diff --git a/Makefile.am b/Makefile.am index c74718220..a32f85792 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,14 +5,6 @@ if COMPOSITE COMPOSITE_DIR=composite endif -if XTRAP -XTRAP_DIR=XTrap -endif - -if MFB -MFB_DIR=mfb -endif - if GLX GLX_DIR=glx endif @@ -48,11 +40,9 @@ SUBDIRS = \ Xi \ xkb \ $(DBE_DIR) \ - $(MFB_DIR) \ $(RECORD_DIR) \ xfixes \ damageext \ - $(XTRAP_DIR) \ $(COMPOSITE_DIR) \ $(GLX_DIR) \ exa \ @@ -93,11 +83,9 @@ DIST_SUBDIRS = \ Xi \ xkb \ dbe \ - mfb \ record \ xfixes \ damageext \ - XTrap \ composite \ glx \ exa \ diff --git a/XTrap/Makefile.am b/XTrap/Makefile.am deleted file mode 100644 index 1eddd4f56..000000000 --- a/XTrap/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_LTLIBRARIES = libxtrap.la - -AM_CFLAGS = $(DIX_CFLAGS) - -libxtrap_la_SOURCES = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c diff --git a/XTrap/xtrapddmi.c b/XTrap/xtrapddmi.c deleted file mode 100644 index 8ce99543d..000000000 --- a/XTrap/xtrapddmi.c +++ /dev/null @@ -1,161 +0,0 @@ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA - -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. - -*****************************************************************************/ -/* - * ABSTRACT: - * - * This module is the platform-specific but conditionally independent - * code for the XTrap extension (usually I/O or platform setup). - * This is shared code and is subject to change only by team approval. - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#ifdef PC -# include "fcntl.h" -# include "io.h" -# define O_NDELAY 0L -#endif - -#define NEED_REPLIES -#define NEED_EVENTS -#include /* From library include environment */ -#include "inputstr.h" /* From server include env. (must be before Xlib.h!) */ -#ifdef PC -# include "scrintst.h" /* Screen struct */ -# include "extnsist.h" -#else -# include "extnsionst.h" /* Server ExtensionEntry definitions */ -# include "scrnintstr.h" /* Screen struct */ -#endif -#include "inputstr.h" - -#include -#include -#include - -extern int XETrapErrorBase; -extern xXTrapGetAvailReply XETrap_avail; -extern DevicePtr XETrapKbdDev; -extern DevicePtr XETrapPtrDev; - -/* - * DESCRIPTION: - * - * This function performs the platform specific setup for server - * extension implementations. - */ -void XETrapPlatformSetup() -{ -} - - -#if !defined _XINPUT -/* - * DESCRIPTION: - * - * This routine processes the simulation of some input event. - * - */ -int XETrapSimulateXEvent(register xXTrapInputReq *request, - register ClientPtr client) -{ - ScreenPtr pScr = NULL; - int status = Success; - xEvent xev; - register int x = request->input.x; - register int y = request->input.y; - DevicePtr keydev = (DevicePtr)PickKeyboard(client); - DevicePtr ptrdev = (DevicePtr)PickPointer(client); - - if (request->input.screen < screenInfo.numScreens) - { - pScr = screenInfo.screens[request->input.screen]; - } - else - { /* Trying to play bogus events to this WS! */ -#ifdef VERBOSE - ErrorF("%s: Trying to send events to screen %d!\n", XTrapExtName, - request->input.screen); -#endif - status = XETrapErrorBase + BadScreen; - } - /* Fill in the event structure with the information - * Note: root, event, child, eventX, eventY, state, and sameScreen - * are all updated by FixUpEventFromWindow() when the events - * are delivered via DeliverDeviceEvents() or whatever. XTrap - * needs to only concern itself with type, detail, time, rootX, - * and rootY. - */ - if (status == Success) - { - xev.u.u.type = request->input.type; - xev.u.u.detail = request->input.detail; - xev.u.keyButtonPointer.time = GetTimeInMillis(); - xev.u.keyButtonPointer.rootX = x; - xev.u.keyButtonPointer.rootY = y; - - if (request->input.type == MotionNotify) - { /* Set new cursor position on screen */ - XETrap_avail.data.cur_x = x; - XETrap_avail.data.cur_y = y; - NewCurrentScreen (inputInfo.pointer, pScr, x, y); /* fix from amnonc@mercury.co.il */ - if (!(*pScr->SetCursorPosition)(inputInfo.pointer, pScr, x, y, xFalse)) - { - status = BadImplementation; - } - } - } - if (status == Success) - { - switch(request->input.type) - { /* Now process the event appropriately */ - case KeyPress: - case KeyRelease: - (*XETrapKbdDev->realInputProc)(&xev,(DeviceIntPtr)keydev, 1L); - break; - case MotionNotify: - case ButtonPress: - case ButtonRelease: - (*XETrapPtrDev->realInputProc)(&xev,(DeviceIntPtr)ptrdev, 1L); - break; - default: - status = BadValue; - break; - } - } - return(status); -} -#endif /* _XINPUT */ diff --git a/XTrap/xtrapdi.c b/XTrap/xtrapdi.c deleted file mode 100644 index 52bd57aee..000000000 --- a/XTrap/xtrapdi.c +++ /dev/null @@ -1,2154 +0,0 @@ -/***************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA -X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. - -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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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. - -*****************************************************************************/ -/* - * ABSTRACT: - * - * This module is the main module for extension initialization and setup. - * It is called by the server and by clients using the extension. - * This is shared code and is subject to change only by team approval. - * - * CONTRIBUTORS: - * - * Dick Annicchiarico - * Robert Chesler - * Gene Durso - * Marc Evans - * Alan Jamison - * Mark Henry - * Ken Miller - * - * CHANGES: - * - * Robert Chesler - grab-impreviousness patch to improve grab behavior - * Robert Chesler - add client arg to swapping routines for X11R6 port - * - */ - -/*-----------------* - * Include Files * - *-----------------*/ - -#define NEED_REPLIES -#define NEED_EVENTS -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include "inputstr.h" /* Server DevicePtr definitions */ -#include "misc.h" /* Server swapping macros */ -#include "dixstruct.h" /* Server ClientRec definitions */ -#include "resource.h" /* Used with the MakeAtom call */ -#ifdef PC -# include "scrintst.h" /* Screen struct */ -# include "extnsist.h" -#else -# include "extnsionst.h" /* Server ExtensionEntry definitions */ -# include "scrnintstr.h" /* Screen struct */ -#endif -#include "pixmapstr.h" /* DrawableRec */ -#include "windowstr.h" /* Drawable Lookup structures */ -#include "inputstr.h" -#include -#include -#include -#include "colormapst.h" -#ifdef PANORAMIX -#include "panoramiX.h" -#include "panoramiXsrv.h" -#include "cursor.h" -#endif - - -/*----------------------------* - * Global Data Declarations * - *----------------------------*/ - -DevicePtr XETrapKbdDev = NULL; -DevicePtr XETrapPtrDev = NULL; -int XETrapErrorBase = 0L; -xXTrapGetAvailReply XETrap_avail; /* What's available to clients */ - -globalref int_function XETrapDispatchVector[10L]; /* Vector of XTrap Rtns */ -globalref int_function XETSwDispatchVector[10L]; /* Swapped XTrap Rtns */ - -globalref int_function XETrapProcVector[256L]; /* The "shadowed" ProcVector */ - /* The "real" EventVector (XTrap creates it till events - * truly become vectored - */ -#ifndef VECTORED_EVENTS -globalref int_function EventProcVector[XETrapCoreEvents]; -#else -extern WindowPtr GetCurrentRootWindow(DeviceIntPtr); -globalref int_function EventProcVector[128L]; -#endif -static int_function keybd_process_inp = NULL; /* Used for VECTORED_EVENTS */ - /* The "shadowed" Event Vector */ -globalref int_function XETrapEventProcVector[XETrapCoreEvents]; - -globalref void_function XETSwProcVector[256L];/* Vector of Req swapping rtns */ - -/* This macro returns a true/false indicator based on whether it changes the - * environment state bits local to the server extension. This is based on the - * idea that if a valid flag is set and the corresponding data bit is not in - * the same state as desired, then true is returned, otherwise false is - * returned. - */ -#define _CheckChangeBit(valid,data,local,bit) \ - (BitIsFalse(valid,bit) ? 0L : \ - (((BitIsTrue(data,bit) && BitIsTrue(local,bit)) || \ - (BitIsFalse(data,bit) && BitIsFalse(local,bit))) ? 0L : \ - (BitToggle(local,bit), 1L))) - -/* This macro is designed to return the number of elements in an - * automatically allocated array. - */ -#ifndef ASIZE -#define ASIZE(array) (sizeof(array)/sizeof(array[0L])) -#endif - -/* This macro is designed to return the number of long words beyond - * XETrapMinRepSize contained in a data structure. - */ -#ifndef XEXTRA -#define XEXTRA(s) \ - ((sizeof(s)+(sizeof(CARD32)-1L)-XETrapMinRepSize)/sizeof(CARD32)) -#endif - -/* Static Declarations known to XTrap Only - * All XTrap clients refer to these single copies! - */ -/* This carries all of the information XTrap uses for internal information */ -static XETrapEnv *XETenv[MAXCLIENTS] = {NULL}; -#ifndef RESTYPE -#define RESTYPE unsigned long -#endif -static RESTYPE XETrapClass = 0L; /* Resource class for this extension */ -static RESTYPE XETrapType = 0L; /* Resource type for this extension */ -static Bool gate_closed = False; /* The global "gatekeeper" */ -static Bool key_ignore = False; /* The global "keymaster" */ -static Bool ignore_grabs = False; -static CARD8 next_key = XEKeyIsClear; /* Echo, Clear, or Other */ -#ifdef VECTORED_EVENTS -static INT16 current_screen = -1L; /* Current screen for events */ -#endif -static INT16 vectored_requests[256L] = {0L}; /* cnt of vectoring clients */ -static INT16 vectored_events[KeyPress+MotionNotify] = {0L}; -typedef struct _client_list -{ - struct _client_list *next; - ClientPtr client; -} ClientList; -static ClientList io_clients; /* Linked-list of clients currently doing I/O */ -static ClientList stats_clients; /* Linked-list of clients collecting stats */ -static ClientList cmd_clients; /* Linked-list of clients using command key */ - -/*----------------------------* - * Forward Declarations - *----------------------------*/ -static void _SwapProc (int (**f1 )(void), int (**f2 )(void)); -static void sXETrapEvent (xETrapDataEvent *from , xETrapDataEvent *to ); -static int add_accelerator_node (ClientPtr client , ClientList *accel ); -static void remove_accelerator_node (ClientPtr client , ClientList *accel ); -static void update_protocol (xXTrapGetReq *reqptr , ClientPtr client ); -#ifdef COLOR_REPLIES -static void GetSendColorRep (ClientPtr client , xResourceReq *req ); -static void GetSendNamedColorRep (ClientPtr client , xResourceReq *req ); -static void GetSendColorCellsRep (ClientPtr client , xResourceReq *req ); -static void GetSendColorPlanesRep (ClientPtr client , xResourceReq *req ); -#endif - -/* - * DESCRIPTION: - * - * This routine is called by the server when a given client - * goes away (as identified by the first argument). All - * memory allocations, misc. values specific to a given - * client would be reset here. - * - */ -int XETrapDestroyEnv(pointer value, XID id) -{ - xXTrapReq request; - XETrapEnv *penv = XETenv[(long)value]; - - XETrapReset(&request,penv->client); - /* Free any memory malloc'd for a particular client here */ - /* In case stop I/O wasn't received for this client */ - if (penv->stats) - { /* Remove from client accelerator list */ - remove_accelerator_node(penv->client, &stats_clients); - Xfree(penv->stats); /* Free the stats buckets */ - } - if (cmd_clients.next == NULL) - { /* No more command key clients! Let's reset the gate */ - gate_closed = False; - key_ignore = False; - next_key = XEKeyIsClear; - } - -#ifdef VECTORED_EVENTS - current_screen = -1L; /* Invalidate current screen */ -#endif - -#ifdef VERBOSE - ErrorF("%s: Client '%d' Disconnected\n", XTrapExtName, - penv->client->index); -#endif - - Xfree(penv); - XETenv[(long)value] = NULL; - - return 0; -} - -/* - * DESCRIPTION: - * - * This routine is called by the server when the last client - * (the session manager in most cases) goes away. This is server - * reset. When the server comes back up, this extension will not - * be loaded unless this routine makes the proper arrangements. - * - * The real concern here is to unload the extension - * and possibly make arragements to be called upon - * server restart. - * - */ -void XETrapCloseDown(ExtensionEntry *extEntry) -{ - long i; - - for (i=0L; irealInputProc; - EventProcVector[KeyRelease] = - (int_function)XETrapKbdDev->realInputProc; - } -#ifdef VECTORED_EVENTS - keybd_process_inp = EventProcVector[KeyPress]; - EventProcVector[KeyPress] = EventProcVector[KeyRelease] = NULL; - XETrapEventProcVector[KeyPress] = XETrapEventVector; - XETrapEventProcVector[KeyRelease] = XETrapEventVector; -#else /* !VECTORED_EVENTS */ - XETrapEventProcVector[KeyPress] = XETrapKeyboard; - XETrapEventProcVector[KeyRelease] = XETrapKeyboard; -#endif /* !VECTORED_EVENTS */ - } - /* Do we need to redirect the pointer device? */ -#ifndef VECTORED_EVENTS - if (XETrapPtrDev == NULL) - { - if ((XETrapPtrDev = (DevicePtr)inputInfo.pointer) == 0L) - { - retval = False; - } - else - { - EventProcVector[ButtonPress] = - (int_function)XETrapPtrDev->realInputProc; - EventProcVector[ButtonRelease] = - (int_function)XETrapPtrDev->realInputProc; - EventProcVector[MotionNotify] = - (int_function)XETrapPtrDev->realInputProc; - } - XETrapEventProcVector[ButtonPress] = XETrapPointer; - XETrapEventProcVector[ButtonRelease] = XETrapPointer; - XETrapEventProcVector[MotionNotify] = XETrapPointer; - } -#endif /* !VECTORED_EVENTS */ - return(retval); -} - -/* - * - * DESCRIPTION: - * - * This routine is the main entry point for the Xtrap extension. It is - * called by the server to inititalize the Xtrap extension. Once the - * extension is initialized, life is controlled by the XtrapDispatch - * routine by the requests it will handle. - * - * Initializes all the XTrap data structures with the proper - * addresses of defined routines that will help control the extension. - * It is vital that the extension state be kept accurate so that only - * one call to this routine be made. - * - */ - -void DEC_XTRAPInit() -{ - register ExtensionEntry *extEntry; - unsigned int i; - Atom a; - - /* Make the extension known to the server. Must be done every time - * DEC_XTRAPInit is called, else server will think it failed. - */ - if ((extEntry = AddExtension(XTrapExtName,XETrapNumEvents, - XETrapNumErrors,XETrapDispatch,sXETrapDispatch,XETrapCloseDown - ,StandardMinorOpcode)) == NULL) - { - ErrorF("%s: AddExtension Failed!\n", XTrapExtName); - return; - } -#ifdef VERBOSE - ErrorF("%s: AddExtension assigned Major Opcode '%d'\n", - XTrapExtName, extEntry->base); -#endif - XETrap_avail.data.major_opcode = extEntry->base; - XETrapErrorBase = extEntry->errorBase; - XETrap_avail.data.event_base = extEntry->eventBase; - - /* Set up our swapped reply vector */ - ReplySwapVector[XETrap_avail.data.major_opcode] = - (void_function) sReplyXTrapDispatch; - - /* Set up our swapped event vector */ - EventSwapVector[extEntry->eventBase + XETrapData] = - (EventSwapPtr) sXETrapEvent; - - /* make an atom saying that the extension is present. The - * adding of the resource occurs during XETrapCreateEnv(). - */ - if ((a = MakeAtom(XTrapExtName,strlen(XTrapExtName),1L)) == None || - (XETrapType = CreateNewResourceType(XETrapDestroyEnv)) == 0L) - { - ErrorF("%s: Setup can't create new resource type (%d,%d,%d)\n", - XTrapExtName, (int)a,(int)XETrapClass,(int)XETrapType); - return; - } - /* initialize the GetAvailable info reply here */ - XETrap_avail.hdr.type = X_Reply; - XETrap_avail.hdr.length = XEXTRA(xXTrapGetAvailReply); - XETrap_avail.data.xtrap_release = XETrapRelease; - XETrap_avail.data.xtrap_version = XETrapVersion; - XETrap_avail.data.xtrap_revision = XETrapRevision; - XETrap_avail.data.pf_ident = XETrapPlatform; - XETrap_avail.data.max_pkt_size = 0xFFFF; /* very large number */ - for (i=0L; iindex > MAXCLIENTS) - { - status = BadImplementation; - } - else if ((XETenv[client->index] = (XETrapEnv *)Xcalloc(sizeof(XETrapEnv))) - == NULL) - { - status = BadAlloc; - } - if (status == Success) - { - penv = XETenv[client->index]; - penv->client = client; - penv->protocol = 31; /* default to backwards compatibility */ - /* prep for client's departure (for memory dealloc, cleanup) */ - AddResource(FakeClientID(client->index),XETrapType, - (pointer)(long)(client->index)); - if (XETrapRedirectDevices() == False) - { - status = XETrapErrorBase + BadDevices; - } - /* Initialize the current state */ - if (status == Success) - { - status = XETrapReset(NULL, penv->client); - } - } - -#ifdef VECTORED_EVENTS - current_screen = -1L; /* Invalidate current screen */ -#endif - -#ifdef VERBOSE - if (status == Success) - { - ErrorF("%s: Client '%d' Connection Accepted\n", XTrapExtName, - penv->client->index); - } -#endif - - return(status); -} - -/* - * DESCRIPTION: - * - * This procedure is defined for the call to AddExtension() - * in which it is expected to be a parameter of the call. - * - * This routine will be called by the server dispatcher - * when a client makes a request that is handled - * by the extension and the byte ordering of the client is the - * SAME as that of the extension. - * - * Note: the status of the requests is returned to the caller of - * the Dispatch routine which will in turn SendErrorToClient if - * necessary. - */ - -int XETrapDispatch(ClientPtr client) -{ - - REQUEST(xXTrapReq); - register int status = Success; - - REQUEST_AT_LEAST_SIZE(xXTrapReq); - - /* Have we seen this client before? */ - if (XETenv[client->index] == NULL) - { - status = XETrapCreateEnv(client); - } - /* Do we have a valid request? */ - if (status == Success) - { - if (stuff->minor_opcode < ASIZE(XETrapDispatchVector)) - { - /* Then vector to the pointed to function */ - status = - (*(XETrapDispatchVector[stuff->minor_opcode]))(stuff,client); - } - else - { - status = BadRequest; - } - } - return(status); -} - -/* - * DESCRIPTION: - * - * This procedure is defined for the call to AddExtension() - * in which it is expected to be a parameter of the call. - * - * This routine would ordinarily be called by the server - * dispatcher when a client makes a request that is handled - * by the extension and the byte ordering of the client is - * DIFFERENT than that of the extension. - */ - -int sXETrapDispatch(ClientPtr client) -{ - - REQUEST(xXTrapReq); - register int status = Success; - - REQUEST_AT_LEAST_SIZE(xXTrapReq); - - /* Have we seen this client before? */ - if (XETenv[client->index] == NULL) - { - status = XETrapCreateEnv(client); - } - /* Do we have a valid request? */ - if (status == Success) - { - if (stuff->minor_opcode < ASIZE(XETSwDispatchVector)) - { - /* Then vector to the pointed to function */ - status = - (*(XETSwDispatchVector[stuff->minor_opcode]))(stuff,client); - } - else - { - status = BadRequest; - } - } - return(status); -} - -/* - * DESCRIPTION: - * - * This routine will place the extension in a steady and known - * state. Any current state will be reset. This is called either - * by a client request (dispatched) or when a new client environment - * is created. - * - */ -int XETrapReset(xXTrapReq *request, ClientPtr client) -{ - static xXTrapConfigReq DummyReq; - register int i; - register int status = Success; - XETrapEnv *penv = XETenv[client->index]; - - /* in case any i/o's pending */ - (void)XETrapStopTrap((xXTrapReq *)NULL, client); - penv->cur.hdr.type = X_Reply; - penv->cur.hdr.length = XEXTRA(xXTrapGetCurReply); - /* Fill in a dummy config request to clear all elements */ - for (i=0L; icur.data_state_flags); i++) - { - penv->cur.data_state_flags[i] = 0L; /* Clear all env flags */ - } - penv->cur.data_config_max_pkt_size = XETrap_avail.data.max_pkt_size; - - return(status); -} - -/* - * DESCRIPTION: - * - * This function sends a reply back to the requesting client indicating - * the available states of the extension can be configured for. - */ -int XETrapGetAvailable(xXTrapGetReq *request, ClientPtr client) -{ - XETrapEnv *penv = XETenv[client->index]; - update_protocol(request, client); - /* Initialize the reply as needed */ - XETrap_avail.data.xtrap_protocol = penv->protocol; - XETrap_avail.hdr.detail = XETrap_GetAvailable; - XETrap_avail.hdr.sequenceNumber = client->sequence; - WriteReplyToClient(client, sizeof(xXTrapGetAvailReply), &XETrap_avail); - return(Success); -} - -/* - * DESCRIPTION: - * - * This function sends a reply back to the requesting client indicating - * the current state of the extension. - */ -int XETrapGetCurrent(xXTrapReq *request, ClientPtr client) -{ - XETrapEnv *penv = XETenv[client->index]; - int rep_size = (penv->protocol == 31 ? 284 : sz_xXTrapGetCurReply); - penv->cur.hdr.length = (rep_size - 32L) / SIZEOF(CARD32); - - /* Initialize the reply as needed */ - penv->cur.hdr.detail = XETrap_GetCurrent; - penv->cur.hdr.sequenceNumber = client->sequence; - WriteReplyToClient(client, rep_size, &(penv->cur)); - - return(Success); -} - -/* - * DESCRIPTION: - * - * This function sends a reply back to the requesting client dumping - * statistics (counts) of requests and events. If stat's isn't - * configured, return failure. - */ -int XETrapGetStatistics(xXTrapReq *request, ClientPtr client) -{ - int status = Success; - XETrapEnv *penv = XETenv[client->index]; - - if ((BitIsTrue(penv->cur.data_config_flags_data, XETrapStatistics)) && - (penv->stats)) - { - /* Initialize the reply as needed */ - int rep_size = sizeof(xXTrapGetStatsReply); - penv->stats->detail = XETrap_GetStatistics; - penv->stats->sequenceNumber = client->sequence; - if (penv->protocol == 31) - { - xXTrapGetStatsReply rep_stats; - rep_stats = *penv->stats; -#ifndef VECTORED_EVENTS - rep_size = 1060; -#else - rep_size = 1544; -#endif - rep_stats.length = (rep_size - 32L) / SIZEOF(CARD32); - /* - * Now we need to shift the data *into* the header area - * for bug compatibility. - */ - memcpy(&(rep_stats.pad0),&(penv->stats->data), - sizeof(XETrapGetStatsRep)); - WriteReplyToClient(client, rep_size, &rep_stats); - } - else - { - WriteReplyToClient(client, rep_size, penv->stats); - } - } - else - { - status = XETrapErrorBase + BadStatistics; - } - return(status); -} - -/* - * DESCRIPTION: - * - * This function is dispatched when a client requests the extension to - * be configured in some manner. - */ -int XETrapConfig(xXTrapConfigReq *request, ClientPtr client) -{ - UByteP vflags = request->config_flags_valid; - UByteP dflags = request->config_flags_data; - UByteP req_flags = request->config_flags_req; - UByteP event_flags = request->config_flags_event; - XETrapEnv *penv = XETenv[client->index]; - UByteP bit_flags = penv->cur.data_config_flags_data; - int status = Success; - CARD32 i = 0L; - - /* Check events and swap if desired */ - if (BitIsTrue(vflags,XETrapEvent)) - { /* Loop through all of the events */ - for (i=0L; icur.data_config_flags_event,i)))) - { /* At this point we *know* there's a change. The - * only question remaining is are there any more - * clients interested in this specific event. If - * so, *don't* swap this process! - */ - if (BitIsTrue(dflags,XETrapEvent)) - { /* Client wants the XTrap rtn */ - if (++(vectored_events[i]) <= 1L) - { /* first client, so do it */ - _SwapProc(&(XETrapEventProcVector[i]), - &(EventProcVector[i])); - } - } - else - { /* Client wants the *real* rtn */ - if (--(vectored_events[i]) <= 0L) - { /* No more clients using, so do it */ - _SwapProc(&(XETrapEventProcVector[i]), - &(EventProcVector[i])); - } - } - switch(i) - { - case KeyPress: /* needed for command key processing */ - case KeyRelease: - XETrapKbdDev->processInputProc = - (void_function)(EventProcVector[i] ? - (void_function)EventProcVector[i] : - (void_function)keybd_process_inp); - XETrapKbdDev->realInputProc = - (void_function)(EventProcVector[i] ? - (void_function)EventProcVector[i] : - (void_function)keybd_process_inp); - break; -#ifndef VECTORED_EVENTS - case ButtonPress: /* hack until events become vectored */ - case ButtonRelease: - case MotionNotify: - XETrapPtrDev->processInputProc = - (void_function)EventProcVector[i]; - XETrapPtrDev->realInputProc = - (void_function)EventProcVector[i]; - break; - default: - status = BadImplementation; - break; -#endif /* !VECTORED_EVENTS */ - } - BitToggle(penv->cur.data_config_flags_event,i); - } - } - } - if ((status == Success) && - (_CheckChangeBit(vflags,dflags,bit_flags,XETrapCmd))) - { - if (BitIsTrue(dflags, XETrapCmd)) - { /* Add accelerator entry to cmd_clients list iff necessary */ - penv->cur.data_config_cmd_key = request->config_cmd_key; - status = add_accelerator_node(penv->client, &cmd_clients); - } - else - { - penv->cur.data_config_cmd_key = 0L; /* default no KeyCode */ - remove_accelerator_node(penv->client, &cmd_clients); - } - } - if ((status == Success) && - (_CheckChangeBit(vflags,dflags,bit_flags,XETrapMaxPacket))) - { - if (BitIsTrue(dflags,XETrapMaxPacket)) - { /* Set size to what's passed in */ - if (request->config_max_pkt_size < XETrapMinPktSize) - { /* Tell them the value is too small */ - status = BadValue; - } - else - { - penv->cur.data_config_max_pkt_size = - request->config_max_pkt_size; - } - } - else - { /* Set it to the default (a *very* big number) */ - penv->cur.data_config_max_pkt_size = 0xFFFF; - } - } - /* If the valid flag is set for requests, then each of the - * requests is swapped if it's different from current state. - */ - if (BitIsTrue(vflags,XETrapRequest) && status == Success) - { /* Loop through all of the core requests */ - for (i=0L; icur.data_config_flags_req,i)))) - { /* At this point we *know* there's a change. The - * only question remaining is are there any more - * clients interested in this specific request. If - * so, *don't* swap this process! - */ - if (BitIsTrue(dflags,XETrapRequest)) - { /* Client wants the XTrap rtn */ - if (++(vectored_requests[i]) <= 1L) - { /* first client, so do it */ - _SwapProc(&(XETrapProcVector[i]), (int_function *)&(ProcVector[i])); - } - } - else - { /* Client wants the *real* rtn */ - if (--(vectored_requests[i]) <= 0L) - { /* No more clients using, so do it */ - _SwapProc(&(XETrapProcVector[i]), (int_function *)&(ProcVector[i])); - } - } - if (status == Success) - { - BitToggle(penv->cur.data_config_flags_req,i); - } - } - } - } - /* Check & Set the boolean flags */ - if (status == Success) - { - _CheckChangeBit(vflags,dflags,bit_flags,XETrapCmdKeyMod); - _CheckChangeBit(vflags,dflags,bit_flags,XETrapTimestamp); - _CheckChangeBit(vflags,dflags,bit_flags,XETrapWinXY); -/* _CheckChangeBit(vflags,dflags,bit_flags,XETrapCursor); */ -#ifdef COLOR_REPLIES - _CheckChangeBit(vflags,dflags,bit_flags,XETrapColorReplies); -#endif /* COLOR_REPLIES */ - if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapGrabServer)) - { /* Let any client uncoditionally set/clear Grabs */ - ignore_grabs = BitValue(dflags, XETrapGrabServer); - } - } - /* The statistics vflag/dflag mechanism is a little different - * from most. The dflag is initially set to 0 to indicate no - * statistics. When a config request comes in to request - * statistics, memory's allocated and the dflag is set. - * Thereafter, whenever a client wants to clear the counters, he - * simply sets the vflag and clears the dflag. Multiple requests - * for statistics configuration are ignored, and the stats memory is - * free'd only when the client disconnects. - */ - if (status == Success) - { - if (_CheckChangeBit(vflags,dflags,bit_flags,XETrapStatistics)) - { - if (BitIsTrue(dflags,XETrapStatistics)) - { /* Do we need to allocate memory? */ - if (penv->stats == NULL && (penv->stats = - (xXTrapGetStatsReply *)Xcalloc(sizeof(xXTrapGetStatsReply))) - != NULL) - { /* Set up the reply header */ - penv->stats->type = X_Reply; - penv->stats->length = XEXTRA(xXTrapGetStatsReply); - /* add accelerator node for stats clients list */ - status = add_accelerator_node(penv->client, &stats_clients); - } - else if (penv->stats == NULL) - { /* No Memory! */ - status = BadAlloc; - } - } - else - { /* Zero out counters */ - (void)memset(penv->stats->data.requests, 0L, - sizeof(penv->stats->data.requests)); - (void)memset(penv->stats->data.events, 0L, - sizeof(penv->stats->data.events)); - /* Re-cock the Stat's flag so that it'll - * sense a change for next zero'ing out - * of the counters. - */ - BitTrue(penv->cur.data_config_flags_data, XETrapStatistics); - } - } - } - return(status); -} - -/* - * DESCRIPTION: - * - * This function sets the XETrapTrapActive bit to indicate that Trapping - * of requests and/or core events to the client may take place. - * - */ -int XETrapStartTrap(xXTrapReq *request, ClientPtr client) -{ - XETrapEnv *penv = XETenv[client->index]; - int status = add_accelerator_node(penv->client, &io_clients); - if (status == Success) - { - BitTrue(penv->cur.data_state_flags, XETrapTrapActive); - } - return(status); -} -/* - * DESCRIPTION: - * - * This function clears the XETrapTrapActive bit to indicate that Trapping - * of requests and/or core events to the client may *not* take place. - * - */ -int XETrapStopTrap(xXTrapReq *request, ClientPtr client) -{ - XETrapEnv *penv = XETenv[client->index]; - - remove_accelerator_node(penv->client, &io_clients); - BitFalse(penv->cur.data_state_flags, XETrapTrapActive); - return(Success); -} - -/* - * DESCRIPTION: - * - * This function sends a reply back to the requesting client indicating - * the specific XTrap version of this extension. - */ -int XETrapGetVersion(xXTrapGetReq *request, ClientPtr client) -{ - xXTrapGetVersReply ver_rep; - XETrapEnv *penv = XETenv[client->index]; - - update_protocol(request,client); /* to agree on protocol version */ - /* Initialize the reply as needed */ - ver_rep.hdr.type = X_Reply; - ver_rep.hdr.detail = XETrap_GetVersion; - ver_rep.hdr.sequenceNumber = client->sequence; - ver_rep.hdr.length = XEXTRA(xXTrapGetVersReply); - ver_rep.data.xtrap_release = XETrap_avail.data.xtrap_release; - ver_rep.data.xtrap_version = XETrap_avail.data.xtrap_version; - ver_rep.data.xtrap_revision = XETrap_avail.data.xtrap_revision; - ver_rep.data.xtrap_protocol = penv->protocol; /* return agreed protocol */ - WriteReplyToClient(client, sizeof(xXTrapGetVersReply), &ver_rep); - return(Success); -} - -/* - * DESCRIPTION: - * - * This function sends a reply back to the requesting client indicating - * the specific XTrap version of this extension. - */ -int XETrapGetLastInpTime(xXTrapReq *request, ClientPtr client) -{ - xXTrapGetLITimReply tim_rep; - XETrapEnv *penv = XETenv[client->index]; - - /* Initialize the reply as needed */ - tim_rep.hdr.type = X_Reply; - tim_rep.hdr.detail = XETrap_GetLastInpTime; - tim_rep.hdr.sequenceNumber = client->sequence; - tim_rep.hdr.length = XEXTRA(xXTrapGetLITimReply); - tim_rep.data_last_time = penv->last_input_time; - WriteReplyToClient(client, sizeof(xXTrapGetLITimReply), &tim_rep); - return(Success); -} - -/* - * DESCRIPTION: - * - * This routine is swapped in for the server's output request vectors. - * After writing the request to one (or more) XTrap client(s), this - * routine ALWAYS returns by calling the REAL output request vector rtn. - * - * Note: Swapped Requests are handled automatically since the unswapped - * vectored routine is called after the request has been swapped. - * IOW, all requests are directed through ProcVector eventually and are - * "unswapped" at that point. It is necessary to swap the data - * back if writing to a swapped client, however, and this is done - * by calling the appropriate XETSwProcVector[] routine. - */ -int XETrapRequestVector(ClientPtr client) -{ - int status = True; - XETrapDatum *pdata, *spdata = NULL; - REQUEST(xResourceReq); - WindowPtr window_ptr; - XETrapEnv *penv; - BYTE *tptr; - ClientList *ioc = &io_clients; - ClientList *stc = &stats_clients; - INT32 asize = sizeof(pdata->hdr) + stuff->length * sizeof(CARD32); - INT32 size = MAX(asize,XETrapMinPktSize); /* Must be at least */ - INT32 csize; /* size of request to send to the XTrap client */ - - /* Get memory for the data to be sent */ - if ((pdata = (XETrapDatum *)Xcalloc(size)) == NULL) - { /* Can't do anything accept set a flag since we don't - * know who to send the error to yet. - */ - status = False; - } - - while (ioc->next != NULL) - { - ioc = ioc->next; - penv = XETenv[ioc->client->index]; - if (status == False) - { /* We didn't get the memory! Complain */ - SendErrorToClient(penv->client,XETrap_avail.data.major_opcode, - stuff->reqType, 0L, BadAlloc); - break; - } - if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType)) - { /* This particular client is interested in *this* request */ - pdata->hdr.client = client->index; /* stuff client index in hdr */ - if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY)) - { - if (Success != dixLookupDrawable(&window_ptr, stuff->id, - client, 0, DixUnknownAccess)) - { /* Failed...invalidate the X and Y coordinate data. */ - pdata->hdr.win_x = -1L; - pdata->hdr.win_y = -1L; - } - else - { - pdata->hdr.screen = window_ptr->drawable.pScreen->myNum; - pdata->hdr.win_x = window_ptr->drawable.x; - pdata->hdr.win_y = window_ptr->drawable.y; - } - } - if (BitIsTrue(penv->cur.data_config_flags_data,XETrapTimestamp)) - { - pdata->hdr.timestamp = GetTimeInMillis(); - } - /* Copy the information to a location we can write it from */ - (void) memcpy(&(pdata->u.req),stuff,stuff->length*sizeof(CARD32)); - pdata->hdr.count = MIN(penv->cur.data_config_max_pkt_size,asize); - XETrapSetHeaderRequest(&(pdata->hdr)); - - /* Perform any needed byte/word swapping. NOTE: This is not - * the "normal" technique that should be used to perform the - * swapping. The reason that we do it here is to be sure to - * do it only once in a controlled manner, which we can not - * guarentee in the case of the Xlib transport. Notice that - * we don't swap the XTRAP EVENT information. This is done - * in the XETrapWriteXLib() routine. - */ - - if (penv->client->swapped) - { /* need to deal with swapped clients */ - if (spdata == NULL) - { /* Get memory for the swapped data to be sent */ - if ((spdata = (XETrapDatum *)Xcalloc(size)) == NULL) - { - SendErrorToClient(penv->client, - XETrap_avail.data.major_opcode, - stuff->reqType, 0L, BadAlloc); - break; - } - - memcpy(spdata,pdata,size); /* fill in the info */ - /* Now call the request-specific rtn to swap the request */ - if (stuff->reqType < 128) - { /* a core request, good */ - (*XETSwProcVector[stuff->reqType])(&(spdata->u.req), - penv->client); /* RTC X11R6 */ - } - else if (penv->cur.data_config_max_pkt_size == - XETrapMinPktSize) - { /* Minimum size, so swap it as an ResourceReq */ - XETSwResourceReq(&(spdata->u.req)); - } - else - { /* trying to swap an extension request! */ - SendErrorToClient(penv->client, - XETrap_avail.data.major_opcode, - stuff->reqType, 0L, XETrapErrorBase + BadSwapReq); - } - } - /* need to stow in the latest header (count) */ - memcpy(spdata,pdata,SIZEOF(XETrapHeader)); - sXETrapHeader(&(spdata->hdr)); /* swap the XTrap Header */ - } - /* Write as many bytes of information as the client wants */ - tptr = (BYTE *)(penv->client->swapped ? spdata : pdata); - csize = MAX(pdata->hdr.count, XETrapMinPktSize); - if (XETrapWriteXLib(penv, tptr, csize) != csize) - { - SendErrorToClient(penv->client,XETrap_avail.data.major_opcode, - stuff->reqType, 0L, XETrapErrorBase + BadIO); - } -#ifdef COLOR_REPLIES - /* Process Color Replies, if desired, and applicable */ - if (BitIsTrue(penv->cur.data_config_flags_data,XETrapColorReplies)) - { /* wants color replies */ - switch(stuff->reqType) - { - case X_AllocColor: - GetSendColorRep(client, stuff); - break; - case X_AllocNamedColor: - GetSendNamedColorRep(client, stuff); - break; - case X_AllocColorCells: - GetSendColorCellsRep(client, stuff); - break; - case X_AllocColorPlanes: - GetSendColorPlanesRep(client, stuff); - break; - default: - break; - } - } -#endif /* COLOR_REPLIES */ - } - } - while (stc->next != NULL) - { /* increment appropriate stats bucket for each interested client */ - stc = stc->next; - penv = XETenv[stc->client->index]; - if (BitIsTrue(penv->cur.data_config_flags_req,stuff->reqType)) - { /* This particular client would like this particular stat */ - penv->stats->data.requests[stuff->reqType]++; - } - } - - if (pdata) - { - Xfree(pdata); - } - if (spdata) - { - Xfree(spdata); - } - if (ignore_grabs == True && - (stuff->reqType == X_GrabServer || stuff->reqType == X_UngrabServer)) - { /* doesn't want Grab's! Note: this is a "last configured" setting */ -#ifndef NO_NEW_XTRAP - int status; - - if (stuff->reqType == X_GrabServer) - { - ClientList *pclient; - - /* first call grab server procedure */ - status = (*XETrapProcVector[stuff->reqType])(client); - - /* then add XTrap controlling clients */ - for (pclient = &io_clients; pclient; pclient = pclient->next) - if (pclient->client) - MakeClientGrabImpervious(pclient->client); - } - else - { - ClientList *pclient; - - /* first drop XTrap controlling clients */ - for (pclient = &io_clients; pclient; pclient = pclient->next) - if (pclient->client) - MakeClientGrabPervious(pclient->client); - - /* then call ungrab server procedure */ - status = (*XETrapProcVector[stuff->reqType])(client); - } - return status; -#else /* NO_NEW_XTRAP */ - return(Success); -#endif /* NO_NEW_XTRAP */ - } - else - { - return((*XETrapProcVector[stuff->reqType])(client)); - } -} -/* - * - * DESCRIPTION: - * - * This routine intercepts input xEvents from the keyboard. - * if XETrapTrapActive, will write record to client(s) - * and then pass the event to the server iff not command - * key and gate is open. If it's a command key, then twiddle - * the gate state as required (optional, see below). - * - * This routine implements an optional user specified command key - * that can be used to close the input pipe into the server - * while a client command is generated. The keypress of the - * command key places this routine in command mode, the keyrelease - * exits command mode. - * - * A keypress of the command key followed by the - * optionally specified lock key will place this routine in continuous - * command mode until the command key and lock key are pressed again - * to exit command mode. In the locked state, the client interprets - * keystrokes as it wishes, as commands or as input to a prior command. - * - * Both mechanisms can be used alternately. - * - * IMPLICIT INPUTS : - * - * penv->cur.data_config_cmd_key : - * This is the keycode of the key that is used to stop - * and restart the transmission of intercepted input - * events to the server. If specified, the gate_state - * flag will be set or cleared depending on the state of - * the command_key. - * - * penv->cur.data_config_flags_data.XETrapCmdKeyMod: - * This is the value of the mode in which the command_key - * will operate. It currently has two values: MODIFIER and - * COMMAND_LOCK. MODIFIER mode clears gate_state on - * keypress, and sets gate_state on keyrelease. - * COMMAND_LOCK mode toggles gate_state on - * or off. - * - * gate_closed: - * A flag that is set/cleared in the xtrap_keyboard - * routine that indicates whether intercepted input - * should be passed to the server at any particular - * instance. - * - * - * next_key: - * This variable tracks the state of the next key to be - * pressed or released. It allows the checking of double - * presses of the command key to be sent to the server and - * keeps good state order when the command key is used. - * - * key_ignore: - * This variable indicates whether or not the specific - * key should be ignored for subsequent server processing. - * - */ -int XETrapKeyboard(xEvent *x_event, DevicePtr keybd, int count) -{ - register BYTE type = x_event->u.u.type; - register BYTE detail = x_event->u.u.detail; - XETrapEnv *penv; - ClientList *stc = &stats_clients; - ClientList *cmc = &cmd_clients; - int_function cur_func = XETrapKeyboard; - -#ifdef VERBOSE - if (count != 1L) - { /* We haven't coded for this situation yet! */ - ErrorF("Warning! Event count != 1 (%d)\n", count); - } -#endif - while (stc->next != NULL) - { /* increment appropriate stats bucket for each interested client */ - stc = stc->next; - penv = XETenv[stc->client->index]; - if (BitIsTrue(penv->cur.data_config_flags_event,type)) - { /* This particular client would like this particular stat */ - penv->stats->data.events[type]++; - } - } -#ifndef VECTORED_EVENTS - /* We *only* StampAndMail command keys with vectored events since - * we get much more data by waiting till we get called in XETrapEventVector - */ - XETrapStampAndMail(x_event); /* send to XTrap client if necessry */ -#endif - while (cmc->next != NULL) - { - cmc = cmc->next; - penv = XETenv[cmc->client->index]; - key_ignore = False; - if (detail == penv->cur.data_config_cmd_key) - { - if (BitIsTrue(penv->cur.data_config_flags_data, XETrapCmdKeyMod)) - { - switch (type) - { - case KeyPress: - if (next_key == XEKeyIsEcho) - { - break; - } - gate_closed = True; - next_key = XEKeyIsClear; - break; - - case KeyRelease: - if (next_key == XEKeyIsEcho) - { - next_key = XEKeyIsClear; - break; - } - if (next_key == XEKeyIsClear) - { - next_key = XEKeyIsEcho; - } - else - { /* it's Other, so Clear it */ - next_key = XEKeyIsClear; - } - gate_closed = False; - key_ignore = True; - break; - - default: break; - } - } - else - { - switch (type) - { - case KeyPress: - if (next_key == XEKeyIsEcho) - { - gate_closed = False; - break; - } - /* Open gate on cmd key release */ - if ((next_key == XEKeyIsOther) && - gate_closed == True) - { - break; - } - gate_closed = True; - next_key = XEKeyIsClear; - break; - - case KeyRelease: - if (next_key == XEKeyIsClear) - { - next_key = XEKeyIsEcho; - break; - } - - if (next_key == XEKeyIsEcho) - { - next_key = XEKeyIsClear; - break; - } - - gate_closed = False; - key_ignore = True; - next_key = XEKeyIsClear; - break; - - default: - break; - } - } - } - else - { - next_key = XEKeyIsOther; - } - } - - /* - * If the gate to the server is open, - * and we are not ignoring a keyrelease, - * pass the event to the server for normal processing. - */ -#ifndef VECTORED_EVENTS - if ((gate_closed == False) && (key_ignore == False)) - { - if (XETrapEventProcVector[type] != cur_func) - { /* to protect us from infinite loops */ - (void)(*XETrapEventProcVector[type])(x_event,keybd,count); - } - else - { - (void)(*EventProcVector[type])(x_event,keybd,count); - } - } -#else /* VECTORED_EVENTS */ - if ((gate_closed == False) && (key_ignore == False)) - { /* send event on to server to be trapped again in XETrapEventVector */ - (void)(*keybd_process_inp)(x_event,keybd,count); - } - else - { - XETrapStampAndMail(x_event); /* send to XTrap client if necessry */ - } -#endif - key_ignore = False; /* reset for next time around */ - return 0; -} - -/* - * DESCRIPTION: - * - * This routine intercepts input xEvents from the pointer device - * and passes the input event back to the server for normal processing. - * - * This routine is sensitive to whether input is being passed - * up to the server or not. This state is set by the keyboard - * input routine. - * - * - */ -#ifndef VECTORED_EVENTS -int XETrapPointer(xEvent *x_event, DevicePtr ptrdev, int count) -{ - XETrapEnv *penv; - ClientList *stc = &stats_clients; - int_function cur_func = XETrapPointer; - -#ifdef VERBOSE - if (count != 1L) - { /* We haven't coded for this situation yet! */ - ErrorF("Warning! Event count != 1 (%d)\n", count); - } -#endif - while (stc->next != NULL) - { /* increment appropriate stats bucket for each interested client */ - stc = stc->next; - penv = XETenv[stc->client->index]; - if (BitIsTrue(penv->cur.data_config_flags_event,x_event->u.u.type)) - { /* This particular client would like this particular stat */ - penv->stats->data.events[x_event->u.u.type]++; - } - } - XETrapStampAndMail(x_event); /* send to XTrap client if necessry */ - /* - * If the gate to the server is open, - * pass the event up like nothing has happened. - */ - if (gate_closed == False) - { - if (XETrapEventProcVector[x_event->u.u.type] != cur_func) - { /* to protect us from infinite loops */ - (void)(*XETrapEventProcVector[x_event->u.u.type])(x_event,ptrdev, - count); - } - else - { - (void)(*EventProcVector[x_event->u.u.type])(x_event,ptrdev,count); - } - } - return 0; -} -#endif /* !VECTORED_EVENTS */ - - -/* - * DESCRIPTION: - * - * This routine determines whether it needs to send event data - * to the XTrap Client(s). If so, it timestamps it appropriately - * and writes out both the header and detail information. - * - */ -void XETrapStampAndMail(xEvent *x_event) -{ - XETrapDatum data; - register CARD32 size; - XETrapEnv *penv; - ClientList *ioc = &io_clients; - - /* Currently, we're intercepting core events *before* most - * of the event information's filled in. Specifically, the - * only fields that are valid at this level are: type, detail, - * time, rootX, rootY, and state. - */ - /* Loop through all clients wishing I/O */ - while (ioc->next != NULL) - { - ioc = ioc->next; - penv = XETenv[ioc->client->index]; - /* Do we have a valid fd? Do we care about this event? */ - if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type)) - { - XETrapSetHeaderEvent(&(data.hdr)); - data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */ - data.hdr.screen = 0L; /* not till Events are vectored! */ - data.hdr.client = 0L; /* not till Events are vectored! */ - if (BitIsTrue(penv->cur.data_config_flags_data, - XETrapTimestamp)) - { - data.hdr.timestamp = GetTimeInMillis(); - } - size = data.hdr.count = XETrapMinPktSize; /* Always for evts */ - penv->last_input_time = x_event->u.keyButtonPointer.time; - /* Copy the event information into our local memory */ - (void)memcpy(&(data.u.event),x_event,sizeof(xEvent)); - -#ifdef PANORAMIX - if (!noPanoramiXExtension && - (data.u.event.u.u.type == MotionNotify || - data.u.event.u.u.type == ButtonPress || - data.u.event.u.u.type == ButtonRelease || - data.u.event.u.u.type == KeyPress || - data.u.event.u.u.type == KeyRelease)) { - int scr = XineramaGetCursorScreen(inputInfo.pointer); - data.u.event.u.keyButtonPointer.rootX += - panoramiXdataPtr[scr].x - panoramiXdataPtr[0].x; - data.u.event.u.keyButtonPointer.rootY += - panoramiXdataPtr[scr].y - panoramiXdataPtr[0].y; - } -#endif - - if (penv->client->swapped) - { /* - * Notice that we don't swap the XTRAP EVENT information. - * This is done in the XETrapWriteXLib() routine. - */ - xEvent ToEvent; - (*EventSwapVector[data.u.event.u.u.type & 0177]) - (&data.u.event,&ToEvent); - (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent)); - sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */ - } - /* From this point on, the contents of data is swapped and - * therefore we should not refer to it for information. - */ - if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size) - { - SendErrorToClient(penv->client, - XETrap_avail.data.major_opcode, - x_event->u.u.type, 0L, XETrapErrorBase + BadIO); - } - } - } - return; -} -#ifdef VECTORED_EVENTS -int XETrapEventVector(ClientPtr client, xEvent *x_event) -{ - XETrapDatum data; - register CARD32 size; - XETrapEnv *penv; - ClientList *ioc = &io_clients; - - /* Loop through all clients wishing I/O */ - while (ioc->next != NULL) - { - ioc = ioc->next; - penv = XETenv[ioc->client->index]; - /* Do we care about this event? */ - if (BitIsTrue(penv->cur.data_config_flags_event, x_event->u.u.type)) - { - XETrapSetHeaderEvent(&(data.hdr)); - data.hdr.client = client->index; - data.hdr.win_x = data.hdr.win_y = -1L; /* Invalidate req draw */ - if ((current_screen < 0L) || ((x_event->u.u.type >= KeyPress) && - (x_event->u.u.type <= MotionNotify) && - (!x_event->u.keyButtonPointer.sameScreen))) - { /* we've moved/warped to another screen */ - /* XXX: we're getting the client's pointer root window. - * is this correct? Should it be the client's keyboard? */ - WindowPtr root_win = GetCurrentRootWindow(PickPointer(client)); - current_screen = root_win->drawable.pScreen->myNum; - } - data.hdr.screen = current_screen; - if (BitIsTrue(penv->cur.data_config_flags_data, - XETrapTimestamp)) - { - data.hdr.timestamp = GetTimeInMillis(); - } - size = data.hdr.count = XETrapMinPktSize; /* Always for evts */ - penv->last_input_time = x_event->u.keyButtonPointer.time; - /* Copy the event information into our local memory */ - (void)memcpy(&(data.u.event),x_event,sizeof(xEvent)); - - if (penv->client->swapped) - { - xEvent ToEvent; - (*EventSwapVector[data.u.event.u.u.type & 0177]) - (&data.u.event,&ToEvent); - (void)memcpy(&(data.u.event),&ToEvent,sizeof(ToEvent)); - sXETrapHeader(&(data.hdr)); /* swap the XTrap Header */ - } - /* From this point on, the contents of pdata is swapped and - * therefore we should not refer to it for information. - */ - if (XETrapWriteXLib(penv, (BYTE *)&data, size) != size) - { - SendErrorToClient(penv->client, - XETrap_avail.data.major_opcode, - x_event->u.u.type, 0L, XETrapErrorBase + BadIO); - } - } - } - return; -} -#endif /* VECTORED_EVENTS */ -void sReplyXTrapDispatch(ClientPtr client, int size, char *reply) -{ - register XETrapRepHdr *rep = (XETrapRepHdr *)reply; - - switch(rep->detail) - { - case XETrap_GetAvailable: - { - xXTrapGetAvailReply lrep; - (void)memcpy((char *)&lrep,reply,sizeof(lrep)); - sReplyXETrapGetAvail(client,size,(char *)&lrep); - } - break; - case XETrap_GetCurrent: - { - xXTrapGetCurReply lrep; - (void)memcpy((char *)&lrep,reply,sizeof(lrep)); - sReplyXETrapGetCur(client,size,(char *)&lrep); - } - break; - case XETrap_GetStatistics: - { - xXTrapGetStatsReply lrep; - (void)memcpy((char *)&lrep,reply,sizeof(lrep)); - sReplyXETrapGetStats(client,size,(char *)&lrep); - } - break; - case XETrap_GetVersion: - { - xXTrapGetVersReply lrep; - (void)memcpy((char *)&lrep,reply,sizeof(lrep)); - sReplyXETrapGetVers(client,size,(char *)&lrep); - } - break; - case XETrap_GetLastInpTime: - { - xXTrapGetLITimReply lrep; - (void)memcpy((char *)&lrep,reply,sizeof(lrep)); - sReplyXETrapGetLITim(client,size,(char *)&lrep); - } - break; - default: - SendErrorToClient(client,XETrap_avail.data.major_opcode, - rep->detail, 0L, BadImplementation); - break; - } - return; -} - -/* - * XLib communications routines - */ - -/* - * DESCRIPTION: - * - * This function performs the transport specific functions required - * for writing data back to an XTrap client over XLib. The trick is - * packaging the data into <=32 byte packets to conform to the sizeof - * an X Event. nbytes must be at least equal to XETrapMinPktSize - * - */ -int XETrapWriteXLib(XETrapEnv *penv, BYTE *data, CARD32 nbytes) -{ - CARD32 size, total = 0L; - xETrapDataEvent event; - - /* Initialize the detail field to show the beginning of a datum */ - event.detail = XETrapDataStart; - event.idx = 0L; - - /* This loop could be optimized by not calling Write until after all - * of the events are packaged. However, this would require memory - * games, and may not therefore be a win. - */ - while (nbytes > 0L) - { /* How many bytes can we send in this packet */ - size = (nbytes > sz_EventData) ? sz_EventData : nbytes; - - /* Initialize the event */ - event.type = XETrapData + XETrap_avail.data.event_base; - event.sequenceNumber = penv->client->sequence; - - /* Copy the data we are sending */ - (void)memcpy(event.data,data,size); - if (size < sz_EventData) - (void)memset(event.data+size,0L,sz_EventData-size); - data += size; - nbytes -= size; - total += size; - - /* Set the detail field to show the continuation of datum */ - if (total != size) - { /* this is not the first one */ - event.detail = (nbytes > 0) ? XETrapDataContinued : XETrapDataLast; - } - - /* Send this part to the client */ - WriteEventsToClient(penv->client, 1L, (xEvent *) &event); - event.idx++; /* Bump the index for the next event */ - } - return(total); -} - -/*----------------------------* - * Static Functions - *----------------------------*/ - -static void update_protocol(xXTrapGetReq *reqptr, ClientPtr client) -{ - XETrapEnv *penv = XETenv[client->index]; - /* update protocol number */ - switch (reqptr->protocol) - { - /* known acceptable protocols */ - case 31: - case XETrapProtocol: - penv->protocol = reqptr->protocol; - break; - /* all else */ - default: /* stay backwards compatible */ - penv->protocol = 31; - break; - } -} - -/* Swap 2 functions. This is a function instead of a macro to help to keep - * lint from complaining about mixed types. It seems to work, but I would - * probably classify this as a hack. - */ -static void _SwapProc( register int (**f1)(void), register int (**f2)(void)) -{ - register int (*t1)(void) = *f1; - *f1 = *f2; - *f2 = t1; - - return; -} - -/* - * DESCRIPTION: - * - * This function swaps the byte order of fields within - * the XTrap Event Header. It assumes the data will be - * swapped by code in XETrapRequestVector(). - * - */ -static void sXETrapEvent(xETrapDataEvent *from, xETrapDataEvent *to) -{ - to->type = from->type; - to->detail = from->detail; - cpswaps(from->sequenceNumber,to->sequenceNumber); - cpswapl(from->idx,to->idx); - /* Assumes that the data's already been swapped by XETrapRequestVector */ - memcpy(to->data, from->data, SIZEOF(EventData)); -} - -/* - * DESCRIPTION: - * - * This function adds a node from an accelerator linked-list - * (either io_clients, stats_clients, or cmd_clients). - * - */ -static int add_accelerator_node(ClientPtr client, ClientList *accel) -{ - Bool found = False; - int status = Success; - - while (accel->next != NULL) - { - if (accel->client == client) - { - found = True; /* Client's already known */ - break; - } - else - { - accel = accel->next; - } - } - if (found == False) - { - if ((accel->next = (ClientList *)Xcalloc(sizeof(ClientList))) == NULL) - { - status = BadAlloc; - } - else - { /* fill in the node */ - accel = accel->next; - accel->next = NULL; - accel->client = client; - } - } - return(status); -} -/* - * DESCRIPTION: - * - * This function removes a node from an accelerator linked-list - * (either io_clients, stats_clients, or cmd_clients). - * - */ -static void remove_accelerator_node(ClientPtr client, ClientList *accel) -{ - while (accel->next != NULL) - { - if (accel->next->client == client) - { - ClientList *tmp = accel->next->next; - Xfree(accel->next); - accel->next = tmp; - break; - } - else - { - accel = accel->next; - } - } - - return; -} - -#ifdef COLOR_REPLIES -static void GetSendColorRep(ClientPtr client, xResourceReq *req) -{ /* adapted from ProcAllocColor() in dispatch.c */ - XETrapDatum data; - int retval; - XETrapEnv *penv = XETenv[client->index]; - xAllocColorReply *crep = (xAllocColorReply *)&(data.u.reply); - xAllocColorReq *creq = (xAllocColorReq *)req; - ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP); - - /* Fill in the header fields */ - data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */ - XETrapSetHeaderReply(&(data.hdr)); - /* Hack alert: - * We need to pass the "reply" type in the header since replies don't - * contain the id's themselves. However, we're not changing the - * protocol to support this until we decide exactly how we want to - * do *all* replies (e.g. not just ColorReplies). So until then, stow - * the reply id in the screen field which wouldn't normally be used in - * this context. - */ - data.hdr.screen = req->reqType; - if (!pmap) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadColor); - return; - } - crep->red = creq->red; - crep->green = creq->green; - crep->blue = creq->blue; - crep->pixel = 0; - if ((retval = AllocColor(pmap, &(crep->red), &(crep->green), - &(crep->blue), &(crep->pixel), client->index)) != Success) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, retval); - return; - } - /* Swap data if necessary */ - if (client->swapped) - { - INT32 n; - swaps(&(crep->red), n); - swaps(&(crep->green), n); - swaps(&(crep->blue), n); - swapl(&(crep->pixel), n); - } - /* Send data to client */ - if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize) - != XETrapMinPktSize) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, XETrapErrorBase + BadIO); - } -} - -static void GetSendNamedColorRep(ClientPtr client, xResourceReq *req) -{ /* adapted from ProcAllocNamedColor() in dispatch.c */ - XETrapDatum data; - XETrapEnv *penv = XETenv[client->index]; - int retval; - xAllocNamedColorReply *nrep = (xAllocNamedColorReply *)&(data.u.reply); - xAllocNamedColorReq *nreq = (xAllocNamedColorReq *)req; - ColormapPtr pcmp = (ColormapPtr )LookupIDByType(nreq->cmap, RT_COLORMAP); - - data.hdr.count = XETrapMinPktSize; /* The color replies are 32 bytes */ - XETrapSetHeaderReply(&(data.hdr)); - /* Hack alert: - * We need to pass the "reply" type in the header since replies don't - * contain the id's themselves. However, we're not changing the - * protocol to support this until we decide exactly how we want to - * do *all* replies (e.g. not just ColorReplies). So until then, stow - * the reply id in the screen field which wouldn't normally be used in - * this context. - */ - data.hdr.screen = req->reqType; - if (!pcmp) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadColor); - return; - } - if (!OsLookupColor(pcmp->pScreen->myNum, (char *)&nreq[1], - nreq->nbytes, &(nrep->exactRed), &(nrep->exactGreen), - &(nrep->exactBlue))) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadName); - return; - } - nrep->screenRed = nrep->exactRed; - nrep->screenGreen = nrep->exactGreen; - nrep->screenBlue = nrep->exactBlue; - nrep->pixel = 0; - if ((retval = AllocColor(pcmp, &(nrep->screenRed), - &(nrep->screenGreen), &(nrep->screenBlue), &(nrep->pixel), - client->index)) != Success) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, retval); - return; - } - /* Swap data if necessary */ - if (client->swapped) - { - INT32 n; - swapl(&(nrep->pixel), n); - swaps(&(nrep->exactRed), n); - swaps(&(nrep->exactGreen), n); - swaps(&(nrep->exactBlue), n); - swaps(&(nrep->screenRed), n); - swaps(&(nrep->screenGreen), n); - swaps(&(nrep->screenBlue), n); - } - - /* Send data to client */ - if (XETrapWriteXLib(penv, (BYTE *)&data, XETrapMinPktSize) - != XETrapMinPktSize) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, XETrapErrorBase + BadIO); - } -} - -static void GetSendColorCellsRep(ClientPtr client, xResourceReq *req) -{ /* adapted from ProcAllocColorCells() in dispatch.c */ - int retval; - int npixels, nmasks; - unsigned long *ppixels, *pmasks; - long length; - XETrapDatum *data; - XETrapEnv *penv = XETenv[client->index]; - xAllocColorCellsReply *crep; - xAllocColorCellsReq *creq = (xAllocColorCellsReq *)req; - ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP); - - if (!pmap) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadColor); - return; - } - npixels = creq->colors; - if (!npixels) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadValue); - return; - } - nmasks = creq->planes; - length = ((long)npixels + (long)nmasks) * sizeof(Pixel); - data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length); - if (!data) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadAlloc); - return; - } - data->hdr.count = MIN(penv->cur.data_config_max_pkt_size, - sizeof(XETrapDatum)+length); - XETrapSetHeaderReply(&(data->hdr)); - data->hdr.screen = req->reqType; /* hack! but necessary */ - ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum)); - pmasks = ppixels + npixels; - if ((retval = AllocColorCells(client->index, pmap, npixels, - nmasks, (Bool)creq->contiguous, ppixels, pmasks)) != Success) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, retval); - xfree(data); - return; - } - crep = (xAllocColorCellsReply *)&(data->u.reply); - crep->nPixels = npixels; - crep->nMasks = nmasks; - /* Swap data if necessary */ - if (client->swapped) - { - INT32 n, i, *ptr; - ptr=(INT32 *)ppixels; - swaps(&(crep->nPixels), n); - swaps(&(crep->nMasks), n); - for (i=0; ihdr.count) - != data->hdr.count) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, XETrapErrorBase + BadIO); - } - xfree(data); -} -static void GetSendColorPlanesRep(ClientPtr client, xResourceReq *req) -{ /* adapted from ProcAllocColorPlanes() in dispatch.c */ - int retval; - int npixels, nmasks; - unsigned long *ppixels, *pmasks; - long length; - XETrapDatum *data; - XETrapEnv *penv = XETenv[client->index]; - xAllocColorPlanesReply *crep; - xAllocColorPlanesReq *creq = (xAllocColorPlanesReq *)req; - ColormapPtr pmap = (ColormapPtr )LookupIDByType(creq->cmap, RT_COLORMAP); - - if (!pmap) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadColor); - return; - } - npixels = creq->colors; - if (!npixels) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadValue); - return; - } - length = (long)npixels * sizeof(Pixel); - data = (XETrapDatum *)xalloc(sizeof(XETrapDatum)+length); - if (!data) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, BadAlloc); - return; - } - data->hdr.count = MIN(penv->cur.data_config_max_pkt_size, - sizeof(XETrapDatum)+length); - XETrapSetHeaderReply(&(data->hdr)); - data->hdr.screen = req->reqType; /* hack! but necessary */ - ppixels = (unsigned long *)((char *)data + sizeof(XETrapDatum)); - crep = (xAllocColorPlanesReply *)&(data->u.reply); - if ((retval = AllocColorPlanes(client->index, pmap, npixels, - (int)creq->red, (int)creq->green, (int)creq->blue, - (int)creq->contiguous, ppixels, &(crep->redMask), &(crep->greenMask), - &(crep->blueMask))) != Success) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, retval); - xfree(data); - return; - } - crep->nPixels = npixels; - /* Swap data if necessary */ - if (client->swapped) - { - INT32 n, i, *ptr; - ptr=(INT32 *)ppixels; - swaps(&(crep->nPixels), n); - swapl(&(crep->redMask), n); - swapl(&(crep->greenMask), n); - swapl(&(crep->blueMask), n); - for (i=0; ihdr.count) - != data->hdr.count) - { - SendErrorToClient(penv->client, XETrap_avail.data.major_opcode, - req->reqType, 0L, XETrapErrorBase + BadIO); - } - xfree(data); -} -#endif /* COLOR_REPLIES */ diff --git a/XTrap/xtrapdiswp.c b/XTrap/xtrapdiswp.c deleted file mode 100644 index 86c240362..000000000 --- a/XTrap/xtrapdiswp.c +++ /dev/null @@ -1,937 +0,0 @@ -/**************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991, 1992 by - - Digital Equipment Corp., Maynard, MA - -X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. - -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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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. - -*****************************************************************************/ -/* - * ABSTRACT: - * - * This module is the device independent module responsible for all - * routines required for proper communication in a heterogeneous - * networking environment (i.e. client & server on different endian - * machines). The bulk of this module is patterned after X11/R4's - * server/dix/swapreq.c ; however, they infact swap fields - * in the exact opposite order since XTrap requires "unswapped" data - * to become "swapped" before sending it to a "swapped" client. - * - * CONTRIBUTORS: - * - * Ken Miller - * Marc Evans - * - * CHANGES: - * - * Robert Chesler - added client arg for X11R6 port in many spots - * - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#define NEED_REPLIES -#define NEED_EVENTS -#include -#include -#include -#include "input.h" /* Server DevicePtr definitions */ -#include "misc.h" -#include "dixstruct.h" -#ifdef PC -# include "extnsist.h" -#else -# include "extnsionst.h" /* Server ExtensionEntry definitions */ -#endif -# include "swapreq.h" /* Server SwapColorItem definition */ -#include -#include - -/* In-coming XTrap requests needing to be swapped to native format */ - -int sXETrapReset(xXTrapReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - return(XETrapReset(request,client)); -} - -int sXETrapGetAvailable(xXTrapGetReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - swaps(&(request->protocol),n); - return(XETrapGetAvailable(request,client)); -} - -int sXETrapConfig(xXTrapConfigReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - swaps(&(request->config_max_pkt_size),n); - return(XETrapConfig(request,client)); -} - -int sXETrapStartTrap(xXTrapReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - return(XETrapStartTrap(request,client)); -} - -int sXETrapStopTrap(xXTrapReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - return(XETrapStopTrap(request,client)); -} - -int sXETrapGetCurrent(xXTrapReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - return(XETrapGetCurrent(request,client)); -} - -int sXETrapGetStatistics(xXTrapReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - return(XETrapGetStatistics(request,client)); -} - -#ifndef _XINPUT -int sXETrapSimulateXEvent(xXTrapInputReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->input.x),n); - swaps(&(request->input.y),n); - return(XETrapSimulateXEvent(request,client)); -} -#endif - -int sXETrapGetVersion(xXTrapGetReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - swaps(&(request->protocol),n); - return(XETrapGetVersion(request,client)); -} - -int sXETrapGetLastInpTime(xXTrapReq *request, ClientPtr client) -{ - register char n; - swaps(&(request->length),n); - return(XETrapGetLastInpTime(request,client)); -} - - -/* Out-going XTrap replies needing to be swapped *from* native format */ - -void sReplyXETrapGetAvail(ClientPtr client, int size, char *reply) -{ - xXTrapGetAvailReply *rep = (xXTrapGetAvailReply *)reply; - register char n; - swaps(&(rep->hdr.sequenceNumber),n); - swapl(&(rep->hdr.length),n); - swapl(&(rep->data.pf_ident),n); - swaps(&(rep->data.xtrap_release),n); - swaps(&(rep->data.xtrap_version),n); - swaps(&(rep->data.xtrap_revision),n); - swaps(&(rep->data.max_pkt_size),n); - swapl(&(rep->data.major_opcode),n); - swapl(&(rep->data.event_base),n); - swaps(&(rep->data.cur_x),n); - swaps(&(rep->data.cur_y),n); - (void)WriteToClient(client,size,reply); - return; -} -void sReplyXETrapGetVers(ClientPtr client, int size, char *reply) -{ - xXTrapGetVersReply *rep = (xXTrapGetVersReply *)reply; - register char n; - swaps(&(rep->hdr.sequenceNumber),n); - swapl(&(rep->hdr.length),n); - swaps(&(rep->data.xtrap_release),n); - swaps(&(rep->data.xtrap_version),n); - swaps(&(rep->data.xtrap_revision),n); - (void)WriteToClient(client,size,reply); - return; -} -void sReplyXETrapGetLITim(ClientPtr client, int size, char *reply) -{ - xXTrapGetLITimReply *rep = (xXTrapGetLITimReply *)reply; - register char n; - swaps(&(rep->hdr.sequenceNumber),n); - swapl(&(rep->hdr.length),n); - swapl(&(rep->data_last_time),n); - (void)WriteToClient(client,size,reply); - return; -} -void sReplyXETrapGetCur(ClientPtr client, int size, char *reply) -{ - xXTrapGetCurReply *rep = (xXTrapGetCurReply *)reply; - register char n; - swaps(&(rep->hdr.sequenceNumber),n); - swapl(&(rep->hdr.length),n); - swaps(&(rep->data_config_max_pkt_size),n); - (void)WriteToClient(client,size,reply); - return; -} -void sReplyXETrapGetStats(ClientPtr client, int size, char *reply) -{ - xXTrapGetStatsReply *rep = (xXTrapGetStatsReply *)reply; - register char n; - register int i; - long *p; - - swaps(&(rep->sequenceNumber),n); - swapl(&(rep->length),n); - for (i=0L, p = (long *)rep->data.requests; i<256L; i++, p++) - { - swapl(p,n); - } - for (i=0L, p = (long *)rep->data.events; icount), n); - swapl(&(hdr->timestamp), n); - swaps(&(hdr->win_x), n); - swaps(&(hdr->win_y), n); - swaps(&(hdr->client), n); -} - - /* Out-going requests needing to be swapped *from* native format - * aka swapreq.c "equivalents" - */ - -/* The following is used for all requests that have - no fields to be swapped (except "length") */ -void XETSwSimpleReq(register xReq *data) -{ - register char n; - swaps(&(data->length), n); -} - -/* The following is used for all requests that have - only a single 32-bit field to be swapped, coming - right after the "length" field */ - -void XETSwResourceReq(register xResourceReq *data) -{ - register char n; - - swaps(&(data->length), n); - swapl(&(data->id), n); -} - -void XETSwCreateWindow(register xCreateWindowReq *data,ClientPtr client) -{ - register char n; - - swapl(&(data->wid), n); - swapl(&(data->parent), n); - swaps(&(data->x), n); - swaps(&(data->y), n); - swaps(&(data->width), n); - swaps(&(data->height), n); - swaps(&(data->borderWidth), n); - swaps(&(data->class), n); - swapl(&(data->visual), n); - swapl(&(data->mask), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -void XETSwChangeWindowAttributes(register xChangeWindowAttributesReq *data, -ClientPtr client) -{ - register char n; - - swapl(&(data->window), n); - swapl(&(data->valueMask), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -void XETSwReparentWindow(register xReparentWindowReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swapl(&(data->parent), n); - swaps(&(data->x), n); - swaps(&(data->y), n); -} - -void XETSwConfigureWindow(xConfigureWindowReq *data, ClientPtr client) -{ - register char n; - swapl(&(data->window), n); - swaps(&(data->mask), n); - SwapRestL(data); - swaps(&(data->length), n); -} - - -void XETSwInternAtom(register xInternAtomReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->nbytes), n); -} - -void XETSwChangeProperty(register xChangePropertyReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swapl(&(data->property), n); - swapl(&(data->type), n); - switch ( data->format ) { - case 8L : break; - case 16L: - SwapShorts((short *)(data + 1), data->nUnits); - break; - case 32L: - SwapLongs((CARD32 *)(data + 1), data->nUnits); - break; - } - swapl(&(data->nUnits), n); -} - -void XETSwDeleteProperty(register xDeletePropertyReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swapl(&(data->property), n); - -} -void XETSwGetProperty(register xGetPropertyReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swapl(&(data->property), n); - swapl(&(data->type), n); - swapl(&(data->longOffset), n); - swapl(&(data->longLength), n); -} - -void XETSwSetSelectionOwner(register xSetSelectionOwnerReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swapl(&(data->selection), n); - swapl(&(data->time), n); -} - -void XETSwConvertSelection(register xConvertSelectionReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->requestor), n); - swapl(&(data->selection), n); - swapl(&(data->target), n); - swapl(&(data->property), n); - swapl(&(data->time), n); -} - -void XETSwSendEvent(register xSendEventReq *data) -{ - register char n; - xEvent eventT; - EventSwapPtr proc; - swapl(&(data->destination), n); - swapl(&(data->eventMask), n); - - /* Swap event */ - proc = EventSwapVector[data->event.u.u.type & 0177]; - if (!proc || proc == NotImplemented) - (*proc)(&(data->event), &eventT); - data->event = eventT; - swaps(&(data->length), n); -} - -void XETSwGrabPointer(register xGrabPointerReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->grabWindow), n); - swaps(&(data->eventMask), n); - swapl(&(data->confineTo), n); - swapl(&(data->cursor), n); - swapl(&(data->time), n); -} - -void XETSwGrabButton(register xGrabButtonReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->grabWindow), n); - swaps(&(data->eventMask), n); - swapl(&(data->confineTo), n); - swapl(&(data->cursor), n); - swaps(&(data->modifiers), n); -} - -void XETSwUngrabButton(register xUngrabButtonReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->grabWindow), n); - swaps(&(data->modifiers), n); -} - -void XETSwChangeActivePointerGrab(register xChangeActivePointerGrabReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cursor), n); - swapl(&(data->time), n); - swaps(&(data->eventMask), n); -} - -void XETSwGrabKeyboard(register xGrabKeyboardReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->grabWindow), n); - swapl(&(data->time), n); -} - -void XETSwGrabKey(register xGrabKeyReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->grabWindow), n); - swaps(&(data->modifiers), n); -} - -void XETSwUngrabKey(register xUngrabKeyReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->grabWindow), n); - swaps(&(data->modifiers), n); -} - -void XETSwGetMotionEvents(register xGetMotionEventsReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swapl(&(data->start), n); - swapl(&(data->stop), n); -} - -void XETSwTranslateCoords(register xTranslateCoordsReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->srcWid), n); - swapl(&(data->dstWid), n); - swaps(&(data->srcX), n); - swaps(&(data->srcY), n); -} - -void XETSwWarpPointer(register xWarpPointerReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->srcWid), n); - swapl(&(data->dstWid), n); - swaps(&(data->srcX), n); - swaps(&(data->srcY), n); - swaps(&(data->srcWidth), n); - swaps(&(data->srcHeight), n); - swaps(&(data->dstX), n); - swaps(&(data->dstY), n); -} - -void XETSwSetInputFocus(register xSetInputFocusReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->focus), n); - swapl(&(data->time), n); -} - -void XETSwOpenFont(register xOpenFontReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->fid), n); - swaps(&(data->nbytes), n); -} - -void XETSwListFonts(register xListFontsReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->maxNames), n); - swaps(&(data->nbytes), n); -} - -void XETSwListFontsWithInfo(register xListFontsWithInfoReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->maxNames), n); - swaps(&(data->nbytes), n); -} - -void XETSwSetFontPath(register xSetFontPathReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->nFonts), n); -} - -void XETSwCreatePixmap(register xCreatePixmapReq *data) -{ - register char n; - - swaps(&(data->length), n); - swapl(&(data->pid), n); - swapl(&(data->drawable), n); - swaps(&(data->width), n); - swaps(&(data->height), n); -} - -void XETSwCreateGC(register xCreateGCReq *data, ClientPtr client) -{ - register char n; - swapl(&(data->gc), n); - swapl(&(data->drawable), n); - swapl(&(data->mask), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -void XETSwChangeGC(register xChangeGCReq *data, ClientPtr client) -{ - register char n; - swapl(&(data->gc), n); - swapl(&(data->mask), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -void XETSwCopyGC(register xCopyGCReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->srcGC), n); - swapl(&(data->dstGC), n); - swapl(&(data->mask), n); -} - -void XETSwSetDashes(register xSetDashesReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->gc), n); - swaps(&(data->dashOffset), n); - swaps(&(data->nDashes), n); -} - -void XETSwSetClipRectangles(register xSetClipRectanglesReq *data, ClientPtr -client) -{ - register char n; - swapl(&(data->gc), n); - swaps(&(data->xOrigin), n); - swaps(&(data->yOrigin), n); - SwapRestS(data); - swaps(&(data->length), n); -} - -void XETSwClearToBackground(register xClearAreaReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->window), n); - swaps(&(data->x), n); - swaps(&(data->y), n); - swaps(&(data->width), n); - swaps(&(data->height), n); -} - -void XETSwCopyArea(register xCopyAreaReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->srcDrawable), n); - swapl(&(data->dstDrawable), n); - swapl(&(data->gc), n); - swaps(&(data->srcX), n); - swaps(&(data->srcY), n); - swaps(&(data->dstX), n); - swaps(&(data->dstY), n); - swaps(&(data->width), n); - swaps(&(data->height), n); -} - -void XETSwCopyPlane(register xCopyPlaneReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->srcDrawable), n); - swapl(&(data->dstDrawable), n); - swapl(&(data->gc), n); - swaps(&(data->srcX), n); - swaps(&(data->srcY), n); - swaps(&(data->dstX), n); - swaps(&(data->dstY), n); - swaps(&(data->width), n); - swaps(&(data->height), n); - swapl(&(data->bitPlane), n); -} - -/* The following routine is used for all Poly drawing requests - (except FillPoly, which uses a different request format) */ -void XETSwPoly(register xPolyPointReq *data, ClientPtr client) -{ - register char n; - - swapl(&(data->drawable), n); - swapl(&(data->gc), n); - SwapRestS(data); - swaps(&(data->length), n); -} - /* cannot use XETSwPoly for this one, because xFillPolyReq - * is longer than xPolyPointReq, and we don't want to swap - * the difference as shorts! - */ -void XETSwFillPoly(register xFillPolyReq *data, ClientPtr client) -{ - register char n; - - swapl(&(data->drawable), n); - swapl(&(data->gc), n); - SwapRestS(data); - swaps(&(data->length), n); -} - -void XETSwPutImage(register xPutImageReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->drawable), n); - swapl(&(data->gc), n); - swaps(&(data->width), n); - swaps(&(data->height), n); - swaps(&(data->dstX), n); - swaps(&(data->dstY), n); - /* Image should already be swapped */ -} - -void XETSwGetImage(register xGetImageReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->drawable), n); - swaps(&(data->x), n); - swaps(&(data->y), n); - swaps(&(data->width), n); - swaps(&(data->height), n); - swapl(&(data->planeMask), n); -} - -/* ProcPolyText used for both PolyText8 and PolyText16 */ - -void XETSwPolyText(register xPolyTextReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->drawable), n); - swapl(&(data->gc), n); - swaps(&(data->x), n); - swaps(&(data->y), n); -} - -/* ProcImageText used for both ImageText8 and ImageText16 */ - -void XETSwImageText(register xImageTextReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->drawable), n); - swapl(&(data->gc), n); - swaps(&(data->x), n); - swaps(&(data->y), n); -} - -void XETSwCreateColormap(register xCreateColormapReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->mid), n); - swapl(&(data->window), n); - swapl(&(data->visual), n); -} - - -void XETSwCopyColormapAndFree(register xCopyColormapAndFreeReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->mid), n); - swapl(&(data->srcCmap), n); - -} - -void XETSwAllocColor (register xAllocColorReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cmap), n); - swaps(&(data->red), n); - swaps(&(data->green), n); - swaps(&(data->blue), n); -} - -void XETSwAllocNamedColor (register xAllocNamedColorReq *data) -{ - register char n; - - swaps(&(data->length), n); - swapl(&(data->cmap), n); - swaps(&(data->nbytes), n); -} - -void XETSwAllocColorCells (register xAllocColorCellsReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cmap), n); - swaps(&(data->colors), n); - swaps(&(data->planes), n); -} - -void XETSwAllocColorPlanes(register xAllocColorPlanesReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cmap), n); - swaps(&(data->colors), n); - swaps(&(data->red), n); - swaps(&(data->green), n); - swaps(&(data->blue), n); -} - -void XETSwFreeColors (register xFreeColorsReq *data, ClientPtr -client) -{ - register char n; - swapl(&(data->cmap), n); - swapl(&(data->planeMask), n); - SwapRestL(data); - swaps(&(data->length), n); - -} - -void XETSwStoreColors (register xStoreColorsReq *data,ClientPtr -client) -{ - register char n; - unsigned long count; - xColorItem *pItem; - - swapl(&(data->cmap), n); - pItem = (xColorItem *) &(data[1]); - for(count = LengthRestB(data)/sizeof(xColorItem); count != 0; count--) - SwapColorItem(pItem++); - swaps(&(data->length), n); -} - -void XETSwStoreNamedColor (register xStoreNamedColorReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cmap), n); - swapl(&(data->pixel), n); - swaps(&(data->nbytes), n); -} - -void XETSwQueryColors(register xQueryColorsReq *data, ClientPtr client) -{ - register char n; - swapl(&(data->cmap), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -void XETSwLookupColor(register xLookupColorReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cmap), n); - swaps(&(data->nbytes), n); -} - -void XETSwCreateCursor(register xCreateCursorReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cid), n); - swapl(&(data->source), n); - swapl(&(data->mask), n); - swaps(&(data->foreRed), n); - swaps(&(data->foreGreen), n); - swaps(&(data->foreBlue), n); - swaps(&(data->backRed), n); - swaps(&(data->backGreen), n); - swaps(&(data->backBlue), n); - swaps(&(data->x), n); - swaps(&(data->y), n); -} - -void XETSwCreateGlyphCursor(register xCreateGlyphCursorReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cid), n); - swapl(&(data->source), n); - swapl(&(data->mask), n); - swaps(&(data->sourceChar), n); - swaps(&(data->maskChar), n); - swaps(&(data->foreRed), n); - swaps(&(data->foreGreen), n); - swaps(&(data->foreBlue), n); - swaps(&(data->backRed), n); - swaps(&(data->backGreen), n); - swaps(&(data->backBlue), n); -} - - -void XETSwRecolorCursor(register xRecolorCursorReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->cursor), n); - swaps(&(data->foreRed), n); - swaps(&(data->foreGreen), n); - swaps(&(data->foreBlue), n); - swaps(&(data->backRed), n); - swaps(&(data->backGreen), n); - swaps(&(data->backBlue), n); -} - -void XETSwQueryBestSize (register xQueryBestSizeReq *data) -{ - register char n; - swaps(&(data->length), n); - swapl(&(data->drawable), n); - swaps(&(data->width), n); - swaps(&(data->height), n); - -} - -void XETSwQueryExtension (register xQueryExtensionReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->nbytes), n); -} - -void XETSwChangeKeyboardMapping (register xChangeKeyboardMappingReq *data) -{ - register char n; - register long *p; - register int i, count; - - swaps(&(data->length), n); - p = (long *)&(data[1]); - count = data->keyCodes * data->keySymsPerKeyCode; - for(i = 0; i < count; i++) - { - swapl(p, n); - p++; - } -} - - -void XETSwChangeKeyboardControl (register xChangeKeyboardControlReq *data, - ClientPtr client) -{ - register char n; - swapl(&(data->mask), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -void XETSwChangePointerControl (register xChangePointerControlReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->accelNum), n); - swaps(&(data->accelDenum), n); - swaps(&(data->threshold), n); -} - - -void XETSwSetScreenSaver (register xSetScreenSaverReq *data) -{ - register char n; - swaps(&(data->length), n); - swaps(&(data->timeout), n); - swaps(&(data->interval), n); -} - -void XETSwChangeHosts(register xChangeHostsReq *data) -{ - register char n; - - swaps(&(data->length), n); - swaps(&(data->hostLength), n); - -} -void XETSwRotateProperties(register xRotatePropertiesReq *data, ClientPtr client) -{ - register char n; - swapl(&(data->window), n); - swaps(&(data->nAtoms), n); - swaps(&(data->nPositions), n); - SwapRestL(data); - swaps(&(data->length), n); -} - -/*ARGSUSED*/ -void XETSwNoOperation(xReq *data) -{ - /* noop -- don't do anything */ -} diff --git a/XTrap/xtrapditbl.c b/XTrap/xtrapditbl.c deleted file mode 100644 index db78c26e2..000000000 --- a/XTrap/xtrapditbl.c +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************** -Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA - -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. - -*****************************************************************************/ -/* - * ABSTRACT: - * - * This module is contains Vector tables used for swapping and general - * dispatch by the XTrap server extension. - * - * CONTRIBUTORS: - * - * Ken Miller - * Marc Evans - * - */ - -/*-----------------* - * Include Files * - *-----------------*/ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#define NEED_REPLIES -#define NEED_EVENTS -#include -#include -#include -#include "input.h" /* Server DevicePtr definitions */ -#include "misc.h" -#include "dixstruct.h" -#ifdef PC -# include "extnsist.h" -#else -# include "extnsionst.h" /* Server ExtensionEntry definitions */ -#endif -#include -#include - -globaldef void_function XETSwProcVector[256L] = -{ - (void_function)ProcBadRequest, - XETSwCreateWindow, - XETSwChangeWindowAttributes, - XETSwResourceReq, /* GetWindowAttributes */ - XETSwResourceReq, /* DestroyWindow */ - XETSwResourceReq, /* 5 DestroySubwindows */ - XETSwResourceReq, /* XETSwChangeSaveSet, */ - XETSwReparentWindow, - XETSwResourceReq, /* MapWindow */ - XETSwResourceReq, /* MapSubwindows */ - XETSwResourceReq, /* 10 UnmapWindow */ - XETSwResourceReq, /* UnmapSubwindows */ - XETSwConfigureWindow, - XETSwResourceReq, /* XETSwCirculateWindow, */ - XETSwResourceReq, /* GetGeometry */ - XETSwResourceReq, /* 15 QueryTree */ - XETSwInternAtom, - XETSwResourceReq, /* XETSwGetAtomName, */ - XETSwChangeProperty, - XETSwDeleteProperty, - XETSwGetProperty, /* 20 */ - XETSwResourceReq, /* XETSwListProperties, */ - XETSwSetSelectionOwner, - XETSwResourceReq, /* XETSwGetSelectionOwner, */ - XETSwConvertSelection, - XETSwSendEvent, /* 25 */ - XETSwGrabPointer, - XETSwResourceReq, /* XETSwUngrabPointer, */ - XETSwGrabButton, - XETSwUngrabButton, - XETSwChangeActivePointerGrab, /* 30 */ - XETSwGrabKeyboard, - XETSwResourceReq, /* XETSwUngrabKeyboard, */ - XETSwGrabKey, - XETSwUngrabKey, - XETSwResourceReq, /* 35 XETSwAllowEvents, */ - XETSwSimpleReq, /* XETSwGrabServer, */ - XETSwSimpleReq, /* XETSwUngrabServer, */ - XETSwResourceReq, /* XETSwQueryPointer, */ - XETSwGetMotionEvents, - XETSwTranslateCoords, /*40 */ - XETSwWarpPointer, - XETSwSetInputFocus, - XETSwSimpleReq, /* XETSwGetInputFocus, */ - XETSwSimpleReq, /* QueryKeymap, */ - XETSwOpenFont, /* 45 */ - XETSwResourceReq, /* XETSwCloseFont, */ - XETSwResourceReq, /* XETSwQueryFont, */ - XETSwResourceReq, /* XETSwQueryTextExtents, */ - XETSwListFonts, - XETSwListFontsWithInfo, /* 50 */ - XETSwSetFontPath, - XETSwSimpleReq, /* GetFontPath, */ - XETSwCreatePixmap, - XETSwResourceReq, /* XETSwFreePixmap, */ - XETSwCreateGC, /* 55 */ - XETSwChangeGC, - XETSwCopyGC, - XETSwSetDashes, - XETSwSetClipRectangles, - XETSwResourceReq, /* 60 XETSwFreeGC, */ - XETSwClearToBackground, - XETSwCopyArea, - XETSwCopyPlane, - XETSwPoly, /* PolyPoint, */ - XETSwPoly, /* 65 PolyLine */ - XETSwPoly, /* PolySegment, */ - XETSwPoly, /* PolyRectangle, */ - XETSwPoly, /* PolyArc, */ - XETSwFillPoly, - XETSwPoly, /* 70 PolyFillRectangle */ - XETSwPoly, /* PolyFillArc, */ - XETSwPutImage, - XETSwGetImage, - XETSwPolyText, - XETSwPolyText, /* 75 */ - XETSwImageText, - XETSwImageText, - XETSwCreateColormap, - XETSwResourceReq, /* XETSwFreeColormap, */ - XETSwCopyColormapAndFree, /* 80 */ - XETSwResourceReq, /* XETSwInstallColormap, */ - XETSwResourceReq, /* XETSwUninstallColormap, */ - XETSwResourceReq, /* XETSwListInstalledColormaps, */ - XETSwAllocColor, - XETSwAllocNamedColor, /* 85 */ - XETSwAllocColorCells, - XETSwAllocColorPlanes, - XETSwFreeColors, - XETSwStoreColors, - XETSwStoreNamedColor, /* 90 */ - XETSwQueryColors, - XETSwLookupColor, - XETSwCreateCursor, - XETSwCreateGlyphCursor, - XETSwResourceReq, /* 95 XETSwFreeCursor, */ - XETSwRecolorCursor, - XETSwQueryBestSize, - XETSwQueryExtension, - XETSwSimpleReq, /* ListExtensions, */ - XETSwChangeKeyboardMapping, /* 100 */ - XETSwSimpleReq, /* GetKeyboardMapping, */ - XETSwChangeKeyboardControl, - XETSwSimpleReq, /* GetKeyboardControl, */ - XETSwSimpleReq, /* Bell, */ - XETSwChangePointerControl, /* 105 */ - XETSwSimpleReq, /* GetPointerControl, */ - XETSwSetScreenSaver, - XETSwSimpleReq, /* GetScreenSaver, */ - XETSwChangeHosts, - XETSwSimpleReq, /* 110 ListHosts, */ - XETSwSimpleReq, /* XETSwChangeAccessControl, */ - XETSwSimpleReq, /* XETSwChangeCloseDownMode, */ - XETSwResourceReq, /* XETSwKillClient, */ - XETSwRotateProperties, - XETSwSimpleReq, /* 115 ForceScreenSaver */ - XETSwSimpleReq, /* SetPointerMapping, */ - XETSwSimpleReq, /* GetPointerMapping, */ - XETSwSimpleReq, /* SetModifierMapping, */ - XETSwSimpleReq, /* GetModifierMapping, */ - NotImplemented, /* 120 */ - NotImplemented, - NotImplemented, - NotImplemented, - NotImplemented, - NotImplemented, /* 125 */ - NotImplemented, - XETSwNoOperation -}; - -/* NOTE: This array must align with the values of the constants used - * as minor_opcode values in the request structure. Failure to do this - * could result in random code paths. - */ -globaldef int_function XETrapDispatchVector[10L] = -{ - XETrapReset, /* 0 XETrap_Reset */ - XETrapGetAvailable, /* 1 XETrap_GetAvailable */ - XETrapConfig, /* 2 XETrap_Config */ - XETrapStartTrap, /* 3 XETrap_StartTrap */ - XETrapStopTrap, /* 4 XETrap_StopTrap */ - XETrapGetCurrent, /* 5 XETrap_GetCurrent */ - XETrapGetStatistics, /* 6 XETrap_GetStatistics */ -#ifndef _XINPUT - XETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */ -#endif - XETrapGetVersion, /* 8 XETrap_GetVersion */ - XETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */ -}; - -/* NOTE: This array must align with the values of the constants used - * as minor_opcode values in the request structure. Failure to do this - * could result in random code paths. - */ -globaldef int_function XETSwDispatchVector[10L] = -{ - sXETrapReset, /* 0 XETrap_Reset */ - sXETrapGetAvailable, /* 1 XETrap_GetAvailable */ - sXETrapConfig, /* 2 XETrap_Config */ - sXETrapStartTrap, /* 3 XETrap_StartTrap */ - sXETrapStopTrap, /* 4 XETrap_StopTrap */ - sXETrapGetCurrent, /* 5 XETrap_GetCurrent */ - sXETrapGetStatistics, /* 6 XETrap_GetStatistics */ -#ifndef _XINPUT - sXETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */ -#endif - sXETrapGetVersion, /* 8 XETrap_GetVersion */ - sXETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */ -}; - -/* ProcVector shadow vector */ -globaldef int_function XETrapProcVector[256L] = {XETrapRequestVector}; -/* - * Events are faked as if they're vectored since that's - * the way it'll eventually be (X11 R5?). - */ -#ifndef VECTORED_EVENTS -globaldef int_function EventProcVector[XETrapCoreEvents] = {NULL}; -#endif -globaldef int_function XETrapEventProcVector[XETrapCoreEvents] = {NULL}; - - diff --git a/Xext/Makefile.am b/Xext/Makefile.am index 484fe2605..37c68d7d3 100644 --- a/Xext/Makefile.am +++ b/Xext/Makefile.am @@ -106,12 +106,6 @@ if MULTIBUFFER MODULE_SRCS += $(MULTIBUFFER_SRCS) endif -# Font Cache extension -FONTCACHE_SRCS = fontcache.c -if FONTCACHE -MODULE_SRCS += $(FONTCACHE_SRCS) -endif - # XF86 Big Font extension BIGFONT_SRCS = xf86bigfont.c if XF86BIGFONT diff --git a/Xext/fontcache.c b/Xext/fontcache.c deleted file mode 100644 index b11968aec..000000000 --- a/Xext/fontcache.c +++ /dev/null @@ -1,323 +0,0 @@ -/*- - * Copyright (c) 1998-1999 Shunsuke Akiyama . - * All rights reserved. - * Copyright (c) 1998-1999 X-TrueType Server Project, All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#define NEED_REPLIES -#define NEED_EVENTS -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "scrnintstr.h" -#include "inputstr.h" -#include "servermd.h" -#define _FONTCACHE_SERVER_ -#include -#include -#include - -#include "swaprep.h" -#include "modinit.h" - -static int miscErrorBase; - -static void FontCacheResetProc( - ExtensionEntry* /* extEntry */ -); - -static DISPATCH_PROC(ProcFontCacheDispatch); -static DISPATCH_PROC(ProcFontCacheGetCacheSettings); -static DISPATCH_PROC(ProcFontCacheGetCacheStatistics); -static DISPATCH_PROC(ProcFontCacheQueryVersion); -static DISPATCH_PROC(ProcFontCacheChangeCacheSettings); -static DISPATCH_PROC(SProcFontCacheDispatch); -static DISPATCH_PROC(SProcFontCacheGetCacheSettings); -static DISPATCH_PROC(SProcFontCacheGetCacheStatistics); -static DISPATCH_PROC(SProcFontCacheQueryVersion); -static DISPATCH_PROC(SProcFontCacheChangeCacheSettings); - -void -FontCacheExtensionInit(INITARGS) -{ - ExtensionEntry* extEntry; - - if ( - (extEntry = AddExtension(FONTCACHENAME, - FontCacheNumberEvents, - FontCacheNumberErrors, - ProcFontCacheDispatch, - SProcFontCacheDispatch, - FontCacheResetProc, - StandardMinorOpcode))) { - miscErrorBase = extEntry->errorBase; - } -} - -/*ARGSUSED*/ -static void -FontCacheResetProc (extEntry) - ExtensionEntry* extEntry; -{ -} - -static int -ProcFontCacheQueryVersion(client) - ClientPtr client; -{ - xFontCacheQueryVersionReply rep; - int n; - - REQUEST_SIZE_MATCH(xFontCacheQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = FONTCACHE_MAJOR_VERSION; - rep.minorVersion = FONTCACHE_MINOR_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); - } - WriteToClient(client, SIZEOF(xFontCacheQueryVersionReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcFontCacheGetCacheSettings(client) - ClientPtr client; -{ - xFontCacheGetCacheSettingsReply rep; - FontCacheSettings cinfo; - int n; - - REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - - /* XXX */ - FontCacheGetSettings(&cinfo); - rep.himark = cinfo.himark; - rep.lowmark = cinfo.lowmark; - rep.balance = cinfo.balance; - rep.reserve0 = 0; - rep.reserve1 = 0; - rep.reserve2 = 0; - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.himark, n); - swapl(&rep.lowmark, n); - swapl(&rep.balance, n); - swapl(&rep.reserve0, n); - swapl(&rep.reserve1, n); - swapl(&rep.reserve2, n); - } - /* XXX */ - - WriteToClient(client, SIZEOF(xFontCacheGetCacheSettingsReply), - (char *)&rep); - return (client->noClientException); -} - -static int -ProcFontCacheGetCacheStatistics(client) - ClientPtr client; -{ - xFontCacheGetCacheStatisticsReply rep; - FontCacheStatistics cstats; - int n; - - REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = (sz_xFontCacheGetCacheStatisticsReply - 32) >> 2; - - /* XXX */ - FontCacheGetStatistics(&cstats); - rep.purge_runs = cstats.purge_runs; - rep.purge_stat = cstats.purge_stat; - rep.balance = cstats.balance; - rep.reserve0 = 0; - rep.f_hits = cstats.f.hits; - rep.f_misshits = cstats.f.misshits; - rep.f_purged = cstats.f.purged; - rep.f_usage = cstats.f.usage; - rep.f_reserve0 = 0; - rep.v_hits = cstats.v.hits; - rep.v_misshits = cstats.v.misshits; - rep.v_purged = cstats.v.purged; - rep.v_usage = cstats.v.usage; - rep.v_reserve0 = 0; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.purge_runs, n); - swapl(&rep.purge_stat, n); - swapl(&rep.balance, n); - swapl(&rep.reserve0, n); - swapl(&rep.f_hits, n); - swapl(&rep.f_misshits, n); - swapl(&rep.f_purged, n); - swapl(&rep.f_usage, n); - swapl(&rep.f_reserve0, n); - swapl(&rep.v_hits, n); - swapl(&rep.v_misshits, n); - swapl(&rep.v_purged, n); - swapl(&rep.v_usage, n); - swapl(&rep.v_reserve0, n); - } - /* XXX */ - WriteToClient(client, SIZEOF(xFontCacheGetCacheStatisticsReply), - (char *)&rep); - return (client->noClientException); -} - -static int -ProcFontCacheChangeCacheSettings(client) - ClientPtr client; -{ - FontCacheSettings cs; - - REQUEST(xFontCacheChangeCacheSettingsReq); - - REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq); - - /* XXX */ - cs.himark = stuff->himark; - cs.lowmark = stuff->lowmark; - cs.balance = stuff->balance; - - if (cs.himark < 0 || cs.lowmark < 0) - return BadValue; - if (cs.himark <= cs.lowmark) - return BadValue; - if (!(10 <= cs.balance && cs.balance <= 90)) - return BadValue; - - if (FontCacheChangeSettings(&cs) == 0) - return miscErrorBase + FontCacheCannotAllocMemory; - /* XXX */ - - return (client->noClientException); -} - -static int -ProcFontCacheDispatch (client) - ClientPtr client; -{ - REQUEST(xReq); - switch (stuff->data) - { - case X_FontCacheQueryVersion: - return ProcFontCacheQueryVersion(client); - case X_FontCacheGetCacheSettings: - return ProcFontCacheGetCacheSettings(client); - case X_FontCacheGetCacheStatistics: - return ProcFontCacheGetCacheStatistics(client); - case X_FontCacheChangeCacheSettings: - return ProcFontCacheChangeCacheSettings(client); - default: - return miscErrorBase + FontCacheBadProtocol; - } -} - -static int -SProcFontCacheQueryVersion(client) - ClientPtr client; -{ - int n; - REQUEST(xFontCacheQueryVersionReq); - swaps(&stuff->length, n); - return ProcFontCacheQueryVersion(client); -} - -static int -SProcFontCacheGetCacheSettings(client) - ClientPtr client; -{ - int n; - REQUEST(xFontCacheGetCacheSettingsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq); - return ProcFontCacheGetCacheSettings(client); -} - -static int -SProcFontCacheGetCacheStatistics(client) - ClientPtr client; -{ - int n; - REQUEST(xFontCacheGetCacheStatisticsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq); - return ProcFontCacheGetCacheStatistics(client); -} - -static int -SProcFontCacheChangeCacheSettings(client) - ClientPtr client; -{ - int n; - REQUEST(xFontCacheChangeCacheSettingsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq); - /* XXX */ - swapl(&stuff->himark, n); - swapl(&stuff->lowmark, n); - swapl(&stuff->balance, n); - /* XXX */ - return ProcFontCacheChangeCacheSettings(client); -} - -static int -SProcFontCacheDispatch (client) - ClientPtr client; -{ - REQUEST(xReq); - switch (stuff->data) - { - case X_FontCacheQueryVersion: - return SProcFontCacheQueryVersion(client); - case X_FontCacheGetCacheSettings: - return SProcFontCacheGetCacheSettings(client); - case X_FontCacheGetCacheStatistics: - return SProcFontCacheGetCacheStatistics(client); - case X_FontCacheChangeCacheSettings: - return SProcFontCacheChangeCacheSettings(client); - default: - return miscErrorBase + FontCacheBadProtocol; - } -} diff --git a/Xext/geext.c b/Xext/geext.c index e49e71f66..171fda160 100644 --- a/Xext/geext.c +++ b/Xext/geext.c @@ -36,12 +36,15 @@ #define SERVER_GE_MAJOR 1 #define SERVER_GE_MINOR 0 +#define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) int GEEventBase; int GEErrorBase; DevPrivateKey GEClientPrivateKey = &GEClientPrivateKey; int GEEventType; /* The opcode for all GenericEvents will have. */ +int RT_GECLIENT = 0; + GEExtension GEExtensions[MAXEXTENSIONS]; @@ -53,6 +56,7 @@ static const int version_requests[] = { /* Forward declarations */ static void SGEGenericEvent(xEvent* from, xEvent* to); +static void GERecalculateWinMask(WindowPtr pWin); #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) @@ -211,6 +215,43 @@ SGEGenericEvent(xEvent* from, xEvent* to) GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto); } +/** + * Resource callback, invoked when the client disconnects and the associated + * GE masks must be destroyed. + */ +int +GEClientGone(WindowPtr pWin, XID id) +{ + GenericClientMasksPtr gclmask; + GenericMaskPtr gmask, prev = NULL; + + if (!pWin || !pWin->optional) + return Success; + + gclmask = pWin->optional->geMasks; + for (gmask = gclmask->geClients; gmask; gmask = gmask->next) + { + if (gmask->resource == id) + { + if (prev) + { + prev->next = gmask->next; + xfree(gmask); + } else { + gclmask->geClients = NULL; + CheckWindowOptionalNeed(pWin); + GERecalculateWinMask(pWin); + xfree(gmask); + } + return Success; + } + prev = gmask; + } + + FatalError("Client not a GE client"); + return BadImplementation; +} + /* Init extension, register at server. * Since other extensions may rely on XGE (XInput does already), it is a good * idea to init XGE first, before any other extension. @@ -234,6 +275,9 @@ GEExtensionInit(void) GEErrorBase = extEntry->errorBase; GEEventType = GEEventBase; + RT_GECLIENT = CreateNewResourceType((DeleteType)GEClientGone); + RegisterResourceName(RT_GECLIENT, "GECLIENT"); + memset(GEExtensions, 0, sizeof(GEExtensions)); EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent; @@ -338,7 +382,7 @@ GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev, cli = evmasks->geClients; while(cli) { - if (cli->client == pClient && cli->dev == pDev) + if (rClient(cli) == pClient && cli->dev == pDev) break; cli = cli->next; } @@ -352,16 +396,17 @@ GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev, return; } cli->next = evmasks->geClients; - cli->client = pClient; + cli->resource = FakeClientID(pClient->index); cli->dev = pDev; evmasks->geClients = cli; + AddResource(cli->resource, RT_GECLIENT, (pointer)pWin); } cli->eventMask[extension] = mask; } else { /* remove client. */ cli = pWin->optional->geMasks->geClients; - if (cli->client == pClient && cli->dev == pDev) + if (rClient(cli) == pClient && cli->dev == pDev) { pWin->optional->geMasks->geClients = cli->next; xfree(cli); @@ -372,7 +417,7 @@ GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev, while(cli) { - if (cli->client == pClient && cli->dev == pDev) + if (rClient(cli) == pClient && cli->dev == pDev) { prev->next = cli->next; xfree(cli); diff --git a/Xext/geext.h b/Xext/geext.h index 84539a94a..3d1665373 100644 --- a/Xext/geext.h +++ b/Xext/geext.h @@ -43,10 +43,10 @@ from the author. * A grab has only one instance of this struct. */ typedef struct _GenericMaskRec { - ClientPtr client; /* client who set the event mask */ + struct _GenericMaskRec* next; + XID resource; /* id for the resource manager */ DeviceIntPtr dev; Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */ - struct _GenericMaskRec* next; } GenericMaskRec, *GenericMaskPtr; diff --git a/Xext/mbuf.c b/Xext/mbuf.c index ae0ca1771..08b933433 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -47,7 +47,7 @@ in this Software without prior written authorization from The Open Group. #include #include -#if !defined(WIN32) && !defined(Lynx) +#if !defined(WIN32) #include #endif diff --git a/Xext/shm.c b/Xext/shm.c index 00e296daa..52e477fac 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -34,13 +34,8 @@ in this Software without prior written authorization from The Open Group. #endif #include -#ifndef Lynx #include #include -#else -#include -#include -#endif #include #include #define NEED_REPLIES diff --git a/Xext/sync.c b/Xext/sync.c index ce047024f..63f6fa2aa 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -72,7 +72,7 @@ PERFORMANCE OF THIS SOFTWARE. #include #include -#if !defined(WIN32) && !defined(Lynx) +#if !defined(WIN32) #include #endif diff --git a/Xext/xevie.c b/Xext/xevie.c index 277b93bfb..a5b183790 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -55,6 +55,7 @@ of the copyright holder. #include #include "../os/osdep.h" +#include "modinit.h" #define NoSuchEvent 0x80000000 diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 1e3b4d66c..a47df03c2 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -2031,6 +2031,8 @@ SELinuxExtensionInit(INITARGS) ProcSELinuxDispatch, SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode); + AddExtensionAlias("Flask", extEntry); + /* Label objects that were created before we could register ourself */ SELinuxLabelInitial(); } diff --git a/Xext/xvmc.c b/Xext/xvmc.c index 0c6dbeb91..3a77eb6ea 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -24,14 +24,9 @@ #include "xvmcext.h" #ifdef HAS_XVMCSHM -#ifndef Lynx #include #include #include -#else -#include -#include -#endif /* Lynx */ #endif /* HAS_XVMCSHM */ diff --git a/Xi/Makefile.am b/Xi/Makefile.am index 2af1940eb..768f996cc 100644 --- a/Xi/Makefile.am +++ b/Xi/Makefile.am @@ -94,7 +94,9 @@ libXi_la_SOURCES = \ ungrdevk.h \ warpdevp.c \ warpdevp.h \ - xiselev.c \ - xiselev.h + xiproperty.c \ + xiproperty.h \ + xiselev.c \ + xiselev.h EXTRA_DIST = stubs.c diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c index 99957fe0c..07bd729db 100644 --- a/Xi/chdevhier.c +++ b/Xi/chdevhier.c @@ -80,7 +80,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client) xAnyHierarchyChangeInfo *any; int required_len = sizeof(xChangeDeviceHierarchyReq); char n; - int rc; + int rc = Success; int nchanges = 0; deviceHierarchyChangedEvent ev; diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 26b79f6dc..8c97d8fe8 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -245,20 +245,9 @@ ProcXChangeDeviceControl(ClientPtr client) break; case DEVICE_CORE: - c = (xDeviceCoreCtl *)&stuff[1]; - - status = ChangeDeviceControl(client, dev, (xDeviceCtl *) c); - - if (status == Success) { - dev->coreEvents = c->status; - ret = Success; - } else if (status == DeviceBusy) { - rep.status = DeviceBusy; - ret = Success; - } else { - ret = BadMatch; - } - + /* Sorry, no device core switching no more. If you want a device to + * send core events, attach it to a master device */ + ret = BadMatch; break; case DEVICE_ENABLE: e = (xDeviceEnableCtl *)&stuff[1]; diff --git a/Xi/exevents.c b/Xi/exevents.c index 725c57835..d59a87d1a 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -587,8 +587,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to) if (from->button) { - int i; - DeviceIntPtr sd; if (!to->button) { classes = dixLookupPrivate(&to->devPrivates, @@ -603,20 +601,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to) classes->button = NULL; } - to->button->buttonsDown = 0; - memset(to->button->down, 0, MAP_LENGTH); - /* merge button states from all attached devices */ - for (sd = inputInfo.devices; sd; sd = sd->next) - { - if (sd->isMaster || sd->u.master != to) - continue; - - for (i = 0; i < MAP_LENGTH; i++) - { - to->button->down[i] += sd->button->down[i]; - to->button->buttonsDown++; - } - } #ifdef XKB if (from->button->xkb_acts) { @@ -923,8 +907,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count) if (!b) return DONT_PROCESS; - if (b->down[key]++ > 0) + kptr = &b->down[key >> 3]; + if ((*kptr & bit) != 0) return DONT_PROCESS; + *kptr |= bit; if (device->valuator) device->valuator->motionHintWindow = NullWindow; b->buttonsDown++; @@ -938,10 +924,25 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count) if (!b) return DONT_PROCESS; - if (b->down[key] == 0) - return DONT_PROCESS; - if (--b->down[key] > 0) + kptr = &b->down[key>>3]; + if (!(*kptr & bit)) return DONT_PROCESS; + if (device->isMaster) { + DeviceIntPtr sd; + + /* + * Leave the button down if any slave has the + * button still down. Note that this depends on the + * event being delivered through the slave first + */ + for (sd = inputInfo.devices; sd; sd = sd->next) { + if (sd->isMaster || sd->u.master != device) + continue; + if ((sd->button->down[key>>3] & bit) != 0) + return DONT_PROCESS; + } + } + *kptr &= ~bit; if (device->valuator) device->valuator->motionHintWindow = NullWindow; if (b->buttonsDown >= 1 && !--b->buttonsDown) @@ -1066,9 +1067,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count) (key == device->deviceGrab.activatingKey)) deactivateDeviceGrab = TRUE; } else if (xE->u.u.type == DeviceButtonPress) { - xE->u.u.detail = key; - if (xE->u.u.detail == 0) + xE->u.u.detail = b->map[key]; + if (xE->u.u.detail == 0) { + xE->u.u.detail = key; return; + } if (!grab && CheckDeviceGrabs(device, xE, 0, count)) { /* if a passive grab was activated, the event has been sent @@ -1077,9 +1080,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count) } } else if (xE->u.u.type == DeviceButtonRelease) { - xE->u.u.detail = key; - if (xE->u.u.detail == 0) + xE->u.u.detail = b->map[key]; + if (xE->u.u.detail == 0) { + xE->u.u.detail = key; return; + } if (!b->state && device->deviceGrab.fromPassiveGrab) deactivateDeviceGrab = TRUE; } @@ -1094,6 +1099,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count) if (deactivateDeviceGrab == TRUE) (*device->deviceGrab.DeactivateGrab) (device); + xE->u.u.detail = key; } _X_EXPORT int @@ -1148,9 +1154,11 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k, ev->num_valuators = 0; if (b) { + int i; ev->classes_reported |= (1 << ButtonClass); ev->num_buttons = b->numButtons; - memmove((char *)&ev->buttons[0], (char *)b->down, 4); + for (i = 0; i < 32; i++) + SetBitIf(ev->buttons, b->down, i); } else if (k) { ev->classes_reported |= (1 << KeyClass); ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode; @@ -1265,11 +1273,13 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, first += 3; nval -= 3; if (nbuttons > 32) { + int i; (ev - 1)->deviceid |= MORE_EVENTS; bev = (deviceButtonStateNotify *) ev++; bev->type = DeviceButtonStateNotify; bev->deviceid = dev->id; - memmove((char *)&bev->buttons[0], (char *)&b->down[4], 28); + for (i = 32; i < MAP_LENGTH; i++) + SetBitIf(bev->buttons, b->down, i); } if (nval > 0) { (ev - 1)->deviceid |= MORE_EVENTS; @@ -1687,7 +1697,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map) if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue)) return BadValue; for (i = 0; i < nElts; i++) - if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1)) + if ((b->map[i + 1] != map[i]) && (b->down[i + 1])) return MappingBusy; for (i = 0; i < nElts; i++) b->map[i + 1] = map[i]; diff --git a/Xi/extgrbdev.c b/Xi/extgrbdev.c index 1a2584fb6..050984a8e 100644 --- a/Xi/extgrbdev.c +++ b/Xi/extgrbdev.c @@ -175,7 +175,7 @@ ProcXExtendedGrabDevice(ClientPtr client) (XGenericEventMask*)(((XEventClass*)&stuff[1]) + stuff->event_count); gemasks = xcalloc(1, sizeof(GenericMaskRec)); - gemasks->client = client; + gemasks->resource = FakeClientID(client->index); gemasks->next = NULL; gemasks->eventMask[xgeMask->extension & 0x7F] = xgeMask->evmask; @@ -184,16 +184,11 @@ ProcXExtendedGrabDevice(ClientPtr client) gemasks->eventMask[xgeMask->extension & 0x7F]= xgeMask->evmask; } - ExtGrabDevice(client, dev, stuff->device_mode, - grab_window, confineTo, time, stuff->owner_events, - cursor, tmp[stuff->deviceid].mask, - gemasks); - - if (rc != Success) { - errval = 0; - goto cleanup; - } - + rep.status = ExtGrabDevice(client, dev, stuff->device_mode, + grab_window, confineTo, time, + stuff->owner_events, cursor, + tmp[stuff->deviceid].mask, + gemasks); cleanup: if (gemasks) diff --git a/Xi/extinit.c b/Xi/extinit.c index 613472ab6..ba93ebcf0 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -122,6 +122,8 @@ SOFTWARE. #include "ungrdevk.h" #include "warpdevp.h" #include "xiselev.h" +#include "xiproperty.c" +#include "xiproperty.h" static Mask lastExtEventMask = 1; @@ -217,7 +219,13 @@ static int (*ProcIVector[])(ClientPtr) = { ProcXSetClientPointer, /* 42 */ ProcXGetClientPointer, /* 43 */ ProcXiSelectEvent, /* 44 */ - ProcXExtendedGrabDevice /* 45 */ + ProcXExtendedGrabDevice, /* 45 */ + ProcXListDeviceProperties, /* 46 */ + ProcXQueryDeviceProperty, /* 47 */ + ProcXConfigureDeviceProperty, /* 48 */ + ProcXChangeDeviceProperty, /* 49 */ + ProcXDeleteDeviceProperty, /* 50 */ + ProcXGetDeviceProperty /* 51 */ }; /* For swapped clients */ @@ -267,7 +275,13 @@ static int (*SProcIVector[])(ClientPtr) = { SProcXSetClientPointer, /* 42 */ SProcXGetClientPointer, /* 43 */ SProcXiSelectEvent, /* 44 */ - SProcXExtendedGrabDevice /* 45 */ + SProcXExtendedGrabDevice, /* 45 */ + SProcXListDeviceProperties, /* 46 */ + SProcXQueryDeviceProperty, /* 47 */ + SProcXConfigureDeviceProperty, /* 48 */ + SProcXChangeDeviceProperty, /* 49 */ + SProcXDeleteDeviceProperty, /* 50 */ + SProcXGetDeviceProperty /* 51 */ }; /***************************************************************** @@ -1127,6 +1141,7 @@ XInputExtensionInit(void) IEventBase = extEntry->eventBase; AllExtensionVersions[IReqCode - 128] = thisversion; MakeDeviceTypeAtoms(); + XIInitKnownProperties(); RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT"); FixExtensionEvents(extEntry); diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index ce1312e90..8fa0cca29 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -95,7 +95,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client) INT32 *coords = NULL, *bufptr; xGetDeviceMotionEventsReply rep; unsigned long i; - int rc, num_events, axes, size = 0, tsize; + int rc, num_events, axes, size = 0; unsigned long nEvents; DeviceIntPtr dev; TimeStamp start, stop; diff --git a/Xi/queryst.c b/Xi/queryst.c index 71ab79be8..268bdd78b 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -119,7 +119,7 @@ ProcXQueryDeviceState(ClientPtr client) total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int))); num_classes++; } - buf = (char *)xalloc(total_length); + buf = (char *)xcalloc(total_length, 1); if (!buf) return BadAlloc; savbuf = buf; @@ -139,8 +139,8 @@ ProcXQueryDeviceState(ClientPtr client) tb->class = ButtonClass; tb->length = sizeof(xButtonState); tb->num_buttons = b->numButtons; - for (i = 0; i < 32; i++) - tb->buttons[i] = b->down[i]; + for (i = 0; i < MAP_LENGTH; i++) + SetBitIf(tb->buttons, b->down, i); buf += sizeof(xButtonState); } diff --git a/Xi/selectev.c b/Xi/selectev.c index d3670ab1b..53d8f7408 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -106,10 +106,10 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win, if (mask == 0) return Success; - /* We always only use mksidx = 0 for events not bound to + /* We always only use mksidx = MAX_DEVICES for events not bound to * devices */ - if (AddExtensionClient (win, client, mask, 0) != Success) + if (AddExtensionClient (win, client, mask, MAX_DEVICES) != Success) return BadAlloc; RecalculateDeviceDeliverableEvents(win); diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c new file mode 100644 index 000000000..c9a01e4b7 --- /dev/null +++ b/Xi/xiproperty.c @@ -0,0 +1,882 @@ +/* + * Copyright © 2006 Keith Packard + * Copyright © 2008 Peter Hutterer + * + * 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 (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WAXIANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WAXIANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + */ + +/* This code is a modified version of randr/rrproperty.c */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "dix.h" +#include "inputstr.h" +#include +#include +#include "exglobals.h" +#include "exevents.h" +#include "swaprep.h" + +#include "xiproperty.h" + +/** + * Properties used or alloced from inside the server. + */ +static struct dev_properties +{ + Atom type; + char *name; +} dev_properties[] = { + {0, XI_PROP_ENABLED} +}; + +static long XIPropHandlerID = 1; + +/** + * Return the type assigned to the specified atom or 0 if the atom isn't known + * to the DIX. + */ +_X_EXPORT Atom +XIGetKnownProperty(char *name) +{ + int i; + for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) + { + if (strcmp(name, dev_properties[i].name) == 0) + return dev_properties[i].type; + } + + return 0; +} + +/** + * Init those properties that are allocated by the server and most likely used + * by the DIX or the DDX. + */ +void +XIInitKnownProperties(void) +{ + int i; + for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) + { + dev_properties[i].type = + MakeAtom(dev_properties[i].name, + strlen(dev_properties[i].name), + TRUE); + } +} + + +/* Registers a new property handler on the given device and returns a unique + * identifier for this handler. This identifier is required to unregister the + * property handler again. + * @return The handler's identifier or 0 if an error occured. + */ +long +XIRegisterPropertyHandler(DeviceIntPtr dev, + Bool (*SetProperty) (DeviceIntPtr dev, + Atom property, + XIPropertyValuePtr prop), + Bool (*GetProperty) (DeviceIntPtr dev, + Atom property)) +{ + XIPropertyHandlerPtr new_handler; + + new_handler = xcalloc(1, sizeof(XIPropertyHandler)); + if (!new_handler) + return 0; + + new_handler->id = XIPropHandlerID++; + new_handler->SetProperty = SetProperty; + new_handler->GetProperty = GetProperty; + new_handler->next = dev->properties.handlers; + dev->properties.handlers = new_handler; + + return new_handler->id; +} + +void +XIUnRegisterPropertyHandler(DeviceIntPtr dev, long id) +{ + XIPropertyHandlerPtr curr, prev = NULL; + + curr = dev->properties.handlers; + while(curr && curr->id != id) + { + prev = curr; + curr = curr->next; + } + + if (!curr) + return; + + if (!prev) /* first one */ + dev->properties.handlers = curr->next; + else + prev->next = curr->next; + + xfree(curr); +} + +static void +XIInitDevicePropertyValue (XIPropertyValuePtr property_value) +{ + property_value->type = None; + property_value->format = 0; + property_value->size = 0; + property_value->data = NULL; +} + +static XIPropertyPtr +XICreateDeviceProperty (Atom property) +{ + XIPropertyPtr prop; + + prop = (XIPropertyPtr)xalloc(sizeof(XIPropertyRec)); + if (!prop) + return NULL; + + prop->next = NULL; + prop->propertyName = property; + prop->is_pending = FALSE; + prop->range = FALSE; + prop->fromClient = FALSE; + prop->immutable = FALSE; + prop->num_valid = 0; + prop->valid_values = NULL; + + XIInitDevicePropertyValue (&prop->current); + XIInitDevicePropertyValue (&prop->pending); + return prop; +} + +static void +XIDestroyDeviceProperty (XIPropertyPtr prop) +{ + if (prop->valid_values) + xfree (prop->valid_values); + if (prop->current.data) + xfree(prop->current.data); + if (prop->pending.data) + xfree(prop->pending.data); + xfree(prop); +} + +/* This function destroys all of the device's property-related stuff, + * including removing all device handlers. + * DO NOT CALL FROM THE DRIVER. + */ +void +XIDeleteAllDeviceProperties (DeviceIntPtr device) +{ + XIPropertyPtr prop, next; + XIPropertyHandlerPtr curr_handler, next_handler; + devicePropertyNotifyEvent event; + + for (prop = device->properties.properties; prop; prop = next) + { + next = prop->next; + + event.type = GenericEvent; + event.extension = IReqCode; + event.evtype = XI_DevicePropertyNotify; + event.length = 0; + event.deviceid = device->id; + event.state = PropertyDelete; + event.atom = prop->propertyName; + event.time = currentTime.milliseconds; + SendEventToAllWindows(device, XI_DevicePropertyNotifyMask, + (xEvent*)&event, 1); + + XIDestroyDeviceProperty(prop); + } + + /* Now free all handlers */ + curr_handler = device->properties.handlers; + while(curr_handler) + { + next_handler = curr_handler->next; + xfree(curr_handler); + curr_handler = next_handler; + } +} + + +int +XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient) +{ + XIPropertyPtr prop, *prev; + devicePropertyNotifyEvent event; + + for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next)) + if (prop->propertyName == property) + break; + + if (!prop->fromClient && fromClient) + return BadAtom; + + if (prop) + { + *prev = prop->next; + event.type = GenericEvent; + event.extension = IReqCode; + event.length = 0; + event.evtype = XI_DevicePropertyNotify; + event.deviceid = device->id; + event.state = PropertyDelete; + event.atom = prop->propertyName; + event.time = currentTime.milliseconds; + SendEventToAllWindows(device, XI_DevicePropertyNotifyMask, + (xEvent*)&event, 1); + XIDestroyDeviceProperty (prop); + } + + return Success; +} + +int +XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, + int format, int mode, unsigned long len, + pointer value, Bool sendevent, Bool pending, + Bool fromClient) +{ + XIPropertyPtr prop; + devicePropertyNotifyEvent event; + int size_in_bytes; + int total_size; + unsigned long total_len; + XIPropertyValuePtr prop_value; + XIPropertyValueRec new_value; + Bool add = FALSE; + + size_in_bytes = format >> 3; + + /* first see if property already exists */ + prop = XIQueryDeviceProperty (dev, property); + if (!prop) /* just add to list */ + { + prop = XICreateDeviceProperty (property); + if (!prop) + return(BadAlloc); + prop->fromClient = fromClient; + add = TRUE; + mode = PropModeReplace; + } + if (pending && prop->is_pending) + prop_value = &prop->pending; + else + prop_value = &prop->current; + + /* To append or prepend to a property the request format and type + must match those of the already defined property. The + existing format and type are irrelevant when using the mode + "PropModeReplace" since they will be written over. */ + + if ((format != prop_value->format) && (mode != PropModeReplace)) + return(BadMatch); + if ((prop_value->type != type) && (mode != PropModeReplace)) + return(BadMatch); + new_value = *prop_value; + if (mode == PropModeReplace) + total_len = len; + else + total_len = prop_value->size + len; + + if (mode == PropModeReplace || len > 0) + { + pointer new_data = NULL, old_data = NULL; + + total_size = total_len * size_in_bytes; + new_value.data = (pointer)xalloc (total_size); + if (!new_value.data && total_size) + { + if (add) + XIDestroyDeviceProperty (prop); + return BadAlloc; + } + new_value.size = len; + new_value.type = type; + new_value.format = format; + + switch (mode) { + case PropModeReplace: + new_data = new_value.data; + old_data = NULL; + break; + case PropModeAppend: + new_data = (pointer) (((char *) new_value.data) + + (prop_value->size * size_in_bytes)); + old_data = new_value.data; + break; + case PropModePrepend: + new_data = new_value.data; + old_data = (pointer) (((char *) new_value.data) + + (prop_value->size * size_in_bytes)); + break; + } + if (new_data) + memcpy ((char *) new_data, (char *) value, len * size_in_bytes); + if (old_data) + memcpy ((char *) old_data, (char *) prop_value->data, + prop_value->size * size_in_bytes); + + /* We must set pendingProperties TRUE before we commit to the driver, + we're in a single thread after all + */ + if (pending && prop->is_pending) + dev->properties.pendingProperties = TRUE; + if (pending && dev->properties.handlers) + { + XIPropertyHandlerPtr handler = dev->properties.handlers; + while(handler) + { + if (handler->SetProperty && + !handler->SetProperty(dev, prop->propertyName, &new_value)) + { + if (new_value.data) + xfree (new_value.data); + return (BadValue); + } + handler = handler->next; + } + } + if (prop_value->data) + xfree (prop_value->data); + *prop_value = new_value; + } + + else if (len == 0) + { + /* do nothing */ + } + + if (add) + { + prop->next = dev->properties.properties; + dev->properties.properties = prop; + } + + + if (sendevent) + { + event.type = GenericEvent; + event.extension = IReqCode; + event.length = 0; + event.evtype = XI_DevicePropertyNotify; + event.deviceid = dev->id; + event.state = PropertyNewValue; + event.atom = prop->propertyName; + event.time = currentTime.milliseconds; + SendEventToAllWindows(dev, XI_DevicePropertyNotifyMask, + (xEvent*)&event, 1); + } + return(Success); +} + +XIPropertyPtr +XIQueryDeviceProperty (DeviceIntPtr dev, Atom property) +{ + XIPropertyPtr prop; + + for (prop = dev->properties.properties; prop; prop = prop->next) + if (prop->propertyName == property) + return prop; + return NULL; +} + +XIPropertyValuePtr +XIGetDeviceProperty (DeviceIntPtr dev, Atom property, Bool pending) +{ + XIPropertyPtr prop = XIQueryDeviceProperty (dev, property); + + if (!prop) + return NULL; + if (pending && prop->is_pending) + return &prop->pending; + else { + /* If we can, try to update the property value first */ + if (dev->properties.handlers) + { + XIPropertyHandlerPtr handler = dev->properties.handlers; + while(handler) + { + if (handler->GetProperty) + handler->GetProperty(dev, prop->propertyName); + handler = handler->next; + } + } + return &prop->current; + } +} + +int +XIConfigureDeviceProperty (DeviceIntPtr dev, Atom property, + Bool pending, Bool range, Bool immutable, + int num_values, INT32 *values) +{ + XIPropertyPtr prop = XIQueryDeviceProperty (dev, property); + Bool add = FALSE; + INT32 *new_values; + + if (!prop) + { + prop = XICreateDeviceProperty (property); + if (!prop) + return(BadAlloc); + add = TRUE; + } else if (prop->immutable && !immutable) + return(BadAccess); + + /* + * ranges must have even number of values + */ + if (range && (num_values & 1)) + return BadMatch; + + new_values = xalloc (num_values * sizeof (INT32)); + if (!new_values && num_values) + return BadAlloc; + if (num_values) + memcpy (new_values, values, num_values * sizeof (INT32)); + + /* + * Property moving from pending to non-pending + * loses any pending values + */ + if (prop->is_pending && !pending) + { + if (prop->pending.data) + xfree (prop->pending.data); + XIInitDevicePropertyValue (&prop->pending); + } + + prop->is_pending = pending; + prop->range = range; + prop->immutable = immutable; + prop->num_valid = num_values; + if (prop->valid_values) + xfree (prop->valid_values); + prop->valid_values = new_values; + + if (add) { + prop->next = dev->properties.properties; + dev->properties.properties = prop; + } + + return Success; +} + +int +ProcXListDeviceProperties (ClientPtr client) +{ + Atom *pAtoms = NULL, *temppAtoms; + xListDevicePropertiesReply rep; + int numProps = 0; + DeviceIntPtr dev; + XIPropertyPtr prop; + int rc = Success; + + REQUEST(xListDevicePropertiesReq); + REQUEST_SIZE_MATCH(xListDevicePropertiesReq); + + rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess); + if (rc != Success) + return rc; + + for (prop = dev->properties.properties; prop; prop = prop->next) + numProps++; + if (numProps) + if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom)))) + return(BadAlloc); + + rep.repType = X_Reply; + rep.RepType = X_ListDeviceProperties; + rep.length = (numProps * sizeof(Atom)) >> 2; + rep.sequenceNumber = client->sequence; + rep.nAtoms = numProps; + if (client->swapped) + { + int n; + swaps (&rep.sequenceNumber, n); + swapl (&rep.length, n); + } + temppAtoms = pAtoms; + for (prop = dev->properties.properties; prop; prop = prop->next) + *temppAtoms++ = prop->propertyName; + + WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep); + if (numProps) + { + client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; + WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); + xfree(pAtoms); + } + return rc; +} + +int +ProcXQueryDeviceProperty (ClientPtr client) +{ + REQUEST(xQueryDevicePropertyReq); + xQueryDevicePropertyReply rep; + DeviceIntPtr dev; + XIPropertyPtr prop; + int rc; + + REQUEST_SIZE_MATCH(xQueryDevicePropertyReq); + + rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess); + + if (rc != Success) + return rc; + + prop = XIQueryDeviceProperty (dev, stuff->property); + if (!prop) + return BadName; + + rep.repType = X_Reply; + rep.length = prop->num_valid; + rep.sequenceNumber = client->sequence; + rep.pending = prop->is_pending; + rep.range = prop->range; + rep.immutable = prop->immutable; + rep.fromClient = prop->fromClient; + if (client->swapped) + { + int n; + swaps (&rep.sequenceNumber, n); + swapl (&rep.length, n); + } + WriteReplyToClient (client, sizeof (xQueryDevicePropertyReply), &rep); + if (prop->num_valid) + { + client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; + WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32), + prop->valid_values); + } + return(client->noClientException); +} + +int +ProcXConfigureDeviceProperty (ClientPtr client) +{ + REQUEST(xConfigureDevicePropertyReq); + DeviceIntPtr dev; + int num_valid; + int rc; + + REQUEST_AT_LEAST_SIZE(xConfigureDevicePropertyReq); + + rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess); + + if (rc != Success) + return rc; + + num_valid = stuff->length - (sizeof (xConfigureDevicePropertyReq) >> 2); + return XIConfigureDeviceProperty (dev, stuff->property, + stuff->pending, stuff->range, + FALSE, num_valid, + (INT32 *) (stuff + 1)); +} + +int +ProcXChangeDeviceProperty (ClientPtr client) +{ + REQUEST(xChangeDevicePropertyReq); + DeviceIntPtr dev; + char format, mode; + unsigned long len; + int sizeInBytes; + int totalSize; + int rc; + + REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq); + UpdateCurrentTime(); + format = stuff->format; + mode = stuff->mode; + if ((mode != PropModeReplace) && (mode != PropModeAppend) && + (mode != PropModePrepend)) + { + client->errorValue = mode; + return BadValue; + } + if ((format != 8) && (format != 16) && (format != 32)) + { + client->errorValue = format; + return BadValue; + } + len = stuff->nUnits; + if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2)) + return BadLength; + sizeInBytes = format>>3; + totalSize = len * sizeInBytes; + REQUEST_FIXED_SIZE(xChangeDevicePropertyReq, totalSize); + + rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess); + if (rc != Success) + return rc; + + if (!ValidAtom(stuff->property)) + { + client->errorValue = stuff->property; + return(BadAtom); + } + if (!ValidAtom(stuff->type)) + { + client->errorValue = stuff->type; + return(BadAtom); + } + + rc = XIChangeDeviceProperty(dev, stuff->property, + stuff->type, (int)format, + (int)mode, len, (pointer)&stuff[1], TRUE, + TRUE, TRUE); + + return rc; +} + +int +ProcXDeleteDeviceProperty (ClientPtr client) +{ + REQUEST(xDeleteDevicePropertyReq); + DeviceIntPtr dev; + int rc; + + REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq); + UpdateCurrentTime(); + rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess); + if (rc != Success) + return rc; + + if (!ValidAtom(stuff->property)) + { + client->errorValue = stuff->property; + return (BadAtom); + } + + + rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE); + return rc; +} + +int +ProcXGetDeviceProperty (ClientPtr client) +{ + REQUEST(xGetDevicePropertyReq); + XIPropertyPtr prop, *prev; + XIPropertyValuePtr prop_value; + unsigned long n, len, ind; + DeviceIntPtr dev; + xGetDevicePropertyReply reply; + int rc; + + REQUEST_SIZE_MATCH(xGetDevicePropertyReq); + if (stuff->delete) + UpdateCurrentTime(); + rc = dixLookupDevice (&dev, stuff->deviceid, client, + stuff->delete ? DixWriteAccess : + DixReadAccess); + if (rc != Success) + return rc; + + if (!ValidAtom(stuff->property)) + { + client->errorValue = stuff->property; + return(BadAtom); + } + if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) + { + client->errorValue = stuff->delete; + return(BadValue); + } + if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type)) + { + client->errorValue = stuff->type; + return(BadAtom); + } + + for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next) + if (prop->propertyName == stuff->property) + break; + + reply.repType = X_Reply; + reply.RepType = X_GetDeviceProperty; + reply.sequenceNumber = client->sequence; + reply.deviceid = dev->id; + if (!prop) + { + reply.nItems = 0; + reply.length = 0; + reply.bytesAfter = 0; + reply.propertyType = None; + reply.format = 0; + WriteReplyToClient(client, sizeof(xGetDevicePropertyReply), &reply); + return(client->noClientException); + } + + if (prop->immutable && stuff->delete) + return BadAccess; + + prop_value = XIGetDeviceProperty(dev, stuff->property, stuff->pending); + if (!prop_value) + return BadAtom; + + /* If the request type and actual type don't match. Return the + property information, but not the data. */ + + if (((stuff->type != prop_value->type) && + (stuff->type != AnyPropertyType)) + ) + { + reply.bytesAfter = prop_value->size; + reply.format = prop_value->format; + reply.length = 0; + reply.nItems = 0; + reply.propertyType = prop_value->type; + WriteReplyToClient(client, sizeof(xGetDevicePropertyReply), &reply); + return(client->noClientException); + } + +/* + * Return type, format, value to client + */ + n = (prop_value->format/8) * prop_value->size; /* size (bytes) of prop */ + ind = stuff->longOffset << 2; + + /* If longOffset is invalid such that it causes "len" to + be negative, it's a value error. */ + + if (n < ind) + { + client->errorValue = stuff->longOffset; + return BadValue; + } + + len = min(n - ind, 4 * stuff->longLength); + + reply.bytesAfter = n - (ind + len); + reply.format = prop_value->format; + reply.length = (len + 3) >> 2; + if (prop_value->format) + reply.nItems = len / (prop_value->format / 8); + else + reply.nItems = 0; + reply.propertyType = prop_value->type; + + if (stuff->delete && (reply.bytesAfter == 0)) + { + devicePropertyNotifyEvent event; + + event.type = GenericEvent; + event.extension = IReqCode; + event.length = 0; + event.evtype = XI_DevicePropertyNotify; + event.deviceid = dev->id; + event.state = PropertyDelete; + event.atom = prop->propertyName; + event.time = currentTime.milliseconds; + SendEventToAllWindows(dev, XI_DevicePropertyNotifyMask, + (xEvent*)&event, 1); + } + + WriteReplyToClient(client, sizeof(xGenericReply), &reply); + if (len) + { + switch (reply.format) { + case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break; + case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break; + default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break; + } + WriteSwappedDataToClient(client, len, + (char *)prop_value->data + ind); + } + + if (stuff->delete && (reply.bytesAfter == 0)) + { /* delete the Property */ + *prev = prop->next; + XIDestroyDeviceProperty (prop); + } + return(client->noClientException); +} + + +int +SProcXListDeviceProperties (ClientPtr client) +{ + REQUEST(xListDevicePropertiesReq); + + REQUEST_SIZE_MATCH(xListDevicePropertiesReq); + (void) stuff; + return BadImplementation; +} + +int +SProcXQueryDeviceProperty (ClientPtr client) +{ + REQUEST(xQueryDevicePropertyReq); + + REQUEST_SIZE_MATCH(xQueryDevicePropertyReq); + (void) stuff; + return BadImplementation; +} + +int +SProcXConfigureDeviceProperty (ClientPtr client) +{ + REQUEST(xConfigureDevicePropertyReq); + + REQUEST_SIZE_MATCH(xConfigureDevicePropertyReq); + (void) stuff; + return BadImplementation; +} + +int +SProcXChangeDeviceProperty (ClientPtr client) +{ + REQUEST(xChangeDevicePropertyReq); + + REQUEST_SIZE_MATCH(xChangeDevicePropertyReq); + (void) stuff; + return BadImplementation; +} + +int +SProcXDeleteDeviceProperty (ClientPtr client) +{ + REQUEST(xDeleteDevicePropertyReq); + + REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq); + (void) stuff; + return BadImplementation; +} + +int +SProcXGetDeviceProperty (ClientPtr client) +{ + REQUEST(xGetDevicePropertyReq); + + REQUEST_SIZE_MATCH(xGetDevicePropertyReq); + (void) stuff; + return BadImplementation; +} + diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h new file mode 100644 index 000000000..47ba0eae3 --- /dev/null +++ b/Xi/xiproperty.h @@ -0,0 +1,45 @@ +/* + * Copyright © 2008 Peter Hutterer + * + * 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Author: Peter Hutterer + */ + +#ifndef XIPROPERTY_C +#define XIPROPERTY_C + +int ProcXListDeviceProperties (ClientPtr client); +int ProcXQueryDeviceProperty (ClientPtr client); +int ProcXConfigureDeviceProperty (ClientPtr client); +int ProcXChangeDeviceProperty (ClientPtr client); +int ProcXDeleteDeviceProperty (ClientPtr client); +int ProcXGetDeviceProperty (ClientPtr client); + +int SProcXListDeviceProperties (ClientPtr client); +int SProcXQueryDeviceProperty (ClientPtr client); +int SProcXConfigureDeviceProperty (ClientPtr client); +int SProcXChangeDeviceProperty (ClientPtr client); +int SProcXDeleteDeviceProperty (ClientPtr client); +int SProcXGetDeviceProperty (ClientPtr client); + +void XIInitKnownProperties(void); + +#endif /* XIPROPERTY_C */ diff --git a/composite/compalloc.c b/composite/compalloc.c index 0372b9bfa..19c7db0b3 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -82,6 +82,9 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) return Success; } + if (!pWin->parent) + return BadMatch; + /* * Only one Manual update is allowed */ diff --git a/config/Makefile.am b/config/Makefile.am index 056f30ed0..1e7c501c3 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -3,7 +3,7 @@ AM_CFLAGS = @DIX_CFLAGS@ noinst_LIBRARIES = libconfig.a libconfig_a_SOURCES = config.c config-backends.h -if HAVE_DBUS +if CONFIG_NEED_DBUS AM_CFLAGS += @DBUS_CFLAGS@ libconfig_a_SOURCES += dbus-core.c endif diff --git a/config/config-backends.h b/config/config-backends.h index ce0e5e436..907e86b9c 100644 --- a/config/config-backends.h +++ b/config/config-backends.h @@ -27,7 +27,7 @@ #include #endif -#ifdef HAVE_DBUS +#ifdef CONFIG_NEED_DBUS #include typedef void (*config_dbus_core_connect_hook)(DBusConnection *connection, diff --git a/config/hal.c b/config/hal.c index f4eb438ea..b6d7402a6 100644 --- a/config/hal.c +++ b/config/hal.c @@ -262,17 +262,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) * Since we can't predict the order in which the keys * arrive, we need to store them. */ -#ifndef HAVE_STRCASESTR - int psi_key_len = strlen(psi_key); - char *lower_psi_key = xalloc(psi_key_len + 1); - - CopyISOLatin1Lowered((unsigned char *) lower_psi_key, - (unsigned char *) psi_key, - psi_key_len); - if ((tmp = strstr(lower_psi_key, "xkb"))) -#else if ((tmp = strcasestr(psi_key, "xkb"))) -#endif { if (!strcasecmp(&tmp[3], "layout")) { @@ -301,9 +291,6 @@ device_added(LibHalContext *hal_ctx, const char *udi) add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val); xfree(tmp_val); } -#ifndef HAVE_STRCASESTR - xfree(lower_psi_key); -#endif } } else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){ diff --git a/configure.ac b/configure.ac index 2bc16e5f4..b876bb5f1 100644 --- a/configure.ac +++ b/configure.ac @@ -127,6 +127,7 @@ AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="n if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then AC_MSG_CHECKING([for __swap16 variant of byteswapping macros]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include #include ], [ int a = 1, b; @@ -137,6 +138,7 @@ b = __swap16(a); AC_MSG_CHECKING([for bswap16 variant of byteswapping macros]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include #include ], [ int a = 1, b; @@ -174,19 +176,6 @@ dnl has it in libc), or if libdl is needed to get it. AC_CHECK_FUNC([dlopen], [], AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl")) -case $host_os in - linux*|darwin*) - AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom]) ;; - freebsd*|netbsd*|openbsd*|dragonfly*) - AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom]) ;; - solaris*) - # Solaris 8 with patches, or Solaris 9 or later have /dev/urandom - if test -r /dev/urandom ; then - AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom]) - fi ;; - *) ;; -esac - dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ @@ -262,6 +251,8 @@ AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes]) AC_CACHE_CHECK([for SYSV IPC], ac_cv_sysv_ipc, [AC_TRY_LINK([ +#include +#include #include ],[ { @@ -379,7 +370,7 @@ case $host_os in AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console]) AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console]) DRI=yes - PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no) + PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no) ;; *netbsd*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) @@ -387,7 +378,7 @@ case $host_os in AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console]) AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console]) DRI=yes - PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no) + PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no) ;; *openbsd*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) @@ -396,7 +387,7 @@ case $host_os in ;; *linux*) DRI=yes - PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no) + PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no) KDRIVE_HW=yes ;; *solaris*) @@ -422,7 +413,7 @@ VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}" VENDOR_NAME="The X.Org Foundation" VENDOR_NAME_SHORT="X.Org" -RELEASE_DATE="5 September 2007" +RELEASE_DATE="(unreleased)" VENDOR_WEB="http://wiki.x.org" m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))]) @@ -503,9 +494,9 @@ AC_ARG_ENABLE(install-libxf86config, [Install libxf86config (default: disabled)]), [INSTALL_LIBXF86CONFIG=$enableval], [INSTALL_LIBXF86CONFIG=no]) -AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]), +AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: yes)]), [BUILTIN_FONTS=$enableval], - [BUILTIN_FONTS=no]) + [BUILTIN_FONTS=yes]) AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]), [NULL_ROOT_CURSOR=$enableval], [NULL_ROOT_CURSOR=no]) @@ -529,7 +520,6 @@ AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes]) AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes]) AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes]) -AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes]) AC_ARG_ENABLE(record, AS_HELP_STRING([--enable-record], [Build Record extension (default: disabled)]), [RECORD=$enableval], [RECORD=no]) AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes]) AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes]) @@ -542,7 +532,6 @@ AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extensio AC_ARG_ENABLE(dri2, AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval]) AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes]) AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto]) -AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto]) AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes]) AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--disable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no]) AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no]) @@ -550,9 +539,8 @@ AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCali AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no]) AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes]) AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no]) -AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCache extension (default: disabled)]), [FONTCACHE=$enableval], [FONTCACHE=no]) AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes]) -AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=auto]) +AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no]) AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes]) AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no]) AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto]) @@ -565,8 +553,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]) -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]) @@ -662,8 +648,6 @@ case $host_os in COMPOSITE=no DGA=no DPMSExtension=no - XF86BIGFONT=no - XF86MISC=no XF86VIDMODE=no fi ;; @@ -677,14 +661,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la' XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' dnl Core modules for most extensions, et al. -# Require updated renderproto for ABI sanity if we're 64-bit. -if test "$ac_cv_sizeof_unsigned_long" = 8; then - RENDERPROTO="[renderproto >= 0.9.3]" -else - RENDERPROTO="renderproto" -fi - -REQUIRED_MODULES="[randrproto >= 1.2] $RENDERPROTO [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.1] [kbproto >= 1.0.3]" +REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.1] [kbproto >= 1.0.3]" REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.9.5]" dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas @@ -705,7 +682,7 @@ if test "x$CONFIG_DBUS_API" = xyes; then fi AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API]) - NEED_DBUS="yes" + CONFIG_NEED_DBUS="yes" fi AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes]) @@ -720,13 +697,15 @@ if test "x$CONFIG_HAL" = xyes; then AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API]) REQUIRED_LIBS="$REQUIRED_LIBS hal" - NEED_DBUS="yes" + CONFIG_NEED_DBUS="yes" fi AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes]) -if test "x$NEED_DBUS" = xyes; then +if test "x$CONFIG_NEED_DBUS" = xyes; then REQUIRED_LIBS="$REQUIRED_LIBS dbus-1" + AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug]) fi +AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes]) CONFIG_LIB='$(top_builddir)/config/libconfig.a' AC_MSG_CHECKING([for glibc...]) @@ -827,13 +806,6 @@ if test "x$MITSHM" = xyes; then AC_DEFINE(HAS_SHM, 1, [Support SHM]) fi -AM_CONDITIONAL(XTRAP, [test "x$XTRAP" = xyes]) -if test "x$XTRAP" = xyes; then - AC_DEFINE(XTRAP, 1, [Support XTrap extension]) - REQUIRED_MODULES="$REQUIRED_MODULES trapproto" - XTRAP_LIB='$(top_builddir)/XTrap/libxtrap.la' -fi - AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes]) if test "x$RECORD" = xyes; then AC_DEFINE(XRECORD, 1, [Support Record extension]) @@ -883,7 +855,7 @@ if test "x$DRI" = xyes; then AC_DEFINE(XF86DRI, 1, [Build DRI extension]) PKG_CHECK_MODULES([DRIPROTO], [xf86driproto]) PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0]) - PKG_CHECK_MODULES([GL], [glproto >= 1.4.1 gl >= 7.1.0]) + PKG_CHECK_MODULES([GL], [glproto >= 1.4.1 dri >= 7.1.0]) PKG_CHECK_EXISTS(libdrm >= 2.2.0, [AC_DEFINE([HAVE_LIBDRM_2_2], 1, [Has version 2.2 (or newer) of the drm library])]) @@ -898,7 +870,7 @@ if test "x$DRI2" = xyes; then # FIXME: Bump the versions once we have releases of these. AC_DEFINE(DRI2, 1, [Build DRI2 extension]) PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1]) - PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1]) + PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.2]) fi AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes]) @@ -946,12 +918,6 @@ if test "x$MULTIBUFFER" = xyes; then # Requires xextproto which is always required fi -AM_CONDITIONAL(FONTCACHE, [test "x$FONTCACHE" = xyes]) -if test "x$FONTCACHE" = xyes; then - AC_DEFINE(FONTCACHE, 1, [Build FontCache extension]) - REQUIRED_MODULES="$REQUIRED_MODULES fontcacheproto" -fi - AM_CONDITIONAL(DBE, [test "x$DBE" = xyes]) if test "x$DBE" = xyes; then AC_DEFINE(DBE, 1, [Support DBE extension]) @@ -970,7 +936,6 @@ fi if test "x$BUILTIN_FONTS" = xyes; then AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts]) - AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server]) FONTPATH="built-ins" fi @@ -1019,6 +984,8 @@ AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1, [Do not have 'strcasecmp'.])) AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1, [Do not have 'strncasecmp'.])) +AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1, + [Do not have 'strcasestr'.])) if test "x$NULL_ROOT_CURSOR" = xyes; then AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor]) @@ -1083,8 +1050,6 @@ AC_SUBST([VENDOR_NAME_SHORT]) AC_SUBST([VENDOR_RELEASE]) AC_SUBST([VENDOR_MAN_VERSION]) -AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit]) -AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display]) AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler]) AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper]) @@ -1114,26 +1079,30 @@ MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow' MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la' CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include' -PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS]) -PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS]) - # OpenSSL used for SHA1 hashing in render/glyph.c, but we don't need all of # the OpenSSL libraries, just libcrypto # Some systems have matching functionality in the smaller/simpler libmd # Builders who want to force a choice can set SHA1_LIB and SHA1_CFLAGS if test "x$SHA1_LIB" = "x" ; then - AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIB="-lmd" - AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1], - [Define to use libmd SHA1 functions instead of OpenSSL libcrypto])]) + AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIB="-lmd" + AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1], + [Use libmd SHA1 functions instead of OpenSSL libcrypto])]) fi + if test "x$SHA1_LIB" = "x" ; then - PKG_CHECK_EXISTS([openssl], - [PKG_CHECK_MODULES([OPENSSL], [openssl], - [OPENSSL_LIB_FLAGS=`$PKG_CONFIG --libs-only-L --libs-only-other openssl`])]) - SHA1_LIB="$OPENSSL_LIB_FLAGS -lcrypto" - SHA1_CFLAGS="$OPENSSL_CFLAGS" + PKG_CHECK_EXISTS([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes], + [HAVE_OPENSSL_PKC=no]) + if test "x$HAVE_OPENSSL_PKC" = xyes; then + REQUIRED_LIBS="$REQUIRED_LIBS openssl" + else + AC_CHECK_LIB([crypto], [SHA1_Init], [SHA1_LIB="-lcrypto"], + [AC_MSG_ERROR([OpenSSL must be installed in order to build the X server.])]) + fi fi +PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS]) +PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS]) + # Autotools has some unfortunate issues with library handling. In order to # get a server to rebuild when a dependency in the tree is changed, it must # be listed in SERVERNAME_DEPENDENCIES. However, no system libraries may be @@ -1218,8 +1187,8 @@ AC_MSG_RESULT([$XVFB]) AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes]) if test "x$XVFB" = xyes; then - XVFB_LIBS="$FB_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 $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB" - XVFB_SYS_LIBS="$XVFBMODULES_LIBS" + XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB" + XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XVFB_LIBS]) AC_SUBST([XVFB_SYS_LIBS]) fi @@ -1236,8 +1205,8 @@ AC_MSG_RESULT([$XNEST]) AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes]) if test "x$XNEST" = xyes; then - XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB" - XNEST_SYS_LIBS="$XNESTMODULES_LIBS" + XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB" + XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS" AC_SUBST([XNEST_LIBS]) AC_SUBST([XNEST_SYS_LIBS]) fi @@ -1361,8 +1330,6 @@ if test "x$XORG" = xyes; then ;; alpha*) linux_alpha=yes - XORG_OS_PCI="axp" - xorg_bus_linuxpci="no" ;; i*86|amd64*|x86_64*) linux_acpi="yes" @@ -1488,15 +1455,6 @@ if test "x$XORG" = xyes; then AC_DEFINE(XFreeXDGA, 1, [Build XDGA support]) fi - if test "x$XF86MISC" = xauto; then - PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no]) - fi - if test "x$XF86MISC" = xyes; then - XORG_MODULES="$XORG_MODULES xf86miscproto" - PKG_CHECK_MODULES(XF86MISC, xf86miscproto) - AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions]) - fi - if test "x$XF86VIDMODE" = xauto; then PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no]) fi @@ -1586,18 +1544,8 @@ AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes]) AM_CONDITIONAL([SOLARIS_USL_CONSOLE], [test "x$solaris_usl_console" = xyes]) AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes]) 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]) @@ -1639,19 +1587,12 @@ if test "x$XWIN" = xyes; then AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager]) fi - AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit]) - AC_DEFINE(DDXTIME, 1, [Use GetTimeInMillis]) - AC_DEFINE(DDXOSFATALERROR, 1, [Use OsVendorFatalError]) AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF]) AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ]) if test "x$XF86VIDMODE" = xyes; then AC_MSG_NOTICE([Disabling XF86VidMode extension]) XF86VIDMODE=no fi - if test "x$XF86MISC" = xyes; then - AC_MSG_NOTICE([Disabling XF86Misc extension]) - XF86MISC=no - fi if test "x$COMPOSITE" = xyes; then AC_MSG_NOTICE([Disabling Composite extension]) COMPOSITE=no @@ -1673,7 +1614,7 @@ if test "x$XQUARTZ" = xyes; then AC_DEFINE(ROOTLESS,1,[Build Rootless code]) DARWIN_GLX_LIBS='$(top_builddir)/hw/xquartz/GL/libCGLCore.la $(top_builddir)/glx/libglx.la' - DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS" + DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS" AC_SUBST([DARWIN_LIBS]) AC_CHECK_LIB([Xplugin],[xp_init],[:]) @@ -1715,9 +1656,9 @@ if test "x$DMX" = xyes; then AC_MSG_ERROR([Xdmx build explicitly requested, but required modules not found.]) fi - DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC" + DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC" XDMX_CFLAGS="$DMXMODULES_CFLAGS" - XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" + XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" XDMX_SYS_LIBS="$DMXMODULES_LIBS" AC_SUBST([XDMX_CFLAGS]) AC_SUBST([XDMX_LIBS]) @@ -1843,7 +1784,7 @@ if test "$KDRIVE" = yes; then KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS" - KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB" + KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB" KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a' case $host_os in *linux*) @@ -1870,7 +1811,6 @@ AC_SUBST([KDRIVE_LOCAL_LIBS]) AC_SUBST([KDRIVE_LIBS]) AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes]) AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes]) -AM_CONDITIONAL(H3600_TS, false) AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes]) AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes]) AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes]) @@ -1901,7 +1841,10 @@ AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir]) AC_SUBST(XKB_COMPILED_DIR) dnl and the rest of these are generic, so they're in config.h -AC_DEFINE(XResExtension, 1, [Build XRes extension]) +dnl +dnl though, thanks to the passing of some significant amount of time, the +dnl above is probably a complete fallacy, and you should not rely on it. +dnl but this is still actually better than imake, honest. -daniels AC_TRY_COMPILE([ #include @@ -1913,20 +1856,13 @@ AC_TRY_COMPILE([ AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix]) -dnl xorgconfig CLI configuration utility -if test "x$XORG" = xyes; then - PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11]) - AC_SUBST(XORGCONFIG_DEP_CFLAGS) - AC_SUBST(XORGCONFIG_DEP_LIBS) -fi - dnl xorgcfg GUI configuration utility AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], [Build xorgcfg GUI configuration utility (default: no)]), [XORGCFG=$enableval],[XORGCFG=no]) if test x$XORGCFG = xyes ; then PKG_CHECK_MODULES([XORGCFG_DEP], - [xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11]) + [xkbui >= 1.0.2 xkbfile xxf86vm xaw7 xmu xt xpm xext x11]) XORGCFG_DEP_CFLAGS="$XORGCFG_DEP_CFLAGS" AC_CHECK_LIB([curses],[waddstr], [XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lcurses"; CURSES=yes], @@ -1992,8 +1928,6 @@ dix/Makefile doc/Makefile fb/Makefile record/Makefile -XTrap/Makefile -mfb/Makefile config/Makefile mi/Makefile miext/Makefile @@ -2038,21 +1972,16 @@ hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/linux/Makefile -hw/xfree86/os-support/lynxos/Makefile hw/xfree86/os-support/sco/Makefile hw/xfree86/os-support/solaris/Makefile hw/xfree86/os-support/sysv/Makefile -hw/xfree86/os-support/usl/Makefile hw/xfree86/parser/Makefile -hw/xfree86/rac/Makefile hw/xfree86/ramdac/Makefile hw/xfree86/shadowfb/Makefile 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 @@ -2060,7 +1989,6 @@ hw/xfree86/utils/gtf/Makefile hw/xfree86/utils/ioport/Makefile hw/xfree86/utils/kbd_mode/Makefile hw/xfree86/utils/xorgcfg/Makefile -hw/xfree86/utils/xorgconfig/Makefile hw/dmx/config/Makefile hw/dmx/doc/Makefile hw/dmx/examples/Makefile diff --git a/dix/Makefile.am b/dix/Makefile.am index 9320a2d65..45da45fcb 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -28,6 +28,7 @@ libdix_la_SOURCES = \ pixmap.c \ privates.c \ property.c \ + ptrveloc.c \ registry.c \ resource.c \ selection.c \ @@ -35,7 +36,8 @@ libdix_la_SOURCES = \ swapreq.c \ tables.c \ window.c \ - strcasecmp.c + strcasecmp.c \ + strcasestr.c EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in diff --git a/dix/devices.c b/dix/devices.c index c83f2fc9f..1cde5c09a 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -57,11 +57,13 @@ SOFTWARE. #define NEED_EVENTS #define NEED_REPLIES #include +#include #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" #include "cursorstr.h" #include "dixstruct.h" +#include "ptrveloc.h" #include "site.h" #ifndef XKB_IN_SERVER #define XKB_IN_SERVER @@ -76,12 +78,14 @@ SOFTWARE. #include "dispatch.h" #include "swaprep.h" #include "dixevents.h" +#include "mipointer.h" #include #include #include "exglobals.h" #include "exevents.h" #include "listdev.h" /* for CopySwapXXXClass */ +#include "xiproperty.h" /** @file * This file handles input device-related stuff. @@ -91,6 +95,30 @@ DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey; /* Used to sture classes currently not in use by an MD */ DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKey; + +/** + * DIX property handler. + */ +static Bool +DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop) +{ + if (property == XIGetKnownProperty(XI_PROP_ENABLED)) + { + if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1) + return FALSE; + + if ((*((CARD8*)prop->data)) && !dev->enabled) + EnableDevice(dev); + else if (!(*((CARD8*)prop->data)) && dev->enabled) + DisableDevice(dev); + return TRUE; + } + + return TRUE; +} + + + /** * Create a new input device and init it to sane values. The device is added * to the server's off_devices list. @@ -170,8 +198,14 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) /* last valuators */ memset(dev->last.valuators, 0, sizeof(dev->last.valuators)); + memset(dev->last.remainder, 0, sizeof(dev->last.remainder)); dev->last.numValuators = 0; + /* device properties */ + dev->properties.properties = NULL; + dev->properties.pendingProperties = FALSE; + dev->properties.handlers = NULL; + /* security creation/labeling check */ if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) { @@ -186,6 +220,11 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart) *prev = dev; dev->next = NULL; + XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), + XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, + FALSE, FALSE, FALSE); + XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL); + return dev; } @@ -257,6 +296,7 @@ EnableDevice(DeviceIntPtr dev) mieqResizeEvents(evsize); OsReleaseSignals(); + if ((*prev != dev) || !dev->inited || ((ret = (*dev->deviceProc)(dev, DEVICE_ON)) != Success)) { ErrorF("[dix] couldn't enable device %d\n", dev->id); @@ -270,11 +310,15 @@ EnableDevice(DeviceIntPtr dev) *prev = dev; dev->next = NULL; + XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), + XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, + TRUE, FALSE, FALSE); + ev.type = DevicePresenceNotify; ev.time = currentTime.milliseconds; ev.devchange = DeviceEnabled; ev.deviceid = dev->id; - dummyDev.id = 0; + dummyDev.id = MAX_DEVICES; SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, (xEvent *) &ev, 1); @@ -334,11 +378,15 @@ DisableDevice(DeviceIntPtr dev) dev->next = inputInfo.off_devices; inputInfo.off_devices = dev; + XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED), + XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled, + TRUE, FALSE, FALSE); + ev.type = DevicePresenceNotify; ev.time = currentTime.milliseconds; ev.devchange = DeviceDisabled; ev.deviceid = dev->id; - dummyDev.id = 0; + dummyDev.id = MAX_DEVICES; SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, (xEvent *) &ev, 1); @@ -378,6 +426,7 @@ ActivateDevice(DeviceIntPtr dev) ev.deviceid = dev->id; memset(&dummyDev, 0, sizeof(DeviceIntRec)); + dummyDev.id = MAX_DEVICES; SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, (xEvent *) &ev, 1); @@ -768,6 +817,8 @@ CloseDevice(DeviceIntPtr dev) if (!dev) return; + XIDeleteAllDeviceProperties(dev); + if (dev->inited) (void)(*dev->deviceProc)(dev, DEVICE_CLOSE); @@ -775,6 +826,10 @@ CloseDevice(DeviceIntPtr dev) if (dev->isMaster && dev->spriteInfo->sprite) screen->DeviceCursorCleanup(dev, screen); + /* free acceleration info */ + if(dev->valuator && dev->valuator->accelScheme.AccelCleanupProc) + dev->valuator->accelScheme.AccelCleanupProc(dev); + xfree(dev->name); classes = (ClassesPtr)&dev->key; @@ -936,7 +991,7 @@ RemoveDevice(DeviceIntPtr dev) ev.time = currentTime.milliseconds; ev.devchange = DeviceRemoved; ev.deviceid = deviceid; - dummyDev.id = 0; + dummyDev.id = MAX_DEVICES; SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, (xEvent *) &ev, 1); } @@ -1152,7 +1207,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons, butc->buttonsDown = 0; butc->state = 0; butc->motionMask = 0; - bzero((char *)butc->down, MAP_LENGTH); + bzero((char *)butc->down, sizeof(butc->down)); #ifdef XKB butc->xkb_acts= NULL; #endif @@ -1186,8 +1241,6 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, valc->mode = mode; valc->axes = (AxisInfoPtr)(valc + 1); valc->axisVal = (int *)(valc->axes + numAxes); - valc->dxremaind = 0; - valc->dyremaind = 0; dev->valuator = valc; AllocateMotionHistory(dev); @@ -1199,6 +1252,59 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, } dev->last.numValuators = numAxes; + if(!dev->isMaster) /* master devs do not accelerate */ + InitPointerAccelerationScheme(dev, PtrAccelDefault); + return TRUE; +} + +/* global list of acceleration schemes */ +ValuatorAccelerationRec pointerAccelerationScheme[] = { + {PtrAccelNoOp, NULL, NULL, NULL}, + {PtrAccelPredictable, acceleratePointerPredictable, NULL, AccelerationDefaultCleanup}, + {PtrAccelClassic, acceleratePointerClassic, NULL, NULL}, + {-1, NULL, NULL, NULL} /* terminator */ +}; + +_X_EXPORT Bool +InitPointerAccelerationScheme(DeviceIntPtr dev, + int scheme) +{ + int x, i = -1; + void* data = NULL; + ValuatorClassPtr val; + + if(dev->isMaster) /* bail out if called for master devs */ + return FALSE; + + for(x = 0; pointerAccelerationScheme[x].number >= 0; x++) { + if(pointerAccelerationScheme[x].number == scheme){ + i = x; + break; + } + } + + if(-1 == i) + return FALSE; + + + /* init scheme-specific data */ + switch(scheme){ + case PtrAccelPredictable: + { + DeviceVelocityPtr s; + s = (DeviceVelocityPtr)xalloc(sizeof(DeviceVelocityRec)); + InitVelocityData(s); + data = s; + break; + } + default: + break; + } + + val = dev->valuator; + val->accelScheme = pointerAccelerationScheme[i]; + val->accelScheme.accelData = data; + return TRUE; } @@ -1478,13 +1584,15 @@ SendMappingNotify(DeviceIntPtr pDev, unsigned request, unsigned firstKeyCode, } /* - * n-squared algorithm. n < 255 and don't want to copy the whole thing and - * sort it to do the checking. How often is it called? Just being lazy? + * Check if the given buffer contains elements between low (inclusive) and + * high (inclusive) only. + * + * @return TRUE if the device map is invalid, FALSE otherwise. */ Bool BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval) { - int i, j; + int i; for (i = 0; i < length; i++) if (buff[i]) /* only check non-zero elements */ @@ -1494,12 +1602,6 @@ BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval) *errval = buff[i]; return TRUE; } - for (j = i + 1; j < length; j++) - if (buff[i] == buff[j]) - { - *errval = buff[i]; - return TRUE; - } } return FALSE; } @@ -1733,7 +1835,7 @@ DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n) if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { for (i = 0; i < n; i++) { if ((device->button->map[i + 1] != map[i]) && - BitIsOn(device->button->down, i + 1)) { + device->button->down[i + 1]) { return MappingBusy; } } @@ -1755,6 +1857,7 @@ ProcSetPointerMapping(ClientPtr client) { BYTE *map; int ret; + int i, j; DeviceIntPtr ptr = PickPointer(client); xSetPointerMappingReply rep; REQUEST(xSetPointerMappingReq); @@ -1781,6 +1884,19 @@ ProcSetPointerMapping(ClientPtr client) if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue)) return BadValue; + /* core protocol specs don't allow for duplicate mappings. */ + for (i = 0; i < stuff->nElts; i++) + { + for (j = i + 1; j < stuff->nElts; j++) + { + if (map[i] && map[i] == map[j]) + { + client->errorValue = map[i]; + return BadValue; + } + } + } + ret = DoSetPointerMapping(client, ptr, map, stuff->nElts); if (ret != Success) { rep.success = ret; diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 83b264a29..a1ecbfbbb 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -87,7 +87,7 @@ extern FontPtr defaultFont; static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; static int num_fpes = 0; -_X_EXPORT FPEFunctions *fpe_functions = (FPEFunctions *) 0; +static FPEFunctions *fpe_functions = (FPEFunctions *) 0; static int num_fpe_types = 0; static unsigned char *font_path_string; @@ -97,7 +97,7 @@ static int size_slept_fpes = 0; static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0; static FontPatternCachePtr patternCache; -_X_EXPORT int +static int FontToXError(err) int err; { @@ -117,6 +117,16 @@ FontToXError(err) } } +static int +LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size, + unsigned char *data) +{ + if (fpe_functions[pfont->fpe->type].load_glyphs) + return (*fpe_functions[pfont->fpe->type].load_glyphs) + (client, pfont, 0, nchars, item_size, data); + else + return Successful; +} /* * adding RT_FONT prevents conflict with default cursor font @@ -470,7 +480,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna * * \param value must conform to DeleteType */ -_X_EXPORT int +int CloseFont(pointer value, XID fid) { int nscr; @@ -1879,16 +1889,6 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result) return Success; } -_X_EXPORT int -LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size, unsigned char *data) -{ - if (fpe_functions[pfont->fpe->type].load_glyphs) - return (*fpe_functions[pfont->fpe->type].load_glyphs) - (client, pfont, 0, nchars, item_size, data); - else - return Successful; -} - void DeleteClientFontStuff(ClientPtr client) { @@ -1908,23 +1908,12 @@ InitFonts (void) { patternCache = MakeFontPatternCache(); -#ifndef BUILTIN_FONTS - if (screenInfo.numScreens > screenInfo.numVideoScreens) { - PrinterFontRegisterFpeFunctions(); - FontFileCheckRegisterFpeFunctions(); - check_fs_register_fpe_functions(); - } else -#endif - { #ifdef BUILTIN_FONTS - BuiltinRegisterFpeFunctions(); + BuiltinRegisterFpeFunctions(); #else - FontFileRegisterFpeFunctions(); + FontFileRegisterFpeFunctions(); + fs_register_fpe_functions(); #endif -#ifndef NOFONTSERVERACCESS - fs_register_fpe_functions(); -#endif - } } int diff --git a/dix/events.c b/dix/events.c index 81919737a..b2444829a 100644 --- a/dix/events.c +++ b/dix/events.c @@ -422,7 +422,7 @@ static Mask* generic_filters[MAXEXTENSIONS]; static CARD8 criticalEvents[32] = { - 0x7c /* key and button events */ + 0x7c, 0x30, 0x40 /* key, button, expose, and configure events */ }; #ifdef PANORAMIX @@ -2118,7 +2118,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent /* Handle generic events */ if (type == GenericEvent) { - GenericMaskPtr pClient; + GenericMaskPtr gmask; /* We don't do more than one GenericEvent at a time. */ if (count > 1) { @@ -2132,16 +2132,16 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent return 0; /* run through all clients, deliver event */ - for (pClient = GECLIENT(pWin); pClient; pClient = pClient->next) + for (gmask = GECLIENT(pWin); gmask; gmask = gmask->next) { - if (pClient->eventMask[GEEXTIDX(pEvents)] & filter) + if (gmask->eventMask[GEEXTIDX(pEvents)] & filter) { - if (XaceHook(XACE_RECEIVE_ACCESS, pClient->client, pWin, + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(gmask), pWin, pEvents, count)) /* do nothing */; - else if (TryClientEvents(pClient->client, pDev, + else if (TryClientEvents(rClient(gmask), pDev, pEvents, count, - pClient->eventMask[GEEXTIDX(pEvents)], + gmask->eventMask[GEEXTIDX(pEvents)], filter, grab) > 0) { deliveries++; @@ -2223,7 +2223,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent { GenericClientMasksPtr gemasks = pWin->optional->geMasks; GenericMaskPtr geclient = gemasks->geClients; - while(geclient && geclient->client != client) + while(geclient && rClient(geclient) != client) geclient = geclient->next; if (geclient) { @@ -3389,7 +3389,7 @@ CheckPassiveGrabsOnWindow( else gdev = device; } - if (gdev) + if (gdev && gdev->key) xkbi= gdev->key->xkbInfo; #endif tempGrab.modifierDevice = grab->modifierDevice; @@ -4077,15 +4077,11 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) if (xE->u.u.type != MotionNotify) { int key; - BYTE *kptr; - int bit; XE_KBPTR.rootX = pSprite->hot.x; XE_KBPTR.rootY = pSprite->hot.y; key = xE->u.u.detail; - kptr = &butc->down[key >> 3]; - bit = 1 << (key & 7); switch (xE->u.u.type) { case ButtonPress: @@ -4587,6 +4583,9 @@ DoEnterLeaveEvents(DeviceIntPtr pDev, WindowPtr toWin, int mode) { + if (!IsPointerDevice(pDev)) + return; + if (fromWin == toWin) return; if (IsParent(fromWin, toWin)) @@ -5521,14 +5520,15 @@ InitEvents(void) FatalError("[dix] Failed to allocate input event list.\n"); } -/** - * This function is deprecated! It shouldn't be used anymore. It used to free - * the spriteTraces, but now they are freed when the SpriteRec is freed. - */ -_X_DEPRECATED void +void CloseDownEvents(void) { + int len; + EventListPtr list; + len = GetEventList(&list); + while(len--) + xfree(list[len].event); } /** @@ -6172,6 +6172,10 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) if (events->u.u.type == GenericEvent) { eventlength += ((xGenericEvent*)events)->length * 4; + } + + if(pClient->swapped) + { if (eventlength > swapEventLen) { swapEventLen = eventlength; @@ -6182,10 +6186,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) return; } } - } - if(pClient->swapped) - { for(i = 0; i < count; i++) { eventFrom = &events[i]; @@ -6196,7 +6197,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, eventTo); - (void)WriteToClient(pClient, eventlength, (char *)&eventTo); + (void)WriteToClient(pClient, eventlength, (char *)eventTo); } } else diff --git a/dix/getevents.c b/dix/getevents.c index fc07496f4..5f9b8c151 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -277,7 +277,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start, int size; int dflt; AxisInfo from, *to; /* for scaling */ - CARD32 *ocbuf, *icbuf; /* pointer to coordinates for copying */ + INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */ INT16 *corebuf; AxisInfo core_axis = {0}; @@ -295,7 +295,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start, *buff = xalloc(size * pDev->valuator->numMotionEvents); if (!(*buff)) return 0; - obuff = *buff; + obuff = (char *)*buff; for (i = pDev->valuator->first_motion; i != pDev->valuator->last_motion; @@ -487,80 +487,6 @@ GetMaximumEventsNum(void) { } -/* Originally a part of xf86PostMotionEvent; modifies valuators - * in-place. */ -static void -acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators, - int *valuators) -{ - float mult = 0.0; - int dx = 0, dy = 0; - int *px = NULL, *py = NULL; - - if (!num_valuators || !valuators) - return; - - if (first_valuator == 0) { - dx = valuators[0]; - px = &valuators[0]; - } - if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) { - dy = valuators[1 - first_valuator]; - py = &valuators[1 - first_valuator]; - } - - if (!dx && !dy) - return; - - if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) { - /* modeled from xf86Events.c */ - if (pDev->ptrfeed->ctrl.threshold) { - if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) { - pDev->valuator->dxremaind = ((float)dx * - (float)(pDev->ptrfeed->ctrl.num)) / - (float)(pDev->ptrfeed->ctrl.den) + - pDev->valuator->dxremaind; - if (px) { - *px = (int)pDev->valuator->dxremaind; - pDev->valuator->dxremaind = pDev->valuator->dxremaind - - (float)(*px); - } - - pDev->valuator->dyremaind = ((float)dy * - (float)(pDev->ptrfeed->ctrl.num)) / - (float)(pDev->ptrfeed->ctrl.den) + - pDev->valuator->dyremaind; - if (py) { - *py = (int)pDev->valuator->dyremaind; - pDev->valuator->dyremaind = pDev->valuator->dyremaind - - (float)(*py); - } - } - } - else { - mult = pow((float)dx * (float)dx + (float)dy * (float)dy, - ((float)(pDev->ptrfeed->ctrl.num) / - (float)(pDev->ptrfeed->ctrl.den) - 1.0) / - 2.0) / 2.0; - if (dx) { - pDev->valuator->dxremaind = mult * (float)dx + - pDev->valuator->dxremaind; - *px = (int)pDev->valuator->dxremaind; - pDev->valuator->dxremaind = pDev->valuator->dxremaind - - (float)(*px); - } - if (dy) { - pDev->valuator->dyremaind = mult * (float)dy + - pDev->valuator->dyremaind; - *py = (int)pDev->valuator->dyremaind; - pDev->valuator->dyremaind = pDev->valuator->dyremaind - - (float)(*py); - } - } - } -} - - /** * Clip an axis to its bounds, which are declared in the call to * InitValuatorAxisClassStruct. @@ -696,7 +622,8 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type, return 0; map = pDev->key->curKeySyms.map; - sym = map[key_code * pDev->key->curKeySyms.mapWidth]; + sym = map[(key_code - pDev->key->curKeySyms.minKeyCode) + * pDev->key->curKeySyms.mapWidth]; master = pDev->u.master; if (master && master->u.lastSlave != pDev) @@ -787,7 +714,7 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type, * * @param num_events Number of elements in list. */ -_X_EXPORT EventListPtr +EventListPtr InitEventList(int num_events) { EventListPtr events; @@ -888,6 +815,8 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, int *v0 = NULL, *v1 = NULL; int i; + ms = GetTimeInMillis(); /* before pointer update to help precision */ + /* Sanity checks. */ if (type != MotionNotify && type != ButtonPress && type != ButtonRelease) return 0; @@ -900,8 +829,6 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, if (type == MotionNotify && num_valuators <= 0) return 0; - ms = GetTimeInMillis(); - /* Do we need to send a DeviceValuator event? */ if (num_valuators) { if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS) @@ -951,9 +878,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, } } else { - if (flags & POINTER_ACCELERATE) - acceleratePointer(pDev, first_valuator, num_valuators, - valuators); + if (flags & POINTER_ACCELERATE && + pDev->valuator->accelScheme.AccelSchemeProc){ + pDev->valuator->accelScheme.AccelSchemeProc( + pDev, first_valuator, num_valuators, valuators, ms); + } if(v0) x += *v0; if(v1) y += *v1; @@ -1030,7 +959,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, kbp->type = DeviceButtonPress; else if (type == ButtonRelease) kbp->type = DeviceButtonRelease; - kbp->detail = pDev->button->map[buttons]; + kbp->detail = buttons; } kbp->root_x = cx; /* root_x/y always in screen coords */ diff --git a/dix/main.c b/dix/main.c index e0bb18024..ab6ca5728 100644 --- a/dix/main.c +++ b/dix/main.c @@ -240,7 +240,7 @@ int dix_main(int argc, char *argv[], char *envp[]) int main(int argc, char *argv[], char *envp[]) #endif { - int i, j, k; + int i; char *xauthfile; HWEventQueueType alwaysCheckForInput[2]; @@ -252,10 +252,6 @@ int main(int argc, char *argv[], char *envp[]) CheckUserAuthorization(); -#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS - ExpandCommandLine(&argc, &argv); -#endif - InitConnectionLimits(); /* prep X authority file from environment; this can be overriden by a @@ -309,22 +305,10 @@ int main(int argc, char *argv[], char *envp[]) SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]); screenInfo.arraySize = MAXSCREENS; screenInfo.numScreens = 0; - screenInfo.numVideoScreens = -1; WindowTable = (WindowPtr *)xalloc(MAXSCREENS * sizeof(WindowPtr)); if (!WindowTable) FatalError("couldn't create root window table"); - /* - * Just in case the ddx doesnt supply a format for depth 1 (like qvss). - */ - j = indexForBitsPerPixel[ 1 ]; - k = indexForScanlinePad[ BITMAP_SCANLINE_PAD ]; - PixmapWidthPaddingInfo[1].padRoundUp = BITMAP_SCANLINE_PAD-1; - PixmapWidthPaddingInfo[1].padPixelsLog2 = answer[j][k]; - j = indexForBitsPerPixel[8]; /* bits per byte */ - PixmapWidthPaddingInfo[1].padBytesLog2 = answer[j][k]; - PixmapWidthPaddingInfo[1].bitsPerPixel = 1; - InitAtoms(); InitEvents(); InitSelections(); @@ -339,8 +323,6 @@ int main(int argc, char *argv[], char *envp[]) if (screenInfo.numScreens < 1) FatalError("no screens found"); - if (screenInfo.numVideoScreens < 0) - screenInfo.numVideoScreens = screenInfo.numScreens; InitExtensions(argc, argv); for (i = 0; i < screenInfo.numScreens; i++) { @@ -437,6 +419,7 @@ int main(int argc, char *argv[], char *envp[]) memset(WindowTable, 0, MAXSCREENS * sizeof(WindowPtr)); CloseDownDevices(); + CloseDownEvents(); for (i = screenInfo.numScreens - 1; i >= 0; i--) { diff --git a/dix/privates.c b/dix/privates.c index 47a0e1a29..efb320463 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -39,6 +39,12 @@ from The Open Group. #include "colormapst.h" #include "inputstr.h" +struct _Private { + DevPrivateKey key; + pointer value; + struct _Private *next; +}; + typedef struct _PrivateDesc { DevPrivateKey key; unsigned size; @@ -116,6 +122,65 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) return &ptr->value; } +/* + * Look up a private pointer. + */ +_X_EXPORT pointer +dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key) +{ + PrivateRec *rec = *privates; + pointer *ptr; + + while (rec) { + if (rec->key == key) + return rec->value; + rec = rec->next; + } + + ptr = dixAllocatePrivate(privates, key); + return ptr ? *ptr : NULL; +} + +/* + * Look up the address of a private pointer. + */ +_X_EXPORT pointer * +dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key) +{ + PrivateRec *rec = *privates; + + while (rec) { + if (rec->key == key) + return &rec->value; + rec = rec->next; + } + + return dixAllocatePrivate(privates, key); +} + +/* + * Set a private pointer. + */ +_X_EXPORT int +dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val) +{ + PrivateRec *rec; + + top: + rec = *privates; + while (rec) { + if (rec->key == key) { + rec->value = val; + return TRUE; + } + rec = rec->next; + } + + if (!dixAllocatePrivate(privates, key)) + return FALSE; + goto top; +} + /* * Called to free privates at object deletion time. */ diff --git a/dix/protocol.txt b/dix/protocol.txt index f4cdf7bbb..0a85ca872 100644 --- a/dix/protocol.txt +++ b/dix/protocol.txt @@ -359,16 +359,28 @@ V000 SECURITY:AuthorizationRevoked E000 SECURITY:BadAuthorization E001 SECURITY:BadAuthorizationProtocol R000 SELinux:SELinuxQueryVersion -R001 SELinux:SELinuxSetSelectionManager -R002 SELinux:SELinuxGetSelectionManager +R001 SELinux:SELinuxSetDeviceCreateContext +R002 SELinux:SELinuxGetDeviceCreateContext R003 SELinux:SELinuxSetDeviceContext R004 SELinux:SELinuxGetDeviceContext -R005 SELinux:SELinuxSetPropertyCreateContext -R006 SELinux:SELinuxGetPropertyCreateContext -R007 SELinux:SELinuxGetPropertyContext -R008 SELinux:SELinuxSetWindowCreateContext -R009 SELinux:SELinuxGetWindowCreateContext -R010 SELinux:SELinuxGetWindowContext +R005 SELinux:SELinuxSetWindowCreateContext +R006 SELinux:SELinuxGetWindowCreateContext +R007 SELinux:SELinuxGetWindowContext +R008 SELinux:SELinuxSetPropertyCreateContext +R009 SELinux:SELinuxGetPropertyCreateContext +R010 SELinux:SELinuxSetPropertyUseContext +R011 SELinux:SELinuxGetPropertyUseContext +R012 SELinux:SELinuxGetPropertyContext +R013 SELinux:SELinuxGetPropertyDataContext +R014 SELinux:SELinuxListProperties +R015 SELinux:SELinuxSetSelectionCreateContext +R016 SELinux:SELinuxGetSelectionCreateContext +R017 SELinux:SELinuxSetSelectionUseContext +R018 SELinux:SELinuxGetSelectionUseContext +R019 SELinux:SELinuxGetSelectionContext +R020 SELinux:SELinuxGetSelectionDataContext +R021 SELinux:SELinuxListSelections +R022 SELinux:SELinuxGetClientContext R000 SHAPE:QueryVersion R001 SHAPE:Rectangles R002 SHAPE:Mask diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c new file mode 100644 index 000000000..31747a2ec --- /dev/null +++ b/dix/ptrveloc.c @@ -0,0 +1,770 @@ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +/***************************************************************************** + * Predictable pointer ballistics + * + * 2006-2008 by Simon Thum (simon [dot] thum [at] gmx de) + * + * Serves 3 complementary functions: + * 1) provide a sophisticated ballistic velocity estimate to improve + * the relation between velocity (of the device) and acceleration + * 2) make arbitrary acceleration profiles possible + * 3) decelerate by two means (constant and adaptive) if enabled + * + * Important concepts are the + * + * - Scheme + * which selects the basic algorithm + * (see devices.c/InitPointerAccelerationScheme) + * - Profile + * which returns an acceleration + * for a given velocity + * + * The profile can be selected by the user (potentially at runtime). + * the classic profile is intended to cleanly perform old-style + * function selection (threshold =/!= 0) + * + ****************************************************************************/ + +/* fwds */ +static inline void +FeedFilterStage(FilterStagePtr s, float value, int tdiff); +extern void +InitFilterStage(FilterStagePtr s, float rdecay, int lutsize); +void +CleanupFilterChain(DeviceVelocityPtr s); +int +SetAccelerationProfile(DeviceVelocityPtr s, int profile_num); +void +InitFilterChain(DeviceVelocityPtr s, float rdecay, float degression, + int stages, int lutsize); +void +CleanupFilterChain(DeviceVelocityPtr s); +static float +SimpleSmoothProfile(DeviceVelocityPtr pVel, float threshold, float acc); + + +/******************************** + * Init/Uninit etc + *******************************/ + +/** + * Init struct so it should match the average case + */ +void +InitVelocityData(DeviceVelocityPtr s) +{ + s->lrm_time = 0; + s->velocity = 0; + s->corr_mul = 10.0; /* dots per 10 milisecond should be usable */ + s->const_acceleration = 1.0; /* no acceleration/deceleration */ + s->reset_time = 300; + s->last_dx = 0; + s->last_dy = 0; + s->use_softening = 1; + s->min_acceleration = 1.0; /* don't decelerate */ + s->coupling = 0.2; + s->profile_private = NULL; + memset(&s->statistics, 0, sizeof(s->statistics)); + memset(&s->filters, 0, sizeof(s->filters)); + SetAccelerationProfile(s, 0); + InitFilterChain(s, (float)1.0/20.0, 1, 1, 40); +} + + +/** + * Clean up + */ +static void +FreeVelocityData(DeviceVelocityPtr s){ + CleanupFilterChain(s); + SetAccelerationProfile(s, -1); +} + + +/* + * dix uninit helper, called through scheme + */ +void +AccelerationDefaultCleanup(DeviceIntPtr pDev){ + /*sanity check*/ + if( pDev->valuator->accelScheme.AccelSchemeProc == acceleratePointerPredictable + && pDev->valuator->accelScheme.accelData != NULL){ + pDev->valuator->accelScheme.AccelSchemeProc = NULL; + FreeVelocityData(pDev->valuator->accelScheme.accelData); + xfree(pDev->valuator->accelScheme.accelData); + pDev->valuator->accelScheme.accelData = NULL; + } +} + +/********************* + * Filtering logic + ********************/ + +/** +Initialize a filter chain. +Expected result is a series of filters, each progressively more integrating. +*/ +void +InitFilterChain(DeviceVelocityPtr s, float rdecay, float progression, int stages, int lutsize) +{ + int fn; + if((stages > 1 && progression < 1.0f) || 0 == progression){ + ErrorF("(dix ptracc) invalid filter chain progression specified\n"); + return; + } + for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){ + if(fn < stages){ + InitFilterStage(&s->filters[fn], rdecay, lutsize); + }else{ + InitFilterStage(&s->filters[fn], 0, 0); + } + rdecay /= progression; + } +} + + +void +CleanupFilterChain(DeviceVelocityPtr s) +{ + int fn; + + for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++) + InitFilterStage(&s->filters[fn], 0, 0); +} + + +/** + * Adjust weighting decay and lut in sync + * The weight fn is designed so its integral 0->inf is unity, so we end + * up with a stable (basically IIR) filter. It always draws + * towards its more current input values, which have more weight the older + * the last input value is. + */ +void +InitFilterStage(FilterStagePtr s, float rdecay, int lutsize) +{ + int x; + float *newlut; + float *oldlut; + + s->fading_lut_size = 0; /* prevent access */ + /* mb(); concurrency issues may arise */ + + if(lutsize > 0){ + newlut = xalloc (sizeof(float)* lutsize); + if(!newlut) + return; + for(x = 0; x < lutsize; x++) + newlut[x] = pow(0.5, ((float)x) * rdecay); + }else{ + newlut = NULL; + } + oldlut = s->fading_lut; + s->fading_lut = newlut; + s->rdecay = rdecay; + s->fading_lut_size = lutsize; + s->current = 0; + if(oldlut != NULL) + xfree(oldlut); +} + + +static inline void +FeedFilterChain(DeviceVelocityPtr s, float value, int tdiff) +{ + int fn; + + for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){ + if(s->filters[fn].rdecay != 0) + FeedFilterStage(&s->filters[fn], value, tdiff); + else break; + } +} + + +static inline void +FeedFilterStage(FilterStagePtr s, float value, int tdiff){ + float fade; + if(tdiff < s->fading_lut_size) + fade = s->fading_lut[tdiff]; + else + fade = pow(0.5, ((float)tdiff) * s->rdecay); + s->current *= fade; /* fade out old velocity */ + s->current += value * (1.0f - fade); /* and add up current */ +} + +/** + * Select the most filtered matching result. Also, the first + * mismatching filter will be set to value (coupling). + */ +static inline float +QueryFilterChain( + DeviceVelocityPtr s, + float value, + float maxdiv) +{ + int fn, rfn = 0, cfn = -1; + float cur, result = value; + + /* try to retrieve most integrated result 'within range' + * Assumption: filter are in order least to most integrating */ + for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){ + if(0.0f == s->filters[fn].rdecay) + break; + cur = s->filters[fn].current; + + if (fabs(value - cur) <= 1.0f || + fabs(value - cur) / (value + cur) <= maxdiv){ + result = cur; + rfn = fn; /*remember result determining filter */ + } else if(cfn == -1){ + cfn = fn; /* rememeber first mismatching filter */ + } + } + + s->statistics.filter_usecount[rfn]++; +#ifdef SERIOUS_DEBUGGING + ErrorF("(dix ptraccel) result from filter stage %i, input %.2f, output %.2f\n", rfn, value, result); +#endif + + /* override one current (coupling) so the filter + * catches up quickly. */ + if(cfn != -1) + s->filters[cfn].current = result; + + return result; +} + +/******************************** + * velocity computation + *******************************/ + +/** + * return the axis if mickey is insignificant and axis-aligned, + * -1 otherwise + * 1 for x-axis + * 2 for y-axis + */ +static inline short +GetAxis(int dx, int dy){ + if(dx == 0 || dy == 0){ + if(dx == 1 || dx == -1) + return 1; + if(dy == 1 || dy == -1) + return 2; + return -1; + }else{ + return -1; + } +} + + +/** + * Perform velocity approximation + * return true if non-visible state reset is suggested + */ +static short +ProcessVelocityData(DeviceVelocityPtr s, int dx, int dy, int time) +{ + float cvelocity; + + int diff = time - s->lrm_time; + int cur_ax = GetAxis(dx, dy); + int last_ax = GetAxis(s->last_dx, s->last_dy); + short reset = (diff >= s->reset_time); + + if(cur_ax != last_ax && cur_ax != -1 && last_ax != -1 && !reset){ + /* correct for the error induced when diagonal movements are + reported as alternating axis mickeys */ + dx += s->last_dx; + dy += s->last_dy; + diff += s->last_diff; + s->last_diff = time - s->lrm_time; /* prevent repeating add-up */ +#ifdef SERIOUS_DEBUGGING + ErrorF("(dix ptracc) axial correction\n"); +#endif + }else{ + s->last_diff = diff; + } + + /* + * cvelocity is not a real velocity yet, more a motion delta. contant + * acceleration is multiplied here to make the velocity an on-screen + * velocity (px/t as opposed to [insert unit]/t). This is intended to + * make multiple devices with widely varying ConstantDecelerations respond + * similar to acceleration controls. + */ + cvelocity = (float)sqrt(dx*dx + dy*dy) * s->const_acceleration; + + s->lrm_time = time; + + if (s->reset_time < 0 || diff < 0) { /* disabled or timer overrun? */ + /* simply set velocity from current movement, no reset. */ + s->velocity = cvelocity; + return 0; + } + + if (diff == 0) + diff = 1; /* prevent div-by-zero, though it shouldn't happen anyway*/ + + /* translate velocity to dots/ms (somewhat untractable in integers, + so we multiply by some per-device adjustable factor) */ + cvelocity = cvelocity * s->corr_mul / (float)diff; + + /* short-circuit: when nv-reset the rest can be skipped */ + if(reset == TRUE){ + s->velocity = cvelocity; + return TRUE; + } + + /* feed into filter chain */ + FeedFilterChain(s, cvelocity, diff); + + /* perform coupling and decide final value */ + s->velocity = QueryFilterChain(s, cvelocity, s->coupling); + +#ifdef SERIOUS_DEBUGGING + ErrorF("(dix ptracc) guess: vel=%.3f diff=%d |%i|%i|%i|%i|\n", + s->velocity, diff, + s->statistics.filter_usecount[0], s->statistics.filter_usecount[1], + s->statistics.filter_usecount[2], s->statistics.filter_usecount[3]); +#endif + return reset; +} + + +/** + * this flattens significant ( > 1) mickeys a little bit for more steady + * constant-velocity response + */ +static inline float +ApplySimpleSoftening(int od, int d) +{ + float res = d; + if (d <= 1 && d >= -1) + return res; + if (d > od) + res -= 0.5; + else if (d < od) + res += 0.5; + return res; +} + + +static void +ApplySofteningAndConstantDeceleration( + DeviceVelocityPtr s, + int dx, + int dy, + float* fdx, + float* fdy, + short do_soften) +{ + if (do_soften && s->use_softening) { + *fdx = ApplySimpleSoftening(s->last_dx, dx); + *fdy = ApplySimpleSoftening(s->last_dy, dy); + } else { + *fdx = dx; + *fdy = dy; + } + + *fdx *= s->const_acceleration; + *fdy *= s->const_acceleration; +} + + + +/***************************************** + * Acceleration functions and profiles + ****************************************/ + +/** + * Polynomial function similar previous one, but with f(1) = 1 + */ +static float +PolynomialAccelerationProfile(DeviceVelocityPtr pVel, float ignored, float acc) +{ + return pow(pVel->velocity, (acc - 1.0) * 0.5); +} + + +/** + * returns acceleration for velocity. + * This profile selects the two functions like the old scheme did + */ +static float +ClassicProfile( + DeviceVelocityPtr pVel, + float threshold, + float acc) +{ + + if (threshold) { + return SimpleSmoothProfile (pVel, + threshold, + acc); + } else { + return PolynomialAccelerationProfile (pVel, + 0, + acc); + } +} + + +/** + * Power profile + * This has a completely smooth transition curve, i.e. no jumps in the + * derivatives. + * + * This has the expense of overall response dependency on min-acceleration. + * In effect, min_acceleration mimics const_acceleration in this profile. + */ +static float +PowerProfile( + DeviceVelocityPtr pVel, + float threshold, + float acc) +{ + float vel_dist; + + acc = (acc-1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */ + + if (pVel->velocity <= threshold) + return pVel->min_acceleration; + vel_dist = pVel->velocity - threshold; + return (pow(acc, vel_dist)) * pVel->min_acceleration; +} + + +/** + * just a smooth function in [0..1] -> [0..1] + * - point symmetry at 0.5 + * - f'(0) = f'(1) = 0 + * - starts faster than sinoids, C1 (Cinf if you dare to ignore endpoints) + */ +static inline float +CalcPenumbralGradient(float x){ + x *= 2.0f; + x -= 1.0f; + return 0.5f + (x * sqrt(1.0f - x*x) + asin(x))/M_PI; +} + + +/** + * acceleration function similar to classic accelerated/unaccelerated, + * but with smooth transition in between (and towards zero for adaptive dec.). + */ +static float +SimpleSmoothProfile( + DeviceVelocityPtr pVel, + float threshold, + float acc) +{ + float velocity = pVel->velocity; + if(velocity < 1.0f) + return CalcPenumbralGradient(0.5 + velocity*0.5) * 2.0f - 1.0f; + if(threshold < 1.0f) + threshold = 1.0f; + if (velocity <= threshold) + return 1; + velocity /= threshold; + if (velocity >= acc) + return acc; + else + return 1.0f + (CalcPenumbralGradient(velocity/acc) * (acc - 1.0f)); +} + + +/** + * This profile uses the first half of the penumbral gradient as a start + * and then scales linearly. + */ +static float +SmoothLinearProfile( + DeviceVelocityPtr pVel, + float threshold, + float acc) +{ + if(acc > 1.0f) + acc -= 1.0f; /*this is so acc = 1 is no acceleration */ + else + return 1.0f; + + float nv = (pVel->velocity - threshold) * acc * 0.5f; + float res; + if(nv < 0){ + res = 0; + }else if(nv < 2){ + res = CalcPenumbralGradient(nv*0.25f)*2.0f; + }else{ + nv -= 2.0f; + res = nv * 2.0f / M_PI /* steepness of gradient at 0.5 */ + + 1.0f; /* gradient crosses 2|1 */ + } + res += pVel->min_acceleration; + return res; +} + + +static float +LinearProfile( + DeviceVelocityPtr pVel, + float threshold, + float acc) +{ + return acc * pVel->velocity; +} + + +/** + * Set the profile by number. + * Intended to make profiles exchangeable at runtime. + * If you created a profile, give it a number here to make it selectable. + * In case some profile-specific init is needed, here would be a good place, + * since FreeVelocityData() also calls this with -1. + * returns FALSE (0) if profile number is unknown. + */ +int +SetAccelerationProfile( + DeviceVelocityPtr s, + int profile_num) +{ + PointerAccelerationProfileFunc profile; + switch(profile_num){ + case -1: + profile = NULL; /* Special case to uninit properly */ + break; + case 0: + profile = ClassicProfile; + break; + case 1: + if(NULL == s->deviceSpecificProfile) + return FALSE; + profile = s->deviceSpecificProfile; + break; + case 2: + profile = PolynomialAccelerationProfile; + break; + case 3: + profile = SmoothLinearProfile; + break; + case 4: + profile = SimpleSmoothProfile; + break; + case 5: + profile = PowerProfile; + break; + case 6: + profile = LinearProfile; + break; + default: + return FALSE; + } + if(s->profile_private != NULL){ + /* Here one could free old profile-private data */ + xfree(s->profile_private); + s->profile_private = NULL; + } + /* Here one could init profile-private data */ + s->Profile = profile; + s->statistics.profile_number = profile_num; + return TRUE; +} + +/** + * device-specific profile + * + * The device-specific profile is intended as a hook for a driver + * which may want to provide an own acceleration profile. + * It should not rely on profile-private data, instead + * it should do init/uninit in the driver (ie. with DEVICE_INIT and friends). + * Users may override or choose it. + */ +extern void +SetDeviceSpecificAccelerationProfile( + DeviceIntPtr pDev, + PointerAccelerationProfileFunc profile) +{ + /*sanity check*/ + if( pDev->valuator && + pDev->valuator->accelScheme.AccelSchemeProc == + acceleratePointerPredictable && + pDev->valuator->accelScheme.accelData != NULL){ + ((DeviceVelocityPtr) + (pDev->valuator->accelScheme.accelData))->deviceSpecificProfile + = profile; + } +} + + + +/******************************** + * acceleration schemes + *******************************/ + +/** + * Modifies valuators in-place. + * This version employs a velocity approximation algorithm to + * enable fine-grained predictable acceleration profiles. + */ +void +acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator, + int num_valuators, int *valuators, int evtime) +{ + float mult = 0.0; + int dx = 0, dy = 0; + int *px = NULL, *py = NULL; + DeviceVelocityPtr velocitydata = + (DeviceVelocityPtr) pDev->valuator->accelScheme.accelData; + float fdx, fdy; /* no need to init */ + + if (!num_valuators || !valuators || !velocitydata) + return; + + if (first_valuator == 0) { + dx = valuators[0]; + px = &valuators[0]; + } + if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) { + dy = valuators[1 - first_valuator]; + py = &valuators[1 - first_valuator]; + } + + if (dx || dy){ + /* reset nonvisible state? */ + if (ProcessVelocityData(velocitydata, dx , dy, evtime)) { + /* set to center of pixel */ + pDev->last.remainder[0] = pDev->last.remainder[1] = 0.5f; + /* prevent softening (somewhat quirky solution, + as it depends on the algorithm) */ + velocitydata->last_dx = dx; + velocitydata->last_dy = dy; + } + + if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) { + /* invoke acceleration profile to determine acceleration */ + mult = velocitydata->Profile(velocitydata, + pDev->ptrfeed->ctrl.threshold, + (float)(pDev->ptrfeed->ctrl.num) / + (float)(pDev->ptrfeed->ctrl.den)); + +#ifdef SERIOUS_DEBUGGING + ErrorF("(dix ptracc) resulting speed multiplier : %.3f\n", mult); +#endif + /* enforce min_acceleration */ + if (mult < velocitydata->min_acceleration) { +#ifdef SERIOUS_DEBUGGING + ErrorF("(dix ptracc) enforced min multiplier : %.3f\n", + velocitydata->min_acceleration); +#endif + mult = velocitydata->min_acceleration; + } + + if(mult != 1.0 || velocitydata->const_acceleration != 1.0) { + ApplySofteningAndConstantDeceleration( velocitydata, + dx, dy, + &fdx, &fdy, + mult > 1.0); + if (dx) { + pDev->last.remainder[0] = mult * fdx + pDev->last.remainder[0]; + *px = (int)pDev->last.remainder[0]; + pDev->last.remainder[0] = pDev->last.remainder[0] - (float)*px; + } + if (dy) { + pDev->last.remainder[1] = mult * fdy + pDev->last.remainder[1]; + *py = (int)pDev->last.remainder[1]; + pDev->last.remainder[1] = pDev->last.remainder[1] - (float)*py; + } + } + } + } + /* remember last motion delta (for softening/slow movement treatment) */ + velocitydata->last_dx = dx; + velocitydata->last_dy = dy; +} + + + +/** + * Originally a part of xf86PostMotionEvent; modifies valuators + * in-place. Retained mostly for embedded scenarios. + */ +void +acceleratePointerClassic(DeviceIntPtr pDev, int first_valuator, + int num_valuators, int *valuators, int ignored) +{ + float mult = 0.0; + int dx = 0, dy = 0; + int *px = NULL, *py = NULL; + + if (!num_valuators || !valuators) + return; + + if (first_valuator == 0) { + dx = valuators[0]; + px = &valuators[0]; + } + if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) { + dy = valuators[1 - first_valuator]; + py = &valuators[1 - first_valuator]; + } + + if (!dx && !dy) + return; + + if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) { + /* modeled from xf86Events.c */ + if (pDev->ptrfeed->ctrl.threshold) { + if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) { + pDev->last.remainder[0] = ((float)dx * + (float)(pDev->ptrfeed->ctrl.num)) / + (float)(pDev->ptrfeed->ctrl.den) + + pDev->last.remainder[0]; + if (px) { + *px = (int)pDev->last.remainder[0]; + pDev->last.remainder[0] = pDev->last.remainder[0] - + (float)(*px); + } + + pDev->last.remainder[1] = ((float)dy * + (float)(pDev->ptrfeed->ctrl.num)) / + (float)(pDev->ptrfeed->ctrl.den) + + pDev->last.remainder[1]; + if (py) { + *py = (int)pDev->last.remainder[1]; + pDev->last.remainder[1] = pDev->last.remainder[1] - + (float)(*py); + } + } + } + else { + mult = pow((float)dx * (float)dx + (float)dy * (float)dy, + ((float)(pDev->ptrfeed->ctrl.num) / + (float)(pDev->ptrfeed->ctrl.den) - 1.0) / + 2.0) / 2.0; + if (dx) { + pDev->last.remainder[0] = mult * (float)dx + + pDev->last.remainder[0]; + *px = (int)pDev->last.remainder[0]; + pDev->last.remainder[0] = pDev->last.remainder[0] - + (float)(*px); + } + if (dy) { + pDev->last.remainder[1] = mult * (float)dy + + pDev->last.remainder[1]; + *py = (int)pDev->last.remainder[1]; + pDev->last.remainder[1] = pDev->last.remainder[1] - + (float)(*py); + } + } + } +} diff --git a/dix/registry.c b/dix/registry.c index 10fa21f84..a519cff6b 100644 --- a/dix/registry.c +++ b/dix/registry.c @@ -126,10 +126,12 @@ RegisterExtensionNames(ExtensionEntry *extEntry) rewind(fh); while (fgets(buf, sizeof(buf), fh)) { + lineobj = NULL; ptr = strchr(buf, '\n'); if (ptr) *ptr = 0; + /* Check for comments or empty lines */ switch (buf[0]) { case PROT_REQUEST: case PROT_EVENT: @@ -139,48 +141,54 @@ RegisterExtensionNames(ExtensionEntry *extEntry) case '\0': continue; default: - continue; + goto invalid; } + /* Check for space character in the fifth position */ ptr = strchr(buf, ' '); - if (!ptr || ptr != buf + 4) { - LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); - continue; - } + if (!ptr || ptr != buf + 4) + goto invalid; + + /* Duplicate the string after the space */ lineobj = strdup(ptr + 1); if (!lineobj) continue; + /* Check for a colon somewhere on the line */ ptr = strchr(buf, ':'); - if (!ptr) { - LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); - continue; - } + if (!ptr) + goto invalid; + + /* Compare the part before colon with the target extension name */ *ptr = 0; - if (strcmp(buf + 5, extEntry->name)) - continue; + goto skip; + /* Get the opcode for the request, event, or error */ offset = strtol(buf + 1, &ptr, 10); - if (offset == 0 && ptr == buf + 1) { - LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); - continue; - } + if (offset == 0 && ptr == buf + 1) + goto invalid; + /* Save the strdup result in the registry */ switch(buf[0]) { case PROT_REQUEST: if (extEntry->base) RegisterRequestName(extEntry->base, offset, lineobj); else RegisterRequestName(offset, 0, lineobj); - break; + continue; case PROT_EVENT: RegisterEventName(extEntry->eventBase + offset, lineobj); - break; + continue; case PROT_ERROR: RegisterErrorName(extEntry->errorBase + offset, lineobj); - break; + continue; } + + invalid: + LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); + skip: + free(lineobj); } } diff --git a/dix/strcasecmp.c b/dix/strcasecmp.c index 58f0961e6..ca1051dc1 100644 --- a/dix/strcasecmp.c +++ b/dix/strcasecmp.c @@ -1,28 +1,31 @@ -/************************************************************ - Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. - - 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 Silicon Graphics not be - used in advertising or publicity pertaining to distribution - of the software without specific prior written permission. - Silicon Graphics makes no representation about the suitability - of this software for any purpose. It is provided "as is" - without any express or implied warranty. - - SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - GRAPHICS 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, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ #ifdef HAVE_DIX_CONFIG_H #include @@ -33,7 +36,7 @@ #ifdef NEED_STRCASECMP int -xstrcasecmp(char *str1,char *str2) +xstrcasecmp(const char *str1, const char *str2) { const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2; @@ -46,3 +49,22 @@ xstrcasecmp(char *str1,char *str2) return (tolower(*us1) - tolower(*us2)); } #endif + +#ifdef NEED_STRNCASECMP +int +xstrncasecmp(const char *s1, const char *s2, size_t n) +{ + if (n != 0) { + const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2; + + do { + if (tolower(*us1) != tolower(*us2++)) + return (tolower(*us1) - tolower(*--us2)); + if (*us1++ == '\0') + break; + } while (--n != 0); + } + + return 0; +} +#endif diff --git a/dix/strcasestr.c b/dix/strcasestr.c new file mode 100644 index 000000000..b3d45495c --- /dev/null +++ b/dix/strcasestr.c @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include "dix.h" + +/* + * Find the first occurrence of find in s, ignore case. + */ +#ifdef NEED_STRCASESTR +char * +xstrcasestr(const char *s, const char *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + c = tolower((unsigned char)c); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while ((char)tolower((unsigned char)sc) != c); + } while (strncasecmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +#endif diff --git a/dix/window.c b/dix/window.c index efe9ae045..c2fe142df 100644 --- a/dix/window.c +++ b/dix/window.c @@ -823,6 +823,8 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, static void DisposeWindowOptional (WindowPtr pWin) { + GenericMaskPtr gmask = NULL, next = NULL; + if (!pWin->optional) return; /* @@ -856,6 +858,17 @@ DisposeWindowOptional (WindowPtr pWin) xfree(pWin->optional->access.perm); xfree(pWin->optional->access.deny); + /* Remove generic event mask allocations */ + if (pWin->optional->geMasks) + gmask = pWin->optional->geMasks->geClients; + while(gmask) + { + next = gmask->next; + xfree(gmask); + gmask = next; + } + xfree (pWin->optional->geMasks); + xfree (pWin->optional); pWin->optional = NULL; } @@ -930,6 +943,7 @@ CrushTree(WindowPtr pWin) (*UnrealizeWindow)(pChild); } FreeWindowResources(pChild); + dixFreePrivates(pChild->devPrivates); xfree(pChild); if ( (pChild = pSib) ) break; @@ -979,6 +993,7 @@ DeleteWindow(pointer value, XID wid) if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; } + xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey)); dixFreePrivates(pWin->devPrivates); xfree(pWin); return Success; diff --git a/exa/exa.c b/exa/exa.c index fc047483d..48352bd5b 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -314,7 +314,6 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, if (driver_alloc) { size_t paddedWidth, datasize; - void *driver_priv; paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits); if (paddedWidth / 4 > 32767 || h > 32767) @@ -327,22 +326,21 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, datasize = h * paddedWidth; - driver_priv = pExaScr->info->CreatePixmap(pScreen, datasize, 0); - if (!driver_priv) { + pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0); + if (!pExaPixmap->driverPriv) { fbDestroyPixmap(pPixmap); return NULL; } (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0, paddedWidth, NULL); - pExaPixmap->driverPriv = driver_priv; pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED; pExaPixmap->fb_ptr = NULL; } else { - pExaPixmap->driverPriv = NULL; - /* Scratch pixmaps may have w/h equal to zero, and may not be - * migrated. - */ + pExaPixmap->driverPriv = NULL; + /* Scratch pixmaps may have w/h equal to zero, and may not be + * migrated. + */ if (!w || !h) pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED; else diff --git a/fb/fb.h b/fb/fb.h index 9d54b72d5..597c7f9c5 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -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 @@ -141,7 +138,7 @@ typedef unsigned __int64 FbBits; defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || defined(_LP64) || \ defined(__s390x__) || \ - defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \ + defined(amd64) || defined (__amd64__) \ defined (__powerpc64__) || \ (defined(sgi) && (_MIPS_SZLONG == 64)) typedef unsigned long FbBits; @@ -600,9 +597,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); } extern DevPrivateKey fbGetGCPrivateKey(void); -#ifndef FB_NO_WINDOW_PIXMAPS extern DevPrivateKey fbGetWinPrivateKey(void); -#endif extern const GCOps fbGCOps; extern const GCFuncs fbGCFuncs; @@ -673,12 +668,8 @@ typedef struct { #define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap) #define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate) -#ifdef FB_NO_WINDOW_PIXMAPS -#define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen) -#else #define fbGetWindowPixmap(pWin) ((PixmapPtr)\ dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey())) -#endif #ifdef ROOTLESS #define __fbPixDrawableX(pPix) ((pPix)->drawable.x) diff --git a/fb/fb24_32.c b/fb/fb24_32.c index a03726b8d..1ebd598a8 100644 --- a/fb/fb24_32.c +++ b/fb/fb24_32.c @@ -1,5 +1,4 @@ /* - * * Copyright © 2000 SuSE, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its @@ -544,11 +543,10 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel) int oldXoff, oldYoff; int newXoff, newYoff; - pNewTile = fbCreatePixmapBpp (pScreen, - pOldTile->drawable.width, - pOldTile->drawable.height, - pOldTile->drawable.depth, - bitsPerPixel, 0); + pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width, + pOldTile->drawable.height, + pOldTile->drawable.depth, + pOldTile->usage_hint); if (!pNewTile) return 0; fbGetDrawable (&pOldTile->drawable, diff --git a/fb/fballpriv.c b/fb/fballpriv.c index 68cb2e4c0..2e77289bb 100644 --- a/fb/fballpriv.c +++ b/fb/fballpriv.c @@ -38,13 +38,11 @@ DevPrivateKey fbGetGCPrivateKey(void) { return fbGCPrivateKey; } -#ifndef FB_NO_WINDOW_PIXMAPS static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKey; DevPrivateKey fbGetWinPrivateKey(void) { return fbWinPrivateKey; } -#endif Bool fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) diff --git a/fb/fbscreen.c b/fb/fbscreen.c index 12b19e419..ea2491211 100644 --- a/fb/fbscreen.c +++ b/fb/fbscreen.c @@ -90,11 +90,7 @@ _fbGetWindowPixmap (WindowPtr pWindow) void _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) { -#ifdef FB_NO_WINDOW_PIXMAPS - FatalError ("Attempted to set window pixmap without fb support\n"); -#else dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap); -#endif } Bool diff --git a/fb/fbwindow.c b/fb/fbwindow.c index f6fe8aa83..70e75a9e9 100644 --- a/fb/fbwindow.c +++ b/fb/fbwindow.c @@ -31,10 +31,8 @@ Bool fbCreateWindow(WindowPtr pWin) { -#ifndef FB_NO_WINDOW_PIXMAPS dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), fbGetScreenPixmap(pWin->drawable.pScreen)); -#endif #ifdef FB_SCREEN_PRIVATE if (pWin->drawable.bitsPerPixel == 32) pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp; @@ -227,7 +225,7 @@ fbFillRegionSolid (DrawablePtr pDrawable, while (n--) { #ifndef FB_ACCESS_WRAPPER - if (!try_mmx || !pixman_fill (dst, dstStride, dstBpp, + if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp, pbox->x1 + dstXoff, pbox->y1 + dstYoff, (pbox->x2 - pbox->x1), (pbox->y2 - pbox->y1), diff --git a/glx/Makefile.am b/glx/Makefile.am index f62d2ed86..4f723ac87 100644 --- a/glx/Makefile.am +++ b/glx/Makefile.am @@ -40,6 +40,8 @@ glapi_sources = \ glapitemp.h \ glapi.c \ glapi.h \ + glapioffsets.h \ + glprocs.h \ glthread.c \ glthread.h @@ -67,6 +69,7 @@ libglx_la_SOURCES = \ glxext.h \ glxdriswrast.c \ glxdricommon.c \ + glxdricommon.h \ glxscreens.c \ glxscreens.h \ glxserver.h \ diff --git a/glx/indirect_dispatch.h b/glx/indirect_dispatch.h index e81c382f0..014e417c9 100644 --- a/glx/indirect_dispatch.h +++ b/glx/indirect_dispatch.h @@ -251,8 +251,6 @@ extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GL extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc); extern HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc); extern HIDDEN void __glXDisp_Color3bv(GLbyte * pc); @@ -423,6 +421,8 @@ extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc); extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc); extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); +extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc); extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc); extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc); diff --git a/glx/indirect_size_get.c b/glx/indirect_size_get.c index 8f726904f..80f81dec6 100644 --- a/glx/indirect_size_get.c +++ b/glx/indirect_size_get.c @@ -714,6 +714,17 @@ __glGetBooleanv_size(GLenum e) case GL_MAX_TEXTURE_COORDS_ARB: case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: case GL_DEPTH_BOUNDS_TEST_EXT: + case GL_ARRAY_BUFFER_BINDING_ARB: + case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: + case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: + case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: + case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: + case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: + case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: + case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: + case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: + case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: case GL_STENCIL_TEST_TWO_SIDE_EXT: case GL_ACTIVE_STENCIL_FACE_EXT: @@ -1072,6 +1083,7 @@ __glGetVertexAttribdvARB_size(GLenum e) case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: case GL_CURRENT_VERTEX_ATTRIB_ARB: + case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: return 1; default: return 0; diff --git a/hw/dmx/dmx-config.h b/hw/dmx/dmx-config.h index 4a2dfe060..5b7b60593 100644 --- a/hw/dmx/dmx-config.h +++ b/hw/dmx/dmx-config.h @@ -73,14 +73,10 @@ #define DMXEXT /* Disable the extensions that are not currently supported */ -#undef BEZIER -#undef PEXEXT #undef MULTIBUFFER #undef XV -#undef XIE #undef DBE #undef XF86VIDMODE -#undef XF86MISC #undef XFreeXDGA #undef XF86DRI #undef SCREENSAVER @@ -88,6 +84,5 @@ #undef XFIXES #undef DAMAGE #undef COMPOSITE -#undef FONTCACHE #endif /* DMX_CONFIG_H */ diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index ab7ee96b9..2365f829f 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -1004,8 +1004,7 @@ static int MakeCurrent(__GLXclientState *cl, prevglxc->pGlxPixmap = 0; } - if (prevglxc->pGlxReadPixmap && - prevglxc->pGlxReadPixmap != prevglxc->pGlxPixmap ) { + if (prevglxc->pGlxReadPixmap) { /* ** The previous drawable was a glx pixmap, release it. */ @@ -1023,8 +1022,7 @@ static int MakeCurrent(__GLXclientState *cl, prevglxc->pGlxWindow = 0; } - if (prevglxc->pGlxReadWindow && - prevglxc->pGlxReadWindow != prevglxc->pGlxWindow) { + if (prevglxc->pGlxReadWindow) { /* ** The previous drawable was a glx window, release it. */ @@ -1042,8 +1040,7 @@ static int MakeCurrent(__GLXclientState *cl, prevglxc->pGlxPbuffer = 0; } - if (prevglxc->pGlxReadPbuffer && - prevglxc->pGlxReadPbuffer != prevglxc->pGlxPbuffer ) { + if (prevglxc->pGlxReadPbuffer) { /* ** The previous drawable was a glx Pbuffer, release it. */ @@ -1071,7 +1068,7 @@ static int MakeCurrent(__GLXclientState *cl, pGlxPixmap->refcnt++; } - if (pReadGlxPixmap && pReadGlxPixmap != pGlxPixmap) { + if (pReadGlxPixmap) { pReadGlxPixmap->refcnt++; } @@ -1079,7 +1076,7 @@ static int MakeCurrent(__GLXclientState *cl, pGlxWindow->refcnt++; } - if (pGlxReadWindow && pGlxReadWindow != pGlxWindow) { + if (pGlxReadWindow) { pGlxReadWindow->refcnt++; } @@ -1087,7 +1084,7 @@ static int MakeCurrent(__GLXclientState *cl, pGlxPbuffer->refcnt++; } - if (pGlxReadPbuffer && pGlxReadPbuffer != pGlxPbuffer) { + if (pGlxReadPbuffer) { pGlxReadPbuffer->refcnt++; } diff --git a/hw/kdrive/Kdrive.tmpl b/hw/kdrive/Kdrive.tmpl deleted file mode 100644 index e259b59a2..000000000 --- a/hw/kdrive/Kdrive.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $ - -#include - -#if BuildRender -RENDERINCS=-I$(KDRIVE)/../../render -#endif - -#if BuildRandR -RANDRINCS=-I$(KDRIVE)/../../randr -#endif - -KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ - -I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \ - -I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \ - -I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS) diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am index 140cccbc8..bf1f47567 100644 --- a/hw/kdrive/ephyr/Makefile.am +++ b/hw/kdrive/ephyr/Makefile.am @@ -78,6 +78,8 @@ Xephyr_DEPENDENCIES = \ $(LIBXEPHYR_HOSTDRI) \ @KDRIVE_LOCAL_LIBS@ +Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + relink: rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index e5b16c95a..65d55af11 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -526,8 +526,6 @@ ephyrRandRSetConfig (ScreenPtr pScreen, scrpriv->randr = KdAddRotation (screen->randr, randr); - KdOffscreenSwapOut (screen->pScreen); - ephyrUnmapFramebuffer (screen); screen->width = newwidth; diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 74f9f1628..171d78c9a 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -565,14 +565,40 @@ hostx_get_visual_masks (EphyrScreenInfo screen, } } +static int +hostx_calculate_color_shift(unsigned long mask, + int bits_per_rgb) +{ + int shift = 0; + while(mask) { + mask = mask >> bits_per_rgb; + if (mask) shift += bits_per_rgb; + } + return shift; +} + void hostx_set_cmap_entry(unsigned char idx, unsigned char r, unsigned char g, unsigned char b) { - /* XXX Will likely break for 8 on 16, not sure if this is correct */ - HostX.cmap[idx] = (r << 16) | (g << 8) | (b); +/* need to calculate the shifts for RGB because server could be BGR. */ +/* XXX Not sure if this is correct for 8 on 16, but this works for 8 on 24.*/ + static int rshift, bshift, gshift = 0; + static int first_time = 1; + if (first_time) { + first_time = 0; + rshift = hostx_calculate_color_shift(HostX.visual->red_mask, + HostX.visual->bits_per_rgb); + gshift = hostx_calculate_color_shift(HostX.visual->green_mask, + HostX.visual->bits_per_rgb); + bshift = hostx_calculate_color_shift(HostX.visual->blue_mask, + HostX.visual->bits_per_rgb); + } + HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) | + ((g << gshift) & HostX.visual->green_mask) | + ((b << bshift) & HostX.visual->blue_mask); } /** diff --git a/hw/kdrive/fake/Makefile.am b/hw/kdrive/fake/Makefile.am index 09d179eb0..76ed9fc8b 100644 --- a/hw/kdrive/fake/Makefile.am +++ b/hw/kdrive/fake/Makefile.am @@ -21,6 +21,8 @@ Xfake_LDADD = \ @KDRIVE_LIBS@ \ @XSERVER_LIBS@ +Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + Xfake_DEPENDENCIES = \ libfake.a \ @KDRIVE_LOCAL_LIBS@ diff --git a/hw/kdrive/fake/fake.c b/hw/kdrive/fake/fake.c index 6211ab871..d77c4f106 100644 --- a/hw/kdrive/fake/fake.c +++ b/hw/kdrive/fake/fake.c @@ -324,8 +324,6 @@ fakeRandRSetConfig (ScreenPtr pScreen, scrpriv->randr = KdAddRotation (screen->randr, randr); - KdOffscreenSwapOut (screen->pScreen); - fakeUnmapFramebuffer (screen); if (!fakeMapFramebuffer (screen)) diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am index 420855b8d..cb1292802 100644 --- a/hw/kdrive/fbdev/Makefile.am +++ b/hw/kdrive/fbdev/Makefile.am @@ -22,6 +22,8 @@ Xfbdev_DEPENDENCIES = \ libfbdev.a \ $(KDRIVE_PURE_LIBS) +Xfbdev_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + relink: rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) endif diff --git a/hw/kdrive/fbdev/fbdev.c b/hw/kdrive/fbdev/fbdev.c index 7721e608a..35ca4dec6 100644 --- a/hw/kdrive/fbdev/fbdev.c +++ b/hw/kdrive/fbdev/fbdev.c @@ -99,8 +99,6 @@ fbdevCardInit (KdCardInfo *card) return TRUE; } -#define FBDEV_KLUDGE_FORMAT -#ifdef FBDEV_KLUDGE_FORMAT static Pixel fbdevMakeContig (Pixel orig, Pixel others) { @@ -114,7 +112,6 @@ fbdevMakeContig (Pixel orig, Pixel others) } return orig; } -#endif static Bool fbdevModeSupported (KdScreenInfo *screen, @@ -261,7 +258,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv) screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length); screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length); screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length); -#ifdef FBDEV_KLUDGE_FORMAT + /* * This is a kludge so that Render will work -- fill in the gaps * in the pixel @@ -278,7 +275,6 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv) screen->fb[0].redMask| screen->fb[0].greenMask); -#endif allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask; depth = 32; while (depth && !(allbits & (1 << (depth - 1)))) @@ -529,8 +525,6 @@ fbdevRandRSetConfig (ScreenPtr pScreen, scrpriv->randr = KdAddRotation (screen->randr, randr); - KdOffscreenSwapOut (screen->pScreen); - fbdevUnmapFramebuffer (screen); if (!fbdevMapFramebuffer (screen)) diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am index e13d08312..6380bd5ab 100644 --- a/hw/kdrive/linux/Makefile.am +++ b/hw/kdrive/linux/Makefile.am @@ -10,10 +10,6 @@ if TSLIB TSLIB_C = tslib.c endif -if H3600_TS -TS_C = ts.c -endif - if KDRIVE_HW KDRIVE_HW_SOURCES = \ agp.c \ @@ -30,5 +26,4 @@ liblinux_a_SOURCES = \ ms.c \ ps2.c \ $(KDRIVE_HW_SOURCES) \ - $(TSLIB_C) \ - $(TS_C) + $(TSLIB_C) diff --git a/hw/kdrive/linux/ts.c b/hw/kdrive/linux/ts.c deleted file mode 100644 index 831953f02..000000000 --- a/hw/kdrive/linux/ts.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Derived from ps2.c by Jim Gettys - * - * Copyright © 1999 Keith Packard - * Copyright © 2000 Compaq Computer Corporation - * - * 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 or Compaq not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard and Compaq makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, - * IN NO EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#define NEED_EVENTS -#include -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include "kdrive.h" -#include -#include /* touch screen events */ - -static long lastx = 0, lasty = 0; - -int KdTsPhyScreen = 0; - -static int -TsReadBytes (int fd, char *buf, int len, int min) -{ - int n, tot; - fd_set set; - struct timeval tv; - - tot = 0; - while (len) - { - n = read (fd, buf, len); - if (n > 0) - { - tot += n; - buf += n; - len -= n; - } - if (tot % min == 0) - break; - FD_ZERO (&set); - FD_SET (fd, &set); - tv.tv_sec = 0; - tv.tv_usec = 100 * 1000; - n = select (fd + 1, &set, 0, 0, &tv); - if (n <= 0) - break; - } - return tot; -} - -static void -TsRead (int tsPort, void *closure) -{ - KdPointerInfo *pi = closure; - TS_EVENT event; - int n; - long x, y; - unsigned long flags; - - n = TsReadBytes (tsPort, (char *) &event, sizeof (event), sizeof (event)); - if (n == sizeof (event)) - { - if (event.pressure) - { - /* - * HACK ATTACK. (static global variables used !) - * Here we test for the touch screen driver actually being on the - * touch screen, if it is we send absolute coordinates. If not, - * then we send delta's so that we can track the entire vga screen. - */ - if (KdCurScreen == KdTsPhyScreen) { - flags = KD_BUTTON_1; - x = event.x; - y = event.y; - } - else - { - flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA; - if ((lastx == 0) || (lasty == 0)) { - x = 0; - y = 0; - } else { - x = event.x - lastx; - y = event.y - lasty; - } - lastx = event.x; - lasty = event.y; - } - } else { - flags = KD_MOUSE_DELTA; - x = 0; - y = 0; - lastx = 0; - lasty = 0; - } - KdEnqueuePointerEvent (pi, flags, x, y, 0); - } -} - -char *TsNames[] = { - "/dev/ts", - "/dev/h3600_ts" /* temporary name; note this code can try - to open more than one device */ -}; - -#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0])) - -static Status -TsInit (KdPointerInfo *pi) -{ - int i; - int fd; - int n = 0; - - if (!pi->path || strcmp(pi->path, "auto") == 0) { - for (i = 0; i < NUM_TS_NAMES; i++) { - fd = open (TsNames[i], 0); - if (fd >= 0) { - pi->path = KdSaveString (TsNames[i]); - break; - } - } - } - else { - fd = open (pi->path, 0); - } - - if (fd < 0) { - ErrorF("TsInit: Couldn't open %s\n", pi->path); - return BadMatch; - } - close(fd); - - pi->name = KdSaveString("H3600 Touchscreen"); - - return Success; -} - -static Status -TsEnable (KdPointerInfo *pi) -{ - int fd; - - if (!pi || !pi->path) - return BadImplementation; - - fd = open(pi->path, 0); - - if (fd < 0) { - ErrorF("TsInit: Couldn't open %s\n", pi->path); - return BadMatch; - } - - struct h3600_ts_calibration cal; - /* - * Check to see if this is a touch screen - */ - if (ioctl (fd, TS_GET_CAL, &cal) != -1) { - mi->driverPrivate = (void *) fd; - if (!KdRegisterFd (fd, TsRead, (void *) mi)) { - close(fd); - return BadAlloc; - } - } - else { - ErrorF("TsEnable: %s is not a touchscreen\n", pi->path); - close (fd); - return BadMatch; - } - - return Success; -} - -static void -TsFini (KdPointerInfo *pi) -{ - KdUnregisterFds (pi, (int)pi->driverPrivate, TRUE); - mi->driverPrivate = NULL; -} - -KdPointerDriver TsDriver = { - TsInit, - TsEnable, - TsDisable, - TsFini, - NULL, -}; diff --git a/hw/kdrive/sdl/Makefile.am b/hw/kdrive/sdl/Makefile.am index fe9309e46..0973cb4ea 100644 --- a/hw/kdrive/sdl/Makefile.am +++ b/hw/kdrive/sdl/Makefile.am @@ -13,5 +13,7 @@ Xsdl_LDADD = \ Xsdl_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ +Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + relink: rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/src/Makefile.am b/hw/kdrive/src/Makefile.am index 07ab8c859..792f64a4d 100644 --- a/hw/kdrive/src/Makefile.am +++ b/hw/kdrive/src/Makefile.am @@ -12,12 +12,14 @@ KDRIVE_HW_SOURCES = \ vga.h endif +if XV +KDRIVE_XV_SOURCES = \ + kxv.c \ + kxv.h +endif + libkdrive_a_SOURCES = \ fourcc.h \ - kaa.c \ - kaa.h \ - kaapict.c \ - kasync.c \ kcmap.c \ kcurscol.c \ kdrive.c \ @@ -27,12 +29,8 @@ libkdrive_a_SOURCES = \ kkeymap.c \ kmap.c \ kmode.c \ - knoop.c \ - koffscreen.c \ kshadow.c \ - ktest.c \ - kxv.c \ - kxv.h \ + $(KDRIVE_XV_SOURCES) \ $(KDRIVE_HW_SOURCES) \ $(top_srcdir)/mi/miinitext.c diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c deleted file mode 100644 index db09e9dba..000000000 --- a/hw/kdrive/src/kaa.c +++ /dev/null @@ -1,1081 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Partly based on code that is Copyright © The XFree86 Project 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" -#include "kaa.h" -#include "dixfontstr.h" - -#define DEBUG_MIGRATE 0 -#define DEBUG_PIXMAP 0 -#if DEBUG_MIGRATE -#define DBG_MIGRATE(a) ErrorF a -#else -#define DBG_MIGRATE(a) -#endif -#if DEBUG_PIXMAP -#define DBG_PIXMAP(a) ErrorF a -#else -#define DBG_PIXMAP(a) -#endif - -DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey; -DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey; - -#define KAA_PIXMAP_SCORE_MOVE_IN 10 -#define KAA_PIXMAP_SCORE_MAX 20 -#define KAA_PIXMAP_SCORE_MOVE_OUT -10 -#define KAA_PIXMAP_SCORE_MIN -20 -#define KAA_PIXMAP_SCORE_PINNED 1000 -#define KAA_PIXMAP_SCORE_INIT 1001 - -void -kaaDrawableDirty (DrawablePtr pDrawable) -{ - PixmapPtr pPixmap; - KaaPixmapPrivPtr pKaaPixmap; - - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap)((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr)pDrawable; - - pKaaPixmap = KaaGetPixmapPriv(pPixmap); - if (pKaaPixmap != NULL) - pKaaPixmap->dirty = TRUE; -} - -static void -kaaPixmapSave (ScreenPtr pScreen, KdOffscreenArea *area) -{ - PixmapPtr pPixmap = area->privData; - KaaPixmapPriv(pPixmap); - int dst_pitch, src_pitch, bytes; - unsigned char *dst, *src; - int i; - - DBG_MIGRATE (("Save 0x%08x (0x%x) (%dx%d)\n", - pPixmap->drawable.id, - KaaGetPixmapPriv(pPixmap)->area ? - KaaGetPixmapPriv(pPixmap)->area->offset : -1, - pPixmap->drawable.width, - pPixmap->drawable.height)); - - src_pitch = pPixmap->devKind; - dst_pitch = pKaaPixmap->devKind; - - src = pPixmap->devPrivate.ptr; - dst = pKaaPixmap->devPrivate.ptr; - - pPixmap->devKind = dst_pitch; - pPixmap->devPrivate.ptr = dst; - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pKaaPixmap->area = NULL; - -#if 0 - if (!pKaaPixmap->dirty) - return; -#endif - - kaaWaitSync (pPixmap->drawable.pScreen); - - bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; - - i = pPixmap->drawable.height; - while (i--) { - memcpy (dst, src, bytes); - dst += dst_pitch; - src += src_pitch; - } -} - -static int -kaaLog2(int val) -{ - int bits; - - if (!val) - return 0; - for (bits = 0; val != 0; bits++) - val >>= 1; - return bits - 1; -} - -static Bool -kaaPixmapAllocArea (PixmapPtr pPixmap) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - KaaScreenPriv (pScreen); - KaaPixmapPriv (pPixmap); - KdScreenPriv (pScreen); - int bpp = pPixmap->drawable.bitsPerPixel; - CARD16 h = pPixmap->drawable.height; - CARD16 w = pPixmap->drawable.width; - int pitch; - - if (pKaaScr->info->flags & KAA_OFFSCREEN_ALIGN_POT && w != 1) - w = 1 << (kaaLog2(w - 1) + 1); - pitch = (w * bpp / 8 + pKaaScr->info->pitchAlign - 1) & - ~(pKaaScr->info->pitchAlign - 1); - - pKaaPixmap->devKind = pPixmap->devKind; - pKaaPixmap->devPrivate = pPixmap->devPrivate; - pKaaPixmap->area = KdOffscreenAlloc (pScreen, pitch * h, - pKaaScr->info->offsetAlign, - FALSE, - kaaPixmapSave, (pointer) pPixmap); - if (!pKaaPixmap->area) - return FALSE; - - DBG_PIXMAP(("++ 0x%08x (0x%x) (%dx%d)\n", - pPixmap->drawable.id, - KaaGetPixmapPriv(pPixmap)->area ? - KaaGetPixmapPriv(pPixmap)->area->offset : -1, - pPixmap->drawable.width, - pPixmap->drawable.height)); - pPixmap->devKind = pitch; - pPixmap->devPrivate.ptr = (pointer) ((CARD8 *) pScreenPriv->screen->memory_base + pKaaPixmap->area->offset); - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - return TRUE; -} - -void -kaaMoveInPixmap (PixmapPtr pPixmap) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - KaaScreenPriv (pScreen); - KaaPixmapPriv (pPixmap); - int dst_pitch, src_pitch, bytes; - unsigned char *dst, *src; - int i; - - DBG_MIGRATE (("-> 0x%08x (0x%x) (%dx%d)\n", - pPixmap->drawable.id, - KaaGetPixmapPriv(pPixmap)->area ? - KaaGetPixmapPriv(pPixmap)->area->offset : -1, - pPixmap->drawable.width, - pPixmap->drawable.height)); - - src = pPixmap->devPrivate.ptr; - src_pitch = pPixmap->devKind; - - if (!kaaPixmapAllocArea (pPixmap)) - return; - - pKaaPixmap->dirty = FALSE; - - if (pKaaScr->info->UploadToScreen) - { - if (pKaaScr->info->UploadToScreen(pPixmap, (char *) src, src_pitch)) - return; - } - - dst = pPixmap->devPrivate.ptr; - dst_pitch = pPixmap->devKind; - - bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; - - kaaWaitSync (pPixmap->drawable.pScreen); - - i = pPixmap->drawable.height; - while (i--) { - memcpy (dst, src, bytes); - dst += dst_pitch; - src += src_pitch; - } -} - -static void -kaaMoveOutPixmap (PixmapPtr pPixmap) -{ - KaaPixmapPriv (pPixmap); - KdOffscreenArea *area = pKaaPixmap->area; - - DBG_MIGRATE (("<- 0x%08x (0x%x) (%dx%d)\n", - pPixmap->drawable.id, - KaaGetPixmapPriv(pPixmap)->area ? - KaaGetPixmapPriv(pPixmap)->area->offset : -1, - pPixmap->drawable.width, - pPixmap->drawable.height)); - if (area) - { - kaaPixmapSave (pPixmap->drawable.pScreen, area); - KdOffscreenFree (pPixmap->drawable.pScreen, area); - } -} - -void -kaaPixmapUseScreen (PixmapPtr pPixmap) -{ - KaaPixmapPriv (pPixmap); - - if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED) - return; - - if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT) { - kaaMoveInPixmap(pPixmap); - pKaaPixmap->score = 0; - } - - if (pKaaPixmap->score < KAA_PIXMAP_SCORE_MAX) - { - pKaaPixmap->score++; - if (!kaaPixmapIsOffscreen(pPixmap) && - pKaaPixmap->score >= KAA_PIXMAP_SCORE_MOVE_IN) - kaaMoveInPixmap (pPixmap); - } - KdOffscreenMarkUsed (pPixmap); -} - -void -kaaPixmapUseMemory (PixmapPtr pPixmap) -{ - KaaPixmapPriv (pPixmap); - - if (pKaaPixmap->score == KAA_PIXMAP_SCORE_PINNED) - return; - - if (pKaaPixmap->score == KAA_PIXMAP_SCORE_INIT) - pKaaPixmap->score = 0; - - if (pKaaPixmap->score > KAA_PIXMAP_SCORE_MIN) - { - pKaaPixmap->score--; - if (pKaaPixmap->area && - pKaaPixmap->score <= KAA_PIXMAP_SCORE_MOVE_OUT) - kaaMoveOutPixmap (pPixmap); - } -} - -static Bool -kaaDestroyPixmap (PixmapPtr pPixmap) -{ - if (pPixmap->refcnt == 1) - { - KaaPixmapPriv (pPixmap); - if (pKaaPixmap->area) - { - DBG_PIXMAP(("-- 0x%08x (0x%x) (%dx%d)\n", - pPixmap->drawable.id, - KaaGetPixmapPriv(pPixmap)->area->offset, - pPixmap->drawable.width, - pPixmap->drawable.height)); - /* Free the offscreen area */ - KdOffscreenFree (pPixmap->drawable.pScreen, pKaaPixmap->area); - pPixmap->devPrivate = pKaaPixmap->devPrivate; - pPixmap->devKind = pKaaPixmap->devKind; - } - } - return fbDestroyPixmap (pPixmap); -} - -static PixmapPtr -kaaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint) -{ - PixmapPtr pPixmap; - KaaPixmapPrivPtr pKaaPixmap; - int bpp; - - bpp = BitsPerPixel (depth); - if (bpp == 32 && depth == 24) - { - int fb; - KdScreenPriv (pScreen); - - for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++) - if (pScreenPriv->screen->fb[fb].depth == 24) - { - bpp = pScreenPriv->screen->fb[fb].bitsPerPixel; - break; - } - } - - pPixmap = fbCreatePixmapBpp (pScreen, w, h, depth, bpp, usage_hint); - if (!pPixmap) - return NULL; - pKaaPixmap = KaaGetPixmapPriv(pPixmap); - if (!w || !h) - pKaaPixmap->score = KAA_PIXMAP_SCORE_PINNED; - else - pKaaPixmap->score = KAA_PIXMAP_SCORE_INIT; - - pKaaPixmap->area = NULL; - pKaaPixmap->dirty = FALSE; - - return pPixmap; -} - -Bool -kaaPixmapIsOffscreen(PixmapPtr p) -{ - ScreenPtr pScreen = p->drawable.pScreen; - KdScreenPriv(pScreen); - - return ((unsigned long) ((CARD8 *) p->devPrivate.ptr - - (CARD8 *) pScreenPriv->screen->memory_base) < - pScreenPriv->screen->memory_size); -} - -PixmapPtr -kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp) -{ - PixmapPtr pPixmap; - int x, y; - - if (pDrawable->type == DRAWABLE_WINDOW) { - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); -#ifdef COMPOSITE - x = -pPixmap->screen_x; - y = -pPixmap->screen_y; -#else - x = 0; - y = 0; -#endif - } - else - { - pPixmap = (PixmapPtr) pDrawable; - x = 0; - y = 0; - } - *xp = x; - *yp = y; - if (kaaPixmapIsOffscreen (pPixmap)) - return pPixmap; - else - return NULL; -} - -Bool -kaaDrawableIsOffscreen (DrawablePtr pDrawable) -{ - PixmapPtr pPixmap; - if (pDrawable->type == DRAWABLE_WINDOW) - pPixmap = (*pDrawable->pScreen->GetWindowPixmap) ((WindowPtr) pDrawable); - else - pPixmap = (PixmapPtr) pDrawable; - return kaaPixmapIsOffscreen (pPixmap); -} - -#if 0 -static void -kaaFillTiled(int dst_x, - int dst_y, - int width, - int height, - int src_x, - int src_y, - int src_width, - int src_height, - void (*Copy) (int srcX, - int srcY, - int dstX, - int dstY, - int width, - int height)) -{ - modulus (src_x, src_width, src_x); - modulus (src_y, src_height, src_y); - - while (height) - { - int dst_x_tmp = dst_x; - int src_x_tmp = src_x; - int width_tmp = width; - int height_left = src_height - src_y; - int height_this = min (height, height_left); - - while (width_tmp) - { - int width_left = src_width - src_x_tmp; - int width_this = min (width_tmp, width_left); - - (*Copy) (src_x_tmp, src_y, - dst_x_tmp, dst_y, - width_this, height_this); - - width_tmp -= width_this; - dst_x_tmp += width_this; - } - height -= height_this; - dst_y += height_this; - src_y = 0; - } -} -#endif - -static void -kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - ScreenPtr pScreen = pDrawable->pScreen; - KdScreenPriv (pScreen); - KaaScreenPriv (pScreen); - RegionPtr pClip = fbGetCompositeClip(pGC); - PixmapPtr pPixmap; - BoxPtr pextent, pbox; - int nbox; - int extentX1, extentX2, extentY1, extentY2; - int fullX1, fullX2, fullY1; - int partX1, partX2; - int off_x, off_y; - - if (!pScreenPriv->enabled || - pGC->fillStyle != FillSolid || - !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &off_x, &off_y)) || - !(*pKaaScr->info->PrepareSolid) (pPixmap, - pGC->alu, - pGC->planemask, - pGC->fgPixel)) - { - KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); - return; - } - - pextent = REGION_EXTENTS(pGC->pScreen, pClip); - extentX1 = pextent->x1; - extentY1 = pextent->y1; - extentX2 = pextent->x2; - extentY2 = pextent->y2; - while (n--) - { - fullX1 = ppt->x; - fullY1 = ppt->y; - fullX2 = fullX1 + (int) *pwidth; - ppt++; - pwidth++; - - if (fullY1 < extentY1 || extentY2 <= fullY1) - continue; - - if (fullX1 < extentX1) - fullX1 = extentX1; - - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullX1 >= fullX2) - continue; - - nbox = REGION_NUM_RECTS (pClip); - if (nbox == 1) - { - (*pKaaScr->info->Solid) (fullX1 + off_x, fullY1 + off_y, - fullX2 + off_x, fullY1 + 1 + off_y); - } - else - { - pbox = REGION_RECTS(pClip); - while(nbox--) - { - if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) - { - partX1 = pbox->x1; - if (partX1 < fullX1) - partX1 = fullX1; - partX2 = pbox->x2; - if (partX2 > fullX2) - partX2 = fullX2; - if (partX2 > partX1) - (*pKaaScr->info->Solid) (partX1 + off_x, fullY1 + off_y, - partX2 + off_x, fullY1 + 1 + off_y); - } - pbox++; - } - } - } - (*pKaaScr->info->DoneSolid) (); - kaaDrawableDirty (pDrawable); - kaaMarkSync (pDrawable->pScreen); -} - -void -kaaCopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - KdScreenPriv (pDstDrawable->pScreen); - KaaScreenPriv (pDstDrawable->pScreen); - PixmapPtr pSrcPixmap, pDstPixmap; - int src_off_x, src_off_y; - int dst_off_x, dst_off_y; - - /* Migrate pixmaps to same place as destination */ - if (pScreenPriv->enabled && pSrcDrawable->type == DRAWABLE_PIXMAP) { - if (kaaDrawableIsOffscreen (pDstDrawable)) - kaaPixmapUseScreen ((PixmapPtr) pSrcDrawable); - else - kaaPixmapUseMemory ((PixmapPtr) pSrcDrawable); - } - - if (pScreenPriv->enabled && - (pSrcPixmap = kaaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) && - (pDstPixmap = kaaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && - (*pKaaScr->info->PrepareCopy) (pSrcPixmap, - pDstPixmap, - dx, - dy, - pGC ? pGC->alu : GXcopy, - pGC ? pGC->planemask : FB_ALLONES)) - { - while (nbox--) - { - (*pKaaScr->info->Copy) (pbox->x1 + dx + src_off_x, - pbox->y1 + dy + src_off_y, - pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - (*pKaaScr->info->DoneCopy) (); - kaaMarkSync (pDstDrawable->pScreen); - } - else - { - kaaWaitSync (pDstDrawable->pScreen); - fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, - pbox, nbox, dx, dy, reverse, upsidedown, - bitplane, closure); - } - kaaDrawableDirty (pDstDrawable); -} - -static RegionPtr -kaaCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, kaaCopyNtoN, 0, 0); -} - -static void -kaaPolyFillRect(DrawablePtr pDrawable, - GCPtr pGC, - int nrect, - xRectangle *prect) -{ - KdScreenPriv (pDrawable->pScreen); - KaaScreenPriv (pDrawable->pScreen); - RegionPtr pClip = fbGetCompositeClip(pGC); - PixmapPtr pPixmap; - register BoxPtr pbox; - BoxPtr pextent; - int extentX1, extentX2, extentY1, extentY2; - int fullX1, fullX2, fullY1, fullY2; - int partX1, partX2, partY1, partY2; - int xoff, yoff; - int xorg, yorg; - int n; - - if (!pScreenPriv->enabled || - pGC->fillStyle != FillSolid || - !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || - !(*pKaaScr->info->PrepareSolid) (pPixmap, - pGC->alu, - pGC->planemask, - pGC->fgPixel)) - { - KdCheckPolyFillRect (pDrawable, pGC, nrect, prect); - return; - } - - xorg = pDrawable->x; - yorg = pDrawable->y; - - pextent = REGION_EXTENTS(pGC->pScreen, pClip); - extentX1 = pextent->x1; - extentY1 = pextent->y1; - extentX2 = pextent->x2; - extentY2 = pextent->y2; - while (nrect--) - { - fullX1 = prect->x + xorg; - fullY1 = prect->y + yorg; - fullX2 = fullX1 + (int) prect->width; - fullY2 = fullY1 + (int) prect->height; - prect++; - - if (fullX1 < extentX1) - fullX1 = extentX1; - - if (fullY1 < extentY1) - fullY1 = extentY1; - - if (fullX2 > extentX2) - fullX2 = extentX2; - - if (fullY2 > extentY2) - fullY2 = extentY2; - - if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) - continue; - n = REGION_NUM_RECTS (pClip); - if (n == 1) - { - (*pKaaScr->info->Solid) (fullX1 + xoff, fullY1 + yoff, - fullX2 + xoff, fullY2 + yoff); - } - else - { - pbox = REGION_RECTS(pClip); - /* - * clip the rectangle to each box in the clip region - * this is logically equivalent to calling Intersect() - */ - while(n--) - { - partX1 = pbox->x1; - if (partX1 < fullX1) - partX1 = fullX1; - partY1 = pbox->y1; - if (partY1 < fullY1) - partY1 = fullY1; - partX2 = pbox->x2; - if (partX2 > fullX2) - partX2 = fullX2; - partY2 = pbox->y2; - if (partY2 > fullY2) - partY2 = fullY2; - - pbox++; - - if (partX1 < partX2 && partY1 < partY2) - (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); - } - } - } - (*pKaaScr->info->DoneSolid) (); - kaaDrawableDirty (pDrawable); - kaaMarkSync (pDrawable->pScreen); -} - -static void -kaaSolidBoxClipped (DrawablePtr pDrawable, - RegionPtr pClip, - FbBits pm, - FbBits fg, - int x1, - int y1, - int x2, - int y2) -{ - KdScreenPriv (pDrawable->pScreen); - KaaScreenPriv (pDrawable->pScreen); - PixmapPtr pPixmap; - BoxPtr pbox; - int nbox; - int xoff, yoff; - int partX1, partX2, partY1, partY2; - - if (!pScreenPriv->enabled || - !(pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || - !(*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) - { - kaaWaitSync (pDrawable->pScreen); - fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); - fbSolidBoxClipped (pDrawable, pClip, x1, y1, x2, y2, - fbAnd (GXcopy, fg, pm), - fbXor (GXcopy, fg, pm)); - kaaDrawableDirty (pDrawable); - return; - } - for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); - nbox--; - pbox++) - { - partX1 = pbox->x1; - if (partX1 < x1) - partX1 = x1; - - partX2 = pbox->x2; - if (partX2 > x2) - partX2 = x2; - - if (partX2 <= partX1) - continue; - - partY1 = pbox->y1; - if (partY1 < y1) - partY1 = y1; - - partY2 = pbox->y2; - if (partY2 > y2) - partY2 = y2; - - if (partY2 <= partY1) - continue; - - (*pKaaScr->info->Solid) (partX1 + xoff, partY1 + yoff, - partX2 + xoff, partY2 + yoff); - } - (*pKaaScr->info->DoneSolid) (); - kaaDrawableDirty (pDrawable); - kaaMarkSync (pDrawable->pScreen); -} - -static void -kaaImageGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - pointer pglyphBase) -{ - FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); - CharInfoPtr *ppci; - CharInfoPtr pci; - unsigned char *pglyph; /* pointer bits in glyph */ - int gWidth, gHeight; /* width and height of glyph */ - FbStride gStride; /* stride of glyph */ - Bool opaque; - int n; - int gx, gy; - void (*glyph) (FbBits *, - FbStride, - int, - FbStip *, - FbBits, - int, - int); - FbBits *dst; - FbStride dstStride; - int dstBpp; - int dstXoff, dstYoff; - FbBits depthMask; - - depthMask = FbFullMask(pDrawable->depth); - if ((pGC->planemask & depthMask) != depthMask) - { - KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase); - return; - } - glyph = 0; - fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - switch (dstBpp) { - case 8: glyph = fbGlyph8; break; - case 16: glyph = fbGlyph16; break; - case 24: glyph = fbGlyph24; break; - case 32: glyph = fbGlyph32; break; - } - - x += pDrawable->x; - y += pDrawable->y; - - if (TERMINALFONT (pGC->font) && !glyph) - { - opaque = TRUE; - } - else - { - int xBack, widthBack; - int yBack, heightBack; - - ppci = ppciInit; - n = nglyph; - widthBack = 0; - while (n--) - widthBack += (*ppci++)->metrics.characterWidth; - - xBack = x; - if (widthBack < 0) - { - xBack += widthBack; - widthBack = -widthBack; - } - yBack = y - FONTASCENT(pGC->font); - heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - kaaSolidBoxClipped (pDrawable, - fbGetCompositeClip(pGC), - pGC->planemask, - pGC->bgPixel, - xBack, - yBack, - xBack + widthBack, - yBack + heightBack); - opaque = FALSE; - } - - kaaWaitSync (pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - - ppci = ppciInit; - while (nglyph--) - { - pci = *ppci++; - pglyph = FONTGLYPHBITS(pglyphBase, pci); - gWidth = GLYPHWIDTHPIXELS(pci); - gHeight = GLYPHHEIGHTPIXELS(pci); - if (gWidth && gHeight) - { - gx = x + pci->metrics.leftSideBearing; - gy = y - pci->metrics.ascent; - if (glyph && gWidth <= sizeof (FbStip) * 8 && - fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) - { - (*glyph) (dst + (gy + dstYoff) * dstStride, - dstStride, - dstBpp, - (FbStip *) pglyph, - pPriv->fg, - gx + dstXoff, - gHeight); - } - else - { - gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); - fbPutXYImage (pDrawable, - fbGetCompositeClip(pGC), - pPriv->fg, - pPriv->bg, - pPriv->pm, - GXcopy, - opaque, - - gx, - gy, - gWidth, gHeight, - - (FbStip *) pglyph, - gStride, - 0); - } - } - x += pci->metrics.characterWidth; - } -} - -static const GCOps kaaOps = { - kaaFillSpans, - KdCheckSetSpans, - KdCheckPutImage, - kaaCopyArea, - KdCheckCopyPlane, - KdCheckPolyPoint, - KdCheckPolylines, - KdCheckPolySegment, - miPolyRectangle, - KdCheckPolyArc, - miFillPolygon, - kaaPolyFillRect, - miPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - kaaImageGlyphBlt, - KdCheckPolyGlyphBlt, - KdCheckPushPixels, -}; - -static void -kaaValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) -{ - fbValidateGC (pGC, changes, pDrawable); - - if (kaaDrawableIsOffscreen (pDrawable)) - pGC->ops = (GCOps *) &kaaOps; - else - pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; -} - -GCFuncs kaaGCFuncs = { - kaaValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -static int -kaaCreateGC (GCPtr pGC) -{ - if (!fbCreateGC (pGC)) - return FALSE; - - pGC->funcs = &kaaGCFuncs; - - return TRUE; -} - - -static void -kaaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - RegionRec rgnDst; - int dx, dy; - PixmapPtr pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - - REGION_INIT (pWin->drawable.pScreen, &rgnDst, NullBox, 0); - - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); -#ifdef COMPOSITE - if (pPixmap->screen_x || pPixmap->screen_y) - REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, - -pPixmap->screen_x, -pPixmap->screen_y); -#endif - - fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable, - 0, - &rgnDst, dx, dy, kaaCopyNtoN, 0, 0); - - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - -static void -kaaFillRegionSolid (DrawablePtr pDrawable, - RegionPtr pRegion, - Pixel pixel) -{ - KdScreenPriv(pDrawable->pScreen); - KaaScreenPriv(pDrawable->pScreen); - PixmapPtr pPixmap; - int xoff, yoff; - - if (pScreenPriv->enabled && - (pPixmap = kaaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && - (*pKaaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) - { - int nbox = REGION_NUM_RECTS (pRegion); - BoxPtr pBox = REGION_RECTS (pRegion); - - while (nbox--) - { - (*pKaaScr->info->Solid) (pBox->x1 + xoff, pBox->y1 + yoff, - pBox->x2 + xoff, pBox->y2 + yoff); - pBox++; - } - (*pKaaScr->info->DoneSolid) (); - kaaMarkSync (pDrawable->pScreen); - } - else - { - kaaWaitSync (pDrawable->pScreen); - fbFillRegionSolid (pDrawable, pRegion, 0, - fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); - } - kaaDrawableDirty (pDrawable); -} - -Bool -kaaDrawInit (ScreenPtr pScreen, - KaaScreenInfoPtr pScreenInfo) -{ - KaaScreenPrivPtr pKaaScr; - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; -#ifdef RENDER - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); -#endif - - pKaaScr = xalloc (sizeof (KaaScreenPrivRec)); - - if (!pKaaScr) - return FALSE; - - pKaaScr->info = pScreenInfo; - - dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr); - - /* - * Hook up asynchronous drawing - */ - KdScreenInitAsync (pScreen); - /* - * Replace various fb screen functions - */ - pScreen->CreateGC = kaaCreateGC; - pScreen->CopyWindow = kaaCopyWindow; -#ifdef RENDER - if (ps) { - ps->Composite = kaaComposite; - ps->RasterizeTrapezoid = kaaRasterizeTrapezoid; - } -#endif - - /* - * Hookup offscreen pixmaps - */ - if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) && - screen->off_screen_base < screen->memory_size) - { - if (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec))) - return FALSE; - pScreen->CreatePixmap = kaaCreatePixmap; - pScreen->DestroyPixmap = kaaDestroyPixmap; - } - - return TRUE; -} - -void -kaaDrawFini (ScreenPtr pScreen) -{ - KaaScreenPriv(pScreen); - - xfree (pKaaScr); -} - -void -kaaMarkSync (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KaaScreenPriv(pScreen); - - pScreenPriv->card->needSync = TRUE; - if (pKaaScr->info->markSync != NULL) { - pScreenPriv->card->lastMarker = (*pKaaScr->info->markSync) (pScreen); - } -} - -void -kaaWaitSync (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KaaScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - - if (card->needSync) { - (*pKaaScr->info->waitMarker) (pScreen, card->lastMarker); - card->needSync = FALSE; - } -} diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h deleted file mode 100644 index 90b963b10..000000000 --- a/hw/kdrive/src/kaa.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Partly based on code that is Copyright © The XFree86 Project 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 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. - */ - -#ifndef _KAA_H_ -#define _KAA_H_ - -#include "picturestr.h" - -#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \ - dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey)) -#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s) - -#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \ - dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey)) -#define KaaSetPixmapPriv(p,a) \ - dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a) -#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p) - -typedef struct { - KaaScreenInfoPtr info; -} KaaScreenPrivRec, *KaaScreenPrivPtr; - -typedef struct { - KdOffscreenArea *area; - int score; - int devKind; - DevUnion devPrivate; - Bool dirty; -} KaaPixmapPrivRec, *KaaPixmapPrivPtr; - -extern DevPrivateKey kaaScreenPrivateKey; -extern DevPrivateKey kaaPixmapPrivateKey; - - -void -kaaPixmapUseScreen (PixmapPtr pPixmap); - -void -kaaPixmapUseMemory (PixmapPtr pPixmap); - -void -kaaDrawableDirty(DrawablePtr pDrawable); - -Bool -kaaDrawableIsOffscreen (DrawablePtr pDrawable); - -Bool -kaaPixmapIsOffscreen(PixmapPtr p); - -PixmapPtr -kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp); - -void -kaaMoveInPixmap (PixmapPtr pPixmap); - -void -kaaMarkSync (ScreenPtr pScreen); - -void -kaaWaitSync (ScreenPtr pScreen); - -void -kaaCopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure); - -void -kaaComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -kaaRasterizeTrapezoid(PicturePtr pPict, - xTrapezoid *trap, - int xoff, - int yoff); - -void -kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets, - float x_offset, float y_offset); - -#endif /* _KAA_H_ */ diff --git a/hw/kdrive/src/kaapict.c b/hw/kdrive/src/kaapict.c deleted file mode 100644 index 501b6b9c4..000000000 --- a/hw/kdrive/src/kaapict.c +++ /dev/null @@ -1,719 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Partly based on code that is Copyright © The XFree86 Project 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" -#include "kaa.h" - -#ifdef RENDER -#include "mipict.h" - -#define KAA_DEBUG_FALLBACKS 0 - -#if KAA_DEBUG_FALLBACKS -static void kaaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n) -{ - char format[20]; - char size[20]; - char loc; - int temp; - - if (!pict) { - snprintf(string, n, "None"); - return; - } - - switch (pict->format) - { - case PICT_a8r8g8b8: - snprintf(format, 20, "ARGB8888"); - break; - case PICT_r5g6b5: - snprintf(format, 20, "RGB565 "); - break; - case PICT_x1r5g5b5: - snprintf(format, 20, "RGB555 "); - break; - case PICT_a8: - snprintf(format, 20, "A8 "); - break; - case PICT_a1: - snprintf(format, 20, "A1 "); - break; - default: - snprintf(format, 20, "0x%x", (int)pict->format); - break; - } - - loc = kaaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm'; - - snprintf(size, 20, "%dx%d%s", pict->pDrawable->width, - pict->pDrawable->height, pict->repeat ? - " R" : ""); - - snprintf(string, n, "0x%lx:%c fmt %s (%s)", (long)pict, loc, format, size); -} - -static void -kaaPrintCompositeFallback(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst) -{ - char sop[20]; - char srcdesc[40], maskdesc[40], dstdesc[40]; - - switch(op) - { - case PictOpSrc: - sprintf(sop, "Src"); - break; - case PictOpOver: - sprintf(sop, "Over"); - break; - default: - sprintf(sop, "0x%x", (int)op); - break; - } - - kaaCompositeFallbackPictDesc(pSrc, srcdesc, 40); - kaaCompositeFallbackPictDesc(pMask, maskdesc, 40); - kaaCompositeFallbackPictDesc(pDst, dstdesc, 40); - - ErrorF("Composite fallback: op %s, \n" - " src %s, \n" - " mask %s, \n" - " dst %s, \n", - sop, srcdesc, maskdesc, dstdesc); -} - -static void -kaaPrintTrapezoidFallback(PicturePtr pDst) -{ - char dstdesc[40]; - - kaaCompositeFallbackPictDesc(pDst, dstdesc, 40); - - ErrorF("Trapezoid fallback: dst %s, %c/%s\n", - dstdesc, - (pDst->polyMode == PolyModePrecise) ? 'p' : 'i', - (pDst->polyEdge == PolyEdgeSharp) ? "a" : "aa"); -} -#endif - -static Bool -kaaGetPixelFromRGBA(CARD32 *pixel, - CARD16 red, - CARD16 green, - CARD16 blue, - CARD16 alpha, - CARD32 format) -{ - int rbits, bbits, gbits, abits; - int rshift, bshift, gshift, ashift; - - *pixel = 0; - - if (!PICT_FORMAT_COLOR(format)) - return FALSE; - - rbits = PICT_FORMAT_R(format); - gbits = PICT_FORMAT_G(format); - bbits = PICT_FORMAT_B(format); - abits = PICT_FORMAT_A(format); - - if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { - bshift = 0; - gshift = bbits; - rshift = gshift + gbits; - ashift = rshift + rbits; - } else { /* PICT_TYPE_ABGR */ - rshift = 0; - gshift = rbits; - bshift = gshift + gbits; - ashift = bshift + bbits; - } - - *pixel |= ( blue >> (16 - bbits)) << bshift; - *pixel |= ( red >> (16 - rbits)) << rshift; - *pixel |= (green >> (16 - gbits)) << gshift; - *pixel |= (alpha >> (16 - abits)) << ashift; - - return TRUE; -} - - -static Bool -kaaGetRGBAFromPixel(CARD32 pixel, - CARD16 *red, - CARD16 *green, - CARD16 *blue, - CARD16 *alpha, - CARD32 format) -{ - int rbits, bbits, gbits, abits; - int rshift, bshift, gshift, ashift; - - if (!PICT_FORMAT_COLOR(format)) - return FALSE; - - rbits = PICT_FORMAT_R(format); - gbits = PICT_FORMAT_G(format); - bbits = PICT_FORMAT_B(format); - abits = PICT_FORMAT_A(format); - - if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { - bshift = 0; - gshift = bbits; - rshift = gshift + gbits; - ashift = rshift + rbits; - } else { /* PICT_TYPE_ABGR */ - rshift = 0; - gshift = rbits; - bshift = gshift + gbits; - ashift = bshift + bbits; - } - - *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits); - while (rbits < 16) { - *red |= *red >> rbits; - rbits <<= 1; - } - - *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits); - while (gbits < 16) { - *green |= *green >> gbits; - gbits <<= 1; - } - - *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits); - while (bbits < 16) { - *blue |= *blue >> bbits; - bbits <<= 1; - } - - if (abits) { - *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits); - while (abits < 16) { - *alpha |= *alpha >> abits; - abits <<= 1; - } - } else - *alpha = 0xffff; - - return TRUE; -} - -static int -kaaTryDriverSolidFill(PicturePtr pSrc, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - KaaScreenPriv (pDst->pDrawable->pScreen); - RegionRec region; - BoxPtr pbox; - int nbox; - int dst_off_x, dst_off_y; - PixmapPtr pSrcPix, pDstPix; - CARD32 pixel; - CARD16 red, green, blue, alpha; - - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - if (!miComputeCompositeRegion (®ion, pSrc, NULL, pDst, - xSrc, ySrc, 0, 0, xDst, yDst, - width, height)) - return 1; - - if (pSrc->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable); - if (pDst->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable); - - pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y); - if (!pDstPix) { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 0; - } - - if (pSrc->pDrawable->type == DRAWABLE_WINDOW) - pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)( - (WindowPtr) (pSrc->pDrawable)); - else - pSrcPix = (PixmapPtr) (pSrc->pDrawable); - - /* If source is offscreen, we need to sync the accelerator - * before accessing it. We'd prefer for it to be in memory. - */ - if (kaaPixmapIsOffscreen(pSrcPix)) { - kaaWaitSync(pDst->pDrawable->pScreen); - } - - pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr); - if (!kaaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha, - pSrc->format)) - { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return -1; - } - kaaGetPixelFromRGBA(&pixel, red, green, blue, alpha, - pDst->format); - - if (!(*pKaaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel)) - { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return -1; - } - - nbox = REGION_NUM_RECTS(®ion); - pbox = REGION_RECTS(®ion); - while (nbox--) - { - (*pKaaScr->info->Solid) (pbox->x1 + dst_off_x, - pbox->y1 + dst_off_y, - pbox->x2 + dst_off_x, - pbox->y2 + dst_off_y); - pbox++; - } - - (*pKaaScr->info->DoneSolid) (); - kaaMarkSync (pDst->pDrawable->pScreen); - kaaDrawableDirty (pDst->pDrawable); - - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 1; -} - -static int -kaaTryDriverBlend(CARD8 op, - PicturePtr pSrc, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - KaaScreenPriv (pDst->pDrawable->pScreen); - RegionRec region; - BoxPtr pbox; - int nbox; - int src_off_x, src_off_y, dst_off_x, dst_off_y; - PixmapPtr pSrcPix, pDstPix; - struct _Pixmap srcScratch; - - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - if (!miComputeCompositeRegion (®ion, pSrc, NULL, pDst, - xSrc, ySrc, 0, 0, xDst, yDst, - width, height)) - return 1; - - - if (pSrc->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable); - if (pDst->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable); - - pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y); - pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y); - - if (!pDstPix) { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 0; - } - - if (!pSrcPix && pKaaScr->info->UploadToScratch) { - if ((*pKaaScr->info->UploadToScratch) ((PixmapPtr) pSrc->pDrawable, - &srcScratch)) - pSrcPix = &srcScratch; - } - - if (!pSrcPix) { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 0; - } - - if (!(*pKaaScr->info->PrepareBlend) (op, pSrc, pDst, pSrcPix, - pDstPix)) - { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return -1; - } - - nbox = REGION_NUM_RECTS(®ion); - pbox = REGION_RECTS(®ion); - - xSrc -= xDst; - ySrc -= yDst; - - while (nbox--) - { - (*pKaaScr->info->Blend) (pbox->x1 + xSrc + src_off_x, - pbox->y1 + ySrc + src_off_y, - pbox->x1 + dst_off_x, - pbox->y1 + dst_off_y, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - - (*pKaaScr->info->DoneBlend) (); - kaaMarkSync (pDst->pDrawable->pScreen); - kaaDrawableDirty (pDst->pDrawable); - - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 1; -} - -static int -kaaTryDriverComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - KaaScreenPriv (pDst->pDrawable->pScreen); - RegionRec region; - BoxPtr pbox; - int nbox; - int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y; - PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix; - struct _Pixmap scratch; - - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - - if (pMask) { - xMask += pMask->pDrawable->x; - yMask += pMask->pDrawable->y; - } - - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height)) - return 1; - - if (pKaaScr->info->CheckComposite && - !(*pKaaScr->info->CheckComposite) (op, pSrc, pMask, pDst)) - { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return -1; - } - - if (pSrc->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable); - if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseScreen ((PixmapPtr) pMask->pDrawable); - if (pDst->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable); - - pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y); - if (pMask) - pMaskPix = kaaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x, - &mask_off_y); - pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y); - - if (!pDstPix) { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 0; - } - - if (!pSrcPix && (!pMask || pMaskPix) && pKaaScr->info->UploadToScratch) { - if (pSrc->pDrawable->type == DRAWABLE_WINDOW) - pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) ( - (WindowPtr) pSrc->pDrawable); - else - pSrcPix = (PixmapPtr) pSrc->pDrawable; - if ((*pKaaScr->info->UploadToScratch) (pSrcPix, &scratch)) - pSrcPix = &scratch; - } else if (pSrcPix && pMask && !pMaskPix && pKaaScr->info->UploadToScratch) { - if (pMask->pDrawable->type == DRAWABLE_WINDOW) - pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) ( - (WindowPtr) pMask->pDrawable); - else - pMaskPix = (PixmapPtr) pMask->pDrawable; - if ((*pKaaScr->info->UploadToScratch) (pMaskPix, &scratch)) - pMaskPix = &scratch; - } - - if (!pSrcPix || (pMask && !pMaskPix)) { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 0; - } - - if (!(*pKaaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix, - pMaskPix, pDstPix)) - { - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return -1; - } - - nbox = REGION_NUM_RECTS(®ion); - pbox = REGION_RECTS(®ion); - - xMask -= xDst; - yMask -= yDst; - - xSrc -= xDst; - ySrc -= yDst; - - while (nbox--) - { - (*pKaaScr->info->Composite) (pbox->x1 + xSrc + src_off_x, - pbox->y1 + ySrc + src_off_y, - pbox->x1 + xMask + mask_off_x, - pbox->y1 + yMask + mask_off_y, - pbox->x1 + dst_off_x, - pbox->y1 + dst_off_y, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - - (*pKaaScr->info->DoneComposite) (); - kaaMarkSync (pDst->pDrawable->pScreen); - kaaDrawableDirty (pDst->pDrawable); - - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - return 1; -} - - -void -kaaComposite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - KdScreenPriv (pDst->pDrawable->pScreen); - KaaScreenPriv (pDst->pDrawable->pScreen); - int ret = -1; - - if (!pMask && pSrc->pDrawable) - { - if (op == PictOpSrc) - { - if (pScreenPriv->enabled && pSrc->pDrawable && pSrc->pDrawable->width == 1 && - pSrc->pDrawable->height == 1 && pSrc->repeat) - { - ret = kaaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst, - width, height); - if (ret == 1) - return; - } - else if (!pSrc->repeat && !pSrc->transform && - pSrc->format == pDst->format) - { - RegionRec region; - - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, - yDst, width, height)) - return; - - - kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0, - REGION_RECTS(®ion), REGION_NUM_RECTS(®ion), - xSrc - xDst, ySrc - yDst, - FALSE, FALSE, 0, 0); - return; - } - } - - if (pScreenPriv->enabled && pKaaScr->info->PrepareBlend && - !pSrc->alphaMap && !pDst->alphaMap) - { - ret = kaaTryDriverBlend(op, pSrc, pDst, xSrc, ySrc, xDst, yDst, - width, height); - if (ret == 1) - return; - } - } - - if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && - pScreenPriv->enabled && pKaaScr->info->PrepareComposite && - !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) - { - ret = kaaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, - yMask, xDst, yDst, width, height); - if (ret == 1) - return; - } - - if (ret != 0) { - /* failure to accelerate was not due to pixmaps being in the wrong - * locations. - */ - if (pSrc->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable); - if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable); - if (pDst->pDrawable->type == DRAWABLE_PIXMAP) - kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable); - } - -#if KAA_DEBUG_FALLBACKS - kaaPrintCompositeFallback (op, pSrc, pMask, pDst); -#endif - - KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height); -} -#endif - -static xFixed -miLineFixedX (xLineFixed *l, xFixed y, Bool ceil) -{ - xFixed dx = l->p2.x - l->p1.x; - xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; - xFixed dy = l->p2.y - l->p1.y; - if (ceil) - ex += (dy - 1); - return l->p1.x + (xFixed) (ex / dy); -} - -/* Need to decide just how much to trim, to maintain translation independence - * when converted to floating point. - */ -#define XFIXED_TO_FLOAT(x) (((float)((x) & 0xffffff00)) / 65536.0) - -/* This is just to allow us to work on the hardware side of the problem while - * waiting for cairo to get a new tesselator. We may not be able to support - * RasterizeTrapezoid at all due to the abutting edges requirement, but it might - * be technically legal if we widened the trap by some epsilon, so that alpha - * values at abutting edges were a little too big and capped at one, rather than - * a little too small and looked bad. - */ -void kaaRasterizeTrapezoid(PicturePtr pDst, - xTrapezoid *trap, - int xoff, - int yoff) -{ - KdScreenPriv (pDst->pDrawable->pScreen); - KaaScreenPriv (pDst->pDrawable->pScreen); - KaaTrapezoid ktrap; - PixmapPtr pPix; - xFixed x1, x2; - - if (!pScreenPriv->enabled || - !pKaaScr->info->PrepareTrapezoids || - pDst->pDrawable->type != DRAWABLE_PIXMAP || - pDst->alphaMap || pDst->format != PICT_a8) - { - KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff); -#if KAA_DEBUG_FALLBACKS - kaaPrintTrapezoidFallback (pDst); -#endif - return; - } - pPix = (PixmapPtr)pDst->pDrawable; - - kaaPixmapUseScreen (pPix); - - if (!kaaPixmapIsOffscreen (pPix) || - !(*pKaaScr->info->PrepareTrapezoids) (pDst, pPix)) - { -#if KAA_DEBUG_FALLBACKS - kaaPrintTrapezoidFallback (pDst); -#endif - KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff); - return; - } - - ktrap.ty = XFIXED_TO_FLOAT(trap->top) + yoff; - x1 = miLineFixedX (&trap->left, trap->top, FALSE); - x2 = miLineFixedX (&trap->right, trap->top, TRUE); - ktrap.tl = XFIXED_TO_FLOAT(x1) + xoff; - ktrap.tr = XFIXED_TO_FLOAT(x2) + xoff; - ktrap.by = XFIXED_TO_FLOAT(trap->bottom) + yoff; - x1 = miLineFixedX (&trap->left, trap->bottom, FALSE); - x2 = miLineFixedX (&trap->right, trap->bottom, TRUE); - ktrap.bl = XFIXED_TO_FLOAT(x1) + xoff; - ktrap.br = XFIXED_TO_FLOAT(x2) + xoff; - - (*pKaaScr->info->Trapezoids) (&ktrap, 1); - (*pKaaScr->info->DoneTrapezoids) (); -} - -void -kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets, - float x_offset, float y_offset) -{ - int i = 0; - float x, y, x_count, y_count; - - x_count = (1 << (grid_order / 2)) + 1; - y_count = (1 << (grid_order / 2)) - 1; - - x_offset += 1.0 / x_count / 2.0; - y_offset += 1.0 / y_count / 2.0; - - for (x = 0; x < x_count; x++) { - for (y = 0; y < y_count; y++) { - x_offsets[i] = x / x_count + x_offset; - y_offsets[i] = y / y_count + y_offset; - i++; - } - } -} - diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c deleted file mode 100644 index 5388f217d..000000000 --- a/hw/kdrive/src/kasync.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" -#include "kaa.h" -#include "picturestr.h" -#include "mipict.h" -#include "fbpict.h" - -/* - * These functions wrap the low-level fb rendering functions and - * synchronize framebuffer/accelerated drawing by stalling until - * the accelerator is idle - */ - -void -KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - kaaWaitSync (pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted); -} - -void -KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc, - DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) -{ - kaaWaitSync (pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); -} - -void -KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, int format, - char *bits) -{ - kaaWaitSync (pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits); -} - -RegionPtr -KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty) -{ - kaaWaitSync (pSrc->pScreen); - kaaDrawableDirty (pDst); - return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); -} - -RegionPtr -KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty, - unsigned long bitPlane) -{ - kaaWaitSync (pSrc->pScreen); - kaaDrawableDirty (pDst); - return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, - bitPlane); -} - -void -KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, - DDXPointPtr pptInit) -{ - kaaWaitSync (pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPolyPoint (pDrawable, pGC, mode, npt, pptInit); -} - -void -KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt) -{ - - if (pGC->lineWidth == 0) { - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - } - kaaDrawableDirty (pDrawable); - fbPolyLine (pDrawable, pGC, mode, npt, ppt); -} - -void -KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC, - int nsegInit, xSegment *pSegInit) -{ - if (pGC->lineWidth == 0) { - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - } - kaaDrawableDirty (pDrawable); - fbPolySegment (pDrawable, pGC, nsegInit, pSegInit); -} - -void -KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC, - int nrects, xRectangle *prect) -{ - if (pGC->lineWidth == 0) { - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - } - fbPolyRectangle (pDrawable, pGC, nrects, prect); -} - -void -KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *pArcs) -{ - if (pGC->lineWidth == 0) - { - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPolyArc (pDrawable, pGC, narcs, pArcs); - } - else - miPolyArc (pDrawable, pGC, narcs, pArcs); -} - -#if 0 -void -KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, DDXPointPtr pPts) -{ - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbFillPolygon (pDrawable, pGC, mode, count, pPts); -} -#endif - -void -KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrect, xRectangle *prect) -{ - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPolyFillRect (pDrawable, pGC, nrect, prect); -} - -void -KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *pArcs) -{ - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPolyFillArc (pDrawable, pGC, narcs, pArcs); -} - -void -KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase) -{ - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); -} - -void -KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase) -{ - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); -} - -void -KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap, - DrawablePtr pDrawable, - int w, int h, int x, int y) -{ - kaaWaitSync(pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); -} - -void -KdCheckGetImage (DrawablePtr pDrawable, - int x, int y, int w, int h, - unsigned int format, unsigned long planeMask, - char *d) -{ - kaaWaitSync(pDrawable->pScreen); - fbGetImage (pDrawable, x, y, w, h, format, planeMask, d); -} - -void -KdCheckGetSpans (DrawablePtr pDrawable, - int wMax, - DDXPointPtr ppt, - int *pwidth, - int nspans, - char *pdstStart) -{ - kaaWaitSync(pDrawable->pScreen); - fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); -} - -void -KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - kaaWaitSync (pWin->drawable.pScreen); - kaaDrawableDirty ((DrawablePtr)pWin); - fbCopyWindow (pWin, ptOldOrg, prgnSrc); -} - -#if KD_MAX_FB > 1 -void -KdCheckPaintKey(DrawablePtr pDrawable, - RegionPtr pRegion, - CARD32 pixel, - int layer) -{ - kaaWaitSync (pDrawable->pScreen); - kaaDrawableDirty (pDrawable); - fbOverlayPaintKey (pDrawable, pRegion, pixel, layer); -} - -void -KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - kaaWaitSync (pWin->drawable.pScreen); - kaaDrawableDirty ((DrawablePtr)pWin); - fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc); -} -#endif - -void -KdScreenInitAsync (ScreenPtr pScreen) -{ - pScreen->GetImage = KdCheckGetImage; - pScreen->GetSpans = KdCheckGetSpans; - pScreen->CopyWindow = KdCheckCopyWindow; -#ifdef RENDER - KdPictureInitAsync (pScreen); -#endif -} - -void -KdCheckComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - kaaWaitSync (pDst->pDrawable->pScreen); - kaaDrawableDirty (pDst->pDrawable); - fbComposite (op, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height); -} - -void -KdCheckRasterizeTrapezoid(PicturePtr pMask, - xTrapezoid *trap, - int x_off, - int y_off) -{ - kaaWaitSync (pMask->pDrawable->pScreen); - kaaDrawableDirty (pMask->pDrawable); - fbRasterizeTrapezoid (pMask, trap, x_off, y_off); -} - -/* - * Only need to stall for copyarea/copyplane - */ -const GCOps kdAsyncPixmapGCOps = { - fbFillSpans, - fbSetSpans, - fbPutImage, - KdCheckCopyArea, - KdCheckCopyPlane, - fbPolyPoint, - fbPolyLine, - fbPolySegment, - fbPolyRectangle, - fbPolyArc, - fbFillPolygon, - fbPolyFillRect, - fbPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - fbImageGlyphBlt, - fbPolyGlyphBlt, - fbPushPixels -}; - -void -KdPictureInitAsync (ScreenPtr pScreen) -{ - PictureScreenPtr ps; - - ps = GetPictureScreen(pScreen); - ps->Composite = KdCheckComposite; - ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid; -} diff --git a/hw/kdrive/src/kcolor.c b/hw/kdrive/src/kcolor.c deleted file mode 100644 index 31af5c37e..000000000 --- a/hw/kdrive/src/kcolor.c +++ /dev/null @@ -1,881 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" -#include -#include "os.h" -#include "opaque.h" -#include - -unsigned char -KdToLower (unsigned char a) -{ - if ((a >= XK_A) && (a <= XK_Z)) - return a + (XK_a - XK_A); - else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis)) - return a + (XK_agrave - XK_Agrave); - else if ((a >= XK_Ooblique) && (a <= XK_Thorn)) - return a + (XK_oslash - XK_Ooblique); - else - return a; -} - -int -KdStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2) -{ - unsigned char c1, c2; - - for (;;) - { - c1 = KdToLower (*s1++); - if (l2 == 0) - c2 = '\0'; - else - c2 = KdToLower (*s2++); - if (!c1 || !c2) - break; - if (c1 != c2) - break; - l2--; - } - return c2 - c1; -} - -typedef struct _kdNamedColor { - unsigned short red; - unsigned short green; - unsigned short blue; - const unsigned char *name; -} KdNamedColor; - -#define C 0x101 - -const KdNamedColor KdColors[] = { - { 240*C, 248*C, 255*C, "alice blue" }, - { 240*C, 248*C, 255*C, "AliceBlue" }, - { 250*C, 235*C, 215*C, "antique white" }, - { 250*C, 235*C, 215*C, "AntiqueWhite" }, - { 255*C, 239*C, 219*C, "AntiqueWhite1" }, - { 238*C, 223*C, 204*C, "AntiqueWhite2" }, - { 205*C, 192*C, 176*C, "AntiqueWhite3" }, - { 139*C, 131*C, 120*C, "AntiqueWhite4" }, - { 127*C, 255*C, 212*C, "aquamarine" }, - { 127*C, 255*C, 212*C, "aquamarine1" }, - { 118*C, 238*C, 198*C, "aquamarine2" }, - { 102*C, 205*C, 170*C, "aquamarine3" }, - { 69*C, 139*C, 116*C, "aquamarine4" }, - { 240*C, 255*C, 255*C, "azure" }, - { 240*C, 255*C, 255*C, "azure1" }, - { 224*C, 238*C, 238*C, "azure2" }, - { 193*C, 205*C, 205*C, "azure3" }, - { 131*C, 139*C, 139*C, "azure4" }, - { 245*C, 245*C, 220*C, "beige" }, - { 255*C, 228*C, 196*C, "bisque" }, - { 255*C, 228*C, 196*C, "bisque1" }, - { 238*C, 213*C, 183*C, "bisque2" }, - { 205*C, 183*C, 158*C, "bisque3" }, - { 139*C, 125*C, 107*C, "bisque4" }, - { 0*C, 0*C, 0*C, "black" }, - { 255*C, 235*C, 205*C, "blanched almond" }, - { 255*C, 235*C, 205*C, "BlanchedAlmond" }, - { 0*C, 0*C, 255*C, "blue" }, - { 138*C, 43*C, 226*C, "blue violet" }, - { 0*C, 0*C, 255*C, "blue1" }, - { 0*C, 0*C, 238*C, "blue2" }, - { 0*C, 0*C, 205*C, "blue3" }, - { 0*C, 0*C, 139*C, "blue4" }, - { 138*C, 43*C, 226*C, "BlueViolet" }, - { 165*C, 42*C, 42*C, "brown" }, - { 255*C, 64*C, 64*C, "brown1" }, - { 238*C, 59*C, 59*C, "brown2" }, - { 205*C, 51*C, 51*C, "brown3" }, - { 139*C, 35*C, 35*C, "brown4" }, - { 222*C, 184*C, 135*C, "burlywood" }, - { 255*C, 211*C, 155*C, "burlywood1" }, - { 238*C, 197*C, 145*C, "burlywood2" }, - { 205*C, 170*C, 125*C, "burlywood3" }, - { 139*C, 115*C, 85*C, "burlywood4" }, - { 95*C, 158*C, 160*C, "cadet blue" }, - { 95*C, 158*C, 160*C, "CadetBlue" }, - { 152*C, 245*C, 255*C, "CadetBlue1" }, - { 142*C, 229*C, 238*C, "CadetBlue2" }, - { 122*C, 197*C, 205*C, "CadetBlue3" }, - { 83*C, 134*C, 139*C, "CadetBlue4" }, - { 127*C, 255*C, 0*C, "chartreuse" }, - { 127*C, 255*C, 0*C, "chartreuse1" }, - { 118*C, 238*C, 0*C, "chartreuse2" }, - { 102*C, 205*C, 0*C, "chartreuse3" }, - { 69*C, 139*C, 0*C, "chartreuse4" }, - { 210*C, 105*C, 30*C, "chocolate" }, - { 255*C, 127*C, 36*C, "chocolate1" }, - { 238*C, 118*C, 33*C, "chocolate2" }, - { 205*C, 102*C, 29*C, "chocolate3" }, - { 139*C, 69*C, 19*C, "chocolate4" }, - { 255*C, 127*C, 80*C, "coral" }, - { 255*C, 114*C, 86*C, "coral1" }, - { 238*C, 106*C, 80*C, "coral2" }, - { 205*C, 91*C, 69*C, "coral3" }, - { 139*C, 62*C, 47*C, "coral4" }, - { 100*C, 149*C, 237*C, "cornflower blue" }, - { 100*C, 149*C, 237*C, "CornflowerBlue" }, - { 255*C, 248*C, 220*C, "cornsilk" }, - { 255*C, 248*C, 220*C, "cornsilk1" }, - { 238*C, 232*C, 205*C, "cornsilk2" }, - { 205*C, 200*C, 177*C, "cornsilk3" }, - { 139*C, 136*C, 120*C, "cornsilk4" }, - { 0*C, 255*C, 255*C, "cyan" }, - { 0*C, 255*C, 255*C, "cyan1" }, - { 0*C, 238*C, 238*C, "cyan2" }, - { 0*C, 205*C, 205*C, "cyan3" }, - { 0*C, 139*C, 139*C, "cyan4" }, - { 0*C, 0*C, 139*C, "dark blue" }, - { 0*C, 139*C, 139*C, "dark cyan" }, - { 184*C, 134*C, 11*C, "dark goldenrod" }, - { 169*C, 169*C, 169*C, "dark gray" }, - { 0*C, 100*C, 0*C, "dark green" }, - { 169*C, 169*C, 169*C, "dark grey" }, - { 189*C, 183*C, 107*C, "dark khaki" }, - { 139*C, 0*C, 139*C, "dark magenta" }, - { 85*C, 107*C, 47*C, "dark olive green" }, - { 255*C, 140*C, 0*C, "dark orange" }, - { 153*C, 50*C, 204*C, "dark orchid" }, - { 139*C, 0*C, 0*C, "dark red" }, - { 233*C, 150*C, 122*C, "dark salmon" }, - { 143*C, 188*C, 143*C, "dark sea green" }, - { 72*C, 61*C, 139*C, "dark slate blue" }, - { 47*C, 79*C, 79*C, "dark slate gray" }, - { 47*C, 79*C, 79*C, "dark slate grey" }, - { 0*C, 206*C, 209*C, "dark turquoise" }, - { 148*C, 0*C, 211*C, "dark violet" }, - { 0*C, 0*C, 139*C, "DarkBlue" }, - { 0*C, 139*C, 139*C, "DarkCyan" }, - { 184*C, 134*C, 11*C, "DarkGoldenrod" }, - { 255*C, 185*C, 15*C, "DarkGoldenrod1" }, - { 238*C, 173*C, 14*C, "DarkGoldenrod2" }, - { 205*C, 149*C, 12*C, "DarkGoldenrod3" }, - { 139*C, 101*C, 8*C, "DarkGoldenrod4" }, - { 169*C, 169*C, 169*C, "DarkGray" }, - { 0*C, 100*C, 0*C, "DarkGreen" }, - { 169*C, 169*C, 169*C, "DarkGrey" }, - { 189*C, 183*C, 107*C, "DarkKhaki" }, - { 139*C, 0*C, 139*C, "DarkMagenta" }, - { 85*C, 107*C, 47*C, "DarkOliveGreen" }, - { 202*C, 255*C, 112*C, "DarkOliveGreen1" }, - { 188*C, 238*C, 104*C, "DarkOliveGreen2" }, - { 162*C, 205*C, 90*C, "DarkOliveGreen3" }, - { 110*C, 139*C, 61*C, "DarkOliveGreen4" }, - { 255*C, 140*C, 0*C, "DarkOrange" }, - { 255*C, 127*C, 0*C, "DarkOrange1" }, - { 238*C, 118*C, 0*C, "DarkOrange2" }, - { 205*C, 102*C, 0*C, "DarkOrange3" }, - { 139*C, 69*C, 0*C, "DarkOrange4" }, - { 153*C, 50*C, 204*C, "DarkOrchid" }, - { 191*C, 62*C, 255*C, "DarkOrchid1" }, - { 178*C, 58*C, 238*C, "DarkOrchid2" }, - { 154*C, 50*C, 205*C, "DarkOrchid3" }, - { 104*C, 34*C, 139*C, "DarkOrchid4" }, - { 139*C, 0*C, 0*C, "DarkRed" }, - { 233*C, 150*C, 122*C, "DarkSalmon" }, - { 143*C, 188*C, 143*C, "DarkSeaGreen" }, - { 193*C, 255*C, 193*C, "DarkSeaGreen1" }, - { 180*C, 238*C, 180*C, "DarkSeaGreen2" }, - { 155*C, 205*C, 155*C, "DarkSeaGreen3" }, - { 105*C, 139*C, 105*C, "DarkSeaGreen4" }, - { 72*C, 61*C, 139*C, "DarkSlateBlue" }, - { 47*C, 79*C, 79*C, "DarkSlateGray" }, - { 151*C, 255*C, 255*C, "DarkSlateGray1" }, - { 141*C, 238*C, 238*C, "DarkSlateGray2" }, - { 121*C, 205*C, 205*C, "DarkSlateGray3" }, - { 82*C, 139*C, 139*C, "DarkSlateGray4" }, - { 47*C, 79*C, 79*C, "DarkSlateGrey" }, - { 0*C, 206*C, 209*C, "DarkTurquoise" }, - { 148*C, 0*C, 211*C, "DarkViolet" }, - { 255*C, 20*C, 147*C, "deep pink" }, - { 0*C, 191*C, 255*C, "deep sky blue" }, - { 255*C, 20*C, 147*C, "DeepPink" }, - { 255*C, 20*C, 147*C, "DeepPink1" }, - { 238*C, 18*C, 137*C, "DeepPink2" }, - { 205*C, 16*C, 118*C, "DeepPink3" }, - { 139*C, 10*C, 80*C, "DeepPink4" }, - { 0*C, 191*C, 255*C, "DeepSkyBlue" }, - { 0*C, 191*C, 255*C, "DeepSkyBlue1" }, - { 0*C, 178*C, 238*C, "DeepSkyBlue2" }, - { 0*C, 154*C, 205*C, "DeepSkyBlue3" }, - { 0*C, 104*C, 139*C, "DeepSkyBlue4" }, - { 105*C, 105*C, 105*C, "dim gray" }, - { 105*C, 105*C, 105*C, "dim grey" }, - { 105*C, 105*C, 105*C, "DimGray" }, - { 105*C, 105*C, 105*C, "DimGrey" }, - { 30*C, 144*C, 255*C, "dodger blue" }, - { 30*C, 144*C, 255*C, "DodgerBlue" }, - { 30*C, 144*C, 255*C, "DodgerBlue1" }, - { 28*C, 134*C, 238*C, "DodgerBlue2" }, - { 24*C, 116*C, 205*C, "DodgerBlue3" }, - { 16*C, 78*C, 139*C, "DodgerBlue4" }, - { 178*C, 34*C, 34*C, "firebrick" }, - { 255*C, 48*C, 48*C, "firebrick1" }, - { 238*C, 44*C, 44*C, "firebrick2" }, - { 205*C, 38*C, 38*C, "firebrick3" }, - { 139*C, 26*C, 26*C, "firebrick4" }, - { 255*C, 250*C, 240*C, "floral white" }, - { 255*C, 250*C, 240*C, "FloralWhite" }, - { 34*C, 139*C, 34*C, "forest green" }, - { 34*C, 139*C, 34*C, "ForestGreen" }, - { 220*C, 220*C, 220*C, "gainsboro" }, - { 248*C, 248*C, 255*C, "ghost white" }, - { 248*C, 248*C, 255*C, "GhostWhite" }, - { 255*C, 215*C, 0*C, "gold" }, - { 255*C, 215*C, 0*C, "gold1" }, - { 238*C, 201*C, 0*C, "gold2" }, - { 205*C, 173*C, 0*C, "gold3" }, - { 139*C, 117*C, 0*C, "gold4" }, - { 218*C, 165*C, 32*C, "goldenrod" }, - { 255*C, 193*C, 37*C, "goldenrod1" }, - { 238*C, 180*C, 34*C, "goldenrod2" }, - { 205*C, 155*C, 29*C, "goldenrod3" }, - { 139*C, 105*C, 20*C, "goldenrod4" }, - { 190*C, 190*C, 190*C, "gray" }, - { 0*C, 0*C, 0*C, "gray0" }, - { 3*C, 3*C, 3*C, "gray1" }, - { 26*C, 26*C, 26*C, "gray10" }, - { 255*C, 255*C, 255*C, "gray100" }, - { 28*C, 28*C, 28*C, "gray11" }, - { 31*C, 31*C, 31*C, "gray12" }, - { 33*C, 33*C, 33*C, "gray13" }, - { 36*C, 36*C, 36*C, "gray14" }, - { 38*C, 38*C, 38*C, "gray15" }, - { 41*C, 41*C, 41*C, "gray16" }, - { 43*C, 43*C, 43*C, "gray17" }, - { 46*C, 46*C, 46*C, "gray18" }, - { 48*C, 48*C, 48*C, "gray19" }, - { 5*C, 5*C, 5*C, "gray2" }, - { 51*C, 51*C, 51*C, "gray20" }, - { 54*C, 54*C, 54*C, "gray21" }, - { 56*C, 56*C, 56*C, "gray22" }, - { 59*C, 59*C, 59*C, "gray23" }, - { 61*C, 61*C, 61*C, "gray24" }, - { 64*C, 64*C, 64*C, "gray25" }, - { 66*C, 66*C, 66*C, "gray26" }, - { 69*C, 69*C, 69*C, "gray27" }, - { 71*C, 71*C, 71*C, "gray28" }, - { 74*C, 74*C, 74*C, "gray29" }, - { 8*C, 8*C, 8*C, "gray3" }, - { 77*C, 77*C, 77*C, "gray30" }, - { 79*C, 79*C, 79*C, "gray31" }, - { 82*C, 82*C, 82*C, "gray32" }, - { 84*C, 84*C, 84*C, "gray33" }, - { 87*C, 87*C, 87*C, "gray34" }, - { 89*C, 89*C, 89*C, "gray35" }, - { 92*C, 92*C, 92*C, "gray36" }, - { 94*C, 94*C, 94*C, "gray37" }, - { 97*C, 97*C, 97*C, "gray38" }, - { 99*C, 99*C, 99*C, "gray39" }, - { 10*C, 10*C, 10*C, "gray4" }, - { 102*C, 102*C, 102*C, "gray40" }, - { 105*C, 105*C, 105*C, "gray41" }, - { 107*C, 107*C, 107*C, "gray42" }, - { 110*C, 110*C, 110*C, "gray43" }, - { 112*C, 112*C, 112*C, "gray44" }, - { 115*C, 115*C, 115*C, "gray45" }, - { 117*C, 117*C, 117*C, "gray46" }, - { 120*C, 120*C, 120*C, "gray47" }, - { 122*C, 122*C, 122*C, "gray48" }, - { 125*C, 125*C, 125*C, "gray49" }, - { 13*C, 13*C, 13*C, "gray5" }, - { 127*C, 127*C, 127*C, "gray50" }, - { 130*C, 130*C, 130*C, "gray51" }, - { 133*C, 133*C, 133*C, "gray52" }, - { 135*C, 135*C, 135*C, "gray53" }, - { 138*C, 138*C, 138*C, "gray54" }, - { 140*C, 140*C, 140*C, "gray55" }, - { 143*C, 143*C, 143*C, "gray56" }, - { 145*C, 145*C, 145*C, "gray57" }, - { 148*C, 148*C, 148*C, "gray58" }, - { 150*C, 150*C, 150*C, "gray59" }, - { 15*C, 15*C, 15*C, "gray6" }, - { 153*C, 153*C, 153*C, "gray60" }, - { 156*C, 156*C, 156*C, "gray61" }, - { 158*C, 158*C, 158*C, "gray62" }, - { 161*C, 161*C, 161*C, "gray63" }, - { 163*C, 163*C, 163*C, "gray64" }, - { 166*C, 166*C, 166*C, "gray65" }, - { 168*C, 168*C, 168*C, "gray66" }, - { 171*C, 171*C, 171*C, "gray67" }, - { 173*C, 173*C, 173*C, "gray68" }, - { 176*C, 176*C, 176*C, "gray69" }, - { 18*C, 18*C, 18*C, "gray7" }, - { 179*C, 179*C, 179*C, "gray70" }, - { 181*C, 181*C, 181*C, "gray71" }, - { 184*C, 184*C, 184*C, "gray72" }, - { 186*C, 186*C, 186*C, "gray73" }, - { 189*C, 189*C, 189*C, "gray74" }, - { 191*C, 191*C, 191*C, "gray75" }, - { 194*C, 194*C, 194*C, "gray76" }, - { 196*C, 196*C, 196*C, "gray77" }, - { 199*C, 199*C, 199*C, "gray78" }, - { 201*C, 201*C, 201*C, "gray79" }, - { 20*C, 20*C, 20*C, "gray8" }, - { 204*C, 204*C, 204*C, "gray80" }, - { 207*C, 207*C, 207*C, "gray81" }, - { 209*C, 209*C, 209*C, "gray82" }, - { 212*C, 212*C, 212*C, "gray83" }, - { 214*C, 214*C, 214*C, "gray84" }, - { 217*C, 217*C, 217*C, "gray85" }, - { 219*C, 219*C, 219*C, "gray86" }, - { 222*C, 222*C, 222*C, "gray87" }, - { 224*C, 224*C, 224*C, "gray88" }, - { 227*C, 227*C, 227*C, "gray89" }, - { 23*C, 23*C, 23*C, "gray9" }, - { 229*C, 229*C, 229*C, "gray90" }, - { 232*C, 232*C, 232*C, "gray91" }, - { 235*C, 235*C, 235*C, "gray92" }, - { 237*C, 237*C, 237*C, "gray93" }, - { 240*C, 240*C, 240*C, "gray94" }, - { 242*C, 242*C, 242*C, "gray95" }, - { 245*C, 245*C, 245*C, "gray96" }, - { 247*C, 247*C, 247*C, "gray97" }, - { 250*C, 250*C, 250*C, "gray98" }, - { 252*C, 252*C, 252*C, "gray99" }, - { 0*C, 255*C, 0*C, "green" }, - { 173*C, 255*C, 47*C, "green yellow" }, - { 0*C, 255*C, 0*C, "green1" }, - { 0*C, 238*C, 0*C, "green2" }, - { 0*C, 205*C, 0*C, "green3" }, - { 0*C, 139*C, 0*C, "green4" }, - { 173*C, 255*C, 47*C, "GreenYellow" }, - { 190*C, 190*C, 190*C, "grey" }, - { 0*C, 0*C, 0*C, "grey0" }, - { 3*C, 3*C, 3*C, "grey1" }, - { 26*C, 26*C, 26*C, "grey10" }, - { 255*C, 255*C, 255*C, "grey100" }, - { 28*C, 28*C, 28*C, "grey11" }, - { 31*C, 31*C, 31*C, "grey12" }, - { 33*C, 33*C, 33*C, "grey13" }, - { 36*C, 36*C, 36*C, "grey14" }, - { 38*C, 38*C, 38*C, "grey15" }, - { 41*C, 41*C, 41*C, "grey16" }, - { 43*C, 43*C, 43*C, "grey17" }, - { 46*C, 46*C, 46*C, "grey18" }, - { 48*C, 48*C, 48*C, "grey19" }, - { 5*C, 5*C, 5*C, "grey2" }, - { 51*C, 51*C, 51*C, "grey20" }, - { 54*C, 54*C, 54*C, "grey21" }, - { 56*C, 56*C, 56*C, "grey22" }, - { 59*C, 59*C, 59*C, "grey23" }, - { 61*C, 61*C, 61*C, "grey24" }, - { 64*C, 64*C, 64*C, "grey25" }, - { 66*C, 66*C, 66*C, "grey26" }, - { 69*C, 69*C, 69*C, "grey27" }, - { 71*C, 71*C, 71*C, "grey28" }, - { 74*C, 74*C, 74*C, "grey29" }, - { 8*C, 8*C, 8*C, "grey3" }, - { 77*C, 77*C, 77*C, "grey30" }, - { 79*C, 79*C, 79*C, "grey31" }, - { 82*C, 82*C, 82*C, "grey32" }, - { 84*C, 84*C, 84*C, "grey33" }, - { 87*C, 87*C, 87*C, "grey34" }, - { 89*C, 89*C, 89*C, "grey35" }, - { 92*C, 92*C, 92*C, "grey36" }, - { 94*C, 94*C, 94*C, "grey37" }, - { 97*C, 97*C, 97*C, "grey38" }, - { 99*C, 99*C, 99*C, "grey39" }, - { 10*C, 10*C, 10*C, "grey4" }, - { 102*C, 102*C, 102*C, "grey40" }, - { 105*C, 105*C, 105*C, "grey41" }, - { 107*C, 107*C, 107*C, "grey42" }, - { 110*C, 110*C, 110*C, "grey43" }, - { 112*C, 112*C, 112*C, "grey44" }, - { 115*C, 115*C, 115*C, "grey45" }, - { 117*C, 117*C, 117*C, "grey46" }, - { 120*C, 120*C, 120*C, "grey47" }, - { 122*C, 122*C, 122*C, "grey48" }, - { 125*C, 125*C, 125*C, "grey49" }, - { 13*C, 13*C, 13*C, "grey5" }, - { 127*C, 127*C, 127*C, "grey50" }, - { 130*C, 130*C, 130*C, "grey51" }, - { 133*C, 133*C, 133*C, "grey52" }, - { 135*C, 135*C, 135*C, "grey53" }, - { 138*C, 138*C, 138*C, "grey54" }, - { 140*C, 140*C, 140*C, "grey55" }, - { 143*C, 143*C, 143*C, "grey56" }, - { 145*C, 145*C, 145*C, "grey57" }, - { 148*C, 148*C, 148*C, "grey58" }, - { 150*C, 150*C, 150*C, "grey59" }, - { 15*C, 15*C, 15*C, "grey6" }, - { 153*C, 153*C, 153*C, "grey60" }, - { 156*C, 156*C, 156*C, "grey61" }, - { 158*C, 158*C, 158*C, "grey62" }, - { 161*C, 161*C, 161*C, "grey63" }, - { 163*C, 163*C, 163*C, "grey64" }, - { 166*C, 166*C, 166*C, "grey65" }, - { 168*C, 168*C, 168*C, "grey66" }, - { 171*C, 171*C, 171*C, "grey67" }, - { 173*C, 173*C, 173*C, "grey68" }, - { 176*C, 176*C, 176*C, "grey69" }, - { 18*C, 18*C, 18*C, "grey7" }, - { 179*C, 179*C, 179*C, "grey70" }, - { 181*C, 181*C, 181*C, "grey71" }, - { 184*C, 184*C, 184*C, "grey72" }, - { 186*C, 186*C, 186*C, "grey73" }, - { 189*C, 189*C, 189*C, "grey74" }, - { 191*C, 191*C, 191*C, "grey75" }, - { 194*C, 194*C, 194*C, "grey76" }, - { 196*C, 196*C, 196*C, "grey77" }, - { 199*C, 199*C, 199*C, "grey78" }, - { 201*C, 201*C, 201*C, "grey79" }, - { 20*C, 20*C, 20*C, "grey8" }, - { 204*C, 204*C, 204*C, "grey80" }, - { 207*C, 207*C, 207*C, "grey81" }, - { 209*C, 209*C, 209*C, "grey82" }, - { 212*C, 212*C, 212*C, "grey83" }, - { 214*C, 214*C, 214*C, "grey84" }, - { 217*C, 217*C, 217*C, "grey85" }, - { 219*C, 219*C, 219*C, "grey86" }, - { 222*C, 222*C, 222*C, "grey87" }, - { 224*C, 224*C, 224*C, "grey88" }, - { 227*C, 227*C, 227*C, "grey89" }, - { 23*C, 23*C, 23*C, "grey9" }, - { 229*C, 229*C, 229*C, "grey90" }, - { 232*C, 232*C, 232*C, "grey91" }, - { 235*C, 235*C, 235*C, "grey92" }, - { 237*C, 237*C, 237*C, "grey93" }, - { 240*C, 240*C, 240*C, "grey94" }, - { 242*C, 242*C, 242*C, "grey95" }, - { 245*C, 245*C, 245*C, "grey96" }, - { 247*C, 247*C, 247*C, "grey97" }, - { 250*C, 250*C, 250*C, "grey98" }, - { 252*C, 252*C, 252*C, "grey99" }, - { 240*C, 255*C, 240*C, "honeydew" }, - { 240*C, 255*C, 240*C, "honeydew1" }, - { 224*C, 238*C, 224*C, "honeydew2" }, - { 193*C, 205*C, 193*C, "honeydew3" }, - { 131*C, 139*C, 131*C, "honeydew4" }, - { 255*C, 105*C, 180*C, "hot pink" }, - { 255*C, 105*C, 180*C, "HotPink" }, - { 255*C, 110*C, 180*C, "HotPink1" }, - { 238*C, 106*C, 167*C, "HotPink2" }, - { 205*C, 96*C, 144*C, "HotPink3" }, - { 139*C, 58*C, 98*C, "HotPink4" }, - { 205*C, 92*C, 92*C, "indian red" }, - { 205*C, 92*C, 92*C, "IndianRed" }, - { 255*C, 106*C, 106*C, "IndianRed1" }, - { 238*C, 99*C, 99*C, "IndianRed2" }, - { 205*C, 85*C, 85*C, "IndianRed3" }, - { 139*C, 58*C, 58*C, "IndianRed4" }, - { 255*C, 255*C, 240*C, "ivory" }, - { 255*C, 255*C, 240*C, "ivory1" }, - { 238*C, 238*C, 224*C, "ivory2" }, - { 205*C, 205*C, 193*C, "ivory3" }, - { 139*C, 139*C, 131*C, "ivory4" }, - { 240*C, 230*C, 140*C, "khaki" }, - { 255*C, 246*C, 143*C, "khaki1" }, - { 238*C, 230*C, 133*C, "khaki2" }, - { 205*C, 198*C, 115*C, "khaki3" }, - { 139*C, 134*C, 78*C, "khaki4" }, - { 230*C, 230*C, 250*C, "lavender" }, - { 255*C, 240*C, 245*C, "lavender blush" }, - { 255*C, 240*C, 245*C, "LavenderBlush" }, - { 255*C, 240*C, 245*C, "LavenderBlush1" }, - { 238*C, 224*C, 229*C, "LavenderBlush2" }, - { 205*C, 193*C, 197*C, "LavenderBlush3" }, - { 139*C, 131*C, 134*C, "LavenderBlush4" }, - { 124*C, 252*C, 0*C, "lawn green" }, - { 124*C, 252*C, 0*C, "LawnGreen" }, - { 255*C, 250*C, 205*C, "lemon chiffon" }, - { 255*C, 250*C, 205*C, "LemonChiffon" }, - { 255*C, 250*C, 205*C, "LemonChiffon1" }, - { 238*C, 233*C, 191*C, "LemonChiffon2" }, - { 205*C, 201*C, 165*C, "LemonChiffon3" }, - { 139*C, 137*C, 112*C, "LemonChiffon4" }, - { 173*C, 216*C, 230*C, "light blue" }, - { 240*C, 128*C, 128*C, "light coral" }, - { 224*C, 255*C, 255*C, "light cyan" }, - { 238*C, 221*C, 130*C, "light goldenrod" }, - { 250*C, 250*C, 210*C, "light goldenrod yellow" }, - { 211*C, 211*C, 211*C, "light gray" }, - { 144*C, 238*C, 144*C, "light green" }, - { 211*C, 211*C, 211*C, "light grey" }, - { 255*C, 182*C, 193*C, "light pink" }, - { 255*C, 160*C, 122*C, "light salmon" }, - { 32*C, 178*C, 170*C, "light sea green" }, - { 135*C, 206*C, 250*C, "light sky blue" }, - { 132*C, 112*C, 255*C, "light slate blue" }, - { 119*C, 136*C, 153*C, "light slate gray" }, - { 119*C, 136*C, 153*C, "light slate grey" }, - { 176*C, 196*C, 222*C, "light steel blue" }, - { 255*C, 255*C, 224*C, "light yellow" }, - { 173*C, 216*C, 230*C, "LightBlue" }, - { 191*C, 239*C, 255*C, "LightBlue1" }, - { 178*C, 223*C, 238*C, "LightBlue2" }, - { 154*C, 192*C, 205*C, "LightBlue3" }, - { 104*C, 131*C, 139*C, "LightBlue4" }, - { 240*C, 128*C, 128*C, "LightCoral" }, - { 224*C, 255*C, 255*C, "LightCyan" }, - { 224*C, 255*C, 255*C, "LightCyan1" }, - { 209*C, 238*C, 238*C, "LightCyan2" }, - { 180*C, 205*C, 205*C, "LightCyan3" }, - { 122*C, 139*C, 139*C, "LightCyan4" }, - { 238*C, 221*C, 130*C, "LightGoldenrod" }, - { 255*C, 236*C, 139*C, "LightGoldenrod1" }, - { 238*C, 220*C, 130*C, "LightGoldenrod2" }, - { 205*C, 190*C, 112*C, "LightGoldenrod3" }, - { 139*C, 129*C, 76*C, "LightGoldenrod4" }, - { 250*C, 250*C, 210*C, "LightGoldenrodYellow" }, - { 211*C, 211*C, 211*C, "LightGray" }, - { 144*C, 238*C, 144*C, "LightGreen" }, - { 211*C, 211*C, 211*C, "LightGrey" }, - { 255*C, 182*C, 193*C, "LightPink" }, - { 255*C, 174*C, 185*C, "LightPink1" }, - { 238*C, 162*C, 173*C, "LightPink2" }, - { 205*C, 140*C, 149*C, "LightPink3" }, - { 139*C, 95*C, 101*C, "LightPink4" }, - { 255*C, 160*C, 122*C, "LightSalmon" }, - { 255*C, 160*C, 122*C, "LightSalmon1" }, - { 238*C, 149*C, 114*C, "LightSalmon2" }, - { 205*C, 129*C, 98*C, "LightSalmon3" }, - { 139*C, 87*C, 66*C, "LightSalmon4" }, - { 32*C, 178*C, 170*C, "LightSeaGreen" }, - { 135*C, 206*C, 250*C, "LightSkyBlue" }, - { 176*C, 226*C, 255*C, "LightSkyBlue1" }, - { 164*C, 211*C, 238*C, "LightSkyBlue2" }, - { 141*C, 182*C, 205*C, "LightSkyBlue3" }, - { 96*C, 123*C, 139*C, "LightSkyBlue4" }, - { 132*C, 112*C, 255*C, "LightSlateBlue" }, - { 119*C, 136*C, 153*C, "LightSlateGray" }, - { 119*C, 136*C, 153*C, "LightSlateGrey" }, - { 176*C, 196*C, 222*C, "LightSteelBlue" }, - { 202*C, 225*C, 255*C, "LightSteelBlue1" }, - { 188*C, 210*C, 238*C, "LightSteelBlue2" }, - { 162*C, 181*C, 205*C, "LightSteelBlue3" }, - { 110*C, 123*C, 139*C, "LightSteelBlue4" }, - { 255*C, 255*C, 224*C, "LightYellow" }, - { 255*C, 255*C, 224*C, "LightYellow1" }, - { 238*C, 238*C, 209*C, "LightYellow2" }, - { 205*C, 205*C, 180*C, "LightYellow3" }, - { 139*C, 139*C, 122*C, "LightYellow4" }, - { 50*C, 205*C, 50*C, "lime green" }, - { 50*C, 205*C, 50*C, "LimeGreen" }, - { 250*C, 240*C, 230*C, "linen" }, - { 255*C, 0*C, 255*C, "magenta" }, - { 255*C, 0*C, 255*C, "magenta1" }, - { 238*C, 0*C, 238*C, "magenta2" }, - { 205*C, 0*C, 205*C, "magenta3" }, - { 139*C, 0*C, 139*C, "magenta4" }, - { 176*C, 48*C, 96*C, "maroon" }, - { 255*C, 52*C, 179*C, "maroon1" }, - { 238*C, 48*C, 167*C, "maroon2" }, - { 205*C, 41*C, 144*C, "maroon3" }, - { 139*C, 28*C, 98*C, "maroon4" }, - { 102*C, 205*C, 170*C, "medium aquamarine" }, - { 0*C, 0*C, 205*C, "medium blue" }, - { 186*C, 85*C, 211*C, "medium orchid" }, - { 147*C, 112*C, 219*C, "medium purple" }, - { 60*C, 179*C, 113*C, "medium sea green" }, - { 123*C, 104*C, 238*C, "medium slate blue" }, - { 0*C, 250*C, 154*C, "medium spring green" }, - { 72*C, 209*C, 204*C, "medium turquoise" }, - { 199*C, 21*C, 133*C, "medium violet red" }, - { 102*C, 205*C, 170*C, "MediumAquamarine" }, - { 0*C, 0*C, 205*C, "MediumBlue" }, - { 186*C, 85*C, 211*C, "MediumOrchid" }, - { 224*C, 102*C, 255*C, "MediumOrchid1" }, - { 209*C, 95*C, 238*C, "MediumOrchid2" }, - { 180*C, 82*C, 205*C, "MediumOrchid3" }, - { 122*C, 55*C, 139*C, "MediumOrchid4" }, - { 147*C, 112*C, 219*C, "MediumPurple" }, - { 171*C, 130*C, 255*C, "MediumPurple1" }, - { 159*C, 121*C, 238*C, "MediumPurple2" }, - { 137*C, 104*C, 205*C, "MediumPurple3" }, - { 93*C, 71*C, 139*C, "MediumPurple4" }, - { 60*C, 179*C, 113*C, "MediumSeaGreen" }, - { 123*C, 104*C, 238*C, "MediumSlateBlue" }, - { 0*C, 250*C, 154*C, "MediumSpringGreen" }, - { 72*C, 209*C, 204*C, "MediumTurquoise" }, - { 199*C, 21*C, 133*C, "MediumVioletRed" }, - { 25*C, 25*C, 112*C, "midnight blue" }, - { 25*C, 25*C, 112*C, "MidnightBlue" }, - { 245*C, 255*C, 250*C, "mint cream" }, - { 245*C, 255*C, 250*C, "MintCream" }, - { 255*C, 228*C, 225*C, "misty rose" }, - { 255*C, 228*C, 225*C, "MistyRose" }, - { 255*C, 228*C, 225*C, "MistyRose1" }, - { 238*C, 213*C, 210*C, "MistyRose2" }, - { 205*C, 183*C, 181*C, "MistyRose3" }, - { 139*C, 125*C, 123*C, "MistyRose4" }, - { 255*C, 228*C, 181*C, "moccasin" }, - { 255*C, 222*C, 173*C, "navajo white" }, - { 255*C, 222*C, 173*C, "NavajoWhite" }, - { 255*C, 222*C, 173*C, "NavajoWhite1" }, - { 238*C, 207*C, 161*C, "NavajoWhite2" }, - { 205*C, 179*C, 139*C, "NavajoWhite3" }, - { 139*C, 121*C, 94*C, "NavajoWhite4" }, - { 0*C, 0*C, 128*C, "navy" }, - { 0*C, 0*C, 128*C, "navy blue" }, - { 0*C, 0*C, 128*C, "NavyBlue" }, - { 253*C, 245*C, 230*C, "old lace" }, - { 253*C, 245*C, 230*C, "OldLace" }, - { 107*C, 142*C, 35*C, "olive drab" }, - { 107*C, 142*C, 35*C, "OliveDrab" }, - { 192*C, 255*C, 62*C, "OliveDrab1" }, - { 179*C, 238*C, 58*C, "OliveDrab2" }, - { 154*C, 205*C, 50*C, "OliveDrab3" }, - { 105*C, 139*C, 34*C, "OliveDrab4" }, - { 255*C, 165*C, 0*C, "orange" }, - { 255*C, 69*C, 0*C, "orange red" }, - { 255*C, 165*C, 0*C, "orange1" }, - { 238*C, 154*C, 0*C, "orange2" }, - { 205*C, 133*C, 0*C, "orange3" }, - { 139*C, 90*C, 0*C, "orange4" }, - { 255*C, 69*C, 0*C, "OrangeRed" }, - { 255*C, 69*C, 0*C, "OrangeRed1" }, - { 238*C, 64*C, 0*C, "OrangeRed2" }, - { 205*C, 55*C, 0*C, "OrangeRed3" }, - { 139*C, 37*C, 0*C, "OrangeRed4" }, - { 218*C, 112*C, 214*C, "orchid" }, - { 255*C, 131*C, 250*C, "orchid1" }, - { 238*C, 122*C, 233*C, "orchid2" }, - { 205*C, 105*C, 201*C, "orchid3" }, - { 139*C, 71*C, 137*C, "orchid4" }, - { 238*C, 232*C, 170*C, "pale goldenrod" }, - { 152*C, 251*C, 152*C, "pale green" }, - { 175*C, 238*C, 238*C, "pale turquoise" }, - { 219*C, 112*C, 147*C, "pale violet red" }, - { 238*C, 232*C, 170*C, "PaleGoldenrod" }, - { 152*C, 251*C, 152*C, "PaleGreen" }, - { 154*C, 255*C, 154*C, "PaleGreen1" }, - { 144*C, 238*C, 144*C, "PaleGreen2" }, - { 124*C, 205*C, 124*C, "PaleGreen3" }, - { 84*C, 139*C, 84*C, "PaleGreen4" }, - { 175*C, 238*C, 238*C, "PaleTurquoise" }, - { 187*C, 255*C, 255*C, "PaleTurquoise1" }, - { 174*C, 238*C, 238*C, "PaleTurquoise2" }, - { 150*C, 205*C, 205*C, "PaleTurquoise3" }, - { 102*C, 139*C, 139*C, "PaleTurquoise4" }, - { 219*C, 112*C, 147*C, "PaleVioletRed" }, - { 255*C, 130*C, 171*C, "PaleVioletRed1" }, - { 238*C, 121*C, 159*C, "PaleVioletRed2" }, - { 205*C, 104*C, 137*C, "PaleVioletRed3" }, - { 139*C, 71*C, 93*C, "PaleVioletRed4" }, - { 255*C, 239*C, 213*C, "papaya whip" }, - { 255*C, 239*C, 213*C, "PapayaWhip" }, - { 255*C, 218*C, 185*C, "peach puff" }, - { 255*C, 218*C, 185*C, "PeachPuff" }, - { 255*C, 218*C, 185*C, "PeachPuff1" }, - { 238*C, 203*C, 173*C, "PeachPuff2" }, - { 205*C, 175*C, 149*C, "PeachPuff3" }, - { 139*C, 119*C, 101*C, "PeachPuff4" }, - { 205*C, 133*C, 63*C, "peru" }, - { 255*C, 192*C, 203*C, "pink" }, - { 255*C, 181*C, 197*C, "pink1" }, - { 238*C, 169*C, 184*C, "pink2" }, - { 205*C, 145*C, 158*C, "pink3" }, - { 139*C, 99*C, 108*C, "pink4" }, - { 221*C, 160*C, 221*C, "plum" }, - { 255*C, 187*C, 255*C, "plum1" }, - { 238*C, 174*C, 238*C, "plum2" }, - { 205*C, 150*C, 205*C, "plum3" }, - { 139*C, 102*C, 139*C, "plum4" }, - { 176*C, 224*C, 230*C, "powder blue" }, - { 176*C, 224*C, 230*C, "PowderBlue" }, - { 160*C, 32*C, 240*C, "purple" }, - { 155*C, 48*C, 255*C, "purple1" }, - { 145*C, 44*C, 238*C, "purple2" }, - { 125*C, 38*C, 205*C, "purple3" }, - { 85*C, 26*C, 139*C, "purple4" }, - { 255*C, 0*C, 0*C, "red" }, - { 255*C, 0*C, 0*C, "red1" }, - { 238*C, 0*C, 0*C, "red2" }, - { 205*C, 0*C, 0*C, "red3" }, - { 139*C, 0*C, 0*C, "red4" }, - { 188*C, 143*C, 143*C, "rosy brown" }, - { 188*C, 143*C, 143*C, "RosyBrown" }, - { 255*C, 193*C, 193*C, "RosyBrown1" }, - { 238*C, 180*C, 180*C, "RosyBrown2" }, - { 205*C, 155*C, 155*C, "RosyBrown3" }, - { 139*C, 105*C, 105*C, "RosyBrown4" }, - { 65*C, 105*C, 225*C, "royal blue" }, - { 65*C, 105*C, 225*C, "RoyalBlue" }, - { 72*C, 118*C, 255*C, "RoyalBlue1" }, - { 67*C, 110*C, 238*C, "RoyalBlue2" }, - { 58*C, 95*C, 205*C, "RoyalBlue3" }, - { 39*C, 64*C, 139*C, "RoyalBlue4" }, - { 139*C, 69*C, 19*C, "saddle brown" }, - { 139*C, 69*C, 19*C, "SaddleBrown" }, - { 250*C, 128*C, 114*C, "salmon" }, - { 255*C, 140*C, 105*C, "salmon1" }, - { 238*C, 130*C, 98*C, "salmon2" }, - { 205*C, 112*C, 84*C, "salmon3" }, - { 139*C, 76*C, 57*C, "salmon4" }, - { 244*C, 164*C, 96*C, "sandy brown" }, - { 244*C, 164*C, 96*C, "SandyBrown" }, - { 46*C, 139*C, 87*C, "sea green" }, - { 46*C, 139*C, 87*C, "SeaGreen" }, - { 84*C, 255*C, 159*C, "SeaGreen1" }, - { 78*C, 238*C, 148*C, "SeaGreen2" }, - { 67*C, 205*C, 128*C, "SeaGreen3" }, - { 46*C, 139*C, 87*C, "SeaGreen4" }, - { 255*C, 245*C, 238*C, "seashell" }, - { 255*C, 245*C, 238*C, "seashell1" }, - { 238*C, 229*C, 222*C, "seashell2" }, - { 205*C, 197*C, 191*C, "seashell3" }, - { 139*C, 134*C, 130*C, "seashell4" }, - { 160*C, 82*C, 45*C, "sienna" }, - { 255*C, 130*C, 71*C, "sienna1" }, - { 238*C, 121*C, 66*C, "sienna2" }, - { 205*C, 104*C, 57*C, "sienna3" }, - { 139*C, 71*C, 38*C, "sienna4" }, - { 135*C, 206*C, 235*C, "sky blue" }, - { 135*C, 206*C, 235*C, "SkyBlue" }, - { 135*C, 206*C, 255*C, "SkyBlue1" }, - { 126*C, 192*C, 238*C, "SkyBlue2" }, - { 108*C, 166*C, 205*C, "SkyBlue3" }, - { 74*C, 112*C, 139*C, "SkyBlue4" }, - { 106*C, 90*C, 205*C, "slate blue" }, - { 112*C, 128*C, 144*C, "slate gray" }, - { 112*C, 128*C, 144*C, "slate grey" }, - { 106*C, 90*C, 205*C, "SlateBlue" }, - { 131*C, 111*C, 255*C, "SlateBlue1" }, - { 122*C, 103*C, 238*C, "SlateBlue2" }, - { 105*C, 89*C, 205*C, "SlateBlue3" }, - { 71*C, 60*C, 139*C, "SlateBlue4" }, - { 112*C, 128*C, 144*C, "SlateGray" }, - { 198*C, 226*C, 255*C, "SlateGray1" }, - { 185*C, 211*C, 238*C, "SlateGray2" }, - { 159*C, 182*C, 205*C, "SlateGray3" }, - { 108*C, 123*C, 139*C, "SlateGray4" }, - { 112*C, 128*C, 144*C, "SlateGrey" }, - { 255*C, 250*C, 250*C, "snow" }, - { 255*C, 250*C, 250*C, "snow1" }, - { 238*C, 233*C, 233*C, "snow2" }, - { 205*C, 201*C, 201*C, "snow3" }, - { 139*C, 137*C, 137*C, "snow4" }, - { 0*C, 255*C, 127*C, "spring green" }, - { 0*C, 255*C, 127*C, "SpringGreen" }, - { 0*C, 255*C, 127*C, "SpringGreen1" }, - { 0*C, 238*C, 118*C, "SpringGreen2" }, - { 0*C, 205*C, 102*C, "SpringGreen3" }, - { 0*C, 139*C, 69*C, "SpringGreen4" }, - { 70*C, 130*C, 180*C, "steel blue" }, - { 70*C, 130*C, 180*C, "SteelBlue" }, - { 99*C, 184*C, 255*C, "SteelBlue1" }, - { 92*C, 172*C, 238*C, "SteelBlue2" }, - { 79*C, 148*C, 205*C, "SteelBlue3" }, - { 54*C, 100*C, 139*C, "SteelBlue4" }, - { 210*C, 180*C, 140*C, "tan" }, - { 255*C, 165*C, 79*C, "tan1" }, - { 238*C, 154*C, 73*C, "tan2" }, - { 205*C, 133*C, 63*C, "tan3" }, - { 139*C, 90*C, 43*C, "tan4" }, - { 216*C, 191*C, 216*C, "thistle" }, - { 255*C, 225*C, 255*C, "thistle1" }, - { 238*C, 210*C, 238*C, "thistle2" }, - { 205*C, 181*C, 205*C, "thistle3" }, - { 139*C, 123*C, 139*C, "thistle4" }, - { 255*C, 99*C, 71*C, "tomato" }, - { 255*C, 99*C, 71*C, "tomato1" }, - { 238*C, 92*C, 66*C, "tomato2" }, - { 205*C, 79*C, 57*C, "tomato3" }, - { 139*C, 54*C, 38*C, "tomato4" }, - { 64*C, 224*C, 208*C, "turquoise" }, - { 0*C, 245*C, 255*C, "turquoise1" }, - { 0*C, 229*C, 238*C, "turquoise2" }, - { 0*C, 197*C, 205*C, "turquoise3" }, - { 0*C, 134*C, 139*C, "turquoise4" }, - { 238*C, 130*C, 238*C, "violet" }, - { 208*C, 32*C, 144*C, "violet red" }, - { 208*C, 32*C, 144*C, "VioletRed" }, - { 255*C, 62*C, 150*C, "VioletRed1" }, - { 238*C, 58*C, 140*C, "VioletRed2" }, - { 205*C, 50*C, 120*C, "VioletRed3" }, - { 139*C, 34*C, 82*C, "VioletRed4" }, - { 245*C, 222*C, 179*C, "wheat" }, - { 255*C, 231*C, 186*C, "wheat1" }, - { 238*C, 216*C, 174*C, "wheat2" }, - { 205*C, 186*C, 150*C, "wheat3" }, - { 139*C, 126*C, 102*C, "wheat4" }, - { 255*C, 255*C, 255*C, "white" }, - { 245*C, 245*C, 245*C, "white smoke" }, - { 245*C, 245*C, 245*C, "WhiteSmoke" }, - { 255*C, 255*C, 0*C, "yellow" }, - { 154*C, 205*C, 50*C, "yellow green" }, - { 255*C, 255*C, 0*C, "yellow1" }, - { 238*C, 238*C, 0*C, "yellow2" }, - { 205*C, 205*C, 0*C, "yellow3" }, - { 139*C, 139*C, 0*C, "yellow4" }, - { 154*C, 205*C, 50*C, "YellowGreen" } -}; - -#undef C - -#define NUM_KD_COLORS (sizeof (KdColors) / sizeof (KdColors[0])) - -Bool -OsInitColors() -{ - return TRUE; -} - -Bool -OsLookupColor(int screen, - char *s_name, - unsigned int len, - unsigned short *pred, - unsigned short *pgreen, - unsigned short *pblue) -{ - const KdNamedColor *c; - unsigned char *name = (unsigned char *) s_name; - int low, mid, high; - int r; - - low = 0; - high = NUM_KD_COLORS; - while (high - low > 0) - { - mid = (low + high) / 2; - c = &KdColors[mid]; - r = KdStrCaseCmp (c->name, name, len); - if (r == 0) - { - *pred = c->red; - *pgreen = c->green; - *pblue = c->blue; - return TRUE; - } - if (r < 0) - { - if (high == mid) - break; - high = mid; - } - else - { - if (low == mid) - break; - low = mid; - } - } - return FALSE; -} diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 51dc633f7..e31cc25d9 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -208,7 +208,6 @@ KdDisableScreen (ScreenPtr pScreen) if (!pScreenPriv->closed) KdSetRootClip (pScreen, FALSE); KdDisableColormap (pScreen); - KdOffscreenSwapOut (pScreen); if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel) (*pScreenPriv->card->cfuncs->disableAccel) (pScreen); if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor) @@ -285,7 +284,6 @@ KdEnableScreen (ScreenPtr pScreen) pScreenPriv->enabled = TRUE; pScreenPriv->dpmsState = KD_DPMS_NORMAL; pScreenPriv->card->selected = pScreenPriv->screen->mynum; - KdOffscreenSwapIn (pScreen); if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor) (*pScreenPriv->card->cfuncs->enableCursor) (pScreen); if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel) @@ -796,9 +794,6 @@ KdCloseScreen (int index, ScreenPtr pScreen) else ret = TRUE; - if (screen->off_screen_base < screen->memory_size) - KdOffscreenFini (pScreen); - if (pScreenPriv->dpmsState != KD_DPMS_NORMAL) (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL); @@ -1097,9 +1092,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if (!screen->dumb && card->cfuncs->initAccel) if (!(*card->cfuncs->initAccel) (pScreen)) screen->dumb = TRUE; - - if (screen->off_screen_base < screen->memory_size) - KdOffscreenInit (pScreen); #ifdef PSEUDO8 (void) p8Init (pScreen, PSEUDO8_USE_DEFAULT); @@ -1393,6 +1385,11 @@ KdInitOutput (ScreenInfo *pScreenInfo, signal(SIGSEGV, KdBacktrace); } +void +OsVendorFatalError(void) +{ +} + #ifdef DPMSExtension int DPMSSet(ClientPtr client, int level) diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 4e04b59f7..e3878e223 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -114,30 +114,6 @@ typedef struct _KdFrameBuffer { void *closure; } KdFrameBuffer; -typedef struct _KdOffscreenArea KdOffscreenArea; - -typedef void (*KdOffscreenSaveProc) (ScreenPtr pScreen, KdOffscreenArea *area); - -typedef enum _KdOffscreenState { - KdOffscreenAvail, - KdOffscreenRemovable, - KdOffscreenLocked, -} KdOffscreenState; - -struct _KdOffscreenArea { - int offset; - int save_offset; - int size; - int score; - pointer privData; - - KdOffscreenSaveProc save; - - KdOffscreenState state; - - KdOffscreenArea *next; -}; - #define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270) #define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y) @@ -205,8 +181,6 @@ typedef struct { int bytesPerPixel[KD_MAX_FB]; int dpmsState; - - KdOffscreenArea *off_screen_areas; ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */ xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */ @@ -401,90 +375,6 @@ typedef struct _KdPointerMatrix { int matrix[2][3]; } KdPointerMatrix; -typedef struct _KaaTrapezoid { - float tl, tr, ty; - float bl, br, by; -} KaaTrapezoid; - -typedef struct _KaaScreenInfo { - int offsetAlign; - int pitchAlign; - int flags; - - int (*markSync) (ScreenPtr pScreen); - void (*waitMarker) (ScreenPtr pScreen, int marker); - - Bool (*PrepareSolid) (PixmapPtr pPixmap, - int alu, - Pixel planemask, - Pixel fg); - void (*Solid) (int x1, int y1, int x2, int y2); - void (*DoneSolid) (void); - - Bool (*PrepareCopy) (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - Bool upsidedown, - Bool reverse, - int alu, - Pixel planemask); - void (*Copy) (int srcX, - int srcY, - int dstX, - int dstY, - int width, - int height); - void (*DoneCopy) (void); - - Bool (*PrepareBlend) (int op, - PicturePtr pSrcPicture, - PicturePtr pDstPicture, - PixmapPtr pSrc, - PixmapPtr pDst); - void (*Blend) (int srcX, - int srcY, - int dstX, - int dstY, - int width, - int height); - void (*DoneBlend) (void); - - Bool (*CheckComposite) (int op, - PicturePtr pSrcPicture, - PicturePtr pMaskPicture, - PicturePtr pDstPicture); - Bool (*PrepareComposite) (int op, - PicturePtr pSrcPicture, - PicturePtr pMaskPicture, - PicturePtr pDstPicture, - PixmapPtr pSrc, - PixmapPtr pMask, - PixmapPtr pDst); - void (*Composite) (int srcX, - int srcY, - int maskX, - int maskY, - int dstX, - int dstY, - int width, - int height); - void (*DoneComposite) (void); - - Bool (*PrepareTrapezoids) (PicturePtr pDstPicture, - PixmapPtr pDst); - void (*Trapezoids) (KaaTrapezoid *traps, - int ntraps); - void (*DoneTrapezoids) (void); - - Bool (*UploadToScreen) (PixmapPtr pDst, - char *src, - int src_pitch); - Bool (*UploadToScratch) (PixmapPtr pSrc, - PixmapPtr pDst); -} KaaScreenInfoRec, *KaaScreenInfoPtr; - -#define KAA_OFFSCREEN_PIXMAPS (1 << 0) -#define KAA_OFFSCREEN_ALIGN_POT (1 << 1) - /* * This is the only completely portable way to * compute this info. @@ -515,119 +405,6 @@ extern KdOsFuncs *kdOsFuncs; dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v) #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen) -/* kaa.c */ -Bool -kaaDrawInit (ScreenPtr pScreen, - KaaScreenInfoPtr pScreenInfo); - -void -kaaDrawFini (ScreenPtr pScreen); - -void -kaaWrapGC (GCPtr pGC); - -void -kaaUnwrapGC (GCPtr pGC); - -/* kasync.c */ -void -KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans, - DDXPointPtr ppt, int *pwidth, int fSorted); - -void -KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc, - DDXPointPtr ppt, int *pwidth, int nspans, int fSorted); - -void -KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, int format, - char *bits); - -RegionPtr -KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty); - -RegionPtr -KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty, - unsigned long bitPlane); - -void -KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, - DDXPointPtr pptInit); - -void -KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt); - -void -KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC, - int nsegInit, xSegment *pSegInit); - -void -KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC, - int nrects, xRectangle *prect); - -void -KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *pArcs); - -#define KdCheckFillPolygon miFillPolygon - -void -KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrect, xRectangle *prect); - -void -KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc *pArcs); - -void -KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase); - -void -KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase); - -void -KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap, - DrawablePtr pDrawable, - int w, int h, int x, int y); - -void -KdCheckGetImage (DrawablePtr pDrawable, - int x, int y, int w, int h, - unsigned int format, unsigned long planeMask, - char *d); - -void -KdCheckGetSpans (DrawablePtr pDrawable, - int wMax, - DDXPointPtr ppt, - int *pwidth, - int nspans, - char *pdstStart); - -void -KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); - -void -KdCheckPaintKey(DrawablePtr pDrawable, - RegionPtr pRegion, - CARD32 pixel, - int layer); - -void -KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); - -void -KdScreenInitAsync (ScreenPtr pScreen); - -extern const GCOps kdAsyncPixmapGCOps; - /* knoop.c */ extern GCOps kdNoopOps; @@ -921,32 +698,6 @@ KdRandRGetTiming (ScreenPtr pScreen, RRScreenSizePtr pSize); #endif -/* kpict.c */ -void -KdPictureInitAsync (ScreenPtr pScreen); - -#ifdef RENDER -void -KdCheckComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -void -KdCheckRasterizeTrapezoid(PicturePtr pMask, - xTrapezoid *trap, - int x_off, - int y_off); -#endif - /* kshadow.c */ Bool KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate); @@ -960,39 +711,6 @@ KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindow void KdShadowUnset (ScreenPtr pScreen); -/* ktest.c */ -Bool -KdFrameBufferValid (CARD8 *base, int size); - -int -KdFrameBufferSize (CARD8 *base, int max); - -/* koffscreen.c */ - -Bool -KdOffscreenInit (ScreenPtr pScreen); - -KdOffscreenArea * -KdOffscreenAlloc (ScreenPtr pScreen, int size, int align, - Bool locked, - KdOffscreenSaveProc save, - pointer privData); - -KdOffscreenArea * -KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area); - -void -KdOffscreenMarkUsed (PixmapPtr pPixmap); - -void -KdOffscreenSwapOut (ScreenPtr pScreen); - -void -KdOffscreenSwapIn (ScreenPtr pScreen); - -void -KdOffscreenFini (ScreenPtr pScreen); - /* function prototypes to be implemented by the drivers */ void InitCard (char *name); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 830875210..e200c5493 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -2404,6 +2404,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev, return Success; case DEVICE_CORE: + return BadMatch; case DEVICE_ENABLE: return Success; diff --git a/hw/kdrive/src/kloadmap.c b/hw/kdrive/src/kloadmap.c deleted file mode 100644 index 21440a423..000000000 --- a/hw/kdrive/src/kloadmap.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" - -#ifdef WINDOWS -#define KM_BUF 1024 -#define KM_EOF -1 - -typedef struct _km_file { - HANDLE handle; - char buf[KM_BUF]; - char *bufptr; - DWORD remain; -} km_file; - -int -km_fill (km_file *kf) -{ - BOOL r; - - NCD_DEBUG ((DEBUG_INIT, "km_fill")); - r = ReadFile (kf->handle, kf->buf, KM_BUF, - &kf->remain, NULL); - NCD_DEBUG ((DEBUG_INIT, "Got %d", kf->remain)); - if (!r || !kf->remain) - return KM_EOF; - kf->bufptr = kf->buf; - --kf->remain; - return *kf->bufptr++; -} - -#define km_getchar(kf) ((kf)->remain-- ? *kf->bufptr++ : km_fill (kf)) -#else -#define km_getchar(kf) getc(kf) -#endif - -BOOL -km_word (km_file *kf, char *buf, int len) -{ - int c; - - for (;;) - { - switch (c = km_getchar (kf)) { - case KM_EOF: - return FALSE; - case ' ': - case '\t': - case '\n': - case '\r': - continue; - } - break; - } - len--; - while (len--) - { - *buf++ = c; - switch (c = km_getchar (kf)) { - case KM_EOF: - case ' ': - case '\t': - case '\n': - case '\r': - *buf++ = '\0'; - return TRUE; - } - } - return FALSE; -} - -BOOL -km_int (km_file *kf, int *r) -{ - char word[64]; - - if (km_word (kf, word, sizeof (word))) - { - *r = strtol (word, NULL, 0); - return TRUE; - } - return FALSE; -} - -WCHAR *winKbdExtensions[] = { - L".xku", - L".xkb" -}; - -#define NUM_KBD_EXTENSIONS (sizeof (winKbdExtensions) / sizeof (winKbdExtensions[0])) - -BOOL -winLoadKeymap (void) -{ - WCHAR file[32 + KL_NAMELENGTH]; - WCHAR name[KL_NAMELENGTH]; - HKL layout; - km_file kf; - int width; - BOOL ret; - KeySym *m; - int scancode; - int w; - int e; - - layout = GetKeyboardLayout (0); - /* - * Pre-build 46 versions of ThinSTAR software return 0 - * for all layouts - */ - if (!layout) - return FALSE; - NCD_DEBUG ((DEBUG_INIT, "Keyboard layout 0x%x", layout)); - for (e = 0; e < NUM_KBD_EXTENSIONS; e++) - { - wstrcpy (file, L"\\Storage Card\\"); - wsprintf (name, TEXT("%08x"), layout); - wstrcat (file, name); - wstrcat (file, winKbdExtensions[e]); - NCD_DEBUG ((DEBUG_INIT, "Loading keymap from %S", file)); - kf.handle = CreateFile (file, - GENERIC_READ, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (kf.handle != INVALID_HANDLE_VALUE) - break; - } - if (kf.handle == INVALID_HANDLE_VALUE) - { - NCD_DEBUG ((DEBUG_INIT, "No such file")); - return FALSE; - } - ret = FALSE; - kf.remain = 0; - /* - * Keymap format: - * - * flags (optional) - * width - * keycode -> keysym array (num_keycodes * width) - */ - if (!km_int (&kf, &width)) - goto bail1; - if (width & KEYMAP_FLAGS) - { - CEKeymapFlags = (unsigned long) width; - if (!km_int (&kf, &width)) - goto bail1; - } - else - CEKeymapFlags = 0; - if (width > MAX_WIDTH) - goto bail1; - NCD_DEBUG ((DEBUG_INIT, "Keymap width %d flags 0x%x", - width, CEKeymapFlags)); - m = CEKeymap; - for (scancode = MIN_SCANCODE; scancode <= MAX_SCANCODE; scancode++) - { - for (w = 0; w < width; w++) - { - if (!km_int (&kf, m)) - break; - m++; - } - if (w != width) - break; - } - CEKeySyms.mapWidth = width; - ret = TRUE; -bail1: - CloseHandle (kf.handle); - return ret; -} diff --git a/hw/kdrive/src/knoop.c b/hw/kdrive/src/knoop.c deleted file mode 100644 index a3e9468ed..000000000 --- a/hw/kdrive/src/knoop.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * GC ops that don't do anything - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" -#include - -typedef void (* typeFillSpans)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -typedef void (* typeSetSpans)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - char * /*psrc*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - int /*nspans*/, - int /*fSorted*/ -); - -typedef void (* typePutImage)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*depth*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - int /*leftPad*/, - int /*format*/, - char * /*pBits*/ -); - -typedef RegionPtr (* typeCopyArea)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - GCPtr /*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*w*/, - int /*h*/, - int /*dstx*/, - int /*dsty*/ -); - -typedef RegionPtr (* typeCopyPlane)( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr /*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - unsigned long /*bitPlane*/ -); -typedef void (* typePolyPoint)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); - -typedef void (* typePolylines)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); - -typedef void (* typePolySegment)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSegs*/ -); - -typedef void (* typePolyRectangle)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nrects*/, - xRectangle * /*pRects*/ -); - -typedef void (* typePolyArc)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); - -typedef void (* typeFillPolygon)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*shape*/, - int /*mode*/, - int /*count*/, - DDXPointPtr /*pPts*/ -); - -typedef void (* typePolyFillRect)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nrectFill*/, - xRectangle * /*prectInit*/ -); - -typedef void (* typePolyFillArc)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); - -typedef int (* typePolyText8)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - char * /*chars*/ -); - -typedef int (* typePolyText16)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - unsigned short * /*chars*/ -); - -typedef void (* typeImageText8)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - char * /*chars*/ -); - -typedef void (* typeImageText16)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - int /*count*/, - unsigned short * /*chars*/ -); - -typedef void (* typeImageGlyphBlt)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); - -typedef void (* typePolyGlyphBlt)( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); - -typedef void (* typePushPixels)( - GCPtr /*pGC*/, - PixmapPtr /*pBitMap*/, - DrawablePtr /*pDst*/, - int /*w*/, - int /*h*/, - int /*x*/, - int /*y*/ -); - -static RegionPtr -KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - return NullRegion; -} - -static RegionPtr -KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - return NullRegion; -} - -GCOps kdNoopOps = { - (typeFillSpans) NoopDDA, /* fill spans */ - (typeSetSpans) NoopDDA, /* set spans */ - (typePutImage) NoopDDA, /* put image */ - KdNoopCopyArea, /* copy area */ - KdNoopCopyPlane, /* copy plane */ - (typePolyPoint) NoopDDA, /* poly point */ - (typePolylines) NoopDDA, /* poly lines */ - (typePolySegment) NoopDDA, /* poly segment */ - (typePolyRectangle) NoopDDA, /* poly rectangle */ - (typePolyArc) NoopDDA, /* poly arc */ - (typeFillPolygon) NoopDDA, /* fill polygon */ - (typePolyFillRect) NoopDDA, /* poly fillrect */ - (typePolyFillArc) NoopDDA, /* poly fillarc */ - (typePolyText8) NoopDDA, /* text 8 */ - (typePolyText16) NoopDDA, /* text 16 */ - (typeImageText8) NoopDDA, /* itext 8 */ - (typeImageText16) NoopDDA, /* itext 16 */ - (typePolyGlyphBlt) NoopDDA, /* glyph blt */ - (typeImageGlyphBlt) NoopDDA, /* iglyph blt */ - (typePushPixels) NoopDDA, /* push pixels */ -}; diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c deleted file mode 100644 index efe03642f..000000000 --- a/hw/kdrive/src/koffscreen.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright © 2003 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" -#include "kaa.h" - -#define DEBUG_OFFSCREEN 0 -#if DEBUG_OFFSCREEN -#define DBG_OFFSCREEN(a) ErrorF a -#else -#define DBG_OFFSCREEN(a) -#endif - -#if DEBUG_OFFSCREEN -static void -KdOffscreenValidate (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - KdOffscreenArea *prev = 0, *area; - - assert (pScreenPriv->screen->off_screen_areas->area.offset == 0); - for (area = pScreenPriv->off_screen_areas; area; area = area->next) - { - if (prev) - assert (prev->offset + prev->size == area->offset); - - prev = area; - } - assert (prev->offset + prev->size == pScreenPriv->screen->memory_size); -} -#else -#define KdOffscreenValidate(s) -#endif - -static KdOffscreenArea * -KdOffscreenKickOut (ScreenPtr pScreen, KdOffscreenArea *area) -{ - if (area->save) - (*area->save) (pScreen, area); - return KdOffscreenFree (pScreen, area); -} - -KdOffscreenArea * -KdOffscreenAlloc (ScreenPtr pScreen, int size, int align, - Bool locked, - KdOffscreenSaveProc save, - pointer privData) -{ - KdOffscreenArea *area, *begin, *best; - KdScreenPriv (pScreen); - int tmp, real_size = 0, best_score; - - KdOffscreenValidate (pScreen); - if (!align) - align = 1; - - if (!size) - { - DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size)); - return NULL; - } - - /* throw out requests that cannot fit */ - if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base)) - { - DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size)); - return NULL; - } - - /* Try to find a free space that'll fit. */ - for (area = pScreenPriv->off_screen_areas; area; area = area->next) - { - /* skip allocated areas */ - if (area->state != KdOffscreenAvail) - continue; - - /* adjust size to match alignment requirement */ - real_size = size; - tmp = area->offset % align; - if (tmp) - real_size += (align - tmp); - - /* does it fit? */ - if (real_size <= area->size) - break; - } - - if (!area) - { - /* - * Kick out existing users to make space. - * - * First, locate a region which can hold the desired object. - */ - - /* prev points at the first object to boot */ - best = NULL; - best_score = MAXINT; - for (begin = pScreenPriv->off_screen_areas; begin != NULL; - begin = begin->next) - { - int avail, score; - KdOffscreenArea *scan; - - if (begin->state == KdOffscreenLocked) - continue; - - /* adjust size to match alignment requirement */ - real_size = size; - tmp = begin->offset % align; - if (tmp) - real_size += (align - tmp); - - avail = 0; - score = 0; - /* now see if we can make room here, and how "costly" it'll be. */ - for (scan = begin; scan != NULL; scan = scan->next) - { - if (scan->state == KdOffscreenLocked) { - /* Can't make room here, start after this locked area. */ - begin = scan->next; - break; - } - /* Score should only be non-zero for KdOffscreenRemovable */ - score += scan->score; - avail += scan->size; - if (avail >= real_size) - break; - } - /* Is it the best option we've found so far? */ - if (avail >= real_size && score < best_score) { - best = begin; - best_score = score; - } - } - area = best; - if (!area) - { - DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size)); - /* Could not allocate memory */ - KdOffscreenValidate (pScreen); - return NULL; - } - - /* adjust size to match alignment requirement */ - real_size = size; - tmp = begin->offset % align; - if (tmp) - real_size += (align - tmp); - - /* - * Kick out first area if in use - */ - if (area->state != KdOffscreenAvail) - area = KdOffscreenKickOut (pScreen, area); - /* - * Now get the system to merge the other needed areas together - */ - while (area->size < real_size) - { - assert (area->next && area->next->state == KdOffscreenRemovable); - (void) KdOffscreenKickOut (pScreen, area->next); - } - } - - /* save extra space in new area */ - if (real_size < area->size) - { - KdOffscreenArea *new_area = xalloc (sizeof (KdOffscreenArea)); - if (!new_area) - return NULL; - new_area->offset = area->offset + real_size; - new_area->size = area->size - real_size; - new_area->state = KdOffscreenAvail; - new_area->save = 0; - new_area->score = 0; - new_area->next = area->next; - area->next = new_area; - area->size = real_size; - } - /* - * Mark this area as in use - */ - if (locked) - area->state = KdOffscreenLocked; - else - area->state = KdOffscreenRemovable; - area->privData = privData; - area->save = save; - area->score = 0; - - area->save_offset = area->offset; - { - int tmp = area->offset % align; - if (tmp) - area->offset += (align - tmp); - } - - KdOffscreenValidate (pScreen); - - DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x\n", size, area->offset)); - return area; -} - -void -KdOffscreenSwapOut (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - - KdOffscreenValidate (pScreen); - /* loop until a single free area spans the space */ - for (;;) - { - KdOffscreenArea *area = pScreenPriv->off_screen_areas; - - if (!area) - break; - if (area->state == KdOffscreenAvail) - { - area = area->next; - if (!area) - break; - } - assert (area->state != KdOffscreenAvail); - (void) KdOffscreenKickOut (pScreen, area); - KdOffscreenValidate (pScreen); - } - KdOffscreenValidate (pScreen); - KdOffscreenFini (pScreen); -} - -void -KdOffscreenSwapIn (ScreenPtr pScreen) -{ - KdOffscreenInit (pScreen); -} - -/* merge the next free area into this one */ -static void -KdOffscreenMerge (KdOffscreenArea *area) -{ - KdOffscreenArea *next = area->next; - - /* account for space */ - area->size += next->size; - /* frob pointer */ - area->next = next->next; - xfree (next); -} - -KdOffscreenArea * -KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area) -{ - KdScreenPriv(pScreen); - KdOffscreenArea *next = area->next; - KdOffscreenArea *prev; - - DBG_OFFSCREEN (("Free 0x%x -> 0x%x\n", area->size, area->offset)); - KdOffscreenValidate (pScreen); - - area->state = KdOffscreenAvail; - area->save = 0; - area->offset = area->save_offset; - area->score = 0; - - /* - * Find previous area - */ - if (area == pScreenPriv->off_screen_areas) - prev = 0; - else - for (prev = pScreenPriv->off_screen_areas; prev; prev = prev->next) - if (prev->next == area) - break; - - /* link with next area if free */ - if (next && next->state == KdOffscreenAvail) - KdOffscreenMerge (area); - - /* link with prev area if free */ - if (prev && prev->state == KdOffscreenAvail) - { - area = prev; - KdOffscreenMerge (area); - } - - KdOffscreenValidate (pScreen); - return area; -} - -void -KdOffscreenMarkUsed (PixmapPtr pPixmap) -{ - KaaPixmapPriv (pPixmap); - KdScreenPriv (pPixmap->drawable.pScreen); - static int iter = 0; - - if (!pKaaPixmap->area) - return; - - /* The numbers here are arbitrary. We may want to tune these. */ - pKaaPixmap->area->score += 100; - if (++iter == 10) { - KdOffscreenArea *area; - for (area = pScreenPriv->off_screen_areas; area != NULL; - area = area->next) - { - if (area->state == KdOffscreenRemovable) - area->score = (area->score * 7) / 8; - } - } -} - -Bool -KdOffscreenInit (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - KdOffscreenArea *area; - - /* Allocate a big free area */ - area = xalloc (sizeof (KdOffscreenArea)); - - if (!area) - return FALSE; - - area->state = KdOffscreenAvail; - area->offset = pScreenPriv->screen->off_screen_base; - area->size = pScreenPriv->screen->memory_size - area->offset; - area->save = 0; - area->next = NULL; - area->score = 0; - - /* Add it to the free areas */ - pScreenPriv->off_screen_areas = area; - - KdOffscreenValidate (pScreen); - - return TRUE; -} - -void -KdOffscreenFini (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - KdOffscreenArea *area; - - /* just free all of the area records */ - while ((area = pScreenPriv->off_screen_areas)) - { - pScreenPriv->off_screen_areas = area->next; - xfree (area); - } -} diff --git a/hw/kdrive/src/ktest.c b/hw/kdrive/src/ktest.c deleted file mode 100644 index 150af5639..000000000 --- a/hw/kdrive/src/ktest.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "kdrive.h" - - -static CARD8 memoryPatterns[] = { 0xff, 0x00, 0x5a, 0xa5, 0xaa, 0x55 }; - -#define NUM_PATTERNS (sizeof (memoryPatterns) / sizeof (memoryPatterns[0])) - -Bool -KdFrameBufferValid (CARD8 *base, int size) -{ - volatile CARD8 *b = (volatile CARD8 *) base; - CARD8 save, test, compare; - int i, j; - - b = base + (size - 1); - save = *b; - - for (i = 0; i < NUM_PATTERNS; i++) - { - test = memoryPatterns[i]; - *b = test; - for (j = 0; j < 1000; j++) - { - compare = *b; - if (compare != test) - return FALSE; - } - } - *b = save; - return TRUE; -} - -int -KdFrameBufferSize (CARD8 *base, int max) -{ - int min, cur; - - min = 0; - while (min + 1 < max) - { - cur = (max + min) / 2; - if (KdFrameBufferValid (base, cur)) - min = cur; - else - max = cur; - } - if (KdFrameBufferValid (base, max)) - return max; - else - return min; -} diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c index 0b8d1c4e0..83ca3935f 100644 --- a/hw/kdrive/src/kxv.c +++ b/hw/kdrive/src/kxv.c @@ -1728,47 +1728,6 @@ KdXVQueryImageAttributes( } -/**************** Offscreen surface stuff *******************/ - -typedef struct { - KdOffscreenImagePtr images; - int num; -} OffscreenImageRec; - -static OffscreenImageRec OffscreenImages[MAXSCREENS]; -static Bool offscreenInited = FALSE; - -Bool -KdXVRegisterOffscreenImages( - ScreenPtr pScreen, - KdOffscreenImagePtr images, - int num -){ - if(!offscreenInited) { - bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS])); - offscreenInited = TRUE; - } - - OffscreenImages[pScreen->myNum].num = num; - OffscreenImages[pScreen->myNum].images = images; - - return TRUE; -} - -KdOffscreenImagePtr -KdXVQueryOffscreenImages( - ScreenPtr pScreen, - int *num -){ - if(!offscreenInited) { - *num = 0; - return NULL; - } - - *num = OffscreenImages[pScreen->myNum].num; - return OffscreenImages[pScreen->myNum].images; -} - /**************** Common video manipulation functions *******************/ void diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h index 5d1441642..900baefde 100644 --- a/hw/kdrive/src/kxv.h +++ b/hw/kdrive/src/kxv.h @@ -186,30 +186,6 @@ typedef struct { QueryImageAttributesFuncPtr QueryImageAttributes; } KdVideoAdaptorRec, *KdVideoAdaptorPtr; -typedef struct { - KdImagePtr image; - int flags; - int (*alloc_surface)(KdScreenInfo * screen, - int id, - unsigned short width, - unsigned short height, - KdSurfacePtr surface); - int (*free_surface)(KdSurfacePtr surface); - int (*display) (KdSurfacePtr surface, - short vid_x, short vid_y, - short drw_x, short drw_y, - short vid_w, short vid_h, - short drw_w, short drw_h, - RegionPtr clipBoxes); - int (*stop) (KdSurfacePtr surface); - int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value); - int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value); - int max_width; - int max_height; - int num_attributes; - KdAttributePtr attributes; -} KdOffscreenImageRec, *KdOffscreenImagePtr; - Bool KdXVScreenInit( ScreenPtr pScreen, @@ -231,19 +207,6 @@ KdXVListGenericAdaptors( KdVideoAdaptorPtr **Adaptors ); -Bool -KdXVRegisterOffscreenImages( - ScreenPtr pScreen, - KdOffscreenImagePtr images, - int num -); - -KdOffscreenImagePtr -KdXVQueryOffscreenImages( - ScreenPtr pScreen, - int *num -); - void KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr, int srcPitch, int dstPitch, int srcW, int srcH, int top, int left, diff --git a/hw/kdrive/vesa/Makefile.am b/hw/kdrive/vesa/Makefile.am index ac50d2bf5..4225dcfbc 100644 --- a/hw/kdrive/vesa/Makefile.am +++ b/hw/kdrive/vesa/Makefile.am @@ -27,5 +27,7 @@ Xvesa_DEPENDENCIES = \ libvesa.a \ @KDRIVE_LOCAL_LIBS@ +Xvesa_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + relink: rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/vesa/vesa.c b/hw/kdrive/vesa/vesa.c index d6fa5eb06..316b873ab 100644 --- a/hw/kdrive/vesa/vesa.c +++ b/hw/kdrive/vesa/vesa.c @@ -1226,8 +1226,6 @@ vesaRandRSetConfig (ScreenPtr pScreen, break; } - KdOffscreenSwapOut (screen->pScreen); - vesaUnmapFramebuffer (screen); if (!vesaComputeFramebufferMapping (screen)) diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am index 9ceecccc0..a4a120a05 100644 --- a/hw/vfb/Makefile.am +++ b/hw/vfb/Makefile.am @@ -26,6 +26,7 @@ XVFB_LIBS = \ Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) Xvfb_DEPENDENCIES = $(XVFB_LIBS) +Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) # Man page include $(top_srcdir)/cpprules.in diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am index 703566594..8b6c2ccd9 100644 --- a/hw/xfree86/Makefile.am +++ b/hw/xfree86/Makefile.am @@ -16,21 +16,17 @@ 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) \ +SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser \ + ramdac shadowfb vbe vgahw xaa \ xf8_16bpp loader dixmods exa modes \ $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR) $(GLUCOSE_DIR) DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \ - parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \ - xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \ - utils doc glucose + parser ramdac shadowfb vbe vgahw xaa \ + xf8_16bpp loader dixmods dri dri2 exa modes \ + utils doc bin_PROGRAMS = Xorg @@ -56,7 +52,6 @@ XORG_LIBS = \ common/libinit.a \ loader/libloader.a \ libosandcommon.la \ - rac/librac.a \ parser/libxf86config.a \ dixmods/libdixmods.la \ modes/libxf86modes.a \ diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index c4be599f1..6aa117448 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -5,16 +5,11 @@ if XORG_BUS_SPARC SBUS_SOURCES = xf86sbusBus.c endif -if DEBUG -DEBUGSOURCES = xf86Debug.c -endif - if XV XVSOURCES = xf86xv.c xf86xvmc.c XVSDKINCS = xf86xv.h xf86xvmc.h endif -XKBSOURCES = xf86XKB.c XISOURCES = xf86Xinput.c xisb.c XISDKINCS = xf86Xinput.h xisb.h RANDRSOURCES = xf86RandR.c @@ -34,14 +29,14 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Cursor.c xf86DGA.c xf86DPMS.c \ xf86DoProbe.c xf86Events.c \ xf86Globals.c xf86AutoConfig.c \ - xf86MiscExt.c xf86Option.c \ + xf86Option.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ - xf86Helper.c xf86PM.c \ - xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \ - $(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \ - $(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES) + xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \ + xf86Mode.c xorgHelper.c \ + $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) nodist_libcommon_la_SOURCES = xf86DefModeSet.c -libinit_a_SOURCES = xf86Build.h xf86Init.c +libinit_a_SOURCES = xf86Init.c +nodist_libinit_a_SOURCES = xf86Build.h INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \ @@ -50,7 +45,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \ - xf86cmap.h xf86fbman.h xf86str.h $(XISDKINCS) \ + xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h xf86Xinput.h xisb.h \ $(XVSDKINCS) atKeynames.h xf86Version.h xorgVersion.h \ xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h @@ -63,7 +58,6 @@ EXTRA_DIST = \ fourcc.h \ scoasm.h \ xf86.h \ - xf86Build.h \ xf86Bus.h \ xf86Config.h \ xf86InPriv.h \ @@ -82,7 +76,6 @@ EXTRA_DIST = \ xf86xvmc.h \ xf86xvpriv.h \ xisb.h \ - xf86Build.h.in \ xf86Version.h \ xorgVersion.h \ xf86Date.h \ diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index 9e7f8219d..9e9234f97 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port); extern unsigned int inw(unsigned long port); extern unsigned int inl(unsigned long port); -# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__)) +# elif defined(linux) && defined(__amd64__) # include @@ -564,9 +564,8 @@ inl(unsigned short port) return ret; } -# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__) +# elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__) -# if !defined(Lynx) # ifndef ASI_PL # define ASI_PL 0x88 # endif @@ -805,7 +804,6 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset, : "r" (val), "r" (addr), "i" (ASI_PL)); } -# endif /* !Lynx */ /* * EGCS 1.1 knows about arbitrary unaligned loads. Define some @@ -1067,7 +1065,7 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, # define write_mem_barrier() /* NOP */ # endif /* __arm32__ */ -# elif (defined(Lynx) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__) +# elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__) # ifndef MAP_FAILED # define MAP_FAILED ((void *)-1) diff --git a/hw/xfree86/common/extramodes b/hw/xfree86/common/extramodes index 1d72861e4..450502670 100644 --- a/hw/xfree86/common/extramodes +++ b/hw/xfree86/common/extramodes @@ -7,18 +7,12 @@ # 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync -# 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz -ModeLine "1152x768" 64.995 1152 1178 1314 1472 768 771 777 806 +hsync +vsync - # 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync # 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync -# 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz -Modeline "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync - # 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 065102fb5..166f801ca 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -340,23 +340,6 @@ Bool xf86IsUnblank(int mode); _X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module); _X_DEPRECATED void xf86DeleteModuleInfo(int idx); -void xf86getsecs(long *, long *); - -/* xf86Debug.c */ -#ifdef BUILDDEBUG -CARD8 xf86PeekFb8(CARD8 *p); -CARD16 xf86PeekFb16(CARD16 *p); -CARD32 xf86PeekFb32(CARD32 *p); -void xf86PokeFb8(CARD8 *p, CARD8 v); -void xf86PokeFb16(CARD16 *p, CARD16 v); -void xf86PokeFb32(CARD16 *p, CARD32 v); -CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset); -CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset); -CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset); -void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v); -void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v); -void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v); -#endif /* xf86Init.c */ @@ -418,12 +401,6 @@ Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, Bool VidModeExtensionInit(ScreenPtr pScreen); -/* xf86Versions.c */ -CARD32 xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flag); -Bool xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, - CARD32 version, int flags); - - #endif /* _NO_XF86_PROTOTYPES */ #endif /* _XF86_H */ diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index 7e5fab412..45c42e1d8 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -41,6 +41,11 @@ #include "xf86_OSlib.h" #include "dirent.h" +#ifdef sun +# include +# include +#endif + /* Sections for the default built-in configuration. */ #define BUILTIN_DEVICE_NAME \ @@ -79,11 +84,8 @@ static const char **builtinConfig = NULL; static int builtinLines = 0; -static const char *deviceList[] = { - "fbdev", - "vesa", - NULL -}; + +static void listPossibleVideoDrivers(char *matches[], int nmatches); /* * A built-in config file is stored as an array of strings, with each string @@ -135,87 +137,91 @@ AppendToConfig(const char *s) AppendToList(s, &builtinConfig, &builtinLines); } -static const char * -videoPtrToDriverName(struct pci_device *dev) +static int +videoPtrToDriverList(struct pci_device *dev, + char *returnList[], int returnListMax) { /* * things not handled yet: * cyrix/nsc. should be merged into geode anyway. * xgi. */ + int i; + /* Add more entries here if we ever return more than 4 drivers for + any device */ + char *driverList[5] = { NULL, NULL, NULL, NULL, NULL }; switch (dev->vendor_id) { case 0x1022: - if (dev->device_id == 0x2081) - return "geode"; - else - return NULL; - case 0x1142: return "apm"; - case 0xedd8: return "ark"; - case 0x1a03: return "ast"; - case 0x1002: return "ati"; - case 0x102c: return "chips"; - case 0x1013: return "cirrus"; + if (dev->device_id == 0x2081) { + driverList[0] = "geode"; + driverList[1] = "amd"; + } + break; + case 0x1142: driverList[0] = "apm"; break; + case 0xedd8: driverList[0] = "ark"; break; + case 0x1a03: driverList[0] = "ast"; break; + case 0x1002: driverList[0] = "ati"; break; + case 0x102c: driverList[0] = "chips"; break; + case 0x1013: driverList[0] = "cirrus"; break; case 0x8086: - if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) - return "i740"; - else return "intel"; - case 0x102b: return "mga"; - case 0x10c8: return "neomagic"; - case 0x105d: return "i128"; - case 0x10de: case 0x12d2: return "nv"; - case 0x1163: return "rendition"; + if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) { + driverList[0] = "i740"; + } else { + driverList[0] = "intel"; + driverList[1] = "i810"; + } + break; + case 0x102b: driverList[0] = "mga"; break; + case 0x10c8: driverList[0] = "neomagic"; break; + case 0x105d: driverList[0] = "i128"; break; + case 0x10de: case 0x12d2: driverList[0] = "nv"; break; + case 0x1163: driverList[0] = "rendition"; break; case 0x5333: switch (dev->device_id) { case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811: case 0x8812: case 0x8814: case 0x8901: - return "s3"; + driverList[0] = "s3"; break; case 0x5631: case 0x883d: case 0x8a01: case 0x8a10: case 0x8c01: case 0x8c03: case 0x8904: case 0x8a13: - return "s3virge"; + driverList[0] = "s3virge"; break; default: - return "savage"; + driverList[0] = "savage"; break; } - case 0x1039: return "sis"; - case 0x126f: return "siliconmotion"; + break; + case 0x1039: driverList[0] = "sis"; break; + case 0x126f: driverList[0] = "siliconmotion"; break; case 0x121a: if (dev->device_id < 0x0003) - return "voodoo"; + driverList[0] = "voodoo"; else - return "tdfx"; - case 0x3d3d: return "glint"; - case 0x1023: return "trident"; - case 0x100c: return "tseng"; - case 0x1106: return "openchrome"; - case 0x15ad: return "vmware"; + driverList[0] = "tdfx"; + break; + case 0x3d3d: driverList[0] = "glint"; break; + case 0x1023: driverList[0] = "trident"; break; + case 0x100c: driverList[0] = "tseng"; break; + case 0x1106: driverList[0] = "openchrome"; break; + case 0x15ad: driverList[0] = "vmware"; break; default: break; } - return NULL; + for (i = 0; (i < returnListMax) && (driverList[i] != NULL); i++) { + returnList[i] = xnfstrdup(driverList[i]); + } + return i; /* Number of entries added */ } Bool xf86AutoConfig(void) { - const char **p; + char *deviceList[20]; + char **p; + const char **cp; char buf[1024]; - const char *driver = NULL; ConfigStatus ret; - driver = chooseVideoDriver(); - - if (driver) { - snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE, - driver, 0, driver); - AppendToConfig(buf); - ErrorF("New driver is \"%s\"\n", driver); - buf[0] = '\t'; - AppendToConfig(BUILTIN_DEVICE_SECTION_POST); - snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, - driver, 0, driver, 0); - AppendToConfig(buf); - } + listPossibleVideoDrivers(deviceList, 20); for (p = deviceList; *p; p++) { snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p); @@ -225,23 +231,23 @@ xf86AutoConfig(void) } AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE); - if (driver) { - snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, driver, 0); - AppendToConfig(buf); - } for (p = deviceList; *p; p++) { snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0); AppendToConfig(buf); } AppendToConfig(BUILTIN_LAYOUT_SECTION_POST); + for (p = deviceList; *p; p++) { + xfree(*p); + } + xf86MsgVerb(X_DEFAULT, 0, "Using default built-in configuration (%d lines)\n", builtinLines); xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n"); - for (p = builtinConfig; *p; p++) - xf86ErrorFVerb(3, "\t%s", *p); + for (cp = builtinConfig; *cp; cp++) + xf86ErrorFVerb(3, "\t%s", *cp); xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n"); xf86setBuiltinConfig(builtinConfig); @@ -416,17 +422,51 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip } #endif /* __linux__ */ -char* -chooseVideoDriver(void) +static void +listPossibleVideoDrivers(char *matches[], int nmatches) { struct pci_device * info = NULL; struct pci_device_iterator *iter; - char *chosen_driver = NULL; int i; - char *matches[20]; /* If we have more than 20 drivers we're in trouble */ - for (i=0 ; i<20 ; i++) + for (i = 0 ; i < nmatches ; i++) { matches[i] = NULL; + } + i = 0; + +#ifdef sun + /* Check for driver type based on /dev/fb type and if valid, use + it instead of PCI bus probe results */ + if (xf86Info.consoleFd >= 0) { + struct vis_identifier visid; + const char *cp; + + if (ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid) >= 0) { + xf86Msg(X_PROBED, "console driver: %s\n", visid.name); + + /* Special case from before the general case was set */ + if (strcmp(visid.name, "NVDAnvda") == 0) { + matches[i++] = xnfstrdup("nvidia"); + } + + /* General case - split into vendor name (initial all-caps + prefix) & driver name (rest of the string). */ + if (strcmp(visid.name, "SUNWtext") != 0) { + for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) { + /* find end of all uppercase vendor section */ + } + if ((cp != visid.name) && (*cp != '\0')) { + char *driverName = xnfstrdup(cp); + char *vendorName = xnfstrdup(visid.name); + vendorName[cp - visid.name] = '\0'; + + matches[i++] = vendorName; + matches[i++] = driverName; + } + } + } + } +#endif /* Find the primary device, and get some information about it. */ iter = pci_slot_match_iterator_create(NULL); @@ -447,31 +487,52 @@ chooseVideoDriver(void) } #endif /* __linux__ */ - /* TODO Handle multiple drivers claiming to support the same PCI ID */ - if (matches[0]) { - chosen_driver = matches[0]; - } else { - if (info != NULL) - chosen_driver = videoPtrToDriverName(info); - if (chosen_driver == NULL) { -#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__ - chosen_driver = "vesa"; -#elif defined __sparc__ - chosen_driver = "sunffb"; -#else - chosen_driver = "fbdev"; -#endif - } + for (i = 0; (i < nmatches) && (matches[i]); i++) { + /* find end of matches list */ } - xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver); + if ((info != NULL) && (i < nmatches)) { + i += videoPtrToDriverList(info, &(matches[i]), nmatches - i); + } - i = 0; - while (matches[i]) { + /* Fallback to platform default hardware */ + if (i < (nmatches - 1)) { +#if defined(__i386__) || defined(__amd64__) || defined(__hurd__) + matches[i++] = xnfstrdup("vesa"); +#elif defined(__sparc__) && !defined(sun) + matches[i++] = xnfstrdup("sunffb"); +#endif + } + + /* Fallback to platform default frame buffer driver */ + if (i < (nmatches - 1)) { +#if !defined(__linux__) && defined(__sparc__) + matches[i++] = xnfstrdup("wsfb"); +#else + matches[i++] = xnfstrdup("fbdev"); +#endif + } +} + +char* +chooseVideoDriver(void) +{ + char *chosen_driver = NULL; + int i; + char *matches[20]; /* If we have more than 20 drivers we're in trouble */ + + listPossibleVideoDrivers(matches, 20); + + /* TODO Handle multiple drivers claiming to support the same PCI ID */ + chosen_driver = matches[0]; + + xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", + chosen_driver); + + for (i = 0; matches[i] ; i++) { if (matches[i] != chosen_driver) { xfree(matches[i]); } - i++; } return chosen_driver; diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index eb084a5ee..663d81a5f 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -116,12 +116,13 @@ static ModuleDefault ModuleDefaults[] = { {.name = "extmod", .toLoad = TRUE, .load_opt=NULL}, {.name = "dbe", .toLoad = TRUE, .load_opt=NULL}, {.name = "glx", .toLoad = TRUE, .load_opt=NULL}, - {.name = "freetype", .toLoad = TRUE, .load_opt=NULL}, #ifdef XRECORD {.name = "record", .toLoad = TRUE, .load_opt=NULL}, #endif {.name = "dri", .toLoad = TRUE, .load_opt=NULL}, +#ifdef DRI2 {.name = "dri2", .toLoad = TRUE, .load_opt=NULL}, +#endif {.name = NULL, .toLoad = FALSE, .load_opt=NULL} }; @@ -305,7 +306,7 @@ xf86ModulelistFromConfig(pointer **optlist) } } if (found == FALSE) { - XF86ConfModulePtr ptr = xf86configptr->conf_modules; + XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules; ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt); xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name); } @@ -314,7 +315,7 @@ xf86ModulelistFromConfig(pointer **optlist) xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec)); for (i=0 ; ModuleDefaults[i].name != NULL ; i++) { if (ModuleDefaults[i].toLoad == TRUE) { - XF86ConfModulePtr ptr = xf86configptr->conf_modules; + XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules; ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt); } } @@ -599,8 +600,9 @@ configFiles(XF86ConfFilesPtr fileconf) pathFrom = X_CONFIG; if (*f) { if (xf86Info.useDefaultFontPath) { + char *g; xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath); - char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3); + g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3); strcpy(g, f); strcat(g, ","); defaultFontPath = strcat(g, defaultFontPath); @@ -948,13 +950,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Info.vidModeAllowNonLocal = value; #endif -#ifdef XF86MISC - if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEMODINDEV, &value)) - xf86Info.miscModInDevEnabled = !value; - if (xf86GetOptValBool(FlagOptions, FLAG_MODINDEVALLOWNONLOCAL, &value)) - xf86Info.miscModInDevAllowNonLocal = value; -#endif - if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value)) xf86Info.allowMouseOpenFail = value; @@ -1084,9 +1079,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) } #endif - xf86Info.allowEmptyInput = FALSE; - if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value)) - xf86Info.allowEmptyInput = TRUE; + /* AllowEmptyInput is automatically true if we're hotplugging */ + xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices); + xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput); xf86Info.useDefaultFontPath = TRUE; xf86Info.useDefaultFontPathFrom = X_DEFAULT; @@ -1233,8 +1228,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) * remove the core attribute from the later ones. */ for (devs = servlayoutp->inputs; devs && *devs; devs++) { - indp = *devs; pointer opt1 = NULL, opt2 = NULL; + indp = *devs; if (indp->commonOptions && xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) { opt1 = indp->commonOptions; @@ -1605,10 +1600,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, count++; adjp = (XF86ConfAdjacencyPtr)adjp->list.next; } + #ifdef DEBUG ErrorF("Found %d screens in the layout section %s", count, conf_layout->lay_identifier); #endif + if (!count) /* alloc enough storage even if no screen is specified */ + count = 1; + slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec)); slp[count].screen = NULL; /* @@ -1663,6 +1662,20 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, adjp = (XF86ConfAdjacencyPtr)adjp->list.next; } + /* No screen was specified in the layout. take the first one from the + * config file, or - if it is NULL - configScreen autogenerates one for + * us */ + if (!count) + { + slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); + if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst, + 0, X_CONFIG)) { + xfree(slp[0].screen); + xfree(slp); + return FALSE; + } + } + /* XXX Need to tie down the upper left screen. */ /* Fill in the refscreen and top/bottom/left/right values */ @@ -1853,9 +1866,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) indp = xnfalloc(sizeof(IDevPtr)); *indp = NULL; servlayoutp->inputs = indp; - if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE)) - return FALSE; - + return TRUE; } @@ -2040,6 +2051,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst; Gamma zeros = {0.0, 0.0, 0.0}; float badgamma = 0.0; + double maxPixClock; xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n", conf_monitor->mon_identifier); @@ -2174,8 +2186,11 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) xf86ProcessOptions(-1, monitorp->options, MonitorOptions); xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING, &monitorp->reducedblanking); - xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ, - &monitorp->maxPixClock); + if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ, + &maxPixClock) == TRUE) { + monitorp->maxPixClock = (int) maxPixClock; + } + return TRUE; } @@ -2416,14 +2431,14 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from) } static Bool -modeIsPresent(char * modename,MonPtr monitorp) +modeIsPresent(DisplayModePtr mode, MonPtr monitorp) { DisplayModePtr knownmodes = monitorp->Modes; /* all I can think of is a linear search... */ while(knownmodes != NULL) { - if(!strcmp(modename,knownmodes->name) && + if(!strcmp(mode->name, knownmodes->name) && !(knownmodes->type & M_T_DEFAULT)) return TRUE; knownmodes = knownmodes->next; @@ -2454,6 +2469,12 @@ 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 */ @@ -2574,6 +2595,8 @@ xf86HandleConfigFile(Bool autoconfig) configDRI(xf86configptr->conf_dri); #endif + checkInput(&xf86ConfigLayout); + /* * Handle some command line options that can override some of the * ServerFlags settings. @@ -2585,13 +2608,6 @@ xf86HandleConfigFile(Bool autoconfig) xf86Info.vidModeAllowNonLocal = TRUE; #endif -#ifdef XF86MISC - if (xf86MiscModInDevDisabled) - xf86Info.miscModInDevEnabled = FALSE; - if (xf86MiscModInDevAllowNonLocal) - xf86Info.miscModInDevAllowNonLocal = TRUE; -#endif - if (xf86AllowMouseOpenFail) xf86Info.allowMouseOpenFail = TRUE; diff --git a/hw/xfree86/common/xf86Debug.c b/hw/xfree86/common/xf86Debug.c deleted file mode 100644 index 5b609652b..000000000 --- a/hw/xfree86/common/xf86Debug.c +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * Copyright (c) 2000-2003 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "compiler.h" - -CARD8 xf86PeekFb8(CARD8 *p) { return *p; } -CARD16 xf86PeekFb16(CARD16 *p) { return *p; } -CARD32 xf86PeekFb32(CARD32 *p) { return *p; } -void xf86PokeFb8(CARD8 *p, CARD8 v) { *p = v; } -void xf86PokeFb16(CARD16 *p, CARD16 v) { *p = v; } -void xf86PokeFb32(CARD16 *p, CARD32 v) { *p = v; } - -CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset) -{ - return MMIO_IN8(Base,Offset); -} - -CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset) -{ - return MMIO_IN16(Base,Offset); -} - -CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset) -{ - return MMIO_IN32(Base,Offset); -} - -void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v) -{ - MMIO_OUT8(Base,Offset,v); -} - -void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v) -{ - MMIO_OUT16(Base,Offset,v); -} - -void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v) -{ - MMIO_OUT32(Base,Offset,v); -} diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index a7f9578b8..6385b7884 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -196,45 +196,6 @@ void ProcessInputEvents () { int x, y; -#ifdef INHERIT_LOCK_STATE - static int generation = 0; -#endif - - /* - * With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock - * and ScrollLock will be set to match that of the VT the server is - * running on. - */ -#ifdef INHERIT_LOCK_STATE - if (generation != serverGeneration) { - xEvent kevent; - DevicePtr pKeyboard = xf86Info.pKeyboard; - extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll; - - generation = serverGeneration; - kevent.u.keyButtonPointer.time = GetTimeInMillis(); - kevent.u.keyButtonPointer.rootX = 0; - kevent.u.keyButtonPointer.rootY = 0; - kevent.u.u.type = KeyPress; - - - if (xf86InitialCaps) { - kevent.u.u.detail = xf86InitialCaps; - (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); - xf86InitialCaps = 0; - } - if (xf86InitialNum) { - kevent.u.u.detail = xf86InitialNum; - (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); - xf86InitialNum = 0; - } - if (xf86InitialScroll) { - kevent.u.u.detail = xf86InitialScroll; - (* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1); - xf86InitialScroll = 0; - } - } -#endif mieqProcessInputEvents(); @@ -355,30 +316,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) } break; #endif - case ACTION_MESSAGE: - { - char *retstr, *message = (char *) arg; - ScrnInfoPtr pScr = XF86SCRNINFO(xf86Info.currentScreen); - -#ifdef DEBUG - ErrorF("ActionMessage: '%s'\n", message); -#endif - /* Okay the message made it to the ddx. The common layer */ - /* can check for relevant messages here and react to any */ - /* that have a global effect. For example: */ - /* */ - /* if (!strcmp(message, "foo") { */ - /* do_foo(); break */ - /* } */ - /* */ - /* otherwise fallback to sending a key event message to */ - /* the current screen's driver: */ - if (*pScr->HandleMessage != NULL) { - (void) (*pScr->HandleMessage)(pScr->scrnIndex, - "KeyEventMessage", message, &retstr); - } - } - break; default: break; } diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index 19ed4e747..c00089190 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -192,10 +192,6 @@ Bool xf86AllowMouseOpenFail = FALSE; Bool xf86VidModeDisabled = FALSE; Bool xf86VidModeAllowNonLocal = FALSE; #endif -#ifdef XF86MISC -Bool xf86MiscModInDevDisabled = FALSE; -Bool xf86MiscModInDevAllowNonLocal = FALSE; -#endif RootWinPropPtr *xf86RegisteredPropertiesTable = NULL; _X_EXPORT Bool xf86inSuspend = FALSE; Bool xorgHWAccess = FALSE; diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index eaa6c76fb..41181b066 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -308,12 +308,11 @@ xf86AllocateScrnInfoPrivateIndex(void) return idx; } -/* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */ - +/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */ _X_EXPORT InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags) { - InputInfoPtr new; + InputInfoPtr new, *prev = NULL; if (!(new = xcalloc(sizeof(InputInfoRec), 1))) return NULL; @@ -321,8 +320,13 @@ xf86AllocateInput(InputDriverPtr drv, int flags) new->drv = drv; drv->refCount++; new->module = DuplicateModule(drv->module, NULL); - new->next = xf86InputDevs; - xf86InputDevs = new; + + for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next) + ; + + *prev = new; + new->next = NULL; + return new; } @@ -2937,17 +2941,3 @@ xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start, { return GetMotionHistory(pDev, buff, start, stop, pScreen, core); } - -_X_EXPORT void -xf86getsecs(long * secs, long * usecs) -{ - struct timeval tv; - - X_GETTIMEOFDAY(&tv); - if (secs) - *secs = tv.tv_sec; - if (usecs) - *usecs= tv.tv_usec; - - return; -} diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 46c4a96b8..34970e05e 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -93,12 +93,6 @@ #include "xf86Bus.h" /* forward declarations */ - -static void xf86PrintBanner(void); -static void xf86PrintMarkers(void); -static void xf86PrintDefaultModulePath(void); -static void xf86PrintDefaultLibraryPath(void); - static Bool probe_devices_from_device_sections(DriverPtr drvp); static Bool add_matching_devices_to_configure_list(DriverPtr drvp); static Bool check_for_matching_devices(DriverPtr drvp); @@ -127,6 +121,130 @@ static int numFormats = 6; #endif static Bool formatsDone = FALSE; +#ifndef OSNAME +#define OSNAME " unknown" +#endif +#ifndef OSVENDOR +#define OSVENDOR "" +#endif +#ifndef PRE_RELEASE +#define PRE_RELEASE XORG_VERSION_SNAP +#endif + +static void +xf86PrintBanner() +{ +#if PRE_RELEASE + ErrorF("\n" + "This is a pre-release version of the X server from " XVENDORNAME ".\n" + "It is not supported in any way.\n" + "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" + "Select the \"xorg\" product for bugs you find in this release.\n" + "Before reporting bugs in pre-release versions please check the\n" + "latest version in the X.Org Foundation git repository.\n" + "See http://wiki.x.org/wiki/GitPage for git access instructions.\n"); +#endif + ErrorF("\nX.Org X Server %d.%d.%d", + XORG_VERSION_MAJOR, + XORG_VERSION_MINOR, + XORG_VERSION_PATCH); +#if XORG_VERSION_SNAP > 0 + ErrorF(".%d", XORG_VERSION_SNAP); +#endif + +#if XORG_VERSION_SNAP >= 900 + /* When the minor number is 99, that signifies that the we are making + * a release candidate for a major version. (X.0.0) + * When the patch number is 99, that signifies that the we are making + * a release candidate for a minor version. (X.Y.0) + * When the patch number is < 99, then we are making a release + * candidate for the next point release. (X.Y.Z) + */ +#if XORG_VERSION_MINOR >= 99 + ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900); +#elif XORG_VERSION_PATCH == 99 + ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1, + XORG_VERSION_SNAP - 900); +#else + ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, + XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900); +#endif +#endif + +#ifdef XORG_CUSTOM_VERSION + ErrorF(" (%s)", XORG_CUSTOM_VERSION); +#endif +#ifndef XORG_DATE +#define XORG_DATE XF86_DATE +#endif + ErrorF("\nRelease Date: %s\n", XORG_DATE); + ErrorF("X Protocol Version %d, Revision %d\n", + X_PROTOCOL, X_PROTOCOL_REVISION); + ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR); +#ifdef HAS_UTSNAME + { + struct utsname name; + + /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX, + and Irix) and Single Unix Spec 3 just say that non-negative is success. + All agree that failure is represented by a negative number. + */ + if (uname(&name) >= 0) { + ErrorF("Current Operating System: %s %s %s %s %s\n", + name.sysname, name.nodename, name.release, name.version, name.machine); + } + } +#endif +#if defined(BUILD_DATE) && (BUILD_DATE > 19000000) + { + struct tm t; + char buf[100]; + + bzero(&t, sizeof(t)); + bzero(buf, sizeof(buf)); + t.tm_mday = BUILD_DATE % 100; + t.tm_mon = (BUILD_DATE / 100) % 100 - 1; + t.tm_year = BUILD_DATE / 10000 - 1900; +#if defined(BUILD_TIME) + t.tm_sec = BUILD_TIME % 100; + t.tm_min = (BUILD_TIME / 100) % 100; + t.tm_hour = (BUILD_TIME / 10000) % 100; + if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t)) + ErrorF("Build Date: %s\n", buf); +#else + if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) + ErrorF("Build Date: %s\n", buf); +#endif + } +#endif +#if defined(CLOG_DATE) && (CLOG_DATE > 19000000) + { + struct tm t; + char buf[100]; + + bzero(&t, sizeof(t)); + bzero(buf, sizeof(buf)); + t.tm_mday = CLOG_DATE % 100; + t.tm_mon = (CLOG_DATE / 100) % 100 - 1; + t.tm_year = CLOG_DATE / 10000 - 1900; + if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) + ErrorF("Changelog Date: %s\n", buf); + } +#endif +#if defined(BUILDERSTRING) + ErrorF("%s \n",BUILDERSTRING); +#endif + ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n" + "\tto make sure that you have the latest version.\n"); + ErrorF("Module Loader present\n"); +} + +static void +xf86PrintMarkers() +{ + LogPrintMarkers(); +} + static Bool xf86CreateRootWindow(WindowPtr pWin) { @@ -174,10 +292,10 @@ xf86CreateRootWindow(WindowPtr pWin) pProp->size, pProp->data, FALSE); } - + /* Look at err */ ret &= (err==Success); - + } else { xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with " "non-root window %p (parent %p)\n", @@ -194,7 +312,7 @@ xf86CreateRootWindow(WindowPtr pWin) static void -PostConfigInit(void) +InstallSignalHandlers(void) { /* * Install signal handler for unexpected signals @@ -220,13 +338,6 @@ PostConfigInit(void) signal(SIGXFSZ,xf86SigHandler); #endif } - -#ifdef XF86PM - xf86OSPMClose = xf86OSPMOpen(); -#endif - - /* Do this after XF86Config is read (it's normally in OsInit()) */ - OsInitColors(); } @@ -254,7 +365,7 @@ probe_devices_from_device_sections(DriverPtr drvp) iter = pci_id_match_iterator_create(NULL); while ((pPci = pci_device_next(iter)) != NULL) { if (devList[i]->busID && *devList[i]->busID) { - if (xf86ComparePciBusString(devList[i]->busID, + if (xf86ComparePciBusString(devList[i]->busID, ((pPci->domain << 8) | pPci->bus), pPci->dev, @@ -301,7 +412,7 @@ probe_devices_from_device_sections(DriverPtr drvp) ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n", drvp->driverName, pPci->bus, pPci->dev, pPci->func); #endif - + /* Allocate an entry in the lists to be returned */ entry = xf86ClaimPciSlot(pPci, drvp, device_id, devList[i], devList[i]->active); @@ -321,7 +432,7 @@ probe_devices_from_device_sections(DriverPtr drvp) } } } - + if (entry != -1) { if ((*drvp->PciProbe)(drvp, entry, pPci, devices[j].match_data)) { @@ -334,7 +445,7 @@ probe_devices_from_device_sections(DriverPtr drvp) } } - + return foundScreen; } @@ -360,7 +471,7 @@ add_matching_devices_to_configure_list(DriverPtr drvp) && ((devices[j].device_class_mask & pPci->device_class) == devices[j].device_class) ) { if (xf86CheckPciSlot(pPci)) { - GDevPtr pGDev = + GDevPtr pGDev = xf86AddDeviceToConfigure(drvp->driverName, pPci, -1); if (pGDev != NULL) { /* After configure pass 1, chipID and chipRev are @@ -395,11 +506,11 @@ check_for_matching_devices(DriverPtr drvp) for (j = 0; ! END_OF_MATCHES(devices[j]); j++) { struct pci_device_iterator *iter; struct pci_device *dev; - + iter = pci_id_match_iterator_create(& devices[j]); dev = pci_device_next(iter); pci_iterator_destroy(iter); - + if (dev != NULL) { return TRUE; } @@ -418,9 +529,9 @@ check_for_matching_devices(DriverPtr drvp) * is found, it is called. If \c DriverRec::PciProbe or no devices can be * successfully probed with it (e.g., only non-PCI devices are available), * the driver's \c DriverRec::Probe function is called. - * + * * \param drv Driver to probe - * + * * \return * If a device can be successfully probed by the driver, \c TRUE is * returned. Otherwise, \c FALSE is returned. @@ -448,13 +559,14 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) if ( ! foundScreen && (drv->Probe != NULL) ) { xf86Msg( X_WARNING, "Falling back to old probe method for %s\n", drv->driverName ); - foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT + foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT : PROBE_DEFAULT ); } return foundScreen; } + /* * InitOutput -- * Initialize screenInfo for all actually accessible framebuffers. @@ -472,7 +584,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; Bool autoconfig = FALSE; - + GDevPtr configured_device; + xf86Initialising = TRUE; if (serverGeneration == 1) { @@ -509,8 +622,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } } - if (!autoconfig) - PostConfigInit(); + InstallSignalHandlers(); /* Initialise the loader */ LoaderInit(); @@ -538,9 +650,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86Msg(X_ERROR, "Auto configuration failed\n"); return; } - PostConfigInit(); } +#ifdef XF86PM + xf86OSPMClose = xf86OSPMOpen(); +#endif + /* Initialise the resource broker */ xf86ResourceBrokerInit(); @@ -555,7 +670,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* If there aren't any specified in the config file, autoconfig them */ /* FIXME: Does not handle multiple active screen sections, but I'm not * sure if we really want to handle that case*/ - GDevPtr configured_device = xf86ConfigLayout.screens->screen->device; + configured_device = xf86ConfigLayout.screens->screen->device; if ((!configured_device) || (!configured_device->driver)) { if (!autoConfigDevice(configured_device)) { xf86Msg(X_ERROR, "Automatic driver configuration failed\n"); @@ -645,7 +760,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) || !xf86DriverList[i]->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags) - || NEED_IO_ENABLED(flags)) + || NEED_IO_ENABLED(flags)) continue; } @@ -681,7 +796,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) layout++) { Bool found = FALSE; for (j = 0; j < xf86Screens[i]->numEntities; j++) { - + GDevPtr dev = xf86GetDevFromEntity(xf86Screens[i]->entityList[j], xf86Screens[i]->entityInstanceList[j]); @@ -739,7 +854,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) * Call the driver's PreInit()'s to complete initialisation for the first * generation. */ - + for (i = 0; i < xf86NumScreens; i++) { xf86EnableAccess(xf86Screens[i]); if (xf86Screens[i]->PreInit && @@ -749,7 +864,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) for (i = 0; i < xf86NumScreens; i++) if (!xf86Screens[i]->configured) xf86DeleteScreen(i--, 0); - + /* * If no screens left, return now. */ @@ -910,12 +1025,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) FatalError("Unable to make VT property - out of memory. Exiting...\n"); } *VT = xf86Info.vtno; - + VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE); for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) { ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, - VTAtom, XA_INTEGER, 32, + VTAtom, XA_INTEGER, 32, 1, VT ); if (ret != Success) xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, @@ -932,14 +1047,11 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } } -#ifdef XKB - xf86InitXkb(); -#endif /* set up the proper access funcs */ xf86PostPreInit(); AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL); - + } else { /* * serverGeneration != 1; some OSs have to do things here, too. @@ -963,34 +1075,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86EnableIO(); } -#if 0 - /* - * Install signal handler for unexpected signals - */ - xf86Info.caughtSignal=FALSE; - if (!xf86Info.notrapSignals) - { - signal(SIGSEGV,xf86SigHandler); - signal(SIGILL,xf86SigHandler); -#ifdef SIGEMT - signal(SIGEMT,xf86SigHandler); -#endif - signal(SIGFPE,xf86SigHandler); -#ifdef SIGBUS - signal(SIGBUS,xf86SigHandler); -#endif -#ifdef SIGSYS - signal(SIGSYS,xf86SigHandler); -#endif -#ifdef SIGXCPU - signal(SIGXCPU,xf86SigHandler); -#endif -#ifdef SIGXFSZ - signal(SIGXFSZ,xf86SigHandler); -#endif - } -#endif - /* * Use the previously collected parts to setup pScreenInfo */ @@ -1004,7 +1088,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) pScreenInfo->formats[i] = formats[i]; /* Make sure the server's VT is active */ - + if (serverGeneration != 1) { xf86Resetting = TRUE; /* All screens are in the same state, so just check the first */ @@ -1014,7 +1098,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) #endif xf86AccessEnter(); xf86EnterServerState(SETUP); - } + } } #ifdef SCO325 else { @@ -1031,8 +1115,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } #endif /* SCO325 */ - for (i = 0; i < xf86NumScreens; i++) { - xf86EnableAccess(xf86Screens[i]); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); /* * Almost everything uses these defaults, and many of those that * don't, will wrap them. @@ -1040,7 +1124,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; xf86Screens[i]->SetDGAMode = xf86SetDGAMode; xf86Screens[i]->DPMSSet = NULL; - xf86Screens[i]->LoadPalette = NULL; + xf86Screens[i]->LoadPalette = NULL; xf86Screens[i]->SetOverscan = NULL; xf86Screens[i]->DriverFunc = NULL; xf86Screens[i]->pScreen = NULL; @@ -1075,7 +1159,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) #ifdef RENDER if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown) { - xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC); + xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC); PictureSetSubpixelOrder (xf86Screens[i]->pScreen, DDC ? (DDC->features.input_type ? @@ -1109,8 +1193,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) void InitInput(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { IDevPtr* pDev; InputDriverPtr pDrv; @@ -1160,16 +1244,12 @@ InitInput(argc, argv) mieqInit(); } -#ifndef SET_STDERR_NONBLOCKING -#define SET_STDERR_NONBLOCKING 1 -#endif - /* * OsVendorInit -- * OS/Vendor-specific initialisations. Called from OsInit(), which * is called by dix before establishing the well known sockets. */ - + void OsVendorInit() { @@ -1178,12 +1258,10 @@ OsVendorInit() #ifdef SIGCHLD signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ #endif - OsDelayInitColors = TRUE; if (!beenHere) xf86LogInit(); -#if SET_STDERR_NONBLOCKING /* Set stderr to non-blocking. */ #ifndef O_NONBLOCK #if defined(FNDELAY) @@ -1191,7 +1269,6 @@ OsVendorInit() #elif defined(O_NDELAY) #define O_NONBLOCK O_NDELAY #endif -#endif #ifdef O_NONBLOCK if (!beenHere) { @@ -1241,9 +1318,6 @@ ddxGiveUp() xf86Screens[i]->busAccess = NULL; } -#ifdef USE_XF86_SERVERLOCK - xf86UnlockServer(); -#endif #ifdef XFreeXDGA DGAShutdown(); #endif @@ -1292,9 +1366,9 @@ AbortDDX() (xf86Screens[i]->LeaveVT)(i, 0); } } - + xf86AccessLeave(); - + /* * This is needed for an abnormal server exit, since the normal exit stuff * MUST also be performed (i.e. the vt must be left in a defined state) @@ -1338,6 +1412,18 @@ xf86SetLogVerbosity(int verb) return save; } +static void +xf86PrintDefaultModulePath(void) +{ + ErrorF("%s\n", DEFAULT_MODULE_PATH); +} + +static void +xf86PrintDefaultLibraryPath(void) +{ + ErrorF("%s\n", DEFAULT_LIBRARY_PATH); +} + /* * ddxProcessArgument -- * Process device-dependent command line args. Returns 0 if argument is @@ -1346,8 +1432,6 @@ xf86SetLogVerbosity(int verb) * */ - - /* ARGSUSED */ int ddxProcessArgument(int argc, char **argv, int i) @@ -1363,7 +1447,7 @@ ddxProcessArgument(int argc, char **argv, int i) UseMsg(); \ FatalError("Required argument to %s not specified\n", argv[i]); \ } - + /* First the options that are only allowed for root */ if (getuid() == 0 || geteuid() != 0) { @@ -1433,18 +1517,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86VidModeAllowNonLocal = TRUE; return 1; } -#endif -#ifdef XF86MISC - if (!strcmp(argv[i],"-disableModInDev")) - { - xf86MiscModInDevDisabled = TRUE; - return 1; - } - if (!strcmp(argv[i],"-allowNonLocalModInDev")) - { - xf86MiscModInDevAllowNonLocal = TRUE; - return 1; - } #endif if (!strcmp(argv[i],"-allowMouseOpenFail")) { @@ -1600,11 +1672,11 @@ ddxProcessArgument(int argc, char **argv, int i) return 0; } } - if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") || + if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") || !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) { double gamma; - CHECK_FOR_REQUIRED_ARGUMENT(); + CHECK_FOR_REQUIRED_ARGUMENT(); if (sscanf(argv[++i], "%lf", &gamma) == 1) { if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) { ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f" @@ -1639,7 +1711,7 @@ ddxProcessArgument(int argc, char **argv, int i) } if (!strcmp(argv[i], "-keyboard")) { - CHECK_FOR_REQUIRED_ARGUMENT(); + CHECK_FOR_REQUIRED_ARGUMENT(); xf86KeyboardName = argv[++i]; return 2; } @@ -1734,12 +1806,7 @@ ddxUseMsg() ErrorF("-disableVidMode disable mode adjustments with xvidtune\n"); ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n"); #endif -#ifdef XF86MISC - ErrorF("-disableModInDev disable dynamic modification of input device settings\n"); - ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n"); - ErrorF(" from non-local clients\n"); ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n"); -#endif ErrorF("-bestRefresh choose modes with the best refresh rate\n"); ErrorF("-ignoreABI make module ABI mismatches non-fatal\n"); ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n"); @@ -1752,145 +1819,9 @@ ddxUseMsg() } -#ifndef OSNAME -#define OSNAME " unknown" -#endif -#ifndef OSVENDOR -#define OSVENDOR "" -#endif -#ifndef PRE_RELEASE -#define PRE_RELEASE XORG_VERSION_SNAP -#endif - -static void -xf86PrintBanner() -{ -#if PRE_RELEASE - ErrorF("\n" - "This is a pre-release version of the X server from " XVENDORNAME ".\n" - "It is not supported in any way.\n" - "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" - "Select the \"xorg\" product for bugs you find in this release.\n" - "Before reporting bugs in pre-release versions please check the\n" - "latest version in the X.Org Foundation git repository.\n" - "See http://wiki.x.org/wiki/GitPage for git access instructions.\n"); -#endif - ErrorF("\nX.Org X Server %d.%d.%d", - XORG_VERSION_MAJOR, - XORG_VERSION_MINOR, - XORG_VERSION_PATCH); -#if XORG_VERSION_SNAP > 0 - ErrorF(".%d", XORG_VERSION_SNAP); -#endif - -#if XORG_VERSION_SNAP >= 900 - /* When the minor number is 99, that signifies that the we are making - * a release candidate for a major version. (X.0.0) - * When the patch number is 99, that signifies that the we are making - * a release candidate for a minor version. (X.Y.0) - * When the patch number is < 99, then we are making a release - * candidate for the next point release. (X.Y.Z) - */ -#if XORG_VERSION_MINOR >= 99 - ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900); -#elif XORG_VERSION_PATCH == 99 - ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1, - XORG_VERSION_SNAP - 900); -#else - ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, - XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900); -#endif -#endif - -#ifdef XORG_CUSTOM_VERSION - ErrorF(" (%s)", XORG_CUSTOM_VERSION); -#endif -#ifndef XORG_DATE -#define XORG_DATE XF86_DATE -#endif - ErrorF("\nRelease Date: %s\n", XORG_DATE); - ErrorF("X Protocol Version %d, Revision %d\n", - X_PROTOCOL, X_PROTOCOL_REVISION); - ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR); -#ifdef HAS_UTSNAME - { - struct utsname name; - - /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX, - and Irix) and Single Unix Spec 3 just say that non-negative is success. - All agree that failure is represented by a negative number. - */ - if (uname(&name) >= 0) { - ErrorF("Current Operating System: %s %s %s %s %s\n", - name.sysname, name.nodename, name.release, name.version, name.machine); - } - } -#endif -#if defined(BUILD_DATE) && (BUILD_DATE > 19000000) - { - struct tm t; - char buf[100]; - - bzero(&t, sizeof(t)); - bzero(buf, sizeof(buf)); - t.tm_mday = BUILD_DATE % 100; - t.tm_mon = (BUILD_DATE / 100) % 100 - 1; - t.tm_year = BUILD_DATE / 10000 - 1900; -#if defined(BUILD_TIME) - t.tm_sec = BUILD_TIME % 100; - t.tm_min = (BUILD_TIME / 100) % 100; - t.tm_hour = (BUILD_TIME / 10000) % 100; - if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t)) - ErrorF("Build Date: %s\n", buf); -#else - if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) - ErrorF("Build Date: %s\n", buf); -#endif - } -#endif -#if defined(CLOG_DATE) && (CLOG_DATE > 19000000) - { - struct tm t; - char buf[100]; - - bzero(&t, sizeof(t)); - bzero(buf, sizeof(buf)); - t.tm_mday = CLOG_DATE % 100; - t.tm_mon = (CLOG_DATE / 100) % 100 - 1; - t.tm_year = CLOG_DATE / 10000 - 1900; - if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) - ErrorF("Changelog Date: %s\n", buf); - } -#endif -#if defined(BUILDERSTRING) - ErrorF("%s \n",BUILDERSTRING); -#endif - ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n" - "\tto make sure that you have the latest version.\n"); - ErrorF("Module Loader present\n"); -} - -static void -xf86PrintMarkers() -{ - LogPrintMarkers(); -} - -static void -xf86PrintDefaultModulePath(void) -{ - ErrorF("%s\n", DEFAULT_MODULE_PATH); -} - -static void -xf86PrintDefaultLibraryPath(void) -{ - ErrorF("%s\n", DEFAULT_LIBRARY_PATH); -} - /* * xf86LoadModules iterates over a list that is being passed in. - */ + */ Bool xf86LoadModules(char **list, pointer *optlist) { @@ -1961,7 +1892,7 @@ xf86GetPixFormat(ScrnInfoPtr pScrn, int depth) return &format; } } - + for (i = 0; i < numFormats; i++) if (formats[i].depth == depth) break; @@ -1983,11 +1914,10 @@ xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) { PixmapFormatPtr format; - + format = xf86GetPixFormat(pScrn, depth); if (format) return format->bitsPerPixel; else return 0; } - diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c deleted file mode 100644 index 8817b792a..000000000 --- a/hw/xfree86/common/xf86MiscExt.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -/* - * This file contains the Pointer/Keyboard functions needed by the - * XFree86-Misc extension. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" - -#ifdef XF86MISC -#define _XF86MISC_SERVER_ -#include -#include "xf86miscproc.h" -#endif - -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" - -#include -#include -#include "xf86Xinput.h" - -#include "xf86OSmouse.h" - -#ifdef DEBUG -# define DEBUG_P(x) ErrorF(x"\n"); -#else -# define DEBUG_P(x) /**/ -#endif - -#ifdef XF86MISC - -typedef struct { - int type; - int baudrate; - int samplerate; - int resolution; - int buttons; - Bool em3buttons; - int em3timeout; - Bool chordmiddle; - int flags; - char* device; - pointer private; -} mseParamsRec, *mseParamsPtr; - -typedef struct { - int type; - int rate; - int delay; - int serverNumLock; /* obsolete */ - pointer private; -} kbdParamsRec, *kbdParamsPtr; - -/* - Sigh... - - The extension should probably be changed to use protocol - names instead of ID numbers -*/ -static struct mouse_map { - int mtype; - MouseProtocolID proto; -} m_map[] = -{ - { MTYPE_MICROSOFT, PROT_MS }, - { MTYPE_MOUSESYS, PROT_MSC }, - { MTYPE_MMSERIES, PROT_MM }, - { MTYPE_LOGITECH, PROT_LOGI }, - { MTYPE_LOGIMAN, PROT_LOGIMAN }, - { MTYPE_MMHIT, PROT_MMHIT }, - { MTYPE_GLIDEPOINT, PROT_GLIDE }, - { MTYPE_IMSERIAL, PROT_IMSERIAL }, - { MTYPE_THINKING, PROT_THINKING }, - { MTYPE_ACECAD, PROT_ACECAD }, - { MTYPE_PS_2, PROT_PS2 }, - { MTYPE_IMPS2, PROT_IMPS2 }, - { MTYPE_EXPPS2, PROT_EXPPS2 }, - { MTYPE_THINKINGPS2, PROT_THINKPS2 }, - { MTYPE_MMANPLUSPS2, PROT_MMPS2 }, - { MTYPE_GLIDEPOINTPS2, PROT_GLIDEPS2 }, - { MTYPE_NETPS2, PROT_NETPS2 }, - { MTYPE_NETSCROLLPS2, PROT_NETSCPS2 }, - { MTYPE_BUSMOUSE, PROT_BM }, - { MTYPE_AUTOMOUSE, PROT_AUTO }, - { MTYPE_SYSMOUSE, PROT_SYSMOUSE }, - { MTYPE_UNKNOWN, PROT_UNKNOWN } -}; - -static int -MapMseProtoToMisc(MouseProtocolID proto) -{ - int i; - - for (i = 0; m_map[i].proto != PROT_UNKNOWN; i++) - if (proto == m_map[i].proto) - return m_map[i].mtype; - - return MTYPE_UNKNOWN; -} - -static MouseProtocolID -MapMseMiscToProto(int proto) -{ - int i; - - for (i = 0; m_map[i].mtype != MTYPE_UNKNOWN; i++) - if (proto == m_map[i].mtype) - return m_map[i].proto; - - return PROT_UNKNOWN; -} - -_X_EXPORT Bool -MiscExtGetMouseSettings(pointer *mouse, char **devname) -{ - mseParamsPtr mseptr; - - mseptr = MiscExtCreateStruct(MISC_POINTER); - if (!mseptr) - return FALSE; - - { - InputInfoPtr pInfo = mseptr->private; - MouseDevPtr pMse; - - *devname = xf86FindOptionValue(pInfo->options, "Device"); - pMse = pInfo->private; - - mseptr->type = MapMseProtoToMisc(pMse->protocolID); - mseptr->baudrate = pMse->baudRate; - mseptr->samplerate = pMse->sampleRate; - mseptr->resolution = pMse->resolution; - mseptr->buttons = pMse->buttons; - mseptr->em3buttons = pMse->emulate3Buttons; - mseptr->em3timeout = pMse->emulate3Timeout; - mseptr->chordmiddle = pMse->chordMiddle; - mseptr->flags = pMse->mouseFlags; - } - *mouse = mseptr; - return TRUE; -} - -_X_EXPORT int -MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype) -{ - mseParamsPtr mse = mouse; - - switch (valtype) { - case MISC_MSE_PROTO: return mse->type; - case MISC_MSE_BAUDRATE: return mse->baudrate; - case MISC_MSE_SAMPLERATE: return mse->samplerate; - case MISC_MSE_RESOLUTION: return mse->resolution; - case MISC_MSE_BUTTONS: return mse->buttons; - case MISC_MSE_EM3BUTTONS: return mse->em3buttons; - case MISC_MSE_EM3TIMEOUT: return mse->em3timeout; - case MISC_MSE_CHORDMIDDLE: return mse->chordmiddle; - case MISC_MSE_FLAGS: return mse->flags; - } - return 0; -} - -_X_EXPORT Bool -MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value) -{ - mseParamsPtr mse = mouse; - - switch (valtype) { - case MISC_MSE_PROTO: - mse->type = value; - return TRUE; - case MISC_MSE_BAUDRATE: - mse->baudrate = value; - return TRUE; - case MISC_MSE_SAMPLERATE: - mse->samplerate = value; - return TRUE; - case MISC_MSE_RESOLUTION: - mse->resolution = value; - return TRUE; - case MISC_MSE_BUTTONS: - mse->buttons = value; - return TRUE; - case MISC_MSE_EM3BUTTONS: - mse->em3buttons = value; - return TRUE; - case MISC_MSE_EM3TIMEOUT: - mse->em3timeout = value; - return TRUE; - case MISC_MSE_CHORDMIDDLE: - mse->chordmiddle = value; - return TRUE; - case MISC_MSE_FLAGS: - mse->flags = value; - return TRUE; - } - return FALSE; -} - -_X_EXPORT Bool -MiscExtSetMouseDevice(pointer mouse, char* device) -{ - mseParamsPtr mse = mouse; - mse->device = device; - - return TRUE; -} - -_X_EXPORT Bool -MiscExtGetKbdSettings(pointer *kbd) -{ - return FALSE; -} - -_X_EXPORT int -MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype) -{ - return 0; -} - -_X_EXPORT Bool -MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value) -{ - return FALSE; -} - -static void -MiscExtClientStateCallback(CallbackListPtr *callbacks, - pointer data, pointer args) -{ - NewClientInfoRec *clientinfo = (NewClientInfoRec*)args; - - if (clientinfo->client == xf86Info.grabInfo.override && - clientinfo->client->clientState == ClientStateGone) { - xf86Info.grabInfo.override = NULL; - xf86Info.grabInfo.disabled = 0; - DeleteCallback(&ClientStateCallback, MiscExtClientStateCallback, NULL); - } -} - -#define MiscExtGrabStateSuccess 0 /* No errors */ -#define MiscExtGrabStateLocked 1 /* A client already requested that - * grabs cannot be removed/killed */ -#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling - * grab removeal/kill already done */ -_X_EXPORT int -MiscExtSetGrabKeysState(ClientPtr client, int state) -{ - if (xf86Info.grabInfo.override == NULL || - xf86Info.grabInfo.override == client) { - if (state == 0 && xf86Info.grabInfo.disabled == 0) { - xf86Info.grabInfo.disabled = 1; - AddCallback(&ClientStateCallback, - MiscExtClientStateCallback, NULL); - xf86Info.grabInfo.override = client; - } - else if (state == 1 && xf86Info.grabInfo.disabled == 1) { - xf86Info.grabInfo.disabled = 0; - DeleteCallback(&ClientStateCallback, - MiscExtClientStateCallback, NULL); - xf86Info.grabInfo.override = NULL; - } - else - return MiscExtGrabStateAlready; - - return MiscExtGrabStateSuccess; - } - - return MiscExtGrabStateLocked; -} - -_X_EXPORT pointer -MiscExtCreateStruct(MiscExtStructType mse_or_kbd) -{ - switch (mse_or_kbd) { - case MISC_POINTER: - { - mseParamsPtr mseptr; - InputInfoPtr pInfo = xf86InputDevs; - - while (pInfo) { - if (pInfo->dev == inputInfo.pointer) - break; - pInfo = pInfo->next; - } - if (!pInfo) - return NULL; - - mseptr = xcalloc(sizeof(mseParamsRec),1); - if (mseptr) - mseptr->private = pInfo; - return mseptr; - } - case MISC_KEYBOARD: - return xcalloc(sizeof(kbdParamsRec),1); - } - return 0; -} - -_X_EXPORT void -MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd) -{ - switch (mse_or_kbd) { - case MISC_POINTER: - case MISC_KEYBOARD: - xfree(structure); - } -} - -static Bool -MiscExtAuthorizeDevice(InputInfoPtr pInfo, char *device) -{ - Bool authorized = FALSE; - char *elem; - struct stat dev, dev_list; - const char *olddev = xf86FindOptionValue(pInfo->options, "Device"); - - if (stat(device,&dev)) - return FALSE; - - if (!S_ISCHR(dev.st_mode)) - return FALSE; - - if (!stat(olddev,&dev_list)) { - if (dev_list.st_dev == dev.st_dev - && dev_list.st_ino == dev.st_ino) { - authorized = TRUE; - } - } - - if (!authorized) { - char *path; - - if (!xf86InputDeviceList - || (path = strdup(xf86InputDeviceList)) == NULL) - return FALSE; - - elem = strtok(path,","); - - while (elem) { - - if (!stat(elem,&dev_list)) { - if (dev_list.st_dev == dev.st_dev - && dev_list.st_ino == dev.st_ino) { - authorized = TRUE; - break; - - } - } - elem = strtok(NULL,","); - } - xfree(path); - } -#if 0 - ErrorF("AUTHORIZED: %s\n",authorized?"Yes":"No"); -#endif - return (authorized); -} - -_X_EXPORT MiscExtReturn -MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd) -{ - if (mse_or_kbd == MISC_POINTER) { - Bool protoChanged = FALSE; - int oldflags; - Bool reopen = FALSE; - MouseProtocolID newProtocol; - mseParamsPtr mse = structure; - InputInfoPtr pInfo; - MouseDevPtr pMse; - pointer xf86MouseProtocolIDToName - = LoaderSymbol("xf86MouseProtocolIDToName"); - if (!xf86MouseProtocolIDToName) - return MISC_RET_NOMODULE; - if (mse->type < MTYPE_MICROSOFT - || (mse->type > MTYPE_EXPPS2 - && (mse->type != MTYPE_OSMOUSE))) - return MISC_RET_BADMSEPROTO; -#ifdef OSMOUSE_ONLY - if (mse->type != MTYPE_OSMOUSE) - return MISC_RET_BADMSEPROTO; -#else - if (mse->type == MTYPE_OSMOUSE) - return MISC_RET_BADMSEPROTO; -#endif /* OSMOUSE_ONLY */ - - if (mse->em3timeout < 0) - return MISC_RET_BADVAL; - - if (mse->type == MTYPE_LOGIMAN - && !(mse->baudrate == 0 - || mse->baudrate == 1200 - || mse->baudrate == 9600)) - return MISC_RET_BADBAUDRATE; - if (mse->type == MTYPE_LOGIMAN && mse->samplerate) - return MISC_RET_BADCOMBO; - - if (mse->flags & MF_REOPEN) { - reopen = TRUE; - mse->flags &= ~MF_REOPEN; - } - if (mse->type != MTYPE_OSMOUSE - && mse->type != MTYPE_PS_2 - && mse->type != MTYPE_BUSMOUSE - && mse->type != MTYPE_IMPS2 - && mse->type != MTYPE_THINKINGPS2 - && mse->type != MTYPE_MMANPLUSPS2 - && mse->type != MTYPE_GLIDEPOINTPS2 - && mse->type != MTYPE_NETPS2 - && mse->type != MTYPE_NETSCROLLPS2 - && mse->type != MTYPE_SYSMOUSE) - { - if (mse->baudrate % 1200 != 0 - || (mse->baudrate != 0 && mse->baudrate < 1200) - || mse->baudrate > 9600) - return MISC_RET_BADBAUDRATE; - } - if ((mse->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS)) - && (mse->type != MTYPE_MOUSESYS)) - return MISC_RET_BADFLAGS; - - if (mse->type != MTYPE_OSMOUSE - && mse->type != MTYPE_BUSMOUSE) - { - if (mse->samplerate < 0) - return MISC_RET_BADVAL; - } - - if (mse->resolution < 0) - return MISC_RET_BADVAL; - if (mse->chordmiddle) - { - if (mse->em3buttons || !(mse->type == MTYPE_MICROSOFT - || mse->type == MTYPE_LOGIMAN) ) - return MISC_RET_BADCOMBO; - } - - /* XXX - This still needs work */ - - pInfo = mse->private; - pMse = pInfo->private; - oldflags = pMse->mouseFlags; - - newProtocol = MapMseMiscToProto(mse->type); - protoChanged = pMse->protocolID != newProtocol; - if (protoChanged - || pMse->baudRate != mse->baudrate - || pMse->sampleRate != mse->samplerate - || pMse->resolution != mse->resolution - || pMse->mouseFlags != mse->flags) - reopen = TRUE; - - if (mse->device) - reopen = TRUE; - - if (reopen) - (pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE); - - pMse->protocolID = newProtocol; - pMse->baudRate = mse->baudrate; - pMse->sampleRate = mse->samplerate; - pMse->resolution = mse->resolution; - pMse->buttons = mse->buttons; - pMse->emulate3Buttons = mse->em3buttons; - pMse->emulate3Timeout = mse->em3timeout; - pMse->chordMiddle = mse->chordmiddle; - pMse->mouseFlags = mse->flags; - - pMse->protocol = ((const char *(*)(MouseProtocolID)) - xf86MouseProtocolIDToName)(pMse->protocolID); - - if (mse->device) { - if (MiscExtAuthorizeDevice(pInfo, mse->device)) { - xf86ReplaceStrOption(pInfo->options, "Device", mse->device); - } else { - return MISC_RET_BADVAL; - } - } - - if (reopen) { - /* Only if protocol is changed explicitely disable auto detect */ - if (protoChanged) - pMse->autoProbe = FALSE; - (pMse->device->deviceProc)(pMse->device, DEVICE_ON); - } - /* Set pInfo->options too */ - - if ((oldflags & MF_CLEAR_DTR) != (pMse->mouseFlags & MF_CLEAR_DTR)) - xf86ReplaceBoolOption(pInfo->options, "ClearDTR", - pMse->mouseFlags | MF_CLEAR_DTR); - if ((oldflags & MF_CLEAR_RTS) != (pMse->mouseFlags & MF_CLEAR_RTS)) - xf86ReplaceBoolOption(pInfo->options, "ClearRTS", - pMse->mouseFlags | MF_CLEAR_RTS); - } - return MISC_RET_BADVAL; -} - -_X_EXPORT Bool -MiscExtGetFilePaths(const char **configfile, const char **modulepath, - const char **logfile) -{ - *configfile = xf86ConfigFile; - *modulepath = xf86ModulePath; - *logfile = xf86LogFile; - - return TRUE; -} - -_X_EXPORT int -MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval, - char **retstr) -{ - ScrnInfoPtr pScr = xf86Screens[scrnIndex]; - - /* should check this in the protocol, but xf86NumScreens isn't exported */ - if (scrnIndex >= xf86NumScreens) - return BadValue; - - if (*pScr->HandleMessage == NULL) - return BadImplementation; - return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr); -} - -#endif /* XF86MISC */ - diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 78a22ecd4..3c75df0ab 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -82,11 +82,11 @@ typedef enum { * changed. The minor revision mask is 0x0000FFFF and the major revision * mask is 0xFFFF0000. */ -#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(3, 0) -#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 0) -#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5) +#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 1) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(3, 1) +#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 1) +#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) #define MODINFOSTRING1 0xef23fdc5 #define MODINFOSTRING2 0x10dc023a @@ -194,7 +194,6 @@ pointer LoadSubModuleLocal(pointer, const char *, const char **, const char **, pointer, const XF86ModReqInfo *, int *, int *); void UnloadSubModule(pointer); -void LoadFont(pointer); void UnloadModule (pointer); #endif pointer LoaderSymbol(const char *); @@ -209,6 +208,7 @@ void LoaderReqSymLists(const char **, ...); void LoaderReqSymbols(const char *, ...); int LoaderCheckUnresolved(int); void LoaderGetOS(const char **name, int *major, int *minor, int *teeny); +Bool LoaderShouldIgnoreABI(void); int LoaderGetABIVersion(const char *abiclass); typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *); diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 88b80be2b..cb4bae7cd 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -51,10 +51,6 @@ extern Bool xf86AllowMouseOpenFail; extern Bool xf86VidModeDisabled; extern Bool xf86VidModeAllowNonLocal; #endif -#ifdef XF86MISC -extern Bool xf86MiscModInDevDisabled; -extern Bool xf86MiscModInDevAllowNonLocal; -#endif extern Bool xf86fpFlag; extern Bool xf86coFlag; extern Bool xf86sFlag; @@ -163,8 +159,6 @@ void DoConfigure(void); /* xf86Events.c */ -void xf86PostKbdEvent(unsigned key); -void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy); void xf86Wakeup(pointer blockData, int err, pointer pReadmask); void xf86SigHandler(int signo); void xf86HandlePMEvents(int fd, pointer data); @@ -182,16 +176,6 @@ int xf86SetVerbosity(int verb); int xf86SetLogVerbosity(int verb); Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only ); -/* xf86Lock.c */ - -#ifdef USE_XF86_SERVERLOCK -void xf86UnlockServer(void); -#endif - -/* xf86XKB.c */ - -void xf86InitXkb(void); - /* xf86Xinput.c */ extern EventList *xf86Events; diff --git a/hw/xfree86/rac/xf86RAC.c b/hw/xfree86/common/xf86RAC.c similarity index 100% rename from hw/xfree86/rac/xf86RAC.c rename to hw/xfree86/common/xf86RAC.c diff --git a/hw/xfree86/rac/xf86RAC.h b/hw/xfree86/common/xf86RAC.h similarity index 100% rename from hw/xfree86/rac/xf86RAC.h rename to hw/xfree86/common/xf86RAC.h diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index f6157518e..10ec37070 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -55,6 +55,8 @@ xf86RandRModeRefresh (DisplayModePtr mode) { if (mode->VRefresh) return (int) (mode->VRefresh + 0.5); + else if (mode->Clock == 0) + return 0; else return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5); } @@ -171,6 +173,25 @@ xf86RandRSetMode (ScreenPtr pScreen, scrp->virtualX = mode->HDisplay; scrp->virtualY = mode->VDisplay; } + + /* + * The DIX forgets the physical dimensions we passed into RRRegisterSize, so + * reconstruct them if possible. + */ + if(scrp->DriverFunc) { + xorgRRModeMM RRModeMM; + + RRModeMM.mode = mode; + RRModeMM.virtX = scrp->virtualX; + RRModeMM.virtY = scrp->virtualY; + RRModeMM.mmWidth = mmWidth; + RRModeMM.mmHeight = mmHeight; + + (*scrp->DriverFunc)(scrp, RR_GET_MODE_MM, &RRModeMM); + + mmWidth = RRModeMM.mmWidth; + mmHeight = RRModeMM.mmHeight; + } if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270)) { /* If the screen is rotated 90 or 270 degrees, swap the sizes. */ @@ -224,7 +245,7 @@ xf86RandRSetConfig (ScreenPtr pScreen, Bool useVirtual = FALSE; Rotation oldRotation = randrp->rotation; - miPointerPosition (&px, &py); + miPointerGetPosition(inputInfo.pointer, &px, &py); for (mode = scrp->modes; ; mode = mode->next) { if (mode->HDisplay == pSize->width && diff --git a/hw/xfree86/common/xf86Versions.c b/hw/xfree86/common/xf86Versions.c deleted file mode 100644 index 97a35590e..000000000 --- a/hw/xfree86/common/xf86Versions.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2003 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86OSmouse.h" - -static CARD32 registeredVersions[NUM_BUILTIN_IFS]; - -_X_EXPORT CARD32 -xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags) -{ - if (iface < 0 || iface >= NUM_BUILTIN_IFS) { - xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: Unexpected interface" - "query: %d\n", iface); - return 0; - } - - if (registeredVersions[iface]) - return registeredVersions[iface]; - - /* Most built-in interfaces are handled this way. */ - switch (iface) { - case BUILTIN_IF_OSMOUSE: - return OS_MOUSE_VERSION_CURRENT; - default: - xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: " - "interface %d not handled\n", iface); - return 0; - } -} - -_X_EXPORT Bool -xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, CARD32 version, - int flags) -{ - if (iface < 0 || iface >= NUM_BUILTIN_IFS) { - xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: " - "unexpected interface number: %d\n", iface); - return FALSE; - } - if (version == 0) { - xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: " - "versions must be greater than zero\n"); - return FALSE; - } - registeredVersions[iface] = version; - return TRUE; -} - diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c deleted file mode 100644 index 11694544a..000000000 --- a/hw/xfree86/common/xf86XKB.c +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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) 1994-2002 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#define NEED_EVENTS 1 -#include -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#define XF86_OS_PRIVS -#include "xf86_OSlib.h" - -#include - -void -xf86InitXkb(void) -{ -} diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 675ec9f75..9a14a4c67 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -82,12 +82,125 @@ #include "mi.h" +#include /* dix pointer acceleration */ + #ifdef XFreeXDGA #include "dgaproc.h" #endif EventListPtr xf86Events = NULL; +/** + * Eval config and modify DeviceVelocityRec accordingly + */ +static void +ProcessVelocityConfiguration(char* devname, pointer list, DeviceVelocityPtr s){ + int tempi, i; + float tempf, tempf2; + + if(!s) + return; + + tempf = xf86SetRealOption(list, "FilterHalflife", 20); + xf86Msg(X_CONFIG, "%s: (accel) filter halflife %.1f ms\n", devname, tempf); + if(tempf > 0) + tempf = 1.0 / tempf; /* set reciprocal if possible */ + else + tempf = 10000; /* else set fairly high */ + + tempf2 = xf86SetRealOption(list, "FilterChainProgression", 2.0); + xf86Msg(X_CONFIG, "%s: (accel) filter chain progression: %.2f\n", + devname, tempf2); + if(tempf2 < 1) + tempf2 = 2; + + tempi = xf86SetIntOption(list, "FilterChainLength", 1); + if(tempi < 1 || tempi > MAX_VELOCITY_FILTERS) + tempi = 1; + + InitFilterChain(s, tempf, tempf2, tempi, 40); + for(i = 0; i < tempi; i++) + xf86Msg(X_CONFIG, "%s: (accel) filter stage %i: %.2f ms\n", + devname, i, 1.0f / (s->filters[i].rdecay)); + + tempf = xf86SetIntOption(list, "ConstantDeceleration", 1); + if(tempf > 1.0){ + xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n", + devname, tempf); + s->const_acceleration = 1.0 / tempf; /* set reciprocal deceleration + alias acceleration */ + } + + tempf = xf86SetIntOption(list, "AdaptiveDeceleration", 1); + if(tempf > 1.0){ + xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n", + devname, tempf); + s->min_acceleration = 1.0 / tempf; /* set minimum acceleration */ + } + + tempf = xf86SetRealOption(list, "VelocityCoupling", 0.2); + xf86Msg(X_CONFIG, "%s: (accel) velocity coupling is %.1f%%\n", devname, + tempf*100.0); + s->coupling = tempf; + + /* Configure softening. If const deceleration is used, this is expected + * to provide better subpixel information so we enable + * softening by default only if ConstantDeceleration is not used + */ + s->use_softening = xf86SetBoolOption(list, "Softening", + s->const_acceleration == 1.0); + + s->reset_time = xf86SetIntOption(list, "VelocityReset", 300); + + tempf = xf86SetRealOption(list, "ExpectedRate", 0); + if(tempf > 0){ + s->corr_mul = 1000.0 / tempf; + }else{ + s->corr_mul = xf86SetRealOption(list, "VelocityScale", 10); + } + + /* select profile by number */ + tempi= xf86SetIntOption(list, "AccelerationProfile", 0); + if(SetAccelerationProfile(s, tempi)){ + xf86Msg(X_CONFIG, "%s: (accel) set acceleration profile %i\n", devname, tempi); + }else{ + xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n", + devname, tempi); + } +} + +static void +ApplyAccelerationSettings(DeviceIntPtr dev){ + int scheme; + DeviceVelocityPtr pVel; + LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate; + + if(dev->valuator){ + scheme = xf86SetIntOption(local->options, "AccelerationScheme", 1); + + /* reinit scheme if needed */ + if(dev->valuator->accelScheme.number != scheme){ + if(dev->valuator->accelScheme.AccelCleanupProc){ + dev->valuator->accelScheme.AccelCleanupProc(dev); + } + + xf86Msg(X_CONFIG, "%s: (accel) init acceleration scheme %i\n", local->name, scheme); + InitPointerAccelerationScheme(dev, scheme); + }else{ + xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n", local->name, scheme); + } + + /* process special configuration */ + switch(scheme){ + case 1: + pVel = (DeviceVelocityPtr) dev->valuator->accelScheme.accelData; + ProcessVelocityConfiguration (local->name, local->options, + pVel); + break; + } + } +} + static Bool xf86SendDragEvents(DeviceIntPtr device) { @@ -131,7 +244,7 @@ xf86ProcessCommonOptions(LocalDevicePtr local, local->history_size = GetMotionHistorySize(); /* Preallocate xEvent store */ if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + GetEventList(&xf86Events); if (!xf86Events) FatalError("Couldn't allocate event store\n"); } @@ -299,6 +412,7 @@ ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control) if (!local->control_proc) { switch (control->control) { case DEVICE_CORE: + return BadMatch; case DEVICE_RESOLUTION: case DEVICE_ABS_CALIB: case DEVICE_ABS_AREA: @@ -467,7 +581,6 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev) LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate; InputDriverPtr drv; IDevRec *idev; - BOOL found; IDevPtr *it; if (pInfo) /* need to get these before RemoveDevice */ @@ -838,6 +951,9 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2; dev->last.valuators[1] = dev->valuator->axisVal[1]; } + + if(axnum == 0) /* to prevent double invocation */ + ApplyAccelerationSettings(dev); } diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index fc94284cb..0156d18bd 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -851,7 +851,6 @@ typedef int xf86SetDGAModeProc (int, int, DGADevicePtr); typedef int xf86ChangeGammaProc (int, Gamma); typedef void xf86PointerMovedProc (int, int, int); typedef Bool xf86PMEventProc (int, pmEvent, Bool); -typedef int xf86HandleMessageProc (int, const char*, const char*, char**); typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int); typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr); typedef void xf86SetOverscanProc (ScrnInfoPtr, int); @@ -1006,7 +1005,6 @@ typedef struct _ScrnInfoRec { xf86ChangeGammaProc *ChangeGamma; xf86PointerMovedProc *PointerMoved; xf86PMEventProc *PMEvent; - xf86HandleMessageProc *HandleMessage; xf86DPMSSetProc *DPMSSet; xf86LoadPaletteProc *LoadPalette; xf86SetOverscanProc *SetOverscan; @@ -1090,14 +1088,6 @@ typedef void (*InputHandlerProc)(int fd, pointer data); #define CLK_REG_SAVE -1 #define CLK_REG_RESTORE -2 -/* xf86Debug.c */ -#ifdef BUILDDEBUG -typedef struct { - long sec; - long usec; -} xf86TsRec, *xf86TsPtr; -#endif - /* * misc constants */ @@ -1111,13 +1101,6 @@ typedef struct { #define OVERLAY_8_16_DUALFB 0x00000004 #define OVERLAY_8_32_PLANAR 0x00000008 -#if 0 -#define LD_RESOLV_IFDONE 0 /* only check if no more - delays pending */ -#define LD_RESOLV_NOW 1 /* finish one delay step */ -#define LD_RESOLV_FORCE 2 /* force checking... */ -#endif - /* Values of xf86Info.mouseFlags */ #define MF_CLEAR_DTR 1 #define MF_CLEAR_RTS 2 @@ -1132,31 +1115,6 @@ typedef enum { ACTION_SWITCHSCREEN = 100, /* VT switch */ ACTION_SWITCHSCREEN_NEXT, ACTION_SWITCHSCREEN_PREV, - ACTION_MESSAGE = 9999 /* Generic message passing */ } ActionEvent; -/* xf86Versions.c */ -/* - * Never change existing values, and always assign values explicitly. - * NUM_BUILTIN_IFS must always be the last entry. - */ -typedef enum { - BUILTIN_IF_OSMOUSE = 0, - BUILTIN_IF_OSKBD = 1, - NUM_BUILTIN_IFS -} BuiltinInterface; - -/* - * These are intentionally the same as the module version macros. - * It is possible to register a module as providing a specific interface, - * in which case the module's version is used. This feature isn't - * really ready for use yet though. - */ - -#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \ - ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF)) -#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF) -#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF) -#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF) - #endif /* _XF86STR_H */ diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h index a4e79dae0..45caf6ea9 100644 --- a/hw/xfree86/ddc/edid.h +++ b/hw/xfree86/ddc/edid.h @@ -531,6 +531,9 @@ struct detailed_monitor_section { } section; /* max: 80 */ }; +/* flags */ +#define EDID_COMPLETE_RAWDATA 0x1 + typedef struct { int scrnIndex; struct vendor vendor; @@ -539,7 +542,7 @@ typedef struct { struct established_timings timings1; struct std_timings timings2[8]; struct detailed_monitor_section det_mon[4]; - void *vdif; /* unused */ + unsigned long flags; int no_sections; Uchar *rawData; } xf86Monitor, *xf86MonPtr; diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index b31969914..941fec2fd 100644 --- a/hw/xfree86/ddc/interpret_edid.c +++ b/hw/xfree86/ddc/interpret_edid.c @@ -118,6 +118,20 @@ xf86InterpretEDID(int scrnIndex, Uchar *block) return NULL; } +xf86MonPtr +xf86InterpretEEDID(int scrnIndex, Uchar *block) +{ + xf86MonPtr m; + + m = xf86InterpretEDID(scrnIndex, block); + if (!m) + return NULL; + + /* extension parse */ + + return m; +} + static void get_vendor_section(Uchar *c, struct vendor *r) { diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c index f5442adb7..5e89b40c4 100644 --- a/hw/xfree86/ddc/print_edid.c +++ b/hw/xfree86/ddc/print_edid.c @@ -462,22 +462,28 @@ print_number_sections(int scrnIndex, int num) xf86MonPtr xf86PrintEDID(xf86MonPtr m) { - CARD16 i, j; + CARD16 i, j, n; char buf[EDID_WIDTH * 2 + 1]; - if (!(m)) return NULL; + if (!m) return NULL; - print_vendor(m->scrnIndex,&m->vendor); - print_version(m->scrnIndex,&m->ver); - print_display(m->scrnIndex,&m->features, &m->ver); - print_established_timings(m->scrnIndex,&m->timings1); - print_std_timings(m->scrnIndex,m->timings2); - print_detailed_monitor_section(m->scrnIndex,m->det_mon); - print_number_sections(m->scrnIndex,m->no_sections); + print_vendor(m->scrnIndex, &m->vendor); + print_version(m->scrnIndex, &m->ver); + print_display(m->scrnIndex, &m->features, &m->ver); + print_established_timings(m->scrnIndex, &m->timings1); + print_std_timings(m->scrnIndex, m->timings2); + print_detailed_monitor_section(m->scrnIndex, m->det_mon); + print_number_sections(m->scrnIndex, m->no_sections); + + /* extension block section stuff */ xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n"); - - for (i = 0; i < 128; i += j) { + + n = 128; + if (m->flags & EDID_COMPLETE_RAWDATA) + n += m->no_sections * 128; + + for (i = 0; i < n; i += j) { for (j = 0; j < EDID_WIDTH; ++j) { sprintf(&buf[j * 2], "%02x", m->rawData[i + j]); } diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 8dda35ac4..0d8677637 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -197,21 +197,17 @@ DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer) * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are * unset. EDID information blocks are interpreted and the results returned in * an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return - * the complete EDID data, including all extension blocks. + * the complete EDID data, including all extension blocks, if the 'complete' + * parameter is TRUE; * * This function does not affect the list of modes used by drivers -- it is up * to the driver to decide policy on what to do with EDID information. * * @return pointer to a new xf86MonPtr containing the EDID information. * @return NULL if no monitor attached or failure to interpret the EDID. - * - * nblocks is an in/out parameter. If non-zero, it defines the number of - * blocks to read from the monitor; zero (or NULL pointer) means read all. - * If non-NULL, on return it will be filled in with the number of blocks - * read. */ xf86MonPtr -xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) +xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *EDID_block = NULL; @@ -242,15 +238,20 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) return NULL; if (DDC2Read(dev, 0, EDID_block)) { - tmp = xf86InterpretEDID(scrnIndex, EDID_block); + int i, n = EDID_block[0x7e]; + + if (complete && n) { + EDID_block = xrealloc(EDID_block, EDID1_LEN * (1+n)); + + for (i = 0; i < n; i++) + DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i))); + } + + tmp = xf86InterpretEEDID(scrnIndex, EDID_block); } - if (nblocks) { - if (tmp) - *nblocks = tmp->no_sections; - else - *nblocks = 0; - } + if (tmp && complete) + tmp->flags |= EDID_COMPLETE_RAWDATA; return tmp; } @@ -269,8 +270,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus) { - int nblocks = 1; - return xf86DoEEDID(scrnIndex, pBus, &nblocks); + return xf86DoEEDID(scrnIndex, pBus, FALSE); } /* diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h index 6e5bf6f7a..42d9ce694 100644 --- a/hw/xfree86/ddc/xf86DDC.h +++ b/hw/xfree86/ddc/xf86DDC.h @@ -35,7 +35,7 @@ extern xf86MonPtr xf86DoEDID_DDC2( I2CBusPtr pBus ); -extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks); +extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool); extern xf86MonPtr xf86PrintEDID( xf86MonPtr monPtr @@ -45,6 +45,10 @@ extern xf86MonPtr xf86InterpretEDID( int screenIndex, Uchar *block ); +extern xf86MonPtr xf86InterpretEEDID( + int screenIndex, Uchar *block +); + extern void xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC); diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am index bb79c9c61..365f00671 100644 --- a/hw/xfree86/dixmods/Makefile.am +++ b/hw/xfree86/dixmods/Makefile.am @@ -6,35 +6,22 @@ if GLX GLXMODS = libglx.la endif -if XTRAP -XTRAPMOD = libxtrap.la -endif - 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 extsmodule_LTLIBRARIES = $(RECORDMOD) \ $(DBEMOD) \ - $(GLXMODS) \ - $(XTRAPMOD) - -fontsmoduledir = $(moduledir)/fonts -fontsmodule_LTLIBRARIES = libfreetype.la + $(GLXMODS) AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@ INCLUDES = @XORG_INCS@ \ @@ -66,10 +53,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 @@ -78,15 +61,8 @@ libshadow_la_LDFLAGS = -avoid-version libshadow_la_LIBADD = $(top_builddir)/miext/shadow/libshadow.la libshadow_la_SOURCES = shmodule.c -libfreetype_la_LDFLAGS = -avoid-version -libfreetype_la_SOURCES = ftmodule.c - libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS) libxorgxkb_la_SOURCES = xkbVT.c xkbPrivate.c xkbKillSrv.c libxorgxkb_la_LIBADD = $(top_builddir)/dix/libdix.la - -libxtrap_la_LDFLAGS = -avoid-version -libxtrap_la_LIBADD = $(top_builddir)/XTrap/libxtrap.la -libxtrap_la_SOURCES = xf86XTrapModule.c diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am index fb0849747..317971db6 100644 --- a/hw/xfree86/dixmods/extmod/Makefile.am +++ b/hw/xfree86/dixmods/extmod/Makefile.am @@ -11,17 +11,12 @@ if XV XV_SRCS = xvmod.c xvmodproc.h endif -if XF86MISC -XF86MISC_SRCS = xf86misc.c xf86miscproc.h -endif - if XF86VIDMODE XF86VMODE_SRCS = xf86vmode.c vidmodeproc.h 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 @@ -30,7 +25,6 @@ libextmod_la_LDFLAGS = -avoid-version libextmod_la_SOURCES = modinit.c \ modinit.h \ $(DGA_SRCS) \ - $(XF86MISC_SRCS) \ $(XF86VMODE_SRCS) \ $(XV_SRCS) libextmod_la_LIBADD = $(top_builddir)/Xext/libXextmodule.la diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c index f8440f127..a18118a53 100644 --- a/hw/xfree86/dixmods/extmod/modinit.c +++ b/hw/xfree86/dixmods/extmod/modinit.c @@ -119,15 +119,6 @@ static ExtensionModule extensionModules[] = { NULL }, #endif -#ifdef XF86MISC - { - XFree86MiscExtensionInit, - XF86MISCNAME, - &noXFree86MiscExtension, - NULL, - NULL - }, -#endif #ifdef XFreeXDGA { XFree86DGAExtensionInit, @@ -146,15 +137,6 @@ static ExtensionModule extensionModules[] = { NULL }, #endif -#ifdef FONTCACHE - { - FontCacheExtensionInit, - FONTCACHENAME, - &noFontCacheExtension, - NULL, - NULL - }, -#endif #ifdef XV { XvExtensionInit, diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h index 7282e6e06..fe95c4922 100644 --- a/hw/xfree86/dixmods/extmod/modinit.h +++ b/hw/xfree86/dixmods/extmod/modinit.h @@ -57,13 +57,6 @@ extern void XFree86VidModeExtensionInit(INITARGS); #include #endif -#ifdef XF86MISC -extern void XFree86MiscExtensionInit(INITARGS); -#define _XF86MISC_SERVER_ -#define _XF86MISC_SAVER_COMPAT_ -#include -#endif - #ifdef XFreeXDGA extern void XFree86DGAExtensionInit(INITARGS); extern void XFree86DGARegister(INITARGS); @@ -76,13 +69,6 @@ extern void DPMSExtensionInit(INITARGS); #include #endif -#ifdef FONTCACHE -extern void FontCacheExtensionInit(INITARGS); -#define _FONTCACHE_SERVER_ -#include "fontcacheP.h" -#include "fontcachstr.h" -#endif - #ifdef XV extern void XvExtensionInit(INITARGS); extern void XvMCExtensionInit(INITARGS); @@ -112,6 +98,10 @@ extern void SELinuxExtensionInit(INITARGS); #include "xselinux.h" #endif +#ifdef XEVIE +extern void XevieExtensionInit(INITARGS); +#endif + #if 1 extern void SecurityExtensionInit(INITARGS); #endif diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c deleted file mode 100644 index 8127afdff..000000000 --- a/hw/xfree86/dixmods/extmod/xf86misc.c +++ /dev/null @@ -1,821 +0,0 @@ - -/* - * Copyright (c) 1995, 1996 The XFree86 Project, Inc - */ - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#define NEED_REPLIES -#define NEED_EVENTS -#include -#include -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "scrnintstr.h" -#include "inputstr.h" -#include "servermd.h" -#define _XF86MISC_SERVER_ -#undef _XF86MISC_SAVER_COMPAT_ -#include -#include "swaprep.h" -#include "xf86.h" -#include -#include "xf86miscproc.h" - -#if 0 -#include -#include "../os/osdep.h" -#include -#ifndef USL -#ifndef Lynx -#include -#else -#include -#endif -#endif /* USL */ -#endif - -static int miscErrorBase; -static DevPrivateKey MiscClientPrivateKey = &MiscClientPrivateKey; - -/* This holds the client's version information */ -typedef struct { - int major; - int minor; -} MiscPrivRec, *MiscPrivPtr; - -#define M_GETPRIV(c) ((MiscPrivPtr) \ - dixLookupPrivate(&(c)->devPrivates, MiscClientPrivateKey)) -#define M_SETPRIV(c,p) \ - dixSetPrivate(&(c)->devPrivates, MiscClientPrivateKey, p) - -static void XF86MiscResetProc( - ExtensionEntry* /* extEntry */ -); - -static void -ClientVersion(ClientPtr client, int *major, int *minor) -{ - MiscPrivPtr pPriv; - - pPriv = M_GETPRIV(client); - if (!pPriv) { - if (major) *major = 0; - if (minor) *minor = 0; - return; - } - - if (major) *major = pPriv->major; - if (minor) *minor = pPriv->minor; -} - -static DISPATCH_PROC(ProcXF86MiscDispatch); -static DISPATCH_PROC(ProcXF86MiscQueryVersion); -static DISPATCH_PROC(ProcXF86MiscGetKbdSettings); -static DISPATCH_PROC(ProcXF86MiscGetMouseSettings); -static DISPATCH_PROC(ProcXF86MiscSetKbdSettings); -static DISPATCH_PROC(ProcXF86MiscSetMouseSettings); -static DISPATCH_PROC(ProcXF86MiscSetGrabKeysState); -static DISPATCH_PROC(ProcXF86MiscSetClientVersion); -static DISPATCH_PROC(ProcXF86MiscGetFilePaths); -static DISPATCH_PROC(ProcXF86MiscPassMessage); -#ifdef _XF86MISC_SAVER_COMPAT_ -static DISPATCH_PROC(ProcXF86MiscGetSaver); -static DISPATCH_PROC(ProcXF86MiscSetSaver); -#endif -static DISPATCH_PROC(SProcXF86MiscDispatch); -static DISPATCH_PROC(SProcXF86MiscQueryVersion); -static DISPATCH_PROC(SProcXF86MiscGetKbdSettings); -static DISPATCH_PROC(SProcXF86MiscGetMouseSettings); -static DISPATCH_PROC(SProcXF86MiscSetKbdSettings); -static DISPATCH_PROC(SProcXF86MiscSetMouseSettings); -static DISPATCH_PROC(SProcXF86MiscSetGrabKeysState); -static DISPATCH_PROC(SProcXF86MiscSetClientVersion); -static DISPATCH_PROC(SProcXF86MiscGetFilePaths); -static DISPATCH_PROC(SProcXF86MiscPassMessage); -#ifdef _XF86MISC_SAVER_COMPAT_ -static DISPATCH_PROC(SProcXF86MiscGetSaver); -static DISPATCH_PROC(SProcXF86MiscSetSaver); -#endif - -#if 0 -static unsigned char XF86MiscReqCode = 0; -#endif - -#ifdef DEBUG -# define DEBUG_P(x) ErrorF x; -#else -# define DEBUG_P(x) do {} while (0) -#endif - -#define MISCERR(x) (miscErrorBase + x) - -void -XFree86MiscExtensionInit(void) -{ - ExtensionEntry* extEntry; - - if (!xf86GetModInDevEnabled()) - return; - - if ( - (extEntry = AddExtension(XF86MISCNAME, - XF86MiscNumberEvents, - XF86MiscNumberErrors, - ProcXF86MiscDispatch, - SProcXF86MiscDispatch, - XF86MiscResetProc, - StandardMinorOpcode))) { -#if 0 - XF86MiscReqCode = (unsigned char)extEntry->base; -#endif - miscErrorBase = extEntry->errorBase; - } -} - -/*ARGSUSED*/ -static void -XF86MiscResetProc (extEntry) - ExtensionEntry* extEntry; -{ -} - -static int -ProcXF86MiscQueryVersion(client) - register ClientPtr client; -{ - xXF86MiscQueryVersionReply rep; - register int n; - - REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = XF86MISC_MAJOR_VERSION; - rep.minorVersion = XF86MISC_MINOR_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); - } - WriteToClient(client, sizeof(xXF86MiscQueryVersionReply), (char *)&rep); - return (client->noClientException); -} - -#ifdef _XF86MISC_SAVER_COMPAT_ -/* THESE HAVE NOT BEEN CONVERTED TO THE NEW DESIGN */ - -/* - * This will go away, but remains for now for compatibility with older - * clients. - */ -static int -ProcXF86MiscSetSaver(client) - register ClientPtr client; -{ - REQUEST(xXF86MiscSetSaverReq); - ScrnInfoPtr vptr; - - if (stuff->screen > screenInfo.numScreens) - return BadValue; - - vptr = (ScrnInfoPtr) - dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates, - xf86ScreenKey); - - REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq); - - if (stuff->suspendTime < 0) - return BadValue; - if (stuff->offTime < 0) - return BadValue; - - return (client->noClientException); -} - -/* - * This will go away, but remains for now for compatibility with older - * clients. - */ -static int -ProcXF86MiscGetSaver(client) - register ClientPtr client; -{ - REQUEST(xXF86MiscGetSaverReq); - xXF86MiscGetSaverReply rep; - register int n; - ScrnInfoPtr vptr; - - if (stuff->screen > screenInfo.numScreens) - return BadValue; - - vptr = (ScrnInfoPtr) - dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates, - xf86ScreenKey); - - REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.suspendTime = 0; - rep.offTime = 0; - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.suspendTime, n); - swapl(&rep.offTime, n); - } - WriteToClient(client, SIZEOF(xXF86MiscGetSaverReply), (char *)&rep); - return (client->noClientException); -} - -#endif /* _XF86MISC_SAVER_COMPAT_ */ - -static int -ProcXF86MiscGetMouseSettings(client) - register ClientPtr client; -{ - xXF86MiscGetMouseSettingsReply rep; - char *devname; - pointer mouse; - register int n; - int devnamelen; - - REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - - if (!MiscExtGetMouseSettings(&mouse, &devname)) - return BadValue; - - rep.mousetype = MiscExtGetMouseValue(mouse, MISC_MSE_PROTO); - rep.baudrate = MiscExtGetMouseValue(mouse, MISC_MSE_BAUDRATE); - rep.samplerate = MiscExtGetMouseValue(mouse, MISC_MSE_SAMPLERATE); - rep.resolution = MiscExtGetMouseValue(mouse, MISC_MSE_RESOLUTION); - rep.buttons = MiscExtGetMouseValue(mouse, MISC_MSE_BUTTONS); - rep.emulate3buttons = MiscExtGetMouseValue(mouse, MISC_MSE_EM3BUTTONS); - rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT); - rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE); - rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS); - devnamelen = rep.devnamelen = (devname? strlen(devname): 0); - rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) - - sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2; - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.mousetype, n); - swapl(&rep.baudrate, n); - swapl(&rep.samplerate, n); - swapl(&rep.resolution, n); - swapl(&rep.buttons, n); - swapl(&rep.emulate3buttons, n); - swapl(&rep.emulate3timeout, n); - swapl(&rep.chordmiddle, n); - swapl(&rep.flags, n); - } - WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep); - MiscExtDestroyStruct(mouse, MISC_POINTER); - - if (devnamelen) - WriteToClient(client, devnamelen, devname); - return (client->noClientException); -} - -static int -ProcXF86MiscGetKbdSettings(client) - register ClientPtr client; -{ - xXF86MiscGetKbdSettingsReply rep; - pointer kbd; - register int n; - - REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (!MiscExtGetKbdSettings(&kbd)) - return BadValue; - - rep.kbdtype = MiscExtGetKbdValue(kbd, MISC_KBD_TYPE); - rep.rate = MiscExtGetKbdValue(kbd, MISC_KBD_RATE); - rep.delay = MiscExtGetKbdValue(kbd, MISC_KBD_DELAY); - rep.servnumlock = MiscExtGetKbdValue(kbd, MISC_KBD_SERVNUMLOCK); - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.kbdtype, n); - swapl(&rep.rate, n); - swapl(&rep.delay, n); - } - WriteToClient(client, SIZEOF(xXF86MiscGetKbdSettingsReply), (char *)&rep); - return (client->noClientException); -} - -static int -ProcXF86MiscSetMouseSettings(client) - register ClientPtr client; -{ - MiscExtReturn ret; - pointer mouse; - char *devname = NULL; - int major, minor; - - REQUEST(xXF86MiscSetMouseSettingsReq); - - REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq); - - ClientVersion(client, &major, &minor); - - if (xf86GetVerbosity() > 1) { - DEBUG_P(("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n", - (int)stuff->mousetype, (int)stuff->baudrate, - (int)stuff->samplerate, stuff->chordmiddle)); - DEBUG_P((" em3but: %d em3tim: %d res: %d flags: %ld\n", - stuff->emulate3buttons, (int)stuff->emulate3timeout, - (int)stuff->resolution, (unsigned long)stuff->flags)); - } - - if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0) - return BadAlloc; - - MiscExtSetMouseValue(mouse, MISC_MSE_PROTO, stuff->mousetype); - MiscExtSetMouseValue(mouse, MISC_MSE_BAUDRATE, stuff->baudrate); - MiscExtSetMouseValue(mouse, MISC_MSE_SAMPLERATE, stuff->samplerate); - MiscExtSetMouseValue(mouse, MISC_MSE_RESOLUTION, stuff->resolution); - MiscExtSetMouseValue(mouse, MISC_MSE_BUTTONS, stuff->buttons); - MiscExtSetMouseValue(mouse, MISC_MSE_EM3BUTTONS, stuff->emulate3buttons); - MiscExtSetMouseValue(mouse, MISC_MSE_EM3TIMEOUT, stuff->emulate3timeout); - MiscExtSetMouseValue(mouse, MISC_MSE_CHORDMIDDLE, stuff->chordmiddle); - MiscExtSetMouseValue(mouse, MISC_MSE_FLAGS, stuff->flags); - - if ((major > 0 || minor > 5) && stuff->devnamelen) { - int size = sizeof(xXF86MiscSetMouseSettingsReq) + stuff->devnamelen; - size = (size + 3) >> 2; - if (client->req_len < size) - return BadLength; - if (stuff->devnamelen) { - if (!(devname = xalloc(stuff->devnamelen))) - return BadAlloc; - strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen); - if (xf86GetVerbosity() > 1) - DEBUG_P(("SetMouseSettings - device: %s\n",devname)); - MiscExtSetMouseDevice(mouse, devname); - } - } - - ret = MiscExtApply(mouse, MISC_POINTER); - - if (devname) - xfree(devname); - - switch ((ret)) { - case MISC_RET_SUCCESS: break; - case MISC_RET_BADVAL: return BadValue; - case MISC_RET_BADMSEPROTO: return MISCERR(XF86MiscBadMouseProtocol); - case MISC_RET_BADBAUDRATE: return MISCERR(XF86MiscBadMouseBaudRate); - case MISC_RET_BADFLAGS: return MISCERR(XF86MiscBadMouseFlags); - case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo); - case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule); - default: - DEBUG_P(("Unexpected return from MiscExtApply(POINTER) = %d\n", ret)); - return BadImplementation; - } - - if (xf86GetVerbosity() > 1) - DEBUG_P(("SetMouseSettings - Succeeded\n")); - return (client->noClientException); -} - -static int -ProcXF86MiscSetKbdSettings(client) - register ClientPtr client; -{ - MiscExtReturn ret; - pointer kbd; - REQUEST(xXF86MiscSetKbdSettingsReq); - - REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq); - - if (xf86GetVerbosity() > 1) - DEBUG_P(("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n", - (int)stuff->kbdtype, (int)stuff->rate, - (int)stuff->delay, stuff->servnumlock)); - - if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0) - return BadAlloc; - - MiscExtSetKbdValue(kbd, MISC_KBD_TYPE, stuff->kbdtype); - MiscExtSetKbdValue(kbd, MISC_KBD_RATE, stuff->rate); - MiscExtSetKbdValue(kbd, MISC_KBD_DELAY, stuff->delay); - MiscExtSetKbdValue(kbd, MISC_KBD_SERVNUMLOCK, stuff->servnumlock); - - switch ((ret = MiscExtApply(kbd, MISC_KEYBOARD))) { - case MISC_RET_SUCCESS: break; - case MISC_RET_BADVAL: return BadValue; - case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType); - default: - DEBUG_P(("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret)); - return BadImplementation; - } - - if (xf86GetVerbosity() > 1) - DEBUG_P(("SetKbdSettings - Succeeded\n")); - return (client->noClientException); -} - -static int -ProcXF86MiscSetGrabKeysState(client) - register ClientPtr client; -{ - int n, status; - xXF86MiscSetGrabKeysStateReply rep; - REQUEST(xXF86MiscSetGrabKeysStateReq); - - REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq); - - if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) { - if (xf86GetVerbosity() > 1) - DEBUG_P(("SetGrabKeysState - %s\n", - stuff->enable ? "enabled" : "disabled")); - } - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.status = status; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.status, n); - } - WriteToClient(client, SIZEOF(xXF86MiscSetGrabKeysStateReply), (char *)&rep); - - return (client->noClientException); -} - -static int -ProcXF86MiscSetClientVersion(ClientPtr client) -{ - REQUEST(xXF86MiscSetClientVersionReq); - - MiscPrivPtr pPriv; - - REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq); - - if ((pPriv = M_GETPRIV(client)) == NULL) { - pPriv = xalloc(sizeof(MiscPrivRec)); - if (!pPriv) - return BadAlloc; - M_SETPRIV(client, pPriv); - } - if (xf86GetVerbosity() > 1) - DEBUG_P(("SetClientVersion: %i %i\n",stuff->major,stuff->minor)); - pPriv->major = stuff->major; - pPriv->minor = stuff->minor; - - return (client->noClientException); -} - -static int -ProcXF86MiscGetFilePaths(client) - register ClientPtr client; -{ - xXF86MiscGetFilePathsReply rep; - const char *configfile; - const char *modulepath; - const char *logfile; - register int n; - int configlen, modulelen, loglen; - - REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - - if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile)) - return BadValue; - - configlen = rep.configlen = (configfile? strlen(configfile): 0); - modulelen = rep.modulelen = (modulepath? strlen(modulepath): 0); - loglen = rep.loglen = (logfile? strlen(logfile): 0); - rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) + - ((rep.configlen + 3) & ~3) + - ((rep.modulelen + 3) & ~3) + - ((rep.loglen + 3) & ~3) ) >> 2; - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.configlen, n); - swaps(&rep.modulelen, n); - swaps(&rep.loglen, n); - } - WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep); - - if (configlen) - WriteToClient(client, configlen, (char *)configfile); - if (modulelen) - WriteToClient(client, modulelen, (char *)modulepath); - if (loglen) - WriteToClient(client, loglen, (char *)logfile); - - return (client->noClientException); -} - -static int -ProcXF86MiscPassMessage(client) - register ClientPtr client; -{ - xXF86MiscPassMessageReply rep; - char *msgtype, *msgval, *retstr; - int retval, size; - register int n; - int mesglen; - - REQUEST(xXF86MiscPassMessageReq); - - REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq); - size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2; - size+= (stuff->typelen + 3) >> 2; - size+= (stuff->vallen + 3) >> 2; - if (client->req_len < size) - return BadLength; - if (stuff->typelen) { - if (!(msgtype = xalloc(stuff->typelen))) - return BadAlloc; - strncpy(msgtype,(char*)(&stuff[1]),stuff->typelen); - } else return BadValue; - if (stuff->vallen) { - if (!(msgval = xalloc(stuff->vallen))) { - xfree(msgtype); - return BadAlloc; - } - strncpy(msgval,(char*)((char*)&stuff[1] + ((stuff->typelen + 3) & ~3)), - stuff->vallen); - } else { - xfree(msgtype); - return BadValue; - } - - if ((retval = MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) { - xfree(msgtype); - xfree(msgval); - return retval; - } - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - mesglen = rep.mesglen = (retstr? strlen(retstr): 0); - rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) + - ((rep.mesglen + 3) & ~3)) >> 2; - rep.status = 0; - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.mesglen, n); - } - WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep); - - if (mesglen) - WriteToClient(client, mesglen, (char *)retstr); - - xfree(msgtype); - xfree(msgval); - - return (client->noClientException); -} - -static int -ProcXF86MiscDispatch (client) - register ClientPtr client; -{ - REQUEST(xReq); - switch (stuff->data) - { - case X_XF86MiscQueryVersion: - return ProcXF86MiscQueryVersion(client); -#ifdef _XF86MISC_SAVER_COMPAT_ - case X_XF86MiscGetSaver: - return ProcXF86MiscGetSaver(client); - case X_XF86MiscSetSaver: - return ProcXF86MiscSetSaver(client); -#endif - case X_XF86MiscGetMouseSettings: - return ProcXF86MiscGetMouseSettings(client); - case X_XF86MiscGetKbdSettings: - return ProcXF86MiscGetKbdSettings(client); - case X_XF86MiscSetClientVersion: - return ProcXF86MiscSetClientVersion(client); - case X_XF86MiscGetFilePaths: - return ProcXF86MiscGetFilePaths(client); - case X_XF86MiscPassMessage: - return ProcXF86MiscPassMessage(client); - default: - if (!xf86GetModInDevEnabled()) - return miscErrorBase + XF86MiscModInDevDisabled; - if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) { - switch (stuff->data) { - case X_XF86MiscSetMouseSettings: - return ProcXF86MiscSetMouseSettings(client); - case X_XF86MiscSetKbdSettings: - return ProcXF86MiscSetKbdSettings(client); - case X_XF86MiscSetGrabKeysState: - return ProcXF86MiscSetGrabKeysState(client); - default: - return BadRequest; - } - } else - return miscErrorBase + XF86MiscModInDevClientNotLocal; - } -} - -static int -SProcXF86MiscQueryVersion(client) - register ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscQueryVersionReq); - swaps(&stuff->length, n); - return ProcXF86MiscQueryVersion(client); -} - -#ifdef _XF86MISC_SAVER_COMPAT_ -static int -SProcXF86MiscGetSaver(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscGetSaverReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq); - swaps(&stuff->screen, n); - return ProcXF86MiscGetSaver(client); -} - -static int -SProcXF86MiscSetSaver(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscSetSaverReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq); - swaps(&stuff->screen, n); - swapl(&stuff->suspendTime, n); - swapl(&stuff->offTime, n); - return ProcXF86MiscSetSaver(client); -} -#endif /* _XF86MISC_SAVER_COMPAT_ */ - -static int -SProcXF86MiscGetMouseSettings(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscGetMouseSettingsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq); - return ProcXF86MiscGetMouseSettings(client); -} - -static int -SProcXF86MiscGetKbdSettings(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscGetKbdSettingsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq); - return ProcXF86MiscGetKbdSettings(client); -} - -static int -SProcXF86MiscSetMouseSettings(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscSetMouseSettingsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscSetMouseSettingsReq); - swapl(&stuff->mousetype, n); - swapl(&stuff->baudrate, n); - swapl(&stuff->samplerate, n); - swapl(&stuff->resolution, n); - swapl(&stuff->buttons, n); - swapl(&stuff->emulate3timeout, n); - swapl(&stuff->flags, n); - return ProcXF86MiscSetMouseSettings(client); -} - -static int -SProcXF86MiscSetKbdSettings(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscSetKbdSettingsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq); - swapl(&stuff->kbdtype, n); - swapl(&stuff->rate, n); - swapl(&stuff->delay, n); - return ProcXF86MiscSetKbdSettings(client); -} - -static int -SProcXF86MiscSetGrabKeysState(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscSetGrabKeysStateReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq); - swaps(&stuff->enable, n); - return ProcXF86MiscSetGrabKeysState(client); -} - -static int -SProcXF86MiscSetClientVersion(ClientPtr client) -{ - register int n; - REQUEST(xXF86MiscSetClientVersionReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq); - swaps(&stuff->major, n); - swaps(&stuff->minor, n); - return ProcXF86MiscSetClientVersion(client); -} - -static int -SProcXF86MiscGetFilePaths(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscGetFilePathsReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq); - return ProcXF86MiscGetFilePaths(client); -} - -static int -SProcXF86MiscPassMessage(client) - ClientPtr client; -{ - register int n; - REQUEST(xXF86MiscPassMessageReq); - swaps(&stuff->length, n); - REQUEST_SIZE_MATCH(xXF86MiscPassMessageReq); - return ProcXF86MiscPassMessage(client); -} - -static int -SProcXF86MiscDispatch (client) - register ClientPtr client; -{ - REQUEST(xReq); - switch (stuff->data) - { - case X_XF86MiscQueryVersion: - return SProcXF86MiscQueryVersion(client); -#ifdef _XF86MISC_SAVER_COMPAT_ - case X_XF86MiscGetSaver: - return SProcXF86MiscGetSaver(client); - case X_XF86MiscSetSaver: - return SProcXF86MiscSetSaver(client); -#endif - case X_XF86MiscGetMouseSettings: - return SProcXF86MiscGetMouseSettings(client); - case X_XF86MiscGetKbdSettings: - return SProcXF86MiscGetKbdSettings(client); - case X_XF86MiscSetClientVersion: - return SProcXF86MiscSetClientVersion(client); - case X_XF86MiscGetFilePaths: - return SProcXF86MiscGetFilePaths(client); - case X_XF86MiscPassMessage: - return SProcXF86MiscPassMessage(client); - default: - if (!xf86GetModInDevEnabled()) - return miscErrorBase + XF86MiscModInDevDisabled; - if (xf86GetModInDevAllowNonLocal() || LocalClient (client)) { - switch (stuff->data) { - case X_XF86MiscSetMouseSettings: - return SProcXF86MiscSetMouseSettings(client); - case X_XF86MiscSetKbdSettings: - return SProcXF86MiscSetKbdSettings(client); - case X_XF86MiscSetGrabKeysState: - return SProcXF86MiscSetGrabKeysState(client); - default: - return BadRequest; - } - } else - return miscErrorBase + XF86MiscModInDevClientNotLocal; - } -} - diff --git a/hw/xfree86/dixmods/extmod/xf86miscproc.h b/hw/xfree86/dixmods/extmod/xf86miscproc.h deleted file mode 100644 index 93b193ca7..000000000 --- a/hw/xfree86/dixmods/extmod/xf86miscproc.h +++ /dev/null @@ -1,69 +0,0 @@ - -/* Prototypes for Pointer/Keyboard functions that the DDX must provide */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _XF86MISCPROC_H_ -#define _XF86MISCPROC_H_ - -typedef enum { - MISC_MSE_PROTO, - MISC_MSE_BAUDRATE, - MISC_MSE_SAMPLERATE, - MISC_MSE_RESOLUTION, - MISC_MSE_BUTTONS, - MISC_MSE_EM3BUTTONS, - MISC_MSE_EM3TIMEOUT, - MISC_MSE_CHORDMIDDLE, - MISC_MSE_FLAGS -} MiscExtMseValType; - -typedef enum { - MISC_KBD_TYPE, - MISC_KBD_RATE, - MISC_KBD_DELAY, - MISC_KBD_SERVNUMLOCK -} MiscExtKbdValType; - -typedef enum { - MISC_RET_SUCCESS, - MISC_RET_BADVAL, - MISC_RET_BADMSEPROTO, - MISC_RET_BADBAUDRATE, - MISC_RET_BADFLAGS, - MISC_RET_BADCOMBO, - MISC_RET_BADKBDTYPE, - MISC_RET_NOMODULE -} MiscExtReturn; - -typedef enum { - MISC_POINTER, - MISC_KEYBOARD -} MiscExtStructType; - -#define MISC_MSEFLAG_CLEARDTR 1 -#define MISC_MSEFLAG_CLEARRTS 2 -#define MISC_MSEFLAG_REOPEN 128 - -void XFree86MiscExtensionInit(void); - -Bool MiscExtGetMouseSettings(pointer *mouse, char **devname); -int MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype); -Bool MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value); -Bool MiscExtGetKbdSettings(pointer *kbd); -int MiscExtGetKbdValue(pointer kbd, MiscExtKbdValType valtype); -Bool MiscExtSetKbdValue(pointer kbd, MiscExtKbdValType valtype, int value); -int MiscExtSetGrabKeysState(ClientPtr client, int enable); -pointer MiscExtCreateStruct(MiscExtStructType mse_or_kbd); -void MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd); -MiscExtReturn MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd); -Bool MiscExtSetMouseDevice(pointer mouse, char* device); -Bool MiscExtGetFilePaths(const char **configfile, const char **modulepath, - const char **logfile); -int MiscExtPassMessage(int scrn, const char *msgtype, const char *msgval, - char **retstr); - -#endif - diff --git a/hw/xfree86/dixmods/ftmodule.c b/hw/xfree86/dixmods/ftmodule.c deleted file mode 100644 index 382c0b3b7..000000000 --- a/hw/xfree86/dixmods/ftmodule.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 1998-2002 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 -#endif - -#include "misc.h" - -#include -#include "xf86Module.h" - -static MODULESETUPPROTO(freetypeSetup); - - /* - * This is the module data function that is accessed when loading - * libfreetype as a module. - */ - -static XF86ModuleVersionInfo VersRec = -{ - "freetype", - MODULEVENDORSTRING " & the After X-TT Project", - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 2, 1, 0, - ABI_CLASS_FONT, /* Font module */ - ABI_FONT_VERSION, - MOD_CLASS_FONT, - {0,0,0,0} /* signature, to be patched into the file by a tool */ -}; - -_X_EXPORT XF86ModuleData freetypeModuleData = { &VersRec, freetypeSetup, NULL }; - -extern void FreeTypeRegisterFontFileFunctions(void); - -static FontModule freetypeModule = { - FreeTypeRegisterFontFileFunctions, - "FreeType", - NULL -}; - -static pointer -freetypeSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - freetypeModule.module = module; - LoadFont(&freetypeModule); - - /* Need a non-NULL return */ - return (pointer)1; -} diff --git a/hw/xfree86/dixmods/mfbmodule.c b/hw/xfree86/dixmods/mfbmodule.c deleted file mode 100644 index 91539d709..000000000 --- a/hw/xfree86/dixmods/mfbmodule.c +++ /dev/null @@ -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 -#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 }; diff --git a/hw/xfree86/dixmods/xf86XTrapModule.c b/hw/xfree86/dixmods/xf86XTrapModule.c deleted file mode 100644 index e89d7751d..000000000 --- a/hw/xfree86/dixmods/xf86XTrapModule.c +++ /dev/null @@ -1,45 +0,0 @@ -/* This is the xf86 module code for the DEC_XTRAP extension. */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -#include - -extern void DEC_XTRAPInit(INITARGS); - -static MODULESETUPPROTO(xtrapSetup); - -static ExtensionModule xtrapExt = -{ - DEC_XTRAPInit, - XTrapExtName, - NULL, - NULL, - NULL -}; - -static XF86ModuleVersionInfo xtrapVersRec = -{ - "xtrap", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, /* needs the server extension ABI */ - ABI_EXTENSION_VERSION, - MOD_CLASS_EXTENSION, - {0,0,0,0} -}; - -_X_EXPORT XF86ModuleData xtrapModuleData = { &xtrapVersRec, xtrapSetup, NULL }; - -static pointer -xtrapSetup(pointer module, pointer opts, int *errmaj, int *errmin) { - LoadExtension(&xtrapExt, FALSE); - /* Need a non-NULL return value to indicate success */ - return (pointer)1; -} diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c index e0cd21739..7de3a66c6 100644 --- a/hw/xfree86/dixmods/xkbPrivate.c +++ b/hw/xfree86/dixmods/xkbPrivate.c @@ -33,8 +33,6 @@ XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); else if (strcasecmp(msgbuf, "clsgrb")==0) xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); - else - xf86ProcessActionEvent(ACTION_MESSAGE, (void *) msgbuf); } return 0; diff --git a/hw/xfree86/doc/Makefile.am b/hw/xfree86/doc/Makefile.am index 6d8f4d213..5809fa05f 100644 --- a/hw/xfree86/doc/Makefile.am +++ b/hw/xfree86/doc/Makefile.am @@ -6,5 +6,4 @@ endif EXTRA_DIST = \ README.DRI \ - README.fonts \ README.rapidaccess diff --git a/hw/xfree86/doc/README.fonts b/hw/xfree86/doc/README.fonts deleted file mode 100644 index 0ad2b49d0..000000000 --- a/hw/xfree86/doc/README.fonts +++ /dev/null @@ -1,1158 +0,0 @@ - Fonts in X11R6.9 - - Juliusz Chroboczek, - - 25 March 2004 - -1. Introduction - -This document describes the support for fonts in X11R6.9. Installing fonts -(section 2., page 1) is aimed at the casual user wishing to install fonts in -X11R6.9 the rest of the document describes the font support in more detail. - -We assume some familiarity with digital fonts. If anything is not clear to -you, please consult Appendix: Background (section 5., page 1) at the end of -this document for background information. - -1.1 Two font systems - -X includes two font systems: the original core X11 fonts system, which is -present in all implementations of X11, and the Xft fonts system, which may -not be distributed with implementations of X11 that are not based on X11R6.9 -but will hopefully be included by them in the future - -The core X11 fonts system is directly derived from the fonts system included -with X11R1 in 1987, which could only use monochrome bitmap fonts. Over the -years, it has been more or less happily coerced into dealing with scalable -fonts and rotated glyphs. - -Xft was designed from the start to provide good support for scalable fonts, -and do so efficiently. Unlike the core fonts system, it supports features -such as anti-aliasing and sub-pixel rasterisation. Perhaps more importantly, -it gives applications full control over the way glyphs are rendered, making -fine typesetting and WYSIWIG display possible. Finally, it allows applica- -tions to use fonts that are not installed system-wide for displaying docu- -ments with embedded fonts. - -Xft is not compatible with the core fonts system: usage of Xft requires mak- -ing fairly extensive changes to toolkits (user-interface libraries). While -X.org will continue to maintain the core fonts system, toolkit authors are -encouraged to switch to Xft as soon as possible. - -2. Installing fonts - -This section explains how to configure both Xft and the core fonts system to -access newly-installed fonts. - -2.1 Configuring Xft - -Xft has no configuration mechanism itself, rather it relies upon the fontcon- -fig library to configure and customize fonts. That library is not specific -to X11R6.9 or indeed on any particular font output mechanism. This discus- -sion describes how fontconfig, rather than Xft, works. - -2.1.1 Installing fonts in Xft - -Fontconfig looks for fonts in a set of well-known directories that include -all of X11R6.9's standard font directories (`/usr/X11R6/lib/X11/lib/fonts/*') -by default) as well as a directory called `.fonts/' in the user's home direc- -tory. Installing a font for use by Xft applications is as simple as copying -a font file into one of these directories. - - $ cp lucbr.ttf ~/.fonts/ - -Fontconfig will notice the new font at the next opportunity and rebuild its -list of fonts. If you want to trigger this update from the command line (for -example in order to globally update the system-wide Fontconfig information), -you may run the command `fc-cache'. - - $ fc-cache - -2.1.2 Fine-tuning Xft - -Fontconfig's behaviour is controlled by a set of configuration files: a sys- -tem-wide configuration file, `/etc/fonts/fonts.conf', and a user-specific -file called `.fonts.conf' in the user's home directory (this can be overrid- -den with the `FONTCONFIG_FILE' environment variable). - -Every Fontconfig configuration file must start with the following boiler- -plate: - - - - - -In addition, every Fontconfig configuration file must end with the following -line: - - - -The default Fontconfig configuration file includes the directory `~/.fonts/' -in the list of directories searched for font files, and this is where user- -specific font files should be installed. In the unlikely case that a new -font directory needs to be added, this can be done with the following syntax: - - /usr/local/share/fonts/ - -Another useful option is the ability to disable anti-aliasing (font smooth- -ing) for selected fonts. This can be done with the following syntax: - - - - Lucida Console - - - false - - - -Anti-aliasing can be disabled for all fonts by the following incantation: - - - - false - - - -Xft supports sub-pixel rasterisation on LCD displays. X11R6.9 should auto- -matically enable this feature on laptops and when using an LCD monitor con- -nected with a DVI cable; you can check whether this was done by typing - - $ xdpyinfo -ext RENDER | grep sub-pixel - -If this doesn't print anything, you will need to configure Render for your -particular LCD hardware manually; this is done with the following syntax: - - - - rgb - - - -The string `rgb' within the `'...`' specifies the order of -pixel components on your display, and should be changed to match your hard- -ware; it can be one of `rgb (normal LCD screen), `bgr' (backwards LCD -screen), `vrgb' (LCD screen rotated clockwise) or `vbgr' (LCD screen rotated -counterclockwise). - -2.1.3 Configuring applications - -Because most current applications use the core fonts system by default, it is -necessary to explicitly configure them to use Xft. How this is done depends -on the application. - -XTerm can be set to use Xft by using the `-fa' command line option or by set- -ting the `XTerm*faceName' resource: - - XTerm*faceName: Courier - -or - - $ xterm -fa "Courier" - -For applications based on GTK+ 2.0 (including GNOME 2 applications), the -environment variable `GDK_USE_XFT' should be set to `1': - - $ export GDK_USE_XFT=1 - -GTK+ 2.2 uses Xft by default. - -For KDE applications, you should select ``Anti-alias fonts'' in the ``Fonts'' -panel of KDE's ``Control Center''. Note that this option is misnamed: it -switches KDE to using Xft but doesn't enable anti-aliasing in case it was -disabled by your Xft configuration file. - -(What about Mozilla?) - -2.1.4 Troubleshooting - -If some Xft-based applications don't seem to notice the changes you are mak- -ing to your configuration files, they may be linked against an old version of -Xft. In order to fix the problem, you should relink them against a current -version of Xft; on most systems, it is enough to install the current version -of the Xft and Fontconfig libraries. - -If, for some reason, you cannot upgrade the shared libraries, please check -the Xft(3) manual page included with XFree86 4.2 for the configuration mecha- -nisms of the previous version of Xft. - -2.2 Configuring the core X11 fonts system - -Installing fonts in the core system is a two step process. First, you need -to create a font directory that contains all the relevant font files as well -as some index files. You then need to inform the X server of the existence -of this new directory by including it in the font path. - -2.2.1 Installing bitmap fonts - -The X11R6.9 server can use bitmap fonts in both the cross-platform BDF format -and the somewhat more efficient binary PCF format. (X11R6.9 also supports -the obsolete SNF format.) - -Bitmap fonts are normally distributed in the BDF format. Before installing -such fonts, it is desirable (but not absolutely necessary) to convert the -font files to the PCF format. This is done by using the command `bdftopcf', -e.g. - - $ bdftopcf courier12.bdf - -You will then want to compress the resulting PCF font files: - - $ gzip courier12.pcf - -After the fonts have been converted, you should copy all the font files that -you wish to make available into a arbitrary directory, say -`/usr/local/share/fonts/bitmap/'. You should then create the index file -`fonts.dir' by running the command `mkfontdir' (please see the mkfontdir(1) -manual page for more information): - - $ mkdir /usr/local/share/fonts/bitmap/ - $ cp *.pcf.gz /usr/local/share/fonts/bitmap/ - $ mkfontdir /usr/local/share/fonts/bitmap/ - -All that remains is to tell the X server about the existence of the new font -directory; see Setting the server font path (section 2.2.4, page 1) below. - -2.2.2 Installing scalable fonts - -The X11R6.9 server supports scalable fonts in three formats: Type 1, TrueType -and CIDFont. This section only applies to the first two; for information on -CIDFonts, please see Installing CIDFonts (section 2.2.3, page 1) later in -this document. Previous versions also included support for the Speedo scal- -able font format, but that is disabled in the default builds of X11R6.9 and -not included in X11R7.0 and later releases. - -Installing scalable fonts is very similar to installing bitmap fonts: you -create a directory with the font files, and run `mkfontdir' to create an -index file called `fonts.dir'. - -There is, however, a big difference: `mkfontdir' cannot automatically recog- -nise scalable font files. For that reason, you must first index all the font -files in a file called `fonts.scale'. While this can be done by hand, it is -best done by using the `mkfontscale' utility. - - $ mkfontscale /usr/local/share/fonts/Type1/ - $ mkfontdir /usr/local/share/fonts/Type1/ - -Under some circumstances, it may be necessary to modify the `fonts.scale' -file generated by mkfontscale; for more information, please see the mkfont- -dir(1) and mkfontscale(1) manual pages and Core fonts and internationalisa- -tion (section 4.1, page 1) later in this document. - -2.2.3 Installing CID-keyed fonts - -The CID-keyed font format was designed by Adobe Systems for fonts with large -character sets. A CID-keyed font, or CIDFont for short, contains a collec- -tion of glyphs indexed by character ID (CID). - -In order to map such glyphs to meaningful indices, Adobe provide a set of -CMap files. The PostScript name of a font generated from a CIDFont consists -of the name of the CIDFont and the name of the CMap separated by two dashes. -For example, the font generated from the CIDFont `Munhwa-Regular' using the -CMap `UniKS-UCS2-H' is called - - Munhwa-Regular--UniKS-UCS2-H - -The CIDFont code in X11R6.9 requires a very rigid directory structure. The -main directory must be called `CID' (its location defaults to -`/usr/X11R6/lib/X11/fonts/CID' but it may be located anywhere), and it should -contain a subdirectory for every CID collection. Every subdirectory must -contain subdirectories called CIDFont (containing the actual CIDFont files), -CMap (containing all the needed CMaps), AFM (containing the font metric -files) and CFM (initially empty). For example, in the case of the font -Munhwa-Regular that uses the CID collection Adobe-Korea1-0, the directory -structure should be as follows: - - CID/Adobe-Korea1/CIDFont/Munhwa-Regular - CID/Adobe-Korea1/CMap/UniKS-UCS2-H - CID/Adobe-Korea1/AFM/Munhwa-Regular.afm - CID/Adobe-Korea1/CFM/ - CID/fonts.dir - CID/fonts.scale - -After creating this directory structure and copying the relevant files, you -should create a `fonts.scale' file. This file has the same format as in the -case of (non-CID) scalable fonts, except that its first column contains -PostScript font names with the extension `.cid' appended rather than actual -filenames: - - 1 - Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \ - -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1 - -(both names on the same line). Running `mkfontdir' creates the `fonts.dir' -file: - - $ cd /usr/local/share/fonts/CID - $ mkfontdir - -Finally, you should create the font metrics summary files in the directory -`CFM' by running the command `mkcfm': - - $ mkcfm /usr/local/share/fonts/CID - -If no CFM files are available, the server will still be able to use the CID -fonts but querying them will take a long time. You should run `mkcfm' again -whenever a change is made to any of the CID-keyed fonts, or when the CID- -keyed fonts are copied to a machine with a different architecture. - -2.2.4 Setting the server's font path - -The list of directories where the server looks for fonts is known as the font -path. Informing the server of the existence of a new font directory consists -of putting it on the font path. - -The font path is an ordered list; if a client's request matches multiple -fonts, the first one in the font path is the one that gets used. When match- -ing fonts, the server makes two passes over the font path: during the first -pass, it searches for an exact match; during the second, it searches for -fonts suitable for scaling. - -For best results, scalable fonts should appear in the font path before the -bitmap fonts; this way, the server will prefer bitmap fonts to scalable fonts -when an exact match is possible, but will avoid scaling bitmap fonts when a -scalable font can be used. (The `:unscaled' hack, while still supported, -should no longer be necessary in X11R6.9.) - -You may check the font path of the running server by typing the command - - $ xset q - -2.2.4.1 Temporary modification of the font path - -The `xset' utility may be used to modify the font path for the current ses- -sion. The font path is set with the command xset fp; a new element is added -to the front with xset +fp, and added to the end with xset fp+. For example, - - $ xset +fp /usr/local/fonts/Type1 - $ xset fp+ /usr/local/fonts/bitmap - -Conversely, an element may be removed from the front of the font path with -`xset -fp', and removed from the end with `xset fp-'. You may reset the font -path to its default value with `xset fp default'. - -For more information, please consult the xset(1) manual page. - -2.2.4.2 Permanent modification of the font path - -The default font path (the one used just after server startup or after `xset -fp default') is specified in the X server's `xorg.conf' file. It is computed -by appending all the directories mentioned in the `FontPath' entries of the -`Files' section in the order in which they appear. - - FontPath "/usr/local/fonts/Type1" - ... - FontPath "/usr/local/fonts/bitmap" - -For more information, please consult the xorg.conf(5) manual page. - -2.2.5 Troubleshooting - -If you seem to be unable to use some of the fonts you have installed, the -first thing to check is that the `fonts.dir' files are correct and that they -are readable by the server (the X server usually runs as root, beware of NFS- -mounted font directories). If this doesn't help, it is quite possible that -you are trying to use a font in a format that is not supported by your -server. - -X11R6.9 supports the BDF, PCF, SNF, Type 1, TrueType, OpenType and CIDFont -font formats. However, not all X11R6.9 servers come with all the font back- -ends configured in. - -On most platforms, the X11R6.9 servers are modular: the font backends are -included in modules that are loaded at runtime. The modules to be loaded are -specified in the `xorg.conf' file using the `Load' directive: - - Load "type1" - -If you have trouble installing fonts in a specific format, you may want to -check the server's log file in order to see whether the relevant modules are -properly loaded. The list of font modules distributed with X11R6.9 is as -follows: - - o "bitmap": bitmap fonts (`*.bdf', `*.pcf' and `*.snf'); - - o "freetype": TrueType fonts (`*.ttf' and `*.ttc'), OpenType fonts - (`*.otf' and `*.otc') and Type 1 fonts (`*.pfa' and `*.pfb'); - - o "type1": alternate Type 1 backend (`*.pfa' and `*.pfb') and CIDFont - backend; - - o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc'). - -Please note that the argument of the `Load' directive is case-sensitive. - -3. Fonts included with X11R6.9 - -3.1 Standard bitmap fonts - -The Sample Implementation of X11 (SI) comes with a large number of bitmap -fonts, including the `fixed' family, and bitmap versions of Courier, Times, -Helvetica and some members of the Lucida family. In the SI, these fonts are -provided in the ISO 8859-1 encoding (ISO Latin Western-European). - -In X11R6.9, a number of these fonts are provided in Unicode-encoded font -files instead. At build time, these fonts are split into font files encoded -according to legacy encodings, a process which allows us to provide the stan- -dard fonts in a number of regional encodings with no duplication of work. - -For example, the font file - - /usr/X11R6/lib/X11/fonts/misc/6x13.bdf - -with XLFD - - -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1 - -is a Unicode-encoded version of the standard `fixed' font with added support -for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA and other scripts -plus numerous technical symbols. It contains over 2800 glyphs, covering all -characters of ISO 8859 parts 1-5, 7-10, 13-15, as well as all European IBM -and Microsoft code pages, KOI8, WGL4, and the repertoires of many other char- -acter sets. - -This font is used at build time for generating the font files - - 6x13-ISO8859-1.bdf - 6x13-ISO8859-2.bdf - ... - 6x13-ISO8859-15.bdf - 6x13-KOI8-R.bdf - -with respective XLFDs - - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1 - ... - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15 - -misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r - -The standard short name `fixed' is normally an alias for - - -misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1 - -3.2 The ClearlyU Unicode font family - -The ClearlyU family of fonts provides a set of 12 pt, 100 dpi proportional -fonts with many of the glyphs needed for Unicode text. Together, the fonts -contain approximately 7500 glyphs. - -The main ClearlyU font has the XLFD - - -mutt-clearlyu-medium-r-normal--17-120-100-100-p-101-iso10646-1 - -and resides in the font file - - /usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz - -Additional ClearlyU fonts include - - -mutt-clearlyu alternate glyphs-medium-r-normal--17-120-100-100-p-91-iso10646-1 - -mutt-clearlyu pua-medium-r-normal--17-120-100-100-p-111-iso10646-1 - -mutt-clearlyu arabic extra-medium-r-normal--17-120-100-100-p-103-fontspecific-0 - -mutt-clearlyu ligature-medium-r-normal--17-120-100-100-p-141-fontspecific-0 - -The Alternate Glyphs font contains additional glyph shapes that are needed -for certain languages. A second alternate glyph font will be provided later -for cases where a character has more than one commonly used alternate shape -(e.g. the Urdu heh). - -The PUA font contains extra glyphs that are useful for certain rendering pur- -poses. - -The Arabic Extra font contains the glyphs necessary for characters that don't -have all of their possible shapes encoded in ISO 10646. The glyphs are -roughly ordered according to the order of the characters in the ISO 10646 -standard. - -The Ligature font contains ligatures for various scripts that may be useful -for improved presentation of text. - -3.3 Standard scalable fonts - -X11R6.9 includes all the scalable fonts distributed with X11R6. - -3.3.1 Standard Type 1 fonts - -The IBM Courier set of fonts cover ISO 8859-1 and ISO 8859-2 as well as Adobe -Standard Encoding. These fonts have XLFD - - -adobe-courier-medium-*-*--0-0-0-0-m-0-*-* - -and reside in the font files - - /usr/X11R6/lib/X11/fonts/Type1/cour*.pfa - -The Adobe Utopia set of fonts only cover ISO 8859-1 as well as Adobe Standard -Encoding. These fonts have XLFD - - -adobe-utopia-*-*-normal--0-0-0-0-p-0-iso8859-1 - -and reside in the font files - - /usr/X11R6/lib/X11/fonts/Type1/UT*.pfa - -Finally, X11R6.9 also comes with Type 1 versions of Bitstream Courier and -Charter. These fonts have XLFD - - -bitstream-courier-*-*-normal--0-0-0-0-m-0-iso8859-1 - -bitstream-charter-*-*-normal--0-0-0-0-p-0-iso8859-1 - -and reside in the font files - - /usr/X11R6/lib/X11/fonts/Type1/c*bt_.pfb - -3.4 The Bigelow & Holmes Luxi family - -X11R6.9 includes the Luxi family of scalable fonts, in both TrueType and -Type 1 format. This family consists of the fonts Luxi Serif, with XLFD - - -b&h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-* - -Luxi Sans, with XLFD - - -b&h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-* - -and Luxi Mono, with XLFD - - -b&h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-* - -Each of these fonts comes Roman, oblique, bold and bold oblique variants The -TrueType version have glyphs covering the basic ASCII Unicode range, the -Latin 1 range, as well as the Extended Latin range and some additional punc- -tuation characters. In particular, these fonts include all the glyphs needed -for ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the -Adobe Standard encoding and the Windows 3.1 character set. - -The glyph coverage of the Type 1 versions is somewhat reduced, and only cov- -ers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding. - -The Luxi fonts are original designs by Kris Holmes and Charles Bigelow. Luxi -fonts include seriffed, sans serif, and monospaced styles, in roman and -oblique, and normal and bold weights. The fonts share stem weight, x-height, -capital height, ascent and descent, for graphical harmony. - -The character width metrics of Luxi roman and bold fonts match those of core -fonts bundled with popular operating and window systems. - -The license terms for the Luxi fonts are included in the file `COPYRIGHT.BH', -as well as in the License document. - -Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc. developed the -Luxi typeface designs in Ikarus digital format. - -URW++ Design and Development GmbH converted the Ikarus format fonts to True- -Type and Type1 font programs and implemented the grid-fitting "hints" and -kerning tables in the Luxi fonts. - -For more information, please contact or -, or consult the URW++ web site . - -An earlier version of the Luxi fonts was made available under the name -Lucidux. This name should no longer be used due to trademark uncertainties, -and all traces of the Lucidux name have been removed from X11R6.9. - -4. More about core fonts - -This section describes X11R6.9-specific enhancements to the core X11 fonts -system. - -4.1 Core fonts and internationalisation - -The scalable font backends (Type 1 and TrueType) can automatically re-encode -fonts to the encoding specified in the XLFD in `fonts.dir'. For example, a -`fonts.dir' file can contain entries for the Type 1 Courier font such as - - cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 - cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-2 - -which will lead to the font being recoded to ISO 8859-1 and ISO 8859-2 -respectively. - -4.1.1 The fontenc layer - -Two of the scalable backends (Type 1 and the FreeType TrueType backend) use a -common fontenc layer for font re-encoding. This allows these backends to -share their encoding data, and allows simple configuration of new locales -independently of font type. - -Please note: the X-TrueType (X-TT) backend is not included in X11R6.9. That -functionality has been merged into the FreeType backend.> - -In the fontenc layer, an encoding is defined by a name (such as iso8859-1), -possibly a number of aliases (alternate names), and an ordered collection of -mappings. A mapping defines the way the encoding can be mapped into one of -the target encodings known to fontenc; currently, these consist of Unicode, -Adobe glyph names, and arbitrary TrueType ``cmap''s. - -A number of encodings are hardwired into fontenc, and are therefore always -available; the hardcoded encodings cannot easily be redefined. These -include: - - o iso10646-1: Unicode; - - o iso8859-1: ISO Latin-1 (Western Europe); - - o iso8859-2: ISO Latin-2 (Eastern Europe); - - o iso8859-3: ISO Latin-3 (Southern Europe); - - o iso8859-4: ISO Latin-4 (Northern Europe); - - o iso8859-5: ISO Cyrillic; - - o iso8859-6: ISO Arabic; - - o iso8859-7: ISO Greek; - - o iso8859-8: ISO Hebrew; - - o iso8859-9: ISO Latin-5 (Turkish); - - o iso8859-10: ISO Latin-6 (Nordic); - - o iso8859-15: ISO Latin-9, or Latin-0 (Revised Western-European); - - o koi8-r: KOI8 Russian; - - o koi8-u: KOI8 Ukrainian (see RFC 2319); - - o koi8-ru: KOI8 Russian/Ukrainian; - - o koi8-uni: KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian); - - o koi8-e: KOI8 ``European,'' ISO-IR-111, or ECMA-Cyrillic; - - o microsoft-symbol and apple-roman: these are only likely to be useful - with TrueType symbol fonts. - -Additional encodings can be added by defining encoding files. When a font -encoding is requested that the fontenc layer doesn't know about, the backend -checks the directory in which the font file resides (not necessarily the -directory with fonts.dir!) for a file named `encodings.dir'. If found, this -file is scanned for the requested encoding, and the relevant encoding defini- -tion file is read in. The `mkfontdir' utility, when invoked with the `-e' -option followed by the name of a directory containing encoding files, can be -used to automatically build `encodings.dir' files. Please see the mkfont- -dir(1) manual page for more details. - -A number of encoding files for common encodings are included with X11R6.9. -Information on writing new encoding files can be found in Format of encodings -directory files (section 4.1.3, page 1) and Format of encoding files (section -4.1.4, page 1) later in this document. - -4.1.2 Backend-specific notes about fontenc - -4.1.2.1 The FreeType backend - -For TrueType and OpenType fonts, the FreeType backend scans the mappings in -order. Mappings with a target of PostScript are ignored; mappings with a -TrueType or Unicode target are checked against all the cmaps in the file. -The first applicable mapping is used. - -For Type 1 fonts, the FreeType backend first searches for a mapping with a -target of PostScript. If one is found, it is used. Otherwise, the backend -searches for a mapping with target Unicode, which is then composed with a -built-in table mapping codes to glyph names. Note that this table only cov- -ers part of the Unicode code points that have been assigned names by Adobe. - -Specifying an encoding value of adobe-fontspecific for a Type 1 font disables -the encoding mechanism. This is useful with symbol and incorrectly encoded -fonts (see Incorrectly encoded fonts (section 4.1.6, page 1) below). - -If a suitable mapping is not found, the FreeType backend defaults to -ISO 8859-1. - -4.1.2.2 Type 1 - -The Type 1 backend behaves similarly to the FreeType backend with Type 1 -fonts, except that it limits all encodings to 8-bit codes. - -4.1.3 Format of encoding directory files - -In order to use a font in an encoding that the font backend does not know -about, you need to have an `encodings.dir' file either in the same directory -as the font file used or in a system-wide location -(`/usr/X11R6/lib/X11/fonts/encodings/' by default). - -The `encodings.dir' file has a similar format to `fonts.dir'. Its first line -specifies the number of encodings, while every successive line has two -columns, the name of the encoding, and the name of the encoding file; this -can be relative to the current directory, or absolute. Every encoding name -should agree with the encoding name defined in the encoding file. For exam- -ple, - - 3 - mulearabic-0 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-0.enc - mulearabic-1 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-1.enc - mulearabic-2 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-2.enc - -The name of an encoding must be specified in the encoding file's `STARTENCOD- -ING' or `ALIAS' line. It is not enough to create an `encodings.dir' entry. - -If your platform supports it (it probably does), encoding files may be com- -pressed or gzipped. - -The `encoding.dir' files are best maintained by the `mkfontdir' utility. -Please see the mkfontdir(1) manual page for more information. - -4.1.4 Format of encoding files - -The encoding files are ``free form,'' i.e. any string of whitespace is equiv- -alent to a single space. Keywords are parsed in a non-case-sensitive manner, -meaning that `size', `SIZE', and `SiZE' all parse as the same keyword; on the -other hand, case is significant in glyph names. - -Numbers can be written in decimal, as in `256', in hexadecimal, as in -`0x100', or in octal, as in `0400'. - -Comments are introduced by a hash sign `#'. A `#' may appear at any point in -a line, and all characters following the `#' are ignored, up to the end of -the line. - -The encoding file starts with the definition of the name of the encoding, and -possibly its alternate names (aliases): - - STARTENCODING mulearabic-0 - ALIAS arabic-0 - -The name of the encoding and its aliases should be suitable for use in an -XLFD font name, and therefore contain exactly one dash `-'. - -The encoding file may then optionally declare the size of the encoding. For -a linear encoding (such as ISO 8859-1), the SIZE line specifies the maximum -code plus one: - - SIZE 0x2B - -For a matrix encoding, it should specify two numbers. The first is the num- -ber of the last row plus one, the other, the highest column number plus one. -In the case of `jisx0208.1990-0' (JIS X 0208(1990), double-byte encoding, -high bit clear), it should be - - SIZE 0x75 0x80 - -In the case of a matrix encoding, a `FIRSTINDEX' line may be included to -specify the minimum glyph index in an encoding. The keyword `FIRSTINDEX' is -followed by two integers, the minimum row number followed by the minimum col- -umn number: - - FIRSTINDEX 0x20 0x20 - -In the case of a linear encoding, a `FIRSTINDEX' line is not very useful. If -for some reason however you chose to include on, it should be followed by a -single integer. - -Note that in most font backends inclusion of a `FIRSTINDEX' line has the side -effect of disabling default glyph generation, and this keyword should there- -fore be avoided unless absolutely necessary. - -Codes outside the region defined by the `SIZE' and `FIRSTINDEX' lines are -understood to be undefined. Encodings default to linear encoding with a size -of 256 (0x100). This means that you must declare the size of all 16 bit -encodings. - -What follows is one or more mapping sections. A mapping section starts with -a `STARTMAPPING' line stating the target of the mapping. The target may be -one of: - - o Unicode (ISO 10646): - - STARTMAPPING unicode - - o a given TrueType ``cmap'': - - STARTMAPPING cmap 3 1 - - o PostScript glyph names: - - STARTMAPPING postscript - -Every line in a mapping section maps one from the encoding being defined to -the target of the mapping. In mappings with a Unicode or TrueType mapping, -codes are mapped to codes: - - 0x21 0x0660 - 0x22 0x0661 - ... - -As an abbreviation, it is possible to map a contiguous range of codes in a -single line. A line consisting of three integers - - ) and has the X-TT functionalities for CJKV -support provided by the After X-TT Project (see the After X-TT Project web -site ). The FreeType module has support for -the ``fontenc'' style of internationalisation (see The fontenc layer (section -4.1.1, page 1)). This backend supports TrueType font files (`*.ttf'), Open- -Type font files (`*.otf'), TrueType Collections (`*.ttc'), OpenType Collec- -tions (`*.otc') and Type 1 font files (`*.pfa' and `*.pfb'). - -In order to access the faces in a TrueType Collection file, the face number -must be specified in the fonts.dir file before the filename, within a pair of -colons, or by setting the 'fn' TTCap option. For example, - - :1:mincho.ttc -misc-pmincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0 - -refers to face 1 in the `mincho.ttc' TrueType Collection file. - -The new FreeType backend supports the extended `fonts.dir' syntax introduced -by X-TrueType with a number of options, collectively known as `TTCap'. A -`TTCap' entry follows the general syntax - - option=value: - -and should be specified before the filename. The new FreeType almost per- -fectly supports TTCap options that are compatible with X-TT 1.4. The Auto- -matic Italic (`ai'), Double Strike (`ds') and Bounding box Width (`bw') -options are indispensable in CJKV. For example, - - mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0 - ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0208.1990-0 - ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0208.1990-0 - ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0208.1990-0 - bw=0.5:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0 - bw=0.5:ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0201.1976-0 - bw=0.5:ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0201.1976-0 - bw=0.5:ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0201.1976-0 - -setup the complete combination of jisx0208 and jisx0201 using mincho.ttc -only. More information on the TTCap syntax is found on the After X-TT Pro- -ject page . - -The FreeType backend uses the fontenc layer in order to support recoding of -fonts; this was described in The fontenc layer (section 4.1.1, page 1) and -especially FreeType-specific notes about fontenc (section 4.1.2.1, page 1) -earlier in this document. - -4.2.2 About the X-TrueType TrueType backend - -The `X-TrueType' backend is a backend based on version 1 of the FreeType -library. X-TrueType doesn't use the `fontenc' layer for managing font encod- -ings, but instead uses its own database of encodings. - -Since the functionalities for CJKV support introduced by X-TT have been -merged into the new FreeType backend, the X-TT backend will be removed from -X11R6.9's tree near the future. Therefore, the use of FreeType backend is -preferred over the X-TT backend. - -General information on X-TrueType may be found at the After X-TT Project page -. - -4.2.3 Delayed glyph rasterisation - -When loading a proportional fonts which contain a huge number of glyphs, the -old FreeType delayed glyph rasterisation until the time at which the glyph -was first used. The new FreeType (libfreetype-xtt2) has an improved `very -lazy' metric calculation method to speed up the process when loading TrueType -or OpenType fonts. Although the X-TT module also has this method, the -"vl=y" TTCap option must be set if you want to use it. This is the default -method for FreeType when it loads multi-byte fonts. Even if you use a uni- -code font which has tens of thousands of glyphs, this delay will not be wor- -risome as long as you use the new FreeType backend -- its `very lazy' method -is super-fast. - -The maximum error of bitmap position using `very lazy' method is 1 pixel, and -is the same as that of a character-cell spacing. When the X-TT backend is -used with the `vl=y' option, a chipped bitmap is displayed with certain -fonts. However, the new FreeType backend has minimal problem with this, -since it corrects left- and right-side bearings using `italicAngle' in the -TrueType/OpenType post table, and does automatic correction of bitmap posi- -tions when rasterisation so that chipped bitmaps are not displayed. Never- -theless if you don't want to use the `very lazy' method when using multi- -bytes fonts, set `vl=n' in the TTCap option to disable it: - - vl=n:luxirr.ttf -b&h-Luxi Serif-medium-r-normal--0-0-0-0-p-0-iso10646-1 - -Of course, both backends also support an optimisation for character-cell -fonts (fonts with all glyph metrics equal, or terminal fonts). A font with -an XLFD specifying a character-cell spacing `c', as in - - -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0 - -or - - fs=c:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0 - -will not compute the metric for each glyph, but instead trust the font to be -a character-cell font. You are encouraged to make use of this optimisation -when useful, but be warned that not all monospaced fonts are character-cell -fonts. - -5. Appendix: background and terminology - -5.1 Characters and glyphs - -A computer text-processing system inputs keystrokes and outputs glyphs, small -pictures that are assembled on paper or on a computer screen. Keystrokes and -glyphs do not, in general, coincide: for example, if the system does generate -ligatures, then to the sequence of two keystrokes will typically cor- -respond a single glyph. Similarly, if the system shapes Arabic glyphs in a -vaguely reasonable manner, then multiple different glyphs may correspond to a -single keystroke. - -The complex transformation rules from keystrokes to glyphs are usually fac- -tored into two simpler transformations, from keystrokes to characters and -from characters to glyphs. You may want to think of characters as the basic -unit of text that is stored e.g. in the buffer of your text editor. While -the definition of a character is intrinsically application-specific, a number -of standardised collections of characters have been defined. - -A coded character set is a set of characters together with a mapping from -integer codes --- known as codepoints --- to characters. Examples of coded -character sets include US-ASCII, ISO 8859-1, KOI8-R, and JIS X 0208(1990). - -A coded character set need not use 8 bit integers to index characters. Many -early systems used 6 bit character sets, while 16 bit (or more) character -sets are necessary for ideographic writing systems. - -5.2 Font files, fonts, and XLFD - -Traditionally, typographers speak about typefaces and founts. A typeface is -a particular style or design, such as Times Italic, while a fount is a -molten-lead incarnation of a given typeface at a given size. - -Digital fonts come in font files. A font file contains the information nec- -essary for generating glyphs of a given typeface, and applications using font -files may access glyph information in an arbitrary order. - -Digital fonts may consist of bitmap data, in which case they are said to be -bitmap fonts. They may also consist of a mathematical description of glyph -shapes, in which case they are said to be scalable fonts. Common formats for -scalable font files are Type 1 (sometimes incorrectly called ATM fonts or -PostScript fonts), TrueType and OpenType. - -The glyph data in a digital font needs to be indexed somehow. How this is -done depends on the font file format. In the case of Type 1 fonts, glyphs -are identified by glyph names. In the case of TrueType fonts, glyphs are -indexed by integers corresponding to one of a number of indexing schemes -(usually Unicode --- see below). - -The X11 core fonts system uses the data in a font file to generate font -instances, which are collections of glyphs at a given size indexed according -to a given encoding. - -X11 core font instances are usually specified using a notation known as the X -Logical Font Description (XLFD). An XLFD starts with a dash `-', and con- -sists of fourteen fields separated by dashes, for example: - - -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1 - -Or particular interest are the last two fields `iso8859-1', which specify the -font instance's encoding. - -A scalable font is specified by an XLFD which contains zeroes instead of some -fields: - - -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 - -X11 font instances may also be specified by short name. Unlike an XLFD, a -short name has no structure and is simply a conventional name for a font -instance. Two short names are of particular interest, as the server will not -start if font instances with these names cannot be opened. These are -`fixed', which specifies the fallback font to use when the requested font -cannot be opened, and `cursor', which specifies the set of glyphs to be used -by the mouse pointer. - -Short names are usually implemented as aliases to XLFDs; the standard `fixed' -and `cursor' aliases are defined in - - /usr/X11R6/lib/X11/font/misc/fonts.alias - -5.3 Unicode - -Unicode (urlnam ) is a coded character set with -the goal of uniquely identifying all characters for all scripts, current and -historical. While Unicode was explicitly not designed as a glyph encoding -scheme, it is often possible to use it as such. - -Unicode is an open character set, meaning that codepoint assignments may be -added to Unicode at any time (once specified, though, an assignment can never -be changed). For this reason, a Unicode font will be sparse, meaning that it -only defines glyphs for a subset of the character registry of Unicode. - -The Unicode standard is defined in parallel with the international standard -ISO 10646. Assignments in the two standards are always equivalent, and we -often use the terms Unicode and ISO 10646 interchangeably. - -When used in the X11 core fonts system, Unicode-encoded fonts should have the -last two fields of their XLFD set to `iso10646-1'. - -6. References - -X11R6.9 comes with extensive documentation in the form of manual pages and -typeset documents. Before installing fonts, you really should read the font- -config(3) and mkfontdir(1) manual pages; other manual pages of interest -include X(7), Xserver(1), xset(1), Xft(3), xlsfonts(1) and showfont(1). In -addition, you may want to read the X Logical Font Description document, by -Jim Flowers, which is provided in the file `xc/doc/xlfd.PS.Z'. - -The latest released version of the X11R6.9 documentation (including this doc- -ument and all manual pages) can be found from current X11R6.9 documentation -. - -The comp.fonts FAQ , which is -unfortunately no longer being maintained, contains a wealth of information -about digital fonts. - -Xft and Fontconfig are described on Keith Packard's Fontconfig site -. - -The xfsft home page -has been superseded by this document, and is now obsolete; you may however -still find some of the information that it contains useful. Joerg Pommnitz' -xfsft page is the -canonical source for the `ttmkfdir' utility, which is the ancestor of -mkfontscale. - -The author's software pages -might or might not contain related scribbles and development versions of -software. - -The documentation of X-TrueType is available from the After X-TT Project page -. - -A number of East-Asian CIDFonts are available from O'Reilly's FTP site -. - -While the Unicode consortium site may be of -interest, you are more likely to find what you need in Markus Kuhn's UTF-8 -and Unicode FAQ . - -The IANA RFC documents, available from a number of sites throughout the -world, often provide interesting information about character set issues; see -for example RFC 373. - - -$XdotOrg$ diff --git a/hw/xfree86/doc/devel/DebuggingHints b/hw/xfree86/doc/devel/DebuggingHints deleted file mode 100644 index 300fe4813..000000000 --- a/hw/xfree86/doc/devel/DebuggingHints +++ /dev/null @@ -1,192 +0,0 @@ - - Xserver Debugging - ================= - -This file is intended to collect helpful hints on Xserver debugging. -I merely outline my experiences here. Somebody else might have better -methods on doing it. This person is therefore invited to share this -experience with the rest of the world by adding it here. - -Paul Flinders has made some patches to gdb to add support for loadable -modules. This version of gdb is currently available as binary for -Linux/x86 on Paul's web site: - - www.dawa.demon.co.uk/xfree-gdb - -This web-site also contains the patches to gdb 4.18 so you may port it -to other platforms. - -It loads the module symbols and supports all gdb features like -breakpointing, disassembling and single stepping. It also shows the -exact location of a signal 11. Paul has fixed the code so that all of -this is working even if using modules compiled without -g. You can -find his latest version on his web site. - -If no module aware gdb is available the following hints might help: - -1. Use remote login. This can be done thru a network connection or - simply by connecting a serial console. This enables you to watch - the Xservers output while running set breakpoints with gdb etc. - Don't even try to run the Xserver from a system console. Whenever - something happens gdb waits for input. However the Xserver has - locked the system console including the keyboard, therefore you'll - never be able to send any input to gdb. Even if your process - doesn't crash or you haven't set any breakpoints a vt switch can be - hazardous: When doing vt switching a signal is sent; unless you did - - gdb> handle SIGUSR1 nostop - - gdb waits for you to continue the program which cannot happen as - you don't have access to gdb's console. - -2. You can compile any source file with debugging symbols to obtain - more information about where an error occurred. Simply go to the - directory which holds the corresponding object file and do: - - # rm .o - # xc/config/util/makeg.sh .o - - After relinking the server or module gdb is able to obtain the - necessary debugging information and will show the exact line in the - source where the error ccurred. See also: - xc/config/util/makeg.man. - -3. In some cases it might be useful to have the assembler output of a - compiled source file. This can be obtained by doing: - - # make .s - - or - - # xc/config/util/makeg.sh .s - - Make will use exactly the same rules it uses for building *.o files. - -4. In some cases it might be useful to set breakpoints in modules. If - no module aware gdb is available you should add a call to one of - the three dummy breakpoint functions - - xf86Break1(), xf86Break2() and xf86Break3() - - to the source file and recompile the module. You now just have to - set a breakpoint onto the appropriate dummy functions. These - functions are located in the core part of the server and therefore - will be available any time. - -5. Without module support gdb is not able to print the function where - an error occurred in a module. - - If you get a line like: - - (gdb) bt - #0 0x823b4f5 in ?? () - .... - - You may obtain the function the address belongs to by calling - LoaderPrintSymbol(): - - (gdb) call LoaderPrintSymbol(0x823b4f5) - - The symbol returned might not always be the name of the function - which contains the address. In case of static functions the symbol - is not known to the loader. However LoaderPrintSymbol() will print - the nearest known function and the offset from its start. You may - easily find the exact location of the address if you do: - - # objdump --disassemble .o - - .o is the name of the object file containing the symbol printed. - -6. Locating static symbols in modules is simpler if the module is a - single object file instead of a library. Such a object file can - easily be build from a library: # mkdir tmp # cd tmp; ar x - module-path/.a # ld -r *.o -o module-path/.o - - When calling LoaderPrintSymbol() the closes public symbol will be - printed together with the offset from the symbol's address. If a - static symbol comes before the first public symbol in a module The - following trick may help: - - create a file 1-.c in tmp/ - containing: - void Dummy-() {} - - Compile it: - - # gcc -c 1-.c - - and do the link step above. - - This way Dummy-() will be the first public function in the - module. All addresses in static function can now be printed - relatively to this address if no other public function comes before - this static one. - -7. In some situations it is quite helpful to add debugging symbols to - the binary. This can be done per object file. Simply remove the - object file and do - - # makeg - - When looking for a bug in a module these debugging infos can be - very helpful: Calling LoaderPrintSymbol() as described above will - return a function and an offset giving the exact location of the - address with respect to this function entry point. When - disassembling an object file with debugging symbols: # objdump -d - -l .o one will receive a disassembled output containing line - number information. Thus one can locate the exact line of code - where the error occurred. - -8. To quickly trace the value of a variable declared in a module three - dummy variables have been added to the core part: - - CARD32 xf86DummyVar1; - CARD32 xf86DummyVar2; - CARD32 xf86DummyVar3; - - The variable can be assigned to one of them. One can then use gdb - to return the value of this variable: - - gdb> p /x xf86DummyVar1 - -9. Sometimes it might be useful to check how the preprocessor replaced - symbols. One can obtain a preprocessed version of the source file - by doing: - - make .i - - This will generate a preprocessed source in .i. - -10. xfree() can catch if one tries to free a memory range twice. You - will get the message: - - Xalloc error: range already freed in Xrealloc() :-( - - To find the location from which xfree() was called one can - breakpoint on XfreeTrap(). The backtrace should show the origin of the - call this call. - -11. To access mapped physical memory the following functions might be - useful. - - These may be used to access physical memory that was mapped using - the flags VIDMEM_FRAMEBUFFER or VIDMEM_MMIO32: - - CARD8 xf86PeekFb8(CARD8 *p); - CARD16 xf86PeekFb16(CARD16 *p); - CARD32 xf86PeekFb32(CARD32 *p); - void xf86PokeFb8(CARD8 *p, CARD8 v); - void xf86PokeFb16(CARD16 *p, CARD16 v); - void xf86PokeFb32(CARD16 *p, CARD32 v); - - Physical memory which was mapped by setting VIDMEM_MMIO should be - accessed using the following. Here the base address to which the - memory is mapped and the offset are required separately. - - CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset); - CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset); - CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset); - void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v); - void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v); - void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v); - diff --git a/hw/xfree86/doc/devel/Makefile.am b/hw/xfree86/doc/devel/Makefile.am index 6ca350c38..eb8b1cb29 100644 --- a/hw/xfree86/doc/devel/Makefile.am +++ b/hw/xfree86/doc/devel/Makefile.am @@ -2,7 +2,6 @@ # not installed on the system for end-users EXTRA_DIST = \ - DebuggingHints \ Domain.note \ RAC.Notes \ Registry \ diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre index 405efda55..cf13c7eb8 100644 --- a/hw/xfree86/doc/man/Xorg.man.pre +++ b/hw/xfree86/doc/man/Xorg.man.pre @@ -30,7 +30,7 @@ SPARC and PowerPC. The most widely supported operating systems are the free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD, OpenBSD, and Solaris. Commercial UNIX operating systems such as UnixWare are also supported. Other supported operating systems include -LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the +GNU Hurd. Darwin and Mac OS X are supported with the XDarwin(__appmansuffix__) X server. Win32/Cygwin is supported with the XWin(__appmansuffix__) X server. .PP diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 8b66f89a6..13a597934 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -647,8 +647,7 @@ Note that the options and .B AllowClosedownGrabs will allow users to remove the grab used by screen saver/locker programs. -An API was written to such cases. -If you enable this option, make sure your screen saver/locker is updated. +Do not use them if you rely on the screen saver for security. Default: off. .TP 7 .BI "Option \*qHandleSpecialKeys\*q \*q" when \*q @@ -696,7 +695,8 @@ the X server to load. Disabled by default. .TP 7 .BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q If enabled, don't add the standard keyboard and mouse drivers, if there are no -input devices in the config file. Disabled by default. +input devices in the config file. Enabled by default if AutoAddDevices and +AutoEnableDevices is enabled, otherwise disabled. .TP 7 .BI "Option \*qAutoAddDevices\*q \*q" boolean \*q If this option is disabled, then no devices will be added from HAL events. diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 6029547bd..cad24ede2 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -2463,7 +2463,7 @@ DRIAdjustFrame(int scrnIndex, int x, int y, int flags) pScrn->frameY1 = pScrn->frameY0 + pDRIPriv->pSAREA->frame.height - 1; /* Fix up cursor */ - miPointerPosition(&px, &py); + miPointerGetPosition(inputInfo.pointer, &px, &py); if (px < pScrn->frameX0) px = pScrn->frameX0; if (px > pScrn->frameX1) px = pScrn->frameX1; if (py < pScrn->frameY0) py = pScrn->frameY0; diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c index 63ea8c56b..4a8d8f26a 100644 --- a/hw/xfree86/exa/examodule.c +++ b/hw/xfree86/exa/examodule.c @@ -179,13 +179,6 @@ exaDDXDriverInit(ScreenPtr pScreen) } -/*ARGSUSED*/ -static const OptionInfoRec * -EXAAvailableOptions(void *unused) -{ - return (EXAOptions); -} - static XF86ModuleVersionInfo exaVersRec = { "exa", diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c index 5cc83faa3..59832d6f9 100644 --- a/hw/xfree86/i2c/xf86i2c.c +++ b/hw/xfree86/i2c/xf86i2c.c @@ -35,12 +35,6 @@ #define I2C_TIMEOUT(x) /*(x)*/ /* Report timeouts */ #define I2C_TRACE(x) /*(x)*/ /* Report progress */ -/* Set which OSs have bad gettimeofday resolution. */ -#if defined(SVR4) && !defined(sun) -#define BAD_GETTIMEOFDAY_RESOLUTION -#endif - - /* This is the default I2CUDelay function if not supplied by the driver. * High level I2C interfaces implementing the bus protocol in hardware * should supply this function too. @@ -49,23 +43,6 @@ * All values 0 to 1e6 inclusive must be expected. */ -#ifdef BAD_GETTIMEOFDAY_RESOLUTION -/* - * This is temporary until a better, portable - * way is found. Adjust bogo_usec to match CPU speed. - */ -static int bogo_usec = 500; - -static void -I2CUDelay(I2CBusPtr b, int usec) -{ - volatile long i; - - if (usec > 0) - for (i = usec * bogo_usec; i > 0; i--) - /* (perhaps hw delay action) */; -} -#else static void I2CUDelay(I2CBusPtr b, int usec) { @@ -86,7 +63,6 @@ I2CUDelay(I2CBusPtr b, int usec) } while (diff>=0 && diff< (usec + 1)); } } -#endif /* Most drivers will register just with GetBits/PutBits functions. * The following functions implement a software I2C protocol diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c index 535978b89..f50607cfc 100644 --- a/hw/xfree86/int10/xf86int10.c +++ b/hw/xfree86/int10/xf86int10.c @@ -730,7 +730,7 @@ int1A_handler(xf86Int10InfoPtr pInt) return 1; case 0xb108: if ((dev = findPci(pInt, X86_EBX)) != NULL) { - pci_device_cfg_read_u8(dev, & X86_CL, X86_EDI); + pci_device_cfg_read_u8(dev, & X86_CL, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { @@ -743,7 +743,7 @@ int1A_handler(xf86Int10InfoPtr pInt) return 1; case 0xb109: if ((dev = findPci(pInt, X86_EBX)) != NULL) { - pci_device_cfg_read_u16(dev, & X86_CX, X86_EDI); + pci_device_cfg_read_u16(dev, & X86_CX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { @@ -756,7 +756,7 @@ int1A_handler(xf86Int10InfoPtr pInt) return 1; case 0xb10a: if ((dev = findPci(pInt, X86_EBX)) != NULL) { - pci_device_cfg_read_u32(dev, & X86_ECX, X86_EDI); + pci_device_cfg_read_u32(dev, & X86_ECX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { @@ -769,7 +769,7 @@ int1A_handler(xf86Int10InfoPtr pInt) return 1; case 0xb10b: if ((dev = findPci(pInt, X86_EBX)) != NULL) { - pci_device_cfg_write_u8(dev, X86_CL, X86_EDI); + pci_device_cfg_write_u8(dev, X86_CL, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { @@ -782,7 +782,7 @@ int1A_handler(xf86Int10InfoPtr pInt) return 1; case 0xb10c: if ((dev = findPci(pInt, X86_EBX)) != NULL) { - pci_device_cfg_write_u16(dev, X86_CX, X86_EDI); + pci_device_cfg_write_u16(dev, X86_CX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { @@ -795,7 +795,7 @@ int1A_handler(xf86Int10InfoPtr pInt) return 1; case 0xb10d: if ((dev = findPci(pInt, X86_EBX)) != NULL) { - pci_device_cfg_write_u32(dev, X86_ECX, X86_EDI); + pci_device_cfg_write_u32(dev, X86_ECX, X86_DI); X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { diff --git a/hw/xfree86/loader/Makefile.am b/hw/xfree86/loader/Makefile.am index ef9ab9ab3..62f90fbbc 100644 --- a/hw/xfree86/loader/Makefile.am +++ b/hw/xfree86/loader/Makefile.am @@ -23,12 +23,10 @@ libloader_a_SOURCES = \ loaderProcs.h \ loadext.c \ loadmod.c \ - loadfont.c \ dlloader.c \ os.c \ dixsym.c \ extsym.c \ - fontsym.c \ misym.c \ xf86sym.c \ sym.h \ diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index a2a239099..eb7988f64 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -57,7 +57,6 @@ #include "cursorstr.h" #include "dix.h" #include "dixevents.h" -#include "dixfont.h" #include "dixstruct.h" #include "misc.h" #include "globals.h" @@ -99,6 +98,7 @@ _X_HIDDEN void *dixLookupTab[] = { /* dix */ /* atom.c */ SYMFUNC(MakeAtom) + SYMFUNC(NameForAtom) SYMFUNC(ValidAtom) /* colormap.c */ SYMFUNC(AllocColor) @@ -147,11 +147,6 @@ _X_HIDDEN void *dixLookupTab[] = { SYMVAR(isItTimeToYield) SYMVAR(ClientStateCallback) SYMVAR(ServerGrabCallback) - /* dixfonts.c */ - SYMFUNC(CloseFont) - SYMFUNC(FontToXError) - SYMFUNC(LoadGlyphs) - SYMVAR(fpe_functions) /* dixutils.c */ SYMFUNC(AddCallback) SYMFUNC(ClientSleep) @@ -265,6 +260,9 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(dixRegisterPrivateInitFunc) SYMFUNC(dixRegisterPrivateDeleteFunc) SYMFUNC(dixAllocatePrivate) + SYMFUNC(dixLookupPrivate) + SYMFUNC(dixLookupPrivateAddr) + SYMFUNC(dixSetPrivate) SYMFUNC(dixFreePrivates) SYMFUNC(dixRegisterPrivateOffset) SYMFUNC(dixLookupPrivateOffset) @@ -358,9 +356,6 @@ _X_HIDDEN void *dixLookupTab[] = { #ifdef DPMSExtension SYMVAR(noDPMSExtension) #endif -#ifdef FONTCACHE - SYMVAR(noFontCacheExtension) -#endif #ifdef GLXEXT SYMVAR(noGlxExtension) #endif @@ -406,9 +401,6 @@ _X_HIDDEN void *dixLookupTab[] = { #ifdef XF86DRI SYMVAR(noXFree86DRIExtension) #endif -#ifdef XF86MISC - SYMVAR(noXFree86MiscExtension) -#endif #ifdef XF86VIDMODE SYMVAR(noXFree86VidModeExtension) #endif diff --git a/hw/xfree86/loader/dlloader.c b/hw/xfree86/loader/dlloader.c index 4caefd071..18dcb76c6 100644 --- a/hw/xfree86/loader/dlloader.c +++ b/hw/xfree86/loader/dlloader.c @@ -87,16 +87,15 @@ DLFindSymbolLocal(pointer module, const char *name) static const char symPrefix[] = DLSYM_PREFIX; - if (strlen(symPrefix)) { + if (sizeof(symPrefix) > 1) { n = malloc(strlen(symPrefix) + strlen(name) + 1); sprintf(n, "%s%s", symPrefix, name); - } else { - n = name; + name = n; } - p = dlsym(module, n); + p = dlsym(module, name); - if (strlen(symPrefix)) + if (sizeof(symPrefix) > 1) free(n); return p; diff --git a/hw/xfree86/loader/fontsym.c b/hw/xfree86/loader/fontsym.c deleted file mode 100644 index 82d4b1cf8..000000000 --- a/hw/xfree86/loader/fontsym.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1998-2002 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "sym.h" -#include -#include -#ifdef FONTENC_COMPATIBILITY -#include -#endif -#include -#include -#include -#include -#ifdef FONTCACHE -#define _FONTCACHE_SERVER_ -#include "fontcache.h" -#endif - -_X_HIDDEN void *fontLookupTab[] = { - - SYMFUNC(TwoByteSwap) - SYMFUNC(FourByteSwap) - SYMFUNC(FontCouldBeTerminal) - SYMFUNC(BufFileRead) - SYMFUNC(BufFileWrite) - SYMFUNC(CheckFSFormat) - SYMFUNC(FontFileOpen) - SYMFUNC(FontFilePriorityRegisterRenderer) - SYMFUNC(FontFileRegisterRenderer) - SYMFUNC(FontParseXLFDName) - SYMFUNC(FontFileCloseFont) - SYMFUNC(FontFileOpenBitmap) - SYMFUNC(FontFileCompleteXLFD) - SYMFUNC(FontFileCountDashes) - SYMFUNC(FontFileFindNameInDir) - SYMFUNC(FontFileClose) - SYMFUNC(FontComputeInfoAccelerators) - SYMFUNC(FontDefaultFormat) - SYMFUNC(NameForAtom) - SYMFUNC(BitOrderInvert) - SYMFUNC(FontFileMatchRenderer) - SYMFUNC(RepadBitmap) - SYMFUNC(FontEncName) - SYMFUNC(FontEncRecode) - SYMFUNC(FontEncFind) - SYMFUNC(FontMapFind) - SYMFUNC(FontEncMapFind) - SYMFUNC(FontEncFromXLFD) - SYMFUNC(FontEncDirectory) - SYMFUNC(FontMapReverse) - SYMFUNC(FontMapReverseFree) - SYMFUNC(CreateFontRec) - SYMFUNC(DestroyFontRec) - SYMFUNC(GetGlyphs) - SYMFUNC(QueryGlyphExtents) - - SYMVAR(FontFileBitmapSources) - -#ifdef FONTENC_COMPATIBILITY - /* Obsolete backwards compatibility symbols -- fontencc.c */ - SYMFUNC(font_encoding_from_xlfd) - SYMFUNC(font_encoding_find) - SYMFUNC(font_encoding_recode) - SYMFUNC(font_encoding_name) - SYMFUNC(identifyEncodingFile) -#endif - -#ifdef FONTCACHE - /* fontcache.c */ - SYMFUNC(FontCacheGetSettings) - SYMFUNC(FontCacheGetStatistics) - SYMFUNC(FontCacheChangeSettings) - SYMFUNC(FontCacheOpenCache) - SYMFUNC(FontCacheCloseCache) - SYMFUNC(FontCacheSearchEntry) - SYMFUNC(FontCacheGetEntry) - SYMFUNC(FontCacheInsertEntry) - SYMFUNC(FontCacheGetBitmap) -#endif -}; diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c index a00269b70..a5e89127f 100644 --- a/hw/xfree86/loader/loader.c +++ b/hw/xfree86/loader/loader.c @@ -63,7 +63,7 @@ #include #if defined(linux) && \ (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \ - || defined(__amd64__) || defined(__x86_64__)) + || defined(__amd64__)) #include #endif #include @@ -76,11 +76,6 @@ #include "compiler.h" #include "sym.h" -#if defined(Lynx) && defined(sun) -/* Cross build machine doesn;t have strerror() */ -#define strerror(err) "strerror unsupported" -#endif - /* * handles are used to identify files that are loaded. Even archives * are counted as a single file. @@ -113,8 +108,7 @@ LoaderInit(void) xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *) ((long)dixLookupTab ^ (long)extLookupTab - ^ (long)fontLookupTab ^ (long)miLookupTab - ^ (long)xfree86LookupTab)); + ^ (long)miLookupTab ^ (long)xfree86LookupTab)); xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n"); xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), @@ -128,9 +122,6 @@ LoaderInit(void) xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); - xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_FONT, - GET_ABI_MAJOR(LoaderVersionInfo.fontVersion), - GET_ABI_MINOR(LoaderVersionInfo.fontVersion)); LoaderGetOS(&osname, NULL, NULL, NULL); if (osname) @@ -363,6 +354,12 @@ LoaderSetOptions(unsigned long opts) LoaderOptions |= opts; } +_X_EXPORT Bool +LoaderShouldIgnoreABI(void) +{ + return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; +} + _X_EXPORT int LoaderGetABIVersion(const char *abiclass) { diff --git a/hw/xfree86/loader/loader.h b/hw/xfree86/loader/loader.h index 46d4c3ed3..ac5f99cf5 100644 --- a/hw/xfree86/loader/loader.h +++ b/hw/xfree86/loader/loader.h @@ -53,9 +53,6 @@ #ifndef _LOADER_H #define _LOADER_H -#if defined(Lynx) && defined(sun) -#define const /**/ -#endif #include #include #include diff --git a/hw/xfree86/loader/loaderProcs.h b/hw/xfree86/loader/loaderProcs.h index 9c73db3a6..827f3a92f 100644 --- a/hw/xfree86/loader/loaderProcs.h +++ b/hw/xfree86/loader/loaderProcs.h @@ -87,7 +87,6 @@ ModuleDescPtr LoadSubModuleLocal(ModuleDescPtr, const char *, pointer, const XF86ModReqInfo *, int *, int *); ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent); -void LoadFont(FontModule *); void UnloadModule(ModuleDescPtr); void UnloadSubModule(ModuleDescPtr); void UnloadDriver(ModuleDescPtr); diff --git a/hw/xfree86/loader/loadfont.c b/hw/xfree86/loader/loadfont.c deleted file mode 100644 index 94d31d6c1..000000000 --- a/hw/xfree86/loader/loadfont.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1998 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -/* Maybe this file belongs in lib/font/fontfile/module/ ? */ - -#define LOADERDECLARATIONS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "loaderProcs.h" -#include "misc.h" -#include "xf86.h" - -/* XXX this should be static, but xorgcfg needs it, nngh */ -FontModule *FontModuleList = NULL; -static int numFontModules = 0; - -static FontModule * -NewFontModule(void) -{ - FontModule *save = FontModuleList; - int n; - - /* Sanity check */ - if (!FontModuleList) - numFontModules = 0; - - n = numFontModules + 1; - FontModuleList = xrealloc(FontModuleList, (n + 1) * sizeof(FontModule)); - if (FontModuleList == NULL) { - FontModuleList = save; - return NULL; - } else { - numFontModules++; - FontModuleList[numFontModules].name = NULL; - return FontModuleList + (numFontModules - 1); - } -} - -_X_EXPORT void -LoadFont(FontModule * f) -{ - FontModule *newfont; - - if (f == NULL) - return; - - if (!(newfont = NewFontModule())) - return; - - xf86MsgVerb(X_INFO, 2, "Loading font %s\n", f->name); - - newfont->name = f->name; - newfont->initFunc = f->initFunc; - newfont->module = f->module; -} diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 04719a687..6031db756 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -198,7 +198,6 @@ LoaderSetPath(const char *path) /* Standard set of module subdirectories to search, in order of preference */ static const char *stdSubdirs[] = { "", - "fonts/", "input/", "drivers/", "multimedia/", diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c index aa712c03a..c7542288e 100644 --- a/hw/xfree86/loader/misym.c +++ b/hw/xfree86/loader/misym.c @@ -160,7 +160,6 @@ _X_HIDDEN void *miLookupTab[] = { SYMFUNC(miPutImage) SYMFUNC(miPushPixels) SYMFUNC(miPointerInitialize) - SYMFUNC(miPointerPosition) SYMFUNC(miRecolorCursor) SYMFUNC(miPointerWarpCursor) SYMFUNC(miDCInitialize) diff --git a/hw/xfree86/loader/os.c b/hw/xfree86/loader/os.c index 12cf3d859..9b3c9640e 100644 --- a/hw/xfree86/loader/os.c +++ b/hw/xfree86/loader/os.c @@ -48,8 +48,6 @@ #define OSNAME "netbsd" #elif defined(__OpenBSD__) #define OSNAME "openbsd" -#elif defined(Lynx) -#define OSNAME "lynxos" #elif defined(__GNU__) #define OSNAME "hurd" #elif defined(__SCO__) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 91ca4f71a..0d1b38cee 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -65,7 +65,6 @@ #include "xf86Parser.h" #include "xf86Config.h" # include "xf86Xinput.h" -#include "xf86OSmouse.h" #ifdef XV #include "xf86xv.h" #include "xf86xvmc.h" @@ -77,7 +76,6 @@ #include "dpmsproc.h" #endif #include "vidmodeproc.h" -#include "xf86miscproc.h" #include "loader.h" #include "xisb.h" #include "vbe.h" @@ -189,7 +187,7 @@ extern long __umodsi3(long, long); #include #endif -#if defined(__powerpc__) && (defined(Lynx) || defined(linux)) +#if defined(__powerpc__) && defined(linux) void _restf14(); void _restf17(); void _restf18(); @@ -278,7 +276,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86SerialModemSetBits) SYMFUNC(xf86SerialModemClearBits) SYMFUNC(xf86LoadKernelModule) - SYMFUNC(xf86OSMouseInit) SYMFUNC(xf86AgpGARTSupported) SYMFUNC(xf86GetAGPInfo) SYMFUNC(xf86AcquireGART) @@ -644,27 +641,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(VidModeGetGammaRampSize) #endif - /* xf86Versions.c */ - SYMFUNC(xf86GetBuiltinInterfaceVersion) - SYMFUNC(xf86RegisterBuiltinInterfaceVersion) - - /* xf86MiscExt.c */ -#ifdef XF86MISC - SYMFUNC(MiscExtGetMouseSettings) - SYMFUNC(MiscExtGetMouseValue) - SYMFUNC(MiscExtSetMouseValue) - SYMFUNC(MiscExtSetMouseDevice) - SYMFUNC(MiscExtGetKbdSettings) - SYMFUNC(MiscExtGetKbdValue) - SYMFUNC(MiscExtSetKbdValue) - SYMFUNC(MiscExtSetGrabKeysState) - SYMFUNC(MiscExtCreateStruct) - SYMFUNC(MiscExtDestroyStruct) - SYMFUNC(MiscExtApply) - SYMFUNC(MiscExtGetFilePaths) - SYMFUNC(MiscExtPassMessage) -#endif - /* Misc */ SYMFUNC(GetTimeInMillis) @@ -684,14 +660,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(DPMSSet) SYMFUNC(DPMSSupported) #endif -/* xf86Debug.c */ -#ifdef BUILDDEBUG - SYMFUNC(xf86Break1) - SYMFUNC(xf86Break2) - SYMFUNC(xf86Break3) - SYMFUNC(xf86SPTimestamp) - SYMFUNC(xf86STimestamp) -#endif SYMFUNC(pciTag) SYMFUNC(pciBusAddrToHostAddr) @@ -703,7 +671,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(LoaderErrorMsg) SYMFUNC(LoaderCheckUnresolved) SYMFUNC(LoadExtension) - SYMFUNC(LoadFont) SYMFUNC(LoaderReqSymbols) SYMFUNC(LoaderReqSymLists) SYMFUNC(LoaderRefSymbols) @@ -713,6 +680,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(LoaderListDirs) SYMFUNC(LoaderFreeDirList) SYMFUNC(LoaderGetOS) + SYMFUNC(LoaderShouldIgnoreABI) SYMFUNC(LoaderGetABIVersion) #ifdef XF86DRI @@ -786,7 +754,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(outb) SYMFUNC(outw) SYMFUNC(outl) -# if defined(NO_INLINE) || defined(Lynx) +# if defined(NO_INLINE) SYMFUNC(mem_barrier) SYMFUNC(ldl_u) SYMFUNC(eieio) @@ -801,34 +769,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(stw_u) SYMFUNC(write_mem_barrier) # endif -# if defined(Lynx) - SYMFUNC(_restf14) - SYMFUNC(_restf17) - SYMFUNC(_restf18) - SYMFUNC(_restf19) - SYMFUNC(_restf20) - SYMFUNC(_restf22) - SYMFUNC(_restf23) - SYMFUNC(_restf24) - SYMFUNC(_restf25) - SYMFUNC(_restf26) - SYMFUNC(_restf27) - SYMFUNC(_restf28) - SYMFUNC(_restf29) - SYMFUNC(_savef14) - SYMFUNC(_savef17) - SYMFUNC(_savef18) - SYMFUNC(_savef19) - SYMFUNC(_savef20) - SYMFUNC(_savef22) - SYMFUNC(_savef23) - SYMFUNC(_savef24) - SYMFUNC(_savef25) - SYMFUNC(_savef26) - SYMFUNC(_savef27) - SYMFUNC(_savef28) - SYMFUNC(_savef29) -# endif # if PPCIO_DEBUG SYMFUNC(debug_inb) SYMFUNC(debug_inw) @@ -839,39 +779,23 @@ _X_HIDDEN void *xfree86LookupTab[] = { # endif #endif #if defined(__GNUC__) -#if !defined(Lynx) SYMFUNC(__div64) -#endif -#if !defined(Lynx) /* FIXME: test on others than x86 and !3.1.0a/x86 */ SYMFUNC(__divdf3) -#endif SYMFUNC(__divdi3) -#if !defined(Lynx) SYMFUNC(__divsf3) SYMFUNC(__divsi3) -#endif SYMFUNC(__moddi3) -#if !defined(Lynx) SYMFUNC(__modsi3) -#endif -#if !defined(Lynx) SYMFUNC(__mul64) -#endif -#if !defined(Lynx) SYMFUNC(__muldf3) -#endif SYMFUNC(__muldi3) -#if !defined(Lynx) SYMFUNC(__mulsf3) SYMFUNC(__mulsi3) SYMFUNC(__udivdi3) SYMFUNC(__udivsi3) -#endif SYMFUNC(__umoddi3) -#if !defined(Lynx) SYMFUNC(__umodsi3) #endif -#endif #if defined(__ia64__) SYMFUNC(outw) SYMFUNC(outb) @@ -918,7 +842,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMVAR(res8514Exclusive) SYMVAR(res8514Shared) -#if defined(__powerpc__) && (!defined(NO_INLINE) || defined(Lynx)) +#if defined(__powerpc__) && !defined(NO_INLINE) SYMVAR(ioBase) #endif @@ -1007,6 +931,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86DoEDID_DDC2) SYMFUNC(xf86InterpretEDID) SYMFUNC(xf86PrintEDID) + SYMFUNC(xf86DoEEDID) SYMFUNC(xf86DDCMonitorSet) SYMFUNC(xf86SetDDCproperties) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index fd72053c7..a5a0a6392 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1006,6 +1006,54 @@ xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp, #define POSITION_UNSET -100000 +/* + * check if the user configured any outputs at all + * with either a position or a relative setting or a mode. + */ +static Bool +xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr *modes) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o; + Bool user_conf = FALSE; + + for (o = 0; o < config->num_output; o++) + { + xf86OutputPtr output = config->output[o]; + char *position; + char *relative_name; + OutputOpts relation; + int r; + static const OutputOpts relations[] = { + OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF + }; + + position = xf86GetOptValString (output->options, + OPTION_POSITION); + if (position) + user_conf = TRUE; + + relation = 0; + relative_name = NULL; + for (r = 0; r < 4; r++) + { + relation = relations[r]; + relative_name = xf86GetOptValString (output->options, + relation); + if (relative_name) + break; + } + if (relative_name) + user_conf = TRUE; + + modes[o] = xf86OutputHasUserPreferredMode(output); + if (modes[o]) + user_conf = TRUE; + } + + return user_conf; +} + static Bool xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) { @@ -1714,9 +1762,11 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) /* Set scrn->modes to the mode list for the 'compat' output */ scrn->modes = xf86DuplicateModes(scrn, output->probed_modes); - for (mode = scrn->modes; mode; mode = mode->next) - if (xf86ModesEqual (mode, &crtc->desiredMode)) - break; + if (crtc) { + for (mode = scrn->modes; mode; mode = mode->next) + if (xf86ModesEqual (mode, &crtc->desiredMode)) + break; + } if (scrn->modes != NULL) { /* For some reason, scrn->modes is circular, unlike the other mode @@ -1991,6 +2041,9 @@ xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, { int o; + if (xf86UserConfiguredOutputs(scrn, modes)) + return xf86TargetFallback(scrn, config, modes, enabled, width, height); + for (o = -1; nextEnabledOutput(config, enabled, &o); ) if (xf86OutputHasUserPreferredMode(config->output[o])) return @@ -2625,15 +2678,16 @@ xf86OutputGetEDIDModes (xf86OutputPtr output) return xf86DDCGetModes(scrn->scrnIndex, edid_mon); } +/* maybe we should care about DDC1? meh. */ _X_EXPORT xf86MonPtr xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) { ScrnInfoPtr scrn = output->scrn; xf86MonPtr mon; - mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus); + mon = xf86DoEEDID(scrn->scrnIndex, pDDCBus, TRUE); if (mon) - xf86DDCApplyQuirks (scrn->scrnIndex, mon); + xf86DDCApplyQuirks(scrn->scrnIndex, mon); return mon; } diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 3a9f3ff24..dd5ce6483 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -526,7 +526,6 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, _X_EXPORT void xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList) { - Bool mode_is_reduced = FALSE; DisplayModePtr mode; for (mode = modeList; mode != NULL; mode = mode->next) { @@ -682,7 +681,7 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor) _X_EXPORT DisplayModePtr xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) { - DisplayModePtr head = NULL, prev = NULL, mode; + DisplayModePtr head = NULL, mode; int i; for (i = 0; i < xf86NumDefaultModes; i++) diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 8f34032e0..6c93066c7 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -597,6 +597,10 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) } else { + int width, height, old_width, old_height; + void *shadowData; + PixmapPtr shadow; + PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, F(crtc->x), F(crtc->y)); PictureTransformIsInverse ("offset", &crtc_to_fb, &fb_to_crtc); @@ -605,12 +609,12 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) * matches the mode, not the pre-rotated copy in the * frame buffer */ - int width = mode->HDisplay; - int height = mode->VDisplay; - void *shadowData = crtc->rotatedData; - PixmapPtr shadow = crtc->rotatedPixmap; - int old_width = shadow ? shadow->drawable.width : 0; - int old_height = shadow ? shadow->drawable.height : 0; + width = mode->HDisplay; + height = mode->VDisplay; + shadowData = crtc->rotatedData; + shadow = crtc->rotatedPixmap; + old_width = shadow ? shadow->drawable.width : 0; + old_height = shadow ? shadow->drawable.height : 0; /* Allocate memory for rotation */ if (old_width != width || old_height != height) diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am index f9a82c68d..b521efe82 100644 --- a/hw/xfree86/os-support/Makefile.am +++ b/hw/xfree86/os-support/Makefile.am @@ -1,10 +1,9 @@ SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) -DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd +DIST_SUBDIRS = bsd bus misc linux solaris sysv sco hurd -sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h \ - assyntax.h xf86OSmouse.h +sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h assyntax.h -EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib +EXTRA_DIST = int10Defines.h xf86OSpriv.h # to get the grouping semantics right, you have to glom these three together # as one library, otherwise libtool will actively defeat your attempts to diff --git a/hw/xfree86/os-support/README.OS-lib b/hw/xfree86/os-support/README.OS-lib deleted file mode 100644 index e410906f9..000000000 --- a/hw/xfree86/os-support/README.OS-lib +++ /dev/null @@ -1,505 +0,0 @@ - - README for XFree86 OS-support Layer - ----------------------------------- - -Contents --------- - 1) Overview - 2) Directory Layout - 3) Adding a new OS - 4) OS Support API - -1 - Overview ------------- - This directory contains the OS support layer functions for the XFree86 -servers. In addition, some miscellaneous server support functions (not -OS-dependent) are included here, to take advantage of the fact that this -library comes last in the linking order. - -Most of the functionality required to support a new OS is encapsulated in -this library. It is hoped that all OS-specific details can be encapsulated, -but that is not likely ever to be completely possible. Hence some minor -changes will wind up being made in other parts of the server. The major -design principles for this library are maintainability, readability, and -portability. Sometimes these goals conflict; some somewhat arbitrary choices -have been made in implementation. - -2 - Directory Layout --------------------- - os-support/ Contains headers and documentation; no code - misc/ Non-OS-specific miscellaneous functions that - fit best into the link architecture this way. - shared/ Contains files with functions used by more than one - OS. These are symlinked into the OS subdirectories - at build time via Imakefile rules. This is alway - preferable to reproducing functions in more than one - OS library. - bsd/ OS support for the 386BSD/NetBSD/FreeBSD operating - systems. - bsdi/ OS support for the BSD/386 operating system. - linux/ OS support for the Linux operating system. - sco/ OS support for the SCO SVR3.x operating system. - solx86/ OS support for the Solaris x86 operating system. - sysv/ OS support for all SVR4.0 and SVR4.2, and for - ISC and AT&T SVR3.2 operating systems. - -3 - Adding A New OS -------------------- - Adding a support for a new operating system entails implementing all of -the functions described in the API below. Many of these functions are no-ops -for many operating systems, and appropriate files with dummy declarations are -available in the 'shared' subdirectory. - -If your OS is sufficiently similar to an existing OS, you can make use of -the existing subdirectory. One of the reasons for implementing this OS -library was the unmaintainability of the spagetti-#ifdef code that existed -before. You should try to avoid cluttering the code with #ifdef's. If -you find that the subdirectory is getting cluttered, split off into a -seperate subdirectory (e.g. as was done for SCO, rather than cluttering -the 'sysv' subdirectory). You can split functions out of an existing -subdirectory into the 'shared' subdirectory, if that is appropriate. Just -remember to update the Imakefile for the old subdirectory. - -You will still likely have to make some small changes to other parts of -the server. You should not put OS-specific #define's or #include's anywhere -else in the server. These should all go in the "xf86_OSlib.h" header file -in this directory. - -4 - OS Support API ------------------ -void xf86OpenConsole(void) -{ - /* - * Open console device, activate VTs, etc, etc. Fill in requisite - * pieces of xf86Info. Most of this code comes from xf86Init.c - */ -} - -void xf86CloseConsole(void) -{ - /* - * Close console at server exit. - */ -} - -Bool xf86VTSwitchPending(void) -{ - /* - * Returns TRUE iff there is a VT switch operation pending for - * the server. In the USL VT model, this is indicated via a - * signal handler. Should return FALSE always for OSs without - * VTs. - */ -} - -Bool xf86VTSwitchAway(void) -{ - /* - * Handles the OS-specific action for switching away from the active - * VT. Returns FALSE if the switch away fails. Should return - * FALSE always for OSs without VTs (then again, this function - * should never be called in that case). - */ -} - -Bool xf86VTSwitchTo(void) -{ - /* - * Handles the OS-specific action for switching to the active VT. - * Returns FALSE if the switch to fails. Should return TRUE - * always for OSs without VTs (then again, this function should - * never be called in that case). - */ -} - -Bool xf86LinearVidMem(void) -{ - /* - * Returns TRUE if the OS supports mapping linear frame buffers - * (ie memory at addresses above physical memory). - */ -} - -pointer xf86MapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - /* - * Handle mapping the video memory. Returns (pointer *)0 for - * failure; causes server exit. It is allowable to call FatalError() - * from inside this function and exit directly. - */ -} - -void xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - /* - * Handle unmapping the video memory. This should undo what - * xf86MapVidMem() does. Base is a pointer obtained from - * a previous call to xf86MapVidMem(). - */ -} - -void xf86MapDisplay(int ScreenNum, int Region) -{ - /* - * For OSs that require the screen be mapped when entering a VT. - * A dummy function will be defined for OSs that don't require - * this (or don't have VTs at all). - */ -} - -void xf86UnMapDisplay(int ScreenNum, int Region) -{ - /* - * For Os that require that the screen be unmapped when leaving a - * VT. A dummy function will be defined for OSs that don't require - * this (or don't have VTs at all). - */ -} - -int xf86ReadBIOS(unsigned long Base, unsigned long Offset, - unsigned char *Buf, int Len) -{ - /* - * Read Len bytes from the BIOS at address Base, offset Offset, - * into buffer Buf. Returns -1 for failure or if the OS does - * not support reading the BIOS. This causes a driver probe - * to fail, but does not cause the server to abort. - */ -} - - -void xf86EnableIOPorts(int ScreenNum) -{ - /* - * Enables I/O permissions. The OS layer should - * enable all I/O port access. - */ -} - -void xf86DisableIOPorts(int ScreenNum) -{ - /* - * Disables I/O permissions. - */ -} - -Bool xf86DisableInterrupts(void) -{ - /* - * Disable interrupts if allowed for this OS. Returns FALSE if - * this is not allowed or if the attempt fails for some reason. - */ -} - -void xf86EnableInterrupts(void) -{ - /* - * Reenable interrupts - */ -} - -int xf86ProcessArgument(int argc, char *argv[], int i) -{ - /* - * Process OS-specific command-line arguments. See - * ddxProcessArgument() for more info. - */ -} - -void xf86UseMsg(void) -{ - /* - * Print list of OS-specific command-line arguments. See - * ddxUseMsg() for more info. - */ -} - -void xf86SoundKbdBell(int loudness, int pitch, int duration) -{ - /* - * Sound the keyboard bell. pitch is in Hz, duration in ms, - * loudness is in the range 0-100 (0 -> off). For systems - * where the loudness can't be controlled, scale the duration - * by loudness/50. - */ -} - -void xf86SetKbdLeds(int leds) -{ - /* - * Set the keyboard LEDs to the state indicated in leds - */ -} - -int xf86GetKbdLeds(void) -{ - /* - * Return the state of the keyboard LEDs. If the OS doesn't - * support this, return 0. - */ -} - -void xf86SetKbdRepeat(char rad) -{ - /* - * Set the keyboard repeat rate and delay according the - * the rad value. The lower 5 bits determine the repeat - * rate (lower value -> higher rate). The next 2 bits - * determine the delay. - * This should possibly be changed to take separate rate and - * delay parameters. - */ -} - -void xf86KbdInit(void) -{ - /* - * Save initial keyboard state. This is called at the start of - * each server generation. - */ -} - -int xf86KbdOn(void) -{ - /* - * Set the keyboard up for use with X. This is called whenever - * the server becomes active (ie at the start of each generation and - * whenever its VT becomes active). Return the file descriptor - * for keyboard input. Return -1 if there is no file descriptor - * to add as an input device. If there are errors encountered, - * call FatalError(). A return value of -1 is not considered an - * error condition. - */ -} - -int xf86KbdOff(void) -{ - /* - * Return the keyboard to the state saved by xf86KbdInit(). This is - * called at the end of a server generation, and also when the - * server's VT ceases being active. Returns the keyboard file - * descriptor. Returns -1 if there is no file descriptor to be - * removed as an input device. Errors should be handled the same - * way as in xf86KbdOn(). - */ -} - -void xf86KbdEvents(void) -{ - /* - * Read characters from the keyboard device, and post the events - * by calling xf86PostKbdEvent(). Read as much as is available - * without waiting. - */ -} - -void xf86SetMouseSpeed(int old, int new, unsigned cflag) -{ - /* - * Set the speed of the mouse port. old is the previous speed, - * new is the new speed, and cflag is the value of the termio[s] - * c_cflag field. For mice that have programmable speed operation, - * this should send the appropriate commands to the mouse. - */ -} - -void xf86MouseInit(void) -{ - /* - * This is called at the start of each server generation. In most - * cases this is a noop. If the mouse must not be opened/closed - * when VT switching, the open should be done here. - */ -} - -int xf86MousedOn(void) -{ - /* - * Set the mouse up for use with X. This is called whenever - * the server becomes active (ie at the start of each generation and - * whenever its VT becomes active). This function normally opens - * the mouse device, and may call xf86SetupMouse() to initialise - * the mouse parameters. Return the file descriptor for mouse input. - * Return -1 if there is no file descriptor to add as an input - * device. If there are errors encountered, call FatalError(). - * A return value of -1 is not considered an error condition. - */ -} - -int xf86MouseOff(Bool doclose) -{ - /* - * Release the mouse from use with X. This is called at the end - * of a server generation (with doclose==TRUE), and also when the - * server's VT ceases being active (with doclose==FALSE). If the - * mouse should not be opened/closed when VT switching, the close - * should be done here when doclose==TRUE. For other systems, the - * mouse device should be closed regardless of the doclose value. - * Returns the mouse file descriptor. Returns -1 if there is no - * file descriptor to be removed as an input device. Errors - * should be handled the same way as in xf86MouseOn(). - */ -} - -void xf86MouseEvents(void) -{ - /* - * Read characters from the mouse device, and post the events - * by calling xf86PostMseEvent(). Read as much as is available - * without waiting. If the OS doesn't handle the mouse protocol - * translation, xf86MouseProtocol() may be called to do the - * translation and event posting. If the OS does handle the protocol - * translation, MOUSE_PROTOCOL_IN_KERNEL should be #define'd in - * xf86_OSlib.h. - */ -} - -int xf86OsMouseProc(DevicePtr pPointer, int what) -{ - /* - * Implements the device-proc for the pointer device when an - * OS-based mouse driver is being used (as opposed to the - * server's internal mouse driver). Implemented as any other - * device-proc in the server. - * - * This function only needs to be implemented if USE_OSMOUSE is - * defined for the OS. - */ -} - -int xf86OsMouseEvents(void) -{ - /* - * When supporting an OS-based mouse driver (as opposed to the - * server's internal mouse driver), read some events from the device - * and post them to the DIX layer through xf86PostMseEvent(). - * - * This function only needs to be implemented if USE_OSMOUSE is - * defined for the OS. - */ -} - -void xf86OsMouseOption(int token, pointer lex_ptr) -{ - /* - * Used in parsing an OsMouse keyword from the Xconfig file. - * Passed the token type and a pointer to the token value. - * The function should do whatever is appropriate for the OS's - * mouse driver. - * - * This function only needs to be implemented if USE_OSMOUSE is - * defined for the OS. - */ -} - -/* - * The following functions are simply wrappers around the OS specific - * libc functions - */ - -void * -xf86memmove(void * dest, const void * src, INT32 n) -{ - return(memmove(dest,src,n)); -} - -void * -xf86memset(void * s, int c, INT32 n) -{ - return(memset(s,c,n)); -} - -void * -xf86memcpy(void * dest, const void * src, INT32 n) -{ - return(memcpy(dest,src,n)); -} - -int -xf86memcmp(const void * s1, const void * s2, INT32 n) -{ - return(memcmp(s1,s2,n)); -} - -char * -xf86strcat(char * dest, const char * src) -{ - return(strcat(dest,src)); -} - -char * -xf86strcpy(char * dest, const char * src) -{ - return(strcpy(dest,src)); -} - -int -xf86strcmp(const char * s1, const char * s2) -{ - return(strcmp(s1,s2)); -} - -int -xf86strncmp(const char * s1, const char * s2, INT32 n) -{ - return(strncmp(s1,s2,n)); -} - -size_t -xf86strlen(const char * s) -{ - return(strlen(s)); -} - -void -xf86getsecs(INT32 * secs, INT32 * usecs) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - *secs = tv.tv_sec; - *usecs= tv.tv_usec; - - return; -} - -double -xf86exp(double x) -{ - return(exp(x)); -} - -double -xf86log(double x) -{ - return(log(x)); -} - -double -xf86pow(double x, double y) -{ - return(pow(x,y)); -} - -double -xf86sqrt(double x) -{ - return(sqrt(x)); -} - -double -xf86cos(double x) -{ - return(cos(x)); -} - - - - -$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.10 2001/12/17 20:00:45 dawes Exp $ - - - - - -$XConsortium: README.OS-lib /main/5 1996/02/21 17:50:28 kaleb $ diff --git a/hw/xfree86/os-support/assyntax.h b/hw/xfree86/os-support/assyntax.h index d3e96e5fd..2d7e17f83 100644 --- a/hw/xfree86/os-support/assyntax.h +++ b/hw/xfree86/os-support/assyntax.h @@ -236,7 +236,7 @@ #endif /* ACK_ASSEMBLER */ -#if defined(__QNX__) || defined(Lynx) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) +#if defined(__QNX__) || (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) #define GLNAME(a) a #else #define GLNAME(a) CONCAT(_,a) diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am index 678903056..fa233242c 100644 --- a/hw/xfree86/os-support/bsd/Makefile.am +++ b/hw/xfree86/os-support/bsd/Makefile.am @@ -59,7 +59,6 @@ libbsd_la_SOURCES = \ $(srcdir)/../shared/vidmem.c \ bsd_VTsw.c \ bsd_init.c \ - bsd_mouse.c \ bsd_bell.c \ $(ARCH_SOURCES) \ $(AGP_SOURCES) \ diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c index d1ee787f1..fe166c845 100644 --- a/hw/xfree86/os-support/bsd/bsdResource.c +++ b/hw/xfree86/os-support/bsd/bsdResource.c @@ -19,7 +19,7 @@ #ifdef INCLUDE_XF86_NO_DOMAIN -#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__) +#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) resPtr xf86AccResFromOS(resPtr ret) diff --git a/hw/xfree86/os-support/bsd/bsd_axp.c b/hw/xfree86/os-support/bsd/bsd_axp.c index 51ffef148..cb10a9d40 100644 --- a/hw/xfree86/os-support/bsd/bsd_axp.c +++ b/hw/xfree86/os-support/bsd/bsd_axp.c @@ -7,7 +7,7 @@ #include "os.h" #include "xf86.h" #include "xf86Priv.h" -#include "xf86Axp.h" +#include "shared/xf86Axp.h" #include #include "xf86_OSlib.h" #include diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 83583d5b9..cbb9e4810 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -310,8 +310,7 @@ acquire_vt: #endif /* SYSCONS_SUPPORT || PCVT_SUPPORT */ #ifdef WSCONS_SUPPORT case WSCONS: - fprintf(stderr, "xf86OpenConsole\n"); - /* xf86Info.consoleFd = open("/dev/wskbd0", 0); */ + /* Nothing to do */ break; #endif } @@ -575,8 +574,14 @@ xf86OpenPcvt() sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1); if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { - FatalError("xf86OpenPcvt: Cannot open %s (%s)", + ErrorF("xf86OpenPcvt: Cannot open %s (%s)", vtname, strerror(errno)); + xf86Info.vtno = initialVT; + sprintf(vtname, "%s%01x", vtprefix, xf86Info.vtno - 1); + if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) { + FatalError("xf86OpenPcvt: Cannot open %s (%s)", + vtname, strerror(errno)); + } } if (ioctl(fd, VT_GETMODE, &vtmode) < 0) { @@ -585,8 +590,8 @@ xf86OpenPcvt() xf86Info.consType = PCVT; #ifdef WSCONS_SUPPORT xf86Msg(X_PROBED, - "Using wscons driver in pcvt compatibility mode " - "(version %d.%d)\n", + "Using wscons driver on %s in pcvt compatibility mode " + "(version %d.%d)\n", vtname, pcvt_version.rmajor, pcvt_version.rminor); #else xf86Msg(X_PROBED, "Using pcvt driver (version %d.%d)\n", @@ -620,7 +625,7 @@ xf86OpenWScons() #if defined(__NetBSD__) sprintf(ttyname, "/dev/ttyE%d", i); #elif defined(__OpenBSD__) - sprintf(ttyname, "/dev/ttyC%d", i); + sprintf(ttyname, "/dev/ttyC%x", i); #endif if ((fd = open(ttyname, 2)) != -1) break; @@ -662,7 +667,7 @@ xf86CloseConsole() VT.mode = VT_AUTO; ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */ } -#if !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) +#if !defined(OpenBSD) && !defined(USE_DEV_IO) && !defined(USE_I386_IOPL) if (ioctl(xf86Info.consoleFd, KDDISABIO, 0) < 0) { xf86FatalError("xf86CloseConsole: KDDISABIO failed (%s)", diff --git a/hw/xfree86/os-support/bsd/bsd_mouse.c b/hw/xfree86/os-support/bsd/bsd_mouse.c deleted file mode 100644 index ca2c1bbd5..000000000 --- a/hw/xfree86/os-support/bsd/bsd_mouse.c +++ /dev/null @@ -1,791 +0,0 @@ - -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xisb.h" -#include "mipointer.h" -#ifdef WSCONS_SUPPORT -#include -#endif -#ifdef USBMOUSE_SUPPORT -#ifdef HAS_LIB_USB_HID -#include -#else -#include "usb.h" -#endif - -#include -#ifdef USB_GET_REPORT_ID -#define USB_NEW_HID -#endif - -#define HUP_GENERIC_DESKTOP 0x0001 -#define HUP_BUTTON 0x0009 - -#define HUG_X 0x0030 -#define HUG_Y 0x0031 -#define HUG_Z 0x0032 -#define HUG_WHEEL 0x0038 - -#define HID_USAGE2(p,u) (((p) << 16) | u) - -/* The UMS mices have middle button as number 3 */ -#define UMS_BUT(i) ((i) == 0 ? 2 : (i) == 1 ? 0 : (i) == 2 ? 1 : (i)) -#endif /* USBMOUSE_SUPPORT */ - -#ifdef USBMOUSE_SUPPORT -static void usbSigioReadInput (int fd, void *closure); -#endif - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -/* These are for FreeBSD and DragonFly */ -#define DEFAULT_MOUSE_DEV "/dev/mouse" -#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse" -#define DEFAULT_PS2_DEV "/dev/psm0" - -static const char *mouseDevs[] = { - DEFAULT_MOUSE_DEV, - DEFAULT_SYSMOUSE_DEV, - DEFAULT_PS2_DEV, - NULL -}; -#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) -/* Only wsmouse mices are autoconfigured for now on OpenBSD */ -#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse" -#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0" - -static const char *mouseDevs[] = { - DEFAULT_WSMOUSE_DEV, - DEFAULT_WSMOUSE0_DEV, - NULL -}; -#endif - -static int -SupportedInterfaces(void) -{ -#if defined(__NetBSD__) - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; -#else - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -#endif -} - -/* Names of protocols that are handled internally here. */ -static const char *internalNames[] = { -#if defined(WSCONS_SUPPORT) - "WSMouse", -#endif -#if defined(USBMOUSE_SUPPORT) - "usb", -#endif - NULL -}; - -/* - * Names of MSC_MISC protocols that the OS supports. These are decoded by - * main "mouse" driver. - */ -static const char *miscNames[] = { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - "SysMouse", -#endif - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - for (i = 0; miscNames[i]; i++) - if (xf86NameCmp(protocol, miscNames[i]) == 0) - return TRUE; - return FALSE; -} - -static const char * -DefaultProtocol(void) -{ -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - return "Auto"; -#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) - return "WSMouse"; -#else - return NULL; -#endif -} - -#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE) -static struct { - int dproto; - const char *name; -} devproto[] = { - { MOUSE_PROTO_MS, "Microsoft" }, - { MOUSE_PROTO_MSC, "MouseSystems" }, - { MOUSE_PROTO_LOGI, "Logitech" }, - { MOUSE_PROTO_MM, "MMSeries" }, - { MOUSE_PROTO_LOGIMOUSEMAN, "MouseMan" }, - { MOUSE_PROTO_BUS, "BusMouse" }, - { MOUSE_PROTO_INPORT, "BusMouse" }, - { MOUSE_PROTO_PS2, "PS/2" }, - { MOUSE_PROTO_HITTAB, "MMHitTab" }, - { MOUSE_PROTO_GLIDEPOINT, "GlidePoint" }, - { MOUSE_PROTO_INTELLI, "Intellimouse" }, - { MOUSE_PROTO_THINK, "ThinkingMouse" }, - { MOUSE_PROTO_SYSMOUSE, "SysMouse" } -}; - -static const char * -SetupAuto(InputInfoPtr pInfo, int *protoPara) -{ - int i; - mousehw_t hw; - mousemode_t mode; - - if (pInfo->fd == -1) - return NULL; - - /* set the driver operation level, if applicable */ - i = 1; - ioctl(pInfo->fd, MOUSE_SETLEVEL, &i); - - /* interrogate the driver and get some intelligence on the device. */ - hw.iftype = MOUSE_IF_UNKNOWN; - hw.model = MOUSE_MODEL_GENERIC; - ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw); - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n", - pInfo->name, hw.iftype, hw.model); - if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0) { - for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i) { - if (mode.protocol == devproto[i].dproto) { - /* override some parameters */ - if (protoPara) { - protoPara[4] = mode.packetsize; - protoPara[0] = mode.syncmask[0]; - protoPara[1] = mode.syncmask[1]; - } - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", - pInfo->name, devproto[i].name); - return devproto[i].name; - } - } - } - return NULL; -} - -static void -SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) -{ - mousemode_t mode; - MouseDevPtr pMse; - - pMse = pInfo->private; - - mode.rate = rate > 0 ? rate : -1; - mode.resolution = res > 0 ? res : -1; - mode.accelfactor = -1; -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - if (pMse->autoProbe || - (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { - /* - * As the FreeBSD sysmouse driver defaults to protocol level 0 - * everytime it is opened we enforce protocol level 1 again at - * this point. - */ - mode.level = 1; - } else - mode.level = -1; -#else - mode.level = -1; -#endif - ioctl(pInfo->fd, MOUSE_SETMODE, &mode); -} -#endif - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - -#define MOUSED_PID_FILE "/var/run/moused.pid" - -/* - * Try to check if moused is running. DEFAULT_SYSMOUSE_DEV is useless without - * it. There doesn't seem to be a better way of checking. - */ -static Bool -MousedRunning(void) -{ - FILE *f = NULL; - unsigned int pid; - - if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) { - if (fscanf(f, "%u", &pid) == 1 && pid > 0) { - if (kill(pid, 0) == 0) { - fclose(f); - return TRUE; - } - } - fclose(f); - } - return FALSE; -} - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev, *dev = NULL; - Bool devMouse = FALSE; - struct stat devMouseStat; - struct stat sb; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK)); - if (fd == -1) { -#ifdef DEBUG - ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno)); -#endif - } else { - /* - * /dev/mouse is held until checks for matches with other devices - * are done. This is so that when it points to /dev/sysmouse, - * the test for whether /dev/sysmouse is usable can be made. - */ - if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) { - if (fstat(fd, &devMouseStat) == 0) - devMouse = TRUE; - close(fd); - continue; - } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) { - /* Check if /dev/mouse is the same as /dev/sysmouse. */ - if (devMouse && fstat(fd, &sb) == 0 && - devMouseStat.st_dev == sb.st_dev && - devMouseStat.st_ino == sb.st_ino) { - /* If the same, use /dev/sysmouse. */ - devMouse = FALSE; - } - close(fd); - if (MousedRunning()) - break; - else { -#ifdef DEBUG - ErrorF("moused isn't running\n"); -#endif - } - } else { - close(fd); - break; - } - } - } - - if (*pdev) - dev = *pdev; - else if (devMouse) - dev = DEFAULT_MOUSE_DEV; - - if (dev) { - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", dev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, dev); - } - - return *pdev; -} -#endif - -#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) - -/* Only support wsmouse configuration for now */ -static const char * -SetupAuto(InputInfoPtr pInfo, int *protoPara) -{ - - xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", - pInfo->name, "wsmouse"); - return "wsmouse"; -} - -static void -SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) -{ - - xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n", - pInfo->name, protocol, rate, res); -} - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK)); - if (fd != -1) { - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, - "Device", *pdev); - xf86Msg(X_INFO, "%s: found Device \"%s\"\n", - pInfo->name, *pdev); - close(fd); - break; - } - } - return *pdev; -} -#endif /* __OpenBSD__ || __NetBSD__ && WSCONS_SUPPORT */ - -#ifdef WSCONS_SUPPORT -#define NUMEVENTS 64 - -static void -wsconsReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - static struct wscons_event eventList[NUMEVENTS]; - int n, c; - struct wscons_event *event = eventList; - unsigned char *pBuf; - - pMse = pInfo->private; - - XisbBlockDuration(pMse->buffer, -1); - pBuf = (unsigned char *)eventList; - n = 0; - while (n < sizeof(eventList) && (c = XisbRead(pMse->buffer)) >= 0) { - pBuf[n++] = (unsigned char)c; - } - - if (n == 0) - return; - - n /= sizeof(struct wscons_event); - while( n-- ) { - int buttons = pMse->lastButtons; - int dx = 0, dy = 0, dz = 0, dw = 0; - switch (event->type) { - case WSCONS_EVENT_MOUSE_UP: -#define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value)) - buttons &= ~BUTBIT; - break; - case WSCONS_EVENT_MOUSE_DOWN: - buttons |= BUTBIT; - break; - case WSCONS_EVENT_MOUSE_DELTA_X: - dx = event->value; - break; - case WSCONS_EVENT_MOUSE_DELTA_Y: - dy = -event->value; - break; -#ifdef WSCONS_EVENT_MOUSE_DELTA_Z - case WSCONS_EVENT_MOUSE_DELTA_Z: - dz = event->value; - break; -#endif - default: - xf86Msg(X_WARNING, "%s: bad wsmouse event type=%d\n", pInfo->name, - event->type); - ++event; - continue; - } - - pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); - ++event; - } - return; -} - - -/* This function is called when the protocol is "wsmouse". */ -static Bool -wsconsPreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse = pInfo->private; - - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pMse); - return FALSE; - } - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local input proc. */ - pInfo->read_input = wsconsReadInput; - pMse->xisbscale = sizeof(struct wscons_event); - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} -#endif - -#if defined(USBMOUSE_SUPPORT) - -typedef struct _UsbMseRec { - int packetSize; - int iid; - hid_item_t loc_x; /* x locator item */ - hid_item_t loc_y; /* y locator item */ - hid_item_t loc_z; /* z (wheel) locator item */ - hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ - unsigned char *buffer; -} UsbMseRec, *UsbMsePtr; - -static int -usbMouseProc(DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - UsbMsePtr pUsbMse; - unsigned char map[MSE_MAXBUTTONS + 1]; - int nbuttons; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - pUsbMse = pMse->mousePriv; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) - map[nbuttons + 1] = nbuttons + 1; - - InitPointerDeviceStruct((DevicePtr)pPointer, - map, - min(pMse->buttons, MSE_MAXBUTTONS), - miPointerGetMotionEvents, - pMse->Ctrl, - miPointerGetMotionBufferSize()); - - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - xf86MotionHistoryAllocate(pInfo); - break; - - case DEVICE_ON: - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - pMse->buffer = XisbNew(pInfo->fd, pUsbMse->packetSize); - if (!pMse->buffer) { - xfree(pMse); - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } else { - xf86FlushInput(pInfo->fd); - if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput, - pInfo)) - AddEnabledDevice(pInfo->fd); - } - } - pMse->lastButtons = 0; - pMse->lastMappedButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - if (pInfo->fd != -1) { - RemoveEnabledDevice(pInfo->fd); - if (pUsbMse->packetSize > 8 && pUsbMse->buffer) { - xfree(pUsbMse->buffer); - } - if (pMse->buffer) { - XisbFree(pMse->buffer); - pMse->buffer = NULL; - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - } - pPointer->public.on = FALSE; - usleep(300000); - break; - } - return Success; -} - -static void -usbReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - UsbMsePtr pUsbMse; - int buttons = pMse->lastButtons; - int dx = 0, dy = 0, dz = 0, dw = 0; - int n, c; - unsigned char *pBuf; - - pMse = pInfo->private; - pUsbMse = pMse->mousePriv; - - XisbBlockDuration(pMse->buffer, -1); - pBuf = pUsbMse->buffer; - n = 0; - while ((c = XisbRead(pMse->buffer)) >= 0 && n < pUsbMse->packetSize) { - pBuf[n++] = (unsigned char)c; - } - if (n == 0) - return; - if (n != pUsbMse->packetSize) { - xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", pInfo->name, - n); - } - /* discard packets with an id that don't match the mouse */ - /* XXX this is probably not the right thing */ - if (pUsbMse->iid != 0) { - if (*pBuf++ != pUsbMse->iid) - return; - } - dx = hid_get_data(pBuf, &pUsbMse->loc_x); - dy = hid_get_data(pBuf, &pUsbMse->loc_y); - dz = hid_get_data(pBuf, &pUsbMse->loc_z); - - buttons = 0; - for (n = 0; n < pMse->buttons; n++) { - if (hid_get_data(pBuf, &pUsbMse->loc_btn[n])) - buttons |= (1 << UMS_BUT(n)); - } - pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); - return; -} - -static void -usbSigioReadInput (int fd, void *closure) -{ - usbReadInput ((InputInfoPtr) closure); -} - -/* This function is called when the protocol is "usb". */ -static Bool -usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse = pInfo->private; - UsbMsePtr pUsbMse; - report_desc_t reportDesc; - int i; - - pUsbMse = xalloc(sizeof(UsbMseRec)); - if (pUsbMse == NULL) { - xf86Msg(X_ERROR, "%s: cannot allocate UsbMouseRec\n", pInfo->name); - xfree(pMse); - return FALSE; - } - - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pUsbMse); - xfree(pMse); - return FALSE; - } - } - /* Get USB informations */ - reportDesc = hid_get_report_desc(pInfo->fd); - /* Get packet size & iid */ -#ifdef USB_NEW_HID - if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) { - xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n", - pInfo->name, strerror(errno)); - return FALSE; - } - pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, - pUsbMse->iid); -#else - pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, - &pUsbMse->iid); -#endif - /* Allocate buffer */ - if (pUsbMse->packetSize <= 8) { - pUsbMse->buffer = pMse->protoBuf; - } else { - pUsbMse->buffer = xalloc(pUsbMse->packetSize); - } - if (pUsbMse->buffer == NULL) { - xf86Msg(X_ERROR, "%s: cannot allocate buffer\n", pInfo->name); - xfree(pUsbMse); - xfree(pMse); - xf86CloseSerial(pInfo->fd); - return FALSE; - } -#ifdef USB_NEW_HID - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) { - xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) { - xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), - hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) { - } -#else - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), - hid_input, &pUsbMse->loc_x) < 0) { - xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), - hid_input, &pUsbMse->loc_y) < 0) { - xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name); - } - if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), - hid_input, &pUsbMse->loc_z) < 0) { - } -#endif - /* Probe for number of buttons */ - for (i = 1; i <= MSE_MAXBUTTONS; i++) { - if (!hid_locate(reportDesc, HID_USAGE2(HUP_BUTTON, i), - hid_input, &pUsbMse->loc_btn[i-1] -#ifdef USB_NEW_HID - , pUsbMse->iid -#endif - )) - break; - } - pMse->buttons = i-1; - - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Private structure */ - pMse->mousePriv = pUsbMse; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->device_control = usbMouseProc; - pInfo->read_input = usbReadInput; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} -#endif /* USBMOUSE */ - -static Bool -bsdMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - /* The protocol is guaranteed to be one of the internalNames[] */ -#ifdef WSCONS_SUPPORT - if (xf86NameCmp(protocol, "WSMouse") == 0) { - return wsconsPreInit(pInfo, protocol, flags); - } -#endif -#ifdef USBMOUSE_SUPPORT - if (xf86NameCmp(protocol, "usb") == 0) { - return usbPreInit(pInfo, protocol, flags); - } -#endif - return TRUE; -} - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; -#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE) - p->SetupAuto = SetupAuto; - p->SetPS2Res = SetSysMouseRes; - p->SetBMRes = SetSysMouseRes; - p->SetMiscRes = SetSysMouseRes; -#endif -#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) - p->SetupAuto = SetupAuto; - p->SetMiscRes = SetMouseRes; -#endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__) - p->FindDevice = FindDevice; -#endif - p->PreInit = bsdMousePreInit; - return p; -} diff --git a/hw/xfree86/os-support/bus/460gxPCI.c b/hw/xfree86/os-support/bus/460gxPCI.c deleted file mode 100644 index 44ee97687..000000000 --- a/hw/xfree86/os-support/bus/460gxPCI.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Copyright (C) 2002-2003 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. - */ - -/* - * This file contains the glue necessary for support of Intel's 460GX chipset. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "460gxPCI.h" -#include "xf86.h" -#include "Pci.h" - -/* 460GX register definitions */ -/* SAC at 0:10:0 */ -#define CBN 0x0040 -/* SAC at CBN:0:0 */ -#define DEVNPRES 0x0070 -/* SAC at CBN:1[0-7]:0 */ -#define BUSNO 0x0048 -#define SUBNO 0x0049 -#define VGASE 0x0080 -#define PCIS 0x0084 -#define IOR 0x008C -#define IORD 0x008E /* CBN:10:0 only */ -/* PXB at CBN:1[0-7]:1 */ -#define ERRCMD 0x0046 - -static int cbn_460gx = -1; -static CARD32 cbdevs_460gx = 0; -static CARD16 iord_460gx; -static int busno_460gx[8], subno_460gx[8]; -static CARD8 pcis_460gx[8], ior_460gx[8]; -static CARD8 has_err_460gx[8], err_460gx[8]; -static CARD8 iomap_460gx[16]; /* One for each 4k */ -static pciBusFuncs_t BusFuncs_460gx; - -static pciConfigPtr -Verify460GXBus(int bus) -{ - pciConfigPtr pPCI; - - if ((bus < 0) || (bus >= pciNumBuses) || - !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || - (pPCI->busnum != cbn_460gx) || (pPCI->funcnum != 0) || - (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17)) - return NULL; - - return pPCI; -} - -/* - * This function is called to emulate the various settings in a P2P or CardBus - * bridge's control register using one of a 460GX's SAC host bridges. - */ -static CARD16 -Control460GXBridge(int bus, CARD16 mask, CARD16 value) -{ - pciConfigPtr pPCI; - PCITAG tag; - CARD16 current = 0; - CARD8 tmp; - - if ((pPCI = Verify460GXBus(bus))) { - /* Start with VGA enablement */ - tmp = pciReadByte(pPCI->tag, VGASE); - if (tmp & 0x01) { - current |= PCI_PCI_BRIDGE_VGA_EN; - if ((mask & PCI_PCI_BRIDGE_VGA_EN) && - !(value & PCI_PCI_BRIDGE_VGA_EN)) - pciWriteByte(pPCI->tag, VGASE, tmp & ~0x01); - } else { - if (mask & value & PCI_PCI_BRIDGE_VGA_EN) - pciWriteByte(pPCI->tag, VGASE, tmp | 0x01); - } - - /* Move on to master abort failure enablement */ - if (has_err_460gx[pPCI->devnum - 0x10]) { - tag = PCI_MAKE_TAG(pPCI->busnum, pPCI->devnum, pPCI->funcnum + 1); - tmp = pciReadByte(tag, ERRCMD); - if (tmp & 0x01) { - current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN; - if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && - !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) - pciWriteByte(tag, ERRCMD, tmp & ~0x01); - } else { - if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteByte(tag, ERRCMD, tmp | 0x01); - } - } - - /* Put emulation of any other P2P bridge control here */ - } - - return (current & ~mask) | (value & mask); -} - -/* - * Retrieve various bus numbers representing the connections provided by 460GX - * host bridges. - */ -static void -Get460GXBridgeBuses(int bus, int *primary, int *secondary, int *subordinate) -{ - pciConfigPtr pPCI = Verify460GXBus(bus); - int i; - - /* The returned bus numbers are initialised by the caller */ - - if (!pPCI) - return; - - i = pPCI->devnum - 0x10; - - /* These are not modified, so no need to re-read them */ - if (primary) - *primary = pPCI->busnum; - if (secondary) - *secondary = busno_460gx[i]; - if (subordinate) - *subordinate = subno_460gx[i]; -} - -/* Retrieves a list of the resources routed to a host bridge's secondary bus */ -static void -Get460GXBridgeResources(int bus, - pointer *ppIoRes, - pointer *ppMemRes, - pointer *ppPmemRes) -{ - pciConfigPtr pPCI = Verify460GXBus(bus); - resRange range; - unsigned int i, j; - - if (ppIoRes) { - xf86FreeResList(*ppIoRes); - *ppIoRes = NULL; - - if (pPCI) { - for (i = 0; i <= 0x0F; i++) { - if (iomap_460gx[i] != pPCI->devnum) - continue; - - RANGE(range, i << 12, ((i + 1) << 12) - 1, - RANGE_TYPE(ResExcIoBlock, 0)); - *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); - } - } - } - - if (ppMemRes) { - xf86FreeResList(*ppMemRes); - *ppMemRes = NULL; - - if (pPCI) { - if (!(i = (pPCI->devnum - 0x10))) - j = 127; /* (4GB - 32M) / 32M */ - else - j = pcis_460gx[i - 1] & 0x7F; - - i = pcis_460gx[i] & 0x7F; - if (i < j) { - RANGE(range, i << 25, (j << 25) - 1, - RANGE_TYPE(ResExcMemBlock, 0)); - *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); - } - } - } - - if (ppPmemRes) { - xf86FreeResList(*ppPmemRes); - *ppPmemRes = NULL; - } -} - -/* - * This checks for, and validates, the presence of the 460GX chipset, and sets - * cbn_460gx to a positive value accordingly. This function returns TRUE if - * the chipset scan is to be stopped, or FALSE if the scan is to move on to the - * next chipset. - */ - -Bool -xorgProbe460GX(scanpciWrapperOpt flags) -{ - pciBusInfo_t *pBusInfo; - PCITAG tag; - - /* Bus zero should already be set up */ - if (!(pBusInfo = pciBusInfo[0])) { - cbn_460gx = -1; - return FALSE; - } - /* First look for a 460GX's primary host bridge */ - tag = PCI_MAKE_TAG(0, 0x10, 0); - if (pciReadLong(tag, PCI_ID_REG) == DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) { - return TRUE; - } - - cbn_460gx = -1; - - return FALSE; -} - -void -xf86PreScan460GX(void) -{ - pciBusInfo_t *pBusInfo; - PCITAG tag; - CARD32 tmp; - int i, devno; - - if (!(pBusInfo = pciBusInfo[0])) - return; - - /* Get CBN (Chipset bus number) */ - tag = PCI_MAKE_TAG(0, 0x10, 0); - if (!(cbn_460gx = (unsigned int)pciReadByte(tag, CBN))) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - if (pciNumBuses <= cbn_460gx) - pciNumBuses = cbn_460gx + 1; - - /* Set up bus CBN */ - if (!pciBusInfo[cbn_460gx]) { - pciBusInfo[cbn_460gx] = xnfalloc(sizeof(pciBusInfo_t)); - *pciBusInfo[cbn_460gx] = *pBusInfo; - } - - tag = PCI_MAKE_TAG(cbn_460gx, 0, 0); - if (pciReadLong(tag, PCI_ID_REG) != DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - /* - * Find out which CBN devices the firmware thinks are present. Of these, - * we are only interested in devices 0x10 through 0x17. - */ - cbdevs_460gx = pciReadLong(tag, DEVNPRES); - - for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { - tag = PCI_MAKE_TAG(cbn_460gx, devno, 0); - if (pciReadLong(tag, PCI_ID_REG) != - DEVID(VENDOR_INTEL, CHIP_460GX_SAC)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - if (devno == 0x10) - iord_460gx = pciReadWord(tag, IORD); - - busno_460gx[i] = (unsigned int)pciReadByte(tag, BUSNO); - subno_460gx[i] = (unsigned int)pciReadByte(tag, SUBNO); - pcis_460gx[i] = pciReadByte(tag, PCIS); - ior_460gx[i] = pciReadByte(tag, IOR); - - has_err_460gx[i] = err_460gx[i] = 0; /* Insurance */ - - tag = PCI_MAKE_TAG(cbn_460gx, devno, 1); - tmp = pciReadLong(tag, PCI_ID_REG); - switch (tmp) { - case DEVID(VENDOR_INTEL, CHIP_460GX_PXB): - case DEVID(VENDOR_INTEL, CHIP_460GX_WXB): - if (cbdevs_460gx & (1 << devno)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - /* - * XXX I don't have WXB docs, but PCI register dumps indicate that - * the registers we are interested in are consistent with those of - * the PXB. - */ - err_460gx[i] = pciReadByte(tag, ERRCMD); - has_err_460gx[i] = 1; - break; - - case DEVID(VENDOR_INTEL, CHIP_460GX_GXB_1): - if (cbdevs_460gx & (1 << devno)) { - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - - /* - * XXX GXB isn't documented to have an ERRCMD register, nor any - * other means of failing master aborts. For now, assume master - * aborts are always allowed to complete normally. - */ - break; - - default: - if (((CARD16)(tmp + 1U) <= (CARD16)1U) && - (cbdevs_460gx & (1U << devno))) - break; - /* Sanity check failed */ - cbn_460gx = -1; - return; - } - } - - /* Allow master aborts to complete normally */ - for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { - if (!(err_460gx[i] & 0x01)) - continue; - - pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1), - ERRCMD, err_460gx[i] & ~0x01); - } - - /* - * The 460GX spec says that any access to buses higher than CBN will be - * master-aborted. It seems possible however that this is not the case in - * all 460GX implementations. For now, limit the bus scan to CBN, unless - * we have already found a higher bus number. - */ - for (i = 0; subno_460gx[i] < cbn_460gx; ) { - if (++i < 8) - continue; - - pciMaxBusNum = cbn_460gx + 1; - break; - } - - return; -} - -/* This does some 460GX-related processing after the PCI bus scan */ -void -xf86PostScan460GX(void) -{ - pciConfigPtr pPCI, *ppPCI; - pciBusInfo_t *pBusInfo; - int i, j, devno; - - if (cbn_460gx <= 0) - return; - - /* Set up our extra bus functions */ - BusFuncs_460gx = *(pciBusInfo[0]->funcs); - BusFuncs_460gx.pciControlBridge = Control460GXBridge; - BusFuncs_460gx.pciGetBridgeBuses = Get460GXBridgeBuses; - BusFuncs_460gx.pciGetBridgeResources = Get460GXBridgeResources; - - /* - * Mark all host bridges so that they are ignored by the upper-level - * xf86GetPciBridgeInfo() function. This marking is later clobbered by the - * tail end of xf86scanpci() for those bridges that actually have bus - * segments associated with them. - */ - ppPCI = xf86scanpci(0); /* Recursion is only apparent */ - while ((pPCI = *ppPCI++)) { - if ((pPCI->pci_base_class == PCI_CLASS_BRIDGE) && - (pPCI->pci_sub_class == PCI_SUBCLASS_BRIDGE_HOST)) - pPCI->businfo = HOST_NO_BUS; - } - - ppPCI = xf86scanpci(0); /* Recursion is only apparent */ - j = 0; - - /* - * Fix up CBN bus linkage. This is somewhat arbitrary. The bridge chosen - * for this must be a CBN device so that bus CBN can be recognised as the - * root segment. It also cannot be any of the bus expanders (devices - * CBN:0x10:0 through CBN:0x17:0 nor any of their functions). For now, we - * chose the SAC host bridge at CBN:0:0. - */ - pBusInfo = pciBusInfo[cbn_460gx]; - pBusInfo->bridge = pciBusInfo[0]->bridge; /* Just in case */ - while ((pPCI = *ppPCI++)) { - if (pPCI->busnum < cbn_460gx) - continue; - if (pPCI->busnum > cbn_460gx) - break; - if (pPCI->devnum < 0) - continue; - if (pPCI->devnum > 0) - break; - if (pPCI->funcnum < 0) - continue; - if (pPCI->funcnum > 0) - break; - - pBusInfo->bridge = pPCI; - pBusInfo->secondary = FALSE; - pBusInfo->primary_bus = cbn_460gx; - break; - } - - for (i = 0, devno = 0x10; devno <= 0x17; i++, devno++) { - /* Restore ERRCMD registers */ - if (err_460gx[i] & 0x01) - pciWriteByte(PCI_MAKE_TAG(cbn_460gx, devno, 1), - ERRCMD, err_460gx[i]); - - if (!(cbdevs_460gx & (1 << devno))) { - while ((pPCI = *ppPCI++)) { - if (pPCI->busnum < cbn_460gx) - continue; - if (pPCI->busnum > cbn_460gx) - break; - if (pPCI->devnum < devno) - continue; - if (pPCI->devnum > devno) - break; - if (pPCI->funcnum < 0) - continue; - if (pPCI->funcnum > 0) - break; - - if ((pBusInfo == pciBusInfo[busno_460gx[i]])) - break; - - /* Fix bus linkage */ - pBusInfo->bridge = pPCI; - pBusInfo->secondary = TRUE; - pBusInfo->primary_bus = cbn_460gx; - - /* Plug in chipset routines */ - pBusInfo->funcs = &BusFuncs_460gx; - break; - } - } - - /* Decode IOR registers */ - for(; j <= (ior_460gx[i] & 0x0F); j++) - iomap_460gx[j] = devno; - } - - /* The bottom 4k of I/O space is always routed to PCI0a */ - iomap_460gx[0] = 0x10; - - /* Decode IORD register */ - for (j = 1; j <= 0x0F; j++) - if (iord_460gx & (1 << j)) - iomap_460gx[j] = 0x10; -} diff --git a/hw/xfree86/os-support/bus/460gxPCI.h b/hw/xfree86/os-support/bus/460gxPCI.h deleted file mode 100644 index 2905d4787..000000000 --- a/hw/xfree86/os-support/bus/460gxPCI.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2002-2003 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 -#endif - -#ifndef PCI_460GX_H -#define PCI_460GX_H 1 - -#include -#include - -Bool xorgProbe460GX(scanpciWrapperOpt flags); -void xf86PreScan460GX(void); -void xf86PostScan460GX(void); - -#endif diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index 5a15430c1..d48fcb67d 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -23,10 +23,6 @@ if XORG_BUS_SPARCPCI PCI_SOURCES += sparcPci.c endif -if LINUX_ALPHA -PCI_SOURCES += axpPci.c -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 1385eee85..a1390c073 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -189,75 +189,26 @@ #define ARCH_PCI_INIT bsdPciInit #endif +#if defined(linux) +# define ARCH_PCI_INIT linuxPciInit +# if defined(__m32r__) +# define INCLUDE_XF86_MAP_PCI_MEM +# define INCLUDE_XF86_NO_DOMAIN +# endif +#endif /* defined(linux) */ + + #if !defined(ARCH_PCI_INIT) /* * Select architecture specific PCI init function */ -#if defined(__alpha__) -# if defined(linux) -# define ARCH_PCI_INIT axpPciInit -# endif -#elif defined(__arm__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif -#elif defined(__hppa__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif -#elif defined(__ia64__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif -#elif defined(__i386__) || defined(__i386) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# else -# define ARCH_PCI_INIT ix86PciInit -# endif -#elif defined(__mc68000__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif -#elif defined(__mips__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif +#if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) +# define ARCH_PCI_INIT ix86PciInit #elif defined(__powerpc__) || defined(__powerpc64__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# else -# define ARCH_PCI_INIT ppcPciInit -# endif -#elif defined(__s390__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif -#elif defined(__sh__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# endif -#elif defined(__m32r__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# define INCLUDE_XF86_MAP_PCI_MEM -# define INCLUDE_XF86_NO_DOMAIN -# endif +# define ARCH_PCI_INIT ppcPciInit #elif defined(__sparc__) || defined(sparc) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# elif defined(sun) -# define ARCH_PCI_INIT sparcPciInit -# endif -# if !defined(__FreeBSD__) && !defined(linux) -# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge -# endif -#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) -# if defined(linux) -# define ARCH_PCI_INIT linuxPciInit -# else -# define ARCH_PCI_INIT ix86PciInit -# endif +# define ARCH_PCI_INIT sparcPciInit +# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge #endif #endif /* !defined(ARCH_PCI_INIT) */ diff --git a/hw/xfree86/os-support/bus/altixPCI.c b/hw/xfree86/os-support/bus/altixPCI.c deleted file mode 100644 index bab255e4d..000000000 --- a/hw/xfree86/os-support/bus/altixPCI.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file contains the glue necessary for support of SGI's Altix chipset. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "altixPCI.h" -#include "xf86.h" -#include "Pci.h" - -void xf86PreScanAltix(void) -{ - /* Nothing to see here... */ -} - -void xf86PostScanAltix(void) -{ - pciConfigPtr *pdev; - int idx, free_idx; - - /* - * Some altix pci chipsets do not expose themselves as host - * bridges. - * - * Walk the devices looking for buses for which there is not a - * corresponding pciDevice entry (ie. pciBusInfo[]->bridge is NULL). - * - * It is assumed that this indicates a root bridge for which we will - * construct a fake pci host bridge device. - */ - - pdev = xf86scanpci(0); - for (idx = 0; pdev[idx] != NULL; idx++) - ; - - free_idx = idx; - - for (idx = 0; idx < free_idx; idx++) { - pciConfigPtr dev, fakedev; - pciBusInfo_t *businfo; - - dev = pdev[idx]; - businfo = pciBusInfo[dev->busnum]; - - if (! businfo) { - /* device has no bus ... should this be an error? */ - continue; - } - - if (businfo->bridge) { - /* bus has a device ... no need for fixup */ - continue; - } - - if (free_idx >= MAX_PCI_DEVICES) - FatalError("SN: No room for fake root bridge device\n"); - - /* - * Construct a fake device and stick it at the end of the - * pdev array. Make it look like a host bridge. - */ - fakedev = xnfcalloc(1, sizeof(pciDevice)); - fakedev->tag = PCI_MAKE_TAG(dev->busnum, 0, 0);; - fakedev->busnum = dev->busnum; - fakedev->devnum = 0; - fakedev->funcnum = 0; - fakedev->fakeDevice = 1; - /* should figure out a better DEVID */ - fakedev->pci_device_vendor = DEVID(VENDOR_GENERIC, CHIP_VGA); - fakedev->pci_base_class = PCI_CLASS_BRIDGE; - - businfo->secondary = 0; - businfo->primary_bus = dev->busnum; - businfo->bridge = fakedev; - - fakedev->businfo = businfo; - - pdev[free_idx++] = fakedev; - } -} diff --git a/hw/xfree86/os-support/bus/altixPCI.h b/hw/xfree86/os-support/bus/altixPCI.h deleted file mode 100644 index 2a738f362..000000000 --- a/hw/xfree86/os-support/bus/altixPCI.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef PCI_ALTIX_H -#define PCI_ALTIX_H 1 - -#include -#include - -Bool xorgProbeAltix(scanpciWrapperOpt flags); -void xf86PreScanAltix(void); -void xf86PostScanAltix(void); - -/* Some defines for PCI */ -#define VENDOR_SGI 0x10A9 -#define CHIP_TIO_CA 0x1010 -#define CHIP_PIC_PCI 0x1011 - -#endif diff --git a/hw/xfree86/os-support/bus/axpPci.c b/hw/xfree86/os-support/bus/axpPci.c deleted file mode 100644 index c59c06804..000000000 --- a/hw/xfree86/os-support/bus/axpPci.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * 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 Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION 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 1998 by Metro Link Incorporated - * - * 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 Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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 -#endif - -#include -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#include -#include "../linux/lnx.h" /* for _iobase */ - -/* - * Alpha/Linux platform specific PCI access functions - */ -static CARD32 axpPciCfgRead(PCITAG tag, int off); -static void axpPciCfgWrite(PCITAG, int off, CARD32 val); -static void axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits); - -static pciBusFuncs_t axpFuncs0 = { -/* pciReadLong */ axpPciCfgRead, -/* pciWriteLong */ axpPciCfgWrite, -/* pciSetBitsLong */ axpPciCfgSetBits, -/* pciAddrHostToBus */ pciAddrNOOP, -/* pciAddrBusToHost */ pciAddrNOOP -}; - -typedef struct _axpDomainRec { - int domain, hose; - int root_bus; - unsigned long dense_io, sparse_io; - unsigned long dense_mem, sparse_mem; - IOADDRESS mapped_io; -} axpDomainRec, *axpDomainPtr; - -#define MAX_DOMAINS (MAX_PCI_BUSES / 256) -static axpDomainPtr xf86DomainInfo[MAX_DOMAINS] = { NULL, }; -static int pciNumDomains = 0; - -/* - * For debug, domain assignment can start downward from a fixed base - * (instead of up from 0) by defining FORCE_HIGH_DOMAINS. This allows - * debug of large domain numbers and sparse domain numbering on systems - * which don't have as many hoses. - */ -#if 0 -# define FORCE_HIGH_DOMAINS MAX_DOMAINS /* assign domains downward from here */ -#endif - -/* - * If FORCE_HIGH_DOMAINS is set, make sure it's not larger than the - * max domain - */ -#if defined(FORCE_HIGH_DOMAINS) && (FORCE_HIGH_DOMAINS > MAX_DOMAINS) -# undef FORCE_HIGH_DOMAINS -# define FORCE_HIGH_DOMAINS MAX_DOMAINS -#endif - -static int -axpSetupDomains(void) -{ - axpDomainRec axpDomain; - int numDomains = 0; - int hose; - -#ifndef INCLUDE_XF86_NO_DOMAIN - -#ifdef FORCE_HIGH_DOMAINS - xf86Msg(X_WARNING, - "DEBUG OPTION FORCE_HIGH_DOMAINS in use - DRI will *NOT* work\n"); - numDomains = FORCE_HIGH_DOMAINS; -#endif - - /* - * Since each hose has a different address space, hoses are a perfect - * overlay for domains, so set up one domain for each hose present - * in the system. We have to loop through all possible hoses because - * some systems allow sparse I/O controllers. - */ - for(hose = 0; hose < MAX_DOMAINS; hose++) { - axpDomain.root_bus = _iobase(IOBASE_ROOT_BUS, hose, -1, -1); - if (axpDomain.root_bus < 0) continue; - - axpDomain.hose = hose; - -#ifndef FORCE_HIGH_DOMAINS - - axpDomain.domain = axpDomain.hose = hose; - numDomains = axpDomain.domain + 1; - -#else /* FORCE_HIGH_DOMAINS */ - - axpDomain.domain = numDomains - hose - 1; - - xf86Msg(X_WARNING, - "FORCE_HIGH_DOMAINS - assigned hose %d to domain %d\n", - axpDomain.hose, axpDomain.domain); - -#endif /* FORCE_HIGH_DOMAINS */ - - axpDomain.dense_io = _iobase(IOBASE_DENSE_IO, hose, -1, -1); - axpDomain.sparse_io = _iobase(IOBASE_SPARSE_IO, hose, -1, -1); - axpDomain.mapped_io = 0; - axpDomain.dense_mem = _iobase(IOBASE_DENSE_MEM, hose, -1, -1); - axpDomain.sparse_mem = _iobase(IOBASE_SPARSE_MEM, hose, -1, -1); - - xf86DomainInfo[axpDomain.domain] = xnfalloc(sizeof(axpDomainRec)); - *(xf86DomainInfo[axpDomain.domain]) = axpDomain; - - /* - * For now, only allow a single domain (hose) on sparse i/o systems. - * - * Allowing multiple domains on sparse systems would require: - * 1) either - * a) revamping the sparse video mapping code to allow - * for multiple unrelated address regions - * -- OR -- - * b) implementing sparse mapping directly in - * xf86MapDomainMemory - * 2) revaming read/write sparse routines to correctly handle - * the solution to 1) - * 3) implementing a sparse I/O system (mapping, inX/outX) - * independent of glibc, since the glibc version only - * supports hose 0 - */ - if (axpDomain.sparse_io) { - if (_iobase(IOBASE_ROOT_BUS, hose + 1, -1, -1) >= 0) { - /* - * It's a sparse i/o system with (at least) one more hose, - * show a message indicating that video is constrained to - * hose 0 - */ - xf86Msg(X_INFO, - "Sparse I/O system - constraining video to hose 0\n"); - } - break; - } - } - -#else /* INCLUDE_XF86_NO_DOMAIN */ - - /* - * domain support is not included, so just set up a single domain (0) - * to represent the first hose so that axpPciInit will still have - * be able to set up the root bus - */ - xf86DomainInfo[0] = xnfalloc(sizeof(axpDomainRec)); - *(xf86DomainInfo[0]) = axpDomain; - numDomains = 1; - -#endif /* INCLUDE_XF86_NO_DOMAIN */ - - return numDomains; -} - -void -axpPciInit() -{ - axpDomainPtr pDomain; - int domain, bus; - - pciNumDomains = axpSetupDomains(); - - for(domain = 0; domain < pciNumDomains; domain++) { - if (!(pDomain = xf86DomainInfo[domain])) continue; - - /* - * Since any bridged buses will be behind a probed pci-pci bridge, - * only set up the root bus for each domain (hose) and the bridged - * buses will be set up as they are found. - */ - /* make a bus with both the domain and the root bus in it */ - bus = PCI_MAKE_BUS(domain, pDomain->root_bus); - pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); - (void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t)); - - pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER; - pciBusInfo[bus]->numDevices = 32; - pciBusInfo[bus]->funcs = &axpFuncs0; - pciBusInfo[bus]->pciBusPriv = pDomain; - - pciNumBuses = bus + 1; - } -} - -/* - * Alpha/Linux PCI configuration space access routines - */ -static int -axpPciBusFromTag(PCITAG tag) -{ - pciBusInfo_t *pBusInfo; - axpDomainPtr pDomain; - int bus, dfn; - - bus = PCI_BUS_FROM_TAG(tag); - if ((bus >= pciNumBuses) - || !(pBusInfo = pciBusInfo[bus]) - || !(pDomain = pBusInfo->pciBusPriv) - || (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1; - - bus = PCI_BUS_NO_DOMAIN(bus); /* should just be root_bus */ - dfn = PCI_DFN_FROM_TAG(tag); - if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1; - - return bus; -} - -static CARD32 -axpPciCfgRead(PCITAG tag, int off) -{ - int bus, dfn; - CARD32 val = 0xffffffff; - - if ((bus = axpPciBusFromTag(tag)) >= 0) { - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - } - return(val); -} - -static void -axpPciCfgWrite(PCITAG tag, int off, CARD32 val) -{ - int bus, dfn; - - if ((bus = axpPciBusFromTag(tag)) >= 0) { - dfn = PCI_DFN_FROM_TAG(tag); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); - } -} - -static void -axpPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - int bus, dfn; - CARD32 val = 0xffffffff; - - if ((bus = axpPciBusFromTag(tag)) >= 0) { - dfn = PCI_DFN_FROM_TAG(tag); - - syscall(__NR_pciconfig_read, bus, dfn, off, 4, &val); - val = (val & ~mask) | (bits & mask); - syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); - } -} - -#ifndef INCLUDE_XF86_NO_DOMAIN - -/* - * Alpha/Linux addressing domain support - */ - -_X_EXPORT int -xf86GetPciDomain(PCITAG Tag) -{ - return PCI_DOM_FROM_TAG(Tag); -} - -_X_EXPORT pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) -{ - axpDomainPtr pDomain; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain < 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain])) - FatalError("%s called with invalid parameters\n", __FUNCTION__); - - /* - * xf86MapVidMem already does what we need, but remember to subtract - * _bus_base() (the physical dense memory root of hose 0) since - * xf86MapVidMem is expecting an offset relative to _bus_base() rather - * than an actual physical address. - */ - return xf86MapVidMem(ScreenNum, Flags, - pDomain->dense_mem + Base - _bus_base(), Size); -} - -IOADDRESS -xf86MapLegacyIO(struct pci_device *dev) -{ - axpDomainPtr pDomain; - const int domain = dev->domain; - - if ((domain < 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain])) - FatalError("%s called with invalid parameters\n", __FUNCTION__); - - /* - * Use glibc inx/outx routines for sparse I/O, so just return the - * base [this is ok since we also constrain sparse I/O systems to - * a single domain in axpSetupDomains()] - */ - if (pDomain->sparse_io) return 0; - - /* - * I/O addresses on Alpha are really just different physical memory - * addresses that the system corelogic turns into I/O commands on the - * bus, so just use xf86MapVidMem to map I/O as well, but remember - * to subtract _bus_base() (the physical dense memory root of hose 0) - * since xf86MapVidMem is expecting an offset relative to _bus_base() - * rather than an actual physical address. - * - * Map the entire I/O space (64kB) at once and only once. - */ - if (!pDomain->mapped_io) - pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(-1, VIDMEM_MMIO, - pDomain->dense_io - _bus_base(), - 0x10000); - - return pDomain->mapped_io; -} - -resPtr -xf86AccResFromOS(resPtr pRes) -{ - resRange range; - int domain; - - for(domain = 0; domain < pciNumDomains; domain++) { - if (!xf86DomainInfo[domain]) continue; - - /* - * Fallback is to claim the following areas: - * - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - */ - - RANGE(range, 0x000c0000, 0x000effff, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff - * range along with their sparse I/O aliases, but that's too - * imprecise. Instead claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, - RANGE_TYPE(ResExcIoBlock, domain)); /* For mainboard */ - pRes = xf86AddResToList(pRes, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); -/* RANGE(range, 0x00000000, 0x00000000, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); */ - RANGE(range, 0xffffffff, 0xffffffff, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -#endif /* !INCLUDE_XF86_NO_DOMAIN */ - diff --git a/hw/xfree86/os-support/bus/e8870PCI.c b/hw/xfree86/os-support/bus/e8870PCI.c deleted file mode 100644 index 8e0f95ac0..000000000 --- a/hw/xfree86/os-support/bus/e8870PCI.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2002-2003 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. - */ - -/* - * This file contains the glue necessary for support of Intel's E8870 chipset. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "e8870PCI.h" -#include "xf86.h" -#include "Pci.h" - -Bool -xorgProbeE8870(scanpciWrapperOpt flags) -{ - PCITAG tag; - - /* Look for an E8870's Hub interface */ - tag = PCI_MAKE_TAG(0, 0x1E, 0); - if (pciReadLong(tag, PCI_ID_REG) == DEVID(VENDOR_INTEL, CHIP_82801_P2P)) - return TRUE; - - return FALSE; -} - -void -xf86PreScanE8870(void) -{ - /* XXX Fill me in... */ - return; -} - -void -xf86PostScanE8870(void) -{ - /* XXX Fill me in... */ -} diff --git a/hw/xfree86/os-support/bus/e8870PCI.h b/hw/xfree86/os-support/bus/e8870PCI.h deleted file mode 100644 index 89726270a..000000000 --- a/hw/xfree86/os-support/bus/e8870PCI.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2002-2003 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 -#endif - -#ifndef PCI_E8870_H -#define PCI_E8870_H 1 - -#include -#include - -Bool xorgProbeE8870(scanpciWrapperOpt flags); -void xf86PreScanE8870(void); -void xf86PostScanE8870(void); - -#endif diff --git a/hw/xfree86/os-support/bus/zx1PCI.c b/hw/xfree86/os-support/bus/zx1PCI.c deleted file mode 100644 index d78e0c434..000000000 --- a/hw/xfree86/os-support/bus/zx1PCI.c +++ /dev/null @@ -1,1140 +0,0 @@ -/* - * Copyright (C) 2002-2003 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. - */ - -/* - * This file contains the glue necessary for support of HP's ZX1 chipset. - * Keep in mind that this chipset is used in both Itanium2 and PA-RISC - * architectures. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "zx1PCI.h" -#include "xf86.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#define MIO_BASE 0xFED00000UL /* mio register base */ -#define MIO_SIZE 0x00002000UL /* 8k, minimum */ - -/* ZX1 mio register definitions */ -#define MIO_FUNCTION0 0x0000U - -#define MODULE_INFO 0x0100U -#define STATUS_CONTROL 0x0108U -#define DILLON_PRESENT 0x02UL - -#define LMMIO_DIR_BASE0 0x0300U -#define LMMIO_DIR_MASK0 0x0308U -#define LMMIO_DIR_ROUTE0 0x0310U -#define LMMIO_DIR_BASE1 0x0318U -#define LMMIO_DIR_MASK1 0x0320U -#define LMMIO_DIR_ROUTE1 0x0328U -#define LMMIO_DIR_BASE2 0x0330U -#define LMMIO_DIR_MASK2 0x0338U -#define LMMIO_DIR_ROUTE2 0x0340U -#define LMMIO_DIR_BASE3 0x0348U -#define LMMIO_DIR_MASK3 0x0350U -#define LMMIO_DIR_ROUTE3 0x0358U -#define LMMIO_DIST_BASE 0x0360U -#define LMMIO_DIST_MASK 0x0368U -#define LMMIO_DIST_ROUTE 0x0370U -#define GMMIO_DIST_BASE 0x0378U -#define PORT_DISABLE 0x02UL -#define MAP_TO_LMMIO 0x04UL -#define GMMIO_DIST_MASK 0x0380U -#define GMMIO_DIST_ROUTE 0x0388U -#define IOS_DIST_BASE 0x0390U -#define IOS_DIST_MASK 0x0398U -#define IOS_DIST_ROUTE 0x03A0U -#define ROPE_CONFIG_BASE 0x03A8U -#define VGA_ROUTE 0x03B0U -#define VGA_ENABLE 0x8000000000000000UL -#define VGA_LIGHT 0x4000000000000000UL - -#define IOS_DIR_BASE 0x03C0U -#define IOS_DIR_MASK 0x03C8U -#define IOS_DIR_ROUTE 0x03D0U -#define IOS_BASE 0x03D8U - -#define MIO_FUNCTION1 0x1000U - -#define ROPE_CONFIG 0x1040U -#define ROPE_D0 0x0100UL -#define ROPE_D2 0x0200UL -#define ROPE_D4 0x0400UL -#define ROPE_D6 0x0800UL -#define ROPE_Q0 0x1000UL -#define ROPE_Q4 0x2000UL - -#define LBA_PORT0_CNTRL 0x1200U -#define LBA_PORT1_CNTRL 0x1208U -#define LBA_PORT2_CNTRL 0x1210U -#define LBA_PORT3_CNTRL 0x1218U -#define LBA_PORT4_CNTRL 0x1220U -#define LBA_PORT5_CNTRL 0x1228U -#define LBA_PORT6_CNTRL 0x1230U -#define LBA_PORT7_CNTRL 0x1238U -#define LBA_RESET_FUNCTION 0x0000000001UL -#define LBA_CLEAR_ERROR 0x0000000010UL -#define LBA_HARD_FAIL 0x0000000040UL -#define LBA_RESET_COMPLETE 0x0100000000UL -#define LBA_RESET_TIMEOUT 0x0200000000UL - -#define ROPE_PAGE_CONTROL 0x1418U - -/* - * Total ioa configuration space size is actually 128k, but we only need the - * first 64k. - */ -#define IOA_SIZE 0x00010000UL - -/* ZX1 ioa register definitions */ -#define IOA_CONFIG_ADDR 0x0040U -#define IOA_CONFIG_DATA 0x0048U - -#define IOA_SECONDARY_BUS 0x0058U -#define IOA_SUBORDINATE_BUS 0x0059U - -#define IOA_CONTROL 0x0108U -#define IOA_RESET_FUNCTION 0x0000000001UL -#define IOA_FORWARD_VGA 0x0000000008UL -#define IOA_CLEAR_ERROR 0x0000000010UL -#define IOA_HARD_FAIL 0x0000000040UL -#define IOA_RESET_COMPLETE 0x0100000000UL - -#define IOA_LMMIO_BASE 0x0200U -#define IOA_LMMIO_MASK 0x0208U -#define IOA_GMMIO_BASE 0x0210U -#define IOA_GMMIO_MASK 0x0218U -#define IOA_WLMMIO_BASE 0x0220U -#define IOA_WLMMIO_MASK 0x0228U -#define IOA_WGMMIO_BASE 0x0230U -#define IOA_WGMMIO_MASK 0x0238U -#define IOA_IOS_BASE 0x0240U -#define IOA_IOS_MASK 0x0248U -#define IOA_ELMMIO_BASE 0x0250U -#define IOA_ELMMIO_MASK 0x0258U -#define IOA_EIOS_BASE 0x0260U -#define IOA_EIOS_MASK 0x0268U -#define IOA_GLOBAL_MASK 0x0270U -#define IOA_SLAVE_CONTROL 0x0278U -#define IOA_VGA_PEER_ENABLE 0x2000UL -#define IOA_MSI_BASE 0x0280U -#define IOA_MSI_MASK 0x0288U - -#define IOA_DMA_BASE 0x02B0U -#define IOA_DMA_MASK 0x02B8U - -#define IOA_ERROR_CONFIG 0x0680U -#define IOA_ERROR_PIOWRITE 0x0001UL -#define IOA_ERROR_PIOREAD 0x0002UL -#define IOA_ERROR_DMAWRITE 0x0004UL -#define IOA_ERROR_DMAREAD 0x0008UL -#define IOA_ERROR_CONFIG_MASTER 0x0010UL -#define IOA_ERROR_SMART 0x0020UL -#define IOA_ERROR_FATAL_SERR 0x0040UL -#define IOA_ERROR_ASSERT_SERR 0x0080UL -/* ? 0x0100UL */ -#define IOA_ERROR_LOOPBACK 0x0200UL -#define IOA_ERROR_CONFIG_TARGET 0x0400UL -#define IOA_ERROR_IO_MASTER 0x0800UL -#define IOA_ERROR_IO_TARGET 0x1000UL -#define IOA_ERROR_MEM_MASTER 0x2000UL -#define IOA_ERROR_MEM_TARGET 0x4000UL -#define IOA_ERROR_HF_IO_FATAL 0x8000UL - -#define RANGE_ENABLE 0x01UL /* In various base registers */ - -#define IO_MASK ((1UL << 16) - 1UL) -#define LMMIO_MASK ((1UL << 32) - 1UL) -#ifdef __ia64__ -#define GMMIO_MASK ((1UL << 44) - 1UL) -#else /* PA-RISC */ -#define GMMIO_MASK ((1UL << 40) - 1UL) -#endif - -#define PDH_START 0xFF000000UL -#define PDH_LAST 0xFFFFFFFFUL - -static CARD8 *pZX1mio = NULL, - *pZX1ioa = NULL; - -/* Per-rope data */ -static INT8 zx1_ropemap[8]; -static CARD32 zx1_pciids[8]; -static CARD64 zx1_lbacntl[8]; -static int zx1_busno[8], zx1_subno[8]; - -/* Array of Booleans for non-empty buses */ -static INT8 zx1_busnmpt[MAX_PCI_BUSES]; - -static pciBusFuncs_t zx1BusFuncs; -static int zx1_fakebus = -1; -static Bool zx1_hasvga = FALSE; - -static pointer pZX1IoRes[8], pZX1MemRes[8]; /* Rope resources */ - -/* Non-PCI configuration space access macros */ -#define MIO_BYTE(offset) \ - (*(volatile CARD8 *)(pointer)(pZX1mio + (offset))) -#define MIO_WORD(offset) \ - (*(volatile CARD16 *)(pointer)(pZX1mio + (offset))) -#define MIO_LONG(offset) \ - (*(volatile CARD32 *)(pointer)(pZX1mio + (offset))) -#define MIO_QUAD(offset) \ - (*(volatile CARD64 *)(pointer)(pZX1mio + (offset))) -#define IOA_BYTE(ioa, offset) \ - (*(volatile CARD8 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) -#define IOA_WORD(ioa, offset) \ - (*(volatile CARD16 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) -#define IOA_LONG(ioa, offset) \ - (*(volatile CARD32 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) -#define IOA_QUAD(ioa, offset) \ - (*(volatile CARD64 *)(pointer)(pZX1ioa + ((offset) + ((ioa) << 13)))) - -/* Range definitions */ -#define MAX_RANGE 16 -static CARD64 bot[MAX_RANGE], top[MAX_RANGE], msk[MAX_RANGE], siz[MAX_RANGE]; -static INT8 *pDecode[MAX_RANGE]; -static int nRange = 0; - -/* Track a resource range and assign a granularity to it */ -static void -SetRange(CARD64 base, CARD64 last, CARD8 width) -{ - int i; - - bot[nRange] = base; - top[nRange] = last; - msk[nRange] = (CARD64)(-1L); - if (base) - msk[nRange] &= (base ^ (base - 1UL)) >> 1; - if (last + 1UL) - msk[nRange] &= (last ^ (last + 1UL)) >> 1; - if (width < 64) - msk[nRange] &= (1UL << width) - 1UL; - - /* Look for overlapping ranges */ - for (i = 0; i < nRange; i++) { - if ((bot[i] > top[i]) || - (top[nRange] < bot[i]) || - (top[i] < bot[nRange])) - continue; - - /* Merge in overlapping range */ - if (bot[nRange] > bot[i]) - bot[nRange] = bot[i]; - if (top[nRange] < top[i]) - top[nRange] = top[i]; - - /* Assign finer granularity */ - msk[nRange] &= msk[i]; - bot[i] = 1UL; - top[i] = 0; - } - - nRange++; -} - -/* Lookup granularity associated with the range containing 'base' */ -static int -GetRange(CARD64 base) -{ - int i; - - for (i = 0; i < nRange; i++) { - if ((bot[i] > top[i]) || - (base < bot[i]) || - (base > top[i])) - continue; - - if (pDecode[i]) - break; - - /* Allocate decoding array */ - msk[i]++; - siz[i] = ((top[i] - bot[i] + 1UL) / msk[i]) + 1UL; - pDecode[i] = xnfalloc(siz[i]); - (void)memset(pDecode[i], -1, siz[i]); - break; - } - - return i; -} - -/* - * Verify that 'bus' is a rope's secondary bus and return the pciConfigPtr of - * the associated fake PCI-to-PCI bridge. - */ -static pciConfigPtr -VerifyZX1Bus(int bus) -{ - pciConfigPtr pPCI; - - if ((bus < 0) || (bus >= pciNumBuses) || - !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || - (pPCI->busnum != zx1_fakebus) || (pPCI->funcnum != 0) || - (pPCI->devnum < 0x10) || (pPCI->devnum > 0x17)) - return NULL; - - return pPCI; -} - -/* - * This function is called to emulate the various settings in a P2P or CardBus - * bridge's control register on a ZX1-based system. - */ -static CARD16 -ControlZX1Bridge(int bus, CARD16 mask, CARD16 value) -{ - pciConfigPtr pPCI; - CARD64 tmp1, tmp2, tmp3, ropenum; - CARD16 current = 0; - - if ((pPCI = VerifyZX1Bus(bus))) { - ropenum = pPCI->devnum & 0x07; - - /* - * Start with VGA enablement. This preserves the "VGA-lite" bit - * in mio's VGA_ROUTE register, and the VPE bit in each ioa's - * SLAVE_CONTROL register. - */ - tmp1 = MIO_QUAD(VGA_ROUTE); - tmp2 = IOA_QUAD(ropenum, IOA_CONTROL) & - ~(IOA_RESET_FUNCTION | IOA_CLEAR_ERROR); - if ((tmp1 & VGA_ENABLE) && ((tmp1 & 0x07UL) == ropenum)) { - current |= PCI_PCI_BRIDGE_VGA_EN; - if ((mask & PCI_PCI_BRIDGE_VGA_EN) && - !(value & PCI_PCI_BRIDGE_VGA_EN)) { - MIO_QUAD(VGA_ROUTE) = tmp1 & ~VGA_ENABLE; - tmp2 &= ~IOA_FORWARD_VGA; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - } else if (mask & value & PCI_PCI_BRIDGE_VGA_EN) { - if (!zx1_hasvga) { - xf86MsgVerb(X_WARNING, 3, - "HP ZX1: Attempt to enable VGA routing to bus %d" - " through rope %ld disallowed\n", bus, ropenum); - value &= ~PCI_PCI_BRIDGE_VGA_EN; - } else { - if (tmp1 & VGA_ENABLE) { - /* - * VGA is routed somewhere else. Disable it. - */ - MIO_QUAD(VGA_ROUTE) = 0UL; - tmp3 = IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL); - if (tmp3 & IOA_FORWARD_VGA) - IOA_QUAD(tmp1 & 0x07UL, IOA_CONTROL) = tmp3 & - ~(IOA_RESET_FUNCTION | IOA_FORWARD_VGA | - IOA_CLEAR_ERROR); - } - if (!(tmp2 & IOA_FORWARD_VGA)) { - tmp2 |= IOA_FORWARD_VGA; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - tmp1 = (tmp1 & ~0x07UL) | ropenum | VGA_ENABLE; - MIO_QUAD(VGA_ROUTE) = tmp1; - } - } - - /* Move on to master abort failure enablement */ - tmp1 = MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) & - ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR); - if ((tmp1 & LBA_HARD_FAIL) || (tmp2 & IOA_HARD_FAIL)) { - current |= PCI_PCI_BRIDGE_MASTER_ABORT_EN; - if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && - !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) { - if (tmp1 & LBA_HARD_FAIL) - MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) = - tmp1 & ~LBA_HARD_FAIL; - if (tmp2 & IOA_HARD_FAIL) { - tmp2 &= ~IOA_HARD_FAIL; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - } - } else { - if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) { - if (!(tmp1 & LBA_HARD_FAIL)) - MIO_QUAD((ropenum << 3) + LBA_PORT0_CNTRL) = - tmp1 | LBA_HARD_FAIL; - if (!(tmp2 & IOA_HARD_FAIL)) { - tmp2 |= IOA_HARD_FAIL; - IOA_QUAD(ropenum, IOA_CONTROL) = tmp2; - } - } - } - - /* Put emulation of any other P2P bridge control here */ - } - - return (current & ~mask) | (value & mask); -} - -/* Retrieves a list of the resources routed to a rope's secondary bus */ -static void -GetZX1BridgeResources(int bus, - pointer *ppIoRes, - pointer *ppMemRes, - pointer *ppPmemRes) -{ - pciConfigPtr pPCI = VerifyZX1Bus(bus); - - if (ppIoRes) { - xf86FreeResList(*ppIoRes); - *ppIoRes = - pPCI ? xf86DupResList(pZX1IoRes[pPCI->devnum & 0x07]) : NULL; - } - - if (ppMemRes) { - xf86FreeResList(*ppMemRes); - *ppMemRes = - pPCI ? xf86DupResList(pZX1MemRes[pPCI->devnum & 0x07]) : NULL; - } - - if (ppPmemRes) { - xf86FreeResList(*ppPmemRes); - *ppPmemRes = NULL; - } -} - -/* The fake bus */ -static CARD32 -zx1FakeReadLong(PCITAG tag, int offset) -{ - FatalError("zx1FakeReadLong(0x%lX, 0x%X) called\n", - (unsigned long)tag, offset); -} - -static void -zx1FakeWriteLong(PCITAG tag, int offset, CARD32 val) -{ - FatalError("zx1FakeWriteLong(0x%lX, 0x%X, 0x%08X) called\n", - (unsigned long)tag, offset, val); -} - -static void -zx1FakeSetBits(PCITAG tag, int offset, CARD32 mask, CARD32 bits) -{ - CARD32 val; - - val = zx1FakeReadLong(tag, offset); - val &= ~mask; - val |= bits; - zx1FakeWriteLong(tag, offset, val); -} - -static pciBusFuncs_t zx1FakeBusFuncs = { - zx1FakeReadLong, - zx1FakeWriteLong, - zx1FakeSetBits -}; - -static pciBusInfo_t zx1FakeBus = { - 0, /* configMech -- copied from bus 0 */ - 0, /* numDevices -- copied from bus 0 */ - FALSE, /* secondary */ - 0, /* primary_bus -- dynamically set */ - &zx1FakeBusFuncs, /* funcs */ - NULL, /* pciBusPriv -- none */ - NULL, /* bridge -- dynamically set */ -}; - -void -xf86PreScanZX1(void) -{ - resRange range; - unsigned long mapSize = getpagesize(); - unsigned long tmp, base, ioaaddr; - unsigned long flagsd, based, lastd, maskd, routed; - unsigned long flags0, base0, last0, mask0, route0; - unsigned long flags1, base1, last1, mask1, route1; - unsigned long flags2, base2, last2, mask2, route2; - unsigned long flags3, base3, last3, mask3, route3; - unsigned long flagsg, baseg, lastg, maskg, routeg; - unsigned long flagsl, basel, lastl; - int i, rope; - - /* Map mio registers (minimum 8k) */ - if (mapSize < MIO_SIZE) - mapSize = MIO_SIZE; - - if (!(pZX1mio = xf86MapVidMem(-1, VIDMEM_MMIO, MIO_BASE, mapSize))) - return; - - /* Look for ZX1's SBA and IOC */ - if (((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX1_SBA)) || - (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX1_IOC))) && - ((MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX2_SBA)) || - (MIO_LONG(MIO_FUNCTION1 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX2_IOC)))) { - xf86UnMapVidMem(-1, pZX1mio, mapSize); - pZX1mio = NULL; - return; - } - - /* Map rope configuration space */ - ioaaddr = MIO_QUAD(ROPE_CONFIG_BASE); - if (!(ioaaddr & RANGE_ENABLE) || /* No ropes */ - ((ioaaddr = ioaaddr & ~RANGE_ENABLE) & 0x01FFFFUL) || /* Not aligned */ - !(pZX1ioa = xf86MapVidMem(-1, VIDMEM_MMIO, ioaaddr, IOA_SIZE))) { - xf86UnMapVidMem(-1, pZX1mio, mapSize); - pZX1mio = NULL; - return; - } - - for (i = 0; i < 8; i++) { - zx1_ropemap[i] = i; - zx1_lbacntl[i] = 0; - xf86FreeResList(pZX1IoRes[i]); - xf86FreeResList(pZX1MemRes[i]); - pZX1IoRes[i] = pZX1MemRes[i] = NULL; - } - - /* - * Determine which of 8 possible ropes exist in the system. This is done - * by looking at their "coupling" to generate a list of candidates, - * whittling this list down by factoring in ROPE_PAGE_CONTROL register - * contents, then poking each candidate's configuration space to determine - * its existence. - */ - tmp = MIO_QUAD(ROPE_CONFIG); - if (tmp & ROPE_D0) - zx1_ropemap[1] = 0; - if (tmp & ROPE_D2) - zx1_ropemap[3] = 2; - if (tmp & ROPE_D4) - zx1_ropemap[5] = 4; - if (tmp & ROPE_D6) - zx1_ropemap[7] = 6; - if (tmp & ROPE_Q0) - zx1_ropemap[1] = zx1_ropemap[2] = zx1_ropemap[3] = 0; - if (tmp & ROPE_Q4) - zx1_ropemap[5] = zx1_ropemap[6] = zx1_ropemap[7] = 4; - - /* - * zx2 should allow better probing support via hard-fails, so no need to - * use the ROPE_PAGE_CONTROL register. Also, zx2 always has ropes 3 & 7 - * active regardless of bundling. - */ - if (MIO_LONG(MIO_FUNCTION0 + PCI_ID_REG) != - DEVID(VENDOR_HP, CHIP_ZX2_SBA)) { - - tmp = MIO_QUAD(ROPE_PAGE_CONTROL); - for (i = 0; i < 8; i++, tmp >>= 8) - if (!(CARD8)tmp) - zx1_ropemap[i] = -1; - } else { - zx1_ropemap[3] = 3; - zx1_ropemap[7] = 7; - } - - for (i = 0; i < 8; ) { - if (zx1_ropemap[i] == i) { - - /* Prevent hard-fails */ - zx1_lbacntl[i] = MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) & - ~(LBA_RESET_FUNCTION | LBA_CLEAR_ERROR); - - if (zx1_lbacntl[i] & LBA_RESET_TIMEOUT) { - /* Ignore this rope and its couplings */ - do { - zx1_ropemap[i++] = -1; - } while ((i < 8) && (zx1_ropemap[i] < i)); - continue; /* Avoid over-incrementing 'i' */ - } - - if (zx1_lbacntl[i] & LBA_HARD_FAIL) - MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = - zx1_lbacntl[i] & ~LBA_HARD_FAIL; - - /* Poke for an ioa */ - zx1_pciids[i] = IOA_LONG(i, PCI_ID_REG); - switch (zx1_pciids[i]) { - case DEVID(VENDOR_HP, CHIP_ELROY): - case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */ - case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */ - case DEVID(VENDOR_HP, CHIP_ZX2_LBA): - case DEVID(VENDOR_HP, CHIP_ZX2_PCIE): - /* Expected vendor/device IDs */ - zx1_busno[i] = - (unsigned int)IOA_BYTE(i, IOA_SECONDARY_BUS); - zx1_subno[i] = - (unsigned int)IOA_BYTE(i, IOA_SUBORDINATE_BUS); - break; - - default: - if ((CARD16)(zx1_pciids[i] + 1U) > (CARD16)1U) - xf86MsgVerb(X_NOTICE, 0, - "HP ZX1: Unexpected vendor/device id 0x%08X" - " on rope %d\n", zx1_pciids[i], i); - /* Nobody home, or not the "right" kind of rope guest */ - - /* - * Restore hard-fail setting. For "active" ropes, this is done - * later. - */ - if (zx1_lbacntl[i] & LBA_HARD_FAIL) { - MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i]; - zx1_lbacntl[i] = 0; - } - - /* Ignore this rope and its couplings */ - do { - zx1_ropemap[i++] = -1; - } while ((i < 8) && (zx1_ropemap[i] < i)); - continue; /* Avoid over-incrementing 'i' */ - } - } - i++; - } - - /* Determine if VGA is currently routed */ - tmp = MIO_QUAD(VGA_ROUTE); - if (tmp & VGA_ENABLE) - zx1_hasvga = TRUE; - - /* - * Decode mio resource "coarse" routing (i.e. ignoring VGA). Due to the - * rather unusual flexibility of this chipset, this is done in a number of - * stages. For each of I/O and memory, first decode the relevant registers - * to generate ranges with an associated granularity. Overlapping ranges - * are merged into a larger range with the finer granularity. Each - * original range is then more thoroughly decoded using the granularity - * associated with the merged range that contains it. The result is then - * converted into resource lists for the common layer. - * - * Note that this doesn't care whether or not read-only bits are actually - * set as documented, nor that mask bits are contiguous. This does, - * however, factor in upper limits on I/O, LMMIO anf GMMIO addresses, and - * thus assumes high-order address bits are ignored rather than decoded. - * For example, an I/O address of 0x76543210 will be treated as 0x3210 - * rather than considered out-of-range. In part, this handling is a - * consequence of the fact that high-order mask bits are zeroes instead of - * ones. - */ - - flagsd = 0; based = 0; lastd = 0; maskd = 0; routed = 0; - flags0 = 0; base0 = 0; last0 = 0; mask0 = 0; route0 = 0; - flags1 = 0; base1 = 0; last1 = 0; mask1 = 0; route1 = 0; - flags2 = 0; base2 = 0; last2 = 0; mask2 = 0; route2 = 0; - flags3 = 0; base3 = 0; last3 = 0; mask3 = 0; route3 = 0; - flagsg = 0; baseg = 0; lastg = 0; maskg = 0; routeg = 0; - flagsl = 0; basel = 0; lastl = 0; - - if ((tmp = MIO_QUAD(IOS_DIST_BASE)) & RANGE_ENABLE) { - flagsd = RANGE_ENABLE; - maskd = MIO_QUAD(IOS_DIST_MASK); - based = tmp & maskd & (~RANGE_ENABLE & IO_MASK); - lastd = based | (~maskd & IO_MASK); - routed = MIO_QUAD(IOS_DIST_ROUTE) >> 58; - SetRange(based, lastd, routed); - } - - if ((tmp = MIO_QUAD(IOS_DIR_BASE)) & RANGE_ENABLE) { - flags0 = RANGE_ENABLE; - mask0 = MIO_QUAD(IOS_DIR_MASK); - base0 = tmp & mask0 & (~RANGE_ENABLE & IO_MASK); - last0 = base0 | (~mask0 & IO_MASK); - route0 = MIO_QUAD(IOS_DIR_ROUTE) & 0x07U; - SetRange(base0, last0, 64); - } - - if (flagsd) { - i = GetRange(based); - for (tmp = based; tmp <= lastd; tmp += msk[i]) { - if ((tmp & maskd) == based) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U]; - } - } - - flagsd = 0; - } - - if (flags0) { - i = GetRange(base0); - for (tmp = base0; tmp <= last0; tmp += msk[i]) { - if ((tmp & mask0) == base0) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route0]; - } - } - - flags0 = 0; - } - - for (i = 0; i < nRange; i++) { - if (!pDecode[i]) - continue; - - rope = pDecode[i][0]; - for (base = tmp = 0; ++tmp < siz[i]; ) { - if (rope == pDecode[i][tmp]) - continue; - - if (rope >= 0) { - RANGE(range, (base * msk[i]) + bot[i], - (tmp * msk[i]) + bot[i] - 1UL, - RANGE_TYPE(ResExcIoBlock, 0)); - pZX1IoRes[rope] = - xf86AddResToList(pZX1IoRes[rope], &range, -1); - } - - base = tmp; - rope = pDecode[i][base]; - } - - xfree(pDecode[i]); - pDecode[i] = NULL; - } - - nRange = 0; - - /* - * Move on to CPU memory access decoding. For now, don't tell the common - * layer about CPU memory ranges that are either relocated to 0 or - * translated into PCI I/O. - */ - - SetRange(MIO_BASE, MIO_BASE + MIO_SIZE - 1UL, 64); /* mio */ - SetRange(ioaaddr, ioaaddr + ((IOA_SIZE << 1) - 1UL), 64); /* ioa */ - SetRange(PDH_START, PDH_LAST, 64); /* PDH */ - - SetRange(MIO_BASE, LMMIO_MASK, 64); /* Completeness */ - - if ((tmp = MIO_QUAD(LMMIO_DIST_BASE)) & RANGE_ENABLE) { - flagsd = RANGE_ENABLE; - maskd = MIO_QUAD(LMMIO_DIST_MASK); - based = tmp & maskd & (~RANGE_ENABLE & LMMIO_MASK); - lastd = based | (~maskd & LMMIO_MASK); - routed = MIO_QUAD(LMMIO_DIST_ROUTE) >> 58; - SetRange(based, lastd, routed); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE0)) & RANGE_ENABLE) { - flags0 = RANGE_ENABLE; - mask0 = MIO_QUAD(LMMIO_DIR_MASK0); - base0 = tmp & mask0 & (~RANGE_ENABLE & LMMIO_MASK); - last0 = base0 | (~mask0 & LMMIO_MASK); - route0 = MIO_QUAD(LMMIO_DIR_ROUTE0) & 0x07U; - SetRange(base0, last0, 64); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE1)) & RANGE_ENABLE) { - flags1 = RANGE_ENABLE; - mask1 = MIO_QUAD(LMMIO_DIR_MASK1); - base1 = tmp & mask1 & (~RANGE_ENABLE & LMMIO_MASK); - last1 = base1 | (~mask1 & LMMIO_MASK); - route1 = MIO_QUAD(LMMIO_DIR_ROUTE1) & 0x07U; - SetRange(base1, last1, 64); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE2)) & RANGE_ENABLE) { - flags2 = RANGE_ENABLE; - mask2 = MIO_QUAD(LMMIO_DIR_MASK2); - base2 = tmp & mask2 & (~RANGE_ENABLE & LMMIO_MASK); - last2 = base2 | (~mask2 & LMMIO_MASK); - route2 = MIO_QUAD(LMMIO_DIR_ROUTE2) & 0x07U; - SetRange(base2, last2, 64); - } - - if ((tmp = MIO_QUAD(LMMIO_DIR_BASE3)) & RANGE_ENABLE) { - flags3 = RANGE_ENABLE; - mask3 = MIO_QUAD(LMMIO_DIR_MASK3); - base3 = tmp & mask3 & (~RANGE_ENABLE & LMMIO_MASK); - last3 = base3 | (~mask3 & LMMIO_MASK); - route3 = MIO_QUAD(LMMIO_DIR_ROUTE3) & 0x07U; - SetRange(base3, last3, 64); - } - - if ((tmp = MIO_QUAD(GMMIO_DIST_BASE)) & RANGE_ENABLE) { - flagsg = tmp & (RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO); - maskg = MIO_QUAD(GMMIO_DIST_MASK); - baseg = tmp & maskg & - (~(RANGE_ENABLE | PORT_DISABLE | MAP_TO_LMMIO) & GMMIO_MASK); - lastg = baseg | (~maskg & GMMIO_MASK); - tmp = routeg = MIO_QUAD(GMMIO_DIST_ROUTE) >> 58; - if (!(flagsg & (PORT_DISABLE & MAP_TO_LMMIO)) && (tmp > 26)) - tmp = 26; - SetRange(baseg, lastg, tmp); - } - - if ((tmp = MIO_QUAD(IOS_BASE)) & RANGE_ENABLE) { - flagsl = RANGE_ENABLE; - basel = tmp & (~RANGE_ENABLE & GMMIO_MASK); - lastl = basel | 0x001FFFFFUL; - SetRange(basel, lastl, 64); - } - - if (flagsd) { - i = GetRange(based); - for (tmp = based; tmp <= lastd; tmp += msk[i]) { - if ((tmp & maskd) == based) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[(tmp >> routed) & 0x07U]; - } - } - - flagsd = 0; - } - - /* LMMIO distributed range does not address anything beyond 0xFED00000 */ - i = GetRange(MIO_BASE); - for (tmp = MIO_BASE; tmp <= LMMIO_MASK; tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - /* Dillon space can sometimes be redirected to rope 0 */ - tmp = MIO_QUAD(STATUS_CONTROL); - if (!(tmp & DILLON_PRESENT)) { - i = GetRange(PDH_START); - for (tmp = PDH_START; tmp <= PDH_LAST; tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[0]; - } - } - - if (flagsg) { - unsigned long mask = (0x07UL << routeg) | maskg; - - i = GetRange(baseg); - for (tmp = baseg; tmp <= lastg; tmp += msk[i]) { - if ((tmp & maskg) == baseg) { - base = (tmp - bot[i]) / msk[i]; - - if ((flagsg & MAP_TO_LMMIO) || - (!(flagsg & PORT_DISABLE) && - (tmp <= ((tmp & mask) | 0x03FFFFFFUL)))) { - pDecode[i][base] = -1; - } else { - pDecode[i][base] = zx1_ropemap[(tmp >> routeg) & 0x07U]; - } - } - } - - flagsg = 0; - } - - if (flagsl) { - i = GetRange(basel); - for (tmp = basel; tmp <= lastl; tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - flagsl = 0; - } - - /* For now, assume directed LMMIO ranges don't overlap with each other */ - if (flags0) { - i = GetRange(base0); - for (tmp = base0; tmp <= last0; tmp += msk[i]) { - if ((tmp & mask0) == base0) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route0]; - } - } - - flags0 = 0; - } - - if (flags1) { - i = GetRange(base1); - for (tmp = base1; tmp <= last1; tmp += msk[i]) { - if ((tmp & mask1) == base1) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route1]; - } - } - - flags1 = 0; - } - - if (flags2) { - i = GetRange(base2); - for (tmp = base2; tmp <= last2; tmp += msk[i]) { - if ((tmp & mask2) == base2) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route2]; - } - } - - flags2 = 0; - } - - if (flags3) { - i = GetRange(base3); - for (tmp = base3; tmp <= last3; tmp += msk[i]) { - if ((tmp & mask3) == base3) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = zx1_ropemap[route3]; - } - } - - flags3 = 0; - } - - /* Claim iao config area */ - i = GetRange(ioaaddr); - for (tmp = ioaaddr; tmp < ioaaddr + (IOA_SIZE << 1); tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - /* Claim mio config area */ - i = GetRange(MIO_BASE); - for (tmp = MIO_BASE; tmp < (MIO_BASE + MIO_SIZE); tmp += msk[i]) { - base = (tmp - bot[i]) / msk[i]; - pDecode[i][base] = -1; - } - - for (i = 0; i < nRange; i++) { - if (!pDecode[i]) - continue; - - rope = pDecode[i][0]; - for (base = tmp = 0; ++tmp < siz[i]; ) { - if (rope == pDecode[i][tmp]) - continue; - - if (rope >= 0) { - RANGE(range, (base * msk[i]) + bot[i], - (tmp * msk[i]) + bot[i] - 1UL, - RANGE_TYPE(ResExcMemBlock, 0)); - pZX1MemRes[rope] = - xf86AddResToList(pZX1MemRes[rope], &range, -1); - } - - base = tmp; - rope = pDecode[i][base]; - } - - xfree(pDecode[i]); - pDecode[i] = NULL; - } - - nRange = 0; - - return; -} - -/* This is called to finalise the results of a PCI bus scan */ -void -xf86PostScanZX1(void) -{ - pciConfigPtr pPCI, *ppPCI, *ppPCI2; - pciBusInfo_t *pBusInfo; - int i, idx; - - if (!pZX1mio) - return; - - (void)memset(zx1_busnmpt, FALSE, sizeof(zx1_busnmpt)); - pBusInfo = pciBusInfo[0]; - - /* - * Certain 2.4 & 2.5 Linux kernels add fake PCI devices. Remove them to - * prevent any possible interference with our PCI validation. - * - * Also, if VGA isn't routed on server entry, determine if VGA routing - * needs to be enabled while the server is running. - */ - idx = 0; - ppPCI = ppPCI2 = xf86scanpci(0); /* Recursion is only apparent */ - while ((pPCI = *ppPCI2++)) { - switch (pPCI->pci_device_vendor) { - case DEVID(VENDOR_HP, CHIP_ELROY): - case DEVID(VENDOR_HP, CHIP_ZX1_SBA): /* Pluto function 0 */ - case DEVID(VENDOR_HP, CHIP_ZX1_IOC): /* Pluto function 1 */ - case DEVID(VENDOR_HP, CHIP_ZX1_LBA): /* Mercury */ - case DEVID(VENDOR_HP, CHIP_ZX1_AGP8): /* QuickSilver */ - case DEVID(VENDOR_HP, CHIP_ZX2_SBA): - case DEVID(VENDOR_HP, CHIP_ZX2_IOC): - case DEVID(VENDOR_HP, CHIP_ZX2_LBA): - case DEVID(VENDOR_HP, CHIP_ZX2_PCIE): - xfree(pPCI); /* Remove it */ - continue; - - default: - *ppPCI++ = pPCI; - idx++; - - zx1_busnmpt[pPCI->busnum] = TRUE; - - if (zx1_hasvga) - continue; - - switch (pPCI->pci_base_class) { - case PCI_CLASS_PREHISTORIC: - if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) - break; - continue; - - case PCI_CLASS_DISPLAY: - if (pPCI->pci_sub_class == PCI_SUBCLASS_DISPLAY_VGA) - break; - continue; - - default: - continue; - } - - zx1_hasvga = TRUE; - continue; - } - } - - /* - * Restore hard-fail settings and figure out the actual secondary and - * subordinate bus numbers. - */ - for (i = 0; i < 8; i++) { - if (zx1_ropemap[i] != i) - continue; - - if (zx1_lbacntl[i] & LBA_HARD_FAIL) - MIO_QUAD((i << 3) + LBA_PORT0_CNTRL) = zx1_lbacntl[i]; - - while ((zx1_busno[i] < zx1_subno[i]) && !pciBusInfo[zx1_subno[i]]) - zx1_subno[i]--; - - if (zx1_fakebus <= zx1_subno[i]) - zx1_fakebus = zx1_subno[i] + 1; - - while (!zx1_busnmpt[zx1_busno[i]]) { - if (zx1_busno[i]) /* Info for bus zero is in static storage */ - xfree(pciBusInfo[zx1_busno[i]]); - pciBusInfo[zx1_busno[i]++] = NULL; - if (zx1_busno[i] > zx1_subno[i]) - break; - } - } - - if (zx1_fakebus >= pciNumBuses) { - if (zx1_fakebus >= pciMaxBusNum) - FatalError("HP ZX1: No room for fake PCI bus\n"); - pciNumBuses = zx1_fakebus + 1; - } - - /* Set up our extra bus functions */ - zx1BusFuncs = *(pBusInfo->funcs); - zx1BusFuncs.pciControlBridge = ControlZX1Bridge; - zx1BusFuncs.pciGetBridgeResources = GetZX1BridgeResources; - - /* Set up our own fake bus to act as the root segment */ - zx1FakeBus.configMech = pBusInfo->configMech; - zx1FakeBus.numDevices = pBusInfo->numDevices; - zx1FakeBus.primary_bus = zx1_fakebus; - pciBusInfo[zx1_fakebus] = &zx1FakeBus; - - /* Add the fake bus' host bridge */ - if (++idx >= MAX_PCI_DEVICES) - FatalError("HP ZX1: No room for fake Host-to-PCI bridge\n"); - *ppPCI++ = zx1FakeBus.bridge = pPCI = xnfcalloc(1, sizeof(pciDevice)); - pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, 0, 0); - pPCI->busnum = zx1_fakebus; - /* pPCI->devnum = pPCI->funcnum = 0; */ - pPCI->pci_device_vendor = DEVID(VENDOR_HP, CHIP_ZX1_SBA); - pPCI->pci_base_class = PCI_CLASS_BRIDGE; - /* pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_HOST; */ - pPCI->fakeDevice = TRUE; - -#ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->_pci_device, pPCI->pci_rev_id, - pPCI->pci_base_class, pPCI->pci_sub_class); -#else - xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->_pci_device, - pPCI->pci_subsys_vendor, pPCI->pci_subsys_card, - pPCI->pci_rev_id, pPCI->pci_base_class, - pPCI->pci_sub_class, pPCI->pci_prog_if, - pPCI->pci_header_type); -#endif - - /* Add a fake PCI-to-PCI bridge to represent each active rope */ - for (i = 0; i < 8; i++) { - if ((zx1_ropemap[i] != i) || (zx1_busno[i] > zx1_subno[i]) || - !(pBusInfo = pciBusInfo[zx1_busno[i]])) - continue; - - if (++idx >= MAX_PCI_DEVICES) - FatalError("HP ZX1: No room for fake PCI-to-PCI bridge\n"); - *ppPCI++ = pPCI = xnfcalloc(1, sizeof(pciDevice)); - pPCI->busnum = zx1_fakebus; - pPCI->devnum = i | 0x10; - /* pPCI->funcnum = 0; */ - pPCI->tag = PCI_MAKE_TAG(zx1_fakebus, pPCI->devnum, 0); - pPCI->pci_device_vendor = zx1_pciids[i]; - pPCI->pci_base_class = PCI_CLASS_BRIDGE; - pPCI->pci_sub_class = PCI_SUBCLASS_BRIDGE_PCI; - pPCI->pci_header_type = 1; - pPCI->pci_primary_bus_number = zx1_fakebus; - pPCI->pci_secondary_bus_number = zx1_busno[i]; - pPCI->pci_subordinate_bus_number = zx1_subno[i]; - pPCI->fakeDevice = TRUE; - - pBusInfo->bridge = pPCI; - pBusInfo->secondary = TRUE; - pBusInfo->primary_bus = zx1_fakebus; - - /* Plug in chipset routines */ - pBusInfo->funcs = &zx1BusFuncs; - - /* Set bridge control register for scanpci utility */ - pPCI->pci_bridge_control = ControlZX1Bridge(zx1_busno[i], 0, 0); - -#ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->_pci_device, pPCI->pci_rev_id, - pPCI->pci_base_class, pPCI->pci_sub_class); -#else - xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum, - pPCI->pci_vendor, pPCI->_pci_device, - pPCI->pci_subsys_vendor, pPCI->pci_subsys_card, - pPCI->pci_rev_id, pPCI->pci_base_class, - pPCI->pci_sub_class, pPCI->pci_prog_if, - pPCI->pci_header_type); -#endif - } - - *ppPCI = NULL; /* Terminate array */ -} diff --git a/hw/xfree86/os-support/bus/zx1PCI.h b/hw/xfree86/os-support/bus/zx1PCI.h deleted file mode 100644 index f2b279382..000000000 --- a/hw/xfree86/os-support/bus/zx1PCI.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2002-2003 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 -#endif - -#ifndef PCI_ZX1_H -#define PCI_ZX1_H 1 - -#include - -void xf86PreScanZX1(void); -void xf86PostScanZX1(void); - -#endif diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am index 2214b1c2d..b405b1f2a 100644 --- a/hw/xfree86/os-support/hurd/Makefile.am +++ b/hw/xfree86/os-support/hurd/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libhurd.la libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \ - hurd_mouse.c hurd_video.c \ + hurd_video.c \ $(srcdir)/../shared/VTsw_noop.c \ $(srcdir)/../shared/posix_tty.c \ $(srcdir)/../shared/stdResource.c \ diff --git a/hw/xfree86/os-support/hurd/hurd_mouse.c b/hw/xfree86/os-support/hurd/hurd_mouse.c deleted file mode 100644 index 089cba38d..000000000 --- a/hw/xfree86/os-support/hurd/hurd_mouse.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright 1997,1998 by UCHIYAMA Yasushi - * - * 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 UCHIYAMA Yasushi not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. UCHIYAMA Yasushi makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL UCHIYAMA YASUSHI 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 NEED_EVENTS -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "inputstr.h" -#include "scrnintstr.h" -#include "mipointer.h" - -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xf86_OSlib.h" -#include "xisb.h" - -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_MOUSE_DEV "/dev/mouse" - -typedef unsigned short kev_type; /* kd event type */ -typedef unsigned char Scancode; - -struct mouse_motion { - short mm_deltaX; /* units? */ - short mm_deltaY; -}; - -typedef struct { - kev_type type; /* see below */ - struct timeval time; /* timestamp */ - union { /* value associated with event */ - boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */ - Scancode sc; /* KEYBD_EVENT */ - struct mouse_motion mmotion; /* MOUSE_MOTION */ - } value; -} kd_event; - -/* - * kd_event ID's. - */ -#define MOUSE_LEFT 1 /* mouse left button up/down */ -#define MOUSE_MIDDLE 2 -#define MOUSE_RIGHT 3 -#define MOUSE_MOTION 4 /* mouse motion */ -#define KEYBD_EVENT 5 /* key up/down */ - -#define NUMEVENTS 64 - -/* - * OsMouseReadInput -- - * Get some events from our queue. Process all outstanding events now. - */ -static void -OsMouseReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - static kd_event eventList[NUMEVENTS]; - int n, c; - kd_event *event = eventList; - unsigned char *pBuf; - - pMse = pInfo->private; - - XisbBlockDuration(pMse->buffer, -1); - pBuf = (unsigned char *)eventList; - n = 0; - while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList)) - pBuf[n++] = (unsigned char)c; - - if (n == 0) - return; - - n /= sizeof(kd_event); - while( n-- ) { - int buttons = pMse->lastButtons; - int dx = 0, dy = 0; - switch (event->type) { - case MOUSE_RIGHT: - buttons = buttons & 6 |(event->value.up ? 0 : 1); - break; - case MOUSE_MIDDLE: - buttons = buttons & 5 |(event->value.up ? 0 : 2); - break; - case MOUSE_LEFT: - buttons = buttons & 3 |(event->value.up ? 0 : 4) ; - break; - case MOUSE_MOTION: - dx = event->value.mmotion.mm_deltaX; - dy = - event->value.mmotion.mm_deltaY; - break; - default: - ErrorF("Bad mouse event (%d)\n",event->type); - continue; - } - pMse->PostEvent(pInfo, buttons, dx, dy, 0, 0); - ++event; - } - return; -} - -static Bool -OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse; - - /* This is called when the protocol is "OSMouse". */ - - pMse = pInfo->private; - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pMse); - return FALSE; - } - } - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->read_input = OsMouseReadInput; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - const char path[] = DEFAULT_MOUSE_DEV; - int fd; - - SYSCALL (fd = open(path, O_RDWR | O_NONBLOCK | O_EXCL)); - - if (fd == -1) - return NULL; - - close(fd); - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", path); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", pInfo->name, - path); - - return path; -} - -static int -SupportedInterfaces(void) -{ - /* XXX Need to check this. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -} - -static const char *internalNames[] = { - "OSMouse", - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - return FALSE; -} - -static const char * -DefaultProtocol(void) -{ - return "OSMouse"; -} - -OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->FindDevice = FindDevice; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; - p->PreInit = OsMousePreInit; - return p; -} - diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index 93f09c10c..f736095c8 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -26,7 +26,7 @@ APM_SRCS = lnx_apm.c XORG_CFLAGS += -DHAVE_APM endif -liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \ +liblinux_la_SOURCES = lnx_init.c lnx_video.c \ lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \ $(srcdir)/../shared/bios_mmap.c \ $(srcdir)/../shared/VTsw_usl.c \ diff --git a/hw/xfree86/os-support/linux/lnx_mouse.c b/hw/xfree86/os-support/linux/lnx_mouse.c deleted file mode 100644 index d2822153f..000000000 --- a/hw/xfree86/os-support/linux/lnx_mouse.c +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xf86_OSlib.h" -#include -#include -#include - -static int -SupportedInterfaces(void) -{ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; -} - -static const char * -DefaultProtocol(void) -{ - return "Auto"; -} - -#define DEFAULT_MOUSE_DEV "/dev/input/mice" -#define DEFAULT_PS2_DEV "/dev/psaux" -#define DEFAULT_GPM_DATA_DEV "/dev/gpmdata" -#define DEFAULT_GPM_CTL_DEV "/dev/gpmdata" - -static const char *mouseDevs[] = { - DEFAULT_MOUSE_DEV, - DEFAULT_PS2_DEV, - DEFAULT_GPM_DATA_DEV, - NULL -}; - -typedef enum { - MOUSE_PROTO_UNKNOWN = 0, - MOUSE_PROTO_SERIAL, - MOUSE_PROTO_PS2, - MOUSE_PROTO_MSC, - MOUSE_PROTO_GPM, - MOUSE_PROTO_EXPPS2, -} protocolTypes; - -static struct { - protocolTypes proto; - const char *name; -} devproto[] = { - { MOUSE_PROTO_UNKNOWN, NULL }, - { MOUSE_PROTO_PS2, "PS/2" }, - { MOUSE_PROTO_MSC, "MouseSystems" }, - { MOUSE_PROTO_GPM, "GPM" }, - { MOUSE_PROTO_EXPPS2, "ExplorerPS/2" }, -}; - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - int fd = -1; - const char **pdev; - - for (pdev = mouseDevs; *pdev; pdev++) { - SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL)); - if (fd == -1) { -#ifdef DEBUG - ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno)); -#endif - } else - break; - } - - if (*pdev) { - close(fd); - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", *pdev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, *pdev); - } - - return *pdev; -} - -static const char * -lnxMouseMagic(InputInfoPtr pInfo) -{ - int fd = -1; - const char *dev; - char *realdev; - struct stat sbuf; - int i; - int proto = MOUSE_PROTO_UNKNOWN; - - dev = xf86SetStrOption(pInfo->conf_idev->commonOptions, "Device", NULL); - if (!dev) { -#ifdef DEBUG - ErrorF("xf86SetStrOption failed to return the device name\n"); -#endif - return NULL; - } - /* Look at the device name to guess the protocol. */ - realdev = NULL; - if (strcmp(dev, DEFAULT_MOUSE_DEV) == 0) { - if (lstat(dev, &sbuf) != 0) { -#ifdef DEBUG - ErrorF("lstat failed for %s (%s)\n", dev, strerror(errno)); -#endif - return NULL; - } - if (S_ISLNK(sbuf.st_mode)) { - realdev = xnfalloc(PATH_MAX + 1); - i = readlink(dev, realdev, PATH_MAX); - if (i <= 0) { -#ifdef DEBUG - ErrorF("readlink failed for %s (%s)\n", dev, strerror(errno)); -#endif - xfree(realdev); - return NULL; - } - realdev[i] = '\0'; - } - } - if (!realdev) - realdev = xnfstrdup(dev); - else { - /* If realdev doesn't contain a '/' then prepend "/dev/" */ - if (!strchr(realdev, '/')) { - char *tmp = xnfalloc(strlen(realdev) + 5 + 1); - sprintf(tmp, "/dev/%s", realdev); - xfree(realdev); - realdev = tmp; - } - } - - if (strcmp(realdev, DEFAULT_MOUSE_DEV) == 0) - proto = MOUSE_PROTO_EXPPS2; - else if (strcmp(realdev, DEFAULT_PS2_DEV) == 0) - proto = MOUSE_PROTO_EXPPS2; - else if (strcmp(realdev, DEFAULT_GPM_DATA_DEV) == 0) - proto = MOUSE_PROTO_MSC; - else if (strcmp(realdev, DEFAULT_GPM_CTL_DEV) == 0) - proto = MOUSE_PROTO_GPM; - xfree(realdev); - /* - * If the protocol can't be guessed from the device name, - * try to characterise it. - */ - if (proto == MOUSE_PROTO_UNKNOWN) { - SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL)); - if (isatty(fd)) { - /* Serial PnP has already failed, so give up. */ - } else { - if (fstat(fd, &sbuf) != 0) { -#ifdef DEBUG - ErrorF("fstat failed for %s (%s)\n", dev, strerror(errno)); -#endif - close(fd); - return NULL; - } - if (S_ISFIFO(sbuf.st_mode)) { - /* Assume GPM data in MSC format. */ - proto = MOUSE_PROTO_MSC; - } else { - /* Default to PS/2 */ - proto = MOUSE_PROTO_PS2; - } - } - close(fd); - } - if (proto == MOUSE_PROTO_UNKNOWN) { - xf86Msg(X_ERROR, "%s: Cannot find mouse protocol.\n", - pInfo->name); - return NULL; - } else { - for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); i++) { - if (devproto[i].proto == proto) { - xf86Msg(X_INFO, - "%s: Setting mouse protocol to \"%s\"\n", - pInfo->name, devproto[i].name); - return devproto[i].name; - } - } - } - return NULL; -} - -static const char * -GuessProtocol(InputInfoPtr pInfo, int flags) -{ - return lnxMouseMagic(pInfo); -} - -static const char * -SetupAuto(InputInfoPtr pInfo, int *protoPara) -{ - return lnxMouseMagic(pInfo); -} - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - p->DefaultProtocol = DefaultProtocol; - p->FindDevice = FindDevice; - p->GuessProtocol = GuessProtocol; - p->SetupAuto = SetupAuto; - return p; -} - diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index 429593784..4c64fa447 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -75,19 +75,9 @@ extern int iopl(int __level); #ifdef __alpha__ -# ifdef LIBC_IS_FIXED extern void sethae(unsigned long hae); -# else -# include -# define sethae(x) syscall(301,x); -# endif -/* define to test the Sparse addressing on a non-Jensen */ -# ifdef TEST_JENSEN_CODE -# define isJensen (1) -# else # define isJensen (axpSystem == JENSEN) -# endif # define BUS_BASE bus_base diff --git a/hw/xfree86/os-support/lynxos/Makefile.am b/hw/xfree86/os-support/lynxos/Makefile.am deleted file mode 100644 index 4085c49a9..000000000 --- a/hw/xfree86/os-support/lynxos/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -EXTRA_DIST = \ - lynx_init.c \ - lynx_mmap.c \ - lynx_mouse.c \ - lynx_noinline.c \ - lynx_ppc.c \ - lynx_video.c \ - lynx_ppc.S diff --git a/hw/xfree86/os-support/lynxos/lynx_init.c b/hw/xfree86/os-support/lynxos/lynx_init.c deleted file mode 100644 index 03f72ca19..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_init.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * 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 Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER 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 -#endif - -#include -#include - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static int VTnum = -1; - -void -xf86OpenConsole() -{ - struct vt_mode VT; - char vtname1[11]; - int fd, pgrp; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* - * setup the virtual terminal manager - * NOTE: - * We use the out-of-the-box atc terminal driver, - * not the GE contributed vdt driver. - * Also, we do setup signals for VT switching which - * is not really necessary because we don't feed the - * VT switch keystrokes to the kernel in xf86Events.c - * (it bombs occasionally...) - */ - if (VTnum != -1) - { - xf86Info.vtno = VTnum; - from = X_CMDLINE; - } - else - { - /* We could use /dev/con which is usually a symlink - * to /dev/atc0 but one could configure the system - * to use a serial line as console device, so to - * be sure we take /dev/atc0. - */ - if ((fd = open("/dev/atc0",O_WRONLY,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open /dev/atc0 (%s)\n", - strerror(errno)); - } - if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } - close(fd); - } - xf86Msg(from, "using VT number %d\n", xf86Info.vtno); - - sprintf(vtname1,"/dev/atc%d",xf86Info.vtno); - - pgrp = getpgrp(); /* POSIX version ! */ - ioctl(xf86Info.consoleFd, TIOCSPGRP, &pgrp); - - if ((xf86Info.consoleFd = open(vtname1,O_RDWR|O_NDELAY,0)) < 0) - { - FatalError( - "xf86OpenConsole: Cannot open %s (%s)\n", - vtname1, strerror(errno)); - } - /* change ownership of the vt */ - chown(vtname1, getuid(), getgid()); - - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_GETMODE failed\n"); - } - - /* for future use... */ - signal(SIGUSR1, xf86VTRequest); - - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) - { - FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); - } - } - else - { - /* serverGeneration != 1 */ - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) - { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); - } - /* - * If the server doesn't have the VT when the reset occurs, - * this is to make sure we don't continue until the activate - * signal is received. - */ - if (!xf86Screens[0]->vtSema) - sleep(5); - } - return; -} - -void -xf86CloseConsole() -{ - struct vt_mode VT; - -#if 0 - ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno); - ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0); -#endif - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) - { - VT.mode = VT_AUTO; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ - } - close(xf86Info.consoleFd); /* make the vt-manager happy */ - return; -} - -int -xf86ProcessArgument(int argc, char *argv[], int i) -{ - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) - { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) - { - UseMsg(); - VTnum = -1; - return(0); - } - return(1); - } - return(0); -} - -void -xf86UseMsg() -{ - ErrorF("vtXX use the specified VT number\n"); - return; -} - diff --git a/hw/xfree86/os-support/lynxos/lynx_mmap.c b/hw/xfree86/os-support/lynxos/lynx_mmap.c deleted file mode 100644 index 3364399aa..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_mmap.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * 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 Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER 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 -#endif - -#include - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Read BIOS using smem_create facility - */ - -_X_EXPORT int -xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, - int Len) -{ -#if defined(__powerpc__) - xf86Msg(X_WARNING, "xf86ReadBios: no BIOS-probe on PowerPC\n"); - return(-1); -#else - char *p; - int mlen; - - mlen = (Offset + Len + 4095) & ~4095; - p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ); - if (p == NULL) - { - /* check if there is a stale segment around */ - if (smem_remove("BIOS-probe") == 0) { - xf86Msg(X_INFO, - "xf86ReadBios: removed stale smem_ segment\n"); - p = smem_create("BIOS-probe", (char *)Base, mlen, SM_READ); - } - if (p == NULL) { - xf86Msg(X_WARNING, "xf86ReadBios: Failed to smem_create " - "Base %x len %x %s \n", - Base, mlen, strerror(errno)); - return(-1); - } - } - memcpy(Buf, p + Offset, Len); - smem_create(NULL, p, 0, SM_DETACH); - smem_remove("BIOS-probe"); - return(Len); -#endif -} diff --git a/hw/xfree86/os-support/lynxos/lynx_mouse.c b/hw/xfree86/os-support/lynxos/lynx_mouse.c deleted file mode 100644 index b48202977..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_mouse.c +++ /dev/null @@ -1,33 +0,0 @@ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX Need to check this. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; -} - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; - return p; -} - diff --git a/hw/xfree86/os-support/lynxos/lynx_noinline.c b/hw/xfree86/os-support/lynxos/lynx_noinline.c deleted file mode 100644 index d4db82cca..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_noinline.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 1998 by Metro Link Incorporated - * - * 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 Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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 -#endif - -#if /* NO_INLINE && */ defined(__powerpc__) - -#include "xf86Pci.h" - -extern volatile unsigned char *ioBase; - -_X_EXPORT void -eieio() -{ - __asm__ __volatile__ ("eieio"); -} - -_X_EXPORT unsigned long -ldl_brx(volatile unsigned char *base, int ndx) -{ - register unsigned long tmp = *(volatile unsigned long *)(base+ndx); - return( ((tmp & 0x000000ff) << 24) | - ((tmp & 0x0000ff00) << 8) | - ((tmp & 0x00ff0000) >> 8) | - ((tmp & 0xff000000) >> 24) ); -} - -_X_EXPORT unsigned short -ldw_brx(volatile unsigned char *base, int ndx) -{ - register unsigned short tmp = *(volatile unsigned short *)(base+ndx); - return((tmp << 8) | (tmp >> 8)); -} - -_X_EXPORT void -stl_brx(unsigned long val, volatile unsigned char *base, int ndx) -{ - unsigned char *p = (unsigned char *)&val; - unsigned long tmp = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0); - *(volatile unsigned long *)(base+ndx) = tmp; -} - -_X_EXPORT void -stw_brx(unsigned short val, volatile unsigned char *base, int ndx) -{ - unsigned char *p = (unsigned char *)&val; - unsigned short tmp = (p[1] << 8) | p[0]; - *(volatile unsigned short *)(base+ndx) = tmp; -} - -_X_EXPORT void -outb(IOADDRESS port, unsigned char value) -{ - *((volatile unsigned char *)(ioBase + port)) = value; eieio(); -} - -_X_EXPORT void -outw(IOADDRESS port, unsigned short value) -{ - stw_brx(value, ioBase, port); eieio(); -} - -_X_EXPORT void -outl(IOADDRESS port, unsigned int value) -{ - stl_brx(value, ioBase, port); eieio(); -} - -_X_EXPORT unsigned char -inb(IOADDRESS port) -{ - unsigned char val; - - val = *((volatile unsigned char *)(ioBase + port)); eieio(); - return(val); -} - -_X_EXPORT unsigned short -inw(IOADDRESS port) -{ - unsigned short val; - - val = ldw_brx(ioBase, port); eieio(); - return(val); -} - -_X_EXPORT unsigned int -inl(IOADDRESS port) -{ - unsigned int val; - - val = ldl_brx(ioBase, port); eieio(); - return(val); -} - -_X_EXPORT unsigned long -ldl_u(void *p) -{ - return (((*(unsigned char *)(p)) | - (*((unsigned char *)(p)+1)<<8) | - (*((unsigned char *)(p)+2)<<16) | - (*((unsigned char *)(p)+3)<<24))); -} - -_X_EXPORT unsigned long -ldq_u(void *p) -{ - return ldl_u(p); -} - -_X_EXPORT unsigned short -ldw_u(void *p) -{ - return(((*(unsigned char *)(p)) | - (*((unsigned char *)(p)+1)<<8))); -} - -_X_EXPORT void -stl_u(unsigned long v, void *p) -{ - - (*(unsigned char *)(p)) = (v); - (*((unsigned char *)(p)+1)) = ((v) >> 8); - (*((unsigned char *)(p)+2)) = ((v) >> 16); - (*((unsigned char *)(p)+3)) = ((v) >> 24); -} - -_X_EXPORT void -stq_u(unsigned long v, void *p) -{ - stl_u(v,p); -} - -_X_EXPORT void -stw_u(unsigned short v, void *p) -{ - (*(unsigned char *)(p)) = (v); - (*((unsigned char *)(p)+1)) = ((v) >> 8); -} - - -_X_EXPORT void -mem_barrier(void) -{ - __asm__ __volatile__("eieio"); -} - -_X_EXPORT void -write_mem_barrier(void) -{ - __asm__ __volatile__("eieio"); -} - -#endif /* NO_INLINE && __powerpc__ */ diff --git a/hw/xfree86/os-support/lynxos/lynx_ppc.S b/hw/xfree86/os-support/lynxos/lynx_ppc.S deleted file mode 100644 index 3865850d1..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_ppc.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_ppc.S,v 1.1 1999/07/10 07:24:49 dawes Exp $ */ -/* - * Copyright 1998 by Metro Link Incorporated - * - * 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 Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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. - */ - - .file "ppc.s" -.toc - .csect .text[PR] - .balign 4 - .globl ppc_flush_icache - .globl .ppc_flush_icache -.csect ppc_flush_icache[DS] -ppc_flush_icache: - .long .ppc_flush_icache, TOC[tc0], 0 -.csect .text[PR] -.ppc_flush_icache: - mflr 0 - stw 31,-4(1) - stw 0,8(1) - stwu 1,-64(1) - mr 31,1 - stw 3,88(31) - li 6, 0 /* __inst_dcbf (addr, 0); */ - dcbf 3, 6 - li 5, 32 /* __inst_dcbf (addr, LINESIZE); */ - dcbf 3, 5 - sync /* __inst_sync (); */ - li 4,0 /* __inst_icbi (addr, 0); */ - icbi 3,4 - li 7,32 /* __inst_icbi (addr, LINESIZE); */ - icbi 3,7 - sync /* __inst_sync (); */ - isync /* __inst_isync (); */ -L..1: - lwz 1,0(1) - lwz 0,8(1) - mtlr 0 - lwz 31,-4(1) - blr -LT..ppc_flush_icache: - .long 0 - .byte 0,0,32,97,128,1,1,1 - .long 0 - .long LT..ppc_flush_icache-.ppc_flush_icache - .short 16 - .byte "ppc_flush_icache" - .byte 31 -_section_.text: - .csect .data[RW] - .long _section_.text diff --git a/hw/xfree86/os-support/lynxos/lynx_ppc.c b/hw/xfree86/os-support/lynxos/lynx_ppc.c deleted file mode 100644 index 6300f38c8..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_ppc.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 1998 by Metro Link Incorporated - * - * 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 Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED 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. - */ - -void ppc_flush_icache() -{ -__asm__ __volatile__ (" \ - mflr 0 ;\ - stw 31,-4(1) ;\ - stw 0,8(1) ;\ - stwu 1,-64(1) ;\ - mr 31,1 ;\ - stw 3,88(31) ;\ - li 6, 0 ;\ - dcbf 3, 6 ;\ - li 5, 32 ;\ - dcbf 3, 5 ;\ - sync ;\ - li 4,0 ;\ - icbi 3,4 ;\ - li 7,32 ;\ - icbi 3,7 ;\ - sync ;\ - isync ;\ - lwz 1,0(1) ;\ - lwz 0,8(1) ;\ - mtlr 0 ;\ - lwz 31,-4(1) ;\ - blr ;\ -"); -} diff --git a/hw/xfree86/os-support/lynxos/lynx_video.c b/hw/xfree86/os-support/lynxos/lynx_video.c deleted file mode 100644 index 4602076c7..000000000 --- a/hw/xfree86/os-support/lynxos/lynx_video.c +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright 1993 by Thomas Mueller - * - * 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 Thomas Mueller not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Mueller makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS MUELLER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS MUELLER 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 -#endif - -#include -#include "input.h" -#include "scrnintstr.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#if defined(__powerpc__) - -# if defined(USE_MACHINE_ABSOLUTE) -# include -# else -# define __USER_SPACE_INCLUDE -# include -# endif - -void ppcPciIoMap(int bus); -#endif - -#if 0 -#define DEBUG -#endif - -#ifdef HAS_MTRR_SUPPORT -#include -#define X_MTRR_ID "XFree86" - -static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); -static void undoWC(int, pointer); -static Bool cleanMTRR(void); -static int devMemFd = -1; -#define MTRR_DEVICE "/dev/mtrr" -#endif - - -#if !defined(NO_MMAP) -#include - -int smem_remove(char *name) -{ - return(0); -} - -char *smem_create(char *name, char *arg_addr, long size, int mode) -{ - int fd; - void *addr = 0; - char *retval; - size_t len = size; - int prot = PROT_READ|PROT_WRITE|PROT_UNCACHE; - int flags = MAP_SHARED; - off_t off = (off_t)arg_addr; - - if ((fd = open("/dev/mem" , O_RDWR)) < 0) - { - retval = (char *)-1; - } - else - { - if (mode == SM_DETACH) - { - munmap(arg_addr, len); - retval = 0; - } - else - { - if ((retval = mmap (addr, len, prot, flags, fd, off) ) == MAP_FAILED) - { - retval = (char *)-1; - } - } - - close(fd); - } - - return(retval); -} - -#endif - - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -typedef struct -{ - char name[16]; - unsigned long Base; - unsigned long Size; - char *ptr; - int RefCnt; -} -_SMEMS; - -#define MAX_SMEMS 16 - -static _SMEMS smems[MAX_SMEMS]; - - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -static void -smemCleanup(void) -{ - int i; - - for (i = 0; i < MAX_SMEMS; i++) { - if (*smems[i].name && smems[i].ptr) { - (void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH); - (void)smem_remove(smems[i].name); - *smems[i].name = '\0'; - smems[i].ptr = NULL; - smems[i].Base = 0; - smems[i].Size = 0; - smems[i].RefCnt = 0; - } - } -} - -static pointer -MapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - static int once; - int free_slot = -1; - int i; - - if (!once) - { - atexit(smemCleanup); - once = 1; - } - for (i = 0; i < MAX_SMEMS; i++) - { - if (!*smems[i].name && free_slot == -1) - free_slot = i; - if (smems[i].Base == Base && smems[i].Size == Size - && *smems[i].name) { - smems[i].RefCnt++; - return smems[i].ptr; - } - } - if (i == MAX_SMEMS && free_slot == -1) - { - FatalError("MapVidMem: failed to smem_create Base %x Size %x (out of SMEMS entries)\n", - Base, Size); - } - - i = free_slot; - sprintf(smems[i].name, "Video-%d", i); - smems[i].Base = Base; - smems[i].Size = Size; - - xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x\n", - Base, Size); - -#if defined(__powerpc__) - if (((unsigned long)Base & PHYS_IO_MEM_START) != PHYS_IO_MEM_START) { - Base = Base | PHYS_IO_MEM_START; - } -#endif - - smems[i].ptr = smem_create(smems[i].name, (char *)Base, Size, SM_READ|SM_WRITE); - smems[i].RefCnt = 1; - if (smems[i].ptr == NULL) - { - /* check if there is a stale segment around */ - if (smem_remove(smems[i].name) == 0) { - xf86Msg(X_INFO, - "MapVidMem: removed stale smem_ segment %s\n", - smems[i].name); - smems[i].ptr = smem_create(smems[i].name, - (char *)Base, Size, SM_READ|SM_WRITE); - } - if (smems[i].ptr == NULL) { - *smems[i].name = '\0'; - FatalError("MapVidMem: failed to smem_create Base %x Size %x (%s)\n", - Base, Size, strerror(errno)); - } - } - xf86MsgVerb(X_INFO, 3, "MapVidMem: Base=0x%x Size=0x%x Ptr=0x%x\n", - Base, Size, smems[i].ptr); - return smems[i].ptr; -} - -static void -UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - int i; - - xf86MsgVerb(X_INFO, 3, "UnMapVidMem: Base/Ptr=0x%x Size=0x%x\n", - Base, Size); - for (i = 0; i < MAX_SMEMS; i++) - { - if (*smems[i].name && smems[i].ptr == Base - && smems[i].Size == Size) - { - if (--smems[i].RefCnt > 0) - return; - - (void)smem_create(NULL, smems[i].ptr, 0, SM_DETACH); - xf86MsgVerb(X_INFO, 3, - "UnMapVidMem: smem_create(%s, 0x%08x, ... " - "SM_DETACH)\n", smems[i].name, smems[i].ptr); - (void)smem_remove(smems[i].name); - *smems[i].name = '\0'; - smems[i].RefCnt = 0; - return; - } - } - xf86MsgVerb(X_WARNING, 2, - "UnMapVidMem: no SMEM found for Base = %lx Size = %lx\n", - Base, Size); -} - - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - pVidMem->linearSupported = TRUE; - pVidMem->mapMem = MapVidMem; - pVidMem->unmapMem = UnMapVidMem; - pVidMem->setWC = 0; - pVidMem->undoWC = 0; -#ifdef HAS_MTRR_SUPPORT - if (cleanMTRR()) { - pVidMem->setWC = setWC; - pVidMem->undoWC = undoWC; - } -#endif - pVidMem->initialised = TRUE; -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts() -{ - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts() -{ - return; -} - -/***************************************************************************/ -/* I/O Permissions section for PowerPC */ -/***************************************************************************/ - -#if defined(__powerpc__) - -_X_EXPORT volatile unsigned char *ioBase = MAP_FAILED; -volatile unsigned char *pciConfBase = MAP_FAILED; - -static int IOEnabled; - - -static void -removeIOSmem(void) -{ - smem_create(NULL, (char *) ioBase, 0, SM_DETACH); - smem_remove("IOBASE"); - ioBase = MAP_FAILED; -} - -_X_EXPORT Bool -xf86EnableIO() -{ - if (IOEnabled++ == 0) { - ioBase = (unsigned char *) smem_create("IOBASE", - (char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE); - if (ioBase == MAP_FAILED) { - --IOEnabled; - xf86Msg(X_WARNING,"xf86EnableIO: Failed to map I/O\n"); - return FALSE; - } else { -#ifdef DEBUG - ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n", - ioBase); -#endif - atexit(removeIOSmem); - } - } - return TRUE; -} - -_X_EXPORT void -xf86DisableIO() -{ - if (!IOEnabled) - return; - - if (--IOEnabled == 0) - removeIOSmem(); - return; -} - -#if 0 -void -xf86DisableIOPrivs(void) -{ - return; -} -#endif -void -ppcPciIoMap(int bus) -{ - xf86EnableIO(); -} - -#endif - - -#ifdef HAS_MTRR_SUPPORT -/* memory range (MTRR) support for LynxOS (taken from BSD MTRR support) */ - -/* - * This code is experimental. Some parts may be overkill, and other parts - * may be incomplete. - */ - -/* - * getAllRanges returns the full list of memory ranges with attributes set. - */ - -static struct mem_range_desc * -getAllRanges(int *nmr) -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - - /* - * Find how many ranges there are. If this fails, then the kernel - * probably doesn't have MTRR support. - */ - mro.mo_arg[0] = 0; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) - return NULL; - *nmr = mro.mo_arg[0]; - mrd = xnfalloc(*nmr * sizeof(struct mem_range_desc)); - mro.mo_arg[0] = *nmr; - mro.mo_desc = mrd; - if (ioctl(devMemFd, MEMRANGE_GET, &mro)) { - xfree(mrd); - return NULL; - } - return mrd; -} - -/* - * cleanMTRR removes any memory attribute that may be left by a previous - * X server. Normally there won't be any, but this takes care of the - * case where a server crashed without being able finish cleaning up. - */ - -static Bool -cleanMTRR() -{ - struct mem_range_desc *mrd; - struct mem_range_op mro; - int nmr, i; - - /* This shouldn't happen */ - if (devMemFd < 0) { - if ((devMemFd = open(MTRR_DEVICE, O_RDONLY)) < 0) { -perror("open MTRR"); - return FALSE; - } - } - - if (!(mrd = getAllRanges(&nmr))) - return FALSE; - - for (i = 0; i < nmr; i++) { - if (strcmp(mrd[i].mr_owner, X_MTRR_ID) == 0 && - (mrd[i].mr_flags & MDF_ACTIVE)) { -#ifdef DEBUG - ErrorF("Clean for (0x%lx,0x%lx)\n", - (unsigned long)mrd[i].mr_base, - (unsigned long)mrd[i].mr_len); -#endif - if (mrd[i].mr_flags & MDF_FIXACTIVE) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - mrd[i].mr_flags = MDF_UNCACHEABLE; - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = mrd + i; - ioctl(devMemFd, MEMRANGE_SET, &mro); - } - } -#ifdef DEBUG - sleep(10); -#endif - xfree(mrd); - return TRUE; -} - -typedef struct x_RangeRec { - struct mem_range_desc mrd; - Bool wasWC; - struct x_RangeRec * next; -} RangeRec, *RangePtr; - -static void -freeRangeList(RangePtr range) -{ - RangePtr rp; - - while (range) { - rp = range; - range = rp->next; - xfree(rp); - } -} - -static RangePtr -dupRangeList(RangePtr list) -{ - RangePtr new = NULL, rp, p; - - rp = list; - while (rp) { - p = xnfalloc(sizeof(RangeRec)); - *p = *rp; - p->next = new; - new = p; - rp = rp->next; - } - return new; -} - -static RangePtr -sortRangeList(RangePtr list) -{ - RangePtr rp1, rp2, copy, sorted = NULL, minp, prev, minprev; - unsigned long minBase; - - /* Sort by base address */ - rp1 = copy = dupRangeList(list); - while (rp1) { - minBase = rp1->mrd.mr_base; - minp = rp1; - minprev = NULL; - prev = rp1; - rp2 = rp1->next; - while (rp2) { - if (rp2->mrd.mr_base < minBase) { - minBase = rp2->mrd.mr_base; - minp = rp2; - minprev = prev; - } - prev = rp2; - rp2 = rp2->next; - } - if (minprev) { - minprev->next = minp->next; - rp1 = copy; - } else { - rp1 = minp->next; - } - minp->next = sorted; - sorted = minp; - } - return sorted; -} - -/* - * findRanges returns a list of ranges that overlap the specified range. - */ - -static void -findRanges(unsigned long base, unsigned long size, RangePtr *ucp, RangePtr *wcp) -{ - struct mem_range_desc *mrd; - int nmr, i; - RangePtr rp, *p; - - if (!(mrd = getAllRanges(&nmr))) - return; - - for (i = 0; i < nmr; i++) { - if ((mrd[i].mr_flags & MDF_ACTIVE) && - mrd[i].mr_base < base + size && - mrd[i].mr_base + mrd[i].mr_len > base) { - if (mrd[i].mr_flags & MDF_WRITECOMBINE) - p = wcp; - else if (mrd[i].mr_flags & MDF_UNCACHEABLE) - p = ucp; - else - continue; - rp = xnfalloc(sizeof(RangeRec)); - rp->mrd = mrd[i]; - rp->next = *p; - *p = rp; - } - } - xfree(mrd); -} - -/* - * This checks if the existing overlapping ranges fully cover the requested - * range. Is this overkill? - */ - -static Bool -fullCoverage(unsigned long base, unsigned long size, RangePtr overlap) -{ - RangePtr rp1, sorted = NULL; - unsigned long end; - - sorted = sortRangeList(overlap); - /* Look for gaps */ - rp1 = sorted; - end = base + size; - while (rp1) { - if (rp1->mrd.mr_base > base) { - freeRangeList(sorted); - return FALSE; - } else { - base = rp1->mrd.mr_base + rp1->mrd.mr_len; - } - if (base >= end) { - freeRangeList(sorted); - return TRUE; - } - rp1 = rp1->next; - } - freeRangeList(sorted); - return FALSE; -} - -static pointer -addWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* See of the full range is already WC */ - if (!uc && fullCoverage(base, size, wc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already set\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_WRITECOMBINE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to set write-combining range " - "(0x%lx,0x%lx)\n", base, size); - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx)\n", base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = FALSE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -delWC(int screenNum, unsigned long base, unsigned long size, MessageType from) -{ - RangePtr uc = NULL, wc = NULL, retlist = NULL; - struct mem_range_desc mrd; - struct mem_range_op mro; - - findRanges(base, size, &uc, &wc); - - /* - * See of the full range is already not WC, or if there is full - * coverage from UC ranges. - */ - if (!wc || fullCoverage(base, size, uc)) { - xf86DrvMsg(screenNum, from, - "Write-combining range (0x%lx,0x%lx) was already clear\n", - base, size); - return NULL; - } - - /* Otherwise, try to add the new range */ - mrd.mr_base = base; - mrd.mr_len = size; - strcpy(mrd.mr_owner, X_MTRR_ID); - mrd.mr_flags = MDF_UNCACHEABLE; - mro.mo_desc = &mrd; - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to remove write-combining range " - "(0x%lx,0x%lx)\n", base, size); - /* XXX Should then remove all of the overlapping WC ranges */ - return NULL; - } else { - xf86DrvMsg(screenNum, from, - "Removed Write-combining range (0x%lx,0x%lx)\n", - base, size); - retlist = xnfalloc(sizeof(RangeRec)); - retlist->mrd = mrd; - retlist->wasWC = TRUE; - retlist->next = NULL; - return retlist; - } -} - -static pointer -setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, - MessageType from) -{ - if (enable) - return addWC(screenNum, base, size, from); - else - return delWC(screenNum, base, size, from); -} - -static void -undoWC(int screenNum, pointer list) -{ - RangePtr rp; - struct mem_range_op mro; - Bool failed; - - rp = list; - while (rp) { -#ifdef DEBUG - ErrorF("Undo for (0x%lx,0x%lx), %d\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len, rp->wasWC); -#endif - failed = FALSE; - if (rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_WRITECOMBINE; - strcpy(rp->mrd.mr_owner, "unknown"); - } else { - mro.mo_arg[0] = MEMRANGE_SET_REMOVE; - } - mro.mo_desc = &rp->mrd; - - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) { - if (!rp->wasWC) { - mro.mo_arg[0] = MEMRANGE_SET_UPDATE; - rp->mrd.mr_flags = MDF_UNCACHEABLE; - strcpy(rp->mrd.mr_owner, "unknown"); - if (ioctl(devMemFd, MEMRANGE_SET, &mro)) - failed = TRUE; - } else - failed = TRUE; - } - if (failed) { - xf86DrvMsg(screenNum, X_WARNING, - "Failed to restore MTRR range (0x%lx,0x%lx)\n", - (unsigned long)rp->mrd.mr_base, - (unsigned long)rp->mrd.mr_len); - } - rp = rp->next; - } -} - -#endif /* HAS_MTRR_SUPPORT */ - diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am index 65fbe92b4..ad27cfc2b 100644 --- a/hw/xfree86/os-support/misc/Makefile.am +++ b/hw/xfree86/os-support/misc/Makefile.am @@ -12,7 +12,7 @@ ILHACK_SRCS = xf86_IlHack.c noinst_LTLIBRARIES = libmisc.la -libmisc_la_SOURCES = xf86_Util.c Delay.c $(ARCH_SRCS) +libmisc_la_SOURCES = Delay.c $(ARCH_SRCS) #AM_LDFLAGS = -r diff --git a/hw/xfree86/os-support/misc/SlowBcopy.c b/hw/xfree86/os-support/misc/SlowBcopy.c index 5cd716823..7c51fcca3 100644 --- a/hw/xfree86/os-support/misc/SlowBcopy.c +++ b/hw/xfree86/os-support/misc/SlowBcopy.c @@ -30,7 +30,7 @@ xf86SetReallySlowBcopy(void) really_slow_bcopy = 1; } -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) || defined(__amd64__) static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int len) { while(len--) @@ -45,7 +45,7 @@ static void xf86_really_slow_bcopy(unsigned char *src, unsigned char *dst, int l _X_EXPORT void xf86SlowBcopy(unsigned char *src, unsigned char *dst, int len) { -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) || defined(__amd64__) if (really_slow_bcopy) { xf86_really_slow_bcopy(src, dst, len); return; diff --git a/hw/xfree86/os-support/misc/xf86_Util.c b/hw/xfree86/os-support/misc/xf86_Util.c deleted file mode 100644 index 9e690591d..000000000 --- a/hw/xfree86/os-support/misc/xf86_Util.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 1993 by David Wexelblat - * - * 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 Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 file is for utility functions that will be shared by other pieces - * of the system. Putting things here ensure that all the linking order - * dependencies are dealt with, as this library will be linked in last. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -/* To prevent empty source file warnings */ -int _xf86misc; - -#if 0 -/* For use only with gcc */ -#ifdef __GNUC__ - -#include "os.h" - -char * -debug_alloca(char *file, int line, int size) -{ - char *ptr; - - ptr = Xalloc(size); - ErrorF("Alloc: %s line %d; ptr = 0x%x, length = %d\n", file, line, - ptr, size); - return ptr; -} - -void -debug_dealloca(char *file, int line, char *ptr) -{ - ErrorF("Dealloc: %s line %d; ptr = 0x%x\n", file, line, ptr); - Xfree(ptr); -} -#endif -#endif - -#if defined(ISC) || defined(Lynx) - -#include - -/* Needed for apm_driver.c */ -/* These functions are modeled after the functions inside gnu's libc */ - -static double -copysign(double x, double y) -{ - x = fabs(x); - return y < 0 ? - x : x; -} - -double -RInt(double x) -{ - double s,t; - const double one = 1.0; - const static double L = 4503599627370496.0E0; - - if (x!=x) - return(x); - if (copysign(x,one) >= L) - return(x); - s = copysign(L,x); - t = x + s; - return (t - s); -} -#endif diff --git a/hw/xfree86/os-support/sco/Makefile.am b/hw/xfree86/os-support/sco/Makefile.am index 9cb5011fb..b5d40f7a5 100644 --- a/hw/xfree86/os-support/sco/Makefile.am +++ b/hw/xfree86/os-support/sco/Makefile.am @@ -2,5 +2,4 @@ EXTRA_DIST = \ VTsw_sco.c \ sco_init.c \ sco_iop.c \ - sco_mouse.c \ sco_video.c diff --git a/hw/xfree86/os-support/sco/sco_mouse.c b/hw/xfree86/os-support/sco/sco_mouse.c deleted file mode 100644 index af57cdedf..000000000 --- a/hw/xfree86/os-support/sco/sco_mouse.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright 2001 by J. Kean Johnston - * - * 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 J. Kean Johnston not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. J. Kean Johnston makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL J. KEAN JOHNSTON 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 -#endif - -#include -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "mipointer.h" -#include -#include - -static int -SupportedInterfaces (void) -{ - return MSE_MISC; -} - -static const char *internalNames[] = { - "OSMouse", - NULL -}; - -static const char ** -BuiltinNames (void) -{ - return internalNames; -} - -static Bool -CheckProtocol (const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) { - if (xf86NameCmp (protocol, internalNames[i]) == 0) - return TRUE; - } - - return FALSE; -} - -static const char * -DefaultProtocol (void) -{ - return "OSMouse"; -} - -static const char * -evtErrStr (int evterr) -{ - switch (evterr) { - case -1: return "error in config files"; - case -2: return "no mouse devices to attach"; - case -3: return "unable to open device"; - case -4: return "unable to open event queue"; - case -999: return "unable to initialize event driver"; - default: return "unknown event driver error"; - } -} - -static int -OsMouseProc (DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - unsigned char map[9]; - dmask_t dmask; - MessageType from = X_CONFIG; - int evi; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - dmask = D_ABS | D_REL | D_BUTTON; - if ((evi = ev_initf(xf86Info.consoleFd)) < 0) { - FatalError ("OsMouseProc: Event driver initialization failed (%s)\n", - evtErrStr(evi)); - } - pInfo->fd = ev_open (&dmask); - if (pInfo->fd < 0) { - FatalError ("OsMouseProc: DEVICE_INIT failed (%s)\n", evtErrStr(pInfo->fd)); - } - - pMse->buttons = xf86SetIntOption (pInfo->options, "Buttons", 0); - if (pMse->buttons == 0) { - pMse->buttons = 8; - from = X_DEFAULT; - } - xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons); - - for (evi = 0; evi <= 8; evi++) - map[evi] = evi; - - InitPointerDeviceStruct((DevicePtr)pPointer, map, 8, - miPointerGetMotionEvents, pMse->Ctrl, - miPointerGetMotionBufferSize()); - - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - - xf86MotionHistoryAllocate(pInfo); - - ev_flush(); - ev_suspend(); - break; - - case DEVICE_ON: - pMse->lastButtons = 0; - pMse->lastMappedButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - ev_resume(); - AddEnabledDevice (pInfo->fd); - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - pPointer->public.on = FALSE; - RemoveEnabledDevice (pInfo->fd); - if (what == DEVICE_CLOSE) { - ev_close(); - pInfo->fd = -1; - } else { - ev_suspend(); - } - break; - } - - return Success; -} - -static void -OsMouseReadInput (InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - EVENT *evp; - - pMse = pInfo->private; - - while ((evp = ev_read()) != (EVENT *)0) { - int buttons = EV_BUTTONS(*evp); - int dx = EV_DX(*evp), dy = -(EV_DY(*evp)), dz = 0; - - if (buttons & WHEEL_FWD) - dz = -1; - else if (buttons & WHEEL_BACK) - dz = 1; - - buttons &= ~(WHEEL_FWD | WHEEL_BACK); - - pMse->PostEvent (pInfo, buttons, dx, dy, dz, 0); - ev_pop(); - } -} - -static Bool -OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse; - - /* This is called when the protocol is "OSMouse". */ - - pMse = pInfo->private; - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = ev_initf(xf86Info.consoleFd); - if (pInfo->fd != -1) { - dmask_t dmask = (D_ABS | D_REL | D_BUTTON); - pInfo->fd = ev_open(&dmask); - } else { - pInfo->fd = -999; - } - - if (pInfo->fd < 0) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open event manager (%s)\n", - pInfo->name, evtErrStr(pInfo->fd)); - else { - xf86Msg(X_ERROR, "%s: cannot open event manager (%s)\n", - pInfo->name, evtErrStr(pInfo->fd)); - xfree(pMse); - return FALSE; - } - } - ev_close(); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->device_control = OsMouseProc; - pInfo->read_input = OsMouseReadInput; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit (int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; - p->PreInit = OsMousePreInit; - - return p; -} diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c index 002e3a275..316526bdc 100644 --- a/hw/xfree86/os-support/shared/posix_tty.c +++ b/hw/xfree86/os-support/shared/posix_tty.c @@ -114,9 +114,6 @@ GetBaud (int baudrate) _X_EXPORT int xf86OpenSerial (pointer options) { -#ifdef Lynx - struct sgttyb ms_sgtty; -#endif struct termios t; int fd, i; char *dev; @@ -155,12 +152,6 @@ xf86OpenSerial (pointer options) #endif } -#ifdef Lynx - /* LynxOS does not assert DTR without this */ - ioctl (fd, TIOCGETP, (char *) &ms_sgtty); - ioctl (fd, TIOCSDTR, (char *) &ms_sgtty); -#endif - /* set up default port parameters */ SYSCALL (tcgetattr (fd, &t)); t.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR\ @@ -343,7 +334,7 @@ xf86SetSerial (int fd, pointer options) if ((xf86SetBoolOption (options, "ClearDTR", FALSE))) { #ifdef CLEARDTR_SUPPORT -# if !defined(Lynx) || defined(TIOCMBIC) +# if defined(TIOCMBIC) val = TIOCM_DTR; SYSCALL (ioctl(fd, TIOCMBIC, &val)); # else diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c index c97f50302..f51131c6b 100644 --- a/hw/xfree86/os-support/shared/sigio.c +++ b/hw/xfree86/os-support/shared/sigio.c @@ -101,6 +101,7 @@ xf86SIGIO (int sig) int i; fd_set ready; struct timeval to; + int save_errno = errno; /* do not clobber the global errno */ int r; ready = xf86SigIOMask; @@ -117,6 +118,8 @@ xf86SIGIO (int sig) if (r > 0) { xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r); } + /* restore global errno */ + errno = save_errno; } static int diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am index 68f6b4cd0..ca3dd31d0 100644 --- a/hw/xfree86/os-support/solaris/Makefile.am +++ b/hw/xfree86/os-support/solaris/Makefile.am @@ -19,7 +19,7 @@ solaris-@SOLARIS_INOUT_ARCH@.il: solaris-@SOLARIS_INOUT_ARCH@.S noinst_LTLIBRARIES = libsolaris.la libsolaris_la_SOURCES = sun_bios.c sun_init.c \ - sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \ + sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \ $(srcdir)/../shared/kmod_noop.c \ $(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \ $(srcdir)/../shared/stdResource.c \ diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c deleted file mode 100644 index a5955ef2c..000000000 --- a/hw/xfree86/os-support/solaris/sun_mouse.c +++ /dev/null @@ -1,717 +0,0 @@ -/* - * Copyright 1999-2001 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. - */ -/* Copyright 2004-2005 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons - * to whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * 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 - * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. - * - * Except as contained in this notice, the name of a copyright holder - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * of the copyright holder. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86_OSlib.h" -#include "xf86OSmouse.h" - -#if defined(__SOL8__) || !defined(__i386) - -#include "xisb.h" -#include "mipointer.h" -#include -#include -#include - -/* Wheel mouse support in VUID drivers in Solaris 9 updates & Solaris 10 */ -#ifdef WHEEL_DEVID /* Defined in vuid_event.h if VUID wheel support present */ -# define HAVE_VUID_WHEEL -#endif -#ifdef HAVE_VUID_WHEEL -# include -#endif - -/* Support for scaling absolute coordinates to screen size in - * Solaris 10 updates and beyond */ -#if !defined(HAVE_ABSOLUTE_MOUSE_SCALING) -# ifdef MSIOSRESOLUTION /* Defined in msio.h if scaling support present */ -# define HAVE_ABSOLUTE_MOUSE_SCALING -# endif -#endif - -/* Names of protocols that are handled internally here. */ - -static const char *internalNames[] = { - "VUID", - NULL -}; - -static const char *solarisMouseDevs[] = { - /* Device file: Protocol: */ - "/dev/mouse", "VUID", /* USB or SPARC */ -#if defined(__i386) || defined(__x86) - "/dev/kdmouse", "PS/2", /* PS/2 */ -#endif - NULL -}; - -typedef struct _VuidMseRec { - struct _VuidMseRec *next; - InputInfoPtr pInfo; - Firm_event event; - unsigned char * buffer; - char * strmod; - Bool(*wrapped_device_control)(DeviceIntPtr device, int what); -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING - Ms_screen_resolution absres; -#endif -} VuidMseRec, *VuidMsePtr; - -static VuidMsePtr vuidMouseList = NULL; - -static int vuidMouseProc(DeviceIntPtr pPointer, int what); -static void vuidReadInput(InputInfoPtr pInfo); - -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING -static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse); -static void vuidMouseAdjustFrame(int index, int x, int y, int flags); - -static int vuidMouseGeneration = 0; -static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey; -#define vuidMouseGetScreenPrivate(s) ( \ - dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey)) -#define vuidMouseSetScreenPrivate(s,p) \ - dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, (void *) p) -#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */ - -static inline -VuidMsePtr getVuidMsePriv(InputInfoPtr pInfo) -{ - VuidMsePtr m = vuidMouseList; - - while ((m != NULL) && (m->pInfo != pInfo)) { - m = m->next; - } - - return m; -} - - -/* - * Initialize and enable the mouse wheel, if present. - * - * Returns 1 if mouse wheel was successfully enabled. - * Returns 0 if an error occurred or if there is no mouse wheel. - */ -static int -vuidMouseWheelInit(InputInfoPtr pInfo) -{ -#ifdef HAVE_VUID_WHEEL - wheel_state wstate; - int nwheel = -1; - int i; - - wstate.vers = VUID_WHEEL_STATE_VERS; - wstate.id = 0; - wstate.stateflags = -1; - - SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELCOUNT, &nwheel)); - if (i != 0) - return (0); - - SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELSTATE, &wstate)); - if (i != 0) { - xf86Msg(X_WARNING, "%s: couldn't get wheel state\n", pInfo->name); - return (0); - } - - wstate.stateflags |= VUID_WHEEL_STATE_ENABLED; - - SYSCALL(i = ioctl(pInfo->fd, VUIDSWHEELSTATE, &wstate)); - if (i != 0) { - xf86Msg(X_WARNING, "%s: couldn't enable wheel\n", pInfo->name); - return (0); - } - - return (1); -#else - return (0); -#endif -} - - -/* This function is called when the protocol is "VUID". */ -static Bool -vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse = pInfo->private; - VuidMsePtr pVuidMse; - int buttons, i; - - pVuidMse = xcalloc(sizeof(VuidMseRec), 1); - if (pVuidMse == NULL) { - xf86Msg(X_ERROR, "%s: cannot allocate VuidMouseRec\n", pInfo->name); - xfree(pMse); - return FALSE; - } - - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - /* Check if the device can be opened. */ - pInfo->fd = xf86OpenSerial(pInfo->options); - if (pInfo->fd == -1) { - if (xf86GetAllowMouseOpenFail()) - xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); - else { - xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); - xfree(pVuidMse); - xfree(pMse); - return FALSE; - } - } - - pVuidMse->buffer = (unsigned char *)&pVuidMse->event; - - pVuidMse->strmod = xf86SetStrOption(pInfo->options, "StreamsModule", NULL); - if (pVuidMse->strmod) { - SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod)); - if (i < 0) { - xf86Msg(X_ERROR, - "%s: cannot push module '%s' onto mouse device: %s\n", - pInfo->name, pVuidMse->strmod, strerror(errno)); - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - xfree(pVuidMse->strmod); - xfree(pVuidMse); - xfree(pMse); - return FALSE; - } - } - - buttons = xf86SetIntOption(pInfo->options, "Buttons", 0); - if (buttons == 0) { - SYSCALL(i = ioctl(pInfo->fd, MSIOBUTTONS, &buttons)); - if (i == 0) { - pInfo->conf_idev->commonOptions = - xf86ReplaceIntOption(pInfo->conf_idev->commonOptions, - "Buttons", buttons); - xf86Msg(X_INFO, "%s: Setting Buttons option to \"%d\"\n", - pInfo->name, buttons); - } - } - - if (pVuidMse->strmod) { - SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod)); - if (i == -1) { - xf86Msg(X_WARNING, - "%s: cannot pop module '%s' off mouse device: %s\n", - pInfo->name, pVuidMse->strmod, strerror(errno)); - } - } - - xf86CloseSerial(pInfo->fd); - pInfo->fd = -1; - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pVuidMse->wrapped_device_control = pInfo->device_control; - pInfo->device_control = vuidMouseProc; - pInfo->read_input = vuidReadInput; - - pMse->xisbscale = sizeof(Firm_event); - -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING - pVuidMse->absres.height = pVuidMse->absres.width = 0; -#endif - pVuidMse->pInfo = pInfo; - pVuidMse->next = vuidMouseList; - vuidMouseList = pVuidMse; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} - -static void -vuidFlushAbsEvents(InputInfoPtr pInfo, int absX, int absY, - Bool *absXset, Bool *absYset) -{ -#ifdef DEBUG - ErrorF("vuidFlushAbsEvents: %d,%d (set: %d, %d)\n", absX, absY, - *absXset, *absYset); -#endif - if ((*absXset) && (*absYset)) { - xf86PostMotionEvent(pInfo->dev, - /* is_absolute: */ TRUE, - /* first_valuator: */ 0, - /* num_valuators: */ 2, - absX, absY); - } else if (*absXset) { - xf86PostMotionEvent(pInfo->dev, - /* is_absolute: */ TRUE, - /* first_valuator: */ 0, - /* num_valuators: */ 1, - absX); - } else if (*absYset) { - xf86PostMotionEvent(pInfo->dev, - /* is_absolute: */ TRUE, - /* first_valuator: */ 1, - /* num_valuators: */ 1, - absY); - } - - *absXset = FALSE; - *absYset = FALSE; -} - -static void -vuidReadInput(InputInfoPtr pInfo) -{ - MouseDevPtr pMse; - VuidMsePtr pVuidMse; - int buttons; - int dx = 0, dy = 0, dz = 0, dw = 0; - unsigned int n; - int c; - unsigned char *pBuf; - int wmask; - int absX, absY; - Bool absXset = FALSE, absYset = FALSE; - - pMse = pInfo->private; - pVuidMse = getVuidMsePriv(pInfo); - buttons = pMse->lastButtons; - XisbBlockDuration(pMse->buffer, -1); - pBuf = pVuidMse->buffer; - n = 0; - - do { - while (n < sizeof(Firm_event) && (c = XisbRead(pMse->buffer)) >= 0) { - pBuf[n++] = (unsigned char)c; - } - - if (n == 0) - return; - - if (n != sizeof(Firm_event)) { - xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", - pInfo->name, n); - } - -#ifdef DEBUG - ErrorF("vuidReadInput: event type: %3d value: %5d\n", - pVuidMse->event.id, pVuidMse->event.value); -#endif - - if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <= BUT_LAST) { - /* button */ - int butnum = pVuidMse->event.id - BUT_FIRST; - - if (butnum < 3) - butnum = 2 - butnum; - if (!pVuidMse->event.value) - buttons &= ~(1 << butnum); - else - buttons |= (1 << butnum); - } else if (pVuidMse->event.id >= VLOC_FIRST && - pVuidMse->event.id <= VLOC_LAST) { - /* axis */ - int delta = pVuidMse->event.value; - switch(pVuidMse->event.id) { - case LOC_X_DELTA: - dx += delta; - break; - case LOC_Y_DELTA: - dy -= delta; - break; - case LOC_X_ABSOLUTE: - if (absXset) { - vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset); - } - absX = delta; - absXset = TRUE; - break; - case LOC_Y_ABSOLUTE: - if (absYset) { - vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset); - } - absY = delta; - absYset = TRUE; - break; - } - } -#ifdef HAVE_VUID_WHEEL - else if (vuid_in_range(VUID_WHEEL, pVuidMse->event.id)) { - if (vuid_id_offset(pVuidMse->event.id) == 0) - dz -= VUID_WHEEL_GETDELTA(pVuidMse->event.value); - else - dw -= VUID_WHEEL_GETDELTA(pVuidMse->event.value); - } -#endif -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING - else if (pVuidMse->event.id == MOUSE_TYPE_ABSOLUTE) { - /* force sending absolute resolution scaling ioctl */ - pVuidMse->absres.height = pVuidMse->absres.width = 0; - vuidMouseSendScreenSize(miPointerCurrentScreen(), pVuidMse); - } -#endif - - n = 0; - if ((c = XisbRead(pMse->buffer)) >= 0) { - /* Another packet. Handle it right away. */ - pBuf[n++] = c; - } - } while (n != 0); - - if (absXset || absYset) { - vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset); - } - - pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); - return; -} - -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING -static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse) -{ - InputInfoPtr pInfo = pVuidMse->pInfo; - ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); - int result; - - if ((pVuidMse->absres.width != pScr->currentMode->HDisplay) || - (pVuidMse->absres.height != pScr->currentMode->VDisplay)) - { - pVuidMse->absres.width = pScr->currentMode->HDisplay; - pVuidMse->absres.height = pScr->currentMode->VDisplay; - - do { - result = ioctl(pInfo->fd, MSIOSRESOLUTION, &(pVuidMse->absres)); - } while ( (result != 0) && (errno == EINTR) ); - - if (result != 0) { - xf86Msg(X_WARNING, - "%s: couldn't set absolute mouse scaling resolution: %s\n", - pInfo->name, strerror(errno)); -#ifdef DEBUG - } else { - xf86Msg(X_INFO, - "%s: absolute mouse scaling resolution set to %d x %d\n", - pInfo->name, - pVuidMse->absres.width, pVuidMse->absres.height); -#endif - } - } -} - -static void vuidMouseAdjustFrame(int index, int x, int y, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[index]; - ScreenPtr pScreen = pScrn->pScreen; - xf86AdjustFrameProc *wrappedAdjustFrame - = (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen); - VuidMsePtr m; - - if(wrappedAdjustFrame) { - pScrn->AdjustFrame = wrappedAdjustFrame; - (*pScrn->AdjustFrame)(index, x, y, flags); - pScrn->AdjustFrame = vuidMouseAdjustFrame; - } - - if (miPointerCurrentScreen() == pScreen) { - for (m = vuidMouseList; m != NULL ; m = m->next) { - vuidMouseSendScreenSize(pScreen, m); - } - } -} -#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */ - - -static int -vuidMouseProc(DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - VuidMsePtr pVuidMse; - int ret = Success; - int i; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - - pVuidMse = getVuidMsePriv(pInfo); - if (pVuidMse == NULL) { - return BadImplementation; - } - - switch (what) { - - case DEVICE_INIT: -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING - if (vuidMouseGeneration != serverGeneration) { - for (i = 0; i < screenInfo.numScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); - vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame); - pScrn->AdjustFrame = vuidMouseAdjustFrame; - } - vuidMouseGeneration = serverGeneration; - } -#endif - ret = pVuidMse->wrapped_device_control(pPointer, what); - break; - - case DEVICE_ON: - ret = pVuidMse->wrapped_device_control(pPointer, DEVICE_ON); - - if ((ret == Success) && (pInfo->fd != -1)) { - int fmt = VUID_FIRM_EVENT; - - if (pVuidMse->strmod) { - SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod)); - if (i < 0) { - xf86Msg(X_WARNING, - "%s: cannot push module '%s' onto mouse device: %s\n", - pInfo->name, pVuidMse->strmod, strerror(errno)); - xfree(pVuidMse->strmod); - pVuidMse->strmod = NULL; - } - } - SYSCALL(i = ioctl(pInfo->fd, VUIDSFORMAT, &fmt)); - if (i < 0) { - xf86Msg(X_WARNING, - "%s: cannot set mouse device to VUID mode: %s\n", - pInfo->name, strerror(errno)); - } - vuidMouseWheelInit(pInfo); -#ifdef HAVE_ABSOLUTE_MOUSE_SCALING - vuidMouseSendScreenSize(screenInfo.screens[0], pVuidMse); -#endif - xf86FlushInput(pInfo->fd); - } - break; - - case DEVICE_OFF: - case DEVICE_CLOSE: - if (pInfo->fd != -1) { - if (pVuidMse->strmod) { - SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod)); - if (i == -1) { - xf86Msg(X_WARNING, - "%s: cannot pop module '%s' off mouse device: %s\n", - pInfo->name, pVuidMse->strmod, strerror(errno)); - } - } - } - ret = pVuidMse->wrapped_device_control(pPointer, what); - break; - - default: /* Should never be called, but just in case */ - ret = pVuidMse->wrapped_device_control(pPointer, what); - break; - } - return ret; -} - -static Bool -sunMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - /* The protocol is guaranteed to be one of the internalNames[] */ - if (xf86NameCmp(protocol, "VUID") == 0) { - return vuidPreInit(pInfo, protocol, flags); - } - return TRUE; -} - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - - return FALSE; -} - -static const char * -DefaultProtocol(void) -{ - return "Auto"; -} - -static Bool -solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol, - const char **device) -{ - const char **pdev, **pproto, *dev = NULL; - int fd = -1; - Bool found; - - for (pdev = solarisMouseDevs; *pdev; pdev += 2) { - pproto = pdev + 1; - if ((*protocol != NULL) && (strcmp(*protocol, "Auto") != 0) && - (*pproto != NULL) && (strcmp(*pproto, *protocol) != 0)) { - continue; - } - if ((*device != NULL) && (strcmp(*device, *pdev) != 0)) { - continue; - } - SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK)); - if (fd == -1) { -#ifdef DEBUG - ErrorF("Cannot open %s (%s)\n", pdev, strerror(errno)); -#endif - } else { - found = TRUE; - if ((*pproto != NULL) && (strcmp(*pproto, "VUID") == 0)) { - int i, r; - SYSCALL(r = ioctl(fd, VUIDGFORMAT, &i)); - if (r < 0) { - found = FALSE; - } - } - close(fd); - if (found == TRUE) { - if (*pproto != NULL) { - *protocol = *pproto; - } - *device = *pdev; - return TRUE; - } - } - } - return FALSE; -} - -static const char * -SetupAuto(InputInfoPtr pInfo, int *protoPara) -{ - const char *pdev = NULL; - const char *pproto = NULL; - MouseDevPtr pMse = pInfo->private; - - if (pInfo->fd == -1) { - /* probe to find device/protocol to use */ - if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) { - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", pdev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, pdev); - } - } else if (pMse->protocolID == PROT_AUTO) { - pdev = xf86CheckStrOption(pInfo->conf_idev->commonOptions, - "Device", NULL); - solarisMouseAutoProbe(pInfo, &pproto, &pdev); - } - return pproto; -} - -static const char * -FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) -{ - const char *pdev = NULL; - const char *pproto = protocol; - - if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) { - /* Set the Device option. */ - pInfo->conf_idev->commonOptions = - xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", pdev); - xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", - pInfo->name, pdev); - } - return pdev; -} - -#else /* __SOL8__ || !__i386 */ - -#undef MSE_MISC -#define MSE_MISC 0 - -#endif /* !__SOL8__ && __i386 */ - -static int -SupportedInterfaces(void) -{ - /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC; -} - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; -#if defined(__SOL8__) || !defined(__i386) - p->BuiltinNames = BuiltinNames; - p->CheckProtocol = CheckProtocol; - p->PreInit = sunMousePreInit; - p->DefaultProtocol = DefaultProtocol; - p->SetupAuto = SetupAuto; - p->FindDevice = FindDevice; -#endif - return p; -} - diff --git a/hw/xfree86/os-support/sysv/Makefile.am b/hw/xfree86/os-support/sysv/Makefile.am index f9d2f237a..e86e70ad1 100644 --- a/hw/xfree86/os-support/sysv/Makefile.am +++ b/hw/xfree86/os-support/sysv/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = sysv_init.c sysv_mouse.c sysv_video.c +EXTRA_DIST = sysv_init.c sysv_video.c diff --git a/hw/xfree86/os-support/sysv/sysv_mouse.c b/hw/xfree86/os-support/sysv/sysv_mouse.c deleted file mode 100644 index e62010515..000000000 --- a/hw/xfree86/os-support/sysv/sysv_mouse.c +++ /dev/null @@ -1,60 +0,0 @@ - -/* - * Copyright 1999 by The XFree86 Project, Inc. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" - -static int -SupportedInterfaces(void) -{ - /* XXX Need to check this. */ - return MSE_SERIAL | MSE_AUTO; -} - -#ifndef ISC -static const char *internalNames[] = { - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - return FALSE; -} -#endif - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - p->SupportedInterfaces = SupportedInterfaces; -#ifndef ISC - p->BuiltinNames = BuiltinNames; - p->CheckProtocol = CheckProtocol; -#endif - return p; -} - diff --git a/hw/xfree86/os-support/usl/Makefile.am b/hw/xfree86/os-support/usl/Makefile.am deleted file mode 100644 index db08f5d85..000000000 --- a/hw/xfree86/os-support/usl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -EXTRA_DIST = \ - usl_init.c \ - usl_iop.c \ - usl_mouse.c \ - usl_video.c \ - usl_vtsw.c diff --git a/hw/xfree86/os-support/usl/usl_init.c b/hw/xfree86/os-support/usl/usl_init.c deleted file mode 100644 index d27b206c8..000000000 --- a/hw/xfree86/os-support/usl/usl_init.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright 2001-2005 by Kean Johnston - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat - * - * 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 names of Thomas Roell, David Wexelblat - * and Kean Johnston not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * Thomas Roell, David Wexelblat and Kean Johnston make no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL, DAVID WEXELBLAT AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT - * OR KEAN JOHNSTON 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 "X.h" -#include "Xmd.h" - -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include - -static Bool KeepTty = FALSE; -static Bool Protect0 = FALSE; -static Bool CRTSpecified = FALSE; -static int VTnum = -1; -static char vtdevice[48]; - -int usl_is_osr6 = -1; - -static Bool -IsConsoleDevice(const char *dev) -{ - if ((!strcmp (dev, "/dev/console")) || - (!strcmp (dev, "/dev/syscon")) || - (!strcmp (dev, "/dev/systty"))) - return TRUE; - - return FALSE; -} - -static int -is_osr6 (void) -{ - struct utsname uts; - - if (usl_is_osr6 == -1) { - if (uname (&uts) < 0) { - FatalError ("get_usl_ver: Failed to determine UNIX name (%s)\n", - strerror (errno)); - } - - if (uts.version[0] == '6') - usl_is_osr6 = 1; - else - usl_is_osr6 = 0; - } - - return usl_is_osr6; -} - - -void -xf86OpenConsole(void) -{ - int fd, i, ioctl_ret; - struct vt_mode VT; - struct vt_stat vts; - MessageType from = X_PROBED; - struct sigaction sigvtsw; - char *ttn; - - if (serverGeneration == 1) { - int isconsole = 0, consdev = 0; - - /* check if we're run with euid==0 */ - if (geteuid() != 0) { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* If we are run in the background we will get SIGTTOU. Ignore it. */ - OsSignal (SIGTTOU, SIG_IGN); - - /* Protect page 0 to help find NULL dereferencing */ - /* mprotect() doesn't seem to work */ - if (Protect0) { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) { - xf86Msg(X_WARNING, "xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } else { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) { - xf86Msg(X_WARNING, "xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - - /* - * setup the virtual terminal manager - */ - if (VTnum == -1) { - /* - * No device was specified. We need to query the kernel to see which - * console device we are on (and in fact if we are on a console at all). - */ - if (ioctl (0, VT_GETSTATE, &vts) < 0) { - FatalError("xf86OpenConsole: Could not query active VT: %s\n", - strerror(errno)); - } - VTnum = vts.v_active; - if (is_osr6()) - snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1); - else - snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum); - } else { - from = X_CMDLINE; - if (is_osr6()) - snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1); - else - snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum); - } - - if (IsConsoleDevice(vtdevice)) { - isconsole = 1; - CRTSpecified = FALSE; /* Dont honour -crt /dev/console */ - } - - if (ioctl (0, KIOCINFO, 0) >= 0) - consdev = 1 + isconsole; - - if ((!CRTSpecified) && (isconsole || (!consdev))) { - /* - * Need to find a free VT - */ - if ((fd = open ("/dev/console", O_WRONLY | O_NOCTTY)) < 0) { - FatalError ("xf86OpenConsole: Could not open /dev/console: %s\n", - strerror (errno)); - } - - if (ioctl (fd, VT_OPENQRY, &VTnum) < 0) { - FatalError ("xf86OpenConsole: Cannot find a free VT: %s\n", - strerror(errno)); - } - close (fd); - if (usl_is_osr6) - snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum + 1); - else - snprintf (vtdevice, sizeof(vtdevice), "/dev/vt%02d", VTnum); - } - - /* - * Now we can dispose of stdin/stdout - */ - fclose (stdin); - fclose (stdout); - - if (CRTSpecified || isconsole || consdev != 1) { - if (!KeepTty) { - setpgrp(); - } - } - - if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NONBLOCK, 0)) < 0) { - FatalError("xf86OpenConsole: Cannot open %s: %s\n", vtdevice, - strerror(errno)); - } - - xf86Msg (from, "using VT number %d (%s)\n\n", VTnum, vtdevice); - xf86Info.vtno = VTnum; - - /* change ownership of the vt */ - chown(vtdevice, getuid(), getgid()); - - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) { - FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n", - strerror(errno)); - } - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) { - FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",strerror(errno)); - } - - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) { - FatalError("xf86OpenConsole: VT_GETMODE failed: %s\n", strerror(errno)); - } - - sigvtsw.sa_handler = xf86VTRequest; - sigfillset(&sigvtsw.sa_mask); - sigvtsw.sa_flags = 0; - sigaction(SIGUSR1, &sigvtsw, NULL); - - VT.mode = VT_PROCESS; - VT.relsig = SIGUSR1; - VT.acqsig = SIGUSR1; - - ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); - if (ioctl_ret < 0) { - FatalError("xf86OpenConsole: VT_SETMODE failed: %s\n", strerror(errno)); - } - - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { - FatalError("xf86OpenConsole: KD_GRAPHICS failed: %s\n", strerror(errno)); - } - } else { /* serverGeneration != 1 */ - /* - * now get the VT - */ - if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) { - FatalError("xf86OpenConsole: VT_ACTIVATE failed: %s\n", strerror(errno)); - } - if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) { - FatalError("xf86OpenConsole: VT_WAITACTIVE failed: %s\n",strerror(errno)); - } - /* - * If the server doesn't have the VT when the reset occurs, - * this is to make sure we don't continue until the activate - * signal is received. - */ - if (!xf86Screens[0]->vtSema) - sleep(5); - } - return; -} - -void -xf86CloseConsole(void) -{ - struct vt_mode VT; - struct sigaction sigvtsw; - - ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */ - - sigvtsw.sa_handler = SIG_DFL; - sigfillset(&sigvtsw.sa_mask); - sigvtsw.sa_flags = 0; - sigaction(SIGUSR1, &sigvtsw, NULL); - - if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) { - VT.mode = VT_AUTO; - VT.waitv = 0; - ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ - } - close(xf86Info.consoleFd); /* make the vt-manager happy */ - return; -} - -int -xf86ProcessArgument(int argc, char *argv[], int i) -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) { - KeepTty = TRUE; - return(1); - } - - /* - * Undocumented flag to protect page 0 from read/write to help - * catch NULL pointer dereferences. This is purely a debugging - * flag. - */ - if (!strcmp(argv[i], "-protect0")) { - Protect0 = TRUE; - return(1); - } - - if ((argv[i][0] == 'v') && (argv[i][1] == 't')) { - if (sscanf(argv[i], "vt%2d", &VTnum) == 0) { - UseMsg(); - VTnum = -1; - return(0); - } - VTnum -= is_osr6(); - CRTSpecified = TRUE; - return(1); - } - - /* - * Use a device the user specifies. - */ - if (!strcmp(argv[i], "-crt")) { - if (++i > argc) { - UseMsg(); - VTnum = -1; - return(0); - } else { - char *mytty = ttyname(0); - char *arg = argv[i]; - - if (!mytty) - mytty = "\1"; - if (!arg[0]) - arg = "\2"; /* Prevent idiots from using -crt "" */ - - if (strcmp (mytty, arg) != 0) { - char *fmt; - - if (is_osr6()) - fmt = "/dev/tty%02d"; - else - fmt = "/dev/vt%02d"; - - if (sscanf(arg, fmt, &VTnum) == 0) { - UseMsg(); - VTnum = -1; - return(0); - } - - /* OSR6 devices start names at 1, UW7 starts at 0 */ - VTnum -= is_osr6(); - CRTSpecified = TRUE; - } - return(2); - } - } - return(0); -} - -void -xf86UseMsg(void) -{ - if (is_osr6()) { - ErrorF("-crt /dev/ttyXX use the specified VT device\n"); - ErrorF("vtXX use the specified VT number (01-16)\n"); - } else { - ErrorF("-crt /dev/vtXX use the specified VT device\n"); - ErrorF("vtXX use the specified VT number (00-15)\n"); - } - - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} diff --git a/hw/xfree86/os-support/usl/usl_iop.c b/hw/xfree86/os-support/usl/usl_iop.c deleted file mode 100644 index c6382fc7e..000000000 --- a/hw/xfree86/os-support/usl/usl_iop.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2001,2005 by Kean Johnston - * - * 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 Kean Johnston not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Kean Johnston makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEAN JOHNSTON 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 "X.h" - -#include "compiler.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86OSpriv.h" -#include "xf86_OSlib.h" - - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -static Bool IOEnabled = FALSE; - -_X_EXPORT Bool -xf86EnableIO(void) -{ - if (IOEnabled) - return TRUE; - - if (sysi86(SI86IOPL, 3) < 0) - FatalError("Failed to set IOPL for extended I/O\n"); - IOEnabled = TRUE; - return TRUE; -} - -_X_EXPORT void -xf86DisableIO(void) -{ - if (!IOEnabled) - return; - - sysi86(SI86IOPL, 0); - IOEnabled = FALSE; -} - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -_X_EXPORT Bool -xf86DisableInterrupts(void) -{ - if (!IOEnabled) { - if (sysi86(SI86IOPL, 3) < 0) - return FALSE; - } - -#ifdef __GNUC__ - __asm__ __volatile__("cli"); -#else - asm("cli"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86IOPL, 0); - } - - return(TRUE); -} - -_X_EXPORT void -xf86EnableInterrupts(void) -{ - if (!IOEnabled) { - if (sysi86(SI86IOPL, 3) < 0) - return; - } - -#ifdef __GNUC__ - __asm__ __volatile__("sti"); -#else - asm("sti"); -#endif /* __GNUC__ */ - - if (!IOEnabled) { - sysi86(SI86IOPL, 0); - } -} - diff --git a/hw/xfree86/os-support/usl/usl_mouse.c b/hw/xfree86/os-support/usl/usl_mouse.c deleted file mode 100644 index aa4600f79..000000000 --- a/hw/xfree86/os-support/usl/usl_mouse.c +++ /dev/null @@ -1,177 +0,0 @@ - -/* - * Copyright 2005 Kean Johnston - * Copyright 1999 by The XFree86 Project, 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 names of The XFree86 Project, Inc - * and Kean Johnston not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * The XFree86 Project, Inc and Kean Johnston make no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THE XFREE86 PROJECT, INC AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT - * OR KEAN JOHNSTON 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 "X.h" -#include "compiler.h" -#include "xf86.h" -#include "xf86Xinput.h" -#include "xf86OSmouse.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "mipointer.h" - -static int -SupportedInterfaces(void) -{ - return MSE_MISC; -} - -static const char *internalNames[] = { - NULL -}; - -static const char ** -BuiltinNames(void) -{ - return internalNames; -} - -static const char * -DefaultProtocol (void) -{ - return "OSMouse"; -} - -static Bool -CheckProtocol(const char *protocol) -{ - int i; - - for (i = 0; internalNames[i]; i++) - if (xf86NameCmp(protocol, internalNames[i]) == 0) - return TRUE; - return FALSE; -} - -static int -OsMouseProc(DeviceIntPtr pPointer, int what) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - unsigned char map[9]; - int ret; - - pInfo = pPointer->public.devicePrivate; - pMse = pInfo->private; - pMse->device = pPointer; - - switch (what) { - case DEVICE_INIT: - pPointer->public.on = FALSE; - - for (ret = 0; ret <= 8; ret++) - map[ret] = ret; - - InitPointerDeviceStruct((DevicePtr)pPointer, map, 8, - miPointerGetMotionEvents, pMse->Ctrl, - miPointerGetMotionBufferSize()); - /* X valuator */ - xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 0); - - /* Y valuator */ - xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); - xf86InitValuatorDefaults(pPointer, 1); - - xf86MotionHistoryAllocate(pInfo); - break; - - case DEVICE_ON: - pMse->lastButtons = 0; - pMse->emulateState = 0; - pPointer->public.on = TRUE; - XqMseOnOff (pInfo, 1); - break; - - case DEVICE_CLOSE: - case DEVICE_OFF: - pPointer->public.on = FALSE; - XqMseOnOff (pInfo, 0); - break; - } - return Success; -} - -static Bool -OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) -{ - MouseDevPtr pMse; - - pMse = pInfo->private; - pMse->protocol = protocol; - xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); - - /* Collect the options, and process the common options. */ - xf86CollectInputOptions(pInfo, NULL, NULL); - xf86ProcessCommonOptions(pInfo, pInfo->options); - - pInfo->fd = -1; -#if 0 - /* Make sure we can open the mouse */ - pInfo->fd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK); - - if (pInfo->fd < 0) { - if (xf86GetAllowMouseOpenFail()) { - xf86Msg(X_WARNING, "%s: cannot open /dev/mouse (%s)\n", - pInfo->name, strerror(errno)); - } else { - xf86Msg(X_ERROR, "%s: cannot open /dev/mouse (%s)\n", - pInfo->name, strerror(errno)); - xfree(pMse); - return FALSE; - } - } -#endif - - /* Process common mouse options (like Emulate3Buttons, etc). */ - pMse->CommonOptions(pInfo); - - /* Setup the local procs. */ - pInfo->device_control = OsMouseProc; - pInfo->read_input = NULL; - - pInfo->flags |= XI86_CONFIGURED; - return TRUE; -} - -_X_EXPORT OSMouseInfoPtr -xf86OSMouseInit(int flags) -{ - OSMouseInfoPtr p; - - p = xcalloc(sizeof(OSMouseInfoRec), 1); - if (!p) - return NULL; - - p->SupportedInterfaces = SupportedInterfaces; - p->BuiltinNames = BuiltinNames; - p->DefaultProtocol = DefaultProtocol; - p->CheckProtocol = CheckProtocol; - p->PreInit = OsMousePreInit; - return p; -} - diff --git a/hw/xfree86/os-support/usl/usl_video.c b/hw/xfree86/os-support/usl/usl_video.c deleted file mode 100644 index 41abd2259..000000000 --- a/hw/xfree86/os-support/usl/usl_video.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyrught 2005 Kean Johnston - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat - * - * 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 names of Thomas Roell, David Dawes - * and Kean Johnston not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior permission. - * Thomas Roell, David Dawes and Kean Johnston make no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL, DAVID DAWES AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT - * OR KEAN JOHNSTON 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 "X.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -static Bool -linearVidMem(void) -{ - return TRUE; -} - -static pointer -mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - pointer base; - int fd; - - fd = open(DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); - if (fd < 0) { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", - DEV_MEM, strerror(errno)); - } - base = mmap((caddr_t)0, Size, (flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, (off_t)Base); - close(fd); - - if (base == MAP_FAILED) { - FatalError("%s: Could not mmap framebuffer [s=%x,a=%x] (%s)\n", - "xf86MapVidMem", Size, Base, strerror(errno)); - } - return(base); -} - -/* ARGSUSED */ -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ - munmap(Base, Size); -} - -/* - * For some SVR4 versions, a 32-bit read is done for the first location - * in each page when the page is first mapped. If this is done while - * memory access is enabled for regions that have read side-effects, - * this can cause unexpected results, including lockups on some hardware. - * This function is called to make sure each page is mapped while it is - * safe to do so. - */ - -#define X_PAGE_SIZE 4096 - -static void -readSideEffects(int ScreenNum, pointer Base, unsigned long Size) -{ - unsigned long base, end, addr; - CARD32 val; - - base = (unsigned long)Base; - end = base + Size; - - for (addr = base; addr < end; addr += X_PAGE_SIZE) - val = *(volatile CARD32 *)addr; -} - -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - pVidMem->linearSupported = linearVidMem(); - pVidMem->mapMem = mapVidMem; - pVidMem->unmapMem = unmapVidMem; - pVidMem->readSideEffects = readSideEffects; - pVidMem->initialised = TRUE; -} - diff --git a/hw/xfree86/os-support/usl/usl_vtsw.c b/hw/xfree86/os-support/usl/usl_vtsw.c deleted file mode 100644 index 812e5bddb..000000000 --- a/hw/xfree86/os-support/usl/usl_vtsw.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2005 by Kean Johnston - * Copyright 1993 by David Wexelblat - * Copyright 1993 by David McCullough - * - * 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 Wexelblat not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. David Wexelblat makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL DAVID WEXELBLAT 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 "X.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -/* - * Handle the VT-switching interface for SCO UnixWare / OpenServer 6 - */ - -/* - * This function is the signal handler for the VT-switching signal. It - * is only referenced inside the OS-support layer. NOTE: we do NOT need - * to re-arm the signal here, since we used sigaction() to set the signal - * disposition in usl_init.c. If we had used signal(), we would need to - * re-arm the signal here. All we need to do now is record the fact that - * we got the signal. XFree86 handles the rest. - */ -void -xf86VTRequest(int sig) -{ - xf86Info.vtRequestsPending = TRUE; - return; -} - -Bool -xf86VTSwitchPending(void) -{ - return(xf86Info.vtRequestsPending ? TRUE : FALSE); -} - -static int usl_ledstatus = -1; -static unsigned int usl_ledstate = 0; - -Bool -xf86VTSwitchAway(void) -{ - usl_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &usl_ledstate); - - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) { - return(FALSE); - } else { - return(TRUE); - } -} - -Bool -xf86VTSwitchTo(void) -{ - xf86Info.vtRequestsPending = FALSE; - if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) { - return(FALSE); - } else { - if (usl_ledstatus >= 0) { - ioctl (xf86Info.consoleFd, KDSETLED, usl_ledstate); - } - usl_ledstatus = -1; - - /* - * Convince the console driver this screen is in graphics mode, - * otherwise it assumes it can do more to the screen than it should. - */ - if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) { - ErrorF("Failed to set graphics mode (%s)\n", strerror(errno)); - } - - return TRUE; - } -} diff --git a/hw/xfree86/os-support/xf86OSmouse.h b/hw/xfree86/os-support/xf86OSmouse.h deleted file mode 100644 index 600683866..000000000 --- a/hw/xfree86/os-support/xf86OSmouse.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 1999-2003 by The XFree86 Project, Inc. - * - * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) - * and author(s) 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 copyright holder(s) and author(s). - */ - -/* Public interface to OS-specific mouse support. */ - -#ifndef _XF86OSMOUSE_H_ -#define _XF86OSMOUSE_H_ - -#include "xf86Xinput.h" - -/* Mouse interface classes */ -#define MSE_NONE 0x00 -#define MSE_SERIAL 0x01 /* serial port */ -#define MSE_BUS 0x02 /* old bus mouse */ -#define MSE_PS2 0x04 /* standard read-only PS/2 */ -#define MSE_XPS2 0x08 /* extended PS/2 */ -#define MSE_AUTO 0x10 /* auto-detect (PnP) */ -#define MSE_MISC 0x20 /* The OS layer will identify the - * specific protocol names that are - * supported for this class. */ - -/* Mouse Protocol IDs. */ -typedef enum { - PROT_UNKNOWN = -2, - PROT_UNSUP = -1, /* protocol is not supported */ - PROT_MS = 0, - PROT_MSC, - PROT_MM, - PROT_LOGI, - PROT_LOGIMAN, - PROT_MMHIT, - PROT_GLIDE, - PROT_IMSERIAL, - PROT_THINKING, - PROT_ACECAD, - PROT_VALUMOUSESCROLL, - PROT_PS2, - PROT_GENPS2, - PROT_IMPS2, - PROT_EXPPS2, - PROT_THINKPS2, - PROT_MMPS2, - PROT_GLIDEPS2, - PROT_NETPS2, - PROT_NETSCPS2, - PROT_BM, - PROT_AUTO, - PROT_SYSMOUSE, - PROT_NUMPROTOS /* This must always be last. */ -} MouseProtocolID; - -struct _MouseDevRec; - -typedef int (*GetInterfaceTypesProc)(void); -typedef const char **(*BuiltinNamesProc)(void); -typedef Bool (*CheckProtocolProc)(const char *protocol); -typedef Bool (*BuiltinPreInitProc)(InputInfoPtr pInfo, const char *protocol, - int flags); -typedef const char *(*DefaultProtocolProc)(void); -typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara); -typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate, - int res); -typedef const char *(*FindDeviceProc)(InputInfoPtr pInfo, const char *protocol, - int flags); -typedef const char *(*GuessProtocolProc)(InputInfoPtr pInfo, int flags); - -/* - * OSMouseInfoRec is used to pass information from the OSMouse layer to the - * OS-independent mouse driver. - */ -typedef struct { - GetInterfaceTypesProc SupportedInterfaces; - BuiltinNamesProc BuiltinNames; - CheckProtocolProc CheckProtocol; - BuiltinPreInitProc PreInit; - DefaultProtocolProc DefaultProtocol; - SetupAutoProc SetupAuto; - SetResProc SetPS2Res; - SetResProc SetBMRes; - SetResProc SetMiscRes; - FindDeviceProc FindDevice; - GuessProtocolProc GuessProtocol; -} OSMouseInfoRec, *OSMouseInfoPtr; - -/* - * SupportedInterfaces: Returns the mouse interface types that the OS support. - * If MSE_MISC is returned, then the BuiltinNames and - * CheckProtocol should be set. - * - * BuiltinNames: Returns the names of the protocols that are fully handled - * in the OS-specific code. These are names that don't appear - * directly in the main "mouse" driver. - * - * CheckProtocol: Checks if the protocol name given is supported by the - * OS. It should return TRUE for both "builtin" protocols and - * protocols of type MSE_MISC that are supported by the OS. - * - * PreInit: The PreInit function for protocols that are builtin. This - * function is passed the protocol name. - * - * DefaultProtocol: Returns the name of a default protocol that should be used - * for the OS when none has been supplied in the config file. - * This should only be set when there is a reasonable default. - * - * SetupAuto: This function can be used to do OS-specific protocol - * auto-detection. It returns the name of the detected protocol, - * or NULL when detection fails. It may also adjust one or more - * of the "protoPara" values for the detected protocol by setting - * then to something other than -1. SetupAuto gets called in two - * ways. The first is before any devices have been opened. This - * can be used when the protocol "Auto" always maps to a single - * protocol type. The second is with the device open, allowing - * OS-specific probing to be done. - * - * SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2 - * protocol types. - * - * SetBMRes: Set the resolution and sample rate for MSE_BM protocol types. - * - * SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types. - * - * FindDevice: This function gets called when no Device has been specified - * in the config file. OS-specific methods may be used to guess - * which input device to use. This function is called after the - * pre-open attempts at protocol discovery are done, but before - * the device is open. I.e., after the first SetupAuto() call, - * after the DefaultProtocol() call, but before the PreInit() - * call. Available protocol information may be used in locating - * the default input device. - * - * GuessProtocol: A last resort attempt at guessing the mouse protocol by - * whatever OS-specific means might be available. OS-independent - * things should be in the mouse driver. This function gets - * called after the mouse driver's OS-independent methods have - * failed. - */ - -extern OSMouseInfoPtr xf86OSMouseInit(int flags); - -/* Adjust this when the mouse interface changes. */ - -/* - * History: - * - * 1.0.0 - Everything up to when versioning was started. - * 1.1.0 - FindDevice and GuessProtocol added to OSMouseInfoRec - * 1.2.0 - xisbscale added to MouseDevRec - * - */ - -#define OS_MOUSE_VERSION_MAJOR 1 -#define OS_MOUSE_VERSION_MINOR 2 -#define OS_MOUSE_VERSION_PATCH 0 - -#define OS_MOUSE_VERSION_CURRENT \ - BUILTIN_INTERFACE_VERSION_NUMERIC(OS_MOUSE_VERSION_MAJOR, \ - OS_MOUSE_VERSION_MINOR, \ - OS_MOUSE_VERSION_PATCH) - -#define HAVE_GUESS_PROTOCOL \ - (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \ - BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0)) - -#define HAVE_FIND_DEVICE \ - (xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \ - BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0)) - -/* Z axis mapping */ -#define MSE_NOZMAP 0 -#define MSE_MAPTOX -1 -#define MSE_MAPTOY -2 -#define MSE_MAPTOZ -3 -#define MSE_MAPTOW -4 - -/* Generalize for other axes. */ -#define MSE_NOAXISMAP MSE_NOZMAP - -#define MSE_MAXBUTTONS 24 -#define MSE_DFLTBUTTONS 3 - -/* - * Mouse device record. This is shared by the mouse driver and the OSMouse - * layer. - */ - -typedef void (*checkMovementsProc)(InputInfoPtr,int, int); -typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool); -typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char); -typedef Bool (*dataGoodProc)(struct _MouseDevRec *); - -typedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons, - int dx, int dy, int dz, int dw); -typedef void (*MouseCommonOptProc)(InputInfoPtr pInfo); - -typedef struct _MouseDevRec { - PtrCtrlProcPtr Ctrl; - PostMseEventProc PostEvent; - MouseCommonOptProc CommonOptions; - DeviceIntPtr device; - const char * mseDevice; - const char * protocol; - MouseProtocolID protocolID; - MouseProtocolID oldProtocolID; /* hack */ - int class; - int mseModel; - int baudRate; - int oldBaudRate; - int sampleRate; - int lastButtons; - int threshold; /* acceleration */ - int num; - int den; - int buttons; /* # of buttons */ - int emulateState; /* automata state for 2 button mode */ - Bool emulate3Buttons; - Bool emulate3ButtonsSoft; - int emulate3Timeout;/* Timeout for 3 button emulation */ - Bool chordMiddle; - Bool flipXY; - int invX; - int invY; - int mouseFlags; /* Flags to Clear after opening - * mouse dev */ - int truebuttons; /* (not used) - * Arg to maintain before - * emulate3buttons timer callback */ - int resolution; - int negativeZ; /* button mask */ - int positiveZ; /* button mask */ - int negativeW; /* button mask */ - int positiveW; /* button mask */ - pointer buffer; /* usually an XISBuffer* */ - int protoBufTail; - unsigned char protoBuf[8]; - unsigned char protoPara[8]; - unsigned char inSync; /* driver in sync with datastream */ - pointer mousePriv; /* private area */ - InputInfoPtr pInfo; - int origProtocolID; - const char * origProtocol; - Bool emulate3Pending;/* timer waiting */ - CARD32 emulate3Expires;/* time to fire emulation code */ - Bool emulateWheel; - int wheelInertia; - int wheelButton; - int negativeX; /* Button values. Unlike the Z and */ - int positiveX; /* W equivalents, these are button */ - int negativeY; /* values rather than button masks. */ - int positiveY; - int wheelYDistance; - int wheelXDistance; - Bool autoProbe; - checkMovementsProc checkMovements; - autoProbeProc autoProbeMouse; - collectDataProc collectData; - dataGoodProc dataGood; - int angleOffset; - pointer pDragLock; /* drag lock area */ - int xisbscale; /* buffer size for 1 event */ - int wheelButtonTimeout;/* Timeout for the wheel button emulation */ - CARD32 wheelButtonExpires; - int doubleClickSourceButtonMask; - int doubleClickTargetButton; - int doubleClickTargetButtonMask; - int doubleClickOldSourceState; - int lastMappedButtons; - int buttonMap[MSE_MAXBUTTONS]; -} MouseDevRec, *MouseDevPtr; - -#endif /* _XF86OSMOUSE_H_ */ diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index aba47581f..b43c14df4 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h @@ -214,12 +214,6 @@ # define VT_SYSREQ_DEFAULT TRUE # endif -# ifdef SYSV -# if !defined(ISC) || defined(ISC202) || defined(ISC22) -# define NEED_STRERROR -# endif -# endif - #endif /* (SYSV || SVR4) && !DGUX */ @@ -299,10 +293,6 @@ # include # include -#ifdef __GNU__ /* GNU/Hurd */ -# define USE_OSMOUSE -#endif - # ifdef __linux__ # include # else /* __GLIBC__ */ @@ -332,46 +322,6 @@ #endif /* __linux__ || __GLIBC__ */ -/**************************************************************************/ -/* LynxOS AT */ -/**************************************************************************/ -#if defined(Lynx) - -# include -# include -# include -# include -# include -# include -# include - -# include -extern int errno; - -/* smem_create et.al. to access physical memory */ -# include - -/* keyboard types */ -# define KB_84 1 -# define KB_101 2 -# define KB_OTHER 3 - -/* atc drivers ignores argument to VT_RELDISP ioctl */ -# define VT_ACKACQ 2 - -# include -# define POSIX_TTY -# define CLEARDTR_SUPPORT - -/* LynxOS 2.5.1 has these */ -# ifdef LED_NUMLOCK -# define LED_CAP LED_CAPSLOCK -# define LED_NUM LED_NUMLOCK -# define LED_SCR LED_SCROLLOCK -# endif - -#endif /* Lynx */ - /**************************************************************************/ /* 386BSD and derivatives, BSD/386 */ /**************************************************************************/ @@ -553,8 +503,6 @@ extern int errno; # define LED_SCR 0x01 # define POSIX_TTY -# define OSMOUSE_ONLY -# define MOUSE_PROTOCOL_IN_KERNEL #define TIOCM_DTR 0x0001 /* data terminal ready */ #define TIOCM_RTS 0x0002 /* request to send */ @@ -624,15 +572,14 @@ extern int errno; # define MAXHOSTNAMELEN 32 #endif /* !MAXHOSTNAMELEN */ -#if !defined(X_NOT_POSIX) -# if defined(_POSIX_SOURCE) -# include -# else -# define _POSIX_SOURCE -# include -# undef _POSIX_SOURCE -# endif /* _POSIX_SOURCE */ -#endif /* !X_NOT_POSIX */ +#if defined(_POSIX_SOURCE) +# include +#else +# define _POSIX_SOURCE +# include +# undef _POSIX_SOURCE +#endif /* _POSIX_SOURCE */ + #if !defined(PATH_MAX) # if defined(MAXPATHLEN) # define PATH_MAX MAXPATHLEN @@ -641,16 +588,7 @@ extern int errno; # endif /* MAXPATHLEN */ #endif /* !PATH_MAX */ -#ifdef NEED_STRERROR -# ifndef strerror -extern char *sys_errlist[]; -extern int sys_nerr; -# define strerror(n) \ - ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error" -# endif /* !strerror */ -#endif /* NEED_STRERROR */ - -#if defined(ISC) || defined(Lynx) +#if defined(ISC) #define rint(x) RInt(x) double RInt( double x @@ -665,12 +603,6 @@ double RInt( #define VT_SYSREQ_DEFAULT FALSE #endif -#ifdef OSMOUSE_ONLY -# ifndef MOUSE_PROTOCOL_IN_KERNEL -# define MOUSE_PROTOCOL_IN_KERNEL -# endif -#endif - #define SYSCALL(call) while(((call) == -1) && (errno == EINTR)) #define XF86_OS_PRIVS diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am index 849ee8bab..7f599f9c4 100644 --- a/hw/xfree86/parser/Makefile.am +++ b/hw/xfree86/parser/Makefile.am @@ -32,8 +32,7 @@ EXTRA_DIST = \ configProcs.h \ xf86Optrec.h \ xf86Parser.h \ - xf86tokens.h \ - cpconfig.c + xf86tokens.h sdk_HEADERS = \ $(LIBHEADERS) \ diff --git a/hw/xfree86/parser/cpconfig.c b/hw/xfree86/parser/cpconfig.c deleted file mode 100644 index 0347f7d2a..000000000 --- a/hw/xfree86/parser/cpconfig.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * - * Copyright (c) 1997 Metro Link Incorporated - * - * 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 Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ - -/* View/edit this file with tab stops set to 4 */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "xf86Parser.h" -#include "configProcs.h" - -#ifdef MALLOC_FUNCTIONS -void -xfree (void *p) -{ - free (p); - return; -} - -void * -xalloc (int size) -{ - return malloc (size); -} - -void * -xrealloc (void *p, int size) -{ - return realloc (p, size); -} - -#endif - -#define CONFPATH "%A,%R,/etc/X11/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F," \ - "%P/etc/X11/%F,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \ - "%P/etc/X11/%X,%P/lib/X11/%X.%H,%P/lib/X11/%X" - -int -main (int argc, char *argv[]) -{ - const char *filename; - char *cmdline = NULL; - XF86ConfigPtr conf; - - if (argc > 1) - { - cmdline = argv[1]; - } - if ((filename = xf86openConfigFile (CONFPATH, cmdline, NULL))) - { - fprintf (stderr, "Opened %s for the config file\n", filename); - } - else - { - fprintf (stderr, "Unable to open config file\n"); - exit (1); - } - - if ((conf = xf86readConfigFile ()) == NULL) - { - fprintf (stderr, "Problem when parsing config file\n"); - } - else - { - fprintf (stderr, "Config file parsed OK\n"); - } - xf86closeConfigFile (); - - if (argc > 2) { - fprintf(stderr, "Writing config file to `%s'\n", argv[2]); - xf86writeConfigFile (argv[2], conf); - } - exit(0); -} - -/* Functions that the parser requires */ - -_X_EXPORT void -VErrorF(const char *f, va_list args) -{ - vfprintf(stderr, f, args); -} - -_X_EXPORT void -ErrorF(const char *f, ...) -{ - va_list args; - - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); -} diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index 851b91161..0ed104d58 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -66,7 +66,6 @@ #include #include -#if !defined(X_NOT_POSIX) #if defined(_POSIX_SOURCE) #include #else @@ -74,7 +73,7 @@ #include #undef _POSIX_SOURCE #endif /* _POSIX_SOURCE */ -#endif /* !X_NOT_POSIX */ + #if !defined(PATH_MAX) #if defined(MAXPATHLEN) #define PATH_MAX MAXPATHLEN diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c index 6589fdc72..3b77b9314 100644 --- a/hw/xfree86/parser/write.c +++ b/hw/xfree86/parser/write.c @@ -68,15 +68,6 @@ #include #include -#if ((defined(sun) && !defined(SVR4)) || defined(macII)) && !defined(__GLIBC__) -#ifndef strerror -extern char *sys_errlist[]; -extern int sys_nerr; -#define strerror(n) \ - (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error") -#endif -#endif - #if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED) #define HAS_SAVED_IDS_AND_SETEUID #endif diff --git a/hw/xfree86/rac/Makefile.am b/hw/xfree86/rac/Makefile.am deleted file mode 100644 index b25068271..000000000 --- a/hw/xfree86/rac/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -noinst_LIBRARIES = librac.a -librac_a_SOURCES = xf86RAC.c - -sdk_HEADERS = xf86RAC.h - -INCLUDES = $(XORG_INCS) - -AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index ec9a35811..3c98f6e7d 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -378,7 +378,7 @@ xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) /* only update coordinate state for first sprite, otherwise we get jumps when removing a sprite. The second sprite is never HW rendered anyway */ if (pDev == inputInfo.pointer || - !pDev->isMaster && pDev->u.master == inputInfo.pointer) + (!pDev->isMaster && pDev->u.master == inputInfo.pointer)) { ScreenPriv->x = x; ScreenPriv->y = y; diff --git a/hw/xfree86/utils/Makefile.am b/hw/xfree86/utils/Makefile.am index e3e7a6177..62705d2fc 100644 --- a/hw/xfree86/utils/Makefile.am +++ b/hw/xfree86/utils/Makefile.am @@ -3,5 +3,4 @@ SUBDIRS = \ cvt \ ioport \ kbd_mode \ - xorgcfg \ - xorgconfig + xorgcfg diff --git a/hw/xfree86/utils/gtf/gtf.c b/hw/xfree86/utils/gtf/gtf.c index fd4a4f23c..8ce93276a 100644 --- a/hw/xfree86/utils/gtf/gtf.c +++ b/hw/xfree86/utils/gtf/gtf.c @@ -112,11 +112,6 @@ #include #include - -#if defined(__Lynx__) -#define rint(x) floor(x) -#endif - #define MARGIN_PERCENT 1.8 /* % of active vertical image */ #define CELL_GRAN 8.0 /* assumed character cell granularity */ #define MIN_PORCH 1 /* minimum front porch */ diff --git a/hw/xfree86/utils/kbd_mode/Makefile.am b/hw/xfree86/utils/kbd_mode/Makefile.am index 1b28411cf..087caa240 100644 --- a/hw/xfree86/utils/kbd_mode/Makefile.am +++ b/hw/xfree86/utils/kbd_mode/Makefile.am @@ -1,4 +1,3 @@ -# $Id$ # # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # diff --git a/hw/xfree86/utils/xorgcfg/config.h b/hw/xfree86/utils/xorgcfg/config.h index ea12e8879..ddbb05514 100644 --- a/hw/xfree86/utils/xorgcfg/config.h +++ b/hw/xfree86/utils/xorgcfg/config.h @@ -74,6 +74,7 @@ #include #include #include +#include #ifndef _xf86cfg_config_h #define _xf86cfg_config_h diff --git a/hw/xfree86/utils/xorgcfg/loader.c b/hw/xfree86/utils/xorgcfg/loader.c index 8a9ad1aef..35a03e7cd 100644 --- a/hw/xfree86/utils/xorgcfg/loader.c +++ b/hw/xfree86/utils/xorgcfg/loader.c @@ -74,9 +74,6 @@ extern int noverify; extern ModuleType module_type; static OptionInfoPtr option; -extern FontModule *font_module; -extern int numFontModules; - char **checkerLegend; int *checkerErrors; @@ -173,12 +170,12 @@ LoaderInitializeOptions(void) XrmQuark classes[2]; volatile int i; static ModuleType module_types[] = { - GenericModule, FontRendererModule, InputModule, VideoModule, NullModule + GenericModule, InputModule, VideoModule, NullModule }; /* The offset in this vector must match loader.h:enum ModuleType values */ static char *module_strs[] = { - "Null Module", "Video Module", "Input Module", "Generic Module", "Font Module" + "Null Module", "Video Module", "Input Module", "Generic Module", }; if (first) { @@ -202,9 +199,8 @@ LoaderInitializeOptions(void) checkerLegend[CHECKER_RECOGNIZED_AS] = "This message means the module code did not follow what was expected\n" "by the checker. For video drivers, it did not call xf86AddDriver,\n" - "a input module did not call xf86AddInputDriver and a font renderer\n" - "module did not call LoadFont. This message can also be printed if\n" - "the module is in the incorrect directory."; + "a input module did not call xf86AddInputDriver. This message can\n" + "also be printed if the module is in the incorrect directory."; checkerLegend[CHECKER_NO_OPTIONS_AVAILABLE] = "The driver does not have an AvailableOptions function, or that\n" "function is returning NULL. If the driver is returning NULL, and\n" @@ -272,9 +268,8 @@ LoaderInitializeOptions(void) signal(SIGFPE, sig_handler); if (sigsetjmp(jmp, 1) == 0) { if (!noverify) { - int ok, nfont_modules; + int ok; - nfont_modules = numFontModules; error_level = 0; ErrorF("CHECK MODULE %s\n", *ploaderList); if ((ok = xf86cfgCheckModule()) == 0) { @@ -352,25 +347,6 @@ LoaderInitializeOptions(void) CheckChipsets(module_options, &error_level); } } - - /* font modules check */ - if (module_type == FontRendererModule) { - if (strcmp(*ploaderList, font_module->name)) { - /* not an error */ - ErrorF(" NOTICE FontModule->name specification mismatch: \"%s\" \"%s\"\n", - *ploaderList, font_module->name); - } - if (nfont_modules + 1 != numFontModules) { - /* not an error */ - ErrorF(" NOTICE font module \"%s\" loaded more than one font renderer.\n", - *ploaderList); - } - } - else if (nfont_modules != numFontModules) { - ErrorF(" WARNING number of font modules changed from %d to %d.\n", - nfont_modules, numFontModules); - ++error_level; - } } ErrorF(" SUMMARY error_level set to %d.\n\n", error_level); } diff --git a/hw/xfree86/utils/xorgcfg/loader.h b/hw/xfree86/utils/xorgcfg/loader.h index 16c527327..5affada84 100644 --- a/hw/xfree86/utils/xorgcfg/loader.h +++ b/hw/xfree86/utils/xorgcfg/loader.h @@ -47,7 +47,6 @@ #endif #include "xf86Xinput.h" -#include #include "loaderProcs.h" #include @@ -102,17 +101,6 @@ typedef struct { Bool found; } OptionInfoRec, *OptionInfoPtr; -/* fontmod.h */ -typedef void (*InitFont)(void); - -typedef struct { - InitFont initFunc; - char * name; - void *module; -} FontModule; - -extern FontModule *FontModuleList; - typedef struct { int token; /* id of the token */ const char * name; /* token name */ @@ -124,7 +112,6 @@ typedef enum { VideoModule, InputModule, GenericModule, - FontRendererModule } ModuleType; typedef struct _xf86cfgModuleOptions { diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c index 629dfe118..809a51a03 100644 --- a/hw/xfree86/utils/xorgcfg/loadmod.c +++ b/hw/xfree86/utils/xorgcfg/loadmod.c @@ -80,8 +80,6 @@ Bool xf86CheckPciSlot( const struct pci_device * ); extern char *loaderPath, **loaderList, **ploaderList; xf86cfgModuleOptions *module_options; -FontModule *font_module; -int numFontModules; extern int noverify, error_level; @@ -89,7 +87,6 @@ int xf86ShowUnresolved = 1; LOOKUP miLookupTab[] = {{0,0}}; LOOKUP dixLookupTab[] = {{0,0}}; -LOOKUP fontLookupTab[] = {{0,0}}; LOOKUP extLookupTab[] = {{0,0}}; LOOKUP xfree86LookupTab[] = { /* Loader functions */ @@ -99,7 +96,6 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(LoaderErrorMsg) SYMFUNC(LoaderCheckUnresolved) SYMFUNC(LoadExtension) - SYMFUNC(LoadFont) SYMFUNC(LoaderReqSymbols) SYMFUNC(LoaderReqSymLists) SYMFUNC(LoaderRefSymbols) @@ -110,189 +106,6 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(LoaderFreeDirList) SYMFUNC(LoaderGetOS) - /* - * these here are our own interfaces to libc functions - */ - SYMFUNC(xf86abort) - SYMFUNC(xf86abs) - SYMFUNC(xf86acos) - SYMFUNC(xf86asin) - SYMFUNC(xf86atan) - SYMFUNC(xf86atan2) - SYMFUNC(xf86atof) - SYMFUNC(xf86atoi) - SYMFUNC(xf86atol) - SYMFUNC(xf86bsearch) - SYMFUNC(xf86ceil) - SYMFUNC(xf86calloc) - SYMFUNC(xf86clearerr) - SYMFUNC(xf86close) - SYMFUNC(xf86cos) - SYMFUNC(xf86exit) - SYMFUNC(xf86exp) - SYMFUNC(xf86fabs) - SYMFUNC(xf86fclose) - SYMFUNC(xf86feof) - SYMFUNC(xf86ferror) - SYMFUNC(xf86fflush) - SYMFUNC(xf86fgetc) - SYMFUNC(xf86fgetpos) - SYMFUNC(xf86fgets) - SYMFUNC(xf86finite) - SYMFUNC(xf86floor) - SYMFUNC(xf86fmod) - SYMFUNC(xf86fopen) - SYMFUNC(xf86fprintf) - SYMFUNC(xf86fputc) - SYMFUNC(xf86fputs) - SYMFUNC(xf86fread) - SYMFUNC(xf86free) - SYMFUNC(xf86freopen) - SYMFUNC(xf86frexp) - SYMFUNC(xf86fscanf) - SYMFUNC(xf86fseek) - SYMFUNC(xf86fsetpos) - SYMFUNC(xf86ftell) - SYMFUNC(xf86fwrite) - SYMFUNC(xf86getc) - SYMFUNC(xf86getenv) - SYMFUNC(xf86getpagesize) - SYMFUNC(xf86hypot) - SYMFUNC(xf86ioctl) - SYMFUNC(xf86isalnum) - SYMFUNC(xf86isalpha) - SYMFUNC(xf86iscntrl) - SYMFUNC(xf86isdigit) - SYMFUNC(xf86isgraph) - SYMFUNC(xf86islower) - SYMFUNC(xf86isprint) - SYMFUNC(xf86ispunct) - SYMFUNC(xf86isspace) - SYMFUNC(xf86isupper) - SYMFUNC(xf86isxdigit) - SYMFUNC(xf86labs) - SYMFUNC(xf86ldexp) - SYMFUNC(xf86log) - SYMFUNC(xf86log10) - SYMFUNC(xf86lseek) - SYMFUNC(xf86malloc) - SYMFUNC(xf86memchr) - SYMFUNC(xf86memcmp) - SYMFUNC(xf86memcpy) -#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \ - defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \ - defined (__amd64__) || defined(__x86_64__) - /* - * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle - * structure copies. This causes a problem both here and in shared - * libraries as there is no way to map the name of the call to the - * correct function. - */ - SYMFUNC(memcpy) - /* - * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle - * aggregate initializations. - */ - SYMFUNC(memset) -#endif - SYMFUNC(xf86memmove) - SYMFUNC(xf86memset) - SYMFUNC(xf86mmap) - SYMFUNC(xf86modf) - SYMFUNC(xf86munmap) - SYMFUNC(xf86open) - SYMFUNC(xf86perror) - SYMFUNC(xf86pow) - SYMFUNC(xf86printf) - SYMFUNC(xf86qsort) - SYMFUNC(xf86read) - SYMFUNC(xf86realloc) - SYMFUNC(xf86remove) - SYMFUNC(xf86rename) - SYMFUNC(xf86rewind) - SYMFUNC(xf86setbuf) - SYMFUNC(xf86setvbuf) - SYMFUNC(xf86sin) - SYMFUNC(xf86snprintf) - SYMFUNC(xf86sprintf) - SYMFUNC(xf86sqrt) - SYMFUNC(xf86sscanf) - SYMFUNC(xf86strcat) - SYMFUNC(xf86strcmp) - SYMFUNC(xf86strcasecmp) - SYMFUNC(xf86strcpy) - SYMFUNC(xf86strcspn) - SYMFUNC(xf86strerror) - SYMFUNC(xf86strlen) - SYMFUNC(xf86strncmp) - SYMFUNC(xf86strncasecmp) - SYMFUNC(xf86strncpy) - SYMFUNC(xf86strpbrk) - SYMFUNC(xf86strchr) - SYMFUNC(xf86strrchr) - SYMFUNC(xf86strspn) - SYMFUNC(xf86strstr) - SYMFUNC(xf86strtod) - SYMFUNC(xf86strtok) - SYMFUNC(xf86strtol) - SYMFUNC(xf86strtoul) - SYMFUNC(xf86tan) - SYMFUNC(xf86tmpfile) - SYMFUNC(xf86tolower) - SYMFUNC(xf86toupper) - SYMFUNC(xf86ungetc) - SYMFUNC(xf86vfprintf) - SYMFUNC(xf86vsnprintf) - SYMFUNC(xf86vsprintf) - SYMFUNC(xf86write) - -/* non-ANSI C functions */ - SYMFUNC(xf86opendir) - SYMFUNC(xf86closedir) - SYMFUNC(xf86readdir) - SYMFUNC(xf86rewinddir) - SYMFUNC(xf86ffs) - SYMFUNC(xf86strdup) - SYMFUNC(xf86bzero) - SYMFUNC(xf86usleep) - SYMFUNC(xf86execl) - - SYMFUNC(xf86getsecs) - SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */ - - SYMFUNC(xf86stat) - SYMFUNC(xf86fstat) - SYMFUNC(xf86access) - SYMFUNC(xf86geteuid) - SYMFUNC(xf86getegid) - SYMFUNC(xf86getpid) - SYMFUNC(xf86mknod) - SYMFUNC(xf86chmod) - SYMFUNC(xf86chown) - SYMFUNC(xf86sleep) - SYMFUNC(xf86mkdir) - SYMFUNC(xf86shmget) - SYMFUNC(xf86shmat) - SYMFUNC(xf86shmdt) - SYMFUNC(xf86shmctl) -#ifdef HAS_GLIBC_SIGSETJMP - SYMFUNC(xf86setjmp) - SYMFUNC(xf86setjmp0) -#if defined(__GLIBC__) && (__GLIBC__ >= 2) - SYMFUNCALIAS("xf86setjmp1",__sigsetjmp) -#else - SYMFUNC(xf86setjmp1) -#endif -#else - SYMFUNCALIAS("xf86setjmp",setjmp) - SYMFUNCALIAS("xf86setjmp0",setjmp) - SYMFUNC(xf86setjmp1) -#endif - SYMFUNCALIAS("xf86longjmp",longjmp) - SYMFUNC(xf86getjmptype) - SYMFUNC(xf86setjmp1_arg2) - SYMFUNC(xf86setjmperror) - SYMFUNC(xf86AddDriver) SYMFUNC(xf86ServerIsOnlyDetecting) SYMFUNC(xf86AddInputDriver) @@ -404,10 +217,6 @@ xf86cfgLoaderInitList(int type) "input", NULL }; - static const char *font[] = { - "fonts", - NULL - }; const char **subdirs; switch (type) { @@ -420,9 +229,6 @@ xf86cfgLoaderInitList(int type) case InputModule: subdirs = input; break; - case FontRendererModule: - subdirs = font; - break; default: fprintf(stderr, "Invalid value passed to xf86cfgLoaderInitList.\n"); subdirs = generic; @@ -453,13 +259,10 @@ xf86cfgCheckModule(void) { int errmaj, errmin; ModuleDescPtr module; - int nfonts; - FontModule *fonts, *pfont_module; driver = NULL; chips = NULL; info = NULL; - pfont_module = NULL; vendor = -1; module_type = GenericModule; @@ -502,47 +305,6 @@ xf86cfgCheckModule(void) XtFree(p); } - nfonts = numFontModules; - numFontModules = 0; - fonts = FontModuleList; - if (fonts) { - Bool dup = FALSE; - while (fonts->name) { - if (strcasecmp(fonts->name, *ploaderList) == 0) { - pfont_module = fonts; - /* HACK: - * fonts->names points into modules. - * Duplicate string of all remaining names to survive - * unloading. Since new fonts are appended to list - * this will only happen once per renderer. - */ - dup = TRUE; - } - if (dup) - fonts->name = strdup(fonts->name); - ++numFontModules; - ++fonts; - } - } - if (pfont_module) - module_type = FontRendererModule; - else if (nfonts + 1 <= numFontModules) { - /* loader.c will flag a warning if -noverify is not set */ - pfont_module = &FontModuleList[nfonts]; - module_type = FontRendererModule; - } - - if (font_module) { - XtFree((XtPointer)font_module->name); - XtFree((XtPointer)font_module); - font_module = NULL; - } - if (pfont_module) { - font_module = XtNew(FontModule); - memcpy(font_module, pfont_module, sizeof(FontModule)); - font_module->name = XtNewString(pfont_module->name); - } - UnloadModule(module); return (1); diff --git a/hw/xfree86/utils/xorgcfg/mouse-cfg.c b/hw/xfree86/utils/xorgcfg/mouse-cfg.c index 24aec6ae4..d74321e58 100644 --- a/hw/xfree86/utils/xorgcfg/mouse-cfg.c +++ b/hw/xfree86/utils/xorgcfg/mouse-cfg.c @@ -36,7 +36,6 @@ #include #include #include -#include /* * Prototypes @@ -44,7 +43,6 @@ static void MouseDeviceCallback(Widget, XtPointer, XtPointer); static void MouseProtocolCallback(Widget, XtPointer, XtPointer); static void MouseEmulateCallback(Widget, XtPointer, XtPointer); -static void MouseApplyCallback(Widget, XtPointer, XtPointer); static Bool MouseConfigCheck(void); /* @@ -265,35 +263,6 @@ MouseEmulateCallback(Widget w, XtPointer user_data, XtPointer call_data) emulate = (Bool)(long)call_data; } -static void -MouseApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i; - XF86MiscMouseSettings mouse; - - XF86MiscGetMouseSettings(XtDisplay(w), &mouse); - XtFree(mouse.device); - - if (mouse.baudrate == 0 || mouse.baudrate < 0 || mouse.baudrate > 9600 || - mouse.baudrate % 1200) - mouse.baudrate = 1200; - - mouse.type = MTYPE_AUTOMOUSE; - for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++) - if (strcmp(protocols[i].name, protocol) == 0) { - mouse.type = protocols[i].type; - break; - } - - mouse.emulate3buttons = emulate; - mouse.flags |= MF_REOPEN; - - mouse.device = device; - - XFlush(XtDisplay(w)); - XF86MiscSetMouseSettings(XtDisplay(w), &mouse); -} - void MouseDeviceAndProtocol(XF86SetupInfo *info) { @@ -396,7 +365,6 @@ MouseDeviceAndProtocol(XF86SetupInfo *info) XtAddCallback(emul3, XtNcallback, MouseEmulateCallback, NULL); apply = XtCreateManagedWidget("apply", commandWidgetClass, mouse_dp, NULL, 0); - XtAddCallback(apply, XtNcallback, MouseApplyCallback, NULL); XtRealizeWidget(mouse_dp); } diff --git a/hw/xfree86/utils/xorgconfig/.gitignore b/hw/xfree86/utils/xorgconfig/.gitignore deleted file mode 100644 index 6f3cabd65..000000000 --- a/hw/xfree86/utils/xorgconfig/.gitignore +++ /dev/null @@ -1 +0,0 @@ -xorgconfig.1 diff --git a/hw/xfree86/utils/xorgconfig/Cards b/hw/xfree86/utils/xorgconfig/Cards deleted file mode 100644 index b95928c37..000000000 --- a/hw/xfree86/utils/xorgconfig/Cards +++ /dev/null @@ -1,3135 +0,0 @@ -# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $ -# This is the database of card definitions used by xf86config. -# Each definition should have a NAME entry, CHIPSET (descriptive) and -# SERVER (one of Mono, VGA16, SVGA, S3, 8514, Mach8, Mach32, Mach64, AGX, -# P9000, W32, I128). -# A reference to another definition is made with SEE (already defined -# entries are not overridden). -# Optional entries are RAMDAC (identifier), CLOCKCHIP (identifier), -# DACSPEED, NOCLOCKPROBE (advises never to probe clocks), UNSUPPORTED -# (indicates card that is not yet properly supported by a dedicated -# server). A LINE entry adds a line of text to be included in the -# Device section (can include options or comments). -# There's no CLOCKS option (although a Clocks line can be included -# with LINE), as it is very undesirable to have a Clocks line that -# is incorrect. The idea is that the Clocks are probed for to be -# sure (a commented suggested Clocks line can be included). -# -# The majority of entries are just a binding of a model name to a -# chipset/server and untested. -# -# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.79 2002/10/16 01:31:05 dawes Exp $ - -# VGA - -NAME * Generic VGA compatible -SERVER VGA16 -DRIVER vga - -NAME * Generic VESA compatible -SERVER VGA16 -DRIVER vesa - -NAME * Unsupported VGA compatible -SERVER VGA16 -DRIVER vga -UNSUPPORTED - - -# # -# generic # -# # - -NAME ** Alliance Pro Motion (generic) [apm] -#CHIPSET apm -SERVER SVGA -DRIVER apm -LINE #Option "no_accel" - -NAME ** Ark Logic (generic) [ark] -#CHIPSET ark -SERVER SVGA -DRIVER ark - -NAME ** ASPEED Technology (generic) [ast] -#CHIPSET ast -SERVER SVGA -DRIVER ast - -NAME ** ATI (generic) [ati] -#CHIPSET ati -SERVER SVGA -DRIVER ati - -NAME ** ATI Rage 128 based (generic) [r128] -#CHIPSET r128 -SERVER SVGA -DRIVER r128 - -NAME ** ATI Radeon (generic) [radeon] -#CHIPSET radeon -SERVER SVGA -DRIVER radeon - -NAME ** Chips and Technologies (generic) [chips] -#CHIPSET chips -SERVER SVGA -DRIVER chips -LINE # Option "suspend_hack" -LINE # Option "STN" -LINE # Option "no_stretch" -LINE # Option "no_center" -LINE # Option "use_modeline" -LINE # Option "fix_panel_size" -LINE # videoram 512 -LINE # Option "noaccel" -LINE # Option "no_bitblt" -LINE # Option "xaa_no_color_exp" -LINE # Option "xaa_benchmark" -LINE # Option "hw_cursor" -LINE # Option "nolinear" -LINE # MemBase 0x03b00000 -LINE # Option "hw_clocks" -LINE # Textclockfreq 25.175 - -NAME ** Cirrus Logic (generic) [cirrus] -#CHIPSET cirrus -SERVER SVGA -DRIVER cirrus -LINE # MemBase 0x00e00000 # ISA card that maps to 14Mb -LINE # MemBase 0x04000000 # VLB card that maps to 64Mb -LINE # MemBase 0x80000000 # VLB card that maps to 2048Mb -LINE # MemBase 0x02000000 # VLB card that maps to 32Mb -LINE # Option "linear" -LINE # Option "fifo_conservative" - -NAME ** Cyrix MediaGX (generic) [cyrix] -#CHIPSET cyrix -SERVER SVGA -DRIVER cyrix - -NAME ** Linux framebuffer (generic) [fbdev] -#CHIPSET fbdev -SERVER SVGA -DRIVER fbdev - -NAME ** 3DLabs, TI (generic) [glint] -#CHIPSET glint -SERVER SVGA -DRIVER glint -LINE #Option "no_accel" - -NAME ** Number Nine I128 (generic) [i128] -#CHIPSET i128 -SERVER SVGA -DRIVER i128 - -NAME ** Intel i740 (generic) [i740] -#CHIPSET i740 -SERVER SVGA -DRIVER i740 - -NAME ** Intel i810 (generic) [i810] -#CHIPSET i810 -SERVER SVGA -DRIVER i810 - -NAME ** Matrox Graphics (generic) [mga] -#CHIPSET mga -SERVER SVGA -DRIVER mga -LINE # Option "mga_sdram" - -NAME ** NeoMagic (generic) [neomagic] -#CHIPSET neomagic -SERVER SVGA -DRIVER neomagic -LINE # Chipset "NM2160" -LINE # IOBase 0xfea00000 -LINE # MemBase 0xfd000000 -LINE # VideoRam 2048 -LINE # DacSpeed 90 -LINE # Option "linear" -LINE # Option "nolinear" -LINE # Option "sw_cursor" -LINE # Option "hw_cursor" -LINE # Option "no_accel" -LINE # Option "intern_disp" -LINE # Option "extern_disp" -LINE # Option "mmio" -LINE # Option "no_mmio" -LINE # Option "lcd_center" -LINE # Option "no_stretch" - -NAME ** NVIDIA (generic) [nv] -#CHIPSET nv -SERVER SVGA -DRIVER nv - -NAME ** Rendition (generic) [rendition] -#CHIPSET rendition -SERVER SVGA -DRIVER rendition -LINE # Option "sw_cursor" - -NAME ** S3 (not ViRGE or Savage) (generic) [s3] -#CHIPSET s3 -SERVER SVGA -DRIVER s3 - -NAME ** S3 ViRGE (generic) [s3virge] -#CHIPSET s3virge -SERVER SVGA -DRIVER s3virge -LINE # Option "xaa_benchmark" -LINE # Option "fifo_moderate" -LINE # Option "pci_burst_on" -LINE # Option "pci_retry" -LINE # Option "lcd_center" -LINE # Set_LCDClk - -NAME ** S3 Savage (generic) [savage] -#CHIPSET savage -SERVER SVGA -DRIVER savage - -NAME ** Silicon Motion (generic) [siliconmotion] -#CHIPSET siliconmotion -SERVER SVGA -DRIVER siliconmotion - -NAME ** SiS (generic) [sis] -#CHIPSET sis -SERVER SVGA -DRIVER sis -LINE # Option "no_accel" -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -LINE # Option "no_BitBlt" -LINE # Option "fast_vram" -LINE # Option "pci_burst_on" -LINE # Option "xaa_benchmark" -LINE # Option "ext_eng_queue" - -NAME ** 3Dfx (generic) [tdfx] -#CHIPSET tdfx -SERVER SVGA -DRIVER tdfx - -NAME ** DEC TGA (generic) [tga] -#CHIPSET tga -SERVER SVGA -DRIVER tga - -NAME ** Trident (generic) [trident] -#CHIPSET trident -SERVER SVGA -DRIVER trident - -NAME ** Tseng Labs (generic) [tseng] -#CHIPSET tseng -SERVER SVGA -DRIVER tseng -LINE # Option "linear" -LINE # Option "noaccel" -LINE # Option "power_saver" -LINE # Option "fast_dram" -LINE # Option "pci_retry" -LINE # Option "hibit_high" -LINE # Option "hibit_low" -LINE # MemBase 0x3C00000 - -NAME ** VMWare guest OS (generic) [vmware] -#CHIPSET vmware -SERVER SVGA -DRIVER vmware - - -#Chips & Technologies - -#untested -NAME Chips & Technologies CT65520 -CHIPSET ct65520 -SERVER SVGA -DRIVER chips -LINE # Device section for C&T cards. -LINE # Option "suspend_hack" -LINE # Option "STN" -LINE # Option "no_stretch" -LINE # Option "no_center" -LINE # Option "use_modeline" -LINE # Option "fix_panel_size" -LINE # videoram 512 - -NAME Chips & Technologies CT65525 -CHIPSET ct65525 -LINE # Option "nolinear" -LINE # MemBase 0x03b00000 -SEE Chips & Technologies CT65520 - -NAME Chips & Technologies CT65530 -CHIPSET ct65530 -SEE Chips & Technologies CT65525 - -NAME Chips & Technologies CT65535 -CHIPSET ct65535 -NOCLOCKPROBE -LINE # Option "hw_clocks" -LINE # Textclockfreq 25.175 -SEE Chips & Technologies CT65530 - -NAME Chips & Technologies CT65540 -CHIPSET ct65540 -NOCLOCKPROBE -LINE # Option "use_18bit_bus" -SEE Chips & Technologies CT65535 - -NAME Chips & Technologies CT65545 -CHIPSET ct65545 -NOCLOCKPROBE -LINE # Option "noaccel" -LINE # Option "no_bitblt" -LINE # Option "xaa_no_color_exp" -LINE # Option "xaa_benchmark" -LINE # Option "hw_cursor" -LINE # Option "mmio" -SEE Chips & Technologies CT65540 - -NAME Chips & Technologies CT65546 -CHIPSET ct65546 -SEE Chips & Technologies CT65545 - -NAME Chips & Technologies CT65548 -CHIPSET ct65548 -SEE Chips & Technologies CT65545 - -NAME Chips & Technologies CT65550 -CHIPSET ct65550 -NOCLOCKPROBE -LINE # Option "noaccel" -LINE # Option "no_bitblt" -LINE # Option "xaa_no_color_exp" -LINE # Option "xaa_benchmark" -LINE # Option "hw_cursor" -LINE # Option "sync_on_green" -LINE # Option "fast_dram" -LINE # Option "use_vclk1" -LINE # Textclockfreq 25.175 -SEE Chips & Technologies CT65530 - -NAME Chips & Technologies CT65554 -CHIPSET ct65554 -SEE Chips & Technologies CT65550 - -NAME Chips & Technologies CT65555 -CHIPSET ct65555 -SEE Chips & Technologies CT65550 - -NAME Chips & Technologies CT68554 -CHIPSET ct68554 -SEE Chips & Technologies CT65550 - -NAME Chips & Technologies CT69000 -CHIPSET ct69000 -SEE Chips & Technologies CT65550 - -NAME Chips & Technologies CT69030 -CHIPSET ct69030 -SEE Chips & Technologies CT65550 - -NAME Chips & Technologies CT64200 -CHIPSET ct64200 -SERVER SVGA -DRIVER chips -LINE # Device section for C&T cards. -LINE # videoram 1024 - -NAME Chips & Technologies CT64300 -CHIPSET ct64300 -SERVER SVGA -DRIVER chips -LINE # Option "noaccel" -LINE # Option "no_bitblt" -LINE # Option "xaa_no_color_exp" -LINE # Option "xaa_benchmark" -LINE # Option "hw_cursor" -LINE # Option "nolinear" -LINE # MemBase 0x03b00000 -LINE # Option "hw_clocks" -LINE # Textclockfreq 25.175 -SEE Chips & Technologies CT64200 - -# Cirrus Logic - -#tested -NAME Cirrus Logic GD542x -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE -LINE # Device section for Cirrus Logic GD5420/2/4/6/8/9-based cards. -LINE #MemBase 0x00e00000 -LINE #MemBase 0x04e00000 -LINE #Option "linear" - -#tested -NAME Cirrus Logic GD543x -CHIPSET CL-GD5430/5434/5436 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE -LINE # Device section for Cirrus Logic GD5430/34-based cards. -LINE #MemBase 0x00e00000 # ISA card that maps to 14Mb -LINE #MemBase 0x04000000 # VLB card that maps to 64Mb -LINE #MemBase 0x80000000 # VLB card that maps to 2048Mb -LINE #MemBase 0x02000000 # VLB card that maps to 32Mb -LINE #Option "linear" - -NAME Cirrus Logic GD544x -CHIPSET CL-GD544x -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE - -NAME Creative Labs Graphics Blaster MA201 -SEE Cirrus Logic GD544x - -NAME Creative Labs Graphics Blaster MA202 -SEE Cirrus Logic GD544x - -#tested -NAME Cirrus Logic GD5462 -CHIPSET CL-GD5462 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE -LINE #Option "fifo_conservative" - -#tested -NAME Cirrus Logic GD5464 -CHIPSET CL-GD5464 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE -LINE #Option "fifo_conservative" - -#tested -NAME Cirrus Logic GD5465 -CHIPSET CL-GD5465 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE -LINE #Option "fifo_conservative" - -NAME Creative Labs Graphics Blaster MA302 -CHIPSET CL-GD5462 -SEE Cirrus Logic GD5462 - -NAME Creative Labs Graphics Blaster MA334 -CHIPSET CL-GD5464 -SEE Cirrus Logic GD5464 - -NAME Creative Labs Graphics Blaster 3D -CHIPSET CL-GD5464 -SEE Cirrus Logic GD5464 - -#tested -NAME Cirrus Logic GD5480 -CHIPSET CL-GD5480 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE - -#tested -NAME Diamond SpeedStar 64 -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -NAME Diamond SpeedStar64 Graphics 2000/2200 -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -NAME Diamond SpeedStar Pro SE (CL-GD5430/5434) -SEE Cirrus Logic GD543x - -NAME Diamond SpeedStar Pro 1100 -SEE Cirrus Logic GD542x - -NAME Orchid Kelvin 64 VLB Rev A -CHIPSET CL-GD5434 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE -LINE # Device section for Orchid Kelvin 64 VLB Rev A -LINE # Linear framebuffer maps at 2048Mb. Some motherboards make linear addressing -LINE # impossible. Some cards map at 32Mb. -LINE #MemBase 0x02000000 # VLB card that maps to 32Mb -LINE #MemBase 0x04000000 # VLB card that maps to 64Mb -LINE MemBase 0x80000000 # VLB card that maps to 2048Mb -LINE #Option "linear" - -NAME Orchid Kelvin 64 VLB Rev B -CHIPSET CL-GD5434 -SERVER SVGA -DRIVER cirrus -NOCLOCKPROBE -LINE # Device section for Orchid Kelvin 64 VLB Rev B -LINE # Linear framebuffer maps at 32Mb. Some motherboards make linear addressing -LINE # impossible. Some cards map at 2048Mb. -LINE MemBase 0x02000000 # VLB card that maps to 32Mb -LINE #MemBase 0x04000000 # VLB card that maps to 64Mb -LINE #MemBase 0x80000000 # VLB card that maps to 2048Mb -LINE #Option "linear" - -NAME Orchid Kelvin 64 -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -NAME Intel 5430 -CHIPSET CL-GD5430 -SEE Cirrus Logic GD543x - -NAME STB Nitro (64) -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -NAME STB Nitro 64 Video -CHIPSET CL-GD5446 -SEE Cirrus Logic GD544x - -NAME STB Horizon -CHIPSET CL-GD5426/28 -SEE Cirrus Logic GD542x - -NAME STB Horizon Video -CHIPSET CL-GD5440 -SEE Cirrus Logic GD544x - -NAME Genoa 8500VL(-28) -CHIPSET CL-GD5426/28 -SEE Cirrus Logic GD542x - -NAME Diamond SpeedStar Pro (not SE) -CHIPSET CL-GD5426/28 -SEE Cirrus Logic GD542x - -NAME ALG-5434(E) -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -NAME Actix ProStar -CHIPSET CL-GD5426/5428 -SEE Cirrus Logic GD542x - -NAME Actix ProStar 64 -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -#tested -NAME Acumos AVGA3 -SEE Cirrus Logic GD542x - -NAME DFI-WG1000 -SEE Cirrus Logic GD542x - -NAME Spider VLB Plus -CHIPSET CL-GD5428 -SEE Cirrus Logic GD542x - -NAME VI720 -CHIPSET CL-GD5434 -SEE Cirrus Logic GD543x - -NAME Cirrus Logic GD62xx (laptop) -CHIPSET CL-GD6205/15/25/35 -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME Cirrus Logic GD64xx (laptop) -CHIPSET CL-GD6420/6440 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Cirrus Logic GD754x (laptop) -CHIPSET CL-GD7541/42/43/48 -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME Techworks Ultimate 3D -CHIPSET CL-GD5464 -SEE Cirrus Logic GD5464 - -NAME VideoLogic GrafixStar 550 -CHIPSET CL-GD5464 -SEE Cirrus Logic GD5464 - -NAME Jaton Video-70P -CHIPSET CL-GD5464 -SEE Cirrus Logic GD5464 - -NAME PixelView Combo TV Pro (Prolink) -CHIPSET CL-GD5480, 4MB -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE # COMMENT on card TV Tuner -NOCLOCKPROBE - -NAME PixelView Combo TV 3D AGP (Prolink) -CHIPSET CL-GD5465, 4MB -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE # COMMENT on card TV+FM Tuner -NOCLOCKPROBE - -NAME Creative Labs Graphics Blaster Eclipse (OEM Model CT6510) -SEE Cirrus Logic GD5465 - -NAME VideoLogic GrafixStar 560 (PCI/AGP) -SEE Cirrus Logic GD5465 - -NAME Cirrus Logic GD5446 (noname card) -CHIPSET CL-GD5446, 1MB (upgradable to 2MB). -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME Octek VL-VGA-26 -CHIPSET CL-GD5426 -SEE Cirrus Logic GD542x - -NAME Octek VL-VGA-28 -CHIPSET CL-GD5428 -SEE Cirrus Logic GD542x - -NAME Octek Combo-26 -CHIPSET CL-GD5426 -SEE Cirrus Logic GD542x - -NAME Octek Combo-28 -CHIPSET CL-GD5428 -SEE Cirrus Logic GD542x - -NAME Octek AVGA-20 -SEE Cirrus Logic GD542x - -# S3 801/805 - -NAME S3 801/805 (generic) -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED - -NAME S3 86C801 (generic) -SEE S3 801/805 (generic) - -NAME S3 86C805 (generic) -SEE S3 801/805 (generic) - -#tested -NAME S3 801/805 with ATT20c490 RAMDAC -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 -LINE #Option "dac_8_bit" # Not supported by some 20c490 clones - -NAME S3 801/805 with SC1148{2,3,4} RAMDAC -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC sc11482 - -NAME S3 801/805 with SC1148{5,7,9} RAMDAC -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC sc11485 - -NAME S3 801/805 with S3 GenDAC -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC s3gendac -CLOCKCHIP s3gendac - -NAME S3 801/805 with ATT20c490 RAMDAC and ICD2061A -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 -CLOCKCHIP icd2061a -LINE #Option "dac_8_bit" # Not supported by some 20c490 clones - -NAME S3 801/805 with Chrontel 8391 -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 -CLOCKCHIP ch8391 -LINE Option "dac_8_bit" - -#tested -NAME Actix GE32+ 2MB -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 -LINE #Option "dac_8_bit" - -NAME Actix GE32i -CHIPSET S3 805i -SERVER S3 -DRIVER vga -UNSUPPORTED - -NAME Orchid Fahrenheit VA -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 - -NAME Orchid Fahrenheit 1280 -CHIPSET S3 801 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Probable clocks: -LINE #Clocks 25.20 28.32 32.50 0.00 40.00 44.90 50.40 65.00 -LINE #Clocks 78.00 56.70 63.10 75.10 80.00 89.90 100.90 31.50 - -NAME Orchid Fahrenheit-1280+ -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20C490 -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE #Option "nolinear" # VLB card may require this -LINE #Probable clocks: -LINE #Clocks 25.20 28.32 40.0 0.0 50.10 77.0 36.10 45.0 -LINE #Clocks 130.0 120.20 80.0 31.50 110.30 65.0 75.0 94.60 - -NAME Diamond Stealth 24 -CHIPSET S3 801/805 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a -LINE #Option "nolinear" -LINE #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp - -NAME Miro Crystal 8S -SEE S3 801/805 (generic) - -NAME Miro Crystal 10SD with GenDAC -SEE S3 801/805 with S3 GenDAC - -NAME Dell S3 805 -SEE S3 801/805 (generic) - -NAME STB Powergraph X-24 -SEE S3 801/805 with ATT20c490 RAMDAC and ICD2061A - -NAME JAX 8241 -SEE S3 801/805 with Chrontel 8391 - -NAME VL-41 -SEE S3 801/805 with Chrontel 8391 - -NAME SPEA Mirage -SEE S3 801/805 with Chrontel 8391 - -# S3 864/Trio64/Trio32/868 - -NAME S3 864 (generic) -SERVER S3 -DRIVER vga -UNSUPPORTED - -NAME S3 86C864 (generic) -SEE S3 864 (generic) - -NAME S3 Vision864 (generic) -SEE S3 864 (generic) - -NAME S3 864 with SDAC (86C716) -CHIPSET S3 864 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC s3_sdac -CLOCKCHIP s3_sdac -NOCLOCKPROBE - -NAME S3 864 with ATT 20C498 or 21C498 -CHIPSET S3 864 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c498 - -NAME S3 864 with STG1703 -CHIPSET S3 864 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC stg1703 -NOCLOCKPROBE - -NAME S3 868 (generic) -CHIPSET S3 868 -SERVER S3 -DRIVER vga -UNSUPPORTED - -NAME S3 86C868 (generic) -SEE S3 868 (generic) - -NAME S3 Vision868 (generic) -SEE S3 868 (generic) - -NAME S3 868 with SDAC (86C716) -CHIPSET S3 868 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME S3 868 with ATT 20C498 or 21C498 -CHIPSET S3 868 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c498 - -NAME S3 868 with ATT 20C409 -CHIPSET S3 868 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c409 -NOCLOCKPROBE - -NAME Number Nine FX Motion 531 -CLOCKCHIP icd2061a -SEE S3 868 with ATT 20C498 or 21C498 - -NAME S3 Trio64 (generic) -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME S3 86C764 (generic) -SEE S3 Trio64 (generic) - -NAME S3 Trio64V+ (generic) -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME S3 86C765 (generic) -SEE S3 Trio64V+ (generic) - -NAME S3 Trio32 (generic) -CHIPSET S3 Trio32 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME Genoa Phantom 64i with S3 SDAC -DACSPEED 135 -SEE S3 864 with SDAC (86C716) - -NAME Number Nine GXE64 -CHIPSET S3 864 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a -LINE Option "number_nine" - -NAME Number Nine GXE64 with S3 Trio64 -SEE S3 Trio64 (generic) - -NAME Diamond Stealth 64 DRAM with S3 SDAC -DACSPEED 135 -SEE S3 864 with SDAC (86C716) - -NAME Diamond Stealth64 Graphics 2xx0 series (864 + SDAC) -DACSPEED 135 -SEE S3 864 with SDAC (86C716) - -NAME Diamond Stealth 64 DRAM with S3 Trio64 -SEE S3 Trio64 (generic) - -NAME Diamond Stealth64 Graphics 2xx0 series (Trio64) -SEE S3 Trio64 (generic) - -NAME Diamond Stealth 64 DRAM SE -SEE S3 Trio32 (generic) - -NAME Diamond Stealth64 Video 2001 series (2121/2201) -SEE S3 Trio64V+ (generic) - -NAME Actix GE64 -CLOCKCHIP icd2061a -SEE S3 864 (generic) - -NAME ELSA Winner 1000PRO with S3 SDAC -SEE S3 864 with SDAC (86C716) - -NAME ELSA Winner 1000PRO with STG1700 or AT&T RAMDAC -CHIPSET S3 864 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a - -NAME ELSA Winner 1000PRO/X -SEE S3 868 with SDAC (86C716) - -NAME ELSA Winner 1000ISA -CHIPSET S3 805i -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a -LINE Option "dac_8_bit" -LINE # the following settings should be detected and set automatically by XF86_S3 -LINE # if the serial number of the ELSA card is printed correctly: -LINE #ClockChip "icd2061a" - -NAME Cardex Trio64 -SEE S3 Trio64 (generic) - -NAME Cardex Trio64Pro -SEE S3 Trio64 (generic) - -NAME Miro Crystal 12SD -SEE S3 Trio32 (generic) - -NAME Miro Crystal 22SD -SEE S3 Trio64 (generic) - -NAME Miro Crystal 20SD with ICS2494 (BIOS 1.xx) -SEE S3 864 with ATT 20C498 or 21C498 - -NAME Miro Crystal 20SD with ICD2061A (BIOS 2.xx) -CLOCKCHIP icd2061a -SEE S3 864 with ATT 20C498 or 21C498 - -NAME Miro Crystal 20SD VLB with S3 SDAC (BIOS 3.xx) -SEE S3 864 with SDAC (86C716) - -NAME Miro Crystal 20SD PCI with S3 SDAC -SEE S3 868 with SDAC (86C716) - -NAME ELSA Winner 1000AVI (SDAC version) -SEE S3 868 with SDAC (86C716) - -NAME ELSA Winner 1000AVI (AT&T 20C409 version) -SEE S3 868 with ATT 20C409 - -NAME Diamond Stealth Video DRAM -SEE S3 868 with SDAC (86C716) - -NAME Diamond Stealth64 Video 2120/2200 -SEE S3 868 with SDAC (86C716) - -NAME SPEA/V7 Mirage P64 -CLOCKCHIP ics2595 -SEE S3 864 (generic) - -NAME SPEA/V7 Mirage P64 with S3 Trio64 -SEE S3 Trio64 (generic) - -NAME Number Nine FX Vision 330 -SEE S3 Trio64 (generic) - -NAME Number Nine FX Motion 331 -SEE S3 Trio64V+ (generic) - -NAME ASUS Video Magic PCI V864 -SEE S3 864 (generic) - -NAME ASUS Video Magic PCI VT64 -SEE S3 Trio64 (generic) - -NAME VidTech FastMax P20 -SEE S3 864 (generic) - -NAME VideoLogic GrafixStar 500 -SEE S3 868 with SDAC (86C716) - -NAME VideoLogic GrafixStar 400 -SEE S3 Trio64V+ (generic) - -NAME VideoLogic GrafixStar 300 -SEE S3 Trio64 (generic) - -NAME 2 the Max MAXColor S3 Trio64V+ -SEE S3 Trio64V+ (generic) - -NAME DataExpert DSV3365 -SEE S3 Trio64V+ (generic) - -NAME ExpertColor DSV3365 -SEE S3 Trio64V+ (generic) - -NAME DSV3326 -SEE S3 Trio64V+ (generic) - -# S3 Trio64V2 - -NAME S3 Trio64V2 (generic) -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME S3 Trio64V2/DX (generic) -SEE S3 Trio64V2 (generic) - -NAME S3 Trio64V2/GX (generic) -SEE S3 Trio64V2 (generic) - -NAME S3 86C775 (generic) -SEE S3 Trio64V2/DX (generic) - -NAME S3 86C785 (generic) -SEE S3 Trio64V2/GX (generic) - -NAME ELSA WINNER 1000/T2D -SEE S3 Trio64V2/DX (generic) - - -# S3 Aurora64V+ - -NAME S3 Aurora64V+ (generic) -CHIPSET S3 Aurora64V+ -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE -LINE # Option "lcd_center" -LINE # Set_LCDClk - -NAME S3 86CM65 -SEE S3 Aurora64V+ (generic) - -NAME SHARP 9080 -SEE S3 Aurora64V+ (generic) - -NAME SHARP 9090 -SEE S3 Aurora64V+ (generic) - -NAME COMPAQ Armada 7730MT -SEE S3 Aurora64V+ (generic) - -NAME COMPAQ Armada 7380DMT -SEE S3 Aurora64V+ (generic) - - -# S3 964/968 - -NAME S3 964 (generic) -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME S3 86C964 (generic) -SEE S3 964 (generic) - -NAME S3 Vision964 (generic) -SEE S3 964 (generic) - -NAME S3 968 (generic) -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME S3 86C968 (generic) -SEE S3 968 (generic) - -NAME S3 Vision968 (generic) -SEE S3 968 (generic) - -NAME Number Nine GXE64 Pro -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC ti3025 -LINE Option "number_nine" - -NAME Diamond Stealth 64 VRAM -CLOCKCHIP icd2061a -LINE #Option "slow_vram" -SEE S3 964 (generic) - -NAME Diamond Stealth64 Video 3200 -CHIPSET S3 968 -LINE #Option "slow_vram" -SEE S3 968 (generic) - -NAME Diamond Stealth 64 Video VRAM (TI RAMDAC) -CHIPSET S3 968 -LINE #Option "slow_vram" -LINE #DacSpeed 220 -SEE S3 968 (generic) - -NAME Diamond Stealth64 Video 3240/3400 (TI RAMDAC) -CHIPSET S3 968 -LINE #Option "slow_vram" -LINE #DacSpeed 220 -SEE S3 968 (generic) - -NAME Diamond Stealth64 Video 3240/3400 (IBM RAMDAC) -CHIPSET S3 968 -LINE #Option "slow_vram" -RAMDAC ibm_rgb526 -LINE DacSpeed 220 -SEE S3 968 (generic) - -NAME Genoa VideoBlitz III AV -CHIPSET S3 968 -LINE #s3RefClk 50 -LINE #DACspeed 170 -SEE S3 968 (generic) - -NAME STB Velocity 64 Video -CHIPSET S3 968 -LINE #s3RefClk 24 -LINE #DACspeed 220 -SEE S3 968 (generic) - -NAME STB Powergraph 64 Video -SEE S3 Trio64V+ (generic) - -NAME STB Powergraph 64 -SEE S3 Trio64 (generic) - -NAME ELSA Winner 1000TRIO -SEE S3 Trio64 (generic) - -NAME ELSA Winner 1000TRIO/V -SEE S3 Trio64V+ (generic) - -NAME Hercules Graphite Terminator 64 -LINE Option "slow_vram" -LINE #s3RefClk 50 -LINE #DACspeed 170 -SEE S3 964 (generic) - -NAME Hercules Terminator 64/Video -SEE S3 Trio64V+ (generic) - -NAME Hercules Graphite Terminator 64/DRAM -SEE S3 Trio64 (generic) - -NAME Hercules Graphite Terminator Pro 64 -LINE #s3RefClk 16 -LINE #DACspeed 220 -SEE S3 968 (generic) - -NAME Number Nine FX Motion 771 -LINE #s3RefClk 16 -SEE S3 968 (generic) - -NAME Spider Tarantula 64 -SEE S3 964 (generic) - -NAME Miro Crystal 20SV -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a - -NAME Miro Crystal 40SV -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP ti3025 - -NAME Miro Crystal 80SV -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME Miro Video 20SV -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c505 -LINE #DacSpeed 150 -CLOCKCHIP ics9161a - -NAME SPEA Mercury 64 -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP ics9161a -LINE #Option "spea_mercury" - -NAME ELSA Winner 2000PRO-2 -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "ELSA_w2000pro" -NOCLOCKPROBE - -NAME ELSA Winner 2000PRO-4 -CHIPSET S3 964 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "ELSA_w2000pro" -NOCLOCKPROBE - -NAME ELSA Winner 2000PRO/X-2 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "sync_on_green" -NOCLOCKPROBE - -NAME ELSA Winner 2000PRO/X-4 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "sync_on_green" -NOCLOCKPROBE - -NAME ELSA Winner 2000PRO/X-8 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "sync_on_green" -NOCLOCKPROBE - -NAME ELSA Winner 2000AVI -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "sync_on_green" -NOCLOCKPROBE - -NAME ELSA Gloria-4 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "sync_on_green" -NOCLOCKPROBE - -NAME ELSA Gloria-8 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Option "sync_on_green" -NOCLOCKPROBE - -NAME VideoLogic GrafixStar 700 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME LeadTek WinFast S430 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME WinFast S430 -SEE LeadTek WinFast S430 - -NAME LeadTek WinFast S510 -CHIPSET S3 968 -SERVER S3 -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME WinFast S510 -SEE LeadTek WinFast S510 - -# S3 928 - -NAME S3 928 (generic) -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED - -NAME S3 86C928 (generic) -SEE S3 928 (generic) - -NAME Actix Ultra -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 -LINE #Option "dac_8_bit" - -NAME Diamond Stealth Pro -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a -LINE #Ramdac "att20c490" # The Diamond RAMDAC is reportedly compatible for 15bpp -LINE #Option "no_linear" # Some VLB machines may require this - -NAME ELSA Winner 1000VL -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE # the following settings should be detected and set automatically by XF86_S3 -LINE # if the serial number of the ELSA card is printed correctly: -LINE #ClockChip "icd2061a" -LINE #Membase 0xf8000000 - -NAME ELSA Winner 1000TwinBus -SEE ELSA Winner 1000VL - -NAME ELSA Winner 2000 -SEE S3 928 (generic) - -NAME Miro Crystal 16S -SEE S3 928 (generic) - -NAME SPEA/V7 Mercury -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP sc11412 -LINE Option "spea_mercury" - -NAME STB Pegasus -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -RAMDAC bt485 -CLOCKCHIP icd2061a -LINE Option "stb_pegasus" -LINE #Option "sync_on_green" - -NAME Number Nine GXE Level 14/16 -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -DACSPEED 200 -CLOCKCHIP icd2061a -LINE Option "number_nine" -LINE #Option "nolinear" -LINE #Option "nomemaccess" - -NAME Number Nine GXE Level 10/11/12 -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a -LINE Option "number_nine" - -NAME 928Movie -CHIPSET S3 928 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2595 -RAMDAC bt485 -LINE # pixel multiplexing not supported - -# S3 911/924 - -NAME S3 911/924 (generic) -CHIPSET S3 911/924 -SERVER S3 -DRIVER vga -UNSUPPORTED - -NAME S3 86C911 (generic) -SEE S3 911/924 (generic) - -NAME S3 86C924 (generic) -SEE S3 911/924 (generic) - -NAME Diamond Stealth VRAM -CHIPSET S3 911/924 -SERVER S3 -DRIVER vga -UNSUPPORTED -CLOCKCHIP icd2061a - -#NAME Orchid Fahrenheit 1280 -#SEE S3 911/924 (generic) - -NAME S3 924 with SC1148 DAC -CHIPSET S3 924 -SERVER S3 -DRIVER vga -UNSUPPORTED -LINE #Probable clocks: -LINE #Clocks 25.2 28.3 39.7 1.7 49.9 76.7 35.7 44 -LINE #Clocks 130.2 119.5 79.4 31.2 110.0 65.2 74.9 71.3 - -# S3 ViRGE,/DX,/GX and ViRGE/VX - -NAME S3 ViRGE (old S3V server) -CHIPSET S3 ViRGE -SERVER S3V -DRIVER s3virge -NOCLOCKPROBE - -NAME S3 ViRGE (generic) -CHIPSET S3 ViRGE -SERVER SVGA -DRIVER s3virge -NOCLOCKPROBE -LINE #Option "xaa_benchmark" -LINE #Option "fifo_moderate" -LINE #Option "pci_burst_on" -LINE #Option "pci_retry" - -NAME S3 ViRGE/DX (generic) -CHIPSET S3 ViRGE/DX -SERVER SVGA -DRIVER s3virge -NOCLOCKPROBE -LINE #Option "xaa_benchmark" -LINE #Option "fifo_moderate" -LINE #Option "pci_burst_on" -LINE #Option "pci_retry" - -NAME S3 ViRGE/GX (generic) -CHIPSET S3 ViRGE/GX -SERVER SVGA -DRIVER s3virge -NOCLOCKPROBE -LINE #Option "xaa_benchmark" -LINE #Option "fifo_moderate" -LINE #Option "pci_burst_on" -LINE #Option "pci_retry" - - -NAME S3 ViRGE/GX2 (generic) -CHIPSET S3 ViRGE/GX2 -SERVER SVGA -DRIVER s3virge -NOCLOCKPROBE -LINE #Option "xaa_benchmark" -LINE #Option "fifo_moderate" -LINE #Option "pci_burst_on" -LINE #Option "pci_retry" - -NAME S3 ViRGE/MX (generic) -CHIPSET S3 ViRGE/MX -SERVER SVGA -DRIVER s3virge -NOCLOCKPROBE -LINE #Option "lcd_center" -LINE #Set_LCDClk -LINE #Option "xaa_benchmark" -LINE #Option "fifo_moderate" -LINE #Option "pci_burst_on" -LINE #Option "pci_retry" - -NAME S3 ViRGE/MX+ (generic) -SEE S3 ViRGE/MX (generic) - - - - -NAME S3 86C325 (generic) -SEE S3 ViRGE (generic) - -NAME S3 86C375 (generic) -SEE S3 ViRGE/DX (generic) - -NAME S3 86C385 (generic) -SEE S3 ViRGE/GX (generic) - -NAME S3 86C357 (generic) -SEE S3 ViRGE/GX2 (generic) - -NAME S3 86C260 (generic) -SEE S3 ViRGE/MX (generic) - -NAME S3 86C280 (generic) -SEE S3 ViRGE/MX+ (generic) - - -NAME ELSA Victory 3D -SEE S3 ViRGE (generic) - -NAME ELSA Victory 3DX -SEE S3 ViRGE/DX (generic) - -NAME ELSA Winner 3000-S -SEE S3 ViRGE (generic) - -NAME Number Nine Visual 9FX Reality 332 -SEE S3 ViRGE (generic) - -NAME Number Nine FX Motion 332 -SEE S3 ViRGE (generic) - -NAME Diamond Stealth 3D 2000 -SEE S3 ViRGE (generic) - -NAME Diamond Stealth 3D 2000 PRO -SEE S3 ViRGE/DX (generic) - -NAME Diamond Multimedia Stealth 3D 2000 -SEE S3 ViRGE (generic) - -NAME Diamond Multimedia Stealth 3D 2000 PRO -SEE S3 ViRGE/DX (generic) - -NAME Canopus Co. Power Window 3DV -SEE S3 ViRGE (generic) - -NAME DataExpert DSV3325 -SEE S3 ViRGE (generic) - -NAME ExpertColor DSV3325 -SEE S3 ViRGE (generic) - -NAME DSV3325 -SEE S3 ViRGE (generic) - -NAME Hercules Terminator 64/3D -SEE S3 ViRGE (generic) - -NAME Hercules Terminator 3D/DX -SEE S3 ViRGE/DX (generic) - -NAME LeadTek WinFast 3D S600 -SEE S3 ViRGE (generic) - -NAME WinFast 3D S600 -SEE LeadTek WinFast 3D S600 - -NAME LeadTek WinFast 3D S680 -SEE S3 ViRGE/GX2 (generic) - -NAME Miro MiroMedia 3D -SEE S3 ViRGE (generic) - -NAME Orchid Technology Fahrenheit Video 3D -SEE S3 ViRGE (generic) - -NAME STB Systems Powergraph 3D -SEE S3 ViRGE (generic) - -NAME STB Nitro 3D -CHIPSET S3 ViRGE/GX -SEE S3 ViRGE/GX (generic) - -NAME MELCO WGP-VG4S -LINE #DACSpeed 191 162 111 83 -LINE #SetMClck 75 -SEE S3 ViRGE (generic) - - - -NAME S3 ViRGE/VX (generic) -CHIPSET S3 ViRGE/VX -SERVER SVGA -DRIVER s3virge -NOCLOCKPROBE -LINE #Option "xaa_benchmark" -LINE #Option "fifo_moderate" -LINE #Option "pci_burst_on" -LINE #Option "pci_retry" - - -NAME S3 86C988 (generic) -SEE S3 ViRGE/VX (generic) - -NAME ELSA Winner 3000 -SEE S3 ViRGE/VX (generic) - -NAME ELSA Winner 3000-M-22 -SEE S3 ViRGE/VX (generic) - -NAME ELSA Winner 3000-L-42 -SEE S3 ViRGE/VX (generic) - -NAME ELSA Winner 2000AVI/3D -SEE S3 ViRGE/VX (generic) - -NAME Diamond Stealth 3D 3000 -SEE S3 ViRGE/VX (generic) - -NAME STB Systems Velocity 3D -SEE S3 ViRGE/VX (generic) - -NAME MELCO WGP-VX8 -SEE S3 ViRGE/VX (generic) - -NAME Diamond Stealth 3D 4000 -SEE S3 ViRGE/GX2 (generic) - -NAME Toshiba Tecra 750CDT -SEE S3 ViRGE/MX (generic) - -NAME Toshiba Tecra 750DVD -SEE S3 ViRGE/MX (generic) - -NAME Toshiba Tecra 540CDT -SEE S3 ViRGE/MX (generic) - -NAME Toshiba Tecra 550CDT -SEE S3 ViRGE/MX (generic) - -# currently unsupported S3 - -NAME S3 86C365 (Trio3D) -SEE * Unsupported VGA compatible - -NAME S3 86C391 (Savage3D) -SEE * Unsupported VGA compatible - -NAME S3 Trio3D -SEE * Unsupported VGA compatible - -NAME S3 Savage3D -SEE * Unsupported VGA compatible - -NAME S3 Savage4 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -# ET4000/ET6000 - -NAME ET3000 (generic) -CHIPSET ET3000 -SERVER SVGA -DRIVER tseng - -NAME Genoa 5400 -SEE ET3000 (generic) - -NAME ET4000 (generic) -CHIPSET ET4000 -SERVER SVGA -DRIVER tseng - -NAME ET4000/W32 (generic) -CHIPSET ET4000/W32 -SERVER W32 -DRIVER tseng - -NAME ET4000 W32i, W32p (generic) -CHIPSET ET4000/W32(i/p) -SERVER SVGA -DRIVER tseng -LINE #Option "linear" # for linear mode at 8bpp -LINE #Option "noaccel" # when problems with accelerator -LINE #Option "power_saver" # enable VESA DPMS -LINE #Option "fast_dram" -LINE #Option "pci_retry" # faster, but problematic for ISA DMA -LINE #Option "hibit_high" # see README.tseng -- most cards need this -LINE #Option "hibit_low" # see README.tseng -- mostly for older ET4000 cards -LINE #MemBase 0x3C00000 # when automatic MemBase detection doesn't work -LINE # -- see README.tseng for more (important) information on MemBase - -NAME ET6000 (generic) -CHIPSET ET6000 -SERVER SVGA -DRIVER tseng -NOCLOCKPROBE -LINE #videoram 2304 # 2.25 MB, when memory probe is incorrect -LINE #Option "linear" # for linear mode at 8bpp -LINE #Option "noaccel" # when problems with accelerator -LINE #Option "power_saver" # enable VESA DPMS -LINE #Option "pci_retry" # faster, but problematic for ISA DMA -LINE #Option "hw_cursor" # Use hardware cursor (see docs for limitations) -LINE #Option "xaa_no_color_exp" # When text (or bitmap) is not rendered correctly - -NAME ET6100 (generic) -CHIPSET ET6100 -SEE ET6000 (generic) - -NAME Diamond Stealth 32 -CLOCKCHIP icd2061a -NOCLOCKPROBE -SEE ET4000 W32i, W32p (generic) - -NAME Cardex Cobra -SEE ET4000 W32i, W32p (generic) - -NAME Cardex Challenger (Pro) -SEE ET4000 W32i, W32p (generic) - -NAME Colorgraphic Dual Lightning -SEE ET4000 W32i, W32p (generic) - -NAME Dell onboard ET4000 -SEE ET4000 (generic) - -NAME DFI-WG5000 -SEE ET4000 W32i, W32p (generic) - -NAME Diamond SpeedStar (Plus) -SEE ET4000 (generic) - -NAME Diamond SpeedStar 24 -SEE ET4000 (generic) - -NAME Diamond SpeedStar HiColor -SEE ET4000 (generic) - -NAME Genoa 8900 Phantom 32i -SEE ET4000 W32i, W32p (generic) - -NAME Hercules Dynamite -SEE ET4000/W32 (generic) - -NAME Hercules Dynamite Power -SEE ET4000 W32i, W32p (generic) - -NAME Hercules Dynamite Pro -SEE ET4000 W32i, W32p (generic) - -NAME Integral FlashPoint -SEE ET4000 W32i, W32p (generic) - -NAME LeadTek WinFast S200 -SEE ET4000 W32i, W32p (generic) - -NAME Matrox Comet -SEE ET4000 W32i, W32p (generic) - -NAME Matrox Marvel II -SEE ET4000 W32i, W32p (generic) - -NAME Miro MiroVideo 20TD -SEE ET4000 W32i, W32p (generic) - -NAME WinFast S200 -SEE LeadTek WinFast S200 - -NAME Sigma Concorde -SEE ET4000/W32 (generic) - -NAME Sigma Legend -SEE ET4000 (generic) - -NAME SPEA/V7 ShowTime Plus -SEE ET4000 W32i, W32p (generic) - -NAME STB LightSpeed -SEE ET4000 W32i, W32p (generic) - -NAME STB MVP-2 -SEE ET4000 (generic) - -NAME STB MVP-2 PCI -SEE ET4000 W32i, W32p (generic) - -NAME STB MVP-2X -SEE ET4000 W32i, W32p (generic) - -NAME STB MVP-4 PCI -SEE ET4000 W32i, W32p (generic) - -NAME STB MVP-4X -SEE ET4000 W32i, W32p (generic) - -NAME TechWorks Thunderbolt -SEE ET4000/W32 (generic) - -NAME ViewTop PCI -SEE ET4000 W32i, W32p (generic) - -NAME SNI PC5H W32 -CLOCKCHIP stg1703 -NOCLOCKPROBE -SEE ET4000 W32i, W32p (generic) - -NAME SNI Scenic W32 -CLOCKCHIP stg1703 -NOCLOCKPROBE -SEE ET4000 W32i, W32p (generic) - -NAME Hercules Dynamite 128/Video -SEE ET6000 (generic) - -NAME STB LightSpeed 128 -SEE ET6000 (generic) - -NAME VideoLogic GrafixStar 600 -SEE ET6000 (generic) - -NAME Jazz Multimedia G-Force 128 -SEE ET6000 (generic) - -NAME Mirage Z-128 -SEE ET6000 (generic) - -NAME California Graphics SunTracer 6000 -SEE ET6000 (generic) - -NAME Binar Graphics AnyView -SEE ET6000 (generic) - -NAME MediaVision Proaxcel 128 -SEE ET6000 (generic) - -NAME ATrend ATC-2165A -SEE ET6000 (generic) - -NAME Interay PMC Viper -SEE ET6000 (generic) - -NAME 2-the-Max MAXColor 6000 -SEE ET6000 (generic) - -NAME Gainward Challenger EV -SEE ET6000 (generic) - -NAME MachSpeed VGA ET6000 -SEE ET6000 (generic) - -NAME KouTech KeyVision 128 EV -SEE ET6000 (generic) - -NAME Jaton Video-58P -SEE ET6000 (generic) - -# ATI - -NAME ATI Rage 128 -CHIPSET ati -SERVER SVGA -DRIVER ati - -NAME ATI 8514 Ultra (no VGA) -CHIPSET ati -SERVER Mach8 -DRIVER vga -UNSUPPORTED - -NAME ATI Graphics Ultra -CHIPSET ati -SERVER Mach8 -DRIVER ati - -NAME ATI Graphics Ultra Pro -CHIPSET ati -SERVER Mach32 -DRIVER ati - -NAME ATI Wonder SVGA -CHIPSET ati -SERVER SVGA -DRIVER ati - -NAME ATI Ultra Plus -CHIPSET ati -SERVER Mach32 -DRIVER ati - -NAME ATI Mach32 -CHIPSET ati -SERVER Mach32 -DRIVER ati - -NAME ATI Mach64 -CHIPSET ati -SERVER Mach64 -DRIVER ati -NOCLOCKPROBE - -NAME ATI Mach64 CT (264CT) -SEE ATI Mach64 - -NAME ATI Mach64 VT (264VT) -SEE ATI Mach64 - -NAME ATI Mach64 GT (264GT), aka 3D RAGE -SEE ATI Mach64 - -NAME ATI Mach64 3D RAGE II -SEE ATI Mach64 - -NAME ATI Mach64 3D RAGE II+DVD -SEE ATI Mach64 - -NAME ATI Mach64 3D Rage IIC -SEE ATI Mach64 - -NAME ATI Mach64 3D Rage Pro -SEE ATI Mach64 - -NAME ATI 3D Pro Turbo -SEE ATI Mach64 - -NAME ATI 3D Pro Turbo PC2TV -SEE ATI Mach64 - -NAME ATI 3D Xpression -SEE ATI Mach64 - -NAME ATI 3D Xpression+ -SEE ATI Mach64 - -NAME ATI 3D Xpression+ PC2TV -SEE ATI Mach64 - -NAME ATI All-in-Wonder -SEE ATI Mach64 - -NAME ATI All-in-Wonder Pro -SEE ATI Mach64 - -NAME ATI Graphics Pro Turbo -SEE ATI Mach64 - -NAME ATI Graphics Pro Turbo 1600 -SEE ATI Mach64 - -NAME ATI Graphics Xpression -SEE ATI Mach64 - -NAME ATI Video Boost -SEE ATI Mach64 - -NAME ATI Video Charger -SEE ATI Mach64 - -NAME ATI Video Xpression -SEE ATI Mach64 - -NAME ATI Video Xpression+ -SEE ATI Mach64 - -NAME ATI WinBoost -SEE ATI Mach64 - -NAME ATI WinCharger -SEE ATI Mach64 - -NAME ATI WinTurbo -SEE ATI Mach64 - -NAME ATI Xpert 98 -SEE ATI Mach64 - -NAME ATI Xpert XL -SEE ATI Mach64 - -NAME ATI Xpert@Play -SEE ATI Mach64 - -NAME ATI Xpert@Play 98 -SEE ATI Mach64 - -NAME ATI Xpert@Work -SEE ATI Mach64 - -NAME ATI integrated on Intel Maui MU440EX motherboard -SEE ATI Mach64 - -NAME ASUS PCI-V264CT -SEE ATI Mach64 - -NAME ASUS PCI-AV264CT -SEE ATI Mach64 - -# AGX - -NAME AGX (generic) -CHIPSET AGX-014/15/16 -SERVER AGX -DRIVER vga -UNSUPPORTED - -NAME Boca Vortex (Sierra RAMDAC) -CHIPSET AGX-015 -SERVER AGX -DRIVER vga -UNSUPPORTED -RAMDAC sc15025 -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels - -NAME EIZO (VRAM) -SEE AGX (generic) - -NAME Orchid Celsius (AT&T RAMDAC) -CHIPSET AGX-015 -SERVER AGX -DRIVER vga -UNSUPPORTED -RAMDAC att20c490 -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels - -NAME Orchid Celsius (Sierra RAMDAC) -CHIPSET AGX-015 -SERVER AGX -DRIVER vga -UNSUPPORTED -RAMDAC sc15025 -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels - - -NAME Spider Black Widow -CHIPSET AGX-015 -SERVER AGX -DRIVER vga -UNSUPPORTED -RAMDAC sc15025 -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels - - -NAME Spider Black Widow Plus -CHIPSET AGX-016 -SERVER AGX -DRIVER vga -UNSUPPORTED -RAMDAC sc15025 -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels -LINE #Option "fifo_aggressive" # 3x bus bw - may result in random pixels -LINE #Probable clocks: -LINE #Clocks 25.2 28.3 39.9 72.2 50.0 76.9 36.1 44.8 -LINE #Clocks 89.0 119.8 79.9 31.5 110.0 64.9 74.9 94.9 - -NAME Hercules Graphite HG210 -CHIPSET AGX-014 -SERVER AGX -DRIVER vga -UNSUPPORTED -RAMDAC bt482 -DACSPEED 85 -LINE Chipset "AGX-014" -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Probable clocks: -LINE #Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0 -LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0 - -NAME Hercules Graphite Pro -CHIPSET AGX-015 -SERVER AGX -DRIVER vga -UNSUPPORTED -# Card specific DAC, doesn't appear in ramdac menu -LINE Ramdac "herc_dual_dac" -LINE Chipset "AGX-015" -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels -LINE #Probable clocks: -LINE #Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0 -LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0 - -NAME Hercules Graphite Power -CHIPSET AGX-016 -SERVER AGX -DRIVER vga -UNSUPPORTED -# Card specific DAC, doesn't appear in ramdac menu -# The glue logic state machine for RAMDAC switching doesn't work as -# documented, for now we're stuck with the small RAMDAC -LINE Ramdac "herc_small_dac" -LINE Chipset "AGX-016" -LINE Option "dac_8_bit" -LINE Option "no_wait_state" -LINE #Option "fifo_moderate" # 2x bus bw - may result in random pixels -LINE #Option "fifo_aggressive" # 3x bus bw - may result in random pixels -LINE #Probable clocks: -LINE #Clocks 25.0 28.0 32.0 36.0 40.0 45.0 50.0 65.0 -LINE #Clocks 70.0 75.0 80.0 85.0 90.0 95.0 100.0 110.0 - -NAME XGA-2 (ISA bus) -CHIPSET XGA-2 -SERVER AGX -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE -LINE #Instance 7 # XGA instance 0-7 -LINE #COPbase 0xC8F00 # XGA memory-mapped register address -LINE #POSbase 0 # Disable probing if above are specified - -NAME XGA-1 (ISA bus) -CHIPSET XGA-1 -SERVER AGX -DRIVER vga -UNSUPPORTED -LINE #Instance 7 # XGA instance 0-7 -LINE #COPbase 0xC8F00 # XGA memory-mapped register address -LINE #POSbase 0 # Disable probing if above are specified - -# WD - -NAME Paradise/WD 90CXX -CHIPSET WD90CXX -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME DFI-WG6000 -CHIPSET WD90C33 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Diamond SpeedStar 24X (not fully supported) -CHIPSET WD90C31 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME WD 90C24 (laptop) -CHIPSET WD90C24 -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE #Chipset "wd90c24" -LINE #Option "noaccel" # Use this if acceleration is causing problems -LINE #Clocks 25.175 28.322 65 36 # These are not programmable -LINE #Clocks 29.979 77.408 62.195 59.957 # These are programmable -LINE #Clocks 31.5 35.501 75.166 50.114 # These are not programmable -LINE #Clocks 39.822 72.038 44.744 80.092 # These are programmable -LINE #Clocks 44.297 # Must match Mclk - - -NAME WD 90C24A or 90C24A2 (laptop) -CHIPSET WD90C24A -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE #Chipset "wd90c24" -LINE #Clocks 25.175 28.322 65 36 # These are not programmable -LINE #Clocks 29.979 77.408 62.195 59.957 # These are programmable -LINE #Clocks 31.5 35.501 75.166 50.114 # These are not programmable -LINE #Clocks 39.822 72.038 44.744 80.092 # These are programmable -LINE #Clocks 44.297 # Must match Mclk - -# Avance Logic - -NAME Avance Logic 2101 -CHIPSET Avance Logic -LINE #chipset "al2101" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Avance Logic 2228 -CHIPSET Avance Logic -LINE #chipset "ali2228" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Avance Logic 2301 -CHIPSET Avance Logic -LINE #chipset "ali2301" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Avance Logic 2302 -CHIPSET Avance Logic -LINE #chipset "ali2302" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Avance Logic 2308 -CHIPSET Avance Logic -LINE #chipset "ali2308" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Avance Logic 2401 -CHIPSET Avance Logic -LINE #chipset "ali2401" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Hercules Stingray -CHIPSET ALG-2228/2301/2302 -LINE #chipset "ali2228" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME SPEA/V7 Mirage VEGA Plus -CHIPSET ALG-2228 -LINE #chipset "ali2228" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -# ARK Logic - -NAME Ark Logic ARK1000PV (generic) -CHIPSET ARK1000PV -SERVER SVGA -DRIVER vga -UNSUPPORTED - -# For now, treat the VL as a PV. This may be changed later -NAME Ark Logic ARK1000VL (generic) -CHIPSET ARK1000VL -LINE Chipset "ark1000pv" -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Ark Logic ARK2000PV (generic) -CHIPSET ARK1000PV -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Ark Logic ARK2000MT (generic) -CHIPSET ARK1000MT -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Hercules Stingray Pro -SEE Ark Logic ARK1000PV (generic) - -NAME Hercules Stingray Pro/V -SEE Ark Logic ARK1000PV (generic) - -NAME Ocean (octek) VL-VGA-1000 -RAMDAC att20c490 -SEE Ark Logic ARK1000VL (generic) - -NAME Hercules Stingray 64/V with ZoomDAC -SEE Ark Logic ARK2000PV (generic) - -NAME Hercules Stingray 64/V with ICS5342 -CHIPSET ARK2000MT -RAMDAC ics5342 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Diamond Stealth64 Graphics 2001 series -CHIPSET ARK2000PV -RAMDAC ics5342 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -# Oak - -NAME Oak ISA Card (generic) -CHIPSET Oak OTI-067/77 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Oak 87 VLB (generic) -CHIPSET Oak OTI-087 -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE Option "fifo_aggressive" # Comment this if you experience streaks. -LINE Option "no_wait" # Comment this if you find problems. -LINE #Option "enable_bitblt" # You may enable this and see if it works (see README.Oak file) - -NAME Oak 87 ISA (generic) -CHIPSET Oak OTI-087 -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE Option "noaccel" # ISA cards seem to have Color Expansion support broken -LINE #Option "enable_bitblt" # This should work on ISA, but lets not make it default just in case. - -NAME Paradise Accelerator Value -SEE Oak 87 ISA (generic) - -# P9000 - -NAME Diamond Viper VLB 2Mb -CHIPSET Weitek 9000 -SERVER P9000 -DRIVER vga -UNSUPPORTED -LINE #Clocks must match the mode clocks (XFree86 3.1 P9000 server) -LINE #Versions later than 3.1 do not require a clocks line -LINE Chipset "vipervlb" # Required for some cards which autodetect as PCI -LINE Videoram 2048 # Required -LINE Membase 0x80000000 # Optional (0x80000000 is default) -NOCLOCKPROBE - -NAME Diamond Viper PCI 2Mb -CHIPSET Weitek 9000 -SERVER P9000 -DRIVER vga -UNSUPPORTED -LINE #Clocks must match the mode clocks (XFree86 3.1 P9000 server) -LINE #Versions later than 3.1 do not require a clocks line -LINE Videoram 2048 # Required -LINE #Membase 0x80000000 # Use scanpci to get the correct Membase -NOCLOCKPROBE - -NAME Orchid P9000 VLB -CHIPSET Weitek 9000 -SERVER P9000 -DRIVER vga -UNSUPPORTED -LINE Chipset "orchid_p9000" -LINE Membase 0xE0000000 -NOCLOCKPROBE - -# P9100 - -NAME Weitek P9100 (generic) -CHIPSET Weitek P9100 -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME Diamond Viper Pro Video -SEE Weitek P9100 (generic) - -# Trident - -NAME Trident 8900/9000 (generic) -CHIPSET TVGA8900/9000 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Trident 8900D (generic) -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Trident TVGA9200CXr (generic) -CHIPSET TVGA9200CXr -SERVER SVGA -DRIVER vga -UNSUPPORTED - -NAME Trident TGUI9400CXi (generic) -CHIPSET TGUI9400CXi -SERVER SVGA -DRIVER trident - -NAME Trident TGUI9420DGi (generic) -CHIPSET TGUI9420DGi -SERVER SVGA -DRIVER trident - -NAME Trident TGUI9430DGi (generic) -CHIPSET TGUI9430DGi -SERVER SVGA -DRIVER trident - -NAME Trident TGUI9420 (generic) -CHIPSET TGUI9420 -DRIVER trident -NOCLOCKPROBE - -NAME Trident TGUI9440 (generic) -CHIPSET TGUI9440 -DRIVER trident -NOCLOCKPROBE - -NAME Trident TGUI9660 (generic) -CHIPSET TGUI9660 -DRIVER trident -NOCLOCKPROBE - -NAME Trident TGUI9680 (generic) -CHIPSET TGUI9680 -DRIVER trident -NOCLOCKPROBE - -NAME Trident TGUI9682 (generic) -CHIPSET TGUI9682 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident TGUI9685 (generic) -CHIPSET TGUI9685 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 9320 (generic) -CHIPSET Cyber9320 -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 9382 (generic) -CHIPSET Cyber9382 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 9385 (generic) -CHIPSET Cyber9385 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 9388 (generic) -CHIPSET Cyber9388 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 939a (generic) -CHIPSET Cyber939a -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 9397 (generic) -CHIPSET Cyber9397 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Cyber 9520 (generic) -CHIPSET Cyber9520 -DRIVER trident -NOCLOCKPROBE - -NAME Trident 3DImage975 (generic) -CHIPSET 3dimage975 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident 3DImage975 AGP (generic) -CHIPSET 3dimage975 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident 3DImage985 (generic) -CHIPSET 3dimage985 -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Providia 9682 (generic) -CHIPSET Providia9682 -DRIVER trident -NOCLOCKPROBE - -NAME Trident Providia 9685 (generic) -CHIPSET Providia9685 -DRIVER trident -NOCLOCKPROBE - -NAME Trident TVGA 8800BR -SEE * Generic VGA compatible - -NAME Trident TVGA 8800CS -SEE * Generic VGA compatible - -NAME Trident CyberBlade (generic) -CHIPSET CyberBlade -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -NAME Trident Blade3D (generic) -CHIPSET Blade3D -SERVER SVGA -DRIVER trident -NOCLOCKPROBE - -# SiS - -NAME SiS 530 -CHIPSET SIS530 -SERVER SVGA -DRIVER sis - -NAME SiS 620 -CHIPSET SIS620 -SERVER SVGA -DRIVER sis - -NAME SiS SG86C201 -CHIPSET SIS86C201 -SERVER SVGA -DRIVER sis - -NAME SiS SG86C205 -CHIPSET SIS86C205 -SERVER SVGA -DRIVER sis -LINE # Option "no_accel" # Use this if acceleration is causing problems -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -NOCLOCKPROBE - -NAME SiS SG86C215 -CHIPSET SIS86C215 -SERVER SVGA -DRIVER sis -LINE # This is a cheap version of 86c205. I am not sure if acceleration works -LINE # Option "no_accel" # Use this if acceleration is causing problems -LINE # Option "no_BitBlt" # Use this if acceleration is causing problems -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -NOCLOCKPROBE - -NAME SiS SG86C225 -CHIPSET SIS86C225 -SERVER SVGA -DRIVER sis -LINE # Option "no_accel" # Use this if acceleration is causing problems -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -NOCLOCKPROBE - -NAME SiS 5597 -CHIPSET SiS5597 -SERVER SVGA -DRIVER sis -LINE # Option "no_accel" # Use this if acceleration is causing problems -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -LINE # Option "fast_vram" -LINE # Option "pci_burst_on" -LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!! -LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing -LINE # errors, but gives some accel -NOCLOCKPROBE - -NAME SiS 5598 -CHIPSET SIS5598 -SERVER SVGA -DRIVER sis -LINE # Option "no_accel" # Use this if acceleration is causing problems -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -LINE # Option "fast_vram" -LINE # Option "pci_burst_on" -LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!! -LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing -LINE # errors, but gives some accel -NOCLOCKPROBE - -NAME SiS 6326 -CHIPSET SiS6326 -SERVER SVGA -DRIVER sis -LINE # Option "no_accel" # Use this if acceleration is causing problems -LINE # Option "fifo_moderate" -LINE # Option "fifo_conserv" -LINE # Option "fifo_aggressive" -LINE # Option "fast_vram" -LINE # Option "pci_burst_on" -LINE # Option "xaa_benchmark" # DON'T use with "ext_eng_queue" !!! -LINE # Option "ext_eng_queue" # Turbo-queue. This can cause drawing -LINE # errors, but gives some accel -NOCLOCKPROBE - -NAME MSI MS-4417 -SEE SiS 6326 - -NAME SiS 3D PRO AGP -SEE SiS 6326 - -NAME Miro Crystal DVD -SEE SiS 6326 - -NAME PC-Chips M567 Mainboard -SEE SiS 5597 - -NAME Diamond SpeedStar A50 -SEE SiS 6326 - -# Cyrix - -NAME MediaGX -CHIPSET mediagx -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -# Alliance ProMotion - -NAME Alliance ProMotion 6422 -CHIPSET AP6422 -SERVER SVGA -DRIVER vga -UNSUPPORTED - -# Number 9 I128 - -NAME Number Nine Imagine I-128 -CHIPSET I128 -SERVER I128 -DRIVER i128 -NOCLOCKPROBE - -NAME Number Nine Imagine I-128 Series 2 -CHIPSET I128 -SERVER I128 -DRIVER i128 -NOCLOCKPROBE - -NAME Number Nine Revolution 3D (T2R) -CHIPSET I128 -SERVER I128 -DRIVER i128 -NOCLOCKPROBE - -NAME Number Nine Imagine-128 Revolution IV (T2R4) -CHIPSET I128 -SERVER I128 -DRIVER i128 -NOCLOCKPROBE - -# Matrox - -NAME Matrox Millennium 2MB -CHIPSET mga2064w -SERVER SVGA -DRIVER mga -LINE VideoRam 2048 -NOCLOCKPROBE - -NAME Matrox Millennium 4MB -CHIPSET mga2064w -SERVER SVGA -DRIVER mga -LINE VideoRam 4096 -NOCLOCKPROBE - -NAME Matrox Millennium 8MB -CHIPSET mga2064w -SERVER SVGA -DRIVER mga -LINE VideoRam 8192 -NOCLOCKPROBE - -NAME Matrox Millennium II 4MB -CHIPSET mga2164w -SERVER SVGA -DRIVER mga -LINE VideoRam 4096 -NOCLOCKPROBE - -NAME Matrox Millennium II 8MB -CHIPSET mga2164w -SERVER SVGA -DRIVER mga -LINE VideoRam 8192 -NOCLOCKPROBE - -NAME Matrox Millennium II 16MB -CHIPSET mga2164w -SERVER SVGA -DRIVER mga -LINE VideoRam 16384 -NOCLOCKPROBE - -NAME Matrox Millennium G200 4MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 4096 -NOCLOCKPROBE - -NAME Matrox Millennium G200 8MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 8192 -NOCLOCKPROBE - -NAME Matrox Millennium G200 16MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 16384 -NOCLOCKPROBE - -NAME Matrox Millennium G200 SD 4MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 4096 -LINE # Option "mga_sdram" -NOCLOCKPROBE - -NAME Matrox Millennium G200 SD 8MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 8192 -LINE # Option "mga_sdram" -NOCLOCKPROBE - -NAME Matrox Millennium G200 SD 16MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 16384 -LINE # Option "mga_sdram" -NOCLOCKPROBE - -NAME Matrox Mystique -CHIPSET mga1064sg -SERVER SVGA -DRIVER mga -NOCLOCKPROBE - -NAME Matrox Mystique G200 4MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 4096 -NOCLOCKPROBE - -NAME Matrox Mystique G200 8MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 8192 -NOCLOCKPROBE - -NAME Matrox Millennium G400 -CHIPSET mgag400 -SERVER SVGA -DRIVER mga -NOCLOCKPROBE - -NAME Matrox Mystique G200 16MB -CHIPSET mgag200 -SERVER SVGA -DRIVER mga -LINE VideoRam 16384 -NOCLOCKPROBE - -NAME Matrox Productiva G100 4MB -CHIPSET mgag100 -SERVER SVGA -DRIVER mga -LINE VideoRam 4096 -NOCLOCKPROBE - -NAME Matrox Productiva G100 8MB -CHIPSET mgag100 -SERVER SVGA -DRIVER mga -LINE VideoRam 8192 -NOCLOCKPROBE - -# NVIDIA - -NAME Diamond Edge 3D -CHIPSET nv1 -SERVER SVGA -DRIVER vga -UNSUPPORTED -NOCLOCKPROBE - -NAME RIVA128 -CHIPSET RIVA128 -SERVER SVGA -DRIVER nv -NOCLOCKPROBE - -NAME RIVA TNT -CHIPSET RIVATNT -SERVER SVGA -DRIVER nv -NOCLOCKPROBE - -NAME RIVA TNT2 -CHIPSET RIVATNT2 -SERVER SVGA -DRIVER nv -NOCLOCKPROBE - -NAME NVIDIA GeForce -CHIPSET GeForce -SERVER SVGA -DRIVER nv -NOCLOCKPROBE - -NAME ELSA VICTORY ERAZOR -SEE RIVA128 - -NAME ELSA Winner 1000 R3D -SEE RIVA128 - -NAME ELSA ERAZOR II -SEE RIVA TNT - -NAME Diamond Viper 330 -SEE RIVA128 - -NAME Diamond Viper 550 -SEE RIVA TNT - -NAME Diamond Viper 770 -SEE RIVA TNT2 - -NAME STB Velocity 128 -SEE RIVA128 - -NAME STB nvidia 128 -SEE RIVA128 - -NAME STB Velocity 4400 -SEE RIVA TNT - -NAME ASUS 3Dexplorer -SEE RIVA128 - -NAME Guillemot Maxi Gamer Xentor -SEE RIVA TNT2 - -NAME Guillemot Maxi Gamer Xentor 32 -SEE RIVA TNT2 - -NAME Creative Graphics Blaster TNT -SEE RIVA TNT - -NAME Creative Graphics Blaster TNT2 -SEE RIVA TNT2 - -# 3Dfx -NAME Voodoo Banshee (generic) -SERVER SVGA -CHIPSET 3dfx Banshee -DRIVER tdfx - -NAME Voodoo3 (generic) -SERVER SVGA -CHIPSET 3dfx Voodoo3 -DRIVER tdfx - -NAME Elsa Victory II -SEE Voodoo Banshee (generic) - -NAME Diamond Monster Fusion -SEE Voodoo Banshee (generic) - -NAME AOpen PA2010 -SEE Voodoo Banshee (generic) - -NAME Chaintech Desperado 3F10 -SEE Voodoo Banshee (generic) - -# 3DLabs - -NAME ELSA GLoria-L/MX -CHIPSET GLINT MX -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME ELSA GLoria-L -CHIPSET GLINT 500TX -SERVER 3DLabs -DRIVER glint -NOCLOCKPROBE - -NAME ELSA GLoria-XL -CHIPSET GLINT MX -SERVER 3DLabs -DRIVER glint -NOCLOCKPROBE - -NAME Diamond Fire GL 3000 -CHIPSET GLINT 500TX -SERVER 3DLabs -DRIVER glint -LINE Option "firegl_3000" -NOCLOCKPROBE - -NAME ELSA GLoria-S -CHIPSET PERMEDIA -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -LINE #VideoRam 8192 -NOCLOCKPROBE - -NAME Diamond Fire GL 1000 -CHIPSET PERMEDIA -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -LINE #VideoRam 8192 -NOCLOCKPROBE - -NAME ELSA GLoria Synergy -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME ELSA Winner 2000/Office -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME Diamond Fire GL 1000 PRO -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME Creative Blaster Exxtreme -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME AccelStar Permedia II AGP -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME Leadtek WinFast 2300 -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -NOCLOCKPROBE - -NAME 3DLabs Oxygen GMX -CHIPSET PERMEDIA 2 -SERVER 3DLabs -DRIVER glint -LINE #Option "no_accel" -NOCLOCKPROBE - -NAME Appian Jeronimo 2000 -CHIPSET PERMEDIA 3 -SERVER 3DLabs -DRIVER glint -NOCLOCKPROBE - -# Alliance Semiconductor - -NAME Diamond Stealth Video 2500 -CHIPSET Alliance AT24 -SERVER SVGA -DRIVER apm -NOCLOCKPROBE - -NAME AT3D -CHIPSET Alliance AT3D -SERVER SVGA -DRIVER apm -NOCLOCKPROBE -LINE #Option "no_accel" - -NAME AT25 -SEE AT3D - -NAME Hercules Stingray 128 3D -SEE AT3D - -# NeoMagic - -NAME NeoMagic (laptop/notebook) -CHIPSET MagicGraph 128 series -SERVER SVGA -DRIVER neomagic -LINE # Chipset "NM2160" -LINE # IOBase 0xfea00000 -LINE # MemBase 0xfd000000 -LINE # VideoRam 2048 -LINE # DacSpeed 90 -LINE # Option "linear" -LINE # Option "nolinear" -LINE # Option "sw_cursor" -LINE # Option "hw_cursor" -LINE # Option "no_accel" -LINE # Option "intern_disp" -LINE # Option "extern_disp" -LINE # Option "mmio" -LINE # Option "no_mmio" -LINE # Option "lcd_center" -LINE # Option "no_stretch" - -# Epson SPC8110 - -NAME EPSON SPC8110 (CardPC) -CHIPSET SPC8110 -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE # Chipset "spc8110" -LINE # MemBase 0x03e00000 -LINE # VideoRam 1024 -LINE # Option "nolinear" -LINE # Option "sw_cursor" -LINE # Option "noaccel" -LINE # Option "fifo_moderate" -LINE # Option "fifo_conservative" - -# Silicon Motion, Inc. - -NAME Silicon Motion Lynx family -CHIPSET Lynx -SERVER SVGA -DRIVER siliconmotion -NOCLOCKPROBE - -# Rendition - -NAME Rendition Verite 1000 -CHIPSET Verite 1000 -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE # Option "sw_cursor" - -NAME Rendition Verite 2x00 -CHIPSET Verite 2x00 -SERVER SVGA -DRIVER vga -UNSUPPORTED -LINE # Option "sw_cursor" - -NAME Creative Labs 3D Blaster PCI (Verite 1000) -SEE Rendition Verite 1000 - -NAME Canopus Total-3D -SEE Rendition Verite 1000 - -NAME Sierra Screaming 3D -SEE Rendition Verite 1000 - -NAME Miro CRYSTAL VRX -SEE Rendition Verite 1000 - -NAME Diamond Stealth II S220 -CHIPSET Verite 2100 -SEE Rendition Verite 2x00 - -NAME Hercules Thriller3D -CHIPSET Verite 2200 -SEE Rendition Verite 2x00 - -# Digital - -NAME Digital 8-plane TGA (UDB/Multia) -CHIPSET TGA -SERVER TGA -DRIVER tga -RAMDAC Bt485 - -NAME Digital 8-plane TGA (ZLXp-E1) -CHIPSET TGA -SERVER TGA -DRIVER tga -RAMDAC Bt485 - -NAME Digital 24-plane TGA (ZLXp-E2) -CHIPSET TGA -SERVER TGA -DRIVER tga -RAMDAC Bt463 - -NAME Digital 24-plane+3D TGA (ZLXp-E3) -CHIPSET TGA -SERVER TGA -DRIVER tga -RAMDAC Bt463 - -# i810 - -NAME Intel 810 -SERVER SVGA -DRIVER i810 - -# i740 - -NAME Intel 740 (generic) -SERVER SVGA -DRIVER i740 - -# Misc - -END diff --git a/hw/xfree86/utils/xorgconfig/Cards98 b/hw/xfree86/utils/xorgconfig/Cards98 deleted file mode 100644 index ef14a0345..000000000 --- a/hw/xfree86/utils/xorgconfig/Cards98 +++ /dev/null @@ -1,647 +0,0 @@ -# $XFree86: xc/programs/Xserver/hw/xfree98/xf86config/Cards98,v 1.7 1998/06/04 16:43:45 hohndel Exp $ -# -# -# -# $XConsortium: Cards /main/27 1996/10/28 05:43:53 kaleb $ -# This is the database of card definitions used by xf86config. -# Each definition should have a NAME entry, CHIPSET (descriptive) and -# SERVER (one of EGC, GANBWAP, PEGC, NKVNEC, WABS, WABEP, WSNA, TGUI, -# MGA, SVGA, NECS3, PWSKB, PWLB, GA968). -# A reference to another definition is made with SEE (already defined -# entries are not overridden). -# Optional entries are RAMDAC (identifier), CLOCKCHIP (identifier), -# DACSPEED, NOCLOCKPROBE (advises never to probe clocks), UNSUPPORTED -# (indicates card that is not yet properly supported by a dedicated -# server). A LINE entry adds a line of text to be included in the -# Device section (can include options or comments). -# There's no CLOCKS option (although a Clocks line can be included -# with LINE), as it is very undesirable to have a Clocks line that -# is incorrect. The idea is that the Clocks are probed for to be -# sure (a commented suggested Clocks line can be included). -# -# The majority of entries are just a binding of a model name to a -# chipset/server and untested. -# - -# EGC - -NAME EGC16 -CHIPSET EGC -SERVER EGC -LINE Chipset "vga" - -# PEGC - -NAME PEGC -CHIPSET PEGC -SERVER PEGC -LINE VideoRam 512 -LINE Clocks 31.5 -LINE # Virtual resolution for 640x400 -LINE # Clocks 28.322 - -# GANBWAP - -NAME GA-98NBI -CHIPSET CL-GD5434 -SERVER GANBWAP -LINE ClockChip "cirrus" -LINE Option "ga98nb1" -LINE Option "no_mmio" -LINE # Option "sw_cursor" - -NAME GA-98NBII -CHIPSET CL-GD5434 -SERVER GANBWAP -LINE ClockChip "cirrus" -LINE Option "ga98nb2" -LINE Option "no_mmio" -LINE # Option "sw_cursor" - -NAME GA-98NBIV -CHIPSET CL-GD5434 -SERVER GANBWAP -LINE ClockChip "cirrus" -LINE Option "ga98nb4" -LINE Option "no_mmio" -LINE # Option "sw_cursor" - -NAME WAP-2000/4000 -CHIPSET CL-GD5434 -SERVER GANBWAP -LINE Option "wap" -LINE Option "no_mmio" -LINE # Option "epsonmemwin" - -# NKVNEC - -NAME PCNKV/PCNKV2/NEC_CIRRUS -CHIPSET CL-GD5428/5429/5430 -SERVER NKVNEC -LINE # Option "fast_dram" -LINE VideoRam 1024 - -NAME PC9821Bf/U8W -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Bp/U8W/U7W -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Bs/U7W -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Be/U7W -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821BA3/U2/W -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821BX3/U2/W -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821BX4/U2 -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Cb -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Ce -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Cf -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Ce2 -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Cs -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Cs2 -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Cx -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Cx2 -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Es -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Nd -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Ne2 -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Nf -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Np -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Ns -LINE Option "nec_cirrus" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V7/C -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V10/C,S -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V12/S -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V13/S -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V16/S -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V16/S5V,P -LINE Chipset "clgd5446" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821V20/S7 -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xb10 -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xc13/S5 -LINE Chipset "clgd5446" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xc16/M,S -LINE Chipset "clgd5446" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xc200/M,S -LINE Chipset "clgd5446" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xa7e -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xe -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC9821Xe10 -LINE Chipset "clgd5430" -LINE Option "nec_cirrus" -LINE Option "no_mmio" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC486MR -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC486MS -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC486MU -LINE Chipset "clgd5429" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC486MV -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC586MV -SEE PCNKV/PCNKV2/NEC_CIRRUS - -NAME PC586RV -LINE Chipset "clgd5429" -SEE PCNKV/PCNKV2/NEC_CIRRUS - -# WABS - -NAME WAB-S -CHIPSET CL-GD5426/5428 -SERVER WABS -LINE VideoRam 1024 -LINE # VideoRam 2048 - -NAME WAB-1000/2000 -CHIPSET CL-GD5428 -SERVER WABS -LINE VideoRam 1024 -LINE # VideoRam 2048 - -NAME WSR-E/G -SEE WAB-1000/2000 - -# WABEP - -NAME WAB-EP -CHIPSET CL-GD5428 -SERVER WABEP -LINE Option "med_dram" - -# WSNA - -NAME WSN-A2F -CHIPSET CL-GD5434 -SERVER WSNA -LINE Option "no_mmio" -LINE Option "med_dram" - -# TGUI - -NAME NEC Trident -CHIPSET TGUI9680/9682 -SERVER TGUI -LINE Option "xaa_no_color_exp" -LINE # Option "noaccel" -LINE # Option "Linear" -LINE # Option "med_dram" -LINE # Option "hw_cursor" - -NAME PC9821Ra20/N -SEE NEC Trident - -NAME PC9821RaII23/N,W -SEE NEC Trident - -NAME PC9821Ra266/N,W -SEE NEC Trident - -NAME PC9821Rs20/B20 -SEE NEC Trident - -NAME PC9821RsII26/B40 -SEE NEC Trident - -NAME PC9821V13/M7 -SEE NEC Trident - -NAME PC9821V16/M7 -SEE NEC Trident - -NAME PC9821V20/M7 -SEE NEC Trident - -NAME PC9821Xa7/C,K -SEE NEC Trident - -NAME PC9821Xa9/C,K -SEE NEC Trident - -NAME PC9821Xa10/C,K -SEE NEC Trident - -NAME PC9821Xa12/C,K -SEE NEC Trident - -NAME PC9821Xa13/C,K,W -SEE NEC Trident - -NAME PC9821Xa16/R,W -SEE NEC Trident - -NAME PC9821Xa20/W -SEE NEC Trident - -NAME PC9821Xc13/M,S -SEE NEC Trident - -NAME PC9821Xv13/R -SEE NEC Trident - -NAME GA-DRV/98 -CHIPSET TGUI9680 -SERVER TGUI -LINE Option "noaccel" -LINE # Option "med_dram" -LINE # Option "hw_cursor" - -# MGA - -NAME MGA Millennium -CHIPSET MGA2064W -SERVER MGA - -NAME PC9821Xt13 -SEE MGA Millennium - -NAME PC9821Xt16 -SEE MGA Millennium - -NAME PC9821Xv13/W -SEE MGA Millennium - -NAME PC9821Xv20/W -SEE MGA Millennium - -NAME PC9821St15 -SEE MGA Millennium - -NAME PC9821St20 -SEE MGA Millennium - -NAME PC9821RvII26/N20 -SEE MGA Millennium - -NAME NEC FC-WAB-X2 -SEE MGA Millennium - -NAME MGA Mystique -CHIPSET MGA1064SG -SERVER MGA - -NAME PC9821V166/S -LINE VideoRam 2048 -SEE MGA Mystique - -NAME PC9821V200/S -LINE VideoRam 2048 -SEE MGA Mystique - -NAME PC9821V200/M -LINE VideoRam 4096 -SEE MGA Mystique - -NAME PC9821V233/M7 -LINE VideoRam 2048 -SEE MGA Mystique - -NAME PC9821V233/M7V -LINE VideoRam 4096 -SEE MGA Mystique - -# SVGA - -NAME NEC Cirrus 755x -CHIPSET CL-GD7555 -LINE Chipset "clgd7555" -LINE # VideoRam 2048 -LINE # Option "no_bitblt" -LINE # Option "fast_dram" -LINE Option "linear" -LINE Option "noaccel" -SERVER SVGA - -NAME PC9821Nr12 -SEE NEC Cirrus 755x - -NAME PC9821Nr13 -SEE NEC Cirrus 755x - -NAME PC9821La13 -SEE NEC Cirrus 755x - -NAME PC9821Ls12 -SEE NEC Cirrus 755x - -NAME PC9821Ls13 -SEE NEC Cirrus 755x - -NAME PC9821Ls150 -SEE NEC Cirrus 755x - -# NECS3 - -NAME NEC WAB-A/B -CHIPSET S3 928 -SERVER NECS3 -LINE Chipset "s3_generic" -LINE Dacspeed 110 -LINE Ramdac "sc15025" -LINE Option "dac_8_bit" -LINE # Option "necwab" -LINE # Option "nomemaccess" -LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0 -LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0 - -NAME NEC FC-WAB-A/B -CHIPSET S3 928 -SERVER NECS3 -LINE Chipset "s3_generic" -LINE Dacspeed 110 -LINE Ramdac "bt485" -LINE Option "necwab" -LINE Option "nomemaccess" -LINE Option "noinit" -LINE Option "nolinear" -LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0 -LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0 - -NAME PC9821Af/U9W E09? -SEE NEC WAB-A/B - -NAME PC9821An/U8W -SEE NEC WAB-A/B - -NAME PC9821Ap2/U8W/C9W -SEE NEC WAB-A/B - -NAME PC9821As2/U7W/U8W -SEE NEC WAB-A/B - -NAME NEC 864 -CHIPSET S3 864 -SERVER NECS3 -LINE Chipset "s3_generic" -LINE Option "necwab" -LINE Ramdac "s3_sdac" -LINE ClockChip "s3_sdac" - -NAME PC9821Ap3 -SEE NEC 864 - -NAME PC9821As3 -SEE NEC 864 - -NAME PC9821Xp -SEE NEC 864 - -NAME PC9821Xs -SEE NEC 864 - -# PWSKB - -NAME PowerWindow 928/801 -CHIPSET S3 928 -SERVER PWSKB -LINE Chipset "s3_generic" -LINE # Chipset "mmio_928" -LINE Ramdac "sc15025" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE # Option "epsonmemwin" -LINE # Option "nomemaccess" -LINE ClockChip "icd2061a" - -NAME PowerWindow 928II -CHIPSET S3 928 -SERVER PWSKB -LINE Chipset "s3_generic" -LINE # Chipset "mmio_928" -LINE Ramdac "att20c505" -LINE # Ramdac "bt485" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE # Option "pw_mux" -LINE Option "bt485_curs" -LINE # Option "epsonmemwin" -LINE # Option "nomemaccess" -LINE ClockChip "icd2061a" - -NAME PowerWindow 805i -CHIPSET S3 805 -SERVER PWSKB -LINE Chipset "s3_generic" -LINE Ramdac "s3gendac" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE # Option "pw805i" -LINE # Option "epsonmemwin" -LINE # Option "nomemaccess" -LINE ClockChip "s3_sdac" - -NAME PowerWindow 928G -CHIPSET S3 928 -SERVER PWSKB -LINE Chipset "s3_generic" -LINE # Chipset "mmio_928" -LINE Ramdac "sc15025" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE # Option "nomemaccess" -LINE # Option "nolinear" -LINE ClockChip "icd2061a" - -NAME PCSKB/PCSKB2 -CHIPSET S3 911/924 -SERVER PWSKB -LINE Chipset "s3_generic" -LINE Ramdac "sc15025" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE # Option "nomemaccess" -LINE Option "pcskb" -LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0 -LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0 - -NAME PCSKB3/PCSKB4/PCPKB4 -CHIPSET S3 928 -SERVER PWSKB -LINE Chipset "s3_generic" -LINE Ramdac "sc15025" -LINE # Ramdac "att20c498" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE Option "nomemaccess" -LINE Option "pcskb4" -LINE Clocks 25.0 28.0 40.0 0.0 50.0 77.0 36.0 45.0 -LINE Clocks 130.0 120.0 80.0 31.0 110.0 65.0 75.0 94.0 - -# PWLB - -NAME PowerWindow 928GLB -CHIPSET S3 928 -SERVER PWLB -LINE Chipset "s3_generic" -LINE # Chipset "mmio_928" -LINE Ramdac "sc15025" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE # Option "pw_localbus" -LINE # Option "nomemaccess" -LINE # Option "nolinear" -LINE ClockChip "icd2061a" - -NAME PowerWindow 928IILB -CHIPSET S3 928 -SERVER PWLB -LINE Chipset "s3_generic" -LINE # Chipset "mmio_928" -LINE Ramdac "att20c505" -LINE # Ramdac "bt485" -LINE Dacspeed 110 -LINE Option "dac_8_bit" -LINE Option "bt485_curs" -LINE Option "pw_localbus" -LINE # Option "pw_mux" -LINE # Option "nomemaccess" -LINE # Option "nolinear" -LINE ClockChip "icd2061a" - -NAME PowerWindow 964LB -CHIPSET S3 964 -SERVER PWLB -LINE Chipset "s3_generic" -LINE Option "pw_localbus" -LINE Option "number_nine" -LINE Ramdac "ti3025" -LINE ClockChip "ti3025" -LINE VideoRam 4096 - -# GA968 - -NAME GA-968V4/PCI -CHIPSET S3 968 -SERVER GA968 -LINE Chipset "s3_generic" -LINE # Chipset "mmio_928" -LINE VideoRam 4096 diff --git a/hw/xfree86/utils/xorgconfig/Makefile.am b/hw/xfree86/utils/xorgconfig/Makefile.am deleted file mode 100644 index dabfc3214..000000000 --- a/hw/xfree86/utils/xorgconfig/Makefile.am +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright 2005 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons -# to whom the Software is furnished to do so, provided that the above -# copyright notice(s) and this permission notice appear in all copies of -# the Software and that both the above copyright notice(s) and this -# permission notice appear in supporting documentation. -# -# 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 -# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. -# -# Except as contained in this notice, the name of a copyright holder -# shall not be used in advertising or otherwise to promote the sale, use -# or other dealings in this Software without prior written authorization -# of the copyright holder. -# - -bin_PROGRAMS = xorgconfig - -X11dir = $(libdir)/X11 -dist_X11_DATA = Cards - -xorgconfig_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ \ - -DCARD_DATABASE_FILE='"$(X11dir)/Cards"' \ - -DPROJECTROOT='"$(PROJECTROOT)"' \ - -DFILEMANSUFFIX='"$(FILE_MAN_SUFFIX)"' \ - -DXVERSIONSTRING='"$(PACKAGE_STRING)"' - -xorgconfig_LDADD = @XORGCONFIG_DEP_LIBS@ - -xorgconfig_SOURCES = \ - cards.c \ - cards.h \ - xorgconfig.c - -# Man page -include $(top_srcdir)/cpprules.in - -appmandir = $(APP_MAN_DIR) - -appman_PRE = xorgconfig.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -EXTRAMANDEFS = \ - -D__XCONFIGFILE__=$(__XCONFIGFILE__) \ - -D__XSERVERNAME__=$(XSERVERNAME) - -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(appman_PRE) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -rm -f $@ - $(LN_S) $< $@ - -EXTRA_DIST = \ - Cards98 \ - xorgconfig.man.pre diff --git a/hw/xfree86/utils/xorgconfig/cards.c b/hw/xfree86/utils/xorgconfig/cards.c deleted file mode 100644 index 8116f0a03..000000000 --- a/hw/xfree86/utils/xorgconfig/cards.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Functions to manipulate card database. - */ - -#include -#include -#include - -#include "cards.h" - -/* Some vars to make path names in texts more flexible. */ -#ifndef PROJECTROOT -# define PROJECTROOT "/usr" -#endif -#define TREEROOT PROJECTROOT -#define TREEROOTLX TREEROOT "/lib/X11" -#define TREEROOTCFG TREEROOT "/etc/X11" -#ifdef XDOCDIR -# define TREEROOTDOC XDOCDIR -#else -# define TREEROOTDOC TREEROOTLX "/doc" -#endif - -/* - * Database format: - * - * NAME - * CHIPSET - * SERVER - * DRIVER - * - * Optional keywords: - * RAMDAC - * CLOCKCHIP - * DACSPEED - * NOCLOCKPROBE - * UNSUPPORTED - * - * SEE refers to another card definition; parameters that - * are already defined are not overridden. - * - * is one of Mono, VGA16, SVGA, S3, Mach32, Mach8, 8514, - * P9000, AGX, W32. - * - * A useful additional keywords may be CLOCKS. - */ - - - -/* Database vars. */ - -int lastcard; - -Card card[MAX_CARDS]; - - -static int -getnextline(FILE *f, char *l) -{ - if (fgets(l, 128, f) == NULL) - return -1; - return 0; -} - -static void -appendstring(char **destp, char *src) -{ - char *newstr; - newstr = malloc(strlen(*destp) + strlen(src) + 1); - strcpy(newstr, *destp); - strcat(newstr, src); - if (strlen(*destp) > 0) - free(*destp); - *destp = newstr; -} - -int -lookupcard(char *name) { - int i; - for (i = 0; i <= lastcard; i++) - if (strcmp(name, card[i].name) == 0) - return i; - return -1; -} - -static char *s3_comment = -"# Use Option \"nolinear\" if the server doesn't start up correctly\n" -"# (this avoids the linear framebuffer probe). If that fails try\n" -"# option \"nomemaccess\".\n" -"#\n" -"# Refer to " TREEROOTDOC "/README.S3, and the XF86_S3 man page.\n"; - -static char *cirrus_comment = -"# Use Option \"no_bitblt\" if you have graphics problems. If that fails\n" -"# try Option \"noaccel\".\n" -"# Refer to " TREEROOTDOC "/README.cirrus.\n" -"# To allow linear addressing, uncomment the Option line and the\n" -"# address that the card maps the framebuffer to.\n"; - -int parse_database() { - FILE *f; - char buf[128]; - int i, lineno; - char filename[128]; - - strcpy(filename, CARD_DATABASE_FILE); - f = fopen(filename, "r"); - if (f == NULL) - return -1; - - lastcard = -1; - lineno = 0; - - for (;;) { - if (getnextline(f, buf)) - break; - lineno++; - if (buf[0] == '#') - /* Comment. */ - continue; - if (strncmp(buf, "END", 3) == 0) - /* End of database. */ - break; - if (strncmp(buf, "LINE", 4) == 0 && lastcard>=0) { - /* Line of Device comment. */ - /* Append to existing lines. */ - appendstring(&card[lastcard].lines, buf + 5); - continue; - } - /* - * The following keywords require the trailing newline - * to be deleted. - */ - i = strlen(buf); - buf[--i] = '\0'; - - /* remove trailing spaces or tabs */ - for(--i; i>=0 && (buf[i] == ' ' || buf[i] == '\011'); i--) ; - if (i>=0) - buf[i+1] = '\0'; - else - continue; /* skip empty lines */ - - if (strncmp(buf, "NAME", 4) == 0) { - /* New entry. */ - lastcard++; - card[lastcard].name = malloc(strlen(buf + 5) + 1); - strcpy(card[lastcard].name, buf + 5); - card[lastcard].chipset = NULL; - card[lastcard].server = NULL; - card[lastcard].driver = NULL; - card[lastcard].ramdac = NULL; - card[lastcard].clockchip = NULL; - card[lastcard].dacspeed = NULL; - card[lastcard].flags = 0; - card[lastcard].lines = ""; - continue; - } - if (lastcard < 0) /* no NAME line found yet */ - continue; - if (strncmp(buf, "SEE", 3) == 0) { - /* Reference to another entry. */ - int i; - i = lookupcard(buf + 4); - if (i == -1) { - printf("Error in database, invalid reference: %s.\n", - buf + 4); - free(card[lastcard].name); - lastcard--; - continue; - } - if (card[lastcard].chipset == NULL) - card[lastcard].chipset = card[i].chipset; - if (card[lastcard].server == NULL) - card[lastcard].server = card[i].server; - if (card[lastcard].driver == NULL) - card[lastcard].driver = card[i].driver; - if (card[lastcard].ramdac == NULL) - card[lastcard].ramdac = card[i].ramdac; - if (card[lastcard].clockchip == NULL) - card[lastcard].clockchip = card[i].clockchip; - if (card[lastcard].dacspeed == NULL) - card[lastcard].dacspeed = card[i].dacspeed; - card[lastcard].flags |= card[i].flags; - appendstring(&card[lastcard].lines, card[i].lines); - continue; - } - if (strncmp(buf, "CHIPSET", 7) == 0) { - /* Chipset description. */ - card[lastcard].chipset = malloc(strlen(buf + 8) + 1); - strcpy(card[lastcard].chipset, buf + 8); - continue; - } - if (strncmp(buf, "SERVER", 6) == 0) { - /* Server identifier. */ - card[lastcard].server = malloc(strlen(buf + 7) + 1); - strcpy(card[lastcard].server, buf + 7); - continue; - } - if (strncmp(buf, "DRIVER", 6) == 0) { - /* Driver identifier. */ - card[lastcard].driver = malloc(strlen(buf + 7) + 1); - strcpy(card[lastcard].driver, buf + 7); - continue; - } - if (strncmp(buf, "RAMDAC", 6) == 0) { - /* Ramdac indentifier. */ - card[lastcard].ramdac = malloc(strlen(buf + 7) + 1); - strcpy(card[lastcard].ramdac, buf + 7); - continue; - } - if (strncmp(buf, "CLOCKCHIP", 9) == 0) { - /* Clockchip indentifier. */ - card[lastcard].clockchip = malloc(strlen(buf + 10) + 1); - strcpy(card[lastcard].clockchip, buf + 10); - card[lastcard].flags |= NOCLOCKPROBE; - continue; - } - if (strncmp(buf, "DACSPEED", 8) == 0) { - /* Clockchip indentifier. */ - card[lastcard].dacspeed = malloc(strlen(buf + 9) + 1); - strcpy(card[lastcard].dacspeed, buf + 9); - continue; - } - if (strncmp(buf, "NOCLOCKPROBE", 12) == 0) { - card[lastcard].flags |= NOCLOCKPROBE; - continue; - } - if (strncmp(buf, "UNSUPPORTED", 12) == 0) { - card[lastcard].flags |= UNSUPPORTED; - continue; - } - /* test for missing required fields */ - if (card[lastcard].driver == NULL) { - fprintf(stderr, "Warning DRIVER specification missing " - "in Card database entry %s (line %d).\n", - card[lastcard].name, lineno); - keypress(); - card[lastcard].driver = "unknown"; - } - if (card[lastcard].chipset == NULL) { - fprintf(stderr, "Warning CHIPSET specification missing " - "in Card database entry %s (line %d).\n", - card[lastcard].name, lineno); - keypress(); - card[lastcard].chipset = "unknown"; - } - } - - fclose(f); - - /* - * Add general comments. - */ - for (i = 0; i <= lastcard; i++) { - if (card[i].server && strcmp(card[i].server, "S3") == 0) - appendstring(&card[i].lines, s3_comment); - if (card[i].chipset && - strncmp(card[i].chipset, "CL-GD", 5) == 0) - appendstring(&card[i].lines, cirrus_comment); - } - - sort_database(); - - return 0; -} - -static int -compare_card(const void *e1, const void *e2) -{ - return strcmp(((Card *)e1)->name, ((Card *)e2)->name); -} - -void -sort_database() { - /* Each element is a bunch of words, but nothing too bad. */ - qsort(card, lastcard + 1, sizeof(Card), compare_card); -} diff --git a/hw/xfree86/utils/xorgconfig/cards.h b/hw/xfree86/utils/xorgconfig/cards.h deleted file mode 100644 index 7e1438db8..000000000 --- a/hw/xfree86/utils/xorgconfig/cards.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CARD_DATABASE_FILE -#define CARD_DATABASE_FILE "Cards" -#endif - -#define MAX_CARDS 1000 - -typedef struct { - char *name; /* Name of the card. */ - char *chipset; /* Chipset (decriptive). */ - char *server; /* Server identifier. */ - char *driver; /* Driver identifier. */ - char *ramdac; /* Ramdac identifier. */ - char *clockchip; /* Clockchip identifier. */ - char *dacspeed; /* DAC speed rating. */ - int flags; - char *lines; /* Additional Device section lines. */ -} Card; - -/* Flags: */ -#define NOCLOCKPROBE 0x1 /* Never probe clocks of the card. */ -#define UNSUPPORTED 0x2 /* Card is not supported (only VGA). */ - -extern int lastcard; - -extern Card card[MAX_CARDS]; - -extern int lookupcard ( char *name ); -extern int parse_database ( void ); -extern void sort_database ( void ); -extern void keypress ( void ); diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.c b/hw/xfree86/utils/xorgconfig/xorgconfig.c deleted file mode 100644 index 30eb83182..000000000 --- a/hw/xfree86/utils/xorgconfig/xorgconfig.c +++ /dev/null @@ -1,2890 +0,0 @@ -/* - * This is a configuration program that will create a base XF86Config - * file based on menu choices. Its main feature is that clueless users - * may be less inclined to select crazy sync rates way over monitor spec, - * by presenting a menu with standard monitor types. Also some people - * don't read docs unless an executable that they can run tells them to. - * - * It assumes a 24-line or bigger text console. - * - * Revision history: - * 25Sep94 Initial version. - * 27Sep94 Fix hsync range of monitor types to match with best possible mode. - * Remove 'const'. - * Tweak descriptions. - * 28Sep94 Fixes from J"org Wunsch: - * Don't use gets(). - * Add mouse device prompt. - * Fix lines overrun for 24-line console. - * Increase buffer size for probeonly output. - * 29Sep94 Fix bad bug with old XF86Config preserving during probeonly run. - * Add note about vertical refresh in interlaced modes. - * Name gets() replacement getstring(). - * Add warning about binary paths. - * Fixes from David Dawes: - * Don't use 'ln -sf'. - * Omit man path reference in comment. - * Generate only a generic 320x200 SVGA section for accel cards. - * Only allow writing to /usr/X11R6/lib/X11 if root, and use - * -xf86config for the -probeonly phase (root only). - * Fix bug that forces screen type to accel in some cases. - * 30Sep94 Continue after clocks probe fails. - * Note about programmable clocks. - * Rename to 'xf86config'. Not to be confused with XF86Config - * or the -xf86config option. - * 07Oct94 Correct hsync in standard mode timings comments, and include - * the proper +/-h/vsync flags. - * 11Oct94 Skip 'numclocks:' and 'pixel clocks:' lines when probing for - * clocks. - * 18Oct94 Add check for existence of /usr/X11R6. - * Add note about ctrl-alt-backspace. - * 06Nov94 Add comment above standard mode timings in XF86Config. - * 24Dec94 Add low-resolution modes using doublescan. - * 29Dec94 Add note in horizontal sync range selection. - * Ask about ClearDTR/RTS option for Mouse Systems mice. - * Ask about writing to /etc/XF86Config. - * Allow link to be set in /var/X11R6/bin. - * Note about X -probeonly crashing. - * Add keyboard Alt binding option for non-ASCII characters. - * Add card database selection. - * Write temporary XF86Config for clock probing in /tmp instead - * of /usr/X11R6/lib/X11. - * Add RAMDAC and Clockchip menu. - * 27Mar99 Modified for XFree86 4.0 config file format - * 06Sep02 Write comment block about 'DontVTSwitch'. - * - * Possible enhancements: - * - Add more standard mode timings (also applies to README.Config). Missing - * are 1024x768 @ 72 Hz, 1152x900 modes, and 1280x1024 @ ~70 Hz. - * I suspect there is a VESA standard for 1024x768 @ 72 Hz with 77 MHz dot - * clock, and 1024x768 @ 75 Hz with 78.7 MHz dot clock. New types of - * monitors probably work better with VESA 75 Hz timings. - * - Add option for creation of clear, minimal XF86Config. - * - The card database doesn't include most of the entries in previous - * databases. - * - * Send comments to H.Hanemaayer@inter.nl.net. - * - * Things to keep up-to-date: - * - Accelerated server names. - * - Ramdac and Clockchip settings. - * - The card database. - * - */ -/* Oct2000 - * New 'Configuration of XKB' section. - * Author: Ivan Pascal The XFree86 Project. - */ -/* - * Nov2002 - * Some enhancements: - * - Add new PS/2 mouse protocol. - * "IMPS/2","ExplorerPS/2","ThinkingMousePS/2","MouseManPlusPS/2", - * "GlidePointPS/2","NetMousePS/2" and "NetScrollPS/2". - * - Add mouse-speed setting for PS/2 mouse. - * - Fix seg.fault problem on Solaris. - * - Add modestring "1400x1050"(for ATI Mobile-Rage). - * - Add videomemory 8192, 16384, 32768, 65536, 131072 and 262144. - * - Ready to DRI. - * - Load xtt module instead of freetype module. - * - Add font path "/TrueType/" and "/freefont/". - * Chisato Yamauchi(cyamauch@phyas.aichi-edu.ac.jp) - */ - -#ifdef HAVE_CONFIG_H -# include "xorg-server.h" -# include "xkb-config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#define MAX_XKBOPTIONS 5 - -#include "cards.h" - - -/* - * Define the following to 310 to remove references to XFree86 features that - * have been added since XFree86 3.1 (e.g. DoubleScan modes). - * or to 311 to remove certain new modelines - */ -#define XFREE86_VERSION 400 - -/* - * Define this to have /etc/X11/XF86Config prompted for as the default - * location to write the XF86Config file to. - */ -#define PREFER_XF86CONFIG_IN_ETC - -/* - * Define this to force the user to go through XKB configuration section. - * - */ -#define FORCE_XKB_DIALOG - -/* - * Configuration variables. - */ - -#define MAX_CLOCKS_LINES 16 - -#define DUMBCONFIG2 "dumbconfig.2" -#define DUMBCONFIG3 "dumbconfig.3" - -/* some more vars to make path names in texts more flexible. OS/2 users - * may be more irritated than Unix users - */ -#ifndef PROJECTROOT -#define PROJECTROOT "/usr" -#endif -#define TREEROOT PROJECTROOT -#define TREEROOTLX TREEROOT "/lib/X11" -#define TREEROOTCFG TREEROOT "/etc/X11" -#define TREEROOTSHARE TREEROOT "/share/X11" -#ifdef XDOCDIR -# define TREEROOTDOC XDOCDIR -#else -# define TREEROOTDOC TREEROOTLX "/doc" -#endif -#ifdef XFONTDIR -# define TREEROOTFONT XFONTDIR -#else -# define TREEROOTFONT TREEROOTLX "/fonts" -#endif -#define MODULEPATH TREEROOT "/lib/modules" - -#define XSERVERNAME_FOR_PROBE "X" - -#ifndef XCONFIGFILE -#define XCONFIGFILE "xorg.conf" -#endif -#define CONFIGNAME XCONFIGFILE - -/* - * This is the filename of the temporary XF86Config file that is written - * when the program is told to probe clocks (which can only happen for - * root). - */ -#define TEMPORARY_XF86CONFIG_DIR_PREFIX "/tmp/."XCONFIGFILE -#define TEMPORARY_XF86CONFIG_FILENAME XCONFIGFILE".tmp" - -#ifndef XF86_VERSION_MAJOR -#ifdef XVERSION -#if XVERSION > 40000000 -#define XF86_VERSION_MAJOR (XVERSION / 10000000) -#else -#define XF86_VERSION_MAJOR (XVERSION / 1000) -#endif -#else -#define XF86_VERSION_MAJOR 4 -#endif -#endif - - -int config_mousetype; /* Mouse. */ -int config_emulate3buttons; -int config_chordmiddle; -int config_cleardtrrts; -char *config_pointerdevice; -int config_altmeta; /* Keyboard. */ -int config_monitortype; /* Monitor. */ -char *config_hsyncrange; -char *config_vsyncrange; -char *config_monitoridentifier; -int config_videomemory; /* Video card. */ -int config_screentype; /* mono, vga16, svga, accel */ -char *config_deviceidentifier; -int config_numberofclockslines; -char *config_clocksline[MAX_CLOCKS_LINES]; -char *config_modesline8bpp; -char *config_modesline16bpp; -char *config_modesline24bpp; -int config_virtual; /* 1 (yes) or 0 (no) */ -int config_virtualx8bpp, config_virtualy8bpp; -int config_virtualx16bpp, config_virtualy16bpp; -int config_virtualx24bpp, config_virtualy24bpp; -char *config_ramdac; -char *config_dacspeed; -char *config_clockchip; -#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) -char *config_keyboard_dev = "/dev/wskbd0"; -#endif -int config_xkbdisable = 0; -char *config_xkbrules; -char *config_xkbmodel = "pc105"; -char *config_xkblayout = "us"; -char *config_xkbvariant = (char *) 0; -char *config_xkboptions = (char *) 0; -char *config_depth; - -char *temp_dir = ""; - -/* - * These are from the selected card definition. Parameters from the - * definition are offered during the questioning about the video card. - */ - -int card_selected; /* Card selected from database. */ - - -static int write_XF86Config(char *filename); - - -/* - * This is the initial intro text that appears when the program is started. - */ - -static char *intro_text = -"\n" -"This program will create a basic " CONFIGNAME " file, based on menu selections\n" -"you make. It will ask for a pathname when it is ready to write the file.\n" -"\n" -"The " CONFIGNAME " file usually resides in /etc/X11 or " TREEROOTCFG ". If\n" -"no " CONFIGNAME " file is present there, " __XSERVERNAME__" will probe the system to\n" -"autoconfigure itself. You can run " __XSERVERNAME__ " -configure to generate a " CONFIGNAME "\n" -"file based on the results of autoconfiguration, or let this program\n" -"produce a base " CONFIGNAME " file for your configuration, and fine-tune it.\n" -"A sample " CONFIGNAME " file is also supplied with "__XSERVERNAME__"; it is configured \n" -"for a standard VGA card and monitor with 640x480 resolution.\n" -"\n" -"There are also many chipset and card-specific options and settings available,\n" -"but this program does not know about these. On some configurations some of\n" -"these settings must be specified. Refer to the X driver man pages and the\n" -"chipset-specific READMEs in " TREEROOTDOC " for further details.\n" -#if 0 -" Refer to " TREEROOTDOC "/README.Config\n" -"for a detailed overview of the configuration process.\n" -"\n" -"(what should we change this section to?)\n" -"For accelerated servers (including accelerated drivers in the SVGA server),\n" -"there are many chipset and card-specific options and settings. This program\n" -"does not know about these. On some configurations some of these settings must\n" -"be specified. Refer to the server man pages and chipset-specific READMEs.\n" -#endif -"\n" -"Before continuing with this program, make sure you know what video card\n" -"you have, and preferably also the chipset it uses and the amount of video\n" -"memory on your video card, as well as the specifications of your monitor.\n" -"\n" -; - -static char *finalcomment_text = -"File has been written. Take a look at it before starting an X server. Note that\n" -"the " CONFIGNAME " file must be in one of the directories searched by the server\n" -"(e.g. /etc/X11) in order to be used. Within the server press\n" -"ctrl, alt and '+' simultaneously to cycle video resolutions. Pressing ctrl,\n" -"alt and backspace simultaneously immediately exits the server (use if\n" -"the monitor doesn't sync for a particular mode).\n" -"\n" -"For further configuration, refer to the " XCONFIGFILE "(" FILEMANSUFFIX ") manual page.\n" -"\n"; - -static void * -Malloc(int i) { - void *p; - - p = malloc(i); - if (p == NULL) { - printf("Fatal malloc error\n"); - exit(-1); - } - return p; -} - -static char * -Strdup(const char *s){ - char *d; - - d = Malloc(strlen(s) + 1); - strcpy(d, s); - return d; -} - -static void -createtmpdir(void) { - /* length of prefix + 20 (digits in 2**64) + 1 (slash) + 1 */ - temp_dir = Malloc(strlen(TEMPORARY_XF86CONFIG_DIR_PREFIX) + 22); - sprintf(temp_dir, "%s%ld", TEMPORARY_XF86CONFIG_DIR_PREFIX, - (long)getpid()); - if (mkdir(temp_dir, 0700) != 0) { - printf("Cannot create directory %s\n", temp_dir); - exit(-1); - } - /* append a slash */ - strcat(temp_dir, "/"); -} - - -void -keypress(void) { - printf("Press enter to continue, or ctrl-c to abort."); - getchar(); - printf("\n"); -} - -static void -emptylines(void) { - int i; - for (i = 0; i < 50; i++) - printf("\n"); -} - -static int -answerisyes(char *s) -{ - if (s[0] == '\'') /* For fools that type the ' literally. */ - return tolower(s[1]) == 'y'; - return tolower(s[0]) == 'y'; -} - -/* - * This is a replacement for gets(). Limit is 80 chars. - * The 386BSD descendants scream about using gets(), for good reason. - */ - -static void -getstring(char *s) -{ - char *cp; - if (fgets(s, 80, stdin) == NULL) - exit(1); - cp = strchr(s, '\n'); - if (cp) - *cp=0; -} - -/* - * Mouse configuration. - */ - -int M_OSMOUSE, M_WSMOUSE, M_AUTO, - M_SYSMOUSE, M_MOUSESYSTEMS, M_PS2, - M_MICROSOFT, M_BUSMOUSE, M_IMPS2, - M_EXPLORER_PS2, M_GLIDEPOINT_PS2, M_MOUSEMANPLUS_PS2, - M_NETMOUSE_PS2, M_NETSCROLL_PS2, M_THINKINGMOUSE_PS2, - M_ACECAD, M_GLIDEPOINT, M_INTELLIMOUSE, - M_LOGITECH, M_MMHITTAB, M_MMSERIES, - M_MOUSEMAN, M_THINKINGMOUSE, M_VUID; - -struct { - char *name; - int *ident; - char *desc; -} mouse_info[] = { -#if defined(QNX4) -#define DEF_PROTO_STRING "OSMOUSE" - {"OSMOUSE", &M_OSMOUSE, - "OSMOUSE" - }, -#endif -#ifdef WSCONS_SUPPORT -#define WS_MOUSE_STRING "wsmouse" -#define DEF_PROTO_STRING WS_MOUSE_STRING - {WS_MOUSE_STRING, &M_WSMOUSE, - "wsmouse protocol" - }, -#endif -#ifndef DEF_PROTO_STRING -#define DEF_PROTO_STRING "Auto" -#endif - {"Auto", &M_AUTO, - "Auto detect" - }, -#ifdef sun - {"VUID", &M_VUID, - "Solaris VUID protocol (SPARC, USB, or virtual mouse)" - }, -#endif - {"SysMouse", &M_SYSMOUSE, - "SysMouse" - }, -#define M_MOUSESYSTEMS_STRING "MouseSystems" - {M_MOUSESYSTEMS_STRING, &M_MOUSESYSTEMS, - "Mouse Systems (3-button protocol)" - }, - {"PS/2", &M_PS2, - "PS/2 Mouse" - }, -#define M_MICROSOFT_STRING "Microsoft" - {M_MICROSOFT_STRING, &M_MICROSOFT, - "Microsoft compatible (2-button protocol)" - }, - {"Busmouse", &M_BUSMOUSE, - "Bus Mouse" - }, -#ifndef __FreeBSD__ - {"IMPS/2", &M_IMPS2, - "IntelliMouse PS/2" - }, - {"ExplorerPS/2", &M_EXPLORER_PS2, - "Explorer PS/2" - }, - {"GlidePointPS/2", &M_GLIDEPOINT_PS2, - "GlidePoint PS/2" - }, - {"MouseManPlusPS/2", &M_MOUSEMANPLUS_PS2, - "MouseManPlus PS/2" - }, - {"NetMousePS/2", &M_NETMOUSE_PS2, - "NetMouse PS/2" - }, - {"NetScrollPS/2", &M_NETSCROLL_PS2, - "NetScroll PS/2" - }, - {"ThinkingMousePS/2", &M_THINKINGMOUSE_PS2, - "ThinkingMouse PS/2" - }, -#endif - {"AceCad", &M_ACECAD, - "AceCad" - }, - {"GlidePoint", &M_GLIDEPOINT, - "GlidePoint" - }, - {"IntelliMouse", &M_INTELLIMOUSE, - "Microsoft IntelliMouse" - }, - {"Logitech", &M_LOGITECH, - "Logitech Mouse (serial, old type, Logitech protocol)" - }, - {"MMHitTab", &M_MMHITTAB, - "MM HitTablet" - }, - {"MMSeries", &M_MMSERIES, - "MM Series" /* XXXX These descriptions should be improved. */ - }, - {"MouseMan", &M_MOUSEMAN, - "Logitech MouseMan (Microsoft compatible)" - }, - {"ThinkingMouse", &M_THINKINGMOUSE, - "ThinkingMouse" - }, -}; - -#ifdef WSCONS_SUPPORT -# define DEF_MOUSEDEV "/dev/wsmouse"; -#elif defined(__FreeBSD__) || defined(__DragonFly__) -# define DEF_MOUSEDEV "/dev/sysmouse"; -#elif defined(__linux__) -# define DEF_MOUSEDEV "/dev/input/mice"; -#else -# define DEF_MOUSEDEV "/dev/mouse"; -#endif - -static char *mouseintro_text = -"First specify a mouse protocol type. Choose one from the following list:\n" -"\n"; - -static char *mousedev_text = -"Now give the full device name that the mouse is connected to, for example\n" -"/dev/tty00. Just pressing enter will use the default, %s.\n" -"\n"; - -static char *mousecomment_text = -"The recommended protocol is " DEF_PROTO_STRING ". If you have a very old mouse\n" -"or don't want OS support or auto detection, and you have a two-button\n" -"or three-button serial mouse, it is most likely of type " M_MICROSOFT_STRING ".\n" -#ifdef WSCONS_SUPPORT -"\n" -"If your system uses the wscons console driver, with a PS/2 type mouse,\n" -"select " WS_MOUSE_STRING ".\n" -#endif -"\n"; - -static char *twobuttonmousecomment_text = -"You have selected a two-button mouse protocol. It is recommended that you\n" -"enable Emulate3Buttons.\n"; - -static char *threebuttonmousecomment_text = -"You have selected a three-button mouse protocol. It is recommended that you\n" -"do not enable Emulate3Buttons, unless the third button doesn't work.\n"; - -static char *unknownbuttonsmousecomment_text = -"If your mouse has only two buttons, it is recommended that you enable\n" -"Emulate3Buttons.\n"; - -static char *microsoftmousecomment_text = -"You have selected a Microsoft protocol mouse. If your mouse was made by\n" -"Logitech, you might want to enable ChordMiddle which could cause the\n" -"third button to work.\n"; - -static char *mousesystemscomment_text = -"You have selected a Mouse Systems protocol mouse. If your mouse is normally\n" -"in Microsoft-compatible mode, enabling the ClearDTR and ClearRTS options\n" -"may cause it to switch to Mouse Systems mode when the server starts.\n"; - -static char *logitechmousecomment_text = -"You have selected a Logitech protocol mouse. This is only valid for old\n" -"Logitech mice.\n"; - -static char *mousemancomment_text = -"You have selected a Logitech MouseMan type mouse. You might want to enable\n" -"ChordMiddle which could cause the third button to work.\n"; - -static void -mouse_configuration(void) { - -#if !defined(QNX4) - int i, j; - char s[80]; - char *def_mousedev = DEF_MOUSEDEV; - -#define MOUSETYPE_COUNT sizeof(mouse_info)/sizeof(mouse_info[0]) - for (i = 0; i < MOUSETYPE_COUNT; i++) - *(mouse_info[i].ident) = i; - - for (i=0;;) { - emptylines(); - printf("%s", mouseintro_text); - for (j = i; j < i + 14 && j < MOUSETYPE_COUNT; j++) - printf("%2d. %s [%s]\n", j + 1, - mouse_info[j].name, mouse_info[j].desc); - printf("\n"); - printf("%s", mousecomment_text); - printf("Enter a protocol number: "); - getstring(s); - if (strlen(s) == 0) { - i += 14; - if (i >= MOUSETYPE_COUNT) - i = 0; - continue; - } - config_mousetype = atoi(s) - 1; - if (config_mousetype >= 0 && config_mousetype < MOUSETYPE_COUNT) - break; - } - printf("\n"); - - if (config_mousetype == M_LOGITECH) { - /* Logitech. */ - printf("%s", logitechmousecomment_text); - printf("\n"); - printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Are you sure it's really not a Microsoft compatible one? "); - getstring(s); - if (!answerisyes(s)) - config_mousetype = M_MICROSOFT; - printf("\n"); - } - - config_chordmiddle = 0; - if (config_mousetype == M_MICROSOFT || config_mousetype == M_MOUSEMAN) { - /* Microsoft or MouseMan. */ - if (config_mousetype == M_MICROSOFT) - printf("%s", microsoftmousecomment_text); - else - printf("%s", mousemancomment_text); - printf("\n"); - printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Do you want to enable ChordMiddle? "); - getstring(s); - if (answerisyes(s)) - config_chordmiddle = 1; - printf("\n"); - } - - config_cleardtrrts = 0; - if (config_mousetype == M_MOUSESYSTEMS) { - /* Mouse Systems. */ - printf("%s", mousesystemscomment_text); - printf("\n"); - printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Do you want to enable ClearDTR and ClearRTS? "); - getstring(s); - if (answerisyes(s)) - config_cleardtrrts = 1; - printf("\n"); - } - - if (config_mousetype == M_MICROSOFT) { - if (config_chordmiddle) - printf("%s", threebuttonmousecomment_text); - else - printf("%s", twobuttonmousecomment_text); - } - else if (config_mousetype == M_MOUSESYSTEMS || - config_mousetype == M_INTELLIMOUSE) { - printf("%s", threebuttonmousecomment_text); - } - else { - printf("%s", unknownbuttonsmousecomment_text); - } - - printf("\n"); - - printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Do you want to enable Emulate3Buttons? "); - getstring(s); - if (answerisyes(s)) - config_emulate3buttons = 1; - else - config_emulate3buttons = 0; - printf("\n"); - -#if (defined(sun) && (defined(__i386) || defined(__x86))) - /* SPARC & USB mice (VUID or AUTO protocols) default to /dev/mouse, - but PS/2 mice default to /dev/kdmouse */ - if ((config_mousetype != M_AUTO) && (config_mousetype != M_VUID)) { - def_mousedev = "/dev/kdmouse"; - } -#endif - - printf(mousedev_text, def_mousedev); - printf("Mouse device: "); - getstring(s); - if (strlen(s) == 0) { - config_pointerdevice = def_mousedev; - } else { - config_pointerdevice = Malloc(strlen(s) + 1); - strcpy(config_pointerdevice, s); - } - printf("\n"); - -#else - /* set some reasonable defaults for OS/2 */ - config_mousetype = M_OSMOUSE; - config_chordmiddle = 0; - config_cleardtrrts = 0; - config_emulate3buttons = 0; - config_pointerdevice = "QNXMOUSE"; -#endif -} - - -/* - * Keyboard configuration. - */ - -/* - * Configuration of XKB - */ -static char *xkbmodeltext = -"Please select one of the following keyboard types that is the better\n" -"description of your keyboard. If nothing really matches,\n" -"choose \"Generic 104-key PC\"\n\n"; - -static char *xkblayouttext = -"Please select the layout corresponding to your keyboard\n"; - -static char *xkbvarianttext = -"Please enter a variant name for '%s' layout. Or just press enter\n" -"for default variant\n\n"; - -static char *xkboptionstext = -"Please answer the following question with either 'y' or 'n'.\n" -"Do you want to select additional XKB options (group switcher,\n" -"group indicator, etc.)? "; - -#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) -static char *kbdevtext = -"Please enter the device name for your keyboard or just press enter\n" -"for the default of wskbd0\n\n"; -#endif - -static void -keyboard_configuration(void) -{ - int i, j; - char s[80]; - char *rulesfile; - int number, options[MAX_XKBOPTIONS], num_options; - XkbRF_RulesPtr rules; - -#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) - printf(kbdevtext); - getstring(s); - if (strlen(s) != 0) { - config_keyboard_dev = Malloc(strlen(s) + 1); - strcpy(config_keyboard_dev, s); - } -#endif - -#ifndef XKB_RULES_DIR -# define XKB_RULES_DIR XKB_BASE_DIRECTORY "/rules" -#endif - -#ifdef XFREE98_XKB - config_xkbrules = "xfree98"; /* static */ - rulesfile = XKB_RULES_DIR "/xfree98"; -#else - config_xkbrules = __XKBDEFRULES__; /* static */ - rulesfile = XKB_RULES_DIR "/" __XKBDEFRULES__; -#endif - - rules = XkbRF_Load(rulesfile, "", True, False); - emptylines(); - - if (!rules) { - printf("XKB rules file '%s' not found\n", rulesfile); - printf("Keyboard XKB options will be set to default values.\n"); - keypress(); - return; - } - - number = -1; - for (i=0;;) { - emptylines(); - printf(xkbmodeltext); - for (j = i; j < i + 16 && j < rules->models.num_desc; j++) - printf("%3d %-50s\n", j+1, rules->models.desc[j].desc); - printf("\nEnter a number to choose the keyboard.\n\n"); - if (rules->models.num_desc >= 16) - printf("Press enter for the next page\n"); - getstring(s); - if (strlen(s) == 0) { - i += 16; - if (i > rules->models.num_desc) - i = 0; - continue; - } - number = atoi(s) - 1; - if (number >= 0 && number < rules->models.num_desc) - break; - } - - i = strlen(rules->models.desc[number].name) + 1; - config_xkbmodel = Malloc(i); - sprintf(config_xkbmodel,"%s", rules->models.desc[number].name); - - emptylines(); - printf(xkblayouttext); - - number = -1; - for (i=0;;) { - emptylines(); - for (j = i; j < i + 18 && j < rules->layouts.num_desc; j++) - printf("%3d %-50s\n", j+1, - rules->layouts.desc[j].desc); - printf("\n"); - printf("Enter a number to choose the country.\n"); - if (rules->layouts.num_desc >= 18) - printf("Press enter for the next page\n"); - printf("\n"); - getstring(s); - if (strlen(s) == 0) { - i += 18; - if (i > rules->layouts.num_desc) - i = 0; - continue; - } - number = atoi(s) - 1; - if (number >= 0 && number < rules->layouts.num_desc) - break; - } - config_xkblayout = Malloc(strlen(rules->layouts.desc[number].name)+1); - sprintf(config_xkblayout,"%s", rules->layouts.desc[number].name); - - emptylines(); - printf(xkbvarianttext, config_xkblayout); - getstring(s); - if (strlen(s) != 0) { - config_xkbvariant = Malloc(strlen(s) + 1); - strcpy(config_xkbvariant, s); - } - - emptylines(); - printf(xkboptionstext); - getstring(s); - if (!answerisyes(s)) - return; - - num_options = 0; - for (j=0,i=0;;) { - if (!strchr(rules->options.desc[i].name, ':')) { - emptylines(); - printf(" %s\n\n", rules->options.desc[i].desc); - j = i; - } else { - printf("%3d %-50s\n", i - j, rules->options.desc[i].desc); - } - i++; - if ( i == rules->options.num_desc || - !strchr(rules->options.desc[i].name, ':')) { - printf("\nPlease select the option or just press enter if none\n"); - getstring(s); - if (strlen(s) != 0) { - number = atoi(s); - if (number && (num_options < MAX_XKBOPTIONS)) { - options[num_options++] = number + j; - } - } - } - if (i == rules->options.num_desc) - break; - } - - if (!num_options) - return; - - for (j=0,i=0; ioptions.desc[options[i]].name); - } - config_xkboptions = Malloc(j + num_options); - for (j=0,i=0; ioptions.desc[options[i]].name); - } - return; -} - - - -/* - * Monitor configuration. - */ - -static char *monitorintro_text = -"Now we want to set the specifications of the monitor. The two critical\n" -"parameters are the vertical refresh rate, which is the rate at which the\n" -"the whole screen is refreshed, and most importantly the horizontal sync rate,\n" -"which is the rate at which scanlines are displayed.\n" -"\n" -"The valid range for horizontal sync and vertical sync should be documented\n" -"in the manual of your monitor.\n" -"\n"; - -static char *hsyncintro_text = -"You must indicate the horizontal sync range of your monitor. You can either\n" -"select one of the predefined ranges below that correspond to industry-\n" -"standard monitor types, or give a specific range.\n" -"\n" -"It is VERY IMPORTANT that you do not specify a monitor type with a horizontal\n" -"sync range that is beyond the capabilities of your monitor. If in doubt,\n" -"choose a conservative setting.\n" -"\n"; - -static char *customhsync_text = -"Please enter the horizontal sync range of your monitor, in the format used\n" -"in the table of monitor types above. You can either specify one or more\n" -"continuous ranges (e.g. 15-25, 30-50), or one or more fixed sync frequencies.\n" -"\n"; - -static char *vsyncintro_text = -"You must indicate the vertical sync range of your monitor. You can either\n" -"select one of the predefined ranges below that correspond to industry-\n" -"standard monitor types, or give a specific range. For interlaced modes,\n" -"the number that counts is the high one (e.g. 87 Hz rather than 43 Hz).\n" -"\n" -" 1 50-70\n" -" 2 50-90\n" -" 3 50-100\n" -" 4 40-150\n" -" 5 Enter your own vertical sync range\n"; - -static char *monitordescintro_text = -"You must now enter a few identification/description strings, namely an\n" -"identifier, a vendor name, and a model name. Just pressing enter will fill\n" -"in default names.\n" -"\n"; - -#define NU_MONITORTYPES 10 - -static char *monitortype_range[NU_MONITORTYPES] = { - "31.5", - "31.5 - 35.1", - "31.5, 35.5", - "31.5, 35.15, 35.5", - "31.5 - 37.9", - "31.5 - 48.5", - "31.5 - 57.0", - "31.5 - 64.3", - "31.5 - 79.0", - "31.5 - 82.0" -}; - -static char *monitortype_name[NU_MONITORTYPES] = { - "Standard VGA, 640x480 @ 60 Hz", - "Super VGA, 800x600 @ 56 Hz", - "8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600)", - "Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz", - "Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz", - "Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz", - "High Frequency SVGA, 1024x768 @ 70 Hz", - "Monitor that can do 1280x1024 @ 60 Hz", - "Monitor that can do 1280x1024 @ 74 Hz", - "Monitor that can do 1280x1024 @ 76 Hz" -}; - -static void -monitor_configuration(void) { - int i; - char s[80]; - printf("%s", monitorintro_text); - - keypress(); - emptylines(); - - printf("%s", hsyncintro_text); - - printf(" hsync in kHz; monitor type with characteristic modes\n"); - for (i = 0; i < NU_MONITORTYPES; i++) - printf("%2d %s; %s\n", i + 1, monitortype_range[i], - monitortype_name[i]); - - printf("%2d Enter your own horizontal sync range\n", - NU_MONITORTYPES + 1); - printf("\n"); - - printf("Enter your choice (1-%d): ", NU_MONITORTYPES + 1); - getstring(s); - config_monitortype = atoi(s) - 1; - if (config_monitortype < 0) - config_monitortype = 0; - - printf("\n"); - - if (config_monitortype < NU_MONITORTYPES) - config_hsyncrange = monitortype_range[config_monitortype]; - else { - /* Custom hsync range option selected. */ - printf("%s", customhsync_text); - printf("Horizontal sync range: "); - getstring(s); - config_hsyncrange = Malloc(strlen(s) + 1); - strcpy(config_hsyncrange, s); - printf("\n"); - } - - printf("%s", vsyncintro_text); - printf("\n"); - - printf("Enter your choice: "); - getstring(s); - printf("\n"); - switch (atoi(s)) { - case 0 : - case 1 : - config_vsyncrange = "50-70"; - break; - case 2 : - config_vsyncrange = "50-90"; - break; - case 3 : - config_vsyncrange = "50-100"; - break; - case 4 : - config_vsyncrange = "40-150"; - break; - case 5 : - /* Custom vsync range option selected. */ - printf("Vertical sync range: "); - getstring(s); - config_vsyncrange = Malloc(strlen(s) + 1); - strcpy(config_vsyncrange, s); - printf("\n"); - break; - } - printf("%s", monitordescintro_text); - printf("The strings are free-form, spaces are allowed.\n"); - printf("Enter an identifier for your monitor definition: "); - getstring(s); - if (strlen(s) == 0) - config_monitoridentifier = "My Monitor"; - else { - config_monitoridentifier = Malloc(strlen(s) + 1); - strcpy(config_monitoridentifier, s); - } -} - - -/* - * Card database. - */ - -static char *cardintro_text = -"Now we must configure video card specific settings. At this point you can\n" -"choose to make a selection out of a database of video card definitions.\n" -"Because there can be variation in Ramdacs and clock generators even\n" -"between cards of the same model, it is not sensible to blindly copy\n" -"the settings (e.g. a Device section). For this reason, after you make a\n" -"selection, you will still be asked about the components of the card, with\n" -"the settings from the chosen database entry presented as a strong hint.\n" -"\n" -"The database entries include information about the chipset, what driver to\n" -"run, the Ramdac and ClockChip, and comments that will be included in the\n" -"Device section. However, a lot of definitions only hint about what driver\n" -"to run (based on the chipset the card uses) and are untested.\n" -"\n" -"If you can't find your card in the database, there's nothing to worry about.\n" -"You should only choose a database entry that is exactly the same model as\n" -"your card; choosing one that looks similar is just a bad idea (e.g. a\n" -"GemStone Snail 64 may be as different from a GemStone Snail 64+ in terms of\n" -"hardware as can be).\n" -"\n"; - -static char *cardunsupported_text = -"This card is basically UNSUPPORTED. It may only work as a generic\n" -"VGA-compatible card. If you have an "__XSERVERNAME__" version more recent than what\n" -"this card definition was based on, there's a chance that it is now\n" -"supported.\n"; - -static void -carddb_configuration(void) { - int i; - char s[80]; - card_selected = -1; - printf("%s", cardintro_text); - printf("Do you want to look at the card database? "); - getstring(s); - printf("\n"); - if (!answerisyes(s)) - return; - - /* - * Choose a database entry. - */ - if (parse_database()) { - printf("Couldn't read card database file %s.\n", - CARD_DATABASE_FILE); - keypress(); - return; - } - - i = 0; - for (;;) { - int j; - emptylines(); - for (j = i; j < i + 18 && j <= lastcard; j++) { - char *name = card[j].name, - *chipset = card[j].chipset; - - printf("%3d %-50s%s\n", j, - name ? name : "-", - chipset ? chipset : "-"); - } - printf("\n"); - printf("Enter a number to choose the corresponding card definition.\n"); - printf("Press enter for the next page, q to continue configuration.\n"); - printf("\n"); - getstring(s); - if (s[0] == 'q') - break; - if (strlen(s) == 0) { - i += 18; - if (i > lastcard) - i = 0; - continue; - } - card_selected = atoi(s); - if (card_selected >= 0 && card_selected <= lastcard) - break; - } - - /* - * Look at the selected card. - */ - if (card_selected != -1) { - char *name = card[card_selected].name, - *chipset = card[card_selected].chipset; - - printf("\nYour selected card definition:\n\n"); - printf("Identifier: %s\n", name ? name : "-"); - printf("Chipset: %s\n", chipset ? chipset : "-"); - if (!card[card_selected].driver) - card[card_selected].driver = "unknown"; - printf("Driver: %s\n", card[card_selected].driver); - - if (card[card_selected].ramdac != NULL) - printf("Ramdac: %s\n", card[card_selected].ramdac); - if (card[card_selected].dacspeed != NULL) - printf("DacSpeed: %s\n", card[card_selected].dacspeed); - if (card[card_selected].clockchip != NULL) - printf("Clockchip: %s\n", card[card_selected].clockchip); - if (card[card_selected].flags & NOCLOCKPROBE) - printf("Do NOT probe clocks or use any Clocks line.\n"); - if (card[card_selected].flags & UNSUPPORTED) - printf("%s", cardunsupported_text); -#if 0 /* Might be confusing. */ - if (strlen(card[card_selected].lines) > 0) - printf("Device section text:\n%s", - card[card_selected].lines); -#endif - printf("\n"); - keypress(); - } -} - - -/* - * Screen/video card configuration. - */ - -static char *deviceintro_text = -"Now you must give information about your video card. This will be used for\n" -"the \"Device\" section of your video card in " CONFIGNAME ".\n" -"\n"; - -static char *videomemoryintro_text = -"It is probably a good idea to use the same approximate amount as that detected\n" -"by the server you intend to use. If you encounter problems that are due to the\n" -"used server not supporting the amount memory you have, specify the maximum\n" -"amount supported by the server.\n" -"\n" -"How much video memory do you have on your video card:\n" -"\n"; - -static char *carddescintro_text = -"You must now enter a few identification/description strings, namely an\n" -"identifier, a vendor name, and a model name. Just pressing enter will fill\n" -"in default names (possibly from a card definition).\n" -"\n"; - -#if 0 -static char *devicesettingscomment_text = -"Especially for accelerated drivers, Ramdac, Dacspeed and ClockChip settings\n" -"or special options may be required in the Device section.\n" -"\n"; - -static char *ramdaccomment_text = -"The RAMDAC setting only applies to some drivers. Some RAMDAC's are\n" -"auto-detected by the server. The detection of a RAMDAC is forced by using a\n" -"Ramdac \"identifier\" line in the Device section. The identifiers are shown\n" -"at the right of the following table of RAMDAC types:\n" -"\n"; - -#define NU_RAMDACS 24 - -static char *ramdac_name[NU_RAMDACS] = { - "AT&T 20C490 (S3 and AGX servers, ARK driver)", - "AT&T 20C498/21C498/22C498 (S3, autodetected)", - "AT&T 20C409/20C499 (S3, autodetected)", - "AT&T 20C505 (S3)", - "BrookTree BT481 (AGX)", - "BrookTree BT482 (AGX)", - "BrookTree BT485/9485 (S3)", - "Sierra SC15025 (S3, AGX)", -#if XFREE86_VERSION >= 311 - "S3 GenDAC (86C708) (autodetected)", - "S3 SDAC (86C716) (autodetected)", -#else - "S3 GenDAC (86C708)", - "S3 SDAC (86C716)", -#endif - "STG-1700 (S3, autodetected)", - "STG-1703 (S3, autodetected)", - "TI 3020 (S3, autodetected)", - "TI 3025 (S3, autodetected)", - "TI 3026 (S3, autodetected)", - "IBM RGB 514 (S3, autodetected)", - "IBM RGB 524 (S3, autodetected)", - "IBM RGB 525 (S3, autodetected)", - "IBM RGB 526 (S3)", - "IBM RGB 528 (S3, autodetected)", - "ICS5342 (S3, ARK)", - "ICS5341 (W32)", - "IC Works w30C516 ZoomDac (ARK)", - "Normal DAC" -}; - -static char *ramdac_id[NU_RAMDACS] = { - "att20c490", "att20c498", "att20c409", "att20c505", "bt481", "bt482", - "bt485", "sc15025", "s3gendac", "s3_sdac", "stg1700","stg1703", - "ti3020", "ti3025", "ti3026", "ibm_rgb514", "ibm_rgb524", - "ibm_rgb525", "ibm_rgb526", "ibm_rgb528", "ics5342", "ics5341", - "zoomdac", "normal" -}; - -static char *clockchipcomment_text = -"A Clockchip line in the Device section forces the detection of a\n" -"programmable clock device. With a clockchip enabled, any required\n" -"clock can be programmed without requiring probing of clocks or a\n" -"Clocks line. Most cards don't have a programmable clock chip.\n" -"Choose from the following list:\n" -"\n"; - -#define NU_CLOCKCHIPS 12 - -static char *clockchip_name[] = { - "Chrontel 8391", - "ICD2061A and compatibles (ICS9161A, DCS2824)", - "ICS2595", - "ICS5342 (similar to SDAC, but not completely compatible)", - "ICS5341", - "S3 GenDAC (86C708) and ICS5300 (autodetected)", - "S3 SDAC (86C716)", - "STG 1703 (autodetected)", - "Sierra SC11412", - "TI 3025 (autodetected)", - "TI 3026 (autodetected)", - "IBM RGB 51x/52x (autodetected)", -}; - -static char *clockchip_id[] = { - "ch8391", "icd2061a", "ics2595", "ics5342", "ics5341", - "s3gendac", "s3_sdac", - "stg1703", "sc11412", "ti3025", "ti3026", "ibm_rgb5xx", -}; - -static char *deviceclockscomment_text = -"For most modern configurations, a Clocks line is neither required or\n" -"desirable. However for some older hardware it can be useful since it\n" -"prevents the slow and nasty sounding clock probing at server start-up.\n" -"Probed clocks are displayed at server startup, along with other server\n" -"and hardware configuration info. You can save this information in a file\n" -"by running 'X -probeonly 2>output_file'. Be warned that clock probing is\n" -"inherently imprecise; some clocks may be slightly too high (varies per run).\n" -"\n"; - -static char *deviceclocksquestion_text = -"At this point I can run X -probeonly, and try to extract the clock information\n" -"from the output. It is recommended that you do this yourself and if a set of\n" -"clocks is shown then you add a clocks line (note that the list of clocks may\n" -"be split over multiple Clocks lines) to your Device section afterwards. Be\n" -"aware that a clocks line is not appropriate for most modern hardware that\n" -"has programmable clocks.\n" -"\n" -"You must be root to be able to run X -probeonly now.\n" -"\n"; - -static char *probeonlywarning_text = -"It is possible that the hardware detection routines in the server will somehow\n" -"cause the system to crash and the screen to remain blank. If this is the\n" -"case, do not choose this option the next time. The server may need a\n" -"Ramdac, ClockChip or special option (e.g. \"nolinear\" for S3) to probe\n" -"and start-up correctly.\n" -"\n"; -#endif - -static char *modesorderintro_text = -"For each depth, a list of modes (resolutions) is defined. The default\n" -"resolution that the server will start-up with will be the first listed\n" -"mode that can be supported by the monitor and card.\n" -"Currently it is set to:\n" -"\n"; - -static char *modesorder_text2 = -"Modes that cannot be supported due to monitor or clock constraints will\n" -"be automatically skipped by the server.\n" -"\n" -" 1 Change the modes for 8-bit (256 colors)\n" -" 2 Change the modes for 16-bit (32K/64K colors)\n" -" 3 Change the modes for 24-bit (24-bit color)\n" -" 4 The modes are OK, continue.\n" -"\n"; - -static char *modeslist_text = -"Please type the digits corresponding to the modes that you want to select.\n" -"For example, 432 selects \"1024x768\" \"800x600\" \"640x480\", with a\n" -"default mode of 1024x768.\n" -"\n"; - -static char *virtual_text = -"You can have a virtual screen (desktop), which is screen area that is larger\n" -"than the physical screen and which is panned by moving the mouse to the edge\n" -"of the screen. If you don't want virtual desktop at a certain resolution,\n" -"you cannot have modes listed that are larger. Each color depth can have a\n" -"differently-sized virtual screen\n" -"\n"; - -static int videomemory[] = { - 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144 -}; - -/* Is this required? */ -#if XFREE86_VERSION >= 400 -#define NU_MODESTRINGS 13 -#else -#if XFREE86_VERSION >= 330 -#define NU_MODESTRINGS 12 -#else -#if XFREE86_VERSION >= 311 -#define NU_MODESTRINGS 8 -#else -#define NU_MODESTRINGS 5 -#endif -#endif -#endif - -static char *modestring[NU_MODESTRINGS] = { - "\"640x400\"", - "\"640x480\"", - "\"800x600\"", - "\"1024x768\"", - "\"1280x1024\"", -#if XFREE86_VERSION >= 311 - "\"320x200\"", - "\"320x240\"", - "\"400x300\"" -#endif -#if XFREE86_VERSION >= 330 - ,"\"1152x864\"", - "\"1600x1200\"", - "\"1800x1400\"", - "\"512x384\"" -#endif -#if XFREE86_VERSION >= 400 - ,"\"1400x1050\"" -#endif -}; - -static int exists_dir(char *name) { - struct stat sbuf; - - /* is it there ? */ - if (stat(name,&sbuf) == -1) - return 0; - - /* is there, but is it a dir? */ - return S_ISDIR(sbuf.st_mode) ? 1 : 0; -} - -static int -screen_configuration(void) { - int i, c/*, np*/; - char s[80]; - - /* - * Configure the "Device" section for the video card. - */ - - printf("%s", deviceintro_text); - - printf("%s", videomemoryintro_text); - - for (i = 0; i < sizeof(videomemory) / sizeof(videomemory[0]); i++) - printf("%2d %dK\n", i + 1, videomemory[i]); - printf("%2d Other\n\n", i + 1); - - printf("Enter your choice: "); - getstring(s); - printf("\n"); - - c = atoi(s) - 1; - if (c >= 0 && c < sizeof(videomemory) / sizeof(videomemory[0])) - config_videomemory = videomemory[c]; - else { - printf("Amount of video memory in Kbytes: "); - getstring(s); - config_videomemory = atoi(s); - printf("\n"); - } - - printf("%s", carddescintro_text); - if (card_selected != -1) - printf("Your card definition is %s.\n\n", - card[card_selected].name); - printf("The strings are free-form, spaces are allowed.\n"); - printf("Enter an identifier for your video card definition: "); - getstring(s); - if (strlen(s) == 0) - if (card_selected != -1) - config_deviceidentifier = card[card_selected].name; - else - config_deviceidentifier = "My Video Card"; - else { - config_deviceidentifier = Malloc(strlen(s) + 1); - strcpy(config_deviceidentifier, s); - } - printf("\n"); - - emptylines(); - - /* - * Initialize screen mode variables for svga and accel - * to default values. - * XXXX Doesn't leave room for off-screen caching in 16/32bpp modes - * for the accelerated servers in some situations. - */ - config_modesline8bpp = - config_modesline16bpp = - config_modesline24bpp = "\"640x480\""; - config_virtualx8bpp = config_virtualx16bpp = config_virtualx24bpp = - config_virtualy8bpp = config_virtualy16bpp = config_virtualy24bpp = 0; - if (config_videomemory >= 4096) { - config_virtualx8bpp = 1600; - config_virtualy8bpp = 1280; - if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) { - /* - * Allow room for font/pixmap cache for accel - * servers. - */ - config_virtualx16bpp = 1280; - config_virtualy16bpp = 1024; - } - else { - config_virtualx16bpp = 1600; - config_virtualy16bpp = 1280; - } - if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) { - config_virtualx24bpp = 1152; - config_virtualy24bpp = 900; - } - else { - config_virtualx24bpp = 1280; - config_virtualy24bpp = 1024; - } - /* Add 1600x1280 */ - config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; - config_modesline16bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; - config_modesline24bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; - - } - else - if (config_videomemory >= 2048) { - if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) { - /* - * Allow room for font/pixmap cache for accel - * servers. - * Also the mach32 is has a limited width. - */ - config_virtualx8bpp = 1280; - config_virtualy8bpp = 1024; - } - else { - config_virtualx8bpp = 1600; - config_virtualy8bpp = 1200; - } - if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) { - config_virtualx16bpp = 1024; - config_virtualy16bpp = 768; - } - else { - config_virtualx16bpp = 1152; - config_virtualy16bpp = 900; - } - config_virtualx24bpp = 800; - config_virtualy24bpp = 600; - if (config_videomemory >= 2048 + 256) { - config_virtualx24bpp = 1024; - config_virtualy24bpp = 768; - } - config_modesline8bpp = "\"1280x1024\" \"1024x768\" \"800x600\" \"640x480\""; - config_modesline16bpp = "\"1024x768\" \"800x600\" \"640x480\""; - if (config_videomemory >= 2048 + 256) - config_modesline24bpp = "\"1024x768\" \"800x600\" \"640x480\""; - else - config_modesline24bpp = "\"800x600\" \"640x480\""; - } - else - if (config_videomemory >= 1024) { - if (card_selected != -1 && !(card[card_selected].flags & UNSUPPORTED)) { - /* - * Allow room for font/pixmap cache for accel - * servers. - */ - config_virtualx8bpp = 1024; - config_virtualy8bpp = 768; - } - else { - config_virtualx8bpp = 1152; - config_virtualy8bpp = 900; - } - config_virtualx16bpp = 800; /* Forget about cache space; */ - config_virtualy16bpp = 600; /* it's small enough as it is. */ - config_virtualx24bpp = 640; - config_virtualy24bpp = 480; - config_modesline8bpp = "\"1024x768\" \"800x600\" \"640x480\""; - config_modesline16bpp = "\"800x600\" \"640x480\""; - config_modesline24bpp = "\"640x480\""; - } - else - if (config_videomemory >= 512) { - config_virtualx8bpp = 800; - config_virtualy8bpp = 600; - config_modesline8bpp = "\"800x600\" \"640x480\""; - config_modesline16bpp = "\"640x400\""; - } - else - if (config_videomemory >= 256) { - config_modesline8bpp = "\"640x400\""; - config_virtualx8bpp = 640; - config_virtualy8bpp = 400; - } - else { - printf("Invalid amount of video memory. Please try again\n"); - return(1); - } - -#if 0 - /* - * Handle the Ramdac/Clockchip setting. - */ - - printf("%s", devicesettingscomment_text); - - if (card_selected == -1 || (card[card_selected].flags & UNSUPPORTED)) - goto skipramdacselection; - - printf("%s", ramdaccomment_text); - - /* meanwhile there are so many RAMDACs that they do no longer fit on - * on page - */ - for (np=12, i=0 ;;) { - int j; - for (j = i; j < i + np && j < NU_RAMDACS; j++) - printf("%3d %-60s%s\n", j+1, - ramdac_name[j], - ramdac_id[j]); - - printf("\n"); - if (card_selected != -1) - if (card[card_selected].ramdac != NULL) - printf("The card definition has Ramdac \"%s\".\n\n", - card[card_selected].ramdac); - printf("\n"); - printf("Enter a number to choose the corresponding RAMDAC.\n"); - printf("Press enter for the next page, q to quit without selection of a RAMDAC.\n"); - printf("\n"); - getstring(s); - - config_ramdac = NULL; - if (s[0] == 'q') - break; - - if (strlen(s) > 0) { - c = atoi(s)-1; - if (c >= 0 && c < NU_RAMDACS) { - config_ramdac = ramdac_id[atoi(s)-1]; - break; - } - } - - i += np; - if (np==12) np = 18; /* account intro lines only displayed 1st time */ - if (i >= NU_RAMDACS) - i = 0; - emptylines(); - } - -skipramdacselection: - emptylines(); - printf("%s", clockchipcomment_text); - - for (i = 0; i < NU_CLOCKCHIPS; i++) - printf("%2d %-60s%s\n", - i + 1, clockchip_name[i], clockchip_id[i]); - - printf("\n"); - - if (card_selected != -1) - if (card[card_selected].clockchip != NULL) - printf("The card definition has Clockchip \"%s\"\n\n", - card[card_selected].clockchip); - - printf("Just press enter if you don't want a Clockchip setting.\n"); - printf("What Clockchip setting do you want (1-%d)? ", NU_CLOCKCHIPS); - - getstring(s); - config_clockchip = NULL; - if (strlen(s) > 0) - config_clockchip = clockchip_id[atoi(s) - 1]; - - emptylines(); - - /* - * Optionally run X -probeonly to figure out the clocks. - */ - - config_numberofclockslines = 0; - - printf("%s", deviceclockscomment_text); - - printf("%s", deviceclocksquestion_text); -#endif - -#if 0 - /* - * XXX Change this to check for a CLOCKPROBE flag rather than an - * NOCLOCKPROBE. - */ - if (card_selected != -1) - if (card[card_selected].flags & NOCLOCKPROBE) - printf("The card definition says to NOT probe clocks.\n"); - - if (config_clockchip != NULL) { - printf("Because you have enabled a Clockchip line, there's no need for clock\n" - "probing.\n"); - keypress(); - goto skipclockprobing; - } - - printf("Do you want me to run 'X -probeonly' now? "); - getstring(s); - printf("\n"); - if (answerisyes(s)) { - /* - * Write temporary XF86Config and run X -probeonly. - * Only allow when root. - */ - FILE *f; - char *buf; - char syscmdline[2*256+100]; /* enough */ - char *fname = NULL; - char *d2name = NULL; - char *d3name = NULL; - - if (getuid() != 0) { - printf("Sorry, you must be root to do this.\n\n"); - goto endofprobeonly; - } - printf("%s", probeonlywarning_text); - keypress(); - fname = Malloc(strlen(temp_dir) + - strlen(TEMPORARY_XF86CONFIG_FILENAME) + 1); - sprintf(fname, "%s%s", temp_dir, - TEMPORARY_XF86CONFIG_FILENAME); - d2name = Malloc(strlen(temp_dir) + strlen(DUMBCONFIG2) + 1); - sprintf(d2name, "%s%s", temp_dir, DUMBCONFIG2); - d3name = Malloc(strlen(temp_dir) + strlen(DUMBCONFIG3) + 1); - sprintf(d3name, "%s%s", temp_dir, DUMBCONFIG3); - printf("Running X -probeonly -pn -xf86config %s.\n", fname); - write_XF86Config(fname); - sync(); - /* compose a line with the real path */ - sprintf(syscmdline, "X -probeonly -pn -xf86config %s 2> %s", - fname, d2name); - - if (system(syscmdline)) { - printf("X -probeonly call failed.\n"); - printf("No Clocks line inserted.\n"); - goto clocksprobefailed; - } - /* Look for 'clocks:' (case sensitive). */ - sprintf(syscmdline, "grep clocks\\: %s > %s", d2name, d3name); - if (system(syscmdline)) { - printf("grep failed.\n"); - printf("Cannot find clocks in server output.\n"); - goto clocksprobefailed; - } - f = fopen(d3name, "r"); - buf = Malloc(8192); - /* Parse lines. */ - while (fgets(buf, 8192, f) != NULL) { - char *clks; - clks = strstr(buf, "clocks: ") + 8; - if (clks >= buf + 3 && strcmp(clks - 11, "num") == 0) - /* Reject lines with 'numclocks:'. */ - continue; - if (clks >= buf + 8 && strcpy(clks - 14, "pixel ") == 0) - /* Reject lines with 'pixel clocks:'. */ - continue; - clks[strlen(clks) - 1] = '\0'; /* Remove '\n'. */ - config_clocksline[config_numberofclockslines] = - Malloc(strlen(clks) + 1); - strcpy(config_clocksline[config_numberofclockslines], - clks); - printf("Clocks %s\n", clks); - config_numberofclockslines++; - } - fclose(f); -clocksprobefailed: - unlink(d3name); - unlink(d2name); - unlink(fname); - printf("\n"); - -endofprobeonly: - keypress(); - } -skipclockprobing: -#endif - - /* - * For vga driver, no further configuration is required. - */ - if (card_selected == -1 || (card[card_selected].flags & UNSUPPORTED)) - return (0); - - /* - * Configure the modes order. - */ - config_virtual = 0; - for (;;) { - char modes[128]; - - emptylines(); - - printf("%s", modesorderintro_text); - printf("%s for 8-bit\n", config_modesline8bpp); - printf("%s for 16-bit\n", config_modesline16bpp); - printf("%s for 24-bit\n", config_modesline24bpp); - printf("\n"); - printf("%s", modesorder_text2); - - printf("Enter your choice: "); - getstring(s); - printf("\n"); - - c = atoi(s) - 1; - if (c < 0 || c >= 3) - break; - - printf("Select modes from the following list:\n\n"); - - for (i = 0; i < NU_MODESTRINGS; i++) - printf(" %c %s\n", i < 9 ? '1' + i : - 'a' + i - 9, - modestring[i]); - printf("\n"); - - printf("%s", modeslist_text); - - printf("Which modes? "); - getstring(s); - printf("\n"); - - modes[0] = '\0'; - for (i = 0; i < strlen(s); i++) { - if ( NU_MODESTRINGS > 9 ) { - if ((s[i] < '1' || s[i] > '9') && - (s[i] < 'a' || s[i] > 'a' + NU_MODESTRINGS - 10)) { - printf("Invalid mode skipped.\n"); - continue; - } - } - else { - if (s[i] < '1' || s[i] > '0' + NU_MODESTRINGS) { - printf("Invalid mode skipped.\n"); - continue; - } - } - if (i > 0) - strcat(modes, " "); - strcat(modes, modestring[s[i] <= '9' ? s[i] - '1' : - s[i] - 'a' + 9]); - } - switch (c) { - case 0 : - config_modesline8bpp = Malloc(strlen(modes) + 1); - strcpy(config_modesline8bpp, modes); - break; - case 1 : - config_modesline16bpp = Malloc(strlen(modes) + 1); - strcpy(config_modesline16bpp, modes); - break; - case 2 : - config_modesline24bpp = Malloc(strlen(modes) + 1); - strcpy(config_modesline24bpp, modes); - break; - } - - printf("%s", virtual_text); - - printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Do you want a virtual screen that is larger than the physical screen?"); - getstring(s); - if (answerisyes(s)) - config_virtual = 1; - } - return(0); -} - -static char *defaultdepthtext = -"Please specify which color depth you want to use by default:\n" -"\n"; - -static struct depth_str { - char *name; - char *desc; -} depth_list[] = { - { "1", "1 bit (monochrome)" }, - { "4", "4 bits (16 colors)" }, - { "8", "8 bits (256 colors)" }, - { "16", "16 bits (65536 colors)" }, - { "24", "24 bits (16 million colors)" } -}; - -static int ndepths = sizeof(depth_list)/sizeof(struct depth_str); - -static void -depth_configuration(void) -{ - int i; - char s[80]; - int depth; - - printf(defaultdepthtext); - for (i=0; i ndepths) ? 0 : i; - } - config_depth = depth_list[depth].name; -} - -/* - * Create the XF86Config file. - */ - -static char *XF86Config_firstchunk_text = -"# File generated by xorgconfig.\n" -"\n" -"#\n" -"# Copyright 2004 "XVENDORNAME"\n" -"#\n" -"# Permission is hereby granted, free of charge, to any person obtaining a\n" -"# copy of this software and associated documentation files (the \"Software\"),\n" -"# to deal in the Software without restriction, including without limitation\n" -"# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n" -"# and/or sell copies of the Software, and to permit persons to whom the\n" -"# Software is furnished to do so, subject to the following conditions:\n" -"# \n" -"# The above copyright notice and this permission notice shall be included in\n" -"# all copies or substantial portions of the Software.\n" -"# \n" -"# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n" -"# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" -"# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n" -"# "XVENDORNAME" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n" -"# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF\n" -"# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n" -"# SOFTWARE.\n" -"# \n" -"# Except as contained in this notice, the name of "XVENDORNAME" shall\n" -"# not be used in advertising or otherwise to promote the sale, use or other\n" -"# dealings in this Software without prior written authorization from\n" -"# "XVENDORNAME".\n" -"#\n" -"\n" -"# **********************************************************************\n" -"# Refer to the " CONFIGNAME "(" FILEMANSUFFIX ") man page for details about the format of \n" -"# this file.\n" -"# **********************************************************************\n" -"\n" -"# **********************************************************************\n" -"# Module section -- this section is used to specify\n" -"# which dynamically loadable modules to load.\n" -"# **********************************************************************\n" -"#\n" -"Section \"Module\"\n" -"\n" -"# This loads the DBE extension module.\n" -"\n" -" Load \"dbe\" # Double buffer extension\n" -"\n" -"# This loads the miscellaneous extensions module, and disables\n" -"# initialisation of the XFree86-DGA extension within that module.\n" -" SubSection \"extmod\"\n" -" Option \"omit xfree86-dga\" # don't initialise the DGA extension\n" -" EndSubSection\n" -"\n" -"# This loads the font modules\n" -#ifdef HAS_TYPE1 -" Load \"type1\"\n" -#else -"# Load \"type1\"\n" -#endif -" Load \"freetype\"\n" -"# Load \"xtt\"\n" -"\n" -"# This loads the GLX module\n" -"# Load \"glx\"\n" -"# This loads the DRI module\n" -"# Load \"dri\"\n" -"\n" -"EndSection\n" -"\n" -"# **********************************************************************\n" -"# Files section. This allows default font and rgb paths to be set\n" -"# **********************************************************************\n" -"\n" -"Section \"Files\"\n" -"\n" -"# Multiple FontPath entries are allowed (which are concatenated together),\n" -"# as well as specifying multiple comma-separated entries in one FontPath\n" -"# command (or a combination of both methods)\n" -"# \n" -"\n"; - -static char *XF86Config_fontpaths[] = -{ -/* " FontPath \"" TREEROOTFONT "/75dpi/\"\n"*/ - "/local/", - "/misc/", - "/75dpi/:unscaled", - "/100dpi/:unscaled", - "/Type1/", - "/TrueType/", - "/freefont/", - "/75dpi/", - "/100dpi/", - 0 /* end of fontpaths */ -}; - -static char *XF86Config_fontpathchunk_text = - -"\n" -"# The module search path. The default path is shown here.\n" -"\n" -"# ModulePath \"" MODULEPATH "\"\n" -"\n" -"EndSection\n" -"\n" -"# **********************************************************************\n" -"# Server flags section.\n" -"# **********************************************************************\n" -"\n" -"Section \"ServerFlags\"\n" -"\n" -"# Uncomment this to cause a core dump at the spot where a signal is \n" -"# received. This may leave the console in an unusable state, but may\n" -"# provide a better stack trace in the core dump to aid in debugging\n" -"\n" -"# Option \"NoTrapSignals\"\n" -"\n" -"# Uncomment this to disable the VT switch sequence\n" -"# (where n is 1 through 12). This allows clients to receive these key\n" -"# events.\n" -"\n" -"# Option \"DontVTSwitch\"\n" -"\n" -"# Uncomment this to disable the server abort sequence\n" -"# This allows clients to receive this key event.\n" -"\n" -"# Option \"DontZap\"\n" -"\n" -"# Uncomment this to disable the / mode switching\n" -"# sequences. This allows clients to receive these key events.\n" -"\n" -"# Option \"Dont Zoom\"\n" -"\n" -"# Uncomment this to disable tuning with the xvidtune client. With\n" -"# it the client can still run and fetch card and monitor attributes,\n" -"# but it will not be allowed to change them. If it tries it will\n" -"# receive a protocol error.\n" -"\n" -"# Option \"DisableVidModeExtension\"\n" -"\n" -"# Uncomment this to enable the use of a non-local xvidtune client. \n" -"\n" -"# Option \"AllowNonLocalXvidtune\"\n" -"\n" -"# Uncomment this to disable dynamically modifying the input device\n" -"# (mouse and keyboard) settings. \n" -"\n" -"# Option \"DisableModInDev\"\n" -"\n" -"# Uncomment this to enable the use of a non-local client to\n" -"# change the keyboard or mouse settings (currently only xset).\n" -"\n" -"# Option \"AllowNonLocalModInDev\"\n" -"\n" -"EndSection\n" -"\n" -"# **********************************************************************\n" -"# Input devices\n" -"# **********************************************************************\n" -"\n" -"# **********************************************************************\n" -"# Core keyboard's InputDevice section\n" -"# **********************************************************************\n" -"\n" -"Section \"InputDevice\"\n" -"\n" -" Identifier \"Keyboard1\"\n" -" Driver \"kbd\"\n" -"\n" -" Option \"AutoRepeat\" \"500 30\"\n" -"\n" -"# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))\n" -"# Option \"Xleds\" \"1 2 3\"\n" -"\n"; - -static char *keyboardchunk2_text = -"\n"; - -static char *keyboardchunk3_text = -"# To customise the XKB settings to suit your keyboard, modify the\n" -"# lines below (which are the defaults). For example, for a non-U.S.\n" -"# keyboard, you will probably want to use:\n" -"# Option \"XkbModel\" \"pc105\"\n" -"# If you have a US Microsoft Natural keyboard, you can use:\n" -"# Option \"XkbModel\" \"microsoft\"\n" -"#\n" -"# Then to change the language, change the Layout setting.\n" -"# For example, a german layout can be obtained with:\n" -"# Option \"XkbLayout\" \"de\"\n" -"# or:\n" -"# Option \"XkbLayout\" \"de\"\n" -"# Option \"XkbVariant\" \"nodeadkeys\"\n" -"#\n" -"# If you'd like to switch the positions of your capslock and\n" -"# control keys, use:\n" -"# Option \"XkbOptions\" \"ctrl:swapcaps\"\n" -"\n" -"# These are the default XKB settings for "__XSERVERNAME__"\n" -"# Option \"XkbRules\" \""__XKBDEFRULES__"\"\n" -"# Option \"XkbModel\" \"pc105\"\n" -"# Option \"XkbLayout\" \"us\"\n" -"# Option \"XkbVariant\" \"\"\n" -"# Option \"XkbOptions\" \"\"\n" -"\n"; - -static char *keyboardlastchunk_text = -"\n" -"EndSection\n" -"\n" -"\n"; - -static char *pointersection_text1 = -"# **********************************************************************\n" -"# Core Pointer's InputDevice section\n" -"# **********************************************************************\n" -"\n" -"Section \"InputDevice\"\n" -"\n" -"# Identifier and driver\n" -"\n" -#if defined(__UNIXWARE__) -"# Identifier \"Mouse1\"\n" -"# Driver \"mouse\"\n" -#else -" Identifier \"Mouse1\"\n" -" Driver \"mouse\"\n" -#endif -; - -static char *pointersection_text2 = -"\n" -"# Mouse-speed setting for PS/2 mouse.\n" -"\n" -"# Option \"Resolution\" \"256\"\n" -"\n" -"# Baudrate and SampleRate are only for some Logitech mice. In\n" -"# almost every case these lines should be omitted.\n" -"\n" -"# Option \"BaudRate\" \"9600\"\n" -"# Option \"SampleRate\" \"150\"\n" -"\n" -"# Mouse wheel mapping. Default is to map vertical wheel to buttons 4 & 5,\n" -"# horizontal wheel to buttons 6 & 7. Change if your mouse has more than\n" -"# 3 buttons and you need to map the wheel to different button ids to avoid\n" -"# conflicts.\n" -"\n" -" Option \"ZAxisMapping\" \"4 5 6 7\"\n" -"\n" -"# Emulate3Buttons is an option for 2-button mice\n" -"# Emulate3Timeout is the timeout in milliseconds (default is 50ms)\n" -"\n"; - - -static char *xinputsection_text = -"# **********************************************************************\n" -"# Other input device sections \n" -"# this is optional and is required only if you\n" -"# are using extended input devices. This is for example only. Refer\n" -"# to the " CONFIGNAME " man page for a description of the options.\n" -"# **********************************************************************\n" -"#\n" -"# Section \"InputDevice\" \n" -"# Identifier \"Mouse2\"\n" -"# Driver \"mouse\"\n" -"# Option \"Protocol\" \"MouseMan\"\n" -"# Option \"Device\" \"/dev/mouse2\"\n" -"# EndSection\n" -"#\n" -"# Section \"InputDevice\"\n" -"# Identifier \"spaceball\"\n" -"# Driver \"magellan\"\n" -"# Option \"Device\" \"/dev/cua0\"\n" -"# EndSection\n" -"#\n" -"# Section \"InputDevice\"\n" -"# Identifier \"spaceball2\"\n" -"# Driver \"spaceorb\"\n" -"# Option \"Device\" \"/dev/cua0\"\n" -"# EndSection\n" -"#\n" -"# Section \"InputDevice\"\n" -"# Identifier \"touchscreen0\"\n" -"# Driver \"microtouch\"\n" -"# Option \"Device\" \"/dev/ttyS0\"\n" -"# Option \"MinX\" \"1412\"\n" -"# Option \"MaxX\" \"15184\"\n" -"# Option \"MinY\" \"15372\"\n" -"# Option \"MaxY\" \"1230\"\n" -"# Option \"ScreenNumber\" \"0\"\n" -"# Option \"ReportingMode\" \"Scaled\"\n" -"# Option \"ButtonNumber\" \"1\"\n" -"# Option \"SendCoreEvents\"\n" -"# EndSection\n" -"#\n" -"# Section \"InputDevice\"\n" -"# Identifier \"touchscreen1\"\n" -"# Driver \"elo2300\"\n" -"# Option \"Device\" \"/dev/ttyS0\"\n" -"# Option \"MinX\" \"231\"\n" -"# Option \"MaxX\" \"3868\"\n" -"# Option \"MinY\" \"3858\"\n" -"# Option \"MaxY\" \"272\"\n" -"# Option \"ScreenNumber\" \"0\"\n" -"# Option \"ReportingMode\" \"Scaled\"\n" -"# Option \"ButtonThreshold\" \"17\"\n" -"# Option \"ButtonNumber\" \"1\"\n" -"# Option \"SendCoreEvents\"\n" -"# EndSection\n" -"\n"; - -static char *monitorsection_text1 = -"# **********************************************************************\n" -"# Monitor section\n" -"# **********************************************************************\n" -"\n" -"# Any number of monitor sections may be present\n" -"\n" -"Section \"Monitor\"\n" -"\n"; - -static char *monitorsection_text2 = -"# HorizSync is in kHz unless units are specified.\n" -"# HorizSync may be a comma separated list of discrete values, or a\n" -"# comma separated list of ranges of values.\n" -"# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S\n" -"# USER MANUAL FOR THE CORRECT NUMBERS.\n" -"\n"; - -static char *monitorsection_text3 = -"# HorizSync 30-64 # multisync\n" -"# HorizSync 31.5, 35.2 # multiple fixed sync frequencies\n" -"# HorizSync 15-25, 30-50 # multiple ranges of sync frequencies\n" -"\n" -"# VertRefresh is in Hz unless units are specified.\n" -"# VertRefresh may be a comma separated list of discrete values, or a\n" -"# comma separated list of ranges of values.\n" -"# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR\'S\n" -"# USER MANUAL FOR THE CORRECT NUMBERS.\n" -"\n"; - -#if 0 -static char *monitorsection_text4 = -"# Modes can be specified in two formats. A compact one-line format, or\n" -"# a multi-line format.\n" -"\n" -"# These two are equivalent\n" -"\n" -"# ModeLine \"1024x768i\" 45 1024 1048 1208 1264 768 776 784 817 Interlace\n" -"\n" -"# Mode \"1024x768i\"\n" -"# DotClock 45\n" -"# HTimings 1024 1048 1208 1264\n" -"# VTimings 768 776 784 817\n" -"# Flags \"Interlace\"\n" -"# EndMode\n" -"\n"; - -static char *modelines_text = -"# This is a set of standard mode timings. Modes that are out of monitor spec\n" -"# are automatically deleted by the server (provided the HorizSync and\n" -"# VertRefresh lines are correct), so there's no immediate need to\n" -"# delete mode timings (unless particular mode timings don't work on your\n" -"# monitor). With these modes, the best standard mode that your monitor\n" -"# and video card can support for a given resolution is automatically\n" -"# used.\n" -"\n" -"# 640x400 @ 70 Hz, 31.5 kHz hsync\n" -"Modeline \"640x400\" 25.175 640 664 760 800 400 409 411 450\n" -"# 640x480 @ 60 Hz, 31.5 kHz hsync\n" -"Modeline \"640x480\" 25.175 640 664 760 800 480 491 493 525\n" -"# 800x600 @ 56 Hz, 35.15 kHz hsync\n" -"ModeLine \"800x600\" 36 800 824 896 1024 600 601 603 625\n" -"# 1024x768 @ 87 Hz interlaced, 35.5 kHz hsync\n" -"Modeline \"1024x768\" 44.9 1024 1048 1208 1264 768 776 784 817 Interlace\n" -"\n" -"# 640x400 @ 85 Hz, 37.86 kHz hsync\n" -"Modeline \"640x400\" 31.5 640 672 736 832 400 401 404 445 -HSync +VSync\n" -"# 640x480 @ 72 Hz, 36.5 kHz hsync\n" -"Modeline \"640x480\" 31.5 640 680 720 864 480 488 491 521\n" -"# 640x480 @ 75 Hz, 37.50 kHz hsync\n" -"ModeLine \"640x480\" 31.5 640 656 720 840 480 481 484 500 -HSync -VSync\n" -"# 800x600 @ 60 Hz, 37.8 kHz hsync\n" -"Modeline \"800x600\" 40 800 840 968 1056 600 601 605 628 +hsync +vsync\n" -"\n" -"# 640x480 @ 85 Hz, 43.27 kHz hsync\n" -"Modeline \"640x480\" 36 640 696 752 832 480 481 484 509 -HSync -VSync\n" -"# 1152x864 @ 89 Hz interlaced, 44 kHz hsync\n" -"ModeLine \"1152x864\" 65 1152 1168 1384 1480 864 865 875 985 Interlace\n" -"\n" -"# 800x600 @ 72 Hz, 48.0 kHz hsync\n" -"Modeline \"800x600\" 50 800 856 976 1040 600 637 643 666 +hsync +vsync\n" -"# 1024x768 @ 60 Hz, 48.4 kHz hsync\n" -"Modeline \"1024x768\" 65 1024 1032 1176 1344 768 771 777 806 -hsync -vsync\n" -"\n" -"# 640x480 @ 100 Hz, 53.01 kHz hsync\n" -"Modeline \"640x480\" 45.8 640 672 768 864 480 488 494 530 -HSync -VSync\n" -"# 1152x864 @ 60 Hz, 53.5 kHz hsync\n" -"Modeline \"1152x864\" 89.9 1152 1216 1472 1680 864 868 876 892 -HSync -VSync\n" -"# 800x600 @ 85 Hz, 55.84 kHz hsync\n" -"Modeline \"800x600\" 60.75 800 864 928 1088 600 616 621 657 -HSync -VSync\n" -"\n" -"# 1024x768 @ 70 Hz, 56.5 kHz hsync\n" -"Modeline \"1024x768\" 75 1024 1048 1184 1328 768 771 777 806 -hsync -vsync\n" -"# 1280x1024 @ 87 Hz interlaced, 51 kHz hsync\n" -"Modeline \"1280x1024\" 80 1280 1296 1512 1568 1024 1025 1037 1165 Interlace\n" -"\n" -"# 800x600 @ 100 Hz, 64.02 kHz hsync\n" -"Modeline \"800x600\" 69.65 800 864 928 1088 600 604 610 640 -HSync -VSync\n" -"# 1024x768 @ 76 Hz, 62.5 kHz hsync\n" -"Modeline \"1024x768\" 85 1024 1032 1152 1360 768 784 787 823\n" -"# 1152x864 @ 70 Hz, 62.4 kHz hsync\n" -"Modeline \"1152x864\" 92 1152 1208 1368 1474 864 865 875 895\n" -"# 1280x1024 @ 61 Hz, 64.2 kHz hsync\n" -"Modeline \"1280x1024\" 110 1280 1328 1512 1712 1024 1025 1028 1054\n" -"\n" -"# 1024x768 @ 85 Hz, 70.24 kHz hsync\n" -"Modeline \"1024x768\" 98.9 1024 1056 1216 1408 768 782 788 822 -HSync -VSync\n" -"# 1152x864 @ 78 Hz, 70.8 kHz hsync\n" -"Modeline \"1152x864\" 110 1152 1240 1324 1552 864 864 876 908\n" -"\n" -"# 1280x1024 @ 70 Hz, 74.59 kHz hsync\n" -"Modeline \"1280x1024\" 126.5 1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync\n" -"# 1600x1200 @ 60Hz, 75.00 kHz hsync\n" -"Modeline \"1600x1200\" 162 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync\n" -"# 1152x864 @ 84 Hz, 76.0 kHz hsync\n" -"Modeline \"1152x864\" 135 1152 1464 1592 1776 864 864 876 908\n" -"\n" -"# 1280x1024 @ 74 Hz, 78.85 kHz hsync\n" -"Modeline \"1280x1024\" 135 1280 1312 1456 1712 1024 1027 1030 1064\n" -"\n" -"# 1024x768 @ 100Hz, 80.21 kHz hsync\n" -"Modeline \"1024x768\" 115.5 1024 1056 1248 1440 768 771 781 802 -HSync -VSync\n" -"# 1280x1024 @ 76 Hz, 81.13 kHz hsync\n" -"Modeline \"1280x1024\" 135 1280 1312 1416 1664 1024 1027 1030 1064\n" -"\n" -"# 1600x1200 @ 70 Hz, 87.50 kHz hsync\n" -"Modeline \"1600x1200\" 189 1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync\n" -"# 1152x864 @ 100 Hz, 89.62 kHz hsync\n" -"Modeline \"1152x864\" 137.65 1152 1184 1312 1536 864 866 885 902 -HSync -VSync\n" -"# 1280x1024 @ 85 Hz, 91.15 kHz hsync\n" -"Modeline \"1280x1024\" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync\n" -"# 1600x1200 @ 75 Hz, 93.75 kHz hsync\n" -"Modeline \"1600x1200\" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync\n" -"# 1600x1200 @ 85 Hz, 105.77 kHz hsync\n" -"Modeline \"1600x1200\" 220 1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync\n" -"# 1280x1024 @ 100 Hz, 107.16 kHz hsync\n" -"Modeline \"1280x1024\" 181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync\n" -"\n" -"# 1800x1440 @ 64Hz, 96.15 kHz hsync \n" -"ModeLine \"1800X1440\" 230 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync\n" -"# 1800x1440 @ 70Hz, 104.52 kHz hsync \n" -"ModeLine \"1800X1440\" 250 1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync\n" -"\n" -"# 512x384 @ 78 Hz, 31.50 kHz hsync\n" -"Modeline \"512x384\" 20.160 512 528 592 640 384 385 388 404 -HSync -VSync\n" -"# 512x384 @ 85 Hz, 34.38 kHz hsync\n" -"Modeline \"512x384\" 22 512 528 592 640 384 385 388 404 -HSync -VSync\n" -"\n" -#if XFREE86_VERSION >= 311 -"# Low-res Doublescan modes\n" -"# If your chipset does not support doublescan, you get a 'squashed'\n" -"# resolution like 320x400.\n" -"\n" -"# 320x200 @ 70 Hz, 31.5 kHz hsync, 8:5 aspect ratio\n" -"Modeline \"320x200\" 12.588 320 336 384 400 200 204 205 225 Doublescan\n" -"# 320x240 @ 60 Hz, 31.5 kHz hsync, 4:3 aspect ratio\n" -"Modeline \"320x240\" 12.588 320 336 384 400 240 245 246 262 Doublescan\n" -"# 320x240 @ 72 Hz, 36.5 kHz hsync\n" -"Modeline \"320x240\" 15.750 320 336 384 400 240 244 246 262 Doublescan\n" -"# 400x300 @ 56 Hz, 35.2 kHz hsync, 4:3 aspect ratio\n" -"ModeLine \"400x300\" 18 400 416 448 512 300 301 302 312 Doublescan\n" -"# 400x300 @ 60 Hz, 37.8 kHz hsync\n" -"Modeline \"400x300\" 20 400 416 480 528 300 301 303 314 Doublescan\n" -"# 400x300 @ 72 Hz, 48.0 kHz hsync\n" -"Modeline \"400x300\" 25 400 424 488 520 300 319 322 333 Doublescan\n" -"# 480x300 @ 56 Hz, 35.2 kHz hsync, 8:5 aspect ratio\n" -"ModeLine \"480x300\" 21.656 480 496 536 616 300 301 302 312 Doublescan\n" -"# 480x300 @ 60 Hz, 37.8 kHz hsync\n" -"Modeline \"480x300\" 23.890 480 496 576 632 300 301 303 314 Doublescan\n" -"# 480x300 @ 63 Hz, 39.6 kHz hsync\n" -"Modeline \"480x300\" 25 480 496 576 632 300 301 303 314 Doublescan\n" -"# 480x300 @ 72 Hz, 48.0 kHz hsync\n" -"Modeline \"480x300\" 29.952 480 504 584 624 300 319 322 333 Doublescan\n" -"\n" -#endif -; -#endif - -static char *devicesection_text = -"# **********************************************************************\n" -"# Graphics device section\n" -"# **********************************************************************\n" -"\n" -"# Any number of graphics device sections may be present\n" -"\n" -"# Standard VGA Device:\n" -"\n" -"Section \"Device\"\n" -" Identifier \"Standard VGA\"\n" -" VendorName \"Unknown\"\n" -" BoardName \"Unknown\"\n" -"\n" -"# The chipset line is optional in most cases. It can be used to override\n" -"# the driver's chipset detection, and should not normally be specified.\n" -"\n" -"# Chipset \"generic\"\n" -"\n" -"# The Driver line must be present. When using run-time loadable driver\n" -"# modules, this line instructs the server to load the specified driver\n" -"# module. Even when not using loadable driver modules, this line\n" -"# indicates which driver should interpret the information in this section.\n" -"\n" -" Driver \"vga\"\n" -"# The BusID line is used to specify which of possibly multiple devices\n" -"# this section is intended for. When this line isn't present, a device\n" -"# section can only match up with the primary video device. For PCI\n" -"# devices a line like the following could be used. This line should not\n" -"# normally be included unless there is more than one video device\n" -"# intalled.\n" -"\n" -"# BusID \"PCI:0:10:0\"\n" -"\n" -"# VideoRam 256\n" -"\n" -"# Clocks 25.2 28.3\n" -"\n" -"EndSection\n" -"\n" -"# Device configured by xorgconfig:\n" -"\n"; - -static char *screensection_text1 = -"# **********************************************************************\n" -"# Screen sections\n" -"# **********************************************************************\n" -"\n" -"# Any number of screen sections may be present. Each describes\n" -"# the configuration of a single screen. A single specific screen section\n" -"# may be specified from the X server command line with the \"-screen\"\n" -"# option.\n"; - -static char *serverlayout_section_text1 = -"# **********************************************************************\n" -"# ServerLayout sections.\n" -"# **********************************************************************\n" -"\n" -"# Any number of ServerLayout sections may be present. Each describes\n" -"# the way multiple screens are organised. A specific ServerLayout\n" -"# section may be specified from the X server command line with the\n" -"# \"-layout\" option. In the absence of this, the first section is used.\n" -"# When now ServerLayout section is present, the first Screen section\n" -"# is used alone.\n" -"\n" -"Section \"ServerLayout\"\n" -"\n" -"# The Identifier line must be present\n" -" Identifier \"Simple Layout\"\n" -"\n" -"# Each Screen line specifies a Screen section name, and optionally\n" -"# the relative position of other screens. The four names after\n" -"# primary screen name are the screens to the top, bottom, left and right\n" -"# of the primary screen. In this example, screen 2 is located to the\n" -"# right of screen 1.\n" -"\n"; - -static char *serverlayout_section_text2 = -"\n" -"# Each InputDevice line specifies an InputDevice section name and\n" -"# optionally some options to specify the way the device is to be\n" -"# used. Those options include \"CorePointer\", \"CoreKeyboard\" and\n" -"# \"SendCoreEvents\".\n" -"\n" -" InputDevice \"Mouse1\" \"CorePointer\"\n" -" InputDevice \"Keyboard1\" \"CoreKeyboard\"\n" -"\n" -"EndSection\n" -"\n" -"# Section \"DRI\"\n" -"# Mode 0666\n" -"# EndSection\n" -"\n"; - -static void -write_fontpath_section(FILE *f) -{ - /* this will create the Fontpath lines, but only after checking, - * that the corresponding dir exists (was THE absolute problem - * users had with XFree86/OS2 3.1.2D !) - */ - int i; - char cur[256+20],*colon, *hash; - -#ifdef COMPILEDDEFAULTFONTPATH - static const char dfp[] = COMPILEDDEFAULTFONTPATH; - const char *thisdir; - const char *nextdir; - int len; - - for (thisdir = dfp; thisdir != NULL; thisdir = nextdir) { - nextdir = strchr(thisdir, ','); - if (nextdir == NULL) { - len = strlen(thisdir); - } else { - len = nextdir - thisdir; - nextdir++; - } - if (len >= sizeof(cur)) - continue; - strncpy(cur, thisdir, len); - cur[len] = '\0'; - colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */ - if (colon) *colon = 0; - hash = exists_dir(cur) ? "" : "#"; - if (colon) *colon = ':'; - fprintf(f,"%s FontPath \"%s\"\n", hash, cur); - } -#endif - - for (i=0; XF86Config_fontpaths[i]; i++) { - strcpy(cur,TREEROOTFONT); - strcat(cur,XF86Config_fontpaths[i]); - /* remove a ':' */ - colon = strchr(cur+2,':'); /* OS/2: C:/...:scaled */ - if (colon) *colon = 0; -#ifdef COMPILEDDEFAULTFONTPATH - /* skip if we already added it as part of the default font path */ - if (strstr(dfp, cur) != NULL) - continue; -#endif - hash = exists_dir(cur) ? "" : "#"; - fprintf(f,"%s FontPath \"%s%s\"\n", - hash, - TREEROOTFONT, - XF86Config_fontpaths[i]); - } -} - -static int -write_XF86Config(char *filename) -{ - FILE *f; - - /* - * Write the file. - */ - - f = fopen(filename, "w"); - if (f == NULL) { - printf("Failed to open filename for writing.\n"); - if (getuid() != 0) - printf("Maybe you need to be root to write to the specified directory?\n"); - return(1); - } - - fprintf(f, "%s", XF86Config_firstchunk_text); - write_fontpath_section(f); - fprintf(f, "%s", XF86Config_fontpathchunk_text); - - /* - * Write keyboard section. - */ - if (config_altmeta) { - fprintf(f, " Option \"LeftAlt\" \"Meta\"\n"); - fprintf(f, " Option \"RightAlt\" \"ModeShift\"\n"); - } - else { - fprintf(f, "# Option \"LeftAlt\" \"Meta\"\n"); - fprintf(f, "# Option \"RightAlt\" \"ModeShift\"\n"); - } -#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT) && !defined(PCVT_SUPPORT) - /* wscons keyoards need a protocol line */ - fprintf(f, " Option \"Protocol\" \"wskbd\"\n"); - fprintf(f, " Option \"Device\" \"%s\"\n", config_keyboard_dev); - fprintf(f, " Option \"XkbKeycodes\" \"wscons(ppc)\"\n"); -#endif - fprintf(f, "%s", keyboardchunk2_text); - - fprintf(f, "%s", keyboardchunk3_text); - if (config_xkbdisable) { - fprintf(f, " Option \"XkbDisable\"\n\n"); - } else { - fprintf(f, "# Option \"XkbDisable\"\n\n"); - } - fprintf(f, " Option \"XkbRules\" \"%s\"\n", - config_xkbrules); - fprintf(f, " Option \"XkbModel\" \"%s\"\n", - config_xkbmodel); - fprintf(f, " Option \"XkbLayout\" \"%s\"\n", - config_xkblayout); - if (config_xkbvariant) - fprintf(f, " Option \"XkbVariant\" \"%s\"\n", - config_xkbvariant); - if (config_xkboptions) - fprintf(f, " Option \"XkbOptions\" \"%s\"\n", - config_xkboptions); - - fprintf(f, "%s",keyboardlastchunk_text); - - /* - * Write pointer section. - */ - fprintf(f, "%s", pointersection_text1); - fprintf(f, " Option \"Protocol\" \"%s\"\t# %s\n", - mouse_info[config_mousetype].name, - mouse_info[config_mousetype].desc); -#if !defined(QNX4) - fprintf(f, " Option \"Device\" \"%s\"\n", config_pointerdevice); -#endif - fprintf(f, "%s", pointersection_text2); - if (!config_emulate3buttons) - fprintf(f, "#"); - fprintf(f, " Option \"Emulate3Buttons\"\n"); - fprintf(f, "# Option \"Emulate3Timeout\" \"50\"\n\n"); - fprintf(f, "# ChordMiddle is an option for some 3-button Logitech mice\n\n"); - if (!config_chordmiddle) - fprintf(f, "#"); - fprintf(f, " Option \"ChordMiddle\"\n\n"); - if (config_cleardtrrts) { - fprintf(f, " Option \"ClearDTR\"\n"); - fprintf(f, " Option \"ClearRTS\"\n\n"); - } - fprintf(f, "EndSection\n\n\n"); - - /* - * Write XInput sample section - */ - fprintf(f, "%s", xinputsection_text); - - /* - * Write monitor section. - */ - fprintf(f, "%s", monitorsection_text1); - fprintf(f, " Identifier \"%s\"\n", config_monitoridentifier); - fprintf(f, "\n"); - fprintf(f, "%s", monitorsection_text2); - fprintf(f, " HorizSync %s\n", config_hsyncrange); - fprintf(f, "\n"); - fprintf(f, "%s", monitorsection_text3); - fprintf(f, " VertRefresh %s\n", config_vsyncrange); - fprintf(f, "\n"); -#if 0 - fprintf(f, "%s", monitorsection_text4); - fprintf(f, "%s", modelines_text); -#endif - fprintf(f, "EndSection\n\n\n"); - - /* - * Write Device section. - */ - - fprintf(f, "%s", devicesection_text); - fprintf(f, "Section \"Device\"\n"); - fprintf(f, " Identifier \"%s\"\n", config_deviceidentifier); - if (card_selected != -1) { - fprintf(f, " Driver \"%s\"\n", card[card_selected].driver); - if (card[card_selected].flags & UNSUPPORTED) { - fprintf(f, " # unsupported card\n"); - } - } else { - fprintf(f, " Driver \"vga\"\n" - " # unsupported card\n"); - } - /* Rely on server to detect video memory. */ - fprintf(f, " #VideoRam %d\n", config_videomemory); - if (card_selected != -1) - /* Add comment lines from card definition. */ - fprintf(f, card[card_selected].lines); - if (config_ramdac != NULL) - fprintf(f, " Ramdac \"%s\"\n", config_ramdac); - if (card_selected != -1) - if (card[card_selected].dacspeed != NULL) - fprintf(f, " Dacspeed %s\n", - card[card_selected].dacspeed); - if (config_clockchip != NULL) - fprintf(f, " Clockchip \"%s\"\n", config_clockchip); - else - if (config_numberofclockslines == 0) - fprintf(f, " # Insert Clocks lines here if appropriate\n"); - else { - int i; - for (i = 0; i < config_numberofclockslines; i++) - fprintf(f, " Clocks %s\n", config_clocksline[i]); - } - fprintf(f, "EndSection\n\n\n"); - - /* - * Write Screen sections. - */ - - fprintf(f, "%s", screensection_text1); - - fprintf(f, - "Section \"Screen\"\n" - " Identifier \"Screen 1\"\n" - " Device \"%s\"\n" - " Monitor \"%s\"\n" - " DefaultDepth %s\n" - "\n" - " Subsection \"Display\"\n" - " Depth 8\n" - " Modes %s\n" - " ViewPort 0 0\n", - config_deviceidentifier, - config_monitoridentifier, - config_depth, - config_modesline8bpp); - if (config_virtual) - fprintf(f, " Virtual %d %d\n", - config_virtualx8bpp, config_virtualy8bpp); - fprintf(f, - " EndSubsection\n" - " Subsection \"Display\"\n" - " Depth 16\n" - " Modes %s\n" - " ViewPort 0 0\n", - config_modesline16bpp); - if (config_virtual) - fprintf(f, " Virtual %d %d\n", - config_virtualx16bpp, config_virtualy16bpp); - fprintf(f, - " EndSubsection\n" - " Subsection \"Display\"\n" - " Depth 24\n" - " Modes %s\n" - " ViewPort 0 0\n", - config_modesline24bpp); - if (config_virtual) - fprintf(f, " Virtual %d %d\n", - config_virtualx24bpp, config_virtualy24bpp); - fprintf(f, - " EndSubsection\n" - "EndSection\n" - "\n"); - - /* - * ServerLayout section - */ - - fprintf(f, serverlayout_section_text1); - /* replace with screen config */ - fprintf(f, " Screen \"Screen 1\"\n"); - - fprintf(f, serverlayout_section_text2); - - fclose(f); - return(0); -} - -static char * -append_version(char *name) -{ -#ifdef APPEND_VERSION_TO_CONFIG_NAME - char *ret = NULL; - - if (XF86_VERSION_MAJOR > 9 || XF86_VERSION_MAJOR < 0) - return name; - - ret = Malloc(strlen(name) + 2 + 1); - sprintf(ret, "%s-%d", name, XF86_VERSION_MAJOR); - free(name); - return ret; -#else - return name; -#endif -} - -/* - * Ask where to write XF86Config to. Returns filename. - */ - -static char * -ask_XF86Config_location(void) { - char s[80]; - char *filename = NULL; - - printf( -"I am going to write the " CONFIGNAME " file now. Make sure you don't accidently\n" -"overwrite a previously configured one.\n\n"); - - if (getuid() == 0) { -#ifdef PREFER_XF86CONFIG_IN_ETC - filename = Strdup("/etc/X11/" XCONFIGFILE); - filename = append_version(filename); - printf("Shall I write it to %s? ", filename); - getstring(s); - printf("\n"); - if (answerisyes(s)) - return filename; -#endif - - if (filename) - free(filename); - filename = Strdup(TREEROOTCFG "/" XCONFIGFILE); - filename = append_version(filename); - printf("Please answer the following question with either 'y' or 'n'.\n"); - printf("Shall I write it to the default location, %s? ", filename); - getstring(s); - printf("\n"); - if (answerisyes(s)) - return filename; - -#ifndef PREFER_XF86CONFIG_IN_ETC - if (filename) - free(filename); - filename = Strdup("/etc/X11/" XCONFIGFILE); - filename = append_version(filename); - printf("Shall I write it to %s? ", filename); - getstring(s); - printf("\n"); - if (answerisyes(s)) - return filename; -#endif - } - - if (filename) - free(filename); - filename = Strdup(XCONFIGFILE); - filename = append_version(filename); - printf("Do you want it written to the current directory as '%s'? ", filename); - getstring(s); - printf("\n"); - if (answerisyes(s)) { - return filename; - } - - printf("Please give a filename to write to: "); - getstring(s); - printf("\n"); - if (filename) - free(filename); - filename = Strdup(s); - return filename; -} - - -/* - * Check if an earlier version of XFree86 is installed; warn about proper - * search path order in that case. - */ - -static char *notinstalled_text = -"The directory " TREEROOT " does not exist. This probably means that you have\n" -"not yet installed the version of "__XSERVERNAME__" that this program was built\n" -"to configure. Please install "__XSERVERNAME__" "XVERSIONSTRING" before running this program,\n" -"following the instructions in the INSTALL or README that comes with the\n" -__XSERVERNAME__" distribution for your OS.\n" -"For a minimal installation it is sufficient to only install base binaries,\n" -"libraries, configuration files and a server that you want to use.\n" -"\n"; - -static char *oldxfree86_text = -"The directory '/usr/X386/bin' exists. You probably have a very old version of\n" -"XFree86 installed, but this program was built to configure "__XSERVERNAME__" "XVERSIONSTRING"\n" -"installed in '" TREEROOT "' instead of '/usr/X386'.\n" -"\n" -"It is important that the directory '" TREEROOT "' is present in your\n" -"search path, *before* any occurrence of '/usr/X386/bin'. If you have installed\n" -"X program binaries that are not in the base "__XSERVERNAME__" distribution in\n" -"'/usr/X386/bin', you can keep the directory in your path as long as it is\n" -"after '" TREEROOT "'.\n" -"\n"; - -static char *pathnote_text = -"Note that the X binary directory in your path may be a symbolic link.\n" -"In that case you could modify the symbolic link to point to the new binaries.\n" -"Example: 'rm -f /usr/bin/X11; ln -s /usr/X11R6/bin /usr/bin/X11', if the\n" -"link is '/usr/bin/X11'.\n" -"\n" -"Make sure the path is OK before continuing.\n"; - -static void -path_check(void) { - char s[80]; - int ok; - - ok = exists_dir(TREEROOT); - if (!ok) { - printf("%s", notinstalled_text); - printf("Do you want to continue? "); - getstring(s); - if (!answerisyes(s)) - exit(-1); - printf("\n"); - } - - ok = exists_dir("/usr/X386/bin"); - if (!ok) - return; - - printf("%s", oldxfree86_text); - printf("Your PATH is currently set as follows:\n%s\n\n", - getenv("PATH")); - printf("%s", pathnote_text); - keypress(); -} - - -static void -configdir_check(void) -{ - /* /etc/X11 may not exist on some systems */ - if (getuid() == 0) { - struct stat buf; - if (stat("/etc/X11", &buf) == -1 && errno == ENOENT) - mkdir("/etc/X11", 0777); - if (stat(TREEROOTCFG, &buf) == -1 && errno == ENOENT) - mkdir(TREEROOTCFG, 0777); - } -} - - -/* - * Program entry point. - */ - -int -main(int argc, char *argv[]) { - - createtmpdir(); - - emptylines(); - - printf("%s", intro_text); - - keypress(); - emptylines(); - - path_check(); - - emptylines(); - - configdir_check(); - - emptylines(); - - mouse_configuration(); - - emptylines(); - - keyboard_configuration(); - - emptylines(); - - monitor_configuration(); - - emptylines(); - - carddb_configuration(); - - emptylines(); - - while(screen_configuration()){}; - - emptylines(); - - depth_configuration(); - - emptylines(); - - while(write_XF86Config(ask_XF86Config_location())){}; - - printf("%s", finalcomment_text); - - exit(0); -} diff --git a/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre b/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre deleted file mode 100644 index b3d656cfa..000000000 --- a/hw/xfree86/utils/xorgconfig/xorgconfig.man.pre +++ /dev/null @@ -1,22 +0,0 @@ -.\" $XdotOrg: $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xorgconfig.man,v 1.5 2001/11/01 23:35:34 dawes Exp $ -.TH xorgconfig 1 __vendorversion__ -.SH NAME -xorgconfig \- generate an __XCONFIGFILE__ file -.SH SYNOPSIS -.B xorgconfig -.SH DESCRIPTION -\fIxorgconfig\fP is an interactive program for generating an __XCONFIGFILE__ file -for use with __XSERVERNAME__ X servers. -.PP -Note that the default name used by \fIxorgconfig\fP for the __XCONFIGFILE__ file -is system-dependent. For instance, on OS/2, XConfig is used. -.SH FILES -.TP -.I __projectroot__/lib/X11/Cards -Video cards database -.SH "SEE ALSO" -__XSERVERNAME__(1), __XCONFIGFILE__(__filemansuffix__), xorgcfg(1), reconfig(1) -.SH AUTHOR -Harm Hanemaayer. -.\" $TOG: xf86conf.man /main/9 1997/07/19 10:53:08 kaleb $ diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c index 324de8ad8..a1eda76d7 100644 --- a/hw/xfree86/x86emu/ops2.c +++ b/hw/xfree86/x86emu/ops2.c @@ -40,6 +40,12 @@ #include "x86emu/x86emui.h" +#undef bswap_32 +#define bswap_32(x) (((x & 0xff000000) >> 24) | \ + ((x & 0x00ff0000) >> 8) | \ + ((x & 0x0000ff00) << 8) | \ + ((x & 0x000000ff) << 24)) + /*----------------------------- Implementation ----------------------------*/ /**************************************************************************** @@ -2571,6 +2577,47 @@ static void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2)) END_OF_INSTR(); } +/* Handles opcodes 0xc8-0xcf */ +static void x86emuOp2_bswap(u8 X86EMU_UNUSED(op2)) +{ + START_OF_INSTR(); + DECODE_PRINTF("BSWAP\n"); + TRACE_AND_STEP(); + + switch (op2) { + case 0xc8: + M.x86.R_EAX = bswap_32(M.x86.R_EAX); + break; + case 0xc9: + M.x86.R_ECX = bswap_32(M.x86.R_ECX); + break; + case 0xca: + M.x86.R_EDX = bswap_32(M.x86.R_EDX); + break; + case 0xcb: + M.x86.R_EBX = bswap_32(M.x86.R_EBX); + break; + case 0xcc: + M.x86.R_ESP = bswap_32(M.x86.R_ESP); + break; + case 0xcd: + M.x86.R_EBP = bswap_32(M.x86.R_EBP); + break; + case 0xce: + M.x86.R_ESI = bswap_32(M.x86.R_ESI); + break; + case 0xcf: + M.x86.R_EDI = bswap_32(M.x86.R_EDI); + break; + default: + /* can't happen */ + break; + } + + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + /*************************************************************************** * Double byte operation code table: **************************************************************************/ @@ -2788,14 +2835,14 @@ void (*x86emu_optab2[256])(u8) = /* 0xc5 */ x86emuOp2_illegal_op, /* 0xc6 */ x86emuOp2_illegal_op, /* 0xc7 */ x86emuOp2_illegal_op, -/* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */ -/* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */ +/* 0xc8 */ x86emuOp2_bswap, +/* 0xc9 */ x86emuOp2_bswap, +/* 0xca */ x86emuOp2_bswap, +/* 0xcb */ x86emuOp2_bswap, +/* 0xcc */ x86emuOp2_bswap, +/* 0xcd */ x86emuOp2_bswap, +/* 0xce */ x86emuOp2_bswap, +/* 0xcf */ x86emuOp2_bswap, /* 0xd0 */ x86emuOp2_illegal_op, /* 0xd1 */ x86emuOp2_illegal_op, diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c index 41968e1a7..4a6ac5deb 100644 --- a/hw/xfree86/x86emu/prim_ops.c +++ b/hw/xfree86/x86emu/prim_ops.c @@ -103,7 +103,7 @@ #include "x86emu/x86emui.h" #if defined(__GNUC__) -# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__) +# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__) # include "x86emu/prim_x86_gcc.h" # endif #endif diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h index 5a443cdbf..5530a3ada 100644 --- a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h +++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h @@ -42,7 +42,7 @@ #include "x86emu/types.h" -#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__)) +#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__)) #error This file is intended to be used by gcc on i386 or x86-64 system #endif diff --git a/hw/xfree86/x86emu/x86emu/types.h b/hw/xfree86/x86emu/x86emu/types.h index 2d41b0f18..c0c09c1b0 100644 --- a/hw/xfree86/x86emu/x86emu/types.h +++ b/hw/xfree86/x86emu/x86emu/types.h @@ -75,7 +75,7 @@ defined(__sparc64__) || \ defined(__s390x__) || \ (defined(__hppa__) && defined(__LP64)) || \ - defined(__amd64__) || defined(amd64) || defined(__x86_64__) || \ + defined(__amd64__) || defined(amd64) || \ (defined(__sgi) && (_MIPS_SZLONG == 64)) #define NUM32 int #else diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am index 58c8e885f..bd8267ad8 100644 --- a/hw/xfree86/xaa/Makefile.am +++ b/hw/xfree86/xaa/Makefile.am @@ -9,7 +9,9 @@ MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c POLYSEG = s-xaaLine.c s-xaaDashLine.c libxaa_la_LDFLAGS = -avoid-version +if COMPOSITE libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la +endif module_LTLIBRARIES = libxaa.la libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \ diff --git a/hw/xfree86/xf1bpp/Makefile.am b/hw/xfree86/xf1bpp/Makefile.am deleted file mode 100644 index c724f760f..000000000 --- a/hw/xfree86/xf1bpp/Makefile.am +++ /dev/null @@ -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) diff --git a/hw/xfree86/xf1bpp/mfbmap.h b/hw/xfree86/xf1bpp/mfbmap.h deleted file mode 100644 index e330ebd5b..000000000 --- a/hw/xfree86/xf1bpp/mfbmap.h +++ /dev/null @@ -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 diff --git a/hw/xfree86/xf1bpp/mfbmap.sh b/hw/xfree86/xf1bpp/mfbmap.sh deleted file mode 100644 index 514040776..000000000 --- a/hw/xfree86/xf1bpp/mfbmap.sh +++ /dev/null @@ -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" diff --git a/hw/xfree86/xf1bpp/mfbmodule.c b/hw/xfree86/xf1bpp/mfbmodule.c deleted file mode 100644 index ccd3572e5..000000000 --- a/hw/xfree86/xf1bpp/mfbmodule.c +++ /dev/null @@ -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 -#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 }; diff --git a/hw/xfree86/xf1bpp/mfbunmap.h b/hw/xfree86/xf1bpp/mfbunmap.h deleted file mode 100644 index 56b734bcd..000000000 --- a/hw/xfree86/xf1bpp/mfbunmap.h +++ /dev/null @@ -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 diff --git a/hw/xfree86/xf1bpp/mfbunmap.sh b/hw/xfree86/xf1bpp/mfbunmap.sh deleted file mode 100644 index 44dc781fc..000000000 --- a/hw/xfree86/xf1bpp/mfbunmap.sh +++ /dev/null @@ -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" diff --git a/hw/xfree86/xf1bpp/xf1bpp.h b/hw/xfree86/xf1bpp/xf1bpp.h deleted file mode 100644 index 33e5818c3..000000000 --- a/hw/xfree86/xf1bpp/xf1bpp.h +++ /dev/null @@ -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 diff --git a/hw/xfree86/xf4bpp/Makefile.am b/hw/xfree86/xf4bpp/Makefile.am deleted file mode 100644 index 1414a0d0f..000000000 --- a/hw/xfree86/xf4bpp/Makefile.am +++ /dev/null @@ -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) diff --git a/hw/xfree86/xf4bpp/NOTES b/hw/xfree86/xf4bpp/NOTES deleted file mode 100644 index e3b77dcfd..000000000 --- a/hw/xfree86/xf4bpp/NOTES +++ /dev/null @@ -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 $ diff --git a/hw/xfree86/xf4bpp/OScompiler.h b/hw/xfree86/xf4bpp/OScompiler.h deleted file mode 100644 index 8a8bbb59c..000000000 --- a/hw/xfree86/xf4bpp/OScompiler.h +++ /dev/null @@ -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 -#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__ */ diff --git a/hw/xfree86/xf4bpp/emulOpStip.c b/hw/xfree86/xf4bpp/emulOpStip.c deleted file mode 100644 index 542e9d394..000000000 --- a/hw/xfree86/xf4bpp/emulOpStip.c +++ /dev/null @@ -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 -#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; -} diff --git a/hw/xfree86/xf4bpp/emulRepAre.c b/hw/xfree86/xf4bpp/emulRepAre.c deleted file mode 100644 index 20fff1e0c..000000000 --- a/hw/xfree86/xf4bpp/emulRepAre.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/emulTile.c b/hw/xfree86/xf4bpp/emulTile.c deleted file mode 100644 index 2f2a758f2..000000000 --- a/hw/xfree86/xf4bpp/emulTile.c +++ /dev/null @@ -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 -#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 */ -} diff --git a/hw/xfree86/xf4bpp/ibmTrace.h b/hw/xfree86/xf4bpp/ibmTrace.h deleted file mode 100644 index f1d88406d..000000000 --- a/hw/xfree86/xf4bpp/ibmTrace.h +++ /dev/null @@ -1 +0,0 @@ -#define TRACE(x) /* empty */ diff --git a/hw/xfree86/xf4bpp/mfbbres.c b/hw/xfree86/xf4bpp/mfbbres.c deleted file mode 100644 index 09d7ee288..000000000 --- a/hw/xfree86/xf4bpp/mfbbres.c +++ /dev/null @@ -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 -#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 */ -} diff --git a/hw/xfree86/xf4bpp/mfbbresd.c b/hw/xfree86/xf4bpp/mfbbresd.c deleted file mode 100644 index 318d4f5da..000000000 --- a/hw/xfree86/xf4bpp/mfbbresd.c +++ /dev/null @@ -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 -#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; -} diff --git a/hw/xfree86/xf4bpp/mfbfillarc.c b/hw/xfree86/xf4bpp/mfbfillarc.c deleted file mode 100644 index 89aeadd2b..000000000 --- a/hw/xfree86/xf4bpp/mfbfillarc.c +++ /dev/null @@ -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 -#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); - } -} diff --git a/hw/xfree86/xf4bpp/mfbhrzvert.c b/hw/xfree86/xf4bpp/mfbhrzvert.c deleted file mode 100644 index 3444f48f5..000000000 --- a/hw/xfree86/xf4bpp/mfbhrzvert.c +++ /dev/null @@ -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 -#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); -} diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c deleted file mode 100644 index 4f9561161..000000000 --- a/hw/xfree86/xf4bpp/mfbimggblt.c +++ /dev/null @@ -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 -#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; imetrics.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 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; - } -} - diff --git a/hw/xfree86/xf4bpp/mfbline.c b/hw/xfree86/xf4bpp/mfbline.c deleted file mode 100644 index d2d4e0b0e..000000000 --- a/hw/xfree86/xf4bpp/mfbline.c +++ /dev/null @@ -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 -#endif - -#include - -#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 diff --git a/hw/xfree86/xf4bpp/mfbzerarc.c b/hw/xfree86/xf4bpp/mfbzerarc.c deleted file mode 100644 index 61fc7b184..000000000 --- a/hw/xfree86/xf4bpp/mfbzerarc.c +++ /dev/null @@ -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 -#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)); - } -} diff --git a/hw/xfree86/xf4bpp/offscreen.c b/hw/xfree86/xf4bpp/offscreen.c deleted file mode 100644 index 3160e7ef8..000000000 --- a/hw/xfree86/xf4bpp/offscreen.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcArea.c b/hw/xfree86/xf4bpp/ppcArea.c deleted file mode 100644 index df7856a35..000000000 --- a/hw/xfree86/xf4bpp/ppcArea.c +++ /dev/null @@ -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 -#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 ; -} - -} diff --git a/hw/xfree86/xf4bpp/ppcCReduce.c b/hw/xfree86/xf4bpp/ppcCReduce.c deleted file mode 100644 index c567e6fd1..000000000 --- a/hw/xfree86/xf4bpp/ppcCReduce.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcClip.c b/hw/xfree86/xf4bpp/ppcClip.c deleted file mode 100644 index 899dba683..000000000 --- a/hw/xfree86/xf4bpp/ppcClip.c +++ /dev/null @@ -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 -#endif - -#include - -#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; - } -} diff --git a/hw/xfree86/xf4bpp/ppcCpArea.c b/hw/xfree86/xf4bpp/ppcCpArea.c deleted file mode 100644 index 9bdaf89e3..000000000 --- a/hw/xfree86/xf4bpp/ppcCpArea.c +++ /dev/null @@ -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 -#endif - -#include - -#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; -} diff --git a/hw/xfree86/xf4bpp/ppcDepth.c b/hw/xfree86/xf4bpp/ppcDepth.c deleted file mode 100644 index 2fa19ff80..000000000 --- a/hw/xfree86/xf4bpp/ppcDepth.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcFillRct.c b/hw/xfree86/xf4bpp/ppcFillRct.c deleted file mode 100644 index 3422c8092..000000000 --- a/hw/xfree86/xf4bpp/ppcFillRct.c +++ /dev/null @@ -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 -#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); -} diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c deleted file mode 100644 index 7ef312d39..000000000 --- a/hw/xfree86/xf4bpp/ppcGC.c +++ /dev/null @@ -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 -#endif - -#include - -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcGCstr.h b/hw/xfree86/xf4bpp/ppcGCstr.h deleted file mode 100644 index 82d1f2df4..000000000 --- a/hw/xfree86/xf4bpp/ppcGCstr.h +++ /dev/null @@ -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 -#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 -); diff --git a/hw/xfree86/xf4bpp/ppcGetSp.c b/hw/xfree86/xf4bpp/ppcGetSp.c deleted file mode 100644 index d88abe02b..000000000 --- a/hw/xfree86/xf4bpp/ppcGetSp.c +++ /dev/null @@ -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 -#endif - -#include -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcIO.c b/hw/xfree86/xf4bpp/ppcIO.c deleted file mode 100644 index 83952d12d..000000000 --- a/hw/xfree86/xf4bpp/ppcIO.c +++ /dev/null @@ -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 -#endif - -#include - -#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; -} diff --git a/hw/xfree86/xf4bpp/ppcImg.c b/hw/xfree86/xf4bpp/ppcImg.c deleted file mode 100644 index 33c6b89c5..000000000 --- a/hw/xfree86/xf4bpp/ppcImg.c +++ /dev/null @@ -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 -#endif - -#include - -#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 ) ; -} diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c deleted file mode 100644 index 9fd29efce..000000000 --- a/hw/xfree86/xf4bpp/ppcPixFS.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcPixmap.c b/hw/xfree86/xf4bpp/ppcPixmap.c deleted file mode 100644 index d04aacf82..000000000 --- a/hw/xfree86/xf4bpp/ppcPixmap.c +++ /dev/null @@ -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 -#endif - -#include - -#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; -} diff --git a/hw/xfree86/xf4bpp/ppcPolyPnt.c b/hw/xfree86/xf4bpp/ppcPolyPnt.c deleted file mode 100644 index c61fd6d26..000000000 --- a/hw/xfree86/xf4bpp/ppcPolyPnt.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcQuery.c b/hw/xfree86/xf4bpp/ppcQuery.c deleted file mode 100644 index d42360da5..000000000 --- a/hw/xfree86/xf4bpp/ppcQuery.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcRslvC.c b/hw/xfree86/xf4bpp/ppcRslvC.c deleted file mode 100644 index 0337feb62..000000000 --- a/hw/xfree86/xf4bpp/ppcRslvC.c +++ /dev/null @@ -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 -#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 ); - } -} - diff --git a/hw/xfree86/xf4bpp/ppcSetSp.c b/hw/xfree86/xf4bpp/ppcSetSp.c deleted file mode 100644 index 7659384e7..000000000 --- a/hw/xfree86/xf4bpp/ppcSetSp.c +++ /dev/null @@ -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 -#endif - -#include - -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcSpMcro.h b/hw/xfree86/xf4bpp/ppcSpMcro.h deleted file mode 100644 index 655a883e5..000000000 --- a/hw/xfree86/xf4bpp/ppcSpMcro.h +++ /dev/null @@ -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); \ - } - diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c deleted file mode 100644 index 1522afd9e..000000000 --- a/hw/xfree86/xf4bpp/ppcWinFS.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/ppcWindow.c b/hw/xfree86/xf4bpp/ppcWindow.c deleted file mode 100644 index 6165e04b6..000000000 --- a/hw/xfree86/xf4bpp/ppcWindow.c +++ /dev/null @@ -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 -#endif - -#include - -#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; -} diff --git a/hw/xfree86/xf4bpp/vgaBitBlt.c b/hw/xfree86/xf4bpp/vgaBitBlt.c deleted file mode 100644 index 2e89f43b7..000000000 --- a/hw/xfree86/xf4bpp/vgaBitBlt.c +++ /dev/null @@ -1,749 +0,0 @@ -/* GJA -- span move routines */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#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 diff --git a/hw/xfree86/xf4bpp/vgaGC.c b/hw/xfree86/xf4bpp/vgaGC.c deleted file mode 100644 index 6495e5638..000000000 --- a/hw/xfree86/xf4bpp/vgaGC.c +++ /dev/null @@ -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 -#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; -} diff --git a/hw/xfree86/xf4bpp/vgaImages.c b/hw/xfree86/xf4bpp/vgaImages.c deleted file mode 100644 index bea2d0a17..000000000 --- a/hw/xfree86/xf4bpp/vgaImages.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/vgaReg.h b/hw/xfree86/xf4bpp/vgaReg.h deleted file mode 100644 index 32ec0daed..000000000 --- a/hw/xfree86/xf4bpp/vgaReg.h +++ /dev/null @@ -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 -#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 diff --git a/hw/xfree86/xf4bpp/vgaSolid.c b/hw/xfree86/xf4bpp/vgaSolid.c deleted file mode 100644 index 0ef18cfeb..000000000 --- a/hw/xfree86/xf4bpp/vgaSolid.c +++ /dev/null @@ -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 -#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 diff --git a/hw/xfree86/xf4bpp/vgaStipple.c b/hw/xfree86/xf4bpp/vgaStipple.c deleted file mode 100644 index 5ad53028c..000000000 --- a/hw/xfree86/xf4bpp/vgaStipple.c +++ /dev/null @@ -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 -#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 ; -} diff --git a/hw/xfree86/xf4bpp/vgaVideo.h b/hw/xfree86/xf4bpp/vgaVideo.h deleted file mode 100644 index 60afa5bb6..000000000 --- a/hw/xfree86/xf4bpp/vgaVideo.h +++ /dev/null @@ -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 -#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) ) - - diff --git a/hw/xfree86/xf4bpp/vgamodule.c b/hw/xfree86/xf4bpp/vgamodule.c deleted file mode 100644 index e7324914b..000000000 --- a/hw/xfree86/xf4bpp/vgamodule.c +++ /dev/null @@ -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 -#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); -} diff --git a/hw/xfree86/xf4bpp/wm3.c b/hw/xfree86/xf4bpp/wm3.c deleted file mode 100644 index 3a57221f2..000000000 --- a/hw/xfree86/xf4bpp/wm3.c +++ /dev/null @@ -1,203 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#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. - */ diff --git a/hw/xfree86/xf4bpp/wm3.h b/hw/xfree86/xf4bpp/wm3.h deleted file mode 100644 index 113723283..000000000 --- a/hw/xfree86/xf4bpp/wm3.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#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); } diff --git a/hw/xfree86/xf4bpp/xf4bpp.h b/hw/xfree86/xf4bpp/xf4bpp.h deleted file mode 100644 index cf0822444..000000000 --- a/hw/xfree86/xf4bpp/xf4bpp.h +++ /dev/null @@ -1,622 +0,0 @@ - -#ifndef __XF4BPP_H__ -#define __XF4BPP_H__ - - -#include "windowstr.h" -#include "gcstruct.h" -#include "colormapst.h" -#include -#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__ */ diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index c6c9c59ab..1f90b240c 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -202,6 +202,12 @@ static void message_kit_thread (SEL selector, NSObject *arg) { for_appkit = YES; for_x = YES; +// fprintf(stderr, "fd_add_count: %d\n", fd_add_count); + if(fd_add_count) { + DarwinProcessFDAdditionQueue(); + fprintf(stderr, "ran it - fd_add_count: %d\n", fd_add_count); + } + switch (type) { case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 911aac7de..900ee4387 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -79,6 +79,11 @@ void QuartzModeEQInit(void); static int old_flags = 0; // last known modifier state +#define FD_ADD_MAX 128 +static int fd_add[FD_ADD_MAX]; +int fd_add_count = 0; +static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER; + static xEvent *darwinEvents = NULL; static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER; @@ -232,15 +237,6 @@ static void DarwinSimulateMouseClick( DarwinUpdateModifiers(KeyPress, modifierMask); } -static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { - size_t i; - TA_SERVER(); - - for (i=0; iretval = EXIT_FAILURE; pthread_cond_broadcast(&data->cond); @@ -211,7 +215,7 @@ static void socket_handoff_thread(void *arg) { pthread_mutex_unlock(&data->lock); if(connect(handoff_fd, servaddr, servaddr_len) < 0) { - fprintf(stderr, "Failed to connect to socket: %s - %s\n", filename, strerror(errno)); + fprintf(stderr, "X11.app: Failed to connect to socket: %s - %d - %s\n", filename, errno, strerror(errno)); return; } @@ -224,6 +228,10 @@ static void socket_handoff_thread(void *arg) { kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) { handoff_data_t handoff_data; +#ifdef DEBUG + fprintf(stderr, "X11.app: Prepping for fd handoff.\n"); +#endif + /* Initialize our data */ pthread_mutex_init(&handoff_data.lock, NULL); pthread_cond_init(&handoff_data.cond, NULL); @@ -233,6 +241,10 @@ kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) { create_thread(socket_handoff_thread, &handoff_data); +#ifdef DEBUG + fprintf(stderr, "X11.app: Thread created for handoff. Waiting on return value.\n"); +#endif + /* Wait for our return value */ pthread_cond_wait(&handoff_data.cond, &handoff_data.lock); pthread_mutex_unlock(&handoff_data.lock); @@ -240,6 +252,10 @@ kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) { /* Cleanup */ pthread_cond_destroy(&handoff_data.cond); pthread_mutex_destroy(&handoff_data.lock); + +#ifdef DEBUG + fprintf(stderr, "X11.app: Sending return value: %d\n", handoff_data.retval); +#endif return handoff_data.retval; } @@ -359,6 +375,9 @@ int main(int argc, char **argv, char **envp) { mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE; mach_port_t mp; kern_return_t kr; + + // The server must not run the PanoramiX operations. + noPanoramiXExtension = TRUE; fprintf(stderr, "X11.app: main(): argc=%d\n", argc); for(i=1; i < argc; i++) { diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index d7b248b15..9928aa9ae 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -57,6 +57,8 @@ #define XSERVER_VERSION "?" #endif +#define DEBUG 1 + static char x11_path[PATH_MAX + 1]; static void set_x11_path() { @@ -132,23 +134,27 @@ static int create_socket(char *filename_out) { servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out); ret_fd = socket(PF_UNIX, SOCK_STREAM, 0); - if(ret_fd == 0) { - fprintf(stderr, "Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno)); + if(ret_fd == -1) { + fprintf(stderr, "Xquartz: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno)); continue; } if(bind(ret_fd, servaddr, servaddr_len) != 0) { - fprintf(stderr, "Failed to bind socket: %s - %s\n", filename_out, strerror(errno)); + fprintf(stderr, "Xquartz: Failed to bind socket: %d - %s\n", errno, strerror(errno)); close(ret_fd); return 0; } if(listen(ret_fd, 10) != 0) { - fprintf(stderr, "Failed to listen to socket: %s - %s\n", filename_out, strerror(errno)); + fprintf(stderr, "Xquartz: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno)); close(ret_fd); return 0; } - + +#ifdef DEBUG + fprintf(stderr, "Xquartz: Listening on socket for fd handoff: %s\n", filename_out); +#endif + return ret_fd; } @@ -186,19 +192,30 @@ static void send_fd_handoff(int handoff_fd, int launchd_fd) { *((int*)CMSG_DATA(cmsg)) = launchd_fd; +#ifdef DEBUG + fprintf(stderr, "Xquartz: Waiting for fd handoff connection.\n"); +#endif connected_fd = accept(handoff_fd, NULL, NULL); if(connected_fd == -1) { - fprintf(stderr, "Failed to accept incoming connection on socket: %s\n", strerror(errno)); + fprintf(stderr, "Xquartz: Failed to accept incoming connection on socket: %s\n", strerror(errno)); return; } +#ifdef DEBUG + fprintf(stderr, "Xquartz: Handoff connection established. Sending message.\n"); +#endif if(sendmsg(connected_fd, &msg, 0) < 0) { - fprintf(stderr, "Error sending $DISPLAY file descriptor: %s\n", strerror(errno)); + fprintf(stderr, "Xquartz: Error sending $DISPLAY file descriptor: %s\n", strerror(errno)); return; } +#ifdef DEBUG + fprintf(stderr, "Xquartz: Message sent. Closing.\n"); +#endif close(connected_fd); - fprintf(stderr, "send %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno)); +#ifdef DEBUG + fprintf(stderr, "Xquartz: end of send debug: %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno)); +#endif } int main(int argc, char **argv, char **envp) { diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c index aafaa26ef..f4ceff32b 100644 --- a/hw/xquartz/pseudoramiX.c +++ b/hw/xquartz/pseudoramiX.c @@ -46,7 +46,6 @@ Equipment Corporation. #include "globals.h" Bool noPseudoramiXExtension = FALSE; -extern int noPanoramiXExtension; extern int ProcPanoramiXQueryVersion (ClientPtr client); @@ -131,9 +130,6 @@ void PseudoramiXExtensionInit(int argc, char *argv[]) } #endif - // The server must not run the PanoramiX operations. - noPanoramiXExtension = TRUE; - if (pseudoramiXGeneration != serverGeneration) { extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0, ProcPseudoramiXDispatch, diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m index 2890d34f1..0ab94936c 100644 --- a/hw/xquartz/quartzCocoa.m +++ b/hw/xquartz/quartzCocoa.m @@ -44,10 +44,6 @@ #include "darwin.h" -extern void FatalError(const char *, ...); -extern char *display; -extern int noPanoramiXExtension; - /* * QuartzWriteCocoaPasteboard * Write text to the Mac OS X pasteboard. diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index 5b8d32dae..5e7a13c03 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -891,6 +891,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) { #ifdef XQUARTZ_USE_XKB XkbComponentNamesRec names; bzero(&names, sizeof(names)); + /* We need to really have rules... or something... */ XkbSetRulesDflts("base", "pc105", "us", NULL, NULL); assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap, QuartzBell, DarwinChangeKeyboardControl)); @@ -1086,14 +1087,25 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev) return 1; } +/* TODO: Not thread safe */ unsigned int QuartzSystemKeymapSeed(void) { - static unsigned int seed; - static KeyboardLayoutRef last_key_layout; - KeyboardLayoutRef key_layout; + static unsigned int seed = 0; + static TISInputSourceRef last_key_layout = NULL; + TISInputSourceRef key_layout; - KLGetCurrentKeyboardLayout (&key_layout); - if (key_layout != last_key_layout) seed++; - last_key_layout = key_layout; + key_layout = TISCopyCurrentKeyboardLayoutInputSource(); + + if(last_key_layout) { + if (CFEqual(key_layout, last_key_layout)) { + CFRelease(key_layout); + } else { + seed++; + CFRelease(last_key_layout); + last_key_layout = key_layout; + } + } else { + last_key_layout = key_layout; + } return seed; } @@ -1136,7 +1148,6 @@ static KeySym make_dead_key(KeySym in) { } Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { - KeyboardLayoutRef key_layout; const void *chr_data = NULL; int num_keycodes = NUM_KEYCODES; UInt32 keyboard_type = 0; @@ -1150,18 +1161,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData); if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef); } - - if (chr_data == NULL) { - KLGetCurrentKeyboardLayout (&key_layout); - KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data); - } - - if (chr_data == NULL) { - KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data); - is_uchr = 0; - num_keycodes = 128; - } - + if (chr_data == NULL) { ErrorF ( "Couldn't get uchr or kchr resource\n"); return FALSE; diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c index 968cde870..ba92ecef6 100644 --- a/hw/xquartz/quartzStartup.c +++ b/hw/xquartz/quartzStartup.c @@ -37,7 +37,6 @@ #include #include #include "quartzCommon.h" -#include "quartzForeground.h" #include "X11Controller.h" #include "darwin.h" #include "darwinEvents.h" diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c index 6a850cd44..550c5a04e 100644 --- a/hw/xwin/InitInput.c +++ b/hw/xwin/InitInput.c @@ -30,9 +30,6 @@ #include #endif #include "win.h" -#ifdef XWIN_CLIPBOARD -# include "../../Xext/xf86miscproc.h" -#endif #include "dixstruct.h" diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am index a88528901..00d425544 100644 --- a/hw/xwin/Makefile.am +++ b/hw/xwin/Makefile.am @@ -46,7 +46,6 @@ SRCS_NATIVEGDI = \ winnativegdi.c \ winpixmap.c \ winpolyline.c \ - winpushpxl.c \ winrop.c \ winsetsp.c DEFS_NATIVEGDI = -DXWIN_NATIVEGDI @@ -168,10 +167,10 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ dist_man1_MANS = XWin.man XWinrc.man GLX_EXTRAS = \ - windows/ChangeLog \ - windows/glwindows.h \ - windows/glwrap.c \ - windows/indirect.c + glx/ChangeLog \ + glx/glwindows.h \ + glx/glwrap.c \ + glx/indirect.c EXTRA_DIST = \ $(GLX_EXTRAS) \ diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c index 107d87aef..1f3775263 100644 --- a/hw/xwin/wingc.c +++ b/hw/xwin/wingc.c @@ -119,7 +119,7 @@ const GCOps winGCOps = { miImageGlyphBlt, miPolyGlyphBlt, #endif - winPushPixels + miPushPixels, }; diff --git a/hw/xwin/winpushpxl.c b/hw/xwin/winpushpxl.c deleted file mode 100644 index 72ef2d559..000000000 --- a/hw/xwin/winpushpxl.c +++ /dev/null @@ -1,225 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_XWIN_CONFIG_H -#include -#endif -#include -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "miscstruct.h" -#include "../mfb/maskbits.h" -#include "mi.h" - -#define NPT 128 - -/* winPushPixels -- squeegees the fill style of pGC through pBitMap - * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may - * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit - * is set in the bitmap, the fill style is put onto the drawable using - * the GC's logical function. The drawable is not changed where the bitmap - * has a zero bit or outside the area covered by the stencil. - -WARNING: - this code works if the 1-bit deep pixmap format returned by GetSpans -is the same as the format defined by the mfb code (i.e. 32-bit padding -per scanline, scanline unit = 32 bits; later, this might mean -bitsizeof(int) padding and sacnline unit == bitsizeof(int).) - - */ - -/* - * in order to have both (MSB_FIRST and LSB_FIRST) versions of this - * in the server, we need to rename one of them - */ -void -winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, - int dx, int dy, int xOrg, int yOrg) -{ - int h, dxDivPPW, ibEnd; - MiBits *pwLineStart; - register MiBits *pw, *pwEnd; - register MiBits msk; - register int ib, w; - register int ipt; /* index into above arrays */ - Bool fInBox; - DDXPointRec pt[NPT], ptThisLine; - int width[NPT]; - PixelType startmask; - - - startmask = (MiBits)(-1) ^ - LONG2CHARSDIFFORDER((MiBits)(-1) >> 1); - - pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx)); - if (!pwLineStart) - return; - ipt = 0; - dxDivPPW = dx/PPW; - - for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0; - h < dy; - h++, ptThisLine.y++) - { - - (*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx, - &ptThisLine, &dx, 1, (char *)pwLineStart); - - pw = pwLineStart; - /* Process all words which are fully in the pixmap */ - - fInBox = FALSE; - pwEnd = pwLineStart + dxDivPPW; - while(pw < pwEnd) - { - w = *pw; -#ifdef XFree86Server - msk = startmask; -#else - msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1); -#endif - for(ib = 0; ib < PPW; ib++) - { - if(w & msk) - { - if(!fInBox) - { - pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; - pt[ipt].y = h + yOrg; - /* start new box */ - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - width[ipt] = ((pw - pwLineStart) << PWSH) + - ib + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, - NPT, pt, width, TRUE); - ipt = 0; - } - /* end box */ - fInBox = FALSE; - } - } -#ifdef XFree86Server - /* This is not quite right, but it'll do for now */ - msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); -#else - msk = SCRRIGHT(msk, 1); -#endif - } - pw++; - } - ibEnd = dx & PIM; - if(ibEnd) - { - /* Process final partial word on line */ - w = *pw; -#ifdef XFree86Server - msk = startmask; -#else - msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1); -#endif - for(ib = 0; ib < ibEnd; ib++) - { - if(w & msk) - { - if(!fInBox) - { - /* start new box */ - pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; - pt[ipt].y = h + yOrg; - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - /* end box */ - width[ipt] = ((pw - pwLineStart) << PWSH) + - ib + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, - pGC, NPT, pt, width, TRUE); - ipt = 0; - } - fInBox = FALSE; - } - } -#ifdef XFree86Server - /* This is not quite right, but it'll do for now */ - msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); -#else - msk = SCRRIGHT(msk, 1); -#endif - } - } - /* If scanline ended with last bit set, end the box */ - if(fInBox) - { - width[ipt] = dx + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); - ipt = 0; - } - } - } - xfree(pwLineStart); - /* Flush any remaining spans */ - if (ipt) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE); - } -} diff --git a/include/Makefile.am b/include/Makefile.am index 7d5fee70b..76c265e79 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -35,6 +35,7 @@ sdk_HEADERS = \ privates.h \ property.h \ propertyst.h \ + ptrveloc.h \ region.h \ regionstr.h \ registry.h \ @@ -50,12 +51,12 @@ sdk_HEADERS = \ validate.h \ window.h \ windowstr.h \ + xkbfile.h \ xkbsrv.h \ - xkbstr.h \ - xorg-server.h + xkbstr.h + +nodist_sdk_HEADERS = xorg-server.h endif AM_CFLAGS = $(DIX_CFLAGS) -EXTRA_DIST = $(sdk_HEADERS) do-not-use-config.h dix-config.h xorg-config.h \ - xkb-config.h xkbfile.h diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 0c515c561..6400b695e 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -27,29 +27,12 @@ /* Support Composite Extension */ #undef COMPOSITE -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - /* Support Damage extension */ #undef DAMAGE /* Build for darwin with Quartz support */ #undef DARWIN_WITH_QUARTZ -/* Use OsVendorInit */ -#undef DDXOSINIT - -/* Use GetTimeInMillis */ -#undef DDXTIME - -/* Use OsVendorFatalError */ -#undef DDXOSFATALERROR - /* Use OsVendorVErrorF */ #undef DDXOSVERRORF @@ -68,9 +51,6 @@ /* Path to DRI drivers */ #undef DRI_DRIVER_PATH -/* Include handhelds.org h3600 touchscreen driver */ -#undef H3600_TS - /* Support XDM-AUTH*-1 */ #undef HASXDMAUTH @@ -92,13 +72,6 @@ /* Support SHM */ #undef HAS_SHM -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - /* Define to 1 if you have the header file. */ #undef HAVE_ASM_MTRR_H @@ -130,12 +103,6 @@ /* Define to 1 if you have the `getisax' function. */ #undef HAVE_GETISAX -/* Define to 1 if you have the `getopt' function. */ -#undef HAVE_GETOPT - -/* Define to 1 if you have the `getopt_long' function. */ -#undef HAVE_GETOPT_LONG - /* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID @@ -166,18 +133,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FB_H -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_H3600_TS_H - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - /* Define to 1 if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP @@ -202,9 +157,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* Define to 1 if you have the `strcasestr' function. */ -#undef HAVE_STRCASESTR - /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR @@ -297,26 +249,12 @@ /* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */ #undef SECURE_RPC -/* Use a lock to prevent multiple servers on a display */ -#undef SERVER_LOCK - /* Support SHAPE extension */ #undef SHAPE /* Include time-based scheduler */ #undef SMART_SCHEDULE -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - /* Define to 1 on systems derived from System V Release 4 */ #undef SVR4 @@ -362,9 +300,6 @@ /* Build XFree86 BigFont extension */ #undef XF86BIGFONT -/* Support XFree86 miscellaneous extensions */ -#undef XF86MISC - /* Support XFree86 Video Mode extension */ #undef XF86VIDMODE @@ -401,18 +336,12 @@ /* Build XvMC Extension */ #undef XvMCExtension -/* Build XRes extension */ -#undef XResExtension - /* Support XSync extension */ #undef XSYNC /* Support XTest extension */ #undef XTEST -/* Support XTrap extension */ -#undef XTRAP - /* Support Xv extension */ #undef XV @@ -465,12 +394,12 @@ /* Define to 1 if `struct sockaddr_in' has a `sin_len' member */ #undef BSD44SOCKETS -/* Define to 1 if modules should avoid the libcwrapper */ -#undef NO_LIBCWRAPPER - /* Support D-Bus */ #undef HAVE_DBUS +/* Use D-Bus for input hotplug */ +#undef CONFIG_NEED_DBUS + /* Support the D-Bus hotplug API */ #undef CONFIG_DBUS_API @@ -480,9 +409,6 @@ /* Use only built-in fonts */ #undef BUILTIN_FONTS -/* Avoid using font servers */ -#undef NOFONTSERVERACCESS - /* Use an empty root cursor */ #undef NULL_ROOT_CURSOR @@ -501,4 +427,13 @@ /* Define to 64-bit byteswap macro */ #undef bswap_64 +/* Need the strcasecmp function. */ +#undef NEED_STRCASECMP + +/* Need the strncasecmp function. */ +#undef NEED_STRNCASECMP + +/* Need the strcasestr function. */ +#undef NEED_STRCASESTR + #endif /* _DIX_CONFIG_H_ */ diff --git a/include/dix.h b/include/dix.h index 300718dd9..fcb24888b 100644 --- a/include/dix.h +++ b/include/dix.h @@ -601,7 +601,17 @@ typedef struct { /* strcasecmp.c */ #if NEED_STRCASECMP #define strcasecmp xstrcasecmp -extern int xstrcasecmp(char *s1, char *s2); +extern int xstrcasecmp(const char *s1, const char *s2); +#endif + +#if NEED_STRNCASECMP +#define strncasecmp xstrncasecmp +extern int xstrncasecmp(const char *s1, const char *s2, size_t n); +#endif + +#if NEED_STRCASESTR +#define strcasestr xstrcasestr +extern char *xstrcasestr(const char *s, const char *find); #endif extern int XItoCoreType(int xi_type); diff --git a/include/dixfont.h b/include/dixfont.h index 516d91b58..d61dd7e9e 100644 --- a/include/dixfont.h +++ b/include/dixfont.h @@ -33,10 +33,6 @@ SOFTWARE. typedef struct _DIXFontProp *DIXFontPropPtr; -extern FPEFunctions *fpe_functions; - -extern int FontToXError(int /*err*/); - extern Bool SetDefaultFont(char * /*defaultfontname*/); extern void QueueFontWakeup(FontPathElementPtr /*fpe*/); @@ -110,12 +106,6 @@ extern int GetFontPath(ClientPtr client, int *length, unsigned char **result); -extern int LoadGlyphs(ClientPtr /*client*/, - FontPtr /*pfont*/, - unsigned /*nchars*/, - int /*item_size*/, - unsigned char * /*data*/); - extern void DeleteClientFontStuff(ClientPtr /*client*/); /* Quartz support on Mac OS X pulls in the QuickDraw diff --git a/include/exevents.h b/include/exevents.h index 664e236dc..b42a90420 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -188,10 +188,73 @@ extern int DeviceEventSuppressForWindow( Mask /* mask */, int /* maskndx */); -void SendEventToAllWindows( +extern void SendEventToAllWindows( DeviceIntPtr /* dev */, Mask /* mask */, xEvent * /* ev */, int /* count */); +/* Input device properties */ +extern void XIDeleteAllDeviceProperties( + DeviceIntPtr /* device */ +); + +extern int XIDeleteDeviceProperty( + DeviceIntPtr /* device */, + Atom /* property */, + Bool /* fromClient */ +); + +extern int XIChangeDeviceProperty( + DeviceIntPtr /* dev */, + Atom /* property */, + Atom /* type */, + int /* format*/, + int /* mode*/, + unsigned long /* len*/, + pointer /* value*/, + Bool /* sendevent*/, + Bool /* pending*/, + Bool /* fromClient */ + ); + +extern XIPropertyPtr XIQueryDeviceProperty( + DeviceIntPtr /* dev */, + Atom /* property */ +); + +extern XIPropertyValuePtr XIGetDeviceProperty( + DeviceIntPtr /* dev */, + Atom /* property */, + Bool /* pending */ +); + +extern int XIConfigureDeviceProperty( + DeviceIntPtr /* dev */, + Atom /* property */, + Bool /* pending */, + Bool /* range */, + Bool /* immutable */, + int /* num_values */, + INT32* /* values */ +); + +extern long XIRegisterPropertyHandler( + DeviceIntPtr dev, + Bool (*SetProperty) (DeviceIntPtr dev, + Atom property, + XIPropertyValuePtr prop), + Bool (*GetProperty) (DeviceIntPtr dev, + Atom property) +); + +extern void XIUnRegisterPropertyHandler( + DeviceIntPtr dev, + long id +); + +extern Atom XIGetKnownProperty( + char* name +); + #endif /* EXEVENTS_H */ diff --git a/include/globals.h b/include/globals.h index 0aba78ae1..d9f140ec7 100644 --- a/include/globals.h +++ b/include/globals.h @@ -65,10 +65,6 @@ extern Bool noDbeExtension; extern Bool noDPMSExtension; #endif -#ifdef FONTCACHE -extern Bool noFontCacheExtension; -#endif - #ifdef GLXEXT extern Bool noGlxExtension; #endif @@ -129,10 +125,6 @@ extern Bool noXFree86DGAExtension; extern Bool noXFree86DRIExtension; #endif -#ifdef XF86MISC -extern Bool noXFree86MiscExtension; -#endif - #ifdef XF86VIDMODE extern Bool noXFree86VidModeExtension; #endif diff --git a/include/input.h b/include/input.h index 59f4e7f95..ba4492839 100644 --- a/include/input.h +++ b/include/input.h @@ -63,6 +63,12 @@ SOFTWARE. #define POINTER_ABSOLUTE (1 << 2) #define POINTER_ACCELERATE (1 << 3) +/*int constants for pointer acceleration schemes*/ +#define PtrAccelNoOp 0 +#define PtrAccelPredictable 1 +#define PtrAccelClassic 2 +#define PtrAccelDefault PtrAccelPredictable + #define MAX_VALUATORS 36 /* XXX from comment in dix/getevents.c */ #define NO_AXIS_LIMITS -1 @@ -155,6 +161,17 @@ typedef void (*DeviceUnwrapProc)( void* /*data*/ ); +/* pointer acceleration handling */ +typedef void (*PointerAccelSchemeProc)( + DeviceIntPtr /*pDev*/, + int /*first_valuator*/, + int /*num_valuators*/, + int* /*valuators*/, + int /*evtime*/); + +typedef void (*DeviceCallbackProc)( + DeviceIntPtr /*pDev*/); + typedef struct _DeviceRec { pointer devicePrivate; ProcessInputProc processInputProc; /* current */ @@ -280,6 +297,10 @@ extern Bool InitValuatorClassDeviceStruct( int /*numMotionEvents*/, int /*mode*/); +extern Bool InitPointerAccelerationScheme( + DeviceIntPtr /*dev*/, + int /*scheme*/); + extern Bool InitAbsoluteClassDeviceStruct( DeviceIntPtr /*device*/); diff --git a/include/inputstr.h b/include/inputstr.h index 7209b2cb3..3f5c76870 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -57,13 +57,16 @@ SOFTWARE. #include "privates.h" #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))) +/* If byte[i] in src is non-zero, set bit i in dst, otherwise set bit to 0 */ +#define SetBitIf(dst, src, i) \ + (src[i]) ? (dst[i/8] |= (1 << (i % 8))) : (dst[i/8] &= ~(1 << (i % 8))); #define SameClient(obj,client) \ (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) #define MAX_DEVICES 20 -#define EMASKSIZE MAX_DEVICES +#define EMASKSIZE MAX_DEVICES + 1 extern DevPrivateKey CoreDevicePrivateKey; @@ -163,6 +166,13 @@ typedef struct _AxisInfo { int max_value; } AxisInfo, *AxisInfoPtr; +typedef struct _ValuatorAccelerationRec { + int number; + PointerAccelSchemeProc AccelSchemeProc; + void *accelData; /* at disposal of AccelScheme */ + DeviceCallbackProc AccelCleanupProc; +} ValuatorAccelerationRec, *ValuatorAccelerationPtr; + typedef struct _ValuatorClassRec { int numMotionEvents; int first_motion; @@ -174,8 +184,8 @@ typedef struct _ValuatorClassRec { AxisInfoPtr axes; unsigned short numAxes; int *axisVal; /* always absolute, but device-coord system */ - float dxremaind, dyremaind; /* for acceleration */ CARD8 mode; + ValuatorAccelerationRec accelScheme; } ValuatorClassRec, *ValuatorClassPtr; typedef struct _ButtonClassRec { @@ -183,7 +193,7 @@ typedef struct _ButtonClassRec { CARD8 buttonsDown; /* number of buttons currently down */ unsigned short state; Mask motionMask; - CARD8 down[MAP_LENGTH]; + CARD8 down[DOWN_LENGTH]; CARD8 map[MAP_LENGTH]; #ifdef XKB union _XkbAction *xkb_acts; @@ -332,6 +342,46 @@ typedef struct { } SpriteRec, *SpritePtr; +/* Device properties */ +typedef struct _XIPropertyValue +{ + Atom type; /* ignored by server */ + short format; /* format of data for swapping - 8,16,32 */ + long size; /* size of data in (format/8) bytes */ + pointer data; /* private to client */ +} XIPropertyValueRec; + +typedef struct _XIProperty +{ + struct _XIProperty *next; + Atom propertyName; + Bool is_pending; + Bool range; + Bool immutable; + Bool fromClient; /* created by client or driver/server */ + int num_valid; + INT32 *valid_values; + XIPropertyValueRec current, + pending; +} XIPropertyRec; + + + +typedef XIPropertyRec *XIPropertyPtr; +typedef XIPropertyValueRec *XIPropertyValuePtr; + + +typedef struct _XIPropertyHandler +{ + struct _XIPropertyHandler* next; + long id; + Bool (*SetProperty) (DeviceIntPtr dev, + Atom property, + XIPropertyValuePtr prop); + Bool (*GetProperty) (DeviceIntPtr dev, + Atom property); +} XIPropertyHandler, *XIPropertyHandlerPtr; + /* states for devices */ #define NOT_GRABBED 0 @@ -344,8 +394,9 @@ typedef struct { #define FROZEN_WITH_EVENT 6 #define THAW_OTHERS 7 + typedef struct _GrabInfoRec { - TimeStamp grabTime; + TimeStamp grabTime; Bool fromPassiveGrab; /* true if from passive grab */ Bool implicitGrab; /* implicit from ButtonPress */ GrabRec activeGrab; @@ -423,11 +474,21 @@ typedef struct _DeviceIntRec { /* last valuator values recorded, not posted to client; * for slave devices, valuators is in device coordinates * for master devices, valuators is in screen coordinates - * see dix/getevents.c */ + * see dix/getevents.c + * remainder supports acceleration + */ struct { int valuators[MAX_VALUATORS]; + float remainder[MAX_VALUATORS]; int numValuators; } last; + + /* Input device property handling. */ + struct { + XIPropertyPtr properties; + Bool pendingProperties; + XIPropertyHandlerPtr handlers; /* NULL-terminated */ + } properties; } DeviceIntRec; typedef struct { diff --git a/include/os.h b/include/os.h index 89c624c38..eff9b5297 100644 --- a/include/os.h +++ b/include/os.h @@ -93,7 +93,6 @@ typedef struct _NewClientRec *NewClientPtr; #define SIGVAL void #endif -extern Bool OsDelayInitColors; extern void (*OsVendorVErrorFProc)(const char *, va_list args); extern int WaitForSomething( @@ -246,10 +245,8 @@ extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */); extern int auditTrailLevel; -#ifdef SERVER_LOCK extern void LockServer(void); extern void UnlockServer(void); -#endif extern int OsLookupColor( int /*screen*/, @@ -267,8 +264,6 @@ extern void OsVendorFatalError(void); extern void OsVendorInit(void); -extern int OsInitColors(void); - void OsBlockSignals (void); void OsReleaseSignals (void); @@ -405,10 +400,6 @@ extern XID GenerateAuthorization( unsigned int * /* data_length_return */, char ** /* data_return */); -#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS -extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/); -#endif - extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/); extern void ddxUseMsg(void); diff --git a/include/privates.h b/include/privates.h index 8d59b728f..98d893c77 100644 --- a/include/privates.h +++ b/include/privates.h @@ -20,12 +20,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *****************************************************************/ typedef void *DevPrivateKey; - -typedef struct _Private { - DevPrivateKey key; - pointer value; - struct _Private *next; -} PrivateRec; +struct _Private; +typedef struct _Private PrivateRec; /* * Request pre-allocated private space for your driver/module. @@ -43,61 +39,20 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key); /* * Look up a private pointer. */ -static _X_INLINE pointer -dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key) -{ - PrivateRec *rec = *privates; - pointer *ptr; - - while (rec) { - if (rec->key == key) - return rec->value; - rec = rec->next; - } - - ptr = dixAllocatePrivate(privates, key); - return ptr ? *ptr : NULL; -} +pointer +dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key); /* * Look up the address of a private pointer. */ -static _X_INLINE pointer * -dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key) -{ - PrivateRec *rec = *privates; - - while (rec) { - if (rec->key == key) - return &rec->value; - rec = rec->next; - } - - return dixAllocatePrivate(privates, key); -} +pointer * +dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key); /* * Set a private pointer. */ -static _X_INLINE int -dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val) -{ - PrivateRec *rec; - - top: - rec = *privates; - while (rec) { - if (rec->key == key) { - rec->value = val; - return TRUE; - } - rec = rec->next; - } - - if (!dixAllocatePrivate(privates, key)) - return FALSE; - goto top; -} +int +dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val); /* * Register callbacks to be called on private allocation/freeing. diff --git a/include/ptrveloc.h b/include/ptrveloc.h new file mode 100644 index 000000000..dd5ee5067 --- /dev/null +++ b/include/ptrveloc.h @@ -0,0 +1,89 @@ +/* +* 2006-2008 by Simon Thum +*/ + +#ifndef POINTERVELOCITY_H +#define POINTERVELOCITY_H + +#include /* DeviceIntPtr */ + +#define MAX_VELOCITY_FILTERS 8 + +struct _DeviceVelocityRec; + +/** + * profile + * returns actual acceleration depending on velocity, acceleration control,... + */ +typedef float (*PointerAccelerationProfileFunc) + (struct _DeviceVelocityRec* /*pVel*/, + float /*threshold*/, float /*acc*/); + +/** + * a filter stage contains the data for the adaptive IIR filtering. + * To improve results, one may run several parallel filters + * which have different decays. Since more integration means more + * delay, a given filter only does good matches in a specific phase of + * a stroke. + * + * Basically, the coupling feature makes one filter fairly enough, + * so that is the default. + */ +typedef struct _FilterStage { + float* fading_lut; /* lookup for adaptive IIR filter */ + int fading_lut_size; /* size of lookup table */ + float rdecay; /* reciprocal weighting halflife in ms */ + float current; +} FilterStage, *FilterStagePtr; + +/** + * Contains all data needed to implement mouse ballistics + */ +typedef struct _DeviceVelocityRec { + FilterStage filters[MAX_VELOCITY_FILTERS]; + float velocity; /* velocity as guessed by algorithm */ + int lrm_time; /* time the last motion event was processed */ + int last_dx, last_dy; /* last motion delta */ + int last_diff; /* last time-diff */ + float corr_mul; /* config: multiply this into velocity */ + float const_acceleration; /* config: (recipr.) const deceleration */ + float min_acceleration; /* config: minimum acceleration */ + short reset_time; /* config: reset non-visible state after # ms */ + short use_softening; /* config: use softening of mouse values */ + float coupling; /* config: max. divergence before coupling */ + PointerAccelerationProfileFunc Profile; + PointerAccelerationProfileFunc deviceSpecificProfile; + void* profile_private;/* extended data, see SetAccelerationProfile() */ + struct { /* to be able to query this information */ + int profile_number; + int filter_usecount[MAX_VELOCITY_FILTERS]; + } statistics; +} DeviceVelocityRec, *DeviceVelocityPtr; + + +extern void +InitVelocityData(DeviceVelocityPtr s); + +extern void +InitFilterChain(DeviceVelocityPtr s, float rdecay, float degression, + int lutsize, int stages); + +extern int +SetAccelerationProfile(DeviceVelocityPtr s, int profile_num); + +extern void +SetDeviceSpecificAccelerationProfile(DeviceIntPtr s, + PointerAccelerationProfileFunc profile); + +extern void +AccelerationDefaultCleanup(DeviceIntPtr pDev); + +extern void +acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator, + int num_valuators, int *valuators, int evtime); + +extern void +acceleratePointerClassic(DeviceIntPtr pDev, int first_valuator, + int num_valuators, int *valuators, int ignore); + +#endif /* POINTERVELOCITY_H */ diff --git a/include/regionstr.h b/include/regionstr.h index 5a79b1228..db712f8ae 100644 --- a/include/regionstr.h +++ b/include/regionstr.h @@ -131,31 +131,6 @@ extern RegDataRec miBrokenData; #define REGION_BREAK(_pScreen, _pReg) \ miRegionBreak(_pReg) -#ifdef DONT_INLINE_REGION_OPS - -#define REGION_INIT(_pScreen, _pReg, _rect, _size) \ - miRegionInit(_pReg, _rect, _size) - -#define REGION_UNINIT(_pScreen, _pReg) \ - miRegionUninit(_pReg) - -#define REGION_RESET(_pScreen, _pReg, _pBox) \ - miRegionReset(_pReg, _pBox) - -#define REGION_NOTEMPTY(_pScreen, _pReg) \ - miRegionNotEmpty(_pReg) - -#define REGION_BROKEN(_pScreen, _pReg) \ - miRegionBroken(_pReg) - -#define REGION_EMPTY(_pScreen, _pReg) \ - miRegionEmpty(_pReg) - -#define REGION_EXTENTS(_pScreen, _pReg) \ - miRegionExtents(_pReg) - -#else /* inline certain simple region ops for performance */ - #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ { \ if ((_rect) != NULL) \ @@ -216,8 +191,6 @@ extern RegDataRec miBrokenData; (_pReg)->data = &miEmptyData; \ } -#endif /* DONT_INLINE_REGION_OPS */ - #ifndef REGION_NULL #define REGION_NULL(_pScreen, _pReg) \ REGION_INIT(_pScreen, _pReg, NullBox, 1) diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 6cf933304..5d4ddbbba 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -612,7 +612,7 @@ typedef struct _ScreenInfo { int arraySize; int numScreens; ScreenPtr screens[MAXSCREENS]; - int numVideoScreens; + int unused; } ScreenInfo; extern ScreenInfo screenInfo; diff --git a/include/servermd.h b/include/servermd.h index 8e6de0959..6624cd921 100644 --- a/include/servermd.h +++ b/include/servermd.h @@ -48,6 +48,11 @@ SOFTWARE. #ifndef SERVERMD_H #define SERVERMD_H 1 +/* + * Note: much of this is vestigial from mfb/cfb times. This should + * really be simplified even further. + */ + /* * Machine dependent values: * GLYPHPADBYTES should be chosen with consideration for the space-time @@ -61,103 +66,21 @@ SOFTWARE. * compiler what kind of padding you want because its defines are * kept separate from this. See server/include/font.h for how * GLYPHPADBYTES is used. - * - * Along with this, you should choose an appropriate value for - * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h. This - * constant choses what kind of memory references are guarenteed during - * font access; either 1, 2 or 4, for byte, word or longword access, - * respectively. For instance, if you have decided to to have - * GLYPHPADBYTES == 4, then it is pointless for you to have a - * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already - * guarenteed you that your fonts are longword aligned. On the other - * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may - * also decide that the computing involved in aligning the pointer is more - * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1. - * - * Next, choose the tuning parameters which are appropriate for your - * hardware; these modify the behaviour of the raw frame buffer code - * in ddx/mfb and ddx/cfb. Defining these incorrectly will not cause - * the server to run incorrectly, but defining these correctly will - * cause some noticeable speed improvements: - * - * AVOID_MEMORY_READ - (8-bit cfb only) - * When stippling pixels on the screen (polytext and pushpixels), - * don't read long words from the display and mask in the - * appropriate values. Rather, perform multiple byte/short/long - * writes as appropriate. This option uses many more instructions - * but runs much faster when the destination is much slower than - * the CPU and at least 1 level of write buffer is availible (2 - * is much better). Defined currently for SPARC and MIPS. - * - * FAST_CONSTANT_OFFSET_MODE - (cfb and mfb) - * This define is used on machines which have no auto-increment - * addressing mode, but do have an effectively free constant-offset - * addressing mode. Currently defined for MIPS and SPARC, even though - * I remember the cg6 as performing better without it (cg3 definitely - * performs better with it). - * - * LARGE_INSTRUCTION_CACHE - - * This define increases the number of times some loops are - * unrolled. On 68020 machines (with 256 bytes of i-cache), - * this define will slow execution down as instructions miss - * the cache frequently. On machines with real i-caches, this - * reduces loop overhead, causing a slight performance improvement. - * Currently defined for MIPS and SPARC - * - * FAST_UNALIGNED_READS - - * For machines with more memory bandwidth than CPU, this - * define uses unaligned reads for 8-bit BitBLT instead of doing - * aligned reads and combining the results with shifts and - * logical-ors. Currently defined for 68020 and vax. - * PLENTIFUL_REGISTERS - - * For machines with > 20 registers. Currently used for - * unrolling the text painting code a bit more. Currently - * defined for MIPS. - * SHARED_IDCACHE - - * For non-Harvard RISC machines, those which share the same - * CPU memory bus for instructions and data. This unrolls some - * solid fill loops which are otherwise best left rolled up. - * Currently defined for SPARC. */ -#ifdef vax - -#define IMAGE_BYTE_ORDER LSBFirst /* Values for the VAX only */ -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 1 -#define GETLEFTBITS_ALIGNMENT 4 -#define FAST_UNALIGNED_READS - -#endif /* vax */ - #ifdef __avr32__ #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 -#define AVOID_MEMORY_READ #endif /* __avr32__ */ #ifdef __arm32__ #define IMAGE_BYTE_ORDER LSBFirst - -# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) -# define BITMAP_BIT_ORDER MSBFirst -# else -# define BITMAP_BIT_ORDER LSBFirst -# endif - -# if defined(XF86MONOVGA) || defined(XF86VGA16) -# define BITMAP_SCANLINE_UNIT 8 -# endif - +#define BITMAP_BIT_ORDER LSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 -#define LARGE_INSTRUCTION_CACHE -#define AVOID_MEMORY_READ #endif /* __arm32__ */ @@ -166,33 +89,14 @@ SOFTWARE. #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 /* to make fb work */ -#define GETLEFTBITS_ALIGNMENT 1 /* PA forces longs to 4 */ /* byte boundries */ -#define AVOID_MEMORY_READ -#define FAST_CONSTANT_OFFSET_MODE -#define LARGE_INSTRUCTION_CACHE -#define PLENTIFUL_REGISTERS - #endif /* hpux || __hppa__ */ -#if defined(__powerpc__) || defined(__ppc__) +#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 - -/* XXX Should this be for Lynx only? */ -#ifdef Lynx -#define BITMAP_SCANLINE_UNIT 8 -#endif - -#define LARGE_INSTRUCTION_CACHE -#define FAST_CONSTANT_OFFSET_MODE -#define PLENTIFUL_REGISTERS -#define AVOID_MEMORY_READ - -#define FAST_MEMCPY #endif /* PowerPC */ @@ -202,19 +106,12 @@ SOFTWARE. # define IMAGE_BYTE_ORDER MSBFirst # define BITMAP_BIT_ORDER MSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 #else # define IMAGE_BYTE_ORDER LSBFirst # define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 #endif -#define AVOID_MEMORY_READ -#define FAST_CONSTANT_OFFSET_MODE -#define LARGE_INSTRUCTION_CACHE -#define PLENTIFUL_REGISTERS - #endif /* SuperH */ #if defined(__m32r__) @@ -223,19 +120,12 @@ SOFTWARE. # define IMAGE_BYTE_ORDER MSBFirst # define BITMAP_BIT_ORDER MSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 #else # define IMAGE_BYTE_ORDER LSBFirst # define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 #endif -#define AVOID_MEMORY_READ -#define FAST_CONSTANT_OFFSET_MODE -#define LARGE_INSTRUCTION_CACHE -#define PLENTIFUL_REGISTERS - #endif /* __m32r__ */ #if (defined(sun) && (defined(__sparc) || defined(sparc))) || \ @@ -256,36 +146,16 @@ SOFTWARE. # define BITMAP_BIT_ORDER MSBFirst #endif -#ifdef sparc -# define AVOID_MEMORY_READ -# define LARGE_INSTRUCTION_CACHE -# define FAST_CONSTANT_OFFSET_MODE -# define SHARED_IDCACHE -#endif - -#ifdef mc68020 -#define FAST_UNALIGNED_READS -#endif - #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 #endif /* sun && !(i386 && SVR4) */ - #if defined(AIXV3) #define IMAGE_BYTE_ORDER MSBFirst /* Values for the RISC/6000 */ #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 -#define LARGE_INSTRUCTION_CACHE -#define FAST_CONSTANT_OFFSET_MODE -#define PLENTIFUL_REGISTERS -#define AVOID_MEMORY_READ - -#define FAST_MEMCPY #endif /* AIXV3 */ #if defined(ibm032) || defined (ibm) @@ -297,7 +167,6 @@ SOFTWARE. #endif #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 1 -#define GETLEFTBITS_ALIGNMENT 4 /* ibm pcc doesn't understand pragmas. */ #ifdef __i386__ @@ -306,67 +175,24 @@ SOFTWARE. #endif /* ibm */ -#if defined (M4310) || defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330) - -#define IMAGE_BYTE_ORDER MSBFirst /* Values for Pegasus only */ -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 - -#define FAST_UNALIGNED_READS - -#endif /* tektronix */ - -#ifdef macII - -#define IMAGE_BYTE_ORDER MSBFirst /* Values for the MacII only */ -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 - -/* might want FAST_UNALIGNED_READS for frame buffers with < 1us latency */ - -#endif /* macII */ - #if (defined(mips) || defined(__mips)) && !defined(sgi) #if defined(MIPSEL) || defined(__MIPSEL__) # define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */ # define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 #else # define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */ # define BITMAP_BIT_ORDER MSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 #endif -#define AVOID_MEMORY_READ -#define FAST_CONSTANT_OFFSET_MODE -#define LARGE_INSTRUCTION_CACHE -#define PLENTIFUL_REGISTERS - #endif /* mips */ -#if defined(__alpha) || defined(__alpha__) || defined(__alphaCross) +#if defined(__alpha) || defined(__alpha__) # define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */ - -# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) -# define BITMAP_BIT_ORDER MSBFirst -# else -# define BITMAP_BIT_ORDER LSBFirst -# endif - -# if defined(XF86MONOVGA) || defined(XF86VGA16) -# define BITMAP_SCANLINE_UNIT 8 -# endif - +# define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 -# define FAST_CONSTANT_OFFSET_MODE -# define LARGE_INSTRUCTION_CACHE -# define PLENTIFUL_REGISTERS #endif /* alpha */ @@ -375,15 +201,10 @@ SOFTWARE. #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 #define BITMAP_SCANLINE_UNIT 8 -#define LARGE_INSTRUCTION_CACHE -#define FAST_CONSTANT_OFFSET_MODE #define FAST_UNALIGNED_READ -#define FAST_MEMCPY - #endif /* linux/s390 */ #if defined (linux) && defined (__s390x__) @@ -391,89 +212,28 @@ SOFTWARE. #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 #define BITMAP_SCANLINE_UNIT 8 -#define LARGE_INSTRUCTION_CACHE -#define FAST_CONSTANT_OFFSET_MODE #define FAST_UNALIGNED_READ -#define FAST_MEMCPY #endif /* linux/s390x */ #if defined(__ia64__) || defined(ia64) + # define IMAGE_BYTE_ORDER LSBFirst - -# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) -# define BITMAP_BIT_ORDER MSBFirst -# else -# define BITMAP_BIT_ORDER LSBFirst -# endif - -# if defined(XF86MONOVGA) || defined(XF86VGA16) -# define BITMAP_SCANLINE_UNIT 8 -# endif - +# define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 -# define FAST_CONSTANT_OFFSET_MODE -# define LARGE_INSTRUCTION_CACHE -# define PLENTIFUL_REGISTERS #endif /* ia64 */ -#if defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__) +#if defined(__amd64__) || defined(amd64) || defined(__amd64) # define IMAGE_BYTE_ORDER LSBFirst - -# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) -# define BITMAP_BIT_ORDER MSBFirst -# else -# define BITMAP_BIT_ORDER LSBFirst -# endif - -# if defined(XF86MONOVGA) || defined(XF86VGA16) -# define BITMAP_SCANLINE_UNIT 8 -# endif - +# define BITMAP_BIT_ORDER LSBFirst # define GLYPHPADBYTES 4 -# define GETLEFTBITS_ALIGNMENT 1 -# define LARGE_INSTRUCTION_CACHE -# define FAST_CONSTANT_OFFSET_MODE /* ???? */ -# define FAST_UNALIGNED_READS #endif /* AMD64 */ -#ifdef stellar - -#define IMAGE_BYTE_ORDER MSBFirst /* Values for the stellar only*/ -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 4 -#define IMAGE_BUFSIZE (64*1024) -/* - * Use SysV random number generator. - */ -#define random rand - -#endif /* stellar */ - -#ifdef luna - -#define IMAGE_BYTE_ORDER MSBFirst /* Values for the OMRON only*/ -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 - -#ifndef mc68000 -#define FAST_CONSTANT_OFFSET_MODE -#define AVOID_MEMORY_READ -#define LARGE_INSTRUCTION_CACHE -#define PLENTIFUL_REGISTERS -#endif - -#endif /* luna */ - #if (defined(SVR4) && (defined(__i386__) || (defined(__i386)))) || \ defined(__alpha__) || defined(__alpha) || \ defined(__i386__) || defined(__QNX__) || \ @@ -484,41 +244,20 @@ SOFTWARE. #endif #ifndef BITMAP_BIT_ORDER -# if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) -# define BITMAP_BIT_ORDER MSBFirst -# else -# define BITMAP_BIT_ORDER LSBFirst -# endif -#endif - -#ifndef BITMAP_SCANLINE_UNIT -# if defined(XF86MONOVGA) || defined(XF86VGA16) -# define BITMAP_SCANLINE_UNIT 8 -# endif +# define BITMAP_BIT_ORDER LSBFirst #endif #ifndef GLYPHPADBYTES #define GLYPHPADBYTES 4 #endif -#define GETLEFTBITS_ALIGNMENT 1 -#define AVOID_MEMORY_READ -#ifdef XSVGA -#define AVOID_GLYPHBLT -#define FAST_CONSTANT_OFFSET_MODE -#define FAST_MEMCPY -#define NO_ONE_RECT -#endif - #endif /* SVR4 / BSD / i386 */ #if defined (linux) && defined (__mc68000__) #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst -#define FAST_UNALIGNED_READS #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 #endif /* linux/m68k */ @@ -527,20 +266,14 @@ SOFTWARE. #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 -#define AVOID_MEMORY_READ -#define FAST_CONSTANT_OFFSET_MODE -#define LARGE_INSTRUCTION_CACHE -#define PLENTIFUL_REGISTERS #endif -/* linux on the Compaq Itsy */ +/* linux on ARM */ #if defined(linux) && defined(__arm__) #define IMAGE_BYTE_ORDER LSBFirst #define BITMAP_BIT_ORDER LSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 #endif /* linux on IBM S/390 */ @@ -548,12 +281,11 @@ SOFTWARE. #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst #define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 #endif /* linux/s390 */ /* size of buffer to use with GetImage, measured in bytes. There's obviously - * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives - * you) used and the number of times the ddx routine has to be called. + * a trade-off between the amount of heap used and the number of times the + * ddx routine has to be called. */ #ifndef IMAGE_BUFSIZE #define IMAGE_BUFSIZE (64*1024) diff --git a/include/windowstr.h b/include/windowstr.h index 0e45262d8..2d11f6ec7 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -115,7 +115,7 @@ typedef struct _WindowOpt { #endif struct _OtherInputMasks *inputMasks; /* default: NULL */ DevCursorList deviceCursors; /* default: NULL */ - struct _GenericClientMasks *geMasks;/* default: NULL */ + struct _GenericClientMasks *geMasks; /* default: NULL */ WindowAccessRec access; } WindowOptRec, *WindowOptPtr; diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index e05d3bfd3..61374069e 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -18,12 +18,6 @@ /* Current X.Org version. */ #undef XORG_VERSION_CURRENT -/* Need XFree86 libc-replacement typedefs. */ -#undef NEED_XF86_TYPES - -/* Need XFree86 libc-replacement functions. */ -#undef NEED_XF86_PROTOTYPES - /* Name of X server. */ #undef __XSERVERNAME__ diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in index 5a253c7c6..8cb2b5a03 100644 --- a/include/xorg-server.h.in +++ b/include/xorg-server.h.in @@ -25,18 +25,12 @@ /* Support Composite Extension */ #undef COMPOSITE -/* Use OsVendorInit */ -#undef DDXOSINIT - /* Build DPMS extension */ #undef DPMSExtension /* Build GLX extension */ #undef GLXEXT -/* Include handhelds.org h3600 touchscreen driver */ -#undef H3600_TS - /* Support XDM-AUTH*-1 */ #undef HASXDMAUTH @@ -49,12 +43,6 @@ /* Support MIT-SHM Extension */ #undef MITSHM -/* Need XFree86 helper functions */ -#undef NEED_XF86_PROTOTYPES - -/* Need XFree86 typedefs */ -#undef NEED_XF86_TYPES - /* Internal define for Xinerama */ #undef PANORAMIX @@ -70,9 +58,6 @@ /* Support MIT-SCREEN-SAVER extension */ #undef SCREENSAVER -/* Use a lock to prevent multiple servers on a display */ -#undef SERVER_LOCK - /* Support SHAPE extension */ #undef SHAPE @@ -106,9 +91,6 @@ /* Build XFree86 BigFont extension */ #undef XF86BIGFONT -/* Support XFree86 miscellaneous extensions */ -#undef XF86MISC - /* Support XFree86 Video Mode extension */ #undef XF86VIDMODE @@ -154,18 +136,12 @@ /* Build XvMC Extension */ #undef XvMCExtension -/* Build XRes extension */ -#undef XResExtension - /* Support XSync extension */ #undef XSYNC /* Support XTest extension */ #undef XTEST -/* Support XTrap extension */ -#undef XTRAP - /* Support Xv Extension */ #undef XV diff --git a/mfb/Makefile.am b/mfb/Makefile.am deleted file mode 100644 index 274a32d7d..000000000 --- a/mfb/Makefile.am +++ /dev/null @@ -1,133 +0,0 @@ -noinst_LTLIBRARIES = libmfb.la - -AM_CFLAGS = $(DIX_CFLAGS) - -INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support - -libmfb_gen_sources = mfbseg.c mfbpgbwht.c mfbpgbblak.c mfbpgbinv.c mfbigbwht.c \ - mfbigbblak.c mfbpawhite.c mfbpablack.c mfbpainv.c mfbtewhite.c \ - mfbteblack.c mfbbltC.c mfbbltX.c mfbbltCI.c mfbbltO.c mfbbltG.c \ - mfbtileC.c mfbtileG.c mfbplywhite.c mfbplyblack.c mfbplyinv.c - -DISTCLEANFILES = $(libmfb_gen_sources) - -libmfb_la_SOURCES = mfbgc.c mfbwindow.c mfbfont.c \ - mfbfillrct.c maskbits.c mfbpixmap.c \ - mfbimage.c mfbline.c mfbbres.c mfbhrzvert.c mfbbresd.c \ - mfbpushpxl.c mfbzerarc.c mfbfillarc.c \ - mfbfillsp.c mfbsetsp.c mfbscrinit.c mfbscrclse.c mfbclip.c \ - mfbbitblt.c mfbgetsp.c mfbpolypnt.c \ - mfbcmap.c mfbmisc.c $(libmfb_gen_sources) - -EXTRA_DIST = maskbits.h mergerop.h fastblt.h mfbline.c mfbblt.c mfbtile.c \ - mfbplygblt.c mfbimggblt.c mfbpntarea.c mfbtegblt.c mfbply1rct.c - -sdk_HEADERS = mfb.h - -mfbseg.c: - echo "#define POLYSEGMENT" > $@ - echo "#include \"$(srcdir)/mfbline.c\"" >> $@ - -mfbbltC.c: - echo "#define MROP Mcopy" > $@ - echo "#include \"$(srcdir)/mfbblt.c\"" >> $@ - -mfbbltX.c: - echo "#define MROP Mxor" > $@ - echo "#include \"$(srcdir)/mfbblt.c\"" >> $@ - -mfbbltCI.c: - echo "#define MROP McopyInverted" > $@ - echo "#include \"$(srcdir)/mfbblt.c\"" >> $@ - -mfbbltO.c: - echo "#define MROP Mor" > $@ - echo "#include \"$(srcdir)/mfbblt.c\"" >> $@ - -mfbbltG.c: - echo "#define MROP 0" > $@ - echo "#include \"$(srcdir)/mfbblt.c\"" >> $@ - -mfbtileC.c: - echo "#define MROP Mcopy" > $@ - echo "#include \"$(srcdir)/mfbtile.c\"" >> $@ - -mfbtileG.c: - echo "#define MROP 0" > $@ - echo "#include \"$(srcdir)/mfbtile.c\"" >> $@ - -mfbpgbwht.c: - echo "#define OPEQ MFB_OPEQ_WHITE" > $@ - echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltWhite" >> $@ - echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@ - -mfbpgbblak.c: - echo "#define OPEQ MFB_OPEQ_BLACK" > $@ - echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltBlack" >> $@ - echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@ - -mfbpgbinv.c: - echo "#define OPEQ MFB_OPEQ_INVERT" > $@ - echo "#define MFBPOLYGLYPHBLT mfbPolyGlyphBltInvert" >> $@ - echo "#include \"$(srcdir)/mfbplygblt.c\"" >> $@ - -mfbigbwht.c: - echo "#define OPEQ MFB_OPEQ_WHITE" > $@ - echo "#define MFBIMAGEGLYPHBLT mfbImageGlyphBltWhite" >> $@ - echo "#include \"$(srcdir)/mfbimggblt.c\"" >> $@ - -mfbigbblak.c: - echo "#define OPEQ MFB_OPEQ_BLACK" > $@ - echo "#define MFBIMAGEGLYPHBLT mfbImageGlyphBltBlack" >> $@ - echo "#include \"$(srcdir)/mfbimggblt.c\"" >> $@ - -mfbpawhite.c: - echo "#define OPEQ MFB_OPEQ_WHITE" > $@ - echo "#define MFBSOLIDFILLAREA mfbSolidWhiteArea" >> $@ - echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_WHITE" >> $@ - echo "#define MFBSTIPPLEFILLAREA mfbStippleWhiteArea" >> $@ - echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@ - -mfbpablack.c: - echo "#define OPEQ MFB_OPEQ_BLACK" > $@ - echo "#define MFBSOLIDFILLAREA mfbSolidBlackArea" >> $@ - echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_BLACK" >> $@ - echo "#define MFBSTIPPLEFILLAREA mfbStippleBlackArea" >> $@ - echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@ - -mfbpainv.c: - echo "#define OPEQ MFB_OPEQ_INVERT" > $@ - echo "#define MFBSOLIDFILLAREA mfbSolidInvertArea" >> $@ - echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_INVERT" >> $@ - echo "#define MFBSTIPPLEFILLAREA mfbStippleInvertArea" >> $@ - echo "#include \"$(srcdir)/mfbpntarea.c\"" >> $@ - -mfbtewhite.c: - echo "#define OP MFB_OP_WHITE" > $@ - echo "#define MFBTEGLYPHBLT mfbTEGlyphBltWhite" >> $@ - echo "#define CLIPTETEXT mfbImageGlyphBltWhite" >> $@ - echo "#include \"$(srcdir)/mfbtegblt.c\"" >> $@ - -mfbteblack.c: - echo "#define OP MFB_OP_BLACK" > $@ - echo "#define MFBTEGLYPHBLT mfbTEGlyphBltBlack" >> $@ - echo "#define CLIPTETEXT mfbImageGlyphBltBlack" >> $@ - echo "#include \"$(srcdir)/mfbtegblt.c\"" >> $@ - -mfbplywhite.c: - echo "#define OPEQ MFB_OPEQ_WHITE" > $@ - echo "#define MFBFILLPOLY1RECT mfbFillPolyWhite" >> $@ - echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_WHITE" >> $@ - echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@ - -mfbplyblack.c: - echo "#define OPEQ MFB_OPEQ_BLACK" > $@ - echo "#define MFBFILLPOLY1RECT mfbFillPolyBlack" >> $@ - echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_BLACK" >> $@ - echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@ - -mfbplyinv.c: - echo "#define OPEQ MFB_OPEQ_INVERT" > $@ - echo "#define MFBFILLPOLY1RECT mfbFillPolyInvert" >> $@ - echo "#define EQWHOLEWORD MFB_EQWHOLEWORD_INVERT" >> $@ - echo "#include \"$(srcdir)/mfbply1rct.c\"" >> $@ diff --git a/mfb/fastblt.h b/mfb/fastblt.h deleted file mode 100644 index 35ba5a2a1..000000000 --- a/mfb/fastblt.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -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. - -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 OPEN GROUP 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 Open Group 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 Open Group. - -*/ - -/* - * Fast bitblt macros for certain hardware. If your machine has an addressing - * mode of small constant + register, you'll probably want this magic specific - * code. It's 25% faster for the R2000. I haven't studied the Sparc - * instruction set, but I suspect it also has this addressing mode. Also, - * unrolling the loop by 32 is possibly excessive for mfb. The number of times - * the loop is actually looped through is pretty small. - */ - -/* - * WARNING: These macros make *a lot* of assumptions about - * the environment they are invoked in. Plenty of implicit - * arguments, lots of side effects. Don't use them casually. - */ - -#define SwitchOdd(n) case n: BodyOdd(n) -#define SwitchEven(n) case n: BodyEven(n) - -/* to allow mfb and cfb to share code... */ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef BitRight -#define BitRight(a,b) SCRRIGHT(a,b) -#define BitLeft(a,b) SCRLEFT(a,b) -#endif - -#ifdef LARGE_INSTRUCTION_CACHE -#define UNROLL 8 -#define PackedLoop \ - switch (nl & (UNROLL-1)) { \ - SwitchOdd( 7) SwitchEven( 6) SwitchOdd( 5) SwitchEven( 4) \ - SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \ - } \ - while ((nl -= UNROLL) >= 0) { \ - LoopReset \ - BodyEven( 8) \ - BodyOdd( 7) BodyEven( 6) BodyOdd( 5) BodyEven( 4) \ - BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \ - } -#else -#define UNROLL 4 -#define PackedLoop \ - switch (nl & (UNROLL-1)) { \ - SwitchOdd( 3) SwitchEven( 2) SwitchOdd( 1) \ - } \ - while ((nl -= UNROLL) >= 0) { \ - LoopReset \ - BodyEven( 4) \ - BodyOdd( 3) BodyEven( 2) BodyOdd( 1) \ - } -#endif - -#define DuffL(counter,label,body) \ - switch (counter & 3) { \ - label: \ - body \ - case 3: \ - body \ - case 2: \ - body \ - case 1: \ - body \ - case 0: \ - if ((counter -= 4) >= 0) \ - goto label; \ - } diff --git a/mfb/maskbits.c b/mfb/maskbits.c deleted file mode 100644 index 85b5f3048..000000000 --- a/mfb/maskbits.c +++ /dev/null @@ -1,1059 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/* - -Copyright 1987, 1998 The Open Group - -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. - -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 OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include "maskbits.h" -#include "servermd.h" - -/* -these tables are used by several macros in the mfb code. - - the vax numbers everything left to right, so bit indices on the -screen match bit indices in longwords. the pc-rt and Sun number -bits on the screen the way they would be written on paper, -(i.e. msb to the left), and so a bit index n on the screen is -bit index PPW-n in a longword - - see also maskbits.h -*/ - -#if PPW != 32 - ERROR MFB must be compiled with PPW 32 -#endif - -#if (BITMAP_BIT_ORDER == MSBFirst) -/* NOTE: -the first element in starttab could be 0xffffffff. making it 0 -lets us deal with a full first word in the middle loop, rather -than having to do the multiple reads and masks that we'd -have to do if we thought it was partial. -*/ -PixelType starttab[PPW+1] = - { - LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x7FFFFFFF ), - LONG2CHARS( 0x3FFFFFFF ), - LONG2CHARS( 0x1FFFFFFF ), - LONG2CHARS( 0x0FFFFFFF ), - LONG2CHARS( 0x07FFFFFF ), - LONG2CHARS( 0x03FFFFFF ), - LONG2CHARS( 0x01FFFFFF ), - LONG2CHARS( 0x00FFFFFF ), - LONG2CHARS( 0x007FFFFF ), - LONG2CHARS( 0x003FFFFF ), - LONG2CHARS( 0x001FFFFF ), - LONG2CHARS( 0x000FFFFF ), - LONG2CHARS( 0x0007FFFF ), - LONG2CHARS( 0x0003FFFF ), - LONG2CHARS( 0x0001FFFF ), - LONG2CHARS( 0x0000FFFF ), - LONG2CHARS( 0x00007FFF ), - LONG2CHARS( 0x00003FFF ), - LONG2CHARS( 0x00001FFF ), - LONG2CHARS( 0x00000FFF ), - LONG2CHARS( 0x000007FF ), - LONG2CHARS( 0x000003FF ), - LONG2CHARS( 0x000001FF ), - LONG2CHARS( 0x000000FF ), - LONG2CHARS( 0x0000007F ), - LONG2CHARS( 0x0000003F ), - LONG2CHARS( 0x0000001F ), - LONG2CHARS( 0x0000000F ), - LONG2CHARS( 0x00000007 ), - LONG2CHARS( 0x00000003 ), - LONG2CHARS( 0x00000001 ), - LONG2CHARS( 0x00000000 ) - }; - -PixelType endtab[PPW+1] = - { - LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x80000000 ), - LONG2CHARS( 0xC0000000 ), - LONG2CHARS( 0xE0000000 ), - LONG2CHARS( 0xF0000000 ), - LONG2CHARS( 0xF8000000 ), - LONG2CHARS( 0xFC000000 ), - LONG2CHARS( 0xFE000000 ), - LONG2CHARS( 0xFF000000 ), - LONG2CHARS( 0xFF800000 ), - LONG2CHARS( 0xFFC00000 ), - LONG2CHARS( 0xFFE00000 ), - LONG2CHARS( 0xFFF00000 ), - LONG2CHARS( 0xFFF80000 ), - LONG2CHARS( 0xFFFC0000 ), - LONG2CHARS( 0xFFFE0000 ), - LONG2CHARS( 0xFFFF0000 ), - LONG2CHARS( 0xFFFF8000 ), - LONG2CHARS( 0xFFFFC000 ), - LONG2CHARS( 0xFFFFE000 ), - LONG2CHARS( 0xFFFFF000 ), - LONG2CHARS( 0xFFFFF800 ), - LONG2CHARS( 0xFFFFFC00 ), - LONG2CHARS( 0xFFFFFE00 ), - LONG2CHARS( 0xFFFFFF00 ), - LONG2CHARS( 0xFFFFFF80 ), - LONG2CHARS( 0xFFFFFFC0 ), - LONG2CHARS( 0xFFFFFFE0 ), - LONG2CHARS( 0xFFFFFFF0 ), - LONG2CHARS( 0xFFFFFFF8 ), - LONG2CHARS( 0xFFFFFFFC ), - LONG2CHARS( 0xFFFFFFFE ), - LONG2CHARS( 0xFFFFFFFF ) - }; - - -#ifdef NEED_OLD_MFB_MASKS -/* a hack, for now, since the entries for 0 need to be all - 1 bits, not all zeros. - this means the code DOES NOT WORK for segments of length - 0 (which is only a problem in the horizontal line code.) -*/ -PixelType startpartial[33] = - { - LONG2CHARS( 0xFFFFFFFF ), - LONG2CHARS( 0x7FFFFFFF ), - LONG2CHARS( 0x3FFFFFFF ), - LONG2CHARS( 0x1FFFFFFF ), - LONG2CHARS( 0x0FFFFFFF ), - LONG2CHARS( 0x07FFFFFF ), - LONG2CHARS( 0x03FFFFFF ), - LONG2CHARS( 0x01FFFFFF ), - LONG2CHARS( 0x00FFFFFF ), - LONG2CHARS( 0x007FFFFF ), - LONG2CHARS( 0x003FFFFF ), - LONG2CHARS( 0x001FFFFF ), - LONG2CHARS( 0x000FFFFF ), - LONG2CHARS( 0x0007FFFF ), - LONG2CHARS( 0x0003FFFF ), - LONG2CHARS( 0x0001FFFF ), - LONG2CHARS( 0x0000FFFF ), - LONG2CHARS( 0x00007FFF ), - LONG2CHARS( 0x00003FFF ), - LONG2CHARS( 0x00001FFF ), - LONG2CHARS( 0x00000FFF ), - LONG2CHARS( 0x000007FF ), - LONG2CHARS( 0x000003FF ), - LONG2CHARS( 0x000001FF ), - LONG2CHARS( 0x000000FF ), - LONG2CHARS( 0x0000007F ), - LONG2CHARS( 0x0000003F ), - LONG2CHARS( 0x0000001F ), - LONG2CHARS( 0x0000000F ), - LONG2CHARS( 0x00000007 ), - LONG2CHARS( 0x00000003 ), - LONG2CHARS( 0x00000001 ), - LONG2CHARS( 0x00000000 ) - }; - -PixelType endpartial[33] = - { - LONG2CHARS( 0xFFFFFFFF ), - LONG2CHARS( 0x80000000 ), - LONG2CHARS( 0xC0000000 ), - LONG2CHARS( 0xE0000000 ), - LONG2CHARS( 0xF0000000 ), - LONG2CHARS( 0xF8000000 ), - LONG2CHARS( 0xFC000000 ), - LONG2CHARS( 0xFE000000 ), - LONG2CHARS( 0xFF000000 ), - LONG2CHARS( 0xFF800000 ), - LONG2CHARS( 0xFFC00000 ), - LONG2CHARS( 0xFFE00000 ), - LONG2CHARS( 0xFFF00000 ), - LONG2CHARS( 0xFFF80000 ), - LONG2CHARS( 0xFFFC0000 ), - LONG2CHARS( 0xFFFE0000 ), - LONG2CHARS( 0xFFFF0000 ), - LONG2CHARS( 0xFFFF8000 ), - LONG2CHARS( 0xFFFFC000 ), - LONG2CHARS( 0xFFFFE000 ), - LONG2CHARS( 0xFFFFF000 ), - LONG2CHARS( 0xFFFFF800 ), - LONG2CHARS( 0xFFFFFC00 ), - LONG2CHARS( 0xFFFFFE00 ), - LONG2CHARS( 0xFFFFFF00 ), - LONG2CHARS( 0xFFFFFF80 ), - LONG2CHARS( 0xFFFFFFC0 ), - LONG2CHARS( 0xFFFFFFE0 ), - LONG2CHARS( 0xFFFFFFF0 ), - LONG2CHARS( 0xFFFFFFF8 ), - LONG2CHARS( 0xFFFFFFFC ), - LONG2CHARS( 0xFFFFFFFE ), - LONG2CHARS( 0xFFFFFFFF ) - }; -#endif /* NEED_OLD_MFB_MASKS */ - - -PixelType partmasks[PPW][PPW] = { - {LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0xE0000000 ), - LONG2CHARS( 0xF0000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0xFE000000 ), - LONG2CHARS( 0xFF000000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0xFFE00000 ), - LONG2CHARS( 0xFFF00000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0xFFFE0000 ), - LONG2CHARS( 0xFFFF0000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0xFFFFE000 ), - LONG2CHARS( 0xFFFFF000 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0xFFFFFE00 ), - LONG2CHARS( 0xFFFFFF00 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0xFFFFFFE0 ), - LONG2CHARS( 0xFFFFFFF0 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0xFFFFFFFE )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x40000000 ), LONG2CHARS( 0x60000000 ), LONG2CHARS( 0x70000000 ), - LONG2CHARS( 0x78000000 ), LONG2CHARS( 0x7C000000 ), LONG2CHARS( 0x7E000000 ), LONG2CHARS( 0x7F000000 ), - LONG2CHARS( 0x7F800000 ), LONG2CHARS( 0x7FC00000 ), LONG2CHARS( 0x7FE00000 ), LONG2CHARS( 0x7FF00000 ), - LONG2CHARS( 0x7FF80000 ), LONG2CHARS( 0x7FFC0000 ), LONG2CHARS( 0x7FFE0000 ), LONG2CHARS( 0x7FFF0000 ), - LONG2CHARS( 0x7FFF8000 ), LONG2CHARS( 0x7FFFC000 ), LONG2CHARS( 0x7FFFE000 ), LONG2CHARS( 0x7FFFF000 ), - LONG2CHARS( 0x7FFFF800 ), LONG2CHARS( 0x7FFFFC00 ), LONG2CHARS( 0x7FFFFE00 ), LONG2CHARS( 0x7FFFFF00 ), - LONG2CHARS( 0x7FFFFF80 ), LONG2CHARS( 0x7FFFFFC0 ), LONG2CHARS( 0x7FFFFFE0 ), LONG2CHARS( 0x7FFFFFF0 ), - LONG2CHARS( 0x7FFFFFF8 ), LONG2CHARS( 0x7FFFFFFC ), LONG2CHARS( 0x7FFFFFFE ), LONG2CHARS( 0x7FFFFFFF )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x20000000 ), LONG2CHARS( 0x30000000 ), LONG2CHARS( 0x38000000 ), - LONG2CHARS( 0x3C000000 ), LONG2CHARS( 0x3E000000 ), LONG2CHARS( 0x3F000000 ), LONG2CHARS( 0x3F800000 ), - LONG2CHARS( 0x3FC00000 ), LONG2CHARS( 0x3FE00000 ), LONG2CHARS( 0x3FF00000 ), LONG2CHARS( 0x3FF80000 ), - LONG2CHARS( 0x3FFC0000 ), LONG2CHARS( 0x3FFE0000 ), LONG2CHARS( 0x3FFF0000 ), LONG2CHARS( 0x3FFF8000 ), - LONG2CHARS( 0x3FFFC000 ), LONG2CHARS( 0x3FFFE000 ), LONG2CHARS( 0x3FFFF000 ), LONG2CHARS( 0x3FFFF800 ), - LONG2CHARS( 0x3FFFFC00 ), LONG2CHARS( 0x3FFFFE00 ), LONG2CHARS( 0x3FFFFF00 ), LONG2CHARS( 0x3FFFFF80 ), - LONG2CHARS( 0x3FFFFFC0 ), LONG2CHARS( 0x3FFFFFE0 ), LONG2CHARS( 0x3FFFFFF0 ), LONG2CHARS( 0x3FFFFFF8 ), - LONG2CHARS( 0x3FFFFFFC ), LONG2CHARS( 0x3FFFFFFE ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x10000000 ), LONG2CHARS( 0x18000000 ), LONG2CHARS( 0x1C000000 ), - LONG2CHARS( 0x1E000000 ), LONG2CHARS( 0x1F000000 ), LONG2CHARS( 0x1F800000 ), LONG2CHARS( 0x1FC00000 ), - LONG2CHARS( 0x1FE00000 ), LONG2CHARS( 0x1FF00000 ), LONG2CHARS( 0x1FF80000 ), LONG2CHARS( 0x1FFC0000 ), - LONG2CHARS( 0x1FFE0000 ), LONG2CHARS( 0x1FFF0000 ), LONG2CHARS( 0x1FFF8000 ), LONG2CHARS( 0x1FFFC000 ), - LONG2CHARS( 0x1FFFE000 ), LONG2CHARS( 0x1FFFF000 ), LONG2CHARS( 0x1FFFF800 ), LONG2CHARS( 0x1FFFFC00 ), - LONG2CHARS( 0x1FFFFE00 ), LONG2CHARS( 0x1FFFFF00 ), LONG2CHARS( 0x1FFFFF80 ), LONG2CHARS( 0x1FFFFFC0 ), - LONG2CHARS( 0x1FFFFFE0 ), LONG2CHARS( 0x1FFFFFF0 ), LONG2CHARS( 0x1FFFFFF8 ), LONG2CHARS( 0x1FFFFFFC ), - LONG2CHARS( 0x1FFFFFFE ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x08000000 ), LONG2CHARS( 0x0C000000 ), LONG2CHARS( 0x0E000000 ), - LONG2CHARS( 0x0F000000 ), LONG2CHARS( 0x0F800000 ), LONG2CHARS( 0x0FC00000 ), LONG2CHARS( 0x0FE00000 ), - LONG2CHARS( 0x0FF00000 ), LONG2CHARS( 0x0FF80000 ), LONG2CHARS( 0x0FFC0000 ), LONG2CHARS( 0x0FFE0000 ), - LONG2CHARS( 0x0FFF0000 ), LONG2CHARS( 0x0FFF8000 ), LONG2CHARS( 0x0FFFC000 ), LONG2CHARS( 0x0FFFE000 ), - LONG2CHARS( 0x0FFFF000 ), LONG2CHARS( 0x0FFFF800 ), LONG2CHARS( 0x0FFFFC00 ), LONG2CHARS( 0x0FFFFE00 ), - LONG2CHARS( 0x0FFFFF00 ), LONG2CHARS( 0x0FFFFF80 ), LONG2CHARS( 0x0FFFFFC0 ), LONG2CHARS( 0x0FFFFFE0 ), - LONG2CHARS( 0x0FFFFFF0 ), LONG2CHARS( 0x0FFFFFF8 ), LONG2CHARS( 0x0FFFFFFC ), LONG2CHARS( 0x0FFFFFFE ), - LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x04000000 ), LONG2CHARS( 0x06000000 ), LONG2CHARS( 0x07000000 ), - LONG2CHARS( 0x07800000 ), LONG2CHARS( 0x07C00000 ), LONG2CHARS( 0x07E00000 ), LONG2CHARS( 0x07F00000 ), - LONG2CHARS( 0x07F80000 ), LONG2CHARS( 0x07FC0000 ), LONG2CHARS( 0x07FE0000 ), LONG2CHARS( 0x07FF0000 ), - LONG2CHARS( 0x07FF8000 ), LONG2CHARS( 0x07FFC000 ), LONG2CHARS( 0x07FFE000 ), LONG2CHARS( 0x07FFF000 ), - LONG2CHARS( 0x07FFF800 ), LONG2CHARS( 0x07FFFC00 ), LONG2CHARS( 0x07FFFE00 ), LONG2CHARS( 0x07FFFF00 ), - LONG2CHARS( 0x07FFFF80 ), LONG2CHARS( 0x07FFFFC0 ), LONG2CHARS( 0x07FFFFE0 ), LONG2CHARS( 0x07FFFFF0 ), - LONG2CHARS( 0x07FFFFF8 ), LONG2CHARS( 0x07FFFFFC ), LONG2CHARS( 0x07FFFFFE ), LONG2CHARS( 0x07FFFFFF ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x02000000 ), LONG2CHARS( 0x03000000 ), LONG2CHARS( 0x03800000 ), - LONG2CHARS( 0x03C00000 ), LONG2CHARS( 0x03E00000 ), LONG2CHARS( 0x03F00000 ), LONG2CHARS( 0x03F80000 ), - LONG2CHARS( 0x03FC0000 ), LONG2CHARS( 0x03FE0000 ), LONG2CHARS( 0x03FF0000 ), LONG2CHARS( 0x03FF8000 ), - LONG2CHARS( 0x03FFC000 ), LONG2CHARS( 0x03FFE000 ), LONG2CHARS( 0x03FFF000 ), LONG2CHARS( 0x03FFF800 ), - LONG2CHARS( 0x03FFFC00 ), LONG2CHARS( 0x03FFFE00 ), LONG2CHARS( 0x03FFFF00 ), LONG2CHARS( 0x03FFFF80 ), - LONG2CHARS( 0x03FFFFC0 ), LONG2CHARS( 0x03FFFFE0 ), LONG2CHARS( 0x03FFFFF0 ), LONG2CHARS( 0x03FFFFF8 ), - LONG2CHARS( 0x03FFFFFC ), LONG2CHARS( 0x03FFFFFE ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x01000000 ), LONG2CHARS( 0x01800000 ), LONG2CHARS( 0x01C00000 ), - LONG2CHARS( 0x01E00000 ), LONG2CHARS( 0x01F00000 ), LONG2CHARS( 0x01F80000 ), LONG2CHARS( 0x01FC0000 ), - LONG2CHARS( 0x01FE0000 ), LONG2CHARS( 0x01FF0000 ), LONG2CHARS( 0x01FF8000 ), LONG2CHARS( 0x01FFC000 ), - LONG2CHARS( 0x01FFE000 ), LONG2CHARS( 0x01FFF000 ), LONG2CHARS( 0x01FFF800 ), LONG2CHARS( 0x01FFFC00 ), - LONG2CHARS( 0x01FFFE00 ), LONG2CHARS( 0x01FFFF00 ), LONG2CHARS( 0x01FFFF80 ), LONG2CHARS( 0x01FFFFC0 ), - LONG2CHARS( 0x01FFFFE0 ), LONG2CHARS( 0x01FFFFF0 ), LONG2CHARS( 0x01FFFFF8 ), LONG2CHARS( 0x01FFFFFC ), - LONG2CHARS( 0x01FFFFFE ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00800000 ), LONG2CHARS( 0x00C00000 ), LONG2CHARS( 0x00E00000 ), - LONG2CHARS( 0x00F00000 ), LONG2CHARS( 0x00F80000 ), LONG2CHARS( 0x00FC0000 ), LONG2CHARS( 0x00FE0000 ), - LONG2CHARS( 0x00FF0000 ), LONG2CHARS( 0x00FF8000 ), LONG2CHARS( 0x00FFC000 ), LONG2CHARS( 0x00FFE000 ), - LONG2CHARS( 0x00FFF000 ), LONG2CHARS( 0x00FFF800 ), LONG2CHARS( 0x00FFFC00 ), LONG2CHARS( 0x00FFFE00 ), - LONG2CHARS( 0x00FFFF00 ), LONG2CHARS( 0x00FFFF80 ), LONG2CHARS( 0x00FFFFC0 ), LONG2CHARS( 0x00FFFFE0 ), - LONG2CHARS( 0x00FFFFF0 ), LONG2CHARS( 0x00FFFFF8 ), LONG2CHARS( 0x00FFFFFC ), LONG2CHARS( 0x00FFFFFE ), - LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00400000 ), LONG2CHARS( 0x00600000 ), LONG2CHARS( 0x00700000 ), - LONG2CHARS( 0x00780000 ), LONG2CHARS( 0x007C0000 ), LONG2CHARS( 0x007E0000 ), LONG2CHARS( 0x007F0000 ), - LONG2CHARS( 0x007F8000 ), LONG2CHARS( 0x007FC000 ), LONG2CHARS( 0x007FE000 ), LONG2CHARS( 0x007FF000 ), - LONG2CHARS( 0x007FF800 ), LONG2CHARS( 0x007FFC00 ), LONG2CHARS( 0x007FFE00 ), LONG2CHARS( 0x007FFF00 ), - LONG2CHARS( 0x007FFF80 ), LONG2CHARS( 0x007FFFC0 ), LONG2CHARS( 0x007FFFE0 ), LONG2CHARS( 0x007FFFF0 ), - LONG2CHARS( 0x007FFFF8 ), LONG2CHARS( 0x007FFFFC ), LONG2CHARS( 0x007FFFFE ), LONG2CHARS( 0x007FFFFF ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00200000 ), LONG2CHARS( 0x00300000 ), LONG2CHARS( 0x00380000 ), - LONG2CHARS( 0x003C0000 ), LONG2CHARS( 0x003E0000 ), LONG2CHARS( 0x003F0000 ), LONG2CHARS( 0x003F8000 ), - LONG2CHARS( 0x003FC000 ), LONG2CHARS( 0x003FE000 ), LONG2CHARS( 0x003FF000 ), LONG2CHARS( 0x003FF800 ), - LONG2CHARS( 0x003FFC00 ), LONG2CHARS( 0x003FFE00 ), LONG2CHARS( 0x003FFF00 ), LONG2CHARS( 0x003FFF80 ), - LONG2CHARS( 0x003FFFC0 ), LONG2CHARS( 0x003FFFE0 ), LONG2CHARS( 0x003FFFF0 ), LONG2CHARS( 0x003FFFF8 ), - LONG2CHARS( 0x003FFFFC ), LONG2CHARS( 0x003FFFFE ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00100000 ), LONG2CHARS( 0x00180000 ), LONG2CHARS( 0x001C0000 ), - LONG2CHARS( 0x001E0000 ), LONG2CHARS( 0x001F0000 ), LONG2CHARS( 0x001F8000 ), LONG2CHARS( 0x001FC000 ), - LONG2CHARS( 0x001FE000 ), LONG2CHARS( 0x001FF000 ), LONG2CHARS( 0x001FF800 ), LONG2CHARS( 0x001FFC00 ), - LONG2CHARS( 0x001FFE00 ), LONG2CHARS( 0x001FFF00 ), LONG2CHARS( 0x001FFF80 ), LONG2CHARS( 0x001FFFC0 ), - LONG2CHARS( 0x001FFFE0 ), LONG2CHARS( 0x001FFFF0 ), LONG2CHARS( 0x001FFFF8 ), LONG2CHARS( 0x001FFFFC ), - LONG2CHARS( 0x001FFFFE ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00080000 ), LONG2CHARS( 0x000C0000 ), LONG2CHARS( 0x000E0000 ), - LONG2CHARS( 0x000F0000 ), LONG2CHARS( 0x000F8000 ), LONG2CHARS( 0x000FC000 ), LONG2CHARS( 0x000FE000 ), - LONG2CHARS( 0x000FF000 ), LONG2CHARS( 0x000FF800 ), LONG2CHARS( 0x000FFC00 ), LONG2CHARS( 0x000FFE00 ), - LONG2CHARS( 0x000FFF00 ), LONG2CHARS( 0x000FFF80 ), LONG2CHARS( 0x000FFFC0 ), LONG2CHARS( 0x000FFFE0 ), - LONG2CHARS( 0x000FFFF0 ), LONG2CHARS( 0x000FFFF8 ), LONG2CHARS( 0x000FFFFC ), LONG2CHARS( 0x000FFFFE ), - LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00040000 ), LONG2CHARS( 0x00060000 ), LONG2CHARS( 0x00070000 ), - LONG2CHARS( 0x00078000 ), LONG2CHARS( 0x0007C000 ), LONG2CHARS( 0x0007E000 ), LONG2CHARS( 0x0007F000 ), - LONG2CHARS( 0x0007F800 ), LONG2CHARS( 0x0007FC00 ), LONG2CHARS( 0x0007FE00 ), LONG2CHARS( 0x0007FF00 ), - LONG2CHARS( 0x0007FF80 ), LONG2CHARS( 0x0007FFC0 ), LONG2CHARS( 0x0007FFE0 ), LONG2CHARS( 0x0007FFF0 ), - LONG2CHARS( 0x0007FFF8 ), LONG2CHARS( 0x0007FFFC ), LONG2CHARS( 0x0007FFFE ), LONG2CHARS( 0x0007FFFF ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00020000 ), LONG2CHARS( 0x00030000 ), LONG2CHARS( 0x00038000 ), - LONG2CHARS( 0x0003C000 ), LONG2CHARS( 0x0003E000 ), LONG2CHARS( 0x0003F000 ), LONG2CHARS( 0x0003F800 ), - LONG2CHARS( 0x0003FC00 ), LONG2CHARS( 0x0003FE00 ), LONG2CHARS( 0x0003FF00 ), LONG2CHARS( 0x0003FF80 ), - LONG2CHARS( 0x0003FFC0 ), LONG2CHARS( 0x0003FFE0 ), LONG2CHARS( 0x0003FFF0 ), LONG2CHARS( 0x0003FFF8 ), - LONG2CHARS( 0x0003FFFC ), LONG2CHARS( 0x0003FFFE ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00010000 ), LONG2CHARS( 0x00018000 ), LONG2CHARS( 0x0001C000 ), - LONG2CHARS( 0x0001E000 ), LONG2CHARS( 0x0001F000 ), LONG2CHARS( 0x0001F800 ), LONG2CHARS( 0x0001FC00 ), - LONG2CHARS( 0x0001FE00 ), LONG2CHARS( 0x0001FF00 ), LONG2CHARS( 0x0001FF80 ), LONG2CHARS( 0x0001FFC0 ), - LONG2CHARS( 0x0001FFE0 ), LONG2CHARS( 0x0001FFF0 ), LONG2CHARS( 0x0001FFF8 ), LONG2CHARS( 0x0001FFFC ), - LONG2CHARS( 0x0001FFFE ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00008000 ), LONG2CHARS( 0x0000C000 ), LONG2CHARS( 0x0000E000 ), - LONG2CHARS( 0x0000F000 ), LONG2CHARS( 0x0000F800 ), LONG2CHARS( 0x0000FC00 ), LONG2CHARS( 0x0000FE00 ), - LONG2CHARS( 0x0000FF00 ), LONG2CHARS( 0x0000FF80 ), LONG2CHARS( 0x0000FFC0 ), LONG2CHARS( 0x0000FFE0 ), - LONG2CHARS( 0x0000FFF0 ), LONG2CHARS( 0x0000FFF8 ), LONG2CHARS( 0x0000FFFC ), LONG2CHARS( 0x0000FFFE ), - LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00004000 ), LONG2CHARS( 0x00006000 ), LONG2CHARS( 0x00007000 ), - LONG2CHARS( 0x00007800 ), LONG2CHARS( 0x00007C00 ), LONG2CHARS( 0x00007E00 ), LONG2CHARS( 0x00007F00 ), - LONG2CHARS( 0x00007F80 ), LONG2CHARS( 0x00007FC0 ), LONG2CHARS( 0x00007FE0 ), LONG2CHARS( 0x00007FF0 ), - LONG2CHARS( 0x00007FF8 ), LONG2CHARS( 0x00007FFC ), LONG2CHARS( 0x00007FFE ), LONG2CHARS( 0x00007FFF ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00002000 ), LONG2CHARS( 0x00003000 ), LONG2CHARS( 0x00003800 ), - LONG2CHARS( 0x00003C00 ), LONG2CHARS( 0x00003E00 ), LONG2CHARS( 0x00003F00 ), LONG2CHARS( 0x00003F80 ), - LONG2CHARS( 0x00003FC0 ), LONG2CHARS( 0x00003FE0 ), LONG2CHARS( 0x00003FF0 ), LONG2CHARS( 0x00003FF8 ), - LONG2CHARS( 0x00003FFC ), LONG2CHARS( 0x00003FFE ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00001000 ), LONG2CHARS( 0x00001800 ), LONG2CHARS( 0x00001C00 ), - LONG2CHARS( 0x00001E00 ), LONG2CHARS( 0x00001F00 ), LONG2CHARS( 0x00001F80 ), LONG2CHARS( 0x00001FC0 ), - LONG2CHARS( 0x00001FE0 ), LONG2CHARS( 0x00001FF0 ), LONG2CHARS( 0x00001FF8 ), LONG2CHARS( 0x00001FFC ), - LONG2CHARS( 0x00001FFE ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000800 ), LONG2CHARS( 0x00000C00 ), LONG2CHARS( 0x00000E00 ), - LONG2CHARS( 0x00000F00 ), LONG2CHARS( 0x00000F80 ), LONG2CHARS( 0x00000FC0 ), LONG2CHARS( 0x00000FE0 ), - LONG2CHARS( 0x00000FF0 ), LONG2CHARS( 0x00000FF8 ), LONG2CHARS( 0x00000FFC ), LONG2CHARS( 0x00000FFE ), - LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000400 ), LONG2CHARS( 0x00000600 ), LONG2CHARS( 0x00000700 ), - LONG2CHARS( 0x00000780 ), LONG2CHARS( 0x000007C0 ), LONG2CHARS( 0x000007E0 ), LONG2CHARS( 0x000007F0 ), - LONG2CHARS( 0x000007F8 ), LONG2CHARS( 0x000007FC ), LONG2CHARS( 0x000007FE ), LONG2CHARS( 0x000007FF ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000200 ), LONG2CHARS( 0x00000300 ), LONG2CHARS( 0x00000380 ), - LONG2CHARS( 0x000003C0 ), LONG2CHARS( 0x000003E0 ), LONG2CHARS( 0x000003F0 ), LONG2CHARS( 0x000003F8 ), - LONG2CHARS( 0x000003FC ), LONG2CHARS( 0x000003FE ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000100 ), LONG2CHARS( 0x00000180 ), LONG2CHARS( 0x000001C0 ), - LONG2CHARS( 0x000001E0 ), LONG2CHARS( 0x000001F0 ), LONG2CHARS( 0x000001F8 ), LONG2CHARS( 0x000001FC ), - LONG2CHARS( 0x000001FE ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000080 ), LONG2CHARS( 0x000000C0 ), LONG2CHARS( 0x000000E0 ), - LONG2CHARS( 0x000000F0 ), LONG2CHARS( 0x000000F8 ), LONG2CHARS( 0x000000FC ), LONG2CHARS( 0x000000FE ), - LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000040 ), LONG2CHARS( 0x00000060 ), LONG2CHARS( 0x00000070 ), - LONG2CHARS( 0x00000078 ), LONG2CHARS( 0x0000007C ), LONG2CHARS( 0x0000007E ), LONG2CHARS( 0x0000007F ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000020 ), LONG2CHARS( 0x00000030 ), LONG2CHARS( 0x00000038 ), - LONG2CHARS( 0x0000003C ), LONG2CHARS( 0x0000003E ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000010 ), LONG2CHARS( 0x00000018 ), LONG2CHARS( 0x0000001C ), - LONG2CHARS( 0x0000001E ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000008 ), LONG2CHARS( 0x0000000C ), LONG2CHARS( 0x0000000E ), - LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000004 ), LONG2CHARS( 0x00000006 ), LONG2CHARS( 0x00000007 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000002 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, -}; - -#else /* LSBFirst */ -/* NOTE: -the first element in starttab could be LONG2CHARS( 0xffffffff. making it 0 -lets us deal with a full first word in the middle loop ), rather -than having to do the multiple reads and masks that we'd -have to do if we thought it was partial. -*/ -PixelType starttab[PPW+1] = - { - LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0xFFFFFFFE ), - LONG2CHARS( 0xFFFFFFFC ), - LONG2CHARS( 0xFFFFFFF8 ), - LONG2CHARS( 0xFFFFFFF0 ), - LONG2CHARS( 0xFFFFFFE0 ), - LONG2CHARS( 0xFFFFFFC0 ), - LONG2CHARS( 0xFFFFFF80 ), - LONG2CHARS( 0xFFFFFF00 ), - LONG2CHARS( 0xFFFFFE00 ), - LONG2CHARS( 0xFFFFFC00 ), - LONG2CHARS( 0xFFFFF800 ), - LONG2CHARS( 0xFFFFF000 ), - LONG2CHARS( 0xFFFFE000 ), - LONG2CHARS( 0xFFFFC000 ), - LONG2CHARS( 0xFFFF8000 ), - LONG2CHARS( 0xFFFF0000 ), - LONG2CHARS( 0xFFFE0000 ), - LONG2CHARS( 0xFFFC0000 ), - LONG2CHARS( 0xFFF80000 ), - LONG2CHARS( 0xFFF00000 ), - LONG2CHARS( 0xFFE00000 ), - LONG2CHARS( 0xFFC00000 ), - LONG2CHARS( 0xFF800000 ), - LONG2CHARS( 0xFF000000 ), - LONG2CHARS( 0xFE000000 ), - LONG2CHARS( 0xFC000000 ), - LONG2CHARS( 0xF8000000 ), - LONG2CHARS( 0xF0000000 ), - LONG2CHARS( 0xE0000000 ), - LONG2CHARS( 0xC0000000 ), - LONG2CHARS( 0x80000000 ), - LONG2CHARS( 0x00000000 ) - }; - -PixelType endtab[PPW+1] = - { - LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0x00000001 ), - LONG2CHARS( 0x00000003 ), - LONG2CHARS( 0x00000007 ), - LONG2CHARS( 0x0000000F ), - LONG2CHARS( 0x0000001F ), - LONG2CHARS( 0x0000003F ), - LONG2CHARS( 0x0000007F ), - LONG2CHARS( 0x000000FF ), - LONG2CHARS( 0x000001FF ), - LONG2CHARS( 0x000003FF ), - LONG2CHARS( 0x000007FF ), - LONG2CHARS( 0x00000FFF ), - LONG2CHARS( 0x00001FFF ), - LONG2CHARS( 0x00003FFF ), - LONG2CHARS( 0x00007FFF ), - LONG2CHARS( 0x0000FFFF ), - LONG2CHARS( 0x0001FFFF ), - LONG2CHARS( 0x0003FFFF ), - LONG2CHARS( 0x0007FFFF ), - LONG2CHARS( 0x000FFFFF ), - LONG2CHARS( 0x001FFFFF ), - LONG2CHARS( 0x003FFFFF ), - LONG2CHARS( 0x007FFFFF ), - LONG2CHARS( 0x00FFFFFF ), - LONG2CHARS( 0x01FFFFFF ), - LONG2CHARS( 0x03FFFFFF ), - LONG2CHARS( 0x07FFFFFF ), - LONG2CHARS( 0x0FFFFFFF ), - LONG2CHARS( 0x1FFFFFFF ), - LONG2CHARS( 0x3FFFFFFF ), - LONG2CHARS( 0x7FFFFFFF ), - LONG2CHARS( 0xFFFFFFFF ) - }; - - -#ifdef NEED_OLD_MFB_MASKS -/* a hack ), for now, since the entries for 0 need to be all - 1 bits ), not all zeros. - this means the code DOES NOT WORK for segments of length - 0 (which is only a problem in the horizontal line code.) -*/ -PixelType startpartial[33] = - { - LONG2CHARS( 0xFFFFFFFF ), - LONG2CHARS( 0xFFFFFFFE ), - LONG2CHARS( 0xFFFFFFFC ), - LONG2CHARS( 0xFFFFFFF8 ), - LONG2CHARS( 0xFFFFFFF0 ), - LONG2CHARS( 0xFFFFFFE0 ), - LONG2CHARS( 0xFFFFFFC0 ), - LONG2CHARS( 0xFFFFFF80 ), - LONG2CHARS( 0xFFFFFF00 ), - LONG2CHARS( 0xFFFFFE00 ), - LONG2CHARS( 0xFFFFFC00 ), - LONG2CHARS( 0xFFFFF800 ), - LONG2CHARS( 0xFFFFF000 ), - LONG2CHARS( 0xFFFFE000 ), - LONG2CHARS( 0xFFFFC000 ), - LONG2CHARS( 0xFFFF8000 ), - LONG2CHARS( 0xFFFF0000 ), - LONG2CHARS( 0xFFFE0000 ), - LONG2CHARS( 0xFFFC0000 ), - LONG2CHARS( 0xFFF80000 ), - LONG2CHARS( 0xFFF00000 ), - LONG2CHARS( 0xFFE00000 ), - LONG2CHARS( 0xFFC00000 ), - LONG2CHARS( 0xFF800000 ), - LONG2CHARS( 0xFF000000 ), - LONG2CHARS( 0xFE000000 ), - LONG2CHARS( 0xFC000000 ), - LONG2CHARS( 0xF8000000 ), - LONG2CHARS( 0xF0000000 ), - LONG2CHARS( 0xE0000000 ), - LONG2CHARS( 0xC0000000 ), - LONG2CHARS( 0x80000000 ), - LONG2CHARS( 0x00000000 ) - }; - -PixelType endpartial[33] = - { - LONG2CHARS( 0xFFFFFFFF ), - LONG2CHARS( 0x00000001 ), - LONG2CHARS( 0x00000003 ), - LONG2CHARS( 0x00000007 ), - LONG2CHARS( 0x0000000F ), - LONG2CHARS( 0x0000001F ), - LONG2CHARS( 0x0000003F ), - LONG2CHARS( 0x0000007F ), - LONG2CHARS( 0x000000FF ), - LONG2CHARS( 0x000001FF ), - LONG2CHARS( 0x000003FF ), - LONG2CHARS( 0x000007FF ), - LONG2CHARS( 0x00000FFF ), - LONG2CHARS( 0x00001FFF ), - LONG2CHARS( 0x00003FFF ), - LONG2CHARS( 0x00007FFF ), - LONG2CHARS( 0x0000FFFF ), - LONG2CHARS( 0x0001FFFF ), - LONG2CHARS( 0x0003FFFF ), - LONG2CHARS( 0x0007FFFF ), - LONG2CHARS( 0x000FFFFF ), - LONG2CHARS( 0x001FFFFF ), - LONG2CHARS( 0x003FFFFF ), - LONG2CHARS( 0x007FFFFF ), - LONG2CHARS( 0x00FFFFFF ), - LONG2CHARS( 0x01FFFFFF ), - LONG2CHARS( 0x03FFFFFF ), - LONG2CHARS( 0x07FFFFFF ), - LONG2CHARS( 0x0FFFFFFF ), - LONG2CHARS( 0x1FFFFFFF ), - LONG2CHARS( 0x3FFFFFFF ), - LONG2CHARS( 0x7FFFFFFF ), - LONG2CHARS( 0xFFFFFFFF ) - }; -#endif - - -PixelType partmasks[PPW][PPW] = { - {LONG2CHARS( 0xFFFFFFFF ), LONG2CHARS( 0x00000001 ), LONG2CHARS( 0x00000003 ), LONG2CHARS( 0x00000007 ), - LONG2CHARS( 0x0000000F ), LONG2CHARS( 0x0000001F ), LONG2CHARS( 0x0000003F ), LONG2CHARS( 0x0000007F ), - LONG2CHARS( 0x000000FF ), LONG2CHARS( 0x000001FF ), LONG2CHARS( 0x000003FF ), LONG2CHARS( 0x000007FF ), - LONG2CHARS( 0x00000FFF ), LONG2CHARS( 0x00001FFF ), LONG2CHARS( 0x00003FFF ), LONG2CHARS( 0x00007FFF ), - LONG2CHARS( 0x0000FFFF ), LONG2CHARS( 0x0001FFFF ), LONG2CHARS( 0x0003FFFF ), LONG2CHARS( 0x0007FFFF ), - LONG2CHARS( 0x000FFFFF ), LONG2CHARS( 0x001FFFFF ), LONG2CHARS( 0x003FFFFF ), LONG2CHARS( 0x007FFFFF ), - LONG2CHARS( 0x00FFFFFF ), LONG2CHARS( 0x01FFFFFF ), LONG2CHARS( 0x03FFFFFF ), LONG2CHARS( 0x07FFFFFF ), - LONG2CHARS( 0x0FFFFFFF ), LONG2CHARS( 0x1FFFFFFF ), LONG2CHARS( 0x3FFFFFFF ), LONG2CHARS( 0x7FFFFFFF )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000002 ), LONG2CHARS( 0x00000006 ), LONG2CHARS( 0x0000000E ), - LONG2CHARS( 0x0000001E ), LONG2CHARS( 0x0000003E ), LONG2CHARS( 0x0000007E ), LONG2CHARS( 0x000000FE ), - LONG2CHARS( 0x000001FE ), LONG2CHARS( 0x000003FE ), LONG2CHARS( 0x000007FE ), LONG2CHARS( 0x00000FFE ), - LONG2CHARS( 0x00001FFE ), LONG2CHARS( 0x00003FFE ), LONG2CHARS( 0x00007FFE ), LONG2CHARS( 0x0000FFFE ), - LONG2CHARS( 0x0001FFFE ), LONG2CHARS( 0x0003FFFE ), LONG2CHARS( 0x0007FFFE ), LONG2CHARS( 0x000FFFFE ), - LONG2CHARS( 0x001FFFFE ), LONG2CHARS( 0x003FFFFE ), LONG2CHARS( 0x007FFFFE ), LONG2CHARS( 0x00FFFFFE ), - LONG2CHARS( 0x01FFFFFE ), LONG2CHARS( 0x03FFFFFE ), LONG2CHARS( 0x07FFFFFE ), LONG2CHARS( 0x0FFFFFFE ), - LONG2CHARS( 0x1FFFFFFE ), LONG2CHARS( 0x3FFFFFFE ), LONG2CHARS( 0x7FFFFFFE ), LONG2CHARS( 0xFFFFFFFE )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000004 ), LONG2CHARS( 0x0000000C ), LONG2CHARS( 0x0000001C ), - LONG2CHARS( 0x0000003C ), LONG2CHARS( 0x0000007C ), LONG2CHARS( 0x000000FC ), LONG2CHARS( 0x000001FC ), - LONG2CHARS( 0x000003FC ), LONG2CHARS( 0x000007FC ), LONG2CHARS( 0x00000FFC ), LONG2CHARS( 0x00001FFC ), - LONG2CHARS( 0x00003FFC ), LONG2CHARS( 0x00007FFC ), LONG2CHARS( 0x0000FFFC ), LONG2CHARS( 0x0001FFFC ), - LONG2CHARS( 0x0003FFFC ), LONG2CHARS( 0x0007FFFC ), LONG2CHARS( 0x000FFFFC ), LONG2CHARS( 0x001FFFFC ), - LONG2CHARS( 0x003FFFFC ), LONG2CHARS( 0x007FFFFC ), LONG2CHARS( 0x00FFFFFC ), LONG2CHARS( 0x01FFFFFC ), - LONG2CHARS( 0x03FFFFFC ), LONG2CHARS( 0x07FFFFFC ), LONG2CHARS( 0x0FFFFFFC ), LONG2CHARS( 0x1FFFFFFC ), - LONG2CHARS( 0x3FFFFFFC ), LONG2CHARS( 0x7FFFFFFC ), LONG2CHARS( 0xFFFFFFFC ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000008 ), LONG2CHARS( 0x00000018 ), LONG2CHARS( 0x00000038 ), - LONG2CHARS( 0x00000078 ), LONG2CHARS( 0x000000F8 ), LONG2CHARS( 0x000001F8 ), LONG2CHARS( 0x000003F8 ), - LONG2CHARS( 0x000007F8 ), LONG2CHARS( 0x00000FF8 ), LONG2CHARS( 0x00001FF8 ), LONG2CHARS( 0x00003FF8 ), - LONG2CHARS( 0X00007FF8 ), LONG2CHARS( 0x0000FFF8 ), LONG2CHARS( 0x0001FFF8 ), LONG2CHARS( 0x0003FFF8 ), - LONG2CHARS( 0X0007FFF8 ), LONG2CHARS( 0x000FFFF8 ), LONG2CHARS( 0x001FFFF8 ), LONG2CHARS( 0x003FFFF8 ), - LONG2CHARS( 0X007FFFF8 ), LONG2CHARS( 0x00FFFFF8 ), LONG2CHARS( 0x01FFFFF8 ), LONG2CHARS( 0x03FFFFF8 ), - LONG2CHARS( 0X07FFFFF8 ), LONG2CHARS( 0x0FFFFFF8 ), LONG2CHARS( 0x1FFFFFF8 ), LONG2CHARS( 0x3FFFFFF8 ), - LONG2CHARS( 0X7FFFFFF8 ), LONG2CHARS( 0xFFFFFFF8 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000010 ), LONG2CHARS( 0x00000030 ), LONG2CHARS( 0x00000070 ), - LONG2CHARS( 0X000000F0 ), LONG2CHARS( 0x000001F0 ), LONG2CHARS( 0x000003F0 ), LONG2CHARS( 0x000007F0 ), - LONG2CHARS( 0X00000FF0 ), LONG2CHARS( 0x00001FF0 ), LONG2CHARS( 0x00003FF0 ), LONG2CHARS( 0x00007FF0 ), - LONG2CHARS( 0X0000FFF0 ), LONG2CHARS( 0x0001FFF0 ), LONG2CHARS( 0x0003FFF0 ), LONG2CHARS( 0x0007FFF0 ), - LONG2CHARS( 0X000FFFF0 ), LONG2CHARS( 0x001FFFF0 ), LONG2CHARS( 0x003FFFF0 ), LONG2CHARS( 0x007FFFF0 ), - LONG2CHARS( 0X00FFFFF0 ), LONG2CHARS( 0x01FFFFF0 ), LONG2CHARS( 0x03FFFFF0 ), LONG2CHARS( 0x07FFFFF0 ), - LONG2CHARS( 0X0FFFFFF0 ), LONG2CHARS( 0x1FFFFFF0 ), LONG2CHARS( 0x3FFFFFF0 ), LONG2CHARS( 0x7FFFFFF0 ), - LONG2CHARS( 0XFFFFFFF0 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000020 ), LONG2CHARS( 0x00000060 ), LONG2CHARS( 0x000000E0 ), - LONG2CHARS( 0X000001E0 ), LONG2CHARS( 0x000003E0 ), LONG2CHARS( 0x000007E0 ), LONG2CHARS( 0x00000FE0 ), - LONG2CHARS( 0X00001FE0 ), LONG2CHARS( 0x00003FE0 ), LONG2CHARS( 0x00007FE0 ), LONG2CHARS( 0x0000FFE0 ), - LONG2CHARS( 0X0001FFE0 ), LONG2CHARS( 0x0003FFE0 ), LONG2CHARS( 0x0007FFE0 ), LONG2CHARS( 0x000FFFE0 ), - LONG2CHARS( 0X001FFFE0 ), LONG2CHARS( 0x003FFFE0 ), LONG2CHARS( 0x007FFFE0 ), LONG2CHARS( 0x00FFFFE0 ), - LONG2CHARS( 0X01FFFFE0 ), LONG2CHARS( 0x03FFFFE0 ), LONG2CHARS( 0x07FFFFE0 ), LONG2CHARS( 0x0FFFFFE0 ), - LONG2CHARS( 0X1FFFFFE0 ), LONG2CHARS( 0x3FFFFFE0 ), LONG2CHARS( 0x7FFFFFE0 ), LONG2CHARS( 0xFFFFFFE0 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000040 ), LONG2CHARS( 0x000000C0 ), LONG2CHARS( 0x000001C0 ), - LONG2CHARS( 0X000003C0 ), LONG2CHARS( 0x000007C0 ), LONG2CHARS( 0x00000FC0 ), LONG2CHARS( 0x00001FC0 ), - LONG2CHARS( 0X00003FC0 ), LONG2CHARS( 0x00007FC0 ), LONG2CHARS( 0x0000FFC0 ), LONG2CHARS( 0x0001FFC0 ), - LONG2CHARS( 0X0003FFC0 ), LONG2CHARS( 0x0007FFC0 ), LONG2CHARS( 0x000FFFC0 ), LONG2CHARS( 0x001FFFC0 ), - LONG2CHARS( 0X003FFFC0 ), LONG2CHARS( 0x007FFFC0 ), LONG2CHARS( 0x00FFFFC0 ), LONG2CHARS( 0x01FFFFC0 ), - LONG2CHARS( 0X03FFFFC0 ), LONG2CHARS( 0x07FFFFC0 ), LONG2CHARS( 0x0FFFFFC0 ), LONG2CHARS( 0x1FFFFFC0 ), - LONG2CHARS( 0X3FFFFFC0 ), LONG2CHARS( 0x7FFFFFC0 ), LONG2CHARS( 0xFFFFFFC0 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000080 ), LONG2CHARS( 0x00000180 ), LONG2CHARS( 0x00000380 ), - LONG2CHARS( 0X00000780 ), LONG2CHARS( 0x00000F80 ), LONG2CHARS( 0x00001F80 ), LONG2CHARS( 0x00003F80 ), - LONG2CHARS( 0X00007F80 ), LONG2CHARS( 0x0000FF80 ), LONG2CHARS( 0x0001FF80 ), LONG2CHARS( 0x0003FF80 ), - LONG2CHARS( 0X0007FF80 ), LONG2CHARS( 0x000FFF80 ), LONG2CHARS( 0x001FFF80 ), LONG2CHARS( 0x003FFF80 ), - LONG2CHARS( 0X007FFF80 ), LONG2CHARS( 0x00FFFF80 ), LONG2CHARS( 0x01FFFF80 ), LONG2CHARS( 0x03FFFF80 ), - LONG2CHARS( 0X07FFFF80 ), LONG2CHARS( 0x0FFFFF80 ), LONG2CHARS( 0x1FFFFF80 ), LONG2CHARS( 0x3FFFFF80 ), - LONG2CHARS( 0X7FFFFF80 ), LONG2CHARS( 0xFFFFFF80 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000100 ), LONG2CHARS( 0x00000300 ), LONG2CHARS( 0x00000700 ), - LONG2CHARS( 0X00000F00 ), LONG2CHARS( 0x00001F00 ), LONG2CHARS( 0x00003F00 ), LONG2CHARS( 0x00007F00 ), - LONG2CHARS( 0X0000FF00 ), LONG2CHARS( 0x0001FF00 ), LONG2CHARS( 0x0003FF00 ), LONG2CHARS( 0x0007FF00 ), - LONG2CHARS( 0X000FFF00 ), LONG2CHARS( 0x001FFF00 ), LONG2CHARS( 0x003FFF00 ), LONG2CHARS( 0x007FFF00 ), - LONG2CHARS( 0X00FFFF00 ), LONG2CHARS( 0x01FFFF00 ), LONG2CHARS( 0x03FFFF00 ), LONG2CHARS( 0x07FFFF00 ), - LONG2CHARS( 0X0FFFFF00 ), LONG2CHARS( 0x1FFFFF00 ), LONG2CHARS( 0x3FFFFF00 ), LONG2CHARS( 0x7FFFFF00 ), - LONG2CHARS( 0XFFFFFF00 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000200 ), LONG2CHARS( 0x00000600 ), LONG2CHARS( 0x00000E00 ), - LONG2CHARS( 0X00001E00 ), LONG2CHARS( 0x00003E00 ), LONG2CHARS( 0x00007E00 ), LONG2CHARS( 0x0000FE00 ), - LONG2CHARS( 0X0001FE00 ), LONG2CHARS( 0x0003FE00 ), LONG2CHARS( 0x0007FE00 ), LONG2CHARS( 0x000FFE00 ), - LONG2CHARS( 0X001FFE00 ), LONG2CHARS( 0x003FFE00 ), LONG2CHARS( 0x007FFE00 ), LONG2CHARS( 0x00FFFE00 ), - LONG2CHARS( 0X01FFFE00 ), LONG2CHARS( 0x03FFFE00 ), LONG2CHARS( 0x07FFFE00 ), LONG2CHARS( 0x0FFFFE00 ), - LONG2CHARS( 0X1FFFFE00 ), LONG2CHARS( 0x3FFFFE00 ), LONG2CHARS( 0x7FFFFE00 ), LONG2CHARS( 0xFFFFFE00 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000400 ), LONG2CHARS( 0x00000C00 ), LONG2CHARS( 0x00001C00 ), - LONG2CHARS( 0X00003C00 ), LONG2CHARS( 0x00007C00 ), LONG2CHARS( 0x0000FC00 ), LONG2CHARS( 0x0001FC00 ), - LONG2CHARS( 0X0003FC00 ), LONG2CHARS( 0x0007FC00 ), LONG2CHARS( 0x000FFC00 ), LONG2CHARS( 0x001FFC00 ), - LONG2CHARS( 0X003FFC00 ), LONG2CHARS( 0x007FFC00 ), LONG2CHARS( 0x00FFFC00 ), LONG2CHARS( 0x01FFFC00 ), - LONG2CHARS( 0X03FFFC00 ), LONG2CHARS( 0x07FFFC00 ), LONG2CHARS( 0x0FFFFC00 ), LONG2CHARS( 0x1FFFFC00 ), - LONG2CHARS( 0X3FFFFC00 ), LONG2CHARS( 0x7FFFFC00 ), LONG2CHARS( 0xFFFFFC00 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000800 ), LONG2CHARS( 0x00001800 ), LONG2CHARS( 0x00003800 ), - LONG2CHARS( 0X00007800 ), LONG2CHARS( 0x0000F800 ), LONG2CHARS( 0x0001F800 ), LONG2CHARS( 0x0003F800 ), - LONG2CHARS( 0X0007F800 ), LONG2CHARS( 0x000FF800 ), LONG2CHARS( 0x001FF800 ), LONG2CHARS( 0x003FF800 ), - LONG2CHARS( 0X007FF800 ), LONG2CHARS( 0x00FFF800 ), LONG2CHARS( 0x01FFF800 ), LONG2CHARS( 0x03FFF800 ), - LONG2CHARS( 0X07FFF800 ), LONG2CHARS( 0x0FFFF800 ), LONG2CHARS( 0x1FFFF800 ), LONG2CHARS( 0x3FFFF800 ), - LONG2CHARS( 0X7FFFF800 ), LONG2CHARS( 0xFFFFF800 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00001000 ), LONG2CHARS( 0x00003000 ), LONG2CHARS( 0x00007000 ), - LONG2CHARS( 0X0000F000 ), LONG2CHARS( 0x0001F000 ), LONG2CHARS( 0x0003F000 ), LONG2CHARS( 0x0007F000 ), - LONG2CHARS( 0X000FF000 ), LONG2CHARS( 0x001FF000 ), LONG2CHARS( 0x003FF000 ), LONG2CHARS( 0x007FF000 ), - LONG2CHARS( 0X00FFF000 ), LONG2CHARS( 0x01FFF000 ), LONG2CHARS( 0x03FFF000 ), LONG2CHARS( 0x07FFF000 ), - LONG2CHARS( 0X0FFFF000 ), LONG2CHARS( 0x1FFFF000 ), LONG2CHARS( 0x3FFFF000 ), LONG2CHARS( 0x7FFFF000 ), - LONG2CHARS( 0XFFFFF000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00002000 ), LONG2CHARS( 0x00006000 ), LONG2CHARS( 0x0000E000 ), - LONG2CHARS( 0X0001E000 ), LONG2CHARS( 0x0003E000 ), LONG2CHARS( 0x0007E000 ), LONG2CHARS( 0x000FE000 ), - LONG2CHARS( 0X001FE000 ), LONG2CHARS( 0x003FE000 ), LONG2CHARS( 0x007FE000 ), LONG2CHARS( 0x00FFE000 ), - LONG2CHARS( 0X01FFE000 ), LONG2CHARS( 0x03FFE000 ), LONG2CHARS( 0x07FFE000 ), LONG2CHARS( 0x0FFFE000 ), - LONG2CHARS( 0X1FFFE000 ), LONG2CHARS( 0x3FFFE000 ), LONG2CHARS( 0x7FFFE000 ), LONG2CHARS( 0xFFFFE000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00004000 ), LONG2CHARS( 0x0000C000 ), LONG2CHARS( 0x0001C000 ), - LONG2CHARS( 0X0003C000 ), LONG2CHARS( 0x0007C000 ), LONG2CHARS( 0x000FC000 ), LONG2CHARS( 0x001FC000 ), - LONG2CHARS( 0X003FC000 ), LONG2CHARS( 0x007FC000 ), LONG2CHARS( 0x00FFC000 ), LONG2CHARS( 0x01FFC000 ), - LONG2CHARS( 0X03FFC000 ), LONG2CHARS( 0x07FFC000 ), LONG2CHARS( 0x0FFFC000 ), LONG2CHARS( 0x1FFFC000 ), - LONG2CHARS( 0X3FFFC000 ), LONG2CHARS( 0x7FFFC000 ), LONG2CHARS( 0xFFFFC000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00008000 ), LONG2CHARS( 0x00018000 ), LONG2CHARS( 0x00038000 ), - LONG2CHARS( 0X00078000 ), LONG2CHARS( 0x000F8000 ), LONG2CHARS( 0x001F8000 ), LONG2CHARS( 0x003F8000 ), - LONG2CHARS( 0X007F8000 ), LONG2CHARS( 0x00FF8000 ), LONG2CHARS( 0x01FF8000 ), LONG2CHARS( 0x03FF8000 ), - LONG2CHARS( 0X07FF8000 ), LONG2CHARS( 0x0FFF8000 ), LONG2CHARS( 0x1FFF8000 ), LONG2CHARS( 0x3FFF8000 ), - LONG2CHARS( 0X7FFF8000 ), LONG2CHARS( 0xFFFF8000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00010000 ), LONG2CHARS( 0x00030000 ), LONG2CHARS( 0x00070000 ), - LONG2CHARS( 0X000F0000 ), LONG2CHARS( 0x001F0000 ), LONG2CHARS( 0x003F0000 ), LONG2CHARS( 0x007F0000 ), - LONG2CHARS( 0X00FF0000 ), LONG2CHARS( 0x01FF0000 ), LONG2CHARS( 0x03FF0000 ), LONG2CHARS( 0x07FF0000 ), - LONG2CHARS( 0X0FFF0000 ), LONG2CHARS( 0x1FFF0000 ), LONG2CHARS( 0x3FFF0000 ), LONG2CHARS( 0x7FFF0000 ), - LONG2CHARS( 0XFFFF0000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00020000 ), LONG2CHARS( 0x00060000 ), LONG2CHARS( 0x000E0000 ), - LONG2CHARS( 0X001E0000 ), LONG2CHARS( 0x003E0000 ), LONG2CHARS( 0x007E0000 ), LONG2CHARS( 0x00FE0000 ), - LONG2CHARS( 0X01FE0000 ), LONG2CHARS( 0x03FE0000 ), LONG2CHARS( 0x07FE0000 ), LONG2CHARS( 0x0FFE0000 ), - LONG2CHARS( 0X1FFE0000 ), LONG2CHARS( 0x3FFE0000 ), LONG2CHARS( 0x7FFE0000 ), LONG2CHARS( 0xFFFE0000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00040000 ), LONG2CHARS( 0x000C0000 ), LONG2CHARS( 0x001C0000 ), - LONG2CHARS( 0X003C0000 ), LONG2CHARS( 0x007C0000 ), LONG2CHARS( 0x00FC0000 ), LONG2CHARS( 0x01FC0000 ), - LONG2CHARS( 0X03FC0000 ), LONG2CHARS( 0x07FC0000 ), LONG2CHARS( 0x0FFC0000 ), LONG2CHARS( 0x1FFC0000 ), - LONG2CHARS( 0X3FFC0000 ), LONG2CHARS( 0x7FFC0000 ), LONG2CHARS( 0xFFFC0000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00080000 ), LONG2CHARS( 0x00180000 ), LONG2CHARS( 0x00380000 ), - LONG2CHARS( 0X00780000 ), LONG2CHARS( 0x00F80000 ), LONG2CHARS( 0x01F80000 ), LONG2CHARS( 0x03F80000 ), - LONG2CHARS( 0X07F80000 ), LONG2CHARS( 0x0FF80000 ), LONG2CHARS( 0x1FF80000 ), LONG2CHARS( 0x3FF80000 ), - LONG2CHARS( 0X7FF80000 ), LONG2CHARS( 0xFFF80000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00100000 ), LONG2CHARS( 0x00300000 ), LONG2CHARS( 0x00700000 ), - LONG2CHARS( 0X00F00000 ), LONG2CHARS( 0x01F00000 ), LONG2CHARS( 0x03F00000 ), LONG2CHARS( 0x07F00000 ), - LONG2CHARS( 0X0FF00000 ), LONG2CHARS( 0x1FF00000 ), LONG2CHARS( 0x3FF00000 ), LONG2CHARS( 0x7FF00000 ), - LONG2CHARS( 0XFFF00000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00200000 ), LONG2CHARS( 0x00600000 ), LONG2CHARS( 0x00E00000 ), - LONG2CHARS( 0X01E00000 ), LONG2CHARS( 0x03E00000 ), LONG2CHARS( 0x07E00000 ), LONG2CHARS( 0x0FE00000 ), - LONG2CHARS( 0X1FE00000 ), LONG2CHARS( 0x3FE00000 ), LONG2CHARS( 0x7FE00000 ), LONG2CHARS( 0xFFE00000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00400000 ), LONG2CHARS( 0x00C00000 ), LONG2CHARS( 0x01C00000 ), - LONG2CHARS( 0X03C00000 ), LONG2CHARS( 0x07C00000 ), LONG2CHARS( 0x0FC00000 ), LONG2CHARS( 0x1FC00000 ), - LONG2CHARS( 0X3FC00000 ), LONG2CHARS( 0x7FC00000 ), LONG2CHARS( 0xFFC00000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00800000 ), LONG2CHARS( 0x01800000 ), LONG2CHARS( 0x03800000 ), - LONG2CHARS( 0X07800000 ), LONG2CHARS( 0x0F800000 ), LONG2CHARS( 0x1F800000 ), LONG2CHARS( 0x3F800000 ), - LONG2CHARS( 0X7F800000 ), LONG2CHARS( 0xFF800000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x01000000 ), LONG2CHARS( 0x03000000 ), LONG2CHARS( 0x07000000 ), - LONG2CHARS( 0X0F000000 ), LONG2CHARS( 0x1F000000 ), LONG2CHARS( 0x3F000000 ), LONG2CHARS( 0x7F000000 ), - LONG2CHARS( 0XFF000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x02000000 ), LONG2CHARS( 0x06000000 ), LONG2CHARS( 0x0E000000 ), - LONG2CHARS( 0X1E000000 ), LONG2CHARS( 0x3E000000 ), LONG2CHARS( 0x7E000000 ), LONG2CHARS( 0xFE000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x04000000 ), LONG2CHARS( 0x0C000000 ), LONG2CHARS( 0x1C000000 ), - LONG2CHARS( 0X3C000000 ), LONG2CHARS( 0x7C000000 ), LONG2CHARS( 0xFC000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x08000000 ), LONG2CHARS( 0x18000000 ), LONG2CHARS( 0x38000000 ), - LONG2CHARS( 0X78000000 ), LONG2CHARS( 0xF8000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x10000000 ), LONG2CHARS( 0x30000000 ), LONG2CHARS( 0x70000000 ), - LONG2CHARS( 0XF0000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x20000000 ), LONG2CHARS( 0x60000000 ), LONG2CHARS( 0xE0000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x40000000 ), LONG2CHARS( 0xC0000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, - {LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x80000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), - LONG2CHARS( 0X00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 ), LONG2CHARS( 0x00000000 )}, -}; - -#endif /* BITMAP_BIT_ORDER */ - -/* used for masking bits in bresenham lines - mask[n] is used to mask out all but bit n in a longword (n is a -screen position). - rmask[n] is used to mask out the single bit at position n (n -is a screen posiotion.) -*/ - -#define _1_ ((PixelType)1) - -#if (BITMAP_BIT_ORDER == MSBFirst) -PixelType mask[PPW] = - { - LONG2CHARS( _1_<<31 ), LONG2CHARS( 1<<30 ), LONG2CHARS( 1<<29 ), - LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<26 ), - LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<23 ), - LONG2CHARS( 1<<22 ), LONG2CHARS( 1<<21 ), LONG2CHARS( 1<<20 ), - LONG2CHARS( 1<<19 ), LONG2CHARS( 1<<18 ), LONG2CHARS( 1<<17 ), - LONG2CHARS( 1<<16 ), LONG2CHARS( 1<<15 ), LONG2CHARS( 1<<14 ), - LONG2CHARS( 1<<13 ), LONG2CHARS( 1<<12 ), LONG2CHARS( 1<<11 ), - LONG2CHARS( 1<<10 ), LONG2CHARS( 1<<9 ), LONG2CHARS( 1<<8 ), - LONG2CHARS( 1<<7 ), LONG2CHARS( 1<<6 ), LONG2CHARS( 1<<5 ), - LONG2CHARS( 1<<4 ), LONG2CHARS( 1<<3 ), LONG2CHARS( 1<<2 ), - LONG2CHARS( 1<<1 ), LONG2CHARS( 1<<0 ) - }; - -PixelType rmask[] = - { - 0xffffffff ^ LONG2CHARS( _1_<<31 ), 0xffffffff ^ LONG2CHARS( 1<<30 ), - 0xffffffff ^ LONG2CHARS( 1<<29 ), 0xffffffff ^ LONG2CHARS( 1<<28), - 0xffffffff ^ LONG2CHARS( 1<<27 ), 0xffffffff ^ LONG2CHARS( 1<<26), - 0xffffffff ^ LONG2CHARS( 1<<25 ), 0xffffffff ^ LONG2CHARS( 1<<24 ), - 0xffffffff ^ LONG2CHARS( 1<<23 ), 0xffffffff ^ LONG2CHARS( 1<<22), - 0xffffffff ^ LONG2CHARS( 1<<21 ), 0xffffffff ^ LONG2CHARS( 1<<20), - 0xffffffff ^ LONG2CHARS( 1<<19 ), 0xffffffff ^ LONG2CHARS( 1<<18 ), - 0xffffffff ^ LONG2CHARS( 1<<17 ), 0xffffffff ^ LONG2CHARS( 1<<16), - 0xffffffff ^ LONG2CHARS( 1<<15 ), 0xffffffff ^ LONG2CHARS( 1<<14), - 0xffffffff ^ LONG2CHARS( 1<<13 ), 0xffffffff ^ LONG2CHARS( 1<<12 ), - 0xffffffff ^ LONG2CHARS( 1<<11 ), 0xffffffff ^ LONG2CHARS( 1<<10), - 0xffffffff ^ LONG2CHARS( 1<<9 ), 0xffffffff ^ LONG2CHARS( 1<<8), - 0xffffffff ^ LONG2CHARS( 1<<7 ), 0xffffffff ^ LONG2CHARS( 1<<6), - 0xffffffff ^ LONG2CHARS( 1<<5 ), 0xffffffff ^ LONG2CHARS( 1<<4), - 0xffffffff ^ LONG2CHARS( 1<<3 ), 0xffffffff ^ LONG2CHARS( 1<<2), - 0xffffffff ^ LONG2CHARS( 1<<1 ), 0xffffffff ^ LONG2CHARS( 1<<0) - }; -#else /* LSBFirst */ -PixelType mask[] = - { - LONG2CHARS( 1<<0 ), LONG2CHARS( 1<<1 ), LONG2CHARS( 1<<2), - LONG2CHARS( 1<<3 ), LONG2CHARS( 1<<4 ), LONG2CHARS( 1<<5), - LONG2CHARS( 1<<6 ), LONG2CHARS( 1<<7 ), LONG2CHARS( 1<<8), - LONG2CHARS( 1<<9 ), LONG2CHARS( 1<<10 ), LONG2CHARS( 1<<11), - LONG2CHARS( 1<<12 ), LONG2CHARS( 1<<13 ), LONG2CHARS( 1<<14), - LONG2CHARS( 1<<15 ), LONG2CHARS( 1<<16 ), LONG2CHARS( 1<<17), - LONG2CHARS( 1<<18 ), LONG2CHARS( 1<<19 ), LONG2CHARS( 1<<20), - LONG2CHARS( 1<<21 ), LONG2CHARS( 1<<22 ), LONG2CHARS( 1<<23), - LONG2CHARS( 1<<24 ), LONG2CHARS( 1<<25 ), LONG2CHARS( 1<<26), - LONG2CHARS( 1<<27 ), LONG2CHARS( 1<<28 ), LONG2CHARS( 1<<29), - LONG2CHARS( 1<<30 ), LONG2CHARS( _1_<<31 ) - }; -PixelType rmask[] = - { - 0xffffffff ^ LONG2CHARS( 1<<0), 0xffffffff ^ LONG2CHARS( 1<<1), - 0xffffffff ^ LONG2CHARS( 1<<2), 0xffffffff ^ LONG2CHARS( 1<<3), - 0xffffffff ^ LONG2CHARS( 1<<4), 0xffffffff ^ LONG2CHARS( 1<<5), - 0xffffffff ^ LONG2CHARS( 1<<6), 0xffffffff ^ LONG2CHARS( 1<<7), - 0xffffffff ^ LONG2CHARS( 1<<8), 0xffffffff ^ LONG2CHARS( 1<<9), - 0xffffffff ^ LONG2CHARS( 1<<10), 0xffffffff ^ LONG2CHARS( 1<<11), - 0xffffffff ^ LONG2CHARS( 1<<12), 0xffffffff ^ LONG2CHARS( 1<<13), - 0xffffffff ^ LONG2CHARS( 1<<14), 0xffffffff ^ LONG2CHARS( 1<<15), - 0xffffffff ^ LONG2CHARS( 1<<16), 0xffffffff ^ LONG2CHARS( 1<<17), - 0xffffffff ^ LONG2CHARS( 1<<18), 0xffffffff ^ LONG2CHARS( 1<<19), - 0xffffffff ^ LONG2CHARS( 1<<20), 0xffffffff ^ LONG2CHARS( 1<<21), - 0xffffffff ^ LONG2CHARS( 1<<22), 0xffffffff ^ LONG2CHARS( 1<<23), - 0xffffffff ^ LONG2CHARS( 1<<24), 0xffffffff ^ LONG2CHARS( 1<<25), - 0xffffffff ^ LONG2CHARS( 1<<26), 0xffffffff ^ LONG2CHARS( 1<<27), - 0xffffffff ^ LONG2CHARS( 1<<28), 0xffffffff ^ LONG2CHARS( 1<<29), - 0xffffffff ^ LONG2CHARS( 1<<30), 0xffffffff ^ LONG2CHARS( _1_<<31) - }; -#endif /* BITMAP_BIT_ORDER */ - -#undef _1_ - -PixelType mfbGetmask(int i) { return mask[i]; } -PixelType mfbGetrmask(int i) { return rmask[i]; } -PixelType mfbGetstarttab(int i) { return starttab[i]; } -PixelType mfbGetendtab(int i) { return endtab[i]; } -PixelType mfbGetpartmasks(int i, int j) { return partmasks[i][j]; } - -/* - * Merge raster ops for full src + dest + plane mask - * - * More clever usage of boolean arithmetic to reduce the - * cost of complex raster ops. This is for bitblt and - * reduces all 16 raster ops + planemask to a single - * expression: - * - * dst = dst & (src & ca1 ^ cx1) ^ (src & ca2 ^ cx2) - * - * The array below contains the values for c?? for each - * raster op. Those values are further modified by - * planemasks on multi-plane displays as follows: - * - * ca1 &= pm; - * cx1 |= ~pm; - * ca2 &= pm; - * cx2 &= pm; - */ - -#include "mergerop.h" - -#define O 0 -#define I ~((MfbBits)0) - -mergeRopRec mergeRopBits[16] = { -{ O,O,O,O, }, /* clear 0x0 0 */ -{ I,O,O,O, }, /* and 0x1 src AND dst */ -{ I,O,I,O, }, /* andReverse 0x2 src AND NOT dst */ -{ O,O,I,O, }, /* copy 0x3 src */ -{ I,I,O,O, }, /* andInverted 0x4 NOT src AND dst */ -{ O,I,O,O, }, /* noop 0x5 dst */ -{ O,I,I,O, }, /* xor 0x6 src XOR dst */ -{ I,I,I,O, }, /* or 0x7 src OR dst */ -{ I,I,I,I, }, /* nor 0x8 NOT src AND NOT dst */ -{ O,I,I,I, }, /* equiv 0x9 NOT src XOR dst */ -{ O,I,O,I, }, /* invert 0xa NOT dst */ -{ I,I,O,I, }, /* orReverse 0xb src OR NOT dst */ -{ O,O,I,I, }, /* copyInverted 0xc NOT src */ -{ I,O,I,I, }, /* orInverted 0xd NOT src OR dst */ -{ I,O,O,I, }, /* nand 0xe NOT src OR NOT dst */ -{ O,O,O,I, }, /* set 0xf 1 */ -}; - -mergeRopPtr mergeGetRopBits(int i) { - return &mergeRopBits[i]; -} - -#undef O -#undef I diff --git a/mfb/maskbits.h b/mfb/maskbits.h deleted file mode 100644 index 36a611fe7..000000000 --- a/mfb/maskbits.h +++ /dev/null @@ -1,689 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */ -/*********************************************************** -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" - - -/* the following notes use the following conventions: -SCREEN LEFT SCREEN RIGHT -in this file and maskbits.c, left and right refer to screen coordinates, -NOT bit numbering in registers. - -starttab[n] - bits[0,n-1] = 0 bits[n,PLST] = 1 -endtab[n] = - bits[0,n-1] = 1 bits[n,PLST] = 0 - -startpartial[], endpartial[] - these are used as accelerators for doing putbits and masking out -bits that are all contained between longword boudaries. the extra -256 bytes of data seems a small price to pay -- code is smaller, -and narrow things (e.g. window borders) go faster. - -the names may seem misleading; they are derived not from which end -of the word the bits are turned on, but at which end of a scanline -the table tends to be used. - -look at the tables and macros to understand boundary conditions. -(careful readers will note that starttab[n] = ~endtab[n] for n != 0) - ------------------------------------------------------------------------ -these two macros depend on the screen's bit ordering. -in both of them x is a screen position. they are used to -combine bits collected from multiple longwords into a -single destination longword, and to unpack a single -source longword into multiple destinations. - -SCRLEFT(dst, x) - takes dst[x, PPW] and moves them to dst[0, PPW-x] - the contents of the rest of dst are 0. - this is a right shift on LSBFirst (forward-thinking) - machines like the VAX, and left shift on MSBFirst - (backwards) machines like the 680x0 and pc/rt. - -SCRRIGHT(dst, x) - takes dst[0,x] and moves them to dst[PPW-x, PPW] - the contents of the rest of dst are 0. - this is a left shift on LSBFirst, right shift - on MSBFirst. - - -the remaining macros are cpu-independent; all bit order dependencies -are built into the tables and the two macros above. - -maskbits(x, w, startmask, endmask, nlw) - for a span of width w starting at position x, returns -a mask for ragged bits at start, mask for ragged bits at end, -and the number of whole longwords between the ends. - -maskpartialbits(x, w, mask) - works like maskbits(), except all the bits are in the - same longword (i.e. (x&PIM + w) <= PPW) - -maskPPWbits(x, w, startmask, endmask, nlw) - as maskbits, but does not calculate nlw. it is used by - mfbGlyphBlt to put down glyphs <= PPW bits wide. - -------------------------------------------------------------------- - -NOTE - any pointers passed to the following 4 macros are - guranteed to be PPW-bit aligned. - The only non-PPW-bit-aligned references ever made are - to font glyphs, and those are made with getleftbits() - and getshiftedleftbits (qq.v.) - - For 64-bit server, it is assumed that we will never have font padding - of more than 4 bytes. The code uses int's to access the fonts - intead of longs. - -getbits(psrc, x, w, dst) - starting at position x in psrc (x < PPW), collect w - bits and put them in the screen left portion of dst. - psrc is a longword pointer. this may span longword boundaries. - it special-cases fetching all w bits from one longword. - - +--------+--------+ +--------+ - | | m |n| | ==> | m |n| | - +--------+--------+ +--------+ - x x+w 0 w - psrc psrc+1 dst - m = PPW - x - n = w - m - - implementation: - get m bits, move to screen-left of dst, zeroing rest of dst; - get n bits from next word, move screen-right by m, zeroing - lower m bits of word. - OR the two things together. - -putbits(src, x, w, pdst) - starting at position x in pdst, put down the screen-leftmost - w bits of src. pdst is a longword pointer. this may - span longword boundaries. - it special-cases putting all w bits into the same longword. - - +--------+ +--------+--------+ - | m |n| | ==> | | m |n| | - +--------+ +--------+--------+ - 0 w x x+w - dst pdst pdst+1 - m = PPW - x - n = w - m - - implementation: - get m bits, shift screen-right by x, zero screen-leftmost x - bits; zero rightmost m bits of *pdst and OR in stuff - from before the semicolon. - shift src screen-left by m, zero bits n-PPW; - zero leftmost n bits of *(pdst+1) and OR in the - stuff from before the semicolon. - -putbitsrop(src, x, w, pdst, ROP) - like putbits but calls DoRop with the rasterop ROP (see mfb.h for - DoRop) - -putbitsrrop(src, x, w, pdst, ROP) - like putbits but calls DoRRop with the reduced rasterop ROP - (see mfb.h for DoRRop) - ------------------------------------------------------------------------ - The two macros below are used only for getting bits from glyphs -in fonts, and glyphs in fonts are gotten only with the following two -mcros. - You should tune these macros toyour font format and cpu -byte ordering. - -NOTE -getleftbits(psrc, w, dst) - get the leftmost w (w<=32) bits from *psrc and put them - in dst. this is used by the mfbGlyphBlt code for glyphs - <=PPW bits wide. - psrc is declared (unsigned char *) - - psrc is NOT guaranteed to be PPW-bit aligned. on many - machines this will cause problems, so there are several - versions of this macro. - - this macro is called ONLY for getting bits from font glyphs, - and depends on the server-natural font padding. - - for blazing text performance, you want this macro - to touch memory as infrequently as possible (e.g. - fetch longwords) and as efficiently as possible - (e.g. don't fetch misaligned longwords) - -getshiftedleftbits(psrc, offset, w, dst) - used by the font code; like getleftbits, but shifts the - bits SCRLEFT by offset. - this is implemented portably, calling getleftbits() - and SCRLEFT(). - psrc is declared (unsigned char *). -*/ - -/* to match CFB and allow algorithm sharing ... - * name mfb32 mfb64 explanation - * ---- ------ ----- ----------- - * PGSZ 32 64 pixel group size (in bits; same as PPW for mfb) - * PGSZB 4 8 pixel group size (in bytes) - * PPW 32 64 pixels per word (pixels per pixel group) - * PLST 31 63 index of last pixel in a word (should be PPW-1) - * PIM 0x1f 0x3f pixel index mask (index within a pixel group) - * PWSH 5 6 pixel-to-word shift (should be log2(PPW)) - * - * The MFB_ versions are here so that cfb can include maskbits.h to get - * the bitmap constants without conflicting with its own P* constants. - * - * Keith Packard (keithp@suse.com): - * Note mfb64 is no longer supported; it requires DIX support - * for realigning images which costs too much - */ - -/* warning: PixelType definition duplicated in mfb.h */ -#ifndef PixelType -#define PixelType CARD32 -#endif /* PixelType */ -#ifndef MfbBits -#define MfbBits CARD32 -#endif - -#define MFB_PGSZB 4 -#define MFB_PPW (MFB_PGSZB<<3) /* assuming 8 bits per byte */ -#define MFB_PGSZ MFB_PPW -#define MFB_PLST (MFB_PPW-1) -#define MFB_PIM MFB_PLST - -/* set PWSH = log2(PPW) using brute force */ - -#if MFB_PPW == 32 -#define MFB_PWSH 5 -#endif /* MFB_PPW == 32 */ - -/* XXX don't use these five */ -extern PixelType starttab[]; -extern PixelType endtab[]; -extern PixelType partmasks[MFB_PPW][MFB_PPW]; -extern PixelType rmask[]; -extern PixelType mask[]; -/* XXX use these five */ -extern PixelType mfbGetstarttab(int); -extern PixelType mfbGetendtab(int); -extern PixelType mfbGetpartmasks(int, int); -extern PixelType mfbGetrmask(int); -extern PixelType mfbGetmask(int); - -#ifndef MFB_CONSTS_ONLY - -#define PGSZB MFB_PGSZB -#define PPW MFB_PPW -#define PGSZ MFB_PGSZ -#define PLST MFB_PLST -#define PIM MFB_PIM -#define PWSH MFB_PWSH - -#define BitLeft(b,s) SCRLEFT(b,s) -#define BitRight(b,s) SCRRIGHT(b,s) - -#if 1 -#define LONG2CHARSSAMEORDER(x) ((MfbBits)(x)) -#define LONG2CHARSDIFFORDER( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \ - | ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \ - | ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \ - | ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) ) -#endif /* XFree86Server */ - -#if (BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER) -#define LONG2CHARS(x) ((MfbBits)(x)) -#else -/* - * the unsigned case below is for compilers like - * the Danbury C and i386cc - */ -#define LONG2CHARS( x ) ( ( ( ( x ) & (MfbBits)0x000000FF ) << 0x18 ) \ - | ( ( ( x ) & (MfbBits)0x0000FF00 ) << 0x08 ) \ - | ( ( ( x ) & (MfbBits)0x00FF0000 ) >> 0x08 ) \ - | ( ( ( x ) & (MfbBits)0xFF000000 ) >> 0x18 ) ) -#endif /* BITMAP_BIT_ORDER */ - -#ifdef STRICT_ANSI_SHIFT -#define SHL(x,y) ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) << (y))) -#define SHR(x,y) ((y) >= PPW ? 0 : LONG2CHARS(LONG2CHARS(x) >> (y))) -#else -#define SHL(x,y) LONG2CHARS(LONG2CHARS(x) << (y)) -#define SHR(x,y) LONG2CHARS(LONG2CHARS(x) >> (y)) -#endif - -#if (BITMAP_BIT_ORDER == MSBFirst) /* pc/rt, 680x0 */ -#define SCRLEFT(lw, n) SHL((PixelType)(lw),(n)) -#define SCRRIGHT(lw, n) SHR((PixelType)(lw),(n)) -#else /* vax, intel */ -#define SCRLEFT(lw, n) SHR((PixelType)(lw),(n)) -#define SCRRIGHT(lw, n) SHL((PixelType)(lw),(n)) -#endif - -#define DoRRop(alu, src, dst) \ -(((alu) == RROP_BLACK) ? ((dst) & ~(src)) : \ - ((alu) == RROP_WHITE) ? ((dst) | (src)) : \ - ((alu) == RROP_INVERT) ? ((dst) ^ (src)) : \ - (dst)) - -/* A generalized form of a x4 Duff's Device */ -#define Duff(counter, block) { \ - while (counter >= 4) {\ - { block; } \ - { block; } \ - { block; } \ - { block; } \ - counter -= 4; \ - } \ - switch (counter & 3) { \ - case 3: { block; } \ - case 2: { block; } \ - case 1: { block; } \ - case 0: \ - counter = 0; \ - } \ -} - -#define maskbits(x, w, startmask, endmask, nlw) \ - startmask = mfbGetstarttab((x) & PIM); \ - endmask = mfbGetendtab(((x)+(w)) & PIM); \ - if (startmask) \ - nlw = (((w) - (PPW - ((x) & PIM))) >> PWSH); \ - else \ - nlw = (w) >> PWSH; - -#define maskpartialbits(x, w, mask) \ - mask = mfbGetpartmasks((x) & PIM, (w) & PIM); - -#define maskPPWbits(x, w, startmask, endmask) \ - startmask = mfbGetstarttab((x) & PIM); \ - endmask = mfbGetendtab(((x)+(w)) & PIM); - -#ifdef __GNUC__ /* XXX don't want for Alpha? */ -#ifdef vax -#define FASTGETBITS(psrc,x,w,dst) \ - __asm ("extzv %1,%2,%3,%0" \ - : "=g" (dst) \ - : "g" (x), "g" (w), "m" (*(char *)(psrc))) -#define getbits(psrc,x,w,dst) FASTGETBITS(psrc,x,w,dst) - -#define FASTPUTBITS(src, x, w, pdst) \ - __asm ("insv %3,%1,%2,%0" \ - : "=m" (*(char *)(pdst)) \ - : "g" (x), "g" (w), "g" (src)) -#define putbits(src, x, w, pdst) FASTPUTBITS(src, x, w, pdst) -#endif /* vax */ -#ifdef mc68020 -#define FASTGETBITS(psrc, x, w, dst) \ - __asm ("bfextu %3{%1:%2},%0" \ - : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc))) - -#define getbits(psrc,x,w,dst) \ -{ \ - FASTGETBITS(psrc, x, w, dst);\ - dst = SHL(dst,(32-(w))); \ -} - -#define FASTPUTBITS(src, x, w, pdst) \ - __asm ("bfins %3,%0{%1:%2}" \ - : "=o" (*(char *)(pdst)) \ - : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst))) - -#define putbits(src, x, w, pdst) FASTPUTBITS(SHR((src),32-(w)), x, w, pdst) - -#endif /* mc68020 */ -#endif /* __GNUC__ */ - -/* The following flag is used to override a bugfix for sun 3/60+CG4 machines, - */ - -/* We don't need to be careful about this unless we're dealing with sun3's - * We will default its usage for those who do not know anything, but will - * override its effect if the machine doesn't look like a sun3 - */ -#if !defined(mc68020) || !defined(sun) -#define NO_3_60_CG4 -#endif - -/* This is gross. We want to #define u_putbits as something which can be used - * in the case of the 3/60+CG4, but if we use /bin/cc or are on another - * machine type, we want nothing to do with u_putbits. What a hastle. Here - * I used slo_putbits as something which either u_putbits or putbits could be - * defined as. - * - * putbits gets it iff it is not already defined with FASTPUTBITS above. - * u_putbits gets it if we have FASTPUTBITS (putbits) from above and have not - * overridden the NO_3_60_CG4 flag. - */ - -#define slo_putbits(src, x, w, pdst) \ -{ \ - register int n = (x)+(w)-PPW; \ - \ - if (n <= 0) \ - { \ - register PixelType tmpmask; \ - maskpartialbits((x), (w), tmpmask); \ - *(pdst) = (*(pdst) & ~tmpmask) | \ - (SCRRIGHT(src, x) & tmpmask); \ - } \ - else \ - { \ - register int d = PPW-(x); \ - *(pdst) = (*(pdst) & mfbGetendtab(x)) | (SCRRIGHT((src), x)); \ - (pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | \ - (SCRLEFT(src, d) & mfbGetendtab(n)); \ - } \ -} - -#if defined(putbits) && !defined(NO_3_60_CG4) -#define u_putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst) -#else -#define u_putbits(src, x, w, pdst) putbits(src, x, w, pdst) -#endif - -#if !defined(putbits) -#define putbits(src, x, w, pdst) slo_putbits(src, x, w, pdst) -#endif - -/* Now if we have not gotten any really good bitfield macros, try some - * moderately fast macros. Alas, I don't know how to do asm instructions - * without gcc. - */ - -#ifndef getbits -#define getbits(psrc, x, w, dst) \ -{ \ - dst = SCRLEFT(*(psrc), (x)); \ - if ( ((x) + (w)) > PPW) \ - dst |= (SCRRIGHT(*((psrc)+1), PPW-(x))); \ -} -#endif - -/* We have to special-case putbitsrop because of 3/60+CG4 combos - */ - -#define u_putbitsrop(src, x, w, pdst, rop) \ -{\ - register PixelType t1, t2; \ - register int n = (x)+(w)-PPW; \ - \ - t1 = SCRRIGHT((src), (x)); \ - DoRop(t2, rop, t1, *(pdst)); \ - \ - if (n <= 0) \ - { \ - register PixelType tmpmask; \ - \ - maskpartialbits((x), (w), tmpmask); \ - *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \ - } \ - else \ - { \ - int m = PPW-(x); \ - *(pdst) = (*(pdst) & mfbGetendtab(x)) | (t2 & mfbGetstarttab(x)); \ - t1 = SCRLEFT((src), m); \ - DoRop(t2, rop, t1, (pdst)[1]); \ - (pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | (t2 & mfbGetendtab(n)); \ - } \ -} - -/* If our getbits and putbits are FAST enough, - * do this brute force, it's faster - */ - -#if defined(FASTPUTBITS) && defined(FASTGETBITS) && defined(NO_3_60_CG4) -#if (BITMAP_BIT_ORDER == MSBFirst) -#define putbitsrop(src, x, w, pdst, rop) \ -{ \ - register PixelType _tmp, _tmp2; \ - FASTGETBITS(pdst, x, w, _tmp); \ - _tmp2 = SCRRIGHT(src, PPW-(w)); \ - DoRop(_tmp, rop, _tmp2, _tmp) \ - FASTPUTBITS(_tmp, x, w, pdst); \ -} -#define putbitsrrop(src, x, w, pdst, rop) \ -{ \ - register PixelType _tmp, _tmp2; \ - \ - FASTGETBITS(pdst, x, w, _tmp); \ - _tmp2 = SCRRIGHT(src, PPW-(w)); \ - _tmp= DoRRop(rop, _tmp2, _tmp); \ - FASTPUTBITS(_tmp, x, w, pdst); \ -} -#undef u_putbitsrop -#else -#define putbitsrop(src, x, w, pdst, rop) \ -{ \ - register PixelType _tmp; \ - FASTGETBITS(pdst, x, w, _tmp); \ - DoRop(_tmp, rop, src, _tmp) \ - FASTPUTBITS(_tmp, x, w, pdst); \ -} -#define putbitsrrop(src, x, w, pdst, rop) \ -{ \ - register PixelType _tmp; \ - \ - FASTGETBITS(pdst, x, w, _tmp); \ - _tmp= DoRRop(rop, src, _tmp); \ - FASTPUTBITS(_tmp, x, w, pdst); \ -} -#undef u_putbitsrop -#endif -#endif - -#ifndef putbitsrop -#define putbitsrop(src, x, w, pdst, rop) u_putbitsrop(src, x, w, pdst, rop) -#endif - -#ifndef putbitsrrop -#define putbitsrrop(src, x, w, pdst, rop) \ -{\ - register PixelType t1, t2; \ - register int n = (x)+(w)-PPW; \ - \ - t1 = SCRRIGHT((src), (x)); \ - t2 = DoRRop(rop, t1, *(pdst)); \ - \ - if (n <= 0) \ - { \ - register PixelType tmpmask; \ - \ - maskpartialbits((x), (w), tmpmask); \ - *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \ - } \ - else \ - { \ - int m = PPW-(x); \ - *(pdst) = (*(pdst) & mfbGetendtab(x)) | (t2 & mfbGetstarttab(x)); \ - t1 = SCRLEFT((src), m); \ - t2 = DoRRop(rop, t1, (pdst)[1]); \ - (pdst)[1] = ((pdst)[1] & mfbGetstarttab(n)) | (t2 & mfbGetendtab(n)); \ - } \ -} -#endif - -#if GETLEFTBITS_ALIGNMENT == 1 -#define getleftbits(psrc, w, dst) dst = *((CARD32 *)(pointer) psrc) -#endif /* GETLEFTBITS_ALIGNMENT == 1 */ - -#if GETLEFTBITS_ALIGNMENT == 2 -#define getleftbits(psrc, w, dst) \ - { \ - if ( ((int)(psrc)) & 0x01 ) \ - getbits( ((CARD32 *)(((char *)(psrc))-1)), 8, (w), (dst) ); \ - else \ - getbits(psrc, 0, w, dst); \ - } -#endif /* GETLEFTBITS_ALIGNMENT == 2 */ - -#if GETLEFTBITS_ALIGNMENT == 4 -#define getleftbits(psrc, w, dst) \ - { \ - int off, off_b; \ - off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \ - getbits( \ - (CARD32 *)( ((char *)(psrc)) - off), \ - (off_b), (w), (dst) \ - ); \ - } -#endif /* GETLEFTBITS_ALIGNMENT == 4 */ - - -#define getshiftedleftbits(psrc, offset, w, dst) \ - getleftbits((psrc), (w), (dst)); \ - dst = SCRLEFT((dst), (offset)); - -/* FASTGETBITS and FASTPUTBITS are not necessarily correct implementations of - * getbits and putbits, but they work if used together. - * - * On a MSBFirst machine, a cpu bitfield extract instruction (like bfextu) - * could normally assign its result to a 32-bit word register in the screen - * right position. This saves canceling register shifts by not fighting the - * natural cpu byte order. - * - * Unfortunately, these fail on a 3/60+CG4 and cannot be used unmodified. Sigh. - */ -#if defined(FASTGETBITS) && defined(FASTPUTBITS) -#ifdef NO_3_60_CG4 -#define u_FASTPUT(aa, bb, cc, dd) FASTPUTBITS(aa, bb, cc, dd) -#else -#define u_FASTPUT(aa, bb, cc, dd) u_putbits(SCRLEFT(aa, PPW-(cc)), bb, cc, dd) -#endif - -#define getandputbits(psrc, srcbit, dstbit, width, pdst) \ -{ \ - register PixelType _tmpbits; \ - FASTGETBITS(psrc, srcbit, width, _tmpbits); \ - u_FASTPUT(_tmpbits, dstbit, width, pdst); \ -} - -#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \ -{ \ - register PixelType _tmpsrc, _tmpdst; \ - FASTGETBITS(pdst, dstbit, width, _tmpdst); \ - FASTGETBITS(psrc, srcbit, width, _tmpsrc); \ - DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \ - u_FASTPUT(_tmpdst, dstbit, width, pdst); \ -} - -#define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \ -{ \ - register PixelType _tmpsrc, _tmpdst; \ - FASTGETBITS(pdst, dstbit, width, _tmpdst); \ - FASTGETBITS(psrc, srcbit, width, _tmpsrc); \ - _tmpdst = DoRRop(rop, _tmpsrc, _tmpdst); \ - u_FASTPUT(_tmpdst, dstbit, width, pdst); \ -} - -#define getandputbits0(psrc, srcbit, width, pdst) \ - getandputbits(psrc, srcbit, 0, width, pdst) - -#define getandputrop0(psrc, srcbit, width, pdst, rop) \ - getandputrop(psrc, srcbit, 0, width, pdst, rop) - -#define getandputrrop0(psrc, srcbit, width, pdst, rop) \ - getandputrrop(psrc, srcbit, 0, width, pdst, rop) - - -#else /* Slow poke */ - -/* pairs of getbits/putbits happen frequently. Some of the code can - * be shared or avoided in a few specific instances. It gets us a - * small advantage, so we do it. The getandput...0 macros are the only ones - * which speed things here. The others are here for compatibility w/the above - * FAST ones - */ - -#define getandputbits(psrc, srcbit, dstbit, width, pdst) \ -{ \ - register PixelType _tmpbits; \ - getbits(psrc, srcbit, width, _tmpbits); \ - putbits(_tmpbits, dstbit, width, pdst); \ -} - -#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \ -{ \ - register PixelType _tmpbits; \ - getbits(psrc, srcbit, width, _tmpbits) \ - putbitsrop(_tmpbits, dstbit, width, pdst, rop) \ -} - -#define getandputrrop(psrc, srcbit, dstbit, width, pdst, rop) \ -{ \ - register PixelType _tmpbits; \ - getbits(psrc, srcbit, width, _tmpbits) \ - putbitsrrop(_tmpbits, dstbit, width, pdst, rop) \ -} - - -#define getandputbits0(psrc, sbindex, width, pdst) \ -{ /* unroll the whole damn thing to see how it * behaves */ \ - register int _flag = PPW - (sbindex); \ - register PixelType _src; \ - \ - _src = SCRLEFT (*(psrc), (sbindex)); \ - if ((width) > _flag) \ - _src |= SCRRIGHT (*((psrc) + 1), _flag); \ - \ - *(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \ -} - - -#define getandputrop0(psrc, sbindex, width, pdst, rop) \ -{ \ - register int _flag = PPW - (sbindex); \ - register PixelType _src; \ - \ - _src = SCRLEFT (*(psrc), (sbindex)); \ - if ((width) > _flag) \ - _src |= SCRRIGHT (*((psrc) + 1), _flag); \ - DoRop(_src, rop, _src, *(pdst)); \ - \ - *(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \ -} - -#define getandputrrop0(psrc, sbindex, width, pdst, rop) \ -{ \ - int _flag = PPW - (sbindex); \ - register PixelType _src; \ - \ - _src = SCRLEFT (*(psrc), (sbindex)); \ - if ((width) > _flag) \ - _src |= SCRRIGHT (*((psrc) + 1), _flag); \ - _src = DoRRop(rop, _src, *(pdst)); \ - \ - *(pdst) = (*(pdst) & mfbGetstarttab((width))) | (_src & mfbGetendtab((width))); \ -} - -#endif /* FASTGETBITS && FASTPUTBITS */ - -#endif /* MFB_CONSTS_ONLY */ diff --git a/mfb/mergerop.h b/mfb/mergerop.h deleted file mode 100644 index b71bfcc09..000000000 --- a/mfb/mergerop.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * -Copyright 1989, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _MERGEROP_H_ -#define _MERGEROP_H_ - -#ifndef GXcopy -#include -#endif - -typedef struct _mergeRopBits { - MfbBits ca1, cx1, ca2, cx2; -} mergeRopRec, *mergeRopPtr; - -extern mergeRopRec mergeRopBits[16]; -extern mergeRopPtr mergeGetRopBits(int i); - -#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */ -#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0; -#define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx; -#if PSZ == 24 /* both for PGSZ == 32 and 64 */ -#define DeclareMergeRop24() \ - MfbBits _ca1u[4], _cx1u[4], _ca2u[4], _cx2u[4]; - /* int _unrollidx[3]={0,0,1,2};*/ -#define DeclarePrebuiltMergeRop24() MfbBits _ccau[4], _ccxu[4]; -#endif /* PSZ == 24 */ -#else /* mfb */ -#define DeclareMergeRop() MfbBits _ca1 = 0, _cx1 = 0, _ca2 = 0, _cx2 = 0; -#define DeclarePrebuiltMergeRop() MfbBits _cca, _ccx; -#endif - -#if defined(PPW) && defined(PGSZ) && (PPW != PGSZ) /* cfb */ -#define InitializeMergeRop(alu,pm) {\ - MfbBits _pm; \ - mergeRopPtr _bits; \ - _pm = PFILL(pm); \ - _bits = mergeGetRopBits(alu); \ - _ca1 = _bits->ca1 & _pm; \ - _cx1 = _bits->cx1 | ~_pm; \ - _ca2 = _bits->ca2 & _pm; \ - _cx2 = _bits->cx2 & _pm; \ -} -#if PSZ == 24 -#if (BITMAP_BIT_ORDER == MSBFirst) -#define InitializeMergeRop24(alu,pm) {\ - register int i; \ - register MfbBits _pm = (pm) & 0xFFFFFF; \ - mergeRopPtr _bits = mergeGetRopBits(alu); \ - MfbBits _bits_ca1 = _bits->ca1; \ - MfbBits _bits_cx1 = _bits->cx1; \ - MfbBits _bits_ca2 = _bits->ca2; \ - MfbBits _bits_cx2 = _bits->cx2; \ - _pm = (_pm << 8) | (_pm >> 16); \ - for(i = 0; i < 4; i++){ \ - _ca1u[i] = _bits_ca1 & _pm; \ - _cx1u[i] = _bits_cx1 | ~_pm; \ - _ca2u[i] = _bits_ca2 & _pm; \ - _cx2u[i] = _bits_cx2 & _pm; \ - _pm = (_pm << 16)|(_pm >> 8); \ - } \ -} -#else /*(BITMAP_BIT_ORDER == LSBFirst)*/ -#define InitializeMergeRop24(alu,pm) {\ - register int i; \ - register MfbBits _pm = (pm) & cfbmask[0]; \ - mergeRopPtr _bits = mergeGetRopBits(alu); \ - MfbBits _bits_ca1 = _bits->ca1 & cfbmask[0]; \ - MfbBits _bits_cx1 = _bits->cx1 & cfbmask[0]; \ - MfbBits _bits_ca2 = _bits->ca2 & cfbmask[0]; \ - MfbBits _bits_cx2 = _bits->cx2 & cfbmask[0]; \ - _pm |= (_pm << 24); \ - _bits_ca1 |= (_bits->ca1 << 24); \ - _bits_cx1 |= (_bits->cx1 << 24); \ - _bits_ca2 |= (_bits->ca2 << 24); \ - _bits_cx2 |= (_bits->cx2 << 24); \ - for(i = 0; i < 4; i++){ \ - _ca1u[i] = _bits_ca1 & _pm; \ - _cx1u[i] = _bits_cx1 | ~_pm; \ - _ca2u[i] = _bits_ca2 & _pm; \ - _cx2u[i] = _bits_cx2 & _pm; \ - _pm = (_pm << 16)|(_pm >> 8); \ - } \ -} -#endif /*(BITMAP_BIT_ORDER == MSBFirst)*/ -#endif /* PSZ == 24 */ -#else /* mfb */ -#define InitializeMergeRop(alu,pm) {\ - mergeRopPtr _bits; \ - _bits = mergeGetRopBits(alu); \ - _ca1 = _bits->ca1; \ - _cx1 = _bits->cx1; \ - _ca2 = _bits->ca2; \ - _cx2 = _bits->cx2; \ -} -#endif - -/* AND has higher precedence than XOR */ - -#define DoMergeRop(src, dst) \ - (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2)) - -#define DoMergeRop24u(src, dst, i) \ -(((dst) & (((src) & _ca1u[i]) ^ _cx1u[i])) ^ (((src) & _ca2u[i]) ^ _cx2u[i])) - -#define DoMaskMergeRop24(src, dst, mask, index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src0 = (src);\ - MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \ - MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \ - *(dst) = (((*(dst)) & cfbrmask[idx]) | (((*(dst)) & cfbmask[idx]) & \ - (((( _src1 |(~mask))<>cfb24Shift[idx])&cfbmask[idx]) ^ \ - (((_src2 &(mask))>>cfb24Shift[idx])&cfbmask[idx])))); \ - (dst)--; \ - } - -#define DoMaskMergeRop(src, dst, mask) \ - (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask))) - -#define DoMaskMergeRop24u(src, dst, mask, i) \ -(((dst) & ((((src) & _ca1u[(i)]) ^ _cx1u[(i)]) | ~(mask))) ^ ((((src) & _ca2u[(i)]) ^ _cx2u[(i)]) & (mask))) - -#define DoMergeRop24(src,dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src0 = (src);\ - MfbBits _src1 = (_src0 & _ca1) ^ _cx1; \ - MfbBits _src2 = (_src0 & _ca2) ^ _cx2; \ - *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \ - ((_src1 << cfb24Shift[idx])&cfbmask[idx])) ^ \ - ((_src2 << cfb24Shift[idx])&cfbmask[idx]))); \ - idx++; \ - (dst)++; \ - *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) & \ - ((_src1 >> cfb24Shift[idx])&cfbmask[idx])) ^ \ - ((_src2 >> cfb24Shift[idx])&cfbmask[idx]))); \ - (dst)--; \ - } - -#define DoPrebuiltMergeRop(dst) (((dst) & _cca) ^ _ccx) - -#define DoPrebuiltMergeRop24(dst,index) { \ - register int idx = ((index) & 3)<< 1; \ - *(dst) = (((*(dst)) & cfbrmask[idx]) | ((((*(dst)) & cfbmask[idx]) &\ - (( _cca <>cfb24Shift[idx])&cfbmask[idx])) ^ \ - (( _ccx >>cfb24Shift[idx])&cfbmask[idx]))); \ - (dst)--; \ - } - -#define DoMaskPrebuiltMergeRop(dst,mask) \ - (((dst) & (_cca | ~(mask))) ^ (_ccx & (mask))) - -#define PrebuildMergeRop(src) ((_cca = ((src) & _ca1) ^ _cx1), \ - (_ccx = ((src) & _ca2) ^ _cx2)) - -#ifndef MROP -#define MROP 0 -#endif - -#define Mclear (1<> cfb24Shift[(idx)<<1])| \ - ((*((pix)+1) & cfbmask[((idx)<<1)+1]) << cfb24Shift[((idx)<<1)+1])) - -#define MROP_SOLID24P(src,dst,sindex, index) \ - MROP_SOLID24(MROP_PIXEL24(src,sindex),dst,index) - -#define MROP_MASK24P(src,dst,mask,sindex,index) \ - MROP_MASK24(MROP_PIXEL24(src,sindex),dst,mask,index) - -#if (MROP) == Mcopy -#define MROP_DECLARE() -#define MROP_DECLARE_REG() -#define MROP_INITIALIZE(alu,pm) -#define MROP_SOLID(src,dst) (src) -#define MROP_SOLID24(src,dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src = (src); \ - *(dst) = (*(dst) & cfbrmask[idx])|((_src<>cfb24Shift[idx])&cfbmask[idx]); \ - } -#define MROP_MASK(src,dst,mask) (((dst) & ~(mask)) | ((src) & (mask))) -#define MROP_MASK24(src,dst,mask,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src = (src); \ - *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \ - (((_src &(mask))<>cfb24Shift[idx])&cfbmask[idx])) | \ - (((_src&(mask))>>cfb24Shift[idx])&cfbmask[idx])); \ - } -#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Copy) -#endif - -#if (MROP) == McopyInverted -#define MROP_DECLARE() -#define MROP_DECLARE_REG() -#define MROP_INITIALIZE(alu,pm) -#define MROP_SOLID(src,dst) (~(src)) -#define MROP_SOLID24(src,dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src = ~(src); \ - *(dst) = (*(dst) & cfbrmask[idx])|((_src << cfb24Shift[idx])&cfbmask[idx]); \ - idx++; \ - (dst)++; \ - *(dst) = (*(dst) & cfbrmask[idx])|((_src >>cfb24Shift[idx])&cfbmask[idx]); \ - (dst)--; \ - } -#define MROP_MASK(src,dst,mask) (((dst) & ~(mask)) | ((~(src)) & (mask))) -#define MROP_MASK24(src,dst,mask,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src = ~(src); \ - *(dst) = (*(dst) & cfbrmask[idx] &(~(((mask)<< cfb24Shift[idx])&cfbmask[idx])) | \ - (((_src &(mask))<>cfb24Shift[idx])&cfbmask[idx])) | \ - ((((_src & (mask))>>cfb24Shift[idx])&cfbmask[idx])); \ - (dst)--; \ - } -#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyInverted) -#endif - -#if (MROP) == Mxor -#define MROP_DECLARE() -#define MROP_DECLARE_REG() -#define MROP_INITIALIZE(alu,pm) -#define MROP_SOLID(src,dst) ((src) ^ (dst)) -#define MROP_SOLID24(src,dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src = (src); \ - *(dst) ^= ((_src << cfb24Shift[idx])&cfbmask[idx]); \ - idx++; \ - (dst)++; \ - *(dst) ^= ((_src >>cfb24Shift[idx])&cfbmask[idx]); \ - (dst)--; \ - } -#define MROP_MASK(src,dst,mask) (((src) & (mask)) ^ (dst)) -#define MROP_MASK24(src,dst,mask,index) {\ - register int idx = ((index) & 3)<< 1; \ - *(dst) ^= ((((src)&(mask))<>cfb24Shift[idx])&cfbmask[idx]); \ - (dst)--; \ - } -#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Xor) -#endif - -#if (MROP) == Mor -#define MROP_DECLARE() -#define MROP_DECLARE_REG() -#define MROP_INITIALIZE(alu,pm) -#define MROP_SOLID(src,dst) ((src) | (dst)) -#define MROP_SOLID24(src,dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - *(dst) |= (((src)<>cfb24Shift[idx])&cfbmask[idx]); \ - (dst)--; \ - } -#define MROP_MASK(src,dst,mask) (((src) & (mask)) | (dst)) -#define MROP_MASK24(src,dst,mask,index) {\ - register int idx = ((index) & 3)<< 1; \ - MfbBits _src = (src); \ - *(dst) |= (((_src &(mask))<>cfb24Shift[idx])&cfbmask[idx]); \ - (dst)--; \ - } -#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,Or) -#endif - -#if (MROP) == (Mcopy|Mxor|MandReverse|Mor) -#define MROP_DECLARE() MfbBits _ca1 = 0, _cx1 = 0; -#define MROP_DECLARE_REG() register MROP_DECLARE() -#define MROP_INITIALIZE(alu,pm) { \ - mergeRopPtr _bits; \ - _bits = mergeGetRopBits(alu); \ - _ca1 = _bits->ca1; \ - _cx1 = _bits->cx1; \ -} -#define MROP_SOLID(src,dst) \ - (((dst) & (((src) & _ca1) ^ _cx1)) ^ (src)) -#define MROP_MASK(src,dst,mask) \ - (((dst) & ((((src) & _ca1) ^ _cx1)) | (~(mask)) ^ ((src) & (mask)))) -#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,CopyXorAndReverseOr) -#define MROP_PREBUILD(src) PrebuildMergeRop(src) -#define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop() -#define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst) -#define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index) -#define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask) -#define MROP_PREBUILT_MASK24(src,dst,mask,index) DoMaskPrebuiltMergeRop24(dst,mask,index) -#endif - -#if (MROP) == 0 -#if !defined(PSZ) || (PSZ != 24) -#define MROP_DECLARE() DeclareMergeRop() -#define MROP_DECLARE_REG() register DeclareMergeRop() -#define MROP_INITIALIZE(alu,pm) InitializeMergeRop(alu,pm) -#define MROP_SOLID(src,dst) DoMergeRop(src,dst) -#define MROP_MASK(src,dst,mask) DoMaskMergeRop(src, dst, mask) -#else -#define MROP_DECLARE() \ - DeclareMergeRop() \ - DeclareMergeRop24() -#define MROP_DECLARE_REG() \ - register DeclareMergeRop()\ - DeclareMergeRop24() -#define MROP_INITIALIZE(alu,pm) \ - InitializeMergeRop(alu,pm)\ - InitializeMergeRop24(alu,pm) -#define MROP_SOLID(src,dst) DoMergeRop24u(src,dst,((int)(&(dst)-pdstBase) % 3)) -#define MROP_MASK(src,dst,mask) DoMaskMergeRop24u(src, dst, mask,((int)(&(dst) - pdstBase)%3)) -#endif -#define MROP_SOLID24(src,dst,index) DoMergeRop24(src,dst,index) -#define MROP_MASK24(src,dst,mask,index) DoMaskMergeRop24(src, dst, mask,index) -#define MROP_NAME(prefix) MROP_NAME_CAT(prefix,General) -#define MROP_PREBUILD(src) PrebuildMergeRop(src) -#define MROP_PREBUILT_DECLARE() DeclarePrebuiltMergeRop() -#define MROP_PREBUILT_SOLID(src,dst) DoPrebuiltMergeRop(dst) -#define MROP_PREBUILT_SOLID24(src,dst,index) DoPrebuiltMergeRop24(dst,index) -#define MROP_PREBUILT_MASK(src,dst,mask) DoMaskPrebuiltMergeRop(dst,mask) -#define MROP_PREBUILT_MASK24(src,dst,mask,index) \ - DoMaskPrebuiltMergeRop24(dst,mask,index) -#endif - -#ifndef MROP_PREBUILD -#define MROP_PREBUILD(src) -#define MROP_PREBUILT_DECLARE() -#define MROP_PREBUILT_SOLID(src,dst) MROP_SOLID(src,dst) -#define MROP_PREBUILT_SOLID24(src,dst,index) MROP_SOLID24(src,dst,index) -#define MROP_PREBUILT_MASK(src,dst,mask) MROP_MASK(src,dst,mask) -#define MROP_PREBUILT_MASK24(src,dst,mask,index) MROP_MASK24(src,dst,mask,index) -#endif - -#if !defined(UNIXCPP) || defined(ANSICPP) -#define MROP_NAME_CAT(prefix,suffix) prefix##suffix -#else -#define MROP_NAME_CAT(prefix,suffix) prefix/**/suffix -#endif - -#endif diff --git a/mfb/mfb.h b/mfb/mfb.h deleted file mode 100644 index 36f111380..000000000 --- a/mfb/mfb.h +++ /dev/null @@ -1,1112 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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. - -******************************************************************/ - -#if !defined(_MFB_H_) || defined(MFB_PROTOTYPES_ONLY) -#ifndef MFB_PROTOTYPES_ONLY -#define _MFB_H_ -#endif - -/* Monochrome Frame Buffer definitions - written by drewry, september 1986 -*/ -#include "pixmap.h" -#include "region.h" -#include "gc.h" -#include "colormap.h" -#include "privates.h" -#include "miscstruct.h" -#include "mibstore.h" - -extern int InverseAlu[]; -extern int mfbGetInverseAlu(int i); - -/* warning: PixelType definition duplicated in maskbits.h */ -#ifndef PixelType -#define PixelType CARD32 -#endif /* PixelType */ -#ifndef MfbBits -#define MfbBits CARD32 -#endif - -/* mfbbitblt.c */ - -extern void mfbDoBitblt( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/ -); - -extern RegionPtr mfbCopyArea( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr/*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/ -); - -extern Bool mfbRegisterCopyPlaneProc( - ScreenPtr /*pScreen*/, - RegionPtr (* /*proc*/)( - DrawablePtr /* pSrcDrawable */, - DrawablePtr /* pDstDrawable */, - GCPtr /* pGC */, - int /* srcx */, - int /* srcy */, - int /* width */, - int /* height */, - int /* dstx */, - int /* dsty */, - unsigned long /* bitPlane */ - ) -); - -extern RegionPtr mfbCopyPlane( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr/*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - unsigned long /*plane*/ -); -/* mfbbltC.c */ - -extern void mfbDoBitbltCopy( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/ -); -/* mfbbltCI.c */ - -extern void mfbDoBitbltCopyInverted( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/ -); -/* mfbbltG.c */ - -extern void mfbDoBitbltGeneral( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/ -); -/* mfbbltO.c */ - -extern void mfbDoBitbltOr( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/ -); -/* mfbbltX.c */ - -extern void mfbDoBitbltXor( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/ -); -/* mfbbres.c */ - -extern void mfbBresS( - int /*rop*/, - PixelType * /*addrl*/, - int /*nlwidth*/, - int /*signdx*/, - int /*signdy*/, - int /*axis*/, - int /*x1*/, - int /*y1*/, - int /*e*/, - int /*e1*/, - int /*e2*/, - int /*len*/ -); -/* mfbbresd.c */ - -extern void mfbBresD( - int /*fgrop*/, - int /*bgrop*/, - int * /*pdashIndex*/, - unsigned char * /*pDash*/, - int /*numInDashList*/, - int * /*pdashOffset*/, - int /*isDoubleDash*/, - PixelType * /*addrl*/, - int /*nlwidth*/, - int /*signdx*/, - int /*signdy*/, - int /*axis*/, - int /*x1*/, - int /*y1*/, - int /*e*/, - int /*e1*/, - int /*e2*/, - int /*len*/ -); - -/* mfbclip.c */ - -extern RegionPtr mfbPixmapToRegion( - PixmapPtr /*pPix*/ -); - -#ifndef MFB_PROTOTYPES_ONLY -typedef RegionPtr (*mfbPixmapToRegionProc)(PixmapPtr); - -extern mfbPixmapToRegionProc *mfbPixmapToRegionWeak(void); -#endif - -/* mfbcmap.c */ - -extern int mfbListInstalledColormaps( - ScreenPtr /*pScreen*/, - Colormap * /*pmaps*/ -); - -extern void mfbInstallColormap( - ColormapPtr /*pmap*/ -); - -extern void mfbUninstallColormap( - ColormapPtr /*pmap*/ -); - -extern void mfbResolveColor( - unsigned short * /*pred*/, - unsigned short * /*pgreen*/, - unsigned short * /*pblue*/, - VisualPtr /*pVisual*/ -); - -extern Bool mfbCreateColormap( - ColormapPtr /*pMap*/ -); - -extern void mfbDestroyColormap( - ColormapPtr /*pMap*/ -); - -extern Bool mfbCreateDefColormap( - ScreenPtr /*pScreen*/ -); -/* mfbfillarc.c */ - -extern void mfbPolyFillArcSolid( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); -/* mfbfillrct.c */ - -extern void mfbPolyFillRect( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nrectFill*/, - xRectangle * /*prectInit*/ -); -/* mfbfillsp.c */ - -extern void mfbBlackSolidFS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbWhiteSolidFS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbInvertSolidFS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbWhiteStippleFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbBlackStippleFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbInvertStippleFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbTileFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbUnnaturalTileFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void mfbUnnaturalStippleFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -/* mfbfont.c */ - -extern Bool mfbRealizeFont( - ScreenPtr /*pscr*/, - FontPtr /*pFont*/ -); - -extern Bool mfbUnrealizeFont( - ScreenPtr /*pscr*/, - FontPtr /*pFont*/ -); - -#ifndef MFB_PROTOTYPES_ONLY -typedef void (*mfbRealizeFontProc)(ScreenPtr, FontPtr); -typedef void (*mfbUnrealizeFontProc)(ScreenPtr, FontPtr); - -extern mfbRealizeFontProc *mfbRealizeFontWeak(void); -extern mfbUnrealizeFontProc *mfbUnrealizeFontWeak(void); -#endif - -/* mfbgc.c */ - -extern Bool mfbCreateGC( - GCPtr /*pGC*/ -); - -extern void mfbValidateGC( - GCPtr /*pGC*/, - unsigned long /*changes*/, - DrawablePtr /*pDrawable*/ -); - -extern int mfbReduceRop( - int /*alu*/, - Pixel /*src*/ -); - -/* mfbgetsp.c */ - -extern void mfbGetSpans( - DrawablePtr /*pDrawable*/, - int /*wMax*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - int /*nspans*/, - char * /*pdstStart*/ -); -/* mfbhrzvert.c */ - -extern void mfbHorzS( - int /*rop*/, - PixelType * /*addrl*/, - int /*nlwidth*/, - int /*x1*/, - int /*y1*/, - int /*len*/ -); - -extern void mfbVertS( - int /*rop*/, - PixelType * /*addrl*/, - int /*nlwidth*/, - int /*x1*/, - int /*y1*/, - int /*len*/ -); -/* mfbigbblak.c */ - -extern void mfbImageGlyphBltBlack( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbigbwht.c */ - -extern void mfbImageGlyphBltWhite( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbimage.c */ - -extern void mfbPutImage( - DrawablePtr /*dst*/, - GCPtr /*pGC*/, - int /*depth*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - int /*leftPad*/, - int /*format*/, - char * /*pImage*/ -); - -extern void mfbGetImage( - DrawablePtr /*pDrawable*/, - int /*sx*/, - int /*sy*/, - int /*w*/, - int /*h*/, - unsigned int /*format*/, - unsigned long /*planeMask*/, - char * /*pdstLine*/ -); -/* mfbline.c */ - -extern void mfbLineSS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); - -extern void mfbLineSD( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); - -/* mfbmisc.c */ - -extern void mfbQueryBestSize( - int /*class*/, - unsigned short * /*pwidth*/, - unsigned short * /*pheight*/, - ScreenPtr /*pScreen*/ -); - -#ifndef MFB_PROTOTYPES_ONLY -typedef void (*mfbQueryBestSizeProc)(int, unsigned short *, unsigned short *, - ScreenPtr); - -extern mfbQueryBestSizeProc *mfbQueryBestSizeWeak(void); -#endif - -/* mfbpablack.c */ - -extern void mfbSolidBlackArea( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*nop*/ -); - -extern void mfbStippleBlackArea( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*pstipple*/ -); -/* mfbpainv.c */ - -extern void mfbSolidInvertArea( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*nop*/ -); - -extern void mfbStippleInvertArea( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*pstipple*/ -); -/* mfbpawhite.c */ - -extern void mfbSolidWhiteArea( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*nop*/ -); - -extern void mfbStippleWhiteArea( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*pstipple*/ -); - -/* mfbpgbinv.c */ - -extern void mfbPolyGlyphBltBlack( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbpgbinv.c */ - -extern void mfbPolyGlyphBltInvert( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbpgbwht.c */ - -extern void mfbPolyGlyphBltWhite( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbpixmap.c */ - -extern PixmapPtr mfbCreatePixmap( - ScreenPtr /*pScreen*/, - int /*width*/, - int /*height*/, - int /*depth*/, - unsigned /*usage_hint*/ -); - -extern Bool mfbDestroyPixmap( - PixmapPtr /*pPixmap*/ -); - -extern PixmapPtr mfbCopyPixmap( - PixmapPtr /*pSrc*/ -); - -extern void mfbPadPixmap( - PixmapPtr /*pPixmap*/ -); - -extern void mfbXRotatePixmap( - PixmapPtr /*pPix*/, - int /*rw*/ -); - -extern void mfbYRotatePixmap( - PixmapPtr /*pPix*/, - int /*rh*/ -); - -extern void mfbCopyRotatePixmap( - PixmapPtr /*psrcPix*/, - PixmapPtr * /*ppdstPix*/, - int /*xrot*/, - int /*yrot*/ -); -/* mfbplyblack.c */ - -extern void mfbFillPolyBlack( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*shape*/, - int /*mode*/, - int /*count*/, - DDXPointPtr /*ptsIn*/ -); -/* mfbplyinv.c */ - -extern void mfbFillPolyInvert( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*shape*/, - int /*mode*/, - int /*count*/, - DDXPointPtr /*ptsIn*/ -); - -/* mfbpntwin.c */ - -extern void mfbFillPolyWhite( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*shape*/, - int /*mode*/, - int /*count*/, - DDXPointPtr /*ptsIn*/ -); -/* mfbpolypnt.c */ - -extern void mfbPolyPoint( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - xPoint * /*pptInit*/ -); -/* mfbpushpxl.c */ - -extern void mfbSolidPP( - GCPtr /*pGC*/, - PixmapPtr /*pBitMap*/, - DrawablePtr /*pDrawable*/, - int /*dx*/, - int /*dy*/, - int /*xOrg*/, - int /*yOrg*/ -); - -extern void mfbPushPixels( - GCPtr /*pGC*/, - PixmapPtr /*pBitMap*/, - DrawablePtr /*pDrawable*/, - int /*dx*/, - int /*dy*/, - int /*xOrg*/, - int /*yOrg*/ -); - -#ifndef MFB_PROTOTYPES_ONLY -typedef void (*mfbPushPixelsProc)(GCPtr, PixmapPtr, DrawablePtr, int, int, - int, int); - -extern mfbPushPixelsProc *mfbPushPixelsWeak(void); -#endif - -/* mfbscrclse.c */ - -extern Bool mfbCloseScreen( - int /*index*/, - ScreenPtr /*pScreen*/ -); -/* mfbscrinit.c */ - -extern Bool mfbAllocatePrivates( - ScreenPtr /*pScreen*/, - DevPrivateKey * /*pGCKey*/ -); - -extern Bool mfbScreenInit( - ScreenPtr /*pScreen*/, - pointer /*pbits*/, - int /*xsize*/, - int /*ysize*/, - int /*dpix*/, - int /*dpiy*/, - int /*width*/ -); - -extern PixmapPtr mfbGetWindowPixmap( - WindowPtr /*pWin*/ -); - -extern void mfbSetWindowPixmap( - WindowPtr /*pWin*/, - PixmapPtr /*pPix*/ -); - -extern void mfbFillInScreen(ScreenPtr pScreen); - -/* mfbseg.c */ - -extern void mfbSegmentSS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSeg*/ -); - -extern void mfbSegmentSD( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSeg*/ -); -/* mfbsetsp.c */ - -extern void mfbSetScanline( - int /*y*/, - int /*xOrigin*/, - int /*xStart*/, - int /*xEnd*/, - PixelType * /*psrc*/, - int /*alu*/, - PixelType * /*pdstBase*/, - int /*widthDst*/ -); - -extern void mfbSetSpans( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - char * /*psrc*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - int /*nspans*/, - int /*fSorted*/ -); -/* mfbteblack.c */ - -extern void mfbTEGlyphBltBlack( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbtewhite.c */ - -extern void mfbTEGlyphBltWhite( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* mfbtileC.c */ - -extern void mfbTileAreaPPWCopy( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*ptile*/ -); -/* mfbtileG.c */ - -extern void mfbTileAreaPPWGeneral( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*ptile*/ -); - -extern void mfbTileAreaPPW( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*ptile*/ -); -/* mfbwindow.c */ - -extern Bool mfbCreateWindow( - WindowPtr /*pWin*/ -); - -extern Bool mfbDestroyWindow( - WindowPtr /*pWin*/ -); - -extern Bool mfbMapWindow( - WindowPtr /*pWindow*/ -); - -extern Bool mfbPositionWindow( - WindowPtr /*pWin*/, - int /*x*/, - int /*y*/ -); - -extern Bool mfbUnmapWindow( - WindowPtr /*pWindow*/ -); - -extern void mfbCopyWindow( - WindowPtr /*pWin*/, - DDXPointRec /*ptOldOrg*/, - RegionPtr /*prgnSrc*/ -); - -extern Bool mfbChangeWindowAttributes( - WindowPtr /*pWin*/, - unsigned long /*mask*/ -); -/* mfbzerarc.c */ - -extern void mfbZeroPolyArcSS( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); - -#ifndef MFB_PROTOTYPES_ONLY -/* - private filed of pixmap - pixmap.devPrivate = (PixelType *)pointer_to_bits - pixmap.devKind = width_of_pixmap_in_bytes - - private field of screen - a pixmap, for which we allocate storage. devPrivate is a pointer to -the bits in the hardware framebuffer. note that devKind can be poked to -make the code work for framebuffers that are wider than their -displayable screen (e.g. the early vsII, which displayed 960 pixels -across, but was 1024 in the hardware.) - - private field of GC -*/ -typedef void (*mfbFillAreaProcPtr)( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*nop*/ - ); - -typedef struct { - 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 unused1[sizeof(long) - 3]; /* Alignment */ - mfbFillAreaProcPtr FillArea; /* fills regions; look at the code */ - } mfbPrivGC; -typedef mfbPrivGC *mfbPrivGCPtr; -#endif - -extern DevPrivateKey mfbGetGCPrivateKey(void); -#ifdef PIXMAP_PER_WINDOW -extern DevPrivateKey frameGetWindowPrivateKey(void); -#endif - -#ifndef MFB_PROTOTYPES_ONLY -/* Common macros for extracting drawing information */ - -#define mfbGetTypedWidth(pDrawable,wtype) (\ - (((pDrawable)->type == DRAWABLE_WINDOW) ? \ - (int) (((PixmapPtr)((pDrawable)->pScreen->devPrivate))->devKind) : \ - (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype)) - -#define mfbGetByteWidth(pDrawable) mfbGetTypedWidth(pDrawable, unsigned char) - -#define mfbGetPixelWidth(pDrawable) mfbGetTypedWidth(pDrawable, PixelType) - -#define mfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\ - PixmapPtr _pPix; \ - if ((pDrawable)->type == DRAWABLE_WINDOW) \ - _pPix = (PixmapPtr) (pDrawable)->pScreen->devPrivate; \ - else \ - _pPix = (PixmapPtr) (pDrawable); \ - (pointer) = (ptype *) _pPix->devPrivate.ptr; \ - (width) = ((int) _pPix->devKind) / sizeof (wtype); \ -} - -#define mfbGetByteWidthAndPointer(pDrawable, width, pointer) \ - mfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char) - -#define mfbGetPixelWidthAndPointer(pDrawable, width, pointer) \ - mfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) - -#define mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\ - PixmapPtr _pPix = (PixmapPtr) (pWin)->drawable.pScreen->devPrivate; \ - (pointer) = (ptype *) _pPix->devPrivate.ptr; \ - (width) = ((int) _pPix->devKind) / sizeof (wtype); \ -} - -#define mfbGetWindowPixelWidthAndPointer(pWin, width, pointer) \ - mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, PixelType, PixelType) - -#define mfbGetWindowByteWidthAndPointer(pWin, width, pointer) \ - mfbGetWindowTypedWidthAndPointer(pWin, width, pointer, char, char) - -/* mfb uses the following macros to calculate addresses in drawables. - * To support banked framebuffers, the macros come in four flavors. - * All four collapse into the same definition on unbanked devices. - * - * mfbScanlineFoo - calculate address and do bank switching - * mfbScanlineFooNoBankSwitch - calculate address, don't bank switch - * mfbScanlineFooSrc - calculate address, switch source bank - * mfbScanlineFooDst - calculate address, switch destination bank - */ - -/* The NoBankSwitch versions are the same for banked and unbanked cases */ - -#define mfbScanlineIncNoBankSwitch(_ptr, _off) _ptr += (_off) -#define mfbScanlineOffsetNoBankSwitch(_ptr, _off) ((_ptr) + (_off)) -#define mfbScanlineDeltaNoBankSwitch(_ptr, _y, _w) \ - mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w)) -#define mfbScanlineNoBankSwitch(_ptr, _x, _y, _w) \ - mfbScanlineOffsetNoBankSwitch(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH)) - -#ifdef MFB_LINE_BANK - -#include "mfblinebank.h" /* get macro definitions from this file */ - -#else /* !MFB_LINE_BANK - unbanked case */ - -#define mfbScanlineInc(_ptr, _off) mfbScanlineIncNoBankSwitch(_ptr, _off) -#define mfbScanlineIncSrc(_ptr, _off) mfbScanlineInc(_ptr, _off) -#define mfbScanlineIncDst(_ptr, _off) mfbScanlineInc(_ptr, _off) - -#define mfbScanlineOffset(_ptr, _off) mfbScanlineOffsetNoBankSwitch(_ptr, _off) -#define mfbScanlineOffsetSrc(_ptr, _off) mfbScanlineOffset(_ptr, _off) -#define mfbScanlineOffsetDst(_ptr, _off) mfbScanlineOffset(_ptr, _off) - -#define mfbScanlineSrc(_ptr, _x, _y, _w) mfbScanline(_ptr, _x, _y, _w) -#define mfbScanlineDst(_ptr, _x, _y, _w) mfbScanline(_ptr, _x, _y, _w) - -#define mfbScanlineDeltaSrc(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w) -#define mfbScanlineDeltaDst(_ptr, _y, _w) mfbScanlineDelta(_ptr, _y, _w) - -#endif /* MFB_LINE_BANK */ - -#define mfbScanlineDelta(_ptr, _y, _w) \ - mfbScanlineOffset(_ptr, (_y) * (_w)) - -#define mfbScanline(_ptr, _x, _y, _w) \ - mfbScanlineOffset(_ptr, (_y) * (_w) + ((_x) >> MFB_PWSH)) - - -/* precomputed information about each glyph for GlyphBlt code. - this saves recalculating the per glyph information for each box. -*/ -typedef struct _pos{ - int xpos; /* xposition of glyph's origin */ - int xchar; /* x position mod 32 */ - int leftEdge; - int rightEdge; - int topEdge; - int bottomEdge; - PixelType *pdstBase; /* longword with character origin */ - int widthGlyph; /* width in bytes of this glyph */ -} TEXTPOS; - -/* reduced raster ops for mfb */ -#define RROP_BLACK GXclear -#define RROP_WHITE GXset -#define RROP_NOP GXnoop -#define RROP_INVERT GXinvert - -/* macros for mfbbitblt.c, mfbfillsp.c - these let the code do one switch on the rop per call, rather -than a switch on the rop per item (span or rectangle.) -*/ - -#define fnCLEAR(src, dst) (0) -#define fnAND(src, dst) (src & dst) -#define fnANDREVERSE(src, dst) (src & ~dst) -#define fnCOPY(src, dst) (src) -#define fnANDINVERTED(src, dst) (~src & dst) -#define fnNOOP(src, dst) (dst) -#define fnXOR(src, dst) (src ^ dst) -#define fnOR(src, dst) (src | dst) -#define fnNOR(src, dst) (~(src | dst)) -#define fnEQUIV(src, dst) (~src ^ dst) -#define fnINVERT(src, dst) (~dst) -#define fnORREVERSE(src, dst) (src | ~dst) -#define fnCOPYINVERTED(src, dst)(~src) -#define fnORINVERTED(src, dst) (~src | dst) -#define fnNAND(src, dst) (~(src & dst)) -#undef fnSET -#define fnSET(src, dst) (MfbBits)(~0) - -/* Using a "switch" statement is much faster in most cases - * since the compiler can do a look-up table or multi-way branch - * instruction, depending on the architecture. The result on - * A Sun 3/50 is at least 2.5 times faster, assuming a uniform - * distribution of RasterOp operation types. - * - * However, doing some profiling on a running system reveals - * GXcopy is the operation over 99.5% of the time and - * GXxor is the next most frequent (about .4%), so we make special - * checks for those first. - * - * Note that this requires a change to the "calling sequence" - * since we can't engineer a "switch" statement to have an lvalue. - */ -#undef DoRop -#define DoRop(result, alu, src, dst) \ -{ \ - if (alu == GXcopy) \ - result = fnCOPY (src, dst); \ - else if (alu == GXxor) \ - result = fnXOR (src, dst); \ - else \ - switch (alu) \ - { \ - case GXclear: \ - result = fnCLEAR (src, dst); \ - break; \ - case GXand: \ - result = fnAND (src, dst); \ - break; \ - case GXandReverse: \ - result = fnANDREVERSE (src, dst); \ - break; \ - case GXandInverted: \ - result = fnANDINVERTED (src, dst); \ - break; \ - default: \ - case GXnoop: \ - result = fnNOOP (src, dst); \ - break; \ - case GXor: \ - result = fnOR (src, dst); \ - break; \ - case GXnor: \ - result = fnNOR (src, dst); \ - break; \ - case GXequiv: \ - result = fnEQUIV (src, dst); \ - break; \ - case GXinvert: \ - result = fnINVERT (src, dst); \ - break; \ - case GXorReverse: \ - result = fnORREVERSE (src, dst); \ - break; \ - case GXcopyInverted: \ - result = fnCOPYINVERTED (src, dst); \ - break; \ - case GXorInverted: \ - result = fnORINVERTED (src, dst); \ - break; \ - case GXnand: \ - result = fnNAND (src, dst); \ - break; \ - case GXset: \ - result = fnSET (src, dst); \ - break; \ - } \ -} - - -/* C expression fragments for various operations. These get passed in - * as -D's on the compile command line. See mfb/Imakefile. This - * fixes XBUG 6319. - * - * This seems like a good place to point out that mfb's use of the - * words black and white is an unfortunate misnomer. In mfb code, black - * means zero, and white means one. - */ -#define MFB_OPEQ_WHITE |= -#define MFB_OPEQ_BLACK &=~ -#define MFB_OPEQ_INVERT ^= -#define MFB_EQWHOLEWORD_WHITE =~0 -#define MFB_EQWHOLEWORD_BLACK =0 -#define MFB_EQWHOLEWORD_INVERT ^=~0 -#define MFB_OP_WHITE /* nothing */ -#define MFB_OP_BLACK ~ - -#endif /* MFB_PROTOTYPES_ONLY */ -#endif /* _MFB_H_ */ diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c deleted file mode 100644 index 344c655ee..000000000 --- a/mfb/mfbbitblt.c +++ /dev/null @@ -1,500 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include - -#include "regionstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "mi.h" - -#include "mfb.h" -#include "maskbits.h" - - -/* CopyArea and CopyPlane for a monchrome frame buffer - - - clip the source rectangle to the source's available bits. (this -avoids copying unnecessary pieces that will just get exposed anyway.) -this becomes the new shape of the destination. - clip the destination region to the composite clip in the -GC. this requires translating the destination region to (dstx, dsty). - build a list of source points, one for each rectangle in the -destination. this is a simple translation. - go do the multiple rectangle copies - do graphics exposures -*/ -/** Optimized for drawing pixmaps into windows, especially when drawing into - ** unobscured windows. Calls to the general-purpose region code were - ** replaced with rectangle-to-rectangle clipping comparisions. This is - ** possible, since the pixmap is a single rectangle. In an unobscured - ** window, the destination clip is also a single rectangle, and region - ** code can be avoided entirely. This is a big savings, since the region - ** code uses XAlloc() and makes many function calls. - ** - ** In addition, if source is a pixmap, there is no need to call the - ** expensive miHandleExposures() routine. Instead, we simply return NULL. - ** - ** Previously, drawing a pixmap into an unobscured window executed at least - ** 8 XAlloc()'s, 30 function calls, and hundreds of lines of code. - ** - ** Now, the same operation requires no XAlloc()'s, no region function calls, - ** and much less overhead. Nice for drawing lots of small pixmaps. - */ - - -void -mfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc) - DrawablePtr pSrc, pDst; - int alu; - RegionPtr prgnDst; - DDXPointPtr pptSrc; -{ - switch (alu) - { - case GXcopy: - mfbDoBitbltCopy (pSrc, pDst, alu, prgnDst, pptSrc); - break; - case GXxor: - mfbDoBitbltXor (pSrc, pDst, alu, prgnDst, pptSrc); - break; - case GXcopyInverted: - mfbDoBitbltCopyInverted (pSrc, pDst, alu, prgnDst, pptSrc); - break; - case GXor: - mfbDoBitbltOr (pSrc, pDst, alu, prgnDst, pptSrc); - break; - default: - mfbDoBitbltGeneral (pSrc, pDst, alu, prgnDst, pptSrc); - break; - } -} - -RegionPtr -mfbCopyArea(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 */ - void (*localDoBitBlt)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/); - - 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); - } - - switch (pGC->alu) { - case GXcopy: - localDoBitBlt = mfbDoBitbltCopy; - break; - case GXcopyInverted: - localDoBitBlt = mfbDoBitbltCopyInverted; - break; - case GXxor: - localDoBitBlt = mfbDoBitbltXor; - break; - case GXor: - localDoBitBlt = mfbDoBitbltOr; - break; - default: - localDoBitBlt = mfbDoBitbltGeneral; - break; - } - - 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; - } - - if (pGC->planemask & 1) - (*localDoBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc); - - 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; -} - - -/* - * Devices which use mfb for 1-bit pixmap support - * must register a function for n-to-1 copy operations - */ - -static DevPrivateKey copyPlaneScreenKey = ©PlaneScreenKey; - -Bool -mfbRegisterCopyPlaneProc (pScreen, proc) - ScreenPtr pScreen; - RegionPtr (*proc)( - DrawablePtr /* pSrcDrawable */, - DrawablePtr /* pDstDrawable */, - GCPtr /* pGC */, - int /* srcx */, - int /* srcy */, - int /* width */, - int /* height */, - int /* dstx */, - int /* dsty */, - unsigned long /* bitPlane */); -{ - dixSetPrivate(&pScreen->devPrivates, copyPlaneScreenKey, proc); - return TRUE; -} - -/* - if fg == 1 and bg ==0, we can do an ordinary CopyArea. - if fg == bg, we can do a CopyArea with alu = mfbReduceRop(alu, fg) - if fg == 0 and bg == 1, we use the same rasterop, with - source operand inverted. - - CopyArea deals with all of the graphics exposure events. - This code depends on knowing that we can change the -alu in the GC without having to call ValidateGC() before calling -CopyArea(). - -*/ - - -RegionPtr -mfbCopyPlane(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, plane) -DrawablePtr pSrcDrawable, pDstDrawable; -register GC *pGC; -int srcx, srcy; -int width, height; -int dstx, dsty; -unsigned long plane; -{ - int alu; - RegionPtr prgnExposed; - RegionPtr (*copyPlane)( - DrawablePtr /* pSrcDrawable */, - DrawablePtr /* pDstDrawable */, - GCPtr /* pGC */, - int /* srcx */, - int /* srcy */, - int /* width */, - int /* height */, - int /* dstx */, - int /* dsty */, - unsigned long /* bitPlane */); - - - if (pSrcDrawable->depth != 1) - { - if ((copyPlane = dixLookupPrivate(&pSrcDrawable->pScreen->devPrivates, - copyPlaneScreenKey))) - { - return (*copyPlane) (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, plane); - } - else - { - FatalError ("No copyPlane proc registered for depth %d\n", - pSrcDrawable->depth); - } - } - if (plane != 1) - return NULL; - - if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) - { - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); - } - else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) - { - alu = pGC->alu; - pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); - pGC->alu = alu; - } - else /* need to invert the src */ - { - alu = pGC->alu; - pGC->alu = InverseAlu[alu]; - prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty); - pGC->alu = alu; - } - return prgnExposed; -} - diff --git a/mfb/mfbblt.c b/mfb/mfbblt.c deleted file mode 100644 index b87a69797..000000000 --- a/mfb/mfbblt.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * mfb copy area - */ - -/* - -Copyright 1989, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - -Author: Keith Packard - -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#include "mfb.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "maskbits.h" -#include "fastblt.h" -#include "mergerop.h" - -void -MROP_NAME(mfbDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc) - DrawablePtr pSrc, pDst; - int alu; - RegionPtr prgnDst; - DDXPointPtr pptSrc; -{ - PixelType *psrcBase, *pdstBase; - /* start of src and dst bitmaps */ - 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 xdir; /* 1 = left right, -1 = right left/ */ - int ydir; /* 1 = top down, -1 = bottom up */ - - PixelType *psrcLine, *pdstLine; - /* pointers to line with current src and dst */ - register PixelType *psrc;/* pointer to current src longword */ - register PixelType *pdst;/* pointer to current dst longword */ - - MROP_DECLARE_REG() - - /* following used for looping through a line */ - PixelType startmask, endmask; /* masks for writing ends of dst */ - int nlMiddle; /* whole longwords in dst */ - int xoffSrc, xoffDst; - register int leftShift, rightShift; - register PixelType bits; - register PixelType bits1; - register int nl; /* temp copy of nlMiddle */ - int careful; - - MROP_INITIALIZE(alu,0); - - mfbGetPixelWidthAndPointer(pSrc, widthSrc, psrcBase); - - mfbGetPixelWidthAndPointer(pDst, widthDst, pdstBase); - - /* 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 */ - ydir = -1; - 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; - } - } - else - { - /* walk source top to bottom */ - ydir = 1; - } - - if (careful && (pptSrc->x < pbox->x1)) - { - /* walk source right to left */ - xdir = -1; - - 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; - } - } - else - { - /* walk source left to right */ - xdir = 1; - } - - while(nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - - if (ydir == -1) /* start at last scanline of rectangle */ - { - psrcLine = mfbScanlineDeltaSrc(psrcBase, -(pptSrc->y+h-1), widthSrc); - pdstLine = mfbScanlineDeltaDst(pdstBase, -(pbox->y2-1), widthDst); - } - else /* start at first scanline */ - { - psrcLine = mfbScanlineDeltaSrc(psrcBase, pptSrc->y, widthSrc); - pdstLine = mfbScanlineDeltaDst(pdstBase, pbox->y1, widthDst); - } - if ((pbox->x1 & PIM) + w <= PPW) - { - maskpartialbits (pbox->x1, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits(pbox->x1, w, startmask, endmask, nlMiddle); - } - if (xdir == 1) - { - xoffSrc = pptSrc->x & PIM; - xoffDst = pbox->x1 & PIM; - pdstLine += (pbox->x1 >> PWSH); - psrcLine += (pptSrc->x >> PWSH); -#ifdef DO_UNALIGNED_BITBLT - nl = xoffSrc - xoffDst; - psrcLine = (PixelType *) - (((unsigned char *) psrcLine) + nl); -#else - if (xoffSrc == xoffDst) -#endif - { - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - if (startmask) - { - *pdst = MROP_MASK(*psrc, *pdst, startmask); - psrc++; - pdst++; - } - nl = nlMiddle; - -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); -#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; -#define BodyEven(n) BodyOdd(n) - -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else -#ifdef NOTDEF - /* you'd think this would be faster -- - * a single instruction instead of 6 - * but measurements show it to be ~15% slower - */ - while ((nl -= 6) >= 0) - { - asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0" - : "=m" (*(char *)pdst) - : "m" (*(char *)psrc) - : "d0", "d1", "d2", "d3", - "a2", "a3"); - pdst += 6; - } - nl += 6; - while (nl--) - *pdst++ = *psrc++; -#endif - DuffL(nl, label1, - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++;) -#endif - - if (endmask) - *pdst = MROP_MASK(*psrc, *pdst, endmask); - mfbScanlineIncDst(pdstLine, widthDst); - mfbScanlineIncSrc(psrcLine, widthSrc); - } - } -#ifndef DO_UNALIGNED_BITBLT - else - { - if (xoffSrc > xoffDst) - { - leftShift = (xoffSrc - xoffDst); - rightShift = PPW - leftShift; - } - else - { - rightShift = (xoffDst - xoffSrc); - leftShift = PPW - rightShift; - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - bits = 0; - if (xoffSrc > xoffDst) - bits = *psrc++; - if (startmask) - { - bits1 = BitLeft(bits,leftShift); - if (BitLeft(startmask, rightShift)) { - bits = *psrc++; - bits1 |= BitRight(bits,rightShift); - } - *pdst = MROP_MASK(bits1, *pdst, startmask); - pdst++; - } - nl = nlMiddle; - -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; - -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) \ -bits = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); - -#define BodyEven(n) \ -bits1 = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) \ -bits = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ -pdst++; - -#define BodyEven(n) \ -bits1 = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ -pdst++; - -#define LoopReset ; - -#endif /* !FAST_CONSTANT_OFFSET_MODE */ - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl,label2, - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); - pdst++; - ) -#endif - - if (endmask) - { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) - { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - mfbScanlineIncDst(pdstLine, widthDst); - mfbScanlineIncSrc(psrcLine, widthSrc); - } - } -#endif /* DO_UNALIGNED_BITBLT */ - } - else /* xdir == -1 */ - { - xoffSrc = (pptSrc->x + w - 1) & PIM; - xoffDst = (pbox->x2 - 1) & PIM; - pdstLine += ((pbox->x2-1) >> PWSH) + 1; - psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1; -#ifdef DO_UNALIGNED_BITBLT - nl = xoffSrc - xoffDst; - psrcLine = (PixelType *) - (((unsigned char *) psrcLine) + nl); -#else - if (xoffSrc == xoffDst) -#endif - { - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - if (endmask) - { - pdst--; - psrc--; - *pdst = MROP_MASK (*psrc, *pdst, endmask); - } - nl = nlMiddle; - -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - psrc -= nl & (UNROLL - 1); - pdst -= nl & (UNROLL - 1); - -#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]); - -#define BodyEven(n) BodyOdd(n) - -#define LoopReset \ -pdst -= UNROLL;\ -psrc -= UNROLL; - -#else - -#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst); -#define BodyEven(n) BodyOdd(n) -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL(nl,label3, - --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);) -#endif - - if (startmask) - { - --pdst; - --psrc; - *pdst = MROP_MASK(*psrc, *pdst, startmask); - } - mfbScanlineIncDst(pdstLine, widthDst); - mfbScanlineIncSrc(psrcLine, widthSrc); - } - } -#ifndef DO_UNALIGNED_BITBLT - else - { - if (xoffDst > xoffSrc) - { - rightShift = (xoffDst - xoffSrc); - leftShift = PPW - rightShift; - } - else - { - leftShift = (xoffSrc - xoffDst); - rightShift = PPW - leftShift; - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - bits = 0; - if (xoffDst > xoffSrc) - bits = *--psrc; - if (endmask) - { - bits1 = BitRight(bits, rightShift); - if (BitRight(endmask, leftShift)) { - bits = *--psrc; - bits1 |= BitLeft(bits, leftShift); - } - pdst--; - *pdst = MROP_MASK(bits1, *pdst, endmask); - } - nl = nlMiddle; - -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; -#ifdef FAST_CONSTANT_OFFSET_MODE - psrc -= nl & (UNROLL - 1); - pdst -= nl & (UNROLL - 1); - -#define BodyOdd(n) \ -bits = psrc[n-1]; \ -pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]); - -#define BodyEven(n) \ -bits1 = psrc[n-1]; \ -pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]); - -#define LoopReset \ -pdst -= UNROLL; \ -psrc -= UNROLL; - -#else - -#define BodyOdd(n) \ -bits = *--psrc; --pdst; \ -*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst); - -#define BodyEven(n) \ -bits1 = *--psrc; --pdst; \ -*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst); - -#define LoopReset ; - -#endif - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl, label4, - bits1 = BitRight(bits, rightShift); - bits = *--psrc; - --pdst; - *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst); - ) -#endif - - if (startmask) - { - bits1 = BitRight(bits, rightShift); - if (BitRight (startmask, leftShift)) - { - bits = *--psrc; - bits1 |= BitLeft(bits, leftShift); - } - --pdst; - *pdst = MROP_MASK(bits1, *pdst, startmask); - } - mfbScanlineIncDst(pdstLine, widthDst); - mfbScanlineIncSrc(psrcLine, widthSrc); - } - } -#endif - } - pbox++; - pptSrc++; - } - if (pboxNew2) - { - xfree(pptNew2); - xfree(pboxNew2); - } - if (pboxNew1) - { - xfree(pptNew1); - xfree(pboxNew1); - } -} diff --git a/mfb/mfbbres.c b/mfb/mfbbres.c deleted file mode 100644 index ee2f10f33..000000000 --- a/mfb/mfbbres.c +++ /dev/null @@ -1,368 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "mfb.h" -#include "maskbits.h" -#include "miline.h" - -/* Solid bresenham line */ -/* NOTES - e2 is used less often than e1, so it's not in a register -*/ - -void -mfbBresS(rop, addrlbase, nlwidth, signdx, signdy, axis, x1, y1, e, e1, e2, len) -int rop; /* a reduced rasterop */ -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 32-bit pointer */ - register PixelType bit; /* current bit being set/cleared/etc. */ - PixelType leftbit = mask[0]; /* leftmost bit to process in new word */ - PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */ - - register int e3 = e2-e1; - PixelType tmp; - - /* point to longword containing first point */ - addrl = mfbScanline(addrlbase, x1, y1, nlwidth); - yinc = signdy * nlwidth; - e = e-e1; /* to make looping easier */ - bit = mask[x1 & PIM]; - - if (!len) - return; - if (rop == RROP_BLACK) - { - if (axis == X_AXIS) - { - if (signdx > 0) - { - tmp = *addrl; - for (;;) - { - tmp &= ~bit; - if (!--len) - break; - bit = SCRRIGHT(bit,1); - e += e1; - if (e >= 0) - { - *addrl = tmp; - mfbScanlineInc(addrl, yinc); - e += e3; - if (!bit) - { - bit = leftbit; - addrl ++; - } - tmp = *addrl; - } - else if (!bit) - { - *addrl = tmp; - bit = leftbit; - addrl ++; - tmp = *addrl; - } - } - *addrl = tmp; - } - else - { - tmp = *addrl; - for (;;) - { - tmp &= ~bit; - if (!--len) - break; - e += e1; - bit = SCRLEFT(bit,1); - if (e >= 0) - { - *addrl = tmp; - mfbScanlineInc(addrl, yinc); - e += e3; - if (!bit) - { - bit = rightbit; - addrl --; - } - tmp = *addrl; - } - else if (!bit) - { - *addrl = tmp; - bit = rightbit; - addrl --; - tmp = *addrl; - } - } - *addrl = tmp; - } - } /* if X_AXIS */ - else - { - if (signdx > 0) - { - while(len--) - { - *addrl &= ~bit; - e += e1; - if (e >= 0) - { - bit = SCRRIGHT(bit,1); - if (!bit) { bit = leftbit;addrl ++; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - } - } - else - { - while(len--) - { - *addrl &= ~bit; - e += e1; - if (e >= 0) - { - bit = SCRLEFT(bit,1); - if (!bit) { bit = rightbit;addrl --; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - } - } - } /* else Y_AXIS */ - } - else if (rop == RROP_WHITE) - { - if (axis == X_AXIS) - { - if (signdx > 0) - { - tmp = *addrl; - for (;;) - { - tmp |= bit; - if (!--len) - break; - e += e1; - bit = SCRRIGHT(bit,1); - if (e >= 0) - { - *addrl = tmp; - mfbScanlineInc(addrl, yinc); - e += e3; - if (!bit) - { - bit = leftbit; - addrl ++; - } - tmp = *addrl; - } - else if (!bit) - { - *addrl = tmp; - bit = leftbit; - addrl ++; - tmp = *addrl; - } - } - *addrl = tmp; - } - else - { - tmp = *addrl; - for (;;) - { - tmp |= bit; - if (!--len) - break; - e += e1; - bit = SCRLEFT(bit,1); - if (e >= 0) - { - *addrl = tmp; - mfbScanlineInc(addrl, yinc); - e += e3; - if (!bit) - { - bit = rightbit; - addrl --; - } - tmp = *addrl; - } - else if (!bit) - { - *addrl = tmp; - bit = rightbit; - addrl --; - tmp = *addrl; - } - } - *addrl = tmp; - } - } /* if X_AXIS */ - else - { - if (signdx > 0) - { - while(len--) - { - *addrl |= bit; - e += e1; - if (e >= 0) - { - bit = SCRRIGHT(bit,1); - if (!bit) { bit = leftbit;addrl ++; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - } - } - else - { - while(len--) - { - *addrl |= bit; - e += e1; - if (e >= 0) - { - bit = SCRLEFT(bit,1); - if (!bit) { bit = rightbit;addrl --; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - } - } - } /* else Y_AXIS */ - } - else if (rop == RROP_INVERT) - { - if (axis == X_AXIS) - { - if (signdx > 0) - { - while(len--) - { - *addrl ^= bit; - e += e1; - if (e >= 0) - { - mfbScanlineInc(addrl, yinc); - e += e3; - } - bit = SCRRIGHT(bit,1); - if (!bit) { bit = leftbit;addrl ++; } - } - } - else - { - while(len--) - { - *addrl ^= bit; - e += e1; - if (e >= 0) - { - mfbScanlineInc(addrl, yinc); - e += e3; - } - bit = SCRLEFT(bit,1); - if (!bit) { bit = rightbit;addrl --; } - } - } - } /* if X_AXIS */ - else - { - if (signdx > 0) - { - while(len--) - { - *addrl ^= bit; - e += e1; - if (e >= 0) - { - bit = SCRRIGHT(bit,1); - if (!bit) { bit = leftbit;addrl ++; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - } - } - else - { - while(len--) - { - *addrl ^= bit; - e += e1; - if (e >= 0) - { - bit = SCRLEFT(bit,1); - if (!bit) { bit = rightbit; addrl --; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - } - } - } /* else Y_AXIS */ - } -} diff --git a/mfb/mfbbresd.c b/mfb/mfbbresd.c deleted file mode 100644 index 3904c0db1..000000000 --- a/mfb/mfbbresd.c +++ /dev/null @@ -1,207 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "mfb.h" -#include "maskbits.h" -#include "miline.h" - -/* Dashed bresenham line */ - -#define StepDash\ - if (!--dashRemaining) { \ - if (++ dashIndex == numInDashList) \ - dashIndex = 0; \ - dashRemaining = pDash[dashIndex]; \ - rop = fgrop; \ - if (dashIndex & 1) \ - rop = bgrop; \ - } - -void -mfbBresD(fgrop, bgrop, - pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, - addrlbase, nlwidth, - signdx, signdy, axis, x1, y1, e, e1, e2, len) -int fgrop, bgrop; -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 */ -{ - register int yinc; /* increment to next scanline, in bytes */ - register PixelType *addrl; - register int e3 = e2-e1; - register MfbBits bit; - PixelType leftbit = mask[0]; /* leftmost bit to process in new word */ - PixelType rightbit = mask[PPW-1]; /* rightmost bit to process in new word */ - int dashIndex; - int dashOffset; - int dashRemaining; - int rop; - - dashOffset = *pdashOffset; - dashIndex = *pdashIndex; - dashRemaining = pDash[dashIndex] - dashOffset; - rop = fgrop; - if (!isDoubleDash) - bgrop = -1; - if (dashIndex & 1) - rop = bgrop; - - /* point to longword containing first point */ - addrl = mfbScanline(addrlbase, x1, y1, nlwidth); - yinc = signdy * nlwidth; - e = e-e1; /* to make looping easier */ - bit = mask[x1 & PIM]; - if (axis == X_AXIS) - { - if (signdx > 0) - { - while(len--) - { - if (rop == RROP_BLACK) - *addrl &= ~bit; - else if (rop == RROP_WHITE) - *addrl |= bit; - else if (rop == RROP_INVERT) - *addrl ^= bit; - e += e1; - if (e >= 0) - { - mfbScanlineInc(addrl, yinc); - e += e3; - } - bit = SCRRIGHT(bit,1); - if (!bit) { bit = leftbit;addrl ++; } - StepDash - } - } - else - { - while(len--) - { - if (rop == RROP_BLACK) - *addrl &= ~bit; - else if (rop == RROP_WHITE) - *addrl |= bit; - else if (rop == RROP_INVERT) - *addrl ^= bit; - e += e1; - if (e >= 0) - { - mfbScanlineInc(addrl, yinc); - e += e3; - } - bit = SCRLEFT(bit,1); - if (!bit) { bit = rightbit;addrl --; } - StepDash - } - } - } /* if X_AXIS */ - else - { - if (signdx > 0) - { - while(len--) - { - if (rop == RROP_BLACK) - *addrl &= ~bit; - else if (rop == RROP_WHITE) - *addrl |= bit; - else if (rop == RROP_INVERT) - *addrl ^= bit; - e += e1; - if (e >= 0) - { - bit = SCRRIGHT(bit,1); - if (!bit) { bit = leftbit;addrl ++; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - StepDash - } - } - else - { - while(len--) - { - if (rop == RROP_BLACK) - *addrl &= ~bit; - else if (rop == RROP_WHITE) - *addrl |= bit; - else if (rop == RROP_INVERT) - *addrl ^= bit; - e += e1; - if (e >= 0) - { - bit = SCRLEFT(bit,1); - if (!bit) { bit = rightbit;addrl --; } - e += e3; - } - mfbScanlineInc(addrl, yinc); - StepDash - } - } - } /* else Y_AXIS */ - *pdashIndex = dashIndex; - *pdashOffset = pDash[dashIndex] - dashRemaining; -} diff --git a/mfb/mfbclip.c b/mfb/mfbclip.c deleted file mode 100644 index 48e532aa8..000000000 --- a/mfb/mfbclip.c +++ /dev/null @@ -1,280 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include "regionstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "regionstr.h" -#include "gc.h" -#include "maskbits.h" -#include "mi.h" -#include "mfb.h" - -#define ADDRECT(reg,r,fr,rx1,ry1,rx2,ry2) \ -if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ - (!((reg)->data->numRects && \ - ((r-1)->y1 == (ry1)) && \ - ((r-1)->y2 == (ry2)) && \ - ((r-1)->x1 <= (rx1)) && \ - ((r-1)->x2 >= (rx2))))) \ -{ \ - if ((reg)->data->numRects == (reg)->data->size) \ - { \ - miRectAlloc(reg, 1); \ - fr = REGION_BOXPTR(reg); \ - r = fr + (reg)->data->numRects; \ - } \ - r->x1 = (rx1); \ - r->y1 = (ry1); \ - r->x2 = (rx2); \ - r->y2 = (ry2); \ - (reg)->data->numRects++; \ - if(r->x1 < (reg)->extents.x1) \ - (reg)->extents.x1 = r->x1; \ - if(r->x2 > (reg)->extents.x2) \ - (reg)->extents.x2 = r->x2; \ - r++; \ -} - -/* Convert bitmap clip mask into clipping region. - * First, goes through each line and makes boxes by noting the transitions - * from 0 to 1 and 1 to 0. - * Then it coalesces the current line with the previous if they have boxes - * at the same X coordinates. - */ -RegionPtr -mfbPixmapToRegion(pPix) - PixmapPtr pPix; -{ - register RegionPtr pReg; - register PixelType *pw, w; - register int ib; - int width, h, base, rx1 = 0, crects; - PixelType *pwLineEnd; - int irectPrevStart, irectLineStart; - register BoxPtr prectO, prectN; - BoxPtr FirstRect, rects, prectLineStart; - Bool fInBox, fSame; - register PixelType mask0 = mask[0]; - PixelType *pwLine; - int nWidth; - - pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1); - if(!pReg) - return NullRegion; - FirstRect = REGION_BOXPTR(pReg); - rects = FirstRect; - - pwLine = (PixelType *) pPix->devPrivate.ptr; - nWidth = pPix->devKind / PGSZB; - - width = pPix->drawable.width; - pReg->extents.x1 = width - 1; - pReg->extents.x2 = 0; - irectPrevStart = -1; - for(h = 0; h < pPix->drawable.height; h++) - { - pw = pwLine; - pwLine += nWidth; - irectLineStart = rects - FirstRect; - /* If the Screen left most bit of the word is set, we're starting in - * a box */ - if(*pw & mask0) - { - fInBox = TRUE; - rx1 = 0; - } - else - fInBox = FALSE; - /* Process all words which are fully in the pixmap */ - pwLineEnd = pw + (width >> PWSH); - for (base = 0; pw < pwLineEnd; base += PPW) - { - w = *pw++; - if (fInBox) - { - if (!~w) - continue; - } - else - { - if (!w) - continue; - } - for(ib = 0; ib < PPW; ib++) - { - /* If the Screen left most bit of the word is set, we're - * starting a box */ - if(w & mask0) - { - if(!fInBox) - { - rx1 = base + ib; - /* start new box */ - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - /* end box */ - ADDRECT(pReg, rects, FirstRect, - rx1, h, base + ib, h + 1); - fInBox = FALSE; - } - } - /* Shift the word VISUALLY left one. */ - w = SCRLEFT(w, 1); - } - } - if(width & PIM) - { - /* Process final partial word on line */ - w = *pw++; - for(ib = 0; ib < (width & PIM); ib++) - { - /* If the Screen left most bit of the word is set, we're - * starting a box */ - if(w & mask0) - { - if(!fInBox) - { - rx1 = base + ib; - /* start new box */ - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - /* end box */ - ADDRECT(pReg, rects, FirstRect, - rx1, h, base + ib, h + 1); - fInBox = FALSE; - } - } - /* Shift the word VISUALLY left one. */ - w = SCRLEFT(w, 1); - } - } - /* If scanline ended with last bit set, end the box */ - if(fInBox) - { - ADDRECT(pReg, rects, FirstRect, - rx1, h, base + (width & PIM), h + 1); - } - /* if all rectangles on this line have the same x-coords as - * those on the previous line, then add 1 to all the previous y2s and - * throw away all the rectangles from this line - */ - fSame = FALSE; - if(irectPrevStart != -1) - { - crects = irectLineStart - irectPrevStart; - if(crects == ((rects - FirstRect) - irectLineStart)) - { - prectO = FirstRect + irectPrevStart; - prectN = prectLineStart = FirstRect + irectLineStart; - fSame = TRUE; - while(prectO < prectLineStart) - { - if((prectO->x1 != prectN->x1) || (prectO->x2 != prectN->x2)) - { - fSame = FALSE; - break; - } - prectO++; - prectN++; - } - if (fSame) - { - prectO = FirstRect + irectPrevStart; - while(prectO < prectLineStart) - { - prectO->y2 += 1; - prectO++; - } - rects -= crects; - pReg->data->numRects -= crects; - } - } - } - if(!fSame) - irectPrevStart = irectLineStart; - } - if (!pReg->data->numRects) - pReg->extents.x1 = pReg->extents.x2 = 0; - else - { - pReg->extents.y1 = REGION_BOXPTR(pReg)->y1; - pReg->extents.y2 = REGION_END(pReg)->y2; - if (pReg->data->numRects == 1) - { - xfree(pReg->data); - pReg->data = (RegDataPtr)NULL; - } - } -#ifdef DEBUG - if (!miValidRegion(pReg)) - FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); -#endif - return(pReg); -} - -mfbPixmapToRegionProc * -mfbPixmapToRegionWeak(void) -{ - return mfbPixmapToRegion; -} diff --git a/mfb/mfbcmap.c b/mfb/mfbcmap.c deleted file mode 100644 index 4dabcae1a..000000000 --- a/mfb/mfbcmap.c +++ /dev/null @@ -1,162 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include "scrnintstr.h" -#include "colormapst.h" -#include "resource.h" -#include "micmap.h" -#include "mfb.h" - -/* A monochrome frame buffer is a static gray colormap with two entries. - * We have a "required list" of length 1. Because we can only support 1 - * colormap, we never have to change it, but we may have to change the - * name we call it. If someone installs a new colormap, we know it must - * look just like the old one (because we've checked in dispatch that it was - * a valid colormap identifier, and all the colormap IDs for this device - * look the same). Nevertheless, we still have to uninstall the old colormap - * and install the new one. Similarly, if someone uninstalls a colormap, - * we have to install the default map, even though we know those two looked - * alike. - * The required list concept is pretty much irrelevant when you can only - * have one map installed at a time. - */ - -int -mfbListInstalledColormaps(pScreen, pmaps) - ScreenPtr pScreen; - Colormap *pmaps; -{ - return miListInstalledColormaps(pScreen, pmaps); -} - - -void -mfbInstallColormap(pmap) - ColormapPtr pmap; -{ - miInstallColormap(pmap); -} - -void -mfbUninstallColormap(pmap) - ColormapPtr pmap; -{ - miUninstallColormap(pmap); -} - -/*ARGSUSED*/ -void -mfbResolveColor (pred, pgreen, pblue, pVisual) - unsigned short *pred; - unsigned short *pgreen; - unsigned short *pblue; - VisualPtr pVisual; -{ - /* - * Gets intensity from RGB. If intensity is >= half, pick white, else - * pick black. This may well be more trouble than it's worth. - */ - *pred = *pgreen = *pblue = - (((30L * *pred + - 59L * *pgreen + - 11L * *pblue) >> 8) >= (((1<<8)-1)*50)) ? ~0 : 0; -} - -Bool -mfbCreateColormap(pMap) - ColormapPtr pMap; -{ - ScreenPtr pScreen; - unsigned short red0, green0, blue0; - unsigned short red1, green1, blue1; - Pixel pix; - - pScreen = pMap->pScreen; - if (pScreen->whitePixel == 0) - { - red0 = green0 = blue0 = ~0; - red1 = green1 = blue1 = 0; - } - else - { - red0 = green0 = blue0 = 0; - red1 = green1 = blue1 = ~0; - } - - /* this is a monochrome colormap, it only has two entries, just fill - * them in by hand. If it were a more complex static map, it would be - * worth writing a for loop or three to initialize it */ - - /* this will be pixel 0 */ - pix = 0; - if (AllocColor(pMap, &red0, &green0, &blue0, &pix, 0) != Success) - return FALSE; - - /* this will be pixel 1 */ - if (AllocColor(pMap, &red1, &green1, &blue1, &pix, 0) != Success) - return FALSE; - return TRUE; -} - -/*ARGSUSED*/ -void -mfbDestroyColormap (pMap) - ColormapPtr pMap; -{ - return; -} - -Bool -mfbCreateDefColormap (pScreen) - ScreenPtr pScreen; -{ - return miCreateDefColormap(pScreen); -} diff --git a/mfb/mfbfillarc.c b/mfb/mfbfillarc.c deleted file mode 100644 index cbf47a0eb..000000000 --- a/mfb/mfbfillarc.c +++ /dev/null @@ -1,334 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - -********************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include "regionstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "mfb.h" -#include "maskbits.h" -#include "mifillarc.h" -#include "mi.h" - -static void -mfbFillEllipseSolid( - DrawablePtr pDraw, - xArc *arc, - register int rop) -{ - int x, y, e; - int yk, xk, ym, xm, dx, dy, xorg, yorg; - register int slw; - miFillArcRec info; - PixelType *addrlt, *addrlb; - register PixelType *addrl; - register int n; - int nlwidth; - register int xpos; - PixelType startmask, endmask; - int nlmiddle; - - mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt); - 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 = mfbScanlineOffset(addrlt, (xpos >> PWSH)); - if (((xpos & PIM) + slw) < PPW) - { - maskpartialbits(xpos, slw, startmask); - if (rop == RROP_BLACK) - *addrl &= ~startmask; - else if (rop == RROP_WHITE) - *addrl |= startmask; - else - *addrl ^= startmask; - if (miFillArcLower(slw)) - { - addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH)); - if (rop == RROP_BLACK) - *addrl &= ~startmask; - else if (rop == RROP_WHITE) - *addrl |= startmask; - else - *addrl ^= startmask; - } - continue; - } - maskbits(xpos, slw, startmask, endmask, nlmiddle); - if (startmask) - { - if (rop == RROP_BLACK) - *addrl++ &= ~startmask; - else if (rop == RROP_WHITE) - *addrl++ |= startmask; - else - *addrl++ ^= startmask; - } - n = nlmiddle; - if (rop == RROP_BLACK) - while (n--) - *addrl++ = 0; - else if (rop == RROP_WHITE) - while (n--) - *addrl++ = ~0; - else - while (n--) - *addrl++ ^= ~0; - if (endmask) - { - if (rop == RROP_BLACK) - *addrl &= ~endmask; - else if (rop == RROP_WHITE) - *addrl |= endmask; - else - *addrl ^= endmask; - } - if (!miFillArcLower(slw)) - continue; - addrl = mfbScanlineOffset(addrlb, (xpos >> PWSH)); - if (startmask) - { - if (rop == RROP_BLACK) - *addrl++ &= ~startmask; - else if (rop == RROP_WHITE) - *addrl++ |= startmask; - else - *addrl++ ^= startmask; - } - n = nlmiddle; - if (rop == RROP_BLACK) - while (n--) - *addrl++ = 0; - else if (rop == RROP_WHITE) - while (n--) - *addrl++ = ~0; - else - while (n--) - *addrl++ ^= ~0; - if (endmask) - { - if (rop == RROP_BLACK) - *addrl &= ~endmask; - else if (rop == RROP_WHITE) - *addrl |= endmask; - else - *addrl ^= endmask; - } - } -} - -#define FILLSPAN(xl,xr,addr) \ - if (xr >= xl) \ - { \ - width = xr - xl + 1; \ - addrl = mfbScanlineOffset(addr, (xl >> PWSH)); \ - if (((xl & PIM) + width) < PPW) \ - { \ - maskpartialbits(xl, width, startmask); \ - if (rop == RROP_BLACK) \ - *addrl &= ~startmask; \ - else if (rop == RROP_WHITE) \ - *addrl |= startmask; \ - else \ - *addrl ^= startmask; \ - } \ - else \ - { \ - maskbits(xl, width, startmask, endmask, nlmiddle); \ - if (startmask) \ - { \ - if (rop == RROP_BLACK) \ - *addrl++ &= ~startmask; \ - else if (rop == RROP_WHITE) \ - *addrl++ |= startmask; \ - else \ - *addrl++ ^= startmask; \ - } \ - n = nlmiddle; \ - if (rop == RROP_BLACK) \ - while (n--) \ - *addrl++ = 0; \ - else if (rop == RROP_WHITE) \ - while (n--) \ - *addrl++ = ~0; \ - else \ - while (n--) \ - *addrl++ ^= ~0; \ - if (endmask) \ - { \ - if (rop == RROP_BLACK) \ - *addrl &= ~endmask; \ - else if (rop == RROP_WHITE) \ - *addrl |= endmask; \ - else \ - *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 -mfbFillArcSliceSolidCopy( - DrawablePtr pDraw, - GCPtr pGC, - xArc *arc, - register int rop) -{ - register PixelType *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; - PixelType *addrlt, *addrlb; - int nlwidth; - int width; - PixelType startmask, endmask; - int nlmiddle; - - mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrlt); - miFillArcSetup(arc, &info); - miFillArcSliceSetup(arc, &slice, pGC); - MIFILLARCSETUP(); - xorg += pDraw->x; - yorg += pDraw->y; - addrlb = addrlt; - addrlt = mfbScanlineDeltaNoBankSwitch(addrlt, yorg - y, nlwidth); - addrlb = mfbScanlineDeltaNoBankSwitch(addrlb, yorg + y + dy, nlwidth); - slice.edge1.x += pDraw->x; - slice.edge2.x += pDraw->x; - while (y > 0) - { - mfbScanlineIncNoBankSwitch(addrlt, nlwidth); - mfbScanlineIncNoBankSwitch(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); - } - } -} - -void -mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs) - register DrawablePtr pDraw; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - mfbPrivGC *priv; - register xArc *arc; - register int i; - BoxRec box; - int x2, y2; - RegionPtr cclip; - int rop; - - priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - rop = priv->rop; - if ((rop == RROP_NOP) || !(pGC->planemask & 1)) - 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; - /* - * Because box.x2 and box.y2 get truncated to 16 bits, and the - * RECT_IN_REGION test treats the resulting number as a signed - * integer, the RECT_IN_REGION test alone can go the wrong way. - * This can result in a server crash because the rendering - * routines in this file deal directly with cpu addresses - * of pixels to be stored, and do not clip or otherwise check - * that all such addresses are within their respective pixmaps. - * So we only allow the RECT_IN_REGION test to be used for - * values that can be expressed correctly in a signed short. - */ - x2 = box.x1 + (int)arc->width + 1; - box.x2 = x2; - y2 = box.y1 + (int)arc->height + 1; - box.y2 = y2; - if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && - (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) - { - if ((arc->angle2 >= FULLCIRCLE) || - (arc->angle2 <= -FULLCIRCLE)) - mfbFillEllipseSolid(pDraw, arc, rop); - else - mfbFillArcSliceSolidCopy(pDraw, pGC, arc, rop); - continue; - } - } - miPolyFillArc(pDraw, pGC, 1, arc); - } -} diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c deleted file mode 100644 index a0b3d6716..000000000 --- a/mfb/mfbfillrct.c +++ /dev/null @@ -1,227 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "pixmapstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "miscstruct.h" -#include "regionstr.h" -#include "scrnintstr.h" - -#include "mfb.h" -#include "maskbits.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 -mfbPolyFillRect(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; - mfbPrivGC *priv; - int alu; - mfbFillAreaProcPtr pfn; - PixmapPtr ppix; - - if (!(pGC->planemask & 1)) - return; - - priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - alu = priv->ropFillArea; - pfn = priv->FillArea; - ppix = pGC->pRotatedPixmap; - 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) - (*pfn) (pDrawable,pboxClipped-pboxClippedBase, pboxClippedBase, alu, ppix); - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c deleted file mode 100644 index c073535df..000000000 --- a/mfb/mfbfillsp.c +++ /dev/null @@ -1,1029 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "mfb.h" -#include "maskbits.h" - -#include "mergerop.h" - -#include "servermd.h" -#include "mi.h" -#include "mispans.h" - -/* scanline filling for monochrome frame buffer - written by drewry, oct 1986 - - 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. - - FillSolid is overloaded to be used for OpaqueStipple as well, -if fgPixel == bgPixel. - - - FillTiled is overloaded to be used for OpaqueStipple, if -fgPixel != bgPixel. based on the fill style, it uses -{RotatedPixmap, gc.alu} or {RotatedPixmap, PrivGC.ropOpStip} -*/ - - -void -mfbBlackSolidFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl;/* pointer to current longword in bitmap */ - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - while (n--) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - - if (*pwidth) - { - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - /* all bits inside same longword */ - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl &= ~startmask; - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - *addrl++ &= ~startmask; - Duff (nlmiddle, *addrl++ = 0x0); - if (endmask) - *addrl &= ~endmask; - } - } - pwidth++; - ppt++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - - -void -mfbWhiteSolidFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl;/* pointer to current longword in bitmap */ - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - while (n--) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - - if (*pwidth) - { - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - /* all bits inside same longword */ - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl |= startmask; - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - *addrl++ |= startmask; - Duff (nlmiddle, *addrl++ = ~0); - if (endmask) - *addrl |= endmask; - } - } - pwidth++; - ppt++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - - -void -mfbInvertSolidFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl;/* pointer to current longword in bitmap */ - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - while (n--) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - - if (*pwidth) - { - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - /* all bits inside same longword */ - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl ^= startmask; - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - *addrl++ ^= startmask; - Duff (nlmiddle, *addrl++ ^= ~0); - if (endmask) - *addrl ^= endmask; - } - } - pwidth++; - ppt++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - -void -mfbWhiteStippleFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl;/* pointer to current longword in bitmap */ - register PixelType src; - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - PixmapPtr pStipple; - PixelType *psrc; - int tileHeight; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - pStipple = pGC->pRotatedPixmap; - tileHeight = pStipple->drawable.height; - psrc = (PixelType *)(pStipple->devPrivate.ptr); - - while (n--) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - src = psrc[ppt->y % tileHeight]; - - /* all bits inside same longword */ - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl |= (src & startmask); - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - *addrl++ |= (src & startmask); - Duff (nlmiddle, *addrl++ |= src); - if (endmask) - *addrl |= (src & endmask); - } - pwidth++; - ppt++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - -void -mfbBlackStippleFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl; /* pointer to current longword in bitmap */ - register PixelType src; - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - PixmapPtr pStipple; - PixelType *psrc; - int tileHeight; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - pStipple = pGC->pRotatedPixmap; - tileHeight = pStipple->drawable.height; - psrc = (PixelType *)(pStipple->devPrivate.ptr); - - while (n--) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - src = psrc[ppt->y % tileHeight]; - - /* all bits inside same longword */ - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl &= ~(src & startmask); - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - *addrl++ &= ~(src & startmask); - Duff (nlmiddle, *addrl++ &= ~src); - if (endmask) - *addrl &= ~(src & endmask); - } - pwidth++; - ppt++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - -void -mfbInvertStippleFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl; /* pointer to current longword in bitmap */ - register PixelType src; - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - PixmapPtr pStipple; - PixelType *psrc; - int tileHeight; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - pStipple = pGC->pRotatedPixmap; - tileHeight = pStipple->drawable.height; - psrc = (PixelType *)(pStipple->devPrivate.ptr); - - while (n--) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - src = psrc[ppt->y % tileHeight]; - - /* all bits inside same longword */ - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl ^= (src & startmask); - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - *addrl++ ^= (src & startmask); - Duff(nlmiddle, *addrl++ ^= src); - if (endmask) - *addrl ^= (src & endmask); - } - pwidth++; - ppt++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - -/* this works with tiles of width == PPW */ -#define FILLSPANPPW(ROP) \ - while (n--) \ - { \ - if (*pwidth) \ - { \ - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); \ - src = psrc[ppt->y % tileHeight]; \ - if ( ((ppt->x & PIM) + *pwidth) < PPW) \ - { \ - maskpartialbits(ppt->x, *pwidth, startmask); \ - *addrl = (*addrl & ~startmask) | \ - (ROP(src, *addrl) & startmask); \ - } \ - else \ - { \ - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); \ - if (startmask) \ - { \ - *addrl = (*addrl & ~startmask) | \ - (ROP(src, *addrl) & startmask); \ - addrl++; \ - } \ - while (nlmiddle--) \ - { \ - *addrl = ROP(src, *addrl); \ - addrl++; \ - } \ - if (endmask) \ - *addrl = (*addrl & ~endmask) | \ - (ROP(src, *addrl) & endmask); \ - } \ - } \ - pwidth++; \ - ppt++; \ - } - - - -void -mfbTileFS(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; -{ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *addrl; /* pointer to current longword in bitmap */ - register PixelType src; - register int nlmiddle; - register PixelType startmask; - register PixelType endmask; - PixmapPtr pTile; - PixelType *psrc; - int tileHeight; - int rop; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - MfbBits flip; - - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - pTile = pGC->pRotatedPixmap; - tileHeight = pTile->drawable.height; - psrc = (PixelType *)(pTile->devPrivate.ptr); - if (pGC->fillStyle == FillTiled) - rop = pGC->alu; - else - rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()))->ropOpStip; - - flip = 0; - switch(rop) - { - case GXcopyInverted: /* for opaque stipples */ - flip = ~0; - case GXcopy: - { - -#define DoMaskCopyRop(src,dst,mask) (((dst) & ~(mask)) | ((src) & (mask))) - - while (n--) - { - if (*pwidth) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - src = psrc[ppt->y % tileHeight] ^ flip; - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl = DoMaskCopyRop (src, *addrl, startmask); - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - { - *addrl = DoMaskCopyRop (src, *addrl, startmask); - addrl++; - } - while (nlmiddle--) - { - *addrl = src; - addrl++; - } - if (endmask) - *addrl = DoMaskCopyRop (src, *addrl, endmask); - } - } - pwidth++; - ppt++; - } - } - break; - default: - { - register DeclareMergeRop (); - - InitializeMergeRop(rop,~0); - while (n--) - { - if (*pwidth) - { - addrl = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - src = psrc[ppt->y % tileHeight]; - if ( ((ppt->x & PIM) + *pwidth) < PPW) - { - maskpartialbits(ppt->x, *pwidth, startmask); - *addrl = DoMaskMergeRop (src, *addrl, startmask); - } - else - { - maskbits(ppt->x, *pwidth, startmask, endmask, nlmiddle); - if (startmask) - { - *addrl = DoMaskMergeRop (src, *addrl, startmask); - addrl++; - } - while (nlmiddle--) - { - *addrl = DoMergeRop (src, *addrl); - addrl++; - } - if (endmask) - *addrl = DoMaskMergeRop (src, *addrl, endmask); - } - } - pwidth++; - ppt++; - } - } - break; - } - xfree(pptFree); - xfree(pwidthFree); -} - - -/* Fill spans with tiles that aren't PPW bits wide */ -void -mfbUnnaturalTileFS(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; -{ - int iline; /* first line of tile to use */ - /* 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 */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *pdst;/* pointer to current word in bitmap */ - register PixelType *psrc;/* pointer to current word in tile */ - register int nlMiddle; - register int rop, nstart; - PixelType startmask; - PixmapPtr pTile; /* pointer to tile we want to fill with */ - int w, width, x, xSrc, ySrc, srcStartOver, nend; - int tlwidth, rem, tileWidth, tileHeight, endinc; - PixelType endmask, *psrcT; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - if (pGC->fillStyle == FillTiled) - { - pTile = pGC->tile.pixmap; - tlwidth = pTile->devKind / PGSZB; - rop = pGC->alu; - } - else - { - pTile = pGC->stipple; - tlwidth = pTile->devKind / PGSZB; - rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()))->ropOpStip; - } - - xSrc = pDrawable->x; - ySrc = pDrawable->y; - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - tileWidth = pTile->drawable.width; - tileHeight = pTile->drawable.height; - - /* this replaces rotating the tile. Instead we just adjust the offset - * at which we start grabbing bits from the tile. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and rem always stay within the tile bounds. - */ - xSrc += (pGC->patOrg.x % tileWidth) - tileWidth; - ySrc += (pGC->patOrg.y % tileHeight) - tileHeight; - - while (n--) - { - iline = (ppt->y - ySrc) % tileHeight; - pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth); - x = ppt->x; - - if (*pwidth) - { - width = *pwidth; - while(width > 0) - { - psrc = psrcT; - w = min(tileWidth, width); - if((rem = (x - xSrc) % tileWidth) != 0) - { - /* if we're in the middle of the tile, get - as many bits as will finish the span, or - as many as will get to the left edge of the tile, - or a longword worth, starting at the appropriate - offset in the tile. - */ - w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD); - endinc = rem / BITMAP_SCANLINE_PAD; - getandputrop((psrc+endinc), (rem&PIM), (x & PIM), w, pdst, rop); - if((x & PIM) + w >= PPW) - pdst++; - } - else if(((x & PIM) + w) < PPW) - { - /* doing < PPW bits is easy, and worth special-casing */ - putbitsrop(*psrc, x & PIM, w, pdst, rop); - } - else - { - /* start at the left edge of the tile, - and put down as much as we can - */ - maskbits(x, w, startmask, endmask, nlMiddle); - - if (startmask) - nstart = PPW - (x & PIM); - else - nstart = 0; - if (endmask) - nend = (x + w) & PIM; - else - nend = 0; - - srcStartOver = nstart > PLST; - - if(startmask) - { - putbitsrop(*psrc, (x & PIM), nstart, pdst, rop); - pdst++; -#if defined(__alpha__) || defined(__alpha) - /* - * XXX workaround an egcs 1.1.2 code generation - * bug. This version might actually be faster. - */ - psrc += srcStartOver; -#else - if(srcStartOver) - psrc++; -#endif - } - - while(nlMiddle--) - { - getandputrop0(psrc, nstart, PPW, pdst, rop); - pdst++; - psrc++; - } - if(endmask) - { - getandputrop0(psrc, nstart, nend, pdst, rop); - } - } - x += w; - width -= w; - } - } - ppt++; - pwidth++; - } - xfree(pptFree); - xfree(pwidthFree); -} - - -/* Fill spans with stipples that aren't PPW bits wide */ -void -mfbUnnaturalStippleFS(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; -{ - /* 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 iline; /* first line of tile to use */ - PixelType *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register PixelType *pdst; /* pointer to current word in bitmap */ - register PixelType *psrc; /* pointer to current word in tile */ - register int nlMiddle; - register int rop, nstart; - PixelType startmask; - PixmapPtr pTile; /* pointer to tile we want to fill with */ - int w, width, x, xSrc, ySrc, srcStartOver, nend; - PixelType endmask, *psrcT; - int tlwidth, rem, tileWidth, endinc; - int tileHeight; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - - if (!(pGC->planemask & 1)) - return; - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - pTile = pGC->stipple; - rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()))->rop; - tlwidth = pTile->devKind / PGSZB; - xSrc = pDrawable->x; - ySrc = pDrawable->y; - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - tileWidth = pTile->drawable.width; - tileHeight = pTile->drawable.height; - - /* this replaces rotating the stipple. Instead, we just adjust the offset - * at which we start grabbing bits from the stipple. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and rem always stay within the tile bounds. - */ - xSrc += (pGC->patOrg.x % tileWidth) - tileWidth; - ySrc += (pGC->patOrg.y % tileHeight) - tileHeight; - while (n--) - { - iline = (ppt->y - ySrc) % tileHeight; - pdst = mfbScanline(addrlBase, ppt->x, ppt->y, nlwidth); - psrcT = (PixelType *) pTile->devPrivate.ptr + (iline * tlwidth); - x = ppt->x; - - if (*pwidth) - { - width = *pwidth; - while(width > 0) - { - psrc = psrcT; - w = min(tileWidth, width); - if((rem = (x - xSrc) % tileWidth) != 0) - { - /* if we're in the middle of the tile, get - as many bits as will finish the span, or - as many as will get to the left edge of the tile, - or a longword worth, starting at the appropriate - offset in the tile. - */ - w = min(min(tileWidth - rem, width), BITMAP_SCANLINE_PAD); - endinc = rem / BITMAP_SCANLINE_PAD; - getandputrrop((psrc + endinc), (rem & PIM), (x & PIM), - w, pdst, rop) - if((x & PIM) + w >= PPW) - pdst++; - } - - else if(((x & PIM) + w) < PPW) - { - /* doing < PPW bits is easy, and worth special-casing */ - putbitsrrop(*psrc, x & PIM, w, pdst, rop); - } - else - { - /* start at the left edge of the tile, - and put down as much as we can - */ - maskbits(x, w, startmask, endmask, nlMiddle); - - if (startmask) - nstart = PPW - (x & PIM); - else - nstart = 0; - if (endmask) - nend = (x + w) & PIM; - else - nend = 0; - - srcStartOver = nstart > PLST; - - if(startmask) - { - putbitsrrop(*psrc, (x & PIM), nstart, pdst, rop); - pdst++; - if(srcStartOver) - psrc++; - } - - while(nlMiddle--) - { - getandputrrop0(psrc, nstart, PPW, pdst, rop); - pdst++; - psrc++; - } - if(endmask) - { - getandputrrop0(psrc, nstart, nend, pdst, rop); - } - } - x += w; - width -= w; - } - } - ppt++; - pwidth++; - } - xfree(pptFree); - xfree(pwidthFree); -} diff --git a/mfb/mfbfont.c b/mfb/mfbfont.c deleted file mode 100644 index 672b5d958..000000000 --- a/mfb/mfbfont.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "mfb.h" -#include -#include "dixfontstr.h" -#include "scrnintstr.h" - -/*ARGSUSED*/ -Bool -mfbRealizeFont( pscr, pFont) - ScreenPtr pscr; - FontPtr pFont; -{ - return (TRUE); -} - -mfbRealizeFontProc * -mfbRealizeFontWeak(void) -{ - return mfbRealizeFont; -} - -/*ARGSUSED*/ -Bool -mfbUnrealizeFont( pscr, pFont) - ScreenPtr pscr; - FontPtr pFont; -{ - return (TRUE); -} - -mfbUnrealizeFontProc * -mfbUnrealizeFontWeak(void) -{ - return mfbUnrealizeFont; -} diff --git a/mfb/mfbgc.c b/mfb/mfbgc.c deleted file mode 100644 index 7492d7c04..000000000 --- a/mfb/mfbgc.c +++ /dev/null @@ -1,1120 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#include "mfb.h" -#include "dixfontstr.h" -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "region.h" - -#include "mistruct.h" -#include "migc.h" - -#include "maskbits.h" - -static GCFuncs mfbFuncs = { - mfbValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - - -static GCOps whiteTECopyOps = { - mfbWhiteSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - mfbZeroPolyArcSS, - mfbFillPolyWhite, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbTEGlyphBltWhite, - mfbPolyGlyphBltWhite, - mfbSolidPP -}; - -static GCOps blackTECopyOps = { - mfbBlackSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - mfbZeroPolyArcSS, - mfbFillPolyBlack, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbTEGlyphBltBlack, - mfbPolyGlyphBltBlack, - mfbSolidPP -}; - -static GCOps whiteTEInvertOps = { - mfbInvertSolidFS, - mfbSetSpans, - mfbPutImage, - miCopyArea, - miCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - miZeroPolyArc, - mfbFillPolyInvert, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbTEGlyphBltWhite, - mfbPolyGlyphBltInvert, - mfbSolidPP -}; - -static GCOps blackTEInvertOps = { - mfbInvertSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - miZeroPolyArc, - mfbFillPolyInvert, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbTEGlyphBltBlack, - mfbPolyGlyphBltInvert, - mfbSolidPP -}; - -static GCOps whiteCopyOps = { - mfbWhiteSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - mfbZeroPolyArcSS, - mfbFillPolyWhite, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbImageGlyphBltWhite, - mfbPolyGlyphBltWhite, - mfbSolidPP -}; - -static GCOps blackCopyOps = { - mfbBlackSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - mfbZeroPolyArcSS, - mfbFillPolyBlack, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbImageGlyphBltBlack, - mfbPolyGlyphBltBlack, - mfbSolidPP -}; - -static GCOps whiteInvertOps = { - mfbInvertSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - miZeroPolyArc, - mfbFillPolyInvert, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbImageGlyphBltWhite, - mfbPolyGlyphBltInvert, - mfbSolidPP -}; - -static GCOps blackInvertOps = { - mfbInvertSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - miZeroPolyArc, - mfbFillPolyInvert, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - mfbImageGlyphBltBlack, - mfbPolyGlyphBltInvert, - mfbSolidPP -}; - -static GCOps whiteWhiteCopyOps = { - mfbWhiteSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - mfbZeroPolyArcSS, - mfbFillPolyWhite, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - mfbPolyGlyphBltWhite, - mfbSolidPP -}; - -static GCOps blackBlackCopyOps = { - mfbBlackSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - mfbZeroPolyArcSS, - mfbFillPolyBlack, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - mfbPolyGlyphBltBlack, - mfbSolidPP -}; - -static GCOps fgEqBgInvertOps = { - mfbInvertSolidFS, - mfbSetSpans, - mfbPutImage, - mfbCopyArea, - mfbCopyPlane, - mfbPolyPoint, - mfbLineSS, - mfbSegmentSS, - miPolyRectangle, - miZeroPolyArc, - mfbFillPolyInvert, - mfbPolyFillRect, - mfbPolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - miImageGlyphBlt, - mfbPolyGlyphBltInvert, - mfbSolidPP -}; - - -struct commonOps { - int fg, bg; - int rrop; - int terminalFont; - GCOps *ops; - void (*fillArea)( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*nop*/); -}; - -static struct commonOps mfbCommonOps[] = { - { 1, 0, RROP_WHITE, 1, &whiteTECopyOps, mfbSolidWhiteArea }, - { 0, 1, RROP_BLACK, 1, &blackTECopyOps, mfbSolidBlackArea }, - { 1, 0, RROP_INVERT, 1, &whiteTEInvertOps, mfbSolidInvertArea }, - { 0, 1, RROP_INVERT, 1, &blackTEInvertOps, mfbSolidInvertArea }, - { 1, 0, RROP_WHITE, 0, &whiteCopyOps, mfbSolidWhiteArea }, - { 0, 1, RROP_BLACK, 0, &blackCopyOps, mfbSolidBlackArea }, - { 1, 0, RROP_INVERT, 0, &whiteInvertOps, mfbSolidInvertArea }, - { 0, 1, RROP_INVERT, 0, &blackInvertOps, mfbSolidInvertArea }, - { 1, 1, RROP_WHITE, 0, &whiteWhiteCopyOps, mfbSolidWhiteArea }, - { 0, 0, RROP_BLACK, 0, &blackBlackCopyOps, mfbSolidBlackArea }, - { 1, 1, RROP_INVERT, 0, &fgEqBgInvertOps, mfbSolidInvertArea }, - { 0, 0, RROP_INVERT, 0, &fgEqBgInvertOps, mfbSolidInvertArea }, -}; - -#define numberCommonOps (sizeof (mfbCommonOps) / sizeof (mfbCommonOps[0])) - -static GCOps * -matchCommon ( - GCPtr pGC) -{ - int i; - struct commonOps *cop; - mfbPrivGC *priv; - - if (pGC->lineWidth != 0) - return 0; - if (pGC->lineStyle != LineSolid) - return 0; - if (pGC->fillStyle != FillSolid) - return 0; - if (!pGC->font || - FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0) - return 0; - priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - for (i = 0; i < numberCommonOps; i++) { - cop = &mfbCommonOps[i]; - if ((pGC->fgPixel & 1) != cop->fg) - continue; - if ((pGC->bgPixel & 1) != cop->bg) - continue; - if (priv->rop != cop->rrop) - continue; - if (cop->terminalFont && !TERMINALFONT(pGC->font)) - continue; - priv->FillArea = cop->fillArea; - return cop->ops; - } - return 0; -} - - -Bool -mfbCreateGC(pGC) - register GCPtr pGC; -{ - mfbPrivGC *pPriv; - - pGC->clientClip = NULL; - pGC->clientClipType = CT_NONE; - - /* some of the output primitives aren't really necessary, since - they will be filled in ValidateGC because of dix/CreateGC() - setting all the change bits. Others are necessary because although - they depend on being a monochrome frame buffer, they don't change - */ - - pGC->ops = &whiteCopyOps; - pGC->funcs = &mfbFuncs; - - /* mfb wants to translate before scan convesion */ - pGC->miTranslate = 1; - - pPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel); - pGC->fExpose = TRUE; - pGC->pRotatedPixmap = NullPixmap; - pGC->freeCompClip = FALSE; - pPriv->FillArea = mfbSolidInvertArea; - return TRUE; -} - -/* some noop functions */ -static void -mfbPolyGlyphBltNoop( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr * ppci, - pointer pglyphBase) -{ - /* this is a no-op function */ -} - -static void -mfbNoopFS( - DrawablePtr pDrawable, - GCPtr pGC, - int nInit, - DDXPointPtr pptInit, - int * pwidthInit, - int fSorted) -{ - /* this is a no-op function */ -} - -static void -mfbFillPolyNoop( - DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, - int count, - DDXPointPtr ptsIn) -{ - /* this is a no-op function */ -} - - -/* 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 -*/ - -/*ARGSUSED*/ -void -mfbValidateGC(pGC, changes, pDrawable) - register GCPtr pGC; - unsigned long changes; - DrawablePtr pDrawable; -{ - register mfbPrivGCPtr devPriv; - int mask; /* stateChanges */ - int index; /* used for stepping through bitfields */ - int xrot, yrot; /* rotations for tile and stipple pattern */ - int rrop; /* reduced rasterop */ - /* flags for changing the proc vector - and updating things in devPriv - */ - int new_rotate, new_rrop, new_line, new_text, new_fill; - DDXPointRec oldOrg; /* origin of thing GC was last used with */ - - oldOrg = pGC->lastWinOrg; - - pGC->lastWinOrg.x = pDrawable->x; - pGC->lastWinOrg.y = pDrawable->y; - - /* we need to re-rotate the tile if the previous window/pixmap - origin (oldOrg) differs from the new window/pixmap origin - (pGC->lastWinOrg) - */ - new_rotate = (oldOrg.x != pGC->lastWinOrg.x) || - (oldOrg.y != pGC->lastWinOrg.y); - - devPriv = (mfbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - /* - 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)) - ) - { - miComputeCompositeClip(pGC, pDrawable); - } - - new_rrop = FALSE; - new_line = FALSE; - new_text = FALSE; - new_fill = FALSE; - - mask = changes; - while (mask) - { - index = lowbit (mask); - mask &= ~index; - - /* this switch acculmulates a list of which procedures - might have to change due to changes in the GC. in - some cases (e.g. changing one 16 bit tile for another) - we might not really need a change, but the code is - being paranoid. - this sort of batching wins if, for example, the alu - and the font have been changed, or any other pair - of items that both change the same thing. - */ - switch (index) - { - case GCFunction: - case GCForeground: - new_rrop = TRUE; - break; - case GCPlaneMask: - break; - case GCBackground: - new_rrop = TRUE; /* for opaque stipples */ - break; - case GCLineStyle: - case GCLineWidth: - case GCJoinStyle: - new_line = TRUE; - break; - case GCCapStyle: - break; - case GCFillStyle: - new_fill = TRUE; - break; - case GCFillRule: - break; - case GCTile: - if(pGC->tileIsPixel) - break; - new_rotate = TRUE; - new_fill = TRUE; - break; - - case GCStipple: - if(pGC->stipple == (PixmapPtr)NULL) - break; - new_rotate = TRUE; - new_fill = TRUE; - break; - - case GCTileStipXOrigin: - new_rotate = TRUE; - break; - - case GCTileStipYOrigin: - new_rotate = TRUE; - break; - - case GCFont: - new_text = TRUE; - break; - case GCSubwindowMode: - break; - case GCGraphicsExposures: - break; - case GCClipXOrigin: - break; - case GCClipYOrigin: - break; - case GCClipMask: - break; - case GCDashOffset: - break; - case GCDashList: - break; - case GCArcMode: - break; - default: - break; - } - } - - /* deal with the changes we've collected . - new_rrop must be done first because subsequent things - depend on it. - */ - - if(new_rotate || new_fill) - { - Bool new_pix = FALSE; - - /* figure out how much to rotate */ - xrot = pGC->patOrg.x; - yrot = pGC->patOrg.y; - xrot += pDrawable->x; - yrot += pDrawable->y; - - switch (pGC->fillStyle) - { - case FillTiled: - /* copy current tile and stipple */ - if (!pGC->tileIsPixel && (pGC->tile.pixmap->drawable.width <= PPW) && - !(pGC->tile.pixmap->drawable.width & (pGC->tile.pixmap->drawable.width - 1))) - { - mfbCopyRotatePixmap(pGC->tile.pixmap, - &pGC->pRotatedPixmap, xrot, yrot); - new_pix = TRUE; - } - break; - case FillStippled: - case FillOpaqueStippled: - if (pGC->stipple && (pGC->stipple->drawable.width <= PPW) && - !(pGC->stipple->drawable.width & (pGC->stipple->drawable.width - 1))) - { - mfbCopyRotatePixmap(pGC->stipple, - &pGC->pRotatedPixmap, xrot, yrot); - new_pix = TRUE; - } - } - /* destroy any previously rotated tile or stipple */ - if (!new_pix && pGC->pRotatedPixmap) - { - (*pDrawable->pScreen->DestroyPixmap)(pGC->pRotatedPixmap); - pGC->pRotatedPixmap = (PixmapPtr)NULL; - } - } - - /* - * duck out here when the GC is unchanged - */ - - if (!changes) - return; - - if (new_rrop || new_fill) - { - rrop = mfbReduceRop(pGC->alu, pGC->fgPixel); - devPriv->rop = rrop; - new_fill = TRUE; - /* FillArea raster op is GC's for tile filling, - and the reduced rop for solid and stipple - */ - if (pGC->fillStyle == FillTiled) - devPriv->ropFillArea = pGC->alu; - else - devPriv->ropFillArea = rrop; - - /* opaque stipples: - fg bg ropOpStip fill style - 1 0 alu tile - 0 1 inverseAlu tile - 1 1 rrop(fg, alu) solid - 0 0 rrop(fg, alu) solid - Note that rrop(fg, alu) == mfbPrivGC.rop, so we don't really need to - compute it. - */ - if (pGC->fillStyle == FillOpaqueStippled) - { - if ((pGC->fgPixel & 1) != (pGC->bgPixel & 1)) - { - if (pGC->fgPixel & 1) - devPriv->ropOpStip = pGC->alu; - else - devPriv->ropOpStip = InverseAlu[pGC->alu]; - } - else - devPriv->ropOpStip = rrop; - devPriv->ropFillArea = devPriv->ropOpStip; - } - } - else - rrop = devPriv->rop; - - if (new_line || new_fill || new_text) - { - GCOps *newops; - - if ((newops = matchCommon (pGC))) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - new_line = new_fill = new_text = 0; - } - else - { - if (!pGC->ops->devPrivate.val) - { - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - } - } - - if (new_line || new_fill) - { - if (pGC->lineWidth == 0) - { - if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid) - && ((rrop == RROP_WHITE) || (rrop == RROP_BLACK))) - pGC->ops->PolyArc = mfbZeroPolyArcSS; - else - pGC->ops->PolyArc = miZeroPolyArc; - } - else - pGC->ops->PolyArc = miPolyArc; - if (pGC->lineStyle == LineSolid) - { - if(pGC->lineWidth == 0) - { - if (pGC->fillStyle == FillSolid) - { - pGC->ops->PolySegment = mfbSegmentSS; - pGC->ops->Polylines = mfbLineSS; - } - else - { - pGC->ops->PolySegment = miPolySegment; - pGC->ops->Polylines = miZeroLine; - } - } - else - { - pGC->ops->PolySegment = miPolySegment; - pGC->ops->Polylines = miWideLine; - } - } - else - { - if(pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) - { - pGC->ops->Polylines = mfbLineSD; - pGC->ops->PolySegment = mfbSegmentSD; - } - else - { - pGC->ops->Polylines = miWideDash; - pGC->ops->PolySegment = miPolySegment; - } - } - } - - if (new_text || new_fill) - { - if ((pGC->font) && - (FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0)) - { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - else - { - /* special case ImageGlyphBlt for terminal emulator fonts */ - - - if ((pGC->font) && - TERMINALFONT(pGC->font) && - ((pGC->fgPixel & 1) != (pGC->bgPixel & 1))) - { - /* pcc bug makes this not compile... - pGC->ops->ImageGlyphBlt = (pGC->fgPixel & 1) ? mfbTEGlyphBltWhite : - mfbTEGlyphBltBlack; - */ - if (pGC->fgPixel & 1) - pGC->ops->ImageGlyphBlt = mfbTEGlyphBltWhite; - else - pGC->ops->ImageGlyphBlt = mfbTEGlyphBltBlack; - } - else - - - { - if (pGC->fgPixel & 1) - pGC->ops->ImageGlyphBlt = mfbImageGlyphBltWhite; - else - pGC->ops->ImageGlyphBlt = mfbImageGlyphBltBlack; - } - - /* now do PolyGlyphBlt */ - if (pGC->fillStyle == FillSolid || - (pGC->fillStyle == FillOpaqueStippled && - (pGC->fgPixel & 1) == (pGC->bgPixel & 1) - ) - ) - { - if (rrop == RROP_WHITE) - pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltWhite; - else if (rrop == RROP_BLACK) - pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltBlack; - else if (rrop == RROP_INVERT) - pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltInvert; - else - pGC->ops->PolyGlyphBlt = mfbPolyGlyphBltNoop; - } - else - { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - } - } - } - - if (new_fill) - - - { - /* install a suitable fillspans and pushpixels */ - pGC->ops->PushPixels = mfbPushPixels; - pGC->ops->FillPolygon = miFillPolygon; - if ((pGC->fillStyle == FillSolid) || - ((pGC->fillStyle == FillOpaqueStippled) && - ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)))) - { - pGC->ops->PushPixels = mfbSolidPP; - switch(devPriv->rop) - { - case RROP_WHITE: - pGC->ops->FillSpans = mfbWhiteSolidFS; - pGC->ops->FillPolygon = mfbFillPolyWhite; - break; - case RROP_BLACK: - pGC->ops->FillSpans = mfbBlackSolidFS; - pGC->ops->FillPolygon = mfbFillPolyBlack; - break; - case RROP_INVERT: - pGC->ops->FillSpans = mfbInvertSolidFS; - pGC->ops->FillPolygon = mfbFillPolyInvert; - break; - case RROP_NOP: - pGC->ops->FillSpans = mfbNoopFS; - pGC->ops->FillPolygon = mfbFillPolyNoop; - break; - } - } - /* beyond this point, opaqueStippled ==> fg != bg */ - else if (((pGC->fillStyle == FillTiled) || - (pGC->fillStyle == FillOpaqueStippled)) && - !pGC->pRotatedPixmap) - { - pGC->ops->FillSpans = mfbUnnaturalTileFS; - } - else if ((pGC->fillStyle == FillStippled) && !pGC->pRotatedPixmap) - { - pGC->ops->FillSpans = mfbUnnaturalStippleFS; - } - else if (pGC->fillStyle == FillStippled) - { - switch(devPriv->rop) - { - case RROP_WHITE: - pGC->ops->FillSpans = mfbWhiteStippleFS; - break; - case RROP_BLACK: - pGC->ops->FillSpans = mfbBlackStippleFS; - break; - case RROP_INVERT: - pGC->ops->FillSpans = mfbInvertStippleFS; - break; - case RROP_NOP: - pGC->ops->FillSpans = mfbNoopFS; - break; - } - } - else /* overload tiles to do parti-colored opaque stipples */ - { - pGC->ops->FillSpans = mfbTileFS; - } - if (pGC->fillStyle == FillSolid) - pGC->ops->PolyFillArc = mfbPolyFillArcSolid; - else - pGC->ops->PolyFillArc = miPolyFillArc; - /* the rectangle code doesn't deal with opaque stipples that - are two colors -- we can fool it for fg==bg, though - */ - if ((((pGC->fillStyle == FillTiled) || - (pGC->fillStyle == FillStippled)) && - !pGC->pRotatedPixmap) || - ((pGC->fillStyle == FillOpaqueStippled) && - ((pGC->fgPixel & 1) != (pGC->bgPixel & 1))) - ) - { - pGC->ops->PolyFillRect = miPolyFillRect; - } - else /* deal with solids and natural stipples and tiles */ - { - pGC->ops->PolyFillRect = mfbPolyFillRect; - - if ((pGC->fillStyle == FillSolid) || - ((pGC->fillStyle == FillOpaqueStippled) && - ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)))) - { - switch(devPriv->rop) - { - case RROP_WHITE: - devPriv->FillArea = mfbSolidWhiteArea; - break; - case RROP_BLACK: - devPriv->FillArea = mfbSolidBlackArea; - break; - case RROP_INVERT: - devPriv->FillArea = mfbSolidInvertArea; - break; - case RROP_NOP: - devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA; - break; - } - } - else if (pGC->fillStyle == FillStippled) - { - switch(devPriv->rop) - { - case RROP_WHITE: - devPriv->FillArea = mfbStippleWhiteArea; - break; - case RROP_BLACK: - devPriv->FillArea = mfbStippleBlackArea; - break; - case RROP_INVERT: - devPriv->FillArea = mfbStippleInvertArea; - break; - case RROP_NOP: - devPriv->FillArea = (mfbFillAreaProcPtr)NoopDDA; - break; - } - } - else /* deal with tiles */ - { - switch (pGC->alu) - { - case GXcopy: - devPriv->FillArea = mfbTileAreaPPWCopy; - break; - default: - devPriv->FillArea = mfbTileAreaPPWGeneral; - break; - } - } - } /* end of natural rectangles */ - } /* end of new_fill */ - - -} - -/* table to map alu(src, dst) to alu(~src, dst) */ -int InverseAlu[16] = { - GXclear, - GXandInverted, - GXnor, - GXcopyInverted, - GXand, - GXnoop, - GXequiv, - GXorInverted, - GXandReverse, - GXxor, - GXinvert, - GXnand, - GXcopy, - GXor, - GXorReverse, - GXset -}; - -int mfbGetInverseAlu(i) - int i; -{ - return InverseAlu[i]; -} - -int -mfbReduceRop(alu, src) - register int alu; - register Pixel src; -{ - int rop = 0; - if ((src & 1) == 0) /* src is black */ - { - switch(alu) - { - case GXclear: - rop = RROP_BLACK; - break; - case GXand: - rop = RROP_BLACK; - break; - case GXandReverse: - rop = RROP_BLACK; - break; - case GXcopy: - rop = RROP_BLACK; - break; - case GXandInverted: - rop = RROP_NOP; - break; - case GXnoop: - rop = RROP_NOP; - break; - case GXxor: - rop = RROP_NOP; - break; - case GXor: - rop = RROP_NOP; - break; - case GXnor: - rop = RROP_INVERT; - break; - case GXequiv: - rop = RROP_INVERT; - break; - case GXinvert: - rop = RROP_INVERT; - break; - case GXorReverse: - rop = RROP_INVERT; - break; - case GXcopyInverted: - rop = RROP_WHITE; - break; - case GXorInverted: - rop = RROP_WHITE; - break; - case GXnand: - rop = RROP_WHITE; - break; - case GXset: - rop = RROP_WHITE; - break; - } - } - else /* src is white */ - { - switch(alu) - { - case GXclear: - rop = RROP_BLACK; - break; - case GXand: - rop = RROP_NOP; - break; - case GXandReverse: - rop = RROP_INVERT; - break; - case GXcopy: - rop = RROP_WHITE; - break; - case GXandInverted: - rop = RROP_BLACK; - break; - case GXnoop: - rop = RROP_NOP; - break; - case GXxor: - rop = RROP_INVERT; - break; - case GXor: - rop = RROP_WHITE; - break; - case GXnor: - rop = RROP_BLACK; - break; - case GXequiv: - rop = RROP_NOP; - break; - case GXinvert: - rop = RROP_INVERT; - break; - case GXorReverse: - rop = RROP_WHITE; - break; - case GXcopyInverted: - rop = RROP_BLACK; - break; - case GXorInverted: - rop = RROP_NOP; - break; - case GXnand: - rop = RROP_INVERT; - break; - case GXset: - rop = RROP_WHITE; - break; - } - } - return rop; -} diff --git a/mfb/mfbgetsp.c b/mfb/mfbgetsp.c deleted file mode 100644 index befe57a1f..000000000 --- a/mfb/mfbgetsp.c +++ /dev/null @@ -1,157 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include "misc.h" -#include "region.h" -#include "gc.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "mfb.h" -#include "maskbits.h" - -#include "servermd.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. - */ -/*ARGSUSED*/ -void -mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) - DrawablePtr pDrawable; /* drawable from which to get bits */ - int wMax; /* largest value of all *pwidths */ - register DDXPointPtr ppt; /* points to start copying from */ - int *pwidth; /* list of number of bits to copy */ - int nspans; /* number of scanlines to copy */ - char *pchardstStart; /* where to put the bits */ -{ - PixelType *pdstStart = (PixelType *)(pointer)pchardstStart; - register PixelType *pdst; /* where to put the bits */ - register PixelType *psrc; /* where to get the bits */ - register PixelType tmpSrc; /* scratch buffer for bits */ - PixelType *psrcBase; /* start of src bitmap */ - int widthSrc; /* width of pixmap in bytes */ - register DDXPointPtr pptLast; /* one past last point to get */ - int xEnd; /* last pixel to copy from */ - register int nstart; - int nend = 0; - int srcStartOver; - PixelType startmask, endmask; - unsigned int srcBit; - int nlMiddle, nl; - int w; - - pptLast = ppt + nspans; - - mfbGetPixelWidthAndPointer(pDrawable, widthSrc, psrcBase); - pdst = pdstStart; - - while(ppt < pptLast) - { - /* XXX should this really be << PWSH, or * 8, or * PGSZB? */ - xEnd = min(ppt->x + *pwidth, widthSrc << PWSH); - pwidth++; - psrc = mfbScanline(psrcBase, ppt->x, ppt->y, widthSrc); - w = xEnd - ppt->x; - srcBit = ppt->x & PIM; - - if (srcBit + w <= PPW) - { - getandputbits0(psrc, srcBit, w, pdst); - pdst++; - } - else - { - - maskbits(ppt->x, w, startmask, endmask, nlMiddle); - if (startmask) - nstart = PPW - srcBit; - else - nstart = 0; - if (endmask) - nend = xEnd & PIM; - srcStartOver = srcBit + nstart > PLST; - if (startmask) - { - getandputbits0(psrc, srcBit, nstart, pdst); - if(srcStartOver) - psrc++; - } - nl = nlMiddle; -#ifdef FASTPUTBITS - Duff(nl, putbits(*psrc, nstart, PPW, pdst); psrc++; pdst++;); -#else - while (nl--) - { - tmpSrc = *psrc; - putbits(tmpSrc, nstart, PPW, pdst); - psrc++; - pdst++; - } -#endif - if (endmask) - { - putbits(*psrc, nstart, nend, pdst); - if(nstart + nend > PPW) - pdst++; - } - if (startmask || endmask) - pdst++; - } - ppt++; - } -} diff --git a/mfb/mfbhrzvert.c b/mfb/mfbhrzvert.c deleted file mode 100644 index 7616f9bf2..000000000 --- a/mfb/mfbhrzvert.c +++ /dev/null @@ -1,177 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include "gc.h" -#include "window.h" -#include "pixmap.h" -#include "region.h" - -#include "mfb.h" -#include "maskbits.h" - -/* horizontal solid line - abs(len) > 1 -*/ -void -mfbHorzS(rop, addrl, nlwidth, x1, y1, len) -int rop; /* a reduced rasterop */ -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); - if (rop == RROP_BLACK) - { - *addrl &= ~startmask; - } - else if (rop == RROP_WHITE) - { - *addrl |= startmask; - } - else if (rop == RROP_INVERT) - { - *addrl ^= startmask; - } - } - else - { - maskbits(x1, len, startmask, endmask, nlmiddle); - if (rop == RROP_BLACK) - { - if (startmask) - *addrl++ &= ~startmask; - Duff (nlmiddle, *addrl++ = 0x0); - if (endmask) - *addrl &= ~endmask; - } - else if (rop == RROP_WHITE) - { - if (startmask) - *addrl++ |= startmask; - Duff (nlmiddle, *addrl++ = ~0); - if (endmask) - *addrl |= endmask; - } - else if (rop == RROP_INVERT) - { - if (startmask) - *addrl++ ^= startmask; - Duff (nlmiddle, *addrl++ ^= ~0); - if (endmask) - *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 -mfbVertS(rop, addrl, nlwidth, x1, y1, len) -int rop; /* a reduced rasterop */ -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; - } - - if (rop == RROP_BLACK) - { - bitmask = rmask[x1 & PIM]; - Duff(len, *addrl &= bitmask; mfbScanlineInc(addrl, nlwidth) ); - } - else if (rop == RROP_WHITE) - { - bitmask = mask[x1 & PIM]; - Duff(len, *addrl |= bitmask; mfbScanlineInc(addrl, nlwidth) ); - } - else if (rop == RROP_INVERT) - { - bitmask = mask[x1 & PIM]; - Duff(len, *addrl ^= bitmask; mfbScanlineInc(addrl, nlwidth) ); - } -} diff --git a/mfb/mfbimage.c b/mfb/mfbimage.c deleted file mode 100644 index 8861865a6..000000000 --- a/mfb/mfbimage.c +++ /dev/null @@ -1,177 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include - -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "gcstruct.h" - -#include "mfb.h" -#include "mi.h" -#include - -#include "maskbits.h" - -#include "servermd.h" - -/* Put and Get images on a monochrome frame buffer - * - * we do this by creating a temporary pixmap and making its - * pointer to bits point to the buffer read in from the client. - * this works because of the padding rules specified at startup - * - * Note that CopyArea must know how to copy a bitmap into the server-format - * temporary pixmap. - * - * For speed, mfbPutImage should allocate the temporary pixmap on the stack. - * - * even though an XYBitmap and an XYPixmap have the same - * format (for this device), PutImage has different semantics for the - * two. XYPixmap just does the copy; XYBitmap takes gc.fgPixel for - * a 1 bit, gc.bgPixel for a 0 bit, which we notice is exactly - * like CopyPlane. - * - * written by drewry, september 1986 - */ - - - -/*ARGSUSED*/ -void -mfbPutImage(dst, pGC, depth, x, y, w, h, leftPad, format, pImage) - DrawablePtr dst; - GCPtr pGC; - int depth, x, y, w, h; - int leftPad; - int format; - char *pImage; -{ - PixmapPtr pPixmap; - - if (!(pGC->planemask & 1)) - return; - - /* 0 may confuse CreatePixmap, and will sometimes be - passed by the mi text code - */ - if ((w == 0) || (h == 0)) - return; - - pPixmap = GetScratchPixmapHeader(dst->pScreen, w+leftPad, h, 1, 1, - BitmapBytePad(w+leftPad), (pointer)pImage); - if (!pPixmap) - return; - - pGC->fExpose = FALSE; - if (format != XYBitmap) - (*pGC->ops->CopyArea)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0, - w, h, x, y); - else - (*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, dst, pGC, leftPad, 0, - w, h, x, y, 1); - pGC->fExpose = TRUE; - FreeScratchPixmapHeader(pPixmap); -} - - -/* - * pdstLine points to space allocated by caller, which he can do since - * he knows dimensions of the pixmap - * we can call mfbDoBitblt because the dispatcher has promised not to send us - * anything that would require going over the edge of the screen. - * - * XYPixmap and ZPixmap are the same for mfb. - * For any planemask with bit 0 == 0, just fill the dst with 0. - */ -/*ARGSUSED*/ -void -mfbGetImage( pDrawable, sx, sy, w, h, format, planeMask, pdstLine) - DrawablePtr pDrawable; - int sx, sy, w, h; - unsigned int format; - unsigned long planeMask; - char *pdstLine; -{ - BoxRec box; - DDXPointRec ptSrc; - RegionRec rgnDst; - - if (planeMask & 0x1) - { - ScreenPtr pScreen = pDrawable->pScreen; - PixmapPtr pPixmap; - - pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, /*bpp*/ 1, - BitmapBytePad(w), (pointer)pdstLine); - if (!pPixmap) - return; - - ptSrc.x = sx + pDrawable->x; - ptSrc.y = sy + pDrawable->y; - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - mfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, - GXcopy, &rgnDst, &ptSrc); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(pPixmap); - } - else - { - bzero(pdstLine, BitmapBytePad(w) * h); - } -} diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c deleted file mode 100644 index cb532cf3b..000000000 --- a/mfb/mfbimggblt.c +++ /dev/null @@ -1,444 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "mfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "maskbits.h" - -/* - 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. -*/ - -void -MFBIMAGEGLYPHBLT(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() */ - BoxRec bbox; /* string's bounding box */ - xRectangle backrect;/* backing rectangle to paint. - in the general case, NOT necessarily - the same as the 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 */ - PixelType *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 PixelType *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 PixelType tmpSrc; - /* for getting bits from glyph */ - register PixelType startmask; - register PixelType endmask; - - register int nFirst;/* bits of glyph in current longword */ - mfbPrivGC *pPrivGC; - mfbFillAreaProcPtr oldFillArea; - /* we might temporarily usurp this - field in devPriv */ - - if (!(pGC->planemask & 1)) - return; - - xorg = pDrawable->x; - yorg = pDrawable->y; - mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); - - 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); - - x += xorg; - y += yorg; - - bbox.x1 = x + info.overallLeft; - bbox.x2 = x + info.overallRight; - bbox.y1 = y - info.overallAscent; - bbox.y2 = y + info.overallDescent; - - /* UNCLEAN CODE - we know the mfbPolyFillRect uses only two fields in - devPrivate[mfbGCPrivateIndex].ptr, one of which (ropFillArea) is - 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[mfbGCPrivateIndex].ptr - (probably rop or ropFillArea.) You could just call ValidateGC, - but that is usually not a cheap thing to do. - */ - - pPrivGC = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - oldFillArea = pPrivGC->FillArea; - - if (pGC->bgPixel & 1) - pPrivGC->FillArea = mfbSolidWhiteArea; - else - pPrivGC->FillArea = mfbSolidBlackArea; - - mfbPolyFillRect(pDrawable, pGC, 1, &backrect); - pPrivGC->FillArea = oldFillArea; - - /* the faint-hearted can open their eyes now */ - switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) - { - case rgnOUT: - break; - case rgnIN: - pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); - 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; - - /* find correct word in scanline and x offset within it - for left edge of glyph - */ - xoff = xchar + pci->metrics.leftSideBearing; - if (xoff > PLST) - { - pdst++; - xoff &= PIM; - } - else if (xoff < 0) - { - xoff += PPW; - pdst--; - } - - pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst); - - if ((xoff + w) <= PPW) - { - /* glyph all in one longword */ - maskpartialbits(xoff, w, startmask); - while (h--) - { - getleftbits(pglyph, w, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - pglyph += widthGlyph; - mfbScanlineInc(pdst, widthDst); - } - } - else - { - /* glyph crosses longword boundary */ - maskPPWbits(xoff, w, startmask, endmask); - nFirst = PPW - xoff; - while (h--) - { - getleftbits(pglyph, w, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); - pglyph += widthGlyph; - mfbScanlineInc(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 */ - 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 = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); - xpos = x; - xchar = xpos & PIM; - - for (i=0; imetrics.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 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; - - 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--; - } - - pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst); - - if ((xoff + w) <= PPW) - { - maskpartialbits(xoff, w, startmask); - while (h--) - { - getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - pglyph += widthGlyph; - mfbScanlineInc(pdst, widthDst); - } - } - else - { - maskPPWbits(xoff, w, startmask, endmask); - nFirst = PPW - xoff; - while (h--) - { - getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); - pglyph += widthGlyph; - mfbScanlineInc(pdst, widthDst); - } - } - } /* for each glyph */ - } /* while nbox-- */ - xfree(ppos); - break; - } - default: - break; - } -} diff --git a/mfb/mfbline.c b/mfb/mfbline.c deleted file mode 100644 index 65baa5efd..000000000 --- a/mfb/mfbline.c +++ /dev/null @@ -1,759 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include - -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "mistruct.h" - -#include "mfb.h" -#include "maskbits.h" -#include "miline.h" - -/* 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. - -*/ - -void -#ifdef POLYSEGMENT -mfbSegmentSS (pDrawable, pGC, nseg, pSeg) - DrawablePtr pDrawable; - GCPtr pGC; - int nseg; - register xSegment *pSeg; -#else -mfbLineSS (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; - int alu; - - if (!(pGC->planemask & 1)) - return; - - cclip = pGC->pCompositeClip; - alu = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()))->rop; - pboxInit = REGION_RECTS(cclip); - nboxInit = REGION_NUM_RECTS(cclip); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrlBase); - - 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) - { - mfbVertS (alu, - 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) - { - mfbHorzS (alu, - 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 - mfbBresS (alu, - 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; - mfbBresS - (alu, - 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 = rmask[x2 & PIM]; - else - _mask = mask[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); - switch(alu) - { - case RROP_BLACK: - *addrl &= _mask; - break; - case RROP_WHITE: - *addrl |= _mask; - break; - case RROP_INVERT: - *addrl ^= _mask; - break; - } - break; - } - else - pbox++; - } - } -#endif -} - -/* - * Draw dashed 1-pixel lines. - */ - -void -#ifdef POLYSEGMENT -mfbSegmentSD (pDrawable, pGC, nseg, pSeg) - DrawablePtr pDrawable; - register GCPtr pGC; - int nseg; - register xSegment *pSeg; -#else -mfbLineSD( 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 fgrop = 0, bgrop = 0; - unsigned char *pDash; - int dashOffset; - int numInDashList; - int dashIndex; - int isDoubleDash; - int dashIndexTmp, dashOffsetTmp; - int unclippedlen; - - if (!(pGC->planemask & 1)) - return; - - cclip = pGC->pCompositeClip; - fgrop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()))->rop; - pboxInit = REGION_RECTS(cclip); - nboxInit = REGION_NUM_RECTS(cclip); - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); - - /* 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) - bgrop = mfbReduceRop(pGC->alu, pGC->bgPixel); - - 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; - mfbBresD (fgrop, bgrop, - &dashIndexTmp, pDash, numInDashList, - &dashOffsetTmp, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, unclippedlen); - break; -#else - mfbBresD (fgrop, bgrop, - &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; - mfbBresD (fgrop, bgrop, - &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)) - { - MfbBits _mask; - int rop; - - rop = fgrop; - if (dashIndex & 1) - rop = bgrop; - if (rop == RROP_BLACK) - _mask = rmask[x2 & PIM]; - else - _mask = mask[x2 & PIM]; - addrl = mfbScanline(addrl, x2, y2, nlwidth); - if (rop == RROP_BLACK) - *addrl &= _mask; - else if (rop == RROP_WHITE) - *addrl |= _mask; - else - *addrl ^= _mask; - break; - } - else - pbox++; - } - } -#endif -} diff --git a/mfb/mfbmisc.c b/mfb/mfbmisc.c deleted file mode 100644 index 5154e2784..000000000 --- a/mfb/mfbmisc.c +++ /dev/null @@ -1,99 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "cursor.h" -#include "scrnintstr.h" - -#include "mfb.h" - -/*ARGSUSED*/ -void -mfbQueryBestSize(class, pwidth, pheight, pScreen) -int class; -unsigned short *pwidth; -unsigned short *pheight; -ScreenPtr pScreen; -{ - unsigned width, test; - - switch(class) - { - case CursorShape: - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - case TileShape: - case StippleShape: - width = *pwidth; - if (!width) break; - /* Return the closes power of two not less than what they gave me */ - test = 0x80000000; - /* Find the highest 1 bit in the width given */ - while(!(test & width)) - test >>= 1; - /* If their number is greater than that, bump up to the next - * power of two */ - if((test - 1) & width) - test <<= 1; - *pwidth = test; - /* We don't care what height they use */ - break; - } -} - -mfbQueryBestSizeProc * -mfbQueryBestSizeWeak(void) -{ - return mfbQueryBestSize; -} diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c deleted file mode 100644 index 34bb33d89..000000000 --- a/mfb/mfbpixmap.c +++ /dev/null @@ -1,298 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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. - -******************************************************************/ - -/* pixmap management - written by drewry, september 1986 - - on a monchrome device, a pixmap is a bitmap. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "maskbits.h" - -#include "mfb.h" -#include "mi.h" - -#include "servermd.h" - - -PixmapPtr -mfbCreatePixmap (pScreen, width, height, depth, usage_hint) - ScreenPtr pScreen; - int width; - int height; - int depth; - unsigned usage_hint; -{ - PixmapPtr pPixmap; - size_t datasize; - size_t paddedWidth; - - if (depth != 1) - return NullPixmap; - paddedWidth = BitmapBytePad(width); - if (paddedWidth / 4 > 32767 || height > 32767) - return NullPixmap; - datasize = height * paddedWidth; - pPixmap = AllocatePixmap(pScreen, datasize); - if (!pPixmap) - return NullPixmap; - pPixmap->drawable.type = DRAWABLE_PIXMAP; - pPixmap->drawable.class = 0; - pPixmap->drawable.pScreen = pScreen; - pPixmap->drawable.depth = depth; - pPixmap->drawable.bitsPerPixel = depth; - pPixmap->drawable.id = 0; - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pPixmap->drawable.x = 0; - pPixmap->drawable.y = 0; - pPixmap->drawable.width = width; - pPixmap->drawable.height = height; - pPixmap->devKind = paddedWidth; - pPixmap->refcnt = 1; - pPixmap->devPrivate.ptr = datasize ? - (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL; - pPixmap->usage_hint = usage_hint; - return pPixmap; -} - - -Bool -mfbDestroyPixmap(pPixmap) - PixmapPtr pPixmap; -{ - if(--pPixmap->refcnt) - return TRUE; - dixFreePrivates(pPixmap->devPrivates); - xfree(pPixmap); - return TRUE; -} - - -PixmapPtr -mfbCopyPixmap(pSrc) - register PixmapPtr pSrc; -{ - register PixmapPtr pDst; - int size; - ScreenPtr pScreen; - - size = pSrc->drawable.height * pSrc->devKind; - pScreen = pSrc->drawable.pScreen; - pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width, - pSrc->drawable.height, pSrc->drawable.depth, 0); - if (!pDst) - return NullPixmap; - memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size); - return pDst; -} - - -/* replicates a pattern to be a full 32 bits wide. - relies on the fact that each scnaline is longword padded. - doesn't do anything if pixmap is not a factor of 32 wide. - changes width field of pixmap if successful, so that the fast - XRotatePixmap code gets used if we rotate the pixmap later. - - calculate number of times to repeat - for each scanline of pattern - zero out area to be filled with replicate - left shift and or in original as many times as needed -*/ -void -mfbPadPixmap(pPixmap) - PixmapPtr pPixmap; -{ - register int width = pPixmap->drawable.width; - register int h; - register PixelType mask; - register PixelType *p; - register PixelType bits; /* real pattern bits */ - register int i; - int rep; /* repeat count for pattern */ - - if (width >= PPW) - return; - - rep = PPW/width; - if (rep*width != PPW) - return; - - mask = endtab[width]; - - p = (PixelType *)(pPixmap->devPrivate.ptr); - for (h=0; h < pPixmap->drawable.height; h++) - { - *p &= mask; - bits = *p; - for(i=1; idrawable.width = PPW; -} - -/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that - * words are PPW bits wide, and that the least significant bit appears on the - * left. - */ -void -mfbXRotatePixmap(pPix, rw) - PixmapPtr pPix; - register int rw; -{ - register PixelType *pw, *pwFinal; - register PixelType t; - - if (pPix == NullPixmap) - return; - - pw = (PixelType *)pPix->devPrivate.ptr; - rw %= (int)pPix->drawable.width; - if (rw < 0) - rw += (int)pPix->drawable.width; - if(pPix->drawable.width == PPW) - { - pwFinal = pw + pPix->drawable.height; - while(pw < pwFinal) - { - t = *pw; - *pw++ = SCRRIGHT(t, rw) | - (SCRLEFT(t, (PPW-rw)) & endtab[rw]); - } - } - else - { - /* We no longer do this. Validate doesn't try to rotate odd-size - * tiles or stipples. mfbUnnaturalFS works directly off - * the unrotate tile/stipple in the GC - */ - ErrorF("X internal error: trying to rotate odd-sized pixmap.\n"); - } - -} - -/* Rotates pixmap pPix by h lines. Assumes that h is always less than - pPix->height - works on any width. - */ -void -mfbYRotatePixmap(pPix, rh) - register PixmapPtr pPix; - int rh; -{ - int nbyDown; /* bytes to move down to row 0; also offset of - row rh */ - int nbyUp; /* bytes to move up to line rh; also - offset of first line moved down to 0 */ - char *pbase; - char *ptmp; - int height; - - if (pPix == NullPixmap) - return; - height = (int) pPix->drawable.height; - rh %= height; - if (rh < 0) - rh += height; - - pbase = (char *)pPix->devPrivate.ptr; - - nbyDown = rh * pPix->devKind; - nbyUp = (pPix->devKind * height) - nbyDown; - if(!(ptmp = (char *)xalloc(nbyUp))) - return; - - memmove(ptmp, pbase, nbyUp); /* save the low rows */ - memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ - memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rh */ - xfree(ptmp); -} - -void -mfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot) - register PixmapPtr psrcPix, *ppdstPix; - int xrot, yrot; -{ - register PixmapPtr pdstPix; - - if ((pdstPix = *ppdstPix) && - (pdstPix->devKind == psrcPix->devKind) && - (pdstPix->drawable.height == psrcPix->drawable.height)) - { - memmove((char *)pdstPix->devPrivate.ptr, - (char *)psrcPix->devPrivate.ptr, - psrcPix->drawable.height * psrcPix->devKind); - pdstPix->drawable.width = psrcPix->drawable.width; - pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - else - { - if (pdstPix) - /* FIX XBUG 6168 */ - (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix); - *ppdstPix = pdstPix = mfbCopyPixmap(psrcPix); - if (!pdstPix) - return; - } - mfbPadPixmap(pdstPix); - if (xrot) - mfbXRotatePixmap(pdstPix, xrot); - if (yrot) - mfbYRotatePixmap(pdstPix, yrot); -} diff --git a/mfb/mfbply1rct.c b/mfb/mfbply1rct.c deleted file mode 100644 index 4227e894f..000000000 --- a/mfb/mfbply1rct.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include - -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "mistruct.h" - -#include "mfb.h" -#include "maskbits.h" - -#if defined(mips) || defined(sparc) -#define GetHighWord(x) (((int) (x)) >> 16) -#else -#define GetHighWord(x) (((int) (x)) / 65536) -#endif - -#if IMAGE_BYTE_ORDER == MSBFirst -#define intToCoord(i,x,y) (((x) = GetHighWord(i)), ((y) = (int) ((short) (i)))) -#define coordToInt(x,y) (((x) << 16) | ((y) & 0xffff)) -#define intToX(i) (GetHighWord(i)) -#define intToY(i) ((int) ((short) i)) -#else -#define intToCoord(i,x,y) (((x) = (int) ((short) (i))), ((y) = GetHighWord(i))) -#define coordToInt(x,y) (((y) << 16) | ((x) & 0xffff)) -#define intToX(i) ((int) ((short) (i))) -#define intToY(i) (GetHighWord(i)) -#endif - -void -MFBFILLPOLY1RECT (pDrawable, pGC, shape, mode, count, ptsIn) - DrawablePtr pDrawable; - GCPtr pGC; - int shape; - int mode; - int count; - DDXPointPtr ptsIn; -{ - int nlwidth; - PixelType *addrl, *addr; - int maxy; - int origin; - register int vertex1, vertex2; - int c; - BoxPtr extents; - int clip; - int y; - int *vertex1p = NULL, *vertex2p; - int *endp; - int x1 = 0, x2 = 0; - int dx1 = 0, dx2 = 0; - int dy1 = 0, dy2 = 0; - int e1 = 0, e2 = 0; - int step1 = 0, step2 = 0; - int sign1 = 0, sign2 = 0; - int h; - int l, r; - PixelType mask, bits = ~((PixelType)0); - int nmiddle; - - if (mode == CoordModePrevious || shape != Convex || - REGION_NUM_RECTS(pGC->pCompositeClip) != 1) - { - miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); - return; - } - origin = *((int *) &pDrawable->x); - vertex2 = origin - ((origin & 0x8000) << 1); - extents = &pGC->pCompositeClip->extents; - vertex1 = *((int *) &extents->x1) - vertex2; - vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001; - clip = 0; - y = 32767; - maxy = 0; - vertex2p = (int *) ptsIn; - endp = vertex2p + count; - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - } - if (y == maxy) - return; - - if (clip & 0x80008000) - { - miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn); - return; - } - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); - addrl = mfbScanlineDelta(addrl, y + pDrawable->y, nlwidth); - origin = intToX(origin); - vertex2p = vertex1p; - vertex2 = vertex1 = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; -#define Setup(c,x,vertex,dx,dy,e,sign,step) {\ - x = intToX(vertex); \ - if ((dy = intToY(c) - y)) { \ - dx = intToX(c) - x; \ - step = 0; \ - if (dx >= 0) \ - { \ - e = 0; \ - sign = 1; \ - if (dx >= dy) {\ - step = dx / dy; \ - dx = dx % dy; \ - } \ - } \ - else \ - { \ - e = 1 - dy; \ - sign = -1; \ - dx = -dx; \ - if (dx >= dy) { \ - step = - (dx / dy); \ - dx = dx % dy; \ - } \ - } \ - } \ - x += origin; \ - vertex = c; \ -} - -#define Step(x,dx,dy,e,sign,step) {\ - x += step; \ - if ((e += dx) > 0) \ - { \ - x += sign; \ - e -= dy; \ - } \ -} - for (;;) - { - if (y == intToY(vertex1)) - { - do - { - if (vertex1p == (int *) ptsIn) - vertex1p = endp; - c = *--vertex1p; - Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1) - } while (y >= intToY(vertex1)); - h = dy1; - } - else - { - Step(x1,dx1,dy1,e1,sign1,step1) - h = intToY(vertex1) - y; - } - if (y == intToY(vertex2)) - { - do - { - c = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) - } while (y >= intToY(vertex2)); - if (dy2 < h) - h = dy2; - } - else - { - Step(x2,dx2,dy2,e2,sign2,step2) - if ((c = (intToY(vertex2) - y)) < h) - h = c; - } - /* fill spans for this segment */ - y += h; - for (;;) - { - l = x1; - r = x2; - nmiddle = x2 - x1; - if (nmiddle < 0) - { - nmiddle = -nmiddle; - l = x2; - r = x1; - } - c = l & PIM; - l -= c; - l = l >> PWSH; - addr = addrl + l; - if (c + nmiddle < PPW) - { - mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle); - *addr OPEQ mask; - } - else - { - if (c) - { - mask = SCRRIGHT(bits, c); - *addr OPEQ mask; - nmiddle += c - PPW; - addr++; - } - nmiddle >>= PWSH; - Duff (nmiddle, *addr++ EQWHOLEWORD) - if ((mask = ~SCRRIGHT(bits, r & PIM))) - *addr OPEQ mask; - } - if (!--h) - break; - mfbScanlineInc(addrl, nlwidth); - Step(x1,dx1,dy1,e1,sign1,step1) - Step(x2,dx2,dy2,e2,sign2,step2) - } - if (y == maxy) - break; - mfbScanlineInc(addrl, nlwidth); - } -} diff --git a/mfb/mfbplygblt.c b/mfb/mfbplygblt.c deleted file mode 100644 index 1bd56e1ec..000000000 --- a/mfb/mfbplygblt.c +++ /dev/null @@ -1,397 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "mfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "regionstr.h" -#include "maskbits.h" -#include "miscstruct.h" - -/* - we should eventually special-case fixed-width fonts, although -its more important for ImageText, which is meant for terminal -emulators. - - 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 well-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.) - - PolyText looks at the fg color and the rasterop; mfbValidateGC -swaps in the right routine after looking at the reduced ratserop -in the private field of the GC. - - the register allocations are provisional; in particualr startmask and -endmask might not be the right things. pglyph, xoff, pdst, and tmpSrc -are fairly obvious, though. - - to avoid source proliferation, this file is compiled -three times: - MFBPOLYGLYPHBLT OPEQ - mfbPolyGlyphBltWhite |= - mfbPolyGlyphBltBlack &=~ - mfbPolyGlyphBltInvert ^= -*/ - -void -MFBPOLYGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs (unused in R5) */ -{ - ExtentInfoRec info; /* 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 */ - PixelType *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 PixelType *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 PixelType tmpSrc; - /* for getting bits from glyph */ - register PixelType startmask; - register PixelType endmask; - register int nFirst;/* bits of glyph in current longword */ - - if (!(pGC->planemask & 1)) - return; - - xorg = pDrawable->x; - yorg = pDrawable->y; - mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); - - x += xorg; - y += yorg; - - QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); - bbox.x1 = x + info.overallLeft; - bbox.x2 = x + info.overallRight; - bbox.y1 = y - info.overallAscent; - bbox.y2 = y + info.overallDescent; - - switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) - { - case rgnOUT: - break; - case rgnIN: - pdstBase = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); - 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; - - /* find correct word in scanline and x offset within it - for left edge of glyph - */ - xoff = xchar + pci->metrics.leftSideBearing; - if (xoff > PLST) - { - pdst++; - xoff &= PIM; - } - else if (xoff < 0) - { - xoff += PPW; - pdst--; - } - - pdst = mfbScanlineDelta(pdst, -pci->metrics.ascent, widthDst); - - if ((xoff + w) <= PPW) - { - /* glyph all in one longword */ - maskpartialbits(xoff, w, startmask); - while (h--) - { - getleftbits(pglyph, w, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - pglyph += widthGlyph; - mfbScanlineInc(pdst, widthDst); - } - } - else - { - /* glyph crosses longword boundary */ - maskPPWbits(xoff, w, startmask, endmask); - nFirst = PPW - xoff; - while (h--) - { - getleftbits(pglyph, w, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); - pglyph += widthGlyph; - mfbScanlineInc(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; - RegionPtr cclip; - int nbox; - BoxPtr pbox; - int xpos; /* x position of char origin */ - 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 = mfbScanlineNoBankSwitch(pdstBase, x, y, widthDst); - xpos = x; - xchar = xpos & PIM; - - for (i=0; imetrics.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); - - for (; --nbox >= 0; 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 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; - - 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--; - } - - pdst = mfbScanlineDelta(pdst, -(y-topEdge), widthDst); - - if ((xoff + w) <= PPW) - { - maskpartialbits(xoff, w, startmask); - while (h--) - { - getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - pglyph += widthGlyph; - mfbScanlineInc(pdst, widthDst); - } - } - else - { - maskPPWbits(xoff, w, startmask, endmask); - nFirst = PPW - xoff; - while (h--) - { - getshiftedleftbits(pglyph, glyphCol, getWidth, tmpSrc); - *pdst OPEQ (SCRRIGHT(tmpSrc, xoff) & startmask); - *(pdst+1) OPEQ (SCRLEFT(tmpSrc, nFirst) & endmask); - pglyph += widthGlyph; - mfbScanlineInc(pdst, widthDst); - } - } - } /* for each glyph */ - } /* while nbox-- */ - xfree(ppos); - break; - } - default: - break; - } -} diff --git a/mfb/mfbpntarea.c b/mfb/mfbpntarea.c deleted file mode 100644 index 2906e660c..000000000 --- a/mfb/mfbpntarea.c +++ /dev/null @@ -1,299 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include "windowstr.h" -#include "regionstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "mfb.h" -#include "maskbits.h" - -/* - the solid fillers are called for rectangles and window backgrounds. - the boxes are already translated. - maybe this should always take a pixmap instead of a drawable? - - NOTE: - iy = ++iy < tileHeight ? iy : 0 -is equivalent to iy%= tileheight, and saves a division. -*/ - -/* - MFBSOLIDFILLAREA OPEQ EQWHOLEOWRD - mfbSolidWhiteArea |= = ~0 - mfbSolidBlackArea &=~ = 0 - mfbSolidInvertArea ^= ^= ~0 - -EQWHOLEWORD is used to write whole longwords. it could use OPEQ, -but *p++ |= ~0 on at least two compilers generates much -worse code than *p++ = ~0. similarly for *p++ &= ~~0 -and *p++ = 0. - -*/ - -/*ARGSUSED*/ -void -MFBSOLIDFILLAREA(pDraw, nbox, pbox, alu, nop) - DrawablePtr pDraw; - int nbox; - BoxPtr pbox; - int alu; - PixmapPtr nop; -{ - int nlwidth; /* width in longwords of the drawable */ - int w; /* width of current box */ - register int h; /* height of current box */ - register PixelType *p; /* pointer to bits we're writing */ - register int nlw; /* loop version of nlwMiddle */ - register PixelType startmask; - register PixelType endmask;/* masks for reggedy bits at either end of line */ - register int nlwExtra; - /* to get from right of box to left of next span */ - int nlwMiddle; /* number of longwords between sides of boxes */ - PixelType *pbits; /* pointer to start of drawable */ - - mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits); - - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth); - - if ( ((pbox->x1 & PIM) + w) < PPW) - { - maskpartialbits(pbox->x1, w, startmask); - nlwExtra = nlwidth; - Duff(h, *p OPEQ startmask; mfbScanlineInc(p, nlwExtra)); - } - else - { - maskbits(pbox->x1, w, startmask, endmask, nlwMiddle); - nlwExtra = nlwidth - nlwMiddle; - - if (startmask && endmask) - { - nlwExtra -= 1; - while (h--) - { - nlw = nlwMiddle; - *p OPEQ startmask; - p++; - Duff(nlw, *p++ EQWHOLEWORD); - *p OPEQ endmask; - mfbScanlineInc(p, nlwExtra); - } - } - else if (startmask && !endmask) - { - nlwExtra -= 1; - while (h--) - { - nlw = nlwMiddle; - *p OPEQ startmask; - p++; - Duff(nlw, *p++ EQWHOLEWORD); - mfbScanlineInc(p, nlwExtra); - } - } - else if (!startmask && endmask) - { - while (h--) - { - nlw = nlwMiddle; - Duff(nlw, *p++ EQWHOLEWORD); - *p OPEQ endmask; - mfbScanlineInc(p, nlwExtra); - } - } - else /* no ragged bits at either end */ - { - while (h--) - { - nlw = nlwMiddle; - Duff(nlw, *p++ EQWHOLEWORD); - mfbScanlineInc(p, nlwExtra); - } - } - } - pbox++; - } -} - - - -/* stipple a list of boxes - -you can use the reduced rasterop for stipples. if rrop is -black, AND the destination with (not stipple pattern). if rrop is -white OR the destination with the stipple pattern. if rrop is invert, -XOR the destination with the stipple pattern. - - MFBSTIPPLEFILLAREA OPEQ - mfbStippleWhiteArea |= - mfbStippleBlackArea &=~ - mfbStippleInveryArea ^= -*/ - -/*ARGSUSED*/ -void -MFBSTIPPLEFILLAREA(pDraw, nbox, pbox, alu, pstipple) - DrawablePtr pDraw; - int nbox; - BoxPtr pbox; - int alu; - PixmapPtr pstipple; -{ - register PixelType *psrc; - /* pointer to bits in tile, if needed */ - int tileHeight; /* height of the tile */ - register PixelType srcpix; - - int nlwidth; /* width in longwords of the drawable */ - int w; /* width of current box */ - register int nlw; /* loop version of nlwMiddle */ - register PixelType *p; /* pointer to bits we're writing */ - register int h; /* height of current box */ - PixelType startmask; - PixelType endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwExtra; /* to get from right of box to left of next span */ - register int iy; /* index of current scanline in tile */ - PixelType *pbits; /* pointer to start of drawable */ - - mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits); - - tileHeight = pstipple->drawable.height; - psrc = (PixelType *)(pstipple->devPrivate.ptr); - - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - iy = pbox->y1 % tileHeight; - p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth); - - if ( ((pbox->x1 & PIM) + w) < PPW) - { - maskpartialbits(pbox->x1, w, startmask); - nlwExtra = nlwidth; - while (h--) - { - srcpix = psrc[iy]; - iy = ++iy < tileHeight ? iy : 0; - *p OPEQ (srcpix & startmask); - mfbScanlineInc(p, nlwExtra); - } - } - else - { - maskbits(pbox->x1, w, startmask, endmask, nlwMiddle); - nlwExtra = nlwidth - nlwMiddle; - - if (startmask && endmask) - { - nlwExtra -= 1; - while (h--) - { - srcpix = psrc[iy]; - iy = ++iy < tileHeight ? iy : 0; - nlw = nlwMiddle; - *p OPEQ (srcpix & startmask); - p++; - Duff (nlw, *p++ OPEQ srcpix); - *p OPEQ (srcpix & endmask); - mfbScanlineInc(p, nlwExtra); - } - } - else if (startmask && !endmask) - { - nlwExtra -= 1; - while (h--) - { - srcpix = psrc[iy]; - iy = ++iy < tileHeight ? iy : 0; - nlw = nlwMiddle; - *p OPEQ (srcpix & startmask); - p++; - Duff(nlw, *p++ OPEQ srcpix); - mfbScanlineInc(p, nlwExtra); - } - } - else if (!startmask && endmask) - { - while (h--) - { - srcpix = psrc[iy]; - iy = ++iy < tileHeight ? iy : 0; - nlw = nlwMiddle; - Duff(nlw, *p++ OPEQ srcpix); - *p OPEQ (srcpix & endmask); - mfbScanlineInc(p, nlwExtra); - } - } - else /* no ragged bits at either end */ - { - while (h--) - { - srcpix = psrc[iy]; - iy = ++iy < tileHeight ? iy : 0; - nlw = nlwMiddle; - Duff(nlw, *p++ OPEQ srcpix); - mfbScanlineInc(p, nlwExtra); - } - } - } - pbox++; - } -} diff --git a/mfb/mfbpolypnt.c b/mfb/mfbpolypnt.c deleted file mode 100644 index 146cfdce0..000000000 --- a/mfb/mfbpolypnt.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "pixmapstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "miscstruct.h" -#include "regionstr.h" -#include "scrnintstr.h" - -#include "mfb.h" -#include "maskbits.h" - -void -mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) - register DrawablePtr pDrawable; - GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; - xPoint *pptInit; -{ - - register BoxPtr pbox; - register int nbox; - - register PixelType *addrl; - int nlwidth; - - int nptTmp; - register xPoint *ppt; - - register int x; - register int y; - register int rop; - mfbPrivGC *pGCPriv; - - if (!(pGC->planemask & 1)) - return; - - pGCPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()); - rop = pGCPriv->rop; - - mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); - - if ((mode == CoordModePrevious) && (npt > 1)) - { - for (ppt = pptInit + 1, nptTmp = npt - 1; --nptTmp >= 0; ppt++) - { - ppt->x += (ppt-1)->x; - ppt->y += (ppt-1)->y; - } - } - - nbox = REGION_NUM_RECTS(pGC->pCompositeClip); - pbox = REGION_RECTS(pGC->pCompositeClip); - for (; --nbox >= 0; pbox++) - { - if (rop == RROP_BLACK) - { - for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) - { - x = ppt->x + pDrawable->x; - y = ppt->y + pDrawable->y; - if ((x >= pbox->x1) && (x < pbox->x2) && - (y >= pbox->y1) && (y < pbox->y2)) - *mfbScanline(addrl, x, y, nlwidth) &= rmask[x & PIM]; - } - } - else if (rop == RROP_WHITE) - { - for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) - { - x = ppt->x + pDrawable->x; - y = ppt->y + pDrawable->y; - if ((x >= pbox->x1) && (x < pbox->x2) && - (y >= pbox->y1) && (y < pbox->y2)) - *mfbScanline(addrl, x, y, nlwidth) |= mask[x & PIM]; - } - } - else if (rop == RROP_INVERT) - { - for (ppt = pptInit, nptTmp = npt; --nptTmp >= 0; ppt++) - { - x = ppt->x + pDrawable->x; - y = ppt->y + pDrawable->y; - if ((x >= pbox->x1) && (x < pbox->x2) && - (y >= pbox->y1) && (y < pbox->y2)) - *mfbScanline(addrl, x, y, nlwidth) ^= mask[x & PIM]; - } - } - } -} diff --git a/mfb/mfbpushpxl.c b/mfb/mfbpushpxl.c deleted file mode 100644 index de9699252..000000000 --- a/mfb/mfbpushpxl.c +++ /dev/null @@ -1,287 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "miscstruct.h" -#include "maskbits.h" -#include "regionstr.h" -#include "mfb.h" - -/* mfbSolidPP is courtesy of xhacks@csri.toronto.edu - - For fillStyle==FillSolid, a monochrome PushPixels can be reduced to - a ROP in the following way: (Note that the ROP is the same as the - result of ROP(src=0x3,dst=0x5)) - - src=0011 0000 0011 - dst=0101 0101 0101 - rop fg=0 fg=1 - GXclear 0x0 0000 0100 0100 0 - GXand 0x1 0001 0100 0101 s&d - GXandReverse 0x2 0010 0100 0110 s&~d - GXcopy 0x3 0011 0100 0111 s - GXandInverted 0x4 0100 0101 0100 ~s&d - GXnoop 0x5 0101 0101 0101 d - GXxor 0x6 0110 0101 0110 s^d - GXor 0x7 0111 0101 0111 s|d - GXnor 0x8 1000 0110 0100 ~s&~d - GXequiv 0x9 1001 0110 0101 ~s^d - GXinvert 0xa 1010 0110 0110 ~d - GXorReverse 0xb 1011 0110 0111 s|~d - GXcopyInverted 0xc 1100 0111 0100 ~s - GXorInverted 0xd 1101 0111 0101 ~s|d - GXnand 0xe 1110 0111 0110 ~s|~d - GXset 0xf 1111 0111 0111 1 - -For src=0: newRop = 0x4|(rop>>2) -For src=1: newRop = 0x4|(rop&3) -*/ - -/* mfbSolidPP -- squeegees the forground color of pGC through pBitMap - * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may - * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit - * is set in the bitmap, the fill style is put onto the drawable using - * the GC's logical function. The drawable is not changed where the bitmap - * has a zero bit or outside the area covered by the stencil. - */ -void -mfbSolidPP(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg) - GCPtr pGC; - PixmapPtr pBitMap; - DrawablePtr pDrawable; - int dx, dy, xOrg, yOrg; -{ - unsigned char alu; - RegionRec rgnDst; - DDXPointPtr pptSrc; - BoxRec srcBox; - register DDXPointPtr ppt; - register BoxPtr pbox; - int i; - - if (!(pGC->planemask & 1)) return; - - /* compute the reduced rop function */ - alu = pGC->alu; - if (!(pGC->fgPixel&1)) alu >>= 2; - alu = (alu & 0x3) | 0x4; - if (alu == GXnoop) return; - - srcBox.x1 = xOrg; - srcBox.y1 = yOrg; - srcBox.x2 = xOrg + dx; - srcBox.y2 = yOrg + dy; - REGION_INIT(pGC->pScreen, &rgnDst, &srcBox, 1); - - /* clip the shape of the dst to the destination composite clip */ - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, pGC->pCompositeClip); - - if (!REGION_NIL(&rgnDst)) - { - i = REGION_NUM_RECTS(&rgnDst); - pptSrc = (DDXPointPtr)xalloc(i * sizeof(DDXPointRec)); - if(pptSrc) - { - for (pbox = REGION_RECTS(&rgnDst), ppt = pptSrc; - --i >= 0; - pbox++, ppt++) - { - ppt->x = pbox->x1 - xOrg; - ppt->y = pbox->y1 - yOrg; - } - mfbDoBitblt((DrawablePtr)pBitMap, pDrawable, alu, &rgnDst, pptSrc); - xfree(pptSrc); - } - } - REGION_UNINIT(pGC->pScreen, &rgnDst); -} - -#define NPT 128 - -/* mfbPushPixels -- squeegees the forground color of pGC through pBitMap - * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may - * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit - * is set in the bitmap, the fill style is put onto the drawable using - * the GC's logical function. The drawable is not changed where the bitmap - * has a zero bit or outside the area covered by the stencil. - */ -void -mfbPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg) - GCPtr pGC; - PixmapPtr pBitMap; - DrawablePtr pDrawable; - int dx, dy, xOrg, yOrg; -{ - int h, dxDivPPW, ibEnd; - PixelType *pwLineStart; - register PixelType *pw, *pwEnd; - register PixelType mask; - register int ib; - register PixelType w; - register int ipt; /* index into above arrays */ - Bool fInBox; - DDXPointRec pt[NPT]; - int width[NPT]; - - /* Now scan convert the pixmap and use the result to call fillspans in - * in the drawable with the original GC */ - ipt = 0; - dxDivPPW = dx/PPW; - for(h = 0; h < dy; h++) - { - - pw = (PixelType *)(pointer) - (((char *)(pBitMap->devPrivate.ptr))+(h * pBitMap->devKind)); - pwLineStart = pw; - /* Process all words which are fully in the pixmap */ - - fInBox = FALSE; - pwEnd = pwLineStart + dxDivPPW; - while(pw < pwEnd) - { - w = *pw; - mask = endtab[1]; - for(ib = 0; ib < PPW; ib++) - { - if(w & mask) - { - if(!fInBox) - { - pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; - pt[ipt].y = h + yOrg; - /* start new box */ - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - width[ipt] = ((pw - pwLineStart) << PWSH) + - ib + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, - width, TRUE); - ipt = 0; - } - /* end box */ - fInBox = FALSE; - } - } - mask = SCRRIGHT(mask, 1); - } - pw++; - } - ibEnd = dx & PIM; - if(ibEnd) - { - /* Process final partial word on line */ - w = *pw; - mask = endtab[1]; - for(ib = 0; ib < ibEnd; ib++) - { - if(w & mask) - { - if(!fInBox) - { - /* start new box */ - pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; - pt[ipt].y = h + yOrg; - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - /* end box */ - width[ipt] = ((pw - pwLineStart) << PWSH) + - ib + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, - width, TRUE); - ipt = 0; - } - fInBox = FALSE; - } - } - mask = SCRRIGHT(mask, 1); - } - } - /* If scanline ended with last bit set, end the box */ - if(fInBox) - { - width[ipt] = dx + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); - ipt = 0; - } - } - } - /* Flush any remaining spans */ - if (ipt) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE); - } -} - -mfbPushPixelsProc *mfbPushPixelsWeak(void) -{ - return mfbPushPixels; -} diff --git a/mfb/mfbscrclse.c b/mfb/mfbscrclse.c deleted file mode 100644 index 97ca729fb..000000000 --- a/mfb/mfbscrclse.c +++ /dev/null @@ -1,64 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include "mfb.h" -#include "scrnintstr.h" - -/*ARGSUSED*/ -Bool -mfbCloseScreen(index, pScreen) - int index; - register ScreenPtr pScreen; -{ - xfree(pScreen->devPrivate); - return TRUE; -} - diff --git a/mfb/mfbscrinit.c b/mfb/mfbscrinit.c deleted file mode 100644 index 8873a1ba1..000000000 --- a/mfb/mfbscrinit.c +++ /dev/null @@ -1,183 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include /* for xColorItem */ -#include -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "resource.h" -#include "colormap.h" -#include "mfb.h" -#include "mistruct.h" -#include "dix.h" -#include "mi.h" -#include "mibstore.h" -#include "migc.h" -#include "servermd.h" - -#ifdef PIXMAP_PER_WINDOW -static DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey; -DevPrivateKey frameGetWindowPrivateKey(void) { return frameWindowPrivateKey; } -#endif -static DevPrivateKey mfbGCPrivateKey = &mfbGCPrivateKey; -DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; } -static unsigned long mfbGeneration = 0; - -static VisualRec visual = { -/* vid class bpRGB cmpE nplan rMask gMask bMask oRed oGreen oBlue */ - 0, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0 -}; - -static VisualID VID; - -static DepthRec depth = { -/* depth numVid vids */ - 1, 1, &VID -}; - -Bool -mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) -{ - if (mfbGeneration != serverGeneration) - { - visual.vid = FakeClientID(0); - VID = visual.vid; - mfbGeneration = serverGeneration; - } - if (pGCKey) - *pGCKey = mfbGCPrivateKey; - pScreen->GetWindowPixmap = mfbGetWindowPixmap; - pScreen->SetWindowPixmap = mfbSetWindowPixmap; - return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC)); -} - - -/* dts * (inch/dot) * (25.4 mm / inch) = mm */ -Bool -mfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ -{ - if (!mfbAllocatePrivates(pScreen, NULL)) - return FALSE; - pScreen->defColormap = (Colormap) FakeClientID(0); - /* whitePixel, blackPixel */ - pScreen->QueryBestSize = mfbQueryBestSize; - /* SaveScreen */ - pScreen->GetImage = mfbGetImage; - pScreen->GetSpans = mfbGetSpans; - pScreen->CreateWindow = mfbCreateWindow; - pScreen->PositionWindow = mfbPositionWindow; - pScreen->RealizeWindow = mfbMapWindow; - pScreen->UnrealizeWindow = mfbUnmapWindow; - pScreen->CopyWindow = mfbCopyWindow; - pScreen->CreatePixmap = mfbCreatePixmap; - pScreen->DestroyPixmap = mfbDestroyPixmap; - pScreen->RealizeFont = mfbRealizeFont; - pScreen->UnrealizeFont = mfbUnrealizeFont; - pScreen->CreateGC = mfbCreateGC; - pScreen->CreateColormap = mfbCreateColormap; - pScreen->DestroyColormap = mfbDestroyColormap; - pScreen->InstallColormap = mfbInstallColormap; - pScreen->UninstallColormap = mfbUninstallColormap; - pScreen->ListInstalledColormaps = mfbListInstalledColormaps; - pScreen->StoreColors = (StoreColorsProcPtr)NoopDDA; - pScreen->ResolveColor = mfbResolveColor; - pScreen->BitmapToRegion = mfbPixmapToRegion; - if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, - 1, 1, &depth, VID, 1, &visual)) - return FALSE; - return TRUE; -} - -PixmapPtr -mfbGetWindowPixmap(pWin) - WindowPtr pWin; -{ -#ifdef PIXMAP_PER_WINDOW - return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates, - frameWindowPrivateKey); -#else - ScreenPtr pScreen = pWin->drawable.pScreen; - - return (* pScreen->GetScreenPixmap)(pScreen); -#endif -} - -void -mfbSetWindowPixmap(pWin, pPix) - WindowPtr pWin; - PixmapPtr pPix; -{ -#ifdef PIXMAP_PER_WINDOW - dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix); -#else - (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); -#endif -} - -void mfbFillInScreen(ScreenPtr pScreen) -{ - pScreen->ChangeWindowAttributes = mfbChangeWindowAttributes; - pScreen->RealizeWindow = mfbMapWindow; - pScreen->UnrealizeWindow = mfbUnmapWindow; - pScreen->DestroyPixmap = mfbDestroyPixmap; - pScreen->RealizeFont = mfbRealizeFont; - pScreen->UnrealizeFont = mfbUnrealizeFont; - pScreen->BitmapToRegion = mfbPixmapToRegion; -} diff --git a/mfb/mfbsetsp.c b/mfb/mfbsetsp.c deleted file mode 100644 index 24add836c..000000000 --- a/mfb/mfbsetsp.c +++ /dev/null @@ -1,281 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include "misc.h" -#include "regionstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "mfb.h" -#include "maskbits.h" - -#include "servermd.h" - - -/* mfbSetScanline -- 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.) - */ -void -mfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst) - int y; - int xOrigin; /* where this scanline starts */ - int xStart; /* first bit to use from scanline */ - int xEnd; /* last bit to use from scanline + 1 */ - register PixelType *psrc; - register int alu; /* raster op */ - PixelType *pdstBase; /* start of the drawable */ - int widthDst; /* width of drawable in words */ -{ - int w; /* width of scanline in bits */ - register PixelType *pdst; /* where to put the bits */ - register PixelType tmpSrc; /* scratch buffer to collect bits in */ - int dstBit; /* offset in bits from beginning of - * word */ - register int nstart; /* number of bits from first partial */ - register int nend; /* " " last partial word */ - int offSrc; - PixelType startmask, endmask; - int nlMiddle, nl; - - pdst = mfbScanline(pdstBase, xStart, y, widthDst); - psrc += (xStart - xOrigin) >> PWSH; - offSrc = (xStart - xOrigin) & PIM; - w = xEnd - xStart; - dstBit = xStart & PIM; - - if (dstBit + w <= PPW) - { - getandputrop(psrc, offSrc, dstBit, w, pdst, alu) - } - else - { - - maskbits(xStart, w, startmask, endmask, nlMiddle); - if (startmask) - nstart = PPW - dstBit; - else - nstart = 0; - if (endmask) - nend = xEnd & PIM; - else - nend = 0; - if (startmask) - { - getandputrop(psrc, offSrc, dstBit, nstart, pdst, alu) - pdst++; - offSrc += nstart; - if (offSrc > PLST) - { - psrc++; - offSrc -= PPW; - } - } - nl = nlMiddle; - while (nl--) - { - getbits(psrc, offSrc, PPW, tmpSrc); - DoRop(*pdst, alu, tmpSrc, *pdst); - pdst++; - psrc++; - } - if (endmask) - { - getandputrop0(psrc, offSrc, nend, pdst, alu); - } - - } -} - - - -/* 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 -mfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - char *pcharsrc; - register DDXPointPtr ppt; - int *pwidth; - int nspans; - int fSorted; -{ - PixelType *psrc = (PixelType *)(pointer)pcharsrc; - PixelType *pdstBase; /* start of dst bitmap */ - int widthDst; /* width of bitmap in words */ - register BoxPtr pbox, pboxLast, pboxTest; - register DDXPointPtr pptLast; - int alu; - RegionPtr prgnDst; - int xStart, xEnd; - int yMax; - - alu = pGC->alu; - prgnDst = pGC->pCompositeClip; - - pptLast = ppt + nspans; - - yMax = pDrawable->y + (int) pDrawable->height; - mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); - - pbox = REGION_RECTS(prgnDst); - pboxLast = pbox + REGION_NUM_RECTS(prgnDst); - - 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 - */ - pboxTest = pbox; - while(ppt < pptLast) - { - pbox = pboxTest; - if(ppt->y >= yMax) - break; - while(pbox < pboxLast) - { - if(pbox->y1 > ppt->y) - { - /* scanline is before clip box */ - break; - } - else if(pbox->y2 <= ppt->y) - { - /* clip box is before scanline */ - pboxTest = ++pbox; - continue; - } - else if(pbox->x1 > ppt->x + *pwidth) - { - /* clip box is to right of scanline */ - break; - } - else if(pbox->x2 <= ppt->x) - { - /* scanline is to right of clip box */ - pbox++; - continue; - } - - /* at least some of the scanline is in the current clip box */ - xStart = max(pbox->x1, ppt->x); - xEnd = min(ppt->x + *pwidth, pbox->x2); - mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, - pdstBase, widthDst); - if(ppt->x + *pwidth <= pbox->x2) - { - /* End of the line, as it were */ - break; - } - else - pbox++; - } - /* We've tried this line against every box; it must be outside them - * all. move on to the next point */ - ppt++; - psrc += PixmapWidthInPadUnits(*pwidth, 1); - pwidth++; - } - } - else - { - /* scan lines not sorted. We must clip each line against all the boxes */ - while(ppt < pptLast) - { - if(ppt->y >= 0 && ppt->y < yMax) - { - - for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++) - { - if(pbox->y1 > ppt->y) - { - /* rest of clip region is above this scanline, - * skip it */ - break; - } - if(pbox->y2 <= ppt->y) - { - /* clip box is below scanline */ - pbox++; - break; - } - if(pbox->x1 <= ppt->x + *pwidth && - pbox->x2 > ppt->x) - { - xStart = max(pbox->x1, ppt->x); - xEnd = min(pbox->x2, ppt->x + *pwidth); - mfbSetScanline(ppt->y, ppt->x, xStart, xEnd, - psrc, alu, pdstBase, widthDst); - } - - } - } - psrc += PixmapWidthInPadUnits(*pwidth, 1); - ppt++; - pwidth++; - } - } -} diff --git a/mfb/mfbtegblt.c b/mfb/mfbtegblt.c deleted file mode 100644 index ff52d8c9e..000000000 --- a/mfb/mfbtegblt.c +++ /dev/null @@ -1,366 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "mfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "maskbits.h" - -/* - this works for fonts with glyphs <= PPW bits wide. - - This should be called only with a terminal-emulator font; -this means that the FIXED_METRICS flag is set, and that -glyphbounds == charbounds. - - in theory, this goes faster; even if it doesn't, it reduces the -flicker caused by writing a string over itself with image text (since -the background gets repainted per character instead of per string.) -this seems to be important for some converted X10 applications. - - 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 -two times: - MFBTEGLYPHBLT OP - mfbTEGlyphBltWhite (white text, black bg ) - mfbTEGlyphBltBlack ~ (black text, white bg ) - -*/ - -#if defined(NO_3_60_CG4) && defined(FASTPUTBITS) && defined(FASTGETBITS) -#define FASTCHARS -#endif - -/* - * this macro "knows" that only characters <= 8 bits wide will - * fit this case (which is why it is independent of GLYPHPADBYTES) - */ - -#if (BITMAP_BIT_ORDER == MSBFirst) && (GLYPHPADBYTES != 4) -#if GLYPHPADBYTES == 1 -#define ShiftAmnt 24 -#else -#define ShiftAmnt 16 -#endif - -/* - * XXX XXX XXX There is something horribly, massively wrong here. There are - * hardcoded shifts by 64 below; these cannot work on any present-day - * architecture. - */ - -/* - * Note: for BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER, SCRRIGHT() evaluates its - * first argument more than once. Thus the imbedded char++ have to be moved. - * (DHD) - */ -#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER -#define GetBits4 c = (*char1++ << ShiftAmnt) | \ - SCRRIGHT (*char2++ << ShiftAmnt, xoff2) | \ - SCRRIGHT (*char3++ << ShiftAmnt, xoff3) | \ - SCRRIGHT (*char4++ << ShiftAmnt, xoff4); -#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */ -#define GetBits4 c = (*char1++ << ShiftAmnt) | \ - SCRRIGHT (*char2 << ShiftAmnt, xoff2) | \ - SCRRIGHT (*char3 << ShiftAmnt, xoff3) | \ - SCRRIGHT (*char4 << ShiftAmnt, xoff4); \ - char2++; char3++; char4++; -#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */ - -#else /* (BITMAP_BIT_ORDER != MSBFirst) || (GLYPHPADBYTES == 4) */ - -#if BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER -#define GetBits4 c = *char1++ | \ - SCRRIGHT (*char2++, xoff2) | \ - SCRRIGHT (*char3++, xoff3) | \ - SCRRIGHT (*char4++, xoff4); -#else /* BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER */ -#define GetBits4 c = *char1++ | \ - SCRRIGHT (*char2, xoff2) | \ - SCRRIGHT (*char3, xoff3) | \ - SCRRIGHT (*char4, xoff4); \ - char2++; char3++; char4++; -#endif /* BITMAP_BIT_ORDER == IMAGE_BYTE_ORDER */ - -#endif /* BITMAP_BIT_ORDER && GLYPHPADBYTES */ - - -#if GLYPHPADBYTES == 1 -typedef unsigned char *glyphPointer; -#define USE_LEFTBITS -#endif - -#if GLYPHPADBYTES == 2 -typedef unsigned short *glyphPointer; -#define USE_LEFTBITS -#endif - -#if GLYPHPADBYTES == 4 -typedef unsigned int *glyphPointer; -#endif - -#ifdef USE_LEFTBITS -#define GetBits1 getleftbits (char1, widthGlyph, c); \ - c &= glyphMask; \ - char1 = (glyphPointer) (((char *) char1) + glyphBytes); -#else -#define GetBits1 c = *char1++; -#endif - -void -MFBTEGLYPHBLT(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 */ -{ - FontPtr pfont = pGC->font; - int widthDst; - PixelType *pdstBase; /* pointer to longword with top row - of current glyph */ - - int h; /* height of glyph and char */ - register int xpos; /* current x */ - int ypos; /* current y */ - int widthGlyph; - - int hTmp; /* counter for height */ - register PixelType startmask, endmask; - int nfirst; /* used if glyphs spans a longword boundary */ - BoxRec bbox; /* for clipping */ - int widthGlyphs; - register PixelType *dst; - register PixelType c; - register int xoff1, xoff2, xoff3, xoff4; - register glyphPointer char1, char2, char3, char4; - -#ifdef USE_LEFTBITS - register PixelType glyphMask; - register PixelType tmpSrc; - register int glyphBytes; -#endif - - if (!(pGC->planemask & 1)) - return; - - mfbGetPixelWidthAndPointer(pDrawable, widthDst, pdstBase); - - xpos = x + pDrawable->x; - ypos = y + pDrawable->y; - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - - xpos += FONTMAXBOUNDS(pfont,leftSideBearing); - ypos -= FONTASCENT(pfont); - - bbox.x1 = xpos; - bbox.x2 = xpos + (widthGlyph * nglyph); - bbox.y1 = ypos; - bbox.y2 = ypos + h; - - switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) - { - case rgnPART: - /* this is the WRONG thing to do, but it works. - calling the non-terminal text is easy, but slow, given - what we know about the font. - - the right thing to do is something like: - for each clip rectangle - compute at which row the glyph starts to be in it, - and at which row the glyph ceases to be in it - compute which is the first glyph inside the left - edge, and the last one inside the right edge - draw a fractional first glyph, using only - the rows we know are in - draw all the whole glyphs, using the appropriate rows - draw any pieces of the last glyph, using the right rows - - this way, the code would take advantage of knowing that - all glyphs are the same height and don't overlap. - - one day... - */ - CLIPTETEXT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - case rgnOUT: - return; - } - pdstBase = mfbScanlineDeltaNoBankSwitch(pdstBase, ypos, widthDst); - widthGlyphs = widthGlyph * PGSZB; - -#ifdef USE_LEFTBITS - glyphMask = endtab[widthGlyph]; - glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci); -#endif - - if (nglyph >= PGSZB && widthGlyphs <= PPW) - { - while (nglyph >= PGSZB) - { - nglyph -= PGSZB; - xoff1 = xpos & PIM; - xoff2 = widthGlyph; - xoff3 = xoff2 + widthGlyph; - xoff4 = xoff3 + widthGlyph; - char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); - char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); - char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); - char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); - - hTmp = h; - dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); /* switch now */ - -#ifndef FASTCHARS - if (xoff1 + widthGlyphs <= PPW) - { - maskpartialbits (xoff1, widthGlyphs, startmask); -#endif - while (hTmp--) - { - GetBits4 -#ifdef FASTCHARS -# if BITMAP_BIT_ORDER == MSBFirst - c >>= PPW - widthGlyphs; -# endif - FASTPUTBITS(OP(c), xoff1, widthGlyphs, dst); -#else - *(dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask); -#endif - mfbScanlineInc(dst, widthDst); - } -#ifndef FASTCHARS - } - else - { - maskPPWbits (xoff1, widthGlyphs, startmask, endmask); - nfirst = PPW - xoff1; - while (hTmp--) - { - GetBits4 - dst[0] = (dst[0] & ~startmask) | - (OP(SCRRIGHT(c,xoff1)) & startmask); - dst[1] = (dst[1] & ~endmask) | - (OP(SCRLEFT(c,nfirst)) & endmask); - mfbScanlineInc(dst, widthDst); - } - } -#endif - xpos += widthGlyphs; - } - } - - while(nglyph--) - { - xoff1 = xpos & PIM; - char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase,(*ppci++)); - hTmp = h; - dst = mfbScanlineOffset(pdstBase, (xpos >> PWSH)); - -#ifndef FASTCHARS - if (xoff1 + widthGlyph <= PPW) - { - maskpartialbits (xoff1, widthGlyph, startmask); -#endif - while (hTmp--) - { -#ifdef FASTCHARS -#ifdef USE_LEFTBITS - FASTGETBITS (char1,0,widthGlyph,c); - char1 = (glyphPointer) (((char *) char1) + glyphBytes); -#else - c = *char1++; -#if BITMAP_BIT_ORDER == MSBFirst - c >>= PPW - widthGlyph; -#endif -#endif - FASTPUTBITS (OP(c),xoff1,widthGlyph,dst); -#else - GetBits1 - (*dst) = ((*dst) & ~startmask) | (OP(SCRRIGHT(c, xoff1)) & startmask); -#endif - mfbScanlineInc(dst, widthDst); - } -#ifndef FASTCHARS - } - else - { - maskPPWbits (xoff1, widthGlyph, startmask, endmask); - nfirst = PPW - xoff1; - while (hTmp--) - { - GetBits1 - dst[0] = (dst[0] & ~startmask) | - (OP(SCRRIGHT(c,xoff1)) & startmask); - dst[1] = (dst[1] & ~endmask) | - (OP(SCRLEFT(c,nfirst)) & endmask); - mfbScanlineInc(dst, widthDst); - } - } -#endif - xpos += widthGlyph; - } -} diff --git a/mfb/mfbtile.c b/mfb/mfbtile.c deleted file mode 100644 index 73015f57d..000000000 --- a/mfb/mfbtile.c +++ /dev/null @@ -1,238 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include "windowstr.h" -#include "regionstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "mfb.h" -#include "maskbits.h" - -#include "mergerop.h" -/* - - the boxes are already translated. - - NOTE: - iy = ++iy < tileHeight ? iy : 0 -is equivalent to iy%= tileheight, and saves a division. -*/ - -/* - tile area with a PPW bit wide pixmap -*/ -void -MROP_NAME(mfbTileAreaPPW)(pDraw, nbox, pbox, alu, ptile) - DrawablePtr pDraw; - int nbox; - BoxPtr pbox; - int alu; - PixmapPtr ptile; -{ - register PixelType *psrc; - /* pointer to bits in tile, if needed */ - int tileHeight; /* height of the tile */ - register PixelType srcpix; - int nlwidth; /* width in longwords of the drawable */ - int w; /* width of current box */ - MROP_DECLARE_REG () - register int h; /* height of current box */ - register int nlw; /* loop version of nlwMiddle */ - register PixelType *p; /* pointer to bits we're writing */ - PixelType startmask; - PixelType endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwExtra; /* to get from right of box to left of next span */ - register int iy; /* index of current scanline in tile */ - PixelType *pbits; /* pointer to start of drawable */ - - mfbGetPixelWidthAndPointer(pDraw, nlwidth, pbits); - - MROP_INITIALIZE(alu,~0) - - tileHeight = ptile->drawable.height; - psrc = (PixelType *)(ptile->devPrivate.ptr); - - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - iy = pbox->y1 % tileHeight; - p = mfbScanline(pbits, pbox->x1, pbox->y1, nlwidth); - - if ( ((pbox->x1 & PIM) + w) < PPW) - { - maskpartialbits(pbox->x1, w, startmask); - nlwExtra = nlwidth; - while (h--) - { - srcpix = psrc[iy]; - iy++; - if (iy == tileHeight) - iy = 0; - *p = MROP_MASK(srcpix,*p,startmask); - mfbScanlineInc(p, nlwExtra); - } - } - else - { - maskbits(pbox->x1, w, startmask, endmask, nlwMiddle); - nlwExtra = nlwidth - nlwMiddle; - - if (startmask && endmask) - { - nlwExtra -= 1; - while (h--) - { - srcpix = psrc[iy]; - iy++; - if (iy == tileHeight) - iy = 0; - nlw = nlwMiddle; - *p = MROP_MASK (srcpix,*p,startmask); - p++; - while (nlw--) - { - *p = MROP_SOLID(srcpix,*p); - p++; - } - - *p = MROP_MASK(srcpix,*p,endmask); - mfbScanlineInc(p, nlwExtra); - } - } - else if (startmask && !endmask) - { - nlwExtra -= 1; - while (h--) - { - srcpix = psrc[iy]; - iy++; - if (iy == tileHeight) - iy = 0; - nlw = nlwMiddle; - *p = MROP_MASK(srcpix,*p,startmask); - p++; - while (nlw--) - { - *p = MROP_SOLID(srcpix,*p); - p++; - } - mfbScanlineInc(p, nlwExtra); - } - } - else if (!startmask && endmask) - { - while (h--) - { - srcpix = psrc[iy]; - iy++; - if (iy == tileHeight) - iy = 0; - nlw = nlwMiddle; - while (nlw--) - { - *p = MROP_SOLID(srcpix,*p); - p++; - } - - *p = MROP_MASK(srcpix,*p,endmask); - mfbScanlineInc(p, nlwExtra); - } - } - else /* no ragged bits at either end */ - { - while (h--) - { - srcpix = psrc[iy]; - iy++; - if (iy == tileHeight) - iy = 0; - nlw = nlwMiddle; - while (nlw--) - { - *p = MROP_SOLID (srcpix,*p); - p++; - } - mfbScanlineInc(p, nlwExtra); - } - } - } - pbox++; - } -} - -#if (MROP) == 0 -void -mfbTileAreaPPW (pDraw, nbox, pbox, alu, ptile) - DrawablePtr pDraw; - int nbox; - BoxPtr pbox; - int alu; - PixmapPtr ptile; -{ - void (*f)( - DrawablePtr /*pDraw*/, - int /*nbox*/, - BoxPtr /*pbox*/, - int /*alu*/, - PixmapPtr /*ptile*/); - - if (alu == GXcopy) - f = mfbTileAreaPPWCopy; - else - f = mfbTileAreaPPWGeneral; - (*f) (pDraw, nbox, pbox, alu, ptile); -} -#endif diff --git a/mfb/mfbwindow.c b/mfb/mfbwindow.c deleted file mode 100644 index 37125da45..000000000 --- a/mfb/mfbwindow.c +++ /dev/null @@ -1,168 +0,0 @@ -/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - - -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_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include "scrnintstr.h" -#include "windowstr.h" -#include "privates.h" -#include "mfb.h" -#include "mistruct.h" -#include "regionstr.h" -#include "maskbits.h" - -Bool -mfbCreateWindow(pWin) - register WindowPtr pWin; -{ - return (TRUE); -} - -/* This always returns true, because Xfree can't fail. It might be possible - * on some devices for Destroy to fail */ -Bool -mfbDestroyWindow(WindowPtr pWin) -{ - return (TRUE); -} - -/*ARGSUSED*/ -Bool mfbMapWindow(pWindow) - WindowPtr pWindow; -{ - return (TRUE); -} - -/* (x, y) is the upper left corner of the window on the screen - do we really need to pass this? (is it a;ready in pWin->absCorner?) - we only do the rotation for pixmaps that are 32 bits wide (padded -or otherwise.) - mfbChangeWindowAttributes() has already put a copy of the pixmap -in pPrivWin->pRotated* -*/ - -/*ARGSUSED*/ -Bool -mfbPositionWindow(pWin, x, y) - register WindowPtr pWin; - int x, y; -{ - /* This is the "wrong" fix to the right problem, but it doesn't really - * cost very much. When the window is moved, we need to invalidate any - * RotatedPixmap that exists in any GC currently validated against this - * window. - */ - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - - /* Again, we have no failure modes indicated by any of the routines - * we've called, so we have to assume it worked */ - return (TRUE); -} - -/*ARGSUSED*/ -Bool -mfbUnmapWindow(pWindow) - WindowPtr pWindow; -{ - return (TRUE); -} - -/* UNCLEAN! - this code calls the bitblt helper code directly. - - mfbCopyWindow copies only the parts of the destination that are -visible in the source. -*/ - - -void -mfbCopyWindow(pWin, ptOldOrg, prgnSrc) - WindowPtr pWin; - DDXPointRec ptOldOrg; - RegionPtr prgnSrc; -{ - DDXPointPtr pptSrc; - register DDXPointPtr ppt; - RegionPtr prgnDst; - register BoxPtr pbox; - register int dx, dy; - register int i, nbox; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip, - prgnSrc); - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - if(!(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) - return; - ppt = pptSrc; - - for (i=nbox; --i >= 0; ppt++, pbox++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - mfbDoBitblt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - GXcopy, prgnDst, pptSrc); - xfree(pptSrc); - REGION_DESTROY(pWin->drawable.pScreen, prgnDst); -} diff --git a/mfb/mfbzerarc.c b/mfb/mfbzerarc.c deleted file mode 100644 index 624e45fee..000000000 --- a/mfb/mfbzerarc.c +++ /dev/null @@ -1,259 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -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. - -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 -OPEN GROUP 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 Open Group 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 Open Group. - -********************************************************/ - - -/* 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_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include "regionstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "mfb.h" -#include "maskbits.h" -#include "mizerarc.h" -#include "mi.h" - -/* - * Note: LEFTMOST must be the bit leftmost in the actual screen - * representation. This depends also on the IMAGE_BYTE_ORDER. - * LONG2CHARS() takes care of the re-ordering as required. (DHD) - */ -#if (BITMAP_BIT_ORDER == MSBFirst) -#define LEFTMOST ((PixelType) LONG2CHARS(((MfbBits)1 << PLST))) -#else -#define LEFTMOST ((PixelType) LONG2CHARS(1)) -#endif - -#define PixelateWhite(addr,yoff,xoff) \ - *mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) |= \ - SCRRIGHT (LEFTMOST, ((xoff) & PIM)) -#define PixelateBlack(addr,yoff,xoff) \ - *mfbScanlineOffset(addr, (yoff)+((xoff)>>PWSH)) &= \ - ~(SCRRIGHT (LEFTMOST, ((xoff) & PIM))) - -#define Pixelate(base,yoff,xoff) \ -{ \ - paddr = mfbScanlineOffset(base, (yoff) + ((xoff)>>PWSH)); \ - pmask = SCRRIGHT(LEFTMOST, (xoff) & PIM); \ - *paddr = (*paddr & ~pmask) | (pixel & pmask); \ -} - -#define DoPix(bit,base,yoff,xoff) if (mask & bit) Pixelate(base,yoff,xoff); - -static void -mfbZeroArcSS( - DrawablePtr pDraw, - GCPtr pGC, - xArc *arc) -{ - miZeroArcRec info; - Bool do360; - register int x, y, a, b, d, mask; - register int k1, k3, dx, dy; - PixelType *addrl; - PixelType *yorgl, *yorgol; - PixelType pixel; - int nlwidth, yoffset, dyoffset; - PixelType pmask; - register PixelType *paddr; - - if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, - mfbGetGCPrivateKey()))->rop == - RROP_BLACK) - pixel = 0; - else - pixel = ~0; - - mfbGetPixelWidthAndPointer(pDraw, nlwidth, addrl); - 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; - mask = info.initialMask; - if (!(arc->width & 1)) - { - DoPix(2, yorgl, 0, info.xorgo); - DoPix(8, yorgol, 0, info.xorgo); - } - if (!info.end.x || !info.end.y) - { - mask = info.end.mask; - info.end = info.altend; - } - if (do360 && (arc->width == arc->height) && !(arc->width & 1)) - { - int xoffset = nlwidth; - PixelType *yorghl = mfbScanlineDeltaNoBankSwitch(yorgl, info.h, nlwidth); - int xorghp = info.xorg + info.h; - int xorghn = info.xorg - info.h; - - if (pixel) - { - 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;); - } - } - else - { - while (1) - { - PixelateBlack(yorgl, yoffset, info.xorg + x); - PixelateBlack(yorgl, yoffset, info.xorg - x); - PixelateBlack(yorgol, -yoffset, info.xorg - x); - PixelateBlack(yorgol, -yoffset, info.xorg + x); - if (a < 0) - break; - PixelateBlack(yorghl, -xoffset, xorghp - y); - PixelateBlack(yorghl, -xoffset, xorghn + y); - PixelateBlack(yorghl, xoffset, xorghn + y); - PixelateBlack(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)) - { - mask = 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)) - { - mask = info.end.mask; - info.end = info.altend; - } - MIARCSTEP(yoffset += dyoffset;, yoffset += nlwidth;); - } - } - if ((x == info.start.x) || (y == info.start.y)) - mask = 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); - } -} - -void -mfbZeroPolyArcSS(pDraw, pGC, narcs, parcs) - DrawablePtr pDraw; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - register xArc *arc; - register int i; - BoxRec box; - int x2, y2; - RegionPtr cclip; - - if (!(pGC->planemask & 1)) - 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; - /* - * Because box.x2 and box.y2 get truncated to 16 bits, and the - * RECT_IN_REGION test treats the resulting number as a signed - * integer, the RECT_IN_REGION test alone can go the wrong way. - * This can result in a server crash because the rendering - * routines in this file deal directly with cpu addresses - * of pixels to be stored, and do not clip or otherwise check - * that all such addresses are within their respective pixmaps. - * So we only allow the RECT_IN_REGION test to be used for - * values that can be expressed correctly in a signed short. - */ - x2 = box.x1 + (int)arc->width + 1; - box.x2 = x2; - y2 = box.y1 + (int)arc->height + 1; - box.y2 = y2; - if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && - (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) - mfbZeroArcSS(pDraw, pGC, arc); - else - miZeroPolyArc(pDraw, pGC, 1, arc); - } - else - miPolyArc(pDraw, pGC, 1, arc); - } -} diff --git a/mi/micoord.h b/mi/micoord.h index 876e88c95..16d086117 100644 --- a/mi/micoord.h +++ b/mi/micoord.h @@ -48,7 +48,7 @@ defined(__alpha) || defined(__alpha__) || \ defined(__i386__) || defined(__i386) || defined(__ia64__) || \ defined(__s390x__) || defined(__s390__) || \ - defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__) + defined(__amd64__) || defined(amd64) || defined(__amd64) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) diff --git a/mi/miinitext.c b/mi/miinitext.c index 71e8f3f16..c68ff9a07 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -66,7 +66,6 @@ SOFTWARE. #ifdef HAVE_KDRIVE_CONFIG_H #include /* there must be a better way... */ -#undef XF86MISC #undef XFreeXDGA #undef XF86DRI #undef XF86VIDMODE @@ -74,7 +73,6 @@ SOFTWARE. #ifdef HAVE_XGL_CONFIG_H #include -#undef XF86MISC #undef XFreeXDGA #undef XF86DRI #undef XF86VIDMODE @@ -103,9 +101,6 @@ extern Bool noDbeExtension; #ifdef DPMSExtension extern Bool noDPMSExtension; #endif -#ifdef FONTCACHE -extern Bool noFontCacheExtension; -#endif #ifdef GLXEXT extern Bool noGlxExtension; #endif @@ -151,9 +146,6 @@ extern Bool noXFree86DGAExtension; #ifdef XF86DRI extern Bool noXFree86DRIExtension; #endif -#ifdef XF86MISC -extern Bool noXFree86MiscExtension; -#endif #ifdef XF86VIDMODE extern Bool noXFree86VidModeExtension; #endif @@ -240,9 +232,6 @@ extern void BigReqExtensionInit(INITARGS); #ifdef XIDLE extern void XIdleExtensionInit(INITARGS); #endif -#ifdef XTRAP -extern void DEC_XTRAPInit(INITARGS); -#endif #ifdef SCREENSAVER extern void ScreenSaverExtensionInit (INITARGS); #endif @@ -277,9 +266,6 @@ extern void XFree86BigfontExtensionInit(INITARGS); #ifdef XF86VIDMODE extern void XFree86VidModeExtensionInit(INITARGS); #endif -#ifdef XF86MISC -extern void XFree86MiscExtensionInit(INITARGS); -#endif #ifdef XFreeXDGA extern void XFree86DGAExtensionInit(INITARGS); #endif @@ -295,9 +281,6 @@ extern void XFree86DRIExtensionInit(INITARGS); #ifdef DPMSExtension extern void DPMSExtensionInit(INITARGS); #endif -#ifdef FONTCACHE -extern void FontCacheExtensionInit(INITARGS); -#endif #ifdef RENDER extern void RenderExtensionInit(INITARGS); #endif @@ -351,9 +334,6 @@ static ExtensionToggle ExtensionToggleList[] = #ifdef DPMSExtension { "DPMS", &noDPMSExtension }, #endif -#ifdef FONTCACHE - { "FontCache", &noFontCacheExtension }, -#endif #ifdef GLXEXT { "GLX", &noGlxExtension }, #endif @@ -399,9 +379,6 @@ static ExtensionToggle ExtensionToggleList[] = #ifdef XF86DRI { "XFree86-DRI", &noXFree86DRIExtension }, #endif -#ifdef XF86MISC - { "XFree86-Misc", &noXFree86MiscExtension }, -#endif #ifdef XF86VIDMODE { "XFree86-VidModeExtension", &noXFree86VidModeExtension }, #endif @@ -485,9 +462,6 @@ InitExtensions(int argc, char *argv[]) #ifdef XIDLE if (!noXIdleExtension) XIdleExtensionInit(); #endif -#ifdef XTRAP - if (!noTestExtensions) DEC_XTRAPInit(); -#endif #if defined(SCREENSAVER) if (!noScreenSaverExtension) ScreenSaverExtensionInit (); #endif @@ -521,9 +495,6 @@ InitExtensions(int argc, char *argv[]) #if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS) if (!noDPMSExtension) DPMSExtensionInit(); #endif -#ifdef FONTCACHE - if (!noFontCacheExtension) FontCacheExtensionInit(); -#endif #ifdef XF86BIGFONT if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit(); #endif @@ -531,9 +502,6 @@ InitExtensions(int argc, char *argv[]) #if defined(XF86VIDMODE) if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit(); #endif -#if defined(XF86MISC) - if (!noXFree86MiscExtension) XFree86MiscExtensionInit(); -#endif #if defined(XFreeXDGA) if (!noXFree86DGAExtension) XFree86DGAExtensionInit(); #endif diff --git a/mi/mipointer.c b/mi/mipointer.c index 8b673f4fe..809ce5e8b 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -126,8 +126,10 @@ miPointerInitialize (ScreenPtr pScreen, static Bool miPointerCloseScreen (int index, ScreenPtr pScreen) { +#if 0 miPointerPtr pPointer; DeviceIntPtr pDev; +#endif SetupScreen(pScreen); @@ -557,12 +559,6 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time) miPointerMoved(pDev, pScreen, *x, *y, time); } -_X_EXPORT void -miPointerPosition (int *x, int *y) -{ - miPointerGetPosition(inputInfo.pointer, x, y); -} - _X_EXPORT void miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y) { diff --git a/mi/mipointer.h b/mi/mipointer.h index d2e4455eb..179e4f371 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -134,12 +134,6 @@ extern void miPointerAbsoluteCursor( unsigned long /*time*/ ) _X_DEPRECATED; -/* Deprecated in favour of miPointerGetPosition. */ -extern void miPointerPosition( - int * /*x*/, - int * /*y*/ -) _X_DEPRECATED; - /* Deprecated in favour of miPointerSetScreen. */ extern void miPointerSetNewScreen( int, /*screen_no*/ diff --git a/mi/miregion.c b/mi/miregion.c index 7e9f5e109..be979347a 100644 --- a/mi/miregion.c +++ b/mi/miregion.c @@ -88,7 +88,7 @@ Equipment Corporation. #include #undef assert -#ifdef DEBUG +#ifdef REGION_DEBUG #define assert(expr) { \ CARD32 *foo = NULL; \ if (!(expr)) { \ diff --git a/mi/misprite.c b/mi/misprite.c index c1f64ce0f..122cea43b 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -50,7 +50,7 @@ in this Software without prior written authorization from The Open Group. # include "mispritest.h" # include "dixfontstr.h" # include -# include "inputstr.h" +# include "inputstr.h" #ifdef RENDER # include "mipict.h" @@ -99,12 +99,12 @@ static void miSpriteInstallColormap(ColormapPtr pMap); static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem *pdef); -static void miSpriteComputeSaved(DeviceIntPtr pDev, +static void miSpriteComputeSaved(DeviceIntPtr pDev, ScreenPtr pScreen); -static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, +static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); -static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, +static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ @@ -118,12 +118,12 @@ static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, */ static Bool miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor); -static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor); +static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor); -static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, +static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y); -static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, +static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); _X_EXPORT miPointerSpriteFuncRec miSpritePointerFuncs = { @@ -139,8 +139,8 @@ _X_EXPORT miPointerSpriteFuncRec miSpritePointerFuncs = { * other misc functions */ -static void miSpriteRemoveCursor(DeviceIntPtr pDev, - ScreenPtr pScreen); +static void miSpriteRemoveCursor(DeviceIntPtr pDev, + ScreenPtr pScreen); static void miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen); static void miSpriteRestoreCursor(DeviceIntPtr pDev, @@ -153,7 +153,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; DeviceIntPtr pDev; - + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); @@ -164,9 +164,9 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) pCursorInfo = MISPRITE(pDev); if (pCursorInfo->isUp && - pCursorInfo->pScreen == pScreen && - RECT_IN_REGION (pScreen, pRegion, &pCursorInfo->saved) - != rgnOUT) + pCursorInfo->pScreen == pScreen && + RECT_IN_REGION (pScreen, pRegion, &pCursorInfo->saved) + != rgnOUT) { SPRITE_DEBUG(("Damage remove\n")); miSpriteRemoveCursor (pDev, pScreen); @@ -188,14 +188,14 @@ miSpriteInitialize (ScreenPtr pScreen, { miSpriteScreenPtr pScreenPriv; VisualPtr pVisual; - + if (!DamageSetup (pScreen)) return FALSE; pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec)); if (!pScreenPriv) return FALSE; - + pScreenPriv->pDamage = DamageCreate (miSpriteReportDamage, (DamageDestroyFunc) 0, DamageReportRawRegion, @@ -219,10 +219,10 @@ miSpriteInitialize (ScreenPtr pScreen, pScreenPriv->SourceValidate = pScreen->SourceValidate; pScreenPriv->CopyWindow = pScreen->CopyWindow; - + pScreenPriv->InstallColormap = pScreen->InstallColormap; pScreenPriv->StoreColors = pScreen->StoreColors; - + pScreenPriv->BlockHandler = pScreen->BlockHandler; pScreenPriv->DeviceCursorInitialize = pScreen->DeviceCursorInitialize; @@ -238,7 +238,7 @@ miSpriteInitialize (ScreenPtr pScreen, pScreenPriv->colors[MASK_COLOR].green = 0; pScreenPriv->colors[MASK_COLOR].blue = 0; dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv); - + pScreen->CloseScreen = miSpriteCloseScreen; pScreen->GetImage = miSpriteGetImage; pScreen->GetSpans = miSpriteGetSpans; @@ -295,7 +295,7 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h, miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev = inputInfo.pointer; miCursorInfoPtr pCursorInfo; - + SCREEN_PROLOGUE (pScreen, GetImage); pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, @@ -308,8 +308,8 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h, if (pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && - ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y, - sx, sy, w, h)) + ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y, + sx, sy, w, h)) { SPRITE_DEBUG (("GetImage remove\n")); miSpriteRemoveCursor (pDev, pScreen); @@ -331,7 +331,7 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev = inputInfo.pointer; miCursorInfoPtr pCursorInfo; - + SCREEN_PROLOGUE (pScreen, GetSpans); pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, @@ -343,8 +343,8 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, { pCursorInfo = MISPRITE(pDev); - if (pDrawable->type == DRAWABLE_WINDOW && - pCursorInfo->isUp && + if (pDrawable->type == DRAWABLE_WINDOW && + pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) { DDXPointPtr pts; @@ -385,7 +385,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev = inputInfo.pointer; miCursorInfoPtr pCursorInfo; - + SCREEN_PROLOGUE (pScreen, SourceValidate); pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, @@ -397,7 +397,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, { pCursorInfo = MISPRITE(pDev); if (pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp && - pCursorInfo->pScreen == pScreen && + pCursorInfo->pScreen == pScreen && ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y, x, y, width, height)) { @@ -420,7 +420,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev = inputInfo.pointer; miCursorInfoPtr pCursorInfo; - + SCREEN_PROLOGUE (pScreen, CopyWindow); pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, @@ -503,7 +503,7 @@ miSpriteInstallColormap (ColormapPtr pMap) pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, InstallColormap); - + (*pScreen->InstallColormap) (pMap); SCREEN_EPILOGUE(pScreen, InstallColormap); @@ -542,7 +542,7 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef) pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, StoreColors); - + (*pScreen->StoreColors) (pMap, ndef, pdef); SCREEN_EPILOGUE(pScreen, StoreColors); @@ -581,14 +581,14 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef) for (i = 0; i < ndef; i++) { if (pdef[i].pixel == - pPriv->colors[SOURCE_COLOR].pixel) + pPriv->colors[SOURCE_COLOR].pixel) { pPriv->colors[SOURCE_COLOR] = pdef[i]; if (++updated == 2) break; } if (pdef[i].pixel == - pPriv->colors[MASK_COLOR].pixel) + pPriv->colors[MASK_COLOR].pixel) { pPriv->colors[MASK_COLOR] = pdef[i]; if (++updated == 2) @@ -695,7 +695,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); miCursorInfoPtr pPointer; - + if (!pDev->isMaster && !pDev->u.master) { ErrorF("[mi] miSpriteSetCursor called for floating device.\n"); @@ -754,7 +754,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, sx + (int)pCursor->bits->width < pointer->saved.x2 && sy >= pointer->saved.y1 && sy + (int)pCursor->bits->height < - pointer->saved.y2)) + pointer->saved.y2)) { int oldx1, oldy1, dx, dy; @@ -967,7 +967,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen) int x, y; CursorPtr pCursor; miCursorInfoPtr pCursorInfo; - + if (!pDev->isMaster && !pDev->u.master) { ErrorF("[mi] miSpriteRestoreCursor called for floating device.\n"); @@ -988,7 +988,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen) SPRITE_DEBUG(("RestoreCursor %d\n", pDev->id)); if (pCursorInfo->checkPixels) miSpriteFindColors (pCursorInfo, pScreen); - if ((*pScreenPriv->funcs->PutUpCursor) (pDev, pScreen, + if ((*pScreenPriv->funcs->PutUpCursor) (pDev, pScreen, pCursor, x, y, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel)) diff --git a/os/Makefile.am b/os/Makefile.am index ce6058538..16e4bfacc 100644 --- a/os/Makefile.am +++ b/os/Makefile.am @@ -15,7 +15,6 @@ libos_la_SOURCES = \ io.c \ mitauth.c \ oscolor.c \ - oscolor.h \ osdep.h \ osinit.c \ utils.c \ diff --git a/os/access.c b/os/access.c index db14380df..93e33b52f 100644 --- a/os/access.c +++ b/os/access.c @@ -76,11 +76,7 @@ SOFTWARE. #include #include #ifndef WIN32 -#ifndef Lynx #include -#else -#include -#endif #include #include @@ -99,20 +95,6 @@ SOFTWARE. # endif #endif -#if defined(DGUX) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - - #if defined(hpux) || defined(QNX4) # include # ifdef HAS_IFREQ @@ -177,11 +159,7 @@ SOFTWARE. #endif /* WIN32 */ #ifndef PATH_MAX -#ifndef Lynx #include -#else -#include -#endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN @@ -312,7 +290,7 @@ AccessUsingXdmcp (void) } -#if ((defined(SVR4) && !defined(DGUX) && !defined(SCO325) && !defined(sun) && !defined(NCR)) || defined(ISC)) && !defined(__sgi) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF) +#if ((defined(SVR4) && !defined(SCO325) && !defined(sun)) || defined(ISC)) && !defined(__sgi) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF) /* Deal with different SIOCGIFCONF ioctl semantics on these OSs */ @@ -361,9 +339,9 @@ ifioctl (int fd, int cmd, char *arg) #endif return(ret); } -#else /* Case DGUX, sun, SCO325 NCR and others */ +#else /* Case sun, SCO325 and others */ #define ifioctl ioctl -#endif /* ((SVR4 && !DGUX !sun !SCO325 !NCR) || ISC) && SIOCGIFCONF */ +#endif /* ((SVR4 && !sun !SCO325) || ISC) && SIOCGIFCONF */ /* * DefineSelf (fd): @@ -372,152 +350,6 @@ ifioctl (int fd, int cmd, char *arg) * for this fd and add them to the selfhosts list. */ -#ifdef WINTCP /* NCR Wollongong based TCP */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -void -DefineSelf (int fd) -{ - /* - * The Wolongong drivers used by NCR SVR4/MP-RAS don't understand the - * socket IO calls that most other drivers seem to like. Because of - * this, this routine must be special cased for NCR. Eventually, - * this will be cleared up. - */ - - struct ipb ifnet; - struct in_ifaddr ifaddr; - struct strioctl str; - unsigned char *addr; - register HOST *host; - int family, len; - - if ((fd = open ("/dev/ip", O_RDWR, 0 )) < 0) - Error ("Getting interface configuration (1)"); - - /* Indicate that we want to start at the begining */ - ifnet.ib_next = (struct ipb *) 1; - - while (ifnet.ib_next) - { - str.ic_cmd = IPIOC_GETIPB; - str.ic_timout = 0; - str.ic_len = sizeof (struct ipb); - str.ic_dp = (char *) &ifnet; - - if (ioctl (fd, (int) I_STR, (char *) &str) < 0) - { - close (fd); - Error ("Getting interface configuration (2)"); - } - - ifaddr.ia_next = (struct in_ifaddr *) ifnet.if_addrlist; - str.ic_cmd = IPIOC_GETINADDR; - str.ic_timout = 0; - str.ic_len = sizeof (struct in_ifaddr); - str.ic_dp = (char *) &ifaddr; - - if (ioctl (fd, (int) I_STR, (char *) &str) < 0) - { - close (fd); - Error ("Getting interface configuration (3)"); - } - - len = sizeof(struct sockaddr_in); - family = ConvertAddr (IA_SIN(&ifaddr), &len, (pointer *)&addr); - if (family == -1 || family == FamilyLocal) - continue; - for (host = selfhosts; - host && !addrEqual (family, addr, len, host); - host = host->next) - ; - if (host) - continue; - MakeHost(host,len) - if (host) - { - host->family = family; - host->len = len; - acopy(addr, host->addr, len); - host->next = selfhosts; - selfhosts = host; - } -#ifdef XDMCP - { - struct sockaddr broad_addr; - - /* - * If this isn't an Internet Address, don't register it. - */ - if (family != FamilyInternet) - continue; - - /* - * Ignore 'localhost' entries as they're not useful - * on the other end of the wire. - */ - if (len == 4 && - addr[0] == 127 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 1) - continue; - - /* - * Ignore '0.0.0.0' entries as they are - * returned by some OSes for unconfigured NICs but they are - * not useful on the other end of the wire. - */ - if (len == 4 && - addr[0] == 0 && addr[1] == 0 && - addr[2] == 0 && addr[3] == 0) - continue; - - XdmcpRegisterConnection (family, (char *)addr, len); - - -#define IA_BROADADDR(ia) ((struct sockaddr_in *)(&((struct in_ifaddr *)ia)->ia_broadaddr)) - - XdmcpRegisterBroadcastAddress ( - (struct sockaddr_in *) IA_BROADADDR(&ifaddr)); - -#undef IA_BROADADDR - } -#endif /* XDMCP */ - } - - close(fd); - - /* - * add something of FamilyLocalHost - */ - for (host = selfhosts; - host && !addrEqual(FamilyLocalHost, "", 0, host); - host = host->next); - if (!host) - { - MakeHost(host, 0); - if (host) - { - host->family = FamilyLocalHost; - host->len = 0; - acopy("", host->addr, 0); - host->next = selfhosts; - selfhosts = host; - } - } -} - -#else /* WINTCP */ - #if !defined(SIOCGIFCONF) || (defined (hpux) && ! defined (HAS_IFREQ)) || defined(QNX4) void DefineSelf (int fd) @@ -1097,7 +929,6 @@ DefineSelf (int fd) } } #endif /* hpux && !HAS_IFREQ */ -#endif /* WINTCP */ #ifdef XDMCP void @@ -1190,7 +1021,8 @@ ResetHosts (char *display) strlen(display) + 1; if (fnamelen > sizeof(fname)) FatalError("Display name `%s' is too long\n", display); - sprintf(fname, ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, display); + snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, + display); if ((fd = fopen (fname, "r")) != 0) { diff --git a/os/auth.c b/os/auth.c index dab4f60bd..a852e1c3b 100644 --- a/os/auth.c +++ b/os/auth.c @@ -314,8 +314,6 @@ GenerateAuthorization( return -1; } -#ifdef HAVE_URANDOM - void GenerateRandomData (int len, char *buf) { @@ -326,45 +324,4 @@ GenerateRandomData (int len, char *buf) close(fd); } -#else /* !HAVE_URANDOM */ - -/* A random number generator that is more unpredictable - than that shipped with some systems. - This code is taken from the C standard. */ - -static unsigned long int next = 1; - -static int -xdm_rand(void) -{ - next = next * 1103515245 + 12345; - return (unsigned int)(next/65536) % 32768; -} - -static void -xdm_srand(unsigned int seed) -{ - next = seed; -} - -void -GenerateRandomData (int len, char *buf) -{ - static int seed; - int value; - int i; - - seed += GetTimeInMillis(); - xdm_srand (seed); - for (i = 0; i < len; i++) - { - value = xdm_rand (); - buf[i] ^= (value & 0xff00) >> 8; - } - - /* XXX add getrusage, popen("ps -ale") */ -} - -#endif /* HAVE_URANDOM */ - #endif /* XCSECURITY */ diff --git a/os/connection.c b/os/connection.c index 38521e686..021776271 100644 --- a/os/connection.c +++ b/os/connection.c @@ -83,29 +83,13 @@ SOFTWARE. #include #ifndef WIN32 -#if defined(Lynx) -#include -#else #include -#endif #ifdef hpux #include #include #endif -#if defined(DGUX) -#include -#include -#include -#include -#include -#include -#include -#include -#endif - - #ifdef AIXV3 #include #endif @@ -128,11 +112,8 @@ SOFTWARE. # include #endif -#ifndef Lynx #include -#else -#include -#endif + #endif /* WIN32 */ #include "misc.h" /* for typedef of pointer */ #include "osdep.h" @@ -141,11 +122,7 @@ SOFTWARE. #include "dixstruct.h" #include "xace.h" -#ifdef X_NOT_POSIX -#define Pid_t int -#else #define Pid_t pid_t -#endif #ifdef DNETCONN #include @@ -757,7 +734,9 @@ ClientAuthorized(ClientPtr client, } } priv->auth_id = auth_id; +#ifdef HAVE_LAUNCHD done: +#endif priv->conn_time = 0; #ifdef XDMCP diff --git a/os/io.c b/os/io.c index 4f4a10903..4a2f52f19 100644 --- a/os/io.c +++ b/os/io.c @@ -70,11 +70,7 @@ SOFTWARE. #include #include #if !defined(WIN32) -#ifndef Lynx #include -#else -#include -#endif #endif #include #define NEED_REPLIES @@ -96,15 +92,7 @@ static ConnectionOutputPtr AllocateOutputBuffer(void); * systems are broken and return EWOULDBLOCK when they should return EAGAIN */ #ifndef WIN32 -#if defined(EAGAIN) && defined(EWOULDBLOCK) #define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK) -#else -#ifdef EAGAIN -#define ETEST(err) (err == EAGAIN) -#else -#define ETEST(err) (err == EWOULDBLOCK) -#endif -#endif #else /* WIN32 The socket errorcodes differ from the normal errors*/ #define ETEST(err) (err == EAGAIN || err == WSAEWOULDBLOCK) #endif diff --git a/os/log.c b/os/log.c index 2a59a00b3..9b0a77fda 100644 --- a/os/log.c +++ b/os/log.c @@ -524,13 +524,8 @@ FatalError(const char *f, ...) VErrorF(f, args); va_end(args); ErrorF("\n"); -#ifdef DDXOSFATALERROR if (!beenhere) OsVendorFatalError(); -#endif -#ifdef ABORTONFATALERROR - abort(); -#endif if (!beenhere) { beenhere = TRUE; AbortServer(); @@ -564,21 +559,6 @@ ErrorF(const char * f, ...) /* A perror() workalike. */ -#ifndef NEED_STRERROR -#ifdef SYSV -#if !defined(ISC) || defined(ISC202) || defined(ISC22) -#define NEED_STRERROR -#endif -#endif -#endif - -#if defined(NEED_STRERROR) && !defined(strerror) -extern char *sys_errlist[]; -extern int sys_nerr; -#define strerror(n) \ - ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[(n)] : "unknown error" -#endif - _X_EXPORT void Error(char *str) { diff --git a/os/oscolor.c b/os/oscolor.c index f3ff9beac..cc45aafb1 100644 --- a/os/oscolor.c +++ b/os/oscolor.c @@ -59,60 +59,1527 @@ typedef struct _builtinColor { unsigned short name; } BuiltinColor; -/* These have to come after the struct definition because despair. */ -#include "oscolor.h" +static const char BuiltinColorNames[] = { + "alice blue\0" + "AliceBlue\0" + "antique white\0" + "AntiqueWhite\0" + "AntiqueWhite1\0" + "AntiqueWhite2\0" + "AntiqueWhite3\0" + "AntiqueWhite4\0" + "aquamarine\0" + "aquamarine1\0" + "aquamarine2\0" + "aquamarine3\0" + "aquamarine4\0" + "azure\0" + "azure1\0" + "azure2\0" + "azure3\0" + "azure4\0" + "beige\0" + "bisque\0" + "bisque1\0" + "bisque2\0" + "bisque3\0" + "bisque4\0" + "black\0" + "blanched almond\0" + "BlanchedAlmond\0" + "blue\0" + "blue violet\0" + "blue1\0" + "blue2\0" + "blue3\0" + "blue4\0" + "BlueViolet\0" + "brown\0" + "brown1\0" + "brown2\0" + "brown3\0" + "brown4\0" + "burlywood\0" + "burlywood1\0" + "burlywood2\0" + "burlywood3\0" + "burlywood4\0" + "cadet blue\0" + "CadetBlue\0" + "CadetBlue1\0" + "CadetBlue2\0" + "CadetBlue3\0" + "CadetBlue4\0" + "chartreuse\0" + "chartreuse1\0" + "chartreuse2\0" + "chartreuse3\0" + "chartreuse4\0" + "chocolate\0" + "chocolate1\0" + "chocolate2\0" + "chocolate3\0" + "chocolate4\0" + "coral\0" + "coral1\0" + "coral2\0" + "coral3\0" + "coral4\0" + "cornflower blue\0" + "CornflowerBlue\0" + "cornsilk\0" + "cornsilk1\0" + "cornsilk2\0" + "cornsilk3\0" + "cornsilk4\0" + "cyan\0" + "cyan1\0" + "cyan2\0" + "cyan3\0" + "cyan4\0" + "dark blue\0" + "dark cyan\0" + "dark goldenrod\0" + "dark gray\0" + "dark green\0" + "dark grey\0" + "dark khaki\0" + "dark magenta\0" + "dark olive green\0" + "dark orange\0" + "dark orchid\0" + "dark red\0" + "dark salmon\0" + "dark sea green\0" + "dark slate blue\0" + "dark slate gray\0" + "dark slate grey\0" + "dark turquoise\0" + "dark violet\0" + "DarkBlue\0" + "DarkCyan\0" + "DarkGoldenrod\0" + "DarkGoldenrod1\0" + "DarkGoldenrod2\0" + "DarkGoldenrod3\0" + "DarkGoldenrod4\0" + "DarkGray\0" + "DarkGreen\0" + "DarkGrey\0" + "DarkKhaki\0" + "DarkMagenta\0" + "DarkOliveGreen\0" + "DarkOliveGreen1\0" + "DarkOliveGreen2\0" + "DarkOliveGreen3\0" + "DarkOliveGreen4\0" + "DarkOrange\0" + "DarkOrange1\0" + "DarkOrange2\0" + "DarkOrange3\0" + "DarkOrange4\0" + "DarkOrchid\0" + "DarkOrchid1\0" + "DarkOrchid2\0" + "DarkOrchid3\0" + "DarkOrchid4\0" + "DarkRed\0" + "DarkSalmon\0" + "DarkSeaGreen\0" + "DarkSeaGreen1\0" + "DarkSeaGreen2\0" + "DarkSeaGreen3\0" + "DarkSeaGreen4\0" + "DarkSlateBlue\0" + "DarkSlateGray\0" + "DarkSlateGray1\0" + "DarkSlateGray2\0" + "DarkSlateGray3\0" + "DarkSlateGray4\0" + "DarkSlateGrey\0" + "DarkTurquoise\0" + "DarkViolet\0" + "deep pink\0" + "deep sky blue\0" + "DeepPink\0" + "DeepPink1\0" + "DeepPink2\0" + "DeepPink3\0" + "DeepPink4\0" + "DeepSkyBlue\0" + "DeepSkyBlue1\0" + "DeepSkyBlue2\0" + "DeepSkyBlue3\0" + "DeepSkyBlue4\0" + "dim gray\0" + "dim grey\0" + "DimGray\0" + "DimGrey\0" + "dodger blue\0" + "DodgerBlue\0" + "DodgerBlue1\0" + "DodgerBlue2\0" + "DodgerBlue3\0" + "DodgerBlue4\0" + "firebrick\0" + "firebrick1\0" + "firebrick2\0" + "firebrick3\0" + "firebrick4\0" + "floral white\0" + "FloralWhite\0" + "forest green\0" + "ForestGreen\0" + "gainsboro\0" + "ghost white\0" + "GhostWhite\0" + "gold\0" + "gold1\0" + "gold2\0" + "gold3\0" + "gold4\0" + "goldenrod\0" + "goldenrod1\0" + "goldenrod2\0" + "goldenrod3\0" + "goldenrod4\0" + "gray\0" + "gray0\0" + "gray1\0" + "gray10\0" + "gray100\0" + "gray11\0" + "gray12\0" + "gray13\0" + "gray14\0" + "gray15\0" + "gray16\0" + "gray17\0" + "gray18\0" + "gray19\0" + "gray2\0" + "gray20\0" + "gray21\0" + "gray22\0" + "gray23\0" + "gray24\0" + "gray25\0" + "gray26\0" + "gray27\0" + "gray28\0" + "gray29\0" + "gray3\0" + "gray30\0" + "gray31\0" + "gray32\0" + "gray33\0" + "gray34\0" + "gray35\0" + "gray36\0" + "gray37\0" + "gray38\0" + "gray39\0" + "gray4\0" + "gray40\0" + "gray41\0" + "gray42\0" + "gray43\0" + "gray44\0" + "gray45\0" + "gray46\0" + "gray47\0" + "gray48\0" + "gray49\0" + "gray5\0" + "gray50\0" + "gray51\0" + "gray52\0" + "gray53\0" + "gray54\0" + "gray55\0" + "gray56\0" + "gray57\0" + "gray58\0" + "gray59\0" + "gray6\0" + "gray60\0" + "gray61\0" + "gray62\0" + "gray63\0" + "gray64\0" + "gray65\0" + "gray66\0" + "gray67\0" + "gray68\0" + "gray69\0" + "gray7\0" + "gray70\0" + "gray71\0" + "gray72\0" + "gray73\0" + "gray74\0" + "gray75\0" + "gray76\0" + "gray77\0" + "gray78\0" + "gray79\0" + "gray8\0" + "gray80\0" + "gray81\0" + "gray82\0" + "gray83\0" + "gray84\0" + "gray85\0" + "gray86\0" + "gray87\0" + "gray88\0" + "gray89\0" + "gray9\0" + "gray90\0" + "gray91\0" + "gray92\0" + "gray93\0" + "gray94\0" + "gray95\0" + "gray96\0" + "gray97\0" + "gray98\0" + "gray99\0" + "green\0" + "green yellow\0" + "green1\0" + "green2\0" + "green3\0" + "green4\0" + "GreenYellow\0" + "grey\0" + "grey0\0" + "grey1\0" + "grey10\0" + "grey100\0" + "grey11\0" + "grey12\0" + "grey13\0" + "grey14\0" + "grey15\0" + "grey16\0" + "grey17\0" + "grey18\0" + "grey19\0" + "grey2\0" + "grey20\0" + "grey21\0" + "grey22\0" + "grey23\0" + "grey24\0" + "grey25\0" + "grey26\0" + "grey27\0" + "grey28\0" + "grey29\0" + "grey3\0" + "grey30\0" + "grey31\0" + "grey32\0" + "grey33\0" + "grey34\0" + "grey35\0" + "grey36\0" + "grey37\0" + "grey38\0" + "grey39\0" + "grey4\0" + "grey40\0" + "grey41\0" + "grey42\0" + "grey43\0" + "grey44\0" + "grey45\0" + "grey46\0" + "grey47\0" + "grey48\0" + "grey49\0" + "grey5\0" + "grey50\0" + "grey51\0" + "grey52\0" + "grey53\0" + "grey54\0" + "grey55\0" + "grey56\0" + "grey57\0" + "grey58\0" + "grey59\0" + "grey6\0" + "grey60\0" + "grey61\0" + "grey62\0" + "grey63\0" + "grey64\0" + "grey65\0" + "grey66\0" + "grey67\0" + "grey68\0" + "grey69\0" + "grey7\0" + "grey70\0" + "grey71\0" + "grey72\0" + "grey73\0" + "grey74\0" + "grey75\0" + "grey76\0" + "grey77\0" + "grey78\0" + "grey79\0" + "grey8\0" + "grey80\0" + "grey81\0" + "grey82\0" + "grey83\0" + "grey84\0" + "grey85\0" + "grey86\0" + "grey87\0" + "grey88\0" + "grey89\0" + "grey9\0" + "grey90\0" + "grey91\0" + "grey92\0" + "grey93\0" + "grey94\0" + "grey95\0" + "grey96\0" + "grey97\0" + "grey98\0" + "grey99\0" + "honeydew\0" + "honeydew1\0" + "honeydew2\0" + "honeydew3\0" + "honeydew4\0" + "hot pink\0" + "HotPink\0" + "HotPink1\0" + "HotPink2\0" + "HotPink3\0" + "HotPink4\0" + "indian red\0" + "IndianRed\0" + "IndianRed1\0" + "IndianRed2\0" + "IndianRed3\0" + "IndianRed4\0" + "ivory\0" + "ivory1\0" + "ivory2\0" + "ivory3\0" + "ivory4\0" + "khaki\0" + "khaki1\0" + "khaki2\0" + "khaki3\0" + "khaki4\0" + "lavender\0" + "lavender blush\0" + "LavenderBlush\0" + "LavenderBlush1\0" + "LavenderBlush2\0" + "LavenderBlush3\0" + "LavenderBlush4\0" + "lawn green\0" + "LawnGreen\0" + "lemon chiffon\0" + "LemonChiffon\0" + "LemonChiffon1\0" + "LemonChiffon2\0" + "LemonChiffon3\0" + "LemonChiffon4\0" + "light blue\0" + "light coral\0" + "light cyan\0" + "light goldenrod\0" + "light goldenrod yellow\0" + "light gray\0" + "light green\0" + "light grey\0" + "light pink\0" + "light salmon\0" + "light sea green\0" + "light sky blue\0" + "light slate blue\0" + "light slate gray\0" + "light slate grey\0" + "light steel blue\0" + "light yellow\0" + "LightBlue\0" + "LightBlue1\0" + "LightBlue2\0" + "LightBlue3\0" + "LightBlue4\0" + "LightCoral\0" + "LightCyan\0" + "LightCyan1\0" + "LightCyan2\0" + "LightCyan3\0" + "LightCyan4\0" + "LightGoldenrod\0" + "LightGoldenrod1\0" + "LightGoldenrod2\0" + "LightGoldenrod3\0" + "LightGoldenrod4\0" + "LightGoldenrodYellow\0" + "LightGray\0" + "LightGreen\0" + "LightGrey\0" + "LightPink\0" + "LightPink1\0" + "LightPink2\0" + "LightPink3\0" + "LightPink4\0" + "LightSalmon\0" + "LightSalmon1\0" + "LightSalmon2\0" + "LightSalmon3\0" + "LightSalmon4\0" + "LightSeaGreen\0" + "LightSkyBlue\0" + "LightSkyBlue1\0" + "LightSkyBlue2\0" + "LightSkyBlue3\0" + "LightSkyBlue4\0" + "LightSlateBlue\0" + "LightSlateGray\0" + "LightSlateGrey\0" + "LightSteelBlue\0" + "LightSteelBlue1\0" + "LightSteelBlue2\0" + "LightSteelBlue3\0" + "LightSteelBlue4\0" + "LightYellow\0" + "LightYellow1\0" + "LightYellow2\0" + "LightYellow3\0" + "LightYellow4\0" + "lime green\0" + "LimeGreen\0" + "linen\0" + "magenta\0" + "magenta1\0" + "magenta2\0" + "magenta3\0" + "magenta4\0" + "maroon\0" + "maroon1\0" + "maroon2\0" + "maroon3\0" + "maroon4\0" + "medium aquamarine\0" + "medium blue\0" + "medium orchid\0" + "medium purple\0" + "medium sea green\0" + "medium slate blue\0" + "medium spring green\0" + "medium turquoise\0" + "medium violet red\0" + "MediumAquamarine\0" + "MediumBlue\0" + "MediumOrchid\0" + "MediumOrchid1\0" + "MediumOrchid2\0" + "MediumOrchid3\0" + "MediumOrchid4\0" + "MediumPurple\0" + "MediumPurple1\0" + "MediumPurple2\0" + "MediumPurple3\0" + "MediumPurple4\0" + "MediumSeaGreen\0" + "MediumSlateBlue\0" + "MediumSpringGreen\0" + "MediumTurquoise\0" + "MediumVioletRed\0" + "midnight blue\0" + "MidnightBlue\0" + "mint cream\0" + "MintCream\0" + "misty rose\0" + "MistyRose\0" + "MistyRose1\0" + "MistyRose2\0" + "MistyRose3\0" + "MistyRose4\0" + "moccasin\0" + "navajo white\0" + "NavajoWhite\0" + "NavajoWhite1\0" + "NavajoWhite2\0" + "NavajoWhite3\0" + "NavajoWhite4\0" + "navy\0" + "navy blue\0" + "NavyBlue\0" + "old lace\0" + "OldLace\0" + "olive drab\0" + "OliveDrab\0" + "OliveDrab1\0" + "OliveDrab2\0" + "OliveDrab3\0" + "OliveDrab4\0" + "orange\0" + "orange red\0" + "orange1\0" + "orange2\0" + "orange3\0" + "orange4\0" + "OrangeRed\0" + "OrangeRed1\0" + "OrangeRed2\0" + "OrangeRed3\0" + "OrangeRed4\0" + "orchid\0" + "orchid1\0" + "orchid2\0" + "orchid3\0" + "orchid4\0" + "pale goldenrod\0" + "pale green\0" + "pale turquoise\0" + "pale violet red\0" + "PaleGoldenrod\0" + "PaleGreen\0" + "PaleGreen1\0" + "PaleGreen2\0" + "PaleGreen3\0" + "PaleGreen4\0" + "PaleTurquoise\0" + "PaleTurquoise1\0" + "PaleTurquoise2\0" + "PaleTurquoise3\0" + "PaleTurquoise4\0" + "PaleVioletRed\0" + "PaleVioletRed1\0" + "PaleVioletRed2\0" + "PaleVioletRed3\0" + "PaleVioletRed4\0" + "papaya whip\0" + "PapayaWhip\0" + "peach puff\0" + "PeachPuff\0" + "PeachPuff1\0" + "PeachPuff2\0" + "PeachPuff3\0" + "PeachPuff4\0" + "peru\0" + "pink\0" + "pink1\0" + "pink2\0" + "pink3\0" + "pink4\0" + "plum\0" + "plum1\0" + "plum2\0" + "plum3\0" + "plum4\0" + "powder blue\0" + "PowderBlue\0" + "purple\0" + "purple1\0" + "purple2\0" + "purple3\0" + "purple4\0" + "red\0" + "red1\0" + "red2\0" + "red3\0" + "red4\0" + "rosy brown\0" + "RosyBrown\0" + "RosyBrown1\0" + "RosyBrown2\0" + "RosyBrown3\0" + "RosyBrown4\0" + "royal blue\0" + "RoyalBlue\0" + "RoyalBlue1\0" + "RoyalBlue2\0" + "RoyalBlue3\0" + "RoyalBlue4\0" + "saddle brown\0" + "SaddleBrown\0" + "salmon\0" + "salmon1\0" + "salmon2\0" + "salmon3\0" + "salmon4\0" + "sandy brown\0" + "SandyBrown\0" + "sea green\0" + "SeaGreen\0" + "SeaGreen1\0" + "SeaGreen2\0" + "SeaGreen3\0" + "SeaGreen4\0" + "seashell\0" + "seashell1\0" + "seashell2\0" + "seashell3\0" + "seashell4\0" + "sienna\0" + "sienna1\0" + "sienna2\0" + "sienna3\0" + "sienna4\0" + "sky blue\0" + "SkyBlue\0" + "SkyBlue1\0" + "SkyBlue2\0" + "SkyBlue3\0" + "SkyBlue4\0" + "slate blue\0" + "slate gray\0" + "slate grey\0" + "SlateBlue\0" + "SlateBlue1\0" + "SlateBlue2\0" + "SlateBlue3\0" + "SlateBlue4\0" + "SlateGray\0" + "SlateGray1\0" + "SlateGray2\0" + "SlateGray3\0" + "SlateGray4\0" + "SlateGrey\0" + "snow\0" + "snow1\0" + "snow2\0" + "snow3\0" + "snow4\0" + "spring green\0" + "SpringGreen\0" + "SpringGreen1\0" + "SpringGreen2\0" + "SpringGreen3\0" + "SpringGreen4\0" + "steel blue\0" + "SteelBlue\0" + "SteelBlue1\0" + "SteelBlue2\0" + "SteelBlue3\0" + "SteelBlue4\0" + "tan\0" + "tan1\0" + "tan2\0" + "tan3\0" + "tan4\0" + "thistle\0" + "thistle1\0" + "thistle2\0" + "thistle3\0" + "thistle4\0" + "tomato\0" + "tomato1\0" + "tomato2\0" + "tomato3\0" + "tomato4\0" + "turquoise\0" + "turquoise1\0" + "turquoise2\0" + "turquoise3\0" + "turquoise4\0" + "violet\0" + "violet red\0" + "VioletRed\0" + "VioletRed1\0" + "VioletRed2\0" + "VioletRed3\0" + "VioletRed4\0" + "wheat\0" + "wheat1\0" + "wheat2\0" + "wheat3\0" + "wheat4\0" + "white\0" + "white smoke\0" + "WhiteSmoke\0" + "yellow\0" + "yellow green\0" + "yellow1\0" + "yellow2\0" + "yellow3\0" + "yellow4\0" + "YellowGreen\0" +}; + +static const BuiltinColor BuiltinColors[] = { + { 240, 248, 255, 0 }, /* alice blue */ + { 240, 248, 255, 11 }, /* AliceBlue */ + { 250, 235, 215, 21 }, /* antique white */ + { 250, 235, 215, 35 }, /* AntiqueWhite */ + { 255, 239, 219, 48 }, /* AntiqueWhite1 */ + { 238, 223, 204, 62 }, /* AntiqueWhite2 */ + { 205, 192, 176, 76 }, /* AntiqueWhite3 */ + { 139, 131, 120, 90 }, /* AntiqueWhite4 */ + { 127, 255, 212, 104 }, /* aquamarine */ + { 127, 255, 212, 115 }, /* aquamarine1 */ + { 118, 238, 198, 127 }, /* aquamarine2 */ + { 102, 205, 170, 139 }, /* aquamarine3 */ + { 69, 139, 116, 151 }, /* aquamarine4 */ + { 240, 255, 255, 163 }, /* azure */ + { 240, 255, 255, 169 }, /* azure1 */ + { 224, 238, 238, 176 }, /* azure2 */ + { 193, 205, 205, 183 }, /* azure3 */ + { 131, 139, 139, 190 }, /* azure4 */ + { 245, 245, 220, 197 }, /* beige */ + { 255, 228, 196, 203 }, /* bisque */ + { 255, 228, 196, 210 }, /* bisque1 */ + { 238, 213, 183, 218 }, /* bisque2 */ + { 205, 183, 158, 226 }, /* bisque3 */ + { 139, 125, 107, 234 }, /* bisque4 */ + { 0, 0, 0, 242 }, /* black */ + { 255, 235, 205, 248 }, /* blanched almond */ + { 255, 235, 205, 264 }, /* BlanchedAlmond */ + { 0, 0, 255, 279 }, /* blue */ + { 138, 43, 226, 284 }, /* blue violet */ + { 0, 0, 255, 296 }, /* blue1 */ + { 0, 0, 238, 302 }, /* blue2 */ + { 0, 0, 205, 308 }, /* blue3 */ + { 0, 0, 139, 314 }, /* blue4 */ + { 138, 43, 226, 320 }, /* BlueViolet */ + { 165, 42, 42, 331 }, /* brown */ + { 255, 64, 64, 337 }, /* brown1 */ + { 238, 59, 59, 344 }, /* brown2 */ + { 205, 51, 51, 351 }, /* brown3 */ + { 139, 35, 35, 358 }, /* brown4 */ + { 222, 184, 135, 365 }, /* burlywood */ + { 255, 211, 155, 375 }, /* burlywood1 */ + { 238, 197, 145, 386 }, /* burlywood2 */ + { 205, 170, 125, 397 }, /* burlywood3 */ + { 139, 115, 85, 408 }, /* burlywood4 */ + { 95, 158, 160, 419 }, /* cadet blue */ + { 95, 158, 160, 430 }, /* CadetBlue */ + { 152, 245, 255, 440 }, /* CadetBlue1 */ + { 142, 229, 238, 451 }, /* CadetBlue2 */ + { 122, 197, 205, 462 }, /* CadetBlue3 */ + { 83, 134, 139, 473 }, /* CadetBlue4 */ + { 127, 255, 0, 484 }, /* chartreuse */ + { 127, 255, 0, 495 }, /* chartreuse1 */ + { 118, 238, 0, 507 }, /* chartreuse2 */ + { 102, 205, 0, 519 }, /* chartreuse3 */ + { 69, 139, 0, 531 }, /* chartreuse4 */ + { 210, 105, 30, 543 }, /* chocolate */ + { 255, 127, 36, 553 }, /* chocolate1 */ + { 238, 118, 33, 564 }, /* chocolate2 */ + { 205, 102, 29, 575 }, /* chocolate3 */ + { 139, 69, 19, 586 }, /* chocolate4 */ + { 255, 127, 80, 597 }, /* coral */ + { 255, 114, 86, 603 }, /* coral1 */ + { 238, 106, 80, 610 }, /* coral2 */ + { 205, 91, 69, 617 }, /* coral3 */ + { 139, 62, 47, 624 }, /* coral4 */ + { 100, 149, 237, 631 }, /* cornflower blue */ + { 100, 149, 237, 647 }, /* CornflowerBlue */ + { 255, 248, 220, 662 }, /* cornsilk */ + { 255, 248, 220, 671 }, /* cornsilk1 */ + { 238, 232, 205, 681 }, /* cornsilk2 */ + { 205, 200, 177, 691 }, /* cornsilk3 */ + { 139, 136, 120, 701 }, /* cornsilk4 */ + { 0, 255, 255, 711 }, /* cyan */ + { 0, 255, 255, 716 }, /* cyan1 */ + { 0, 238, 238, 722 }, /* cyan2 */ + { 0, 205, 205, 728 }, /* cyan3 */ + { 0, 139, 139, 734 }, /* cyan4 */ + { 0, 0, 139, 740 }, /* dark blue */ + { 0, 139, 139, 750 }, /* dark cyan */ + { 184, 134, 11, 760 }, /* dark goldenrod */ + { 169, 169, 169, 775 }, /* dark gray */ + { 0, 100, 0, 785 }, /* dark green */ + { 169, 169, 169, 796 }, /* dark grey */ + { 189, 183, 107, 806 }, /* dark khaki */ + { 139, 0, 139, 817 }, /* dark magenta */ + { 85, 107, 47, 830 }, /* dark olive green */ + { 255, 140, 0, 847 }, /* dark orange */ + { 153, 50, 204, 859 }, /* dark orchid */ + { 139, 0, 0, 871 }, /* dark red */ + { 233, 150, 122, 880 }, /* dark salmon */ + { 143, 188, 143, 892 }, /* dark sea green */ + { 72, 61, 139, 907 }, /* dark slate blue */ + { 47, 79, 79, 923 }, /* dark slate gray */ + { 47, 79, 79, 939 }, /* dark slate grey */ + { 0, 206, 209, 955 }, /* dark turquoise */ + { 148, 0, 211, 970 }, /* dark violet */ + { 0, 0, 139, 982 }, /* DarkBlue */ + { 0, 139, 139, 991 }, /* DarkCyan */ + { 184, 134, 11, 1000 }, /* DarkGoldenrod */ + { 255, 185, 15, 1014 }, /* DarkGoldenrod1 */ + { 238, 173, 14, 1029 }, /* DarkGoldenrod2 */ + { 205, 149, 12, 1044 }, /* DarkGoldenrod3 */ + { 139, 101, 8, 1059 }, /* DarkGoldenrod4 */ + { 169, 169, 169, 1074 }, /* DarkGray */ + { 0, 100, 0, 1083 }, /* DarkGreen */ + { 169, 169, 169, 1093 }, /* DarkGrey */ + { 189, 183, 107, 1102 }, /* DarkKhaki */ + { 139, 0, 139, 1112 }, /* DarkMagenta */ + { 85, 107, 47, 1124 }, /* DarkOliveGreen */ + { 202, 255, 112, 1139 }, /* DarkOliveGreen1 */ + { 188, 238, 104, 1155 }, /* DarkOliveGreen2 */ + { 162, 205, 90, 1171 }, /* DarkOliveGreen3 */ + { 110, 139, 61, 1187 }, /* DarkOliveGreen4 */ + { 255, 140, 0, 1203 }, /* DarkOrange */ + { 255, 127, 0, 1214 }, /* DarkOrange1 */ + { 238, 118, 0, 1226 }, /* DarkOrange2 */ + { 205, 102, 0, 1238 }, /* DarkOrange3 */ + { 139, 69, 0, 1250 }, /* DarkOrange4 */ + { 153, 50, 204, 1262 }, /* DarkOrchid */ + { 191, 62, 255, 1273 }, /* DarkOrchid1 */ + { 178, 58, 238, 1285 }, /* DarkOrchid2 */ + { 154, 50, 205, 1297 }, /* DarkOrchid3 */ + { 104, 34, 139, 1309 }, /* DarkOrchid4 */ + { 139, 0, 0, 1321 }, /* DarkRed */ + { 233, 150, 122, 1329 }, /* DarkSalmon */ + { 143, 188, 143, 1340 }, /* DarkSeaGreen */ + { 193, 255, 193, 1353 }, /* DarkSeaGreen1 */ + { 180, 238, 180, 1367 }, /* DarkSeaGreen2 */ + { 155, 205, 155, 1381 }, /* DarkSeaGreen3 */ + { 105, 139, 105, 1395 }, /* DarkSeaGreen4 */ + { 72, 61, 139, 1409 }, /* DarkSlateBlue */ + { 47, 79, 79, 1423 }, /* DarkSlateGray */ + { 151, 255, 255, 1437 }, /* DarkSlateGray1 */ + { 141, 238, 238, 1452 }, /* DarkSlateGray2 */ + { 121, 205, 205, 1467 }, /* DarkSlateGray3 */ + { 82, 139, 139, 1482 }, /* DarkSlateGray4 */ + { 47, 79, 79, 1497 }, /* DarkSlateGrey */ + { 0, 206, 209, 1511 }, /* DarkTurquoise */ + { 148, 0, 211, 1525 }, /* DarkViolet */ + { 255, 20, 147, 1536 }, /* deep pink */ + { 0, 191, 255, 1546 }, /* deep sky blue */ + { 255, 20, 147, 1560 }, /* DeepPink */ + { 255, 20, 147, 1569 }, /* DeepPink1 */ + { 238, 18, 137, 1579 }, /* DeepPink2 */ + { 205, 16, 118, 1589 }, /* DeepPink3 */ + { 139, 10, 80, 1599 }, /* DeepPink4 */ + { 0, 191, 255, 1609 }, /* DeepSkyBlue */ + { 0, 191, 255, 1621 }, /* DeepSkyBlue1 */ + { 0, 178, 238, 1634 }, /* DeepSkyBlue2 */ + { 0, 154, 205, 1647 }, /* DeepSkyBlue3 */ + { 0, 104, 139, 1660 }, /* DeepSkyBlue4 */ + { 105, 105, 105, 1673 }, /* dim gray */ + { 105, 105, 105, 1682 }, /* dim grey */ + { 105, 105, 105, 1691 }, /* DimGray */ + { 105, 105, 105, 1699 }, /* DimGrey */ + { 30, 144, 255, 1707 }, /* dodger blue */ + { 30, 144, 255, 1719 }, /* DodgerBlue */ + { 30, 144, 255, 1730 }, /* DodgerBlue1 */ + { 28, 134, 238, 1742 }, /* DodgerBlue2 */ + { 24, 116, 205, 1754 }, /* DodgerBlue3 */ + { 16, 78, 139, 1766 }, /* DodgerBlue4 */ + { 178, 34, 34, 1778 }, /* firebrick */ + { 255, 48, 48, 1788 }, /* firebrick1 */ + { 238, 44, 44, 1799 }, /* firebrick2 */ + { 205, 38, 38, 1810 }, /* firebrick3 */ + { 139, 26, 26, 1821 }, /* firebrick4 */ + { 255, 250, 240, 1832 }, /* floral white */ + { 255, 250, 240, 1845 }, /* FloralWhite */ + { 34, 139, 34, 1857 }, /* forest green */ + { 34, 139, 34, 1870 }, /* ForestGreen */ + { 220, 220, 220, 1882 }, /* gainsboro */ + { 248, 248, 255, 1892 }, /* ghost white */ + { 248, 248, 255, 1904 }, /* GhostWhite */ + { 255, 215, 0, 1915 }, /* gold */ + { 255, 215, 0, 1920 }, /* gold1 */ + { 238, 201, 0, 1926 }, /* gold2 */ + { 205, 173, 0, 1932 }, /* gold3 */ + { 139, 117, 0, 1938 }, /* gold4 */ + { 218, 165, 32, 1944 }, /* goldenrod */ + { 255, 193, 37, 1954 }, /* goldenrod1 */ + { 238, 180, 34, 1965 }, /* goldenrod2 */ + { 205, 155, 29, 1976 }, /* goldenrod3 */ + { 139, 105, 20, 1987 }, /* goldenrod4 */ + { 190, 190, 190, 1998 }, /* gray */ + { 0, 0, 0, 2003 }, /* gray0 */ + { 3, 3, 3, 2009 }, /* gray1 */ + { 26, 26, 26, 2015 }, /* gray10 */ + { 255, 255, 255, 2022 }, /* gray100 */ + { 28, 28, 28, 2030 }, /* gray11 */ + { 31, 31, 31, 2037 }, /* gray12 */ + { 33, 33, 33, 2044 }, /* gray13 */ + { 36, 36, 36, 2051 }, /* gray14 */ + { 38, 38, 38, 2058 }, /* gray15 */ + { 41, 41, 41, 2065 }, /* gray16 */ + { 43, 43, 43, 2072 }, /* gray17 */ + { 46, 46, 46, 2079 }, /* gray18 */ + { 48, 48, 48, 2086 }, /* gray19 */ + { 5, 5, 5, 2093 }, /* gray2 */ + { 51, 51, 51, 2099 }, /* gray20 */ + { 54, 54, 54, 2106 }, /* gray21 */ + { 56, 56, 56, 2113 }, /* gray22 */ + { 59, 59, 59, 2120 }, /* gray23 */ + { 61, 61, 61, 2127 }, /* gray24 */ + { 64, 64, 64, 2134 }, /* gray25 */ + { 66, 66, 66, 2141 }, /* gray26 */ + { 69, 69, 69, 2148 }, /* gray27 */ + { 71, 71, 71, 2155 }, /* gray28 */ + { 74, 74, 74, 2162 }, /* gray29 */ + { 8, 8, 8, 2169 }, /* gray3 */ + { 77, 77, 77, 2175 }, /* gray30 */ + { 79, 79, 79, 2182 }, /* gray31 */ + { 82, 82, 82, 2189 }, /* gray32 */ + { 84, 84, 84, 2196 }, /* gray33 */ + { 87, 87, 87, 2203 }, /* gray34 */ + { 89, 89, 89, 2210 }, /* gray35 */ + { 92, 92, 92, 2217 }, /* gray36 */ + { 94, 94, 94, 2224 }, /* gray37 */ + { 97, 97, 97, 2231 }, /* gray38 */ + { 99, 99, 99, 2238 }, /* gray39 */ + { 10, 10, 10, 2245 }, /* gray4 */ + { 102, 102, 102, 2251 }, /* gray40 */ + { 105, 105, 105, 2258 }, /* gray41 */ + { 107, 107, 107, 2265 }, /* gray42 */ + { 110, 110, 110, 2272 }, /* gray43 */ + { 112, 112, 112, 2279 }, /* gray44 */ + { 115, 115, 115, 2286 }, /* gray45 */ + { 117, 117, 117, 2293 }, /* gray46 */ + { 120, 120, 120, 2300 }, /* gray47 */ + { 122, 122, 122, 2307 }, /* gray48 */ + { 125, 125, 125, 2314 }, /* gray49 */ + { 13, 13, 13, 2321 }, /* gray5 */ + { 127, 127, 127, 2327 }, /* gray50 */ + { 130, 130, 130, 2334 }, /* gray51 */ + { 133, 133, 133, 2341 }, /* gray52 */ + { 135, 135, 135, 2348 }, /* gray53 */ + { 138, 138, 138, 2355 }, /* gray54 */ + { 140, 140, 140, 2362 }, /* gray55 */ + { 143, 143, 143, 2369 }, /* gray56 */ + { 145, 145, 145, 2376 }, /* gray57 */ + { 148, 148, 148, 2383 }, /* gray58 */ + { 150, 150, 150, 2390 }, /* gray59 */ + { 15, 15, 15, 2397 }, /* gray6 */ + { 153, 153, 153, 2403 }, /* gray60 */ + { 156, 156, 156, 2410 }, /* gray61 */ + { 158, 158, 158, 2417 }, /* gray62 */ + { 161, 161, 161, 2424 }, /* gray63 */ + { 163, 163, 163, 2431 }, /* gray64 */ + { 166, 166, 166, 2438 }, /* gray65 */ + { 168, 168, 168, 2445 }, /* gray66 */ + { 171, 171, 171, 2452 }, /* gray67 */ + { 173, 173, 173, 2459 }, /* gray68 */ + { 176, 176, 176, 2466 }, /* gray69 */ + { 18, 18, 18, 2473 }, /* gray7 */ + { 179, 179, 179, 2479 }, /* gray70 */ + { 181, 181, 181, 2486 }, /* gray71 */ + { 184, 184, 184, 2493 }, /* gray72 */ + { 186, 186, 186, 2500 }, /* gray73 */ + { 189, 189, 189, 2507 }, /* gray74 */ + { 191, 191, 191, 2514 }, /* gray75 */ + { 194, 194, 194, 2521 }, /* gray76 */ + { 196, 196, 196, 2528 }, /* gray77 */ + { 199, 199, 199, 2535 }, /* gray78 */ + { 201, 201, 201, 2542 }, /* gray79 */ + { 20, 20, 20, 2549 }, /* gray8 */ + { 204, 204, 204, 2555 }, /* gray80 */ + { 207, 207, 207, 2562 }, /* gray81 */ + { 209, 209, 209, 2569 }, /* gray82 */ + { 212, 212, 212, 2576 }, /* gray83 */ + { 214, 214, 214, 2583 }, /* gray84 */ + { 217, 217, 217, 2590 }, /* gray85 */ + { 219, 219, 219, 2597 }, /* gray86 */ + { 222, 222, 222, 2604 }, /* gray87 */ + { 224, 224, 224, 2611 }, /* gray88 */ + { 227, 227, 227, 2618 }, /* gray89 */ + { 23, 23, 23, 2625 }, /* gray9 */ + { 229, 229, 229, 2631 }, /* gray90 */ + { 232, 232, 232, 2638 }, /* gray91 */ + { 235, 235, 235, 2645 }, /* gray92 */ + { 237, 237, 237, 2652 }, /* gray93 */ + { 240, 240, 240, 2659 }, /* gray94 */ + { 242, 242, 242, 2666 }, /* gray95 */ + { 245, 245, 245, 2673 }, /* gray96 */ + { 247, 247, 247, 2680 }, /* gray97 */ + { 250, 250, 250, 2687 }, /* gray98 */ + { 252, 252, 252, 2694 }, /* gray99 */ + { 0, 255, 0, 2701 }, /* green */ + { 173, 255, 47, 2707 }, /* green yellow */ + { 0, 255, 0, 2720 }, /* green1 */ + { 0, 238, 0, 2727 }, /* green2 */ + { 0, 205, 0, 2734 }, /* green3 */ + { 0, 139, 0, 2741 }, /* green4 */ + { 173, 255, 47, 2748 }, /* GreenYellow */ + { 190, 190, 190, 2760 }, /* grey */ + { 0, 0, 0, 2765 }, /* grey0 */ + { 3, 3, 3, 2771 }, /* grey1 */ + { 26, 26, 26, 2777 }, /* grey10 */ + { 255, 255, 255, 2784 }, /* grey100 */ + { 28, 28, 28, 2792 }, /* grey11 */ + { 31, 31, 31, 2799 }, /* grey12 */ + { 33, 33, 33, 2806 }, /* grey13 */ + { 36, 36, 36, 2813 }, /* grey14 */ + { 38, 38, 38, 2820 }, /* grey15 */ + { 41, 41, 41, 2827 }, /* grey16 */ + { 43, 43, 43, 2834 }, /* grey17 */ + { 46, 46, 46, 2841 }, /* grey18 */ + { 48, 48, 48, 2848 }, /* grey19 */ + { 5, 5, 5, 2855 }, /* grey2 */ + { 51, 51, 51, 2861 }, /* grey20 */ + { 54, 54, 54, 2868 }, /* grey21 */ + { 56, 56, 56, 2875 }, /* grey22 */ + { 59, 59, 59, 2882 }, /* grey23 */ + { 61, 61, 61, 2889 }, /* grey24 */ + { 64, 64, 64, 2896 }, /* grey25 */ + { 66, 66, 66, 2903 }, /* grey26 */ + { 69, 69, 69, 2910 }, /* grey27 */ + { 71, 71, 71, 2917 }, /* grey28 */ + { 74, 74, 74, 2924 }, /* grey29 */ + { 8, 8, 8, 2931 }, /* grey3 */ + { 77, 77, 77, 2937 }, /* grey30 */ + { 79, 79, 79, 2944 }, /* grey31 */ + { 82, 82, 82, 2951 }, /* grey32 */ + { 84, 84, 84, 2958 }, /* grey33 */ + { 87, 87, 87, 2965 }, /* grey34 */ + { 89, 89, 89, 2972 }, /* grey35 */ + { 92, 92, 92, 2979 }, /* grey36 */ + { 94, 94, 94, 2986 }, /* grey37 */ + { 97, 97, 97, 2993 }, /* grey38 */ + { 99, 99, 99, 3000 }, /* grey39 */ + { 10, 10, 10, 3007 }, /* grey4 */ + { 102, 102, 102, 3013 }, /* grey40 */ + { 105, 105, 105, 3020 }, /* grey41 */ + { 107, 107, 107, 3027 }, /* grey42 */ + { 110, 110, 110, 3034 }, /* grey43 */ + { 112, 112, 112, 3041 }, /* grey44 */ + { 115, 115, 115, 3048 }, /* grey45 */ + { 117, 117, 117, 3055 }, /* grey46 */ + { 120, 120, 120, 3062 }, /* grey47 */ + { 122, 122, 122, 3069 }, /* grey48 */ + { 125, 125, 125, 3076 }, /* grey49 */ + { 13, 13, 13, 3083 }, /* grey5 */ + { 127, 127, 127, 3089 }, /* grey50 */ + { 130, 130, 130, 3096 }, /* grey51 */ + { 133, 133, 133, 3103 }, /* grey52 */ + { 135, 135, 135, 3110 }, /* grey53 */ + { 138, 138, 138, 3117 }, /* grey54 */ + { 140, 140, 140, 3124 }, /* grey55 */ + { 143, 143, 143, 3131 }, /* grey56 */ + { 145, 145, 145, 3138 }, /* grey57 */ + { 148, 148, 148, 3145 }, /* grey58 */ + { 150, 150, 150, 3152 }, /* grey59 */ + { 15, 15, 15, 3159 }, /* grey6 */ + { 153, 153, 153, 3165 }, /* grey60 */ + { 156, 156, 156, 3172 }, /* grey61 */ + { 158, 158, 158, 3179 }, /* grey62 */ + { 161, 161, 161, 3186 }, /* grey63 */ + { 163, 163, 163, 3193 }, /* grey64 */ + { 166, 166, 166, 3200 }, /* grey65 */ + { 168, 168, 168, 3207 }, /* grey66 */ + { 171, 171, 171, 3214 }, /* grey67 */ + { 173, 173, 173, 3221 }, /* grey68 */ + { 176, 176, 176, 3228 }, /* grey69 */ + { 18, 18, 18, 3235 }, /* grey7 */ + { 179, 179, 179, 3241 }, /* grey70 */ + { 181, 181, 181, 3248 }, /* grey71 */ + { 184, 184, 184, 3255 }, /* grey72 */ + { 186, 186, 186, 3262 }, /* grey73 */ + { 189, 189, 189, 3269 }, /* grey74 */ + { 191, 191, 191, 3276 }, /* grey75 */ + { 194, 194, 194, 3283 }, /* grey76 */ + { 196, 196, 196, 3290 }, /* grey77 */ + { 199, 199, 199, 3297 }, /* grey78 */ + { 201, 201, 201, 3304 }, /* grey79 */ + { 20, 20, 20, 3311 }, /* grey8 */ + { 204, 204, 204, 3317 }, /* grey80 */ + { 207, 207, 207, 3324 }, /* grey81 */ + { 209, 209, 209, 3331 }, /* grey82 */ + { 212, 212, 212, 3338 }, /* grey83 */ + { 214, 214, 214, 3345 }, /* grey84 */ + { 217, 217, 217, 3352 }, /* grey85 */ + { 219, 219, 219, 3359 }, /* grey86 */ + { 222, 222, 222, 3366 }, /* grey87 */ + { 224, 224, 224, 3373 }, /* grey88 */ + { 227, 227, 227, 3380 }, /* grey89 */ + { 23, 23, 23, 3387 }, /* grey9 */ + { 229, 229, 229, 3393 }, /* grey90 */ + { 232, 232, 232, 3400 }, /* grey91 */ + { 235, 235, 235, 3407 }, /* grey92 */ + { 237, 237, 237, 3414 }, /* grey93 */ + { 240, 240, 240, 3421 }, /* grey94 */ + { 242, 242, 242, 3428 }, /* grey95 */ + { 245, 245, 245, 3435 }, /* grey96 */ + { 247, 247, 247, 3442 }, /* grey97 */ + { 250, 250, 250, 3449 }, /* grey98 */ + { 252, 252, 252, 3456 }, /* grey99 */ + { 240, 255, 240, 3463 }, /* honeydew */ + { 240, 255, 240, 3472 }, /* honeydew1 */ + { 224, 238, 224, 3482 }, /* honeydew2 */ + { 193, 205, 193, 3492 }, /* honeydew3 */ + { 131, 139, 131, 3502 }, /* honeydew4 */ + { 255, 105, 180, 3512 }, /* hot pink */ + { 255, 105, 180, 3521 }, /* HotPink */ + { 255, 110, 180, 3529 }, /* HotPink1 */ + { 238, 106, 167, 3538 }, /* HotPink2 */ + { 205, 96, 144, 3547 }, /* HotPink3 */ + { 139, 58, 98, 3556 }, /* HotPink4 */ + { 205, 92, 92, 3565 }, /* indian red */ + { 205, 92, 92, 3576 }, /* IndianRed */ + { 255, 106, 106, 3586 }, /* IndianRed1 */ + { 238, 99, 99, 3597 }, /* IndianRed2 */ + { 205, 85, 85, 3608 }, /* IndianRed3 */ + { 139, 58, 58, 3619 }, /* IndianRed4 */ + { 255, 255, 240, 3630 }, /* ivory */ + { 255, 255, 240, 3636 }, /* ivory1 */ + { 238, 238, 224, 3643 }, /* ivory2 */ + { 205, 205, 193, 3650 }, /* ivory3 */ + { 139, 139, 131, 3657 }, /* ivory4 */ + { 240, 230, 140, 3664 }, /* khaki */ + { 255, 246, 143, 3670 }, /* khaki1 */ + { 238, 230, 133, 3677 }, /* khaki2 */ + { 205, 198, 115, 3684 }, /* khaki3 */ + { 139, 134, 78, 3691 }, /* khaki4 */ + { 230, 230, 250, 3698 }, /* lavender */ + { 255, 240, 245, 3707 }, /* lavender blush */ + { 255, 240, 245, 3722 }, /* LavenderBlush */ + { 255, 240, 245, 3736 }, /* LavenderBlush1 */ + { 238, 224, 229, 3751 }, /* LavenderBlush2 */ + { 205, 193, 197, 3766 }, /* LavenderBlush3 */ + { 139, 131, 134, 3781 }, /* LavenderBlush4 */ + { 124, 252, 0, 3796 }, /* lawn green */ + { 124, 252, 0, 3807 }, /* LawnGreen */ + { 255, 250, 205, 3817 }, /* lemon chiffon */ + { 255, 250, 205, 3831 }, /* LemonChiffon */ + { 255, 250, 205, 3844 }, /* LemonChiffon1 */ + { 238, 233, 191, 3858 }, /* LemonChiffon2 */ + { 205, 201, 165, 3872 }, /* LemonChiffon3 */ + { 139, 137, 112, 3886 }, /* LemonChiffon4 */ + { 173, 216, 230, 3900 }, /* light blue */ + { 240, 128, 128, 3911 }, /* light coral */ + { 224, 255, 255, 3923 }, /* light cyan */ + { 238, 221, 130, 3934 }, /* light goldenrod */ + { 250, 250, 210, 3950 }, /* light goldenrod yellow */ + { 211, 211, 211, 3973 }, /* light gray */ + { 144, 238, 144, 3984 }, /* light green */ + { 211, 211, 211, 3996 }, /* light grey */ + { 255, 182, 193, 4007 }, /* light pink */ + { 255, 160, 122, 4018 }, /* light salmon */ + { 32, 178, 170, 4031 }, /* light sea green */ + { 135, 206, 250, 4047 }, /* light sky blue */ + { 132, 112, 255, 4062 }, /* light slate blue */ + { 119, 136, 153, 4079 }, /* light slate gray */ + { 119, 136, 153, 4096 }, /* light slate grey */ + { 176, 196, 222, 4113 }, /* light steel blue */ + { 255, 255, 224, 4130 }, /* light yellow */ + { 173, 216, 230, 4143 }, /* LightBlue */ + { 191, 239, 255, 4153 }, /* LightBlue1 */ + { 178, 223, 238, 4164 }, /* LightBlue2 */ + { 154, 192, 205, 4175 }, /* LightBlue3 */ + { 104, 131, 139, 4186 }, /* LightBlue4 */ + { 240, 128, 128, 4197 }, /* LightCoral */ + { 224, 255, 255, 4208 }, /* LightCyan */ + { 224, 255, 255, 4218 }, /* LightCyan1 */ + { 209, 238, 238, 4229 }, /* LightCyan2 */ + { 180, 205, 205, 4240 }, /* LightCyan3 */ + { 122, 139, 139, 4251 }, /* LightCyan4 */ + { 238, 221, 130, 4262 }, /* LightGoldenrod */ + { 255, 236, 139, 4277 }, /* LightGoldenrod1 */ + { 238, 220, 130, 4293 }, /* LightGoldenrod2 */ + { 205, 190, 112, 4309 }, /* LightGoldenrod3 */ + { 139, 129, 76, 4325 }, /* LightGoldenrod4 */ + { 250, 250, 210, 4341 }, /* LightGoldenrodYellow */ + { 211, 211, 211, 4362 }, /* LightGray */ + { 144, 238, 144, 4372 }, /* LightGreen */ + { 211, 211, 211, 4383 }, /* LightGrey */ + { 255, 182, 193, 4393 }, /* LightPink */ + { 255, 174, 185, 4403 }, /* LightPink1 */ + { 238, 162, 173, 4414 }, /* LightPink2 */ + { 205, 140, 149, 4425 }, /* LightPink3 */ + { 139, 95, 101, 4436 }, /* LightPink4 */ + { 255, 160, 122, 4447 }, /* LightSalmon */ + { 255, 160, 122, 4459 }, /* LightSalmon1 */ + { 238, 149, 114, 4472 }, /* LightSalmon2 */ + { 205, 129, 98, 4485 }, /* LightSalmon3 */ + { 139, 87, 66, 4498 }, /* LightSalmon4 */ + { 32, 178, 170, 4511 }, /* LightSeaGreen */ + { 135, 206, 250, 4525 }, /* LightSkyBlue */ + { 176, 226, 255, 4538 }, /* LightSkyBlue1 */ + { 164, 211, 238, 4552 }, /* LightSkyBlue2 */ + { 141, 182, 205, 4566 }, /* LightSkyBlue3 */ + { 96, 123, 139, 4580 }, /* LightSkyBlue4 */ + { 132, 112, 255, 4594 }, /* LightSlateBlue */ + { 119, 136, 153, 4609 }, /* LightSlateGray */ + { 119, 136, 153, 4624 }, /* LightSlateGrey */ + { 176, 196, 222, 4639 }, /* LightSteelBlue */ + { 202, 225, 255, 4654 }, /* LightSteelBlue1 */ + { 188, 210, 238, 4670 }, /* LightSteelBlue2 */ + { 162, 181, 205, 4686 }, /* LightSteelBlue3 */ + { 110, 123, 139, 4702 }, /* LightSteelBlue4 */ + { 255, 255, 224, 4718 }, /* LightYellow */ + { 255, 255, 224, 4730 }, /* LightYellow1 */ + { 238, 238, 209, 4743 }, /* LightYellow2 */ + { 205, 205, 180, 4756 }, /* LightYellow3 */ + { 139, 139, 122, 4769 }, /* LightYellow4 */ + { 50, 205, 50, 4782 }, /* lime green */ + { 50, 205, 50, 4793 }, /* LimeGreen */ + { 250, 240, 230, 4803 }, /* linen */ + { 255, 0, 255, 4809 }, /* magenta */ + { 255, 0, 255, 4817 }, /* magenta1 */ + { 238, 0, 238, 4826 }, /* magenta2 */ + { 205, 0, 205, 4835 }, /* magenta3 */ + { 139, 0, 139, 4844 }, /* magenta4 */ + { 176, 48, 96, 4853 }, /* maroon */ + { 255, 52, 179, 4860 }, /* maroon1 */ + { 238, 48, 167, 4868 }, /* maroon2 */ + { 205, 41, 144, 4876 }, /* maroon3 */ + { 139, 28, 98, 4884 }, /* maroon4 */ + { 102, 205, 170, 4892 }, /* medium aquamarine */ + { 0, 0, 205, 4910 }, /* medium blue */ + { 186, 85, 211, 4922 }, /* medium orchid */ + { 147, 112, 219, 4936 }, /* medium purple */ + { 60, 179, 113, 4950 }, /* medium sea green */ + { 123, 104, 238, 4967 }, /* medium slate blue */ + { 0, 250, 154, 4985 }, /* medium spring green */ + { 72, 209, 204, 5005 }, /* medium turquoise */ + { 199, 21, 133, 5022 }, /* medium violet red */ + { 102, 205, 170, 5040 }, /* MediumAquamarine */ + { 0, 0, 205, 5057 }, /* MediumBlue */ + { 186, 85, 211, 5068 }, /* MediumOrchid */ + { 224, 102, 255, 5081 }, /* MediumOrchid1 */ + { 209, 95, 238, 5095 }, /* MediumOrchid2 */ + { 180, 82, 205, 5109 }, /* MediumOrchid3 */ + { 122, 55, 139, 5123 }, /* MediumOrchid4 */ + { 147, 112, 219, 5137 }, /* MediumPurple */ + { 171, 130, 255, 5150 }, /* MediumPurple1 */ + { 159, 121, 238, 5164 }, /* MediumPurple2 */ + { 137, 104, 205, 5178 }, /* MediumPurple3 */ + { 93, 71, 139, 5192 }, /* MediumPurple4 */ + { 60, 179, 113, 5206 }, /* MediumSeaGreen */ + { 123, 104, 238, 5221 }, /* MediumSlateBlue */ + { 0, 250, 154, 5237 }, /* MediumSpringGreen */ + { 72, 209, 204, 5255 }, /* MediumTurquoise */ + { 199, 21, 133, 5271 }, /* MediumVioletRed */ + { 25, 25, 112, 5287 }, /* midnight blue */ + { 25, 25, 112, 5301 }, /* MidnightBlue */ + { 245, 255, 250, 5314 }, /* mint cream */ + { 245, 255, 250, 5325 }, /* MintCream */ + { 255, 228, 225, 5335 }, /* misty rose */ + { 255, 228, 225, 5346 }, /* MistyRose */ + { 255, 228, 225, 5356 }, /* MistyRose1 */ + { 238, 213, 210, 5367 }, /* MistyRose2 */ + { 205, 183, 181, 5378 }, /* MistyRose3 */ + { 139, 125, 123, 5389 }, /* MistyRose4 */ + { 255, 228, 181, 5400 }, /* moccasin */ + { 255, 222, 173, 5409 }, /* navajo white */ + { 255, 222, 173, 5422 }, /* NavajoWhite */ + { 255, 222, 173, 5434 }, /* NavajoWhite1 */ + { 238, 207, 161, 5447 }, /* NavajoWhite2 */ + { 205, 179, 139, 5460 }, /* NavajoWhite3 */ + { 139, 121, 94, 5473 }, /* NavajoWhite4 */ + { 0, 0, 128, 5486 }, /* navy */ + { 0, 0, 128, 5491 }, /* navy blue */ + { 0, 0, 128, 5501 }, /* NavyBlue */ + { 253, 245, 230, 5510 }, /* old lace */ + { 253, 245, 230, 5519 }, /* OldLace */ + { 107, 142, 35, 5527 }, /* olive drab */ + { 107, 142, 35, 5538 }, /* OliveDrab */ + { 192, 255, 62, 5548 }, /* OliveDrab1 */ + { 179, 238, 58, 5559 }, /* OliveDrab2 */ + { 154, 205, 50, 5570 }, /* OliveDrab3 */ + { 105, 139, 34, 5581 }, /* OliveDrab4 */ + { 255, 165, 0, 5592 }, /* orange */ + { 255, 69, 0, 5599 }, /* orange red */ + { 255, 165, 0, 5610 }, /* orange1 */ + { 238, 154, 0, 5618 }, /* orange2 */ + { 205, 133, 0, 5626 }, /* orange3 */ + { 139, 90, 0, 5634 }, /* orange4 */ + { 255, 69, 0, 5642 }, /* OrangeRed */ + { 255, 69, 0, 5652 }, /* OrangeRed1 */ + { 238, 64, 0, 5663 }, /* OrangeRed2 */ + { 205, 55, 0, 5674 }, /* OrangeRed3 */ + { 139, 37, 0, 5685 }, /* OrangeRed4 */ + { 218, 112, 214, 5696 }, /* orchid */ + { 255, 131, 250, 5703 }, /* orchid1 */ + { 238, 122, 233, 5711 }, /* orchid2 */ + { 205, 105, 201, 5719 }, /* orchid3 */ + { 139, 71, 137, 5727 }, /* orchid4 */ + { 238, 232, 170, 5735 }, /* pale goldenrod */ + { 152, 251, 152, 5750 }, /* pale green */ + { 175, 238, 238, 5761 }, /* pale turquoise */ + { 219, 112, 147, 5776 }, /* pale violet red */ + { 238, 232, 170, 5792 }, /* PaleGoldenrod */ + { 152, 251, 152, 5806 }, /* PaleGreen */ + { 154, 255, 154, 5816 }, /* PaleGreen1 */ + { 144, 238, 144, 5827 }, /* PaleGreen2 */ + { 124, 205, 124, 5838 }, /* PaleGreen3 */ + { 84, 139, 84, 5849 }, /* PaleGreen4 */ + { 175, 238, 238, 5860 }, /* PaleTurquoise */ + { 187, 255, 255, 5874 }, /* PaleTurquoise1 */ + { 174, 238, 238, 5889 }, /* PaleTurquoise2 */ + { 150, 205, 205, 5904 }, /* PaleTurquoise3 */ + { 102, 139, 139, 5919 }, /* PaleTurquoise4 */ + { 219, 112, 147, 5934 }, /* PaleVioletRed */ + { 255, 130, 171, 5948 }, /* PaleVioletRed1 */ + { 238, 121, 159, 5963 }, /* PaleVioletRed2 */ + { 205, 104, 137, 5978 }, /* PaleVioletRed3 */ + { 139, 71, 93, 5993 }, /* PaleVioletRed4 */ + { 255, 239, 213, 6008 }, /* papaya whip */ + { 255, 239, 213, 6020 }, /* PapayaWhip */ + { 255, 218, 185, 6031 }, /* peach puff */ + { 255, 218, 185, 6042 }, /* PeachPuff */ + { 255, 218, 185, 6052 }, /* PeachPuff1 */ + { 238, 203, 173, 6063 }, /* PeachPuff2 */ + { 205, 175, 149, 6074 }, /* PeachPuff3 */ + { 139, 119, 101, 6085 }, /* PeachPuff4 */ + { 205, 133, 63, 6096 }, /* peru */ + { 255, 192, 203, 6101 }, /* pink */ + { 255, 181, 197, 6106 }, /* pink1 */ + { 238, 169, 184, 6112 }, /* pink2 */ + { 205, 145, 158, 6118 }, /* pink3 */ + { 139, 99, 108, 6124 }, /* pink4 */ + { 221, 160, 221, 6130 }, /* plum */ + { 255, 187, 255, 6135 }, /* plum1 */ + { 238, 174, 238, 6141 }, /* plum2 */ + { 205, 150, 205, 6147 }, /* plum3 */ + { 139, 102, 139, 6153 }, /* plum4 */ + { 176, 224, 230, 6159 }, /* powder blue */ + { 176, 224, 230, 6171 }, /* PowderBlue */ + { 160, 32, 240, 6182 }, /* purple */ + { 155, 48, 255, 6189 }, /* purple1 */ + { 145, 44, 238, 6197 }, /* purple2 */ + { 125, 38, 205, 6205 }, /* purple3 */ + { 85, 26, 139, 6213 }, /* purple4 */ + { 255, 0, 0, 6221 }, /* red */ + { 255, 0, 0, 6225 }, /* red1 */ + { 238, 0, 0, 6230 }, /* red2 */ + { 205, 0, 0, 6235 }, /* red3 */ + { 139, 0, 0, 6240 }, /* red4 */ + { 188, 143, 143, 6245 }, /* rosy brown */ + { 188, 143, 143, 6256 }, /* RosyBrown */ + { 255, 193, 193, 6266 }, /* RosyBrown1 */ + { 238, 180, 180, 6277 }, /* RosyBrown2 */ + { 205, 155, 155, 6288 }, /* RosyBrown3 */ + { 139, 105, 105, 6299 }, /* RosyBrown4 */ + { 65, 105, 225, 6310 }, /* royal blue */ + { 65, 105, 225, 6321 }, /* RoyalBlue */ + { 72, 118, 255, 6331 }, /* RoyalBlue1 */ + { 67, 110, 238, 6342 }, /* RoyalBlue2 */ + { 58, 95, 205, 6353 }, /* RoyalBlue3 */ + { 39, 64, 139, 6364 }, /* RoyalBlue4 */ + { 139, 69, 19, 6375 }, /* saddle brown */ + { 139, 69, 19, 6388 }, /* SaddleBrown */ + { 250, 128, 114, 6400 }, /* salmon */ + { 255, 140, 105, 6407 }, /* salmon1 */ + { 238, 130, 98, 6415 }, /* salmon2 */ + { 205, 112, 84, 6423 }, /* salmon3 */ + { 139, 76, 57, 6431 }, /* salmon4 */ + { 244, 164, 96, 6439 }, /* sandy brown */ + { 244, 164, 96, 6451 }, /* SandyBrown */ + { 46, 139, 87, 6462 }, /* sea green */ + { 46, 139, 87, 6472 }, /* SeaGreen */ + { 84, 255, 159, 6481 }, /* SeaGreen1 */ + { 78, 238, 148, 6491 }, /* SeaGreen2 */ + { 67, 205, 128, 6501 }, /* SeaGreen3 */ + { 46, 139, 87, 6511 }, /* SeaGreen4 */ + { 255, 245, 238, 6521 }, /* seashell */ + { 255, 245, 238, 6530 }, /* seashell1 */ + { 238, 229, 222, 6540 }, /* seashell2 */ + { 205, 197, 191, 6550 }, /* seashell3 */ + { 139, 134, 130, 6560 }, /* seashell4 */ + { 160, 82, 45, 6570 }, /* sienna */ + { 255, 130, 71, 6577 }, /* sienna1 */ + { 238, 121, 66, 6585 }, /* sienna2 */ + { 205, 104, 57, 6593 }, /* sienna3 */ + { 139, 71, 38, 6601 }, /* sienna4 */ + { 135, 206, 235, 6609 }, /* sky blue */ + { 135, 206, 235, 6618 }, /* SkyBlue */ + { 135, 206, 255, 6626 }, /* SkyBlue1 */ + { 126, 192, 238, 6635 }, /* SkyBlue2 */ + { 108, 166, 205, 6644 }, /* SkyBlue3 */ + { 74, 112, 139, 6653 }, /* SkyBlue4 */ + { 106, 90, 205, 6662 }, /* slate blue */ + { 112, 128, 144, 6673 }, /* slate gray */ + { 112, 128, 144, 6684 }, /* slate grey */ + { 106, 90, 205, 6695 }, /* SlateBlue */ + { 131, 111, 255, 6705 }, /* SlateBlue1 */ + { 122, 103, 238, 6716 }, /* SlateBlue2 */ + { 105, 89, 205, 6727 }, /* SlateBlue3 */ + { 71, 60, 139, 6738 }, /* SlateBlue4 */ + { 112, 128, 144, 6749 }, /* SlateGray */ + { 198, 226, 255, 6759 }, /* SlateGray1 */ + { 185, 211, 238, 6770 }, /* SlateGray2 */ + { 159, 182, 205, 6781 }, /* SlateGray3 */ + { 108, 123, 139, 6792 }, /* SlateGray4 */ + { 112, 128, 144, 6803 }, /* SlateGrey */ + { 255, 250, 250, 6813 }, /* snow */ + { 255, 250, 250, 6818 }, /* snow1 */ + { 238, 233, 233, 6824 }, /* snow2 */ + { 205, 201, 201, 6830 }, /* snow3 */ + { 139, 137, 137, 6836 }, /* snow4 */ + { 0, 255, 127, 6842 }, /* spring green */ + { 0, 255, 127, 6855 }, /* SpringGreen */ + { 0, 255, 127, 6867 }, /* SpringGreen1 */ + { 0, 238, 118, 6880 }, /* SpringGreen2 */ + { 0, 205, 102, 6893 }, /* SpringGreen3 */ + { 0, 139, 69, 6906 }, /* SpringGreen4 */ + { 70, 130, 180, 6919 }, /* steel blue */ + { 70, 130, 180, 6930 }, /* SteelBlue */ + { 99, 184, 255, 6940 }, /* SteelBlue1 */ + { 92, 172, 238, 6951 }, /* SteelBlue2 */ + { 79, 148, 205, 6962 }, /* SteelBlue3 */ + { 54, 100, 139, 6973 }, /* SteelBlue4 */ + { 210, 180, 140, 6984 }, /* tan */ + { 255, 165, 79, 6988 }, /* tan1 */ + { 238, 154, 73, 6993 }, /* tan2 */ + { 205, 133, 63, 6998 }, /* tan3 */ + { 139, 90, 43, 7003 }, /* tan4 */ + { 216, 191, 216, 7008 }, /* thistle */ + { 255, 225, 255, 7016 }, /* thistle1 */ + { 238, 210, 238, 7025 }, /* thistle2 */ + { 205, 181, 205, 7034 }, /* thistle3 */ + { 139, 123, 139, 7043 }, /* thistle4 */ + { 255, 99, 71, 7052 }, /* tomato */ + { 255, 99, 71, 7059 }, /* tomato1 */ + { 238, 92, 66, 7067 }, /* tomato2 */ + { 205, 79, 57, 7075 }, /* tomato3 */ + { 139, 54, 38, 7083 }, /* tomato4 */ + { 64, 224, 208, 7091 }, /* turquoise */ + { 0, 245, 255, 7101 }, /* turquoise1 */ + { 0, 229, 238, 7112 }, /* turquoise2 */ + { 0, 197, 205, 7123 }, /* turquoise3 */ + { 0, 134, 139, 7134 }, /* turquoise4 */ + { 238, 130, 238, 7145 }, /* violet */ + { 208, 32, 144, 7152 }, /* violet red */ + { 208, 32, 144, 7163 }, /* VioletRed */ + { 255, 62, 150, 7173 }, /* VioletRed1 */ + { 238, 58, 140, 7184 }, /* VioletRed2 */ + { 205, 50, 120, 7195 }, /* VioletRed3 */ + { 139, 34, 82, 7206 }, /* VioletRed4 */ + { 245, 222, 179, 7217 }, /* wheat */ + { 255, 231, 186, 7223 }, /* wheat1 */ + { 238, 216, 174, 7230 }, /* wheat2 */ + { 205, 186, 150, 7237 }, /* wheat3 */ + { 139, 126, 102, 7244 }, /* wheat4 */ + { 255, 255, 255, 7251 }, /* white */ + { 245, 245, 245, 7257 }, /* white smoke */ + { 245, 245, 245, 7269 }, /* WhiteSmoke */ + { 255, 255, 0, 7280 }, /* yellow */ + { 154, 205, 50, 7287 }, /* yellow green */ + { 255, 255, 0, 7300 }, /* yellow1 */ + { 238, 238, 0, 7308 }, /* yellow2 */ + { 205, 205, 0, 7316 }, /* yellow3 */ + { 139, 139, 0, 7324 }, /* yellow4 */ + { 154, 205, 50, 7332 }, /* YellowGreen */ +}; + #define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0])) -static unsigned char -OsToLower (unsigned char a) -{ - if ((a >= XK_A) && (a <= XK_Z)) - return a + (XK_a - XK_A); - else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis)) - return a + (XK_agrave - XK_Agrave); - else if ((a >= XK_Ooblique) && (a <= XK_Thorn)) - return a + (XK_oslash - XK_Ooblique); - else - return a; -} - -static int -OsStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2) -{ - unsigned char c1, c2; - - for (;;) - { - c1 = OsToLower (*s1++); - if (l2 == 0) - c2 = '\0'; - else - c2 = OsToLower (*s2++); - if (!c1 || !c2) - break; - if (c1 != c2) - break; - l2--; - } - return c2 - c1; -} - Bool -OsInitColors(void) -{ - return TRUE; -} - -Bool -OsLookupColor(int screen, - char *s_name, - unsigned int len, +OsLookupColor(int screen, + char *name, + unsigned int len, unsigned short *pred, unsigned short *pgreen, unsigned short *pblue) { const BuiltinColor *c; - unsigned char *name = (unsigned char *) s_name; int low, mid, high; int r; @@ -122,7 +1589,7 @@ OsLookupColor(int screen, { mid = (low + high) / 2; c = &BuiltinColors[mid]; - r = OsStrCaseCmp (&BuiltinColorNames[c->name], name, len); + r = strncasecmp (&BuiltinColorNames[c->name], name, len); if (r == 0) { *pred = c->red * 0x101; @@ -130,7 +1597,7 @@ OsLookupColor(int screen, *pblue = c->blue * 0x101; return TRUE; } - if (r < 0) + if (r > 0) high = mid - 1; else low = mid + 1; diff --git a/os/oscolor.h b/os/oscolor.h deleted file mode 100644 index 3d0a76222..000000000 --- a/os/oscolor.h +++ /dev/null @@ -1,1508 +0,0 @@ -static const unsigned char BuiltinColorNames[] = { - "alice blue\0" - "AliceBlue\0" - "antique white\0" - "AntiqueWhite\0" - "AntiqueWhite1\0" - "AntiqueWhite2\0" - "AntiqueWhite3\0" - "AntiqueWhite4\0" - "aquamarine\0" - "aquamarine1\0" - "aquamarine2\0" - "aquamarine3\0" - "aquamarine4\0" - "azure\0" - "azure1\0" - "azure2\0" - "azure3\0" - "azure4\0" - "beige\0" - "bisque\0" - "bisque1\0" - "bisque2\0" - "bisque3\0" - "bisque4\0" - "black\0" - "blanched almond\0" - "BlanchedAlmond\0" - "blue\0" - "blue violet\0" - "blue1\0" - "blue2\0" - "blue3\0" - "blue4\0" - "BlueViolet\0" - "brown\0" - "brown1\0" - "brown2\0" - "brown3\0" - "brown4\0" - "burlywood\0" - "burlywood1\0" - "burlywood2\0" - "burlywood3\0" - "burlywood4\0" - "cadet blue\0" - "CadetBlue\0" - "CadetBlue1\0" - "CadetBlue2\0" - "CadetBlue3\0" - "CadetBlue4\0" - "chartreuse\0" - "chartreuse1\0" - "chartreuse2\0" - "chartreuse3\0" - "chartreuse4\0" - "chocolate\0" - "chocolate1\0" - "chocolate2\0" - "chocolate3\0" - "chocolate4\0" - "coral\0" - "coral1\0" - "coral2\0" - "coral3\0" - "coral4\0" - "cornflower blue\0" - "CornflowerBlue\0" - "cornsilk\0" - "cornsilk1\0" - "cornsilk2\0" - "cornsilk3\0" - "cornsilk4\0" - "cyan\0" - "cyan1\0" - "cyan2\0" - "cyan3\0" - "cyan4\0" - "dark blue\0" - "dark cyan\0" - "dark goldenrod\0" - "dark gray\0" - "dark green\0" - "dark grey\0" - "dark khaki\0" - "dark magenta\0" - "dark olive green\0" - "dark orange\0" - "dark orchid\0" - "dark red\0" - "dark salmon\0" - "dark sea green\0" - "dark slate blue\0" - "dark slate gray\0" - "dark slate grey\0" - "dark turquoise\0" - "dark violet\0" - "DarkBlue\0" - "DarkCyan\0" - "DarkGoldenrod\0" - "DarkGoldenrod1\0" - "DarkGoldenrod2\0" - "DarkGoldenrod3\0" - "DarkGoldenrod4\0" - "DarkGray\0" - "DarkGreen\0" - "DarkGrey\0" - "DarkKhaki\0" - "DarkMagenta\0" - "DarkOliveGreen\0" - "DarkOliveGreen1\0" - "DarkOliveGreen2\0" - "DarkOliveGreen3\0" - "DarkOliveGreen4\0" - "DarkOrange\0" - "DarkOrange1\0" - "DarkOrange2\0" - "DarkOrange3\0" - "DarkOrange4\0" - "DarkOrchid\0" - "DarkOrchid1\0" - "DarkOrchid2\0" - "DarkOrchid3\0" - "DarkOrchid4\0" - "DarkRed\0" - "DarkSalmon\0" - "DarkSeaGreen\0" - "DarkSeaGreen1\0" - "DarkSeaGreen2\0" - "DarkSeaGreen3\0" - "DarkSeaGreen4\0" - "DarkSlateBlue\0" - "DarkSlateGray\0" - "DarkSlateGray1\0" - "DarkSlateGray2\0" - "DarkSlateGray3\0" - "DarkSlateGray4\0" - "DarkSlateGrey\0" - "DarkTurquoise\0" - "DarkViolet\0" - "deep pink\0" - "deep sky blue\0" - "DeepPink\0" - "DeepPink1\0" - "DeepPink2\0" - "DeepPink3\0" - "DeepPink4\0" - "DeepSkyBlue\0" - "DeepSkyBlue1\0" - "DeepSkyBlue2\0" - "DeepSkyBlue3\0" - "DeepSkyBlue4\0" - "dim gray\0" - "dim grey\0" - "DimGray\0" - "DimGrey\0" - "dodger blue\0" - "DodgerBlue\0" - "DodgerBlue1\0" - "DodgerBlue2\0" - "DodgerBlue3\0" - "DodgerBlue4\0" - "firebrick\0" - "firebrick1\0" - "firebrick2\0" - "firebrick3\0" - "firebrick4\0" - "floral white\0" - "FloralWhite\0" - "forest green\0" - "ForestGreen\0" - "gainsboro\0" - "ghost white\0" - "GhostWhite\0" - "gold\0" - "gold1\0" - "gold2\0" - "gold3\0" - "gold4\0" - "goldenrod\0" - "goldenrod1\0" - "goldenrod2\0" - "goldenrod3\0" - "goldenrod4\0" - "gray\0" - "gray0\0" - "gray1\0" - "gray10\0" - "gray100\0" - "gray11\0" - "gray12\0" - "gray13\0" - "gray14\0" - "gray15\0" - "gray16\0" - "gray17\0" - "gray18\0" - "gray19\0" - "gray2\0" - "gray20\0" - "gray21\0" - "gray22\0" - "gray23\0" - "gray24\0" - "gray25\0" - "gray26\0" - "gray27\0" - "gray28\0" - "gray29\0" - "gray3\0" - "gray30\0" - "gray31\0" - "gray32\0" - "gray33\0" - "gray34\0" - "gray35\0" - "gray36\0" - "gray37\0" - "gray38\0" - "gray39\0" - "gray4\0" - "gray40\0" - "gray41\0" - "gray42\0" - "gray43\0" - "gray44\0" - "gray45\0" - "gray46\0" - "gray47\0" - "gray48\0" - "gray49\0" - "gray5\0" - "gray50\0" - "gray51\0" - "gray52\0" - "gray53\0" - "gray54\0" - "gray55\0" - "gray56\0" - "gray57\0" - "gray58\0" - "gray59\0" - "gray6\0" - "gray60\0" - "gray61\0" - "gray62\0" - "gray63\0" - "gray64\0" - "gray65\0" - "gray66\0" - "gray67\0" - "gray68\0" - "gray69\0" - "gray7\0" - "gray70\0" - "gray71\0" - "gray72\0" - "gray73\0" - "gray74\0" - "gray75\0" - "gray76\0" - "gray77\0" - "gray78\0" - "gray79\0" - "gray8\0" - "gray80\0" - "gray81\0" - "gray82\0" - "gray83\0" - "gray84\0" - "gray85\0" - "gray86\0" - "gray87\0" - "gray88\0" - "gray89\0" - "gray9\0" - "gray90\0" - "gray91\0" - "gray92\0" - "gray93\0" - "gray94\0" - "gray95\0" - "gray96\0" - "gray97\0" - "gray98\0" - "gray99\0" - "green\0" - "green yellow\0" - "green1\0" - "green2\0" - "green3\0" - "green4\0" - "GreenYellow\0" - "grey\0" - "grey0\0" - "grey1\0" - "grey10\0" - "grey100\0" - "grey11\0" - "grey12\0" - "grey13\0" - "grey14\0" - "grey15\0" - "grey16\0" - "grey17\0" - "grey18\0" - "grey19\0" - "grey2\0" - "grey20\0" - "grey21\0" - "grey22\0" - "grey23\0" - "grey24\0" - "grey25\0" - "grey26\0" - "grey27\0" - "grey28\0" - "grey29\0" - "grey3\0" - "grey30\0" - "grey31\0" - "grey32\0" - "grey33\0" - "grey34\0" - "grey35\0" - "grey36\0" - "grey37\0" - "grey38\0" - "grey39\0" - "grey4\0" - "grey40\0" - "grey41\0" - "grey42\0" - "grey43\0" - "grey44\0" - "grey45\0" - "grey46\0" - "grey47\0" - "grey48\0" - "grey49\0" - "grey5\0" - "grey50\0" - "grey51\0" - "grey52\0" - "grey53\0" - "grey54\0" - "grey55\0" - "grey56\0" - "grey57\0" - "grey58\0" - "grey59\0" - "grey6\0" - "grey60\0" - "grey61\0" - "grey62\0" - "grey63\0" - "grey64\0" - "grey65\0" - "grey66\0" - "grey67\0" - "grey68\0" - "grey69\0" - "grey7\0" - "grey70\0" - "grey71\0" - "grey72\0" - "grey73\0" - "grey74\0" - "grey75\0" - "grey76\0" - "grey77\0" - "grey78\0" - "grey79\0" - "grey8\0" - "grey80\0" - "grey81\0" - "grey82\0" - "grey83\0" - "grey84\0" - "grey85\0" - "grey86\0" - "grey87\0" - "grey88\0" - "grey89\0" - "grey9\0" - "grey90\0" - "grey91\0" - "grey92\0" - "grey93\0" - "grey94\0" - "grey95\0" - "grey96\0" - "grey97\0" - "grey98\0" - "grey99\0" - "honeydew\0" - "honeydew1\0" - "honeydew2\0" - "honeydew3\0" - "honeydew4\0" - "hot pink\0" - "HotPink\0" - "HotPink1\0" - "HotPink2\0" - "HotPink3\0" - "HotPink4\0" - "indian red\0" - "IndianRed\0" - "IndianRed1\0" - "IndianRed2\0" - "IndianRed3\0" - "IndianRed4\0" - "ivory\0" - "ivory1\0" - "ivory2\0" - "ivory3\0" - "ivory4\0" - "khaki\0" - "khaki1\0" - "khaki2\0" - "khaki3\0" - "khaki4\0" - "lavender\0" - "lavender blush\0" - "LavenderBlush\0" - "LavenderBlush1\0" - "LavenderBlush2\0" - "LavenderBlush3\0" - "LavenderBlush4\0" - "lawn green\0" - "LawnGreen\0" - "lemon chiffon\0" - "LemonChiffon\0" - "LemonChiffon1\0" - "LemonChiffon2\0" - "LemonChiffon3\0" - "LemonChiffon4\0" - "light blue\0" - "light coral\0" - "light cyan\0" - "light goldenrod\0" - "light goldenrod yellow\0" - "light gray\0" - "light green\0" - "light grey\0" - "light pink\0" - "light salmon\0" - "light sea green\0" - "light sky blue\0" - "light slate blue\0" - "light slate gray\0" - "light slate grey\0" - "light steel blue\0" - "light yellow\0" - "LightBlue\0" - "LightBlue1\0" - "LightBlue2\0" - "LightBlue3\0" - "LightBlue4\0" - "LightCoral\0" - "LightCyan\0" - "LightCyan1\0" - "LightCyan2\0" - "LightCyan3\0" - "LightCyan4\0" - "LightGoldenrod\0" - "LightGoldenrod1\0" - "LightGoldenrod2\0" - "LightGoldenrod3\0" - "LightGoldenrod4\0" - "LightGoldenrodYellow\0" - "LightGray\0" - "LightGreen\0" - "LightGrey\0" - "LightPink\0" - "LightPink1\0" - "LightPink2\0" - "LightPink3\0" - "LightPink4\0" - "LightSalmon\0" - "LightSalmon1\0" - "LightSalmon2\0" - "LightSalmon3\0" - "LightSalmon4\0" - "LightSeaGreen\0" - "LightSkyBlue\0" - "LightSkyBlue1\0" - "LightSkyBlue2\0" - "LightSkyBlue3\0" - "LightSkyBlue4\0" - "LightSlateBlue\0" - "LightSlateGray\0" - "LightSlateGrey\0" - "LightSteelBlue\0" - "LightSteelBlue1\0" - "LightSteelBlue2\0" - "LightSteelBlue3\0" - "LightSteelBlue4\0" - "LightYellow\0" - "LightYellow1\0" - "LightYellow2\0" - "LightYellow3\0" - "LightYellow4\0" - "lime green\0" - "LimeGreen\0" - "linen\0" - "magenta\0" - "magenta1\0" - "magenta2\0" - "magenta3\0" - "magenta4\0" - "maroon\0" - "maroon1\0" - "maroon2\0" - "maroon3\0" - "maroon4\0" - "medium aquamarine\0" - "medium blue\0" - "medium orchid\0" - "medium purple\0" - "medium sea green\0" - "medium slate blue\0" - "medium spring green\0" - "medium turquoise\0" - "medium violet red\0" - "MediumAquamarine\0" - "MediumBlue\0" - "MediumOrchid\0" - "MediumOrchid1\0" - "MediumOrchid2\0" - "MediumOrchid3\0" - "MediumOrchid4\0" - "MediumPurple\0" - "MediumPurple1\0" - "MediumPurple2\0" - "MediumPurple3\0" - "MediumPurple4\0" - "MediumSeaGreen\0" - "MediumSlateBlue\0" - "MediumSpringGreen\0" - "MediumTurquoise\0" - "MediumVioletRed\0" - "midnight blue\0" - "MidnightBlue\0" - "mint cream\0" - "MintCream\0" - "misty rose\0" - "MistyRose\0" - "MistyRose1\0" - "MistyRose2\0" - "MistyRose3\0" - "MistyRose4\0" - "moccasin\0" - "navajo white\0" - "NavajoWhite\0" - "NavajoWhite1\0" - "NavajoWhite2\0" - "NavajoWhite3\0" - "NavajoWhite4\0" - "navy\0" - "navy blue\0" - "NavyBlue\0" - "old lace\0" - "OldLace\0" - "olive drab\0" - "OliveDrab\0" - "OliveDrab1\0" - "OliveDrab2\0" - "OliveDrab3\0" - "OliveDrab4\0" - "orange\0" - "orange red\0" - "orange1\0" - "orange2\0" - "orange3\0" - "orange4\0" - "OrangeRed\0" - "OrangeRed1\0" - "OrangeRed2\0" - "OrangeRed3\0" - "OrangeRed4\0" - "orchid\0" - "orchid1\0" - "orchid2\0" - "orchid3\0" - "orchid4\0" - "pale goldenrod\0" - "pale green\0" - "pale turquoise\0" - "pale violet red\0" - "PaleGoldenrod\0" - "PaleGreen\0" - "PaleGreen1\0" - "PaleGreen2\0" - "PaleGreen3\0" - "PaleGreen4\0" - "PaleTurquoise\0" - "PaleTurquoise1\0" - "PaleTurquoise2\0" - "PaleTurquoise3\0" - "PaleTurquoise4\0" - "PaleVioletRed\0" - "PaleVioletRed1\0" - "PaleVioletRed2\0" - "PaleVioletRed3\0" - "PaleVioletRed4\0" - "papaya whip\0" - "PapayaWhip\0" - "peach puff\0" - "PeachPuff\0" - "PeachPuff1\0" - "PeachPuff2\0" - "PeachPuff3\0" - "PeachPuff4\0" - "peru\0" - "pink\0" - "pink1\0" - "pink2\0" - "pink3\0" - "pink4\0" - "plum\0" - "plum1\0" - "plum2\0" - "plum3\0" - "plum4\0" - "powder blue\0" - "PowderBlue\0" - "purple\0" - "purple1\0" - "purple2\0" - "purple3\0" - "purple4\0" - "red\0" - "red1\0" - "red2\0" - "red3\0" - "red4\0" - "rosy brown\0" - "RosyBrown\0" - "RosyBrown1\0" - "RosyBrown2\0" - "RosyBrown3\0" - "RosyBrown4\0" - "royal blue\0" - "RoyalBlue\0" - "RoyalBlue1\0" - "RoyalBlue2\0" - "RoyalBlue3\0" - "RoyalBlue4\0" - "saddle brown\0" - "SaddleBrown\0" - "salmon\0" - "salmon1\0" - "salmon2\0" - "salmon3\0" - "salmon4\0" - "sandy brown\0" - "SandyBrown\0" - "sea green\0" - "SeaGreen\0" - "SeaGreen1\0" - "SeaGreen2\0" - "SeaGreen3\0" - "SeaGreen4\0" - "seashell\0" - "seashell1\0" - "seashell2\0" - "seashell3\0" - "seashell4\0" - "sienna\0" - "sienna1\0" - "sienna2\0" - "sienna3\0" - "sienna4\0" - "sky blue\0" - "SkyBlue\0" - "SkyBlue1\0" - "SkyBlue2\0" - "SkyBlue3\0" - "SkyBlue4\0" - "slate blue\0" - "slate gray\0" - "slate grey\0" - "SlateBlue\0" - "SlateBlue1\0" - "SlateBlue2\0" - "SlateBlue3\0" - "SlateBlue4\0" - "SlateGray\0" - "SlateGray1\0" - "SlateGray2\0" - "SlateGray3\0" - "SlateGray4\0" - "SlateGrey\0" - "snow\0" - "snow1\0" - "snow2\0" - "snow3\0" - "snow4\0" - "spring green\0" - "SpringGreen\0" - "SpringGreen1\0" - "SpringGreen2\0" - "SpringGreen3\0" - "SpringGreen4\0" - "steel blue\0" - "SteelBlue\0" - "SteelBlue1\0" - "SteelBlue2\0" - "SteelBlue3\0" - "SteelBlue4\0" - "tan\0" - "tan1\0" - "tan2\0" - "tan3\0" - "tan4\0" - "thistle\0" - "thistle1\0" - "thistle2\0" - "thistle3\0" - "thistle4\0" - "tomato\0" - "tomato1\0" - "tomato2\0" - "tomato3\0" - "tomato4\0" - "turquoise\0" - "turquoise1\0" - "turquoise2\0" - "turquoise3\0" - "turquoise4\0" - "violet\0" - "violet red\0" - "VioletRed\0" - "VioletRed1\0" - "VioletRed2\0" - "VioletRed3\0" - "VioletRed4\0" - "wheat\0" - "wheat1\0" - "wheat2\0" - "wheat3\0" - "wheat4\0" - "white\0" - "white smoke\0" - "WhiteSmoke\0" - "yellow\0" - "yellow green\0" - "yellow1\0" - "yellow2\0" - "yellow3\0" - "yellow4\0" - "YellowGreen\0" -}; -static const BuiltinColor BuiltinColors[] = { - { 240, 248, 255, 0 }, /* alice blue */ - { 240, 248, 255, 11 }, /* AliceBlue */ - { 250, 235, 215, 21 }, /* antique white */ - { 250, 235, 215, 35 }, /* AntiqueWhite */ - { 255, 239, 219, 48 }, /* AntiqueWhite1 */ - { 238, 223, 204, 62 }, /* AntiqueWhite2 */ - { 205, 192, 176, 76 }, /* AntiqueWhite3 */ - { 139, 131, 120, 90 }, /* AntiqueWhite4 */ - { 127, 255, 212, 104 }, /* aquamarine */ - { 127, 255, 212, 115 }, /* aquamarine1 */ - { 118, 238, 198, 127 }, /* aquamarine2 */ - { 102, 205, 170, 139 }, /* aquamarine3 */ - { 69, 139, 116, 151 }, /* aquamarine4 */ - { 240, 255, 255, 163 }, /* azure */ - { 240, 255, 255, 169 }, /* azure1 */ - { 224, 238, 238, 176 }, /* azure2 */ - { 193, 205, 205, 183 }, /* azure3 */ - { 131, 139, 139, 190 }, /* azure4 */ - { 245, 245, 220, 197 }, /* beige */ - { 255, 228, 196, 203 }, /* bisque */ - { 255, 228, 196, 210 }, /* bisque1 */ - { 238, 213, 183, 218 }, /* bisque2 */ - { 205, 183, 158, 226 }, /* bisque3 */ - { 139, 125, 107, 234 }, /* bisque4 */ - { 0, 0, 0, 242 }, /* black */ - { 255, 235, 205, 248 }, /* blanched almond */ - { 255, 235, 205, 264 }, /* BlanchedAlmond */ - { 0, 0, 255, 279 }, /* blue */ - { 138, 43, 226, 284 }, /* blue violet */ - { 0, 0, 255, 296 }, /* blue1 */ - { 0, 0, 238, 302 }, /* blue2 */ - { 0, 0, 205, 308 }, /* blue3 */ - { 0, 0, 139, 314 }, /* blue4 */ - { 138, 43, 226, 320 }, /* BlueViolet */ - { 165, 42, 42, 331 }, /* brown */ - { 255, 64, 64, 337 }, /* brown1 */ - { 238, 59, 59, 344 }, /* brown2 */ - { 205, 51, 51, 351 }, /* brown3 */ - { 139, 35, 35, 358 }, /* brown4 */ - { 222, 184, 135, 365 }, /* burlywood */ - { 255, 211, 155, 375 }, /* burlywood1 */ - { 238, 197, 145, 386 }, /* burlywood2 */ - { 205, 170, 125, 397 }, /* burlywood3 */ - { 139, 115, 85, 408 }, /* burlywood4 */ - { 95, 158, 160, 419 }, /* cadet blue */ - { 95, 158, 160, 430 }, /* CadetBlue */ - { 152, 245, 255, 440 }, /* CadetBlue1 */ - { 142, 229, 238, 451 }, /* CadetBlue2 */ - { 122, 197, 205, 462 }, /* CadetBlue3 */ - { 83, 134, 139, 473 }, /* CadetBlue4 */ - { 127, 255, 0, 484 }, /* chartreuse */ - { 127, 255, 0, 495 }, /* chartreuse1 */ - { 118, 238, 0, 507 }, /* chartreuse2 */ - { 102, 205, 0, 519 }, /* chartreuse3 */ - { 69, 139, 0, 531 }, /* chartreuse4 */ - { 210, 105, 30, 543 }, /* chocolate */ - { 255, 127, 36, 553 }, /* chocolate1 */ - { 238, 118, 33, 564 }, /* chocolate2 */ - { 205, 102, 29, 575 }, /* chocolate3 */ - { 139, 69, 19, 586 }, /* chocolate4 */ - { 255, 127, 80, 597 }, /* coral */ - { 255, 114, 86, 603 }, /* coral1 */ - { 238, 106, 80, 610 }, /* coral2 */ - { 205, 91, 69, 617 }, /* coral3 */ - { 139, 62, 47, 624 }, /* coral4 */ - { 100, 149, 237, 631 }, /* cornflower blue */ - { 100, 149, 237, 647 }, /* CornflowerBlue */ - { 255, 248, 220, 662 }, /* cornsilk */ - { 255, 248, 220, 671 }, /* cornsilk1 */ - { 238, 232, 205, 681 }, /* cornsilk2 */ - { 205, 200, 177, 691 }, /* cornsilk3 */ - { 139, 136, 120, 701 }, /* cornsilk4 */ - { 0, 255, 255, 711 }, /* cyan */ - { 0, 255, 255, 716 }, /* cyan1 */ - { 0, 238, 238, 722 }, /* cyan2 */ - { 0, 205, 205, 728 }, /* cyan3 */ - { 0, 139, 139, 734 }, /* cyan4 */ - { 0, 0, 139, 740 }, /* dark blue */ - { 0, 139, 139, 750 }, /* dark cyan */ - { 184, 134, 11, 760 }, /* dark goldenrod */ - { 169, 169, 169, 775 }, /* dark gray */ - { 0, 100, 0, 785 }, /* dark green */ - { 169, 169, 169, 796 }, /* dark grey */ - { 189, 183, 107, 806 }, /* dark khaki */ - { 139, 0, 139, 817 }, /* dark magenta */ - { 85, 107, 47, 830 }, /* dark olive green */ - { 255, 140, 0, 847 }, /* dark orange */ - { 153, 50, 204, 859 }, /* dark orchid */ - { 139, 0, 0, 871 }, /* dark red */ - { 233, 150, 122, 880 }, /* dark salmon */ - { 143, 188, 143, 892 }, /* dark sea green */ - { 72, 61, 139, 907 }, /* dark slate blue */ - { 47, 79, 79, 923 }, /* dark slate gray */ - { 47, 79, 79, 939 }, /* dark slate grey */ - { 0, 206, 209, 955 }, /* dark turquoise */ - { 148, 0, 211, 970 }, /* dark violet */ - { 0, 0, 139, 982 }, /* DarkBlue */ - { 0, 139, 139, 991 }, /* DarkCyan */ - { 184, 134, 11, 1000 }, /* DarkGoldenrod */ - { 255, 185, 15, 1014 }, /* DarkGoldenrod1 */ - { 238, 173, 14, 1029 }, /* DarkGoldenrod2 */ - { 205, 149, 12, 1044 }, /* DarkGoldenrod3 */ - { 139, 101, 8, 1059 }, /* DarkGoldenrod4 */ - { 169, 169, 169, 1074 }, /* DarkGray */ - { 0, 100, 0, 1083 }, /* DarkGreen */ - { 169, 169, 169, 1093 }, /* DarkGrey */ - { 189, 183, 107, 1102 }, /* DarkKhaki */ - { 139, 0, 139, 1112 }, /* DarkMagenta */ - { 85, 107, 47, 1124 }, /* DarkOliveGreen */ - { 202, 255, 112, 1139 }, /* DarkOliveGreen1 */ - { 188, 238, 104, 1155 }, /* DarkOliveGreen2 */ - { 162, 205, 90, 1171 }, /* DarkOliveGreen3 */ - { 110, 139, 61, 1187 }, /* DarkOliveGreen4 */ - { 255, 140, 0, 1203 }, /* DarkOrange */ - { 255, 127, 0, 1214 }, /* DarkOrange1 */ - { 238, 118, 0, 1226 }, /* DarkOrange2 */ - { 205, 102, 0, 1238 }, /* DarkOrange3 */ - { 139, 69, 0, 1250 }, /* DarkOrange4 */ - { 153, 50, 204, 1262 }, /* DarkOrchid */ - { 191, 62, 255, 1273 }, /* DarkOrchid1 */ - { 178, 58, 238, 1285 }, /* DarkOrchid2 */ - { 154, 50, 205, 1297 }, /* DarkOrchid3 */ - { 104, 34, 139, 1309 }, /* DarkOrchid4 */ - { 139, 0, 0, 1321 }, /* DarkRed */ - { 233, 150, 122, 1329 }, /* DarkSalmon */ - { 143, 188, 143, 1340 }, /* DarkSeaGreen */ - { 193, 255, 193, 1353 }, /* DarkSeaGreen1 */ - { 180, 238, 180, 1367 }, /* DarkSeaGreen2 */ - { 155, 205, 155, 1381 }, /* DarkSeaGreen3 */ - { 105, 139, 105, 1395 }, /* DarkSeaGreen4 */ - { 72, 61, 139, 1409 }, /* DarkSlateBlue */ - { 47, 79, 79, 1423 }, /* DarkSlateGray */ - { 151, 255, 255, 1437 }, /* DarkSlateGray1 */ - { 141, 238, 238, 1452 }, /* DarkSlateGray2 */ - { 121, 205, 205, 1467 }, /* DarkSlateGray3 */ - { 82, 139, 139, 1482 }, /* DarkSlateGray4 */ - { 47, 79, 79, 1497 }, /* DarkSlateGrey */ - { 0, 206, 209, 1511 }, /* DarkTurquoise */ - { 148, 0, 211, 1525 }, /* DarkViolet */ - { 255, 20, 147, 1536 }, /* deep pink */ - { 0, 191, 255, 1546 }, /* deep sky blue */ - { 255, 20, 147, 1560 }, /* DeepPink */ - { 255, 20, 147, 1569 }, /* DeepPink1 */ - { 238, 18, 137, 1579 }, /* DeepPink2 */ - { 205, 16, 118, 1589 }, /* DeepPink3 */ - { 139, 10, 80, 1599 }, /* DeepPink4 */ - { 0, 191, 255, 1609 }, /* DeepSkyBlue */ - { 0, 191, 255, 1621 }, /* DeepSkyBlue1 */ - { 0, 178, 238, 1634 }, /* DeepSkyBlue2 */ - { 0, 154, 205, 1647 }, /* DeepSkyBlue3 */ - { 0, 104, 139, 1660 }, /* DeepSkyBlue4 */ - { 105, 105, 105, 1673 }, /* dim gray */ - { 105, 105, 105, 1682 }, /* dim grey */ - { 105, 105, 105, 1691 }, /* DimGray */ - { 105, 105, 105, 1699 }, /* DimGrey */ - { 30, 144, 255, 1707 }, /* dodger blue */ - { 30, 144, 255, 1719 }, /* DodgerBlue */ - { 30, 144, 255, 1730 }, /* DodgerBlue1 */ - { 28, 134, 238, 1742 }, /* DodgerBlue2 */ - { 24, 116, 205, 1754 }, /* DodgerBlue3 */ - { 16, 78, 139, 1766 }, /* DodgerBlue4 */ - { 178, 34, 34, 1778 }, /* firebrick */ - { 255, 48, 48, 1788 }, /* firebrick1 */ - { 238, 44, 44, 1799 }, /* firebrick2 */ - { 205, 38, 38, 1810 }, /* firebrick3 */ - { 139, 26, 26, 1821 }, /* firebrick4 */ - { 255, 250, 240, 1832 }, /* floral white */ - { 255, 250, 240, 1845 }, /* FloralWhite */ - { 34, 139, 34, 1857 }, /* forest green */ - { 34, 139, 34, 1870 }, /* ForestGreen */ - { 220, 220, 220, 1882 }, /* gainsboro */ - { 248, 248, 255, 1892 }, /* ghost white */ - { 248, 248, 255, 1904 }, /* GhostWhite */ - { 255, 215, 0, 1915 }, /* gold */ - { 255, 215, 0, 1920 }, /* gold1 */ - { 238, 201, 0, 1926 }, /* gold2 */ - { 205, 173, 0, 1932 }, /* gold3 */ - { 139, 117, 0, 1938 }, /* gold4 */ - { 218, 165, 32, 1944 }, /* goldenrod */ - { 255, 193, 37, 1954 }, /* goldenrod1 */ - { 238, 180, 34, 1965 }, /* goldenrod2 */ - { 205, 155, 29, 1976 }, /* goldenrod3 */ - { 139, 105, 20, 1987 }, /* goldenrod4 */ - { 190, 190, 190, 1998 }, /* gray */ - { 0, 0, 0, 2003 }, /* gray0 */ - { 3, 3, 3, 2009 }, /* gray1 */ - { 26, 26, 26, 2015 }, /* gray10 */ - { 255, 255, 255, 2022 }, /* gray100 */ - { 28, 28, 28, 2030 }, /* gray11 */ - { 31, 31, 31, 2037 }, /* gray12 */ - { 33, 33, 33, 2044 }, /* gray13 */ - { 36, 36, 36, 2051 }, /* gray14 */ - { 38, 38, 38, 2058 }, /* gray15 */ - { 41, 41, 41, 2065 }, /* gray16 */ - { 43, 43, 43, 2072 }, /* gray17 */ - { 46, 46, 46, 2079 }, /* gray18 */ - { 48, 48, 48, 2086 }, /* gray19 */ - { 5, 5, 5, 2093 }, /* gray2 */ - { 51, 51, 51, 2099 }, /* gray20 */ - { 54, 54, 54, 2106 }, /* gray21 */ - { 56, 56, 56, 2113 }, /* gray22 */ - { 59, 59, 59, 2120 }, /* gray23 */ - { 61, 61, 61, 2127 }, /* gray24 */ - { 64, 64, 64, 2134 }, /* gray25 */ - { 66, 66, 66, 2141 }, /* gray26 */ - { 69, 69, 69, 2148 }, /* gray27 */ - { 71, 71, 71, 2155 }, /* gray28 */ - { 74, 74, 74, 2162 }, /* gray29 */ - { 8, 8, 8, 2169 }, /* gray3 */ - { 77, 77, 77, 2175 }, /* gray30 */ - { 79, 79, 79, 2182 }, /* gray31 */ - { 82, 82, 82, 2189 }, /* gray32 */ - { 84, 84, 84, 2196 }, /* gray33 */ - { 87, 87, 87, 2203 }, /* gray34 */ - { 89, 89, 89, 2210 }, /* gray35 */ - { 92, 92, 92, 2217 }, /* gray36 */ - { 94, 94, 94, 2224 }, /* gray37 */ - { 97, 97, 97, 2231 }, /* gray38 */ - { 99, 99, 99, 2238 }, /* gray39 */ - { 10, 10, 10, 2245 }, /* gray4 */ - { 102, 102, 102, 2251 }, /* gray40 */ - { 105, 105, 105, 2258 }, /* gray41 */ - { 107, 107, 107, 2265 }, /* gray42 */ - { 110, 110, 110, 2272 }, /* gray43 */ - { 112, 112, 112, 2279 }, /* gray44 */ - { 115, 115, 115, 2286 }, /* gray45 */ - { 117, 117, 117, 2293 }, /* gray46 */ - { 120, 120, 120, 2300 }, /* gray47 */ - { 122, 122, 122, 2307 }, /* gray48 */ - { 125, 125, 125, 2314 }, /* gray49 */ - { 13, 13, 13, 2321 }, /* gray5 */ - { 127, 127, 127, 2327 }, /* gray50 */ - { 130, 130, 130, 2334 }, /* gray51 */ - { 133, 133, 133, 2341 }, /* gray52 */ - { 135, 135, 135, 2348 }, /* gray53 */ - { 138, 138, 138, 2355 }, /* gray54 */ - { 140, 140, 140, 2362 }, /* gray55 */ - { 143, 143, 143, 2369 }, /* gray56 */ - { 145, 145, 145, 2376 }, /* gray57 */ - { 148, 148, 148, 2383 }, /* gray58 */ - { 150, 150, 150, 2390 }, /* gray59 */ - { 15, 15, 15, 2397 }, /* gray6 */ - { 153, 153, 153, 2403 }, /* gray60 */ - { 156, 156, 156, 2410 }, /* gray61 */ - { 158, 158, 158, 2417 }, /* gray62 */ - { 161, 161, 161, 2424 }, /* gray63 */ - { 163, 163, 163, 2431 }, /* gray64 */ - { 166, 166, 166, 2438 }, /* gray65 */ - { 168, 168, 168, 2445 }, /* gray66 */ - { 171, 171, 171, 2452 }, /* gray67 */ - { 173, 173, 173, 2459 }, /* gray68 */ - { 176, 176, 176, 2466 }, /* gray69 */ - { 18, 18, 18, 2473 }, /* gray7 */ - { 179, 179, 179, 2479 }, /* gray70 */ - { 181, 181, 181, 2486 }, /* gray71 */ - { 184, 184, 184, 2493 }, /* gray72 */ - { 186, 186, 186, 2500 }, /* gray73 */ - { 189, 189, 189, 2507 }, /* gray74 */ - { 191, 191, 191, 2514 }, /* gray75 */ - { 194, 194, 194, 2521 }, /* gray76 */ - { 196, 196, 196, 2528 }, /* gray77 */ - { 199, 199, 199, 2535 }, /* gray78 */ - { 201, 201, 201, 2542 }, /* gray79 */ - { 20, 20, 20, 2549 }, /* gray8 */ - { 204, 204, 204, 2555 }, /* gray80 */ - { 207, 207, 207, 2562 }, /* gray81 */ - { 209, 209, 209, 2569 }, /* gray82 */ - { 212, 212, 212, 2576 }, /* gray83 */ - { 214, 214, 214, 2583 }, /* gray84 */ - { 217, 217, 217, 2590 }, /* gray85 */ - { 219, 219, 219, 2597 }, /* gray86 */ - { 222, 222, 222, 2604 }, /* gray87 */ - { 224, 224, 224, 2611 }, /* gray88 */ - { 227, 227, 227, 2618 }, /* gray89 */ - { 23, 23, 23, 2625 }, /* gray9 */ - { 229, 229, 229, 2631 }, /* gray90 */ - { 232, 232, 232, 2638 }, /* gray91 */ - { 235, 235, 235, 2645 }, /* gray92 */ - { 237, 237, 237, 2652 }, /* gray93 */ - { 240, 240, 240, 2659 }, /* gray94 */ - { 242, 242, 242, 2666 }, /* gray95 */ - { 245, 245, 245, 2673 }, /* gray96 */ - { 247, 247, 247, 2680 }, /* gray97 */ - { 250, 250, 250, 2687 }, /* gray98 */ - { 252, 252, 252, 2694 }, /* gray99 */ - { 0, 255, 0, 2701 }, /* green */ - { 173, 255, 47, 2707 }, /* green yellow */ - { 0, 255, 0, 2720 }, /* green1 */ - { 0, 238, 0, 2727 }, /* green2 */ - { 0, 205, 0, 2734 }, /* green3 */ - { 0, 139, 0, 2741 }, /* green4 */ - { 173, 255, 47, 2748 }, /* GreenYellow */ - { 190, 190, 190, 2760 }, /* grey */ - { 0, 0, 0, 2765 }, /* grey0 */ - { 3, 3, 3, 2771 }, /* grey1 */ - { 26, 26, 26, 2777 }, /* grey10 */ - { 255, 255, 255, 2784 }, /* grey100 */ - { 28, 28, 28, 2792 }, /* grey11 */ - { 31, 31, 31, 2799 }, /* grey12 */ - { 33, 33, 33, 2806 }, /* grey13 */ - { 36, 36, 36, 2813 }, /* grey14 */ - { 38, 38, 38, 2820 }, /* grey15 */ - { 41, 41, 41, 2827 }, /* grey16 */ - { 43, 43, 43, 2834 }, /* grey17 */ - { 46, 46, 46, 2841 }, /* grey18 */ - { 48, 48, 48, 2848 }, /* grey19 */ - { 5, 5, 5, 2855 }, /* grey2 */ - { 51, 51, 51, 2861 }, /* grey20 */ - { 54, 54, 54, 2868 }, /* grey21 */ - { 56, 56, 56, 2875 }, /* grey22 */ - { 59, 59, 59, 2882 }, /* grey23 */ - { 61, 61, 61, 2889 }, /* grey24 */ - { 64, 64, 64, 2896 }, /* grey25 */ - { 66, 66, 66, 2903 }, /* grey26 */ - { 69, 69, 69, 2910 }, /* grey27 */ - { 71, 71, 71, 2917 }, /* grey28 */ - { 74, 74, 74, 2924 }, /* grey29 */ - { 8, 8, 8, 2931 }, /* grey3 */ - { 77, 77, 77, 2937 }, /* grey30 */ - { 79, 79, 79, 2944 }, /* grey31 */ - { 82, 82, 82, 2951 }, /* grey32 */ - { 84, 84, 84, 2958 }, /* grey33 */ - { 87, 87, 87, 2965 }, /* grey34 */ - { 89, 89, 89, 2972 }, /* grey35 */ - { 92, 92, 92, 2979 }, /* grey36 */ - { 94, 94, 94, 2986 }, /* grey37 */ - { 97, 97, 97, 2993 }, /* grey38 */ - { 99, 99, 99, 3000 }, /* grey39 */ - { 10, 10, 10, 3007 }, /* grey4 */ - { 102, 102, 102, 3013 }, /* grey40 */ - { 105, 105, 105, 3020 }, /* grey41 */ - { 107, 107, 107, 3027 }, /* grey42 */ - { 110, 110, 110, 3034 }, /* grey43 */ - { 112, 112, 112, 3041 }, /* grey44 */ - { 115, 115, 115, 3048 }, /* grey45 */ - { 117, 117, 117, 3055 }, /* grey46 */ - { 120, 120, 120, 3062 }, /* grey47 */ - { 122, 122, 122, 3069 }, /* grey48 */ - { 125, 125, 125, 3076 }, /* grey49 */ - { 13, 13, 13, 3083 }, /* grey5 */ - { 127, 127, 127, 3089 }, /* grey50 */ - { 130, 130, 130, 3096 }, /* grey51 */ - { 133, 133, 133, 3103 }, /* grey52 */ - { 135, 135, 135, 3110 }, /* grey53 */ - { 138, 138, 138, 3117 }, /* grey54 */ - { 140, 140, 140, 3124 }, /* grey55 */ - { 143, 143, 143, 3131 }, /* grey56 */ - { 145, 145, 145, 3138 }, /* grey57 */ - { 148, 148, 148, 3145 }, /* grey58 */ - { 150, 150, 150, 3152 }, /* grey59 */ - { 15, 15, 15, 3159 }, /* grey6 */ - { 153, 153, 153, 3165 }, /* grey60 */ - { 156, 156, 156, 3172 }, /* grey61 */ - { 158, 158, 158, 3179 }, /* grey62 */ - { 161, 161, 161, 3186 }, /* grey63 */ - { 163, 163, 163, 3193 }, /* grey64 */ - { 166, 166, 166, 3200 }, /* grey65 */ - { 168, 168, 168, 3207 }, /* grey66 */ - { 171, 171, 171, 3214 }, /* grey67 */ - { 173, 173, 173, 3221 }, /* grey68 */ - { 176, 176, 176, 3228 }, /* grey69 */ - { 18, 18, 18, 3235 }, /* grey7 */ - { 179, 179, 179, 3241 }, /* grey70 */ - { 181, 181, 181, 3248 }, /* grey71 */ - { 184, 184, 184, 3255 }, /* grey72 */ - { 186, 186, 186, 3262 }, /* grey73 */ - { 189, 189, 189, 3269 }, /* grey74 */ - { 191, 191, 191, 3276 }, /* grey75 */ - { 194, 194, 194, 3283 }, /* grey76 */ - { 196, 196, 196, 3290 }, /* grey77 */ - { 199, 199, 199, 3297 }, /* grey78 */ - { 201, 201, 201, 3304 }, /* grey79 */ - { 20, 20, 20, 3311 }, /* grey8 */ - { 204, 204, 204, 3317 }, /* grey80 */ - { 207, 207, 207, 3324 }, /* grey81 */ - { 209, 209, 209, 3331 }, /* grey82 */ - { 212, 212, 212, 3338 }, /* grey83 */ - { 214, 214, 214, 3345 }, /* grey84 */ - { 217, 217, 217, 3352 }, /* grey85 */ - { 219, 219, 219, 3359 }, /* grey86 */ - { 222, 222, 222, 3366 }, /* grey87 */ - { 224, 224, 224, 3373 }, /* grey88 */ - { 227, 227, 227, 3380 }, /* grey89 */ - { 23, 23, 23, 3387 }, /* grey9 */ - { 229, 229, 229, 3393 }, /* grey90 */ - { 232, 232, 232, 3400 }, /* grey91 */ - { 235, 235, 235, 3407 }, /* grey92 */ - { 237, 237, 237, 3414 }, /* grey93 */ - { 240, 240, 240, 3421 }, /* grey94 */ - { 242, 242, 242, 3428 }, /* grey95 */ - { 245, 245, 245, 3435 }, /* grey96 */ - { 247, 247, 247, 3442 }, /* grey97 */ - { 250, 250, 250, 3449 }, /* grey98 */ - { 252, 252, 252, 3456 }, /* grey99 */ - { 240, 255, 240, 3463 }, /* honeydew */ - { 240, 255, 240, 3472 }, /* honeydew1 */ - { 224, 238, 224, 3482 }, /* honeydew2 */ - { 193, 205, 193, 3492 }, /* honeydew3 */ - { 131, 139, 131, 3502 }, /* honeydew4 */ - { 255, 105, 180, 3512 }, /* hot pink */ - { 255, 105, 180, 3521 }, /* HotPink */ - { 255, 110, 180, 3529 }, /* HotPink1 */ - { 238, 106, 167, 3538 }, /* HotPink2 */ - { 205, 96, 144, 3547 }, /* HotPink3 */ - { 139, 58, 98, 3556 }, /* HotPink4 */ - { 205, 92, 92, 3565 }, /* indian red */ - { 205, 92, 92, 3576 }, /* IndianRed */ - { 255, 106, 106, 3586 }, /* IndianRed1 */ - { 238, 99, 99, 3597 }, /* IndianRed2 */ - { 205, 85, 85, 3608 }, /* IndianRed3 */ - { 139, 58, 58, 3619 }, /* IndianRed4 */ - { 255, 255, 240, 3630 }, /* ivory */ - { 255, 255, 240, 3636 }, /* ivory1 */ - { 238, 238, 224, 3643 }, /* ivory2 */ - { 205, 205, 193, 3650 }, /* ivory3 */ - { 139, 139, 131, 3657 }, /* ivory4 */ - { 240, 230, 140, 3664 }, /* khaki */ - { 255, 246, 143, 3670 }, /* khaki1 */ - { 238, 230, 133, 3677 }, /* khaki2 */ - { 205, 198, 115, 3684 }, /* khaki3 */ - { 139, 134, 78, 3691 }, /* khaki4 */ - { 230, 230, 250, 3698 }, /* lavender */ - { 255, 240, 245, 3707 }, /* lavender blush */ - { 255, 240, 245, 3722 }, /* LavenderBlush */ - { 255, 240, 245, 3736 }, /* LavenderBlush1 */ - { 238, 224, 229, 3751 }, /* LavenderBlush2 */ - { 205, 193, 197, 3766 }, /* LavenderBlush3 */ - { 139, 131, 134, 3781 }, /* LavenderBlush4 */ - { 124, 252, 0, 3796 }, /* lawn green */ - { 124, 252, 0, 3807 }, /* LawnGreen */ - { 255, 250, 205, 3817 }, /* lemon chiffon */ - { 255, 250, 205, 3831 }, /* LemonChiffon */ - { 255, 250, 205, 3844 }, /* LemonChiffon1 */ - { 238, 233, 191, 3858 }, /* LemonChiffon2 */ - { 205, 201, 165, 3872 }, /* LemonChiffon3 */ - { 139, 137, 112, 3886 }, /* LemonChiffon4 */ - { 173, 216, 230, 3900 }, /* light blue */ - { 240, 128, 128, 3911 }, /* light coral */ - { 224, 255, 255, 3923 }, /* light cyan */ - { 238, 221, 130, 3934 }, /* light goldenrod */ - { 250, 250, 210, 3950 }, /* light goldenrod yellow */ - { 211, 211, 211, 3973 }, /* light gray */ - { 144, 238, 144, 3984 }, /* light green */ - { 211, 211, 211, 3996 }, /* light grey */ - { 255, 182, 193, 4007 }, /* light pink */ - { 255, 160, 122, 4018 }, /* light salmon */ - { 32, 178, 170, 4031 }, /* light sea green */ - { 135, 206, 250, 4047 }, /* light sky blue */ - { 132, 112, 255, 4062 }, /* light slate blue */ - { 119, 136, 153, 4079 }, /* light slate gray */ - { 119, 136, 153, 4096 }, /* light slate grey */ - { 176, 196, 222, 4113 }, /* light steel blue */ - { 255, 255, 224, 4130 }, /* light yellow */ - { 173, 216, 230, 4143 }, /* LightBlue */ - { 191, 239, 255, 4153 }, /* LightBlue1 */ - { 178, 223, 238, 4164 }, /* LightBlue2 */ - { 154, 192, 205, 4175 }, /* LightBlue3 */ - { 104, 131, 139, 4186 }, /* LightBlue4 */ - { 240, 128, 128, 4197 }, /* LightCoral */ - { 224, 255, 255, 4208 }, /* LightCyan */ - { 224, 255, 255, 4218 }, /* LightCyan1 */ - { 209, 238, 238, 4229 }, /* LightCyan2 */ - { 180, 205, 205, 4240 }, /* LightCyan3 */ - { 122, 139, 139, 4251 }, /* LightCyan4 */ - { 238, 221, 130, 4262 }, /* LightGoldenrod */ - { 255, 236, 139, 4277 }, /* LightGoldenrod1 */ - { 238, 220, 130, 4293 }, /* LightGoldenrod2 */ - { 205, 190, 112, 4309 }, /* LightGoldenrod3 */ - { 139, 129, 76, 4325 }, /* LightGoldenrod4 */ - { 250, 250, 210, 4341 }, /* LightGoldenrodYellow */ - { 211, 211, 211, 4362 }, /* LightGray */ - { 144, 238, 144, 4372 }, /* LightGreen */ - { 211, 211, 211, 4383 }, /* LightGrey */ - { 255, 182, 193, 4393 }, /* LightPink */ - { 255, 174, 185, 4403 }, /* LightPink1 */ - { 238, 162, 173, 4414 }, /* LightPink2 */ - { 205, 140, 149, 4425 }, /* LightPink3 */ - { 139, 95, 101, 4436 }, /* LightPink4 */ - { 255, 160, 122, 4447 }, /* LightSalmon */ - { 255, 160, 122, 4459 }, /* LightSalmon1 */ - { 238, 149, 114, 4472 }, /* LightSalmon2 */ - { 205, 129, 98, 4485 }, /* LightSalmon3 */ - { 139, 87, 66, 4498 }, /* LightSalmon4 */ - { 32, 178, 170, 4511 }, /* LightSeaGreen */ - { 135, 206, 250, 4525 }, /* LightSkyBlue */ - { 176, 226, 255, 4538 }, /* LightSkyBlue1 */ - { 164, 211, 238, 4552 }, /* LightSkyBlue2 */ - { 141, 182, 205, 4566 }, /* LightSkyBlue3 */ - { 96, 123, 139, 4580 }, /* LightSkyBlue4 */ - { 132, 112, 255, 4594 }, /* LightSlateBlue */ - { 119, 136, 153, 4609 }, /* LightSlateGray */ - { 119, 136, 153, 4624 }, /* LightSlateGrey */ - { 176, 196, 222, 4639 }, /* LightSteelBlue */ - { 202, 225, 255, 4654 }, /* LightSteelBlue1 */ - { 188, 210, 238, 4670 }, /* LightSteelBlue2 */ - { 162, 181, 205, 4686 }, /* LightSteelBlue3 */ - { 110, 123, 139, 4702 }, /* LightSteelBlue4 */ - { 255, 255, 224, 4718 }, /* LightYellow */ - { 255, 255, 224, 4730 }, /* LightYellow1 */ - { 238, 238, 209, 4743 }, /* LightYellow2 */ - { 205, 205, 180, 4756 }, /* LightYellow3 */ - { 139, 139, 122, 4769 }, /* LightYellow4 */ - { 50, 205, 50, 4782 }, /* lime green */ - { 50, 205, 50, 4793 }, /* LimeGreen */ - { 250, 240, 230, 4803 }, /* linen */ - { 255, 0, 255, 4809 }, /* magenta */ - { 255, 0, 255, 4817 }, /* magenta1 */ - { 238, 0, 238, 4826 }, /* magenta2 */ - { 205, 0, 205, 4835 }, /* magenta3 */ - { 139, 0, 139, 4844 }, /* magenta4 */ - { 176, 48, 96, 4853 }, /* maroon */ - { 255, 52, 179, 4860 }, /* maroon1 */ - { 238, 48, 167, 4868 }, /* maroon2 */ - { 205, 41, 144, 4876 }, /* maroon3 */ - { 139, 28, 98, 4884 }, /* maroon4 */ - { 102, 205, 170, 4892 }, /* medium aquamarine */ - { 0, 0, 205, 4910 }, /* medium blue */ - { 186, 85, 211, 4922 }, /* medium orchid */ - { 147, 112, 219, 4936 }, /* medium purple */ - { 60, 179, 113, 4950 }, /* medium sea green */ - { 123, 104, 238, 4967 }, /* medium slate blue */ - { 0, 250, 154, 4985 }, /* medium spring green */ - { 72, 209, 204, 5005 }, /* medium turquoise */ - { 199, 21, 133, 5022 }, /* medium violet red */ - { 102, 205, 170, 5040 }, /* MediumAquamarine */ - { 0, 0, 205, 5057 }, /* MediumBlue */ - { 186, 85, 211, 5068 }, /* MediumOrchid */ - { 224, 102, 255, 5081 }, /* MediumOrchid1 */ - { 209, 95, 238, 5095 }, /* MediumOrchid2 */ - { 180, 82, 205, 5109 }, /* MediumOrchid3 */ - { 122, 55, 139, 5123 }, /* MediumOrchid4 */ - { 147, 112, 219, 5137 }, /* MediumPurple */ - { 171, 130, 255, 5150 }, /* MediumPurple1 */ - { 159, 121, 238, 5164 }, /* MediumPurple2 */ - { 137, 104, 205, 5178 }, /* MediumPurple3 */ - { 93, 71, 139, 5192 }, /* MediumPurple4 */ - { 60, 179, 113, 5206 }, /* MediumSeaGreen */ - { 123, 104, 238, 5221 }, /* MediumSlateBlue */ - { 0, 250, 154, 5237 }, /* MediumSpringGreen */ - { 72, 209, 204, 5255 }, /* MediumTurquoise */ - { 199, 21, 133, 5271 }, /* MediumVioletRed */ - { 25, 25, 112, 5287 }, /* midnight blue */ - { 25, 25, 112, 5301 }, /* MidnightBlue */ - { 245, 255, 250, 5314 }, /* mint cream */ - { 245, 255, 250, 5325 }, /* MintCream */ - { 255, 228, 225, 5335 }, /* misty rose */ - { 255, 228, 225, 5346 }, /* MistyRose */ - { 255, 228, 225, 5356 }, /* MistyRose1 */ - { 238, 213, 210, 5367 }, /* MistyRose2 */ - { 205, 183, 181, 5378 }, /* MistyRose3 */ - { 139, 125, 123, 5389 }, /* MistyRose4 */ - { 255, 228, 181, 5400 }, /* moccasin */ - { 255, 222, 173, 5409 }, /* navajo white */ - { 255, 222, 173, 5422 }, /* NavajoWhite */ - { 255, 222, 173, 5434 }, /* NavajoWhite1 */ - { 238, 207, 161, 5447 }, /* NavajoWhite2 */ - { 205, 179, 139, 5460 }, /* NavajoWhite3 */ - { 139, 121, 94, 5473 }, /* NavajoWhite4 */ - { 0, 0, 128, 5486 }, /* navy */ - { 0, 0, 128, 5491 }, /* navy blue */ - { 0, 0, 128, 5501 }, /* NavyBlue */ - { 253, 245, 230, 5510 }, /* old lace */ - { 253, 245, 230, 5519 }, /* OldLace */ - { 107, 142, 35, 5527 }, /* olive drab */ - { 107, 142, 35, 5538 }, /* OliveDrab */ - { 192, 255, 62, 5548 }, /* OliveDrab1 */ - { 179, 238, 58, 5559 }, /* OliveDrab2 */ - { 154, 205, 50, 5570 }, /* OliveDrab3 */ - { 105, 139, 34, 5581 }, /* OliveDrab4 */ - { 255, 165, 0, 5592 }, /* orange */ - { 255, 69, 0, 5599 }, /* orange red */ - { 255, 165, 0, 5610 }, /* orange1 */ - { 238, 154, 0, 5618 }, /* orange2 */ - { 205, 133, 0, 5626 }, /* orange3 */ - { 139, 90, 0, 5634 }, /* orange4 */ - { 255, 69, 0, 5642 }, /* OrangeRed */ - { 255, 69, 0, 5652 }, /* OrangeRed1 */ - { 238, 64, 0, 5663 }, /* OrangeRed2 */ - { 205, 55, 0, 5674 }, /* OrangeRed3 */ - { 139, 37, 0, 5685 }, /* OrangeRed4 */ - { 218, 112, 214, 5696 }, /* orchid */ - { 255, 131, 250, 5703 }, /* orchid1 */ - { 238, 122, 233, 5711 }, /* orchid2 */ - { 205, 105, 201, 5719 }, /* orchid3 */ - { 139, 71, 137, 5727 }, /* orchid4 */ - { 238, 232, 170, 5735 }, /* pale goldenrod */ - { 152, 251, 152, 5750 }, /* pale green */ - { 175, 238, 238, 5761 }, /* pale turquoise */ - { 219, 112, 147, 5776 }, /* pale violet red */ - { 238, 232, 170, 5792 }, /* PaleGoldenrod */ - { 152, 251, 152, 5806 }, /* PaleGreen */ - { 154, 255, 154, 5816 }, /* PaleGreen1 */ - { 144, 238, 144, 5827 }, /* PaleGreen2 */ - { 124, 205, 124, 5838 }, /* PaleGreen3 */ - { 84, 139, 84, 5849 }, /* PaleGreen4 */ - { 175, 238, 238, 5860 }, /* PaleTurquoise */ - { 187, 255, 255, 5874 }, /* PaleTurquoise1 */ - { 174, 238, 238, 5889 }, /* PaleTurquoise2 */ - { 150, 205, 205, 5904 }, /* PaleTurquoise3 */ - { 102, 139, 139, 5919 }, /* PaleTurquoise4 */ - { 219, 112, 147, 5934 }, /* PaleVioletRed */ - { 255, 130, 171, 5948 }, /* PaleVioletRed1 */ - { 238, 121, 159, 5963 }, /* PaleVioletRed2 */ - { 205, 104, 137, 5978 }, /* PaleVioletRed3 */ - { 139, 71, 93, 5993 }, /* PaleVioletRed4 */ - { 255, 239, 213, 6008 }, /* papaya whip */ - { 255, 239, 213, 6020 }, /* PapayaWhip */ - { 255, 218, 185, 6031 }, /* peach puff */ - { 255, 218, 185, 6042 }, /* PeachPuff */ - { 255, 218, 185, 6052 }, /* PeachPuff1 */ - { 238, 203, 173, 6063 }, /* PeachPuff2 */ - { 205, 175, 149, 6074 }, /* PeachPuff3 */ - { 139, 119, 101, 6085 }, /* PeachPuff4 */ - { 205, 133, 63, 6096 }, /* peru */ - { 255, 192, 203, 6101 }, /* pink */ - { 255, 181, 197, 6106 }, /* pink1 */ - { 238, 169, 184, 6112 }, /* pink2 */ - { 205, 145, 158, 6118 }, /* pink3 */ - { 139, 99, 108, 6124 }, /* pink4 */ - { 221, 160, 221, 6130 }, /* plum */ - { 255, 187, 255, 6135 }, /* plum1 */ - { 238, 174, 238, 6141 }, /* plum2 */ - { 205, 150, 205, 6147 }, /* plum3 */ - { 139, 102, 139, 6153 }, /* plum4 */ - { 176, 224, 230, 6159 }, /* powder blue */ - { 176, 224, 230, 6171 }, /* PowderBlue */ - { 160, 32, 240, 6182 }, /* purple */ - { 155, 48, 255, 6189 }, /* purple1 */ - { 145, 44, 238, 6197 }, /* purple2 */ - { 125, 38, 205, 6205 }, /* purple3 */ - { 85, 26, 139, 6213 }, /* purple4 */ - { 255, 0, 0, 6221 }, /* red */ - { 255, 0, 0, 6225 }, /* red1 */ - { 238, 0, 0, 6230 }, /* red2 */ - { 205, 0, 0, 6235 }, /* red3 */ - { 139, 0, 0, 6240 }, /* red4 */ - { 188, 143, 143, 6245 }, /* rosy brown */ - { 188, 143, 143, 6256 }, /* RosyBrown */ - { 255, 193, 193, 6266 }, /* RosyBrown1 */ - { 238, 180, 180, 6277 }, /* RosyBrown2 */ - { 205, 155, 155, 6288 }, /* RosyBrown3 */ - { 139, 105, 105, 6299 }, /* RosyBrown4 */ - { 65, 105, 225, 6310 }, /* royal blue */ - { 65, 105, 225, 6321 }, /* RoyalBlue */ - { 72, 118, 255, 6331 }, /* RoyalBlue1 */ - { 67, 110, 238, 6342 }, /* RoyalBlue2 */ - { 58, 95, 205, 6353 }, /* RoyalBlue3 */ - { 39, 64, 139, 6364 }, /* RoyalBlue4 */ - { 139, 69, 19, 6375 }, /* saddle brown */ - { 139, 69, 19, 6388 }, /* SaddleBrown */ - { 250, 128, 114, 6400 }, /* salmon */ - { 255, 140, 105, 6407 }, /* salmon1 */ - { 238, 130, 98, 6415 }, /* salmon2 */ - { 205, 112, 84, 6423 }, /* salmon3 */ - { 139, 76, 57, 6431 }, /* salmon4 */ - { 244, 164, 96, 6439 }, /* sandy brown */ - { 244, 164, 96, 6451 }, /* SandyBrown */ - { 46, 139, 87, 6462 }, /* sea green */ - { 46, 139, 87, 6472 }, /* SeaGreen */ - { 84, 255, 159, 6481 }, /* SeaGreen1 */ - { 78, 238, 148, 6491 }, /* SeaGreen2 */ - { 67, 205, 128, 6501 }, /* SeaGreen3 */ - { 46, 139, 87, 6511 }, /* SeaGreen4 */ - { 255, 245, 238, 6521 }, /* seashell */ - { 255, 245, 238, 6530 }, /* seashell1 */ - { 238, 229, 222, 6540 }, /* seashell2 */ - { 205, 197, 191, 6550 }, /* seashell3 */ - { 139, 134, 130, 6560 }, /* seashell4 */ - { 160, 82, 45, 6570 }, /* sienna */ - { 255, 130, 71, 6577 }, /* sienna1 */ - { 238, 121, 66, 6585 }, /* sienna2 */ - { 205, 104, 57, 6593 }, /* sienna3 */ - { 139, 71, 38, 6601 }, /* sienna4 */ - { 135, 206, 235, 6609 }, /* sky blue */ - { 135, 206, 235, 6618 }, /* SkyBlue */ - { 135, 206, 255, 6626 }, /* SkyBlue1 */ - { 126, 192, 238, 6635 }, /* SkyBlue2 */ - { 108, 166, 205, 6644 }, /* SkyBlue3 */ - { 74, 112, 139, 6653 }, /* SkyBlue4 */ - { 106, 90, 205, 6662 }, /* slate blue */ - { 112, 128, 144, 6673 }, /* slate gray */ - { 112, 128, 144, 6684 }, /* slate grey */ - { 106, 90, 205, 6695 }, /* SlateBlue */ - { 131, 111, 255, 6705 }, /* SlateBlue1 */ - { 122, 103, 238, 6716 }, /* SlateBlue2 */ - { 105, 89, 205, 6727 }, /* SlateBlue3 */ - { 71, 60, 139, 6738 }, /* SlateBlue4 */ - { 112, 128, 144, 6749 }, /* SlateGray */ - { 198, 226, 255, 6759 }, /* SlateGray1 */ - { 185, 211, 238, 6770 }, /* SlateGray2 */ - { 159, 182, 205, 6781 }, /* SlateGray3 */ - { 108, 123, 139, 6792 }, /* SlateGray4 */ - { 112, 128, 144, 6803 }, /* SlateGrey */ - { 255, 250, 250, 6813 }, /* snow */ - { 255, 250, 250, 6818 }, /* snow1 */ - { 238, 233, 233, 6824 }, /* snow2 */ - { 205, 201, 201, 6830 }, /* snow3 */ - { 139, 137, 137, 6836 }, /* snow4 */ - { 0, 255, 127, 6842 }, /* spring green */ - { 0, 255, 127, 6855 }, /* SpringGreen */ - { 0, 255, 127, 6867 }, /* SpringGreen1 */ - { 0, 238, 118, 6880 }, /* SpringGreen2 */ - { 0, 205, 102, 6893 }, /* SpringGreen3 */ - { 0, 139, 69, 6906 }, /* SpringGreen4 */ - { 70, 130, 180, 6919 }, /* steel blue */ - { 70, 130, 180, 6930 }, /* SteelBlue */ - { 99, 184, 255, 6940 }, /* SteelBlue1 */ - { 92, 172, 238, 6951 }, /* SteelBlue2 */ - { 79, 148, 205, 6962 }, /* SteelBlue3 */ - { 54, 100, 139, 6973 }, /* SteelBlue4 */ - { 210, 180, 140, 6984 }, /* tan */ - { 255, 165, 79, 6988 }, /* tan1 */ - { 238, 154, 73, 6993 }, /* tan2 */ - { 205, 133, 63, 6998 }, /* tan3 */ - { 139, 90, 43, 7003 }, /* tan4 */ - { 216, 191, 216, 7008 }, /* thistle */ - { 255, 225, 255, 7016 }, /* thistle1 */ - { 238, 210, 238, 7025 }, /* thistle2 */ - { 205, 181, 205, 7034 }, /* thistle3 */ - { 139, 123, 139, 7043 }, /* thistle4 */ - { 255, 99, 71, 7052 }, /* tomato */ - { 255, 99, 71, 7059 }, /* tomato1 */ - { 238, 92, 66, 7067 }, /* tomato2 */ - { 205, 79, 57, 7075 }, /* tomato3 */ - { 139, 54, 38, 7083 }, /* tomato4 */ - { 64, 224, 208, 7091 }, /* turquoise */ - { 0, 245, 255, 7101 }, /* turquoise1 */ - { 0, 229, 238, 7112 }, /* turquoise2 */ - { 0, 197, 205, 7123 }, /* turquoise3 */ - { 0, 134, 139, 7134 }, /* turquoise4 */ - { 238, 130, 238, 7145 }, /* violet */ - { 208, 32, 144, 7152 }, /* violet red */ - { 208, 32, 144, 7163 }, /* VioletRed */ - { 255, 62, 150, 7173 }, /* VioletRed1 */ - { 238, 58, 140, 7184 }, /* VioletRed2 */ - { 205, 50, 120, 7195 }, /* VioletRed3 */ - { 139, 34, 82, 7206 }, /* VioletRed4 */ - { 245, 222, 179, 7217 }, /* wheat */ - { 255, 231, 186, 7223 }, /* wheat1 */ - { 238, 216, 174, 7230 }, /* wheat2 */ - { 205, 186, 150, 7237 }, /* wheat3 */ - { 139, 126, 102, 7244 }, /* wheat4 */ - { 255, 255, 255, 7251 }, /* white */ - { 245, 245, 245, 7257 }, /* white smoke */ - { 245, 245, 245, 7269 }, /* WhiteSmoke */ - { 255, 255, 0, 7280 }, /* yellow */ - { 154, 205, 50, 7287 }, /* yellow green */ - { 255, 255, 0, 7300 }, /* yellow1 */ - { 238, 238, 0, 7308 }, /* yellow2 */ - { 205, 205, 0, 7316 }, /* yellow3 */ - { 139, 139, 0, 7324 }, /* yellow4 */ - { 154, 205, 50, 7332 }, /* YellowGreen */ -}; diff --git a/os/osdep.h b/os/osdep.h index 84f7177db..2f7bd7585 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -59,7 +59,6 @@ SOFTWARE. #include #ifndef sgi /* SGI defines OPEN_MAX in a useless way */ -#ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE #include #else @@ -67,13 +66,6 @@ SOFTWARE. #include #undef _POSIX_SOURCE #endif -#else /* X_NOT_POSIX */ -#ifdef WIN32 -#define _POSIX_ -#include -#undef _POSIX_ -#endif -#endif /* X_NOT_POSIX */ #endif #ifdef __QNX__ diff --git a/os/osinit.c b/os/osinit.c index 1bc8624dc..7a16c0b1d 100644 --- a/os/osinit.c +++ b/os/osinit.c @@ -67,11 +67,11 @@ SOFTWARE. #endif #endif -#if defined(Lynx) || defined(__SCO__) +#if defined(__SCO__) #include #endif -#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) +#if !defined(SYSV) && !defined(WIN32) && !defined(QNX4) #include #endif @@ -90,8 +90,6 @@ int limitStackSpace = -1; int limitNoFile = -1; #endif -Bool OsDelayInitColors = FALSE; - void OsInit(void) { @@ -143,15 +141,8 @@ OsInit(void) #endif } -#ifndef X_NOT_POSIX if (getpgrp () == 0) setpgid (0, 0); -#else -#if !defined(SYSV) && !defined(WIN32) - if (getpgrp (0) == 0) - setpgrp (0, getpid ()); -#endif -#endif #ifdef RLIMIT_DATA if (limitDataSpace >= 0) @@ -198,15 +189,11 @@ OsInit(void) } } #endif -#ifdef SERVER_LOCK LockServer(); -#endif been_here = TRUE; } TimerInit(); -#ifdef DDXOSINIT OsVendorInit(); -#endif /* * No log file by default. OsVendorInit() should call LogInit() with the * log file name if logging to a file is desired. @@ -218,16 +205,13 @@ OsInit(void) SmartScheduleDisable = TRUE; #endif OsInitAllocator(); - if (!OsDelayInitColors) OsInitColors(); } void OsCleanup(Bool terminating) { -#ifdef SERVER_LOCK if (terminating) { UnlockServer(); } -#endif } diff --git a/os/rpcauth.c b/os/rpcauth.c index 3451ac18b..1a27c5882 100644 --- a/os/rpcauth.c +++ b/os/rpcauth.c @@ -42,6 +42,7 @@ from The Open Group. #include #include "misc.h" #include "os.h" +#include "osdep.h" #include "dixstruct.h" #include @@ -51,16 +52,6 @@ from The Open Group. extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *); #endif -#if defined(DGUX) -#include -#include -#endif /* DGUX */ - -#ifdef ultrix -#include -#include -#endif - static enum auth_stat why; static char * diff --git a/os/utils.c b/os/utils.c index e885666ee..67ab6d93d 100644 --- a/os/utils.c +++ b/os/utils.c @@ -83,7 +83,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #include #undef _POSIX_C_SOURCE #else -#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) +#if defined(_POSIX_SOURCE) #include #else #define _POSIX_SOURCE @@ -94,18 +94,13 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifndef WIN32 #include #endif -#if !defined(SYSV) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) +#if !defined(SYSV) && !defined(WIN32) && !defined(QNX4) #include #endif #include #include /* for isspace */ #include -#if defined(DGUX) -#include -#include -#endif - #include /* for malloc() */ #if defined(TCPCONN) || defined(STREAMSCONN) @@ -145,9 +140,6 @@ _X_EXPORT Bool noDbeExtension = FALSE; #ifdef DPMSExtension _X_EXPORT Bool noDPMSExtension = FALSE; #endif -#ifdef FONTCACHE -_X_EXPORT Bool noFontCacheExtension = FALSE; -#endif #ifdef GLXEXT _X_EXPORT Bool noGlxExtension = FALSE; _X_EXPORT Bool noGlxVisualInit = FALSE; @@ -196,9 +188,6 @@ _X_EXPORT Bool noXFree86DGAExtension = FALSE; #ifdef XF86DRI _X_EXPORT Bool noXFree86DRIExtension = FALSE; #endif -#ifdef XF86MISC -_X_EXPORT Bool noXFree86MiscExtension = FALSE; -#endif #ifdef XF86VIDMODE _X_EXPORT Bool noXFree86VidModeExtension = FALSE; #endif @@ -264,9 +253,6 @@ OsSignal(sig, handler) int sig; OsSigHandlerPtr handler; { -#ifdef X_NOT_POSIX - return signal(sig, handler); -#else struct sigaction act, oact; sigemptyset(&act.sa_mask); @@ -277,10 +263,8 @@ OsSignal(sig, handler) if (sigaction(sig, &act, &oact)) perror("sigaction"); return oact.sa_handler; -#endif } - -#ifdef SERVER_LOCK + /* * Explicit support for a server lock file like the ones used for UUCP. * For architectures with virtual terminals that can run more than one @@ -292,17 +276,8 @@ OsSignal(sig, handler) #define LOCK_PREFIX "/.X" #define LOCK_SUFFIX "-lock" -#if defined(DGUX) -#include -#include -#endif - #ifndef PATH_MAX -#ifndef Lynx #include -#else -#include -#endif #ifndef PATH_MAX #ifdef MAXPATHLEN #define PATH_MAX MAXPATHLEN @@ -376,11 +351,7 @@ LockServer(void) FatalError("Could not create lock file in %s\n", tmp); (void) sprintf(pid_str, "%10ld\n", (long)getpid()); (void) write(lfd, pid_str, 11); -#ifndef USE_CHMOD - (void) fchmod(lfd, 0444); -#else (void) chmod(tmp, 0444); -#endif (void) close(lfd); /* @@ -462,7 +433,6 @@ UnlockServer(void) (void) unlink(LockFile); } } -#endif /* SERVER_LOCK */ /* Force connections to close on SIGHUP from init */ @@ -474,13 +444,6 @@ AutoResetServer (int sig) dispatchException |= DE_RESET; isItTimeToYield = TRUE; -#ifdef GPROF - chdir ("/tmp"); - exit (0); -#endif -#if defined(SYSV) && defined(X_NOT_POSIX) - OsSignal (SIGHUP, AutoResetServer); -#endif errno = olderrno; } @@ -494,10 +457,6 @@ GiveUp(int sig) dispatchException |= DE_TERMINATE; isItTimeToYield = TRUE; -#if defined(SYSV) && defined(X_NOT_POSIX) - if (sig) - OsSignal(sig, SIG_IGN); -#endif errno = olderrno; } @@ -565,9 +524,6 @@ void UseMsg(void) ErrorF("-c turns off key-click\n"); ErrorF("c # key-click volume (0-100)\n"); ErrorF("-cc int default color visual class\n"); -#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS - ErrorF("-config file read options from file\n"); -#endif ErrorF("-core generate core dump on fatal error\n"); ErrorF("-dpi int screen resolution in dots per inch\n"); #ifdef DPMSExtension @@ -1092,118 +1048,6 @@ ProcessCommandLine(int argc, char *argv[]) } } -#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS -static void -InsertFileIntoCommandLine( - int *resargc, char ***resargv, - int prefix_argc, char **prefix_argv, - char *filename, - int suffix_argc, char **suffix_argv) -{ - struct stat st; - FILE *f; - char *p; - char *q; - int insert_argc; - char *buf; - int len; - int i; - - f = fopen(filename, "r"); - if (!f) - FatalError("Can't open option file %s\n", filename); - - fstat(fileno(f), &st); - - buf = (char *) xalloc((unsigned) st.st_size + 1); - if (!buf) - FatalError("Out of Memory\n"); - - len = fread(buf, 1, (unsigned) st.st_size, f); - - fclose(f); - - if (len < 0) - FatalError("Error reading option file %s\n", filename); - - buf[len] = '\0'; - - p = buf; - q = buf; - insert_argc = 0; - - while (*p) - { - while (isspace(*p)) - p++; - if (!*p) - break; - if (*p == '#') - { - while (*p && *p != '\n') - p++; - } else - { - while (*p && !isspace(*p)) - *q++ = *p++; - /* Since p and q might still be pointing at the same place, we */ - /* need to step p over the whitespace now before we add the null. */ - if (*p) - p++; - *q++ = '\0'; - insert_argc++; - } - } - - buf = (char *) xrealloc(buf, q - buf); - if (!buf) - FatalError("Out of memory reallocing option buf\n"); - - *resargc = prefix_argc + insert_argc + suffix_argc; - *resargv = (char **) xalloc((*resargc + 1) * sizeof(char *)); - if (!*resargv) - FatalError("Out of Memory\n"); - - memcpy(*resargv, prefix_argv, prefix_argc * sizeof(char *)); - - p = buf; - for (i = 0; i < insert_argc; i++) - { - (*resargv)[prefix_argc + i] = p; - p += strlen(p) + 1; - } - - memcpy(*resargv + prefix_argc + insert_argc, - suffix_argv, suffix_argc * sizeof(char *)); - - (*resargv)[*resargc] = NULL; -} /* end InsertFileIntoCommandLine */ - - -void -ExpandCommandLine(int *pargc, char ***pargv) -{ - int i; - -#if !defined(WIN32) && !defined(__CYGWIN__) - if (getuid() != geteuid()) - return; -#endif - - for (i = 1; i < *pargc; i++) - { - if ( (0 == strcmp((*pargv)[i], "-config")) && (i < (*pargc - 1)) ) - { - InsertFileIntoCommandLine(pargc, pargv, - i, *pargv, - (*pargv)[i+1], /* filename */ - *pargc - i - 2, *pargv + i + 2); - i--; - } - } -} /* end ExpandCommandLine */ -#endif - /* Implement a simple-minded font authorization scheme. The authorization name is "hp-hostname-1", the contents are simply the host name. */ int diff --git a/os/xdmauth.c b/os/xdmauth.c index d143ddefc..8cbcd581f 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -69,7 +69,7 @@ XdmAuthenticationValidator (ARRAY8Ptr privateData, ARRAY8Ptr incomingData, { XdmAuthKeyPtr incoming; - XdmcpUnwrap (incomingData->data, &privateKey, + XdmcpUnwrap (incomingData->data, (unsigned char *)&privateKey, incomingData->data,incomingData->length); if (packet_type == ACCEPT) { if (incomingData->length != 8) @@ -89,7 +89,8 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData, outgoingData->data = 0; if (packet_type == REQUEST) { if (XdmcpAllocARRAY8 (outgoingData, 8)) - XdmcpWrap (&rho, &privateKey, outgoingData->data, 8); + XdmcpWrap ((unsigned char *)&rho, (unsigned char *)&privateKey, + outgoingData->data, 8); } return TRUE; } @@ -99,7 +100,8 @@ XdmAuthenticationAddAuth (int name_len, char *name, int data_len, char *data) { Bool ret; - XdmcpUnwrap (data, (unsigned char *)&privateKey, data, data_len); + XdmcpUnwrap ((unsigned char *)data, (unsigned char *)&privateKey, + (unsigned char *)data, data_len); authFromXDMCP = TRUE; ret = AddAuthorization (name_len, name, data_len, data); authFromXDMCP = FALSE; @@ -152,7 +154,7 @@ XdmAuthenticationInit (char *cookie, int cookie_len) } XdmcpGenerateKey (&rho); XdmcpRegisterAuthentication (XdmAuthenticationName, XdmAuthenticationNameLen, - (unsigned char *)&rho, + (char *)&rho, sizeof (rho), (ValidatorFunc)XdmAuthenticationValidator, (GeneratorFunc)XdmAuthenticationGenerator, @@ -387,7 +389,7 @@ XdmCheckCookie (unsigned short cookie_length, char *cookie, if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { - XdmcpUnwrap (cookie, (unsigned char *)&auth->key, plain, cookie_length); + XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) != NULL) { client->next = xdmClients; @@ -432,7 +434,7 @@ XdmToID (unsigned short cookie_length, char *cookie) if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { - XdmcpUnwrap (cookie, (unsigned char *)&auth->key, plain, cookie_length); + XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL) { xfree (client); diff --git a/os/xdmcp.c b/os/xdmcp.c index d896c8ba3..736cd3e11 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -24,12 +24,8 @@ #include #if !defined(WIN32) -#ifndef Lynx #include #include -#else -#include -#endif #include #include #endif @@ -46,11 +42,6 @@ #include "opaque.h" #include "site.h" -#if defined(DGUX) -#include -#include -#endif - #ifdef STREAMSCONN #include #include diff --git a/randr/randrstr.h b/randr/randrstr.h index 598ced698..c3bef7fb7 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -420,6 +420,11 @@ miRROutputSetProperty (ScreenPtr pScreen, Atom property, RRPropertyValuePtr value); +Bool +miRROutputGetProperty (ScreenPtr pScreen, + RROutputPtr output, + Atom property); + Bool miRROutputValidateMode (ScreenPtr pScreen, RROutputPtr output, diff --git a/randr/rrpointer.c b/randr/rrpointer.c index e3b8b0395..6b934c0c6 100644 --- a/randr/rrpointer.c +++ b/randr/rrpointer.c @@ -136,14 +136,11 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y) void RRPointerScreenConfigured (ScreenPtr pScreen) { - WindowPtr pRoot; + WindowPtr pRoot; ScreenPtr pCurrentScreen; int x, y; DeviceIntPtr pDev; - if (pScreen != pCurrentScreen) - return; - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (IsPointerDevice(pDev)) diff --git a/render/picture.c b/render/picture.c index e42eec1db..7920c51b4 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1558,12 +1558,24 @@ FreePictFormat (pointer pPictFormat, * being careful to avoid these cases. */ static CARD8 -ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst) +ReduceCompositeOp (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, CARD16 width, CARD16 height) { Bool no_src_alpha, no_dst_alpha; + /* Sampling off the edge of a RepeatNone picture introduces alpha + * even if the picture itself doesn't have alpha. We don't try to + * detect every case where we don't sample off the edge, just the + * simplest case where there is no transform on the source + * picture. + */ no_src_alpha = PICT_FORMAT_COLOR(pSrc->format) && PICT_FORMAT_A(pSrc->format) == 0 && + (pSrc->repeatType != RepeatNone || + (!pSrc->transform && + xSrc >= 0 && ySrc >= 0 && + xSrc + width <= pSrc->pDrawable->width && + ySrc + height <= pSrc->pDrawable->height)) && pSrc->alphaMap == NULL && pMask == NULL; no_dst_alpha = PICT_FORMAT_COLOR(pDst->format) && @@ -1665,7 +1677,7 @@ CompositePicture (CARD8 op, ValidatePicture (pMask); ValidatePicture (pDst); - op = ReduceCompositeOp (op, pSrc, pMask, pDst); + op = ReduceCompositeOp (op, pSrc, pMask, pDst, xSrc, ySrc, width, height); if (op == PictOpDst) return; diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 85415a4c9..eb5c38133 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -473,7 +473,7 @@ register int i; int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups]; if ((!xkb) || (!XkbKeycodeInRange(xkb,key)) || (!xkb->map) || - (!xkb->map->types)||(!newTypes)||((groups&XkbAllGroupsMask)==0)|| + (!xkb->map->types)||((groups&XkbAllGroupsMask)==0)|| (nGroups>XkbNumKbdGroups)) { return BadMatch; } diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index ade13c3af..d6b5f7589 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -351,7 +351,7 @@ unsigned missing; (names->compat==NULL)&&(names->symbols==NULL)&& (names->geometry==NULL)) { LogMessage(X_ERROR, "XKB: No components provided for device %s\n", - keybd->name); + keybd->name ? keybd->name : "(unnamed keyboard)"); return 0; } else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 28107d05d..3f45e23c1 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "inputstr.h" #include -#if !defined(WIN32) && !defined(Lynx) +#if !defined(WIN32) #include #endif @@ -309,15 +309,14 @@ AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg) DeviceIntPtr dev = (DeviceIntPtr) arg; XkbSrvInfoPtr xkbi = dev->key->xkbInfo; KeyCode key; -BOOL is_core; if (xkbi->repeatKey == 0) return 0; - is_core = (dev == inputInfo.keyboard); key = xkbi->repeatKey; AccessXKeyboardEvent(dev, DeviceKeyRelease, key, True); AccessXKeyboardEvent(dev, DeviceKeyPress, key, True); + return xkbi->desc->ctrls->repeat_interval; } diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 41b4e4c8e..8a2682562 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -1045,7 +1045,7 @@ int button; switch (pAction->type) { case XkbSA_LockDeviceBtn: if ((pAction->devbtn.flags&XkbSA_LockNoLock)|| - (dev->button->down[button/8]&(1L<<(button%8)))) + (dev->button->down[button])) return 0; XkbDDXFakeDeviceButton(dev,True,button); filter->upAction.type= XkbSA_NoAction; @@ -1077,7 +1077,7 @@ int button; switch (filter->upAction.type) { case XkbSA_LockDeviceBtn: if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)|| - ((dev->button->down[button/8]&(1L<<(button%8)))==0)) + ((dev->button->down[button])==0)) return 0; XkbDDXFakeDeviceButton(dev,False,button); break; diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 6389b906f..047efcdfb 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -882,14 +882,13 @@ XkbSrvInfoPtr xkbi; ((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)|| (xE[i].u.u.type==DeviceKeyPress)|| (xE[i].u.u.type == DeviceKeyRelease))) { - XkbStatePtr s= &xkbi->state; DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n"); DebugF("[xkb] event= 0x%04x\n",xE[i].u.keyButtonPointer.state); - DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, - s->grab_mods); + DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",xkbi->state.lookup_mods, + xkbi->state.grab_mods); DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n", - s->compat_lookup_mods, - s->compat_grab_mods); + xkbi->state.compat_lookup_mods, + xkbi->state.compat_grab_mods); } if ( (type>=KeyPress)&&(type<=MotionNotify) ) { CARD16 old,new; diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 0aaa037cb..8043f5aa9 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -62,7 +62,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define PHYS_LEDS 0x7f #define LED_COMPOSE 8 #else -#if defined(ultrix) || defined(__osf__) || defined(__alpha) || defined(__alpha__) +#if defined(__osf__) || defined(__alpha) || defined(__alpha__) #define LED_COMPOSE 2 #define LED_CAPS 3 #define LED_SCROLL 4