summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_screen.c
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-01-16 10:22:53 -0500
committerRob Clark <[email protected]>2019-01-26 10:47:21 -0500
commit41ddf1d1506e4a1394ab784d805d1df78b1892e1 (patch)
treeb546fe3b3299e8d2ac589294d23e8cd9088c65f3 /src/gallium/drivers/freedreno/freedreno_screen.c
parentcd79b5e0c2cc0035719348592bac97dce6ce1d73 (diff)
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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]> [slight tweak to fix uninitialized 'prsc' in debug print] Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_screen.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c16
1 files changed, 15 insertions, 1 deletions
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) {