diff options
author | wkoszek <wkoszek@FreeBSD.org> | 2007-12-29 23:26:59 +0000 |
---|---|---|
committer | wkoszek <wkoszek@FreeBSD.org> | 2007-12-29 23:26:59 +0000 |
commit | bb029b61d9d00673b61ff3bd4589761e3ddbd060 (patch) | |
tree | 2208d9a465b1ecf2354401f83d3b431d9003169a /sys | |
parent | 8a0ce839351386ec837779aa9f63b575cf8d096a (diff) | |
download | FreeBSD-src-bb029b61d9d00673b61ff3bd4589761e3ddbd060.zip FreeBSD-src-bb029b61d9d00673b61ff3bd4589761e3ddbd060.tar.gz |
Replace explicit calls to video methods with their respective variants
implemented with macros. This patch improves code readability. Reasoning
behind vidd_* is a sort of "video discipline".
List of macros is supposed to be complete--all methods of video_switch
ought to have their respective macros from now on.
Functionally, this code should be no-op. My intention is to leave current
behaviour of touched code as is.
No objections: rwatson
Silence on: freebsd-current@
Approved by: cognet
Diffstat (limited to 'sys')
26 files changed, 238 insertions, 209 deletions
diff --git a/sys/dev/fb/creator.c b/sys/dev/fb/creator.c index 2a34685..f1a4213 100644 --- a/sys/dev/fb/creator.c +++ b/sys/dev/fb/creator.c @@ -845,9 +845,9 @@ creator_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len) int i; for (i = 0; i < len; i++) { - (*vidsw[adp->va_index]->putc)(adp, off + i, s[i] & 0xff, - (s[i] & 0xff00) >> 8); + vidd_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8); } + return (0); } diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index ea9c996..dbb9f36 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -484,7 +484,7 @@ int genfbread(genfb_softc_t *sc, video_adapter_t *adp, struct uio *uio, len = imin(len, adp->va_window_size - offset); if (len <= 0) break; - (*vidsw[adp->va_index]->set_win_org)(adp, uio->uio_offset); + vidd_set_win_org(adp, uio->uio_offset); error = uiomove((caddr_t)(adp->va_window + offset), len, uio); if (error) break; @@ -505,7 +505,7 @@ int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, if (adp == NULL) /* XXX */ return ENXIO; - error = (*vidsw[adp->va_index]->ioctl)(adp, cmd, arg); + error = vidd_ioctl(adp, cmd, arg); if (error == ENOIOCTL) error = ENODEV; return error; @@ -514,7 +514,7 @@ int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, int prot) { - return (*vidsw[adp->va_index]->mmap)(adp, offset, paddr, prot); + return vidd_mmap(adp, offset, paddr, prot); } #endif /* FB_INSTALL_CDEV */ @@ -686,16 +686,15 @@ fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) break; case FBIO_MODEINFO: /* get mode information */ - error = (*vidsw[adp->va_index]->get_info)(adp, - ((video_info_t *)arg)->vi_mode, - (video_info_t *)arg); + error = vidd_get_info(adp, + ((video_info_t *)arg)->vi_mode, + (video_info_t *)arg); if (error) error = ENODEV; break; case FBIO_FINDMODE: /* find a matching video mode */ - error = (*vidsw[adp->va_index]->query_mode)(adp, - (video_info_t *)arg); + error = vidd_query_mode(adp, (video_info_t *)arg); break; case FBIO_GETMODE: /* get video mode */ @@ -703,7 +702,7 @@ fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) break; case FBIO_SETMODE: /* set video mode */ - error = (*vidsw[adp->va_index]->set_mode)(adp, *(int *)arg); + error = vidd_set_mode(adp, *(int *)arg); if (error) error = ENODEV; /* EINVAL? */ break; @@ -722,7 +721,7 @@ fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) break; case FBIO_BLANK: /* blank display */ - error = (*vidsw[adp->va_index]->blank_display)(adp, *(int *)arg); + error = vidd_blank_display(adp, *(int *)arg); break; case FBIO_GETPALETTE: /* get color palette */ diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index 30d341d..0be91d3 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -189,20 +189,74 @@ typedef struct video_switch { vi_putm_t *putm; } video_switch_t; -#define save_palette(adp, pal) \ - (*vidsw[(adp)->va_index]->save_palette)((adp), (pal)) -#define load_palette(adp, pal) \ - (*vidsw[(adp)->va_index]->load_palette)((adp), (pal)) -#define get_mode_info(adp, mode, buf) \ - (*vidsw[(adp)->va_index]->get_info)((adp), (mode), (buf)) -#define set_video_mode(adp, mode) \ +#define vidd_probe(unit, adpp, arg, flags) \ + (*vidsw[(adp)->va_index]->probe)((unit), (adpp), (arg), (flags)) +#define vidd_init(unit, adp, flags) \ + (*vidsw[(adp)->va_index]->init)((unit), (adp), (flags)) +#define vidd_get_info(adp, mode, info) \ + (*vidsw[(adp)->va_index]->get_info)((adp), (mode), (info)) +#define vidd_query_mode(adp, mode) \ + (*vidsw[(adp)->va_index]->query_mode)((adp), (mode)) +#define vidd_set_mode(adp, mode) \ (*vidsw[(adp)->va_index]->set_mode)((adp), (mode)) -#define set_border(adp, border) \ +#define vidd_save_font(adp, page, size, width, data, c, count) \ + (*vidsw[(adp)->va_index]->save_font)((adp), (page), (size), \ + (width), (data), (c), (count)) +#define vidd_load_font(adp, page, size, width, data, c, count) \ + (*vidsw[(adp)->va_index]->load_font)((adp), (page), (size), \ + (width), (data), (c), (count)) +#define vidd_show_font(adp, page) \ + (*vidsw[(adp)->va_index]->show_font)((adp), (page)) +#define vidd_save_palette(adp, pallete) \ + (*vidsw[(adp)->va_index]->save_palette)((adp), (pallete)) +#define vidd_load_palette(adp, pallete) \ + (*vidsw[(adp)->va_index]->load_palette)((adp), (pallete)) +#define vidd_set_border(adp, border) \ (*vidsw[(adp)->va_index]->set_border)((adp), (border)) -#define set_origin(adp, o) \ - (*vidsw[(adp)->va_index]->set_win_org)(adp, o) - -/* XXX - add more macros */ +#define vidd_save_state(adp, p, size) \ + (*vidsw[(adp)->va_index]->save_state)((adp), (p), (size)) +#define vidd_load_state(adp, p) \ + (*vidsw[(adp)->va_index]->load_state)((adp), (p)) +#define vidd_set_win_org(adp, offset) \ + (*vidsw[(adp)->va_index]->set_win_org)((adp), (offset)) +#define vidd_read_hw_cursor(adp, col, row) \ + (*vidsw[(adp)->va_index]->read_hw_cursor)((adp), (col), (row)) +#define vidd_set_hw_cursor(adp, col, row) \ + (*vidsw[(adp)->va_index]->set_hw_cursor)((adp), (col), (row)) +#define vidd_set_hw_cursor_shape(adp, base, height, celsize, blink) \ + (*vidsw[(adp)->va_index]->set_hw_cursor_shape)((adp), (base), \ + (height), (celsize), (blink)) +#define vidd_blank_display(adp, mode) \ + (*vidsw[(adp)->va_index]->blank_display)((adp), (mode)) +#define vidd_mmap(adp, offset, paddr, prot) \ + (*vidsw[(adp)->va_index]->mmap)((adp), (offset), (paddr), (prot)) +#define vidd_ioctl(adp, cmd, data) \ + (*vidsw[(adp)->va_index]->ioctl)((adp), (cmd), (data)) +#define vidd_clear(adp) \ + (*vidsw[(adp)->va_index]->clear)((adp)) +#define vidd_fill_rect(adp, val, x, y, cx, cy) \ + (*vidsw[(adp)->va_index]->fill_rect)((adp), (val), (x), (y), \ + (cx), (cy)) +#define vidd_bitblt(adp, ...) \ + (*vidsw[(adp)->va_index]->bitblt)(adp, __VA_ARGS__) +#define vidd_diag(adp, level) \ + (*vidsw[(adp)->va_index]->diag)((adp), (level)) +#define vidd_save_cursor_palette(adp, palette) \ + (*vidsw[(adp)->va_index]->save_cursor_palette)((adp), (palette)) +#define vidd_load_cursor_palette(adp, palette) \ + (*vidsw[(adp)->va_index]->load_cursor_palette)((adp), (palette)) +#define vidd_copy(adp, src, dst, n) \ + (*vidsw[(adp)->va_index]->copy)((adp), (src), (dst), (n)) +#define vidd_putp(adp, offset, p, a, size, bpp, bit_ltor1, byte_ltor2) \ + (*vidsw[(adp)->va_index]->putp)((adp), (offset), (p), (a), \ + (size), (bpp), (bit_ltor1), (bit_ltor2)) +#define vidd_putc(adp, offset, c, a) \ + (*vidsw[(adp)->va_index]->putc)((adp), (offset), (c), (a)) +#define vidd_puts(adp, offset, s, len) \ + (*vidsw[(adp)->va_index]->puts)((adp), (offset), (s), (len)) +#define vidd_putm(adp, x, y, pixel_image, pixel_mask, size, width) \ + (*vidsw[(adp)->va_index]->putm)((adp), (x), (y), (pixel_image), \ + (pixel_mask), (size), (width)) /* video driver */ typedef struct video_driver { diff --git a/sys/dev/fb/machfb.c b/sys/dev/fb/machfb.c index eb128eb..85674fa 100644 --- a/sys/dev/fb/machfb.c +++ b/sys/dev/fb/machfb.c @@ -1113,7 +1113,7 @@ machfb_puts(video_adapter_t *adp, vm_offset_t off, uint16_t *s, int len) MACHFB_BLANK; blanks = 0; } - (*vidsw[adp->va_index]->putc)(adp, off + i, c, a); + vidd_putc(adp, off + i, c, a); } } if (blanks != 0) diff --git a/sys/dev/fb/splash_bmp.c b/sys/dev/fb/splash_bmp.c index 139d1e9..517a3ef 100644 --- a/sys/dev/fb/splash_bmp.c +++ b/sys/dev/fb/splash_bmp.c @@ -94,9 +94,9 @@ bmp_start(video_adapter_t *adp) return ENODEV; } for (i = 0; modes[i] >= 0; ++i) { - if (((*vidsw[adp->va_index]->get_info)(adp, modes[i], &info) == 0) - && (bmp_Init((u_char *)bmp_decoder.data, - info.vi_width, info.vi_height, info.vi_depth) == 0)) + if ((vidd_get_info(adp, modes[i], &info) == 0) && + (bmp_Init((u_char *)bmp_decoder.data, info.vi_width, + info.vi_height, info.vi_depth) == 0)) break; } splash_mode = modes[i]; @@ -127,11 +127,11 @@ bmp_splash(video_adapter_t *adp, int on) if (on) { if (!splash_on) { /* set up the video mode and draw something */ - if ((*vidsw[adp->va_index]->set_mode)(adp, splash_mode)) + if (vidd_set_mode(adp, splash_mode)) return 1; if (bmp_Draw(adp)) return 1; - (*vidsw[adp->va_index]->save_palette)(adp, pal); + vidd_save_palette(adp, pal); time_stamp = 0; splash_on = TRUE; } @@ -160,7 +160,7 @@ bmp_splash(video_adapter_t *adp, int on) for (i = 0; i < sizeof(pal); ++i) { tpal[i] = pal[i] * brightness / FADE_LEVELS; } - (*vidsw[adp->va_index]->load_palette)(adp, tpal); + vidd_load_palette(adp, tpal); time_stamp = tv.tv_sec; } } @@ -298,7 +298,7 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val) sofs += (x >> 3); newbank = sofs/info->adp->va_window_size; if (info->bank != newbank) { - (*vidsw[info->adp->va_index]->set_win_org)(info->adp, newbank*info->adp->va_window_size); + vidd_set_win_org(info->adp, newbank*info->adp->va_window_size); info->bank = newbank; } sofs %= info->adp->va_window_size; @@ -313,7 +313,7 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val) sofs += x; newbank = sofs/info->adp->va_window_size; if (info->bank != newbank) { - (*vidsw[info->adp->va_index]->set_win_org)(info->adp, newbank*info->adp->va_window_size); + vidd_set_win_org(info->adp, newbank*info->adp->va_window_size); info->bank = newbank; } sofs %= info->adp->va_window_size; @@ -601,8 +601,8 @@ bmp_Draw(video_adapter_t *adp) /* clear the screen */ bmp_info.vidmem = (u_char *)adp->va_window; bmp_info.adp = adp; - (*vidsw[adp->va_index]->clear)(adp); - (*vidsw[adp->va_index]->set_win_org)(adp, 0); + vidd_clear(adp); + vidd_set_win_org(adp, 0); bmp_info.bank = 0; /* initialise the info structure for drawing */ @@ -612,7 +612,7 @@ bmp_Draw(video_adapter_t *adp) #endif /* set the palette for our image */ - (*vidsw[adp->va_index]->load_palette)(adp, (u_char *)&bmp_info.palette); + vidd_load_palette(adp, (u_char *)&bmp_info.palette); #if 0 #ifndef PC98 diff --git a/sys/dev/fb/splash_pcx.c b/sys/dev/fb/splash_pcx.c index e67bb24..641b036 100644 --- a/sys/dev/fb/splash_pcx.c +++ b/sys/dev/fb/splash_pcx.c @@ -98,7 +98,7 @@ pcx_start(video_adapter_t *adp) pcx_info.bpp, pcx_info.planes); for (i = 0; modes[i] >= 0; ++i) { - if (get_mode_info(adp, modes[i], &info) != 0) + if (vidd_get_info(adp, modes[i], &info) != 0) continue; if (bootverbose) printf("splash_pcx: considering mode %d:\n" @@ -136,7 +136,7 @@ pcx_splash(video_adapter_t *adp, int on) { if (on) { if (!splash_on) { - if (set_video_mode(adp, splash_mode) || pcx_draw(adp)) + if (vidd_set_mode(adp, splash_mode) || pcx_draw(adp)) return 1; splash_on = TRUE; } @@ -208,7 +208,7 @@ pcx_draw(video_adapter_t *adp) if (pcx_info.zlen < 1) return (1); - load_palette(adp, pcx_info.palette); + vidd_load_palette(adp, pcx_info.palette); vidmem = (uint8_t *)adp->va_window; swidth = adp->va_info.vi_width; @@ -219,7 +219,7 @@ pcx_draw(video_adapter_t *adp) banksize = adp->va_window_size; for (origin = 0; origin < sheight*sbpsl; origin += banksize) { - set_origin(adp, origin); + vidd_set_win_org(adp, origin); bzero(vidmem, banksize); } @@ -231,7 +231,7 @@ pcx_draw(video_adapter_t *adp) pos -= banksize; origin += banksize; } - set_origin(adp, origin); + vidd_set_win_org(adp, origin); for (scan = i = 0; scan < pcx_info.height; ++scan, ++y, pos += sbpsl) { for (j = 0; j < pcx_info.bpsl && i < pcx_info.zlen; ++i) { @@ -251,7 +251,7 @@ pcx_draw(video_adapter_t *adp) if (pos > banksize) { origin += banksize; pos -= banksize; - set_origin(adp, origin); + vidd_set_win_org(adp, origin); } if (pos + pcx_info.width > banksize) { @@ -260,7 +260,7 @@ pcx_draw(video_adapter_t *adp) bcopy(line, vidmem + pos, j); origin += banksize; pos -= banksize; - set_origin(adp, origin); + vidd_set_win_org(adp, origin); bcopy(line + j, vidmem, pcx_info.width - j); } else { bcopy(line, vidmem + pos, pcx_info.width); diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 6650569..9383e0a 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -1656,7 +1656,7 @@ setup_grmode: update_adapter_info(adp, &info); /* move hardware cursor out of the way */ - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + vidd_set_hw_cursor(adp, -1, -1); return 0; #else /* VGA_NO_MODE_CHANGE */ @@ -2502,7 +2502,7 @@ planar_fill(video_adapter_t *adp, int val) length = adp->va_line_width*adp->va_info.vi_height; while (length > 0) { l = imin(length, adp->va_window_size); - (*vidsw[adp->va_index]->set_win_org)(adp, at); + vidd_set_win_org(adp, at); bzero_io(adp->va_window, l); length -= l; at += l; @@ -2522,7 +2522,7 @@ packed_fill(video_adapter_t *adp, int val) length = adp->va_line_width*adp->va_info.vi_height; while (length > 0) { l = imin(length, adp->va_window_size); - (*vidsw[adp->va_index]->set_win_org)(adp, at); + vidd_set_win_org(adp, at); fill_io(val, adp->va_window, l); length -= l; at += l; @@ -2540,7 +2540,7 @@ direct_fill(video_adapter_t *adp, int val) length = adp->va_line_width*adp->va_info.vi_height; while (length > 0) { l = imin(length, adp->va_window_size); - (*vidsw[adp->va_index]->set_win_org)(adp, at); + vidd_set_win_org(adp, at); switch (adp->va_info.vi_pixel_size) { case sizeof(u_int16_t): fillw_io(val, adp->va_window, l/sizeof(u_int16_t)); @@ -2599,7 +2599,7 @@ planar_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) while (cy > 0) { pos = adp->va_line_width*y + x/8; if (bank != pos/banksize) { - (*vidsw[adp->va_index]->set_win_org)(adp, pos); + vidd_set_win_org(adp, pos); bank = pos/banksize; } offset = pos%banksize; @@ -2612,7 +2612,7 @@ planar_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) if (offset >= banksize) { offset = 0; ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); } outw(GDCIDX, 0xff08); /* bit mask */ } @@ -2624,7 +2624,7 @@ planar_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) if (offset >= banksize) { offset = 0; ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); } } if ((x + cx) % 8) { @@ -2634,7 +2634,7 @@ planar_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) if (offset >= banksize) { offset = 0; ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); } outw(GDCIDX, 0xff08); /* bit mask */ } @@ -2662,7 +2662,7 @@ packed_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) while (cy > 0) { pos = adp->va_line_width*y + x*adp->va_info.vi_pixel_size; if (bank != pos/banksize) { - (*vidsw[adp->va_index]->set_win_org)(adp, pos); + vidd_set_win_org(adp, pos); bank = pos/banksize; } offset = pos%banksize; @@ -2672,7 +2672,7 @@ packed_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) /* the line may cross the window boundary */ if (offset + cx > banksize) { ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); end = offset + cx - banksize; fill_io(val, adp->va_window, end/adp->va_info.vi_pixel_size); } @@ -2700,7 +2700,7 @@ direct_fill_rect16(video_adapter_t *adp, int val, int x, int y, int cx, int cy) while (cy > 0) { pos = adp->va_line_width*y + x*sizeof(u_int16_t); if (bank != pos/banksize) { - (*vidsw[adp->va_index]->set_win_org)(adp, pos); + vidd_set_win_org(adp, pos); bank = pos/banksize; } offset = pos%banksize; @@ -2710,7 +2710,7 @@ direct_fill_rect16(video_adapter_t *adp, int val, int x, int y, int cx, int cy) /* the line may cross the window boundary */ if (offset + cx > banksize) { ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); end = offset + cx - banksize; fillw_io(val, adp->va_window, end/sizeof(u_int16_t)); } @@ -2740,7 +2740,7 @@ direct_fill_rect24(video_adapter_t *adp, int val, int x, int y, int cx, int cy) while (cy > 0) { pos = adp->va_line_width*y + x*3; if (bank != pos/banksize) { - (*vidsw[adp->va_index]->set_win_org)(adp, pos); + vidd_set_win_org(adp, pos); bank = pos/banksize; } offset = pos%banksize; @@ -2751,7 +2751,7 @@ direct_fill_rect24(video_adapter_t *adp, int val, int x, int y, int cx, int cy) /* the line may cross the window boundary */ if (offset + cx >= banksize) { ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); j = 0; end = offset + cx - banksize; for (; j < end; i = (++i)%3, ++j) { @@ -2782,7 +2782,7 @@ direct_fill_rect32(video_adapter_t *adp, int val, int x, int y, int cx, int cy) while (cy > 0) { pos = adp->va_line_width*y + x*sizeof(u_int32_t); if (bank != pos/banksize) { - (*vidsw[adp->va_index]->set_win_org)(adp, pos); + vidd_set_win_org(adp, pos); bank = pos/banksize; } offset = pos%banksize; @@ -2792,7 +2792,7 @@ direct_fill_rect32(video_adapter_t *adp, int val, int x, int y, int cx, int cy) /* the line may cross the window boundary */ if (offset + cx > banksize) { ++bank; /* next bank */ - (*vidsw[adp->va_index]->set_win_org)(adp, bank*banksize); + vidd_set_win_org(adp, bank*banksize); end = offset + cx - banksize; filll_io(val, adp->va_window, end/sizeof(u_int32_t)); } diff --git a/sys/dev/syscons/blank/blank_saver.c b/sys/dev/syscons/blank/blank_saver.c index 960acca..ad1ef74 100644 --- a/sys/dev/syscons/blank/blank_saver.c +++ b/sys/dev/syscons/blank/blank_saver.c @@ -42,16 +42,14 @@ static int blank_saver(video_adapter_t *adp, int blank) { - (*vidsw[adp->va_index]->blank_display)(adp, - (blank) ? V_DISPLAY_BLANK - : V_DISPLAY_ON); + vidd_blank_display(adp, (blank) ? V_DISPLAY_BLANK : V_DISPLAY_ON); return 0; } static int blank_init(video_adapter_t *adp) { - if ((*vidsw[adp->va_index]->blank_display)(adp, V_DISPLAY_ON) == 0) + if (vidd_blank_display(adp, V_DISPLAY_ON) == 0) return 0; return ENODEV; } diff --git a/sys/dev/syscons/daemon/daemon_saver.c b/sys/dev/syscons/daemon/daemon_saver.c index 92d807f..b15e04c 100644 --- a/sys/dev/syscons/daemon/daemon_saver.c +++ b/sys/dev/syscons/daemon/daemon_saver.c @@ -225,7 +225,7 @@ daemon_saver(video_adapter_t *adp, int blank) /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], ATTR(FG_LIGHTGREY | BG_BLACK)); - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + vidd_set_hw_cursor(adp, -1, -1); sc_set_border(scp, 0); xlen = ylen = tlen = 0; } diff --git a/sys/dev/syscons/dragon/dragon_saver.c b/sys/dev/syscons/dragon/dragon_saver.c index f8fa51b..6294daa 100644 --- a/sys/dev/syscons/dragon/dragon_saver.c +++ b/sys/dev/syscons/dragon/dragon_saver.c @@ -135,13 +135,13 @@ dragon_update(video_adapter_t *adp) int tmp; if (curve > CURVE) { - (*vidsw[adp->va_index]->clear)(adp); + vidd_clear(adp); /* set palette of each curves */ for (tmp = 0; tmp < 3*CURVE; ++tmp) { dragon_pal[3+tmp] = (u_char)random(); } - load_palette(adp, dragon_pal); + vidd_load_palette(adp, dragon_pal); mul = ((random() & 7) + 1) * (SCRW / 320); org_x = random() % SCRW; org_y = random() % SCRH; @@ -207,7 +207,7 @@ dragon_saver(video_adapter_t *adp, int blank) /* switch to graphics mode */ if (blanked <= 0) { pl = splhigh(); - set_video_mode(adp, VIDEO_MODE); + vidd_set_mode(adp, VIDEO_MODE); vid = (u_char *)adp->va_window; curve = CURVE + 1; ++blanked; @@ -229,7 +229,7 @@ dragon_init(video_adapter_t *adp) video_info_t info; /* check that the console is capable of running in 320x200x256 */ - if (get_mode_info(adp, VIDEO_MODE, &info)) { + if (vidd_get_info(adp, VIDEO_MODE, &info)) { log(LOG_NOTICE, "%s: the console does not support " VIDEO_MODE_NAME "\n", SAVER_NAME); diff --git a/sys/dev/syscons/fade/fade_saver.c b/sys/dev/syscons/fade/fade_saver.c index d7793b6..27d732c 100644 --- a/sys/dev/syscons/fade/fade_saver.c +++ b/sys/dev/syscons/fade/fade_saver.c @@ -51,7 +51,7 @@ fade_saver(video_adapter_t *adp, int blank) if (blank) { if (ISPALAVAIL(adp->va_flags)) { if (count <= 0) - save_palette(adp, palette); + vidd_save_palette(adp, palette); if (count < 256) { pal[0] = pal[1] = pal[2] = 0; for (i = 3; i < 256*3; i++) { @@ -60,20 +60,18 @@ fade_saver(video_adapter_t *adp, int blank) else pal[i] = 60; } - load_palette(adp, pal); + vidd_load_palette(adp, pal); count++; } } else { - (*vidsw[adp->va_index]->blank_display)(adp, - V_DISPLAY_BLANK); + vidd_blank_display(adp, V_DISPLAY_BLANK); } } else { if (ISPALAVAIL(adp->va_flags)) { - load_palette(adp, palette); + vidd_load_palette(adp, palette); count = 0; } else { - (*vidsw[adp->va_index]->blank_display)(adp, - V_DISPLAY_ON); + vidd_blank_display(adp, V_DISPLAY_ON); } } return 0; @@ -82,8 +80,8 @@ fade_saver(video_adapter_t *adp, int blank) static int fade_init(video_adapter_t *adp) { - if (!ISPALAVAIL(adp->va_flags) - && (*vidsw[adp->va_index]->blank_display)(adp, V_DISPLAY_ON) != 0) + if (!ISPALAVAIL(adp->va_flags) && + vidd_blank_display(adp, V_DISPLAY_ON) != 0) return ENODEV; return 0; } diff --git a/sys/dev/syscons/fire/fire_saver.c b/sys/dev/syscons/fire/fire_saver.c index de60a20..4c995ef 100644 --- a/sys/dev/syscons/fire/fire_saver.c +++ b/sys/dev/syscons/fire/fire_saver.c @@ -55,7 +55,7 @@ #define SET_ORIGIN(adp, o) do { \ int oo = o; \ if (oo != last_origin) \ - set_origin(adp, last_origin = oo); \ + vidd_set_win_org(adp, last_origin = oo); \ } while (0) static u_char *buf; @@ -118,14 +118,14 @@ fire_saver(video_adapter_t *adp, int blank) /* switch to graphics mode */ if (blanked <= 0) { pl = splhigh(); - set_video_mode(adp, scrmode); - load_palette(adp, fire_pal); + vidd_set_mode(adp, scrmode); + vidd_load_palette(adp, fire_pal); blanked++; vid = (u_char *)adp->va_window; banksize = adp->va_window_size; bpsl = adp->va_line_width; splx(pl); - (*vidsw[adp->va_index]->clear)(adp); + vidd_clear(adp); } fire_update(adp); } else { @@ -141,11 +141,11 @@ fire_init(video_adapter_t *adp) video_info_t info; int i, red, green, blue; - if (!get_mode_info(adp, M_VGA_CG320, &info)) { + if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!get_mode_info(adp, M_PC98_PEGC640x480, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; - } else if (!get_mode_info(adp, M_PC98_PEGC640x400, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, diff --git a/sys/dev/syscons/green/green_saver.c b/sys/dev/syscons/green/green_saver.c index d6cfe80..b03cc72 100644 --- a/sys/dev/syscons/green/green_saver.c +++ b/sys/dev/syscons/green/green_saver.c @@ -42,16 +42,15 @@ static int green_saver(video_adapter_t *adp, int blank) { - (*vidsw[adp->va_index]->blank_display)(adp, - (blank) ? V_DISPLAY_STAND_BY - : V_DISPLAY_ON); + vidd_blank_display(adp, + (blank) ? V_DISPLAY_STAND_BY : V_DISPLAY_ON); return 0; } static int green_init(video_adapter_t *adp) { - if ((*vidsw[adp->va_index]->blank_display)(adp, V_DISPLAY_ON) == 0) + if (vidd_blank_display(adp, V_DISPLAY_ON) == 0) return 0; return ENODEV; } diff --git a/sys/dev/syscons/logo/logo_saver.c b/sys/dev/syscons/logo/logo_saver.c index 20f2bdc..c77edfb 100644 --- a/sys/dev/syscons/logo/logo_saver.c +++ b/sys/dev/syscons/logo/logo_saver.c @@ -45,7 +45,7 @@ #define SET_ORIGIN(adp, o) do { \ int oo = o; \ if (oo != last_origin) \ - set_origin(adp, last_origin = oo); \ + vidd_set_win_org(adp, last_origin = oo); \ } while (0) extern unsigned int logo_w; @@ -114,15 +114,15 @@ logo_saver(video_adapter_t *adp, int blank) /* switch to graphics mode */ if (blanked <= 0) { pl = splhigh(); - set_video_mode(adp, scrmode); - load_palette(adp, logo_pal); - set_border(adp, 0); + vidd_set_mode(adp, scrmode); + vidd_load_palette(adp, logo_pal); + vidd_set_border(adp, 0); blanked++; vid = (u_char *)adp->va_window; banksize = adp->va_window_size; bpsl = adp->va_line_width; splx(pl); - (*vidsw[adp->va_index]->clear)(adp); + vidd_clear(adp); } logo_update(adp); } else { @@ -136,13 +136,13 @@ logo_init(video_adapter_t *adp) { video_info_t info; - if (!get_mode_info(adp, M_VESA_CG800x600, &info)) { + if (!vidd_get_info(adp, M_VESA_CG800x600, &info)) { scrmode = M_VESA_CG800x600; - } else if (!get_mode_info(adp, M_VGA_CG320, &info)) { + } else if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!get_mode_info(adp, M_PC98_PEGC640x480, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; - } else if (!get_mode_info(adp, M_PC98_PEGC640x400, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, diff --git a/sys/dev/syscons/rain/rain_saver.c b/sys/dev/syscons/rain/rain_saver.c index 3cdf980..3953137 100644 --- a/sys/dev/syscons/rain/rain_saver.c +++ b/sys/dev/syscons/rain/rain_saver.c @@ -54,7 +54,7 @@ #define SET_ORIGIN(adp, o) do { \ int oo = o; \ if (oo != last_origin) \ - set_origin(adp, last_origin = oo); \ + vidd_set_win_org(adp, last_origin = oo); \ } while (0) static u_char *vid; @@ -71,7 +71,7 @@ rain_update(video_adapter_t *adp) for (i = MAX; i > 1; i--) rain_pal[BLUE(i)] = rain_pal[BLUE(i - 1)]; rain_pal[BLUE(1)] = t; - load_palette(adp, rain_pal); + vidd_load_palette(adp, rain_pal); } static int @@ -85,9 +85,9 @@ rain_saver(video_adapter_t *adp, int blank) /* switch to graphics mode */ if (blanked <= 0) { pl = splhigh(); - set_video_mode(adp, scrmode); - load_palette(adp, rain_pal); - set_border(adp, 0); + vidd_set_mode(adp, scrmode); + vidd_load_palette(adp, rain_pal); + vidd_set_border(adp, 0); blanked++; vid = (u_char *)adp->va_window; banksize = adp->va_window_size; @@ -141,11 +141,11 @@ rain_init(video_adapter_t *adp) video_info_t info; int i; - if (!get_mode_info(adp, M_VGA_CG320, &info)) { + if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!get_mode_info(adp, M_PC98_PEGC640x480, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; - } else if (!get_mode_info(adp, M_PC98_PEGC640x400, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, diff --git a/sys/dev/syscons/scgfbrndr.c b/sys/dev/syscons/scgfbrndr.c index bca5ad6..20679b7 100644 --- a/sys/dev/syscons/scgfbrndr.c +++ b/sys/dev/syscons/scgfbrndr.c @@ -148,13 +148,13 @@ gfb_nop(scr_stat *scp) static void gfb_clear(scr_stat *scp, int c, int attr) { - (*vidsw[scp->sc->adapter]->clear)(scp->sc->adp); + vidd_clear(scp->sc->adp); } static void gfb_border(scr_stat *scp, int color) { - (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); + vidd_set_border(scp->sc->adp, color); } static void @@ -187,13 +187,13 @@ gfb_draw(scr_stat *scp, int from, int count, int flip) n = (count / adp->va_info.vi_width) + 1; /* Scroll to make room for new text rows... */ - (*vidsw[scp->sc->adapter]->copy)(adp, n, 0, n); + vidd_copy(adp, n, 0, n); #if 0 - (*vidsw[scp->sc->adapter]->clear)(adp, n); + vidd_clear(adp, n); #endif /* Display new text rows... */ - (*vidsw[scp->sc->adapter]->puts)(adp, from, + vidd_puts(adp, from, (u_int16_t *)sc_vtb_pointer(&scp->vtb, from), count); } @@ -212,11 +212,11 @@ gfb_draw(scr_stat *scp, int from, int count, int flip) for (i = count; i-- > 0; ++from) { c = sc_vtb_getc(&scp->vtb, from); a = sc_vtb_geta(&scp->vtb, from) >> 8; - (*vidsw[scp->sc->adapter]->putc)(adp, from, c, + vidd_putc(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); } else { - (*vidsw[scp->sc->adapter]->puts)(adp, from, + vidd_puts(adp, from, (u_int16_t *)sc_vtb_pointer(&scp->vtb, from), count); } @@ -233,8 +233,8 @@ gfb_cursor_shape(scr_stat *scp, int base, int height, int blink) scp->cursor_base = base; scp->cursor_height = height; #endif - (*vidsw[scp->sc->adapter]->set_hw_cursor_shape)(scp->sc->adp, - base, height, scp->font_size, blink); + vidd_set_hw_cursor_shape(scp->sc->adp, base, height, scp->font_size, + blink); } static int pxlblinkrate = 0; @@ -254,33 +254,29 @@ gfb_cursor(scr_stat *scp, int at, int blink, int on, int flip) scp->status |= VR_CURSOR_BLINK; if (on) { scp->status |= VR_CURSOR_ON; - (*vidsw[adp->va_index]->set_hw_cursor)(adp, - at%scp->xsize, - at/scp->xsize); + vidd_set_hw_cursor(adp, at%scp->xsize, at/scp->xsize); } else { if (scp->status & VR_CURSOR_ON) - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, - -1); + vidd_set_hw_cursor(adp, -1, -1); scp->status &= ~VR_CURSOR_ON; } } else { scp->status &= ~VR_CURSOR_BLINK; if(on) { scp->status |= VR_CURSOR_ON; - (*vidsw[scp->sc->adapter]->putc)(scp->sc->adp, - scp->cursor_oldpos, + vidd_putc(scp->sc->adp, scp->cursor_oldpos, sc_vtb_getc(&scp->vtb, scp->cursor_oldpos), sc_vtb_geta(&scp->vtb, scp->cursor_oldpos) >> 8); a = sc_vtb_geta(&scp->vtb, at) >> 8; c = sc_vtb_getc(&scp->vtb, at); - (*vidsw[scp->sc->adapter]->putc)(scp->sc->adp, at, - c, (a >> 4) | ((a & 0xf) << 4)); + vidd_putc(scp->sc->adp, at, c, + (a >> 4) | ((a & 0xf) << 4)); scp->cursor_saveunder_attr = a; scp->cursor_saveunder_char = c; } else { if (scp->status & VR_CURSOR_ON) - (*vidsw[scp->sc->adapter]->putc)(scp->sc->adp, - at, scp->cursor_saveunder_char, + vidd_putc(scp->sc->adp, at, + scp->cursor_saveunder_char, scp->cursor_saveunder_attr); scp->status &= ~VR_CURSOR_ON; } @@ -300,22 +296,19 @@ gfb_cursor(scr_stat *scp, int at, int blink, int on, int flip) if (on) { if (!blink) { scp->status |= VR_CURSOR_ON; - (*vidsw[adp->va_index]->set_hw_cursor)(adp, - at%scp->xsize, at/scp->xsize); + vidd_set_hw_cursor(adp, at%scp->xsize, at/scp->xsize); } else if (++pxlblinkrate & 4) { pxlblinkrate = 0; scp->status ^= VR_CURSOR_ON; if(scp->status & VR_CURSOR_ON) - (*vidsw[adp->va_index]->set_hw_cursor)(adp, - at%scp->xsize, at/scp->xsize); + vidd_set_hw_cursor(adp, at%scp->xsize, + at/scp->xsize); else - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, - -1); + vidd_set_hw_cursor(adp, -1, -1); } } else { if (scp->status & VR_CURSOR_ON) - (*vidsw[adp->va_index]->set_hw_cursor)(adp, - at%scp->xsize, at/scp->xsize); + vidd_set_hw_cursor(adp, at%scp->xsize, at/scp->xsize); scp->status &= ~VR_CURSOR_ON; } if (blink) @@ -344,16 +337,16 @@ static void gfb_mouse(scr_stat *scp, int x, int y, int on) { #ifdef __sparc64__ - (*vidsw[scp->sc->adapter]->putm)(scp->sc->adp, x, y, - mouse_pointer, on ? 0xffffffff : 0x0, 22, 12); + vidd_putm(scp->sc->adp, x, y, mouse_pointer, + on ? 0xffffffff : 0x0, 22, 12); #else int i, pos; if (on) { /* Display the mouse pointer image... */ - (*vidsw[scp->sc->adapter]->putm)(scp->sc->adp, x, y, - mouse_pointer, 0xffffffff, 16, 8); + vidd_putm(scp->sc->adp, x, y, mouse_pointer, + 0xffffffff, 16, 8); } else { /* diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c index 5b056d3..1ab41d2 100644 --- a/sys/dev/syscons/scvgarndr.c +++ b/sys/dev/syscons/scvgarndr.c @@ -234,7 +234,7 @@ vga_txtclear(scr_stat *scp, int c, int attr) static void vga_txtborder(scr_stat *scp, int color) { - (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); + vidd_set_border(scp->sc->adp, color); } static void @@ -270,9 +270,8 @@ vga_txtcursor_shape(scr_stat *scp, int base, int height, int blink) scp->curs_attr.base = base; scp->curs_attr.height = height; #endif - (*vidsw[scp->sc->adapter]->set_hw_cursor_shape)(scp->sc->adp, - base, height, - scp->font_size, blink); + vidd_set_hw_cursor_shape(scp->sc->adp, base, height, + scp->font_size, blink); } static void @@ -312,8 +311,7 @@ draw_txtcharcursor(scr_stat *scp, int at, u_short c, u_short a, int flip) font[i] ^= 0xff; } /* XXX */ - (*vidsw[sc->adapter]->load_font)(sc->adp, 0, h, 8, font, - sc->cursor_char, 1); + vidd_load_font(sc->adp, 0, h, 8, font, sc->cursor_char, 1); sc_vtb_putc(&scp->scr, at, sc->cursor_char, a); } else #endif /* SC_NO_FONT_LOADING */ @@ -348,13 +346,11 @@ vga_txtcursor(scr_stat *scp, int at, int blink, int on, int flip) scp->status |= VR_CURSOR_BLINK; if (on) { scp->status |= VR_CURSOR_ON; - (*vidsw[adp->va_index]->set_hw_cursor)(adp, - at%scp->xsize, - at/scp->xsize); + vidd_set_hw_cursor(adp, at%scp->xsize, + at/scp->xsize); } else { if (scp->status & VR_CURSOR_ON) - (*vidsw[adp->va_index]->set_hw_cursor)(adp, - -1, -1); + vidd_set_hw_cursor(adp, -1, -1); scp->status &= ~VR_CURSOR_ON; } } else { @@ -438,8 +434,7 @@ draw_txtmouse(scr_stat *scp, int x, int y) while (!(inb(crtc_addr + 6) & 0x08)) /* idle */ ; #endif c = scp->sc->mouse_char; - (*vidsw[scp->sc->adapter]->load_font)(scp->sc->adp, 0, 32, 8, font_buf, - c, 4); + vidd_load_font(scp->sc->adp, 0, 32, 8, font_buf, c, 4); sc_vtb_putc(&scp->scr, pos, c, sc_vtb_geta(&scp->scr, pos)); /* FIXME: may be out of range! */ @@ -627,7 +622,7 @@ vga_pxlborder_planar(scr_stat *scp, int color) int y; int i; - (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); + vidd_set_border(scp->sc->adp, color); outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0003); /* data rotate/function select */ @@ -1250,7 +1245,7 @@ vga_pxlmouse_planar(scr_stat *scp, int x, int y, int on) static void vga_grborder(scr_stat *scp, int color) { - (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); + vidd_set_border(scp->sc->adp, color); } #endif diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c index 65a56c6..5e1d910 100644 --- a/sys/dev/syscons/scvidctl.c +++ b/sys/dev/syscons/scvidctl.c @@ -142,7 +142,7 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize, int error; int s; - if ((*vidsw[scp->sc->adapter]->get_info)(scp->sc->adp, mode, &info)) + if (vidd_get_info(scp->sc->adp, mode, &info)) return ENODEV; /* adjust argument values */ @@ -261,7 +261,7 @@ sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode) int error; int s; - if ((*vidsw[scp->sc->adapter]->get_info)(scp->sc->adp, mode, &info)) + if (vidd_get_info(scp->sc->adp, mode, &info)) return ENODEV; /* stop screen saver, etc */ @@ -332,7 +332,7 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, int error; int s; - if ((*vidsw[scp->sc->adapter]->get_info)(scp->sc->adp, scp->mode, &info)) + if (vidd_get_info(scp->sc->adp, scp->mode, &info)) return ENODEV; /* this shouldn't happen */ /* adjust argument values */ @@ -472,7 +472,7 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, #define fb_ioctl(a, c, d) \ (((a) == NULL) ? ENODEV : \ - (*vidsw[(a)->va_index]->ioctl)((a), (c), (caddr_t)(d))) + vidd_ioctl((a), (c), (caddr_t)(d))) int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *td) @@ -723,12 +723,12 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread * #endif #ifndef SC_NO_PALETTE_LOADING - load_palette(adp, scp->sc->palette); + vidd_load_palette(adp, scp->sc->palette); #endif #ifndef PC98 /* move hardware cursor out of the way */ - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + vidd_set_hw_cursor(adp, -1, -1); #endif /* FALLTHROUGH */ @@ -780,7 +780,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread * if (scp == scp->sc->cur_scp) { set_mode(scp); #ifndef SC_NO_PALETTE_LOADING - load_palette(adp, scp->sc->palette); + vidd_load_palette(adp, scp->sc->palette); #endif } sc_clear_screen(scp); diff --git a/sys/dev/syscons/snake/snake_saver.c b/sys/dev/syscons/snake/snake_saver.c index 6a7b7da..bbdcda3 100644 --- a/sys/dev/syscons/snake/snake_saver.c +++ b/sys/dev/syscons/snake/snake_saver.c @@ -71,7 +71,7 @@ snake_saver(video_adapter_t *adp, int blank) if (blanked <= 0) { sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + vidd_set_hw_cursor(adp, -1, -1); sc_set_border(scp, 0); dirx = (scp->xpos ? 1 : -1); diry = (scp->ypos ? diff --git a/sys/dev/syscons/star/star_saver.c b/sys/dev/syscons/star/star_saver.c index 3963e08..d4b58cd 100644 --- a/sys/dev/syscons/star/star_saver.c +++ b/sys/dev/syscons/star/star_saver.c @@ -85,7 +85,7 @@ star_saver(video_adapter_t *adp, int blank) /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + vidd_set_hw_cursor(adp, -1, -1); sc_set_border(scp, 0); blanked = TRUE; for(i=0; i<NUM_STARS; i++) { diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index cc273e6..152e51f 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -369,7 +369,7 @@ sc_attach_unit(int unit, int flags) #ifdef SC_PIXEL_MODE if ((sc->config & SC_VESA800X600) - && ((*vidsw[sc->adapter]->get_info)(sc->adp, M_VESA_800x600, &info) == 0)) { + && (vidd_get_info(sc->adp, M_VESA_800x600, &info) == 0)) { #ifdef DEV_SPLASH if (sc->flags & SC_SPLASH_SCRN) splash_term(sc->adp); @@ -2053,7 +2053,7 @@ set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border) scp->status |= GRAPHICS_MODE; #ifndef SC_NO_PALETTE_LOADING if (pal != NULL) - load_palette(scp->sc->adp, pal); + vidd_load_palette(scp->sc->adp, pal); #endif sc_set_border(scp, border); return 0; @@ -2091,7 +2091,7 @@ restore_scrn_saver_mode(scr_stat *scp, int changemode) } if (set_mode(scp) == 0) { #ifndef SC_NO_PALETTE_LOADING - load_palette(scp->sc->adp, scp->sc->palette); + vidd_load_palette(scp->sc->adp, scp->sc->palette); #endif --scrn_blanked; splx(s); @@ -2495,7 +2495,7 @@ exchange_scr(sc_softc_t *sc) sc_set_cursor_image(scp); #ifndef SC_NO_PALETTE_LOADING if (ISGRAPHSC(sc->old_scp)) - load_palette(sc->adp, sc->palette); + vidd_load_palette(sc->adp, sc->palette); #endif sc_set_border(scp, scp->border); @@ -2740,8 +2740,8 @@ scinit(int unit, int flags) #endif /* extract the hardware cursor location and hide the cursor for now */ - (*vidsw[sc->adapter]->read_hw_cursor)(sc->adp, &col, &row); - (*vidsw[sc->adapter]->set_hw_cursor)(sc->adp, -1, -1); + vidd_read_hw_cursor(sc->adp, &col, &row); + vidd_set_hw_cursor(sc->adp, -1, -1); /* set up the first console */ sc->first_vty = unit*MAXCONS; @@ -2843,7 +2843,7 @@ scinit(int unit, int flags) #endif /* !SC_NO_FONT_LOADING */ #ifndef SC_NO_PALETTE_LOADING - save_palette(sc->adp, sc->palette); + vidd_save_palette(sc->adp, sc->palette); #endif #ifdef DEV_SPLASH @@ -2889,7 +2889,7 @@ scterm(int unit, int flags) #if 0 /* XXX */ /* move the hardware cursor to the upper-left corner */ - (*vidsw[sc->adapter]->set_hw_cursor)(sc->adp, 0, 0); + vidd_set_hw_cursor(sc->adp, 0, 0); #endif /* release the keyboard and the video card */ @@ -3023,7 +3023,7 @@ init_scp(sc_softc_t *sc, int vty, scr_stat *scp) scp->sc = sc; scp->status = 0; scp->mode = sc->initial_mode; - (*vidsw[sc->adapter]->get_info)(sc->adp, scp->mode, &info); + vidd_get_info(sc->adp, scp->mode, &info); if (info.vi_flags & V_INFO_GRAPHICS) { scp->status |= GRAPHICS_MODE; scp->xpixel = info.vi_width; @@ -3437,7 +3437,7 @@ scmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) scp = sc_get_stat(dev); if (scp != scp->sc->cur_scp) return -1; - return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, paddr, nprot); + return vidd_mmap(scp->sc->adp, offset, paddr, nprot); } static int @@ -3497,7 +3497,7 @@ set_mode(scr_stat *scp) video_info_t info; /* reject unsupported mode */ - if ((*vidsw[scp->sc->adapter]->get_info)(scp->sc->adp, scp->mode, &info)) + if (vidd_get_info(scp->sc->adp, scp->mode, &info)) return 1; /* if this vty is not currently showing, do nothing */ @@ -3505,7 +3505,7 @@ set_mode(scr_stat *scp) return 0; /* setup video hardware for the given mode */ - (*vidsw[scp->sc->adapter]->set_mode)(scp->sc->adp, scp->mode); + vidd_set_mode(scp->sc->adp, scp->mode); scp->rndr->init(scp); #ifndef __sparc64__ sc_vtb_init(&scp->scr, VTB_FRAMEBUFFER, scp->xsize, scp->ysize, @@ -3562,8 +3562,7 @@ sc_load_font(scr_stat *scp, int page, int size, int width, u_char *buf, sc = scp->sc; sc->font_loading_in_progress = TRUE; - (*vidsw[sc->adapter]->load_font)(sc->adp, page, size, width, buf, base, - count); + vidd_load_font(sc->adp, page, size, width, buf, base, count); sc->font_loading_in_progress = FALSE; } @@ -3575,15 +3574,14 @@ sc_save_font(scr_stat *scp, int page, int size, int width, u_char *buf, sc = scp->sc; sc->font_loading_in_progress = TRUE; - (*vidsw[sc->adapter]->save_font)(sc->adp, page, size, width, buf, base, - count); + vidd_save_font(sc->adp, page, size, width, buf, base, count); sc->font_loading_in_progress = FALSE; } void sc_show_font(scr_stat *scp, int page) { - (*vidsw[scp->sc->adapter]->show_font)(scp->sc->adp, page); + vidd_show_font(scp->sc->adp, page); } #endif /* !SC_NO_FONT_LOADING */ diff --git a/sys/dev/syscons/warp/warp_saver.c b/sys/dev/syscons/warp/warp_saver.c index aba2439..85a7d29 100644 --- a/sys/dev/syscons/warp/warp_saver.c +++ b/sys/dev/syscons/warp/warp_saver.c @@ -47,7 +47,7 @@ #define SET_ORIGIN(adp, o) do { \ int oo = o; \ if (oo != last_origin) \ - set_origin(adp, last_origin = oo); \ + vidd_set_win_org(adp, last_origin = oo); \ } while (0) static u_char *vid; @@ -103,15 +103,15 @@ warp_saver(video_adapter_t *adp, int blank) /* switch to graphics mode */ if (blanked <= 0) { pl = splhigh(); - set_video_mode(adp, scrmode); - load_palette(adp, warp_pal); - set_border(adp, 0); + vidd_set_mode(adp, scrmode); + vidd_load_palette(adp, warp_pal); + vidd_set_border(adp, 0); blanked++; vid = (u_char *)adp->va_window; banksize = adp->va_window_size; bpsl = adp->va_line_width; splx(pl); - (*vidsw[adp->va_index]->clear)(adp); + vidd_clear(adp); } /* update display */ warp_update(adp); @@ -127,11 +127,11 @@ warp_init(video_adapter_t *adp) video_info_t info; int i; - if (!get_mode_info(adp, M_VGA_CG320, &info)) { + if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!get_mode_info(adp, M_PC98_PEGC640x480, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { scrmode = M_PC98_PEGC640x480; - } else if (!get_mode_info(adp, M_PC98_PEGC640x400, &info)) { + } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, diff --git a/sys/i386/xbox/xboxfb.c b/sys/i386/xbox/xboxfb.c index fa9decb..906ced5 100644 --- a/sys/i386/xbox/xboxfb.c +++ b/sys/i386/xbox/xboxfb.c @@ -360,13 +360,13 @@ xbr_draw(scr_stat* scp, int from, int count, int flip) if (!flip) { /* Normal printing */ - (*vidsw[scp->sc->adapter]->puts)(adp, from, (uint16_t*)sc_vtb_pointer(&scp->vtb, from), count); + vidd_puts(adp, from, (uint16_t*)sc_vtb_pointer(&scp->vtb, from), count); } else { /* This is for selections and such: invert the color attribute */ for (i = count; i-- > 0; ++from) { c = sc_vtb_getc(&scp->vtb, from); a = sc_vtb_geta(&scp->vtb, from) >> 8; - (*vidsw[scp->sc->adapter]->putc)(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); + vidd_putc(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); } } } @@ -414,7 +414,7 @@ xbr_set_mouse(scr_stat* scp) static void xbr_draw_mouse(scr_stat* scp, int x, int y, int on) { - (*vidsw[scp->sc->adapter]->putm)(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); + vidd_putm(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); } @@ -624,8 +624,7 @@ xboxfb_puts(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, int len) int i; for (i = 0; i < len; i++) { - (*vidsw[adp->va_index]->putc)(adp, off + i, s[i] & 0xff, - (s[i] & 0xff00) >> 8); + vidd_putc(adp, off + i, s[i] & 0xff, (s[i] & 0xff00) >> 8); } return (0); } diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index d69236d..3d7cd3a 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -150,7 +150,7 @@ isavga_attach(device_t dev) #endif /* FB_INSTALL_CDEV */ if (0 && bootverbose) - (*vidsw[sc->adp->va_index]->diag)(sc->adp, bootverbose); + vidd_diag(sc->adp, bootverbose); #if 0 /* experimental */ device_add_child(dev, "fb", -1); @@ -176,7 +176,7 @@ isavga_suspend(device_t dev) free(sc->state_buf, M_TEMP); sc->state_buf = NULL; } - nbytes = (*vidsw[sc->adp->va_index]->save_state)(sc->adp, NULL, 0); + nbytes = vidd_save_state(sc->adp, NULL, 0); if (nbytes <= 0) return (0); sc->state_buf = malloc(nbytes, M_TEMP, M_NOWAIT | M_ZERO); @@ -184,8 +184,7 @@ isavga_suspend(device_t dev) return (0); if (bootverbose) device_printf(dev, "saving %d bytes of video state\n", nbytes); - if ((*vidsw[sc->adp->va_index]->save_state)(sc->adp, sc->state_buf, - nbytes) != 0) { + if (vidd_save_state(sc->adp, sc->state_buf, nbytes) != 0) { device_printf(dev, "failed to save state (nbytes=%d)\n", nbytes); free(sc->state_buf, M_TEMP); @@ -201,8 +200,7 @@ isavga_resume(device_t dev) sc = device_get_softc(dev); if (sc->state_buf != NULL) { - if ((*vidsw[sc->adp->va_index]->load_state)(sc->adp, - sc->state_buf) != 0) + if (vidd_load_state(sc->adp, sc->state_buf) != 0) device_printf(dev, "failed to reload state\n"); free(sc->state_buf, M_TEMP); sc->state_buf = NULL; diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index f5719f0..9f990b2 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -177,7 +177,7 @@ gdc_attach(device_t dev) #endif /* FB_INSTALL_CDEV */ if (bootverbose) - (*vidsw[sc->adp->va_index]->diag)(sc->adp, bootverbose); + vidd_diag(sc->adp, bootverbose); return 0; } @@ -1147,7 +1147,7 @@ gdc_set_mode(video_adapter_t *adp, int mode) bcopy(&info, &adp->va_info, sizeof(info)); /* move hardware cursor out of the way */ - (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + vidd_set_hw_cursor(adp, -1, -1); return 0; } @@ -1374,7 +1374,7 @@ packed_fill(video_adapter_t *adp, int val) length = adp->va_line_width*adp->va_info.vi_height; while (length > 0) { l = imin(length, adp->va_window_size); - (*vidsw[adp->va_index]->set_win_org)(adp, at); + vidd_set_win_org(adp, at); bzero_io(adp->va_window, l); length -= l; at += l; diff --git a/sys/pc98/cbus/scgdcrndr.c b/sys/pc98/cbus/scgdcrndr.c index f8ea8d1..53ff41e 100644 --- a/sys/pc98/cbus/scgdcrndr.c +++ b/sys/pc98/cbus/scgdcrndr.c @@ -106,7 +106,7 @@ gdc_txtclear(scr_stat *scp, int c, int attr) static void gdc_txtborder(scr_stat *scp, int color) { - (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); + vidd_set_border(scp->sc->adp, color); } static void @@ -142,9 +142,8 @@ gdc_txtcursor_shape(scr_stat *scp, int base, int height, int blink) if (base < 0 || base >= scp->font_size) return; /* the caller may set height <= 0 in order to disable the cursor */ - (*vidsw[scp->sc->adapter]->set_hw_cursor_shape)(scp->sc->adp, - base, height, - scp->font_size, blink); + vidd_set_hw_cursor_shape(scp->sc->adp, base, height, scp->font_size, + blink); } static void @@ -152,12 +151,11 @@ gdc_txtcursor(scr_stat *scp, int at, int blink, int on, int flip) { if (on) { scp->status |= VR_CURSOR_ON; - (*vidsw[scp->sc->adapter]->set_hw_cursor)(scp->sc->adp, - at%scp->xsize, at/scp->xsize); + vidd_set_hw_cursor(scp->sc->adp, at%scp->xsize, + at/scp->xsize); } else { if (scp->status & VR_CURSOR_ON) - (*vidsw[scp->sc->adapter]->set_hw_cursor)(scp->sc->adp, - -1, -1); + vidd_set_hw_cursor(scp->sc->adp, -1, -1); scp->status &= ~VR_CURSOR_ON; } } @@ -204,7 +202,7 @@ gdc_txtmouse(scr_stat *scp, int x, int y, int on) static void gdc_grborder(scr_stat *scp, int color) { - (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); + vidd_set_border(scp->sc->adp, color); } #endif /* SC_NO_MODE_CHANGE */ |