video: Added e_client_video_hw_composition_set/unset/check() functions to manage... 57/206157/8
authorSeunghun Lee <shiin.lee@samsung.com>
Mon, 29 Apr 2019 08:13:02 +0000 (17:13 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 28 May 2019 10:43:04 +0000 (10:43 +0000)
A internal implementation for video will call set/unset() functions according
to its compositing method. And then e_client_video_hw_composition_check() will be
used instead of video_client flag. This patch removed video_client flag from
E_Client structure.

Change-Id: Iea0e5a412c55b2990622c2f2aeb329311402d805

src/bin/e_comp_wl.c
src/bin/e_comp_wl.h
src/bin/e_info_server.c
src/bin/video/e_client_video.c
src/bin/video/e_client_video.h
src/bin/video/e_video_internal.h
src/bin/video/iface/e_video_external.c
src/bin/video/iface/e_video_fallback.c
src/bin/video/iface/e_video_hwc.c
src/bin/video/iface/e_video_hwc.h

index c76a17bef5f951e037b02592cfcaf5448618e04f..04f70323aec8dd196afb4f53c6d7b3c197893a09 100644 (file)
@@ -343,7 +343,7 @@ e_comp_wl_video_subsurface_has(E_Client *ec)
    if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
    if (!ec->comp_data) return EINA_FALSE;
 
-   if (ec->comp_data->video_client)
+   if (e_client_video_hw_composition_check(ec))
      return EINA_TRUE;
 
    if (ec->comp_data->has_video_client)
@@ -372,7 +372,7 @@ e_comp_wl_normal_subsurface_has(E_Client *ec)
 
    /* if a leaf client is not video cliet */
    if (ec->comp_data->sub.data && !ec->comp_data->sub.below_list &&
-       !ec->comp_data->sub.below_list_pending && !ec->comp_data->video_client)
+       !ec->comp_data->sub.below_list_pending && !e_client_video_hw_composition_check(ec))
      return EINA_TRUE;
 
    EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc)
@@ -4354,7 +4354,6 @@ _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec)
    ec->comp_data->layer = p_cdata->layer;
    ec->comp_data->fetch.win_type = p_cdata->fetch.win_type;
    ec->comp_data->fetch.layer = p_cdata->fetch.layer;
-   ec->comp_data->video_client = p_cdata->video_client;
 
    e_pixmap_cdata_set(ec->pixmap, ec->comp_data);
 
@@ -5383,7 +5382,7 @@ e_comp_wl_buffer_get(struct wl_resource *resource, E_Client *ec)
           }
         else
           {
-             if ((ec) && (ec->comp_data->video_client))
+             if ((ec) && (e_client_video_hw_composition_check(ec)))
                {
                   buffer->type = E_COMP_WL_BUFFER_TYPE_VIDEO;
                   buffer->w = buffer->h = 1;
@@ -5435,7 +5434,7 @@ e_comp_wl_buffer_get(struct wl_resource *resource, E_Client *ec)
                if (!tbm_surf)
                  goto err;
 
-               if ((ec) && (ec->comp_data->video_client))
+               if ((ec) && (e_client_video_hw_composition_check(ec)))
                  {
                     buffer->type = E_COMP_WL_BUFFER_TYPE_VIDEO;
                     buffer->w = buffer->h = 1;
index 40d77f00c8130cdf155b3cd63a1279c16115c84d..31643990e81a8e99ff08eea0f631c87b53bcf22e 100644 (file)
@@ -458,7 +458,6 @@ struct _E_Comp_Wl_Client_Data
    Eina_Bool maximize_pre : 1;
    Eina_Bool focus_update : 1;
    Eina_Bool opaque_state : 1;
-   Eina_Bool video_client : 1;
    Eina_Bool has_video_client : 1;
    Eina_Bool never_hwc : 1;          //  force window not to do hwc
    unsigned char accepts_focus : 1;
index fa2a39a2b8b5348c6aa3b0aa9c32021bcdab30a9..ef1b7e3d5b0357fc80538b4ea665d356f9cfd148 100644 (file)
@@ -1310,7 +1310,7 @@ _get_win_prop_Video_Client(const Evas_Object *evas_obj)
 
    ec = evas_object_data_get(evas_obj, "E_Client");
 
-   if (asprintf(&str, "%d", ec->comp_data ? ec->comp_data->video_client : 0) < 0)
+   if (asprintf(&str, "%d", ec->comp_data ? e_client_video_hw_composition_check((E_Client *)ec) : 0) < 0)
      return NULL;
 
    return str;
@@ -2944,7 +2944,7 @@ _e_info_server_cb_subsurface(const Eldbus_Service_Interface *iface EINA_UNUSED,
              if (ec->comp_data->sub.below_obj)
                bgrect = (Ecore_Window)ec->comp_data->sub.below_obj;
              maskobj = e_comp_object_mask_has(ec->frame);
-             video = (ec->comp_data->video_client) ? 1 : 0;
+             video = (e_client_video_hw_composition_check(ec)) ? 1 : 0;
              if (ec->comp_data->sub.data)
                stand = ec->comp_data->sub.data->stand_alone;
              name = e_client_util_name_get(ec);
index 11f72493cb31cf7b48d47d2ac24719daf4657a4c..eac40f4f904aae36b7d38206e7b27f328a157eab 100644 (file)
@@ -17,8 +17,6 @@
    if (!ecv->iface->iname)                            \
       return ret
 
-typedef struct _E_Client_Video E_Client_Video;
-
 struct _E_Client_Video
 {
    /* Composite interface ( hwc planes / hwc windows / fallback ) */
@@ -34,6 +32,8 @@ struct _E_Client_Video
       E_Client_Video_Commit_Data_Release_Cb commit_data_release;
       E_Client_Video_Tbm_Surface_Get_Cb tbm_surface_get;
    } cb;
+
+   Eina_Bool hw_composition;
 };
 
 static void
@@ -52,7 +52,7 @@ _e_client_video_comp_iface_init(E_Client_Video *ecv, E_Client *ec)
    if ((e_config->eom_enable == EINA_TRUE) && (e_eom_is_ec_external(ec)))
      {
         INF("Try to intialize external interface");
-        iface = e_video_external_iface_create(ec);
+        iface = e_video_external_iface_create(ecv);
         goto end;
      }
 
@@ -66,13 +66,13 @@ _e_client_video_comp_iface_init(E_Client_Video *ecv, E_Client *ec)
    if (hwc_pol != E_HWC_POLICY_NONE)
      {
         INF("Initialize the interface of the client_video for HWC mode");
-        iface = e_video_hwc_iface_create(ec);
+        iface = e_video_hwc_iface_create(ecv);
      }
 
 end:
    if (!iface)
      {
-        iface = e_video_fallback_iface_create(ec);
+        iface = e_video_fallback_iface_create(ecv);
         if (!iface)
           {
              ERR("Failed to create 'E_Video_Comp_Iface'");
@@ -146,6 +146,8 @@ _e_client_video_init(E_Client_Video *ecv, E_Client *ec)
 {
    Eina_Bool res;
 
+   ecv->ec = ec;
+
    res = _e_client_video_comp_iface_init(ecv, ec);
    if (!res)
      {
@@ -153,8 +155,6 @@ _e_client_video_init(E_Client_Video *ecv, E_Client *ec)
         return EINA_FALSE;
      }
 
-   ecv->ec = ec;
-
    E_LIST_HANDLER_APPEND(ecv->event_handlers, E_EVENT_CLIENT_ZONE_SET,
                          _e_client_video_cb_ec_zone_set, ecv);
    E_LIST_HANDLER_APPEND(ecv->event_handlers, E_EVENT_CLIENT_REMOVE,
@@ -360,3 +360,36 @@ e_client_video_tbm_surface_get_func_set(E_Client *ec, E_Client_Video_Tbm_Surface
 
    ecv->cb.tbm_surface_get = func;
 }
+
+EINTERN Eina_Bool
+e_client_video_hw_composition_check(E_Client *ec)
+{
+   INTERNAL_DATA_GET;
+
+   if (!ecv)
+     return EINA_FALSE;
+
+   return ecv->hw_composition;
+}
+
+/* Video Internal Functions */
+EINTERN E_Client *
+e_client_video_ec_get(E_Client_Video *ecv)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ecv, NULL);
+   return ecv->ec;
+}
+
+EINTERN void
+e_client_video_hw_composition_set(E_Client_Video *ecv)
+{
+   EINA_SAFETY_ON_NULL_RETURN(ecv);
+   ecv->hw_composition = EINA_TRUE;
+}
+
+EINTERN void
+e_client_video_hw_composition_unset(E_Client_Video *ecv)
+{
+   EINA_SAFETY_ON_NULL_RETURN(ecv);
+   ecv->hw_composition = EINA_FALSE;
+}
index b59dd37180ebeb82699685241bbb5a1ea42d3c24..f3d2d9e8ad1d9b9978f53ec6f351d14f93091f0c 100644 (file)
@@ -21,6 +21,7 @@ typedef tbm_surface_h   (*E_Client_Video_Tbm_Surface_Get_Cb)(E_Client *ec);
 
 E_API   Eina_Bool    e_client_video_set(E_Client *ec);
 E_API   void         e_client_video_unset(E_Client *ec);
+EINTERN Eina_Bool    e_client_video_hw_composition_check(E_Client *ec);
 
 E_API   Eina_Bool    e_client_video_topmost_visibility_follow(E_Client *ec);
 E_API   Eina_Bool    e_client_video_topmost_visibility_unfollow(E_Client *ec);
index ea797c904f3cf335fb5e8d455b8b0d6521ccd809..10df010e3a25e277ecd574a6dae879328ef664d4 100644 (file)
@@ -41,6 +41,7 @@
    (g)->output_r.w, (g)->output_r.h, (g)->output_r.x, (g)->output_r.y, \
    (g)->transform
 
+typedef struct _E_Client_Video E_Client_Video;
 typedef struct _E_Video_Comp_Iface E_Video_Comp_Iface;
 
 struct _E_Video_Comp_Iface
@@ -61,8 +62,11 @@ struct _E_Video_Comp_Iface
 };
 
 EINTERN E_Hwc_Policy         e_zone_video_hwc_policy_get(E_Zone *zone);
-EINTERN E_Video_Comp_Iface  *e_video_hwc_iface_create(E_Client *ec);
-EINTERN E_Video_Comp_Iface  *e_video_fallback_iface_create(E_Client *ec);
-EINTERN E_Video_Comp_Iface  *e_video_external_iface_create(E_Client *ec);
+EINTERN E_Video_Comp_Iface  *e_video_hwc_iface_create(E_Client_Video *ecv);
+EINTERN E_Video_Comp_Iface  *e_video_fallback_iface_create(E_Client_Video *ecv);
+EINTERN E_Video_Comp_Iface  *e_video_external_iface_create(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);
 
 #endif
index 6b0a918a8a5afb0c0f593a640d97cfe5d94bbee3..0c4f9818e912596c57814f6b1dc641ac52fbd17b 100644 (file)
@@ -5,7 +5,7 @@ typedef struct _E_Video_External E_Video_External;
 struct _E_Video_External
 {
    E_Video_Comp_Iface base;
-   E_Client *ec;
+   E_Client_Video *ecv;
 };
 
 static void
@@ -14,25 +14,19 @@ _e_video_external_iface_destroy(E_Video_Comp_Iface *iface)
    E_Video_External *evs;
 
    evs = container_of(iface, E_Video_External, base);
-
-   if (!e_object_is_del(E_OBJECT(evs->ec)))
-     {
-        /* 'ec->comp_data' is supposed to be freed when ec is deleted. */
-        evs->ec->comp_data->video_client = 0;
-     }
+   e_client_video_hw_composition_unset(evs->ecv);
 
    free(evs);
 }
 
 static void
-_e_video_external_init(E_Client *ec)
+_e_video_external_init(E_Client_Video *ecv)
 {
-   /* Set video_client flag so that 'e_comp_wl' can ignore it. */
-   ec->comp_data->video_client = 1;
+   e_client_video_hw_composition_set(ecv);
 }
 
 EINTERN E_Video_Comp_Iface *
-e_video_external_iface_create(E_Client *ec)
+e_video_external_iface_create(E_Client_Video *ecv)
 {
    E_Video_External *evs;
 
@@ -45,9 +39,9 @@ e_video_external_iface_create(E_Client *ec)
         return NULL;
      }
 
-   _e_video_external_init(ec);
+   _e_video_external_init(ecv);
 
-   evs->ec = ec;
+   evs->ecv = ecv;
    evs->base.destroy = _e_video_external_iface_destroy;
 
    return &evs->base;
index f21a8979a0b9359d6130a34e5b273d43462971f4..ad35ba9f127ed098c245f29f7a25be37ff7bb401 100644 (file)
@@ -5,33 +5,39 @@ typedef struct _E_Video_Fallback E_Video_Fallback;
 struct _E_Video_Fallback
 {
    E_Video_Comp_Iface base;
-   E_Client *ec;
+   E_Client_Video *ecv;
 };
 
 static void
 _e_video_fallback_iface_destroy(E_Video_Comp_Iface *iface)
 {
    E_Video_Fallback *evs;
+   E_Client *ec;
 
    evs = container_of(iface, E_Video_Fallback, base);
 
    /* Unset animatable lock */
-   e_policy_animatable_lock(evs->ec, E_POLICY_ANIMATABLE_NEVER, 0);
+   ec = e_client_video_ec_get(evs->ecv);
+   e_policy_animatable_lock(ec, E_POLICY_ANIMATABLE_NEVER, 0);
 
    free(evs);
 }
 
 static void
-_e_video_fallback_init(E_Client *ec)
+_e_video_fallback_init(E_Client_Video *ecv)
 {
+   E_Client *ec;
+
    /* software compositing */
-   ec->comp_data->video_client = 0;
+   e_client_video_hw_composition_unset(ecv);
+
    /* Set animatable lock */
+   ec = e_client_video_ec_get(ecv);
    e_policy_animatable_lock(ec, E_POLICY_ANIMATABLE_NEVER, 1);
 }
 
 EINTERN E_Video_Comp_Iface *
-e_video_fallback_iface_create(E_Client *ec)
+e_video_fallback_iface_create(E_Client_Video *ecv)
 {
    E_Video_Fallback *evs;
 
@@ -44,9 +50,9 @@ e_video_fallback_iface_create(E_Client *ec)
         return NULL;
      }
 
-   _e_video_fallback_init(ec);
+   _e_video_fallback_init(ecv);
 
-   evs->ec = ec;
+   evs->ecv = ecv;
    evs->base.destroy = _e_video_fallback_iface_destroy;
 
    return &evs->base;
index 95ec894accbc3fcd68c9d89639623a699b61b93e..2f9e92941e28b43464e18e1e543acee203a1ae92 100644 (file)
@@ -1295,7 +1295,7 @@ _e_video_hwc_child_client_get(E_Client *ec)
    if (e_object_is_del(E_OBJECT(ec))) return NULL;
    if (!ec->comp_data) return NULL;
 
-   if (ec->comp_data->video_client) return ec;
+   if (e_client_video_hw_composition_check(ec)) return ec;
 
    EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc)
      {
@@ -1603,9 +1603,12 @@ _e_video_hwc_client_event_init(E_Video_Hwc *evh)
 }
 
 EINTERN E_Video_Comp_Iface *
-e_video_hwc_iface_create(E_Client *ec)
+e_video_hwc_iface_create(E_Client_Video *ecv)
 {
    E_Video_Hwc *evh;
+   E_Client *ec;
+
+   ec = e_client_video_ec_get(ecv);
 
    VIN("Create HWC interface", ec);
 
@@ -1615,6 +1618,8 @@ e_video_hwc_iface_create(E_Client *ec)
 
    _e_video_hwc_client_event_init(evh);
 
+   evh->ecv = ecv;
+
    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;
@@ -1630,7 +1635,7 @@ e_video_hwc_iface_create(E_Client *ec)
 
    /* This ec is a video client now. */
    VIN("video client", ec);
-   ec->comp_data->video_client = 1;
+   e_client_video_hw_composition_set(ecv);
 
    return &evh->iface;
 }
index 3bfdcf97e786f199e0ae9d0b81bb85434300804e..d6097c4b7b4e84109266357dcd5ba24cf099aef5 100644 (file)
@@ -48,6 +48,7 @@ struct _E_Video_Hwc
 
    E_Hwc_Policy hwc_policy;
 
+   E_Client_Video *ecv;
    E_Client *ec;
    Ecore_Window window;
    E_Output *e_output;