[Intel-gfx] [PATCH v17 19/19] drm/i915: Do not truncate fb sizes for NV12

Vidya Srinivas vidya.srinivas at intel.com
Wed Mar 28 09:18:12 UTC 2018


As per WA 1106, to avoid corruption issues
NV12 plane height needs to be multiplier of 4
We avoid trunction in this patch so that
the buffer we send (which is multiplier of 4)
directs goes into the kernel.

Credits-to: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas at intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |  4 ++++
 drivers/gpu/drm/i915/intel_sprite.c  | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0db0465..744dfc3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12987,6 +12987,9 @@ intel_check_primary_plane(struct intel_plane *plane,
 	if (ret)
 		return ret;
 
+	if (pixel_format == DRM_FORMAT_NV12)
+		goto check_plane_surface;
+
 	if (!state->base.fb)
 		return 0;
 
@@ -13108,6 +13111,7 @@ intel_check_primary_plane(struct intel_plane *plane,
 	dst->y1 = crtc_y;
 	dst->y2 = crtc_y + crtc_h;
 
+check_plane_surface:
 	if (INTEL_GEN(dev_priv) >= 9) {
 		ret = skl_check_plane_surface(crtc_state, state);
 		if (ret)
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 538d938..e50751d 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -230,6 +230,8 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
 #endif
 }
 
+#define MULT4(x) ((x + 3) & ~0x03)
+
 void
 skl_update_plane(struct intel_plane *plane,
 		 const struct intel_crtc_state *crtc_state,
@@ -261,6 +263,13 @@ skl_update_plane(struct intel_plane *plane,
 	crtc_w--;
 	crtc_h--;
 
+	if (fb->format->format == DRM_FORMAT_NV12) {
+		crtc_w = MULT4(crtc_w);
+		crtc_h = MULT4(crtc_h);
+		src_w = MULT4(src_w);
+		src_h = MULT4(src_h);
+	}
+
 	spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
 	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
@@ -957,6 +966,9 @@ intel_check_sprite_plane(struct intel_plane *plane,
 		return 0;
 	}
 
+	if (fb->format->format && fb->format->format == DRM_FORMAT_NV12)
+		goto check_plane_surface;
+
 	/* Don't modify another pipe's plane */
 	if (plane->pipe != crtc->pipe) {
 		DRM_DEBUG_KMS("Wrong plane <-> crtc mapping\n");
@@ -1111,6 +1123,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
 	dst->y1 = crtc_y;
 	dst->y2 = crtc_y + crtc_h;
 
+check_plane_surface:
 	if (INTEL_GEN(dev_priv) >= 9) {
 		ret = skl_check_plane_surface(crtc_state, state);
 		if (ret)
-- 
2.7.4



More information about the Intel-gfx mailing list