[Mesa-dev] [PATCH v2 1/4] Introduce a new EGL extension MESA_EGL_resource_sharing

Zhigang Gong zhigang.gong at linux.intel.com
Tue Jul 16 01:04:17 PDT 2013


This extension provides entry points for exposing internal GL
resouces to external libraries for sharing access purpose. One good
candiate of the external library is the Open CL GL extension. The
extension lets applications can acquire a low level attributes of the
given texture/buffer object/render buffer. The low level attributes
are defined at dri driver layer. It a driver specific data structure
which could be used by the external library (Open Cl driver) to
create another shared buffer object to access the same resource
correctly.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 docs/specs/MESA_resource_sharing.spec |  134 +++++++++++++++++++++++++++++++++
 1 file changed, 134 insertions(+)
 create mode 100644 docs/specs/MESA_resource_sharing.spec

diff --git a/docs/specs/MESA_resource_sharing.spec b/docs/specs/MESA_resource_sharing.spec
new file mode 100644
index 0000000..a226997
--- /dev/null
+++ b/docs/specs/MESA_resource_sharing.spec
@@ -0,0 +1,134 @@
+Name
+
+    MESA_resource_sharing
+
+Name Strings
+
+    EGL_MESA_resource_sharing
+
+Contact
+
+    Zhigang Gong <zhigang.gong at linux.intel.com>
+
+Status
+
+    Proposal
+
+Version
+
+    Version 1, Jul 16, 2013
+
+Number
+
+    EGL Extension #not assigned
+
+Dependencies
+
+    Requires EGL 1.4 or later.  This extension is written against the
+    wording of the EGL 1.4 specification.
+
+Overview
+
+    This extension provides entry points for exposing internal GL
+    resouces to external libraries for sharing access purpose. One good
+    candiate of the external library is the Open CL GL extension. The
+    extension lets applications can acquire a low level attributes of the
+    given texture/buffer object/render buffer. The low level attributes
+    are defined at dri driver layer. It a driver specific data structure
+    which could be used by the external library (Open Cl driver) to
+    create another shared buffer object to access the same resource
+    correctly.
+
+IP Status
+
+    Open-source; freely implementable.
+
+New Procedures and Functions
+
+    EGLBoolean eglAcquireResourceMESA(EGLDisplay dpy,
+                                      EGLContext ctx,
+                                      const EGLenum target,
+                                      const EGLint *attrib_list,
+                                      void * user_data);
+    EGLBoolean eglReleaseResourceMESA(EGLDisplay dpy,
+                                      EGLContext ctx,
+                                      const EGLenum target,
+                                      const EGLint *attrib_list);
+
+New Tokens
+
+    Accepted in <target> parameter of eglAcquireResourceMESA and
+    eglReleaseResourceMESA:
+
+        EGL_GL_TEXTURE_MESA             0x3300
+        EGL_GL_BUFFER_OBJECT_MESA       0x3301
+        EGL_GL_RENDER_BUFFER_MESA       0x3302
+
+    Accepted in the <attrib_list> parameter of eglAcquireResourceMESA
+    and eglReleaseResourceMESA:
+        EGL_GL_TEXTURE_ID_MESA          0x3303
+        EGL_GL_TEXTURE_LEVEL_MESA       0x3304
+        EGL_GL_TEXTURE_TARGET_MESA      0x3305
+        EGL_GL_BUFFER_OBJECT_ID_MESA    0x3306
+        EGL_GL_RENDER_BUFFER_ID_MESA    0x3307
+
+    Accepted as value for the EGL_GL_TEXTURE_ID_MESA:
+
+        A valid texture id which is created from the specified context.
+        And the texture object should be complete.
+
+    Values accepted for EGL_GL_TEXTURE_LEVEL_MESA/TARGET_MESA:
+
+       The mipmap level and the corresponding texture target for the
+       specified texture id.
+
+    Value accepted for EGL_GL_BUFFER_OBJECT_ID_MESA:
+       A valid buffer object id in the specified context and should
+       be allocated.
+
+    Value accepeted for EGL_GL_RENDER_BUFFER_ID_MESA:
+       A valid render buffer id created in the specified context.
+
+Additions to the EGL 1.4 Specification:
+
+    To expose a resource to external library, call
+
+        EGLImageKHR eglAcquireResourceMESA(EGLDisplay dpy,
+                                           EGLContext ctx,
+                                           EGLenum target,
+                                           const EGLint *attrib_list,
+                                           void * user_data);
+    Use the target parameter to identify whether this resource is
+    texture/buffer object or render buffer. In the attribute list, we
+    can get all the needed values for the specified resource target.
+    The user_data should be a driver specified data structure and EGL
+    layer just need to treat it as an opaque pointer. EGL/dri2 driver
+    need to call the registered dri driver layer function and pass the
+    corresponding resource parameter and the user_data pointer to the
+    dri driver layer. And if the driver layer has a valid implementation,
+    then the driver should lookup the resource's object from the
+    specified context, and get the needed attributes into the user_data
+    structure. Take texture in i965 platform as an example, it needs to
+    get the texture object's width/height/color format and bo's name and
+    the global offset and the tile_x and tile_y which will not be zero
+    for a non-zero mipmap level texture. DRI driver should define the
+    user_data's data structure and export the header file to the
+    external driver. When this function call into the dri driver layer,
+    the dri driver need to increase the reference counter to the specified
+    resource.
+
+    If the external library finished to access the resource, it need to
+    call
+
+        EGLImageKHR eglReleaseResourceMESA(EGLDisplay dpy,
+                                           EGLContext ctx,
+                                           EGLenum target,
+                                           const EGLint *attrib_list);
+   to release the reference counter of the specified resource object.
+
+Issues
+
+Revision History
+
+    Version 1, Jul 16, 2013
+        Initial draft (Zhigang Gong)
-- 
1.7.9.5



More information about the mesa-dev mailing list