video: Cleanup function implementation 30/318430/1
authorSeunghun Lee <shiin@samsung.com>
Wed, 25 Sep 2024 00:06:55 +0000 (09:06 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Sun, 29 Sep 2024 23:50:26 +0000 (08:50 +0900)
No functional changes.

Change-Id: I20f3464a59b58d7d88cd876f98c62887d8903d14

src/bin/displaymgr/video/e_video_hwc.c

index 1bab49ec4876dcb9b47e06285c5d52811001e32f..9002d096b1b1302e8d475009de9c0d8f3fe91241 100644 (file)
@@ -270,13 +270,12 @@ _e_video_hwc_commit_data_set(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf)
        (evh->commit_data.info.transform == vbuf->content_t) &&
        (evh->commit_data.buffer == vbuf->tbm_surface))
      {
-        WRN("commit data ins't changed");
+        WRN("commit data is the same as previous");
         return EINA_FALSE;
      }
 
    CLEAR(evh->commit_data.info);
 
-   /* Set src_config */
    evh->commit_data.info.src_config.size.h = vbuf->width_from_pitch;
    evh->commit_data.info.src_config.size.v = vbuf->height_from_size;
    evh->commit_data.info.src_config.pos.x = vbuf->content_r.x;
@@ -284,110 +283,110 @@ _e_video_hwc_commit_data_set(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf)
    evh->commit_data.info.src_config.pos.w = vbuf->content_r.w;
    evh->commit_data.info.src_config.pos.h = vbuf->content_r.h;
    evh->commit_data.info.src_config.format = vbuf->tbmfmt;
-
-   /* Set dst_pos */
    evh->commit_data.info.dst_pos.x = evh->geo.tdm.output_r.x;
    evh->commit_data.info.dst_pos.y = evh->geo.tdm.output_r.y;
    evh->commit_data.info.dst_pos.w = evh->geo.tdm.output_r.w;
    evh->commit_data.info.dst_pos.h = evh->geo.tdm.output_r.h;
-
-   /* Set transform */
    evh->commit_data.info.transform = vbuf->content_t;
-
-   /* Set buffer */
    evh->commit_data.buffer = vbuf->tbm_surface;
 
 end:
-   e_hwc_window_changed_set(evh->hwc_window, E_HWC_WINS_CHANGED_WIN_GEOMETRY|E_HWC_WINS_CHANGED_WIN_BUFFER);
+   return EINA_TRUE;
+}
 
-   DBG("Client(%s):PID(%d), Buffer(%p, refcnt:%d) is shown."
-       "Geometry details are : buffer size(%dx%d) src(%d,%d, %dx%d)"
-       " dst(%d,%d, %dx%d), transform(%d)",
-       e_client_util_name_get(evh->ec) ?: "No Name" ,
-       evh->ec->netwm.pid,
-       vbuf, (vbuf ? vbuf->ref_cnt : 0),
-       evh->commit_data.info.src_config.size.h,
-       evh->commit_data.info.src_config.size.v,
-       evh->commit_data.info.src_config.pos.x,
-       evh->commit_data.info.src_config.pos.y,
-       evh->commit_data.info.src_config.pos.w,
-       evh->commit_data.info.src_config.pos.h,
-       evh->commit_data.info.dst_pos.x, evh->commit_data.info.dst_pos.y,
-       evh->commit_data.info.dst_pos.w, evh->commit_data.info.dst_pos.h,
-       evh->commit_data.info.transform);
+static Eina_Bool
+_e_video_hwc_punch_need_check(E_Video_Hwc *evh)
+{
+   E_Client *topmost;
 
-   return EINA_TRUE;
+   if (e_video_debug_punch_value_get())
+     return EINA_TRUE;
+
+   topmost = e_comp_wl_topmost_parent_get(evh->ec);
+   if (!topmost)
+     return EINA_FALSE;
+
+   /* if it's laid above main surface */
+   if ((topmost->comp_data) &&
+       (eina_list_data_find(topmost->comp_data->sub.list, evh->ec)))
+     return EINA_TRUE;
+
+   /* if it's laid under main surface and main surface is transparent */
+   if (topmost->argb)
+     return EINA_TRUE;
+
+   return EINA_FALSE;
 }
 
 static void
