Merge commit 'origin/master' into transform-proposal

This commit is contained in:
Keith Packard 2008-06-13 10:13:53 -07:00
commit 93b9a6d067
209 changed files with 435 additions and 55374 deletions

88
.gitignore vendored
View file

@ -37,61 +37,6 @@ xorg-server.pc
stamp-h?
do-not-use-config.h
do-not-use-config.h.in
cfb/cfb8lineCO.c
cfb/cfb8lineCP.c
cfb/cfb8lineG.c
cfb/cfb8lineX.c
cfb/cfb8segC.c
cfb/cfb8segCS.c
cfb/cfb8segX.c
cfb/cfb8setG.c
cfb/cfbbltC.c
cfb/cfbbltG.c
cfb/cfbbltO.c
cfb/cfbbltX.c
cfb/cfbfillarcC.c
cfb/cfbfillarcG.c
cfb/cfbglrop8.c
cfb/cfbply1rctC.c
cfb/cfbply1rctG.c
cfb/cfbseg.c
cfb/cfbsolidC.c
cfb/cfbsolidG.c
cfb/cfbsolidX.c
cfb/cfbtile32C.c
cfb/cfbtile32G.c
cfb/cfbtileoddC.c
cfb/cfbtileoddG.c
cfb/cfbzerarcC.c
cfb/cfbzerarcG.c
cfb/cfbzerarcX.c
cfb32/cfb8lineCO.c
cfb32/cfb8lineCP.c
cfb32/cfb8lineG.c
cfb32/cfb8lineX.c
cfb32/cfb8segC.c
cfb32/cfb8segCS.c
cfb32/cfb8segX.c
cfb32/cfb8setG.c
cfb32/cfbbltC.c
cfb32/cfbbltG.c
cfb32/cfbbltO.c
cfb32/cfbbltX.c
cfb32/cfbfillarcC.c
cfb32/cfbfillarcG.c
cfb32/cfbply1rctC.c
cfb32/cfbply1rctG.c
cfb32/cfbseg.c
cfb32/cfbsolidC.c
cfb32/cfbsolidG.c
cfb32/cfbsolidX.c
cfb32/cfbtile32C.c
cfb32/cfbtile32G.c
cfb32/cfbtileoddC.c
cfb32/cfbtileoddG.c
cfb32/cfbzerarcC.c
cfb32/cfbzerarcG.c
cfb32/cfbzerarcX.c
doc/Xserver.1x
doc/Xserver.man
hw/dmx/Xdmx
@ -120,24 +65,11 @@ hw/dmx/examples/xdmx
hw/dmx/examples/xinput
hw/dmx/examples/xled
hw/dmx/examples/xtest
hw/kdrive/ati/Xati
hw/kdrive/chips/Xchips
hw/kdrive/ephyr/Xephyr
hw/kdrive/epson/Xepson
hw/kdrive/fake/Xfake
hw/kdrive/fbdev/Xfbdev
hw/kdrive/i810/Xi810
hw/kdrive/mach64/Xmach64
hw/kdrive/mga/Xmga
hw/kdrive/neomagic/Xneomagic
hw/kdrive/nvidia/Xnvidia
hw/kdrive/pm2/Xpm2
hw/kdrive/r128/Xr128
hw/kdrive/sdl/Xsdl
hw/kdrive/sis300/Xsis
hw/kdrive/smi/Xsmi
hw/kdrive/vesa/Xvesa
hw/kdrive/via/Xvia
hw/vfb/Xvfb
hw/vfb/Xvfb.1x
hw/vfb/Xvfb.man
@ -153,15 +85,9 @@ hw/xfree86/exa/exa.4x
hw/xfree86/exa/exa.man
hw/xfree86/fbdevhw/fbdevhw.4x
hw/xfree86/fbdevhw/fbdevhw.man
hw/xfree86/getconfig/cfg.man
hw/xfree86/getconfig/getconfig.1x
hw/xfree86/getconfig/getconfig.5x
hw/xfree86/getconfig/getconfig.man
hw/xfree86/os-support/xorgos.c
hw/xfree86/osandcommon.c
hw/xfree86/ramdac/xf86BitOrder.c
hw/xfree86/scanpci/xf86PciData.c
hw/xfree86/scanpci/xf86PciIds.h
hw/xfree86/utils/cvt/cvt
hw/xfree86/utils/cvt/cvt.man
hw/xfree86/utils/gtf/gtf
@ -174,12 +100,6 @@ hw/xfree86/utils/ioport/ioport
hw/xfree86/utils/ioport/outb
hw/xfree86/utils/ioport/outl
hw/xfree86/utils/ioport/outw
hw/xfree86/utils/pcitweak/pcitweak
hw/xfree86/utils/pcitweak/pcitweak.1x
hw/xfree86/utils/pcitweak/pcitweak.man
hw/xfree86/utils/scanpci/scanpci
hw/xfree86/utils/scanpci/scanpci.1x
hw/xfree86/utils/scanpci/scanpci.man
hw/xfree86/utils/xorgcfg/XOrgCfg
hw/xfree86/utils/xorgcfg/xorgcfg
hw/xfree86/utils/xorgcfg/xorgcfg.1x
@ -256,20 +176,12 @@ hw/xfree86/xf1bpp/mfbtileG.c
hw/xfree86/xf1bpp/mfbwindow.c
hw/xfree86/xf1bpp/mfbzerarc.c
hw/xfree86/xf4bpp/mfbseg.c
hw/xfree86/xf8_32bpp/cfbgc32.c
hw/xfree86/xf8_32bpp/cfbgc8.c
hw/xfree86/xorg.c
hw/xfree86/xorg.conf.example
hw/xfree86/xorg.conf.example.pre
hw/xnest/Xnest
hw/xnest/Xnest.1x
hw/xnest/Xnest.man
hw/xprint/Xprt
hw/xprint/config/C/print/Xprinters.ghostscript
hw/xprint/doc/Xprt.1x
hw/xprint/doc/Xprt.man
hw/xprint/dpmsstubs-wrapper.c
hw/xprint/miinitext-wrapper.c
hw/xquartz/mach-startup/mach_startup.h
hw/xquartz/mach-startup/mach_startupServer.c
hw/xquartz/mach-startup/mach_startupServer.h

View file

@ -9,10 +9,6 @@ if XTRAP
XTRAP_DIR=XTrap
endif
if MFB
MFB_DIR=mfb
endif
if GLX
GLX_DIR=glx
endif
@ -39,7 +35,6 @@ SUBDIRS = \
Xi \
xkb \
$(DBE_DIR) \
$(MFB_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
@ -82,7 +77,6 @@ DIST_SUBDIRS = \
Xi \
xkb \
dbe \
mfb \
record \
xfixes \
damageext \

View file

@ -676,15 +676,19 @@ SProcSecurityGenerateAuthorization(
char n;
CARD32 *values;
unsigned long nvalues;
int values_offset;
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
swaps(&stuff->nbytesAuthProto, n);
swaps(&stuff->nbytesAuthData, n);
swapl(&stuff->valueMask, n);
values = (CARD32 *)(&stuff[1]) +
((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
((stuff->nbytesAuthData + (unsigned)3) >> 2);
values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
((stuff->nbytesAuthData + (unsigned)3) >> 2);
if (values_offset >
stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2))
return BadLength;
values = (CARD32 *)(&stuff[1]) + values_offset;
nvalues = (((CARD32 *)stuff) + stuff->length) - values;
SwapLongs(values, nvalues);
return ProcSecurityGenerateAuthorization(client);

View file

@ -188,13 +188,12 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
static Bool badSysCall = FALSE;
static void
SigSysHandler(signo)
int signo;
SigSysHandler(int signo)
{
badSysCall = TRUE;
}
static Bool CheckForShmSyscall()
static Bool CheckForShmSyscall(void)
{
void (*oldHandler)();
int shmid = -1;
@ -278,8 +277,7 @@ ShmExtensionInit(INITARGS)
/*ARGSUSED*/
static void
ShmResetProc (extEntry)
ExtensionEntry *extEntry;
ShmResetProc(ExtensionEntry *extEntry)
{
int i;
@ -291,17 +289,13 @@ ExtensionEntry *extEntry;
}
void
ShmRegisterFuncs(
ScreenPtr pScreen,
ShmFuncsPtr funcs)
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
{
shmFuncs[pScreen->myNum] = funcs;
}
void
ShmSetPixmapFormat(
ScreenPtr pScreen,
int format)
ShmSetPixmapFormat(ScreenPtr pScreen, int format)
{
shmPixFormat[pScreen->myNum] = format;
}
@ -328,15 +322,13 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
}
void
ShmRegisterFbFuncs(pScreen)
ScreenPtr pScreen;
ShmRegisterFbFuncs(ScreenPtr pScreen)
{
shmFuncs[pScreen->myNum] = &fbFuncs;
}
static int
ProcShmQueryVersion(client)
ClientPtr client;
ProcShmQueryVersion(ClientPtr client)
{
xShmQueryVersionReply rep;
int n;
@ -430,8 +422,7 @@ shm_access(ClientPtr client, SHMPERM_TYPE *perm, int readonly)
}
static int
ProcShmAttach(client)
ClientPtr client;
ProcShmAttach(ClientPtr client)
{
SHMSTAT_TYPE buf;
ShmDescPtr shmdesc;
@ -492,9 +483,8 @@ ProcShmAttach(client)
/*ARGSUSED*/
static int
ShmDetachSegment(value, shmseg)
pointer value; /* must conform to DeleteType */
XID shmseg;
ShmDetachSegment(pointer value, /* must conform to DeleteType */
XID shmseg)
{
ShmDescPtr shmdesc = (ShmDescPtr)value;
ShmDescPtr *prev;
@ -510,8 +500,7 @@ ShmDetachSegment(value, shmseg)
}
static int
ProcShmDetach(client)
ClientPtr client;
ProcShmDetach(ClientPtr client)
{
ShmDescPtr shmdesc;
REQUEST(xShmDetachReq);
@ -523,12 +512,10 @@ ProcShmDetach(client)
}
static void
miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
GCPtr pGC;
int depth, w, h, sx, sy, sw, sh, dx, dy;
unsigned int format;
char *data;
miShmPutImage(DrawablePtr dst, GCPtr pGC,
int depth, unsigned int format,
int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
char *data)
{
PixmapPtr pmap;
GCPtr putGC;
@ -557,12 +544,10 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
}
_X_EXPORT void
fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
GCPtr pGC;
int depth, w, h, sx, sy, sw, sh, dx, dy;
unsigned int format;
char *data;
fbShmPutImage(DrawablePtr dst, GCPtr pGC,
int depth, unsigned int format,
int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
char *data)
{
if ((format == ZPixmap) || (depth == 1))
{
@ -747,8 +732,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
static int
ProcPanoramiXShmCreatePixmap(
ClientPtr client)
ProcPanoramiXShmCreatePixmap(ClientPtr client)
{
ScreenPtr pScreen = NULL;
PixmapPtr pMap = NULL;
@ -855,8 +839,7 @@ CreatePmap:
#endif
static int
ProcShmPutImage(client)
ClientPtr client;
ProcShmPutImage(ClientPtr client)
{
GCPtr pGC;
DrawablePtr pDraw;
@ -894,8 +877,17 @@ ProcShmPutImage(client)
return BadValue;
}
VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
client);
/*
* There's a potential integer overflow in this check:
* VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
* client);
* the version below ought to avoid it
*/
if (stuff->totalHeight != 0 &&
length > (shmdesc->size - stuff->offset)/stuff->totalHeight) {
client->errorValue = stuff->totalWidth;
return BadValue;
}
if (stuff->srcX > stuff->totalWidth)
{
client->errorValue = stuff->srcX;
@ -959,8 +951,7 @@ ProcShmPutImage(client)
static int
ProcShmGetImage(client)
ClientPtr client;
ProcShmGetImage(ClientPtr client)
{
DrawablePtr pDraw;
long lenPer = 0, length;
@ -1072,12 +1063,8 @@ ProcShmGetImage(client)
}
static PixmapPtr
fbShmCreatePixmap (pScreen, width, height, depth, addr)
ScreenPtr pScreen;
int width;
int height;
int depth;
char *addr;
fbShmCreatePixmap (ScreenPtr pScreen,
int width, int height, int depth, char *addr)
{
PixmapPtr pPixmap;
@ -1094,8 +1081,7 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
}
static int
ProcShmCreatePixmap(client)
ClientPtr client;
ProcShmCreatePixmap(ClientPtr client)
{
PixmapPtr pMap;
DrawablePtr pDraw;
@ -1176,8 +1162,7 @@ CreatePmap:
}
static int
ProcShmDispatch (client)
ClientPtr client;
ProcShmDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
@ -1212,8 +1197,7 @@ ProcShmDispatch (client)
}
static void
SShmCompletionEvent(from, to)
xShmCompletionEvent *from, *to;
SShmCompletionEvent(xShmCompletionEvent *from, xShmCompletionEvent *to)
{
to->type = from->type;
cpswaps(from->sequenceNumber, to->sequenceNumber);
@ -1225,8 +1209,7 @@ SShmCompletionEvent(from, to)
}
static int
SProcShmQueryVersion(client)
ClientPtr client;
SProcShmQueryVersion(ClientPtr client)
{
int n;
REQUEST(xShmQueryVersionReq);
@ -1236,8 +1219,7 @@ SProcShmQueryVersion(client)
}
static int
SProcShmAttach(client)
ClientPtr client;
SProcShmAttach(ClientPtr client)
{
int n;
REQUEST(xShmAttachReq);
@ -1249,8 +1231,7 @@ SProcShmAttach(client)
}
static int
SProcShmDetach(client)
ClientPtr client;
SProcShmDetach(ClientPtr client)
{
int n;
REQUEST(xShmDetachReq);
@ -1261,8 +1242,7 @@ SProcShmDetach(client)
}
static int
SProcShmPutImage(client)
ClientPtr client;
SProcShmPutImage(ClientPtr client)
{
int n;
REQUEST(xShmPutImageReq);
@ -1284,8 +1264,7 @@ SProcShmPutImage(client)
}
static int
SProcShmGetImage(client)
ClientPtr client;
SProcShmGetImage(ClientPtr client)
{
int n;
REQUEST(xShmGetImageReq);
@ -1303,8 +1282,7 @@ SProcShmGetImage(client)
}
static int
SProcShmCreatePixmap(client)
ClientPtr client;
SProcShmCreatePixmap(ClientPtr client)
{
int n;
REQUEST(xShmCreatePixmapReq);
@ -1320,8 +1298,7 @@ SProcShmCreatePixmap(client)
}
static int
SProcShmDispatch (client)
ClientPtr client;
SProcShmDispatch (ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)

View file

@ -167,7 +167,7 @@ ProcXTestFakeInput(client)
deviceValuator *dv = NULL;
int valuators[MAX_VALUATORS] = {0};
int numValuators = 0;
int firstValuator;
int firstValuator = 0;
EventListPtr events;
int nevents;
int i;

View file

@ -40,8 +40,6 @@ AC_CONFIG_HEADERS(include/xorg-server.h)
dnl dix-config.h covers most of the DIX (i.e. everything but the DDX, not just
dnl dix/).
AC_CONFIG_HEADERS(include/dix-config.h)
dnl xgl-config.h covers the Xgl DDX.
AC_CONFIG_HEADERS(include/xgl-config.h)
dnl xorg-config.h covers the Xorg DDX.
AC_CONFIG_HEADERS(include/xorg-config.h)
dnl xkb-config.h covers XKB for the Xorg and Xnest DDXs.
@ -567,11 +565,6 @@ AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
dnl legacy fb support
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@ -1252,62 +1245,6 @@ if test "x$XORG" = xauto; then
fi
AC_MSG_RESULT([$XORG])
dnl Xgl DDX
AC_MSG_CHECKING([whether to build Xgl DDX])
if test "x$XGL" != xno; then
PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XGL=yes], [XGL=no])
AC_SUBST(XGLMODULES_CFLAGS)
fi
AC_MSG_RESULT([$XGL])
AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])
if test "x$XGL" = xyes; then
XGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
XGL_SYS_LIBS="$XGLMODULES_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS"
AC_SUBST([XGL_LIBS])
AC_SUBST([XGL_SYS_LIBS])
AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules])
xglmoduledir="$moduledir/xgl"
AC_SUBST([xglmoduledir])
AC_DEFINE_DIR(XGL_MODULE_PATH, xglmoduledir, [Default XGL module search path])
fi
dnl Xegl DDX
AC_MSG_CHECKING([whether to build Xegl DDX])
if test "x$XEGL" != xno; then
PKG_CHECK_MODULES([XGLMODULES], [glitz-glx >= 0.4.3], [XEGL=yes], [XEGL=no])
AC_SUBST(XEGLMODULES_CFLAGS)
fi
AC_MSG_RESULT([$XEGL])
AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes])
if test "x$XEGL" = xyes; then
XEGL_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
XEGL_SYS_LIBS = "$XEGL_SYS_LIBS $XEGLMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XEGL_LIBS])
AC_SUBST([XEGL_SYS_LIBS])
fi
dnl Xglx DDX
AC_MSG_CHECKING([whether to build Xglx DDX])
if test "x$XGLX" != xno; then
PKG_CHECK_MODULES([XGLXMODULES], [glitz-glx >= 0.4.3 xrender], [XGLX=yes], [XGLX=no])
AC_SUBST(XGLXMODULES_CFLAGS)
fi
AC_MSG_RESULT([$XGLX])
AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes])
if test "x$XGLX" = xyes; then
XGLX_LIBS="$FB_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB"
XGLX_SYS_LIBS="$XGLX_SYS_LIBS $XGLXMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XGLX_LIBS])
AC_SUBST([XGLX_SYS_LIBS])
fi
xorg_bus_linuxpci=no
xorg_bus_bsdpci=no
xorg_bus_ix86pci=no
@ -1315,7 +1252,7 @@ xorg_bus_ppcpci=no
xorg_bus_sparcpci=no
xorg_bus_sparc=no
if test "x$XORG" = xyes -o "x$XGL" = xyes; then
if test "x$XORG" = xyes; then
XORG_DDXINCS='-I$(top_srcdir)/hw/xfree86 -I$(top_srcdir)/hw/xfree86/include -I$(top_srcdir)/hw/xfree86/common'
XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os'
XORG_INCS="$XORG_DDXINCS $XORG_OSINCS"
@ -1578,15 +1515,6 @@ AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86MISC], [test "x$XF86MISC" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
dnl legacy fb support
test "x$MFB" = xauto && MFB="$XORG"
AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
if test "x$MFB" = xyes; then
if test "x$XORG" != xyes; then
AC_MSG_ERROR([legacy fb support requires the Xorg server])
fi
fi
dnl XWin DDX
AC_MSG_CHECKING([whether to build XWin DDX])
@ -1982,7 +1910,6 @@ doc/Makefile
fb/Makefile
record/Makefile
XTrap/Makefile
mfb/Makefile
config/Makefile
mi/Makefile
miext/Makefile
@ -2037,8 +1964,6 @@ hw/xfree86/vbe/Makefile
hw/xfree86/vgahw/Makefile
hw/xfree86/x86emu/Makefile
hw/xfree86/xaa/Makefile
hw/xfree86/xf1bpp/Makefile
hw/xfree86/xf4bpp/Makefile
hw/xfree86/xf8_16bpp/Makefile
hw/xfree86/utils/Makefile
hw/xfree86/utils/cvt/Makefile
@ -2054,13 +1979,6 @@ hw/dmx/input/Makefile
hw/dmx/glxProxy/Makefile
hw/dmx/Makefile
hw/vfb/Makefile
hw/xgl/Makefile
hw/xgl/egl/Makefile
hw/xgl/egl/module/Makefile
hw/xgl/glx/Makefile
hw/xgl/glx/module/Makefile
hw/xgl/glxext/Makefile
hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
hw/xwin/Makefile
hw/xquartz/Makefile

View file

@ -229,6 +229,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
xDbeSwapAction swapAction;
VisualID visual;
int status;
int add_index;
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
@ -299,14 +300,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
return(BadAlloc);
bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec));
/* Make the window priv a DBE window priv resource. */
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
(pointer)pDbeWindowPriv))
{
xfree(pDbeWindowPriv);
return(BadAlloc);
}
/* Fill out window priv information. */
pDbeWindowPriv->pWindow = pWin;
pDbeWindowPriv->width = pWin->drawable.width;
@ -321,14 +314,15 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* Initialize the buffer ID list. */
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
pDbeWindowPriv->IDs[0] = stuff->buffer;
for (i = 1; i < DBE_INIT_MAX_IDS; i++)
add_index = 0;
for (i = 0; i < DBE_INIT_MAX_IDS; i++)
{
pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
}
/* Actually connect the window priv to the window. */
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv);
} /* if -- There is no buffer associated with the window. */
@ -354,7 +348,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* No more room in the ID array -- reallocate another array. */
XID *pIDs;
/* Setup an array pointer for the realloc operation below. */
if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
{
@ -391,16 +384,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
pDbeWindowPriv->maxAvailableIDs += DBE_INCR_MAX_IDS;
}
/* Finally, record the buffer ID in the array. */
pDbeWindowPriv->IDs[i] = stuff->buffer;
/* Associate the new ID with an existing window priv. */
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
(pointer)pDbeWindowPriv))
{
pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
return(BadAlloc);
}
add_index = i;
} /* else -- A buffer is already associated with the window. */
@ -409,13 +393,26 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
status = (*pDbeScreenPriv->AllocBackBufferName)(pWin, stuff->buffer,
stuff->swapAction);
if ((status != Success) && (pDbeWindowPriv->nBufferIDs == 0))
if (status == Success)
{
pDbeWindowPriv->IDs[add_index] = stuff->buffer;
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
(pointer)pDbeWindowPriv))
{
pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
if (pDbeWindowPriv->nBufferIDs == 0) {
status = BadAlloc;
goto out_free;
}
}
} else {
/* The DDX buffer allocation routine failed for the first buffer of
* this window.
*/
xfree(pDbeWindowPriv);
return(status);
if (pDbeWindowPriv->nBufferIDs == 0) {
goto out_free;
}
}
/* Increment the number of buffers (XIDs) associated with this window. */
@ -424,9 +421,13 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* Set swap action on all calls. */
pDbeWindowPriv->swapAction = stuff->swapAction;
return(status);
out_free:
dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, NULL);
xfree(pDbeWindowPriv);
return (status);
} /* ProcDbeAllocateBackBufferName() */

View file

@ -1046,6 +1046,7 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
if (!map)
return FALSE;
dst->map = map;
dst->mapWidth = src->mapWidth;
}
memmove((char *)&dst->map[rowDif * dst->mapWidth],
(char *)src->map,

View file

@ -2950,6 +2950,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
if (pScreen)
{
(*pScreen->RealizeCursor) ( pDev, pScreen, pSprite->current);
(*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
&pSprite->hotLimits, &pSprite->physLimits);
pSprite->confined = FALSE;

View file

@ -376,6 +376,7 @@ ExaCheckAddTraps (PicturePtr pPicture,
CARD32
exaGetPixmapFirstPixel (PixmapPtr pPixmap)
{
ExaScreenPriv(pPixmap->drawable.pScreen);
CARD32 pixel;
void *fb;
Bool need_finish = FALSE;
@ -390,7 +391,8 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
fb = pExaPixmap->sys_ptr;
/* Try to avoid framebuffer readbacks */
if ((!offscreen && !sys_valid && !damaged) ||
if (pExaScr->info->CreatePixmap ||
(!offscreen && !sys_valid && !damaged) ||
(offscreen && (!sys_valid || damaged)))
{
box.x1 = 0;

View file

@ -101,9 +101,6 @@
#if GLYPHPADBYTES != 4
#error "GLYPHPADBYTES must be 4"
#endif
#if GETLEFTBITS_ALIGNMENT != 1
#error "GETLEFTBITS_ALIGNMENT must be 1"
#endif
/* whether to bother to include 24bpp support */
#ifndef FBNO24BIT
#define FB_24BIT

View file

@ -63,6 +63,9 @@
#include <stdlib.h>
#include <string.h>
#ifdef DEBUG
#include <assert.h>
#endif
#include "glapi.h"
#include "glapioffsets.h"

View file

@ -943,11 +943,11 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
buf[p++] = modes->transparentAlpha;
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
buf[p++] = modes->transparentIndex;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = 0;
buf[p++] = GLX_SAMPLES_SGIS;
buf[p++] = modes->samples;
buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
buf[p++] = modes->sampleBuffers;
buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
buf[p++] = 0;
if (client->swapped) {
@ -959,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
return Success;
}
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (33)
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (35)
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
/**
* Send the set of GLXFBConfigs to the client. There is not currently
@ -1037,6 +1037,9 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
WRITE_PAIR( GLX_SAMPLES_SGIS, modes->samples );
WRITE_PAIR( GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers );
/* GLX_VISUAL_SELECT_GROUP_SGIX ? */
WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );

View file

@ -485,9 +485,11 @@ nooverride:
data = xalloc(pitch * pixmap->drawable.height);
__glXenterServer(GL_FALSE);
pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/,
0 /*pixmap->drawable.y*/, pixmap->drawable.width,
pixmap->drawable.height, ZPixmap, ~0, data);
__glXleaveServer(GL_FALSE);
if (pixmap->drawable.depth == 24)
glxFillAlphaChannel(data,
@ -529,9 +531,11 @@ nooverride:
pixmap->drawable.depth);
void *data = xalloc(pitch * (p[i].y2 - p[i].y1));
__glXenterServer(GL_FALSE);
pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1,
/*pixmap->drawable.y*/ + p[i].y1, p[i].x2 - p[i].x1,
p[i].y2 - p[i].y1, ZPixmap, ~0, data);
__glXleaveServer(GL_FALSE);
if (pixmap->drawable.depth == 24)
glxFillAlphaChannel(data,

View file

@ -81,7 +81,6 @@ struct __GLXDRIdrawable {
__GLXDRIscreen *screen;
GCPtr gc; /* scratch GC for span drawing */
GCPtr cleargc; /* GC for clearing the color buffer */
GCPtr swapgc; /* GC for swapping the color buffers */
};
@ -94,7 +93,6 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
(*core->destroyDrawable)(private->driDrawable);
FreeScratchGC(private->gc);
FreeScratchGC(private->cleargc);
FreeScratchGC(private->swapgc);
xfree(private);
@ -335,11 +333,9 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
private->gc = CreateScratchGC(pScreen, pDraw->depth);
private->cleargc = CreateScratchGC(pScreen, pDraw->depth);
private->swapgc = CreateScratchGC(pScreen, pDraw->depth);
glxChangeGC(private->gc, GCFunction, GXcopy);
glxChangeGC(private->cleargc, GCFunction, GXcopy);
glxChangeGC(private->swapgc, GCFunction, GXcopy);
glxChangeGC(private->swapgc, GCGraphicsExposures, FALSE);
@ -378,9 +374,6 @@ swrastPutImage(__DRIdrawable *draw, int op,
case __DRI_SWRAST_IMAGE_OP_DRAW:
gc = drawable->gc;
break;
case __DRI_SWRAST_IMAGE_OP_CLEAR:
gc = drawable->cleargc;
break;
case __DRI_SWRAST_IMAGE_OP_SWAP:
gc = drawable->swapgc;
break;

View file

@ -18,10 +18,6 @@ if XWIN
XWIN_SUBDIRS = xwin
endif
if XGL
XGL_SUBDIRS = xgl
endif
if KDRIVE
KDRIVE_SUBDIRS = kdrive
endif
@ -32,7 +28,6 @@ endif
SUBDIRS = \
$(XORG_SUBDIRS) \
$(XGL_SUBDIRS) \
$(XWIN_SUBDIRS) \
$(XVFB_SUBDIRS) \
$(XNEST_SUBDIRS) \
@ -40,7 +35,7 @@ SUBDIRS = \
$(KDRIVE_SUBDIRS) \
$(XQUARTZ_SUBDIRS)
DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl
DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive
relink:
for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done

View file

@ -733,7 +733,7 @@ static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
if (pCursor) {
dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
if (dmxScreen->curCursor != pCursorPriv->cursor) {
if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
if (dmxScreen->beDisplay)
XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
pCursorPriv->cursor);
@ -969,10 +969,21 @@ void dmxCheckCursor(void)
DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
}
static Bool dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
{
return TRUE;
}
static void dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
{
}
miPointerSpriteFuncRec dmxPointerSpriteFuncs =
{
dmxRealizeCursor,
dmxUnrealizeCursor,
dmxSetCursor,
dmxMoveCursor,
dmxDeviceCursorInitialize,
dmxDeviceCursorCleanup
};

View file

@ -85,6 +85,8 @@ static GCOps dmxGCOps = {
/** Initialize the GC on \a pScreen */
Bool dmxInitGC(ScreenPtr pScreen)
{
if (!dixRequestPrivate(dmxGCPrivateKey, sizeof(dmxGCPrivRec)))
return FALSE;
return TRUE;
}

View file

@ -746,8 +746,7 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
nconfigs = dmxScreen->numGlxVisuals;
}
configprivs = xalloc(dmxScreen->beNumVisuals *
sizeof(dmxGlxVisualPrivate*));
configprivs = xalloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
if (configs != NULL && configprivs != NULL) {
@ -779,6 +778,8 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
/* Hand out the glx configs to glx extension */
GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs);
XFlush(dmxScreen->beDisplay);
}
}
#endif /* GLXEXT */

View file

@ -237,7 +237,6 @@ static void enqueueMotion(DevicePtr pDev, int x, int y)
POINTER_ABSOLUTE, 0, 2, valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(p, (events + i)->event);
xfree(events);
return;
}
@ -709,7 +708,6 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(p, (events + i)->event);
xfree(events);
return;
case MotionNotify:

View file

@ -476,15 +476,11 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
break;
}
if (info.keyClass) {
#if 00 /*BP*/
InitKeyClassDeviceStruct(pDevice, &info.keySyms, info.modMap);
#else
DevicePtr pDev = (DevicePtr) pDevice;
InitKeyboardDeviceStruct(pDev,
&info.keySyms,
info.modMap,
dmxBell, dmxKbdCtrl);
#endif
}
if (info.buttonClass) {
InitButtonClassDeviceStruct(pDevice, info.numButtons, info.map);
@ -492,13 +488,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
if (info.valuatorClass) {
if (info.numRelAxes && dmxLocal->sendsCore) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
#if 00 /*BP*/
miPointerGetMotionEvents,
miPointerGetMotionBufferSize(),
#else
GetMotionHistory,
GetMaximumEventsNum(),
#endif
Relative);
for (i = 0; i < info.numRelAxes; i++)
InitValuatorAxisStruct(pDevice, i, info.minval[0],
@ -506,7 +496,6 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
info.minres[0], info.maxres[0]);
} else if (info.numRelAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
dmxPointerGetMotionEvents,
dmxPointerGetMotionBufferSize(),
Relative);
for (i = 0; i < info.numRelAxes; i++)
@ -515,7 +504,6 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
info.minres[0], info.maxres[0]);
} else if (info.numAbsAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
dmxPointerGetMotionEvents,
dmxPointerGetMotionBufferSize(),
Absolute);
for (i = 0; i < info.numAbsAxes; i++)
@ -877,7 +865,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
/* Print out information about the XInput Extension. */
handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
ext = XGetExtensionVersion(display, INAME);
ext = XQueryInputVersion(display, XI_2_Major, XI_2_Minor);
XSetExtensionErrorHandler(handler);
if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
@ -895,9 +883,11 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
for (i = 0; i < num; i++) {
const char *use = "Unknown";
switch (devices[i].use) {
case IsXPointer: use = "XPointer"; break;
case IsXKeyboard: use = "XKeyboard"; break;
case IsXExtensionDevice: use = "XExtensionDevice"; break;
case IsXPointer: use = "XPointer"; break;
case IsXKeyboard: use = "XKeyboard"; break;
case IsXExtensionDevice: use = "XExtensionDevice"; break;
case IsXExtensionPointer: use = "XExtensionPointer"; break;
case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break;
}
dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n",
devices[i].id,
@ -931,7 +921,10 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
}
}
break;
#if 0
case IsXExtensionDevice:
case IsXExtensionKeyboard:
case IsXExtensionPointer:
if (doXI) {
if (!dmxInput->numDevs) {
dmxLog(dmxWarning,
@ -950,6 +943,7 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
}
}
break;
#endif
}
}
XFreeDeviceList(devices);
@ -1085,13 +1079,6 @@ void dmxInputInit(DMXInputInfo *dmxInput)
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
#ifndef XINPUT
if (!dmxLocal->isCore)
dmxLog(dmxFatal,
"This server was not compiled to support the XInput"
" extension, but %s is not a core device.\n",
dmxLocal->name);
#endif
dmxLocal->pDevice = dmxAddDevice(dmxLocal);
if (dmxLocal->isCore) {
if (dmxLocal->type == DMX_LOCAL_MOUSE)

View file

@ -93,12 +93,9 @@ int ChangePointerDevice(DeviceIntPtr old_dev,
/* Switch the motion history buffers */
if (dmxLocalOld->savedMotionProc) {
old_dev->valuator->GetMotionProc = dmxLocalOld->savedMotionProc;
old_dev->valuator->numMotionEvents = dmxLocalOld->savedMotionEvents;
}
dmxLocalNew->savedMotionProc = new_dev->valuator->GetMotionProc;
dmxLocalNew->savedMotionEvents = new_dev->valuator->numMotionEvents;
new_dev->valuator->GetMotionProc = GetMotionHistory;
new_dev->valuator->numMotionEvents = GetMaximumEventsNum();
/* Switch our notion of core pointer */
dmxLocalOld->isCore = 0;

View file

@ -64,7 +64,7 @@ InitInput (int argc, char **argv)
{
KdKeyboardInfo *ki;
KdPointerInfo *pi;
KdAddKeyboardDriver(&EphyrKeyboardDriver);
#ifdef linux
KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
@ -301,17 +301,17 @@ miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
ephyrUnrealizeCursor,
ephyrSetCursor,
ephyrMoveCursor,
ephyrDeviceCursorInitialize,
NULL
ephyrDeviceCursorInitialize,
NULL
};
Bool
ephyrCursorInit(ScreenPtr pScreen)
{
miPointerInitialize(pScreen,
miPointerInitialize(pScreen,
&EphyrPointerSpriteFuncs,
&ephyrPointerScreenFuncs,
&ephyrPointerScreenFuncs,
FALSE);
return TRUE;
@ -336,18 +336,18 @@ KdCardFuncs ephyrFuncs = {
ephyrRestore, /* restore */
ephyrScreenFini, /* scrfini */
ephyrCardFini, /* cardfini */
0, /* initCursor */
0, /* enableCursor */
0, /* initCursor */
0, /* enableCursor */
0, /* disableCursor */
0, /* finiCursor */
0, /* recolorCursor */
0, /* initAccel */
0, /* enableAccel */
0, /* disableAccel */
0, /* finiAccel */
ephyrGetColors, /* getColors */
ephyrGetColors,/* getColors */
ephyrPutColors, /* putColors */
};

View file

@ -2107,7 +2107,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
if (flags & KD_MOUSE_DELTA)
{
if (x || y || z)
dixflags = POINTER_RELATIVE & POINTER_ACCELERATE;
dixflags = POINTER_RELATIVE | POINTER_ACCELERATE;
} else if (x != pi->dixdev->last.valuators[0] ||
y != pi->dixdev->last.valuators[1])
dixflags = POINTER_ABSOLUTE;

View file

@ -12,19 +12,15 @@ if XF86UTILS
XF86UTILS_SUBDIR = utils
endif
if MFB
MFB_SUBDIR = xf1bpp xf4bpp
endif
DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \
ramdac shadowfb vbe vgahw xaa \
xf8_16bpp loader dixmods exa modes \
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
parser rac ramdac shadowfb vbe vgahw xaa \
xf8_16bpp loader dixmods dri dri2 exa modes \
utils doc

View file

@ -2454,12 +2454,6 @@ addDefaultModes(MonPtr monitorp)
return TRUE;
}
static void
checkInput(serverLayoutPtr layout) {
if (!xf86Info.allowEmptyInput)
checkCoreInputDevices(layout, FALSE);
}
/*
* load the config file and fill the global data structure
*/
@ -2486,7 +2480,7 @@ xf86HandleConfigFile(Bool autoconfig)
xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
xf86ConfigFile = xnfstrdup(filename);
} else {
xf86Msg(X_ERROR, "Unable to locate/open config file");
xf86Msg(X_WARNING, "Unable to locate/open config file");
if (xf86ConfigFile)
xf86ErrorFVerb(0, ": \"%s\"", xf86ConfigFile);
xf86ErrorFVerb(0, "\n");

View file

@ -236,8 +236,6 @@ ProcessInputEvents ()
}
#endif
xf86Info.inputPending = FALSE;
mieqProcessInputEvents();
/* FIXME: This is a problem if we have multiple pointers */
@ -499,8 +497,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
}
if (xf86VTSwitchPending()) xf86VTSwitch();
if (xf86Info.inputPending) ProcessInputEvents();
}

View file

@ -103,7 +103,6 @@ xf86InfoRec xf86Info = {
NULL, /* mouseLocal */
-1, /* lastEventTime */
FALSE, /* vtRequestsPending */
FALSE, /* inputPending */
FALSE, /* dontVTSwitch */
FALSE, /* dontZap */
FALSE, /* dontZoom */

View file

@ -1117,7 +1117,6 @@ InitInput(argc, argv)
InputInfoPtr pInfo;
xf86Info.vtRequestsPending = FALSE;
xf86Info.inputPending = FALSE;
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {

View file

@ -85,7 +85,6 @@ typedef struct {
/* event handler part */
int lastEventTime;
Bool vtRequestsPending;
Bool inputPending;
Bool dontVTSwitch;
Bool dontZap;
Bool dontZoom;

View file

@ -785,9 +785,9 @@ xf86ScaleAxis(int Cx,
ErrorF ("Divide by Zero in xf86ScaleAxis");
}
if (X > Sxlow)
if (X > Sxhigh)
X = Sxlow;
if (X < Sxhigh)
if (X < Sxlow)
X = Sxhigh;
return (X);

View file

@ -14,17 +14,12 @@ if DBE
DBEMOD = libdbe.la
endif
if MFB
MFBMOD = libmfb.la
endif
if RECORD
RECORDMOD = librecord.la
endif
module_LTLIBRARIES = libfb.la \
libwfb.la \
$(MFBMOD) \
libshadow.la
extsmoduledir = $(moduledir)/extensions
@ -66,10 +61,6 @@ libglx_la_LIBADD = \
$(GLXDRI_LIBRARY)
libglx_la_SOURCES = glxmodule.c
libmfb_la_LDFLAGS = -avoid-version
libmfb_la_LIBADD = $(top_builddir)/mfb/libmfb.la
libmfb_la_SOURCES = mfbmodule.c
librecord_la_LDFLAGS = -avoid-version
librecord_la_LIBADD = $(top_builddir)/record/librecord.la
librecord_la_SOURCES = recordmod.c

View file

@ -21,7 +21,6 @@ endif
AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/mfb \
-I$(top_srcdir)/dbe \
-I$(top_srcdir)/hw/xfree86/loader \
-I$(top_srcdir)/miext/shadow

View file

@ -1,47 +0,0 @@
/*
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Module.h"
static XF86ModuleVersionInfo VersRec =
{
"mfb",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_ANSIC, /* Only need the ansic layer */
ABI_ANSIC_VERSION,
MOD_CLASS_NONE,
{0,0,0,0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData mfbModuleData = { &VersRec, NULL, NULL };

View file

@ -1903,6 +1903,7 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect)
nextEnabledOutput(config, enabled, &o);
while ((mode = nextAspectMode(config->output[o], mode, aspect))) {
test = mode;
for (p = o; nextEnabledOutput(config, enabled, &p); ) {
test = xf86OutputFindClosestMode(config->output[p], mode);
if (!test)

View file

@ -28,7 +28,6 @@ static void xf86CursorSetCursor(DeviceIntPtr, ScreenPtr, CursorPtr, int, int);
static void xf86CursorMoveCursor(DeviceIntPtr, ScreenPtr, int, int);
static Bool xf86DeviceCursorInitialize(DeviceIntPtr, ScreenPtr);
static void xf86DeviceCursorCleanup(DeviceIntPtr, ScreenPtr);
static void xf86DeviceCursorUndisplay(DeviceIntPtr, ScreenPtr);
static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
xf86CursorRealizeCursor,

View file

@ -1,178 +0,0 @@
module_LTLIBRARIES = libxf1bpp.la
sdk_HEADERS = xf1bpp.h mfbmap.h mfbunmap.h
libxf1bpp_la_LDFLAGS = -avoid-version
libxf1bppgen_a_SOURCES = \
mfbseg.c \
mfbpgbwht.c \
mfbpgbblak.c \
mfbpgbinv.c \
mfbigbwht.c \
mfbigbblak.c \
mfbpawhite.c \
mfbpablack.c \
mfbpainv.c \
mfbtewhite.c \
mfbteblack.c \
mfbplywhite.c \
mfbplyblack.c \
mfbplyinv.c \
mfbbltC.c \
mfbbltX.c \
mfbbltCI.c \
mfbbltO.c \
mfbbltG.c \
mfbtileC.c \
mfbtileG.c
libxf1bppmfb_a_SOURCES = \
maskbits.c \
mfbbitblt.c \
mfbbres.c \
mfbbresd.c \
mfbclip.c \
mfbcmap.c \
mfbfillarc.c \
mfbfillrct.c \
mfbfillsp.c \
mfbfont.c \
mfbgc.c \
mfbgetsp.c \
mfbhrzvert.c \
mfbimage.c \
mfbline.c \
mfbmisc.c \
mfbpixmap.c \
mfbpolypnt.c \
mfbpushpxl.c \
mfbscrclse.c \
mfbscrinit.c \
mfbsetsp.c \
mfbwindow.c \
mfbzerarc.c
BUILT_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES)
libxf1bpp_la_SOURCES = $(libxf1bppmfb_a_SOURCES) $(libxf1bppgen_a_SOURCES) \
mfbmodule.c
AM_CFLAGS = -DXF86MONO $(DIX_CFLAGS) $(XORG_CFLAGS)
INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb
mfbseg.c:
echo "#define POLYSEGMENT" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbline.c\"" >> $@
mfbpgbwht.c:
echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltWhite" > $@
echo "#define OPEQ |=" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
mfbpgbblak.c:
echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltBlack" > $@
echo "#define OPEQ &=~" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
mfbpgbinv.c:
echo "#define MFBPOLYGLYPHBLT xf1bppPolyGlyphBltInvert" > $@
echo "#define OPEQ ^=" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbplygblt.c\"" >> $@
mfbigbwht.c:
echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltWhite" > $@
echo "#define OPEQ |=" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
mfbigbblak.c:
echo "#define MFBIMAGEGLYPHBLT xf1bppImageGlyphBltBlack" > $@
echo "#define OPEQ &=~" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbimggblt.c\"" >> $@
mfbpawhite.c:
echo "#define MFBSOLIDFILLAREA xf1bppSolidWhiteArea" > $@
echo "#define MFBSTIPPLEFILLAREA xf1bppStippleWhiteArea" >> $@
echo "#define OPEQ |=" >> $@
echo "#define EQWHOLEWORD =~0" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
mfbpablack.c:
echo "#define MFBSOLIDFILLAREA xf1bppSolidBlackArea" > $@
echo "#define MFBSTIPPLEFILLAREA xf1bppStippleBlackArea" >> $@
echo "#define OPEQ &=~" >> $@
echo "#define EQWHOLEWORD =0" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
mfbpainv.c:
echo "#define MFBSOLIDFILLAREA xf1bppSolidInvertArea" > $@
echo "#define MFBSTIPPLEFILLAREA xf1bppStippleInvertArea" >> $@
echo "#define OPEQ ^=" >> $@
echo "#define EQWHOLEWORD ^=~0" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbpntarea.c\"" >> $@
mfbtewhite.c:
echo "#define OP" > $@
echo "#define CLIPTETEXT xf1bppImageGlyphBltWhite" >> $@
echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltWhite" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
mfbteblack.c:
echo "#define OP ~" > $@
echo "#define CLIPTETEXT xf1bppImageGlyphBltBlack" >> $@
echo "#define MFBTEGLYPHBLT xf1bppTEGlyphBltBlack" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbtegblt.c\"" >> $@
mfbplywhite.c:
echo "#define MFBFILLPOLY1RECT xf1bppFillPolyWhite" > $@
echo "#define OPEQ |=" >> $@
echo "#define EQWHOLEWORD =~0" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
mfbplyblack.c:
echo "#define MFBFILLPOLY1RECT xf1bppFillPolyBlack" > $@
echo "#define OPEQ &=~" >> $@
echo "#define EQWHOLEWORD =0" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
mfbplyinv.c:
echo "#define MFBFILLPOLY1RECT xf1bppFillPolyInvert" > $@
echo "#define OPEQ ^=" >> $@
echo "#define EQWHOLEWORD ^=~0" >> $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbply1rct.c\"" >> $@
mfbbltC.c:
echo "#define MROP Mcopy" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
mfbbltX.c:
echo "#define MROP Mxor" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
mfbbltCI.c:
echo "#define MROP McopyInverted" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
mfbbltO.c:
echo "#define MROP Mor" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
mfbbltG.c:
echo "#define MROP M0" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbblt.c\"" >> $@
mfbtileC.c:
echo "#define MROP Mcopy" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
mfbtileG.c:
echo "#define MRop M0" > $@
echo "#include \"mfbmap.h\"" >> $@
echo "#include \"$(top_srcdir)/mfb/mfbtile.c\"" >> $@
$(libxf1bppmfb_a_SOURCES):
echo "#include \"mfbmap.h\"" > $@
echo "#include \"$(top_srcdir)/mfb/$@\"" >> $@
EXTRA_DIST = mfbmap.sh mfbunmap.sh
DISTCLEANFILES = $(BUILT_SOURCES)

View file

@ -1,122 +0,0 @@
#ifndef _MFBMAP_H
#define _MFBMAP_H
#define InverseAlu xf1bppInverseAlu
#define endtab xf1bppendtab
#define mask xf1bppmask
#define mergeRopBits xf1bppmergeRopBits
#define mergeGetRopBits xf1bppmergeGetRopBits
#define mfbAllocatePrivates xf1bppAllocatePrivates
#define mfbBSFuncRec xf1bppBSFuncRec
#define mfbBlackSolidFS xf1bppBlackSolidFS
#define mfbBlackStippleFS xf1bppBlackStippleFS
#define mfbBresD xf1bppBresD
#define mfbBresS xf1bppBresS
#define mfbChangeWindowAttributes xf1bppChangeWindowAttributes
#define mfbCloseScreen xf1bppCloseScreen
#define mfbCopyArea xf1bppCopyArea
#define mfbCopyPixmap xf1bppCopyPixmap
#define mfbCopyPlane xf1bppCopyPlane
#define mfbCopyRotatePixmap xf1bppCopyRotatePixmap
#define mfbCopyWindow xf1bppCopyWindow
#define mfbCreateColormap xf1bppCreateColormap
#define mfbCreateDefColormap xf1bppCreateDefColormap
#define mfbCreateGC xf1bppCreateGC
#define mfbCreatePixmap xf1bppCreatePixmap
#define mfbCreateWindow xf1bppCreateWindow
#define mfbDestroyColormap xf1bppDestroyColormap
#define mfbDestroyPixmap xf1bppDestroyPixmap
#define mfbDestroyWindow xf1bppDestroyWindow
#define mfbDoBitblt xf1bppDoBitblt
#define mfbDoBitbltCopy xf1bppDoBitbltCopy
#define mfbDoBitbltCopyInverted xf1bppDoBitbltCopyInverted
#define mfbDoBitbltGeneral xf1bppDoBitbltGeneral
#define mfbDoBitbltOr xf1bppDoBitbltOr
#define mfbDoBitbltXor xf1bppDoBitbltXor
#define mfbFillInScreen xf1bppFillInScreen
#define mfbFillPolyBlack xf1bppFillPolyBlack
#define mfbFillPolyInvert xf1bppFillPolyInvert
#define mfbFillPolyWhite xf1bppFillPolyWhite
#define mfbGCPrivateIndex xf1bppGCPrivateIndex
#define mfbGetGCPrivateIndex xf1bppGetGCPrivateIndex
#define mfbGetImage xf1bppGetImage
#define mfbGetInverseAlu xf1bppGetInverseAlu
#define mfbGetSpans xf1bppGetSpans
#define mfbGetWindowPixmap xf1bppGetWindowPixmap
#define mfbGetWindowPrivateIndex xf1bppGetWindowPrivateIndex
#define mfbGetmask xf1bppGetmask
#define mfbGetpartmasks xf1bppGetpartmasks
#define mfbGetrmask xf1bppGetrmask
#define mfbGetstarttab xf1bppGetstarttab
#define mfbGetendtab xf1bppGetendtab
#define mfbHorzS xf1bppHorzS
#define mfbImageGlyphBltBlack xf1bppImageGlyphBltBlack
#define mfbImageGlyphBltWhite xf1bppImageGlyphBltWhite
#define mfbInstallColormap xf1bppInstallColormap
#define mfbInvertSolidFS xf1bppInvertSolidFS
#define mfbInvertStippleFS xf1bppInvertStippleFS
#define mfbLineSD xf1bppLineSD
#define mfbLineSS xf1bppLineSS
#define mfbListInstalledColormaps xf1bppListInstalledColormaps
#define mfbMapWindow xf1bppMapWindow
#define mfbPadPixmap xf1bppPadPixmap
#define mfbPixmapToRegion xf1bppPixmapToRegion
#define mfbPixmapToRegionWeak xf1bppPixmapToRegionWeak
#define mfbPolyFillArcSolid xf1bppPolyFillArcSolid
#define mfbPolyFillRect xf1bppPolyFillRect
#define mfbPolyGlyphBltBlack xf1bppPolyGlyphBltBlack
#define mfbPolyGlyphBltInvert xf1bppPolyGlyphBltInvert
#define mfbPolyGlyphBltWhite xf1bppPolyGlyphBltWhite
#define mfbPolyPoint xf1bppPolyPoint
#define mfbPositionWindow xf1bppPositionWindow
#define mfbPushPixels xf1bppPushPixels
#define mfbPushPixelsWeak xf1bppPushPixelsWeak
#define mfbPutImage xf1bppPutImage
#define mfbQueryBestSize xf1bppQueryBestSize
#define mfbQueryBestSizeWeak xf1bppQueryBestSizeWeak
#define mfbRealizeFont xf1bppRealizeFont
#define mfbRealizeFontWeak xf1bppRealizeFontWeak
#define mfbReduceRop xf1bppReduceRop
#define mfbRegisterCopyPlaneProc xf1bppRegisterCopyPlaneProc
#define mfbResolveColor xf1bppResolveColor
#define mfbRestoreAreas xf1bppRestoreAreas
#define mfbSaveAreas xf1bppSaveAreas
#define mfbScreenInit xf1bppScreenInit
#define mfbSegmentSD xf1bppSegmentSD
#define mfbSegmentSS xf1bppSegmentSS
#define mfbSetScanline xf1bppSetScanline
#define mfbSetSpans xf1bppSetSpans
#define mfbSetWindowPixmap xf1bppSetWindowPixmap
#define mfbSolidBlackArea xf1bppSolidBlackArea
#define mfbSolidInvertArea xf1bppSolidInvertArea
#define mfbSolidPP xf1bppSolidPP
#define mfbSolidWhiteArea xf1bppSolidWhiteArea
#define mfbStippleBlackArea xf1bppStippleBlackArea
#define mfbStippleInvertArea xf1bppStippleInvertArea
#define mfbStippleWhiteArea xf1bppStippleWhiteArea
#define mfbTEGlyphBltBlack xf1bppTEGlyphBltBlack
#define mfbTEGlyphBltWhite xf1bppTEGlyphBltWhite
#define mfbTileAreaPPW xf1bppTileAreaPPW
#define mfbTileAreaPPWCopy xf1bppTileAreaPPWCopy
#define mfbTileAreaPPWGeneral xf1bppTileAreaPPWGeneral
#define mfbTileFS xf1bppTileFS
#define mfbUninstallColormap xf1bppUninstallColormap
#define mfbUnmapWindow xf1bppUnmapWindow
#define mfbUnnaturalStippleFS xf1bppUnnaturalStippleFS
#define mfbUnnaturalTileFS xf1bppUnnaturalTileFS
#define mfbUnrealizeFont xf1bppUnrealizeFont
#define mfbUnrealizeFontWeak xf1bppUnrealizeFontWeak
#define mfbValidateGC xf1bppValidateGC
#define mfbVertS xf1bppVertS
#define mfbWhiteSolidFS xf1bppWhiteSolidFS
#define mfbWhiteStippleFS xf1bppWhiteStippleFS
#define mfbWindowPrivateIndex xf1bppWindowPrivateIndex
#define mfbXRotatePixmap xf1bppXRotatePixmap
#define mfbYRotatePixmap xf1bppYRotatePixmap
#define mfbZeroPolyArcSS xf1bppZeroPolyArcSS
#define partmasks xf1bpppartmasks
#define rmask xf1bpprmask
#define starttab xf1bppstarttab
#endif

View file

@ -1,25 +0,0 @@
#!/bin/sh
# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbmap.sh,v 1.1.2.3 1998/06/27 14:48:23 dawes Exp $
#
# This script recreates the mapping list that maps the mfb external
# symbols * to xf1bpp* (without "mfb")
# This should only be rerun if there have been changes in the mfb code
# that affect the external symbols.
# It assumes that Xserver/mfb has been compiled.
# The output goes to stdout.
echo ""
echo "#ifndef _MFBMAP_H"
echo "#define _MFBMAP_H"
echo ""
nm ../../../mfb/*.o | \
awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
sed s/^_// | \
grep -v "ModuleInit$" | \
sort | \
awk "{ print \"#define \" \$1 \" xf1bpp\"\$1 }" | \
sed s/xf1bppmfb/xf1bpp/
echo ""
echo "#endif"

View file

@ -1,47 +0,0 @@
/*
* Copyright (C) 1997 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Module.h"
static XF86ModuleVersionInfo VersRec =
{
"xf1bpp",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_ANSIC, /* Only need ansic layer */
ABI_ANSIC_VERSION,
MOD_CLASS_NONE,
{0,0,0,0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData xf1bppModuleData = { &VersRec, NULL, NULL };

View file

@ -1,114 +0,0 @@
#ifdef _MFBMAP_H
#undef _MFBMAP_H
#undef InverseAlu
#undef endtab
#undef mask
#undef mergeRopBits
#undef mergeGetRopBits
#undef mfbAllocatePrivates
#undef mfbBSFuncRec
#undef mfbBlackSolidFS
#undef mfbBlackStippleFS
#undef mfbBresD
#undef mfbBresS
#undef mfbChangeWindowAttributes
#undef mfbCloseScreen
#undef mfbCopyArea
#undef mfbCopyPixmap
#undef mfbCopyPlane
#undef mfbCopyRotatePixmap
#undef mfbCopyWindow
#undef mfbCreateColormap
#undef mfbCreateDefColormap
#undef mfbCreateGC
#undef mfbCreatePixmap
#undef mfbCreateWindow
#undef mfbDestroyColormap
#undef mfbDestroyPixmap
#undef mfbDestroyWindow
#undef mfbDoBitblt
#undef mfbDoBitbltCopy
#undef mfbDoBitbltCopyInverted
#undef mfbDoBitbltGeneral
#undef mfbDoBitbltOr
#undef mfbDoBitbltXor
#undef mfbFillPolyBlack
#undef mfbFillPolyInvert
#undef mfbFillPolyWhite
#undef mfbGCPrivateIndex
#undef mfbGetImage
#undef mfbGetInverseAlu
#undef mfbGetSpans
#undef mfbGetWindowPixmap
#undef mfbHorzS
#undef mfbImageGlyphBltBlack
#undef mfbImageGlyphBltWhite
#undef mfbInstallColormap
#undef mfbInvertSolidFS
#undef mfbInvertStippleFS
#undef mfbLineSD
#undef mfbLineSS
#undef mfbListInstalledColormaps
#undef mfbMapWindow
#undef mfbPadPixmap
#undef mfbPixmapToRegion
#undef mfbPixmapToRegionWeak
#undef mfbPolyFillArcSolid
#undef mfbPolyFillRect
#undef mfbPolyGlyphBltBlack
#undef mfbPolyGlyphBltInvert
#undef mfbPolyGlyphBltWhite
#undef mfbPolyPoint
#undef mfbPositionWindow
#undef mfbPushPixels
#undef mfbPushPixelsWeak
#undef mfbPutImage
#undef mfbQueryBestSize
#undef mfbQueryBestSizeWeak
#undef mfbRealizeFont
#undef mfbRealizeFontWeak
#undef mfbReduceRop
#undef mfbRegisterCopyPlaneProc
#undef mfbResolveColor
#undef mfbRestoreAreas
#undef mfbSaveAreas
#undef mfbScreenInit
#undef mfbSegmentSD
#undef mfbSegmentSS
#undef mfbSetScanline
#undef mfbSetSpans
#undef mfbSetWindowPixmap
#undef mfbSolidBlackArea
#undef mfbSolidInvertArea
#undef mfbSolidPP
#undef mfbSolidWhiteArea
#undef mfbStippleBlackArea
#undef mfbStippleInvertArea
#undef mfbStippleWhiteArea
#undef mfbTEGlyphBltBlack
#undef mfbTEGlyphBltWhite
#undef mfbTileAreaPPW
#undef mfbTileAreaPPWCopy
#undef mfbTileAreaPPWGeneral
#undef mfbTileFS
#undef mfbUninstallColormap
#undef mfbUnmapWindow
#undef mfbUnnaturalStippleFS
#undef mfbUnnaturalTileFS
#undef mfbUnrealizeFont
#undef mfbUnrealizeFontWeak
#undef mfbValidateGC
#undef mfbVertS
#undef mfbWhiteSolidFS
#undef mfbWhiteStippleFS
#undef mfbWindowPrivateIndex
#undef mfbXRotatePixmap
#undef mfbYRotatePixmap
#undef mfbZeroPolyArcSS
#undef partmasks
#undef rmask
#undef starttab
#endif

View file

@ -1,23 +0,0 @@
#!/bin/sh
# $XFree86: xc/programs/Xserver/hw/xfree86/xf1bpp/mfbunmap.sh,v 1.1.2.1 1998/06/27 14:48:24 dawes Exp $
#
# This script recreates a header that undoes the effect of mfbmap.h
# This should only be rerun if there have been changes in the mfb code
# that affect the external symbols.
# It assumes that Xserver/mfb has been compiled.
# The output goes to stdout.
echo ""
echo "#ifdef _MFBMAP_H"
echo "#undef _MFBMAP_H"
echo ""
nm ../../../mfb/*.o | \
awk "{ if ((\$2 == \"D\") || (\$2 == \"T\") || (\$2 == \"C\")) print \$3 }" | \
sed s/^_// | \
grep -v "ModuleInit$" | \
sort | \
awk "{ print \"#undef \" \$1 }"
echo ""
echo "#endif"

View file

@ -1,36 +0,0 @@
/*
* Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifndef __XF1BPP_H__
#define __XF1BPP_H__
#define MFB_PROTOTYPES_ONLY
#include "mfbmap.h"
#include "mfb.h"
#include "mfbunmap.h"
#undef MFB_PROTOTYPES_ONLY
#endif

View file

@ -1,57 +0,0 @@
module_LTLIBRARIES = libxf4bpp.la
sdk_HEADERS = xf4bpp.h
libxf4bpp_la_LDFLAGS = -avoid-version
libxf4bpp_la_SOURCES = \
ppcArea.c \
ppcClip.c \
ppcCpArea.c \
ppcCReduce.c \
ppcDepth.c \
ppcFillRct.c \
ppcWinFS.c \
ppcPixFS.c \
ppcGC.c \
ppcGetSp.c \
ppcImg.c \
ppcPixmap.c \
ppcPolyPnt.c \
ppcQuery.c \
ppcRslvC.c \
ppcSetSp.c \
ppcWindow.c \
ppcIO.c \
emulOpStip.c \
emulRepAre.c \
emulTile.c \
vgaGC.c \
vgaBitBlt.c \
vgaImages.c \
vgaStipple.c \
vgaSolid.c \
offscreen.c \
wm3.c \
mfbimggblt.c \
mfbline.c \
mfbseg.c \
mfbhrzvert.c \
mfbbres.c \
mfbbresd.c \
mfbfillarc.c \
mfbzerarc.c \
vgamodule.c
EXTRA_DIST = OScompiler.h ibmTrace.h ppcGCstr.h ppcSpMcro.h vgaReg.h \
vgaVideo.h wm3.h NOTES
DISTCLEANFILES = mfbseg.c
mfbseg.c:
echo "#define POLYSEGMENT" > $@
echo "#include \"$(srcdir)/mfbline.c\"" >> $@
INCLUDES = $(XORG_INCS) -I$(srcdir)/../xf1bpp -I$(top_srcdir)/mfb
AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)

View file

@ -1,194 +0,0 @@
This code originally hails from IBM. It was ported to an early XFree86 by
Gertjan Akkerman, whose BUGS file I append here.
In turn, this is a port of Gertjan's work to the new server design. Among the
changes are:
- The removal of almost all unreferenced code.
- The removal of this code's own copy of mfb (xf1bpp is used instead).
- The removal of banking support (mibank is used instead).
- External symbols were made static where this was sufficient.
- The remaining external names were renamed to xf4bpp*.
- Several minor cleanups too many to mention here.
To understate the matter, this code is >UGLY<. This seems inherent in IBM's
corporate culture. Be that as it may, it *does* survive X11R4's xtest
(whatever that means these days...). For now, this is sufficient for 4bpp
support in the new design, but at some point, I'll have to sit down and
rewrite this from scratch. A more technical justification for a rewrite is
that the pixmap format is 8bpp, instead of 4bpp, which is causing me to
pepper the rest of the server with unclean accomodations.
Marc.
===============================================================================
Section 1: From IBM's X11R4 contribution towards XFree86.
This section describes what I did to obtain a 16 colour vga server.
I started with the SYSV, ppc, vga and common directories from IBM's X11R4
contribution. Those directories have the following function:
1. SYSV implements the mouse and keyboard.
2. ppc is a generic layer implementing ddx in terms of drawing operations
through rectangles. (With spans as a boundary case: height = 1.)
3. vga implements a layer of operations drawing through rectangles.
4. common implements ddx initialization and quitting, and screen saving.
I eliminated SYSV and common since the functionality provided therein is
already provided in XFree86. Since XFree86 is actively being ported to
new operating systems, while X11R4 is out of date, I preferred the XFree86
code here above the SYSV and common code.
Whatever functionality was still needed from common (default colormap
initialization -- not much code) was moved into ppc.
Since XFree86 uses the mi-provided software cursor code, IBM's software
cursor code was deleted from ppc and vga. This is a pity, since it is
expected that it is more efficient than mi's code, but the XFree86 mouse and
keyboard code directly call mi, and I do not want to maintain the XFree86
mouse and keyboard code.
Since we cannot support a monolithic multi-screen server using all of the
x11r4 contributed code yet, all multi screen code was deleted. This includes
one header file containing a nasty copyright statement.
Since glyph handling has changed between X11R4 and X11R5, the code handling
glyphs was replaced by appropriate calls to mi.
I hope it can be modified and put back one day.
Provisionally, some code was added (viz. file vga/offscreen.c) to intercept
calls to the rectangle drawing code when we are switched out of the VT.
I hope this can be replaced by some window tree invalidation and GC validation
scheme.
Section 2: BUGS
This section describes fixed and still unfixed bugs in this code.
All bugs not labeled otherwise also occur in IBM's X11R4 code, and may be of
interest to anybody using that code.
1. (Fixed.)
I found (and provisionally fixed) a bug in the IBM bitblit code:
In file ddx/ibm/vga/vgaImages.c a function vgaReadColorImage is defined.
When this function is used to read less than 8 pixels starting on a byte
boundary it will always read precisely 8 pixels.
Thus, when space is allocated for 4 or less pixels, it will write beyond
the allocated space.
Since the code is rather convoluted, this may not be apparent at first sight,
but going through the code with an example shows the error.
2. (Fixed.)
In ppcPixmapFS.c, function ppcStipplePixmapFS there was a bug
regarding the stipple origin: The horizontal origin is added while
the vertical one is subtracted. The horizontal origin should be subtracted
instead of added here.
This bug gets visible when backing-store is enabled and one uses twm:
the submenu icons get truncated on their left hand side.
(In case you wonder why this bug appears: under those circumstances
twm prepares its menus by drawing into an unmapped window.
The miCopyPlane function uses the ppcStipplePixmap (and many others)
to get the plane copied.)
I also fixed this bug in the other routines (ppcOpStipplePixmapFS,
ppcTilePixmapFS) in this file, although I had no visible clues for this.
I hope this is appropriate.
3. (Fixed.)
I find it suspect that ppcSetSpans gives different output when one
claims that an actually sorted list of spans is unsorted.
The unsorted code is wrong, and should be made to look more like the sorted
code. I.e., use ( xStart - ppt->x ) instead of ( xStart - pbox->x1 )
4. (Fixed.)
There used to be another bug that became visible when using twm and backing
store: popping up a submenu, and moving the cursor upwards til it leaves the
submenu, the submenu would disappears, as it should.
But the submenu icon would not get restored, while it should be.
10b. By replacing the clip-computing code in ppcValidateGC by that in
cfbValidateGC, I *finally* fixed the disappearing twm menu icon problem.
5. Added mfbRegisterCopyplaneProc call. [Its omission was an error on my
part.]
Fixing a server core dump in XTest.
6. Fixed not-very-high tile bug in function ppcTileRect, file emulTile.c
(I.e., if the tile was higher than the area to be tiled, far too much
was drawn, causing server core dumps in XTest.)
Actually, "savey" ought to be used to determine the height of the tiles in
the top line to be tiled, instead of "pTile->drawable.height".
7. A use of height where width was intended was fixed in ppcTileRect:
"savehcount = w / pTile->drawable.height;" should use "... .width" and
"savehcount = ( x + w - htarget ) / pTile->drawable.height;" too.
8. Deleted overly clever code in ppcCReduce.c
(All code that tried to pre-compute how alu's could be replaced by
other alu's with inverted colors, etc. was deleted. I think it is
at least wrong for FillSolid.)
9. Looked at suspicious code in ppcSetSp.c
"tmpx = *pdst;" was never updated during the loop. We took it out of the
initialization position of the for and moved it into the loop.
10. Add xSrc := GC->patOrg.x + pDrawable.x and ySrc := ... in ppcPixmapFS.c,
functions ppcStipplePixmapFS, ppcOpStipplePixmapFS, and ppcTilePixmapFS.
This because stipple and tile origins are taken relative to the drawable.
Also use a "modulo" function that gets the cases of a negative stipple
or tile offset right. (When the stipple origin is to the right of or
below the origin of the drawable.)
11. File vgaSolid.c, function vgaFillSolid:
Inverting is XORing with all ones. Not with the color we want to AND/OR
later. So we'll have to set the color to VGA_ALLPLANES
whenever we want to invert existing data, and reset it before the
AND/OR is done.
Also we replaced an outb( 0x3CF, tmp2 ) by the SetVideoGraphicsData( tmp2 )
it is representing. (Just a cosmetic replacement.)
12. File vgaImages, function vgaDrawColorImage.
Moved a line "invert_existing_data = TRUE;" two lines down, past a case
label. Now it is also part of the code executed for GXorReverse, as it
should be.
13. The pixmap FillSpans routines (file ppcPixmapFS.c) got somewhat better
after importing some code from ddx/ibm/vga. (A getbits function that does
wrapping.)
They were wrong for the FillStippled and FillOpaqueStippled modes.
I don't understand the old code. How could it handle stipples of a size not
an exact multiple of 32? (or 8, for that matter.)
14. In function vgaBitBlt file vgaBitBlt.c, in the shortcuts for
GXSet, GXClear and GXInvert, the source (x0,y0) is accidentally operated
upon by vgaFillSolid, instead of the destination (x1,y1).
15. Notice that in DoMonoSingle and DoMonoMany in file vgaStipple.c, the left
edge of the square to be stippled is treated wrong.
Correct would be to get the bits with getbits using offset xshift, and
to shift them right (x & 07) places.
[One might wish to use the variable tmp1 at this place, since it had been
set to (x & 07) at this place; but that is already re-used at this point.]
Also note that NeedValX is set wrong: The implicit assumption was that
stipples are more than 8 wide.
This only fixes the problem when miPushPixel is used instead of ppcPushPixel.
I think I should look some more into this.
16. I took out some code of the CopyArea function, in which a no-op function
was called while a real one was needed. My fix does not completely work,
although it improved the behaviour of GetImage somewhat.
17. After finding three kinds of errors in this single function,
-- the new kinds being the right side not being always written due to
an incorrect if scope, and the lower end not always being written due
to variables being updated at the wrong place --
(requiring modifications to be made at at least 10 places,
I decided to REWRITE the body of the ppcTileRect function from scratch.
This version simply computes all relevant margins in advance, and does
not try to reuse temporary variables. I leave that to the compiler.
(This was a maintenance and robustness nightmare anyway.)
MORE NOTES:
It is funny that there are two files in mi that require compilation
with the proper #defines ( -DXF86VGA16 in my case ):
Besides the obvious mibitblt.c, there is also mipushpxl.c.
$XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/NOTES,v 1.1.2.2 1998/06/27 15:15:45 dawes Exp $

View file

@ -1,58 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef __COMPILER_DEPENDANCIES__
#define __COMPILER_DEPENDANCIES__
#define MOVE( src, dst, length ) memcpy( dst, src, length)
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ABS(x) (((x)>0)?(x):-(x))
#include "misc.h"
#include "compiler.h"
#ifdef lint
/* So that lint doesn't complain about constructs it doesn't understand */
#ifdef volatile
#undef volatile
#endif
#define volatile
#ifdef const
#undef const
#endif
#define const
#ifdef signed
#undef signed
#endif
#define signed
#ifdef _ANSI_DECLS_
#undef _ANSI_DECLS_
#endif
#endif
#endif /* !__COMPILER_DEPENDANCIES__ */

View file

@ -1,102 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/* ppc OpaqueStipple
*
* Based on the private stipple; does a foreground, and then an inverted
* on the background
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
void
xf4bppOpaqueStipple( pWin, pStipple, fg, bg, alu, planes, x, y, w, h, xSrc, ySrc )
WindowPtr pWin; /* GJA */
register PixmapPtr pStipple ;
unsigned long int fg ;
unsigned long int bg ;
int alu ;
unsigned long int planes ;
register int x, y, w, h ;
int xSrc, ySrc ;
{
/* DO BACKGROUND */
switch ( alu ) {
/* Easy Cases -- i.e. Final Result Doesn't Depend On Initial Dest. */
case GXclear: /* 0x0 Zero 0 */
case GXset: /* 0xf 1 */
/* Foreground And Background Are Both The Same !! */
xf4bppFillSolid( pWin, bg, alu, planes, x, y, w, h ) ;
case GXnoop: /* 0x5 dst */
break ;
case GXcopy: /* 0x3 src */
case GXcopyInverted: /* 0xc NOT src */
{ /* Special Case Code */
register int vtarget, htarget ;
/* We Can Draw Just One Copy Then Blit The Rest !! */
/* Draw The One Copy */
htarget = MIN( w, pStipple->drawable.width ) ;
vtarget = MIN( h, pStipple->drawable.height ) ;
/* First The Background */
xf4bppFillSolid( pWin, bg, alu, planes, x, y,
htarget, vtarget ) ;
/* Then The Foreground */
xf4bppFillStipple( pWin, pStipple, fg, alu, planes,
x, y, htarget, vtarget,
xSrc, ySrc ) ;
/* Here We Double The Size Of The BLIT Each Iteration */
xf4bppReplicateArea(pWin, x, y, planes, w, h, htarget, vtarget);
}
break ;
default:
/* Hard Cases -- i.e. Final Result DOES Depend On Initial Dest. */
{ /* Do The Background */
register int i, j;
register PixmapPtr pInvPixmap = xf4bppCopyPixmap( pStipple ) ;
register unsigned char *data = pInvPixmap->devPrivate.ptr ;
/* INVERT PIXMAP OK, jeff, this is for you */
for ( i = pInvPixmap->drawable.height ; i-- ; )
for ( j = pInvPixmap->devKind ; j-- ; data++ )
*data = ~ ( *data ) ;
xf4bppFillStipple( pWin, pInvPixmap, bg, alu, planes, x, y, w, h, xSrc, ySrc );
mfbDestroyPixmap( pInvPixmap ) ;
/* DO FOREGROUND */
xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc );
}
break ;
}
return;
}

View file

@ -1,69 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/* ppc Replicate Area -- A Divide & Conquer Algorithm
* a "ppc" Helper Function For Stipples And Tiling
* P. Shupak 1/88
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
void xf4bppReplicateArea( pWin, x, y, planeMask, goalWidth, goalHeight,
currentHoriz, currentVert)
WindowPtr pWin; /* GJA */
register int x, y, planeMask ;
int goalWidth, goalHeight ;
int currentHoriz, currentVert ;
{
for ( ;
currentHoriz <= ( goalWidth >> 1 ) ;
currentHoriz <<= 1 ) {
xf4bppBitBlt( pWin, GXcopy, planeMask,
x, y,
x + currentHoriz, y,
currentHoriz, currentVert ) ;
}
if ( goalWidth - currentHoriz )
xf4bppBitBlt( pWin, GXcopy, planeMask,
x, y,
x + currentHoriz, y,
goalWidth - currentHoriz, currentVert ) ;
for ( ;
currentVert <= ( goalHeight >> 1 ) ;
currentVert <<= 1 ) {
xf4bppBitBlt( pWin, GXcopy, planeMask,
x, y,
x, y + currentVert,
goalWidth, currentVert ) ;
}
if ( goalHeight - currentVert )
xf4bppBitBlt( pWin, GXcopy, planeMask,
x, y,
x, y + currentVert,
goalWidth, goalHeight - currentVert ) ;
return ;
}

View file

@ -1,352 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/* ppc Tile
* P. Shupak 11/87
* Modified From original ppc Tile
* T. Paquin 9/87
* Uses private imageFill a bunch of times
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "ibmTrace.h"
static void
DrawFirstTile
(
WindowPtr pWin, /* GJA */
register PixmapPtr pTile,
register int x,
register int y,
int w,
int h,
int alu,
unsigned long int planes,
int xOffset,
int yOffset
)
{
register int htarget ;
register int vtarget ;
if ( xOffset ) { /* Not X-Aligned */
if ( yOffset ) { /* Nor Y-Aligned */
htarget = MIN( pTile->drawable.width - xOffset, w ),
vtarget = MIN( pTile->drawable.height - yOffset, h ),
yOffset *= pTile->devKind ;
xf4bppDrawColorImage( pWin,x, y,
htarget,
vtarget,
(unsigned char *)pTile->devPrivate.ptr + yOffset + xOffset,
pTile->devKind,
alu, planes ) ;
if ( w > htarget ) {
w = MIN( w, pTile->drawable.width ) ;
if ( h > vtarget ) {
h = MIN( h, pTile->drawable.height ) ;
xf4bppDrawColorImage( pWin, x, y + vtarget,
htarget,
h - vtarget,
(unsigned char *)pTile->devPrivate.ptr + xOffset,
pTile->devKind,
alu, planes ) ;
xf4bppDrawColorImage( pWin, x + htarget, y,
w - htarget,
vtarget,
(unsigned char *)pTile->devPrivate.ptr + yOffset,
pTile->devKind,
alu, planes ) ;
xf4bppDrawColorImage( pWin, x + htarget,
y + vtarget,
w - htarget,
h - vtarget,
pTile->devPrivate.ptr,
pTile->devKind,
alu, planes ) ;
}
else { /* h <= vtarget */
xf4bppDrawColorImage( pWin, x + htarget, y,
w - htarget,
vtarget,
(unsigned char *)pTile->devPrivate.ptr + yOffset,
pTile->devKind,
alu, planes ) ;
}
}
else if ( h > vtarget ) {
xf4bppDrawColorImage( pWin, x, y + vtarget,
htarget,
MIN( h, pTile->drawable.height ) - vtarget,
(unsigned char *)pTile->devPrivate.ptr + xOffset,
pTile->devKind,
alu, planes ) ;
vtarget = pTile->drawable.height ;
}
}
else { /* No Y Offset */
xf4bppDrawColorImage( pWin, x, y,
htarget = MIN( pTile->drawable.width - xOffset, w ),
vtarget = MIN( pTile->drawable.height, h ),
(unsigned char *)pTile->devPrivate.ptr + xOffset,
pTile->devKind,
alu, planes ) ;
if ( w > htarget ) {
xf4bppDrawColorImage( pWin, x + htarget, y,
MIN( pTile->drawable.width, w ) - htarget,
vtarget,
pTile->devPrivate.ptr,
pTile->devKind,
alu, planes ) ;
}
}
}
else if ( yOffset ) {
xf4bppDrawColorImage( pWin, x, y,
htarget = MIN( pTile->drawable.width, w ),
vtarget = MIN( pTile->drawable.height - yOffset, h ),
(unsigned char *)pTile->devPrivate.ptr + ( yOffset * pTile->devKind ),
pTile->devKind,
alu, planes ) ;
if ( h > vtarget ) {
xf4bppDrawColorImage( pWin, x, y + vtarget,
htarget,
MIN( pTile->drawable.height, h ) - vtarget,
pTile->devPrivate.ptr,
pTile->devKind,
alu, planes ) ;
}
}
else { /* NO Offset */
xf4bppDrawColorImage( pWin, x, y,
htarget = MIN( pTile->drawable.width, w ),
vtarget = MIN( pTile->drawable.height, h ),
pTile->devPrivate.ptr,
pTile->devKind,
alu, planes ) ;
}
return ;
}
/* GJA --
* After finding three kinds of errors in this single function,
* (requiring modifications to be made at at least 10 places,
* I decided to REWRITE the body of the xf4bppTileRect function from scratch.
* This version simply computes all relevant margins in advance, and does
* not try to reuse temporary variables. I leave that to the compiler.
* (This was a maintenance and robustness nightmare anyway.)
* The code is pretty obvious: all margins, coordinates, and numbers of tiles
* are computed before drawing starts.
* Notice that the margins consist of incompletely drawn tiles. Therefore
* we need offsets in the data for the left and upper margins.
* The right and lower margins are also incomplete, but start at offset 0
* in the data. They just end at awkward offsets.
* The center block, by definition, consists of fully drawn tiles.
* Perhaps we could leave out some if's. But why bother? It would decrease
* robustness.
*/
void
xf4bppTileRect( pWin, pTile, alu, planes, x0, y0, w, h, xSrc, ySrc )
WindowPtr pWin; /* GJA */
register PixmapPtr pTile ;
const int alu ;
const unsigned long int planes ;
register int x0, y0, w, h ;
int xSrc ;
int ySrc ;
{
int xOffset ;
int yOffset ;
int width, height;
TRACE( ( "xf4bppTileRect(pTile=x%x,alu=x%x,planes=x%02x,x0=%d,y0=%d,w=%d,h=%d,xSrc=%d,ySrc=%d\n",
pTile, alu, planes, x0, y0, w, h, xSrc, ySrc ) ) ;
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXinvert: /* 0xa NOT dst */
case GXset: /* 0xf 1 */
xf4bppFillSolid
( pWin, 0xFF, alu, planes, x0, y0, w, h ) ;
case GXnoop: /* 0x5 dst */
return ;
default:
break ;
}
width = pTile->drawable.width;
if ( ( xOffset = ( x0 - xSrc ) ) > 0 )
xOffset %= width ;
else
xOffset = width - (( - xOffset ) % width ) ;
if ( xOffset == width ) xOffset = 0; /* For else case */
height = pTile->drawable.height;
if ( ( yOffset = ( y0 - ySrc ) ) > 0 )
yOffset %= height ;
else
yOffset = height - (( - yOffset ) % height ) ;
if ( yOffset == height ) yOffset = 0; /* For else case */
switch ( alu ) {
case GXcopyInverted: /* 0xc NOT src */
case GXcopy: /* 0x3 src */
/* Special Case Code */
DrawFirstTile( pWin, pTile, x0, y0, w, h,
alu, planes, xOffset, yOffset ) ;
/* Here We Double The Size Of The BLIT Each Iteration */
xf4bppReplicateArea( pWin, x0, y0, planes, w, h,
MIN( w, pTile->drawable.width ),
MIN( h, pTile->drawable.height ) ) ;
break ;
case GXnor: /* 0x8 NOT src AND NOT dst */
case GXandReverse: /* 0x2 src AND NOT dst */
case GXorReverse: /* 0xb src OR NOT dst */
case GXnand: /* 0xe NOT src OR NOT dst */
case GXandInverted: /* 0x4 NOT src AND dst */
case GXand: /* 0x1 src AND dst */
case GXequiv: /* 0x9 NOT src XOR dst */
case GXxor: /* 0x6 src XOR dst */
case GXorInverted: /* 0xd NOT src OR dst */
case GXor: /* 0x7 src OR dst */
default:
{
register unsigned char *data ;
register int hcount, vcount ; /* Number of tiles in center */
int xcount, ycount; /* Temporaries */
int x1, y1; /* Left upper corner of center */
int x2, y2; /* Left upper corner of lower right margin */
int leftmgn, rightmgn, topmgn, botmgn; /* Margins */
int htarget, vtarget ;
data = pTile->devPrivate.ptr;
/* Compute the various sizes and coordinates. */
leftmgn = MIN( w, width - xOffset ) ;
x1 = x0 + leftmgn;
topmgn = MIN( h, height - yOffset ) ;
y1 = y0 + topmgn;
rightmgn = (w - leftmgn) % width;
hcount = (w - leftmgn) / width;
x2 = x0 + w - rightmgn;
botmgn = (h - topmgn) % height;
vcount = (h - topmgn) / height;
y2 = y0 + h - botmgn;
/* We'll use yOffset as offset in data.
* This requires yOffset != height (ditto xOffset).
*/
yOffset *= pTile->devKind;
/* Draw top margin, including corners */
if ( topmgn ) {
if ( leftmgn ) {
xf4bppDrawColorImage( pWin, x0, y0, leftmgn, topmgn,
data + yOffset + xOffset,
pTile->devKind, alu, planes ) ;
}
for ( xcount = hcount, htarget = x1;
xcount ;
xcount--, htarget += width )
{
xf4bppDrawColorImage( pWin, htarget, y0, width, topmgn,
data + yOffset,
pTile->devKind, alu, planes ) ;
}
if ( rightmgn ) {
xf4bppDrawColorImage( pWin, x2, y0, rightmgn, topmgn,
data + yOffset,
pTile->devKind, alu, planes ) ;
}
}
/* Draw bottom margin, including corners */
if ( botmgn ) {
if ( leftmgn ) {
xf4bppDrawColorImage( pWin, x0, y2, leftmgn, botmgn,
data + xOffset,
pTile->devKind, alu, planes ) ;
}
for ( xcount = hcount, htarget = x1;
xcount ;
xcount--, htarget += width )
{
xf4bppDrawColorImage( pWin, htarget, y2, width, botmgn,
data,
pTile->devKind, alu, planes ) ;
}
if ( rightmgn ) {
xf4bppDrawColorImage( pWin, x2, y2, rightmgn, botmgn,
data,
pTile->devKind, alu, planes ) ;
}
}
/* Draw left margin, excluding corners */
if ( leftmgn ) {
for ( ycount = vcount, vtarget = y1 ;
ycount ;
ycount--, vtarget += height )
{
xf4bppDrawColorImage( pWin, x0, vtarget, leftmgn, height,
data + xOffset,
pTile->devKind, alu, planes ) ;
}
}
/* Draw right margin, excluding corners */
if ( rightmgn ) {
for ( ycount = vcount, vtarget = y1 ;
ycount ;
ycount--, vtarget += height )
{
xf4bppDrawColorImage( pWin, x2, vtarget, rightmgn, height,
data,
pTile->devKind, alu, planes ) ;
}
}
/* Draw center consisting of full tiles */
for ( ycount = vcount, vtarget = y1 ;
ycount ;
ycount--, vtarget += height )
{
for ( xcount = hcount, htarget = x1 ;
xcount ;
xcount--, htarget += width )
{
xf4bppDrawColorImage( pWin, htarget, vtarget, width, height,
data,
pTile->devKind, alu, planes ) ;
}
}
} } /* Block + switch */
}

View file

@ -1 +0,0 @@
#define TRACE(x) /* empty */

View file

@ -1,164 +0,0 @@
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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.
******************************************************************/
/* GJA -- modified this file for vga16 */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "miline.h"
#include "wm3.h"
/* Solid bresenham line */
/* NOTES
e2 is used less often than e1, so it's not in a register
*/
void
xf4bppBresS(addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len)
PixelType *addrlbase; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
int signdx, signdy; /* signs of directions */
int axis; /* major axis (Y_AXIS or X_AXIS) */
int x1, y1; /* initial point */
register int e; /* error accumulator */
register int e1; /* bresenham increments */
int e2;
int len; /* length of line */
{
register int yinc; /* increment to next scanline, in bytes */
register PixelType *addrl; /* bitmask long pointer
*dont* * cast to char pointer */
register PixelType bit; /* current bit being set/cleared/etc. */
PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
register int e3 = e2-e1;
/* point to longword containing first point */
addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
yinc = signdy * nlwidth;
e = e-e1; /* to make looping easier */
bit = mfbGetmask(x1 & PIM);
if (!len)
return;
if (axis == X_AXIS)
{
if (signdx > 0)
{
while(len--)
{
UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
addrl += yinc;
e += e3;
}
bit = SCRRIGHT(bit,1);
if (!bit) { bit = leftbit; addrl++; }
}
}
else
{
while(len--)
{
UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
addrl += yinc;
e += e3;
}
bit = SCRLEFT(bit,1);
if (!bit) { bit = rightbit; addrl--; }
}
}
} /* if X_AXIS */
else
{
if (signdx > 0)
{
while(len--)
{
UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
bit = SCRRIGHT(bit,1);
if (!bit) { bit = leftbit; addrl++; }
e += e3;
}
addrl += yinc;
}
}
else
{
while(len--)
{
UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
bit = SCRLEFT(bit,1);
if (!bit) { bit = rightbit; addrl--; }
e += e3;
}
addrl += yinc;
}
}
} /* else Y_AXIS */
}

View file

@ -1,205 +0,0 @@
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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.
******************************************************************/
/* GJA -- modified this file for vga16 */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "miline.h"
#include "wm3.h"
#include "xf86.h"
/* Dashed bresenham line */
#define NO_INK (-1) /* GJA -- means: dash is off */
#define StepDash\
if (!--dashRemaining) { \
if (++ dashIndex == numInDashList) \
dashIndex = 0; \
dashRemaining = pDash[dashIndex]; \
ink = fgink; \
if (dashIndex & 1) \
ink = bgink; \
if (isDoubleDash) \
WM3_SET_INK(ink); \
}
void
xf4bppBresD(pDrawable, fgink, bgink,
pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
addrlbase, nlwidth,
signdx, signdy, axis, x1, y1, e, e1, e2, len)
DrawablePtr pDrawable;
int fgink, bgink;
int *pdashIndex; /* current dash */
unsigned char *pDash; /* dash list */
int numInDashList; /* total length of dash list */
int *pdashOffset; /* offset into current dash */
int isDoubleDash;
PixelType *addrlbase; /* pointer to base of bitmap */
int nlwidth; /* width in longwords of bitmap */
int signdx, signdy; /* signs of directions */
int axis; /* major axis (Y_AXIS or X_AXIS) */
int x1, y1; /* initial point */
register int e; /* error accumulator */
register int e1; /* bresenham increments */
int e2;
int len; /* length of line */
{
IOADDRESS REGBASE =
xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
register int yinc; /* increment to next scanline, in bytes */
register PixelType *addrl;
register int e3 = e2-e1;
register unsigned long bit;
PixelType leftbit = mfbGetmask(0); /* leftmost bit to process in new word */
PixelType rightbit = mfbGetmask(PPW-1); /* rightmost bit to process in new word */
int dashIndex;
int dashOffset;
int dashRemaining;
int ink;
fgink &= 0x0F; bgink &= 0x0F; /* GJA -- so they're != NO_INK */
dashOffset = *pdashOffset;
dashIndex = *pdashIndex;
dashRemaining = pDash[dashIndex] - dashOffset;
ink = fgink;
if (!isDoubleDash)
bgink = NO_INK;
if (dashIndex & 1)
ink = bgink;
if ( ink != NO_INK ) WM3_SET_INK(ink);
/* point to longword containing first point */
addrl = mfbScanline(addrlbase, x1, y1, nlwidth);
yinc = signdy * nlwidth;
e = e-e1; /* to make looping easier */
bit = mfbGetmask(x1 & PIM);
if (axis == X_AXIS)
{
if (signdx > 0)
{
while(len--)
{
if ( ink != NO_INK ) UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
addrl += yinc;
e += e3;
}
bit = SCRRIGHT(bit,1);
if (!bit) { bit = leftbit; addrl++; }
StepDash
}
}
else
{
while(len--)
{
if ( ink != NO_INK ) UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
addrl += yinc;
e += e3;
}
bit = SCRLEFT(bit,1);
if (!bit) { bit = rightbit; addrl--; }
StepDash
}
}
} /* if X_AXIS */
else
{
if (signdx > 0)
{
while(len--)
{
if ( ink != NO_INK ) UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
bit = SCRRIGHT(bit,1);
if (!bit) { bit = leftbit; addrl++; }
e += e3;
}
addrl += yinc;
StepDash
}
}
else
{
while(len--)
{
if ( ink != NO_INK ) UPDRW(addrl,bit);
e += e1;
if (e >= 0)
{
bit = SCRLEFT(bit,1);
if (!bit) { bit = rightbit; addrl--; }
e += e3;
}
addrl += yinc;
StepDash
}
}
} /* else Y_AXIS */
*pdashIndex = dashIndex;
*pdashOffset = pDash[dashIndex] - dashRemaining;
}

View file

@ -1,301 +0,0 @@
/************************************************************
Copyright (c) 1989 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
********************************************************/
/* GJA -- Took mfb code and modified it. */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "mi.h"
#include "mifillarc.h"
#include "wm3.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
static void
v16FillEllipseSolid
(
DrawablePtr pDraw,
xArc *arc
)
{
int x, y, e;
int yk, xk, ym, xm, dx, dy, xorg, yorg;
register int slw;
miFillArcRec info;
int *addrlt, *addrlb;
register int *addrl;
register int n;
int nlwidth;
register int xpos;
int startmask, endmask, nlmiddle;
if (pDraw->type == DRAWABLE_WINDOW)
{
addrlt = (int *)
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
nlwidth = (int)
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
}
else
{
addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
}
miFillArcSetup(arc, &info);
MIFILLARCSETUP();
xorg += pDraw->x;
yorg += pDraw->y;
addrlb = addrlt;
addrlt += nlwidth * (yorg - y);
addrlb += nlwidth * (yorg + y + dy);
while (y)
{
addrlt += nlwidth;
addrlb -= nlwidth;
MIFILLARCSTEP(slw);
if (!slw)
continue;
xpos = xorg - x;
addrl = addrlt + (xpos >> PWSH);
if (((xpos & PIM) + slw) < PPW)
{
maskpartialbits(xpos, slw, startmask);
UPDRW(addrl,startmask);
if (miFillArcLower(slw))
{
addrl = addrlb + (xpos >> PWSH);
UPDRW(addrl,startmask);
}
continue;
}
maskbits(xpos, slw, startmask, endmask, nlmiddle);
if (startmask)
{
UPDRW(addrl,startmask); addrl++;
}
n = nlmiddle;
while (n--) {
UPDRW(addrl,~0); addrl++;
}
if (endmask)
{
UPDRW(addrl,endmask);
}
if (!miFillArcLower(slw))
continue;
addrl = addrlb + (xpos >> PWSH);
if (startmask)
{
UPDRW(addrl,startmask); addrl++;
}
n = nlmiddle;
while (n--) {
UPDRW(addrl,~0); addrl++;
}
if (endmask)
{
UPDRW(addrl,endmask);
}
}
}
#define FILLSPAN(xl,xr,addr) \
if (xr >= xl) \
{ \
width = xr - xl + 1; \
addrl = addr + (xl >> PWSH); \
if (((xl & PIM) + width) < PPW) \
{ \
maskpartialbits(xl, width, startmask); \
UPDRW(addrl,startmask); \
} \
else \
{ \
maskbits(xl, width, startmask, endmask, nlmiddle); \
if (startmask) \
{ \
UPDRW(addrl,startmask); addrl++; \
} \
n = nlmiddle; \
while (n--) { \
UPDRW(addrl,~0); addrl++; \
} \
if (endmask) \
{ \
UPDRW(addrl,endmask); \
} \
} \
}
#define FILLSLICESPANS(flip,addr) \
if (!flip) \
{ \
FILLSPAN(xl, xr, addr); \
} \
else \
{ \
xc = xorg - x; \
FILLSPAN(xc, xr, addr); \
xc += slw - 1; \
FILLSPAN(xl, xc, addr); \
}
static void
v16FillArcSliceSolidCopy
(
DrawablePtr pDraw,
GCPtr pGC,
xArc *arc
)
{
register int *addrl;
register int n;
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
register int x, y, e;
miFillArcRec info;
miArcSliceRec slice;
int xl, xr, xc;
int *addrlt, *addrlb;
int nlwidth;
int width;
int startmask, endmask, nlmiddle;
if (pDraw->type == DRAWABLE_WINDOW)
{
addrlt = (int *)
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
nlwidth = (int)
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
}
else
{
addrlt = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
}
miFillArcSetup(arc, &info);
miFillArcSliceSetup(arc, &slice, pGC);
MIFILLARCSETUP();
xorg += pDraw->x;
yorg += pDraw->y;
addrlb = addrlt;
addrlt += nlwidth * (yorg - y);
addrlb += nlwidth * (yorg + y + dy);
slice.edge1.x += pDraw->x;
slice.edge2.x += pDraw->x;
while (y > 0)
{
addrlt += nlwidth;
addrlb -= nlwidth;
MIFILLARCSTEP(slw);
MIARCSLICESTEP(slice.edge1);
MIARCSLICESTEP(slice.edge2);
if (miFillSliceUpper(slice))
{
MIARCSLICEUPPER(xl, xr, slice, slw);
FILLSLICESPANS(slice.flip_top, addrlt);
}
if (miFillSliceLower(slice))
{
MIARCSLICELOWER(xl, xr, slice, slw);
FILLSLICESPANS(slice.flip_bot, addrlb);
}
}
}
static void
xf4bppPolyFillArcSolid
(
register DrawablePtr pDraw,
GCPtr pGC,
int narcs,
xArc *parcs
)
{
register xArc *arc;
register int i;
BoxRec box;
RegionPtr cclip;
#if 0
mfbPrivGC *priv;
int rop;
priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
mfbGetGCPrivateKey());
rop = priv->rop;
if ((rop == RROP_NOP) || !(pGC->planemask & 1))
#else
if ( !(pGC->planemask & 0x0F))
#endif
return;
cclip = pGC->pCompositeClip;
for (arc = parcs, i = narcs; --i >= 0; arc++)
{
if (miFillArcEmpty(arc))
continue;
if (miCanFillArc(arc))
{
box.x1 = arc->x + pDraw->x;
box.y1 = arc->y + pDraw->y;
box.x2 = box.x1 + (int)arc->width + 1;
box.y2 = box.y1 + (int)arc->height + 1;
if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
{
if ((arc->angle2 >= FULLCIRCLE) ||
(arc->angle2 <= -FULLCIRCLE))
DO_WM3(pGC,v16FillEllipseSolid(pDraw, arc))
else
DO_WM3(pGC,v16FillArcSliceSolidCopy(pDraw, pGC, arc))
continue;
}
}
miPolyFillArc(pDraw, pGC, 1, arc);
}
}
void
xf4bppPolyFillArc(pDraw, pGC, narcs, parcs)
register DrawablePtr pDraw;
GCPtr pGC;
int narcs;
xArc *parcs;
{
if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema || (pGC->fillStyle != FillSolid) ) {
miPolyFillArc(pDraw, pGC, narcs, parcs);
} else {
xf4bppPolyFillArcSolid(pDraw, pGC, narcs, parcs);
}
}

View file

@ -1,135 +0,0 @@
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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.
******************************************************************/
/* GJA -- modified this file for vga16 */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "wm3.h"
/* horizontal solid line
abs(len) > 1
*/
void
xf4bppHorzS(addrl, nlwidth, x1, y1, len)
register PixelType *addrl; /* pointer to base of bitmap */
register int nlwidth; /* width in longwords of bitmap */
int x1; /* initial point */
int y1;
int len; /* length of line */
{
register PixelType startmask;
register PixelType endmask;
register int nlmiddle;
/* force the line to go left to right
but don't draw the last point
*/
if (len < 0)
{
x1 += len;
x1 += 1;
len = -len;
}
addrl = mfbScanline(addrl, x1, y1, nlwidth);
/* all bits inside same longword */
if ( ((x1 & PIM) + len) < PPW)
{
maskpartialbits(x1, len, startmask);
UPDRW(addrl,startmask);
}
else
{
maskbits(x1, len, startmask, endmask, nlmiddle);
if (startmask) {
UPDRW(addrl,startmask); addrl++;
}
Duff (nlmiddle, UPDRW(addrl,~0); addrl++);
if (endmask) {
UPDRW(addrl,endmask);
}
}
}
/* vertical solid line
this uses do loops because pcc (Ultrix 1.2, bsd 4.2) generates
better code. sigh. we know that len will never be 0 or 1, so
it's OK to use it.
*/
void
xf4bppVertS(addrl, nlwidth, x1, y1, len)
register PixelType *addrl; /* pointer to base of bitmap */
register int nlwidth; /* width in longwords of bitmap */
int x1, y1; /* initial point */
register int len; /* length of line */
{
register PixelType bitmask;
addrl = mfbScanline(addrl, x1, y1, nlwidth);
if (len < 0)
{
nlwidth = -nlwidth;
len = -len;
}
bitmask = mfbGetmask(x1 & PIM);
Duff(len, UPDRW(addrl,bitmask); addrl += nlwidth);
}

View file

@ -1,505 +0,0 @@
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "mi.h"
#include "dixfontstr.h"
#include "ppcGCstr.h"
#include "wm3.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
/*
we should eventually special-case fixed-width fonts for ImageText.
this works for fonts with glyphs <= 32 bits wide.
the clipping calculations are done for worst-case fonts.
we make no assumptions about the heights, widths, or bearings
of the glyphs. if we knew that the glyphs are all the same height,
we could clip the tops and bottoms per clipping box, rather
than per character per clipping box. if we knew that the glyphs'
left and right bearings were wlle-behaved, we could clip a single
character at the start, output until the last unclipped
character, and then clip the last one. this is all straightforward
to determine based on max-bounds and min-bounds from the font.
there is some inefficiency introduced in the per-character
clipping to make what's going on clearer.
(it is possible, for example, for a font to be defined in which the
next-to-last character in a font would be clipped out, but the last
one wouldn't. the code below deals with this.)
Image text looks at the bits in the glyph and the fg and bg in the
GC. it paints a rectangle, as defined in the protocol dcoument,
and the paints the characters.
to avoid source proliferation, this file is compiled
three times:
MFBIMAGEGLYPHBLT OPEQ
mfbImageGlyphBltWhite |=
mfbImageGlyphBltBlack &=~
the register allocations for startmask and endmask may not
be the right thing. are there two other deserving candidates?
xoff, pdst, pglyph, and tmpSrc seem like the right things, though.
*/
/* Forward declarations -- GJA */
static void doImageGlyphBlt(
DrawablePtr,
GC *,
int,
int,
unsigned int,
CharInfoPtr *,
unsigned char *,
ExtentInfoRec *
);
void
xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
DrawablePtr pDrawable;
GC *pGC;
int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
pointer pglyphBase; /* start of array of glyphs */
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
xRectangle backrect;/* backing rectangle to paint.
in the general case, NOT necessarily
the same as the string's bounding box
*/
/* GJA -- I agree, this ALL should be moved to GC validation. */
if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) ||
!xf86Screens[pDrawable->pScreen->myNum]->vtSema ||
((pGC->font) &&
(FONTMAXBOUNDS(pGC->font,rightSideBearing) -
FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 ||
FONTMINBOUNDS(pGC->font,characterWidth) < 0)) ) {
miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
} else {
ppcPrivGC *pPrivGC;
int oldfillStyle, oldfg, oldalu;
if (!(pGC->planemask & 0x0F))
return;
QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info);
backrect.x = x;
backrect.y = y - FONTASCENT(pGC->font);
backrect.width = info.overallWidth;
backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates,
mfbGetGCPrivateKey());
oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */
oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */
oldalu = pPrivGC->colorRrop.alu; /* GJA */
pPrivGC->colorRrop.fillStyle = FillSolid; /* GJA */
pPrivGC->colorRrop.fgPixel = pGC->bgPixel; /* GJA */
pGC->fgPixel = pGC->bgPixel;
pPrivGC->colorRrop.alu = GXcopy; /* GJA */
pGC->alu = GXcopy;
/* Required fields:
* colorRrop.alu, colorRrop.planemask, colorRrop.fgPixel
*/
xf4bppPolyFillRect(pDrawable, pGC, 1, &backrect);
pPrivGC->colorRrop.fgPixel = oldfg; /* GJA */
pGC->fgPixel = oldfg;
/* the faint-hearted can open their eyes now */
DO_WM3(pGC,doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci,
pglyphBase,&info))
pPrivGC->colorRrop.fillStyle = oldfillStyle; /* GJA */
pPrivGC->colorRrop.alu = oldalu; /* GJA */
pGC->alu = oldalu;
}
}
static void
doImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,infop)
DrawablePtr pDrawable;
GC *pGC;
int x, y;
unsigned int nglyph;
CharInfoPtr *ppci; /* array of character info */
unsigned char *pglyphBase; /* start of array of glyphs */
ExtentInfoRec* infop; /* used by QueryGlyphExtents() */
{
BoxRec bbox; /* string's bounding box */
CharInfoPtr pci;
int xorg, yorg; /* origin of drawable in bitmap */
int widthDst; /* width of dst in longwords */
/* these keep track of the character origin */
CARD32 *pdstBase;
/* points to longword with character origin */
int xchar; /* xorigin of char (mod 32) */
/* these are used for placing the glyph */
register int xoff; /* x offset of left edge of glyph (mod 32) */
register CARD32 *pdst;
/* pointer to current longword in dst */
int w; /* width of glyph in bits */
int h; /* height of glyph */
int widthGlyph; /* width of glyph, in bytes */
register unsigned char *pglyph;
/* pointer to current row of glyph */
/* used for putting down glyph */
register unsigned int tmpSrc;
/* for getting bits from glyph */
register int startmask;
register int endmask;
register int nFirst;/* bits of glyph in current longword */
xorg = pDrawable->x;
yorg = pDrawable->y;
if (pDrawable->type == DRAWABLE_WINDOW)
{
pdstBase = (CARD32 *)
(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr);
widthDst = (int)
(((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2;
}
else
{
pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr);
widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2;
}
x += xorg;
y += yorg;
bbox.x1 = x + infop->overallLeft;
bbox.x2 = x + infop->overallRight;
bbox.y1 = y - infop->overallAscent;
bbox.y2 = y + infop->overallDescent;
/* UNCLEAN CODE
we know the mfbPolyFillRect uses only three fields in
devPrivate[mfbGetGCPrivateIndex()].ptr, two of which (the rotated
tile/stipple and the ropFillArea) are
irrelevant for solid filling, so we just poke the FillArea
field. the GC is now in an inconsistent state, but we'll fix
it as soon as PolyFillRect returns. fortunately, the server
is single threaded.
NOTE:
if you are not using the standard mfbFillRectangle code, you
need to poke any fields in the GC the rectangle stuff need
(probably alu, fgPixel, and fillStyle) and in devPrivate[mfbGetGCPrivateIndex()].ptr
(probably rop or ropFillArea.) You could just call ValidateGC,
but that is usually not a cheap thing to do.
*/
switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox))
{
case rgnOUT:
break;
case rgnIN:
pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
xchar = x & PIM;
while(nglyph--)
{
pci = *ppci;
pglyph = FONTGLYPHBITS(pglyphBase, pci);
w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing;
h = pci->metrics.ascent + pci->metrics.descent;
widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
/* start at top scanline of glyph */
pdst = pdstBase - (pci->metrics.ascent * widthDst);
/* find correct word in scanline and x offset within it
for left edge of glyph
*/
xoff = xchar + pci->metrics.leftSideBearing;
if (xoff > PIM)
{
pdst++;
xoff &= PIM;
}
else if (xoff < 0)
{
xoff += PPW;
pdst--;
}
if ((xoff + w) <= PPW)
{
/* glyph all in one longword */
maskpartialbits(xoff, w, startmask);
while (h--)
{
getleftbits(pglyph, w, tmpSrc);
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
pglyph += widthGlyph;
pdst += widthDst;
}
}
else
{
/* glyph crosses longword boundary */
maskPPWbits(xoff, w, startmask, endmask);
nFirst = PPW - xoff;
while (h--)
{
getleftbits(pglyph, w, tmpSrc);
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
pglyph += widthGlyph;
pdst += widthDst;
}
} /* glyph crosses longwords boundary */
/* update character origin */
x += pci->metrics.characterWidth;
xchar += pci->metrics.characterWidth;
if (xchar > PLST)
{
xchar -= PPW;
pdstBase++;
}
else if (xchar < 0)
{
xchar += PPW;
pdstBase--;
}
ppci++;
} /* while nglyph-- */
break;
case rgnPART:
{
TEXTPOS *ppos;
int nbox;
BoxPtr pbox;
RegionPtr cclip;
int xpos; /* x position of char origin */
unsigned int i;
BoxRec clip;
int leftEdge, rightEdge;
int topEdge, bottomEdge;
int glyphRow; /* first row of glyph not wholly
clipped out */
int glyphCol; /* leftmost visible column of glyph */
#if GETLEFTBITS_ALIGNMENT > 1
int getWidth; /* bits to get from glyph */
#endif
if(!(ppos = (TEXTPOS *)xalloc(nglyph * sizeof(TEXTPOS))))
return;
pdstBase = pdstBase + (widthDst * y) + (x >> PWSH);
xpos = x;
xchar = xpos & PIM;
for (i=0; i<nglyph; i++)
{
pci = ppci[i];
ppos[i].xpos = xpos;
ppos[i].xchar = xchar;
ppos[i].leftEdge = xpos + pci->metrics.leftSideBearing;
ppos[i].rightEdge = xpos + pci->metrics.rightSideBearing;
ppos[i].topEdge = y - pci->metrics.ascent;
ppos[i].bottomEdge = y + pci->metrics.descent;
ppos[i].pdstBase = pdstBase;
ppos[i].widthGlyph = GLYPHWIDTHBYTESPADDED(pci);
xpos += pci->metrics.characterWidth;
xchar += pci->metrics.characterWidth;
if (xchar > PLST)
{
xchar &= PIM;
pdstBase++;
}
else if (xchar < 0)
{
xchar += PPW;
pdstBase--;
}
}
cclip = pGC->pCompositeClip;
pbox = REGION_RECTS(cclip);
nbox = REGION_NUM_RECTS(cclip);
/* HACK ALERT
since we continue out of the loop below so often, it
is easier to increment pbox at the top than at the end.
don't try this at home.
*/
pbox--;
while(nbox--)
{
pbox++;
clip.x1 = max(bbox.x1, pbox->x1);
clip.y1 = max(bbox.y1, pbox->y1);
clip.x2 = min(bbox.x2, pbox->x2);
clip.y2 = min(bbox.y2, pbox->y2);
if ((clip.x2<=clip.x1) || (clip.y2<=clip.y1))
continue;
for(i=0; i<nglyph; i++)
{
pci = ppci[i];
xchar = ppos[i].xchar;
/* clip the left and right edges */
if (ppos[i].leftEdge < clip.x1)
leftEdge = clip.x1;
else
leftEdge = ppos[i].leftEdge;
if (ppos[i].rightEdge > clip.x2)
rightEdge = clip.x2;
else
rightEdge = ppos[i].rightEdge;
w = rightEdge - leftEdge;
if (w <= 0)
continue;
/* clip the top and bottom edges */
if (ppos[i].topEdge < clip.y1)
topEdge = clip.y1;
else
topEdge = ppos[i].topEdge;
if (ppos[i].bottomEdge > clip.y2)
bottomEdge = clip.y2;
else
bottomEdge = ppos[i].bottomEdge;
h = bottomEdge - topEdge;
if (h <= 0)
continue;
glyphRow = (topEdge - y) + pci->metrics.ascent;
widthGlyph = ppos[i].widthGlyph;
pglyph = FONTGLYPHBITS(pglyphBase, pci);
pglyph += (glyphRow * widthGlyph);
pdst = ppos[i].pdstBase - ((y-topEdge) * widthDst);
glyphCol = (leftEdge - ppos[i].xpos) -
(pci->metrics.leftSideBearing);
#if GETLEFTBITS_ALIGNMENT > 1
getWidth = w + glyphCol;
#endif
xoff = xchar + (leftEdge - ppos[i].xpos);
if (xoff > PLST)
{
xoff &= PIM;
pdst++;
}
else if (xoff < 0)
{
xoff += PPW;
pdst--;
}
if ((xoff + w) <= PPW)
{
maskpartialbits(xoff, w, startmask);
while (h--)
{
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
pglyph += widthGlyph;
pdst += widthDst;
}
}
else
{
maskPPWbits(xoff, w, startmask, endmask);
nFirst = PPW - xoff;
while (h--)
{
getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc);
UPDRW(pdst,(SCRRIGHT(tmpSrc, xoff) & startmask));
UPDRW(&(pdst[1]),(SCRLEFT(tmpSrc, nFirst) & endmask));
pglyph += widthGlyph;
pdst += widthDst;
}
}
} /* for each glyph */
} /* while nbox-- */
xfree(ppos);
break;
}
default:
break;
}
}

View file

@ -1,976 +0,0 @@
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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.
******************************************************************/
/* GJA -- modified this file for vga16 */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "mi.h"
#include "miline.h"
#include "vgaVideo.h"
#include "wm3.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
/* single-pixel lines on a color frame buffer
NON-SLOPED LINES
horizontal lines are always drawn left to right; we have to
move the endpoints right by one after they're swapped.
horizontal lines will be confined to a single band of a
region. the code finds that band (giving up if the lower
bound of the band is above the line we're drawing); then it
finds the first box in that band that contains part of the
line. we clip the line to subsequent boxes in that band.
vertical lines are always drawn top to bottom (y-increasing.)
this requires adding one to the y-coordinate of each endpoint
after swapping.
SLOPED LINES
when clipping a sloped line, we bring the second point inside
the clipping box, rather than one beyond it, and then add 1 to
the length of the line before drawing it. this lets us use
the same box for finding the outcodes for both endpoints. since
the equation for clipping the second endpoint to an edge gives us
1 beyond the edge, we then have to move the point towards the
first point by one step on the major axis.
eventually, there will be a diagram here to explain what's going
on. the method uses Cohen-Sutherland outcodes to determine
outsideness, and a method similar to Pike's layers for doing the
actual clipping.
*/
#ifdef POLYSEGMENT
static void DoV16SegmentSS(
DrawablePtr, GCPtr, int, xSegment*
);
void
xf4bppSegmentSS (pDrawable, pGC, nseg, pSeg)
DrawablePtr pDrawable;
GCPtr pGC;
int nseg;
register xSegment *pSeg;
{
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
miPolySegment(pDrawable, pGC, nseg, pSeg);
} else {
DO_WM3(pGC,DoV16SegmentSS (pDrawable, pGC, nseg, pSeg));
}
}
#else
static void DoV16LineSS(
DrawablePtr, GCPtr, int, int, DDXPointPtr
);
void
xf4bppLineSS (pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
GCPtr pGC;
int mode; /* Origin or Previous */
int npt; /* number of points */
DDXPointPtr pptInit;
{
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
miZeroLine(pDrawable, pGC, mode, npt, pptInit);
} else {
DO_WM3(pGC,DoV16LineSS (pDrawable, pGC, mode, npt, pptInit));
}
}
#endif
static void
#ifdef POLYSEGMENT
DoV16SegmentSS (pDrawable, pGC, nseg, pSeg)
DrawablePtr pDrawable;
GCPtr pGC;
int nseg;
register xSegment *pSeg;
#else
DoV16LineSS (pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
GCPtr pGC;
int mode; /* Origin or Previous */
int npt; /* number of points */
DDXPointPtr pptInit;
#endif
{
int nboxInit;
register int nbox;
BoxPtr pboxInit;
register BoxPtr pbox;
#ifndef POLYSEGMENT
register DDXPointPtr ppt; /* pointer to list of translated points */
#endif
unsigned int oc1; /* outcode of point 1 */
unsigned int oc2; /* outcode of point 2 */
PixelType *addrlBase; /* pointer to start of drawable */
#ifndef POLYSEGMENT
PixelType *addrl; /* address of destination pixmap */
#endif
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
int adx; /* abs values of dx and dy */
int ady;
int signdx; /* sign of dx and dy */
int signdy;
int e, e1, e2; /* bresenham error and increments */
int len; /* length of segment */
int axis; /* major axis */
int octant;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
/* a bunch of temporaries */
register int y1, y2;
register int x1, x2;
RegionPtr cclip;
#ifndef POLYSEGMENT
int alu = pGC->alu; /* GJA */
#endif
if (!(pGC->planemask & 0x0F))
return;
cclip = pGC->pCompositeClip;
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */
addrlBase = (PixelType *)VIDBASE(pDrawable); /* GJA */
xorg = pDrawable->x;
yorg = pDrawable->y;
#ifdef POLYSEGMENT
while (nseg--)
#else
ppt = pptInit;
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
while(--npt)
#endif
{
nbox = nboxInit;
pbox = pboxInit;
#ifdef POLYSEGMENT
x1 = pSeg->x1 + xorg;
y1 = pSeg->y1 + yorg;
x2 = pSeg->x2 + xorg;
y2 = pSeg->y2 + yorg;
pSeg++;
#else
x1 = x2;
y1 = y2;
++ppt;
if (mode == CoordModePrevious)
{
xorg = x1;
yorg = y1;
}
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
#endif
if (x1 == x2) /* vertical line */
{
/* make the line go top to bottom of screen, keeping
endpoint semantics
*/
if (y1 > y2)
{
register int tmp;
tmp = y2;
y2 = y1 + 1;
y1 = tmp + 1;
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
y1--;
#endif
}
#ifdef POLYSEGMENT
else if (pGC->capStyle != CapNotLast)
y2++;
#endif
/* get to first band that might contain part of line */
while ((nbox) && (pbox->y2 <= y1))
{
pbox++;
nbox--;
}
if (nbox)
{
/* stop when lower edge of box is beyond end of line */
while((nbox) && (y2 >= pbox->y1))
{
if ((x1 >= pbox->x1) && (x1 < pbox->x2))
{
int y1t, y2t;
/* this box has part of the line in it */
y1t = max(y1, pbox->y1);
y2t = min(y2, pbox->y2);
if (y1t != y2t)
{
xf4bppVertS (addrlBase, nlwidth,
x1, y1t, y2t-y1t);
}
}
nbox--;
pbox++;
}
}
#ifndef POLYSEGMENT
y2 = ppt->y + yorg;
#endif
}
else if (y1 == y2) /* horizontal line */
{
/* force line from left to right, keeping
endpoint semantics
*/
if (x1 > x2)
{
register int tmp;
tmp = x2;
x2 = x1 + 1;
x1 = tmp + 1;
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
x1--;
#endif
}
#ifdef POLYSEGMENT
else if (pGC->capStyle != CapNotLast)
x2++;
#endif
/* find the correct band */
while( (nbox) && (pbox->y2 <= y1))
{
pbox++;
nbox--;
}
/* try to draw the line, if we haven't gone beyond it */
if ((nbox) && (pbox->y1 <= y1))
{
int tmp;
/* when we leave this band, we're done */
tmp = pbox->y1;
while((nbox) && (pbox->y1 == tmp))
{
int x1t, x2t;
if (pbox->x2 <= x1)
{
/* skip boxes until one might contain start point */
nbox--;
pbox++;
continue;
}
/* stop if left of box is beyond right of line */
if (pbox->x1 >= x2)
{
nbox = 0;
break;
}
x1t = max(x1, pbox->x1);
x2t = min(x2, pbox->x2);
if (x1t != x2t)
{
xf4bppHorzS (addrlBase, nlwidth,
x1t, y1, x2t-x1t);
}
nbox--;
pbox++;
}
}
#ifndef POLYSEGMENT
x2 = ppt->x + xorg;
#endif
}
else /* sloped line */
{
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy,
1, 1, octant);
if (adx > ady)
{
axis = X_AXIS;
e1 = ady << 1;
e2 = e1 - (adx << 1);
e = e1 - adx;
}
else
{
axis = Y_AXIS;
e1 = adx << 1;
e2 = e1 - (ady << 1);
e = e1 - ady;
SetYMajorOctant(octant);
}
FIXUP_ERROR(e, octant, bias);
/* we have bresenham parameters and two points.
all we have to do now is clip and draw.
*/
while(nbox--)
{
oc1 = 0;
oc2 = 0;
OUTCODES(oc1, x1, y1, pbox);
OUTCODES(oc2, x2, y2, pbox);
if ((oc1 | oc2) == 0)
{
if (axis == X_AXIS)
len = adx;
else
len = ady;
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
len++;
#endif
xf4bppBresS (addrlBase, nlwidth,
signdx, signdy, axis, x1, y1,
e, e1, e2, len);
break;
}
else if (oc1 & oc2)
{
pbox++;
}
else
{
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
int clip1 = 0, clip2 = 0;
int clipdx, clipdy;
int err;
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1,
pbox->y2-1,
&new_x1, &new_y1, &new_x2, &new_y2,
adx, ady, &clip1, &clip2,
octant, bias, oc1, oc2) == -1)
{
pbox++;
continue;
}
if (axis == X_AXIS)
len = abs(new_x2 - new_x1);
else
len = abs(new_y2 - new_y1);
#ifdef POLYSEGMENT
if (clip2 != 0 || pGC->capStyle != CapNotLast)
len++;
#else
len += (clip2 != 0);
#endif
if (len)
{
/* unwind bresenham error term to first point */
if (clip1)
{
clipdx = abs(new_x1 - x1);
clipdy = abs(new_y1 - y1);
if (axis == X_AXIS)
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
else
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
}
else
err = e;
xf4bppBresS (addrlBase, nlwidth,
signdx, signdy, axis, new_x1, new_y1,
err, e1, e2, len);
}
pbox++;
}
} /* while (nbox--) */
} /* sloped line */
} /* while (nline--) */
#ifndef POLYSEGMENT
/* paint the last point if the end style isn't CapNotLast.
(Assume that a projecting, butt, or round cap that is one
pixel wide is the same as the single pixel of the endpoint.)
*/
if ((pGC->capStyle != CapNotLast) &&
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
(ppt == pptInit + 1)))
{
PixelType _mask;
if (alu == RROP_BLACK)
_mask = mfbGetrmask(x2 & PIM);
else
_mask = mfbGetmask(x2 & PIM);
nbox = nboxInit;
pbox = pboxInit;
while (nbox--)
{
if ((x2 >= pbox->x1) &&
(y2 >= pbox->y1) &&
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
addrl = mfbScanline(addrlBase, x2, y2, nlwidth);
UPDRW(addrl,_mask);
break;
}
else
pbox++;
}
}
#endif
}
/*
* Draw dashed 1-pixel lines.
*/
#ifdef POLYSEGMENT
static void DoV16SegmentSD(
DrawablePtr, GCPtr, int, xSegment*
);
void
xf4bppSegmentSD (pDrawable, pGC, nseg, pSeg)
DrawablePtr pDrawable;
GCPtr pGC;
int nseg;
register xSegment *pSeg;
{
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
miPolySegment(pDrawable, pGC, nseg, pSeg);
} else {
DO_WM3(pGC,DoV16SegmentSD (pDrawable, pGC, nseg, pSeg));
}
}
#else
static void DoV16LineSD(
DrawablePtr, GCPtr, int, int, DDXPointPtr
);
void
xf4bppLineSD (pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
GCPtr pGC;
int mode; /* Origin or Previous */
int npt; /* number of points */
DDXPointPtr pptInit;
{
if ( ! xf86Screens[pDrawable->pScreen->myNum]->vtSema ) {
miZeroDashLine(pDrawable, pGC, mode, npt, pptInit);
} else {
DO_WM3(pGC,DoV16LineSD (pDrawable, pGC, mode, npt, pptInit));
}
}
#endif
static void
#ifdef POLYSEGMENT
DoV16SegmentSD (pDrawable, pGC, nseg, pSeg)
DrawablePtr pDrawable;
register GCPtr pGC;
int nseg;
register xSegment *pSeg;
#else
DoV16LineSD( pDrawable, pGC, mode, npt, pptInit)
DrawablePtr pDrawable;
register GCPtr pGC;
int mode; /* Origin or Previous */
int npt; /* number of points */
DDXPointPtr pptInit;
#endif
{
int nboxInit;
register int nbox;
BoxPtr pboxInit;
register BoxPtr pbox;
#ifndef POLYSEGMENT
register DDXPointPtr ppt; /* pointer to list of translated points */
#endif
register unsigned int oc1; /* outcode of point 1 */
register unsigned int oc2; /* outcode of point 2 */
PixelType *addrl; /* address of destination pixmap */
int nlwidth; /* width in longwords of destination pixmap */
int xorg, yorg; /* origin of window */
int adx; /* abs values of dx and dy */
int ady;
int signdx; /* sign of dx and dy */
int signdy;
int e, e1, e2; /* bresenham error and increments */
int len; /* length of segment */
int axis; /* major axis */
int octant;
unsigned int bias = miGetZeroLineBias(pDrawable->pScreen);
int x1, x2, y1, y2;
RegionPtr cclip;
int fgink, bgink; /* GJA */
unsigned char *pDash;
int dashOffset;
int numInDashList;
int dashIndex;
int isDoubleDash;
int dashIndexTmp, dashOffsetTmp;
int unclippedlen;
if (!(pGC->planemask & 0x0F))
return;
cclip = pGC->pCompositeClip;
fgink = bgink = pGC->fgPixel; /* GJA */
pboxInit = REGION_RECTS(cclip);
nboxInit = REGION_NUM_RECTS(cclip);
nlwidth = BYTES_PER_LINE(pDrawable) >> 2; /* GJA */
addrl = (PixelType *)VIDBASE(pDrawable); /* GJA */
/* compute initial dash values */
pDash = (unsigned char *) pGC->dash;
numInDashList = pGC->numInDashList;
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
dashIndex = 0;
dashOffset = 0;
miStepDash ((int)pGC->dashOffset, &dashIndex, pDash,
numInDashList, &dashOffset);
if (isDoubleDash)
bgink = pGC->bgPixel; /* GJA */
xorg = pDrawable->x;
yorg = pDrawable->y;
#ifdef POLYSEGMENT
while (nseg--)
#else
ppt = pptInit;
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
while(--npt)
#endif
{
nbox = nboxInit;
pbox = pboxInit;
#ifdef POLYSEGMENT
x1 = pSeg->x1 + xorg;
y1 = pSeg->y1 + yorg;
x2 = pSeg->x2 + xorg;
y2 = pSeg->y2 + yorg;
pSeg++;
#else
x1 = x2;
y1 = y2;
++ppt;
if (mode == CoordModePrevious)
{
xorg = x1;
yorg = y1;
}
x2 = ppt->x + xorg;
y2 = ppt->y + yorg;
#endif
CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant);
if (adx > ady)
{
axis = X_AXIS;
e1 = ady << 1;
e2 = e1 - (adx << 1);
e = e1 - adx;
unclippedlen = adx;
}
else
{
axis = Y_AXIS;
e1 = adx << 1;
e2 = e1 - (ady << 1);
e = e1 - ady;
unclippedlen = ady;
SetYMajorOctant(octant);
}
FIXUP_ERROR(e, octant, bias);
/* we have bresenham parameters and two points.
all we have to do now is clip and draw.
*/
while(nbox--)
{
oc1 = 0;
oc2 = 0;
OUTCODES(oc1, x1, y1, pbox);
OUTCODES(oc2, x2, y2, pbox);
if ((oc1 | oc2) == 0)
{
#ifdef POLYSEGMENT
if (pGC->capStyle != CapNotLast)
unclippedlen++;
dashIndexTmp = dashIndex;
dashOffsetTmp = dashOffset;
xf4bppBresD (pDrawable, fgink, bgink,
&dashIndexTmp, pDash, numInDashList,
&dashOffsetTmp, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, x1, y1,
e, e1, e2, unclippedlen);
break;
#else
xf4bppBresD (pDrawable, fgink, bgink,
&dashIndex, pDash, numInDashList,
&dashOffset, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, x1, y1,
e, e1, e2, unclippedlen);
goto dontStep;
#endif
}
else if (oc1 & oc2)
{
pbox++;
}
else /* have to clip */
{
int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2;
int clip1 = 0, clip2 = 0;
int clipdx, clipdy;
int err;
if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, pbox->y2-1,
&new_x1, &new_y1, &new_x2, &new_y2,
adx, ady, &clip1, &clip2,
octant, bias, oc1, oc2) == -1)
{
pbox++;
continue;
}
dashIndexTmp = dashIndex;
dashOffsetTmp = dashOffset;
if (clip1)
{
int dlen;
if (axis == X_AXIS)
dlen = abs(new_x1 - x1);
else
dlen = abs(new_y1 - y1);
miStepDash (dlen, &dashIndexTmp, pDash,
numInDashList, &dashOffsetTmp);
}
if (axis == X_AXIS)
len = abs(new_x2 - new_x1);
else
len = abs(new_y2 - new_y1);
#ifdef POLYSEGMENT
if (clip2 != 0 || pGC->capStyle != CapNotLast)
len++;
#else
len += (clip2 != 0);
#endif
if (len)
{
/* unwind bresenham error term to first point */
if (clip1)
{
clipdx = abs(new_x1 - x1);
clipdy = abs(new_y1 - y1);
if (axis == X_AXIS)
err = e+((clipdy*e2) + ((clipdx-clipdy)*e1));
else
err = e+((clipdx*e2) + ((clipdy-clipdx)*e1));
}
else
err = e;
xf4bppBresD (pDrawable, fgink, bgink,
&dashIndexTmp, pDash, numInDashList,
&dashOffsetTmp, isDoubleDash,
addrl, nlwidth,
signdx, signdy, axis, new_x1, new_y1,
err, e1, e2, len);
}
pbox++;
}
} /* while (nbox--) */
#ifndef POLYSEGMENT
/*
* walk the dash list around to the next line
*/
miStepDash (unclippedlen, &dashIndex, pDash,
numInDashList, &dashOffset);
dontStep: ;
#endif
} /* while (nline--) */
#ifndef POLYSEGMENT
/* paint the last point if the end style isn't CapNotLast.
(Assume that a projecting, butt, or round cap that is one
pixel wide is the same as the single pixel of the endpoint.)
*/
if ((pGC->capStyle != CapNotLast) &&
((dashIndex & 1) == 0 || isDoubleDash) &&
((ppt->x + xorg != pptInit->x + pDrawable->x) ||
(ppt->y + yorg != pptInit->y + pDrawable->y) ||
(ppt == pptInit + 1)))
{
nbox = nboxInit;
pbox = pboxInit;
while (nbox--)
{
if ((x2 >= pbox->x1) &&
(y2 >= pbox->y1) &&
(x2 < pbox->x2) &&
(y2 < pbox->y2))
{
unsigned long _mask;
_mask = mfbGetmask(x2 & PIM);
addrl = mfbScanline(addrl, x2, y2, nlwidth);
UPDRW(addrl,_mask);
break;
}
else
pbox++;
}
}
#endif
}
#if 0
#ifndef POLYSEGMENT
/*
the clipping code could be cleaned up some; most of its
mess derives from originally being inline in the line code,
then pulled out to make clipping dashes easier.
*/
int
mfbClipLine(pbox, box,
ppt1Orig, ppt1, ppt2,
adx, ady, signdx, signdy, axis,
pclip1, pclip2)
BoxPtr pbox; /* box to clip to */
BoxRec box; /* box to do calculations with */
DDXPointPtr ppt1Orig, ppt1, ppt2;
int adx, ady;
int signdx, signdy;
register int axis;
int *pclip1, *pclip2;
{
DDXPointRec pt1Orig, pt1, pt2;
register int swapped = 0;
int clipDone = 0;
register unsigned int utmp;
register int oc1, oc2;
int clip1, clip2;
pt1Orig = *ppt1Orig;
pt1 = *ppt1;
pt2 = *ppt2;
clip1 = 0;
clip2 = 0;
do
{
oc1 = 0;
oc2 = 0;
OUTCODES(oc1, pt1.x, pt1.y, pbox);
OUTCODES(oc2, pt2.x, pt2.y, pbox);
if (oc1 & oc2)
clipDone = -1;
else if ((oc1 | oc2) == 0)
{
clipDone = 1;
if (swapped)
{
SWAPPT(pt1, pt2);
SWAPINT(oc1, oc2);
SWAPINT(clip1, clip2);
}
}
else /* have to clip */
{
/* only clip one point at a time */
if (!oc1)
{
SWAPPT(pt1, pt2);
SWAPINT(oc1, oc2);
SWAPINT(clip1, clip2);
swapped = !swapped;
}
clip1 |= oc1;
if (oc1 & OUT_LEFT)
{
pt1.x = box.x1;
utmp = abs(box.x1 - pt1Orig.x);
utmp *= ady;
if(axis==X_AXIS)
{
pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
}
else
{
utmp <<= 1;
if (swapped)
utmp += ady;
else
utmp -= ady;
pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
if (swapped)
pt1.y -= signdy;
}
}
else if (oc1 & OUT_ABOVE)
{
pt1.y = box.y1;
utmp = abs(box.y1 - pt1Orig.y);
utmp *= adx;
if (axis == Y_AXIS)
{
pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
}
else
{
utmp <<= 1;
if (swapped)
utmp += adx;
else
utmp -= adx;
pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
if (swapped)
pt1.x -= signdx;
}
}
else if (oc1 & OUT_RIGHT)
{
pt1.x = box.x2;
utmp = abs(pt1Orig.x - box.x2);
utmp *= ady;
if (axis == X_AXIS)
{
pt1.y = pt1Orig.y + SignTimes(signdy, round(utmp, adx));
}
else
{
utmp <<= 1;
if (swapped)
utmp += ady;
else
utmp -= ady;
pt1.y = pt1Orig.y + SignTimes(signdy, ceiling(utmp, 2*adx));
if (swapped)
pt1.y -= signdy;
}
}
else if (oc1 & OUT_BELOW)
{
pt1.y = box.y2;
utmp = abs(pt1Orig.y - box.y2);
utmp *= adx;
if (axis == Y_AXIS)
{
pt1.x = pt1Orig.x + SignTimes(signdx, round(utmp, ady));
}
else
{
utmp <<= 1;
if (swapped)
utmp += adx;
else
utmp -= adx;
pt1.x = pt1Orig.x + SignTimes(signdx, ceiling(utmp, 2*ady));
if (swapped)
pt1.x -= signdx;
}
}
} /* else have to clip */
} while(!clipDone);
*ppt1 = pt1;
*ppt2 = pt2;
*pclip1 = clip1;
*pclip2 = clip2;
return clipDone;
}
#endif
#endif

View file

@ -1,267 +0,0 @@
/************************************************************
Copyright (c) 1989 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
********************************************************/
/* GJA -- Took mfb code and modified it. */
/* Derived from:
* "Algorithm for drawing ellipses or hyperbolae with a digital plotter"
* by M. L. V. Pitteway
* The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "mi.h"
#include "mizerarc.h"
#include "wm3.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
/*
* Note, LEFTMOST must be the bit leftmost in the actual screen
* representation. This depends on both BITMAP_BIT_ORDER and
* IMAGE_BYTE_ORDER
* DHD 10/92
*/
#if (BITMAP_BIT_ORDER == MSBFirst)
#if (IMAGE_BYTE_ORDER == MSBFirst)
#define LEFTMOST ((unsigned int) 0x80000000)
#else
#define LEFTMOST ((unsigned int) 0x80)
#endif
#else
#if (IMAGE_BYTE_ORDER == LSBFirst)
#define LEFTMOST ((unsigned int) 1)
#else
#define LEFTMOST ((unsigned int) 0x1000000)
#endif
#endif
#define PixelateWhite(addr,off) \
{ \
register int *tmpaddr = &((addr)[(off)>>PWSH]); \
UPDRW(tmpaddr,SCRRIGHT (LEFTMOST, ((off) & PIM))); \
}
#define PixelateBlack(addr,off) \
{ \
register int *tmpaddr = &((addr)[(off)>>PWSH]); \
UPDRW(tmpaddr,~(SCRRIGHT (LEFTMOST, ((off) & PIM)))); \
}
#define Pixelate(base,off) \
{ \
paddr = base + ((off)>>PWSH); \
pmask = SCRRIGHT(LEFTMOST, (off) & PIM); \
UPDRW(paddr,(pixel & pmask)); \
}
#define DoPix(bit,base,off) if (msk & bit) Pixelate(base,off);
static void
v16ZeroArcSS
(
DrawablePtr pDraw,
GCPtr pGC,
xArc *arc
)
{
miZeroArcRec info;
Bool do360;
register int x, y, a, b, d, msk;
register int k1, k3, dx, dy;
int *addrl;
int *yorgl, *yorgol;
unsigned long pixel;
int nlwidth, yoffset, dyoffset;
int pmask;
register int *paddr;
if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
mfbGetGCPrivateKey()))->rop ==
RROP_BLACK)
pixel = 0;
else
pixel = ~0UL;
if (pDraw->type == DRAWABLE_WINDOW)
{
addrl = (int *)
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devPrivate.ptr);
nlwidth = (int)
(((PixmapPtr)(pDraw->pScreen->devPrivate))->devKind) >> 2;
}
else
{
addrl = (int *)(((PixmapPtr)pDraw)->devPrivate.ptr);
nlwidth = (int)(((PixmapPtr)pDraw)->devKind) >> 2;
}
do360 = miZeroArcSetup(arc, &info, TRUE);
yorgl = addrl + ((info.yorg + pDraw->y) * nlwidth);
yorgol = addrl + ((info.yorgo + pDraw->y) * nlwidth);
info.xorg += pDraw->x;
info.xorgo += pDraw->x;
MIARCSETUP();
yoffset = y ? nlwidth : 0;
dyoffset = 0;
msk = info.initialMask;
if (!(arc->width & 1))
{
DoPix(2, yorgl, info.xorgo);
DoPix(8, yorgol, info.xorgo);
}
if (!info.end.x || !info.end.y)
{
msk = info.end.mask;
info.end = info.altend;
}
if (do360 && (arc->width == arc->height) && !(arc->width & 1))
{
int xoffset = nlwidth;
int *yorghl = yorgl + (info.h * nlwidth);
int xorghp = info.xorg + info.h;
int xorghn = info.xorg - info.h;
while (1)
{
PixelateWhite(yorgl + yoffset, info.xorg + x);
PixelateWhite(yorgl + yoffset, info.xorg - x);
PixelateWhite(yorgol- yoffset, info.xorg - x);
PixelateWhite(yorgol - yoffset, info.xorg + x);
if (a < 0)
break;
PixelateWhite(yorghl - xoffset, xorghp - y);
PixelateWhite(yorghl - xoffset, xorghn + y);
PixelateWhite(yorghl + xoffset, xorghn + y);
PixelateWhite(yorghl + xoffset, xorghp - y);
xoffset += nlwidth;
MIARCCIRCLESTEP(yoffset += nlwidth;);
}
x = info.w;
yoffset = info.h * nlwidth;
}
else if (do360)
{
while (y < info.h || x < info.w)
{
MIARCOCTANTSHIFT(dyoffset = nlwidth;);
Pixelate(yorgl + yoffset, info.xorg + x);
Pixelate(yorgl + yoffset, info.xorgo - x);
Pixelate(yorgol - yoffset, info.xorgo - x);
Pixelate(yorgol - yoffset, info.xorg + x);
MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
}
}
else
{
while (y < info.h || x < info.w)
{
MIARCOCTANTSHIFT(dyoffset = nlwidth;);
if ((x == info.start.x) || (y == info.start.y))
{
msk = info.start.mask;
info.start = info.altstart;
}
DoPix(1, yorgl + yoffset, info.xorg + x);
DoPix(2, yorgl + yoffset, info.xorgo - x);
DoPix(4, yorgol - yoffset, info.xorgo - x);
DoPix(8, yorgol - yoffset, info.xorg + x);
if ((x == info.end.x) || (y == info.end.y))
{
msk = info.end.mask;
info.end = info.altend;
}
MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;);
}
}
if ((x == info.start.x) || (y == info.start.y))
msk = info.start.mask;
DoPix(1, yorgl + yoffset, info.xorg + x);
DoPix(4, yorgol - yoffset, info.xorgo - x);
if (arc->height & 1)
{
DoPix(2, yorgl + yoffset, info.xorgo - x);
DoPix(8, yorgol - yoffset, info.xorg + x);
}
}
static void
xf4bppZeroPolyArcSS
(
DrawablePtr pDraw,
GCPtr pGC,
int narcs,
xArc *parcs
)
{
register xArc *arc;
register int i;
BoxRec box;
RegionPtr cclip;
if (!pGC->planemask & 0x0F)
return;
cclip = pGC->pCompositeClip;
for (arc = parcs, i = narcs; --i >= 0; arc++)
{
if (miCanZeroArc(arc))
{
box.x1 = arc->x + pDraw->x;
box.y1 = arc->y + pDraw->y;
box.x2 = box.x1 + (int)arc->width + 1;
box.y2 = box.y1 + (int)arc->height + 1;
if (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN)
v16ZeroArcSS(pDraw, pGC, arc);
else
miZeroPolyArc(pDraw, pGC, 1, arc);
}
else
miPolyArc(pDraw, pGC, 1, arc);
}
}
void
xf4bppZeroPolyArc(pDraw, pGC, narcs, parcs)
DrawablePtr pDraw;
GCPtr pGC;
int narcs;
xArc *parcs;
{
if ( !xf86Screens[pDraw->pScreen->myNum]->vtSema ) {
miZeroPolyArc(pDraw, pGC, narcs, parcs);
} else {
DO_WM3(pGC,xf4bppZeroPolyArcSS(pDraw, pGC, narcs, parcs));
}
}

View file

@ -1,342 +0,0 @@
/*
* Copyright 1993 Gerrit Jan Akkerman
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 Gerrit Jan Akkerman not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* GERRIT JAN AKKERMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL GERRIT JAN AKKERMAN 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.
*
*/
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "vgaVideo.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
#define saved_screen(pWin) \
((unsigned char *)(((PixmapPtr)((pWin)->drawable.pScreen->devPrivate))->devPrivate.ptr))
#define SAVEDSCREEN(pWin, x, y) \
(*(saved_screen(pWin) + (y) * (BYTES_PER_LINE(pWin)) + (x)))
#define DO_ROP(src,dst,alu,planes) \
((dst) = do_rop((src),(dst),(alu),(planes)))
/* NOTE:
* The following to functions don't do anything. They're just there to
* provide a stable interface to the rest of the system.
*/
static int
do_rop
(
int src,
int dst,
int alu,
const unsigned long planes
)
{
int _dst; /* New dst */
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
_dst = 0; break ;
case GXinvert: /* 0xa NOT dst */
_dst = ~dst; break ;
case GXset: /* 0xf 1 */
_dst = src; break ;
default:
case GXnoop: /* 0x5 dst */
return dst;
case GXnor: /* 0x8 NOT src AND NOT dst */
_dst = ~src & ~dst; break ;
case GXandInverted: /* 0x4 NOT src AND dst */
_dst = ~src & dst; break ;
case GXand: /* 0x1 src AND dst */
_dst = src & dst; break ;
case GXequiv: /* 0x9 NOT src XOR dst */
_dst = ~src ^ dst; break ;
case GXxor: /* 0x6 src XOR dst */
_dst = src ^ dst; break ;
case GXandReverse: /* 0x2 src AND NOT dst */
_dst = src & ~dst; break ;
case GXnand: /* 0xe NOT src OR NOT dst */
_dst = ~src | ~dst; break ;
case GXorReverse: /* 0xb src OR NOT dst */
_dst = src | ~dst; break ;
case GXorInverted: /* 0xd NOT src OR dst */
_dst = ~src | dst; break ;
case GXor: /* 0x7 src OR dst */
_dst = src | dst; break ;
case GXcopyInverted: /* 0xc NOT src */
_dst = ~src; break ;
case GXcopy: /* 0x3 src */
_dst = src; break ;
}
return (dst & ~planes) | (_dst & planes);
}
/* File vgaBitBlt.c */
void
xf4bppOffBitBlt( pWin, alu, writeplanes, x0, y0, x1, y1, w, h )
WindowPtr pWin; /* GJA */
const int alu, writeplanes ;
register int x0 ;
int y0 ;
register int x1 ;
int y1 ;
register int w, h ;
{
int x,y;
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXinvert: /* 0xa NOT dst */
case GXset: /* 0xf 1 */
xf4bppOffFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes,
x0, y0, w, h ) ;
case GXnoop: /* 0x5 dst */
return ;
default:
break ;
}
if ( (w <= 0) || (h <= 0) ) return;
for ( y = 0 ; y < h ; y++ ) {
for ( x = 0 ; x < w ; x++ ) {
DO_ROP(SAVEDSCREEN(pWin,x0+x,y0+y),SAVEDSCREEN(pWin,x1+x,y1+y),
alu,writeplanes);
}
}
}
/* for file vgaImages.c */
void
xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
WindowPtr pWin; /* GJA */
int x, y ;
register int w, h ;
unsigned char *data ;
register int RowIncrement ;
const int alu ;
const unsigned long int planes ;
{
int dx,dy;
for ( dy = 0 ; dy < h ; dy++ ) {
for ( dx = 0 ; dx < w ; dx++ ) {
DO_ROP( data[dy * RowIncrement + dx],
SAVEDSCREEN(pWin,x+dx,y+dy), alu, planes);
}
}
}
void
xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
WindowPtr pWin; /* GJA */
int x, y ;
int lx, ly ;
unsigned char *data ;
int RowIncrement ;
{
int dx, dy;
if ( ( lx <= 0 ) || ( ly <= 0 ) )
return ;
for ( dy = 0 ; dy < ly ; dy++ ) {
for ( dx = 0 ; dx < lx ; dx++ ) {
data[dy*RowIncrement+dx] = SAVEDSCREEN(pWin,x+dx,y+dy);
}
}
}
/* For file vgaSolid.c */
void xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
WindowPtr pWin; /* GJA */
unsigned long int color ;
const int alu ;
unsigned long int planes ;
register int x0 ;
register const int y0 ;
register int lx ;
register const int ly ; /* MUST BE > 0 !! */
{
int dx, dy;
if ( ( lx == 0 ) || ( ly == 0 ) )
return;
for ( dy = 0 ; dy < ly ; dy++ ) {
for ( dx = 0 ; dx < lx ; dx++ ) {
DO_ROP(color,SAVEDSCREEN(pWin, x0+dx,y0+dy),alu,planes);
}
}
}
/* For file vgaStipple.c */
/* GJA -- modified this to take both Width and Height, and to
* reduce x and y to Width and Height by taking remainders.
*/
static unsigned char
xygetbits
(
register int x,
register int y,
register const unsigned int Width,
register const unsigned int paddedByteWidth,
register const unsigned int Height,
register const unsigned char * const data
)
{
register unsigned char bits ;
unsigned const char *lineptr, *cptr ;
register int shift ;
register int wrap ;
x = x % Width;
y = y % Height;
lineptr = data + (y * paddedByteWidth);
cptr = lineptr + (x >> 3) ;
bits = *cptr ;
if ((shift = x & 7))
bits = SCRLEFT8( bits, shift ) |
SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
if ( ( wrap = x + 8 - Width ) > 0 ) {
bits &= SCRLEFT8( 0xFF, wrap ) ;
bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
}
return bits ;
}
static void
DoMono
(
WindowPtr pWin, /* GJA */
int w,
int x,
int y,
register const unsigned char *mastersrc,
int h,
unsigned int width,
register unsigned int paddedByteWidth,
unsigned int height,
int xshift,
int yshift,
int alu,
int planes,
int fg
)
{
int dy, dx, i;
int byte;
for ( dy = 0 ; dy < h ; dy++ ) {
for ( dx = 0; dx <= w - 8 ; dx += 8 ) {
/* get next byte */
byte = xygetbits(dx+xshift,dy+yshift,width,
paddedByteWidth, height, mastersrc);
for ( i = 0 ; i < 8 ; i++ ) {
if ( byte & (128 >> i) ) {
DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
alu,planes);
}
}
}
/* get last bits */
byte = xygetbits(dx+xshift,dy+yshift,width,
paddedByteWidth, height, mastersrc);
for ( i = 0 ; i < (w - dx) ; i++ ) {
if ( byte & (128 >> i) ) {
DO_ROP(fg,SAVEDSCREEN(pWin,x+dx+i,y+dy),
alu,planes);
}
}
}
}
void
xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
WindowPtr pWin; /* GJA */
register PixmapPtr const pStipple ;
unsigned long int fg ;
const int alu ;
unsigned long int planes ;
int x, y, w, h ;
const int xSrc, ySrc ;
{
unsigned int width ;
unsigned int height ;
int xshift ;
int yshift ;
if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
return ;
/* Figure Bit Offsets & Source Address */
width = pStipple->drawable.width ;
if ( ( xshift = ( x - xSrc ) ) < 0 )
xshift = width - ( ( - xshift ) % width ) ;
else
xshift %= width ;
height = pStipple->drawable.height ;
if ( ( yshift = ( y - ySrc ) ) < 0 )
yshift = height - ( ( - yshift ) % height ) ;
else
yshift %= height ;
DoMono( pWin, w, x, y,
(const unsigned char *) pStipple->devPrivate.ptr,
h,
width,
( ( width + 31 ) & (unsigned)(~31) ) >> 3,
height,
xshift, yshift,
alu, (int)planes, (int)fg ) ;
return ;
}

View file

@ -1,97 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/*
* ppc solid area fill
*
* Tom Paquin 8/87
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "ppcGCstr.h"
#include "ibmTrace.h"
void
xf4bppFillArea( pWin, nboxes, pBox, pGC )
register WindowPtr pWin ;
register int nboxes ;
register BoxPtr pBox ;
GCPtr pGC ;
{
register int x, y, w, h ;
int alu ;
unsigned long int fg, bg, pm ;
int xSrc, ySrc ;
PixmapPtr pPixmap ;
ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ;
if ( ( alu = pPrivGC->colorRrop.alu ) == GXnoop || !nboxes )
return ;
xSrc = pGC->patOrg.x + pWin->drawable.x ;
ySrc = pGC->patOrg.y + pWin->drawable.y ;
pm = pPrivGC->colorRrop.planemask ;
fg = pPrivGC->colorRrop.fgPixel ;
bg = pPrivGC->colorRrop.bgPixel ;
nboxes++ ;
switch ( pPrivGC->colorRrop.fillStyle ) {
case FillTiled:
for ( pPixmap = pGC->tile.pixmap ; --nboxes ; pBox++ )
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
xf4bppTileRect( pWin, pPixmap, alu, pm,
x, y, w, h, xSrc, ySrc ) ;
break ;
case FillOpaqueStippled:
for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
xf4bppOpaqueStipple( pWin, pPixmap, fg, bg, alu, pm,
x, y, w, h, xSrc, ySrc ) ;
break ;
case FillStippled:
for ( pPixmap = pGC->stipple ; --nboxes ; pBox++ )
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
xf4bppFillStipple( pWin, pPixmap, fg, alu, pm,
x, y, w, h, xSrc, ySrc ) ;
break ;
case FillSolid:
for ( ; --nboxes ; pBox++ )
if ( ( w = pBox->x2 - ( x = pBox->x1 ) )
&& ( h = pBox->y2 - ( y = pBox->y1 ) ) )
xf4bppFillSolid( pWin, fg, alu, pm, x, y, w, h ) ;
break ;
}
}

View file

@ -1,237 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "ppcGCstr.h"
/* xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
* An attempt to do "strength reduction" on color raster-ops
* P. Shupak 1/88
*/
static void
ppcReduceGeneral
(
register int alu,
register unsigned long pm,
register unsigned long fg,
register unsigned long bg,
register int fillStyle,
int drawableDepth,
ppcReducedRrop *returnLoc
)
{
if ( ( alu == GXnoop )
|| !( pm &= ( ( 1 << drawableDepth ) - 1 ) ) ) {
returnLoc->alu = GXnoop ;
return ;
}
#ifdef DELETE_THIS
switch ( fillStyle ) {
case FillTiled:
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXinvert: /* 0xa NOT dst */
case GXset: /* 0xf 1 */
fillStyle = FillSolid ;
default: /* We Can't Do Much Here */
break ;
}
break ;
case FillOpaqueStippled:
if ( ( fg & pm ) != ( bg & pm ) ) { /* else FillSolid */
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXset: /* 0xf 1 */
case GXinvert: /* 0xa NOT dst */
fillStyle = FillSolid ;
break ;
case GXnor: /* 0x8 NOT src AND NOT dst */
case GXnand: /* 0xe NOT src OR NOT dst */
case GXcopy: /* 0x3 src */
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
fg = ~fg ;
bg = ~bg ;
alu = GXnor ;
break ;
case GXandInverted: /* 0x4 NOT src AND dst */
fg = ~fg ;
bg = ~bg ;
alu = GXand ; /* Fall Through */
case GXand: /* 0x1 src AND dst */
pm &= ~( fg & bg ) ;
if ( ( bg & pm ) == pm ) {
fillStyle = FillStippled ;
alu = GXclear ;
}
break ;
case GXequiv: /* 0x9 NOT src XOR dst */
fg = ~fg ;
bg = ~bg ;
alu = GXxor ; /* Fall Through */
case GXxor: /* 0x6 src XOR dst */
pm &= ( fg | bg ) ;
if ( !( bg & pm ) ) {
fillStyle = FillStippled ;
alu = GXinvert ;
}
break ;
case GXorReverse: /* 0xb src OR NOT dst */
fg = ~fg ;
bg = ~bg ;
alu = GXnand ;
break ;
case GXcopyInverted: /* 0xc NOT src */
fg = ~fg ;
bg = ~bg ;
alu = GXcopy ;
break ;
case GXorInverted: /* 0xd NOT src OR dst */
fg = ~fg ;
bg = ~bg ;
alu = GXor ; /* Fall Through */
case GXor: /* 0x7 src OR dst */
pm &= ( fg | bg ) ;
if ( !( bg & pm ) ) {
fillStyle = FillStippled ;
alu = GXset ;
}
break ;
default:
ErrorF(
"xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
break ;
}
break ; /* Don't Fall Through */
}
else
fillStyle = FillSolid ;
/* Fall Through */
case FillStippled:
case FillSolid:
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXset: /* 0xf 1 */
case GXinvert: /* 0xa NOT dst */
break ;
case GXand: /* 0x1 src AND dst */
pm &= ~fg ;
alu = GXclear ;
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
fg = ~fg ;
alu = GXnor ; /* Fall Through */
case GXnor: /* 0x8 NOT src AND NOT dst */
if ( !( fg & pm ) )
alu = GXclear ;
else if ( ( fg & pm ) == pm )
alu = GXinvert ;
break ;
case GXandInverted: /* 0x4 NOT src AND dst */
pm &= fg ;
alu = GXclear ;
break ;
case GXxor: /* 0x6 src XOR dst */
pm &= fg ;
alu = GXinvert ;
break ;
case GXor: /* 0x7 src OR dst */
pm &= fg ;
alu = GXset ;
break ;
case GXequiv: /* 0x9 NOT src XOR dst */
pm &= ~fg ;
alu = GXinvert ;
break ;
case GXorReverse: /* 0xb src OR NOT dst */
fg = ~fg ;
alu = GXnand ; /* Fall Through */
case GXnand: /* 0xe NOT src OR NOT dst */
if ( !( fg & pm ) )
alu = GXset ;
else if ( ( fg & pm ) == pm )
alu = GXinvert ;
break ;
case GXcopyInverted: /* 0xc NOT src */
fg = ~fg ;
alu = GXcopy ; /* Fall Through */
case GXcopy: /* 0x3 src */
if ( !( fg & pm ) )
alu = GXclear ;
else if ( ( fg & pm ) == pm )
alu = GXset ;
break ;
case GXorInverted: /* 0xd NOT src OR dst */
pm &= ~fg ;
alu = GXset ;
break ;
default:
ErrorF(
"xf4bppGetReducedColorRrop: Unknown Alu Raster-Op" ) ;
break ;
}
break;
default:
ErrorF("xf4bppGetReducedColorRrop: Bad Fillstyle\n");
break;
}
#endif
/* Final Test On Restricted Plane Mask */
if ( !pm )
alu = GXnoop ;
/* Set Actual Returned Values */
returnLoc->planemask = pm ;
returnLoc->fgPixel = fg ;
returnLoc->bgPixel = bg ;
returnLoc->alu = alu ;
returnLoc->fillStyle = fillStyle ;
return ;
}
void
xf4bppGetReducedColorRrop( pGC, drawableDepth, returnLoc )
GC *pGC ;
int drawableDepth ;
ppcReducedRrop *returnLoc ;
{
ppcReduceGeneral( pGC->alu,
pGC->planemask,
pGC->fgPixel,
pGC->bgPixel,
pGC->fillStyle,
drawableDepth,
returnLoc ) ;
return ;
}

View file

@ -1,157 +0,0 @@
/*
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright IBM Corporation 1987,1988,1989
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM 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.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "scrnintstr.h"
void
xf4bppDestroyClip(pGC)
GCPtr pGC;
{
if(pGC->clientClipType == CT_NONE)
return;
else if (pGC->clientClipType == CT_PIXMAP)
{
mfbDestroyPixmap((PixmapPtr)(pGC->clientClip));
}
else
{
/* we know we'll never have a list of rectangles, since
ChangeClip immediately turns them into a region
*/
REGION_DESTROY(pGC->pScreen, pGC->clientClip);
}
pGC->clientClip = NULL;
pGC->clientClipType = CT_NONE;
}
void
xf4bppChangeClip(pGC, type, pvalue, nrects)
GCPtr pGC;
int type;
pointer pvalue;
int nrects;
{
xf4bppDestroyClip(pGC);
if(type == CT_PIXMAP)
{
/* convert the pixmap to a region */
pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pvalue);
/* you wouldn't do this if you were leaving the pixmap in
rather than converting it.
*/
(*pGC->pScreen->DestroyPixmap)(pvalue);
}
else if (type == CT_REGION)
{
/* stuff the region in the GC */
pGC->clientClip = pvalue;
}
else if (type != CT_NONE)
{
pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
(xRectangle *)pvalue,
type);
xfree(pvalue);
}
pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION :
CT_NONE;
pGC->stateChanges |= GCClipMask;
}
void
xf4bppCopyClip (pgcDst, pgcSrc)
GCPtr pgcDst, pgcSrc;
{
RegionPtr prgnNew;
switch(pgcSrc->clientClipType)
{
case CT_PIXMAP:
((PixmapPtr) pgcSrc->clientClip)->refcnt++;
/* Fall through !! */
case CT_NONE:
xf4bppChangeClip(pgcDst, pgcSrc->clientClipType, pgcSrc->clientClip, 0);
break;
case CT_REGION:
prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
REGION_COPY(pgcSrc->pScreen, prgnNew, (RegionPtr)(pgcSrc->clientClip));
xf4bppChangeClip(pgcDst, CT_REGION, (pointer)prgnNew, 0);
break;
}
}

View file

@ -1,470 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "mfbmap.h"
#define PSZ 8
#include "mfb.h"
#include "mergerop.h"
#include "mi.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
/*
* Graft in the DoBitblt from cfb. It does everything correctly.
*/
static void
vga16DoBitblt
(
DrawablePtr pSrc,
DrawablePtr pDst,
int alu,
RegionPtr prgnDst,
DDXPointPtr pptSrc,
unsigned long planemask
)
{
int widthSrc, widthDst; /* add to get to same position in next line */
BoxPtr pbox;
int nbox;
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
/* temporaries for shuffling rectangles */
DDXPointPtr pptTmp, pptNew1, pptNew2;
/* shuffling boxes entails shuffling the
source points too */
int w, h;
int careful;
widthSrc = mfbGetPixelWidth(pSrc);
widthDst = mfbGetPixelWidth(pDst);
/* XXX we have to err on the side of safety when both are windows,
* because we don't know if IncludeInferiors is being used.
*/
careful = ((pSrc == pDst) ||
((pSrc->type == DRAWABLE_WINDOW) &&
(pDst->type == DRAWABLE_WINDOW)));
pbox = REGION_RECTS(prgnDst);
nbox = REGION_NUM_RECTS(prgnDst);
pboxNew1 = NULL;
pptNew1 = NULL;
pboxNew2 = NULL;
pptNew2 = NULL;
if (careful && (pptSrc->y < pbox->y1))
{
/* walk source botttom to top */
widthSrc = -widthSrc;
widthDst = -widthDst;
if (nbox > 1)
{
/* keep ordering in each band, reverse order of bands */
pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
if(!pboxNew1)
return;
pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
if(!pptNew1)
{
xfree(pboxNew1);
return;
}
pboxBase = pboxNext = pbox+nbox-1;
while (pboxBase >= pbox)
{
while ((pboxNext >= pbox) &&
(pboxBase->y1 == pboxNext->y1))
pboxNext--;
pboxTmp = pboxNext+1;
pptTmp = pptSrc + (pboxTmp - pbox);
while (pboxTmp <= pboxBase)
{
*pboxNew1++ = *pboxTmp++;
*pptNew1++ = *pptTmp++;
}
pboxBase = pboxNext;
}
pboxNew1 -= nbox;
pbox = pboxNew1;
pptNew1 -= nbox;
pptSrc = pptNew1;
}
}
if (careful && (pptSrc->x < pbox->x1))
{
if (nbox > 1)
{
/* reverse order of rects in each band */
pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
if(!pboxNew2 || !pptNew2)
{
if (pptNew2) xfree(pptNew2);
if (pboxNew2) xfree(pboxNew2);
if (pboxNew1)
{
xfree(pptNew1);
xfree(pboxNew1);
}
return;
}
pboxBase = pboxNext = pbox;
while (pboxBase < pbox+nbox)
{
while ((pboxNext < pbox+nbox) &&
(pboxNext->y1 == pboxBase->y1))
pboxNext++;
pboxTmp = pboxNext;
pptTmp = pptSrc + (pboxTmp - pbox);
while (pboxTmp != pboxBase)
{
*pboxNew2++ = *--pboxTmp;
*pptNew2++ = *--pptTmp;
}
pboxBase = pboxNext;
}
pboxNew2 -= nbox;
pbox = pboxNew2;
pptNew2 -= nbox;
pptSrc = pptNew2;
}
}
while(nbox--)
{
w = pbox->x2 - pbox->x1;
h = pbox->y2 - pbox->y1;
if( pSrc->type == DRAWABLE_WINDOW )
xf4bppBitBlt( (WindowPtr)pDst, alu, planemask,
pptSrc->x, /* x0 */
pptSrc->y, /* y0 */
pbox->x1, /* x1 */
pbox->y1, /* y1 */
w, h ); /* w, h */
else /* DRAWABLE_PIXMAP */
xf4bppDrawColorImage( (WindowPtr)pDst,
pbox->x1, pbox->y1,
w,
h,
((unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr
+ pptSrc->x + (pptSrc->y*((PixmapPtr)pSrc)->devKind)),
((PixmapPtr)pSrc)->devKind,
alu, planemask ) ;
pbox++;
pptSrc++;
}
if (pboxNew2)
{
xfree(pptNew2);
xfree(pboxNew2);
}
if (pboxNew1)
{
xfree(pptNew1);
xfree(pboxNew1);
}
}
/*
* Graft in the CopyArea from mfb/cfb. It does everything correctly.
*/
RegionPtr
xf4bppCopyArea(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty)
register DrawablePtr pSrcDrawable;
register DrawablePtr pDstDrawable;
register GC *pGC;
int srcx, srcy;
int width, height;
int dstx, dsty;
{
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
Bool freeSrcClip = FALSE;
RegionPtr prgnExposed;
RegionRec rgnDst;
DDXPointPtr pptSrc;
register DDXPointPtr ppt;
register BoxPtr pbox;
int i;
register int dx;
register int dy;
xRectangle origSource;
DDXPointRec origDest;
int numRects;
BoxRec fastBox;
int fastClip = 0; /* for fast clipping with pixmap source */
int fastExpose = 0; /* for fast exposures with pixmap source */
if ( pDstDrawable->type != DRAWABLE_WINDOW )
return miCopyArea( pSrcDrawable, pDstDrawable, pGC,
srcx, srcy, width, height, dstx, dsty ) ;
/* Begin code from mfb/cfbCopyArea */
origSource.x = srcx;
origSource.y = srcy;
origSource.width = width;
origSource.height = height;
origDest.x = dstx;
origDest.y = dsty;
if ((pSrcDrawable != pDstDrawable) &&
pSrcDrawable->pScreen->SourceValidate)
{
(*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height);
}
srcx += pSrcDrawable->x;
srcy += pSrcDrawable->y;
/* clip the source */
if (pSrcDrawable->type == DRAWABLE_PIXMAP)
{
if ((pSrcDrawable == pDstDrawable) &&
(pGC->clientClipType == CT_NONE))
{
prgnSrcClip = pGC->pCompositeClip;
}
else
{
fastClip = 1;
}
}
else
{
if (pGC->subWindowMode == IncludeInferiors)
{
if (!((WindowPtr) pSrcDrawable)->parent)
{
/*
* special case bitblt from root window in
* IncludeInferiors mode; just like from a pixmap
*/
fastClip = 1;
}
else if ((pSrcDrawable == pDstDrawable) &&
(pGC->clientClipType == CT_NONE))
{
prgnSrcClip = pGC->pCompositeClip;
}
else
{
prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
freeSrcClip = TRUE;
}
}
else
{
prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
}
}
fastBox.x1 = srcx;
fastBox.y1 = srcy;
fastBox.x2 = srcx + width;
fastBox.y2 = srcy + height;
/* Don't create a source region if we are doing a fast clip */
if (fastClip)
{
fastExpose = 1;
/*
* clip the source; if regions extend beyond the source size,
* make sure exposure events get sent
*/
if (fastBox.x1 < pSrcDrawable->x)
{
fastBox.x1 = pSrcDrawable->x;
fastExpose = 0;
}
if (fastBox.y1 < pSrcDrawable->y)
{
fastBox.y1 = pSrcDrawable->y;
fastExpose = 0;
}
if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
{
fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
fastExpose = 0;
}
if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
{
fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
fastExpose = 0;
}
}
else
{
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
}
dstx += pDstDrawable->x;
dsty += pDstDrawable->y;
if (pDstDrawable->type == DRAWABLE_WINDOW)
{
if (!((WindowPtr)pDstDrawable)->realized)
{
if (!fastClip)
REGION_UNINIT(pGC->pScreen, &rgnDst);
if (freeSrcClip)
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
return NULL;
}
}
dx = srcx - dstx;
dy = srcy - dsty;
/* Translate and clip the dst to the destination composite clip */
if (fastClip)
{
RegionPtr cclip;
/* Translate the region directly */
fastBox.x1 -= dx;
fastBox.x2 -= dx;
fastBox.y1 -= dy;
fastBox.y2 -= dy;
/* If the destination composite clip is one rectangle we can
do the clip directly. Otherwise we have to create a full
blown region and call intersect */
cclip = pGC->pCompositeClip;
if (REGION_NUM_RECTS(cclip) == 1)
{
BoxPtr pBox = REGION_RECTS(cclip);
if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
/* Check to see if the region is empty */
if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2)
{
REGION_NULL(pGC->pScreen, &rgnDst);
}
else
{
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
}
}
else
{
/* We must turn off fastClip now, since we must create
a full blown region. It is intersected with the
composite clip below. */
fastClip = 0;
REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
}
}
else
{
REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
}
if (!fastClip)
{
REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip);
}
/* Do bit blitting */
numRects = REGION_NUM_RECTS(&rgnDst);
if (numRects && width && height)
{
if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
sizeof(DDXPointRec))))
{
REGION_UNINIT(pGC->pScreen, &rgnDst);
if (freeSrcClip)
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
return NULL;
}
pbox = REGION_RECTS(&rgnDst);
ppt = pptSrc;
for (i = numRects; --i >= 0; pbox++, ppt++)
{
ppt->x = pbox->x1 + dx;
ppt->y = pbox->y1 + dy;
}
vga16DoBitblt(pSrcDrawable, pDstDrawable, pGC->alu,
&rgnDst, pptSrc, pGC->planemask );
xfree(pptSrc);
}
prgnExposed = NULL;
if (pGC->fExpose)
{
/* Pixmap sources generate a NoExposed (we return NULL to do this) */
if (!fastExpose)
prgnExposed =
miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
origSource.x, origSource.y,
(int)origSource.width,
(int)origSource.height,
origDest.x, origDest.y, (unsigned long)0);
}
REGION_UNINIT(pGC->pScreen, &rgnDst);
if (freeSrcClip)
REGION_DESTROY(pGC->pScreen, prgnSrcClip);
return prgnExposed;
}

View file

@ -1,53 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/* Check to see if the alleged depth is acceptable for the Screen
*
* T. Paquin 9/87
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "scrnintstr.h"
Bool
xf4bppDepthOK(pDraw,depth)
register DrawablePtr pDraw;
register int depth;
{
register ScreenPtr pScreen= pDraw->pScreen;
register int i = pScreen->numDepths;
if ( ( pDraw->type == DRAWABLE_PIXMAP ) && ( depth == 1 ) )
return TRUE ;
while ( i-- )
if ( depth == pScreen->allowedDepths[i].depth )
return TRUE ;
return FALSE ;
}

View file

@ -1,215 +0,0 @@
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "scrnintstr.h"
#define MODEQ(a, b) ((a) %= (b))
/*
filled rectangles.
translate the rectangles, clip them, and call the
helper function in the GC.
*/
#define NUM_STACK_RECTS 1024
void
xf4bppPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
DrawablePtr pDrawable;
GCPtr pGC;
int nrectFill; /* number of rectangles to fill */
xRectangle *prectInit; /* Pointer to first rectangle to fill */
{
xRectangle *prect;
RegionPtr prgnClip;
register BoxPtr pbox;
register BoxPtr pboxClipped;
BoxPtr pboxClippedBase;
BoxPtr pextent;
BoxRec stackRects[NUM_STACK_RECTS];
int numRects;
int n;
int xorg, yorg;
if (!(pGC->planemask & 0x0F)) /* GJA */
return;
prgnClip = pGC->pCompositeClip;
prect = prectInit;
xorg = pDrawable->x;
yorg = pDrawable->y;
if (xorg || yorg)
{
prect = prectInit;
n = nrectFill;
Duff (n, prect->x += xorg; prect->y += yorg; prect++);
}
prect = prectInit;
numRects = REGION_NUM_RECTS(prgnClip) * nrectFill;
if (numRects > NUM_STACK_RECTS)
{
pboxClippedBase = (BoxPtr)xalloc(numRects * sizeof(BoxRec));
if (!pboxClippedBase)
return;
}
else
pboxClippedBase = stackRects;
pboxClipped = pboxClippedBase;
if (REGION_NUM_RECTS(prgnClip) == 1)
{
int x1, y1, x2, y2, bx2, by2;
pextent = REGION_RECTS(prgnClip);
x1 = pextent->x1;
y1 = pextent->y1;
x2 = pextent->x2;
y2 = pextent->y2;
while (nrectFill--)
{
if ((pboxClipped->x1 = prect->x) < x1)
pboxClipped->x1 = x1;
if ((pboxClipped->y1 = prect->y) < y1)
pboxClipped->y1 = y1;
bx2 = (int) prect->x + (int) prect->width;
if (bx2 > x2)
bx2 = x2;
pboxClipped->x2 = bx2;
by2 = (int) prect->y + (int) prect->height;
if (by2 > y2)
by2 = y2;
pboxClipped->y2 = by2;
prect++;
if ((pboxClipped->x1 < pboxClipped->x2) &&
(pboxClipped->y1 < pboxClipped->y2))
{
pboxClipped++;
}
}
}
else
{
int x1, y1, x2, y2, bx2, by2;
pextent = REGION_EXTENTS(pGC->pScreen, prgnClip);
x1 = pextent->x1;
y1 = pextent->y1;
x2 = pextent->x2;
y2 = pextent->y2;
while (nrectFill--)
{
BoxRec box;
if ((box.x1 = prect->x) < x1)
box.x1 = x1;
if ((box.y1 = prect->y) < y1)
box.y1 = y1;
bx2 = (int) prect->x + (int) prect->width;
if (bx2 > x2)
bx2 = x2;
box.x2 = bx2;
by2 = (int) prect->y + (int) prect->height;
if (by2 > y2)
by2 = y2;
box.y2 = by2;
prect++;
if ((box.x1 >= box.x2) || (box.y1 >= box.y2))
continue;
n = REGION_NUM_RECTS (prgnClip);
pbox = REGION_RECTS(prgnClip);
/* clip the rectangle to each box in the clip region
this is logically equivalent to calling Intersect()
*/
while(n--)
{
pboxClipped->x1 = max(box.x1, pbox->x1);
pboxClipped->y1 = max(box.y1, pbox->y1);
pboxClipped->x2 = min(box.x2, pbox->x2);
pboxClipped->y2 = min(box.y2, pbox->y2);
pbox++;
/* see if clipping left anything */
if(pboxClipped->x1 < pboxClipped->x2 &&
pboxClipped->y1 < pboxClipped->y2)
{
pboxClipped++;
}
}
}
}
if (pboxClipped != pboxClippedBase)
xf4bppFillArea((WindowPtr)pDrawable, pboxClipped-pboxClippedBase,
pboxClippedBase, pGC);
if (pboxClippedBase != stackRects)
xfree(pboxClippedBase);
}

View file

@ -1,446 +0,0 @@
/*
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright IBM Corporation 1987,1988,1989
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM 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.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "mi.h"
#include "scrnintstr.h"
#include "ppcGCstr.h"
#include "vgaVideo.h"
#include "ibmTrace.h"
#define ppcGCInterestValidateMask \
( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground \
| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \
| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr);
static void xf4bppDestroyGC(GC *);
static GCFuncs vgaGCFuncs = {
xf4bppValidateGC,
(void (*)(GCPtr, unsigned long))NoopDDA,
(void (*)(GCPtr, unsigned long, GCPtr))NoopDDA,
xf4bppDestroyGC,
xf4bppChangeClip,
xf4bppDestroyClip,
xf4bppCopyClip,
{ NULL }
};
static ppcPrivGC vgaPrototypeGCPriv = {
GXcopy, /* unsigned char rop */
0, /* unsigned char ropOpStip */
0, /* unsigned char ropFillArea */
{0, }, /* unsigned char unused[sizeof(long) - 3] */
NULL, /* mfbFillAreaProcPtr FillArea */
{
VGA_ALLPLANES, /* unsigned long planemask */
1, /* unsigned long fgPixel */
0, /* unsigned long bgPixel */
GXcopy, /* int alu */
FillSolid, /* int fillStyle */
}, /* ppcReducedRrop colorRrop */
-1, /* short lastDrawableType */
-1, /* short lastDrawableDepth */
0 /* pointer devPriv */
} ;
static GCOps vgaGCOps = {
xf4bppSolidWindowFS, /* void (* FillSpans)() */
xf4bppSetSpans, /* void (* SetSpans)() */
miPutImage, /* void (* PutImage)() */
xf4bppCopyArea, /* RegionPtr (* CopyArea)() */
miCopyPlane, /* void (* CopyPlane)() */
xf4bppPolyPoint, /* void (* PolyPoint)() */
miZeroLine, /* void (* Polylines)() */
miPolySegment, /* void (* PolySegment)() */
miPolyRectangle, /* void (* PolyRectangle)() */
xf4bppZeroPolyArc, /* void (* PolyArc)() */
miFillPolygon, /* void (* FillPolygon)() */
miPolyFillRect, /* void (* PolyFillRect)() */
xf4bppPolyFillArc, /* void (* PolyFillArc)() */
miPolyText8, /* int (* PolyText8)() */
miPolyText16, /* int (* PolyText16)() */
miImageText8, /* void (* ImageText8)() */
miImageText16, /* void (* ImageText16)() */
xf4bppImageGlyphBlt, /* GJA -- void (* ImageGlyphBlt)() */
miPolyGlyphBlt, /* GJA -- void (* PolyGlyphBlt)() */
miPushPixels, /* void (* PushPixels)() */
{NULL} /* devPrivate */
};
Bool
xf4bppCreateGC( pGC )
register GCPtr pGC ;
{
ppcPrivGC *pPriv ;
GCOps *pOps ;
if ( pGC->depth == 1 )
{
return (mfbCreateGC(pGC));
}
if ( !( pPriv = xalloc( sizeof( ppcPrivGC ) ) ) )
return FALSE ;
if ( !( pOps = xalloc( sizeof( GCOps ) ) ) ) {
xfree(pPriv);
return FALSE;
}
/* Now we initialize the GC fields */
pGC->miTranslate = 1;
pGC->unused = 0;
pGC->planemask = VGA_ALLPLANES;
pGC->fgPixel = VGA_BLACK_PIXEL;
pGC->bgPixel = VGA_WHITE_PIXEL;
pGC->funcs = &vgaGCFuncs;
/* ops, -- see below */
pGC->fExpose = TRUE;
pGC->freeCompClip = FALSE;
/* GJA: I don't like this code:
* they allocated a mfbPrivGC, ignore the allocated data and place
* a pointer to a ppcPrivGC in its slot.
*/
*pPriv = vgaPrototypeGCPriv;
dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv);
/* Set the vgaGCOps */
*pOps = vgaGCOps;
pOps->devPrivate.val = 1;
pGC->ops = pOps;
return TRUE ;
}
static void
xf4bppDestroyGC( pGC )
register GC *pGC ;
{
TRACE( ( "xf4bppDestroyGC(pGC=0x%x)\n", pGC ) ) ;
if ( pGC->freeCompClip && pGC->pCompositeClip )
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
if(pGC->ops->devPrivate.val) xfree( pGC->ops );
xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()));
return ;
}
static Mask
ppcChangePixmapGC
(
register GC *pGC,
register Mask changes
)
{
register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
register unsigned long int idx ; /* used for stepping through bitfields */
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
while ((idx = LOWBIT(changes))) {
switch ( idx ) {
case GCLineStyle:
case GCLineWidth:
pGC->ops->Polylines = ( ! pGC->lineWidth )
? miZeroLine
: ( ( pGC->lineStyle == LineSolid )
? miWideLine : miWideDash ) ;
changes &= ~( GCLineStyle | GCLineWidth ) ;
break ;
case GCJoinStyle:
changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
break ;
case GCBackground:
if ( pGC->fillStyle != FillOpaqueStippled ) {
changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
break ;
} /* else Fall Through */
case GCForeground:
if ( pGC->fillStyle == FillTiled ) {
changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
break ;
} /* else Fall Through */
case GCFunction:
case GCPlaneMask:
case GCFillStyle:
{ /* new_fill */
int fillStyle = devPriv->colorRrop.fillStyle ;
/* install a suitable fillspans */
if ( fillStyle == FillSolid )
pGC->ops->FillSpans = xf4bppSolidPixmapFS ;
else if ( fillStyle == FillStippled )
pGC->ops->FillSpans = xf4bppStipplePixmapFS ;
else if ( fillStyle == FillOpaqueStippled )
pGC->ops->FillSpans = xf4bppOpStipplePixmapFS ;
else /* fillStyle == FillTiled */
pGC->ops->FillSpans = xf4bppTilePixmapFS ;
changes &= ~( GCBackground | GCForeground
| GCFunction | GCPlaneMask | GCFillStyle ) ;
break ;
} /* end of new_fill */
default:
ErrorF( "ppcChangePixmapGC: Unexpected GC Change\n" ) ;
changes &= ~ idx ; /* Remove it anyway */
break ;
}
}
return 0 ;
}
/* Clipping conventions
if the drawable is a window
CT_REGION ==> pCompositeClip really is the composite
CT_other ==> pCompositeClip is the window clip region
if the drawable is a pixmap
CT_REGION ==> pCompositeClip is the translated client region
clipped to the pixmap boundary
CT_other ==> pCompositeClip is the pixmap bounding box
*/
static void
xf4bppValidateGC( pGC, changes, pDrawable )
GCPtr pGC;
unsigned long changes;
DrawablePtr pDrawable;
{
register ppcPrivGCPtr devPriv ;
WindowPtr pWin ;
devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
mfbGetGCPrivateKey());
if ( pDrawable->type != devPriv->lastDrawableType ) {
devPriv->lastDrawableType = pDrawable->type ;
xf4bppChangeGCtype( pGC, devPriv ) ;
changes = (unsigned)~0 ;
}
if ( pDrawable->depth == 1 ) {
/* ibmAbort(); */
xf4bppNeverCalled();
}
if ( pDrawable->type == DRAWABLE_WINDOW ) {
pWin = (WindowPtr) pDrawable ;
pGC->lastWinOrg.x = pWin->drawable.x ;
pGC->lastWinOrg.y = pWin->drawable.y ;
}
else {
pWin = (WindowPtr) NULL ;
pGC->lastWinOrg.x = 0 ;
pGC->lastWinOrg.y = 0 ;
}
changes &= ppcGCInterestValidateMask ;
/* If Nothing REALLY Changed, Just Return */
if ( pDrawable->serialNumber == (pGC->serialNumber & DRAWABLE_SERIAL_BITS) )
if ( !( changes &= ~ GC_CALL_VALIDATE_BIT ) )
return ;
/* GJA -- start of cfb code */
/*
* if the client clip is different or moved OR the subwindowMode has
* changed OR the window's clip has changed since the last validation
* we need to recompute the composite clip
*/
if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
(pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
)
{
if (pWin) {
RegionPtr pregWin;
Bool freeTmpClip, freeCompClip;
if (pGC->subWindowMode == IncludeInferiors) {
pregWin = NotClippedByChildren(pWin);
freeTmpClip = TRUE;
}
else {
pregWin = &pWin->clipList;
freeTmpClip = FALSE;
}
freeCompClip = pGC->freeCompClip;
/*
* if there is no client clip, we can get by with just keeping
* the pointer we got, and remembering whether or not should
* destroy (or maybe re-use) it later. this way, we avoid
* unnecessary copying of regions. (this wins especially if
* many clients clip by children and have no client clip.)
*/
if (pGC->clientClipType == CT_NONE) {
if (freeCompClip)
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
pGC->freeCompClip = freeTmpClip;
}
else {
/*
* we need one 'real' region to put into the composite
* clip. if pregWin the current composite clip are real,
* we can get rid of one. if pregWin is real and the
* current composite clip isn't, use pregWin for the
* composite clip. if the current composite clip is real
* and pregWin isn't, use the current composite clip. if
* neither is real, create a new region.
*/
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
if (freeCompClip)
{
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
REGION_DESTROY(pGC->pScreen, pregWin);
}
else if (freeTmpClip)
{
REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
pGC->clientClip);
pGC->pCompositeClip = pregWin;
}
else
{
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
pGC->freeCompClip = TRUE;
REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
}
} /* end of composite clip for a window */
else {
BoxRec pixbounds;
/* XXX should we translate by drawable.x/y here ? */
pixbounds.x1 = 0;
pixbounds.y1 = 0;
pixbounds.x2 = pDrawable->width;
pixbounds.y2 = pDrawable->height;
if (pGC->freeCompClip) {
REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
} else {
pGC->freeCompClip = TRUE;
pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pGC->pCompositeClip, pGC->clientClip);
REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
}
} /* end of composute clip for pixmap */
}
/* GJA -- End of cfb code */
changes &= ~ ( GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode
| GC_CALL_VALIDATE_BIT ) ;
/* If needed, Calculate the Color Reduced Raster-Op */
if ( changes & ( GCFillStyle | GCBackground | GCForeground
| GCPlaneMask | GCFunction ) )
xf4bppGetReducedColorRrop( pGC, pDrawable->depth,
&devPriv->colorRrop ) ;
(* ( ( pDrawable->type == DRAWABLE_WINDOW )
? xf4bppChangeWindowGC
: ppcChangePixmapGC ) )( pGC, changes ) ;
return ;
}

View file

@ -1,71 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "gc.h"
#include "mfb.h"
typedef struct {
unsigned long planemask ;
unsigned long fgPixel ;
unsigned long bgPixel ;
int alu ;
int fillStyle ;
} ppcReducedRrop ;
/* ************************************************************************ */
/* private field of GC */
typedef struct {
/* The next five (5) fields MUST CORRESPOND to
* the fields of a "mfbPrivGC" struct
* ----- BEGINNING OF "DO-NOT-CHANGE" REGION -----
*/
unsigned char rop ; /* reduction of rasterop to 1 of 3 */
unsigned char ropOpStip ; /* rop for opaque stipple */
unsigned char ropFillArea ; /* == alu, rop, or ropOpStip */
unsigned char unused[sizeof(long) - 3];
mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */
/* ----- END OF "DO-NOT-CHANGE" REGION ----- */
ppcReducedRrop colorRrop ;
short lastDrawableType ; /* was last drawable a window or a pixmap? */
short lastDrawableDepth ; /* was last drawable 1 or 8 planes? */
pointer devPriv ; /* Private area for device specific stuff */
} ppcPrivGC ;
typedef ppcPrivGC *ppcPrivGCPtr ;
/* ppcCReduce.c */
void xf4bppGetReducedColorRrop(
GCPtr,
int,
ppcReducedRrop *
);
/* vgaGC.c */
void xf4bppChangeGCtype(
GCPtr,
ppcPrivGCPtr
);

View file

@ -1,141 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <string.h>
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "servermd.h"
#include "ibmTrace.h"
/* GetSpans -- for each span, gets bits from drawable starting at ppt[i]
* and continuing for pwidth[i] bits
* Each scanline returned will be server scanline padded, i.e., it will come
* out to an integral number of words.
*/
void
xf4bppGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart )
DrawablePtr pDrawable ; /* drawable from which to get bits */
int wMax ; /* largest value of all *pwidths */
DDXPointPtr ppt ; /* points to start copying from */
int *pwidth ; /* list of number of bits to copy */
int nspans ; /* number of scanlines to copy */
char *pdstStart ;
{
register int j ;
register unsigned char *pdst ; /* where to put the bits */
register unsigned char *psrc ; /* where to get the bits */
register int pixmapStride ;
TRACE( ( "xf4bppGetSpans(pDrawable=0x%x,wMax=%d,ppt=0x%x,pwidth=0x%x,nspans=%d)\n",
pDrawable, wMax, ppt, pwidth, nspans ) ) ;
if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) )
{
mfbGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ;
return;
}
pixmapStride = PixmapBytePad( wMax, pDrawable->depth ) ;
pdst = (unsigned char *) /* GJA */ pdstStart ;
if ( pDrawable->type == DRAWABLE_WINDOW ) {
for ( ; nspans-- ; ppt++, pwidth++ ) {
xf4bppReadColorImage( (WindowPtr)pDrawable,
ppt->x, ppt->y, j = *pwidth, 1, pdst, pixmapStride ) ;
pdst += j ; /* width is in 32 bit words */
j = ( -j ) & 3 ;
while ( j-- ) /* Pad out to 32-bit boundary */
*pdst++ = 0 ;
}
}
else { /* OK, if we are here, we had better be a DRAWABLE PIXMAP */
register int widthSrc = /* width of pixmap in bytes */
(int) ( (PixmapPtr) pDrawable )->devKind ;
psrc = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
for ( ; nspans-- ; ppt++, pwidth++ ) {
MOVE( psrc + ( ppt->y * widthSrc ) + ppt->x,
pdst, j = *pwidth ) ;
pdst += j ;
j = ( -j ) & 3 ;
while ( j-- ) /* Pad out to 32-bit boundary */
*pdst++ = 0 ;
}
}
return ;
}

View file

@ -1,233 +0,0 @@
/*
Copyright (c) 1990 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright IBM Corporation 1987,1988,1989
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "mi.h"
#include "micmap.h"
#include "scrnintstr.h"
#include "vgaVideo.h"
#if 0
/* XXX This remains to remind of the PC98 difference */
static VisualRec vgaVisuals[] = {
/* StaticColor needs to be first so is can be used as the default */
/* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */
#ifdef PC98
{ 0, StaticColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
{ 0, StaticGray, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
{ 0, GrayScale, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
{ 0, PseudoColor, 4, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
#else
{ 0, StaticColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
{ 0, StaticGray, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
{ 0, GrayScale, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
{ 0, PseudoColor, 6, 1 << VGA_MAXPLANES, VGA_MAXPLANES, 0, 0, 0, 0, 0, 0 },
#endif
} ;
#endif
void
xf4bppNeverCalled()
{
FatalError("xf4bppNeverCalled was nevertheless called\n");
}
/*ARGSUSED*/
static Bool
vgaScreenClose
(
int idx,
ScreenPtr pScreen
)
{
pScreen->defColormap = 0 ;
return TRUE;
}
static GCPtr sampleGCperDepth[MAXFORMATS+1] = { 0 };
static PixmapPtr samplePixmapPerDepth[1] = { 0 };
/* GJA -- Took this from miscrinit.c.
* We want that devKind contains the distance in bytes between two scanlines.
* The computation that mi does is not appropriate for planar VGA.
* Therefore we provide here our own routine.
*/
/* GJA -- WARNING: this is an internal structure declaration, taken from
* miscrinit.c
*/
typedef struct
{
pointer pbits; /* pointer to framebuffer */
int width; /* delta to add to a framebuffer addr to move one row down */
} miScreenInitParmsRec, *miScreenInitParmsPtr;
/* With the introduction of pixmap privates, the "screen pixmap" can no
* longer be created in miScreenInit, since all the modules that could
* possibly ask for pixmap private space have not been initialized at
* that time. pScreen->CreateScreenResources is called after all
* possible private-requesting modules have been inited; we create the
* screen pixmap here.
*/
static Bool
v16CreateScreenResources
(
ScreenPtr pScreen
)
{
miScreenInitParmsPtr pScrInitParms;
pointer value;
pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate;
/* if width is non-zero, pScreen->devPrivate will be a pixmap
* else it will just take the value pbits
*/
if (pScrInitParms->width)
{
PixmapPtr pPixmap;
/* create a pixmap with no data, then redirect it to point to
* the screen
*/
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
if (!pPixmap)
return FALSE;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, pScreen->width,
pScreen->height, pScreen->rootDepth, 8 /* bits per pixel */,
/* GJA: was PixmapBytePad(pScrInitParms->width, pScreen->rootDepth), */
#define BITS_PER_BYTE_SHIFT 3
pScrInitParms->width >> BITS_PER_BYTE_SHIFT,
pScrInitParms->pbits))
return FALSE;
value = (pointer)pPixmap;
}
else
{
value = pScrInitParms->pbits;
}
xfree(pScreen->devPrivate); /* freeing miScreenInitParmsRec */
pScreen->devPrivate = value; /* pPixmap or pbits */
return TRUE;
}
Bool
xf4bppScreenInit( pScreen, pbits, virtx, virty, dpix, dpiy, width )
ScreenPtr pScreen;
pointer pbits;
int virtx, virty;
int dpix, dpiy;
int width;
{
Bool ret;
VisualPtr visuals;
DepthPtr depths;
int nvisuals;
int ndepths;
int rootdepth;
VisualID defaultVisual;
rootdepth = 0;
ret = miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
&defaultVisual, (unsigned long)1 << 8, 6, -1);
if (!ret)
return FALSE;
pScreen-> id = 0;
pScreen->defColormap = FakeClientID(0);
pScreen-> whitePixel = VGA_WHITE_PIXEL;
pScreen-> blackPixel = VGA_BLACK_PIXEL;
pScreen-> rgf = 0;
*(pScreen-> GCperDepth) = *(sampleGCperDepth);
*(pScreen-> PixmapPerDepth) = *(samplePixmapPerDepth);
pScreen-> CloseScreen = vgaScreenClose;
pScreen-> QueryBestSize = xf4bppQueryBestSize;
pScreen-> GetImage = xf4bppGetImage;
pScreen-> GetSpans = xf4bppGetSpans;
pScreen-> CreateWindow = xf4bppCreateWindowForXYhardware;
pScreen-> DestroyWindow = xf4bppDestroyWindow;
pScreen-> PositionWindow = xf4bppPositionWindow;
pScreen-> CopyWindow = xf4bppCopyWindow;
pScreen-> CreatePixmap = xf4bppCreatePixmap;
pScreen-> CreateGC = xf4bppCreateGC;
pScreen-> CreateColormap = xf4bppInitializeColormap;
pScreen-> DestroyColormap = (DestroyColormapProcPtr)NoopDDA;
pScreen-> InstallColormap = miInstallColormap;
pScreen-> UninstallColormap = miUninstallColormap;
pScreen-> ListInstalledColormaps = miListInstalledColormaps;
pScreen-> StoreColors = (StoreColorsProcPtr)NoopDDA;
pScreen-> ResolveColor = xf4bppResolveColor;
mfbFillInScreen(pScreen);
if (!mfbAllocatePrivates(pScreen, NULL))
return FALSE;
if (!miScreenInit(pScreen, pbits, virtx, virty, dpix, dpiy, width,
rootdepth, ndepths, depths, defaultVisual /* See above */,
nvisuals, visuals))
return FALSE;
/* GJA -- Now we override the supplied default: */
pScreen -> CreateScreenResources = v16CreateScreenResources;
mfbRegisterCopyPlaneProc(pScreen,miCopyPlane); /* GJA -- R4->R5 */
return TRUE;
}

View file

@ -1,122 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mi.h"
#include "scrnintstr.h"
#include "servermd.h"
/* Was MIGETIMAGE -- public entry for the GetImage Request
* We're getting the image into a memory buffer. While we have to use GetSpans
* to read a line from the device ( since we don't know what that looks like ) ,
* we can just write into the destination buffer
*
* two different strategies are used, depending on whether we're getting the
* image in Z format or XY format
* Z format:
* Line at a time, GetSpans a line and bcopy it to the destination
* buffer, except that if the planemask is not all ones, we create a
* temporary pixmap and do a SetSpans into it ( to get bits turned off )
* and then another GetSpans to get stuff back ( because pixmaps are
* opaque, and we are passed in the memory to write into ) . This is
* completely ugly and slow but works, but the interfaces just aren't
* designed for this case. Life is hard.
* XY format:
* get the single plane specified in planemask
*/
void
xf4bppGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine )
DrawablePtr pDraw ;
int sx, sy, w, h ;
unsigned int format ;
unsigned long planeMask ;
char * pdstLine ;
{
#if 1
int depth, i, linelength, width ;
DDXPointRec pt ;
char *pbits ;
XID gcv[2] ;
PixmapPtr pPixmap = (PixmapPtr) NULL ;
GCPtr pGC ;
char *pDst = pdstLine ;
depth = pDraw->depth ;
if ( format == ZPixmap ) {
linelength = PixmapBytePad( w, depth ) ;
/* if ( pDraw->type == DRAWABLE_WINDOW ) { */
sx += pDraw->x ;
sy += pDraw->y ;
/* } */
if ( ( ( ( 1 << pDraw->depth ) - 1 ) & planeMask )
!= (unsigned)( 1 << pDraw->depth ) - 1 ) {
pGC = GetScratchGC( depth, pDraw->pScreen ) ;
pPixmap = (PixmapPtr)
(* pDraw->pScreen->CreatePixmap)( pDraw->pScreen, w, h, depth,
CREATE_PIXMAP_USAGE_SCRATCH) ;
gcv[0] = GXcopy ;
gcv[1] = planeMask ;
DoChangeGC( pGC, GCPlaneMask | GCFunction, gcv, 0 ) ;
ValidateGC( (DrawablePtr)pPixmap, pGC ) ;
pbits = (char *)xalloc(w);
for ( i = 0 ; i < h ; i++ ) {
pt.x = sx ;
pt.y = sy + i ;
width = w ;
(* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pbits ) ;
pt.x = 0 ;
pt.y = i ;
width = w ;
if ( planeMask & ((1 << depth) - 1) ) /* GJA -- mfb bug */
(* pGC->ops->SetSpans)( (DrawablePtr)pPixmap, pGC, pbits, &pt, &width, 1, TRUE ) ;
(* pDraw->pScreen->GetSpans)( (DrawablePtr)pPixmap, w, &pt, &width, 1, pDst ) ;
pDst += linelength ;
}
xfree(pbits) ;
(* pGC->pScreen->DestroyPixmap)( pPixmap ) ;
FreeScratchGC( pGC ) ;
return ;
}
for ( i = 0 ; i < h ; i++ ) {
pt.x = sx ;
pt.y = sy + i ;
width = w ;
(* pDraw->pScreen->GetSpans)( pDraw, w, &pt, &width, 1, pDst ) ;
pDst += linelength ;
}
}
else
#endif
miGetImage( pDraw, sx, sy, w, h, format, planeMask, pdstLine ) ;
}

View file

@ -1,502 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/******************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "maskbits.h"
#include "mi.h"
#include "mispans.h"
#include "ppcGCstr.h"
#include "ppcSpMcro.h"
#include "vgaVideo.h"
#include "ibmTrace.h"
#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
/* GJA -- copied this from VGA */
#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
/*
********** ********** ********** ********** ********** ********** **********
these routines all clip. they assume that anything that has called
them has already translated the points (i.e. pGC->miTranslate is
non-zero, which is howit gets set in mfbCreateGC().)
the number of new scnalines created by clipping ==
MaxRectsPerBand * nSpans.
********** ********** ********** ********** ********** ********** **********
*/
/* A mod definition that goes smoothly into the negative.
*/
static int
modulo
(
int n1,
int n2
)
{
int tmp;
if ( n1 < 0 ) {
tmp = (-n1) % n2;
if ( tmp == 0 ) {
return 0;
} else {
return n2 - tmp;
}
} else {
return n1 % n2;
}
}
void
xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
DrawablePtr pDrawable ;
GCPtr pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register unsigned long int pm, npm ;
register unsigned long int fg ;
register int alu ;
/* next three parameters are post-clip */
int n ; /* number of spans to fill */
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
register unsigned char *addrl ; /* pointer to current longword in bitmap */
int i ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
TRACE(("xf4bppSolidPixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n", pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
if ( pDrawable->type != DRAWABLE_PIXMAP ) {
ErrorF("xf4bppSolidPixmapFS: drawable is not a pixmap\n") ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop )
return ;
n = nInit * miFindMaxBand(pGC->pCompositeClip) ;
if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
return ;
pwidth = pwidthFree ;
if ( !( pptFree = (DDXPointRec *)
xalloc( n * sizeof( DDXPointRec ) ) ) ) {
xfree( pwidth ) ;
return ;
}
ppt = pptFree ;
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted ) ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
for ( ; n-- ; ppt++, pwidth++ ) {
addrl = ( (unsigned char *) ( ( (PixmapPtr) pDrawable )->devPrivate.ptr ) )
+ ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
+ ppt->x ;
for ( i = *pwidth ; i-- ; addrl++ )
{
unsigned _p;
DoRop( _p, alu, fg, *addrl );
*addrl = ( *addrl & npm ) | ( pm & _p ) ;
}
#ifdef notdef /* PURDUE */
*addrl = ( *addrl & npm ) | ( pm & DoRop( alu, fg, *addrl ) ) ;
#endif /* PURDUE */
}
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}
/* GJA -- copied from vgaStipple.c */
static unsigned char
vgagetbits
(
register const int x,
register const unsigned int patternWidth,
register const unsigned char * const lineptr
)
{
register unsigned char bits ;
register const unsigned char *cptr ;
register int shift ;
register int wrap ;
cptr = lineptr + ( x >> 3 ) ;
bits = *cptr ;
if ((shift = x & 7))
bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
bits &= SCRLEFT8( 0xFF, wrap ) ;
bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
}
/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
* I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
*/
switch (patternWidth) {
case 1: /* Not really useful. */
bits &= ~SCRRIGHT8(0xFF,1);
bits |= SCRRIGHT8(bits,1);
bits |= SCRRIGHT8(bits,2);
bits |= SCRRIGHT8(bits,4);
break;
case 2:
bits &= ~SCRRIGHT8(0xFF,2);
bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
case 3:
bits &= ~SCRRIGHT8(0xFF,3);
bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
case 4:
bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
case 5:
bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
case 6:
bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
case 7:
bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
default:
;
/* Do nothing, of course */
}
return bits ;
}
void
xf4bppStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
register DrawablePtr pDrawable ;
GC *pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register unsigned char *pdst ; /* pointer to current word in bitmap */
register unsigned long int pm, npm ;
register unsigned long int fg ;
register int alu ;
/* next three parameters are post-clip */
int n ; /* number of spans to fill */
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
PixmapPtr pTile ; /* pointer to tile we want to fill with */
int width, x, xSrc, ySrc ;
int tlwidth, tileWidth ;
unsigned char *psrcT ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
int xoff, count, stip, i ;
TRACE(("xf4bppStipplePixmapFS(pDrawable=0x%x, pGC=0x%x, nInit=%d, pptInit=0x%x, pwidthInit=0x%x, fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
if ( pDrawable->type != DRAWABLE_PIXMAP ) {
ErrorF( "xf4bppStippleWindowFS: drawable is not a pixmap\n") ;
return ;
}
if ( pGC->stipple->drawable.depth != 1 ) {
ErrorF( "ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
pDrawable->type, pGC->stipple->drawable.depth ) ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
pTile = pGC->stipple ;
tlwidth = pTile->devKind ;
tileWidth = pTile->drawable.width ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
/* this replaces rotating the stipple. Instead, we just adjust the offset
* at which we start grabbing bits from the stipple */
xSrc = pGC->patOrg.x + pDrawable->x;
ySrc = pGC->patOrg.y + pDrawable->y;
while ( n-- ) {
pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
+ ( ppt->y * ( (int) ( ( (PixmapPtr) pDrawable )->devKind ) ) )
+ ppt->x ;
psrcT = (unsigned char *)pTile->devPrivate.ptr
+ ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
x = ppt->x ;
xoff = modulo( x - xSrc, tileWidth) ;
for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
if ( xoff >= tileWidth ) xoff -= tileWidth;
if ( width < 8 )
count = width;
else
count = 8;
stip = vgagetbits( xoff, tileWidth, psrcT ) ;
for ( i = count ; i-- ; ) {
if ( stip & 128 )
{
unsigned _p;
DoRop( _p, alu, fg, *pdst ) ;
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
}
#ifdef notdef /* PURDUE */
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
#endif /* PURDUE */
pdst++ ;
stip = SCRLEFT( stip, 1 ) ;
}
}
ppt++ ;
pwidth++ ;
}
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}
void
xf4bppOpStipplePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
DrawablePtr pDrawable ;
GC *pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register unsigned char *pdst ; /* pointer to current word in bitmap */
register unsigned long int pm, npm ;
register unsigned long int fg, bg ;
register int alu ;
/* next three parameters are post-clip */
int n ; /* number of spans to fill */
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
PixmapPtr pTile ; /* pointer to tile we want to fill with */
int width ;
int xSrc, ySrc ;
int tlwidth, tileWidth ;
unsigned char *psrcT ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
int xoff, count, stip, i ;
TRACE( ( "xf4bppOpStipplePixmapFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
if ( pGC->stipple->drawable.depth != 1 ) {
ErrorF( "xf4bppOpStipplePixmapFS: bad depth\ntype = %d, depth = %d\n",
pDrawable->type, pGC->stipple->drawable.depth ) ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
pTile = pGC->stipple ;
tlwidth = pTile->devKind ;
tileWidth = pTile->drawable.width ;
xSrc = pGC->patOrg.x + pDrawable->x;
ySrc = pGC->patOrg.y + pDrawable->y;
/* this replaces rotating the stipple. Instead, we just adjust the offset
* at which we start grabbing bits from the stipple */
for ( ; n-- ; ppt++, pwidth++ ) {
pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
+ ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
+ ppt->x ;
psrcT = (unsigned char *)pTile->devPrivate.ptr
+ ( modulo( ppt->y - ySrc, pTile->drawable.height ) * tlwidth ) ;
xoff = modulo( ppt->x - xSrc, tileWidth) ;
for ( width = *pwidth ; width ; width -= count, xoff+=count ) {
if ( xoff >= tileWidth ) xoff -= tileWidth;
if ( width < 8 )
count = width;
else
count = 8;
stip = vgagetbits( xoff, tileWidth, psrcT ) ;
for ( i = count ; i-- ; pdst++, stip = SCRLEFT( stip, 1 ) )
if ( stip & 128 )
{
unsigned _p;
DoRop( _p, alu, fg, *pdst ) ;
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
}
#ifdef notdef /* PURDUE */
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, fg, *pdst ) ) ;
#endif /* PURDUE */
else
{
unsigned _p;
DoRop( _p, alu, bg, *pdst ) ;
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
}
#ifdef notdef /* PURDUE */
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, bg, *pdst ) ) ;
#endif /* PURDUE */
}
}
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}
void
xf4bppTilePixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
register DrawablePtr pDrawable ;
GC *pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
register unsigned char *pdst ; /* pointer to current word in bitmap */
register unsigned char *psrc ; /* pointer to current word in tile */
register PixmapPtr pTile ; /* pointer to tile we want to fill with */
int i ;
int alu ;
unsigned char pm, npm ;
/* next three parameters are post-clip */
int n ; /* number of spans to fill */
int tileWidth ;
int xSrc, ySrc;
unsigned char *psrcT ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
TRACE( ( "ppcTileFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
mfbTileFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ;
return ;
}
if ( !xf4bppDepthOK( pDrawable, pGC->tile.pixmap->drawable.depth ) ) {
ErrorF( "ppcTileFS: bad depth\ntype = %d, depth = %d\n",
pDrawable->type, pDrawable->depth) ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
/* the following code is for 8 bits per pixel addressable memory only */
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ;
pTile = pGC->tile.pixmap ;
tileWidth = pTile->drawable.width ;
xSrc = pGC->patOrg.x + pDrawable->x;
ySrc = pGC->patOrg.y + pDrawable->y;
/* this replaces rotating the tile. Instead we just adjust the offset
* at which we start grabbing bits from the tile */
for ( ; n-- ; ppt++, pwidth++ ) {
pdst = ( (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr )
+ ( ppt->y * ( (int) ( (PixmapPtr) pDrawable )->devKind ) )
+ ppt->x ;
psrcT = (unsigned char *) pTile->devPrivate.ptr
+ ( modulo( ppt->y - ySrc, pTile->drawable.height) * pTile->devKind ) ;
psrc = psrcT + modulo( ppt->x - xSrc, tileWidth ) ;
for ( i = *pwidth ; i-- ; pdst++, psrc++ ) {
if ( psrc >= ( psrcT + tileWidth ) )
psrc = psrcT ;
{
unsigned _p;
DoRop( _p, alu, *psrc, *pdst ) ;
*pdst = ( *pdst & npm ) | ( pm & _p ) ;
}
#ifdef notdef /* PURDUE */
*pdst = ( *pdst & npm ) | ( pm & DoRop( alu, *psrc, *pdst ) ) ;
#endif /* PURDUE */
}
}
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}

View file

@ -1,151 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <string.h>
#include "xf4bpp.h"
#include "servermd.h"
#include "OScompiler.h"
#include "ibmTrace.h"
#include "scrnintstr.h"
PixmapPtr
xf4bppCreatePixmap( pScreen, width, height, depth, usage_hint )
ScreenPtr pScreen ;
int width ;
int height ;
int depth ;
unsigned usage_hint ;
{
register PixmapPtr pPixmap = (PixmapPtr)NULL;
size_t size ;
TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d, usage_hint=%d)\n", pScreen, width, height, depth, usage_hint)) ;
if ( depth > 8 )
return (PixmapPtr) NULL ;
size = PixmapBytePad(width, depth);
if (size / 4 > 32767 || height > 32767)
return (PixmapPtr) NULL ;
pPixmap = AllocatePixmap (pScreen, (height * size));
if ( !pPixmap )
return (PixmapPtr) NULL ;
pPixmap->drawable.type = DRAWABLE_PIXMAP ;
pPixmap->drawable.class = 0 ;
pPixmap->drawable.pScreen = pScreen ;
pPixmap->drawable.depth = depth ;
pPixmap->drawable.id = 0 ;
pPixmap->drawable.bitsPerPixel = ( depth == 1 ) ? 1 : 8 ;
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER ;
pPixmap->drawable.x = 0 ;
pPixmap->drawable.y = 0 ;
pPixmap->drawable.width = width ;
pPixmap->drawable.height = height ;
pPixmap->devKind = size;
pPixmap->refcnt = 1 ;
size = height * pPixmap->devKind ;
pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
+ pScreen->totalPixmapSize);
bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
pPixmap->usage_hint = usage_hint;
return pPixmap ;
}
PixmapPtr
xf4bppCopyPixmap(pSrc)
register PixmapPtr pSrc;
{
register PixmapPtr pDst;
int size;
TRACE(("xf4bppCopyPixmap(pSrc=0x%x)\n", pSrc)) ;
size = pSrc->drawable.height * pSrc->devKind;
pDst = xalloc(sizeof(PixmapRec) + size);
if (!pDst)
return NullPixmap;
pDst->devPrivates = NULL;
pDst->drawable = pSrc->drawable;
pDst->drawable.id = 0;
pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pDst->devKind = pSrc->devKind;
pDst->refcnt = 1;
pDst->devPrivate.ptr = (pointer)(pDst + 1);
MOVE( (char *)pSrc->devPrivate.ptr, (char *)pDst->devPrivate.ptr, size ) ;
return pDst;
}

View file

@ -1,143 +0,0 @@
/*
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright IBM Corporation 1987,1988,1989
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM 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.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "mi.h"
#include "scrnintstr.h"
#include "ppcGCstr.h"
#include "ibmTrace.h"
void
xf4bppPolyPoint( pDrawable, pGC, mode, npt, pptInit )
DrawablePtr pDrawable ;
GCPtr pGC ;
int mode ; /* Origin or Previous */
int npt ;
xPoint *pptInit ;
{
register xPoint *ppt ;
ppcPrivGC *devPriv ;
int alu ;
int nptTmp ;
TRACE( ("xf4bppPolyPoint(0x%x,0x%x,%d,%d,0x%x)\n",
pDrawable, pGC, mode, npt, pptInit ) ) ;
if ( pDrawable->type == DRAWABLE_PIXMAP ) {
if ( pGC->alu != GXnoop )
miPolyPoint( pDrawable, pGC, mode, npt, pptInit ) ;
return ;
}
devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
if ( ( alu = devPriv->colorRrop.alu ) == GXnoop )
return ;
/* make pointlist origin relative */
if ( mode == CoordModePrevious )
for ( ppt = pptInit, nptTmp = npt ; --nptTmp ; ) {
ppt++ ;
ppt->x += (ppt-1)->x ;
ppt->y += (ppt-1)->y ;
}
if ( pGC->miTranslate ) {
register int xorg = pDrawable->x ;
register int yorg = pDrawable->y ;
for ( ppt = pptInit, nptTmp = npt ; nptTmp-- ; ppt++ ) {
ppt->x += xorg ;
ppt->y += yorg ;
}
}
{
register RegionPtr pRegion = pGC->pCompositeClip ;
register unsigned long int fg = devPriv->colorRrop.fgPixel ;
register unsigned long int pm = devPriv->colorRrop.planemask ;
BoxRec box ; /* Scratch Space */
if ( ! REGION_NUM_RECTS(pRegion))
return ;
for ( ppt = pptInit ; npt-- ; ppt++ )
if (POINT_IN_REGION(pDrawable->pScreen, pRegion,
ppt->x, ppt->y, &box))
xf4bppFillSolid( (WindowPtr)pDrawable,
fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
}
return ;
}

View file

@ -1,46 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
void
xf4bppQueryBestSize
(
register int class,
register unsigned short *pwidth,
register unsigned short *pheight,
ScreenPtr pScreen
)
{
if ( class == CursorShape )
*pwidth = *pheight = 32 ; /* ppc's cursor max out at 32 by 32 */
else /* either TileShape or StippleShape */
/* Round Up To Nearest Multiple Of 8 -- We don't care what height they use */
*pwidth = ( *pwidth + 0x7 ) & ~ 0x7 ;
return ;
}

View file

@ -1,177 +0,0 @@
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
All Rights Reserved
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright no-
tice appear in all copies and that both that copyright no-
tice and this permission notice appear in supporting docu-
mentation, and that the names of Sun or X Consortium
not be used in advertising or publicity pertaining to
distribution of the software without specific prior
written permission. Sun and X Consortium make no
representations about the suitability of this software for
any purpose. It is provided "as is" without any express or
implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
ABLE 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.
********************************************************/
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/* Generic Color Resolution Scheme
* P. Shupak 12/31/87
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "scrnintstr.h"
/*
* New colormap routines that can support multiple Visual types.
*/
static unsigned short defstaticpalette[16][3] = {
/* R G B */
{ 0x0000, 0x0000, 0x0000 }, /* black */
{ 0xFFFF, 0xFFFF, 0xFFFF }, /* white */
{ 0xAAAA, 0xAAAA, 0xAAAA }, /* grey */
{ 0x0000, 0x0000, 0xAAAA }, /* dark blue */
{ 0x0000, 0x0000, 0xFFFF }, /* medium blue */
{ 0x0000, 0xAAAA, 0xFFFF }, /* light blue */
{ 0x0000, 0xFFFF, 0xFFFF }, /* cyan */
{ 0x0000, 0xAAAA, 0x0000 }, /* dark green */
{ 0x0000, 0xFFFF, 0x0000 }, /* green */
{ 0xAAAA, 0xFFFF, 0x5555 }, /* pale green */
{ 0xAAAA, 0x5555, 0x0000 }, /* brown */
{ 0xFFFF, 0xAAAA, 0x0000 }, /* light brown */
{ 0xFFFF, 0xFFFF, 0x0000 }, /* yellow */
{ 0xAAAA, 0x0000, 0xAAAA }, /* purple */
{ 0xFFFF, 0x0000, 0xFFFF }, /* magenta */
{ 0xFFFF, 0x0000, 0x0000 }, /* red */
};
Bool
xf4bppInitializeColormap(pmap)
register ColormapPtr pmap;
{
register unsigned i;
register VisualPtr pVisual;
unsigned lim, maxent, shift;
pVisual = pmap->pVisual;
lim = (1 << pVisual->bitsPerRGBValue) - 1;
shift = 16 - pVisual->bitsPerRGBValue;
maxent = pVisual->ColormapEntries - 1;
switch( pVisual->class )
{
case StaticGray:
for ( i = 0 ; i < maxent ; i++ ) {
pmap->red[i].co.local.red =
pmap->red[i].co.local.green =
pmap->red[i].co.local.blue =
((((i * 65535) / maxent) >> shift) * 65535) / lim;
}
break;
case StaticColor:
for ( i = 0 ; i < 16 ; i++ ) {
pmap->red[i].co.local.red = (defstaticpalette[i][0]);
pmap->red[i].co.local.green = (defstaticpalette[i][1]);
pmap->red[i].co.local.blue = (defstaticpalette[i][2]);
}
break;
case GrayScale:
case PseudoColor:
for(i=0;i<=maxent;i++) {
int a,b,c;
a = i << 10;
b = i << 12;
c = i << 14;
pmap->red[i].co.local.red = a;
pmap->red[i].co.local.green = b;
pmap->red[i].co.local.blue = c;
}
break;
case TrueColor:
case DirectColor:
default:
ErrorF( "Unsupported Visual class %d\b", pVisual->class );
return FALSE;
}
return TRUE;
}
void
xf4bppResolveColor( pred, pgreen, pblue, pVisual )
register unsigned short* pred ;
register unsigned short* pgreen ;
register unsigned short* pblue ;
register VisualPtr pVisual ;
{
unsigned lim, maxent, shift;
lim = (1 << pVisual->bitsPerRGBValue) - 1;
shift = 16 - pVisual->bitsPerRGBValue;
maxent = pVisual->ColormapEntries - 1;
switch( pVisual->class )
{
case StaticGray:
*pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
*pred = (((*pred * (maxent + 1)) >> 16) * 65535) / maxent;
*pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
break;
case StaticColor:
break;
case GrayScale:
*pred = (30L * *pred + 59L * *pgreen + 11L * *pblue) / 100;
*pblue = *pgreen = *pred = ((*pred >> shift) * 65535) / lim;
break;
case PseudoColor:
/* rescale to rgb bits */
*pred = ((*pred >> shift) * 65535) / lim;
*pgreen = ((*pgreen >> shift) * 65535) / lim;
*pblue = ((*pblue >> shift) * 65535) / lim;
break;
case TrueColor:
case DirectColor:
default:
ErrorF( "Unsupported Visual class %d\b", pVisual->class );
}
}

View file

@ -1,319 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/***********************************************************
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "OScompiler.h"
#include "mfbmap.h"
#include "mfb.h"
#include "servermd.h"
/* SetScanline -- copies the bits from psrc to the drawable starting at
* (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc
* starts on the scanline. (I.e., if this scanline passes through multiple
* boxes, we may not want to start grabbing bits at psrc but at some offset
* further on.)
*/
static void
ppcSetScanline
(
register int pixCount, /* width of scanline in bits */
register char *psrc,
register unsigned char *pdst, /* where to put the bits */
register int pm, /* plane mask */
const int alu /* raster op */
)
{
register int npm = ~pm ; /* inverted plane mask */
register char tmpx ;
pm &= 0x0F; npm &= 0x0F; /* GJA */
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
while ( pixCount-- )
*pdst++ &= npm ;
break ;
case GXand: /* 0x1 src AND dst */
while ( pixCount-- )
*pdst++ &= *psrc++ | npm ;
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
for ( ; pixCount-- ; pdst++, psrc++ ) {
tmpx = *pdst;
*pdst = ( tmpx & npm ) | ( pm & *psrc & ~tmpx ) ;
}
break ;
case GXcopy: /* 0x3 src */
for ( ; pixCount-- ; pdst++, psrc++ )
*pdst = ( *pdst & npm ) | ( pm & *psrc ) ;
break ;
case GXandInverted: /* 0x4 NOT src AND dst */
while ( pixCount-- )
*pdst++ &= npm | ~*psrc++ ;
break ;
case GXnoop: /* 0x5 dst */
break ;
case GXxor: /* 0x6 src XOR dst */
while ( pixCount-- )
*pdst++ ^= pm & *psrc++ ;
break ;
case GXor: /* 0x7 src OR dst */
while ( pixCount-- )
*pdst++ |= *psrc++ & pm ;
break ;
case GXnor: /* 0x8 NOT src AND NOT dst */
for ( ; pixCount-- ; pdst++, psrc++ ) {
tmpx = *pdst;
*pdst = ( tmpx & npm ) | ( pm & ~( tmpx | *psrc ) ) ;
}
break ;
case GXequiv: /* 0x9 NOT src XOR dst */
while ( pixCount-- )
*pdst++ ^= pm & ~ *psrc++ ;
break ;
case GXorReverse: /* 0xb src OR NOT dst */
for ( ; pixCount-- ; pdst++, psrc++ ) {
tmpx = *pdst;
*pdst = ( tmpx & npm ) | ( pm & ( *psrc | ~tmpx ) ) ;
}
break ;
case GXinvert: /* 0xa NOT dst */
while ( pixCount-- )
*pdst++ ^= pm ;
break ;
case GXcopyInverted: /* 0xc NOT src */
for ( ; pixCount-- ; pdst++, psrc++ )
*pdst = ( *pdst & npm ) | ( pm & ~ *psrc ) ;
break ;
case GXorInverted: /* 0xd NOT src OR dst */
while ( pixCount-- )
*pdst++ |= pm & ~ *psrc++ ;
break ;
case GXnand: /* 0xe NOT src OR NOT dst */
for ( ; pixCount-- ; pdst++, psrc++ ) {
tmpx = *pdst;
*pdst = ( tmpx & npm ) | ( pm & ~( tmpx & *psrc ) ) ;
}
break ;
case GXset: /* 0xf 1 */
while ( pixCount-- )
*pdst++ |= pm ;
break ;
default:
ErrorF( "ppcSetScanLine: bad alu value == 0x%02X\n", alu ) ;
break ;
}
return ;
}
/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at
* ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines
* are in increasing Y order.
* Source bit lines are server scanline padded so that they always begin
* on a word boundary.
*/
void
xf4bppSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted )
register DrawablePtr pDrawable ;
GCPtr pGC ;
char *psrc ;
register DDXPointPtr ppt ;
int *pwidth ;
int nspans ;
int fSorted ;
{
unsigned char *pdstBase = NULL; /* start of dst bitmap */
int widthDst = 0; /* width of bitmap in words */
register BoxPtr pbox, pboxLast, pboxTest ;
register DDXPointPtr pptLast ;
RegionPtr prgnDst ;
register int width ;
int xStart, xEnd ;
int yMax ;
int alu ;
int pm ;
/* allow for 1-deep windows on nfb machines (eg apa8, aed) */
if ( ( pDrawable->depth == 1 ) && ( pDrawable->type == DRAWABLE_PIXMAP ) ) {
mfbSetSpans( pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted ) ;
return ;
}
if ( !( pm = pGC->planemask & ~( (~0) << pDrawable->depth ) )
|| ( ( alu = pGC->alu ) == GXnoop ) )
return ;
prgnDst = pGC->pCompositeClip ;
if ( ! REGION_NUM_RECTS(prgnDst))
return ;
pboxLast = ( pbox = REGION_RECTS(prgnDst) ) + REGION_NUM_RECTS(prgnDst);
pptLast = ppt + nspans ;
if ( pDrawable->type == DRAWABLE_WINDOW ) {
yMax = (int) pDrawable->height + pDrawable->y ;
}
else {
pdstBase = (unsigned char *) ( (PixmapPtr) pDrawable )->devPrivate.ptr ;
widthDst = (int) ( (PixmapPtr) pDrawable )->devKind ;
yMax = pDrawable->height ;
}
if ( fSorted ) {
/* scan lines sorted in ascending order. Because they are sorted, we
* don't have to check each scanline against each clip box. We can be
* sure that this scanline only has to be clipped to boxes at or after the
* beginning of this y-band
*/
for ( pboxTest = pbox ;
( ppt < pptLast ) && ( ppt->y < yMax ) ;
ppt++, pwidth++,
psrc += PixmapBytePad( width, pDrawable->depth ) ) {
width = *pwidth ;
for ( pbox = pboxTest ;
pbox < pboxLast ;
pbox++ ) {
if ( pbox->y2 <= ppt->y ) {
/* clip box is before scanline */
pboxTest = pbox + 1 ;
}
else if ( ( pbox->y1 > ppt->y )
|| ( pbox->x1 > ppt->x + width ) )
break ; /* scanline before clip box or left of clip box */
else if ( pbox->x2 > ppt->x ) {
/* some of the scanline is in the current clip box */
xStart = MAX( pbox->x1, ppt->x ) ;
xEnd = MIN( ppt->x + width, pbox->x2 ) ;
if ( pDrawable->type == DRAWABLE_PIXMAP )
ppcSetScanline( xEnd - xStart,
psrc + ( xStart - ppt->x ),
pdstBase + xStart
+ ( ppt->y * widthDst ),
pm, alu ) ;
else
xf4bppDrawColorImage( (WindowPtr)pDrawable,
xStart, ppt->y, xEnd - xStart, 1,
(unsigned char *)psrc + ( xStart - ppt->x ),
xEnd - xStart, alu, pm ) ;
if ( ppt->x + width <= pbox->x2 )
break ; /* End of the line, as it were */
}
}
/* We've tried this line against every box ; it must be outside them
* all. move on to the next point */
}
}
else {
/* scan lines not sorted. We must clip each line against all the boxes */
for ( ;
ppt < pptLast ;
ppt++, pwidth++,
psrc += PixmapBytePad( width, pDrawable->depth ) ) {
width = *pwidth ;
if ( ppt->y >= 0 && ppt->y < yMax ) {
for ( pbox = REGION_RECTS(prgnDst) ; pbox < pboxLast ; pbox++ ) {
if ( pbox->y1 > ppt->y )
break ; /* rest of clip region is above this scanline */
else if ( ( pbox->y2 > ppt->y )
&& ( pbox->x1 <= ppt->x + width )
&& ( pbox->x2 > ppt->x ) ) {
xStart = MAX( pbox->x1, ppt->x ) ;
xEnd = MIN( pbox->x2, ppt->x + width ) ;
if ( pDrawable->type == DRAWABLE_PIXMAP )
ppcSetScanline( xEnd - xStart,
psrc + ( xStart - ppt->x ),
/* ^ GJA */
( ( pdstBase
+ ( ppt->y * widthDst ) )
+ xStart ),
pm, alu ) ;
else /* pDrawable->type == DRAWABLE_WINDOW */
xf4bppDrawColorImage( (WindowPtr)pDrawable,
xStart, ppt->y, xEnd - xStart, 1,
(unsigned char *)psrc + ( xStart - ppt->x ),
/* GJA ^ */
xEnd - xStart, alu, pm ) ;
}
}
}
}
}
return ;
}

View file

@ -1,43 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/* This screwy macro is used in all the spans routines and you find
it all over the place, so it is a macro just to tidy things up.
*/
#define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT) \
{ \
N = IN * miFindMaxBand(pGC->pCompositeClip); \
if(!(PW = (int *)xalloc(N * sizeof(int)))) \
return; \
if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \
{ \
free(PW); \
return; \
} \
FPW = PW; \
FPPT = PPT; \
N = miClipSpans(pGC->pCompositeClip, IPPT, IPW, IN, \
PPT, PW, FSORT); \
}

View file

@ -1,280 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
/******************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "mi.h"
#include "mispans.h"
#include "ppcGCstr.h"
#include "ppcSpMcro.h"
#include "ibmTrace.h"
#define LeftMostBitInScreenLongWord SCRLEFT( 0xFFFFFFFF, 31 )
/*
********** ********** ********** ********** ********** ********** **********
these routines all clip. they assume that anything that has called
them has already translated the points (i.e. pGC->miTranslate is
non-zero, which is howit gets set in mfbCreateGC().)
the number of new scanlines created by clipping ==
MaxRectsPerBand * nSpans.
********** ********** ********** ********** ********** ********** **********
*/
void
xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
DrawablePtr pDrawable ;
GCPtr pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register unsigned long int pm ;
register unsigned long int fg ;
register int alu ;
/* next three parameters are post-clip */
int n ; /* number of spans to fill */
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
TRACE( ( "xf4bppSolidWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
if ( pDrawable->type != DRAWABLE_WINDOW ) {
ErrorF( "xf4bppSolidWindowFS: drawable is not a window\n") ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
n = nInit * miFindMaxBand( pGC->pCompositeClip ) ;
if ( !( pwidthFree = (int *) xalloc( n * sizeof( int ) ) ) )
return ;
pwidth = pwidthFree ;
if ( !( pptFree = (DDXPointRec *)
xalloc( n * sizeof( DDXPointRec ) ) ) ) {
xfree( pwidth ) ;
return ;
}
ppt = pptFree ;
n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit,
ppt, pwidth, fSorted ) ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
for ( ; n-- ; ppt++, pwidth++ )
if ( *pwidth )
xf4bppFillSolid( (WindowPtr)pDrawable,
fg, alu, pm, ppt->x, ppt->y, *pwidth, 1 ) ;
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}
void
xf4bppStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
DrawablePtr pDrawable ;
register GC *pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register unsigned long int pm ;
register unsigned long int fg ;
register int alu ;
/* next three parameters are post-clip */
int n ; /* number of spans to fill */
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
PixmapPtr pTile ; /* pointer to tile we want to fill with */
int xSrc ;
int ySrc ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
TRACE( ( "xf4bppStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
if ( pDrawable->type != DRAWABLE_WINDOW ) {
ErrorF( "xf4bppStippleWindowFS: drawable is not a window\n" ) ;
return ;
}
if ( pGC->stipple->drawable.depth != 1 ) {
ErrorF("ppcStippleFS: bad depth\ntype = %d, depth = %d\n",
pDrawable->type, pGC->stipple->drawable.depth ) ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
pTile = pGC->stipple ;
for ( ; n-- ; ppt++, pwidth++ )
xf4bppFillStipple( (WindowPtr)pDrawable, pTile, fg, alu, pm,
ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}
void
xf4bppOpStippleWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
DrawablePtr pDrawable ;
register GC *pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
int n ; /* number of spans to fill */
int xSrc ;
int ySrc ;
unsigned long int pm ;
unsigned long int fg, bg ;
int alu ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
TRACE( ( "xf4bppOpStippleWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
if ( pGC->stipple->drawable.depth != 1 ) {
ErrorF( "xf4bppOpStippleWindowFS: bad depth\ntype = %d, depth = %d\n",
pDrawable->type, pGC->stipple->drawable.depth ) ;
return ;
}
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ;
bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
for ( ; n-- ; ppt++, pwidth++ )
xf4bppOpaqueStipple( (WindowPtr)pDrawable, pGC->stipple, fg, bg, alu, pm,
ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}
void
xf4bppTileWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
DrawablePtr pDrawable ;
register GC *pGC ;
int nInit ; /* number of spans to fill */
DDXPointPtr pptInit ; /* pointer to list of start points */
int *pwidthInit ; /* pointer to list of n widths */
int fSorted ;
{
/* next three parameters are post-clip */
register DDXPointPtr ppt ; /* pointer to list of start points */
register int *pwidth ; /* pointer to list of n widths */
int n ; /* number of spans to fill */
unsigned char pm ;
int alu ;
int xSrc ;
int ySrc ;
int *pwidthFree ; /* copies of the pointers to free */
DDXPointPtr pptFree ;
TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n",
pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop )
return ;
SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit,
pptFree, pwidth, ppt, fSorted ) ;
xSrc = pGC->patOrg.x + pDrawable->x ;
ySrc = pGC->patOrg.y + pDrawable->y ;
pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ;
for ( ; n-- ; ppt++, pwidth++ )
xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm,
ppt->x, ppt->y, *pwidth, 1, xSrc, ySrc ) ;
xfree( pptFree ) ;
xfree( pwidthFree ) ;
return ;
}

View file

@ -1,220 +0,0 @@
/*
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright IBM Corporation 1987,1988,1989
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM 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.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "scrnintstr.h"
#include "ibmTrace.h"
/*
xf4bppCopyWindow copies only the parts of the destination that are
visible in the source.
*/
void
xf4bppCopyWindow(pWin, ptOldOrg, prgnSrc)
register WindowPtr pWin ;
DDXPointRec ptOldOrg ;
RegionPtr prgnSrc ;
{
RegionPtr prgnDst ;
register BoxPtr pbox ;
register int dx, dy ;
register int nbox ;
register int pm ;
BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew ;
/* temporaries for shuffling rectangles */
TRACE(("xf4bppCopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n", pWin, ptOldOrg, prgnSrc)) ;
dx = ptOldOrg.x - pWin->drawable.x ;
dy = ptOldOrg.y - pWin->drawable.y ;
REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy);
prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1);
REGION_INTERSECT(pWin->drawable.pScreen, prgnDst,
&pWin->borderClip, prgnSrc);
if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) )
return;
pbox = REGION_RECTS(prgnDst);
pboxNew = 0 ;
if ( nbox > 1 ) {
if ( dy < 0 ) {
if ( dx > 0 ) {
/* walk source bottom to top */
/* keep ordering in each band, reverse order of bands */
if ( !( pboxNew =
(BoxPtr) xalloc( sizeof( BoxRec ) * nbox ) ) )
return ;
pboxBase = pboxNext = pbox+nbox - 1 ;
while ( pboxBase >= pbox ) {
while ( ( pboxNext >= pbox )
&& ( pboxBase->y1 == pboxNext->y1 ) )
pboxNext-- ;
pboxTmp = pboxNext + 1 ;
while ( pboxTmp <= pboxBase )
*pboxNew++ = *pboxTmp++ ;
pboxBase = pboxNext ;
}
pboxNew -= nbox ;
pbox = pboxNew ;
}
else { /* dx <= 0 */
/* we can just reverse the entire list in place */
/* Do three-position swaps */
BoxRec tmpBox ;
pboxBase = pbox ;
pboxNext = pbox + nbox - 1 ;
while ( pboxBase < pboxNext ) {
/* ****** Warning Structure Assignment !! ****** */
tmpBox = *pboxBase ;
*pboxBase = *pboxNext ;
*pboxNext = tmpBox ;
pboxBase++ ;
pboxNext-- ;
}
}
}
else if ( dx < 0 ) {
/* walk source right to left */
/* reverse order of rects in each band */
if ( !( pboxNew = (BoxPtr)xalloc(sizeof(BoxRec) * nbox) ) )
return ;
pboxBase = pboxNext = pbox ;
while (pboxBase < pbox+nbox)
{
while ((pboxNext < pbox+nbox) &&
(pboxNext->y1 == pboxBase->y1))
pboxNext++ ;
pboxTmp = pboxNext ;
while (pboxTmp != pboxBase)
*pboxNew++ = *--pboxTmp ;
pboxBase = pboxNext ;
}
pboxNew -= nbox ;
pbox = pboxNew ;
}
} /* END if nbox > 1 */
/*
* call blit several times, the parms are:
* blit( alu,rplanes, wplanes, srcx, srcy, destx, desty, width, height ) ;
*/
pm = ( 1 << pWin->drawable.depth ) - 1 ;
for ( ; nbox-- ; pbox++ )
xf4bppBitBlt( pWin, GXcopy, pm,
pbox->x1 + dx, pbox->y1 + dy,
pbox->x1, pbox->y1,
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1) ;
/* free up stuff */
if ( pboxNew )
xfree( pboxNew ) ;
REGION_DESTROY(pWin->drawable.pScreen, prgnDst);
}
Bool xf4bppPositionWindow(pWin, x, y)
register WindowPtr pWin ;
register int x, y ;
{
return TRUE ;
}
Bool
xf4bppDestroyWindow(pWin)
register WindowPtr pWin ;
{
return pWin ? TRUE : FALSE ;
}
/* As The Name Says -- Used For ega, vga and apa8c */
Bool
xf4bppCreateWindowForXYhardware(pWin)
register WindowPtr pWin ;
{
TRACE(("xf4bppCreateWindowForXYhardware (pWin= 0x%x)\n", pWin));
return TRUE;
}

View file

@ -1,749 +0,0 @@
/* GJA -- span move routines */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "vgaReg.h"
#include "vgaVideo.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
#ifndef PC98_EGC /* not PC98_EGC */
/* NOTE: It seems that there is no way to program the VGA to copy just
* a part of a byte in the smarter modes. Therefore we copy the boundaries
* plane by plane.
*/
#define WORDSZ 8
/* The fast blit code requires WORDSZ = 8 for its read-modify write cycle.
* Therefore, we do not fully implement the other options.
*/
#define HIGHPLANEMASK 0x08
#define HIGHPLANEINDEX 3
/* Of course, we want the following anyway:
* (Yes, they're identical now.)
*/
#define SMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
#define DMEM(x,y) ( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + (x) )
#define WORD8 unsigned char
#define LW8 BYTES_PER_LINE(pWin) /* Line width */
#define WSHIFT8 0x3
#define WMASK8 0x07
/* NOTE: lmask[8] matters. It must be different from lmask[0] */
static unsigned char lmasktab[] = {
0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF
} ;
static unsigned char rmasktab[] = {
0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00
} ;
#define LMASK8(n) lmasktab[n]
#define RMASK8(n) rmasktab[n]
#define SWAPB8(x) (x)
#if (WORDSZ == 8)
#define WORD WORD8
#define LW LW8
#define WSHIFT WSHIFT8
#define WMASK WMASK8
#define LMASK(n) LMASK8(n)
#define RMASK(n) RMASK8(n)
#define SWAPB(x) SWAPB8(x)
#endif /* WORDSZ == 8 */
#define DO_ALU(dst,src,mask,alu) {\
int _ndst, _odst; _odst = dst; \
switch ( alu ) { \
case GXclear: \
_ndst = 0; break; \
case GXand: \
_ndst = src & _odst; break; \
case GXandReverse: \
_ndst = src & ~ _odst; break; \
case GXcopy: \
_ndst = src; break; \
case GXandInverted: \
_ndst = ~ src & _odst; break; \
default: \
case GXnoop: \
_ndst = _odst; break; \
case GXxor: \
_ndst = src ^ _odst; break; \
case GXor: \
_ndst = src | _odst; break; \
case GXnor: \
_ndst = ~ src & ~ _odst; break; \
case GXequiv: \
_ndst = ~ src ^ _odst; break; \
case GXinvert: \
_ndst = ~ _odst; break; \
case GXorReverse: \
_ndst = src | ~ _odst; break; \
case GXcopyInverted: \
_ndst = ~ src; break; \
case GXorInverted: \
_ndst = ~ src | _odst; break; \
case GXnand: \
_ndst = ~ src | ~ _odst; break; \
case GXset: \
_ndst = ~0; break; \
} \
dst = (_odst & ~(mask)) | (_ndst & (mask)); \
}
static void aligned_blit(
WindowPtr, int, int, int, int, int, int, int, int
);
static void aligned_blit_center(
WindowPtr, int, int, int, int, int, int
);
static void shift(
WindowPtr, int, int, int, int, int, int, int
);
static void shift_thin_rect(
WindowPtr, int, int, int, int, int, int, int
);
static void shift_center(
WindowPtr, int, int, int, int, int, int, int
);
void xf4bppBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h)
WindowPtr pWin; /* GJA */
int alu;
int writeplanes; /* planes */
int x0, y0, x1, y1, w, h;
{
IOADDRESS REGBASE;
int plane, bit;
if ( !w || !h ) return;
if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffBitBlt(pWin,alu,writeplanes,x0,y0,x1,y1,w,h);
return;
}
REGBASE =
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
/* 0x7, not WMASK: it is hardware dependant */
if ( ((x0 - x1) & 0x7) || (alu != GXcopy) ) {
/* Use slow copy */
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
plane ; plane >>= 1, bit-- )
{
if ( writeplanes & plane) {
SetVideoGraphics(Read_Map_SelectIndex, bit);
SetVideoSequencer(Mask_MapIndex, plane);
shift(pWin,x0,x1,y0,y1,w,h,alu);
}
}
} else {
aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,writeplanes);
}
}
/* Copy a span a number of places to the right.
*/
static void
shift(pWin,x0,x1,y0,y1,w,h,alu)
WindowPtr pWin; /* GJA */
int x0; /* left edge of source */
int x1; /* left edge of target */
int y0;
int y1;
int w; /* length of source, and of target */
int h;
int alu;
{
if ( ((x1 & WMASK) + w) <= WORDSZ ) {
shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
} else if ( x1 > x0 ) { /* Shift right: start right */
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
if ( r1 ) /* right edge */
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
shift_center(pWin,x0,x1,y0,y1,w,h,alu);
if ( l1 ) /* left edge */
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
} else {
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
if ( l1 ) /* left edge */
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
shift_center(pWin,x0,x1,y0,y1,w,h,alu);
if ( r1 ) /* right edge */
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
}
}
/* The whole rectangle is so thin that it fits in one byte written */
static void
shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu)
WindowPtr pWin; /* GJA */
int x0; /* left edge of source */
int x1; /* left edge of target */
int y0;
int y1;
int w; /* length of source, and of target */
int h;
int alu;
{
int l0 = x0 & WMASK; /* Left edge of source, as bit */
int l1 = x1 & WMASK; /* Left edge of target, as bit */
int L0 = x0 >> WSHIFT; /* Left edge of source, as byte */
int L1 = x1 >> WSHIFT; /* Left edge of target, as byte */
int pad;
int htmp;
int mask;
int tmp;
int bs;
volatile unsigned char *sp, *dp;
mask = RMASK(l1) & LMASK(l1+w);
bs = (x1 - x0) & WMASK;
if ( y1 > y0 ) { /* Move down, start at the bottom */
pad = - BYTES_PER_LINE(pWin);
sp = SMEM(L0,y0+h-1);
dp = DMEM(L1,y1+h-1);
} else { /* Move up, start at the top */
pad = BYTES_PER_LINE(pWin);
sp = SMEM(L0,y0);
dp = DMEM(L1,y1);
}
if ( l0+w > WORDSZ ) {
/* Need two bytes */
for ( htmp = h ; htmp ; htmp-- ) {
tmp = (sp[0] << (WORDSZ - bs));
sp++;
tmp |= (sp[0] >> bs);
sp--;
DO_ALU(dp[0],tmp,mask,alu);
dp += pad;
sp += pad;
}
} else if ( l0 <= l1 ) {
/* Need one byte, shifted right */
for ( htmp = h ; htmp ; htmp-- ) {
tmp = (sp[0] >> bs);
DO_ALU(dp[0],tmp,mask,alu);
dp += pad;
sp += pad;
}
} else {
/* Need one byte, shifted left */
for ( htmp = h ; htmp ; htmp-- ) {
tmp = (sp[0] << (WORDSZ - bs));
DO_ALU(dp[0],tmp,mask,alu);
dp += pad;
sp += pad;
}
}
}
static void
shift_center(pWin,x0,x1,y0,y1,w,h,alu)
WindowPtr pWin; /* GJA */
int x0; /* left edge of source */
int x1; /* left edge of target */
int y0;
int y1;
int w; /* length of source, and of target */
int h;
int alu;
{
int l1 = x1 & WMASK; /* Left edge of target, as bit */
int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
int pad;
int htmp, wtmp; /* Temporaries for indices over height and width */
volatile unsigned char tmp; /* Temporary result of the shifts */
int bs;
int rem; /* Remaining bits; temporary in loop */
int bytecnt;
volatile unsigned char *sp, *dp;
bs = (x1 - x0) & WMASK;
if ( l1 ) {
bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
} else {
bytecnt = (w - r1) >> WSHIFT;
sp = SMEM( (x0 >> WSHIFT), y0);
dp = DMEM( (x1 >> WSHIFT), y1);
}
if ( y1 > y0 ) { /* Move down, start at the bottom */
if ( x1 > x0 ) { /* Move right, start right */
pad = - BYTES_PER_LINE(pWin) + bytecnt;
sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
} else { /* Move left, start left */
pad = - BYTES_PER_LINE(pWin) - bytecnt;
sp += BYTES_PER_LINE(pWin) * (h - 1);
dp += BYTES_PER_LINE(pWin) * (h - 1);
}
} else { /* Move up, start at the top */
if ( x1 > x0 ) { /* Move right, start right */
pad = BYTES_PER_LINE(pWin) + bytecnt;
sp += bytecnt - 1;
dp += bytecnt - 1;
} else { /* Move left, start left */
pad = BYTES_PER_LINE(pWin) - bytecnt;
sp += 0;
dp += 0;
}
}
if ( x1 > x0 ) { /* Move right, start right */
if ( bs == 0 ) { /* No shift. Need one byte only */
for ( htmp = h ; htmp ; htmp-- ) {
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
tmp = sp[0];
DO_ALU(dp[0],tmp,~0,alu);
dp--;
sp--;
}
dp += pad;
sp += pad;
}
} else {
for ( htmp = h ; htmp ; htmp-- ) {
if ( bytecnt ) {
sp++;
rem = sp[0];
sp--;
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
tmp = (rem >> bs);
rem = sp[0];
tmp |= (rem << (WORDSZ - bs)) ;
DO_ALU(dp[0],tmp,~0,alu);
dp--;
sp--;
}
}
dp += pad;
sp += pad;
}
}
} else { /* x1 <= x0 */ /* Move left, start left */
if ( bs == 0 ) { /* No shift. Need one byte only */
for ( htmp = h ; htmp ; htmp-- ) {
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
tmp = sp[0];
DO_ALU(dp[0],tmp,~0,alu);
dp++;
sp++;
}
dp += pad;
sp += pad;
}
} else {
for ( htmp = h ; htmp ; htmp-- ) {
if ( bytecnt ) {
rem = sp[0];
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
tmp = (rem << (WORDSZ - bs));
sp++;
rem = sp[0];
sp--;
tmp |= (rem >> bs);
DO_ALU(dp[0],tmp,~0,alu);
dp++;
sp++;
}
}
dp += pad;
sp += pad;
}
}
}
}
/* Copy a rectangle.
*/
static void
aligned_blit(pWin,x0,x1,y0,y1,w,h,alu,planes)
WindowPtr pWin; /* GJA */
int x0; /* left edge of source */
int x1; /* left edge of target */
int y0;
int y1;
int w; /* length of source, and of target */
int h;
int alu;
int planes;
{
IOADDRESS REGBASE =
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
int plane, bit;
if ( ((x1 & WMASK) + w) <= WORDSZ ) {
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
plane ; plane >>= 1, bit-- )
{
if ( planes & plane) {
SetVideoGraphics(Read_Map_SelectIndex, bit);
SetVideoSequencer(Mask_MapIndex, plane);
shift_thin_rect(pWin,x0,x1,y0,y1,w,h,alu);
}
}
} else if ( x1 > x0 ) { /* Shift right: start right */
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
if ( r1 ) { /* right edge */
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
plane ; plane >>= 1, bit-- )
{
if ( planes & plane) {
SetVideoGraphics(Read_Map_SelectIndex, bit);
SetVideoSequencer(Mask_MapIndex, plane);
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
}
}
}
/* Center */
SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
SetVideoSequencer(Mask_MapIndex, planes);
aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
if ( l1 ) { /* left edge */
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
plane ; plane >>= 1, bit-- )
{
if ( planes & plane) {
SetVideoGraphics(Read_Map_SelectIndex, bit);
SetVideoSequencer(Mask_MapIndex, plane);
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
}
}
}
} else {
int l1 = x1 & WMASK, r1 = (x1 + w) & WMASK;
if ( l1 ) { /* left edge */
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX;
plane ; plane >>= 1, bit-- )
{
if ( planes & plane) {
SetVideoGraphics(Read_Map_SelectIndex, bit);
SetVideoSequencer(Mask_MapIndex, plane);
shift_thin_rect(pWin,x0,x1,y0,y1,(WORDSZ-l1),h,alu);
}
}
}
/* Center */
SetVideoGraphics(Graphics_ModeIndex, 1); /* Write mode 1 */
SetVideoSequencer(Mask_MapIndex, planes);
aligned_blit_center(pWin,x0,x1,y0,y1,w,h);
if ( r1 ) { /* right edge */
SetVideoGraphics(Enb_Set_ResetIndex, 0); /* All from CPU */
SetVideoGraphics(Bit_MaskIndex, 0xFF); /* All bits */
SetVideoGraphics(Graphics_ModeIndex, 0); /* Write mode 0 */
SetVideoGraphics(Data_RotateIndex, 0); /* Don't rotate, replace */
for ( plane = HIGHPLANEMASK, bit = HIGHPLANEINDEX ;
plane ; plane >>= 1, bit-- )
{
if ( planes & plane) {
SetVideoGraphics(Read_Map_SelectIndex, bit);
SetVideoSequencer(Mask_MapIndex, plane);
shift_thin_rect(pWin,x0+w-r1,x1+w-r1,y0,y1,r1,h,alu);
}
}
}
}
}
static void
aligned_blit_center(pWin,x0,x1,y0,y1,w,h)
WindowPtr pWin; /* GJA */
int x0; /* left edge of source */
int x1; /* left edge of target */
int y0;
int y1;
int w; /* length of source, and of target */
int h;
{
int l1 = x1 & WMASK; /* Left edge of target, as bit */
int r1 = (x1 + w) & WMASK; /* Right edge of target, as bit */
int pad;
int htmp, wtmp; /* Temporaries for indices over height and width */
volatile unsigned char tmp; /* Temporary result of the shifts */
int bytecnt;
volatile unsigned char *sp, *dp;
if ( l1 ) {
bytecnt = (w - (WORDSZ - l1) - r1) >> WSHIFT;
sp = SMEM( ((x0 + (WORDSZ - l1)) >> WSHIFT), y0);
dp = DMEM( ((x1 + (WORDSZ - l1)) >> WSHIFT), y1);
} else {
bytecnt = (w - r1) >> WSHIFT;
sp = SMEM( (x0 >> WSHIFT), y0);
dp = DMEM( (x1 >> WSHIFT), y1);
}
if ( y1 > y0 ) { /* Move down, start at the bottom */
if ( x1 > x0 ) { /* Move right, start right */
pad = - BYTES_PER_LINE(pWin) + bytecnt;
sp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
dp += BYTES_PER_LINE(pWin) * (h - 1) + bytecnt - 1;
} else { /* Move left, start left */
pad = - BYTES_PER_LINE(pWin) - bytecnt;
sp += BYTES_PER_LINE(pWin) * (h - 1);
dp += BYTES_PER_LINE(pWin) * (h - 1);
}
} else { /* Move up, start at the top */
if ( x1 > x0 ) { /* Move right, start right */
pad = BYTES_PER_LINE(pWin) + bytecnt;
sp += bytecnt - 1;
dp += bytecnt - 1;
} else { /* Move left, start left */
pad = BYTES_PER_LINE(pWin) - bytecnt;
sp += 0;
dp += 0;
}
}
if ( x1 > x0 ) { /* Move right, start right */
for ( htmp = h ; htmp ; htmp-- ) {
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
tmp = sp[0];
dp[0] = tmp;
dp--;
sp--;
}
dp += pad;
sp += pad;
}
} else { /* x1 <= x0 */ /* Move left, start left */
for ( htmp = h ; htmp ; htmp-- ) {
for ( wtmp = bytecnt ; wtmp ; wtmp-- ) {
tmp = sp[0];
dp[0] = tmp;
dp++;
sp++;
}
dp += pad;
sp += pad;
}
}
}
#else /* PC98_EGC */
static void
egc_fast_blt (pWin, alu, writeplanes, x0, y0, x1, y1, w, h)
WindowPtr pWin;
const int alu, writeplanes ;
register int x0, x1 ;
int y0, y1 ;
register int w, h ;
{
register volatile unsigned char *src ;
register volatile unsigned char *dst ;
unsigned short *src_x ;
unsigned short *dst_x ;
int x_direction, y_interval ;
int src_off, dst_off ;
register int k, i ;
unsigned short ROP_value;
src = (unsigned char *)SCREENADDRESS( pWin, 0, y0);
dst = (unsigned char *)SCREENADDRESS( pWin, 0, y1);
/* Set Map Mask */
outw(EGC_PLANE, ~(writeplanes & VGA_ALLPLANES));
switch(alu) {
case GXnor: /* ~(S|D) */
ROP_value = 0x2903;
break;
case GXandInverted: /* ~S&D */
ROP_value = 0x290c;
break;
case GXand: /* S&D */
ROP_value = 0x29c0;
break;
case GXequiv: /* ~S ^ D */
ROP_value = 0x29c3;
break;
case GXxor: /* S^D */
ROP_value = 0x293c;
break;
case GXandReverse: /* S&~D */
ROP_value = 0x2930;
break;
case GXorReverse: /* S|~D */
ROP_value = 0x29f3;
break;
case GXnand: /* ~(S&D) */
ROP_value = 0x293f;
break;
case GXorInverted: /* ~S|D */
ROP_value = 0x29cf;
break;
case GXor: /* S|D */
ROP_value = 0x29fa;
break;
case GXcopyInverted: /* ~S */
ROP_value = 0x290f;
break;
case GXcopy: /* S */
default:
ROP_value = 0x29f0;
}
outw(EGC_MODE, ROP_value);
if ( y1 > y0 ) {
y_interval = - BYTES_PER_LINE(pWin) * 8 ;
src += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
dst += BYTES_PER_LINE(pWin) * ( h - 1 ) ;
}
else {
y_interval = BYTES_PER_LINE(pWin) * 8 ;
}
src = (unsigned char *)((int)src << 3) ;
dst = (unsigned char *)((int)dst << 3) ;
if ( y1 > y0) {
x_direction = 0x1000 ;
src += x0 + w - 1 ;
dst += x1 + w - 1 ;
} else if ( y1 < y0 ) {
x_direction = 0 ;
src += x0 ;
dst += x1 ;
} else {
if ( x1 < x0 ) {
x_direction = 0 ;
src += x0 ;
dst += x1 ;
} else {
x_direction = 0x1000 ;
src += x0 + w - 1 ;
dst += x1 + w - 1 ;
}
}
outw ( EGC_LENGTH , w - 1 ) ;
for ( ; h-- ; ) {
if ( x_direction ) {
src_off = 15 - (int)src & 0xf ;
dst_off = 15 - (int)dst & 0xf ;
} else {
src_off = (int)src & 0xf ;
dst_off = (int)dst & 0xf ;
}
#if defined(__NetBSD__) || defined(__OpenBSD__)
src_x = (unsigned short *)(((unsigned int)src >> 4 ) << 1) ;
dst_x = (unsigned short *)(((unsigned int)dst >> 4 ) << 1) ;
#else
src_x = (unsigned short *)(((int)src >> 4 ) << 1) ;
dst_x = (unsigned short *)(((int)dst >> 4 ) << 1) ;
#endif
k = ( src_off + w + 15 ) >> 4 ;
if ( src_off < dst_off ) {
if ( ((src_off + w - 1 ) >> 4) < ((dst_off + w - 1) >> 4)) k++ ;
}
if ( src_off > dst_off ) {
if ( ((src_off + w - 1) >> 4 ) == ((dst_off + w - 1) >> 4) ) k++ ;
if ( x_direction ) dst_x ++ ;
else dst_x -- ;
}
outw ( EGC_ADD , x_direction | src_off | dst_off << 4 );
if ( x_direction ) {
wcopyl ( src_x, dst_x, k, VIDBASE(pWin) ) ;
} else {
wcopyr ( src_x, dst_x, k, VIDBASE(pWin) ) ;
}
src += y_interval ;
dst += y_interval ;
}
outw ( EGC_ADD, 0 ) ;
outw ( EGC_LENGTH , 0xf );
return;
}
void
xf4bppBitBlt( pWin,alu, writeplanes, x0, y0, x1, y1, w, h )
WindowPtr pWin; /* GJA */
int alu;
int writeplanes; /* planes */
int x0, y0, x1, y1, w, h;
{
if ( ! xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffBitBlt( pWin, alu, writeplanes,
x0, y0, x1, y1, w, h );
return;
}
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXinvert: /* 0xa NOT dst */
case GXset: /* 0xf 1 */
xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, writeplanes, x1, y1, w, h ) ;
/* x1, y1, GJA */
case GXnoop: /* 0x5 dst */
return ;
default:
break ;
}
egc_fast_blt ( pWin, alu, writeplanes, x0, y0, x1, y1, w, h);
return;
}
#endif

View file

@ -1,213 +0,0 @@
/*
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright IBM Corporation 1987,1988,1989
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 IBM not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
IBM 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.
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "mfbmap.h"
#include "mfb.h"
#include "mi.h"
#include "ppcGCstr.h"
void
xf4bppChangeGCtype( pGC, devPriv )
register GC *pGC ;
register ppcPrivGCPtr devPriv ;
{
if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) {
pGC->ops->CopyArea = miCopyArea ;
pGC->ops->PolyFillRect = miPolyFillRect ;
pGC->ops->PushPixels = miPushPixels ;
pGC->ops->PolyArc = miPolyArc ;
pGC->ops->PolyFillArc = miPolyFillArc ;
pGC->ops->PolySegment = miPolySegment ;
}
else {
pGC->ops->CopyArea = xf4bppCopyArea ;
pGC->ops->PolyFillRect = xf4bppPolyFillRect ;
pGC->ops->PushPixels = miPushPixels ; /* GJA */
pGC->ops->PolyArc = xf4bppZeroPolyArc ;
pGC->ops->PolyFillArc = xf4bppPolyFillArc ;
pGC->ops->PolySegment = xf4bppSegmentSS ;
}
return;
}
Mask
xf4bppChangeWindowGC( pGC, changes )
register GC *pGC ;
register Mask changes ;
{
register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey());
register unsigned long int idx ; /* used for stepping through bitfields */
#define LOWBIT( x ) ( x & - x ) /* Two's complement */
while ((idx = LOWBIT(changes))) {
switch ( idx ) {
case GCLineStyle:
case GCLineWidth:
pGC->ops->PolyArc = ( ( pGC->lineStyle == LineSolid )
? ( ( pGC->lineWidth == 0 ) ? xf4bppZeroPolyArc
: miPolyArc )
: miPolyArc ) ;
pGC->ops->PolySegment = ( ( pGC->lineStyle == LineSolid )
? ( ( pGC->lineWidth == 0 )
? ( ( pGC->fillStyle == FillSolid ) ?
xf4bppSegmentSS : miPolySegment )
: miPolySegment )
: ( ( pGC->lineWidth == 0 )
? ( ( pGC->fillStyle == FillSolid ) ?
xf4bppSegmentSD : miPolySegment )
: miPolySegment ) ) ;
pGC->ops->Polylines = ( ( pGC->lineStyle == LineSolid )
? ( ( pGC->lineWidth == 0 )
? ( (pGC->fillStyle == FillSolid ) ?
xf4bppLineSS : miZeroLine )
: miWideLine )
: ( ( pGC->lineWidth == 0 )
? ( (pGC->fillStyle == FillSolid ) ?
xf4bppLineSD : miWideDash )
: miWideDash ) ) ;
/*
* If these are just square boxes with no funny business
* going on we can call the fast routine that draws
* rectangles without floating point.
*/
/* too buggy */
#if 0
if ( ( pGC->lineStyle == LineSolid )
&& ( pGC->joinStyle == JoinMiter )
&& ( pGC->lineWidth != 0 ) )
pGC->ops->PolyRectangle = xf4bppPolyRectangle;
else
#endif
pGC->ops->PolyRectangle = miPolyRectangle;
changes &= ~( GCLineStyle | GCLineWidth ) ;
break ;
case GCJoinStyle:
/*
* If these are just square boxes with no funny business
* going on we can call the fast routine that draws
* rectangles without floating point.
*/
/* too buggy */
#if 0
if ( ( pGC->lineStyle == LineSolid )
&& ( pGC->joinStyle == JoinMiter )
&& ( pGC->lineWidth != 0 ) )
pGC->ops->PolyRectangle = xf4bppPolyRectangle;
else
#endif
pGC->ops->PolyRectangle = miPolyRectangle;
changes &= ~ idx ; /* i.e. changes &= ~ GCJoinStyle */
break ;
case GCBackground:
if ( pGC->fillStyle != FillOpaqueStippled ) {
changes &= ~ idx ; /* i.e. changes &= ~GCBackground */
break ;
} /* else Fall Through */
case GCForeground:
if ( pGC->fillStyle == FillTiled ) {
changes &= ~ idx ; /* i.e. changes &= ~GCForeground */
break ;
} /* else Fall Through */
case GCFunction:
case GCPlaneMask:
case GCFillStyle:
{ /* new_fill */
int fillStyle = devPriv->colorRrop.fillStyle ;
/* install a suitable fillspans */
if ( fillStyle == FillSolid )
pGC->ops->FillSpans = xf4bppSolidWindowFS ;
else if ( fillStyle == FillStippled )
pGC->ops->FillSpans = xf4bppStippleWindowFS ;
else if ( fillStyle == FillOpaqueStippled )
pGC->ops->FillSpans = xf4bppOpStippleWindowFS ;
else /* fillStyle == FillTiled */
pGC->ops->FillSpans = xf4bppTileWindowFS ;
} /* end of new_fill */
changes &= ~( GCBackground | GCForeground
| GCFunction
| GCPlaneMask | GCFillStyle ) ;
break ;
default:
ErrorF("xf4bppChangeWindowGC: Unexpected GC Change\n") ;
changes &= ~ idx ; /* Remove it anyway */
break ;
}
}
return changes;
}

View file

@ -1,460 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "vgaReg.h"
#include "vgaVideo.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
#undef TRUE
#undef FALSE
#define TRUE 1
#define FALSE 0
void
xf4bppDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes )
WindowPtr pWin; /* GJA */
int x, y ;
register int w, h ;
unsigned char *data ;
register int RowIncrement ;
const int alu ;
const unsigned long int planes ;
{
IOADDRESS REGBASE;
register unsigned long int tmp ;
register const unsigned char *src ;
register volatile unsigned char *dst ;
register int Pixel_Count ;
register unsigned int currMask ;
register unsigned int InitialMask ;
register volatile unsigned char *StartByte ;
unsigned int invert_source_data = FALSE ;
#ifdef PC98_EGC /* new EGC test */
register unsigned char tmp1;
#endif
{ /* Start GJA */
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffDrawColorImage( pWin, x, y, w, h, data, RowIncrement, alu, planes );
return;
}
} /* End GJA */
{
unsigned int invert_existing_data = FALSE ;
unsigned int data_rotate_value = VGA_COPY_MODE ;
#ifdef PC98_EGC
unsigned short ROP_value;
#endif
REGBASE = 0x300 +
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
case GXinvert: /* 0xa NOT dst */
case GXset: /* 0xf 1 */
xf4bppFillSolid( pWin, VGA_ALLPLANES, alu, planes, x, y, w, h ) ;
case GXnoop: /* 0x5 dst */
return ;
case GXnor: /* 0x8 NOT src AND NOT dst */
invert_existing_data = TRUE ;
case GXandInverted: /* 0x4 NOT src AND dst */
invert_source_data = TRUE ;
case GXand: /* 0x1 src AND dst */
data_rotate_value = VGA_AND_MODE ;
break ;
case GXequiv: /* 0x9 NOT src XOR dst */
invert_source_data = TRUE ;
case GXxor: /* 0x6 src XOR dst */
data_rotate_value = VGA_XOR_MODE ;
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
invert_existing_data = TRUE ;
data_rotate_value = VGA_AND_MODE ;
break ;
case GXnand: /* 0xe NOT src OR NOT dst */
invert_source_data = TRUE ;
case GXorReverse: /* 0xb src OR NOT dst */
invert_existing_data = TRUE ;
/* GJA -- moved this here */
data_rotate_value = VGA_OR_MODE ;
break ;
case GXorInverted: /* 0xd NOT src OR dst */
invert_source_data = TRUE ;
case GXor: /* 0x7 src OR dst */
data_rotate_value = VGA_OR_MODE ;
break ;
case GXcopyInverted: /* 0xc NOT src */
invert_source_data = TRUE ;
case GXcopy: /* 0x3 src */
default:
break ;
}
#ifdef PC98_EGC
/* Setup EGC Registers */
switch(data_rotate_value) {
/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
case VGA_AND_MODE:
if (invert_existing_data)
ROP_value = EGC_AND_INV_MODE;
else
ROP_value = EGC_AND_MODE;
break;
case VGA_OR_MODE:
if (invert_existing_data)
ROP_value = EGC_OR_INV_MODE;
else
ROP_value = EGC_OR_MODE;
break;
case VGA_XOR_MODE:
if (invert_existing_data)
ROP_value = EGC_XOR_INV_MODE;
else
ROP_value = EGC_XOR_MODE;
break;
case VGA_COPY_MODE:
default:
ROP_value = EGC_COPY_MODE;
break;
}
outw(EGC_PLANE, ~(planes & VGA_ALLPLANES));
outw(EGC_MODE, ROP_value);
outw(EGC_FGC, 0x0000);
tmp1 = 0;
#else
if ( invert_existing_data )
xf4bppFillSolid( pWin, VGA_ALLPLANES, GXinvert, planes, x, y, w, h ) ;
/* Setup VGA Registers */
SetVideoSequencer( Mask_MapIndex, planes & VGA_ALLPLANES ) ;
/* Set Raster Op */
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_2 ) ;
#endif
}
StartByte = SCREENADDRESS(pWin, x, y);
InitialMask = SCRRIGHT8( LeftmostBit, BIT_OFFSET( x ) ) ;
if ( invert_source_data )
#ifdef PC98_EGC
#if 0 /* New EGC version */
egc_image_invert ( StartByte, data, InitialMask, w, h,
RowIncrement ) ;
#else /* new EGC c version */
for ( ;
h-- ;
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
dst = StartByte;
for ( src = data,
Pixel_Count = w, currMask = InitialMask ;
Pixel_Count-- ;
src++ ) {
if (tmp1 != (~*src & VGA_ALLPLANES)) {
tmp1 = ~*src & VGA_ALLPLANES;
/* set FGC */
outw(EGC_FGC, ~*src & VGA_ALLPLANES);
}
*((VgaMemoryPtr) dst) = currMask;
if ( currMask & RightmostBit ) {
currMask = LeftmostBit ;
dst++;
}
else
currMask = SCRRIGHT8( currMask, 1 ) ;
}
}
#endif /* new EGC */
#else /* original */
for ( ;
h-- ;
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
dst = StartByte;
for ( src = data,
Pixel_Count = w, currMask = InitialMask ;
Pixel_Count-- ;
src++ ) {
/* Set The Bit Mask Reg */
SetVideoGraphics( Bit_MaskIndex, currMask ) ;
/* Read To Load vga Data Latches */
tmp = *( (VgaMemoryPtr) dst ) ;
(void) tmp;
*( (VgaMemoryPtr) dst ) = ~ *src ;
if ( currMask & RightmostBit ) {
currMask = LeftmostBit ;
dst++;
}
else
currMask = SCRRIGHT8( currMask, 1 ) ;
}
}
#endif
else /* invert_source_data == FALSE */
#ifdef PC98_EGC
#if 0 /* new EGC version */
egc_image ( StartByte, data, InitialMask, w, h,
RowIncrement );
#else /* new EGC c version */
for ( ;
h-- ;
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
dst = StartByte;
for ( src = data,
Pixel_Count = w, currMask = InitialMask ;
Pixel_Count-- ;
src++ ) {
if (tmp1 != *src & VGA_ALLPLANES) {
tmp1 = *src & VGA_ALLPLANES;
outw(EGC_FGC, tmp1); /* set FGC */
}
*((VgaMemoryPtr) dst) = currMask; /* write with mask */
if ( currMask & RightmostBit ) {
currMask = LeftmostBit ;
dst++;
}
else
currMask = SCRRIGHT8( currMask, 1 ) ;
}
}
#endif /* new EGC version */
#else /* original */
for ( ;
h-- ;
data += RowIncrement, StartByte += BYTES_PER_LINE(pWin) ) {
dst = StartByte;
for ( src = data,
Pixel_Count = w, currMask = InitialMask ;
Pixel_Count-- ;
src++ ) {
/* Set The Bit Mask Reg */
SetVideoGraphics( Bit_MaskIndex, currMask ) ; /* GJA */
/* Read To Load vga Data Latches */
tmp = *( (VgaMemoryPtr) dst ) ;
(void) tmp;
*( (VgaMemoryPtr) dst ) = *src ;
if ( currMask & RightmostBit ) {
currMask = LeftmostBit ;
dst++;
}
else
currMask = SCRRIGHT8( currMask, 1 ) ;
}
}
#endif /* original */
return ;
}
#ifndef PC98_EGC
static unsigned long int
read8Z
(
IOADDRESS REGBASE,
register volatile unsigned char *screen_ptr
)
{
register unsigned long int i ;
register unsigned long int j ;
/* Read One Byte At A Time to get
* i == [ Plane 3 ] [ Plane 2 ] [ Plane 1 ] [ Plane 0 ]
* into a single register
*/
SetVideoGraphicsData( 3 ) ;
i = *( (VgaMemoryPtr) screen_ptr ) << 8 ;
SetVideoGraphicsData( 2 ) ;
i |= *( (VgaMemoryPtr) screen_ptr ) ;
i <<= 8 ;
SetVideoGraphicsData( 1 ) ;
i |= *( (VgaMemoryPtr) screen_ptr ) ;
i <<= 8 ;
SetVideoGraphicsData( 0 ) ;
i |= *( (VgaMemoryPtr) screen_ptr ) ;
/* Push Bits To Get
* j == [Pixel 7][Pixel 6][Pixel 5][Pixel 4][Pixel 3][Pixel 2][Pixel 1][Pixel 0]
* into one register
*/
j = ( i & 0x1 ) << 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j <<= 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j <<= 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j <<= 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j <<= 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j <<= 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j <<= 4 ;
j |= ( i >>= 1 ) & 0x1 ;
j |= ( i & 0x2 ) << 28 ;
j |= ( ( i >>= 1 ) & 0x2 ) << 24 ;
j |= ( ( i >>= 1 ) & 0x2 ) << 20 ;
j |= ( ( i >>= 1 ) & 0x2 ) << 16 ;
j |= ( ( i >>= 1 ) & 0x2 ) << 12 ;
j |= ( ( i >>= 1 ) & 0x2 ) << 8 ;
j |= ( ( i >>= 1 ) & 0x2 ) << 4 ;
j |= ( i >>= 1 ) & 0x2 ;
j |= ( i & 0x4 ) << 28 ;
j |= ( ( i >>= 1 ) & 0x4 ) << 24 ;
j |= ( ( i >>= 1 ) & 0x4 ) << 20 ;
j |= ( ( i >>= 1 ) & 0x4 ) << 16 ;
j |= ( ( i >>= 1 ) & 0x4 ) << 12 ;
j |= ( ( i >>= 1 ) & 0x4 ) << 8 ;
j |= ( ( i >>= 1 ) & 0x4 ) << 4 ;
j |= ( i >>= 1 ) & 0x4 ;
j |= ( i & 0x8 ) << 28 ;
j |= ( ( i >>= 1 ) & 0x8 ) << 24 ;
j |= ( ( i >>= 1 ) & 0x8 ) << 20 ;
j |= ( ( i >>= 1 ) & 0x8 ) << 16 ;
j |= ( ( i >>= 1 ) & 0x8 ) << 12 ;
j |= ( ( i >>= 1 ) & 0x8 ) << 8 ;
j |= ( ( i >>= 1 ) & 0x8 ) << 4 ;
j |= ( i >>= 1 ) & 0x8 ;
return j ;
}
#endif /* not PC98_EGC */
void
xf4bppReadColorImage( pWin, x, y, lx, ly, data, RowIncrement )
WindowPtr pWin; /* GJA */
int x, y ;
int lx, ly ;
register unsigned char *data ;
int RowIncrement ;
{
IOADDRESS REGBASE;
register unsigned long int tmp ;
register volatile unsigned char *src ;
volatile unsigned char *masterSrc ;
int savCenterWidth ;
int dx ;
int skip ;
int center_width ;
int ignore ;
int pad ;
unsigned char tmpc;
{ /* Start GJA */
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffReadColorImage( pWin, x, y, lx, ly, data, RowIncrement );
return;
}
} /* End GJA */
if ( ( lx <= 0 ) || ( ly <= 0 ) )
return ;
REGBASE = 0x300 +
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase;
/* Setup VGA Registers */
#ifndef PC98_EGC
SetVideoGraphicsIndex( Graphics_ModeIndex ) ;
tmpc = inb( GraphicsDataRegister );
SetVideoGraphicsData( tmpc & ~0x8 ) ; /* Clear the bit */
SetVideoGraphicsIndex( Read_Map_SelectIndex ) ;
#else
outw(EGC_MODE, 0x0800);
#endif
skip = BIT_OFFSET( x ) ;
pad = RowIncrement - lx ;
ignore = BIT_OFFSET( x + lx ) ;
masterSrc = SCREENADDRESS( pWin, x, y ) ;
center_width = ROW_OFFSET( x + lx ) - ROW_OFFSET( ( x + 0x7 ) & ~0x7 ) ;
#define SINGLE_STEP *data++ = tmp & VGA_ALLPLANES ; tmp >>= 4
if ( center_width < 0 ) {
src = masterSrc;
for ( ; ly-- ; ) {
tmp = read8Z( REGBASE, src ) >> ( skip << 2 ) ;
for ( dx = lx + 1 ; --dx ; ) {
SINGLE_STEP ;
}
data += pad ;
src += BYTES_PER_LINE(pWin);
}
} else
for ( savCenterWidth = center_width ;
ly-- ;
center_width = savCenterWidth,
masterSrc += BYTES_PER_LINE(pWin) ) {
src = masterSrc ;
tmp = read8Z( REGBASE, src ) ; src++;
if ((dx = skip))
tmp >>= ( dx << 2 ) ;
else
if ( lx < 8 ) { /* kludge -- GJA */
--center_width ; /* kludge -- GJA */
dx = 8 - lx ; /* kludge -- GJA */
} else /* kludge -- GJA */
--center_width ;
BranchPoint:
switch ( dx ) {
LoopTop:
case 0x0: SINGLE_STEP ;
case 0x1: SINGLE_STEP ;
case 0x2: SINGLE_STEP ;
case 0x3: SINGLE_STEP ;
case 0x4: SINGLE_STEP ;
case 0x5: SINGLE_STEP ;
case 0x6: SINGLE_STEP ;
case 0x7: *data++ = tmp & VGA_ALLPLANES ;
/* Fall Through To End Of Inner Loop */
if ( center_width > 0 ) {
tmp = read8Z( REGBASE, src ) ; src++;
center_width-- ;
goto LoopTop ;
}
else if ( ( center_width == 0 )
&& ( dx = ( - ignore ) & 07 ) ) {
tmp = read8Z( REGBASE, src ) ; src++;
center_width-- ;
goto BranchPoint ; /* Do Mod 8 edge */
}
else /* End of this line */
data += pad ;
}
}
return ;
}

View file

@ -1,137 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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.
*
*/
#define SET_BYTE_REGISTER( ioport, value ) outb( ioport, value )
#define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
#define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
/* GJA -- deleted RTIO and ATRIO case here, so that a PCIO #define became
* superfluous.
*/
#define SET_INDEXED_REGISTER(RegGroup, Index, Value) \
(SET_BYTE_REGISTER(RegGroup, Index), \
SET_BYTE_REGISTER((RegGroup) + 1, Value))
/* There is a jumper on the ega to change this to 0x200 instead !! */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#if 0 /* This is now a stack variable, as needed */
#define REGBASE 0x300
#endif
#define AttributeIndexRegister REGBASE + 0xC0
#define AttributeDataWriteRegister REGBASE + 0xC0
#define AttributeDataReadRegister REGBASE + 0xC1
#define AttributeRegister AttributeIndexRegister
#define AttributeModeIndex 0x30
#define OverScanColorIndex 0x31
#define ColorPlaneEnableIndex 0x32
#define HorizPelPanIndex 0x33
#define ColorSelectIndex 0x34
#ifndef PC98_EGC
#define SetVideoAttributeIndex( index ) \
SET_INDEX_REGISTER( AttributeIndexRegister, index )
#define SetVideoAttribute( index, value ) \
SetVideoAttributeIndex( index ) ; \
SET_BYTE_REGISTER( AttributeDataWriteRegister, value )
#endif
/* Graphics Registers 03CE & 03CF */
#define GraphicsIndexRegister REGBASE + 0xCE
#define GraphicsDataRegister REGBASE + 0xCF
#define GraphicsRegister GraphicsIndexRegister
#define Set_ResetIndex 0x00
#define Enb_Set_ResetIndex 0x01
#define Color_CompareIndex 0x02
#define Data_RotateIndex 0x03
#define Read_Map_SelectIndex 0x04
#define Graphics_ModeIndex 0x05
#define MiscellaneousIndex 0x06
#define Color_Dont_CareIndex 0x07
#define Bit_MaskIndex 0x08
#ifndef PC98_EGC
#define SetVideoGraphicsIndex( index ) \
SET_INDEX_REGISTER( GraphicsIndexRegister, index )
#define SetVideoGraphicsData( value ) \
SET_INDEX_REGISTER( GraphicsDataRegister, value )
#define SetVideoGraphics( index, value ) \
SET_INDEXED_REGISTER( GraphicsRegister, index, value )
#endif
/* Sequencer Registers 03C4 & 03C5 */
#define SequencerIndexRegister REGBASE + 0xC4
#define SequencerDataRegister REGBASE + 0xC5
#define SequencerRegister SequencerIndexRegister
#define Seq_ResetIndex 00
#define Clock_ModeIndex 01
#define Mask_MapIndex 02
#define Char_Map_SelectIndex 03
#define Memory_ModeIndex 04
#ifndef PC98_EGC
#define SetVideoSequencerIndex( index ) \
SET_INDEX_REGISTER( SequencerIndexRegister, index )
#define SetVideoSequencer( index, value ) \
SET_INDEXED_REGISTER( SequencerRegister, index, value )
#endif
/* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */
/* for the Graphics' Data_Rotate Register */
#define VGA_ROTATE_FUNC_SHIFT 3
#define VGA_COPY_MODE ( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */
#define VGA_AND_MODE ( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */
#define VGA_OR_MODE ( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */
#define VGA_XOR_MODE ( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */
/* for the Graphics' Graphics_Mode Register */
#define VGA_READ_MODE_SHIFT 3
#define VGA_WRITE_MODE_0 0
#define VGA_WRITE_MODE_1 1
#define VGA_WRITE_MODE_2 2
#define VGA_WRITE_MODE_3 3
#define VGA_READ_MODE_0 ( 0 << VGA_READ_MODE_SHIFT )
#define VGA_READ_MODE_1 ( 1 << VGA_READ_MODE_SHIFT )
#ifdef PC98_EGC
/* I/O port address define for extended EGC */
#define EGC_PLANE 0x4a0 /* EGC active plane select */
#define EGC_READ 0x4a2 /* EGC FGC,EGC,Read Plane */
#define EGC_MODE 0x4a4 /* EGC Mode register & ROP */
#define EGC_FGC 0x4a6 /* EGC Forground color */
#define EGC_MASK 0x4a8 /* EGC Mask register */
#define EGC_BGC 0x4aa /* EGC Background color */
#define EGC_ADD 0x4ac /* EGC Dest/Source address */
#define EGC_LENGTH 0x4ae /* EGC Bit length */
#define PALETTE_ADD 0xa8 /* Palette address */
#define PALETTE_GRE 0xaa /* Palette Green */
#define PALETTE_RED 0xac /* Palette Red */
#define PALETTE_BLU 0xae /* Palette Blue */
#define EGC_AND_MODE 0x2c8c /* (S&P&D)|(~S&D) */
#define EGC_AND_INV_MODE 0x2c2c /* (S&P&~D)|(~S&D) */
#define EGC_OR_MODE 0x2cec /* S&(P|D)|(~S&D) */
#define EGC_OR_INV_MODE 0x2cbc /* S&(P|~D)|(~S&D) */
#define EGC_XOR_MODE 0x2c6c /* (S&(P&~D|~P&D))|(~S&D) */
#define EGC_XOR_INV_MODE 0x2c9c /* (S&(P&D)|(~P&~D))|(~S&D) */
#define EGC_COPY_MODE 0x2cac /* (S&P)|(~S&D) */
#endif

View file

@ -1,574 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "vgaReg.h"
#include "vgaVideo.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
#undef TRUE
#undef FALSE
#define TRUE 1
#define FALSE 0
#ifndef PC98_EGC
#ifdef USE_ASM
extern void fastFill();
extern void fastFillRMW();
#else
static void fastFill
(
register volatile unsigned char *destination,
register const unsigned int bytes_per_line,
register const unsigned int bytewidth, /* MUST BE > 0 !! */
register unsigned int height /* MUST BE > 0 !! */
)
{
int stop_count = bytewidth ;
register int row_jump = bytes_per_line - bytewidth ;
#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
register const unsigned int notZero = ((unsigned char)(~0x0));
#else
#define notZero ((unsigned char)(~0))
#endif
#define SINGLE_STORE \
( *( (VgaMemoryPtr) destination ) = notZero ); \
destination++; stop_count--;
/* TOP OF FIRST LOOP */
BranchPoint:
switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
LoopTop :
case 0x0 : SINGLE_STORE ;
case 0xF : SINGLE_STORE ;
case 0xE : SINGLE_STORE ;
case 0xD : SINGLE_STORE ;
case 0xC : SINGLE_STORE ;
case 0xB : SINGLE_STORE ;
case 0xA : SINGLE_STORE ;
case 0x9 : SINGLE_STORE ;
case 0x8 : SINGLE_STORE ;
case 0x7 : SINGLE_STORE ;
case 0x6 : SINGLE_STORE ;
case 0x5 : SINGLE_STORE ;
case 0x4 : SINGLE_STORE ;
case 0x3 : SINGLE_STORE ;
case 0x2 : SINGLE_STORE ;
case 0x1 : SINGLE_STORE ;
/* FIRST LOOP */
if ( stop_count )
goto LoopTop ;
/* SECOND LOOP */
if ( --height ) {
destination += row_jump ;
stop_count = bytewidth ;
goto BranchPoint ;
}
else
return ;
#undef SINGLE_STORE
}
/*NOTREACHED*/
}
/* For Read-Modify-Write Case */
static void fastFillRMW
(
register volatile unsigned char *destination,
register const unsigned int bytes_per_line,
register const unsigned int bytewidth, /* MUST BE > 0 !! */
register unsigned int height /* MUST BE > 0 !! */
)
{
int stop_count = bytewidth ;
register int row_jump = bytes_per_line - bytewidth ;
#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__)
register const unsigned int notZero = ((unsigned char)(~0x0));
#endif
register int tmp ;
#define SINGLE_STORE \
tmp = *( (VgaMemoryPtr) destination ) ; (void)tmp; \
( *( (VgaMemoryPtr) destination ) = notZero ) ; \
destination++; stop_count-- ;
/* TOP OF FIRST LOOP */
BranchPoint:
switch ( bytewidth & 0xF ) { /* Jump into loop at mod 16 remainder */
LoopTop :
case 0x0 : SINGLE_STORE ;
case 0xF : SINGLE_STORE ;
case 0xE : SINGLE_STORE ;
case 0xD : SINGLE_STORE ;
case 0xC : SINGLE_STORE ;
case 0xB : SINGLE_STORE ;
case 0xA : SINGLE_STORE ;
case 0x9 : SINGLE_STORE ;
case 0x8 : SINGLE_STORE ;
case 0x7 : SINGLE_STORE ;
case 0x6 : SINGLE_STORE ;
case 0x5 : SINGLE_STORE ;
case 0x4 : SINGLE_STORE ;
case 0x3 : SINGLE_STORE ;
case 0x2 : SINGLE_STORE ;
case 0x1 : SINGLE_STORE ;
/* FIRST LOOP */
if ( stop_count )
goto LoopTop ;
/* SECOND LOOP */
if ( --height ) {
destination += row_jump ;
stop_count = bytewidth ;
goto BranchPoint ;
}
else
return ;
}
#undef SINGLE_STORE
/*NOTREACHED*/
}
#endif
void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
WindowPtr pWin; /* GJA */
unsigned long int color ;
const int alu ;
unsigned long int planes ;
register int x0 ;
register const int y0 ;
register int lx ;
register const int ly ; /* MUST BE > 0 !! */
{
IOADDRESS REGBASE;
register volatile unsigned char *dst ;
register int tmp ;
register int tmp2 ;
register int tmp3 ;
unsigned int data_rotate_value = VGA_COPY_MODE ;
unsigned int read_write_modify = FALSE ;
unsigned int invert_existing_data = FALSE ;
{ /* Start GJA */
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
return;
}
} /* End GJA */
if ( ( lx == 0 ) || ( ly == 0 ) )
return;
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
color = 0 ;
break ;
case GXnor: /* 0x8 NOT src AND NOT dst */
invert_existing_data = TRUE ;
case GXandInverted: /* 0x4 NOT src AND dst */
color = ~color ;
case GXand: /* 0x1 src AND dst */
data_rotate_value = VGA_AND_MODE ;
read_write_modify = TRUE ;
case GXcopy: /* 0x3 src */
break ;
case GXnoop: /* 0x5 dst */
return ;
case GXequiv: /* 0x9 NOT src XOR dst */
color = ~color ;
case GXxor: /* 0x6 src XOR dst */
data_rotate_value = VGA_XOR_MODE ;
read_write_modify = TRUE ;
planes &= color ;
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
invert_existing_data = TRUE ;
data_rotate_value = VGA_AND_MODE ;
read_write_modify = TRUE ;
break ;
case GXorReverse: /* 0xb src OR NOT dst */
invert_existing_data = TRUE ;
data_rotate_value = VGA_OR_MODE ;
read_write_modify = TRUE ;
break ;
case GXnand: /* 0xe NOT src OR NOT dst */
invert_existing_data = TRUE ;
case GXorInverted: /* 0xd NOT src OR dst */
color = ~color ;
case GXor: /* 0x7 src OR dst */
data_rotate_value = VGA_OR_MODE ;
read_write_modify = TRUE ;
break ;
case GXcopyInverted: /* 0xc NOT src */
color = ~color ;
break ;
case GXinvert: /* 0xa NOT dst */
data_rotate_value = VGA_XOR_MODE ;
read_write_modify = TRUE ;
case GXset: /* 0xf 1 */
color = VGA_ALLPLANES ;
default:
break ;
}
if ( !( planes &= VGA_ALLPLANES ) )
return ;
REGBASE =
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
/*
* Set The Plane-Enable
*/
SetVideoSequencer( Mask_MapIndex, planes ) ;
SetVideoGraphics( Enb_Set_ResetIndex, planes ) ;
/*
* Put Display Into SET/RESET Write Mode
*/
SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
/*
* Set The Color in The Set/Reset Register
*/
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
/*
* Set The Function-Select In The Data Rotate Register
*/
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
/* Do Left Edge */
if ((tmp = x0 & 07)) {
tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp ) ;
/* Catch The Cases Where The Entire Region Is Within One Byte */
if ( ( lx -= 8 - tmp ) < 0 ) {
tmp2 &= SCRLEFT8( 0xFF, -lx ) ;
lx = 0 ;
}
/* Set The Bit Mask Reg */
SetVideoGraphics(Bit_MaskIndex, tmp2 ) ;
if ( invert_existing_data == TRUE ) {
SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
dst = SCREENADDRESS( pWin, x0, y0 );
for ( tmp = ly;
tmp-- ; ) {
tmp3 = *( (VgaMemoryPtr) dst ) ;
(void)tmp3;
*( (VgaMemoryPtr) dst ) = tmp2 ;
dst += BYTES_PER_LINE(pWin);
}
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
/* Un-Set XOR */
}
dst = SCREENADDRESS( pWin, x0, y0 );
for ( tmp = ly;
tmp-- ; ) {
tmp3 = *( (VgaMemoryPtr) dst ) ;
(void)tmp3;
*( (VgaMemoryPtr) dst ) = tmp2 ;
dst += BYTES_PER_LINE(pWin);
}
if ( !lx ) { /* All Handled In This Byte */
return ;
}
x0 = ( x0 + 8 ) & ~07 ;
}
/* Fill The Center Of The Box */
if ( ROW_OFFSET( lx ) ) {
SetVideoGraphics(Bit_MaskIndex, 0xFF ) ;
if ( invert_existing_data == TRUE ) {
SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
fastFillRMW( SCREENADDRESS( pWin, x0, y0 ),
BYTES_PER_LINE(pWin),
ROW_OFFSET( lx ), ly ) ;
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
/* Un-Set XOR */
/* Point At The Bit Mask Reg */
}
(* ( ( read_write_modify == FALSE ) ? fastFill : fastFillRMW ) )
( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
ROW_OFFSET( lx ), ly ) ;
}
/* Do Right Edge */
if ((tmp = BIT_OFFSET(lx))) { /* x0 Now Is Byte Aligned */
/* Set The Bit Mask */
SetVideoGraphics( Bit_MaskIndex,
(tmp2 = SCRLEFT8( 0xFF, ( 8 - tmp ) ) ) ) ;
if ( invert_existing_data == TRUE ) {
SetVideoGraphics( Set_ResetIndex, VGA_ALLPLANES ) ;
SetVideoGraphics( Data_RotateIndex, VGA_XOR_MODE ) ;
dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
for ( tmp = ly;
tmp-- ; ) {
tmp3 = *( (VgaMemoryPtr) dst ) ;
(void)tmp3;
*( (VgaMemoryPtr) dst ) = tmp2 ;
dst += BYTES_PER_LINE(pWin);
}
SetVideoGraphics( Set_ResetIndex, color & VGA_ALLPLANES ) ;
SetVideoGraphics( Data_RotateIndex, data_rotate_value ) ;
/* Un-Set XOR */
}
dst = SCREENADDRESS( pWin, ( x0 + lx ), y0 );
for ( tmp = ly;
tmp-- ; ) {
tmp3 = *( (VgaMemoryPtr) dst ) ;
(void)tmp3;
*( (VgaMemoryPtr) dst ) = tmp2 ;
dst += BYTES_PER_LINE(pWin) ;
}
}
/* Disable Set/Reset Register */
SetVideoGraphics( Enb_Set_ResetIndex, 0 ) ;
return ;
}
#else /* for PC98 EGC */
static void WordfastFill( destination, bytes_per_line, wordwidth, height )
register volatile unsigned char *destination ;
register const unsigned int bytes_per_line ;
register const unsigned int wordwidth ; /* MUST BE > 0 !! */
register unsigned int height ; /* MUST BE > 0 !! */
{
int stop_count = wordwidth ;
register int row_jump = bytes_per_line - wordwidth*2 ;
#if !defined(OLDHC) && defined(BSDrt) && !defined(__i386__) && 0
register const int notZero = ~0x0 ;
#else
#define notZero ( ~0 )
#endif
#define SINGLE_STORE \
( *( (unsigned short *) destination++ ) = notZero ); \
destination++; stop_count--;
/* TOP OF FIRST LOOP */
BranchPoint:
switch ( wordwidth & 0xF ) { /* Jump into loop at mod 16 remainder */
LoopTop :
case 0x0 : SINGLE_STORE ;
case 0xF : SINGLE_STORE ;
case 0xE : SINGLE_STORE ;
case 0xD : SINGLE_STORE ;
case 0xC : SINGLE_STORE ;
case 0xB : SINGLE_STORE ;
case 0xA : SINGLE_STORE ;
case 0x9 : SINGLE_STORE ;
case 0x8 : SINGLE_STORE ;
case 0x7 : SINGLE_STORE ;
case 0x6 : SINGLE_STORE ;
case 0x5 : SINGLE_STORE ;
case 0x4 : SINGLE_STORE ;
case 0x3 : SINGLE_STORE ;
case 0x2 : SINGLE_STORE ;
case 0x1 : SINGLE_STORE ;
/* FIRST LOOP */
if ( stop_count )
goto LoopTop ;
/* SECOND LOOP */
if ( --height ) {
destination += row_jump ;
stop_count = wordwidth ;
goto BranchPoint ;
}
else
return ;
#undef SINGLE_STORE
}
/*NOTREACHED*/
}
void xf4bppFillSolid( pWin, color, alu, planes, x0, y0, lx, ly )
WindowPtr pWin; /* GJA */
unsigned long int color ;
const int alu ;
unsigned long int planes ;
register int x0 ;
register const int y0 ;
register int lx ;
register const int ly ; /* MUST BE > 0 !! */
{
register volatile unsigned char *dst ;
register tmp ;
register tmp2 ;
register unsigned short tmp3 ;
unsigned short ROP_value;
unsigned int data_rotate_value = VGA_COPY_MODE ;
unsigned int read_write_modify = FALSE ;
unsigned int invert_existing_data = FALSE ;
{ /* Start GJA */
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffFillSolid( pWin, color, alu, planes, x0, y0, lx, ly );
return;
}
} /* End GJA */
if ( ( lx == 0 ) || ( ly == 0 ) )
return;
switch ( alu ) {
case GXclear: /* 0x0 Zero 0 */
color = 0 ;
break ;
case GXnor: /* 0x8 NOT src AND NOT dst */
invert_existing_data = TRUE ;
case GXandInverted: /* 0x4 NOT src AND dst */
color = ~color ;
case GXand: /* 0x1 src AND dst */
data_rotate_value = VGA_AND_MODE ;
read_write_modify = TRUE ;
case GXcopy: /* 0x3 src */
break ;
case GXnoop: /* 0x5 dst */
return ;
case GXequiv: /* 0x9 NOT src XOR dst */
color = ~color ;
case GXxor: /* 0x6 src XOR dst */
data_rotate_value = VGA_XOR_MODE ;
read_write_modify = TRUE ;
planes &= color ;
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
invert_existing_data = TRUE ;
data_rotate_value = VGA_AND_MODE ;
read_write_modify = TRUE ;
break ;
case GXorReverse: /* 0xb src OR NOT dst */
invert_existing_data = TRUE ;
data_rotate_value = VGA_OR_MODE ;
read_write_modify = TRUE ;
break ;
case GXnand: /* 0xe NOT src OR NOT dst */
invert_existing_data = TRUE ;
case GXorInverted: /* 0xd NOT src OR dst */
color = ~color ;
case GXor: /* 0x7 src OR dst */
data_rotate_value = VGA_OR_MODE ;
read_write_modify = TRUE ;
break ;
case GXcopyInverted: /* 0xc NOT src */
color = ~color ;
break ;
case GXinvert: /* 0xa NOT dst */
data_rotate_value = VGA_XOR_MODE ;
read_write_modify = TRUE ;
case GXset: /* 0xf 1 */
color = VGA_ALLPLANES ;
default:
break ;
}
if ( !( planes &= VGA_ALLPLANES ) )
return ;
/* Set Access Planes */
outw(EGC_PLANE, ~planes);
switch(data_rotate_value) {
/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
case VGA_AND_MODE:
if (invert_existing_data)
ROP_value = EGC_AND_INV_MODE;
else
ROP_value = EGC_AND_MODE;
break;
case VGA_OR_MODE:
if (invert_existing_data)
ROP_value = EGC_OR_INV_MODE;
else
ROP_value = EGC_OR_MODE;
break;
case VGA_XOR_MODE:
if (invert_existing_data)
ROP_value = EGC_XOR_INV_MODE;
else
ROP_value = EGC_XOR_MODE;
break;
case VGA_COPY_MODE:
default:
ROP_value = EGC_COPY_MODE;
break;
}
outw(EGC_MODE, ROP_value);
outw(EGC_FGC, color & VGA_ALLPLANES);
/* Do Left Edge */
if ( tmp = x0 & 0x0f ) {
dst = (unsigned char *)((int)(SCREENADDRESS(pWin,x0,y0)) & ~0x01);
tmp3 = (unsigned)0xffff >>tmp;
/* Catch The Cases Where The Entire Region Is Within One Word */
if ( ( lx -= 16 - tmp ) < 0 ) {
tmp3 &= (unsigned)0xffff << -lx;
lx = 0 ;
}
tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
for ( tmp = ly;
tmp-- ; ) {
*((unsigned short *) dst ) = tmp3 ;
dst += BYTES_PER_LINE(pWin);
}
if ( !lx ) { /* All Handled In This Word */
return ;
}
x0 = ( x0 + 0x0f ) & ~0x0f ;
}
/* Fill The Center Of The Box */
if (lx >> 4) {
WordfastFill( SCREENADDRESS( pWin, x0, y0 ), BYTES_PER_LINE(pWin),
(lx >> 4), ly ) ;
}
/* Do Right Edge */
if ( tmp = lx & 0x0f ) { /* x0 Now Is Word Aligned */
/* Set The Bit Mask */
tmp3 = (unsigned)0xffff << ( 16 - tmp );
dst = (unsigned char*)((int)SCREENADDRESS(pWin,(x0+lx),y0) & ~0x01);
tmp3 = (unsigned short)(tmp3 >> 8 | tmp3 << 8);
for ( tmp = ly;
tmp-- ; ) {
*( (unsigned short *) dst ) = tmp3 ;
dst += BYTES_PER_LINE(pWin);
}
}
return ;
}
#endif

View file

@ -1,720 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "vgaReg.h"
#include "vgaVideo.h"
#include "xf86str.h" /* for pScrn->vtSema */
extern ScrnInfoPtr *xf86Screens;
#ifndef PC98_EGC
static unsigned char
getbits
(
register const int x,
register const unsigned int patternWidth,
register const unsigned char * const lineptr
)
{
register unsigned char bits ;
register const unsigned char *cptr ;
register int shift ;
register int wrap ;
cptr = lineptr + ( x >> 3 ) ;
bits = *cptr ;
if ((shift = x & 7))
bits = SCRLEFT8( bits, shift ) | SCRRIGHT8( cptr[1], ( 8 - shift ) ) ;
if ( ( wrap = x + 8 - patternWidth ) > 0 ) {
bits &= SCRLEFT8( 0xFF, wrap ) ;
bits |= SCRRIGHT8( *lineptr, ( 8 - wrap ) ) ;
}
/* GJA -- Handle extraction of 8 bits from < 8 bits wide stipple.
* I duplicated case 4,5,6,7 to give the compiler a chance to optimize.
*/
switch (patternWidth) {
case 1: /* Not really useful. */
bits &= ~SCRRIGHT8(0xFF,1);
bits |= SCRRIGHT8(bits,1);
bits |= SCRRIGHT8(bits,2);
bits |= SCRRIGHT8(bits,4);
break;
case 2:
bits &= ~SCRRIGHT8(0xFF,2);
bits |= SCRRIGHT8(bits,2); bits |= SCRRIGHT8(bits,4); break;
case 3:
bits &= ~SCRRIGHT8(0xFF,3);
bits |= (SCRRIGHT8(bits,3) | SCRRIGHT8(bits,6)); break;
case 4:
bits = (bits & ~SCRRIGHT8(0xFF,4)) | SCRRIGHT8(bits,4); break;
case 5:
bits = (bits & ~SCRRIGHT8(0xFF,5)) | SCRRIGHT8(bits,5); break;
case 6:
bits = (bits & ~SCRRIGHT8(0xFF,6)) | SCRRIGHT8(bits,6); break;
case 7:
bits = (bits & ~SCRRIGHT8(0xFF,7)) | SCRRIGHT8(bits,7); break;
default:
;
/* Do nothing, of course */
}
return bits ;
}
#endif
/* GJA --
* Basically, in the code below, we will draw a stipple in the usual
* three parts: left edge, center and right edge.
* For efficiency reasons, the center will be drawn byte aligned, so that
* we will have to shuffle the bits in the left and right edges.
* The hard cases will be stipples with width < 8: In order to get 8
* bits from those, we will need a loop. One single 'if' will never do.
* This is taken care of above.
*/
static void
DoMonoSingle
(
WindowPtr pWin, /* GJA */
int w,
int x,
int y,
register const unsigned char *mastersrc,
int h,
register unsigned int width,
register unsigned int paddedByteWidth,
unsigned int height,
int xshift,
int yshift
)
{
IOADDRESS REGBASE =
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
register volatile unsigned char *xDst ;
register VideoAdapterObject tmp2 ;
register int NeedValX ;
register int counter ;
register int tmp1 ;
unsigned int rowCounter ;
int byte_cnt ;
#ifdef PC98_EGC
unsigned char bitmask;
#endif
/* Do Left Edge */
if ((tmp1 = x & 07)) {
tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
/* Catch The Cases Where The Entire Region Is Within One Byte */
if ( ( w -= 8 - tmp1 ) < 0 ) {
tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
w = 0 ;
}
#ifndef PC98_EGC
SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
#else
bitmask = tmp2; /* Set The Bit Mask */
#endif
/*
* For Each Line In The Source Pixmap
*/
xDst = SCREENADDRESS( pWin, x, y );
for ( tmp1 = yshift, rowCounter = h;
rowCounter ;
rowCounter-- , tmp1++ ) {
if ( tmp1 >= (int)height )
tmp1 -= height ;
#ifndef PC98_EGC
/* Read To Save */
tmp2 = *( (VgaMemoryPtr) xDst) ;
#endif
/* Write Pattern */
*( (VgaMemoryPtr) xDst ) =
#ifndef PC98_EGC
getbits( xshift /* GJA */, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) >> (x & 07) ;
#else
#if 0
(getbits( xshift /* GJA */, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) >> (x & 07)
& bitmask);
#else
(getbits_x( xshift /* GJA */, width,
mastersrc
+ ( tmp1 * paddedByteWidth ), (x & 07))
& bitmask);
#endif
#endif
xDst += BYTES_PER_LINE(pWin);
}
NeedValX = (xshift + 8 - (x & 07)) % width;
x = ( x + 7 ) & ~07 ;
}
else {
NeedValX = xshift ;
}
if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
int SavNeedX = NeedValX ;
#ifndef PC98_EGC
SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
#endif
/*
* For Each Line In The Source Pixmap
*/
xDst = SCREENADDRESS( pWin, x, y );
for ( tmp1 = yshift, rowCounter = h;
rowCounter ;
rowCounter-- , tmp1++ ) {
register const unsigned char *l_ptr ;
if ( tmp1 >= (int)height )
tmp1 -= height ;
l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
/*
* For Each Byte Across The Pattern In X
*/
for ( counter = byte_cnt, NeedValX = SavNeedX ;
counter-- ; ) {
#ifndef PC98_EGC
/* Read To Save */
tmp2 = *( (VgaMemoryPtr) xDst) ;
#endif
/* Write Pattern */
*( (VgaMemoryPtr) xDst ) =
#ifndef PC98_EGC
getbits( NeedValX, width, l_ptr ) ;
#else
#if 0
getbits( NeedValX, width, l_ptr ) ;
#else
getbits_x ( NeedValX, width, l_ptr, 0 ) ;
#endif
#endif
/* GJA -- The '%' is there since width could be < 8 */
NeedValX = (NeedValX + 8) % width;
xDst++;
}
xDst += BYTES_PER_LINE(pWin) - byte_cnt;
}
}
/* Do Right Edge */
if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
/* Set The Bit Mask */
#ifndef PC98_EGC
SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
#else
bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ));
#endif
/*
* For Each Line In The Source Pixmap
*/
xDst = SCREENADDRESS( pWin, ( x + w ), y );
for ( tmp1 = yshift, rowCounter = h;
rowCounter ;
rowCounter-- , tmp1++ ) {
if ( tmp1 >= (int)height )
tmp1 -= height ;
#ifndef PC98_EGC
/* Read To Save */
tmp2 = *( (VgaMemoryPtr) xDst) ;
#endif
/* Write Pattern */
*( (VgaMemoryPtr) xDst ) =
#ifndef PC98_EGC
getbits( NeedValX, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) ;
#else
#if 0
(getbits( NeedValX, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) & bitmask);
#else
(getbits_x( NeedValX, width,
mastersrc
+ ( tmp1 * paddedByteWidth ), 0 ) & bitmask);
#endif
#endif
xDst += BYTES_PER_LINE(pWin) ;
}
}
return ;
}
static void
DoMonoMany
(
WindowPtr pWin, /* GJA */
int w,
int x,
int y,
register const unsigned char *mastersrc,
int h,
register unsigned int width,
register unsigned int paddedByteWidth,
unsigned int height,
int xshift,
int yshift
)
{
IOADDRESS REGBASE =
xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->domainIOBase + 0x300;
register volatile unsigned char *xDst ;
register VideoAdapterObject tmp2 ;
register int NeedValX ;
register int byte_cnt ;
register int tmp1 ;
unsigned DestinationRow ;
unsigned int SourceRow ;
volatile unsigned char *dst ;
int scr_incr = ( height * BYTES_PER_LINE(pWin) ) ;
#ifdef PC98_EGC
unsigned char bitmask;
#endif
/* Do Left Edge */
if ((tmp1 = x & 07)) {
tmp2 = SCRRIGHT8( ( (unsigned) 0xFF ), tmp1 ) ;
/* Catch The Cases Where The Entire Region Is Within One Byte */
if ( ( w -= 8 - tmp1 ) < 0 ) {
tmp2 &= SCRLEFT8( (unsigned) 0xFF, -w ) ;
w = 0 ;
}
#ifndef PC98_EGC
SetVideoGraphics( Bit_MaskIndex, tmp2 ) ; /* Set The Bit Mask */
#else
bitmask = tmp2; /* Set The Bit Mask */
#endif
/*
* For Each Line In The Source Pixmap
*/
for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
SourceRow < height ;
tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
register unsigned bitPattern ;
if ( tmp1 >= (int)height )
tmp1 -= height ;
/*
* For Each Time Pattern Repeats In The Y Dimension
*/
xDst = dst;
for ( DestinationRow = SourceRow,
#ifndef PC98_EGC
bitPattern = getbits( xshift, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) ;
#else
#if 0
bitPattern = getbits( xshift, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) ;
#else
bitPattern = getbits_x( xshift, width,
mastersrc
+ ( tmp1 * paddedByteWidth ), 0 ) ;
#endif
#endif
(int)DestinationRow < h ;
DestinationRow += height ) {
#ifndef PC98_EGC
/* Read To Save */
tmp2 = *( (VgaMemoryPtr) xDst ) ;
#endif
/* Write Pattern */
#ifndef PC98_EGC
*( (VgaMemoryPtr) xDst ) = bitPattern >> (x & 07);
#else
*( (VgaMemoryPtr) xDst ) = (bitPattern >> (x & 07)) & bitmask;
#endif
xDst += scr_incr;
}
}
NeedValX = (xshift + 8 - (x & 07)) % width;
x = ( x + 7 ) & ~07 ;
}
else {
NeedValX = xshift ;
}
if ((byte_cnt = ROW_OFFSET(w))) { /* Fill The Center Of The Box */
int SavNeedX = NeedValX ;
#ifndef PC98_EGC
SetVideoGraphics( Bit_MaskIndex, 0xFF ) ; /* Set The Bit Mask */
#endif
/*
* For Each Line In The Source Pixmap
*/
for ( tmp1 = yshift, SourceRow = 0, dst = SCREENADDRESS( pWin, x, y ) ;
SourceRow < height ;
tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) - byte_cnt ) {
register const unsigned char *l_ptr ;
if ( tmp1 >= (int)height )
tmp1 -= height ;
l_ptr = mastersrc + ( tmp1 * paddedByteWidth ) ;
/*
* For Each Byte Across The Pattern In X
*/
for ( tmp2 = byte_cnt, NeedValX = SavNeedX ;
tmp2-- ;
dst++ ) {
register unsigned bitPattern ;
#ifndef PC98_EGC
register VideoAdapterObject tmp3 ;
#endif
/*
* For Each Time Pattern Repeats In Y
*/
xDst = dst;
for ( DestinationRow = SourceRow,
#ifndef PC98_EGC
bitPattern = getbits( NeedValX, width, l_ptr ) ;
#else
#if 0
bitPattern = getbits( NeedValX, width, l_ptr ) ;
#else
bitPattern = getbits_x( NeedValX, width, l_ptr, 0 ) ;
#endif
#endif
(int)DestinationRow < h ;
DestinationRow += height ) {
#ifndef PC98_EGC
/* Read To Save */
tmp3 = *( (VgaMemoryPtr) xDst) ;
(void)tmp3;
#endif
/* Write Pattern */
*( (VgaMemoryPtr) xDst ) = bitPattern ;
xDst += scr_incr;
}
NeedValX = (NeedValX + 8) % width;
}
}
}
/* Do Right Edge */
if ((tmp1 = BIT_OFFSET(w))) { /* x Now Is Byte Aligned */
/* Set The Bit Mask */
#ifndef PC98_EGC
SetVideoGraphics( Bit_MaskIndex, SCRLEFT8( 0xFF, ( 8 - tmp1 ) ) ) ;
#else
bitmask = SCRLEFT8( 0xFF, ( 8 - tmp1 ) );
#endif
/*
* For Each Line In The Source Pixmap
*/
for ( tmp1 = yshift, SourceRow = 0,
dst = SCREENADDRESS( pWin, ( x + w ), y ) ;
SourceRow < height ;
tmp1++, SourceRow++, dst += BYTES_PER_LINE(pWin) ) {
register unsigned bitPattern ;
if ( tmp1 >= (int)height )
tmp1 -= height ;
/*
* For Each Time Pattern Repeats In The Y Dimension
*/
xDst = dst;
for ( DestinationRow = SourceRow,
#ifndef PC98_EGC
bitPattern = getbits( NeedValX, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) ;
#else
#if 0
bitPattern = getbits( NeedValX, width,
mastersrc
+ ( tmp1 * paddedByteWidth ) ) ;
#else
bitPattern = getbits_x( NeedValX, width,
mastersrc
+ ( tmp1 * paddedByteWidth ), 0 ) ;
#endif
#endif
(int)DestinationRow < h ;
DestinationRow += height ) {
#ifndef PC98_EGC
/* Read To Save */
tmp2 = *( (VgaMemoryPtr) xDst) ;
#endif
/* Write Pattern */
#ifndef PC98_EGC
*( (VgaMemoryPtr) xDst ) = bitPattern ;
#else
*( (VgaMemoryPtr) xDst ) = bitPattern & bitmask;
#endif
xDst += scr_incr;
}
}
}
return ;
}
#define DO_RECURSE 0x10000
static void
vgaSetMonoRegisters
(
DrawablePtr pDrawable,
register unsigned long int plane_mask,
register unsigned long int desiredState
)
{
IOADDRESS REGBASE =
xf86Screens[pDrawable->pScreen->myNum]->domainIOBase + 0x300;
#ifndef PC98_EGC
/* Setup VGA Registers */
/*
* Set The Plane-Enable
*/
SetVideoSequencer( Mask_MapIndex, plane_mask ) ;
SetVideoGraphics( Enb_Set_ResetIndex, plane_mask ) ;
/*
* Put Display Into SET-AND (i.e. Write Mode 3 )
*/
SetVideoGraphics( Graphics_ModeIndex, VGA_WRITE_MODE_3 ) ;
/*
* Set The Color in The Set/Reset Register
*/
SetVideoGraphics( Set_ResetIndex, desiredState & VGA_ALLPLANES ) ;
/*
* Set The Vga's Alu Function
*/
SetVideoGraphics( Data_RotateIndex, desiredState >> 8 ) ;
#else /* PC98_EGC */
unsigned short ROP_value;
/* Setup VGA Registers */
/*
* Set The Plane-Enable
*/
outw(EGC_PLANE, ~plane_mask);
switch((desiredState >> 8)&0x18) {
/* EGC MODE.. Cmp Read: Flase, WriteSource=ROP, ReadSource=CPU */
case VGA_AND_MODE:
if (desiredState & DO_RECURSE)
ROP_value = EGC_AND_INV_MODE;
else
ROP_value = EGC_AND_MODE;
break;
case VGA_OR_MODE:
if (desiredState & DO_RECURSE)
ROP_value = EGC_OR_INV_MODE;
else
ROP_value = EGC_OR_MODE;
break;
case VGA_XOR_MODE:
if (desiredState & DO_RECURSE)
ROP_value = EGC_XOR_INV_MODE;
else
ROP_value = EGC_XOR_MODE;
break;
case VGA_COPY_MODE:
default:
ROP_value = EGC_COPY_MODE;
break;
}
outw(EGC_MODE, ROP_value);
outw(EGC_FGC, desiredState & VGA_ALLPLANES);
#endif
return ;
}
static unsigned long
vgaCalcMonoMode
(
int rasterOp,
register unsigned long int color
)
{
register unsigned int data_rotate_value = VGA_COPY_MODE << 8 ;
register unsigned int invert_existing_data = 0 ;
/* Test The Raster-Op */
switch ( rasterOp ) {
case GXclear: /* 0x0 Zero 0 */
color = 0 ;
break ;
case GXinvert: /* 0xa NOT dst */
data_rotate_value = VGA_XOR_MODE << 8 ;
case GXset: /* 0xf 1 */
color = VGA_ALLPLANES ;
break ;
case GXnor: /* 0x8 NOT src AND NOT dst */
invert_existing_data = DO_RECURSE ;
case GXandInverted: /* 0x4 NOT src AND dst */
color = ~color ;
case GXand: /* 0x1 src AND dst */
data_rotate_value = VGA_AND_MODE << 8 ;
case GXcopy: /* 0x3 src */
break ;
case GXequiv: /* 0x9 NOT src XOR dst */
color = ~color ;
case GXxor: /* 0x6 src XOR dst */
data_rotate_value = VGA_XOR_MODE << 8 ;
break ;
case GXandReverse: /* 0x2 src AND NOT dst */
invert_existing_data = DO_RECURSE ;
data_rotate_value = VGA_AND_MODE << 8 ;
break ;
case GXorReverse: /* 0xb src OR NOT dst */
invert_existing_data = DO_RECURSE ;
data_rotate_value = VGA_OR_MODE << 8 ;
break ;
case GXnand: /* 0xe NOT src OR NOT dst */
invert_existing_data = DO_RECURSE ;
case GXorInverted: /* 0xd NOT src OR dst */
color = ~color ;
case GXor: /* 0x7 src OR dst */
data_rotate_value = VGA_OR_MODE << 8 ;
break ;
case GXcopyInverted: /* 0xc NOT src */
color = ~color ;
break ;
case GXnoop: /* 0x5 dst */
; /* Shouldn't Get Here !! */
}
return ( color & VGA_ALLPLANES ) | data_rotate_value | invert_existing_data ;
}
static void
vgaDrawMonoImage
(
WindowPtr pWin, /* GJA */
unsigned char *data,
int x,
int y,
int w,
int h,
unsigned long int fg,
int alu,
unsigned long int planes
)
{
unsigned long regState ;
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes );
return;
}
if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
return ;
#ifndef PC98_EGC
if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
vgaDrawMonoImage( pWin, data, x, y, w, h,
VGA_ALLPLANES, GXinvert, planes ) ;
regState &= ~DO_RECURSE ;
}
#else
regState = vgaCalcMonoMode(alu, (char)fg);
#endif
vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
DoMonoSingle( pWin, w, x, y, (const unsigned char *) data, h,
w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0 ) ;
return ;
}
void
xf4bppFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
WindowPtr pWin; /* GJA */
register PixmapPtr const pStipple ;
unsigned long int fg ;
const int alu ;
unsigned long int planes ;
int x, y, w, h ;
const int xSrc, ySrc ;
{
unsigned int width ;
unsigned int height ;
int xshift ;
int yshift ;
unsigned long regState ;
if ( !xf86Screens[((DrawablePtr)pWin)->pScreen->myNum]->vtSema ) {
xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes,
x, y, w, h, xSrc, ySrc );
return;
}
if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
return ;
#if 1
if ( ( regState = vgaCalcMonoMode( alu, fg ) ) & DO_RECURSE ) {
xf4bppFillStipple( pWin, pStipple, VGA_ALLPLANES, GXinvert, planes,
x, y, w, h, xSrc, ySrc ) ;
regState &= ~DO_RECURSE ;
}
#else
regState = vgaCalcMonoMode(alu, (char)fg);
#endif
vgaSetMonoRegisters( (DrawablePtr)pWin, planes, regState ) ;
/* Figure Bit Offsets & Source Address */
width = pStipple->drawable.width ;
if ( ( xshift = ( x - xSrc ) ) < 0 )
xshift = width - ( ( - xshift ) % width ) ;
else
xshift %= width ;
if ( xshift == (int)width ) xshift = 0;
height = pStipple->drawable.height ;
if ( ( yshift = ( y - ySrc ) ) < 0 )
yshift = height - ( ( - yshift ) % height ) ;
else
yshift %= height ;
if ( yshift == (int)height ) yshift = 0;
(* ( (h > (int)height) ? DoMonoMany : DoMonoSingle ) ) (
pWin, w, x, y,
(const unsigned char *) pStipple->devPrivate.ptr,
h,
width,
( ( width + 31 ) & ((unsigned)(~31)) ) >> 3,
height,
xshift, yshift
) ;
return ;
}

View file

@ -1,93 +0,0 @@
/*
* Copyright IBM Corporation 1987,1988,1989
*
* All Rights Reserved
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* 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 IBM not be
* used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
* IBM 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_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h" /* GJA -- for pointer data type */
#ifdef lint
#if defined(volatile)
#undef volatile
#endif
#define volatile /**/
#if defined(const)
#undef const
#endif
#define const /**/
#if defined(signed)
#undef signed
#endif
#define signed /**/
#endif
/*
* References to all pc ( i.e. '286 ) memory in the
* regions used by the [ev]ga server ( the 128K windows )
* MUST be long-word ( i.e. 32-bit ) reads or writes.
* This definition will change for other memory architectures
* ( e.g. AIX-Rt )
*/
typedef unsigned char VideoAdapterObject ;
typedef volatile VideoAdapterObject *VideoMemoryPtr ;
typedef volatile VideoAdapterObject *VgaMemoryPtr ;
#if !defined(BITMAP_BIT_ORDER)
#define BITMAP_BIT_ORDER MSBFirst
#endif
#if !defined(IMAGE_BYTE_ORDER)
#define IMAGE_BYTE_ORDER LSBFirst
#endif
/* Bit Ordering Macros */
#if !defined(SCRLEFT8)
#define SCRLEFT8(lw, n) ( (unsigned char) (((unsigned char) lw) << (n)) )
#endif
#if !defined(SCRRIGHT8)
#define SCRRIGHT8(lw, n) ( (unsigned char) (((unsigned char)lw) >> (n)) )
#endif
/* These work ONLY on 8-bit wide Quantities !! */
#define LeftmostBit ( SCRLEFT8( 0xFF, 7 ) & 0xFF )
#define RightmostBit ( SCRRIGHT8( 0xFF, 7 ) & 0xFF )
/*
* [ev]ga video screen defines & macros
*/
#define VGA_BLACK_PIXEL 0
#define VGA_WHITE_PIXEL 1
#define VGA_MAXPLANES 4
#define VGA_ALLPLANES 0xFL
#define VIDBASE(pDraw) ((volatile unsigned char *) \
(((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))-> \
devPrivate.ptr))
#define BYTES_PER_LINE(pDraw) \
((int)((PixmapPtr)(((DrawablePtr)(pDraw))->pScreen->devPrivate))->devKind)
#define ROW_OFFSET( x ) ( ( x ) >> 3 )
#define BIT_OFFSET( x ) ( ( x ) & 0x7 )
#define SCREENADDRESS( pWin, x, y ) \
( VIDBASE(pWin) + (y) * BYTES_PER_LINE(pWin) + ROW_OFFSET(x) )

View file

@ -1,57 +0,0 @@
/*
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Module.h"
static MODULESETUPPROTO(xf4bppSetup);
static XF86ModuleVersionInfo VersRec =
{
"xf4bpp",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_ANSIC, /* Only need ansic layer */
ABI_ANSIC_VERSION,
MOD_CLASS_NONE,
{0,0,0,0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData xf4bppModuleData = { &VersRec, xf4bppSetup, NULL };
static pointer
xf4bppSetup(pointer module, pointer opts, int *errmaj, int *errmin)
{
/* This module requires xf1bpp for bitmap support */
return LoadSubModule(module, "xf1bpp", NULL, NULL, NULL, NULL,
errmaj, errmin);
}

View file

@ -1,203 +0,0 @@
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf4bpp.h"
#include "OScompiler.h"
#include "wm3.h"
#include "vgaVideo.h"
#include "xf86.h"
/* Ferraro is wrong. GJA */
#define COPY (0 << 3)
#define AND (1 << 3)
#define OR (2 << 3)
#define XOR (3 << 3)
int
wm3_set_regs(pGC)
GC *pGC;
{
#ifndef PC98_EGC
IOADDRESS REGBASE = xf86Screens[pGC->pScreen->myNum]->domainIOBase + 0x300;
int post_invert = 0;
int ALU;
switch(pGC->alu) {
case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */
pGC->fgPixel = 0;
pGC->bgPixel = 0;
ALU = COPY;
break;
case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */
ALU = AND;
break;
case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = OR;
post_invert = 1;
break;
case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */
ALU = COPY;
break;
case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = AND;
break;
default:
case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */
return 0;
case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */
ALU = XOR;
break;
case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */
ALU = OR;
break;
case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
ALU = OR;
post_invert = 1;
break;
case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = XOR;
break;
case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
pGC->fgPixel = 0x0F;
pGC->bgPixel = 0x0F;
ALU = XOR;
break;
case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = AND;
post_invert = 1;
break;
case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = COPY;
break;
case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = OR;
break;
case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */
ALU = AND;
post_invert = 1;
break;
case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */
pGC->fgPixel = 0x0F;
pGC->bgPixel = 0x0F;
ALU = COPY;
break;
}
SetVideoSequencer(Mask_MapIndex, (pGC->planemask & VGA_ALLPLANES));
SetVideoGraphics(Enb_Set_ResetIndex, VGA_ALLPLANES);
SetVideoGraphics(Set_ResetIndex, pGC->fgPixel);
SetVideoGraphics(Bit_MaskIndex, 0xFF);
SetVideoGraphics(Graphics_ModeIndex, 3); /* Write Mode 3 */
SetVideoGraphics(Data_RotateIndex, ALU);
return post_invert;
#else
int ALU;
switch(pGC->alu) {
case GXclear: /* rop0 = RROP_BLACK; rop1 = RROP_BLACK; */
pGC->fgPixel = 0;
pGC->bgPixel = 0;
ALU = EGC_COPY_MODE;
break;
case GXand: /* rop0 = RROP_BLACK; rop1 = RROP_NOP; */
ALU = EGC_AND_MODE;
break;
case GXandReverse: /* rop0 = RROP_BLACK; rop1 = RROP_INVERT; -- TRICKY */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = EGC_OR_INV_MODE;
break;
case GXcopy: /* rop0 = RROP_BLACK; rop1 = RROP_WHITE; */
ALU = EGC_COPY_MODE;
break;
case GXandInverted: /* rop0 = RROP_NOP; rop1 = RROP_BLACK; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = EGC_AND_MODE;
break;
case GXnoop: /* rop0 = RROP_NOP; rop1 = RROP_NOP; */
return 0;
case GXxor: /* rop0 = RROP_NOP; rop1 = RROP_INVERT; */
ALU = EGC_XOR_MODE;
break;
case GXor: /* rop0 = RROP_NOP; rop1 = RROP_WHITE; */
ALU = EGC_OR_MODE;
break;
case GXnor: /* rop0 = RROP_INVERT; rop1 = RROP_BLACK; -- TRICKY*/
ALU = EGC_OR_INV_MODE;
break;
case GXequiv: /* rop0 = RROP_INVERT; rop1 = RROP_NOP; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = EGC_XOR_MODE;
break;
case GXinvert: /* rop0 = RROP_INVERT; rop1 = RROP_INVERT; */
pGC->fgPixel = 0x0F;
pGC->bgPixel = 0x0F;
ALU = EGC_XOR_MODE;
break;
case GXorReverse: /* rop0 = RROP_INVERT; rop1 = RROP_WHITE; -- TRICKY */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = EGC_AND_INV_MODE;
break;
case GXcopyInverted: /* rop0 = RROP_WHITE; rop1 = RROP_BLACK; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = EGC_COPY_MODE;
break;
case GXorInverted: /* rop0 = RROP_WHITE; rop1 = RROP_NOP; */
pGC->fgPixel = ~pGC->fgPixel;
pGC->bgPixel = ~pGC->bgPixel;
ALU = EGC_OR_MODE;
break;
case GXnand: /* rop0 = RROP_WHITE; rop1 = RROP_INVERT; -- TRICKY */
ALU = EGC_OR_INV_MODE;
break;
case GXset: /* rop0 = RROP_WHITE; rop1 = RROP_WHITE; */
pGC->fgPixel = 0x0F;
pGC->bgPixel = 0x0F;
ALU = EGC_COPY_MODE;
break;
}
outw(EGC_PLANE, ~(pGC->planemask & VGA_ALLPLANES));
outw(EGC_MODE, ALU);
outw(EGC_FGC, pGC->fgPixel & VGA_ALLPLANES); /* set FGC */
return 0;
#endif
}
/*
Now we will have to set the alu.
Problematic is: How do we handle IsDoubleDash, which draws with both fg
and bg colour?
The answer is: We take care to store the ink colour in one register only.
Then we need set only this register to change the ink.
*/
/* -- MORE NOTES:
We might try to 'wrap' the mfb functions in a 16-colour wrapper that does
all operations once. However, this does not work:
Some operations (esp) CopyArea may for example cause expositions.
Such expositions will cause data to be copied in from backing store,
and this copying in may damage the contents of the VGA registers.
So we must take care to set the VGA registers at each place where they could
be modified.
*/

View file

@ -1,73 +0,0 @@
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "vgaReg.h"
#ifdef PC98_EGC
#define VGA_ALLPLANES 0xFL
#endif
/* Do call in Write Mode 3.
* We take care of the possibility that two passes are needed.
*/
#ifndef PC98_EGC
#define DO_WM3(pgc,call) \
{ int _tp, _fg, _bg, _alu; \
_fg = pgc->fgPixel; _bg = pgc->bgPixel; \
_tp = wm3_set_regs(pgc); \
(call); \
if ( _tp ) { \
_alu = pgc->alu; \
pgc->alu = GXinvert; \
_tp = wm3_set_regs(pgc); \
(call); \
pgc->alu = _alu; \
} \
pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
}
#else
#define DO_WM3(pgc,call) \
{ int _tp, _fg, _bg; \
_fg = pgc->fgPixel; _bg = pgc->bgPixel; \
_tp = wm3_set_regs(pgc); \
(call); \
pgc->fgPixel = _fg; pgc->bgPixel = _bg; \
}
#endif
#ifndef PC98_EGC
#define WM3_SET_INK(ink) \
SetVideoGraphics(Set_ResetIndex, ink)
#else
#define WM3_SET_INK(ink) \
outw(EGC_FGC, ink)
#endif
/* GJA -- Move a long word to screen memory.
* The reads into 'dummy' are here to load the VGA latches.
* This is a RMW operation except for trivial cases.
* Notice that we ignore the operation.
*/
#ifdef PC98_EGC
#define UPDRW(destp,src) \
{ volatile unsigned short *_dtmp = \
(volatile unsigned short *)(destp); \
unsigned int _stmp = (src); \
*_dtmp = _stmp; _dtmp++; _stmp >>= 16; \
*_dtmp = _stmp; }
#else
#define UPDRW(destp,src) \
{ volatile char *_dtmp = (volatile char *)(destp); \
unsigned int _stmp = (src); \
volatile int dummy; /* Bit bucket. */ \
_stmp = ldl_u(&_stmp); \
dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
dummy = *_dtmp; *_dtmp = _stmp; _dtmp++; _stmp >>= 8; \
dummy = *_dtmp; *_dtmp = _stmp; }
#endif
#define UPDRWB(destp,src) \
{ volatile int dummy; /* Bit bucket. */ \
dummy = *(destp); *(destp) = (src); }

View file

@ -1,622 +0,0 @@
#ifndef __XF4BPP_H__
#define __XF4BPP_H__
#include "windowstr.h"
#include "gcstruct.h"
#include "colormapst.h"
#include <X11/fonts/fontstruct.h>
#ifndef PixelType
#define PixelType CARD32
#endif
/* ppcArea.c */
void xf4bppFillArea(
WindowPtr,
int,
BoxPtr,
GCPtr
);
/* ppcClip.c */
void xf4bppDestroyClip(
GCPtr
);
void xf4bppChangeClip(
GCPtr,
int,
pointer,
int
);
void xf4bppCopyClip(
GCPtr,
GCPtr
);
/* ppcCpArea.c */
RegionPtr xf4bppCopyArea(
DrawablePtr,
DrawablePtr,
GCPtr,
int,
int,
int,
int,
int,
int
);
/* ppcDepth.c */
Bool xf4bppDepthOK(
DrawablePtr,
int
);
/* ppcFillRct.c */
void xf4bppPolyFillRect(
DrawablePtr,
GCPtr,
int,
xRectangle *
);
/* ppcWindowFS.c */
void xf4bppSolidWindowFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
void xf4bppStippleWindowFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
void xf4bppOpStippleWindowFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
void xf4bppTileWindowFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
/* xf4bppPixmapFS.c */
void xf4bppSolidPixmapFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
void xf4bppStipplePixmapFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
void xf4bppOpStipplePixmapFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
void xf4bppTilePixmapFS(
DrawablePtr,
GCPtr,
int,
DDXPointPtr,
int *,
int
);
/* ppcGC.c */
Bool xf4bppCreateGC(
GCPtr
);
/* ppcGetSp.c */
void xf4bppGetSpans(
DrawablePtr,
int,
DDXPointPtr,
int *,
int,
char *
);
/* ppcImg.c */
void xf4bppGetImage(
DrawablePtr,
int,
int,
int,
int,
unsigned int,
unsigned long,
char *
);
/* ppcLine.c */
void xf4bppScrnZeroLine(
DrawablePtr,
GCPtr,
int,
int,
DDXPointPtr
);
void xf4bppScrnZeroDash(
DrawablePtr,
GCPtr,
int,
int,
DDXPointPtr
);
void xf4bppScrnZeroSegs(
DrawablePtr,
GCPtr,
int,
xSegment *
);
/* ppcPixmap.c */
PixmapPtr xf4bppCreatePixmap(
ScreenPtr,
int,
int,
int,
unsigned
);
PixmapPtr xf4bppCopyPixmap(
PixmapPtr
);
/* ppcPolyPnt.c */
void xf4bppPolyPoint(
DrawablePtr,
GCPtr,
int,
int,
xPoint *
);
/* ppcPolyRec.c */
void xf4bppPolyRectangle(
DrawablePtr,
GCPtr,
int,
xRectangle *
);
/* ppcQuery.c */
void xf4bppQueryBestSize(
int,
unsigned short *,
unsigned short *,
ScreenPtr
);
/* ppcRslvC.c */
void xf4bppResolveColor(
unsigned short *,
unsigned short *,
unsigned short *,
VisualPtr
);
Bool xf4bppInitializeColormap(
ColormapPtr
);
/* ppcSetSp.c */
void xf4bppSetSpans(
DrawablePtr,
GCPtr,
char *,
DDXPointPtr,
int *,
int,
int
);
/* ppcWindow.c */
void xf4bppCopyWindow(
WindowPtr,
DDXPointRec,
RegionPtr
);
Bool xf4bppPositionWindow(
WindowPtr,
int,
int
);
Bool xf4bppUnrealizeWindow(
WindowPtr,
int,
int
);
Bool xf4bppDestroyWindow(
WindowPtr
);
Bool xf4bppCreateWindowForXYhardware(
WindowPtr
);
/* emulOpStip.c */
void xf4bppOpaqueStipple(
WindowPtr,
PixmapPtr,
unsigned long int,
unsigned long int,
int,
unsigned long int,
int,
int,
int,
int,
int,
int
);
/* emulRepAre.c */
void xf4bppReplicateArea(
WindowPtr,
int,
int,
int,
int,
int,
int,
int
);
/* emulTile.c */
void xf4bppTileRect(
WindowPtr,
PixmapPtr,
const int,
const unsigned long int,
int,
int,
int,
int,
int,
int
);
/* vgaGC.c */
Mask xf4bppChangeWindowGC(
GCPtr,
Mask
);
/* vgaBitBlt.c */
void xf4bppBitBlt(
WindowPtr,
int,
int,
int,
int,
int,
int,
int,
int
);
/* vgaImages.c */
void xf4bppDrawColorImage(
WindowPtr,
int,
int,
int,
int,
unsigned char *,
int,
const int,
const unsigned long int
);
void xf4bppReadColorImage(
WindowPtr,
int,
int,
int,
int,
unsigned char *,
int
);
/* vgaLine.c */
void xf4bppHorzLine(
WindowPtr,
unsigned long int,
int,
unsigned long int,
int,
int,
int
);
void xf4bppVertLine(
WindowPtr,
unsigned long int,
int,
unsigned long int,
int,
int,
int
);
void xf4bppBresLine(
WindowPtr,
unsigned long int,
int,
unsigned long int,
int,
int,
int,
int,
int,
int,
int,
int,
unsigned long int
);
/* vgaStipple.c */
void xf4bppFillStipple(
WindowPtr,
const PixmapPtr,
unsigned long int,
const int,
unsigned long int,
int,
int,
int,
int,
const int,
const int
);
/* vgaSolid.c */
void xf4bppFillSolid(
WindowPtr,
unsigned long int,
const int,
unsigned long int,
int,
const int,
int,
const int
);
/* offscreen.c */
void xf4bppOffBitBlt(
WindowPtr,
const int,
const int,
int,
int,
int,
int,
int,
int
);
void xf4bppOffDrawColorImage(
WindowPtr,
int,
int,
int,
int,
unsigned char *,
int,
const int,
const unsigned long int
);
void xf4bppOffReadColorImage(
WindowPtr,
int,
int,
int,
int,
unsigned char *,
int
);
void xf4bppOffFillSolid(
WindowPtr,
unsigned long int,
const int,
unsigned long int,
int,
const int,
int,
const int
);
void xf4bppOffDrawMonoImage(
WindowPtr,
unsigned char *,
int,
int,
int,
int,
unsigned long int,
int,
unsigned long int
);
void xf4bppOffFillStipple(
WindowPtr,
const PixmapPtr,
unsigned long int,
const int,
unsigned long int,
int,
int,
int,
int,
const int,
const int
);
/* mfbimggblt.c */
void xf4bppImageGlyphBlt(
DrawablePtr,
GCPtr,
int,
int,
unsigned int,
CharInfoPtr *,
pointer
);
/* wm3.c */
int wm3_set_regs(
GC *
);
/* ppcIO.c */
void xf4bppNeverCalled(
void
);
Bool xf4bppScreenInit(
ScreenPtr,
pointer,
int,
int,
int,
int,
int
);
/* mfbfillarc.c */
void xf4bppPolyFillArc(
DrawablePtr,
GCPtr,
int,
xArc *
);
/* mfbzerarc.c */
void xf4bppZeroPolyArc(
DrawablePtr,
GCPtr,
int,
xArc *
);
/* mfbline.c */
void xf4bppSegmentSS (
DrawablePtr,
GCPtr,
int,
xSegment *
);
void xf4bppLineSS (
DrawablePtr,
GCPtr,
int,
int,
DDXPointPtr
);
void xf4bppSegmentSD (
DrawablePtr,
GCPtr,
int,
xSegment *
);
void xf4bppLineSD (
DrawablePtr,
GCPtr,
int,
int,
DDXPointPtr
);
/* mfbbres.c */
void xf4bppBresS(
PixelType *,
int,
int,
int,
int,
int,
int,
int,
int,
int,
int
);
/* mfbbresd.c */
void xf4bppBresD(
DrawablePtr,
int, int,
int *,
unsigned char *,
int,
int *,
int,
PixelType *,
int, int, int, int, int, int,
int, int,
int, int
);
/* mfbhrzvert.c */
void xf4bppHorzS(
PixelType *,
int,
int,
int,
int
);
void xf4bppVertS(
PixelType *,
int,
int,
int,
int
);
#ifdef PC98_EGC
/* egc_asm.s */
unsigned char getbits_x(
int,
unsigned int,
pointer,
unsigned int
);
void wcopyr(
pointer,
pointer,
int,
pointer
);
void wcopyl(
pointer,
pointer,
int,
pointer
);
unsigned long int read8Z(
pointer
);
#endif /* PC98_EGC */
#endif /* __XF4BPP_H__ */

View file

@ -1,83 +0,0 @@
if GLX
GLX_SUBDIRS = glxext
endif
if XGLX
XGLX_SUBDIRS = glx
endif
if XEGL
XEGL_SUBDIRS = egl
endif
DIST_SUBDIRS = glxext glx egl
SUBDIRS = \
. \
$(GLX_SUBDIRS) \
$(XGLX_SUBDIRS) \
$(XEGL_SUBDIRS)
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DHAVE_XGL_CONFIG_H \
-DHAVE_DIX_CONFIG_H \
-I$(top_srcdir)/glx \
-I$(top_srcdir)/GL/include \
-I@MESA_SOURCE@/include \
-I@MESA_SOURCE@/src/mesa/glapi \
$(XGLMODULES_CFLAGS)
noinst_LIBRARIES = libxgl.a
libxgl_a_SOURCES = \
xgl.h \
xglmodule.h \
xglglx.h \
xglinput.c \
xgloutput.c \
xglcmap.c \
xglparse.c \
xglscreen.c \
xglarea.c \
xglgeometry.c \
xglpixmap.c \
xglsync.c \
xglsolid.c \
xgltile.c \
xglcopy.c \
xglfill.c \
xglwindow.c \
xglget.c \
xglgc.c \
xglshm.c \
xglcompose.c \
xglpict.c \
xglglyph.c \
xgltrap.c \
xglloader.c \
xglhash.c \
xglglx.c \
xglxv.c
EXTRA_DIST = \
xglmodule.h
Xgl_LDFLAGS = -export-dynamic
Xgl_SOURCES = \
xglinit.c \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xext/dpmsstubs.c \
$(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/fb/fbcmap.c
XGL_LIBS = \
libxgl.a \
@XGL_LIBS@ \
$(XSERVER_LIBS)
Xgl_DEPENDENCIES = $(XGL_LIBS)
Xgl_LDADD = $(XGL_LIBS) $(XSERVER_SYS_LIBS) $(XGL_SYS_LIBS)
Xgl_programs = Xgl
bin_PROGRAMS = $(Xgl_programs)

View file

@ -1,44 +0,0 @@
if XGL
XGL_MODULE_DIRS = module
endif
DIST_SUBDIRS = module
SUBDIRS = \
. \
$(XGL_MODULE_DIRS)
AM_CFLAGS = \
$(DIX_CFLAGS) \
-DHAVE_XGL_CONFIG_H \
-DHAVE_DIX_CONFIG_H \
$(XEGLMODULES_CFLAGS)
noinst_LTLIBRARIES = libxegl.la
libxegl_la_SOURCES = \
xegl.h \
xegl.c \
xeglinput.c \
kkeymap.h \
kinput.c \
evdev.c
XEGL_LIBS = \
@XEGL_LIBS@ \
libxegl.la \
../libxgl.a \
$XSERVER_LIBS
Xegl_LDFLAGS = -export-dynamic
Xegl_SOURCES = \
xeglinit.c \
$(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xext/dpmsstubs.c \
$(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/fb/fbcmap.c
Xegl_DEPENDENCIES = $(XEGL_LIBS)
Xegl_LDADD = $(XEGL_LIBS) $(XSERVER_SYS_LIBS) $(XEGL_SYS_LIBS)
bin_PROGRAMS = Xegl

View file

@ -1,646 +0,0 @@
/*
* Copyright © 2004 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.
*/
#include <xgl-config.h>
#define NEED_EVENTS
#include <errno.h>
#include <linux/input.h>
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xpoll.h>
#define XK_PUBLISHING
#include <X11/keysym.h>
#include "inputstr.h"
#include "kkeymap.h"
#include "scrnintstr.h"
#include "xegl.h"
#define NUM_EVENTS 128
#define ABS_UNSET -65535
#define BITS_PER_LONG (sizeof(long) * 8)
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define BIT(x) (1 << OFF(x))
#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
typedef struct _kevdevMouse {
/* current device state */
int rel[REL_MAX + 1];
int abs[ABS_MAX + 1];
int prevabs[ABS_MAX + 1];
long key[NBITS(KEY_MAX + 1)];
/* supported device info */
long relbits[NBITS(REL_MAX + 1)];
long absbits[NBITS(ABS_MAX + 1)];
long keybits[NBITS(KEY_MAX + 1)];
struct input_absinfo absinfo[ABS_MAX + 1];
int max_rel;
int max_abs;
} Kevdev;
static int flags = 0;
static void
EvdevMotion (KdMouseInfo *mi)
{
Kevdev *ke = mi->driver;
int i;
for (i = 0; i <= ke->max_rel; i++)
if (ke->rel[i])
{
KdEnqueueMouseEvent (mi, flags | KD_MOUSE_DELTA, ke->rel[0], ke->rel[1]);
int a;
// ErrorF ("rel");
for (a = 0; a <= ke->max_rel; a++)
{
// if (ISBITSET (ke->relbits, a))
// ErrorF (" %d=%d", a, ke->rel[a]);
ke->rel[a] = 0;
}
// ErrorF ("\n");
break;
}
for (i = 0; i < ke->max_abs; i++)
if (ke->abs[i] != ke->prevabs[i])
{
KdEnqueueMouseEvent (mi, flags, ke->abs[0], ke->abs[1]);
int a;
// ErrorF ("abs");
for (a = 0; a <= ke->max_abs; a++)
{
// if (ISBITSET (ke->absbits, a))
// ErrorF (" %d=%d", a, ke->abs[a]);
ke->prevabs[a] = ke->abs[a];
}
// ErrorF ("\n");
break;
}
}
static void
EvdevRead (int evdevPort, void *closure)
{
KdMouseInfo *mi = closure;
Kevdev *ke = mi->driver;
int i, n;
struct input_event events[NUM_EVENTS];
n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
if (n <= 0)
return;
n /= sizeof (struct input_event);
for (i = 0; i < n; i++)
{
switch (events[i].type) {
case EV_SYN:
break;
case EV_KEY:
EvdevMotion (mi);
ASSIGNBIT(ke->key,events[i].code, events[i].value);
if (events[i].code < 0x100)
ErrorF ("key %d %d\n", events[i].code, events[i].value);
else
ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
if (events[i].value==1) {
switch (events[i].code) {
case BTN_LEFT:
flags |= KD_BUTTON_1;
break;
case BTN_RIGHT:
flags |= KD_BUTTON_3;
break;
case BTN_MIDDLE:
flags |= KD_BUTTON_2;
break;
case BTN_FORWARD:
flags |= KD_BUTTON_4;
break;
case BTN_BACK:
flags |= KD_BUTTON_5;
break;
}
}
else if (events[i].value==0) {
switch (events[i].code) {
case BTN_LEFT:
flags &= ~KD_BUTTON_1;
break;
case BTN_RIGHT:
flags &= ~KD_BUTTON_3;
break;
case BTN_MIDDLE:
flags &= ~KD_BUTTON_2;
break;
case BTN_FORWARD:
flags &= ~KD_BUTTON_4;
break;
case BTN_BACK:
flags &= ~KD_BUTTON_5;
break;
}
}
KdEnqueueMouseEvent (mi, KD_MOUSE_DELTA | flags, 0, 0);
break;
case EV_REL:
ke->rel[events[i].code] += events[i].value;
break;
case EV_ABS:
ke->abs[events[i].code] = events[i].value;
break;
}
}
EvdevMotion (mi);
}
int EvdevInputType;
char *kdefaultEvdev[] = {
// "/dev/input/event0",
"/dev/input/event1",
// "/dev/input/event2",
// "/dev/input/event3",
// "/dev/input/event4",
// "/dev/input/event5",
};
#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
static Bool
EvdevInit (void)
{
int i;
int fd;
KdMouseInfo *mi, *next;
int n = 0;
char *prot;
char name[100];
if (!EvdevInputType)
EvdevInputType = KdAllocInputType ();
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
prot = mi->prot;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
{
fd = open (kdefaultEvdev[i], 2);
if (fd >= 0)
{
ioctl(fd, EVIOCGRAB, 1);
ioctl(fd, EVIOCGNAME(sizeof(name)), name);
ErrorF("Name is %s\n", name);
ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
ErrorF("Phys Loc is %s\n", name);
ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
ErrorF("Unique is %s\n", name);
mi->name = KdSaveString (kdefaultEvdev[i]);
break;
}
}
}
else
fd = open (mi->name, 2);
if (fd >= 0)
{
unsigned long ev[NBITS(EV_MAX)];
Kevdev *ke;
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
{
perror ("EVIOCGBIT 0");
close (fd);
continue;
}
ke = xalloc (sizeof (Kevdev));
if (!ke)
{
close (fd);
continue;
}
memset (ke, '\0', sizeof (Kevdev));
if (ISBITSET (ev, EV_KEY))
{
if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
ke->keybits) < 0)
{
perror ("EVIOCGBIT EV_KEY");
xfree (ke);
close (fd);
continue;
}
}
if (ISBITSET (ev, EV_REL))
{
if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
ke->relbits) < 0)
{
perror ("EVIOCGBIT EV_REL");
xfree (ke);
close (fd);
continue;
}
for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
if (ISBITSET(ke->relbits, ke->max_rel))
break;
}
if (ISBITSET (ev, EV_ABS))
{
int i;
if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
ke->absbits) < 0)
{
perror ("EVIOCGBIT EV_ABS");
xfree (ke);
close (fd);
continue;
}
for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
if (ISBITSET(ke->absbits, ke->max_abs))
break;
for (i = 0; i <= ke->max_abs; i++)
{
if (ISBITSET (ke->absbits, i))
if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
{
perror ("EVIOCGABS");
break;
}
ke->prevabs[i] = ABS_UNSET;
}
if (i <= ke->max_abs)
{
xfree (ke);
close (fd);
continue;
}
}
mi->driver = ke;
mi->inputType = EvdevInputType;
if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi))
n++;
}
}
return TRUE;
}
static void
EvdevFini (void)
{
KdMouseInfo *mi;
KdUnregisterFds (EvdevInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == EvdevInputType)
{
xfree (mi->driver);
mi->driver = 0;
mi->inputType = 0;
}
}
}
KdMouseFuncs LinuxEvdevMouseFuncs = {
EvdevInit,
EvdevFini,
};
KeySym evdevKeymap[(112 - 1 + 1) * 2] = {
/* These are directly mapped from DOS scanset 0 */
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
/* 3 10 */ XK_2, XK_at,
/* 4 11 */ XK_3, XK_numbersign,
/* 5 12 */ XK_4, XK_dollar,
/* 6 13 */ XK_5, XK_percent,
/* 7 14 */ XK_6, XK_asciicircum,
/* 8 15 */ XK_7, XK_ampersand,
/* 9 16 */ XK_8, XK_asterisk,
/* 10 17 */ XK_9, XK_parenleft,
/* 11 18 */ XK_0, XK_parenright,
/* 12 19 */ XK_minus, XK_underscore,
/* 13 20 */ XK_equal, XK_plus,
/* 14 21 */ XK_BackSpace, NoSymbol,
/* 15 22 */ XK_Tab, NoSymbol,
/* 16 23 */ XK_Q, NoSymbol,
/* 17 24 */ XK_W, NoSymbol,
/* 18 25 */ XK_E, NoSymbol,
/* 19 26 */ XK_R, NoSymbol,
/* 20 27 */ XK_T, NoSymbol,
/* 21 28 */ XK_Y, NoSymbol,
/* 22 29 */ XK_U, NoSymbol,
/* 23 30 */ XK_I, NoSymbol,
/* 24 31 */ XK_O, NoSymbol,
/* 25 32 */ XK_P, NoSymbol,
/* 26 33 */ XK_bracketleft, XK_braceleft,
/* 27 34 */ XK_bracketright, XK_braceright,
/* 28 35 */ XK_Return, NoSymbol,
/* 29 36 */ XK_Control_L, NoSymbol,
/* 30 37 */ XK_A, NoSymbol,
/* 31 38 */ XK_S, NoSymbol,
/* 32 39 */ XK_D, NoSymbol,
/* 33 40 */ XK_F, NoSymbol,
/* 34 41 */ XK_G, NoSymbol,
/* 35 42 */ XK_H, NoSymbol,
/* 36 43 */ XK_J, NoSymbol,
/* 37 44 */ XK_K, NoSymbol,
/* 38 45 */ XK_L, NoSymbol,
/* 39 46 */ XK_semicolon, XK_colon,
/* 40 47 */ XK_apostrophe, XK_quotedbl,
/* 41 48 */ XK_grave, XK_asciitilde,
/* 42 49 */ XK_Shift_L, NoSymbol,
/* 43 50 */ XK_backslash, XK_bar,
/* 44 51 */ XK_Z, NoSymbol,
/* 45 52 */ XK_X, NoSymbol,
/* 46 53 */ XK_C, NoSymbol,
/* 47 54 */ XK_V, NoSymbol,
/* 48 55 */ XK_B, NoSymbol,
/* 49 56 */ XK_N, NoSymbol,
/* 50 57 */ XK_M, NoSymbol,
/* 51 58 */ XK_comma, XK_less,
/* 52 59 */ XK_period, XK_greater,
/* 53 60 */ XK_slash, XK_question,
/* 54 61 */ XK_Shift_R, NoSymbol,
/* 55 62 */ XK_KP_Multiply, NoSymbol,
/* 56 63 */ XK_Alt_L, XK_Meta_L,
/* 57 64 */ XK_space, NoSymbol,
/* 58 65 */ XK_Caps_Lock, NoSymbol,
/* 59 66 */ XK_F1, NoSymbol,
/* 60 67 */ XK_F2, NoSymbol,
/* 61 68 */ XK_F3, NoSymbol,
/* 62 69 */ XK_F4, NoSymbol,
/* 63 70 */ XK_F5, NoSymbol,
/* 64 71 */ XK_F6, NoSymbol,
/* 65 72 */ XK_F7, NoSymbol,
/* 66 73 */ XK_F8, NoSymbol,
/* 67 74 */ XK_F9, NoSymbol,
/* 68 75 */ XK_F10, NoSymbol,
/* 69 76 */ XK_Break, XK_Pause,
/* 70 77 */ XK_Scroll_Lock, NoSymbol,
/* 71 78 */ XK_KP_Home, XK_KP_7,
/* 72 79 */ XK_KP_Up, XK_KP_8,
/* 73 80 */ XK_KP_Page_Up, XK_KP_9,
/* 74 81 */ XK_KP_Subtract, NoSymbol,
/* 75 82 */ XK_KP_Left, XK_KP_4,
/* 76 83 */ XK_KP_5, NoSymbol,
/* 77 84 */ XK_KP_Right, XK_KP_6,
/* 78 85 */ XK_KP_Add, NoSymbol,
/* 79 86 */ XK_KP_End, XK_KP_1,
/* 80 87 */ XK_KP_Down, XK_KP_2,
/* 81 88 */ XK_KP_Page_Down, XK_KP_3,
/* 82 89 */ XK_KP_Insert, XK_KP_0,
/* 83 90 */ XK_KP_Delete, XK_KP_Decimal,
/* 84 91 */ NoSymbol, NoSymbol,
/* 85 92 */ NoSymbol, NoSymbol,
/* 86 93 */ NoSymbol, NoSymbol,
/* 87 94 */ XK_F11, NoSymbol,
/* 88 95 */ XK_F12, NoSymbol,
/* These are remapped from the extended set (using ExtendMap) */
/* 89 96 */ XK_Control_R, NoSymbol,
/* 90 97 */ XK_KP_Enter, NoSymbol,
/* 91 98 */ XK_KP_Divide, NoSymbol,
/* 92 99 */ XK_Sys_Req, XK_Print,
/* 93 100 */ XK_Alt_R, XK_Meta_R,
/* 94 101 */ XK_Num_Lock, NoSymbol,
/* 95 102 */ XK_Home, NoSymbol,
/* 96 103 */ XK_Up, NoSymbol,
/* 97 104 */ XK_Page_Up, NoSymbol,
/* 98 105 */ XK_Left, NoSymbol,
/* 99 106 */ XK_Right, NoSymbol,
/* 100 107 */ XK_End, NoSymbol,
/* 101 108 */ XK_Down, NoSymbol,
/* 102 109 */ XK_Page_Down, NoSymbol,
/* 103 110 */ XK_Insert, NoSymbol,
/* 104 111 */ XK_Delete, NoSymbol,
/* 105 112 */ XK_Super_L, NoSymbol,
/* 106 113 */ XK_Super_R, NoSymbol,
/* 107 114 */ XK_Menu, NoSymbol,
/* 108 115 */ NoSymbol, NoSymbol,
/* 109 116 */ NoSymbol, NoSymbol,
/* 110 117 */ NoSymbol, NoSymbol,
/* 111 118 */ NoSymbol, NoSymbol,
/* 112 119 */ NoSymbol, NoSymbol,
};
static void
EvdevRead1 (int evdevPort, void *closure)
{
int i, n, xk;
struct input_event events[NUM_EVENTS];
n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
if (n <= 0)
return;
n /= sizeof (struct input_event);
for (i = 0; i < n; i++)
{
switch (events[i].type) {
case EV_SYN:
break;
case EV_KEY:
xk = events[i].code;
if (events[i].code < 0x100)
ErrorF ("key %d %d xk %d\n", events[i].code, events[i].value, xk);
else
ErrorF ("key 0x%x %d xk %d\n", events[i].code, events[i].value, xk);
if (events[i].value == 2) {
//KdEnqueueKeyboardEvent (xk, 0);
KdEnqueueKeyboardEvent (xk, 0);
} else
KdEnqueueKeyboardEvent (xk, !events[i].value);
break;
}
}
}
char *kdefaultEvdev1[] = {
"/dev/input/event0",
// "/dev/input/event1",
// "/dev/input/event2",
// "/dev/input/event3",
// "/dev/input/event4",
// "/dev/input/event5",
};
#define NUM_DEFAULT_EVDEV1 (sizeof (kdefaultEvdev1) / sizeof (kdefaultEvdev1[0]))
static Bool
EvdevKbdInit (void)
{
int i;
int fd;
int n = 0;
char name[100];
if (!EvdevInputType)
EvdevInputType = KdAllocInputType ();
for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
{
fd = open (kdefaultEvdev1[i], 2);
if (fd >= 0)
{
ioctl(fd, EVIOCGRAB, 1);
ioctl(fd, EVIOCGNAME(sizeof(name)), name);
ErrorF("Name is %s\n", name);
ioctl(fd, EVIOCGPHYS(sizeof(name)), name);
ErrorF("Phys Loc is %s\n", name);
ioctl(fd, EVIOCGUNIQ(sizeof(name)), name);
ErrorF("Unique is %s\n", name);
}
if (fd >= 0)
{
unsigned long ev[NBITS(EV_MAX)];
Kevdev *ke;
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
{
perror ("EVIOCGBIT 0");
close (fd);
continue;
}
ke = xalloc (sizeof (Kevdev));
if (!ke)
{
close (fd);
continue;
}
memset (ke, '\0', sizeof (Kevdev));
if (ISBITSET (ev, EV_KEY))
{
if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
ke->keybits) < 0)
{
perror ("EVIOCGBIT EV_KEY");
xfree (ke);
close (fd);
continue;
}
}
if (ISBITSET (ev, EV_REL))
{
if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
ke->relbits) < 0)
{
perror ("EVIOCGBIT EV_REL");
xfree (ke);
close (fd);
continue;
}
for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
if (ISBITSET(ke->relbits, ke->max_rel))
break;
}
if (ISBITSET (ev, EV_ABS))
{
int i;
if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
ke->absbits) < 0)
{
perror ("EVIOCGBIT EV_ABS");
xfree (ke);
close (fd);
continue;
}
for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
if (ISBITSET(ke->absbits, ke->max_abs))
break;
for (i = 0; i <= ke->max_abs; i++)
{
if (ISBITSET (ke->absbits, i))
if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
{
perror ("EVIOCGABS");
break;
}
ke->prevabs[i] = ABS_UNSET;
}
if (i <= ke->max_abs)
{
xfree (ke);
close (fd);
continue;
}
}
if (KdRegisterFd (EvdevInputType, fd, EvdevRead1, NULL))
n++;
}
}
return TRUE;
}
static void EvdevKbdLoad(void)
{
kdMinScanCode = 1;
kdMaxScanCode = 112;
kdKeymapWidth = 2;
memcpy (kdKeymap, evdevKeymap, sizeof (evdevKeymap));
}
static void
EvdevKbdFini (void)
{
}
static void
EvdevKbdLeds (int leds)
{
}
static void EvdevKbdBell(int volume, int pitch, int duration)
{
}
KdKeyboardFuncs LinuxEvdevKeyboardFuncs = {
EvdevKbdLoad,
EvdevKbdInit,
EvdevKbdLeds,
EvdevKbdBell,
EvdevKbdFini,
0,
};

File diff suppressed because it is too large Load diff

View file

@ -1,55 +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.
*/
/*
* All global variables and functions pertaining to keyboard key mapping
* live in this header file.
*/
#ifndef _KKEYMAP_H
#define _KKEYMAP_H
/* Offset of MIN_SCANCODE to 8 (X minimum scancode value) */
#define KD_KEY_OFFSET (8 - kdMinScanCode)
#define KD_MIN_KEYCODE 8
#define KD_MAX_KEYCODE 254
#define KD_MAX_WIDTH 4
#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
extern int kdMinScanCode;
extern int kdMaxScanCode;
extern int kdMinKeyCode;
extern int kdMaxKeyCode;
extern int kdKeymapWidth;
extern KeySym kdKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
extern CARD8 kdModMap[MAP_LENGTH];
extern KeySymsRec kdKeySyms;
typedef struct {
KeySym modsym;
int modbit;
} KdKeySymModsRec;
#endif /* _KKEYMAP_H */

View file

@ -1,15 +0,0 @@
AM_CFLAGS = \
$(DIX_CFLAGS) \
-I$(srcdir)/.. \
-I$(srcdir)/../.. \
$(XEGLMODULES_CFLAGS)
libxegl_la_LDFLAGS = -avoid-version
libxegl_la_SOURCES = xeglmodule.c
libxegl_la_LIBADD = \
$(top_builddir)/hw/xgl/glx/libxegl.la \
$(XEGLMODULES_LIBS)
moduledir = @xglmoduledir@
module_LTLIBRARIES = libxegl.la

View file

@ -1,104 +0,0 @@
/*
* Copyright © 2005 Novell, Inc.
*
* 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
* Novell, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
* Novell, Inc. makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL NOVELL, INC. 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.
*
* Author: David Reveman <davidr@novell.com>
*/
#include "xglmodule.h"
#include "xegl.h"
#include <glitz-egl.h>
char *
moduleVersion (void)
{
return VERSION;
}
Bool
moduleInit (const char *module)
{
glitz_egl_init (module);
return TRUE;
}
void
InitOutput (ScreenInfo *pScreenInfo,
int argc,
char **argv)
{
xeglInitOutput (pScreenInfo, argc, argv);
}
Bool
LegalModifier (unsigned int key,
DeviceIntPtr pDev)
{
return xeglLegalModifier (key, pDev);
}
void
ProcessInputEvents (void)
{
xeglProcessInputEvents ();
}
void
InitInput (int argc,
char **argv)
{
xeglInitInput (argc, argv);
}
void
ddxUseMsg (void)
{
ErrorF ("\nXegl usage:\n");
xeglUseMsg ();
}
int
ddxProcessArgument (int argc,
char **argv,
int i)
{
return xeglProcessArgument (argc, argv, i);
}
void
AbortDDX (void)
{
xeglAbort ();
}
void
ddxGiveUp (void)
{
xeglGiveUp ();
}
void
OsVendorInit (void)
{
xeglOsVendorInit ();
}

View file

@ -1,303 +0,0 @@
/*
* Copyright © 2004 David Reveman
*
* 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
* David Reveman not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
* David Reveman makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN 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.
*
* Author: David Reveman <davidr@novell.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <math.h>
#include <glitz-egl.h>
#include "inputstr.h"
#include "cursorstr.h"
#include "mipointer.h"
#include "xegl.h"
#define XEGL_DEFAULT_SCREEN_WIDTH 800
#define XEGL_DEFAULT_SCREEN_HEIGHT 600
DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey;
#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
#define XEGL_SET_SCREEN_PRIV(pScreen, v) \
dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v)
#define XEGL_SCREEN_PRIV(pScreen) \
xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen)
static EGLDisplay eDisplay;
static EGLScreenMESA eScreen;
static ScreenPtr currentScreen = 0;
static Bool softCursor = TRUE;
extern miPointerScreenFuncRec kdPointerScreenFuncs;
static Bool
xeglAllocatePrivates (ScreenPtr pScreen)
{
xeglScreenPtr pScreenPriv;
pScreenPriv = xalloc (sizeof (xeglScreenRec));
if (!pScreenPriv)
return FALSE;
XEGL_SET_SCREEN_PRIV (pScreen, pScreenPriv);
return TRUE;
}
static Bool
xeglCloseScreen (int index,
ScreenPtr pScreen)
{
glitz_drawable_t *drawable;
XEGL_SCREEN_PRIV (pScreen);
drawable = XGL_GET_SCREEN_PRIV (pScreen)->drawable;
if (drawable)
glitz_drawable_destroy (drawable);
xglClearVisualTypes ();
XGL_SCREEN_UNWRAP (CloseScreen);
xfree (pScreenPriv);
return (*pScreen->CloseScreen) (index, pScreen);
}
static Bool
xeglScreenInit (int index,
ScreenPtr pScreen,
int argc,
char **argv)
{
EGLSurface eSurface;
EGLModeMESA mode;
int count;
xeglScreenPtr pScreenPriv;
glitz_drawable_format_t *format;
glitz_drawable_t *drawable;
EGLint screenAttribs[] = {
EGL_WIDTH, 1024,
EGL_HEIGHT, 768,
EGL_NONE
};
if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
{
xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
}
screenAttribs[1] = xglScreenInfo.width;
screenAttribs[3] = xglScreenInfo.height;
format = xglVisuals[0].format;
if (!xeglAllocatePrivates (pScreen))
return FALSE;
currentScreen = pScreen;
pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen);
if (xglScreenInfo.width == 0 || xglScreenInfo.height == 0)
{
xglScreenInfo.width = XEGL_DEFAULT_SCREEN_WIDTH;
xglScreenInfo.height = XEGL_DEFAULT_SCREEN_HEIGHT;
}
eglGetModesMESA (eDisplay, eScreen, &mode, 1, &count);
eSurface = eglCreateScreenSurfaceMESA (eDisplay, format->id, screenAttribs);
if (eSurface == EGL_NO_SURFACE)
{
ErrorF ("failed to create screen surface\n");
return FALSE;
}
eglShowScreenSurfaceMESA (eDisplay, eScreen, eSurface, mode);
drawable = glitz_egl_create_surface (eDisplay, eScreen, format, eSurface,
xglScreenInfo.width,
xglScreenInfo.height);
if (!drawable)
{
ErrorF ("[%d] couldn't create glitz drawable for window\n", index);
return FALSE;
}
xglScreenInfo.drawable = drawable;
if (!xglScreenInit (pScreen))
return FALSE;
#ifdef GLXEXT
if (!xglInitVisualConfigs (pScreen))
return FALSE;
#endif
XGL_SCREEN_WRAP (CloseScreen, xeglCloseScreen);
miDCInitialize (pScreen, &kdPointerScreenFuncs);
miCreateDefColormap(pScreen);
if (!xglFinishScreenInit (pScreen))
return FALSE;
return TRUE;
}
void
xeglInitOutput (ScreenInfo *pScreenInfo,
int argc,
char **argv)
{
glitz_drawable_format_t *format, templ;
int i, maj, min, count;
unsigned long mask;
xglSetPixmapFormats (pScreenInfo);
if (!eDisplay)
{
eDisplay = eglGetDisplay (":0");
if (!eglInitialize (eDisplay, &maj, &min))
FatalError ("can't open display");
eglGetScreensMESA (eDisplay, &eScreen, 1, &count);
}
templ.samples = 1;
templ.doublebuffer = 1;
templ.color.alpha_size = 8;
mask = GLITZ_FORMAT_SAMPLES_MASK;
format = glitz_egl_find_window_config (eDisplay, eScreen,
mask, &templ, 0);
if (!format)
FatalError ("no visual format found");
xglSetVisualTypesAndMasks (pScreenInfo, format, (1 << TrueColor));
xglInitVisuals (pScreenInfo);
AddScreen (xeglScreenInit, argc, argv);
}
static void
xeglBlockHandler (pointer blockData,
OSTimePtr pTimeout,
pointer pReadMask)
{
XGL_SCREEN_PRIV (currentScreen);
if (!xglSyncSurface (&pScreenPriv->pScreenPixmap->drawable))
FatalError (XGL_SW_FAILURE_STRING);
glitz_surface_flush (pScreenPriv->surface);
glitz_drawable_finish (pScreenPriv->drawable);
}
void
xeglInitInput (int argc,
char **argv)
{
eglInitInput (&LinuxEvdevMouseFuncs, &LinuxEvdevKeyboardFuncs);
RegisterBlockAndWakeupHandlers (xeglBlockHandler, KdWakeupHandler, NULL);
}
Bool
xeglLegalModifier (unsigned int key,
DeviceIntPtr pDev)
{
return KdLegalModifier (key, pDev);
}
void
xeglProcessInputEvents (void)
{
KdProcessInputEvents ();
}
void
xeglUseMsg (void)
{
ErrorF ("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM] "
"specify screen characteristics\n");
ErrorF ("-softcursor force software cursor\n");
}
int
xeglProcessArgument (int argc,
char **argv,
int i)
{
if (!strcmp (argv[i], "-screen"))
{
if ((i + 1) < argc)
{
xglParseScreen (argv[i + 1]);
}
else
return 1;
return 2;
}
else if (!strcmp (argv[i], "-softcursor"))
{
softCursor = TRUE;
return 1;
}
return 0;
}
void
xeglAbort (void)
{
}
void
xeglGiveUp (void)
{
AbortDDX ();
}
void
xeglOsVendorInit (void)
{
}

View file

@ -1,214 +0,0 @@
/*
* Copyright © 2005 Novell, Inc.
*
* 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
* Novell, Inc. not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
* Novell, Inc. makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL NOVELL, INC. 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.
*
* Author: David Reveman <davidr@novell.com>
*/
#ifndef _XEGL_H_
#define _XEGL_H_
#include "xgl.h"
#include "randrstr.h"
#define KD_BUTTON_1 0x01
#define KD_BUTTON_2 0x02
#define KD_BUTTON_3 0x04
#define KD_BUTTON_4 0x08
#define KD_BUTTON_5 0x10
#define KD_MOUSE_DELTA 0x80000000
typedef struct _KdMouseFuncs {
Bool (*Init) (void);
void (*Fini) (void);
} KdMouseFuncs;
typedef struct _KdKeyboardFuncs {
void (*Load) (void);
int (*Init) (void);
void (*Leds) (int);
void (*Bell) (int, int, int);
void (*Fini) (void);
int LockLed;
} KdKeyboardFuncs;
typedef struct _KdOsFuncs {
int (*Init) (void);
void (*Enable) (void);
Bool (*SpecialKey) (KeySym);
void (*Disable) (void);
void (*Fini) (void);
void (*pollEvents) (void);
} KdOsFuncs;
typedef struct _KdMouseMatrix {
int matrix[2][3];
} KdMouseMatrix;
typedef enum _KdMouseState {
start,
button_1_pend,
button_1_down,
button_2_down,
button_3_pend,
button_3_down,
synth_2_down_13,
synth_2_down_3,
synth_2_down_1,
num_input_states
} KdMouseState;
#define KD_MAX_BUTTON 7
typedef struct _KdMouseInfo {
struct _KdMouseInfo *next;
void *driver;
void *closure;
char *name;
char *prot;
char map[KD_MAX_BUTTON];
int nbutton;
Bool emulateMiddleButton;
unsigned long emulationTimeout;
Bool timeoutPending;
KdMouseState mouseState;
Bool eventHeld;
xEvent heldEvent;
unsigned char buttonState;
int emulationDx, emulationDy;
int inputType;
Bool transformCoordinates;
} KdMouseInfo;
typedef struct _xeglScreen {
CloseScreenProcPtr CloseScreen;
ScreenPtr pScreen;
DDXPointRec origin;
} xeglScreenRec, *xeglScreenPtr;
extern KdMouseInfo *kdMouseInfo;
extern KdOsFuncs *kdOsFuncs;
extern Bool kdDontZap;
extern Bool kdDisableZaphod;
extern DevPrivateKey xeglScreenPrivateKey;
extern KdMouseFuncs LinuxEvdevMouseFuncs;
extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs;
#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 KdGetScreenPriv(pScreen) ((xeglScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey))
#define KdScreenPriv(pScreen) \
xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen)
void
eglInitInput (KdMouseFuncs *pMouseFuncs,
KdKeyboardFuncs *pKeyboardFuncs);
void
KdParseMouse (char *arg);
KdMouseInfo *
KdMouseInfoAdd (void);
void
KdMouseInfoDispose (KdMouseInfo *mi);
int
KdAllocInputType (void);
char *
KdSaveString (char *str);
Bool
KdRegisterFd (int type,
int fd,
void (*read) (int fd, void *closure),
void *closure);
void
KdUnregisterFds (int type,
Bool do_close);
void
KdEnqueueKeyboardEvent (unsigned char scan_code,
unsigned char is_up);
void
KdEnqueueMouseEvent (KdMouseInfo *mi,
unsigned long flags,
int rx,
int ry);
void
KdRegisterFdEnableDisable (int fd,
int (*enable) (int fd, void *closure),
void (*disable) (int fd, void *closure));
void
KdWakeupHandler (pointer data,
int result,
pointer readmask);
Bool
KdLegalModifier (unsigned int key,
DeviceIntPtr pDev);
void
KdProcessInputEvents (void);
void
xeglInitOutput (ScreenInfo *pScreenInfo,
int argc,
char **argv);
Bool
xeglLegalModifier (unsigned int key,
DevicePtr pDev);
void
xeglProcessInputEvents (void);
void
xeglInitInput (int argc,
char **argv);
void
xeglUseMsg (void);
int
xeglProcessArgument (int argc,
char **argv,
int i);
void
xeglAbort (void);
void
xeglGiveUp (void);
void
xeglOsVendorInit (void);
#endif /* _XEGL_H_ */

View file

@ -1,131 +0,0 @@
/*
* Copyright © 2004 David Reveman
*
* 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
* David Reveman not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
* David Reveman makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL DAVID REVEMAN 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.
*
* Author: David Reveman <davidr@novell.com>
*/
#include "xegl.h"
static xglScreenInfoRec xglScreenInfo = {
NULL, 0, 0, 0, 0,
DEFAULT_GEOMETRY_DATA_TYPE,
DEFAULT_GEOMETRY_USAGE,
FALSE,
XGL_DEFAULT_PBO_MASK,
FALSE,
FALSE
};
#ifdef GLXEXT
static Bool loadGlx = TRUE;
#endif
void
InitOutput (ScreenInfo *pScreenInfo,
int argc,
char **argv)
{
#ifdef GLXEXT
if (loadGlx)
{
if (!xglLoadGLXModules ())
FatalError ("No GLX modules loaded");
}
#endif
xeglInitOutput (pScreenInfo, argc, argv);
}
Bool
LegalModifier (unsigned int key,
DeviceIntPtr pDev)
{
return xeglLegalModifier (key, pDev);
}
void
ProcessInputEvents (void)
{
xeglProcessInputEvents ();
}
void
InitInput (int argc,
char **argv)
{
xeglInitInput (argc, argv);
}
void
ddxUseMsg (void)
{
ErrorF ("\nXgl usage:\n");
#ifdef GLXEXT
ErrorF ("-noglx don't load glx extension\n");
#endif
xglUseMsg ();
ErrorF ("\nXegl usage:\n");
xeglUseMsg ();
}
int
ddxProcessArgument (int argc,
char **argv,
int i)
{
int skip;
#ifdef GLXEXT
if (!strcmp (argv[i], "-noglx"))
{
loadGlx = FALSE;
return 1;
}
#endif
skip = xglProcessArgument (argc, argv, i);
if (skip)
return skip;
return xeglProcessArgument (argc, argv, i);
}
void
AbortDDX (void)
{
xeglAbort ();
}
void
ddxGiveUp (void)
{
xeglGiveUp ();
}
void
OsVendorInit (void)
{
xeglOsVendorInit ();
}

View file

@ -1,168 +0,0 @@
#include "xgl.h"
#include "xegl.h"
KdOsFuncs *kdOsFuncs;
Bool kdEmulateMiddleButton;
Bool kdRawPointerCoordinates;
Bool kdDontZap;
Bool kdDisableZaphod;
int kdScreenPrivateIndex;
static char *
KdParseFindNext (char *cur, char *delim, char *save, char *last)
{
while (*cur && !strchr (delim, *cur))
{
*save++ = *cur++;
}
*save = 0;
*last = *cur;
if (*cur)
cur++;
return cur;
}
/*
* Mouse argument syntax:
*
* device,protocol,options...
*
* Options are any of:
* 1-5 n button mouse
* 2button emulate middle button
* {NMO} Reorder buttons
*/
char *
KdSaveString (char *str)
{
char *n = (char *) xalloc (strlen (str) + 1);
if (!n)
return 0;
strcpy (n, str);
return n;
}
/*
* Parse mouse information. Syntax:
*
* <device>,<nbutton>,<protocol>{,<option>}...
*
* options: {nmo} pointer mapping (e.g. {321})
* 2button emulate middle button
* 3button dont emulate middle button
*/
void
KdParseMouse (char *arg)
{
char save[1024];
char delim;
KdMouseInfo *mi;
int i;
mi = KdMouseInfoAdd ();
if (!mi)
return;
mi->name = 0;
mi->prot = 0;
mi->emulateMiddleButton = kdEmulateMiddleButton;
mi->transformCoordinates = !kdRawPointerCoordinates;
mi->nbutton = 3;
for (i = 0; i < KD_MAX_BUTTON; i++)
mi->map[i] = i + 1;
if (!arg)
return;
if (strlen (arg) >= sizeof (save))
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (!save[0])
return;
mi->name = KdSaveString (save);
if (delim != ',')
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (!save[0])
return;
if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
{
mi->nbutton = save[0] - '0';
if (mi->nbutton > KD_MAX_BUTTON)
{
UseMsg ();
return;
}
}
if (!delim != ',')
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (save[0])
mi->prot = KdSaveString (save);
while (delim == ',')
{
arg = KdParseFindNext (arg, ",", save, &delim);
if (save[0] == '{')
{
char *s = save + 1;
i = 0;
while (*s && *s != '}')
{
if ('1' <= *s && *s <= '0' + mi->nbutton)
mi->map[i] = *s - '0';
else
UseMsg ();
s++;
}
}
else if (!strcmp (save, "2button"))
mi->emulateMiddleButton = TRUE;
else if (!strcmp (save, "3button"))
mi->emulateMiddleButton = FALSE;
else if (!strcmp (save, "rawcoord"))
mi->transformCoordinates = FALSE;
else if (!strcmp (save, "transform"))
mi->transformCoordinates = TRUE;
else
UseMsg ();
}
}
KdMouseInfo *kdMouseInfo;
KdMouseInfo *
KdMouseInfoAdd (void)
{
KdMouseInfo *mi, **prev;
mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
if (!mi)
return 0;
bzero (mi, sizeof (KdMouseInfo));
for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
*prev = mi;
return mi;
}
void
KdMouseInfoDispose (KdMouseInfo *mi)
{
KdMouseInfo **prev;
for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
if (*prev == mi)
{
*prev = mi->next;
if (mi->name)
xfree (mi->name);
if (mi->prot)
xfree (mi->prot);
xfree (mi);
break;
}
}

Some files were not shown because too many files have changed in this diff Show more