Subject: port-next68k/10741: patch: provide basic support for internal 12bit color display
To: None <gnats-bugs@gnats.netbsd.org>
From: None <twetzel@gwdg.de>
List: netbsd-bugs
Date: 08/03/2000 06:08:16
>Number: 10741
>Category: port-next68k
>Synopsis: patch: provide basic support for internal 12bit color display
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-next68k-maintainer
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Aug 03 06:09:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Timm Wetzel
>Release: NetBSD-current around 1.4Z
>Organization:
>Environment:
N/A (NeXTstation turbocolor, 1.4Z ramdisk kernel with xe disabled and
`options DISABLE_NEXT_BMAP_CHIP')
>Description:
This patch modifies the nextdisplay code to work for 12bit color
systems. The diff is against 1.4Z.
I could only test it on a turbocolor station (the non-turbo color slabs
could be different).
You need `options RCONS_16BPP' in your kernel config to make this work.
Some changes in the MI rcons code were necessary. Is the 16bpp rcons
code used at all by other ports?
>How-To-Repeat:
Boot NeXTstation color or turbocolor.
>Fix:
Index: arch/next68k/dev/nextcons.c
===================================================================
RCS file: /clients/cvsroot/netbsd/src/sys/arch/next68k/dev/nextcons.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 nextcons.c
--- nextcons.c 1999/08/09 12:08:05 1.1.1.3
+++ nextcons.c 2000/07/28 00:26:44
@@ -67,7 +67,9 @@
{
if ((rom_machine_type == NeXT_WARP9)
- || (rom_machine_type == NeXT_X15))
+ || (rom_machine_type == NeXT_X15)
+ || (rom_machine_type == NeXT_WARP9C)
+ || (rom_machine_type == NeXT_TURBO_COLOR))
cp->cn_pri = CN_INTERNAL;
else
cp->cn_pri = CN_DEAD;
Index: arch/next68k/dev/nextdisplay.c
===================================================================
RCS file: /clients/cvsroot/netbsd/src/sys/arch/next68k/dev/nextdisplay.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 nextdisplay.c
--- nextdisplay.c 2000/01/25 19:57:00 1.1.1.3
+++ nextdisplay.c 2000/07/30 22:46:35
@@ -141,7 +141,9 @@
void *aux;
{
if ((rom_machine_type == NeXT_WARP9)
- || (rom_machine_type == NeXT_X15))
+ || (rom_machine_type == NeXT_X15)
+ || (rom_machine_type == NeXT_WARP9C)
+ || (rom_machine_type == NeXT_TURBO_COLOR))
return (1);
else
return (0);
@@ -168,14 +170,14 @@
dc->dc_paddr = color ? COLORP(addr) : MONOP(addr);
dc->dc_size = color ? NEXT_P_C16_VIDEOSIZE : NEXT_P_VIDEOSIZE;
- dc->dc_wid = 1152; /* XXX color */
- dc->dc_ht = 832; /* XXX color */
- dc->dc_depth = color ? 8 : 2;
+ dc->dc_wid = color ? 1120 : 1152; /* XXX color/mono turbo */
+ dc->dc_ht = color ? 832 : 864; /* XXX color */
+ dc->dc_depth = color ? 16 : 2;
dc->dc_rowbytes = dc->dc_wid * dc->dc_depth / 8;
dc->dc_videobase = dc->dc_vaddr;
-#if 0
+#if 1
printf("intiobase at: %08x\n", intiobase);
printf("intiolimit at: %08x\n", intiolimit);
printf("videobase at: %08x\n", color ? colorbase : monobase);
@@ -194,12 +196,13 @@
/* clear the screen */
for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
- *(u_int32_t *)(dc->dc_videobase + i) = 0xffffffff;
+ *(u_int32_t *)(dc->dc_videobase + i) =
+ (color ? 0x0 : 0xffffffff);
rap = &dc->dc_raster;
rap->width = dc->dc_wid;
rap->height = dc->dc_ht;
- rap->depth = color ? 8 : 2;
+ rap->depth = color ? 16 : 2;
rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
rap->pixels = (u_int32_t *)dc->dc_videobase;
@@ -234,7 +237,8 @@
sc = (struct nextdisplay_softc *)self;
- if (rom_machine_type == NeXT_WARP9C) {
+ if ((rom_machine_type == NeXT_WARP9C)
+ || (rom_machine_type == NeXT_TURBO_COLOR)) {
iscolor = 1;
addr = (paddr_t)colorbase;
} else {
@@ -261,7 +265,7 @@
waa.scrdata = iscolor ? &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono;
waa.accessops = &nextdisplay_accessops;
waa.accesscookie = sc;
-#if 0
+#if 1
printf("nextdisplay: access cookie is %p\n", sc);
#endif
config_found(self, &waa, wsemuldisplaydevprint);
@@ -338,7 +342,7 @@
*curxp = 0;
*curyp = 0;
rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0,
- WSATTR_REVERSE, &defattr);
+ (strcmp(type->name, "color") == 0) ? 0 : WSATTR_REVERSE, &defattr);
*defattrp = defattr;
sc->nscreens++;
#if 0
@@ -388,7 +392,8 @@
long defattr;
int iscolor;
- if (rom_machine_type == NeXT_WARP9C) {
+ if ((rom_machine_type == NeXT_WARP9C)
+ || (rom_machine_type == NeXT_TURBO_COLOR)) {
iscolor = 1;
nextdisplay_consaddr = (paddr_t)colorbase;
} else {
@@ -399,7 +404,7 @@
/* set up the display */
nextdisplay_init(&nextdisplay_console_dc, iscolor);
- rcons_alloc_attr(&dc->dc_rcons, 0, 0, WSATTR_REVERSE, &defattr);
+ rcons_alloc_attr(&dc->dc_rcons, 0, 0, iscolor ? 0 /* XXX */: WSATTR_REVERSE, &defattr);
wsdisplay_cnattach(iscolor ? &nextdisplay_color : &nextdisplay_mono,
&dc->dc_rcons, 0, 0, defattr);
Index: arch/next68k/include/bus_space.h
===================================================================
RCS file: /clients/cvsroot/netbsd/src/sys/arch/next68k/include/bus_space.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 bus_space.h
--- bus_space.h 1999/08/09 12:08:11 1.1.1.3
+++ bus_space.h 2000/07/30 21:37:27
@@ -86,6 +86,7 @@
* Value for the next68k mono video bus space tag, not to be used directly by MI code.
*/
#define NEXT68K_MONO_VIDEO_BUS_SPACE monobase
+#define NEXT68K_COLOR_VIDEO_BUS_SPACE colorbase
/*
* Mapping and unmapping operations.
@@ -95,7 +96,8 @@
((*(hp)=(bus_space_handle_t)((t)+((a)-INTIOBASE))),0) : \
((((a)>=MONOBASE)&&((a)+(s)<MONOTOP)) ? \
((*(hp)=(bus_space_handle_t)((t)+((a)-MONOBASE))),0) : \
- (-1)))
+ ((((a)>=COLORBASE)&&((a)+(s)<COLORTOP)) ? \
+ ((*(hp)=(bus_space_handle_t)((t)+((a)-COLORBASE))),0) : (-1))))
#define bus_space_unmap(t, h, s)
Index: arch/next68k/include/cpu.h
===================================================================
RCS file: /clients/cvsroot/netbsd/src/sys/arch/next68k/include/cpu.h,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 cpu.h
--- cpu.h 2000/06/10 09:57:24 1.1.1.5
+++ cpu.h 2000/07/30 21:50:19
@@ -204,7 +204,7 @@
#endif /* _KERNEL */
#define NEXT_RAMBASE (0x4000000) /* really depends on slot, but... */
-#define NEXT_BANKSIZE (0x1000000) /* Size of a memory bank in physical address */
+#define NEXT_BANKSIZE (0x1000000) /* Size of a memory bank in physical address */ /* XXX turbo chipset? */
#if 0
/* @@@ this needs to be fixed to work on 030's */
@@ -299,7 +299,11 @@
#define NEXT_P_MEMSIZE 0x04000000
#define NEXT_P_VIDEOMEM (NEXT_SLOT_ID+0x0b000000)
#define NEXT_P_VIDEOSIZE 0x0003a800
+/* Huh? */
+#if 0
#define NEXT_P_C16_VIDEOMEM (NEXT_SLOT_ID+0x06000000) /* COLOR_FB */
+#endif
+#define NEXT_P_C16_VIDEOMEM (0x2c000000) /* COLOR_FB */
#define NEXT_P_C16_VIDEOSIZE 0x001D4000 /* COLOR_FB */
#define NEXT_P_WF4VIDEO (NEXT_SLOT_ID+0x0c000000) /* w A+B-AB function */
#define NEXT_P_WF3VIDEO (NEXT_SLOT_ID+0x0d000000) /* w (1-A)B function */
@@ -390,8 +394,8 @@
#define INTIOTOP (0x02120000)
#define MONOBASE (0x0b000000)
#define MONOTOP (0x0b03a800)
-#define COLORBASE (0x06000000)
-#define COLORTOP (0x061D4000)
+#define COLORBASE (0x2c000000)
+#define COLORTOP (0x2c1D4000)
#define NEXT_INTR_BITS \
"\20\40NMI\37PFAIL\36TIMER\35ENETX_DMA\34ENETR_DMA\33SCSI_DMA\32DISK_DMA\31PRINTER_DMA\30SOUND_OUT_DMA\27SOUND_IN_DMA\26SCC_DMA\25DSP_DMA\24M2R_DMA\23R2M_DMA\22SCC\21REMOTE\20BUS\17DSP_4\16DISK|C16_VIDEO\15SCSI\14PRINTER\13ENETX\12ENETR\11SOUND_OVRUN\10PHONE\07DSP_3\06VIDEO\05MONITOR\04KYBD_MOUSE\03POWER\02SOFTINT1\01SOFTINT0"
Index: dev/rcons/raster.h
===================================================================
RCS file: /clients/cvsroot/netbsd/src/sys/dev/rcons/raster.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 raster.h
--- raster.h 1999/02/03 23:12:04 1.1.1.1
+++ raster.h 2000/07/31 19:16:39
@@ -159,12 +159,20 @@
#define RAS_OR 0xe /* src | dst */
#define RAS_SET 0xf /* 1 */
+#ifndef RCONS_16BPP
#define RAS_COLOR(color) ( ( (color) & 0xff ) << 4 )
+#else
+#define RAS_COLOR(color) ( ( (color) & 0xffff ) << 4 )
+#endif
/* Get the op from a rop. */
#define RAS_GETOP(op) ( (op) & 0xf )
/* Get the color from a rop. */
+#ifndef RCONS_16BPP
#define RAS_GETCOLOR(op) ( ( (op) >> 4 ) & 0xff )
+#else
+#define RAS_GETCOLOR(op) ( ( (op) >> 4 ) & 0xffff )
+#endif
/* Get the longword address of a pixel. */
#define RAS_ADDR( r, x, y ) \
( (r)->pixels + (y) * (r)->linelongs + (x) * (r)->depth / 32 )
Index: dev/rcons/raster_op.c
===================================================================
RCS file: /clients/cvsroot/netbsd/src/sys/dev/rcons/raster_op.c,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 raster_op.c
--- raster_op.c 2000/06/08 22:45:34 1.1.1.4
+++ raster_op.c 2000/07/31 23:37:20
@@ -72,8 +72,8 @@
#include <sys/types.h>
#ifdef _KERNEL
-#include <dev/rcons/raster.h>
#include "opt_rcons.h"
+#include <dev/rcons/raster.h>
#else
#include "raster.h"
#endif
@@ -924,7 +924,7 @@
color = RAS_GETCOLOR( rop );
if ( color == 0 )
- color = 255;
+ color = 0xffff;
/* Make 32 bits of color so we can do the ROP without shifting. */
color |= ( color << 16 );
@@ -1538,7 +1538,7 @@
color = RAS_GETCOLOR( rop );
if ( color == 0 )
- color = 255; /* XXX */
+ color = 0xffff; /* XXX */
/* Make 32 bits of color so we can do the ROP without shifting. */
color |= ( color << 16 );
>Release-Note:
>Audit-Trail:
>Unformatted: