summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-01-24 13:58:00 +0100
committerNicolai Hähnle <nicolai.haehnle@amd.com>2018-03-14 09:04:01 +0100
commit6179179b42153392825b5f9c26bde0f54bd3c784 (patch)
tree2b3092452e6b4daed1d3e62b2cdb45723e7f5320
parent1a13c2a842223d7f452219790169abb0df42c7ca (diff)
egl: add support for EGL_MESA_drm_image_formats
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c21
-rw-r--r--src/egl/main/eglapi.c2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 864f7eb0c6..90c7d191f1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2136,7 +2136,15 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
switch (attrs.DRMBufferFormatMESA) {
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
format = __DRI_IMAGE_FORMAT_ARGB8888;
- pitch = attrs.DRMBufferStrideMESA;
+ break;
+ case EGL_DRM_BUFFER_FORMAT_ARGB2101010_MESA:
+ format = __DRI_IMAGE_FORMAT_ARGB2101010;
+ break;
+ case EGL_DRM_BUFFER_FORMAT_ARGB1555_MESA:
+ format = __DRI_IMAGE_FORMAT_ARGB1555;
+ break;
+ case EGL_DRM_BUFFER_FORMAT_RGB565_MESA:
+ format = __DRI_IMAGE_FORMAT_RGB565;
break;
default:
_eglError(EGL_BAD_PARAMETER,
@@ -2144,6 +2152,8 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
+ pitch = attrs.DRMBufferStrideMESA;
+
dri_image =
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
attrs.Width,
@@ -2528,6 +2538,15 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp,
case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA:
format = __DRI_IMAGE_FORMAT_ARGB8888;
break;
+ case EGL_DRM_BUFFER_FORMAT_ARGB2101010_MESA:
+ format = __DRI_IMAGE_FORMAT_ARGB2101010;
+ break;
+ case EGL_DRM_BUFFER_FORMAT_ARGB1555_MESA:
+ format = __DRI_IMAGE_FORMAT_ARGB1555;
+ break;
+ case EGL_DRM_BUFFER_FORMAT_RGB565_MESA:
+ format = __DRI_IMAGE_FORMAT_RGB565;
+ break;
default:
_eglError(EGL_BAD_PARAMETER, __func__);
return EGL_NO_IMAGE_KHR;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index c110349119..ee85864515 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -521,6 +521,8 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
if (dpy->Extensions.KHR_no_config_context)
_eglAppendExtension(&exts, "EGL_MESA_configless_context");
_EGL_CHECK_EXTENSION(MESA_drm_image);
+ if (dpy->Extensions.MESA_drm_image)
+ _eglAppendExtension(&exts, "EGL_MESA_drm_image_formats");
_EGL_CHECK_EXTENSION(MESA_image_dma_buf_export);
_EGL_CHECK_EXTENSION(NOK_swap_region);