summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2003-10-14 05:07:39 +0000
committerKeith Packard <keithp@keithp.com>2003-10-14 05:07:39 +0000
commit4b844cafb2516139c8407822b61939cd6c743742 (patch)
tree0e1232bbf30f353aeec8567288f89b02f2aee582 /hw/kdrive
parentcdf3377f6d3789628495ac64df80ac7dc235e46d (diff)
Check for off-screen pixmap support in KaaDrawableIsOffscreenPixmap. -Wall
fixes. Allocate pixmap private space only for screens with off-screen pixmap support
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/src/kaa.c26
-rw-r--r--hw/kdrive/src/kasync.c1
-rw-r--r--hw/kdrive/src/kcmap.c3
-rw-r--r--hw/kdrive/src/kdrive.c8
-rw-r--r--hw/kdrive/src/kdrive.h8
-rw-r--r--hw/kdrive/src/kinput.c5
-rw-r--r--hw/kdrive/src/kmap.c4
-rw-r--r--hw/kdrive/src/kmode.c4
-rw-r--r--hw/kdrive/src/koffscreen.c3
-rw-r--r--hw/kdrive/src/kpict.c4
-rw-r--r--hw/kdrive/src/kshadow.c2
-rw-r--r--hw/kdrive/src/kxv.c21
-rw-r--r--hw/kdrive/src/vga.c4
13 files changed, 37 insertions, 56 deletions
diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c
index 514cd224c..62314c87c 100644
--- a/hw/kdrive/src/kaa.c
+++ b/hw/kdrive/src/kaa.c
@@ -65,6 +65,7 @@ typedef struct {
#define KaaPixmapPitch(w) (((w) + (pKaaScr->info->offscreenPitch - 1)) & ~(pKaaScr->info->offscreenPitch - 1))
#define KaaDrawableIsOffscreenPixmap(d) (d->type == DRAWABLE_PIXMAP && \
+ KaaGetPixmapPriv ((PixmapPtr)(d)) != NULL && \
KaaGetPixmapPriv ((PixmapPtr)(d))->offscreenArea != NULL && \
!KaaGetPixmapPriv ((PixmapPtr)(d))->offscreenArea->swappedOut)
@@ -372,11 +373,6 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable,
KdScreenPriv (pDstDrawable->pScreen);
KaaScreenPriv (pDstDrawable->pScreen);
PixmapPtr pSrcPixmap, pDstPixmap;
- int srcX, srcY, dstX, dstY;
- int w, h;
- CARD32 flags;
- CARD32 cmd;
- CARD8 alu;
if (pScreenPriv->enabled &&
(pSrcPixmap = kaaGetDrawingPixmap (pSrcDrawable, NULL, NULL)) &&
@@ -401,8 +397,6 @@ kaaCopyNtoN (DrawablePtr pSrcDrawable,
}
else
{
- KdScreenPriv (pDstDrawable->pScreen);
-
KdCheckSync (pDstDrawable->pScreen);
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
pbox, nbox, dx, dy, reverse, upsidedown,
@@ -531,7 +525,6 @@ kaaSolidBoxClipped (DrawablePtr pDrawable,
BoxPtr pbox;
int nbox;
int partX1, partX2, partY1, partY2;
- CARD32 cmd;
if (!pScreenPriv->enabled ||
!(pPixmap = kaaGetDrawingPixmap (pDrawable, NULL, NULL)) ||
@@ -585,7 +578,6 @@ kaaImageGlyphBlt (DrawablePtr pDrawable,
CharInfoPtr *ppciInit,
pointer pglyphBase)
{
- KaaScreenPriv (pDrawable->pScreen);
FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
CharInfoPtr *ppci;
CharInfoPtr pci;
@@ -737,8 +729,6 @@ static const GCOps kaaOps = {
void
kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable)
{
- FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC);
-
fbValidateGC (pGC, changes, pDrawable);
if (pDrawable->type == DRAWABLE_WINDOW ||
@@ -773,8 +763,6 @@ kaaCreateGC (GCPtr pGC)
void
kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- KaaScreenPriv (pScreen);
RegionRec rgnDst;
int dx, dy;
WindowPtr pwinRoot;
@@ -831,7 +819,6 @@ kaaFillRegionSolid (DrawablePtr pDrawable,
void
kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
{
- PixmapPtr pTile;
if (!REGION_NUM_RECTS(pRegion))
return;
@@ -877,9 +864,6 @@ kaaDrawInit (ScreenPtr pScreen,
kaaGeneration = serverGeneration;
}
- if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, sizeof(KaaPixmapPrivRec)))
- return FALSE;
-
pKaaScr = xalloc (sizeof (KaaScreenPrivRec));
if (!pKaaScr)
@@ -908,11 +892,19 @@ kaaDrawInit (ScreenPtr pScreen,
if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) &&
screen->off_screen_size > 0)
{
+ if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, sizeof(KaaPixmapPrivRec)))
+ return FALSE;
+
pKaaScr->CreatePixmap = pScreen->CreatePixmap;
pScreen->CreatePixmap = kaaCreatePixmap;
pKaaScr->DestroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = kaaDestroyPixmap;
}
+ else
+ {
+ if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0))
+ return FALSE;
+ }
return TRUE;
}
diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c
index b58b3fb57..560e7243e 100644
--- a/hw/kdrive/src/kasync.c
+++ b/hw/kdrive/src/kasync.c
@@ -262,7 +262,6 @@ KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnS
void
KdScreenInitAsync (ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
pScreen->GetImage = KdCheckGetImage;
pScreen->GetSpans = KdCheckGetSpans;
pScreen->PaintWindowBackground = KdCheckPaintWindow;
diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c
index 515df73a2..d3cb7f20a 100644
--- a/hw/kdrive/src/kcmap.c
+++ b/hw/kdrive/src/kcmap.c
@@ -138,8 +138,7 @@ KdColormapFb (ColormapPtr pCmap)
KdScreenInfo *screen = pScreenPriv->screen;
int d;
DepthPtr depth;
- int v, vi;
- VisualPtr visual;
+ int v;
VisualID vid = pCmap->pVisual->vid;
int fb;
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 02e6e1d1b..cead4302d 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -77,8 +77,8 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
WindowPtr pWin = WindowTable[pScreen->myNum];
WindowPtr pChild;
Bool WasViewable;
- Bool anyMarked;
- RegionPtr pOldClip, bsExposed;
+ Bool anyMarked = FALSE;
+ RegionPtr pOldClip = 0, bsExposed;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@@ -323,9 +323,6 @@ KdResume (void)
void
KdEnableScreens (void)
{
- KdCardInfo *card;
- KdScreenInfo *screen;
-
if (!kdEnabled)
{
kdEnabled = TRUE;
@@ -425,7 +422,6 @@ void
KdParseScreen (KdScreenInfo *screen,
char *arg)
{
- char *bpp;
char delim;
char save[1024];
int fb;
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index a5702803a..8b51f12cd 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -218,7 +218,7 @@ KdMouseInfo *KdMouseInfoAdd (void);
void KdParseMouse (char *);
typedef struct _KdMouseFuncs {
- int (*Init) (void);
+ Bool (*Init) (void);
void (*Fini) (void);
} KdMouseFuncs;
@@ -553,6 +553,12 @@ void
KdParseMouse (char *arg);
void
+KdParseRgba (char *rgba);
+
+int
+KdProcessArgument (int argc, char **argv, int i);
+
+void
KdOsInit (KdOsFuncs *pOsFuncs);
Bool
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 645c05ea3..5ac032c0e 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -42,8 +42,6 @@ static DeviceIntPtr pKdKeyboard, pKdPointer;
static KdMouseFuncs *kdMouseFuncs;
static KdKeyboardFuncs *kdKeyboardFuncs;
-static unsigned long kdEmulationTimeout;
-static Bool kdTimeoutPending;
static int kdBellPitch;
static int kdBellDuration;
static int kdLeds;
@@ -163,7 +161,6 @@ KdNonBlockFd (int fd)
void
KdAddFd (int fd)
{
- int flags;
struct sigaction act;
sigset_t set;
@@ -303,7 +300,6 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff)
BYTE map[KD_MAX_BUTTON];
DevicePtr pDev = (DevicePtr)pDevice;
int i;
- KdMouseInfo *mi;
if (!pDev)
return BadImplementation;
@@ -1263,7 +1259,6 @@ KdEnqueueKeyboardEvent(unsigned char scan_code,
{
unsigned char key_code;
xEvent xE;
- int e;
KeyClassPtr keyc;
if (!pKdKeyboard)
diff --git a/hw/kdrive/src/kmap.c b/hw/kdrive/src/kmap.c
index 676282393..bd506996b 100644
--- a/hw/kdrive/src/kmap.c
+++ b/hw/kdrive/src/kmap.c
@@ -108,7 +108,7 @@ KdSetMappedMode (CARD32 addr, CARD32 size, int mode)
#ifdef HAVE_ASM_MTRR_H
struct mtrr_sentry sentry;
unsigned long base, bound;
- unsigned int type;
+ unsigned int type = MTRR_TYPE_WRBACK;
if (addr < 0x100000)
return;
@@ -147,7 +147,7 @@ KdResetMappedMode (CARD32 addr, CARD32 size, int mode)
#ifdef HAVE_ASM_MTRR_H
struct mtrr_sentry sentry;
unsigned long base, bound;
- unsigned int type;
+ unsigned int type = MTRR_TYPE_WRBACK;
if (addr < 0x100000)
return;
diff --git a/hw/kdrive/src/kmode.c b/hw/kdrive/src/kmode.c
index 989f1e582..e1e82dce7 100644
--- a/hw/kdrive/src/kmode.c
+++ b/hw/kdrive/src/kmode.c
@@ -299,7 +299,7 @@ KdTuneMode (KdScreenInfo *screen,
Bool (*supported) (KdScreenInfo *,
const KdMonitorTiming *))
{
- const KdMonitorTiming *t, *new;
+ const KdMonitorTiming *t;
while (!(*usable) (screen))
{
@@ -369,8 +369,6 @@ KdRandRGetTiming (ScreenPtr pScreen,
int rate,
RRScreenSizePtr pSize)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen = pScreenPriv->screen;
int i;
const KdMonitorTiming *t;
diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c
index a407fc4ee..62df0fcd6 100644
--- a/hw/kdrive/src/koffscreen.c
+++ b/hw/kdrive/src/koffscreen.c
@@ -52,6 +52,9 @@ KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
int tmp, real_size;
+ if (!align)
+ align = 1;
+
/* Go through the areas */
area = pScreenPriv->screen->off_screen_areas;
while (area != NULL)
diff --git a/hw/kdrive/src/kpict.c b/hw/kdrive/src/kpict.c
index 643a91a29..25fb449a0 100644
--- a/hw/kdrive/src/kpict.c
+++ b/hw/kdrive/src/kpict.c
@@ -26,7 +26,9 @@
#include <config.h>
#endif
#include "kdrive.h"
-#include "picturestr.h"
+#include <picturestr.h>
+#include <mipict.h>
+#include <fbpict.h>
void
KdCheckComposite (CARD8 op,
diff --git a/hw/kdrive/src/kshadow.c b/hw/kdrive/src/kshadow.c
index f75fb43cb..9642bab30 100644
--- a/hw/kdrive/src/kshadow.c
+++ b/hw/kdrive/src/kshadow.c
@@ -45,8 +45,6 @@ KdShadowScreenInit (KdScreenInfo *screen)
Bool
KdShadowInitScreen (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window)
{
- KdScreenPriv(pScreen);
-
return shadowInit (pScreen, update, window);
}
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index aea8ef8ad..6699197e3 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -188,7 +188,6 @@ KdXVScreenInit(
KdVideoAdaptorPtr *adaptors,
int num
){
- KdScreenPriv(pScreen);
KdXVScreenPtr ScreenPriv;
XvScreenPtr pxvs;
@@ -669,7 +668,6 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
RegionRec WinRegion;
RegionRec ClipRegion;
BoxRec WinBox;
- ScreenPtr pScreen = portPriv->pDraw->pScreen;
int ret = Success;
Bool clippedAway = FALSE;
@@ -682,18 +680,18 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
/* clip to the window composite clip */
- REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
- REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+ REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1);
+ REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1);
+ REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
/* that's all if it's totally obscured */
- if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
+ if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) {
clippedAway = TRUE;
goto CLIP_VIDEO_BAILOUT;
}
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
- REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion);
+ REGION_SUBTRACT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, &ClipRegion);
}
ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen,
@@ -718,8 +716,8 @@ CLIP_VIDEO_BAILOUT:
if(!portPriv->FreeCompositeClip)
portPriv->pCompositeClip = NULL;
- REGION_UNINIT(pScreen, &WinRegion);
- REGION_UNINIT(pScreen, &ClipRegion);
+ REGION_UNINIT(portPriv->pDraw->pScreen, &WinRegion);
+ REGION_UNINIT(portPriv->pDraw->pScreen, &ClipRegion);
return ret;
}
@@ -1149,8 +1147,6 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
static Bool
KdXVCloseScreen(int i, ScreenPtr pScreen)
{
- KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
XvAdaptorPtr pa;
@@ -1203,8 +1199,6 @@ KdXVRunning (ScreenPtr pScreen)
Bool
KdXVEnable(ScreenPtr pScreen)
{
- KdXVScreenPtr ScreenPriv;
-
if (!KdXVRunning (pScreen))
return TRUE;
@@ -1635,7 +1629,6 @@ KdXVPutImage(
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
ScreenPtr pScreen = pDraw->pScreen;
KdScreenPriv(pScreen);
- KdScreenInfo *screen=pScreenPriv->screen;
RegionRec WinRegion;
RegionRec ClipRegion;
BoxRec WinBox;
diff --git a/hw/kdrive/src/vga.c b/hw/kdrive/src/vga.c
index 06b5d92b8..23372424c 100644
--- a/hw/kdrive/src/vga.c
+++ b/hw/kdrive/src/vga.c
@@ -93,7 +93,7 @@ VGA8
VgaFetch (VgaCard *card, VGA16 reg)
{
VgaMap map;
- VGA8 value;
+ VGA8 value = 0;
(*card->map) (card, reg, &map, VGAFALSE);
switch (map.access) {
@@ -235,7 +235,7 @@ VgaSet (VgaCard *card, VgaReg *reg, VGA32 value)
mask <<= reg->base;
new <<= reg->base;
v = card->values[reg->id].cur;
- v = v & ~mask | new;
+ v = (v & ~mask) | new;
card->values[reg->id].cur = v;
card->values[reg->id].flags |= VGA_VALUE_MODIFIED|VGA_VALUE_DIRTY;
}