diff options
author | Keith Packard <keithp@keithp.com> | 2003-11-02 19:56:10 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2003-11-02 19:56:10 +0000 |
commit | 5378236aa647ec9a723a3e5fbd2a57eb286a1938 (patch) | |
tree | b178d5f95a4882d617dbbdab8cb5e0b40003a704 | |
parent | 9e94665cf9cf0f74dff5b3cdaa4cde99e234fa45 (diff) |
merge xfixes_2_branch back to HEAD
51 files changed, 920 insertions, 996 deletions
diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am index 43e737cc4..f492e8db6 100644 --- a/hw/kdrive/fbdev/Makefile.am +++ b/hw/kdrive/fbdev/Makefile.am @@ -1,12 +1,6 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @KDRIVE_INCS@ \ + @XSERVER_CFLAGS@ noinst_LIBRARIES = libfbdev.a @@ -18,28 +12,18 @@ libfbdev_a_SOURCES = \ Xfbdev_SOURCES = \ fbinit.c -Xfbdev_LDADD = \ - libfbdev.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) \ - -lm -lz if TSLIB -Xfbdev_LDADD += -lts +TSLIB_FLAG = -lts endif +Xfbdev_LDADD = \ + libfbdev.a \ + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ \ + $(TSLIB_FLAG) + +Xfbdev_DEPENDENCIES = \ + libfbdev.a \ + @KDRIVE_LIBS@ + diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index e9ab57454..cb0a1b399 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -29,9 +29,6 @@ #include "fbdev.h" #include <sys/ioctl.h> -/* this code was used to debug MSB 24bpp code on a 16bpp frame buffer */ -#undef FAKE24_ON_16 - extern int KdTsPhyScreen; Bool @@ -114,9 +111,6 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv) Pixel allbits; int depth; Bool gray; -#ifdef FAKE24_ON_16 - Bool fake24; -#endif depth = priv->var.bits_per_pixel; gray = priv->var.grayscale; @@ -190,35 +184,8 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv) } screen->rate = 72; scrpriv->randr = screen->randr; - scrpriv->layerKind = LAYER_FB; -#ifdef FAKE24_ON_16 - if (screen->fb[0].depth == 24 && screen->fb[0].bitsPerPixel == 24 && - priv->var.bits_per_pixel == 16) - { - fake24 = TRUE; - scrpriv->shadow = TRUE; - scrpriv->rotation = 0; - screen->fb[0].redMask = 0xff0000; - screen->fb[0].greenMask = 0x00ff00; - screen->fb[0].blueMask = 0x0000ff; - screen->width = priv->var.xres; - screen->height = priv->var.yres; - screen->softCursor = TRUE; - } - else -#endif - { - screen->fb[0].depth = depth; - screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel; - screen->width = priv->var.xres; - screen->height = priv->var.yres; - screen->fb[0].byteStride = priv->fix.line_length; - screen->fb[0].pixelStride = (priv->fix.line_length * 8 / - priv->var.bits_per_pixel); - screen->fb[0].frameBuffer = (CARD8 *) (priv->fb); - } - return TRUE; + return fbdevMapFramebuffer (screen); } Bool @@ -256,173 +223,94 @@ fbdevWindowLinear (ScreenPtr pScreen, return (CARD8 *) priv->fb + row * priv->fix.line_length + offset; } -#ifdef FAKE24_ON_16 -void -fbdevUpdateFake24 (ScreenPtr pScreen, - PixmapPtr pShadow, - RegionPtr damage) +Bool +fbdevMapFramebuffer (KdScreenInfo *screen) { - shadowScrPriv(pScreen); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - FbBits *shaBits; - CARD8 *shaBase, *shaLine, *sha; - CARD16 s; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - int x, y, w, h, width; - int i; - CARD16 *winBase, *winLine, *win; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp); - shaStride = shaStride * sizeof (FbBits) / sizeof (CARD8); - shaBase = (CARD8 *) shaBits; - while (nbox--) + FbdevScrPriv *scrpriv = screen->driver; + KdMouseMatrix m; + FbdevPriv *priv = screen->card->driver; + + if (scrpriv->randr != RR_Rotate_0) + scrpriv->shadow = TRUE; + else + scrpriv->shadow = FALSE; + + KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height); + + KdSetMouseMatrix (&m); + + screen->width = priv->var.xres; + screen->height = priv->var.yres; + screen->memory_base = (CARD8 *) (priv->fb); + screen->memory_size = 0; + screen->off_screen_base = 0; + screen->fb[0].depth = priv->var.bits_per_pixel; + screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel; + + if (scrpriv->shadow) { - x = pbox->x1; - y = pbox->y1; - w = (pbox->x2 - pbox->x1); - h = pbox->y2 - pbox->y1; - - shaLine = shaBase + y * shaStride + x * 3; - - while (h--) - { - winSize = 0; - scrBase = 0; - width = w; - scr = x; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (CARD16 *) (*pScrPriv->window) (pScreen, - y, - scr * sizeof (CARD16), - SHADOW_WINDOW_WRITE, - &winSize); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (CARD16); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - while (i--) - { -#if IMAGE_BYTE_ORDER == MSBFirst - *win++ = ((sha[2] >> 3) | - ((sha[1] & 0xf8) << 2) | - ((sha[0] & 0xf8) << 7)); -#else - *win++ = ((sha[0] >> 3) | - ((sha[1] & 0xfc) << 3) | - ((sha[2] & 0xf8) << 8)); -#endif - sha += 3; - } - } - shaLine += shaStride; - y++; - } - pbox++; + if (!KdShadowFbAlloc (screen, 0, + scrpriv->randr & (RR_Rotate_90|RR_Rotate_270))) + return FALSE; + } + else + { + screen->fb[0].byteStride = priv->fix.line_length; + screen->fb[0].pixelStride = (priv->fix.line_length * 8 / + priv->var.bits_per_pixel); + screen->fb[0].frameBuffer = (CARD8 *) (priv->fb); } + + return TRUE; } -#endif /* FAKE24_ON_16 */ void -fbdevConfigureScreen (ScreenPtr pScreen) +fbdevSetScreenSizes (ScreenPtr pScreen) { KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; FbdevScrPriv *scrpriv = screen->driver; - KdMouseMatrix m; + FbdevPriv *priv = screen->card->driver; -#ifdef FAKE24_ON_16 - if (fake24) - { - scrpriv->randr = RR_Rotate_0; - scrpriv->shadow = TRUE; - } - else -#endif /* FAKE24_ON_16 */ + if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180)) { - if (scrpriv->randr != RR_Rotate_0) - scrpriv->shadow = TRUE; - else - scrpriv->shadow = FALSE; - } - - KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height); - - if (m.matrix[0][0]) - { - pScreen->width = screen->width; - pScreen->height = screen->height; + pScreen->width = priv->var.xres; + pScreen->height = priv->var.yres; pScreen->mmWidth = screen->width_mm; pScreen->mmHeight = screen->height_mm; } else { - pScreen->width = screen->height; - pScreen->height = screen->width; + pScreen->width = priv->var.yres; + pScreen->height = priv->var.xres; pScreen->mmWidth = screen->height_mm; pScreen->mmHeight = screen->width_mm; } - KdSetMouseMatrix (&m); } -LayerPtr -fbdevLayerCreate (ScreenPtr pScreen) +Bool +fbdevUnmapFramebuffer (KdScreenInfo *screen) +{ + KdShadowFbFree (screen, 0); + return TRUE; +} + +Bool +fbdevSetShadow (ScreenPtr pScreen) { KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; FbdevScrPriv *scrpriv = screen->driver; ShadowUpdateProc update; ShadowWindowProc window; - PixmapPtr pPixmap; - int kind; - if (scrpriv->shadow) - { - window = fbdevWindowLinear; - update = 0; -#ifdef FAKE24_ON_16 - if (pScreenPriv->screen->fb[0].bitsPerPixel == 24 && priv->var.bits_per_pixel == 16) - { - update = fbdevUpdateFake24; - } - else -#endif /* FAKE24_ON_16 */ - { - if (scrpriv->randr) - update = shadowUpdateRotatePacked; - else - update = shadowUpdatePacked; - } - if (!update) - abort (); - kind = LAYER_SHADOW; - pPixmap = 0; - } + window = fbdevWindowLinear; + update = 0; + if (scrpriv->randr) + update = shadowUpdateRotatePacked; else - { - kind = scrpriv->layerKind; - pPixmap = LAYER_SCREEN_PIXMAP; - update = 0; - window = 0; - } - - return LayerCreate (pScreen, kind, screen->fb[0].depth, - pPixmap, update, window, scrpriv->randr, 0); + update = shadowUpdatePacked; + return KdShadowSet (pScreen, scrpriv->randr, update, window); } @@ -458,29 +346,6 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) return TRUE; } -int -fbdevLayerAdd (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - if (!LayerWindowAdd (pScreen, pLayer, pWin)) - return WT_STOPWALKING; - - return WT_WALKCHILDREN; -} - -int -fbdevLayerRemove (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - LayerWindowRemove (pScreen, pLayer, pWin); - - return WT_WALKCHILDREN; -} - Bool fbdevRandRSetConfig (ScreenPtr pScreen, Rotation randr, @@ -496,7 +361,6 @@ fbdevRandRSetConfig (ScreenPtr pScreen, int oldheight; int oldmmwidth; int oldmmheight; - LayerPtr pNewLayer; int newwidth, newheight; if (screen->randr & (RR_Rotate_0|RR_Rotate_180)) @@ -526,34 +390,46 @@ fbdevRandRSetConfig (ScreenPtr pScreen, scrpriv->randr = KdAddRotation (screen->randr, randr); - fbdevConfigureScreen (pScreen); + KdOffscreenSwapOut (screen->pScreen); - pNewLayer = fbdevLayerCreate (pScreen); - if (!pNewLayer) + fbdevUnmapFramebuffer (screen); + + if (!fbdevMapFramebuffer (screen)) goto bail4; - if (WalkTree (pScreen, fbdevLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING) - goto bail5; - WalkTree (pScreen, fbdevLayerRemove, (pointer) scrpriv->pLayer); - LayerDestroy (pScreen, scrpriv->pLayer); + if (!fbdevSetShadow (screen->pScreen)) + goto bail4; - scrpriv->pLayer = pNewLayer; + fbdevSetScreenSizes (screen->pScreen); + /* + * Set frame buffer mapping + */ + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); + + /* set the subpixel order */ + KdSetSubpixelOrder (pScreen, scrpriv->randr); if (wasEnabled) KdEnableScreen (pScreen); return TRUE; -bail5: - WalkTree (pScreen, fbdevLayerRemove, (pointer) pNewLayer); - LayerDestroy (pScreen, pNewLayer); bail4: + fbdevUnmapFramebuffer (screen); + *scrpriv = oldscr; + (void) fbdevMapFramebuffer (screen); pScreen->width = oldwidth; pScreen->height = oldheight; pScreen->mmWidth = oldmmwidth; pScreen->mmHeight = oldmmheight; - *scrpriv = oldscr; + if (wasEnabled) KdEnableScreen (pScreen); return FALSE; @@ -616,27 +492,15 @@ fbdevInitScreen (ScreenPtr pScreen) #endif pScreen->CreateColormap = fbdevCreateColormap; - - if (!LayerStartInit (pScreen)) - return FALSE; return TRUE; } Bool fbdevFinishInitScreen (ScreenPtr pScreen) { - KdScreenPriv(pScreen); - FbdevScrPriv *scrpriv = pScreenPriv->screen->driver; - - scrpriv->layerKind = LayerNewKind (pScreen); - - if (!LayerFinishInit (pScreen)) + if (!shadowSetup (pScreen)) return FALSE; - scrpriv->pLayer = fbdevLayerCreate (pScreen); - if (!scrpriv->pLayer) - return FALSE; - #ifdef RANDR if (!fbdevRandRInit (pScreen)) return FALSE; @@ -645,6 +509,13 @@ fbdevFinishInitScreen (ScreenPtr pScreen) return TRUE; } + +Bool +fbdevCreateResources (ScreenPtr pScreen) +{ + return fbdevSetShadow (pScreen); +} + void fbdevPreserve (KdCardInfo *card) { diff --git a/hw/kdrive/fbdev/fbdev.h b/hw/kdrive/fbdev/fbdev.h index 4b14bc2e8..d37b99597 100644 --- a/hw/kdrive/fbdev/fbdev.h +++ b/hw/kdrive/fbdev/fbdev.h @@ -30,7 +30,6 @@ #include <unistd.h> #include <sys/mman.h> #include "kdrive.h" -#include "layer.h" #ifdef RANDR #include "randrstr.h" @@ -50,8 +49,7 @@ typedef struct _fbdevPriv { typedef struct _fbdevScrPriv { Rotation randr; Bool shadow; - int layerKind; - LayerPtr pLayer; + PixmapPtr pShadow; } FbdevScrPriv; extern KdCardFuncs fbdevFuncs; @@ -71,6 +69,12 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv); Bool fbdevInitScreen (ScreenPtr pScreen); +Bool +fbdevFinishInitScreen (ScreenPtr pScreen); + +Bool +fbdevCreateResources (ScreenPtr pScreen); + void fbdevPreserve (KdCardInfo *card); @@ -99,6 +103,40 @@ void fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs); Bool -fbdevFinishInitScreen (ScreenPtr pScreen); +fbdevMapFramebuffer (KdScreenInfo *screen); + +void * +fbdevWindowLinear (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure); + +void +fbdevSetScreenSizes (ScreenPtr pScreen); + +Bool +fbdevUnmapFramebuffer (KdScreenInfo *screen); + +Bool +fbdevSetShadow (ScreenPtr pScreen); + +Bool +fbdevCreateColormap (ColormapPtr pmap); + +#ifdef RANDR +Bool +fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations); + +Bool +fbdevRandRSetConfig (ScreenPtr pScreen, + Rotation randr, + int rate, + RRScreenSizePtr pSize); +Bool +fbdevRandRInit (ScreenPtr pScreen); + +#endif #endif /* _FBDEV_H_ */ diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c index bc44b23fe..533aa9bf8 100644 --- a/hw/kdrive/fbdev/fbinit.c +++ b/hw/kdrive/fbdev/fbinit.c @@ -63,6 +63,8 @@ KdCardFuncs fbdevFuncs = { fbdevCardInit, /* cardinit */ fbdevScreenInit, /* scrinit */ fbdevInitScreen, /* initScreen */ + fbdevFinishInitScreen, /* finishInitScreen */ + fbdevCreateResources, /* createRes */ fbdevPreserve, /* preserve */ fbdevEnable, /* enable */ fbdevDPMS, /* dpms */ @@ -85,6 +87,4 @@ KdCardFuncs fbdevFuncs = { fbdevGetColors, /* getColors */ fbdevPutColors, /* putColors */ - - fbdevFinishInitScreen, /* finishInitScreen */ }; diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am index 081767cc7..2a52d3a75 100644 --- a/hw/kdrive/linux/Makefile.am +++ b/hw/kdrive/linux/Makefile.am @@ -1,16 +1,18 @@ INCLUDES = \ - -I$(top_srcdir)/hw/kdrive/src \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @KDRIVE_INCS@ \ + @XSERVER_CFLAGS@ noinst_LIBRARIES = liblinux.a +if TSLIB +TSLIB_C = tslib.c +endif + +if H3600_TS +TS_C = ts.c +endif + liblinux_a_SOURCES = \ agp.c \ bus.c \ @@ -18,12 +20,18 @@ liblinux_a_SOURCES = \ linux.c \ mouse.c \ ms.c \ - ps2.c + ps2.c \ + $(TSLIB_C) \ + $(TS_C) -if TSLIB -liblinux_a_SOURCES += tslib.c -endif +liblinux_a_DEPENDENCIES = \ + agp.c \ + bus.c \ + keyboard.c \ + linux.c \ + mouse.c \ + ms.c \ + ps2.c \ + $(TSLIB_C) \ + $(TS_C) -if H3600_TS -liblinux_a_SOURCES += ts.c -endif diff --git a/hw/kdrive/linux/agp.c b/hw/kdrive/linux/agp.c index 6f4482c03..d401e03a1 100644 --- a/hw/kdrive/linux/agp.c +++ b/hw/kdrive/linux/agp.c @@ -87,7 +87,7 @@ static int acquiredScreen = -1; */ static Bool -GARTInit() +GARTInit(void) { static Bool initDone = FALSE; struct _agp_info agpinf; diff --git a/hw/kdrive/linux/bus.c b/hw/kdrive/linux/bus.c index 5451b0aa4..15d2ba846 100644 --- a/hw/kdrive/linux/bus.c +++ b/hw/kdrive/linux/bus.c @@ -35,7 +35,7 @@ /* /dev/adbmouse is a busmouse */ -void +static void BusRead (int adbPort, void *closure) { unsigned char buf[3]; @@ -68,7 +68,7 @@ char *BusNames[] = { int BusInputType; -int +static int BusInit (void) { int i; @@ -89,7 +89,7 @@ BusInit (void) return n; } -void +static void BusFini (void) { KdUnregisterFds (BusInputType, TRUE); diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c index f2998766e..dba87a00d 100644 --- a/hw/kdrive/linux/keyboard.c +++ b/hw/kdrive/linux/keyboard.c @@ -112,7 +112,7 @@ static unsigned char tbl[KD_MAX_WIDTH] = }; static void -readKernelMapping() +readKernelMapping(void) { KeySym *k; int i, j; @@ -373,13 +373,13 @@ readKernelMapping() kdMaxScanCode = maxKeyCode; } -void +static void LinuxKeyboardLoad (void) { readKernelMapping (); } -void +static void LinuxKeyboardRead (int fd, void *closure) { unsigned char buf[256], *b; @@ -400,7 +400,7 @@ static int LinuxKbdTrans; static struct termios LinuxTermios; static int LinuxKbdType; -int +static int LinuxKeyboardEnable (int fd, void *closure) { struct termios nTty; @@ -429,14 +429,14 @@ LinuxKeyboardEnable (int fd, void *closure) return fd; } -void +static void LinuxKeyboardDisable (int fd, void *closure) { ioctl(LinuxConsoleFd, KDSKBMODE, LinuxKbdTrans); tcsetattr(LinuxConsoleFd, TCSANOW, &LinuxTermios); } -int +static int LinuxKeyboardInit (void) { if (!LinuxKbdType) @@ -450,20 +450,20 @@ LinuxKeyboardInit (void) return 1; } -void +static void LinuxKeyboardFini (void) { LinuxKeyboardDisable (LinuxConsoleFd, 0); KdUnregisterFds (LinuxKbdType, FALSE); } -void +static void LinuxKeyboardLeds (int leds) { ioctl (LinuxConsoleFd, KDSETLED, leds & 7); } -void +static void LinuxKeyboardBell (int volume, int pitch, int duration) { if (volume && pitch) diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c index 76ce58349..2badebebe 100644 --- a/hw/kdrive/linux/linux.c +++ b/hw/kdrive/linux/linux.c @@ -65,7 +65,7 @@ LinuxCheckChown (char *file) } static int -LinuxInit () +LinuxInit (void) { int fd = -1; char vtname[11]; diff --git a/hw/kdrive/linux/mouse.c b/hw/kdrive/linux/mouse.c index 2158a587d..689c7e9e7 100644 --- a/hw/kdrive/linux/mouse.c +++ b/hw/kdrive/linux/mouse.c @@ -46,7 +46,7 @@ typedef struct _kbufio { int used; } Kbufio; -Bool +static Bool MouseWaitForReadable (int fd, int timeout) { fd_set set; @@ -69,7 +69,7 @@ MouseWaitForReadable (int fd, int timeout) return FALSE; } -int +static int MouseReadByte (Kbufio *b, int timeout) { int n; @@ -89,7 +89,8 @@ MouseReadByte (Kbufio *b, int timeout) return b->buf[b->used++]; } -int +#if NOTUSED +static int MouseFlush (Kbufio *b, char *buf, int size) { CARD32 now = GetTimeInMillis (); @@ -115,7 +116,7 @@ MouseFlush (Kbufio *b, char *buf, int size) return n; } -int +static int MousePeekByte (Kbufio *b, int timeout) { int c; @@ -125,8 +126,9 @@ MousePeekByte (Kbufio *b, int timeout) --b->used; return c; } +#endif /* NOTUSED */ -Bool +static Bool MouseWaitForWritable (int fd, int timeout) { fd_set set; @@ -149,7 +151,7 @@ MouseWaitForWritable (int fd, int timeout) return FALSE; } -Bool +static Bool MouseWriteByte (int fd, unsigned char c, int timeout) { int ret; @@ -171,7 +173,7 @@ MouseWriteByte (int fd, unsigned char c, int timeout) } } -Bool +static Bool MouseWriteBytes (int fd, unsigned char *c, int n, int timeout) { while (n--) @@ -708,7 +710,7 @@ static const KmouseProt *kmouseProts[] = { #define NUM_PROT (sizeof (kmouseProts) / sizeof (kmouseProts[0])) -void +static void MouseInitProtocol (Kmouse *km) { int ret; @@ -736,7 +738,7 @@ MouseInitProtocol (Kmouse *km) km->state = km->prot->state; } -void +static void MouseFirstProtocol (Kmouse *km, char *prot) { if (prot) @@ -772,7 +774,7 @@ MouseFirstProtocol (Kmouse *km, char *prot) MouseInitProtocol (km); } -void +static void MouseNextProtocol (Kmouse *km) { do @@ -787,7 +789,7 @@ MouseNextProtocol (Kmouse *km) ErrorF ("Switching to mouse protocol \"%s\"\n", km->prot->name); } -void +static void MouseRead (int mousePort, void *closure) { KdMouseInfo *mi = closure; @@ -911,7 +913,7 @@ char *kdefaultMouse[] = { #define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0])) -Bool +static Bool MouseInit (void) { int i; @@ -968,7 +970,7 @@ MouseInit (void) return TRUE; } -void +static void MouseFini (void) { KdMouseInfo *mi; diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c index 20c3dc680..b29f6527b 100644 --- a/hw/kdrive/linux/ms.c +++ b/hw/kdrive/linux/ms.c @@ -35,7 +35,7 @@ THE SOFTWARE. #include "scrnintstr.h" #include "kdrive.h" -int +static int MsReadBytes (int fd, char *buf, int len, int min) { int n, tot; @@ -65,7 +65,7 @@ MsReadBytes (int fd, char *buf, int len, int min) return tot; } -void +static void MsRead (int port, void *closure) { unsigned char buf[3 * 200]; @@ -97,7 +97,7 @@ MsRead (int port, void *closure) int MsInputType; -int +static int MsInit (void) { int port; @@ -151,7 +151,7 @@ MsInit (void) return 0; } -void +static void MsFini (void) { KdUnregisterFds (MsInputType, TRUE); diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c index 3a3444366..da3372011 100644 --- a/hw/kdrive/linux/ps2.c +++ b/hw/kdrive/linux/ps2.c @@ -33,7 +33,7 @@ #include "scrnintstr.h" #include "kdrive.h" -int +static int Ps2ReadBytes (int fd, char *buf, int len, int min) { int n, tot; @@ -71,7 +71,7 @@ char *Ps2Names[] = { #define NUM_PS2_NAMES (sizeof (Ps2Names) / sizeof (Ps2Names[0])) -void +static void Ps2Read (int ps2Port, void *closure) { unsigned char buf[3 * 200]; @@ -119,7 +119,7 @@ Ps2Read (int ps2Port, void *closure) int Ps2InputType; -int +static int Ps2Init (void) { int i; @@ -141,7 +141,7 @@ Ps2Init (void) return n; } -void +static void Ps2Fini (void) { KdUnregisterFds (Ps2InputType, TRUE); diff --git a/hw/kdrive/mach64/Makefile.am b/hw/kdrive/mach64/Makefile.am index 2a960ec5f..ff9282e60 100644 --- a/hw/kdrive/mach64/Makefile.am +++ b/hw/kdrive/mach64/Makefile.am @@ -1,14 +1,7 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ - -I$(top_srcdir)/hw/kdrive/linux \ + @KDRIVE_INCS@ \ -I$(top_srcdir)/hw/kdrive/vesa \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @XSERVER_CFLAGS@ bin_PROGRAMS = Xmach64 @@ -22,28 +15,16 @@ libmach64_a_SOURCES = \ mach64.h \ mach64draw.h - Xmach64_SOURCES = \ mach64stub.c -Xmach64_LDADD = \ - libmach64.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) \ - -lm -lz +MACH64_LIBS = \ + libmach64.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a + +Xmach64_LDADD = \ + $(MACH64_LIBS) \ + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ + +Xmach64_DEPENDENCIES = $(MACH64_LIBS) @KDRIVE_LIBS@ diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c index a036f3e1d..3d24045da 100644 --- a/hw/kdrive/mach64/mach64.c +++ b/hw/kdrive/mach64/mach64.c @@ -27,7 +27,7 @@ #include "mach64.h" #include <sys/io.h> -Bool +static Bool mach64CardInit (KdCardInfo *card) { Mach64CardInfo *mach64c; @@ -50,12 +50,11 @@ mach64CardInit (KdCardInfo *card) return TRUE; } -Bool +static Bool mach64ScreenInit (KdScreenInfo *screen) { Mach64CardInfo *mach64c = screen->card->driver; Mach64ScreenInfo *mach64s; - int screen_size, memory; mach64s = (Mach64ScreenInfo *) xalloc (sizeof (Mach64ScreenInfo)); if (!mach64s) @@ -70,7 +69,6 @@ mach64ScreenInit (KdScreenInfo *screen) screen->dumb = TRUE; if (mach64s->vesa.mapping != VESA_LINEAR) screen->dumb = TRUE; - screen->memory_base = mach64s->vesa.fb; switch (screen->fb[0].depth) { case 8: mach64s->colorKey = 0xff; @@ -86,30 +84,21 @@ mach64ScreenInit (KdScreenInfo *screen) mach64s->colorKey = 1; break; } - memory = mach64s->vesa.fb_size; - screen_size = screen->fb[0].byteStride * screen->height; - memory -= screen_size; - screen->softCursor = TRUE; - screen->off_screen_base = screen_size; - screen->off_screen_size = memory; screen->driver = mach64s; return TRUE; } -Bool +static Bool mach64InitScreen (ScreenPtr pScreen) { #ifdef XV - KdScreenPriv(pScreen); - Mach64CardInfo *mach64c = pScreenPriv->screen->card->driver; - if (mach64c->media_reg && mach64c->reg) - mach64InitVideo(pScreen); + mach64InitVideo(pScreen); #endif return vesaInitScreen (pScreen); } #ifdef RANDR -Bool +static Bool mach64RandRSetConfig (ScreenPtr pScreen, Rotation rotation, int rate, @@ -123,7 +112,7 @@ mach64RandRSetConfig (ScreenPtr pScreen, return TRUE; } -void +static void mach64RandRInit (ScreenPtr pScreen) { rrScrPriv(pScreen); @@ -132,7 +121,7 @@ mach64RandRInit (ScreenPtr pScreen) } #endif -Bool +static Bool mach64FinishInitScreen (ScreenPtr pScreen) { Bool ret; @@ -143,6 +132,12 @@ mach64FinishInitScreen (ScreenPtr pScreen) return ret; } +static Bool +mach64CreateResources (ScreenPtr pScreen) +{ + return vesaCreateResources (pScreen); +} + CARD32 mach64ReadLCD (Reg *reg, int id) { @@ -367,7 +362,7 @@ mach64DPMS (ScreenPtr pScreen, int mode) return TRUE; } -void +static void mach64Restore (KdCardInfo *card) { Mach64CardInfo *mach64c = card->driver; @@ -381,23 +376,26 @@ mach64Restore (KdCardInfo *card) vesaRestore (card); } -void +static void mach64ScreenFini (KdScreenInfo *screen) { Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - +#ifdef XV + mach64FiniVideo(screen->pScreen); +#endif vesaScreenFini (screen); xfree (mach64s); screen->driver = 0; } -void +static void mach64CardFini (KdCardInfo *card) { Mach64CardInfo *mach64c = card->driver; mach64UnmapReg (card, mach64c); vesaCardFini (card); + xfree (mach64c); } #define mach64CursorInit 0 /* initCursor */ @@ -410,6 +408,8 @@ KdCardFuncs mach64Funcs = { mach64CardInit, /* cardinit */ mach64ScreenInit, /* scrinit */ mach64InitScreen, /* initScreen */ + mach64FinishInitScreen, /* finishInitScreen */ + mach64CreateResources, /* createRes */ mach64Preserve, /* preserve */ mach64Enable, /* enable */ mach64DPMS, /* dpms */ @@ -432,6 +432,4 @@ KdCardFuncs mach64Funcs = { vesaGetColors, /* getColors */ vesaPutColors, /* putColors */ - - mach64FinishInitScreen, /* finishInitScreen */ }; diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h index 38ddb9ae9..68e762b3b 100644 --- a/hw/kdrive/mach64/mach64.h +++ b/hw/kdrive/mach64/mach64.h @@ -557,6 +557,7 @@ typedef struct _mach64PortPriv { } Mach64PortPrivRec, *Mach64PortPrivPtr; Bool mach64InitVideo(ScreenPtr pScreen); +void mach64FiniVideo(ScreenPtr pScreen); typedef struct _mach64ScreenInfo { VesaScreenPrivRec vesa; diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c index aa065c5a8..d93e7dff7 100644 --- a/hw/kdrive/mach64/mach64draw.c +++ b/hw/kdrive/mach64/mach64draw.c @@ -64,6 +64,10 @@ CARD8 mach64Rop[16] = { #define MACH64_DRAW_COMBO_SOLID 0x1 #define MACH64_DRAW_COMBO_COPY 0x8 +#define SYNC_ALWAYS 0 +#if SYNC_ALWAYS +static ScreenPtr mach64Screen; +#endif static Reg *reg; static CARD32 avail; static CARD32 triple; @@ -102,6 +106,9 @@ mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) reg = mach64c->reg; triple = mach64s->bpp24; +#if SYNC_ALWAYS + mach64Screen = pScreen; +#endif if (!reg) return FALSE; @@ -140,7 +147,7 @@ mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) return TRUE; } -Bool +static Bool mach64PrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, @@ -154,7 +161,7 @@ mach64PrepareSolid (PixmapPtr pPixmap, return TRUE; } -void +static void mach64Solid (int x1, int y1, int x2, int y2) { if (triple) @@ -176,16 +183,19 @@ mach64Solid (int x1, int y1, int x2, int y2) reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1); } -void +static void mach64DoneSolid (void) { +#if SYNC_ALWAYS + KdCheckSync (mach64Screen); +#endif } static int copyDx; static int copyDy; static CARD32 copyCombo; -Bool +static Bool mach64PrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int dx, @@ -217,7 +227,7 @@ mach64PrepareCopy (PixmapPtr pSrcPixmap, return TRUE; } -void +static void mach64Copy (int srcX, int srcY, int dstX, @@ -260,9 +270,12 @@ mach64Copy (int srcX, reg->DST_HEIGHT_WIDTH = MACH64_YX(w,h); } -void +static void mach64DoneCopy (void) { +#if SYNC_ALWAYS + KdCheckSync (mach64Screen); +#endif } KaaScreenInfoRec mach64Kaa = { @@ -449,6 +462,7 @@ mach64DrawDisable (ScreenPtr pScreen) void mach64DrawFini (ScreenPtr pScreen) { + kaaDrawFini (pScreen); } void diff --git a/hw/kdrive/mach64/mach64video.c b/hw/kdrive/mach64/mach64video.c index b66b4007a..64e5fb795 100644 --- a/hw/kdrive/mach64/mach64video.c +++ b/hw/kdrive/mach64/mach64video.c @@ -980,7 +980,10 @@ Bool mach64InitVideo(ScreenPtr pScreen) int num_adaptors; KdCardInfo *card = pScreenPriv->card; Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; + Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; + mach64s->pAdaptor = NULL; + if (!mach64c->media_reg) return FALSE; @@ -1017,3 +1020,18 @@ Bool mach64InitVideo(ScreenPtr pScreen) xfree(newAdaptors); return TRUE; } + +void +mach64FiniVideo (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + mach64ScreenInfo(pScreenPriv); + KdVideoAdaptorPtr adapt = mach64s->pAdaptor; + + if (adapt) + { + Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); + REGION_UNINIT (pScreen, &pPortPriv->clip); + xfree (adapt); + } +} diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am index bcc7607ab..157421249 100644 --- a/hw/kdrive/mga/Makefile.am +++ b/hw/kdrive/mga/Makefile.am @@ -1,15 +1,7 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ + @KDRIVE_INCS@ \ -I$(top_srcdir)/hw/kdrive/vesa \ - -I$(top_srcdir)/hw/kdrive/linux \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @XSERVER_CFLAGS@ bin_PROGRAMS = Xmga @@ -24,23 +16,7 @@ Xmga_SOURCES = \ mgastub.c Xmga_LDADD = \ - libmga.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) \ - -lm -lz + libmga.a \ + $(top_builddir)/hw/kdrive/vesa/libvesa.a \ + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ diff --git a/hw/kdrive/mga/mga.c b/hw/kdrive/mga/mga.c index 2c3a4831d..556b9b18f 100644 --- a/hw/kdrive/mga/mga.c +++ b/hw/kdrive/mga/mga.c @@ -27,7 +27,7 @@ #endif #include "mga.h" -Bool +static Bool mgaCardInit (KdCardInfo *card) { MgaCardInfo *mgac; @@ -51,11 +51,10 @@ mgaCardInit (KdCardInfo *card) return TRUE; } -Bool +static Bool mgaScreenInit (KdScreenInfo *screen) { MgaScreenInfo *mgas; - int screen_size, memory; mgas = (MgaScreenInfo *) xalloc (sizeof (MgaScreenInfo)); if (!mgas) @@ -75,33 +74,17 @@ mgaScreenInit (KdScreenInfo *screen) fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping); #endif - screen->memory_base = mgas->vesa.fb; - - memory = mgas->vesa.fb_size; - screen_size = screen->fb[0].byteStride * screen->height; - - memory -= screen_size; - if (memory > screen->fb[0].byteStride) - { - screen->off_screen_base = screen_size; - screen->off_screen_size = memory; - } - else - { - screen->off_screen_base = 0; - screen->off_screen_size = 0; - } screen->driver = mgas; return TRUE; } -Bool +static Bool mgaInitScreen (ScreenPtr pScreen) { return vesaInitScreen (pScreen); } -Bool +static Bool mgaFinishInitScreen (ScreenPtr pScreen) { Bool ret; @@ -111,7 +94,13 @@ mgaFinishInitScreen (ScreenPtr pScreen) return ret; } -void +static Bool +mgaCreateResources (ScreenPtr pScreen) +{ + return vesaCreateResources (pScreen); +} + +static void mgaPreserve (KdCardInfo *card) { vesaPreserve (card); @@ -162,14 +151,14 @@ mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac) mgaUnmapReg (card, mgac); } -Bool +static Bool mgaDPMS (ScreenPtr pScreen, int mode) { /* XXX */ return TRUE; } -Bool +static Bool mgaEnable (ScreenPtr pScreen) { KdScreenPriv (pScreen); @@ -184,7 +173,7 @@ mgaEnable (ScreenPtr pScreen) return TRUE; } -void +static void mgaDisable (ScreenPtr pScreen) { KdScreenPriv (pScreen); @@ -195,7 +184,7 @@ mgaDisable (ScreenPtr pScreen) vesaDisable (pScreen); } -void +static void mgaRestore (KdCardInfo *card) { MgaCardInfo *mgac = card->driver; @@ -204,7 +193,7 @@ mgaRestore (KdCardInfo *card) vesaRestore (card); } -void +static void mgaScreenFini (KdScreenInfo *screen) { MgaScreenInfo *mgas = (MgaScreenInfo *) screen->driver; @@ -214,7 +203,7 @@ mgaScreenFini (KdScreenInfo *screen) screen->driver = 0; } -void +static void mgaCardFini (KdCardInfo *card) { MgaCardInfo *mgac = (MgaCardInfo *)card->driver; @@ -227,6 +216,8 @@ KdCardFuncs mgaFuncs = { mgaCardInit, /* cardinit */ mgaScreenInit, /* scrinit */ mgaInitScreen, /* initScreen */ + mgaFinishInitScreen, /* finishInitScreen */ + mgaCreateResources, /* createRes */ mgaPreserve, /* preserve */ mgaEnable, /* enable */ mgaDPMS, /* dpms */ @@ -249,7 +240,5 @@ KdCardFuncs mgaFuncs = { vesaGetColors, /* getColors */ vesaPutColors, /* putColors */ - - mgaFinishInitScreen, /* finishInitScreen */ }; diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c index b41c5c16a..04cd44fc9 100644 --- a/hw/kdrive/mga/mgadraw.c +++ b/hw/kdrive/mga/mgadraw.c @@ -51,7 +51,7 @@ int fifo_size; int pitch, src_pitch; int dir; -void +static void mgaWaitAvail (int n) { if (fifo_size < n) { @@ -62,7 +62,7 @@ mgaWaitAvail (int n) fifo_size -= n; } -void +static void mgaWaitIdle (void) { while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000); @@ -91,11 +91,10 @@ mgaSetup (ScreenPtr pScreen, int wait) return TRUE; } -Bool +static Bool mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) { KdScreenPriv(pPixmap->drawable.pScreen); - mgaScreenInfo (pScreenPriv); int cmd; int dst_org; @@ -115,7 +114,7 @@ mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) return TRUE; } -void +static void mgaSolid (int x1, int y1, int x2, int y2) { mgaWaitAvail (2); @@ -124,7 +123,7 @@ mgaSolid (int x1, int y1, int x2, int y2) MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (y1 << 16) | (y2 - y1)); } -void +static void mgaDoneSolid (void) { } @@ -132,12 +131,11 @@ mgaDoneSolid (void) #define BLIT_LEFT 1 #define BLIT_UP 4 -Bool +static Bool mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int dx, int dy, int alu, Pixel pm) { KdScreenPriv(pSrcPixmap->drawable.pScreen); - mgaScreenInfo (pScreenPriv); int cmd; @@ -165,7 +163,7 @@ mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, return TRUE; } -void +static void mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h) { int start, end; @@ -191,7 +189,7 @@ mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h) MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (dstY << 16) | h); } -void +static void mgaDoneCopy (void) { } diff --git a/hw/kdrive/nvidia/Makefile.am b/hw/kdrive/nvidia/Makefile.am index 324595e8c..41ad93691 100644 --- a/hw/kdrive/nvidia/Makefile.am +++ b/hw/kdrive/nvidia/Makefile.am @@ -1,13 +1,7 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ + @KDRIVE_INCS@ \ -I$(top_srcdir)/hw/kdrive/vesa \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @XSERVER_CFLAGS@ bin_PROGRAMS = Xnvidia @@ -29,21 +23,5 @@ Xnvidia_SOURCES = \ Xnvidia_LDADD = \ libnvidia.a \ $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) \ - -lm -lz + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ diff --git a/hw/kdrive/nvidia/nvidia.c b/hw/kdrive/nvidia/nvidia.c index c74daf7a0..fa53476b1 100644 --- a/hw/kdrive/nvidia/nvidia.c +++ b/hw/kdrive/nvidia/nvidia.c @@ -28,7 +28,7 @@ #include "nvidia.h" #include <sys/io.h> -Bool +static Bool nvidiaCardInit (KdCardInfo *card) { NvidiaCardInfo *nvidiac; @@ -50,7 +50,7 @@ nvidiaCardInit (KdCardInfo *card) return TRUE; } -Bool +static Bool nvidiaScreenInit (KdScreenInfo *screen) { NvidiaCardInfo *nvidiac = screen->card->driver; @@ -96,7 +96,7 @@ nvidiaScreenInit (KdScreenInfo *screen) return TRUE; } -Bool +static Bool nvidiaInitScreen (ScreenPtr pScreen) { #if 0 @@ -111,13 +111,12 @@ nvidiaInitScreen (ScreenPtr pScreen) } #ifdef RANDR +static Bool nvidiaRandRSetConfig (ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { - KdScreenPriv(pScreen); - KdCheckSync (pScreen); if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) @@ -126,7 +125,7 @@ nvidiaRandRSetConfig (ScreenPtr pScreen, return TRUE; } -void +static void nvidiaRandRInit (ScreenPtr pScreen) { rrScrPriv(pScreen); @@ -135,7 +134,7 @@ nvidiaRandRInit (ScreenPtr pScreen) } #endif -Bool +static Bool nvidiaFinishInitScreen (ScreenPtr pScreen) { Bool ret; @@ -149,8 +148,6 @@ nvidiaFinishInitScreen (ScreenPtr pScreen) void nvidiaPreserve (KdCardInfo *card) { - NvidiaCardInfo *nvidiac = card->driver; - vesaPreserve(card); } @@ -198,7 +195,7 @@ static void vgaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock) LEAVE (); } -void nvidiaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock) +static void nvidiaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock) { if (NVIDIA_IS_3(nvidiac)) nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x06, lock ? 0x99 : 0x57); @@ -276,7 +273,6 @@ nvidiaEnable (ScreenPtr pScreen) return FALSE; nvidiaSetMMIO (pScreenPriv->card, nvidiac); - nvidiaDPMS (pScreen, KD_DPMS_NORMAL); #ifdef XV KdXVEnable (pScreen); #endif @@ -296,13 +292,13 @@ nvidiaDisable (ScreenPtr pScreen) vesaDisable (pScreen); } -Bool +static Bool nvidiaDPMS (ScreenPtr pScreen, int mode) { return vesaDPMS (pScreen, mode); } -void +static void nvidiaRestore (KdCardInfo *card) { NvidiaCardInfo *nvidiac = card->driver; @@ -311,7 +307,7 @@ nvidiaRestore (KdCardInfo *card) vesaRestore (card); } -void +static void nvidiaScreenFini (KdScreenInfo *screen) { NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; @@ -321,7 +317,7 @@ nvidiaScreenFini (KdScreenInfo *screen) screen->driver = 0; } -void +static void nvidiaCardFini (KdCardInfo *card) { NvidiaCardInfo *nvidiac = card->driver; @@ -340,6 +336,8 @@ KdCardFuncs nvidiaFuncs = { nvidiaCardInit, /* cardinit */ nvidiaScreenInit, /* scrinit */ nvidiaInitScreen, /* initScreen */ + nvidiaFinishInitScreen, /* finishInitScreen */ + vesaCreateResources, /* createRes */ nvidiaPreserve, /* preserve */ nvidiaEnable, /* enable */ nvidiaDPMS, /* dpms */ @@ -362,6 +360,4 @@ KdCardFuncs nvidiaFuncs = { vesaGetColors, /* getColors */ vesaPutColors, /* putColors */ - - nvidiaFinishInitScreen, /* finishInitScreen */ }; diff --git a/hw/kdrive/nvidia/nvidia.h b/hw/kdrive/nvidia/nvidia.h index b1ba3b3ad..083ffc0ea 100644 --- a/hw/kdrive/nvidia/nvidia.h +++ b/hw/kdrive/nvidia/nvidia.h @@ -26,6 +26,7 @@ #define _NVIDIA_H_ #include <vesa.h> #include "kxv.h" +#include "klinux.h" /* * offset from ioport beginning diff --git a/hw/kdrive/nvidia/nvidiadraw.c b/hw/kdrive/nvidia/nvidiadraw.c index 840b0752c..b49ed7805 100644 --- a/hw/kdrive/nvidia/nvidiadraw.c +++ b/hw/kdrive/nvidia/nvidiadraw.c @@ -81,19 +81,18 @@ nvidiaWaitIdle (NvidiaCardInfo *card) } } -Bool -nvidiaPrepareSolid (DrawablePtr pDrawable, - int alu, - Pixel pm, - Pixel fg) +static Bool +nvidiaPrepareSolid (PixmapPtr pPixmap, + int alu, + Pixel pm, + Pixel fg) { - ScreenPtr pScreen = pDrawable->pScreen; + ScreenPtr pScreen = pPixmap->drawable.pScreen; KdScreenPriv(pScreen); - nvidiaScreenInfo(pScreenPriv); nvidiaCardInfo(pScreenPriv); card = nvidiac; - if (~pm & FbFullMask(pDrawable->depth)) + if (~pm & FbFullMask(pPixmap->drawable.depth)) return FALSE; nvidiaWait (nvidiac, &nvidiac->rop->FifoFree, 1); nvidiac->rop->Rop3 = nvidiaRop[alu]; @@ -102,7 +101,7 @@ nvidiaPrepareSolid (DrawablePtr pDrawable, return TRUE; } -void +static void nvidiaSolid (int x1, int y1, int x2, int y2) { nvidiaWait (card, &card->rect->FifoFree, 2); @@ -110,34 +109,33 @@ nvidiaSolid (int x1, int y1, int x2, int y2) card->rect->WidthHeight = NVIDIA_XY(x2-x1,y2-y1); } -void +static void nvidiaDoneSolid (void) { } -Bool -nvidiaPrepareCopy (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, +static Bool +nvidiaPrepareCopy (PixmapPtr pSrcPixmap, + PixmapPtr pDstPixmap, int dx, int dy, int alu, Pixel pm) { - ScreenPtr pScreen = pDstDrawable->pScreen; + ScreenPtr pScreen = pDstPixmap->drawable.pScreen; KdScreenPriv(pScreen); - nvidiaScreenInfo(pScreenPriv); nvidiaCardInfo(pScreenPriv); card = nvidiac; - if (~pm & FbFullMask(pDstDrawable->depth)) + if (~pm & FbFullMask(pDstPixmap->drawable.depth)) return FALSE; nvidiaWait (nvidiac, &card->rop->FifoFree, 1); nvidiac->rop->Rop3 = nvidiaRop[alu]; return TRUE; } -void +static void nvidiaCopy (int srcX, int srcY, int dstX, @@ -151,7 +149,7 @@ nvidiaCopy (int srcX, card->blt->WidthHeight = NVIDIA_XY(w, h); } -void +static void nvidiaDoneCopy (void) { } @@ -170,9 +168,8 @@ Bool nvidiaDrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); - nvidiaScreenInfo(pScreenPriv); nvidiaCardInfo(pScreenPriv); - Bool ret; + Bool ret = TRUE; ENTER (); if (pScreenPriv->screen->fb[0].depth == 4) @@ -213,7 +210,6 @@ void nvidiaDrawEnable (ScreenPtr pScreen) { KdScreenPriv(pScreen); - nvidiaScreenInfo(pScreenPriv); nvidiaCardInfo(pScreenPriv); ENTER (); diff --git a/hw/kdrive/r128/Makefile.am b/hw/kdrive/r128/Makefile.am index 86d3070d3..1a5718c5f 100644 --- a/hw/kdrive/r128/Makefile.am +++ b/hw/kdrive/r128/Makefile.am @@ -1,14 +1,7 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ + @KDRIVE_INCS@ \ -I$(top_srcdir)/hw/kdrive/vesa \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @XSERVER_CFLAGS@ bin_PROGRAMS = Xr128 @@ -25,21 +18,5 @@ Xr128_SOURCES = \ Xr128_LDADD = \ libr128.a \ $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) \ - -lm -lz + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ diff --git a/hw/kdrive/r128/r128.c b/hw/kdrive/r128/r128.c index 10974cc7f..2be8b26d2 100644 --- a/hw/kdrive/r128/r128.c +++ b/hw/kdrive/r128/r128.c @@ -27,7 +27,7 @@ #endif #include "r128.h" -Bool +static Bool r128CardInit (KdCardInfo *card) { R128CardInfo *r128c; @@ -51,10 +51,9 @@ r128CardInit (KdCardInfo *card) return TRUE; } -Bool +static Bool r128ScreenInit (KdScreenInfo *screen) { - R128CardInfo *r128c = screen->card->driver; R128ScreenInfo *r128s; int screen_size, memory; @@ -96,13 +95,13 @@ r128ScreenInit (KdScreenInfo *screen) return TRUE; } -Bool +static Bool r128InitScreen (ScreenPtr pScreen) { return vesaInitScreen (pScreen); } -Bool +static Bool r128FinishInitScreen (ScreenPtr pScreen) { Bool ret; @@ -112,11 +111,9 @@ r128FinishInitScreen (ScreenPtr pScreen) return ret; } -void +static void r128Preserve (KdCardInfo *card) { - R128CardInfo *r128c = card->driver; - vesaPreserve (card); } @@ -164,7 +161,15 @@ r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c) r128UnmapReg (card, r128c); } -Bool + +static Bool +r128DPMS (ScreenPtr pScreen, int mode) +{ + /* XXX */ + return TRUE; +} + +static Bool r128Enable (ScreenPtr pScreen) { KdScreenPriv (pScreen); @@ -179,7 +184,7 @@ r128Enable (ScreenPtr pScreen) return TRUE; } -void +static void r128Disable (ScreenPtr pScreen) { KdScreenPriv (pScreen); @@ -189,14 +194,7 @@ r128Disable (ScreenPtr pScreen) vesaDisable (pScreen); } -Bool -r128DPMS (ScreenPtr pScreen, int mode) -{ - /* XXX */ - return TRUE; -} - -void +static void r128Restore (KdCardInfo *card) { R128CardInfo *r128c = card->driver; @@ -205,7 +203,7 @@ r128Restore (KdCardInfo *card) vesaRestore (card); } -void +static void r128ScreenFini (KdScreenInfo *screen) { R128ScreenInfo *r128s = (R128ScreenInfo *) screen->driver; @@ -215,7 +213,7 @@ r128ScreenFini (KdScreenInfo *screen) screen->driver = 0; } -void +static void r128CardFini (KdCardInfo *card) { R128CardInfo *r128c = (R128CardInfo *)card->driver; @@ -228,6 +226,8 @@ KdCardFuncs r128Funcs = { r128CardInit, /* cardinit */ r128ScreenInit, /* scrinit */ r128InitScreen, /* initScreen */ + r128FinishInitScreen, /* finishInitScreen */ + vesaCreateResources,/* createRes */ r128Preserve, /* preserve */ r128Enable, /* enable */ r128DPMS, /* dpms */ @@ -250,7 +250,5 @@ KdCardFuncs r128Funcs = { vesaGetColors, /* getColors */ vesaPutColors, /* putColors */ - - r128FinishInitScreen, /* finishInitScreen */ }; diff --git a/hw/kdrive/r128/r128.h b/hw/kdrive/r128/r128.h index 06b3d0286..8cf2bd4e2 100644 --- a/hw/kdrive/r128/r128.h +++ b/hw/kdrive/r128/r128.h @@ -45,6 +45,10 @@ #define R128_REG_PC_NGUI_CTLSTAT 0x0184 #define R128_REG_DST_HEIGHT_WIDTH 0x143c #define R128_REG_SRC_Y_X 0x1434 +#define R128_DEFAULT_SC_BOTTOM_RIGHT 0x16e8 +#define R128_AUX_SC_CNTL 0x1660 +#define R128_SC_TOP_LEFT 0x16ec +#define R128_SC_BOTTOM_RIGHT 0x16f0 #define R128_GMC_DST_DATATYPE_SHIFT 8 #define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) @@ -57,6 +61,8 @@ #define R128_GUI_ACTIVE (1 << 31) #define R128_PC_BUSY (1 << 31) #define R128_DP_SRC_SOURCE_MEMORY (2 << 24) +#define R128_DEFAULT_SC_RIGHT_MAX (0x1fff << 0) +#define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) typedef volatile CARD8 VOL8; typedef volatile CARD16 VOL16; diff --git a/hw/kdrive/r128/r128draw.c b/hw/kdrive/r128/r128draw.c index 7a8de7479..be4dc79ae 100644 --- a/hw/kdrive/r128/r128draw.c +++ b/hw/kdrive/r128/r128draw.c @@ -69,11 +69,9 @@ int copydx, copydy; int fifo_size; char *mmio; -void +static void r128WaitAvail (int n) { - int i; - if (fifo_size < n) { while ((fifo_size = R128_IN32 (mmio, R128_REG_GUI_STAT) & 0xfff) < n) @@ -83,7 +81,7 @@ r128WaitAvail (int n) fifo_size -= n; } -void +static void r128WaitIdle (void) { int tries; @@ -127,15 +125,24 @@ r128Setup (ScreenPtr pScreen, int wait) R128_OUT32 (mmio, R128_REG_DEFAULT_OFFSET, 0); R128_OUT32 (mmio, R128_REG_DEFAULT_PITCH, r128s->pitch); + r128WaitAvail (4); + R128_OUT32 (mmio, R128_AUX_SC_CNTL, 0); + R128_OUT32 (mmio, R128_DEFAULT_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX + | R128_DEFAULT_SC_BOTTOM_MAX)); + R128_OUT32 (mmio, R128_SC_TOP_LEFT, 0); + R128_OUT32 (mmio, R128_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX + | R128_DEFAULT_SC_BOTTOM_MAX)); + r128WaitAvail (wait); + return TRUE; } -Bool -r128PrepareSolid (DrawablePtr pDrawable, int alu, Pixel pm, Pixel fg) +static Bool +r128PrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) { - KdScreenPriv (pDrawable->pScreen); + KdScreenPriv (pPixmap->drawable.pScreen); r128ScreenInfo (pScreenPriv); - r128Setup (pDrawable->pScreen, 4); + r128Setup (pPixmap->drawable.pScreen, 4); R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl | R128_GMC_BRUSH_SOLID_COLOR | R128_GMC_SRC_DATATYPE_COLOR @@ -148,7 +155,7 @@ r128PrepareSolid (DrawablePtr pDrawable, int alu, Pixel pm, Pixel fg) return TRUE; } -void +static void r128Solid (int x1, int y1, int x2, int y2) { r128WaitAvail (2); @@ -157,21 +164,21 @@ r128Solid (int x1, int y1, int x2, int y2) } -void +static void r128DoneSolid (void) { } -Bool -r128PrepareCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int dx, int dy, int alu, Pixel pm) +static Bool +r128PrepareCopy (PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) { - KdScreenPriv (pSrcDrawable->pScreen); + KdScreenPriv (pSrc->drawable.pScreen); r128ScreenInfo (pScreenPriv); copydx = dx; copydy = dy; - r128Setup (pSrcDrawable->pScreen, 3); + r128Setup (pSrc->drawable.pScreen, 3); R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl | R128_GMC_BRUSH_SOLID_COLOR | R128_GMC_SRC_DATATYPE_COLOR @@ -186,7 +193,7 @@ r128PrepareCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int dx, int return TRUE; } -void +static void r128Copy (int srcX, int srcY, int dstX, int dstY, int w, int h) { if (copydx < 0) @@ -207,7 +214,7 @@ r128Copy (int srcX, int srcY, int dstX, int dstY, int w, int h) R128_OUT32 (mmio, R128_REG_DST_HEIGHT_WIDTH, (h << 16) | w); } -void +static void r128DoneCopy (void) { } @@ -225,8 +232,6 @@ KaaScreenInfoRec r128Kaa = { Bool r128DrawInit (ScreenPtr pScreen) { - KdScreenPriv(pScreen); - if (!kaaDrawInit (pScreen, &r128Kaa)) return FALSE; diff --git a/hw/kdrive/r128/r128stub.c b/hw/kdrive/r128/r128stub.c index 006d66a6a..30dc32c66 100644 --- a/hw/kdrive/r128/r128stub.c +++ b/hw/kdrive/r128/r128stub.c @@ -26,6 +26,7 @@ #include <config.h> #endif #include "r128.h" +#include "klinux.h" void InitCard (char *name) @@ -34,6 +35,8 @@ InitCard (char *name) if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) KdCardInfoAdd (&r128Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x5046, 0, &attr)) + KdCardInfoAdd (&r128Funcs, &attr, 0); } void diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am index d512ecc6b..b6e4bb140 100644 --- a/hw/kdrive/smi/Makefile.am +++ b/hw/kdrive/smi/Makefile.am @@ -1,14 +1,8 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ -I$(top_srcdir)/hw/kdrive/fbdev \ -I$(top_srcdir)/hw/kdrive/vesa \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @KDRIVE_INCS@ \ + @XSERVER_CFLAGS@ bin_PROGRAMS = Xsmi @@ -27,21 +21,5 @@ Xsmi_LDADD = \ libsmi.a \ $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \ $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) \ - -lm -lz + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c index fc29b2228..aaa0b8356 100644 --- a/hw/kdrive/smi/smi.c +++ b/hw/kdrive/smi/smi.c @@ -27,7 +27,7 @@ #include "smi.h" #include <sys/io.h> -Bool +static Bool smiCardInit (KdCardInfo *card) { SmiCardInfo *smic; @@ -51,7 +51,7 @@ smiCardInit (KdCardInfo *card) return TRUE; } -Bool +static Bool smiScreenInit (KdScreenInfo *screen) { SmiCardInfo *smic = screen->card->driver; @@ -80,7 +80,7 @@ smiScreenInit (KdScreenInfo *screen) return TRUE; } -Bool +static Bool smiInitScreen (ScreenPtr pScreen) { Bool ret; @@ -99,13 +99,13 @@ smiInitScreen (ScreenPtr pScreen) } #ifdef RANDR +static Bool smiRandRSetConfig (ScreenPtr pScreen, Rotation randr, int rate, RRScreenSizePtr pSize) { Bool ret; - KdScreenPriv(pScreen); ENTER (); KdCheckSync (pScreen); @@ -115,7 +115,7 @@ smiRandRSetConfig (ScreenPtr pScreen, return ret; } -Bool +static Bool smiRandRInit (ScreenPtr pScreen) { rrScrPriv(pScreen); @@ -127,7 +127,7 @@ smiRandRInit (ScreenPtr pScreen) } #endif -Bool +static Bool smiFinishInitScreen (ScreenPtr pScreen) { Bool ret; @@ -141,8 +141,6 @@ smiFinishInitScreen (ScreenPtr pScreen) void smiPreserve (KdCardInfo *card) { - SmiCardInfo *smic = card->driver; - ENTER (); subPreserve(card); LEAVE(); @@ -229,6 +227,16 @@ smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic) smiUnmapReg (card, smic); } +static Bool +smiDPMS (ScreenPtr pScreen, int mode) +{ + Bool ret; + ENTER (); + ret = subDPMS (pScreen, mode); + LEAVE (); + return ret; +} + Bool smiEnable (ScreenPtr pScreen) { @@ -268,27 +276,15 @@ smiDisable (ScreenPtr pScreen) LEAVE (); } -Bool -smiDPMS (ScreenPtr pScreen, int mode) -{ - Bool ret; - ENTER (); - ret = subDPMS (pScreen, mode); - LEAVE (); - return ret; -} - -void +static void smiRestore (KdCardInfo *card) { - SmiCardInfo *smic = card->driver; - ENTER (); subRestore (card); LEAVE(); } -void +static void smiScreenFini (KdScreenInfo *screen) { SmiScreenInfo *smis = (SmiScreenInfo *) screen->driver; @@ -300,7 +296,7 @@ smiScreenFini (KdScreenInfo *screen) LEAVE (); } -void +static void smiCardFini (KdCardInfo *card) { SmiCardInfo *smic = card->driver; @@ -321,6 +317,8 @@ KdCardFuncs smiFuncs = { smiCardInit, /* cardinit */ smiScreenInit, /* scrinit */ smiInitScreen, /* initScreen */ + smiFinishInitScreen, /* finishInitScreen */ + subCreateResources, /* createRes */ smiPreserve, /* preserve */ smiEnable, /* enable */ smiDPMS, /* dpms */ @@ -343,6 +341,4 @@ KdCardFuncs smiFuncs = { subGetColors, /* getColors */ subPutColors, /* putColors */ - - smiFinishInitScreen, /* finishInitScreen */ }; diff --git a/hw/kdrive/smi/smi.h b/hw/kdrive/smi/smi.h index 572312313..abee819bf 100644 --- a/hw/kdrive/smi/smi.h +++ b/hw/kdrive/smi/smi.h @@ -35,8 +35,9 @@ #define subInitialize vesaInitialize #define subScreenInitialize vesaScreenInitialize #define subInitScreen vesaInitScreen -#define subRandRSetConfig vesaRandRSetConfig #define subFinishInitScreen vesaFinishInitScreen +#define subCreateResources vesaCreateResources +#define subRandRSetConfig vesaRandRSetConfig #define subPreserve vesaPreserve #define subEnable vesaEnable #define subDPMS vesaDPMS @@ -54,8 +55,9 @@ #define subInitialize fbdevInitialize #define subScreenInitialize fbdevScreenInitialize #define subInitScreen fbdevInitScreen -#define subRandRSetConfig fbdevRandRSetConfig #define subFinishInitScreen fbdevFinishInitScreen +#define subCreateResources fbdevCreateResources +#define subRandRSetConfig fbdevRandRSetConfig #define subPreserve fbdevPreserve #define subEnable fbdevEnable #define subDPMS fbdevDPMS @@ -197,6 +199,18 @@ void smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic); void +smiOutb (CARD16 port, CARD8 val); + +CARD8 +smiInb (CARD16 port); + +CARD8 +smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id); + +void +smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val); + +void smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic); void diff --git a/hw/kdrive/smi/smidraw.c b/hw/kdrive/smi/smidraw.c index 3b0033586..d1691fce0 100644 --- a/hw/kdrive/smi/smidraw.c +++ b/hw/kdrive/smi/smidraw.c @@ -143,18 +143,16 @@ smiSetup (ScreenPtr pScreen, int wait) return TRUE; } -Bool -smiPrepareSolid (DrawablePtr pDrawable, +static Bool +smiPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) { - KdScreenPriv(pDrawable->pScreen); - - if (~pm & FbFullMask(pDrawable->depth)) + if (~pm & FbFullMask(pPixmap->drawable.depth)) return FALSE; - if (!smiSetup (pDrawable->pScreen, 3)) + if (!smiSetup (pPixmap->drawable.pScreen, 3)) return FALSE; accel_cmd = smiSolidRop[alu] | SMI_BITBLT | SMI_START_ENGINE; @@ -164,7 +162,7 @@ smiPrepareSolid (DrawablePtr pDrawable, return TRUE; } -void +static void smiSolid (int x1, int y1, int x2, int y2) { smiWaitAvail(smic,3); @@ -173,7 +171,7 @@ smiSolid (int x1, int y1, int x2, int y2) dpr->accel_cmd = accel_cmd; } -void +static void smiDoneSolid (void) { } @@ -181,20 +179,18 @@ smiDoneSolid (void) static int copyDx; static int copyDy; -Bool -smiPrepareCopy (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - int dx, - int dy, - int alu, - Pixel pm) +static Bool +smiPrepareCopy (PixmapPtr pSrcPixmap, + PixmapPtr pDstPixmap, + int dx, + int dy, + int alu, + Pixel pm) { - KdScreenPriv(pSrcDrawable->pScreen); - - if (~pm & FbFullMask(pSrcDrawable->depth)) + if (~pm & FbFullMask(pSrcPixmap->drawable.depth)) return FALSE; - if (!smiSetup (pSrcDrawable->pScreen, 0)) + if (!smiSetup (pSrcPixmap->drawable.pScreen, 0)) return FALSE; accel_cmd = smiBltRop[alu] | SMI_BITBLT | SMI_START_ENGINE; @@ -206,7 +202,7 @@ smiPrepareCopy (DrawablePtr pSrcDrawable, return TRUE; } -void +static void smiCopy (int srcX, int srcY, int dstX, @@ -228,7 +224,7 @@ smiCopy (int srcX, dpr->accel_cmd = accel_cmd; } -void +static void smiDoneCopy (void) { } @@ -248,7 +244,6 @@ smiDrawInit (ScreenPtr pScreen) { KdScreenPriv(pScreen); smiCardInfo (pScreenPriv); - smiScreenInfo (pScreenPriv); ENTER (); if (pScreenPriv->screen->fb[0].depth == 4) diff --git a/hw/kdrive/smi/smistub.c b/hw/kdrive/smi/smistub.c index 7b67c4b2e..fb4e1bad7 100644 --- a/hw/kdrive/smi/smistub.c +++ b/hw/kdrive/smi/smistub.c @@ -28,6 +28,7 @@ #include <config.h> #endif #include "smi.h" +#include "klinux.h" void InitCard (char *name) diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am index 95677f9f6..af7973843 100644 --- a/hw/kdrive/src/Makefile.am +++ b/hw/kdrive/src/Makefile.am @@ -1,10 +1,6 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @KDRIVE_INCS@ \ + @XSERVER_CFLAGS@ noinst_LIBRARIES = libkdrive.a diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c index 9b1457d77..f34f644b4 100644 --- a/hw/kdrive/src/kaa.c +++ b/hw/kdrive/src/kaa.c @@ -50,10 +50,6 @@ int kaaPixmapPrivateIndex; typedef struct { KaaScreenInfoPtr info; - - CreatePixmapProcPtr CreatePixmap; - DestroyPixmapProcPtr DestroyPixmap; - int pixelOffset; /* offset from pPixmap to pixels */ } KaaScreenPrivRec, *KaaScreenPrivPtr; typedef struct { @@ -71,22 +67,10 @@ typedef struct { #define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr) #define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s) -#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr) -#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a)) -#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p) - -#define KaaPixmapPitch(w) (((w) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1)) -#define KaaDrawableIsOffscreenPixmap(d) (d->type == DRAWABLE_PIXMAP && \ - KaaGetPixmapPriv((PixmapPtr)(d)) && \ - KaaGetPixmapPriv((PixmapPtr)(d))->area) -#define KaaDrawableIsScreen(d) (((d)->type == DRAWABLE_WINDOW) || \ - KaaDrawableIsOffscreenPixmap(d)) - -#define KAA_SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ - ((KaaScreenPrivPtr) (pScreen)->devPrivates[kaaScreenPrivateIndex].ptr)->field) - -#define KAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\ - ((pScreen)->field = wrapper) +#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr) +#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a)) +#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p) +#define KaaPixmapPitch(w) (((w) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1)) #define MIN_OFFPIX_SIZE (4096) @@ -248,9 +232,6 @@ kaaPixmapUseMemory (PixmapPtr pPixmap) static Bool kaaDestroyPixmap (PixmapPtr pPixmap) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; - Bool ret; - if (pPixmap->refcnt == 1) { KaaPixmapPriv (pPixmap); @@ -267,58 +248,93 @@ kaaDestroyPixmap (PixmapPtr pPixmap) pPixmap->devKind = pKaaPixmap->devKind; } } - - KAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap); - ret = (*pScreen->DestroyPixmap) (pPixmap); - KAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, kaaDestroyPixmap); - - return ret; + return fbDestroyPixmap (pPixmap); } static PixmapPtr kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth) { - PixmapPtr pPixmap = NULL; + PixmapPtr pPixmap; KaaPixmapPrivPtr pKaaPixmap; + int bpp; - KAA_SCREEN_PROLOGUE (pScreen, CreatePixmap); - pPixmap = (* pScreen->CreatePixmap) (pScreen, w, h, depth); - KAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, kaaCreatePixmap); + bpp = BitsPerPixel (depth); + if (bpp == 32 && depth == 24) + { + int fb; + KdScreenPriv (pScreen); + + for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++) + if (pScreenPriv->screen->fb[fb].depth == 24) + { + bpp = pScreenPriv->screen->fb[fb].bitsPerPixel; + break; + } + } + pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp); if (!pPixmap) return NULL; pKaaPixmap = KaaGetPixmapPriv(pPixmap); pKaaPixmap->score = 0; pKaaPixmap->area = NULL; - if ((pPixmap->devKind * h) >= MIN_OFFPIX_SIZE) + if (depth == pScreen->rootDepth && + (pPixmap->devKind * h) >= MIN_OFFPIX_SIZE) kaaPixmapAllocArea (pPixmap); return pPixmap; } -PixmapPtr -kaaGetDrawingPixmap (DrawablePtr pDrawable, int *x, int *y) +static Bool +kaaPixmapIsOffscreen(PixmapPtr p) { - if (pDrawable->type == DRAWABLE_WINDOW) { - if (x) - *x = pDrawable->x; - if (y) - *y = pDrawable->y; + ScreenPtr pScreen = p->drawable.pScreen; + KdScreenPriv(pScreen); - return (*pDrawable->pScreen->GetScreenPixmap) (pDrawable->pScreen); + return ((unsigned long) ((CARD8 *) p->devPrivate.ptr - + (CARD8 *) pScreenPriv->screen->memory_base) < + pScreenPriv->screen->memory_size); +} + +static PixmapPtr +kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) +{ + PixmapPtr pPixmap; + int x, y; + + if (pDrawable->type == DRAWABLE_WINDOW) { + pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); + x = pDrawable->x; + y = pDrawable->y; } - else if (KaaDrawableIsOffscreenPixmap (pDrawable)) + else { - if (x) - *x = 0; - if (y) - *y = 0; - return ((PixmapPtr)pDrawable); + pPixmap = (PixmapPtr) pDrawable; + x = 0; + y = 0; } + if (kaaPixmapIsOffscreen (pPixmap)) + { + x += pPixmap->drawable.x; + y += pPixmap->drawable.y; + if (xp) *xp = x; + if (yp) *yp = y; + return pPixmap; + } + return NULL; +} + +static Bool +kaaDrawableIsOffscreen (DrawablePtr pDrawable) +{ + PixmapPtr pPixmap; + if (pDrawable->type == DRAWABLE_WINDOW) + pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); else - return NULL; + pPixmap = (PixmapPtr) pDrawable; + return kaaPixmapIsOffscreen (pPixmap); } -void +static void kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted) { @@ -335,7 +351,7 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, if (!pScreenPriv->enabled || pGC->fillStyle != FillSolid || - !(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) || + !(pPixmap = kaaGetOffscreenPixmap (pDrawable, NULL, NULL)) || !(*pKaaScr->info->PrepareSolid) (pPixmap, pGC->alu, pGC->planemask, @@ -389,7 +405,8 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, if (partX2 > fullX2) partX2 = fullX2; if (partX2 > partX1) - (*pKaaScr->info->Solid) (partX1, fullY1, partX2, fullY1 + 1); + (*pKaaScr->info->Solid) (partX1, fullY1, + partX2, fullY1 + 1); } pbox++; } @@ -399,7 +416,7 @@ kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, KdMarkSync(pDrawable->pScreen); } -void +static void kaaCopyNtoN (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, @@ -418,15 +435,15 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable, /* Migrate pixmaps to same place as destination */ if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) { - if (KaaDrawableIsScreen (pDstDrawable)) + if (kaaDrawableIsOffscreen (pDstDrawable)) kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable); else kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable); } if (pScreenPriv->enabled && - (pSrcPixmap = kaaGetDrawingPixmap (pSrcDrawable, NULL, NULL)) && - (pDstPixmap = kaaGetDrawingPixmap (pDstDrawable, NULL, NULL)) && + (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, NULL, NULL)) && + (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, NULL, NULL)) && (*pKaaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, dx, @@ -454,7 +471,7 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable, } } -RegionPtr +static RegionPtr kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { @@ -463,7 +480,7 @@ kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, dstx, dsty, kaaCopyNtoN, 0, 0); } -void +static void kaaPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, @@ -483,7 +500,7 @@ kaaPolyFillRect(DrawablePtr pDrawable, if (!pScreenPriv->enabled || pGC->fillStyle != FillSolid || - !(pPixmap = kaaGetDrawingPixmap (pDrawable, &xorg, &yorg)) || + !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xorg, &yorg)) || !(*pKaaScr->info->PrepareSolid) (pPixmap, pGC->alu, pGC->planemask, @@ -559,7 +576,7 @@ kaaPolyFillRect(DrawablePtr pDrawable, KdMarkSync(pDrawable->pScreen); } -void +static void kaaSolidBoxClipped (DrawablePtr pDrawable, RegionPtr pClip, FbBits pm, @@ -577,7 +594,7 @@ kaaSolidBoxClipped (DrawablePtr pDrawable, int partX1, partX2, partY1, partY2; if (!pScreenPriv->enabled || - !(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) || + !(pPixmap = kaaGetOffscreenPixmap (pDrawable, NULL, NULL)) || !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) { KdCheckSync (pDrawable->pScreen); @@ -619,7 +636,7 @@ kaaSolidBoxClipped (DrawablePtr pDrawable, KdMarkSync(pDrawable->pScreen); } -void +static void kaaImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, @@ -776,12 +793,12 @@ static const GCOps kaaOps = { #endif }; -void +static void kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) { fbValidateGC (pGC, changes, pDrawable); - if (KaaDrawableIsScreen (pDrawable)) + if (kaaDrawableIsOffscreen (pDrawable)) pGC->ops = (GCOps *) &kaaOps; else pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; @@ -797,7 +814,7 @@ GCFuncs kaaGCFuncs = { miCopyClip }; -int +static int kaaCreateGC (GCPtr pGC) { if (!fbCreateGC (pGC)) @@ -809,7 +826,7 @@ kaaCreateGC (GCPtr pGC) } -void +static void kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { RegionRec rgnDst; @@ -833,7 +850,7 @@ kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); } -void +static void kaaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel) @@ -843,7 +860,7 @@ kaaFillRegionSolid (DrawablePtr pDrawable, PixmapPtr pPixmap; if (pScreenPriv->enabled && - (pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) && + (pPixmap = kaaGetOffscreenPixmap (pDrawable, NULL, NULL)) && (*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) { int nbox = REGION_NUM_RECTS (pRegion); @@ -865,7 +882,7 @@ kaaFillRegionSolid (DrawablePtr pDrawable, } } -void +static void kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { @@ -933,7 +950,8 @@ kaaDrawInit (ScreenPtr pScreen, KaaScreenInfoPtr pScreenInfo) { KaaScreenPrivPtr pKaaScr; - KdScreenInfo *screen = KdGetScreenPriv (pScreen)->screen; + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif @@ -974,15 +992,13 @@ kaaDrawInit (ScreenPtr pScreen, * Hookup offscreen pixmaps */ if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) && - screen->off_screen_size > 0) + screen->off_screen_base < screen->memory_size) { - pKaaScr->CreatePixmap = pScreen->CreatePixmap; - pScreen->CreatePixmap = kaaCreatePixmap; - pKaaScr->DestroyPixmap = pScreen->DestroyPixmap; - pScreen->DestroyPixmap = kaaDestroyPixmap; if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, sizeof (KaaPixmapPrivRec))) return FALSE; + pScreen->CreatePixmap = kaaCreatePixmap; + pScreen->DestroyPixmap = kaaDestroyPixmap; } else { @@ -993,3 +1009,10 @@ kaaDrawInit (ScreenPtr pScreen, return TRUE; } +void +kaaDrawFini (ScreenPtr pScreen) +{ + KaaScreenPriv(pScreen); + + xfree (pKaaScr); +} diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c index 3c9158d9f..a2807e899 100644 --- a/hw/kdrive/src/kasync.c +++ b/hw/kdrive/src/kasync.c @@ -305,11 +305,3 @@ const GCOps kdAsyncPixmapGCOps = { ,NULL #endif }; - -void -KdAssertSync (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - assert (!card->needSync); -} diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c index d3cb7f20a..855dc6f02 100644 --- a/hw/kdrive/src/kcmap.c +++ b/hw/kdrive/src/kcmap.c @@ -130,7 +130,7 @@ KdDisableColormap (ScreenPtr pScreen) } } -int +static int KdColormapFb (ColormapPtr pCmap) { ScreenPtr pScreen = pCmap->pScreen; diff --git a/hw/kdrive/src/kcurscol.c b/hw/kdrive/src/kcurscol.c index 8afd6442b..50edf1735 100644 --- a/hw/kdrive/src/kcurscol.c +++ b/hw/kdrive/src/kcurscol.c @@ -28,7 +28,7 @@ #include "kdrive.h" #include "cursorstr.h" -int +static int KdComputeCmapShift (unsigned long mask) { int shift; diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index a3ed0e764..a6065f6f4 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -225,7 +225,7 @@ KdDisableScreen (ScreenPtr pScreen) (*pScreenPriv->card->cfuncs->disable) (pScreen); } -void +static void KdDoSwitchCmd (char *reason) { if (kdSwitchCmd) @@ -382,7 +382,7 @@ ddxGiveUp () Bool kdDumbDriver; Bool kdSoftCursor; -char * +static char * KdParseFindNext (char *cur, char *delim, char *save, char *last) { while (*cur && !strchr (delim, *cur)) @@ -833,6 +833,22 @@ KdAllocatePrivates (ScreenPtr pScreen) } Bool +KdCreateScreenResources (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdCardInfo *card = pScreenPriv->card; + Bool ret; + + pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources; + ret = (*pScreen->CreateScreenResources) (pScreen); + pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = KdCreateScreenResources; + if (ret && card->cfuncs->createRes) + ret = (*card->cfuncs->createRes) (pScreen); + return ret; +} + +Bool KdCloseScreen (int index, ScreenPtr pScreen) { KdScreenPriv(pScreen); @@ -844,7 +860,7 @@ KdCloseScreen (int index, ScreenPtr pScreen) pScreen->CloseScreen = pScreenPriv->CloseScreen; ret = (*pScreen->CloseScreen) (index, pScreen); - if (screen->off_screen_size > 0) + if (screen->off_screen_base < screen->memory_size) KdOffscreenFini (pScreen); if (pScreenPriv->dpmsState != KD_DPMS_NORMAL) @@ -930,7 +946,7 @@ KdSaveScreen (ScreenPtr pScreen, int on) return TRUE; } -Bool +static Bool KdCreateWindow (WindowPtr pWin) { #ifndef PHOENIX @@ -1015,11 +1031,32 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) KdCardInfo *card = screen->card; KdPrivScreenPtr pScreenPriv; int fb; + /* + * note that screen->fb is set up for the nominal orientation + * of the screen; that means if randr is rotated, the values + * there should reflect a rotated frame buffer (or shadow). + */ + Bool rotated = (screen->randr & (RR_Rotate_90|RR_Rotate_270)) != 0; + int width, height, *width_mmp, *height_mmp; KdAllocatePrivates (pScreen); pScreenPriv = KdGetScreenPriv(pScreen); + if (!rotated) + { + width = screen->width; + height = screen->height; + width_mmp = &screen->width_mm; + height_mmp = &screen->height_mm; + } + else + { + width = screen->height; + height = screen->width; + width_mmp = &screen->height_mm; + height_mmp = &screen->width_mm; + } screen->pScreen = pScreen; pScreenPriv->screen = screen; pScreenPriv->card = card; @@ -1039,7 +1076,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) */ if (!fbSetupScreen (pScreen, screen->fb[0].frameBuffer, - screen->width, screen->height, + width, height, monitorResolution, monitorResolution, screen->fb[0].pixelStride, screen->fb[0].bitsPerPixel)) @@ -1072,7 +1109,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if (!fbOverlayFinishScreenInit (pScreen, screen->fb[0].frameBuffer, screen->fb[1].frameBuffer, - screen->width, screen->height, + width, height, monitorResolution, monitorResolution, screen->fb[0].pixelStride, screen->fb[1].pixelStride, @@ -1089,7 +1126,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) { if (!fbFinishScreenInit (pScreen, screen->fb[0].frameBuffer, - screen->width, screen->height, + width, height, monitorResolution, monitorResolution, screen->fb[0].pixelStride, screen->fb[0].bitsPerPixel)) @@ -1102,14 +1139,14 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) * Fix screen sizes; for some reason mi takes dpi instead of mm. * Rounding errors are annoying */ - if (screen->width_mm) - pScreen->mmWidth = screen->width_mm; + if (*width_mmp) + pScreen->mmWidth = *width_mmp; else - screen->width_mm = pScreen->mmWidth; - if (screen->height_mm) - pScreen->mmHeight = screen->height_mm; + *width_mmp = pScreen->mmWidth; + if (*height_mmp) + pScreen->mmHeight = *height_mmp; else - screen->height_mm = pScreen->mmHeight; + *height_mmp = pScreen->mmHeight; /* * Plug in our own block/wakeup handlers. @@ -1130,7 +1167,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if (!(*card->cfuncs->initAccel) (pScreen)) screen->dumb = TRUE; - if (screen->off_screen_size > 0) + if (screen->off_screen_base < screen->memory_size) KdOffscreenInit (pScreen); #ifdef PSEUDO8 @@ -1163,6 +1200,9 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) */ pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = KdCloseScreen; + + pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = KdCreateScreenResources; if (screen->softCursor || !card->cfuncs->initCursor || @@ -1222,7 +1262,7 @@ KdInitScreen (ScreenInfo *pScreenInfo, screen->softCursor = TRUE; } -Bool +static Bool KdSetPixmapFormats (ScreenInfo *pScreenInfo) { CARD8 depthToBpp[33]; /* depth -> bpp map */ @@ -1287,7 +1327,7 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo) return TRUE; } -void +static void KdAddScreen (ScreenInfo *pScreenInfo, KdScreenInfo *screen, int argc, diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 6cc976913..8969e6f83 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -93,6 +93,7 @@ typedef struct _KdFrameBuffer { int bitsPerPixel; int pixelStride; int byteStride; + Bool shadow; unsigned long visuals; Pixel redMask, greenMask, blueMask; void *closure; @@ -119,8 +120,8 @@ typedef struct _KdScreenInfo { DDXPointRec origin; KdFrameBuffer fb[KD_MAX_FB]; CARD8 *memory_base; - int off_screen_base; - int off_screen_size; + unsigned long memory_size; + unsigned long off_screen_base; struct _RealOffscreenArea *off_screen_areas; } KdScreenInfo; @@ -128,6 +129,8 @@ typedef struct _KdCardFuncs { Bool (*cardinit) (KdCardInfo *); /* detect and map device */ Bool (*scrinit) (KdScreenInfo *);/* initialize screen information */ Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */ + Bool (*finishInitScreen) (ScreenPtr pScreen); + Bool (*createRes) (ScreenPtr); /* create screen resources */ void (*preserve) (KdCardInfo *); /* save graphics card state */ Bool (*enable) (ScreenPtr); /* set up for rendering */ Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */ @@ -151,7 +154,6 @@ typedef struct _KdCardFuncs { void (*getColors) (ScreenPtr, int, int, xColorItem *); void (*putColors) (ScreenPtr, int, int, xColorItem *); - Bool (*finishInitScreen) (ScreenPtr pScreen); } KdCardFuncs; #define KD_MAX_PSEUDO_DEPTH 8 @@ -170,6 +172,7 @@ typedef struct { ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */ xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */ + CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; #ifdef FB_OLD_SCREEN miBSFuncRec BackingStoreFuncs; @@ -216,6 +219,7 @@ extern KdMouseInfo *kdMouseInfo; extern int KdCurScreen; KdMouseInfo *KdMouseInfoAdd (void); +void KdMouseInfoDispose (KdMouseInfo *mi); void KdParseMouse (char *); typedef struct _KdMouseFuncs { @@ -352,6 +356,9 @@ kaaDrawInit (ScreenPtr pScreen, KaaScreenInfoPtr pScreenInfo); void +kaaDrawFini (ScreenPtr pScreen); + +void kaaWrapGC (GCPtr pGC); void @@ -565,6 +572,9 @@ Bool KdAllocatePrivates (ScreenPtr pScreen); Bool +KdCreateScreenResources (ScreenPtr pScreen); + +Bool KdCloseScreen (int index, ScreenPtr pScreen); Bool @@ -689,7 +699,7 @@ void KdEnableInput (void); void -ProcessInputEvents (); +ProcessInputEvents (void); extern KdMouseFuncs LinuxMouseFuncs; extern KdMouseFuncs Ps2MouseFuncs; @@ -771,13 +781,16 @@ KdCheckComposite (CARD8 op, /* kshadow.c */ Bool -KdShadowScreenInit (KdScreenInfo *screen); +KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate); -Bool -KdShadowInitScreen (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); +void +KdShadowFbFree (KdScreenInfo *screen, int fb); +Bool +KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window); + void -KdShadowScreenFini (KdScreenInfo *screen); +KdShadowUnset (ScreenPtr pScreen); /* ktest.c */ Bool diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 5ac032c0e..016e35ddc 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -92,7 +92,7 @@ KdInputFd kdInputFds[KD_MAX_INPUT_FDS]; int kdNumInputFds; int kdInputTypeSequence; -void +static void KdSigio (int sig) { int i; @@ -101,7 +101,7 @@ KdSigio (int sig) (*kdInputFds[i].read) (kdInputFds[i].fd, kdInputFds[i].closure); } -void +static void KdBlockSigio (void) { sigset_t set; @@ -111,7 +111,7 @@ KdBlockSigio (void) sigprocmask (SIG_BLOCK, &set, 0); } -void +static void KdUnblockSigio (void) { sigset_t set; @@ -158,7 +158,7 @@ KdNonBlockFd (int fd) fcntl (fd, F_SETFL, flags); } -void +static void KdAddFd (int fd) { struct sigaction act; @@ -179,7 +179,7 @@ KdAddFd (int fd) sigprocmask (SIG_SETMASK, &set, 0); } -void +static void KdRemoveFd (int fd) { struct sigaction act; @@ -915,7 +915,7 @@ KdInputTransition kdInputMachine[num_input_states][num_input_class] = { #define EventX(e) ((e)->u.keyButtonPointer.rootX) #define EventY(e) ((e)->u.keyButtonPointer.rootY) -int +static int KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev) { if (ev->u.keyButtonPointer.pad1) @@ -932,7 +932,7 @@ KdInsideEmulationWindow (KdMouseInfo *mi, xEvent *ev) abs (mi->emulationDy) < EMULATION_WINDOW); } -KdInputClass +static KdInputClass KdClassifyInput (KdMouseInfo *mi, xEvent *ev) { switch (ev->u.u.type) { @@ -1083,7 +1083,7 @@ KdResetInputMachine (void) } } -void +static void KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev) { if (mi->emulateMiddleButton) @@ -1092,7 +1092,7 @@ KdHandleMouseEvent (KdMouseInfo *mi, xEvent *ev) KdQueueEvent (ev); } -void +static void KdReceiveTimeout (KdMouseInfo *mi) { KdRunMouseMachine (mi, timeout, 0); @@ -1122,7 +1122,7 @@ extern char dispatchException; extern int nClients; -void +static void KdCheckSpecialKeys(xEvent *xE) { KeySym sym = KEYCOL1(xE->u.u.detail); @@ -1195,7 +1195,7 @@ KdCheckSpecialKeys(xEvent *xE) * */ -void +static void KdHandleKeyboardEvent (xEvent *ev) { int key = ev->u.u.detail; @@ -1236,7 +1236,7 @@ KdReleaseAllKeys (void) KdUnblockSigio (); } -void +static void KdCheckLock (void) { KeyClassPtr keyc = pKdKeyboard->key; diff --git a/hw/kdrive/src/knoop.c b/hw/kdrive/src/knoop.c index d791d819d..26d7642f9 100644 --- a/hw/kdrive/src/knoop.c +++ b/hw/kdrive/src/knoop.c @@ -255,14 +255,14 @@ typedef void (* typePushPixels)( #endif ); -RegionPtr +static RegionPtr KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { return NullRegion; } -RegionPtr +static RegionPtr KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c index a8476ab6f..09dfc3de3 100644 --- a/hw/kdrive/src/koffscreen.c +++ b/hw/kdrive/src/koffscreen.c @@ -21,7 +21,6 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $Header$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -61,7 +60,7 @@ KdOffscreenValidate (ScreenPtr pScreen) prev = area; } - assert (prev->area.offset + prev->area.size == pScreenPriv->screen->off_screen_size); + assert (prev->area.offset + prev->area.size == pScreenPriv->screen->memory_size); } #else #define KdOffscreenValidate(s) @@ -97,7 +96,7 @@ KdOffscreenAlloc (ScreenPtr pScreen, int size, int align, } /* throw out requests that cannot fit */ - if (size > pScreenPriv->screen->off_screen_size) + if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base)) { DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size)); return NULL; @@ -280,7 +279,7 @@ KdOffscreenInit (ScreenPtr pScreen) area->area.screen = NULL; area->area.offset = pScreenPriv->screen->off_screen_base; - area->area.size = pScreenPriv->screen->off_screen_size; + area->area.size = pScreenPriv->screen->memory_size - area->area.offset; area->save = 0; area->locked = FALSE; area->next = NULL; diff --git a/hw/kdrive/src/kshadow.c b/hw/kdrive/src/kshadow.c index 9642bab30..f4b593f26 100644 --- a/hw/kdrive/src/kshadow.c +++ b/hw/kdrive/src/kshadow.c @@ -28,29 +28,59 @@ #include "kdrive.h" Bool -KdShadowScreenInit (KdScreenInfo *screen) +KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate) { + int paddedWidth; void *buf; + int width = rotate ? screen->height : screen->width; + int height = rotate ? screen->width : screen->height; + int bpp = screen->fb[fb].bitsPerPixel; - buf = shadowAlloc (screen->width, screen->height, screen->fb[0].bitsPerPixel); + /* use fb computation for width */ + paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits); + buf = xalloc (paddedWidth * height); if (!buf) return FALSE; - screen->fb[0].frameBuffer = buf; - screen->fb[0].byteStride = BitmapBytePad (screen->width * screen->fb[0].bitsPerPixel); - screen->fb[0].pixelStride = screen->fb[0].byteStride * 8 / screen->fb[0].bitsPerPixel; - screen->dumb = TRUE; + if (screen->fb[fb].shadow) + xfree (screen->fb[fb].frameBuffer); + screen->fb[fb].shadow = TRUE; + screen->fb[fb].frameBuffer = buf; + screen->fb[fb].byteStride = paddedWidth; + screen->fb[fb].pixelStride = paddedWidth * 8 / bpp; return TRUE; } +void +KdShadowFbFree (KdScreenInfo *screen, int fb) +{ + if (screen->fb[fb].shadow) + { + xfree (screen->fb[fb].frameBuffer); + screen->fb[fb].frameBuffer = 0; + screen->fb[fb].shadow = FALSE; + } +} + Bool -KdShadowInitScreen (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window) +KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window) { - return shadowInit (pScreen, update, window); + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + int fb; + + for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++) + { + if (screen->fb[fb].shadow) + return shadowSet (pScreen, (*pScreen->GetScreenPixmap) (pScreen), + update, window, randr, 0); + else + shadowUnset (pScreen); + } + return TRUE; } void -KdShadowScreenFini (KdScreenInfo *screen) +KdShadowUnset (ScreenPtr pScreen) { - if (screen->fb[0].frameBuffer) - xfree (screen->fb[0].frameBuffer); + shadowUnset (pScreen); } diff --git a/hw/kdrive/src/vga.c b/hw/kdrive/src/vga.c index 23372424c..7975d5c5c 100644 --- a/hw/kdrive/src/vga.c +++ b/hw/kdrive/src/vga.c @@ -210,7 +210,7 @@ VgaInvalidate (VgaCard *card) } -void +static void _VgaSync (VgaCard *card, VGA16 id) { if (!(card->values[id].flags & VGA_VALUE_VALID)) diff --git a/hw/kdrive/src/vga.h b/hw/kdrive/src/vga.h index 2123257d5..5d7e77307 100644 --- a/hw/kdrive/src/vga.h +++ b/hw/kdrive/src/vga.h @@ -126,6 +126,12 @@ VgaInvalidate (VgaCard *card); void VgaRestore (VgaCard *card); +void +VgaFinish (VgaCard *card); + +void +VgaFlushReg (VgaCard *card, VgaReg *reg); + VGA8 VgaFetch (VgaCard *card, VGA16 id); diff --git a/hw/kdrive/vesa/Makefile.am b/hw/kdrive/vesa/Makefile.am index 1c639a2e2..b0aeba0bb 100644 --- a/hw/kdrive/vesa/Makefile.am +++ b/hw/kdrive/vesa/Makefile.am @@ -1,12 +1,6 @@ INCLUDES = \ - -I$(top_srcdir)/fb \ - -I$(top_srcdir)/hw/kdrive/src \ - -I$(top_srcdir)/mi \ - -I$(top_srcdir)/miext/layer \ - -I$(top_srcdir)/miext/shadow \ - -I$(top_srcdir)/randr \ - -I$(top_srcdir)/render \ - $(XSERVER_CFLAGS) + @KDRIVE_INCS@ \ + @XSERVER_CFLAGS@ noinst_LIBRARIES = libvesa.a @@ -23,20 +17,9 @@ Xvesa_SOURCES = \ Xvesa_LDADD = \ libvesa.a \ - $(top_builddir)/dix/libdix.a \ - $(top_builddir)/os/libos.a \ - $(top_builddir)/miext/layer/liblayer.a \ - $(top_builddir)/hw/kdrive/src/libkdrive.a \ - $(top_builddir)/hw/kdrive/linux/liblinux.a \ - $(top_builddir)/miext/shadow/libshadow.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/fb/libfb.a \ - $(top_builddir)/mi/libmi.a \ - $(top_builddir)/Xext/libXext.a \ - $(top_builddir)/randr/librandr.a \ - $(top_builddir)/render/librender.a \ - $(top_builddir)/xfixes/libxfixes.a \ - $(top_builddir)/dix/libxpstubs.a \ - $(XSERVER_LIBS) + @KDRIVE_LIBS@ \ + @XSERVER_LIBS@ + +Xvesa_DEPENDENCIES = \ + libvesa.a \ + @KDRIVE_LIBS@ diff --git a/hw/kdrive/vesa/vesa.c b/hw/kdrive/vesa/vesa.c index 8786d2562..9576bca04 100644 --- a/hw/kdrive/vesa/vesa.c +++ b/hw/kdrive/vesa/vesa.c @@ -463,8 +463,6 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr) pscr->randr = screen->randr; pscr->shadow = vesa_shadow; pscr->origDepth = screen->fb[0].depth; - pscr->layerKind = LAYER_FB; - /* * Compute visual support for the selected depth */ @@ -683,7 +681,7 @@ void vesaUpdateMono (ScreenPtr pScreen, shadowBufPtr pBuf) { - RegionPtr damage = &pBuf->damage; + RegionPtr damage = shadowDamage(pBuf); PixmapPtr pShadow = pBuf->pPixmap; int nbox = REGION_NUM_RECTS (damage); BoxPtr pbox = REGION_RECTS (damage); @@ -791,30 +789,13 @@ vesaCreateColormap16 (ColormapPtr pmap) } void -vesaConfigureScreen (ScreenPtr pScreen) +vesaSetScreenSizes (ScreenPtr pScreen) { KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; - VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; - - KdMouseMatrix m; + VesaScreenPrivPtr pscr = screen->driver; - if (pscr->mapping == VESA_PLANAR || pscr->mapping == VESA_MONO) - { - pscr->shadow = TRUE; - pscr->randr = RR_Rotate_0; - } - else if (pscr->mapping == VESA_WINDOWED) - pscr->shadow = TRUE; - else if (pscr->randr != RR_Rotate_0) - pscr->shadow = TRUE; - else - pscr->shadow = vesa_shadow; - - KdComputeMouseMatrix (&m, pscr->randr, - pscr->mode.XResolution, pscr->mode.YResolution); - - if (m.matrix[0][0]) + if (pscr->randr & (RR_Rotate_0|RR_Rotate_180)) { pScreen->width = pscr->mode.XResolution; pScreen->height = pscr->mode.YResolution; @@ -828,67 +809,45 @@ vesaConfigureScreen (ScreenPtr pScreen) pScreen->mmWidth = screen->height_mm; pScreen->mmHeight = screen->width_mm; } - KdSetMouseMatrix (&m); } -LayerPtr -vesaLayerCreate (ScreenPtr pScreen) +Bool +vesaSetShadow (ScreenPtr pScreen) { KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; ShadowUpdateProc update; ShadowWindowProc window = 0; - PixmapPtr pPixmap; - int kind; - if (pscr->shadow) - { - if (pscr->randr != RR_Rotate_0) - update = shadowUpdateRotatePacked; + if (pscr->randr != RR_Rotate_0) + update = shadowUpdateRotatePacked; + else + update = shadowUpdatePacked; + switch (pscr->mapping) { + case VESA_LINEAR: + window = vesaWindowLinear; + break; + case VESA_WINDOWED: + window = vesaWindowWindowed; + break; + case VESA_PLANAR: + pScreen->CreateColormap = vesaCreateColormap16; + if (pScreenPriv->screen->fb[0].bitsPerPixel == 8) + update = shadowUpdatePlanar4x8; + else + update = shadowUpdatePlanar4; + window = vesaWindowPlanar; + break; + case VESA_MONO: + update = vesaUpdateMono; + if (pscr->mode.mode < 8) + window = vesaWindowCga; else - update = shadowUpdatePacked; - switch (pscr->mapping) { - case VESA_LINEAR: window = vesaWindowLinear; - break; - case VESA_WINDOWED: - window = vesaWindowWindowed; - break; - case VESA_PLANAR: - pScreen->CreateColormap = vesaCreateColormap16; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 8) - update = shadowUpdatePlanar4x8; - else - update = shadowUpdatePlanar4; - window = vesaWindowPlanar; - break; - case VESA_MONO: - update = vesaUpdateMono; - if (pscr->mode.mode < 8) - window = vesaWindowCga; - else - window = vesaWindowLinear; - break; - } - - kind = LAYER_SHADOW; - pPixmap = 0; - } - else - { - kind = pscr->layerKind; - pPixmap = LAYER_SCREEN_PIXMAP; - update = 0; - window = 0; + break; } - - if (vesa_verbose) - ErrorF ("Mode selected %dx%dx%d\n", - pScreen->width, pScreen->height, screen->fb[0].depth); - - return LayerCreate (pScreen, kind, screen->fb[0].depth, - pPixmap, update, window, pscr->randr, 0); + + return KdShadowSet (pScreen, pscr->randr, update, window); } Bool @@ -898,11 +857,18 @@ vesaMapFramebuffer (KdScreenInfo *screen) VesaScreenPrivPtr pscr = screen->driver; int depth, bpp, fbbpp; Pixel allbits; + KdMouseMatrix m; if (vesa_linear_fb) + { pscr->mapping = VESA_LINEAR; + pscr->shadow = FALSE; + } else + { pscr->mapping = VESA_WINDOWED; + pscr->shadow = TRUE; + } depth = vesaDepth (&pscr->mode); bpp = pscr->mode.BitsPerPixel; @@ -963,9 +929,10 @@ vesaMapFramebuffer (KdScreenInfo *screen) bpp, depth); } pscr->randr = RR_Rotate_0; + pscr->shadow = TRUE; break; default: - return 0; + return FALSE; } switch (fbbpp) { @@ -978,15 +945,17 @@ vesaMapFramebuffer (KdScreenInfo *screen) break; } - screen->width = pscr->mode.XResolution; - screen->height = pscr->mode.YResolution; - screen->fb[0].depth = depth; - screen->fb[0].bitsPerPixel = bpp; - screen->fb[0].byteStride = pscr->mode.BytesPerScanLine; - screen->fb[0].pixelStride = ((pscr->mode.BytesPerScanLine * 8) / fbbpp); + if (pscr->randr != RR_Rotate_0) + pscr->shadow = TRUE; + + if (vesa_shadow) + pscr->shadow = vesa_shadow; if (pscr->mapping == VESA_LINEAR && !(pscr->mode.ModeAttributes & MODE_LINEAR)) + { pscr->mapping = VESA_WINDOWED; + pscr->shadow = TRUE; + } screen->softCursor = TRUE; @@ -1013,7 +982,35 @@ vesaMapFramebuffer (KdScreenInfo *screen) pscr->fb = NULL; break; } - screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb); + + KdComputeMouseMatrix (&m, pscr->randr, + pscr->mode.XResolution, pscr->mode.YResolution); + + KdSetMouseMatrix (&m); + + screen->width = pscr->mode.XResolution; + screen->height = pscr->mode.YResolution; + screen->memory_base = pscr->fb; + screen->memory_size = pscr->fb_size; + screen->fb[0].depth = depth; + screen->fb[0].bitsPerPixel = bpp; + + if (pscr->shadow) + { + if (!KdShadowFbAlloc (screen, 0, + pscr->randr & (RR_Rotate_90|RR_Rotate_270))) + return FALSE; + screen->off_screen_base = screen->memory_size; + } + else + { + screen->fb[0].frameBuffer = (CARD8 *) (pscr->fb); + screen->fb[0].byteStride = pscr->mode.BytesPerScanLine; + screen->fb[0].pixelStride = ((pscr->mode.BytesPerScanLine * 8) / + screen->fb[0].bitsPerPixel); + screen->off_screen_base = screen->fb[0].byteStride * screen->height; + } + return TRUE; } @@ -1023,6 +1020,7 @@ vesaUnmapFramebuffer (KdScreenInfo *screen) VesaCardPrivPtr priv = screen->card->driver; VesaScreenPrivPtr pscr = screen->driver; + KdShadowFbFree (screen, 0); if (pscr->fb) { if (pscr->mode.vbe) @@ -1108,29 +1106,6 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) return TRUE; } -int -vesaLayerAdd (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - if (!LayerWindowAdd (pScreen, pLayer, pWin)) - return WT_STOPWALKING; - - return WT_WALKCHILDREN; -} - -int -vesaLayerRemove (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - LayerWindowRemove (pScreen, pLayer, pWin); - - return WT_WALKCHILDREN; -} - Bool vesaRandRSetConfig (ScreenPtr pScreen, Rotation randr, @@ -1150,7 +1125,6 @@ vesaRandRSetConfig (ScreenPtr pScreen, int oldheight; int oldmmwidth; int oldmmheight; - LayerPtr pNewLayer; int newwidth, newheight; if (screen->randr & (RR_Rotate_0|RR_Rotate_180)) @@ -1225,54 +1199,29 @@ vesaRandRSetConfig (ScreenPtr pScreen, break; } + KdOffscreenSwapOut (screen->pScreen); + vesaUnmapFramebuffer (screen); + if (!vesaMapFramebuffer (screen)) goto bail3; -#if 0 - /* - * XXX can't switch depths yet - */ - screen->fb[0].depth = depth; - screen->fb[0].bitsPerPixel = bpp; -#endif - screen->fb[0].byteStride = mode->BytesPerScanLine; - screen->fb[0].pixelStride = ((mode->BytesPerScanLine * 8) / screen->fb[0].bitsPerPixel); + vesaSetScreenSizes (screen->pScreen); + + if (!vesaSetShadow (screen->pScreen)) + goto bail4; - /* - * Compute screen geometry - */ - vesaConfigureScreen (pScreen); - /* * Set frame buffer mapping */ - if (!pscr->shadow) - { - (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), - pScreen->width, - pScreen->height, - screen->fb[0].depth, - screen->fb[0].bitsPerPixel, - screen->fb[0].byteStride, - screen->fb[0].frameBuffer); - } - - /* - * Create the layer - */ - pNewLayer = vesaLayerCreate (pScreen); - if (!pNewLayer) - goto bail4; + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); - if (WalkTree (pScreen, vesaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING) - goto bail5; - - WalkTree (pScreen, vesaLayerRemove, (pointer) pscr->pLayer); - LayerDestroy (pScreen, pscr->pLayer); - - pscr->pLayer = pNewLayer; - /* set the subpixel order */ KdSetSubpixelOrder (pScreen, pscr->randr); @@ -1281,9 +1230,6 @@ vesaRandRSetConfig (ScreenPtr pScreen, return TRUE; -bail5: - WalkTree (pScreen, vesaLayerRemove, (pointer) pNewLayer); - LayerDestroy (pScreen, pNewLayer); bail4: vesaUnmapFramebuffer (screen); *pscr = oldscr; @@ -1298,22 +1244,7 @@ bail3: bail2: *pscr = oldscr; - /* - * Set frame buffer mapping - */ - if (!pscr->shadow) - { - (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), - pScreen->width, - pScreen->height, - screen->fb[0].depth, - screen->fb[0].bitsPerPixel, - screen->fb[0].byteStride, - screen->fb[0].frameBuffer); - } - (void) vesaSetMode (pScreen, &pscr->mode); - bail1: if (wasEnabled) KdEnableScreen (pScreen); @@ -1340,27 +1271,13 @@ vesaRandRInit (ScreenPtr pScreen) Bool vesaInitScreen(ScreenPtr pScreen) { - if (!LayerStartInit (pScreen)) - return FALSE; - return TRUE; } Bool vesaFinishInitScreen (ScreenPtr pScreen) { - KdScreenPriv(pScreen); - VesaScreenPrivPtr pscr = pScreenPriv->screen->driver; - - pscr->layerKind = LayerNewKind (pScreen); - - if (!LayerFinishInit (pScreen)) - return FALSE; - - vesaConfigureScreen (pScreen); - - pscr->pLayer = vesaLayerCreate (pScreen); - if (!pscr->pLayer) + if (!shadowSetup (pScreen)) return FALSE; #ifdef RANDR @@ -1372,6 +1289,12 @@ vesaFinishInitScreen (ScreenPtr pScreen) } Bool +vesaCreateResources (ScreenPtr pScreen) +{ + return vesaSetShadow (pScreen); +} + +Bool vesaSetMode (ScreenPtr pScreen, VesaModePtr mode) { @@ -1668,6 +1591,7 @@ vesaScreenFini(KdScreenInfo *screen) { VesaScreenPrivPtr pscr = screen->driver; + KdShadowFbFree (screen, 0); vesaUnmapFramebuffer (screen); screen->fb[0].depth = pscr->origDepth; } diff --git a/hw/kdrive/vesa/vesa.h b/hw/kdrive/vesa/vesa.h index 30222d41b..4cad3ac2a 100644 --- a/hw/kdrive/vesa/vesa.h +++ b/hw/kdrive/vesa/vesa.h @@ -25,7 +25,7 @@ THE SOFTWARE. #define _VESA_H_ #include "kdrive.h" -#include "layer.h" +#include "shadow.h" #include "vm86.h" #ifdef RANDR #include "randrstr.h" @@ -98,17 +98,92 @@ typedef struct _VesaScreenPriv { Rotation randr; int mapping; int origDepth; - int layerKind; void *fb; int fb_size; CARD32 fb_phys; - LayerPtr pLayer; + PixmapPtr pShadow; } VesaScreenPrivRec, *VesaScreenPrivPtr; extern int vesa_video_mode; extern Bool vesa_force_mode; void +vesaReportMode (VesaModePtr mode); + +VesaModePtr +vesaGetModes (Vm86InfoPtr vi, int *ret_nmode); + +void +vesaTestMode (void); + +void * +vesaSetWindowPlanar(ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +void * +vesaSetWindowLinear (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +void * +vesaSetWindowWindowed (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +void * +vesaWindowPlanar (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure); + +void * +vesaWindowLinear (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure); + +void * +vesaWindowWindowed (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure); + +void * +vesaWindowCga (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure); + +void +vesaUpdateMono (ScreenPtr pScreen, + shadowBufPtr pBuf); + +Bool +vesaCreateColormap16 (ColormapPtr pmap); + +void +vesaSetScreenSizes (ScreenPtr pScreen); + +Bool +vesaSetShadow (ScreenPtr pScreen); + + +void vesaListModes(void); Bool @@ -145,12 +220,15 @@ vesaScreenInitialize (KdScreenInfo *screen, VesaScreenPrivPtr pscr); Bool vesaScreenInit(KdScreenInfo *screen); -LayerPtr -vesaLayerCreate (ScreenPtr pScreen); +PixmapPtr +vesaGetPixmap (ScreenPtr pScreen); Bool vesaMapFramebuffer (KdScreenInfo *screen); +void +vesaUnmapFramebuffer (KdScreenInfo *screen); + Bool vesaInitScreen(ScreenPtr pScreen); @@ -158,6 +236,9 @@ Bool vesaFinishInitScreen(ScreenPtr pScreen); Bool +vesaCreateResources (ScreenPtr pScreen); + +Bool vesaSetMode (ScreenPtr pScreen, VesaModePtr mode); @@ -182,6 +263,12 @@ vesaCardFini(KdCardInfo *card); void vesaScreenFini(KdScreenInfo *screen); +int +vesaSetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries); + +int +vesaGetPalette(VesaCardPrivPtr priv, int first, int number, U8 *entries); + void vesaPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs); @@ -193,10 +280,19 @@ vesaProcessArgument (int argc, char **argv, int i); #ifdef RANDR Bool +vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations); + +Bool vesaRandRSetConfig (ScreenPtr pScreen, Rotation randr, int rate, RRScreenSizePtr pSize); +Bool +vesaRandRInit (ScreenPtr pScreen); + #endif +Bool +toshibaDPMS (ScreenPtr pScreen, int mode); + #endif /* _VESA_H_ */ diff --git a/hw/kdrive/vesa/vesainit.c b/hw/kdrive/vesa/vesainit.c index 3e9463db9..45092add0 100644 --- a/hw/kdrive/vesa/vesainit.c +++ b/hw/kdrive/vesa/vesainit.c @@ -30,6 +30,8 @@ const KdCardFuncs vesaFuncs = { vesaCardInit, /* cardinit */ vesaScreenInit, /* scrinit */ vesaInitScreen, /* initScreen */ + vesaFinishInitScreen, /* finishInitScreen */ + vesaCreateResources, /* createRes */ vesaPreserve, /* preserve */ vesaEnable, /* enable */ vesaDPMS, /* dpms */ @@ -52,8 +54,6 @@ const KdCardFuncs vesaFuncs = { vesaGetColors, /* getColors */ vesaPutColors, /* putColors */ - - vesaFinishInitScreen, /* finishInitScreen */ }; void |