From: Thierry Reding Subject: Re: [PATCH] HACK: drm: Allow encoders to be reenabled Date: Thu, 8 Nov 2012 20:01:57 +0100 Message-ID: <20121108190157.GA9367@avionic-0098.mockup.avionic-design.de> References: <1352326005-7215-1-git-send-email-thierry.reding@avionic-design.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0174502321==" Return-path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by gabe.freedesktop.org (Postfix) with ESMTP id EA2B7A0ACC for ; Thu, 8 Nov 2012 11:02:02 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Alex Deucher Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0174502321== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ew6BAiZeqk4r7MaW" Content-Disposition: inline --ew6BAiZeqk4r7MaW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 08, 2012 at 12:48:18PM -0500, Alex Deucher wrote: > On Wed, Nov 7, 2012 at 5:06 PM, Thierry Reding > 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 >=20 > Reviewed-by: Alex Deucher 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_cr= tc_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 =3D NULL; > > + /* > > + * HACK: Force DPMS mode to off so that the enc= oder > > + * has a chance of being reenabled along with t= he > > + * connector later on. > > + */ > > + connector->dpms =3D DRM_MODE_DPMS_OFF; > > connector->encoder =3D new_encoder; > > } > > } > > -- > > 1.8.0 > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/dri-devel >=20 >=20 --ew6BAiZeqk4r7MaW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQIcBAEBAgAGBQJQnAGlAAoJEN0jrNd/PrOhd3IP/R5EYwXobp4/IBFYKRAwXS6t OpYjWRLHxqD/8RwK9tFaKY6mZ8jYssI4ns7t+hecriZYsBPfJmxHVbs+5rlu4oRe 8flgIZGHNOhU76NLsjaltVDyU5erzNtUeycorRoMWY6L6U6Nw3rFD2MLIiLZuwMh wwo9/4un36WOwd3YpKBRnXxqXuC2lWTyg+jF/1GPpF3HSpfAeSc+avX55eCaoMFD eMdf1aLq+aJkax9Uw1TOLLlNP1s+6kO3IxnvDZZezsl26dL37JLzFyY2rXnCl4OR pe9mGPuMHHGU5tf/ApdzQs/ylhMxYP4PN7y+++pl/a/k3KpySvuI8xGS/dVQZ+NP mAMhvX0J5HfsPmToKndPqK9mdQYQGnhTjGU6lvfodSzUuTm/ZtX/jSy2RAzj2QsS 07jLcJOEK1p31FysmfSDOeOwP/Uolomugl1AywzM+73OvAyYoBQMOf05KR47TyuH DUVFmdsBAVOtamB1sW9C4x7fFrC/e88fCmgtZ4ykZeTAJWh6zqrhtOytBDuncNzt bTqBEnrjH+KqFkB5GPSAonyAD79WDL/ytqSlcOoVAH7K6kNjnaWP+JJ/FtbLwBSz GQmQ3NTmiVdqKsE9kKK42XXL+5shrL6gEgIB7VbrzJjzc4r30AZFpm1JoSes4cXh T5VFk76TT/aD41X3Svni =t7mE -----END PGP SIGNATURE----- --ew6BAiZeqk4r7MaW-- --===============0174502321== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0174502321==--