Use hw cursor when output has cursor layer 21/293921/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 8 Jun 2023 07:14:47 +0000 (16:14 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 8 Jun 2023 07:15:15 +0000 (16:15 +0900)
Change-Id: I9ba63582d759541ff4b861d0604f582f93bcef16

src/tdm_backend_drm_types.h
src/tdm_drm_display.c
src/tdm_drm_hwc.c

index 2d13c13..356d8ec 100644 (file)
@@ -200,6 +200,7 @@ struct _tdm_drm_output_data {
        unsigned int connector_type_id;
        struct list_head layer_list;
        tdm_drm_layer *primary_layer;
+       tdm_drm_layer *cursor_layer;
 
        /* not fixed data below */
        hal_tdm_output_vblank_handler vblank_func;
index 5c3114f..ed1f2c6 100644 (file)
@@ -560,6 +560,7 @@ _tdm_drm_display_create_layer_list_type(tdm_drm_display *display_data)
                        layer_data->capabilities = TDM_DRM_LAYER_CAPABILITY_CURSOR |
                                                                           TDM_DRM_LAYER_CAPABILITY_GRAPHIC;
                        layer_data->zpos = cpos_next++;
+                       output_data->cursor_layer = layer_data;
                } else if (types[i] == DRM_PLANE_TYPE_OVERLAY) {
                        layer_data->capabilities = TDM_DRM_LAYER_CAPABILITY_OVERLAY |
                                                                           TDM_DRM_LAYER_CAPABILITY_GRAPHIC;
index 6903d53..0645634 100644 (file)
@@ -42,7 +42,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NUM_UI_LAYERS  1
 
 #define ZPOS_MAX       1
-#define ZPOS_CURSOR    2
 #define ZPOS_1         1
 #define ZPOS_0         0
 #define ZPOS_VIDEO1    0
@@ -350,6 +349,7 @@ _drm_hwc_apply_policy(tdm_drm_hwc *hwc_data , hal_tdm_hwc_window **composited_wn
 {
        tdm_drm_hwc_window_data *hwc_window_data = NULL;
        tdm_drm_hwc_window_data **composited_list = NULL;
+       tdm_drm_output *output_data = hwc_data->output_data;
        int client_count = 0;
        int device_count = 0;
        int video_count = 0;
@@ -388,6 +388,7 @@ _drm_hwc_apply_policy(tdm_drm_hwc *hwc_data , hal_tdm_hwc_window **composited_wn
                case HAL_TDM_HWC_WIN_COMPOSITION_CURSOR:
                        if (set_clients_below) break;
                        if (cursor_count > 0) break;
+                       if (!output_data->cursor_layer) break;
 
                        composited_list[i]->validated_type = HAL_TDM_HWC_WIN_COMPOSITION_CURSOR;
                        cursor_count++;
@@ -435,7 +436,7 @@ _drm_hwc_apply_policy(tdm_drm_hwc *hwc_data , hal_tdm_hwc_window **composited_wn
                        composited_list[i]->lzpos = ZPOS_VIDEO1;
                        continue;
                case HAL_TDM_HWC_WIN_COMPOSITION_CURSOR:
-                       composited_list[i]->lzpos = ZPOS_CURSOR;
+                       composited_list[i]->lzpos = output_data->cursor_layer->zpos;
                        continue;
                case HAL_TDM_HWC_WIN_COMPOSITION_DEVICE:
                        if (num_ui_layers <= 0) break;