diff mbox series

[09/18] drm/vc4: hdmi: Remove limited_rgb_range

Message ID 20210317154352.732095-10-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series drm/vc4: hdmi: Add Support for the YUV output | expand

Commit Message

Maxime Ripard March 17, 2021, 3:43 p.m. UTC
The limited_rgb_range field in the vc4_hdmi_encoder structure is used to
tell whether we're supposed to output with a full or limited RGB range.

This is redundant with the new helper we introduced, so let's convert to
that helper and drop that field.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 21 +++++----------------
 drivers/gpu/drm/vc4/vc4_hdmi.h |  1 -
 2 files changed, 5 insertions(+), 17 deletions(-)

Comments

Thomas Zimmermann April 12, 2021, 10:19 a.m. UTC | #1
Am 17.03.21 um 16:43 schrieb Maxime Ripard:
> The limited_rgb_range field in the vc4_hdmi_encoder structure is used to
> tell whether we're supposed to output with a full or limited RGB range.
> 
> This is redundant with the new helper we introduced, so let's convert to
> that helper and drop that field.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/vc4/vc4_hdmi.c | 21 +++++----------------
>   drivers/gpu/drm/vc4/vc4_hdmi.h |  1 -
>   2 files changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index bb2fffa2d495..8f0af246f18f 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -384,7 +384,6 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder,
>   static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
>   {
>   	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
> -	struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
>   	struct drm_connector *connector = &vc4_hdmi->connector;
>   	struct drm_connector_state *cstate = connector->state;
>   	struct drm_crtc *crtc = encoder->crtc;
> @@ -401,9 +400,9 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
>   
>   	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
>   					   connector, mode,
> -					   vc4_encoder->limited_rgb_range ?
> -					   HDMI_QUANTIZATION_RANGE_LIMITED :
> -					   HDMI_QUANTIZATION_RANGE_FULL);
> +					   vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode) ?
> +					   HDMI_QUANTIZATION_RANGE_FULL :
> +					   HDMI_QUANTIZATION_RANGE_LIMITED);
>   
>   	drm_hdmi_avi_infoframe_bars(&frame.avi, cstate);
>   
> @@ -841,20 +840,10 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
>   					     struct drm_atomic_state *state)
>   {
>   	struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
> -	struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
>   	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
>   
> -	if (vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode) {
> -		if (vc4_hdmi->variant->csc_setup)
> -			vc4_hdmi->variant->csc_setup(vc4_hdmi, mode);
> -
> -		vc4_encoder->limited_rgb_range = true;
> -	} else {
> -		if (vc4_hdmi->variant->csc_setup)
> -			vc4_hdmi->variant->csc_setup(vc4_hdmi, mode);
> -
> -		vc4_encoder->limited_rgb_range = false;
> -	}
> +	if (vc4_hdmi->variant->csc_setup)
> +		vc4_hdmi->variant->csc_setup(vc4_hdmi, mode);
>   
>   	HDMI_WRITE(HDMI_FIFO_CTL, VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N);
>   }
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
> index 3d88261d463e..8e42f9e7b3e2 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.h
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
> @@ -12,7 +12,6 @@
>   struct vc4_hdmi_encoder {
>   	struct vc4_encoder base;
>   	bool hdmi_monitor;
> -	bool limited_rgb_range;
>   };
>   
>   static inline struct vc4_hdmi_encoder *
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index bb2fffa2d495..8f0af246f18f 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -384,7 +384,6 @@  static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder,
 static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 {
 	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
-	struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
 	struct drm_connector *connector = &vc4_hdmi->connector;
 	struct drm_connector_state *cstate = connector->state;
 	struct drm_crtc *crtc = encoder->crtc;
@@ -401,9 +400,9 @@  static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
 
 	drm_hdmi_avi_infoframe_quant_range(&frame.avi,
 					   connector, mode,
-					   vc4_encoder->limited_rgb_range ?
-					   HDMI_QUANTIZATION_RANGE_LIMITED :
-					   HDMI_QUANTIZATION_RANGE_FULL);
+					   vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode) ?
+					   HDMI_QUANTIZATION_RANGE_FULL :
+					   HDMI_QUANTIZATION_RANGE_LIMITED);
 
 	drm_hdmi_avi_infoframe_bars(&frame.avi, cstate);
 
@@ -841,20 +840,10 @@  static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
 					     struct drm_atomic_state *state)
 {
 	struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
-	struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
 	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
 
-	if (vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode) {
-		if (vc4_hdmi->variant->csc_setup)
-			vc4_hdmi->variant->csc_setup(vc4_hdmi, mode);
-
-		vc4_encoder->limited_rgb_range = true;
-	} else {
-		if (vc4_hdmi->variant->csc_setup)
-			vc4_hdmi->variant->csc_setup(vc4_hdmi, mode);
-
-		vc4_encoder->limited_rgb_range = false;
-	}
+	if (vc4_hdmi->variant->csc_setup)
+		vc4_hdmi->variant->csc_setup(vc4_hdmi, mode);
 
 	HDMI_WRITE(HDMI_FIFO_CTL, VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N);
 }
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index 3d88261d463e..8e42f9e7b3e2 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -12,7 +12,6 @@ 
 struct vc4_hdmi_encoder {
 	struct vc4_encoder base;
 	bool hdmi_monitor;
-	bool limited_rgb_range;
 };
 
 static inline struct vc4_hdmi_encoder *