[evas_gl] support yuv and nv format
authorJoogab Yun <joogab.yun@samsung.com>
Thu, 1 Dec 2016 04:56:15 +0000 (13:56 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 07:24:00 +0000 (16:24 +0900)
Change-Id: I320d9b449dafd06ec6c0f46fae9bfbbe4167580d

src/modules/evas/engines/gl_drm/evas_engine.c
src/modules/evas/engines/gl_tbm/evas_engine.c [changed mode: 0755->0644]
src/modules/evas/engines/wayland_egl/evas_engine.c [changed mode: 0755->0644]

index 5f9ea18..f74a4fb 100644 (file)
@@ -635,7 +635,7 @@ _native_cb_bind(void *data EINA_UNUSED, void *image)
           {
              if (glsym_glEGLImageTargetTexture2DOES)
                {
-                  glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface.surface);
+                  glsym_glEGLImageTargetTexture2DOES(img->native.target, n->ns_data.wl_surface.surface);
                   GLERRV("glsym_glEGLImageTargetTexture2DOES");
                }
              else
@@ -1297,7 +1297,9 @@ eng_image_native_set(void *data, void *image, void *native)
                   glsym_eglQueryWaylandBufferWL(ob->egl.disp, wl_buf,
                                                 EGL_TEXTURE_FORMAT, &format);
                   if ((format != EGL_TEXTURE_RGB) &&
-                      (format != EGL_TEXTURE_RGBA))
+                      (format != EGL_TEXTURE_RGBA)&&
+                      (format != EGL_TEXTURE_Y_U_V_WL) &&
+                      (format != EGL_TEXTURE_Y_UV_WL))
                     {
                        ERR("eglQueryWaylandBufferWL() %d format is not supported ", format);
                        glsym_evas_gl_common_image_free(img);
@@ -1351,7 +1353,11 @@ eng_image_native_set(void *data, void *image, void *native)
                   img->native.func.bind = _native_cb_bind;
                   img->native.func.unbind = _native_cb_unbind;
                   img->native.func.free = _native_cb_free;
-                  img->native.target = GL_TEXTURE_2D;
+                  if ( (format == EGL_TEXTURE_Y_U_V_WL)||
+                       (format == EGL_TEXTURE_Y_UV_WL))
+                     img->native.target = GL_TEXTURE_EXTERNAL_OES;
+                  else
+                     img->native.target = GL_TEXTURE_2D;
                   img->native.mipmap = 0;
 
                   glsym_evas_gl_common_image_native_enable(img);
old mode 100755 (executable)
new mode 100644 (file)
index e07a70d..71dd9ac
@@ -1218,7 +1218,7 @@ _native_cb_bind(void *data EINA_UNUSED, void *image)
           {
              if (glsym_glEGLImageTargetTexture2DOES)
                {
-                  glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface.surface);
+                  glsym_glEGLImageTargetTexture2DOES(img->native.target, n->ns_data.wl_surface.surface);
                   GLERRV("glsym_glEGLImageTargetTexture2DOES");
                }
              else
@@ -1581,7 +1581,9 @@ eng_image_native_set(void *data, void *image, void *native)
                   glsym_eglQueryWaylandBufferWL(ob->egl_disp, wl_buf,
                                                 EGL_TEXTURE_FORMAT, &format);
                   if ((format != EGL_TEXTURE_RGB) &&
-                      (format != EGL_TEXTURE_RGBA))
+                      (format != EGL_TEXTURE_RGBA)&&
+                      (format != EGL_TEXTURE_Y_U_V_WL) &&
+                      (format != EGL_TEXTURE_Y_UV_WL))
                     {
                        ERR("eglQueryWaylandBufferWL() %d format is not supported ", format);
                        glsym_evas_gl_common_image_free(img);
@@ -1629,15 +1631,19 @@ eng_image_native_set(void *data, void *image, void *native)
 
                   //XXX: workaround for mesa-10.2.8
                   // mesa's eglQueryWaylandBufferWL() with EGL_WAYLAND_Y_INVERTED_WL works incorrect.
-                  //img->native.yinvert = yinvert;
-                  img->native.yinvert = 1;
+                  img->native.yinvert = yinvert;
+//                  img->native.yinvert = 1;
                   img->native.loose = 0;
                   img->native.data = n;
                   img->native.func.data = re;
                   img->native.func.bind = _native_cb_bind;
                   img->native.func.unbind = _native_cb_unbind;
                   img->native.func.free = _native_cb_free;
-                  img->native.target = GL_TEXTURE_2D;
+                  if ( (format == EGL_TEXTURE_Y_U_V_WL)||
+                       (format == EGL_TEXTURE_Y_UV_WL))
+                     img->native.target = GL_TEXTURE_EXTERNAL_OES;
+                  else
+                     img->native.target = GL_TEXTURE_2D;
                   img->native.mipmap = 0;
 
                   glsym_evas_gl_common_image_native_enable(img);
old mode 100755 (executable)
new mode 100644 (file)
index 1b25510..c477293
@@ -1234,7 +1234,7 @@ _native_cb_bind(void *data EINA_UNUSED, void *image)
           {
              if (glsym_glEGLImageTargetTexture2DOES)
                {
-                  glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface.surface);
+                  glsym_glEGLImageTargetTexture2DOES(img->native.target, n->ns_data.wl_surface.surface);
                   GLERRV("glsym_glEGLImageTargetTexture2DOES");
                }
              else
@@ -1596,7 +1596,9 @@ eng_image_native_set(void *data, void *image, void *native)
                   glsym_eglQueryWaylandBuffer(ob->egl_disp, wl_buf,
                                                 EGL_TEXTURE_FORMAT, &format);
                   if ((format != EGL_TEXTURE_RGB) &&
-                      (format != EGL_TEXTURE_RGBA))
+                      (format != EGL_TEXTURE_RGBA)&&
+                      (format != EGL_TEXTURE_Y_U_V_WL) &&
+                      (format != EGL_TEXTURE_Y_UV_WL))
                     {
                        ERR("eglQueryWaylandBuffer() %d format is not supported ", format);
                        glsym_evas_gl_common_image_free(img);
@@ -1652,7 +1654,11 @@ eng_image_native_set(void *data, void *image, void *native)
                   img->native.func.bind = _native_cb_bind;
                   img->native.func.unbind = _native_cb_unbind;
                   img->native.func.free = _native_cb_free;
-                  img->native.target = GL_TEXTURE_2D;
+                  if ( (format == EGL_TEXTURE_Y_U_V_WL)||
+                       (format == EGL_TEXTURE_Y_UV_WL))
+                     img->native.target = GL_TEXTURE_EXTERNAL_OES;
+                  else
+                     img->native.target = GL_TEXTURE_2D;
                   img->native.mipmap = 0;
 
                   glsym_evas_gl_common_image_native_enable(img);