[Upstream migration @62307] Merge remote branch 'origin/upstream'
[profile/ivi/ecore.git] / src / lib / ecore_evas / ecore_evas_x.c
old mode 100644 (file)
new mode 100755 (executable)
index 1869b76..a66caad
@@ -997,6 +997,17 @@ _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void
    ee = ecore_event_window_match(e->win);
    if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
    if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+   /* some GL drivers are doing buffer copy in a separate thread.
+    * we need to check whether GL driver sends SYNC_DRAW_DONE msg afger copying
+    * that are required in order to exactly render. - added by gl77.lee
+    */
+   if (ee->gl_sync_draw_done < 0)
+     {
+        if (getenv("ECORE_EVAS_GL_SYNC_DRAW_DONE"))
+           ee->gl_sync_draw_done = atoi(getenv("ECORE_EVAS_GL_SYNC_DRAW_DONE"));
+        else
+           ee->gl_sync_draw_done = 0;
+     }
    if (first_map_bug < 0)
      {
         char *bug = NULL;
@@ -1533,10 +1544,41 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize,
      }
 }
 
+#define _USE_WIN_ROT_EFFECT 1
+
+#if _USE_WIN_ROT_EFFECT
+static void _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__);
+
+typedef struct _Ecore_Evas_X_Rotation_Effect Ecore_Evas_X_Rotation_Effect;
+struct _Ecore_Evas_X_Rotation_Effect
+{
+   Eina_Bool    wait_for_comp_reply;
+};
+
+static Ecore_Evas_X_Rotation_Effect _rot_effect =
+{
+   EINA_FALSE
+};
+
+static void
+_ecore_evas_x_rotation_effect_setup(void)
+{
+   _rot_effect.wait_for_comp_reply = EINA_TRUE;
+}
+#endif /* end of _USE_WIN_ROT_EFFECT */
+
 static void
 _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
 {
    if (ee->rotation == rotation) return;
+   if (!strcmp(ee->driver, "xrender_x11")) return;
+
+#if _USE_WIN_ROT_EFFECT
+   int angles[2];
+   angles[0] = rotation;
+   angles[1] = ee->rotation;
+#endif /* end of _USE_WIN_ROT_EFFECT */
+
    if (!strcmp(ee->driver, "opengl_x11"))
      {
 #ifdef BUILD_ECORE_EVAS_OPENGL_X11
@@ -1547,6 +1589,15 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
         einfo->info.rotation = rotation;
         _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 
                                             (Evas_Engine_Info *)einfo);
+# if _USE_WIN_ROT_EFFECT
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
+# else
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
+# endif
 #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */
      }
    else if (!strcmp(ee->driver, "software_x11"))
@@ -1559,6 +1610,15 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
         einfo->info.rotation = rotation;
         _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 
                                             (Evas_Engine_Info *)einfo);
+# if _USE_WIN_ROT_EFFECT
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
+# else
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
+# endif
 #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */
      }
    else if (!strcmp(ee->driver,  "software_16_x11"))
@@ -1571,6 +1631,15 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
         einfo->info.rotation = rotation;
         _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 
                                             (Evas_Engine_Info *)einfo);
+# if _USE_WIN_ROT_EFFECT
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
+# else
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
+# endif
 #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */
      }
    else if (!strcmp(ee->driver,  "software_8_x11"))
@@ -1583,8 +1652,22 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize)
         einfo->info.rotation = rotation;
         _ecore_evas_x_rotation_set_internal(ee, rotation, resize, 
                                             (Evas_Engine_Info *)einfo);
+# if _USE_WIN_ROT_EFFECT
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &angles, 2);
+# else
+        ecore_x_window_prop_property_set(ee->prop.window,
+                                         ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                                         ECORE_X_ATOM_CARDINAL, 32, &rotation, 1);
+# endif
 #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */
      }
+
+#if _USE_WIN_ROT_EFFECT
+  _ecore_evas_x_rotation_effect_setup();
+  _ecore_evas_x_flush_pre(ee, NULL, NULL);
+#endif /* end of _USE_WIN_ROT_EFFECT */
 }
 
 static void
@@ -2759,7 +2842,8 @@ _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUS
 {
    Ecore_Evas *ee = data;
 
-   if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))
+   if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) &&
+       (!ee->gl_sync_draw_done)) // added by gl77.lee
      {
         if (ee->engine.x.sync_counter)
           {
@@ -3126,12 +3210,14 @@ ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent,
 
    ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
 
+   ee->gl_sync_draw_done = -1; // added by gl77.lee
+
    _ecore_evas_x_init();
 
    ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func;
 
    ee->driver = "opengl_x11";
-   ee->semi_sync = 1; // gl engine doesn't need to sync - its whole swaps
+   ee->semi_sync = 0; // gl engine doesn't need to sync - its whole swaps
 //   ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps
    if (disp_name) ee->name = strdup(disp_name);