From c25844b47e78024dd976d0487857ca3fb061a775 Mon Sep 17 00:00:00 2001 From: obrien Date: Sat, 13 Apr 2002 22:34:16 +0000 Subject: Turn on TGA support. Submitted by: Andrew M. Miklic --- sys/dev/fb/fb.c | 11 ++++++----- sys/dev/fb/fbreg.h | 22 +++++++++++++++++++++- sys/dev/fb/gfb.c | 1 - sys/dev/fb/tga.c | 28 ++++++++++++++++++++++------ 4 files changed, 49 insertions(+), 13 deletions(-) (limited to 'sys/dev/fb') diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 5bfd303..0dbb73b 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -637,10 +637,11 @@ fb_dump_adp_info(char *driver, video_adapter_t *adp, int level) printf("%s%d: %s%d, %s, type:%s (%d), flags:0x%x\n", FB_DRIVER_NAME, adp->va_index, driver, adp->va_unit, adp->va_name, adapter_name(adp->va_type), adp->va_type, adp->va_flags); - printf("%s%d: port:0x%x-0x%x, crtc:0x%x, mem:0x%x 0x%x\n", - FB_DRIVER_NAME, adp->va_index, - adp->va_io_base, adp->va_io_base + adp->va_io_size - 1, - adp->va_crtc_addr, adp->va_mem_base, adp->va_mem_size); + printf("%s%d: port:0x%lx-0x%lx, crtc:0x%lx, mem:0x%lx 0x%x\n", + FB_DRIVER_NAME, adp->va_index, (u_long)adp->va_io_base, + (u_long)adp->va_io_base + adp->va_io_size - 1, + (u_long)adp->va_crtc_addr, (u_long)adp->va_mem_base, + adp->va_mem_size); printf("%s%d: init mode:%d, bios mode:%d, current mode:%d\n", FB_DRIVER_NAME, adp->va_index, adp->va_initial_mode, adp->va_initial_bios_mode, adp->va_mode); @@ -669,7 +670,7 @@ fb_dump_mode_info(char *driver, video_adapter_t *adp, video_info_t *info, printf("T %dx%d, font:%dx%d, ", info->vi_width, info->vi_height, info->vi_cwidth, info->vi_cheight); - printf("win:0x%x\n", info->vi_window); + printf("win:0x%lx\n", (u_long)info->vi_window); } int diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index 4cf0ad5..d556791 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -86,8 +86,21 @@ typedef int vi_ioctl_t(video_adapter_t *adp, u_long cmd, caddr_t data); typedef int vi_clear_t(video_adapter_t *adp); typedef int vi_fill_rect_t(video_adapter_t *adp, int val, int x, int y, int cx, int cy); -typedef int vi_bitblt_t(video_adapter_t *adp,...); +typedef int vi_bitblt_t(video_adapter_t *adp, ...); typedef int vi_diag_t(video_adapter_t *adp, int level); +typedef int vi_save_cursor_palette_t(video_adapter_t *adp, u_char *palette); +typedef int vi_load_cursor_palette_t(video_adapter_t *adp, u_char *palette); +typedef int vi_copy_t(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst, + int n); +typedef int vi_putp_t(video_adapter_t *adp, vm_offset_t off, u_int32_t p, + u_int32_t a, int size, int bpp, int bit_ltor, + int byte_ltor); +typedef int vi_putc_t(video_adapter_t *adp, vm_offset_t off, u_int8_t c, + u_int8_t a); +typedef int vi_puts_t(video_adapter_t *adp, vm_offset_t off, u_int16_t *s, + int len); +typedef int vi_putm_t(video_adapter_t *adp, int x, int y, + u_int8_t *pixel_image, u_int32_t pixel_mask, int size); typedef struct video_switch { vi_probe_t *probe; @@ -116,6 +129,13 @@ typedef struct video_switch { int (*reserved1)(void); int (*reserved2)(void); vi_diag_t *diag; + vi_save_cursor_palette_t *save_cursor_palette; + vi_load_cursor_palette_t *load_cursor_palette; + vi_copy_t *copy; + vi_putp_t *putp; + vi_putc_t *putc; + vi_puts_t *puts; + vi_putm_t *putm; } video_switch_t; #define save_palette(adp, pal) \ diff --git a/sys/dev/fb/gfb.c b/sys/dev/fb/gfb.c index f7c377c..fcb8aed 100644 --- a/sys/dev/fb/gfb.c +++ b/sys/dev/fb/gfb.c @@ -541,7 +541,6 @@ gfb_bitblt(video_adapter_t *adp, ...) int /*gfb_clear(video_adapter_t *adp, int n)*/ gfb_clear(video_adapter_t *adp) - video_adapter_t *adp; { int off; diff --git a/sys/dev/fb/tga.c b/sys/dev/fb/tga.c index 08fcac8..a5a56c0 100644 --- a/sys/dev/fb/tga.c +++ b/sys/dev/fb/tga.c @@ -105,10 +105,12 @@ static void tga2_init(struct gfb_softc *, int); /* TGA-specific functionality. */ static gfb_builtin_save_palette_t tga_builtin_save_palette; static gfb_builtin_load_palette_t tga_builtin_load_palette; +#ifdef TGA2 static gfb_builtin_save_palette_t tga2_builtin_save_palette; static gfb_builtin_load_palette_t tga2_builtin_load_palette; static gfb_builtin_save_cursor_palette_t tga2_builtin_save_cursor_palette; static gfb_builtin_load_cursor_palette_t tga2_builtin_load_cursor_palette; +#endif static gfb_builtin_read_hw_cursor_t tga_builtin_read_hw_cursor; static gfb_builtin_set_hw_cursor_t tga_builtin_set_hw_cursor; static gfb_builtin_set_hw_cursor_shape_t tga_builtin_set_hw_cursor_shape; @@ -128,8 +130,10 @@ static void tga2_ics9110_wr(struct gfb_softc *, int); /* RAMDAC-specific functions */ static gfb_ramdac_init_t bt463_init; static void bt463_update_window_type(struct gfb_softc *); +#if 0 static gfb_ramdac_save_palette_t bt463_save_palette; static gfb_ramdac_load_palette_t bt463_load_palette; +#endif static gfb_ramdac_save_cursor_palette_t bt463_save_cursor_palette; static gfb_ramdac_load_cursor_palette_t bt463_load_cursor_palette; static gfb_ramdac_init_t bt485_init; @@ -150,7 +154,9 @@ static gfb_ramdac_load_cursor_palette_t ibm561_load_cursor_palette; static vi_query_mode_t tga_query_mode; static vi_set_mode_t tga_set_mode; static vi_blank_display_t tga_blank_display; +#if 0 static vi_ioctl_t tga_ioctl; +#endif static vi_set_border_t tga_set_border; static vi_set_win_org_t tga_set_win_org; static vi_fill_rect_t tga_fill_rect; @@ -670,7 +676,7 @@ tga_set_mode(video_adapter_t *adp, int mode) /* Assume the best... */ error = 0; - gder = READ_GFB_REGISTER(video_adapter_t *adp, TGA_REG_GDER); + gder = READ_GFB_REGISTER(adp, TGA_REG_GDER); /* Determine the adapter type first @@ -686,13 +692,13 @@ tga_set_mode(video_adapter_t *adp, int mode) switch(mode) { case TGA2_2DA_MODE: vgae_mask = ~0x00400000; - WRITE_GFB_REGISTER(video_adapter_t *adp, TGA_REG_GDER, + WRITE_GFB_REGISTER(adp, TGA_REG_GDER, gder & vgae_mask); adp->va_mode = mode; break; case TGA2_VGA_MODE: vgae_mask = 0x00400000; - WRITE_GFB_REGISTER(video_adapter_t *adp, TGA_REG_GDER, + WRITE_GFB_REGISTER(adp, TGA_REG_GDER, gder | vgae_mask); adp->va_mode = mode; break; @@ -757,6 +763,8 @@ tga_blank_display(video_adapter_t *adp, int mode) return(0); } +#if 0 + static int tga_ioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) { @@ -784,6 +792,8 @@ tga_ioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) return(error); } +#endif /* 0 */ + static int tga_set_border(video_adapter_t *adp, int color) { return(ENODEV); @@ -916,7 +926,7 @@ tga_bitblt(video_adapter_t *adp, ...) { static int #if 0 tga_clear(video_adapter_t *adp, int n) -else +#else tga_clear(video_adapter_t *adp) #endif { @@ -1410,6 +1420,7 @@ tga_builtin_load_palette(video_adapter_t *adp, video_color_palette_t *palette) return(error); } +#ifdef TGA2 static int tga2_builtin_save_palette(video_adapter_t *adp, video_color_palette_t *palette) { @@ -1512,8 +1523,10 @@ tga2_builtin_load_cursor_palette(video_adapter_t *adp, struct fbcmap *palette) return(error); } +#endif /* TGA2 */ + static int -tga_builtin_read_hw_cursor(video_adapter_t *adp, int col, int row) +tga_builtin_read_hw_cursor(video_adapter_t *adp, int *col, int *row) { gfb_reg_t cxyr; int error; @@ -1969,6 +1982,7 @@ bt463_update_window_type(struct gfb_softc *sc) } } +#if 0 static int bt463_save_palette(video_adapter_t *adp, video_color_palette_t *palette) { @@ -2016,6 +2030,8 @@ bt463_load_palette(video_adapter_t *adp, video_color_palette_t *palette) return(error); } +#endif /* 0 */ + static int bt463_save_cursor_palette(video_adapter_t *adp, struct fbcmap *palette) { @@ -2040,7 +2056,7 @@ bt463_save_cursor_palette(video_adapter_t *adp, struct fbcmap *palette) } static int -bt463_load_cursor_palette(video_adapter_t *adp, struct bfcmap *palette) +bt463_load_cursor_palette(video_adapter_t *adp, struct fbcmap *palette) { struct gfb_softc *sc; int error, i; -- cgit v1.1