ecore_wl2: add ecore_wl2_subsurface_aux_hint_set 63/255363/3
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 17 Mar 2021 10:28:29 +0000 (19:28 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 17 Mar 2021 11:20:07 +0000 (20:20 +0900)
This patch is providing way to set auxiliary hint on subsurface.
Application could get filpped image with following line.

ecore_wl2_subsurface_aux_hint_set(subsurface, "wm.video.flip.mode", "1");

+ reducing debug message

*tizen_only

Change-Id: I6a6f7c91bb088abd2daf8d57ef3c439f957ca6e0

src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_subsurf.c

index 4eb8635..c3bcef8 100644 (file)
@@ -3218,6 +3218,18 @@ EAPI Eina_Bool ecore_wl2_subsurface_video_surface_prepare(Ecore_Wl2_Subsurface *
  * @since_tizen 6.0
  */
 EAPI Eina_Bool ecore_wl2_subsurface_video_surface_destination_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h);
+
+/**
+ * @brief Set an auxiliary hint on a given subsurface
+ *
+ * @param subsurface The subsurface to set an auxiliary hint
+ * @param hint The auxiliary hint string
+ * @param val The value string
+ *
+ * @ingroup Ecore_Wl2_Subsurface_Group
+ * @since_tizen 6.0
+ */
+EAPI void ecore_wl2_subsurface_aux_hint_set(Ecore_Wl2_Subsurface *subsurface, const char *hint, const char *val);
 //
 # undef EAPI
 # define EAPI
index 070a2ce..8ce492e 100644 (file)
@@ -232,29 +232,23 @@ ecore_wl2_subsurface_video_surface_prepare(Ecore_Wl2_Subsurface *subsurface)
    EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface->parent, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(subsurface->parent->display, EINA_FALSE);
 
-   subsurface->video = EINA_TRUE;
    win = subsurface->parent;
    display = win->display;
 
+   if (!display->wl.tz_policy) return EINA_FALSE;
+
    tizen_policy_place_subsurface_below_parent(display->wl.tz_policy,
                                           subsurface->wl.subsurface);
 
    if (!win->tbm_client)
      {
+        /* deinit tbm_client in ecore_wl2_window_free */
         win->tbm_client = wayland_tbm_client_init(display->wl.display);
-        if (!win->tbm_client)
-          {
-             ERR("Failed to init wayland tbm client");
-             goto client_init_err;
-          }
+        if (!win->tbm_client) return EINA_FALSE;
      }
 
    subsurface->wl.tbm_surface = tbm_surface_create(1, 1, TBM_FORMAT_ARGB8888);
-   if (!subsurface->wl.tbm_surface)
-     {
-        ERR("Failed to create tbm surface");
-        goto client_init_err;
-     }
+   if (!subsurface->wl.tbm_surface) return EINA_FALSE;
 
    subsurface->wl.wl_buffer = wayland_tbm_client_create_buffer(win->tbm_client,
                                                     subsurface->wl.tbm_surface);
@@ -274,6 +268,7 @@ ecore_wl2_subsurface_video_surface_prepare(Ecore_Wl2_Subsurface *subsurface)
    wl_surface_attach(subsurface->wl.surface, subsurface->wl.wl_buffer, 0, 0);
    wl_surface_commit(subsurface->wl.surface);
 
+   subsurface->video = EINA_TRUE;
    return EINA_TRUE;
 
 buf_fill_err:
@@ -284,9 +279,6 @@ create_buf_err:
    tbm_surface_destroy(subsurface->wl.tbm_surface);
    subsurface->wl.tbm_surface = NULL;
 
-client_init_err:
-   subsurface->video = EINA_FALSE;
-
    return EINA_FALSE;
 }
 
@@ -410,4 +402,24 @@ ecore_wl2_subsurface_place_surface_below(Ecore_Wl2_Subsurface *subsurface, Ecore
    EINA_SAFETY_ON_NULL_RETURN(subsurface);
    _ecore_wl2_subsurfae_place_surface_stack(subsurface, other, EINA_FALSE);
 }
+
+EAPI void
+ecore_wl2_subsurface_aux_hint_set(Ecore_Wl2_Subsurface *subsurface, const char *hint, const char *val)
+{
+   int id = INT_MAX; /* id is meaningless to window manager server */
+   Ecore_Wl2_Window *win;
+   Ecore_Wl2_Display *display;
+
+   EINA_SAFETY_ON_NULL_RETURN(hint);
+   EINA_SAFETY_ON_NULL_RETURN(val);
+   EINA_SAFETY_ON_NULL_RETURN(subsurface);
+   EINA_SAFETY_ON_NULL_RETURN(subsurface->parent);
+   EINA_SAFETY_ON_NULL_RETURN(subsurface->parent->display);
+
+   win = subsurface->parent;
+   display = win->display;
+
+   if (display->wl.tz_policy)
+     tizen_policy_add_aux_hint(display->wl.tz_policy, subsurface->wl.surface, id, hint, val);
+}
 //