{
E_Video_Hwc *evh;
E_Hwc_Policy hwc_policy;
+ E_Output *output;
+ output = e_output_find(ec->zone->output_id);
hwc_policy = e_zone_video_hwc_policy_get(ec->zone);
if (hwc_policy == E_HWC_POLICY_PLANES)
- evh = e_video_hwc_planes_create();
+ evh = e_video_hwc_planes_create(output, ec);
else if (hwc_policy == E_HWC_POLICY_WINDOWS)
- evh = e_video_hwc_windows_create();
+ evh = e_video_hwc_windows_create(output, ec);
else
{
VER("Unknown HWC mode %d", ec, hwc_policy);
}
evh->hwc_policy = hwc_policy;
+ evh->e_output = output;
evh->ec = ec;
- evh->pp_align = -1;
evh->window = e_client_util_win_get(ec);
- evh->e_output = e_output_find(ec->zone->output_id);
- evh->output = evh->e_output->toutput;
+ evh->pp_align = -1;
//TODO: shoud this function be called here?
e_zone_video_available_size_get(ec->zone, NULL, NULL,
e_video_hwc_iface_create(E_Client *ec)
{
E_Video_Hwc *evh;
- Eina_Bool res = EINA_FALSE;
VIN("Create HWC interface", ec);
_e_video_hwc_client_event_init(evh);
- if (evh->hwc_policy == E_HWC_POLICY_PLANES)
- res = e_video_hwc_planes_init(evh);
- else
- res = e_video_hwc_windows_init(evh);
-
- if (!res)
- {
- VER("Failed to init HWC backend", ec);
- free(evh);
- return NULL;
- }
-
evh->iface.destroy = _e_video_hwc_iface_destroy;
evh->iface.follow_topmost_visibility = _e_video_hwc_iface_follow_topmost_visibility;
evh->iface.unfollow_topmost_visibility = _e_video_hwc_iface_unfollow_topmost_visibility;
struct
{
+ tdm_output *output;
tdm_layer *layer;
/* attributes */
Eina_List *prop_list;
static Eina_Bool
_e_video_hwc_planes_tdm_layer_set(E_Video_Hwc_Planes *evhp)
{
+ E_Plane *plane = NULL;
Eina_Bool need_wait;
+ tdm_layer *layer;
tdm_error ret;
int zpos;
if (evhp->tdm.layer)
return EINA_TRUE;
- evhp->tdm.layer = _e_video_hwc_planes_available_video_tdm_layer_get(evhp->base.output);
- if (!evhp->tdm.layer)
+ layer = _e_video_hwc_planes_available_video_tdm_layer_get(evhp->tdm.output);
+ if (!layer)
{
- VWR("no available layer for evhp", evhp->base.ec);
+ VWR("no available layer for evhp", NULL);
return EINA_FALSE;
}
- _e_video_hwc_planes_tdm_layer_usable_set(evhp->tdm.layer, EINA_FALSE);
+ _e_video_hwc_planes_tdm_layer_usable_set(layer, EINA_FALSE);
- ret = tdm_layer_get_zpos(evhp->tdm.layer, &zpos);
+ ret = tdm_layer_get_zpos(layer, &zpos);
if (ret == TDM_ERROR_NONE)
- evhp->e_plane = e_output_plane_get_by_zpos(evhp->base.e_output, zpos);
+ plane = e_output_plane_get_by_zpos(evhp->base.e_output, zpos);
- if (!evhp->e_plane)
+ if (!plane)
{
- VWR("fail get e_plane", evhp->base.ec);
- goto err_get_eplane;
+ VWR("fail get e_plane", NULL);
+ goto err_plane;
}
- if (!e_plane_video_set(evhp->e_plane, EINA_TRUE, &need_wait))
+ if (!e_plane_video_set(plane, EINA_TRUE, &need_wait))
{
- VWR("fail set video to e_plane", evhp->base.ec);
- goto err_set_eplane_video;
+ VWR("fail set video to e_plane", NULL);
+ goto err_plane;
}
if (need_wait)
_e_video_hwc_planes_cb_eplane_video_set_hook, evhp);
}
- VIN("assign layer: %p", evhp->base.ec, evhp->tdm.layer);
+ evhp->tdm.layer = layer;
+ evhp->e_plane = plane;
+
+ VIN("assign layer: %p", NULL, evhp->tdm.layer);
return EINA_TRUE;
-err_set_eplane_video:
- evhp->e_plane = NULL;
-err_get_eplane:
+err_plane:
_e_video_hwc_planes_tdm_layer_usable_set(evhp->tdm.layer, EINA_TRUE);
- evhp->tdm.layer = NULL;
return EINA_FALSE;
}
ret = _tdm_layer_commit(evhp->tdm.layer, _e_video_hwc_planes_cb_commit_handler, evhp);
EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == TDM_ERROR_NONE, EINA_FALSE);
- ret = tdm_output_wait_vblank(evhp->base.output, 1, 0, _e_video_hwc_planes_cb_vblank_handler, evhp);
+ ret = tdm_output_wait_vblank(evhp->tdm.output, 1, 0, _e_video_hwc_planes_cb_vblank_handler, evhp);
EINA_SAFETY_ON_FALSE_RETURN_VAL(ret == TDM_ERROR_NONE, EINA_FALSE);
evhp->waiting_vblank = EINA_TRUE;
{
/* tlayer = e_output_video_available_tdm_layer_get(evhp->e_output); */
- tlayer = _e_video_hwc_planes_available_video_tdm_layer_get(evhp->base.output);
+ tlayer = _e_video_hwc_planes_available_video_tdm_layer_get(evhp->tdm.output);
}
ret = tdm_layer_get_available_properties(tlayer, props, count);
}
static Eina_Bool
-_e_video_hwc_planes_set(E_Video_Hwc_Planes *evhp)
+_e_video_hwc_planes_init(E_Video_Hwc_Planes *evhp, E_Output *output)
{
const tdm_prop *props;
int i, count = 0;
- /* if (e_output_video_capability_get(evhp->e_output)) */
- if (_tdm_output_video_layer_exists(evhp->base.output))
- {
- /* If tdm offers video layers, we will assign a tdm layer when showing */
- ;;;
- }
- else if (_e_video_hwc_planes_tdm_layer_set(evhp))
+ /* If tdm offers video layers, we will assign a tdm layer when showing */
+ if (!_tdm_output_video_layer_exists(output->toutput))
{
- /* If tdm doesn't offer video layers, we assign a tdm layer now. If failed,
- * video will be displayed via the UI rendering path.
- */
- ;;;
+ /* If tdm doesn't offer video layers, we assign a tdm layer now. If
+ * failed, video will be displayed via the UI rendering path. */
+ if (!_e_video_hwc_planes_tdm_layer_set(evhp))
+ return EINA_FALSE;
}
- else
- return EINA_FALSE;
+
+ evhp->tdm.mute_id = -1;
_e_video_hwc_planes_available_properties_get(evhp, &props, &count);
for (i = 0; i < count; i++)
return EINA_TRUE;
}
-static Eina_Bool
-_e_video_hwc_planes_init(E_Video_Hwc_Planes *evhp)
-{
- evhp->tdm.mute_id = -1;
-
- if (!_e_video_hwc_planes_set(evhp))
- {
- VER("Failed to init hwc_planes", evhp->base.ec);
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
static void
_e_video_hwc_planes_destroy(E_Video_Hwc_Planes *evhp)
{
const tdm_prop *props;
int i, count = 0;
- layer = _tdm_output_video_layer_get(evhp->base.output);
+ layer = _tdm_output_video_layer_get(evhp->tdm.output);
tdm_layer_get_available_properties(layer, &props, &count);
for (i = 0; i < count; i++)
{
}
EINTERN E_Video_Hwc *
-e_video_hwc_planes_create(void)
+e_video_hwc_planes_create(E_Output *output, E_Client *ec)
{
E_Video_Hwc_Planes *evhp;
- evhp = calloc(1, sizeof *evhp);
- EINA_SAFETY_ON_NULL_RETURN_VAL(evhp, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
- return (E_Video_Hwc *)evhp;
-}
+ VIN("Create HWC Planes backend", ec);
-EINTERN Eina_Bool
-e_video_hwc_planes_init(E_Video_Hwc *evh)
-{
- E_Video_Hwc_Planes *evhp;
+ evhp = E_NEW(E_Video_Hwc_Planes, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(evhp, NULL);
- INF("Initializing HWC Planes mode");
+ evhp->base.e_output = output;
+ evhp->tdm.output = output->toutput;
- evhp = (E_Video_Hwc_Planes *)evh;
- if (!_e_video_hwc_planes_init(evhp))
+ if (!_e_video_hwc_planes_init(evhp, output))
{
ERR("Failed to init 'E_Video_Hwc_Planes'");
- return EINA_FALSE;
+ free(evhp);
+ return NULL;
}
_e_video_hwc_planes_ec_event_init(evhp);
evhp->base.backend.commit_data_release = NULL;
evhp->base.backend.tbm_surface_get = NULL;
- return EINA_TRUE;
+ return (E_Video_Hwc *)evhp;
}
EINTERN Eina_Bool
evhp = (E_Video_Hwc_Planes *)evh;
- tdm_layer *layer = _tdm_output_video_layer_get(evhp->base.output);
+ tdm_layer *layer = _tdm_output_video_layer_get(evhp->tdm.output);
tdm_layer_get_capabilities(layer, &capabilities);
return EINA_TRUE;
}
-static Eina_Bool
-_e_video_hwc_windows_init(E_Video_Hwc_Windows *evhw)
-{
- E_Hwc *hwc;
- E_Hwc_Window *hwc_window;
-
- hwc = evhw->base.e_output->hwc;
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
- hwc_window = e_hwc_window_new(hwc, evhw->base.ec, E_HWC_WINDOW_STATE_VIDEO);
- EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window, EINA_FALSE);
-
- evhw->hwc_window = hwc_window;
- evhw->hwc = hwc;
-
- return EINA_TRUE;
-}
-
static void
_e_video_destroy(E_Video_Hwc_Windows *evhw)
{
}
EINTERN E_Video_Hwc *
-e_video_hwc_windows_create(void)
+e_video_hwc_windows_create(E_Output *output, E_Client *ec)
{
E_Video_Hwc_Windows *evhw;
- evhw = calloc(1, sizeof *evhw);
- EINA_SAFETY_ON_NULL_RETURN_VAL(evhw, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL);
- return (E_Video_Hwc *)evhw;
-}
-
-EINTERN Eina_Bool
-e_video_hwc_windows_init(E_Video_Hwc *evh)
-{
- E_Video_Hwc_Windows *evhw;
+ VIN("Create HWC Windows backend", ec);
- INF("Initializing HWC Windows mode");
+ evhw = E_NEW(E_Video_Hwc_Windows, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(evhw, NULL);
- evhw = (E_Video_Hwc_Windows *)evh;
- EINA_SAFETY_ON_NULL_RETURN_VAL(evhw, EINA_FALSE);
+ evhw->hwc = output->hwc;
+ if (!evhw->hwc)
+ {
+ free(evhw);
+ return NULL;
+ }
- if (!_e_video_hwc_windows_init(evhw))
+ evhw->hwc_window = e_hwc_window_new(evhw->hwc, ec, E_HWC_WINDOW_STATE_VIDEO);
+ if (!evhw->hwc_window)
{
- ERR("Failed to init 'E_Video_Hwc_Windows'");
- return EINA_FALSE;
+ free(evhw);
+ return NULL;
}
_e_video_hwc_windows_ec_event_init(evhw);
evhw->base.backend.commit_data_release = _e_video_hwc_windows_iface_commit_data_release;
evhw->base.backend.tbm_surface_get = _e_video_hwc_windows_iface_tbm_surface_get;
- return EINA_TRUE;
+ return (E_Video_Hwc *)evhw;
}
EINTERN tbm_surface_h