e_output: check the TDM_OUTPUT_CAPABILITY_HWC caps. 44/165944/3
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 3 Jan 2018 12:19:38 +0000 (21:19 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 5 Jan 2018 04:48:41 +0000 (04:48 +0000)
When the output supports the TDM_OUTPUT_CAPABILITY_HWC,
1. the output does not use the planes(tdm_layers) in e20.
2. the E_OUTPUT_HWC_POLICY_WINDOWS is set.

Change-Id: I4fd77066c9e7c92b5b4fff9fc216340e6070604f

src/bin/e_output.c
src/bin/e_output.h
src/bin/e_output_hwc.c

index 40ab6c4b7d385e465c493d8a1ec443ff4d0aa48a..762757fc08a83ee3348050d38b5f04a86f6d6886 100644 (file)
@@ -1784,21 +1784,73 @@ _e_output_planes_commit(E_Output *output)
 
 }
 
+static Eina_Bool
+_e_output_planes_init(E_Output *output)
+{
+   E_Plane *plane = NULL;
+   E_Plane *default_fb = NULL;
+   tdm_output *toutput = output->toutput;
+   int num_layers, i;
+
+   tdm_output_get_layer_count(toutput, &num_layers);
+   if (num_layers < 1)
+     {
+        ERR("fail to get tdm_output_get_layer_count\n");
+        goto fail;
+     }
+   output->plane_count = num_layers;
+   INF("E_OUTPUT: num_planes %i", output->plane_count);
+
+   if (!e_plane_init())
+     {
+        ERR("fail to e_plane_init.");
+        goto fail;
+     }
+
+   for (i = 0; i < output->plane_count; i++)
+     {
+        plane = e_plane_new(output, i);
+        if (!plane)
+          {
+             ERR("fail to create the e_plane.");
+             goto fail;
+          }
+        output->planes = eina_list_append(output->planes, plane);
+     }
+
+   output->planes = eina_list_sort(output->planes, eina_list_count(output->planes), _e_output_cb_planes_sort);
+
+   default_fb = e_output_default_fb_target_get(output);
+   if (!default_fb)
+     {
+        ERR("fail to get default_fb_target plane");
+        goto fail;
+     }
+
+   if (!e_plane_fb_target_set(default_fb, EINA_TRUE))
+     {
+        ERR("fail to set fb_target plane");
+        goto fail;
+     }
+
+   return EINA_TRUE;
+
+fail:
+   return EINA_FALSE;
+}
+
 EINTERN E_Output *
 e_output_new(E_Comp_Screen *e_comp_screen, int index)
 {
    E_Output *output = NULL;
-   E_Plane *plane = NULL;
-   E_Plane *default_fb = NULL;
    tdm_output *toutput = NULL;
    tdm_error error;
    char *id = NULL;
    char *name;
-   int num_layers;
-   int i;
    int size = 0;
    tdm_output_type output_type;
    int min_w, min_h, max_w, max_h, preferred_align;
+   tdm_output_capability output_caps = 0;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
 
@@ -1850,46 +1902,21 @@ e_output_new(E_Comp_Screen *e_comp_screen, int index)
 
    _e_output_tdm_stream_capture_support(output);
 
-   tdm_output_get_layer_count(toutput, &num_layers);
-   if (num_layers < 1)
-     {
-        ERR("fail to get tdm_output_get_layer_count\n");
-        goto fail;
-     }
-   output->plane_count = num_layers;
-   INF("E_OUTPUT: num_planes %i", output->plane_count);
-
-   if (!e_plane_init())
-     {
-        ERR("fail to e_plane_init.");
-        goto fail;
-     }
-
-   for (i = 0; i < output->plane_count; i++)
-     {
-        plane = e_plane_new(output, i);
-        if (!plane)
-          {
-             ERR("fail to create the e_plane.");
-             goto fail;
-          }
-        output->planes = eina_list_append(output->planes, plane);
-     }
-
-   output->planes = eina_list_sort(output->planes, eina_list_count(output->planes), _e_output_cb_planes_sort);
-
-   default_fb = e_output_default_fb_target_get(output);
-   if (!default_fb)
+   error = tdm_output_get_capabilities(toutput, &output_caps);
+   if (error != TDM_ERROR_NONE)
      {
-        ERR("fail to get default_fb_target plane");
+        ERR("fail to tdm_output_get_capabilities");
         goto fail;
      }
 
-   if (!e_plane_fb_target_set(default_fb, EINA_TRUE))
-     {
-        ERR("fail to set fb_target plane");
-        goto fail;
-     }
+   /* The E20 works the hwc_windows policy when tdm_output supports hwc capability e20.
+    * The E_Plane, E_Plane_Renderer resource is not used in E20.
+    */
+   if (output_caps & TDM_OUTPUT_CAPABILITY_HWC)
+     output->tdm_hwc = EINA_TRUE;
+   else
+     if (!_e_output_planes_init(output))
+       goto fail;
 
    return output;
 
index 6612fae0f3109e5fbd6b908c6e6d57f4f079af7f..4c3b363013fdc7135c274eb4dc88fc71e75d7fbf 100644 (file)
@@ -119,6 +119,7 @@ struct _E_Output
 
    /* output hwc */
    E_Output_Hwc *output_hwc;
+   Eina_Bool     tdm_hwc;
 
    /* external */
    Eina_Bool            external_set;
index 731df2d0ddfdd21748bdee325c79793ef35e44d8..2ab23ca10bf4e9c31806704c76500b5c6be44cb1 100644 (file)
@@ -609,6 +609,22 @@ e_output_hwc_new(E_Output *output)
 
    output_hwc->output = output;
 
+   /*
+    * E20 has two hwc policy options.
+    * 1. One is the E_OUTPUT_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_OUTPUT_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 compsition types of the E_Hwc_Window of the ec.
+    */
+   if (output->tdm_hwc)
+     {
+        output_hwc->hwc_policy = E_OUTPUT_HWC_POLICY_WINDOWS;
+     }
+   else
+     output_hwc->hwc_policy = E_OUTPUT_HWC_POLICY_PLANES;
+
    return output_hwc;
 }