--- include/EGL/eglext.h | 8 ++ src/egl/docs/EGL_MESA_drm_image.txt | 147 +++++++++++++++++++++++++++++++++++ src/egl/main/egldisplay.h | 1 + src/egl/main/eglimage.c | 8 ++ src/egl/main/eglimage.h | 5 + src/egl/main/eglmisc.c | 3 + 6 files changed, 172 insertions(+), 0 deletions(-) create mode 100644 src/egl/docs/EGL_MESA_drm_image.txt
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index a00a1e9..371ed38 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -266,6 +266,14 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETIMAGEATTRIBMESA) (EGLDisplay dpy, EGLI #define EGL_SYSTEM_SHARABLE_BIT_MESA 0x0002 /* eglCreateImageKHR value */ #endif /* EGL_MESA_image_system_use */ +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_IMAGE_MESA 0x3203 /* eglCreateImageKHR target */ +#define EGL_DRM_STRIDE_MESA 0x3204 /* eglCreateImageKHR attribute */ +#define EGL_DRM_KMS_HANDLE_MESA 0x3205 /* eglGetImageAttributeMESA attribute */ +#define EGL_DRM_SHARED_HANDLE_MESA 0x3206 /* eglGetImageAttributeMESA attribute */ +#endif /* EGL_MESA_drm_image */ + #ifdef __cplusplus } #endif diff --git a/src/egl/docs/EGL_MESA_drm_image.txt b/src/egl/docs/EGL_MESA_drm_image.txt new file mode 100644 index 0000000..f8e7f70 --- /dev/null +++ b/src/egl/docs/EGL_MESA_drm_image.txt @@ -0,0 +1,147 @@ +Name + + MESA_drm_image + +Name Strings + + EGL_MESA_drm_image + +Contributors + + Jakob Bornecrantz + +Contacts + + Jakob Bornecrantz, (wallbraker 'at' gmail.com) + +Status + + Preliminary - totally subject to change. + +Version + + Version 1, January 20, 2010 + +Number + + EGL Extension #? + +Dependencies + + EGL_KHR_base_image extension + +Overview + + The extensions specified in this document provide a mechanism for creating + EGLImage objects from drm handles and also query handle and stride from + images created with EGL_MESA_image_system_use use cases. + +New Types + + None + +New Procedures and Functions + + None + +New Tokens + + Accepted in the <target> parameter of eglCreateImageKHR: + + EGL_DRM_IMAGE_MESA 0x???? + + Accepted as an attribute in the <attr_list> parameter of + eglCreateImageKHR: + + EGL_DRM_STRIDE_MESA 0x???? + + Accepted as am attribute to eglGetImageAttributeMESA. + + EGL_DRM_STRIDE_MESA 0x???? + EGL_DRM_KMS_HANDLE_MESA 0x???? + EGL_DRM_SHARED_HANDLE_MESA 0x???? + + +Additions to the EGL Image (EGL_KHR_image) Specification: + + Add the following to Table aaa (Legal values for eglCreateImageKHR + <target> parameter), Section 2.5.1 (EGLImage Specification) + + +-------------------------------------+---------------------------------+ + | <target> | Notes | + +-------------------------------------+---------------------------------+ + | EGL_DRM_IMAGE_MESA | Used for DRM images. | + +-------------------------------------+---------------------------------+ + + Add the following to Table bbb (Legal attributes for eglCreateImageKHR + <attr_list> parameter), Section 2.5.1 (EGLImage Specification) + + +------------------------+------------------------------------+---------+ + | | | Default | + | Attribute | Description | Value | + +------------------------+------------------------------------+---------+ + | EGL_DRM_STRIDE_MESA | Specifies the internal stride. | None | + +------------------------+------------------------------------+---------+ + | EGL_WIDTH | Specifies the width in pixels. | None | + +------------------------+------------------------------------+---------+ + | EGL_HEIGHT | Specifies the height in pixels. | None | + +------------------------+------------------------------------+---------+ + + Add the following to Table ??? (Legal values for eglGetImageAttribMESA + <attrib> parameter, Section ??? (???) + + +-------------------------------+---------------------------------------+ + | | | + | Attribute | Description | + +-------------------------------+---------------------------------------+ + | EGL_DRM_STRIDE_MESA | Internal stride of the image. | + +-------------------------------+---------------------------------------+ + | EGL_DRM_KMS_HANDLE_MESA | Handle to be used with kms. | + +-------------------------------+---------------------------------------+ + | EGL_DRM_SHARED_HANDLE_MESA | Handle sharable to other proccess, | + | | see EGL_MESA_drm_image. | + +-------------------------------+---------------------------------------+ + + + Insert the following text after paragraph 3 ("If <target> is + NATIVE_PIXMAP_KHR...") of Section 2.5.1 (EGLImage Specification) + + "If <target> is EGL_DRM_IMAGE_MESA, <dpy> must be a valid EGLDisplay, + and <ctx> must be EGL_NO_CONTEXT. This is because drm has no context. + + If <target> is EGL_DRM_IMAGE_MESA, <buffer> must be the handle to a + valid drm buffer object. <attr_list> must specify the stride, width and + height to be used for the EGLimage. Additional values specified in + <attr_list> are ignored." + + Add the following errors to the end of the list in Section 2.5.1 (EGLImage + Specification): + + " * If <target> is EGL_DRM_IMAGE_MESA, and <dpy> is not a valid + EGLDisplay, the error EGL_BAD_DISPLAY is generated. + + * If <target> is EGL_DRM_IMAGE_MESA, and neither EGL_WIDTH, + EGL_HEIGHT, EGL_DRM_HANDLE_MESA and EGL_DRM_STRIDE_MESA, are + specified, the error EGL_BAD_PARAMETER is generated. + + * If <target> is EGL_DRM_IMAGE_MESA, and EGL_DRM_HANDLE_MESA is + not a valid drm handle to a buffer object, error EGL_BAD_PARAMETER + is generated. + + * <AND SO ON>" + + +Issues + + 1. Should it be able to query the width, height, stride and handle from a + EGL_DRM_IMAGE_MESA object. + + SUGGESTION: No this up to defined by another extension. + + + 2. Should you be able to specify the format? + + SUGGESTION: Yes, add this ASAP. + +Revision History + diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 3413fa3..e792d51 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -51,6 +51,7 @@ struct _egl_extensions EGLBoolean MESA_create_image; EGLBoolean MESA_get_image_attrib; EGLBoolean MESA_image_system_use; + EGLBoolean MESA_drm_image; char String[_EGL_MAX_EXTENSIONS_LEN]; }; diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c index 855c4c0..3eb9a6b 100644 --- a/src/egl/main/eglimage.c +++ b/src/egl/main/eglimage.c @@ -47,6 +47,11 @@ _eglParseImageAttribList(_EGLImage *img, const EGLint *attrib_list) img->UseSystem = val; break; #endif +#ifdef EGL_MESA_drm_image + case EGL_DRM_STRIDE_MESA: + img->DRMStride = val; + break; +#endif default: /* unknown attrs are ignored */ break; @@ -80,6 +85,9 @@ _eglInitImage(_EGLImage *img, _EGLDisplay *dpy, const EGLint *attrib_list) #ifdef EGL_MESA_image_system_use img->UseSystem = 0; #endif +#ifdef EGL_MESA_drm_image + img->DRMStride = 0; +#endif err = _eglParseImageAttribList(img, attrib_list); if (err != EGL_SUCCESS) diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h index f07f12b..2139d20 100644 --- a/src/egl/main/eglimage.h +++ b/src/egl/main/eglimage.h @@ -24,6 +24,11 @@ struct _egl_image #ifdef EGL_MESA_image_system_use EGLint UseSystem; #endif +#ifdef EGL_MESA_drm_image + /* stride and handles must be handled by the driver, + * this value is not queryable */ + EGLint DRMStride; +#endif }; diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index c9329cb..baeb8da 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -104,6 +104,9 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy) #ifdef EGL_MESA_image_system_use _EGL_CHECK_EXTENSION(MESA_image_system_use); #endif +#ifdef EGL_MESA_drm_image + _EGL_CHECK_EXTENSION(MESA_drm_image); +#endif _EGL_CHECK_EXTENSION(NOK_swap_region); _EGL_CHECK_EXTENSION(NOK_texture_from_pixmap); -- 1.7.0.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev