e_output: add two interal API to get current mode and mode list 52/172552/2
authorJunkyeong Kim <jk0430.kim@samsung.com>
Wed, 14 Mar 2018 10:38:47 +0000 (19:38 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 16 Mar 2018 06:19:20 +0000 (06:19 +0000)
Change-Id: I39bddc68a969b27d7de4b0d619f62cb401a341fa
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/bin/e_output.c
src/bin/e_output.h

index 7b7d985515ed804f4efa5e4cc0b019c6b06edbbe..41c585b10fca7119d0c1e6e907ff383dd80c7b76 100644 (file)
@@ -2307,8 +2307,10 @@ EINTERN Eina_Bool
 e_output_mode_apply(E_Output *output, E_Output_Mode *mode)
 {
    tdm_error error;
+   E_Output_Mode *current_mode = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(mode, EINA_FALSE);
 
    if (!output->info.connected)
      {
@@ -2316,6 +2318,13 @@ e_output_mode_apply(E_Output *output, E_Output_Mode *mode)
         return EINA_FALSE;
      }
 
+   current_mode = e_output_current_mode_get(output);
+   if (current_mode != NULL)
+     {
+        if (current_mode == mode)
+          return EINA_TRUE;
+     }
+
    error = tdm_output_set_mode(output->toutput, mode->tmode);
    if (error != TDM_ERROR_NONE)
      {
@@ -2323,6 +2332,10 @@ e_output_mode_apply(E_Output *output, E_Output_Mode *mode)
         return EINA_FALSE;
      }
 
+   if (current_mode != NULL)
+     current_mode->current = EINA_FALSE;
+   mode->current = EINA_TRUE;
+
    output->config.geom.x = 0;
    output->config.geom.y = 0;
    output->config.geom.w = mode->w;
@@ -2451,6 +2464,32 @@ e_output_best_mode_find(E_Output *output)
    return best_mode;
 }
 
+EINTERN Eina_List *
+e_output_mode_list_get(E_Output *output)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output->info.modes, NULL);
+
+   return output->info.modes;
+}
+
+EINTERN E_Output_Mode *
+e_output_current_mode_get(E_Output *output)
+{
+   Eina_List *l;
+   E_Output_Mode *emode = NULL;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(output, NULL);
+
+   EINA_LIST_FOREACH(output->info.modes, l, emode)
+     {
+        if (emode->current)
+          return emode;
+     }
+
+   return NULL;
+}
+
 EINTERN Eina_Bool
 e_output_connected(E_Output *output)
 {
index 71228afc84f722aaec06939663883447a19586ab..d65ce64458ec92f5d7a6858743a6e232f9dd5a76 100644 (file)
@@ -45,6 +45,7 @@ struct _E_Output_Mode
    int    w, h; // resolution width and height
    double refresh; // refresh in hz
    Eina_Bool preferred : 1; // is this the preferred mode for the device?
+   Eina_Bool current : 1;
 
    const tdm_output_mode *tmode;
 };
@@ -172,6 +173,8 @@ EINTERN Eina_Bool         e_output_commit(E_Output *output);
 EINTERN Eina_Bool         e_output_render(E_Output *output);
 EINTERN Eina_Bool         e_output_setup(E_Output *output);
 EINTERN E_Output_Mode   * e_output_best_mode_find(E_Output *output);
+EINTERN Eina_List       * e_output_mode_list_get(E_Output *output);
+EINTERN E_Output_Mode   * e_output_current_mode_get(E_Output *output);
 EINTERN Eina_Bool         e_output_connected(E_Output *output);
 E_API Eina_Bool           e_output_dpms_set(E_Output *output, E_OUTPUT_DPMS val);
 E_API E_OUTPUT_DPMS       e_output_dpms_get(E_Output *output);