vga.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. /* VGA: VESA LFB (from boot) with a shadow buffer and a damage-rect flush. */
  2. #include "vga.h"
  3. #include "pci.h"
  4. #include "gpu.h"
  5. #include "ati.h"
  6. /* Cached boot framebuffer info (set once when vga_fb_* first used). */
  7. static unsigned int vga_fb_w, vga_fb_h, vga_fb_pitch_val, vga_fb_bpp_val;
  8. static unsigned int vga_fb_vram_kb_val;
  9. static volatile unsigned char *vga_fb_lfb;
  10. static int vga_fb_cached;
  11. /* Shadow buffer state. */
  12. static unsigned char *vga_shadow_buf;
  13. static unsigned int vga_shadow_pitch;
  14. static unsigned int vga_shadow_size;
  15. /* Damage rect list. Each entry is a half-open [x0,x1) x [y0,y1) region of
  16. * the shadow buffer that has not been copied to VRAM yet. Entries merge when
  17. * they overlap, touch or would barely waste space, so related marks (the
  18. * per-pixel writes of one glyph or cursor draw, the rectangles of one window
  19. * repaint) collapse into a few rects, while unrelated damage (a window and the
  20. * cursor on the other side of the screen) stays separate and the flush copies
  21. * each row only over the columns that changed. A rect that is only partially
  22. * flushed keeps its remaining rows and moves behind the newer damage. */
  23. #define DAMAGE_SLOTS 16
  24. struct damage_rect {
  25. unsigned int x0, y0, x1, y1;
  26. };
  27. static struct damage_rect damage_rects[DAMAGE_SLOTS];
  28. static unsigned int damage_count;
  29. static void damage_add(unsigned int x0, unsigned int y0,
  30. unsigned int x1, unsigned int y1)
  31. {
  32. unsigned int i;
  33. if (x1 > vga_fb_w)
  34. x1 = vga_fb_w;
  35. if (y1 > vga_fb_h)
  36. y1 = vga_fb_h;
  37. if (x0 >= x1 || y0 >= y1)
  38. return;
  39. /* Already covered? Scanning backwards catches the repeated per-pixel
  40. marks of a glyph or cursor draw in one step. */
  41. for (i = damage_count; i-- > 0; ) {
  42. struct damage_rect *d = &damage_rects[i];
  43. if (x0 >= d->x0 && y0 >= d->y0 && x1 <= d->x1 && y1 <= d->y1)
  44. return;
  45. }
  46. /* Merge with every rect this one touches; a merge can bring another
  47. rect into reach, so restart the scan after each one. */
  48. for (i = 0; i < damage_count; ) {
  49. struct damage_rect *d = &damage_rects[i];
  50. unsigned int nx0 = (x0 < d->x0) ? x0 : d->x0;
  51. unsigned int ny0 = (y0 < d->y0) ? y0 : d->y0;
  52. unsigned int nx1 = (x1 > d->x1) ? x1 : d->x1;
  53. unsigned int ny1 = (y1 > d->y1) ? y1 : d->y1;
  54. unsigned int merged_area = (nx1 - nx0) * (ny1 - ny0);
  55. unsigned int area = (d->x1 - d->x0) * (d->y1 - d->y0) +
  56. (x1 - x0) * (y1 - y0);
  57. if (nx0 <= d->x1 && d->x0 <= nx1 &&
  58. ny0 <= d->y1 && d->y0 <= ny1 &&
  59. merged_area <= 2 * area) {
  60. x0 = nx0;
  61. y0 = ny0;
  62. x1 = nx1;
  63. y1 = ny1;
  64. damage_rects[i] = damage_rects[--damage_count];
  65. i = 0;
  66. continue;
  67. }
  68. i++;
  69. }
  70. if (damage_count < DAMAGE_SLOTS) {
  71. damage_rects[damage_count].x0 = x0;
  72. damage_rects[damage_count].y0 = y0;
  73. damage_rects[damage_count].x1 = x1;
  74. damage_rects[damage_count].y1 = y1;
  75. damage_count++;
  76. return;
  77. }
  78. /* List full: extend whichever rect grows the least (correct, just a
  79. few redundant pixels copied). */
  80. {
  81. unsigned int best = 0, best_grow = 0xFFFFFFFFu;
  82. for (i = 0; i < DAMAGE_SLOTS; i++) {
  83. struct damage_rect *d = &damage_rects[i];
  84. unsigned int nx0 = (x0 < d->x0) ? x0 : d->x0;
  85. unsigned int ny0 = (y0 < d->y0) ? y0 : d->y0;
  86. unsigned int nx1 = (x1 > d->x1) ? x1 : d->x1;
  87. unsigned int ny1 = (y1 > d->y1) ? y1 : d->y1;
  88. unsigned int grow = (nx1 - nx0) * (ny1 - ny0) -
  89. (d->x1 - d->x0) * (d->y1 - d->y0);
  90. if (grow < best_grow) {
  91. best_grow = grow;
  92. best = i;
  93. }
  94. }
  95. {
  96. struct damage_rect *d = &damage_rects[best];
  97. if (x0 < d->x0) d->x0 = x0;
  98. if (y0 < d->y0) d->y0 = y0;
  99. if (x1 > d->x1) d->x1 = x1;
  100. if (y1 > d->y1) d->y1 = y1;
  101. }
  102. }
  103. }
  104. static int damage_any(void)
  105. {
  106. return damage_count != 0;
  107. }
  108. static void damage_clear(void)
  109. {
  110. damage_count = 0;
  111. }
  112. static void mark_dirty_rect_xy(unsigned int y, unsigned int h,
  113. unsigned int x0, unsigned int x1)
  114. {
  115. damage_add(x0, y, x1, y + h);
  116. }
  117. /* Full-width dirty rows (used where the x-extent isn't tracked). */
  118. static void mark_dirty_rect(unsigned int y, unsigned int h)
  119. {
  120. damage_add(0, y, vga_fb_w, y + h);
  121. }
  122. /*
  123. * Force CRTC Start Address to 0 and Line Compare to max (0x3FF).
  124. * Fixes real hardware where VBE mode set leaves stale CRTC state,
  125. * causing the display to appear rotated (bottom portion at top).
  126. */
  127. static void vga_reset_crtc(void)
  128. {
  129. unsigned char v;
  130. /* Start Address High/Low = 0 */
  131. port_outb(0x3D4, 0x0C);
  132. port_outb(0x3D5, 0x00);
  133. port_outb(0x3D4, 0x0D);
  134. port_outb(0x3D5, 0x00);
  135. /* Unlock CRTC registers 0-7: clear bit 7 of register 0x11 */
  136. port_outb(0x3D4, 0x11);
  137. v = port_inb(0x3D5);
  138. port_outb(0x3D5, v & 0x7F);
  139. /* Line Compare bits 7:0 = 0xFF (register 0x18) */
  140. port_outb(0x3D4, 0x18);
  141. port_outb(0x3D5, 0xFF);
  142. /* Line Compare bit 8 = 1 (register 0x07, bit 4) */
  143. port_outb(0x3D4, 0x07);
  144. v = port_inb(0x3D5);
  145. port_outb(0x3D5, v | 0x10);
  146. /* Line Compare bit 9 = 1 (register 0x09, bit 6) */
  147. port_outb(0x3D4, 0x09);
  148. v = port_inb(0x3D5);
  149. port_outb(0x3D5, v | 0x40);
  150. }
  151. static volatile struct vga_boot_fb_info *vga_get_boot_fb(void)
  152. {
  153. volatile struct vga_boot_fb_info *p = VGA_BOOT_FB;
  154. __asm__ volatile ("" : "+r"(p));
  155. return p;
  156. }
  157. static void vga_cache_boot_fb(void)
  158. {
  159. volatile struct vga_boot_fb_info *info;
  160. if (vga_fb_cached)
  161. return;
  162. vga_fb_cached = 1;
  163. info = vga_get_boot_fb();
  164. if (!info->valid) {
  165. vga_fb_w = vga_fb_h = vga_fb_pitch_val = vga_fb_bpp_val = 0;
  166. vga_fb_lfb = 0;
  167. gpu_init(0);
  168. return;
  169. }
  170. vga_fb_w = info->width;
  171. vga_fb_h = info->height;
  172. vga_fb_pitch_val = info->pitch;
  173. vga_fb_bpp_val = info->bpp;
  174. /* Some BIOSes (e.g. 1024x768) report pitch in pixels or too small; enforce minimum. */
  175. {
  176. unsigned int min_pitch = vga_fb_w;
  177. if (vga_fb_bpp_val == 16)
  178. min_pitch *= 2;
  179. else if (vga_fb_bpp_val == 24)
  180. min_pitch *= 3;
  181. else if (vga_fb_bpp_val == 32)
  182. min_pitch *= 4;
  183. if (vga_fb_pitch_val < min_pitch)
  184. vga_fb_pitch_val = min_pitch;
  185. }
  186. vga_fb_lfb = (volatile unsigned char *)(unsigned long)info->lfb_base;
  187. vga_fb_vram_kb_val = (unsigned int)info->vram_64k * 64;
  188. /* Clamp height to what fits in VRAM (prevents wrap on small VRAM cards) */
  189. if (vga_fb_vram_kb_val > 0 && vga_fb_pitch_val > 0) {
  190. unsigned int vram_bytes = vga_fb_vram_kb_val * 1024;
  191. unsigned int max_h = vram_bytes / vga_fb_pitch_val;
  192. if (max_h < vga_fb_h)
  193. vga_fb_h = max_h;
  194. }
  195. gpu_init(info->lfb_base);
  196. if (gpu_vendor() == GPU_VENDOR_ATI && !ati_is_radeon())
  197. vga_reset_crtc();
  198. }
  199. /* ---- LFB API ---- */
  200. unsigned int vga_fb_width(void)
  201. {
  202. vga_cache_boot_fb();
  203. return vga_fb_w;
  204. }
  205. unsigned int vga_fb_height(void)
  206. {
  207. vga_cache_boot_fb();
  208. return vga_fb_h;
  209. }
  210. unsigned int vga_fb_pitch(void)
  211. {
  212. vga_cache_boot_fb();
  213. return vga_fb_pitch_val;
  214. }
  215. unsigned int vga_fb_bpp(void)
  216. {
  217. vga_cache_boot_fb();
  218. return vga_fb_bpp_val;
  219. }
  220. unsigned int vga_fb_vram_kb(void)
  221. {
  222. vga_cache_boot_fb();
  223. return vga_fb_vram_kb_val;
  224. }
  225. unsigned int vga_fb_pci_id(void)
  226. {
  227. vga_cache_boot_fb();
  228. return gpu_pci_id();
  229. }
  230. void *vga_fb_ptr(void)
  231. {
  232. vga_cache_boot_fb();
  233. if (vga_shadow_buf)
  234. return (void *)vga_shadow_buf;
  235. return (void *)vga_fb_lfb;
  236. }
  237. unsigned long vga_fb_lfb_addr(void)
  238. {
  239. vga_cache_boot_fb();
  240. return (unsigned long)vga_fb_lfb;
  241. }
  242. int vga_has_vesa(void)
  243. {
  244. vga_cache_boot_fb();
  245. return (vga_fb_w != 0 && vga_fb_lfb != 0);
  246. }
  247. /* 16bpp: RGB 5:6:5. 32bpp: BGRX byte order (standard VBE / QEMU). */
  248. static void shadow_put_pixel(unsigned int x, unsigned int y, unsigned int r, unsigned int g, unsigned int b)
  249. {
  250. unsigned int pitch = vga_shadow_pitch;
  251. unsigned int bpp = vga_fb_bpp_val;
  252. unsigned char *p;
  253. if (x >= vga_fb_w || y >= vga_fb_h || !vga_shadow_buf)
  254. return;
  255. p = vga_shadow_buf + (unsigned long)y * pitch;
  256. if (bpp == 16) {
  257. unsigned int rgb16 = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
  258. unsigned int off = x * 2;
  259. p[off] = (unsigned char)(rgb16 & 0xFF);
  260. p[off + 1] = (unsigned char)(rgb16 >> 8);
  261. } else if (bpp == 24) {
  262. unsigned int off = x * 3;
  263. p[off] = (unsigned char)b;
  264. p[off + 1] = (unsigned char)g;
  265. p[off + 2] = (unsigned char)r;
  266. } else if (bpp == 32) {
  267. unsigned int off = x * 4;
  268. p[off] = (unsigned char)b;
  269. p[off + 1] = (unsigned char)g;
  270. p[off + 2] = (unsigned char)r;
  271. p[off + 3] = 0;
  272. }
  273. mark_dirty_rect_xy(y, 1, x, x + 1);
  274. }
  275. void vga_put_pixel_rgb(unsigned int x, unsigned int y, unsigned int r, unsigned int g, unsigned int b)
  276. {
  277. vga_cache_boot_fb();
  278. if (!vga_shadow_buf)
  279. return;
  280. shadow_put_pixel(x, y, r, g, b);
  281. }
  282. void vga_fill_rect(unsigned int x, unsigned int y, unsigned int w, unsigned int h,
  283. unsigned int r, unsigned int g, unsigned int b)
  284. {
  285. unsigned int row, x1, y1;
  286. unsigned int pitch;
  287. unsigned int bpp;
  288. unsigned char *fb;
  289. vga_cache_boot_fb();
  290. pitch = vga_shadow_pitch;
  291. bpp = vga_fb_bpp_val;
  292. fb = vga_shadow_buf;
  293. if (!fb || w == 0 || h == 0)
  294. return;
  295. if (x >= vga_fb_w || y >= vga_fb_h)
  296. return;
  297. x1 = x + w;
  298. y1 = y + h;
  299. if (x1 > vga_fb_w) x1 = vga_fb_w;
  300. if (y1 > vga_fb_h) y1 = vga_fb_h;
  301. if (bpp == 16) {
  302. unsigned short val = (unsigned short)(((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3));
  303. for (row = y; row < y1; row++) {
  304. unsigned short *p = (unsigned short *)(fb + (unsigned long)row * pitch + x * 2);
  305. unsigned int xx;
  306. for (xx = x; xx < x1; xx++)
  307. *p++ = val;
  308. }
  309. } else if (bpp == 24) {
  310. for (row = y; row < y1; row++) {
  311. unsigned char *p = fb + (unsigned long)row * pitch + x * 3;
  312. unsigned int xx;
  313. for (xx = x; xx < x1; xx++) {
  314. p[0] = (unsigned char)b;
  315. p[1] = (unsigned char)g;
  316. p[2] = (unsigned char)r;
  317. p += 3;
  318. }
  319. }
  320. } else {
  321. unsigned int val = ((unsigned int)r << 16) | ((unsigned int)g << 8) | b;
  322. for (row = y; row < y1; row++) {
  323. unsigned int *p = (unsigned int *)(fb + (unsigned long)row * pitch + x * 4);
  324. unsigned int xx;
  325. for (xx = x; xx < x1; xx++)
  326. *p++ = val;
  327. }
  328. }
  329. mark_dirty_rect_xy(y, y1 - y, x, x1);
  330. }
  331. static unsigned int vga_pixel_bytes(void)
  332. {
  333. if (vga_fb_bpp_val == 16)
  334. return 2;
  335. if (vga_fb_bpp_val == 24)
  336. return 3;
  337. return 4;
  338. }
  339. void vga_fb_read_rect(unsigned int x, unsigned int y, unsigned int w, unsigned int h,
  340. unsigned char *buf)
  341. {
  342. unsigned int pitch, pb, row, col;
  343. unsigned char *fb;
  344. const unsigned char *src;
  345. vga_cache_boot_fb();
  346. if (!vga_shadow_buf || vga_fb_w == 0 || w == 0 || h == 0)
  347. return;
  348. pitch = vga_shadow_pitch;
  349. pb = vga_pixel_bytes();
  350. fb = vga_shadow_buf;
  351. for (row = 0; row < h; row++) {
  352. src = fb + (unsigned long)(y + row) * pitch + x * pb;
  353. for (col = 0; col < w * pb; col++)
  354. buf[row * w * pb + col] = src[col];
  355. }
  356. }
  357. void vga_fb_write_rect(unsigned int x, unsigned int y, unsigned int w, unsigned int h,
  358. const unsigned char *buf)
  359. {
  360. unsigned int pitch, pb, row, col;
  361. unsigned char *dst;
  362. vga_cache_boot_fb();
  363. if (!vga_shadow_buf || vga_fb_w == 0 || w == 0 || h == 0)
  364. return;
  365. pitch = vga_shadow_pitch;
  366. pb = vga_pixel_bytes();
  367. for (row = 0; row < h; row++) {
  368. dst = vga_shadow_buf + (unsigned long)(y + row) * pitch + x * pb;
  369. for (col = 0; col < w * pb; col++)
  370. dst[col] = buf[row * w * pb + col];
  371. }
  372. {
  373. unsigned int xe = x + w;
  374. if (xe > vga_fb_w)
  375. xe = vga_fb_w;
  376. mark_dirty_rect_xy(y, h, x, xe);
  377. }
  378. }
  379. void vga_clear_rgb(unsigned int r, unsigned int g, unsigned int b)
  380. {
  381. unsigned int pitch = vga_shadow_pitch;
  382. unsigned int bpp = vga_fb_bpp_val;
  383. vga_cache_boot_fb();
  384. if (!vga_shadow_buf)
  385. return;
  386. if (bpp == 16) {
  387. unsigned int rgb16 = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
  388. unsigned short val = (unsigned short)((rgb16 & 0xFF) | ((rgb16 >> 8) << 8));
  389. unsigned short *fb = (unsigned short *)vga_shadow_buf;
  390. unsigned int n = (pitch / 2) * vga_fb_h;
  391. unsigned int i;
  392. for (i = 0; i < n; i++)
  393. fb[i] = val;
  394. } else if (bpp == 24) {
  395. unsigned char *p = vga_shadow_buf;
  396. unsigned int row, x;
  397. for (row = 0; row < vga_fb_h; row++) {
  398. unsigned int row_off = row * pitch;
  399. for (x = 0; x < vga_fb_w; x++) {
  400. unsigned int off = row_off + x * 3;
  401. p[off] = (unsigned char)b;
  402. p[off + 1] = (unsigned char)g;
  403. p[off + 2] = (unsigned char)r;
  404. }
  405. }
  406. } else if (bpp == 32) {
  407. unsigned int *fb = (unsigned int *)vga_shadow_buf;
  408. unsigned int pixel = ((unsigned int)r << 16) | ((unsigned int)g << 8) | b;
  409. unsigned int stride = pitch / 4;
  410. unsigned int row, x;
  411. for (row = 0; row < vga_fb_h; row++)
  412. for (x = 0; x < vga_fb_w; x++)
  413. fb[row * stride + x] = pixel;
  414. }
  415. mark_dirty_rect(0, vga_fb_h);
  416. }
  417. /* ---- Shadow buffer init and flush ---- */
  418. /* Assembly row copy: rep movsl optimized for P5 USWC write-combining to UC memory. */
  419. extern void vga_fb_copy_row(void *dst, void *src, unsigned int dwords);
  420. void vga_shadow_init(void)
  421. {
  422. vga_cache_boot_fb();
  423. if (!vga_fb_lfb || vga_fb_w == 0 || vga_fb_h == 0)
  424. return;
  425. vga_shadow_buf = (unsigned char *)VGA_SHADOW_BASE;
  426. vga_shadow_pitch = vga_fb_pitch_val;
  427. vga_shadow_size = vga_fb_h * vga_shadow_pitch;
  428. damage_clear();
  429. }
  430. /* Copy damage rects from the shadow to VRAM, at most about `max_bytes` this
  431. * call (0 = no limit), and drop the rects that are done. A rect that fits
  432. * the budget is copied whole even when that overshoots a little, so a
  433. * window-sized repaint is never split across iterations; only a rect larger
  434. * than the budget (a full-screen repaint) is chunked, and its remaining rows
  435. * move to the back of the list so newer, smaller damage is flushed first. */
  436. static unsigned int shadow_copy_damage(unsigned int max_bytes)
  437. {
  438. unsigned int i = 0, bytes = 0;
  439. unsigned int pb = vga_pixel_bytes();
  440. unsigned int align = (pb == 2) ? 2 : (pb == 3) ? 4 : 1;
  441. unsigned char *src = vga_shadow_buf;
  442. unsigned char *dst = (unsigned char *)vga_fb_lfb;
  443. while (i < damage_count) {
  444. struct damage_rect *d = &damage_rects[i];
  445. unsigned int rx0 = d->x0 & ~(align - 1);
  446. unsigned int rx1 = (d->x1 + align - 1) & ~(align - 1);
  447. unsigned int row_bytes, rect_bytes, dwords, tail, y;
  448. if (rx1 > vga_fb_w)
  449. rx1 = vga_fb_w;
  450. if (rx0 >= rx1) {
  451. damage_rects[i] = damage_rects[--damage_count];
  452. continue;
  453. }
  454. row_bytes = (rx1 - rx0) * pb;
  455. rect_bytes = row_bytes * (d->y1 - d->y0);
  456. dwords = row_bytes / 4;
  457. tail = row_bytes % 4;
  458. /* The budget is spent and this rect is bigger than a whole
  459. call: leave it (rows already copied keep their progress). */
  460. if (max_bytes && bytes > 0 && rect_bytes > max_bytes)
  461. break;
  462. for (y = d->y0; y < d->y1; y++) {
  463. unsigned char *s = src + (unsigned long)y * vga_shadow_pitch + rx0 * pb;
  464. unsigned char *t = dst + (unsigned long)y * vga_fb_pitch_val + rx0 * pb;
  465. vga_fb_copy_row(t, s, dwords);
  466. if (tail) {
  467. unsigned int k;
  468. for (k = dwords * 4; k < row_bytes; k++)
  469. t[k] = s[k];
  470. }
  471. bytes += row_bytes;
  472. if (max_bytes && rect_bytes > max_bytes && bytes >= max_bytes) {
  473. d->y0 = y + 1;
  474. break;
  475. }
  476. }
  477. if (y < d->y1) {
  478. /* Chunked: keep the remaining rows, behind the rest. */
  479. struct damage_rect rest = *d;
  480. damage_rects[i] = damage_rects[--damage_count];
  481. damage_rects[damage_count++] = rest;
  482. return bytes;
  483. }
  484. damage_rects[i] = damage_rects[--damage_count];
  485. if (max_bytes && bytes >= max_bytes)
  486. break;
  487. }
  488. return bytes;
  489. }
  490. /* Copy up to `max_bytes` of the pending damage to VRAM. Called from the
  491. * main loop on every iteration: small updates (a cursor move is ~1 KB) reach
  492. * the screen within one loop instead of waiting for a fixed 30 Hz tick, while
  493. * a full-screen repaint is chunked so it cannot stall input. */
  494. void vga_fb_flush_budget(unsigned int max_bytes)
  495. {
  496. vga_cache_boot_fb();
  497. if (!vga_shadow_buf || !vga_fb_lfb)
  498. return;
  499. if (!damage_any())
  500. return;
  501. shadow_copy_damage(max_bytes);
  502. }
  503. void vga_fb_flush(void)
  504. {
  505. vga_fb_flush_budget(0);
  506. }
  507. int vga_shadow_is_active(void)
  508. {
  509. return vga_shadow_buf != 0;
  510. }
  511. void vga_fb_mark_dirty_rect(unsigned int y, unsigned int h)
  512. {
  513. vga_cache_boot_fb();
  514. mark_dirty_rect(y, h);
  515. }
  516. /* Mark a rectangle dirty, limited to the horizontal span [x0, x1). */
  517. void vga_fb_mark_dirty_rect_xy(unsigned int y, unsigned int h,
  518. unsigned int x0, unsigned int x1)
  519. {
  520. vga_cache_boot_fb();
  521. mark_dirty_rect_xy(y, h, x0, x1);
  522. }
  523. void vga_fb_clear_dirty(void)
  524. {
  525. damage_clear();
  526. }