xserver/hw/kdrive/vesa vesa.c,1.31,1.32 vesa.h,1.18,1.19
Keith Packard
xserver-commit at pdx.freedesktop.org
Wed May 19 19:42:22 PDT 2004
Committed by: keithp
Update of /cvs/xserver/xserver/hw/kdrive/vesa
In directory pdx:/tmp/cvs-serv14268/hw/kdrive/vesa
Modified Files:
vesa.c vesa.h
Log Message:
2004-05-19 Keith Packard <keithp at keithp.com>
* hw/kdrive/src/kaa.c: (kaaPixmapUseScreen), (kaaPixmapUseMemory),
(kaaCreatePixmap):
Pin header-only pixmaps in memory.
* hw/kdrive/src/kdrive.h:
* hw/kdrive/src/koffscreen.c: (KdOffscreenKickOut),
(KdOffscreenAlloc), (KdOffscreenSwapOut), (KdOffscreenFree):
Off-screen reallocation could have used a stale pointer.
* hw/kdrive/vesa/vesa.c: (vesaScreenInitialize),
(vesaComputeFramebufferMapping), (vesaMapFramebuffer),
(vesaUnmapFramebuffer), (vesaRandRSetConfig), (vesaEnable):
* hw/kdrive/vesa/vesa.h:
Separate framebuffer mapping computation from actual
frame buffer mapping. Now map the frame buffer from
vesaEnable so that VT switch shares the same
mapping code. This makes sure any shadow framebuffer
is allocated again.
Index: vesa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vesa.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- a/vesa.c 13 May 2004 21:15:06 -0000 1.31
+++ b/vesa.c 20 May 2004 02:42:20 -0000 1.32
@@ -48,6 +48,12 @@
#define vesaHeight(scr,vmib) ((vmib)->YResolution)
static Bool
+vesaComputeFramebufferMapping (KdScreenInfo *screen);
+
+static Bool
+vesaMapFramebuffer (KdScreenInfo *screen);
+
+static Bool
vesaModeSupportable (VesaModePtr mode, Bool complain)
{
if((mode->ModeAttributes & 0x10) == 0) {
@@ -507,7 +513,11 @@
}
screen->rate = 72;
- return vesaMapFramebuffer (screen);
+ if (!vesaComputeFramebufferMapping (screen))
+ return FALSE;
+ if (!vesaMapFramebuffer (screen))
+ return FALSE;
+ return TRUE;
}
Bool
@@ -850,10 +860,9 @@
return KdShadowSet (pScreen, pscr->randr, update, window);
}
-Bool
-vesaMapFramebuffer (KdScreenInfo *screen)
+static Bool
+vesaComputeFramebufferMapping (KdScreenInfo *screen)
{
- VesaCardPrivPtr priv = screen->card->driver;
VesaScreenPrivPtr pscr = screen->driver;
int depth, bpp, fbbpp;
Pixel allbits;
@@ -956,7 +965,27 @@
pscr->mapping = VESA_WINDOWED;
pscr->shadow = TRUE;
}
+ KdComputeMouseMatrix (&m, pscr->randr,
+ pscr->mode.XResolution, pscr->mode.YResolution);
+
+ KdSetMouseMatrix (&m);
+
+ screen->width = pscr->mode.XResolution;
+ screen->height = pscr->mode.YResolution;
+ screen->fb[0].depth = depth;
+ screen->fb[0].bitsPerPixel = bpp;
+ return TRUE;
+}
+
+static Bool
+vesaMapFramebuffer (KdScreenInfo *screen)
+{
+ VesaCardPrivPtr priv = screen->card->driver;
+ VesaScreenPrivPtr pscr = screen->driver;
+
+ if (pscr->mapped)
+ return TRUE;
switch (pscr->mapping) {
case VESA_MONO:
case VESA_LINEAR:
@@ -981,17 +1010,8 @@
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].depth = depth;
- screen->fb[0].bitsPerPixel = bpp;
if (pscr->shadow)
{
@@ -1008,16 +1028,21 @@
screen->fb[0].bitsPerPixel);
screen->off_screen_base = screen->fb[0].byteStride * screen->height;
}
+ pscr->mapped = TRUE;
return TRUE;
}
-void
+static void
vesaUnmapFramebuffer (KdScreenInfo *screen)
{
VesaCardPrivPtr priv = screen->card->driver;
VesaScreenPrivPtr pscr = screen->driver;
+ if (!pscr->mapped)
+ return;
+
+ pscr->mapped = FALSE;
KdShadowFbFree (screen, 0);
if (pscr->fb)
{
@@ -1201,6 +1226,9 @@
vesaUnmapFramebuffer (screen);
+ if (!vesaComputeFramebufferMapping (screen))
+ goto bail3;
+
if (!vesaMapFramebuffer (screen))
goto bail3;
@@ -1231,6 +1259,7 @@
bail4:
vesaUnmapFramebuffer (screen);
*pscr = oldscr;
+ (void) vesaComputeFramebufferMapping (screen);
(void) vesaMapFramebuffer (screen);
bail3:
@@ -1332,6 +1361,10 @@
int i;
CARD32 size;
char *p;
+ Bool was_mapped = pscr->mapped;
+
+ if (!vesaMapFramebuffer (screen))
+ return FALSE;
if (!vesaSetMode (pScreen, &pscr->mode))
return FALSE;
@@ -1340,39 +1373,6 @@
case VESA_MONO:
VgaSetWritePlaneMask (priv->vi, 0x1);
case VESA_LINEAR:
- /*
- * Remap the frame buffer if necessary
- */
- if (!pscr->fb)
- {
- if (pscr->mode.vbe)
- pscr->fb = VbeMapFramebuffer(priv->vi, priv->vbeInfo,
- pscr->mode.mode,
- &pscr->fb_size,
- &pscr->fb_phys);
- else
- pscr->fb = VgaMapFramebuffer (priv->vi,
- pscr->mode.mode,
- &pscr->fb_size,
- &pscr->fb_phys);
- if (!pscr->fb)
- return FALSE;
- screen->fb[0].frameBuffer = (CARD8 *)(pscr->fb);
- screen->memory_base = pscr->fb;
- /*
- * 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);
- }
- }
if (vesa_restore_font)
memcpy (priv->text, pscr->fb, VESA_TEXT_SAVE);
break;
@@ -1405,6 +1405,16 @@
}
break;
}
+ if (!was_mapped)
+ {
+ (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
+ pScreen->width,
+ pScreen->height,
+ screen->fb[0].depth,
+ screen->fb[0].bitsPerPixel,
+ screen->fb[0].byteStride,
+ screen->fb[0].frameBuffer);
+ }
return TRUE;
}
Index: vesa.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vesa.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- a/vesa.h 18 Nov 2003 04:53:16 -0000 1.18
+++ b/vesa.h 20 May 2004 02:42:20 -0000 1.19
@@ -102,6 +102,7 @@
int fb_size;
CARD32 fb_phys;
PixmapPtr pShadow;
+ Bool mapped;
} VesaScreenPrivRec, *VesaScreenPrivPtr;
extern int vesa_video_mode;
@@ -224,12 +225,6 @@
vesaGetPixmap (ScreenPtr pScreen);
Bool
-vesaMapFramebuffer (KdScreenInfo *screen);
-
-void
-vesaUnmapFramebuffer (KdScreenInfo *screen);
-
-Bool
vesaInitScreen(ScreenPtr pScreen);
Bool
More information about the xserver-commit
mailing list