diff options
author | Dave Airlie <[email protected]> | 2014-03-03 13:57:16 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2015-04-01 14:10:04 +1000 |
commit | 8f7338f284cdb1fef64c85e3293d2200d0cc6387 (patch) | |
tree | 23fed8ea291e6859c04fee041ba9b22d8d7e0fc4 /src/mesa | |
parent | 22ccdf12dd7b5db6eb0c8f2b03c3516f8376fdad (diff) |
egl: add initial EGL_MESA_image_dma_buf_export v2.4
At the moment to get an EGL image to a dma-buf file descriptor,
you have to use EGL_MESA_drm_image, and then use libdrm to
convert this to a file descriptor.
This extension just provides an API modelled on EGL_MESA_drm_image,
to return a dma-buf file descriptor.
v2: update spec for new API proposal
add internal queries to get the fourcc back from intel driver.
v2.1: add gallium pieces.
v2.2: add offsets to spec and API, rename fd->fds, stride->strides
in API. rewrite spec a bit more, add some q/a
v2.3:
add modifiers to query interface and 64-bit type for that (Daniel Stone)
specifiy what happens to num fds vs num planes differences. (Chad Versace)
v2.4:
fix grammar (Daniel Stone)
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 3640b675471..cb9710fc6e6 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -300,6 +300,17 @@ intel_image_format_lookup(int fourcc) return f; } +static boolean intel_lookup_fourcc(int dri_format, int *fourcc) +{ + for (unsigned i = 0; i < ARRAY_SIZE(intel_image_formats); i++) { + if (intel_image_formats[i].planes[0].dri_format == dri_format) { + *fourcc = intel_image_formats[i].fourcc; + return true; + } + } + return false; +} + static __DRIimage * intel_allocate_image(int dri_format, void *loaderPrivate) { @@ -559,6 +570,14 @@ intel_query_image(__DRIimage *image, int attrib, int *value) if (drm_intel_bo_gem_export_to_prime(image->bo, value) == 0) return true; return false; + case __DRI_IMAGE_ATTRIB_FOURCC: + if (intel_lookup_fourcc(image->dri_format, value)) + return true; + return false; + case __DRI_IMAGE_ATTRIB_NUM_PLANES: + *value = 1; + return true; + default: return false; } @@ -784,7 +803,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate) } static const __DRIimageExtension intelImageExtension = { - .base = { __DRI_IMAGE, 8 }, + .base = { __DRI_IMAGE, 11 }, .createImageFromName = intel_create_image_from_name, .createImageFromRenderbuffer = intel_create_image_from_renderbuffer, @@ -797,7 +816,9 @@ static const __DRIimageExtension intelImageExtension = { .fromPlanar = intel_from_planar, .createImageFromTexture = intel_create_image_from_texture, .createImageFromFds = intel_create_image_from_fds, - .createImageFromDmaBufs = intel_create_image_from_dma_bufs + .createImageFromDmaBufs = intel_create_image_from_dma_bufs, + .blitImage = NULL, + .getCapabilities = NULL }; static int |