hwc: unset cursor surface when cursor window is hidden 12/203312/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 4 Apr 2019 11:27:34 +0000 (20:27 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 16 Apr 2019 08:24:09 +0000 (08:24 +0000)
Change-Id: Ibda1367604439367d0819883015e79c7e10360bb

src/tdm_vc4_hwc.c
src/tdm_vc4_types.h

index d34e33d..475b1f7 100644 (file)
@@ -41,6 +41,20 @@ _comp_to_str(tdm_hwc_window_composition composition_type)
 }
 
 static int
+_vc4_hwc_cursor_buffer_unset(tdm_vc4_hwc_window_data *hwc_window_data)
+{
+       hwc_window_data->surface = NULL;
+       hwc_window_data->cursor_img_surface = 0;
+
+       hwc_window_data->info.src_config.pos.w = hwc_window_data->cursor_img.width;
+       hwc_window_data->info.src_config.pos.h = hwc_window_data->cursor_img.height;
+       hwc_window_data->info.dst_pos.w = hwc_window_data->cursor_img.width;
+       hwc_window_data->info.dst_pos.h = hwc_window_data->cursor_img.height;
+
+       return 1;
+}
+
+static int
 _vc4_hwc_cursor_buffer_set(tdm_vc4_hwc_data *hwc_data, tdm_vc4_hwc_window_data *hwc_window_data)
 {
        tbm_surface_h cursor_tsurface = NULL;
@@ -53,7 +67,7 @@ _vc4_hwc_cursor_buffer_set(tdm_vc4_hwc_data *hwc_data, tdm_vc4_hwc_window_data *
        int src_stride;
        int i;
 
-       if (!hwc_window_data->cursor_img_refresh)
+       if (!hwc_window_data->cursor_img_refresh && hwc_window_data->surface)
                return 1;
 
        img_w = hwc_window_data->cursor_img.width;
@@ -96,6 +110,7 @@ _vc4_hwc_cursor_buffer_set(tdm_vc4_hwc_data *hwc_data, tdm_vc4_hwc_window_data *
        tbm_surface_unmap(hwc_data->cursor_tsurface);
 
        hwc_window_data->surface = hwc_data->cursor_tsurface;
+       hwc_window_data->cursor_img_surface = 1;
 
        /* fix the dst_pos info of the cursor window */
        hwc_window_data->info.src_config.pos.w = new_w;
@@ -238,8 +253,13 @@ _vc4_hwc_prepare_commit(tdm_vc4_hwc_data *hwc_data)
        /* set the hwc_windows to the layers */
        LIST_FOR_EACH_ENTRY_REV(hwc_window_data, &hwc_data->hwc_window_list, link) {
                if (hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_NONE ||
-                       hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_CLIENT)
+                       hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_CLIENT) {
+
+                       if (hwc_window_data->cursor_img_surface)
+                               _vc4_hwc_cursor_buffer_unset(hwc_window_data);
+
                        continue;
+               }
 
                if (hwc_window_data == hwc_data->target_hwc_window)
                        continue;
index a045117..ed71a75 100644 (file)
@@ -270,6 +270,7 @@ struct _tdm_vc4_hwc_window_data {
                int stride;
                void *ptr;
        } cursor_img;
+       int cursor_img_surface;
        int cursor_img_refresh;
 };