All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane
@ 2015-06-24 18:59 ville.syrjala
  2015-06-24 18:59 ` [PATCH 2/3] drm/i915: Add debug messages for pipe enable/disable ville.syrjala
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ville.syrjala @ 2015-06-24 18:59 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Avoid some 'switch (plane->type)' by storing the fronbuffer_bits in
intel_plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 75 ++++++++++--------------------------
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_sprite.c  |  1 +
 3 files changed, 22 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4c829b9..ae65516 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2604,7 +2604,7 @@ valid_fb:
 	primary->crtc = primary->state->crtc = &intel_crtc->base;
 	update_state_fb(primary);
 	intel_crtc->base.state->plane_mask |= (1 << drm_plane_index(primary));
-	obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
+	obj->frontbuffer_bits |= to_intel_plane(primary)->frontbuffer_bits;
 }
 
 static void i9xx_update_primary_plane(struct drm_crtc *crtc,
@@ -4733,25 +4733,12 @@ static void intel_pre_plane_update(struct intel_crtc *crtc)
 	struct drm_plane *p;
 
 	/* Track fb's for any planes being disabled */
-
 	drm_for_each_plane_mask(p, dev, atomic->disabled_planes) {
 		struct intel_plane *plane = to_intel_plane(p);
-		unsigned fb_bits = 0;
-
-		switch (p->type) {
-		case DRM_PLANE_TYPE_PRIMARY:
-			fb_bits = INTEL_FRONTBUFFER_PRIMARY(plane->pipe);
-			break;
-		case DRM_PLANE_TYPE_CURSOR:
-			fb_bits = INTEL_FRONTBUFFER_CURSOR(plane->pipe);
-			break;
-		case DRM_PLANE_TYPE_OVERLAY:
-			fb_bits = INTEL_FRONTBUFFER_SPRITE(plane->pipe);
-			break;
-		}
 
 		mutex_lock(&dev->struct_mutex);
-		i915_gem_track_fb(intel_fb_obj(plane->base.fb), NULL, fb_bits);
+		i915_gem_track_fb(intel_fb_obj(plane->base.fb), NULL,
+				  plane->frontbuffer_bits);
 		mutex_unlock(&dev->struct_mutex);
 	}
 
@@ -10717,11 +10704,12 @@ static void intel_unpin_work_fn(struct work_struct *__work)
 {
 	struct intel_unpin_work *work =
 		container_of(__work, struct intel_unpin_work, work);
-	struct drm_device *dev = work->crtc->dev;
-	enum pipe pipe = to_intel_crtc(work->crtc)->pipe;
+	struct intel_crtc *crtc = to_intel_crtc(work->crtc);
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_plane *primary = crtc->base.primary;
 
 	mutex_lock(&dev->struct_mutex);
-	intel_unpin_fb_obj(work->old_fb, work->crtc->primary->state);
+	intel_unpin_fb_obj(work->old_fb, primary->state);
 	drm_gem_object_unreference(&work->pending_flip_obj->base);
 
 	intel_fbc_update(dev);
@@ -10730,11 +10718,11 @@ static void intel_unpin_work_fn(struct work_struct *__work)
 		i915_gem_request_assign(&work->flip_queued_req, NULL);
 	mutex_unlock(&dev->struct_mutex);
 
-	intel_frontbuffer_flip_complete(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
+	intel_frontbuffer_flip_complete(dev, to_intel_plane(primary)->frontbuffer_bits);
 	drm_framebuffer_unreference(work->old_fb);
 
-	BUG_ON(atomic_read(&to_intel_crtc(work->crtc)->unpin_work_count) == 0);
-	atomic_dec(&to_intel_crtc(work->crtc)->unpin_work_count);
+	BUG_ON(atomic_read(&crtc->unpin_work_count) == 0);
+	atomic_dec(&crtc->unpin_work_count);
 
 	kfree(work);
 }
@@ -11495,10 +11483,11 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	work->enable_stall_check = true;
 
 	i915_gem_track_fb(intel_fb_obj(work->old_fb), obj,
-			  INTEL_FRONTBUFFER_PRIMARY(pipe));
+			  to_intel_plane(primary)->frontbuffer_bits);
 
 	intel_fbc_disable(dev);
-	intel_frontbuffer_flip_prepare(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
+	intel_frontbuffer_flip_prepare(dev,
+				       to_intel_plane(primary)->frontbuffer_bits);
 	mutex_unlock(&dev->struct_mutex);
 
 	trace_i915_flip_request(intel_crtc->plane, obj);
@@ -11651,12 +11640,12 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
 	if (intel_wm_need_update(plane, plane_state))
 		intel_crtc->atomic.update_wm = true;
 
+	if (visible)
+		intel_crtc->atomic.fb_bits |=
+			to_intel_plane(plane)->frontbuffer_bits;
+
 	switch (plane->type) {
 	case DRM_PLANE_TYPE_PRIMARY:
-		if (visible)
-			intel_crtc->atomic.fb_bits |=
-			    INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
-
 		intel_crtc->atomic.wait_for_flips = true;
 		intel_crtc->atomic.pre_disable_primary = turn_off;
 		intel_crtc->atomic.post_enable_primary = turn_on;
@@ -11692,25 +11681,13 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
 		intel_crtc->atomic.update_fbc |= visible || mode_changed;
 		break;
 	case DRM_PLANE_TYPE_CURSOR:
-		if (visible)
-			intel_crtc->atomic.fb_bits |=
-			    INTEL_FRONTBUFFER_CURSOR(intel_crtc->pipe);
 		break;
 	case DRM_PLANE_TYPE_OVERLAY:
-		/*
-		 * 'prepare' is never called when plane is being disabled, so
-		 * we need to handle frontbuffer tracking as a special case
-		 */
-		if (visible)
-			intel_crtc->atomic.fb_bits |=
-			    INTEL_FRONTBUFFER_SPRITE(intel_crtc->pipe);
-
 		if (turn_off && !mode_changed) {
 			intel_crtc->atomic.wait_vblank = true;
 			intel_crtc->atomic.update_sprite_watermarks |=
 				1 << i;
 		}
-		break;
 	}
 	return 0;
 }
@@ -13592,27 +13569,13 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 {
 	struct drm_device *dev = plane->dev;
 	struct intel_plane *intel_plane = to_intel_plane(plane);
-	enum pipe pipe = intel_plane->pipe;
 	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);
-	unsigned frontbuffer_bits = 0;
 	int ret = 0;
 
 	if (!obj)
 		return 0;
 
-	switch (plane->type) {
-	case DRM_PLANE_TYPE_PRIMARY:
-		frontbuffer_bits = INTEL_FRONTBUFFER_PRIMARY(pipe);
-		break;
-	case DRM_PLANE_TYPE_CURSOR:
-		frontbuffer_bits = INTEL_FRONTBUFFER_CURSOR(pipe);
-		break;
-	case DRM_PLANE_TYPE_OVERLAY:
-		frontbuffer_bits = INTEL_FRONTBUFFER_SPRITE(pipe);
-		break;
-	}
-
 	mutex_lock(&dev->struct_mutex);
 
 	if (plane->type == DRM_PLANE_TYPE_CURSOR &&
@@ -13626,7 +13589,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 	}
 
 	if (ret == 0)
-		i915_gem_track_fb(old_obj, obj, frontbuffer_bits);
+		i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bits);
 
 	mutex_unlock(&dev->struct_mutex);
 
@@ -13845,6 +13808,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 	}
 	primary->pipe = pipe;
 	primary->plane = pipe;
+	primary->frontbuffer_bits = INTEL_FRONTBUFFER_PRIMARY(pipe);
 	primary->check_plane = intel_check_primary_plane;
 	primary->commit_plane = intel_commit_primary_plane;
 	primary->disable_plane = intel_disable_primary_plane;
@@ -14000,6 +13964,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 	cursor->max_downscale = 1;
 	cursor->pipe = pipe;
 	cursor->plane = pipe;
+	cursor->frontbuffer_bits = INTEL_FRONTBUFFER_CURSOR(pipe);
 	cursor->check_plane = intel_check_cursor_plane;
 	cursor->commit_plane = intel_commit_cursor_plane;
 	cursor->disable_plane = intel_disable_cursor_plane;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e2174fd..de2cc26 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -590,6 +590,7 @@ struct intel_plane {
 	enum pipe pipe;
 	bool can_scale;
 	int max_downscale;
+	uint32_t frontbuffer_bits;
 
 	/* Since we need to change the watermarks before/after
 	 * enabling/disabling the planes, we need to store the parameters here
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index e0045aa..3806f83 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1130,6 +1130,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 
 	intel_plane->pipe = pipe;
 	intel_plane->plane = plane;
+	intel_plane->frontbuffer_bits = INTEL_FRONTBUFFER_SPRITE(pipe);
 	intel_plane->check_plane = intel_check_sprite_plane;
 	intel_plane->commit_plane = intel_commit_sprite_plane;
 	possible_crtcs = (1 << pipe);
-- 
2.3.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] drm/i915: Add debug messages for pipe enable/disable
  2015-06-24 18:59 [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane ville.syrjala
@ 2015-06-24 18:59 ` ville.syrjala
  2015-06-24 18:59 ` [PATCH 3/3] drm/i915: Don't set cursor rotate bits when cursor is disabled ville.syrjala
  2015-06-25  7:53 ` [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane Daniel Vetter
  2 siblings, 0 replies; 5+ messages in thread
From: ville.syrjala @ 2015-06-24 18:59 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently we don't have any real indication when a pipe gets
enabled/disabled. Add some.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ae65516..cd8fa05 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2110,6 +2110,8 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
 	int reg;
 	u32 val;
 
+	DRM_DEBUG_KMS("enabling pipe %c\n", pipe_name(pipe));
+
 	assert_planes_disabled(dev_priv, pipe);
 	assert_cursor_disabled(dev_priv, pipe);
 	assert_sprites_disabled(dev_priv, pipe);
@@ -2169,6 +2171,8 @@ static void intel_disable_pipe(struct intel_crtc *crtc)
 	int reg;
 	u32 val;
 
+	DRM_DEBUG_KMS("disabling pipe %c\n", pipe_name(pipe));
+
 	/*
 	 * Make sure planes won't keep trying to pump pixels to us,
 	 * or we might hang the display.
-- 
2.3.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] drm/i915: Don't set cursor rotate bits when cursor is disabled
  2015-06-24 18:59 [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane ville.syrjala
  2015-06-24 18:59 ` [PATCH 2/3] drm/i915: Add debug messages for pipe enable/disable ville.syrjala
@ 2015-06-24 18:59 ` ville.syrjala
  2015-06-25 12:12   ` Daniel Vetter
  2015-06-25  7:53 ` [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane Daniel Vetter
  2 siblings, 1 reply; 5+ messages in thread
From: ville.syrjala @ 2015-06-24 18:59 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Let's keep the cursor control register at 0 when the cursor is disabled.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index cd8fa05..29c584c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9896,10 +9896,10 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
 
 		if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 			cntl |= CURSOR_PIPE_CSC_ENABLE;
-	}
 
-	if (crtc->cursor->state->rotation == BIT(DRM_ROTATE_180))
-		cntl |= CURSOR_ROTATE_180;
+		if (crtc->cursor->state->rotation == BIT(DRM_ROTATE_180))
+			cntl |= CURSOR_ROTATE_180;
+	}
 
 	if (intel_crtc->cursor_cntl != cntl) {
 		I915_WRITE(CURCNTR(pipe), cntl);
-- 
2.3.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane
  2015-06-24 18:59 [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane ville.syrjala
  2015-06-24 18:59 ` [PATCH 2/3] drm/i915: Add debug messages for pipe enable/disable ville.syrjala
  2015-06-24 18:59 ` [PATCH 3/3] drm/i915: Don't set cursor rotate bits when cursor is disabled ville.syrjala
@ 2015-06-25  7:53 ` Daniel Vetter
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2015-06-25  7:53 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

On Wed, Jun 24, 2015 at 09:59:34PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Avoid some 'switch (plane->type)' by storing the fronbuffer_bits in
> intel_plane.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Hm I just realized that we never got around to adding FB bits for the
additional sprite planes on vlv and gen9+. And that's been broken since
introduction, since the vlv sprite support is 1 year older than the FB
tracking. But at least with your patch here that's easy to fix.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c | 75 ++++++++++--------------------------
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  drivers/gpu/drm/i915/intel_sprite.c  |  1 +
>  3 files changed, 22 insertions(+), 55 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 4c829b9..ae65516 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2604,7 +2604,7 @@ valid_fb:
>  	primary->crtc = primary->state->crtc = &intel_crtc->base;
>  	update_state_fb(primary);
>  	intel_crtc->base.state->plane_mask |= (1 << drm_plane_index(primary));
> -	obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
> +	obj->frontbuffer_bits |= to_intel_plane(primary)->frontbuffer_bits;
>  }
>  
>  static void i9xx_update_primary_plane(struct drm_crtc *crtc,
> @@ -4733,25 +4733,12 @@ static void intel_pre_plane_update(struct intel_crtc *crtc)
>  	struct drm_plane *p;
>  
>  	/* Track fb's for any planes being disabled */
> -
>  	drm_for_each_plane_mask(p, dev, atomic->disabled_planes) {
>  		struct intel_plane *plane = to_intel_plane(p);
> -		unsigned fb_bits = 0;
> -
> -		switch (p->type) {
> -		case DRM_PLANE_TYPE_PRIMARY:
> -			fb_bits = INTEL_FRONTBUFFER_PRIMARY(plane->pipe);
> -			break;
> -		case DRM_PLANE_TYPE_CURSOR:
> -			fb_bits = INTEL_FRONTBUFFER_CURSOR(plane->pipe);
> -			break;
> -		case DRM_PLANE_TYPE_OVERLAY:
> -			fb_bits = INTEL_FRONTBUFFER_SPRITE(plane->pipe);
> -			break;
> -		}
>  
>  		mutex_lock(&dev->struct_mutex);
> -		i915_gem_track_fb(intel_fb_obj(plane->base.fb), NULL, fb_bits);
> +		i915_gem_track_fb(intel_fb_obj(plane->base.fb), NULL,
> +				  plane->frontbuffer_bits);
>  		mutex_unlock(&dev->struct_mutex);
>  	}
>  
> @@ -10717,11 +10704,12 @@ static void intel_unpin_work_fn(struct work_struct *__work)
>  {
>  	struct intel_unpin_work *work =
>  		container_of(__work, struct intel_unpin_work, work);
> -	struct drm_device *dev = work->crtc->dev;
> -	enum pipe pipe = to_intel_crtc(work->crtc)->pipe;
> +	struct intel_crtc *crtc = to_intel_crtc(work->crtc);
> +	struct drm_device *dev = crtc->base.dev;
> +	struct drm_plane *primary = crtc->base.primary;
>  
>  	mutex_lock(&dev->struct_mutex);
> -	intel_unpin_fb_obj(work->old_fb, work->crtc->primary->state);
> +	intel_unpin_fb_obj(work->old_fb, primary->state);
>  	drm_gem_object_unreference(&work->pending_flip_obj->base);
>  
>  	intel_fbc_update(dev);
> @@ -10730,11 +10718,11 @@ static void intel_unpin_work_fn(struct work_struct *__work)
>  		i915_gem_request_assign(&work->flip_queued_req, NULL);
>  	mutex_unlock(&dev->struct_mutex);
>  
> -	intel_frontbuffer_flip_complete(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
> +	intel_frontbuffer_flip_complete(dev, to_intel_plane(primary)->frontbuffer_bits);
>  	drm_framebuffer_unreference(work->old_fb);
>  
> -	BUG_ON(atomic_read(&to_intel_crtc(work->crtc)->unpin_work_count) == 0);
> -	atomic_dec(&to_intel_crtc(work->crtc)->unpin_work_count);
> +	BUG_ON(atomic_read(&crtc->unpin_work_count) == 0);
> +	atomic_dec(&crtc->unpin_work_count);
>  
>  	kfree(work);
>  }
> @@ -11495,10 +11483,11 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>  	work->enable_stall_check = true;
>  
>  	i915_gem_track_fb(intel_fb_obj(work->old_fb), obj,
> -			  INTEL_FRONTBUFFER_PRIMARY(pipe));
> +			  to_intel_plane(primary)->frontbuffer_bits);
>  
>  	intel_fbc_disable(dev);
> -	intel_frontbuffer_flip_prepare(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
> +	intel_frontbuffer_flip_prepare(dev,
> +				       to_intel_plane(primary)->frontbuffer_bits);
>  	mutex_unlock(&dev->struct_mutex);
>  
>  	trace_i915_flip_request(intel_crtc->plane, obj);
> @@ -11651,12 +11640,12 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
>  	if (intel_wm_need_update(plane, plane_state))
>  		intel_crtc->atomic.update_wm = true;
>  
> +	if (visible)
> +		intel_crtc->atomic.fb_bits |=
> +			to_intel_plane(plane)->frontbuffer_bits;
> +
>  	switch (plane->type) {
>  	case DRM_PLANE_TYPE_PRIMARY:
> -		if (visible)
> -			intel_crtc->atomic.fb_bits |=
> -			    INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe);
> -
>  		intel_crtc->atomic.wait_for_flips = true;
>  		intel_crtc->atomic.pre_disable_primary = turn_off;
>  		intel_crtc->atomic.post_enable_primary = turn_on;
> @@ -11692,25 +11681,13 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
>  		intel_crtc->atomic.update_fbc |= visible || mode_changed;
>  		break;
>  	case DRM_PLANE_TYPE_CURSOR:
> -		if (visible)
> -			intel_crtc->atomic.fb_bits |=
> -			    INTEL_FRONTBUFFER_CURSOR(intel_crtc->pipe);
>  		break;
>  	case DRM_PLANE_TYPE_OVERLAY:
> -		/*
> -		 * 'prepare' is never called when plane is being disabled, so
> -		 * we need to handle frontbuffer tracking as a special case
> -		 */
> -		if (visible)
> -			intel_crtc->atomic.fb_bits |=
> -			    INTEL_FRONTBUFFER_SPRITE(intel_crtc->pipe);
> -
>  		if (turn_off && !mode_changed) {
>  			intel_crtc->atomic.wait_vblank = true;
>  			intel_crtc->atomic.update_sprite_watermarks |=
>  				1 << i;
>  		}
> -		break;
>  	}
>  	return 0;
>  }
> @@ -13592,27 +13569,13 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  {
>  	struct drm_device *dev = plane->dev;
>  	struct intel_plane *intel_plane = to_intel_plane(plane);
> -	enum pipe pipe = intel_plane->pipe;
>  	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
>  	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->fb);
> -	unsigned frontbuffer_bits = 0;
>  	int ret = 0;
>  
>  	if (!obj)
>  		return 0;
>  
> -	switch (plane->type) {
> -	case DRM_PLANE_TYPE_PRIMARY:
> -		frontbuffer_bits = INTEL_FRONTBUFFER_PRIMARY(pipe);
> -		break;
> -	case DRM_PLANE_TYPE_CURSOR:
> -		frontbuffer_bits = INTEL_FRONTBUFFER_CURSOR(pipe);
> -		break;
> -	case DRM_PLANE_TYPE_OVERLAY:
> -		frontbuffer_bits = INTEL_FRONTBUFFER_SPRITE(pipe);
> -		break;
> -	}
> -
>  	mutex_lock(&dev->struct_mutex);
>  
>  	if (plane->type == DRM_PLANE_TYPE_CURSOR &&
> @@ -13626,7 +13589,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  	}
>  
>  	if (ret == 0)
> -		i915_gem_track_fb(old_obj, obj, frontbuffer_bits);
> +		i915_gem_track_fb(old_obj, obj, intel_plane->frontbuffer_bits);
>  
>  	mutex_unlock(&dev->struct_mutex);
>  
> @@ -13845,6 +13808,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
>  	}
>  	primary->pipe = pipe;
>  	primary->plane = pipe;
> +	primary->frontbuffer_bits = INTEL_FRONTBUFFER_PRIMARY(pipe);
>  	primary->check_plane = intel_check_primary_plane;
>  	primary->commit_plane = intel_commit_primary_plane;
>  	primary->disable_plane = intel_disable_primary_plane;
> @@ -14000,6 +13964,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>  	cursor->max_downscale = 1;
>  	cursor->pipe = pipe;
>  	cursor->plane = pipe;
> +	cursor->frontbuffer_bits = INTEL_FRONTBUFFER_CURSOR(pipe);
>  	cursor->check_plane = intel_check_cursor_plane;
>  	cursor->commit_plane = intel_commit_cursor_plane;
>  	cursor->disable_plane = intel_disable_cursor_plane;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e2174fd..de2cc26 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -590,6 +590,7 @@ struct intel_plane {
>  	enum pipe pipe;
>  	bool can_scale;
>  	int max_downscale;
> +	uint32_t frontbuffer_bits;
>  
>  	/* Since we need to change the watermarks before/after
>  	 * enabling/disabling the planes, we need to store the parameters here
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index e0045aa..3806f83 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1130,6 +1130,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>  
>  	intel_plane->pipe = pipe;
>  	intel_plane->plane = plane;
> +	intel_plane->frontbuffer_bits = INTEL_FRONTBUFFER_SPRITE(pipe);
>  	intel_plane->check_plane = intel_check_sprite_plane;
>  	intel_plane->commit_plane = intel_commit_sprite_plane;
>  	possible_crtcs = (1 << pipe);
> -- 
> 2.3.6
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/3] drm/i915: Don't set cursor rotate bits when cursor is disabled
  2015-06-24 18:59 ` [PATCH 3/3] drm/i915: Don't set cursor rotate bits when cursor is disabled ville.syrjala
@ 2015-06-25 12:12   ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2015-06-25 12:12 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

On Wed, Jun 24, 2015 at 09:59:36PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Let's keep the cursor control register at 0 when the cursor is disabled.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

All merged, with the slight naming bikeshed we discussed on irc squashed
into patch 1.

Thanks, Daniel

> ---
>  drivers/gpu/drm/i915/intel_display.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index cd8fa05..29c584c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9896,10 +9896,10 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
>  
>  		if (IS_HASWELL(dev) || IS_BROADWELL(dev))
>  			cntl |= CURSOR_PIPE_CSC_ENABLE;
> -	}
>  
> -	if (crtc->cursor->state->rotation == BIT(DRM_ROTATE_180))
> -		cntl |= CURSOR_ROTATE_180;
> +		if (crtc->cursor->state->rotation == BIT(DRM_ROTATE_180))
> +			cntl |= CURSOR_ROTATE_180;
> +	}
>  
>  	if (intel_crtc->cursor_cntl != cntl) {
>  		I915_WRITE(CURCNTR(pipe), cntl);
> -- 
> 2.3.6
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-25 12:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 18:59 [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane ville.syrjala
2015-06-24 18:59 ` [PATCH 2/3] drm/i915: Add debug messages for pipe enable/disable ville.syrjala
2015-06-24 18:59 ` [PATCH 3/3] drm/i915: Don't set cursor rotate bits when cursor is disabled ville.syrjala
2015-06-25 12:12   ` Daniel Vetter
2015-06-25  7:53 ` [PATCH 1/3] drm/i915: Store frontbuffer_bits in the plane Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.