Skip to content

Commit 99d3e5c

Browse files
mripardpelwell
authored andcommitted
drm/vc4: hdmi: Add full range RGB helper
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. Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
1 parent 1d82e2f commit 99d3e5c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎drivers/gpu/drm/vc4/vc4_hdmi.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ static bool vc4_hdmi_mode_needs_scrambling(const struct drm_display_mode *mode)
108108
return (mode->clock * 1000) > HDMI_14_MAX_TMDS_CLK;
109109
}
110110

111+
static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi,
112+
const struct drm_display_mode *mode)
113+
{
114+
struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
115+
116+
return !vc4_encoder->hdmi_monitor ||
117+
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL;
118+
}
119+
111120
static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
112121
{
113122
struct drm_info_node *node = (struct drm_info_node *)m->private;
@@ -1115,8 +1124,7 @@ static void vc4_hdmi_encoder_pre_crtc_enable(struct drm_encoder *encoder,
11151124

11161125
mutex_lock(&vc4_hdmi->mutex);
11171126

1118-
if (vc4_encoder->hdmi_monitor &&
1119-
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) {
1127+
if (!vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode)) {
11201128
if (vc4_hdmi->variant->csc_setup)
11211129
vc4_hdmi->variant->csc_setup(vc4_hdmi, true);
11221130

0 commit comments

Comments
 (0)