Port-sparc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CG14 in 8-bit color
Hi,
admittedly it doesn't seem that useful, but I run my cg14 in 8-bit color
to allow for higher resolutions (1920x1200). "Out of the box" the Xorg
driver included with NetBSD 9.2 works only in 24-bit color; with a few
changes to xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
it works in either 8-bit or 24-bit mode. I've attached a diff. Simply
set DefaultDepth in xorg.conf or use the -depth command line parameter.
Part of the change is to trust the OBP on the VSIMM size instead of
assuming an 8MB VSIMM for higher resolutions. I'm not sure if that
breaks anything? (Older OBP versions? The SS10SX?)
I also have no clue how to fix the acceleration code. Currently if you
enable the Accel option, you will see vertical bars on your screen
(looks like 3 black pixels followed by 1 pixel of the actual image.)
With ShadowFB enabled I find the speed acceptable, but of course
acceleration would be preferable.
Maybe someone more knowledgeable in this area can have a look and see
if/how these changes (or something to the same effect) could be
integrated.
I'm happy to do further testing if someone has suggestions for changes.
Cheers,
Malte
--
Malte Dehling
<mdehling at gmail.com>
56a57
> static void CG14InitCplane8(ScrnInfoPtr pScrn);
182,183d182
< Cg14Ptr pCg14;
<
187,188d185
< pCg14 = GET_CG14_FROM_SCRN(pScrn);
<
350,351c347
< if ((psdp->height * psdp->width * 4) > 0x00400000)
< pCg14->memsize = 0x00800000;
---
>
361c357,361
< }
---
> } else {
> xf86Msg(X_INFO, "memsize could not be determined, assuming 4 MB\n");
> }
> } else {
> xf86Msg(X_INFO, "could not read PROM reg property\n");
374a375
> case 8:
549,551d549
< pCg14->x32 = xf86MapSbusMem (pCg14->psdp, CG14_X32_VOFF,
< (pCg14->psdp->width * pCg14->psdp->height));
< pCg14->xlut = xf86MapSbusMem (pCg14->psdp, CG14_XLUT_VOFF, 4096);
552a551,555
> if (pScrn->depth != 8) {
> pCg14->x32 = xf86MapSbusMem(pCg14->psdp, CG14_X32_VOFF,
> (pCg14->psdp->width * pCg14->psdp->height));
> pCg14->xlut = xf86MapSbusMem (pCg14->psdp, CG14_XLUT_VOFF, 4096);
> }
573c576
< if (! pCg14->fb || !pCg14->x32 || !pCg14->xlut || !pCg14->curs) {
---
> if ( pScrn->depth == 8 && (!pCg14->fb || !pCg14->curs) ) {
575c578,586
< "can't mmap something: fd %08x x32 %08x xlut %08x cursor %08x\n",
---
> "can't mmap something: fb %08x cursor %08x\n",
> (uint32_t)pCg14->fb, (uint32_t)pCg14->curs);
> return FALSE;
> }
> if ( pScrn->depth != 8 &&
> (!pCg14->fb || !pCg14->x32 || !pCg14->xlut || !pCg14->curs) )
> {
> xf86Msg(X_ERROR,
> "can't mmap something: fb %08x x32 %08x xlut %08x cursor %08x\n",
600,602c611,621
< if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
< pScrn->rgbBits, pScrn->defaultVisual))
< return FALSE;
---
> if (pScrn->depth == 8) {
> pScrn->rgbBits = 8;
> if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
> pScrn->rgbBits, pScrn->defaultVisual))
> return FALSE;
> } else {
> if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
> pScrn->rgbBits, pScrn->defaultVisual))
> return FALSE;
> }
>
607,608c626,630
< pCg14->shadow = malloc(pScrn->virtualX * pScrn->virtualY * 4);
<
---
> if (pScrn->depth == 8)
> pCg14->shadow = malloc(pScrn->virtualX * pScrn->virtualY);
> else
> pCg14->shadow = malloc(pScrn->virtualX * pScrn->virtualY * 4);
>
621c643,647
< CG14InitCplane24(pScrn);
---
> if (pScrn->depth == 8)
> CG14InitCplane8(pScrn);
> else
> CG14InitCplane24(pScrn);
>
687a714,716
> if (pScrn->depth == 8 && !xf86SbusHandleColormaps(pScreen, pCg14->psdp))
> return FALSE;
>
737c766,770
< CG14InitCplane24 (pScrn);
---
> if (pScrn->depth == 8)
> CG14InitCplane8 (pScrn);
> else
> CG14InitCplane24 (pScrn);
>
752c785,787
< CG14ExitCplane24 (pScrn);
---
> if (pScrn->depth != 8)
> CG14ExitCplane24 (pScrn);
>
771d805
<
778,783c812,818
< CG14ExitCplane24 (pScrn);
< xf86UnmapSbusMem(pCg14->psdp, pCg14->fb,
< (pCg14->psdp->width * pCg14->psdp->height * 4));
< xf86UnmapSbusMem(pCg14->psdp, pCg14->x32,
< (pCg14->psdp->width * pCg14->psdp->height));
< xf86UnmapSbusMem(pCg14->psdp, pCg14->xlut, 4096);
---
> if (pScrn->depth != 8) {
> CG14ExitCplane24 (pScrn);
> xf86UnmapSbusMem(pCg14->psdp, pCg14->x32,
> (pCg14->psdp->width * pCg14->psdp->height));
> xf86UnmapSbusMem(pCg14->psdp, pCg14->xlut, 4096);
> };
> xf86UnmapSbusMem(pCg14->psdp, pCg14->fb, pCg14->memsize);
797,798c832,837
< *size = pCg14->width << 2;
< return (CARD8 *)pCg14->fb + row * (pCg14->width << 2) + offset;
---
> if (pScrn->depth == 8)
> *size = pCg14->width;
> else
> *size = pCg14->width << 2;
>
> return (CARD8 *)pCg14->fb + row * *size + offset;
858a898,914
>
> /*
> * This initializes the card for 8 bit mode.
> */
> static void
> CG14InitCplane8(ScrnInfoPtr pScrn)
> {
> Cg14Ptr pCg14 = GET_CG14_FROM_SCRN(pScrn);
> int size, bpp;
>
> size = pScrn->virtualX * pScrn->virtualY;
> bpp = 8;
> ioctl (pCg14->psdp->fd, CG14_SET_PIXELMODE, &bpp);
> memset (pCg14->fb, 0, size);
> }
>
>
884c940
<
---
>
Home |
Main Index |
Thread Index |
Old Index