[evas_gl_thread] change the mode of glFraemBuffer_XXX to finish because 93/157793/3
authorJoogab Yun <joogab.yun@samsung.com>
Wed, 25 Oct 2017 08:43:59 +0000 (17:43 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 30 Oct 2017 01:27:10 +0000 (01:27 +0000)
of GL_INVALID_FRAMEBUFFER_OPERATION error

and clean up the source

Change-Id: Iabbdb413f99d7fa4f4d6a990e85501fc34231313

src/lib/evas/common/evas_thread_render.c
src/modules/evas/engines/gl_common/evas_gl_thread_egl.c
src/modules/evas/engines/gl_common/evas_gl_thread_egl.h
src/modules/evas/engines/gl_common/evas_gl_thread_gl_generated.c
src/modules/evas/engines/wayland_egl/evas_wl_main.c
src/utils/evas/gl_api_def.txt

index 1bb43a9..e54d061 100644 (file)
@@ -432,7 +432,7 @@ evas_threads_sw_init(void)
 fail_on_software_thread_init:
   eina_threads_shutdown();
 fail_on_eina_thread_init:
-  return --evas_threads_gl_init_count;
+  return --evas_threads_sw_init_count;
 }
 
 EAPI int
index e8812e6..b84a9cd 100644 (file)
@@ -59,7 +59,6 @@ GL_TH_FN(eglGetError)(GL_TH_DP)
   thread_data_ptr =
       evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(eglGetError) *), &thcmd_ref);
   *thread_data_ptr = thread_data;
-  *thread_data_ptr = thread_data;
 
   thread_data->orig_func = orig_func;
 
@@ -1371,6 +1370,84 @@ GL_TH_FN(eglUnbindWaylandDisplayWL)(GL_TH_DP,  EGLDisplay  dpy,  void *wl_displa
 }
 
 
+
+typedef struct
+{
+  GL_TH_FNTYPE(wl_egl_window_set_buffer_transform) orig_func;
+  void *egl_window;
+  int wl_output_transform;
+} GL_TH_ST(wl_egl_window_set_buffer_transform);
+
+static void
+GL_TH_CB(wl_egl_window_set_buffer_transform)(void *data)
+{
+  GL_TH_ST(wl_egl_window_set_buffer_transform) *thread_data = *(void **)data;
+
+  thread_data->orig_func(thread_data->egl_window, thread_data->wl_output_transform);
+}
+
+void
+GL_TH_FN(wl_egl_window_set_buffer_transform)(GL_TH_DP, void *egl_window, int wl_output_transform)
+{
+
+  GL_TH_ST(wl_egl_window_set_buffer_transform) thread_data_local, *thread_data = &thread_data_local, **thread_data_ptr;
+  void *thcmd_ref;
+
+  if (!evas_gl_thread_enabled(thread_type))
+    return ((GL_TH_FNTYPE(wl_egl_window_set_buffer_transform))orig_func)(egl_window, wl_output_transform);
+
+  thread_data_ptr =
+        evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(wl_egl_window_set_buffer_transform) *), &thcmd_ref);
+  *thread_data_ptr = thread_data;
+
+  thread_data->egl_window = egl_window;
+  thread_data->wl_output_transform = wl_output_transform;
+  thread_data->orig_func = orig_func;
+
+  evas_gl_thread_cmd_enqueue(thcmd_ref,
+                             GL_TH_CB(wl_egl_window_set_buffer_transform),
+                             EVAS_GL_THREAD_MODE_FINISH);
+}
+
+typedef struct
+{
+  GL_TH_FNTYPE(wl_egl_window_set_window_transform) orig_func;
+  void *egl_window;
+  int wl_output_transform;
+} GL_TH_ST(wl_egl_window_set_window_transform);
+
+static void
+GL_TH_CB(wl_egl_window_set_window_transform)(void *data)
+{
+  GL_TH_ST(wl_egl_window_set_window_transform) *thread_data = *(void **)data;
+
+  thread_data->orig_func(thread_data->egl_window, thread_data->wl_output_transform);
+}
+
+void
+GL_TH_FN(wl_egl_window_set_window_transform)(GL_TH_DP,  void *egl_window, int wl_output_transform)
+{
+
+  GL_TH_ST(wl_egl_window_set_window_transform) thread_data_local, *thread_data = &thread_data_local, **thread_data_ptr;
+  void *thcmd_ref;
+
+  if (!evas_gl_thread_enabled(thread_type))
+    return ((GL_TH_FNTYPE(wl_egl_window_set_window_transform))orig_func)(egl_window, wl_output_transform);
+
+  thread_data_ptr =
+        evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(wl_egl_window_set_window_transform) *), &thcmd_ref);
+  *thread_data_ptr = thread_data;
+
+  thread_data->egl_window = egl_window;
+  thread_data->wl_output_transform = wl_output_transform;
+  thread_data->orig_func = orig_func;
+
+  evas_gl_thread_cmd_enqueue(thcmd_ref,
+                             GL_TH_CB(wl_egl_window_set_window_transform),
+                             EVAS_GL_THREAD_MODE_FINISH);
+}
+
+
 /*****************************************************************************/
 
 
