summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_screen.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-10-14 11:21:04 +0100
committerEric Anholt <[email protected]>2014-12-17 16:07:01 -0800
commit39bc9360116e1c944c1d0d04f67a6ec5f010371f (patch)
treec241e633ec5bdbdf736b46db9e4b33faaac07e27 /src/gallium/drivers/vc4/vc4_screen.c
parent113044e1b9d8f70a26f826f7c03adcbbc8ecb138 (diff)
vc4: Add dmabuf support.
This gets DRI3 working on modesetting with glamor. It's not enabled under simulation, because it looks like handing our dumb-allocated buffers off to the server doesn't actually work for the server's rendering.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_screen.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_screen.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 98c51c1ce7a..b532cc6782f 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -482,6 +482,9 @@ vc4_screen_bo_get_handle(struct pipe_screen *pscreen,
case DRM_API_HANDLE_TYPE_KMS:
whandle->handle = bo->handle;
return TRUE;
+ case DRM_API_HANDLE_TYPE_FD:
+ whandle->handle = vc4_bo_get_dmabuf(bo);
+ return whandle->handle != -1;
}
return FALSE;
@@ -492,20 +495,16 @@ vc4_screen_bo_from_handle(struct pipe_screen *pscreen,
struct winsys_handle *whandle)
{
struct vc4_screen *screen = vc4_screen(pscreen);
- struct vc4_bo *bo;
- if (whandle->type != DRM_API_HANDLE_TYPE_SHARED) {
+ switch (whandle->type) {
+ case DRM_API_HANDLE_TYPE_SHARED:
+ return vc4_bo_open_name(screen, whandle->handle, whandle->stride);
+ case DRM_API_HANDLE_TYPE_FD:
+ return vc4_bo_open_dmabuf(screen, whandle->handle, whandle->stride);
+ default:
fprintf(stderr,
"Attempt to import unsupported handle type %d\n",
whandle->type);
return NULL;
}
-
- bo = vc4_bo_open_name(screen, whandle->handle, whandle->stride);
- if (!bo) {
- fprintf(stderr, "Open name %d failed\n", whandle->handle);
- return NULL;
- }
-
- return bo;
}