e_comp_wl_tbm: add egl_image_buffer_get_with_flags to E_Comp_Wl_Tbm_Funcs 85/303985/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 4 Jan 2024 09:43:28 +0000 (18:43 +0900)
committerchangyeon lee <cyeon.lee@samsung.com>
Tue, 9 Jan 2024 02:06:12 +0000 (02:06 +0000)
Change-Id: I3cfe6edd34e3ca4e318e0affad41ad20cc3b668a

src/bin/e_comp_wl_tbm.c
src/bin/e_comp_wl_tbm.h
src/bin/e_hwc_window_queue.c

index 39ab6e952b8891fd811893abd3fae36ee5dbc9f6..c5a986a47b51cbd5fa94cea712a26f33c6aa8b45 100644 (file)
@@ -104,6 +104,7 @@ e_comp_wl_tbm_module_func_set(const char *module_name, E_Comp_Wl_Tbm_Funcs *fn)
    _e_comp_wl_tbm_funcs->module_name = strdup(module_name);
    _e_comp_wl_tbm_funcs->capturable_buffer_get = fn->capturable_buffer_get;
    _e_comp_wl_tbm_funcs->egl_image_buffer_get = fn->egl_image_buffer_get;
+   _e_comp_wl_tbm_funcs->egl_image_buffer_get_with_flags = fn->egl_image_buffer_get_with_flags;
 
    return EINA_TRUE;
 }
@@ -141,10 +142,16 @@ e_comp_wl_tbm_capturable_buffer_get(tbm_surface_h tsurface)
 }
 
 EINTERN tbm_surface_h
-e_comp_wl_tbm_egl_image_buffer_get(int width, int height, tbm_format format)
+e_comp_wl_tbm_egl_image_buffer_get(int width, int height, tbm_format format, int flags)
 {
    tbm_surface_h egl_image_buffer = NULL;
 
+   if (_e_comp_wl_tbm_funcs && _e_comp_wl_tbm_funcs->egl_image_buffer_get_with_flags)
+     {
+        if (_e_comp_wl_tbm_funcs->egl_image_buffer_get_with_flags(width, height, format, flags, &egl_image_buffer))
+          return egl_image_buffer;
+     }
+
    if (_e_comp_wl_tbm_funcs && _e_comp_wl_tbm_funcs->egl_image_buffer_get)
      {
         if (_e_comp_wl_tbm_funcs->egl_image_buffer_get(width, height, format, &egl_image_buffer))
index f9c8b190af555f6212c2168c8b34f06f0b503295..13c27334f5ede025ab3e476b3bb565ef9b1d3be9 100644 (file)
@@ -16,6 +16,7 @@ struct _E_Comp_Wl_Tbm_Funcs
    /* reference count of dst_tsurface should be increased */
    Eina_Bool     (*capturable_buffer_get)(tbm_surface_h src_tsurface, tbm_surface_h *dst_tsurface);
    Eina_Bool     (*egl_image_buffer_get)(int width, int height, tbm_format format, tbm_surface_h *egl_image_tsurface);
+   Eina_Bool     (*egl_image_buffer_get_with_flags)(int width, int height, tbm_format format, int flags, tbm_surface_h *egl_image_tsurface);
 };
 
 EINTERN Eina_Bool e_comp_wl_tbm_init(void);
@@ -34,7 +35,7 @@ E_API   Eina_Bool e_comp_wl_tbm_module_func_unset(void);
 
 /* reference count of returned tbm_surface should be decreased when not using it anymore */
 EINTERN tbm_surface_h e_comp_wl_tbm_capturable_buffer_get(tbm_surface_h tsurface);
-EINTERN tbm_surface_h e_comp_wl_tbm_egl_image_buffer_get(int width, int height, tbm_format format);
+EINTERN tbm_surface_h e_comp_wl_tbm_egl_image_buffer_get(int width, int height, tbm_format format, int flags);
 
 EINTERN Eina_Bool e_comp_wl_tbm_gbm_bo_user_data_set(tbm_surface_h tsurface, void *gbo);
 
index 61d7d91fbb451f36ef80a99b9aa044687674789e..d28ab21c01893e5ab8edd7307feee4cef618c89d 100644 (file)
@@ -166,6 +166,7 @@ _backup_tsurface_create(tbm_surface_h tsurface)
    tbm_surface_h new_tsurface;
    tbm_surface_info_s src_info;
    int ret = TBM_SURFACE_ERROR_NONE;
+   tbm_bo tbo;
 
    ret = tbm_surface_get_info(tsurface, &src_info);
    if (ret != TBM_SURFACE_ERROR_NONE)
@@ -174,11 +175,18 @@ _backup_tsurface_create(tbm_surface_h tsurface)
         return NULL;
      }
 
+   tbo = tbm_surface_internal_get_bo(tsurface, 0);
+   if (!tbo)
+     {
+        EHWQERR("fail to get bo", NULL, NULL, NULL);
+        return NULL;
+     }
+
    EHWQINF("Copy Backup buffer create w:%d h:%d fmt:%c%c%c%c", NULL, NULL, NULL,
            src_info.width, src_info.height, EHW_FOURCC_STR(src_info.format));
 
    /* get the buffer from e20 module first, if no buffer from e20 module, then create the tbm_surface here. */
-   new_tsurface = e_comp_wl_tbm_egl_image_buffer_get(src_info.width, src_info.height, src_info.format);
+   new_tsurface = e_comp_wl_tbm_egl_image_buffer_get(src_info.width, src_info.height, src_info.format, tbm_bo_get_flags(tbo));
    if (!new_tsurface)
      {
         new_tsurface = tbm_surface_create(src_info.width, src_info.height, src_info.format);