diff mbox

[6/5] drm/i915: Make sure the primary plane is enabled before reading out the fb state

Message ID 1423164913-24717-1-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien Feb. 5, 2015, 7:35 p.m. UTC
We don't want to end up in a state where we track that the pipe has its
primary plane enabled when primary plane registers are programmed with
values that look possible but the plane actually disabled.

Refuse to read out the fb state when the primary plane isn't enabled.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Suggested-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Matt Roper Feb. 5, 2015, 9 p.m. UTC | #1
On Thu, Feb 05, 2015 at 07:35:13PM +0000, Damien Lespiau wrote:
> We don't want to end up in a state where we track that the pipe has its
> primary plane enabled when primary plane registers are programmed with
> values that look possible but the plane actually disabled.
> 
> Refuse to read out the fb state when the primary plane isn't enabled.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Suggested-by: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>

For the series:

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 074f204..3fe9598 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -6613,6 +6613,10 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>  	struct drm_framebuffer *fb;
>  	struct intel_framebuffer *intel_fb;
>  
> +	val = I915_READ(DSPCNTR(plane));
> +	if (!(val & DISPLAY_PLANE_ENABLE))
> +		return;
> +
>  	intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
>  	if (!intel_fb) {
>  		DRM_DEBUG_KMS("failed to alloc fb\n");
> @@ -6621,8 +6625,6 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>  
>  	fb = &intel_fb->base;
>  
> -	val = I915_READ(DSPCNTR(plane));
> -
>  	if (INTEL_INFO(dev)->gen >= 4)
>  		if (val & DISPPLANE_TILED)
>  			plane_config->tiling = I915_TILING_X;
> @@ -7654,6 +7656,9 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
>  	fb = &intel_fb->base;
>  
>  	val = I915_READ(PLANE_CTL(pipe, 0));
> +	if (!(val & PLANE_CTL_ENABLE))
> +		goto error;
> +
>  	if (val & PLANE_CTL_TILED_MASK)
>  		plane_config->tiling = I915_TILING_X;
>  
> @@ -7741,6 +7746,10 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
>  	struct drm_framebuffer *fb;
>  	struct intel_framebuffer *intel_fb;
>  
> +	val = I915_READ(DSPCNTR(pipe));
> +	if (!(val & DISPLAY_PLANE_ENABLE))
> +		return;
> +
>  	intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
>  	if (!intel_fb) {
>  		DRM_DEBUG_KMS("failed to alloc fb\n");
> @@ -7749,8 +7758,6 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
>  
>  	fb = &intel_fb->base;
>  
> -	val = I915_READ(DSPCNTR(pipe));
> -
>  	if (INTEL_INFO(dev)->gen >= 4)
>  		if (val & DISPPLANE_TILED)
>  			plane_config->tiling = I915_TILING_X;
> -- 
> 1.8.3.1
>
Daniel Vetter Feb. 6, 2015, 8:41 a.m. UTC | #2
On Thu, Feb 05, 2015 at 01:00:53PM -0800, Matt Roper wrote:
> On Thu, Feb 05, 2015 at 07:35:13PM +0000, Damien Lespiau wrote:
> > We don't want to end up in a state where we track that the pipe has its
> > primary plane enabled when primary plane registers are programmed with
> > values that look possible but the plane actually disabled.
> > 
> > Refuse to read out the fb state when the primary plane isn't enabled.
> > 
> > Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Suggested-by: Matt Roper <matthew.d.roper@intel.com>
> > Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> 
> For the series:
> 
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

All merged, thanks for patches&review.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 074f204..3fe9598 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6613,6 +6613,10 @@  i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 	struct drm_framebuffer *fb;
 	struct intel_framebuffer *intel_fb;
 
+	val = I915_READ(DSPCNTR(plane));
+	if (!(val & DISPLAY_PLANE_ENABLE))
+		return;
+
 	intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
 	if (!intel_fb) {
 		DRM_DEBUG_KMS("failed to alloc fb\n");
@@ -6621,8 +6625,6 @@  i9xx_get_initial_plane_config(struct intel_crtc *crtc,
 
 	fb = &intel_fb->base;
 
-	val = I915_READ(DSPCNTR(plane));
-
 	if (INTEL_INFO(dev)->gen >= 4)
 		if (val & DISPPLANE_TILED)
 			plane_config->tiling = I915_TILING_X;
@@ -7654,6 +7656,9 @@  skylake_get_initial_plane_config(struct intel_crtc *crtc,
 	fb = &intel_fb->base;
 
 	val = I915_READ(PLANE_CTL(pipe, 0));
+	if (!(val & PLANE_CTL_ENABLE))
+		goto error;
+
 	if (val & PLANE_CTL_TILED_MASK)
 		plane_config->tiling = I915_TILING_X;
 
@@ -7741,6 +7746,10 @@  ironlake_get_initial_plane_config(struct intel_crtc *crtc,
 	struct drm_framebuffer *fb;
 	struct intel_framebuffer *intel_fb;
 
+	val = I915_READ(DSPCNTR(pipe));
+	if (!(val & DISPLAY_PLANE_ENABLE))
+		return;
+
 	intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
 	if (!intel_fb) {
 		DRM_DEBUG_KMS("failed to alloc fb\n");
@@ -7749,8 +7758,6 @@  ironlake_get_initial_plane_config(struct intel_crtc *crtc,
 
 	fb = &intel_fb->base;
 
-	val = I915_READ(DSPCNTR(pipe));
-
 	if (INTEL_INFO(dev)->gen >= 4)
 		if (val & DISPPLANE_TILED)
 			plane_config->tiling = I915_TILING_X;