Hello,

Here's a patch series to implement a handful of EGLImage extensions in
the DRI2 EGL driver:

    EGL_KHR_image_base
    EGL_KHR_image_pixmap
    GL_OES_EGL_image

The implementation is a little tricky, since the EGLImage is an EGL
(binding layer) type, but it's passed to client API functions such as

    void glEGLImageTargetTexture2DOES (GLenum target,
                                       GLeglImageOES image);
    void glEGLImageTargetRenderbufferStorageOES (GLenum target,
                                                 GLeglImageOES image);

The image argument is an EGLImage and the binding agnostic GL
implementation can't do anything with it.  So what I've done is to
pass the image argument all the way into the backend driver, which is
then expected to have some interface provided from the loader to map
the opaque EGLImage to a type the driver understands.

In the DRI case, I make this work with two new DRI extensions: DRI
image and DRI imageLookup.  The DRI image extensions is implemented by
the driver and the loader (that is, src/egl/drivers/dri2) uses it to
create a __DRIimage from the GEM/TTM handle for a pixmap, or possibly
some other source.  This is how EGL_KHR_image_pixmap is done.  The DRI
imageLookup extension is implemented by the loader and passed to the
DRI driver at initialization time.  The driver uses this extension to
map the opaque EGLImage handles back to a __DRIimage struct.

With this in place, I have implemented GL_OES_EGL_image.  I added the
glapi specification for it and I've added it as a GL extension as
well.  This is mostly boilerplate extension work, and it adds
dd_function_table hooks for the driver to implement.  There still some
details I need to figure out here, for example, the extensions don't
show up in the EGL extension string.

Looking though the EGL_KHR_image_pixmap and GL_OES_EGL_image
extensions, there seems to be no way to specify the format of the
pixmap.  With GLX_EXT_texture_from_pixmap, we can specifiy the format
as either RGB or RGBA through the attribute list passed to
glXBindTexImageEXT().  In the EGLImage model, there's no way to
specify this, so I've proposed an extension in patch 11:
EGL_KHR_image_pixmap_format.  This adds an eglCreateImageKHR
attribute, EGL_NATIVE_PIXMAP_FORMAT_KHR that takes two values:

    EGL_NATIVE_PIXMAP_RGB_KHR
    EGL_NATIVE_PIXMAP_RGBA_KHR

Pretty straightforward.

Finally I added a few new options to xeglgears: -pbuffer-texture,
which renders to an EGL pbuffer surface and textures using
eglBindTexImage() and -pixmap-texture, which renders to a EGL pixmap
surface and textures from that by creating an EGLImage from the
underlying X pixmap and binding that using GL_OES_EGL_image.

Let me know what you think,
Kristian


Kristian Høgsberg (12):
  dri: Store the loader private passed in at dri context creation
  intel: Track named regions and make sure we only have one region per
    named bo
  intel: Avoid dri_bo_flink() in intel_update_renderbuffers()
  glapi: Add GL_OES_EGL_image
  glapi: GL_OES_EGL_image autogenerated files
  core: Implement GL_OES_EGL_image entry points
  dri_interface.h: Add DRI image and imageLookup extensions
  intel: Implement DRI image extension
  intel: Implement GL_OES_EGL_image entrypoints
  egl_dri2: Implement EGL_KHR_image and EGL_KHR_image_pixmap
  egl: Add proposed EGL_KHR_image_pixmap_format extension
  xeglgears: Add test case for texturing from an EGLImage

 include/EGL/eglext.h                         |    8 +
 include/GL/internal/dri_interface.h          |   43 +
 progs/egl/xeglgears.c                        |   95 +-
 src/egl/drivers/dri2/egl_dri2.c              |  133 ++-
 src/egl/main/eglimage.c                      |   10 +
 src/egl/main/eglimage.h                      |    1 +
 src/glx/indirect.c                           |    3 +-
 src/mesa/drivers/dri/common/dri_util.c       |    5 +-
 src/mesa/drivers/dri/common/dri_util.h       |    6 +
 src/mesa/drivers/dri/intel/intel_context.c   |   10 +-
 src/mesa/drivers/dri/intel/intel_fbo.c       |   34 +
 src/mesa/drivers/dri/intel/intel_regions.c   |   24 +-
 src/mesa/drivers/dri/intel/intel_regions.h   |   11 +
 src/mesa/drivers/dri/intel/intel_screen.c    |   88 +
 src/mesa/drivers/dri/intel/intel_screen.h    |    1 +
 src/mesa/drivers/dri/intel/intel_tex_image.c |   51 +
 src/mesa/glapi/Makefile                      |    5 +-
 src/mesa/glapi/OES_EGL_image.xml             |   20 +
 src/mesa/glapi/gl_API.xml                    |    2 +
 src/mesa/glapi/glapidispatch.h               |   16 +-
 src/mesa/glapi/glapioffsets.h                |    6 +-
 src/mesa/glapi/glapitable.h                  |    2 +
 src/mesa/glapi/glapitemp.h                   |   12 +
 src/mesa/glapi/glprocs.h                     |  608 ++++----
 src/mesa/main/dd.h                           |   11 +
 src/mesa/main/fbobject.c                     |   24 +
 src/mesa/main/fbobject.h                     |    3 +
 src/mesa/main/mfeatures.h                    |    2 +
 src/mesa/main/remap_helper.h                 | 2317 +++++++++++++-------------
 src/mesa/main/teximage.c                     |   41 +
 src/mesa/main/teximage.h                     |    2 +
 src/mesa/sparc/glapi_sparc.S                 |    2 +
 src/mesa/x86-64/glapi_x86-64.S               |   74 +
 src/mesa/x86/glapi_x86.S                     |    2 +
 34 files changed, 2178 insertions(+), 1494 deletions(-)
 create mode 100644 src/mesa/glapi/OES_EGL_image.xml


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to