index 4947bfe..631ac07 100644 (file)
@@ -43,8 +43,9 @@ EVAS_TH_EGL_FN      (EGLBoolean , eglGetSyncAttribKHR,  EGLDisplay  dpy,  void *
 EVAS_TH_EGL_FN      (int        , eglWaitSyncKHR,  EGLDisplay  dpy,  void * sync, int flags) \
 EVAS_TH_EGL_FN      (EGLBoolean , eglBindWaylandDisplayWL,  EGLDisplay  dpy,  void *wl_display) \
 EVAS_TH_EGL_FN      (EGLBoolean , eglUnbindWaylandDisplayWL,  EGLDisplay  dpy,  void *wl_display) \
-EVAS_TH_EGL_FN      (void *     , eglGetProcAddress, char const * procname)
-
+EVAS_TH_EGL_FN      (void *     , eglGetProcAddress, char const * procname) \
+EVAS_TH_EGL_FN      (void       , wl_egl_window_set_buffer_transform, void *egl_window, int wl_output_transform) \
+EVAS_TH_EGL_FN      (void       , wl_egl_window_set_window_transform, void *egl_window, int wl_output_transform)
 
 
 
index 3104526..78cda27 100644 (file)
@@ -279,12 +279,8 @@ GL_TH_FN(glBindFramebuffer)(GL_TH_DP, GLenum target, GLuint framebuffer)
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glBindFramebuffer) *) + sizeof(GL_TH_ST(glBindFramebuffer)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glBindFramebuffer) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glBindFramebuffer) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->target = target;
    thread_data->framebuffer = framebuffer;
@@ -2962,12 +2958,8 @@ GL_TH_FN(glFramebufferRenderbuffer)(GL_TH_DP, GLenum target, GLenum attachment,
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferRenderbuffer) *) + sizeof(GL_TH_ST(glFramebufferRenderbuffer)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glFramebufferRenderbuffer) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferRenderbuffer) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->target = target;
    thread_data->attachment = attachment;
@@ -3030,12 +3022,8 @@ GL_TH_FN(glFramebufferTexture2D)(GL_TH_DP, GLenum target, GLenum attachment, GLe
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2D) *) + sizeof(GL_TH_ST(glFramebufferTexture2D)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glFramebufferTexture2D) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2D) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->target = target;
    thread_data->attachment = attachment;
@@ -20820,12 +20808,8 @@ GL_TH_FN(glBindFramebufferOES)(GL_TH_DP, GLenum target, GLuint framebuffer)
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glBindFramebufferOES) *) + sizeof(GL_TH_ST(glBindFramebufferOES)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glBindFramebufferOES) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glBindFramebufferOES) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->target = target;
    thread_data->framebuffer = framebuffer;
@@ -21091,12 +21075,8 @@ GL_TH_FN(glFramebufferRenderbufferOES)(GL_TH_DP, GLenum target, GLenum attachmen
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferRenderbufferOES) *) + sizeof(GL_TH_ST(glFramebufferRenderbufferOES)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glFramebufferRenderbufferOES) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferRenderbufferOES) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->target = target;
    thread_data->attachment = attachment;
@@ -21159,12 +21139,8 @@ GL_TH_FN(glFramebufferTexture2DOES)(GL_TH_DP, GLenum target, GLenum attachment,
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2DOES) *) + sizeof(GL_TH_ST(glFramebufferTexture2DOES)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glFramebufferTexture2DOES) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2DOES) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->target = target;
    thread_data->attachment = attachment;
