summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/trace/tr_screen.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-07-12 18:45:09 -0400
committerTimothy Arceri <[email protected]>2017-08-06 12:42:06 +1000
commit714dfaae726534c3791df1ef8a9768f4435166d8 (patch)
treefdf95541a8147798dfb78a2d280c79f3da8255a3 /src/gallium/drivers/trace/tr_screen.c
parent1e8e4ee230af2484d6aa22dfcc99ed4354f5842e (diff)
gallium: introduce memory object
v2: fix comment regarding fd ownership, define pipe_memory_object v3: remove stray return v4 (Timothy Arceri): update trace v5 (Timothy Arceri): actually dump the params in trace Reviewed-by: Marek Olšák <[email protected]> (v3) Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src/gallium/drivers/trace/tr_screen.c')
-rw-r--r--src/gallium/drivers/trace/tr_screen.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index e56434c5bda..c499aa69804 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -367,6 +367,32 @@ trace_screen_resource_get_handle(struct pipe_screen *_screen,
resource, handle, usage);
}
+static struct pipe_resource *
+trace_screen_resource_from_memobj(struct pipe_screen *_screen,
+ const struct pipe_resource *templ,
+ struct pipe_memory_object *memobj,
+ uint64_t offset)
+{
+ struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+ trace_dump_call_begin("pipe_screen", "resource_from_memobj");
+ trace_dump_arg(ptr, screen);
+ trace_dump_arg(resource_template, templ);
+ trace_dump_arg(ptr, memobj);
+ trace_dump_arg(uint, offset);
+
+ struct pipe_resource *res =
+ screen->resource_from_memobj(screen, templ, memobj, offset);
+
+ if (!res)
+ return NULL;
+ res->screen = _screen;
+
+ trace_dump_ret(ptr, res);
+ trace_dump_call_end();
+ return res;
+}
+
static void
trace_screen_resource_changed(struct pipe_screen *_screen,
struct pipe_resource *resource)
@@ -457,6 +483,46 @@ trace_screen_fence_finish(struct pipe_screen *_screen,
/********************************************************************
+ * memobj
+ */
+
+static struct pipe_memory_object *
+trace_screen_memobj_create_from_handle(struct pipe_screen *_screen,
+ struct winsys_handle *handle,
+ bool dedicated)
+{
+ struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+ trace_dump_call_begin("pipe_screen", "memobj_create_from_handle");
+ trace_dump_arg(ptr, screen);
+ trace_dump_arg(ptr, handle);
+ trace_dump_arg(bool, dedicated);
+
+ struct pipe_memory_object *res =
+ screen->memobj_create_from_handle(screen, handle, dedicated);
+
+ trace_dump_ret(ptr, res);
+ trace_dump_call_end();
+
+ return res;
+}
+
+static void
+trace_screen_memobj_destroy(struct pipe_screen *_screen,
+ struct pipe_memory_object *memobj)
+{
+ struct pipe_screen *screen = trace_screen(_screen)->screen;
+
+ trace_dump_call_begin("pipe_screen", "memobj_destroy");
+ trace_dump_arg(ptr, screen);
+ trace_dump_arg(ptr, memobj);
+ trace_dump_call_end();
+
+ screen->memobj_destroy(screen, memobj);
+}
+
+
+/********************************************************************
* screen
*/
@@ -542,10 +608,13 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.resource_create = trace_screen_resource_create;
tr_scr->base.resource_from_handle = trace_screen_resource_from_handle;
tr_scr->base.resource_get_handle = trace_screen_resource_get_handle;
+ SCR_INIT(resource_from_memobj);
SCR_INIT(resource_changed);
tr_scr->base.resource_destroy = trace_screen_resource_destroy;
tr_scr->base.fence_reference = trace_screen_fence_reference;
tr_scr->base.fence_finish = trace_screen_fence_finish;
+ SCR_INIT(memobj_create_from_handle);
+ SCR_INIT(memobj_destroy);
tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
tr_scr->base.get_timestamp = trace_screen_get_timestamp;