From 41ddf1d1506e4a1394ab784d805d1df78b1892e1 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Wed, 16 Jan 2019 10:22:53 -0500 Subject: freedreno: add renderonly scanout This allows creating a fd_screen with a renderonly object which will be used to allocated scanout resources. Signed-off-by: Jonathan Marek Reviewed-by: Eric Anholt [slight tweak to fix uninitialized 'prsc' in debug print] Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_screen.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/freedreno/freedreno_screen.c') diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index b372d5c5596..e596a4e8462 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -147,6 +147,9 @@ fd_screen_destroy(struct pipe_screen *pscreen) if (screen->dev) fd_device_del(screen->dev); + if (screen->ro) + FREE(screen->ro); + fd_bc_fini(&screen->batch_cache); slab_destroy_parent(&screen->transfer_pool); @@ -637,6 +640,7 @@ fd_get_compiler_options(struct pipe_screen *pscreen, boolean fd_screen_bo_get_handle(struct pipe_screen *pscreen, struct fd_bo *bo, + struct renderonly_scanout *scanout, unsigned stride, struct winsys_handle *whandle) { @@ -645,6 +649,8 @@ fd_screen_bo_get_handle(struct pipe_screen *pscreen, if (whandle->type == WINSYS_HANDLE_TYPE_SHARED) { return fd_bo_get_name(bo, &whandle->handle) == 0; } else if (whandle->type == WINSYS_HANDLE_TYPE_KMS) { + if (renderonly_get_handle(scanout, whandle)) + return TRUE; whandle->handle = fd_bo_handle(bo); return TRUE; } else if (whandle->type == WINSYS_HANDLE_TYPE_FD) { @@ -713,7 +719,7 @@ fd_screen_bo_from_handle(struct pipe_screen *pscreen, } struct pipe_screen * -fd_screen_create(struct fd_device *dev) +fd_screen_create(struct fd_device *dev, struct renderonly *ro) { struct fd_screen *screen = CALLOC_STRUCT(fd_screen); struct pipe_screen *pscreen; @@ -734,6 +740,14 @@ fd_screen_create(struct fd_device *dev) screen->dev = dev; screen->refcnt = 1; + if (ro) { + screen->ro = renderonly_dup(ro); + if (!screen->ro) { + DBG("could not create renderonly object"); + goto fail; + } + } + // maybe this should be in context? screen->pipe = fd_pipe_new(screen->dev, FD_PIPE_3D); if (!screen->pipe) { -- cgit v1.2.3