summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorVarad Gautam <[email protected]>2017-05-30 17:23:39 +0530
committerEric Engestrom <[email protected]>2017-05-30 13:56:20 +0100
commitde3c459bbd617275a9ed57be42f7c594bae04116 (patch)
tree8428357cad628f626080ddc829148e9c15ed6df5 /src/egl/drivers
parent6719e058d6b8a38cc66accf1609fcabb66571e86 (diff)
egl: implement eglQueryDmaBufModifiersEXT
query and return supported dmabuf format modifiers for EGL_EXT_image_dma_buf_import_modifiers. v2: move format check to the driver instead of making format queries here and then checking. v3: Check DRIimageExtension version before query (Daniel Stone) v4: - move to DRIimageExtension version 15, check queryDmaBufModifiers before calling (Jason Ekstrand) - pass external_only to the driver instead of setting as EGL_TRUE here (Emil Velikov, Daniel Stone) Signed-off-by: Varad Gautam <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c2715528d88..bcafdf9f4c5 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2178,6 +2178,38 @@ dri2_query_dma_buf_formats(_EGLDriver *drv, _EGLDisplay *disp,
return EGL_TRUE;
}
+static EGLBoolean
+dri2_query_dma_buf_modifiers(_EGLDriver *drv, _EGLDisplay *disp, EGLint format,
+ EGLint max, EGLuint64KHR *modifiers,
+ EGLBoolean *external_only, EGLint *count)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+
+ if (max < 0) {
+ _eglError(EGL_BAD_PARAMETER, "invalid value for max count of formats");
+ return EGL_FALSE;
+ }
+
+ if (max > 0 && modifiers == NULL) {
+ _eglError(EGL_BAD_PARAMETER, "invalid modifiers array");
+ return EGL_FALSE;
+ }
+
+ if (dri2_dpy->image->base.version < 15 ||
+ dri2_dpy->image->queryDmaBufModifiers == NULL)
+ return EGL_FALSE;
+
+ if (dri2_dpy->image->queryDmaBufModifiers(dri2_dpy->dri_screen, format,
+ max, modifiers,
+ (unsigned int *) external_only,
+ count) == false) {
+ _eglError(EGL_BAD_PARAMETER, "invalid format");
+ return EGL_FALSE;
+ }
+
+ return EGL_TRUE;
+}
+
/**
* The spec says:
*
@@ -3116,6 +3148,7 @@ _eglBuiltInDriverDRI2(const char *args)
dri2_drv->base.API.ExportDMABUFImageQueryMESA = dri2_export_dma_buf_image_query_mesa;
dri2_drv->base.API.ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa;
dri2_drv->base.API.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats;
+ dri2_drv->base.API.QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers;
#endif
#ifdef HAVE_WAYLAND_PLATFORM
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl;