Re: [PATCH] HACK: drm: Allow encoders to be reenabled

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

 



On Thu, Nov 08, 2012 at 12:48:18PM -0500, Alex Deucher wrote:
> On Wed, Nov 7, 2012 at 5:06 PM, Thierry Reding
> <thierry.reding@xxxxxxxxxxxxxxxxx> wrote:
> > When running the xf86-video-modesetting driver on top of a KMS driver,
> > leaving X causes the active encoder's DPMS mode to be set to off by the
> > drm_crtc_helper_disable() function. This doesn't set the connector's
> > DPMS mode to off, however, which results in subsequent calls to the
> > drm_helper_connector_dpms() function to not enable the encoder because
> > the connector's DPMS mode hasn't changed.
> >
> > This patch works around this by forcing the connector's DPMS mode to off
> > if the encoder has changed, which always happens when a new mode is set
> > after drm_crtc_helper_disable(). The code that sets the connector DPMS
> > mode to on will then also enable the CRTC and encoder because the mode
> > actually changed.
> >
> > Signed-off-by: Thierry Reding <thierry.reding@xxxxxxxxxxxxxxxxx>
> 
> Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

This is really much uglier than I would have liked, but I honestly can't
think of any better way that would be this easy to implement. An
alternative solution would be to add dpms fields to both drm_crtc and
drm_encoder structures and modify drm_helper_connector_dpms() to run the
CRTC's and encoder's .dpms() functions if the new mode is different from
that stored in the respective dpms fields. Coding that, however, will
probably be more involved and more likely to introduce errors somewhere
else because of the extra accounting required.

In case this workaround isn't acceptable I can take a look at coding up
a cleaner fix.

Thierry

> > ---
> >  drivers/gpu/drm/drm_crtc_helper.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
> > index 1227adf..1b5ebf1 100644
> > --- a/drivers/gpu/drm/drm_crtc_helper.c
> > +++ b/drivers/gpu/drm/drm_crtc_helper.c
> > @@ -649,6 +649,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
> >                          */
> >                         if (connector->encoder)
> >                                 connector->encoder->crtc = NULL;
> > +                       /*
> > +                        * HACK: Force DPMS mode to off so that the encoder
> > +                        * has a chance of being reenabled along with the
> > +                        * connector later on.
> > +                        */
> > +                       connector->dpms = DRM_MODE_DPMS_OFF;
> >                         connector->encoder = new_encoder;
> >                 }
> >         }
> > --
> > 1.8.0
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@xxxxxxxxxxxxxxxxxxxxx
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 

Attachment: pgpZ4YJDArTBU.pgp
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[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