From 4d173c5333890497f505e6f2f7d4cd76d04ec35a Mon Sep 17 00:00:00 2001 From: jhb Date: Thu, 9 May 2019 20:30:35 +0000 Subject: [PATCH] MFC 333235: Allow arbitrary numbers of columns for VNC server screen resolution. The prior code only allowed multiples of 32 for the numbers of columns. Remove this restriction to allow a forthcoming UEFI firmware update to allow arbitrary x,y resolutions. (the code for handling rows already supported non mult-32 values) --- usr.sbin/bhyve/rfb.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c index 0c023dc464c..6dab5255c8a 100644 --- a/usr.sbin/bhyve/rfb.c +++ b/usr.sbin/bhyve/rfb.c @@ -544,16 +544,21 @@ rfb_send_screen(struct rfb_softc *rc, int cfd, int all) } for (x = 0; x < xcells; x++) { + if (x == (xcells - 1) && rem_x > 0) + cellwidth = rem_x; + else + cellwidth = PIX_PER_CELL; + if (rc->hw_crc) crc_p[x] = fast_crc32(p, - PIX_PER_CELL * sizeof(uint32_t), + cellwidth * sizeof(uint32_t), crc_p[x]); else crc_p[x] = (uint32_t)crc32(crc_p[x], (Bytef *)p, - PIX_PER_CELL * sizeof(uint32_t)); + cellwidth * sizeof(uint32_t)); - p += PIX_PER_CELL; + p += cellwidth; /* check for crc delta if last row in cell */ if ((y & PIXCELL_MASK) == PIXCELL_MASK || y == (h-1)) { @@ -566,28 +571,6 @@ rfb_send_screen(struct rfb_softc *rc, int cfd, int all) } } } - - if (rem_x) { - if (rc->hw_crc) - crc_p[x] = fast_crc32(p, - rem_x * sizeof(uint32_t), - crc_p[x]); - else - crc_p[x] = (uint32_t)crc32(crc_p[x], - (Bytef *)p, - rem_x * sizeof(uint32_t)); - p += rem_x; - - if ((y & PIXCELL_MASK) == PIXCELL_MASK || y == (h-1)) { - if (orig_crc[x] != crc_p[x]) { - orig_crc[x] = crc_p[x]; - crc_p[x] = 1; - changes++; - } else { - crc_p[x] = 0; - } - } - } } /* If number of changes is > THRESH percent, send the whole screen */ -- 2.45.0