diff mbox

[01/18] drm/i915: Fix glk/cnl display w/a #1175

Message ID 20180719182214.4323-2-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä July 19, 2018, 6:21 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The workaround was supposed to look at the plane destination
coordinates. Currently it's looking at some mixture of src
and dst coordinates that doesn't make sense. Fix it up.

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

Comments

Imre Deak July 20, 2018, 10:55 a.m. UTC | #1
On Thu, Jul 19, 2018 at 09:21:57PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The workaround was supposed to look at the plane destination
> coordinates. Currently it's looking at some mixture of src
> and dst coordinates that doesn't make sense. Fix it up.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Fixes: 394676f05bee ("drm/i915: Add WA for planes ending close to left screen edge")
Reviewed-by: Imre Deak <imre.deak@intel.com>

Not sure why I thought it's ok to use the source width. As I understand now
it wouldn't work with scaling on.

> ---
>  drivers/gpu/drm/i915/intel_display.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 87e4cfbfd096..8efff0c56920 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2988,6 +2988,7 @@ static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
>  	int w = drm_rect_width(&plane_state->base.src) >> 16;
>  	int h = drm_rect_height(&plane_state->base.src) >> 16;
>  	int dst_x = plane_state->base.dst.x1;
> +	int dst_w = drm_rect_width(&plane_state->base.dst);
>  	int pipe_src_w = crtc_state->pipe_src_w;
>  	int max_width = skl_max_plane_width(fb, 0, rotation);
>  	int max_height = 4096;
> @@ -3009,10 +3010,10 @@ static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
>  	 * screen may cause FIFO underflow and display corruption.
>  	 */
>  	if ((IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv)) &&
> -	    (dst_x + w < 4 || dst_x > pipe_src_w - 4)) {
> +	    (dst_x + dst_w < 4 || dst_x > pipe_src_w - 4)) {
>  		DRM_DEBUG_KMS("requested plane X %s position %d invalid (valid range %d-%d)\n",
> -			      dst_x + w < 4 ? "end" : "start",
> -			      dst_x + w < 4 ? dst_x + w : dst_x,
> +			      dst_x + dst_w < 4 ? "end" : "start",
> +			      dst_x + dst_w < 4 ? dst_x + dst_w : dst_x,
>  			      4, pipe_src_w - 4);
>  		return -ERANGE;
>  	}
> -- 
> 2.16.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 87e4cfbfd096..8efff0c56920 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2988,6 +2988,7 @@  static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
 	int w = drm_rect_width(&plane_state->base.src) >> 16;
 	int h = drm_rect_height(&plane_state->base.src) >> 16;
 	int dst_x = plane_state->base.dst.x1;
+	int dst_w = drm_rect_width(&plane_state->base.dst);
 	int pipe_src_w = crtc_state->pipe_src_w;
 	int max_width = skl_max_plane_width(fb, 0, rotation);
 	int max_height = 4096;
@@ -3009,10 +3010,10 @@  static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
 	 * screen may cause FIFO underflow and display corruption.
 	 */
 	if ((IS_GEMINILAKE(dev_priv) || IS_CANNONLAKE(dev_priv)) &&
-	    (dst_x + w < 4 || dst_x > pipe_src_w - 4)) {
+	    (dst_x + dst_w < 4 || dst_x > pipe_src_w - 4)) {
 		DRM_DEBUG_KMS("requested plane X %s position %d invalid (valid range %d-%d)\n",
-			      dst_x + w < 4 ? "end" : "start",
-			      dst_x + w < 4 ? dst_x + w : dst_x,
+			      dst_x + dst_w < 4 ? "end" : "start",
+			      dst_x + dst_w < 4 ? dst_x + dst_w : dst_x,
 			      4, pipe_src_w - 4);
 		return -ERANGE;
 	}