diff options
author | Julien Isorce <[email protected]> | 2019-04-23 14:26:33 -0700 |
---|---|---|
committer | Julien Isorce <[email protected]> | 2019-04-30 17:53:12 +0000 |
commit | a3c202de0a963c0562796cf75e3a9b3eedf1afad (patch) | |
tree | d5944a294314d5a154833fd2b6b4b5667e1f8166 | |
parent | ec6c2297634eba77248a929048cf4201887a5f0a (diff) |
gallium: add resource_get_info to pipe_screen
Generic plumbing.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/auxiliary/driver_ddebug/dd_screen.c | 12 | ||||
-rw-r--r-- | src/gallium/auxiliary/driver_rbug/rbug_screen.c | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/driver_trace/tr_screen.c | 15 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 9 |
4 files changed, 51 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_screen.c b/src/gallium/auxiliary/driver_ddebug/dd_screen.c index b2108adfa32..ce9f697ad08 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_screen.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_screen.c @@ -311,6 +311,17 @@ dd_screen_resource_get_handle(struct pipe_screen *_screen, return screen->resource_get_handle(screen, pipe, resource, handle, usage); } +static void +dd_screen_resource_get_info(struct pipe_screen *_screen, + struct pipe_resource *resource, + unsigned *stride, + unsigned *offset) +{ + struct pipe_screen *screen = dd_screen(_screen)->screen; + + screen->resource_get_info(screen, resource, stride, offset); +} + static bool dd_screen_check_resource_capability(struct pipe_screen *_screen, struct pipe_resource *resource, @@ -554,6 +565,7 @@ ddebug_screen_create(struct pipe_screen *screen) SCR_INIT(resource_from_user_memory); SCR_INIT(check_resource_capability); dscreen->base.resource_get_handle = dd_screen_resource_get_handle; + SCR_INIT(resource_get_info); SCR_INIT(resource_changed); dscreen->base.resource_destroy = dd_screen_resource_destroy; SCR_INIT(flush_frontbuffer); diff --git a/src/gallium/auxiliary/driver_rbug/rbug_screen.c b/src/gallium/auxiliary/driver_rbug/rbug_screen.c index 693e7fab912..6d93fb8e953 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_screen.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_screen.c @@ -216,6 +216,20 @@ rbug_screen_resource_get_handle(struct pipe_screen *_screen, } static void +rbug_screen_resource_get_info(struct pipe_screen *_screen, + struct pipe_resource *_resource, + unsigned *stride, + unsigned *offset) +{ + 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; + + screen->resource_get_info(screen, resource, stride, offset); +} + +static void rbug_screen_resource_changed(struct pipe_screen *_screen, struct pipe_resource *_resource) { @@ -319,6 +333,7 @@ rbug_screen_create(struct pipe_screen *screen) rb_screen->base.resource_from_handle = rbug_screen_resource_from_handle; SCR_INIT(check_resource_capability); rb_screen->base.resource_get_handle = rbug_screen_resource_get_handle; + SCR_INIT(resource_get_info); SCR_INIT(resource_changed); rb_screen->base.resource_destroy = rbug_screen_resource_destroy; rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer; diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.c b/src/gallium/auxiliary/driver_trace/tr_screen.c index e42aef63552..d14d46d123f 100644 --- a/src/gallium/auxiliary/driver_trace/tr_screen.c +++ b/src/gallium/auxiliary/driver_trace/tr_screen.c @@ -407,6 +407,20 @@ trace_screen_resource_get_handle(struct pipe_screen *_screen, resource, handle, usage); } +static void +trace_screen_resource_get_info(struct pipe_screen *_screen, + struct pipe_resource *resource, + unsigned *stride, + unsigned *offset) +{ + struct trace_screen *tr_screen = trace_screen(_screen); + struct pipe_screen *screen = tr_screen->screen; + + /* TODO trace call */ + + screen->resource_get_info(screen, resource, stride, offset); +} + static struct pipe_resource * trace_screen_resource_from_memobj(struct pipe_screen *_screen, const struct pipe_resource *templ, @@ -673,6 +687,7 @@ trace_screen_create(struct pipe_screen *screen) tr_scr->base.resource_from_handle = trace_screen_resource_from_handle; SCR_INIT(check_resource_capability); tr_scr->base.resource_get_handle = trace_screen_resource_get_handle; + SCR_INIT(resource_get_info); SCR_INIT(resource_from_memobj); SCR_INIT(resource_changed); tr_scr->base.resource_destroy = trace_screen_resource_destroy; diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index d4e2d9f63ac..3f9bad47095 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -263,6 +263,15 @@ struct pipe_screen { unsigned usage); /** + * Get stride and offset for the given pipe resource without the need to get + * a winsys_handle. + */ + void (*resource_get_info)(struct pipe_screen *screen, + struct pipe_resource *resource, + unsigned *stride, + unsigned *offset); + + /** * Mark the resource as changed so derived internal resources will be * recreated on next use. * |