[Mesa-dev] [PATCH 3/3] noop: implement resource_get_handle
Marek Olšák
maraeo at gmail.com
Mon Aug 29 15:29:48 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
X+DRI3 locks up if the returned handle is invalid.
---
src/gallium/drivers/noop/noop_pipe.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index 25e0c1f..3013019 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -127,27 +127,39 @@ static struct pipe_resource *noop_resource_from_handle(struct pipe_screen *scree
struct pipe_screen *oscreen = noop_screen->oscreen;
struct pipe_resource *result;
struct pipe_resource *noop_resource;
result = oscreen->resource_from_handle(oscreen, templ, handle, usage);
noop_resource = noop_resource_create(screen, result);
pipe_resource_reference(&result, NULL);
return noop_resource;
}
-static boolean noop_resource_get_handle(struct pipe_screen *screen,
+static boolean noop_resource_get_handle(struct pipe_screen *pscreen,
struct pipe_context *ctx,
struct pipe_resource *resource,
struct winsys_handle *handle,
unsigned usage)
{
- return FALSE;
+ 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_handle musn't fail. Just create something and return it. */
+ tex = screen->resource_create(screen, resource);
+ if (!tex)
+ return false;
+
+ result = screen->resource_get_handle(screen, NULL, tex, handle, usage);
+ pipe_resource_reference(&tex, NULL);
+ return result;
}
static void noop_resource_destroy(struct pipe_screen *screen,
struct pipe_resource *resource)
{
struct noop_resource *nresource = (struct noop_resource *)resource;
FREE(nresource->data);
FREE(resource);
}
--
2.7.4
More information about the mesa-dev
mailing list