[Nouveau] [PATCH 2/5] drm/nv10/plane: add downscaling restrictions

Ilia Mirkin imirkin at alum.mit.edu
Fri Nov 15 08:26:42 PST 2013


Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

Copied from the (disabled) overlay code in xf86-video-nouveau. I verified that
my nv34 indeed doesn't scale down by more than 2, didn't test the factor of 8.

 drivers/gpu/drm/nouveau/dispnv04/overlay.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/overlay.c b/drivers/gpu/drm/nouveau/dispnv04/overlay.c
index 514a305..c14afb7 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/overlay.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/overlay.c
@@ -112,7 +112,15 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 	format = ALIGN(src_w * 4, 0x100);
 
 	if (format > 0xffff)
-		return -EINVAL;
+		return -ERANGE;
+
+	if (dev->chipset >= 0x30) {
+		if (crtc_w < (src_w >> 1) || crtc_h < (src_h >> 1))
+			return -ERANGE;
+	} else {
+		if (crtc_w < (src_w >> 3) || crtc_h < (src_h >> 3))
+			return -ERANGE;
+	}
 
 	ret = nouveau_bo_pin(nv_fb->nvbo, TTM_PL_FLAG_VRAM);
 	if (ret)
-- 
1.8.3.2



More information about the Nouveau mailing list