Thu May 27 04:48:10 2021 UTC ()
Add support for EXA, so that the pnozz driver works again with Xorg.
Note, that only minimal acceleration is currently supported.

Thanks to macallan for the pointers to get this working.


(jdc)
diff -r0 -r1.1 xsrc/external/mit/xf86-video-pnozz/dist/src/compat-api.h
diff -r0 -r1.1 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c
diff -r1.1 -r1.2 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h
diff -r1.2 -r1.3 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c
diff -r1.2 -r1.3 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_cursor.c
diff -r1.6 -r1.7 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_driver.c

File Added: xsrc/external/mit/xf86-video-pnozz/dist/src/compat-api.h
/*
 * Copyright 2012 Red Hat, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 * Author: Dave Airlie <airlied@redhat.com>
 */

/* this file provides API compat between server post 1.13 and pre it,
   it should be reused inside as many drivers as possible */
#ifndef COMPAT_API_H
#define COMPAT_API_H

#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
#endif

#ifndef XF86_HAS_SCRN_CONV
#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
#endif

#ifndef XF86_SCRN_INTERFACE

#define SCRN_ARG_TYPE int
#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]

#define SCREEN_ARG_TYPE int
#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]

#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv

#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask

#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
#define CLOSE_SCREEN_ARGS scrnIndex, pScreen

#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0

#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0

#define FREE_SCREEN_ARGS_DECL int arg, int flags

#define VT_FUNC_ARGS_DECL int arg, int flags
#define VT_FUNC_ARGS pScrn->scrnIndex, 0

#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
#else
#define SCRN_ARG_TYPE ScrnInfoPtr
#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)

#define SCREEN_ARG_TYPE ScreenPtr
#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)

#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv

#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask

#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
#define CLOSE_SCREEN_ARGS pScreen

#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y

#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
#define SWITCH_MODE_ARGS(arg, m) arg, m

#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg

#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
#define VT_FUNC_ARGS pScrn

#define XF86_SCRN_ARG(x) (x)

#endif

#endif

File Added: xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c
/*
 * SBus Weitek P9100 EXA support
 *
/*-
 * Copyright (c) 2021 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Julian Coleman.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "pnozz.h"
#include "pnozz_regs.h"


static CARD32 PnozzCopyROP[] = {
	/*GXclear*/		0,
	/*GXand*/		ROP_SRC & ROP_DST,
	/*GXandReverse*/	ROP_SRC & (~ROP_DST),
	/*GXcopy*/		ROP_SRC,
	/*GXandInverted*/	(~ROP_SRC) & ROP_DST,
	/*GXnoop*/		ROP_DST,
	/*GXxor*/		ROP_SRC ^ ROP_DST,
	/*GXor*/		ROP_SRC | ROP_DST,
	/*GXnor*/		(~ROP_SRC) & (~ROP_DST),
	/*GXequiv*/		(~ROP_SRC) ^ ROP_DST,
	/*GXinvert*/		(~ROP_DST),
	/*GXorReverse*/		ROP_SRC | (~ROP_DST),
	/*GXcopyInverted*/	(~ROP_SRC),
	/*GXorInverted*/	(~ROP_SRC) | ROP_DST,
	/*GXnand*/		(~ROP_SRC) | (~ROP_DST),
	/*GXset*/		ROP_SET
};

static CARD32 PnozzDrawROP[] = {
	/*GXclear*/		0,
	/*GXand*/		ROP_PAT & ROP_DST,
	/*GXandReverse*/	ROP_PAT & (~ROP_DST),
	/*GXcopy*/		ROP_PAT,
	/*GXandInverted*/	(~ROP_PAT) & ROP_DST,
	/*GXnoop*/		ROP_DST,
	/*GXxor*/		ROP_PAT ^ ROP_DST,
	/*GXor*/		ROP_PAT | ROP_DST,
	/*GXnor*/		(~ROP_PAT) & (~ROP_DST),
	/*GXequiv*/		(~ROP_PAT) ^ ROP_DST,
	/*GXinvert*/		(~ROP_DST),
	/*GXorReverse*/		ROP_PAT | (~ROP_DST),
	/*GXcopyInverted*/	(~ROP_PAT),
	/*GXorInverted*/	(~ROP_PAT) | ROP_DST,
	/*GXnand*/		(~ROP_PAT) | (~ROP_DST),
	/*GXset*/		ROP_PAT
};

#define waitReady(pPnozz) while((pnozz_read_4(pPnozz, ENGINE_STATUS) & \
				(ENGINE_BUSY | BLITTER_BUSY)) !=0 )

void PnozzInitEngine(PnozzPtr);
void pnozz_write_colour(PnozzPtr pPnozz, int reg, CARD32 colour);

CARD32 MaxClip, junk;

static void
PnozzWaitMarker(ScreenPtr pScreen, int Marker)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    PnozzPtr p = GET_PNOZZ_FROM_SCRN(pScrn);

    waitReady(p);
}

static Bool
PnozzPrepareCopy
(
    PixmapPtr pSrcPixmap,
    PixmapPtr pDstPixmap,
    int       xdir,
    int       ydir,
    int       alu,
    Pixel     planemask
)
{
    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
    
    waitReady(pPnozz);
    pnozz_write_4(pPnozz, RASTER_OP, (PnozzCopyROP[alu] & 0xff));
    pnozz_write_4(pPnozz, PLANE_MASK, planemask);
    pPnozz->srcoff = exaGetPixmapOffset(pSrcPixmap) / pPnozz->width;

    return TRUE;
}

static void
PnozzCopy
(
    PixmapPtr pDstPixmap,
    int       xSrc,
    int       ySrc,
    int       xDst,
    int       yDst,
    int       w,
    int       h
)
{
    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
    CARD32 src, dst, srcw, dstw;
    int doff = exaGetPixmapOffset(pDstPixmap) / pPnozz->width;
    
    src = (((xSrc << pPnozz->depthshift) & 0x1fff) << 16) |
	((ySrc + pPnozz->srcoff) & 0x1fff);
    dst = (((xDst << pPnozz->depthshift) & 0x1fff) << 16) |
	((yDst + doff) & 0x1fff);
    srcw = ((((xSrc + w) << pPnozz->depthshift) - 1) << 16) | 
        ((ySrc + pPnozz->srcoff + h - 1) & 0x1fff);
    dstw = ((((xDst + w) << pPnozz->depthshift) - 1) << 16) |
        ((yDst + doff + h - 1) & 0x1fff);

    waitReady(pPnozz);

    pnozz_write_4(pPnozz, ABS_XY0, src);
    pnozz_write_4(pPnozz, ABS_XY1, srcw);
    pnozz_write_4(pPnozz, ABS_XY2, dst);
    pnozz_write_4(pPnozz, ABS_XY3, dstw);
    junk = pnozz_read_4(pPnozz, COMMAND_BLIT);
    exaMarkSync(pDstPixmap->drawable.pScreen);
}

static void
PnozzDoneCopy(PixmapPtr pDstPixmap)
{
    ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);

    waitReady(pPnozz);
}

static Bool
PnozzPrepareSolid(
    PixmapPtr pPixmap,
    int alu,
    Pixel planemask,
    Pixel fg)
{
    ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
    
    waitReady(pPnozz);
    pnozz_write_colour(pPnozz, FOREGROUND_COLOR, fg);
    pnozz_write_4(pPnozz, RASTER_OP, PnozzDrawROP[alu] & 0xff);
    pnozz_write_4(pPnozz, PLANE_MASK, planemask);
    pnozz_write_4(pPnozz, COORD_INDEX, 0);

    return TRUE;
}

static void
PnozzSolid(
    PixmapPtr pPixmap,
    int x,
    int y,
    int x2,
    int y2)
{
    ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
    int w = x2 - x - 1;
    int h = y2 - y - 1;

    waitReady(pPnozz);
    pnozz_write_4(pPnozz, RECT_RTW_XY, ((x & 0x1fff) << 16) | 
        (y & 0x1fff));
    pnozz_write_4(pPnozz, RECT_RTP_XY, (((w & 0x1fff) << 16) | 
        (h & 0x1fff)));
    junk = pnozz_read_4(pPnozz, COMMAND_QUAD);
    exaMarkSync(pPixmap->drawable.pScreen);
}

int
PnozzEXAInit(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
    ExaDriverPtr pExa;
    
    PnozzInitEngine(pPnozz);

    pExa = exaDriverAlloc();
    if (!pExa)
	return FALSE;

    pPnozz->pExa = pExa;

    pExa->exa_major = EXA_VERSION_MAJOR;
    pExa->exa_minor = EXA_VERSION_MINOR;

    pExa->memoryBase = pPnozz->fb;

    /* round to multiple of pixmap pitch */
    pExa->memorySize = (pPnozz->vidmem / pPnozz->width) * pPnozz->width;
    pExa->offScreenBase = pPnozz->width * pPnozz->height;

    /*
     * our blitter can't deal with variable pitches
     */
    pExa->pixmapOffsetAlign = pPnozz->width;
    pExa->pixmapPitchAlign = pPnozz->width;

    pExa->flags = EXA_MIXED_PIXMAPS;

    pExa->maxX = 4096;
    pExa->maxY = 4096;

    pExa->WaitMarker = PnozzWaitMarker;

    pExa->PrepareSolid = PnozzPrepareSolid;
    pExa->Solid = PnozzSolid;
    pExa->DoneSolid = PnozzDoneCopy;

    pExa->PrepareCopy = PnozzPrepareCopy;
    pExa->Copy = PnozzCopy;
    pExa->DoneCopy = PnozzDoneCopy;

    return exaDriverInit(pScreen, pExa);;
}

