rbug: implement resource creation with modifier
authorLucas Stach <l.stach@pengutronix.de>
Mon, 16 Sep 2019 13:09:38 +0000 (15:09 +0200)
committerLucas Stach <dev@lynxeye.de>
Fri, 18 Oct 2019 10:12:07 +0000 (10:12 +0000)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
src/gallium/auxiliary/driver_rbug/rbug_screen.c

index 6c7a7cfc9eaa2551343bfb1341465d24bd634e18..1a27618ef49d65fbd79d55d7e69a168ef129f8f6 100644 (file)
@@ -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;