diff mbox series

[3/3] drm/i915: Use luminance range from static hdr metadata

Message ID 20220426123044.320415-4-jouni.hogander@intel.com (mailing list archive)
State New, archived
Headers show
Series HDR aux backlight range calculation | expand

Commit Message

Hogander, Jouni April 26, 2022, 12:30 p.m. UTC
Instead of using fixed 0 - 512 range use
drm_luminance_range_from_static_hdr_metadata to obtain panel range. If
that fails fall back to static 0 - 512.

Cc: Lyude Paul <lyude@redhat.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
index fb6cf30ee628..6673af455808 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
@@ -293,8 +293,13 @@  intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi
 		}
 	}
 
-	panel->backlight.max = 512;
-	panel->backlight.min = 0;
+	if (!drm_luminance_range_from_static_hdr_metadata(&connector->base,
+							  &panel->backlight.min,
+							  &panel->backlight.max)) {
+		drm_err(&i915->drm, "No backlight range data in static hdr metadata, using fixed 0,512\n");
+		panel->backlight.max = 512;
+		panel->backlight.min = 0;
+	}
 	panel->backlight.level = intel_dp_aux_hdr_get_backlight(connector, pipe);
 	panel->backlight.enabled = panel->backlight.level != 0;