E_Comp_Screen *e_comp_screen = output->e_comp_screen;
tbm_surface_queue_h tqueue = NULL;
tdm_error error;
- int scr_w, scr_h, queue_w, queue_h;
-
- e_output_size_get(output, &scr_w, &scr_h);
+ int queue_w, queue_h;
if ((output->tdm_hwc) && (!output->fake_config))
{
}
queue_w = tbm_surface_queue_get_width(tqueue);
- if (scr_w != queue_w)
- EHINF("!!!!!!WARNING::: the queue width(%d) is diffrent from output width(%d)!!!!!!", hwc, queue_w, scr_w);
queue_h = tbm_surface_queue_get_height(tqueue);
- if (scr_h != queue_h)
- EHINF("!!!!!!WARNING::: the queue height(%d) is diffrent from output height(%d)!!!!!!", hwc, queue_h, scr_h);
+
+ if ((w != queue_w) || (h != queue_h))
+ tbm_surface_queue_reset(tqueue, w, h, tbm_surface_queue_get_format(tqueue));
hwc->target_buffer_queue = tqueue;
+ e_comp_screen->tqueue = tqueue;
EHINF("The tqueue(%p, %dx%d) is created.", hwc, tqueue, queue_w, queue_h);
- // TODO: change the e_comp_screen->tqueue into hwc->target_buffer_queue
- e_comp_screen->tqueue = tqueue;
-
return (void *)tqueue;
}
return ee;
}
-static void
-_e_hwc_ee_deinit(E_Hwc *hwc)
+EINTERN void
+e_hwc_ecore_evas_deinit(void)
{
- // TODO:
- E_Output *output = hwc->output;
E_Output *primary_output = NULL;
+ E_Hwc *hwc = NULL;
primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
- if (primary_output != output)
- {
- if (hwc->ee)
- ecore_evas_free(hwc->ee);
- hwc->ee = NULL;
- }
- else
- {
- /* ecore_evas_free execute when e_comp free */
- hwc->ee = NULL;
- }
+ if (!primary_output) return;
+
+ hwc = primary_output->hwc;
+ if (!hwc) return;
+ if (!hwc->ee) return;
+
+ ecore_evas_free(hwc->ee);
+ hwc->ee =NULL;
}
-// TODO: Currently E20 has only one e_output for the primary output.
-// We need to change the ee and other logic for multiple E_Output.
-static Eina_Bool
-_e_hwc_ee_init(E_Hwc* hwc)
+EINTERN Eina_Bool
+e_hwc_ecore_evas_init(void)
{
- E_Output *output = hwc->output;
E_Output *primary_output = NULL;
Ecore_Evas *ee = NULL;
int w = 0, h = 0, scr_w = 1, scr_h = 1;
+ E_Hwc *hwc;
int screen_rotation;
char buf[1024];
- /* initialize the ecore_evas only hwc of the primary output */
- if (!hwc->primary_output)
- {
- EHINF("No Primary Output, No Ecore_Evas.", hwc);
- return EINA_TRUE;
- }
+ primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(primary_output, EINA_FALSE);
+
+ hwc = primary_output->hwc;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
EHINF("ecore evase engine init.", hwc);
// TODO: fix me. change the screen_rotation into output_rotation.
- screen_rotation = output->e_comp_screen->rotation;
+ screen_rotation = primary_output->e_comp_screen->rotation;
/* set env for use tbm_surface_queue*/
setenv("USE_EVAS_SOFTWARE_TBM_ENGINE", "1", 1);
e_comp_gl_set(EINA_TRUE);
/* get the size of the primary output */
- e_output_size_get(output, &scr_w, &scr_h);
+ e_output_size_get(primary_output, &scr_w, &scr_h);
/* if output is disconnected, set the default width, height */
if (scr_w == 0 || scr_h == 0)
scr_w = 2;
scr_h = 1;
- if (!e_output_fake_config_set(output, scr_w, scr_h))
+ if (!e_output_fake_config_set(primary_output, scr_w, scr_h))
{
+ e_hwc_ecore_evas_deinit();
e_error_message_show(_("Fail to set the fake output config!\n"));
- _e_hwc_ee_deinit(hwc);
return EINA_FALSE;
}
}
if (!ee)
{
e_error_message_show(_("Enlightenment cannot initialize outputs!\n"));
- _e_hwc_ee_deinit(hwc);
+ e_hwc_ecore_evas_deinit();
return EINA_FALSE;
}
EHINF("ee(%p) with the tqueue(%p) is created.", hwc, ee, hwc->target_buffer_queue);
- primary_output = e_comp_screen_primary_output_get(e_comp->e_comp_screen);
- if (primary_output == output)
- {
- e_comp->ee = ee;
- ecore_evas_data_set(e_comp->ee, "comp", e_comp);
+ e_comp->ee = ee;
+ ecore_evas_data_set(e_comp->ee, "comp", e_comp);
+ ecore_evas_callback_resize_set(e_comp->ee, _e_hwc_cb_ee_resize);
- ecore_evas_callback_resize_set(e_comp->ee, _e_hwc_cb_ee_resize);
-
- if (screen_rotation)
- {
- /* SHOULD called with resize option after ecore_evas_resize */
- ecore_evas_rotation_with_resize_set(e_comp->ee, screen_rotation);
- ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
+ if (screen_rotation)
+ {
+ /* SHOULD called with resize option after ecore_evas_resize */
+ ecore_evas_rotation_with_resize_set(e_comp->ee, screen_rotation);
+ ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
+ snprintf(buf, sizeof(buf), "\tEE Rotate and Resize %d, %dx%d", screen_rotation, w, h);
+ e_main_ts(buf);
+ }
- snprintf(buf, sizeof(buf), "\tEE Rotate and Resize %d, %dx%d", screen_rotation, w, h);
- e_main_ts(buf);
- }
+ if (!e_hwc_windows_ecore_evas_set(hwc, ee))
+ {
+ ERR("fail to e_hwc_windows_ecore_evas_set");
+ e_hwc_ecore_evas_deinit();
+ return EINA_FALSE;
}
return EINA_TRUE;
/* set the pirmary_output */
hwc->primary_output = primary_output;
- if (!_e_hwc_ee_init(hwc))
- {
- EHERR("_e_hwc_ee_init failed", hwc);
- goto fail;
- }
-
if (e_hwc_policy_get(hwc) == E_HWC_POLICY_WINDOWS)
{
/* create the target_window to the hwc */
EINA_LIST_FREE(hwc->visible_windows, hwc_window)
e_hwc_window_unref(hwc_window);
- _e_hwc_ee_deinit(hwc);
-
if (hwc->commit_fence_fd >= 0)
close(hwc->commit_fence_fd);
E_FREE(target_hwc_window);
}
-static E_Hwc_Window_Target *
-_e_hwc_windows_target_window_new(E_Hwc *hwc)
-{
- const char *name = NULL;
- E_Hwc_Window_Target *target_hwc_window = NULL;
- Evas *evas = NULL;
-
- name = ecore_evas_engine_name_get(hwc->ee);
- EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
-
- evas = ecore_evas_get(hwc->ee);
- EINA_SAFETY_ON_NULL_RETURN_VAL(evas, NULL);
-
- if(!strcmp("gl_drm_tbm", name) ||
- !strcmp("drm_tbm", name) ||
- !strcmp("gl_tbm", name) ||
- !strcmp("software_tbm", name) ||
- !strcmp("gl_tbm_ES", name))
- {
- ecore_evas_manual_render_set(hwc->ee, 1);
- ecore_evas_show(hwc->ee);
- }
-
- target_hwc_window = E_OBJECT_ALLOC(E_Hwc_Window_Target, E_HWC_WINDOW_TYPE, _e_hwc_windows_target_window_free);
- EINA_SAFETY_ON_NULL_GOTO(target_hwc_window, fail);
-
- ((E_Hwc_Window *)target_hwc_window)->is_target = EINA_TRUE;
- ((E_Hwc_Window *)target_hwc_window)->state = E_HWC_WINDOW_STATE_DEVICE;
- ((E_Hwc_Window *)target_hwc_window)->accepted_state = E_HWC_WINDOW_STATE_DEVICE;
- ((E_Hwc_Window *)target_hwc_window)->hwc = hwc;
-
- target_hwc_window->hwc = hwc;
- target_hwc_window->ee = hwc->ee;
- target_hwc_window->evas = ecore_evas_get(target_hwc_window->ee);
- target_hwc_window->event_fd = eventfd(0, EFD_NONBLOCK);
- target_hwc_window->event_hdlr =
- ecore_main_fd_handler_add(target_hwc_window->event_fd, ECORE_FD_READ,
- _e_hwc_windows_target_window_render_finished_cb,
- (void *)target_hwc_window, NULL, NULL);
-
- ecore_evas_manual_render(target_hwc_window->ee);
-
- if (!_e_hwc_windows_target_window_queue_set(target_hwc_window))
- {
- EHWSERR("fail to _e_hwc_windows_target_window_queue_set", hwc);
- goto fail;
- }
-
- evas_event_callback_add(evas,
- EVAS_CALLBACK_RENDER_FLUSH_POST,
- _e_hwc_windows_target_window_render_flush_post_cb,
- target_hwc_window);
-
- evas_event_callback_add(evas,
- EVAS_CALLBACK_RENDER_FLUSH_PRE,
- _e_hwc_windows_target_window_render_flush_pre_cb,
- target_hwc_window);
-
- evas_event_callback_add(evas,
- EVAS_CALLBACK_RENDER_PRE,
- _e_hwc_windows_target_window_render_pre_cb,
- target_hwc_window);
-
- return target_hwc_window;
-
-fail:
- ecore_evas_manual_render_set(hwc->ee, 0);
- if (target_hwc_window)
- e_object_del(E_OBJECT(target_hwc_window));
-
- return NULL;
-}
-
-static Eina_Bool
-_e_hwc_windows_tbm_surface_queue_init(E_Hwc *hwc)
-{
- E_Output *output = hwc->output;
- tbm_surface_queue_h tqueue = NULL;
- tdm_error error;
- int scr_w, scr_h, queue_w, queue_h;
-
- e_output_size_get(output, &scr_w, &scr_h);
-
- if ((output->tdm_hwc) && (!output->fake_config))
- {
- tqueue = tdm_hwc_get_client_target_buffer_queue(hwc->thwc, &error);
- if (error != TDM_ERROR_NONE)
- {
- EHWSERR("fail to tdm_hwc_get_client_target_buffer_queue", hwc);
- return EINA_FALSE;
- }
- }
- else
- {
- tqueue = tbm_surface_queue_create(3, scr_w, scr_h, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT);
- if (!tqueue)
- {
- EHWSERR("fail to tbm_surface_queue_create", hwc);
- return EINA_FALSE;
- }
- }
-
- queue_w = tbm_surface_queue_get_width(tqueue);
- if (scr_w != queue_w)
- EHWSINF("!!WARNING::: the queue width(%d) is diffrent from output width(%d)!", NULL, hwc,
- queue_w, scr_w);
- queue_h = tbm_surface_queue_get_height(tqueue);
- if (scr_h != queue_h)
- EHWSINF("!!WARNING::: the queue height(%d) is diffrent from output height(%d)!", NULL, hwc,
- queue_h, scr_h);
-
- hwc->target_buffer_queue = tqueue;
-
- EHWSINF("The tqueue(%p, %dx%d) is created.", NULL, hwc, tqueue, queue_w, queue_h);
-
- return EINA_TRUE;
-}
-
-static void
-_e_hwc_windows_tbm_surface_queue_deinit(E_Hwc *hwc)
-{
- if (hwc->target_buffer_queue)
- {
- tbm_surface_queue_destroy(hwc->target_buffer_queue);
- hwc->target_buffer_queue = NULL;
- }
-}
-
-static E_Hwc_Window_Target *
-_e_hwc_windows_target_window_new_with_no_ee(E_Hwc *hwc)
-{
- E_Hwc_Window_Target *target_hwc_window = NULL;
-
- target_hwc_window = E_OBJECT_ALLOC(E_Hwc_Window_Target, E_HWC_WINDOW_TYPE, _e_hwc_windows_target_window_free);
- EINA_SAFETY_ON_NULL_GOTO(target_hwc_window, fail);
-
- ((E_Hwc_Window *)target_hwc_window)->is_target = EINA_TRUE;
- ((E_Hwc_Window *)target_hwc_window)->state = E_HWC_WINDOW_STATE_DEVICE;
- ((E_Hwc_Window *)target_hwc_window)->accepted_state = E_HWC_WINDOW_STATE_DEVICE;
- ((E_Hwc_Window *)target_hwc_window)->hwc = hwc;
-
- target_hwc_window->hwc = hwc;
- target_hwc_window->ee = NULL;
- target_hwc_window->evas = NULL;
- target_hwc_window->event_fd = eventfd(0, EFD_NONBLOCK);;
- target_hwc_window->event_hdlr = ecore_main_fd_handler_add(target_hwc_window->event_fd, ECORE_FD_READ,
- _e_hwc_windows_target_window_render_finished_cb,
- (void *)target_hwc_window, NULL, NULL);;
-
- /* create the tqueue of the target_window */
- _e_hwc_windows_tbm_surface_queue_init(hwc);
-
- if (!_e_hwc_windows_target_window_queue_set(target_hwc_window))
- {
- EHWSERR("fail to _e_hwc_windows_target_window_queue_set", hwc);
- goto fail;
- }
-
- return target_hwc_window;
-
-fail:
- _e_hwc_windows_tbm_surface_queue_deinit(hwc);
-
- if (target_hwc_window)
- e_object_del(E_OBJECT(target_hwc_window));
-
- return NULL;
-}
-
static void
_e_hwc_windows_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_surface_h tsurface_dst, void *user_data)
{
return EINA_FALSE;
}
+EINTERN Eina_Bool
+e_hwc_windows_ecore_evas_set(E_Hwc *hwc, Ecore_Evas *ee)
+{
+ E_Hwc_Window_Target *target_hwc_window;
+ Evas *evas;
+ const char *name = NULL;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
+
+ if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES)
+ return EINA_FALSE;
+
+ target_hwc_window = hwc->root_target_hwc_window;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+
+ name = ecore_evas_engine_name_get(ee);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
+
+ evas = ecore_evas_get(ee);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(evas, EINA_FALSE);
+
+ if (!_e_hwc_windows_target_window_queue_set(target_hwc_window))
+ {
+ EHWSERR("fail to _e_hwc_windows_target_window_queue_set", NULL);
+ return EINA_FALSE;
+ }
+
+ if(!strcmp("gl_drm_tbm", name) ||
+ !strcmp("drm_tbm", name) ||
+ !strcmp("gl_tbm", name) ||
+ !strcmp("software_tbm", name) ||
+ !strcmp("gl_tbm_ES", name))
+ {
+ ecore_evas_manual_render_set(ee, 1);
+ ecore_evas_show(ee);
+ }
+
+ target_hwc_window->ee = ee;
+ target_hwc_window->evas = evas;
+ target_hwc_window->event_fd = eventfd(0, EFD_NONBLOCK);
+ target_hwc_window->event_hdlr =
+ ecore_main_fd_handler_add(target_hwc_window->event_fd, ECORE_FD_READ,
+ _e_hwc_windows_target_window_render_finished_cb,
+ (void *)target_hwc_window, NULL, NULL);
+
+ evas_event_callback_add(evas,
+ EVAS_CALLBACK_RENDER_FLUSH_POST,
+ _e_hwc_windows_target_window_render_flush_post_cb,
+ target_hwc_window);
+
+ evas_event_callback_add(evas,
+ EVAS_CALLBACK_RENDER_FLUSH_PRE,
+ _e_hwc_windows_target_window_render_flush_pre_cb,
+ target_hwc_window);
+
+ evas_event_callback_add(evas,
+ EVAS_CALLBACK_RENDER_PRE,
+ _e_hwc_windows_target_window_render_pre_cb,
+ target_hwc_window);
+
+ ecore_evas_manual_render(target_hwc_window->ee);
+
+ return EINA_TRUE;
+}
+
EINTERN E_Hwc_Window_Target *
e_hwc_windows_target_window_new(E_Hwc *hwc)
{
if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES)
return NULL;
- if (hwc->primary_output)
- {
- target_hwc_window = _e_hwc_windows_target_window_new(hwc);
- EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, NULL);
- }
- else
- {
- target_hwc_window = _e_hwc_windows_target_window_new_with_no_ee(hwc);
- EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, NULL);
- }
+ target_hwc_window = E_OBJECT_ALLOC(E_Hwc_Window_Target, E_HWC_WINDOW_TYPE, _e_hwc_windows_target_window_free);
+ EINA_SAFETY_ON_NULL_GOTO(target_hwc_window, fail);
+
+ ((E_Hwc_Window *)target_hwc_window)->is_target = EINA_TRUE;
+ ((E_Hwc_Window *)target_hwc_window)->state = E_HWC_WINDOW_STATE_DEVICE;
+ ((E_Hwc_Window *)target_hwc_window)->accepted_state = E_HWC_WINDOW_STATE_DEVICE;
+ ((E_Hwc_Window *)target_hwc_window)->hwc = hwc;
target_hwc_window->hwc = hwc;
+ target_hwc_window->event_fd = -1;
hwc->hwc_windows = eina_list_append(hwc->hwc_windows, target_hwc_window);
return target_hwc_window;
+
+fail:
+ if (target_hwc_window)
+ e_object_del(E_OBJECT(target_hwc_window));
+
+ return NULL;
}
EINTERN void
hwc = target_hwc_window->hwc;
EINA_SAFETY_ON_NULL_RETURN(hwc);
- if (!hwc->primary_output)
- _e_hwc_windows_tbm_surface_queue_deinit(hwc);
-
hwc->hwc_windows = eina_list_remove(hwc->hwc_windows, hwc->target_hwc_window);
e_object_del(E_OBJECT(hwc->target_hwc_window));
}