فهرست منبع

disp: msm: sde: validate sspp input formats in plane atomic check

This change adds support to validate plane formats in
atomic check phase. Also, the current check is not
sufficient to distinguish between some formats like
TP10_UBWC and P010_UBWC which can result in scenarios
where unsupported formats are also detected as
supported formats. Additional checks are introduced
to make sure that this is handled properly.

Change-Id: I41ea8dc95dba93479e24a68aab0dba0a253c3eec
Signed-off-by: Charishma Jerripothula <[email protected]>
Charishma Jerripothula 1 سال پیش
والد
کامیت
85be4c14bc
2فایلهای تغییر یافته به همراه32 افزوده شده و 9 حذف شده
  1. 9 8
      msm/sde/sde_formats.c
  2. 23 1
      msm/sde/sde_plane.c

+ 9 - 8
msm/sde/sde_formats.c

@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
@@ -1335,21 +1336,21 @@ int sde_format_validate_fmt(struct msm_kms *kms,
 
 	while (fmt_list->fourcc_format) {
 		fmt_tmp = sde_get_sde_format_ext(fmt_list->fourcc_format,
-					fmt_list->modifier);
-		if (fmt_tmp
-		  && (fmt_tmp->base.pixel_format == sde_fmt->base.pixel_format)
-		  && (fmt_tmp->fetch_mode == sde_fmt->fetch_mode)) {
+			fmt_list->modifier);
+		if (fmt_tmp &&
+			(fmt_tmp->base.pixel_format == sde_fmt->base.pixel_format) &&
+			(fmt_tmp->fetch_mode == sde_fmt->fetch_mode) &&
+			(bitmap_equal(fmt_tmp->flag, sde_fmt->flag, SDE_FORMAT_FLAG_BIT_MAX)) &&
+			(fmt_tmp->unpack_tight == sde_fmt->unpack_tight)) {
 			valid_format = true;
 			break;
 		}
 		++fmt_list;
 	}
 
-	if (!valid_format) {
-		SDE_ERROR("fmt:%d mode:%d not found within the list!\n",
-			sde_fmt->base.pixel_format, sde_fmt->fetch_mode);
+	if (!valid_format)
+
 		ret = -EINVAL;
-	}
 exit:
 	return ret;
 }

+ 23 - 1
msm/sde/sde_plane.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * Copyright (C) 2014-2021 The Linux Foundation. All rights reserved.
  * Copyright (C) 2013 Red Hat
  * Author: Rob Clark <[email protected]>
@@ -1721,6 +1721,13 @@ static int sde_plane_rot_atomic_check(struct drm_plane *plane,
 		fmt = to_sde_format(msm_fmt);
 		ret = sde_format_validate_fmt(&sde_kms->base, fmt,
 			psde->pipe_sblk->in_rot_format_list);
+		if (ret) {
+			SDE_ERROR_PLANE(psde,
+				"fmt:%d mode:%d unpack:%d not found within the list!\n",
+				(fmt) ? fmt->base.pixel_format : 0,
+				(fmt) ? fmt->fetch_mode : 0,
+				(fmt) ? fmt->unpack_tight : 0);
+		}
 	}
 
 exit:
@@ -2698,7 +2705,22 @@ static int _sde_plane_sspp_atomic_check_helper(struct sde_plane *psde,
 {
 	int ret = 0;
 	u32 min_src_size = SDE_FORMAT_IS_YUV(fmt) ? 2 : 1;
+	struct sde_kms *sde_kms = _sde_plane_get_kms(&psde->base);
 
+	if (!sde_kms) {
+		SDE_ERROR("invalid sde_kms\n");
+		return -EINVAL;
+	}
+
+	ret = sde_format_validate_fmt(&sde_kms->base, fmt,
+			psde->pipe_sblk->format_list);
+	if (ret) {
+		SDE_ERROR_PLANE(psde, "fmt:%d mode:%d unpack:%d not found within the list!\n",
+			(fmt) ? fmt->base.pixel_format : 0,
+			(fmt) ? fmt->fetch_mode : 0,
+			(fmt) ? fmt->unpack_tight : 0);
+		return ret;
+	}
 	if (SDE_FORMAT_IS_YUV(fmt) &&
 			(!(psde->features & SDE_SSPP_SCALER) ||
 			 !(psde->features & (BIT(SDE_SSPP_CSC)