plymouth uses a shadow framebuffer to cache screen contents for
quick compositing. This shadow framebuffer may or may not have
the same memory layout as the hardware framebuffer. In cases
where the size and layout of pixels are the same between the shadow
framebuffer and the hardware framebuffer we can memcpy()
the pixels line-by-line to the hardware. If the width of area being
flushed is the same number of bytes as the width of the hardware buffer,
then we can memcpy() the entire flush area in one call to memcpy.
The check for this latter fast-path has a miscalculation that tests
the number of pixels in the flush area width to number of bytes in the
buffer width. This commit adds the * 4 multiplier to correctly compare
bytes with bytes instead of pixels with bytes.
This commit also adds a sanity check to make sure the byte size of the
hardware framebuffer width is equal to the advertised row stride.
dst = &head->map_address[y1 * backend->row_stride + x * backend->bytes_per_pixel];
src = (char *) &shadow_buffer[y1 * head->area.width + x];
- if (area_to_flush->width == backend->row_stride)
+ if (area_to_flush->width * 4 == backend->row_stride &&
+ head->area.width * 4 == backend->row_stride)
{
memcpy (dst, src, area_to_flush->width * area_to_flush->height * 4);
return;