Browse Source

disp: msm: sde: set layer mixer for each wb display mode

Set the number of layer mixer for each wb mode based on the
current mode hdisplay width. If the hdisplay width of current
mode is greater than the maximum layer mixer width of HW supported,
set dual layer mixers for this mode and check if the split
hdisplay width is an even number.

Change-Id: I0190830ed559f008f9e2c0752858ddc5e7cb83cd
Signed-off-by: Lei Chen <[email protected]>
Lei Chen 2 years ago
parent
commit
99aee9b733
1 changed files with 7 additions and 11 deletions
  1. 7 11
      msm/sde/sde_wb.c

+ 7 - 11
msm/sde/sde_wb.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-License-Identifier: GPL-2.0-only
 /*
 /*
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
  */
 
 
@@ -472,9 +472,6 @@ int sde_wb_get_mode_info(struct drm_connector *connector,
 	const u32 single_intf = 1;
 	const u32 single_intf = 1;
 	const u32 no_enc = 0;
 	const u32 no_enc = 0;
 	struct msm_display_topology *topology;
 	struct msm_display_topology *topology;
-	struct sde_wb_device *wb_dev = display;
-	u16 hdisplay;
-	int i;
 
 
 	if (!drm_mode || !mode_info || !avail_res ||
 	if (!drm_mode || !mode_info || !avail_res ||
 			!avail_res->max_mixer_width || !display) {
 			!avail_res->max_mixer_width || !display) {
@@ -482,18 +479,17 @@ int sde_wb_get_mode_info(struct drm_connector *connector,
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
 
 
-	hdisplay = drm_mode->hdisplay;
-
-	/* find maximum display width to support */
-	for (i = 0; i < wb_dev->count_modes; i++)
-		hdisplay = max(hdisplay, wb_dev->modes[i].hdisplay);
-
 	topology = &mode_info->topology;
 	topology = &mode_info->topology;
-	topology->num_lm = (avail_res->max_mixer_width <= hdisplay) ?
+	topology->num_lm = (avail_res->max_mixer_width <= drm_mode->hdisplay) ?
 			dual_lm : single_lm;
 			dual_lm : single_lm;
 	topology->num_enc = no_enc;
 	topology->num_enc = no_enc;
 	topology->num_intf = single_intf;
 	topology->num_intf = single_intf;
 
 
+	if (topology->num_lm == dual_lm && (drm_mode->hdisplay % 4)) {
+		SDE_ERROR("invalid mode settings for 3d-merge, hdisplay:%d\n", drm_mode->hdisplay);
+		return -EINVAL;
+	}
+
 	mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_NONE;
 	mode_info->comp_info.comp_type = MSM_DISPLAY_COMPRESSION_NONE;
 	mode_info->wide_bus_en = false;
 	mode_info->wide_bus_en = false;
 	mode_info->comp_info.comp_ratio = MSM_DISPLAY_COMPRESSION_RATIO_NONE;
 	mode_info->comp_info.comp_ratio = MSM_DISPLAY_COMPRESSION_RATIO_NONE;