struct _tpl_wl_egl_buffer {
tbm_surface_h tbm_surface;
+ int bo_name;
struct wl_proxy *wl_buffer;
int dx, dy; /* position to attach to wl_surface */
_thread_surface_queue_acquire(tpl_wl_egl_surface_t *wl_egl_surface);
static void
_thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface,
- tbm_surface_h tbm_surface);
+ tpl_wl_egl_buffer_t *wl_egl_buffer);
static tpl_bool_t
_check_native_handle_is_wl_display(tpl_handle_t display)
wl_egl_buffer->wl_buffer = NULL;
wl_egl_buffer->tbm_surface = tbm_surface;
+ wl_egl_buffer->bo_name = _get_tbm_surface_bo_name(tbm_surface);
wl_egl_buffer->wl_egl_surface = wl_egl_surface;
wl_egl_buffer->status = RELEASED;
TPL_INFO("[WL_EGL_BUFFER_CREATE]",
"wl_egl_surface(%p) wl_egl_buffer(%p) tbm_surface(%p) bo(%d)",
wl_egl_surface, wl_egl_buffer, tbm_surface,
- _get_tbm_surface_bo_name(tbm_surface));
+ wl_egl_buffer->bo_name);
}
_wl_egl_buffer_init(wl_egl_buffer, wl_egl_surface);
tbm_surface_internal_ref(tbm_surface);
- bo_name = _get_tbm_surface_bo_name(tbm_surface);
-
wl_egl_buffer = _wl_egl_buffer_create(wl_egl_surface, tbm_surface);
TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer, "Failed to create/get wl_egl_buffer.");
wl_egl_surface->reset = TPL_FALSE;
- TRACE_MARK("[DEQ][NEW]BO_NAME:%d", bo_name);
- TRACE_ASYNC_BEGIN((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name);
+ TRACE_MARK("[DEQ][NEW]BO_NAME:%d", wl_egl_buffer->bo_name);
+ TRACE_ASYNC_BEGIN((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", wl_egl_buffer->bo_name);
TPL_LOG_T("WL_EGL", "[DEQ] wl_egl_buffer(%p) tbm_surface(%p) bo(%d) fence(%d)",
- wl_egl_buffer, tbm_surface, bo_name, release_fence ? *release_fence : -1);
+ wl_egl_buffer, tbm_surface, wl_egl_buffer->bo_name, release_fence ? *release_fence : -1);
tpl_gmutex_unlock(&wl_egl_buffer->mutex);
tpl_gmutex_unlock(&wl_egl_display->wl_event_mutex);
tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
if (wl_egl_surface->vblank_done)
- _thread_wl_surface_commit(wl_egl_surface, tbm_surface);
+ _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer);
else
__tpl_list_push_back(wl_egl_surface->vblank_waiting_buffers,
- tbm_surface);
+ wl_egl_buffer);
tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
ready_to_commit = TPL_TRUE;
else {
wl_egl_buffer->status = WAITING_VBLANK;
- __tpl_list_push_back(wl_egl_surface->vblank_waiting_buffers, tbm_surface);
+ __tpl_list_push_back(wl_egl_surface->vblank_waiting_buffers, wl_egl_buffer);
ready_to_commit = TPL_FALSE;
}
}
tpl_gmutex_unlock(&wl_egl_buffer->mutex);
if (ready_to_commit)
- _thread_wl_surface_commit(wl_egl_surface, tbm_surface);
+ _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer);
}
return TPL_ERROR_NONE;
unsigned int tv_usec, void *user_data)
{
tpl_wl_egl_surface_t *wl_egl_surface = (tpl_wl_egl_surface_t *)user_data;
- tbm_surface_h tbm_surface = NULL;
+ tpl_wl_egl_buffer_t *wl_egl_buffer = NULL;
TRACE_ASYNC_END((int)wl_egl_surface, "WAIT_VBLANK");
TPL_DEBUG("[VBLANK] wl_egl_surface(%p)", wl_egl_surface);
wl_egl_surface->vblank_done = TPL_TRUE;
tpl_gmutex_lock(&wl_egl_surface->surf_mutex);
- tbm_surface = (tbm_surface_h)__tpl_list_pop_front(
+ wl_egl_buffer = (tpl_wl_egl_buffer_t *)__tpl_list_pop_front(
wl_egl_surface->vblank_waiting_buffers,
NULL);
- if (tbm_surface)
- _thread_wl_surface_commit(wl_egl_surface, tbm_surface);
+ if (wl_egl_buffer)
+ _thread_wl_surface_commit(wl_egl_surface, wl_egl_buffer);
tpl_gmutex_unlock(&wl_egl_surface->surf_mutex);
}
/* -- END -- tdm_client vblank callback function */
static void
_thread_wl_surface_commit(tpl_wl_egl_surface_t *wl_egl_surface,
- tbm_surface_h tbm_surface)
+ tpl_wl_egl_buffer_t *wl_egl_buffer)
{
tpl_wl_egl_display_t *wl_egl_display = wl_egl_surface->wl_egl_display;
- tpl_wl_egl_buffer_t *wl_egl_buffer = NULL;
struct wl_surface *wl_surface = wl_egl_surface->wl_surface;
struct wl_egl_window *wl_egl_window = wl_egl_surface->wl_egl_window;
uint32_t version;
- wl_egl_buffer = _get_wl_egl_buffer(tbm_surface);
TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer != NULL,
"wl_egl_buffer sould be not NULL");
if (wl_egl_buffer->wl_buffer == NULL) {
wl_egl_buffer->wl_buffer =
(struct wl_proxy *)wayland_tbm_client_create_buffer(
- wl_egl_display->wl_tbm_client, tbm_surface);
+ wl_egl_display->wl_tbm_client,
+ wl_egl_buffer->tbm_surface);
}
TPL_CHECK_ON_FALSE_ASSERT_FAIL(wl_egl_buffer->wl_buffer != NULL,
"[FATAL] Failed to create wl_buffer");
wl_surface);
pst_feedback->wl_egl_surface = wl_egl_surface;
- pst_feedback->bo_name = _get_tbm_surface_bo_name(tbm_surface);
+ pst_feedback->bo_name = wl_egl_buffer->bo_name;
pst_feedback->pst_sync_fd = wl_egl_buffer->presentation_sync_fd;
wl_egl_buffer->presentation_sync_fd = -1;
zwp_linux_surface_synchronization_v1_set_acquire_fence(wl_egl_surface->surface_sync,
wl_egl_buffer->acquire_fence_fd);
TPL_DEBUG("[SET_ACQUIRE_FENCE] wl_egl_surface(%p) tbm_surface(%p) acquire_fence(%d)",
- wl_egl_surface, tbm_surface, wl_egl_buffer->acquire_fence_fd);
+ wl_egl_surface, wl_egl_buffer->tbm_surface, wl_egl_buffer->acquire_fence_fd);
close(wl_egl_buffer->acquire_fence_fd);
wl_egl_buffer->acquire_fence_fd = -1;
wl_display_flush(wl_egl_display->wl_display);
- TRACE_ASYNC_BEGIN((int)tbm_surface, "[COMMIT ~ RELEASE] BO(%d)",
- _get_tbm_surface_bo_name(tbm_surface));
+ TRACE_ASYNC_BEGIN((int)wl_egl_buffer->tbm_surface, "[COMMIT ~ RELEASE] BO(%d)",
+ wl_egl_buffer->bo_name);
wl_egl_buffer->need_to_commit = TPL_FALSE;
wl_egl_buffer->status = COMMITTED;
- TPL_LOG_T("WL_EGL", "[COMMIT] wl_buffer(%p) tbm_surface(%p) bo(%d)",
- wl_egl_buffer->wl_buffer, tbm_surface,
- _get_tbm_surface_bo_name(tbm_surface));
+ TPL_LOG_T("WL_EGL",
+ "[COMMIT] wl_egl_buffer(%p) wl_buffer(%p) tbm_surface(%p) bo(%d)",
+ wl_egl_buffer, wl_egl_buffer->wl_buffer, wl_egl_buffer->tbm_surface,
+ wl_egl_buffer->bo_name);
if (wl_egl_display->tdm_initialized &&
_thread_surface_vblank_wait(wl_egl_surface) != TPL_ERROR_NONE)
}
TRACE_ASYNC_END(wl_egl_buffer->commit_sync_fd, "[COMMIT_SYNC] bo(%d)",
- _get_tbm_surface_bo_name(tbm_surface));
+ wl_egl_buffer->bo_name);
TPL_DEBUG("[COMMIT_SYNC][SEND] wl_egl_surface(%p) commit_sync_fd(%d)",
wl_egl_surface, wl_egl_buffer->commit_sync_fd);
}
wl_egl_buffer->tbm_surface = NULL;
+ wl_egl_buffer->bo_name = -1;
free(wl_egl_buffer);
}
TPL_INFO("[INFO]",
"INDEX[%d] | wl_egl_buffer(%p) tbm_surface(%p) bo(%d) | status(%d)",
idx, wl_egl_buffer, wl_egl_buffer->tbm_surface,
- _get_tbm_surface_bo_name(wl_egl_buffer->tbm_surface),
+ wl_egl_buffer->bo_name,
wl_egl_buffer->status);
}
}