wcfb.c revision 1.7.2.1 1 /* $NetBSD: wcfb.c,v 1.7.2.1 2011/06/06 09:08:28 jruoho Exp $ */
2
3 /*-
4 * Copyright (c) 2010 Michael Lorenz
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.7.2.1 2011/06/06 09:08:28 jruoho Exp $");
31
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/kernel.h>
35 #include <sys/device.h>
36 #include <sys/proc.h>
37 #include <sys/mutex.h>
38 #include <sys/ioctl.h>
39 #include <sys/kernel.h>
40 #include <sys/systm.h>
41 #include <sys/kauth.h>
42 #include <sys/kmem.h>
43
44 #include <dev/pci/pcidevs.h>
45 #include <dev/pci/pcireg.h>
46 #include <dev/pci/pcivar.h>
47 #include <dev/pci/pciio.h>
48 #include <dev/pci/wcfbreg.h>
49
50 #include <dev/wscons/wsdisplayvar.h>
51 #include <dev/wscons/wsconsio.h>
52 #include <dev/wsfont/wsfont.h>
53 #include <dev/rasops/rasops.h>
54 #include <dev/wscons/wsdisplay_vconsvar.h>
55 #include <dev/pci/wsdisplay_pci.h>
56
57 #include "opt_wsfb.h"
58 #include "opt_wsdisplay_compat.h"
59
60 #ifdef WCFB_DEBUG
61 # define DPRINTF printf
62 #else
63 # define DPRINTF while (0) printf
64 #endif
65
66 static int wcfb_match(device_t, cfdata_t, void *);
67 static void wcfb_attach(device_t, device_t, void *);
68 static int wcfb_ioctl(void *, void *, u_long, void *, int,
69 struct lwp *);
70 static paddr_t wcfb_mmap(void *, void *, off_t, int);
71
72 struct wcfb_softc {
73 device_t sc_dev;
74
75 pci_chipset_tag_t sc_pc;
76 pcitag_t sc_pcitag;
77
78 bus_space_tag_t sc_memt;
79 bus_space_tag_t sc_regt, sc_wtft;
80 bus_space_tag_t sc_iot;
81
82 bus_space_handle_t sc_fbh, sc_wtfh;
83 bus_space_handle_t sc_regh;
84 bus_addr_t sc_fb, sc_reg, sc_wtf;
85 bus_size_t sc_fbsize, sc_regsize, sc_wtfsize;
86
87 int sc_width, sc_height, sc_stride;
88 int sc_locked;
89 uint8_t *sc_fbaddr, *sc_fb0, *sc_fb1, *sc_shadow;
90 struct vcons_screen sc_console_screen;
91 struct wsscreen_descr sc_defaultscreen_descr;
92 const struct wsscreen_descr *sc_screens[1];
93 struct wsscreen_list sc_screenlist;
94 struct vcons_data vd;
95 int sc_mode;
96 u_char sc_cmap_red[256];
97 u_char sc_cmap_green[256];
98 u_char sc_cmap_blue[256];
99 uint32_t sc_fb0off, sc_fb1off;
100
101 void (*copycols)(void *, int, int, int, int);
102 void (*erasecols)(void *, int, int, int, long);
103 void (*copyrows)(void *, int, int, int);
104 void (*eraserows)(void *, int, int, long);
105 void (*putchar)(void *, int, int, u_int, long);
106 void (*cursor)(void *, int, int, int);
107
108 };
109
110 static void wcfb_init_screen(void *, struct vcons_screen *, int, long *);
111
112 CFATTACH_DECL_NEW(wcfb, sizeof(struct wcfb_softc),
113 wcfb_match, wcfb_attach, NULL, NULL);
114
115 struct wsdisplay_accessops wcfb_accessops = {
116 wcfb_ioctl,
117 wcfb_mmap,
118 NULL, /* alloc_screen */
119 NULL, /* free_screen */
120 NULL, /* show_screen */
121 NULL, /* load_font */
122 NULL, /* pollc */
123 NULL /* scroll */
124 };
125
126 static void wcfb_putchar(void *, int, int, u_int, long);
127 static void wcfb_cursor(void *, int, int, int);
128 static void wcfb_copycols(void *, int, int, int, int);
129 static void wcfb_erasecols(void *, int, int, int, long);
130 static void wcfb_copyrows(void *, int, int, int);
131 static void wcfb_eraserows(void *, int, int, long);
132
133 static void wcfb_putpalreg(struct wcfb_softc *, int, int, int, int);
134
135 static int
136 wcfb_match(device_t parent, cfdata_t match, void *aux)
137 {
138 struct pci_attach_args *pa = aux;
139
140 if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3DLABS &&
141 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_3DLABS_WILDCAT5110)
142 return 100;
143
144 return 0;
145 }
146
147 static void
148 wcfb_attach(device_t parent, device_t self, void *aux)
149 {
150 struct wcfb_softc *sc = device_private(self);
151 struct pci_attach_args *pa = aux;
152 struct rasops_info *ri;
153 prop_dictionary_t dict;
154 struct wsemuldisplaydev_attach_args aa;
155 int i, j;
156 uint32_t reg;
157 unsigned long defattr;
158 bool is_console = 0;
159 char devinfo[256];
160 void *wtf;
161
162 sc->sc_dev = self;
163 sc->putchar = NULL;
164 pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
165 aprint_naive("\n");
166 aprint_normal(": %s\n", devinfo);
167
168 dict = device_properties(self);
169 prop_dictionary_get_bool(dict, "is_console", &is_console);
170 #ifndef WCFB_DEBUG
171 if (!is_console) return;
172 #endif
173 sc->sc_memt = pa->pa_memt;
174 sc->sc_iot = pa->pa_iot;
175 sc->sc_pc = pa->pa_pc;
176 sc->sc_pcitag = pa->pa_tag;
177
178 if (pci_mapreg_map(pa, 0x14, PCI_MAPREG_TYPE_MEM, 0,
179 &sc->sc_regt, &sc->sc_regh, &sc->sc_reg, &sc->sc_regsize)) {
180 aprint_error("%s: failed to map registers.\n",
181 device_xname(sc->sc_dev));
182 }
183
184 if (pci_mapreg_map(pa, 0x10, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR,
185 &sc->sc_memt, &sc->sc_fbh, &sc->sc_fb, &sc->sc_fbsize)) {
186 aprint_error("%s: failed to map framebuffer.\n",
187 device_xname(sc->sc_dev));
188 }
189
190 if (pci_mapreg_map(pa, 0x18, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR,
191 &sc->sc_wtft, &sc->sc_wtfh, &sc->sc_wtf, &sc->sc_wtfsize)) {
192 aprint_error("%s: failed to map wtf.\n",
193 device_xname(sc->sc_dev));
194 }
195 wtf = bus_space_vaddr(sc->sc_wtft, sc->sc_wtfh);
196 memset(wtf, 0, 0x100000);
197
198 sc->sc_fbaddr = bus_space_vaddr(sc->sc_memt, sc->sc_fbh);
199
200 sc->sc_fb0off =
201 bus_space_read_4(sc->sc_regt, sc->sc_regh, WC_FB8_ADDR0) - sc->sc_fb;
202 sc->sc_fb0 = sc->sc_fbaddr + sc->sc_fb0off;
203 sc->sc_fb1off =
204 bus_space_read_4(sc->sc_regt, sc->sc_regh, WC_FB8_ADDR1) - sc->sc_fb;
205 sc->sc_fb1 = sc->sc_fbaddr + sc->sc_fb1off;
206
207 reg = bus_space_read_4(sc->sc_regt, sc->sc_regh, WC_RESOLUTION);
208 sc->sc_height = (reg >> 16) + 1;
209 sc->sc_width = (reg & 0xffff) + 1;
210 sc->sc_stride = 1 <<
211 ((bus_space_read_4(sc->sc_regt, sc->sc_regh, WC_CONFIG) &
212 0x00ff0000) >> 16);
213 printf("%s: %d x %d, %d\n", device_xname(sc->sc_dev),
214 sc->sc_width, sc->sc_height, sc->sc_stride);
215
216 sc->sc_shadow = kmem_alloc(sc->sc_stride * sc->sc_height, KM_SLEEP);
217 if (sc->sc_shadow == NULL) {
218 printf("%s: failed to allocate shadow buffer\n",
219 device_xname(self));
220 return;
221 }
222
223 for (i = 0x40; i < 0x100; i += 16) {
224 printf("%04x:", i);
225 for (j = 0; j < 16; j += 4) {
226 printf(" %08x", bus_space_read_4(sc->sc_regt,
227 sc->sc_regh, 0x8000 + i + j));
228 }
229 printf("\n");
230 }
231
232 /* make sure video output is on */
233 bus_space_write_4(sc->sc_regt, sc->sc_regh, WC_DPMS_STATE, WC_DPMS_ON);
234
235 sc->sc_defaultscreen_descr = (struct wsscreen_descr){
236 "default",
237 0, 0,
238 NULL,
239 8, 16,
240 WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
241 NULL
242 };
243 sc->sc_screens[0] = &sc->sc_defaultscreen_descr;
244 sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens};
245 sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
246 sc->sc_locked = 0;
247
248 vcons_init(&sc->vd, sc, &sc->sc_defaultscreen_descr,
249 &wcfb_accessops);
250 sc->vd.init_screen = wcfb_init_screen;
251
252 /* init engine here */
253 #if 0
254 wcfb_init(sc);
255 #endif
256
257 ri = &sc->sc_console_screen.scr_ri;
258
259 j = 0;
260 for (i = 0; i < 256; i++) {
261
262 sc->sc_cmap_red[i] = rasops_cmap[j];
263 sc->sc_cmap_green[i] = rasops_cmap[j + 1];
264 sc->sc_cmap_blue[i] = rasops_cmap[j + 2];
265 wcfb_putpalreg(sc, i, rasops_cmap[j], rasops_cmap[j + 1],
266 rasops_cmap[j + 2]);
267 j += 3;
268 }
269
270 if (is_console) {
271 vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
272 &defattr);
273 sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
274
275 memset(sc->sc_fb0, ri->ri_devcmap[(defattr >> 16) & 0xff],
276 sc->sc_stride * sc->sc_height);
277 memset(sc->sc_fb1, ri->ri_devcmap[(defattr >> 16) & 0xff],
278 sc->sc_stride * sc->sc_height);
279 sc->sc_defaultscreen_descr.textops = &ri->ri_ops;
280 sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
281 sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
282 sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
283 wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
284 defattr);
285 vcons_replay_msgbuf(&sc->sc_console_screen);
286 } else {
287 /*
288 * since we're not the console we can postpone the rest
289 * until someone actually allocates a screen for us
290 */
291 memset(sc->sc_fb0, WS_DEFAULT_BG,
292 sc->sc_stride * sc->sc_height);
293 memset(sc->sc_fb1, WS_DEFAULT_BG,
294 sc->sc_stride * sc->sc_height);
295 return;
296 }
297
298 aa.console = is_console;
299 aa.scrdata = &sc->sc_screenlist;
300 aa.accessops = &wcfb_accessops;
301 aa.accesscookie = &sc->vd;
302
303 config_found(sc->sc_dev, &aa, wsemuldisplaydevprint);
304 }
305
306 static int
307 wcfb_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
308 struct lwp *l)
309 {
310 struct wcfb_softc *sc = v;
311
312 switch (cmd) {
313 case WSDISPLAYIO_GTYPE:
314 *(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
315 return 0;
316
317 /* PCI config read/write passthrough. */
318 case PCI_IOC_CFGREAD:
319 case PCI_IOC_CFGWRITE:
320 return pci_devioctl(sc->sc_pc, sc->sc_pcitag,
321 cmd, data, flag, l);
322
323 case WSDISPLAYIO_GET_BUSID:
324 return wsdisplayio_busid_pci(sc->sc_dev, sc->sc_pc,
325 sc->sc_pcitag, data);
326
327 case WSDISPLAYIO_SMODE: {
328 /*int new_mode = *(int*)data, i;*/
329 }
330 return 0;
331 }
332
333 return EPASSTHROUGH;
334 }
335
336 static paddr_t
337 wcfb_mmap(void *v, void *vs, off_t offset, int prot)
338 {
339 struct wcfb_softc *sc = v;
340
341 /* no point in allowing a wsfb map if we can't provide one */
342 /*
343 * restrict all other mappings to processes with superuser privileges
344 * or the kernel itself
345 */
346 if (kauth_authorize_generic(kauth_cred_get(), KAUTH_GENERIC_ISSUSER,
347 NULL) != 0) {
348 aprint_normal_dev(sc->sc_dev, "mmap() rejected.\n");
349 return -1;
350 }
351
352 #ifdef WSFB_FAKE_VGA_FB
353 if ((offset >= 0xa0000) && (offset < 0xbffff)) {
354
355 return bus_space_mmap(sc->sc_memt, sc->sc_gen.sc_fboffset,
356 offset - 0xa0000, prot, BUS_SPACE_MAP_LINEAR);
357 }
358 #endif
359
360 return -1;
361 }
362
363 static void
364 wcfb_init_screen(void *cookie, struct vcons_screen *scr,
365 int existing, long *defattr)
366 {
367 struct wcfb_softc *sc = cookie;
368 struct rasops_info *ri = &scr->scr_ri;
369
370 ri->ri_depth = 8;
371 ri->ri_width = sc->sc_width;
372 ri->ri_height = sc->sc_height;
373 ri->ri_stride = sc->sc_stride;
374 ri->ri_flg = RI_CENTER /*| RI_FULLCLEAR*/;
375
376 ri->ri_bits = sc->sc_shadow;
377
378 if (existing) {
379 ri->ri_flg |= RI_CLEAR;
380 }
381
382 rasops_init(ri, sc->sc_height / 8, sc->sc_width / 8);
383 ri->ri_caps = WSSCREEN_WSCOLORS;
384
385 rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
386 sc->sc_width / ri->ri_font->fontwidth);
387
388 ri->ri_hw = scr;
389 sc->putchar = ri->ri_ops.putchar;
390 sc->copyrows = ri->ri_ops.copyrows;
391 sc->eraserows = ri->ri_ops.eraserows;
392 sc->copycols = ri->ri_ops.copycols;
393 sc->erasecols = ri->ri_ops.erasecols;
394
395 ri->ri_ops.copyrows = wcfb_copyrows;
396 ri->ri_ops.copycols = wcfb_copycols;
397 ri->ri_ops.eraserows = wcfb_eraserows;
398 ri->ri_ops.erasecols = wcfb_erasecols;
399 ri->ri_ops.putchar = wcfb_putchar;
400 ri->ri_ops.cursor = wcfb_cursor;
401 }
402
403 static void
404 wcfb_putchar(void *cookie, int row, int col, u_int c, long attr)
405 {
406 struct rasops_info *ri = cookie;
407 struct vcons_screen *scr = ri->ri_hw;
408 struct wcfb_softc *sc = scr->scr_cookie;
409 int offset = (ri->ri_yorigin + row * ri->ri_font->fontheight) *
410 sc->sc_stride + ri->ri_xorigin + col * ri->ri_font->fontwidth;
411 uint8_t *from, *to0, *to1;
412 int i;
413
414 sc->putchar(ri, row, col, c, attr);
415 from = sc->sc_shadow + offset;
416 to0 = sc->sc_fb0 + offset;
417 to1 = sc->sc_fb1 + offset;
418 for (i = 0; i < ri->ri_font->fontheight; i++) {
419 memcpy(to0, from, ri->ri_font->fontwidth);
420 memcpy(to1, from, ri->ri_font->fontwidth);
421 to0 += sc->sc_stride;
422 to1 += sc->sc_stride;
423 from += sc->sc_stride;
424 }
425 }
426
427 static void
428 wcfb_putpalreg(struct wcfb_softc *sc, int i, int r, int g, int b)
429 {
430 uint32_t rgb;
431
432 bus_space_write_4(sc->sc_regt, sc->sc_regh, WC_CMAP_INDEX, i);
433 rgb = (b << 22) | (g << 12) | (r << 2);
434 bus_space_write_4(sc->sc_regt, sc->sc_regh, WC_CMAP_DATA, rgb);
435 }
436
437 static void
438 wcfb_cursor(void *cookie, int on, int row, int col)
439 {
440 struct rasops_info *ri = cookie;
441 struct vcons_screen *scr = ri->ri_hw;
442 struct wcfb_softc *sc = scr->scr_cookie;
443 int coffset;
444
445 if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
446
447 if (ri->ri_flg & RI_CURSOR) {
448 /* remove cursor */
449 coffset = ri->ri_ccol + (ri->ri_crow * ri->ri_cols);
450 #ifdef WSDISPLAY_SCROLLSUPPORT
451 coffset += scr->scr_offset_to_zero;
452 #endif
453 wcfb_putchar(cookie, ri->ri_crow,
454 ri->ri_ccol, scr->scr_chars[coffset],
455 scr->scr_attrs[coffset]);
456 ri->ri_flg &= ~RI_CURSOR;
457 }
458 ri->ri_crow = row;
459 ri->ri_ccol = col;
460 if (on) {
461 long attr, revattr;
462 coffset = col + (row * ri->ri_cols);
463 #ifdef WSDISPLAY_SCROLLSUPPORT
464 coffset += scr->scr_offset_to_zero;
465 #endif
466 attr = scr->scr_attrs[coffset];
467 revattr = attr ^ 0xffff0000;
468
469 wcfb_putchar(cookie, ri->ri_crow, ri->ri_ccol,
470 scr->scr_chars[coffset], revattr);
471 ri->ri_flg |= RI_CURSOR;
472 }
473 } else {
474 ri->ri_crow = row;
475 ri->ri_ccol = col;
476 ri->ri_flg &= ~RI_CURSOR;
477 }
478 }
479
480 static void
481 wcfb_copycols(void *cookie, int row, int srccol, int dstcol, int ncols)
482 {
483 struct rasops_info *ri = cookie;
484 struct vcons_screen *scr = ri->ri_hw;
485 struct wcfb_softc *sc = scr->scr_cookie;
486 int offset = (ri->ri_yorigin + row * ri->ri_font->fontheight) *
487 sc->sc_stride + ri->ri_xorigin + dstcol * ri->ri_font->fontwidth;
488 uint8_t *from, *to0, *to1;
489 int i;
490
491 sc->copycols(ri, row, srccol, dstcol, ncols);
492 from = sc->sc_shadow + offset;
493 to0 = sc->sc_fb0 + offset;
494 to1 = sc->sc_fb1 + offset;
495 for (i = 0; i < ri->ri_font->fontheight; i++) {
496 memcpy(to0, from, ri->ri_font->fontwidth * ncols);
497 memcpy(to1, from, ri->ri_font->fontwidth * ncols);
498 to0 += sc->sc_stride;
499 to1 += sc->sc_stride;
500 from += sc->sc_stride;
501 }
502 }
503
504 static void
505 wcfb_erasecols(void *cookie, int row, int startcol, int ncols, long fillattr)
506 {
507 struct rasops_info *ri = cookie;
508 struct vcons_screen *scr = ri->ri_hw;
509 struct wcfb_softc *sc = scr->scr_cookie;
510 int offset = (ri->ri_yorigin + row * ri->ri_font->fontheight) *
511 sc->sc_stride + ri->ri_xorigin + startcol * ri->ri_font->fontwidth;
512 uint8_t *to0, *to1;
513 int i;
514
515 sc->erasecols(ri, row, startcol, ncols, fillattr);
516
517 to0 = sc->sc_fb0 + offset;
518 to1 = sc->sc_fb1 + offset;
519 for (i = 0; i < ri->ri_font->fontheight; i++) {
520 memset(to0, ri->ri_devcmap[(fillattr >> 16) & 0xff],
521 ri->ri_font->fontwidth * ncols);
522 memset(to1, ri->ri_devcmap[(fillattr >> 16) & 0xff],
523 ri->ri_font->fontwidth * ncols);
524 to0 += sc->sc_stride;
525 to1 += sc->sc_stride;
526 }
527 }
528
529 static void
530 wcfb_copyrows(void *cookie, int srcrow, int dstrow, int nrows)
531 {
532 struct rasops_info *ri = cookie;
533 struct vcons_screen *scr = ri->ri_hw;
534 struct wcfb_softc *sc = scr->scr_cookie;
535 int offset = (ri->ri_yorigin + dstrow * ri->ri_font->fontheight) *
536 sc->sc_stride + ri->ri_xorigin;
537 uint8_t *from, *to0, *to1;
538 int i;
539
540 sc->copyrows(ri, srcrow, dstrow, nrows);
541
542 from = sc->sc_shadow + offset;
543 to0 = sc->sc_fb0 + offset;
544 to1 = sc->sc_fb1 + offset;
545 for (i = 0; i < ri->ri_font->fontheight * nrows; i++) {
546 memcpy(to0, from, ri->ri_emuwidth);
547 memcpy(to1, from, ri->ri_emuwidth);
548 to0 += sc->sc_stride;
549 to1 += sc->sc_stride;
550 from += sc->sc_stride;
551 }
552 }
553
554 static void
555 wcfb_eraserows(void *cookie, int row, int nrows, long fillattr)
556 {
557 struct rasops_info *ri = cookie;
558 struct vcons_screen *scr = ri->ri_hw;
559 struct wcfb_softc *sc = scr->scr_cookie;
560 int offset = (ri->ri_yorigin + row * ri->ri_font->fontheight) *
561 sc->sc_stride + ri->ri_xorigin;
562 uint8_t *to0, *to1;
563 int i;
564
565 sc->eraserows(ri, row, nrows, fillattr);
566
567 to0 = sc->sc_fb0 + offset;
568 to1 = sc->sc_fb1 + offset;
569 for (i = 0; i < ri->ri_font->fontheight * nrows; i++) {
570 memset(to0, ri->ri_devcmap[(fillattr >> 16) & 0xff],
571 ri->ri_emuwidth);
572 memset(to1, ri->ri_devcmap[(fillattr >> 16) & 0xff],
573 ri->ri_emuwidth);
574 to0 += sc->sc_stride;
575 to1 += sc->sc_stride;
576 }
577 }
578