Re: [PATCH v2 4/4] drm/i915: Use luminance range calculated during edid parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Jun 2022, Jouni Högander <jouni.hogander@xxxxxxxxx> 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@xxxxxxxxxx>
> Cc: Mika Kahola <mika.kahola@xxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Cc: Manasi Navare <manasi.d.navare@xxxxxxxxx>
> Signed-off-by: Jouni Högander <jouni.hogander@xxxxxxxxx>
> ---
>  .../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;

-- 
Jani Nikula, Intel Open Source Graphics Center




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux