e_hwc_new(E_Output *output)
{
E_Hwc *hwc = NULL;
+ tdm_hwc_capability hwc_caps = 0;
tdm_error error;
EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
hwc = E_NEW(E_Hwc, 1);
EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, NULL);
-
hwc->output = output;
+ /*
+ * E20 has two hwc policy options.
+ * 1. One is the E_HWC_POLICY_PLANES.
+ * - E20 decides the hwc policy with the E_Planes associated with the tdm_layers.
+ * - E20 manages how to set the surface(buffer) of the ec to the E_Plane.
+ * 2. Another is the E_HWC_POLICY_WIDNOWS.
+ * - The tdm-backend decides the hwc policy with the E_Hwc_Windows associated with the tdm_hwc_window.
+ * - E20 asks to verify the composition types of the E_Hwc_Window of the ec.
+ */
if (!output->tdm_hwc)
{
hwc->hwc_policy = E_HWC_POLICY_PLANES;
+ EHINF("Use the HWC PLANES Policy.", hwc);
}
else
{
hwc->hwc_policy = E_HWC_POLICY_WINDOWS;
+ EHINF("Use the HWC WINDOWS Policy.", hwc);
hwc->thwc = tdm_output_get_hwc(output->toutput, &error);
if (!hwc->thwc)
EHERR("tdm_output_get_hwc failed", hwc);
goto fail;
}
+
+ error = tdm_hwc_get_capabilities(hwc->thwc, &hwc_caps);
+ if (error != TDM_ERROR_NONE)
+ {
+ EHERR("fail to tdm_hwc_get_capabilities", hwc);
+ return EINA_FALSE;
+ }
+
+ /* hwc video capabilities */
+ if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_STREAM)
+ hwc->tdm_hwc_video_stream = EINA_TRUE;
+ if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCALE)
+ hwc->tdm_hwc_video_scale = EINA_TRUE;
+ if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_TRANSFORM)
+ hwc->tdm_hwc_video_transform = EINA_TRUE;
+ if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCANOUT)
+ hwc->tdm_hwc_video_scanout = EINA_TRUE;
}
+ /* initialize the ecore_evas in each hwc */
if (!_e_hwc_ee_init(hwc))
{
EHERR("_e_hwc_ee_init failed", hwc);
goto fail;
}
- /*
- * E20 has two hwc policy options.
- * 1. One is the E_HWC_POLICY_PLANES.
- * - E20 decides the hwc policy with the E_Planes associated with the tdm_layers.
- * - E20 manages how to set the surface(buffer) of the ec to the E_Plane.
- * 2. Another is the E_HWC_POLICY_WIDNOWS.
- * - The tdm-backend decides the hwc policy with the E_Hwc_Windows associated with the tdm_hwc_window.
- * - E20 asks to verify the composition types of the E_Hwc_Window of the ec.
- */
- if (hwc->hwc_policy == E_HWC_POLICY_PLANES)
+ if (e_hwc_policy_get(hwc) == E_HWC_POLICY_WINDOWS)
{
- if (!e_hwc_planes_init())
+ /* create the target_window to the hwc */
+ hwc->target_hwc_window = e_hwc_windows_target_window_new(hwc);
+ if (!hwc->target_hwc_window)
{
- EHERR("e_hwc_windows_init failed", hwc);
+ EHERR("e_hwc_windows_target_window_new failed", hwc);
goto fail;
}
-
- EHINF("Use the HWC PLANES Policy.", hwc);
- }
- else
- {
- if (!e_hwc_window_queue_init())
- {
- EHERR("E_Hwc_Window_Queue init failed", hwc);
- goto fail;
- }
-
- if (!e_hwc_window_init())
- {
- EHERR("E_Hwc_Window init failed", hwc);
- goto fail;
- }
-
- if (!e_hwc_windows_init(hwc))
- {
- EHERR("e_hwc_windows_init failed", hwc);
- goto fail;
- }
-
- /* turn on sw compositor at the start */
- ecore_event_add(E_EVENT_COMPOSITOR_ENABLE, NULL, NULL, NULL);
-
- EHINF("Use the HWC WINDOWS Policy.", hwc);
}
return hwc;
{
if (!hwc) return;
- _e_hwc_ee_deinit(hwc);
-
- if (hwc->hwc_policy == E_HWC_POLICY_PLANES)
- e_hwc_planes_deinit();
- else
+ if (e_hwc_policy_get(hwc) == E_HWC_POLICY_WINDOWS)
{
- e_hwc_windows_deinit(hwc);
- e_hwc_window_deinit();
- e_hwc_window_queue_deinit();
+ e_hwc_windows_target_window_del(hwc->target_hwc_window);
+ hwc->target_hwc_window = NULL;
}
+ _e_hwc_ee_deinit(hwc);
+
E_FREE(hwc);
}
}
EINTERN Eina_Bool
-e_hwc_windows_init(E_Hwc *hwc)
+e_hwc_windows_init(void)
{
- tdm_error error;
- tdm_hwc_capability hwc_caps = 0;
- E_Hwc_Window_Target *target_hwc_window;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc->thwc, EINA_FALSE);
-
- if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES)
- return EINA_FALSE;
-
- target_hwc_window = _e_hwc_windows_target_window_new(hwc);
- EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
- target_hwc_window->hwc = hwc;
-
- error = tdm_hwc_get_capabilities(hwc->thwc, &hwc_caps);
- if (error != TDM_ERROR_NONE)
+ if (!e_hwc_window_init())
{
- EHWSERR("fail to tdm_hwc_get_capabilities", hwc);
+ ERR("E_Hwc_Window init failed");
return EINA_FALSE;
}
- /* hwc video capabilities */
- if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_STREAM)
- hwc->tdm_hwc_video_stream = EINA_TRUE;
- if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCALE)
- hwc->tdm_hwc_video_scale = EINA_TRUE;
- if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_TRANSFORM)
- hwc->tdm_hwc_video_transform = EINA_TRUE;
- if (hwc_caps & TDM_HWC_CAPABILITY_VIDEO_SCANOUT)
- hwc->tdm_hwc_video_scanout = EINA_TRUE;
-
- /* set the target_window to the hwc */
- hwc->target_hwc_window = target_hwc_window;
-
- hwc->hwc_windows = eina_list_append(hwc->hwc_windows, target_hwc_window);
+ if (!e_hwc_window_queue_init())
+ {
+ ERR("E_Hwc_Window_Queue init failed");
+ e_hwc_window_deinit();
+ return EINA_FALSE;
+ }
return EINA_TRUE;
}
EINTERN void
-e_hwc_windows_deinit(E_Hwc *hwc)
+e_hwc_windows_deinit(void)
{
- EINA_SAFETY_ON_NULL_RETURN(hwc);
-
- if (e_hwc_policy_get(hwc) == E_HWC_POLICY_PLANES)
- return;
-
- hwc->hwc_windows = eina_list_remove(hwc->hwc_windows, hwc->target_hwc_window);
- e_object_del(E_OBJECT(hwc->target_hwc_window));
- hwc->target_hwc_window = NULL;
+ e_hwc_window_queue_deinit();
+ e_hwc_window_deinit();
}
EINTERN Eina_Bool