@@ -23512,12 +23488,8 @@ GL_TH_FN(glFramebufferTexture2DMultisampleEXT)(GL_TH_DP, GLenum a, GLenum b, GLe
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2DMultisampleEXT) *) + sizeof(GL_TH_ST(glFramebufferTexture2DMultisampleEXT)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glFramebufferTexture2DMultisampleEXT) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2DMultisampleEXT) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->a = a;
    thread_data->b = b;
@@ -24682,12 +24654,8 @@ GL_TH_FN(glFramebufferTexture2DMultisample)(GL_TH_DP, GLenum a, GLenum b, GLenum
         return;
      }
    thread_data_ptr =
-      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2DMultisample) *) + sizeof(GL_TH_ST(glFramebufferTexture2DMultisample)), &thcmd_ref);
-   *thread_data_ptr = (void *)((char *)thread_data_ptr + sizeof(GL_TH_ST(glFramebufferTexture2DMultisample) *));
-   thread_data = *thread_data_ptr;
-
-   if (!evas_gl_thread_force_finish())
-     thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+      evas_gl_thread_cmd_create(thread_type, sizeof(GL_TH_ST(glFramebufferTexture2DMultisample) *), &thcmd_ref);
+   *thread_data_ptr = thread_data;
 
    thread_data->a = a;
    thread_data->b = b;
index 5cf5698..101cd14 100644 (file)
@@ -404,6 +404,7 @@ eng_window_resurf(Outbuf *gw)
    gw->surf = EINA_TRUE;
 }
 
+
 void
 eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth EINA_UNUSED)
 {
@@ -448,14 +449,15 @@ eng_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth EIN
        * because the display server needs to calcuate the screen rotation value
        * from buffer_transform value.
        */
-      wl_egl_window_set_buffer_transform(ob->win, ob->info->info.rotation / 90);
-      wl_egl_window_set_window_transform(ob->win, ob->info->window_rotation / 90);
+      GL_TH(wl_egl_window_set_buffer_transform, ob->win, ob->info->info.rotation / 90);
+      GL_TH(wl_egl_window_set_window_transform, ob->win, ob->info->window_rotation / 90);
 
       if ((ob->info->info.rotation == 90) || (ob->info->info.rotation == 270))
         wl_egl_window_resize(ob->win, h, w, dx, dy);
       else
         wl_egl_window_resize(ob->win, w, h, dx, dy);
     }
+
 }
 
 void
index d617ec6..74ba7d7 100644 (file)
@@ -27,7 +27,7 @@
 | EVAS GL | void | glAttachShader | GLuint program, GLuint shader | flush | noext |  |  |  | | | | | |
 | EVAS GL | void | glBindAttribLocation | GLuint program, GLuint index, const char* name | finish | noext | _mp_default, strlen(name), name |  |  | | | | | |
 | EVAS GL | void | glBindBuffer | GLenum target, GLuint buffer | finish | noext |  |  |  | | | | | |
-| EVAS GL | void | glBindFramebuffer | GLenum target, GLuint framebuffer | flush | ext |  |  |  | | | | | |
+| EVAS GL | void | glBindFramebuffer | GLenum target, GLuint framebuffer | finish | ext |  |  |  | | | | | |
 | EVAS GL | void | glBindRenderbuffer | GLenum target, GLuint renderbuffer | flush | noext |  |  |  | | | | | |
 | EVAS GL | void | glBindTexture | GLenum target, GLuint texture | flush | noext |  |  |  | | | | | |
 | EVAS GL | void | glBlendColor | GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha | flush | noext |  |  |  | | | | | |
@@ -71,8 +71,8 @@
 | EVAS GL | void | glEnableVertexAttribArray | GLuint index | finish | noext |  |  |  | | | | | |
 | EVAS GL | void | glFinish | void | finish | noext |  |  |  | | | | | |
 | EVAS GL | void | glFlush | void | finish | noext |  |  |  | | | | | |
