Message ID | 20220620072019.2710652-5-jouni.hogander@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | HDR aux backlight range calculation | expand |
On Mon, 20 Jun 2022, Jouni Högander <jouni.hogander@intel.com> wrote: > Instead of using fixed 0 - 512 range use luminance range calculated > as a part of edid parsing. As a backup fall back to static 0 - 512. > > v2: Use values calculated during edid parsing > > Cc: Lyude Paul <lyude@redhat.com> > Cc: Mika Kahola <mika.kahola@intel.com> > Cc: Jani Nikula <jani.nikula@intel.com> > Cc: Manasi Navare <manasi.d.navare@intel.com> > Signed-off-by: Jouni Högander <jouni.hogander@intel.com> > --- > .../drm/i915/display/intel_dp_aux_backlight.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > 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 c92d5bb2326a..b2666bd67701 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c > @@ -276,8 +276,11 @@ intel_dp_aux_hdr_disable_backlight(const struct drm_connector_state *conn_state, > static int > intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pipe) > { > - struct drm_i915_private *i915 = to_i915(connector->base.dev); > + struct drm_connector *conn_base = &connector->base; Nitpick, we never call this "conn_base". Usually we try to avoid having drm_connector as local variable altogether, but if you must, please name it _connector or drm_connector. > + struct drm_i915_private *i915 = to_i915(conn_base->dev); > struct intel_panel *panel = &connector->panel; > + struct drm_luminance_range_info *luminance_range = > + &conn_base->display_info.luminance_range; > int ret; > > if (panel->backlight.edp.intel.sdr_uses_aux) { > @@ -293,8 +296,16 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi > } > } > > - panel->backlight.max = 512; > - panel->backlight.min = 0; > + if (!luminance_range->max_luminance) { Nitpick, I kind of dislike these "if (!something) ... else ..." constructs when you could avoid the negative by switching it around. > + panel->backlight.max = 512; > + panel->backlight.min = 0; > + } else { > + panel->backlight.max = luminance_range->max_luminance; > + panel->backlight.min = luminance_range->min_luminance; > + } > + > + drm_dbg(&i915->drm, "Using range %d..%d\n", panel->backlight.min, panel->backlight.max); Please use drm_dbg_kms(). Please say *what* range this is. Otherwise, you have to figure it out from the context and function names. > + > panel->backlight.level = intel_dp_aux_hdr_get_backlight(connector, pipe); > panel->backlight.enabled = panel->backlight.level != 0;
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 c92d5bb2326a..b2666bd67701 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c @@ -276,8 +276,11 @@ intel_dp_aux_hdr_disable_backlight(const struct drm_connector_state *conn_state, static int intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pipe) { - struct drm_i915_private *i915 = to_i915(connector->base.dev); + struct drm_connector *conn_base = &connector->base; + struct drm_i915_private *i915 = to_i915(conn_base->dev); struct intel_panel *panel = &connector->panel; + struct drm_luminance_range_info *luminance_range = + &conn_base->display_info.luminance_range; int ret; if (panel->backlight.edp.intel.sdr_uses_aux) { @@ -293,8 +296,16 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi } } - panel->backlight.max = 512; - panel->backlight.min = 0; + if (!luminance_range->max_luminance) { + panel->backlight.max = 512; + panel->backlight.min = 0; + } else { + panel->backlight.max = luminance_range->max_luminance; + panel->backlight.min = luminance_range->min_luminance; + } + + drm_dbg(&i915->drm, "Using range %d..%d\n", panel->backlight.min, panel->backlight.max); + panel->backlight.level = intel_dp_aux_hdr_get_backlight(connector, pipe); panel->backlight.enabled = panel->backlight.level != 0;
Instead of using fixed 0 - 512 range use luminance range calculated as a part of edid parsing. As a backup fall back to static 0 - 512. v2: Use values calculated during edid parsing Cc: Lyude Paul <lyude@redhat.com> Cc: Mika Kahola <mika.kahola@intel.com> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Manasi Navare <manasi.d.navare@intel.com> Signed-off-by: Jouni Högander <jouni.hogander@intel.com> --- .../drm/i915/display/intel_dp_aux_backlight.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)