Check for off-screen pixmap support in KaaDrawableIsOffscreenPixmap. -Wall

fixes. Allocate pixmap private space only for screens with off-screen
    pixmap support
This commit is contained in:
Keith Packard 2003-10-14 05:07:39 +00:00
parent cdf3377f6d
commit 4b844cafb2
13 changed files with 37 additions and 56 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -218,7 +218,7 @@ KdMouseInfo *KdMouseInfoAdd (void);
void KdParseMouse (char *);
typedef struct _KdMouseFuncs {
int (*Init) (void);
Bool (*Init) (void);
void (*Fini) (void);
} KdMouseFuncs;
@ -552,6 +552,12 @@ KdSaveString (char *str);
void
KdParseMouse (char *arg);
void
KdParseRgba (char *rgba);
int
KdProcessArgument (int argc, char **argv, int i);
void
KdOsInit (KdOsFuncs *pOsFuncs);

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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,

View File

@ -45,8 +45,6 @@ KdShadowScreenInit (KdScreenInfo *screen)
Bool
KdShadowInitScreen (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window)
{
KdScreenPriv(pScreen);
return shadowInit (pScreen, update, window);
}

View File

@ -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;

View File

@ -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;
}