Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/iomd Kill off vidcvideo_textpalette() again, bu...
details: https://anonhg.NetBSD.org/src/rev/26611a5b0699
branches: trunk
changeset: 532903:26611a5b0699
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Mon Jun 17 21:00:13 2002 +0000
description:
Kill off vidcvideo_textpalette() again, but better.
This time, vidcvideo_stdpalette() uses vidcvideo_write(), as it should, and
correctly initialises the paletter in 16bpp and (I hope) 32 bpp modes.
This fixes the colours on the text console in 16bpp modes. 32bpp seems to be
generally broken anyway.
diffstat:
sys/arch/arm/iomd/vidc20config.c | 104 ++++++++++++++++++++++----------------
sys/arch/arm/iomd/vidc20config.h | 3 +-
2 files changed, 60 insertions(+), 47 deletions(-)
diffs (158 lines):
diff -r 7d0df298b2dd -r 26611a5b0699 sys/arch/arm/iomd/vidc20config.c
--- a/sys/arch/arm/iomd/vidc20config.c Mon Jun 17 20:32:21 2002 +0000
+++ b/sys/arch/arm/iomd/vidc20config.c Mon Jun 17 21:00:13 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vidc20config.c,v 1.11 2002/06/16 14:02:04 bjh21 Exp $ */
+/* $NetBSD: vidc20config.c,v 1.12 2002/06/17 21:00:13 bjh21 Exp $ */
/*
* Copyright (c) 2001 Reinoud Zandijk
@@ -48,7 +48,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.11 2002/06/16 14:02:04 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.12 2002/06/17 21:00:13 bjh21 Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -294,29 +294,6 @@
}
-void
-vidcvideo_stdpalette()
-{
- WriteWord(vidc_base, VIDC_PALREG | 0x00000000);
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL( 0, 0, 0));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 0, 0));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL( 0, 255, 0));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 255, 0));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL( 0, 0, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 0, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL( 0, 255, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 255, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(128, 128, 128));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 128, 128));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(128, 255, 128));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 255, 128));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(128, 128, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 128, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(128, 255, 255));
- WriteWord(vidc_base, VIDC_PALETTE | VIDC_COL(255, 255, 255));
-}
-
-
static int
vidcvideo_coldinit(void)
{
@@ -566,7 +543,7 @@
vidcvideo_setmode(vidc_currentmode);
vidcvideo_blank(0); /* display on */
- vidcvideo_textpalette();
+ vidcvideo_stdpalette();
if (cold_init == 0) {
vidcvideo_write(VIDC_CP1, 0x0);
@@ -683,27 +660,64 @@
}
-int
-vidcvideo_textpalette()
+void
+vidcvideo_stdpalette()
{
- vidcvideo_write(VIDC_PALREG, 0x00000000);
- vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 0, 0));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 255, 0));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 0));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 0, 255));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 0, 255));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 255, 255));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 255));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(128, 128, 128));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 128, 128));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(128, 255, 128));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 128));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(128, 128, 255));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 128, 255));
- vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 255));
+ int i;
- return 0;
+ switch (vidc_currentmode->log2_bpp) {
+ case 0: /* 1 bpp */
+ case 1: /* 2 bpp */
+ case 2: /* 4 bpp */
+ case 3: /* 8 bpp */
+ vidcvideo_write(VIDC_PALREG, 0x00000000);
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 0, 0));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 0, 0));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 255, 0));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 0));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 0, 255));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 0, 255));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL( 0, 255, 255));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 255));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(128, 128, 128));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 128, 128));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(128, 255, 128));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 128));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(128, 128, 255));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 128, 255));
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(255, 255, 255));
+ break;
+ case 4: /* 16 bpp */
+ /*
+ * The use of the palette in 16-bit modes is quite
+ * fun. Comments in linux/drivers/video/acornfb.c
+ * imply that it goes something like this:
+ *
+ * red = LUT[pixel[7:0]].red
+ * green = LUT[pixel[11:4]].green
+ * blue = LUT[pixel[15:8]].blue
+ *
+ * We just want 5:5:5 R:G:B.
+ */
+ vidcvideo_write(VIDC_PALREG, 0x00000000);
+ for (i = 0; i < 256; i++) {
+ int r5, g5, b5;
+
+ r5 = i & 0x1f;
+ g5 = (i >> 1) & 0x1f;
+ b5 = (i >> 2) & 0x1f;
+ vidcvideo_write(VIDC_PALETTE,
+ VIDC_COL(r5 << 3 | r5 >> 2, g5 << 3 | g5 >> 2,
+ b5 << 3 | b5 >> 2));
+ }
+ break;
+ case 5: /* 32 bpp */
+ vidcvideo_write(VIDC_PALREG, 0x00000000);
+ for (i = 0; i < 256; i++)
+ vidcvideo_write(VIDC_PALETTE, VIDC_COL(i, i, i));
+ break;
+ }
+
}
int
diff -r 7d0df298b2dd -r 26611a5b0699 sys/arch/arm/iomd/vidc20config.h
--- a/sys/arch/arm/iomd/vidc20config.h Mon Jun 17 20:32:21 2002 +0000
+++ b/sys/arch/arm/iomd/vidc20config.h Mon Jun 17 21:00:13 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vidc20config.h,v 1.3 2002/06/16 14:02:04 bjh21 Exp $ */
+/* $NetBSD: vidc20config.h,v 1.4 2002/06/17 21:00:13 bjh21 Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -48,7 +48,6 @@
extern int vidcvideo_write __P((u_int reg, int value));
extern int vidcvideo_cursor_init __P((int width, int heigth));
extern void vidcvideo_setpalette __P((struct vidc_state *vidc));
-extern int vidcvideo_textpalette __P((void));
extern void vidcvideo_stdpalette __P((void));
extern void vidcvideo_setstate __P((struct vidc_state *vidc));
extern void vidcvideo_getstate __P((struct vidc_state *vidc));
Home |
Main Index |
Thread Index |
Old Index