summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2003-10-24 09:34:33 +0000
committerKeith Packard <keithp@keithp.com>2003-10-24 09:34:33 +0000
commitfaa7c94689f3613cab95a94345fa742c25b01ef4 (patch)
tree758a7c22383cb143f082959878c8d593223c0adf /hw/kdrive
parentd5b176b2d4ebe55f977e6224eadd86221149ae81 (diff)
Add function called at CreateScreenResources to get shadow set up on pixmap
correctly. Rework vesa and fbdev code to handle shadows right with the non-layer world. Use GetScreenPixmap directly for damage detection of sprite. Avoids problems during server shutdown with windows disappearing before the sprite layer is closed.
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/fbdev/fbdev.c291
-rw-r--r--hw/kdrive/fbdev/fbdev.h9
-rw-r--r--hw/kdrive/fbdev/fbinit.c4
-rw-r--r--hw/kdrive/mach64/mach64.c7
-rw-r--r--hw/kdrive/mga/Makefile.am9
-rw-r--r--hw/kdrive/mga/mga.c10
-rw-r--r--hw/kdrive/nvidia/Makefile.am5
-rw-r--r--hw/kdrive/nvidia/nvidia.c4
-rw-r--r--hw/kdrive/r128/Makefile.am5
-rw-r--r--hw/kdrive/r128/r128.c4
-rw-r--r--hw/kdrive/r128/r128draw.c12
-rw-r--r--hw/kdrive/smi/Makefile.am5
-rw-r--r--hw/kdrive/smi/smi.c4
-rw-r--r--hw/kdrive/smi/smi.h6
-rw-r--r--hw/kdrive/src/kdrive.c59
-rw-r--r--hw/kdrive/src/kdrive.h19
-rw-r--r--hw/kdrive/src/kshadow.c51
-rw-r--r--hw/kdrive/vesa/vesa.c255
-rw-r--r--hw/kdrive/vesa/vesa.h3
-rw-r--r--hw/kdrive/vesa/vesainit.c4
20 files changed, 349 insertions, 417 deletions
diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c
index 63db395d7..4e33155ee 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;
@@ -191,33 +185,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
screen->rate = 72;
scrpriv->randr = screen->randr;
-#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
@@ -255,177 +223,93 @@ 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)
+ if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180))
{
- scrpriv->randr = RR_Rotate_0;
- scrpriv->shadow = TRUE;
- }
- else
-#endif /* FAKE24_ON_16 */
- {
- 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);
}
-PixmapPtr
-fbdevGetPixmap (ScreenPtr pScreen)
+Bool
+fbdevUnmapFramebuffer (KdScreenInfo *screen)
+{
+ KdShadowFbFree (screen, 0);
+}
+
+Bool
+fbdevSetShadow (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
FbdevScrPriv *scrpriv = screen->driver;
ShadowUpdateProc update;
ShadowWindowProc window;
- PixmapPtr pShadow, pPixmap;
- 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;
- }
- pPixmap = (*pScreen->CreatePixmap) (pScreen,
- pScreen->width,
- pScreen->height,
- screen->fb[0].depth);
- if (!pPixmap)
- return FALSE;
- shadowSet (pScreen, pPixmap, update, window, scrpriv->randr, 0);
- pShadow = pPixmap;
- }
+ window = fbdevWindowLinear;
+ update = 0;
+ if (scrpriv->randr)
+ update = shadowUpdateRotatePacked;
else
- {
- pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
- pShadow = 0;
- }
-
- if (scrpriv->pShadow)
- (*pScreen->DestroyPixmap) (scrpriv->pShadow);
- scrpriv->pShadow = pShadow;
-
- return pPixmap;
+ update = shadowUpdatePacked;
+ return KdShadowSet (pScreen, scrpriv->randr, update, window);
}
@@ -461,16 +345,6 @@ fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
return TRUE;
}
-int
-fbdevPixmapSet (WindowPtr pWin, pointer value)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pPixmap = value;
-
- (*pScreen->SetWindowPixmap) (pWin, pPixmap);
- return WT_WALKCHILDREN;
-}
-
Bool
fbdevRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
@@ -516,16 +390,30 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
scrpriv->randr = KdAddRotation (screen->randr, randr);
- fbdevConfigureScreen (pScreen);
+ KdOffscreenSwapOut (screen->pScreen);
- /*
- * Get the pixmap that windows live in
- */
- pPixmap = fbdevGetPixmap (pScreen);
- if (!pPixmap)
+ fbdevUnmapFramebuffer (screen);
+
+ if (!fbdevMapFramebuffer (screen))
goto bail4;
- WalkTree (pScreen, fbdevPixmapSet, (pointer) pPixmap);
+ if (!fbdevSetShadow (screen->pScreen))
+ goto bail4;
+
+ 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)
@@ -534,11 +422,14 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
return TRUE;
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;
@@ -601,18 +492,13 @@ fbdevInitScreen (ScreenPtr pScreen)
#endif
pScreen->CreateColormap = fbdevCreateColormap;
- return shadowSetup (pScreen);
+ return TRUE;
}
Bool
fbdevFinishInitScreen (ScreenPtr pScreen)
{
- PixmapPtr pPixmap;
-
- fbdevConfigureScreen (pScreen);
-
- pPixmap = fbdevGetPixmap (pScreen);
- if (!pPixmap)
+ if (!shadowSetup (pScreen))
return FALSE;
#ifdef RANDR
@@ -623,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 9daff7468..f7c6be5eb 100644
--- a/hw/kdrive/fbdev/fbdev.h
+++ b/hw/kdrive/fbdev/fbdev.h
@@ -69,6 +69,12 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv);
Bool
fbdevInitScreen (ScreenPtr pScreen);
+Bool
+fbdevFinishInitScreen (ScreenPtr pScreen);
+
+Bool
+fbdevCreateResources (ScreenPtr pScreen);
+
void
fbdevPreserve (KdCardInfo *card);
@@ -96,7 +102,4 @@ fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
void
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-Bool
-fbdevFinishInitScreen (ScreenPtr pScreen);
-
#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/mach64/mach64.c b/hw/kdrive/mach64/mach64.c
index a6f9c8dad..8e03ab8b0 100644
--- a/hw/kdrive/mach64/mach64.c
+++ b/hw/kdrive/mach64/mach64.c
@@ -133,6 +133,12 @@ mach64FinishInitScreen (ScreenPtr pScreen)
return ret;
}
+Bool
+mach64CreateResources (ScreenPtr pScreen)
+{
+ return vesaCreateResources (pScreen);
+}
+
CARD32
mach64ReadLCD (Reg *reg, int id)
{
@@ -403,6 +409,7 @@ KdCardFuncs mach64Funcs = {
mach64CardInit, /* cardinit */
mach64ScreenInit, /* scrinit */
mach64InitScreen, /* initScreen */
+ mach64CreateResources, /* createRes */
mach64Preserve, /* preserve */
mach64Enable, /* enable */
mach64DPMS, /* dpms */
diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am
index 1fd8a6bac..a1bcde938 100644
--- a/hw/kdrive/mga/Makefile.am
+++ b/hw/kdrive/mga/Makefile.am
@@ -1,5 +1,5 @@
INCLUDES = \
- @KDRIVE_INCS@ \
+ $(KDRIVE_INCS) \
-I$(top_srcdir)/hw/kdrive/vesa \
$(XSERVER_CFLAGS)
@@ -16,6 +16,7 @@ Xmga_SOURCES = \
mgastub.c
Xmga_LDADD = \
- libmga.a \
- $(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@
+ 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 106eaa6b9..145ba7fcf 100644
--- a/hw/kdrive/mga/mga.c
+++ b/hw/kdrive/mga/mga.c
@@ -94,6 +94,12 @@ mgaFinishInitScreen (ScreenPtr pScreen)
return ret;
}
+Bool
+mgaCreateResources (ScreenPtr pScreen)
+{
+ return vesaCreateResources (pScreen);
+}
+
void
mgaPreserve (KdCardInfo *card)
{
@@ -210,6 +216,8 @@ KdCardFuncs mgaFuncs = {
mgaCardInit, /* cardinit */
mgaScreenInit, /* scrinit */
mgaInitScreen, /* initScreen */
+ mgaFinishInitScreen, /* finishInitScreen */
+ mgaCreateResources, /* createRes */
mgaPreserve, /* preserve */
mgaEnable, /* enable */
mgaDPMS, /* dpms */
@@ -232,7 +240,5 @@ KdCardFuncs mgaFuncs = {
vesaGetColors, /* getColors */
vesaPutColors, /* putColors */
-
- mgaFinishInitScreen, /* finishInitScreen */
};
diff --git a/hw/kdrive/nvidia/Makefile.am b/hw/kdrive/nvidia/Makefile.am
index 109e42b30..deec489d5 100644
--- a/hw/kdrive/nvidia/Makefile.am
+++ b/hw/kdrive/nvidia/Makefile.am
@@ -1,5 +1,5 @@
INCLUDES = \
- @KDRIVE_INCS@ \
+ $(KDRIVE_INCS) \
-I$(top_srcdir)/hw/kdrive/vesa \
$(XSERVER_CFLAGS)
@@ -23,4 +23,5 @@ Xnvidia_SOURCES = \
Xnvidia_LDADD = \
libnvidia.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@
+ $(KDRIVE_LIBS) \
+ $(XSERVER_LIBS)
diff --git a/hw/kdrive/nvidia/nvidia.c b/hw/kdrive/nvidia/nvidia.c
index 75c67ec29..750426481 100644
--- a/hw/kdrive/nvidia/nvidia.c
+++ b/hw/kdrive/nvidia/nvidia.c
@@ -336,6 +336,8 @@ KdCardFuncs nvidiaFuncs = {
nvidiaCardInit, /* cardinit */
nvidiaScreenInit, /* scrinit */
nvidiaInitScreen, /* initScreen */
+ nvidiaFinishInitScreen, /* finishInitScreen */
+ vesaCreateResources, /* createRes */
nvidiaPreserve, /* preserve */
nvidiaEnable, /* enable */
nvidiaDPMS, /* dpms */
@@ -358,6 +360,4 @@ KdCardFuncs nvidiaFuncs = {
vesaGetColors, /* getColors */
vesaPutColors, /* putColors */
-
- nvidiaFinishInitScreen, /* finishInitScreen */
};
diff --git a/hw/kdrive/r128/Makefile.am b/hw/kdrive/r128/Makefile.am
index e9d5d6bd0..a5c45cf6f 100644
--- a/hw/kdrive/r128/Makefile.am
+++ b/hw/kdrive/r128/Makefile.am
@@ -1,5 +1,5 @@
INCLUDES = \
- @KDRIVE_INCS@ \
+ $(KDRIVE_INCS) \
-I$(top_srcdir)/hw/kdrive/vesa \
$(XSERVER_CFLAGS)
@@ -18,4 +18,5 @@ Xr128_SOURCES = \
Xr128_LDADD = \
libr128.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@
+ $(KDRIVE_LIBS) \
+ $(XSERVER_LIBS)
diff --git a/hw/kdrive/r128/r128.c b/hw/kdrive/r128/r128.c
index 10974cc7f..5dff93e03 100644
--- a/hw/kdrive/r128/r128.c
+++ b/hw/kdrive/r128/r128.c
@@ -228,6 +228,8 @@ KdCardFuncs r128Funcs = {
r128CardInit, /* cardinit */
r128ScreenInit, /* scrinit */
r128InitScreen, /* initScreen */
+ r128FinishInitScreen, /* finishInitScreen */
+ vesaCreateResources,/* createRes */
r128Preserve, /* preserve */
r128Enable, /* enable */
r128DPMS, /* dpms */
@@ -250,7 +252,5 @@ KdCardFuncs r128Funcs = {
vesaGetColors, /* getColors */
vesaPutColors, /* putColors */
-
- r128FinishInitScreen, /* finishInitScreen */
};
diff --git a/hw/kdrive/r128/r128draw.c b/hw/kdrive/r128/r128draw.c
index 7a8de7479..78447fc1c 100644
--- a/hw/kdrive/r128/r128draw.c
+++ b/hw/kdrive/r128/r128draw.c
@@ -130,12 +130,12 @@ r128Setup (ScreenPtr pScreen, int wait)
}
Bool
-r128PrepareSolid (DrawablePtr pDrawable, int alu, Pixel pm, Pixel fg)
+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
@@ -163,15 +163,15 @@ r128DoneSolid (void)
}
Bool
-r128PrepareCopy (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int dx, int dy, int alu, Pixel pm)
+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
diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am
index 5099ffeac..642160d7b 100644
--- a/hw/kdrive/smi/Makefile.am
+++ b/hw/kdrive/smi/Makefile.am
@@ -1,5 +1,5 @@
INCLUDES = \
- @KDRIVE_INCS@ \
+ $(KDRIVE_INCS) \
-I$(top_srcdir)/hw/kdrive/fbdev \
-I$(top_srcdir)/hw/kdrive/vesa \
$(XSERVER_CFLAGS)
@@ -21,4 +21,5 @@ Xsmi_LDADD = \
libsmi.a \
$(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a \
- @KDRIVE_LIBS@
+ $(KDRIVE_LIBS) \
+ $(XSERVER_LIBS)
diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c
index fc29b2228..d40009775 100644
--- a/hw/kdrive/smi/smi.c
+++ b/hw/kdrive/smi/smi.c
@@ -321,6 +321,8 @@ KdCardFuncs smiFuncs = {
smiCardInit, /* cardinit */
smiScreenInit, /* scrinit */
smiInitScreen, /* initScreen */
+ smiFinishInitScreen, /* finishInitScreen */
+ subCreateResources, /* createRes */
smiPreserve, /* preserve */
smiEnable, /* enable */
smiDPMS, /* dpms */
@@ -343,6 +345,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..481535fc4 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
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 3d79418cc..af6e96cbd 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -833,6 +833,23 @@ KdAllocatePrivates (ScreenPtr pScreen)
}
Bool
+KdCreateScreenResources (ScreenPtr pScreen)
+{
+ KdScreenPriv(pScreen);
+ KdScreenInfo *screen = pScreenPriv->screen;
+ 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);
@@ -1015,11 +1032,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 +1077,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 +1110,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 +1127,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 +1140,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.
@@ -1163,6 +1201,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 ||
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 12e1fa94f..e46a24e32 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;
@@ -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;
@@ -568,6 +571,9 @@ Bool
KdAllocatePrivates (ScreenPtr pScreen);
Bool
+KdCreateScreenResources (ScreenPtr pScreen);
+
+Bool
KdCloseScreen (int index, ScreenPtr pScreen);
Bool
@@ -774,13 +780,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/kshadow.c b/hw/kdrive/src/kshadow.c
index 9642bab30..c12971628 100644
--- a/hw/kdrive/src/kshadow.c
+++ b/hw/kdrive/src/kshadow.c
@@ -28,29 +28,58 @@
#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);
+ }
}
void
-KdShadowScreenFini (KdScreenInfo *screen)
+KdShadowUnset (ScreenPtr pScreen)
{
- if (screen->fb[0].frameBuffer)
- xfree (screen->fb[0].frameBuffer);
+ shadowUnset (pScreen);
}
diff --git a/hw/kdrive/vesa/vesa.c b/hw/kdrive/vesa/vesa.c
index 38bf609fd..7582fecb7 100644
--- a/hw/kdrive/vesa/vesa.c
+++ b/hw/kdrive/vesa/vesa.c
@@ -789,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;
@@ -826,78 +809,46 @@ vesaConfigureScreen (ScreenPtr pScreen)
pScreen->mmWidth = screen->height_mm;
pScreen->mmHeight = screen->width_mm;
}
- KdSetMouseMatrix (&m);
}
-PixmapPtr
-vesaGetPixmap (ScreenPtr pScreen)
+Bool
+vesaSetShadow (ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
VesaScreenPrivPtr pscr = pScreenPriv->screen->driver;
ShadowUpdateProc update;
ShadowWindowProc window = 0;
- PixmapPtr pShadow, pPixmap;
- 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;
- }
-
- pPixmap = (*pScreen->CreatePixmap) (pScreen,
- pScreen->width,
- pScreen->height,
- screen->fb[0].depth);
- if (!pPixmap)
- return NullPixmap;
- if (!shadowSet (pScreen, pPixmap, update,
- window, pscr->randr, 0))
- {
- (*pScreen->DestroyPixmap) (pPixmap);
- return NullPixmap;
- }
- pShadow = pPixmap;
- }
- else
- {
- pPixmap = (*pScreen->GetScreenPixmap) (pScreen);
- pShadow = 0;
- shadowUnset (pScreen);
+ break;
}
- if (pscr->pShadow)
- (*pScreen->DestroyPixmap) (pscr->pShadow);
- pscr->pShadow = pShadow;
-
- if (vesa_verbose)
- ErrorF ("Mode selected %dx%dx%d\n",
- pScreen->width, pScreen->height, screen->fb[0].depth);
- return pPixmap;
+ return KdShadowSet (pScreen, pscr->randr, update, window);
}
Bool
@@ -907,11 +858,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;
@@ -972,9 +930,10 @@ vesaMapFramebuffer (KdScreenInfo *screen)
bpp, depth);
}
pscr->randr = RR_Rotate_0;
+ pscr->shadow = TRUE;
break;
default:
- return 0;
+ return FALSE;
}
switch (fbbpp) {
@@ -987,15 +946,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;
@@ -1022,10 +983,34 @@ vesaMapFramebuffer (KdScreenInfo *screen)
pscr->fb = NULL;
break;
}
+
+ 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].frameBuffer = (CARD8 *)(pscr->fb);
- screen->off_screen_base = screen->fb[0].byteStride * screen->height;
+ 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->off_screen_base = screen->fb[0].byteStride * screen->height;
+ screen->fb[0].byteStride = pscr->mode.BytesPerScanLine;
+ screen->fb[0].pixelStride = ((pscr->mode.BytesPerScanLine * 8) /
+ screen->fb[0].bitsPerPixel);
+ }
return TRUE;
}
@@ -1036,6 +1021,7 @@ vesaUnmapFramebuffer (KdScreenInfo *screen)
VesaCardPrivPtr priv = screen->card->driver;
VesaScreenPrivPtr pscr = screen->driver;
+ KdShadowFbFree (screen, 0);
if (pscr->fb)
{
if (pscr->mode.vbe)
@@ -1121,17 +1107,6 @@ vesaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
return TRUE;
}
-int
-vesaPixmapSet (WindowPtr pWin, pointer value)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pPixmap = value;
-
- pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- (*pScreen->SetWindowPixmap) (pWin, pPixmap);
- return WT_WALKCHILDREN;
-}
-
Bool
vesaRandRSetConfig (ScreenPtr pScreen,
Rotation randr,
@@ -1229,46 +1204,25 @@ vesaRandRSetConfig (ScreenPtr pScreen,
KdOffscreenSwapOut (screen->pScreen);
vesaUnmapFramebuffer (screen);
+
if (!vesaMapFramebuffer (screen))
goto bail3;
-#if 0
- /*
- * XXX can't switch depths
- */
- 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);
- }
-
- /*
- * Get the pixmap that windows live in
- */
- pPixmap = vesaGetPixmap (pScreen);
- if (!pPixmap)
- goto bail4;
-
- WalkTree (pScreen, vesaPixmapSet, (pointer) pPixmap);
+ (*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, pscr->randr);
@@ -1292,22 +1246,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);
@@ -1334,23 +1273,17 @@ vesaRandRInit (ScreenPtr pScreen)
Bool
vesaInitScreen(ScreenPtr pScreen)
{
+ KdScreenPriv(pScreen);
+
return TRUE;
}
Bool
vesaFinishInitScreen (ScreenPtr pScreen)
{
- PixmapPtr pPixmap;
-
- vesaConfigureScreen (pScreen);
-
if (!shadowSetup (pScreen))
return FALSE;
- pPixmap = vesaGetPixmap (pScreen);
- if (!pPixmap)
- return FALSE;
-
#ifdef RANDR
if (!vesaRandRInit (pScreen))
return FALSE;
@@ -1360,6 +1293,12 @@ vesaFinishInitScreen (ScreenPtr pScreen)
}
Bool
+vesaCreateResources (ScreenPtr pScreen)
+{
+ return vesaSetShadow (pScreen);
+}
+
+Bool
vesaSetMode (ScreenPtr pScreen,
VesaModePtr mode)
{
@@ -1656,11 +1595,7 @@ vesaScreenFini(KdScreenInfo *screen)
{
VesaScreenPrivPtr pscr = screen->driver;
- if (pscr->pShadow)
- {
- (*screen->pScreen->DestroyPixmap) (pscr->pShadow);
- pscr->pShadow = 0;
- }
+ 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 f3897999d..1cce002a7 100644
--- a/hw/kdrive/vesa/vesa.h
+++ b/hw/kdrive/vesa/vesa.h
@@ -157,6 +157,9 @@ Bool
vesaFinishInitScreen(ScreenPtr pScreen);
Bool
+vesaCreateResources (ScreenPtr pScreen);
+
+Bool
vesaSetMode (ScreenPtr pScreen,
VesaModePtr mode);
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