egl_image_buffer_get func has to provide the tbm_surface_h for making the egl_image.
Change-Id: Ibf2b2720b322e5183d16200296fe20f69747396e
_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;
}
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)
{
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);
/* 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
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)