Add support for mapping of glue texture object to real texture object in eglCreateIma...
authormythri.venugopal <mythri.venugopal@samsung.com>
Mon, 6 Jan 2014 10:52:54 +0000 (10:52 +0000)
committermythri.venugopal <mythri.venugopal@samsung.com>
Mon, 6 Jan 2014 10:52:54 +0000 (10:52 +0000)
Refer http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_gl_image.txt

src/headers/egl.h
src/modules/fastpath/coregl_fastpath_egl.c

index e7b4c3c..c7d779c 100644 (file)
@@ -107,6 +107,15 @@ typedef void *EGLClientBuffer;
 #define EGL_TEXTURE_RGB                        0x305D
 #define EGL_TEXTURE_RGBA               0x305E
 #define EGL_TEXTURE_2D                 0x305F
+#define EGL_GL_TEXTURE_2D_KHR   0x30B1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#define EGL_GL_TEXTURE_3D_KHR  0x30B2
+#define EGL_GL_RENDERBUFFER_KHR        0x30B9
 
 /* Config attribute mask bits */
 #define EGL_PBUFFER_BIT                        0x0001  /* EGL_SURFACE_TYPE mask bits */
index 937e6a2..05e4188 100644 (file)
@@ -1355,12 +1355,14 @@ fastpath_eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLC
 {
        void *ret = NULL;
        EGLContext real_ctx = EGL_NO_CONTEXT;
+       GLuint real_obj = 0;
 
        _COREGL_FASTPATH_FUNC_BEGIN();
 
        if (ctx != NULL && ctx != EGL_NO_CONTEXT)
        {
                GLGlueContext *gctx = (GLGlueContext *)ctx;
+               GLuint glue_obj = (GLuint)buffer;
 
                if (gctx->magic != MAGIC_GLFAST)
                {
@@ -1371,8 +1373,37 @@ fastpath_eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLC
                        AST(gctx->cstate != NULL);
                        real_ctx = gctx->cstate->rctx;
                }
+
+               switch(target)
+               {
+                       case EGL_GL_TEXTURE_2D_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
+                       case EGL_GL_TEXTURE_3D_KHR:
+                       case EGL_GL_RENDERBUFFER_KHR:
+                               if((GLuint )buffer == 0)
+                               {
+                                       COREGL_ERR("\E[40;31;1m fastpath_eglCreateImageKHR buffer object NULL \E[0m\n");
+                                       real_obj = 0;
+                               } else {
+                                       real_obj = fastpath_ostate_get_object(&gctx->ostate, GL_OBJECT_TYPE_TEXTURE, (GLuint )buffer);
+                               }
+                               break;
+                       default:
+                               COREGL_ERR("\E[40;31;1mError Not supported target NULL client buffer\E[0m\n");
+                           goto finish;
+               }
+
+       } else  {
+               real_obj = (GLuint )buffer;
        }
-       ret = _orig_fastpath_eglCreateImageKHR(dpy, real_ctx, target, buffer, attrib_list);
+
+       ret = _orig_fastpath_eglCreateImageKHR(dpy, real_ctx, target, (EGLClientBuffer)real_obj, attrib_list);
+
 
        goto finish;