[Mesa-dev] [PATCH 1/6] egl: Add EGL_MESA_create_image
Jakob Bornecrantz
wallbraker at gmail.com
Sat May 29 05:56:29 PDT 2010
---
include/EGL/eglext.h | 5 ++
src/egl/docs/EGL_MESA_create_image.txt | 113 ++++++++++++++++++++++++++++++++
src/egl/main/egldisplay.h | 1 +
src/egl/main/eglimage.c | 12 ++++
src/egl/main/eglimage.h | 4 +
src/egl/main/eglmisc.c | 3 +
6 files changed, 138 insertions(+), 0 deletions(-)
create mode 100644 src/egl/docs/EGL_MESA_create_image.txt
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index e9f5a49..317209d 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -246,6 +246,11 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG
#endif /* EGL_NOK_texture_from_pixmap */
+#ifndef EGL_MESA_create_image
+#define EGL_MESA_create_image 1
+#define EGL_NEW_IMAGE_MESA 0x3200 /* eglCreateImageKHR target */
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/src/egl/docs/EGL_MESA_create_image.txt b/src/egl/docs/EGL_MESA_create_image.txt
new file mode 100644
index 0000000..da208ad
--- /dev/null
+++ b/src/egl/docs/EGL_MESA_create_image.txt
@@ -0,0 +1,113 @@
+Name
+
+ MESA_create_image
+
+Name Strings
+
+ EGL_MESA_create_image
+
+Contributors
+
+ Jakob Bornecrantz
+
+Contacts
+
+ Jakob Bornecrantz, (wallbraker 'at' gmail.com)
+
+Status
+
+ Preliminary - totally subject to change.
+
+Version
+
+ Version 1, February 18, 2010
+
+Number
+
+ EGL Extension #?
+
+Dependencies
+
+ EGL_KHR_base_image is required
+
+Overview
+
+ The extensions specified in this document provide a mechanism for creating
+ EGLImages owned by EGL and not a client API.
+
+New Types
+
+ None
+
+New Procedures and Functions
+
+ None
+
+New Tokens
+
+ Accepted in the <target> parameter of eglCreateImageKHR:
+
+ EGL_NEW_IMAGE_MESA 0x????
+
+ Accepted as an attribute in the <attr_list> parameter of
+ eglCreateImageKHR:
+
+ EGL_WIDTH 0x????
+ EGL_HEIGHT 0x????
+
+
+Additions to the EGL Image (EGL_KHR_base_image) Specification:
+
+ Add the following to Table aaa (Legal values for eglCreateImageKHR
+ <target> parameter), Section 2.5.1 (EGLImage Specification)
+
+ +-------------------------------------+---------------------------------+
+ | <target> | Notes |
+ +-------------------------------------+---------------------------------+
+ | EGL_NEW_IMAGE_MESA | Create new 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_WIDTH | Image width in pixels. | 0 |
+ +------------------------+------------------------------------+---------+
+ | EGL_HEIGHT | Image height in pixels | 0 |
+ +------------------------+------------------------------------+---------+
+
+
+ Insert the following text after paragraph 3 ("If <target> is
+ NATIVE_PIXMAP_KHR...") of Section 2.5.1 (EGLImage Specification)
+
+ "If <target> is EGL_NEW_IMAGE_MESA, <dpy> must be a valid EGLDisplay;
+ <ctx> must be EGL_NO_CONTEXT; <buffer> must be zero; and the attributes
+ allowed are EGL_WIDTH and EGL_HEIGHT.
+
+ Add the following errors to the end of the list in Section 2.5.1 (EGLImage
+ Specification):
+
+ " * If <target> is EGL_NEW_IMAGE_MESA, and <dpy> is not a valid
+ EGLDisplay, the error EGL_BAD_DISPLAY is generated.
+
+ * If <target> is EGL_NEW_IMAGE_MESA, and neither EGL_WIDTH; and
+ EGL_HEIGHT, are specified, the error EGL_BAD_PARAMETER is generated.
+
+ * <AND SO ON>"
+
+
+Issues
+
+ 1. Should it be possible to specify the format of the new EGLImage?
+
+ SUGGESTION: Add tokens for this later on, right now this is all
+ that is needed.
+
+
+
+
+Revision History
+
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 42e305f..5b870b6 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -48,6 +48,7 @@ struct _egl_extensions
EGLBoolean KHR_gl_renderbuffer_image;
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
+ EGLBoolean MESA_create_image;
char String[_EGL_MAX_EXTENSIONS_LEN];
};
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 5732ef3..f92553b 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -34,6 +34,14 @@ _eglParseImageAttribList(_EGLImage *img, const EGLint *attrib_list)
case EGL_GL_TEXTURE_ZOFFSET_KHR:
img->GLTextureZOffset = val;
break;
+#ifdef EGL_MESA_create_image
+ case EGL_WIDTH:
+ img->Width = val;
+ break;
+ case EGL_HEIGHT:
+ img->Height = val;
+ break;
+#endif
default:
/* unknown attrs are ignored */
break;
@@ -60,6 +68,10 @@ _eglInitImage(_EGLImage *img, _EGLDisplay *dpy, const EGLint *attrib_list)
img->Preserved = EGL_FALSE;
img->GLTextureLevel = 0;
img->GLTextureZOffset = 0;
+#ifdef EGL_MESA_create_image
+ img->Width = 0;
+ img->Height = 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 2c0fb16..3020cda 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -17,6 +17,10 @@ struct _egl_image
EGLBoolean Preserved;
EGLint GLTextureLevel;
EGLint GLTextureZOffset;
+#ifdef EGL_MESA_create_image
+ EGLint Width;
+ EGLint Height;
+#endif
};
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index e62a9e7..2c344c0 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -95,6 +95,9 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
_EGL_CHECK_EXTENSION(KHR_gl_texture_cubemap_image);
_EGL_CHECK_EXTENSION(KHR_gl_texture_3D_image);
_EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image);
+#ifdef EGL_MESA_create_image
+ _EGL_CHECK_EXTENSION(MESA_create_image);
+#endif
_EGL_CHECK_EXTENSION(NOK_swap_region);
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
--
1.7.0.4
More information about the mesa-dev
mailing list