From: Thierry Reding Subject: [PATCH] HACK: drm: Allow encoders to be reenabled Date: Wed, 7 Nov 2012 23:06:45 +0100 Message-ID: <1352326005-7215-1-git-send-email-thierry.reding@avionic-design.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by gabe.freedesktop.org (Postfix) with ESMTP id B22929E744 for ; Wed, 7 Nov 2012 14:06:48 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mailbox.adnet.avionic-design.de (Postfix) with ESMTP id E32422A282E5 for ; Wed, 7 Nov 2012 23:06:46 +0100 (CET) Received: from mailbox.adnet.avionic-design.de ([127.0.0.1]) by localhost (mailbox.avionic-design.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H1XE-Bj+xq7G for ; Wed, 7 Nov 2012 23:06:46 +0100 (CET) Received: from mailman.adnet.avionic-design.de (mailman.adnet.avionic-design.de [172.20.31.172]) by mailbox.adnet.avionic-design.de (Postfix) with ESMTP id 0762B2A28173 for ; Wed, 7 Nov 2012 23:06:46 +0100 (CET) Received: from localhost (avionic-0098.adnet.avionic-design.de [172.20.31.233]) by mailman.adnet.avionic-design.de (Postfix) with ESMTP id 9181E10055A for ; Wed, 7 Nov 2012 23:06:41 +0100 (CET) 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: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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 --- 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