From 93d47932b843aecdad7277287bf1850c16bf2f29 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Mon, 16 Sep 2019 15:09:38 +0200 Subject: [PATCH] rbug: implement resource creation with modifier Signed-off-by: Lucas Stach --- .../auxiliary/driver_rbug/rbug_screen.c | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/gallium/auxiliary/driver_rbug/rbug_screen.c b/src/gallium/auxiliary/driver_rbug/rbug_screen.c index 6c7a7cfc9ea..1a27618ef49 100644 --- a/src/gallium/auxiliary/driver_rbug/rbug_screen.c +++ b/src/gallium/auxiliary/driver_rbug/rbug_screen.c @@ -138,6 +138,23 @@ rbug_screen_is_format_supported(struct pipe_screen *_screen, tex_usage); } +static void +rbug_screen_query_dmabuf_modifiers(struct pipe_screen *_screen, + enum pipe_format format, int max, + uint64_t *modifiers, + unsigned int *external_only, int *count) +{ + struct rbug_screen *rb_screen = rbug_screen(_screen); + struct pipe_screen *screen = rb_screen->screen; + + screen->query_dmabuf_modifiers(screen, + format, + max, + modifiers, + external_only, + count); +} + static struct pipe_context * rbug_screen_context_create(struct pipe_screen *_screen, void *priv, unsigned flags) @@ -179,6 +196,25 @@ rbug_screen_resource_create(struct pipe_screen *_screen, return NULL; } +static struct pipe_resource * +rbug_screen_resource_create_with_modifiers(struct pipe_screen *_screen, + const struct pipe_resource *templat, + const uint64_t *modifiers, int count) +{ + struct rbug_screen *rb_screen = rbug_screen(_screen); + struct pipe_screen *screen = rb_screen->screen; + struct pipe_resource *result; + + result = screen->resource_create_with_modifiers(screen, + templat, + modifiers, + count); + + if (result) + return rbug_resource_create(rb_screen, result); + return NULL; +} + static struct pipe_resource * rbug_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, @@ -371,9 +407,11 @@ rbug_screen_create(struct pipe_screen *screen) rb_screen->base.get_shader_param = rbug_screen_get_shader_param; rb_screen->base.get_paramf = rbug_screen_get_paramf; rb_screen->base.is_format_supported = rbug_screen_is_format_supported; + SCR_INIT(query_dmabuf_modifiers); rb_screen->base.context_create = rbug_screen_context_create; SCR_INIT(can_create_resource); rb_screen->base.resource_create = rbug_screen_resource_create; + SCR_INIT(resource_create_with_modifiers); 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; -- 2.30.2