[Intel-gfx] [PATCH] drm/i915: Force a full modeset if the requested CRTC is disconnected

Chris Wilson chris at chris-wilson.co.uk
Tue Aug 13 22:58:11 CEST 2013


On Tue, Aug 13, 2013 at 10:32:19PM +0200, Daniel Vetter wrote:
> On Tue, Aug 13, 2013 at 06:59:34PM +0100, Chris Wilson wrote:
> > If the CRTC for this modeset is not attached to any encoder, it will be
> > off. In this case, we will need to turn it on as well as update its
> > base. This requires a full modeset sequence.
> > 
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68030
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c |   14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 4f9c3d8..30bd919 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -8836,9 +8836,8 @@ is_crtc_connector_off(struct drm_mode_set *set)
> >  
> >  	for (i = 0; i < set->num_connectors; i++)
> >  		if (set->connectors[i]->encoder &&
> > -		    set->connectors[i]->encoder->crtc == set->crtc &&
> > -		    set->connectors[i]->dpms != DRM_MODE_DPMS_ON)
> > -			return true;
> > +		    set->connectors[i]->encoder->crtc == set->crtc)
> > +			return set->connectors[i]->dpms != DRM_MODE_DPMS_ON;
> >  
> >  	return false;
> >  }
> > @@ -8853,11 +8852,10 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
> >  	if (is_crtc_connector_off(set)) {
> >  		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) {
> > -			struct intel_crtc *intel_crtc =
> > -				to_intel_crtc(set->crtc);
> > +		struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
> >  
> > +		/* If we have no fb (or off) then treat it as a full mode set */
> > +		if (set->crtc->fb == NULL) {
> >  			if (intel_crtc->active && i915_fastboot) {
> >  				DRM_DEBUG_KMS("crtc has no fb, will flip\n");
> >  				config->fb_changed = true;
> > @@ -8870,6 +8868,8 @@ 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 if (!intel_crtc->active) {
> > +			config->mode_changed = true;
> 
> This hunk here /should/ be redundant, at least if we don't botch up the
> connector iteration above. Also can you please pimp the commit message a
> bit to trace the epic multi-chapter train wreak this has become?

I'm thinking we want something closer to

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 30bd919..c12a620 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8824,7 +8824,7 @@ static void intel_set_config_restore_state(struct drm_device *dev,
 }
 
 static bool
-is_crtc_connector_off(struct drm_mode_set *set)
+is_connector_off(struct drm_mode_set *set)
 {
 	int i;
 
@@ -8835,9 +8835,8 @@ is_crtc_connector_off(struct drm_mode_set *set)
 		return false;
 
 	for (i = 0; i < set->num_connectors; i++)
-		if (set->connectors[i]->encoder &&
-		    set->connectors[i]->encoder->crtc == set->crtc)
-			return set->connectors[i]->dpms != DRM_MODE_DPMS_ON;
+		if (set->connectors[i]->dpms != DRM_MODE_DPMS_ON)
+			return true;
 
 	return false;
 }
@@ -8849,11 +8848,13 @@ 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 (is_crtc_connector_off(set)) {
+	if (is_connector_off(set)) {
 		config->mode_changed = true;
 	} else if (set->crtc->fb != set->fb) {
 		struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
 
+		config->fb_changed = true;
+
 		/* If we have no fb (or off) then treat it as a full mode set */
 		if (set->crtc->fb == NULL) {
 			if (intel_crtc->active && i915_fastboot) {
@@ -8870,8 +8871,6 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
 			config->mode_changed = true;
 		} else if (!intel_crtc->active) {
 			config->mode_changed = true;
-		} else {
-			config->fb_changed = true;
 		}
 	}
 


-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list