'follow_topmost_visibility' is related to 'E_Client', not HWC mode.
Change-Id: I8377e0a6680d70e163598a4ae23c0f55f8e707cc
E_Client *ec;
Eina_List *event_handlers;
+ E_Comp_Wl_Hook *subsurf_create_hook_handler;
Eina_Bool hw_composition;
Eina_Bool follow_topmost_visibility;
_e_client_video_comp_iface_deinit(ecv);
E_FREE_LIST(ecv->event_handlers, ecore_event_handler_del);
+ E_FREE_FUNC(ecv->subsurf_create_hook_handler, e_comp_wl_hook_del);
}
static void
return ECORE_CALLBACK_PASS_ON;
}
+static void
+_e_client_video_ec_visibility_event_free(void *d EINA_UNUSED, E_Event_Client *ev)
+{
+ e_object_unref(E_OBJECT(ev->ec));
+ free(ev);
+}
+
+static void
+_e_client_video_ec_visibility_event_send(E_Client *ec)
+{
+ E_Event_Client *ev;
+ int obscured;
+
+ obscured = ec->visibility.obscured;
+ VIN("Signal visibility change event of video, type %d",
+ ec, obscured);
+
+ ev = E_NEW(E_Event_Client , 1);
+ EINA_SAFETY_ON_NULL_RETURN(ev);
+
+ ev->ec = ec;
+ e_object_ref(E_OBJECT(ec));
+ ecore_event_add(E_EVENT_CLIENT_VISIBILITY_CHANGE, ev,
+ (Ecore_End_Cb)_e_client_video_ec_visibility_event_free, NULL);
+}
+
+static void
+_e_client_video_ec_visibility_set(E_Client *ec, E_Visibility vis)
+{
+ if (ec->visibility.obscured == vis)
+ return;
+
+ ec->visibility.obscured = vis;
+ _e_client_video_ec_visibility_event_send(ec);
+}
+
+static Eina_Bool
+_e_client_video_cb_ec_visibility_change(void *data, int type EINA_UNUSED, void *event)
+{
+ E_Client_Video *ecv;
+ E_Event_Client *ev;
+ E_Client *topmost;
+
+ ecv = data;
+ if (!ecv->follow_topmost_visibility)
+ goto end;
+
+ topmost = e_comp_wl_topmost_parent_get(ecv->ec);
+ if ((!topmost) || (topmost == ecv->ec))
+ goto end;
+
+ ev = event;
+ if (ev->ec != topmost)
+ goto end;
+
+ _e_client_video_ec_visibility_set(ecv->ec, topmost->visibility.obscured);
+
+end:
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static E_Client *
+_e_client_video_ec_offscreen_parent_get(E_Client *ec)
+{
+ E_Client *parent = NULL;
+
+ if (!ec->comp_data || !ec->comp_data->sub.data)
+ return NULL;
+
+ parent = ec->comp_data->sub.data->parent;
+ while (parent)
+ {
+ if (!parent->comp_data || !parent->comp_data->sub.data)
+ return NULL;
+
+ if (parent->comp_data->sub.data->remote_surface.offscreen_parent)
+ return parent->comp_data->sub.data->remote_surface.offscreen_parent;
+
+ parent = parent->comp_data->sub.data->parent;
+ }
+
+ return NULL;
+}
+
+static Eina_Bool
+_e_client_video_cb_remote_surface_provider_visibility_change(void *data, int type EINA_UNUSED, void *event)
+{
+ E_Client_Video *ecv;
+ E_Event_Remote_Surface_Provider *ev;
+ E_Client *offscreen_parent;
+
+ ecv = data;
+ offscreen_parent = _e_client_video_ec_offscreen_parent_get(ecv->ec);
+ if (!offscreen_parent)
+ goto end;
+
+ ev = event;
+ if (ev->ec != offscreen_parent)
+ goto end;
+
+ switch (ev->ec->visibility.obscured)
+ {
+ case E_VISIBILITY_FULLY_OBSCURED:
+ evas_object_hide(ecv->ec->frame);
+ break;
+ case E_VISIBILITY_UNOBSCURED:
+ evas_object_show(ecv->ec->frame);
+ default:
+ VER("Not implemented", ecv->ec);
+ break;
+ }
+
+end:
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_e_client_video_cb_hook_subsurface_create(void *data, E_Client *ec)
+{
+ E_Client_Video *ecv;
+ E_Client *topmost1, *topmost2;
+
+ ecv = data;
+ if (!ecv->follow_topmost_visibility)
+ return;
+
+ /* This is to raise an 'VISIBILITY_CHANGE' event to video client when its
+ * topmost ancestor is changed. The reason why it uses hook handler of
+ * creation of subsurface is that there is no event for like parent change,
+ * and being created subsurface that has common topmost parent means
+ * it implies topmost parent has been possibly changed. */
+ topmost1 = e_comp_wl_topmost_parent_get(ec);
+ topmost2 = e_comp_wl_topmost_parent_get(ecv->ec);
+ if (topmost1 && topmost2)
+ {
+ if (topmost1 == topmost2)
+ _e_client_video_ec_visibility_set(ecv->ec, topmost1->visibility.obscured);
+ }
+}
+
static Eina_Bool
_e_client_video_init(E_Client_Video *ecv, E_Client *ec)
{
_e_client_video_cb_ec_zone_set, ecv);
E_LIST_HANDLER_APPEND(ecv->event_handlers, E_EVENT_CLIENT_REMOVE,
_e_client_video_cb_ec_remove, ecv);
+ E_LIST_HANDLER_APPEND(ecv->event_handlers, E_EVENT_CLIENT_VISIBILITY_CHANGE,
+ _e_client_video_cb_ec_visibility_change, ecv);
+ E_LIST_HANDLER_APPEND(ecv->event_handlers, E_EVENT_REMOTE_SURFACE_PROVIDER_VISIBILITY_CHANGE,
+ _e_client_video_cb_remote_surface_provider_visibility_change, ecv);
+
+ ecv->subsurf_create_hook_handler =
+ e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
+ _e_client_video_cb_hook_subsurface_create, ecv);
return EINA_TRUE;
}
ecv->hw_composition = EINA_FALSE;
}
-EINTERN Eina_Bool
-e_client_video_topmost_visibility_follow_get(E_Client_Video *ecv)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(ecv, EINA_FALSE);
- return ecv->follow_topmost_visibility;
-}
-
EINTERN Eina_Bool
e_client_video_property_allow_get(E_Client_Video *ecv)
{
EINTERN E_Client *e_client_video_ec_get(E_Client_Video *ecv);
EINTERN void e_client_video_hw_composition_set(E_Client_Video *ecv);
EINTERN void e_client_video_hw_composition_unset(E_Client_Video *ecv);
-EINTERN Eina_Bool e_client_video_topmost_visibility_follow_get(E_Client_Video *ecv);
EINTERN Eina_Bool e_client_video_property_allow_get(E_Client_Video *ecv);
#endif
return ECORE_CALLBACK_PASS_ON;
}
+static void
+_e_video_hwc_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ E_Video_Hwc *evh;
+ E_Client *ec;
+
+ evh = data;
+ ec = evh->ec;
+ if (e_object_is_del(E_OBJECT(ec)))
+ return;
+
+ if (evh->need_force_render)
+ {
+ VIN("video forcely rendering..", evh->ec);
+ _e_video_hwc_render(evh, __FUNCTION__);
+ }
+
+ /* if stand_alone is true, not show */
+ if (ec->comp_data->sub.data && ec->comp_data->sub.data->stand_alone)
+ return;
+
+ /* FIXME It seems unnecessary. */
+ if (evh->hwc_policy == E_HWC_POLICY_PLANES)
+ {
+ if (!e_video_hwc_planes_properties_commit(evh))
+ return;
+ }
+
+ if (evh->current_fb)
+ _e_video_hwc_buffer_show(evh, evh->current_fb, evh->current_fb->content_t);
+
+}
+
+static void
+_e_video_hwc_client_event_init(E_Video_Hwc *evh)
+{
+ evas_object_event_callback_add(evh->ec->frame, EVAS_CALLBACK_SHOW,
+ _e_video_hwc_cb_evas_show, evh);
+ E_LIST_HANDLER_APPEND(evh->ec_event_handler, E_EVENT_CLIENT_SHOW,
+ _e_video_hwc_cb_client_show, evh);
+ E_LIST_HANDLER_APPEND(evh->ec_event_handler, E_EVENT_CLIENT_BUFFER_CHANGE,
+ _e_video_hwc_cb_client_buffer_change, evh);
+}
+
+static void
+_e_video_hwc_client_event_deinit(E_Video_Hwc *evh)
+{
+ evas_object_event_callback_del_full(evh->ec->frame, EVAS_CALLBACK_SHOW,
+ _e_video_hwc_cb_evas_show, evh);
+
+ E_FREE_LIST(evh->ec_event_handler, ecore_event_handler_del);
+}
+
static void
_e_video_hwc_iface_destroy(E_Video_Comp_Iface *iface)
{
if (e_comp_object_mask_has(evh->ec->frame))
e_comp_object_mask_set(evh->ec->frame, EINA_FALSE);
+ _e_video_hwc_client_event_deinit(evh);
+
E_FREE_FUNC(evh->render.job, ecore_job_del);
evh->backend.destroy(evh);
return evh;
}
-static void
-_e_video_hwc_show(E_Video_Hwc *evh)
-{
- E_Client *ec;
-
- ec = evh->ec;
- if (e_object_is_del(E_OBJECT(ec)))
- return;
-
- if (evh->need_force_render)
- {
- VIN("video forcely rendering..", evh->ec);
- _e_video_hwc_render(evh, __FUNCTION__);
- }
-
- /* if stand_alone is true, not show */
- if ((ec->comp_data->sub.data && ec->comp_data->sub.data->stand_alone) ||
- (ec->comp_data->sub.data && e_client_video_topmost_visibility_follow_get(evh->ecv)))
- return;
-
- /* FIXME It seems unnecessary. */
- if (evh->hwc_policy == E_HWC_POLICY_PLANES)
- {
- if (!e_video_hwc_planes_properties_commit(evh))
- return;
- }
-
- if (evh->current_fb)
- _e_video_hwc_buffer_show(evh, evh->current_fb, evh->current_fb->content_t);
-}
-
-static void
-_e_video_hwc_cb_evas_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- E_Video_Hwc *evh;
-
- evh = data;
- _e_video_hwc_show(evh);
-}
-
-static void
-_e_video_hwc_client_event_init(E_Video_Hwc *evh)
-{
- evas_object_event_callback_add(evh->ec->frame, EVAS_CALLBACK_SHOW,
- _e_video_hwc_cb_evas_show, evh);
- E_LIST_HANDLER_APPEND(evh->ec_event_handler, E_EVENT_CLIENT_SHOW,
- _e_video_hwc_cb_client_show, evh);
- E_LIST_HANDLER_APPEND(evh->ec_event_handler, E_EVENT_CLIENT_BUFFER_CHANGE,
- _e_video_hwc_cb_client_buffer_change, evh);
-}
-
EINTERN E_Video_Comp_Iface *
e_video_hwc_iface_create(E_Client_Video *ecv)
{
evh = _e_video_hwc_create(ec);
if (!evh)
- return NULL;
+ return NULL;
_e_video_hwc_client_event_init(evh);
return _e_video_hwc_current_fb_update(evh);
}
-EINTERN void
-e_video_hwc_show(E_Video_Hwc *evh)
-{
- _e_video_hwc_show(evh);
-}
-
EINTERN void
e_video_hwc_wait_buffer_commit(E_Video_Hwc *evh)
{
};
/* Functions for HWC */
-EINTERN void e_video_hwc_show(E_Video_Hwc *evh);
EINTERN void e_video_hwc_wait_buffer_commit(E_Video_Hwc *evh);
EINTERN void e_video_hwc_client_mask_update(E_Video_Hwc *evh);
EINTERN Eina_Bool e_video_hwc_current_fb_update(E_Video_Hwc *evh);
free(evhp);
}
-static Eina_Bool
-_e_video_hwc_planes_cb_client_visibility_change(void *data, int type, void *event)
-{
- E_Event_Remote_Surface_Provider *ev;
- E_Client *ec, *offscreen_parent;
- E_Video_Hwc_Planes *evhp;
-
- evhp = data;
- offscreen_parent = e_video_hwc_client_offscreen_parent_get(evhp->base.ec);
- if (!offscreen_parent)
- goto end;
-
- ev = event;
- ec = ev->ec;
- if (offscreen_parent != ec)
- goto end;
-
- switch (ec->visibility.obscured)
- {
- case E_VISIBILITY_FULLY_OBSCURED:
- _e_video_hwc_planes_cb_evas_hide(evhp, NULL, NULL, NULL);
- break;
- case E_VISIBILITY_UNOBSCURED:
- e_video_hwc_show((E_Video_Hwc *)evhp);
- break;
- default:
- VER("Not implemented", evhp->base.ec);
- return ECORE_CALLBACK_PASS_ON;
- }
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
-_e_video_hwc_planes_cb_topmost_client_visibility_change(void *data, int type, void *event)
-{
- E_Event_Client *ev;
- E_Client *ec, *topmost;
- E_Video_Hwc_Planes *evhp;
-
- evhp = data;
- topmost = e_comp_wl_topmost_parent_get(evhp->base.ec);
- if (!topmost)
- goto end;
-
- if (topmost == evhp->base.ec)
- goto end;
-
- ev = event;
- ec = ev->ec;
- if (topmost != ec)
- goto end;
-
- if (e_client_video_topmost_visibility_follow_get(evhp->base.ecv))
- {
- switch (ec->visibility.obscured)
- {
- case E_VISIBILITY_FULLY_OBSCURED:
- VIN("follow_topmost_visibility: fully_obscured", ec);
- _e_video_hwc_planes_cb_evas_hide(evhp, NULL, NULL, NULL);
- break;
- case E_VISIBILITY_UNOBSCURED:
- VIN("follow_topmost_visibility: UNOBSCURED", ec);
- e_video_hwc_show((E_Video_Hwc *)evhp);
- break;
- default:
- return ECORE_CALLBACK_PASS_ON;
- }
- }
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
static void
_e_video_hwc_planes_ec_event_deinit(E_Video_Hwc_Planes *evhp)
{
evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_HIDE,
_e_video_hwc_planes_cb_evas_hide, evhp);
-
- E_FREE_LIST(evhp->base.ec_event_handler, ecore_event_handler_del);
}
const char *
{
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE,
_e_video_hwc_planes_cb_evas_hide, evhp);
-
- E_LIST_HANDLER_APPEND(evhp->base.ec_event_handler, E_EVENT_REMOTE_SURFACE_PROVIDER_VISIBILITY_CHANGE,
- _e_video_hwc_planes_cb_client_visibility_change, evhp);
- E_LIST_HANDLER_APPEND(evhp->base.ec_event_handler, E_EVENT_CLIENT_VISIBILITY_CHANGE,
- _e_video_hwc_planes_cb_topmost_client_visibility_change, evhp);
}
static void
E_Hwc *hwc;
E_Hwc_Window *hwc_window;
- E_Comp_Wl_Hook *hook_subsurf_create;
struct
{
free(evhw);
}
-static Eina_Bool
-_e_video_cb_ec_visibility_change(void *data, int type, void *event)
-{
- E_Event_Remote_Surface_Provider *ev;
- E_Client *ec, *offscreen_parent;
- E_Video_Hwc_Windows *evhw;
-
- evhw = data;
- offscreen_parent = e_video_hwc_client_offscreen_parent_get(evhw->base.ec);
- if (!offscreen_parent)
- goto end;
-
- ev = event;
- ec = ev->ec;
- if (offscreen_parent != ec)
- goto end;
-
- switch (ec->visibility.obscured)
- {
- case E_VISIBILITY_FULLY_OBSCURED:
- evas_object_hide(evhw->base.ec->frame);
- break;
- case E_VISIBILITY_UNOBSCURED:
- evas_object_show(evhw->base.ec->frame);
- break;
- default:
- VER("Not implemented", evhw->base.ec);
- return ECORE_CALLBACK_PASS_ON;
- }
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_e_video_ec_visibility_event_free(void *d EINA_UNUSED, E_Event_Client *ev)
-{
- e_object_unref(E_OBJECT(ev->ec));
- free(ev);
-}
-
-static void
-_e_video_ec_visibility_event_send(E_Client *ec)
-{
- E_Event_Client *ev;
- int obscured;
-
- obscured = ec->visibility.obscured;
- VIN("Signal visibility change event of video, type %d", ec, obscured);
-
- ev = E_NEW(E_Event_Client, 1);
- if (!ev) return;
- ev->ec = ec;
- e_object_ref(E_OBJECT(ec));
- ecore_event_add(E_EVENT_CLIENT_VISIBILITY_CHANGE, ev,
- (Ecore_End_Cb)_e_video_ec_visibility_event_free, NULL);
-}
-
-static void
-_e_video_hwc_windows_ec_visibility_set(E_Client *ec, E_Visibility vis)
-{
- if (ec->visibility.obscured == vis)
- return;
-
- ec->visibility.obscured = vis;
- _e_video_ec_visibility_event_send(ec);
-}
-
-static Eina_Bool
-_e_video_cb_topmost_ec_visibility_change(void *data, int type, void *event)
-{
- E_Video_Hwc_Windows *evhw;
- E_Event_Client *ev;
- E_Client *topmost;
-
- ev = event;
- evhw = data;
- if (!e_client_video_topmost_visibility_follow_get(evhw->base.ecv))
- goto end;
-
- topmost = e_comp_wl_topmost_parent_get(evhw->base.ec);
- if (!topmost) goto end;
- if (topmost != ev->ec) goto end;
- if (topmost == evhw->base.ec) goto end;
-
- /* Update visibility of video client by changing visibility of topmost client */
- _e_video_hwc_windows_ec_visibility_set(evhw->base.ec, topmost->visibility.obscured);
-
-end:
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static void
-_e_video_hwc_windows_ec_event_deinit(E_Video_Hwc_Windows *evhw)
-{
- E_FREE_FUNC(evhw->hook_subsurf_create, e_comp_wl_hook_del);
- E_FREE_LIST(evhw->base.ec_event_handler, ecore_event_handler_del);
-}
-
const char *
_e_video_hwc_windows_prop_name_get_by_id(E_Video_Hwc_Windows *evhw, unsigned int id)
{
return NULL;
}
-static void
-_e_video_hwc_windows_cb_hook_subsurface_create(void *data, E_Client *ec)
-{
- E_Video_Hwc_Windows *evhw;
- E_Client *topmost1, *topmost2;
-
- evhw = data;
- if (!e_client_video_topmost_visibility_follow_get(evhw->base.ecv))
- return;
-
- /* This is to raise an 'VISIBILITY_CHANGE' event to video client when its
- * topmost ancestor is changed. The reason why it uses hook handler of
- * creation of subsurface is that there is no event for like parent change,
- * and being created subsurface that has common topmost parent means
- * it implies topmost parent has been possibly changed. */
- topmost1 = e_comp_wl_topmost_parent_get(ec);
- topmost2 = e_comp_wl_topmost_parent_get(evhw->base.ec);
- if (topmost1 && topmost2)
- {
- if (topmost1 == topmost2)
- _e_video_hwc_windows_ec_visibility_set(evhw->base.ec, topmost1->visibility.obscured);
- }
-}
-
-static void
-_e_video_hwc_windows_ec_event_init(E_Video_Hwc_Windows *evhw)
-{
- evhw->hook_subsurf_create =
- e_comp_wl_hook_add(E_COMP_WL_HOOK_SUBSURFACE_CREATE,
- _e_video_hwc_windows_cb_hook_subsurface_create, evhw);
-
- E_LIST_HANDLER_APPEND(evhw->base.ec_event_handler, E_EVENT_REMOTE_SURFACE_PROVIDER_VISIBILITY_CHANGE,
- _e_video_cb_ec_visibility_change, evhw);
- E_LIST_HANDLER_APPEND(evhw->base.ec_event_handler, E_EVENT_CLIENT_VISIBILITY_CHANGE,
- _e_video_cb_topmost_ec_visibility_change, evhw);
-}
-
static void
_e_video_hwc_windows_iface_destroy(E_Video_Hwc *evh)
{
E_Video_Hwc_Windows *evhw;
evhw = (E_Video_Hwc_Windows *)evh;
- _e_video_hwc_windows_ec_event_deinit(evhw);
_e_video_destroy(evhw);
}
return NULL;
}
- _e_video_hwc_windows_ec_event_init(evhw);
_e_video_hwc_windows_iface_set(&evhw->base.backend);
return (E_Video_Hwc *)evhw;