950-0624-drm-vc4-hdmi-Add-full-range-RGB-helper.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 4809cf80fdd964c413045e550fb137a18dc98ba2 Mon Sep 17 00:00:00 2001
  2. From: Maxime Ripard <[email protected]>
  3. Date: Tue, 12 Jan 2021 15:55:07 +0100
  4. Subject: [PATCH] drm/vc4: hdmi: Add full range RGB helper
  5. We're going to need to tell whether we want to run with a full or
  6. limited range RGB output in multiple places in the code, so let's create
  7. a helper that will return whether we need with full range or not.
  8. Acked-by: Thomas Zimmermann <[email protected]>
  9. Signed-off-by: Maxime Ripard <[email protected]>
  10. ---
  11. drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++--
  12. 1 file changed, 10 insertions(+), 2 deletions(-)
  13. --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
  14. +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
  15. @@ -108,6 +108,15 @@ static bool vc4_hdmi_mode_needs_scrambli
  16. return (mode->clock * 1000) > HDMI_14_MAX_TMDS_CLK;
  17. }
  18. +static bool vc4_hdmi_is_full_range_rgb(struct vc4_hdmi *vc4_hdmi,
  19. + const struct drm_display_mode *mode)
  20. +{
  21. + struct vc4_hdmi_encoder *vc4_encoder = &vc4_hdmi->encoder;
  22. +
  23. + return !vc4_encoder->hdmi_monitor ||
  24. + drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_FULL;
  25. +}
  26. +
  27. static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused)
  28. {
  29. struct drm_info_node *node = (struct drm_info_node *)m->private;
  30. @@ -1117,8 +1126,7 @@ static void vc4_hdmi_encoder_pre_crtc_en
  31. mutex_lock(&vc4_hdmi->mutex);
  32. - if (vc4_encoder->hdmi_monitor &&
  33. - drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) {
  34. + if (!vc4_hdmi_is_full_range_rgb(vc4_hdmi, mode)) {
  35. if (vc4_hdmi->variant->csc_setup)
  36. vc4_hdmi->variant->csc_setup(vc4_hdmi, true);