e_comp_screen: add e_comp_screen_pp_available_formats_get 45/147745/13
authorSooChan Lim <sc1.lim@samsung.com>
Tue, 5 Sep 2017 10:59:33 +0000 (19:59 +0900)
committerBoram Park <boram1288.park@samsung.com>
Fri, 8 Sep 2017 01:26:58 +0000 (01:26 +0000)
provide the pp avaliable formats at e_comp_screen

Change-Id: Ibf2f3309028472970dbc750813ac190391d9c811

src/bin/e_comp_screen.c
src/bin/e_comp_screen.h
src/bin/e_comp_wl_video.c

index e38ca60141d740041dd1bbf17cc92651b10eaed1..6e25f1327a295ecda94e894741b20c9edc742624 100644 (file)
@@ -414,6 +414,8 @@ _e_comp_screen_new(E_Comp *comp)
    E_Comp_Screen *e_comp_screen = NULL;
    tdm_error error = TDM_ERROR_NONE;
    tdm_display_capability capabilities;
+   const tbm_format *pp_formats;
+   int count, i;
 
    e_comp_screen = E_NEW(E_Comp_Screen, 1);
    if (!e_comp_screen) return NULL;
@@ -449,7 +451,17 @@ _e_comp_screen_new(E_Comp *comp)
 
    /* check the pp_support */
    if (capabilities & TDM_DISPLAY_CAPABILITY_PP)
-     e_comp_screen->pp_enabled = EINA_TRUE;
+     {
+        error = tdm_display_get_pp_available_formats(e_comp_screen->tdisplay, &pp_formats, &count);
+        if (error != TDM_ERROR_NONE)
+          ERR("fail to get available pp formats");
+        else
+          {
+             e_comp_screen->pp_enabled = EINA_TRUE;
+             for (i = 0 ; i < count ; i++)
+               e_comp_screen->available_pp_formats = eina_list_append(e_comp_screen->available_pp_formats, &pp_formats[i]);
+          }
+     }
 
    if (e_comp_socket_init("tdm-socket"))
      PRCTL("[Winsys] change permission and create sym link for %s", "tdm-socket");
@@ -460,8 +472,16 @@ _e_comp_screen_new(E_Comp *comp)
 static void
 _e_comp_screen_del(E_Comp_Screen *e_comp_screen)
 {
+   Eina_List *l = NULL, *ll = NULL;
+   tbm_format *formats;
+
    if (!e_comp_screen) return;
 
+   if (e_comp_screen->pp_enabled)
+     {
+        EINA_LIST_FOREACH_SAFE(e_comp_screen->available_pp_formats, l, ll, formats)
+          e_comp_screen->available_pp_formats = eina_list_remove(e_comp_screen->available_pp_formats, l);
+     }
    if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
    if (e_comp_screen->tdisplay) tdm_display_deinit(e_comp_screen->tdisplay);
 
@@ -1254,6 +1274,26 @@ e_comp_screen_pp_support(void)
    return e_comp_screen->pp_enabled;
 }
 
+
+EINTERN Eina_List *
+e_comp_screen_pp_available_formats_get(void)
+{
+  E_Comp_Screen *e_comp_screen = NULL;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, EINA_FALSE);
+
+  e_comp_screen = e_comp->e_comp_screen;
+  EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
+  EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->tdisplay, EINA_FALSE);
+
+  if (!e_comp_screen->pp_enabled)
+    {
+       ERR("pp does not support.");
+       return NULL;
+    }
+
+   return e_comp_screen->available_pp_formats;
+}
+
 EINTERN void
 e_comp_screen_hwc_info_debug(void)
 {
index 6cf0543e3bead42c33acd5e1cebab11eee37e360..5a708cacf35cfb86aa31c5a2e67e12433a696767 100644 (file)
@@ -29,7 +29,8 @@ struct _E_Comp_Screen
    int rotation;
 
    /* pp support */
-   Eina_Bool pp_enabled;
+   Eina_Bool  pp_enabled;
+   Eina_List *available_pp_formats;
 };
 
 
@@ -55,6 +56,7 @@ E_API   void              e_comp_screen_rotation_ignore_output_transform_send(E_
 EINTERN E_Output        * e_comp_screen_primary_output_get(E_Comp_Screen *e_comp_screen);
 
 EINTERN Eina_Bool         e_comp_screen_pp_support(void);
+EINTERN Eina_List       * e_comp_screen_pp_available_formats_get(void);
 
 #endif /*E_COMP_SCREEN_H*/
 
index a40fdb9e24e6a96fd4d1161336d839badf7b5bc8..800e9f4ceec850f4e80f84bccdd4d4dc5cc16a71 100644 (file)
@@ -2559,8 +2559,11 @@ static void
 _e_comp_wl_video_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
 {
    struct wl_resource *res;
-   const tbm_format *formats = NULL;
+   const uint32_t *formats = NULL;
    int i, count = 0;
+   Eina_List *pp_format_list = NULL;
+   Eina_List *l = NULL;
+   uint32_t *pp_format;
 
    if (!(res = wl_resource_create(client, &tizen_video_interface, version, id)))
      {
@@ -2573,10 +2576,12 @@ _e_comp_wl_video_cb_bind(struct wl_client *client, void *data, uint32_t version,
 
    /* 1st, use pp information. */
    if (e_comp_screen_pp_support())
+     pp_format_list = e_comp_screen_pp_available_formats_get();
+
+   if (pp_format_list)
      {
-        tdm_display_get_pp_available_formats(e_comp->e_comp_screen->tdisplay, &formats, &count);
-        for (i = 0; i < count; i++)
-          tizen_video_send_format(res, formats[i]);
+        EINA_LIST_FOREACH(pp_format_list, l, pp_format)
+          tizen_video_send_format(res, *pp_format);
      }
    else
      {