[Intel-gfx] [PATCH v2 8/9] drm/dp: Release DP MST shared link bandwidth

Daniel Vetter daniel at ffwll.ch
Thu Jan 26 08:41:46 UTC 2017


On Wed, Jan 25, 2017 at 08:53:18PM +0000, Pandiyan, Dhinakaran wrote:
> On Wed, 2017-01-25 at 07:16 +0100, Daniel Vetter wrote:
> > On Tue, Jan 24, 2017 at 03:49:36PM -0800, Dhinakaran Pandiyan wrote:
> > > Implement the ->atomic_release() callback to release the shared link
> > > bandwidth that was originally acquired during compute_config()
> > > 
> > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_dp_mst.c | 28 ++++++++++++++++++++++++++++
> > >  1 file changed, 28 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> > > index f51574f..2f57a56 100644
> > > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > > @@ -78,6 +78,33 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
> > >  
> > >  }
> > >  
> > > +static void intel_dp_mst_atomic_release(struct drm_connector *connector,
> > > +					struct drm_connector_state *conn_state)
> > > +{
> > > +	struct intel_dp_mst_encoder *intel_mst;
> > > +	struct drm_dp_mst_topology_mgr *mgr;
> > > +	struct drm_dp_mst_topology_state *topology_state;
> > > +	struct drm_encoder *encoder;
> > > +	struct intel_connector *intel_connector = to_intel_connector(connector);
> > > +
> > > +	encoder = connector->state->best_encoder;
> > > +	if (!encoder || to_intel_encoder(encoder)->type != INTEL_OUTPUT_DP_MST)
> > > +		return;
> > 
> > NULL encoder should imo be caught in core. Type != DP_MST is impossible,
> > if you're unsure make it into a BUG_ON for testing.
> 
> 
> I don't get why (type != INTEL_OUTPUT_DP_MST) is impossible. Is that
> because we have the implementation for atomic_release() only for MST
> connectors? But, that is only for now.

Yes. And if we add atomic_release for other encoders, then ofcourse we
will not reuse the mst one there. See all the other intel_dp_mst_* hooks
in the same vfunc table, those also don't check for the encoder type. This
would be like doing a runtime type check in C++ for the "this" pointer :-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list