e_comp_wl_tbm: Add internal func e_comp_wl_tbm_aligned_width_get 63/260863/2 accepted/tizen/unified/20210707.070841 submit/tizen/20210706.063021
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 11 May 2021 10:45:46 +0000 (19:45 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Tue, 6 Jul 2021 04:32:44 +0000 (13:32 +0900)
this patch is for supporting another RGB format

Change-Id: Icd5279c2c3f83164527a186dbf85f9084ff8d959

src/bin/e_comp_wl_tbm.c
src/bin/e_comp_wl_tbm.h
src/bin/e_hwc_window.c
src/bin/e_hwc_windows.c
src/bin/e_output.c

index 5371269..f87a5cc 100644 (file)
@@ -202,3 +202,52 @@ e_comp_wl_tbm_remote_buffer_get_with_tbm(struct wl_resource *wl_tbm, tbm_surface
 
    return remote_buffer;
 }
+
+EINTERN unsigned int
+e_comp_wl_tbm_aligned_width_get(tbm_surface_h tsurface)
+{
+   unsigned int aligned_width = 0;
+   tbm_surface_info_s surf_info;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tsurface, 0);
+
+   tbm_surface_get_info(tsurface, &surf_info);
+
+   switch (surf_info.format)
+     {
+      case TBM_FORMAT_YUV420:
+      case TBM_FORMAT_YVU420:
+      case TBM_FORMAT_YUV422:
+      case TBM_FORMAT_YVU422:
+      case TBM_FORMAT_NV12:
+      case TBM_FORMAT_NV21:
+        aligned_width = surf_info.planes[0].stride;
+        break;
+      case TBM_FORMAT_YUYV:
+      case TBM_FORMAT_UYVY:
+        aligned_width = surf_info.planes[0].stride >> 1;
+        break;
+      case TBM_FORMAT_XRGB8888:
+      case TBM_FORMAT_XBGR8888:
+      case TBM_FORMAT_RGBX8888:
+      case TBM_FORMAT_BGRX8888:
+      case TBM_FORMAT_ARGB8888:
+      case TBM_FORMAT_ABGR8888:
+      case TBM_FORMAT_RGBA8888:
+      case TBM_FORMAT_BGRA8888:
+      case TBM_FORMAT_XRGB2101010:
+      case TBM_FORMAT_XBGR2101010:
+      case TBM_FORMAT_RGBX1010102:
+      case TBM_FORMAT_BGRX1010102:
+      case TBM_FORMAT_ARGB2101010:
+      case TBM_FORMAT_ABGR2101010:
+      case TBM_FORMAT_RGBA1010102:
+      case TBM_FORMAT_BGRA1010102:
+        aligned_width = surf_info.planes[0].stride >> 2;
+        break;
+      default:
+        ERR("not supported format: %c%c%c%c", FOURCC_STR(surf_info.format));
+     }
+
+   return aligned_width;
+}
index ba10399..39d6f2e 100644 (file)
@@ -26,6 +26,8 @@ EINTERN void e_comp_wl_tbm_buffer_destroy(E_Comp_Wl_Buffer *buffer);
 EINTERN struct wl_resource *e_comp_wl_tbm_remote_buffer_get(struct wl_resource *wl_tbm, struct wl_resource *wl_buffer);
 EINTERN struct wl_resource *e_comp_wl_tbm_remote_buffer_get_with_tbm(struct wl_resource *wl_tbm, tbm_surface_h tbm_surface);
 
+EINTERN unsigned int e_comp_wl_tbm_aligned_width_get(tbm_surface_h tsurface);
+
 E_API   Eina_Bool e_comp_wl_tbm_module_func_set(const char *module_name, E_Comp_Wl_Tbm_Funcs *fn);
 E_API   Eina_Bool e_comp_wl_tbm_module_func_unset(void);
 
index 541ecac..8225485 100644 (file)
@@ -218,39 +218,6 @@ _get_composition_type(E_Hwc_Window_State state)
    return composition_type;
 }
 
-static unsigned int
-_get_aligned_width(tbm_surface_h tsurface)
-{
-   unsigned int aligned_width = 0;
-   tbm_surface_info_s surf_info;
-
-   tbm_surface_get_info(tsurface, &surf_info);
-
-   switch (surf_info.format)
-     {
-      case TBM_FORMAT_YUV420:
-      case TBM_FORMAT_YVU420:
-      case TBM_FORMAT_YUV422:
-      case TBM_FORMAT_YVU422:
-      case TBM_FORMAT_NV12:
-      case TBM_FORMAT_NV21:
-        aligned_width = surf_info.planes[0].stride;
-        break;
-      case TBM_FORMAT_YUYV:
-      case TBM_FORMAT_UYVY:
-        aligned_width = surf_info.planes[0].stride >> 1;
-        break;
-      case TBM_FORMAT_ARGB8888:
-      case TBM_FORMAT_XRGB8888:
-        aligned_width = surf_info.planes[0].stride >> 2;
-        break;
-      default:
-        EHWERR("not supported format: %x", NULL, NULL, NULL, surf_info.format);
-     }
-
-   return aligned_width;
-}
-
 static void
 _e_hwc_window_buffer_cb_queue_destroy(struct wl_listener *listener, void *data)
 {
@@ -1235,7 +1202,7 @@ _e_hwc_window_info_get(E_Hwc_Window *hwc_window, tdm_hwc_window_info *hwc_win_in
    hwc_win_info->src_config.pos.w = surf_info.width;
    hwc_win_info->src_config.pos.h = surf_info.height;
 
-   hwc_win_info->src_config.size.h = _get_aligned_width(tsurface);
+   hwc_win_info->src_config.size.h = e_comp_wl_tbm_aligned_width_get(tsurface);
    EINA_SAFETY_ON_TRUE_RETURN_VAL(hwc_win_info->src_config.size.h == 0, EINA_FALSE);
    hwc_win_info->src_config.size.v = surf_info.height;
 
@@ -1301,7 +1268,7 @@ _e_hwc_window_target_info_get(E_Hwc_Window *hwc_window, tdm_hwc_window_info *hwc
    hwc_win_info->src_config.pos.w = surf_info.width;
    hwc_win_info->src_config.pos.h = surf_info.height;
 
-   hwc_win_info->src_config.size.h = _get_aligned_width(tsurface);
+   hwc_win_info->src_config.size.h = e_comp_wl_tbm_aligned_width_get(tsurface);
    EINA_SAFETY_ON_TRUE_RETURN_VAL(hwc_win_info->src_config.size.h == 0, EINA_FALSE);
    hwc_win_info->src_config.size.v = surf_info.height;
 
index 380557a..cf5906a 100644 (file)
@@ -160,39 +160,6 @@ _e_hwc_windows_hwc_mode_update(E_Hwc *hwc, int num_client, int num_device, int n
    return hwc_mode;
 }
 
-static unsigned int
-_e_hwc_windows_aligned_width_get(tbm_surface_h tsurface)
-{
-   unsigned int aligned_width = 0;
-   tbm_surface_info_s surf_info;
-
-   tbm_surface_get_info(tsurface, &surf_info);
-
-   switch (surf_info.format)
-     {
-      case TBM_FORMAT_YUV420:
-      case TBM_FORMAT_YVU420:
-      case TBM_FORMAT_YUV422:
-      case TBM_FORMAT_YVU422:
-      case TBM_FORMAT_NV12:
-      case TBM_FORMAT_NV21:
-        aligned_width = surf_info.planes[0].stride;
-        break;
-      case TBM_FORMAT_YUYV:
-      case TBM_FORMAT_UYVY:
-        aligned_width = surf_info.planes[0].stride >> 1;
-        break;
-      case TBM_FORMAT_ARGB8888:
-      case TBM_FORMAT_XRGB8888:
-        aligned_width = surf_info.planes[0].stride >> 2;
-        break;
-      default:
-        EHWSERR("not supported format: %x", NULL, surf_info.format);
-     }
-
-   return aligned_width;
-}
-
 static void
 _e_hwc_windows_comp_info_rendered_buffers_set(E_Hwc_Windows_Comp_Info *comp_info,
                                               Eina_List *rendered_buffers)
@@ -1810,10 +1777,10 @@ _e_hwc_windows_pp_info_set(E_Hwc *hwc, tbm_surface_h src, tbm_surface_h dst,
        (!memcmp(&hwc->pp_set_dst_rect, dst_rect, sizeof(Eina_Rectangle))))
       return EINA_TRUE;
 
-   aligned_width_src = _e_hwc_windows_aligned_width_get(src);
+   aligned_width_src = e_comp_wl_tbm_aligned_width_get(src);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(aligned_width_src != 0, EINA_FALSE);
 
-   aligned_width_dst = _e_hwc_windows_aligned_width_get(dst);
+   aligned_width_dst = e_comp_wl_tbm_aligned_width_get(dst);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(aligned_width_dst != 0, EINA_FALSE);
 
    pp_info.src_config.size.h = aligned_width_src;
index 770fc33..5c95030 100644 (file)
@@ -93,39 +93,6 @@ static void _e_output_stream_capture_mask_data_hash_cb_data_free(void *data);
 static void _e_output_stream_capture_mask_image_activate(E_Output *output);
 static void _e_output_stream_capture_mask_image_deactivate(E_Output *output);
 
-static unsigned int
-_e_output_aligned_width_get(E_Output *output, tbm_surface_h tsurface)
-{
-   unsigned int aligned_width = 0;
-   tbm_surface_info_s surf_info;
-
-   tbm_surface_get_info(tsurface, &surf_info);
-
-   switch (surf_info.format)
-     {
-      case TBM_FORMAT_YUV420:
-      case TBM_FORMAT_YVU420:
-      case TBM_FORMAT_YUV422:
-      case TBM_FORMAT_YVU422:
-      case TBM_FORMAT_NV12:
-      case TBM_FORMAT_NV21:
-        aligned_width = surf_info.planes[0].stride;
-        break;
-      case TBM_FORMAT_YUYV:
-      case TBM_FORMAT_UYVY:
-        aligned_width = surf_info.planes[0].stride >> 1;
-        break;
-      case TBM_FORMAT_ARGB8888:
-      case TBM_FORMAT_XRGB8888:
-        aligned_width = surf_info.planes[0].stride >> 2;
-        break;
-      default:
-        EOERR("not supported format: %x", output, surf_info.format);
-     }
-
-   return aligned_width;
-}
-
 static inline void
 _e_output_display_mode_set(E_Output *output, E_Output_Display_Mode display_mode)
 {
@@ -1282,7 +1249,7 @@ _e_output_tdm_capture_info_set(E_Output *output, tdm_capture *tcapture, tbm_surf
    tbm_error = tbm_surface_get_info(tsurface, &surf_info);
    EINA_SAFETY_ON_FALSE_RETURN_VAL(tbm_error == TBM_ERROR_NONE, EINA_FALSE);
 
-   width = _e_output_aligned_width_get(output, tsurface);
+   width = e_comp_wl_tbm_aligned_width_get(tsurface);
    EINA_SAFETY_ON_TRUE_RETURN_VAL(width == 0, EINA_FALSE);
 
    memset(&capture_info, 0, sizeof(tdm_info_capture));