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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
Signed-off-by: Vidya Srinivas <vidya.srinivas@xxxxxxxxx>
---
 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

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux