diff options
author | Dave Airlie <[email protected]> | 2017-07-12 18:45:09 -0400 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-08-06 12:42:06 +1000 |
commit | 714dfaae726534c3791df1ef8a9768f4435166d8 (patch) | |
tree | fdf95541a8147798dfb78a2d280c79f3da8255a3 /src/gallium/drivers/ddebug/dd_screen.c | |
parent | 1e8e4ee230af2484d6aa22dfcc99ed4354f5842e (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/ddebug/dd_screen.c')
-rw-r--r-- | src/gallium/drivers/ddebug/dd_screen.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 14e6f6b011f..51382da1d73 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -245,6 +245,22 @@ dd_screen_resource_from_user_memory(struct pipe_screen *_screen, return res; } +static struct pipe_resource * +dd_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 = dd_screen(_screen)->screen; + struct pipe_resource *res = + screen->resource_from_memobj(screen, templ, memobj, offset); + + if (!res) + return NULL; + res->screen = _screen; + return res; +} + static void dd_screen_resource_changed(struct pipe_screen *_screen, struct pipe_resource *res) @@ -303,7 +319,28 @@ dd_screen_fence_finish(struct pipe_screen *_screen, return screen->fence_finish(screen, ctx, fence, timeout); } +/******************************************************************** + * memobj + */ + +static struct pipe_memory_object * +dd_screen_memobj_create_from_handle(struct pipe_screen *_screen, + struct winsys_handle *handle, + bool dedicated) +{ + struct pipe_screen *screen = dd_screen(_screen)->screen; + + return screen->memobj_create_from_handle(screen, handle, dedicated); +} + +static void +dd_screen_memobj_destroy(struct pipe_screen *_screen, + struct pipe_memory_object *memobj) +{ + struct pipe_screen *screen = dd_screen(_screen)->screen; + screen->memobj_destroy(screen, memobj); +} /******************************************************************** * screen */ @@ -412,6 +449,7 @@ ddebug_screen_create(struct pipe_screen *screen) SCR_INIT(can_create_resource); dscreen->base.resource_create = dd_screen_resource_create; dscreen->base.resource_from_handle = dd_screen_resource_from_handle; + SCR_INIT(resource_from_memobj); SCR_INIT(resource_from_user_memory); dscreen->base.resource_get_handle = dd_screen_resource_get_handle; SCR_INIT(resource_changed); @@ -419,6 +457,8 @@ ddebug_screen_create(struct pipe_screen *screen) SCR_INIT(flush_frontbuffer); SCR_INIT(fence_reference); SCR_INIT(fence_finish); + SCR_INIT(memobj_create_from_handle); + SCR_INIT(memobj_destroy); SCR_INIT(get_driver_query_info); SCR_INIT(get_driver_query_group_info); SCR_INIT(get_compiler_options); |