[PATCH 10/21] drm/amd/display: Interface for LTTPR interop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Wesley Chalmers <Wesley.Chalmers@xxxxxxx>

[WHY]
The logic to toggle LTTPR transparent/non-transparent requires 2 flags
provided by BIOS

[HOW]
Repurpose the interface to get dce caps so both LTTPR querying functions
can use them.

Signed-off-by: Wesley Chalmers <Wesley.Chalmers@xxxxxxx>
Reviewed-by: Jun Lei <Jun.Lei@xxxxxxx>
Acked-by: Anson Jacob <Anson.Jacob@xxxxxxx>
---
 .../drm/amd/display/dc/bios/bios_parser2.c    | 75 ++++++++++++++++---
 .../gpu/drm/amd/display/dc/dc_bios_types.h    |  3 +
 drivers/gpu/drm/amd/include/atomfirmware.h    |  1 +
 3 files changed, 67 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 2ee0c6fc069a..d79f4fe06c47 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -916,7 +916,7 @@ static enum bp_result bios_parser_get_soc_bb_info(
 	return result;
 }
 
-static enum bp_result get_lttpr_caps_v4_1(
+static enum bp_result get_disp_caps_v4_1(
 	struct bios_parser *bp,
 	uint8_t *dce_caps)
 {
@@ -935,12 +935,12 @@ static enum bp_result get_lttpr_caps_v4_1(
 	if (!disp_cntl_tbl)
 		return BP_RESULT_BADBIOSTABLE;
 
-	*dce_caps = !!(disp_cntl_tbl->display_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
+	*dce_caps = disp_cntl_tbl->display_caps;
 
 	return result;
 }
 
-static enum bp_result get_lttpr_caps_v4_2(
+static enum bp_result get_disp_caps_v4_2(
 	struct bios_parser *bp,
 	uint8_t *dce_caps)
 {
@@ -959,12 +959,12 @@ static enum bp_result get_lttpr_caps_v4_2(
 	if (!disp_cntl_tbl)
 		return BP_RESULT_BADBIOSTABLE;
 
-	*dce_caps = !!(disp_cntl_tbl->display_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
+	*dce_caps = disp_cntl_tbl->display_caps;
 
 	return result;
 }
 
-static enum bp_result get_lttpr_caps_v4_3(
+static enum bp_result get_disp_caps_v4_3(
 	struct bios_parser *bp,
 	uint8_t *dce_caps)
 {
@@ -983,12 +983,12 @@ static enum bp_result get_lttpr_caps_v4_3(
 	if (!disp_cntl_tbl)
 		return BP_RESULT_BADBIOSTABLE;
 
-	*dce_caps = !!(disp_cntl_tbl->display_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
+	*dce_caps = disp_cntl_tbl->display_caps;
 
 	return result;
 }
 
-static enum bp_result get_lttpr_caps_v4_4(
+static enum bp_result get_disp_caps_v4_4(
 	struct bios_parser *bp,
 	uint8_t *dce_caps)
 {
@@ -1007,7 +1007,52 @@ static enum bp_result get_lttpr_caps_v4_4(
 	if (!disp_cntl_tbl)
 		return BP_RESULT_BADBIOSTABLE;
 
-	*dce_caps = !!(disp_cntl_tbl->display_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
+	*dce_caps = disp_cntl_tbl->display_caps;
+
+	return result;
+}
+
+static enum bp_result bios_parser_get_lttpr_interop(
+	struct dc_bios *dcb,
+	uint8_t *dce_caps)
+{
+	struct bios_parser *bp = BP_FROM_DCB(dcb);
+	enum bp_result result = BP_RESULT_UNSUPPORTED;
+	struct atom_common_table_header *header;
+	struct atom_data_revision tbl_revision;
+
+	if (!DATA_TABLES(dce_info))
+		return BP_RESULT_UNSUPPORTED;
+
+	header = GET_IMAGE(struct atom_common_table_header,
+						DATA_TABLES(dce_info));
+	get_atom_data_table_revision(header, &tbl_revision);
+	switch (tbl_revision.major) {
+	case 4:
+		switch (tbl_revision.minor) {
+		case 1:
+			result = get_disp_caps_v4_1(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_VBIOS_LTTPR_TRANSPARENT_ENABLE);
+			break;
+		case 2:
+			result = get_disp_caps_v4_2(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_VBIOS_LTTPR_TRANSPARENT_ENABLE);
+			break;
+		case 3:
+			result = get_disp_caps_v4_3(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_VBIOS_LTTPR_TRANSPARENT_ENABLE);
+			break;
+		case 4:
+			result = get_disp_caps_v4_4(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_VBIOS_LTTPR_TRANSPARENT_ENABLE);
+			break;
+		default:
+			break;
+		}
+		break;
+	default:
+		break;
+	}
 
 	return result;
 }
@@ -1031,16 +1076,20 @@ static enum bp_result bios_parser_get_lttpr_caps(
 	case 4:
 		switch (tbl_revision.minor) {
 		case 1:
-			result = get_lttpr_caps_v4_1(bp, dce_caps);
+			result = get_disp_caps_v4_1(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
 			break;
 		case 2:
-			result = get_lttpr_caps_v4_2(bp, dce_caps);
+			result = get_disp_caps_v4_2(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
 			break;
 		case 3:
-			result = get_lttpr_caps_v4_3(bp, dce_caps);
+			result = get_disp_caps_v4_3(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
 			break;
 		case 4:
-			result = get_lttpr_caps_v4_4(bp, dce_caps);
+			result = get_disp_caps_v4_4(bp, dce_caps);
+			*dce_caps = !!(*dce_caps & DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE);
 			break;
 		default:
 			break;
@@ -2670,6 +2719,8 @@ static const struct dc_vbios_funcs vbios_funcs = {
 	.get_disp_connector_caps_info = bios_parser_get_disp_connector_caps_info,
 
 	.get_lttpr_caps = bios_parser_get_lttpr_caps,
+
+	.get_lttpr_interop = bios_parser_get_lttpr_interop,
 };
 
 static bool bios_parser2_construct(
diff --git a/drivers/gpu/drm/amd/display/dc/dc_bios_types.h b/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
index 1b957c60156b..67abda44eb1f 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_bios_types.h
@@ -153,6 +153,9 @@ struct dc_vbios_funcs {
 	enum bp_result (*get_lttpr_caps)(
 			struct dc_bios *dcb,
 			uint8_t *dce_caps);
+	enum bp_result (*get_lttpr_interop)(
+			struct dc_bios *dcb,
+			uint8_t *dce_caps);
 };
 
 struct bios_registers {
diff --git a/drivers/gpu/drm/amd/include/atomfirmware.h b/drivers/gpu/drm/amd/include/atomfirmware.h
index 82b3cd89b383..c77ed38c20fb 100644
--- a/drivers/gpu/drm/amd/include/atomfirmware.h
+++ b/drivers/gpu/drm/amd/include/atomfirmware.h
@@ -1079,6 +1079,7 @@ enum dce_info_caps_def
   DCE_INFO_CAPS_ENABLE_INTERLAC_TIMING   =0x08,
   // only for VBIOS
   DCE_INFO_CAPS_LTTPR_SUPPORT_ENABLE	 =0x20,
+  DCE_INFO_CAPS_VBIOS_LTTPR_TRANSPARENT_ENABLE = 0x40,
 };
 
 /* 
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux