From: SooChan Lim Date: Fri, 11 Dec 2020 03:55:13 +0000 (+0900) Subject: e_comp_wl_tbm: add egl_image_buffer_get func to E_Comp_wl_Tbm_Funcs X-Git-Tag: submit/tizen/20201211.120426~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F249413%2F1;p=platform%2Fupstream%2Fenlightenment.git e_comp_wl_tbm: add egl_image_buffer_get func to E_Comp_wl_Tbm_Funcs egl_image_buffer_get func has to provide the tbm_surface_h for making the egl_image. Change-Id: Ibf2b2720b322e5183d16200296fe20f69747396e --- diff --git a/src/bin/e_comp_wl_tbm.c b/src/bin/e_comp_wl_tbm.c index 881a45fedf..5371269d78 100644 --- a/src/bin/e_comp_wl_tbm.c +++ b/src/bin/e_comp_wl_tbm.c @@ -33,6 +33,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; return EINA_TRUE; } @@ -69,6 +70,20 @@ e_comp_wl_tbm_capturable_buffer_get(tbm_surface_h tsurface) return tsurface; } +EINTERN tbm_surface_h +e_comp_wl_tbm_egl_image_buffer_get(int width, int height, tbm_format format) +{ + tbm_surface_h egl_image_buffer = NULL; + + 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)) + return egl_image_buffer; + } + + return NULL; +} + EINTERN Eina_Bool e_comp_wl_tbm_init(void) { diff --git a/src/bin/e_comp_wl_tbm.h b/src/bin/e_comp_wl_tbm.h index db762238a7..ba10399de2 100644 --- a/src/bin/e_comp_wl_tbm.h +++ b/src/bin/e_comp_wl_tbm.h @@ -13,7 +13,8 @@ struct _E_Comp_Wl_Tbm_Funcs char *module_name; /* 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 (*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); }; EINTERN Eina_Bool e_comp_wl_tbm_init(void); @@ -30,5 +31,6 @@ 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); # endif #endif diff --git a/src/bin/e_hwc_window_queue.c b/src/bin/e_hwc_window_queue.c index a0c1fed267..54d34075ab 100644 --- a/src/bin/e_hwc_window_queue.c +++ b/src/bin/e_hwc_window_queue.c @@ -180,13 +180,18 @@ _backup_tsurface_create(tbm_surface_h tsurface) return NULL; } - new_tsurface = tbm_surface_create(src_info.width, src_info.height, 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); if (!new_tsurface) { - EHWQERR("fail to allocate the new_tsurface.", NULL, NULL, NULL); - tbm_surface_unmap(tsurface); - return NULL; - } + new_tsurface = tbm_surface_create(src_info.width, src_info.height, src_info.format); + if (!new_tsurface) + { + EHWQERR("fail to allocate the new_tsurface.", NULL, NULL, NULL); + tbm_surface_unmap(tsurface); + return NULL; + } + } ret = tbm_surface_map(new_tsurface, TBM_SURF_OPTION_WRITE, &dst_info); if (ret != TBM_SURFACE_ERROR_NONE)