cvs diff -r1.1 -r1.2 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h 2009/08/26 22:28:26 1.1
+++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h 2021/05/27 04:48:10 1.2
@@ -10,72 +10,86 @@ @@ -10,72 +10,86 @@
10 * copies of the Software, and to permit persons to whom the Software is 10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions: 11 * furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23/* $NetBSD: pnozz.h,v 1.1 2009/08/26 22:28:26 macallan Exp $ */ 23/* $NetBSD: pnozz.h,v 1.2 2021/05/27 04:48:10 jdc Exp $ */
24 24
25#ifndef PNOZZ_H 25#ifndef PNOZZ_H
26#define PNOZZ_H 26#define PNOZZ_H
27 27
28#include "xf86.h" 28#include "xf86.h"
29#include "xf86_OSproc.h" 29#include "xf86_OSproc.h"
30#include "xf86RamDac.h" 30#include "xf86RamDac.h"
31#include <X11/Xmd.h> 31#include <X11/Xmd.h>
 32#include <dev/sun/fbio.h>
32#include "gcstruct.h" 33#include "gcstruct.h"
33#include "pnozz_regs.h" 34#include "pnozz_regs.h"
34#include "xf86sbusBus.h" 35#include "xf86sbusBus.h"
 36#ifdef HAVE_XAA_H
35#include "xaa.h" 37#include "xaa.h"
 38#endif
 39#include "exa.h"
36 40
37typedef struct { 41typedef struct {
38 unsigned int fg, bg; /* FG/BG colors for stipple */ 42 unsigned int fg, bg; /* FG/BG colors for stipple */
39 unsigned int patalign; /* X/Y alignment of bits */ 43 unsigned int patalign; /* X/Y alignment of bits */
40 unsigned int alu; /* Transparent/Opaque + rop */ 44 unsigned int alu; /* Transparent/Opaque + rop */
41 unsigned int bits[32]; /* The stipple bits themselves */ 45 unsigned int bits[32]; /* The stipple bits themselves */
42} PnozzStippleRec, *PnozzStipplePtr; 46} PnozzStippleRec, *PnozzStipplePtr;
43 47
44typedef struct { 48typedef struct {
45 int type; 49 int type;
46 PnozzStipplePtr stipple; 50 PnozzStipplePtr stipple;
47} PnozzPrivGCRec, *PnozzPrivGCPtr; 51} PnozzPrivGCRec, *PnozzPrivGCPtr;
48 52
49typedef struct { 53typedef struct {
50 unsigned char *fb; /* 2MB framebuffer */ 54 unsigned char *fb; /* 2MB framebuffer */
51 unsigned char *fbc; /* registers, so we can just add a byte offset */ 55 unsigned char *fbc; /* registers, so we can just add a byte offset */
52 int vclipmax; 56 int vclipmax;
53 int width; 57 int width;
54 int height, scanlinesize, maxheight; 58 int height, scanlinesize, maxheight;
55 int depthshift; 59 int depthshift;
 60 int vidmem;
56 61
57 sbusDevicePtr psdp; 62 sbusDevicePtr psdp;
 63 struct fbcursor Cursor;
58 Bool HWCursor; 64 Bool HWCursor;
59 Bool NoAccel; 65 Bool NoAccel;
 66 Bool useXAA;
60 CloseScreenProcPtr CloseScreen; 67 CloseScreenProcPtr CloseScreen;
61  68
62 xf86CursorInfoPtr CursorInfoRec; 69 xf86CursorInfoPtr CursorInfoRec;
63 struct fbcursor Cursor; 70 unsigned int CursorXY;
 71 int CursorBg, CursorFg;
 72 Bool CursorEnabled;
 73 unsigned int cursmask[32]; /* cursor mask bits */
 74 unsigned int cursbits[32]; /* what to show where mask enabled */
64 unsigned char pal[9]; 75 unsigned char pal[9];
65  76
66 OptionInfoPtr Options; 77 OptionInfoPtr Options;
67 XAAInfoRecPtr pXAA; 78 ExaDriverPtr pExa;
 79 int srcoff;
 80#ifdef HAVE_XAA_H
68 unsigned char *buffers[2]; 81 unsigned char *buffers[2];
 82#endif
69 /* 83 /*
70 * XXX this is enough for everything a SPARCbook could do on it's 84 * XXX this is enough for everything a SPARCbook could do on it's
71 * internal display but not necessarily for an external one 85 * internal display but not necessarily for an external one
72 */ 86 */
73 CARD32 Buffer[6400]; 87 CARD32 Buffer[6400];
74 int words, last_word; 88 int words, last_word;
75 int offset_mask; 89 int offset_mask;
76 90
77 int DidSave; 91 int DidSave;
78 unsigned int SvSysConf; /* System Configuration Register */ 92 unsigned int SvSysConf; /* System Configuration Register */
79 unsigned int CRTC[4]; /* CRTC values for horizontal timing */ 93 unsigned int CRTC[4]; /* CRTC values for horizontal timing */
80 unsigned int SvMemCtl; /* memory control register */ 94 unsigned int SvMemCtl; /* memory control register */
81 unsigned char SvDAC_MCCR; /* DAC Misc Clock Ctrl (0x02) */ 95 unsigned char SvDAC_MCCR; /* DAC Misc Clock Ctrl (0x02) */
@@ -104,17 +118,19 @@ extern int PnozzWindowPrivateIndex; @@ -104,17 +118,19 @@ extern int PnozzWindowPrivateIndex;
104#define PnozzSetWindowPrivate(w,p) \ 118#define PnozzSetWindowPrivate(w,p) \
105((w)->devPrivates[PnozzWindowPrivateIndex].ptr = (pointer) p) 119((w)->devPrivates[PnozzWindowPrivateIndex].ptr = (pointer) p)
106 120
107void pnozz_write_4(PnozzPtr, int, unsigned int); 121void pnozz_write_4(PnozzPtr, int, unsigned int);
108unsigned int pnozz_read_4(PnozzPtr, int); 122unsigned int pnozz_read_4(PnozzPtr, int);
109void pnozz_write_dac(PnozzPtr, int, unsigned char); 123void pnozz_write_dac(PnozzPtr, int, unsigned char);
110unsigned char pnozz_read_dac(PnozzPtr, int); 124unsigned char pnozz_read_dac(PnozzPtr, int);
111void pnozz_write_dac_ctl_reg(PnozzPtr, int, unsigned char); 125void pnozz_write_dac_ctl_reg(PnozzPtr, int, unsigned char);
112void pnozz_write_dac_ctl_reg_2(PnozzPtr, int, unsigned short); 126void pnozz_write_dac_ctl_reg_2(PnozzPtr, int, unsigned short);
113unsigned char pnozz_read_dac_ctl_reg(PnozzPtr, int); 127unsigned char pnozz_read_dac_ctl_reg(PnozzPtr, int);
114void pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int); 128void pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int);
115 129
116int PnozzAccelInit(ScrnInfoPtr); 130int PnozzAccelInit(ScrnInfoPtr);
 131Bool PnozzDGAInit(ScreenPtr);
 132int PnozzEXAInit(ScreenPtr);
117void PnozzHideCursor(ScrnInfoPtr); 133void PnozzHideCursor(ScrnInfoPtr);
118void PnozzShowCursor(ScrnInfoPtr); 134void PnozzShowCursor(ScrnInfoPtr);
119 135
120#endif /* CG6_H */ 136#endif /* PNOZZ_H */

cvs diff -r1.2 -r1.3 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c 2011/05/25 14:15:26 1.2
+++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c 2021/05/27 04:48:10 1.3
@@ -10,35 +10,35 @@ @@ -10,35 +10,35 @@
10 * copies of the Software, and to permit persons to whom the Software is 10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions: 11 * furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23/* $NetBSD: pnozz_accel.c,v 1.2 2011/05/25 14:15:26 christos Exp $ */ 23/* $NetBSD: pnozz_accel.c,v 1.3 2021/05/27 04:48:10 jdc Exp $ */
24 24
25#include <fcntl.h> 25#ifdef HAVE_CONFIG_H
26#include <sys/time.h> 26#include "config.h"
27#include <sys/types.h> 27#endif
28#include <dev/sun/fbio.h> 
29#include <dev/wscons/wsconsio.h> 
30 28
31#include "pnozz.h" 29#include "pnozz.h"
 30#include "pnozz_regs.h"
 31#include "dgaproc.h"
