From 389e83c4fec180cfd566c504840c915c7c87a668 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 12 Feb 2024 14:00:44 -0500 Subject: [PATCH] drisw/xlib: loop over all the boxes in display() hook Acked-by: Daniel Stone Part-of: --- src/gallium/winsys/sw/xlib/xlib_sw_winsys.c | 51 +++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c index 9b257bcb184..de6f872615d 100644 --- a/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c +++ b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c @@ -315,7 +315,8 @@ xlib_sw_display(struct xlib_drawable *xlib_drawable, if (no_swap) return; - if (nboxes != 1) { + if (!nboxes) { + nboxes = 1; _box.width = xlib_dt->width; _box.height = xlib_dt->height; box = &_box; @@ -350,33 +351,35 @@ xlib_sw_display(struct xlib_drawable *xlib_drawable, XSetFunction(display, xlib_dt->gc, GXcopy); } - if (xlib_dt->shm) { - ximage = xlib_dt->tempImage; - ximage->data = xlib_dt->data; + for (unsigned i = 0; i < nboxes; i++) { + if (xlib_dt->shm) { + ximage = xlib_dt->tempImage; + ximage->data = xlib_dt->data; - /* _debug_printf("XSHM\n"); */ - XShmPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc, - ximage, box->x, box->y, box->x, box->y, - box->width, box->height, False); - } - else { - /* display image in Window */ - ximage = xlib_dt->tempImage; - ximage->data = xlib_dt->data; + /* _debug_printf("XSHM\n"); */ + XShmPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc, + ximage, box[i].x, box[i].y, box[i].x, box[i].y, + box[i].width, box[i].height, False); + } + else { + /* display image in Window */ + ximage = xlib_dt->tempImage; + ximage->data = xlib_dt->data; - /* check that the XImage has been previously initialized */ - assert(ximage->format); - assert(ximage->bitmap_unit); + /* check that the XImage has been previously initialized */ + assert(ximage->format); + assert(ximage->bitmap_unit); - /* update XImage's fields */ - ximage->width = xlib_dt->width; - ximage->height = xlib_dt->height; - ximage->bytes_per_line = xlib_dt->stride; + /* update XImage's fields */ + ximage->width = xlib_dt->width; + ximage->height = xlib_dt->height; + ximage->bytes_per_line = xlib_dt->stride; - /* _debug_printf("XPUT\n"); */ - XPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc, - ximage, box->x, box->y, box->x, box->y, - box->width, box->height); + /* _debug_printf("XPUT\n"); */ + XPutImage(xlib_dt->display, xlib_drawable->drawable, xlib_dt->gc, + ximage, box[i].x, box[i].y, box[i].x, box[i].y, + box[i].width, box[i].height); + } } XFlush(xlib_dt->display);