summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2019-08-13 14:33:35 -0700
committerKenneth Graunke <kenneth@whitecape.org>2019-08-21 22:18:22 +0000
commitbc844d92ce0fd000a85c370ecef27ad42a27cf14 (patch)
treed8c120a8a323cb930e62186e724cbfa41e9bac47
parentf02d1a0b75c72f600ecdd73020673e4bec015153 (diff)
gallium/noop: Implement resource_get_param
v2: Pass through to oscreen rather than faking it (review from Marek). Fixes: 0346b700833 ("gallium/screen: Add pipe_screen::resource_get_param") Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/auxiliary/driver_noop/noop_pipe.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/driver_noop/noop_pipe.c b/src/gallium/auxiliary/driver_noop/noop_pipe.c
index ff93db86bd3e..ec619fd33bcc 100644
--- a/src/gallium/auxiliary/driver_noop/noop_pipe.c
+++ b/src/gallium/auxiliary/driver_noop/noop_pipe.c
@@ -156,6 +156,27 @@ static bool noop_resource_get_handle(struct pipe_screen *pscreen,
return result;
}
+static bool noop_resource_get_param(struct pipe_screen *pscreen,
+ struct pipe_resource *resource,
+ unsigned int plane,
+ enum pipe_resource_param param,
+ uint64_t *value)
+{
+ struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)pscreen;
+ struct pipe_screen *screen = noop_screen->oscreen;
+ struct pipe_resource *tex;
+ bool result;
+
+ /* resource_get_param mustn't fail. Just create something and return it. */
+ tex = screen->resource_create(screen, resource);
+ if (!tex)
+ return false;
+
+ result = screen->resource_get_param(screen, tex, 0, param, value);
+ pipe_resource_reference(&tex, NULL);
+ return result;
+}
+
static void noop_resource_destroy(struct pipe_screen *screen,
struct pipe_resource *resource)
{
@@ -502,6 +523,8 @@ struct pipe_screen *noop_screen_create(struct pipe_screen *oscreen)
screen->resource_create = noop_resource_create;
screen->resource_from_handle = noop_resource_from_handle;
screen->resource_get_handle = noop_resource_get_handle;
+ if (oscreen->resource_get_param)
+ screen->resource_get_param = noop_resource_get_param;
screen->resource_destroy = noop_resource_destroy;
screen->flush_frontbuffer = noop_flush_frontbuffer;
screen->get_timestamp = noop_get_timestamp;