KDrive: Delete rafts of unused code
Most of this stuff was gone with the last real hardware drivers that used it. Au revoir.
This commit is contained in:
parent
ad7a7ae290
commit
6c7c0ffeb7
|
@ -1,17 +0,0 @@
|
||||||
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $
|
|
||||||
|
|
||||||
#include <Server.tmpl>
|
|
||||||
|
|
||||||
#if BuildRender
|
|
||||||
RENDERINCS=-I$(KDRIVE)/../../render
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if BuildRandR
|
|
||||||
RANDRINCS=-I$(KDRIVE)/../../randr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
|
|
||||||
-I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \
|
|
||||||
-I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \
|
|
||||||
-I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \
|
|
||||||
-I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS)
|
|
|
@ -526,8 +526,6 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
|
||||||
|
|
||||||
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
||||||
|
|
||||||
KdOffscreenSwapOut (screen->pScreen);
|
|
||||||
|
|
||||||
ephyrUnmapFramebuffer (screen);
|
ephyrUnmapFramebuffer (screen);
|
||||||
|
|
||||||
screen->width = newwidth;
|
screen->width = newwidth;
|
||||||
|
|
|
@ -324,8 +324,6 @@ fakeRandRSetConfig (ScreenPtr pScreen,
|
||||||
|
|
||||||
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
||||||
|
|
||||||
KdOffscreenSwapOut (screen->pScreen);
|
|
||||||
|
|
||||||
fakeUnmapFramebuffer (screen);
|
fakeUnmapFramebuffer (screen);
|
||||||
|
|
||||||
if (!fakeMapFramebuffer (screen))
|
if (!fakeMapFramebuffer (screen))
|
||||||
|
|
|
@ -529,8 +529,6 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
|
||||||
|
|
||||||
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
scrpriv->randr = KdAddRotation (screen->randr, randr);
|
||||||
|
|
||||||
KdOffscreenSwapOut (screen->pScreen);
|
|
||||||
|
|
||||||
fbdevUnmapFramebuffer (screen);
|
fbdevUnmapFramebuffer (screen);
|
||||||
|
|
||||||
if (!fbdevMapFramebuffer (screen))
|
if (!fbdevMapFramebuffer (screen))
|
||||||
|
|
|
@ -29,10 +29,7 @@ libkdrive_a_SOURCES = \
|
||||||
kkeymap.c \
|
kkeymap.c \
|
||||||
kmap.c \
|
kmap.c \
|
||||||
kmode.c \
|
kmode.c \
|
||||||
knoop.c \
|
|
||||||
koffscreen.c \
|
|
||||||
kshadow.c \
|
kshadow.c \
|
||||||
ktest.c \
|
|
||||||
$(KDRIVE_XV_SOURCES) \
|
$(KDRIVE_XV_SOURCES) \
|
||||||
$(KDRIVE_HW_SOURCES) \
|
$(KDRIVE_HW_SOURCES) \
|
||||||
$(top_srcdir)/mi/miinitext.c
|
$(top_srcdir)/mi/miinitext.c
|
||||||
|
|
|
@ -208,7 +208,6 @@ KdDisableScreen (ScreenPtr pScreen)
|
||||||
if (!pScreenPriv->closed)
|
if (!pScreenPriv->closed)
|
||||||
KdSetRootClip (pScreen, FALSE);
|
KdSetRootClip (pScreen, FALSE);
|
||||||
KdDisableColormap (pScreen);
|
KdDisableColormap (pScreen);
|
||||||
KdOffscreenSwapOut (pScreen);
|
|
||||||
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
|
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
|
||||||
(*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
|
(*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
|
||||||
if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
|
if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
|
||||||
|
@ -285,7 +284,6 @@ KdEnableScreen (ScreenPtr pScreen)
|
||||||
pScreenPriv->enabled = TRUE;
|
pScreenPriv->enabled = TRUE;
|
||||||
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
|
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
|
||||||
pScreenPriv->card->selected = pScreenPriv->screen->mynum;
|
pScreenPriv->card->selected = pScreenPriv->screen->mynum;
|
||||||
KdOffscreenSwapIn (pScreen);
|
|
||||||
if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
|
if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
|
||||||
(*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
|
(*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
|
||||||
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
|
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
|
||||||
|
@ -796,9 +794,6 @@ KdCloseScreen (int index, ScreenPtr pScreen)
|
||||||
else
|
else
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
if (screen->off_screen_base < screen->memory_size)
|
|
||||||
KdOffscreenFini (pScreen);
|
|
||||||
|
|
||||||
if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
|
if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
|
||||||
(*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
|
(*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
|
||||||
|
|
||||||
|
@ -1097,9 +1092,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
if (!screen->dumb && card->cfuncs->initAccel)
|
if (!screen->dumb && card->cfuncs->initAccel)
|
||||||
if (!(*card->cfuncs->initAccel) (pScreen))
|
if (!(*card->cfuncs->initAccel) (pScreen))
|
||||||
screen->dumb = TRUE;
|
screen->dumb = TRUE;
|
||||||
|
|
||||||
if (screen->off_screen_base < screen->memory_size)
|
|
||||||
KdOffscreenInit (pScreen);
|
|
||||||
|
|
||||||
#ifdef PSEUDO8
|
#ifdef PSEUDO8
|
||||||
(void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
|
(void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
|
||||||
|
|
|
@ -114,30 +114,6 @@ typedef struct _KdFrameBuffer {
|
||||||
void *closure;
|
void *closure;
|
||||||
} KdFrameBuffer;
|
} KdFrameBuffer;
|
||||||
|
|
||||||
typedef struct _KdOffscreenArea KdOffscreenArea;
|
|
||||||
|
|
||||||
typedef void (*KdOffscreenSaveProc) (ScreenPtr pScreen, KdOffscreenArea *area);
|
|
||||||
|
|
||||||
typedef enum _KdOffscreenState {
|
|
||||||
KdOffscreenAvail,
|
|
||||||
KdOffscreenRemovable,
|
|
||||||
KdOffscreenLocked,
|
|
||||||
} KdOffscreenState;
|
|
||||||
|
|
||||||
struct _KdOffscreenArea {
|
|
||||||
int offset;
|
|
||||||
int save_offset;
|
|
||||||
int size;
|
|
||||||
int score;
|
|
||||||
pointer privData;
|
|
||||||
|
|
||||||
KdOffscreenSaveProc save;
|
|
||||||
|
|
||||||
KdOffscreenState state;
|
|
||||||
|
|
||||||
KdOffscreenArea *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
|
#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
|
||||||
#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
|
#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
|
||||||
|
|
||||||
|
@ -205,8 +181,6 @@ typedef struct {
|
||||||
int bytesPerPixel[KD_MAX_FB];
|
int bytesPerPixel[KD_MAX_FB];
|
||||||
|
|
||||||
int dpmsState;
|
int dpmsState;
|
||||||
|
|
||||||
KdOffscreenArea *off_screen_areas;
|
|
||||||
|
|
||||||
ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
|
ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
|
||||||
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
|
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
|
||||||
|
@ -401,90 +375,6 @@ typedef struct _KdPointerMatrix {
|
||||||
int matrix[2][3];
|
int matrix[2][3];
|
||||||
} KdPointerMatrix;
|
} KdPointerMatrix;
|
||||||
|
|
||||||
typedef struct _KaaTrapezoid {
|
|
||||||
float tl, tr, ty;
|
|
||||||
float bl, br, by;
|
|
||||||
} KaaTrapezoid;
|
|
||||||
|
|
||||||
typedef struct _KaaScreenInfo {
|
|
||||||
int offsetAlign;
|
|
||||||
int pitchAlign;
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
int (*markSync) (ScreenPtr pScreen);
|
|
||||||
void (*waitMarker) (ScreenPtr pScreen, int marker);
|
|
||||||
|
|
||||||
Bool (*PrepareSolid) (PixmapPtr pPixmap,
|
|
||||||
int alu,
|
|
||||||
Pixel planemask,
|
|
||||||
Pixel fg);
|
|
||||||
void (*Solid) (int x1, int y1, int x2, int y2);
|
|
||||||
void (*DoneSolid) (void);
|
|
||||||
|
|
||||||
Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
|
|
||||||
PixmapPtr pDstPixmap,
|
|
||||||
Bool upsidedown,
|
|
||||||
Bool reverse,
|
|
||||||
int alu,
|
|
||||||
Pixel planemask);
|
|
||||||
void (*Copy) (int srcX,
|
|
||||||
int srcY,
|
|
||||||
int dstX,
|
|
||||||
int dstY,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
void (*DoneCopy) (void);
|
|
||||||
|
|
||||||
Bool (*PrepareBlend) (int op,
|
|
||||||
PicturePtr pSrcPicture,
|
|
||||||
PicturePtr pDstPicture,
|
|
||||||
PixmapPtr pSrc,
|
|
||||||
PixmapPtr pDst);
|
|
||||||
void (*Blend) (int srcX,
|
|
||||||
int srcY,
|
|
||||||
int dstX,
|
|
||||||
int dstY,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
void (*DoneBlend) (void);
|
|
||||||
|
|
||||||
Bool (*CheckComposite) (int op,
|
|
||||||
PicturePtr pSrcPicture,
|
|
||||||
PicturePtr pMaskPicture,
|
|
||||||
PicturePtr pDstPicture);
|
|
||||||
Bool (*PrepareComposite) (int op,
|
|
||||||
PicturePtr pSrcPicture,
|
|
||||||
PicturePtr pMaskPicture,
|
|
||||||
PicturePtr pDstPicture,
|
|
||||||
PixmapPtr pSrc,
|
|
||||||
PixmapPtr pMask,
|
|
||||||
PixmapPtr pDst);
|
|
||||||
void (*Composite) (int srcX,
|
|
||||||
int srcY,
|
|
||||||
int maskX,
|
|
||||||
int maskY,
|
|
||||||
int dstX,
|
|
||||||
int dstY,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
void (*DoneComposite) (void);
|
|
||||||
|
|
||||||
Bool (*PrepareTrapezoids) (PicturePtr pDstPicture,
|
|
||||||
PixmapPtr pDst);
|
|
||||||
void (*Trapezoids) (KaaTrapezoid *traps,
|
|
||||||
int ntraps);
|
|
||||||
void (*DoneTrapezoids) (void);
|
|
||||||
|
|
||||||
Bool (*UploadToScreen) (PixmapPtr pDst,
|
|
||||||
char *src,
|
|
||||||
int src_pitch);
|
|
||||||
Bool (*UploadToScratch) (PixmapPtr pSrc,
|
|
||||||
PixmapPtr pDst);
|
|
||||||
} KaaScreenInfoRec, *KaaScreenInfoPtr;
|
|
||||||
|
|
||||||
#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
|
|
||||||
#define KAA_OFFSCREEN_ALIGN_POT (1 << 1)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the only completely portable way to
|
* This is the only completely portable way to
|
||||||
* compute this info.
|
* compute this info.
|
||||||
|
@ -821,36 +711,6 @@ KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindow
|
||||||
void
|
void
|
||||||
KdShadowUnset (ScreenPtr pScreen);
|
KdShadowUnset (ScreenPtr pScreen);
|
||||||
|
|
||||||
/* ktest.c */
|
|
||||||
Bool
|
|
||||||
KdFrameBufferValid (CARD8 *base, int size);
|
|
||||||
|
|
||||||
int
|
|
||||||
KdFrameBufferSize (CARD8 *base, int max);
|
|
||||||
|
|
||||||
/* koffscreen.c */
|
|
||||||
|
|
||||||
Bool
|
|
||||||
KdOffscreenInit (ScreenPtr pScreen);
|
|
||||||
|
|
||||||
KdOffscreenArea *
|
|
||||||
KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|
||||||
Bool locked,
|
|
||||||
KdOffscreenSaveProc save,
|
|
||||||
pointer privData);
|
|
||||||
|
|
||||||
KdOffscreenArea *
|
|
||||||
KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area);
|
|
||||||
|
|
||||||
void
|
|
||||||
KdOffscreenSwapOut (ScreenPtr pScreen);
|
|
||||||
|
|
||||||
void
|
|
||||||
KdOffscreenSwapIn (ScreenPtr pScreen);
|
|
||||||
|
|
||||||
void
|
|
||||||
KdOffscreenFini (ScreenPtr pScreen);
|
|
||||||
|
|
||||||
/* function prototypes to be implemented by the drivers */
|
/* function prototypes to be implemented by the drivers */
|
||||||
void
|
void
|
||||||
InitCard (char *name);
|
InitCard (char *name);
|
||||||
|
|
|
@ -1,199 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 1999 Keith Packard
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of Keith Packard not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Keith Packard makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <kdrive-config.h>
|
|
||||||
#endif
|
|
||||||
#include "kdrive.h"
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#define KM_BUF 1024
|
|
||||||
#define KM_EOF -1
|
|
||||||
|
|
||||||
typedef struct _km_file {
|
|
||||||
HANDLE handle;
|
|
||||||
char buf[KM_BUF];
|
|
||||||
char *bufptr;
|
|
||||||
DWORD remain;
|
|
||||||
} km_file;
|
|
||||||
|
|
||||||
int
|
|
||||||
km_fill (km_file *kf)
|
|
||||||
{
|
|
||||||
BOOL r;
|
|
||||||
|
|
||||||
NCD_DEBUG ((DEBUG_INIT, "km_fill"));
|
|
||||||
r = ReadFile (kf->handle, kf->buf, KM_BUF,
|
|
||||||
&kf->remain, NULL);
|
|
||||||
NCD_DEBUG ((DEBUG_INIT, "Got %d", kf->remain));
|
|
||||||
if (!r || !kf->remain)
|
|
||||||
return KM_EOF;
|
|
||||||
kf->bufptr = kf->buf;
|
|
||||||
--kf->remain;
|
|
||||||
return *kf->bufptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define km_getchar(kf) ((kf)->remain-- ? *kf->bufptr++ : km_fill (kf))
|
|
||||||
#else
|
|
||||||
#define km_getchar(kf) getc(kf)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
km_word (km_file *kf, char *buf, int len)
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
switch (c = km_getchar (kf)) {
|
|
||||||
case KM_EOF:
|
|
||||||
return FALSE;
|
|
||||||
case ' ':
|
|
||||||
case '\t':
|
|
||||||
case '\n':
|
|
||||||
case '\r':
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
len--;
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
*buf++ = c;
|
|
||||||
switch (c = km_getchar (kf)) {
|
|
||||||
case KM_EOF:
|
|
||||||
case ' ':
|
|
||||||
case '\t':
|
|
||||||
case '\n':
|
|
||||||
case '\r':
|
|
||||||
*buf++ = '\0';
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
km_int (km_file *kf, int *r)
|
|
||||||
{
|
|
||||||
char word[64];
|
|
||||||
|
|
||||||
if (km_word (kf, word, sizeof (word)))
|
|
||||||
{
|
|
||||||
*r = strtol (word, NULL, 0);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
WCHAR *winKbdExtensions[] = {
|
|
||||||
L".xku",
|
|
||||||
L".xkb"
|
|
||||||
};
|
|
||||||
|
|
||||||
#define NUM_KBD_EXTENSIONS (sizeof (winKbdExtensions) / sizeof (winKbdExtensions[0]))
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
winLoadKeymap (void)
|
|
||||||
{
|
|
||||||
WCHAR file[32 + KL_NAMELENGTH];
|
|
||||||
WCHAR name[KL_NAMELENGTH];
|
|
||||||
HKL layout;
|
|
||||||
km_file kf;
|
|
||||||
int width;
|
|
||||||
BOOL ret;
|
|
||||||
KeySym *m;
|
|
||||||
int scancode;
|
|
||||||
int w;
|
|
||||||
int e;
|
|
||||||
|
|
||||||
layout = GetKeyboardLayout (0);
|
|
||||||
/*
|
|
||||||
* Pre-build 46 versions of ThinSTAR software return 0
|
|
||||||
* for all layouts
|
|
||||||
*/
|
|
||||||
if (!layout)
|
|
||||||
return FALSE;
|
|
||||||
NCD_DEBUG ((DEBUG_INIT, "Keyboard layout 0x%x", layout));
|
|
||||||
for (e = 0; e < NUM_KBD_EXTENSIONS; e++)
|
|
||||||
{
|
|
||||||
wstrcpy (file, L"\\Storage Card\\");
|
|
||||||
wsprintf (name, TEXT("%08x"), layout);
|
|
||||||
wstrcat (file, name);
|
|
||||||
wstrcat (file, winKbdExtensions[e]);
|
|
||||||
NCD_DEBUG ((DEBUG_INIT, "Loading keymap from %S", file));
|
|
||||||
kf.handle = CreateFile (file,
|
|
||||||
GENERIC_READ,
|
|
||||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
|
||||||
NULL,
|
|
||||||
OPEN_EXISTING,
|
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
|
||||||
NULL);
|
|
||||||
if (kf.handle != INVALID_HANDLE_VALUE)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (kf.handle == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
NCD_DEBUG ((DEBUG_INIT, "No such file"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
ret = FALSE;
|
|
||||||
kf.remain = 0;
|
|
||||||
/*
|
|
||||||
* Keymap format:
|
|
||||||
*
|
|
||||||
* flags (optional)
|
|
||||||
* width
|
|
||||||
* keycode -> keysym array (num_keycodes * width)
|
|
||||||
*/
|
|
||||||
if (!km_int (&kf, &width))
|
|
||||||
goto bail1;
|
|
||||||
if (width & KEYMAP_FLAGS)
|
|
||||||
{
|
|
||||||
CEKeymapFlags = (unsigned long) width;
|
|
||||||
if (!km_int (&kf, &width))
|
|
||||||
goto bail1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
CEKeymapFlags = 0;
|
|
||||||
if (width > MAX_WIDTH)
|
|
||||||
goto bail1;
|
|
||||||
NCD_DEBUG ((DEBUG_INIT, "Keymap width %d flags 0x%x",
|
|
||||||
width, CEKeymapFlags));
|
|
||||||
m = CEKeymap;
|
|
||||||
for (scancode = MIN_SCANCODE; scancode <= MAX_SCANCODE; scancode++)
|
|
||||||
{
|
|
||||||
for (w = 0; w < width; w++)
|
|
||||||
{
|
|
||||||
if (!km_int (&kf, m))
|
|
||||||
break;
|
|
||||||
m++;
|
|
||||||
}
|
|
||||||
if (w != width)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CEKeySyms.mapWidth = width;
|
|
||||||
ret = TRUE;
|
|
||||||
bail1:
|
|
||||||
CloseHandle (kf.handle);
|
|
||||||
return ret;
|
|
||||||
}
|
|
|
@ -1,251 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 1999 Keith Packard
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of Keith Packard not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Keith Packard makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* GC ops that don't do anything
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <kdrive-config.h>
|
|
||||||
#endif
|
|
||||||
#include "kdrive.h"
|
|
||||||
#include <gcstruct.h>
|
|
||||||
|
|
||||||
typedef void (* typeFillSpans)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*nInit*/,
|
|
||||||
DDXPointPtr /*pptInit*/,
|
|
||||||
int * /*pwidthInit*/,
|
|
||||||
int /*fSorted*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typeSetSpans)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
char * /*psrc*/,
|
|
||||||
DDXPointPtr /*ppt*/,
|
|
||||||
int * /*pwidth*/,
|
|
||||||
int /*nspans*/,
|
|
||||||
int /*fSorted*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePutImage)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*depth*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
int /*w*/,
|
|
||||||
int /*h*/,
|
|
||||||
int /*leftPad*/,
|
|
||||||
int /*format*/,
|
|
||||||
char * /*pBits*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef RegionPtr (* typeCopyArea)(
|
|
||||||
DrawablePtr /*pSrc*/,
|
|
||||||
DrawablePtr /*pDst*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*srcx*/,
|
|
||||||
int /*srcy*/,
|
|
||||||
int /*w*/,
|
|
||||||
int /*h*/,
|
|
||||||
int /*dstx*/,
|
|
||||||
int /*dsty*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef RegionPtr (* typeCopyPlane)(
|
|
||||||
DrawablePtr /*pSrcDrawable*/,
|
|
||||||
DrawablePtr /*pDstDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*srcx*/,
|
|
||||||
int /*srcy*/,
|
|
||||||
int /*width*/,
|
|
||||||
int /*height*/,
|
|
||||||
int /*dstx*/,
|
|
||||||
int /*dsty*/,
|
|
||||||
unsigned long /*bitPlane*/
|
|
||||||
);
|
|
||||||
typedef void (* typePolyPoint)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*mode*/,
|
|
||||||
int /*npt*/,
|
|
||||||
DDXPointPtr /*pptInit*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolylines)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*mode*/,
|
|
||||||
int /*npt*/,
|
|
||||||
DDXPointPtr /*pptInit*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolySegment)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*nseg*/,
|
|
||||||
xSegment * /*pSegs*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolyRectangle)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*nrects*/,
|
|
||||||
xRectangle * /*pRects*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolyArc)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*narcs*/,
|
|
||||||
xArc * /*parcs*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typeFillPolygon)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*shape*/,
|
|
||||||
int /*mode*/,
|
|
||||||
int /*count*/,
|
|
||||||
DDXPointPtr /*pPts*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolyFillRect)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*nrectFill*/,
|
|
||||||
xRectangle * /*prectInit*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolyFillArc)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*narcs*/,
|
|
||||||
xArc * /*parcs*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef int (* typePolyText8)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
int /*count*/,
|
|
||||||
char * /*chars*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef int (* typePolyText16)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
int /*count*/,
|
|
||||||
unsigned short * /*chars*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typeImageText8)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
int /*count*/,
|
|
||||||
char * /*chars*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typeImageText16)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
int /*count*/,
|
|
||||||
unsigned short * /*chars*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typeImageGlyphBlt)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
unsigned int /*nglyph*/,
|
|
||||||
CharInfoPtr * /*ppci*/,
|
|
||||||
pointer /*pglyphBase*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePolyGlyphBlt)(
|
|
||||||
DrawablePtr /*pDrawable*/,
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/,
|
|
||||||
unsigned int /*nglyph*/,
|
|
||||||
CharInfoPtr * /*ppci*/,
|
|
||||||
pointer /*pglyphBase*/
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (* typePushPixels)(
|
|
||||||
GCPtr /*pGC*/,
|
|
||||||
PixmapPtr /*pBitMap*/,
|
|
||||||
DrawablePtr /*pDst*/,
|
|
||||||
int /*w*/,
|
|
||||||
int /*h*/,
|
|
||||||
int /*x*/,
|
|
||||||
int /*y*/
|
|
||||||
);
|
|
||||||
|
|
||||||
static RegionPtr
|
|
||||||
KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
|
|
||||||
int srcx, int srcy, int width, int height, int dstx, int dsty)
|
|
||||||
{
|
|
||||||
return NullRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
static RegionPtr
|
|
||||||
KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
|
|
||||||
int srcx, int srcy, int width, int height,
|
|
||||||
int dstx, int dsty, unsigned long bitPlane)
|
|
||||||
{
|
|
||||||
return NullRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
GCOps kdNoopOps = {
|
|
||||||
(typeFillSpans) NoopDDA, /* fill spans */
|
|
||||||
(typeSetSpans) NoopDDA, /* set spans */
|
|
||||||
(typePutImage) NoopDDA, /* put image */
|
|
||||||
KdNoopCopyArea, /* copy area */
|
|
||||||
KdNoopCopyPlane, /* copy plane */
|
|
||||||
(typePolyPoint) NoopDDA, /* poly point */
|
|
||||||
(typePolylines) NoopDDA, /* poly lines */
|
|
||||||
(typePolySegment) NoopDDA, /* poly segment */
|
|
||||||
(typePolyRectangle) NoopDDA, /* poly rectangle */
|
|
||||||
(typePolyArc) NoopDDA, /* poly arc */
|
|
||||||
(typeFillPolygon) NoopDDA, /* fill polygon */
|
|
||||||
(typePolyFillRect) NoopDDA, /* poly fillrect */
|
|
||||||
(typePolyFillArc) NoopDDA, /* poly fillarc */
|
|
||||||
(typePolyText8) NoopDDA, /* text 8 */
|
|
||||||
(typePolyText16) NoopDDA, /* text 16 */
|
|
||||||
(typeImageText8) NoopDDA, /* itext 8 */
|
|
||||||
(typeImageText16) NoopDDA, /* itext 16 */
|
|
||||||
(typePolyGlyphBlt) NoopDDA, /* glyph blt */
|
|
||||||
(typeImageGlyphBlt) NoopDDA, /* iglyph blt */
|
|
||||||
(typePushPixels) NoopDDA, /* push pixels */
|
|
||||||
};
|
|
|
@ -1,351 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2003 Anders Carlsson
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of Anders Carlsson not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Anders Carlsson makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <kdrive-config.h>
|
|
||||||
#endif
|
|
||||||
#include "kdrive.h"
|
|
||||||
|
|
||||||
#define DEBUG_OFFSCREEN 0
|
|
||||||
#if DEBUG_OFFSCREEN
|
|
||||||
#define DBG_OFFSCREEN(a) ErrorF a
|
|
||||||
#else
|
|
||||||
#define DBG_OFFSCREEN(a)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEBUG_OFFSCREEN
|
|
||||||
static void
|
|
||||||
KdOffscreenValidate (ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
KdScreenPriv (pScreen);
|
|
||||||
KdOffscreenArea *prev = 0, *area;
|
|
||||||
|
|
||||||
assert (pScreenPriv->screen->off_screen_areas->area.offset == 0);
|
|
||||||
for (area = pScreenPriv->off_screen_areas; area; area = area->next)
|
|
||||||
{
|
|
||||||
if (prev)
|
|
||||||
assert (prev->offset + prev->size == area->offset);
|
|
||||||
|
|
||||||
prev = area;
|
|
||||||
}
|
|
||||||
assert (prev->offset + prev->size == pScreenPriv->screen->memory_size);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define KdOffscreenValidate(s)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static KdOffscreenArea *
|
|
||||||
KdOffscreenKickOut (ScreenPtr pScreen, KdOffscreenArea *area)
|
|
||||||
{
|
|
||||||
if (area->save)
|
|
||||||
(*area->save) (pScreen, area);
|
|
||||||
return KdOffscreenFree (pScreen, area);
|
|
||||||
}
|
|
||||||
|
|
||||||
KdOffscreenArea *
|
|
||||||
KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|
||||||
Bool locked,
|
|
||||||
KdOffscreenSaveProc save,
|
|
||||||
pointer privData)
|
|
||||||
{
|
|
||||||
KdOffscreenArea *area, *begin, *best;
|
|
||||||
KdScreenPriv (pScreen);
|
|
||||||
int tmp, real_size = 0, best_score;
|
|
||||||
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
if (!align)
|
|
||||||
align = 1;
|
|
||||||
|
|
||||||
if (!size)
|
|
||||||
{
|
|
||||||
DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* throw out requests that cannot fit */
|
|
||||||
if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base))
|
|
||||||
{
|
|
||||||
DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try to find a free space that'll fit. */
|
|
||||||
for (area = pScreenPriv->off_screen_areas; area; area = area->next)
|
|
||||||
{
|
|
||||||
/* skip allocated areas */
|
|
||||||
if (area->state != KdOffscreenAvail)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* adjust size to match alignment requirement */
|
|
||||||
real_size = size;
|
|
||||||
tmp = area->offset % align;
|
|
||||||
if (tmp)
|
|
||||||
real_size += (align - tmp);
|
|
||||||
|
|
||||||
/* does it fit? */
|
|
||||||
if (real_size <= area->size)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!area)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Kick out existing users to make space.
|
|
||||||
*
|
|
||||||
* First, locate a region which can hold the desired object.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* prev points at the first object to boot */
|
|
||||||
best = NULL;
|
|
||||||
best_score = MAXINT;
|
|
||||||
for (begin = pScreenPriv->off_screen_areas; begin != NULL;
|
|
||||||
begin = begin->next)
|
|
||||||
{
|
|
||||||
int avail, score;
|
|
||||||
KdOffscreenArea *scan;
|
|
||||||
|
|
||||||
if (begin->state == KdOffscreenLocked)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* adjust size to match alignment requirement */
|
|
||||||
real_size = size;
|
|
||||||
tmp = begin->offset % align;
|
|
||||||
if (tmp)
|
|
||||||
real_size += (align - tmp);
|
|
||||||
|
|
||||||
avail = 0;
|
|
||||||
score = 0;
|
|
||||||
/* now see if we can make room here, and how "costly" it'll be. */
|
|
||||||
for (scan = begin; scan != NULL; scan = scan->next)
|
|
||||||
{
|
|
||||||
if (scan->state == KdOffscreenLocked) {
|
|
||||||
/* Can't make room here, start after this locked area. */
|
|
||||||
begin = scan->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Score should only be non-zero for KdOffscreenRemovable */
|
|
||||||
score += scan->score;
|
|
||||||
avail += scan->size;
|
|
||||||
if (avail >= real_size)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* Is it the best option we've found so far? */
|
|
||||||
if (avail >= real_size && score < best_score) {
|
|
||||||
best = begin;
|
|
||||||
best_score = score;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
area = best;
|
|
||||||
if (!area)
|
|
||||||
{
|
|
||||||
DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
|
|
||||||
/* Could not allocate memory */
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* adjust size to match alignment requirement */
|
|
||||||
real_size = size;
|
|
||||||
tmp = begin->offset % align;
|
|
||||||
if (tmp)
|
|
||||||
real_size += (align - tmp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Kick out first area if in use
|
|
||||||
*/
|
|
||||||
if (area->state != KdOffscreenAvail)
|
|
||||||
area = KdOffscreenKickOut (pScreen, area);
|
|
||||||
/*
|
|
||||||
* Now get the system to merge the other needed areas together
|
|
||||||
*/
|
|
||||||
while (area->size < real_size)
|
|
||||||
{
|
|
||||||
assert (area->next && area->next->state == KdOffscreenRemovable);
|
|
||||||
(void) KdOffscreenKickOut (pScreen, area->next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* save extra space in new area */
|
|
||||||
if (real_size < area->size)
|
|
||||||
{
|
|
||||||
KdOffscreenArea *new_area = xalloc (sizeof (KdOffscreenArea));
|
|
||||||
if (!new_area)
|
|
||||||
return NULL;
|
|
||||||
new_area->offset = area->offset + real_size;
|
|
||||||
new_area->size = area->size - real_size;
|
|
||||||
new_area->state = KdOffscreenAvail;
|
|
||||||
new_area->save = 0;
|
|
||||||
new_area->score = 0;
|
|
||||||
new_area->next = area->next;
|
|
||||||
area->next = new_area;
|
|
||||||
area->size = real_size;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Mark this area as in use
|
|
||||||
*/
|
|
||||||
if (locked)
|
|
||||||
area->state = KdOffscreenLocked;
|
|
||||||
else
|
|
||||||
area->state = KdOffscreenRemovable;
|
|
||||||
area->privData = privData;
|
|
||||||
area->save = save;
|
|
||||||
area->score = 0;
|
|
||||||
|
|
||||||
area->save_offset = area->offset;
|
|
||||||
{
|
|
||||||
int tmp = area->offset % align;
|
|
||||||
if (tmp)
|
|
||||||
area->offset += (align - tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
|
|
||||||
DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x\n", size, area->offset));
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KdOffscreenSwapOut (ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
KdScreenPriv (pScreen);
|
|
||||||
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
/* loop until a single free area spans the space */
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
KdOffscreenArea *area = pScreenPriv->off_screen_areas;
|
|
||||||
|
|
||||||
if (!area)
|
|
||||||
break;
|
|
||||||
if (area->state == KdOffscreenAvail)
|
|
||||||
{
|
|
||||||
area = area->next;
|
|
||||||
if (!area)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
assert (area->state != KdOffscreenAvail);
|
|
||||||
(void) KdOffscreenKickOut (pScreen, area);
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
}
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
KdOffscreenFini (pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KdOffscreenSwapIn (ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
KdOffscreenInit (pScreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* merge the next free area into this one */
|
|
||||||
static void
|
|
||||||
KdOffscreenMerge (KdOffscreenArea *area)
|
|
||||||
{
|
|
||||||
KdOffscreenArea *next = area->next;
|
|
||||||
|
|
||||||
/* account for space */
|
|
||||||
area->size += next->size;
|
|
||||||
/* frob pointer */
|
|
||||||
area->next = next->next;
|
|
||||||
xfree (next);
|
|
||||||
}
|
|
||||||
|
|
||||||
KdOffscreenArea *
|
|
||||||
KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area)
|
|
||||||
{
|
|
||||||
KdScreenPriv(pScreen);
|
|
||||||
KdOffscreenArea *next = area->next;
|
|
||||||
KdOffscreenArea *prev;
|
|
||||||
|
|
||||||
DBG_OFFSCREEN (("Free 0x%x -> 0x%x\n", area->size, area->offset));
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
|
|
||||||
area->state = KdOffscreenAvail;
|
|
||||||
area->save = 0;
|
|
||||||
area->offset = area->save_offset;
|
|
||||||
area->score = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find previous area
|
|
||||||
*/
|
|
||||||
if (area == pScreenPriv->off_screen_areas)
|
|
||||||
prev = 0;
|
|
||||||
else
|
|
||||||
for (prev = pScreenPriv->off_screen_areas; prev; prev = prev->next)
|
|
||||||
if (prev->next == area)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* link with next area if free */
|
|
||||||
if (next && next->state == KdOffscreenAvail)
|
|
||||||
KdOffscreenMerge (area);
|
|
||||||
|
|
||||||
/* link with prev area if free */
|
|
||||||
if (prev && prev->state == KdOffscreenAvail)
|
|
||||||
{
|
|
||||||
area = prev;
|
|
||||||
KdOffscreenMerge (area);
|
|
||||||
}
|
|
||||||
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
KdOffscreenInit (ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
KdScreenPriv (pScreen);
|
|
||||||
KdOffscreenArea *area;
|
|
||||||
|
|
||||||
/* Allocate a big free area */
|
|
||||||
area = xalloc (sizeof (KdOffscreenArea));
|
|
||||||
|
|
||||||
if (!area)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
area->state = KdOffscreenAvail;
|
|
||||||
area->offset = pScreenPriv->screen->off_screen_base;
|
|
||||||
area->size = pScreenPriv->screen->memory_size - area->offset;
|
|
||||||
area->save = 0;
|
|
||||||
area->next = NULL;
|
|
||||||
area->score = 0;
|
|
||||||
|
|
||||||
/* Add it to the free areas */
|
|
||||||
pScreenPriv->off_screen_areas = area;
|
|
||||||
|
|
||||||
KdOffscreenValidate (pScreen);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
KdOffscreenFini (ScreenPtr pScreen)
|
|
||||||
{
|
|
||||||
KdScreenPriv (pScreen);
|
|
||||||
KdOffscreenArea *area;
|
|
||||||
|
|
||||||
/* just free all of the area records */
|
|
||||||
while ((area = pScreenPriv->off_screen_areas))
|
|
||||||
{
|
|
||||||
pScreenPriv->off_screen_areas = area->next;
|
|
||||||
xfree (area);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 1999 Keith Packard
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of Keith Packard not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Keith Packard makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <kdrive-config.h>
|
|
||||||
#endif
|
|
||||||
#include "kdrive.h"
|
|
||||||
|
|
||||||
|
|
||||||
static CARD8 memoryPatterns[] = { 0xff, 0x00, 0x5a, 0xa5, 0xaa, 0x55 };
|
|
||||||
|
|
||||||
#define NUM_PATTERNS (sizeof (memoryPatterns) / sizeof (memoryPatterns[0]))
|
|
||||||
|
|
||||||
Bool
|
|
||||||
KdFrameBufferValid (CARD8 *base, int size)
|
|
||||||
{
|
|
||||||
volatile CARD8 *b = (volatile CARD8 *) base;
|
|
||||||
CARD8 save, test, compare;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
b = base + (size - 1);
|
|
||||||
save = *b;
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_PATTERNS; i++)
|
|
||||||
{
|
|
||||||
test = memoryPatterns[i];
|
|
||||||
*b = test;
|
|
||||||
for (j = 0; j < 1000; j++)
|
|
||||||
{
|
|
||||||
compare = *b;
|
|
||||||
if (compare != test)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*b = save;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
KdFrameBufferSize (CARD8 *base, int max)
|
|
||||||
{
|
|
||||||
int min, cur;
|
|
||||||
|
|
||||||
min = 0;
|
|
||||||
while (min + 1 < max)
|
|
||||||
{
|
|
||||||
cur = (max + min) / 2;
|
|
||||||
if (KdFrameBufferValid (base, cur))
|
|
||||||
min = cur;
|
|
||||||
else
|
|
||||||
max = cur;
|
|
||||||
}
|
|
||||||
if (KdFrameBufferValid (base, max))
|
|
||||||
return max;
|
|
||||||
else
|
|
||||||
return min;
|
|
||||||
}
|
|
|
@ -1728,47 +1728,6 @@ KdXVQueryImageAttributes(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************** Offscreen surface stuff *******************/
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
KdOffscreenImagePtr images;
|
|
||||||
int num;
|
|
||||||
} OffscreenImageRec;
|
|
||||||
|
|
||||||
static OffscreenImageRec OffscreenImages[MAXSCREENS];
|
|
||||||
static Bool offscreenInited = FALSE;
|
|
||||||
|
|
||||||
Bool
|
|
||||||
KdXVRegisterOffscreenImages(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
KdOffscreenImagePtr images,
|
|
||||||
int num
|
|
||||||
){
|
|
||||||
if(!offscreenInited) {
|
|
||||||
bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS]));
|
|
||||||
offscreenInited = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
OffscreenImages[pScreen->myNum].num = num;
|
|
||||||
OffscreenImages[pScreen->myNum].images = images;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
KdOffscreenImagePtr
|
|
||||||
KdXVQueryOffscreenImages(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
int *num
|
|
||||||
){
|
|
||||||
if(!offscreenInited) {
|
|
||||||
*num = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
*num = OffscreenImages[pScreen->myNum].num;
|
|
||||||
return OffscreenImages[pScreen->myNum].images;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************** Common video manipulation functions *******************/
|
/**************** Common video manipulation functions *******************/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -186,30 +186,6 @@ typedef struct {
|
||||||
QueryImageAttributesFuncPtr QueryImageAttributes;
|
QueryImageAttributesFuncPtr QueryImageAttributes;
|
||||||
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
|
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
KdImagePtr image;
|
|
||||||
int flags;
|
|
||||||
int (*alloc_surface)(KdScreenInfo * screen,
|
|
||||||
int id,
|
|
||||||
unsigned short width,
|
|
||||||
unsigned short height,
|
|
||||||
KdSurfacePtr surface);
|
|
||||||
int (*free_surface)(KdSurfacePtr surface);
|
|
||||||
int (*display) (KdSurfacePtr surface,
|
|
||||||
short vid_x, short vid_y,
|
|
||||||
short drw_x, short drw_y,
|
|
||||||
short vid_w, short vid_h,
|
|
||||||
short drw_w, short drw_h,
|
|
||||||
RegionPtr clipBoxes);
|
|
||||||
int (*stop) (KdSurfacePtr surface);
|
|
||||||
int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
|
|
||||||
int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
|
|
||||||
int max_width;
|
|
||||||
int max_height;
|
|
||||||
int num_attributes;
|
|
||||||
KdAttributePtr attributes;
|
|
||||||
} KdOffscreenImageRec, *KdOffscreenImagePtr;
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
KdXVScreenInit(
|
KdXVScreenInit(
|
||||||
ScreenPtr pScreen,
|
ScreenPtr pScreen,
|
||||||
|
@ -231,19 +207,6 @@ KdXVListGenericAdaptors(
|
||||||
KdVideoAdaptorPtr **Adaptors
|
KdVideoAdaptorPtr **Adaptors
|
||||||
);
|
);
|
||||||
|
|
||||||
Bool
|
|
||||||
KdXVRegisterOffscreenImages(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
KdOffscreenImagePtr images,
|
|
||||||
int num
|
|
||||||
);
|
|
||||||
|
|
||||||
KdOffscreenImagePtr
|
|
||||||
KdXVQueryOffscreenImages(
|
|
||||||
ScreenPtr pScreen,
|
|
||||||
int *num
|
|
||||||
);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
|
KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
|
||||||
int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
|
int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
|
||||||
|
|
|
@ -1226,8 +1226,6 @@ vesaRandRSetConfig (ScreenPtr pScreen,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
KdOffscreenSwapOut (screen->pScreen);
|
|
||||||
|
|
||||||
vesaUnmapFramebuffer (screen);
|
vesaUnmapFramebuffer (screen);
|
||||||
|
|
||||||
if (!vesaComputeFramebufferMapping (screen))
|
if (!vesaComputeFramebufferMapping (screen))
|
||||||
|
|
Loading…
Reference in New Issue