Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyve/rfb.c
Show First 20 Lines • Show All 535 Lines • ▼ Show 20 Lines | rfb_send_screen(struct rfb_softc *rc, int cfd, int all) | ||||
memset(rc->crc_tmp, 0, sizeof(uint32_t) * xcells * ycells); | memset(rc->crc_tmp, 0, sizeof(uint32_t) * xcells * ycells); | ||||
for (y = 0; y < h; y++) { | for (y = 0; y < h; y++) { | ||||
if ((y & PIXCELL_MASK) == 0) { | if ((y & PIXCELL_MASK) == 0) { | ||||
crc_p += xcells; | crc_p += xcells; | ||||
orig_crc += xcells; | orig_crc += xcells; | ||||
} | } | ||||
for (x = 0; x < xcells; x++) { | for (x = 0; x < xcells; x++) { | ||||
if (rc->hw_crc) | if (x == (xcells - 1) && rem_x > 0) | ||||
crc_p[x] = fast_crc32(p, | cellwidth = rem_x; | ||||
PIX_PER_CELL * sizeof(uint32_t), | |||||
crc_p[x]); | |||||
else | else | ||||
crc_p[x] = (uint32_t)crc32(crc_p[x], | cellwidth = PIX_PER_CELL; | ||||
(Bytef *)p, | |||||
PIX_PER_CELL * sizeof(uint32_t)); | |||||
p += PIX_PER_CELL; | |||||
/* check for crc delta if last row in cell */ | |||||
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 (rem_x) { | |||||
if (rc->hw_crc) | if (rc->hw_crc) | ||||
crc_p[x] = fast_crc32(p, | crc_p[x] = fast_crc32(p, | ||||
rem_x * sizeof(uint32_t), | cellwidth * sizeof(uint32_t), | ||||
crc_p[x]); | crc_p[x]); | ||||
else | else | ||||
crc_p[x] = (uint32_t)crc32(crc_p[x], | crc_p[x] = (uint32_t)crc32(crc_p[x], | ||||
(Bytef *)p, | (Bytef *)p, | ||||
rem_x * sizeof(uint32_t)); | cellwidth * sizeof(uint32_t)); | ||||
p += rem_x; | |||||
p += cellwidth; | |||||
/* check for crc delta if last row in cell */ | |||||
if ((y & PIXCELL_MASK) == PIXCELL_MASK || y == (h-1)) { | if ((y & PIXCELL_MASK) == PIXCELL_MASK || y == (h-1)) { | ||||
if (orig_crc[x] != crc_p[x]) { | if (orig_crc[x] != crc_p[x]) { | ||||
orig_crc[x] = crc_p[x]; | orig_crc[x] = crc_p[x]; | ||||
crc_p[x] = 1; | crc_p[x] = 1; | ||||
changes++; | changes++; | ||||
} else { | } else { | ||||
crc_p[x] = 0; | crc_p[x] = 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 462 Lines • Show Last 20 Lines |