egl/x11/sw: fix partial image uploads

* swrast allocates images aligned to 64x64 tiles, which results in images
  that are larger than the window. PutImage requests must be clamped on
  the y-axis to avoid uploading/damaging out-of-bounds regions
* winsys coords are y-inverted

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29910>
This commit is contained in:
Mike Blumenkrantz
2024-02-13 13:10:30 -05:00
committed by Marge Bot
parent e3e712e74e
commit 6088a0bf51
+5
View File
@@ -174,6 +174,11 @@ swrastPutImage(__DRIdrawable *draw, int op, int x, int y, int w, int h,
return;
}
/* clamp to drawable size */
if (y + h > dri2_surf->base.Height)
h = dri2_surf->base.Height - y;
/* y-invert */
y = dri2_surf->base.Height - y - h;
if (size < max_req_len) {
cookie = xcb_put_image(
dri2_dpy->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, dri2_surf->drawable, gc, w,