e_plane: remove pp pending data if offscreen commit or dpms is not on. 97/155597/6
authorJunkyeong Kim <jk0430.kim@samsung.com>
Sun, 15 Oct 2017 12:25:01 +0000 (21:25 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 19 Oct 2017 23:53:39 +0000 (23:53 +0000)
Change-Id: I4d895edb0d0a1530cd0208299e9d2ef5ce2f9b5e
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/bin/e_plane.c

index 16a00b3bfb6ac5592e634355e0f8891a95d0fb58..feed3f94bb46affb30443ec5701f0e0510181025 100644 (file)
@@ -728,12 +728,47 @@ _e_plane_pp_info_set(E_Plane *plane, tbm_surface_h dst_tsurface)
    return EINA_TRUE;
 }
 
+static void
+_e_plane_pp_pending_data_remove(E_Plane *plane)
+{
+   E_Plane_Commit_Data *data = NULL;
+   Eina_List *l = NULL, *ll = NULL;
+
+   if (eina_list_count(plane->pending_pp_commit_data_list) != 0)
+     {
+        EINA_LIST_FOREACH_SAFE(plane->pending_pp_commit_data_list, l, ll, data)
+          {
+             if (!data) continue;
+             plane->pending_pp_commit_data_list = eina_list_remove_list(plane->pending_pp_commit_data_list, l);
+             tbm_surface_queue_release(plane->pp_tqueue, data->tsurface);
+             tbm_surface_internal_unref(data->tsurface);
+             E_FREE(data);
+          }
+     }
+   eina_list_free(plane->pending_pp_commit_data_list);
+   plane->pending_pp_commit_data_list = NULL;
+
+   if (eina_list_count(plane->pending_pp_data_list) != 0)
+     {
+        EINA_LIST_FOREACH_SAFE(plane->pending_pp_data_list, l, ll, data)
+          {
+             if (!data) continue;
+             plane->pending_pp_data_list = eina_list_remove_list(plane->pending_pp_data_list, l);
+             if (data->ec) e_pixmap_image_clear(data->ec->pixmap, 1);
+             e_plane_commit_data_release(data);
+          }
+     }
+   eina_list_free(plane->pending_pp_data_list);
+   plane->pending_pp_data_list = NULL;
+}
+
 static void
 _e_plane_pp_layer_commit_handler(tdm_layer *layer, unsigned int sequence,
                                  unsigned int tv_sec, unsigned int tv_usec,
                                  void *user_data)
 {
    E_Plane_Commit_Data *data = (E_Plane_Commit_Data *)user_data;
+   E_Output *output = NULL;
    E_Plane *plane = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN(data);
@@ -746,7 +781,7 @@ _e_plane_pp_layer_commit_handler(tdm_layer *layer, unsigned int sequence,
    if (!plane->pp_set)
      {
         tbm_surface_internal_unref(data->tsurface);
-        free(data);
+        E_FREE(data);
         return;
      }
 
@@ -760,11 +795,18 @@ _e_plane_pp_layer_commit_handler(tdm_layer *layer, unsigned int sequence,
    /* set the new pp surface to the plane */
    plane->pp_tsurface = data->tsurface;
 
-   free(data);
+   E_FREE(data);
 
    if (plane_trace_debug)
      ELOGF("E_PLANE", "PP Layer Commit Handler Plane(%p)", NULL, NULL, plane);
 
+   output = plane->output;
+   if (e_output_dpms_get(output))
+     {
+        _e_plane_pp_pending_data_remove(plane);
+        return;
+     }
+
    /* deal with the pending layer commit */
    if (eina_list_count(plane->pending_pp_commit_data_list) != 0)
      {
@@ -862,6 +904,7 @@ fail:
 static Eina_Bool
 _e_plane_pp_layer_data_commit(E_Plane *plane, E_Plane_Commit_Data *data)
 {
+   E_Output *output = NULL;
    tbm_surface_info_s surf_info;
    unsigned int aligned_width;
    int dst_w, dst_h;
@@ -870,6 +913,13 @@ _e_plane_pp_layer_data_commit(E_Plane *plane, E_Plane_Commit_Data *data)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(data, EINA_FALSE);
 
+   output = plane->output;
+   if (e_output_dpms_get(output))
+     {
+        _e_plane_pp_pending_data_remove(plane);
+        goto fail;
+     }
+
    aligned_width = _e_plane_aligned_width_get(data->tsurface);
    if (aligned_width == 0)
      {
@@ -917,7 +967,7 @@ _e_plane_pp_layer_data_commit(E_Plane *plane, E_Plane_Commit_Data *data)
 fail:
    tbm_surface_internal_unref(data->tsurface);
    tbm_surface_queue_release(plane->pp_tqueue, data->tsurface);
-   free(data);
+   E_FREE(data);
 
    return EINA_FALSE;
 }
@@ -942,6 +992,7 @@ _e_plane_pp_data_get(E_Plane *plane, tbm_surface_h tsurface)
 static void
 _e_plane_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_surface_h tsurface_dst, void *user_data)
 {
+   E_Output *output = NULL;
    E_Plane *plane = NULL;
    E_Plane_Commit_Data *data = NULL;
 
@@ -973,6 +1024,15 @@ _e_plane_pp_commit_handler(tdm_pp *pp, tbm_surface_h tsurface_src, tbm_surface_h
         goto done;
      }
 
+   output = plane->output;
+   if (e_output_dpms_get(output))
+     {
+        _e_plane_pp_pending_data_remove(plane);
+        tbm_surface_queue_release(plane->pp_tqueue, tsurface_dst);
+
+        goto done;
+     }
+
    if (!_e_plane_pp_layer_commit(plane, tsurface_dst))
      ERR("fail to _e_plane_pp_layer_commit");
 
@@ -984,6 +1044,7 @@ done:
 static Eina_Bool
 _e_plane_pp_commit(E_Plane *plane, E_Plane_Commit_Data *data)
 {
+   E_Output *output = NULL;
    tbm_surface_h pp_tsurface = NULL;
    tbm_error_e tbm_err = TBM_ERROR_NONE;
    tdm_error tdm_err = TDM_ERROR_NONE;
@@ -994,6 +1055,13 @@ _e_plane_pp_commit(E_Plane *plane, E_Plane_Commit_Data *data)
            NULL, NULL, plane, plane->zpos, data->tsurface, plane->pp_tqueue,
            data->buffer_ref.buffer ? data->buffer_ref.buffer->resource : NULL, data);
 
+   output = plane->output;
+   if (e_output_dpms_get(output))
+     {
+        _e_plane_pp_pending_data_remove(plane);
+        return EINA_FALSE;
+     }
+
    tbm_err = tbm_surface_queue_dequeue(plane->pp_tqueue, &pp_tsurface);
    if (tbm_err != TBM_ERROR_NONE)
      {
@@ -1575,6 +1643,9 @@ e_plane_offscreen_commit(E_Plane *plane)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(plane, EINA_FALSE);
 
+   if ((plane->pp_set) && e_plane_is_fb_target(plane))
+     _e_plane_pp_pending_data_remove(plane);
+
    if (plane->unset_commit) return EINA_TRUE;
 
    data = e_plane_commit_data_aquire(plane);
@@ -2583,9 +2654,6 @@ fail:
 EINTERN void
 e_plane_zoom_unset(E_Plane *plane)
 {
-   E_Plane_Commit_Data *data = NULL;
-   Eina_List *l, *ll;
-
    EINA_SAFETY_ON_NULL_RETURN(plane);
 
    plane->pp_set_info = EINA_FALSE;
@@ -2597,22 +2665,7 @@ e_plane_zoom_unset(E_Plane *plane)
    plane->pp_rect.w = 0;
    plane->pp_rect.h = 0;
 
-   EINA_LIST_FOREACH_SAFE(plane->pending_pp_commit_data_list, l, ll, data)
-     {
-        if (!data) continue;
-        plane->pending_pp_commit_data_list = eina_list_remove_list(plane->pending_pp_commit_data_list, l);
-        tbm_surface_queue_release(plane->pp_tqueue, data->tsurface);
-        tbm_surface_internal_unref(data->tsurface);
-        free(data);
-     }
-
-   EINA_LIST_FOREACH_SAFE(plane->pending_pp_data_list, l, ll, data)
-     {
-        if (!data) continue;
-        plane->pending_pp_data_list = eina_list_remove_list(plane->pending_pp_data_list, l);
-        if (data->ec) e_pixmap_image_clear(data->ec->pixmap, 1);
-        e_plane_commit_data_release(data);
-     }
+   _e_plane_pp_pending_data_remove(plane);
 
    if (plane->pp_tsurface)
      {