From: Mun Gwan-gyeong <elong...@gmail.com> It adds limits of the height and the width on the copy region.
Cc: Daniel Stone <dan...@fooishbar.org> Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com> [Eric: compare coordinates instead of bytes (Suggested by DanielS)] Signed-off-by: Eric Engestrom <eric.engest...@imgtec.com> --- src/egl/drivers/dri2/platform_drm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index a952aa5456..b3c2563c2e 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -530,6 +530,12 @@ swrast_put_image2(__DRIdrawable *driDrawable, int x_bytes, width_bytes; char *src, *dst; + if (height > dri2_surf->base.Height - y) + height = dri2_surf->base.Height - y; + + if (width > dri2_surf->base.Width - x) + width = dri2_surf->base.Width - x; + if (op != __DRI_SWRAST_IMAGE_OP_DRAW && op != __DRI_SWRAST_IMAGE_OP_SWAP) return; @@ -579,6 +585,12 @@ swrast_get_image(__DRIdrawable *driDrawable, int x_bytes, width_bytes; char *src, *dst; + if (height > dri2_surf->base.Height - y) + height = dri2_surf->base.Height - y; + + if (width > dri2_surf->base.Width - x) + width = dri2_surf->base.Width - x; + if (get_swrast_front_bo(dri2_surf) < 0) return; -- Cheers, Eric _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev