From d1ce387f2a802c4a097dc0c7e01e562c76fdb789 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Thu, 21 Aug 2014 20:36:41 -0400 Subject: [PATCH] xv: use correct max width/height settings Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70931 Signed-off-by: Ilia Mirkin --- src/nouveau_xv.c | 11 ++++++----- src/nv50_xv.c | 1 + src/nv_type.h | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c index e40d6ba..ae51a4d 100644 --- a/src/nouveau_xv.c +++ b/src/nouveau_xv.c @@ -975,6 +975,8 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, if (pPriv->grabbedByV4L) return Success; + if (width > pPriv->max_image_dim || height > pPriv->max_image_dim) + return BadMatch; NV_set_action_flags(pScrn, pDraw, pPriv, id, drw_x, drw_y, drw_w, drw_h, &action_flags); @@ -1348,11 +1350,6 @@ NVQueryImageAttributes(ScrnInfoPtr pScrn, int id, { int size, tmp; - if (*w > IMAGE_MAX_W) - *w = IMAGE_MAX_W; - if (*h > IMAGE_MAX_H) - *h = IMAGE_MAX_H; - *w = (*w + 1) & ~1; // width rounded up to an even number if (offsets) offsets[0] = 0; @@ -1613,6 +1610,7 @@ NVSetupBlitVideo (ScreenPtr pScreen) pPriv->bicubic = FALSE; pPriv->doubleBuffer = FALSE; pPriv->SyncToVBlank = (pNv->dev->chipset >= 0x11); + pPriv->max_image_dim = 2048; pNv->blitAdaptor = adapt; @@ -1673,6 +1671,7 @@ NVSetupOverlayVideoAdapter(ScreenPtr pScreen) pPriv->blitter = FALSE; pPriv->texture = FALSE; pPriv->bicubic = FALSE; + pPriv->max_image_dim = 2048; NVSetPortDefaults (pScrn, pPriv); @@ -1874,6 +1873,7 @@ NV30SetupTexturedVideo (ScreenPtr pScreen, Bool bicubic) pPriv->bicubic = bicubic; pPriv->doubleBuffer = FALSE; pPriv->SyncToVBlank = TRUE; + pPriv->max_image_dim = 4096; if (bicubic) pNv->textureAdaptor[1] = adapt; @@ -1955,6 +1955,7 @@ NV40SetupTexturedVideo (ScreenPtr pScreen, Bool bicubic) pPriv->bicubic = bicubic; pPriv->doubleBuffer = FALSE; pPriv->SyncToVBlank = TRUE; + pPriv->max_image_dim = 4096; if (bicubic) pNv->textureAdaptor[1] = adapt; diff --git a/src/nv50_xv.c b/src/nv50_xv.c index 909074a..3ac9e44 100644 --- a/src/nv50_xv.c +++ b/src/nv50_xv.c @@ -364,6 +364,7 @@ nv50_xv_set_port_defaults(ScrnInfoPtr pScrn, NVPortPrivPtr pPriv) pPriv->saturation = 0; pPriv->hue = 0; pPriv->iturbt_709 = 0; + pPriv->max_image_dim = 8192; } int diff --git a/src/nv_type.h b/src/nv_type.h index c0517c6..a12dd53 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -163,6 +163,7 @@ typedef struct _NVPortPrivRec { Bool texture; Bool bicubic; /* only for texture adapter */ Bool SyncToVBlank; + int max_image_dim; struct nouveau_bo *video_mem; int pitch; int offset; -- 1.8.5.5