#define EHWS_BUFFER_COMP_INFO_KEY (unsigned long)(&ehws_comp_buffer_info_key)
static Eina_Bool _e_hwc_windows_target_window_queue_set(E_Hwc_Window_Target *target_hwc_window);
-static Eina_Bool _e_hwc_windows_pp_output_data_commit(E_Hwc *hwc, E_Hwc_Window_Commit_Data *data);
-static Eina_Bool _e_hwc_windows_pp_window_commit(E_Hwc *hwc, E_Hwc_Window *hwc_window);
static void _e_hwc_windows_wait_commit_set(E_Hwc *hwc, Eina_Bool set);
static E_Comp_Wl_Buffer *
E_Hwc_Mode hwc_mode = E_HWC_MODE_NONE;
int num_visible = hwc->num_visible_windows;
- if (hwc->pp_set && hwc->pp_hwc_window)
- {
- hwc_mode = E_HWC_MODE_FULL;
- ecore_event_add(E_EVENT_COMPOSITOR_DISABLE, NULL, NULL, NULL);
- hwc->hwc_mode = hwc_mode;
- return hwc_mode;
- }
-
/* check ui windows */
if (!num_visible)
hwc_mode = E_HWC_MODE_NONE;
const Eina_List *l;
E_Hwc_Window *hwc_window;
Eina_Bool ret = EINA_FALSE;
- Eina_Bool temp = EINA_FALSE;
/* return TRUE when the number of the commit data is more than one */
EINA_LIST_FOREACH(hwc->hwc_windows, l, hwc_window)
{
- if (hwc->pp_set)
- {
- if (hwc->pp_hwc_window)
- temp = e_hwc_window_pp_commit_data_acquire(hwc_window, EINA_TRUE);
- else
- temp = e_hwc_window_pp_commit_data_acquire(hwc_window, EINA_FALSE);
- }
- else
- temp = e_hwc_window_commit_data_acquire(hwc_window);
- if (!temp) continue;
+ if (!e_hwc_window_commit_data_acquire(hwc_window)) continue;
_e_hwc_windows_presentation_feedback_take(hwc_window);
{
e_hwc_window_presentation_time_feedback_discard(hwc_window_target);
- if (hwc->pp_set)
- {
- if (hwc->pp_hwc_window)
- ret = e_hwc_window_pp_commit_data_acquire(hwc_window_target, EINA_TRUE);
- else
- ret = e_hwc_window_pp_commit_data_acquire(hwc_window_target, EINA_FALSE);
- }
- else
- ret = e_hwc_window_commit_data_acquire(hwc_window_target);
-
+ ret = e_hwc_window_commit_data_acquire(hwc_window_target);
if (ret)
{
/* it is possible that other hwc_window is freed in
{
if (hwc_window->is_target) continue;
- if (hwc->pp_set)
- {
- if (hwc->pp_hwc_window)
- ret = e_hwc_window_pp_commit_data_acquire(hwc_window, EINA_TRUE);
- else
- ret = e_hwc_window_pp_commit_data_acquire(hwc_window, EINA_FALSE);
- }
- else
- ret = e_hwc_window_commit_data_acquire(hwc_window);
+ ret = e_hwc_window_commit_data_acquire(hwc_window);
if (!ret) continue;
EHWSTRACE("!!!!!!!! HWC OffScreen Commit !!!!!!!!", NULL, hwc);
return NULL;
}
-static E_Hwc_Window *
-_e_hwc_windows_pp_window_get(E_Hwc *hwc, tbm_surface_h tsurface)
-{
- Eina_List *l;
- E_Hwc_Window *hwc_window = NULL;
-
- EINA_LIST_FOREACH(hwc->pp_hwc_window_list, l, hwc_window)
- {
- if (!hwc_window) continue;
- if (!hwc_window->commit_data) continue;
-
- if (hwc_window->commit_data->buffer.tsurface == tsurface)
- return hwc_window;
- }
-
- return NULL;
-}
-
static void
-_e_hwc_windows_pp_output_commit_handler(tdm_hwc *thwc, unsigned int sequence,
- unsigned int tv_sec, unsigned int tv_usec,
- void *user_data)
-{
- E_Hwc *hwc;
- E_Hwc_Window_Commit_Data *data = NULL;
- E_Output *output = NULL;
-
- EINA_SAFETY_ON_NULL_RETURN(user_data);
-
- hwc = user_data;
-
- _e_hwc_windows_commit_data_release(hwc, sequence, tv_sec, tv_usec);
- _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
-
- /* layer already resetted */
- if (hwc->pp_output_commit_data)
- {
- data = hwc->pp_output_commit_data;
- hwc->pp_output_commit_data = NULL;
-
- /* if pp_set is false, do not deal with pending list */
- if (!hwc->pp_set)
- {
- if (hwc->pp_tsurface)
- tbm_surface_internal_unref(hwc->pp_tsurface);
-
- hwc->pp_tsurface = data->buffer.tsurface;
- _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
-
- E_FREE(data);
-
- return;
- }
-
- if (hwc->pp_tqueue && hwc->pp_tsurface)
- {
- /* release and unref the current pp surface on the hwc */
- tbm_surface_queue_release(hwc->pp_tqueue, hwc->pp_tsurface);
- tbm_surface_internal_unref(hwc->pp_tsurface);
- }
-
- /* set the new pp surface to the hwc */
- hwc->pp_tsurface = data->buffer.tsurface;
-
- E_FREE(data);
- }
-
- EHWSTRACE("!!!!!!!! HWC PP Output Commit Handler !!!!!!!!", NULL, hwc);
- EHWSTRACE(" pp_tsurface(%p)", NULL, hwc, hwc->pp_tsurface);
-
- output = hwc->output;
- if (e_output_dpms_get(output))
- return;
-}
-
-static Eina_Bool
-_e_hwc_windows_pp_output_data_commit(E_Hwc *hwc, E_Hwc_Window_Commit_Data *data)
+_e_hwc_windows_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_surface_h tsurface_dst, void *user_data)
{
- tdm_error terror;
- tdm_region fb_damage;
- E_Output *output;
-
- /* the damage isn't supported by hwc extension yet */
- memset(&fb_damage, 0, sizeof(fb_damage));
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE);
-
- output = hwc->output;
-
- if (e_output_dpms_get(output))
- goto fail;
-
- EHWSTRACE("!!!!!!!! HWC PP Output Commit !!!!!!!!", NULL, hwc);
- EHWSTRACE(" tsurface(%p)", NULL, hwc, data->buffer.tsurface);
-
- /* no need to pass composited_wnds list because smooth transition isn't
- * used in this case */
- terror = tdm_hwc_set_client_target_buffer(hwc->thwc, data->buffer.tsurface, fb_damage);
- if (terror != TDM_ERROR_NONE)
- {
- EHWSERR("fail to tdm_hwc_set_client_target_buffer", hwc);
- goto fail;
- }
-
- terror = tdm_hwc_accept_validation(hwc->thwc);
- if (terror != TDM_ERROR_NONE)
- {
- EHWSERR("fail to tdm_hwc_accept_validation", hwc);
- goto fail;
- }
-
- terror = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_pp_output_commit_handler, hwc);
- if (terror != TDM_ERROR_NONE)
- {
- EHWSERR("fail to tdm_hwc_commit", hwc);
- /* send tizen_hwc_commit feedback discarded */
- e_comp_wl_tizen_hwc_discarded();
- goto fail;
- }
-
- /* send tizen_hwc_commit feedback committed */
- e_comp_wl_tizen_hwc_committed();
-
- hwc->pp_output_commit_data = data;
-
- return EINA_TRUE;
-
-fail:
- tbm_surface_internal_unref(data->buffer.tsurface);
- tbm_surface_queue_release(hwc->pp_tqueue, data->buffer.tsurface);
- E_FREE(data);
+ E_Hwc *hwc = NULL;
+ E_Hwc_Window *hwc_window = NULL;
+ E_Hwc_Window_Queue_Buffer *queue_buffer;
- _e_hwc_windows_commit_data_release(hwc, 0, 0, 0);
- _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
+ hwc = (E_Hwc *)user_data;
+ EINA_SAFETY_ON_NULL_RETURN(hwc);
- return EINA_FALSE;
-}
+ EHWSTRACE("!!!!!!!! HWC PP Commit Handler !!!!!!!!", NULL, hwc);
+ EHWSTRACE("PP DON tsurface src:%p dst:%p", NULL, hwc, tsurface_src, tsurface_dst);
-static Eina_Bool
-_e_hwc_windows_pp_output_commit(E_Hwc *hwc, tbm_surface_h tsurface)
-{
- tbm_surface_h pp_tsurface = NULL;
- tbm_error_e tbm_err;
- E_Hwc_Window_Commit_Data *data = NULL;
+ hwc->pp_commit = EINA_FALSE;
- tbm_err = tbm_surface_queue_enqueue(hwc->pp_tqueue, tsurface);
- if (tbm_err != TBM_ERROR_NONE)
- {
- EHWSERR("fail tbm_surface_queue_enqueue", hwc);
- goto fail;
- }
+ hwc_window = (E_Hwc_Window *)hwc->target_hwc_window;
+ EINA_SAFETY_ON_FALSE_RETURN(hwc_window);
- tbm_err = tbm_surface_queue_acquire(hwc->pp_tqueue, &pp_tsurface);
- if (tbm_err != TBM_ERROR_NONE)
+ queue_buffer = e_hwc_window_queue_buffer_find(hwc->pp_queue, tsurface_dst);
+ if (!queue_buffer)
{
- EHWSERR("fail tbm_surface_queue_acquire", hwc);
- goto fail;
+ ERR("fail to e_hwc_window_queue_buffer_find");
+ goto done;
}
- data = E_NEW(E_Hwc_Window_Commit_Data, 1);
- if (!data) goto fail;
- data->buffer.tsurface = pp_tsurface;
- tbm_surface_internal_ref(data->buffer.tsurface);
+ if (!e_hwc_window_queue_buffer_enqueue(hwc->pp_queue, queue_buffer))
+ ERR("fail to e_hwc_window_queue_buffer_enqueue");
- if (!_e_hwc_windows_pp_output_data_commit(hwc, data))
+ /* source tsurface buffer queue */
+ if (hwc->pp_buffer.queue)
{
- EHWSERR("fail to _e_hwc_windows_pp_output_data_commit", hwc);
- return EINA_FALSE;
+ queue_buffer = e_hwc_window_queue_buffer_find(hwc->pp_buffer.queue,
+ hwc->pp_buffer.tsurface);
+ if (queue_buffer)
+ e_hwc_window_queue_buffer_release(hwc->pp_buffer.queue, queue_buffer);
}
- return EINA_TRUE;
-
-fail:
- tbm_surface_queue_release(hwc->pp_tqueue, tsurface);
- if (pp_tsurface && pp_tsurface != tsurface)
- tbm_surface_queue_release(hwc->pp_tqueue, pp_tsurface);
+ e_comp_wl_buffer_reference(&hwc->pp_buffer_ref, NULL);
- return EINA_FALSE;
-}
-
-static void
-_e_hwc_windows_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_surface_h tsurface_dst, void *user_data)
-{
- E_Output *output = NULL;
- E_Hwc *hwc = NULL;
- E_Hwc_Window *hwc_window = NULL;
-
- hwc = (E_Hwc *)user_data;
- EINA_SAFETY_ON_NULL_RETURN(hwc);
- hwc_window = _e_hwc_windows_pp_window_get(hwc, tsurface_src);
- EINA_SAFETY_ON_NULL_RETURN(hwc_window);
-
- hwc->pp_hwc_window_list = eina_list_remove(hwc->pp_hwc_window_list, hwc_window);
-
- EHWSTRACE("!!!!!!!! HWC PP Commit Handler !!!!!!!!", NULL, hwc);
- EHWSTRACE(" tsurface src(%p) dst(%p)", NULL, hwc, tsurface_src, tsurface_dst);
-
- hwc->pp_commit = EINA_FALSE;
+done:
+ tbm_surface_internal_unref(tsurface_src);
+ tbm_surface_internal_unref(tsurface_dst);
- /* if pp_set is false, skip the commit */
if (!hwc->pp_set)
{
if (hwc->tpp)
{
+ EHWSINF("PP Destroy tdm_pp:%p", NULL, hwc, hwc->tpp);
+
tdm_pp_destroy(hwc->tpp);
hwc->tpp = NULL;
}
- _e_hwc_windows_commit_data_release(hwc, 0, 0, 0);
- _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
- goto done;
+ e_hwc_window_buffer_set(&hwc->pp_buffer, NULL, NULL);
}
-
- output = hwc->output;
- if (e_output_dpms_get(output))
- {
- tbm_surface_queue_release(hwc->pp_tqueue, tsurface_dst);
- _e_hwc_windows_commit_data_release(hwc, 0, 0, 0);
- _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
-
- goto done;
- }
-
- if (!_e_hwc_windows_pp_output_commit(hwc, tsurface_dst))
- EHWSERR("fail to _e_hwc_windows_pp_output_commit", hwc);
-
-done:
- tbm_surface_internal_unref(tsurface_src);
- tbm_surface_internal_unref(tsurface_dst);
}
static Eina_Bool
tdm_error ret = TDM_ERROR_NONE;
unsigned int aligned_width_src = 0, aligned_width_dst = 0;
+ if ((!memcmp(&hwc->pp_set_src_rect, src_rect, sizeof(Eina_Rectangle))) &&
+ (!memcmp(&hwc->pp_set_dst_rect, dst_rect, sizeof(Eina_Rectangle))))
+ return EINA_TRUE;
+
aligned_width_src = _e_hwc_windows_aligned_width_get(src);
EINA_SAFETY_ON_FALSE_RETURN_VAL(aligned_width_src != 0, EINA_FALSE);
}
static Eina_Bool
-_e_hwc_pp_windows_info_set(E_Hwc *hwc, E_Hwc_Window *hwc_window, tbm_surface_h dst_tsurface)
-{
- tbm_surface_h src_tsurface = hwc_window->commit_data->buffer.tsurface;
- Eina_Rectangle dst_rect;
-
- EINA_SAFETY_ON_FALSE_RETURN_VAL(hwc->pp_set_info == EINA_TRUE, EINA_TRUE);
-
- dst_rect.x = 0;
- dst_rect.y = 0;
- dst_rect.w = tbm_surface_get_width(dst_tsurface);
- dst_rect.h = tbm_surface_get_height(dst_tsurface);
-
- if (_e_hwc_windows_pp_info_set(hwc, src_tsurface, dst_tsurface, &hwc->pp_rect, &dst_rect) != EINA_TRUE)
- {
- EHWSERR("fail pp info set", hwc);
- return EINA_FALSE;
- }
- hwc->pp_set_info = EINA_FALSE;
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_e_hwc_windows_pp_window_commit(E_Hwc *hwc, E_Hwc_Window *hwc_window)
-{
- E_Output *output = NULL;
- tbm_surface_h pp_tsurface = NULL;
- tbm_error_e tbm_err = TBM_ERROR_NONE;
- tdm_error terror = TDM_ERROR_NONE;
- E_Hwc_Window_Commit_Data *commit_data = hwc_window->commit_data;
- EINA_SAFETY_ON_NULL_RETURN_VAL(commit_data, EINA_FALSE);
-
- tbm_surface_h tsurface = commit_data->buffer.tsurface;
-
- EHWSTRACE("!!!!!!!! HWC PP Commit !!!!!!!!", NULL, hwc);
- EHWSTRACE(" tsurface(%p) tqueue(%p) wl_buffer(%p) data(%p)",
- NULL, hwc, commit_data->buffer.tsurface, hwc->pp_tqueue,
- commit_data->buffer_ref.buffer ? commit_data->buffer_ref.buffer->resource : NULL, commit_data);
-
- output = hwc->output;
- if (e_output_dpms_get(output))
- return EINA_FALSE;
-
- tbm_err = tbm_surface_queue_dequeue(hwc->pp_tqueue, &pp_tsurface);
- if (tbm_err != TBM_ERROR_NONE)
- {
- EHWSERR("fail tbm_surface_queue_dequeue", hwc);
- return EINA_FALSE;
- }
-
- if (!_e_hwc_pp_windows_info_set(hwc, hwc_window, pp_tsurface))
- {
- EHWSERR("fail _e_hwc_windows_info_set", hwc);
- goto pp_fail;
- }
-
- tbm_surface_internal_ref(pp_tsurface);
- tbm_surface_internal_ref(commit_data->buffer.tsurface);
- terror = tdm_pp_attach(hwc->tpp, commit_data->buffer.tsurface, pp_tsurface);
- EINA_SAFETY_ON_FALSE_GOTO(terror == TDM_ERROR_NONE, attach_fail);
-
- hwc->pp_hwc_window_list = eina_list_append(hwc->pp_hwc_window_list, hwc_window);
-
- terror = tdm_pp_commit(hwc->tpp);
- EINA_SAFETY_ON_FALSE_GOTO(terror == TDM_ERROR_NONE, commit_fail);
-
- _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
- hwc->pp_commit = EINA_TRUE;
-
- return EINA_TRUE;
-
-commit_fail:
- hwc->pp_hwc_window_list = eina_list_remove(hwc->pp_hwc_window_list, hwc_window);
-attach_fail:
- tbm_surface_internal_unref(pp_tsurface);
- tbm_surface_internal_unref(tsurface);
-pp_fail:
- tbm_surface_queue_release(hwc->pp_tqueue, pp_tsurface);
-
- EHWSERR("failed _e_hwc_windows_pp_data_commit", hwc);
-
- return EINA_FALSE;
-}
-
-static E_Hwc_Window *
-_e_hwc_windows_pp_get_hwc_window_for_zoom(E_Hwc *hwc)
-{
- E_Hwc_Window_Target *target_hwc_window = NULL;
- E_Hwc_Window *hwc_window_for_zoom = NULL;
- int w, h;
-
- e_output_size_get(hwc->output, &w, &h);
-
- if (hwc->pp_hwc_window)
- {
- if (tbm_surface_get_width(hwc->pp_hwc_window->buffer.tsurface) != w ||
- tbm_surface_get_height(hwc->pp_hwc_window->buffer.tsurface) != h)
- return NULL;
-
- hwc_window_for_zoom = hwc->pp_hwc_window;
- }
- else
- {
- target_hwc_window = hwc->target_hwc_window;
- EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, NULL);
-
- hwc_window_for_zoom = (E_Hwc_Window *)target_hwc_window;
- if (!hwc_window_for_zoom->buffer.tsurface) return NULL;
- }
-
- return hwc_window_for_zoom;
-}
-
-static Eina_Bool
-_e_hwc_windows_pp_commit(E_Hwc *hwc)
-{
- E_Hwc_Window_Commit_Data *commit_data = NULL;
- E_Hwc_Window *hwc_window = NULL;
- tdm_error terror = TDM_ERROR_NONE;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc->pp_tqueue, EINA_FALSE);
-
- hwc_window = _e_hwc_windows_pp_get_hwc_window_for_zoom(hwc);
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window, EINA_FALSE);
-
- commit_data = hwc_window->commit_data;
- if (!commit_data || !commit_data->buffer.tsurface)
- {
- EHWSINF("no commit_data for pp. execute commit", NULL, hwc);
- EHWSTRACE("======= HWC Accept Validation no pp commit data =======", NULL, hwc);
- terror = tdm_hwc_accept_validation(hwc->thwc);
- if (terror != TDM_ERROR_NONE)
- {
- EHWSERR("fail to tdm_hwc_accept_validation", hwc);
- return EINA_FALSE;
- }
-
- _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
-
- terror = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_commit_handler, hwc);
- if (terror != TDM_ERROR_NONE)
- {
- _e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
- EHWSERR("fail to tdm_hwc_commit", hwc);
- /* send tizen_hwc_commit feedback discarded */
- e_comp_wl_tizen_hwc_discarded();
- return EINA_FALSE;
- }
-
- /* send tizen_hwc_commit feedback committed */
- e_comp_wl_tizen_hwc_committed();
-
- hwc->wait_commit = EINA_TRUE;
-
- return EINA_TRUE;
- }
-
- if (!tbm_surface_queue_can_dequeue(hwc->pp_tqueue, 0))
- {
- EHWSTRACE("PP Commit Can Dequeue failed tsurface(%p) tqueue(%p) wl_buffer(%p) data(%p)",
- NULL, hwc, commit_data->buffer.tsurface, hwc->pp_tqueue,
- commit_data->buffer_ref.buffer ? commit_data->buffer_ref.buffer->resource : NULL, commit_data);
-
- _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
-
- return EINA_TRUE;
- }
-
- if (!_e_hwc_windows_pp_window_commit(hwc, hwc_window))
- {
- EHWSERR("fail _e_hwc_windows_pp_data_commit", hwc);
- e_hwc_window_commit_data_release(hwc_window);
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
_e_hwc_windows_commit_handler_timeout(void *data)
{
E_Hwc *hwc = (E_Hwc *)data;
EHWSERR("Timeout wait commit", hwc);
- if (hwc->pp_output_commit_data)
- _e_hwc_windows_pp_output_commit_handler(hwc->thwc, 0, 0, 0, hwc);
- else
- _e_hwc_windows_commit_handler(hwc->thwc, 0, 0, 0, hwc);
+ _e_hwc_windows_commit_handler(hwc->thwc, 0, 0, 0, hwc);
hwc->wait_commit = EINA_FALSE;
hwc->commit_handler_timer = NULL;
_e_hwc_windows_device_state_available_update(E_Hwc *hwc)
{
Eina_Bool available = EINA_TRUE;
- E_Hwc_Window *hwc_window = NULL;
- Eina_List *visible_windows = NULL;
- int w, h;
-
- e_output_size_get(hwc->output, &w, &h);
/* make the full_gl_composite when the zoom is enabled */
if (hwc->pp_set)
{
available = EINA_FALSE;
-
- if (hwc->num_visible_windows > 1 || hwc->pp_set_info || e_comp->nocomp_override)
- {
- hwc->pp_hwc_window = NULL;
- }
- else
- {
- /* if there is only 1 visible window, set to pp_hwc_window*/
- visible_windows = hwc->visible_windows;
-
- if (eina_list_count(visible_windows) == 1)
- hwc_window = eina_list_nth(visible_windows, 0);
-
- if (hwc_window == NULL)
- hwc->pp_hwc_window = NULL;
- else
- {
- if (tbm_surface_get_width(hwc_window->buffer.tsurface) != w ||
- tbm_surface_get_height(hwc_window->buffer.tsurface) != h)
- hwc->pp_hwc_window = NULL;
- else
- hwc->pp_hwc_window = hwc_window;
- }
- }
-
- goto finish;
- }
-
- /* make the full_gl_composite when the zoom is disabled */
- if (hwc->pp_unset)
- {
- available = EINA_FALSE;
- hwc->pp_hwc_window = NULL;
-
goto finish;
}
return EINA_TRUE;
}
+static void
+_e_hwc_windows_pp_hwc_window_update(E_Hwc *hwc)
+{
+ E_Hwc_Window *hwc_window;
+ int w, h;
+
+ e_output_size_get(hwc->output, &w, &h);
+
+ if (hwc->num_visible_windows != 1)
+ goto clear;
+
+ if (e_hwc_deactive_get(hwc))
+ goto clear;
+
+ hwc_window = eina_list_nth(hwc->visible_windows, 0);
+ if (!hwc_window)
+ goto clear;
+
+ if ((tbm_surface_get_width(hwc_window->buffer.tsurface)) != w ||
+ (tbm_surface_get_height(hwc_window->buffer.tsurface)) != h)
+ goto clear;
+
+ if (!hwc_window->device_state_available)
+ goto clear;
+
+ if (hwc->pp_hwc_window != hwc_window)
+ EHWSTRACE("Set pp_hwc_window:%p", NULL, hwc, hwc_window);
+
+ hwc->pp_hwc_window = hwc_window;
+
+ return;
+
+clear:
+ if (hwc->pp_hwc_window)
+ EHWSTRACE("Unset pp_hwc_window", NULL, hwc);
+
+ hwc->pp_hwc_window = NULL;
+}
+
/* check if there is a need to update the output */
static Eina_Bool
_e_hwc_windows_changes_update(E_Hwc *hwc)
update_changes = EINA_TRUE;
}
+ if (hwc->pp_set)
+ _e_hwc_windows_pp_hwc_window_update(hwc);
+
/* update the states of the visible windows when there is something to update */
if (update_changes)
{
if (e_hwc_window_is_target(hwc_window)) continue;
e_hwc_window_constraints_update(hwc_window);
- if (hwc->pp_hwc_window == hwc_window)
- e_hwc_window_pp_rendered_window_update(hwc_window);
- else
- e_hwc_window_rendered_window_update(hwc_window);
+ e_hwc_window_rendered_window_update(hwc_window);
if (hwc_window->state == E_HWC_WINDOW_STATE_CLIENT) num_client++;
if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE) num_device++;
}
/* skip the target_buffer when the window is on trainsition of the composition */
- if (hwc_mode != E_HWC_MODE_FULL && _e_hwc_windows_transition_check(hwc))
+ if ((hwc_mode != E_HWC_MODE_FULL) && (_e_hwc_windows_transition_check(hwc)) && (!hwc->pp_set))
{
- /* if pp set enabled, buffer set to tdm after pp done */
_e_hwc_windows_target_window_buffer_skip(hwc);
if (!hwc->transition)
dst_pos.x, dst_pos.y, dst_pos.w, dst_pos.h);
}
+static void
+_e_hwc_windows_pp_rect_set(E_Hwc *hwc, Eina_Rectangle *src_rect, Eina_Rectangle *dst_rect)
+{
+ memcpy(&hwc->pp_src_rect, src_rect, sizeof(Eina_Rectangle));
+ memcpy(&hwc->pp_dst_rect, dst_rect, sizeof(Eina_Rectangle));
+}
+
+static Eina_Bool
+_e_hwc_windows_pp_buffer_update(E_Hwc *hwc)
+{
+ E_Hwc_Window_Queue_Buffer *queue_buffer;
+ E_Hwc_Window *hwc_window;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
+
+ if (hwc->pp_hwc_window)
+ {
+ hwc_window = hwc->pp_hwc_window;
+
+ e_hwc_window_queue_clear(((E_Hwc_Window *)hwc->target_hwc_window)->queue);
+ }
+ else
+ hwc_window = (E_Hwc_Window *)hwc->target_hwc_window;
+
+ if ((hwc_window->is_target) && ((E_Hwc_Window *)hwc->target_hwc_window == hwc_window))
+ {
+ queue_buffer = e_hwc_window_queue_buffer_acquire(hwc_window->queue);
+ if (!queue_buffer) return EINA_FALSE;
+
+ e_hwc_window_buffer_set(&hwc->pp_buffer, queue_buffer->tsurface, hwc_window->queue);
+ }
+ else
+ {
+ if (hwc_window->buffer.tsurface == hwc->pp_buffer.tsurface)
+ return EINA_FALSE;
+
+ e_hwc_window_buffer_set(&hwc->pp_buffer,
+ hwc_window->buffer.tsurface, hwc_window->buffer.queue);
+
+ if (!e_hwc_window_is_target(hwc_window))
+ e_comp_wl_buffer_reference(&hwc->pp_buffer_ref, _e_hwc_windows_comp_wl_buffer_get(hwc_window));
+ }
+
+ return EINA_TRUE;
+}
+
static Eina_Bool
_e_hwc_windows_mirror_changes_update(E_Hwc *hwc)
{
target_window = (E_Hwc_Window *)target_hwc_window;
EINA_SAFETY_ON_NULL_RETURN_VAL(target_window->queue, EINA_FALSE);
- if (e_hwc_window_state_get(target_window) == E_HWC_WINDOW_STATE_NONE)
+ if ((e_hwc_window_state_get(target_window) == E_HWC_WINDOW_STATE_NONE) ||
+ ((hwc->pp_set) && (hwc->pp_hwc_window)))
{
/* evas_norender is needed for preventing memory leak
because evas_object is freed in manual render
if (release_fences) free(release_fences);
}
+static Eina_Bool
+_e_hwc_windows_pp_commit(E_Hwc *hwc)
+{
+ E_Output *output = NULL;
+ E_Hwc_Window_Queue_Buffer *queue_buffer = NULL;
+ tdm_error terror = TDM_ERROR_NONE;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
+
+ if (hwc->pp_commit) return EINA_TRUE;
+
+ output = hwc->output;
+ if (e_output_dpms_get(output))
+ return EINA_TRUE;
+
+ if (!e_hwc_window_queue_buffer_can_dequeue(hwc->pp_queue)) return EINA_TRUE;
+
+ if (!_e_hwc_windows_pp_buffer_update(hwc)) return EINA_TRUE;
+
+ queue_buffer = e_hwc_window_queue_buffer_dequeue(hwc->pp_queue);
+ if (!queue_buffer)
+ {
+ EHWSERR("fail e_hwc_window_queue_buffer_dequeue", hwc);
+ return EINA_FALSE;
+ }
+
+ if (!_e_hwc_windows_pp_info_set(hwc, hwc->pp_buffer.tsurface,
+ queue_buffer->tsurface, &hwc->pp_src_rect, &hwc->pp_dst_rect))
+ {
+ EHWSERR("fail _e_hwc_windows_pp_info_set", hwc);
+ goto pp_fail;
+ }
+
+ tbm_surface_internal_ref(queue_buffer->tsurface);
+ tbm_surface_internal_ref(hwc->pp_buffer.tsurface);
+ terror = tdm_pp_attach(hwc->tpp, hwc->pp_buffer.tsurface, queue_buffer->tsurface);
+ EINA_SAFETY_ON_FALSE_GOTO(terror == TDM_ERROR_NONE, attach_fail);
+
+ EHWSTRACE("!!!!!!!! HWC PP Commit !!!!!!!!", NULL, hwc);
+ EHWSTRACE("PP COM tsurface:%p tqueue:%p pp_hwc_window:%p", NULL, hwc,
+ hwc->pp_buffer.tsurface, hwc->pp_tqueue, hwc->pp_hwc_window);
+
+ terror = tdm_pp_commit(hwc->tpp);
+ EINA_SAFETY_ON_FALSE_GOTO(terror == TDM_ERROR_NONE, commit_fail);
+
+ hwc->pp_commit = EINA_TRUE;
+
+ return EINA_TRUE;
+
+commit_fail:
+attach_fail:
+ tbm_surface_internal_unref(queue_buffer->tsurface);
+ tbm_surface_internal_unref(hwc->pp_buffer.tsurface);
+pp_fail:
+ if (queue_buffer)
+ e_hwc_window_queue_buffer_release(hwc->pp_queue, queue_buffer);
+
+ if ((hwc->pp_buffer.tsurface) && (hwc->pp_buffer.queue))
+ {
+ queue_buffer = e_hwc_window_queue_buffer_find(hwc->pp_buffer.queue, hwc->pp_buffer.tsurface);
+ if (queue_buffer)
+ e_hwc_window_queue_buffer_release(hwc->pp_buffer.queue, queue_buffer);
+ }
+
+ EHWSERR("failed _e_hwc_windows_pp_data_commit", hwc);
+
+ hwc->pp_commit = EINA_FALSE;
+
+ return EINA_FALSE;
+}
+
EINTERN Eina_Bool
e_hwc_windows_commit(E_Hwc *hwc, E_Output_Display_Mode display_mode)
{
}
}
- if (hwc->hwc_mode != E_HWC_MODE_FULL) {
- if (!_e_hwc_windows_target_buffer_prepared(hwc))
- return EINA_TRUE;
- }
+ if (hwc->pp_set)
+ {
+ e_output_zoom_rotating_check(output);
+ _e_hwc_windows_pp_commit(hwc);
+ }
+
+ if (hwc->hwc_mode != E_HWC_MODE_FULL)
+ {
+ if (!_e_hwc_windows_target_buffer_prepared(hwc))
+ return EINA_TRUE;
+ }
if (output->dpms == E_OUTPUT_DPMS_OFF)
{
if (!_e_hwc_windows_commit_data_acquire(hwc))
return EINA_TRUE;
- if (hwc->pp_unset)
- hwc->pp_unset = EINA_FALSE;
+ EHWSTRACE("!!!!!!!! HWC Commit !!!!!!!!", NULL, hwc);
+ _e_hwc_windows_update_fps(hwc);
- if (hwc->pp_set)
+ _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
+
+ error = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_commit_handler, hwc);
+ if (error != TDM_ERROR_NONE)
{
- e_output_zoom_rotating_check(output);
- _e_hwc_windows_update_fps(hwc);
- if (!_e_hwc_windows_pp_commit(hwc))
- {
- EHWSERR("_e_hwc_windows_pp_commit failed.", hwc);
- goto fail;
- }
+ EHWSERR("tdm_hwc_commit failed.", hwc);
+ _e_hwc_windows_commit_handler(hwc->thwc, 0, 0, 0, hwc);
+ goto fail;
}
- else
- {
- EHWSTRACE("!!!!!!!! HWC Commit !!!!!!!!", NULL, hwc);
- _e_hwc_windows_update_fps(hwc);
-
- _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
-
- error = tdm_hwc_commit(hwc->thwc, 0, _e_hwc_windows_commit_handler, hwc);
- if (error != TDM_ERROR_NONE)
- {
- EHWSERR("tdm_hwc_commit failed.", hwc);
- /* send tizen_hwc_commit feedback discarded */
- e_comp_wl_tizen_hwc_discarded();
- _e_hwc_windows_commit_handler(hwc->thwc, 0, 0, 0, hwc);
- goto fail;
- }
- if (e_hwc_windows_fence_enabled_get(hwc))
+ if (e_hwc_windows_fence_enabled_get(hwc))
+ {
+ error = tdm_hwc_get_commit_fence(hwc->thwc, &commit_fence_fd);
+ if (error == TDM_ERROR_NONE)
{
- error = tdm_hwc_get_commit_fence(hwc->thwc, &commit_fence_fd);
- if (error == TDM_ERROR_NONE)
- {
- if (hwc->commit_fence_fd >= 0)
- close(hwc->commit_fence_fd);
-
- hwc->commit_fence_fd = commit_fence_fd;
+ if (hwc->commit_fence_fd >= 0)
+ close(hwc->commit_fence_fd);
- _e_hwc_windows_release_fence_fd_update(hwc);
- }
- else
- EHWSERR("tdm_hwc_get_commit_sync_fence_fd failed.", hwc);
+ hwc->commit_fence_fd = commit_fence_fd;
+ _e_hwc_windows_release_fence_fd_update(hwc);
}
-
- /* send tizen_hwc_commit feedback committed */
- e_comp_wl_tizen_hwc_committed();
+ else
+ EHWSERR("tdm_hwc_get_commit_sync_fence_fd failed.", hwc);
}
+ /* send tizen_hwc_commit feedback committed */
+ e_comp_wl_tizen_hwc_committed();
+
return EINA_TRUE;
fail:
+ /* send tizen_hwc_commit feedback discarded */
+ e_comp_wl_tizen_hwc_discarded();
_e_hwc_windows_wait_commit_set(hwc, EINA_FALSE);
return EINA_FALSE;
E_Comp_Screen *e_comp_screen = NULL;
tdm_error ret = TDM_ERROR_NONE;
int w, h;
+ Eina_Rectangle dst_rect;
EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
- if ((hwc->pp_rect.x == rect->x) && (hwc->pp_rect.y == rect->y) &&
- (hwc->pp_rect.w == rect->w) && (hwc->pp_rect.h == rect->h))
+ if ((hwc->pp_src_rect.x == rect->x) && (hwc->pp_src_rect.y == rect->y) &&
+ (hwc->pp_src_rect.w == rect->w) && (hwc->pp_src_rect.h == rect->h))
return EINA_TRUE;
e_comp_screen = e_comp->e_comp_screen;
&hwc->pp_maxw, &hwc->pp_maxh,
&hwc->pp_align);
tdm_display_get_pp_preferred_align_vertical(e_comp_screen->tdisplay, &hwc->pp_align_vertical);
+
+ EHWSINF("PP Create tdm_pp:%p", NULL, hwc, hwc->tpp);
}
if (!hwc->pp_tqueue)
EHWSERR("fail tbm_surface_queue_create", hwc);
goto fail;
}
+
+ hwc->pp_queue = e_hwc_window_queue_get(hwc->pp_tqueue);
+ if (!hwc->pp_queue)
+ {
+ EHWSERR("fail e_hwc_window_queue_get", hwc);
+ goto fail;
+ }
+
+ EHWSINF("PP Create pp_tqueue:%p", NULL, hwc, hwc->pp_tqueue);
}
+ _e_hwc_windows_target_window_pp_queue_set(hwc->target_hwc_window, hwc->pp_queue);
+ _e_hwc_windows_target_window_force_render(hwc->target_hwc_window);
hwc->pp_set = EINA_TRUE;
- hwc->pp_set_info = EINA_TRUE;
- hwc->pp_unset = EINA_FALSE;
- hwc->pp_hwc_window = NULL;
- hwc->target_hwc_window->skip_surface_set = EINA_TRUE;
}
- hwc->pp_rect.x = rect->x;
- hwc->pp_rect.y = rect->y;
- hwc->pp_rect.w = rect->w;
- hwc->pp_rect.h = rect->h;
+ dst_rect.x = 0;
+ dst_rect.y = 0;
+ dst_rect.w = w;
+ dst_rect.h = h;
- /* to wake up main loop */
- uint64_t value = 1;
- if (write(hwc->target_hwc_window->event_fd, &value, sizeof(value)) < 0)
- EHWSERR("failed to wake up main loop:%m", hwc);
+ _e_hwc_windows_pp_rect_set(hwc, rect, &dst_rect);
return EINA_TRUE;
hwc->tpp = NULL;
}
+ if (hwc->pp_tqueue)
+ {
+ tbm_surface_queue_destroy(hwc->pp_tqueue);
+ hwc->pp_tqueue = NULL;
+ }
+
return EINA_FALSE;
}
{
EINA_SAFETY_ON_NULL_RETURN(hwc);
- hwc->pp_rect.x = 0;
- hwc->pp_rect.y = 0;
- hwc->pp_rect.w = 0;
- hwc->pp_rect.h = 0;
+ CLEAR(hwc->pp_src_rect);
+ CLEAR(hwc->pp_dst_rect);
+ CLEAR(hwc->pp_set_src_rect);
+ CLEAR(hwc->pp_set_dst_rect);
if (e_comp_screen_pp_support())
{
- hwc->target_hwc_window->skip_surface_set = EINA_FALSE;
- hwc->pp_set_info = EINA_FALSE;
hwc->pp_set = EINA_FALSE;
hwc->pp_hwc_window = NULL;
- hwc->pp_unset = EINA_TRUE;
-
- if (hwc->pp_tsurface)
- tbm_surface_queue_release(hwc->pp_tqueue, hwc->pp_tsurface);
if (hwc->pp_tqueue)
{
+ EHWSINF("PP Destroy pp_tqueue:%p", NULL, hwc, hwc->pp_tqueue);
+
+ hwc->pp_queue = NULL;
tbm_surface_queue_destroy(hwc->pp_tqueue);
hwc->pp_tqueue = NULL;
}
{
if (hwc->tpp)
{
+ EHWSINF("PP Destroy tdm_pp:%p", NULL, hwc, hwc->tpp);
tdm_pp_destroy(hwc->tpp);
hwc->tpp = NULL;
}
- }
- if (hwc->pp_output_commit_data)
- _e_hwc_windows_wait_commit_set(hwc, EINA_TRUE);
+ e_hwc_window_buffer_set(&hwc->pp_buffer, NULL, NULL);
+ }
- hwc->pp_src_rect_prev.x = 0;
- hwc->pp_src_rect_prev.y = 0;
- hwc->pp_src_rect_prev.w = 0;
- hwc->pp_src_rect_prev.h = 0;
+ _e_hwc_windows_target_window_pp_queue_set(hwc->target_hwc_window, NULL);
+ _e_hwc_windows_target_window_force_render(hwc->target_hwc_window);
}
-
- /* to wake up main loop */
- uint64_t value = 1;
- if (write(hwc->target_hwc_window->event_fd, &value, sizeof(value)) < 0)
- EHWSERR("failed to wake up main loop:%m", hwc);
}
// add hwc_window to the render_list