diff mbox series

[8/8] drm/i915: Force planar YUV coordinates to be a multiple of 2, v2.

Message ID 20180920102711.4184-9-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Preparations for adding gen11 planar formats. | expand

Commit Message

Maarten Lankhorst Sept. 20, 2018, 10:27 a.m. UTC
We can't make NV12 work any other way. The scaler doesn't handle odd
coordinates well, and we will get visual corruption on the screen.

Changes since v1:
- Put the check in intel_plane_check_src_coordinates. (Ville)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Matt Roper Sept. 20, 2018, 11:19 p.m. UTC | #1
On Thu, Sep 20, 2018 at 12:27:11PM +0200, Maarten Lankhorst wrote:
> We can't make NV12 work any other way. The scaler doesn't handle odd
> coordinates well, and we will get visual corruption on the screen.
> 
> Changes since v1:
> - Put the check in intel_plane_check_src_coordinates. (Ville)
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/intel_sprite.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 7d3c7469d271..46c6336cb858 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -253,13 +253,20 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
>  	src->y2 = (src_y + src_h) << 16;
>  
>  	if (fb->format->is_yuv &&
> -	    fb->format->format != DRM_FORMAT_NV12 &&
>  	    (src_x & 1 || src_w & 1)) {
>  		DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n",
>  			      src_x, src_w);
>  		return -EINVAL;
>  	}
>  
> +	if (fb->format->is_yuv &&
> +	    fb->format->num_planes > 1 &&
> +	    (src_y & 1 || src_h & 1)) {
> +		DRM_DEBUG_KMS("src y/h (%u, %u) must be a multiple of 2 for planar YUV planes\n",
> +			      src_y, src_h);
> +		return -EINVAL;
> +	}
> +
>  	return 0;
>  }
>  
> -- 
> 2.18.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 7d3c7469d271..46c6336cb858 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -253,13 +253,20 @@  int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
 	src->y2 = (src_y + src_h) << 16;
 
 	if (fb->format->is_yuv &&
-	    fb->format->format != DRM_FORMAT_NV12 &&
 	    (src_x & 1 || src_w & 1)) {
 		DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n",
 			      src_x, src_w);
 		return -EINVAL;
 	}
 
+	if (fb->format->is_yuv &&
+	    fb->format->num_planes > 1 &&
+	    (src_y & 1 || src_h & 1)) {
+		DRM_DEBUG_KMS("src y/h (%u, %u) must be a multiple of 2 for planar YUV planes\n",
+			      src_y, src_h);
+		return -EINVAL;
+	}
+
 	return 0;
 }