-| EVAS GL | void | glFramebufferRenderbuffer | GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer | flush | noext |  |  |  | | | | | |
-| EVAS GL | void | glFramebufferTexture2D | GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level | flush | ext |  |  |  | | | | | |
+| EVAS GL | void | glFramebufferRenderbuffer | GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer | finish | noext |  |  |  | | | | | |
+| EVAS GL | void | glFramebufferTexture2D | GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level | finish | ext |  |  |  | | | | | |
 | EVAS GL | void | glFrontFace | GLenum mode | finish | noext |  |  |  | | | | | |
 | EVAS GL | void | glGenBuffers | GLsizei n, GLuint* buffers | finish | noext |  |  |  | | | | | |
 | EVAS GL | void | glGenerateMipmap | GLenum target | finish | noext |  |  |  | | | | | |
 | EVAS GL | void | glRenderbufferStorageOES | GLenum target, GLenum internalformat, GLsizei width, GLsizei height | flush | ext |  |  |  | | | | | |
 | EVAS GL | void | glGetRenderbufferParameterivOES | GLenum target, GLenum pname, GLint* params | finish | ext |  |  |  | | | | | |
 | EVAS GL | GLboolean | glIsFramebufferOES | GLuint framebuffer | finish | ext |  |  |  | | | | | |
-| EVAS GL | void | glBindFramebufferOES | GLenum target, GLuint framebuffer | flush | ext |  |  |  | | | | | |
+| EVAS GL | void | glBindFramebufferOES | GLenum target, GLuint framebuffer | finish | ext |  |  |  | | | | | |
 | EVAS GL | void | glDeleteFramebuffersOES | GLsizei n, const GLuint* framebuffers | flush | ext | _mp_delete_object, n * sizeof(GLuint), framebuffers |  |  | | | | | |
 | EVAS GL | void | glGenFramebuffersOES | GLsizei n, GLuint* framebuffers | finish | ext |  |  |  | | | | | |
 | EVAS GL | GLenum | glCheckFramebufferStatusOES | GLenum target | finish | ext |  |  |  | | | | | |
-| EVAS GL | void | glFramebufferRenderbufferOES | GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer | flush | ext |  |  |  | | | | | |
-| EVAS GL | void | glFramebufferTexture2DOES | GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level | flush | ext |  |  |  | | | | | |
+| EVAS GL | void | glFramebufferRenderbufferOES | GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer | finish | ext |  |  |  | | | | | |
+| EVAS GL | void | glFramebufferTexture2DOES | GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level | finish | ext |  |  |  | | | | | |
 | EVAS GL | void | glGetFramebufferAttachmentParameterivOES | GLenum target, GLenum attachment, GLenum pname, GLint* params | finish | ext |  |  |  | | | | | |
 | EVAS GL | void | glGenerateMipmapOES | GLenum target | finish | ext |  |  |  | | | | | |
 /* GL_OES_matrix_palette */
 | EVAS GL | void | glFlushMappedBufferRangeEXT | GLenum target, GLintptr offset, GLsizeiptr length | finish | ext |  |  |  | | | | | |
 /* GL_EXT_multisampled_render_to_texture */
 | EVAS GL | void | glRenderbufferStorageMultisampleEXT | GLenum a, GLsizei b, GLenum c, GLsizei d, GLsizei e | finish | ext |  |  |  | | | | | |
-| EVAS GL | void | glFramebufferTexture2DMultisampleEXT | GLenum a, GLenum b, GLenum c, GLuint d, GLint e, GLsizei f | flush | ext |  |  |  | | | | | |
+| EVAS GL | void | glFramebufferTexture2DMultisampleEXT | GLenum a, GLenum b, GLenum c, GLuint d, GLint e, GLsizei f | finish | ext |  |  |  | | | | | |
 
 /* GL_EXT_robustness */
 | EVAS GL | GLenum | glGetGraphicsResetStatusEXT | void | finish | ext |  |  |  | | | | | |
 | EVAS GL | void | glStartTilingQCOM | GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask | flush | ext |  |  |  | | | | | |
 | EVAS GL | void | glEndTilingQCOM | GLbitfield preserveMask | flush | ext |  |  |  | | | | | |
 
-| EVAS GL | void | glFramebufferTexture2DMultisample | GLenum a, GLenum b, GLenum c, GLuint d, GLint e, GLsizei f | flush | ext |  |  |  | | | | | |
+| EVAS GL | void | glFramebufferTexture2DMultisample | GLenum a, GLenum b, GLenum c, GLuint d, GLint e, GLsizei f | finish | ext |  |  |  | | | | | |
 
 # OpenGL-ES 3.0
 | EVAS GL | void | glBeginQuery | GLenum target, GLuint id | finish | ext |  |  |  | | | | | |