aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bishop <[email protected]>2016-09-08 15:55:03 -0400
committerEmil Velikov <[email protected]>2016-09-27 13:37:21 +0100
commitc060f291c26ac22721a515c78c7a4779f389ff7e (patch)
tree7e284f71a50ce038410e847872d789fb66ba54ed
parentaa560e8e6328acd5b8feec1fea54dec06ae21368 (diff)
i915g: add dma-buf support to i915_drm_buffer_get_handle
The implementation of i915_drm_buffer_get_handle now handles DRM_API_HANDLE_TYPE_FD in the same way that intel_winsys_import_handle does, by calling drm_intel_bo_gem_create_from_prime. Tested by successfully running Chrome's ozone_demo [1] with the ozone-gbm backend on an Intel Pineview M machine. Without this change it fails while trying to create a DMA-BUF. [1] https://chromium.googlesource.com/chromium/src.git/+/master/ui/ozone/demo/ozone_demo.cc Signed-off-by: Nicholas Bishop <[email protected]> [Emil Velikov: Fix coding style] Signed-off-by: Emil Velikov <[email protected]>
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_buffer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
index ba454ecf54c..890f7dc2833 100644
--- a/src/gallium/winsys/i915/drm/i915_drm_buffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -153,6 +153,12 @@ i915_drm_buffer_get_handle(struct i915_winsys *iws,
whandle->handle = buf->flink;
} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
whandle->handle = buf->bo->handle;
+ } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
+ int fd;
+
+ if (drm_intel_bo_gem_export_to_prime(buf->bo, &fd))
+ return FALSE;
+ whandle->handle = fd;
} else {
assert(!"unknown usage");
return FALSE;