tpl_wayland_display_t *wayland_display;
#ifdef TPL_USING_WAYLAND_TBM
- tbm_surface_h tbm_surface = NULL;
+ tbm_surface_h tbm_surface = NULL;
#endif
struct wl_proxy *wl_proxy = NULL;
- unsigned int name = -1;
+ unsigned int name = -1;
uint32_t wl_format = 0;
TPL_ASSERT(surface);
break;
default:
TPL_ERR("Unsupported format found in surface!");
- tbm_bo_unref(bo);
- tpl_object_unreference((tpl_object_t *)buffer);
- free(wayland_buffer);
return NULL;
}
/* Create tbm_surface_h */
tbm_surface = tbm_surface_create(width, height, wl_format);
-
if (NULL == tbm_surface)
{
TPL_ERR("TBM SURFACE create failed!");
/* Get tbm_bo from tbm_surface_h */
bo = tbm_bo_ref(tbm_surface_internal_get_bo(tbm_surface, 0));
-
if (NULL == bo)
{
TPL_ERR("TBM get bo failed!");
+ tbm_surface_destroy(tbm_surface);
return NULL;
}
if (bo_handle.ptr == NULL)
{
TPL_ERR("TBM bo get handle failed!");
+ tbm_bo_unref(bo);
tbm_surface_destroy(tbm_surface);
return NULL;
}
if (NULL == buffer)
{
TPL_ERR("TPL buffer alloc failed!");
+ tbm_bo_unref(bo);
tbm_surface_destroy(tbm_surface);
return NULL;
}
if (wayland_buffer == NULL)
{
TPL_ERR("Mem alloc for wayland_buffer failed!");
+ tbm_bo_unref(bo);
tbm_surface_destroy(tbm_surface);
tpl_object_unreference((tpl_object_t *) buffer);
return NULL;
name = tbm_bo_export(bo);
- TPL_LOG(7, "Client back buffer is new alloced | BO:%d",name);
+ TPL_LOG(7, "Client back buffer is new alloced | BO:%d",name);
buffer = __tpl_buffer_alloc(surface, (size_t) name, (int) bo_handle.u32, width, height, depth, stride);
if (NULL == buffer)
if (wl_proxy == NULL)
{
TPL_ERR("Failed to create TBM client buffer!");
+ tbm_bo_unref(bo);
tbm_surface_destroy(tbm_surface);
tpl_object_unreference((tpl_object_t *)buffer);
free(wayland_buffer);
#ifdef EGL_BIND_WL_DISPLAY
unsigned int __tpl_wayland_display_bind_client_display(tpl_display_t *tpl_display, tpl_handle_t native_dpy)
{
- struct wl_display *wayland_display;
tpl_wayland_display_t *tpl_wayland_display;
#ifndef TPL_USING_WAYLAND_TBM /* USING WAYLAND_DRM */
+ struct wl_display *wayland_display;
char *device_name = NULL;
#endif
TPL_ASSERT(tpl_display);
TPL_ASSERT(native_dpy);
- wayland_display = (struct wl_display *) native_dpy;
tpl_wayland_display = (tpl_wayland_display_t *) tpl_display->backend.data;
-
tpl_display->bufmgr_fd = dup(gbm_device_get_fd(tpl_display->native_handle));
tpl_wayland_display->bufmgr = tbm_bufmgr_init(tpl_display->bufmgr_fd);
if (tpl_wayland_display->bufmgr == NULL)
}
#ifndef TPL_USING_WAYLAND_TBM /* USING WAYLAND_DRM */
+ wayland_display = (struct wl_display *) native_dpy;
device_name = drmGetDeviceNameFromFd(tpl_display->bufmgr_fd);
tpl_wayland_display->wl_drm = wayland_drm_init((struct wl_display *) wayland_display, device_name, &wl_drm_server_listener, tpl_display, 0);
if (NULL == tpl_wayland_display->wl_drm)