Commit 5378236a authored by Keith Packard's avatar Keith Packard

merge xfixes_2_branch back to HEAD

parent 9e94665c
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@
......@@ -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)
{
......
......@@ -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_ */
......@@ -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 */
};
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
......@@ -87,7 +87,7 @@ static int acquiredScreen = -1;
*/
static Bool
GARTInit()
GARTInit(void)
{
static Bool initDone = FALSE;
struct _agp_info agpinf;
......
......@@ -35,7 +35,7 @@
/* /dev/adbmouse is a busmouse */
void
static void