-_e_video_hwc_client_mask_update(E_Video_Hwc *evh)
+_e_video_hwc_mask_update(E_Video_Hwc *evh)
 {
    E_Client *topmost;
-   Eina_Bool punch = EINA_FALSE;
+   Eina_Bool punch;
    int bw, bh;
 
-   if (e_video_debug_punch_value_get())
-     punch = EINA_TRUE;
-   else if ((topmost = e_comp_wl_topmost_parent_get(evh->ec)))
-     {
-        /* if it's laid above main surface */
-        if ((topmost->comp_data) &&
-            (eina_list_data_find(topmost->comp_data->sub.list, evh->ec)))
-          punch = EINA_TRUE;
-        /* if it's laid under main surface and main surface is transparent */
-        else if (topmost->argb)
-          {
-             /* FIXME: the mask obj can be drawn at the wrong position in the beginnig
-              * time. It happens caused by window manager policy.
-              */
-             if ((topmost->fullscreen || topmost->maximized) &&
-                 (evh->geo.output_r.x == 0 || evh->geo.output_r.y == 0))
-               {
-                  e_pixmap_size_get(topmost->pixmap, &bw, &bh);
-
-                  if (bw > 100 && bh > 100 &&
-                      evh->geo.output_r.w < 100 && evh->geo.output_r.h < 100)
-                    {
-                       VIN("don't punch. (%dx%d, %dx%d)", evh->ec,
-                           bw, bh, evh->geo.output_r.w, evh->geo.output_r.h);
-                       return;
-                    }
-               }
+   punch = _e_video_hwc_punch_need_check(evh);
+
+   /* FIXME: the mask obj can be drawn at the wrong position in the beginnig
+    * time. It happens caused by window manager policy. */
+   topmost = e_comp_wl_topmost_parent_get(evh->ec);
+   if (topmost &&
+       topmost->argb &&
+       (topmost->fullscreen || topmost->maximized) &&
+       (evh->geo.output_r.x == 0 || evh->geo.output_r.y == 0))
+     {
+        e_pixmap_size_get(topmost->pixmap, &bw, &bh);
 
-             punch = EINA_TRUE;
+        if (bw > 100 && bh > 100 &&
+            evh->geo.output_r.w < 100 && evh->geo.output_r.h < 100)
+          {
+             VIN("don't punch. (%dx%d, %dx%d)", evh->ec,
+                 bw, bh, evh->geo.output_r.w, evh->geo.output_r.h);
+             return;
           }
      }
 
-   if (punch)
+   if (punch &&
+       !e_view_client_mask_has(e_client_view_get(evh->ec)))
      {
-        if (!e_view_client_mask_has(e_client_view_get(evh->ec)))
-          {
-             e_view_client_mask_set(e_client_view_get(evh->ec), true);
-             VIN("punched", evh->ec);
-          }
+        e_view_client_mask_set(e_client_view_get(evh->ec), true);
+        VIN("punched", evh->ec);
      }
-   else
+   else if (!punch &&
+            e_view_client_mask_has(e_client_view_get(evh->ec)))
      {
-        if (e_view_client_mask_has(e_client_view_get(evh->ec)))
-          {
-             e_view_client_mask_set(e_client_view_get(evh->ec), false);
-             VIN("Un-punched", evh->ec);
-          }
+        e_view_client_mask_set(e_client_view_get(evh->ec), false);
+        VIN("Un-punched", evh->ec);
      }
 }
 
 static Eina_Bool
 _e_video_hwc_buffer_commit(E_Video_Hwc *evh, E_Comp_Wl_Video_Buf *vbuf)
 {
-   Eina_Bool ret;
+   if (!_e_video_hwc_commit_data_set(evh, vbuf))
+     return EINA_FALSE;
 
-   /* show means that set the information of the buffer and the info of the hwc window */
+   e_hwc_window_changed_set(evh->hwc_window, E_HWC_WINS_CHANGED_WIN_GEOMETRY|E_HWC_WINS_CHANGED_WIN_BUFFER);
 
-   ret = _e_video_hwc_commit_data_set(evh, vbuf);
+   _e_video_hwc_mask_update(evh);
 
-   _e_video_hwc_client_mask_update(evh);
+   DBG("Client(%s):PID(%d), Buffer(%p, refcnt:%d) is shown. "
+       "Geometry details are : buffer size(%dx%d) src(%d,%d, %dx%d) "
+       "dst(%d,%d, %dx%d), transform(%d)",
+       e_client_util_name_get(evh->ec) ?: "No Name" ,
+       evh->ec->netwm.pid,
+       vbuf, (vbuf ? vbuf->ref_cnt : 0),
+       evh->commit_data.info.src_config.size.h,
+       evh->commit_data.info.src_config.size.v,
+       evh->commit_data.info.src_config.pos.x,
+       evh->commit_data.info.src_config.pos.y,
+       evh->commit_data.info.src_config.pos.w,
+       evh->commit_data.info.src_config.pos.h,
+       evh->commit_data.info.dst_pos.x, evh->commit_data.info.dst_pos.y,
+       evh->commit_data.info.dst_pos.w, evh->commit_data.info.dst_pos.h,
+       evh->commit_data.info.transform);
 
-   return ret;
+   return EINA_TRUE;
 }
 
 static void