32 32
33static CARD32 PnozzCopyROP[] = { 33static CARD32 PnozzCopyROP[] = {
34 /*GXclear*/ 0, 34 /*GXclear*/ 0,
35 /*GXand*/ ROP_SRC & ROP_DST, 35 /*GXand*/ ROP_SRC & ROP_DST,
36 /*GXandReverse*/ ROP_SRC & (~ROP_DST), 36 /*GXandReverse*/ ROP_SRC & (~ROP_DST),
37 /*GXcopy*/ ROP_SRC, 37 /*GXcopy*/ ROP_SRC,
38 /*GXandInverted*/ (~ROP_SRC) & ROP_DST, 38 /*GXandInverted*/ (~ROP_SRC) & ROP_DST,
39 /*GXnoop*/ ROP_DST, 39 /*GXnoop*/ ROP_DST,
40 /*GXxor*/ ROP_SRC ^ ROP_DST, 40 /*GXxor*/ ROP_SRC ^ ROP_DST,
41 /*GXor*/ ROP_SRC | ROP_DST, 41 /*GXor*/ ROP_SRC | ROP_DST,
42 /*GXnor*/ (~ROP_SRC) & (~ROP_DST), 42 /*GXnor*/ (~ROP_SRC) & (~ROP_DST),
43 /*GXequiv*/ (~ROP_SRC) ^ ROP_DST, 43 /*GXequiv*/ (~ROP_SRC) ^ ROP_DST,
44 /*GXinvert*/ (~ROP_DST), 44 /*GXinvert*/ (~ROP_DST),
@@ -58,43 +58,68 @@ static CARD32 PnozzDrawROP[] = { @@ -58,43 +58,68 @@ static CARD32 PnozzDrawROP[] = {
58 /*GXnoop*/ ROP_DST, 58 /*GXnoop*/ ROP_DST,
59 /*GXxor*/ ROP_PAT ^ ROP_DST, 59 /*GXxor*/ ROP_PAT ^ ROP_DST,
60 /*GXor*/ ROP_PAT | ROP_DST, 60 /*GXor*/ ROP_PAT | ROP_DST,
61 /*GXnor*/ (~ROP_PAT) & (~ROP_DST), 61 /*GXnor*/ (~ROP_PAT) & (~ROP_DST),
62 /*GXequiv*/ (~ROP_PAT) ^ ROP_DST, 62 /*GXequiv*/ (~ROP_PAT) ^ ROP_DST,
63 /*GXinvert*/ (~ROP_DST), 63 /*GXinvert*/ (~ROP_DST),
64 /*GXorReverse*/ ROP_PAT | (~ROP_DST), 64 /*GXorReverse*/ ROP_PAT | (~ROP_DST),
65 /*GXcopyInverted*/ (~ROP_PAT), 65 /*GXcopyInverted*/ (~ROP_PAT),
66 /*GXorInverted*/ (~ROP_PAT) | ROP_DST, 66 /*GXorInverted*/ (~ROP_PAT) | ROP_DST,
67 /*GXnand*/ (~ROP_PAT) | (~ROP_DST), 67 /*GXnand*/ (~ROP_PAT) | (~ROP_DST),
68 /*GXset*/ ROP_PAT 68 /*GXset*/ ROP_PAT
69}; 69};
70 70
 71/* DGA stuff */
 72
 73static Bool Pnozz_OpenFramebuffer(ScrnInfoPtr pScrn, char **,
 74 unsigned char **mem, int *, int *, int *);
 75static Bool Pnozz_SetMode(ScrnInfoPtr, DGAModePtr);
 76static void Pnozz_SetViewport(ScrnInfoPtr, int, int, int);
 77static int Pnozz_GetViewport(ScrnInfoPtr);
 78static void Pnozz_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 79static void Pnozz_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
 80
 81static void PnozzSync(ScrnInfoPtr);
 82
 83static DGAFunctionRec Pnozz_DGAFuncs = {
 84 Pnozz_OpenFramebuffer,
 85 NULL,
 86 Pnozz_SetMode,
 87 Pnozz_SetViewport,
 88 Pnozz_GetViewport,
 89 PnozzSync,
 90 Pnozz_FillRect,
 91 Pnozz_BlitRect,
 92 NULL
 93};
 94
 95
71CARD32 MaxClip, junk; 96CARD32 MaxClip, junk;
72 97
73void 98void
74PnozzSync(ScrnInfoPtr pScrn) 99PnozzSync(ScrnInfoPtr pScrn)
75{ 100{
76 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 101 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
77 while((pnozz_read_4(pPnozz, ENGINE_STATUS) &  102 while((pnozz_read_4(pPnozz, ENGINE_STATUS) &
78 (ENGINE_BUSY | BLITTER_BUSY)) !=0 ); 103 (ENGINE_BUSY | BLITTER_BUSY)) !=0 );
79} 104}
80 105
81/* 106/*
82 * Both the framebuffer and the colour registers are apparently little endian. 107 * Both the framebuffer and the colour registers are apparently little endian.
83 * For framebuffer accesses we can just turn on byte swapping, for the colour 108 * For framebuffer accesses we can just turn on byte swapping, for the colour
84 * registers we need to juggle bytes ourselves. 109 * registers we need to juggle bytes ourselves.
85 */ 110 */
86 111
87static void 112void
88pnozz_write_colour(PnozzPtr pPnozz, int reg, CARD32 colour) 113pnozz_write_colour(PnozzPtr pPnozz, int reg, CARD32 colour)
89{ 114{
90 CARD32 c2; 115 CARD32 c2;
91  116
92 switch(pPnozz->depthshift)  117 switch(pPnozz->depthshift)
93 { 118 {
94 case 0: 119 case 0:
95 c2 = (colour << 8 | colour); 120 c2 = (colour << 8 | colour);
96 pnozz_write_4(pPnozz, reg, c2 << 16 | c2); 121 pnozz_write_4(pPnozz, reg, c2 << 16 | c2);
97 break; 122 break;
98 case 1: 123 case 1:
99 c2 = ((colour & 0xff) << 8) | ((colour & 0xff00) >> 8); 124 c2 = ((colour & 0xff) << 8) | ((colour & 0xff00) >> 8);
100 c2 |= c2 << 16; 125 c2 |= c2 << 16;
@@ -107,27 +132,27 @@ pnozz_write_colour(PnozzPtr pPnozz, int  @@ -107,27 +132,27 @@ pnozz_write_colour(PnozzPtr pPnozz, int
107 break; 132 break;
108 } 133 }
109} 134}
110 135
111static void unClip(PnozzPtr pPnozz) 136static void unClip(PnozzPtr pPnozz)
112{ 137{
113 pnozz_write_4(pPnozz, WINDOW_OFFSET, 0); 138 pnozz_write_4(pPnozz, WINDOW_OFFSET, 0);
114 pnozz_write_4(pPnozz, WINDOW_MIN, 0); 139 pnozz_write_4(pPnozz, WINDOW_MIN, 0);
115 pnozz_write_4(pPnozz, WINDOW_MAX, MaxClip); 140 pnozz_write_4(pPnozz, WINDOW_MAX, MaxClip);
116 pnozz_write_4(pPnozz, BYTE_CLIP_MIN, 0); 141 pnozz_write_4(pPnozz, BYTE_CLIP_MIN, 0);
117 pnozz_write_4(pPnozz, BYTE_CLIP_MAX, MaxClip); 142 pnozz_write_4(pPnozz, BYTE_CLIP_MAX, MaxClip);
118} 143}
119 144
120static void 145void
121PnozzInitEngine(PnozzPtr pPnozz) 146PnozzInitEngine(PnozzPtr pPnozz)
122{ 147{
123 unClip(pPnozz); 148 unClip(pPnozz);
124 pnozz_write_4(pPnozz, DRAW_MODE, 0); 149 pnozz_write_4(pPnozz, DRAW_MODE, 0);
125 pnozz_write_4(pPnozz, PLANE_MASK, 0xffffffff);  150 pnozz_write_4(pPnozz, PLANE_MASK, 0xffffffff);
126 pnozz_write_4(pPnozz, PATTERN0, 0xffffffff);  151 pnozz_write_4(pPnozz, PATTERN0, 0xffffffff);
127 pnozz_write_4(pPnozz, PATTERN1, 0xffffffff);  152 pnozz_write_4(pPnozz, PATTERN1, 0xffffffff);
128 pnozz_write_4(pPnozz, PATTERN2, 0xffffffff);  153 pnozz_write_4(pPnozz, PATTERN2, 0xffffffff);
129 pnozz_write_4(pPnozz, PATTERN3, 0xffffffff);  154 pnozz_write_4(pPnozz, PATTERN3, 0xffffffff);
130} 155}
131 156
132static void 157static void
133PnozzSetupForScreenToScreenCopy( 158PnozzSetupForScreenToScreenCopy(
@@ -213,26 +238,28 @@ PnozzSubsequentSolidFillRect @@ -213,26 +238,28 @@ PnozzSubsequentSolidFillRect
213 int h 238 int h
214) 239)
215{ 240{
216 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 241 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
217  242
218 PnozzSync(pScrn); 243 PnozzSync(pScrn);
219 pnozz_write_4(pPnozz, RECT_RTW_XY, ((x & 0x1fff) << 16) |  244 pnozz_write_4(pPnozz, RECT_RTW_XY, ((x & 0x1fff) << 16) |
220 (y & 0x1fff)); 245 (y & 0x1fff));
221 pnozz_write_4(pPnozz, RECT_RTP_XY, (((w & 0x1fff) << 16) |  246 pnozz_write_4(pPnozz, RECT_RTP_XY, (((w & 0x1fff) << 16) |
222 (h & 0x1fff))); 247 (h & 0x1fff)));
223 junk = pnozz_read_4(pPnozz, COMMAND_QUAD); 248 junk = pnozz_read_4(pPnozz, COMMAND_QUAD);
224} 249}
225 250
 251#ifdef HAVE_XAA_H
 252
226static void  253static void
227PnozzSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, 254PnozzSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
228 int fg, int bg, 255 int fg, int bg,
229 int rop, 256 int rop,
230 unsigned int planemask) 257 unsigned int planemask)
231{ 258{
232 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 259 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
233  260
234 PnozzSync(pScrn); 261 PnozzSync(pScrn);
235  262
236 if (bg == -1) { 263 if (bg == -1) {
237 /* transparent */ 264 /* transparent */
238 pnozz_write_colour(pPnozz, FOREGROUND_COLOR, fg);  265 pnozz_write_colour(pPnozz, FOREGROUND_COLOR, fg);
@@ -431,27 +458,26 @@ PnozzImageWriteRect(ScrnInfoPtr pScrn, i @@ -431,27 +458,26 @@ PnozzImageWriteRect(ScrnInfoPtr pScrn, i
431 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 458 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
432 volatile CARD32 junk; 459 volatile CARD32 junk;
433  460
434 pnozz_write_4(pPnozz, ABS_X0, x); 461 pnozz_write_4(pPnozz, ABS_X0, x);
435 pnozz_write_4(pPnozz, ABS_XY1, (x << 16) | y); 462 pnozz_write_4(pPnozz, ABS_XY1, (x << 16) | y);
436 pnozz_write_4(pPnozz, ABS_X2, x + wi); 463 pnozz_write_4(pPnozz, ABS_X2, x + wi);
437 pnozz_write_4(pPnozz, ABS_Y3, 1); 464 pnozz_write_4(pPnozz, ABS_Y3, 1);
438 junk = *(volatile CARD32 *)(pPnozz->fb + PIXEL_8); 465 junk = *(volatile CARD32 *)(pPnozz->fb + PIXEL_8);
439} 466}
440 467
441/* 468/*
442 * TODO: 469 * TODO:
443 * - CPU to VRAM colour blits 470 * - CPU to VRAM colour blits
444 * - DGA support 
445 */ 471 */
446 472
447int 473int
448PnozzAccelInit(ScrnInfoPtr pScrn) 474PnozzAccelInit(ScrnInfoPtr pScrn)
449{ 475{
450 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 476 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
451 XAAInfoRecPtr pXAAInfo = pPnozz->pXAA; 477 XAAInfoRecPtr pXAAInfo = pPnozz->pXAA;
452 478
453 pXAAInfo->Flags = LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS; 479 pXAAInfo->Flags = LINEAR_FRAMEBUFFER | PIXMAP_CACHE | OFFSCREEN_PIXMAPS;
454 pXAAInfo->maxOffPixWidth = pPnozz->width; 480 pXAAInfo->maxOffPixWidth = pPnozz->width;
455 pXAAInfo->maxOffPixHeight = pPnozz->maxheight; 481 pXAAInfo->maxOffPixHeight = pPnozz->maxheight;
456 MaxClip = ((pPnozz->scanlinesize & 0xffff) << 16) | (pPnozz->maxheight); 482 MaxClip = ((pPnozz->scanlinesize & 0xffff) << 16) | (pPnozz->maxheight);
457  483
@@ -525,13 +551,124 @@ PnozzAccelInit(ScrnInfoPtr pScrn) @@ -525,13 +551,124 @@ PnozzAccelInit(ScrnInfoPtr pScrn)
525 pXAAInfo->SubsequentMono8x8PatternFillRect = 551 pXAAInfo->SubsequentMono8x8PatternFillRect =
526 PnozzSubsequentMono8x8PatternFillRect; 552 PnozzSubsequentMono8x8PatternFillRect;
527 553
528 /* image uploads */ 554 /* image uploads */
529 pXAAInfo->ImageWriteBase = pPnozz->fbc + PIXEL_8; 555 pXAAInfo->ImageWriteBase = pPnozz->fbc + PIXEL_8;
530 pXAAInfo->ImageWriteRange = 4; 556 pXAAInfo->ImageWriteRange = 4;
531 pXAAInfo->ImageWriteFlags = /*CPU_TRANSFER_BASE_FIXED |*/ CPU_TRANSFER_PAD_DWORD | 557 pXAAInfo->ImageWriteFlags = /*CPU_TRANSFER_BASE_FIXED |*/ CPU_TRANSFER_PAD_DWORD |
532 NO_TRANSPARENCY; 558 NO_TRANSPARENCY;
533 pXAAInfo->SetupForImageWrite = PnozzSetupForImageWrite; 559 pXAAInfo->SetupForImageWrite = PnozzSetupForImageWrite;
534 pXAAInfo->SubsequentImageWriteRect = PnozzImageWriteRect; 560 pXAAInfo->SubsequentImageWriteRect = PnozzImageWriteRect;
535  561
536 return 0; 562 return 0;
537} 563}
 564
 565#endif /* HAVE_XAA_H */
 566
 567Bool
 568PnozzDGAInit(ScreenPtr pScreen)
 569{
 570 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 571 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
 572 DGAModePtr mode;
 573 int result;
 574
 575 mode = xnfcalloc(sizeof(DGAModeRec), 1);
 576 if (mode == NULL) {
 577 xf86Msg(X_WARNING, "%s: DGA setup failed, cannot allocate memory\n",
 578 pPnozz->psdp->device);
 579 return FALSE;
 580 }
 581
 582 mode->mode = pScrn->modes;
 583 mode->flags = DGA_PIXMAP_AVAILABLE | DGA_CONCURRENT_ACCESS;
 584 if(!pPnozz->NoAccel) {
 585 mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
 586 }
 587
 588 mode->imageWidth = mode->pixmapWidth = mode->viewportWidth =
 589 pScrn->virtualX;
 590 mode->imageHeight = mode->pixmapHeight = mode->viewportHeight =
 591 pScrn->virtualY;
 592
 593 mode->bytesPerScanline = mode->imageWidth;
 594
 595 mode->byteOrder = pScrn->imageByteOrder;
 596 mode->depth = 8;
 597 mode->bitsPerPixel = 8;
 598 mode->red_mask = pScrn->mask.red;
 599 mode->green_mask = pScrn->mask.green;
 600 mode->blue_mask = pScrn->mask.blue;
 601
 602 mode->visualClass = PseudoColor;
 603 mode->address = pPnozz->fb;
 604
 605 result = DGAInit(pScreen, &Pnozz_DGAFuncs, mode, 1);
 606
 607 if (result) {
 608 xf86Msg(X_INFO, "%s: DGA initialized\n",
 609 pPnozz->psdp->device);
 610 return TRUE;
 611 } else {
 612 xf86Msg(X_WARNING, "%s: DGA setup failed\n",
 613 pPnozz->psdp->device);
 614 return FALSE;
 615 }
 616}
 617
 618static Bool
 619Pnozz_OpenFramebuffer(ScrnInfoPtr pScrn, char **name,
 620 unsigned char **mem,
 621 int *size, int *offset,
 622 int *extra)
 623{
 624 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
 625
 626 *name = pPnozz->psdp->device;
 627
 628 *mem = (unsigned char*)0;
 629 *size = pPnozz->vidmem;
 630 *offset = 0;
 631 *extra = 0;
 632
 633 return TRUE;
 634}
 635
 636static Bool
 637Pnozz_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
 638{
 639 /*
 640 * Nothing to do, we currently only support one mode
 641 * and we are always in it.
 642 */
 643 return TRUE;
 644}
 645
 646static void
 647Pnozz_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
 648{
 649 /* We don't support viewports, so... */
 650}
 651
 652static int
 653Pnozz_GetViewport(ScrnInfoPtr pScrn)
 654{
 655 /* No viewports, none pending... */
 656 return 0;
 657}
 658
 659static void
 660Pnozz_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color)
 661{
 662
 663 PnozzSetupForSolidFill(pScrn, color, GXset, 8);
 664 PnozzSubsequentSolidFillRect(pScrn, x, y, w, h);
 665}
 666
 667static void
 668Pnozz_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy,
 669 int w, int h, int dstx, int dsty)
 670{
 671
 672 PnozzSetupForScreenToScreenCopy(pScrn, 0, 0, GXcopy, 8, 0);
 673 PnozzSubsequentScreenToScreenCopy(pScrn, srcx, srcy, dstx, dsty, w, h);
 674}

cvs diff -r1.2 -r1.3 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_cursor.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_cursor.c 2011/05/25 23:36:39 1.2
+++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_cursor.c 2021/05/27 04:48:10 1.3
@@ -10,33 +10,36 @@ @@ -10,33 +10,36 @@
10 * copies of the Software, and to permit persons to whom the Software is 10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions: 11 * furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23/* $NetBSD: pnozz_cursor.c,v 1.2 2011/05/25 23:36:39 macallan Exp $ */ 23/* $NetBSD: pnozz_cursor.c,v 1.3 2021/05/27 04:48:10 jdc Exp $ */
 24
 25#ifdef HAVE_CONFIG_H
 26#include "config.h"
 27#endif
24 28
25#include <fcntl.h> 29#include <fcntl.h>
26#include <sys/time.h> 30#include <sys/time.h>
27#include <sys/types.h> 31#include <sys/types.h>
28#include <sys/ioctl.h> 32#include <sys/ioctl.h>
29#include <dev/sun/fbio.h> 
30#include <dev/wscons/wsconsio.h> 33#include <dev/wscons/wsconsio.h>
31 34
32#include "pnozz.h" 35#include "pnozz.h"
33 36
34static void PnozzLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); 37static void PnozzLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
35static void PnozzSetCursorPosition(ScrnInfoPtr pScrn, int x, int y); 38static void PnozzSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
36static void PnozzSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); 39static void PnozzSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
37 40
38static void 41static void
39PnozzLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) 42PnozzLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
40{ 43{
41 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 44 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
42  45

cvs diff -r1.6 -r1.7 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_driver.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_driver.c 2016/08/16 01:27:47 1.6
+++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_driver.c 2021/05/27 04:48:10 1.7
@@ -10,151 +10,133 @@ @@ -10,151 +10,133 @@
10 * copies of the Software, and to permit persons to whom the Software is 10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions: 11 * furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23/* $NetBSD: pnozz_driver.c,v 1.6 2016/08/16 01:27:47 mrg Exp $ */ 23/* $NetBSD: pnozz_driver.c,v 1.7 2021/05/27 04:48:10 jdc Exp $ */
24 24
25/* 25/*
26 * this driver has been tested on SPARCbook 3GX and 3TX, it supports full  26 * this driver has been tested on SPARCbook 3GX and 3TX, it supports full
27 * acceleration in 8, 16 and 24 bit colour 27 * acceleration in 8, 16 and 24 bit colour
28 */ 28 */
29 29
30#include <fcntl.h> 30#ifdef HAVE_CONFIG_H
31#include <sys/time.h> 31#include "config.h"
32#include <sys/types.h> 32#endif
 33
33#include <sys/ioctl.h> 34#include <sys/ioctl.h>
34#include <dev/sun/fbio.h> 
35#include <dev/wscons/wsconsio.h> 
36 35
 36#include "pnozz.h"
37#include "xf86.h" 37#include "xf86.h"
38#include "xf86_OSproc.h" 38#include "xf86_OSproc.h"
39 
40#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 
41#include "xf86Resources.h" 
42#endif 
43#include "xf86sbusBus.h" 
44 
45#include "mipointer.h" 39#include "mipointer.h"
46#include "micmap.h" 40#include "micmap.h"
47 41
48#define DEBUG 0 42#define DEBUG 1
49 43
50#include "fb.h" 44#include "fb.h"
51#include "xf86cmap.h" 45#include "xf86cmap.h"
52#include "pnozz.h" 
53 46
54#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) > 6 47#include "compat-api.h"
55#define xf86LoaderReqSymLists(...) do {} while (0) 
56#define LoaderRefSymLists(...) do {} while (0) 
57#endif 
58 48
59static const OptionInfoRec * PnozzAvailableOptions(int chipid, int busid); 49static const OptionInfoRec * PnozzAvailableOptions(int chipid, int busid);
60static void PnozzIdentify(int flags); 50static void PnozzIdentify(int flags);
61static Bool PnozzProbe(DriverPtr drv, int flags); 51static Bool PnozzProbe(DriverPtr drv, int flags);
62static Bool PnozzPreInit(ScrnInfoPtr pScrn, int flags); 52static Bool PnozzPreInit(ScrnInfoPtr pScrn, int flags);
63static Bool PnozzScreenInit(int Index, ScreenPtr pScreen, int argc, 53static Bool PnozzScreenInit(SCREEN_INIT_ARGS_DECL);
64 char **argv); 54static Bool PnozzEnterVT(VT_FUNC_ARGS_DECL);
65static Bool PnozzEnterVT(int scrnIndex, int flags); 55static void PnozzLeaveVT(VT_FUNC_ARGS_DECL);
66static void PnozzLeaveVT(int scrnIndex, int flags); 56static Bool PnozzCloseScreen(CLOSE_SCREEN_ARGS_DECL);
67static Bool PnozzCloseScreen(int scrnIndex, ScreenPtr pScreen); 
68static Bool PnozzSaveScreen(ScreenPtr pScreen, int mode); 57static Bool PnozzSaveScreen(ScreenPtr pScreen, int mode);
69 58
70/* Required if the driver supports mode switching */ 59/* Required if the driver supports mode switching */
71static Bool PnozzSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); 60static Bool PnozzSwitchMode(SWITCH_MODE_ARGS_DECL);
72/* Required if the driver supports moving the viewport */ 61/* Required if the driver supports moving the viewport */
73static void PnozzAdjustFrame(int scrnIndex, int x, int y, int flags); 62static void PnozzAdjustFrame(ADJUST_FRAME_ARGS_DECL);
74 63
75/* Optional functions */ 64/* Optional functions */
76static void PnozzFreeScreen(int scrnIndex, int flags); 65static void PnozzFreeScreen(FREE_SCREEN_ARGS_DECL);
77static ModeStatus PnozzValidMode(int scrnIndex, DisplayModePtr mode, 66static ModeStatus PnozzValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
78 Bool verbose, int flags); 67 Bool verbose, int flags);
79 68
80void PnozzSync(ScrnInfoPtr); 69void PnozzSync(ScrnInfoPtr);
81void PnozzSave(PnozzPtr); 70void PnozzSave(PnozzPtr);
82void PnozzRestore(PnozzPtr); 71void PnozzRestore(PnozzPtr);
83int PnozzSetDepth(PnozzPtr, int); /* return true or false */ 72int PnozzSetDepth(PnozzPtr, int); /* return true or false */
84void DumpSCR(unsigned int); 73void DumpSCR(unsigned int);
85 74
86static void PnozzLoadPalette(ScrnInfoPtr, int, int *, LOCO *, VisualPtr); 75static void PnozzLoadPalette(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
87 76
88#define VERSION 4000 77#define VERSION 4000
89#define PNOZZ_NAME "p9100" 78#define PNOZZ_NAME "p9100"
90#define PNOZZ_DRIVER_NAME "pnozz" 79#define PNOZZ_DRIVER_NAME "pnozz"
91#define PNOZZ_MAJOR_VERSION 1 80#define PNOZZ_MAJOR_VERSION 2
92#define PNOZZ_MINOR_VERSION 0 81#define PNOZZ_MINOR_VERSION 0
93#define PNOZZ_PATCHLEVEL 0 82#define PNOZZ_PATCHLEVEL 0
94 83
95/*  84/*
96 * This contains the functions needed by the server after loading the driver 85 * This contains the functions needed by the server after loading the driver
97 * module. It must be supplied, and gets passed back by the SetupProc 86 * module. It must be supplied, and gets passed back by the SetupProc
98 * function in the dynamic case. In the static case, a reference to this 87 * function in the dynamic case. In the static case, a reference to this
99 * is compiled in, and this requires that the name of this DriverRec be 88 * is compiled in, and this requires that the name of this DriverRec be
100 * an upper-case version of the driver name. 89 * an upper-case version of the driver name.
101 */ 90 */
102 91
103DriverRec PNOZZ = { 92DriverRec PNOZZ = {
104 VERSION, 93 VERSION,
105 PNOZZ_DRIVER_NAME, 94 PNOZZ_DRIVER_NAME,
106 PnozzIdentify, 95 PnozzIdentify,
107 PnozzProbe, 96 PnozzProbe,
108 PnozzAvailableOptions, 97 PnozzAvailableOptions,
109 NULL, 98 NULL,
110 0 99 0
111}; 100};
112 101
113typedef enum { 102typedef enum {
114 OPTION_SW_CURSOR, 103 OPTION_SW_CURSOR,
115 OPTION_HW_CURSOR, 104 OPTION_HW_CURSOR,
116 OPTION_NOACCEL 105 OPTION_NOACCEL,
 106 OPTION_ACCELMETHOD
117} PnozzOpts; 107} PnozzOpts;
118 108
119static const OptionInfoRec PnozzOptions[] = { 109static const OptionInfoRec PnozzOptions[] = {
120 { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, 110 { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
121 { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, 111 { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
122 { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, 112 { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
 113 { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
123 { -1, NULL, OPTV_NONE, {0}, FALSE } 114 { -1, NULL, OPTV_NONE, {0}, FALSE }
124}; 115};
125 116
126static const char *ramdacSymbols[] = { 117static const char *ramdacSymbols[] = {
127 "xf86CreateCursorInfoRec", 118 "xf86CreateCursorInfoRec",
128 "xf86DestroyCursorInfoRec", 119 "xf86DestroyCursorInfoRec",
129 "xf86InitCursor", 120 "xf86InitCursor",
130 NULL 121 NULL
131}; 122};
132 123
133static const char *fbSymbols[] = { 124static const char *fbSymbols[] = {
134 "fbScreenInit", 125 "fbScreenInit",
135 "fbPictureInit", 126 "fbPictureInit",
136 NULL 127 NULL
137}; 128};
138 129
139static const char *xaaSymbols[] = 
140{ 
141 "XAACreateInfoRec", 
142 "XAADestroyInfoRec", 
143 "XAAInit", 
144 NULL 
145}; 
146#ifdef XFree86LOADER 
147 
148static MODULESETUPPROTO(PnozzSetup); 130static MODULESETUPPROTO(PnozzSetup);
149 131
150static XF86ModuleVersionInfo PnozzVersRec = 132static XF86ModuleVersionInfo PnozzVersRec =
151{ 133{
152 "pnozz", 134 "pnozz",
153 MODULEVENDORSTRING, 135 MODULEVENDORSTRING,
154 MODINFOSTRING1, 136 MODINFOSTRING1,
155 MODINFOSTRING2, 137 MODINFOSTRING2,
156 XORG_VERSION_CURRENT, 138 XORG_VERSION_CURRENT,
157 PNOZZ_MAJOR_VERSION, PNOZZ_MINOR_VERSION, PNOZZ_PATCHLEVEL, 139 PNOZZ_MAJOR_VERSION, PNOZZ_MINOR_VERSION, PNOZZ_PATCHLEVEL,
158 ABI_CLASS_VIDEODRV, 140 ABI_CLASS_VIDEODRV,
159 ABI_VIDEODRV_VERSION, 141 ABI_VIDEODRV_VERSION,
160 MOD_CLASS_VIDEODRV, 142 MOD_CLASS_VIDEODRV,
@@ -162,45 +144,42 @@ static XF86ModuleVersionInfo PnozzVersRe @@ -162,45 +144,42 @@ static XF86ModuleVersionInfo PnozzVersRe
162}; 144};
163 145
164XF86ModuleData pnozzModuleData = { &PnozzVersRec, PnozzSetup, NULL }; 146XF86ModuleData pnozzModuleData = { &PnozzVersRec, PnozzSetup, NULL };
165 147
166pointer 148pointer
167PnozzSetup(pointer module, pointer opts, int *errmaj, int *errmin) 149PnozzSetup(pointer module, pointer opts, int *errmaj, int *errmin)
168{ 150{
169 static Bool setupDone = FALSE; 151 static Bool setupDone = FALSE;
170 152
171 if (!setupDone) { 153 if (!setupDone) {
172 setupDone = TRUE; 154 setupDone = TRUE;
173 xf86AddDriver(&PNOZZ, module, 0); 155 xf86AddDriver(&PNOZZ, module, 0);
174  156
175 LoaderRefSymLists(xaaSymbols, ramdacSymbols, fbSymbols, NULL); 
176 /* 157 /*
177 * Modules that this driver always requires can be loaded here 158 * Modules that this driver always requires can be loaded here
178 * by calling LoadSubModule(). 159 * by calling LoadSubModule().
179 */ 160 */
180 161
181 /* 162 /*
182 * The return value must be non-NULL on success even though there 163 * The return value must be non-NULL on success even though there
183 * is no TearDownProc. 164 * is no TearDownProc.
184 */ 165 */
185 return (pointer)TRUE; 166 return (pointer)TRUE;
186 } else { 167 } else {
187 if (errmaj) *errmaj = LDR_ONCEONLY; 168 if (errmaj) *errmaj = LDR_ONCEONLY;
188 return NULL; 169 return NULL;
189 } 170 }
190} 171}
191 172
192#endif /* XFree86LOADER */ 
193 
194static volatile unsigned int scratch32; 173static volatile unsigned int scratch32;
195 174
196void pnozz_write_4(PnozzPtr p, int offset, unsigned int value) 175void pnozz_write_4(PnozzPtr p, int offset, unsigned int value)
197{ 176{
198 if ((offset & 0xffffff80) != p->offset_mask) { 177 if ((offset & 0xffffff80) != p->offset_mask) {
199 p->offset_mask = offset & 0xffffff80; 178 p->offset_mask = offset & 0xffffff80;
200 scratch32 = *(volatile unsigned int *)(p->fb + offset); 179 scratch32 = *(volatile unsigned int *)(p->fb + offset);
201 } 180 }
202 *((volatile unsigned int *)(p->fbc + offset)) = value; 181 *((volatile unsigned int *)(p->fbc + offset)) = value;
203} 182}
204 183
205unsigned int pnozz_read_4(PnozzPtr p, int offset) 184unsigned int pnozz_read_4(PnozzPtr p, int offset)
206{ 185{
@@ -302,27 +281,27 @@ PnozzGetRec(ScrnInfoPtr pScrn) @@ -302,27 +281,27 @@ PnozzGetRec(ScrnInfoPtr pScrn)
302 return TRUE; 281 return TRUE;
303} 282}
304 283
305static void 284static void
306PnozzFreeRec(ScrnInfoPtr pScrn) 285PnozzFreeRec(ScrnInfoPtr pScrn)
307{ 286{
308 PnozzPtr pPnozz; 287 PnozzPtr pPnozz;
309 288
310 if (pScrn->driverPrivate == NULL) 289 if (pScrn->driverPrivate == NULL)
311 return; 290 return;
312 291
313 pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 292 pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
314 293
315 xfree(pScrn->driverPrivate); 294 free(pScrn->driverPrivate);
316 pScrn->driverPrivate = NULL; 295 pScrn->driverPrivate = NULL;
317 296
318 return; 297 return;
319} 298}
320 299
321static const OptionInfoRec * 300static const OptionInfoRec *
322PnozzAvailableOptions(int chipid, int busid) 301PnozzAvailableOptions(int chipid, int busid)
323{ 302{
324 return PnozzOptions; 303 return PnozzOptions;
325} 304}
326 305
327/* Mandatory */ 306/* Mandatory */
328static void 307static void
@@ -372,27 +351,27 @@ PnozzProbe(DriverPtr drv, int flags) @@ -372,27 +351,27 @@ PnozzProbe(DriverPtr drv, int flags)
372 return FALSE; 351 return FALSE;
373 } 352 }
374 353
375 /* 354 /*
376 * We need to probe the hardware first. We then need to see how this 355 * We need to probe the hardware first. We then need to see how this
377 * fits in with what is given in the config file, and allow the config 356 * fits in with what is given in the config file, and allow the config
378 * file info to override any contradictions. 357 * file info to override any contradictions.
379 */ 358 */
380 359
381 numUsed = xf86MatchSbusInstances(PNOZZ_NAME, SBUS_DEVICE_P9100, 360 numUsed = xf86MatchSbusInstances(PNOZZ_NAME, SBUS_DEVICE_P9100,
382 devSections, numDevSections, 361 devSections, numDevSections,
383 drv, &usedChips); 362 drv, &usedChips);
384  363
385 xfree(devSections); 364 free(devSections);
386 if (numUsed <= 0) 365 if (numUsed <= 0)
387 return FALSE; 366 return FALSE;
388 367
389 if (flags & PROBE_DETECT) 368 if (flags & PROBE_DETECT)
390 foundScreen = TRUE; 369 foundScreen = TRUE;
391 else 370 else
392 for (i = 0; i < numUsed; i++) { 371 for (i = 0; i < numUsed; i++) {
393 pEnt = xf86GetEntityInfo(usedChips[i]); 372 pEnt = xf86GetEntityInfo(usedChips[i]);
394  373
395 /* 374 /*
396 * Check that nothing else has claimed the slots. 375 * Check that nothing else has claimed the slots.
397 */ 376 */
398 if(pEnt->active) { 377 if(pEnt->active) {
@@ -407,29 +386,29 @@ PnozzProbe(DriverPtr drv, int flags) @@ -407,29 +386,29 @@ PnozzProbe(DriverPtr drv, int flags)
407 pScrn->name = PNOZZ_NAME; 386 pScrn->name = PNOZZ_NAME;
408 pScrn->Probe = PnozzProbe; 387 pScrn->Probe = PnozzProbe;
409 pScrn->PreInit = PnozzPreInit; 388 pScrn->PreInit = PnozzPreInit;
410 pScrn->ScreenInit = PnozzScreenInit; 389 pScrn->ScreenInit = PnozzScreenInit;
411 pScrn->SwitchMode = PnozzSwitchMode; 390 pScrn->SwitchMode = PnozzSwitchMode;
412 pScrn->AdjustFrame = PnozzAdjustFrame; 391 pScrn->AdjustFrame = PnozzAdjustFrame;
413 pScrn->EnterVT = PnozzEnterVT; 392 pScrn->EnterVT = PnozzEnterVT;
414 pScrn->LeaveVT = PnozzLeaveVT; 393 pScrn->LeaveVT = PnozzLeaveVT;
415 pScrn->FreeScreen = PnozzFreeScreen; 394 pScrn->FreeScreen = PnozzFreeScreen;
416 pScrn->ValidMode = PnozzValidMode; 395 pScrn->ValidMode = PnozzValidMode;
417 xf86AddEntityToScreen(pScrn, pEnt->index); 396 xf86AddEntityToScreen(pScrn, pEnt->index);
418 foundScreen = TRUE; 397 foundScreen = TRUE;
419 } 398 }
420 xfree(pEnt); 399 free(pEnt);
421 } 400 }
422 xfree(usedChips); 401 free(usedChips);
423 return foundScreen; 402 return foundScreen;
424} 403}
425 404
426/* Mandatory */ 405/* Mandatory */
427static Bool 406static Bool
428PnozzPreInit(ScrnInfoPtr pScrn, int flags) 407PnozzPreInit(ScrnInfoPtr pScrn, int flags)
429{ 408{
430 PnozzPtr pPnozz; 409 PnozzPtr pPnozz;
431 sbusDevicePtr psdp; 410 sbusDevicePtr psdp;
432 MessageType from; 411 MessageType from;
433 rgb defaultWeight = {0, 0, 0}; 412 rgb defaultWeight = {0, 0, 0};
434 int i; 413 int i;
435 414
@@ -519,27 +498,27 @@ PnozzPreInit(ScrnInfoPtr pScrn, int flag @@ -519,27 +498,27 @@ PnozzPreInit(ScrnInfoPtr pScrn, int flag
519 /* We don't currently support DirectColor at > 8bpp */ 498 /* We don't currently support DirectColor at > 8bpp */
520 if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { 499 if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
521 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" 500 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"
522 " (%s) is not supported at depth %d\n", 501 " (%s) is not supported at depth %d\n",
523 xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); 502 xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
524 return FALSE; 503 return FALSE;
525 } 504 }
526 } 505 }
527 506
528 /* Collect all of the relevant option flags (fill in pScrn->options) */ 507 /* Collect all of the relevant option flags (fill in pScrn->options) */
529 xf86CollectOptions(pScrn, NULL); 508 xf86CollectOptions(pScrn, NULL);
530 509
531 /* Process the options */ 510 /* Process the options */
532 if (!(pPnozz->Options = xalloc(sizeof(PnozzOptions)))) 511 if (!(pPnozz->Options = malloc(sizeof(PnozzOptions))))
533 return FALSE; 512 return FALSE;
534 513
535 memcpy(pPnozz->Options, PnozzOptions, sizeof(PnozzOptions)); 514 memcpy(pPnozz->Options, PnozzOptions, sizeof(PnozzOptions));
536 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pPnozz->Options); 515 xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pPnozz->Options);
537  516
538 /* 517 /*
539 * The new cmap code requires this to be initialised. 518 * The new cmap code requires this to be initialised.
540 */ 519 */
541 520
542 { 521 {
543 Gamma zeros = {0.0, 0.0, 0.0}; 522 Gamma zeros = {0.0, 0.0, 0.0};
544 523
545 if (!xf86SetGamma(pScrn, zeros)) { 524 if (!xf86SetGamma(pScrn, zeros)) {
@@ -556,43 +535,44 @@ PnozzPreInit(ScrnInfoPtr pScrn, int flag @@ -556,43 +535,44 @@ PnozzPreInit(ScrnInfoPtr pScrn, int flag
556 from = X_CONFIG; 535 from = X_CONFIG;
557 if (xf86ReturnOptValBool(pPnozz->Options, OPTION_SW_CURSOR, FALSE)) { 536 if (xf86ReturnOptValBool(pPnozz->Options, OPTION_SW_CURSOR, FALSE)) {
558 from = X_CONFIG; 537 from = X_CONFIG;
559 pPnozz->HWCursor = FALSE; 538 pPnozz->HWCursor = FALSE;
560 } 539 }
561  540
562 xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", 541 xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
563 pPnozz->HWCursor ? "HW" : "SW"); 542 pPnozz->HWCursor ? "HW" : "SW");
564 543
565 if (xf86ReturnOptValBool(pPnozz->Options, OPTION_NOACCEL, FALSE)) { 544 if (xf86ReturnOptValBool(pPnozz->Options, OPTION_NOACCEL, FALSE)) {
566 pPnozz->NoAccel = TRUE; 545 pPnozz->NoAccel = TRUE;
567 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); 546 xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
568 } 547 }
 548
 549 pPnozz->useXAA = FALSE;
 550
 551 char *optstr;
 552 optstr = (char *)xf86GetOptValString(pPnozz->Options, OPTION_ACCELMETHOD);
 553 if (optstr == NULL) optstr = "exa";
 554 if (xf86NameCmp(optstr, "xaa") == 0)
 555 pPnozz->useXAA = TRUE;
569  556
570 if (xf86LoadSubModule(pScrn, "fb") == NULL) { 557 if (xf86LoadSubModule(pScrn, "fb") == NULL) {
571 PnozzFreeRec(pScrn); 558 PnozzFreeRec(pScrn);
572 return FALSE; 559 return FALSE;
573 } 560 }
574 561
575 if (xf86LoadSubModule(pScrn, "ramdac") == NULL) { 562 if (xf86LoadSubModule(pScrn, "ramdac") == NULL) {
576 PnozzFreeRec(pScrn); 563 PnozzFreeRec(pScrn);
577 return FALSE; 564 return FALSE;
578 } 565 }
579 xf86LoaderReqSymLists(ramdacSymbols, NULL); 
580 
581 if (xf86LoadSubModule(pScrn, "xaa") == NULL) { 
582 PnozzFreeRec(pScrn); 
583 return FALSE; 
584 } 
585 xf86LoaderReqSymLists(xaaSymbols, NULL); 
586 566
587 /********************* 567 /*********************
588 set up clock and mode stuff 568 set up clock and mode stuff
589 *********************/ 569 *********************/
590  570
591 pScrn->progClock = TRUE; 571 pScrn->progClock = TRUE;
592 572
593 if(pScrn->display->virtualX || pScrn->display->virtualY) { 573 if(pScrn->display->virtualX || pScrn->display->virtualY) {
594 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 574 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
595 "Pnozz does not support a virtual desktop\n"); 575 "Pnozz does not support a virtual desktop\n");
596 pScrn->display->virtualX = 0; 576 pScrn->display->virtualX = 0;
597 pScrn->display->virtualY = 0; 577 pScrn->display->virtualY = 0;
598 } 578 }
@@ -602,55 +582,66 @@ PnozzPreInit(ScrnInfoPtr pScrn, int flag @@ -602,55 +582,66 @@ PnozzPreInit(ScrnInfoPtr pScrn, int flag
602 pScrn->displayWidth = pScrn->virtualX; 582 pScrn->displayWidth = pScrn->virtualX;
603 583
604 /* Set display resolution */ 584 /* Set display resolution */
605 xf86SetDpi(pScrn, 0, 0); 585 xf86SetDpi(pScrn, 0, 0);
606 586
607 return TRUE; 587 return TRUE;
608} 588}
609 589
610/* Mandatory */ 590/* Mandatory */
611 591
612/* This gets called at the start of each server generation */ 592/* This gets called at the start of each server generation */
613 593
614static Bool 594static Bool
615PnozzScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) 595PnozzScreenInit(SCREEN_INIT_ARGS_DECL)
616{ 596{
617 ScrnInfoPtr pScrn; 597 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
618 PnozzPtr pPnozz; 598 PnozzPtr pPnozz;
619 VisualPtr visual; 599 VisualPtr visual;
620 int ret,len=0,i; 600 int ret,len=0,i;
621 unsigned int *regs, pctl, pfb, *fb; 601 unsigned int *regs, pctl, pfb, *fb;
622 602
623 /*  603 /*
624 * First get the ScrnInfoRec 604 * First get the ScrnInfoRec
625 */ 605 */
626 pScrn = xf86Screens[pScreen->myNum]; 606 pScrn = xf86Screens[pScreen->myNum];
627 607
628 pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 608 pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
629 609
630 /* 610 /*
631 * XXX 611 * XXX
632 * figure out how much video RAM we really have - 2MB is just by far the  612 * figure out how much video RAM we really have - 2MB is just by far the
633 * most common size 613 * most common size
634 */ 614 */
 615 pPnozz->vidmem = 0x200000; /* map 2MB */
635 pPnozz->fb = 616 pPnozz->fb =
636 xf86MapSbusMem (pPnozz->psdp, 0, 0x200000); /* map 2MB */ 617 xf86MapSbusMem (pPnozz->psdp, 0, pPnozz->vidmem);
637 fb=(unsigned int *)pPnozz->fb; 618 fb=(unsigned int *)pPnozz->fb;
638  619
639 pPnozz->fbc = 620 pPnozz->fbc =
640 xf86MapSbusMem (pPnozz->psdp, 0x200000,0x8000); /* map registers */ 621 xf86MapSbusMem (pPnozz->psdp, pPnozz->vidmem,0x8000); /* map registers */
 622
 623 if (! pPnozz->fbc) {
 624 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 625 "xf86MapSbusMem failed fbc:%p fb:%p\n",
 626 pPnozz->fbc, pPnozz->fb);
 627
 628 if (pPnozz->fb) {
 629 xf86UnmapSbusMem(pPnozz->psdp, pPnozz->fb, pPnozz->vidmem);
 630 pPnozz->fb = NULL;
 631 }
641 632
642 if (! pPnozz->fbc) 
643 return FALSE; 633 return FALSE;
 634 }
644 635
645 /* 636 /*
646 * The next step is to setup the screen's visuals, and initialise the 637 * The next step is to setup the screen's visuals, and initialise the
647 * framebuffer code. In cases where the framebuffer's default 638 * framebuffer code. In cases where the framebuffer's default
648 * choices for things like visual layouts and bits per RGB are OK, 639 * choices for things like visual layouts and bits per RGB are OK,
649 * this may be as simple as calling the framebuffer's ScreenInit() 640 * this may be as simple as calling the framebuffer's ScreenInit()
650 * function. If not, the visuals will need to be setup before calling 641 * function. If not, the visuals will need to be setup before calling
651 * a fb ScreenInit() function and fixed up after. 642 * a fb ScreenInit() function and fixed up after.
652 */ 643 */
653 644
654 /* 645 /*
655 * Reset visual list. 646 * Reset visual list.
656 */ 647 */
@@ -695,27 +686,27 @@ PnozzScreenInit(int scrnIndex, ScreenPtr @@ -695,27 +686,27 @@ PnozzScreenInit(int scrnIndex, ScreenPtr
695 686
696 /* 687 /*
697 * Call the framebuffer layer's ScreenInit function, and fill in other 688 * Call the framebuffer layer's ScreenInit function, and fill in other
698 * pScreen fields. 689 * pScreen fields.
699 */ 690 */
700#if DEBUG 691#if DEBUG
701 xf86Msg(X_ERROR, "sls: %d\n", pPnozz->scanlinesize); 692 xf86Msg(X_ERROR, "sls: %d\n", pPnozz->scanlinesize);
702#endif 693#endif
703 ret = fbScreenInit(pScreen, pPnozz->fb, pScrn->virtualX, 694 ret = fbScreenInit(pScreen, pPnozz->fb, pScrn->virtualX,
704 pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, 695 pScrn->virtualY, pScrn->xDpi, pScrn->yDpi,
705 pScrn->displayWidth, pScrn->bitsPerPixel); 696 pScrn->displayWidth, pScrn->bitsPerPixel);
706 697
707 /* should be set by PnozzSetDepth() */ 698 /* should be set by PnozzSetDepth() */
708 pPnozz->maxheight = (0x200000 / pPnozz->scanlinesize) & 0xffff; 699 pPnozz->maxheight = (pPnozz->vidmem / pPnozz->scanlinesize) & 0xffff;
709#if DEBUG 700#if DEBUG
710 xf86Msg(X_ERROR, "max scanlines: %d\n", pPnozz->maxheight); 701 xf86Msg(X_ERROR, "max scanlines: %d\n", pPnozz->maxheight);
711#endif 702#endif
712 if (!ret) 703 if (!ret)
713 return FALSE; 704 return FALSE;
714 705
715 if (pScrn->bitsPerPixel > 8) { 706 if (pScrn->bitsPerPixel > 8) {
716 visual = pScreen->visuals + pScreen->numVisuals; 707 visual = pScreen->visuals + pScreen->numVisuals;
717 while (--visual >= pScreen->visuals) { 708 while (--visual >= pScreen->visuals) {
718 if ((visual->class | DynamicClass) == DirectColor) { 709 if ((visual->class | DynamicClass) == DirectColor) {
719 visual->offsetRed = pScrn->offset.red; 710 visual->offsetRed = pScrn->offset.red;
720 visual->offsetGreen = pScrn->offset.green; 711 visual->offsetGreen = pScrn->offset.green;
721 visual->offsetBlue = pScrn->offset.blue; 712 visual->offsetBlue = pScrn->offset.blue;
@@ -723,36 +714,58 @@ PnozzScreenInit(int scrnIndex, ScreenPtr @@ -723,36 +714,58 @@ PnozzScreenInit(int scrnIndex, ScreenPtr
723 visual->greenMask = pScrn->mask.green; 714 visual->greenMask = pScrn->mask.green;
724 visual->blueMask = pScrn->mask.blue; 715 visual->blueMask = pScrn->mask.blue;
725 } 716 }
726 } 717 }
727 } 718 }
728 719
729 fbPictureInit(pScreen, 0, 0); 720 fbPictureInit(pScreen, 0, 0);
730 721
731 xf86SetBackingStore(pScreen); 722 xf86SetBackingStore(pScreen);
732 xf86SetSilkenMouse(pScreen); 723 xf86SetSilkenMouse(pScreen);
733 xf86SetBlackWhitePixels(pScreen); 724 xf86SetBlackWhitePixels(pScreen);
734 725
735 if (!pPnozz->NoAccel) { 726 if (!pPnozz->NoAccel) {
736 BoxRec bx; 727#ifdef HAVE_XAA_H
737 pPnozz->pXAA = XAACreateInfoRec(); 728 if (pPnozz->useXAA) {
738 PnozzAccelInit(pScrn); 729 BoxRec bx;
739 bx.x1 = bx.y1 = 0; 730 pPnozz->pXAA = XAACreateInfoRec();
740 bx.x2 = pPnozz->width; 731 PnozzAccelInit(pScrn);
741 bx.y2 = pPnozz->maxheight; 732 bx.x1 = bx.y1 = 0;
742 xf86InitFBManager(pScreen, &bx); 733 bx.x2 = pPnozz->width;
743 if(!XAAInit(pScreen, pPnozz->pXAA)) 734 bx.y2 = pPnozz->maxheight;
744 return FALSE; 735 xf86InitFBManager(pScreen, &bx);
745 xf86Msg(X_INFO, "%s: Using acceleration\n", pPnozz->psdp->device); 736 if(!XAAInit(pScreen, pPnozz->pXAA))
 737 return FALSE;
 738 xf86Msg(X_INFO, "%s: Using XAA acceleration\n", pPnozz->psdp->device);
 739 } else
 740#endif /* HAVE_XAA_H */
 741 {
 742 /* EXA */
 743 XF86ModReqInfo req;
 744 int errmaj, errmin;
 745
 746 memset(&req, 0, sizeof(XF86ModReqInfo));
 747 req.majorversion = EXA_VERSION_MAJOR;
 748 req.minorversion = EXA_VERSION_MINOR;
 749 if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req,
 750 &errmaj, &errmin)) {
 751 LoaderErrorMsg(NULL, "exa", errmaj, errmin);
 752 return FALSE;
 753 }
 754 if (!PnozzEXAInit(pScreen))
 755 return FALSE;
 756
 757 xf86Msg(X_INFO, "%s: Using EXA acceleration\n", pPnozz->psdp->device);
 758 }
746 } 759 }
747 760
748 /* Initialise cursor functions */ 761 /* Initialise cursor functions */
749 miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); 762 miDCInitialize (pScreen, xf86GetPointerScreenFuncs());
750 763
751 /* 764 /*
752 * Initialize HW cursor layer.  765 * Initialize HW cursor layer.
753 * Must follow software cursor initialization 766 * Must follow software cursor initialization
754 */ 767 */
755 xf86SbusHideOsHwCursor(pPnozz->psdp); 768 xf86SbusHideOsHwCursor(pPnozz->psdp);
756 if (pPnozz->HWCursor) {  769 if (pPnozz->HWCursor) {
757 extern Bool PnozzHWCursorInit(ScreenPtr pScreen); 770 extern Bool PnozzHWCursorInit(ScreenPtr pScreen);
758 771
@@ -782,122 +795,122 @@ PnozzScreenInit(int scrnIndex, ScreenPtr @@ -782,122 +795,122 @@ PnozzScreenInit(int scrnIndex, ScreenPtr
782 xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); 795 xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
783 } 796 }
784 797
785 /* unblank the screen */ 798 /* unblank the screen */
786 PnozzSaveScreen(pScreen, SCREEN_SAVER_OFF); 799 PnozzSaveScreen(pScreen, SCREEN_SAVER_OFF);
787 800
788 /* Done */ 801 /* Done */
789 return TRUE; 802 return TRUE;
790} 803}
791 804
792 805
793/* Usually mandatory */ 806/* Usually mandatory */
794static Bool 807static Bool
795PnozzSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) 808PnozzSwitchMode(SWITCH_MODE_ARGS_DECL)
796{ 809{
797 xf86Msg(X_ERROR, "SwitchMode: %d %d %d %d\n", mode->CrtcHTotal,  810 xf86Msg(X_ERROR, "SwitchMode: %d %d %d %d\n", mode->CrtcHTotal,
798 mode->CrtcHSyncStart, mode->CrtcHSyncEnd, mode->CrtcHDisplay); 811 mode->CrtcHSyncStart, mode->CrtcHSyncEnd, mode->CrtcHDisplay);
799 return TRUE; 812 return TRUE;
800} 813}
801 814
802 815
803/* 816/*
804 * This function is used to initialize the Start Address - the first 817 * This function is used to initialize the Start Address - the first
805 * displayed location in the video memory. 818 * displayed location in the video memory.
806 */ 819 */
807/* Usually mandatory */ 820/* Usually mandatory */
808static void  821static void
809PnozzAdjustFrame(int scrnIndex, int x, int y, int flags) 822PnozzAdjustFrame(ADJUST_FRAME_ARGS_DECL)
810{ 823{
811 /* we don't support virtual desktops for now */ 824 /* we don't support virtual desktops for now */
812 return; 825 return;
813} 826}
814 827
815/* 828/*
816 * This is called when VT switching back to the X server. Its job is 829 * This is called when VT switching back to the X server. Its job is
817 * to reinitialise the video mode. 830 * to reinitialise the video mode.
818 */ 831 */
819 832
820/* Mandatory */ 833/* Mandatory */
821static Bool 834static Bool
822PnozzEnterVT(int scrnIndex, int flags) 835PnozzEnterVT(VT_FUNC_ARGS_DECL)
823{ 836{
824 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 837 SCRN_INFO_PTR(arg);
825 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 838 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
826 839
827 xf86SbusHideOsHwCursor (pPnozz->psdp); 840 xf86SbusHideOsHwCursor (pPnozz->psdp);
828 return TRUE; 841 return TRUE;
829} 842}
830 843
831 844
832/* 845/*
833 * This is called when VT switching away from the X server. 846 * This is called when VT switching away from the X server.
834 */ 847 */
835 848
836/* Mandatory */ 849/* Mandatory */
837static void 850static void
838PnozzLeaveVT(int scrnIndex, int flags) 851PnozzLeaveVT(VT_FUNC_ARGS_DECL)
839{ 852{
840 return; 853 return;
841} 854}
842 855
843 856
844/* 857/*
845 * This is called at the end of each server generation. It restores the 858 * This is called at the end of each server generation. It restores the
846 * original (text) mode. It should really also unmap the video memory too. 859 * original (text) mode. It should really also unmap the video memory too.
847 */ 860 */
848 861
849/* Mandatory */ 862/* Mandatory */
850static Bool 863static Bool
851PnozzCloseScreen(int scrnIndex, ScreenPtr pScreen) 864PnozzCloseScreen(CLOSE_SCREEN_ARGS_DECL)
852{ 865{
853 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 866 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
854 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn); 867 PnozzPtr pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);
855 int state = 1; 868 int state = 1;
856 869
857 pScrn->vtSema = FALSE; 870 pScrn->vtSema = FALSE;
858  871
859 if (pPnozz->HWCursor) 872 if (pPnozz->HWCursor)
860 PnozzHideCursor(pScrn); 873 PnozzHideCursor(pScrn);
861 874
862 PnozzRestore(pPnozz); /* restore colour depth */ 875 PnozzRestore(pPnozz); /* restore colour depth */
863  876
864 xf86UnmapSbusMem(pPnozz->psdp, pPnozz->fb,0x200000); 877 xf86UnmapSbusMem(pPnozz->psdp, pPnozz->fb,pPnozz->vidmem);
865 xf86UnmapSbusMem(pPnozz->psdp, pPnozz->fbc,0x8000); 878 xf86UnmapSbusMem(pPnozz->psdp, pPnozz->fbc,0x8000);
866 879
867 /* make sure video is turned on */ 880 /* make sure video is turned on */
868 ioctl(pPnozz->psdp->fd, FBIOSVIDEO, &state); 881 ioctl(pPnozz->psdp->fd, FBIOSVIDEO, &state);
869  882
870 pScreen->CloseScreen = pPnozz->CloseScreen; 883 pScreen->CloseScreen = pPnozz->CloseScreen;
871 return (*pScreen->CloseScreen)(scrnIndex, pScreen); 884 return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
872 return FALSE; 
873} 885}
874 886
875 887
876/* Free up any per-generation data structures */ 888/* Free up any per-generation data structures */
877 889
878/* Optional */ 890/* Optional */
879static void 891static void
880PnozzFreeScreen(int scrnIndex, int flags) 892PnozzFreeScreen(FREE_SCREEN_ARGS_DECL)
881{ 893{
882 PnozzFreeRec(xf86Screens[scrnIndex]); 894 SCRN_INFO_PTR(arg);
 895 PnozzFreeRec(pScrn);
883} 896}
884 897
885 898
886/* Checks if a mode is suitable for the selected chipset. */ 899/* Checks if a mode is suitable for the selected chipset. */
887 900
888/* Optional */ 901/* Optional */
889static ModeStatus 902static ModeStatus
890PnozzValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) 903PnozzValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
891{ 904{
892 if (mode->Flags & V_INTERLACE) 905 if (mode->Flags & V_INTERLACE)
893 return(MODE_BAD); 906 return(MODE_BAD);
894 907
895 return(MODE_OK); 908 return(MODE_OK);
896} 909}
897 910
898/* Do screen blanking */ 911/* Do screen blanking */
899 912
900/* Mandatory */ 913/* Mandatory */
901static Bool 914static Bool
902PnozzSaveScreen(ScreenPtr pScreen, int mode) 915PnozzSaveScreen(ScreenPtr pScreen, int mode)
903{ 916{
@@ -1057,27 +1070,28 @@ unsigned int upper_bit(unsigned int b) @@ -1057,27 +1070,28 @@ unsigned int upper_bit(unsigned int b)
1057 * - double or quadruple scanline length 1070 * - double or quadruple scanline length
1058 * - switch the DAC to the appropriate pixel format 1071 * - switch the DAC to the appropriate pixel format
1059 * - tell the drawing engine about new line length / pixel size 1072 * - tell the drawing engine about new line length / pixel size
1060 */ 1073 */
1061 1074
1062int 1075int
1063PnozzSetDepth(PnozzPtr pPnozz, int depth) 1076PnozzSetDepth(PnozzPtr pPnozz, int depth)
1064{ 1077{
1065 int new_sls; 1078 int new_sls;
1066 unsigned int bits, scr, sscr, memctl, mem; 1079 unsigned int bits, scr, sscr, memctl, mem;
1067 int s0, s1, s2, s3, ps, crtcline; 1080 int s0, s1, s2, s3, ps, crtcline;
1068 unsigned char pf, mc3, es; 1081 unsigned char pf, mc3, es;
1069 1082
1070#if DEBUG 1083#ifdef DEBUG
 1084 xf86Msg(X_ERROR, "SetDepth: %d\n", depth);
1071 DumpDAC(pPnozz); 1085 DumpDAC(pPnozz);
1072 DumpCRTC(pPnozz); 1086 DumpCRTC(pPnozz);
1073#endif 1087#endif
1074 1088
1075 switch (depth) { 1089 switch (depth) {
1076 case 8: 1090 case 8:
1077 pPnozz->depthshift = 0; 1091 pPnozz->depthshift = 0;
1078 ps = 2; 1092 ps = 2;
1079 pf = 3; 1093 pf = 3;
1080 mc3 = 0; 1094 mc3 = 0;
1081 es = 0; /* no swapping */ 1095 es = 0; /* no swapping */
1082 memctl = 3; 1096 memctl = 3;
1083 break; 1097 break;