Generic plumbing.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
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,
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);
resource, handle, usage);
}
+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)
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;
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,
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;
struct winsys_handle *handle,
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.