All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Reza Amini <reza.amini-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 05/16] drm/amd/display: refactor member referencing to improve readability
Date: Mon, 3 Apr 2017 19:07:19 -0400	[thread overview]
Message-ID: <20170403230730.9884-6-harry.wentland@amd.com> (raw)
In-Reply-To: <20170403230730.9884-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>

From: Reza Amini <reza.amini@amd.com>

Change-Id: I06f22e78a63e1ea251fcd847594fd2abaa8eda65
Signed-off-by: Reza Amini <reza.amini@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 107 ++++++++--------------
 1 file changed, 39 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 8f53d7a9f4dd..069f588a9e02 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1519,17 +1519,16 @@ static void set_avi_info_frame(
 	uint8_t cn0_cn1 = 0;
 	uint8_t *check_sum = NULL;
 	uint8_t byte_index = 0;
+	union hdmi_info_packet *hdmi_info = &info_frame.avi_info_packet.info_packet_hdmi;
 
 	color_space = pipe_ctx->stream->public.output_color_space;
 
 	/* Initialize header */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.header.
-			info_frame_type = HDMI_INFOFRAME_TYPE_AVI;
+	hdmi_info->bits.header.info_frame_type = HDMI_INFOFRAME_TYPE_AVI;
 	/* InfoFrameVersion_3 is defined by CEA861F (Section 6.4), but shall
 	* not be used in HDMI 2.0 (Section 10.1) */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.header.version = 2;
-	info_frame.avi_info_packet.info_packet_hdmi.bits.header.length =
-			HDMI_AVI_INFOFRAME_SIZE;
+	hdmi_info->bits.header.version = 2;
+	hdmi_info->bits.header.length = HDMI_AVI_INFOFRAME_SIZE;
 
 	/*
 	 * IDO-defined (Y2,Y1,Y0 = 1,1,1) shall not be used by devices built
@@ -1555,52 +1554,41 @@ static void set_avi_info_frame(
 
 	/* Y0_Y1_Y2 : The pixel encoding */
 	/* H14b AVI InfoFrame has extension on Y-field from 2 bits to 3 bits */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.Y0_Y1_Y2 =
-		pixel_encoding;
+	hdmi_info->bits.Y0_Y1_Y2 = pixel_encoding;
 
 	/* A0 = 1 Active Format Information valid */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.A0 =
-		ACTIVE_FORMAT_VALID;
+	hdmi_info->bits.A0 = ACTIVE_FORMAT_VALID;
 
 	/* B0, B1 = 3; Bar info data is valid */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.B0_B1 =
-		BAR_INFO_BOTH_VALID;
+	hdmi_info->bits.B0_B1 = BAR_INFO_BOTH_VALID;
 
-	info_frame.avi_info_packet.info_packet_hdmi.bits.SC0_SC1 =
-			PICTURE_SCALING_UNIFORM;
+	hdmi_info->bits.SC0_SC1 = PICTURE_SCALING_UNIFORM;
 
 	/* S0, S1 : Underscan / Overscan */
 	/* TODO: un-hardcode scan type */
 	scan_type = SCANNING_TYPE_UNDERSCAN;
-	info_frame.avi_info_packet.info_packet_hdmi.bits.S0_S1 = scan_type;
+	hdmi_info->bits.S0_S1 = scan_type;
 
 	/* C0, C1 : Colorimetry */
 	if (color_space == COLOR_SPACE_YCBCR709 ||
 			color_space == COLOR_SPACE_YCBCR709_LIMITED)
-		info_frame.avi_info_packet.info_packet_hdmi.bits.C0_C1 =
-				COLORIMETRY_ITU709;
+		hdmi_info->bits.C0_C1 = COLORIMETRY_ITU709;
 	else if (color_space == COLOR_SPACE_YCBCR601 ||
 			color_space == COLOR_SPACE_YCBCR601_LIMITED)
-		info_frame.avi_info_packet.info_packet_hdmi.bits.C0_C1 =
-				COLORIMETRY_ITU601;
+		hdmi_info->bits.C0_C1 = COLORIMETRY_ITU601;
 	else {
 		if (stream->public.timing.pixel_encoding != PIXEL_ENCODING_RGB)
 			BREAK_TO_DEBUGGER();
-		info_frame.avi_info_packet.info_packet_hdmi.bits.C0_C1 =
-				COLORIMETRY_NO_DATA;
+		hdmi_info->bits.C0_C1 = COLORIMETRY_NO_DATA;
 	}
 	if (color_space == COLOR_SPACE_2020_RGB_FULLRANGE ||
 			color_space == COLOR_SPACE_2020_RGB_LIMITEDRANGE ||
 			color_space == COLOR_SPACE_2020_YCBCR) {
-		info_frame.avi_info_packet.info_packet_hdmi.bits.EC0_EC2 =
-				COLORIMETRYEX_BT2020RGBYCBCR;
-		info_frame.avi_info_packet.info_packet_hdmi.bits.C0_C1 =
-				COLORIMETRY_EXTENDED;
+		hdmi_info->bits.EC0_EC2 = COLORIMETRYEX_BT2020RGBYCBCR;
+		hdmi_info->bits.C0_C1   = COLORIMETRY_EXTENDED;
 	} else if (color_space == COLOR_SPACE_ADOBERGB) {
-		info_frame.avi_info_packet.info_packet_hdmi.bits.EC0_EC2 =
-				COLORIMETRYEX_ADOBERGB;
-		info_frame.avi_info_packet.info_packet_hdmi.bits.C0_C1 =
-				COLORIMETRY_EXTENDED;
+		hdmi_info->bits.EC0_EC2 = COLORIMETRYEX_ADOBERGB;
+		hdmi_info->bits.C0_C1   = COLORIMETRY_EXTENDED;
 	}
 
 	/* TODO: un-hardcode aspect ratio */
@@ -1609,93 +1597,76 @@ static void set_avi_info_frame(
 	switch (aspect) {
 	case ASPECT_RATIO_4_3:
 	case ASPECT_RATIO_16_9:
-		info_frame.avi_info_packet.info_packet_hdmi.bits.M0_M1 = aspect;
+		hdmi_info->bits.M0_M1 = aspect;
 		break;
 
 	case ASPECT_RATIO_NO_DATA:
 	case ASPECT_RATIO_64_27:
 	case ASPECT_RATIO_256_135:
 	default:
-		info_frame.avi_info_packet.info_packet_hdmi.bits.M0_M1 = 0;
+		hdmi_info->bits.M0_M1 = 0;
 	}
 
 	/* Active Format Aspect ratio - same as Picture Aspect Ratio. */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.R0_R3 =
-			ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE;
+	hdmi_info->bits.R0_R3 = ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE;
 
 	/* TODO: un-hardcode cn0_cn1 and itc */
 	cn0_cn1 = 0;
 	itc = false;
 
 	if (itc) {
-		info_frame.avi_info_packet.info_packet_hdmi.bits.ITC = 1;
-		info_frame.avi_info_packet.info_packet_hdmi.bits.CN0_CN1 =
-			cn0_cn1;
+		hdmi_info->bits.ITC     = 1;
+		hdmi_info->bits.CN0_CN1 = cn0_cn1;
 	}
 
 	/* TODO : We should handle YCC quantization */
 	/* but we do not have matrix calculation */
 	if (color_space == COLOR_SPACE_SRGB) {
-		info_frame.avi_info_packet.info_packet_hdmi.bits.Q0_Q1 =
-						RGB_QUANTIZATION_FULL_RANGE;
-		info_frame.avi_info_packet.info_packet_hdmi.bits.YQ0_YQ1 =
-						YYC_QUANTIZATION_FULL_RANGE;
+		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_FULL_RANGE;
+		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_FULL_RANGE;
 	} else if (color_space == COLOR_SPACE_SRGB_LIMITED) {
-		info_frame.avi_info_packet.info_packet_hdmi.bits.Q0_Q1 =
-						RGB_QUANTIZATION_LIMITED_RANGE;
-		info_frame.avi_info_packet.info_packet_hdmi.bits.YQ0_YQ1 =
-						YYC_QUANTIZATION_LIMITED_RANGE;
+		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_LIMITED_RANGE;
+		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
 	} else {
-		info_frame.avi_info_packet.info_packet_hdmi.bits.Q0_Q1 =
-						RGB_QUANTIZATION_DEFAULT_RANGE;
-		info_frame.avi_info_packet.info_packet_hdmi.bits.YQ0_YQ1 =
-						YYC_QUANTIZATION_LIMITED_RANGE;
+		hdmi_info->bits.Q0_Q1   = RGB_QUANTIZATION_DEFAULT_RANGE;
+		hdmi_info->bits.YQ0_YQ1 = YYC_QUANTIZATION_LIMITED_RANGE;
 	}
 
-	info_frame.avi_info_packet.info_packet_hdmi.bits.VIC0_VIC7 =
+	hdmi_info->bits.VIC0_VIC7 =
 					stream->public.timing.vic;
 
 	/* pixel repetition
 	 * PR0 - PR3 start from 0 whereas pHwPathMode->mode.timing.flags.pixel
 	 * repetition start from 1 */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.PR0_PR3 = 0;
+	hdmi_info->bits.PR0_PR3 = 0;
 
 	/* Bar Info
 	 * barTop:    Line Number of End of Top Bar.
 	 * barBottom: Line Number of Start of Bottom Bar.
 	 * barLeft:   Pixel Number of End of Left Bar.
 	 * barRight:  Pixel Number of Start of Right Bar. */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.bar_top =
-			stream->public.timing.v_border_top;
-	info_frame.avi_info_packet.info_packet_hdmi.bits.bar_bottom =
-		(stream->public.timing.v_border_top
+	hdmi_info->bits.bar_top = stream->public.timing.v_border_top;
+	hdmi_info->bits.bar_bottom = (stream->public.timing.v_border_top
 			- stream->public.timing.v_border_bottom + 1);
-	info_frame.avi_info_packet.info_packet_hdmi.bits.bar_left =
-			stream->public.timing.h_border_left;
-	info_frame.avi_info_packet.info_packet_hdmi.bits.bar_right =
-		(stream->public.timing.h_total
+	hdmi_info->bits.bar_left  = stream->public.timing.h_border_left;
+	hdmi_info->bits.bar_right = (stream->public.timing.h_total
 			- stream->public.timing.h_border_right + 1);
 
 	/* check_sum - Calculate AFMT_AVI_INFO0 ~ AFMT_AVI_INFO3 */
-	check_sum =
-		&info_frame.
-		avi_info_packet.info_packet_hdmi.packet_raw_data.sb[0];
+	check_sum = &info_frame.avi_info_packet.info_packet_hdmi.packet_raw_data.sb[0];
+
 	*check_sum = HDMI_INFOFRAME_TYPE_AVI + HDMI_AVI_INFOFRAME_SIZE + 2;
 
 	for (byte_index = 1; byte_index <= HDMI_AVI_INFOFRAME_SIZE; byte_index++)
-		*check_sum += info_frame.avi_info_packet.info_packet_hdmi.
-				packet_raw_data.sb[byte_index];
+		*check_sum += hdmi_info->packet_raw_data.sb[byte_index];
 
 	/* one byte complement */
 	*check_sum = (uint8_t) (0x100 - *check_sum);
 
 	/* Store in hw_path_mode */
-	info_packet->hb0 =
-		info_frame.avi_info_packet.info_packet_hdmi.packet_raw_data.hb0;
-	info_packet->hb1 =
-		info_frame.avi_info_packet.info_packet_hdmi.packet_raw_data.hb1;
-	info_packet->hb2 =
-		info_frame.avi_info_packet.info_packet_hdmi.packet_raw_data.hb2;
+	info_packet->hb0 = hdmi_info->packet_raw_data.hb0;
+	info_packet->hb1 = hdmi_info->packet_raw_data.hb1;
+	info_packet->hb2 = hdmi_info->packet_raw_data.hb2;
 
 	for (byte_index = 0; byte_index < sizeof(info_frame.avi_info_packet.
 				info_packet_hdmi.packet_raw_data.sb); byte_index++)
-- 
2.11.0

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

  parent reply	other threads:[~2017-04-03 23:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 23:07 [PATCH 00/16] DC Patches Apr 3, 2017 Harry Wentland
     [not found] ` <20170403230730.9884-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2017-04-03 23:07   ` [PATCH 01/16] drm/amd/display: decouple per-crtc-plane model Harry Wentland
2017-04-03 23:07   ` [PATCH 02/16] drm/amd/display: Fix cleanup in amdgpu_dm_initialize_drm_device Harry Wentland
2017-04-03 23:07   ` [PATCH 03/16] drm/amd/display: update plane functionalities Harry Wentland
2017-04-03 23:07   ` [PATCH 04/16] drm/amd/display: remove surface validation against stream rect Harry Wentland
2017-04-03 23:07   ` Harry Wentland [this message]
2017-04-03 23:07   ` [PATCH 06/16] drm/amd/display: Temporary disable PSR for HBR2 & HBR3 Harry Wentland
2017-04-03 23:07   ` [PATCH 07/16] drm/amd/display: fix dce_calc surface pitch setting for non underlay pipes Harry Wentland
2017-04-03 23:07   ` [PATCH 08/16] drm/amd/display: Remove get_connector_for_link Harry Wentland
2017-04-03 23:07   ` [PATCH 09/16] drm/amd/display: Remove get_connector_for_sink Harry Wentland
2017-04-03 23:07   ` [PATCH 10/16] drm/amd/display: Fix i2c write flag Harry Wentland
2017-04-03 23:07   ` [PATCH 11/16] drm/amd/display: Refactor edid read Harry Wentland
2017-04-03 23:07   ` [PATCH 12/16] drm/amd/display: PSR Aux Channel and Static Screen Support Fix Harry Wentland
2017-04-03 23:07   ` [PATCH 13/16] drm/amd/display: Fill in vrefresh and min_vblank_time for dce8/dce10 Harry Wentland
2017-04-03 23:07   ` [PATCH 14/16] drm/amd/display: Ignore visible flag when check surface update type Harry Wentland
2017-04-03 23:07   ` [PATCH 15/16] drm/amd/display: Log clock source in error condition Harry Wentland
2017-04-03 23:07   ` [PATCH 16/16] drm/amd/display: Fix s3 hang on resume Harry Wentland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170403230730.9884-6-harry.wentland@amd.com \
    --to=harry.wentland-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=reza.amini-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.