u32 x2 = info->var.xres;
u32 y2 = DIV_ROUND_UP(end, info->fix.line_length);
+ if ((y2 - y1) == 1) {
+ /*
+ * We've only written to a single scanline. Try to reduce
+ * the number of horizontal pixels that need an update.
+ */
+ off_t bit_off = (off % info->fix.line_length) * 8;
+ off_t bit_end = (end % info->fix.line_length) * 8;
+
+ x1 = bit_off / info->var.bits_per_pixel;
+ x2 = DIV_ROUND_UP(bit_end, info->var.bits_per_pixel);
+ }
+
drm_rect_init(clip, x1, y1, x2 - x1, y2 - y1);
}