From: Daniel Vetter Subject: Re: [PATCH V2] drm/i915: force full modeset if the connector is in DPMS OFF mode Date: Tue, 21 May 2013 18:44:11 +0200 Message-ID: <20130521164411.GN12292@phenom.ffwll.local> References: <20130503174008.GF17947@debian> <1367603047-6570-1-git-send-email-eich@suse.de> <20130520141322.44770b62@jbarnes-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 79C9EE5ECA for ; Tue, 21 May 2013 09:44:16 -0700 (PDT) Received: by mail-we0-f182.google.com with SMTP id q57so206968wes.41 for ; Tue, 21 May 2013 09:44:15 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130520141322.44770b62@jbarnes-desktop> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Jesse Barnes Cc: Egbert Eich , intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Mon, May 20, 2013 at 02:13:22PM -0700, Jesse Barnes wrote: > On Fri, 3 May 2013 19:44:07 +0200 > Egbert Eich wrote: > > > From: Imre Deak > > > > Currently the driver's assumed behavior for a modeset with an attached > > FB is that the corresponding connector will be switched to DPMS ON mode > > if it happened to be in DPMS OFF (or another power save mode). This > > wasn't enforced though if only the FB changed, everything else (format, > > connector etc.) remaining the same. In this case we only set the new FB > > base and left the connector in the old power save mode. > > > > Fix this by forcing a full modeset whenever there is an attached FB and > > any affected connector is in a power save mode. > > > > V_2: Run the test for encoders in power save mode outside the the > > test for fb change: user space may have just disabled the encoders > > but left everything else in place. Make sure the connector list is > > not empty before running this test. > > > > Signed-off-by: Imre Deak > > Signed-off-by: Egbert Eich > > --- > > drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++++++++++++-- > > 1 file changed, 22 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > > index 2939524..992d469 100644 > > --- a/drivers/gpu/drm/i915/intel_display.c > > +++ b/drivers/gpu/drm/i915/intel_display.c > > @@ -8380,6 +8380,21 @@ static void intel_set_config_restore_state(struct drm_device *dev, > > } > > } > > > > +static bool > > +connector_off(struct drm_crtc *crtc, struct drm_connector *connectors, > > + int num_connectors) > > +{ > > + int i; > > + > > + for (i = 0; i < num_connectors; i++) > > + if (connectors[i].encoder && > > + connectors[i].encoder->crtc == crtc && > > + connectors[i].dpms != DRM_MODE_DPMS_ON) > > + return true; > > + > > + return false; > > +} > > + > > static void > > intel_set_config_compute_mode_changes(struct drm_mode_set *set, > > struct intel_set_config *config) > > @@ -8387,7 +8402,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, > > > > /* We should be able to check here if the fb has the same properties > > * and then just flip_or_move it */ > > - if (set->crtc->fb != set->fb) { > > + if (set->connectors != NULL && > > + connector_off(set->crtc, *set->connectors, > > + set->num_connectors)) { > > + config->mode_changed = true; > > + } else if (set->crtc->fb != set->fb) { > > /* If we have no fb then treat it as a full mode set */ > > if (set->crtc->fb == NULL) { > > DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); > > @@ -8397,8 +8416,9 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, > > } else if (set->fb->pixel_format != > > set->crtc->fb->pixel_format) { > > config->mode_changed = true; > > - } else > > + } else { > > config->fb_changed = true; > > + } > > } > > > > if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y)) > > Acked-by: Jesse Barnes Picked up for -fixes, thanks for the patch. We can bikeshed this later on, but this patch here at least should patch the worst holes. And maybe we come up with saner semantics for the new atomic modeset stuff ... -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch