Re: [RESEND v2 1/2] drm/i915: Add connector property to limit max bpc

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

 



On Fri, Nov 10, 2017 at 07:47:46PM +0000, Sripada, Radhakrishna wrote:
> 
> 
> > -----Original Message-----
> > From: Vivi, Rodrigo
> > Sent: Thursday, November 9, 2017 1:25 PM
> > To: Sripada, Radhakrishna <radhakrishna.sripada@xxxxxxxxx>
> > Cc: intel-gfx@xxxxxxxxxxxxxxxxxxxxx; Zanoni, Paulo R
> > <paulo.r.zanoni@xxxxxxxxx>
> > Subject: Re:  [RESEND v2 1/2] drm/i915: Add connector property to
> > limit max bpc
> > 
> > On Thu, Nov 09, 2017 at 12:31:51AM +0000, Radhakrishna Sripada wrote:
> > > From: "Sripada, Radhakrishna" <radhakrishna.sripada@xxxxxxxxx>
> > >
> > > At times 12bpc HDMI cannot be driven due to faulty cables, dongles
> > > level shifters etc. To workaround them we may need to drive the output
> > > at a lower bpc. Currently the user space does not have a way to limit
> > > the bpc. The default bpc to be programmed is decided by the driver and
> > > is run against connector limitations.
> > >
> > > Creating a new connector property "max bpc" in order to limit the bpc
> > > with which the pixels are scanned out. xrandr can make use of this
> > > connector property to make sure that bpc does not exceed the configured
> > value.
> > 
> > I wonder if this case qualifies to "Linux is not about choice"...
> When we are dealing with faulty hardware like cables/dongles/level-shifters we would need a quirk
> to try falling back to a lower bpc and drive the output.  However we set the default to the maximum 
> possible value that the driver is anyway currently doing. Is there an alternative that you would suggest 
> in this case?

We deal with so may faulty stuff already... But it is "better" when we do in a
broader way without exposing an stable api that we have to maintain forever
because few bad cables and dongles out there.

> 
> > 
> > Or all test cases we already have in place would cover all possible
> > combinations in CI to avoid dealing with future regressions.
> > 
> > >
> > > V2: Initialize max_bpc to satisfy kms_properties
> > >
> > > Suggested-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> > > Cc: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>
> > > Cc: Manasi Navare <manasi.d.navare@xxxxxxxxx>
> > > Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@xxxxxxxxx>
> > > ---
> > >  drivers/gpu/drm/i915/i915_drv.h     |  1 +
> > >  drivers/gpu/drm/i915/intel_atomic.c |  7 +++++++
> > >  drivers/gpu/drm/i915/intel_drv.h    |  2 ++
> > >  drivers/gpu/drm/i915/intel_hdmi.c   | 11 +++++++++++
> > >  drivers/gpu/drm/i915/intel_modes.c  | 19 +++++++++++++++++++
> > >  5 files changed, 40 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > b/drivers/gpu/drm/i915/i915_drv.h
> > > index fe93115c4caa..9642bc4b7a0b 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -2477,6 +2477,7 @@ struct drm_i915_private {
> > >
> > >  	struct drm_property *broadcast_rgb_property;
> > >  	struct drm_property *force_audio_property;
> > > +	struct drm_property *max_bpc_property;
> > >
> > >  	/* hda/i915 audio component */
> > >  	struct i915_audio_component *audio_component;
> > > diff --git a/drivers/gpu/drm/i915/intel_atomic.c
> > b/drivers/gpu/drm/i915/intel_atomic.c
> > > index 36d4e635e4ce..d6d836ea1a7f 100644
> > > --- a/drivers/gpu/drm/i915/intel_atomic.c
> > > +++ b/drivers/gpu/drm/i915/intel_atomic.c
> > > @@ -58,6 +58,8 @@ int
> > intel_digital_connector_atomic_get_property(struct drm_connector
> > *connector,
> > >  		*val = intel_conn_state->force_audio;
> > >  	else if (property == dev_priv->broadcast_rgb_property)
> > >  		*val = intel_conn_state->broadcast_rgb;
> > > +	else if (property == dev_priv->max_bpc_property)
> > > +		*val = intel_conn_state->max_bpc;
> > >  	else {
> > >  		DRM_DEBUG_ATOMIC("Unknown property %s\n",
> > property->name);
> > >  		return -EINVAL;
> > > @@ -95,6 +97,11 @@ int
> > intel_digital_connector_atomic_set_property(struct drm_connector
> > *connector,
> > >  		return 0;
> > >  	}
> > >
> > > +	if (property == dev_priv->max_bpc_property) {
> > > +		intel_conn_state->max_bpc = val;
> > > +		return 0;
> > > +	}
> > > +
> > >  	DRM_DEBUG_ATOMIC("Unknown property %s\n", property-
> > >name);
> > >  	return -EINVAL;
> > >  }
> > > diff --git a/drivers/gpu/drm/i915/intel_drv.h
> > b/drivers/gpu/drm/i915/intel_drv.h
> > > index 00b488688042..9004a1ee1e99 100644
> > > --- a/drivers/gpu/drm/i915/intel_drv.h
> > > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > > @@ -340,6 +340,7 @@ struct intel_digital_connector_state {
> > >
> > >  	enum hdmi_force_audio force_audio;
> > >  	int broadcast_rgb;
> > > +	int max_bpc;
> > >  };
> > >
> > >  #define to_intel_digital_connector_state(x) container_of(x, struct
> > intel_digital_connector_state, base)
> > > @@ -1704,6 +1705,7 @@ int intel_ddc_get_modes(struct drm_connector
> > *c, struct i2c_adapter *adapter);
> > >  void intel_attach_force_audio_property(struct drm_connector
> > *connector);
> > >  void intel_attach_broadcast_rgb_property(struct drm_connector
> > *connector);
> > >  void intel_attach_aspect_ratio_property(struct drm_connector
> > *connector);
> > > +void intel_attach_max_bpc_property(struct drm_connector *connector,
> > int min, int max);
> > >
> > >
> > >  /* intel_overlay.c */
> > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> > b/drivers/gpu/drm/i915/intel_hdmi.c
> > > index fa1c793a21ef..4a5dda8aa8c3 100644
> > > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > > @@ -1808,10 +1808,21 @@ static const struct drm_encoder_funcs
> > intel_hdmi_enc_funcs = {
> > >  static void
> > >  intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct
> > drm_connector *connector)
> > >  {
> > > +	struct drm_i915_private *dev_priv = to_i915(connector->dev);
> > > +
> > >  	intel_attach_force_audio_property(connector);
> > >  	intel_attach_broadcast_rgb_property(connector);
> > >  	intel_attach_aspect_ratio_property(connector);
> > >  	connector->state->picture_aspect_ratio =
> > HDMI_PICTURE_ASPECT_NONE;
> > > +
> > > +	if ((IS_G4X(dev_priv) || IS_VALLEYVIEW(dev_priv) ||
> > > +	    IS_CHERRYVIEW(dev_priv))) {
> > > +		intel_attach_max_bpc_property(connector, 8, 10);
> > > +		to_intel_digital_connector_state(connector->state)-
> > >max_bpc = 10;
> > > +	} else if (INTEL_GEN(dev_priv) >= 5) {
> > > +		intel_attach_max_bpc_property(connector, 8, 12);
> > > +		to_intel_digital_connector_state(connector->state)-
> > >max_bpc = 12;
> > > +	}
> > >  }
> > >
> > >  /*
> > > diff --git a/drivers/gpu/drm/i915/intel_modes.c
> > b/drivers/gpu/drm/i915/intel_modes.c
> > > index 4e43f873c889..8357e494e911 100644
> > > --- a/drivers/gpu/drm/i915/intel_modes.c
> > > +++ b/drivers/gpu/drm/i915/intel_modes.c
> > > @@ -150,3 +150,22 @@ intel_attach_aspect_ratio_property(struct
> > drm_connector *connector)
> > >  			connector->dev-
> > >mode_config.aspect_ratio_property,
> > >  			DRM_MODE_PICTURE_ASPECT_NONE);
> > >  }
> > > +
> > > +void
> > > +intel_attach_max_bpc_property(struct drm_connector *connector, int
> > min, int max)
> > > +{
> > > +	struct drm_device *dev = connector->dev;
> > > +	struct drm_i915_private *dev_priv = to_i915(dev);
> > > +	struct drm_property *prop;
> > > +
> > > +	prop = dev_priv->max_bpc_property;
> > > +	if (prop == NULL) {
> > > +		prop = drm_property_create_range(dev, 0, "max bpc", min,
> > max);
> > > +		if (prop == NULL)
> > > +			return;
> > > +
> > > +		dev_priv->max_bpc_property = prop;
> > > +	}
> > > +
> > > +	drm_object_attach_property(&connector->base, prop, max);
> > > +}
> > > --
> > > 2.9.3
> > >
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux