diff options
author | Marek Olšák <[email protected]> | 2016-02-24 18:51:15 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-03-09 15:02:25 +0100 |
commit | 82db518f1519cec9e3842f23455a105e2006afbd (patch) | |
tree | 5baa1ddfa03e94f1edc53b10473c67b9dce26fee /src/gallium/drivers | |
parent | d943ac432de1f46cea47bdbf5ffe5365e2aef386 (diff) |
gallium: add external usage flags to resource_from(get)_handle (v2)
This will allow drivers to make better decisions about texture sharing
for DRI2, DRI3, Wayland, and OpenCL.
v2: add read/write flags, take advantage of __DRI_IMAGE_USE_BACKBUFFER
Reviewed-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/ddebug/dd_screen.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_resource.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_texture.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/noop/noop_pipe.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.h | 7 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/rbug/rbug_screen.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_texture.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_screen.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_resource.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/virgl_resource.c | 3 |
18 files changed, 64 insertions, 35 deletions
diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 3706b2d63f5..fbc0bec73dd 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -179,11 +179,12 @@ dd_screen_resource_create(struct pipe_screen *_screen, static struct pipe_resource * dd_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct pipe_screen *screen = dd_screen(_screen)->screen; struct pipe_resource *res = - screen->resource_from_handle(screen, templ, handle); + screen->resource_from_handle(screen, templ, handle, usage); if (!res) return NULL; @@ -218,11 +219,12 @@ dd_screen_resource_destroy(struct pipe_screen *_screen, static boolean dd_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *resource, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct pipe_screen *screen = dd_screen(_screen)->screen; - return screen->resource_get_handle(screen, resource, handle); + return screen->resource_get_handle(screen, resource, handle, usage); } diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index bcdd518c8bf..9aded3bb7fe 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -637,7 +637,8 @@ fail: static struct pipe_resource * fd_resource_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *tmpl, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct fd_resource *rsc = CALLOC_STRUCT(fd_resource); struct fd_resource_slice *slice = &rsc->slices[0]; diff --git a/src/gallium/drivers/i915/i915_resource.c b/src/gallium/drivers/i915/i915_resource.c index 627ed2b4445..3ffb0b7a5d2 100644 --- a/src/gallium/drivers/i915/i915_resource.c +++ b/src/gallium/drivers/i915/i915_resource.c @@ -23,7 +23,8 @@ i915_resource_create(struct pipe_screen *screen, static struct pipe_resource * i915_resource_from_handle(struct pipe_screen * screen, const struct pipe_resource *template, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { if (template->target == PIPE_BUFFER) return NULL; diff --git a/src/gallium/drivers/ilo/ilo_resource.c b/src/gallium/drivers/ilo/ilo_resource.c index 9026ba9a983..8c888c529c4 100644 --- a/src/gallium/drivers/ilo/ilo_resource.c +++ b/src/gallium/drivers/ilo/ilo_resource.c @@ -714,7 +714,8 @@ ilo_resource_create(struct pipe_screen *screen, static struct pipe_resource * ilo_resource_from_handle(struct pipe_screen *screen, const struct pipe_resource *templ, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { if (templ->target == PIPE_BUFFER) return NULL; @@ -725,7 +726,8 @@ ilo_resource_from_handle(struct pipe_screen *screen, static boolean ilo_resource_get_handle(struct pipe_screen *screen, struct pipe_resource *res, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { if (res->target == PIPE_BUFFER) return false; diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index ae266ceb082..c2ca8b8d6a0 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -434,7 +434,8 @@ llvmpipe_resource_data(struct pipe_resource *resource) static struct pipe_resource * llvmpipe_resource_from_handle(struct pipe_screen *screen, const struct pipe_resource *template, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct sw_winsys *winsys = llvmpipe_screen(screen)->winsys; struct llvmpipe_resource *lpr; @@ -485,7 +486,8 @@ no_lpr: static boolean llvmpipe_resource_get_handle(struct pipe_screen *screen, struct pipe_resource *pt, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct sw_winsys *winsys = llvmpipe_screen(screen)->winsys; struct llvmpipe_resource *lpr = llvmpipe_resource(pt); diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c index 165284a90bf..fd0a5d0f830 100644 --- a/src/gallium/drivers/noop/noop_pipe.c +++ b/src/gallium/drivers/noop/noop_pipe.c @@ -114,14 +114,15 @@ static struct pipe_resource *noop_resource_create(struct pipe_screen *screen, static struct pipe_resource *noop_resource_from_handle(struct pipe_screen *screen, const struct pipe_resource *templ, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen; struct pipe_screen *oscreen = noop_screen->oscreen; struct pipe_resource *result; struct pipe_resource *noop_resource; - result = oscreen->resource_from_handle(oscreen, templ, handle); + result = oscreen->resource_from_handle(oscreen, templ, handle, usage); noop_resource = noop_resource_create(screen, result); pipe_resource_reference(&result, NULL); return noop_resource; @@ -129,7 +130,8 @@ static struct pipe_resource *noop_resource_from_handle(struct pipe_screen *scree static boolean noop_resource_get_handle(struct pipe_screen *screen, struct pipe_resource *resource, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { return FALSE; } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_resource.c b/src/gallium/drivers/nouveau/nv30/nv30_resource.c index a98a6464de8..4d215d2e616 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_resource.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_resource.c @@ -66,7 +66,8 @@ nv30_resource_create(struct pipe_screen *pscreen, static struct pipe_resource * nv30_resource_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *tmpl, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { if (tmpl->target == PIPE_BUFFER) return NULL; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_resource.c b/src/gallium/drivers/nouveau/nv50/nv50_resource.c index 5d415ae77eb..ad5f3b814db 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_resource.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_resource.c @@ -22,7 +22,8 @@ nv50_resource_create(struct pipe_screen *screen, static struct pipe_resource * nv50_resource_from_handle(struct pipe_screen * screen, const struct pipe_resource *templ, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { if (templ->target == PIPE_BUFFER) return NULL; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c index 7fbc6e1fd8e..c034d0fd011 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c @@ -19,7 +19,8 @@ nvc0_resource_create(struct pipe_screen *screen, static struct pipe_resource * nvc0_resource_from_handle(struct pipe_screen * screen, const struct pipe_resource *templ, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { if (templ->target == PIPE_BUFFER) { return NULL; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index e90e741a353..2b9018a5de3 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -971,7 +971,8 @@ static void r300_texture_destroy(struct pipe_screen *screen, boolean r300_resource_get_handle(struct pipe_screen* screen, struct pipe_resource *texture, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct radeon_winsys *rws = r300_screen(screen)->rws; struct r300_resource* tex = (struct r300_resource*)texture; @@ -1097,7 +1098,8 @@ struct pipe_resource *r300_texture_create(struct pipe_screen *screen, struct pipe_resource *r300_texture_from_handle(struct pipe_screen *screen, const struct pipe_resource *base, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct r300_screen *rscreen = r300_screen(screen); struct radeon_winsys *rws = rscreen->rws; diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 213bdffc2ed..4c339429eca 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -25,6 +25,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_format.h" +#include "pipe/p_screen.h" struct pipe_screen; struct pipe_context; @@ -62,12 +63,14 @@ void r300_texture_setup_format_state(struct r300_screen *screen, boolean r300_resource_get_handle(struct pipe_screen* screen, struct pipe_resource *texture, - struct winsys_handle *whandle); + struct winsys_handle *whandle, + unsigned usage); struct pipe_resource* r300_texture_from_handle(struct pipe_screen* screen, const struct pipe_resource* base, - struct winsys_handle *whandle); + struct winsys_handle *whandle, + unsigned usage); struct pipe_resource* r300_texture_create(struct pipe_screen* screen, diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 0b31d0a1f01..e441936b447 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -230,7 +230,8 @@ static int r600_setup_surface(struct pipe_screen *screen, static boolean r600_texture_get_handle(struct pipe_screen* screen, struct pipe_resource *ptex, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct r600_texture *rtex = (struct r600_texture*)ptex; struct r600_resource *resource = &rtex->resource; @@ -877,7 +878,8 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen, const struct pipe_resource *templ, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct r600_common_screen *rscreen = (struct r600_common_screen*)screen; struct pb_buffer *buf = NULL; diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c index ac764029a2f..c2950e4a703 100644 --- a/src/gallium/drivers/rbug/rbug_screen.c +++ b/src/gallium/drivers/rbug/rbug_screen.c @@ -160,13 +160,14 @@ rbug_screen_resource_create(struct pipe_screen *_screen, static struct pipe_resource * rbug_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *result; - result = screen->resource_from_handle(screen, templ, handle); + result = screen->resource_from_handle(screen, templ, handle, usage); result = rbug_resource_create(rbug_screen(_screen), result); @@ -176,14 +177,15 @@ rbug_screen_resource_from_handle(struct pipe_screen *_screen, static boolean rbug_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *_resource, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct rbug_screen *rb_screen = rbug_screen(_screen); struct rbug_resource *rb_resource = rbug_resource(_resource); struct pipe_screen *screen = rb_screen->screen; struct pipe_resource *resource = rb_resource->resource; - return screen->resource_get_handle(screen, resource, handle); + return screen->resource_get_handle(screen, resource, handle, usage); } diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 52df89504b8..52ec373f8f2 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -218,7 +218,8 @@ softpipe_resource_destroy(struct pipe_screen *pscreen, static struct pipe_resource * softpipe_resource_from_handle(struct pipe_screen *screen, const struct pipe_resource *templat, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct sw_winsys *winsys = softpipe_screen(screen)->winsys; struct softpipe_resource *spr = CALLOC_STRUCT(softpipe_resource); @@ -251,7 +252,8 @@ softpipe_resource_from_handle(struct pipe_screen *screen, static boolean softpipe_resource_get_handle(struct pipe_screen *screen, struct pipe_resource *pt, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct sw_winsys *winsys = softpipe_screen(screen)->winsys; struct softpipe_resource *spr = softpipe_resource(pt); diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index 1c3bcd67afa..264ac335405 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -47,7 +47,8 @@ svga_resource_create(struct pipe_screen *screen, static struct pipe_resource * svga_resource_from_handle(struct pipe_screen * screen, const struct pipe_resource *template, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { if (template->target == PIPE_BUFFER) return NULL; diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 0612109c800..b24e1856aca 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -313,7 +313,8 @@ trace_screen_resource_create(struct pipe_screen *_screen, static struct pipe_resource * trace_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct trace_screen *tr_screen = trace_screen(_screen); struct pipe_screen *screen = tr_screen->screen; @@ -321,7 +322,7 @@ trace_screen_resource_from_handle(struct pipe_screen *_screen, /* TODO trace call */ - result = screen->resource_from_handle(screen, templ, handle); + result = screen->resource_from_handle(screen, templ, handle, usage); result = trace_resource_create(trace_screen(_screen), result); @@ -331,7 +332,8 @@ trace_screen_resource_from_handle(struct pipe_screen *_screen, static boolean trace_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *_resource, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct trace_screen *tr_screen = trace_screen(_screen); struct trace_resource *tr_resource = trace_resource(_resource); @@ -340,7 +342,7 @@ trace_screen_resource_get_handle(struct pipe_screen *_screen, /* TODO trace call */ - return screen->resource_get_handle(screen, resource, handle); + return screen->resource_get_handle(screen, resource, handle, usage); } diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index 036da329987..ea212af0512 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -523,7 +523,8 @@ fail: static struct pipe_resource * vc4_resource_from_handle(struct pipe_screen *pscreen, const struct pipe_resource *tmpl, - struct winsys_handle *handle) + struct winsys_handle *handle, + unsigned usage) { struct vc4_resource *rsc = vc4_resource_setup(pscreen, tmpl); struct pipe_resource *prsc = &rsc->base.b; diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c index 0b2fc4ec497..2b3794765e2 100644 --- a/src/gallium/drivers/virgl/virgl_resource.c +++ b/src/gallium/drivers/virgl/virgl_resource.c @@ -64,7 +64,8 @@ static struct pipe_resource *virgl_resource_create(struct pipe_screen *screen, static struct pipe_resource *virgl_resource_from_handle(struct pipe_screen *screen, const struct pipe_resource *templ, - struct winsys_handle *whandle) + struct winsys_handle *whandle, + unsigned usage) { struct virgl_screen *vs = virgl_screen(screen); if (templ->target == PIPE_BUFFER) |