Am 17.03.21 um 16:43 schrieb Maxime Ripard: > We're going to need to tell whether we want to run with a full or > limited range RGB output in multiple places in the code, so let's create > a helper that will return whether we need with full range or not. > > Signed-off-by: Maxime Ripard Acked-by: Thomas Zimmermann although with a comments > --- > drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index eee9751009c2..fc545072b173 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -95,6 +95,15 @@ > > #define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) > > +static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi, > + const struct drm_display_mode *mode) > +{ > + struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder; > + > + return !vc4_encoder->hdmi_monitor || Is this ever being called from non-HDMI code? If not, I'd put an drm_WARN_ONCE around this check. > + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL; > +} > + > static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) > { > struct drm_info_node *node = (struct drm_info_node *)m->private; > @@ -833,8 +842,7 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder, > struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); > struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); > > - if (vc4_encoder->hdmi_monitor && > - drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) { > + if (vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode) { > if (vc4_hdmi->variant->csc_setup) > vc4_hdmi->variant->csc_setup(vc4_hdmi, true); > > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer