diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-05-20 10:20:14 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-05-20 10:20:14 +0930 |
commit | 99d28c3ef37aeffe7d8ec41e45a650ba248c6958 (patch) | |
tree | f64efb86b1bc5f0c864d6a4ad0d79291f96b1c15 | |
parent | fc7e2566cc076c0d979f74871bc436df43401058 (diff) | |
parent | 0178b6a4abed0df3e90ba393709ed566105e7c2c (diff) |
Merge branch 'master' into mpx
Conflicts:
Xext/xprint.c (removed in master)
config/hal.c
dix/main.c
hw/kdrive/ati/ati_cursor.c (removed in master)
hw/kdrive/i810/i810_cursor.c (removed in master)
hw/xprint/ddxInit.c (removed in master)
xkb/ddxLoad.c
763 files changed, 4494 insertions, 104250 deletions
diff --git a/.gitignore b/.gitignore index a6925d98f..13d5de4fd 100644 --- a/.gitignore +++ b/.gitignore @@ -278,8 +278,13 @@ hw/xprint/doc/Xprt.1x hw/xprint/doc/Xprt.man hw/xprint/dpmsstubs-wrapper.c hw/xprint/miinitext-wrapper.c -hw/xquartz/xpr/Xquartz -hw/xquartz/xpr/Xquartz.1 +hw/xquartz/mach-startup/mach_startup.h +hw/xquartz/mach-startup/mach_startupServer.c +hw/xquartz/mach-startup/mach_startupServer.h +hw/xquartz/mach-startup/mach_startupUser.c +hw/xquartz/mach-startup/X11 +hw/xquartz/mach-startup/Xquartz +hw/xquartz/doc/Xquartz.1 include/dix-config.h include/kdrive-config.h include/xgl-config.h diff --git a/Xext/Makefile.am b/Xext/Makefile.am index 42aa279d8..484fe2605 100644 --- a/Xext/Makefile.am +++ b/Xext/Makefile.am @@ -99,12 +99,6 @@ if XEVIE BUILTIN_SRCS += $(XEVIE_SRCS) endif -# XPrint: Printing via X Protocol -XPRINT_SRCS = xprint.c -if XPRINT -BUILTIN_SRCS += $(XPRINT_SRCS) -endif - # Multi-buffering extension MULTIBUFFER_SRCS = mbuf.c EXTRA_MULTIBUFFER_SRCS = mbufbf.c mbufpx.c @@ -150,7 +144,6 @@ EXTRA_DIST = \ $(XCALIBRATE_SRCS) \ $(XINERAMA_SRCS) \ $(XEVIE_SRCS) \ - $(XPRINT_SRCS) \ $(MULTIBUFFER_SRCS) \ $(EXTRA_MULTIBUFFER_SRCS) \ $(FONTCACHE_SRCS) \ diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 5fcaeb35f..17815a663 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -87,6 +87,9 @@ _X_EXPORT unsigned long XRT_PIXMAP; _X_EXPORT unsigned long XRT_GC; _X_EXPORT unsigned long XRT_COLORMAP; +static Bool VisualsEqual(VisualPtr, ScreenPtr, VisualPtr); +_X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr = &VisualsEqual; + /* * Function prototypes */ @@ -668,10 +671,10 @@ Bool PanoramiXCreateConnectionBlock(void) connSetupPrefix.length = length >> 2; - xfree(PanoramiXVisuals); for (i = 0; i < PanoramiXNumDepths; i++) xfree(PanoramiXDepths[i].vids); xfree(PanoramiXDepths); + PanoramiXDepths = NULL; /* * OK, change some dimensions so it looks as if it were one big screen @@ -709,7 +712,7 @@ Bool PanoramiXCreateConnectionBlock(void) * do their own back-mapping. */ static Bool -VisualsEqual(VisualPtr a, VisualPtr b) +VisualsEqual(VisualPtr a, ScreenPtr pScreenB, VisualPtr b) { return ((a->class == b->class) && (a->ColormapEntries == b->ColormapEntries) && @@ -759,7 +762,6 @@ static void PanoramiXMaybeAddVisual(VisualPtr pVisual) { ScreenPtr pScreen; - VisualPtr candidate = NULL; int j, k; Bool found = FALSE; @@ -767,10 +769,10 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual) pScreen = screenInfo.screens[j]; found = FALSE; - candidate = pScreen->visuals; for (k = 0; k < pScreen->numVisuals; k++) { - candidate++; - if (VisualsEqual(pVisual, candidate) + VisualPtr candidate = &pScreen->visuals[k]; + + if ((*XineramaVisualsEqualPtr)(pVisual, pScreen, candidate) #ifdef GLXPROXY && glxMatchVisual(screenInfo.screens[0], pVisual, pScreen) #endif @@ -844,8 +846,13 @@ PanoramiXConsolidate(void) _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig) { + ScreenPtr pOtherScreen = screenInfo.screens[screen]; VisualPtr pVisual = NULL; - int i, j; + int i; + + /* if screen is 0, orig is already the correct visual ID */ + if (screen == 0) + return orig; for (i = 0; i < PanoramiXNumVisuals; i++) { if (orig == PanoramiXVisuals[i].vid) { @@ -858,11 +865,13 @@ PanoramiXTranslateVisualID(int screen, VisualID orig) return 0; /* found the original, now translate it relative to the backend screen */ - for (i = 0; i < PanoramiXNumScreens; i++) - for (j = 0; j < screenInfo.screens[i]->numVisuals; j++) - if (VisualsEqual(pVisual, &screenInfo.screens[i]->visuals[j])) - return screenInfo.screens[i]->visuals[j].vid; - + for (i = 0; i < pOtherScreen->numVisuals; i++) { + VisualPtr pOtherVisual = &pOtherScreen->visuals[i]; + + if ((*XineramaVisualsEqualPtr)(pVisual, pOtherScreen, pOtherVisual)) + return pOtherVisual->vid; + } + return 0; } diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h index 6d556e963..d5c3d9827 100644 --- a/Xext/panoramiXsrv.h +++ b/Xext/panoramiXsrv.h @@ -30,6 +30,16 @@ extern unsigned long XRT_PIXMAP; extern unsigned long XRT_GC; extern unsigned long XRT_COLORMAP; +/* + * Drivers are allowed to wrap this function. Each wrapper can decide that the + * two visuals are unequal, but if they are deemed equal, the wrapper must call + * down and return FALSE if the wrapped function does. This ensures that all + * layers agree that the visuals are equal. The first visual is always from + * screen 0. + */ +typedef Bool (*XineramaVisualsEqualProcPtr)(VisualPtr, ScreenPtr, VisualPtr); +extern XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr; + extern void XineramaGetImageData( DrawablePtr *pDrawables, int left, diff --git a/Xext/xprint.c b/Xext/xprint.c deleted file mode 100644 index 71bde1112..000000000 --- a/Xext/xprint.c +++ /dev/null @@ -1,2617 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/******************************************************************* -** -** ********************************************************* -** * -** * File: xprint.c -** * -** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company -** * -** * Copyright 1989 by The Massachusetts Institute of Technology -** * -** * 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 MIT not be used in -** * advertising or publicity pertaining to distribution of the -** * software without specific prior written permission. -** * M.I.T. makes no representation about the suitability of -** * this software for any purpose. It is provided "as is" -** * without any express or implied warranty. -** * -** * MIT 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 MIT 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. -** * -** ********************************************************* -** -********************************************************************/ - -#define _XP_PRINT_SERVER_ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xos.h> -#define NEED_EVENTS -#include <X11/Xproto.h> -#undef NEED_EVENTS -#include "misc.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "extnsionst.h" -#include "dixstruct.h" -#include <X11/Xatom.h> -#include <X11/extensions/Print.h> -#include <X11/extensions/Printstr.h> -#include "../hw/xprint/DiPrint.h" -#include "../hw/xprint/attributes.h" -#include "modinit.h" - -static void XpResetProc(ExtensionEntry *); - -static int ProcXpDispatch(ClientPtr); -static int ProcXpSwappedDispatch(ClientPtr); - -static int ProcXpQueryVersion(ClientPtr); -static int ProcXpGetPrinterList(ClientPtr); -static int ProcXpCreateContext(ClientPtr); -static int ProcXpSetContext(ClientPtr); -static int ProcXpGetContext(ClientPtr); -static int ProcXpDestroyContext(ClientPtr); -static int ProcXpGetContextScreen(ClientPtr); -static int ProcXpStartJob(ClientPtr); -static int ProcXpEndJob(ClientPtr); -static int ProcXpStartDoc(ClientPtr); -static int ProcXpEndDoc(ClientPtr); -static int ProcXpStartPage(ClientPtr); -static int ProcXpEndPage(ClientPtr); -static int ProcXpSelectInput(ClientPtr); -static int ProcXpInputSelected(ClientPtr); -static int ProcXpPutDocumentData(ClientPtr); -static int ProcXpGetDocumentData(ClientPtr); -static int ProcXpGetAttributes(ClientPtr); -static int ProcXpGetOneAttribute(ClientPtr); -static int ProcXpSetAttributes(ClientPtr); -static int ProcXpRehashPrinterList(ClientPtr); -static int ProcXpQueryScreens(ClientPtr); -static int ProcXpGetPageDimensions(ClientPtr); -static int ProcXpSetImageResolution(ClientPtr); -static int ProcXpGetImageResolution(ClientPtr); - -static void SwapXpNotifyEvent(xPrintPrintEvent *, xPrintPrintEvent *); -static void SwapXpAttributeEvent(xPrintAttributeEvent *, xPrintAttributeEvent *); - -static int SProcXpGetPrinterList(ClientPtr); -static int SProcXpCreateContext(ClientPtr); -static int SProcXpSetContext(ClientPtr); -static int SProcXpGetContext(ClientPtr); -static int SProcXpDestroyContext(ClientPtr); -static int SProcXpGetContextScreen(ClientPtr); -static int SProcXpStartJob(ClientPtr); -static int SProcXpEndJob(ClientPtr); -static int SProcXpStartDoc(ClientPtr); -static int SProcXpEndDoc(ClientPtr); -static int SProcXpStartPage(ClientPtr); -static int SProcXpEndPage(ClientPtr); -static int SProcXpSelectInput(ClientPtr); -static int SProcXpInputSelected(ClientPtr); -static int SProcXpPutDocumentData(ClientPtr); -static int SProcXpGetDocumentData(ClientPtr); -static int SProcXpGetAttributes(ClientPtr); -static int SProcXpGetOneAttribute(ClientPtr); -static int SProcXpSetAttributes(ClientPtr); -static int SProcXpRehashPrinterList(ClientPtr); -static int SProcXpGetPageDimensions(ClientPtr); -static int SProcXpSetImageResolution(ClientPtr); -static int SProcXpGetImageResolution(ClientPtr); - -static void SendXpNotify(XpContextPtr, int, int); -static void SendAttributeNotify(XpContextPtr, int); -static int XpFreeClient(pointer, XID); -static int XpFreeContext(pointer, XID); -static int XpFreePage(pointer, XID); -static Bool XpCloseScreen(int, ScreenPtr); -static CARD32 GetAllEventMasks(XpContextPtr); -static struct _XpClient *CreateXpClient(ClientPtr); -static struct _XpClient *FindClient(XpContextPtr, ClientPtr); -static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr); - -typedef struct _driver { - struct _driver *next; - char *name; - int (* CreateContext)(XpContextPtr); -} XpDriverRec, *XpDriverPtr; - -typedef struct _xpScreen { - Bool (* CloseScreen)(int, ScreenPtr); - struct _driver *drivers; -} XpScreenRec, *XpScreenPtr; - -/* - * Each context has a list of XpClients indicating which clients have - * associated this context with their connection. - * Each such client has a RTclient resource allocated for it, - * and this per-client - * resource is used to delete the XpClientRec if/when the client closes - * its connection. - * The list of XpClients is also walked if/when the context is destroyed - * so that the ContextPtr can be removed from the client's devPrivates. - */ -typedef struct _XpClient { - struct _XpClient *pNext; - ClientPtr client; - XpContextPtr context; - CARD32 eventMask; - XID contextClientID; /* unneeded sanity check? */ -} XpClientRec, *XpClientPtr; - -static void FreeXpClient(XpClientPtr, Bool); - -/* - * Each StartPage request specifies a window which forms the top level - * window of the page. One of the following structs is created as a - * RTpage resource with the same ID as the window itself. This enables - * us to clean up when/if the window is destroyed, and to prevent the - * same window from being simultaneously referenced in multiple contexts. - * The page resource is created at the first StartPage on a given window, - * and is only destroyed when/if the window is destroyed. When the - * EndPage is recieved (or an EndDoc or EndJob) the context field is - * set to NULL, but the resource remains alive. - */ -typedef struct _XpPage { - XpContextPtr context; -} XpPageRec, *XpPagePtr; - -typedef struct _XpStPageRec { - XpContextPtr pContext; - Bool slept; - XpPagePtr pPage; - WindowPtr pWin; -} XpStPageRec, *XpStPagePtr; - -typedef struct _XpStDocRec { - XpContextPtr pContext; - Bool slept; - CARD8 type; -} XpStDocRec, *XpStDocPtr; - -#define QUADPAD(x) ((((x)+3)>>2)<<2) - -/* - * Possible bit-mask values in the "state" field of a XpContextRec. - */ -#define JOB_STARTED (1 << 0) -#define DOC_RAW_STARTED (1 << 1) -#define DOC_COOKED_STARTED (1 << 2) -#define PAGE_STARTED (1 << 3) -#define GET_DOC_DATA_STARTED (1 << 4) -#define JOB_GET_DATA (1 << 5) - -static XpScreenPtr XpScreens[MAXSCREENS]; -static unsigned char XpReqCode; -static int XpEventBase; -static int XpErrorBase; -static DevPrivateKey XpClientPrivateKey = &XpClientPrivateKey; - -#define XP_GETPRIV(pClient) ((XpContextPtr) \ - dixLookupPrivate(&(pClient)->devPrivates, XpClientPrivateKey)) -#define XP_SETPRIV(pClient, p) \ - dixSetPrivate(&(pClient)->devPrivates, XpClientPrivateKey, p) - -/* - * There are three types of resources involved. One is the resource associated - * with the context itself, with an ID specified by a printing client. The - * next is a resource created by us on the client's behalf (and unknown to - * the client) when a client inits or sets a context which allows us to - * track each client's interest in events - * on a particular context, and also allows us to clean up this interest - * record when/if the client's connection is closed. Finally, there is - * a resource created for each window that's specified in a StartPage. This - * resource carries the same ID as the window itself, and enables us to - * easily prevent the same window being referenced in multiple contexts - * simultaneously, and enables us to clean up if the window is destroyed - * before the EndPage. - */ -static RESTYPE RTclient, RTcontext, RTpage; - -/* - * allEvents is the OR of all the legal event mask bits. - */ -static CARD32 allEvents = XPPrintMask | XPAttributeMask; - - -/******************************************************************************* - * - * ExtensionInit, Driver Init functions, QueryVersion, and Dispatch procs - * - ******************************************************************************/ - -/* - * XpExtensionInit - * - * Called from InitExtensions in main() usually through miinitextension - * - */ - -void -XpExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - int i; - - RTclient = CreateNewResourceType(XpFreeClient); - RTcontext = CreateNewResourceType(XpFreeContext); - RTpage = CreateNewResourceType(XpFreePage); - if (RTclient && RTcontext && RTpage && - (extEntry = AddExtension(XP_PRINTNAME, XP_EVENTS, XP_ERRORS, - ProcXpDispatch, ProcXpSwappedDispatch, - XpResetProc, StandardMinorOpcode))) - { - XpReqCode = (unsigned char)extEntry->base; - XpEventBase = extEntry->eventBase; - XpErrorBase = extEntry->errorBase; - EventSwapVector[XpEventBase] = (EventSwapPtr) SwapXpNotifyEvent; - EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent; - } - - for(i = 0; i < MAXSCREENS; i++) - { - /* - * If a screen has registered with our extension, then we - * wrap the screen's CloseScreen function to allow us to - * reset our ContextPrivate stuff. Note that this - * requires a printing DDX to call XpRegisterInitFunc - * _before_ this extension is initialized - i.e. at screen init - * time, _not_ at root window creation time. - */ - if(XpScreens[i] != (XpScreenPtr)NULL) - { - XpScreens[i]->CloseScreen = screenInfo.screens[i]->CloseScreen; - screenInfo.screens[i]->CloseScreen = XpCloseScreen; - } - } -} - -static void -XpResetProc(ExtensionEntry *extEntry) -{ - /* - * We can't free up the XpScreens recs here, because extensions are - * closed before screens, and our CloseScreen function uses the XpScreens - * recs. - - int i; - - for(i = 0; i < MAXSCREENS; i++) - { - if(XpScreens[i] != (XpScreenPtr)NULL) - Xfree(XpScreens[i]); - XpScreens[i] = (XpScreenPtr)NULL; - } - */ -} - -static Bool -XpCloseScreen(int index, ScreenPtr pScreen) -{ - Bool (* CloseScreen)(int, ScreenPtr); - - CloseScreen = XpScreens[index]->CloseScreen; - if(XpScreens[index] != (XpScreenPtr)NULL) - { - XpDriverPtr pDriv, nextDriv; - - pDriv = XpScreens[index]->drivers; - while(pDriv != (XpDriverPtr)NULL) - { - nextDriv = pDriv->next; - Xfree(pDriv); - pDriv = nextDriv; - } - Xfree(XpScreens[index]); - } - XpScreens[index] = (XpScreenPtr)NULL; - - return (*CloseScreen)(index, pScreen); -} - -/* - * XpRegisterInitFunc tells the print extension which screens - * are printers as opposed to displays, and what drivers are - * supported on each screen. This eliminates the need of - * allocating print-related private structures on windows on _all_ screens. - * It also hands the extension a pointer to the routine to be called - * whenever a context gets created for a particular driver on this screen. - */ -void -XpRegisterInitFunc(ScreenPtr pScreen, char *driverName, int (*initContext)(struct _XpContext *)) -{ - XpDriverPtr pDriver; - - if(XpScreens[pScreen->myNum] == 0) - { - if((XpScreens[pScreen->myNum] = - (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == 0) - return; - XpScreens[pScreen->myNum]->CloseScreen = 0; - XpScreens[pScreen->myNum]->drivers = 0; - } - - if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) == 0) - return; - pDriver->next = XpScreens[pScreen->myNum]->drivers; - pDriver->name = driverName; - pDriver->CreateContext = initContext; - XpScreens[pScreen->myNum]->drivers = pDriver; -} - -static int -ProcXpDispatch(ClientPtr client) -{ - REQUEST(xReq); - - switch(stuff->data) - { - case X_PrintQueryVersion: - return ProcXpQueryVersion(client); - case X_PrintGetPrinterList: - return ProcXpGetPrinterList(client); - case X_PrintCreateContext: - return ProcXpCreateContext(client); - case X_PrintSetContext: - return ProcXpSetContext(client); - case X_PrintGetContext: - return ProcXpGetContext(client); - case X_PrintDestroyContext: - return ProcXpDestroyContext(client); - case X_PrintGetContextScreen: - return ProcXpGetContextScreen(client); - case X_PrintStartJob: - return ProcXpStartJob(client); - case X_PrintEndJob: - return ProcXpEndJob(client); - case X_PrintStartDoc: - return ProcXpStartDoc(client); - case X_PrintEndDoc: - return ProcXpEndDoc(client); - case X_PrintStartPage: - return ProcXpStartPage(client); - case X_PrintEndPage: - return ProcXpEndPage(client); - case X_PrintSelectInput: - return ProcXpSelectInput(client); - case X_PrintInputSelected: - return ProcXpInputSelected(client); - case X_PrintPutDocumentData: - return ProcXpPutDocumentData(client); - case X_PrintGetDocumentData: - return ProcXpGetDocumentData(client); - case X_PrintSetAttributes: - return ProcXpSetAttributes(client); - case X_PrintGetAttributes: - return ProcXpGetAttributes(client); - case X_PrintGetOneAttribute: - return ProcXpGetOneAttribute(client); - case X_PrintRehashPrinterList: - return ProcXpRehashPrinterList(client); - case X_PrintQueryScreens: - return ProcXpQueryScreens(client); - case X_PrintGetPageDimensions: - return ProcXpGetPageDimensions(client); - case X_PrintSetImageResolution: - return ProcXpSetImageResolution(client); - case X_PrintGetImageResolution: - return ProcXpGetImageResolution(client); - default: - return BadRequest; - } -} - -static int -ProcXpSwappedDispatch(ClientPtr client) -{ - int temp; - REQUEST(xReq); - - switch(stuff->data) - { - case X_PrintQueryVersion: - swaps(&stuff->length, temp); - return ProcXpQueryVersion(client); - case X_PrintGetPrinterList: - return SProcXpGetPrinterList(client); - case X_PrintCreateContext: - return SProcXpCreateContext(client); - case X_PrintSetContext: - return SProcXpSetContext(client); - case X_PrintGetContext: - return SProcXpGetContext(client); - case X_PrintDestroyContext: - return SProcXpDestroyContext(client); - case X_PrintGetContextScreen: - return SProcXpGetContextScreen(client); - case X_PrintStartJob: - return SProcXpStartJob(client); - case X_PrintEndJob: - return SProcXpEndJob(client); - case X_PrintStartDoc: - return SProcXpStartDoc(client); - case X_PrintEndDoc: - return SProcXpEndDoc(client); - case X_PrintStartPage: - return SProcXpStartPage(client); - case X_PrintEndPage: - return SProcXpEndPage(client); - case X_PrintSelectInput: - return SProcXpSelectInput(client); - case X_PrintInputSelected: - return SProcXpInputSelected(client); - case X_PrintPutDocumentData: - return SProcXpPutDocumentData(client); - case X_PrintGetDocumentData: - return SProcXpGetDocumentData(client); - case X_PrintSetAttributes: - return SProcXpSetAttributes(client); - case X_PrintGetAttributes: - return SProcXpGetAttributes(client); - case X_PrintGetOneAttribute: - return SProcXpGetOneAttribute(client); - case X_PrintRehashPrinterList: - return SProcXpRehashPrinterList(client); - case X_PrintQueryScreens: - swaps(&stuff->length, temp); - return ProcXpQueryScreens(client); - case X_PrintGetPageDimensions: - return SProcXpGetPageDimensions(client); - case X_PrintSetImageResolution: - return SProcXpSetImageResolution(client); - case X_PrintGetImageResolution: - return SProcXpGetImageResolution(client); - default: - return BadRequest; - } -} - -static int -ProcXpQueryVersion(ClientPtr client) -{ - /* REQUEST(xPrintQueryVersionReq); */ - xPrintQueryVersionReply rep; - int n; - long l; - - REQUEST_SIZE_MATCH(xPrintQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = XP_MAJOR_VERSION; - rep.minorVersion = XP_MINOR_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); - } - WriteToClient(client, sz_xPrintQueryVersionReply, (char *)&rep); - return client->noClientException; -} - -/******************************************************************************* - * - * GetPrinterList : Return a list of all printers associated with this - * server. Calls XpDiGetPrinterList, which is defined in - * the device-independent code in Xserver/Xprint. - * - ******************************************************************************/ - -static int -ProcXpGetPrinterList(ClientPtr client) -{ - REQUEST(xPrintGetPrinterListReq); - int totalSize; - int numEntries; - XpDiListEntry **pList; - xPrintGetPrinterListReply *rep; - int n, i, totalBytes; - long l; - char *curByte; - - REQUEST_AT_LEAST_SIZE(xPrintGetPrinterListReq); - - totalSize = ((sz_xPrintGetPrinterListReq) >> 2) + - ((stuff->printerNameLen + 3) >> 2) + - ((stuff->localeLen + 3) >> 2); - if(totalSize != client->req_len) - return BadLength; - - pList = XpDiGetPrinterList(stuff->printerNameLen, (char *)(stuff + 1), - stuff->localeLen, (char *)((stuff + 1) + - QUADPAD(stuff->printerNameLen))); - - for(numEntries = 0, totalBytes = sz_xPrintGetPrinterListReply; - pList[numEntries] != (XpDiListEntry *)NULL; - numEntries++) - { - totalBytes += 2 * sizeof(CARD32); - totalBytes += QUADPAD(strlen(pList[numEntries]->name)); - totalBytes += QUADPAD(strlen(pList[numEntries]->description)); - } - - if((rep = (xPrintGetPrinterListReply *)xalloc(totalBytes)) == - (xPrintGetPrinterListReply *)NULL) - return BadAlloc; - - rep->type = X_Reply; - rep->length = (totalBytes - sz_xPrintGetPrinterListReply) >> 2; - rep->sequenceNumber = client->sequence; - rep->listCount = numEntries; - if (client->swapped) { - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, l); - swapl(&rep->listCount, l); - } - - for(i = 0, curByte = (char *)(rep + 1); i < numEntries; i++) - { - CARD32 *pCrd; - int len; - - pCrd = (CARD32 *)curByte; - len = strlen(pList[i]->name); - *pCrd = len; - if (client->swapped) - swapl((long *)curByte, l); - curByte += sizeof(CARD32); - strncpy(curByte, pList[i]->name, len); - curByte += QUADPAD(len); - - pCrd = (CARD32 *)curByte; - len = strlen(pList[i]->description); - *pCrd = len; - if (client->swapped) - swapl((long *)curByte, l); - curByte += sizeof(CARD32); - strncpy(curByte, pList[i]->description, len); - curByte += QUADPAD(len); - } - - XpDiFreePrinterList(pList); - - WriteToClient(client, totalBytes, (char *)rep); - xfree(rep); - return client->noClientException; -} - -/******************************************************************************* - * - * QueryScreens: Returns the list of screens which are associated with - * print drivers. - * - ******************************************************************************/ - -static int -ProcXpQueryScreens(ClientPtr client) -{ - /* REQUEST(xPrintQueryScreensReq); */ - int i, numPrintScreens, totalSize; - WINDOW *pWinId; - xPrintQueryScreensReply *rep; - long l; - - REQUEST_SIZE_MATCH(xPrintQueryScreensReq); - - rep = (xPrintQueryScreensReply *)xalloc(sz_xPrintQueryScreensReply); - pWinId = (WINDOW *)(rep + 1); - - for(i = 0, numPrintScreens = 0, totalSize = sz_xPrintQueryScreensReply; - i < MAXSCREENS; i++) - { - /* - * If a screen has registered with our extension, then it's - * a printer screen. - */ - if(XpScreens[i] != (XpScreenPtr)NULL) - { - numPrintScreens++; - totalSize += sizeof(WINDOW); - rep = (xPrintQueryScreensReply *)xrealloc(rep, totalSize); - /* fix of bug: pWinId should be set again after reallocate rep */ - pWinId = (WINDOW *)(rep + 1); - *pWinId = WindowTable[i]->drawable.id; - if (client->swapped) - swapl((long *)pWinId, l); - } - } - - rep->type = X_Reply; - rep->sequenceNumber = client->sequence; - rep->length = (totalSize - sz_xPrintQueryScreensReply) >> 2; - rep->listCount = numPrintScreens; - if (client->swapped) - { - int n; - - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, l); - swapl(&rep->listCount, l); - } - - WriteToClient(client, totalSize, (char *)rep); - xfree(rep); - return client->noClientException; -} - -static int -ProcXpGetPageDimensions(ClientPtr client) -{ - REQUEST(xPrintGetPageDimensionsReq); - CARD16 width, height; - xRectangle rect; - xPrintGetPageDimensionsReply rep; - XpContextPtr pContext; - int result; - - REQUEST_SIZE_MATCH(xPrintGetPageDimensionsReq); - - if((pContext =(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixReadAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if((pContext->funcs.GetMediumDimensions == 0) || - (pContext->funcs.GetReproducibleArea == 0)) - return BadImplementation; - - result = pContext->funcs.GetMediumDimensions(pContext, &width, &height); - if(result != Success) - return result; - - result = pContext->funcs.GetReproducibleArea(pContext, &rect); - if(result != Success) - return result; - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.width = width; - rep.height = height; - rep.rx = rect.x; - rep.ry = rect.y; - rep.rwidth = rect.width; - rep.rheight = rect.height; - - if(client->swapped) - { - int n; - long l; - - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swaps(&rep.width, n); - swaps(&rep.height, n); - swaps(&rep.rx, n); - swaps(&rep.ry, n); - swaps(&rep.rwidth, n); - swaps(&rep.rheight, n); - } - - WriteToClient(client, sz_xPrintGetPageDimensionsReply, (char *)&rep); - return client->noClientException; -} - -static int -ProcXpSetImageResolution(ClientPtr client) -{ - REQUEST(xPrintSetImageResolutionReq); - xPrintSetImageResolutionReply rep; - XpContextPtr pContext; - Bool status; - int result; - - REQUEST_SIZE_MATCH(xPrintSetImageResolutionReq); - - if((pContext =(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixWriteAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - rep.prevRes = pContext->imageRes; - if(pContext->funcs.SetImageResolution != 0) { - result = pContext->funcs.SetImageResolution(pContext, - (int)stuff->imageRes, - &status); - if(result != Success) - status = FALSE; - } else - status = FALSE; - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.status = status; - - if(client->swapped) - { - int n; - long l; - - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swaps(&rep.prevRes, n); - } - - WriteToClient(client, sz_xPrintSetImageResolutionReply, (char *)&rep); - return client->noClientException; -} - -static int -ProcXpGetImageResolution(ClientPtr client) -{ - REQUEST(xPrintGetImageResolutionReq); - xPrintGetImageResolutionReply rep; - XpContextPtr pContext; - - REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq); - - if((pContext =(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixReadAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.imageRes = pContext->imageRes; - - if(client->swapped) - { - int n; - long l; - - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swaps(&rep.imageRes, n); - } - - WriteToClient(client, sz_xPrintGetImageResolutionReply, (char *)&rep); - return client->noClientException; -} - -/******************************************************************************* - * - * RehashPrinterList : Cause the server's list of printers to be rebuilt. - * This allows new printers to be added, or old ones - * deleted without needing to restart the server. - * - ******************************************************************************/ - -static int -ProcXpRehashPrinterList(ClientPtr client) -{ - /* REQUEST(xPrintRehashPrinterListReq); */ - - REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq); - - return XpRehashPrinterList(); -} - -/****************************************************************************** - * - * Context functions: Init, Set, Destroy, FreeContext - * AllocateContextPrivateIndex, AllocateContextPrivate - * and supporting functions. - * - * Init creates a context, creates a XpClientRec for the calling - * client, and stores the contextPtr in the client's devPrivates. - * - * Set creates a XpClientRec for the calling client, and stores the - * contextPtr in the client's devPrivates unless the context is None. - * If the context is None, then the client's connection association - * with any context is removed. - * - * Destroy frees any and all XpClientRecs associated with the context, - * frees the context itself, and removes the contextPtr from any - * relevant client devPrivates. - * - * FreeContext is called by FreeResource to free up a context. - * - ******************************************************************************/ - -/* - * CreateContext creates and initializes the memory for the context itself. - * The driver's CreateContext function - * is then called. - */ -static int -ProcXpCreateContext(ClientPtr client) -{ - REQUEST(xPrintCreateContextReq); - XpScreenPtr pPrintScreen; - WindowPtr pRoot; - char *driverName; - XpContextPtr pContext; - int result = Success; - XpDriverPtr pDriver; - - REQUEST_AT_LEAST_SIZE(xPrintCreateContextReq); - - LEGAL_NEW_RESOURCE(stuff->contextID, client); - - /* - * Check to see if the printer name is valid. - */ - if((pRoot = XpDiValidatePrinter((char *)(stuff + 1), stuff->printerNameLen)) == - (WindowPtr)NULL) - return BadMatch; - - pPrintScreen = XpScreens[pRoot->drawable.pScreen->myNum]; - - /* - * Allocate and add the context resource. - */ - if((pContext = (XpContextPtr) xalloc(sizeof(XpContextRec))) == - (XpContextPtr) NULL) - return BadAlloc; - - if(AddResource(stuff->contextID, RTcontext, (pointer) pContext) - != TRUE) - { - xfree(pContext); - return BadAlloc; - } - - pContext->contextID = stuff->contextID; - pContext->clientHead = (XpClientPtr)NULL; - pContext->screenNum = pRoot->drawable.pScreen->myNum; - pContext->state = 0; - pContext->clientSlept = (ClientPtr)NULL; - pContext->imageRes = 0; - pContext->devPrivates = NULL; - - pContext->funcs.DestroyContext = 0; - pContext->funcs.StartJob = 0; - pContext->funcs.EndJob = 0; - pContext->funcs.StartDoc = 0; - pContext->funcs.EndDoc = 0; - pContext->funcs.StartPage = 0; - pContext->funcs.EndPage = 0; - pContext->funcs.PutDocumentData = 0; - pContext->funcs.GetDocumentData = 0; - pContext->funcs.GetAttributes = 0; - pContext->funcs.GetOneAttribute = 0; - pContext->funcs.SetAttributes = 0; - pContext->funcs.AugmentAttributes = 0; - pContext->funcs.GetMediumDimensions = 0; - pContext->funcs.GetReproducibleArea = 0; - pContext->funcs.SetImageResolution = 0; - - if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) == - (char *)NULL) - { - /* Freeing the context also causes the XpClients to be freed. */ - FreeResource(stuff->contextID, RT_NONE); - return BadAlloc; - } - strncpy(pContext->printerName, (char *)(stuff + 1), stuff->printerNameLen); - pContext->printerName[stuff->printerNameLen] = (char)'\0'; - - driverName = XpDiGetDriverName(pRoot->drawable.pScreen->myNum, - pContext->printerName); - - for(pDriver = pPrintScreen->drivers; - pDriver != (XpDriverPtr)NULL; - pDriver = pDriver->next) - { - if(!strcmp(driverName, pDriver->name)) - { - if(pDriver->CreateContext != 0) - pDriver->CreateContext(pContext); - else - return BadImplementation; - break; - } - } - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -/* - * SetContext creates the calling client's contextClient resource, - * and stashes the contextID in the client's devPrivate. - */ -static int -ProcXpSetContext(ClientPtr client) -{ - REQUEST(xPrintSetContextReq); - - XpContextPtr pContext; - XpClientPtr pPrintClient; - int result = Success; - - REQUEST_AT_LEAST_SIZE(xPrintSetContextReq); - - if((pContext = XP_GETPRIV(client)) != (pointer)NULL) - { - /* - * Erase this client's knowledge of its old context, if any. - */ - if((pPrintClient = FindClient(pContext, client)) != (XpClientPtr)NULL) - { - XpUnsetFontResFunc(client); - - if(pPrintClient->eventMask == 0) - FreeXpClient(pPrintClient, TRUE); - } - - XP_SETPRIV(client, NULL); - } - if(stuff->printContext == None) - return Success; - - /* - * Check to see that the supplied XID is really a valid print context - * in this server. - */ - if((pContext =(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixWriteAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL) - return BadAlloc; - - XP_SETPRIV(client, pContext); - - XpSetFontResFunc(client); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -XpContextPtr -XpGetPrintContext(ClientPtr client) -{ - return XP_GETPRIV(client); -} - -static int -ProcXpGetContext(ClientPtr client) -{ - /* REQUEST(xPrintGetContextReq); */ - xPrintGetContextReply rep; - - XpContextPtr pContext; - int n; - long l; - - REQUEST_SIZE_MATCH(xPrintGetContextReq); - - if((pContext = XP_GETPRIV(client)) == (pointer)NULL) - rep.printContext = None; - else - rep.printContext = pContext->contextID; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swapl(&rep.printContext, l); - } - WriteToClient(client, sz_xPrintGetContextReply, (char *)&rep); - return client->noClientException; -} - - -/* - * DestroyContext frees the context associated with the calling client. - * It operates by freeing the context resource ID, thus causing XpFreeContext - * to be called. - */ -static int -ProcXpDestroyContext(ClientPtr client) -{ - REQUEST(xPrintDestroyContextReq); - - XpContextPtr pContext; - - REQUEST_SIZE_MATCH(xPrintDestroyContextReq); - - if((pContext =(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixDestroyAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - XpUnsetFontResFunc(client); - - FreeResource(pContext->contextID, RT_NONE); - - return Success; -} - -static int -ProcXpGetContextScreen(ClientPtr client) -{ - REQUEST(xPrintGetContextScreenReq); - xPrintGetContextScreenReply rep; - XpContextPtr pContext; - int n; - long l; - - if((pContext =(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixReadAccess)) - == (XpContextPtr)NULL) - return XpErrorBase+XPBadContext; - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.rootWindow = WindowTable[pContext->screenNum]->drawable.id; - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swapl(&rep.rootWindow, l); - } - - WriteToClient(client, sz_xPrintGetContextScreenReply, (char *)&rep); - return client->noClientException; -} - -/* - * XpFreeContext is the routine called by dix:FreeResource when a context - * resource ID is freed. - * It checks to see if there's a partial job pending on the context, and - * if so it calls the appropriate End procs with the cancel flag set. - * It calls the driver's DestroyContext routine to allow the driver to clean - * up any context-related memory or state. - * It calls FreeXpClient to free all the - * associated XpClientRecs and to set all the client->devPrivates to NULL. - * It frees the printer name string, and frees the context - * itself. - */ -static int -XpFreeContext(pointer data, XID id) -{ - XpContextPtr pContext = (XpContextPtr)data; - - /* Clean up any pending job on this context */ - if(pContext->state != 0) - { - if(pContext->state & PAGE_STARTED) - { - WindowPtr pWin = (WindowPtr )LookupIDByType( - pContext->pageWin, RT_WINDOW); - XpPagePtr pPage = (XpPagePtr)LookupIDByType( - pContext->pageWin, RTpage); - - pContext->funcs.EndPage(pContext, pWin); - SendXpNotify(pContext, XPEndPageNotify, TRUE); - pContext->state &= ~PAGE_STARTED; - if(pPage) - pPage->context = (XpContextPtr)NULL; - } - if((pContext->state & DOC_RAW_STARTED) || - (pContext->state & DOC_COOKED_STARTED)) - { - pContext->funcs.EndDoc(pContext, TRUE); - SendXpNotify(pContext, XPEndDocNotify, TRUE); - pContext->state &= ~DOC_RAW_STARTED; - pContext->state &= ~DOC_COOKED_STARTED; - } - if(pContext->funcs.EndJob != 0) - { - pContext->funcs.EndJob(pContext, TRUE); - SendXpNotify(pContext, XPEndJobNotify, TRUE); - pContext->state &= ~JOB_STARTED; - pContext->state &= ~GET_DOC_DATA_STARTED; - } - } - - /* - * Tell the driver we're destroying the context - * This allows the driver to free and ContextPrivate data - */ - if(pContext->funcs.DestroyContext != 0) - pContext->funcs.DestroyContext(pContext); - - /* Free up all the XpClientRecs */ - while(pContext->clientHead != (XpClientPtr)NULL) - { - FreeXpClient(pContext->clientHead, TRUE); - } - - xfree(pContext->printerName); - dixFreePrivates(pContext->devPrivates); - xfree(pContext); - return Success; /* ??? */ -} - -/* - * XpFreeClient is the routine called by dix:FreeResource when a RTclient - * is freed. It simply calls the FreeXpClient routine to do the work. - */ -static int -XpFreeClient(pointer data, XID id) -{ - FreeXpClient((XpClientPtr)data, TRUE); - return Success; -} - -/* - * FreeXpClient - * frees the ClientRec passed in, and sets the client->devPrivates to NULL - * if the client->devPrivates points to the same context as the XpClient. - * Called from XpFreeContext(from FreeResource), and - * XpFreeClient. The boolean freeResource specifies whether or not to call - * FreeResource for the XpClientRec's XID. We should free it except if we're - * called from XpFreeClient (which is itself called from FreeResource for the - * XpClientRec's XID). - */ -static void -FreeXpClient(XpClientPtr pXpClient, Bool freeResource) -{ - XpClientPtr pCurrent, pPrev; - XpContextPtr pContext = pXpClient->context; - - /* - * If we're freeing the clientRec associated with the context tied - * to the client's devPrivates, then we need to clear the devPrivates. - */ - if(XP_GETPRIV(pXpClient->client) == pXpClient->context) - { - XP_SETPRIV(pXpClient->client, NULL); - } - - for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead; - pCurrent != (XpClientPtr)NULL; - pCurrent = pCurrent->pNext) - { - if(pCurrent == pXpClient) - { - if(freeResource == TRUE) - FreeResource (pCurrent->contextClientID, RTclient); - - if (pPrev != (XpClientPtr)NULL) - pPrev->pNext = pCurrent->pNext; - else - pContext->clientHead = pCurrent->pNext; - - xfree (pCurrent); - break; - } - pPrev = pCurrent; - } -} - -/* - * CreateXpClient takes a ClientPtr and returns a pointer to a - * XpClientRec which it allocates. It also initializes the Rec, - * including adding a resource on behalf of the client to enable the - * freeing of the Rec when the client's connection is closed. - */ -static XpClientPtr -CreateXpClient(ClientPtr client) -{ - XpClientPtr pNewPrintClient; - XID clientResource; - - if((pNewPrintClient = (XpClientPtr)xalloc(sizeof(XpClientRec))) == - (XpClientPtr)NULL) - return (XpClientPtr)NULL; - - clientResource = FakeClientID(client->index); - if(!AddResource(clientResource, RTclient, (pointer)pNewPrintClient)) - { - xfree (pNewPrintClient); - return (XpClientPtr)NULL; - } - - pNewPrintClient->pNext = (XpClientPtr)NULL; - pNewPrintClient->client = client; - pNewPrintClient->context = (XpContextPtr)NULL; - pNewPrintClient->eventMask = 0; - pNewPrintClient->contextClientID = clientResource; - - return pNewPrintClient; -} - -/* - * XpFreePage is the routine called by dix:FreeResource to free the page - * resource built with the same ID as a page window. It checks to see - * if we're in the middle of a page, and if so calls the driver's EndPage - * function with 'cancel' set TRUE. It frees the memory associated with - * the page resource. - */ -static int -XpFreePage(pointer data, XID id) -{ - XpPagePtr page = (XpPagePtr)data; - int result = Success; - WindowPtr pWin = (WindowPtr )LookupIDByType(id, RT_WINDOW); - - /* Check to see if the window's being deleted in the middle of a page */ - if(page->context != (XpContextPtr)NULL && - page->context->state & PAGE_STARTED) - { - if(page->context->funcs.EndPage != 0) - result = page->context->funcs.EndPage(page->context, pWin); - SendXpNotify(page->context, XPEndPageNotify, (int)TRUE); - page->context->pageWin = 0; /* None, NULL??? XXX */ - } - - xfree(page); - return result; -} - -static XpClientPtr -AcquireClient(XpContextPtr pContext, ClientPtr client) -{ - XpClientPtr pXpClient; - - if((pXpClient = FindClient(pContext, client)) != (XpClientPtr)NULL) - return pXpClient; - - if((pXpClient = CreateXpClient(client)) == (XpClientPtr)NULL) - return (XpClientPtr)NULL; - - pXpClient->context = pContext; - pXpClient->pNext = pContext->clientHead; - pContext->clientHead = pXpClient; - - return pXpClient; -} - -static XpClientPtr -FindClient(XpContextPtr pContext, ClientPtr client) -{ - XpClientPtr pXpClient; - - for(pXpClient = pContext->clientHead; pXpClient != (XpClientPtr)NULL; - pXpClient = pXpClient->pNext) - { - if(pXpClient->client == client) return pXpClient; - } - return (XpClientPtr)NULL; -} - - -/****************************************************************************** - * - * Start/End Functions: StartJob, EndJob, StartDoc, EndDoc, StartPage, EndPage - * - ******************************************************************************/ - -static int -ProcXpStartJob(ClientPtr client) -{ - REQUEST(xPrintStartJobReq); - XpContextPtr pContext; - int result = Success; - - REQUEST_SIZE_MATCH(xPrintStartJobReq); - - /* Check to see that a context has been established by this client. */ - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadContext; - - if(pContext->state != 0) - return XpErrorBase+XPBadSequence; - - if(stuff->saveData != XPSpool && stuff->saveData != XPGetData) - { - client->errorValue = stuff->saveData; - return BadValue; - } - - if(pContext->funcs.StartJob != 0) - result = pContext->funcs.StartJob(pContext, - (stuff->saveData == XPGetData)? TRUE:FALSE, - client); - else - return BadImplementation; - - pContext->state = JOB_STARTED; - if(stuff->saveData == XPGetData) - pContext->state |= JOB_GET_DATA; - - SendXpNotify(pContext, XPStartJobNotify, FALSE); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -static int -ProcXpEndJob(ClientPtr client) -{ - REQUEST(xPrintEndJobReq); - int result = Success; - XpContextPtr pContext; - - REQUEST_SIZE_MATCH(xPrintEndJobReq); - - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadSequence; - - if(!(pContext->state & JOB_STARTED)) - return XpErrorBase+XPBadSequence; - - /* Check for missing EndDoc */ - if((pContext->state & DOC_RAW_STARTED) || - (pContext->state & DOC_COOKED_STARTED)) - { - if(pContext->state & PAGE_STARTED) - { - WindowPtr pWin = (WindowPtr )LookupIDByType( - pContext->pageWin, RT_WINDOW); - XpPagePtr pPage = (XpPagePtr)LookupIDByType( - pContext->pageWin, RTpage); - - if(stuff->cancel != TRUE) - return XpErrorBase+XPBadSequence; - - if(pContext->funcs.EndPage != 0) - result = pContext->funcs.EndPage(pContext, pWin); - else - return BadImplementation; - - SendXpNotify(pContext, XPEndPageNotify, TRUE); - - pContext->state &= ~PAGE_STARTED; - - if(pPage) - pPage->context = (XpContextPtr)NULL; - - if(result != Success) return result; - } - - if(pContext->funcs.EndDoc != 0) - result = pContext->funcs.EndDoc(pContext, stuff->cancel); - else - return BadImplementation; - - SendXpNotify(pContext, XPEndDocNotify, stuff->cancel); - } - - if(pContext->funcs.EndJob != 0) - result = pContext->funcs.EndJob(pContext, stuff->cancel); - else - return BadImplementation; - - pContext->state = 0; - - SendXpNotify(pContext, XPEndJobNotify, stuff->cancel); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -static Bool -DoStartDoc(ClientPtr client, XpStDocPtr c) -{ - XpContextPtr pContext = c->pContext; - - if(c->pContext->state & JOB_GET_DATA && - !(c->pContext->state & GET_DOC_DATA_STARTED)) - { - if(!c->slept) - { - c->slept = TRUE; - ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c); - c->pContext->clientSlept = client; - } - return TRUE; - } - - if(pContext->funcs.StartDoc != 0) - (void) pContext->funcs.StartDoc(pContext, c->type); - else - { - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, - BadImplementation); - return TRUE; - } - - if(c->type == XPDocNormal) - pContext->state |= DOC_COOKED_STARTED; - else - pContext->state |= DOC_RAW_STARTED; - - SendXpNotify(pContext, XPStartDocNotify, (int)FALSE); - - xfree(c); - return TRUE; -} - -static int -ProcXpStartDoc(ClientPtr client) -{ - REQUEST(xPrintStartDocReq); - int result = Success; - XpContextPtr pContext; - XpStDocPtr c; - - REQUEST_SIZE_MATCH(xPrintStartDocReq); - - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadSequence; - - if(!(pContext->state & JOB_STARTED) || - pContext->state & DOC_RAW_STARTED || - pContext->state & DOC_COOKED_STARTED) - return XpErrorBase+XPBadSequence; - - if(stuff->type != XPDocNormal && stuff->type != XPDocRaw) - { - client->errorValue = stuff->type; - return BadValue; - } - - c = (XpStDocPtr)xalloc(sizeof(XpStDocRec)); - c->pContext = pContext; - c->type = stuff->type; - c->slept = FALSE; - (void)DoStartDoc(client, c); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -static int -ProcXpEndDoc(ClientPtr client) -{ - REQUEST(xPrintEndDocReq); - XpContextPtr pContext; - int result = Success; - - REQUEST_SIZE_MATCH(xPrintEndDocReq); - - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadSequence; - - if(!(pContext->state & DOC_RAW_STARTED) && - !(pContext->state & DOC_COOKED_STARTED)) - return XpErrorBase+XPBadSequence; - - if(pContext->state & PAGE_STARTED) - { - if(stuff->cancel == TRUE) - { - WindowPtr pWin = (WindowPtr )LookupIDByType( - pContext->pageWin, RT_WINDOW); - XpPagePtr pPage = (XpPagePtr)LookupIDByType( - pContext->pageWin, RTpage); - - if(pContext->funcs.EndPage != 0) - result = pContext->funcs.EndPage(pContext, pWin); - else - return BadImplementation; - - SendXpNotify(pContext, XPEndPageNotify, TRUE); - - if(pPage) - pPage->context = (XpContextPtr)NULL; - } - else - return XpErrorBase+XPBadSequence; - if(result != Success) - return result; - } - - if(pContext->funcs.EndDoc != 0) - result = pContext->funcs.EndDoc(pContext, stuff->cancel); - else - return BadImplementation; - - pContext->state &= ~DOC_RAW_STARTED; - pContext->state &= ~DOC_COOKED_STARTED; - - SendXpNotify(pContext, XPEndDocNotify, stuff->cancel); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -static Bool -DoStartPage( - ClientPtr client, - XpStPagePtr c) -{ - WindowPtr pWin = c->pWin; - int result = Success; - XpContextPtr pContext = c->pContext; - XpPagePtr pPage; - - if(c->pContext->state & JOB_GET_DATA && - !(c->pContext->state & GET_DOC_DATA_STARTED)) - { - if(!c->slept) - { - c->slept = TRUE; - ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c); - c->pContext->clientSlept = client; - } - return TRUE; - } - - if(!(pContext->state & DOC_COOKED_STARTED)) - { - /* Implied StartDoc if it was omitted */ - if(pContext->funcs.StartDoc != 0) - result = pContext->funcs.StartDoc(pContext, XPDocNormal); - else - { - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, - BadImplementation); - return TRUE; - } - - if(result != Success) - { - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, result); - return TRUE; - } - - pContext->state |= DOC_COOKED_STARTED; - SendXpNotify(pContext, XPStartDocNotify, (int)FALSE); - } - - /* ensure the window's not already being used as a page */ - if((pPage = (XpPagePtr)LookupIDByType(c->pWin->drawable.id, RTpage)) != - (XpPagePtr)NULL) - { - if(pPage->context != (XpContextPtr)NULL) - { - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, - BadWindow); - return TRUE; - } - } - else - { - if((pPage = (XpPagePtr)xalloc(sizeof(XpPageRec))) == (XpPagePtr)NULL) - { - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, - BadAlloc); - return TRUE; - } - if(AddResource(c->pWin->drawable.id, RTpage, pPage) == FALSE) - { - xfree(pPage); - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, - BadAlloc); - return TRUE; - } - } - - pPage->context = pContext; - pContext->pageWin = c->pWin->drawable.id; - - if(pContext->funcs.StartPage != 0) - result = pContext->funcs.StartPage(pContext, pWin); - else - { - SendErrorToClient(client, XpReqCode, X_PrintStartPage, 0, - BadImplementation); - return TRUE; - } - - pContext->state |= PAGE_STARTED; - - (void)MapWindow(pWin, client); - - SendXpNotify(pContext, XPStartPageNotify, (int)FALSE); - - return TRUE; -} - -static int -ProcXpStartPage(ClientPtr client) -{ - REQUEST(xPrintStartPageReq); - WindowPtr pWin; - int result = Success; - XpContextPtr pContext; - XpStPagePtr c; - - REQUEST_SIZE_MATCH(xPrintStartPageReq); - - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadSequence; - - if(!(pContext->state & JOB_STARTED)) - return XpErrorBase+XPBadSequence; - - /* can't have pages in a raw documented */ - if(pContext->state & DOC_RAW_STARTED) - return XpErrorBase+XPBadSequence; - - if(pContext->state & PAGE_STARTED) - return XpErrorBase+XPBadSequence; - - result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); - if (result != Success) - return result; - if (pWin->drawable.pScreen->myNum != pContext->screenNum) - return BadWindow; - - if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL) - return BadAlloc; - c->pContext = pContext; - c->slept = FALSE; - c->pWin = pWin; - - (void)DoStartPage(client, c); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -static int -ProcXpEndPage(ClientPtr client) -{ - REQUEST(xPrintEndPageReq); - int result = Success; - XpContextPtr pContext; - XpPagePtr page; - WindowPtr pWin; - - REQUEST_SIZE_MATCH(xPrintEndPageReq); - - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadSequence; - - if(!(pContext->state & PAGE_STARTED)) - return XpErrorBase+XPBadSequence; - - pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW); - - /* Call the ddx's EndPage proc. */ - if(pContext->funcs.EndPage != 0) - result = pContext->funcs.EndPage(pContext, pWin); - else - return BadImplementation; - - if((page = (XpPagePtr)LookupIDByType(pContext->pageWin, RTpage)) != - (XpPagePtr)NULL) - page->context = (XpContextPtr)NULL; - - pContext->state &= ~PAGE_STARTED; - pContext->pageWin = 0; /* None, NULL??? XXX */ - - (void)UnmapWindow(pWin, FALSE); - - SendXpNotify(pContext, XPEndPageNotify, stuff->cancel); - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -/******************************************************************************* - * - * Document Data Functions: PutDocumentData, GetDocumentData - * - ******************************************************************************/ - -static int -ProcXpPutDocumentData(ClientPtr client) -{ - REQUEST(xPrintPutDocumentDataReq); - XpContextPtr pContext; - DrawablePtr pDraw; - int result = Success; - unsigned totalSize; - char *pData, *pDoc_fmt, *pOptions; - - REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq); - - if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) - return XpErrorBase+XPBadSequence; - - if(!(pContext->state & DOC_RAW_STARTED) && - !(pContext->state & DOC_COOKED_STARTED)) - return XpErrorBase+XPBadSequence; - - if (stuff->drawable) { - if (pContext->state & DOC_RAW_STARTED) - return BadDrawable; - result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixWriteAccess); - if (result != Success) - return result; - if (pDraw->pScreen->myNum != pContext->screenNum) - return BadDrawable; - } else { - if (pContext->state & DOC_COOKED_STARTED) - return BadDrawable; - pDraw = NULL; - } - - pData = (char *)(&stuff[1]); - - totalSize = (stuff->len_data + 3) >> 2; - pDoc_fmt = pData + (totalSize << 2); - - totalSize += (stuff->len_fmt + 3) >> 2; - pOptions = pData + (totalSize << 2); - - totalSize += (stuff->len_options + 3) >> 2; - if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len) - return BadLength; - - if(pContext->funcs.PutDocumentData != 0) - { - result = (*pContext->funcs.PutDocumentData)(pContext, pDraw, - pData, stuff->len_data, - pDoc_fmt, stuff->len_fmt, - pOptions, stuff->len_options, - client); - } - else - return BadImplementation; - - if (client->noClientException != Success) - return client->noClientException; - else - return result; -} - -static int -ProcXpGetDocumentData(ClientPtr client) -{ - REQUEST(xPrintGetDocumentDataReq); - xPrintGetDocumentDataReply rep; - XpContextPtr pContext; - int result = Success; - - REQUEST_SIZE_MATCH(xPrintGetDocumentDataReq); - - if((pContext = (XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixWriteAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if(pContext->funcs.GetDocumentData == 0) - return BadImplementation; - - if(!(pContext->state & JOB_GET_DATA) || - pContext->state & GET_DOC_DATA_STARTED) - return XpErrorBase+XPBadSequence; - - if(stuff->maxBufferSize <= 0) - { - client->errorValue = stuff->maxBufferSize; - return BadValue; /* gotta have a positive buffer size */ - } - - result = (*pContext->funcs.GetDocumentData)(pContext, client, - stuff->maxBufferSize); - if(result != Success) - { - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.dataLen = 0; - rep.statusCode = 1; - rep.finishedFlag = TRUE; - if (client->swapped) { - int n; - long l; - - swaps(&rep.sequenceNumber, n); - swapl(&rep.statusCode, l); /* XXX Why are these longs??? */ - swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */ - } - (void)WriteToClient(client,sz_xPrintGetDocumentDataReply,(char *)&rep); - } - else - pContext->state |= GET_DOC_DATA_STARTED; - - if(pContext->clientSlept != (ClientPtr)NULL) - { - ClientSignal(pContext->clientSlept); - ClientWakeup(pContext->clientSlept); - pContext->clientSlept = (ClientPtr)NULL; - } - - return result; -} - -/******************************************************************************* - * - * Attribute requests: GetAttributes, SetAttributes, GetOneAttribute - * - ******************************************************************************/ - -static int -ProcXpGetAttributes(ClientPtr client) -{ - REQUEST(xPrintGetAttributesReq); - XpContextPtr pContext; - char *attrs; - xPrintGetAttributesReply *pRep; - int totalSize, n; - unsigned long l; - - REQUEST_SIZE_MATCH(xPrintGetAttributesReq); - - if(stuff->type < XPJobAttr || stuff->type > XPServerAttr) - { - client->errorValue = stuff->type; - return BadValue; - } - - if(stuff->type != XPServerAttr) - { - if((pContext = (XpContextPtr)SecurityLookupIDByType( - client, - stuff->printContext, - RTcontext, - DixReadAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if(pContext->funcs.GetAttributes == 0) - return BadImplementation; - if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) == - (char *)NULL) - return BadAlloc; - } - else - { - if((attrs = XpGetAttributes((XpContextPtr)NULL, XPServerAttr)) == - (char *)NULL) - return BadAlloc; - } - - totalSize = sz_xPrintGetAttributesReply + QUADPAD(strlen(attrs)); - if((pRep = (xPrintGetAttributesReply *)malloc(totalSize)) == - (xPrintGetAttributesReply *)NULL) - return BadAlloc; - - pRep->type = X_Reply; - pRep->length = (totalSize - sz_xPrintGetAttributesReply) >> 2; - pRep->sequenceNumber = client->sequence; - pRep->stringLen = strlen(attrs); - - if (client->swapped) { - swaps(&pRep->sequenceNumber, n); - swapl(&pRep->length, l); - swapl(&pRep->stringLen, l); - } - - strncpy((char*)(pRep + 1), attrs, strlen(attrs)); - xfree(attrs); - - WriteToClient(client, totalSize, (char *)pRep); - - xfree(pRep); - - return client->noClientException; -} - -static int -ProcXpSetAttributes(ClientPtr client) -{ - REQUEST(xPrintSetAttributesReq); - int result = Success; - XpContextPtr pContext; - char *attr; - - REQUEST_AT_LEAST_SIZE(xPrintSetAttributesReq); - - if(stuff->type < XPJobAttr || stuff->type > XPServerAttr) - { - client->errorValue = stuff->type; - return BadValue; - } - - /* - * Disallow changing of read-only attribute pools - */ - if(stuff->type == XPPrinterAttr || stuff->type == XPServerAttr) - return BadMatch; - - if((pContext = (XpContextPtr)SecurityLookupIDByType( - client, - stuff->printContext, - RTcontext, - DixWriteAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if(pContext->funcs.SetAttributes == 0) - return BadImplementation; - - /* - * Check for attributes being set after their relevant phase - * has already begun (e.g. Job attributes set after StartJob). - */ - if((pContext->state & JOB_STARTED) && stuff->type == XPJobAttr) - return XpErrorBase+XPBadSequence; - if(((pContext->state & DOC_RAW_STARTED) || - (pContext->state & DOC_COOKED_STARTED)) && stuff->type == XPDocAttr) - return XpErrorBase+XPBadSequence; - if((pContext->state & PAGE_STARTED) && stuff->type == XPPageAttr) - return XpErrorBase+XPBadSequence; - - if((attr = (char *)malloc(stuff->stringLen + 1)) == (char *)NULL) - return BadAlloc; - - strncpy(attr, (char *)(stuff + 1), stuff->stringLen); - attr[stuff->stringLen] = (char)'\0'; - - if(stuff->rule == XPAttrReplace) - (*pContext->funcs.SetAttributes)(pContext, stuff->type, attr); - else if(stuff->rule == XPAttrMerge) - (*pContext->funcs.AugmentAttributes)(pContext, stuff->type, attr); - else - { - client->errorValue = stuff->rule; - result = BadValue; - } - - xfree(attr); - - SendAttributeNotify(pContext, stuff->type); - - return result; -} - -static int -ProcXpGetOneAttribute(ClientPtr client) -{ - REQUEST(xPrintGetOneAttributeReq); - XpContextPtr pContext; - char *value, *attrName; - xPrintGetOneAttributeReply *pRep; - int totalSize; - int n; - unsigned long l; - - REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq); - - totalSize = ((sz_xPrintGetOneAttributeReq) >> 2) + - ((stuff->nameLen + 3) >> 2); - if(totalSize != client->req_len) - return BadLength; - - if(stuff->type < XPJobAttr || stuff->type > XPServerAttr) - { - client->errorValue = stuff->type; - return BadValue; - } - - if((attrName = (char *)malloc(stuff->nameLen + 1)) == (char *)NULL) - return BadAlloc; - strncpy(attrName, (char *)(stuff+1), stuff->nameLen); - attrName[stuff->nameLen] = (char)'\0'; - - if(stuff->type != XPServerAttr) - { - if((pContext = (XpContextPtr)SecurityLookupIDByType( - client, - stuff->printContext, - RTcontext, - DixReadAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if(pContext->funcs.GetOneAttribute == 0) - return BadImplementation; - if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type, - attrName)) == (char *)NULL) - return BadAlloc; - } - else - { - if((value = XpGetOneAttribute((XpContextPtr)NULL, XPServerAttr, - attrName)) == (char *)NULL) - return BadAlloc; - } - - free(attrName); - - totalSize = sz_xPrintGetOneAttributeReply + QUADPAD(strlen(value)); - if((pRep = (xPrintGetOneAttributeReply *)malloc(totalSize)) == - (xPrintGetOneAttributeReply *)NULL) - return BadAlloc; - - pRep->type = X_Reply; - pRep->length = (totalSize - sz_xPrintGetOneAttributeReply) >> 2; - pRep->sequenceNumber = client->sequence; - pRep->valueLen = strlen(value); - - if (client->swapped) { - swaps(&pRep->sequenceNumber, n); - swapl(&pRep->length, l); - swapl(&pRep->valueLen, l); - } - - strncpy((char*)(pRep + 1), value, strlen(value)); - - WriteToClient(client, totalSize, (char *)pRep); - - xfree(pRep); - - return client->noClientException; -} - -/******************************************************************************* - * - * Print Event requests: SelectInput InputSelected, SendXpNotify - * - ******************************************************************************/ - - -static int -ProcXpSelectInput(ClientPtr client) -{ - REQUEST(xPrintSelectInputReq); - int result = Success; - XpContextPtr pContext; - XpClientPtr pPrintClient; - - REQUEST_SIZE_MATCH(xPrintSelectInputReq); - - /* - * Check to see that the supplied XID is really a valid print context - * in this server. - */ - if((pContext=(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixWriteAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - if(stuff->eventMask & ~allEvents) - { - client->errorValue = stuff->eventMask; - return BadValue; /* bogus event mask bits */ - } - - if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL) - return BadAlloc; - - pPrintClient->eventMask = stuff->eventMask; - - return result; -} - -static int -ProcXpInputSelected(ClientPtr client) -{ - REQUEST(xPrintInputSelectedReq); - xPrintInputSelectedReply rep; - int n; - long l; - XpClientPtr pXpClient; - XpContextPtr pContext; - - REQUEST_SIZE_MATCH(xPrintInputSelectedReq); - - if((pContext=(XpContextPtr)SecurityLookupIDByType(client, - stuff->printContext, - RTcontext, - DixReadAccess)) - == (XpContextPtr)NULL) - { - client->errorValue = stuff->printContext; - return XpErrorBase+XPBadContext; - } - - pXpClient = FindClient(pContext, client); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.eventMask = (pXpClient != (XpClientPtr)NULL)? pXpClient->eventMask : 0; - rep.allEventsMask = GetAllEventMasks(pContext); - - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swapl(&rep.eventMask, l); - swapl(&rep.allEventsMask, l); - } - - WriteToClient(client, sz_xPrintInputSelectedReply, (char *)&rep); - return client->noClientException; -} - -static void -SendAttributeNotify(XpContextPtr pContext, int which) -{ - XpClientPtr pXpClient; - xPrintAttributeEvent ae; - ClientPtr client; - - pXpClient = pContext->clientHead; - if(pXpClient == (XpClientPtr)NULL) - return; /* Nobody's interested in the events (or this context). */ - - for (pXpClient = pContext->clientHead; - pXpClient != (XpClientPtr)NULL; - pXpClient = pXpClient->pNext) - { - client = pXpClient->client; - if (client == serverClient || client->clientGone || - !(pXpClient->eventMask & XPAttributeMask)) - continue; - ae.type = XPAttributeNotify + XpEventBase; - ae.detail = which; - ae.printContext = pContext->contextID; - ae.sequenceNumber = client->sequence; - WriteEventsToClient (client, 1, (xEvent *) &ae); - } -} - -static void -SendXpNotify(XpContextPtr pContext, int which, int val) -{ - XpClientPtr pXpClient; - xPrintPrintEvent pe; - ClientPtr client; - - pXpClient = pContext->clientHead; - if(pXpClient == (XpClientPtr)NULL) - return; /* Nobody's interested in the events (or this context). */ - - for (pXpClient = pContext->clientHead; - pXpClient != (XpClientPtr)NULL; - pXpClient = pXpClient->pNext) - { - client = pXpClient->client; - if (client == serverClient || client->clientGone || - !(pXpClient->eventMask & XPPrintMask)) - continue; - pe.type = XPPrintNotify + XpEventBase; - pe.detail = which; - pe.printContext = pContext->contextID; - pe.cancel = (Bool)val; - pe.sequenceNumber = client->sequence; - WriteEventsToClient (client, 1, (xEvent *) &pe); - } -} - -static CARD32 -GetAllEventMasks(XpContextPtr pContext) -{ - XpClientPtr pPrintClient; - CARD32 totalMask = (CARD32)0; - - for (pPrintClient = pContext->clientHead; - pPrintClient != (XpClientPtr)NULL; - pPrintClient = pPrintClient->pNext) - { - totalMask |= pPrintClient->eventMask; - } - return totalMask; -} - -/* - * XpContextOfClient - returns the XpContextPtr to the context - * associated with the specified client, or NULL if the client - * does not currently have a context set. - */ -XpContextPtr -XpContextOfClient(ClientPtr client) -{ - return XP_GETPRIV(client); -} - - -/******************************************************************************* - * - * Swap-request functions - * - ******************************************************************************/ - -static int -SProcXpCreateContext(ClientPtr client) -{ - int i; - long n; - - REQUEST(xPrintCreateContextReq); - - swaps(&stuff->length, i); - swapl(&stuff->contextID, n); - swapl(&stuff->printerNameLen, n); - swapl(&stuff->localeLen, n); - return ProcXpCreateContext(client); -} - -static int -SProcXpGetPrinterList(ClientPtr client) -{ - int i; - long n; - - REQUEST(xPrintGetPrinterListReq); - - swaps(&stuff->length, i); - swapl(&stuff->printerNameLen, n); - swapl(&stuff->localeLen, n); - return ProcXpGetPrinterList(client); -} - -static int -SProcXpRehashPrinterList(ClientPtr client) -{ - int i; - - REQUEST(xPrintRehashPrinterListReq); - swaps(&stuff->length, i); - return ProcXpRehashPrinterList(client); -} - -static int -SProcXpSetContext(ClientPtr client) -{ - int i; - - REQUEST(xPrintSetContextReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, i); - return ProcXpSetContext(client); -} - -static int -SProcXpGetContext(ClientPtr client) -{ - int i; - - REQUEST(xPrintGetContextReq); - swaps(&stuff->length, i); - return ProcXpGetContext(client); -} - -static int -SProcXpDestroyContext(ClientPtr client) -{ - int i; - long n; - - REQUEST(xPrintDestroyContextReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - return ProcXpDestroyContext(client); -} - -static int -SProcXpGetContextScreen(ClientPtr client) -{ - int i; - long n; - - REQUEST(xPrintGetContextScreenReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - return ProcXpGetContextScreen(client); -} - -static int -SProcXpInputSelected(ClientPtr client) -{ - int i; - long n; - - REQUEST(xPrintInputSelectedReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - return ProcXpInputSelected(client); -} - -static int -SProcXpStartJob(ClientPtr client) -{ - int i; - - REQUEST(xPrintStartJobReq); - swaps(&stuff->length, i); - return ProcXpStartJob(client); -} - -static int -SProcXpEndJob(ClientPtr client) -{ - int i; - - REQUEST(xPrintEndJobReq); - swaps(&stuff->length, i); - return ProcXpEndJob(client); -} - -static int -SProcXpStartDoc(ClientPtr client) -{ - int i; - - REQUEST(xPrintStartDocReq); - swaps(&stuff->length, i); - return ProcXpStartDoc(client); -} - -static int -SProcXpEndDoc(ClientPtr client) -{ - int i; - - REQUEST(xPrintEndDocReq); - swaps(&stuff->length, i); - return ProcXpEndDoc(client); -} - -static int -SProcXpStartPage(ClientPtr client) -{ - int i; - long n; - - REQUEST(xPrintStartPageReq); - swaps(&stuff->length, i); - swapl(&stuff->window, n); - return ProcXpStartPage(client); -} - -static int -SProcXpEndPage(ClientPtr client) -{ - int i; - - REQUEST(xPrintEndPageReq); - swaps(&stuff->length, i); - return ProcXpEndPage(client); -} - -static int -SProcXpPutDocumentData(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintPutDocumentDataReq); - swaps(&stuff->length, i); - swapl(&stuff->drawable, n); - swapl(&stuff->len_data, n); - swaps(&stuff->len_fmt, i); - swaps(&stuff->len_options, i); - return ProcXpPutDocumentData(client); -} - -static int -SProcXpGetDocumentData(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintGetDocumentDataReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - swapl(&stuff->maxBufferSize, n); - return ProcXpGetDocumentData(client); -} - -static int -SProcXpGetAttributes(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintGetAttributesReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - return ProcXpGetAttributes(client); -} - -static int -SProcXpSetAttributes(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintSetAttributesReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - swapl(&stuff->stringLen, n); - return ProcXpSetAttributes(client); -} - -static int -SProcXpGetOneAttribute(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintGetOneAttributeReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - swapl(&stuff->nameLen, n); - return ProcXpGetOneAttribute(client); -} - -static int -SProcXpSelectInput(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintSelectInputReq); - swaps(&stuff->length, i); - swapl(&stuff->eventMask, n); - swapl(&stuff->printContext, n); - return ProcXpSelectInput(client); -} - -static int -SProcXpGetPageDimensions(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintGetPageDimensionsReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - return ProcXpGetPageDimensions(client); -} - -static int -SProcXpSetImageResolution(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintSetImageResolutionReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - swaps(&stuff->imageRes, i); - return ProcXpSetImageResolution(client); -} - -static int -SProcXpGetImageResolution(ClientPtr client) -{ - long n; - int i; - - REQUEST(xPrintGetImageResolutionReq); - swaps(&stuff->length, i); - swapl(&stuff->printContext, n); - return ProcXpGetImageResolution(client); -} - -static void -SwapXpNotifyEvent(xPrintPrintEvent *src, xPrintPrintEvent *dst) -{ - /* - * Swap the sequence number and context fields. - */ - cpswaps(src->sequenceNumber, dst->sequenceNumber); - cpswapl(src->printContext, dst->printContext); - - /* - * Copy the byte-long fields. - */ - dst->type = src->type; - dst->detail = src->detail; - dst->cancel = src->cancel; -} - -static void -SwapXpAttributeEvent(xPrintAttributeEvent *src, xPrintAttributeEvent *dst) -{ - /* - * Swap the sequence number and context fields. - */ - cpswaps(src->sequenceNumber, dst->sequenceNumber); - cpswapl(src->printContext, dst->printContext); - - /* - * Copy the byte-long fields. - */ - dst->type = src->type; - dst->detail = src->detail; -} diff --git a/composite/Makefile.am b/composite/Makefile.am index 21504e659..d7bead137 100644 --- a/composite/Makefile.am +++ b/composite/Makefile.am @@ -7,4 +7,5 @@ libcomposite_la_SOURCES = \ compext.c \ compint.h \ compinit.c \ + compoverlay.c \ compwindow.c diff --git a/composite/compext.c b/composite/compext.c index b3433f72b..e720f6ce7 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -54,10 +54,7 @@ static CARD8 CompositeReqCode; static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey; RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; -static RESTYPE CompositeClientOverlayType; - -static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, - ScreenPtr pScreen); +RESTYPE CompositeClientOverlayType; typedef struct _CompositeClient { int major_version; @@ -107,19 +104,8 @@ static int FreeCompositeClientOverlay (pointer value, XID ccwid) { CompOverlayClientPtr pOc = (CompOverlayClientPtr) value; - ScreenPtr pScreen = pOc->pScreen; - CompScreenPtr cs; - - deleteCompOverlayClient(pOc, pScreen); - - /* Unmap overlay window when there are no more clients using it */ - cs = GetCompScreen(pScreen); - if (cs->pOverlayClients == NULL) { - if (cs->pOverlayWin != NULL) { - UnmapWindow(cs->pOverlayWin, FALSE); - } - } + compFreeOverlayClient (pOc); return Success; } @@ -304,137 +290,6 @@ ProcCompositeNameWindowPixmap (ClientPtr client) } -/* - * Routines for manipulating the per-screen overlay clients list. - * This list indicates which clients have called GetOverlayWindow - * for this screen. - */ - -/* Return the screen's overlay client list element for the given client */ -static CompOverlayClientPtr -findCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc; - - for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) { - if (pOc->pClient == pClient) { - return pOc; - } - } - - return NULL; -} - -static int -createCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc; - - pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec)); - if (pOc == NULL) { - return BadAlloc; - } - pOc->pClient = pClient; - pOc->pScreen = pScreen; - pOc->resource = FakeClientID(pClient->index); - pOc->pNext = cs->pOverlayClients; - cs->pOverlayClients = pOc; - - /* - * Create a resource for this element so it can be deleted - * when the client goes away. - */ - if (!AddResource (pOc->resource, CompositeClientOverlayType, - (pointer) pOc)) { - xfree(pOc); - return BadAlloc; - } - - return Success; -} - -/* - * Delete the given overlay client list element from its screen list. - */ -static void -deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc, pNext; - CompOverlayClientPtr pOcLast = NULL; - - pOc = cs->pOverlayClients; - while (pOc != NULL) { - pNext = pOc->pNext; - if (pOc == pOcToDel) { - xfree(pOc); - if (pOcLast == NULL) { - cs->pOverlayClients = pNext; - } else { - pOcLast->pNext = pNext; - } - break; - } - pOcLast = pOc; - pOc = pNext; - } -} - -/* - * Delete all the hide-counts list elements for this screen. - */ -void -deleteCompOverlayClientsForScreen (ScreenPtr pScreen) -{ - CompScreenPtr cs = GetCompScreen(pScreen); - CompOverlayClientPtr pOc, pTmp; - - pOc = cs->pOverlayClients; - while (pOc != NULL) { - pTmp = pOc->pNext; - FreeResource(pOc->resource, 0); - pOc = pTmp; - } - cs->pOverlayClients = NULL; -} - -/* -** If necessary, create the overlay window. And map it -** Note: I found it excessively difficult to destroy this window -** during compCloseScreen; DeleteWindow can't be called because -** the input devices are already shut down. So we are going to -** just allocate an overlay window once per screen per X server -** invocation. -*/ - -static WindowPtr -createOverlayWindow (ScreenPtr pScreen) -{ - int wid = FakeClientID(0); - WindowPtr pWin; - XID overrideRedirect = TRUE; - int result; - - pWin = CreateWindow ( - wid, WindowTable[pScreen->myNum], - 0, 0, pScreen->width, pScreen->height, 0, - InputOutput, CWOverrideRedirect, &overrideRedirect, - WindowTable[pScreen->myNum]->drawable.depth, - serverClient, pScreen->rootVisual, &result); - if (pWin == NULL) { - return NULL; - } - - if (!AddResource(wid, RT_WINDOW, (pointer)pWin)) { - DeleteWindow(pWin, None); - return NULL; - } - - return pWin; -} - static int ProcCompositeGetOverlayWindow (ClientPtr client) { @@ -456,28 +311,31 @@ ProcCompositeGetOverlayWindow (ClientPtr client) } pScreen = pWin->drawable.pScreen; + /* + * Create an OverlayClient structure to mark this client's + * interest in the overlay window + */ + pOc = compCreateOverlayClient(pScreen, client); + if (pOc == NULL) + return BadAlloc; + + /* + * Make sure the overlay window exists + */ cs = GetCompScreen(pScreen); - if (cs->pOverlayWin == NULL) { - cs->pOverlayWin = createOverlayWindow(pScreen); - if (cs->pOverlayWin == NULL) { + if (cs->pOverlayWin == NULL) + if (!compCreateOverlayWindow(pScreen)) + { + FreeResource (pOc->resource, RT_NONE); return BadAlloc; } - } rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess); if (rc != Success) + { + FreeResource (pOc->resource, RT_NONE); return rc; - - MapWindow(cs->pOverlayWin, serverClient); - - /* Record that client is using this overlay window */ - pOc = findCompOverlayClient(client, pScreen); - if (pOc == NULL) { - int ret = createCompOverlayClient(client, pScreen); - if (ret != Success) { - return ret; - } } rep.type = X_Reply; @@ -504,7 +362,6 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; CompOverlayClientPtr pOc; - CompScreenPtr cs; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); @@ -519,18 +376,12 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) * Has client queried a reference to the overlay window * on this screen? If not, generate an error. */ - pOc = findCompOverlayClient(client, pWin->drawable.pScreen); - if (pOc == NULL) { + pOc = compFindOverlayClient (pWin->drawable.pScreen, client); + if (pOc == NULL) return BadMatch; - } /* The delete function will free the client structure */ - FreeResource (pOc->resource, 0); - - cs = GetCompScreen(pScreen); - if (cs->pOverlayClients == NULL) { - UnmapWindow(cs->pOverlayWin, FALSE); - } + FreeResource (pOc->resource, RT_NONE); return client->noClientException; } diff --git a/composite/compinit.c b/composite/compinit.c index 49b2044b0..7914a8d25 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -76,14 +76,6 @@ compCloseScreen (int index, ScreenPtr pScreen) pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; - deleteCompOverlayClientsForScreen(pScreen); - - /* - ** Note: no need to call DeleteWindow; the server has - ** already destroyed it. - */ - cs->pOverlayWin = NULL; - xfree (cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (index, pScreen); @@ -122,11 +114,11 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) if (ret && (mask & CWBackingStore)) { if (pWin->backingStore != NotUseful) { compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic); - pWin->backStorage = TRUE; + pWin->backStorage = (pointer) (intptr_t) 1; } else { compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic); - pWin->backStorage = FALSE; + pWin->backStorage = NULL; } } @@ -380,6 +372,7 @@ compScreenInit (ScreenPtr pScreen) return FALSE; cs->damaged = FALSE; + cs->overlayWid = FakeClientID(0); cs->pOverlayWin = NULL; cs->pOverlayClients = NULL; diff --git a/composite/compint.h b/composite/compint.h index 4b0fe0834..1c19ccd39 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -155,6 +155,7 @@ typedef struct _CompScreen { VisualID *alternateVisuals; WindowPtr pOverlayWin; + Window overlayWid; CompOverlayClientPtr pOverlayClients; } CompScreenRec, *CompScreenPtr; @@ -172,6 +173,7 @@ extern DevPrivateKey CompSubwindowsPrivateKey; extern RESTYPE CompositeClientWindowType; extern RESTYPE CompositeClientSubwindowsType; +extern RESTYPE CompositeClientOverlayType; /* * compalloc.c @@ -230,6 +232,25 @@ Bool compScreenInit (ScreenPtr pScreen); /* + * compoverlay.c + */ + +void +compFreeOverlayClient (CompOverlayClientPtr pOcToDel); + +CompOverlayClientPtr +compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient); + +CompOverlayClientPtr +compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient); + +Bool +compCreateOverlayWindow (ScreenPtr pScreen); + +void +compDestroyOverlayWindow (ScreenPtr pScreen); + +/* * compwindow.c */ @@ -292,9 +313,6 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); void compWindowUpdate (WindowPtr pWin); -void -deleteCompOverlayClientsForScreen (ScreenPtr pScreen); - WindowPtr CompositeRealChildHead (WindowPtr pWin); diff --git a/composite/compoverlay.c b/composite/compoverlay.c new file mode 100644 index 000000000..94e5b0346 --- /dev/null +++ b/composite/compoverlay.c @@ -0,0 +1,159 @@ +/* + * Copyright © 2006 Sun Microsystems + * + * 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 Sun Microsystems not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Sun Microsystems makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL SUN MICROSYSTEMS 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 © 2003 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_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "compint.h" +#include "xace.h" + +/* + * Delete the given overlay client list element from its screen list. + */ +void +compFreeOverlayClient (CompOverlayClientPtr pOcToDel) +{ + ScreenPtr pScreen = pOcToDel->pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + CompOverlayClientPtr *pPrev, pOc; + + for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) + { + if (pOc == pOcToDel) { + *pPrev = pOc->pNext; + xfree (pOc); + break; + } + } + + /* Destroy overlay window when there are no more clients using it */ + if (cs->pOverlayClients == NULL) + compDestroyOverlayWindow (pScreen); +} + +/* + * Return the client's first overlay client rec from the given screen + */ +CompOverlayClientPtr +compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + CompOverlayClientPtr pOc; + + for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) + if (pOc->pClient == pClient) + return pOc; + + return NULL; +} + +/* + * Create an overlay client object for the given client + */ +CompOverlayClientPtr +compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + CompOverlayClientPtr pOc; + + pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec)); + if (pOc == NULL) + return NULL; + + pOc->pClient = pClient; + pOc->pScreen = pScreen; + pOc->resource = FakeClientID(pClient->index); + pOc->pNext = cs->pOverlayClients; + cs->pOverlayClients = pOc; + + /* + * Create a resource for this element so it can be deleted + * when the client goes away. + */ + if (!AddResource (pOc->resource, CompositeClientOverlayType, (pointer) pOc)) + return NULL; + + return pOc; +} + +/* + * Create the overlay window and map it + */ +Bool +compCreateOverlayWindow (ScreenPtr pScreen) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pWin; + XID overrideRedirect = TRUE; + int result; + + pWin = cs->pOverlayWin = + CreateWindow (cs->overlayWid, pRoot, + 0, 0, pScreen->width, pScreen->height, 0, + InputOutput, CWOverrideRedirect, &overrideRedirect, + pRoot->drawable.depth, + serverClient, pScreen->rootVisual, &result); + if (pWin == NULL) + return FALSE; + + if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin)) + return FALSE; + + MapWindow(pWin, serverClient); + + return TRUE; +} + +/* + * Destroy the overlay window + */ +void +compDestroyOverlayWindow (ScreenPtr pScreen) +{ + CompScreenPtr cs = GetCompScreen(pScreen); + + cs->pOverlayWin = NullWindow; + FreeResource (cs->overlayWid, RT_NONE); +} + diff --git a/composite/compwindow.c b/composite/compwindow.c index c022027db..c1657bdcd 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -54,7 +54,7 @@ compCheckWindow (WindowPtr pWin, pointer data) PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin); PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0; PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen); - + if (!pWin->parent) { assert (pWin->redirectDraw == RedirectDrawNone); @@ -122,7 +122,7 @@ compSetPixmapVisitWindow (WindowPtr pWindow, pointer data) SetWinSize (pWindow); SetBorderSize (pWindow); if (HasBorder (pWindow)) - QueueWorkProc (compRepaintBorder, serverClient, + QueueWorkProc (compRepaintBorder, serverClient, (pointer) pWindow->drawable.id); return WT_WALKCHILDREN; } @@ -146,15 +146,15 @@ compCheckRedirect (WindowPtr pWin) Bool should; should = pWin->realized && (pWin->drawable.class != InputOnly) && - (cw != NULL); - + (cw != NULL) && (pWin->parent != NULL); + /* Never redirect the overlay window */ if (cs->pOverlayWin != NULL) { if (pWin == cs->pOverlayWin) { should = FALSE; } - } - + } + if (should != (pWin->redirectDraw != RedirectDrawNone)) { if (should) @@ -276,10 +276,10 @@ compClipNotify (WindowPtr pWin, int dx, int dy) ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); CompWindowPtr cw = GetCompWindow (pWin); - + if (cw) { - if (cw->borderClipX != pWin->drawable.x || + if (cw->borderClipX != pWin->drawable.x || cw->borderClipY != pWin->drawable.y) { REGION_TRANSLATE (pScreen, &cw->borderClip, @@ -324,7 +324,7 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent) ScreenPtr pScreen = pWin->drawable.pScreen; XID winVisual = wVisual (pWin); XID parentVisual = wVisual (pParent); - + if (winVisual != parentVisual && (compIsAlternateVisual (pScreen, winVisual) || compIsAlternateVisual (pScreen, parentVisual))) @@ -345,11 +345,11 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) WindowPtr pParent; int draw_x, draw_y; unsigned int w, h, bw; - + /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; - + bw = wBorderWidth (pWin); draw_x = pParent->drawable.x + x + (int)bw; draw_y = pParent->drawable.y + y + (int)bw; @@ -390,18 +390,18 @@ compResizeWindow (WindowPtr pWin, int x, int y, WindowPtr pParent; int draw_x, draw_y; unsigned int bw; - + /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; - + bw = wBorderWidth (pWin); draw_x = pParent->drawable.x + x + (int)bw; draw_y = pParent->drawable.y + y + (int)bw; compReallocPixmap (pWin, draw_x, draw_y, w, h, bw); } compCheckTree (pScreen); - + pScreen->ResizeWindow = cs->ResizeWindow; (*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib); cs->ResizeWindow = pScreen->ResizeWindow; @@ -430,11 +430,11 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw) WindowPtr pParent; int draw_x, draw_y; unsigned int w, h; - + /* if this is a root window, can't be moved */ if (!(pParent = pWin->parent)) return; - + draw_x = pWin->drawable.x; draw_y = pWin->drawable.y; w = pWin->drawable.width; @@ -481,13 +481,13 @@ compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent) */ if (compImplicitRedirect (pWin, pWin->parent)) compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic); - + /* * Allocate any necessary redirect pixmap * (this actually should never be true; pWin is always unmapped) */ compCheckRedirect (pWin); - + /* * Reset pixmap pointers as appropriate */ @@ -514,7 +514,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); CompWindowPtr cw = GetCompWindow (pWin); - + assert (cw->oldx != COMP_ORIGIN_INVALID); assert (cw->oldy != COMP_ORIGIN_INVALID); if (cw->pOldPixmap) @@ -526,7 +526,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) RegionRec rgnDst; PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin); GCPtr pGC; - + dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); @@ -535,10 +535,10 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, + + REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); - + dx = dx + pPixmap->screen_x - cw->oldx; dy = dy + pPixmap->screen_y - cw->oldy; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); @@ -546,7 +546,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { BoxPtr pBox = REGION_RECTS (&rgnDst); int nBox = REGION_NUM_RECTS (&rgnDst); - + ValidateGC(&pPixmap->drawable, pGC); while (nBox--) { @@ -568,7 +568,7 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) ptOldOrg.x += dx; ptOldOrg.y += dy; } - + pScreen->CopyWindow = cs->CopyWindow; if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) { @@ -634,7 +634,7 @@ compDestroyWindow (WindowPtr pWin) FreeResource (cw->clients->id, RT_NONE); while ((csw = GetCompSubwindows (pWin))) FreeResource (csw->clients->id, RT_NONE); - + if (pWin->redirectDraw != RedirectDrawNone) compFreePixmap (pWin); ret = (*pScreen->DestroyWindow) (pWin); @@ -699,7 +699,7 @@ PictFormatPtr compWindowFormat (WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; - + return PictureMatchVisual (pScreen, pWin->drawable.depth, compGetWindowVisual (pWin)); } @@ -716,24 +716,24 @@ compWindowUpdateAutomatic (WindowPtr pWin) int error; RegionPtr pRegion = DamageRegion (cw->damage); PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable, - pSrcFormat, + pSrcFormat, 0, 0, serverClient, &error); XID subwindowMode = IncludeInferiors; PicturePtr pDstPicture = CreatePicture (0, &pParent->drawable, pDstFormat, - CPSubwindowMode, + CPSubwindowMode, &subwindowMode, serverClient, &error); - + /* * First move the region from window to screen coordinates */ - REGION_TRANSLATE (pScreen, pRegion, + REGION_TRANSLATE (pScreen, pRegion, pWin->drawable.x, pWin->drawable.y); - + /* * Clip against the "real" border clip */ @@ -742,14 +742,14 @@ compWindowUpdateAutomatic (WindowPtr pWin) /* * Now translate from screen to dest coordinates */ - REGION_TRANSLATE (pScreen, pRegion, + REGION_TRANSLATE (pScreen, pRegion, -pParent->drawable.x, -pParent->drawable.y); - + /* * Clip the picture */ SetPictureClipRegion (pDstPicture, 0, 0, pRegion); - + /* * And paint */ @@ -813,7 +813,7 @@ CompositeRealChildHead (WindowPtr pWin) if (!pChild) { return NullWindow; } - + cs = GetCompScreen(pWin->drawable.pScreen); if (pChild == cs->pOverlayWin) { return pChild; diff --git a/config/hal.c b/config/hal.c index 67ffa0304..1d62a1de1 100644 --- a/config/hal.c +++ b/config/hal.c @@ -74,7 +74,7 @@ remove_device(DeviceIntPtr dev) static void device_removed(LibHalContext *ctx, const char *udi) { - DeviceIntPtr dev; + DeviceIntPtr dev, next; char *value; value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */ @@ -82,11 +82,13 @@ device_removed(LibHalContext *ctx, const char *udi) return; sprintf(value, "hal:%s", udi); - for (dev = inputInfo.devices; dev; dev = dev->next) { + for (dev = inputInfo.devices; dev; dev = next) { + next = dev->next; if (dev->config_info && strcmp(dev->config_info, value) == 0) remove_device(dev); } - for (dev = inputInfo.off_devices; dev; dev = dev->next) { + for (dev = inputInfo.off_devices; dev; dev = next) { + next = dev->next; if (dev->config_info && strcmp(dev->config_info, value) == 0) remove_device(dev); } @@ -260,7 +262,17 @@ 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")) { @@ -289,6 +301,9 @@ 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 a6cdef457..1bdb26c2a 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,8 @@ AC_CHECK_FUNC([dlopen], [], 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 @@ -191,7 +193,7 @@ dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ strtol getopt getopt_long vsnprintf walkcontext backtrace \ - getisax getzoneid shmctl64]) + getisax getzoneid shmctl64 strcasestr]) AC_FUNC_ALLOCA dnl Old HAS_* names used in os/*.c. AC_CHECK_FUNC([getdtablesize], @@ -402,6 +404,9 @@ case $host_os in *solaris*) PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no) ;; + darwin*) + AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) + ;; esac AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes) @@ -562,11 +567,7 @@ AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (d AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes]) 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(x11app, AS_HELP_STRING([--enable-x11app], [Build Apple's X11.app for Xquartz (default: auto)]), [X11APP=$enableval], [X11APP=auto]) -AC_ARG_WITH(x11app-archs, AS_HELP_STRING([--with-x11app-archs=ARCHS], [Architectures to build X11.app for, space delimeted (default: "ppc i386")]), [X11APP_ARCHS=$enableval], [X11APP_ARCHS="ppc i386"]) -AC_SUBST([X11APP_ARCHS]) AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto]) -AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: no)]), [XPRINT=$enableval], [XPRINT=no]) AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no]) AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no]) AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no]) @@ -979,15 +980,6 @@ if test "x$DPMSExtension" = xyes; then AC_DEFINE(DPMSExtension, 1, [Support DPMS extension]) fi -if test "x$XPRINT" = xauto; then - PKG_CHECK_MODULES([XPRINTPROTO], [printproto], [XPRINT=yes], [XPRINT=no]) -fi -AM_CONDITIONAL(XPRINT, [test "x$XPRINT" = xyes]) -if test "x$XPRINT" = xyes; then - AC_DEFINE(XPRINT, 1, [Build Print extension]) - REQUIRED_MODULES="$REQUIRED_MODULES printproto" -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]) @@ -1140,15 +1132,25 @@ 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 -PKG_CHECK_EXISTS([openssl], - [PKG_CHECK_MODULES([OPENSSL], [openssl], +# 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])]) +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`])]) -LIBCRYPTO="$OPENSSL_LIB_FLAGS -lcrypto" + SHA1_LIB="$OPENSSL_LIB_FLAGS -lcrypto" + SHA1_CFLAGS="$OPENSSL_CFLAGS" +fi # 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 -# listed there, or some versions of autotols will break (especially if a -L +# listed there, or some versions of autotools will break (especially if a -L # is required to find the library). So, we keep two sets of libraries # detected: NAMESPACE_LIBS for in-tree libraries to be linked against, which # will go into the _DEPENDENCIES and _LDADD of the server, and @@ -1160,9 +1162,9 @@ LIBCRYPTO="$OPENSSL_LIB_FLAGS -lcrypto" # XSERVER_SYS_LIBS is the set of out-of-tree libraries which all servers # require. # -XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS} ${OPENSSL_CFLAGS}" +XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS} ${SHA1_CFLAGS}" XSERVER_LIBS="$DIX_LIB $CONFIG_LIB $MI_LIB $OS_LIB" -XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${LIBCRYPTO}" +XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${SHA1_LIB}" AC_SUBST([XSERVER_LIBS]) AC_SUBST([XSERVER_SYS_LIBS]) @@ -1602,62 +1604,6 @@ if test "x$MFB" = xyes -o "x$AFB" = xyes; then fi fi -dnl Xprint DDX - -AC_MSG_CHECKING([whether to build Xprint DDX]) -AC_MSG_RESULT([$XPRINT]) - -if test "x$XPRINT" = xyes; then - PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau]) - XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT" - XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB" - XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS" - - xpconfigdir=$libdir/X11/xserver - AC_SUBST([xpconfigdir]) - - AC_PATH_PROG(MKFONTSCALE, mkfontscale) - AC_PATH_PROG(MKFONTDIR, mkfontdir) - - # freetype support code borrowed from lib/XFont - if test x$XP_USE_FREETYPE = xyes; then - AC_DEFINE(XP_USE_FREETYPE,1,[Support FreeType rasterizer in Xprint for nearly all font file formats]) - - if test "$freetype_config" = "auto" ; then - PKG_CHECK_MODULES(FREETYPE, freetype2, - freetype_config=no, freetype_config=yes) - fi - - if test "$freetype_config" = "yes"; then - AC_PATH_PROG(ft_config,freetype-config,no) - if test "$ft_config" = "no"; then - AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/]) - fi - else - ft_config="$freetype_config" - fi - - if test "$freetype_config" != "no"; then - FREETYPE_CFLAGS="`$ft_config --cflags`" - FREETYPE_LIBS="`$ft_config --libs`" - fi - FREETYPE_REQUIRES="freetype2" - else - FREETYPE_CFLAGS="" - FREETYPE_LIBS="" - FREETYPE_REQUIRES="" - fi - XPRINT_CFLAGS="$XPRINT_CFLAGS $FREETYPE_CFLAGS" - XPRINT_SYS_LIBS="$XPRINT_SYS_LIBS $FREETYPE_LIBS" - # end freetype support - - AC_SUBST([XPRINT_CFLAGS]) - AC_SUBST([XPRINT_LIBS]) - AC_SUBST([XPRINT_SYS_LIBS]) -fi -AM_CONDITIONAL(XP_USE_FREETYPE, [test "x$XPRINT" = xyes && test "x$XP_USE_FREETYPE" = xyes]) - - dnl XWin DDX AC_MSG_CHECKING([whether to build XWin DDX]) @@ -1756,17 +1702,6 @@ AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes]) AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes]) AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes]) -if test "x$X11APP" = xauto; then - AC_MSG_CHECKING([whether to build X11.app]) - if test "x$XQUARTZ" = xyes ; then - X11APP=yes - else - X11APP=no - fi - AC_MSG_RESULT([$X11APP]) -fi -AM_CONDITIONAL(X11APP,[test "X$X11APP" = Xyes]) - if test "x$LAUNCHD" = "xauto"; then if test "x$XQUARTZ" = "xyes" ; then LAUNCHD=yes @@ -2165,63 +2100,16 @@ hw/xwin/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile +hw/xquartz/doc/Makefile +hw/xquartz/mach-startup/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile -hw/kdrive/ati/Makefile -hw/kdrive/chips/Makefile hw/kdrive/ephyr/Makefile -hw/kdrive/epson/Makefile hw/kdrive/fake/Makefile hw/kdrive/fbdev/Makefile -hw/kdrive/i810/Makefile hw/kdrive/linux/Makefile -hw/kdrive/mach64/Makefile -hw/kdrive/mga/Makefile -hw/kdrive/neomagic/Makefile -hw/kdrive/nvidia/Makefile -hw/kdrive/pm2/Makefile -hw/kdrive/r128/Makefile hw/kdrive/sdl/Makefile -hw/kdrive/sis300/Makefile -hw/kdrive/smi/Makefile hw/kdrive/src/Makefile hw/kdrive/vesa/Makefile -hw/kdrive/via/Makefile -hw/xprint/Makefile -hw/xprint/doc/Makefile -hw/xprint/pcl/Makefile -hw/xprint/pcl-mono/Makefile -hw/xprint/raster/Makefile -hw/xprint/ps/Makefile -hw/xprint/etc/Makefile -hw/xprint/etc/Xsession.d/Makefile -hw/xprint/etc/init.d/Makefile -hw/xprint/etc/profile.d/Makefile -hw/xprint/config/Makefile -hw/xprint/config/C/print/attributes/Makefile -hw/xprint/config/C/print/ddx-config/Makefile -hw/xprint/config/C/print/ddx-config/raster/Makefile -hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile -hw/xprint/config/C/print/models/PSdefault/fonts/Makefile -hw/xprint/config/C/print/models/PSdefault/Makefile -hw/xprint/config/C/print/models/PSspooldir/Makefile -hw/xprint/config/C/print/models/SPSPARC2/Makefile -hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile -hw/xprint/config/C/print/models/GSdefault/Makefile -hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile -hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile -hw/xprint/config/C/print/models/Makefile -hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile -hw/xprint/config/C/print/models/CANONC3200-PS/Makefile -hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile -hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile -hw/xprint/config/C/print/models/HPLJ4family/Makefile -hw/xprint/config/C/print/models/HPDJ1600C/Makefile -hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile -hw/xprint/config/C/print/Makefile -hw/xprint/config/C/Makefile -hw/xprint/config/en_US/print/attributes/Makefile -hw/xprint/config/en_US/print/Makefile -hw/xprint/config/en_US/Makefile xorg-server.pc ]) diff --git a/dix/Makefile.am b/dix/Makefile.am index c24e98530..7a0a98f0e 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -1,10 +1,6 @@ standard_dix_libs = libdix.la libxpstubs.la -if XPRINT -noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la -else noinst_LTLIBRARIES = $(standard_dix_libs) -endif AM_CFLAGS = $(DIX_CFLAGS) \ -DVENDOR_NAME=\""@VENDOR_NAME@"\" \ @@ -46,12 +42,6 @@ libdix_la_SOURCES = \ libxpstubs_la_SOURCES = \ xpstubs.c -if XPRINT -libXpdix_la_SOURCES = $(libdix_la_SOURCES) -libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint -libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS) -endif - EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in # Install list of protocol names diff --git a/dix/dispatch.c b/dix/dispatch.c index 64955d952..8b2169076 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -399,9 +399,6 @@ Dispatch(void) } isItTimeToYield = FALSE; -#ifdef XPRINT - requestingClient = client; -#endif #ifdef SMART_SCHEDULE start_tick = SmartScheduleTime; #endif @@ -473,9 +470,6 @@ Dispatch(void) if (client) client->smart_stop_tick = SmartScheduleTime; #endif -#ifdef XPRINT - requestingClient = NULL; -#endif } dispatchException &= ~DE_PRIORITYCHANGE; } diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 0e6fa0300..83b264a29 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -302,8 +302,14 @@ doOpenFont(ClientPtr client, OFclosurePtr c) c->fontname = newname; c->fnamelen = newlen; c->current_fpe = 0; - if (--aliascount <= 0) + if (--aliascount <= 0) { + /* We've tried resolving this alias 20 times, we're + * probably stuck in an infinite loop of aliases pointing + * to each other - time to take emergency exit! + */ + err = BadImplementation; break; + } continue; } if (err == BadFontName) { @@ -1931,37 +1937,27 @@ GetDefaultPointSize () FontResolutionPtr GetClientResolutions (int *num) { -#ifdef XPRINT - if (requestingClient && requestingClient->fontResFunc != NULL && - !requestingClient->clientGone) - { - return (*requestingClient->fontResFunc)(requestingClient, num); - } - else -#endif - { - static struct _FontResolution res; - ScreenPtr pScreen; + static struct _FontResolution res; + ScreenPtr pScreen; - pScreen = screenInfo.screens[0]; - res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth; - /* - * XXX - we'll want this as long as bitmap instances are prevalent - so that we can match them from scalable fonts - */ - if (res.x_resolution < 88) - res.x_resolution = 75; - else - res.x_resolution = 100; - res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight; - if (res.y_resolution < 88) - res.y_resolution = 75; - else - res.y_resolution = 100; - res.point_size = 120; - *num = 1; - return &res; - } + pScreen = screenInfo.screens[0]; + res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth; + /* + * XXX - we'll want this as long as bitmap instances are prevalent + so that we can match them from scalable fonts + */ + if (res.x_resolution < 88) + res.x_resolution = 75; + else + res.x_resolution = 100; + res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight; + if (res.y_resolution < 88) + res.y_resolution = 75; + else + res.y_resolution = 100; + res.point_size = 120; + *num = 1; + return &res; } /* diff --git a/dix/globals.c b/dix/globals.c index 7f95eabd5..210c7849c 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -136,16 +136,11 @@ Bool screenSaverSuspended = FALSE; char *defaultFontPath = COMPILEDDEFAULTFONTPATH; char *defaultTextFont = COMPILEDDEFAULTFONT; char *defaultCursorFont = COMPILEDCURSORFONT; -char *defaultDisplayClass = COMPILEDDISPLAYCLASS; FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in every compilation of dix code */ -Bool loadableFonts = FALSE; CursorPtr rootCursor; Bool blackRoot=FALSE; Bool whiteRoot=FALSE; -#ifdef XPRINT -ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */ -#endif _X_EXPORT TimeStamp currentTime; _X_EXPORT TimeStamp lastDeviceEventTime; @@ -156,7 +151,5 @@ _X_EXPORT int monitorResolution = 0; _X_EXPORT char *display; CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND; -int argcGlobal; -char **argvGlobal; DDXPointRec dixScreenOrigins[MAXSCREENS]; diff --git a/dix/main.c b/dix/main.c index 42d33091a..11ea29bba 100644 --- a/dix/main.c +++ b/dix/main.c @@ -103,9 +103,6 @@ Equipment Corporation. #include "extnsionst.h" #include "privates.h" #include "registry.h" -#ifdef XPRINT -#include "DiPrint.h" -#endif #ifdef PANORAMIX #include "panoramiXsrv.h" #else @@ -251,9 +248,6 @@ int main(int argc, char *argv[], char *envp[]) InitGlobals(); InitRegions(); -#ifdef XPRINT - PrinterInitGlobals(); -#endif CheckUserParameters(argc, argv, envp); @@ -265,11 +259,6 @@ int main(int argc, char *argv[], char *envp[]) InitConnectionLimits(); - /* These are needed by some routines which are called from interrupt - * handlers, thus have no direct calling path back to main and thus - * can't be passed argc, argv as parameters */ - argcGlobal = argc; - argvGlobal = argv; /* prep X authority file from environment; this can be overriden by a * command line option */ xauthfile = getenv("XAUTHORITY"); @@ -348,9 +337,6 @@ int main(int argc, char *argv[], char *envp[]) InitCallbackManager(); InitVisualWrap(); InitOutput(&screenInfo, argc, argv); -#ifdef XPRINT - PrinterInitOutput(&screenInfo, argc, argv); -#endif if (screenInfo.numScreens < 1) FatalError("no screens found"); @@ -374,13 +360,8 @@ int main(int argc, char *argv[], char *envp[]) } InitFonts(); - if (loadableFonts) - SetFontPath(serverClient, 0, (unsigned char *)defaultFontPath, - &error); - else { - if (SetDefaultFontPath(defaultFontPath) != Success) - ErrorF("[dix] failed to set default font path '%s'", - defaultFontPath); + if (SetDefaultFontPath(defaultFontPath) != Success) { + ErrorF("[dix] failed to set default font path '%s'", defaultFontPath); } if (!SetDefaultFont(defaultTextFont)) { FatalError("could not open default font '%s'", defaultTextFont); diff --git a/dix/xpstubs.c b/dix/xpstubs.c index 59340ad21..f8cd207eb 100644 --- a/dix/xpstubs.c +++ b/dix/xpstubs.c @@ -31,12 +31,8 @@ from The Open Group. #include "misc.h" #include <X11/fonts/font.h> -#ifdef XPRINT -#include "DiPrint.h" -#else extern Bool XpClientIsBitmapClient(ClientPtr client); extern Bool XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe); -#endif Bool XpClientIsBitmapClient( @@ -52,27 +48,3 @@ XpClientIsPrintClient( { return FALSE; } -#ifdef XPRINT -int -PrinterOptions( - int argc, - char **argv, - int i) -{ - return i; -} -void -PrinterInitOutput( - ScreenInfo *pScreenInfo, - int argc, - char **argv) -{ -} -void PrinterUseMsg(void) -{ -} -void PrinterInitGlobals(void) -{ -} -#endif /* XPRINT */ - diff --git a/hw/Makefile.am b/hw/Makefile.am index c2b9571b9..4589b7eef 100644 --- a/hw/Makefile.am +++ b/hw/Makefile.am @@ -26,10 +26,6 @@ if KDRIVE KDRIVE_SUBDIRS = kdrive endif -if XPRINT -XPRINT_SUBDIRS = xprint -endif - if XQUARTZ XQUARTZ_SUBDIRS = xquartz endif @@ -42,10 +38,9 @@ SUBDIRS = \ $(XNEST_SUBDIRS) \ $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ - $(XQUARTZ_SUBDIRS) \ - $(XPRINT_SUBDIRS) + $(XQUARTZ_SUBDIRS) -DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl xprint +DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl relink: for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done diff --git a/hw/kdrive/Makefile.am b/hw/kdrive/Makefile.am index 767e1c40d..c30a157c7 100644 --- a/hw/kdrive/Makefile.am +++ b/hw/kdrive/Makefile.am @@ -1,10 +1,9 @@ if KDRIVEVESA -VESA_SUBDIRS = vesa ati chips i810 mach64 mga nvidia pm2 r128 \ - smi via +VESA_SUBDIRS = vesa endif if BUILD_KDRIVEFBDEVLIB -FBDEV_SUBDIRS = fbdev epson +FBDEV_SUBDIRS = fbdev endif if XFAKESERVER @@ -35,8 +34,7 @@ SUBDIRS = \ $(LINUX_SUBDIRS) \ $(SERVER_SUBDIRS) -DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \ - smi via fbdev sdl ephyr src linux fake sis300 +DIST_SUBDIRS = vesa fbdev sdl ephyr src linux fake relink: @for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done diff --git a/hw/kdrive/Xkdrive.man b/hw/kdrive/Xkdrive.man index b4f1a977d..b37f9f10a 100644 --- a/hw/kdrive/Xkdrive.man +++ b/hw/kdrive/Xkdrive.man @@ -11,26 +11,6 @@ Xkdrive \- tiny X server .B Xfbdev .RI [ :display ] .RI [ option ...] - -.B Xigs -.RI [ :display ] -.RI [ option ...] - -.B Xtrident -.RI [ :display ] -.RI [ option ...] - -.B Xsis530 -.RI [ :display ] -.RI [ option ...] - -.B Xtrio -.RI [ :display ] -.RI [ option ...] - -.B Xitsy -.RI [ :display ] -.RI [ option ...] .SH DESCRIPTION .B Xkdrive is a family of X servers designed to be particularly small. This diff --git a/hw/kdrive/ati/Makefile.am b/hw/kdrive/ati/Makefile.am deleted file mode 100644 index 31462bb04..000000000 --- a/hw/kdrive/ati/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -#if DRI -#DRI_INCLUDES = -I$(top_srcdir)/dri \ -# -I$(top_srcdir)/drm -#DRI_LIBS = $(top_builddir)/dri/libdri.a \ -# $(top_builddir)/drm/libdrm.a -#DRI_SOURCES = ati_dri.c \ -# ati_dri.h \ -# ati_dripriv.h \ -# r128_common.h \ -# r128_sarea.h \ -# radeon_common.h \ -# radeon_sarea.h -#endif - -if KDRIVEFBDEV -FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev -FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a -endif - -if KDRIVEVESA -VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa -VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a -endif - -INCLUDES = \ - @KDRIVE_INCS@ \ - $(DRI_INCLUDES) \ - $(FBDEV_INCLUDES) \ - $(VESA_INCLUDES) \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xati - -noinst_LIBRARIES = libati.a - -libati_a_SOURCES = \ - ati_cursor.c \ - ati_dma.c \ - ati_dma.h \ - ati_draw.c \ - ati_draw.h \ - ati_microcode.c \ - ati.c \ - ati.h \ - ati_reg.h \ - r128_composite.c \ - ati_video.c \ - radeon_composite.c \ - $(DRI_SOURCES) - -Xati_SOURCES = \ - ati_stub.c - -ATI_LIBS = \ - libati.a \ - $(FBDEV_LIBS) \ - $(VESA_LIBS) \ - $(DRI_LIBS) \ - @KDRIVE_LIBS@ - -if GLX -Xati_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xati_LDADD = \ - $(ATI_LIBS) \ - @KDRIVE_LIBS@ - -Xati_DEPENDENCIES = \ - libati.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/ati/ati.c b/hw/kdrive/ati/ati.c deleted file mode 100644 index c4f67e171..000000000 --- a/hw/kdrive/ati/ati.c +++ /dev/null @@ -1,761 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ati.h" -#include "ati_reg.h" -#if defined(USE_DRI) && defined(GLXEXT) -#include "ati_sarea.h" -#endif - -static Bool ATIIsAGP(ATICardInfo *atic); - -#define CAP_SERIESMASK 0xf -#define CAP_R128 0x1 /* If it's a Rage 128 */ -#define CAP_R100 0x2 /* If it's an r100 series radeon. */ -#define CAP_R200 0x3 /* If it's an r200 series radeon. */ -#define CAP_R300 0x4 /* If it's an r300 series radeon. */ - -#define CAP_FEATURESMASK 0xf0 -#define CAP_NOAGP 0x10 /* If it's a PCI-only card. */ - -struct pci_id_entry ati_pci_ids[] = { - {0x1002, 0x4136, 0x2, "ATI Radeon RS100"}, - {0x1002, 0x4137, 0x2, "ATI Radeon RS200"}, - {0x1002, 0x4237, 0x2, "ATI Radeon RS250"}, - {0x1002, 0x4144, 0x4, "ATI Radeon R300 AD"}, - {0x1002, 0x4145, 0x4, "ATI Radeon R300 AE"}, - {0x1002, 0x4146, 0x4, "ATI Radeon R300 AF"}, - {0x1002, 0x4147, 0x4, "ATI Radeon R300 AG"}, - {0x1002, 0x4148, 0x4, "ATI Radeon R350 AH"}, - {0x1002, 0x4149, 0x4, "ATI Radeon R350 AI"}, - {0x1002, 0x414a, 0x4, "ATI Radeon R350 AJ"}, - {0x1002, 0x414b, 0x4, "ATI Radeon R350 AK"}, - {0x1002, 0x4150, 0x4, "ATI Radeon RV350 AP"}, - {0x1002, 0x4151, 0x4, "ATI Radeon RV350 AQ"}, - {0x1002, 0x4152, 0x4, "ATI Radeon RV350 AR"}, - {0x1002, 0x4153, 0x4, "ATI Radeon RV350 AS"}, - {0x1002, 0x4154, 0x4, "ATI Radeon RV350 AT"}, - {0x1002, 0x4156, 0x4, "ATI Radeon RV350 AV"}, - {0x1002, 0x4242, 0x3, "ATI Radeon R200 BB"}, - {0x1002, 0x4243, 0x3, "ATI Radeon R200 BC"}, - {0x1002, 0x4336, 0x2, "ATI Radeon RS100"}, - {0x1002, 0x4337, 0x2, "ATI Radeon RS200"}, - {0x1002, 0x4437, 0x2, "ATI Radeon RS250"}, - {0x1002, 0x4964, 0x2, "ATI Radeon RV250 Id"}, - {0x1002, 0x4965, 0x2, "ATI Radeon RV250 Ie"}, - {0x1002, 0x4966, 0x2, "ATI Radeon RV250 If"}, - {0x1002, 0x4967, 0x2, "ATI Radeon R250 Ig"}, - {0x1002, 0x4c45, 0x11, "ATI Rage 128 LE"}, - {0x1002, 0x4c46, 0x1, "ATI Rage 128 LF"}, - {0x1002, 0x4c57, 0x2, "ATI Radeon Mobiliy M7 RV200 LW (7500)"}, - {0x1002, 0x4c58, 0x2, "ATI Radeon Mobiliy M7 RV200 LX (7500)"}, - {0x1002, 0x4c59, 0x2, "ATI Radeon Mobility M6 LY"}, - {0x1002, 0x4c5a, 0x2, "ATI Radeon Mobility M6 LZ"}, - {0x1002, 0x4c64, 0x3, "ATI Radeon RV250 Ld"}, - {0x1002, 0x4c65, 0x3, "ATI Radeon RV250 Le"}, - {0x1002, 0x4c66, 0x3, "ATI Radeon Mobility M9 RV250 Lf"}, - {0x1002, 0x4c67, 0x3, "ATI Radeon RV250 Lg"}, - {0x1002, 0x4d46, 0x1, "ATI Rage 128 MF"}, - {0x1002, 0x4d46, 0x1, "ATI Rage 128 ML"}, - {0x1002, 0x4e44, 0x4, "ATI Radeon R300 ND"}, - {0x1002, 0x4e45, 0x4, "ATI Radeon R300 NE"}, - {0x1002, 0x4e46, 0x4, "ATI Radeon R300 NF"}, - {0x1002, 0x4e47, 0x4, "ATI Radeon R300 NG"}, - {0x1002, 0x4e48, 0x4, "ATI Radeon R350 NH"}, - {0x1002, 0x4e49, 0x4, "ATI Radeon R350 NI"}, - {0x1002, 0x4e4a, 0x4, "ATI Radeon R350 NJ"}, - {0x1002, 0x4e4b, 0x4, "ATI Radeon R350 NK"}, - {0x1002, 0x4e50, 0x4, "ATI Radeon Mobility RV350 NP"}, - {0x1002, 0x4e51, 0x4, "ATI Radeon Mobility RV350 NQ"}, - {0x1002, 0x4e52, 0x4, "ATI Radeon Mobility RV350 NR"}, - {0x1002, 0x4e53, 0x4, "ATI Radeon Mobility RV350 NS"}, - {0x1002, 0x4e54, 0x4, "ATI Radeon Mobility RV350 NT"}, - {0x1002, 0x4e56, 0x4, "ATI Radeon Mobility RV350 NV"}, - {0x1002, 0x5041, 0x1, "ATI Rage 128 PA"}, - {0x1002, 0x5042, 0x1, "ATI Rage 128 PB"}, - {0x1002, 0x5043, 0x1, "ATI Rage 128 PC"}, - {0x1002, 0x5044, 0x11, "ATI Rage 128 PD"}, - {0x1002, 0x5045, 0x1, "ATI Rage 128 PE"}, - {0x1002, 0x5046, 0x1, "ATI Rage 128 PF"}, - {0x1002, 0x5047, 0x1, "ATI Rage 128 PG"}, - {0x1002, 0x5048, 0x1, "ATI Rage 128 PH"}, - {0x1002, 0x5049, 0x1, "ATI Rage 128 PI"}, - {0x1002, 0x504a, 0x1, "ATI Rage 128 PJ"}, - {0x1002, 0x504b, 0x1, "ATI Rage 128 PK"}, - {0x1002, 0x504c, 0x1, "ATI Rage 128 PL"}, - {0x1002, 0x504d, 0x1, "ATI Rage 128 PM"}, - {0x1002, 0x504e, 0x1, "ATI Rage 128 PN"}, - {0x1002, 0x504f, 0x1, "ATI Rage 128 PO"}, - {0x1002, 0x5050, 0x11, "ATI Rage 128 PP"}, - {0x1002, 0x5051, 0x1, "ATI Rage 128 PQ"}, - {0x1002, 0x5052, 0x11, "ATI Rage 128 PR"}, - {0x1002, 0x5053, 0x1, "ATI Rage 128 PS"}, - {0x1002, 0x5054, 0x1, "ATI Rage 128 PT"}, - {0x1002, 0x5055, 0x1, "ATI Rage 128 PU"}, - {0x1002, 0x5056, 0x1, "ATI Rage 128 PV"}, - {0x1002, 0x5057, 0x1, "ATI Rage 128 PW"}, - {0x1002, 0x5058, 0x1, "ATI Rage 128 PX"}, - {0x1002, 0x5144, 0x2, "ATI Radeon R100 QD"}, - {0x1002, 0x5145, 0x2, "ATI Radeon R100 QE"}, - {0x1002, 0x5146, 0x2, "ATI Radeon R100 QF"}, - {0x1002, 0x5147, 0x2, "ATI Radeon R100 QG"}, - {0x1002, 0x5148, 0x3, "ATI Radeon R200 QH"}, - {0x1002, 0x514c, 0x3, "ATI Radeon R200 QL"}, - {0x1002, 0x514d, 0x3, "ATI Radeon R200 QM"}, - {0x1002, 0x5157, 0x2, "ATI Radeon RV200 QW (7500)"}, - {0x1002, 0x5158, 0x2, "ATI Radeon RV200 QX (7500)"}, - {0x1002, 0x5159, 0x2, "ATI Radeon RV100 QY"}, - {0x1002, 0x515a, 0x2, "ATI Radeon RV100 QZ"}, - {0x1002, 0x5245, 0x11, "ATI Rage 128 RE"}, - {0x1002, 0x5246, 0x1, "ATI Rage 128 RF"}, - {0x1002, 0x5247, 0x1, "ATI Rage 128 RG"}, - {0x1002, 0x524b, 0x11, "ATI Rage 128 RK"}, - {0x1002, 0x524c, 0x1, "ATI Rage 128 RL"}, - {0x1002, 0x5345, 0x1, "ATI Rage 128 SE"}, - {0x1002, 0x5346, 0x1, "ATI Rage 128 SF"}, - {0x1002, 0x5347, 0x1, "ATI Rage 128 SG"}, - {0x1002, 0x5348, 0x1, "ATI Rage 128 SH"}, - {0x1002, 0x534b, 0x1, "ATI Rage 128 SK"}, - {0x1002, 0x534c, 0x1, "ATI Rage 128 SL"}, - {0x1002, 0x534d, 0x1, "ATI Rage 128 SM"}, - {0x1002, 0x534e, 0x1, "ATI Rage 128 SN"}, - {0x1002, 0x5446, 0x1, "ATI Rage 128 TF"}, - {0x1002, 0x544c, 0x1, "ATI Rage 128 TL"}, - {0x1002, 0x5452, 0x1, "ATI Rage 128 TR"}, - {0x1002, 0x5453, 0x1, "ATI Rage 128 TS"}, - {0x1002, 0x5454, 0x1, "ATI Rage 128 TT"}, - {0x1002, 0x5455, 0x1, "ATI Rage 128 TU"}, - {0x1002, 0x5834, 0x3, "ATI Radeon RS300"}, - {0x1002, 0x5835, 0x3, "ATI Radeon RS300 Mobility"}, - {0x1002, 0x5941, 0x3, "ATI Radeon RV280 (9200)"}, - {0x1002, 0x5961, 0x3, "ATI Radeon RV280 (9200 SE)"}, - {0x1002, 0x5964, 0x3, "ATI Radeon RV280 (9200 SE)"}, - {0x1002, 0x5c60, 0x3, "ATI Radeon RV280"}, - {0x1002, 0x5c61, 0x3, "ATI Radeon RV280 Mobility"}, - {0x1002, 0x5c62, 0x3, "ATI Radeon RV280"}, - {0x1002, 0x5c63, 0x3, "ATI Radeon RV280 Mobility"}, - {0x1002, 0x5c64, 0x3, "ATI Radeon RV280"}, - {0, 0, 0, NULL} -}; - -static char * -make_busid(KdCardAttr *attr) -{ - char *busid; - - busid = xalloc(20); - if (busid == NULL) - return NULL; - snprintf(busid, 20, "pci:%04x:%02x:%02x.%d", attr->domain, attr->bus, - attr->slot, attr->func); - return busid; -} - -static Bool -ATICardInit(KdCardInfo *card) -{ - ATICardInfo *atic; - int i; - Bool initialized = FALSE; - - atic = xcalloc(sizeof(ATICardInfo), 1); - if (atic == NULL) - return FALSE; - -#ifdef KDRIVEFBDEV - if (!initialized && fbdevInitialize(card, &atic->backend_priv.fbdev)) { - atic->use_fbdev = TRUE; - initialized = TRUE; - atic->backend_funcs.cardfini = fbdevCardFini; - atic->backend_funcs.scrfini = fbdevScreenFini; - atic->backend_funcs.initScreen = fbdevInitScreen; - atic->backend_funcs.finishInitScreen = fbdevFinishInitScreen; - atic->backend_funcs.createRes = fbdevCreateResources; - atic->backend_funcs.preserve = fbdevPreserve; - atic->backend_funcs.restore = fbdevRestore; - atic->backend_funcs.dpms = fbdevDPMS; - atic->backend_funcs.enable = fbdevEnable; - atic->backend_funcs.disable = fbdevDisable; - atic->backend_funcs.getColors = fbdevGetColors; - atic->backend_funcs.putColors = fbdevPutColors; -#ifdef RANDR - atic->backend_funcs.randrSetConfig = fbdevRandRSetConfig; -#endif - } -#endif -#ifdef KDRIVEVESA - if (!initialized && vesaInitialize(card, &atic->backend_priv.vesa)) { - atic->use_vesa = TRUE; - initialized = TRUE; - atic->backend_funcs.cardfini = vesaCardFini; - atic->backend_funcs.scrfini = vesaScreenFini; - atic->backend_funcs.initScreen = vesaInitScreen; - atic->backend_funcs.finishInitScreen = vesaFinishInitScreen; - atic->backend_funcs.createRes = vesaCreateResources; - atic->backend_funcs.preserve = vesaPreserve; - atic->backend_funcs.restore = vesaRestore; - atic->backend_funcs.dpms = vesaDPMS; - atic->backend_funcs.enable = vesaEnable; - atic->backend_funcs.disable = vesaDisable; - atic->backend_funcs.getColors = vesaGetColors; - atic->backend_funcs.putColors = vesaPutColors; -#ifdef RANDR - atic->backend_funcs.randrSetConfig = vesaRandRSetConfig; -#endif - } -#endif - - if (!initialized || !ATIMapReg(card, atic)) { - xfree(atic); - return FALSE; - } - - atic->busid = make_busid(&card->attr); - if (atic->busid == NULL) { - xfree(atic); - return FALSE; - } - -#ifdef USE_DRI - /* We demand identification by busid, not driver name */ - atic->drmFd = drmOpen(NULL, atic->busid); - if (atic->drmFd < 0) - ErrorF("Failed to open DRM, DRI disabled.\n"); -#endif /* USE_DRI */ - - card->driver = atic; - - for (i = 0; ati_pci_ids[i].name != NULL; i++) { - if (ati_pci_ids[i].device == card->attr.deviceID) { - atic->pci_id = &ati_pci_ids[i]; - break; - } - } - - if ((atic->pci_id->caps & CAP_SERIESMASK) != CAP_R128) - atic->is_radeon = TRUE; - if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R100) - atic->is_r100 = TRUE; - if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R200) - atic->is_r200 = TRUE; - if ((atic->pci_id->caps & CAP_SERIESMASK) == CAP_R300) - atic->is_r300 = TRUE; - - atic->is_agp = ATIIsAGP(atic); - - ErrorF("Using ATI card: %s (%s) at %s\n", atic->pci_id->name, - atic->is_agp ? "AGP" : "PCI", atic->busid); - - return TRUE; -} - -static void -ATICardFini(KdCardInfo *card) -{ - ATICardInfo *atic = (ATICardInfo *)card->driver; - - ATIUnmapReg(card, atic); - atic->backend_funcs.cardfini(card); -} - -/* - * Once screen->off_screen_base is set, this function - * allocates the remaining memory appropriately - */ - -static void -ATISetOffscreen (KdScreenInfo *screen) -{ - ATICardInfo(screen); -#if defined(USE_DRI) && defined(GLXEXT) - ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver; - int l; -#endif - int screen_size; - char *mmio = atic->reg_base; - - /* check (and adjust) pitch */ - if (mmio) - { - int byteStride = screen->fb[0].byteStride; - int bitStride; - int pixelStride; - int bpp = screen->fb[0].bitsPerPixel; - - /* - * Ensure frame buffer is correctly aligned - */ - if (byteStride & 0x3f) - { - byteStride = (byteStride + 0x3f) & ~0x3f; - bitStride = byteStride * 8; - pixelStride = bitStride / bpp; - - screen->fb[0].byteStride = byteStride; - screen->fb[0].pixelStride = pixelStride; - } - } - - screen_size = screen->fb[0].byteStride * screen->height; - - screen->off_screen_base = screen_size; - -#if defined(USE_DRI) && defined(GLXEXT) - /* Reserve a static area for the back buffer the same size as the - * visible screen. XXX: This would be better initialized in ati_dri.c - * when GLX is set up, but the offscreen memory manager's allocations - * don't last through VT switches, while the kernel's understanding of - * offscreen locations does. - */ - atis->frontOffset = 0; - atis->frontPitch = screen->fb[0].byteStride; - - if (screen->off_screen_base + screen_size <= screen->memory_size) { - atis->backOffset = screen->off_screen_base; - atis->backPitch = screen->fb[0].byteStride; - screen->off_screen_base += screen_size; - } - - /* Reserve the depth span for Rage 128 */ - if (!atic->is_radeon && screen->off_screen_base + - screen->fb[0].byteStride <= screen->memory_size) { - atis->spanOffset = screen->off_screen_base; - screen->off_screen_base += screen->fb[0].byteStride; - } - - /* Reserve the static depth buffer, which happens to be the same - * bitsPerPixel as the screen. - */ - if (screen->off_screen_base + screen_size <= screen->memory_size) { - atis->depthOffset = screen->off_screen_base; - atis->depthPitch = screen->fb[0].byteStride; - screen->off_screen_base += screen_size; - } - - /* Reserve approx. half of remaining offscreen memory for local - * textures. Round down to a whole number of texture regions. - */ - atis->textureSize = (screen->memory_size - screen->off_screen_base) / 2; - l = ATILog2(atis->textureSize / ATI_NR_TEX_REGIONS); - if (l < ATI_LOG_TEX_GRANULARITY) - l = ATI_LOG_TEX_GRANULARITY; - atis->textureSize = (atis->textureSize >> l) << l; - if (atis->textureSize >= 512 * 1024) { - atis->textureOffset = screen->off_screen_base; - screen->off_screen_base += atis->textureSize; - } else { - /* Minimum texture size is for 2 256x256x32bpp textures */ - atis->textureSize = 0; - } -#endif /* USE_DRI && GLXEXT */ -} - -static void -ATISetPitch (KdScreenInfo *screen) -{ - ATICardInfo(screen); -#if defined(USE_DRI) && defined(GLXEXT) - ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver; - int l; -#endif - char *mmio = atic->reg_base; - - /* check (and adjust) pitch for radeon */ - if (mmio) - { - int byteStride = screen->fb[0].byteStride; - int bitStride; - int pixelStride; - int bpp = screen->fb[0].bitsPerPixel; - CARD32 crtc_pitch; - CARD32 crtc2_pitch; -#if 0 - CARD32 crtc_ext_cntl; - CARD32 dac_cntl; -#endif - bitStride = byteStride * 8; - pixelStride = bitStride / bpp; - - crtc_pitch = (pixelStride >> 3); - crtc_pitch |= crtc_pitch << 16; - crtc2_pitch = (pixelStride >> 3); - crtc2_pitch |= crtc2_pitch << 16; -#if 0 - crtc_ext_cntl = MMIO_IN32 (mmio, ATI_REG_CRTC_EXT_CNTL); - dac_cntl = MMIO_IN32 (mmio, ATI_REG_DAC_CNTL); - /* Turn off the screen */ - MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL, - crtc_ext_cntl | - ATI_CRTC_VSYNC_DIS | - ATI_CRTC_HSYNC_DIS | - ATI_CRTC_DISPLAY_DIS); - MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL, - dac_cntl | - ATI_DAC_RANGE_CNTL | - ATI_DAC_BLANKING); -#endif - MMIO_OUT32 (mmio, ATI_REG_CRTC_PITCH, crtc_pitch); - MMIO_OUT32 (mmio, ATI_REG_CRTC2_PITCH, crtc2_pitch); -#if 0 - /* Turn the screen back on */ - MMIO_OUT32 (mmio, ATI_REG_CRTC_EXT_CNTL, - crtc_ext_cntl); - MMIO_OUT32 (mmio, ATI_REG_DAC_CNTL, - dac_cntl); -#endif - } -} - -static Bool -ATIScreenInit(KdScreenInfo *screen) -{ - ATIScreenInfo *atis; - ATICardInfo(screen); - Bool success = FALSE; - - atis = xcalloc(sizeof(ATIScreenInfo), 1); - if (atis == NULL) - return FALSE; - - atis->atic = atic; - atis->screen = screen; - screen->driver = atis; - - if (screen->fb[0].depth == 0) - screen->fb[0].depth = 16; -#ifdef KDRIVEFBDEV - if (atic->use_fbdev) { - success = fbdevScreenInitialize(screen, - &atis->backend_priv.fbdev); - } -#endif -#ifdef KDRIVEVESA - if (atic->use_vesa) { - success = vesaScreenInitialize(screen, - &atis->backend_priv.vesa); - } -#endif - - if (!success) { - screen->driver = NULL; - xfree(atis); - return FALSE; - } - - ATISetOffscreen (screen); - - return TRUE; -} - -#ifdef RANDR -static Bool -ATIRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - ATICardInfo *atic = screen->card->driver; - Bool ret; - - ATIDrawDisable (pScreen); - ret = atic->backend_funcs.randrSetConfig(pScreen, randr, rate, pSize); - ATISetOffscreen (screen); - ATISetPitch (screen); - /* - * Set frame buffer mapping - */ - (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), - pScreen->width, - pScreen->height, - screen->fb[0].depth, - screen->fb[0].bitsPerPixel, - screen->fb[0].byteStride, - screen->fb[0].frameBuffer); - - ATIDrawEnable (pScreen); - return ret; -} - -static Bool -ATIRandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrSetConfig = ATIRandRSetConfig; - return TRUE; -} -#endif - -static void -ATIScreenFini(KdScreenInfo *screen) -{ - ATIScreenInfo *atis = (ATIScreenInfo *)screen->driver; - ATICardInfo *atic = screen->card->driver; - -#ifdef XV - ATIFiniVideo(screen->pScreen); -#endif - - atic->backend_funcs.scrfini(screen); - xfree(atis); - screen->driver = 0; -} - -Bool -ATIMapReg(KdCardInfo *card, ATICardInfo *atic) -{ - atic->reg_base = (char *)KdMapDevice(ATI_REG_BASE(card), - ATI_REG_SIZE(card)); - - if (atic->reg_base == NULL) - return FALSE; - - KdSetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -void -ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic) -{ - if (atic->reg_base) { - KdResetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice((void *)atic->reg_base, ATI_REG_SIZE(card)); - atic->reg_base = 0; - } -} - -static Bool -ATIInitScreen(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - -#ifdef XV - ATIInitVideo(pScreen); -#endif - return atic->backend_funcs.initScreen(pScreen); -} - -static Bool -ATIFinishInitScreen(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - if (!atic->backend_funcs.finishInitScreen(pScreen)) - return FALSE; -#ifdef RANDR - if (!ATIRandRInit (pScreen)) - return FALSE; -#endif - return TRUE; -} - -static Bool -ATICreateResources(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - return atic->backend_funcs.createRes(pScreen); -} - -static void -ATIPreserve(KdCardInfo *card) -{ - ATICardInfo *atic = card->driver; - char *mmio = atic->reg_base; - - atic->backend_funcs.preserve(card); - if (atic->is_radeon && mmio) - { - atic->crtc_pitch = MMIO_IN32(mmio, ATI_REG_CRTC_PITCH); - atic->crtc2_pitch = MMIO_IN32(mmio, ATI_REG_CRTC2_PITCH); - - } -} - -static void -ATIRestore(KdCardInfo *card) -{ - ATICardInfo *atic = card->driver; - char *mmio = atic->reg_base; - - if (mmio) - { - MMIO_OUT32(mmio, ATI_REG_CRTC_PITCH, atic->crtc_pitch); - MMIO_OUT32(mmio, ATI_REG_CRTC2_PITCH, atic->crtc2_pitch); - } - ATIUnmapReg(card, atic); - - atic->backend_funcs.restore(card); -} - -static Bool -ATIDPMS(ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - return atic->backend_funcs.dpms(pScreen, mode); -} - -static Bool -ATIEnable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - if (!atic->backend_funcs.enable(pScreen)) - return FALSE; - - if ((atic->reg_base == NULL) && !ATIMapReg(pScreenPriv->screen->card, - atic)) - return FALSE; - - ATISetOffscreen (pScreenPriv->screen); - - ATISetPitch (pScreenPriv->screen); - - return TRUE; -} - -static void -ATIDisable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); -#if defined(USE_DRI) && defined(GLXEXT) - ATIScreenInfo(pScreenPriv); -#endif /* USE_DRI && GLXEXT */ - ATICardInfo(pScreenPriv); - - ATIUnmapReg(pScreenPriv->card, atic); - - atic->backend_funcs.disable(pScreen); -} - -static void -ATIGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - atic->backend_funcs.getColors(pScreen, fb, n, pdefs); -} - -static void -ATIPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - atic->backend_funcs.putColors(pScreen, fb, n, pdefs); -} - -/* Compute log base 2 of val. */ -int -ATILog2(int val) -{ - int bits; - - for (bits = 0; val != 0; val >>= 1, ++bits) - ; - return bits - 1; -} - -static Bool -ATIIsAGP(ATICardInfo *atic) -{ - char *mmio = atic->reg_base; - CARD32 cap_ptr, cap_id; - - if (mmio == NULL) - return FALSE; - - if (MMIO_IN32(mmio, ATI_REG_PCI_CFG_STATUS) & ATI_CAP_LIST) { - cap_ptr = MMIO_IN32(mmio, ATI_REG_PCI_CFG_CAPABILITIES_PTR) & - ATI_CAP_PTR_MASK; - while (cap_ptr != ATI_CAP_ID_NULL) { - cap_id = MMIO_IN32(mmio, ATI_PCI_CFG_OFFSET + cap_ptr); - if ((cap_id & 0xff) == ATI_CAP_ID_AGP) - return TRUE; - cap_ptr = (cap_id >> 8) & ATI_CAP_PTR_MASK; - } - } - - return FALSE; -} - -/* This function is required to work around a hardware bug in some (all?) - * revisions of the R300. This workaround should be called after every - * CLOCK_CNTL_INDEX register access. If not, register reads afterward - * may not be correct. - */ -void R300CGWorkaround(ATIScreenInfo *atis) { - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - CARD32 save; - - save = MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX); - MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save & ~(0x3f | - ATI_PLL_WR_EN)); - MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX); - MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, save); -} - -KdCardFuncs ATIFuncs = { - ATICardInit, /* cardinit */ - ATIScreenInit, /* scrinit */ - ATIInitScreen, /* initScreen */ - ATIFinishInitScreen, /* finishInitScreen */ - ATICreateResources, /* createRes */ - ATIPreserve, /* preserve */ - ATIEnable, /* enable */ - ATIDPMS, /* dpms */ - ATIDisable, /* disable */ - ATIRestore, /* restore */ - ATIScreenFini, /* scrfini */ - ATICardFini, /* cardfini */ - - ATICursorInit, /* initCursor */ - ATICursorEnable, /* enableCursor */ - ATICursorDisable, /* disableCursor */ - ATICursorFini, /* finiCursor */ - ATIRecolorCursor, /* recolorCursor */ - - ATIDrawInit, /* initAccel */ - ATIDrawEnable, /* enableAccel */ - ATIDrawDisable, /* disableAccel */ - ATIDrawFini, /* finiAccel */ - - ATIGetColors, /* getColors */ - ATIPutColors, /* putColors */ -}; diff --git a/hw/kdrive/ati/ati.h b/hw/kdrive/ati/ati.h deleted file mode 100644 index 3ff3e3ff3..000000000 --- a/hw/kdrive/ati/ati.h +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 _ATI_H_ -#define _ATI_H_ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#ifdef KDRIVEFBDEV -#include <fbdev.h> -#endif -#ifdef KDRIVEVESA -#include <vesa.h> -#endif - -#include "kxv.h" - -#undef XF86DRI -#ifdef XF86DRI -#define USE_DRI -#include "xf86drm.h" -#include "dri.h" -#ifdef GLXEXT -#include "GL/glxint.h" -#include "GL/glxtokens.h" -#include "ati_dripriv.h" -#endif -#endif - -#define ATI_REG_BASE(c) ((c)->attr.address[1]) -#define ATI_REG_SIZE(c) (0x4000) - -#ifdef __powerpc__ - -static __inline__ void -MMIO_OUT32(__volatile__ void *base, const unsigned long offset, - const unsigned int val) -{ - __asm__ __volatile__( - "stwbrx %1,%2,%3\n\t" - "eieio" - : "=m" (*((volatile unsigned char *)base+offset)) - : "r" (val), "b" (base), "r" (offset)); -} - -static __inline__ CARD32 -MMIO_IN32(__volatile__ void *base, const unsigned long offset) -{ - register unsigned int val; - __asm__ __volatile__( - "lwbrx %0,%1,%2\n\t" - "eieio" - : "=r" (val) - : "b" (base), "r" (offset), - "m" (*((volatile unsigned char *)base+offset))); - return val; -} - -#else - -#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v)) -#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a))) - -#endif - -#define MMIO_OUT8(mmio, a, v) (*(VOL8 *)((mmio) + (a)) = (v)) -#define MMIO_IN8(mmio, a, v) (*(VOL8 *)((mmio) + (a))) - -#define INPLL(mmio, addr) \ - (MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, addr), \ - MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_DATA)) - -#define OUTPLL(mmio, addr, val) do { \ - MMIO_OUT8(mmio, ATI_REG_CLOCK_CNTL_INDEX, (addr) | ATI_PLL_WR_EN); \ - MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_DATA, val); \ -} while (0) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -struct pci_id_entry { - CARD16 vendor; - CARD16 device; - CARD8 caps; - char *name; -}; - -struct backend_funcs { - void (*cardfini)(KdCardInfo *); - void (*scrfini)(KdScreenInfo *); - Bool (*initScreen)(ScreenPtr); - Bool (*finishInitScreen)(ScreenPtr pScreen); - Bool (*createRes)(ScreenPtr); - void (*preserve)(KdCardInfo *); - void (*restore)(KdCardInfo *); - Bool (*dpms)(ScreenPtr, int); - Bool (*enable)(ScreenPtr); - void (*disable)(ScreenPtr); - void (*getColors)(ScreenPtr, int, int, xColorItem *); - void (*putColors)(ScreenPtr, int, int, xColorItem *); -#ifdef RANDR - Bool (*randrSetConfig) (ScreenPtr, Rotation, int, RRScreenSizePtr); -#endif -}; - -typedef struct _ATICardInfo { - union { -#ifdef KDRIVEFBDEV - FbdevPriv fbdev; -#endif -#ifdef KDRIVEVESA - VesaCardPrivRec vesa; -#endif - } backend_priv; - struct backend_funcs backend_funcs; - - struct pci_id_entry *pci_id; - char *reg_base; - Bool is_radeon; - Bool is_r100; - Bool is_r200; - Bool is_r300; - Bool is_agp; - char *busid; - CARD32 crtc_pitch; - CARD32 crtc2_pitch; -#ifdef USE_DRI - int drmFd; -#endif /* USE_DRI */ - Bool use_fbdev, use_vesa; -} ATICardInfo; - -#define getATICardInfo(kd) ((ATICardInfo *) ((kd)->card->driver)) -#define ATICardInfo(kd) ATICardInfo *atic = getATICardInfo(kd) - -typedef struct _ATICursor { - int width, height; - int xhot, yhot; - - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; - KdOffscreenArea *area; -} ATICursor; - -typedef struct _ATIPortPriv { - int brightness; - int saturation; - RegionRec clip; - CARD32 size; - KdOffscreenArea *off_screen; - DrawablePtr pDraw; - PixmapPtr pPixmap; - - CARD32 src_offset; - CARD32 src_pitch; - CARD8 *src_addr; - - int id; - int src_x1, src_y1, src_x2, src_y2; - int dst_x1, dst_y1, dst_x2, dst_y2; - int src_w, src_h, dst_w, dst_h; -} ATIPortPrivRec, *ATIPortPrivPtr; - -typedef struct _dmaBuf { - int size; - int used; - void *address; -#ifdef USE_DRI - drmBufPtr drmBuf; -#endif -} dmaBuf; - -typedef struct _ATIScreenInfo { - union { -#ifdef KDRIVEFBDEV - FbdevScrPriv fbdev; -#endif -#ifdef KDRIVEVESA - VesaScreenPrivRec vesa; -#endif - } backend_priv; - KaaScreenInfoRec kaa; - - ATICardInfo *atic; - KdScreenInfo *screen; - - int scratch_offset; - int scratch_next; - KdOffscreenArea *scratch_area; - - ATICursor cursor; - - KdVideoAdaptorPtr pAdaptor; - int num_texture_ports; - - Bool using_pio; /* If we use decode DMA packets to MMIO. */ - Bool using_pseudo; /* If we use MMIO to submit DMA packets. */ - Bool using_dma; /* If we use non-DRI DMA to submit packets. */ - Bool using_dri; /* If we use the DRM for DMA. */ - Bool using_agp; /* If we are using AGP or not for DMA. */ - - KdOffscreenArea *dma_space; /* For "DMA" from framebuffer. */ - void *agp_addr; /* Mapped AGP aperture */ - int agp_size; - int agp_key; /* Key of AGP memory for DMA */ - CARD32 *ring_addr; /* Beginning of ring buffer. */ - int ring_write; /* Index of write ptr in ring. */ - int ring_read; /* Index of read ptr in ring. */ - int ring_len; - - - dmaBuf *indirectBuffer; - int indirectStart; - - int mmio_avail; - int cce_pri_size; - int cce_pri_avail; - -#ifdef USE_DRI - Bool dma_started; - - drmSize registerSize; - drmHandle registerHandle; - drmHandle fbHandle; - - drmSize gartSize; - drmHandle agpMemHandle; /* Handle from drmAgpAlloc */ - unsigned long gartOffset; - unsigned char *AGP; /* Map */ - int agpMode; - drmSize pciSize; - drmHandle pciMemHandle; - - /* ring buffer data */ - unsigned long ringStart; /* Offset into AGP space */ - drmHandle ringHandle; /* Handle from drmAddMap */ - drmSize ringMapSize; /* Size of map */ - int ringSize; /* Size of ring (MB) */ - unsigned char *ring; /* Map */ - - unsigned long ringReadOffset; /* Offset into AGP space */ - drmHandle ringReadPtrHandle; /* Handle from drmAddMap */ - drmSize ringReadMapSize; /* Size of map */ - unsigned char *ringReadPtr; /* Map */ - - /* vertex/indirect buffer data */ - unsigned long bufStart; /* Offset into AGP space */ - drmHandle bufHandle; /* Handle from drmAddMap */ - drmSize bufMapSize; /* Size of map */ - int bufSize; /* Size of buffers (MB) */ - unsigned char *buf; /* Map */ - int bufNumBufs; /* Number of buffers */ - drmBufMapPtr buffers; /* Buffer map */ - - /* AGP Texture data */ - unsigned long gartTexStart; /* Offset into AGP space */ - drmHandle gartTexHandle; /* Handle from drmAddMap */ - drmSize gartTexMapSize; /* Size of map */ - int gartTexSize; /* Size of AGP tex space (MB) */ - unsigned char *gartTex; /* Map */ - int log2GARTTexGran; - - int DMAusecTimeout; /* CCE timeout in usecs */ - - /* DRI screen private data */ - int frontOffset; - int frontPitch; - int backOffset; - int backPitch; - int depthOffset; - int depthPitch; - int spanOffset; - int textureOffset; - int textureSize; - int log2TexGran; - - int irqEnabled; - - int serverContext; - - DRIInfoPtr pDRIInfo; -#ifdef GLXEXT - int numVisualConfigs; - __GLXvisualConfig *pVisualConfigs; - ATIConfigPrivPtr pVisualConfigsPriv; -#endif /* GLXEXT */ -#endif /* USE_DRI */ -} ATIScreenInfo; - -#define getATIScreenInfo(kd) ((ATIScreenInfo *) ((kd)->screen->driver)) -#define ATIScreenInfo(kd) ATIScreenInfo *atis = getATIScreenInfo(kd) - -typedef union { float f; CARD32 i; } fi_type; - -/* Surely there's a better way to go about this */ -static inline CARD32 -ATIFloatAsInt(float val) -{ - fi_type fi; - - fi.f = val; - return fi.i; -} - -#define GET_FLOAT_BITS(x) ATIFloatAsInt(x) - -/* ati.c */ -Bool -ATIMapReg(KdCardInfo *card, ATICardInfo *atic); - -void -ATIUnmapReg(KdCardInfo *card, ATICardInfo *atic); - -void -R300CGWorkaround(ATIScreenInfo *atis); - -/* ati_draw.c */ -void -ATIDrawSetup(ScreenPtr pScreen); - -Bool -ATIDrawInit(ScreenPtr pScreen); - -void -ATIDrawEnable(ScreenPtr pScreen); - -void -ATIDrawDisable(ScreenPtr pScreen); - -void -ATIDrawFini(ScreenPtr pScreen); - -/* ati_dri.c */ -#ifdef USE_DRI -Bool -ATIDRIScreenInit(ScreenPtr pScreen); - -void -ATIDRICloseScreen(ScreenPtr pScreen); - -void -ATIDRIDMAStart(ATIScreenInfo *atis); - -void -ATIDRIDMAStop(ATIScreenInfo *atis); - -void -ATIDRIDMAReset(ATIScreenInfo *atis); - -void -ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard); - -drmBufPtr -ATIDRIGetBuffer(ATIScreenInfo *atis); - -#endif /* USE_DRI */ - -/* ati_cursor.c */ -Bool -ATICursorInit(ScreenPtr pScreen); - -void -ATICursorEnable(ScreenPtr pScreen); - -void -ATICursorDisable(ScreenPtr pScreen); - -void -ATICursorFini(ScreenPtr pScreen); - -void -ATIRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef); - -int -ATILog2(int val); - -/* ati_video.c */ -Bool -ATIInitVideo(ScreenPtr pScreen); - -void -ATIFiniVideo(ScreenPtr pScreen); - -extern KdCardFuncs ATIFuncs; - -#endif /* _ATI_H_ */ diff --git a/hw/kdrive/ati/ati_cursor.c b/hw/kdrive/ati/ati_cursor.c deleted file mode 100644 index 0e9715118..000000000 --- a/hw/kdrive/ati/ati_cursor.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * Copyright © 2004 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ati.h" -#include "ati_reg.h" -#include "cursorstr.h" -#include "ati_draw.h" -#include "inputstr.h" - -static void -ATIMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - CARD16 xoff, yoff; - char *mmio = atic->reg_base; - int stride = atic->is_radeon ? 256 : 16; - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) { - yoff = -y; - y = 0; - } - - MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_OFF, ATI_CUR_LOCK | - (xoff << 16) | yoff); - MMIO_OUT32(mmio, ATI_REG_CUR_HORZ_VERT_POSN, ATI_CUR_LOCK | - (x << 16) | y); - MMIO_OUT32(mmio, ATI_REG_CUR_OFFSET, (pCurPriv->area->offset + yoff * - stride)); -} - -static void -ClassicAllocCursorColors(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - CursorPtr pCursor = pCurPriv->pCursor; - - KdAllocateCursorPixels(pScreen, 0, pCursor, &pCurPriv->source, - &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - /* FALLTHROUGH */ - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - /* FALLTHROUGH */ - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -ClassicSetCursorColors(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - char *mmio = atic->reg_base; - - MMIO_OUT32(mmio, ATI_REG_CUR_CLR0, pCurPriv->mask); - MMIO_OUT32(mmio, ATI_REG_CUR_CLR1, pCurPriv->source); -} - -static void -ClassicRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - CursorPtr pCursor = pCurPriv->pCursor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) { - while (ndef != 0) { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - - if (ndef == 0) - return; - } - ClassicAllocCursorColors(pScreen); - ClassicSetCursorColors(pScreen); -} - -#define InvertBits32(v) do { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} while (0) - -static void -ClassicLoadCursor(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int h; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int i; - int lwsrc; - CARD32 tmp; - char *mmio = atic->reg_base; - - ClassicAllocCursorColors(pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* Stick new image into cursor memory */ - ram = (CARD32 *)(pScreenPriv->screen->memory_base + - pCurPriv->area->offset); - mskLine = (CARD32 *)bits->mask; - srcLine = (CARD32 *)bits->source; - - h = bits->height; - if (h > ATI_CURSOR_HEIGHT) - h = ATI_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ - - tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL); - MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp & ~ATI_CRTC_CUR_EN); - - for (i = 0; i < ATI_CURSOR_HEIGHT; i++) { - CARD32 m1, m2, s1, s2; - - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - - if (i < h && 0 < lwsrc) { - m1 = ~*msk++; - s1 = *src++; - InvertBits32(m1); - InvertBits32(s1); - } else { - m1 = 0xffffffff; - s1 = 0x0; - } - if (i < h && 1 < lwsrc) { - m2 = ~*msk++; - s2 = *src++; - InvertBits32(m2); - InvertBits32(s2); - } else { - m2 = 0xffffffff; - s2 = 0x0; - } - - *ram++ = m1; - *ram++ = m2; - *ram++ = s1; - *ram++ = s2; - } - - /* Not sure why this is necessary, but it prevents some cursor - * corruption. Not even all of it. - */ - for (i = 0; i < ATI_CURSOR_HEIGHT; i++) { - *ram++ = 0xffffffff; - *ram++ = 0xffffffff; - *ram++ = 0x0; - *ram++ = 0x0; - } - - /* Enable the cursor */ - tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL); - MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp | ATI_CRTC_CUR_EN); - - /* Set new color */ - ClassicSetCursorColors(pScreen); - -} - -static void -RadeonLoadCursor(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int h, w; - int x, y; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int lwsrc; - CARD32 tmp; - char *mmio = atic->reg_base; - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - w = bits->width; - if (w > ATI_CURSOR_WIDTH) - w = ATI_CURSOR_WIDTH; - - h = bits->height; - if (h > ATI_CURSOR_HEIGHT) - h = ATI_CURSOR_HEIGHT; - - tmp = MMIO_IN32(mmio, 0x7c); - tmp = 0x00010f80; - MMIO_OUT32 (mmio, 0x7c, tmp); - - tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL); - tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN); - MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp); - - /* Stick new image into cursor memory */ - ram = (CARD32 *)(pScreenPriv->screen->memory_base + - pCurPriv->area->offset); - if (pCursor->bits->argb) - { - srcLine = pCursor->bits->argb; - for (y = 0; y < h; y++) - { - src = srcLine; - srcLine += pCursor->bits->width; - for (x = 0; x < w; x++) - *ram++ = *src++; - for (; x < ATI_CURSOR_WIDTH; x++) - *ram++ = 0; - } - for (; y < ATI_CURSOR_HEIGHT; y++) - for (x = 0; x < ATI_CURSOR_WIDTH; x++) - *ram++ = 0; - } - else - { - CARD32 colors[4]; - - colors[0] = 0; - colors[1] = 0; - colors[2] = (((pCursor->backRed >> 8) << 16) | - ((pCursor->backGreen >> 8) << 8) | - ((pCursor->backBlue >> 8) << 0) | - 0xff000000); - colors[3] = (((pCursor->foreRed >> 8) << 16) | - ((pCursor->foreGreen >> 8) << 8) | - ((pCursor->foreBlue >> 8) << 0) | - 0xff000000); - - mskLine = (CARD32 *)bits->mask; - srcLine = (CARD32 *)bits->source; - - /* words per line */ - lwsrc = BitmapBytePad(bits->width) / 4; - - for (y = 0; y < ATI_CURSOR_HEIGHT; y++) - { - CARD32 m, s; - - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - - for (x = 0; x < ATI_CURSOR_WIDTH / 32; x++) - { - int k; - if (y < h && x < lwsrc) - { - m = *msk++; - s = *src++; - } - else - { - m = 0x0; - s = 0x0; - } - - for (k = 0; k < 32; k++) - { - CARD32 bits = (s & 1) | ((m & 1) << 1); - *ram++ = colors[bits]; - s >>= 1; - m >>= 1; - } - } - } - } - - /* Enable the cursor */ - tmp &= ~(ATI_CRTC_ICON_EN); - tmp |= ATI_CRTC_ARGB_EN; - tmp |= ATI_CRTC_CUR_EN; - MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp); -} - -static void -ATIUnloadCursor(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - char *mmio = atic->reg_base; - CARD32 tmp; - - tmp = MMIO_IN32(mmio, ATI_REG_GEN_CNTL); - tmp &= ~(ATI_CRTC_CUR_EN | ATI_CRTC_ICON_EN | ATI_CRTC_ARGB_EN); - MMIO_OUT32(mmio, ATI_REG_GEN_CNTL, tmp); -} - -static Bool -ATIRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCursor && pCurPriv->pCursor == pCursor) - { - int x, y; - - miPointerGetPosition(pDev, &x, &y); - if (atic->is_radeon) - RadeonLoadCursor (pScreen); - else - ClassicLoadCursor(pScreen); - /* Move to new position */ - ATIMoveCursor(pDev, pScreen, x, y); - } - - return TRUE; -} - -static Bool -ATIUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -ATISetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - { - if (atic->is_radeon) - RadeonLoadCursor (pScreen); - else - ClassicLoadCursor(pScreen); - /* Move to new position */ - ATIMoveCursor(pDev, pScreen, x, y); - } - else - ATIUnloadCursor(pScreen); -} - -miPointerSpriteFuncRec ATIPointerSpriteFuncs = { - ATIRealizeCursor, - ATIUnrealizeCursor, - ATISetCursor, - ATIMoveCursor, -}; - -static void -ATIQueryBestSize(int class, unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize(class, pwidth, pheight, pScreen); - break; - } -} - -static void -ATICursorSave(ScreenPtr pScreen, KdOffscreenArea *area) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - pCurPriv->area = NULL; -} - -void -ATICursorEnable(ScreenPtr pScreen) -{ - DeviceIntPtr pDev = inputInfo.pointer; - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - if (!pCurPriv->has_cursor) - return; - - if (pCurPriv->area == NULL) { - if (atic->is_radeon) - pCurPriv->area = KdOffscreenAlloc(pScreen, - ATI_CURSOR_HEIGHT * ATI_CURSOR_WIDTH * 4, - 128, TRUE, ATICursorSave, atis); - else - pCurPriv->area = KdOffscreenAlloc(pScreen, - ATI_CURSOR_HEIGHT * ATI_CURSOR_PITCH * 2, - 32, TRUE, ATICursorSave, atis); - } - if (pCurPriv->area == NULL) - FatalError("Couldn't allocate offscreen memory for cursor.\n"); - - if (pCurPriv->pCursor) { - int x, y; - - miPointerGetPosition(pDev, &x, &y); - if (atic->is_radeon) - RadeonLoadCursor(pScreen); - else - ClassicLoadCursor(pScreen); - /* Move to new position */ - ATIMoveCursor(pDev, pScreen, x, y); - } - else - ATIUnloadCursor(pScreen); -} - -void -ATICursorDisable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - if (!pScreenPriv->enabled || !pCurPriv->has_cursor) - return; - - if (pCurPriv->pCursor) - ATIUnloadCursor(pScreen); -} - -Bool -ATICursorInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - pCurPriv->has_cursor = FALSE; - - if (atic->reg_base == NULL) - return FALSE; - - pCurPriv->width = ATI_CURSOR_WIDTH; - pCurPriv->height= ATI_CURSOR_HEIGHT; - pScreen->QueryBestSize = ATIQueryBestSize; - miPointerInitialize(pScreen, &ATIPointerSpriteFuncs, - &kdPointerScreenFuncs, FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -ATIRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - - if (!atic->is_radeon) - ClassicRecolorCursor (pScreen, ndef, pdef); -} - -void -ATICursorFini(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICursor *pCurPriv = &atis->cursor; - - pCurPriv->has_cursor = FALSE; - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/ati/ati_dma.c b/hw/kdrive/ati/ati_dma.c deleted file mode 100644 index b97d79b25..000000000 --- a/hw/kdrive/ati/ati_dma.c +++ /dev/null @@ -1,1037 +0,0 @@ -/* - * Copyright © 2004 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 <sys/time.h> - -#include "ati.h" -#include "ati_reg.h" -#include "ati_dma.h" -#include "ati_draw.h" - -#ifdef USE_DRI -#include "radeon_common.h" -#include "r128_common.h" -#include "ati_sarea.h" -#endif /* USE_DRI */ - -#include "agp.h" - -#define DEBUG_FIFO 0 - -extern CARD32 r128_cce_microcode[]; -extern CARD32 radeon_cp_microcode[][2]; -extern CARD32 r200_cp_microcode[][2]; -extern CARD32 r300_cp_microcode[][2]; - -#if DEBUG_FIFO -static void -ATIDebugFifo(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - - if (atic->is_radeon) { - ErrorF("RADEON_REG_CP_CSQ_CNTL: 0x%08x\n", - MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL)); - ErrorF("RADEON_REG_CP_CSQ_STAT: 0x%08x\n", - MMIO_IN32(mmio, RADEON_REG_CP_CSQ_STAT)); - ErrorF("RADEON_REG_RBBM_STATUS: 0x%08x\n", - MMIO_IN32(mmio, RADEON_REG_RBBM_STATUS)); - ErrorF("RADEON_REG_RB3D_DSTCACHE_CTLSTAT: 0x%08x\n", - MMIO_IN32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT)); - } else { - ErrorF("R128_REG_PM4_BUFFER_CNTL: 0x%08x\n", - MMIO_IN32(mmio, R128_REG_PM4_BUFFER_CNTL)); - ErrorF("R128_REG_PM4_STAT: 0x%08x\n", - MMIO_IN32(mmio, R128_REG_PM4_STAT)); - ErrorF("R128_REG_GUI_STAT: 0x%08x\n", - MMIO_IN32(mmio, R128_REG_GUI_STAT)); - ErrorF("R128_REG_PC_NGUI_CTLSTAT: 0x%08x\n", - MMIO_IN32(mmio, R128_REG_PC_NGUI_CTLSTAT)); - } -} -#endif - -static void -ATIUploadMicrocode(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - int i; - - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_ADDR, 0); - if (atic->is_radeon && atic->is_r300) { - for (i = 0; i < 256; i++) { - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH, - r300_cp_microcode[i][1]); - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL, - r300_cp_microcode[i][0]); - } - } else if (atic->is_radeon && atic->is_r200) { - for (i = 0; i < 256; i++) { - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH, - r200_cp_microcode[i][1]); - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL, - r200_cp_microcode[i][0]); - } - } else if (atic->is_radeon && atic->is_r100) { - for (i = 0; i < 256; i++) { - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH, - radeon_cp_microcode[i][1]); - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL, - radeon_cp_microcode[i][0]); - } - } else { - for (i = 0; i < 256; i++) { - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAH, - r128_cce_microcode[i * 2]); - MMIO_OUT32(mmio, ATI_REG_MICROCODE_RAM_DATAL, - r128_cce_microcode[i * 2 + 1]); - } - } -} - -/* Required when reading from video memory after acceleration to make sure all - * data has been flushed to video memory from the pixel cache. - */ -static void -ATIFlushPixelCache(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - CARD32 temp; - TIMEOUT_LOCALS; - - if (atic->is_radeon) { - temp = MMIO_IN32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT); - temp |= RADEON_RB3D_DC_FLUSH_ALL; - MMIO_OUT32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT, temp); - - WHILE_NOT_TIMEOUT(.2) { - if ((MMIO_IN32(mmio, RADEON_REG_RB3D_DSTCACHE_CTLSTAT) & - RADEON_RB3D_DC_BUSY) == 0) - break; - } - } else { - temp = MMIO_IN32(mmio, R128_REG_PC_NGUI_CTLSTAT); - temp |= R128_PC_FLUSH_ALL; - MMIO_OUT32(mmio, R128_REG_PC_NGUI_CTLSTAT, temp); - - WHILE_NOT_TIMEOUT(.2) { - if ((MMIO_IN32(mmio, R128_REG_PC_NGUI_CTLSTAT) & - R128_PC_BUSY) != R128_PC_BUSY) - break; - } - } - if (TIMEDOUT()) - ErrorF("Timeout flushing pixel cache.\n"); -} - -static void -ATIEngineReset(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - CARD32 clockcntlindex, mclkcntl; - -#if DEBUG_FIFO - ErrorF("Engine Reset!\n"); - ATIDebugFifo(atis); -#endif - - ATIFlushPixelCache(atis); - - clockcntlindex = MMIO_IN32(mmio, ATI_REG_CLOCK_CNTL_INDEX); - if (atic->is_r300) - R300CGWorkaround(atis); - - if (atic->is_radeon) { - CARD32 host_path_cntl; - - mclkcntl = INPLL(mmio, RADEON_REG_MCLK_CNTL); - - OUTPLL(mmio, RADEON_REG_MCLK_CNTL, mclkcntl | - RADEON_FORCEON_MCLKA | - RADEON_FORCEON_MCLKB | - RADEON_FORCEON_YCLKA | - RADEON_FORCEON_YCLKB | - RADEON_FORCEON_MC | - RADEON_FORCEON_AIC); - - host_path_cntl = MMIO_IN32(mmio, RADEON_REG_HOST_PATH_CNTL); - - if (atic->is_r300) { - MMIO_OUT32(mmio, RADEON_REG_RBBM_SOFT_RESET, - RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_HI | - RADEON_SOFT_RESET_E2); - } else { - MMIO_OUT32(mmio, RADEON_REG_RBBM_SOFT_RESET, - RADEON_SOFT_RESET_CP | - RADEON_SOFT_RESET_SE | - RADEON_SOFT_RESET_RE | - RADEON_SOFT_RESET_PP | - RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB); - } - MMIO_IN32(mmio, RADEON_REG_RBBM_SOFT_RESET); - MMIO_OUT32(mmio, RADEON_REG_RBBM_SOFT_RESET, 0); - - MMIO_OUT32(mmio, RADEON_REG_HOST_PATH_CNTL, host_path_cntl | - RADEON_HDP_SOFT_RESET); - MMIO_IN32(mmio, RADEON_REG_HOST_PATH_CNTL); - MMIO_OUT32(mmio, RADEON_REG_HOST_PATH_CNTL, host_path_cntl); - - MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, clockcntlindex); - OUTPLL(mmio, RADEON_REG_MCLK_CNTL, mclkcntl); - if (atic->is_r300) - R300CGWorkaround(atis); - } else { - CARD32 temp; - - mclkcntl = INPLL(mmio, R128_REG_MCLK_CNTL); - - OUTPLL(mmio, R128_REG_MCLK_CNTL, - mclkcntl | R128_FORCE_GCP | R128_FORCE_PIPE3D_CP); - - temp = MMIO_IN32(mmio, R128_REG_GEN_RESET_CNTL); - MMIO_OUT32(mmio, R128_REG_GEN_RESET_CNTL, - temp | R128_SOFT_RESET_GUI); - temp = MMIO_IN32(mmio, R128_REG_GEN_RESET_CNTL); - MMIO_OUT32(mmio, R128_REG_GEN_RESET_CNTL, - temp & ~R128_SOFT_RESET_GUI); - temp = MMIO_IN32(mmio, R128_REG_GEN_RESET_CNTL); - - OUTPLL(mmio, R128_REG_MCLK_CNTL, mclkcntl); - MMIO_OUT32(mmio, ATI_REG_CLOCK_CNTL_INDEX, clockcntlindex); - } -#ifdef USE_DRI - if (atis->using_dri) { - ATIDRIDMAReset(atis); - ATIDRIDMAStart(atis); - } -#endif -} - -static void -ATIWaitAvailMMIO(ATIScreenInfo *atis, int n) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - TIMEOUT_LOCALS; - - if (atis->mmio_avail >= n) { - atis->mmio_avail -= n; - return; - } - if (atic->is_radeon) { - WHILE_NOT_TIMEOUT(.2) { - atis->mmio_avail = MMIO_IN32(mmio, - RADEON_REG_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK; - if (atis->mmio_avail >= n) - break; - } - } else { - WHILE_NOT_TIMEOUT(.2) { - atis->mmio_avail = MMIO_IN32(mmio, R128_REG_GUI_STAT) & - 0xfff; - if (atis->mmio_avail >= n) - break; - } - } - if (TIMEDOUT()) { - ErrorF("Timeout waiting for %d MMIO slots.\n", n); - ATIEngineReset(atis); - ATIDrawSetup(atis->screen->pScreen); - } - atis->mmio_avail -= n; -} - -static int -ATIGetAvailPrimary(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - - if (atic->is_radeon) { - int csq_stat, diff; - - csq_stat = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_STAT); - if (atic->is_r200) - diff = ((csq_stat & R200_CSQ_WPTR_PRIMARY_MASK) >> 9) - - (csq_stat & R200_CSQ_RPTR_PRIMARY_MASK); - else - diff = ((csq_stat & RADEON_CSQ_WPTR_PRIMARY_MASK) >> 8) - - (csq_stat & RADEON_CSQ_RPTR_PRIMARY_MASK); - - if (diff < 0) - return -diff; - else - return atis->cce_pri_size - diff; - } else { - return MMIO_IN32(mmio, R128_REG_PM4_STAT) & - R128_PM4_FIFOCNT_MASK; - } -} - -static void -ATIWaitAvailPrimary(ATIScreenInfo *atis, int n) -{ - TIMEOUT_LOCALS; - - if (atis->cce_pri_avail >= n) { - atis->cce_pri_avail -= n; - return; - } - - WHILE_NOT_TIMEOUT(.2) { - if (atis->cce_pri_avail >= n) - break; - atis->cce_pri_avail = ATIGetAvailPrimary(atis); - if (atis->cce_pri_avail >= n) - break; - } - if (TIMEDOUT()) { - ErrorF("Timeout waiting for %d CCE slots (%d avail).\n", n, - atis->cce_pri_avail); - ATIEngineReset(atis); - ATIDrawSetup(atis->screen->pScreen); - } - atis->cce_pri_avail -= n; -} - -void -ATIWaitIdle(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - TIMEOUT_LOCALS; - - if (atis->indirectBuffer != NULL) - ATIFlushIndirect(atis, 0); - -#ifdef USE_DRI - if (atis->using_dri) { - int ret = 0; - int cmd = (atic->is_radeon ? DRM_RADEON_CP_IDLE : - DRM_R128_CCE_IDLE); - WHILE_NOT_TIMEOUT(2) { - ret = drmCommandNone(atic->drmFd, cmd); - if (ret != -EBUSY) - break; - } - if (TIMEDOUT()) { - ATIDebugFifo(atis); - FatalError("Timed out idling CCE (card hung)\n"); - } - if (ret != 0) - ErrorF("Failed to idle DMA, returned %d\n", ret); - return; - } -#endif - - if (!atic->is_radeon && (atis->using_pseudo || atis->using_dma)) { - ATIWaitAvailPrimary(atis, atis->cce_pri_size); - - WHILE_NOT_TIMEOUT(.2) { - if ((MMIO_IN32(mmio, R128_REG_PM4_STAT) & - (R128_PM4_BUSY | R128_PM4_GUI_ACTIVE)) == 0) - break; - } - if (TIMEDOUT()) { - ErrorF("Timeout idling CCE, resetting...\n"); - ATIEngineReset(atis); - ATIDrawSetup(atis->screen->pScreen); - } - } - - /* Radeon CP idle is the same as MMIO idle. */ - if (atis->using_pio || atic->is_radeon) { - /* Empty the fifo */ - ATIWaitAvailMMIO(atis, 64); - - if (atic->is_radeon) { - WHILE_NOT_TIMEOUT(.2) { - if ((MMIO_IN32(mmio, RADEON_REG_RBBM_STATUS) & - RADEON_RBBM_ACTIVE) == 0) - break; - } - } else { - WHILE_NOT_TIMEOUT(.2) { - if ((MMIO_IN32(mmio, R128_REG_GUI_STAT) & - R128_GUI_ACTIVE) == 0) - break; - } - } - if (TIMEDOUT()) { - ErrorF("Timeout idling accelerator, resetting...\n"); - ATIEngineReset(atis); - ATIDrawSetup(atis->screen->pScreen); - } - } - - ATIFlushPixelCache(atis); - -#if DEBUG_FIFO - ErrorF("Idle?\n"); - ATIDebugFifo(atis); -#endif -} - -dmaBuf * -ATIGetDMABuffer(ATIScreenInfo *atis) -{ - dmaBuf *buf; - - buf = (dmaBuf *)xalloc(sizeof(dmaBuf)); - if (buf == NULL) - return NULL; - -#ifdef USE_DRI - if (atis->using_dri) { - buf->drmBuf = ATIDRIGetBuffer(atis); - if (buf->drmBuf == NULL) { - xfree(buf); - return NULL; - } - buf->size = buf->drmBuf->total; - buf->used = buf->drmBuf->used; - buf->address = buf->drmBuf->address; - return buf; - } -#endif /* USE_DRI */ - - if (atis->using_dma) - buf->size = atis->ring_len / 2; - else - buf->size = 512 * 1024; - buf->address = xalloc(buf->size); - if (buf->address == NULL) { - xfree(buf); - return NULL; - } - buf->used = 0; - - return buf; -} - -/* Decode a type-3 packet into MMIO register writes. Only some type-3 packets - * supported, and only partially. - */ -static void -ATIDispatchPacket3MMIO(ATIScreenInfo *atis, CARD32 header, CARD32 *addr, - int count) -{ - ATICardInfo *atic = atis->atic; - char *mmio = atic->reg_base; - CARD32 settings; - int i = 0; - - settings = addr[i++]; - - if ((settings & ATI_GMC_SRC_PITCH_OFFSET_CNTL) != 0) - MMIO_OUT32(mmio, ATI_REG_SRC_PITCH_OFFSET, addr[i++]); - if ((settings & ATI_GMC_DST_PITCH_OFFSET_CNTL) != 0) - MMIO_OUT32(mmio, ATI_REG_DST_PITCH_OFFSET, addr[i++]); - if ((settings & ATI_GMC_BRUSH_MASK) == ATI_GMC_BRUSH_SOLID_COLOR) - MMIO_OUT32(mmio, ATI_REG_DP_BRUSH_FRGD_CLR, addr[i++]); - - switch (header & (ATI_CCE_PACKETTYPE_MASK | - ATI_CCE_PACKET3_IT_OPCODE_MASK)) - { - case ATI_CCE_PACKET3_PAINT_MULTI: - while (i < count) { - MMIO_OUT32(mmio, ATI_REG_DST_Y_X, - (addr[i] >> 16) | (addr[i] << 16)); - i++; - MMIO_OUT32(mmio, ATI_REG_DST_HEIGHT_WIDTH, - (addr[i] >> 16) | (addr[i] << 16)); - i++; - } - break; - case ATI_CCE_PACKET3_BITBLT_MULTI: - while (i < count) { - MMIO_OUT32(mmio, ATI_REG_SRC_Y_X, - (addr[i] >> 16) | (addr[i] << 16)); - i++; - MMIO_OUT32(mmio, ATI_REG_DST_Y_X, - (addr[i] >> 16) | (addr[i] << 16)); - i++; - MMIO_OUT32(mmio, ATI_REG_DST_HEIGHT_WIDTH, - (addr[i] >> 16) | (addr[i] << 16)); - i++; - } - break; - default: - ErrorF("Unsupported packet: 0x%x\n", header); - } -} - -/* Dispatch packets by decoding them and writing to registers. Doesn't support - * the type 3 packets. - */ -static void -ATIDispatchIndirectMMIO(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - dmaBuf *buf = atis->indirectBuffer; - char *mmio = atic->reg_base; - CARD32 *addr; - CARD32 reg; - int i, n, count; - - addr = (CARD32 *)((char *)buf->address + atis->indirectStart); - count = (buf->used - atis->indirectStart) / 4; - - for (i = 0; i < count; i++) { - CARD32 header = addr[i]; - - switch (header & ATI_CCE_PACKETTYPE_MASK) - { - case ATI_CCE_PACKET0: - n = ((header & ATI_CCE_PACKET0_COUNT_MASK) >> 16) + 1; - reg = (header & ATI_CCE_PACKET0_REG_MASK) << 2; - ATIWaitAvailMMIO(atis, n); - while (n > 0) { - i++; - MMIO_OUT32(mmio, reg, addr[i]); - if ((header & ATI_CCE_PACKET0_ONE_REG_WR) == 0) - reg += 4; - n--; - } - break; - case ATI_CCE_PACKET1: - reg = (header & ATI_CCE_PACKET1_REG_1) << 2; - MMIO_OUT32(mmio, reg, addr[++i]); - reg = ((header & ATI_CCE_PACKET1_REG_2) >> - ATI_CCE_PACKET1_REG_2_SHIFT) << 2; - MMIO_OUT32(mmio, reg, addr[++i]); - break; - case ATI_CCE_PACKET2: - /* PACKET2 is a no-op packet. */ - break; - case ATI_CCE_PACKET3: - n = ((header & ATI_CCE_PACKET3_COUNT_MASK) >> 16) + 1; - ATIDispatchPacket3MMIO(atis, header, &addr[i], n); - i += n; - break; - default: - ErrorF("Unsupported packet: 0x%x\n", addr[i]); - } - } -} - -/* Dispatch packets by sending them through the MMIO aperture. */ -static void -R128DispatchIndirectPDMA(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - dmaBuf *buf = atis->indirectBuffer; - char *mmio = atic->reg_base; - CARD32 *addr; - int count; - - addr = (CARD32 *)((char *)buf->address + atis->indirectStart); - count = (buf->used - atis->indirectStart) / 4; - - while (count > 1) { - ATIWaitAvailPrimary(atis, 2); - MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_EVEN, *addr++); - MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_ODD, *addr++); - count -= 2; - } - - /* Submit last DWORD if necessary. */ - if (count != 0) { - ATIWaitAvailPrimary(atis, 2); - MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_EVEN, *addr++); - MMIO_OUT32(mmio, R128_REG_PM4_FIFO_DATA_ODD, ATI_CCE_PACKET2); - } -} - -/* Dispatch packets by sending them through the MMIO aperture, using the - * primary CCE ring. */ -static void -RadeonDispatchIndirectPDMA(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - dmaBuf *buf = atis->indirectBuffer; - char *mmio = atic->reg_base; - CARD32 *addr; - int count, avail, reg, i; - TIMEOUT_LOCALS; - - addr = (CARD32 *)((char *)buf->address + atis->indirectStart); - count = (buf->used - atis->indirectStart) / 4; - - reg = RADEON_REG_CSQ_APER_PRIMARY; - WHILE_NOT_TIMEOUT(3) { - /* 3 seconds is empirical, using render_bench on an r100. */ - if (count <= 0) - break; - avail = ATIGetAvailPrimary(atis); - for (i = 0; i < min(count, avail); i++) { - MMIO_OUT32(mmio, reg, *addr++); - if (reg == RADEON_REG_CSQ_APER_PRIMARY_END) - reg = RADEON_REG_CSQ_APER_PRIMARY; - else - reg += 4; - } - count -= i; - } - if (TIMEDOUT()) { - ErrorF("Timeout submitting packets, resetting...\n"); - ATIEngineReset(atis); - ATIDrawSetup(atis->screen->pScreen); - } -} - - -/* Dispatch packets by writing them to the (primary) ring buffer, which happens - * to be in framebuffer memory. - */ -static void -R128DispatchIndirectDMA(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - dmaBuf *buf = atis->indirectBuffer; - char *mmio = atic->reg_base; - CARD32 *addr; - int count, ring_count; - TIMEOUT_LOCALS; - - addr = (CARD32 *)((char *)buf->address + atis->indirectStart); - count = (buf->used - atis->indirectStart) / 4; - ring_count = atis->ring_len / 4; - - WHILE_NOT_TIMEOUT(.2) { - if (count <= 0) - break; - - atis->ring_addr[atis->ring_write++] = *addr++; - if (atis->ring_write >= ring_count) - atis->ring_write = 0; - while (atis->ring_write == atis->ring_read) { - atis->ring_read = MMIO_IN32(mmio, ATI_REG_CCE_RPTR); - } - count--; - } - if (TIMEDOUT()) { - ErrorF("Timeout submitting packets, resetting...\n"); - ATIEngineReset(atis); - ATIDrawSetup(atis->screen->pScreen); - } - - /* Workaround for some early Rage 128 ASIC spins where the CCE parser - * may read up to 32 DWORDS beyond the end of the ring buffer memory - * before wrapping around, if the ring buffer was empty and a <32 DWORD - * packet that wraps around the end of the ring buffer is submitted. - * To work around that, copy the beginning of the ring buffer past the - * end if that may happen. - */ - if (atis->ring_write < 32) - memcpy(atis->ring_addr + ring_count, atis->ring_addr, 32 * 4); - - /* Update write pointer */ - MMIO_OUT32(mmio, ATI_REG_CCE_WPTR, atis->ring_write); -} - -void -ATIFlushIndirect(ATIScreenInfo *atis, Bool discard) -{ - ATICardInfo *atic = atis->atic; - dmaBuf *buf = atis->indirectBuffer; - - if ((atis->indirectStart == buf->used) && !discard) - return; - -#if DEBUG_FIFO - ErrorF("Dispatching %d DWORDS\n", (buf->used - atis->indirectStart) / - 4); -#endif - -#ifdef USE_DRI - if (atis->using_dri) { - buf->drmBuf->used = buf->used; - ATIDRIDispatchIndirect(atis, discard); - if (discard) { - buf->drmBuf = ATIDRIGetBuffer(atis); - buf->size = buf->drmBuf->total; - buf->used = buf->drmBuf->used; - buf->address = buf->drmBuf->address; - atis->indirectStart = 0; - } else { - /* Start on a double word boundary */ - atis->indirectStart = buf->used = (buf->used + 7) & ~7; - } - return; - } -#endif /* USE_DRI */ - - if (atis->using_dma && !atic->is_radeon) - R128DispatchIndirectDMA(atis); - else if (atis->using_pseudo) { - if (atic->is_radeon) - RadeonDispatchIndirectPDMA(atis); - else - R128DispatchIndirectPDMA(atis); - } else - ATIDispatchIndirectMMIO(atis); - - buf->used = 0; - atis->indirectStart = 0; -} - -static Bool -ATIInitAGP(ScreenPtr pScreen, int size) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - AgpInfoPtr agp_info; - int screennum = atis->screen->mynum; - - if (atic->is_radeon) - return FALSE; - - if (!KdAgpGARTSupported()) - return FALSE; - - if (!KdAcquireGART(screennum)) - return FALSE; - - atis->agp_key = KdAllocateGARTMemory(screennum, size, 0, NULL); - if (atis->agp_key == -1) { - ErrorF("Failed to allocate %dKB GART memory\n", size/1024); - KdReleaseGART(screennum); - return FALSE; - } - - if (!KdBindGARTMemory(screennum, atis->agp_key, 0)) { - ErrorF("Failed to bind GART memory\n"); - KdReleaseGART(screennum); - return FALSE; - } - - agp_info = KdGetAGPInfo(screennum); - if (agp_info == NULL) { - KdUnbindGARTMemory(screennum, atis->agp_key); - KdReleaseGART(screennum); - return FALSE; - } - - atis->agp_addr = KdMapDevice(agp_info->base, agp_info->size); - if (atis->agp_addr == NULL) { - ErrorF("Failed to map GART memory\n"); - KdUnbindGARTMemory(screennum, atis->agp_key); - KdReleaseGART(screennum); - free(agp_info); - return FALSE; - } - KdSetMappedMode(agp_info->base, agp_info->size, - KD_MAPPED_MODE_FRAMEBUFFER); - - atis->agp_size = size; - free(agp_info); - - return TRUE; -} - -static void -ATIFiniAGP(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - int screennum = atis->screen->mynum; - - KdUnbindGARTMemory(screennum, atis->agp_key); - KdReleaseGART(screennum); - atis->agp_addr = NULL; - atis->agp_size = 0; -} - -static Bool -ATIPseudoDMAInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - char *mmio = atic->reg_base; - - if (atic->is_r300) - return FALSE; - - ATIUploadMicrocode(atis); - ATIEngineReset(atis); - - if (atic->is_r200) { - MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, - RADEON_CSQ_PRIPIO_INDDIS); - atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & - R200_CSQ_CNT_PRIMARY_MASK; - MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); - } else if (atic->is_radeon) { - MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, - RADEON_CSQ_PRIPIO_INDDIS); - atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & - RADEON_CSQ_CNT_PRIMARY_MASK; - MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); - } else { - MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL, R128_PM4_192PIO | - R128_PM4_BUFFER_CNTL_NOUPDATE); - atis->cce_pri_size = 192; - MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL, - R128_PM4_MICRO_FREERUN); - } - - return TRUE; -} - -static Bool -ATIPseudoDMAFini(ScreenPtr pScreen) -{ KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - char *mmio = atic->reg_base; - - if (atic->is_radeon) { - MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, 0); - MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, - RADEON_CSQ_PRIDIS_INDDIS); - } else { - MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL, 0); - MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL, - R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE); - } - atis->cce_pri_size = 0; - - ATIEngineReset(atis); - - return TRUE; -} - -static Bool -ATIDMAInit(ScreenPtr pScreen, Bool use_agp) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - char *mmio = atic->reg_base; - int dma_offset; - CARD32 tmp; - - /* XXX: Not for radeons. Yet? */ - if (atic->is_radeon) - return FALSE; - - if (use_agp) { - if (1) - return FALSE; /* XXX */ - /* Allocate a 1MB AGP space, but only use 128k + 128 for DMA. - * XXX: Should use the rest for things like scratch space. - */ - if (!ATIInitAGP(pScreen, 1024 * 1024)) - return FALSE; - atis->ring_addr = atis->agp_addr; - atis->ring_len = 128 * 1024; - dma_offset = R128_AGP_OFFSET; - } else { - if (1) - return FALSE; /* XXX */ - /* Allocate a 128K buffer, plus 32 DWORDS to give space for the - * R128 ASIC bug workaround. - */ - atis->dma_space = KdOffscreenAlloc(pScreen, 128 * 1024 + 128, - 128, TRUE, NULL, NULL); - if (atis->dma_space == NULL) - return FALSE; - atis->ring_addr = (CARD32 *)(atis->dma_space->offset + - pScreenPriv->screen->memory_base); - atis->ring_len = 128 * 1024; - dma_offset = atis->dma_space->offset; - } - - ATIUploadMicrocode(atis); - ATIEngineReset(atis); - - atis->ring_read = 0; - atis->ring_write = 0; - - tmp = MMIO_IN32(mmio, ATI_REG_BUS_CNTL); - MMIO_OUT32(mmio, ATI_REG_BUS_CNTL, tmp & ~ATI_BUS_MASTER_DIS); - - MMIO_OUT32(mmio, ATI_REG_CCE_RB_BASE, dma_offset); - MMIO_OUT32(mmio, ATI_REG_CCE_WPTR, atis->ring_write); - MMIO_OUT32(mmio, ATI_REG_CCE_RPTR, atis->ring_read); - MMIO_OUT32(mmio, ATI_REG_CCE_RPTR_ADDR, 0 /* XXX? */); - - if (atic->is_r200) { - MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, - RADEON_CSQ_PRIBM_INDBM); - atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & - R200_CSQ_CNT_PRIMARY_MASK; - MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); - } else if (atic->is_radeon) { - MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, - RADEON_CSQ_PRIBM_INDBM); - atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & - RADEON_CSQ_CNT_PRIMARY_MASK; - MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); - } else { - MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_WM_CNTL, - ((R128_WATERMARK_L/4) << R128_WMA_SHIFT) | - ((R128_WATERMARK_M/4) << R128_WMB_SHIFT) | - ((R128_WATERMARK_N/4) << R128_WMC_SHIFT) | - ((R128_WATERMARK_K/64) << R128_WB_WM_SHIFT)); - /* The sample code reads from an undocumneted register - * (PM4_BUFFER_ADDR). Perhaps it's a write posting thing? Do - * a read in case that's it. - */ - MMIO_IN32(mmio, R128_REG_PM4_BUFFER_CNTL); - if (use_agp) { - /* XXX Magic num */ - MMIO_OUT32(mmio, R128_REG_PCI_GART_PAGE, 1); - MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL, - ATILog2(atis->ring_len) | - R128_PM4_192BM | - R128_PM4_BUFFER_CNTL_NOUPDATE); - } else { - MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL, - ATILog2(atis->ring_len) | - R128_PM4_192BM | - R128_PM4_BUFFER_CNTL_NOUPDATE | - R128_PM4_IN_FRAME_BUFFER); - } - atis->cce_pri_size = 192; - MMIO_IN32(mmio, R128_REG_PM4_BUFFER_CNTL); - MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL, - R128_PM4_MICRO_FREERUN); - } - - return TRUE; -} - -static Bool -ATIDMAFini(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - char *mmio = atic->reg_base; - - if (atic->is_radeon) { - MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, 0); - MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, - RADEON_CSQ_PRIDIS_INDDIS); - } else { - MMIO_OUT32(mmio, ATI_REG_CCE_WPTR, - atis->ring_write | R128_PM4_BUFFER_DL_DONE); - MMIO_OUT32(mmio, R128_REG_PM4_MICRO_CNTL, 0); - MMIO_OUT32(mmio, R128_REG_PM4_BUFFER_CNTL, - R128_PM4_NONPM4 | R128_PM4_BUFFER_CNTL_NOUPDATE); - } - atis->cce_pri_size = 0; - - ATIEngineReset(atis); - - if (atis->using_agp) - ATIFiniAGP(pScreen); - else - KdOffscreenFree(pScreen, atis->dma_space); - - return TRUE; -} - -void -ATIDMASetup(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - -#ifdef USE_DRI - if (atis->using_dri) - ATIDRIDMAStart(atis); -#endif /* USE_DRI */ - - if (!atis->using_dri) { - atis->using_agp = FALSE; - if (atic->is_agp && ATIDMAInit(pScreen, TRUE)) { - atis->using_agp = TRUE; - atis->using_dma = TRUE; - } else if (ATIDMAInit(pScreen, FALSE)) { - atis->using_agp = FALSE; - atis->using_dma = TRUE; - } else if (ATIPseudoDMAInit(pScreen)) - atis->using_pseudo = TRUE; - else - atis->using_pio = TRUE; - } - - atis->indirectBuffer = ATIGetDMABuffer(atis); - if (atis->indirectBuffer == FALSE) - FatalError("Failed to allocate DMA buffer.\n"); - - if (atis->using_dri) - ErrorF("Initialized %s DRI DMA\n", - atis->using_agp ? "AGP" : "PCI"); - else if (atis->using_dma && atis->using_agp) - ErrorF("Initialized AGP DMA\n"); - else if (atis->using_dma) - ErrorF("Initialized framebuffer pseudo-DMA\n"); - else if (atis->using_pseudo) - ErrorF("Initialized pseudo-DMA\n"); - else if (atis->using_pio) - ErrorF("Initialized PIO\n"); -} - -void -ATIDMATeardown(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - - ATIWaitIdle(atis); - -#ifdef USE_DRI - if (atis->using_dri) - ATIDRIDMAStop(atis); -#endif /* USE_DRI */ - - if (atis->using_dma) - ATIDMAFini(pScreen); - - if (atis->using_pseudo) - ATIPseudoDMAFini(pScreen); - - if (atis->using_pio || atis->using_pseudo || atis->using_dma) { - xfree(atis->indirectBuffer->address); - xfree(atis->indirectBuffer); - } - atis->indirectBuffer = NULL; - - atis->using_pio = FALSE; - atis->using_pseudo = FALSE; - atis->using_dma = FALSE; - atis->using_agp = FALSE; -} - diff --git a/hw/kdrive/ati/ati_dma.h b/hw/kdrive/ati/ati_dma.h deleted file mode 100644 index 4c2092b2c..000000000 --- a/hw/kdrive/ati/ati_dma.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright © 2004 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 _ATI_DMA_H_ -#define _ATI_DMA_H_ - -#define CCE_DEBUG 1 - -#if !CCE_DEBUG -#define DMA_PACKET0(reg, count) \ - (ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2)) -#else -#define DMA_PACKET0(reg, count) \ - (__packet0count = (count), __reg = (reg), \ - ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2)) -#endif -#define DMA_PACKET1(reg1, reg2) \ - (ATI_CCE_PACKET1 | \ - (((reg2) >> 2) << ATI_CCE_PACKET1_REG_2_SHIFT) | ((reg1) >> 2)) -#define DMA_PACKET3(type, count) \ - ((type) | (((count) - 1) << 16)) - -#if !CCE_DEBUG - -#define RING_LOCALS CARD32 *__head; int __count -#define BEGIN_DMA(n) \ -do { \ - if ((atis->indirectBuffer->used + 4*(n)) > \ - atis->indirectBuffer->size) { \ - ATIFlushIndirect(atis, 1); \ - } \ - __head = (CARD32 *)((char *)atis->indirectBuffer->address + \ - atis->indirectBuffer->used); \ - __count = 0; \ -} while (0) -#define END_DMA() do { \ - atis->indirectBuffer->used += __count * 4; \ -} while (0) - -#else - -#define RING_LOCALS \ - CARD32 *__head; int __count, __total, __reg, __packet0count -#define BEGIN_DMA(n) \ -do { \ - if ((atis->indirectBuffer->used + 4*(n)) > \ - atis->indirectBuffer->size) { \ - ATIFlushIndirect(atis, 1); \ - } \ - __head = (CARD32 *)((char *)atis->indirectBuffer->address + \ - atis->indirectBuffer->used); \ - __count = 0; \ - __total = n; \ - __reg = 0; \ - __packet0count = 0; \ -} while (0) -#define END_DMA() do { \ - if (__count != __total) \ - FatalError("count != total (%d vs %d) at %s:%d\n", \ - __count, __total, __FILE__, __LINE__); \ - atis->indirectBuffer->used += __count * 4; \ -} while (0) - -#endif - -#define OUT_RING(val) do { \ - __head[__count++] = (val); \ -} while (0) - -#define OUT_RING_REG(reg, val) do { \ - if (__reg != reg) \ - FatalError("unexpected reg (0x%x vs 0x%x) at %s:%d\n", \ - reg, __reg, __FILE__, __LINE__); \ - if (__packet0count-- <= 0) \ - FatalError("overrun of packet0 at %s:%d\n", \ - __FILE__, __LINE__); \ - __head[__count++] = (val); \ - __reg += 4; \ -} while (0) - -#define OUT_RING_F(x) OUT_RING(GET_FLOAT_BITS(x)) - -#define OUT_REG(reg, val) \ -do { \ - OUT_RING(DMA_PACKET0(reg, 1)); \ - OUT_RING(val); \ -} while (0) - -#define TIMEOUT_LOCALS struct timeval _target, _curtime - -static inline Bool -tv_le(struct timeval *tv1, struct timeval *tv2) -{ - if (tv1->tv_sec < tv2->tv_sec || - (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec < tv2->tv_usec)) - return TRUE; - else - return FALSE; -} - -#define WHILE_NOT_TIMEOUT(_timeout) \ - gettimeofday(&_target, NULL); \ - _target.tv_usec += ((_timeout) * 1000000); \ - _target.tv_sec += _target.tv_usec / 1000000; \ - _target.tv_usec = _target.tv_usec % 1000000; \ - while (gettimeofday(&_curtime, NULL), tv_le(&_curtime, &_target)) - -#define TIMEDOUT() (!tv_le(&_curtime, &_target)) - -dmaBuf * -ATIGetDMABuffer(ATIScreenInfo *atis); - -void -ATIFlushIndirect(ATIScreenInfo *atis, Bool discard); - -void -ATIDMASetup(ScreenPtr pScreen); - -void -ATIDMATeardown(ScreenPtr pScreen); - -#endif /* _ATI_DMA_H_ */ diff --git a/hw/kdrive/ati/ati_draw.c b/hw/kdrive/ati/ati_draw.c deleted file mode 100644 index c10fea471..000000000 --- a/hw/kdrive/ati/ati_draw.c +++ /dev/null @@ -1,918 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ati.h" -#include "ati_reg.h" -#include "ati_dma.h" -#include "ati_draw.h" -#include "kaa.h" - -CARD8 ATISolidRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -CARD8 ATIBltRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -int copydx, copydy; -ATIScreenInfo *accel_atis; -/* If is_24bpp is set, then we are using the accelerator in 8-bit mode due - * to it being broken for 24bpp, so coordinates have to be multiplied by 3. - */ -Bool is_24bpp; -CARD32 settings, color, src_pitch_offset, dst_pitch_offset; - -int sample_count; -float sample_offsets_x[255]; -float sample_offsets_y[255]; - -#define DRAW_USING_PACKET3 0 - -void -ATIDrawSetup(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - RING_LOCALS; - - /* XXX: this shouldn't be necessary, but fixes some R128 composite - * issues. - */ - /*if (!atic->is_radeon) { - char *mmio = atic->reg_base; - ATIWaitIdle(atis); - MMIO_OUT32(mmio, R128_REG_PC_GUI_MODE, - R128_PC_BYPASS_EN); - }*/ - - BEGIN_DMA(2); - OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT, - ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX); - END_DMA(); - - if (!atic->is_radeon) { - /* Setup for R128 Composite */ - BEGIN_DMA(12); - OUT_REG(R128_REG_SCALE_3D_CNTL, - R128_SCALE_3D_TEXMAP_SHADE | - R128_SCALE_PIX_REPLICATE | - R128_TEX_CACHE_SPLIT | - R128_TEX_MAP_ALPHA_IN_TEXTURE | - R128_TEX_CACHE_LINE_SIZE_4QW); - OUT_REG(R128_REG_SETUP_CNTL, - R128_COLOR_SOLID_COLOR | - R128_PRIM_TYPE_TRI | - R128_TEXTURE_ST_MULT_W | - R128_STARTING_VERTEX_1 | - R128_ENDING_VERTEX_3 | - R128_SUB_PIX_4BITS); - OUT_REG(R128_REG_PM4_VC_FPU_SETUP, - R128_FRONT_DIR_CCW | - R128_BACKFACE_CULL | - R128_FRONTFACE_SOLID | - R128_FPU_COLOR_SOLID | - R128_FPU_SUB_PIX_4BITS | - R128_FPU_MODE_3D | - R128_TRAP_BITS_DISABLE | - R128_XFACTOR_2 | - R128_YFACTOR_2 | - R128_FLAT_SHADE_VERTEX_OGL | - R128_FPU_ROUND_TRUNCATE | - R128_WM_SEL_8DW); - OUT_REG(R128_REG_PLANE_3D_MASK_C, 0xffffffff); - OUT_REG(R128_REG_CONSTANT_COLOR_C, 0xff000000); - OUT_REG(R128_REG_WINDOW_XY_OFFSET, 0x00000000); - END_DMA(); - } else if (!atic->is_r300) { - /* Setup for R100/R200 Composite */ - BEGIN_DMA(8); - OUT_REG(RADEON_REG_RE_TOP_LEFT, 0); - OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff); - OUT_REG(RADEON_REG_RB3D_PLANEMASK, 0xffffffff); - OUT_REG(RADEON_REG_SE_CNTL, - RADEON_FFACE_CULL_CCW | - RADEON_FFACE_SOLID | - RADEON_VTX_PIX_CENTER_OGL); - END_DMA(); - - if (atic->is_r100) { - BEGIN_DMA(6); - OUT_REG(RADEON_REG_SE_CNTL_STATUS, RADEON_TCL_BYPASS); - OUT_REG(RADEON_REG_SE_COORD_FMT, - RADEON_VTX_XY_PRE_MULT_1_OVER_W0 | - RADEON_VTX_ST0_NONPARAMETRIC | - RADEON_VTX_ST1_NONPARAMETRIC | - RADEON_TEX1_W_ROUTING_USE_W0); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_MODE, - RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH | - RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH); - END_DMA(); - } else { - BEGIN_DMA(18); - /* XXX: The 0 below should be RADEON_TCL_BYPASS on - * RS300s. - */ - OUT_REG(R200_REG_SE_VAP_CNTL_STATUS, 0); - OUT_REG(R200_REG_PP_CNTL_X, 0); - OUT_REG(R200_REG_PP_TXMULTI_CTL_0, 0); - OUT_REG(R200_REG_SE_VTX_STATE_CNTL, 0); - OUT_REG(R200_REG_RE_CNTL, 0); - /* XXX: VTX_ST_DENORMALIZED is illegal for the case of - * repeating textures. - */ - OUT_REG(R200_REG_SE_VTE_CNTL, R200_VTX_ST_DENORMALIZED); - OUT_REG(R200_REG_SE_VAP_CNTL, - R200_VAP_FORCE_W_TO_ONE | - R200_VAP_VF_MAX_VTX_NUM); - OUT_REG(R200_REG_RE_AUX_SCISSOR_CNTL, 0); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_MODE, - RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH | - RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH | - R200_RB3D_DC_2D_CACHE_AUTOFREE | - R200_RB3D_DC_3D_CACHE_AUTOFREE); - END_DMA(); - } - } -} - -static void -ATIWaitMarker(ScreenPtr pScreen, int marker) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - - ENTER_DRAW(0); - ATIWaitIdle(atis); - LEAVE_DRAW(0); -} - -void -RadeonSwitchTo2D(ATIScreenInfo *atis) -{ - RING_LOCALS; - - ENTER_DRAW(0); - BEGIN_DMA(4); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH); - OUT_REG(ATI_REG_WAIT_UNTIL, - RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN); - END_DMA(); - LEAVE_DRAW(0); -} - -void -RadeonSwitchTo3D(ATIScreenInfo *atis) -{ - RING_LOCALS; - - ENTER_DRAW(0); - BEGIN_DMA(4); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH); - /* We must wait for 3d to idle, in case source was just written as a dest. */ - OUT_REG(ATI_REG_WAIT_UNTIL, - RADEON_WAIT_HOST_IDLECLEAN | RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_3D_IDLECLEAN); - END_DMA(); - LEAVE_DRAW(0); -} - -#if ATI_TRACE_DRAW -void -ATIEnterDraw (PixmapPtr pPix, char *function) -{ - if (pPix != NULL) { - KdScreenPriv(pPix->drawable.pScreen); - CARD32 offset; - - offset = ((CARD8 *)pPix->devPrivate.ptr - - pScreenPriv->screen->memory_base); - - ErrorF ("Enter %s 0x%x (%dx%dx%d/%d)\n", function, offset, - pPix->drawable.width, pPix->drawable.height, pPix->drawable.depth, - pPix->drawable.bitsPerPixel); - } else - ErrorF ("Enter %s\n", function); -} - -void -ATILeaveDraw (PixmapPtr pPix, char *function) -{ - if (pPix != NULL) { - KdScreenPriv(pPix->drawable.pScreen); - CARD32 offset; - - offset = ((CARD8 *)pPix->devPrivate.ptr - - pScreenPriv->screen->memory_base); - - ErrorF ("Leave %s 0x%x\n", function, offset); - } else - ErrorF ("Leave %s\n", function); -} -#endif - -/* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we - * require src and dest datatypes to be equal. - */ -static Bool -ATIGetDatatypeBpp(int bpp, CARD32 *type) -{ - switch (bpp) { - case 8: - *type = R128_DATATYPE_CI8; - return TRUE; - case 16: - *type = R128_DATATYPE_RGB565; - return TRUE; - case 24: - *type = R128_DATATYPE_CI8; - return TRUE; - case 32: - *type = R128_DATATYPE_ARGB8888; - return TRUE; - default: - ATI_FALLBACK(("Unsupported bpp: %d\n", bpp)); - return FALSE; - } -} - -Bool -ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset, - int offset, int pitch) -{ - ATICardInfo *atic = atis->atic; - - /* On the R128, depending on the bpp the screen can be set up so that it - * doesn't meet the pitchAlign requirement but can still be - * accelerated, so we check the specific pitch requirement of alignment - * to 8 pixels. - */ - if (atic->is_radeon) { - if (pitch % atis->kaa.pitchAlign != 0) - ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch)); - *pitch_offset = ((pitch >> 6) << 22) | (offset >> 10); - - } else { - if (pitch % bpp != 0) - ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch)); - *pitch_offset = ((pitch / bpp) << 21) | (offset >> 5); - } - - if (offset % atis->kaa.offsetAlign != 0) - ATI_FALLBACK(("Bad offset 0x%08x\n", offset)); - - return TRUE; -} - -Bool -ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset) -{ - KdScreenPriv(pPix->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - CARD32 pitch, offset; - int bpp; - - bpp = pPix->drawable.bitsPerPixel; - if (bpp == 24) - bpp = 8; - - offset = ((CARD8 *)pPix->devPrivate.ptr - - pScreenPriv->screen->memory_base); - pitch = pPix->devKind; - - return ATIGetOffsetPitch(atis, bpp, pitch_offset, offset, pitch); -} - -static Bool -ATIPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) -{ - KdScreenPriv(pPix->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - CARD32 datatype; - RING_LOCALS; - - is_24bpp = (pPix->drawable.bitsPerPixel == 24); - accel_atis = atis; - - if (is_24bpp) { - /* Solid fills in fake-24bpp mode only work if the pixel color - * and planemask are all the same byte. - */ - if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) & - 0xffff))) - ATI_FALLBACK(("Can't do solid color 0x%08x in 24bpp\n", - fg)); - if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) & - 0xffff))) - ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n", - pm)); - } - - if (!ATIGetDatatypeBpp(pPix->drawable.bitsPerPixel, &datatype)) - return FALSE; - if (!ATIGetPixmapOffsetPitch(pPix, &dst_pitch_offset)) - return FALSE; - - ENTER_DRAW(pPix); - - if (atic->is_radeon) - RadeonSwitchTo2D(atis); - - settings = - ATI_GMC_DST_PITCH_OFFSET_CNTL | - ATI_GMC_BRUSH_SOLID_COLOR | - (datatype << 8) | - ATI_GMC_SRC_DATATYPE_COLOR | - (ATISolidRop[alu] << 16) | - ATI_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS; - color = fg; - -#if DRAW_USING_PACKET3 - BEGIN_DMA(6); - OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT, - ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX); - OUT_REG(ATI_REG_DP_WRITE_MASK, pm); - OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT | - ATI_DST_Y_TOP_TO_BOTTOM); - END_DMA(); -#else - BEGIN_DMA(12); - OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT, - ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX); - OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset); - OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings); - OUT_REG(ATI_REG_DP_BRUSH_FRGD_CLR, fg); - OUT_REG(ATI_REG_DP_WRITE_MASK, pm); - OUT_REG(ATI_REG_DP_CNTL, ATI_DST_X_LEFT_TO_RIGHT | - ATI_DST_Y_TOP_TO_BOTTOM); - END_DMA(); -#endif - - LEAVE_DRAW(pPix); - return TRUE; -} - -static void -ATISolid(int x1, int y1, int x2, int y2) -{ - ENTER_DRAW(0); - ATIScreenInfo *atis = accel_atis; - RING_LOCALS; - - if (is_24bpp) { - x1 *= 3; - x2 *= 3; - } -#if DRAW_USING_PACKET3 - BEGIN_DMA(6); - OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_PAINT_MULTI, 5)); - OUT_RING(settings); - OUT_RING(dst_pitch_offset); - OUT_RING(color); - OUT_RING((x1 << 16) | y1); - OUT_RING(((x2 - x1) << 16) | (y2 - y1)); - END_DMA(); -#else - BEGIN_DMA(3); - OUT_RING(DMA_PACKET0(ATI_REG_DST_Y_X, 2)); - OUT_RING_REG(ATI_REG_DST_Y_X, (y1 << 16) | x1); - OUT_RING_REG(ATI_REG_DST_HEIGHT_WIDTH, ((y2 - y1) << 16) | (x2 - x1)); - END_DMA(); -#endif - LEAVE_DRAW(0); -} - -static void -ATIDoneSolid(void) -{ - ENTER_DRAW(0); - LEAVE_DRAW(0); -} - -static Bool -ATIPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - CARD32 datatype; - RING_LOCALS; - - copydx = dx; - copydy = dy; - is_24bpp = pDst->drawable.bitsPerPixel == 24; - accel_atis = atis; - - if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) & - 0xffff)))) - ATI_FALLBACK(("Can't do planemask 0x%08x in 24bpp\n", pm)); - - if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype)) - return FALSE; - if (!ATIGetPixmapOffsetPitch(pSrc, &src_pitch_offset)) - return FALSE; - if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset)) - return FALSE; - - ENTER_DRAW (pDst); - if (atic->is_radeon) - RadeonSwitchTo2D(atis); - - settings = - ATI_GMC_SRC_PITCH_OFFSET_CNTL | - ATI_GMC_DST_PITCH_OFFSET_CNTL | - ATI_GMC_BRUSH_NONE | - (datatype << 8) | - ATI_GMC_SRC_DATATYPE_COLOR | - (ATIBltRop[alu] << 16) | - ATI_DP_SRC_SOURCE_MEMORY | - ATI_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS; - -#if DRAW_USING_PACKET3 - BEGIN_DMA(6); - OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT, - ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX); - OUT_REG(ATI_REG_DP_WRITE_MASK, pm); - OUT_REG(ATI_REG_DP_CNTL, - (dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) | - (dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0)); - END_DMA(); - -#else - BEGIN_DMA(12); - OUT_REG(ATI_REG_DEFAULT_SC_BOTTOM_RIGHT, - ATI_DEFAULT_SC_RIGHT_MAX | ATI_DEFAULT_SC_BOTTOM_MAX); - OUT_REG(ATI_REG_SRC_PITCH_OFFSET, src_pitch_offset); - OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset); - OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, settings); - OUT_REG(ATI_REG_DP_WRITE_MASK, pm); - OUT_REG(ATI_REG_DP_CNTL, - (dx >= 0 ? ATI_DST_X_LEFT_TO_RIGHT : 0) | - (dy >= 0 ? ATI_DST_Y_TOP_TO_BOTTOM : 0)); - END_DMA(); -#endif - LEAVE_DRAW(pDst); - - return TRUE; -} - -static void -ATICopy(int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - ATIScreenInfo *atis = accel_atis; - RING_LOCALS; - - if (is_24bpp) { - srcX *= 3; - dstX *= 3; - w *= 3; - } - -#if !DRAW_USING_PACKET3 - if (copydx < 0) { - srcX += w - 1; - dstX += w - 1; - } - - if (copydy < 0) { - srcY += h - 1; - dstY += h - 1; - } -#endif - -#if DRAW_USING_PACKET3 - BEGIN_DMA(7); - OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_BITBLT_MULTI, 6)); - OUT_RING(settings); - OUT_RING(src_pitch_offset); - OUT_RING(dst_pitch_offset); - OUT_RING((srcX << 16) | srcY); - OUT_RING((dstX << 16) | dstY); - OUT_RING((w << 16) | h); - END_DMA(); -#else - BEGIN_DMA(4); - OUT_RING(DMA_PACKET0(ATI_REG_SRC_Y_X, 3)); - OUT_RING_REG(ATI_REG_SRC_Y_X, (srcY << 16) | srcX); - OUT_RING_REG(ATI_REG_DST_Y_X, (dstY << 16) | dstX); - OUT_RING_REG(ATI_REG_DST_HEIGHT_WIDTH, (h << 16) | w); - END_DMA(); -#endif -} - -static void -ATIDoneCopy(void) -{ -} - -static Bool -ATIUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) -{ - ScreenPtr pScreen = pDst->drawable.pScreen; - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - int width, height, bpp, i, dwords; - int dst_pitch, dst_offset; - CARD32 dst_pitch_offset, datatype; - Bool success; - RING_LOCALS; - - ENTER_DRAW (pDst); - - LEAVE_DRAW (pDst); - /* XXX: Hostdata uploads aren't working yet. */ - return FALSE; - - dst_offset = ((CARD8 *)pDst->devPrivate.ptr - - pScreenPriv->screen->memory_base); - dst_pitch = pDst->devKind; - width = pDst->drawable.width; - height = pDst->drawable.height; - bpp = pDst->drawable.bitsPerPixel; - - success = ATIGetDatatypeBpp(bpp, &datatype); - - if (bpp == 24) { - is_24bpp = TRUE; - bpp = 8; - } else - is_24bpp = FALSE; - - if (!ATIGetOffsetPitch(atis, bpp, &dst_pitch_offset, dst_offset, - dst_pitch)) - return FALSE; - - if (src_pitch != (width * bpp / 8)) - return FALSE; - - /* No PACKET3 packets when in PIO mode. */ - if (atis->using_pio) - return FALSE; - - dwords = (width * height * (bpp / 8) + 3) / 4; - - /* Flush pixel cache so nothing being written to the destination - * previously gets mixed up with the hostdata blit. - */ - if (atic->is_radeon) { - BEGIN_DMA(4); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, RADEON_RB3D_DC_FLUSH); - OUT_REG(ATI_REG_WAIT_UNTIL, - RADEON_WAIT_2D_IDLECLEAN | - RADEON_WAIT_3D_IDLECLEAN | - RADEON_WAIT_HOST_IDLECLEAN); - END_DMA(); - } else { - BEGIN_DMA(2); - OUT_REG(R128_REG_PC_GUI_CTLSTAT, - R128_PC_FLUSH_GUI | R128_PC_RI_GUI); - END_DMA(); - } - - BEGIN_DMA(8); - OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_HOSTDATA_BLT, 7 + dwords)); - OUT_RING(ATI_GMC_DST_PITCH_OFFSET_CNTL | - ATI_GMC_BRUSH_NONE | - (datatype << 8) | - ATI_GMC_SRC_DATATYPE_COLOR | - (ATISolidRop[GXcopy] << 16) | - ATI_DP_SRC_SOURCE_HOST_DATA | - ATI_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - ATI_GMC_WR_MSK_DIS); - OUT_RING(dst_pitch_offset); - OUT_RING(0xffffffff); - OUT_RING(0xffffffff); - OUT_RING((0 << 16) | 0); - OUT_RING((height << 16) | width); - OUT_RING(dwords); - END_DMA(); - - for (i = 0; i < dwords; i++) { - BEGIN_DMA(1); - OUT_RING(((CARD32 *)src)[i]); - END_DMA(); - } - - if (atic->is_radeon) { - BEGIN_DMA(4); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, - RADEON_RB3D_DC_FLUSH_ALL); - OUT_REG(ATI_REG_WAIT_UNTIL, - RADEON_WAIT_2D_IDLECLEAN | - RADEON_WAIT_HOST_IDLECLEAN); - END_DMA(); - } else { - BEGIN_DMA(2); - OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI); - END_DMA(); - } - - kaaMarkSync(pScreen); - - ErrorF("hostdata upload %d,%d %dbpp\n", width, height, bpp); - - return TRUE; -} - - -static Bool -ATIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst) -{ - KdScreenPriv(pSrc->drawable.pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - int dst_pitch, src_pitch, w, i, size, bytes; - unsigned char *dst, *src; - RING_LOCALS; - - ENTER_DRAW(pSrc); - /* Align width to log 2, useful for R128 composite. This should be a - * KAA flag we check for (and supported in kaa.c in general) since many - * older bits of hardware are going to want POT pitches. - */ - w = pSrc->drawable.width; - if (atis->kaa.flags & KAA_OFFSCREEN_ALIGN_POT) - w = 1 << (ATILog2(w - 1) + 1); - dst_pitch = (w * pSrc->drawable.bitsPerPixel / 8 + - atis->kaa.pitchAlign - 1) & ~(atis->kaa.pitchAlign - 1); - - size = dst_pitch * pSrc->drawable.height; - if (size > atis->scratch_area->size) - ATI_FALLBACK(("Pixmap too large for scratch (%d,%d)\n", - pSrc->drawable.width, pSrc->drawable.height)); - - atis->scratch_next = (atis->scratch_next + atis->kaa.offsetAlign - 1) & - ~(atis->kaa.offsetAlign - 1); - if (atis->scratch_next + size > atis->scratch_area->offset + - atis->scratch_area->size) { - /* Only sync when we've used all of the scratch area. */ - kaaWaitSync(pSrc->drawable.pScreen); - atis->scratch_next = atis->scratch_area->offset; - } - memcpy(pDst, pSrc, sizeof(*pDst)); - pDst->devKind = dst_pitch; - pDst->devPrivate.ptr = pScreenPriv->screen->memory_base + - atis->scratch_next; - atis->scratch_next += size; - - src = pSrc->devPrivate.ptr; - src_pitch = pSrc->devKind; - dst = pDst->devPrivate.ptr; - bytes = src_pitch < dst_pitch ? src_pitch : dst_pitch; - - i = pSrc->drawable.height; - while (i--) { - memcpy(dst, src, bytes); - dst += dst_pitch; - src += src_pitch; - } - - /* Flush the pixel cache */ - if (atic->is_radeon) { - BEGIN_DMA(4); - OUT_REG(RADEON_REG_RB3D_DSTCACHE_CTLSTAT, - RADEON_RB3D_DC_FLUSH_ALL); - OUT_REG(ATI_REG_WAIT_UNTIL, RADEON_WAIT_HOST_IDLECLEAN); - END_DMA(); - } else { - BEGIN_DMA(2); - OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_ALL); - END_DMA(); - } - - LEAVE_DRAW(pSrc); - return TRUE; -} - -static void -ATIBlockHandler(pointer blockData, OSTimePtr timeout, pointer readmask) -{ - ScreenPtr pScreen = (ScreenPtr) blockData; - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - - /* When the server is going to sleep, make sure that all DMA data has - * been flushed. - */ - if (atis->indirectBuffer) - ATIFlushIndirect(atis, 1); -} - -static void -ATIWakeupHandler(pointer blockData, int result, pointer readmask) -{ -} - -Bool -ATIDrawInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - - ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth, - pScreenPriv->screen->fb[0].bitsPerPixel); - - RegisterBlockAndWakeupHandlers(ATIBlockHandler, ATIWakeupHandler, - pScreen); - -#ifdef USE_DRI - atis->using_dri = ATIDRIScreenInit(pScreen); -#endif /* USE_DRI */ - - memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec)); - atis->kaa.waitMarker = ATIWaitMarker; - atis->kaa.PrepareSolid = ATIPrepareSolid; - atis->kaa.Solid = ATISolid; - atis->kaa.DoneSolid = ATIDoneSolid; - atis->kaa.PrepareCopy = ATIPrepareCopy; - atis->kaa.Copy = ATICopy; - atis->kaa.DoneCopy = ATIDoneCopy; - /* Other acceleration will be hooked in in DrawEnable depending on - * what type of DMA gets initialized. - */ - - atis->kaa.flags = KAA_OFFSCREEN_PIXMAPS; - if (atic->is_radeon) { - atis->kaa.offsetAlign = 1024; - atis->kaa.pitchAlign = 64; - } else { - /* Rage 128 compositing wants power-of-two pitches. */ - atis->kaa.flags |= KAA_OFFSCREEN_ALIGN_POT; - atis->kaa.offsetAlign = 32; - /* Pitch alignment is in sets of 8 pixels, and we need to cover - * 32bpp, so 32 bytes. - */ - atis->kaa.pitchAlign = 32; - } - - kaaInitTrapOffsets(8, sample_offsets_x, sample_offsets_y, 0.0, 0.0); - sample_count = (1 << 8) - 1; - - if (!kaaDrawInit(pScreen, &atis->kaa)) - return FALSE; - - return TRUE; -} - -static void -ATIScratchSave(ScreenPtr pScreen, KdOffscreenArea *area) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - - atis->scratch_area = NULL; -} - -void -ATIDrawEnable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - - ATIDMASetup(pScreen); - ATIDrawSetup(pScreen); - - atis->scratch_area = NULL; - atis->kaa.PrepareBlend = NULL; - atis->kaa.Blend = NULL; - atis->kaa.DoneBlend = NULL; - atis->kaa.CheckComposite = NULL; - atis->kaa.PrepareComposite = NULL; - atis->kaa.Composite = NULL; - atis->kaa.DoneComposite = NULL; - atis->kaa.UploadToScreen = NULL; - atis->kaa.UploadToScratch = NULL; - - /* We can't dispatch 3d commands in PIO mode. */ - if (!atis->using_pio) { - if (!atic->is_radeon) { - atis->kaa.CheckComposite = R128CheckComposite; - atis->kaa.PrepareComposite = R128PrepareComposite; - atis->kaa.Composite = R128Composite; - atis->kaa.DoneComposite = R128DoneComposite; - } else if (atic->is_r100) { - atis->kaa.CheckComposite = R100CheckComposite; - atis->kaa.PrepareComposite = R100PrepareComposite; - atis->kaa.Composite = RadeonComposite; - atis->kaa.DoneComposite = RadeonDoneComposite; - } else if (atic->is_r200) { - atis->kaa.CheckComposite = R200CheckComposite; - atis->kaa.PrepareComposite = R200PrepareComposite; - atis->kaa.Composite = RadeonComposite; - atis->kaa.DoneComposite = RadeonDoneComposite; - } - } -#ifdef USE_DRI - if (atis->using_dri) { - if (!atic->is_radeon) { - /*atis->kaa.PrepareTrapezoids = R128PrepareTrapezoids; - atis->kaa.Trapezoids = R128Trapezoids; - atis->kaa.DoneTrapezoids = R128DoneTrapezoids;*/ - } else if (atic->is_r100 || atic->is_r200) { - atis->kaa.PrepareTrapezoids = RadeonPrepareTrapezoids; - atis->kaa.Trapezoids = RadeonTrapezoids; - atis->kaa.DoneTrapezoids = RadeonDoneTrapezoids; - } - } -#endif /* USE_DRI */ - - atis->kaa.UploadToScreen = ATIUploadToScreen; - - /* Reserve a scratch area. It'll be used for storing glyph data during - * Composite operations, because glyphs aren't in real pixmaps and thus - * can't be migrated. - */ - atis->scratch_area = KdOffscreenAlloc(pScreen, 131072, - atis->kaa.offsetAlign, TRUE, ATIScratchSave, atis); - if (atis->scratch_area != NULL) { - atis->scratch_next = atis->scratch_area->offset; - atis->kaa.UploadToScratch = ATIUploadToScratch; - } - - kaaMarkSync(pScreen); -} - -void -ATIDrawDisable(ScreenPtr pScreen) -{ - kaaWaitSync(pScreen); - ATIDMATeardown(pScreen); -} - -void -ATIDrawFini(ScreenPtr pScreen) -{ -#ifdef USE_DRI - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - if (atis->using_dri) { - ATIDRICloseScreen(pScreen); - atis->using_dri = FALSE; - } -#endif /* USE_DRI */ - - RemoveBlockAndWakeupHandlers(ATIBlockHandler, ATIWakeupHandler, - pScreen); - - kaaDrawFini(pScreen); -} - diff --git a/hw/kdrive/ati/ati_draw.h b/hw/kdrive/ati/ati_draw.h deleted file mode 100644 index 98a130a7b..000000000 --- a/hw/kdrive/ati/ati_draw.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright © 2004 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 _ATI_DRAW_H_ -#define _ATI_DRAW_H_ - -Bool ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset, - int offset, int pitch); -Bool ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset); - -Bool R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture); -Bool R128PrepareComposite(int op, PicturePtr pSrcPicture, - PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, - PixmapPtr pMask, PixmapPtr pDst); -void R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, - int w, int h); -void R128DoneComposite(void); - -Bool R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst); -void R128Trapezoids(KaaTrapezoid *traps, int ntraps); -void R128DoneTrapezoids(void); - -Bool R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture); -Bool R100PrepareComposite(int op, PicturePtr pSrcPicture, - PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, - PixmapPtr pMask, PixmapPtr pDst); -Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture); -Bool R200PrepareComposite(int op, PicturePtr pSrcPicture, - PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, - PixmapPtr pMask, PixmapPtr pDst); -void RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX, - int dstY, int w, int h); -void RadeonDoneComposite(void); - -Bool RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst); -void RadeonTrapezoids(KaaTrapezoid *traps, int ntraps); -void RadeonDoneTrapezoids(void); - -void RadeonSwitchTo2D(ATIScreenInfo *atis); -void RadeonSwitchTo3D(ATIScreenInfo *atis); -void ATIWaitIdle(ATIScreenInfo *atis); - -#define ATI_TRACE_FALL 0 -#define ATI_TRACE_DRAW 0 - -#if ATI_TRACE_FALL -#define ATI_FALLBACK(x) \ -do { \ - ErrorF("%s: ", __FUNCTION__); \ - ErrorF x; \ - return FALSE; \ -} while (0) -#else -#define ATI_FALLBACK(x) return FALSE -#endif - -#if ATI_TRACE_DRAW -#define ENTER_DRAW(pix) ATIEnterDraw(pix, __FUNCTION__) -#define LEAVE_DRAW(pix) ATILeaveDraw(pix, __FUNCTION__) - -void -ATIEnterDraw (PixmapPtr pPixmap, char *function); - -void -ATILeaveDraw (PixmapPtr pPixmap, char *function); -#else /* ATI_TRACE */ -#define ENTER_DRAW(pix) -#define LEAVE_DRAW(pix) -#endif /* !ATI_TRACE */ - -#endif /* _ATI_DRAW_H_ */ diff --git a/hw/kdrive/ati/ati_drawtmp.h b/hw/kdrive/ati/ati_drawtmp.h deleted file mode 100644 index 82c99ac4d..000000000 --- a/hw/kdrive/ati/ati_drawtmp.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 USE_DMA -#define TAG(x) x##DMA -#define LOCALS RING_LOCALS; \ - (void)atic -#define BEGIN(x) BEGIN_RING(x * 2) -#define OUT_REG(reg, val) OUT_RING_REG(reg, val) -#define END() ADVANCE_RING() -#else -#define TAG(x) x##MMIO -#define LOCALS char *mmio = atic->reg_base; \ - (void)atis -#define BEGIN(x) ATIWaitAvailMMIO(x) -#define OUT_REG(reg, val) MMIO_OUT32((mmio), (reg), (val)) -#define END() -#endif - -static Bool -TAG(ATISetup)(PixmapPtr pDst, PixmapPtr pSrc) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - int dst_offset, dst_pitch; - int bpp = pDst->drawable.bitsPerPixel; - LOCALS; - - accel_atis = atis; - - dst_pitch = pDst->devKind; - dst_offset = ((CARD8 *)pDst->devPrivate.ptr - - pScreenPriv->screen->memory_base); - if ((dst_pitch & (atis->kaa.offscreenPitch - 1)) != 0) - ATI_FALLBACK(("Bad dst pitch 0x%x\n", dst_pitch)); - if ((dst_offset & (atis->kaa.offscreenByteAlign - 1)) != 0) - ATI_FALLBACK(("Bad dst offset 0x%x\n", dst_offset)); - - if (pSrc != NULL) { - src_pitch = pSrc->devKind; - src_offset = ((CARD8 *)pSrc->devPrivate.ptr - - pScreenPriv->screen->memory_base); - if ((src_pitch & (atis->kaa.offscreenPitch - 1)) != 0) - ATI_FALLBACK(("Bad src pitch 0x%x\n", src_pitch)); - if ((src_offset & (atis->kaa.offscreenByteAlign - 1)) != 0) - ATI_FALLBACK(("Bad src offset 0x%x\n", src_offset)); - } - -#ifdef USE_DMA - if (atic->is_radeon && !atic->is_r200) - RadeonSwitchTo2D(); -#endif - BEGIN((pSrc != NULL) ? 3 : 2); - if (atic->is_radeon) { - OUT_REG(RADEON_REG_DST_PITCH_OFFSET, - ((dst_pitch >> 6) << 22) | (dst_offset >> 10)); - if (pSrc != NULL) { - OUT_REG(RADEON_REG_SRC_PITCH_OFFSET, - ((src_pitch >> 6) << 22) | (src_offset >> 10)); - } - } else { - if (is_24bpp) { - dst_pitch *= 3; - src_pitch *= 3; - } - /* R128 pitch is in units of 8 pixels, offset in 32 bytes */ - OUT_REG(RADEON_REG_DST_PITCH_OFFSET, - ((dst_pitch/bpp) << 21) | (dst_offset >> 5)); - if (pSrc != NULL) { - OUT_REG(RADEON_REG_SRC_PITCH_OFFSET, - ((src_pitch/bpp) << 21) | (src_offset >> 5)); - } - } - OUT_REG(RADEON_REG_DEFAULT_SC_BOTTOM_RIGHT, - (RADEON_DEFAULT_SC_RIGHT_MAX | RADEON_DEFAULT_SC_BOTTOM_MAX)); - END(); - - return TRUE; -} - -static Bool -TAG(ATIPrepareSolid)(PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) -{ - KdScreenPriv(pPixmap->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - CARD32 datatype; - LOCALS; - - if (is_24bpp) { - /* Solid fills in fake-24bpp mode only work if the pixel color - * and planemask are all the same byte. - */ - if ((fg & 0xffffff) != (((fg & 0xff) << 16) | ((fg >> 8) & - 0xffff))) - ATI_FALLBACK(("Can't do solid color %d in 24bpp\n")); - if ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) & - 0xffff))) - ATI_FALLBACK(("Can't do planemask %d in 24bpp\n")); - } - - if (!ATIGetDatatypeBpp(pPixmap->drawable.bitsPerPixel, &datatype)) - return FALSE; - if (!TAG(ATISetup)(pPixmap, NULL)) - return FALSE; - - BEGIN(4); - OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL, - (datatype << 8) | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_AUX_CLIP_DIS | - RADEON_GMC_BRUSH_SOLID_COLOR | - RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_SRC_DATATYPE_COLOR | - (ATISolidRop[alu] << 16)); - OUT_REG(RADEON_REG_DP_BRUSH_FRGD_CLR, fg); - OUT_REG(RADEON_REG_DP_WRITE_MASK, pm); - OUT_REG(RADEON_REG_DP_CNTL, RADEON_DST_X_LEFT_TO_RIGHT | - RADEON_DST_Y_TOP_TO_BOTTOM); - END(); - - return TRUE; -} - -static void -TAG(ATISolid)(int x1, int y1, int x2, int y2) -{ - ATIScreenInfo *atis = accel_atis; - ATICardInfo *atic = atis->atic; - LOCALS; - - if (is_24bpp) { - x1 *= 3; - x2 *= 3; - } - BEGIN(2); - OUT_REG(RADEON_REG_DST_Y_X, (y1 << 16) | x1); - OUT_REG(RADEON_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1)); - END(); -} - -static Bool -TAG(ATIPrepareCopy)(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - CARD32 datatype; - LOCALS; - - copydx = dx; - copydy = dy; - - if (is_24bpp && ((pm & 0xffffff) != (((pm & 0xff) << 16) | ((pm >> 8) & - 0xffff)))) - ATI_FALLBACK(("Can't do planemask %d in 24bpp\n")); - - if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype)) - return FALSE; - if (!TAG(ATISetup)(pDst, pSrc)) - return FALSE; - - BEGIN(3); - OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL, - (datatype << 8) | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_AUX_CLIP_DIS | - RADEON_GMC_BRUSH_SOLID_COLOR | - RADEON_GMC_SRC_DATATYPE_COLOR | - (ATIBltRop[alu] << 16) | - RADEON_GMC_SRC_PITCH_OFFSET_CNTL | - RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_DP_SRC_SOURCE_MEMORY); - OUT_REG(RADEON_REG_DP_WRITE_MASK, pm); - OUT_REG(RADEON_REG_DP_CNTL, - (dx >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) | - (dy >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0)); - END(); - - return TRUE; -} - -static void -TAG(ATICopy)(int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - ATIScreenInfo *atis = accel_atis; - ATICardInfo *atic = atis->atic; - LOCALS; - - if (is_24bpp) { - srcX *= 3; - dstX *= 3; - w *= 3; - } - - if (copydx < 0) { - srcX += w - 1; - dstX += w - 1; - } - - if (copydy < 0) { - srcY += h - 1; - dstY += h - 1; - } - - BEGIN(3); - OUT_REG(RADEON_REG_SRC_Y_X, (srcY << 16) | srcX); - OUT_REG(RADEON_REG_DST_Y_X, (dstY << 16) | dstX); - OUT_REG(RADEON_REG_DST_HEIGHT_WIDTH, (h << 16) | w); - END(); -} - -#undef TAG -#undef LOCALS -#undef BEGIN -#undef OUT_REG -#undef END diff --git a/hw/kdrive/ati/ati_dri.c b/hw/kdrive/ati/ati_dri.c deleted file mode 100644 index edef72030..000000000 --- a/hw/kdrive/ati/ati_dri.c +++ /dev/null @@ -1,1138 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 <sys/time.h> - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include "ati.h" -#include "ati_reg.h" -#include "ati_dma.h" -#include "ati_dri.h" -#include "ati_dripriv.h" -#include "sarea.h" -#include "ati_sarea.h" -#include "ati_draw.h" -#include "r128_common.h" -#include "radeon_common.h" -#include "kaa.h" - -/* ?? HACK - for now, put this here... */ -/* ?? Alpha - this may need to be a variable to handle UP1x00 vs TITAN */ -#if defined(__alpha__) -# define DRM_PAGE_SIZE 8192 -#elif defined(__ia64__) -# define DRM_PAGE_SIZE getpagesize() -#else -# define DRM_PAGE_SIZE 4096 -#endif - -#ifdef GLXEXT -/* Initialize the visual configs that are supported by the hardware. - * These are combined with the visual configs that the indirect - * rendering core supports, and the intersection is exported to the - * client. - */ -static Bool ATIInitVisualConfigs(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - int numConfigs = 0; - __GLXvisualConfig *pConfigs = NULL; - ATIConfigPrivPtr pATIConfigs = NULL; - ATIConfigPrivPtr *pATIConfigPtrs = NULL; - int i, accum, stencil, db, use_db; - int depth = pScreenPriv->screen->fb[0].depth; - int bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - - if (depth != 16 && (depth != 24 || bpp != 32)) - ErrorF("DRI GLX unsupported at %d/%d depth/bpp\n", depth, bpp); - - if (atis->depthOffset != 0) - use_db = 1; - else - use_db = 0; - - numConfigs = 4; - if (use_db) - numConfigs *= 2; - - pConfigs = xcalloc(sizeof(__GLXvisualConfig), numConfigs); - pATIConfigs = xcalloc(sizeof(ATIConfigPrivRec), numConfigs); - pATIConfigPtrs = xcalloc(sizeof(ATIConfigPrivPtr), numConfigs); - if (pConfigs == NULL || pATIConfigs == NULL || pATIConfigPtrs == NULL) { - xfree(pConfigs); - xfree(pATIConfigs); - xfree(pATIConfigPtrs); - return FALSE; - } - - i = 0; - for (db = 0; db <= use_db; db++) { - for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= 1; stencil++) { - pATIConfigPtrs[i] = &pATIConfigs[i]; - - pConfigs[i].vid = (VisualID)(-1); - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - if (depth == 16) { - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0x00000000; - } else { - pConfigs[i].redSize = 8; - pConfigs[i].greenSize = 8; - pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 8; - pConfigs[i].redMask = 0x00FF0000; - pConfigs[i].greenMask = 0x0000FF00; - pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0xFF000000; - } - if (accum) { /* Simulated in software */ - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - if (depth == 16) - pConfigs[i].accumAlphaSize = 0; - else - pConfigs[i].accumAlphaSize = 16; - } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - if (db) - pConfigs[i].doubleBuffer = TRUE; - else - pConfigs[i].doubleBuffer = FALSE; - pConfigs[i].stereo = FALSE; - if (depth == 16) { - pConfigs[i].bufferSize = 16; - pConfigs[i].depthSize = 16; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - } else { - pConfigs[i].bufferSize = 32; - if (stencil) { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 8; - } else { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 0; - } - } - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (accum) { - pConfigs[i].visualRating = GLX_SLOW_CONFIG; - } else { - pConfigs[i].visualRating = GLX_NONE; - } - pConfigs[i].transparentPixel = GLX_NONE; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } - } - - atis->numVisualConfigs = numConfigs; - atis->pVisualConfigs = pConfigs; - atis->pVisualConfigsPriv = pATIConfigs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pATIConfigPtrs); - return TRUE; -} -#endif /* GLXEXT */ - -static void -ATIDRIInitGARTValues(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - int s, l; - - atis->gartOffset = 0; - - /* Initialize the ring buffer data */ - atis->ringStart = atis->gartOffset; - atis->ringMapSize = atis->ringSize * 1024 * 1024 + DRM_PAGE_SIZE; - - atis->ringReadOffset = atis->ringStart + atis->ringMapSize; - atis->ringReadMapSize = DRM_PAGE_SIZE; - - /* Reserve space for vertex/indirect buffers */ - atis->bufStart = atis->ringReadOffset + atis->ringReadMapSize; - atis->bufMapSize = atis->bufSize * 1024 * 1024; - - /* Reserve the rest for GART textures */ - atis->gartTexStart = atis->bufStart + atis->bufMapSize; - s = (atis->gartSize * 1024 * 1024 - atis->gartTexStart); - l = ATILog2((s-1) / ATI_NR_TEX_REGIONS); - if (l < ATI_LOG_TEX_GRANULARITY) l = ATI_LOG_TEX_GRANULARITY; - atis->gartTexMapSize = (s >> l) << l; - atis->log2GARTTexGran = l; -} - -static int -ATIDRIAddAndMap(int fd, drmHandle offset, drmSize size, - drmMapType type, drmMapFlags flags, drmHandlePtr handle, - drmAddressPtr address, char *desc) -{ - char *name; - - name = (type == DRM_AGP) ? "agp" : "pci"; - - if (drmAddMap(fd, offset, size, type, flags, handle) < 0) { - ErrorF("[%s] Could not add %s mapping\n", name, desc); - return FALSE; - } - ErrorF("[%s] %s handle = 0x%08lx\n", name, desc, *handle); - - if (drmMap(fd, *handle, size, address) < 0) { - ErrorF("[%s] Could not map %s\n", name, desc); - return FALSE; - } - ErrorF("[%s] %s mapped at 0x%08lx\n", name, desc, *address); - - return TRUE; -} - -/* Initialize the AGP state. Request memory for use in AGP space, and - initialize the Rage 128 registers to point to that memory. */ -static Bool -ATIDRIAgpInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - unsigned char *mmio = atic->reg_base; - unsigned long mode; - int ret; - CARD32 cntl, chunk; - - if (drmAgpAcquire(atic->drmFd) < 0) { - ErrorF("[agp] AGP not available\n"); - return FALSE; - } - - ATIDRIInitGARTValues(pScreen); - - mode = drmAgpGetMode(atic->drmFd); - if (atic->is_radeon) { - mode &= ~RADEON_AGP_MODE_MASK; - mode |= RADEON_AGP_1X_MODE; - } else { - mode &= ~R128_AGP_MODE_MASK; - mode |= R128_AGP_1X_MODE; - } - - if (drmAgpEnable(atic->drmFd, mode) < 0) { - ErrorF("[agp] AGP not enabled\n"); - drmAgpRelease(atic->drmFd); - return FALSE; - } - ErrorF("[agp] Mode 0x%08x selected\n", drmAgpGetMode(atic->drmFd)); - - if ((ret = drmAgpAlloc(atic->drmFd, atis->gartSize * 1024 * 1024, 0, - NULL, &atis->agpMemHandle)) < 0) { - ErrorF("[agp] Out of memory (%d)\n", ret); - drmAgpRelease(atic->drmFd); - return FALSE; - } - ErrorF("[agp] %d kB allocated with handle 0x%08lx\n", - atis->gartSize * 1024, (long)atis->agpMemHandle); - - if (drmAgpBind(atic->drmFd, atis->agpMemHandle, atis->gartOffset) < 0) { - ErrorF("[agp] Could not bind\n"); - drmAgpFree(atic->drmFd, atis->agpMemHandle); - drmAgpRelease(atic->drmFd); - return FALSE; - } - - if (!ATIDRIAddAndMap(atic->drmFd, atis->ringStart, atis->ringMapSize, - DRM_AGP, DRM_READ_ONLY, &atis->ringHandle, - (drmAddressPtr)&atis->ring, "ring")) - return FALSE; - - if (!ATIDRIAddAndMap(atic->drmFd, atis->ringReadOffset, - atis->ringReadMapSize, DRM_AGP, DRM_READ_ONLY, - &atis->ringReadPtrHandle, (drmAddressPtr)&atis->ringReadPtr, - "ring read ptr")) - return FALSE; - - if (!ATIDRIAddAndMap(atic->drmFd, atis->bufStart, atis->bufMapSize, - DRM_AGP, 0, &atis->bufHandle, (drmAddressPtr)&atis->buf, - "vertex/indirect buffers")) - return FALSE; - - if (!ATIDRIAddAndMap(atic->drmFd, atis->gartTexStart, - atis->gartTexMapSize, DRM_AGP, 0, &atis->gartTexHandle, - (drmAddressPtr)&atis->gartTex, "AGP texture map")) - return FALSE; - - if (atic->is_r100) { - /* Workaround for some hardware bugs */ - cntl = MMIO_IN32(mmio, ATI_REG_AGP_CNTL); - MMIO_OUT32(mmio, ATI_REG_AGP_CNTL, cntl | - RADEON_PENDING_SLOTS_VAL | RADEON_PENDING_SLOTS_SEL); - } else if (!atic->is_radeon) { - cntl = MMIO_IN32(mmio, ATI_REG_AGP_CNTL); - cntl &= ~R128_AGP_APER_SIZE_MASK; - switch (atis->gartSize) { - case 256: cntl |= R128_AGP_APER_SIZE_256MB; break; - case 128: cntl |= R128_AGP_APER_SIZE_128MB; break; - case 64: cntl |= R128_AGP_APER_SIZE_64MB; break; - case 32: cntl |= R128_AGP_APER_SIZE_32MB; break; - case 16: cntl |= R128_AGP_APER_SIZE_16MB; break; - case 8: cntl |= R128_AGP_APER_SIZE_8MB; break; - case 4: cntl |= R128_AGP_APER_SIZE_4MB; break; - default: - ErrorF("[agp] Illegal aperture size %d kB\n", atis->gartSize * - 1024); - return FALSE; - } - MMIO_OUT32(mmio, ATI_REG_AGP_CNTL, cntl); - - /* Disable Rage 128 PCIGART registers */ - chunk = MMIO_IN32(mmio, R128_REG_BM_CHUNK_0_VAL); - chunk &= ~(R128_BM_PTR_FORCE_TO_PCI | - R128_BM_PM4_RD_FORCE_TO_PCI | - R128_BM_GLOBAL_FORCE_TO_PCI); - MMIO_OUT32(mmio, R128_REG_BM_CHUNK_0_VAL, chunk); - - /* Ensure AGP GART is used (for now) */ - MMIO_OUT32(mmio, R128_REG_PCI_GART_PAGE, 1); - } - - MMIO_OUT32(mmio, ATI_REG_AGP_BASE, drmAgpBase(atic->drmFd)); - - return TRUE; -} - -static Bool -ATIDRIPciInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - unsigned char *mmio = atic->reg_base; - CARD32 chunk; - int ret; - - ATIDRIInitGARTValues(pScreen); - - ret = drmScatterGatherAlloc(atic->drmFd, atis->gartSize * 1024 * 1024, - &atis->pciMemHandle); - if (ret < 0) { - ErrorF("[pci] Out of memory (%d)\n", ret); - return FALSE; - } - ErrorF("[pci] %d kB allocated with handle 0x%08lx\n", - atis->gartSize * 1024, (long)atis->pciMemHandle); - - if (!ATIDRIAddAndMap(atic->drmFd, atis->ringStart, atis->ringMapSize, - DRM_SCATTER_GATHER, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL, - &atis->ringHandle, (drmAddressPtr)&atis->ring, "ring")) - return FALSE; - - if (!ATIDRIAddAndMap(atic->drmFd, atis->ringReadOffset, - atis->ringReadMapSize, DRM_SCATTER_GATHER, - DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL, - &atis->ringReadPtrHandle, (drmAddressPtr)&atis->ringReadPtr, - "ring read ptr")) - return FALSE; - - if (!ATIDRIAddAndMap(atic->drmFd, atis->bufStart, atis->bufMapSize, - DRM_SCATTER_GATHER, 0, &atis->bufHandle, (drmAddressPtr)&atis->buf, - "vertex/indirect buffers")) - return FALSE; - - if (!ATIDRIAddAndMap(atic->drmFd, atis->gartTexStart, - atis->gartTexMapSize, DRM_SCATTER_GATHER, 0, &atis->gartTexHandle, - (drmAddressPtr)&atis->gartTex, "PCI texture map")) - return FALSE; - - if (!atic->is_radeon) { - /* Force PCI GART mode */ - chunk = MMIO_IN32(mmio, R128_REG_BM_CHUNK_0_VAL); - chunk |= (R128_BM_PTR_FORCE_TO_PCI | - R128_BM_PM4_RD_FORCE_TO_PCI | R128_BM_GLOBAL_FORCE_TO_PCI); - MMIO_OUT32(mmio, R128_REG_BM_CHUNK_0_VAL, chunk); - /* Ensure PCI GART is used */ - MMIO_OUT32(mmio, R128_REG_PCI_GART_PAGE, 0); - } - return TRUE; -} - - -/* Initialize the kernel data structures. */ -static int -R128DRIKernelInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - drmR128Init drmInfo; - int bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - - memset(&drmInfo, 0, sizeof(drmR128Init) ); - - drmInfo.func = DRM_R128_INIT_CCE; - drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); - drmInfo.is_pci = !atis->using_agp; - drmInfo.cce_mode = R128_PM4_64BM_64VCBM_64INDBM; - drmInfo.cce_secure = TRUE; - drmInfo.ring_size = atis->ringSize * 1024 * 1024; - drmInfo.usec_timeout = atis->DMAusecTimeout; - - drmInfo.front_offset = atis->frontOffset; - drmInfo.front_pitch = atis->frontPitch / (bpp / 8); - drmInfo.back_offset = atis->backOffset; - drmInfo.back_pitch = atis->backPitch / (bpp / 8); - drmInfo.fb_bpp = bpp; - - drmInfo.depth_offset = atis->depthOffset; - drmInfo.depth_pitch = atis->depthPitch / (bpp / 8); - drmInfo.depth_bpp = bpp; - - drmInfo.span_offset = atis->spanOffset; - - drmInfo.fb_offset = atis->fbHandle; - drmInfo.mmio_offset = atis->registerHandle; - drmInfo.ring_offset = atis->ringHandle; - drmInfo.ring_rptr_offset = atis->ringReadPtrHandle; - drmInfo.buffers_offset = atis->bufHandle; - drmInfo.agp_textures_offset = atis->gartTexHandle; - - if (drmCommandWrite(atic->drmFd, DRM_R128_INIT, &drmInfo, - sizeof(drmR128Init)) < 0) - return FALSE; - - return TRUE; -} - -/* Initialize the kernel data structures */ -static int -RadeonDRIKernelInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - drmRadeonInit drmInfo; - - memset(&drmInfo, 0, sizeof(drmRadeonInit)); - - if (atic->is_r200) - drmInfo.func = DRM_RADEON_INIT_R200_CP; - else - drmInfo.func = DRM_RADEON_INIT_CP; - - drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); - drmInfo.is_pci = !atis->using_agp; - drmInfo.cp_mode = RADEON_CSQ_PRIBM_INDBM; - drmInfo.gart_size = atis->gartSize * 1024 * 1024; - drmInfo.ring_size = atis->ringSize * 1024 * 1024; - drmInfo.usec_timeout = atis->DMAusecTimeout; - - drmInfo.front_offset = atis->frontOffset; - drmInfo.front_pitch = atis->frontPitch; - drmInfo.back_offset = atis->backOffset; - drmInfo.back_pitch = atis->backPitch; - drmInfo.fb_bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - drmInfo.depth_offset = atis->depthOffset; - drmInfo.depth_pitch = atis->depthPitch; - drmInfo.depth_bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - - drmInfo.fb_offset = atis->fbHandle; - drmInfo.mmio_offset = atis->registerHandle; - drmInfo.ring_offset = atis->ringHandle; - drmInfo.ring_rptr_offset = atis->ringReadPtrHandle; - drmInfo.buffers_offset = atis->bufHandle; - drmInfo.gart_textures_offset = atis->gartTexHandle; - - if (drmCommandWrite(atic->drmFd, DRM_RADEON_CP_INIT, - &drmInfo, sizeof(drmRadeonInit)) < 0) - return FALSE; - - return TRUE; -} - -/* Add a map for the vertex buffers that will be accessed by any - DRI-based clients. */ -static Bool -ATIDRIBufInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - int type, size; - - if (atic->is_radeon) - size = RADEON_BUFFER_SIZE; - else - size = R128_BUFFER_SIZE; - - if (atis->using_agp) - type = DRM_AGP_BUFFER; - else - type = DRM_SG_BUFFER; - - /* Initialize vertex buffers */ - atis->bufNumBufs = drmAddBufs(atic->drmFd, atis->bufMapSize / size, - size, type, atis->bufStart); - - if (atis->bufNumBufs <= 0) { - ErrorF("[drm] Could not create vertex/indirect buffers list\n"); - return FALSE; - } - ErrorF("[drm] Added %d %d byte vertex/indirect buffers\n", - atis->bufNumBufs, size); - - atis->buffers = drmMapBufs(atic->drmFd); - if (atis->buffers == NULL) { - ErrorF("[drm] Failed to map vertex/indirect buffers list\n"); - return FALSE; - } - ErrorF("[drm] Mapped %d vertex/indirect buffers\n", - atis->buffers->count); - - return TRUE; -} - -static int -ATIDRIIrqInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - - if (atis->irqEnabled) - return FALSE; - - atis->irqEnabled = drmCtlInstHandler(atic->drmFd, 0); - - if (!atis->irqEnabled) - return FALSE; - - return TRUE; -} - -static void ATIDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - - if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && - (newContextType==DRI_2D_CONTEXT)) { - /* Entering from Wakeup */ - kaaMarkSync(pScreen); - } - if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && - (newContextType==DRI_2D_CONTEXT)) { - /* Exiting from Block Handler */ - if (atis->dma_started) - ATIFlushIndirect(atis, 1); - } -} - -static Bool ATIDRIFinishScreenInit(ScreenPtr pScreen); - -/* Initialize the screen-specific data structures for the Radeon or - Rage 128. This is the main entry point to the device-specific - initialization code. It calls device-independent DRI functions to - create the DRI data structures and initialize the DRI state. */ -Bool -ATIDRIScreenInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - void *scratch_ptr; - int scratch_int; - DRIInfoPtr pDRIInfo; - int devSareaSize; - drmSetVersion sv; - - if (pScreenPriv->screen->fb[0].depth < 16 || - pScreenPriv->screen->fb[0].bitsPerPixel == 24) { - ErrorF("DRI unsupported at this depth/bpp, disabling.\n"); - return FALSE; - } - - atis->agpMode = 1; - atis->gartSize = 8; - atis->ringSize = 1; - atis->bufSize = 2; - atis->gartTexSize = 1; - atis->DMAusecTimeout = 10000; - - if (atic->drmFd < 0) - return FALSE; - - sv.drm_di_major = -1; - sv.drm_dd_major = -1; - drmSetInterfaceVersion(atic->drmFd, &sv); - if (atic->is_radeon) { - if (sv.drm_dd_major != 1 || sv.drm_dd_minor < 6) { - ErrorF("[dri] radeon kernel module version is %d.%d " - "but version 1.6 or greater is needed.\n", - sv.drm_dd_major, sv.drm_dd_minor); - return FALSE; - } - } else { - if (sv.drm_dd_major != 2 || sv.drm_dd_minor < 2) { - ErrorF("[dri] r128 kernel module version is %d.%d " - "but version 2.2 or greater is needed.\n", - sv.drm_dd_major, sv.drm_dd_minor); - return FALSE; - } - } - - /* Create the DRI data structure, and fill it in before calling the - * DRIScreenInit(). - */ - pDRIInfo = DRICreateInfoRec(); - if (pDRIInfo == NULL) - return FALSE; - - atis->pDRIInfo = pDRIInfo; - pDRIInfo->busIdString = atic->busid; - if (atic->is_radeon) { - pDRIInfo->drmDriverName = "radeon"; - if (atic->is_r100) - pDRIInfo->clientDriverName = "radeon"; - else - pDRIInfo->clientDriverName = "r200"; - } else { - pDRIInfo->drmDriverName = "r128"; - pDRIInfo->clientDriverName = "r128"; - } - pDRIInfo->ddxDriverMajorVersion = 4; - pDRIInfo->ddxDriverMinorVersion = 0; - pDRIInfo->ddxDriverPatchVersion = 0; - pDRIInfo->frameBufferPhysicalAddress = - pScreenPriv->card->attr.address[0] & 0xfc000000; - pDRIInfo->frameBufferSize = pScreenPriv->screen->memory_size; - pDRIInfo->frameBufferStride = pScreenPriv->screen->fb[0].byteStride; - pDRIInfo->ddxDrawableTableEntry = SAREA_MAX_DRAWABLES; - pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; - - /* For now the mapping works by using a fixed size defined - * in the SAREA header - */ - pDRIInfo->SAREASize = SAREA_MAX; - - if (atic->is_radeon) { - pDRIInfo->devPrivateSize = sizeof(RADEONDRIRec); - devSareaSize = sizeof(RADEONSAREAPriv); - } else { - pDRIInfo->devPrivateSize = sizeof(R128DRIRec); - devSareaSize = sizeof(R128SAREAPriv); - } - - if (sizeof(XF86DRISAREARec) + devSareaSize > SAREA_MAX) { - ErrorF("[dri] Data does not fit in SAREA. Disabling DRI.\n"); - return FALSE; - } - - pDRIInfo->devPrivate = xcalloc(pDRIInfo->devPrivateSize, 1); - if (pDRIInfo->devPrivate == NULL) { - DRIDestroyInfoRec(atis->pDRIInfo); - atis->pDRIInfo = NULL; - return FALSE; - } - - pDRIInfo->contextSize = sizeof(ATIDRIContextRec); - - pDRIInfo->SwapContext = ATIDRISwapContext; - /*pDRIInfo->InitBuffers = R128DRIInitBuffers;*/ /* XXX Appears unnecessary */ - /*pDRIInfo->MoveBuffers = R128DRIMoveBuffers;*/ /* XXX Badness */ - pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - /*pDRIInfo->TransitionTo2d = R128DRITransitionTo2d; - pDRIInfo->TransitionTo3d = R128DRITransitionTo3d; - pDRIInfo->TransitionSingleToMulti3D = R128DRITransitionSingleToMulti3d; - pDRIInfo->TransitionMultiToSingle3D = R128DRITransitionMultiToSingle3d;*/ - - pDRIInfo->createDummyCtx = TRUE; - pDRIInfo->createDummyCtxPriv = FALSE; - - if (!DRIScreenInit(pScreen, pDRIInfo, &atic->drmFd)) { - ErrorF("[dri] DRIScreenInit failed. Disabling DRI.\n"); - xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate = NULL; - DRIDestroyInfoRec(pDRIInfo); - pDRIInfo = NULL; - return FALSE; - } - - /* Add a map for the MMIO registers that will be accessed by any - * DRI-based clients. - */ - atis->registerSize = ATI_REG_SIZE(pScreenPriv->screen->card); - if (drmAddMap(atic->drmFd, ATI_REG_BASE(pScreenPriv->screen->card), - atis->registerSize, DRM_REGISTERS, DRM_READ_ONLY, - &atis->registerHandle) < 0) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - ErrorF("[drm] register handle = 0x%08lx\n", atis->registerHandle); - - /* DRIScreenInit adds the frame buffer map, but we need it as well */ - DRIGetDeviceInfo(pScreen, &atis->fbHandle, &scratch_int, &scratch_int, - &scratch_int, &scratch_int, &scratch_ptr); - - /* Initialize AGP */ - atis->using_agp = atic->is_agp; - if (atic->is_agp && !ATIDRIAgpInit(pScreen)) { - atis->using_agp = FALSE; - ErrorF("[agp] AGP failed to initialize; falling back to PCI mode.\n"); - ErrorF("[agp] Make sure your kernel's AGP support is loaded and functioning.\n"); - } - - /* Initialize PCIGART */ - if (!atis->using_agp && !ATIDRIPciInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - -#ifdef GLXEXT - if (!ATIInitVisualConfigs(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - ErrorF("[dri] Visual configs initialized\n"); -#endif - - atis->serverContext = DRIGetContext(pScreen); - - return ATIDRIFinishScreenInit(pScreen); -} - -/* Finish initializing the device-dependent DRI state, and call - DRIFinishScreenInit() to complete the device-independent DRI - initialization. */ -static Bool -R128DRIFinishScreenInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - R128SAREAPrivPtr pSAREAPriv; - R128DRIPtr pR128DRI; - int bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - - /* Initialize the kernel data structures */ - if (!R128DRIKernelInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - - /* Initialize the vertex buffers list */ - if (!ATIDRIBufInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - - /* Initialize IRQ */ - ATIDRIIrqInit(pScreen); - - pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScreen); - memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - - pR128DRI = (R128DRIPtr)atis->pDRIInfo->devPrivate; - - pR128DRI->deviceID = pScreenPriv->screen->card->attr.deviceID; - pR128DRI->width = pScreenPriv->screen->width; - pR128DRI->height = pScreenPriv->screen->height; - pR128DRI->depth = pScreenPriv->screen->fb[0].depth; - pR128DRI->bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - - pR128DRI->IsPCI = !atis->using_agp; - pR128DRI->AGPMode = atis->agpMode; - - pR128DRI->frontOffset = atis->frontOffset; - pR128DRI->frontPitch = atis->frontPitch / (bpp / 8); - pR128DRI->backOffset = atis->backOffset; - pR128DRI->backPitch = atis->backPitch / (bpp / 8); - pR128DRI->depthOffset = atis->depthOffset; - pR128DRI->depthPitch = atis->depthPitch / (bpp / 8); - pR128DRI->spanOffset = atis->spanOffset; - pR128DRI->textureOffset = atis->textureOffset; - pR128DRI->textureSize = atis->textureSize; - pR128DRI->log2TexGran = atis->log2TexGran; - - pR128DRI->registerHandle = atis->registerHandle; - pR128DRI->registerSize = atis->registerSize; - - pR128DRI->gartTexHandle = atis->gartTexHandle; - pR128DRI->gartTexMapSize = atis->gartTexMapSize; - pR128DRI->log2AGPTexGran = atis->log2GARTTexGran; - pR128DRI->gartTexOffset = atis->gartTexStart; - pR128DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); - - return TRUE; -} - -/* Finish initializing the device-dependent DRI state, and call - * DRIFinishScreenInit() to complete the device-independent DRI - * initialization. - */ -static Bool -RadeonDRIFinishScreenInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - RADEONSAREAPrivPtr pSAREAPriv; - RADEONDRIPtr pRADEONDRI; - drmRadeonMemInitHeap drmHeap; - - /* Initialize the kernel data structures */ - if (!RadeonDRIKernelInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - - /* Initialize the vertex buffers list */ - if (!ATIDRIBufInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - - /* Initialize IRQ */ - ATIDRIIrqInit(pScreen); - - drmHeap.region = RADEON_MEM_REGION_GART; - drmHeap.start = 0; - drmHeap.size = atis->gartTexMapSize; - - if (drmCommandWrite(atic->drmFd, DRM_RADEON_INIT_HEAP, &drmHeap, - sizeof(drmHeap))) { - ErrorF("[drm] Failed to initialize GART heap manager\n"); - } - - /* Initialize the SAREA private data structure */ - pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); - memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - - pRADEONDRI = (RADEONDRIPtr)atis->pDRIInfo->devPrivate; - - pRADEONDRI->deviceID = pScreenPriv->screen->card->attr.deviceID; - pRADEONDRI->width = pScreenPriv->screen->width; - pRADEONDRI->height = pScreenPriv->screen->height; - pRADEONDRI->depth = pScreenPriv->screen->fb[0].depth; - pRADEONDRI->bpp = pScreenPriv->screen->fb[0].bitsPerPixel; - - pRADEONDRI->IsPCI = !atis->using_agp; - pRADEONDRI->AGPMode = atis->agpMode; - - pRADEONDRI->frontOffset = atis->frontOffset; - pRADEONDRI->frontPitch = atis->frontPitch; - pRADEONDRI->backOffset = atis->backOffset; - pRADEONDRI->backPitch = atis->backPitch; - pRADEONDRI->depthOffset = atis->depthOffset; - pRADEONDRI->depthPitch = atis->depthPitch; - pRADEONDRI->textureOffset = atis->textureOffset; - pRADEONDRI->textureSize = atis->textureSize; - pRADEONDRI->log2TexGran = atis->log2TexGran; - - pRADEONDRI->registerHandle = atis->registerHandle; - pRADEONDRI->registerSize = atis->registerSize; - - pRADEONDRI->statusHandle = atis->ringReadPtrHandle; - pRADEONDRI->statusSize = atis->ringReadMapSize; - - pRADEONDRI->gartTexHandle = atis->gartTexHandle; - pRADEONDRI->gartTexMapSize = atis->gartTexMapSize; - pRADEONDRI->log2GARTTexGran = atis->log2GARTTexGran; - pRADEONDRI->gartTexOffset = atis->gartTexStart; - - pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); - - return TRUE; -} - -static Bool -ATIDRIFinishScreenInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo (pScreenPriv); - - atis->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; - - /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit - * because *DRIKernelInit requires that the hardware lock is held by - * the X server, and the first time the hardware lock is grabbed is - * in DRIFinishScreenInit. - */ - if (!DRIFinishScreenInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - - if (atic->is_radeon) { - if (!RadeonDRIFinishScreenInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - } else { - if (!R128DRIFinishScreenInit(pScreen)) { - ATIDRICloseScreen(pScreen); - return FALSE; - } - } - - return TRUE; -} - -/* The screen is being closed, so clean up any state and free any - resources used by the DRI. */ -void -ATIDRICloseScreen(ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - ATIScreenInfo (pScreenPriv); - ATICardInfo (pScreenPriv); - drmR128Init drmR128Info; - drmRadeonInit drmRadeonInfo; - - if (atis->indirectBuffer != NULL) { - /* Flush any remaining commands and free indirect buffers. - * Two steps are used because ATIFlushIndirect gets a - * new buffer after discarding. - */ - ATIFlushIndirect(atis, 1); - ATIDRIDispatchIndirect(atis, 1); - xfree(atis->indirectBuffer); - atis->indirectBuffer = NULL; - atis->indirectStart = 0; - } - ATIDRIDMAStop(atis); - - if (atis->irqEnabled) { - drmCtlUninstHandler(atic->drmFd); - atis->irqEnabled = FALSE; - } - - /* De-allocate vertex buffers */ - if (atis->buffers) { - drmUnmapBufs(atis->buffers); - atis->buffers = NULL; - } - - /* De-allocate all kernel resources */ - if (!atic->is_radeon) { - memset(&drmR128Info, 0, sizeof(drmR128Init)); - drmR128Info.func = DRM_R128_CLEANUP_CCE; - drmCommandWrite(atic->drmFd, DRM_R128_INIT, &drmR128Info, - sizeof(drmR128Init)); - } else { - memset(&drmRadeonInfo, 0, sizeof(drmRadeonInfo)); - drmRadeonInfo.func = DRM_RADEON_CLEANUP_CP; - drmCommandWrite(atic->drmFd, DRM_RADEON_CP_INIT, &drmRadeonInfo, - sizeof(drmR128Init)); - } - - /* De-allocate all AGP resources */ - if (atis->gartTex) { - drmUnmap(atis->gartTex, atis->gartTexMapSize); - atis->gartTex = NULL; - } - if (atis->buf) { - drmUnmap(atis->buf, atis->bufMapSize); - atis->buf = NULL; - } - if (atis->ringReadPtr) { - drmUnmap(atis->ringReadPtr, atis->ringReadMapSize); - atis->ringReadPtr = NULL; - } - if (atis->ring) { - drmUnmap(atis->ring, atis->ringMapSize); - atis->ring = NULL; - } - if (atis->agpMemHandle != DRM_AGP_NO_HANDLE) { - drmAgpUnbind(atic->drmFd, atis->agpMemHandle); - drmAgpFree(atic->drmFd, atis->agpMemHandle); - atis->agpMemHandle = DRM_AGP_NO_HANDLE; - drmAgpRelease(atic->drmFd); - } - if (atis->pciMemHandle) { - drmScatterGatherFree(atic->drmFd, atis->pciMemHandle); - atis->pciMemHandle = 0; - } - - /* De-allocate all DRI resources */ - DRICloseScreen(pScreen); - - /* De-allocate all DRI data structures */ - if (atis->pDRIInfo) { - if (atis->pDRIInfo->devPrivate) { - xfree(atis->pDRIInfo->devPrivate); - atis->pDRIInfo->devPrivate = NULL; - } - DRIDestroyInfoRec(atis->pDRIInfo); - atis->pDRIInfo = NULL; - } - -#ifdef GLXEXT - if (atis->pVisualConfigs) { - xfree(atis->pVisualConfigs); - atis->pVisualConfigs = NULL; - } - if (atis->pVisualConfigsPriv) { - xfree(atis->pVisualConfigsPriv); - atis->pVisualConfigsPriv = NULL; - } -#endif /* GLXEXT */ - atic->drmFd = -1; -} - -void -ATIDRIDMAStart(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - int ret; - - if (atic->is_radeon) - ret = drmCommandNone(atic->drmFd, DRM_RADEON_CP_START); - else - ret = drmCommandNone(atic->drmFd, DRM_R128_CCE_START); - - if (ret == 0) - atis->dma_started = TRUE; - else - FatalError("%s: DMA start returned %d\n", __FUNCTION__, ret); -} - -/* Attempts to idle the DMA engine and stops it. Note that the ioctl is the - * same for both R128 and Radeon, so we can just use the name of one of them. - */ -void -ATIDRIDMAStop(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - drmRadeonCPStop stop; - int ret; - - stop.flush = 1; - stop.idle = 1; - ret = drmCommandWrite(atic->drmFd, DRM_RADEON_CP_STOP, &stop, - sizeof(drmRadeonCPStop)); - - if (ret != 0 && errno == EBUSY) { - ErrorF("Failed to idle the DMA engine\n"); - - stop.idle = 0; - ret = drmCommandWrite(atic->drmFd, DRM_RADEON_CP_STOP, &stop, - sizeof(drmRadeonCPStop)); - } - atis->dma_started = FALSE; -} - -void -ATIDRIDMAReset(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - int ret; - - ret = drmCommandNone(atic->drmFd, atic->is_radeon ? - DRM_RADEON_CP_RESET : DRM_R128_CCE_RESET); - - if (ret != 0) - FatalError("Failed to reset CCE/CP\n"); - - atis->dma_started = FALSE; -} - -/* The R128 and Radeon Indirect ioctls differ only in the ioctl number */ -void -ATIDRIDispatchIndirect(ATIScreenInfo *atis, Bool discard) -{ - ATICardInfo *atic = atis->atic; - drmBufPtr buffer = atis->indirectBuffer->drmBuf; - drmR128Indirect indirect; - int cmd; - - indirect.idx = buffer->idx; - indirect.start = atis->indirectStart; - indirect.end = buffer->used; - indirect.discard = discard; - cmd = atic->is_radeon ? DRM_RADEON_INDIRECT : DRM_R128_INDIRECT; - drmCommandWriteRead(atic->drmFd, cmd, &indirect, - sizeof(drmR128Indirect)); -} - -/* Get an indirect buffer for the DMA 2D acceleration commands */ -drmBufPtr -ATIDRIGetBuffer(ATIScreenInfo *atis) -{ - ATICardInfo *atic = atis->atic; - drmDMAReq dma; - drmBufPtr buf = NULL; - int indx = 0, size = 0, ret = 0; - TIMEOUT_LOCALS; - - dma.context = atis->serverContext; - dma.send_count = 0; - dma.send_list = NULL; - dma.send_sizes = NULL; - dma.flags = 0; - dma.request_count = 1; - if (atic->is_radeon) - dma.request_size = RADEON_BUFFER_SIZE; - else - dma.request_size = R128_BUFFER_SIZE; - dma.request_list = &indx; - dma.request_sizes = &size; - dma.granted_count = 0; - - WHILE_NOT_TIMEOUT(.2) { - ret = drmDMA(atic->drmFd, &dma); - if (ret != -EBUSY) - break; - } - if (TIMEDOUT()) - FatalError("Timeout fetching DMA buffer (card hung)\n"); - if (ret != 0) - FatalError("Error fetching DMA buffer: %d\n", ret); - - buf = &atis->buffers->list[indx]; - buf->used = 0; - return buf; -} diff --git a/hw/kdrive/ati/ati_dri.h b/hw/kdrive/ati/ati_dri.h deleted file mode 100644 index 985f7eb43..000000000 --- a/hw/kdrive/ati/ati_dri.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 _ATI_DRI_H_ -#define _ATI_DRI_H_ - -typedef struct { - /* DRI screen private data */ - int deviceID; /* PCI device ID */ - int width; /* Width in pixels of display */ - int height; /* Height in scanlines of display */ - int depth; /* Depth of display (8, 15, 16, 24) */ - int bpp; /* Bit depth of display (8, 16, 24, 32) */ - - int IsPCI; /* Current card is a PCI card */ - int AGPMode; - - int frontOffset; /* Start of front buffer */ - int frontPitch; - int backOffset; /* Start of shared back buffer */ - int backPitch; - int depthOffset; /* Start of shared depth buffer */ - int depthPitch; - int spanOffset; /* Start of scratch spanline */ - int textureOffset; /* Start of texture data in frame buffer */ - int textureSize; - int log2TexGran; - - /* MMIO register data */ - drmHandle registerHandle; - drmSize registerSize; - - /* CCE AGP Texture data */ - drmHandle gartTexHandle; - drmSize gartTexMapSize; - int log2AGPTexGran; - int gartTexOffset; - unsigned int sarea_priv_offset; -} R128DRIRec, *R128DRIPtr; - -typedef struct { - /* DRI screen private data */ - int deviceID; /* PCI device ID */ - int width; /* Width in pixels of display */ - int height; /* Height in scanlines of display */ - int depth; /* Depth of display (8, 15, 16, 24) */ - int bpp; /* Bit depth of display (8, 16, 24, 32) */ - - int IsPCI; /* Current card is a PCI card */ - int AGPMode; - - int frontOffset; /* Start of front buffer */ - int frontPitch; - int backOffset; /* Start of shared back buffer */ - int backPitch; - int depthOffset; /* Start of shared depth buffer */ - int depthPitch; - int textureOffset; /* Start of texture data in frame buffer */ - int textureSize; - int log2TexGran; - - /* MMIO register data */ - drmHandle registerHandle; - drmSize registerSize; - - /* CP in-memory status information */ - drmHandle statusHandle; - drmSize statusSize; - - /* CP GART Texture data */ - drmHandle gartTexHandle; - drmSize gartTexMapSize; - int log2GARTTexGran; - int gartTexOffset; - unsigned int sarea_priv_offset; -} RADEONDRIRec, *RADEONDRIPtr; - -#endif /* _ATI_DRI_H_ */ diff --git a/hw/kdrive/ati/ati_dripriv.h b/hw/kdrive/ati/ati_dripriv.h deleted file mode 100644 index f0e139383..000000000 --- a/hw/kdrive/ati/ati_dripriv.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, - * Precision Insight, Inc., Cedar Park, Texas, and - * VA Linux Systems Inc., Fremont, California. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX - * SYSTEMS AND/OR THEIR SUPPLIERS 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. - */ - -/* - * Authors: - * Rickard E. Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * - */ - -#ifndef _ATI_DRIPRIV_H_ -#define _ATI_DRIPRIV_H_ - -#ifdef GLXEXT -#include "GL/glxint.h" - -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **configprivs); -#endif - -typedef struct { - /* Nothing here yet */ - int dummy; -} ATIConfigPrivRec, *ATIConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} ATIDRIContextRec, *ATIDRIContextPtr; - -#endif diff --git a/hw/kdrive/ati/ati_microcode.c b/hw/kdrive/ati/ati_microcode.c deleted file mode 100644 index f8829e823..000000000 --- a/hw/kdrive/ati/ati_microcode.c +++ /dev/null @@ -1,857 +0,0 @@ -/* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- - * radeon_cp.c -- CP support for Radeon -*- linux-c -*- - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * 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 (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 - * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - * - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - */ - -/* CCE microcode (from ATI) */ - -#include "ati.h" - -CARD32 r128_cce_microcode[] = { - 0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, - 1617039951, 0, 774592877, 0, 1987540286, 0, 2307490946U, 0, - 599558925, 0, 589505315, 0, 596487092, 0, 589505315, 1, - 11544576, 1, 206848, 1, 311296, 1, 198656, 2, 912273422, 11, - 262144, 0, 0, 1, 33559837, 1, 7438, 1, 14809, 1, 6615, 12, 28, - 1, 6614, 12, 28, 2, 23, 11, 18874368, 0, 16790922, 1, 409600, 9, - 30, 1, 147854772, 16, 420483072, 3, 8192, 0, 10240, 1, 198656, - 1, 15630, 1, 51200, 10, 34858, 9, 42, 1, 33559823, 2, 10276, 1, - 15717, 1, 15718, 2, 43, 1, 15936948, 1, 570480831, 1, 14715071, - 12, 322123831, 1, 33953125, 12, 55, 1, 33559908, 1, 15718, 2, - 46, 4, 2099258, 1, 526336, 1, 442623, 4, 4194365, 1, 509952, 1, - 459007, 3, 0, 12, 92, 2, 46, 12, 176, 1, 15734, 1, 206848, 1, - 18432, 1, 133120, 1, 100670734, 1, 149504, 1, 165888, 1, - 15975928, 1, 1048576, 6, 3145806, 1, 15715, 16, 2150645232U, 2, - 268449859, 2, 10307, 12, 176, 1, 15734, 1, 15735, 1, 15630, 1, - 15631, 1, 5253120, 6, 3145810, 16, 2150645232U, 1, 15864, 2, 82, - 1, 343310, 1, 1064207, 2, 3145813, 1, 15728, 1, 7817, 1, 15729, - 3, 15730, 12, 92, 2, 98, 1, 16168, 1, 16167, 1, 16002, 1, 16008, - 1, 15974, 1, 15975, 1, 15990, 1, 15976, 1, 15977, 1, 15980, 0, - 15981, 1, 10240, 1, 5253120, 1, 15720, 1, 198656, 6, 110, 1, - 180224, 1, 103824738, 2, 112, 2, 3145839, 0, 536885440, 1, - 114880, 14, 125, 12, 206975, 1, 33559995, 12, 198784, 0, - 33570236, 1, 15803, 0, 15804, 3, 294912, 1, 294912, 3, 442370, - 1, 11544576, 0, 811612160, 1, 12593152, 1, 11536384, 1, - 14024704, 7, 310382726, 0, 10240, 1, 14796, 1, 14797, 1, 14793, - 1, 14794, 0, 14795, 1, 268679168, 1, 9437184, 1, 268449792, 1, - 198656, 1, 9452827, 1, 1075854602, 1, 1075854603, 1, 557056, 1, - 114880, 14, 159, 12, 198784, 1, 1109409213, 12, 198783, 1, - 1107312059, 12, 198784, 1, 1109409212, 2, 162, 1, 1075854781, 1, - 1073757627, 1, 1075854780, 1, 540672, 1, 10485760, 6, 3145894, - 16, 274741248, 9, 168, 3, 4194304, 3, 4209949, 0, 0, 0, 256, 14, - 174, 1, 114857, 1, 33560007, 12, 176, 0, 10240, 1, 114858, 1, - 33560018, 1, 114857, 3, 33560007, 1, 16008, 1, 114874, 1, - 33560360, 1, 114875, 1, 33560154, 0, 15963, 0, 256, 0, 4096, 1, - 409611, 9, 188, 0, 10240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -CARD32 radeon_cp_microcode[][2] = { - { 0x21007000, 0000000000 }, - { 0x20007000, 0000000000 }, - { 0x000000b4, 0x00000004 }, - { 0x000000b8, 0x00000004 }, - { 0x6f5b4d4c, 0000000000 }, - { 0x4c4c427f, 0000000000 }, - { 0x5b568a92, 0000000000 }, - { 0x4ca09c6d, 0000000000 }, - { 0xad4c4c4c, 0000000000 }, - { 0x4ce1af3d, 0000000000 }, - { 0xd8afafaf, 0000000000 }, - { 0xd64c4cdc, 0000000000 }, - { 0x4cd10d10, 0000000000 }, - { 0x000f0000, 0x00000016 }, - { 0x362f242d, 0000000000 }, - { 0x00000012, 0x00000004 }, - { 0x000f0000, 0x00000016 }, - { 0x362f282d, 0000000000 }, - { 0x000380e7, 0x00000002 }, - { 0x04002c97, 0x00000002 }, - { 0x000f0001, 0x00000016 }, - { 0x333a3730, 0000000000 }, - { 0x000077ef, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000021, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00000017, 0x00000004 }, - { 0x0003802b, 0x00000002 }, - { 0x040067e0, 0x00000002 }, - { 0x00000017, 0x00000004 }, - { 0x000077e0, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x000037e1, 0x00000002 }, - { 0x040067e1, 0x00000006 }, - { 0x000077e0, 0x00000002 }, - { 0x000077e1, 0x00000002 }, - { 0x000077e1, 0x00000006 }, - { 0xffffffff, 0000000000 }, - { 0x10000000, 0000000000 }, - { 0x0003802b, 0x00000002 }, - { 0x040067e0, 0x00000006 }, - { 0x00007675, 0x00000002 }, - { 0x00007676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0003802c, 0x00000002 }, - { 0x04002676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0000002f, 0x00000018 }, - { 0x0000002f, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x00000030, 0x00000018 }, - { 0x00000030, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x01605000, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00098000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x64c0603e, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00080000, 0x00000016 }, - { 0000000000, 0000000000 }, - { 0x0400251d, 0x00000002 }, - { 0x00007580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x04002580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x00000049, 0x00000004 }, - { 0x00005000, 0000000000 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x00019000, 0x00000002 }, - { 0x00011055, 0x00000014 }, - { 0x00000055, 0x00000012 }, - { 0x0400250f, 0x00000002 }, - { 0x0000504f, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007565, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x00000058, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x01e655b4, 0x00000002 }, - { 0x4401b0e4, 0x00000002 }, - { 0x01c110e4, 0x00000002 }, - { 0x26667066, 0x00000018 }, - { 0x040c2565, 0x00000002 }, - { 0x00000066, 0x00000018 }, - { 0x04002564, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x0000005d, 0x00000004 }, - { 0x00401069, 0x00000008 }, - { 0x00101000, 0x00000002 }, - { 0x000d80ff, 0x00000002 }, - { 0x0080006c, 0x00000008 }, - { 0x000f9000, 0x00000002 }, - { 0x000e00ff, 0x00000002 }, - { 0000000000, 0x00000006 }, - { 0x0000008f, 0x00000018 }, - { 0x0000005b, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007576, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00009000, 0x00000002 }, - { 0x00041000, 0x00000002 }, - { 0x0c00350e, 0x00000002 }, - { 0x00049000, 0x00000002 }, - { 0x00051000, 0x00000002 }, - { 0x01e785f8, 0x00000002 }, - { 0x00200000, 0x00000002 }, - { 0x0060007e, 0x0000000c }, - { 0x00007563, 0x00000002 }, - { 0x006075f0, 0x00000021 }, - { 0x20007073, 0x00000004 }, - { 0x00005073, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00007576, 0x00000002 }, - { 0x00007577, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x0000750f, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00600083, 0x0000000c }, - { 0x006075f0, 0x00000021 }, - { 0x000075f8, 0x00000002 }, - { 0x00000083, 0x00000004 }, - { 0x000a750e, 0x00000002 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x0020750f, 0x00000002 }, - { 0x00600086, 0x00000004 }, - { 0x00007570, 0x00000002 }, - { 0x00007571, 0x00000002 }, - { 0x00007572, 0x00000006 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00005000, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00007568, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000095, 0x0000000c }, - { 0x00058000, 0x00000002 }, - { 0x0c607562, 0x00000002 }, - { 0x00000097, 0x00000004 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x00600096, 0x00000004 }, - { 0x400070e5, 0000000000 }, - { 0x000380e6, 0x00000002 }, - { 0x040025c5, 0x00000002 }, - { 0x000380e5, 0x00000002 }, - { 0x000000a8, 0x0000001c }, - { 0x000650aa, 0x00000018 }, - { 0x040025bb, 0x00000002 }, - { 0x000610ab, 0x00000018 }, - { 0x040075bc, 0000000000 }, - { 0x000075bb, 0x00000002 }, - { 0x000075bc, 0000000000 }, - { 0x00090000, 0x00000006 }, - { 0x00090000, 0x00000002 }, - { 0x000d8002, 0x00000006 }, - { 0x00007832, 0x00000002 }, - { 0x00005000, 0x00000002 }, - { 0x000380e7, 0x00000002 }, - { 0x04002c97, 0x00000002 }, - { 0x00007820, 0x00000002 }, - { 0x00007821, 0x00000002 }, - { 0x00007800, 0000000000 }, - { 0x01200000, 0x00000002 }, - { 0x20077000, 0x00000002 }, - { 0x01200000, 0x00000002 }, - { 0x20007000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x0120751b, 0x00000002 }, - { 0x8040750a, 0x00000002 }, - { 0x8040750b, 0x00000002 }, - { 0x00110000, 0x00000002 }, - { 0x000380e5, 0x00000002 }, - { 0x000000c6, 0x0000001c }, - { 0x000610ab, 0x00000018 }, - { 0x844075bd, 0x00000002 }, - { 0x000610aa, 0x00000018 }, - { 0x840075bb, 0x00000002 }, - { 0x000610ab, 0x00000018 }, - { 0x844075bc, 0x00000002 }, - { 0x000000c9, 0x00000004 }, - { 0x804075bd, 0x00000002 }, - { 0x800075bb, 0x00000002 }, - { 0x804075bc, 0x00000002 }, - { 0x00108000, 0x00000002 }, - { 0x01400000, 0x00000002 }, - { 0x006000cd, 0x0000000c }, - { 0x20c07000, 0x00000020 }, - { 0x000000cf, 0x00000012 }, - { 0x00800000, 0x00000006 }, - { 0x0080751d, 0x00000006 }, - { 0000000000, 0000000000 }, - { 0x0000775c, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00661000, 0x00000002 }, - { 0x0460275d, 0x00000020 }, - { 0x00004000, 0000000000 }, - { 0x01e00830, 0x00000002 }, - { 0x21007000, 0000000000 }, - { 0x6464614d, 0000000000 }, - { 0x69687420, 0000000000 }, - { 0x00000073, 0000000000 }, - { 0000000000, 0000000000 }, - { 0x00005000, 0x00000002 }, - { 0x000380d0, 0x00000002 }, - { 0x040025e0, 0x00000002 }, - { 0x000075e1, 0000000000 }, - { 0x00000001, 0000000000 }, - { 0x000380e0, 0x00000002 }, - { 0x04002394, 0x00000002 }, - { 0x00005000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0x00000008, 0000000000 }, - { 0x00000004, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, -}; - -CARD32 r200_cp_microcode[][2] = { - { 0x21007000, 0000000000 }, - { 0x20007000, 0000000000 }, - { 0x000000ab, 0x00000004 }, - { 0x000000af, 0x00000004 }, - { 0x66544a49, 0000000000 }, - { 0x49494174, 0000000000 }, - { 0x54517d83, 0000000000 }, - { 0x498d8b64, 0000000000 }, - { 0x49494949, 0000000000 }, - { 0x49da493c, 0000000000 }, - { 0x49989898, 0000000000 }, - { 0xd34949d5, 0000000000 }, - { 0x9dc90e11, 0000000000 }, - { 0xce9b9b9b, 0000000000 }, - { 0x000f0000, 0x00000016 }, - { 0x352e232c, 0000000000 }, - { 0x00000013, 0x00000004 }, - { 0x000f0000, 0x00000016 }, - { 0x352e272c, 0000000000 }, - { 0x000f0001, 0x00000016 }, - { 0x3239362f, 0000000000 }, - { 0x000077ef, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000020, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000020, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00061000, 0x00000002 }, - { 0x00000020, 0x0000001a }, - { 0x00004000, 0x0000001e }, - { 0x00000016, 0x00000004 }, - { 0x0003802a, 0x00000002 }, - { 0x040067e0, 0x00000002 }, - { 0x00000016, 0x00000004 }, - { 0x000077e0, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x000037e1, 0x00000002 }, - { 0x040067e1, 0x00000006 }, - { 0x000077e0, 0x00000002 }, - { 0x000077e1, 0x00000002 }, - { 0x000077e1, 0x00000006 }, - { 0xffffffff, 0000000000 }, - { 0x10000000, 0000000000 }, - { 0x0003802a, 0x00000002 }, - { 0x040067e0, 0x00000006 }, - { 0x00007675, 0x00000002 }, - { 0x00007676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0003802b, 0x00000002 }, - { 0x04002676, 0x00000002 }, - { 0x00007677, 0x00000002 }, - { 0x00007678, 0x00000006 }, - { 0x0000002e, 0x00000018 }, - { 0x0000002e, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x0000002f, 0x00000018 }, - { 0x0000002f, 0x00000018 }, - { 0000000000, 0x00000006 }, - { 0x01605000, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00098000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x64c0603d, 0x00000004 }, - { 0x00080000, 0x00000016 }, - { 0000000000, 0000000000 }, - { 0x0400251d, 0x00000002 }, - { 0x00007580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x04002580, 0x00000002 }, - { 0x00067581, 0x00000002 }, - { 0x00000046, 0x00000004 }, - { 0x00005000, 0000000000 }, - { 0x00061000, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x00019000, 0x00000002 }, - { 0x00011055, 0x00000014 }, - { 0x00000055, 0x00000012 }, - { 0x0400250f, 0x00000002 }, - { 0x0000504a, 0x00000004 }, - { 0x00007565, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x00000051, 0x00000004 }, - { 0x01e655b4, 0x00000002 }, - { 0x4401b0dc, 0x00000002 }, - { 0x01c110dc, 0x00000002 }, - { 0x2666705d, 0x00000018 }, - { 0x040c2565, 0x00000002 }, - { 0x0000005d, 0x00000018 }, - { 0x04002564, 0x00000002 }, - { 0x00007566, 0x00000002 }, - { 0x00000054, 0x00000004 }, - { 0x00401060, 0x00000008 }, - { 0x00101000, 0x00000002 }, - { 0x000d80ff, 0x00000002 }, - { 0x00800063, 0x00000008 }, - { 0x000f9000, 0x00000002 }, - { 0x000e00ff, 0x00000002 }, - { 0000000000, 0x00000006 }, - { 0x00000080, 0x00000018 }, - { 0x00000054, 0x00000004 }, - { 0x00007576, 0x00000002 }, - { 0x00065000, 0x00000002 }, - { 0x00009000, 0x00000002 }, - { 0x00041000, 0x00000002 }, - { 0x0c00350e, 0x00000002 }, - { 0x00049000, 0x00000002 }, - { 0x00051000, 0x00000002 }, - { 0x01e785f8, 0x00000002 }, - { 0x00200000, 0x00000002 }, - { 0x00600073, 0x0000000c }, - { 0x00007563, 0x00000002 }, - { 0x006075f0, 0x00000021 }, - { 0x20007068, 0x00000004 }, - { 0x00005068, 0x00000004 }, - { 0x00007576, 0x00000002 }, - { 0x00007577, 0x00000002 }, - { 0x0000750e, 0x00000002 }, - { 0x0000750f, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00600076, 0x0000000c }, - { 0x006075f0, 0x00000021 }, - { 0x000075f8, 0x00000002 }, - { 0x00000076, 0x00000004 }, - { 0x000a750e, 0x00000002 }, - { 0x0020750f, 0x00000002 }, - { 0x00600079, 0x00000004 }, - { 0x00007570, 0x00000002 }, - { 0x00007571, 0x00000002 }, - { 0x00007572, 0x00000006 }, - { 0x00005000, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00007568, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x00000084, 0x0000000c }, - { 0x00058000, 0x00000002 }, - { 0x0c607562, 0x00000002 }, - { 0x00000086, 0x00000004 }, - { 0x00600085, 0x00000004 }, - { 0x400070dd, 0000000000 }, - { 0x000380dd, 0x00000002 }, - { 0x00000093, 0x0000001c }, - { 0x00065095, 0x00000018 }, - { 0x040025bb, 0x00000002 }, - { 0x00061096, 0x00000018 }, - { 0x040075bc, 0000000000 }, - { 0x000075bb, 0x00000002 }, - { 0x000075bc, 0000000000 }, - { 0x00090000, 0x00000006 }, - { 0x00090000, 0x00000002 }, - { 0x000d8002, 0x00000006 }, - { 0x00005000, 0x00000002 }, - { 0x00007821, 0x00000002 }, - { 0x00007800, 0000000000 }, - { 0x00007821, 0x00000002 }, - { 0x00007800, 0000000000 }, - { 0x01665000, 0x00000002 }, - { 0x000a0000, 0x00000002 }, - { 0x000671cc, 0x00000002 }, - { 0x0286f1cd, 0x00000002 }, - { 0x000000a3, 0x00000010 }, - { 0x21007000, 0000000000 }, - { 0x000000aa, 0x0000001c }, - { 0x00065000, 0x00000002 }, - { 0x000a0000, 0x00000002 }, - { 0x00061000, 0x00000002 }, - { 0x000b0000, 0x00000002 }, - { 0x38067000, 0x00000002 }, - { 0x000a00a6, 0x00000004 }, - { 0x20007000, 0000000000 }, - { 0x01200000, 0x00000002 }, - { 0x20077000, 0x00000002 }, - { 0x01200000, 0x00000002 }, - { 0x20007000, 0000000000 }, - { 0x00061000, 0x00000002 }, - { 0x0120751b, 0x00000002 }, - { 0x8040750a, 0x00000002 }, - { 0x8040750b, 0x00000002 }, - { 0x00110000, 0x00000002 }, - { 0x000380dd, 0x00000002 }, - { 0x000000bd, 0x0000001c }, - { 0x00061096, 0x00000018 }, - { 0x844075bd, 0x00000002 }, - { 0x00061095, 0x00000018 }, - { 0x840075bb, 0x00000002 }, - { 0x00061096, 0x00000018 }, - { 0x844075bc, 0x00000002 }, - { 0x000000c0, 0x00000004 }, - { 0x804075bd, 0x00000002 }, - { 0x800075bb, 0x00000002 }, - { 0x804075bc, 0x00000002 }, - { 0x00108000, 0x00000002 }, - { 0x01400000, 0x00000002 }, - { 0x006000c4, 0x0000000c }, - { 0x20c07000, 0x00000020 }, - { 0x000000c6, 0x00000012 }, - { 0x00800000, 0x00000006 }, - { 0x0080751d, 0x00000006 }, - { 0x000025bb, 0x00000002 }, - { 0x000040c0, 0x00000004 }, - { 0x0000775c, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00661000, 0x00000002 }, - { 0x0460275d, 0x00000020 }, - { 0x00004000, 0000000000 }, - { 0x00007999, 0x00000002 }, - { 0x00a05000, 0x00000002 }, - { 0x00661000, 0x00000002 }, - { 0x0460299b, 0x00000020 }, - { 0x00004000, 0000000000 }, - { 0x01e00830, 0x00000002 }, - { 0x21007000, 0000000000 }, - { 0x00005000, 0x00000002 }, - { 0x00038042, 0x00000002 }, - { 0x040025e0, 0x00000002 }, - { 0x000075e1, 0000000000 }, - { 0x00000001, 0000000000 }, - { 0x000380d9, 0x00000002 }, - { 0x04007394, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, -}; - -/* Microcode from http://volodya-project.sourceforge.net/ */ - -CARD32 r300_cp_microcode[][2] = { - { 0x4200e000, 0000000000 }, - { 0x4000e000, 0000000000 }, - { 0x000000af, 0x00000008 }, - { 0x000000b3, 0x00000008 }, - { 0x6c5a504f, 0000000000 }, - { 0x4f4f497a, 0000000000 }, - { 0x5a578288, 0000000000 }, - { 0x4f91906a, 0000000000 }, - { 0x4f4f4f4f, 0000000000 }, - { 0x4fe24f44, 0000000000 }, - { 0x4f9c9c9c, 0000000000 }, - { 0xdc4f4fde, 0000000000 }, - { 0xa1cd4f4f, 0000000000 }, - { 0xd29d9d9d, 0000000000 }, - { 0x4f0f9fd7, 0000000000 }, - { 0x000ca000, 0x00000004 }, - { 0x000d0012, 0x00000038 }, - { 0x0000e8b4, 0x00000004 }, - { 0x000d0014, 0x00000038 }, - { 0x0000e8b6, 0x00000004 }, - { 0x000d0016, 0x00000038 }, - { 0x0000e854, 0x00000004 }, - { 0x000d0018, 0x00000038 }, - { 0x0000e855, 0x00000004 }, - { 0x000d001a, 0x00000038 }, - { 0x0000e856, 0x00000004 }, - { 0x000d001c, 0x00000038 }, - { 0x0000e857, 0x00000004 }, - { 0x000d001e, 0x00000038 }, - { 0x0000e824, 0x00000004 }, - { 0x000d0020, 0x00000038 }, - { 0x0000e825, 0x00000004 }, - { 0x000d0022, 0x00000038 }, - { 0x0000e830, 0x00000004 }, - { 0x000d0024, 0x00000038 }, - { 0x0000f0c0, 0x00000004 }, - { 0x000d0026, 0x00000038 }, - { 0x0000f0c1, 0x00000004 }, - { 0x000d0028, 0x00000038 }, - { 0x0000f041, 0x00000004 }, - { 0x000d002a, 0x00000038 }, - { 0x0000f184, 0x00000004 }, - { 0x000d002c, 0x00000038 }, - { 0x0000f185, 0x00000004 }, - { 0x000d002e, 0x00000038 }, - { 0x0000f186, 0x00000004 }, - { 0x000d0030, 0x00000038 }, - { 0x0000f187, 0x00000004 }, - { 0x000d0032, 0x00000038 }, - { 0x0000f180, 0x00000004 }, - { 0x000d0034, 0x00000038 }, - { 0x0000f393, 0x00000004 }, - { 0x000d0036, 0x00000038 }, - { 0x0000f38a, 0x00000004 }, - { 0x000d0038, 0x00000038 }, - { 0x0000f38e, 0x00000004 }, - { 0x0000e821, 0x00000004 }, - { 0x0140a000, 0x00000004 }, - { 0x00000043, 0x00000018 }, - { 0x00cce800, 0x00000004 }, - { 0x001b0001, 0x00000004 }, - { 0x08004800, 0x00000004 }, - { 0x001b0001, 0x00000004 }, - { 0x08004800, 0x00000004 }, - { 0x001b0001, 0x00000004 }, - { 0x08004800, 0x00000004 }, - { 0x0000003a, 0x00000008 }, - { 0x0000a000, 0000000000 }, - { 0x02c0a000, 0x00000004 }, - { 0x000ca000, 0x00000004 }, - { 0x00130000, 0x00000004 }, - { 0x000c2000, 0x00000004 }, - { 0xc980c045, 0x00000008 }, - { 0x2000451d, 0x00000004 }, - { 0x0000e580, 0x00000004 }, - { 0x000ce581, 0x00000004 }, - { 0x08004580, 0x00000004 }, - { 0x000ce581, 0x00000004 }, - { 0x0000004c, 0x00000008 }, - { 0x0000a000, 0000000000 }, - { 0x000c2000, 0x00000004 }, - { 0x0000e50e, 0x00000004 }, - { 0x00032000, 0x00000004 }, - { 0x00022056, 0x00000028 }, - { 0x00000056, 0x00000024 }, - { 0x0800450f, 0x00000004 }, - { 0x0000a050, 0x00000008 }, - { 0x0000e565, 0x00000004 }, - { 0x0000e566, 0x00000004 }, - { 0x00000057, 0x00000008 }, - { 0x03cca5b4, 0x00000004 }, - { 0x05432000, 0x00000004 }, - { 0x00022000, 0x00000004 }, - { 0x4ccce063, 0x00000030 }, - { 0x08274565, 0x00000004 }, - { 0x00000063, 0x00000030 }, - { 0x08004564, 0x00000004 }, - { 0x0000e566, 0x00000004 }, - { 0x0000005a, 0x00000008 }, - { 0x00802066, 0x00000010 }, - { 0x00202000, 0x00000004 }, - { 0x001b00ff, 0x00000004 }, - { 0x01000069, 0x00000010 }, - { 0x001f2000, 0x00000004 }, - { 0x001c00ff, 0x00000004 }, - { 0000000000, 0x0000000c }, - { 0x00000085, 0x00000030 }, - { 0x0000005a, 0x00000008 }, - { 0x0000e576, 0x00000004 }, - { 0x000ca000, 0x00000004 }, - { 0x00012000, 0x00000004 }, - { 0x00082000, 0x00000004 }, - { 0x1800650e, 0x00000004 }, - { 0x00092000, 0x00000004 }, - { 0x000a2000, 0x00000004 }, - { 0x000f0000, 0x00000004 }, - { 0x00400000, 0x00000004 }, - { 0x00000079, 0x00000018 }, - { 0x0000e563, 0x00000004 }, - { 0x00c0e5f9, 0x000000c2 }, - { 0x0000006e, 0x00000008 }, - { 0x0000a06e, 0x00000008 }, - { 0x0000e576, 0x00000004 }, - { 0x0000e577, 0x00000004 }, - { 0x0000e50e, 0x00000004 }, - { 0x0000e50f, 0x00000004 }, - { 0x0140a000, 0x00000004 }, - { 0x0000007c, 0x00000018 }, - { 0x00c0e5f9, 0x000000c2 }, - { 0x0000007c, 0x00000008 }, - { 0x0014e50e, 0x00000004 }, - { 0x0040e50f, 0x00000004 }, - { 0x00c0007f, 0x00000008 }, - { 0x0000e570, 0x00000004 }, - { 0x0000e571, 0x00000004 }, - { 0x0000e572, 0x0000000c }, - { 0x0000a000, 0x00000004 }, - { 0x0140a000, 0x00000004 }, - { 0x0000e568, 0x00000004 }, - { 0x000c2000, 0x00000004 }, - { 0x00000089, 0x00000018 }, - { 0x000b0000, 0x00000004 }, - { 0x18c0e562, 0x00000004 }, - { 0x0000008b, 0x00000008 }, - { 0x00c0008a, 0x00000008 }, - { 0x000700e4, 0x00000004 }, - { 0x00000097, 0x00000038 }, - { 0x000ca099, 0x00000030 }, - { 0x080045bb, 0x00000004 }, - { 0x000c209a, 0x00000030 }, - { 0x0800e5bc, 0000000000 }, - { 0x0000e5bb, 0x00000004 }, - { 0x0000e5bc, 0000000000 }, - { 0x00120000, 0x0000000c }, - { 0x00120000, 0x00000004 }, - { 0x001b0002, 0x0000000c }, - { 0x0000a000, 0x00000004 }, - { 0x0000e821, 0x00000004 }, - { 0x0000e800, 0000000000 }, - { 0x0000e821, 0x00000004 }, - { 0x0000e82e, 0000000000 }, - { 0x02cca000, 0x00000004 }, - { 0x00140000, 0x00000004 }, - { 0x000ce1cc, 0x00000004 }, - { 0x050de1cd, 0x00000004 }, - { 0x000000a7, 0x00000020 }, - { 0x4200e000, 0000000000 }, - { 0x000000ae, 0x00000038 }, - { 0x000ca000, 0x00000004 }, - { 0x00140000, 0x00000004 }, - { 0x000c2000, 0x00000004 }, - { 0x00160000, 0x00000004 }, - { 0x700ce000, 0x00000004 }, - { 0x001400aa, 0x00000008 }, - { 0x4000e000, 0000000000 }, - { 0x02400000, 0x00000004 }, - { 0x400ee000, 0x00000004 }, - { 0x02400000, 0x00000004 }, - { 0x4000e000, 0000000000 }, - { 0x000c2000, 0x00000004 }, - { 0x0240e51b, 0x00000004 }, - { 0x0080e50a, 0x00000005 }, - { 0x0080e50b, 0x00000005 }, - { 0x00220000, 0x00000004 }, - { 0x000700e4, 0x00000004 }, - { 0x000000c1, 0x00000038 }, - { 0x000c209a, 0x00000030 }, - { 0x0880e5bd, 0x00000005 }, - { 0x000c2099, 0x00000030 }, - { 0x0800e5bb, 0x00000005 }, - { 0x000c209a, 0x00000030 }, - { 0x0880e5bc, 0x00000005 }, - { 0x000000c4, 0x00000008 }, - { 0x0080e5bd, 0x00000005 }, - { 0x0000e5bb, 0x00000005 }, - { 0x0080e5bc, 0x00000005 }, - { 0x00210000, 0x00000004 }, - { 0x02800000, 0x00000004 }, - { 0x00c000c8, 0x00000018 }, - { 0x4180e000, 0x00000040 }, - { 0x000000ca, 0x00000024 }, - { 0x01000000, 0x0000000c }, - { 0x0100e51d, 0x0000000c }, - { 0x000045bb, 0x00000004 }, - { 0x000080c4, 0x00000008 }, - { 0x0000f3ce, 0x00000004 }, - { 0x0140a000, 0x00000004 }, - { 0x00cc2000, 0x00000004 }, - { 0x08c053cf, 0x00000040 }, - { 0x00008000, 0000000000 }, - { 0x0000f3d2, 0x00000004 }, - { 0x0140a000, 0x00000004 }, - { 0x00cc2000, 0x00000004 }, - { 0x08c053d3, 0x00000040 }, - { 0x00008000, 0000000000 }, - { 0x0000f39d, 0x00000004 }, - { 0x0140a000, 0x00000004 }, - { 0x00cc2000, 0x00000004 }, - { 0x08c0539e, 0x00000040 }, - { 0x00008000, 0000000000 }, - { 0x03c00830, 0x00000004 }, - { 0x4200e000, 0000000000 }, - { 0x0000a000, 0x00000004 }, - { 0x200045e0, 0x00000004 }, - { 0x0000e5e1, 0000000000 }, - { 0x00000001, 0000000000 }, - { 0x000700e1, 0x00000004 }, - { 0x0800e394, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, - { 0000000000, 0000000000 }, -}; diff --git a/hw/kdrive/ati/ati_reg.h b/hw/kdrive/ati/ati_reg.h deleted file mode 100644 index 3089cba04..000000000 --- a/hw/kdrive/ati/ati_reg.h +++ /dev/null @@ -1,1927 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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. - */ - -/* Many of the Radeon and Rage 128 registers are the same. - * ATI_ should denote registers and values that are common for R128 and Radeon. - * - * The information in this file comes from many sources, including the Rage 128 - * DDK, Rage 128 register reference, the XFree86 and kernel Rage 128 and Radeon - * register definition headers, and bits from the Radeon DDK and RV200 register - * specs supplied by others. - */ - -#define ATI_REG_CLOCK_CNTL_INDEX 0x0008 -# define ATI_PLL_WR_EN (1 << 7) -# define ATI_PLL_DIV_SEL (3 << 8) - -#define ATI_REG_CLOCK_CNTL_DATA 0x000c - -#define ATI_REG_BUS_CNTL 0x0030 -# define ATI_BUS_MASTER_DIS (1 << 6) - -#define ATI_REG_GEN_INT_CNTL 0x0040 - -#define ATI_REG_GEN_CNTL 0x0050 -# define ATI_CRTC_DBL_SCAN_EN (1 << 0) /* 0x00000001 */ -# define ATI_CRTC_INTERLACE_EN (1 << 1) /* 0x00000002 */ -# define ATI_CRTC_CSYNC_EN (1 << 4) /* 0x00000010 */ -# define ATI_CRTC_PIX_WIDTH_MASK (7 << 8) /* 0x00000700 */ -# define ATI_CRTC_CUR_EN (1 << 16) /* 0x00010000 */ -# define ATI_CRTC_CUR_MODE_MASK (7 << 17) /* 0x000e0000 */ -# define ATI_CRTC_ICON_EN (1 << 20) /* 0x00100000 */ -# define ATI_CRTC_ARGB_EN (2 << 20) /* 0x00200000 */ -# define ATI_CRTC_EXT_DISP_EN (1 << 24) /* 0x01000000 */ -# define ATI_CRTC_EN (1 << 25) /* 0x02000000 */ -# define ATI_CRTC_DISP_REQ_EN_B (1 << 26) /* 0x04000000 */ - -#define ATI_REG_CRTC_EXT_CNTL 0x0054 -# define ATI_CRTC_EN (1 << 25) -# define ATI_CRTC_VGA_XOVERSCAN (1 << 0) -# define ATI_VGA_ATI_LINEAR (1 << 3) -# define ATI_XCRT_CNT_EN (1 << 6) -# define ATI_CRTC_HSYNC_DIS (1 << 8) -# define ATI_CRTC_VSYNC_DIS (1 << 9) -# define ATI_CRTC_DISPLAY_DIS (1 << 10) -# define RADEON_CRTC_SYNC_TRISTAT (1 << 11) -# define ATI_CRTC_CRT_ON (1 << 15) -# define R128_FP_OUT_EN (1 << 22) -# define R128_FP_ACTIVE (1 << 23) - -#define ATI_REG_DAC_CNTL 0x0058 -# define ATI_DAC_RANGE_CNTL (3 << 0) -# define ATI_DAC_BLANKING (1 << 2) -# define R128_DAC_CRT_SEL_CRTC2 (1 << 4) -# define ATI_DAC_CMP_EN (1 << 3) -# define R128_DAC_PALETTE_ACC_CTL (1 << 5) -# define ATI_DAC_CMP_OUTPUT (1 << 7) -# define ATI_DAC_8BIT_EN (1 << 8) -# define ATI_DAC_VGA_ADR_EN (1 << 13) -# define ATI_DAC_PDWN (1 << 15) -# define ATI_DAC_MASK_ALL (0xff << 24) - -#define ATI_REG_I2C_CNTL_1 0x0094 - -#define R128_REG_GEN_RESET_CNTL 0x00f0 -# define R128_SOFT_RESET_GUI (1 << 0) -# define R128_SOFT_RESET_VCLK (1 << 8) -# define R128_SOFT_RESET_PCLK (1 << 9) -# define R128_SOFT_RESET_DISPENG_XCLK (1 << 11) -# define R128_SOFT_RESET_MEMCTLR_XCLK (1 << 12) - -#define RADEON_REG_RBBM_SOFT_RESET 0x00f0 -# define RADEON_SOFT_RESET_CP (1 << 0) -# define RADEON_SOFT_RESET_HI (1 << 1) -# define RADEON_SOFT_RESET_SE (1 << 2) -# define RADEON_SOFT_RESET_RE (1 << 3) -# define RADEON_SOFT_RESET_PP (1 << 4) -# define RADEON_SOFT_RESET_E2 (1 << 5) -# define RADEON_SOFT_RESET_RB (1 << 6) -# define RADEON_SOFT_RESET_HDP (1 << 7) - -#define RADEON_REG_HOST_PATH_CNTL 0x0130 -# define RADEON_HDP_SOFT_RESET (1 << 26) - -#define ATI_REG_AGP_BASE 0x0170 - -#define ATI_REG_AGP_CNTL 0x0174 -# define R128_AGP_APER_SIZE_256MB (0x00 << 0) -# define R128_AGP_APER_SIZE_128MB (0x20 << 0) -# define R128_AGP_APER_SIZE_64MB (0x30 << 0) -# define R128_AGP_APER_SIZE_32MB (0x38 << 0) -# define R128_AGP_APER_SIZE_16MB (0x3c << 0) -# define R128_AGP_APER_SIZE_8MB (0x3e << 0) -# define R128_AGP_APER_SIZE_4MB (0x3f << 0) -# define R128_AGP_APER_SIZE_MASK (0x3f << 0) -# define RADEON_PENDING_SLOTS_VAL 0x00060000 -# define RADEON_PENDING_SLOTS_SEL 0x00080000 - -#define R128_REG_PCI_GART_PAGE 0x017c - -#define R128_REG_PC_NGUI_CTLSTAT 0x0184 -# define R128_PC_FLUSH_GUI (3 << 0) -# define R128_PC_RI_GUI (1 << 2) -# define R128_PC_FLUSH_ALL 0x00ff -# define R128_PC_BUSY (1 << 31) - -#define R128_REG_VIPH_CONTROL 0x01d0 - -#define ATI_REG_CRTC_H_TOTAL_DISP 0x0200 -#define ATI_REG_CRTC2_H_TOTAL_DISP 0x0300 -# define ATI_CRTC_H_TOTAL (0x01ff << 0) -# define ATI_CRTC_H_TOTAL_SHIFT 0 -# define ATI_CRTC_H_DISP (0x00ff << 16) -# define ATI_CRTC_H_DISP_SHIFT 16 - -#define ATI_REG_CRTC_H_SYNC_STRT_WID 0x0204 -#define ATI_REG_CRTC2_H_SYNC_STRT_WID 0x0304 -# define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0) -# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3) -# define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3 -# define RADEON_CRTC_H_SYNC_WID (0x3f << 16) -# define RADEON_CRTC_H_SYNC_WID_SHIFT 16 -# define RADEON_CRTC_H_SYNC_POL (1 << 23) - -#define ATI_REG_CRTC_OFFSET 0x0224 -#define ATI_REG_CRTC2_OFFSET 0x0324 -#define ATI_REG_CRTC_OFFSET_CNTL 0x0228 -#define ATI_REG_CRTC2_OFFSET_CNTL 0x0328 -#define ATI_REG_CRTC_PITCH 0x022c -#define ATI_REG_CRTC2_PITCH 0x032c - -#define ATI_REG_OVR_CLR 0x0230 -#define ATI_REG_OVR_WID_LEFT_RIGHT 0x0234 -#define ATI_REG_OVR_WID_TOP_BOTTOM 0x0238 - -#define ATI_REG_CUR_OFFSET 0x0260 -#define ATI_REG_CUR_HORZ_VERT_POSN 0x0264 -#define ATI_REG_CUR_HORZ_VERT_OFF 0x0268 -# define ATI_CUR_LOCK (1 << 31) -# define ATI_CURSOR_WIDTH 64 -# define ATI_CURSOR_HEIGHT 64 -# define ATI_CURSOR_PITCH 16 - -#define ATI_REG_CUR_CLR0 0x026c -#define ATI_REG_CUR_CLR1 0x0270 -#define ATI_REG_OV0_SCALE_CNTL 0x0420 -#define ATI_REG_SUBPIC_CNTL 0x0540 -#define ATI_REG_CAP0_TRIG_CNTL 0x0950 -#define RADEON_REG_VIPH_CONTROL 0x0c50 - -#define RADEON_REG_RBBM_STATUS 0x0e40 -# define RADEON_RBBM_FIFOCNT_MASK 0x007f -# define RADEON_RBBM_ACTIVE (1 << 31) - -#define ATI_REG_CCE_RB_BASE 0x0700 - -#define R128_REG_PM4_BUFFER_CNTL 0x0704 -# define R128_PM4_IN_FRAME_BUFFER (1 << 26) -# define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27) -# define R128_PM4_NONPM4 (0 << 28) -# define R128_PM4_192PIO (1 << 28) -# define R128_PM4_192BM (2 << 28) -# define R128_PM4_128PIO_64INDBM (3 << 28) -# define R128_PM4_128BM_64INDBM (4 << 28) -# define R128_PM4_64PIO_128INDBM (5 << 28) -# define R128_PM4_64BM_128INDBM (6 << 28) -# define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28) -# define R128_PM4_64BM_64VCBM_64INDBM (8 << 28) -# define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28) - -#define RADEON_REG_CP_RB_CNTL 0x0704 - -#define R128_REG_PM4_BUFFER_WM_CNTL 0x0708 -# define R128_WMA_SHIFT 0 -# define R128_WMB_SHIFT 8 -# define R128_WMC_SHIFT 16 -# define R128_WB_WM_SHIFT 24 - -#define ATI_REG_CCE_RPTR_ADDR 0x070c -#define ATI_REG_CCE_RPTR 0x0710 -#define ATI_REG_CCE_WPTR 0x0714 -# define R128_PM4_BUFFER_DL_DONE (1 << 31) - -#define R128_REG_PM4_VC_FPU_SETUP 0x071c -# define R128_FRONT_DIR_CW (0 << 0) -# define R128_FRONT_DIR_CCW (1 << 0) -# define R128_FRONT_DIR_MASK (1 << 0) -# define R128_BACKFACE_CULL (0 << 1) -# define R128_BACKFACE_POINTS (1 << 1) -# define R128_BACKFACE_LINES (2 << 1) -# define R128_BACKFACE_SOLID (3 << 1) -# define R128_BACKFACE_MASK (3 << 1) -# define R128_FRONTFACE_CULL (0 << 3) -# define R128_FRONTFACE_POINTS (1 << 3) -# define R128_FRONTFACE_LINES (2 << 3) -# define R128_FRONTFACE_SOLID (3 << 3) -# define R128_FRONTFACE_MASK (3 << 3) -# define R128_FPU_COLOR_SOLID (0 << 5) -# define R128_FPU_COLOR_FLAT (1 << 5) -# define R128_FPU_COLOR_GOURAUD (2 << 5) -# define R128_FPU_COLOR_GOURAUD2 (3 << 5) -# define R128_FPU_COLOR_MASK (3 << 5) -# define R128_FPU_SUB_PIX_2BITS (0 << 7) -# define R128_FPU_SUB_PIX_4BITS (1 << 7) -# define R128_FPU_MODE_2D (0 << 8) -# define R128_FPU_MODE_3D (1 << 8) -# define R128_TRAP_BITS_DISABLE (1 << 9) -# define R128_EDGE_ANTIALIAS (1 << 10) -# define R128_SUPERSAMPLE (1 << 11) -# define R128_XFACTOR_2 (0 << 12) -# define R128_XFACTOR_4 (1 << 12) -# define R128_YFACTOR_2 (0 << 13) -# define R128_YFACTOR_4 (1 << 13) -# define R128_FLAT_SHADE_VERTEX_D3D (0 << 14) -# define R128_FLAT_SHADE_VERTEX_OGL (1 << 14) -# define R128_FPU_ROUND_TRUNCATE (0 << 15) -# define R128_FPU_ROUND_NEAREST (1 << 15) -# define R128_WM_SEL_8DW (0 << 16) -# define R128_WM_SEL_16DW (1 << 16) -# define R128_WM_SEL_32DW (2 << 16) - -#define R128_REG_PM4_IW_INDOFF 0x0738 -#define R128_REG_PM4_IW_INDSIZE 0x073c - -#define RADEON_REG_CP_CSQ_CNTL 0x0740 -# define RADEON_CSQ_CNT_PRIMARY_MASK 0x000000ff -# define RADEON_CSQ_CNT_INDIRECT_MASK 0x0000ff00 -# define R200_CSQ_CNT_PRIMARY_MASK 0x000001ff -# define R200_CSQ_CNT_INDIRECT_MASK 0x0003fe00 -# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) -# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) -# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) -# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) -# define RADEON_CSQ_PRIBM_INDBM (4 << 28) -# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) - -#define R128_REG_PM4_STAT 0x07b8 -# define R128_PM4_FIFOCNT_MASK 0x00000fff -# define R128_PM4_BUSY (1 << 16) -# define R128_PM4_GUI_ACTIVE (1 << 31) - -#define RADEON_REG_CP_STAT 0x07c0 -# define RADEON_CSQ_PRIMARY_BUSY (1 << 10) -# define RADEON_CSQ_INDIRECT_BUSY (1 << 11) - -#define RADEON_REG_ME_CNTL 0x07d0 -# define RADEON_ME_MODE_FREE_RUN (1 << 30) - -#define ATI_REG_MICROCODE_RAM_ADDR 0x07d4 -#define ATI_REG_MICROCODE_RAM_RADDR 0x07d8 -#define ATI_REG_MICROCODE_RAM_DATAH 0x07dc -#define ATI_REG_MICROCODE_RAM_DATAL 0x07e0 -#define R128_REG_PM4_BUFFER_ADDR 0x07f0 - -#define RADEON_REG_CP_CSQ_STAT 0x07f8 -# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0) -# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8) -# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16) -# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24) -# define R200_CSQ_RPTR_PRIMARY_MASK (0x1ff << 0) -# define R200_CSQ_WPTR_PRIMARY_MASK (0x1ff << 9) - -#define R128_REG_PM4_MICRO_CNTL 0x07fc -# define R128_PM4_MICRO_FREERUN (1 << 30) - -#define RADEON_TV_MASTER_CNTL 0x0800 -# define RADEON_TV_MACROVISION (1 << 5) -# define RADEON_TVCLK_ALWAYS_ON (1 << 30) - -#define R128_REG_BM_CHUNK_0_VAL 0x0a18 -# define R128_BM_PTR_FORCE_TO_PCI (1 << 21) -# define R128_BM_PM4_RD_FORCE_TO_PCI (1 << 22) -# define R128_BM_GLOBAL_FORCE_TO_PCI (1 << 23) - -/* Offset of the PCI config space mirror */ -#define ATI_PCI_CFG_OFFSET 0x0f00 - -#define ATI_REG_PCI_CFG_STATUS 0x0f06 -# define ATI_CAP_LIST 0x0010 - -#define ATI_REG_PCI_CFG_CAPABILITIES_PTR 0x0f34 -# define ATI_CAP_PTR_MASK 0x00fc -# define ATI_CAP_ID_NULL 0x0000 /* End of capability list */ -# define ATI_CAP_ID_AGP 0x0002 /* AGP capability ID */ - -#define R128_REG_AGP_STATUS 0x0f54 /* PCI */ -# define R128_AGP_1X_MODE 0x01 -# define R128_AGP_2X_MODE 0x02 -# define R128_AGP_4X_MODE 0x04 -# define R128_AGP_MODE_MASK 0x07 - -#define R128_REG_AGP_COMMAND 0x0f58 -# define R128_AGP_ENABLE (1 << 8) - -#define RADEON_REG_AGP_STATUS 0x0f5c /* PCI */ -# define RADEON_AGP_1X_MODE 0x01 -# define RADEON_AGP_2X_MODE 0x02 -# define RADEON_AGP_4X_MODE 0x04 -# define RADEON_AGP_FW_MODE 0x10 -# define RADEON_AGP_MODE_MASK 0x17 - -#define RADEON_REG_AGP_COMMAND 0x0f60 -# define RADEON_AGP_ENABLE (1 << 8) - -#define R128_REG_PM4_FIFO_DATA_EVEN 0x1000 -#define R128_REG_PM4_FIFO_DATA_ODD 0x1004 - -#define RADEON_REG_CSQ_APER_PRIMARY 0x1000 -#define RADEON_REG_CSQ_APER_PRIMARY_END 0x11fc -#define RADEON_REG_CSQ_APER_INDIRECT 0x1300 -#define RADEON_REG_CSQ_APER_INDIRECT_END 0x13fc -#define ATI_REG_SRC_PITCH_OFFSET 0x1428 -#define ATI_REG_DST_PITCH_OFFSET 0x142c -#define ATI_REG_SRC_Y_X 0x1434 -#define ATI_REG_DST_Y_X 0x1438 -#define ATI_REG_DST_HEIGHT_WIDTH 0x143c - -#define ATI_REG_DP_GUI_MASTER_CNTL 0x146c -# define ATI_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define ATI_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define ATI_GMC_SRC_CLIPPING (1 << 2) -# define ATI_GMC_DST_CLIPPING (1 << 3) -# define ATI_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define ATI_GMC_BRUSH_NONE (15 << 4) -# define ATI_GMC_BRUSH_MASK (15 << 4) -# define ATI_GMC_DST_DATATYPE_MASK (0xf << 8) -# define ATI_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define R128_GMC_CONVERSION_TEMP (1 << 15) -# define R128_GMC_CONVERSION_TEMP_6500 (0 << 15) -# define R128_GMC_CONVERSION_TEMP_9300 (1 << 15) -# define ATI_GMC_ROP3_MASK (0xff << 16) -# define ATI_DP_SRC_SOURCE_MEMORY (2 << 24) -# define ATI_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define R128_GMC_3D_FCN_EN (1 << 27) -# define ATI_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define R128_GMC_AUX_CLIP_DIS (1 << 29) -# define ATI_GMC_WR_MSK_DIS (1 << 30) -# define R128_GMC_LD_BRUSH_Y_X (1 << 31) - -#define ATI_REG_DP_BRUSH_FRGD_CLR 0x147c -#define ATI_REG_DST_WIDTH_HEIGHT 0x1598 -#define ATI_REG_CLR_CMP_CNTL 0x15c0 - -#define R128_REG_AUX_SC_CNTL 0x1660 -# define R128_AUX1_SC_ENB (1 << 0) -# define R128_AUX1_SC_MODE_SUB (1 << 1) -# define R128_AUX2_SC_ENB (1 << 0) -# define R128_AUX2_SC_MODE_SUB (1 << 1) -# define R128_AUX3_SC_ENB (1 << 0) -# define R128_AUX3_SC_MODE_SUB (1 << 1) - -#define R128_REG_AUX1_SC_LEFT 0x1664 -#define R128_REG_AUX1_SC_RIGHT 0x1668 -#define R128_REG_AUX1_SC_TOP 0x166c -#define R128_REG_AUX1_SC_BOTTOM 0x1670 -#define R128_REG_AUX2_SC_LEFT 0x1674 -#define R128_REG_AUX2_SC_RIGHT 0x1678 -#define R128_REG_AUX2_SC_TOP 0x167c -#define R128_REG_AUX2_SC_BOTTOM 0x1680 -#define R128_REG_AUX3_SC_LEFT 0x1684 -#define R128_REG_AUX3_SC_RIGHT 0x1688 -#define R128_REG_AUX3_SC_TOP 0x168c -#define R128_REG_AUX3_SC_BOTTOM 0x1690 - -#define ATI_REG_DP_CNTL 0x16c0 -# define ATI_DST_X_LEFT_TO_RIGHT (1 << 0) -# define ATI_DST_Y_TOP_TO_BOTTOM (1 << 1) - -#define ATI_REG_DP_MIX 0x16c8 -#define ATI_REG_DP_WRITE_MASK 0x16cc -#define ATI_REG_DEFAULT_OFFSET 0x16e0 -#define ATI_REG_DEFAULT_PITCH 0x16e4 - -#define ATI_REG_DEFAULT_SC_BOTTOM_RIGHT 0x16e8 -# define ATI_DEFAULT_SC_RIGHT_MAX 0x00001fff -# define ATI_DEFAULT_SC_BOTTOM_MAX 0x1fff0000 - -#define ATI_REG_SC_TOP_LEFT 0x16ec -#define ATI_REG_SC_BOTTOM_RIGHT 0x16f0 - -#define ATI_REG_WAIT_UNTIL 0x1720 -# define ATI_WAIT_CRTC_PFLIP (1 << 0) -# define ATI_WAIT_RE_CRTC_VLINE (1 << 1) -# define ATI_WAIT_FE_CRTC_VLINE (1 << 2) -# define ATI_WAIT_CRTC_VLINE (1 << 3) -# define ATI_WAIT_DMA_VIPH0_IDLE (1 << 4) -# define ATI_WAIT_DMA_VIPH1_IDLE (1 << 5) -# define ATI_WAIT_DMA_VIPH2_IDLE (1 << 6) -# define ATI_WAIT_DMA_VIPH3_IDLE (1 << 7) -# define ATI_WAIT_DMA_VID_IDLE (1 << 8) -# define ATI_WAIT_DMA_GUI_IDLE (1 << 9) -# define ATI_WAIT_CMDFIFO (1 << 10) -# define ATI_WAIT_OV0_FLIP (1 << 11) -# define RADEON_WAIT_OV0_SLICEDONE (1 << 12) -# define RADEON_WAIT_2D_IDLE (1 << 14) -# define RADEON_WAIT_3D_IDLE (1 << 15) -# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) -# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) -# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) -# define ATI_WAIT_CMDFIFO_ENTRIES (0x07f00000) -# define RADEON_WAIT_BOTH_CRTC_PFLIP (1 << 30) -# define RADEON_ENG_DISPLAY_SELECT (1 << 31) - -#define RADEON_REG_ISYNC_CNTL 0x1724 -#define ISYNC_ANY2D_IDLE3D 0x1 -#define ISYNC_ANY3D_IDLE2D 0x2 - -#define R128_REG_GUI_STAT 0x1740 -# define R128_GUI_ACTIVE (1 << 31) - -#define R128_REG_PC_GUI_MODE 0x1744 -#define R128_PC_GUI_PRIORITY (1 << 0) -#define R128_PC_RISE_DF_EN (1 << 1) -#define R128_PC_FALL_DF_EN (1 << 2) -#define R128_PC_BYPASS_EN (1 << 3) -#define R128_PC_CACHE_SIZE (1 << 4) -#define R128_PC_IGNORE_UNIFY (1 << 5) -#define R128_PC_IGNORE_WRHINT (1 << 6) -#define R128_PC_IGNORE_RDHINT (1 << 7) -#define R128_PC_RISE_DP_EN (1 << 8) - -#define R128_REG_PC_GUI_CTLSTAT 0x1748 -/* bits match R128_REG_PC_NGUI_CTLSTAT */ - -#define R128_REG_TEX_CNTL 0x1800 -#define R128_REG_SECONDARY_SCALE_OFFSET 0x1980 -#define R128_REG_SECONDARY_SCALE_PITCH 0x1980 -#define R128_REG_SECONDARY_SCALE_X_INC 0x1984 -#define R128_REG_SECONDARY_SCALE_Y_INC 0x1988 -#define R128_REG_SECONDARY_SCALE_HACC 0x198c -#define R128_REG_SECONDARY_SCALE_VACC 0x1990 -#define R128_REG_SCALE_SRC_HEIGHT_WIDTH 0x1994 -#define R128_REG_SCALE_OFFSET_0 0x1998 -#define R128_REG_SCALE_PITCH 0x199c -#define R128_REG_SCALE_X_INC 0x19a0 -#define R128_REG_SCALE_Y_INC 0x19a4 -#define R128_REG_SCALE_HACC 0x19a8 -#define R128_REG_SCALE_VACC 0x19ac -#define R128_REG_SCALE_DST_X_Y 0x19b0 -#define R128_REG_SCALE_DST_HEIGHT_WIDTH 0x19b4 - -#define R128_REG_SCALE_3D_CNTL 0x1a00 -# define R128_SCALE_DITHER_ERR_DIFF (0 << 1) -# define R128_SCALE_DITHER_TABLE (1 << 1) -# define R128_TEX_CACHE_SIZE_FULL (0 << 2) -# define R128_TEX_CACHE_SIZE_HALF (1 << 2) -# define R128_DITHER_INIT_CURR (0 << 3) -# define R128_DITHER_INIT_RESET (1 << 3) -# define R128_ROUND_24BIT (1 << 4) -# define R128_TEX_CACHE_DISABLE (1 << 5) -# define R128_SCALE_3D_NOOP (0 << 6) -# define R128_SCALE_3D_SCALE (1 << 6) -# define R128_SCALE_3D_TEXMAP_SHADE (2 << 6) -# define R128_SCALE_PIX_BLEND (0 << 8) -# define R128_SCALE_PIX_REPLICATE (1 << 8) -# define R128_TEX_CACHE_SPLIT (1 << 9) -# define R128_APPLE_YUV_MODE (1 << 10) -# define R128_TEX_CACHE_PALLETE_MODE (1 << 11) -# define R128_ALPHA_COMB_ADD_CLAMP (0 << 12) -# define R128_ALPHA_COMB_ADD_NCLAMP (1 << 12) -# define R128_ALPHA_COMB_SUB_DST_SRC_CLAMP (2 << 12) -# define R128_ALPHA_COMB_SUB_DST_SRC_NCLAMP (3 << 12) -# define R128_FOG_TABLE (1 << 14) -# define R128_SIGNED_DST_CLAMP (1 << 15) -/* Alpha bits from R128_REG_MISC_3D_CNTL */ -# define R128_COMPOSITE_SHADOW_CMP_EQUAL (0 << 28) -# define R128_COMPOSITE_SHADOW_CMP_NEQUAL (1 << 28) -# define R128_COMPOSITE_SHADOW (1 << 29) -# define R128_TEX_MAP_ALPHA_IN_TEXTURE (1 << 30) -# define R128_TEX_CACHE_LINE_SIZE_8QW (0 << 31) -# define R128_TEX_CACHE_LINE_SIZE_4QW (1 << 31) - -#define R128_REG_SCALE_3D_DATATYPE 0x1a20 - -#define R128_REG_SETUP_CNTL 0x1bc4 -# define R128_DONT_START_TRIANGLE (1 << 0) -# define R128_Z_BIAS (0 << 1) -# define R128_DONT_START_ANY_ON (1 << 2) -# define R128_COLOR_SOLID_COLOR (0 << 3) -# define R128_COLOR_FLAT_VERT_1 (1 << 3) -# define R128_COLOR_FLAT_VERT_2 (2 << 3) -# define R128_COLOR_FLAT_VERT_3 (3 << 3) -# define R128_COLOR_GOURAUD (4 << 3) -# define R128_PRIM_TYPE_TRI (0 << 7) -# define R128_PRIM_TYPE_LINE (1 << 7) -# define R128_PRIM_TYPE_POINT (2 << 7) -# define R128_PRIM_TYPE_POLY_EDGE (3 << 7) -# define R128_TEXTURE_ST_MULT_W (0 << 9) -# define R128_TEXTURE_ST_DIRECT (1 << 9) -# define R128_STARTING_VERTEX_1 (1 << 14) -# define R128_STARTING_VERTEX_2 (2 << 14) -# define R128_STARTING_VERTEX_3 (3 << 14) -# define R128_ENDING_VERTEX_1 (1 << 16) -# define R128_ENDING_VERTEX_2 (2 << 16) -# define R128_ENDING_VERTEX_3 (3 << 16) -# define R128_SU_POLY_LINE_LAST (0 << 18) -# define R128_SU_POLY_LINE_NOT_LAST (1 << 18) -# define R128_SUB_PIX_2BITS (0 << 19) -# define R128_SUB_PIX_4BITS (1 << 19) -# define R128_SET_UP_CONTINUE (1 << 31) - -#define R128_REG_WINDOW_XY_OFFSET 0x1bcc - -#define RADEON_REG_RB3D_BLENDCNTL 0x1c20 -# define RADEON_COMB_FCN_MASK (3 << 12) -# define RADEON_COMB_FCN_ADD_CLAMP (0 << 12) -# define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12) -# define RADEON_COMB_FCN_SUB_CLAMP (2 << 12) -# define RADEON_COMB_FCN_SUB_NOCLAMP (3 << 12) -# define R200_COMB_FCN_MIN (4 << 12) -# define R200_COMB_FCN_MAX (5 << 12) -# define R200_COMB_FCN_RSUB_CLAMP (6 << 12) -# define R200_COMB_FCN_RSUB_NOCLAMP (7 << 12) -# define RADEON_SBLEND_GL_ZERO (32 << 16) -# define RADEON_SBLEND_GL_ONE (33 << 16) -# define RADEON_SBLEND_GL_SRC_COLOR (34 << 16) -# define RADEON_SBLEND_GL_INV_SRC_COLOR (35 << 16) -# define RADEON_SBLEND_GL_DST_COLOR (36 << 16) -# define RADEON_SBLEND_GL_INV_DST_COLOR (37 << 16) -# define RADEON_SBLEND_GL_SRC_ALPHA (38 << 16) -# define RADEON_SBLEND_GL_INV_SRC_ALPHA (39 << 16) -# define RADEON_SBLEND_GL_DST_ALPHA (40 << 16) -# define RADEON_SBLEND_GL_INV_DST_ALPHA (41 << 16) -# define RADEON_SBLEND_GL_SRC_ALPHA_SATURATE (42 << 16) -# define R200_SBLEND_GL_CONST_COLOR (43 << 16) -# define R200_SBLEND_GL_ONE_MINUS_CONST_COLOR (44 << 16) -# define R200_SBLEND_GL_CONST_ALPHA (45 << 16) -# define R200_SBLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 16) -# define RADEON_SBLEND_MASK (63 << 16) -# define RADEON_DBLEND_GL_ZERO (32 << 24) -# define RADEON_DBLEND_GL_ONE (33 << 24) -# define RADEON_DBLEND_GL_SRC_COLOR (34 << 24) -# define RADEON_DBLEND_GL_INV_SRC_COLOR (35 << 24) -# define RADEON_DBLEND_GL_DST_COLOR (36 << 24) -# define RADEON_DBLEND_GL_INV_DST_COLOR (37 << 24) -# define RADEON_DBLEND_GL_SRC_ALPHA (38 << 24) -# define RADEON_DBLEND_GL_INV_SRC_ALPHA (39 << 24) -# define RADEON_DBLEND_GL_DST_ALPHA (40 << 24) -# define RADEON_DBLEND_GL_INV_DST_ALPHA (41 << 24) -# define R200_DBLEND_GL_CONST_COLOR (43 << 24) -# define R200_DBLEND_GL_ONE_MINUS_CONST_COLOR (44 << 24) -# define R200_DBLEND_GL_CONST_ALPHA (45 << 24) -# define R200_DBLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 24) -# define RADEON_DBLEND_MASK (63 << 24) - -#define RADEON_REG_PP_CNTL 0x1c38 -# define RADEON_STIPPLE_ENABLE (1 << 0) -# define RADEON_SCISSOR_ENABLE (1 << 1) -# define RADEON_PATTERN_ENABLE (1 << 2) -# define RADEON_SHADOW_ENABLE (1 << 3) -# define RADEON_TEX_ENABLE_MASK (0xf << 4) -# define RADEON_TEX_0_ENABLE (1 << 4) -# define RADEON_TEX_1_ENABLE (1 << 5) -# define RADEON_TEX_2_ENABLE (1 << 6) -# define RADEON_TEX_3_ENABLE (1 << 7) -# define R200_TEX_4_ENABLE (1 << 8) -# define R200_TEX_5_ENABLE (1 << 9) -# define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12) -# define RADEON_TEX_BLEND_0_ENABLE (1 << 12) -# define RADEON_TEX_BLEND_1_ENABLE (1 << 13) -# define RADEON_TEX_BLEND_2_ENABLE (1 << 14) -# define RADEON_TEX_BLEND_3_ENABLE (1 << 15) -# define R200_TEX_BLEND_4_ENABLE (1 << 16) -# define R200_TEX_BLEND_5_ENABLE (1 << 17) -# define R200_TEX_BLEND_6_ENABLE (1 << 18) -# define RADEON_PLANAR_YUV_ENABLE (1 << 20) -# define RADEON_SPECULAR_ENABLE (1 << 21) -# define RADEON_FOG_ENABLE (1 << 22) -# define RADEON_ALPHA_TEST_ENABLE (1 << 23) -# define RADEON_ANTI_ALIAS_NONE (0 << 24) -# define RADEON_ANTI_ALIAS_LINE (1 << 24) -# define RADEON_ANTI_ALIAS_POLY (2 << 24) -# define RADEON_ANTI_ALIAS_LINE_POLY (3 << 24) -# define RADEON_BUMP_MAP_ENABLE (1 << 26) -# define RADEON_BUMPED_MAP_T0 (0 << 27) -# define RADEON_BUMPED_MAP_T1 (1 << 27) -# define RADEON_BUMPED_MAP_T2 (2 << 27) -# define RADEON_TEX_3D_ENABLE_0 (1 << 29) -# define RADEON_TEX_3D_ENABLE_1 (1 << 30) -# define RADEON_MC_ENABLE (1 << 31) - -#define RADEON_REG_RB3D_CNTL 0x1c3c -# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) -# define RADEON_PLANE_MASK_ENABLE (1 << 1) -# define RADEON_DITHER_ENABLE (1 << 2) -# define RADEON_ROUND_ENABLE (1 << 3) -# define RADEON_SCALE_DITHER_ENABLE (1 << 4) -# define RADEON_DITHER_INIT (1 << 5) -# define RADEON_ROP_ENABLE (1 << 6) -# define RADEON_STENCIL_ENABLE (1 << 7) -# define RADEON_Z_ENABLE (1 << 8) -# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9) -# define RADEON_COLOR_FORMAT_ARGB1555 (3 << 10) -# define RADEON_COLOR_FORMAT_RGB565 (4 << 10) -# define RADEON_COLOR_FORMAT_ARGB8888 (6 << 10) -# define RADEON_COLOR_FORMAT_RGB332 (7 << 10) -# define RADEON_COLOR_FORMAT_Y8 (8 << 10) -# define RADEON_COLOR_FORMAT_RGB8 (9 << 10) -# define RADEON_COLOR_FORMAT_YUV422_VYUY (11 << 10) -# define RADEON_COLOR_FORMAT_YUV422_YVYU (12 << 10) -# define RADEON_COLOR_FORMAT_aYUV444 (14 << 10) -# define RADEON_COLOR_FORMAT_ARGB4444 (15 << 10) -# define RADEON_CLRCMP_FLIP_ENABLE (1 << 14) - -#define RADEON_REG_RB3D_COLOROFFSET 0x1c40 -# define RADEON_COLOROFFSET_MASK 0xfffffff0 - -#define RADEON_REG_RE_WIDTH_HEIGHT 0x1c44 - -#define RADEON_REG_RB3D_COLORPITCH 0x1c48 -# define RADEON_COLORPITCH_MASK 0x000001ff8 -# define RADEON_COLOR_TILE_ENABLE (1 << 16) -# define RADEON_COLOR_MICROTILE_ENABLE (1 << 17) -# define RADEON_COLOR_ENDIAN_NO_SWAP (0 << 18) -# define RADEON_COLOR_ENDIAN_WORD_SWAP (1 << 18) -# define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18) - -#define RADEON_REG_SE_CNTL 0x1c4c -# define RADEON_FFACE_CULL_CW (0 << 0) -# define RADEON_FFACE_CULL_CCW (1 << 0) -# define RADEON_FFACE_CULL_DIR_MASK (1 << 0) -# define RADEON_BFACE_CULL (0 << 1) -# define RADEON_BFACE_SOLID (3 << 1) -# define RADEON_FFACE_CULL (0 << 3) -# define RADEON_FFACE_SOLID (3 << 3) -# define RADEON_FFACE_CULL_MASK (3 << 3) -# define RADEON_BADVTX_CULL_DISABLE (1 << 5) -# define RADEON_FLAT_SHADE_VTX_0 (0 << 6) -# define RADEON_FLAT_SHADE_VTX_1 (1 << 6) -# define RADEON_FLAT_SHADE_VTX_2 (2 << 6) -# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) -# define RADEON_DIFFUSE_SHADE_SOLID (0 << 8) -# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) -# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) -# define RADEON_DIFFUSE_SHADE_MASK (3 << 8) -# define RADEON_ALPHA_SHADE_SOLID (0 << 10) -# define RADEON_ALPHA_SHADE_FLAT (1 << 10) -# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) -# define RADEON_ALPHA_SHADE_MASK (3 << 10) -# define RADEON_SPECULAR_SHADE_SOLID (0 << 12) -# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) -# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) -# define RADEON_SPECULAR_SHADE_MASK (3 << 12) -# define RADEON_FOG_SHADE_SOLID (0 << 14) -# define RADEON_FOG_SHADE_FLAT (1 << 14) -# define RADEON_FOG_SHADE_GOURAUD (2 << 14) -# define RADEON_FOG_SHADE_MASK (3 << 14) -# define RADEON_ZBIAS_ENABLE_POINT (1 << 16) -# define RADEON_ZBIAS_ENABLE_LINE (1 << 17) -# define RADEON_ZBIAS_ENABLE_TRI (1 << 18) -# define RADEON_WIDELINE_ENABLE (1 << 20) -# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) -# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) -# define RADEON_VTX_PIX_CENTER_D3D (0 << 27) -# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) -# define RADEON_ROUND_MODE_TRUNC (0 << 28) -# define RADEON_ROUND_MODE_ROUND (1 << 28) -# define RADEON_ROUND_MODE_ROUND_EVEN (2 << 28) -# define RADEON_ROUND_MODE_ROUND_ODD (3 << 28) -# define RADEON_ROUND_PREC_16TH_PIX (0 << 30) -# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) -# define RADEON_ROUND_PREC_4TH_PIX (2 << 30) -# define RADEON_ROUND_PREC_HALF_PIX (3 << 30) - -#define R200_REG_RE_CNTL 0x1c50 - -#define RADEON_REG_SE_COORD_FMT 0x1c50 -# define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0) -# define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1) -# define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8) -# define RADEON_VTX_ST1_NONPARAMETRIC (1 << 9) -# define RADEON_VTX_ST2_NONPARAMETRIC (1 << 10) -# define RADEON_VTX_ST3_NONPARAMETRIC (1 << 11) -# define RADEON_VTX_W0_NORMALIZE (1 << 12) -# define RADEON_VTX_W0_IS_NOT_1_OVER_W0 (1 << 16) -# define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17) -# define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19) -# define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21) -# define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23) -# define RADEON_TEX1_W_ROUTING_USE_W0 (0 << 26) -# define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26) - -#define RADEON_REG_PP_TXFILTER_0 0x1c54 -#define RADEON_REG_PP_TXFILTER_1 0x1c6c -#define RADEON_REG_PP_TXFILTER_2 0x1c84 -# define RADEON_MAG_FILTER_NEAREST (0 << 0) -# define RADEON_MAG_FILTER_LINEAR (1 << 0) -# define RADEON_MAG_FILTER_MASK (1 << 0) -# define RADEON_MIN_FILTER_NEAREST (0 << 1) -# define RADEON_MIN_FILTER_LINEAR (1 << 1) -# define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1) -# define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1) -# define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1) -# define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1) -# define RADEON_MIN_FILTER_ANISO_NEAREST (8 << 1) -# define RADEON_MIN_FILTER_ANISO_LINEAR (9 << 1) -# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1) -# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1) -# define RADEON_MIN_FILTER_MASK (15 << 1) -# define RADEON_MAX_ANISO_1_TO_1 (0 << 5) -# define RADEON_MAX_ANISO_2_TO_1 (1 << 5) -# define RADEON_MAX_ANISO_4_TO_1 (2 << 5) -# define RADEON_MAX_ANISO_8_TO_1 (3 << 5) -# define RADEON_MAX_ANISO_16_TO_1 (4 << 5) -# define RADEON_MAX_ANISO_MASK (7 << 5) -# define RADEON_LOD_BIAS_MASK (0xff << 8) -# define RADEON_LOD_BIAS_SHIFT 8 -# define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16) -# define RADEON_MAX_MIP_LEVEL_SHIFT 16 -# define RADEON_YUV_TO_RGB (1 << 20) -# define RADEON_YUV_TEMPERATURE_COOL (0 << 21) -# define RADEON_YUV_TEMPERATURE_HOT (1 << 21) -# define RADEON_YUV_TEMPERATURE_MASK (1 << 21) -# define RADEON_WRAPEN_S (1 << 22) -# define RADEON_CLAMP_S_WRAP (0 << 23) -# define RADEON_CLAMP_S_MIRROR (1 << 23) -# define RADEON_CLAMP_S_CLAMP_LAST (2 << 23) -# define RADEON_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23) -# define RADEON_CLAMP_S_CLAMP_BORDER (4 << 23) -# define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23) -# define RADEON_CLAMP_S_CLAMP_GL (6 << 23) -# define RADEON_CLAMP_S_MIRROR_CLAMP_GL (7 << 23) -# define RADEON_CLAMP_S_MASK (7 << 23) -# define RADEON_WRAPEN_T (1 << 26) -# define RADEON_CLAMP_T_WRAP (0 << 27) -# define RADEON_CLAMP_T_MIRROR (1 << 27) -# define RADEON_CLAMP_T_CLAMP_LAST (2 << 27) -# define RADEON_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27) -# define RADEON_CLAMP_T_CLAMP_BORDER (4 << 27) -# define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27) -# define RADEON_CLAMP_T_CLAMP_GL (6 << 27) -# define RADEON_CLAMP_T_MIRROR_CLAMP_GL (7 << 27) -# define RADEON_CLAMP_T_MASK (7 << 27) -# define RADEON_BORDER_MODE_OGL (0 << 31) -# define RADEON_BORDER_MODE_D3D (1 << 31) - -#define RADEON_REG_PP_TXFORMAT_0 0x1c58 -#define RADEON_REG_PP_TXFORMAT_1 0x1c70 -#define RADEON_REG_PP_TXFORMAT_2 0x1c88 -# define RADEON_TXFORMAT_I8 (0 << 0) -# define RADEON_TXFORMAT_AI88 (1 << 0) -# define RADEON_TXFORMAT_RGB332 (2 << 0) -# define RADEON_TXFORMAT_ARGB1555 (3 << 0) -# define RADEON_TXFORMAT_RGB565 (4 << 0) -# define RADEON_TXFORMAT_ARGB4444 (5 << 0) -# define RADEON_TXFORMAT_ARGB8888 (6 << 0) -# define RADEON_TXFORMAT_RGBA8888 (7 << 0) -# define RADEON_TXFORMAT_Y8 (8 << 0) -# define RADEON_TXFORMAT_AYUV444 (9 << 0) -# define RADEON_TXFORMAT_VYUY422 (10 << 0) -# define RADEON_TXFORMAT_YVYU422 (11 << 0) -# define RADEON_TXFORMAT_DXT1 (12 << 0) -# define RADEON_TXFORMAT_DXT23 (14 << 0) -# define RADEON_TXFORMAT_DXT45 (15 << 0) -# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0) -# define RADEON_TXFORMAT_FORMAT_SHIFT 0 -# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5) -# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6) -# define RADEON_TXFORMAT_NON_POWER2 (1 << 7) -# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8) -# define RADEON_TXFORMAT_WIDTH_SHIFT 8 -# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12) -# define RADEON_TXFORMAT_HEIGHT_SHIFT 12 -# define RADEON_TXFORMAT_F5_WIDTH_MASK (15 << 16) -# define RADEON_TXFORMAT_F5_WIDTH_SHIFT 16 -# define RADEON_TXFORMAT_F5_HEIGHT_MASK (15 << 20) -# define RADEON_TXFORMAT_F5_HEIGHT_SHIFT 20 -# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) -# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) -# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24) -# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24) -# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26) -# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26) -# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26) -# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26) -# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) -# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) -# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) -# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31) - -#define RADEON_REG_PP_TXOFFSET_0 0x1c5c -#define RADEON_REG_PP_TXOFFSET_1 0x1c74 -#define RADEON_REG_PP_TXOFFSET_2 0x1c8c -# define RADEON_TXO_ENDIAN_NO_SWAP (0 << 0) -# define RADEON_TXO_ENDIAN_BYTE_SWAP (1 << 0) -# define RADEON_TXO_ENDIAN_WORD_SWAP (2 << 0) -# define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0) -# define RADEON_TXO_MACRO_LINEAR (0 << 2) -# define RADEON_TXO_MACRO_TILE (1 << 2) -# define RADEON_TXO_MICRO_LINEAR (0 << 3) -# define RADEON_TXO_MICRO_TILE_X2 (1 << 3) -# define RADEON_TXO_MICRO_TILE_OPT (2 << 3) -# define RADEON_TXO_OFFSET_MASK 0xffffffe0 -# define RADEON_TXO_OFFSET_SHIFT 5 - -#define RADEON_REG_PP_TXCBLEND_0 0x1c60 -#define RADEON_REG_PP_TXCBLEND_1 0x1c78 -#define RADEON_REG_PP_TXCBLEND_2 0x1c90 -# define RADEON_COLOR_ARG_A_SHIFT 0 -# define RADEON_COLOR_ARG_A_MASK (0x1f << 0) -# define RADEON_COLOR_ARG_A_ZERO (0 << 0) -# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0) -# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0) -# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0) -# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0) -# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0) -# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0) -# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0) -# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0) -# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0) -# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0) -# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0) -# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0) -# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0) -# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0) -# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0) -# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0) -# define RADEON_COLOR_ARG_B_SHIFT 5 -# define RADEON_COLOR_ARG_B_MASK (0x1f << 5) -# define RADEON_COLOR_ARG_B_ZERO (0 << 5) -# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5) -# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5) -# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5) -# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5) -# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5) -# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5) -# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5) -# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5) -# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5) -# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5) -# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5) -# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5) -# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5) -# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5) -# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5) -# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5) -# define RADEON_COLOR_ARG_C_SHIFT 10 -# define RADEON_COLOR_ARG_C_MASK (0x1f << 10) -# define RADEON_COLOR_ARG_C_ZERO (0 << 10) -# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10) -# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10) -# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10) -# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10) -# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10) -# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10) -# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10) -# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10) -# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10) -# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10) -# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10) -# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10) -# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10) -# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10) -# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10) -# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10) -# define RADEON_COMP_ARG_A (1 << 15) -# define RADEON_COMP_ARG_A_SHIFT 15 -# define RADEON_COMP_ARG_B (1 << 16) -# define RADEON_COMP_ARG_B_SHIFT 16 -# define RADEON_COMP_ARG_C (1 << 17) -# define RADEON_COMP_ARG_C_SHIFT 17 -# define RADEON_BLEND_CTL_MASK (7 << 18) -# define RADEON_BLEND_CTL_ADD (0 << 18) -# define RADEON_BLEND_CTL_SUBTRACT (1 << 18) -# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18) -# define RADEON_BLEND_CTL_BLEND (3 << 18) -# define RADEON_BLEND_CTL_DOT3 (4 << 18) -# define RADEON_SCALE_SHIFT 21 -# define RADEON_SCALE_MASK (3 << 21) -# define RADEON_SCALE_1X (0 << 21) -# define RADEON_SCALE_2X (1 << 21) -# define RADEON_SCALE_4X (2 << 21) -# define RADEON_CLAMP_TX (1 << 23) -# define RADEON_T0_EQ_TCUR (1 << 24) -# define RADEON_T1_EQ_TCUR (1 << 25) -# define RADEON_T2_EQ_TCUR (1 << 26) -# define RADEON_T3_EQ_TCUR (1 << 27) -# define RADEON_COLOR_ARG_MASK 0x1f -# define RADEON_COMP_ARG_SHIFT 15 - -#define RADEON_REG_PP_TXABLEND_0 0x1c64 -#define RADEON_REG_PP_TXABLEND_1 0x1c7c -#define RADEON_REG_PP_TXABLEND_2 0x1c94 -# define RADEON_ALPHA_ARG_A_SHIFT 0 -# define RADEON_ALPHA_ARG_A_MASK (0xf << 0) -# define RADEON_ALPHA_ARG_A_ZERO (0 << 0) -# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0) -# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0) -# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0) -# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0) -# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0) -# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0) -# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0) -# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0) -# define RADEON_ALPHA_ARG_B_SHIFT 4 -# define RADEON_ALPHA_ARG_B_MASK (0xf << 4) -# define RADEON_ALPHA_ARG_B_ZERO (0 << 4) -# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4) -# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4) -# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4) -# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4) -# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4) -# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4) -# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4) -# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4) -# define RADEON_ALPHA_ARG_C_SHIFT 8 -# define RADEON_ALPHA_ARG_C_MASK (0xf << 8) -# define RADEON_ALPHA_ARG_C_ZERO (0 << 8) -# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8) -# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8) -# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8) -# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8) -# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8) -# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8) -# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8) -# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8) -# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9) -/* COMP_ARG, BLEND_CNTL, CLAMP_TX same as for CBLEND, T*_EQ_TCUR */ -# define RADEON_ALPHA_ARG_MASK 0xf - -#define RADEON_REG_PP_TFACTOR_0 0x1c68 -#define RADEON_REG_PP_TFACTOR_1 0x1c80 -#define RADEON_REG_PP_TFACTOR_2 0x1c98 - -#define R128_REG_TEX_CNTL_C 0x1c9c -# define R128_Z_ENABLE (1 << 0) -# define R128_Z_WRITE_ENABLE (1 << 1) -# define R128_STENCIL_ENABLE (1 << 3) -# define R128_SHADE_ENABLE (0 << 4) -# define R128_TEXMAP_ENABLE (1 << 4) -# define R128_SEC_TEXMAP_ENABLE (1 << 5) -# define R128_FOG_ENABLE (1 << 7) -# define R128_DITHER_ENABLE (1 << 8) -# define R128_ALPHA_ENABLE (1 << 9) -# define R128_ALPHA_TEST_ENABLE (1 << 10) -# define R128_SPEC_LIGHT_ENABLE (1 << 11) -# define R128_TEX_CHROMA_KEY_ENABLE (1 << 12) -# define R128_ALPHA_IN_TEX_COMPLETE_A (0 << 13) -# define R128_ALPHA_IN_TEX_LSB_A (1 << 13) -# define R128_LIGHT_DIS (0 << 14) -# define R128_LIGHT_COPY (1 << 14) -# define R128_LIGHT_MODULATE (2 << 14) -# define R128_LIGHT_ADD (3 << 14) -# define R128_LIGHT_BLEND_CONSTANT (4 << 14) -# define R128_LIGHT_BLEND_TEXTURE (5 << 14) -# define R128_LIGHT_BLEND_VERTEX (6 << 14) -# define R128_LIGHT_BLEND_CONST_COLOR (7 << 14) -# define R128_ALPHA_LIGHT_DIS (0 << 18) -# define R128_ALPHA_LIGHT_COPY (1 << 18) -# define R128_ALPHA_LIGHT_MODULATE (2 << 18) -# define R128_ALPHA_LIGHT_ADD (3 << 18) -# define R128_ANTI_ALIAS (1 << 21) -# define R128_TEX_CACHE_FLUSH (1 << 23) -# define R128_LOD_BIAS_SHIFT 24 -# define R128_LOD_BIAS_MASK (0xff << 24) - -#define R128_REG_MISC_3D_STATE_CNTL 0x1ca0 -# define R128_REF_ALPHA_MASK 0xff -# define R128_MISC_SCALE_3D_NOOP (0 << 8) -# define R128_MISC_SCALE_3D_SCALE (1 << 8) -# define R128_MISC_SCALE_3D_TEXMAP_SHADE (2 << 8) -# define R128_MISC_SCALE_PIX_BLEND (0 << 10) -# define R128_MISC_SCALE_PIX_REPLICATE (1 << 10) -# define R128_ALPHA_COMB_ADD_CLAMP (0 << 12) -# define R128_ALPHA_COMB_ADD_NO_CLAMP (1 << 12) -# define R128_ALPHA_COMB_SUB_SRC_DST_CLAMP (2 << 12) -# define R128_ALPHA_COMB_SUB_SRC_DST_NO_CLAMP (3 << 12) -# define R128_FOG_VERTEX (0 << 14) -# define R128_FOG_TABLE (1 << 14) -# define R128_SBLEND_ZERO (0 << 16) -# define R128_SBLEND_ONE (1 << 16) -# define R128_SBLEND_SRCCOLOR (2 << 16) -# define R128_SBLEND_INVSRCCOLOR (3 << 16) -# define R128_SBLEND_SRC_ALPHA (4 << 16) -# define R128_SBLEND_INV_SRC_ALPHA (5 << 16) -# define R128_SBLEND_DST_ALPHA (6 << 16) -# define R128_SBLEND_INV_DST_ALPHA (7 << 16) -# define R128_SBLEND_DSTCOLOR (8 << 16) -# define R128_SBLEND_INVDSTCOLOR (9 << 16) -# define R128_SBLEND_SRC_ALPHASAT (10 << 16) -# define R128_SBLEND_BOTHSRC_ALPHA (11 << 16) -# define R128_SBLEND_BOTHINV_SRC_ALPHA (12 << 16) -# define R128_SBLEND_MASK (15 << 16) -# define R128_DBLEND_ZERO (0 << 20) -# define R128_DBLEND_ONE (1 << 20) -# define R128_DBLEND_SRCCOLOR (2 << 20) -# define R128_DBLEND_INVSRCCOLOR (3 << 20) -# define R128_DBLEND_SRC_ALPHA (4 << 20) -# define R128_DBLEND_INV_SRC_ALPHA (5 << 20) -# define R128_DBLEND_DST_ALPHA (6 << 20) -# define R128_DBLEND_INV_DST_ALPHA (7 << 20) -# define R128_DBLEND_DSTCOLOR (8 << 20) -# define R128_DBLEND_INVDSTCOLOR (9 << 20) -# define R128_DBLEND_SRC_ALPHASAT (10 << 20) -# define R128_DBLEND_MASK (15 << 20) -# define R128_ALPHA_TEST_NEVER (0 << 24) -# define R128_ALPHA_TEST_LESS (1 << 24) -# define R128_ALPHA_TEST_LESSEQUAL (2 << 24) -# define R128_ALPHA_TEST_EQUAL (3 << 24) -# define R128_ALPHA_TEST_GREATEREQUAL (4 << 24) -# define R128_ALPHA_TEST_GREATER (5 << 24) -# define R128_ALPHA_TEST_NEQUAL (6 << 24) -# define R128_ALPHA_TEST_ALWAYS (7 << 24) -# define R128_ALPHA_TEST_MASK (7 << 24) - -#define R128_REG_PRIM_TEX_CNTL_C 0x1cb0 -#define R128_REG_SEC_TEX_CNTL_C 0x1d00 -# define R128_SEC_SELECT_PRIM_ST (0 << 0) -# define R128_SEC_SELECT_SEC_ST (1 << 0) -# define R128_MIN_BLEND_NEAREST (0 << 1) -# define R128_MIN_BLEND_LINEAR (1 << 1) -# define R128_MIN_BLEND_MIPNEAREST (2 << 1) -# define R128_MIN_BLEND_MIPLINEAR (3 << 1) -# define R128_MIN_BLEND_LINEARMIPNEAREST (4 << 1) -# define R128_MIN_BLEND_LINEARMIPLINEAR (5 << 1) -# define R128_MIN_BLEND_MASK (7 << 1) -# define R128_MAG_BLEND_NEAREST (0 << 4) -# define R128_MAG_BLEND_LINEAR (1 << 4) -# define R128_MAG_BLEND_MASK (7 << 4) -# define R128_MIP_MAP_DISABLE (1 << 7) -# define R128_TEX_CLAMP_S_WRAP (0 << 8) -# define R128_TEX_CLAMP_S_MIRROR (1 << 8) -# define R128_TEX_CLAMP_S_CLAMP (2 << 8) -# define R128_TEX_CLAMP_S_BORDER_COLOR (3 << 8) -# define R128_TEX_CLAMP_S_MASK (3 << 8) -# define R128_TEX_WRAP_S (1 << 10) -# define R128_TEX_CLAMP_T_WRAP (0 << 11) -# define R128_TEX_CLAMP_T_MIRROR (1 << 11) -# define R128_TEX_CLAMP_T_CLAMP (2 << 11) -# define R128_TEX_CLAMP_T_BORDER_COLOR (3 << 11) -# define R128_TEX_CLAMP_T_MASK (3 << 11) -# define R128_TEX_WRAP_T (1 << 13) -# define R128_TEX_PERSPECTIVE_DISABLE (1 << 14) -# define R128_TEX_DATATYPE_SHIFT 16 -# define R128_PALLETE_EITHER (0 << 20) -# define R128_PALLETE_1 (1 << 20) -# define R128_PALLETE_2 (2 << 20) -# define R128_PSEUDOCOLOR_DT_RGB565 (0 << 24) -# define R128_PSEUDOCOLOR_DT_ARGB1555 (1 << 24) -# define R128_PSEUDOCOLOR_DT_ARGB4444 (2 << 24) - -#define R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4 -#define R128_REG_SEC_TEXTURE_COMBINE_CNTL_C 0x1d04 -# define R128_COMB_DIS (0 << 0) -# define R128_COMB_COPY (1 << 0) -# define R128_COMB_COPY_INP (2 << 0) -# define R128_COMB_MODULATE (3 << 0) -# define R128_COMB_MODULATE2X (4 << 0) -# define R128_COMB_MODULATE4X (5 << 0) -# define R128_COMB_ADD (6 << 0) -# define R128_COMB_ADD_SIGNED (7 << 0) -# define R128_COMB_BLEND_VERTEX (8 << 0) -# define R128_COMB_BLEND_TEXTURE (9 << 0) -# define R128_COMB_BLEND_CONST (10 << 0) -# define R128_COMB_BLEND_PREMULT (11 << 0) -# define R128_COMB_BLEND_PREV (12 << 0) -# define R128_COMB_BLEND_PREMULT_INV (13 << 0) -# define R128_COMB_ADD_SIGNED2X (14 << 0) -# define R128_COMB_BLEND_CONST_COLOR (15 << 0) -# define R128_COMB_MASK (15 << 0) -# define R128_COLOR_FACTOR_CONST_COLOR (0 << 4) -# define R128_COLOR_FACTOR_NCONST_COLOR (1 << 4) -# define R128_COLOR_FACTOR_TEX (4 << 4) -# define R128_COLOR_FACTOR_NTEX (5 << 4) -# define R128_COLOR_FACTOR_ALPHA (6 << 4) -# define R128_COLOR_FACTOR_NALPHA (7 << 4) -# define R128_COLOR_FACTOR_PREV_COLOR (8 << 4) -# define R128_COLOR_FACTOR_MASK (15 << 4) -# define R128_COMB_FCN_MSB (1 << 8) -# define R128_INPUT_FACTOR_CONST_COLOR (2 << 10) -# define R128_INPUT_FACTOR_CONST_ALPHA (3 << 10) -# define R128_INPUT_FACTOR_INT_COLOR (4 << 10) -# define R128_INPUT_FACTOR_INT_ALPHA (5 << 10) -# define R128_INPUT_FACTOR_PREV_COLOR (8 << 10) /* SEC only */ -# define R128_INPUT_FACTOR_PREV_ALPHA (9 << 10) /* SEC only */ -# define R128_INPUT_FACTOR_MASK (15 << 10) -# define R128_COMB_ALPHA_DIS (0 << 14) -# define R128_COMB_ALPHA_COPY (1 << 14) -# define R128_COMB_ALPHA_COPY_INP (2 << 14) -# define R128_COMB_ALPHA_MODULATE (3 << 14) -# define R128_COMB_ALPHA_MODULATE2X (4 << 14) -# define R128_COMB_ALPHA_MODULATE4X (5 << 14) -# define R128_COMB_ALPHA_ADD (6 << 14) -# define R128_COMB_ALPHA_ADD_SIGNED (7 << 14) -# define R128_COMB_ALPHA_ADD_SIGNED2X (14 << 14) -# define R128_COMB_ALPHA_MASK (15 << 14) -# define R128_ALPHA_FACTOR_TEX_ALPHA (6 << 18) -# define R128_ALPHA_FACTOR_NTEX_ALPHA (7 << 18) -# define R128_ALPHA_FACTOR_MASK (15 << 18) -# define R128_INP_FACTOR_A_CONST_ALPHA (1 << 25) -# define R128_INP_FACTOR_A_INT_ALPHA (2 << 25) -# define R128_INP_FACTOR_A_PREV_ALPHA (4 << 25) /* SEC only */ -# define R128_INP_FACTOR_A_MASK (7 << 25) - -#define R128_REG_TEX_SIZE_PITCH_C 0x1cb8 -# define R128_TEX_PITCH_SHIFT 0 -# define R128_TEX_SIZE_SHIFT 4 -# define R128_TEX_HEIGHT_SHIFT 8 -# define R128_TEX_MIN_SIZE_SHIFT 12 -# define R128_SEC_TEX_PITCH_SHIFT 16 -# define R128_SEC_TEX_SIZE_SHIFT 20 -# define R128_SEC_TEX_HEIGHT_SHIFT 24 -# define R128_SEC_TEX_MIN_SIZE_SHIFT 28 -# define R128_TEX_PITCH_MASK (0x0f << 0) -# define R128_TEX_SIZE_MASK (0x0f << 4) -# define R128_TEX_HEIGHT_MASK (0x0f << 8) -# define R128_TEX_MIN_SIZE_MASK (0x0f << 12) -# define R128_SEC_TEX_PITCH_MASK (0x0f << 16) -# define R128_SEC_TEX_SIZE_MASK (0x0f << 20) -# define R128_SEC_TEX_HEIGHT_MASK (0x0f << 24) -# define R128_SEC_TEX_MIN_SIZE_MASK (0x0f << 28) -# define R128_TEX_SIZE_PITCH_SHIFT 0 -# define R128_SEC_TEX_SIZE_PITCH_SHIFT 16 -# define R128_TEX_SIZE_PITCH_MASK (0xffff << 0) -# define R128_SEC_TEX_SIZE_PITCH_MASK (0xffff << 16) - -#define R128_REG_PRIM_TEX_0_OFFSET_C 0x1cbc -#define R128_REG_PRIM_TEX_1_OFFSET_C 0x1cc0 -#define R128_REG_PRIM_TEX_2_OFFSET_C 0x1cc4 -#define R128_REG_PRIM_TEX_3_OFFSET_C 0x1cc8 -#define R128_REG_PRIM_TEX_4_OFFSET_C 0x1ccc -#define R128_REG_PRIM_TEX_5_OFFSET_C 0x1cd0 -#define R128_REG_PRIM_TEX_6_OFFSET_C 0x1cd4 -#define R128_REG_PRIM_TEX_7_OFFSET_C 0x1cd8 -#define R128_REG_PRIM_TEX_8_OFFSET_C 0x1cdc -#define R128_REG_PRIM_TEX_9_OFFSET_C 0x1ce0 -#define R128_REG_PRIM_TEX_10_OFFSET_C 0x1ce4 -#define R128_REG_SEC_TEX_0_OFFSET_C 0x1d08 -#define R128_REG_SEC_TEX_1_OFFSET_C 0x1d0c -#define R128_REG_SEC_TEX_2_OFFSET_C 0x1d10 -#define R128_REG_SEC_TEX_3_OFFSET_C 0x1d14 -#define R128_REG_SEC_TEX_4_OFFSET_C 0x1d18 -#define R128_REG_SEC_TEX_5_OFFSET_C 0x1d1c -#define R128_REG_SEC_TEX_6_OFFSET_C 0x1d20 -#define R128_REG_SEC_TEX_7_OFFSET_C 0x1d24 -#define R128_REG_SEC_TEX_8_OFFSET_C 0x1d28 -#define R128_REG_SEC_TEX_9_OFFSET_C 0x1d2c -#define R128_REG_SEC_TEX_10_OFFSET_C 0x1d30 -# define R128_TEX_NO_TILE (0 << 30) -# define R128_TEX_TILED_BY_HOST (1 << 30) -# define R128_TEX_TILED_BY_STORAGE (2 << 30) -# define R128_TEX_TILED_BY_STORAGE2 (3 << 30) -#define R128_REG_CONSTANT_COLOR_C 0x1d34 -# define R128_CONSTANT_BLUE_SHIFT 0 -# define R128_CONSTANT_GREEN_SHIFT 8 -# define R128_CONSTANT_RED_SHIFT 16 -# define R128_CONSTANT_ALPHA_SHIFT 24 - -#define RADEON_REG_PP_TEX_SIZE_0 0x1d04 /* NPOT */ -#define RADEON_REG_PP_TEX_SIZE_1 0x1d0c /* NPOT */ -#define RADEON_REG_PP_TEX_SIZE_2 0x1d14 /* NPOT */ -# define RADEON_TEX_USIZE_MASK (0x7ff << 0) -# define RADEON_TEX_USIZE_SHIFT 0 -# define RADEON_TEX_VSIZE_MASK (0x7ff << 16) -# define RADEON_TEX_VSIZE_SHIFT 16 -# define RADEON_SIGNED_RGB_MASK (1 << 30) -# define RADEON_SIGNED_RGB_SHIFT 30 -# define RADEON_SIGNED_ALPHA_MASK (1 << 31) -# define RADEON_SIGNED_ALPHA_SHIFT 31 - -#define RADEON_REG_PP_TEX_PITCH_0 0x1d08 /* NPOT */ -#define RADEON_REG_PP_TEX_PITCH_1 0x1d10 /* NPOT */ -#define RADEON_REG_PP_TEX_PITCH_2 0x1d18 /* NPOT */ -/* note: bits 13-5: 32 byte aligned stride of texture map */ - -#define R128_REG_PLANE_3D_MASK_C 0x1d44 - -#define RADEON_REG_RB3D_PLANEMASK 0x1d84 - -#define R200_REG_SE_VAP_CNTL 0x2080 -# define R200_VAP_TCL_ENABLE 0x00000001 -# define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010 -# define R200_VAP_FORCE_W_TO_ONE 0x00010000 -# define R200_VAP_D3D_TEX_DEFAULT 0x00020000 -# define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18 -# define R200_VAP_VF_MAX_VTX_NUM (9 << 18) -# define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000 - -#define R200_REG_SE_VTX_FMT_0 0x2088 -# define R200_VTX_XY 0 /* always have xy */ -# define R200_VTX_Z0 (1 << 0) -# define R200_VTX_W0 (1 << 1) -# define R200_VTX_WEIGHT_COUNT_SHIFT (2) -# define R200_VTX_PV_MATRIX_SEL (1 << 5) -# define R200_VTX_N0 (1 << 6) -# define R200_VTX_POINT_SIZE (1 << 7) -# define R200_VTX_DISCRETE_FOG (1 << 8) -# define R200_VTX_SHININESS_0 (1 << 9) -# define R200_VTX_SHININESS_1 (1 << 10) -# define R200_VTX_COLOR_NOT_PRESENT 0 -# define R200_VTX_PK_RGBA 1 -# define R200_VTX_FP_RGB 2 -# define R200_VTX_FP_RGBA 3 -# define R200_VTX_COLOR_MASK 3 -# define R200_VTX_COLOR_0_SHIFT 11 -# define R200_VTX_COLOR_1_SHIFT 13 -# define R200_VTX_COLOR_2_SHIFT 15 -# define R200_VTX_COLOR_3_SHIFT 17 -# define R200_VTX_COLOR_4_SHIFT 19 -# define R200_VTX_COLOR_5_SHIFT 21 -# define R200_VTX_COLOR_6_SHIFT 23 -# define R200_VTX_COLOR_7_SHIFT 25 -# define R200_VTX_XY1 (1 << 28) -# define R200_VTX_Z1 (1 << 29) -# define R200_VTX_W1 (1 << 30) -# define R200_VTX_N1 (1 << 31) - -#define R200_REG_SE_VTX_FMT_1 0x208c -# define R200_VTX_TEX0_COMP_CNT_SHIFT 0 -# define R200_VTX_TEX1_COMP_CNT_SHIFT 3 -# define R200_VTX_TEX2_COMP_CNT_SHIFT 6 -# define R200_VTX_TEX3_COMP_CNT_SHIFT 9 -# define R200_VTX_TEX4_COMP_CNT_SHIFT 12 -# define R200_VTX_TEX5_COMP_CNT_SHIFT 15 - -#define R200_REG_SE_VTE_CNTL 0x20b0 -# define R200_VPORT_X_SCALE_ENA 0x00000001 -# define R200_VPORT_X_OFFSET_ENA 0x00000002 -# define R200_VPORT_Y_SCALE_ENA 0x00000004 -# define R200_VPORT_Y_OFFSET_ENA 0x00000008 -# define R200_VPORT_Z_SCALE_ENA 0x00000010 -# define R200_VPORT_Z_OFFSET_ENA 0x00000020 -# define R200_VTX_XY_FMT 0x00000100 -# define R200_VTX_Z_FMT 0x00000200 -# define R200_VTX_W0_FMT 0x00000400 -# define R200_VTX_W0_NORMALIZE 0x00000800 -# define R200_VTX_ST_DENORMALIZED 0x00001000 - -#define R200_REG_SE_VAP_CNTL_STATUS 0x2140 -#define RADEON_REG_SE_CNTL_STATUS 0x2140 -# define RADEON_VC_NO_SWAP (0 << 0) -# define RADEON_VC_16BIT_SWAP (1 << 0) -# define RADEON_VC_32BIT_SWAP (2 << 0) -# define RADEON_VC_HALF_DWORD_SWAP (3 << 0) -# define RADEON_TCL_BYPASS (1 << 8) - -#define R200_REG_SE_VTX_STATE_CNTL 0x2180 - -#define RADEON_REG_RE_TOP_LEFT 0x26c0 - -#define R200_REG_RE_AUX_SCISSOR_CNTL 0x26f0 - -#define R200_REG_PP_TXFILTER_0 0x2c00 -#define R200_REG_PP_TXFILTER_1 0x2c20 -#define R200_REG_PP_TXFILTER_2 0x2c40 -#define R200_REG_PP_TXFILTER_3 0x2c60 -#define R200_REG_PP_TXFILTER_4 0x2c80 -#define R200_REG_PP_TXFILTER_5 0x2ca0 -# define R200_MAG_FILTER_NEAREST (0 << 0) -# define R200_MAG_FILTER_LINEAR (1 << 0) -# define R200_MAG_FILTER_MASK (1 << 0) -# define R200_MIN_FILTER_NEAREST (0 << 1) -# define R200_MIN_FILTER_LINEAR (1 << 1) -# define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1) -# define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1) -# define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1) -# define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1) -# define R200_MIN_FILTER_ANISO_NEAREST (8 << 1) -# define R200_MIN_FILTER_ANISO_LINEAR (9 << 1) -# define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1) -# define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1) -# define R200_MIN_FILTER_MASK (15 << 1) -# define R200_MAX_ANISO_1_TO_1 (0 << 5) -# define R200_MAX_ANISO_2_TO_1 (1 << 5) -# define R200_MAX_ANISO_4_TO_1 (2 << 5) -# define R200_MAX_ANISO_8_TO_1 (3 << 5) -# define R200_MAX_ANISO_16_TO_1 (4 << 5) -# define R200_MAX_ANISO_MASK (7 << 5) -# define R200_MAX_MIP_LEVEL_MASK (0x0f << 16) -# define R200_MAX_MIP_LEVEL_SHIFT 16 -# define R200_YUV_TO_RGB (1 << 20) -# define R200_YUV_TEMPERATURE_COOL (0 << 21) -# define R200_YUV_TEMPERATURE_HOT (1 << 21) -# define R200_YUV_TEMPERATURE_MASK (1 << 21) -# define R200_WRAPEN_S (1 << 22) -# define R200_CLAMP_S_WRAP (0 << 23) -# define R200_CLAMP_S_MIRROR (1 << 23) -# define R200_CLAMP_S_CLAMP_LAST (2 << 23) -# define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23) -# define R200_CLAMP_S_CLAMP_BORDER (4 << 23) -# define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23) -# define R200_CLAMP_S_CLAMP_GL (6 << 23) -# define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23) -# define R200_CLAMP_S_MASK (7 << 23) -# define R200_WRAPEN_T (1 << 26) -# define R200_CLAMP_T_WRAP (0 << 27) -# define R200_CLAMP_T_MIRROR (1 << 27) -# define R200_CLAMP_T_CLAMP_LAST (2 << 27) -# define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27) -# define R200_CLAMP_T_CLAMP_BORDER (4 << 27) -# define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27) -# define R200_CLAMP_T_CLAMP_GL (6 << 27) -# define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27) -# define R200_CLAMP_T_MASK (7 << 27) -# define R200_KILL_LT_ZERO (1 << 30) -# define R200_BORDER_MODE_OGL (0 << 31) -# define R200_BORDER_MODE_D3D (1 << 31) - -#define R200_REG_PP_TXFORMAT_0 0x2c04 -#define R200_REG_PP_TXFORMAT_1 0x2c24 -#define R200_REG_PP_TXFORMAT_2 0x2c44 -#define R200_REG_PP_TXFORMAT_3 0x2c64 -#define R200_REG_PP_TXFORMAT_4 0x2c84 -#define R200_REG_PP_TXFORMAT_5 0x2ca4 -# define R200_TXFORMAT_I8 (0 << 0) -# define R200_TXFORMAT_AI88 (1 << 0) -# define R200_TXFORMAT_RGB332 (2 << 0) -# define R200_TXFORMAT_ARGB1555 (3 << 0) -# define R200_TXFORMAT_RGB565 (4 << 0) -# define R200_TXFORMAT_ARGB4444 (5 << 0) -# define R200_TXFORMAT_ARGB8888 (6 << 0) -# define R200_TXFORMAT_RGBA8888 (7 << 0) -# define R200_TXFORMAT_Y8 (8 << 0) -# define R200_TXFORMAT_AVYU4444 (9 << 0) -# define R200_TXFORMAT_VYUY422 (10 << 0) -# define R200_TXFORMAT_YVYU422 (11 << 0) -# define R200_TXFORMAT_DXT1 (12 << 0) -# define R200_TXFORMAT_DXT23 (14 << 0) -# define R200_TXFORMAT_DXT45 (15 << 0) -# define R200_TXFORMAT_FORMAT_MASK (31 << 0) -# define R200_TXFORMAT_FORMAT_SHIFT 0 -# define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6) -# define R200_TXFORMAT_NON_POWER2 (1 << 7) -# define R200_TXFORMAT_WIDTH_MASK (15 << 8) -# define R200_TXFORMAT_WIDTH_SHIFT 8 -# define R200_TXFORMAT_HEIGHT_MASK (15 << 12) -# define R200_TXFORMAT_HEIGHT_SHIFT 12 -# define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */ -# define R200_TXFORMAT_F5_WIDTH_SHIFT 16 -# define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20) -# define R200_TXFORMAT_F5_HEIGHT_SHIFT 20 -# define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) -# define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) -# define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24) -# define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24) -# define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24) -# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) -# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) -# define R200_TXFORMAT_ST_ROUTE_SHIFT 24 -# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) -# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) -# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) - -#define R200_REG_PP_TXFORMAT_X_0 0x2c08 -#define R200_REG_PP_TXFORMAT_X_1 0x2c28 -#define R200_REG_PP_TXFORMAT_X_2 0x2c48 -#define R200_REG_PP_TXFORMAT_X_3 0x2c68 -#define R200_REG_PP_TXFORMAT_X_4 0x2c88 -#define R200_REG_PP_TXFORMAT_X_5 0x2ca8 -# define R200_DEPTH_LOG2_MASK (0xf << 0) -# define R200_DEPTH_LOG2_SHIFT 0 -# define R200_VOLUME_FILTER_SHIFT 4 -# define R200_VOLUME_FILTER_MASK (1 << 4) -# define R200_VOLUME_FILTER_NEAREST (0 << 4) -# define R200_VOLUME_FILTER_LINEAR (1 << 4) -# define R200_WRAPEN_Q (1 << 8) -# define R200_CLAMP_Q_WRAP (0 << 9) -# define R200_CLAMP_Q_MIRROR (1 << 9) -# define R200_CLAMP_Q_CLAMP_LAST (2 << 9) -# define R200_CLAMP_Q_MIRROR_CLAMP_LAST (3 << 9) -# define R200_CLAMP_Q_CLAMP_BORDER (4 << 9) -# define R200_CLAMP_Q_MIRROR_CLAMP_BORDER (5 << 9) -# define R200_CLAMP_Q_CLAMP_GL (6 << 9) -# define R200_CLAMP_Q_MIRROR_CLAMP_GL (7 << 9) -# define R200_CLAMP_Q_MASK (7 << 9) -# define R200_MIN_MIP_LEVEL_MASK (0xff << 12) -# define R200_MIN_MIP_LEVEL_SHIFT 12 -# define R200_TEXCOORD_NONPROJ (0 << 16) -# define R200_TEXCOORD_CUBIC_ENV (1 << 16) -# define R200_TEXCOORD_VOLUME (2 << 16) -# define R200_TEXCOORD_PROJ (3 << 16) -# define R200_TEXCOORD_DEPTH (4 << 16) -# define R200_TEXCOORD_1D_PROJ (5 << 16) -# define R200_TEXCOORD_1D (6 << 16) -# define R200_TEXCOORD_ZERO (7 << 16) -# define R200_TEXCOORD_MASK (7 << 16) -# define R200_LOD_BIAS_MASK (0xfff80000) -# define R200_LOD_BIAS_SHIFT 19 - -#define R200_REG_PP_TXSIZE_0 0x2c0c /* NPOT only */ -#define R200_REG_PP_TXSIZE_1 0x2c2c /* NPOT only */ -#define R200_REG_PP_TXSIZE_2 0x2c4c /* NPOT only */ -#define R200_REG_PP_TXSIZE_3 0x2c6c /* NPOT only */ -#define R200_REG_PP_TXSIZE_4 0x2c8c /* NPOT only */ -#define R200_REG_PP_TXSIZE_5 0x2cac /* NPOT only */ - -#define R200_REG_PP_TXPITCH_0 0x2c10 /* NPOT only */ -#define R200_REG_PP_TXPITCH_1 0x2c30 /* NPOT only */ -#define R200_REG_PP_TXPITCH_2 0x2c50 /* NPOT only */ -#define R200_REG_PP_TXPITCH_3 0x2c70 /* NPOT only */ -#define R200_REG_PP_TXPITCH_4 0x2c90 /* NPOT only */ -#define R200_REG_PP_TXPITCH_5 0x2cb0 /* NPOT only */ - -#define R200_REG_PP_BORDER_COLOR_0 0x2c14 -#define R200_REG_PP_TXMULTI_CTL_0 0x2c1c - -#define R200_REG_PP_CNTL_X 0x2cc4 - -#define R200_PP_TXOFFSET_0 0x2d00 -#define R200_PP_TXOFFSET_1 0x2d18 -#define R200_PP_TXOFFSET_2 0x2d30 -#define R200_PP_TXOFFSET_3 0x2d48 -#define R200_PP_TXOFFSET_4 0x2d60 -#define R200_PP_TXOFFSET_5 0x2d78 -# define R200_TXO_ENDIAN_NO_SWAP (0 << 0) -# define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0) -# define R200_TXO_ENDIAN_WORD_SWAP (2 << 0) -# define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0) -# define R200_TXO_OFFSET_MASK 0xffffffe0 -# define R200_TXO_OFFSET_SHIFT 5 - -#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04 -#define R200_PP_CUBIC_OFFSET_F2_0 0x2d08 -#define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c -#define R200_PP_CUBIC_OFFSET_F4_0 0x2d10 -#define R200_PP_CUBIC_OFFSET_F5_0 0x2d14 -#define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c -#define R200_PP_CUBIC_OFFSET_F2_1 0x2d20 -#define R200_PP_CUBIC_OFFSET_F3_1 0x2d24 -#define R200_PP_CUBIC_OFFSET_F4_1 0x2d28 -#define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c -#define R200_PP_CUBIC_OFFSET_F1_2 0x2d34 -#define R200_PP_CUBIC_OFFSET_F2_2 0x2d38 -#define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c -#define R200_PP_CUBIC_OFFSET_F4_2 0x2d40 -#define R200_PP_CUBIC_OFFSET_F5_2 0x2d44 -#define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c -#define R200_PP_CUBIC_OFFSET_F2_3 0x2d50 -#define R200_PP_CUBIC_OFFSET_F3_3 0x2d54 -#define R200_PP_CUBIC_OFFSET_F4_3 0x2d58 -#define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c -#define R200_PP_CUBIC_OFFSET_F1_4 0x2d64 -#define R200_PP_CUBIC_OFFSET_F2_4 0x2d68 -#define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c -#define R200_PP_CUBIC_OFFSET_F4_4 0x2d70 -#define R200_PP_CUBIC_OFFSET_F5_4 0x2d74 -#define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c -#define R200_PP_CUBIC_OFFSET_F2_5 0x2d80 -#define R200_PP_CUBIC_OFFSET_F3_5 0x2d84 -#define R200_PP_CUBIC_OFFSET_F4_5 0x2d88 -#define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c - -/* AKA PIXSHADER_I0_C0 */ -#define R200_REG_PP_TXCBLEND_0 0x2f00 -# define R200_TXC_ARG_A_ZERO (0) -# define R200_TXC_ARG_A_CURRENT_COLOR (2) -# define R200_TXC_ARG_A_CURRENT_ALPHA (3) -# define R200_TXC_ARG_A_DIFFUSE_COLOR (4) -# define R200_TXC_ARG_A_DIFFUSE_ALPHA (5) -# define R200_TXC_ARG_A_SPECULAR_COLOR (6) -# define R200_TXC_ARG_A_SPECULAR_ALPHA (7) -# define R200_TXC_ARG_A_TFACTOR_COLOR (8) -# define R200_TXC_ARG_A_TFACTOR_ALPHA (9) -# define R200_TXC_ARG_A_R0_COLOR (10) -# define R200_TXC_ARG_A_R0_ALPHA (11) -# define R200_TXC_ARG_A_R1_COLOR (12) -# define R200_TXC_ARG_A_R1_ALPHA (13) -# define R200_TXC_ARG_A_R2_COLOR (14) -# define R200_TXC_ARG_A_R2_ALPHA (15) -# define R200_TXC_ARG_A_R3_COLOR (16) -# define R200_TXC_ARG_A_R3_ALPHA (17) -# define R200_TXC_ARG_A_R4_COLOR (18) -# define R200_TXC_ARG_A_R4_ALPHA (19) -# define R200_TXC_ARG_A_R5_COLOR (20) -# define R200_TXC_ARG_A_R5_ALPHA (21) -# define R200_TXC_ARG_A_TFACTOR1_COLOR (26) -# define R200_TXC_ARG_A_TFACTOR1_ALPHA (27) -# define R200_TXC_ARG_A_MASK (31 << 0) -# define R200_TXC_ARG_A_SHIFT 0 -# define R200_TXC_ARG_B_ZERO (0 << 5) -# define R200_TXC_ARG_B_CURRENT_COLOR (2 << 5) -# define R200_TXC_ARG_B_CURRENT_ALPHA (3 << 5) -# define R200_TXC_ARG_B_DIFFUSE_COLOR (4 << 5) -# define R200_TXC_ARG_B_DIFFUSE_ALPHA (5 << 5) -# define R200_TXC_ARG_B_SPECULAR_COLOR (6 << 5) -# define R200_TXC_ARG_B_SPECULAR_ALPHA (7 << 5) -# define R200_TXC_ARG_B_TFACTOR_COLOR (8 << 5) -# define R200_TXC_ARG_B_TFACTOR_ALPHA (9 << 5) -# define R200_TXC_ARG_B_R0_COLOR (10 << 5) -# define R200_TXC_ARG_B_R0_ALPHA (11 << 5) -# define R200_TXC_ARG_B_R1_COLOR (12 << 5) -# define R200_TXC_ARG_B_R1_ALPHA (13 << 5) -# define R200_TXC_ARG_B_R2_COLOR (14 << 5) -# define R200_TXC_ARG_B_R2_ALPHA (15 << 5) -# define R200_TXC_ARG_B_R3_COLOR (16 << 5) -# define R200_TXC_ARG_B_R3_ALPHA (17 << 5) -# define R200_TXC_ARG_B_R4_COLOR (18 << 5) -# define R200_TXC_ARG_B_R4_ALPHA (19 << 5) -# define R200_TXC_ARG_B_R5_COLOR (20 << 5) -# define R200_TXC_ARG_B_R5_ALPHA (21 << 5) -# define R200_TXC_ARG_B_TFACTOR1_COLOR (26 << 5) -# define R200_TXC_ARG_B_TFACTOR1_ALPHA (27 << 5) -# define R200_TXC_ARG_B_MASK (31 << 5) -# define R200_TXC_ARG_B_SHIFT 5 -# define R200_TXC_ARG_C_ZERO (0 << 10) -# define R200_TXC_ARG_C_CURRENT_COLOR (2 << 10) -# define R200_TXC_ARG_C_CURRENT_ALPHA (3 << 10) -# define R200_TXC_ARG_C_DIFFUSE_COLOR (4 << 10) -# define R200_TXC_ARG_C_DIFFUSE_ALPHA (5 << 10) -# define R200_TXC_ARG_C_SPECULAR_COLOR (6 << 10) -# define R200_TXC_ARG_C_SPECULAR_ALPHA (7 << 10) -# define R200_TXC_ARG_C_TFACTOR_COLOR (8 << 10) -# define R200_TXC_ARG_C_TFACTOR_ALPHA (9 << 10) -# define R200_TXC_ARG_C_R0_COLOR (10 << 10) -# define R200_TXC_ARG_C_R0_ALPHA (11 << 10) -# define R200_TXC_ARG_C_R1_COLOR (12 << 10) -# define R200_TXC_ARG_C_R1_ALPHA (13 << 10) -# define R200_TXC_ARG_C_R2_COLOR (14 << 10) -# define R200_TXC_ARG_C_R2_ALPHA (15 << 10) -# define R200_TXC_ARG_C_R3_COLOR (16 << 10) -# define R200_TXC_ARG_C_R3_ALPHA (17 << 10) -# define R200_TXC_ARG_C_R4_COLOR (18 << 10) -# define R200_TXC_ARG_C_R4_ALPHA (19 << 10) -# define R200_TXC_ARG_C_R5_COLOR (20 << 10) -# define R200_TXC_ARG_C_R5_ALPHA (21 << 10) -# define R200_TXC_ARG_C_TFACTOR1_COLOR (26 << 10) -# define R200_TXC_ARG_C_TFACTOR1_ALPHA (27 << 10) -# define R200_TXC_ARG_C_MASK (31 << 10) -# define R200_TXC_ARG_C_SHIFT 10 -# define R200_TXC_COMP_ARG_A (1 << 16) -# define R200_TXC_COMP_ARG_A_SHIFT (16) -# define R200_TXC_BIAS_ARG_A (1 << 17) -# define R200_TXC_SCALE_ARG_A (1 << 18) -# define R200_TXC_NEG_ARG_A (1 << 19) -# define R200_TXC_COMP_ARG_B (1 << 20) -# define R200_TXC_COMP_ARG_B_SHIFT (20) -# define R200_TXC_BIAS_ARG_B (1 << 21) -# define R200_TXC_SCALE_ARG_B (1 << 22) -# define R200_TXC_NEG_ARG_B (1 << 23) -# define R200_TXC_COMP_ARG_C (1 << 24) -# define R200_TXC_COMP_ARG_C_SHIFT (24) -# define R200_TXC_BIAS_ARG_C (1 << 25) -# define R200_TXC_SCALE_ARG_C (1 << 26) -# define R200_TXC_NEG_ARG_C (1 << 27) -# define R200_TXC_OP_MADD (0 << 28) -# define R200_TXC_OP_CND0 (2 << 28) -# define R200_TXC_OP_LERP (3 << 28) -# define R200_TXC_OP_DOT3 (4 << 28) -# define R200_TXC_OP_DOT4 (5 << 28) -# define R200_TXC_OP_CONDITIONAL (6 << 28) -# define R200_TXC_OP_DOT2_ADD (7 << 28) -# define R200_TXC_OP_MASK (7 << 28) - -/* AKA PIXSHADER_I0_C1 */ -#define R200_REG_PP_TXCBLEND2_0 0x2f04 -# define R200_TXC_TFACTOR_SEL_SHIFT 0 -# define R200_TXC_TFACTOR_SEL_MASK 0x7 -# define R200_TXC_TFACTOR1_SEL_SHIFT 4 -# define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4) -# define R200_TXC_SCALE_SHIFT 8 -# define R200_TXC_SCALE_MASK (7 << 8) -# define R200_TXC_SCALE_1X (0 << 8) -# define R200_TXC_SCALE_2X (1 << 8) -# define R200_TXC_SCALE_4X (2 << 8) -# define R200_TXC_SCALE_8X (3 << 8) -# define R200_TXC_SCALE_INV2 (5 << 8) -# define R200_TXC_SCALE_INV4 (6 << 8) -# define R200_TXC_SCALE_INV8 (7 << 8) -# define R200_TXC_CLAMP_SHIFT 12 -# define R200_TXC_CLAMP_MASK (3 << 12) -# define R200_TXC_CLAMP_WRAP (0 << 12) -# define R200_TXC_CLAMP_0_1 (1 << 12) -# define R200_TXC_CLAMP_8_8 (2 << 12) -# define R200_TXC_OUTPUT_REG_MASK (7 << 16) -# define R200_TXC_OUTPUT_REG_NONE (0 << 16) -# define R200_TXC_OUTPUT_REG_R0 (1 << 16) -# define R200_TXC_OUTPUT_REG_R1 (2 << 16) -# define R200_TXC_OUTPUT_REG_R2 (3 << 16) -# define R200_TXC_OUTPUT_REG_R3 (4 << 16) -# define R200_TXC_OUTPUT_REG_R4 (5 << 16) -# define R200_TXC_OUTPUT_REG_R5 (6 << 16) -# define R200_TXC_OUTPUT_MASK_MASK (7 << 20) -# define R200_TXC_OUTPUT_MASK_RGB (0 << 20) -# define R200_TXC_OUTPUT_MASK_RG (1 << 20) -# define R200_TXC_OUTPUT_MASK_RB (2 << 20) -# define R200_TXC_OUTPUT_MASK_R (3 << 20) -# define R200_TXC_OUTPUT_MASK_GB (4 << 20) -# define R200_TXC_OUTPUT_MASK_G (5 << 20) -# define R200_TXC_OUTPUT_MASK_B (6 << 20) -# define R200_TXC_OUTPUT_MASK_NONE (7 << 20) -# define R200_TXC_REPL_NORMAL 0 -# define R200_TXC_REPL_RED 1 -# define R200_TXC_REPL_GREEN 2 -# define R200_TXC_REPL_BLUE 3 -# define R200_TXC_REPL_ARG_A_SHIFT 26 -# define R200_TXC_REPL_ARG_A_MASK (3 << 26) -# define R200_TXC_REPL_ARG_B_SHIFT 28 -# define R200_TXC_REPL_ARG_B_MASK (3 << 28) -# define R200_TXC_REPL_ARG_C_SHIFT 30 -# define R200_TXC_REPL_ARG_C_MASK (3 << 30) - -/* AKA PIXSHADER_I0_A0 */ -#define R200_REG_PP_TXABLEND_0 0x2f08 -# define R200_TXA_ARG_A_ZERO (0) -# define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */ -# define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */ -# define R200_TXA_ARG_A_DIFFUSE_ALPHA (4) -# define R200_TXA_ARG_A_DIFFUSE_BLUE (5) -# define R200_TXA_ARG_A_SPECULAR_ALPHA (6) -# define R200_TXA_ARG_A_SPECULAR_BLUE (7) -# define R200_TXA_ARG_A_TFACTOR_ALPHA (8) -# define R200_TXA_ARG_A_TFACTOR_BLUE (9) -# define R200_TXA_ARG_A_R0_ALPHA (10) -# define R200_TXA_ARG_A_R0_BLUE (11) -# define R200_TXA_ARG_A_R1_ALPHA (12) -# define R200_TXA_ARG_A_R1_BLUE (13) -# define R200_TXA_ARG_A_R2_ALPHA (14) -# define R200_TXA_ARG_A_R2_BLUE (15) -# define R200_TXA_ARG_A_R3_ALPHA (16) -# define R200_TXA_ARG_A_R3_BLUE (17) -# define R200_TXA_ARG_A_R4_ALPHA (18) -# define R200_TXA_ARG_A_R4_BLUE (19) -# define R200_TXA_ARG_A_R5_ALPHA (20) -# define R200_TXA_ARG_A_R5_BLUE (21) -# define R200_TXA_ARG_A_TFACTOR1_ALPHA (26) -# define R200_TXA_ARG_A_TFACTOR1_BLUE (27) -# define R200_TXA_ARG_A_MASK (31 << 0) -# define R200_TXA_ARG_A_SHIFT 0 -# define R200_TXA_ARG_B_ZERO (0 << 5) -# define R200_TXA_ARG_B_CURRENT_ALPHA (2 << 5) /* guess */ -# define R200_TXA_ARG_B_CURRENT_BLUE (3 << 5) /* guess */ -# define R200_TXA_ARG_B_DIFFUSE_ALPHA (4 << 5) -# define R200_TXA_ARG_B_DIFFUSE_BLUE (5 << 5) -# define R200_TXA_ARG_B_SPECULAR_ALPHA (6 << 5) -# define R200_TXA_ARG_B_SPECULAR_BLUE (7 << 5) -# define R200_TXA_ARG_B_TFACTOR_ALPHA (8 << 5) -# define R200_TXA_ARG_B_TFACTOR_BLUE (9 << 5) -# define R200_TXA_ARG_B_R0_ALPHA (10 << 5) -# define R200_TXA_ARG_B_R0_BLUE (11 << 5) -# define R200_TXA_ARG_B_R1_ALPHA (12 << 5) -# define R200_TXA_ARG_B_R1_BLUE (13 << 5) -# define R200_TXA_ARG_B_R2_ALPHA (14 << 5) -# define R200_TXA_ARG_B_R2_BLUE (15 << 5) -# define R200_TXA_ARG_B_R3_ALPHA (16 << 5) -# define R200_TXA_ARG_B_R3_BLUE (17 << 5) -# define R200_TXA_ARG_B_R4_ALPHA (18 << 5) -# define R200_TXA_ARG_B_R4_BLUE (19 << 5) -# define R200_TXA_ARG_B_R5_ALPHA (20 << 5) -# define R200_TXA_ARG_B_R5_BLUE (21 << 5) -# define R200_TXA_ARG_B_TFACTOR1_ALPHA (26 << 5) -# define R200_TXA_ARG_B_TFACTOR1_BLUE (27 << 5) -# define R200_TXA_ARG_B_MASK (31 << 5) -# define R200_TXA_ARG_B_SHIFT 5 -# define R200_TXA_ARG_C_ZERO (0 << 10) -# define R200_TXA_ARG_C_CURRENT_ALPHA (2 << 10) /* guess */ -# define R200_TXA_ARG_C_CURRENT_BLUE (3 << 10) /* guess */ -# define R200_TXA_ARG_C_DIFFUSE_ALPHA (4 << 10) -# define R200_TXA_ARG_C_DIFFUSE_BLUE (5 << 10) -# define R200_TXA_ARG_C_SPECULAR_ALPHA (6 << 10) -# define R200_TXA_ARG_C_SPECULAR_BLUE (7 << 10) -# define R200_TXA_ARG_C_TFACTOR_ALPHA (8 << 10) -# define R200_TXA_ARG_C_TFACTOR_BLUE (9 << 10) -# define R200_TXA_ARG_C_R0_ALPHA (10 << 10) -# define R200_TXA_ARG_C_R0_BLUE (11 << 10) -# define R200_TXA_ARG_C_R1_ALPHA (12 << 10) -# define R200_TXA_ARG_C_R1_BLUE (13 << 10) -# define R200_TXA_ARG_C_R2_ALPHA (14 << 10) -# define R200_TXA_ARG_C_R2_BLUE (15 << 10) -# define R200_TXA_ARG_C_R3_ALPHA (16 << 10) -# define R200_TXA_ARG_C_R3_BLUE (17 << 10) -# define R200_TXA_ARG_C_R4_ALPHA (18 << 10) -# define R200_TXA_ARG_C_R4_BLUE (19 << 10) -# define R200_TXA_ARG_C_R5_ALPHA (20 << 10) -# define R200_TXA_ARG_C_R5_BLUE (21 << 10) -# define R200_TXA_ARG_C_TFACTOR1_ALPHA (26 << 10) -# define R200_TXA_ARG_C_TFACTOR1_BLUE (27 << 10) -# define R200_TXA_ARG_C_MASK (31 << 10) -# define R200_TXA_ARG_C_SHIFT 10 -# define R200_TXA_COMP_ARG_A (1 << 16) -# define R200_TXA_COMP_ARG_A_SHIFT (16) -# define R200_TXA_BIAS_ARG_A (1 << 17) -# define R200_TXA_SCALE_ARG_A (1 << 18) -# define R200_TXA_NEG_ARG_A (1 << 19) -# define R200_TXA_COMP_ARG_B (1 << 20) -# define R200_TXA_COMP_ARG_B_SHIFT (20) -# define R200_TXA_BIAS_ARG_B (1 << 21) -# define R200_TXA_SCALE_ARG_B (1 << 22) -# define R200_TXA_NEG_ARG_B (1 << 23) -# define R200_TXA_COMP_ARG_C (1 << 24) -# define R200_TXA_COMP_ARG_C_SHIFT (24) -# define R200_TXA_BIAS_ARG_C (1 << 25) -# define R200_TXA_SCALE_ARG_C (1 << 26) -# define R200_TXA_NEG_ARG_C (1 << 27) -# define R200_TXA_OP_MADD (0 << 28) -# define R200_TXA_OP_CND0 (2 << 28) -# define R200_TXA_OP_LERP (3 << 28) -# define R200_TXA_OP_CONDITIONAL (6 << 28) -# define R200_TXA_OP_MASK (7 << 28) - -/* AKA PIXSHADER_I0_A1 */ -#define R200_REG_PP_TXABLEND2_0 0x2f0c -# define R200_TXA_TFACTOR_SEL_SHIFT 0 -# define R200_TXA_TFACTOR_SEL_MASK 0x7 -# define R200_TXA_TFACTOR1_SEL_SHIFT 4 -# define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4) -# define R200_TXA_SCALE_SHIFT 8 -# define R200_TXA_SCALE_MASK (7 << 8) -# define R200_TXA_SCALE_1X (0 << 8) -# define R200_TXA_SCALE_2X (1 << 8) -# define R200_TXA_SCALE_4X (2 << 8) -# define R200_TXA_SCALE_8X (3 << 8) -# define R200_TXA_SCALE_INV2 (5 << 8) -# define R200_TXA_SCALE_INV4 (6 << 8) -# define R200_TXA_SCALE_INV8 (7 << 8) -# define R200_TXA_CLAMP_SHIFT 12 -# define R200_TXA_CLAMP_MASK (3 << 12) -# define R200_TXA_CLAMP_WRAP (0 << 12) -# define R200_TXA_CLAMP_0_1 (1 << 12) -# define R200_TXA_CLAMP_8_8 (2 << 12) -# define R200_TXA_OUTPUT_REG_MASK (7 << 16) -# define R200_TXA_OUTPUT_REG_NONE (0 << 16) -# define R200_TXA_OUTPUT_REG_R0 (1 << 16) -# define R200_TXA_OUTPUT_REG_R1 (2 << 16) -# define R200_TXA_OUTPUT_REG_R2 (3 << 16) -# define R200_TXA_OUTPUT_REG_R3 (4 << 16) -# define R200_TXA_OUTPUT_REG_R4 (5 << 16) -# define R200_TXA_OUTPUT_REG_R5 (6 << 16) -# define R200_TXA_DOT_ALPHA (1 << 20) -# define R200_TXA_REPL_NORMAL 0 -# define R200_TXA_REPL_RED 1 -# define R200_TXA_REPL_GREEN 2 -# define R200_TXA_REPL_ARG_A_SHIFT 26 -# define R200_TXA_REPL_ARG_A_MASK (3 << 26) -# define R200_TXA_REPL_ARG_B_SHIFT 28 -# define R200_TXA_REPL_ARG_B_MASK (3 << 28) -# define R200_TXA_REPL_ARG_C_SHIFT 30 -# define R200_TXA_REPL_ARG_C_MASK (3 << 30) - -#define RADEON_REG_RB2D_DSTCACHE_MODE 0x3428 -/* This is a read-only mirror of RADEON_REG_RB3D_DSTCACHE_MODE */ - -#define RADEON_REG_RB2D_DSTCACHE_CTLSTAT 0x342C -/* This is a read-only mirror of RADEON_REG_RB3D_DSTCACHE_CTLSTAT */ - -#define RADEON_REG_RB3D_DSTCACHE_MODE 0x3258 -# define RADEON_RB3D_DC_CACHE_ENABLE (0) -# define RADEON_RB3D_DC_2D_CACHE_DISABLE (1) -# define RADEON_RB3D_DC_3D_CACHE_DISABLE (2) -# define RADEON_RB3D_DC_CACHE_DISABLE (3) -# define RADEON_RB3D_DC_2D_CACHE_LINESIZE_128 (1 << 2) -# define RADEON_RB3D_DC_3D_CACHE_LINESIZE_128 (2 << 2) -# define RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH (1 << 8) -# define RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH (2 << 8) -# define R200_RB3D_DC_2D_CACHE_AUTOFREE (1 << 10) -# define R200_RB3D_DC_3D_CACHE_AUTOFREE (2 << 10) -# define RADEON_RB3D_DC_FORCE_RMW (1 << 16) -# define RADEON_RB3D_DC_DISABLE_RI_FILL (1 << 24) -# define RADEON_RB3D_DC_DISABLE_RI_READ (1 << 25) -# define RADEON_RB3D_DC_DISABLE_MASK_CHK (1 << 26) - -#define RADEON_REG_RB3D_DSTCACHE_CTLSTAT 0x325C -# define RADEON_RB3D_DC_FLUSH (3 << 0) -# define RADEON_RB3D_DC_FREE (3 << 2) -# define RADEON_RB3D_DC_FLUSH_ALL 0xf -# define RADEON_RB3D_DC_BUSY (1 << 31) - -/* PLL register defines */ -#define R128_REG_MCLK_CNTL 0x000f -# define R128_FORCE_GCP (1 << 16) -# define R128_FORCE_PIPE3D_CP (1 << 17) -# define R128_FORCE_RCP (1 << 18) -#define RADEON_REG_MCLK_CNTL 0x0012 -# define RADEON_FORCEON_MCLKA (1 << 16) -# define RADEON_FORCEON_MCLKB (1 << 17) -# define RADEON_FORCEON_YCLKA (1 << 18) -# define RADEON_FORCEON_YCLKB (1 << 19) -# define RADEON_FORCEON_MC (1 << 20) -# define RADEON_FORCEON_AIC (1 << 21) - -/* CCE packet defines */ - -#define ATI_CCE_PACKETTYPE_MASK 0xc0000000 -#define ATI_CCE_PACKET0 0x00000000 -#define ATI_CCE_PACKET0_COUNT_MASK 0x3fff0000 -#define ATI_CCE_PACKET0_ONE_REG_WR 0x00008000 -#define ATI_CCE_PACKET0_REG_MASK 0x000007ff -#define ATI_CCE_PACKET1 0x40000000 -#define ATI_CCE_PACKET1_REG_1 0x000007ff -#define ATI_CCE_PACKET1_REG_2 0x003ff800 -#define ATI_CCE_PACKET1_REG_2_SHIFT 10 -#define ATI_CCE_PACKET2 0x80000000 -#define ATI_CCE_PACKET3 0xc0000000 -#define ATI_CCE_PACKET3_COUNT_MASK 0x3fff0000 -#define ATI_CCE_PACKET3_IT_OPCODE_MASK 0x0000ff00 -#define ATI_CCE_PACKET3_NOP 0xc0001000 -#define ATI_CCE_PACKET3_NEXT_CHAR 0xc0001900 -#define ATI_CCE_PACKET3_PLY_NEXTSCAN 0xc0001d00 -#define ATI_CCE_PACKET3_SET_SCISSORS 0xc0001e00 -#define R128_CCE_PACKET3_SET_MODE_24BPP 0xc0001f00 -#define R128_CCE_PACKET3_3D_SAVE_CONTEXT 0xc0002000 -#define R128_CCE_PACKET3_3D_PLAY_CONTEXT 0xc0002100 -#define ATI_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xc0002300 -#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xc0002400 -#define ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM 0xc0002500 -#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xc0002600 -#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xc0002800 -#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xc0002900 -#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xc0002a00 -#define ATI_CCE_PACKET3_LOAD_PALETTE 0xc0002c00 -#define R128_CCE_PACKET3_PURGE 0xc0002d00 -#define R128_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xc0002e00 -#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xc0002f00 -#define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xc0003200 -#define R200_CP_PACKET3_3D_DRAW_IMMD_2 0xc0003500 -#define ATI_CCE_PACKET3_CNTL_PAINT 0xc0009100 -#define ATI_CCE_PACKET3_CNTL_BITBLT 0xc0009200 -#define ATI_CCE_PACKET3_CNTL_SMALLTEXT 0xc0009300 -#define ATI_CCE_PACKET3_HOSTDATA_BLT 0xc0009400 -#define ATI_CCE_PACKET3_CNTL_POLYLINE 0xc0009500 -#define R128_CCE_PACKET3_SCALE 0xc0009600 -#define R128_CCE_PACKET3_TRANS_SCALE 0xc0009700 -#define ATI_CCE_PACKET3_CNTL_POLYSCANLINES 0xc0009800 -#define ATI_CCE_PACKET3_PAINT_MULTI 0xc0009a00 -#define ATI_CCE_PACKET3_BITBLT_MULTI 0xc0009b00 -#define ATI_CCE_PACKET3_CNTL_TRANS_BITBLT 0xc0009c00 - -#define RADEON_CP_VC_FRMT_XY 0x00000000 -#define RADEON_CP_VC_FRMT_W0 0x00000001 -#define RADEON_CP_VC_FRMT_FPCOLOR 0x00000002 -#define RADEON_CP_VC_FRMT_FPALPHA 0x00000004 -#define RADEON_CP_VC_FRMT_PKCOLOR 0x00000008 -#define RADEON_CP_VC_FRMT_FPSPEC 0x00000010 -#define RADEON_CP_VC_FRMT_FPFOG 0x00000020 -#define RADEON_CP_VC_FRMT_PKSPEC 0x00000040 -#define RADEON_CP_VC_FRMT_ST0 0x00000080 -#define RADEON_CP_VC_FRMT_ST1 0x00000100 -#define RADEON_CP_VC_FRMT_Q1 0x00000200 -#define RADEON_CP_VC_FRMT_ST2 0x00000400 -#define RADEON_CP_VC_FRMT_Q2 0x00000800 -#define RADEON_CP_VC_FRMT_ST3 0x00001000 -#define RADEON_CP_VC_FRMT_Q3 0x00002000 -#define RADEON_CP_VC_FRMT_Q0 0x00004000 -#define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK 0x00038000 -#define RADEON_CP_VC_FRMT_N0 0x00040000 -#define RADEON_CP_VC_FRMT_XY1 0x08000000 -#define RADEON_CP_VC_FRMT_Z1 0x10000000 -#define RADEON_CP_VC_FRMT_W1 0x20000000 -#define RADEON_CP_VC_FRMT_N1 0x40000000 -#define RADEON_CP_VC_FRMT_Z 0x80000000 - -#define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE 0x00000000 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT 0x00000001 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE 0x00000002 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP 0x00000003 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2 0x00000007 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009 -#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a -#define RADEON_CP_VC_CNTL_PRIM_WALK_IND 0x00000010 -#define RADEON_CP_VC_CNTL_PRIM_WALK_LIST 0x00000020 -#define RADEON_CP_VC_CNTL_PRIM_WALK_RING 0x00000030 -#define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA 0x00000000 -#define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA 0x00000040 -#define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080 -#define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000 -#define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100 -#define RADEON_CP_VC_CNTL_TCL_DISABLE 0x00000000 -#define RADEON_CP_VC_CNTL_TCL_ENABLE 0x00000200 -#define RADEON_CP_VC_CNTL_NUM_SHIFT 16 - -#define R128_CCE_VC_FRMT_RHW 0x00000001 -#define R128_CCE_VC_FRMT_DIFFUSE_BGR 0x00000002 -#define R128_CCE_VC_FRMT_DIFFUSE_A 0x00000004 -#define R128_CCE_VC_FRMT_DIFFUSE_ARGB 0x00000008 -#define R128_CCE_VC_FRMT_SPEC_BGR 0x00000010 -#define R128_CCE_VC_FRMT_SPEC_F 0x00000020 -#define R128_CCE_VC_FRMT_SPEC_FRGB 0x00000040 -#define R128_CCE_VC_FRMT_S_T 0x00000080 -#define R128_CCE_VC_FRMT_S2_T2 0x00000100 -#define R128_CCE_VC_FRMT_RHW2 0x00000200 - -#define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 -#define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 -#define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 -#define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 -#define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 -#define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 -#define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 -#define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 -#define R128_CCE_VC_CNTL_NUM_SHIFT 16 - -#define R128_DATATYPE_VQ 0 -#define R128_DATATYPE_CI4 1 -#define R128_DATATYPE_CI8 2 -#define R128_DATATYPE_ARGB1555 3 -#define R128_DATATYPE_RGB565 4 -#define R128_DATATYPE_RGB888 5 -#define R128_DATATYPE_ARGB8888 6 -#define R128_DATATYPE_RGB332 7 -#define R128_DATATYPE_Y8 8 -#define R128_DATATYPE_RGB8 9 -#define R128_DATATYPE_CI16 10 -#define R128_DATATYPE_VYUY_422 11 -#define R128_DATATYPE_YVYU_422 12 -#define R128_DATATYPE_AYUV_444 14 -#define R128_DATATYPE_ARGB4444 15 - -#define R128_AGP_OFFSET 0x02000000 - -#define R128_WATERMARK_L 16 -#define R128_WATERMARK_M 8 -#define R128_WATERMARK_N 8 -#define R128_WATERMARK_K 128 diff --git a/hw/kdrive/ati/ati_sarea.h b/hw/kdrive/ati/ati_sarea.h deleted file mode 100644 index 2f04c7be0..000000000 --- a/hw/kdrive/ati/ati_sarea.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 _ATI_SAREA_H_ -#define _ATI_SAREA_H_ - -/* There are 2 heaps (local/AGP). Each region within a heap is a - * minimum of 64k, and there are at most 64 of them per heap. - */ -#define ATI_CARD_HEAP 0 -#define ATI_GART_HEAP 1 -#define ATI_NR_TEX_HEAPS 2 -#define ATI_NR_TEX_REGIONS 64 -#define ATI_LOG_TEX_GRANULARITY 16 - -#include "r128_sarea.h" -#include "radeon_sarea.h" - -#endif /* _ATI_SAREA_H_ */ diff --git a/hw/kdrive/ati/ati_stub.c b/hw/kdrive/ati/ati_stub.c deleted file mode 100644 index f881b7f7b..000000000 --- a/hw/kdrive/ati/ati_stub.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ati.h" -#include "klinux.h" - -extern struct pci_id_entry ati_pci_ids[]; - -void -InitCard(char *name) -{ - struct pci_id_entry *id; - KdCardAttr attr; - - for (id = ati_pci_ids; id->name != NULL; id++) { - int j = 0; - while (LinuxFindPci(id->vendor, id->device, j++, &attr)) - KdCardInfoAdd(&ATIFuncs, &attr, 0); - } -} - -void -InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput(pScreenInfo, argc, argv); -} - -void -InitInput(int argc, char **argv) -{ - KdOsAddInputDrivers(); - KdInitInput(); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -#ifdef KDRIVEVESA - vesaUseMsg(); -#endif -} - -int -ddxProcessArgument(int argc, char **argv, int i) -{ - int ret; - -#ifdef KDRIVEVESA - if (!(ret = vesaProcessArgument (argc, argv, i))) -#endif - ret = KdProcessArgument(argc, argv, i); - - return ret; -} diff --git a/hw/kdrive/ati/ati_video.c b/hw/kdrive/ati/ati_video.c deleted file mode 100644 index ca0ab464a..000000000 --- a/hw/kdrive/ati/ati_video.c +++ /dev/null @@ -1,988 +0,0 @@ -/* - * Copyright © 2004 Keith Packard - * Copyright © 2005 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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. - * - * Based on mach64video.c by Keith Packard. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ati.h" -#include "ati_dma.h" -#include "ati_draw.h" -#include "ati_reg.h" -#include "kaa.h" - -#include <X11/extensions/Xv.h> -#include "fourcc.h" - -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -static Atom xvBrightness, xvSaturation; - -extern CARD8 ATIBltRop[16]; - -#define IMAGE_MAX_WIDTH 2048 -#define IMAGE_MAX_HEIGHT 2048 - -static void -ATIStopVideo(KdScreenInfo *screen, pointer data, Bool exit) -{ - ScreenPtr pScreen = screen->pScreen; - ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data; - - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - - if (pPortPriv->off_screen) { - KdOffscreenFree (pScreen, pPortPriv->off_screen); - pPortPriv->off_screen = 0; - } -} - -static int -ATISetPortAttribute(KdScreenInfo *screen, Atom attribute, int value, - pointer data) -{ - return BadMatch; -} - -static int -ATIGetPortAttribute(KdScreenInfo *screen, Atom attribute, int *value, - pointer data) -{ - return BadMatch; -} - -static void -ATIQueryBestSize(KdScreenInfo *screen, Bool motion, short vid_w, short vid_h, - short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, - pointer data) -{ - *p_w = drw_w; - *p_h = drw_h; -} - -/* ATIClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -static void -ATIClipVideo(BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2, - BoxPtr extents, INT32 width, INT32 height) -{ - INT32 vscale, hscale, delta; - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if (diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if (diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if (diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if (diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if (*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if (delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if (*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if (delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } -} - -static void -R128DisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - CARD32 dstDatatype, srcDatatype; - CARD32 dst_offset, dst_pitch; - int dstxoff, dstyoff; - PixmapPtr pPixmap = pPortPriv->pPixmap; - int bpp = pPixmap->drawable.bitsPerPixel; - RING_LOCALS; - - BoxPtr pBox = REGION_RECTS(&pPortPriv->clip); - int nBox = REGION_NUM_RECTS(&pPortPriv->clip); - - if (pPortPriv->id == FOURCC_UYVY) - srcDatatype = R128_DATATYPE_YVYU_422; - else - srcDatatype = R128_DATATYPE_VYUY_422; - - switch (bpp) - { - case 16: - if (pPixmap->drawable.depth == 15) - dstDatatype = R128_DATATYPE_ARGB1555; - else - dstDatatype = R128_DATATYPE_RGB565; - break; - case 32: - dstDatatype = R128_DATATYPE_ARGB8888; - break; - default: - return; - } - - dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr - - pScreenPriv->screen->memory_base); - dst_pitch = pPixmap->devKind; -#ifdef COMPOSITE - dstxoff = -pPixmap->screen_x + pPixmap->drawable.x; - dstyoff = -pPixmap->screen_y + pPixmap->drawable.y; -#else - dstxoff = 0; - dstyoff = 0; -#endif - - BEGIN_DMA(18); - OUT_REG(ATI_REG_DST_PITCH_OFFSET, - ((dst_pitch / bpp) << 21) | (dst_offset >> 5)); - OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, - ATI_GMC_DST_PITCH_OFFSET_CNTL | - ATI_GMC_BRUSH_NONE | - (dstDatatype << 8) | - ATI_GMC_SRC_DATATYPE_COLOR | - (ATIBltRop[GXcopy] << 16) | - R128_GMC_3D_FCN_EN | - ATI_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS); - OUT_REG(ATI_REG_DP_CNTL, - ATI_DST_X_LEFT_TO_RIGHT | ATI_DST_Y_TOP_TO_BOTTOM ); - OUT_REG(R128_REG_SCALE_3D_CNTL, - R128_SCALE_3D_SCALE | - R128_SBLEND_ONE | - R128_DBLEND_ZERO); - OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_CACHE_FLUSH); - OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype); - - OUT_RING(DMA_PACKET0(R128_REG_SCALE_PITCH, 5)); - OUT_RING_REG(R128_REG_SCALE_PITCH, pPortPriv->src_pitch / 16); - OUT_RING_REG(R128_REG_SCALE_X_INC, - (pPortPriv->src_w << 16) / pPortPriv->dst_w); - OUT_RING_REG(R128_REG_SCALE_Y_INC, - (pPortPriv->src_h << 16) / pPortPriv->dst_h); - OUT_RING_REG(R128_REG_SCALE_HACC, 0x0); - OUT_RING_REG(R128_REG_SCALE_VACC, 0x0); - - END_DMA(); - - while (nBox--) { - int srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth; - - dstX = pBox->x1 + dstxoff; - dstY = pBox->y1 + dstyoff; - dstw = pBox->x2 - pBox->x1; - dsth = pBox->y2 - pBox->y1; - srcX = (pBox->x1 - pPortPriv->dst_x1) * - pPortPriv->src_w / pPortPriv->dst_w; - srcY = (pBox->y1 - pPortPriv->dst_y1) * - pPortPriv->src_h / pPortPriv->dst_h; - srcw = pPortPriv->src_w - srcX; - srch = pPortPriv->src_h - srcY; - - BEGIN_DMA(6); - OUT_RING(DMA_PACKET0(R128_REG_SCALE_SRC_HEIGHT_WIDTH, 2)); - OUT_RING_REG(R128_REG_SCALE_SRC_HEIGHT_WIDTH, - (srch << 16) | srcw); - OUT_RING_REG(R128_REG_SCALE_OFFSET_0, pPortPriv->src_offset + - srcY * pPortPriv->src_pitch + srcX * 2); - - OUT_RING(DMA_PACKET0(R128_REG_SCALE_DST_X_Y, 2)); - OUT_RING_REG(R128_REG_SCALE_DST_X_Y, (dstX << 16) | dstY); - OUT_RING_REG(R128_REG_SCALE_DST_HEIGHT_WIDTH, - (dsth << 16) | dstw); - END_DMA(); - pBox++; - } -#ifdef DAMAGEEXT - /* XXX: Shouldn't this be in kxv.c instead? */ - DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); -#endif - kaaMarkSync(pScreen); -} - -union intfloat { - float f; - CARD32 i; -}; - -struct blend_vertex { - union intfloat x, y; - union intfloat s0, t0; -}; - -#define VTX_DWORD_COUNT 4 - -#define VTX_OUT(vtx) \ -do { \ - OUT_RING(vtx.x.i); \ - OUT_RING(vtx.y.i); \ - OUT_RING(vtx.s0.i); \ - OUT_RING(vtx.t0.i); \ -} while (0) - -static void -RadeonDisplayVideo(KdScreenInfo *screen, ATIPortPrivPtr pPortPriv) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - struct blend_vertex vtx[4]; - PixmapPtr pPixmap = pPortPriv->pPixmap; - CARD32 txformat; - CARD32 dst_offset, dst_pitch, dst_format; - int dstxoff, dstyoff, pixel_shift; - RING_LOCALS; - - BoxPtr pBox = REGION_RECTS(&pPortPriv->clip); - int nBox = REGION_NUM_RECTS(&pPortPriv->clip); - - switch (pPixmap->drawable.bitsPerPixel) { - case 16: - if (pPixmap->drawable.depth == 15) - dst_format = RADEON_COLOR_FORMAT_ARGB1555; - else - dst_format = RADEON_COLOR_FORMAT_RGB565; - pixel_shift = 1; - break; - case 32: - dst_format = RADEON_COLOR_FORMAT_ARGB8888; - pixel_shift = 2; - break; - default: - return; - } - - dst_offset = ((CARD8 *)pPixmap->devPrivate.ptr - - pScreenPriv->screen->memory_base); - dst_pitch = pPixmap->devKind; - -#ifdef COMPOSITE - dstxoff = -pPixmap->screen_x + pPixmap->drawable.x; - dstyoff = -pPixmap->screen_y + pPixmap->drawable.y; -#else - dstxoff = 0; - dstyoff = 0; -#endif - - /* Same for R100/R200 */ - if (pPortPriv->id == FOURCC_UYVY) - txformat = RADEON_TXFORMAT_YVYU422; - else - txformat = RADEON_TXFORMAT_VYUY422; - - txformat |= RADEON_TXFORMAT_NON_POWER2; - - RadeonSwitchTo3D(atis); - - BEGIN_DMA(8); - - OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3)); - OUT_RING_REG(RADEON_REG_PP_CNTL, - RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE); - OUT_RING_REG(RADEON_REG_RB3D_CNTL, - dst_format | RADEON_ALPHA_BLEND_ENABLE); - OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset); - - OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift); - - OUT_REG(RADEON_REG_RB3D_BLENDCNTL, - RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO); - - END_DMA(); - - if (atic->is_r200) { - BEGIN_DMA(17); - - OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY); - OUT_REG(R200_REG_SE_VTX_FMT_1, - (2 << R200_VTX_TEX0_COMP_CNT_SHIFT)); - - OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_0, 5)); - OUT_RING_REG(R200_REG_PP_TXFILTER_0, - R200_MAG_FILTER_LINEAR | - R200_MIN_FILTER_LINEAR | - R200_YUV_TO_RGB); - OUT_RING_REG(R200_REG_PP_TXFORMAT_0, txformat); - OUT_RING_REG(R200_REG_PP_TXFORMAT_X_0, 0); - OUT_RING_REG(R200_REG_PP_TXSIZE_0, - (pPixmap->drawable.width - 1) | - ((pPixmap->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); - OUT_RING_REG(R200_REG_PP_TXPITCH_0, pPortPriv->src_pitch - 32); - - OUT_REG(R200_PP_TXOFFSET_0, pPortPriv->src_offset); - - OUT_RING(DMA_PACKET0(R200_REG_PP_TXCBLEND_0, 4)); - OUT_RING_REG(R200_REG_PP_TXCBLEND_0, - R200_TXC_ARG_A_ZERO | - R200_TXC_ARG_B_ZERO | - R200_TXC_ARG_C_R0_COLOR | - R200_TXC_OP_MADD); - OUT_RING_REG(R200_REG_PP_TXCBLEND2_0, - R200_TXC_CLAMP_0_1 | R200_TXC_OUTPUT_REG_R0); - OUT_RING_REG(R200_REG_PP_TXABLEND_0, - R200_TXA_ARG_A_ZERO | - R200_TXA_ARG_B_ZERO | - R200_TXA_ARG_C_R0_ALPHA | - R200_TXA_OP_MADD); - OUT_RING_REG(R200_REG_PP_TXABLEND2_0, - R200_TXA_CLAMP_0_1 | R200_TXA_OUTPUT_REG_R0); - - END_DMA(); - } else { -// BEGIN_DMA(11); - BEGIN_DMA(9); - - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 5)); - OUT_RING_REG(RADEON_REG_PP_TXFILTER_0, RADEON_MAG_FILTER_LINEAR | - RADEON_MIN_FILTER_LINEAR | - RADEON_YUV_TO_RGB); - OUT_RING_REG(RADEON_REG_PP_TXFORMAT_0, txformat); - OUT_RING_REG(RADEON_REG_PP_TXOFFSET_0, pPortPriv->src_offset); - OUT_RING_REG(RADEON_REG_PP_TXCBLEND_0, - RADEON_COLOR_ARG_A_ZERO | - RADEON_COLOR_ARG_B_ZERO | - RADEON_COLOR_ARG_C_T0_COLOR | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - OUT_RING_REG(RADEON_REG_PP_TXABLEND_0, - RADEON_ALPHA_ARG_A_ZERO | - RADEON_ALPHA_ARG_B_ZERO | - RADEON_ALPHA_ARG_C_T0_ALPHA | - RADEON_BLEND_CTL_ADD | - RADEON_CLAMP_TX); - - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2)); - OUT_RING_REG(RADEON_REG_PP_TEX_SIZE_0, - (pPixmap->drawable.width - 1) | - ((pPixmap->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); - OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_0, - pPortPriv->src_pitch - 32); - -// OUT_RING_REG(ATI_REG_WAIT_UNTIL, ATI_WAIT_CRTC_VLINE); - - END_DMA(); - } - - while (nBox--) { - float srcX, srcY, dstX, dstY, srcw, srch, dstw, dsth; - - dstX = pBox->x1 + dstxoff; - dstY = pBox->y1 + dstyoff; - dstw = pBox->x2 - pBox->x1; - dsth = pBox->y2 - pBox->y1; - srcX = (pBox->x1 - pPortPriv->dst_x1) * - pPortPriv->src_w / pPortPriv->dst_w; - srcY = (pBox->y1 - pPortPriv->dst_y1) * - pPortPriv->src_h / pPortPriv->dst_h; - srcw = pPortPriv->src_w * (dstw / pPortPriv->dst_w); - srch = pPortPriv->src_h * (dsth / pPortPriv->dst_h); - - /* - * rectangle: - * - * +---------2 - * | | - * | | - * 0---------1 - */ - - vtx[0].x.f = dstX; - vtx[0].y.f = dstY + dsth; - vtx[0].s0.f = srcX; - vtx[0].t0.f = srcY + srch; - - vtx[1].x.f = dstX + dstw; - vtx[1].y.f = dstY + dsth; - vtx[1].s0.f = srcX + srcw; - vtx[1].t0.f = srcY + srch; - - vtx[2].x.f = dstX + dstw; - vtx[2].y.f = dstY; - vtx[2].s0.f = srcX + srcw; - vtx[2].t0.f = srcY; - - if (atic->is_r100) { - BEGIN_DMA(3 * VTX_DWORD_COUNT + 3); - OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD, - 3 * VTX_DWORD_COUNT + 2)); - OUT_RING(RADEON_CP_VC_FRMT_XY | - RADEON_CP_VC_FRMT_ST0); - OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST | - RADEON_CP_VC_CNTL_PRIM_WALK_RING | - RADEON_CP_VC_CNTL_MAOS_ENABLE | - RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE | - (3 << RADEON_CP_VC_CNTL_NUM_SHIFT)); - } else { - BEGIN_DMA(3 * VTX_DWORD_COUNT + 2); - OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2, - 3 * VTX_DWORD_COUNT + 1)); - OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST | - RADEON_CP_VC_CNTL_PRIM_WALK_RING | - (3 << RADEON_CP_VC_CNTL_NUM_SHIFT)); - } - - VTX_OUT(vtx[0]); - VTX_OUT(vtx[1]); - VTX_OUT(vtx[2]); - END_DMA(); - - pBox++; - } -#ifdef DAMAGEEXT - /* XXX: Shouldn't this be in kxv.c instead? */ - DamageDamageRegion(pPortPriv->pDraw, &pPortPriv->clip); -#endif - kaaMarkSync(pScreen); -} - -static void -ATIVideoSave(ScreenPtr pScreen, KdOffscreenArea *area) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATIPortPrivPtr pPortPriv = atis->pAdaptor->pPortPrivates[0].ptr; - - if (pPortPriv->off_screen == area) - pPortPriv->off_screen = 0; -} - -static int -ATIPutImage(KdScreenInfo *screen, DrawablePtr pDraw, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, - unsigned char *buf, - short width, - short height, - Bool sync, - RegionPtr clipBoxes, - pointer data) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIScreenInfo(pScreenPriv); - ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data; - char *mmio = atic->reg_base; - INT32 x1, x2, y1, y2; - int randr = RR_Rotate_0 /* XXX */; - int srcPitch, srcPitch2, dstPitch; - int top, left, npixels, nlines, size; - BoxRec dstBox; - int dst_width = width, dst_height = height; - int rot_x1, rot_y1, rot_x2, rot_y2; - int dst_x1, dst_y1, dst_x2, dst_y2; - int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; - - /* Clip */ - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - ATIClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - - src_w = (x2 - x1) >> 16; - src_h = (y2 - y1) >> 16; - drw_w = dstBox.x2 - dstBox.x1; - drw_h = dstBox.y2 - dstBox.y1; - - if ((x1 >= x2) || (y1 >= y2)) - return Success; - - if (mmio == NULL) - return BadAlloc; - - if (randr & (RR_Rotate_0|RR_Rotate_180)) { - dst_width = width; - dst_height = height; - rot_src_w = src_w; - rot_src_h = src_h; - rot_drw_w = drw_w; - rot_drw_h = drw_h; - } else { - dst_width = height; - dst_height = width; - rot_src_w = src_h; - rot_src_h = src_w; - rot_drw_w = drw_h; - rot_drw_h = drw_w; - } - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - default: - dst_x1 = dstBox.x1; - dst_y1 = dstBox.y1; - dst_x2 = dstBox.x2; - dst_y2 = dstBox.y2; - rot_x1 = x1; - rot_y1 = y1; - rot_x2 = x2; - rot_y2 = y2; - break; - case RR_Rotate_90: - dst_x1 = dstBox.y1; - dst_y1 = screen->height - dstBox.x2; - dst_x2 = dstBox.y2; - dst_y2 = screen->height - dstBox.x1; - rot_x1 = y1; - rot_y1 = (src_w << 16) - x2; - rot_x2 = y2; - rot_y2 = (src_w << 16) - x1; - break; - case RR_Rotate_180: - dst_x1 = screen->width - dstBox.x2; - dst_y1 = screen->height - dstBox.y2; - dst_x2 = screen->width - dstBox.x1; - dst_y2 = screen->height - dstBox.y1; - rot_x1 = (src_w << 16) - x2; - rot_y1 = (src_h << 16) - y2; - rot_x2 = (src_w << 16) - x1; - rot_y2 = (src_h << 16) - y1; - break; - case RR_Rotate_270: - dst_x1 = screen->width - dstBox.y2; - dst_y1 = dstBox.x1; - dst_x2 = screen->width - dstBox.y1; - dst_y2 = dstBox.x2; - rot_x1 = (src_h << 16) - y2; - rot_y1 = x1; - rot_x2 = (src_h << 16) - y1; - rot_y2 = x2; - break; - } - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width + 3) & ~3; - srcPitch2 = ((width >> 1) + 3) & ~3; - size = dstPitch * dst_height; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width << 1); - srcPitch2 = 0; - size = dstPitch * dst_height; - break; - } - - if (pPortPriv->off_screen != NULL && size != pPortPriv->size) { - KdOffscreenFree(screen->pScreen, pPortPriv->off_screen); - pPortPriv->off_screen = 0; - } - - if (pPortPriv->off_screen == NULL) { - pPortPriv->off_screen = KdOffscreenAlloc(screen->pScreen, - size * 2, 64, TRUE, ATIVideoSave, pPortPriv); - if (pPortPriv->off_screen == NULL) - return BadAlloc; - } - - - if (pDraw->type == DRAWABLE_WINDOW) - pPortPriv->pPixmap = - (*pScreen->GetWindowPixmap)((WindowPtr)pDraw); - else - pPortPriv->pPixmap = (PixmapPtr)pDraw; - - /* Migrate the pixmap to offscreen if necessary. */ - if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) - kaaMoveInPixmap(pPortPriv->pPixmap); - - if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) { - return BadAlloc; - } - - pPortPriv->src_offset = pPortPriv->off_screen->offset; - pPortPriv->src_addr = (CARD8 *)(pScreenPriv->screen->memory_base + - pPortPriv->src_offset); - pPortPriv->src_pitch = dstPitch; - pPortPriv->size = size; - pPortPriv->pDraw = pDraw; - - /* copy data */ - top = rot_y1 >> 16; - left = (rot_x1 >> 16) & ~1; - npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; - - /* Since we're probably overwriting the area that might still be used - * for the last PutImage request, wait for idle. - */ - ATIWaitIdle(atis); - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; - KdXVCopyPlanarData(screen, buf, pPortPriv->src_addr, randr, - srcPitch, srcPitch2, dstPitch, rot_src_w, rot_src_h, - height, top, left, nlines, npixels, id); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - nlines = ((rot_y2 + 0xffff) >> 16) - top; - KdXVCopyPackedData(screen, buf, pPortPriv->src_addr, randr, - srcPitch, dstPitch, rot_src_w, rot_src_h, top, left, - nlines, npixels); - break; - } - - /* update cliplist */ - if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes)) { - REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes); - } - - pPortPriv->id = id; - pPortPriv->src_x1 = rot_x1; - pPortPriv->src_y1 = rot_y1; - pPortPriv->src_x2 = rot_x2; - pPortPriv->src_y2 = rot_y2; - pPortPriv->src_w = rot_src_w; - pPortPriv->src_h = rot_src_h; - pPortPriv->dst_x1 = dst_x1; - pPortPriv->dst_y1 = dst_y1; - pPortPriv->dst_x2 = dst_x2; - pPortPriv->dst_y2 = dst_y2; - pPortPriv->dst_w = rot_drw_w; - pPortPriv->dst_h = rot_drw_h; - - if (atic->is_radeon) - RadeonDisplayVideo(screen, pPortPriv); - else - R128DisplayVideo(screen, pPortPriv); - - return Success; -} - -static int -ATIReputImage(KdScreenInfo *screen, DrawablePtr pDraw, short drw_x, short drw_y, - RegionPtr clipBoxes, pointer data) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - ATICardInfo(pScreenPriv); - ATIPortPrivPtr pPortPriv = (ATIPortPrivPtr)data; - BoxPtr pOldExtents = REGION_EXTENTS(screen->pScreen, &pPortPriv->clip); - BoxPtr pNewExtents = REGION_EXTENTS(screen->pScreen, clipBoxes); - - if (pOldExtents->x1 != pNewExtents->x1 || - pOldExtents->x2 != pNewExtents->x2 || - pOldExtents->y1 != pNewExtents->y1 || - pOldExtents->y2 != pNewExtents->y2) - return BadMatch; - - if (pDraw->type == DRAWABLE_WINDOW) - pPortPriv->pPixmap = - (*pScreen->GetWindowPixmap)((WindowPtr)pDraw); - else - pPortPriv->pPixmap = (PixmapPtr)pDraw; - - if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) - kaaMoveInPixmap(pPortPriv->pPixmap); - - if (!kaaPixmapIsOffscreen(pPortPriv->pPixmap)) { - ErrorF("err\n"); - return BadAlloc; - } - - - /* update cliplist */ - if (!REGION_EQUAL(screen->pScreen, &pPortPriv->clip, clipBoxes)) - REGION_COPY(screen->pScreen, &pPortPriv->clip, clipBoxes); - - /* XXX: What do the drw_x and drw_y here mean for us? */ - - if (atic->is_radeon) - RadeonDisplayVideo(screen, pPortPriv); - else - R128DisplayVideo(screen, pPortPriv); - - return Success; -} - -static int -ATIQueryImageAttributes(KdScreenInfo *screen, int id, unsigned short *w, - unsigned short *h, int *pitches, int *offsets) -{ - int size, tmp; - - if (*w > IMAGE_MAX_WIDTH) - *w = IMAGE_MAX_WIDTH; - if (*h > IMAGE_MAX_HEIGHT) - *h = IMAGE_MAX_HEIGHT; - - *w = (*w + 1) & ~1; - if (offsets) - offsets[0] = 0; - - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if (pitches) - pitches[0] = size; - size *= *h; - if (offsets) - offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if (pitches) - pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if (offsets) - offsets[2] = size; - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if (pitches) - pitches[0] = size; - size *= *h; - break; - } - - return size; -} - - -/* client libraries expect an encoding */ -static KdVideoEncodingRec DummyEncoding[1] = -{ - { - 0, - "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, - {1, 1} - } -}; - -#define NUM_FORMATS 3 - -static KdVideoFormatRec Formats[NUM_FORMATS] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; - -#define NUM_ATTRIBUTES 0 - -static KdAttributeRec Attributes[NUM_ATTRIBUTES] = -{ -}; - -#define NUM_IMAGES 4 - -static KdImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY -}; - -static KdVideoAdaptorPtr -ATISetupImageVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - KdVideoAdaptorPtr adapt; - ATIPortPrivPtr pPortPriv; - int i; - - atis->num_texture_ports = 16; - - adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + atis->num_texture_ports * - (sizeof(ATIPortPrivRec) + sizeof(DevUnion))); - if (adapt == NULL) - return NULL; - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "ATI Texture Video"; - adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = atis->num_texture_ports; - adapt->pPortPrivates = (DevUnion*)(&adapt[1]); - - pPortPriv = - (ATIPortPrivPtr)(&adapt->pPortPrivates[atis->num_texture_ports]); - - for (i = 0; i < atis->num_texture_ports; i++) - adapt->pPortPrivates[i].ptr = &pPortPriv[i]; - - adapt->nAttributes = NUM_ATTRIBUTES; - adapt->pAttributes = Attributes; - adapt->pImages = Images; - adapt->nImages = NUM_IMAGES; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = ATIStopVideo; - adapt->SetPortAttribute = ATISetPortAttribute; - adapt->GetPortAttribute = ATIGetPortAttribute; - adapt->QueryBestSize = ATIQueryBestSize; - adapt->PutImage = ATIPutImage; - adapt->ReputImage = ATIReputImage; - adapt->QueryImageAttributes = ATIQueryImageAttributes; - - /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); - - atis->pAdaptor = adapt; - - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvSaturation = MAKE_ATOM("XV_SATURATION"); - - return adapt; -} - -Bool ATIInitVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - KdScreenInfo *screen = pScreenPriv->screen; - KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; - KdVideoAdaptorPtr newAdaptor = NULL; - int num_adaptors; - - atis->pAdaptor = NULL; - - if (atic->reg_base == NULL) - return FALSE; - if (atic->is_r300) - return FALSE; - - num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); - - newAdaptor = ATISetupImageVideo(pScreen); - - if (newAdaptor) { - if (!num_adaptors) { - num_adaptors = 1; - adaptors = &newAdaptor; - } else { - newAdaptors = xalloc((num_adaptors + 1) * - sizeof(KdVideoAdaptorPtr *)); - if (newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * - sizeof(KdVideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } - } - - if (num_adaptors) - KdXVScreenInit(pScreen, adaptors, num_adaptors); - - if (newAdaptors) - xfree(newAdaptors); - - return TRUE; -} - -void -ATIFiniVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ATIScreenInfo(pScreenPriv); - KdVideoAdaptorPtr adapt = atis->pAdaptor; - ATIPortPrivPtr pPortPriv; - int i; - - if (!adapt) - return; - - for (i = 0; i < atis->num_texture_ports; i++) { - pPortPriv = (ATIPortPrivPtr)(&adapt->pPortPrivates[i].ptr); - REGION_UNINIT(pScreen, &pPortPriv->clip); - } - xfree(adapt); - atis->pAdaptor = NULL; -} diff --git a/hw/kdrive/ati/r128_blendtmp.h b/hw/kdrive/ati/r128_blendtmp.h deleted file mode 100644 index b663eac95..000000000 --- a/hw/kdrive/ati/r128_blendtmp.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt, 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 USE_DMA -#define TAG(x) x##DMA -#define LOCALS RING_LOCALS; \ - (void)atic -#define BEGIN(x) BEGIN_RING(x * 2) -#define OUT_REG(reg, val) OUT_RING_REG(reg, val) -#define END() ADVANCE_RING() -#else -#define TAG(x) x##MMIO -#define LOCALS char *mmio = atic->reg_base -#define BEGIN(x) ATIWaitAvailMMIO(x) -#define OUT_REG(reg, val) MMIO_OUT32(mmio, (reg), (val)) -#define END() -#endif - -static Bool -TAG(R128PrepareBlend)(int op, PicturePtr pSrcPicture, PicturePtr pDstPicture, - PixmapPtr pSrc, PixmapPtr pDst) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - CARD32 dstDatatype, srcDatatype; - LOCALS; - - accel_atis = atis; - - if (!TAG(ATISetup)(pDst, pSrc)) - return FALSE; - - src_bpp = pSrc->drawable.bitsPerPixel; - is_repeat = pSrcPicture->repeat; - - if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0])) - ATI_FALLBACK(("Unsupported op 0x%x\n", op)); - if (pSrcPicture->repeat && (pSrc->drawable.width != 1 || - pSrc->drawable.height != 1)) - ATI_FALLBACK(("repeat unsupported\n")); - if (pSrcPicture->transform != NULL) - ATI_FALLBACK(("transform unsupported\n")); - if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype)) - ATI_FALLBACK(("Unsupported dest format 0x%x\n", - pDstPicture->format)); - if (!R128GetDatatypePict(pSrcPicture->format, &srcDatatype)) - ATI_FALLBACK(("Unsupported src format 0x%x\n", - pSrcPicture->format)); - - BEGIN(11); - OUT_REG(RADEON_REG_DP_GUI_MASTER_CNTL, - (dstDatatype << 8) | - RADEON_GMC_SRC_DATATYPE_COLOR | - RADEON_GMC_DST_PITCH_OFFSET_CNTL | - RADEON_GMC_CLR_CMP_CNTL_DIS | - RADEON_GMC_AUX_CLIP_DIS | - (ATIBltRop[3] << 16) | - RADEON_GMC_3D_FCN_EN); - OUT_REG(R128_REG_TEX_CNTL_C, R128_TEX_ALPHA_EN | R128_TEX_CACHE_FLUSH); - OUT_REG(R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C, 0); - OUT_REG(R128_REG_SCALE_3D_CNTL, - R128_SCALE_3D_SCALE | - R128BlendOp[op] | - R128_TEX_MAP_ALPHA_IN_TEXTURE); - OUT_REG(R128_REG_SCALE_3D_DATATYPE, srcDatatype); - OUT_REG(R128_REG_SCALE_PITCH, src_pitch / src_bpp); - /* 4.16 fixed point scaling factor? */ - if (is_repeat) { - OUT_REG(R128_REG_SCALE_X_INC, 0); - OUT_REG(R128_REG_SCALE_Y_INC, 0); - } else { - OUT_REG(R128_REG_SCALE_X_INC, 65536); - OUT_REG(R128_REG_SCALE_Y_INC, 65536); - } - OUT_REG(R128_REG_SCALE_HACC, 0x00000000); - OUT_REG(R128_REG_SCALE_VACC, 0x00000000); - OUT_REG(RADEON_REG_DP_CNTL, - RADEON_DST_X_LEFT_TO_RIGHT | RADEON_DST_Y_TOP_TO_BOTTOM ); - END(); - - return TRUE; -} - -static void -TAG(R128Blend)(int srcX, int srcY, int dstX, int dstY, int width, int height) -{ - ATIScreenInfo *atis = accel_atis; - ATICardInfo *atic = atis->atic; - LOCALS; - - if (is_repeat) { - srcX = 0; - srcY = 0; - } - - BEGIN(4); - OUT_REG(R128_REG_SCALE_OFFSET_0, src_offset + srcY * src_pitch + srcX * - (src_bpp >> 3)); - OUT_REG(R128_REG_SCALE_SRC_HEIGHT_WIDTH, (height << 16) | width); - OUT_REG(R128_REG_SCALE_DST_X_Y, (dstX << 16) | dstY); - OUT_REG(R128_REG_SCALE_DST_HEIGHT_WIDTH, (height << 16) | width); - END(); -} - -static void -TAG(R128DoneBlend)(void) -{ -} - -#undef TAG -#undef LOCALS -#undef BEGIN -#undef OUT_REG -#undef END diff --git a/hw/kdrive/ati/r128_common.h b/hw/kdrive/ati/r128_common.h deleted file mode 100644 index 862fea599..000000000 --- a/hw/kdrive/ati/r128_common.h +++ /dev/null @@ -1,170 +0,0 @@ -/* r128_common.h -- common header definitions for R128 2D/3D/DRM suite - * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 (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 - * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * - * Converted to common header format: - * Jens Owen <jens@tungstengraphics.com> - * - * - */ - -#ifndef _R128_COMMON_H_ -#define _R128_COMMON_H_ - -#include "X11/Xmd.h" - -/* - * WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (r128_drm.h) - */ - -/* Driver specific DRM command indices - * NOTE: these are not OS specific, but they are driver specific - */ -#define DRM_R128_INIT 0x00 -#define DRM_R128_CCE_START 0x01 -#define DRM_R128_CCE_STOP 0x02 -#define DRM_R128_CCE_RESET 0x03 -#define DRM_R128_CCE_IDLE 0x04 -#define DRM_R128_UNDEFINED1 0x05 -#define DRM_R128_RESET 0x06 -#define DRM_R128_SWAP 0x07 -#define DRM_R128_CLEAR 0x08 -#define DRM_R128_VERTEX 0x09 -#define DRM_R128_INDICES 0x0a -#define DRM_R128_BLIT 0x0b -#define DRM_R128_DEPTH 0x0c -#define DRM_R128_STIPPLE 0x0d -#define DRM_R128_UNDEFINED2 0x0e -#define DRM_R128_INDIRECT 0x0f -#define DRM_R128_FULLSCREEN 0x10 -#define DRM_R128_CLEAR2 0x11 -#define DRM_R128_GETPARAM 0x12 -#define DRM_R128_FLIP 0x13 - -#define DRM_R128_FRONT_BUFFER 0x1 -#define DRM_R128_BACK_BUFFER 0x2 -#define DRM_R128_DEPTH_BUFFER 0x4 - -typedef struct { - enum { - DRM_R128_INIT_CCE = 0x01, - DRM_R128_CLEANUP_CCE = 0x02 - } func; - unsigned long sarea_priv_offset; - int is_pci; - int cce_mode; - int cce_secure; /* FIXME: Deprecated, we should remove this */ - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - unsigned int span_offset; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long agp_textures_offset; -} drmR128Init; - -typedef struct { - int flush; - int idle; -} drmR128CCEStop; - -typedef struct { - int idx; - int start; - int end; - int discard; -} drmR128Indirect; - -typedef struct { - int idx; - int pitch; - int offset; - int format; - unsigned short x, y; - unsigned short width, height; -} drmR128Blit; - -typedef struct { - enum { - DRM_R128_WRITE_SPAN = 0x01, - DRM_R128_WRITE_PIXELS = 0x02, - DRM_R128_READ_SPAN = 0x03, - DRM_R128_READ_PIXELS = 0x04 - } func; - int n; - int *x; - int *y; - unsigned int *buffer; - unsigned char *mask; -} drmR128Depth; - -typedef struct { - int prim; - int idx; /* Index of vertex buffer */ - int count; /* Number of vertices in buffer */ - int discard; /* Client finished with buffer? */ -} drmR128Vertex; - -typedef struct { - unsigned int *mask; -} drmR128Stipple; - -typedef struct { - unsigned int flags; - unsigned int clear_color; - unsigned int clear_depth; - unsigned int color_mask; - unsigned int depth_mask; -} drmR128Clear; - -typedef struct { - enum { - DRM_R128_INIT_FULLSCREEN = 0x01, - DRM_R128_CLEANUP_FULLSCREEN = 0x02 - } func; -} drmR128Fullscreen; - -typedef struct drm_r128_getparam { - int param; - int *value; -} drmR128GetParam; - -#define R128_PARAM_IRQ_NR 1 - -#endif diff --git a/hw/kdrive/ati/r128_composite.c b/hw/kdrive/ati/r128_composite.c deleted file mode 100644 index 0d18ebff7..000000000 --- a/hw/kdrive/ati/r128_composite.c +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt, 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 "ati.h" -#include "ati_reg.h" -#include "ati_dma.h" -#include "ati_draw.h" - -extern ATIScreenInfo *accel_atis; -extern int sample_count; -extern float sample_offsets_x[255]; -extern float sample_offsets_y[255]; -extern CARD8 ATIBltRop[16]; - -static int widths[2] = {1,1}; -static int heights[2] = {1,1}; -static Bool is_transform[2]; -static PictTransform *transform[2]; - -struct blendinfo { - Bool dst_alpha; - Bool src_alpha; - CARD32 blendctl; -}; - -static struct blendinfo R128BlendOp[] = { - /* Clear */ - {0, 0, R128_SBLEND_ZERO | R128_DBLEND_ZERO}, - /* Src */ - {0, 0, R128_SBLEND_ONE | R128_DBLEND_ZERO}, - /* Dst */ - {0, 0, R128_SBLEND_ZERO | R128_DBLEND_ONE}, - /* Over */ - {0, 1, R128_SBLEND_ONE | R128_DBLEND_INV_SRC_ALPHA}, - /* OverReverse */ - {1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ONE}, - /* In */ - {1, 0, R128_SBLEND_DST_ALPHA | R128_DBLEND_ZERO}, - /* InReverse */ - {0, 1, R128_SBLEND_ZERO | R128_DBLEND_SRC_ALPHA}, - /* Out */ - {1, 0, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_ZERO}, - /* OutReverse */ - {0, 1, R128_SBLEND_ZERO | R128_DBLEND_INV_SRC_ALPHA}, - /* Atop */ - {1, 1, R128_SBLEND_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA}, - /* AtopReverse */ - {1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_SRC_ALPHA}, - /* Xor */ - {1, 1, R128_SBLEND_INV_DST_ALPHA | R128_DBLEND_INV_SRC_ALPHA}, - /* Add */ - {0, 0, R128_SBLEND_ONE | R128_DBLEND_ONE}, -}; - -static Bool -R128GetDatatypePict(CARD32 format, CARD32 *type) -{ - switch (format) { - case PICT_a1r5g5b5: - case PICT_x1r5g5b5: - *type = R128_DATATYPE_ARGB1555; - return TRUE; - case PICT_r5g6b5: - *type = R128_DATATYPE_RGB565; - return TRUE; - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - *type = R128_DATATYPE_ARGB8888; - return TRUE; - default: - return FALSE; - } - -} - -static Bool -R128CheckCompositeTexture(PicturePtr pPict) -{ - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - - if (w > (1 << 10) || h > (1 << 10)) - ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); - if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) - ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h)); - - switch (pPict->format) { - case PICT_a8: - case PICT_a1r5g5b5: - case PICT_a4r4g4b4: - case PICT_r5g6b5: - case PICT_a8r8g8b8: - break; - default: - ATI_FALLBACK(("Unsupported picture format 0x%x\n", - pPict->format)); - } - - return TRUE; -} - -Bool -R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture) -{ - CARD32 dstDatatype; - - if (op >= sizeof(R128BlendOp)/sizeof(R128BlendOp[0])) - ATI_FALLBACK(("Unsupported op 0x%x\n", op)); - if (pDstPicture->format == PICT_a8) { - if (R128BlendOp[op].src_alpha || R128BlendOp[op].dst_alpha || - pMaskPicture != NULL) - ATI_FALLBACK(("alpha blending unsupported with " - "A8 dst?\n")); - } else if (!R128GetDatatypePict(pDstPicture->format, &dstDatatype)) { - ATI_FALLBACK(("Unsupported dest format 0x%x\n", - pDstPicture->format)); - } - if (pMaskPicture != NULL && pMaskPicture->componentAlpha && - R128BlendOp[op].src_alpha) - ATI_FALLBACK(("Component alpha not supported with source alpha " - "blending.\n")); - - if (!R128CheckCompositeTexture(pSrcPicture)) - return FALSE; - if (pMaskPicture != NULL && !R128CheckCompositeTexture(pMaskPicture)) - return FALSE; - - return TRUE; -} - -static Bool -R128TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit, CARD32 *txsize, - CARD32 *tex_cntl_c) -{ - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - int bytepp, shift, l2w, l2h, l2p; - int pitch; - - pitch = pPix->devKind; - if ((pitch & (pitch - 1)) != 0) - ATI_FALLBACK(("NPOT pitch 0x%x unsupported\n", pitch)); - - switch (pPict->format) { - case PICT_a8: - /* DATATYPE_RGB8 appears to expand the value into the alpha - * channel like we want. We then blank out the R,G,B channels - * as necessary using the combiners. - */ - *tex_cntl_c = R128_DATATYPE_RGB8 << R128_TEX_DATATYPE_SHIFT; - break; - case PICT_a1r5g5b5: - *tex_cntl_c = R128_DATATYPE_ARGB1555 << R128_TEX_DATATYPE_SHIFT; - break; - case PICT_a4r4g4b4: - *tex_cntl_c = R128_DATATYPE_ARGB4444 << R128_TEX_DATATYPE_SHIFT; - break; - case PICT_r5g6b5: - *tex_cntl_c = R128_DATATYPE_RGB565 << R128_TEX_DATATYPE_SHIFT; - break; - case PICT_a8r8g8b8: - *tex_cntl_c = R128_DATATYPE_ARGB8888 << R128_TEX_DATATYPE_SHIFT; - break; - default: - return FALSE; - } - bytepp = PICT_FORMAT_BPP(pPict->format) / 8; - - *tex_cntl_c |= R128_MIP_MAP_DISABLE; - - if (pPict->filter == PictFilterBilinear) - *tex_cntl_c |= R128_MIN_BLEND_LINEAR | R128_MAG_BLEND_LINEAR; - - if (unit == 0) - shift = 0; - else { - shift = 16; - *tex_cntl_c |= R128_SEC_SELECT_SEC_ST; - } - - /* ATILog2 returns -1 for value of 0 */ - l2w = ATILog2(w - 1) + 1; - l2h = ATILog2(h - 1) + 1; - l2p = ATILog2(pPix->devKind / bytepp); - - if (pPict->repeat && w == 1 && h == 1) - l2p = 0; - else if (pPict->repeat && l2p != l2w) - ATI_FALLBACK(("Repeat not supported for pitch != width\n")); - l2w = l2p; - - widths[unit] = 1 << l2w; - heights[unit] = 1 << l2h; - *txsize |= l2p << (R128_TEX_PITCH_SHIFT + shift); - *txsize |= ((l2w > l2h) ? l2w : l2h) << (R128_TEX_SIZE_SHIFT + shift); - *txsize |= l2h << (R128_TEX_HEIGHT_SHIFT + shift); - - if (pPict->transform != 0) { - is_transform[unit] = TRUE; - transform[unit] = pPict->transform; - } else { - is_transform[unit] = FALSE; - } - - return TRUE; -} - -Bool -R128PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - CARD32 txsize = 0, prim_tex_cntl_c, sec_tex_cntl_c = 0, dstDatatype; - CARD32 dst_pitch_offset, color_factor, in_color_factor, alpha_comb; - CARD32 blend_cntl; - int i; - RING_LOCALS; - - accel_atis = atis; - - if (pDstPicture->format == PICT_a8) - dstDatatype = R128_DATATYPE_Y8; - else - R128GetDatatypePict(pDstPicture->format, &dstDatatype); - - if (!R128TextureSetup(pSrcPicture, pSrc, 0, &txsize, &prim_tex_cntl_c)) - return FALSE; - if (pMask != NULL && !R128TextureSetup(pMaskPicture, pMask, 1, &txsize, - &sec_tex_cntl_c)) - return FALSE; - else if (pMask == NULL) - is_transform[1] = FALSE; - - if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset)) - return FALSE; - - blend_cntl = R128BlendOp[op].blendctl; - if (PICT_FORMAT_A(pDstPicture->format) == 0 && - R128BlendOp[op].dst_alpha) { - if ((blend_cntl & R128_SBLEND_MASK) == - R128_SBLEND_DST_ALPHA) - blend_cntl = (blend_cntl & ~R128_SBLEND_MASK) | - R128_SBLEND_ONE; - else if ((blend_cntl & R128_SBLEND_MASK) == - R128_SBLEND_INV_DST_ALPHA) - blend_cntl = (blend_cntl & ~R128_SBLEND_MASK) | - R128_SBLEND_ZERO; - } - - BEGIN_DMA(12); - OUT_REG(R128_REG_SCALE_3D_CNTL, - R128_SCALE_3D_TEXMAP_SHADE | - R128_SCALE_PIX_REPLICATE | - R128_TEX_CACHE_SPLIT | - R128_TEX_MAP_ALPHA_IN_TEXTURE | - R128_TEX_CACHE_LINE_SIZE_4QW); - OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset); - OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, - ATI_GMC_DST_PITCH_OFFSET_CNTL | - ATI_GMC_BRUSH_SOLID_COLOR | - (dstDatatype << 8) | - ATI_GMC_SRC_DATATYPE_COLOR | - (ATIBltRop[GXcopy] << 16) | - ATI_DP_SRC_SOURCE_MEMORY | - R128_GMC_3D_FCN_EN | - ATI_GMC_CLR_CMP_CNTL_DIS | - R128_GMC_AUX_CLIP_DIS | - ATI_GMC_WR_MSK_DIS); - OUT_REG(R128_REG_MISC_3D_STATE_CNTL, - R128_MISC_SCALE_3D_TEXMAP_SHADE | - R128_MISC_SCALE_PIX_REPLICATE | - R128_ALPHA_COMB_ADD_CLAMP | - blend_cntl); - OUT_REG(R128_REG_TEX_CNTL_C, - R128_TEXMAP_ENABLE | - ((pMask != NULL) ? R128_SEC_TEXMAP_ENABLE : 0) | - R128_ALPHA_ENABLE | - R128_TEX_CACHE_FLUSH); - OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI); - END_DMA(); - - /* IN operator: Without a mask, only the first texture unit is enabled. - * With a mask, we put the source in the first unit and have it pass - * through as input to the 2nd. The 2nd unit takes the incoming source - * pixel and modulates it with either the alpha or each of the channels - * in the mask, depending on componentAlpha. - */ - BEGIN_DMA(15); - OUT_RING(DMA_PACKET0(R128_REG_PRIM_TEX_CNTL_C, 14)); - OUT_RING_REG(R128_REG_PRIM_TEX_CNTL_C, prim_tex_cntl_c); - - /* If this is the only stage and the dest is a8, route the alpha result - * to the color (red channel, in particular), too. Otherwise, be sure - * to zero out color channels of an a8 source. - */ - if (pMaskPicture == NULL && pDstPicture->format == PICT_a8) - color_factor = R128_COLOR_FACTOR_ALPHA; - else if (pSrcPicture->format == PICT_a8) - color_factor = R128_COLOR_FACTOR_CONST_COLOR; - else - color_factor = R128_COLOR_FACTOR_TEX; - - if (PICT_FORMAT_A(pSrcPicture->format) == 0) - alpha_comb = R128_COMB_ALPHA_COPY_INP; - else - alpha_comb = R128_COMB_ALPHA_DIS; - - OUT_RING_REG(R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C, - R128_COMB_COPY | - color_factor | - R128_INPUT_FACTOR_INT_COLOR | - alpha_comb | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_CONST_ALPHA); - OUT_RING_REG(R128_REG_TEX_SIZE_PITCH_C, txsize); - /* We could save some output by only writing the offset register that - * will actually be used. On the other hand, this is easy. - */ - for (i = 0; i <= 10; i++) { - OUT_RING_REG(R128_REG_PRIM_TEX_0_OFFSET_C + 4 * i, - ((CARD8 *)pSrc->devPrivate.ptr - - pScreenPriv->screen->memory_base)); - } - END_DMA(); - - if (pMask != NULL) { - BEGIN_DMA(14); - OUT_RING(DMA_PACKET0(R128_REG_SEC_TEX_CNTL_C, 13)); - OUT_RING_REG(R128_REG_SEC_TEX_CNTL_C, sec_tex_cntl_c); - - if (pDstPicture->format == PICT_a8) { - color_factor = R128_COLOR_FACTOR_ALPHA; - in_color_factor = R128_INPUT_FACTOR_PREV_ALPHA; - } else if (pMaskPicture->componentAlpha) { - color_factor = R128_COLOR_FACTOR_TEX; - in_color_factor = R128_INPUT_FACTOR_PREV_COLOR; - } else { - color_factor = R128_COLOR_FACTOR_ALPHA; - in_color_factor = R128_INPUT_FACTOR_PREV_COLOR; - } - - OUT_RING_REG(R128_REG_SEC_TEXTURE_COMBINE_CNTL_C, - R128_COMB_MODULATE | - color_factor | - in_color_factor | - R128_COMB_ALPHA_MODULATE | - R128_ALPHA_FACTOR_TEX_ALPHA | - R128_INP_FACTOR_A_PREV_ALPHA); - for (i = 0; i <= 10; i++) { - OUT_RING_REG(R128_REG_SEC_TEX_0_OFFSET_C + 4 * i, - ((CARD8 *)pMask->devPrivate.ptr - - pScreenPriv->screen->memory_base)); - } - END_DMA(); - } - - return TRUE; -} -#define VTX_RING_COUNT 8 - -#define VTX_OUT(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \ -do { \ - OUT_RING_F((_dstX)); \ - OUT_RING_F(((float)(_dstY)) + .125); \ - OUT_RING_F(0.0); \ - OUT_RING_F(1.0); \ - OUT_RING_F((((float)(_srcX)) + 0.5) / (widths[0])); \ - OUT_RING_F((((float)(_srcY)) + 0.5) / (heights[0])); \ - OUT_RING_F((((float)(_maskX)) + 0.5) / (widths[1])); \ - OUT_RING_F((((float)(_maskY)) + 0.5) / (heights[1])); \ -} while (0) - -void -R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, - int w, int h) -{ - ATIScreenInfo *atis = accel_atis; - int srcXend, srcYend, maskXend, maskYend; - PictVector v; - RING_LOCALS; - - /*ErrorF("R128Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n", - srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/ - - srcXend = srcX + w; - srcYend = srcY + h; - maskXend = maskX + w; - maskYend = maskY + h; - if (is_transform[0]) { - v.vector[0] = IntToxFixed(srcX); - v.vector[1] = IntToxFixed(srcY); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[0], &v); - srcX = xFixedToInt(v.vector[0]); - srcY = xFixedToInt(v.vector[1]); - v.vector[0] = IntToxFixed(srcXend); - v.vector[1] = IntToxFixed(srcYend); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[0], &v); - srcXend = xFixedToInt(v.vector[0]); - srcYend = xFixedToInt(v.vector[1]); - } - if (is_transform[1]) { - v.vector[0] = IntToxFixed(maskX); - v.vector[1] = IntToxFixed(maskY); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[1], &v); - maskX = xFixedToInt(v.vector[0]); - maskY = xFixedToInt(v.vector[1]); - v.vector[0] = IntToxFixed(maskXend); - v.vector[1] = IntToxFixed(maskYend); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[1], &v); - maskXend = xFixedToInt(v.vector[0]); - maskYend = xFixedToInt(v.vector[1]); - } - - BEGIN_DMA(3 + 4 * VTX_RING_COUNT); - OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM, - 2 + 4 * VTX_RING_COUNT)); - OUT_RING(R128_CCE_VC_FRMT_RHW | - R128_CCE_VC_FRMT_S_T | - R128_CCE_VC_FRMT_S2_T2); - OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN | - R128_CCE_VC_CNTL_PRIM_WALK_RING | - (4 << R128_CCE_VC_CNTL_NUM_SHIFT)); - - VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY); - VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend); - VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend); - VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY); - - END_DMA(); -} - -void -R128DoneComposite(void) -{ -} - -Bool -R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - CARD32 dst_pitch_offset; - RING_LOCALS; - - accel_atis = atis; - - if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch_offset)) - return FALSE; - - BEGIN_DMA(18); - OUT_REG(R128_REG_SCALE_3D_CNTL, - R128_SCALE_3D_TEXMAP_SHADE | - R128_SCALE_PIX_REPLICATE | - R128_TEX_CACHE_SPLIT | - R128_TEX_CACHE_LINE_SIZE_4QW); - OUT_REG(ATI_REG_DST_PITCH_OFFSET, dst_pitch_offset); - OUT_REG(ATI_REG_DP_GUI_MASTER_CNTL, - ATI_GMC_DST_PITCH_OFFSET_CNTL | - ATI_GMC_BRUSH_SOLID_COLOR | - (R128_DATATYPE_RGB8 << 8) | - ATI_GMC_SRC_DATATYPE_COLOR | - (ATIBltRop[GXcopy] << 16) | - ATI_DP_SRC_SOURCE_MEMORY | - R128_GMC_3D_FCN_EN | - ATI_GMC_CLR_CMP_CNTL_DIS | - ATI_GMC_WR_MSK_DIS); - OUT_REG(R128_REG_MISC_3D_STATE_CNTL, - R128_MISC_SCALE_3D_TEXMAP_SHADE | - R128_MISC_SCALE_PIX_REPLICATE | - R128_ALPHA_COMB_ADD_CLAMP | - R128BlendOp[PictOpAdd].blendctl); - OUT_REG(R128_REG_TEX_CNTL_C, - R128_ALPHA_ENABLE); - OUT_REG(R128_REG_PC_GUI_CTLSTAT, R128_PC_FLUSH_GUI); - - OUT_RING(DMA_PACKET0(R128_REG_AUX_SC_CNTL, 5)); - OUT_RING_REG(R128_REG_AUX_SC_CNTL, R128_AUX1_SC_ENB); - OUT_RING_REG(R128_REG_AUX1_SC_LEFT, 0); - OUT_RING_REG(R128_REG_AUX1_SC_RIGHT, pDst->drawable.width); - OUT_RING_REG(R128_REG_AUX1_SC_TOP, 0); - OUT_RING_REG(R128_REG_AUX1_SC_BOTTOM, pDst->drawable.height); - END_DMA(); - - return TRUE; -} - -#define TRAP_VERT_RING_COUNT 4 - -#define TRAP_VERT(_x, _y) \ -do { \ - OUT_RING_F((_x) + sample_x); \ - OUT_RING_F((_y) + 0.125 + sample_y); \ - OUT_RING_F(0.0); \ - OUT_RING(0x01010101); \ -} while (0) - -void -R128Trapezoids(KaaTrapezoid *traps, int ntraps) -{ - ATIScreenInfo *atis = accel_atis; - RING_LOCALS; - - while (ntraps > 0) { - int i, sample, count, vertcount; - - count = 0xffff / 4 / sample_count; - if (count > ntraps) - count = ntraps; - vertcount = count * sample_count * 4; - - BEGIN_DMA(3 + vertcount * TRAP_VERT_RING_COUNT); - OUT_RING(DMA_PACKET3(ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM, - 2 + vertcount * TRAP_VERT_RING_COUNT)); - OUT_RING(R128_CCE_VC_FRMT_DIFFUSE_ARGB); - OUT_RING(R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN | - R128_CCE_VC_CNTL_PRIM_WALK_RING | - (vertcount << R128_CCE_VC_CNTL_NUM_SHIFT)); - - for (i = 0; i < count; i++) { - for (sample = 0; sample < sample_count; sample++) { - float sample_x = sample_offsets_x[sample]; - float sample_y = sample_offsets_y[sample]; - TRAP_VERT(traps[i].tl, traps[i].ty); - TRAP_VERT(traps[i].bl, traps[i].by); - TRAP_VERT(traps[i].br, traps[i].by); - TRAP_VERT(traps[i].tr, traps[i].ty); - } - } - END_DMA(); - - ntraps -= count; - traps += count; - } -} - -void -R128DoneTrapezoids(void) -{ -} diff --git a/hw/kdrive/ati/r128_sarea.h b/hw/kdrive/ati/r128_sarea.h deleted file mode 100644 index 6fbd05ecb..000000000 --- a/hw/kdrive/ati/r128_sarea.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, - * Precision Insight, Inc., Cedar Park, Texas, and - * VA Linux Systems Inc., Fremont, California. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX - * SYSTEMS AND/OR THEIR SUPPLIERS 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. - */ - -/* - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * - */ - -#ifndef _R128_SAREA_H_ -#define _R128_SAREA_H_ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the kernel file (r128_drm.h) - */ -#ifndef __R128_SAREA_DEFINES__ -#define __R128_SAREA_DEFINES__ - -/* What needs to be changed for the current vertex buffer? - */ -#define R128_UPLOAD_CONTEXT 0x001 -#define R128_UPLOAD_SETUP 0x002 -#define R128_UPLOAD_TEX0 0x004 -#define R128_UPLOAD_TEX1 0x008 -#define R128_UPLOAD_TEX0IMAGES 0x010 -#define R128_UPLOAD_TEX1IMAGES 0x020 -#define R128_UPLOAD_CORE 0x040 -#define R128_UPLOAD_MASKS 0x080 -#define R128_UPLOAD_WINDOW 0x100 -#define R128_UPLOAD_CLIPRECTS 0x200 /* handled client-side */ -#define R128_REQUIRE_QUIESCENCE 0x400 -#define R128_UPLOAD_ALL 0x7ff - -#define R128_FRONT 0x1 -#define R128_BACK 0x2 -#define R128_DEPTH 0x4 - -/* Primitive types - */ -#define R128_POINTS 0x1 -#define R128_LINES 0x2 -#define R128_LINE_STRIP 0x3 -#define R128_TRIANGLES 0x4 -#define R128_TRIANGLE_FAN 0x5 -#define R128_TRIANGLE_STRIP 0x6 - -/* Vertex/indirect buffer size - */ -#define R128_BUFFER_SIZE 16384 - -/* Byte offsets for indirect buffer data - */ -#define R128_INDEX_PRIM_OFFSET 20 -#define R128_HOSTDATA_BLIT_OFFSET 32 - -/* Keep these small for testing - */ -#define R128_NR_SAREA_CLIPRECTS 12 - -#define R128_NR_CONTEXT_REGS 12 - -#define R128_MAX_TEXTURE_LEVELS 11 -#define R128_MAX_TEXTURE_UNITS 2 - -#endif /* __R128_SAREA_DEFINES__ */ - -typedef struct { - /* Context state - can be written in one large chunk */ - unsigned int dst_pitch_offset_c; - unsigned int dp_gui_master_cntl_c; - unsigned int sc_top_left_c; - unsigned int sc_bottom_right_c; - unsigned int z_offset_c; - unsigned int z_pitch_c; - unsigned int z_sten_cntl_c; - unsigned int tex_cntl_c; - unsigned int misc_3d_state_cntl_reg; - unsigned int texture_clr_cmp_clr_c; - unsigned int texture_clr_cmp_msk_c; - unsigned int fog_color_c; - - /* Texture state */ - unsigned int tex_size_pitch_c; - unsigned int constant_color_c; - - /* Setup state */ - unsigned int pm4_vc_fpu_setup; - unsigned int setup_cntl; - - /* Mask state */ - unsigned int dp_write_mask; - unsigned int sten_ref_mask_c; - unsigned int plane_3d_mask_c; - - /* Window state */ - unsigned int window_xy_offset; - - /* Core state */ - unsigned int scale_3d_cntl; -} r128_context_regs_t; - -/* Setup registers for each texture unit - */ -typedef struct { - unsigned int tex_cntl; - unsigned int tex_combine_cntl; - unsigned int tex_size_pitch; - unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; - unsigned int tex_border_color; -} r128_texture_regs_t; - -typedef struct { - /* The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ - r128_context_regs_t ContextState; - r128_texture_regs_t TexState[R128_MAX_TEXTURE_UNITS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; - -#ifdef XF86DRI - /* The current cliprects, or a subset thereof. - */ - XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS]; - unsigned int nbox; -#endif - - /* Counters for throttling of rendering clients. - */ - unsigned int last_frame; - unsigned int last_dispatch; - - /* Maintain an LRU of contiguous regions of texture space. If you - * think you own a region of texture memory, and it has an age - * different to the one you set, then you are mistaken and it has - * been stolen by another client. If global texAge hasn't changed, - * there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained texture - * information of other clients - by maintaining them in the same - * lru which is used to age their own textures, clients have an - * approximate lru for the whole of global texture space, and can - * make informed decisions as to which areas to kick out. There is - * no need to choose whether to kick out your own texture or someone - * else's - simply eject them all in LRU order. - */ - /* Last elt is sentinal */ - drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1]; - /* last time texture was uploaded */ - unsigned int texAge[ATI_NR_TEX_HEAPS]; - - int ctxOwner; /* last context to upload state */ - int pfAllowPageFlip; /* set by the 2d driver, read by the client */ - int pfCurrentPage; /* set by kernel, read by others */ -} R128SAREAPriv, *R128SAREAPrivPtr; - -#endif diff --git a/hw/kdrive/ati/radeon_common.h b/hw/kdrive/ati/radeon_common.h deleted file mode 100644 index 6c416c6b1..000000000 --- a/hw/kdrive/ati/radeon_common.h +++ /dev/null @@ -1,460 +0,0 @@ -/* radeon_common.h -- common header definitions for Radeon 2D/3D/DRM suite - * - * Copyright 2000 VA Linux Systems, Inc., Fremont, California. - * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. - * 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 (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 - * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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: - * Gareth Hughes <gareth@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * Keith Whitwell <keith@tungstengraphics.com> - * - * Converted to common header format: - * Jens Owen <jens@tungstengraphics.com> - * - * - */ - -#ifndef _RADEON_COMMON_H_ -#define _RADEON_COMMON_H_ - -#include <inttypes.h> - -/* WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (radeon_drm.h) - */ - -/* Driver specific DRM command indices - * NOTE: these are not OS specific, but they are driver specific - */ -#define DRM_RADEON_CP_INIT 0x00 -#define DRM_RADEON_CP_START 0x01 -#define DRM_RADEON_CP_STOP 0x02 -#define DRM_RADEON_CP_RESET 0x03 -#define DRM_RADEON_CP_IDLE 0x04 -#define DRM_RADEON_RESET 0x05 -#define DRM_RADEON_FULLSCREEN 0x06 -#define DRM_RADEON_SWAP 0x07 -#define DRM_RADEON_CLEAR 0x08 -#define DRM_RADEON_VERTEX 0x09 -#define DRM_RADEON_INDICES 0x0a -#define DRM_RADEON_STIPPLE 0x0c -#define DRM_RADEON_INDIRECT 0x0d -#define DRM_RADEON_TEXTURE 0x0e -#define DRM_RADEON_VERTEX2 0x0f -#define DRM_RADEON_CMDBUF 0x10 -#define DRM_RADEON_GETPARAM 0x11 -#define DRM_RADEON_FLIP 0x12 -#define DRM_RADEON_ALLOC 0x13 -#define DRM_RADEON_FREE 0x14 -#define DRM_RADEON_INIT_HEAP 0x15 -#define DRM_RADEON_IRQ_EMIT 0x16 -#define DRM_RADEON_IRQ_WAIT 0x17 -#define DRM_RADEON_CP_RESUME 0x18 -#define DRM_RADEON_SETPARAM 0x19 -#define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39 - - -#define RADEON_FRONT 0x1 -#define RADEON_BACK 0x2 -#define RADEON_DEPTH 0x4 -#define RADEON_STENCIL 0x8 - -#define RADEON_CLEAR_X1 0 -#define RADEON_CLEAR_Y1 1 -#define RADEON_CLEAR_X2 2 -#define RADEON_CLEAR_Y2 3 -#define RADEON_CLEAR_DEPTH 4 - - -typedef struct { - enum { - DRM_RADEON_INIT_CP = 0x01, - DRM_RADEON_CLEANUP_CP = 0x02, - DRM_RADEON_INIT_R200_CP = 0x03 - } func; - unsigned long sarea_priv_offset; - int is_pci; - int cp_mode; - int gart_size; - int ring_size; - int usec_timeout; - - unsigned int fb_bpp; - unsigned int front_offset, front_pitch; - unsigned int back_offset, back_pitch; - unsigned int depth_bpp; - unsigned int depth_offset, depth_pitch; - - unsigned long fb_offset; - unsigned long mmio_offset; - unsigned long ring_offset; - unsigned long ring_rptr_offset; - unsigned long buffers_offset; - unsigned long gart_textures_offset; -} drmRadeonInit; - -typedef struct { - int flush; - int idle; -} drmRadeonCPStop; - -typedef struct { - int idx; - int start; - int end; - int discard; -} drmRadeonIndirect; - -typedef union drmRadeonClearR { - float f[5]; - unsigned int ui[5]; -} drmRadeonClearRect; - -typedef struct drmRadeonClearT { - unsigned int flags; - unsigned int clear_color; - unsigned int clear_depth; - unsigned int color_mask; - unsigned int depth_mask; /* misnamed field: should be stencil */ - drmRadeonClearRect *depth_boxes; -} drmRadeonClearType; - -typedef struct drmRadeonFullscreenT { - enum { - RADEON_INIT_FULLSCREEN = 0x01, - RADEON_CLEANUP_FULLSCREEN = 0x02 - } func; -} drmRadeonFullscreenType; - -typedef struct { - unsigned int *mask; -} drmRadeonStipple; - -typedef struct { - unsigned int x; - unsigned int y; - unsigned int width; - unsigned int height; - const void *data; -} drmRadeonTexImage; - -typedef struct { - unsigned int offset; - int pitch; - int format; - int width; /* Texture image coordinates */ - int height; - drmRadeonTexImage *image; -} drmRadeonTexture; - - -#define RADEON_MAX_TEXTURE_UNITS 3 - -/* Layout matches drm_radeon_state_t in linux drm_radeon.h. - */ -typedef struct { - struct { - unsigned int pp_misc; /* 0x1c14 */ - unsigned int pp_fog_color; - unsigned int re_solid_color; - unsigned int rb3d_blendcntl; - unsigned int rb3d_depthoffset; - unsigned int rb3d_depthpitch; - unsigned int rb3d_zstencilcntl; - unsigned int pp_cntl; /* 0x1c38 */ - unsigned int rb3d_cntl; - unsigned int rb3d_coloroffset; - unsigned int re_width_height; - unsigned int rb3d_colorpitch; - } context; - struct { - unsigned int se_cntl; - } setup1; - struct { - unsigned int se_coord_fmt; /* 0x1c50 */ - } vertex; - struct { - unsigned int re_line_pattern; /* 0x1cd0 */ - unsigned int re_line_state; - unsigned int se_line_width; /* 0x1db8 */ - } line; - struct { - unsigned int pp_lum_matrix; /* 0x1d00 */ - unsigned int pp_rot_matrix_0; /* 0x1d58 */ - unsigned int pp_rot_matrix_1; - } bumpmap; - struct { - unsigned int rb3d_stencilrefmask; /* 0x1d7c */ - unsigned int rb3d_ropcntl; - unsigned int rb3d_planemask; - } mask; - struct { - unsigned int se_vport_xscale; /* 0x1d98 */ - unsigned int se_vport_xoffset; - unsigned int se_vport_yscale; - unsigned int se_vport_yoffset; - unsigned int se_vport_zscale; - unsigned int se_vport_zoffset; - } viewport; - struct { - unsigned int se_cntl_status; /* 0x2140 */ - } setup2; - struct { - unsigned int re_top_left; /*ignored*/ /* 0x26c0 */ - unsigned int re_misc; - } misc; - struct { - unsigned int pp_txfilter; - unsigned int pp_txformat; - unsigned int pp_txoffset; - unsigned int pp_txcblend; - unsigned int pp_txablend; - unsigned int pp_tfactor; - unsigned int pp_border_color; - } texture[RADEON_MAX_TEXTURE_UNITS]; - struct { - unsigned int se_zbias_factor; - unsigned int se_zbias_constant; - } zbias; - unsigned int dirty; -} drmRadeonState; - -/* 1.1 vertex ioctl. Used in compatibility modes. - */ -typedef struct { - int prim; - int idx; /* Index of vertex buffer */ - int count; /* Number of vertices in buffer */ - int discard; /* Client finished with buffer? */ -} drmRadeonVertex; - -typedef struct { - unsigned int start; - unsigned int finish; - unsigned int prim:8; - unsigned int stateidx:8; - unsigned int numverts:16; /* overloaded as offset/64 for elt prims */ - unsigned int vc_format; -} drmRadeonPrim; - -typedef struct { - int idx; /* Index of vertex buffer */ - int discard; /* Client finished with buffer? */ - int nr_states; - drmRadeonState *state; - int nr_prims; - drmRadeonPrim *prim; -} drmRadeonVertex2; - -#define RADEON_MAX_STATES 16 -#define RADEON_MAX_PRIMS 64 - -/* Command buffer. Replace with true dma stream? - */ -typedef struct { - int bufsz; - char *buf; - int nbox; - drmClipRect *boxes; -} drmRadeonCmdBuffer; - -/* New style per-packet identifiers for use in cmd_buffer ioctl with - * the RADEON_EMIT_PACKET command. Comments relate new packets to old - * state bits and the packet size: - */ -#define RADEON_EMIT_PP_MISC 0 /* context/7 */ -#define RADEON_EMIT_PP_CNTL 1 /* context/3 */ -#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */ -#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */ -#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */ -#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */ -#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */ -#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */ -#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */ -#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */ -#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */ -#define RADEON_EMIT_RE_MISC 11 /* misc/1 */ -#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */ -#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */ -#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */ -#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */ -#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */ -#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */ -#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */ -#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */ -#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */ -#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */ -#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */ -#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */ -#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */ -#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */ -#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */ -#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */ -#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */ -#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/6 */ -#define R200_EMIT_TFACTOR_0 30 /* tf/6 */ -#define R200_EMIT_VTX_FMT_0 31 /* vtx/4 */ -#define R200_EMIT_VAP_CTL 32 /* vap/1 */ -#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */ -#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */ -#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */ -#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */ -#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */ -#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */ -#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */ -#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */ -#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */ -#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */ -#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */ -#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */ -#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */ -#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */ -#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */ -#define R200_EMIT_VTE_CNTL 48 /* vte/1 */ -#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */ -#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */ -#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */ -#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */ -#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */ -#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */ -#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */ -#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */ -#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */ -#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */ -#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */ -#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */ -#define R200_EMIT_PP_CUBIC_FACES_0 61 -#define R200_EMIT_PP_CUBIC_OFFSETS_0 62 -#define R200_EMIT_PP_CUBIC_FACES_1 63 -#define R200_EMIT_PP_CUBIC_OFFSETS_1 64 -#define R200_EMIT_PP_CUBIC_FACES_2 65 -#define R200_EMIT_PP_CUBIC_OFFSETS_2 66 -#define R200_EMIT_PP_CUBIC_FACES_3 67 -#define R200_EMIT_PP_CUBIC_OFFSETS_3 68 -#define R200_EMIT_PP_CUBIC_FACES_4 69 -#define R200_EMIT_PP_CUBIC_OFFSETS_4 70 -#define R200_EMIT_PP_CUBIC_FACES_5 71 -#define R200_EMIT_PP_CUBIC_OFFSETS_5 72 -#define RADEON_EMIT_PP_TEX_SIZE_0 73 -#define RADEON_EMIT_PP_TEX_SIZE_1 74 -#define RADEON_EMIT_PP_TEX_SIZE_2 75 -#define RADEON_MAX_STATE_PACKETS 76 - - -/* Commands understood by cmd_buffer ioctl. More can be added but - * obviously these can't be removed or changed: - */ -#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */ -#define RADEON_CMD_SCALARS 2 /* emit scalar data */ -#define RADEON_CMD_VECTORS 3 /* emit vector data */ -#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */ -#define RADEON_CMD_PACKET3 5 /* emit hw packet */ -#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */ -#define RADEON_CMD_SCALARS2 7 /* R200 stopgap */ -#define RADEON_CMD_WAIT 8 /* synchronization */ - -typedef union { - int i; - struct { - unsigned char cmd_type, pad0, pad1, pad2; - } header; - struct { - unsigned char cmd_type, packet_id, pad0, pad1; - } packet; - struct { - unsigned char cmd_type, offset, stride, count; - } scalars; - struct { - unsigned char cmd_type, offset, stride, count; - } vectors; - struct { - unsigned char cmd_type, buf_idx, pad0, pad1; - } dma; - struct { - unsigned char cmd_type, flags, pad0, pad1; - } wait; -} drmRadeonCmdHeader; - - -#define RADEON_WAIT_2D 0x1 -#define RADEON_WAIT_3D 0x2 - - -typedef struct drm_radeon_getparam { - int param; - int *value; -} drmRadeonGetParam; - -#define RADEON_PARAM_GART_BUFFER_OFFSET 1 -#define RADEON_PARAM_LAST_FRAME 2 -#define RADEON_PARAM_LAST_DISPATCH 3 -#define RADEON_PARAM_LAST_CLEAR 4 -#define RADEON_PARAM_IRQ_NR 5 -#define RADEON_PARAM_GART_BASE 6 - - -#define RADEON_MEM_REGION_GART 1 -#define RADEON_MEM_REGION_FB 2 - -typedef struct drm_radeon_mem_alloc { - int region; - int alignment; - int size; - int *region_offset; /* offset from start of fb or GART */ -} drmRadeonMemAlloc; - -typedef struct drm_radeon_mem_free { - int region; - int region_offset; -} drmRadeonMemFree; - -typedef struct drm_radeon_mem_init_heap { - int region; - int size; - int start; -} drmRadeonMemInitHeap; - -/* 1.6: Userspace can request & wait on irq's: - */ -typedef struct drm_radeon_irq_emit { - int *irq_seq; -} drmRadeonIrqEmit; - -typedef struct drm_radeon_irq_wait { - int irq_seq; -} drmRadeonIrqWait; - - -/* 1.10: Clients tell the DRM where they think the framebuffer is located in - * the card's address space, via a new generic ioctl to set parameters - */ - -typedef struct drm_radeon_set_param { - unsigned int param; - int64_t value; -} drmRadeonSetParam; - -#define RADEON_SETPARAM_FB_LOCATION 1 - - -#endif diff --git a/hw/kdrive/ati/radeon_composite.c b/hw/kdrive/ati/radeon_composite.c deleted file mode 100644 index ddad343e3..000000000 --- a/hw/kdrive/ati/radeon_composite.c +++ /dev/null @@ -1,875 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "ati.h" -#include "ati_reg.h" -#include "ati_dma.h" -#include "ati_draw.h" - -extern ATIScreenInfo *accel_atis; -extern int sample_count; -extern float sample_offsets_x[255]; -extern float sample_offsets_y[255]; -static Bool is_transform[2]; -static PictTransform *transform[2]; - -struct blendinfo { - Bool dst_alpha; - Bool src_alpha; - CARD32 blend_cntl; -}; - -static struct blendinfo RadeonBlendOp[] = { - /* Clear */ - {0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ZERO}, - /* Src */ - {0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ZERO}, - /* Dst */ - {0, 0, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_ONE}, - /* Over */ - {0, 1, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_INV_SRC_ALPHA}, - /* OverReverse */ - {1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ONE}, - /* In */ - {1, 0, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_ZERO}, - /* InReverse */ - {0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_SRC_ALPHA}, - /* Out */ - {1, 0, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_ZERO}, - /* OutReverse */ - {0, 1, RADEON_SBLEND_GL_ZERO | RADEON_DBLEND_GL_INV_SRC_ALPHA}, - /* Atop */ - {1, 1, RADEON_SBLEND_GL_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA}, - /* AtopReverse */ - {1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_SRC_ALPHA}, - /* Xor */ - {1, 1, RADEON_SBLEND_GL_INV_DST_ALPHA | RADEON_DBLEND_GL_INV_SRC_ALPHA}, - /* Add */ - {0, 0, RADEON_SBLEND_GL_ONE | RADEON_DBLEND_GL_ONE}, -}; - -struct formatinfo { - int fmt; - Bool byte_swap; - CARD32 card_fmt; -}; - -/* Note on texture formats: - * TXFORMAT_Y8 expands to (Y,Y,Y,1). TXFORMAT_I8 expands to (I,I,I,I) - */ -static struct formatinfo R100TexFormats[] = { - {PICT_a8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8r8g8b8, 0, RADEON_TXFORMAT_ARGB8888}, - {PICT_a8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8b8g8r8, 1, RADEON_TXFORMAT_RGBA8888}, - {PICT_r5g6b5, 0, RADEON_TXFORMAT_RGB565}, - {PICT_a1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x1r5g5b5, 0, RADEON_TXFORMAT_ARGB1555}, - {PICT_a8, 0, RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP}, -}; - -static struct formatinfo R200TexFormats[] = { - {PICT_a8r8g8b8, 0, R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8r8g8b8, 0, R200_TXFORMAT_ARGB8888}, - {PICT_a8r8g8b8, 1, R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x8r8g8b8, 1, R200_TXFORMAT_RGBA8888}, - {PICT_r5g6b5, 0, R200_TXFORMAT_RGB565}, - {PICT_a1r5g5b5, 0, R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP}, - {PICT_x1r5g5b5, 0, R200_TXFORMAT_ARGB1555}, - {PICT_a8, 0, R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP}, -}; - -/* Common Radeon setup code */ - -static Bool -RadeonGetDestFormat(PicturePtr pDstPicture, CARD32 *dst_format) -{ - switch (pDstPicture->format) { - case PICT_a8r8g8b8: - case PICT_x8r8g8b8: - *dst_format = RADEON_COLOR_FORMAT_ARGB8888; - break; - case PICT_r5g6b5: - *dst_format = RADEON_COLOR_FORMAT_RGB565; - break; - case PICT_a1r5g5b5: - case PICT_x1r5g5b5: - *dst_format = RADEON_COLOR_FORMAT_ARGB1555; - break; - case PICT_a8: - *dst_format = RADEON_COLOR_FORMAT_RGB8; - break; - default: - ATI_FALLBACK(("Unsupported dest format 0x%x\n", - pDstPicture->format)); - } - - return TRUE; -} - -/* R100-specific code */ - -static Bool -R100CheckCompositeTexture(PicturePtr pPict, int unit) -{ - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - int i; - - if ((w > 0x7ff) || (h > 0x7ff)) - ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); - - for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++) - { - if (R100TexFormats[i].fmt == pPict->format) - break; - } - if (i == sizeof(R100TexFormats) / sizeof(R100TexFormats[0])) - ATI_FALLBACK(("Unsupported picture format 0x%x\n", - pPict->format)); - - if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) - ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h)); - - if (pPict->filter != PictFilterNearest && - pPict->filter != PictFilterBilinear) - ATI_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter)); - - return TRUE; -} - -static Bool -R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit) -{ - ATIScreenInfo *atis = accel_atis; - KdScreenPriv(pPix->drawable.pScreen); - CARD32 txfilter, txformat, txoffset, txpitch; - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - int i; - RING_LOCALS; - - txpitch = pPix->devKind; - txoffset = ((CARD8 *)pPix->devPrivate.ptr - - pScreenPriv->screen->memory_base); - - for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++) - { - if (R100TexFormats[i].fmt == pPict->format) - break; - } - txformat = R100TexFormats[i].card_fmt; - if (R100TexFormats[i].byte_swap) - txoffset |= RADEON_TXO_ENDIAN_BYTE_SWAP; - - if (pPict->repeat) { - txformat |= ATILog2(w) << RADEON_TXFORMAT_WIDTH_SHIFT; - txformat |= ATILog2(h) << RADEON_TXFORMAT_HEIGHT_SHIFT; - } else - txformat |= RADEON_TXFORMAT_NON_POWER2; - txformat |= unit << 24; /* RADEON_TXFORMAT_ST_ROUTE_STQX */ - - - if ((txoffset & 0x1f) != 0) - ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset)); - if ((txpitch & 0x1f) != 0) - ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch)); - - switch (pPict->filter) { - case PictFilterNearest: - txfilter = (RADEON_MAG_FILTER_NEAREST | - RADEON_MIN_FILTER_NEAREST); - break; - case PictFilterBilinear: - txfilter = (RADEON_MAG_FILTER_LINEAR | - RADEON_MIN_FILTER_LINEAR); - break; - default: - ATI_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); - } - - BEGIN_DMA(7); - if (unit == 0) { - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 3)); - OUT_RING_REG(RADEON_REG_PP_TXFILTER_0, txfilter); - OUT_RING_REG(RADEON_REG_PP_TXFORMAT_0, txformat); - OUT_RING_REG(RADEON_REG_PP_TXOFFSET_0, txoffset); - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2)); - OUT_RING_REG(RADEON_REG_PP_TEX_SIZE_0, - (pPix->drawable.width - 1) | - ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); - OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_0, txpitch - 32); - } else { - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_1, 3)); - OUT_RING_REG(RADEON_REG_PP_TXFILTER_1, txfilter); - OUT_RING_REG(RADEON_REG_PP_TXFORMAT_1, txformat); - OUT_RING_REG(RADEON_REG_PP_TXOFFSET_1, txoffset); - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_1, 2)); - OUT_RING_REG(RADEON_REG_PP_TEX_SIZE_1, - (pPix->drawable.width - 1) | - ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); - OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_1, txpitch - 32); - } - END_DMA(); - - if (pPict->transform != 0) { - is_transform[unit] = TRUE; - transform[unit] = pPict->transform; - } else { - is_transform[unit] = FALSE; - } - - return TRUE; -} - -Bool -R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture) -{ - CARD32 tmp1; - - /* Check for unsupported compositing operations. */ - if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0])) - ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op)); - if (pMaskPicture != NULL && pMaskPicture->componentAlpha && - RadeonBlendOp[op].src_alpha) - ATI_FALLBACK(("Component alpha not supported with source " - "alpha blending.\n")); - if (pDstPicture->pDrawable->width >= (1 << 11) || - pDstPicture->pDrawable->height >= (1 << 11)) - ATI_FALLBACK(("Dest w/h too large (%d,%d).\n", - pDstPicture->pDrawable->width, - pDstPicture->pDrawable->height)); - - if (!R100CheckCompositeTexture(pSrcPicture, 0)) - return FALSE; - if (pMaskPicture != NULL && !R100CheckCompositeTexture(pMaskPicture, 1)) - return FALSE; - - if (pDstPicture->componentAlpha) - return FALSE; - - if (!RadeonGetDestFormat(pDstPicture, &tmp1)) - return FALSE; - - return TRUE; -} - -Bool -R100PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - CARD32 dst_format, dst_offset, dst_pitch; - CARD32 pp_cntl, blendcntl, cblend, ablend; - int pixel_shift; - RING_LOCALS; - - accel_atis = atis; - - RadeonGetDestFormat(pDstPicture, &dst_format); - pixel_shift = pDst->drawable.bitsPerPixel >> 4; - - dst_offset = ((CARD8 *)pDst->devPrivate.ptr - - pScreenPriv->screen->memory_base); - dst_pitch = pDst->devKind; - if ((dst_offset & 0x0f) != 0) - ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset)); - if (((dst_pitch >> pixel_shift) & 0x7) != 0) - ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch)); - - if (!R100TextureSetup(pSrcPicture, pSrc, 0)) - return FALSE; - pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE; - - if (pMask != NULL) { - if (!R100TextureSetup(pMaskPicture, pMask, 1)) - return FALSE; - pp_cntl |= RADEON_TEX_1_ENABLE; - } else { - is_transform[1] = FALSE; - } - - ENTER_DRAW(pDst); - - RadeonSwitchTo3D(atis); - - BEGIN_DMA(12); - - OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3)); - OUT_RING_REG(RADEON_REG_PP_CNTL, pp_cntl); - OUT_RING_REG(RADEON_REG_RB3D_CNTL, - dst_format | RADEON_ALPHA_BLEND_ENABLE); - OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset); - - OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift); - - /* IN operator: Multiply src by mask components or mask alpha. - * BLEND_CTL_ADD is A * B + C. - * If a picture is a8, we have to explicitly zero its color values. - * If the destination is a8, we have to route the alpha to red, I think. - */ - cblend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | - RADEON_COLOR_ARG_C_ZERO; - ablend = RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | - RADEON_ALPHA_ARG_C_ZERO; - - if (pDstPicture->format == PICT_a8) - cblend |= RADEON_COLOR_ARG_A_T0_ALPHA; - else if (pSrcPicture->format == PICT_a8) - cblend |= RADEON_COLOR_ARG_A_ZERO; - else - cblend |= RADEON_COLOR_ARG_A_T0_COLOR; - ablend |= RADEON_ALPHA_ARG_A_T0_ALPHA; - - if (pMask) { - if (pMaskPicture->componentAlpha && - pDstPicture->format != PICT_a8) - cblend |= RADEON_COLOR_ARG_B_T1_COLOR; - else - cblend |= RADEON_COLOR_ARG_B_T1_ALPHA; - ablend |= RADEON_ALPHA_ARG_B_T1_ALPHA; - } else { - cblend |= RADEON_COLOR_ARG_B_ZERO | RADEON_COMP_ARG_B; - ablend |= RADEON_ALPHA_ARG_B_ZERO | RADEON_COMP_ARG_B; - } - - OUT_REG(RADEON_REG_PP_TXCBLEND_0, cblend); - OUT_REG(RADEON_REG_PP_TXABLEND_0, ablend); - - /* Op operator. */ - blendcntl = RadeonBlendOp[op].blend_cntl; - if (PICT_FORMAT_A(pDstPicture->format) == 0 && - RadeonBlendOp[op].dst_alpha) { - if ((blendcntl & RADEON_SBLEND_MASK) == - RADEON_SBLEND_GL_DST_ALPHA) - blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) | - RADEON_SBLEND_GL_ONE; - else if ((blendcntl & RADEON_SBLEND_MASK) == - RADEON_SBLEND_GL_INV_DST_ALPHA) - blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) | - RADEON_SBLEND_GL_ZERO; - } - OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl); - END_DMA(); - - LEAVE_DRAW(pDst); - - return TRUE; -} - -static Bool -R200CheckCompositeTexture(PicturePtr pPict, int unit) -{ - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - int i; - - if ((w > 0x7ff) || (h > 0x7ff)) - ATI_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); - - for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++) - { - if (R200TexFormats[i].fmt == pPict->format) - break; - } - if (i == sizeof(R200TexFormats) / sizeof(R200TexFormats[0])) - ATI_FALLBACK(("Unsupported picture format 0x%x\n", - pPict->format)); - - if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) - ATI_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h)); - - if (pPict->filter != PictFilterNearest && - pPict->filter != PictFilterBilinear) - ATI_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter)); - - return TRUE; -} - -static Bool -R200TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit) -{ - ATIScreenInfo *atis = accel_atis; - KdScreenPriv(pPix->drawable.pScreen); - CARD32 txfilter, txformat, txoffset, txpitch; - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - int i; - RING_LOCALS; - - txpitch = pPix->devKind; - txoffset = ((CARD8 *)pPix->devPrivate.ptr - - pScreenPriv->screen->memory_base); - - for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++) - { - if (R200TexFormats[i].fmt == pPict->format) - break; - } - txformat = R200TexFormats[i].card_fmt; - if (R200TexFormats[i].byte_swap) - txoffset |= R200_TXO_ENDIAN_BYTE_SWAP; - - if (pPict->repeat) { - txformat |= ATILog2(w) << R200_TXFORMAT_WIDTH_SHIFT; - txformat |= ATILog2(h) << R200_TXFORMAT_HEIGHT_SHIFT; - } else - txformat |= R200_TXFORMAT_NON_POWER2; - txformat |= unit << R200_TXFORMAT_ST_ROUTE_SHIFT; - - if ((txoffset & 0x1f) != 0) - ATI_FALLBACK(("Bad texture offset 0x%x\n", txoffset)); - if ((txpitch & 0x1f) != 0) - ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch)); - - switch (pPict->filter) { - case PictFilterNearest: - txfilter = (R200_MAG_FILTER_NEAREST | - R200_MIN_FILTER_NEAREST); - break; - case PictFilterBilinear: - txfilter = (R200_MAG_FILTER_LINEAR | - R200_MIN_FILTER_LINEAR); - break; - default: - ATI_FALLBACK(("Bad filter 0x%x\n", pPict->filter)); - } - - if (unit == 0) { - BEGIN_DMA(6); - OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_0 + 0x20 * unit, 5)); - OUT_RING_REG(R200_REG_PP_TXFILTER_0, txfilter); - OUT_RING_REG(R200_REG_PP_TXFORMAT_0, txformat); - OUT_RING_REG(R200_REG_PP_TXFORMAT_X_0, 0); - OUT_RING_REG(R200_REG_PP_TXSIZE_0, - (pPix->drawable.width - 1) | - ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); - OUT_RING_REG(R200_REG_PP_TXPITCH_0, txpitch - 32); - END_DMA(); - } else { - BEGIN_DMA(6); - OUT_RING(DMA_PACKET0(R200_REG_PP_TXFILTER_1, 5)); - OUT_RING_REG(R200_REG_PP_TXFILTER_1, txfilter); - OUT_RING_REG(R200_REG_PP_TXFORMAT_1, txformat); - OUT_RING_REG(R200_REG_PP_TXFORMAT_X_1, 0); - OUT_RING_REG(R200_REG_PP_TXSIZE_1, - (pPix->drawable.width - 1) | - ((pPix->drawable.height - 1) << RADEON_TEX_VSIZE_SHIFT)); - OUT_RING_REG(R200_REG_PP_TXPITCH_1, txpitch - 32); - END_DMA(); - } - - BEGIN_DMA(2); - OUT_REG(R200_PP_TXOFFSET_0 + 0x18 * unit, txoffset); - END_DMA(); - - if (pPict->transform != 0) { - is_transform[unit] = TRUE; - transform[unit] = pPict->transform; - } else { - is_transform[unit] = FALSE; - } - - return TRUE; -} - -Bool -R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture) -{ - CARD32 tmp1; - - /* Check for unsupported compositing operations. */ - if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0])) - ATI_FALLBACK(("Unsupported Composite op 0x%x\n", op)); - if (pMaskPicture != NULL && pMaskPicture->componentAlpha && - RadeonBlendOp[op].src_alpha) - ATI_FALLBACK(("Component alpha not supported with source " - "alpha blending.\n")); - - if (!R200CheckCompositeTexture(pSrcPicture, 0)) - return FALSE; - if (pMaskPicture != NULL && !R200CheckCompositeTexture(pMaskPicture, 1)) - return FALSE; - - if (!RadeonGetDestFormat(pDstPicture, &tmp1)) - return FALSE; - - return TRUE; -} - -Bool -R200PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - CARD32 dst_format, dst_offset, dst_pitch; - CARD32 pp_cntl, blendcntl, cblend, ablend; - int pixel_shift; - RING_LOCALS; - - RadeonGetDestFormat(pDstPicture, &dst_format); - pixel_shift = pDst->drawable.bitsPerPixel >> 4; - - accel_atis = atis; - - dst_offset = ((CARD8 *)pDst->devPrivate.ptr - - pScreenPriv->screen->memory_base); - dst_pitch = pDst->devKind; - if ((dst_offset & 0x0f) != 0) - ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset)); - if (((dst_pitch >> pixel_shift) & 0x7) != 0) - ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch)); - - if (!R200TextureSetup(pSrcPicture, pSrc, 0)) - return FALSE; - pp_cntl = RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE; - - if (pMask != NULL) { - if (!R200TextureSetup(pMaskPicture, pMask, 1)) - return FALSE; - pp_cntl |= RADEON_TEX_1_ENABLE; - } else { - is_transform[1] = FALSE; - } - - RadeonSwitchTo3D(atis); - - BEGIN_DMA(17); - - OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 3)); - OUT_RING_REG(RADEON_REG_PP_CNTL, pp_cntl); - OUT_RING_REG(RADEON_REG_RB3D_CNTL, dst_format | RADEON_ALPHA_BLEND_ENABLE); - OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset); - - OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY); - OUT_REG(R200_REG_SE_VTX_FMT_1, - (2 << R200_VTX_TEX0_COMP_CNT_SHIFT) | - (2 << R200_VTX_TEX1_COMP_CNT_SHIFT)); - - OUT_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift); - - /* IN operator: Multiply src by mask components or mask alpha. - * BLEND_CTL_ADD is A * B + C. - * If a picture is a8, we have to explicitly zero its color values. - * If the destination is a8, we have to route the alpha to red, I think. - */ - cblend = R200_TXC_OP_MADD | R200_TXC_ARG_C_ZERO; - ablend = R200_TXA_OP_MADD | R200_TXA_ARG_C_ZERO; - - if (pDstPicture->format == PICT_a8) - cblend |= R200_TXC_ARG_A_R0_ALPHA; - else if (pSrcPicture->format == PICT_a8) - cblend |= R200_TXC_ARG_A_ZERO; - else - cblend |= R200_TXC_ARG_A_R0_COLOR; - ablend |= R200_TXA_ARG_A_R0_ALPHA; - - if (pMask) { - if (pMaskPicture->componentAlpha && - pDstPicture->format != PICT_a8) - cblend |= R200_TXC_ARG_B_R1_COLOR; - else - cblend |= R200_TXC_ARG_B_R1_ALPHA; - ablend |= R200_TXA_ARG_B_R1_ALPHA; - } else { - cblend |= R200_TXC_ARG_B_ZERO | R200_TXC_COMP_ARG_B; - ablend |= R200_TXA_ARG_B_ZERO | R200_TXA_COMP_ARG_B; - } - - OUT_RING(DMA_PACKET0(R200_REG_PP_TXCBLEND_0, 4)); - OUT_RING_REG(R200_REG_PP_TXCBLEND_0, cblend); - OUT_RING_REG(R200_REG_PP_TXCBLEND2_0, - R200_TXC_CLAMP_0_1 | R200_TXC_OUTPUT_REG_R0); - OUT_RING_REG(R200_REG_PP_TXABLEND_0, ablend); - OUT_RING_REG(R200_REG_PP_TXABLEND2_0, - R200_TXA_CLAMP_0_1 | R200_TXA_OUTPUT_REG_R0); - - /* Op operator. */ - blendcntl = RadeonBlendOp[op].blend_cntl; - if (PICT_FORMAT_A(pDstPicture->format) == 0 && - RadeonBlendOp[op].dst_alpha) { - if ((blendcntl & RADEON_SBLEND_MASK) == - RADEON_SBLEND_GL_DST_ALPHA) - blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) | - RADEON_SBLEND_GL_ONE; - else if ((blendcntl & RADEON_SBLEND_MASK) == - RADEON_SBLEND_GL_INV_DST_ALPHA) - blendcntl = (blendcntl & ~RADEON_SBLEND_MASK) | - RADEON_SBLEND_GL_ZERO; - } - OUT_REG(RADEON_REG_RB3D_BLENDCNTL, blendcntl); - END_DMA(); - - return TRUE; -} - -union intfloat { - float f; - CARD32 i; -}; - -struct blend_vertex { - union intfloat x, y; - union intfloat s0, t0; - union intfloat s1, t1; -}; - -#define VTX_DWORD_COUNT 6 - -#define VTX_OUT(_dstX, _dstY, _srcX, _srcY, _maskX, _maskY) \ -do { \ - OUT_RING_F(_dstX); \ - OUT_RING_F(_dstY); \ - OUT_RING_F(_srcX); \ - OUT_RING_F(_srcY); \ - OUT_RING_F(_maskX); \ - OUT_RING_F(_maskY); \ -} while (0) - -void -RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, - int w, int h) -{ - ATIScreenInfo *atis = accel_atis; - ATICardInfo *atic = atis->atic; - int srcXend, srcYend, maskXend, maskYend; - RING_LOCALS; - PictVector v; - - ENTER_DRAW(0); - - /*ErrorF("RadeonComposite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n", - srcX, srcY, maskX, maskY,dstX, dstY, w, h);*/ - - srcXend = srcX + w; - srcYend = srcY + h; - maskXend = maskX + w; - maskYend = maskY + h; - if (is_transform[0]) { - v.vector[0] = IntToxFixed(srcX); - v.vector[1] = IntToxFixed(srcY); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[0], &v); - srcX = xFixedToInt(v.vector[0]); - srcY = xFixedToInt(v.vector[1]); - v.vector[0] = IntToxFixed(srcXend); - v.vector[1] = IntToxFixed(srcYend); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[0], &v); - srcXend = xFixedToInt(v.vector[0]); - srcYend = xFixedToInt(v.vector[1]); - } - if (is_transform[1]) { - v.vector[0] = IntToxFixed(maskX); - v.vector[1] = IntToxFixed(maskY); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[1], &v); - maskX = xFixedToInt(v.vector[0]); - maskY = xFixedToInt(v.vector[1]); - v.vector[0] = IntToxFixed(maskXend); - v.vector[1] = IntToxFixed(maskYend); - v.vector[2] = xFixed1; - PictureTransformPoint(transform[1], &v); - maskXend = xFixedToInt(v.vector[0]); - maskYend = xFixedToInt(v.vector[1]); - } - - if (atic->is_r100) { - BEGIN_DMA(4 * VTX_DWORD_COUNT + 3); - OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD, - 4 * VTX_DWORD_COUNT + 2)); - OUT_RING(RADEON_CP_VC_FRMT_XY | - RADEON_CP_VC_FRMT_ST0 | - RADEON_CP_VC_FRMT_ST1); - OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN | - RADEON_CP_VC_CNTL_PRIM_WALK_RING | - RADEON_CP_VC_CNTL_MAOS_ENABLE | - RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE | - (4 << RADEON_CP_VC_CNTL_NUM_SHIFT)); - } else { - BEGIN_DMA(4 * VTX_DWORD_COUNT + 2); - OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2, - 4 * VTX_DWORD_COUNT + 1)); - OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN | - RADEON_CP_VC_CNTL_PRIM_WALK_RING | - (4 << RADEON_CP_VC_CNTL_NUM_SHIFT)); - } - - VTX_OUT(dstX, dstY, srcX, srcY, maskX, maskY); - VTX_OUT(dstX, dstY + h, srcX, srcYend, maskX, maskYend); - VTX_OUT(dstX + w, dstY + h, srcXend, srcYend, maskXend, maskYend); - VTX_OUT(dstX + w, dstY, srcXend, srcY, maskXend, maskY); - - LEAVE_DRAW(0); - - END_DMA(); -} - -void -RadeonDoneComposite(void) -{ - ENTER_DRAW(0); - LEAVE_DRAW(0); -} - -Bool -RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst) -{ - KdScreenPriv(pDst->drawable.pScreen); - ATIScreenInfo(pScreenPriv); - ATICardInfo(pScreenPriv); - CARD32 dst_offset, dst_pitch; - int pixel_shift; - RING_LOCALS; - - pixel_shift = pDst->drawable.bitsPerPixel >> 4; - - accel_atis = atis; - - dst_offset = ((CARD8 *)pDst->devPrivate.ptr - - pScreenPriv->screen->memory_base); - dst_pitch = pDst->devKind; - if ((dst_offset & 0x0f) != 0) - ATI_FALLBACK(("Bad destination offset 0x%x\n", dst_offset)); - if (((dst_pitch >> pixel_shift) & 0x7) != 0) - ATI_FALLBACK(("Bad destination pitch 0x%x\n", dst_pitch)); - - RadeonSwitchTo3D(atis); - - BEGIN_DMA(8); - - OUT_RING(DMA_PACKET0(RADEON_REG_PP_CNTL, 5)); - OUT_RING_REG(RADEON_REG_PP_CNTL, RADEON_TEX_BLEND_0_ENABLE); - OUT_RING_REG(RADEON_REG_RB3D_CNTL, - RADEON_COLOR_FORMAT_RGB8 | RADEON_ALPHA_BLEND_ENABLE); - OUT_RING_REG(RADEON_REG_RB3D_COLOROFFSET, dst_offset); - OUT_RING_REG(RADEON_REG_RE_WIDTH_HEIGHT, - ((pDst->drawable.height - 1) << 16) | - (pDst->drawable.width - 1)); - OUT_RING_REG(RADEON_REG_RB3D_COLORPITCH, dst_pitch >> pixel_shift); - OUT_REG(RADEON_REG_RB3D_BLENDCNTL, RadeonBlendOp[PictOpAdd].blend_cntl); - END_DMA(); - - if (atic->is_r100) { - BEGIN_DMA(4); - OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXCBLEND_0, 3)); - OUT_RING_REG(RADEON_REG_PP_TXCBLEND_0, - RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | - RADEON_COLOR_ARG_C_TFACTOR_ALPHA); - OUT_RING_REG(RADEON_REG_PP_TXABLEND_0, - RADEON_BLEND_CTL_ADD | RADEON_CLAMP_TX | - RADEON_ALPHA_ARG_C_TFACTOR_ALPHA); - OUT_RING_REG(RADEON_REG_PP_TFACTOR_0, 0x01000000); - END_DMA(); - } else if (atic->is_r200) { - BEGIN_DMA(14); - OUT_REG(R200_REG_SE_VTX_FMT_0, R200_VTX_XY); - OUT_REG(R200_REG_SE_VTX_FMT_1, 0); - OUT_REG(R200_REG_PP_TXCBLEND_0, - R200_TXC_ARG_C_TFACTOR_COLOR); - OUT_REG(R200_REG_PP_TXABLEND_0, - R200_TXA_ARG_C_TFACTOR_ALPHA); - OUT_REG(R200_REG_PP_TXCBLEND2_0, R200_TXC_OUTPUT_REG_R0); - OUT_REG(R200_REG_PP_TXABLEND2_0, R200_TXA_OUTPUT_REG_R0); - OUT_REG(RADEON_REG_PP_TFACTOR_0, 0x01000000); - END_DMA(); - } - - return TRUE; -} - -#define TRAP_VERT_RING_COUNT 2 - -#define TRAP_VERT(_x, _y) \ -do { \ - OUT_RING_F((_x) + sample_x); \ - OUT_RING_F((_y) + sample_y); \ -} while (0) - -void -RadeonTrapezoids(KaaTrapezoid *traps, int ntraps) -{ - ATIScreenInfo *atis = accel_atis; - ATICardInfo *atic = atis->atic; - RING_LOCALS; - - while (ntraps > 0) { - int i, sample, count, vertcount; - - count = 0xffff / 4 / sample_count; - if (count > ntraps) - count = ntraps; - vertcount = count * sample_count * 4; - - if (atic->is_r100) { - BEGIN_DMA(3 + vertcount * TRAP_VERT_RING_COUNT); - OUT_RING(DMA_PACKET3(RADEON_CP_PACKET3_3D_DRAW_IMMD, - 2 + vertcount * TRAP_VERT_RING_COUNT)); - OUT_RING(RADEON_CP_VC_FRMT_XY); - OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN | - RADEON_CP_VC_CNTL_PRIM_WALK_RING | - RADEON_CP_VC_CNTL_MAOS_ENABLE | - RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE | - (vertcount << RADEON_CP_VC_CNTL_NUM_SHIFT)); - } else { - BEGIN_DMA(2 + vertcount * TRAP_VERT_RING_COUNT); - OUT_RING(DMA_PACKET3(R200_CP_PACKET3_3D_DRAW_IMMD_2, - 1 + vertcount * TRAP_VERT_RING_COUNT)); - OUT_RING(RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN | - RADEON_CP_VC_CNTL_PRIM_WALK_RING | - (vertcount << RADEON_CP_VC_CNTL_NUM_SHIFT)); - } - - for (i = 0; i < count; i++) { - for (sample = 0; sample < sample_count; sample++) { - float sample_x = sample_offsets_x[sample]; - float sample_y = sample_offsets_y[sample]; - TRAP_VERT(traps[i].tl, traps[i].ty); - TRAP_VERT(traps[i].bl, traps[i].by); - TRAP_VERT(traps[i].br, traps[i].by); - TRAP_VERT(traps[i].tr, traps[i].ty); - } - } - END_DMA(); - - ntraps -= count; - traps += count; - } -} - -void -RadeonDoneTrapezoids(void) -{ - ATIScreenInfo *atis = accel_atis; - RING_LOCALS; - - BEGIN_DMA(2); - OUT_REG(RADEON_REG_RE_WIDTH_HEIGHT, 0xffffffff); - END_DMA(); -} diff --git a/hw/kdrive/ati/radeon_sarea.h b/hw/kdrive/ati/radeon_sarea.h deleted file mode 100644 index 1d39bca52..000000000 --- a/hw/kdrive/ati/radeon_sarea.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright 2000 ATI Technologies Inc., Markham, Ontario, - * VA Linux Systems Inc., Fremont, California. - * - * 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 on 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 - * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR - * THEIR SUPPLIERS 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. - */ - -/* - * Authors: - * Kevin E. Martin <martin@xfree86.org> - * Gareth Hughes <gareth@valinux.com> - * - */ - -#ifndef _RADEON_SAREA_H_ -#define _RADEON_SAREA_H_ - -/* WARNING: If you change any of these defines, make sure to change the - * defines in the kernel file (radeon_drm.h) - */ -#ifndef __RADEON_SAREA_DEFINES__ -#define __RADEON_SAREA_DEFINES__ - -/* What needs to be changed for the current vertex buffer? */ -#define RADEON_UPLOAD_CONTEXT 0x00000001 -#define RADEON_UPLOAD_VERTFMT 0x00000002 -#define RADEON_UPLOAD_LINE 0x00000004 -#define RADEON_UPLOAD_BUMPMAP 0x00000008 -#define RADEON_UPLOAD_MASKS 0x00000010 -#define RADEON_UPLOAD_VIEWPORT 0x00000020 -#define RADEON_UPLOAD_SETUP 0x00000040 -#define RADEON_UPLOAD_TCL 0x00000080 -#define RADEON_UPLOAD_MISC 0x00000100 -#define RADEON_UPLOAD_TEX0 0x00000200 -#define RADEON_UPLOAD_TEX1 0x00000400 -#define RADEON_UPLOAD_TEX2 0x00000800 -#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 -#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 -#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 -#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ -#define RADEON_REQUIRE_QUIESCENCE 0x00010000 -#define RADEON_UPLOAD_ZBIAS 0x00020000 -#define RADEON_UPLOAD_ALL 0x0002ffff -#define RADEON_UPLOAD_CONTEXT_ALL 0x000201ff - -#define RADEON_FRONT 0x1 -#define RADEON_BACK 0x2 -#define RADEON_DEPTH 0x4 -#define RADEON_STENCIL 0x8 - -/* Primitive types */ -#define RADEON_POINTS 0x1 -#define RADEON_LINES 0x2 -#define RADEON_LINE_STRIP 0x3 -#define RADEON_TRIANGLES 0x4 -#define RADEON_TRIANGLE_FAN 0x5 -#define RADEON_TRIANGLE_STRIP 0x6 -#define RADEON_3VTX_POINTS 0x9 -#define RADEON_3VTX_LINES 0xa - -/* Vertex/indirect buffer size */ -#define RADEON_BUFFER_SIZE 65536 - -/* Byte offsets for indirect buffer data */ -#define RADEON_INDEX_PRIM_OFFSET 20 -#define RADEON_HOSTDATA_BLIT_OFFSET 32 - -#define RADEON_SCRATCH_REG_OFFSET 32 - -/* Keep these small for testing */ -#define RADEON_NR_SAREA_CLIPRECTS 12 - -#define RADEON_MAX_TEXTURE_LEVELS 12 -#define RADEON_MAX_TEXTURE_UNITS 3 - -/* Blits have strict offset rules. All blit offset must be aligned on - * a 1K-byte boundary. - */ -#define RADEON_OFFSET_SHIFT 10 -#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) -#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) - -#endif /* __RADEON_SAREA_DEFINES__ */ - -typedef struct { - unsigned int red; - unsigned int green; - unsigned int blue; - unsigned int alpha; -} radeon_color_regs_t; - -typedef struct { - /* Context state */ - unsigned int pp_misc; - unsigned int pp_fog_color; - unsigned int re_solid_color; - unsigned int rb3d_blendcntl; - unsigned int rb3d_depthoffset; - unsigned int rb3d_depthpitch; - unsigned int rb3d_zstencilcntl; - - unsigned int pp_cntl; - unsigned int rb3d_cntl; - unsigned int rb3d_coloroffset; - unsigned int re_width_height; - unsigned int rb3d_colorpitch; - unsigned int se_cntl; - - /* Vertex format state */ - unsigned int se_coord_fmt; - - /* Line state */ - unsigned int re_line_pattern; - unsigned int re_line_state; - - unsigned int se_line_width; - - /* Bumpmap state */ - unsigned int pp_lum_matrix; - - unsigned int pp_rot_matrix_0; - unsigned int pp_rot_matrix_1; - - /* Mask state */ - unsigned int rb3d_stencilrefmask; - unsigned int rb3d_ropcntl; - unsigned int rb3d_planemask; - - /* Viewport state */ - unsigned int se_vport_xscale; - unsigned int se_vport_xoffset; - unsigned int se_vport_yscale; - unsigned int se_vport_yoffset; - unsigned int se_vport_zscale; - unsigned int se_vport_zoffset; - - /* Setup state */ - unsigned int se_cntl_status; - - /* Misc state */ - unsigned int re_top_left; - unsigned int re_misc; -} radeon_context_regs_t; - -/* Setup registers for each texture unit */ -typedef struct { - unsigned int pp_txfilter; - unsigned int pp_txformat; - unsigned int pp_txoffset; - unsigned int pp_txcblend; - unsigned int pp_txablend; - unsigned int pp_tfactor; - unsigned int pp_border_color; -} radeon_texture_regs_t; - -typedef struct { - /* The channel for communication of state information to the kernel - * on firing a vertex buffer. - */ - radeon_context_regs_t ContextState; - radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; - - /* The current cliprects, or a subset thereof */ - XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS]; - unsigned int nbox; - - /* Counters for throttling of rendering clients */ - unsigned int last_frame; - unsigned int last_dispatch; - unsigned int last_clear; - - /* Maintain an LRU of contiguous regions of texture space. If you - * think you own a region of texture memory, and it has an age - * different to the one you set, then you are mistaken and it has - * been stolen by another client. If global texAge hasn't changed, - * there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained texture - * information of other clients - by maintaining them in the same - * lru which is used to age their own textures, clients have an - * approximate lru for the whole of global texture space, and can - * make informed decisions as to which areas to kick out. There is - * no need to choose whether to kick out your own texture or someone - * else's - simply eject them all in LRU order. - */ - /* Last elt is sentinal */ - drmTextureRegion texList[ATI_NR_TEX_HEAPS][ATI_NR_TEX_REGIONS+1]; - /* last time texture was uploaded */ - unsigned int texAge[ATI_NR_TEX_HEAPS]; - - int ctxOwner; /* last context to upload state */ - int pfAllowPageFlip; /* set by the 2d driver, read by the client */ - int pfCurrentPage; /* set by kernel, read by others */ - int crtc2_base; /* for pageflipping with CloneMode */ -} RADEONSAREAPriv, *RADEONSAREAPrivPtr; - -#endif diff --git a/hw/kdrive/chips/Makefile.am b/hw/kdrive/chips/Makefile.am deleted file mode 100644 index 46e176051..000000000 --- a/hw/kdrive/chips/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xchips - -noinst_LIBRARIES = libchips.a - -libchips_a_SOURCES = \ - chipsdraw.c \ - chips.c \ - chips.h - -Xchips_SOURCES = \ - chipsstub.c - -CHIPS_LIBS = \ - libchips.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - @KDRIVE_LIBS@ - -if GLX -Xchips_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xchips_LDADD = \ - $(CHIPS_LIBS) \ - @KDRIVE_LIBS@ - -Xchips_DEPENDENCIES = \ - libchips.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/chips/chips.c b/hw/kdrive/chips/chips.c deleted file mode 100644 index b419863eb..000000000 --- a/hw/kdrive/chips/chips.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "chips.h" -#include "kaa.h" -#include <sys/io.h> - -#undef CHIPS_DEBUG - -static Bool -chipsCardInit (KdCardInfo *card) -{ - ChipsCardInfo *chipsc; - - chipsc = (ChipsCardInfo *) xalloc (sizeof (ChipsCardInfo)); - if (!chipsc) - return FALSE; - - iopl (3); - - if (!vesaInitialize (card, &chipsc->vesa)) - { - xfree (chipsc); - return FALSE; - } - -#ifdef USE_PCI - chipsc->window = (CARD32 *) (chipsc->cop_base + 0x10000); -#else - chipsc->window = 0; -#endif - card->driver = chipsc; - - return TRUE; -} - -static Bool -chipsScreenInit (KdScreenInfo *screen) -{ - ChipsScreenInfo *chipss; - int screen_size, memory; - - chipss = (ChipsScreenInfo *) xalloc (sizeof (ChipsScreenInfo)); - if (!chipss) - return FALSE; - memset (chipss, '\0', sizeof (ChipsScreenInfo)); - if (!vesaScreenInitialize (screen, &chipss->vesa)) - { - xfree (chipss); - return FALSE; - } - - if (chipss->vesa.mapping != VESA_LINEAR) - screen->dumb = TRUE; - if (!screen->dumb) - { - chipss->mmio_base = (CARD8 *) KdMapDevice (CHIPS_MMIO_BASE(chipss), - CHIPS_MMIO_SIZE(chipss)); - - if (chipss->mmio_base) - { - KdSetMappedMode (CHIPS_MMIO_BASE(chipss), - CHIPS_MMIO_SIZE(chipss), - KD_MAPPED_MODE_REGISTERS); - } - else - screen->dumb = TRUE; - } - else - chipss->mmio_base = 0; - - chipss->screen = chipss->vesa.fb; - memory = chipss->vesa.fb_size; - - screen_size = screen->fb[0].byteStride * screen->height; - - if (chipss->screen && memory >= screen_size + 2048) - { - memory -= 2048; - chipss->cursor_base = chipss->screen + memory - 2048; - } - else - chipss->cursor_base = 0; - memory -= screen_size; - if (memory > screen->fb[0].byteStride) - { - chipss->off_screen = chipss->screen + screen_size; - chipss->off_screen_size = memory; - } - else - { - chipss->off_screen = 0; - chipss->off_screen_size = 0; - } - screen->driver = chipss; - return TRUE; -} - -static Bool -chipsInitScreen (ScreenPtr pScreen) -{ - return vesaInitScreen (pScreen); -} - -#ifdef RANDR -static Bool -chipsRandRSetConfig (ScreenPtr pScreen, - Rotation rotation, - int rate, - RRScreenSizePtr pSize) -{ - kaaWaitSync (pScreen); - - if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) - return FALSE; - - return TRUE; -} - -static void -chipsRandRInit (ScreenPtr pScreen) -{ - rrScrPriv(pScreen); - - pScrPriv->rrSetConfig = chipsRandRSetConfig; -} -#endif - -static Bool -chipsFinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - ret = vesaFinishInitScreen (pScreen); -#ifdef RANDR - chipsRandRInit (pScreen); -#endif - return ret; -} - -static Bool -chipsCreateResources (ScreenPtr pScreen) -{ - return vesaCreateResources (pScreen); -} - -CARD8 -chipsReadXR (ChipsScreenInfo *chipss, CARD8 index) -{ - CARD8 value; - outb (index, 0x3d6); - value = inb (0x3d7); - return value; -} - -void -chipsWriteXR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value) -{ - outb (index, 0x3d6); - outb (value, 0x3d7); -} - -#if 0 -static CARD8 -chipsReadFR (ChipsScreenInfo *chipss, CARD8 index) -{ - CARD8 value; - outb (index, 0x3d0); - value = inb (0x3d1); - return value; -} - -static void -chipsWriteFR (ChipsScreenInfo *chipss, CARD8 index, CARD8 value) -{ - outb (index, 0x3d0); - outb (value, 0x3d1); -} - -static CARD8 -chipsReadSeq (ChipsScreenInfo *chipss, CARD8 index) -{ - CARD8 value; - outb (index, 0x3c4); - value = inb (0x3c5); - return value; -} - -static void -chipsWriteSeq (ChipsScreenInfo *chipss, CARD8 index, CARD8 value) -{ - outb (index, 0x3c4); - outb (value, 0x3c5); -} -#endif - -static void -chipsPreserve (KdCardInfo *card) -{ - vesaPreserve(card); -} - -static void -chipsSetMMIO (ChipsCardInfo *chipsc) -{ -} - -static void -chipsResetMMIO (ChipsCardInfo *chipsc) -{ -} - -static Bool -chipsEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - ChipsCardInfo *chipsc = pScreenPriv->card->driver; - - if (!vesaEnable (pScreen)) - return FALSE; - chipsSetMMIO (chipsc); - return TRUE; -} - -#if 0 -static Bool -chipsDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - chipsScreenInfo(pScreenPriv); - - ErrorF ("seqreg 0x01 0x%x\n", chipsReadSeq (chipss, 0x1)); - ErrorF ("dpmsreg XR61 0x%x\n", chipsReadXR (chipss, 0x61)); - ErrorF ("dpmsreg XR73 0x%x\n", chipsReadXR (chipss, 0x73)); - - ErrorF ("flat panel FR05 0x%x\n", chipsReadFR (chipss, 0x5)); - ErrorF ("flat panel XR52 0x%x\n", chipsReadXR (chipss, 0x52)); - return TRUE; -} -#endif - -static void -chipsDisable (ScreenPtr pScreen) -{ - vesaDisable (pScreen); -} - -static void -chipsRestore (KdCardInfo *card) -{ - ChipsCardInfo *chipsc = card->driver; - - chipsResetMMIO (chipsc); - vesaRestore (card); -} - -static void -chipsScreenFini (KdScreenInfo *screen) -{ - ChipsScreenInfo *chipss = (ChipsScreenInfo *) screen->driver; - - if (chipss->mmio_base) - { - KdUnmapDevice ((void *) chipss->mmio_base, CHIPS_MMIO_SIZE(chipss)); - KdResetMappedMode (CHIPS_MMIO_BASE(chipss), - CHIPS_MMIO_SIZE(chipss), - KD_MAPPED_MODE_REGISTERS); - } - vesaScreenFini (screen); - xfree (chipss); - screen->driver = 0; -} - -static void -chipsCardFini (KdCardInfo *card) -{ - vesaCardFini (card); -} - -#define chipsCursorInit (void *) 0 -#define chipsCursorEnable (void *) 0 -#define chipsCursorDisable (void *) 0 -#define chipsCursorFini (void *) 0 -#define chipsRecolorCursor (void *) 0 - -KdCardFuncs chipsFuncs = { - chipsCardInit, /* cardinit */ - chipsScreenInit, /* scrinit */ - chipsInitScreen, /* initScreen */ - chipsFinishInitScreen, /* finishInitScreen */ - chipsCreateResources, /* createRes */ - chipsPreserve, /* preserve */ - chipsEnable, /* enable */ - vesaDPMS, /* dpms */ - chipsDisable, /* disable */ - chipsRestore, /* restore */ - chipsScreenFini, /* scrfini */ - chipsCardFini, /* cardfini */ - - chipsCursorInit, /* initCursor */ - chipsCursorEnable, /* enableCursor */ - chipsCursorDisable, /* disableCursor */ - chipsCursorFini, /* finiCursor */ - chipsRecolorCursor, /* recolorCursor */ - - chipsDrawInit, /* initAccel */ - chipsDrawEnable, /* enableAccel */ - chipsDrawDisable, /* disableAccel */ - chipsDrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; diff --git a/hw/kdrive/chips/chips.h b/hw/kdrive/chips/chips.h deleted file mode 100644 index 6ad17fe25..000000000 --- a/hw/kdrive/chips/chips.h +++ /dev/null @@ -1,117 +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. - */ - -#ifndef _CHIPS_H_ -#define _CHIPS_H_ -#include <vesa.h> - -/* - * offset from ioport beginning - */ - -#define HIQV -#ifdef HIQV -#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x400000) -#else -#define CHIPS_MMIO_BASE(c) ((c)->vesa.fb_phys + 0x200000) -#endif -#define CHIPS_MMIO_SIZE(c) (0x20000) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _chipsSave { - int dummy; -} ChipsSave; - -typedef struct _chipsCardInfo { - VesaCardPrivRec vesa; - CARD32 *window; - Bool mmio; - ChipsSave save; -} ChipsCardInfo; - -#define getChipsCardInfo(kd) ((ChipsCardInfo *) ((kd)->card->driver)) -#define chipsCardInfo(kd) ChipsCardInfo *chipsc = getChipsCardInfo(kd) - -typedef struct _chipsCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} ChipsCursor; - -#define CHIPS_CURSOR_WIDTH 64 -#define CHIPS_CURSOR_HEIGHT 64 - -typedef struct _chipsScreenInfo { - VesaScreenPrivRec vesa; - CARD8 *mmio_base; - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - ChipsCursor cursor; - KaaScreenInfoRec kaa; -} ChipsScreenInfo; - -#define getChipsScreenInfo(kd) ((ChipsScreenInfo *) ((kd)->screen->driver)) -#define chipsScreenInfo(kd) ChipsScreenInfo *chipss = getChipsScreenInfo(kd) - -Bool -chipsDrawInit (ScreenPtr pScreen); - -void -chipsDrawEnable (ScreenPtr pScreen); - -void -chipsDrawDisable (ScreenPtr pScreen); - -void -chipsDrawFini (ScreenPtr pScreen); - -CARD8 -chipsReadXR (ChipsScreenInfo *chipsc, CARD8 index); - -void -chipsWriteXR (ChipsScreenInfo *chipsc, CARD8 index, CARD8 value); - -Bool -chipsCursorInit (ScreenPtr pScreen); - -void -chipsCursorEnable (ScreenPtr pScreen); - -void -chipsCursorDisable (ScreenPtr pScreen); - -void -chipsCursorFini (ScreenPtr pScreen); - -void -chipsRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -extern KdCardFuncs chipsFuncs; - -#endif /* _CHIPS_H_ */ diff --git a/hw/kdrive/chips/chipsdraw.c b/hw/kdrive/chips/chipsdraw.c deleted file mode 100644 index b1c35f901..000000000 --- a/hw/kdrive/chips/chipsdraw.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "chips.h" - -#include <X11/Xmd.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "kaa.h" - -CARD8 chipsBltRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -CARD8 chipsSolidRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -/* Definitions for the Chips and Technology BitBLT engine communication. */ -/* These are done using Memory Mapped IO, of the registers */ -/* BitBLT modes for register 93D0. */ - -#ifdef HIQV -#define ctPATCOPY 0xF0 -#define ctLEFT2RIGHT 0x000 -#define ctRIGHT2LEFT 0x100 -#define ctTOP2BOTTOM 0x000 -#define ctBOTTOM2TOP 0x200 -#define ctSRCSYSTEM 0x400 -#define ctDSTSYSTEM 0x800 -#define ctSRCMONO 0x1000 -#define ctBGTRANSPARENT 0x22000 -#define ctCOLORTRANSENABLE 0x4000 -#define ctCOLORTRANSDISABLE 0x0 -#define ctCOLORTRANSDST 0x8000 -#define ctCOLORTRANSROP 0x0 -#define ctCOLORTRANSEQUAL 0x10000L -#define ctCOLORTRANSNEQUAL 0x0 -#define ctPATMONO 0x40000L -#define ctPATSOLID 0x80000L -#define ctPATSTART0 0x000000L -#define ctPATSTART1 0x100000L -#define ctPATSTART2 0x200000L -#define ctPATSTART3 0x300000L -#define ctPATSTART4 0x400000L -#define ctPATSTART5 0x500000L -#define ctPATSTART6 0x600000L -#define ctPATSTART7 0x700000L -#define ctSRCFG 0x000000L /* Where is this for the 65550?? */ -#else -#define ctPATCOPY 0xF0 -#define ctTOP2BOTTOM 0x100 -#define ctBOTTOM2TOP 0x000 -#define ctLEFT2RIGHT 0x200 -#define ctRIGHT2LEFT 0x000 -#define ctSRCFG 0x400 -#define ctSRCMONO 0x800 -#define ctPATMONO 0x1000 -#define ctBGTRANSPARENT 0x2000 -#define ctSRCSYSTEM 0x4000 -#define ctPATSOLID 0x80000L -#define ctPATSTART0 0x00000L -#define ctPATSTART1 0x10000L -#define ctPATSTART2 0x20000L -#define ctPATSTART3 0x30000L -#define ctPATSTART4 0x40000L -#define ctPATSTART5 0x50000L -#define ctPATSTART6 0x60000L -#define ctPATSTART7 0x70000L -#endif - -#define chipsFillPix(bpp,pixel) {\ - if (bpp == 8) \ - { \ - pixel = pixel & 0xff; \ - } \ - else if (bpp == 16) \ - { \ - pixel = pixel & 0xffff; \ - } \ -} - -static VOL8 *mmio; -static CARD32 byteStride; -static CARD32 bytesPerPixel; -static CARD32 pixelStride; - -static void -chipsSet (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - chipsScreenInfo(pScreenPriv); - - mmio = chipss->mmio_base; - byteStride = pScreenPriv->screen->fb[0].byteStride; - bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3; - pixelStride = pScreenPriv->screen->fb[0].pixelStride; -} - -#ifdef HIQV -#define CHIPS_BR0 0x00 /* offset */ -#define CHIPS_BR1 0x04 /* bg */ -#define CHIPS_BR2 0x08 /* fg */ -#define CHIPS_BR3 0x0c /* monochrome */ -#define CHIPS_BR4 0x10 /* bitblt */ -#define CHIPS_BR5 0x14 /* pattern addr */ -#define CHIPS_BR6 0x18 /* source addr */ -#define CHIPS_BR7 0x1c /* dst addr */ -#define CHIPS_BR8 0x20 /* dst w/h */ -#else -#define CHIPS_DR0 0x83d0 -#define CHIPS_DR1 0x87d0 -#define CHIPS_DR2 0x8bd0 -#define CHIPS_DR3 0x8fd0 -#define CHIPS_DR4 0x93d0 -#define CHIPS_DR5 0x97d0 -#define CHIPS_DR6 0x9bd0 -#define CHIPS_DR7 0x9fd0 -#endif - -#define DBG(x) - -static void -chipsPitch (int src, int dst) -{ - CARD32 p; - - p = ((dst & 0xffff) << 16) | (src & 0xffff); - DBG(ErrorF ("\tpitch 0x%x\n", p)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR0) = p; -#else - *(VOL32 *) (mmio + CHIPS_DR0) = p; -#endif -} - -static void -chipsBg (Pixel bg) -{ - DBG(ErrorF ("\tbg 0x%x\n", bg)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR1) = bg & 0xffff; -#else - *(VOL32 *) (mmio + CHIPS_DR2) = bg; -#endif -} - -static void -chipsFg (Pixel fg) -{ - DBG(ErrorF ("\tfg 0x%x\n", fg)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR2) = fg; -#else - *(VOL32 *) (mmio + CHIPS_DR3) = fg; -#endif -} - -static void -chipsOp (CARD32 op) -{ - DBG(ErrorF ("\top 0x%x\n", op)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR4) = op; -#else - *(VOL32 *) (mmio + CHIPS_DR4) = op; -#endif -} - -static void -chipsRopSolid (int rop) -{ - CARD32 op; - - op = chipsSolidRop[rop] | ctTOP2BOTTOM | ctLEFT2RIGHT | ctPATSOLID | ctPATMONO; - chipsOp (op); -} - -static void -chipsSrc (int addr) -{ - DBG(ErrorF ("\tsrc 0x%x\n", addr)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR6) = addr; -#else - *(VOL32 *) (mmio + CHIPS_DR5) = addr; -#endif -} - -static void -chipsDst (int addr) -{ - DBG(ErrorF ("\tdst 0x%x\n", addr)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR7) = addr; -#else - *(VOL32 *) (mmio + CHIPS_DR6) = addr; -#endif -} - -static void -chipsWidthHeightGo (int w, int h) -{ - DBG(ErrorF ("\twidth height %d/%d\n", w, h)); -#ifdef HIQV - *(VOL32 *) (mmio + CHIPS_BR8) = ((h & 0xffff) << 16) | (w & 0xffff); -#else - *(VOL32 *) (mmio + CHIPS_DR7) = ((h & 0xffff) << 16) | (w & 0xffff); -#endif -} - -static void -chipsWaitIdle (void) -{ -#ifdef HIQV - int timeout = 0; - CARD8 tmp; - VOL32 *br4 = (VOL32 *) (mmio + CHIPS_BR4); - - DBG(ErrorF ("\tBR4 0x%x 0x%x\n", mmio + CHIPS_BR4, *br4)); - DBG(ErrorF ("\tXR20 0x%x\n", chipsReadXR (0, 0x20))); - for (;;) - { - if ((*br4 & 0x80000000) == 0) - break; - tmp = chipsReadXR (0, 0x20); - if ((tmp & 1) == 0) - break; - if (++timeout > 1000000) - { - ErrorF ("timeout\n"); - tmp = chipsReadXR (0, 0x20); - chipsWriteXR (0, 0x20, tmp | 2); - sleep (1); - chipsWriteXR (0, 0x20, tmp); - sleep (1); - } - } -#else - while (*(VOL32 *) (mmio + CHIPS_DR4) & 0x00100000) - ; -#endif -} - -static void -chipsWaitMarker (ScreenPtr pScreen, int marker) -{ - chipsSet (pScreen); - chipsWaitIdle (); -} - -static Bool -chipsPrepareSolid (PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - FbBits depthMask; - - DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg)); - depthMask = FbFullMask(pPixmap->drawable.depth); - if ((pm & depthMask) != depthMask) - return FALSE; - else - { - chipsSet (pPixmap->drawable.pScreen); - chipsWaitIdle (); - chipsFillPix(pPixmap->drawable.bitsPerPixel,fg); - chipsFg (fg); - chipsBg (fg); - chipsRopSolid (alu); - chipsPitch (byteStride, byteStride); - return TRUE; - } -} - -static void -chipsSolid (int x1, int y1, int x2, int y2) -{ - CARD32 dst; - int w, h; - - DBG(ErrorF (" Solid %dx%d %dx%d\n", x1, y1, x2, y2)); - dst = y1 * byteStride + x1 * bytesPerPixel; - w = (x2 - x1) * bytesPerPixel; - h = (y2 - y1); - chipsWaitIdle (); - chipsDst (dst); - chipsWidthHeightGo (w, h); -} - -static void -chipsDoneSolid (void) -{ -} - -static CARD32 copyOp; - -static Bool -chipsPrepareCopy (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - int dx, - int dy, - int alu, - Pixel pm) -{ - FbBits depthMask; - - DBG(ErrorF ("PrepareSolid %d 0x%x\n", alu, fg)); - depthMask = FbFullMask(pDstPixmap->drawable.depth); - if ((pm & depthMask) != depthMask) - return FALSE; - else - { - copyOp = chipsBltRop[alu]; - if (dy >= 0) - copyOp |= ctTOP2BOTTOM; - else - copyOp |= ctBOTTOM2TOP; - if (dx >= 0) - copyOp |= ctLEFT2RIGHT; - else - copyOp |= ctRIGHT2LEFT; - chipsSet (pDstPixmap->drawable.pScreen); - chipsWaitIdle (); - chipsOp (copyOp); - chipsPitch (byteStride, byteStride); - return TRUE; - } -} - -static void -chipsCopy (int srcX, - int srcY, - int dstX, - int dstY, - int w, - int h) -{ - int src, dst; - if ((copyOp & (ctTOP2BOTTOM|ctBOTTOM2TOP)) == ctBOTTOM2TOP) - { - src = (srcY + h - 1) * byteStride; - dst = (dstY + h - 1) * byteStride; - } - else - { - src = srcY * byteStride; - dst = dstY * byteStride; - } - if ((copyOp & (ctLEFT2RIGHT|ctRIGHT2LEFT)) == ctRIGHT2LEFT) - { - src = src + (srcX + w) * bytesPerPixel - 1; - dst = dst + (dstX + w) * bytesPerPixel - 1; - } - else - { - src = src + srcX * bytesPerPixel; - dst = dst + dstX * bytesPerPixel; - } - chipsWaitIdle (); - chipsSrc (src); - chipsDst (dst); - chipsWidthHeightGo (w * bytesPerPixel, h); -} - -static void -chipsDoneCopy (void) -{ -} - -Bool -chipsDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - chipsScreenInfo(pScreenPriv); - - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - case 16: - break; - default: - return FALSE; - } - - memset(&chipss->kaa, 0, sizeof(KaaScreenInfoRec)); - chipss->kaa.waitMarker = chipsWaitMarker; - chipss->kaa.PrepareSolid = chipsPrepareSolid; - chipss->kaa.Solid = chipsSolid; - chipss->kaa.DoneSolid = chipsDoneSolid; - chipss->kaa.PrepareCopy = chipsPrepareCopy; - chipss->kaa.Copy = chipsCopy; - chipss->kaa.DoneCopy = chipsDoneCopy; - - if (!kaaDrawInit (pScreen, &chipss->kaa)) - return FALSE; - - return TRUE; -} - -void -chipsDrawEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - chipsScreenInfo(pScreenPriv); - CARD8 mode = 0x00; - - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - mode = 0x00; - break; - case 16: - mode = 0x10; - break; - } - chipsSet (pScreen); - chipsWaitIdle (); - chipsWriteXR (chipss, 0x20, mode); - - kaaMarkSync (pScreen); -} - -void -chipsDrawDisable (ScreenPtr pScreen) -{ -} - -void -chipsDrawFini (ScreenPtr pScreen) -{ -} - diff --git a/hw/kdrive/chips/chipsstub.c b/hw/kdrive/chips/chipsstub.c deleted file mode 100644 index 9024a7d44..000000000 --- a/hw/kdrive/chips/chipsstub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "chips.h" - -extern int chips_clk, chips_mclk; - -void -InitCard (char *name) -{ - KdCardAttr attr; - - KdCardInfoAdd (&chipsFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index d2fd11c00..d0fa99831 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -150,11 +150,22 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv) screen->fb[0].depth = 16; screen->fb[0].bitsPerPixel = 16; } - else + else if (screen->fb[0].depth <= 24) { screen->fb[0].depth = 24; screen->fb[0].bitsPerPixel = 32; } + else if (screen->fb[0].depth <= 30) + { + screen->fb[0].depth = 30; + screen->fb[0].bitsPerPixel = 32; + } + else + { + ErrorF("\nXephyr: Unsupported screen depth %d\n", + screen->fb[0].depth); + return FALSE; + } hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask); diff --git a/hw/kdrive/epson/Makefile.am b/hw/kdrive/epson/Makefile.am deleted file mode 100644 index 14bb04996..000000000 --- a/hw/kdrive/epson/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xepson - -noinst_LIBRARIES = libepson.a - -libepson_a_SOURCES = \ - epson13806.c \ - epson13806.h \ - epson13806draw.c\ - epson13806draw.h\ - epson13806reg.h - -Xepson_SOURCES = \ - epson13806stub.c - -EPSON_LIBS = \ - libepson.a \ - @KDRIVE_LIBS@ - -if GLX -Xepson_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xepson_LDADD = \ - $(EPSON_LIBS) \ - @KDRIVE_LIBS@ - -Xepson_DEPENDENCIES = \ - libepson.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/epson/Xepson.man b/hw/kdrive/epson/Xepson.man deleted file mode 100644 index 96aab813e..000000000 --- a/hw/kdrive/epson/Xepson.man +++ /dev/null @@ -1,26 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/kdrive/epson/Xepson.man,v 1.5 2001/02/13 21:15:15 dawes Exp $ -.\" -.TH Xepson 1 __vendorversion__ -.SH NAME -Xepson \- Epson 13806 accelerated framebuffer device tiny X server -.SH SYNOPSIS -.B Xepson -.RI [ :display ] -.RI [ option ...] -.SH DESCRIPTION -.B Xepson -is a driver for the Epson LCD 13806 framebuffer. -.B Xepson -is heavily based upon the Kdrive Xfbdev driver, and behaves very similarly, except for accelerated operations targetted at the Epson chip. -.SH OPTIONS -.B Xepson -accepts the common options of the Xkdrive family of servers. Please -see Xkdrive(1). -.SH KEYBOARD -To be written. -.SH SEE ALSO -X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1). -.SH AUTHORS -The -.B Xepson -server was written by Costas Stylianou based on the Xfbdev sources with some contributions from Phil Blundell & Peter Naulls. diff --git a/hw/kdrive/epson/epson13806.c b/hw/kdrive/epson/epson13806.c deleted file mode 100644 index 6cf8c9ad9..000000000 --- a/hw/kdrive/epson/epson13806.c +++ /dev/null @@ -1,604 +0,0 @@ -/* - * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095 - * - * 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 Costas Sylianou not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Costas Stylianou makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL COSTAS STYLIANOU 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. - */ -/* - * epson13806.c - Implementation of hardware accelerated functions for - * Epson S1D13806 graphics controller. - * - * History: - * 28-Jan-04 C.Stylianou PRJ NBL: Created from fbdev.c. - * 30-Mar-04 Phil Blundell/Peter Naulls Integration with XFree 4.3 - * - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include <sys/ioctl.h> - -#include "epson13806.h" -#include "epson13806reg.h" - -extern int KdTsPhyScreen; - -Bool -epsonInitialize (KdCardInfo *card, EpsonPriv *priv) -{ - int k; - unsigned long off; - if ((priv->fd = open("/dev/fb0", O_RDWR)) < 0) { - perror("Error opening /dev/fb0\n"); - return FALSE; - } - - if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) { - perror("Error with /dev/fb ioctl FIOGET_FSCREENINFO"); - close (priv->fd); - return FALSE; - } - - if ((k=ioctl(priv->fd, FBIOGET_VSCREENINFO, &priv->var)) < 0) { - perror("Error with /dev/fb ioctl FIOGET_VSCREENINFO"); - close (priv->fd); - return FALSE; - } - - priv->fb_base = KdMapDevice (EPSON13806_PHYSICAL_VMEM_ADDR, EPSON13806_VMEM_SIZE); - - - if (priv->fb_base == (char *)-1) { - perror("ERROR: mmap framebuffer fails!"); - close (priv->fd); - return FALSE; - } - - off = (unsigned long) priv->fix.smem_start % (unsigned long) getpagesize(); - priv->fb = priv->fb_base + off; - return TRUE; -} - -Bool -epsonCardInit (KdCardInfo *card) -{ - EpsonPriv *priv; - - priv = (EpsonPriv *) xalloc (sizeof (EpsonPriv)); - if (!priv) - return FALSE; - - if (!epsonInitialize (card, priv)) - { - xfree (priv); - return FALSE; - } - card->driver = priv; - - // Call InitEpson to map onto Epson registers - initEpson13806(); - - return TRUE; -} - -#define FBDEV_KLUDGE_FORMAT -#ifdef FBDEV_KLUDGE_FORMAT -static Pixel -epsonMakeContig (Pixel orig, Pixel others) -{ - Pixel low; - - low = lowbit (orig) >> 1; - while (low && (others & low) == 0) - { - orig |= low; - low >>= 1; - } - return orig; -} -#endif - -Bool -epsonScreenInitialize (KdScreenInfo *screen, EpsonScrPriv *scrpriv) -{ - EpsonPriv *priv = screen->card->driver; - Pixel allbits; - int depth; - Bool gray; - depth = priv->var.bits_per_pixel; - gray = priv->var.grayscale; - - - screen->fb[0].visuals = (1 << TrueColor); -#define Mask(o,l) (((1 << l) - 1) << o) - 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 - */ - screen->fb[0].redMask = epsonMakeContig (screen->fb[0].redMask, - screen->fb[0].greenMask| - screen->fb[0].blueMask); - - screen->fb[0].greenMask = epsonMakeContig (screen->fb[0].greenMask, - screen->fb[0].redMask| - screen->fb[0].blueMask); - - screen->fb[0].blueMask = epsonMakeContig (screen->fb[0].blueMask, - 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)))) - depth--; - - screen->rate = 60; - scrpriv->randr = screen->randr; - - { - screen->fb[0].depth = depth; - screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel; - screen->width = priv->var.xres; - screen->height = priv->var.yres; - screen->fb[0].byteStride = priv->fix.line_length; - screen->fb[0].pixelStride = (priv->fix.line_length * 8 / - priv->var.bits_per_pixel); - screen->fb[0].frameBuffer = (CARD8 *) (priv->fb); - screen->off_screen_base = screen->fb[0].byteStride * screen->height; - screen->memory_base = priv->fb; - screen->memory_size = EPSON13806_VMEM_SIZE; - } - return TRUE; -} - -Bool -epsonScreenInit (KdScreenInfo *screen) -{ - EpsonScrPriv *scrpriv; - - scrpriv = xalloc (sizeof (EpsonScrPriv)); - if (!scrpriv) - return FALSE; - memset (scrpriv, '\0', sizeof (EpsonScrPriv)); - screen->driver = scrpriv; - if (!epsonScreenInitialize (screen, scrpriv)) { - screen->driver = 0; - xfree (scrpriv); - return FALSE; - } - return TRUE; -} - -static void * -epsonWindowLinear (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - EpsonPriv *priv = pScreenPriv->card->driver; - - if (!pScreenPriv->enabled) - return 0; - *size = priv->fix.line_length; - return (CARD8 *) priv->fb + row * priv->fix.line_length + offset; -} - - -#ifdef RANDR -static Bool -epsonRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EpsonScrPriv *scrpriv = screen->driver; -#if 0 - RRVisualGroupPtr pVisualGroup; - RRGroupOfVisualGroupPtr pGroupOfVisualGroup; -#endif - RRScreenSizePtr pSize; - Rotation randr; - int n; - - *rotations = RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270; - - for (n = 0; n < pScreen->numDepths; n++) - if (pScreen->allowedDepths[n].numVids) - break; - if (n == pScreen->numDepths) - return FALSE; - -#if 0 - pVisualGroup = RRCreateVisualGroup (pScreen); - if (!pVisualGroup) - return FALSE; - - if (!RRAddDepthToVisualGroup (pScreen, pVisualGroup, &pScreen->allowedDepths[n])) { - RRDestroyVisualGroup (pScreen, pVisualGroup); - return FALSE; - } - - pVisualGroup = RRRegisterVisualGroup (pScreen, pVisualGroup); - if (!pVisualGroup) - return FALSE; - - pGroupOfVisualGroup = RRCreateGroupOfVisualGroup (pScreen); - - if (!RRAddVisualGroupToGroupOfVisualGroup (pScreen, - pGroupOfVisualGroup, - pVisualGroup)) - { - RRDestroyGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - /* pVisualGroup left until screen closed */ - return FALSE; - } - - pGroupOfVisualGroup = RRRegisterGroupOfVisualGroup (pScreen, pGroupOfVisualGroup); - if (!pGroupOfVisualGroup) - return FALSE; -#endif - - pSize = RRRegisterSize (pScreen, - screen->width, - screen->height, - screen->width_mm, - screen->height_mm); - - randr = KdSubRotation (scrpriv->randr, screen->randr); - - RRSetCurrentConfig (pScreen, randr, RR_Rotate_0, pSize); - - return TRUE; -} - -static Bool -epsonRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EpsonScrPriv *scrpriv = screen->driver; - Bool wasEnabled = pScreenPriv->enabled; - - randr = KdAddRotation (randr, screen->randr); - - if (scrpriv->randr != randr) - { - if (wasEnabled) - KdDisableScreen (pScreen); - - scrpriv->randr = randr; - - if (wasEnabled) - KdEnableScreen (pScreen); - } - return TRUE; -} - -static Bool -epsonRandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit (pScreen)) - return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = epsonRandRGetInfo; - pScrPriv->rrSetConfig = epsonRandRSetConfig; - return TRUE; -} -#endif - -static Bool -epsonCreateColormap (ColormapPtr pmap) -{ - ScreenPtr pScreen = pmap->pScreen; - KdScreenPriv(pScreen); - EpsonPriv *priv = pScreenPriv->card->driver; - VisualPtr pVisual; - int i; - int nent; - xColorItem *pdefs; - - switch (priv->fix.visual) { - case FB_VISUAL_STATIC_PSEUDOCOLOR: - pVisual = pmap->pVisual; - nent = pVisual->ColormapEntries; - pdefs = xalloc (nent * sizeof (xColorItem)); - if (!pdefs) - return FALSE; - for (i = 0; i < nent; i++) - pdefs[i].pixel = i; - epsonGetColors (pScreen, 0, nent, pdefs); - for (i = 0; i < nent; i++) - { - pmap->red[i].co.local.red = pdefs[i].red; - pmap->red[i].co.local.green = pdefs[i].green; - pmap->red[i].co.local.blue = pdefs[i].blue; - } - xfree (pdefs); - return TRUE; - - default: - return fbInitializeColormap (pmap); - } -} - -Bool -epsonInitScreen (ScreenPtr pScreen) -{ -#ifdef TOUCHSCREEN - KdTsPhyScreen = pScreen->myNum; -#endif - - pScreen->CreateColormap = epsonCreateColormap; - - return TRUE; -} - -static Bool -epsonFinishInitScreen (ScreenPtr pScreen) -{ - if (!shadowSetup (pScreen)) - return FALSE; - -#ifdef RANDR - if (!epsonRandRInit (pScreen)) - return FALSE; -#endif - - return TRUE; -} - -static Bool -epsonSetShadow (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EpsonScrPriv *scrpriv = screen->driver; - ShadowUpdateProc update; - ShadowWindowProc window; - - window = epsonWindowLinear; - update = shadowUpdatePacked; - - return KdShadowSet (pScreen, scrpriv->randr, update, window); -} - -static Bool -epsonCreateResources (ScreenPtr pScreen) -{ - return epsonSetShadow (pScreen); -} - -void -epsonPreserve (KdCardInfo *card) -{ -} - -Bool -epsonEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - EpsonPriv *priv = pScreenPriv->card->driver; - int k; - - priv->var.activate = FB_ACTIVATE_NOW|FB_CHANGE_CMAP_VBL; - - /* display it on the LCD */ - k = ioctl (priv->fd, FBIOPUT_VSCREENINFO, &priv->var); - if (k < 0) { - perror ("FBIOPUT_VSCREENINFO"); - return FALSE; - } - - k = ioctl (priv->fd, FBIOGET_FSCREENINFO, &priv->fix); - if (k < 0) { - perror ("FBIOGET_FSCREENINFO"); - return FALSE; - } - - if (priv->fix.visual == FB_VISUAL_DIRECTCOLOR) { - struct fb_cmap cmap; - int i; - - for (i = 0; - i < (1 << priv->var.red.length) || - i < (1 << priv->var.green.length) || - i < (1 << priv->var.blue.length); i++) { - priv->red[i] = i * 65535 / ((1 << priv->var.red.length) - 1); - priv->green[i] = i * 65535 / ((1 << priv->var.green.length) - 1); - priv->blue[i] = i * 65535 / ((1 << priv->var.blue.length) - 1); - } - cmap.start = 0; - cmap.len = i; - cmap.red = &priv->red[0]; - cmap.green = &priv->green[0]; - cmap.blue = &priv->blue[0]; - cmap.transp = 0; - ioctl (priv->fd, FBIOPUTCMAP, &cmap); - } - return TRUE; -} - -Bool -epsonDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - EpsonPriv *priv = pScreenPriv->card->driver; - static int oldmode = -1; - - if (mode == oldmode) - return TRUE; -#ifdef FBIOPUT_POWERMODE - if (ioctl (priv->fd, FBIOPUT_POWERMODE, &mode) >= 0) { - oldmode = mode; - return TRUE; - } -#endif -#ifdef FBIOBLANK - if (ioctl (priv->fd, FBIOBLANK, mode ? mode + 1 : 0) >= 0) { - oldmode = mode; - return TRUE; - } -#endif - return FALSE; -} - -void -epsonDisable (ScreenPtr pScreen) -{ -} - -void -epsonRestore (KdCardInfo *card) -{ -} - -void -epsonScreenFini (KdScreenInfo *screen) -{ -} - -void -epsonCardFini (KdCardInfo *card) -{ - EpsonPriv *priv = card->driver; - - munmap (priv->fb_base, priv->fix.smem_len); - close (priv->fd); - xfree (priv); -} - -void -epsonGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - EpsonPriv *priv = pScreenPriv->card->driver; - struct fb_cmap cmap; - int p; - int k; - int min, max; - - min = 256; - max = 0; - for (k = 0; k < n; k++) { - if (pdefs[k].pixel < min) - min = pdefs[k].pixel; - if (pdefs[k].pixel > max) - max = pdefs[k].pixel; - } - cmap.start = min; - cmap.len = max - min + 1; - cmap.red = &priv->red[min]; - cmap.green = &priv->green[min];; - cmap.blue = &priv->blue[min]; - cmap.transp = 0; - k = ioctl (priv->fd, FBIOGETCMAP, &cmap); - if (k < 0) { - perror ("can't get colormap"); - return; - } - while (n--) { - p = pdefs->pixel; - pdefs->red = priv->red[p]; - pdefs->green = priv->green[p]; - pdefs->blue = priv->blue[p]; - pdefs++; - } -} - -void -epsonPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - EpsonPriv *priv = pScreenPriv->card->driver; - struct fb_cmap cmap; - int p; - int min, max; - - min = 256; - max = 0; - while (n--) { - p = pdefs->pixel; - priv->red[p] = pdefs->red; - priv->green[p] = pdefs->green; - priv->blue[p] = pdefs->blue; - if (p < min) - min = p; - if (p > max) - max = p; - pdefs++; - } - cmap.start = min; - cmap.len = max - min + 1; - cmap.red = &priv->red[min]; - cmap.green = &priv->green[min]; - cmap.blue = &priv->blue[min]; - cmap.transp = 0; - ioctl (priv->fd, FBIOPUTCMAP, &cmap); -} - - - -KdCardFuncs epsonFuncs = { - epsonCardInit, /* cardinit */ - epsonScreenInit, /* scrinit */ - epsonInitScreen, /* initScreen */ - epsonFinishInitScreen, - epsonCreateResources, - epsonPreserve, /* preserve */ - epsonEnable, /* enable */ - epsonDPMS, /* dpms */ - epsonDisable, /* disable */ - epsonRestore, /* restore */ - epsonScreenFini, /* scrfini */ - epsonCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - /* - * History: - * 28-Jan-04 C.Stylianou NBL: Added the following for h/w accel. - * - */ - - epsonDrawInit, /* initAccel */ - epsonDrawEnable, /* enableAccel */ - epsonDrawDisable, /* disableAccel */ - epsonDrawFini, /* finiAccel */ - - epsonGetColors, /* getColors */ - epsonPutColors, /* putColors */ -}; diff --git a/hw/kdrive/epson/epson13806.h b/hw/kdrive/epson/epson13806.h deleted file mode 100644 index b28d7c085..000000000 --- a/hw/kdrive/epson/epson13806.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095 - * - * 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 Costas Sylianou not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Costas Stylianou makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL COSTAS STYLIANOU 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. - */ -/* - * epson13806draw.h - Implementation of hard ware accelerated functions for epson S1D13806 - * Graphic controller. - * - * History: - * 28-Jan-04 C.Stylianou PRJ NBL: Created from fbdev.h - * - */ - -#ifndef _EPSON13806_H_ -#define _EPSON13806_H_ - -#include <stdio.h> -#include <linux/fb.h> -#include <unistd.h> -#include <sys/mman.h> - -#include "kdrive.h" - -#ifdef RANDR -#include "randrstr.h" -#endif - -typedef struct _epsonPriv { - struct fb_var_screeninfo var; - struct fb_fix_screeninfo fix; - __u16 red[256]; - __u16 green[256]; - __u16 blue[256]; - int fd; - char *fb; - char *fb_base; -} EpsonPriv; - -typedef struct _epsonScrPriv { - Rotation randr; - Bool shadow; - KaaScreenInfoRec kaa; -} EpsonScrPriv; - -extern KdCardFuncs epsonFuncs; - -Bool -epsonInitialize (KdCardInfo *card, EpsonPriv *priv); - -Bool -epsonCardInit (KdCardInfo *card); - -Bool -epsonScreenInit (KdScreenInfo *screen); - -Bool -epsonScreenInitialize (KdScreenInfo *screen, EpsonScrPriv *scrpriv); - -Bool -epsonInitScreen (ScreenPtr pScreen); - -void -epsonPreserve (KdCardInfo *card); - -Bool -epsonEnable (ScreenPtr pScreen); - -Bool -epsonDPMS (ScreenPtr pScreen, int mode); - -void -epsonDisable (ScreenPtr pScreen); - -void -epsonRestore (KdCardInfo *card); - -void -epsonScreenFini (KdScreenInfo *screen); - -void -epsonCardFini (KdCardInfo *card); - -void -epsonGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs); - -void -epsonPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs); - -/* - * History: - * 28-Jan-04 C.Stylianou NBL: Added the following prototypes for h/w accel. - * - */ -Bool -epsonDrawInit (ScreenPtr pScreen); - -void -epsonDrawEnable (ScreenPtr pScreen); - -void -epsonDrawDisable (ScreenPtr pScreen); - -void -epsonDrawFini (ScreenPtr pScreen); - -/* - * History: - * 28-Jan-04 C.Stylianou NBL: Maps to Epson registers - * - */ -void -initEpson13806(void); - - -#endif /* __EPSON13806_H_ */ diff --git a/hw/kdrive/epson/epson13806draw.c b/hw/kdrive/epson/epson13806draw.c deleted file mode 100644 index 3222353a3..000000000 --- a/hw/kdrive/epson/epson13806draw.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095 - * - * 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 Costas Sylianou not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Costas Stylianou makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL COSTAS STYLIANOU 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. - */ -/* - * epson13806draw.c - Implementation of hardware accelerated functions for epson S1D13806 - * Graphic controller. - * - * History: - * 28-Jan-04 C.Stylianou PRJ NBL: Created from chipsdraw.c - * - */ - -#include "epson13806.h" -#include "epson13806draw.h" -#include "epson13806reg.h" - -#include "kaa.h" - -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" - - -// Functionality of BitBLT ROP register for Epson S1D13806 Graphics controller -CARD8 epson13806Rop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x08, /* src AND dst */ - /* GXandReverse */ 0x04, /* src AND NOT dst */ - /* GXcopy */ 0x0C, /* src */ - /* GXandInverted*/ 0x02, /* NOT src AND dst */ - /* GXnoop */ 0x0A, /* dst */ - /* GXxor */ 0x06, /* src XOR dst */ - /* GXor */ 0x0E, /* src OR dst */ - /* GXnor */ 0x01, /* NOT src AND NOT dst */ - /* GXequiv */ 0x09, /* NOT src XOR dst */ - /* GXinvert */ 0x05, /* NOT dst */ - /* GXorReverse */ 0x0D, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x03, /* NOT src */ - /* GXorInverted */ 0x0B, /* NOT src OR dst */ - /* GXnand */ 0x07, /* NOT src OR NOT dst */ - /* GXset */ 0x0F, /* 1 */ -}; - - - -#undef __DEBUG_EPSON__ -#undef __DEBUG_EPSON_FBSET__ -#undef __DEBUG_EPSON_SOLID__ -#undef __DEBUG_EPSON_COPY__ - - -#ifdef __DEBUG_EPSON__ - #define EPSON_DEBUG(a) a -#else - #define EPSON_DEBUG(a) -#endif - -#ifdef __DEBUG_EPSON_FBSET__ - #define EPSON_DEBUG_FBSET(a) a -#else - #define EPSON_DEBUG_FBSET(a) -#endif - -#ifdef __DEBUG_EPSON_SOLID__ - #define EPSON_DEBUG_SOLID(a) a -#else - #define EPSON_DEBUG_SOLID(a) -#endif - -#ifdef __DEBUG_EPSON_COPY__ - #define EPSON_DEBUG_COPY(a) a -#else - #define EPSON_DEBUG_COPY(a) -#endif - - -static unsigned int byteStride; // Distance between lines in the frame buffer (in bytes) -static unsigned int bytesPerPixel; -static unsigned int pixelStride; - -static unsigned char *regbase; - -/* - * epsonSet - * - * Description: Sets Epson variables - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonSet (ScreenPtr pScreen) -{ - EPSON_DEBUG_FBSET (fprintf(stderr,"+epsonSet\n")); - - KdScreenPriv(pScreen); - - byteStride = pScreenPriv->screen->fb[0].byteStride; - bytesPerPixel = pScreenPriv->screen->fb[0].bitsPerPixel >> 3; - pixelStride = pScreenPriv->screen->fb[0].pixelStride; - - EPSON_DEBUG_FBSET (fprintf(stderr,"byteStride: [%x]\n", pScreenPriv->screen->fb[0].byteStride)); - EPSON_DEBUG_FBSET (fprintf(stderr,"bytesPerPixel: [%x]\n", pScreenPriv->screen->fb[0].bitsPerPixel >> 3)); - EPSON_DEBUG_FBSET (fprintf(stderr,"pixelStride: [%x]\n", pScreenPriv->screen->fb[0].pixelStride)); - - EPSON_DEBUG_FBSET (fprintf(stderr,"-epsonSet\n")); -} - - -/* - * epsonBg - * - * Description: Sets background colour - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonBg (Pixel bg) -{ - EPSON13806_REG16(EPSON13806_BLTBGCOLOR) = bg; -} - - -/* - * epsonFg - * - * Description: Sets foreground colour - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonFg (Pixel fg) -{ - EPSON13806_REG16(EPSON13806_BLTFGCOLOR) = fg; -} - - -/* - * epsonWaitForHwBltDone - * - * Description: Wait for previous blt to be done before programming any blt registers - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonWaitForHwBltDone (void) -{ - while (EPSON13806_REG (EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {} -} - - -/* - * epsonDrawSync - * - * Description: Sync hardware acceleration - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonWaitMarker (ScreenPtr pScreen, int marker) -{ - EPSON_DEBUG (fprintf(stderr,"+epsonDrawSync\n")); - - epsonWaitForHwBltDone (); - - EPSON_DEBUG (fprintf(stderr,"-epsonDrawSync\n")); -} - - -/* - * epsonPrepareSolid - * - * Description: Prepare Solid Fill i.e, can it be accelerated - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static Bool -epsonPrepareSolid (PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - EPSON_DEBUG_SOLID (fprintf(stderr,"+epsonPrepareSolid\n")); - - FbBits depthMask; - - depthMask = FbFullMask(pPixmap->drawable.depth); - if ((pm & depthMask) != depthMask) - return FALSE; - - epsonSet (pPixmap->drawable.pScreen); - fg &= 0xffff; - epsonFg (fg); - epsonBg (fg); - - epsonWaitForHwBltDone (); - - EPSON_DEBUG_SOLID (fprintf(stderr,"Solid.alu [0x%x], [%d]\n", alu ,epson13806Rop[alu])); - EPSON13806_REG(EPSON13806_BLTROP) = epson13806Rop[alu]; - - if (epson13806Rop[alu] == GXnoop) - { - EPSON13806_REG(EPSON13806_BLTOPERATION) = EPSON13806_BLTOPERATION_PATFILLROP; - } - else - { - EPSON13806_REG(EPSON13806_BLTOPERATION) = EPSON13806_BLTOPERATION_SOLIDFILL; - } - - - EPSON_DEBUG_SOLID (fprintf(stderr,"-epsonPrepareSolid\n")); - return TRUE; - -} - - -/* - * epsonSolid - * - * Description: Executes Solid Fill - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonSolid (int x1, int y1, int x2, int y2) -{ - - EPSON_DEBUG_SOLID (fprintf(stderr,"+epsonSolid\n")); - - CARD32 dst_addr; - int width, height; - - EPSON_DEBUG_SOLID (fprintf(stderr,"Solid X1 [%d] Y1 [%d] X2 [%d] Y2 [%d]\n", x1, y1, x2, y2)); - - dst_addr = y1 * byteStride + x1 * bytesPerPixel; - width = ((x2 - x1)-1); - height = ((y2 - y1)-1); - - // program dst address - EPSON13806_REG16(EPSON13806_BLTDSTSTART01) = dst_addr; - EPSON13806_REG(EPSON13806_BLTDSTSTART2) = dst_addr >> 16; - - // program width and height of blit - EPSON13806_REG16(EPSON13806_BLTWIDTH) = width; - EPSON13806_REG16(EPSON13806_BLTHEIGHT) = height; - - EPSON13806_REG(EPSON13806_BLTCTRL0) = EPSON13806_BLTCTRL0_ACTIVE; - - // Wait for operation to complete - while (EPSON13806_REG(EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {} - - EPSON_DEBUG_SOLID (fprintf(stderr,"-epsonSolid\n")); -} - - -/* - * epsonDoneSolid - * - * Description: Done Solid - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonDoneSolid (void) -{ - EPSON_DEBUG_SOLID (fprintf(stderr,"+epsonDoneSolid\n")); - - // Read from BitBLT data offset 0 to shut it down - //(void)EPSON13806_REG(EPSON13806_BITBLTDATA); - - EPSON_DEBUG_SOLID (fprintf(stderr,"-epsonDoneSolid\n")); - -} - - -/* - * epsonPrepareCopy - * - * Description: Prepares BitBLT, i.e, can it be accelerated - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static Bool -epsonPrepareCopy (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - int dx, - int dy, - int alu, - Pixel pm) -{ - EPSON_DEBUG_COPY (fprintf(stderr,"+epsonPrepareCopy dx [0x%x] dy [0x%x]\n", dx, dy)); - - FbBits depthMask; - - depthMask = FbFullMask(pDstPixmap->drawable.depth); - - if ((pm & depthMask) != depthMask) - return FALSE; - - epsonSet (pDstPixmap->drawable.pScreen); - epsonWaitForHwBltDone (); - EPSON13806_REG(EPSON13806_BLTROP) = epson13806Rop[alu]; - - EPSON_DEBUG_COPY (fprintf(stderr,"-epsonPrepareCopy\n")); - - return TRUE; -} - - -/* - * epsonCopy - * - * Description: Executes BitBLT - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonCopy (int srcX, - int srcY, - int dstX, - int dstY, - int width, - int height) -{ - EPSON_DEBUG_COPY (fprintf(stderr,"+epsonCopy\n")); - int src_addr, dst_addr; - int neg_dir = FALSE; - - if (!width || !height) - return; - - src_addr = srcX * bytesPerPixel + srcY * byteStride; - dst_addr = dstX * bytesPerPixel + dstY * byteStride; - - /* - * See if regions overlap and dest region is beyond source region. - * If so, we need to do a move BLT in negative direction. Only applies - * if the BLT is not transparent. - */ - - if ((srcX + width > dstX) && (srcX < dstX + width) && - (srcY + height > dstY) && (srcY < dstY + height) && - (dst_addr > src_addr)) - { - neg_dir = TRUE; - - // negative direction : get the coords of lower right corner - src_addr += byteStride * (height-1) + bytesPerPixel * (width-1); - dst_addr += byteStride * (height-1) + bytesPerPixel * (width-1); - } - - // program BLIT memory offset - EPSON13806_REG16(EPSON13806_BLTSTRIDE) = byteStride/2; - - // program src and dst addresses - EPSON13806_REG16(EPSON13806_BLTSRCSTART01) = src_addr; - EPSON13806_REG(EPSON13806_BLTSRCSTART2) = src_addr >> 16; - EPSON13806_REG16(EPSON13806_BLTDSTSTART01) = dst_addr; - EPSON13806_REG(EPSON13806_BLTDSTSTART2) = dst_addr >> 16; - - // program width and height of blit - EPSON13806_REG16(EPSON13806_BLTWIDTH) = width-1; - EPSON13806_REG16(EPSON13806_BLTHEIGHT) = height-1; - - // select pos/neg move BLIT - EPSON13806_REG(EPSON13806_BLTOPERATION) = neg_dir ? - EPSON13806_BLTOPERATION_MOVENEGROP : EPSON13806_BLTOPERATION_MOVEPOSROP; - - EPSON13806_REG(EPSON13806_BLTCTRL0) = EPSON13806_BLTCTRL0_ACTIVE; - - // Wait for operation to complete - while (EPSON13806_REG(EPSON13806_BLTCTRL0) & EPSON13806_BLTCTRL0_ACTIVE) {} - - EPSON_DEBUG_COPY (fprintf(stderr,"-epsonCopy\n")); -} - - -/* - * epsonDoneCopy - * - * Description: Done Copy - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -static void -epsonDoneCopy (void) -{ - EPSON_DEBUG_COPY (fprintf(stderr,"+epsonDoneCopy\n")); - - // Read from BitBLT data offset 0 to shut it down - //(void)EPSON13806_REG(EPSON13806_BITBLTDATA); - - EPSON_DEBUG_COPY (fprintf(stderr,"-epsonDoneCopy\n")); -} - - -/* - * epsonDrawInit - * - * Description: Configure the Epson S1D13806 for a 800x600 TFT colour display - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -Bool -epsonDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EpsonScrPriv *epsons = screen->driver; - - EPSON_DEBUG (fprintf(stderr,"+epsonDrawInit\n")); - - epsonSet(pScreen); - -#if 0 - EPSON13806_REG(EPSON13806_MISC) = 0x00; - EPSON13806_REG(EPSON13806_DISPMODE) = 0x00; - EPSON13806_REG16(EPSON13806_GPIOCFG) = 0xffff; - EPSON13806_REG16(EPSON13806_GPIOCTRL) = 0x0001; - - EPSON13806_REG(EPSON13806_MEMCLKCFG) = 0x01; - EPSON13806_REG(EPSON13806_LCDPCLKCFG) = 0x00; - EPSON13806_REG(EPSON13806_CRTPCLKCFG) = 0x02; - EPSON13806_REG(EPSON13806_MPCLKCFG) = 0x02; - EPSON13806_REG(EPSON13806_CPUMEMWAITSEL) = 0x01; - EPSON13806_REG(EPSON13806_MEMCFG) = 0x80; - EPSON13806_REG(EPSON13806_DRAMREFRESH) = 0x03; - EPSON13806_REG16(EPSON13806_DRAMTIMINGCTRL) = 0x0100; - - // 5ms delay for internal LCD SDRAM to initialize - usleep(5000); - - EPSON13806_REG(EPSON13806_PANELTYPE) = 0x25; - EPSON13806_REG(EPSON13806_MODRATE) = 0x00; - EPSON13806_REG(EPSON13806_LCDHDP) = 0x63; - EPSON13806_REG(EPSON13806_LCDHNDP) = 0x1f; - EPSON13806_REG(EPSON13806_TFTFPLINESTART) = 0x01; - EPSON13806_REG(EPSON13806_TFTFPLINEPULSE) = 0x0b; - EPSON13806_REG16(EPSON13806_LCDVDP0) = 0x0257; - EPSON13806_REG(EPSON13806_LCDVNDP) = 0x1b; - EPSON13806_REG(EPSON13806_TFTFPFRAMESTART) = 0x0a; - EPSON13806_REG(EPSON13806_TFTFPFRAMEPULSE) = 0x01; - EPSON13806_REG(EPSON13806_LCDDISPMODE) = 0x85; - EPSON13806_REG(EPSON13806_LCDMISC) = 0x00; - EPSON13806_REG16(EPSON13806_LCDSTART01) = 0x0000; - EPSON13806_REG(EPSON13806_LCDSTART2) = 0x00; - EPSON13806_REG16(EPSON13806_LCDSTRIDE) = byteStride>>1; - EPSON13806_REG(EPSON13806_LCDPIXELPAN) = 0x00; - EPSON13806_REG(EPSON13806_LCDFIFOHIGH) = 0x00; - EPSON13806_REG(EPSON13806_LCDFIFOLOW) = 0x00; -#endif - - - EPSON13806_REG(EPSON13806_BLTCTRL0) = 0x00; - EPSON13806_REG(EPSON13806_BLTCTRL1) = 0x01; // We're using 16 bpp - EPSON13806_REG16(EPSON13806_BLTSTRIDE) = byteStride>>1; // program BLIT memory offset - -#if 0 - EPSON13806_REG(EPSON13806_LUTMODE) = 0x00; - EPSON13806_REG(EPSON13806_LUTADDR) = 0x00; - EPSON13806_REG(EPSON13806_PWRSAVECFG) = 0x10; - EPSON13806_REG(EPSON13806_PWRSAVESTATUS) = 0x00; - EPSON13806_REG(EPSON13806_CPUMEMWATCHDOG) = 0x00; - EPSON13806_REG(EPSON13806_DISPMODE) = 0x01; - - // Enable backlight voltage - EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 1<<1; - // 10ms delay after turning on LCD. - usleep(10000); -#endif - - // Instruct the BitBLT unit to fill the screen with black, i.e clear fb. - static int addr = 0x00000000; - EPSON13806_REG16(EPSON13806_BLTDSTSTART01) = addr; - EPSON13806_REG(EPSON13806_BLTDSTSTART2) = addr >> 16; - EPSON13806_REG16(EPSON13806_BLTFGCOLOR) = 0x0000; - EPSON13806_REG(EPSON13806_BLTOPERATION) = EPSON13806_BLTOPERATION_SOLIDFILL; // solid fill blt - EPSON13806_REG16(EPSON13806_BLTWIDTH) = (0x0320-1); - EPSON13806_REG16(EPSON13806_BLTHEIGHT) = (0x0258-1); - EPSON13806_REG(EPSON13806_BLTCTRL0) = EPSON13806_BLTCTRL0_ACTIVE; - -#if 0 - // Enable LCD data - EPSON13806_REG(EPSON13806_LCDDISPMODE) &= ~(1<<7); - - // Turn on backlight full - EPSON13806_REG16(EPSON13806_GPIOCTRL) |= 0x00fc; -#endif - - memset(&epsons->kaa, 0, sizeof(KaaScreenInfoRec)); - epsons->kaa.waitMarker = epsonWaitMarker; - epsons->kaa.PrepareSolid = epsonPrepareSolid; - epsons->kaa.Solid = epsonSolid; - epsons->kaa.DoneSolid = epsonDoneSolid; - epsons->kaa.PrepareCopy = epsonPrepareCopy; - epsons->kaa.Copy = epsonCopy; - epsons->kaa.DoneCopy = epsonDoneCopy; - epsons->kaa.flags = KAA_OFFSCREEN_PIXMAPS; - - if (!kaaDrawInit (pScreen, &epsons->kaa)) - return FALSE; - - EPSON_DEBUG (fprintf(stderr,"-epsonDrawInit\n")); - return TRUE; -} - - -/* - * epsonDrawEnable - * - * Description: Enables hardware acceleration - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -void -epsonDrawEnable (ScreenPtr pScreen) -{ - EPSON_DEBUG (fprintf(stderr,"+epsonDrawEnable\n")); - epsonWaitForHwBltDone (); - kaaMarkSync (pScreen); - EPSON_DEBUG (fprintf(stderr,"-epsonDrawEnable\n")); -} - - -/* - * epsonDrawDisable - * - * Description: Disables hardware acceleration - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -void -epsonDrawDisable (ScreenPtr pScreen) -{ - EPSON_DEBUG (fprintf(stderr,"+epsonDrawDisable\n")); -} - - -/* - * epsonDrawFini - * - * Description: Finish hardware acceleration - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -void -epsonDrawFini (ScreenPtr pScreen) -{ - EPSON_DEBUG (fprintf(stderr,"+epsonDrawFini\n")); -} - - -/* - * initEpson13806 - * - * Description: Maps Epson S1D13806 registers - * - * History: - * 11-Feb-04 C.Stylianou NBL: Created. - * - */ - -void -initEpson13806(void) -{ - EPSON_DEBUG (fprintf(stderr,"+initEpson\n")); - - // Map Epson S1D13806 registers - regbase = KdMapDevice (EPSON13806_PHYSICAL_REG_ADDR, EPSON13806_GPIO_REGSIZE); - if (!regbase) - perror("ERROR: regbase\n"); // Sets up register mappings in header files. - -#if 0 - CARD8 rev_code; - rev_code = EPSON13806_REG (EPSON13806_REVCODE); - if ((rev_code >> 2) != 0x07) - perror("ERROR: EPSON13806 Display Controller NOT FOUND!\n"); -#endif - - EPSON_DEBUG (fprintf(stderr,"-initEpson\n")); -} diff --git a/hw/kdrive/epson/epson13806draw.h b/hw/kdrive/epson/epson13806draw.h deleted file mode 100644 index b5f1bf5c2..000000000 --- a/hw/kdrive/epson/epson13806draw.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095 - * - * 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 Costas Sylianou not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Costas Stylianou makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL COSTAS STYLIANOU 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. - */ -/* - * epson13806draw.h - Implementation of hard ware accelerated functions for epson S1D13806 - * Graphic controller. - * - * History: - * 28-Jan-04 C.Stylianou PRJ NBL: Created from chipsdraw.h - * - */ - -#ifndef _EPSON13806DRAW_H_ -#define _EPSON13806DRAW_H_ - - -/* - * offset from ioport beginning - */ - - -#define SetupEpson(s) KdScreenPriv(s); \ - epsonCardInfo(pScreenPriv); \ - EpsonPtr epson = epsonc->epson - - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _epsonSave { - int dummy; -} EpsonSave; - -typedef struct _epsonCardInfo { - EpsonPriv epson; - CARD32 *window; - Bool mmio; - EpsonSave save; -} epsonCardInfo; - -#define getEpsonCardInfo(kd) ((epsonCardInfo *) ((kd)->card->driver)) -#define epsonCardInfo(kd) epsonCardInfo *epsonc = getEpsonCardInfo(kd) - -typedef struct _epsonCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} EpsonCursor; - -#define epson_CURSOR_WIDTH 64 -#define epson_CURSOR_HEIGHT 64 - -typedef struct _epsonScreenInfo { - EpsonScrPriv epson; - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - EpsonCursor cursor; - void *regbase_virt; -} EpsonScreenInfo; - -#define getEpsonScreenInfo(kd) ((EpsonScreenInfo *) ((kd)->screen->driver)) -#define epsonScreenInfo(kd) EpsonScreenInfo *epsons = getEpsonScreenInfo(kd) - -Bool -epsonDrawInit (ScreenPtr pScreen); - -void -epsonDrawEnable (ScreenPtr pScreen); - -void -epsonDrawSync (ScreenPtr pScreen); - -void -epsonDrawDisable (ScreenPtr pScreen); - -void -epsonDrawFini (ScreenPtr pScreen); - -Bool -epsonCursorInit (ScreenPtr pScreen); - -void -epsonCursorEnable (ScreenPtr pScreen); - -void -epsonCursorDisable (ScreenPtr pScreen); - -void -epsonCursorFini (ScreenPtr pScreen); - -void -epsonRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -extern KdCardFuncs epsonFuncs; - -#endif diff --git a/hw/kdrive/epson/epson13806reg.h b/hw/kdrive/epson/epson13806reg.h deleted file mode 100644 index ee745a08f..000000000 --- a/hw/kdrive/epson/epson13806reg.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095 - * - * 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 Costas Sylianou not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Costas Stylianou makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL COSTAS STYLIANOU 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. - */ -/* - * epson13806reg.h Epson S1D13806 LCD controller header file. - * - * History: - * 15-Feb-04 C.Stylianou PRJ NBL: Created. - * - */ - - -#ifndef EPSON13806REG_H -#define EPSON13806REG_H - - -#define TT_UNUSED(x) ((void) (x)) - - -#define EPSON13806_PHYSICAL_REG_ADDR 0x14000000 -#define EPSON13806_GPIO_REGSIZE 0x001f0000 - -#define EPSON13806_PHYSICAL_VMEM_ADDR 0x14200000 -#define EPSON13806_VMEM_SIZE 0x140000 - -#define PLATFORM_EPSON13806_BASE (regbase) -#define EPSON13806_REG_BASE (PLATFORM_EPSON13806_BASE + 0x000000) // Register base address -#define EPSON13806_SDRAM_BASE (PLATFORM_EPSON13806_BASE + 0x200000) // SDRAM base address - -////////////////////////////////////////////////////////////////////////////////////////// -// Register Offsets -////////////////////////////////////////////////////////////////////////////////////////// -#define EPSON13806_REVCODE (EPSON13806_REG_BASE + 0x0000) // Revision Code Register -#define EPSON13806_MISC (EPSON13806_REG_BASE + 0x0001) // Miscellaneous Register -#define EPSON13806_GPIOCFG (EPSON13806_REG_BASE + 0x0004) // General IO Pins Configuration Register (16 bits) -#define EPSON13806_GPIOCFG0 (EPSON13806_REG_BASE + 0x0004) // General IO Pins Configuration Register 0 -#define EPSON13806_GPIOCFG1 (EPSON13806_REG_BASE + 0x0005) // General IO Pins Configuration Register 1 -#define EPSON13806_GPIOCTRL (EPSON13806_REG_BASE + 0x0008) // General IO Pins Control Register (16 bits) -#define EPSON13806_GPIOCTRL0 (EPSON13806_REG_BASE + 0x0008) // General IO Pins Control Register 0 -#define EPSON13806_GPIOCTRL1 (EPSON13806_REG_BASE + 0x0009) // General IO Pins Control Register 1 -#define EPSON13806_MDCFGSTATUS (EPSON13806_REG_BASE + 0x000C) // Configuration Status Register -#define EPSON13806_MEMCLKCFG (EPSON13806_REG_BASE + 0x0010) // Memory Clock Configuration Register -#define EPSON13806_LCDPCLKCFG (EPSON13806_REG_BASE + 0x0014) // LCD Pixel Clock Configuration Register -#define EPSON13806_CRTPCLKCFG (EPSON13806_REG_BASE + 0x0018) // CRT/TV Clock Configuration Register -#define EPSON13806_MPCLKCFG (EPSON13806_REG_BASE + 0x001C) // MediaPlug Clock Configuration Register -#define EPSON13806_CPUMEMWAITSEL (EPSON13806_REG_BASE + 0x001E) // CPU To Memory Wait State Select Register -#define EPSON13806_MEMCFG (EPSON13806_REG_BASE + 0x0020) // Memory Configuration Register -#define EPSON13806_DRAMREFRESH (EPSON13806_REG_BASE + 0x0021) // DRAM Refresh Rate Register -#define EPSON13806_DRAMTIMINGCTRL (EPSON13806_REG_BASE + 0x002A) // DRAM Timings Control Register (16 bits) -#define EPSON13806_DRAMTIMINGCTRL0 (EPSON13806_REG_BASE + 0x002A) // DRAM Timings Control Register 0 -#define EPSON13806_DRAMTIMINGCTRL1 (EPSON13806_REG_BASE + 0x002B) // DRAM Timings Control Register 1 -#define EPSON13806_PANELTYPE (EPSON13806_REG_BASE + 0x0030) // Panel Type Register -#define EPSON13806_MODRATE (EPSON13806_REG_BASE + 0x0031) // MOD Rate Register -#define EPSON13806_LCDHDP (EPSON13806_REG_BASE + 0x0032) // LCD Horizontal Display Width Register -#define EPSON13806_LCDHNDP (EPSON13806_REG_BASE + 0x0034) // LCD Horizontal Non-Display Period Register -#define EPSON13806_TFTFPLINESTART (EPSON13806_REG_BASE + 0x0035) // TFT FPLINE Start Position Register -#define EPSON13806_TFTFPLINEPULSE (EPSON13806_REG_BASE + 0x0036) // TFT FPLINE Pulse Width Register -#define EPSON13806_LCDVDP (EPSON13806_REG_BASE + 0x0038) // LCD Vertical Display Height Register (16 bits) -#define EPSON13806_LCDVDP0 (EPSON13806_REG_BASE + 0x0038) // LCD Vertical Display Height Register 0 -#define EPSON13806_LCDVDP1 (EPSON13806_REG_BASE + 0x0039) // LCD Vertical Display Height Register 1 -#define EPSON13806_LCDVNDP (EPSON13806_REG_BASE + 0x003A) // LCD Vertical Non-Display Period Register -#define EPSON13806_TFTFPFRAMESTART (EPSON13806_REG_BASE + 0x003B) // TFT FPFRAME Start Position Register -#define EPSON13806_TFTFPFRAMEPULSE (EPSON13806_REG_BASE + 0x003C) // TFT FPFRAME Pulse Width Register -#define EPSON13806_LCDLINECOUNT (EPSON13806_REG_BASE + 0x003E) // LCD Line Count Register (16 bits) -#define EPSON13806_LCDLINECOUNT0 (EPSON13806_REG_BASE + 0x003E) // LCD Line Count Register 0 -#define EPSON13806_LCDLINECOUNT1 (EPSON13806_REG_BASE + 0x003F) // LCD Line Count Register 1 -#define EPSON13806_LCDDISPMODE (EPSON13806_REG_BASE + 0x0040) // LCD Display Mode Register -#define EPSON13806_LCDMISC (EPSON13806_REG_BASE + 0x0041) // LCD Miscellaneous Register -#define EPSON13806_LCDSTART01 (EPSON13806_REG_BASE + 0x0042) // LCD Display Start Address Register 0 and 1 (16 bits) -#define EPSON13806_LCDSTART0 (EPSON13806_REG_BASE + 0x0042) // LCD Display Start Address Register 0 -#define EPSON13806_LCDSTART1 (EPSON13806_REG_BASE + 0x0043) // LCD Display Start Address Register 1 -#define EPSON13806_LCDSTART2 (EPSON13806_REG_BASE + 0x0044) // LCD Display Start Address Register 2 -#define EPSON13806_LCDSTRIDE (EPSON13806_REG_BASE + 0x0046) // LCD Memory Address Offset Register (16 bits) -#define EPSON13806_LCDSTRIDE0 (EPSON13806_REG_BASE + 0x0046) // LCD Memory Address Offset Register 0 -#define EPSON13806_LCDSTRIDE1 (EPSON13806_REG_BASE + 0x0047) // LCD Memory Address Offset Register 1 -#define EPSON13806_LCDPIXELPAN (EPSON13806_REG_BASE + 0x0048) // LCD Pixel Panning Register -#define EPSON13806_LCDFIFOHIGH (EPSON13806_REG_BASE + 0x004A) // LCD Display FIFO High Threshold Control Register -#define EPSON13806_LCDFIFOLOW (EPSON13806_REG_BASE + 0x004B) // LCD Display FIFO Low Threshold Control Register - -#define EPSON13806_LCDINKCURSCTRL (EPSON13806_REG_BASE + 0x0070) // LCD INK/Cursor Control Register -#define EPSON13806_LCDINKCURSSTART (EPSON13806_REG_BASE + 0x0071) // LCD INK/Cursor Start Address Register -#define EPSON13806_LCDCURSORXPOS (EPSON13806_REG_BASE + 0x0072) // LCD Cursor X Position Register (16 bits) -#define EPSON13806_LCDCURSORXPOS0 (EPSON13806_REG_BASE + 0x0072) // LCD Cursor X Position Register 0 -#define EPSON13806_LCDCURSORXPOS1 (EPSON13806_REG_BASE + 0x0073) // LCD Cursor X Position Register 1 -#define EPSON13806_LCDCURSORYPOS (EPSON13806_REG_BASE + 0x0074) // LCD Cursor Y Position Register (16 bits) -#define EPSON13806_LCDCURSORYPOS0 (EPSON13806_REG_BASE + 0x0074) // LCD Cursor Y Position Register 0 -#define EPSON13806_LCDCURSORYPOS1 (EPSON13806_REG_BASE + 0x0075) // LCD Cursor Y Position Register 1 -#define EPSON13806_LCDINKCURSBLUE0 (EPSON13806_REG_BASE + 0x0076) // LCD INK/Cursor Blue Color 0 Register -#define EPSON13806_LCDINKCURSGREEN0 (EPSON13806_REG_BASE + 0x0077) // LCD INK/Cursor Green Color 0 Register -#define EPSON13806_LCDINKCURSRED0 (EPSON13806_REG_BASE + 0x0078) // LCD INK/Cursor Red Color 0 Register -#define EPSON13806_LCDINKCURSBLUE1 (EPSON13806_REG_BASE + 0x007A) // LCD INK/Cursor Blue Color 1 Register -#define EPSON13806_LCDINKCURSGREEN1 (EPSON13806_REG_BASE + 0x007B) // LCD INK/Cursor Green Colour 1 Register -#define EPSON13806_LCDINKCURSRED1 (EPSON13806_REG_BASE + 0x007C) // LCD INK/Cursor Red Color 1 Register -#define EPSON13806_LCDINKCURSFIFO (EPSON13806_REG_BASE + 0x007E) // LCD INK/Cursor FIFO Threshold Register - -#define EPSON13806_BLTCTRL0 (EPSON13806_REG_BASE + 0x0100) // BitBlt Control Register 0 -#define EPSON13806_BLTCTRL1 (EPSON13806_REG_BASE + 0x0101) // BitBlt Control Register 1 -#define EPSON13806_BLTROP (EPSON13806_REG_BASE + 0x0102) // BitBlt ROP Code/Color Expansion Register -#define EPSON13806_BLTOPERATION (EPSON13806_REG_BASE + 0x0103) // BitBlt Operation Register -#define EPSON13806_BLTSRCSTART01 (EPSON13806_REG_BASE + 0x0104) // BitBlt Source Start Address Register 0 and 1 (16 bits) -#define EPSON13806_BLTSRCSTART0 (EPSON13806_REG_BASE + 0x0104) // BitBlt Source Start Address Register 0 -#define EPSON13806_BLTSRCSTART1 (EPSON13806_REG_BASE + 0x0105) // BitBlt Source Start Address Register 1 -#define EPSON13806_BLTSRCSTART2 (EPSON13806_REG_BASE + 0x0106) // BitBlt Source Start Address Register 2 -#define EPSON13806_BLTDSTSTART01 (EPSON13806_REG_BASE + 0x0108) // BitBlt Destination Start Address Register 0 and 1 (16 bits) -#define EPSON13806_BLTDSTSTART0 (EPSON13806_REG_BASE + 0x0108) // BitBlt Destination Start Address Register 0 -#define EPSON13806_BLTDSTSTART1 (EPSON13806_REG_BASE + 0x0109) // BitBlt Destination Start Address Register 1 -#define EPSON13806_BLTDSTSTART2 (EPSON13806_REG_BASE + 0x010A) // BitBlt Destination Start Address Register 2 -#define EPSON13806_BLTSTRIDE (EPSON13806_REG_BASE + 0x010C) // BitBlt Memory Address Offset Register (16 bits) -#define EPSON13806_BLTSTRIDE0 (EPSON13806_REG_BASE + 0x010C) // BitBlt Memory Address Offset Register 0 -#define EPSON13806_BLTSTRIDE1 (EPSON13806_REG_BASE + 0x010D) // BitBlt Memory Address Offset Register 1 -#define EPSON13806_BLTWIDTH (EPSON13806_REG_BASE + 0x0110) // BitBlt Width Register (16 bits) -#define EPSON13806_BLTWIDTH0 (EPSON13806_REG_BASE + 0x0110) // BitBlt Width Register 0 -#define EPSON13806_BLTWIDTH1 (EPSON13806_REG_BASE + 0x0111) // BitBlt Width Register 1 -#define EPSON13806_BLTHEIGHT (EPSON13806_REG_BASE + 0x0112) // BitBlt Height Register (16 bits) -#define EPSON13806_BLTHEIGHT0 (EPSON13806_REG_BASE + 0x0112) // BitBlt Height Register 0 -#define EPSON13806_BLTHEIGHT1 (EPSON13806_REG_BASE + 0x0113) // BitBlt Height Register 1 -#define EPSON13806_BLTBGCOLOR (EPSON13806_REG_BASE + 0x0114) // BitBlt Background Color Register (16 bits) -#define EPSON13806_BLTBGCOLOR0 (EPSON13806_REG_BASE + 0x0114) // BitBlt Background Color Register 0 -#define EPSON13806_BLTBGCOLOR1 (EPSON13806_REG_BASE + 0x0115) // BitBlt Background Color Register 1 -#define EPSON13806_BLTFGCOLOR (EPSON13806_REG_BASE + 0x0118) // BitBlt Foreground Color Register (16 bits) -#define EPSON13806_BLTFGCOLOR0 (EPSON13806_REG_BASE + 0x0118) // BitBlt Foreground Color Register 0 -#define EPSON13806_BLTFGCOLOR1 (EPSON13806_REG_BASE + 0x0119) // BitBlt Foreground Color Register 0 - -#define EPSON13806_LUTMODE (EPSON13806_REG_BASE + 0x01E0) // Look-Up Table Mode Register -#define EPSON13806_LUTADDR (EPSON13806_REG_BASE + 0x01E2) // Look-Up Table Address Register -#define EPSON13806_LUTDATA (EPSON13806_REG_BASE + 0x01E4) // Look-Up Table Data Register -#define EPSON13806_PWRSAVECFG (EPSON13806_REG_BASE + 0x01F0) // Power Save Configuration Register -#define EPSON13806_PWRSAVESTATUS (EPSON13806_REG_BASE + 0x01F1) // Power Save Status Register -#define EPSON13806_CPUMEMWATCHDOG (EPSON13806_REG_BASE + 0x01F4) // CPU-to-Memory Access Watchdog Timer Register -#define EPSON13806_DISPMODE (EPSON13806_REG_BASE + 0x01FC) // Display Mode Register - -#define EPSON13806_MEDIALCMD (EPSON13806_REG_BASE + 0x1000) // MediaPlug LCMD Register -#define EPSON13806_MEDIARESERVEDLCMD (EPSON13806_REG_BASE + 0x1002) // MediaPlug Reserved LCMD Register -#define EPSON13806_MEDIACMD (EPSON13806_REG_BASE + 0x1004) // MediaPlug CMD Register -#define EPSON13806_MEDIARESERVEDCMD (EPSON13806_REG_BASE + 0x1006) // MediaPlug Reserved CMD Register -#define EPSON13806_MEDIADATA (EPSON13806_REG_BASE + 0x1008) // MediaPlug Data Registers (base) - -#define EPSON13806_BITBLTDATA (EPSON13806_REG_BASE + 0x100000) // BitBLT Data Registers (base) - -// BLTCTRL0 register defines -#define EPSON13806_BLTCTRL0_ACTIVE (1<<7) // Read: 1=busy, 0=idle / Write: 1=start, 0=no change - -// BLTOPERATION register defines -#define EPSON13806_BLTOPERATION_WRITEROP (0x00) // Write BitBLT with ROP -#define EPSON13806_BLTOPERATION_READ (0x01) // Read BitBLT -#define EPSON13806_BLTOPERATION_MOVEPOSROP (0x02) // Move BitBLT in positive direction with ROP -#define EPSON13806_BLTOPERATION_MOVENEGROP (0x03) // Move BitBLT in negative direction with ROP -#define EPSON13806_BLTOPERATION_TRANSWRITE (0x04) // Transparent Write BitBLT -#define EPSON13806_BLTOPERATION_TRANSMOVEPOS (0x05) // Transparent Move BitBLT in positive direction -#define EPSON13806_BLTOPERATION_PATFILLROP (0x06) // Pattern fill with ROP -#define EPSON13806_BLTOPERATION_PATFILLTRANS (0x07) // Pattern fill with transparency -#define EPSON13806_BLTOPERATION_COLOREXP (0x08) // Color expansion -#define EPSON13806_BLTOPERATION_COLOREXPTRANS (0x09) // Color expansion with transparency -#define EPSON13806_BLTOPERATION_MOVECOLOREXP (0x0A) // Move BitBLT with color expansion -#define EPSON13806_BLTOPERATION_MOVECOLOREXPTRANS (0x0B) // Move BitBLT with color expansion and transparency -#define EPSON13806_BLTOPERATION_SOLIDFILL (0x0C) // Solid fill - -////////////////////////////////////////////////////////////////////////////////////////// -// Epson register access macros -////////////////////////////////////////////////////////////////////////////////////////// -#define EPSON13806_REG(address) *(VOL8 *)(address) -#define EPSON13806_REG16(address) *(VOL16 *)(address) - - -#endif // EPSON13806 diff --git a/hw/kdrive/epson/epson13806stub.c b/hw/kdrive/epson/epson13806stub.c deleted file mode 100644 index 087a30fc7..000000000 --- a/hw/kdrive/epson/epson13806stub.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2004 by Costas Stylianou <costas.stylianou@psion.com> +44(0)7850 394095 - * - * 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 Costas Sylianou not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Costas Stylianou makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * COSTAS STYLIANOU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL COSTAS STYLIANOU 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. - */ -/* - * epson13806stub.c - * - * History: - * 28-Jan-04 C.Stylianou PRJ NBL: Created from fbdevinit.c - * - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include <epson13806.h> - -void -InitCard (char *name) -{ - KdCardAttr attr; - - fprintf(stderr, "Epson 13806 Tiny X Driver ver 1.01\n"); - - KdCardInfoAdd (&epsonFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} diff --git a/hw/kdrive/i810/Makefile.am b/hw/kdrive/i810/Makefile.am deleted file mode 100644 index 30919fad9..000000000 --- a/hw/kdrive/i810/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xi810 - -noinst_LIBRARIES = libi810.a - - -libi810_a_SOURCES = \ - i810_cursor.c \ - i810_video.c \ - i810draw.c \ - i810draw.h \ - i810_reg.h \ - i810.c \ - i810.h - -Xi810_SOURCES = \ - i810stub.c - -I810_LIBS = \ - libi810.a \ - @KDRIVE_LIBS@ - -if GLX -Xi810_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xi810_LDADD = \ - $(I810_LIBS) \ - @KDRIVE_LIBS@ - -Xi810_DEPENDENCIES = \ - libi810.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/i810/i810.c b/hw/kdrive/i810/i810.c deleted file mode 100644 index 49090f9eb..000000000 --- a/hw/kdrive/i810/i810.c +++ /dev/null @@ -1,2112 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/* - * i810.c - KDrive driver for the i810 chipset - * - * Authors: - * Pontus Lidman <pontus.lidman@nokia.com> - * - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kxv.h" -#include "klinux.h" - -#include "i810.h" -#include "agp.h" - -#include "i810draw.h" - -#ifndef I810_DEBUG -int I810_DEBUG = (0 -/* | DEBUG_ALWAYS_SYNC */ -/* | DEBUG_VERBOSE_ACCEL */ -/* | DEBUG_VERBOSE_SYNC */ -/* | DEBUG_VERBOSE_VGA */ -/* | DEBUG_VERBOSE_RING */ -/* | DEBUG_VERBOSE_OUTREG */ -/* | DEBUG_VERBOSE_MEMORY */ -/* | DEBUG_VERBOSE_CURSOR */ - ); -#endif - - -static Bool -i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t); - -static void -i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode ); - -Bool -i810CardInit (KdCardInfo *card) -{ - int i; - - I810CardInfo *i810c; - -/* fprintf(stderr,"i810CardInit\n"); */ - - i810c = (I810CardInfo *) xalloc (sizeof (I810CardInfo)); - - if (!i810c) - return FALSE; - - /* 2MB Video RAM */ - i810c->videoRam=2048; - - /* Find FB address */ - - if (card->attr.address[1] != 0) { - i810c->LinearAddr = card->attr.address[0] & 0xFF000000; - - if (!i810c->LinearAddr) { - fprintf(stderr,"No valid FB address in PCI config space(1)\n"); - xfree(i810c); - return FALSE; - } else { -/* fprintf(stderr,"Linear framebuffer at %lx\n",i810c->LinearAddr); */ - } - } else { - fprintf(stderr,"No valid FB address in PCI config space(2)\n"); - xfree(i810c); - return FALSE; - } - - if (card->attr.address[1]) { - - i810c->MMIOAddr = card->attr.address[1] & 0xFFF80000; - - i810c->MMIOBase = - KdMapDevice (i810c->MMIOAddr, I810_REG_SIZE); - if (!i810c->MMIOBase) { - fprintf(stderr,"No valid MMIO address in PCI config space(1)\n"); - xfree(i810c); - return FALSE; - } else { - - } - } else { - fprintf(stderr,"No valid MMIO address in PCI config space(2)\n"); - xfree(i810c); - return FALSE; - } - -/* fprintf(stderr,"Mapped 0x%x bytes of MMIO regs at phys 0x%lx virt %p\n", */ -/* I810_REG_SIZE,i810c->MMIOAddr,i810c->MMIOBase); */ - - /* Find out memory bus frequency. - */ - - { - unsigned long *p; - - if (!(p= (unsigned long *) LinuxGetPciCfg(&card->attr))) - return FALSE; - -/* fprintf(stderr,"Frequency long %lx\n",p[WHTCFG_PAMR_DRP]); */ - - if ( (p[WHTCFG_PAMR_DRP] & LM_FREQ_MASK) == LM_FREQ_133 ) - i810c->LmFreqSel = 133; - else - i810c->LmFreqSel = 100; - - xfree(p); - -/* fprintf(stderr,"Selected frequency %d\n",i810c->LmFreqSel); */ - } - -/* fprintf(stderr,"Will alloc AGP framebuffer: %d kByte\n",i810c->videoRam); */ - - /* Since we always want write combining on first 32 mb of framebuffer - * we pass a mapsize of 32 mb */ - i810c->FbMapSize = 32*1024*1024; - - for (i = 2 ; i < i810c->FbMapSize ; i <<= 1); - i810c->FbMapSize = i; - - i810c->FbBase = - KdMapDevice (i810c->LinearAddr, i810c->FbMapSize); - - if (!i810c->FbBase) return FALSE; -/* fprintf(stderr,"Mapped 0x%lx bytes of framebuffer at %p\n", */ -/* i810c->FbMapSize,i810c->FbBase); */ - - card->driver=i810c; - - return TRUE; -} - -static void -i810ScreenFini (KdScreenInfo *screen) -{ - I810ScreenInfo *i810s = (I810ScreenInfo *) screen->driver; - - xfree (i810s); - screen->driver = 0; -} - -static Bool -i810InitScreen (ScreenPtr pScreen) { - -#ifdef XV - i810InitVideo(pScreen); -#endif - return TRUE; -} - -static Bool -i810FinishInitScreen(ScreenPtr pScreen) -{ - /* XXX: RandR init */ - return TRUE; -} - -static void -i810CardFini (KdCardInfo *card) -{ - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - KdUnmapDevice (i810c->FbBase, i810c->FbMapSize); - KdUnmapDevice (i810c->MMIOBase, I810_REG_SIZE); - xfree (i810c); - card->driver = 0; -} - -struct wm_info { - double freq; - unsigned int wm; -}; - -struct wm_info i810_wm_8_100[] = { - { 0, 0x22003000 }, - { 25.2, 0x22003000 }, - { 28.0, 0x22003000 }, - { 31.5, 0x22003000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22008000 }, - { 50.0, 0x22008000 }, - { 56.3, 0x22008000 }, - { 65.0, 0x22008000 }, - { 75.0, 0x22008000 }, - { 78.8, 0x22008000 }, - { 80.0, 0x22008000 }, - { 94.0, 0x22008000 }, - { 96.0, 0x22107000 }, - { 99.0, 0x22107000 }, - { 108.0, 0x22107000 }, - { 121.0, 0x22107000 }, - { 128.9, 0x22107000 }, - { 132.0, 0x22109000 }, - { 135.0, 0x22109000 }, - { 157.5, 0x2210b000 }, - { 162.0, 0x2210b000 }, - { 175.5, 0x2210b000 }, - { 189.0, 0x2220e000 }, - { 202.5, 0x2220e000 } -}; - -struct wm_info i810_wm_16_100[] = { - { 0, 0x22004000 }, - { 25.2, 0x22006000 }, - { 28.0, 0x22006000 }, - { 31.5, 0x22007000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22009000 }, - { 50.0, 0x22009000 }, - { 56.3, 0x22108000 }, - { 65.0, 0x2210e000 }, - { 75.0, 0x2210e000 }, - { 78.8, 0x2210e000 }, - { 80.0, 0x22210000 }, - { 94.5, 0x22210000 }, - { 96.0, 0x22210000 }, - { 99.0, 0x22210000 }, - { 108.0, 0x22210000 }, - { 121.0, 0x22210000 }, - { 128.9, 0x22210000 }, - { 132.0, 0x22314000 }, - { 135.0, 0x22314000 }, - { 157.5, 0x22415000 }, - { 162.0, 0x22416000 }, - { 175.5, 0x22416000 }, - { 189.0, 0x22416000 }, - { 195.0, 0x22416000 }, - { 202.5, 0x22416000 } -}; - - -struct wm_info i810_wm_24_100[] = { - { 0, 0x22006000 }, - { 25.2, 0x22009000 }, - { 28.0, 0x22009000 }, - { 31.5, 0x2200a000 }, - { 36.0, 0x2210c000 }, - { 40.0, 0x2210c000 }, - { 45.0, 0x2210c000 }, - { 49.5, 0x22111000 }, - { 50.0, 0x22111000 }, - { 56.3, 0x22111000 }, - { 65.0, 0x22214000 }, - { 75.0, 0x22214000 }, - { 78.8, 0x22215000 }, - { 80.0, 0x22216000 }, - { 94.5, 0x22218000 }, - { 96.0, 0x22418000 }, - { 99.0, 0x22418000 }, - { 108.0, 0x22418000 }, - { 121.0, 0x22418000 }, - { 128.9, 0x22419000 }, - { 132.0, 0x22519000 }, - { 135.0, 0x4441d000 }, - { 157.5, 0x44419000 }, - { 162.0, 0x44419000 }, - { 175.5, 0x44419000 }, - { 189.0, 0x44419000 }, - { 195.0, 0x44419000 }, - { 202.5, 0x44419000 } -}; - -struct wm_info i810_wm_32_100[] = { - { 0, 0x2210b000 }, - { 60, 0x22415000 }, /* 0x314000 works too */ - { 80, 0x22419000 } /* 0x518000 works too */ -}; - - -struct wm_info i810_wm_8_133[] = { - { 0, 0x22003000 }, - { 25.2, 0x22003000 }, - { 28.0, 0x22003000 }, - { 31.5, 0x22003000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22008000 }, - { 50.0, 0x22008000 }, - { 56.3, 0x22008000 }, - { 65.0, 0x22008000 }, - { 75.0, 0x22008000 }, - { 78.8, 0x22008000 }, - { 80.0, 0x22008000 }, - { 94.0, 0x22008000 }, - { 96.0, 0x22107000 }, - { 99.0, 0x22107000 }, - { 108.0, 0x22107000 }, - { 121.0, 0x22107000 }, - { 128.9, 0x22107000 }, - { 132.0, 0x22109000 }, - { 135.0, 0x22109000 }, - { 157.5, 0x2210b000 }, - { 162.0, 0x2210b000 }, - { 175.5, 0x2210b000 }, - { 189.0, 0x2220e000 }, - { 202.5, 0x2220e000 } -}; - - -struct wm_info i810_wm_16_133[] = { - { 0, 0x22004000 }, - { 25.2, 0x22006000 }, - { 28.0, 0x22006000 }, - { 31.5, 0x22007000 }, - { 36.0, 0x22007000 }, - { 40.0, 0x22007000 }, - { 45.0, 0x22007000 }, - { 49.5, 0x22009000 }, - { 50.0, 0x22009000 }, - { 56.3, 0x22108000 }, - { 65.0, 0x2210e000 }, - { 75.0, 0x2210e000 }, - { 78.8, 0x2210e000 }, - { 80.0, 0x22210000 }, - { 94.5, 0x22210000 }, - { 96.0, 0x22210000 }, - { 99.0, 0x22210000 }, - { 108.0, 0x22210000 }, - { 121.0, 0x22210000 }, - { 128.9, 0x22210000 }, - { 132.0, 0x22314000 }, - { 135.0, 0x22314000 }, - { 157.5, 0x22415000 }, - { 162.0, 0x22416000 }, - { 175.5, 0x22416000 }, - { 189.0, 0x22416000 }, - { 195.0, 0x22416000 }, - { 202.5, 0x22416000 } -}; - -struct wm_info i810_wm_24_133[] = { - { 0, 0x22006000 }, - { 25.2, 0x22009000 }, - { 28.0, 0x22009000 }, - { 31.5, 0x2200a000 }, - { 36.0, 0x2210c000 }, - { 40.0, 0x2210c000 }, - { 45.0, 0x2210c000 }, - { 49.5, 0x22111000 }, - { 50.0, 0x22111000 }, - { 56.3, 0x22111000 }, - { 65.0, 0x22214000 }, - { 75.0, 0x22214000 }, - { 78.8, 0x22215000 }, - { 80.0, 0x22216000 }, - { 94.5, 0x22218000 }, - { 96.0, 0x22418000 }, - { 99.0, 0x22418000 }, - { 108.0, 0x22418000 }, - { 121.0, 0x22418000 }, - { 128.9, 0x22419000 }, - { 132.0, 0x22519000 }, - { 135.0, 0x4441d000 }, - { 157.5, 0x44419000 }, - { 162.0, 0x44419000 }, - { 175.5, 0x44419000 }, - { 189.0, 0x44419000 }, - { 195.0, 0x44419000 }, - { 202.5, 0x44419000 } -}; - -static void -i810WriteControlMMIO(I810CardInfo *i810c, int addr, CARD8 index, CARD8 val) { - moutb(addr, index); - moutb(addr+1, val); -} - -static CARD8 -i810ReadControlMMIO(I810CardInfo *i810c, int addr, CARD8 index) { - moutb(addr, index); - return minb(addr+1); -} - -static Bool -i810ModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) -{ - /* This is just a guess. */ - if (t->horizontal > 1600 || t->horizontal < 640) return FALSE; - if (t->vertical > 1200 || t->horizontal < 350) return FALSE; - return TRUE; -} - -static Bool -i810ModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - int byte_width, pixel_width, screen_size; - -/* fprintf(stderr,"i810ModeUsable\n"); */ - - if (screen->fb[0].depth >= 24) - { - screen->fb[0].depth = 24; - screen->fb[0].bitsPerPixel = 24; - screen->dumb = TRUE; - } - else if (screen->fb[0].depth >= 16) - { - screen->fb[0].depth = 16; - screen->fb[0].bitsPerPixel = 16; - } - else if (screen->fb[0].depth >= 15) - { - screen->fb[0].depth = 15; - screen->fb[0].bitsPerPixel = 16; - } - else - { - screen->fb[0].depth = 8; - screen->fb[0].bitsPerPixel = 8; - } - byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); - pixel_width = screen->width; - - screen->fb[0].pixelStride = pixel_width; - screen->fb[0].byteStride = byte_width; - - screen_size = byte_width * screen->height; - - return screen_size <= (i810c->videoRam * 1024); -} - -static int i810AllocateGARTMemory( KdScreenInfo *screen ) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - unsigned long size = i810c->videoRam * 1024; - - int key; - long tom = 0; - unsigned long physical; - - if (!KdAgpGARTSupported()) - return FALSE; - - if (!KdAcquireGART(screen->mynum)) - return FALSE; - - /* This allows the 2d only Xserver to regen */ - i810c->agpAcquired2d = TRUE; - - /* Treat the gart like video memory - we assume we own all that is - * there, so ignore EBUSY errors. Don't try to remove it on - * failure, either, as other X server may be using it. - */ - - if ((key = KdAllocateGARTMemory(screen->mynum, size, 0, NULL)) == -1) - return FALSE; - - i810c->VramOffset = 0; - i810c->VramKey = key; - - if (!KdBindGARTMemory(screen->mynum, key, 0)) - return FALSE; - - - i810c->SysMem.Start = 0; - i810c->SysMem.Size = size; - i810c->SysMem.End = size; - i810c->SavedSysMem = i810c->SysMem; - - tom = i810c->SysMem.End; - - i810c->DcacheMem.Start = 0; - i810c->DcacheMem.End = 0; - i810c->DcacheMem.Size = 0; - i810c->CursorPhysical = 0; - - /* Dcache - half the speed of normal ram, so not really useful for - * a 2d server. Don't bother reporting its presence. This is - * mapped in addition to the requested amount of system ram. - */ - size = 1024 * 4096; - - /* Keep it 512K aligned for the sake of tiled regions. - */ - tom += 0x7ffff; - tom &= ~0x7ffff; - - if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_DCACHE_MEMORY, NULL)) != -1) { - i810c->DcacheOffset= tom; - i810c->DcacheKey = key; - if (!KdBindGARTMemory(screen->mynum, key, tom)) { - fprintf(stderr,"Allocation of %ld bytes for DCACHE failed\n", size); - i810c->DcacheKey = -1; - } else { - i810c->DcacheMem.Start = tom; - i810c->DcacheMem.Size = size; - i810c->DcacheMem.End = i810c->DcacheMem.Start + i810c->DcacheMem.Size; - tom = i810c->DcacheMem.End; - } - } else { - fprintf(stderr, - "No physical memory available for %ld bytes of DCACHE\n", - size); - i810c->DcacheKey = -1; - } - - /* Mouse cursor -- The i810 (crazy) needs a physical address in - * system memory from which to upload the cursor. We get this from - * the agpgart module using a special memory type. - */ - - /* 4k for the cursor is excessive, I'm going to steal 3k for - * overlay registers later - */ - - size = 4096; - - if ((key = KdAllocateGARTMemory(screen->mynum, size, AGP_PHYS_MEMORY, - &physical)) == -1) { - fprintf(stderr, - "No physical memory available for HW cursor\n"); - i810c->HwcursKey = -1; - } else { - i810c->HwcursOffset= tom; - i810c->HwcursKey = key; - if (!KdBindGARTMemory(screen->mynum, key, tom)) { - fprintf(stderr, - "Allocation of %ld bytes for HW cursor failed\n", - size); - i810c->HwcursKey = -1; - } else { - i810c->CursorPhysical = physical; - i810c->CursorStart = tom; - tom += size; - } - } - - /* Overlay register buffer -- Just like the cursor, the i810 needs a - * physical address in system memory from which to upload the overlay - * registers. - */ - if (i810c->CursorStart != 0) { - i810c->OverlayPhysical = i810c->CursorPhysical + 1024; - i810c->OverlayStart = i810c->CursorStart + 1024; - } - - - i810c->GttBound = 1; - - return TRUE; -} - -/* Allocate from a memrange, returns success */ - -static int i810AllocLow( I810MemRange *result, I810MemRange *pool, int size ) -{ - if (size > pool->Size) return FALSE; - - pool->Size -= size; - result->Size = size; - result->Start = pool->Start; - result->End = pool->Start += size; - return TRUE; -} - -static int i810AllocHigh( I810MemRange *result, I810MemRange *pool, int size ) -{ - if (size > pool->Size) return 0; - - pool->Size -= size; - result->Size = size; - result->End = pool->End; - result->Start = pool->End -= size; - return 1; -} - -static Bool -i810AllocateFront(KdScreenInfo *screen) { - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - int cache_lines = -1; - - if(i810c->DoneFrontAlloc) - return TRUE; - - memset(&(i810c->FbMemBox), 0, sizeof(BoxRec)); - /* Alloc FrontBuffer/Ring/Accel memory */ - i810c->FbMemBox.x1=0; - i810c->FbMemBox.x2=screen->width; - i810c->FbMemBox.y1=0; - i810c->FbMemBox.y2=screen->height; - - /* This could be made a command line option */ - cache_lines = 0; - - if(cache_lines >= 0) - i810c->FbMemBox.y2 += cache_lines; - else { - /* make sure there is enough for two DVD sized YUV buffers */ - i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384; - if (screen->width <= 1024) - i810c->FbMemBox.y2 += (screen->fb[0].depth == 24) ? 256 : 384; - cache_lines = i810c->FbMemBox.y2 - screen->height; - } - - if (I810_DEBUG) - ErrorF("Adding %i scanlines for pixmap caching\n", cache_lines); - - /* Reserve room for the framebuffer and pixcache. Put at the top - * of memory so we can have nice alignment for the tiled regions at - * the start of memory. - */ - i810AllocLow( &(i810c->FrontBuffer), - &(i810c->SysMem), - ((i810c->FbMemBox.x2 * - i810c->FbMemBox.y2 * - i810c->cpp) + 4095) & ~4095); - - memset( &(i810c->LpRing), 0, sizeof( I810RingBuffer ) ); - if(i810AllocLow( &(i810c->LpRing.mem), &(i810c->SysMem), 16*4096 )) { - if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) - ErrorF( "ring buffer at local %lx\n", - i810c->LpRing.mem.Start); - - i810c->LpRing.tail_mask = i810c->LpRing.mem.Size - 1; - i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start; - i810c->LpRing.head = 0; - i810c->LpRing.tail = 0; - i810c->LpRing.space = 0; - } - - if ( i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 64*1024 ) || - i810AllocLow( &i810c->Scratch, &(i810c->SysMem), 16*1024 ) ) { - if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) - ErrorF("Allocated Scratch Memory\n"); - } - -#ifdef XV - /* 720x720 is just how much memory the mpeg player needs for overlays */ - - if ( i810AllocHigh( &i810c->XvMem, &(i810c->SysMem), 720*720*2 )) { - if (I810_DEBUG & DEBUG_VERBOSE_MEMORY) - ErrorF("Allocated overlay Memory\n"); - } -#endif - - i810c->DoneFrontAlloc = TRUE; - return TRUE; -} - -static Bool -i810MapMem(KdScreenInfo *screen) -{ - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - i810c->LpRing.virtual_start = i810c->FbBase + i810c->LpRing.mem.Start; - - return TRUE; -} - - -Bool -i810ScreenInit (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - I810ScreenInfo *i810s; - - int i; - - const KdMonitorTiming *t; - -/* fprintf(stderr,"i810ScreenInit\n"); */ - - i810s = (I810ScreenInfo *) xalloc (sizeof (I810ScreenInfo)); - if (!i810s) - return FALSE; - - memset (i810s, '\0', sizeof (I810ScreenInfo)); - - i810s->i810c = i810c; - - /* Default dimensions */ - if (!screen->width || !screen->height) - { - screen->width = 720; - screen->height = 576; - screen->rate = 52; -#if 0 - screen->width = 1024; - screen->height = 768; - screen->rate = 72; -#endif - } - - if (!screen->fb[0].depth) - screen->fb[0].depth = 16; - - t = KdFindMode (screen, i810ModeSupported); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - if (!KdTuneMode (screen, i810ModeUsable, i810ModeSupported)) - { - xfree (i810c); - return FALSE; - } - -/* fprintf(stderr,"Screen rate %d horiz %d vert %d\n",t->rate,t->horizontal,t->vertical); */ - - switch (screen->fb[0].depth) { - case 8: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 15: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x03e0; - screen->fb[0].redMask = 0x7c00; - - i810c->colorKey = 0x043f; - - break; - case 16: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x07e0; - screen->fb[0].redMask = 0xf800; - - i810c->colorKey = 0x083f; - - break; - case 24: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x0000ff; - screen->fb[0].greenMask = 0x00ff00; - screen->fb[0].redMask = 0xff0000; - - i810c->colorKey = 0x0101ff; - - break; - default: - fprintf(stderr,"Unsupported depth %d\n",screen->fb[0].depth); - return FALSE; - } - - - - /* Set all colours to black */ - for (i=0; i<768; i++) i810c->vga.ModeReg.DAC[i] = 0x00; - - /* ... and the overscan */ - if (screen->fb[0].depth >= 4) - i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF; - - /* Could be made a command-line option */ - -#ifdef I810CFG_SHOW_OVERSCAN - i810c->vga.ModeReg.DAC[765] = 0x3F; - i810c->vga.ModeReg.DAC[766] = 0x00; - i810c->vga.ModeReg.DAC[767] = 0x3F; - i810c->vga.ModeReg.Attribute[OVERSCAN] = 0xFF; - i810c->vga.ShowOverscan = TRUE; -#else - i810c->vga.ShowOverscan = FALSE; -#endif - - i810c->vga.paletteEnabled = FALSE; - i810c->vga.cmapSaved = FALSE; - i810c->vga.MMIOBase = i810c->MMIOBase; - - i810c->cpp = screen->fb[0].bitsPerPixel/8; - - /* move to initscreen? */ - - switch (screen->fb[0].bitsPerPixel) { - case 8: - i810c->MaxClock = 203000; - break; - case 16: - i810c->MaxClock = 163000; - break; - case 24: - i810c->MaxClock = 136000; - break; - case 32: /* not supported */ - i810c->MaxClock = 86000; - default: - fprintf(stderr,"Unsupported bpp %d\n",screen->fb[0].bitsPerPixel); - return FALSE; - } - - if (!i810AllocateGARTMemory( screen )) { - return FALSE; - } - - i810AllocateFront(screen); - - /* Map LpRing memory */ - if (!i810MapMem(screen)) return FALSE; - - screen->fb[0].frameBuffer = i810c->FbBase; - - screen->driver = i810s; - - return TRUE; -} - -/* - * I810Save -- - * - * This function saves the video state. It reads all of the SVGA registers - * into the vgaI810Rec data structure. There is in general no need to - * mask out bits here - just read the registers. - */ -static void -DoSave(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, Bool saveFonts) -{ - - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - - int i; - - /* Save VGA registers */ - - vgaReg->MiscOutReg = mmioReadMiscOut(vgap); - if (vgaReg->MiscOutReg & 0x01) - vgap->IOBase = VGA_IOBASE_COLOR; - else - vgap->IOBase = VGA_IOBASE_MONO; - - for (i = 0; i < VGA_NUM_CRTC; i++) { - vgaReg->CRTC[i] = mmioReadCrtc(vgap, i); - } - - mmioEnablePalette(vgap); - for (i = 0; i < VGA_NUM_ATTR; i++) { - vgaReg->Attribute[i] = mmioReadAttr(vgap, i); - } - mmioDisablePalette(vgap); - - for (i = 0; i < VGA_NUM_GFX; i++) { - vgaReg->Graphics[i] = mmioReadGr(vgap, i); - } - - for (i = 1; i < VGA_NUM_SEQ; i++) { - vgaReg->Sequencer[i] = mmioReadSeq(vgap, i); - } - - /* - * The port I/O code necessary to read in the extended registers - * into the fields of the I810Rec structure goes here. - */ - i810Reg->IOControl = mmioReadCrtc(vgap, IO_CTNL); - i810Reg->AddressMapping = i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING); - i810Reg->BitBLTControl = INREG8(BITBLT_CNTL); - i810Reg->VideoClk2_M = INREG16(VCLK2_VCO_M); - i810Reg->VideoClk2_N = INREG16(VCLK2_VCO_N); - i810Reg->VideoClk2_DivisorSel = INREG8(VCLK2_VCO_DIV_SEL); - - i810Reg->ExtVertTotal=mmioReadCrtc(vgap, EXT_VERT_TOTAL); - i810Reg->ExtVertDispEnd=mmioReadCrtc(vgap, EXT_VERT_DISPLAY); - i810Reg->ExtVertSyncStart=mmioReadCrtc(vgap, EXT_VERT_SYNC_START); - i810Reg->ExtVertBlankStart=mmioReadCrtc(vgap, EXT_VERT_BLANK_START); - i810Reg->ExtHorizTotal=mmioReadCrtc(vgap, EXT_HORIZ_TOTAL); - i810Reg->ExtHorizBlank=mmioReadCrtc(vgap, EXT_HORIZ_BLANK); - i810Reg->ExtOffset=mmioReadCrtc(vgap, EXT_OFFSET); - i810Reg->InterlaceControl=mmioReadCrtc(vgap, INTERLACE_CNTL); - - i810Reg->PixelPipeCfg0 = INREG8(PIXPIPE_CONFIG_0); - i810Reg->PixelPipeCfg1 = INREG8(PIXPIPE_CONFIG_1); - i810Reg->PixelPipeCfg2 = INREG8(PIXPIPE_CONFIG_2); - i810Reg->DisplayControl = INREG8(DISPLAY_CNTL); - i810Reg->LMI_FIFO_Watermark = INREG(FWATER_BLC); - - for (i = 0 ; i < 8 ; i++) - i810Reg->Fence[i] = INREG(FENCE+i*4); - - i810Reg->LprbTail = INREG(LP_RING + RING_TAIL); - i810Reg->LprbHead = INREG(LP_RING + RING_HEAD); - i810Reg->LprbStart = INREG(LP_RING + RING_START); - i810Reg->LprbLen = INREG(LP_RING + RING_LEN); - - if ((i810Reg->LprbTail & TAIL_ADDR) != (i810Reg->LprbHead & HEAD_ADDR) && - i810Reg->LprbLen & RING_VALID) { - i810PrintErrorState( i810c ); - FatalError( "Active ring not flushed\n"); - } - - if (I810_DEBUG) { - fprintf(stderr,"Got mode in I810Save:\n"); - i810PrintMode( vgaReg, i810Reg ); - } -} - -static void -i810Preserve(KdCardInfo *card) -{ - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - -/* fprintf(stderr,"i810Preserve\n"); */ - DoSave(card, &vgap->SavedReg, &i810c->SavedReg, TRUE); -} - -/* Famous last words - */ -void -i810PrintErrorState(i810CardInfo *i810c) -{ - - fprintf(stderr, "pgetbl_ctl: 0x%lx pgetbl_err: 0x%lx\n", - INREG(PGETBL_CTL), - INREG(PGE_ERR)); - - fprintf(stderr, "ipeir: %lx iphdr: %lx\n", - INREG(IPEIR), - INREG(IPEHR)); - - fprintf(stderr, "LP ring tail: %lx head: %lx len: %lx start %lx\n", - INREG(LP_RING + RING_TAIL), - INREG(LP_RING + RING_HEAD) & HEAD_ADDR, - INREG(LP_RING + RING_LEN), - INREG(LP_RING + RING_START)); - - fprintf(stderr, "eir: %x esr: %x emr: %x\n", - INREG16(EIR), - INREG16(ESR), - INREG16(EMR)); - - fprintf(stderr, "instdone: %x instpm: %x\n", - INREG16(INST_DONE), - INREG8(INST_PM)); - - fprintf(stderr, "memmode: %lx instps: %lx\n", - INREG(MEMMODE), - INREG(INST_PS)); - - fprintf(stderr, "hwstam: %x ier: %x imr: %x iir: %x\n", - INREG16(HWSTAM), - INREG16(IER), - INREG16(IMR), - INREG16(IIR)); -} - -static Bool -i810BindGARTMemory( KdScreenInfo *screen ) -{ - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - - if (!i810c->GttBound) { - if (!KdAcquireGART(screen->mynum)) - return FALSE; - if (!KdBindGARTMemory(screen->mynum, i810c->VramKey, - i810c->VramOffset)) - - return FALSE; - if (i810c->DcacheKey != -1) { - if (!KdBindGARTMemory(screen->mynum, i810c->DcacheKey, - i810c->DcacheOffset)) - return FALSE; - } - if (i810c->HwcursKey != -1) { - if (!KdBindGARTMemory(screen->mynum, i810c->HwcursKey, - i810c->HwcursOffset)) - return FALSE; - } - i810c->GttBound = 1; - } - return TRUE; -} - -static Bool -i810UnbindGARTMemory(KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - - - if (KdAgpGARTSupported() && i810c->GttBound) { - if (!KdUnbindGARTMemory(screen->mynum, i810c->VramKey)) - return FALSE; - if (i810c->DcacheKey != -1) { - if (!KdUnbindGARTMemory(screen->mynum, i810c->DcacheKey)) - return FALSE; - } - if (i810c->HwcursKey != -1) { - if (!KdUnbindGARTMemory(screen->mynum, i810c->HwcursKey)) - return FALSE; - } - if (!KdReleaseGART(screen->mynum)) - return FALSE; - i810c->GttBound = 0; - } - return TRUE; -} - -/* - * I810CalcVCLK -- - * - * Determine the closest clock frequency to the one requested. - */ - -#define MAX_VCO_FREQ 600.0 -#define TARGET_MAX_N 30 -#define REF_FREQ 24.0 - -#define CALC_VCLK(m,n,p) \ - (double)m / ((double)n * (1 << p)) * 4 * REF_FREQ - -static void -i810CalcVCLK( KdScreenInfo *screen, double freq ) -{ - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - I810RegPtr i810Reg = &i810c->ModeReg; - - int m, n, p; - double f_out, f_best; - double f_err; - double f_vco; - int m_best = 0, n_best = 0, p_best = 0; - double f_target = freq; - double err_max = 0.005; - double err_target = 0.001; - double err_best = 999999.0; - - p_best = p = log(MAX_VCO_FREQ/f_target)/log((double)2); - f_vco = f_target * (1 << p); - - n = 2; - do { - n++; - m = f_vco / (REF_FREQ / (double)n) / (double)4.0 + 0.5; - if (m < 3) m = 3; - f_out = CALC_VCLK(m,n,p); - f_err = 1.0 - (f_target/f_out); - if (fabs(f_err) < err_max) { - m_best = m; - n_best = n; - f_best = f_out; - err_best = f_err; - } - } while ((fabs(f_err) >= err_target) && - ((n <= TARGET_MAX_N) || (fabs(err_best) > err_max))); - - if (fabs(f_err) < err_target) { - m_best = m; - n_best = n; - } - - i810Reg->VideoClk2_M = (m_best-2) & 0x3FF; - i810Reg->VideoClk2_N = (n_best-2) & 0x3FF; - i810Reg->VideoClk2_DivisorSel = (p_best << 4); - -/* fprintf(stderr, "Setting dot clock to %.1f MHz " */ -/* "[ 0x%x 0x%x 0x%x ] " */ -/* "[ %d %d %d ]\n", */ -/* CALC_VCLK(m_best,n_best,p_best), */ -/* i810Reg->VideoClk2_M, */ -/* i810Reg->VideoClk2_N, */ -/* i810Reg->VideoClk2_DivisorSel, */ -/* m_best, n_best, p_best); */ -} - -/* - * I810CalcFIFO -- - * - * Calculate burst length and FIFO watermark. - */ - -#define Elements(x) (sizeof(x)/sizeof(*x)) - -static unsigned int -i810CalcWatermark( KdScreenInfo *screen, double freq, Bool dcache ) -{ - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - - - struct wm_info *tab; - int nr; - int i; - - if (i810c->LmFreqSel == 100) { - switch(screen->fb[0].bitsPerPixel) { - case 8: - tab = i810_wm_8_100; - nr = Elements(i810_wm_8_100); - break; - case 16: - tab = i810_wm_16_100; - nr = Elements(i810_wm_16_100); - break; - case 24: - tab = i810_wm_24_100; - nr = Elements(i810_wm_24_100); - break; - default: - return 0; - } - } else { - switch(screen->fb[0].bitsPerPixel) { - case 8: - tab = i810_wm_8_133; - nr = Elements(i810_wm_8_133); - break; - case 16: - tab = i810_wm_16_133; - nr = Elements(i810_wm_16_133); - break; - case 24: - tab = i810_wm_24_133; - nr = Elements(i810_wm_24_133); - break; - default: - return 0; - } - } - - for (i = 0 ; i < nr && tab[i].freq < freq ; i++); - - if (i == nr) - i--; - -/* fprintf(stderr,"chose watermark 0x%x: (tab.freq %.1f)\n", */ -/* tab[i].wm, tab[i].freq); */ - - /* None of these values (sourced from intel) have watermarks for - * the dcache memory. Fake it for now by using the same watermark - * for both... - * - * Update: this is probably because dcache isn't real useful as - * framebuffer memory, so intel's drivers don't need watermarks - * for that memory because they never use it to feed the ramdacs. - * We do use it in the fallback mode, so keep the watermarks for - * now. - */ - if (dcache) - return (tab[i].wm & ~0xffffff) | ((tab[i].wm>>12) & 0xfff); - else - return tab[i].wm; -} - -static void i810PrintMode( vgaRegPtr vgaReg, I810RegPtr mode ) -{ - int i; - - fprintf(stderr," MiscOut: %x\n", vgaReg->MiscOutReg); - - - fprintf(stderr,"SEQ: "); - for (i = 0 ; i < VGA_NUM_SEQ ; i++) { - if ((i&7)==0) fprintf(stderr,"\n"); - fprintf(stderr," %d: %x", i, vgaReg->Sequencer[i]); - } - fprintf(stderr,"\n"); - - fprintf(stderr,"CRTC: "); - for (i = 0 ; i < VGA_NUM_CRTC ; i++) { - if ((i&3)==0) fprintf(stderr,"\n"); - fprintf(stderr," CR%02x: %2x", i, vgaReg->CRTC[i]); - } - fprintf(stderr,"\n"); - - fprintf(stderr,"GFX: "); - for (i = 0 ; i < VGA_NUM_GFX ; i++) { - if ((i&3)==0) fprintf(stderr,"\n"); - fprintf(stderr," GR%02x: %02x", i, vgaReg->Graphics[i]); - } - fprintf(stderr,"\n"); - - fprintf(stderr,"ATTR: "); - for (i = 0 ; i < VGA_NUM_ATTR ; i++) { - if ((i&7)==0) fprintf(stderr,"\n"); - fprintf(stderr," %d: %x", i, vgaReg->Attribute[i]); - } - fprintf(stderr,"\n"); - - - fprintf(stderr," DisplayControl: %x\n", mode->DisplayControl); - fprintf(stderr," PixelPipeCfg0: %x\n", mode->PixelPipeCfg0); - fprintf(stderr," PixelPipeCfg1: %x\n", mode->PixelPipeCfg1); - fprintf(stderr," PixelPipeCfg2: %x\n", mode->PixelPipeCfg2); - fprintf(stderr," VideoClk2_M: %x\n", mode->VideoClk2_M); - fprintf(stderr," VideoClk2_N: %x\n", mode->VideoClk2_N); - fprintf(stderr," VideoClk2_DivisorSel: %x\n", mode->VideoClk2_DivisorSel); - fprintf(stderr," AddressMapping: %x\n", mode->AddressMapping); - fprintf(stderr," IOControl: %x\n", mode->IOControl); - fprintf(stderr," BitBLTControl: %x\n", mode->BitBLTControl); - fprintf(stderr," ExtVertTotal: %x\n", mode->ExtVertTotal); - fprintf(stderr," ExtVertDispEnd: %x\n", mode->ExtVertDispEnd); - fprintf(stderr," ExtVertSyncStart: %x\n", mode->ExtVertSyncStart); - fprintf(stderr," ExtVertBlankStart: %x\n", mode->ExtVertBlankStart); - fprintf(stderr," ExtHorizTotal: %x\n", mode->ExtHorizTotal); - fprintf(stderr," ExtHorizBlank: %x\n", mode->ExtHorizBlank); - fprintf(stderr," ExtOffset: %x\n", mode->ExtOffset); - fprintf(stderr," InterlaceControl: %x\n", mode->InterlaceControl); - fprintf(stderr," LMI_FIFO_Watermark: %x\n", mode->LMI_FIFO_Watermark); - fprintf(stderr," LprbTail: %x\n", mode->LprbTail); - fprintf(stderr," LprbHead: %x\n", mode->LprbHead); - fprintf(stderr," LprbStart: %x\n", mode->LprbStart); - fprintf(stderr," LprbLen: %x\n", mode->LprbLen); - fprintf(stderr," OverlayActiveStart: %x\n", mode->OverlayActiveStart); - fprintf(stderr," OverlayActiveEnd: %x\n", mode->OverlayActiveEnd); -} - - -/* - * i810VGASeqReset - * perform a sequencer reset. - * - * The i815 documentation states that these bits are not used by the - * HW, but still warns about not programming them... - */ - -static void -i810VGASeqReset(i810VGAPtr vgap, Bool start) -{ - if (start) - { - mmioWriteSeq(vgap, 0x00, 0x01); /* Synchronous Reset */ - } - else - { - mmioWriteSeq(vgap, 0x00, 0x03); /* End Reset */ - } -} - -static void -i810VGAProtect(KdCardInfo *card, Bool on) -{ - - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - - unsigned char tmp; - - if (on) { - /* - * Turn off screen and disable sequencer. - */ - tmp = mmioReadSeq(vgap, 0x01); - - i810VGASeqReset(vgap, TRUE); /* start synchronous reset */ - mmioWriteSeq(vgap, 0x01, tmp | 0x20); /* disable the display */ - - mmioEnablePalette(vgap); - } else { - /* - * Reenable sequencer, then turn on screen. - */ - - tmp = mmioReadSeq(vgap, 0x01); - - mmioWriteSeq(vgap, 0x01, tmp & ~0x20); /* reenable display */ - i810VGASeqReset(vgap, FALSE); /* clear synchronousreset */ - - mmioDisablePalette(vgap); - } -} - -/* - * i810VGABlankScreen -- blank the screen. - */ - -void -i810VGABlankScreen(KdCardInfo *card, Bool on) -{ - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - - unsigned char scrn; - - scrn = mmioReadSeq(vgap, 0x01); - - if (on) { - scrn &= ~0x20; /* enable screen */ - } else { - scrn |= 0x20; /* blank screen */ - } - - mmioWriteSeq(vgap,0x00,0x01); - mmioWriteSeq(vgap, 0x01, scrn); /* change mode */ - mmioWriteSeq(vgap,0x00,0x03); -} - -/* Restore hardware state */ - -static void -DoRestore(KdCardInfo *card, vgaRegPtr vgaReg, I810RegPtr i810Reg, - Bool restoreFonts) { - - - I810CardInfo *i810c = card->driver; - - i810VGAPtr vgap = &i810c->vga; - - unsigned char temp; - unsigned int itemp; - int i; - - if (I810_DEBUG & DEBUG_VERBOSE_VGA) { - fprintf(stderr,"Setting mode in DoRestore:\n"); - i810PrintMode( vgaReg, i810Reg ); - } - - /* Blank screen (i810vgaprotect) */ - i810VGAProtect(card, TRUE); - - /* Should wait for at least two hsync and no more than two vsync - before writing PIXCONF and turning the display on (?) */ - usleep(50000); - - /* Turn off DRAM Refresh */ - temp = INREG8( DRAM_ROW_CNTL_HI ); - temp &= ~DRAM_REFRESH_RATE; - temp |= DRAM_REFRESH_DISABLE; - OUTREG8( DRAM_ROW_CNTL_HI, temp ); - - usleep(1000); /* Wait 1 ms */ - - /* Write the M, N and P values */ - OUTREG16( VCLK2_VCO_M, i810Reg->VideoClk2_M); - OUTREG16( VCLK2_VCO_N, i810Reg->VideoClk2_N); - OUTREG8( VCLK2_VCO_DIV_SEL, i810Reg->VideoClk2_DivisorSel); - - /* - * Turn on 8 bit dac mode, if requested. This is needed to make - * sure that vgaHWRestore writes the values into the DAC properly. - * The problem occurs if 8 bit dac mode is requested and the HW is - * in 6 bit dac mode. If this happens, all the values are - * automatically shifted left twice by the HW and incorrect colors - * will be displayed on the screen. The only time this can happen - * is at server startup time and when switching back from a VT. - */ - temp = INREG8(PIXPIPE_CONFIG_0); - temp &= 0x7F; /* Save all but the 8 bit dac mode bit */ - temp |= (i810Reg->PixelPipeCfg0 & DAC_8_BIT); - OUTREG8( PIXPIPE_CONFIG_0, temp ); - - /* - * Code to restore any SVGA registers that have been saved/modified - * goes here. Note that it is allowable, and often correct, to - * only modify certain bits in a register by a read/modify/write cycle. - * - * A special case - when using an external clock-setting program, - * this function must not change bits associated with the clock - * selection. This condition can be checked by the condition: - * - * if (i810Reg->std.NoClock >= 0) - * restore clock-select bits. - */ - - /* VGA restore */ - if (vgaReg->MiscOutReg & 0x01) - vgap->IOBase = VGA_IOBASE_COLOR; - else - vgap->IOBase = VGA_IOBASE_MONO; - - mmioWriteMiscOut(vgap, vgaReg->MiscOutReg); - - for (i = 1; i < VGA_NUM_SEQ; i++) - mmioWriteSeq(vgap, i, vgaReg->Sequencer[i]); - - /* Ensure CRTC registers 0-7 are unlocked by clearing bit 7 or CRTC[17] */ - /* = CR11 */ - mmioWriteCrtc(vgap, 17, vgaReg->CRTC[17] & ~0x80); - - for (i = 0; i < VGA_NUM_CRTC; i++) { - mmioWriteCrtc(vgap, i, vgaReg->CRTC[i]); - } - - for (i = 0; i < VGA_NUM_GFX; i++) - mmioWriteGr(vgap, i, vgaReg->Graphics[i]); - - mmioEnablePalette(vgap); - for (i = 0; i < VGA_NUM_ATTR; i++) - mmioWriteAttr(vgap, i, vgaReg->Attribute[i]); - mmioDisablePalette(vgap); - - - mmioWriteCrtc(vgap, EXT_VERT_TOTAL, i810Reg->ExtVertTotal); - mmioWriteCrtc(vgap, EXT_VERT_DISPLAY, i810Reg->ExtVertDispEnd); - mmioWriteCrtc(vgap, EXT_VERT_SYNC_START, i810Reg->ExtVertSyncStart); - mmioWriteCrtc(vgap, EXT_VERT_BLANK_START, i810Reg->ExtVertBlankStart); - mmioWriteCrtc(vgap, EXT_HORIZ_TOTAL, i810Reg->ExtHorizTotal); - mmioWriteCrtc(vgap, EXT_HORIZ_BLANK, i810Reg->ExtHorizBlank); - - /* write CR40, CR42 first etc to get CR13 written as described in PRM */ - - mmioWriteCrtc(vgap, EXT_START_ADDR_HI, 0); - mmioWriteCrtc(vgap, EXT_START_ADDR, EXT_START_ADDR_ENABLE); - - mmioWriteCrtc(vgap, EXT_OFFSET, i810Reg->ExtOffset); - mmioWriteCrtc(vgap, 0x13, vgaReg->CRTC[0x13]); - - temp=mmioReadCrtc(vgap, INTERLACE_CNTL); - temp &= ~INTERLACE_ENABLE; - temp |= i810Reg->InterlaceControl; - mmioWriteCrtc(vgap, INTERLACE_CNTL, temp); - - temp=i810ReadControlMMIO(i810c, GRX, ADDRESS_MAPPING); - temp &= 0xE0; /* Save reserved bits 7:5 */ - temp |= i810Reg->AddressMapping; - i810WriteControlMMIO(i810c, GRX, ADDRESS_MAPPING, temp); - - /* Setting the OVRACT Register for video overlay*/ - OUTREG(0x6001C, (i810Reg->OverlayActiveEnd << 16) | i810Reg->OverlayActiveStart); - - /* Turn on DRAM Refresh */ - temp = INREG8( DRAM_ROW_CNTL_HI ); - temp &= ~DRAM_REFRESH_RATE; - temp |= DRAM_REFRESH_60HZ; - OUTREG8( DRAM_ROW_CNTL_HI, temp ); - - temp = INREG8( BITBLT_CNTL ); - temp &= ~COLEXP_MODE; - temp |= i810Reg->BitBLTControl; - OUTREG8( BITBLT_CNTL, temp ); - - temp = INREG8( DISPLAY_CNTL ); - temp &= ~(VGA_WRAP_MODE | GUI_MODE); - temp |= i810Reg->DisplayControl; - OUTREG8( DISPLAY_CNTL, temp ); - - - temp = INREG8( PIXPIPE_CONFIG_0 ); - temp &= 0x64; /* Save reserved bits 6:5,2 */ - temp |= i810Reg->PixelPipeCfg0; - OUTREG8( PIXPIPE_CONFIG_0, temp ); - - temp = INREG8( PIXPIPE_CONFIG_2 ); - temp &= 0xF3; /* Save reserved bits 7:4,1:0 */ - temp |= i810Reg->PixelPipeCfg2; - OUTREG8( PIXPIPE_CONFIG_2, temp ); - - temp = INREG8( PIXPIPE_CONFIG_1 ); - temp &= ~DISPLAY_COLOR_MODE; - temp &= 0xEF; /* Restore the CRT control bit */ - temp |= i810Reg->PixelPipeCfg1; - OUTREG8( PIXPIPE_CONFIG_1, temp ); - - OUTREG16(EIR, 0); - - itemp = INREG(FWATER_BLC); - itemp &= ~(LM_BURST_LENGTH | LM_FIFO_WATERMARK | - MM_BURST_LENGTH | MM_FIFO_WATERMARK ); - itemp |= i810Reg->LMI_FIFO_Watermark; - OUTREG(FWATER_BLC, itemp); - - - for (i = 0 ; i < 8 ; i++) { - OUTREG( FENCE+i*4, i810Reg->Fence[i] ); - if (I810_DEBUG & DEBUG_VERBOSE_VGA) - fprintf(stderr,"Fence Register : %x\n", i810Reg->Fence[i]); - } - - /* First disable the ring buffer (Need to wait for empty first?, if so - * should probably do it before entering this section) - */ - itemp = INREG(LP_RING + RING_LEN); - itemp &= ~RING_VALID_MASK; - OUTREG(LP_RING + RING_LEN, itemp ); - - /* Set up the low priority ring buffer. - */ - OUTREG(LP_RING + RING_TAIL, 0 ); - OUTREG(LP_RING + RING_HEAD, 0 ); - - i810c->LpRing.head = 0; - i810c->LpRing.tail = 0; - - itemp = INREG(LP_RING + RING_START); - itemp &= ~(START_ADDR); - itemp |= i810Reg->LprbStart; - OUTREG(LP_RING + RING_START, itemp ); - - itemp = INREG(LP_RING + RING_LEN); - itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); - itemp |= i810Reg->LprbLen; - OUTREG(LP_RING + RING_LEN, itemp ); - - i810VGAProtect(card, FALSE); - - temp=mmioReadCrtc(vgap, IO_CTNL); - temp &= ~(EXTENDED_ATTR_CNTL | EXTENDED_CRTC_CNTL); - temp |= i810Reg->IOControl; - mmioWriteCrtc(vgap, IO_CTNL, temp); - /* Protect CRTC[0-7] */ - mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80); -} - - -static Bool -i810SetMode(KdScreenInfo *screen, const KdMonitorTiming *t) -{ - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - - I810RegPtr i810Reg = &i810c->ModeReg; - vgaRegPtr pVga = &vgap->ModeReg; - - double dclk = t->clock/1000.0; - - switch (screen->fb[0].bitsPerPixel) { - case 8: - pVga->CRTC[0x13] = screen->width >> 3; - i810Reg->ExtOffset = screen->width >> 11; - i810Reg->PixelPipeCfg1 = DISPLAY_8BPP_MODE; - i810Reg->BitBLTControl = COLEXP_8BPP; - break; - case 16: - i810Reg->PixelPipeCfg1 = DISPLAY_16BPP_MODE; - pVga->CRTC[0x13] = screen->width >> 2; - i810Reg->ExtOffset = screen->width >> 10; - i810Reg->BitBLTControl = COLEXP_16BPP; - break; - case 24: - pVga->CRTC[0x13] = (screen->width * 3) >> 3; - i810Reg->ExtOffset = (screen->width * 3) >> 11; - - i810Reg->PixelPipeCfg1 = DISPLAY_24BPP_MODE; - i810Reg->BitBLTControl = COLEXP_24BPP; - break; - default: - break; - } - - i810Reg->PixelPipeCfg0 = DAC_8_BIT; - - /* Do not delay CRT Blank: needed for video overlay */ - i810Reg->PixelPipeCfg1 |= 0x10; - - /* Turn on Extended VGA Interpretation */ - i810Reg->IOControl = EXTENDED_CRTC_CNTL; - - /* Turn on linear and page mapping */ - i810Reg->AddressMapping = (LINEAR_MODE_ENABLE | - GTT_MEM_MAP_ENABLE); - - /* Turn on GUI mode */ - i810Reg->DisplayControl = HIRES_MODE; - - i810Reg->OverlayActiveStart = t->horizontal + t->hblank - 32; - i810Reg->OverlayActiveEnd = t->horizontal - 32; - - /* Turn on interlaced mode if necessary (it's not) */ - i810Reg->InterlaceControl = INTERLACE_DISABLE; - - /* - * Set the overscan color to 0. - * NOTE: This only affects >8bpp mode. - */ - pVga->Attribute[0x11] = 0; - - /* - * Calculate the VCLK that most closely matches the requested dot - * clock. - */ - i810CalcVCLK(screen, dclk); - - /* Since we program the clocks ourselves, always use VCLK2. */ - pVga->MiscOutReg |= 0x0C; - - /* Calculate the FIFO Watermark and Burst Length. */ - i810Reg->LMI_FIFO_Watermark = i810CalcWatermark(screen, dclk, FALSE); - - /* Setup the ring buffer */ - i810Reg->LprbTail = 0; - i810Reg->LprbHead = 0; - i810Reg->LprbStart = i810c->LpRing.mem.Start; - - if (i810Reg->LprbStart) - i810Reg->LprbLen = ((i810c->LpRing.mem.Size-4096) | - RING_NO_REPORT | RING_VALID); - else - i810Reg->LprbLen = RING_INVALID; - - return TRUE; -} - -static Bool -i810ModeInit(KdScreenInfo *screen, const KdMonitorTiming *t) -{ - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - vgaRegPtr pVga; - -/* fprintf(stderr,"i810ModeInit\n"); */ - - i810VGAUnlock(vgap); - - if (!i810VGAInit(screen, t)) return FALSE; - pVga = &vgap->ModeReg; - - if (!i810SetMode(screen, t)) return FALSE; - - DoRestore(screen->card, &vgap->ModeReg, &i810c->ModeReg, FALSE); - - return TRUE; -} - -Bool -i810VGAInit(KdScreenInfo *screen, const KdMonitorTiming *t) -{ - unsigned int i; - - int hactive, hblank, hbp, hfp; - int vactive, vblank, vbp, vfp; - int h_screen_off = 0, h_adjust = 0, h_total, h_display_end, h_blank_start; - int h_blank_end, h_sync_start, h_sync_end, v_total, v_retrace_start; - int v_retrace_end, v_display_end, v_blank_start, v_blank_end; - - KdCardInfo *card = screen->card; - I810CardInfo *i810c = card->driver; - - i810VGAPtr vgap = &i810c->vga; - I810RegPtr ireg = &i810c->ModeReg; - - - vgaRegPtr regp; - int depth = screen->fb[0].depth; - - regp = &vgap->ModeReg; - - /* - * compute correct Hsync & Vsync polarity - */ - - regp->MiscOutReg = 0x23; - if (t->vpol == KdSyncNegative) regp->MiscOutReg |= 0x40; - if (t->hpol == KdSyncNegative) regp->MiscOutReg |= 0x80; - - /* - * Time Sequencer - */ - if (depth == 4) - regp->Sequencer[0] = 0x02; - else - regp->Sequencer[0] = 0x00; - /* No support for 320 or 360 x resolution */ - regp->Sequencer[1] = 0x01; - - if (depth == 1) - regp->Sequencer[2] = 1 << BIT_PLANE; - else - regp->Sequencer[2] = 0x0F; - - regp->Sequencer[3] = 0x00; /* Font select */ - - if (depth < 8) - regp->Sequencer[4] = 0x06; /* Misc */ - else - regp->Sequencer[4] = 0x0E; /* Misc */ - - hactive = t->horizontal; - hblank = t->hblank; - hbp = t->hbp; - hfp = t->hfp; - - vactive = t->vertical; - vblank = t->vblank; - vbp = t->vbp; - vfp = t->vfp; - - switch (screen->fb[0].bitsPerPixel) { - case 8: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - h_screen_off = hactive; - h_adjust = 1; - break; - case 16: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - h_screen_off = hactive * 2; - h_adjust = 1; - break; - case 24: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - h_screen_off = hactive * 3; - h_adjust = 1; - break; - case 32: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - h_screen_off = hactive * 4; - h_adjust = 1; - break; - } - - /* - * Compute horizontal register values from timings - */ - h_total = hactive + hblank - 5; - h_display_end = hactive - 1; - h_blank_start = h_display_end; - h_blank_end = h_blank_start + hblank; - - h_sync_start = hactive + hfp + h_adjust; - h_sync_end = h_sync_start + hblank - hbp - hfp; - - /* Set CRTC regs for horizontal timings */ - regp->CRTC[0x0] = h_total; - ireg->ExtHorizTotal=(h_total & 0x100) >> 8; - - regp->CRTC[0x1] = h_display_end; - - regp->CRTC[0x2] = h_blank_start; - - regp->CRTC[0x3] = 0x80 | (h_blank_end & 0x1f); - regp->CRTC[0x5] = (h_blank_end & 0x20) << 2; - - regp->CRTC[0x4] = h_sync_start; - - regp->CRTC[0x5] |= h_sync_end & 0x1f; - - regp->CRTC[0x13] = h_screen_off; - ireg->ExtOffset = h_screen_off >> 8; - - /* Compute vertical timings */ - v_total = vactive + vblank - 2; - v_retrace_start = vactive + vfp - 1; - v_retrace_end = v_retrace_start + vblank - vbp - vfp; - v_display_end = vactive - 1; - v_blank_start = vactive - 1; - v_blank_end = v_blank_start + vblank /* - 1 */; - - regp->CRTC[0x6] = v_total; - ireg->ExtVertTotal = v_total >> 8; - - regp->CRTC[0x10] = v_retrace_start; - ireg->ExtVertSyncStart = v_retrace_start >> 8; - - regp->CRTC[0x11] = v_retrace_end; - - regp->CRTC[0x12] = v_display_end; - ireg->ExtVertDispEnd = v_display_end >> 8; - - regp->CRTC[0x15] = v_blank_start; - ireg->ExtVertBlankStart = v_blank_start >> 8; - - regp->CRTC[0x16] = v_blank_end; - - if (depth < 8) - regp->CRTC[23] = 0xE3; - else - regp->CRTC[23] = 0xC3; - regp->CRTC[24] = 0xFF; - - /* - * Graphics Display Controller - */ - regp->Graphics[0] = 0x00; - regp->Graphics[1] = 0x00; - regp->Graphics[2] = 0x00; - regp->Graphics[3] = 0x00; - if (depth == 1) { - regp->Graphics[4] = BIT_PLANE; - regp->Graphics[5] = 0x00; - } else { - regp->Graphics[4] = 0x00; - if (depth == 4) - regp->Graphics[5] = 0x02; - else - regp->Graphics[5] = 0x40; - } - regp->Graphics[6] = 0x05; - regp->Graphics[7] = 0x0F; - regp->Graphics[8] = 0xFF; - - if (depth == 1) { - /* Initialise the Mono map according to which bit-plane gets used */ - - Bool flipPixels = FALSE; /* maybe support this in the future? */ - - for (i=0; i<16; i++) - if (((i & (1 << BIT_PLANE)) != 0) != flipPixels) - regp->Attribute[i] = WHITE_VALUE; - else - regp->Attribute[i] = BLACK_VALUE; - - regp->Attribute[16] = 0x01; /* -VGA2- */ - if (!vgap->ShowOverscan) - regp->Attribute[OVERSCAN] = OVERSCAN_VALUE; /* -VGA2- */ - } else { - regp->Attribute[0] = 0x00; /* standard colormap translation */ - regp->Attribute[1] = 0x01; - regp->Attribute[2] = 0x02; - regp->Attribute[3] = 0x03; - regp->Attribute[4] = 0x04; - regp->Attribute[5] = 0x05; - regp->Attribute[6] = 0x06; - regp->Attribute[7] = 0x07; - regp->Attribute[8] = 0x08; - regp->Attribute[9] = 0x09; - regp->Attribute[10] = 0x0A; - regp->Attribute[11] = 0x0B; - regp->Attribute[12] = 0x0C; - regp->Attribute[13] = 0x0D; - regp->Attribute[14] = 0x0E; - regp->Attribute[15] = 0x0F; - if (depth == 4) - regp->Attribute[16] = 0x81; - else - regp->Attribute[16] = 0x41; - /* Attribute[17] (overscan) was initialised earlier */ - } - regp->Attribute[18] = 0x0F; - regp->Attribute[19] = 0x00; - regp->Attribute[20] = 0x00; - - return(TRUE); -} - -void -i810VGALock(i810VGAPtr vgap) -{ - /* Protect CRTC[0-7] */ - mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) & ~0x80); -} - -void -i810VGAUnlock(i810VGAPtr vgap) -{ - /* Unprotect CRTC[0-7] */ - mmioWriteCrtc(vgap, 0x11, mmioReadCrtc(vgap, 0x11) | 0x80); -} - -static void -i810Restore(KdCardInfo *card) { - - I810CardInfo *i810c = card->driver; - - i810VGAPtr vgap = &i810c->vga; - - if (I810_DEBUG) - fprintf(stderr,"i810Restore\n"); - - DoRestore(card, &vgap->SavedReg, &i810c->SavedReg, TRUE); -} - -static Bool -i810Enable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = pScreenPriv->card; - I810CardInfo *i810c = card->driver; - i810VGAPtr vgap = &i810c->vga; - const KdMonitorTiming *t; - - if (I810_DEBUG) - fprintf(stderr,"i810Enable\n"); - - vgap->IOBase = (mmioReadMiscOut(vgap) & 0x01) ? - VGA_IOBASE_COLOR : VGA_IOBASE_MONO; - - { - I810RegPtr i810Reg = &i810c->ModeReg; - int i; - - for (i = 0 ; i < 8 ; i++) - i810Reg->Fence[i] = 0; - } - - t = KdFindMode (screen, i810ModeSupported); - - if (!i810BindGARTMemory(screen)) - return FALSE; - - if (!i810ModeInit(screen, t)) return FALSE; - - { - /* DPMS power on state */ - - unsigned char SEQ01=0; - int DPMSSyncSelect=0; - - SEQ01 = 0x00; - DPMSSyncSelect = HSYNC_ON | VSYNC_ON; - - SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20; - i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01); - - /* Set the DPMS mode */ - OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); - } -#ifdef XV - KdXVEnable (pScreen); -#endif - return TRUE; -} - - -static void -i810Disable(ScreenPtr pScreen) { - - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = pScreenPriv->card; - I810CardInfo *i810c = card->driver; - - i810VGAPtr vgap = &i810c->vga; - - if (I810_DEBUG) - fprintf(stderr,"i810Disable\n"); - -#ifdef XV - KdXVDisable (pScreen); -#endif - i810Restore(screen->card); - - if (!i810UnbindGARTMemory(screen)) - return; - - i810VGALock(vgap); -} - - -static Bool -i810DPMS(ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - I810CardInfo *i810c = card->driver; - - unsigned char SEQ01=0; - int DPMSSyncSelect=0; - - if (I810_DEBUG) - fprintf(stderr,"i810DPMS: %d\n",mode); - - switch (mode) { - case KD_DPMS_NORMAL: - /* Screen: On; HSync: On, VSync: On */ - SEQ01 = 0x00; - DPMSSyncSelect = HSYNC_ON | VSYNC_ON; - break; - case KD_DPMS_STANDBY: - /* Screen: Off; HSync: Off, VSync: On */ - SEQ01 = 0x20; - DPMSSyncSelect = HSYNC_OFF | VSYNC_ON; - break; - case KD_DPMS_SUSPEND: - /* Screen: Off; HSync: On, VSync: Off */ - SEQ01 = 0x20; - DPMSSyncSelect = HSYNC_ON | VSYNC_OFF; - break; - case KD_DPMS_POWERDOWN: - /* Screen: Off; HSync: Off, VSync: Off */ - SEQ01 = 0x20; - DPMSSyncSelect = HSYNC_OFF | VSYNC_OFF; - break; - } - - /* Turn the screen on/off */ - SEQ01 |= i810ReadControlMMIO(i810c, SRX, 0x01) & ~0x20; - i810WriteControlMMIO(i810c, SRX, 0x01, SEQ01); - - /* Set the DPMS mode */ - OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); - return TRUE; -} - - -static void -i810GetColors (ScreenPtr pScreen, int fb, int ndefs, xColorItem *c) -{ - - if (I810_DEBUG) - fprintf(stderr,"i810GetColors (NOT IMPLEMENTED)\n"); -} - -#define DACDelay(hw) \ - do { \ - unsigned char temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ - temp = Vminb((hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ - } while (0) - -static void -i810PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - i810VGAPtr vgap = &i810c->vga; - - if (I810_DEBUG) - fprintf(stderr,"i810PutColors\n"); - - while (ndef--) - { - mmioWriteDacWriteAddr(vgap, pdefs->pixel); - DACDelay(vgap); - mmioWriteDacData(vgap, pdefs->red); - DACDelay(vgap); - mmioWriteDacData(vgap, pdefs->green); - DACDelay(vgap); - mmioWriteDacData(vgap, pdefs->blue); - DACDelay(vgap); - - pdefs++; - } -} - - -KdCardFuncs i810Funcs = { - i810CardInit, /* cardinit */ - i810ScreenInit, /* scrinit */ - i810InitScreen, /* initScreen */ - i810FinishInitScreen, /* finishInitScreen */ - NULL, /* createResources */ - i810Preserve, /* preserve */ - i810Enable, /* enable */ - i810DPMS, /* dpms */ - i810Disable, /* disable */ - i810Restore, /* restore */ - i810ScreenFini, /* scrfini */ - i810CardFini, /* cardfini */ - - i810CursorInit, /* initCursor */ - i810CursorEnable, /* enableCursor */ - i810CursorDisable, /* disableCursor */ - i810CursorFini, /* finiCursor */ - NULL, /* recolorCursor */ - - i810InitAccel, /* initAccel */ - i810EnableAccel, /* enableAccel */ - i810DisableAccel, /* disableAccel */ - i810FiniAccel, /* finiAccel */ - - i810GetColors, /* getColors */ - i810PutColors, /* putColors */ -}; diff --git a/hw/kdrive/i810/i810.h b/hw/kdrive/i810/i810.h deleted file mode 100644 index 8fc2d56be..000000000 --- a/hw/kdrive/i810/i810.h +++ /dev/null @@ -1,511 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/* - * Author: - * Pontus Lidman <pontus.lidman@nokia.com> - */ - -#ifndef _I810_H_ -#define _I810_H_ - -#include "i810_reg.h" - -/* Globals */ - -typedef struct _I810Rec *I810Ptr; - -/* Linear region allocated in framebuffer. - */ -typedef struct { - unsigned long Start; - unsigned long End; - unsigned long Size; -} I810MemRange; - -typedef struct { - int tail_mask; - I810MemRange mem; - unsigned char *virtual_start; - int head; - int tail; - int space; -} I810RingBuffer; - -typedef struct { - unsigned char DisplayControl; - unsigned char PixelPipeCfg0; - unsigned char PixelPipeCfg1; - unsigned char PixelPipeCfg2; - unsigned short VideoClk2_M; - unsigned short VideoClk2_N; - unsigned char VideoClk2_DivisorSel; - unsigned char AddressMapping; - unsigned char IOControl; - unsigned char BitBLTControl; - unsigned char ExtVertTotal; - unsigned char ExtVertDispEnd; - unsigned char ExtVertSyncStart; - unsigned char ExtVertBlankStart; - unsigned char ExtHorizTotal; - unsigned char ExtHorizBlank; - unsigned char ExtOffset; - unsigned char InterlaceControl; - unsigned int LMI_FIFO_Watermark; - - unsigned int LprbTail; - unsigned int LprbHead; - unsigned int LprbStart; - unsigned int LprbLen; - - unsigned int Fence[8]; - - unsigned short OverlayActiveStart; - unsigned short OverlayActiveEnd; - - -} I810RegRec, *I810RegPtr; - -#define minb(p) *(volatile CARD8 *)(i810c->MMIOBase + (p)) -#define moutb(p,v) *(volatile CARD8 *)(i810c->MMIOBase + (p)) = (v) - -#define OUT_RING(n) { \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - ErrorF( "OUT_RING %x: %x\n", outring, n); \ - *(volatile unsigned int *)(virt + outring) = n; \ - outring += 4; \ - outring &= ringmask; \ -} - -#define ADVANCE_LP_RING() { \ - i810c->LpRing.tail = outring; \ - OUTREG(LP_RING + RING_TAIL, outring); \ -} - -#ifdef __GNUC__ -#define LP_RING_MESSAGE(n) \ - ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__) -#else -#define LP_RING_MESSAGE(n) \ - ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__) -#endif - -#define LP_RING_LOCALS \ - unsigned int outring, ringmask; \ - volatile unsigned char *virt - -#define BEGIN_LP_RING(n) \ - if (n>2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ - i810Sync(i810s); \ - if (i810c->LpRing.space < n*4) i810WaitLpRing(i810s, n*4, 0); \ - i810c->LpRing.space -= n*4; \ - if (I810_DEBUG & DEBUG_VERBOSE_RING) \ - LP_RING_MESSAGE(n); \ - outring = i810c->LpRing.tail; \ - ringmask = i810c->LpRing.tail_mask; \ - virt = i810c->LpRing.virtual_start; - -/* Memory mapped register access macros */ -#define INREG8(addr) *(volatile CARD8 *)(i810c->MMIOBase + (addr)) -#define INREG16(addr) *(volatile CARD16 *)(i810c->MMIOBase + (addr)) -#define INREG(addr) *(volatile CARD32 *)(i810c->MMIOBase + (addr)) - -#define OUTREG8(addr, val) do { \ - *(volatile CARD8 *)(i810c->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ - ErrorF( "OUTREG8(%x, %x)\n", addr, val); \ -} while (0) - -#define OUTREG16(addr, val) do { \ - *(volatile CARD16 *)(i810c->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ - ErrorF( "OUTREG16(%x, %x)\n", addr, val); \ -} while (0) - -#define OUTREG(addr, val) do { \ - *(volatile CARD32 *)(i810c->MMIOBase + (addr)) = (val); \ - if (I810_DEBUG&DEBUG_VERBOSE_OUTREG) \ - ErrorF( "OUTREG(%x, %x)\n", addr, val); \ -} while (0) - -/* To remove all debugging, make sure I810_DEBUG is defined as a - * preprocessor symbol, and equal to zero. - */ - -#define I810_DEBUG 0 - -#ifndef I810_DEBUG -#warning "Debugging enabled - expect reduced performance" -extern int I810_DEBUG; -#endif - -#define DEBUG_VERBOSE_ACCEL 0x1 -#define DEBUG_VERBOSE_SYNC 0x2 -#define DEBUG_VERBOSE_VGA 0x4 -#define DEBUG_VERBOSE_RING 0x8 -#define DEBUG_VERBOSE_OUTREG 0x10 -#define DEBUG_VERBOSE_MEMORY 0x20 -#define DEBUG_VERBOSE_CURSOR 0x40 -#define DEBUG_ALWAYS_SYNC 0x80 -#define DEBUG_VERBOSE_DRI 0x100 - - -/* Size of the mmio region. - */ -#define I810_REG_SIZE 0x80000 - -/* PCI identifiers */ -#ifndef PCI_CHIP_I810 -#define PCI_CHIP_I810 0x7121 -#define PCI_CHIP_I810_DC100 0x7123 -#define PCI_CHIP_I810_E 0x7125 -#define PCI_CHIP_I815 0x1132 -#define PCI_CHIP_I810_BRIDGE 0x7120 -#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 -#define PCI_CHIP_I810_E_BRIDGE 0x7124 -#define PCI_CHIP_I815_BRIDGE 0x1130 -#define PCI_CHIP_I845G 0x2562 -#endif - - -#define IS_I810(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I810 || \ - i810c->PciInfo->chipType == PCI_CHIP_I810_DC100 || \ - i810c->PciInfo->chipType == PCI_CHIP_I810_E) -#define IS_I815(i810c) (i810c->PciInfo->chipType == PCI_CHIP_I815) - - -/* default number of VGA registers stored internally */ -#define VGA_NUM_CRTC 25 /* 0x19 */ -#define VGA_NUM_SEQ 5 -#define VGA_NUM_GFX 9 -#define VGA_NUM_ATTR 21 - -/* - * Settings of standard VGA registers. - */ -typedef struct { - unsigned char MiscOutReg; /* */ - unsigned char CRTC[VGA_NUM_CRTC]; /* Crtc Controller */ - unsigned char Sequencer[VGA_NUM_SEQ]; /* Video Sequencer */ - unsigned char Graphics[VGA_NUM_GFX]; /* Video Graphics */ - unsigned char Attribute[VGA_NUM_ATTR]; /* Video Atribute */ - unsigned char DAC[768]; /* Internal Colorlookuptable */ -} vgaRegRec, *vgaRegPtr; - - -typedef struct _i810VGARec *i810VGAPtr; - -/* VGA registers */ -typedef struct _i810VGARec { - int IOBase; /* I/O Base address */ - CARD8 * MMIOBase; /* Pointer to MMIO start */ - vgaRegRec SavedReg; /* saved registers */ - vgaRegRec ModeReg; /* register settings for - current mode */ - Bool ShowOverscan; - Bool paletteEnabled; - Bool cmapSaved; -} i810VGARec; - -typedef struct _i810CardInfo { - int videoRam; - int MaxClock; - long FbMapSize; - int cpp; /* chars per pixel */ - - unsigned long LinearAddr; - unsigned long MMIOAddr; - - unsigned char *MMIOBase; - unsigned char *FbBase; - - Bool GttBound; - Bool agpAcquired2d; - int VramKey; - unsigned long VramOffset; - int DcacheKey; - unsigned long DcacheOffset; - int HwcursKey; - unsigned long HwcursOffset; - - I810MemRange DcacheMem; - I810MemRange SysMem; - - I810MemRange SavedDcacheMem; - I810MemRange SavedSysMem; - - unsigned int bufferOffset; /* for I810SelectBuffer */ - Bool DoneFrontAlloc; - BoxRec FbMemBox; - I810MemRange FrontBuffer; - I810MemRange Scratch; - I810MemRange XvMem; - - int LmFreqSel; - - i810VGARec vga; - - I810RegRec SavedReg; - I810RegRec ModeReg; - I810RingBuffer LpRing; - - unsigned int BR[20]; - - int CursorOffset; - unsigned long CursorPhysical; - unsigned long CursorStart; - unsigned long OverlayPhysical; - unsigned long OverlayStart; - int colorKey; - - int nextColorExpandBuf; - - ScreenBlockHandlerProcPtr BlockHandler; - -#ifdef XV - KdVideoAdaptorPtr adaptor; -#endif - -} i810CardInfo; - -typedef struct _i810CardInfo I810CardInfo; /* compatibility */ - -#define getI810CardInfo(kd) ((I810CardInfo *) ((kd)->card->driver)) -#define i810CardInfo(kd) I810CardInfo *i810c = getI810CardInfo(kd) - -#define getI810ScreenInfo(kd) ((I810ScreenInfo *) ((kd)->screen->driver)) -#define i810ScreenInfo(kd) I810ScreenInfo *i810s = getI810ScreenInfo(kd) - -typedef struct _i810Cursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; -} i810Cursor, *i810CursorPtr; - -typedef struct _i810ScreenInfo { - i810CardInfo *i810c; - i810Cursor cursor; - - int pitch; - KaaScreenInfoRec kaa; -} i810ScreenInfo; - -typedef struct _i810ScreenInfo I810ScreenInfo; /* compatibility */ - -#define I810_CURSOR_HEIGHT 64 -#define I810_CURSOR_WIDTH 64 - -/* init functions (i810.c) */ - -Bool -i810CardInit (KdCardInfo *card); - -Bool -i810ScreenInit (KdScreenInfo *screen); - -/* The cursor functions (i810_cursor.c) */ - -Bool -i810CursorInit(ScreenPtr pScreen); - -void -i810CursorEnable (ScreenPtr pScreen); - -void -i810CursorDisable (ScreenPtr pScreen); - -void -i810CursorFini (ScreenPtr pScreen); - -/* Accel functions (i810draw.c) */ - -Bool -i810InitAccel(ScreenPtr); - -void -i810EnableAccel (ScreenPtr); - -void -i810DisableAccel (ScreenPtr); - -void -i810FiniAccel (ScreenPtr); - -void -i810FillBoxSolid (KdScreenInfo *screen, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask); - - -extern KdCardFuncs i810Funcs; - -/* Standard VGA registers */ - -#define VGA_ATTR_INDEX 0x3C0 -#define VGA_ATTR_DATA_W 0x3C0 -#define VGA_ATTR_DATA_R 0x3C1 -#define VGA_IN_STAT_0 0x3C2 /* read */ -#define VGA_MISC_OUT_W 0x3C2 /* write */ -#define VGA_ENABLE 0x3C3 -#define VGA_SEQ_INDEX 0x3C4 -#define VGA_SEQ_DATA 0x3C5 -#define VGA_DAC_MASK 0x3C6 -#define VGA_DAC_READ_ADDR 0x3C7 -#define VGA_DAC_WRITE_ADDR 0x3C8 -#define VGA_DAC_DATA 0x3C9 -#define VGA_FEATURE_R 0x3CA /* read */ -#define VGA_MISC_OUT_R 0x3CC /* read */ -#define VGA_GRAPH_INDEX 0x3CE -#define VGA_GRAPH_DATA 0x3CF - -#define VGA_IOBASE_MONO 0x3B0 -#define VGA_IOBASE_COLOR 0x3D0 - -#define VGA_CRTC_INDEX_OFFSET 0x04 -#define VGA_CRTC_DATA_OFFSET 0x05 -#define VGA_IN_STAT_1_OFFSET 0x0A /* read */ -#define VGA_FEATURE_W_OFFSET 0x0A /* write */ - -/* VGA stuff */ -#define BIT_PLANE 3 /* Which plane we write to in mono mode */ - -/* DAC indices for white and black */ -#define WHITE_VALUE 0x3F -#define BLACK_VALUE 0x00 -#define OVERSCAN_VALUE 0x01 - -#define OVERSCAN 0x11 /* Index of OverScan register */ - -void -i810VGAUnlock(i810VGAPtr vgap); - -void -i810VGALock(i810VGAPtr vgap); - -Bool -i810VGAInit(KdScreenInfo *scrninfp, const KdMonitorTiming *t); - -void -i810VGABlankScreen(KdCardInfo *card, Bool on); - -void -i810AdjustFrame(KdScreenInfo *screen, int x, int y, int flags); - -Bool -i810VGAMapMem(KdCardInfo *card); - -void -i810VGASave(KdCardInfo *card, vgaRegPtr save, int flags); - -void -i810PrintErrorState(i810CardInfo *i810c); - -void -i810VGAGetIOBase(i810VGAPtr vgap); - -Bool -i810InitVideo(ScreenPtr pScreen); - -/* - * MMIO versions of the register access functions. These require - * hwp->MemBase to be set in such a way that when the standard VGA port - * address is added the correct memory address results. - */ - -#define Vminb(p) ( *(volatile CARD8 *)(vgap->MMIOBase + (p))) -#define Vmoutb(p,v) ( *(volatile CARD8 *)(vgap->MMIOBase + (p)) = (v)) - -#define mmioWriteCrtc(vgap, index, value) { \ - Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index); \ - Vmoutb(vgap->IOBase + VGA_CRTC_DATA_OFFSET, value); \ -} - -#define mmioReadCrtc(vgap, index) ( \ - Vmoutb(vgap->IOBase + VGA_CRTC_INDEX_OFFSET, index), \ - Vminb(vgap->IOBase + VGA_CRTC_DATA_OFFSET) \ -) - -#define mmioWriteGr(vgap, index, value) { \ - Vmoutb(VGA_GRAPH_INDEX, index); \ - Vmoutb(VGA_GRAPH_DATA, value); \ -} - -#define mmioReadGr(vgap, index) ( \ - Vmoutb(VGA_GRAPH_INDEX, index), \ - Vminb(VGA_GRAPH_DATA) \ -) - -#define mmioWriteSeq(vgap, index, value) {\ - Vmoutb(VGA_SEQ_INDEX, index); \ - Vmoutb(VGA_SEQ_DATA, value); \ -} - -#define mmioReadSeq(vgap, index) ( \ - Vmoutb(VGA_SEQ_INDEX, index), \ - Vminb(VGA_SEQ_DATA) \ -) - -#define mmioWriteAttr(vgap, index, value) { \ - (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \ - Vmoutb(VGA_ATTR_INDEX, index); \ - Vmoutb(VGA_ATTR_DATA_W, value); \ -} - -#define mmioReadAttr(vgap, index) ( \ - (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET), \ - Vmoutb(VGA_ATTR_INDEX, index), \ - Vminb(VGA_ATTR_DATA_R) \ -) - -#define mmioWriteMiscOut(vgap, value) Vmoutb(VGA_MISC_OUT_W, value) - - -#define mmioReadMiscOut(vgap) Vminb(VGA_MISC_OUT_R) - -#define mmioEnablePalette(vgap) { \ - (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \ - Vmoutb(VGA_ATTR_INDEX, 0x00); \ - vgap->paletteEnabled = TRUE; \ -} - -#define mmioDisablePalette(vgap) { \ - (void) Vminb(vgap->IOBase + VGA_IN_STAT_1_OFFSET); \ - Vmoutb(VGA_ATTR_INDEX, 0x20); \ - vgap->paletteEnabled = FALSE; \ -} - -#define mmioWriteDacWriteAddr(vgap, value) Vmoutb(VGA_DAC_WRITE_ADDR, value) - -#define mmioWriteDacData(vgap, value) Vmoutb(VGA_DAC_DATA, value) - -#endif /* _I810_H_ */ diff --git a/hw/kdrive/i810/i810_cursor.c b/hw/kdrive/i810/i810_cursor.c deleted file mode 100644 index fcd89deff..000000000 --- a/hw/kdrive/i810/i810_cursor.c +++ /dev/null @@ -1,436 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ - -/* i810_cursor.c: KDrive hardware cursor routines for the i810 chipset */ - -/* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - * Pontus Lidman <pontus.lidman@nokia.com> - * - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kxv.h" -#include "i810.h" -#include "cursorstr.h" -#include "inputstr.h" - -#define SetupCursor(s) KdScreenPriv(pScreen); \ - i810CardInfo(pScreenPriv); \ - i810ScreenInfo(pScreenPriv); \ - i810Cursor *pCurPriv = &i810s->cursor - - -static void -writeStandardMMIO(I810CardInfo *i810c, int addr, CARD8 val) -{ - moutb(addr, val); -} - -static void -_i810MoveCursor(ScreenPtr pScreen, int x, int y) -{ - KdScreenPriv(pScreen); - i810CardInfo(pScreenPriv); - int flag; - - if (I810_DEBUG & DEBUG_VERBOSE_CURSOR) - ErrorF( "I810SetCursorPosition %d %d\n", x, y); - - x += i810c->CursorOffset; - - if (x >= 0) flag = CURSOR_X_POS; - else { - flag = CURSOR_X_NEG; - x=-x; - } - - OUTREG8( CURSOR_X_LO, x&0xFF); - OUTREG8( CURSOR_X_HI, (((x >> 8) & 0x07) | flag)); - - if (y >= 0) flag = CURSOR_Y_POS; - else { - flag = CURSOR_Y_NEG; - y=-y; - } - OUTREG8( CURSOR_Y_LO, y&0xFF); - OUTREG8( CURSOR_Y_HI, (((y >> 8) & 0x07) | flag)); - - /* Enable cursor */ - OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical); - OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); - -} - -static void i810LoadCursor(ScreenPtr pScreen, int x, int y); - -static void -i810MoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _i810MoveCursor (pScreen, x, y); - - i810LoadCursor(pScreen, x, y); -} - -static void -_i810SetCursorColors(ScreenPtr pScreen) -{ - - KdScreenPriv(pScreen); - i810CardInfo(pScreenPriv); - int tmp; - - int bg = 0xffffff; - int fg = 0x000000; - - tmp=INREG8(PIXPIPE_CONFIG_0); - tmp |= EXTENDED_PALETTE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); - - writeStandardMMIO(i810c, DACMASK, 0xFF); - writeStandardMMIO(i810c, DACWX, 0x04); - - writeStandardMMIO(i810c, DACDATA, (bg & 0x00FF0000) >> 16); - writeStandardMMIO(i810c, DACDATA, (bg & 0x0000FF00) >> 8); - writeStandardMMIO(i810c, DACDATA, (bg & 0x000000FF)); - - writeStandardMMIO(i810c, DACDATA, (fg & 0x00FF0000) >> 16); - writeStandardMMIO(i810c, DACDATA, (fg & 0x0000FF00) >> 8); - writeStandardMMIO(i810c, DACDATA, (fg & 0x000000FF)); - - tmp=INREG8( PIXPIPE_CONFIG_0 ); - tmp &= ~EXTENDED_PALETTE; - OUTREG8( PIXPIPE_CONFIG_0, tmp ); -} - -#define InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -static void i810LoadCursor(ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - - int h; - unsigned int *msk, *mskLine, *src, *srcLine; - - int i, j; - int src_stride, src_width; - - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - CARD8 tmp; - unsigned int *ram, *ramLine; - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - ramLine = (unsigned int *) (i810c->FbBase + i810c->CursorStart); - mskLine = (unsigned int *) (bits->mask); - srcLine = (unsigned int *) (bits->source); - - h = bits->height; - if (h > I810_CURSOR_HEIGHT) - h = I810_CURSOR_HEIGHT; - - src_stride = BitmapBytePad(bits->width); /* bytes per line */ - src_stride = (src_stride +3) >> 2; - src_width = (bits->width + 31) >> 5; - - for (i = 0; i < I810_CURSOR_HEIGHT; i++) { - - msk = mskLine; - src = srcLine; - ram = ramLine; - mskLine += src_stride; - srcLine += src_stride; - ramLine += I810_CURSOR_WIDTH / 16; - - for (j = 0; j < I810_CURSOR_WIDTH / 32; j++) { - - unsigned long m, s; - - if (i < h && j < src_width) - { - m = *msk++; - s = *src++ & m; - m = ~m; - /* mask off right side */ - if (j == src_width - 1 && (bits->width & 31)) - { - m |= 0xffffffff << (bits->width & 31); - } - } - else - { - m = 0xffffffff; - s = 0x00000000; - } - - InvertBits32(s); - InvertBits32(m); - - ram[2+j]=s; - ram[0+j]=m; - } - } - /* Set new color */ - _i810SetCursorColors (pScreen); - - /* Move to new position */ - _i810MoveCursor (pScreen, x, y); - - /* Enable cursor */ - OUTREG( CURSOR_BASEADDR, i810c->CursorPhysical); - OUTREG8( CURSOR_CONTROL, CURSOR_ORIGIN_DISPLAY | CURSOR_MODE_64_3C); - - tmp = INREG8( PIXPIPE_CONFIG_0 ); - tmp |= HW_CURSOR_ENABLE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); -} - -static void -i810UnloadCursor(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810CardInfo(pScreenPriv); - - unsigned char tmp; - - tmp=INREG8( PIXPIPE_CONFIG_0 ); - tmp &= ~HW_CURSOR_ENABLE; - OUTREG8( PIXPIPE_CONFIG_0, tmp); -} - - -static Bool -i810RealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerGetPosition (pDev, &x, &y); - i810LoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -i810UnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -i810SetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - i810LoadCursor (pScreen, x, y); - else - i810UnloadCursor (pScreen); -} - -miPointerSpriteFuncRec i810PointerSpriteFuncs = { - i810RealizeCursor, - i810UnrealizeCursor, - i810SetCursor, - i810MoveCursor, -}; - -static void -i810QueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -i810CursorInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810CardInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - if (!i810c->CursorStart) { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = I810_CURSOR_WIDTH; - pCurPriv->height= I810_CURSOR_HEIGHT; - pScreen->QueryBestSize = i810QueryBestSize; - miPointerInitialize (pScreen, - &i810PointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -i810CursorEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - i810LoadCursor (pScreen, x, y); - } - else - i810UnloadCursor (pScreen); - } -} - -void -i810CursorDisable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - i810UnloadCursor (pScreen); - } - } -} - -void -i810CursorFini (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810Cursor *pCurPriv = &i810s->cursor; - - pCurPriv->pCursor = NULL; -} - diff --git a/hw/kdrive/i810/i810_reg.h b/hw/kdrive/i810/i810_reg.h deleted file mode 100644 index d9f4c8f48..000000000 --- a/hw/kdrive/i810/i810_reg.h +++ /dev/null @@ -1,695 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, 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 NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ - -/* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - * Pontus Lidman <pontus.lidman@nokia.com> - * - * based on the i740 driver by - * Kevin E. Martin <kevin@precisioninsight.com> - * - * - */ - -/* I/O register offsets - */ -#define SRX 0x3C4 /* p208 */ -#define GRX 0x3CE /* p213 */ -#define ARX 0x3C0 /* p224 */ - -/* VGA Color Palette Registers */ -#define DACMASK 0x3C6 /* p232 */ -#define DACSTATE 0x3C7 /* p232 */ -#define DACRX 0x3C7 /* p233 */ -#define DACWX 0x3C8 /* p233 */ -#define DACDATA 0x3C9 /* p233 */ - -/* CRT Controller Registers (CRX) */ -#define START_ADDR_HI 0x0C /* p246 */ -#define START_ADDR_LO 0x0D /* p247 */ -#define VERT_SYNC_END 0x11 /* p249 */ -#define EXT_VERT_TOTAL 0x30 /* p257 */ -#define EXT_VERT_DISPLAY 0x31 /* p258 */ -#define EXT_VERT_SYNC_START 0x32 /* p259 */ -#define EXT_VERT_BLANK_START 0x33 /* p260 */ -#define EXT_HORIZ_TOTAL 0x35 /* p261 */ -#define EXT_HORIZ_BLANK 0x39 /* p261 */ -#define EXT_START_ADDR 0x40 /* p262 */ -#define EXT_START_ADDR_ENABLE 0x80 -#define EXT_OFFSET 0x41 /* p263 */ -#define EXT_START_ADDR_HI 0x42 /* p263 */ -#define INTERLACE_CNTL 0x70 /* p264 */ -#define INTERLACE_ENABLE 0x80 -#define INTERLACE_DISABLE 0x00 - -/* Miscellaneous Output Register - */ -#define MSR_R 0x3CC /* p207 */ -#define MSR_W 0x3C2 /* p207 */ -#define IO_ADDR_SELECT 0x01 - -#define MDA_BASE 0x3B0 /* p207 */ -#define CGA_BASE 0x3D0 /* p207 */ - -/* CR80 - IO Control, p264 - */ -#define IO_CTNL 0x80 -#define EXTENDED_ATTR_CNTL 0x02 -#define EXTENDED_CRTC_CNTL 0x01 - -/* GR10 - Address mapping, p221 - */ -#define ADDRESS_MAPPING 0x10 -#define PAGE_TO_LOCAL_MEM_ENABLE 0x10 -#define GTT_MEM_MAP_ENABLE 0x08 -#define PACKED_MODE_ENABLE 0x04 -#define LINEAR_MODE_ENABLE 0x02 -#define PAGE_MAPPING_ENABLE 0x01 - -/* Blitter control, p378 - */ -#define BITBLT_CNTL 0x7000c -#define COLEXP_MODE 0x30 -#define COLEXP_8BPP 0x00 -#define COLEXP_16BPP 0x10 -#define COLEXP_24BPP 0x20 -#define COLEXP_RESERVED 0x30 -#define BITBLT_STATUS 0x01 - -/* p375. - */ -#define DISPLAY_CNTL 0x70008 -#define VGA_WRAP_MODE 0x02 -#define VGA_WRAP_AT_256KB 0x00 -#define VGA_NO_WRAP 0x02 -#define GUI_MODE 0x01 -#define STANDARD_VGA_MODE 0x00 -#define HIRES_MODE 0x01 - -/* p375 - */ -#define PIXPIPE_CONFIG_0 0x70009 -#define DAC_8_BIT 0x80 -#define DAC_6_BIT 0x00 -#define HW_CURSOR_ENABLE 0x10 -#define EXTENDED_PALETTE 0x01 - -/* p375 - */ -#define PIXPIPE_CONFIG_1 0x7000a -#define DISPLAY_COLOR_MODE 0x0F -#define DISPLAY_VGA_MODE 0x00 -#define DISPLAY_8BPP_MODE 0x02 -#define DISPLAY_15BPP_MODE 0x04 -#define DISPLAY_16BPP_MODE 0x05 -#define DISPLAY_24BPP_MODE 0x06 -#define DISPLAY_32BPP_MODE 0x07 - -/* p375 - */ -#define PIXPIPE_CONFIG_2 0x7000b -#define DISPLAY_GAMMA_ENABLE 0x08 -#define DISPLAY_GAMMA_DISABLE 0x00 -#define OVERLAY_GAMMA_ENABLE 0x04 -#define OVERLAY_GAMMA_DISABLE 0x00 - - -/* p380 - */ -#define DISPLAY_BASE 0x70020 -#define DISPLAY_BASE_MASK 0x03fffffc - - -/* Cursor control registers, pp383-384 - */ -#define CURSOR_CONTROL 0x70080 -#define CURSOR_ORIGIN_SCREEN 0x00 -#define CURSOR_ORIGIN_DISPLAY 0x10 -#define CURSOR_MODE 0x07 -#define CURSOR_MODE_DISABLE 0x00 -#define CURSOR_MODE_32_4C_AX 0x01 -#define CURSOR_MODE_64_3C 0x04 -#define CURSOR_MODE_64_4C_AX 0x05 -#define CURSOR_MODE_64_4C 0x06 -#define CURSOR_MODE_RESERVED 0x07 -#define CURSOR_BASEADDR 0x70084 -#define CURSOR_BASEADDR_MASK 0x1FFFFF00 -#define CURSOR_X_LO 0x70088 -#define CURSOR_X_HI 0x70089 -#define CURSOR_X_POS 0x00 -#define CURSOR_X_NEG 0x80 -#define CURSOR_Y_LO 0x7008A -#define CURSOR_Y_HI 0x7008B -#define CURSOR_Y_POS 0x00 -#define CURSOR_Y_NEG 0x80 - - - -/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm - * not sure they refer to local (graphics) memory. - * - * These details are for the local memory control registers, - * (pp301-310). The test machines are not equiped with local memory, - * so nothing is tested. Only a single row seems to be supported. - */ -#define DRAM_ROW_TYPE 0x3000 -#define DRAM_ROW_0 0x01 -#define DRAM_ROW_0_SDRAM 0x01 -#define DRAM_ROW_0_EMPTY 0x00 -#define DRAM_ROW_CNTL_LO 0x3001 -#define DRAM_PAGE_MODE_CTRL 0x10 -#define DRAM_RAS_TO_CAS_OVRIDE 0x08 -#define DRAM_CAS_LATENCY 0x04 -#define DRAM_RAS_TIMING 0x02 -#define DRAM_RAS_PRECHARGE 0x01 -#define DRAM_ROW_CNTL_HI 0x3002 -#define DRAM_REFRESH_RATE 0x18 -#define DRAM_REFRESH_DISABLE 0x00 -#define DRAM_REFRESH_60HZ 0x08 -#define DRAM_REFRESH_FAST_TEST 0x10 -#define DRAM_REFRESH_RESERVED 0x18 -#define DRAM_SMS 0x07 -#define DRAM_SMS_NORMAL 0x00 -#define DRAM_SMS_NOP_ENABLE 0x01 -#define DRAM_SMS_ABPCE 0x02 -#define DRAM_SMS_MRCE 0x03 -#define DRAM_SMS_CBRCE 0x04 - -/* p307 - */ -#define DPMS_SYNC_SELECT 0x5002 -#define VSYNC_CNTL 0x08 -#define VSYNC_ON 0x00 -#define VSYNC_OFF 0x08 -#define HSYNC_CNTL 0x02 -#define HSYNC_ON 0x00 -#define HSYNC_OFF 0x02 - - - -/* p317, 319 - */ -#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */ -#define VCLK2_VCO_N 0x600a -#define VCLK2_VCO_DIV_SEL 0x6012 -#define POST_DIV_SELECT 0x70 -#define POST_DIV_1 0x00 -#define POST_DIV_2 0x10 -#define POST_DIV_4 0x20 -#define POST_DIV_8 0x30 -#define POST_DIV_16 0x40 -#define POST_DIV_32 0x50 -#define VCO_LOOP_DIV_BY_4M 0x00 -#define VCO_LOOP_DIV_BY_16M 0x04 - - -/* Instruction Parser Mode Register - * - p281 - * - 2 new bits. - */ -#define INST_PM 0x20c0 -#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */ -#define SYNC_PACKET_FLUSH_ENABLE 0x10 -#define TWO_D_INST_DISABLE 0x08 -#define THREE_D_INST_DISABLE 0x04 -#define STATE_VAR_UPDATE_DISABLE 0x02 -#define PAL_STIP_DISABLE 0x01 - -#define INST_DONE 0x2090 -#define INST_PS 0x20c4 - -#define MEMMODE 0x20dc - - -/* Instruction parser error register. p279 - */ -#define IPEIR 0x2088 -#define IPEHR 0x208C - - -/* General error reporting regs, p296 - */ -#define EIR 0x20B0 -#define EMR 0x20B4 -#define ESR 0x20B8 -#define IP_ERR 0x0001 -#define ERROR_RESERVED 0xffc6 - - -/* Interrupt Control Registers - * - new bits for i810 - * - new register hwstam (mask) - */ -#define HWSTAM 0x2098 /* p290 */ -#define IER 0x20a0 /* p291 */ -#define IIR 0x20a4 /* p292 */ -#define IMR 0x20a8 /* p293 */ -#define ISR 0x20ac /* p294 */ -#define HW_ERROR 0x8000 -#define SYNC_STATUS_TOGGLE 0x1000 -#define DPY_0_FLIP_PENDING 0x0800 -#define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */ -#define OVL_0_FLIP_PENDING 0x0200 -#define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */ -#define DPY_0_VBLANK 0x0080 -#define DPY_0_EVENT 0x0040 -#define DPY_1_VBLANK 0x0020 /* not implemented on i810 */ -#define DPY_1_EVENT 0x0010 /* not implemented on i810 */ -#define HOST_PORT_EVENT 0x0008 /* */ -#define CAPTURE_EVENT 0x0004 /* */ -#define USER_DEFINED 0x0002 -#define BREAKPOINT 0x0001 - - -#define INTR_RESERVED (0x6000 | \ - DPY_1_FLIP_PENDING | \ - OVL_1_FLIP_PENDING | \ - DPY_1_VBLANK | \ - DPY_1_EVENT | \ - HOST_PORT_EVENT | \ - CAPTURE_EVENT ) - -/* FIFO Watermark and Burst Length Control Register - * - * - different offset and contents on i810 (p299) (fewer bits per field) - * - some overlay fields added - * - what does it all mean? - */ -#define FWATER_BLC 0x20d8 -#define MM_BURST_LENGTH 0x00700000 -#define MM_FIFO_WATERMARK 0x0001F000 -#define LM_BURST_LENGTH 0x00000700 -#define LM_FIFO_WATERMARK 0x0000001F - - -/* Fence/Tiling ranges [0..7] - */ -#define FENCE 0x2000 -#define FENCE_NR 8 - -#define FENCE_START_MASK 0x03F80000 -#define FENCE_X_MAJOR 0x00000000 -#define FENCE_Y_MAJOR 0x00001000 -#define FENCE_SIZE_MASK 0x00000700 -#define FENCE_SIZE_512K 0x00000000 -#define FENCE_SIZE_1M 0x00000100 -#define FENCE_SIZE_2M 0x00000200 -#define FENCE_SIZE_4M 0x00000300 -#define FENCE_SIZE_8M 0x00000400 -#define FENCE_SIZE_16M 0x00000500 -#define FENCE_SIZE_32M 0x00000600 -#define FENCE_PITCH_MASK 0x00000070 -#define FENCE_PITCH_1 0x00000000 -#define FENCE_PITCH_2 0x00000010 -#define FENCE_PITCH_4 0x00000020 -#define FENCE_PITCH_8 0x00000030 -#define FENCE_PITCH_16 0x00000040 -#define FENCE_PITCH_32 0x00000050 -#define FENCE_VALID 0x00000001 - - -/* Registers to control page table, p274 - */ -#define PGETBL_CTL 0x2020 -#define PGETBL_ADDR_MASK 0xFFFFF000 -#define PGETBL_ENABLE_MASK 0x00000001 -#define PGETBL_ENABLED 0x00000001 - -/* Register containing pge table error results, p276 - */ -#define PGE_ERR 0x2024 -#define PGE_ERR_ADDR_MASK 0xFFFFF000 -#define PGE_ERR_ID_MASK 0x00000038 -#define PGE_ERR_CAPTURE 0x00000000 -#define PGE_ERR_OVERLAY 0x00000008 -#define PGE_ERR_DISPLAY 0x00000010 -#define PGE_ERR_HOST 0x00000018 -#define PGE_ERR_RENDER 0x00000020 -#define PGE_ERR_BLITTER 0x00000028 -#define PGE_ERR_MAPPING 0x00000030 -#define PGE_ERR_CMD_PARSER 0x00000038 -#define PGE_ERR_TYPE_MASK 0x00000007 -#define PGE_ERR_INV_TABLE 0x00000000 -#define PGE_ERR_INV_PTE 0x00000001 -#define PGE_ERR_MIXED_TYPES 0x00000002 -#define PGE_ERR_PAGE_MISS 0x00000003 -#define PGE_ERR_ILLEGAL_TRX 0x00000004 -#define PGE_ERR_LOCAL_MEM 0x00000005 -#define PGE_ERR_TILED 0x00000006 - - - -/* Page table entries loaded via mmio region, p323 - */ -#define PTE_BASE 0x10000 -#define PTE_ADDR_MASK 0x3FFFF000 -#define PTE_TYPE_MASK 0x00000006 -#define PTE_LOCAL 0x00000002 -#define PTE_MAIN_UNCACHED 0x00000000 -#define PTE_MAIN_CACHED 0x00000006 -#define PTE_VALID_MASK 0x00000001 -#define PTE_VALID 0x00000001 - - -/* Ring buffer registers, p277, overview p19 - */ -#define LP_RING 0x2030 -#define HP_RING 0x2040 - -#define RING_TAIL 0x00 -#define TAIL_ADDR 0x000FFFF8 - -#define RING_HEAD 0x04 -#define HEAD_WRAP_COUNT 0xFFE00000 -#define HEAD_WRAP_ONE 0x00200000 -#define HEAD_ADDR 0x001FFFFC - -#define RING_START 0x08 -#define START_ADDR 0x00FFFFF8 - -#define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 -#define RING_REPORT_MASK 0x00000006 -#define RING_REPORT_64K 0x00000002 -#define RING_REPORT_128K 0x00000004 -#define RING_NO_REPORT 0x00000000 -#define RING_VALID_MASK 0x00000001 -#define RING_VALID 0x00000001 -#define RING_INVALID 0x00000000 - - - -/* BitBlt Instructions - * - * There are many more masks & ranges yet to add. - */ -#define BR00_BITBLT_CLIENT 0x40000000 -#define BR00_OP_COLOR_BLT 0x10000000 -#define BR00_OP_SRC_COPY_BLT 0x10C00000 -#define BR00_OP_FULL_BLT 0x11400000 -#define BR00_OP_MONO_SRC_BLT 0x11800000 -#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000 -#define BR00_OP_MONO_PAT_BLT 0x11C00000 -#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22) -#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000 - - -#define BR00_TPCY_DISABLE 0x00000000 -#define BR00_TPCY_ENABLE 0x00000010 - -#define BR00_TPCY_ROP 0x00000000 -#define BR00_TPCY_NO_ROP 0x00000020 -#define BR00_TPCY_EQ 0x00000000 -#define BR00_TPCY_NOT_EQ 0x00000040 - -#define BR00_PAT_MSB_FIRST 0x00000000 /* ? */ - -#define BR00_PAT_VERT_ALIGN 0x000000e0 - -#define BR00_LENGTH 0x0000000F - -#define BR09_DEST_ADDR 0x03FFFFFF - -#define BR11_SOURCE_PITCH 0x00003FFF - -#define BR12_SOURCE_ADDR 0x03FFFFFF - -#define BR13_SOLID_PATTERN 0x80000000 -#define BR13_RIGHT_TO_LEFT 0x40000000 -#define BR13_LEFT_TO_RIGHT 0x00000000 -#define BR13_MONO_TRANSPCY 0x20000000 -#define BR13_USE_DYN_DEPTH 0x04000000 -#define BR13_DYN_8BPP 0x00000000 -#define BR13_DYN_16BPP 0x01000000 -#define BR13_DYN_24BPP 0x02000000 -#define BR13_ROP_MASK 0x00FF0000 -#define BR13_DEST_PITCH 0x0000FFFF -#define BR13_PITCH_SIGN_BIT 0x00008000 - -#define BR14_DEST_HEIGHT 0xFFFF0000 -#define BR14_DEST_WIDTH 0x0000FFFF - -#define BR15_PATTERN_ADDR 0x03FFFFFF - -#define BR16_SOLID_PAT_COLOR 0x00FFFFFF -#define BR16_BACKGND_PAT_CLR 0x00FFFFFF - -#define BR17_FGND_PAT_CLR 0x00FFFFFF - -#define BR18_SRC_BGND_CLR 0x00FFFFFF -#define BR19_SRC_FGND_CLR 0x00FFFFFF - - -/* Instruction parser instructions - */ - -#define INST_PARSER_CLIENT 0x00000000 -#define INST_OP_FLUSH 0x02000000 -#define INST_FLUSH_MAP_CACHE 0x00000001 - -#define INST_DEST_BUFFER_INFO 0x06800000 - -#define INST_FRONT_BUFFER_INFO 0x06000000 -#define FRONT_INFO_ASYNC_FLIP 1<<6 -#define FRONT_INFO_PITCH_B 8 - -#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) - - -/* Registers in the i810 host-pci bridge pci config space which affect - * the i810 graphics operations. - */ -#define SMRAM_MISCC 0x70 -#define GMS 0x000000c0 -#define GMS_DISABLE 0x00000000 -#define GMS_ENABLE_BARE 0x00000040 -#define GMS_ENABLE_512K 0x00000080 -#define GMS_ENABLE_1M 0x000000c0 -#define USMM 0x00000030 -#define USMM_DISABLE 0x00000000 -#define USMM_TSEG_ZERO 0x00000010 -#define USMM_TSEG_512K 0x00000020 -#define USMM_TSEG_1M 0x00000030 -#define GFX_MEM_WIN_SIZE 0x00010000 -#define GFX_MEM_WIN_32M 0x00010000 -#define GFX_MEM_WIN_64M 0x00000000 - -/* Overkill? I don't know. Need to figure out top of mem to make the - * SMRAM calculations come out. Linux seems to have problems - * detecting it all on its own, so this seems a reasonable double - * check to any user supplied 'mem=...' boot param. - * - * ... unfortunately this reg doesn't work according to spec on the - * test hardware. - */ -#define WHTCFG_PAMR_DRP 0x50 -#define SYS_DRAM_ROW_0_SHIFT 16 -#define SYS_DRAM_ROW_1_SHIFT 20 -#define DRAM_MASK 0x0f -#define DRAM_VALUE_0 0 -#define DRAM_VALUE_1 8 -/* No 2 value defined */ -#define DRAM_VALUE_3 16 -#define DRAM_VALUE_4 16 -#define DRAM_VALUE_5 24 -#define DRAM_VALUE_6 32 -#define DRAM_VALUE_7 32 -#define DRAM_VALUE_8 48 -#define DRAM_VALUE_9 64 -#define DRAM_VALUE_A 64 -#define DRAM_VALUE_B 96 -#define DRAM_VALUE_C 128 -#define DRAM_VALUE_D 128 -#define DRAM_VALUE_E 192 -#define DRAM_VALUE_F 256 /* nice one, geezer */ -#define LM_FREQ_MASK 0x10 -#define LM_FREQ_133 0x10 -#define LM_FREQ_100 0x00 - - - - -/* These are 3d state registers, but the state is invarient, so we let - * the X server handle it: - */ - - - -/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135 - */ -#define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1) -#define CC1_UPDATE_KILL_WRITE (1<<28) -#define CC1_ENABLE_KILL_WRITE (1<<27) -#define CC1_DISABLE_KILL_WRITE 0 -#define CC1_UPDATE_COLOR_IDX (1<<26) -#define CC1_UPDATE_CHROMA_LOW (1<<25) -#define CC1_UPDATE_CHROMA_HI (1<<24) -#define CC1_CHROMA_LOW_MASK ((1<<24)-1) -#define CC2_COLOR_IDX_SHIFT 24 -#define CC2_COLOR_IDX_MASK (0xff<<24) -#define CC2_CHROMA_HI_MASK ((1<<24)-1) - - -#define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23)) -#define CS_UPDATE_LOAD (1<<17) -#define CS_UPDATE_USE (1<<16) -#define CS_UPDATE_LOAD (1<<17) -#define CS_LOAD_CTX0 0 -#define CS_LOAD_CTX1 (1<<8) -#define CS_USE_CTX0 0 -#define CS_USE_CTX1 (1<<0) - -/* 3D Rendering Engine */ - -#define RENDER_CLIENT 0x60000000 - -/* Primitive rendering instruction */ - -#define GFX_PRIMITIVE 0x1f000000 -#define PRIMITIVE_TRIANGLE 0 << 18 -#define PRIMITIVE_TRI_STRIP 1 << 18 -#define PRIMITIVE_TRI_REV_STRIP 2 << 18 -#define PRIMITIVE_TRI_FAN 3 << 18 -#define PRIMITIVE_POLYGON 4 << 18 -#define PRIMITIVE_LINE 5 << 18 -#define PRIMITIVE_LINE_STRIP 6 << 18 -#define PRIMITIVE_RECTANGLE 7 << 18 - -/* Vertex format instruction */ -#define GFX_VERTEX_FORMAT 0x05000000 -#define VERTEX_0_TEXCOORDS 0 << 8 -#define VERTEX_1_TEXCOORDS 1 << 8 -#define VERTEX_2_TEXCOORDS 2 << 8 -#define VERTEX_SPECULAR_FOG 1 << 7 -#define VERTEX_DIFFUSE_ALPHA 1 << 6 -#define VERTEX_Z_OFFSET 1 << 5 -#define VERTEX_POS_XYZ 1 << 1 -#define VERTEX_POS_XYZ_RHW 2 << 1 -#define VERTEX_POS_XY 3 << 1 -#define VERTEX_POS_XY_RHW 4 << 1 - -/* Drawing Rectangle Info instruction */ - -#define GFX_DRAWING_RECTANGLE_INFO 0x1d800003 -#define GFX_DRAWING_CLIP_DISABLE 1<<31 - -/* Boolean enable 1 */ -#define GFX_BOOLEAN_ENA_1 0x03000000 -#define BOOL1_ALPHA_SETUP_MASK 1<<17 -#define BOOL1_ALPHA_SETUP_BIT 1<<16 -#define BOOL1_FOG_ENABLE_MASK 1<<7 -#define BOOL1_FOG_ENABLE_BIT 1<<6 -#define BOOL1_ALPHA_TEST_MASK 1<<5 -#define BOOL1_ALPHA_TEST_BIT 1<<4 -#define BOOL1_BLEND_ENABLE_MASK 1<<3 -#define BOOL1_BLEND_ENABLE_BIT 1<<2 -#define BOOL1_Z_ENABLE_MASK 1<<1 -#define BOOL1_Z_ENABLE_BIT 1<<0 - -/* Boolean enable 2 */ -#define GFX_BOOLEAN_ENA_2 0x04000000 -#define BOOL2_MAPPING_CACHE_MASK 1<<17 -#define BOOL2_MAPPING_CACHE_BIT 1<<16 -#define BOOL2_ALPHA_DITHER_MASK 1<<15 -#define BOOL2_ALPHA_DITHER_BIT 1<<14 -#define BOOL2_FOG_DITHER_MASK 1<<13 -#define BOOL2_FOG_DITHER_BIT 1<<12 -#define BOOL2_SPECULAR_DITHER_MASK 1<<11 -#define BOOL2_SPECULAR_DITHER_BIT 1<<10 -#define BOOL2_COLOR_DITHER_MASK 1<<9 -#define BOOL2_COLOR_DITHER_BIT 1<<8 -#define BOOL2_FB_WRITE_MASK 1<<3 -#define BOOL2_FB_WRITE_BIT 1<<2 -#define BOOL2_Z_WRITE_MASK 1<<1 -#define BOOL2_Z_WRITE_BIT 1<<0 - -/* Dest buffer variables */ - -#define GFX_DEST_BUFFER_VARIABLES 0x1d850000 - -#define DEST_BUF_VAR_8BIT 0 << 8 -#define DEST_BUF_VAR_555 1 << 8 -#define DEST_BUF_VAR_565 2 << 8 - -/* map color blend stages */ - -#define GFX_MAP_COLOR_BLEND_STAGES 0 - -#define MAP_BLEND_STAGE_B 20 -#define MAP_BLEND_ACC_SEL_MASK 1<<19 -#define MAP_BLEND_ACC_SEL_BIT 1<<18 -#define MAP_BLEND_ARG1_MASK 1<<17 -#define MAP_BLEND_ARG1_B 14 -#define MAP_BLEND_REPLICATE_ARG1 1<<13 -#define MAP_BLEND_INVERT_ARG1 1<<12 - -#define MAP_BLEND_ARG2_MASK 1<<11 -#define MAP_BLEND_ARG2_B 8 -#define MAP_BLEND_REPLICATE_ARG2 1<<7 -#define MAP_BLEND_INVERT_ARG2 1<<6 - -#define MAP_BLEND_COLOR_OP_MASK 1<<5 -#define MAP_BLEND_COLOR_OP_B 0 - -#define GFX_SCISSOR_ENABLE 0x1c800000 - -#define SCISSOR_ENABLE_MASK 1<<1 -#define SCISSOR_ENABLE_BIT 1<<0 diff --git a/hw/kdrive/i810/i810_video.c b/hw/kdrive/i810/i810_video.c deleted file mode 100644 index ac881d51d..000000000 --- a/hw/kdrive/i810/i810_video.c +++ /dev/null @@ -1,1136 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/*************************************************************************** - -Copyright 2000 Intel Corporation. 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, sub license, 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 NON-INFRINGEMENT. -IN NO EVENT SHALL INTEL, AND/OR ITS SUPPLIERS 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. - -**************************************************************************/ - - -/* - * i810_video.c: i810 KDrive Xv driver. - * Based on the XFree86 i810 Xv driver by Jonathan Bian. - * - * Authors: - * Jonathan Bian <jonathan.bian@intel.com> - * Pontus Lidman <pontus.lidman@nokia.com> - * - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kxv.h" -#include "i810.h" - -#include <X11/extensions/Xv.h> - -#include "fourcc.h" - -typedef struct { - CARD32 size; - CARD32 offset; -} FBLinearRec, *FBLinearPtr; - -#define OFF_DELAY 250 /* milliseconds */ -#define FREE_DELAY 15000 - -#define OFF_TIMER 0x01 -#define FREE_TIMER 0x02 -#define CLIENT_VIDEO_ON 0x04 - -#define TIMER_MASK (OFF_TIMER | FREE_TIMER) - -static KdVideoAdaptorPtr i810SetupImageVideo(ScreenPtr); -static void i810StopVideo(KdScreenInfo *, pointer, Bool); -static int i810SetPortAttribute(KdScreenInfo *, Atom, int, pointer); -static int i810GetPortAttribute(KdScreenInfo *, Atom, int *, pointer); -static void i810QueryBestSize(KdScreenInfo *, Bool, - short, short, short, short, unsigned int *, unsigned int *, pointer); -static int i810PutImage( KdScreenInfo *, DrawablePtr, - short, short, short, short, short, short, short, short, - int, unsigned char*, short, short, Bool, RegionPtr, pointer); -static int i810QueryImageAttributes(KdScreenInfo *, - int, unsigned short *, unsigned short *, int *, int *); - -static void i810BlockHandler(int, pointer, pointer, pointer); - -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -static Atom xvBrightness, xvContrast, xvColorKey; - -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 -#define Y_BUF_SIZE (IMAGE_MAX_WIDTH * IMAGE_MAX_HEIGHT) - -#define OVERLAY_UPDATE(p) OUTREG(0x30000, p | 0x80000000); - -/* - * OV0CMD - Overlay Command Register - */ -#define VERTICAL_CHROMINANCE_FILTER 0x70000000 -#define VC_SCALING_OFF 0x00000000 -#define VC_LINE_REPLICATION 0x10000000 -#define VC_UP_INTERPOLATION 0x20000000 -#define VC_PIXEL_DROPPING 0x50000000 -#define VC_DOWN_INTERPOLATION 0x60000000 -#define VERTICAL_LUMINANCE_FILTER 0x0E000000 -#define VL_SCALING_OFF 0x00000000 -#define VL_LINE_REPLICATION 0x02000000 -#define VL_UP_INTERPOLATION 0x04000000 -#define VL_PIXEL_DROPPING 0x0A000000 -#define VL_DOWN_INTERPOLATION 0x0C000000 -#define HORIZONTAL_CHROMINANCE_FILTER 0x01C00000 -#define HC_SCALING_OFF 0x00000000 -#define HC_LINE_REPLICATION 0x00400000 -#define HC_UP_INTERPOLATION 0x00800000 -#define HC_PIXEL_DROPPING 0x01400000 -#define HC_DOWN_INTERPOLATION 0x01800000 -#define HORIZONTAL_LUMINANCE_FILTER 0x00380000 -#define HL_SCALING_OFF 0x00000000 -#define HL_LINE_REPLICATION 0x00080000 -#define HL_UP_INTERPOLATION 0x00100000 -#define HL_PIXEL_DROPPING 0x00280000 -#define HL_DOWN_INTERPOLATION 0x00300000 - -#define Y_ADJUST 0x00010000 -#define OV_BYTE_ORDER 0x0000C000 -#define UV_SWAP 0x00004000 -#define Y_SWAP 0x00008000 -#define Y_AND_UV_SWAP 0x0000C000 -#define SOURCE_FORMAT 0x00003C00 -#define RGB_555 0x00000800 -#define RGB_565 0x00000C00 -#define YUV_422 0x00002000 -#define YUV_411 0x00002400 -#define YUV_420 0x00003000 -#define YUV_410 0x00003800 -#define BUFFER_AND_FIELD 0x00000006 -#define BUFFER0_FIELD0 0x00000000 -#define BUFFER1_FIELD0 0x00000004 -#define OVERLAY_ENABLE 0x00000001 - -/* - * DOV0STA - Display/Overlay 0 Status Register - */ -#define DOV0STA 0x30008 - -#define MINUV_SCALE 0x1 - -#define RGB16ToColorKey(c) \ - (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3)) - -#define RGB15ToColorKey(c) \ - (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3)) - -Bool i810InitVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; - KdVideoAdaptorPtr newAdaptor = NULL; - int num_adaptors; - -/* fprintf(stderr,"i810InitVideo\n"); */ - - if (screen->fb[0].bitsPerPixel != 8) - { - newAdaptor = i810SetupImageVideo(pScreen); - } - - num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); - - if(newAdaptor) { - if(!num_adaptors) { - num_adaptors = 1; - adaptors = &newAdaptor; - } else { - newAdaptors = /* need to free this someplace */ - xalloc((num_adaptors + 1) * sizeof(KdVideoAdaptorPtr*)); - if(newAdaptors) { - memcpy(newAdaptors, adaptors, num_adaptors * - sizeof(KdVideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } - } - - if(num_adaptors) - KdXVScreenInit(pScreen, adaptors, num_adaptors); - - if(newAdaptors) - xfree(newAdaptors); - return TRUE; -} - -/* client libraries expect an encoding */ -static KdVideoEncodingRec DummyEncoding[1] = -{ - { - 0, - "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, - {1, 1} - } -}; - -#define NUM_FORMATS 3 - -static KdVideoFormatRec Formats[NUM_FORMATS] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; - -#define NUM_ATTRIBUTES 3 - -static KdAttributeRec Attributes[NUM_ATTRIBUTES] = -{ - {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, - {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} -}; - -#define NUM_IMAGES 4 - -static KdImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY -}; - -typedef struct { - CARD32 OBUF_0Y; - CARD32 OBUF_1Y; - CARD32 OBUF_0U; - CARD32 OBUF_0V; - CARD32 OBUF_1U; - CARD32 OBUF_1V; - CARD32 OV0STRIDE; - CARD32 YRGB_VPH; - CARD32 UV_VPH; - CARD32 HORZ_PH; - CARD32 INIT_PH; - CARD32 DWINPOS; - CARD32 DWINSZ; - CARD32 SWID; - CARD32 SWIDQW; - CARD32 SHEIGHT; - CARD32 YRGBSCALE; - CARD32 UVSCALE; - CARD32 OV0CLRC0; - CARD32 OV0CLRC1; - CARD32 DCLRKV; - CARD32 DCLRKM; - CARD32 SCLRKVH; - CARD32 SCLRKVL; - CARD32 SCLRKM; - CARD32 OV0CONF; - CARD32 OV0CMD; -} I810OverlayRegRec, *I810OverlayRegPtr; - -typedef struct { - CARD32 YBuf0offset; - CARD32 UBuf0offset; - CARD32 VBuf0offset; - - CARD32 YBuf1offset; - CARD32 UBuf1offset; - CARD32 VBuf1offset; - - unsigned char currentBuf; - - unsigned char brightness; - unsigned char contrast; - - RegionRec clip; - CARD32 colorKey; - - CARD32 videoStatus; - Time offTime; - Time freeTime; - FBLinearPtr linear; -} I810PortPrivRec, *I810PortPrivPtr; - -#define GET_PORT_PRIVATE(screen) \ - (I810PortPrivPtr)(((I810CardInfo *) (screen->card->driver))->adaptor->pPortPrivates[0].ptr) - -static void i810ResetVideo(KdScreenInfo *screen) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; - I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); - - /* - * Default to maximum image size in YV12 - */ - - overlay->YRGB_VPH = 0; - overlay->UV_VPH = 0; - overlay->HORZ_PH = 0; - overlay->INIT_PH = 0; - overlay->DWINPOS = 0; - overlay->DWINSZ = (IMAGE_MAX_HEIGHT << 16) | IMAGE_MAX_WIDTH; - overlay->SWID = IMAGE_MAX_WIDTH | (IMAGE_MAX_WIDTH << 15); - overlay->SWIDQW = (IMAGE_MAX_WIDTH >> 3) | (IMAGE_MAX_WIDTH << 12); - overlay->SHEIGHT = IMAGE_MAX_HEIGHT | (IMAGE_MAX_HEIGHT << 15); - overlay->YRGBSCALE = 0x80004000; /* scale factor 1 */ - overlay->UVSCALE = 0x80004000; /* scale factor 1 */ - overlay->OV0CLRC0 = 0x4000; /* brightness: 0 contrast: 1.0 */ - overlay->OV0CLRC1 = 0x80; /* saturation: bypass */ - - /* - * Enable destination color keying - */ - switch(screen->fb[0].depth) { - case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); - overlay->DCLRKM = 0x80070307; - break; - case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); - overlay->DCLRKM = 0x80070707; - break; - default: overlay->DCLRKV = pPriv->colorKey; - overlay->DCLRKM = 0x80000000; - break; - } - - overlay->SCLRKVH = 0; - overlay->SCLRKVL = 0; - overlay->SCLRKM = 0; /* source color key disable */ - overlay->OV0CONF = 0; /* two 720 pixel line buffers */ - - overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST | - YUV_420; - - OVERLAY_UPDATE(i810c->OverlayPhysical); -} - - -static KdVideoAdaptorPtr -i810SetupImageVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = pScreenPriv->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - - KdVideoAdaptorPtr adapt; - I810PortPrivPtr pPriv; - -/* fprintf(stderr,"i810SetupImageVideo\n"); */ - - if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + - sizeof(I810PortPrivRec) + - sizeof(DevUnion)))) - return NULL; - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "I810 Video Overlay"; - adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = 1; - adapt->pPortPrivates = (DevUnion*)(&adapt[1]); - - pPriv = (I810PortPrivPtr)(&adapt->pPortPrivates[1]); - - adapt->pPortPrivates[0].ptr = (pointer)(pPriv); - adapt->pAttributes = Attributes; - adapt->nImages = NUM_IMAGES; - adapt->nAttributes = NUM_ATTRIBUTES; - adapt->pImages = Images; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = i810StopVideo; - adapt->SetPortAttribute = i810SetPortAttribute; - adapt->GetPortAttribute = i810GetPortAttribute; - adapt->QueryBestSize = i810QueryBestSize; - adapt->PutImage = i810PutImage; - adapt->QueryImageAttributes = i810QueryImageAttributes; - - pPriv->colorKey = i810c->colorKey & ((1 << screen->fb[0].depth) - 1); - pPriv->videoStatus = 0; - pPriv->brightness = 0; - pPriv->contrast = 128; - pPriv->linear = NULL; - pPriv->currentBuf = 0; - - /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); - - i810c->adaptor = adapt; - - i810c->BlockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = i810BlockHandler; - - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvContrast = MAKE_ATOM("XV_CONTRAST"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - - i810ResetVideo(screen); - - return adapt; -} - - -/* I810ClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -static void -I810ClipVideo( - BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - BoxPtr extents, /* extents of the clip region */ - INT32 width, - INT32 height -){ - INT32 vscale, hscale, delta; - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } -} - -static void -i810StopVideo(KdScreenInfo *screen, pointer data, Bool exit) -{ - I810PortPrivPtr pPriv = (I810PortPrivPtr)data; - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); - - REGION_EMPTY(screen->pScreen, &pPriv->clip); - - if(exit) { - if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - overlay->OV0CMD &= 0xFFFFFFFE; - OVERLAY_UPDATE(i810c->OverlayPhysical); - } - if(pPriv->linear) { - xfree(pPriv->linear); - pPriv->linear = NULL; - } - pPriv->videoStatus = 0; - } else { - if(pPriv->videoStatus & CLIENT_VIDEO_ON) { - pPriv->videoStatus |= OFF_TIMER; - pPriv->offTime = currentTime.milliseconds + OFF_DELAY; - } - } - -} - -static int -i810SetPortAttribute( - KdScreenInfo *screen, - Atom attribute, - int value, - pointer data -){ - I810PortPrivPtr pPriv = (I810PortPrivPtr)data; - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - - I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); - - if(attribute == xvBrightness) { - if((value < -128) || (value > 127)) - return BadValue; - pPriv->brightness = value; - overlay->OV0CLRC0 &= 0xFFFFFF00; - overlay->OV0CLRC0 |= value; - OVERLAY_UPDATE(i810c->OverlayPhysical); - } else - if(attribute == xvContrast) { - if((value < 0) || (value > 255)) - return BadValue; - pPriv->contrast = value; - overlay->OV0CLRC0 &= 0xFFFE00FF; - overlay->OV0CLRC0 |= value << 9; - OVERLAY_UPDATE(i810c->OverlayPhysical); - } else - if(attribute == xvColorKey) { - pPriv->colorKey = value; - switch(screen->fb[0].depth) { - case 16: overlay->DCLRKV = RGB16ToColorKey(pPriv->colorKey); - break; - case 15: overlay->DCLRKV = RGB15ToColorKey(pPriv->colorKey); - break; - default: overlay->DCLRKV = pPriv->colorKey; - break; - } - OVERLAY_UPDATE(i810c->OverlayPhysical); - REGION_EMPTY(screen->pScreen, &pPriv->clip); - } else return BadMatch; - - return Success; -} - -static int -i810GetPortAttribute( - KdScreenInfo *screen, - Atom attribute, - int *value, - pointer data -){ - I810PortPrivPtr pPriv = (I810PortPrivPtr)data; - - if(attribute == xvBrightness) { - *value = pPriv->brightness; - } else - if(attribute == xvContrast) { - *value = pPriv->contrast; - } else - if(attribute == xvColorKey) { - *value = pPriv->colorKey; - } else return BadMatch; - - return Success; -} - -static void -i810QueryBestSize( - KdScreenInfo *screen, - Bool motion, - short vid_w, short vid_h, - short drw_w, short drw_h, - unsigned int *p_w, unsigned int *p_h, - pointer data -){ - *p_w = drw_w; - *p_h = drw_h; -} - - -static void -I810CopyPackedData( - KdScreenInfo *screen, - unsigned char *buf, - int srcPitch, - int dstPitch, - int top, - int left, - int h, - int w - ) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; - unsigned char *src, *dst; - - src = buf + (top*srcPitch) + (left<<1); - - if (pPriv->currentBuf == 0) - dst = i810c->FbBase + pPriv->YBuf0offset; - else - dst = i810c->FbBase + pPriv->YBuf1offset; - - w <<= 1; - while(h--) { - memcpy(dst, src, w); - src += srcPitch; - dst += dstPitch; - } -} - -static void -i810CopyPlanarData( - KdScreenInfo *screen, - unsigned char *buf, - int srcPitch, - int dstPitch, /* of chroma */ - int srcH, - int top, - int left, - int h, - int w, - int id - ) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; - int i; - unsigned char *src1, *src2, *src3, *dst1, *dst2, *dst3; - - /* Copy Y data */ - src1 = buf + (top*srcPitch) + left; - if (pPriv->currentBuf == 0) - dst1 = i810c->FbBase + pPriv->YBuf0offset; - else - dst1 = i810c->FbBase + pPriv->YBuf1offset; - - for (i = 0; i < h; i++) { - memcpy(dst1, src1, w); - src1 += srcPitch; - dst1 += dstPitch << 1; - } - - /* Copy V data for YV12, or U data for I420 */ - src2 = buf + (srcH*srcPitch) + ((top*srcPitch)>>2) + (left>>1); - if (pPriv->currentBuf == 0) { - if (id == FOURCC_I420) - dst2 = i810c->FbBase + pPriv->UBuf0offset; - else - dst2 = i810c->FbBase + pPriv->VBuf0offset; - } else { - if (id == FOURCC_I420) - dst2 = i810c->FbBase + pPriv->UBuf1offset; - else - dst2 = i810c->FbBase + pPriv->VBuf1offset; - } - - for (i = 0; i < h/2; i++) { - memcpy(dst2, src2, w/2); - src2 += srcPitch>>1; - dst2 += dstPitch; - } - - /* Copy U data for YV12, or V data for I420 */ - src3 = buf + (srcH*srcPitch) + ((srcH*srcPitch)>>2) + ((top*srcPitch)>>2) + (left>>1); - if (pPriv->currentBuf == 0) { - if (id == FOURCC_I420) - dst3 = i810c->FbBase + pPriv->VBuf0offset; - else - dst3 = i810c->FbBase + pPriv->UBuf0offset; - } else { - if (id == FOURCC_I420) - dst3 = i810c->FbBase + pPriv->VBuf1offset; - else - dst3 = i810c->FbBase + pPriv->UBuf1offset; - } - - for (i = 0; i < h/2; i++) { - memcpy(dst3, src3, w/2); - src3 += srcPitch>>1; - dst3 += dstPitch; - } -} - -static void -i810DisplayVideo( - KdScreenInfo *screen, - int id, - short width, short height, - int dstPitch, /* of chroma for 4:2:0 */ - int x1, int y1, int x2, int y2, - BoxPtr dstBox, - short src_w, short src_h, - short drw_w, short drw_h -){ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - I810PortPrivPtr pPriv = i810c->adaptor->pPortPrivates[0].ptr; - I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); - int xscaleInt, xscaleFract, yscaleInt, yscaleFract; - int xscaleIntUV = 0, xscaleFractUV = 0, yscaleIntUV = 0, yscaleFractUV = 0; - unsigned int swidth; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - swidth = (width + 7) & ~7; - overlay->SWID = (swidth << 15) | swidth; - overlay->SWIDQW = (swidth << 12) | (swidth >> 3); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - swidth = ((width + 3) & ~3) << 1; - overlay->SWID = swidth; - overlay->SWIDQW = swidth >> 3; - break; - } - - overlay->SHEIGHT = height | (height << 15); - overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; - overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) | - (dstBox->x2 - dstBox->x1); - - /* buffer locations */ - overlay->OBUF_0Y = pPriv->YBuf0offset; - overlay->OBUF_1Y = pPriv->YBuf1offset; - overlay->OBUF_0U = pPriv->UBuf0offset; - overlay->OBUF_0V = pPriv->VBuf0offset; - overlay->OBUF_1U = pPriv->UBuf1offset; - overlay->OBUF_1V = pPriv->VBuf1offset; - - /* - * Calculate horizontal and vertical scaling factors, default to 1:1 - */ - overlay->YRGBSCALE = 0x80004000; - overlay->UVSCALE = 0x80004000; - - /* - * Initially, YCbCr and Overlay Enable and - * vertical chrominance up interpolation and horozontal chrominance - * up interpolation - */ - overlay->OV0CMD = VC_UP_INTERPOLATION | HC_UP_INTERPOLATION | Y_ADJUST | - OVERLAY_ENABLE; - - if ((drw_w != src_w) || (drw_h != src_h)) - { - xscaleInt = (src_w / drw_w) & 0x3; - xscaleFract = (src_w << 12) / drw_w; - yscaleInt = (src_h / drw_h) & 0x3; - yscaleFract = (src_h << 12) / drw_h; - - overlay->YRGBSCALE = (xscaleInt << 15) | - ((xscaleFract & 0xFFF) << 3) | - (yscaleInt) | - ((yscaleFract & 0xFFF) << 20); - - if (drw_w > src_w) - { - /* horizontal up-scaling */ - overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER; - overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER; - overlay->OV0CMD |= (HC_UP_INTERPOLATION | HL_UP_INTERPOLATION); - } - - if (drw_h > src_h) - { - /* vertical up-scaling */ - overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER; - overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER; - overlay->OV0CMD |= (VC_UP_INTERPOLATION | VL_UP_INTERPOLATION); - } - - if (drw_w < src_w) - { - /* horizontal down-scaling */ - overlay->OV0CMD &= ~HORIZONTAL_CHROMINANCE_FILTER; - overlay->OV0CMD &= ~HORIZONTAL_LUMINANCE_FILTER; - overlay->OV0CMD |= (HC_DOWN_INTERPOLATION | HL_DOWN_INTERPOLATION); - } - - if (drw_h < src_h) - { - /* vertical down-scaling */ - overlay->OV0CMD &= ~VERTICAL_CHROMINANCE_FILTER; - overlay->OV0CMD &= ~VERTICAL_LUMINANCE_FILTER; - overlay->OV0CMD |= (VC_DOWN_INTERPOLATION | VL_DOWN_INTERPOLATION); - } - - /* now calculate the UV scaling factor */ - - if (xscaleFract) - { - xscaleFractUV = xscaleFract >> MINUV_SCALE; - overlay->OV0CMD &= ~HC_DOWN_INTERPOLATION; - overlay->OV0CMD |= HC_UP_INTERPOLATION; - } - - if (xscaleInt) - { - xscaleIntUV = xscaleInt >> MINUV_SCALE; - if (xscaleIntUV) - { - overlay->OV0CMD &= ~HC_UP_INTERPOLATION; - } - } - - if (yscaleFract) - { - yscaleFractUV = yscaleFract >> MINUV_SCALE; - overlay->OV0CMD &= ~VC_DOWN_INTERPOLATION; - overlay->OV0CMD |= VC_UP_INTERPOLATION; - } - - if (yscaleInt) - { - yscaleIntUV = yscaleInt >> MINUV_SCALE; - if (yscaleIntUV) - { - overlay->OV0CMD &= ~VC_UP_INTERPOLATION; - overlay->OV0CMD |= VC_DOWN_INTERPOLATION; - } - } - - overlay->UVSCALE = yscaleIntUV | ((xscaleFractUV & 0xFFF) << 3) | - ((yscaleFractUV & 0xFFF) << 20); - } - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16); - overlay->OV0CMD &= ~SOURCE_FORMAT; - overlay->OV0CMD |= YUV_420; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - overlay->OV0STRIDE = dstPitch; - overlay->OV0CMD &= ~SOURCE_FORMAT; - overlay->OV0CMD |= YUV_422; - overlay->OV0CMD &= ~OV_BYTE_ORDER; - if (id == FOURCC_UYVY) - overlay->OV0CMD |= Y_SWAP; - break; - } - - overlay->OV0CMD &= ~BUFFER_AND_FIELD; - if (pPriv->currentBuf == 0) - overlay->OV0CMD |= BUFFER0_FIELD0; - else - overlay->OV0CMD |= BUFFER1_FIELD0; - - OVERLAY_UPDATE(i810c->OverlayPhysical); - -} - -static FBLinearPtr -i810AllocateMemory( - KdScreenInfo *screen, - FBLinearPtr linear, - int size -){ - KdCardInfo *card=screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - FBLinearPtr new_linear; - - if(linear) { - if(linear->size >= size) - return linear; - else - ErrorF("Ran out of memory for overlay buffer, requested size = %d\n",size); - } - - new_linear = xalloc(sizeof(FBLinearRec)); - new_linear->size = i810c->XvMem.Size; - new_linear->offset = i810c->XvMem.Start; - -/* fprintf(stderr,"Overlay mem offset %lx\n",new_linear->offset); */ - - return new_linear; -} - -static int -i810PutImage(KdScreenInfo *screen, - DrawablePtr pDraw, - short src_x, - short src_y, - short drw_x, - short drw_y, - short src_w, - short src_h, - short drw_w, - short drw_h, - int id, - unsigned char *buf, - short width, - short height, - Bool sync, - RegionPtr clipBoxes, - pointer data) -{ - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - I810PortPrivPtr pPriv = (I810PortPrivPtr)data; - INT32 x1, x2, y1, y2; - int srcPitch, dstPitch; - int top, left, npixels, nlines, size; - BoxRec dstBox; - - /* Clip */ - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - I810ClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - - if((x1 >= x2) || (y1 >= y2)) - return Success; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - srcPitch = (width + 3) & ~3; - dstPitch = ((width >> 1) + 7) & ~7; /* of chroma */ - size = dstPitch * height * 3; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - srcPitch = (width << 1); - dstPitch = (srcPitch + 7) & ~7; - size = dstPitch * height; - break; - } - - if(!(pPriv->linear = i810AllocateMemory(screen, pPriv->linear, - (screen->fb[0].bitsPerPixel == 16) ? size : (size >> 1)))) - return BadAlloc; - - /* fixup pointers */ - pPriv->YBuf0offset = pPriv->linear->offset; - pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * height); - pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * height >> 1); - - pPriv->YBuf1offset = pPriv->linear->offset + size; - pPriv->UBuf1offset = pPriv->YBuf1offset + (dstPitch * 2 * height); - pPriv->VBuf1offset = pPriv->UBuf1offset + (dstPitch * height >> 1); - - /* wait for the last rendered buffer to be flipped in */ - while (((INREG(DOV0STA)&0x00100000)>>20) != pPriv->currentBuf); - - /* buffer swap */ - if (pPriv->currentBuf == 0) - pPriv->currentBuf = 1; - else - pPriv->currentBuf = 0; - - /* copy data */ - top = y1 >> 16; - left = (x1 >> 16) & ~1; - npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - i810CopyPlanarData(screen, buf, srcPitch, dstPitch, height, top, left, - nlines, npixels, id); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - nlines = ((y2 + 0xffff) >> 16) - top; - I810CopyPackedData(screen, buf, srcPitch, dstPitch, top, left, nlines, - npixels); - break; - } - - /* update cliplist */ - if(!REGION_EQUAL(screen->pScreen, &pPriv->clip, clipBoxes)) { - REGION_COPY(screen->pScreen, &pPriv->clip, clipBoxes); - KXVPaintRegion (pDraw, &pPriv->clip, pPriv->colorKey); - } - - - i810DisplayVideo(screen, id, width, height, dstPitch, - x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - - pPriv->videoStatus = CLIENT_VIDEO_ON; - - return Success; -} - - -static int -i810QueryImageAttributes( - KdScreenInfo *screen, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets -){ - int size, tmp; - - if(*w > 720) *w = 720; - if(*h > 576) *h = 576; - - *w = (*w + 1) & ~1; - if(offsets) offsets[0] = 0; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if(pitches) pitches[0] = size; - size *= *h; - if(offsets) offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if(pitches) pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if(offsets) offsets[2] = size; - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) pitches[0] = size; - size *= *h; - break; - } - - return size; -} - -static void -i810BlockHandler ( - int i, - pointer blockData, - pointer pTimeout, - pointer pReadmask -){ - ScreenPtr pScreen = screenInfo.screens[i]; - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = screen->card; - I810CardInfo *i810c = (I810CardInfo *) card->driver; - I810PortPrivPtr pPriv = GET_PORT_PRIVATE(screen); - I810OverlayRegPtr overlay = (I810OverlayRegPtr) (i810c->FbBase + i810c->OverlayStart); - - pScreen->BlockHandler = i810c->BlockHandler; - - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); - - pScreen->BlockHandler = i810BlockHandler; - - if(pPriv->videoStatus & TIMER_MASK) { - UpdateCurrentTime(); - if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < currentTime.milliseconds) { - /* Turn off the overlay */ - overlay->OV0CMD &= 0xFFFFFFFE; - OVERLAY_UPDATE(i810c->OverlayPhysical); - - pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; - } - } else { /* FREE_TIMER */ - if(pPriv->freeTime < currentTime.milliseconds) { - if(pPriv->linear) { - xfree(pPriv->linear); - pPriv->linear = NULL; - } - pPriv->videoStatus = 0; - } - } - } -} diff --git a/hw/kdrive/i810/i810draw.c b/hw/kdrive/i810/i810draw.c deleted file mode 100644 index b571efbe0..000000000 --- a/hw/kdrive/i810/i810draw.c +++ /dev/null @@ -1,352 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/* Hardware accelerated drawing for KDrive i810 driver. - Author: Pontus Lidman <pontus.lidman@nokia.com> -*/ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kaa.h" -#ifdef XV -#include "kxv.h" -#endif -#include "i810.h" -#include "i810_reg.h" - -//#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" - -#define NUM_STACK_RECTS 1024 - -i810ScreenInfo *accel_i810s; - -static int -i810WaitLpRing(i810ScreenInfo *i810s, int n, int timeout_millis) -{ - i810CardInfo *i810c = i810s->i810c; - I810RingBuffer *ring = &(i810c->LpRing); - int iters = 0; - int start = 0; - int now = 0; - int last_head = 0; - int first = 0; - - /* If your system hasn't moved the head pointer in 2 seconds, I'm going to - * call it crashed. - */ - if (timeout_millis == 0) - timeout_millis = 2000; - - if (I810_DEBUG) { - fprintf(stderr, "i810WaitLpRing %d\n", n); - first = GetTimeInMillis(); - } - - while (ring->space < n) - { - int i; - - ring->head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; - ring->space = ring->head - (ring->tail+8); - - if (ring->space < 0) - ring->space += ring->mem.Size; - - iters++; - now = GetTimeInMillis(); - if ( start == 0 || now < start || ring->head != last_head) { - if (I810_DEBUG) - if (now > start) - fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); - start = now; - last_head = ring->head; - } else if ( now - start > timeout_millis ) { - - i810PrintErrorState(i810c); - fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); - FatalError("lockup\n"); - } - - for (i = 0 ; i < 2000 ; i++) - ; - } - - if (I810_DEBUG) - { - now = GetTimeInMillis(); - if (now - first) { - fprintf(stderr,"Elapsed %d ms\n", now - first); - fprintf(stderr, "space: %d wanted %d\n", ring->space, n ); - } - } - - return iters; -} - -static void -i810Sync(i810ScreenInfo *i810s) -{ - i810CardInfo *i810c = i810s->i810c; - LP_RING_LOCALS; - - if (I810_DEBUG) - fprintf(stderr, "i810Sync\n"); - - /* Send a flush instruction and then wait till the ring is empty. - * This is stronger than waiting for the blitter to finish as it also - * flushes the internal graphics caches. - */ - BEGIN_LP_RING(2); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( 0 ); /* pad to quadword */ - ADVANCE_LP_RING(); - - i810WaitLpRing(i810s, i810c->LpRing.mem.Size - 8, 0); - - i810c->LpRing.space = i810c->LpRing.mem.Size - 8; - i810c->nextColorExpandBuf = 0; -} - -static void -i810WaitMarker(ScreenPtr pScreen, int marker) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - - i810Sync(i810s); -} - -#if 0 -static void -i810EmitInvarientState(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810CardInfo(pScreenPriv); - i810ScreenInfo(pScreenPriv); - LP_RING_LOCALS; - - BEGIN_LP_RING( 10 ); - - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE ); - OUT_RING( GFX_CMD_CONTEXT_SEL | CS_UPDATE_USE | CS_USE_CTX0 ); - OUT_RING( INST_PARSER_CLIENT | INST_OP_FLUSH | INST_FLUSH_MAP_CACHE); - OUT_RING( 0 ); - - - OUT_RING( GFX_OP_COLOR_CHROMA_KEY ); - OUT_RING( CC1_UPDATE_KILL_WRITE | - CC1_DISABLE_KILL_WRITE | - CC1_UPDATE_COLOR_IDX | - CC1_UPDATE_CHROMA_LOW | - CC1_UPDATE_CHROMA_HI | - 0); - OUT_RING( 0 ); - OUT_RING( 0 ); - - /* No depth buffer in KDrive yet */ - /* OUT_RING( CMD_OP_Z_BUFFER_INFO ); */ - /* OUT_RING( pI810->DepthBuffer.Start | pI810->auxPitchBits); */ - - ADVANCE_LP_RING(); -} -#endif - -static unsigned int i810PatternRop[16] = { - 0x00, /* GXclear */ - 0xA0, /* GXand */ - 0x50, /* GXandReverse */ - 0xF0, /* GXcopy */ - 0x0A, /* GXandInvert */ - 0xAA, /* GXnoop */ - 0x5A, /* GXxor */ - 0xFA, /* GXor */ - 0x05, /* GXnor */ - 0xA5, /* GXequiv */ - 0x55, /* GXinvert */ - 0xF5, /* GXorReverse */ - 0x0F, /* GXcopyInvert */ - 0xAF, /* GXorInverted */ - 0x5F, /* GXnand */ - 0xFF /* GXset */ -}; - -static Bool -i810PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) -{ - KdScreenPriv(pPix->drawable.pScreen); - i810ScreenInfo(pScreenPriv); - i810CardInfo(pScreenPriv); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "i810PrepareSolid color: %x rop: %x mask: %x\n", - fg, alu, pm); - - /* Color blit, p166 */ - i810c->BR[13] = BR13_SOLID_PATTERN | - (i810PatternRop[alu] << 16) | - (pPix->drawable.pScreen->width * i810c->cpp); - i810c->BR[16] = fg; - - accel_i810s = i810s; - - return TRUE; -} - -static void -i810Solid(int x1, int y1, int x2, int y2) -{ - I810ScreenInfo *i810s = accel_i810s; - I810CardInfo *i810c = i810s->i810c; - LP_RING_LOCALS; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF( "i810SubsequentFillRectSolid %d,%d %d,%d\n", x1, y1, x2, y2); - - BEGIN_LP_RING(6); - - OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); - OUT_RING( i810c->BR[13] ); - OUT_RING( ((y2 - y1) << 16) | ((x2 - x1) * i810c->cpp)); - OUT_RING( i810c->bufferOffset + y1 * i810s->pitch + x1 * i810c->cpp ); - - OUT_RING( i810c->BR[16]); - OUT_RING( 0 ); /* pad to quadword */ - - ADVANCE_LP_RING(); -} - -static void -i810DoneSolid(void) -{ -} - -static Bool -i810PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) -{ - return FALSE; -} - -static void -i810RefreshRing(i810CardInfo *i810c) -{ - i810c->LpRing.head = INREG(LP_RING + RING_HEAD) & HEAD_ADDR; - i810c->LpRing.tail = INREG(LP_RING + RING_TAIL); - i810c->LpRing.space = i810c->LpRing.head - (i810c->LpRing.tail+8); - if (i810c->LpRing.space < 0) - i810c->LpRing.space += i810c->LpRing.mem.Size; -} - - -static void -i810SetRingRegs(i810CardInfo *i810c) -{ - unsigned int itemp; - - OUTREG(LP_RING + RING_TAIL, 0 ); - OUTREG(LP_RING + RING_HEAD, 0 ); - - itemp = INREG(LP_RING + RING_START); - itemp &= ~(START_ADDR); - itemp |= i810c->LpRing.mem.Start; - OUTREG(LP_RING + RING_START, itemp ); - - itemp = INREG(LP_RING + RING_LEN); - itemp &= ~(RING_NR_PAGES | RING_REPORT_MASK | RING_VALID_MASK); - itemp |= ((i810c->LpRing.mem.Size-4096) | RING_NO_REPORT | RING_VALID); - OUTREG(LP_RING + RING_LEN, itemp ); -} - -Bool -i810InitAccel(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810ScreenInfo(pScreenPriv); - i810CardInfo(pScreenPriv); - - memset(&i810s->kaa, 0, sizeof(KaaScreenInfoRec)); - i810s->kaa.waitMarker = i810WaitMarker; - i810s->kaa.PrepareSolid = i810PrepareSolid; - i810s->kaa.Solid = i810Solid; - i810s->kaa.DoneSolid = i810DoneSolid; - i810s->kaa.PrepareCopy = i810PrepareCopy; - i810s->kaa.Copy = NULL; - i810s->kaa.DoneCopy = NULL; - - i810s->pitch = pScreen->width * i810c->cpp; - - return FALSE; -} - -void -i810EnableAccel(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810CardInfo(pScreenPriv); - - if (i810c->LpRing.mem.Size == 0) { - ErrorF("No memory for LpRing!! Acceleration not functional!!\n"); - } - - i810SetRingRegs(i810c); - - kaaMarkSync (pScreen); -} - - -void -i810DisableAccel(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - i810CardInfo(pScreenPriv); - i810ScreenInfo(pScreenPriv); - - i810RefreshRing(i810c); - i810Sync(i810s); -} - -void -i810FiniAccel(ScreenPtr pScreen) -{ -} diff --git a/hw/kdrive/i810/i810draw.h b/hw/kdrive/i810/i810draw.h deleted file mode 100644 index 7c8c04489..000000000 --- a/hw/kdrive/i810/i810draw.h +++ /dev/null @@ -1,46 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/* Hardware accelerated drawing for KDrive i810 driver, header file. - Author: Pontus Lidman <pontus.lidman@nokia.com> -*/ - - -#ifndef _I810DRAW_H_ -#define _I810DRAW_H_ - -void i810RefreshRing(KdScreenInfo *screen); -int i810WaitLpRing( KdScreenInfo *screen, int n, int timeout_millis ); -void i810Sync( KdScreenInfo *screen ); - -#endif /* _I810DRAW_H_ */ diff --git a/hw/kdrive/i810/i810stub.c b/hw/kdrive/i810/i810stub.c deleted file mode 100644 index 3109984e0..000000000 --- a/hw/kdrive/i810/i810stub.c +++ /dev/null @@ -1,92 +0,0 @@ -/* COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 2000, 2001 Nokia Home Communications - -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. - -X Window System is a trademark of The Open Group */ - -/* Stub functions for the i810 KDrive driver - Author: Pontus Lidman <pontus.lidman@nokia.com> -*/ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kxv.h" -#include "i810.h" -#include "klinux.h" - -static const int i810Cards[]={ - PCI_CHIP_I810, - PCI_CHIP_I810_DC100, - PCI_CHIP_I810_E -}; - -#define numI810Cards (sizeof(i810Cards) / sizeof(i810Cards[0])) - -void -InitCard (char *name) -{ - KdCardAttr attr; - int i; - - for (i = 0; i < numI810Cards; i++) - if (LinuxFindPci (0x8086, i810Cards[i], 0, &attr)) - KdCardInfoAdd (&i810Funcs, &attr, (void *) i810Cards[i]); -} - - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/igs/igs.c b/hw/kdrive/igs/igs.c deleted file mode 100644 index 1c446f782..000000000 --- a/hw/kdrive/igs/igs.c +++ /dev/null @@ -1,667 +0,0 @@ -/* - * Copyright © 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "igs.h" - -Bool -igsCardInit (KdCardInfo *card) -{ - int k; - char *pixels; - IgsCardInfo *igsc; - - igsc = (IgsCardInfo *) xalloc (sizeof (IgsCardInfo)); - if (!igsc) - return FALSE; - - memset (igsc, '\0', sizeof (IgsCardInfo)); - - igsc->frameBuffer = (CARD8 *) KdMapDevice (card->attr.address[0] + - IGS_FB, - IGS_MEM); - - igsc->vga = (VOL8 *) KdMapDevice (card->attr.address[0] + - IGS_VGA, - 64 * 1024); - - igsc->cop = (Cop5xxx *) KdMapDevice (card->attr.address[0] + - IGS_COP_OFFSET, - sizeof (Cop5xxx)); - - igsc->copData = (VOL32 *) KdMapDevice (card->attr.address[0] + - IGS_COP_DATA, - IGS_COP_DATA_LEN); - - igsRegInit (&igsc->igsvga, igsc->vga); - - card->driver = igsc; - - return TRUE; -} - -Bool -igsModeSupported (KdScreenInfo *screen, - const KdMonitorTiming *t) -{ - /* make sure the clock isn't too fast */ - if (t->clock > IGS_MAX_CLOCK) - return FALSE; - /* width must be a multiple of 16 */ - if (t->horizontal & 0xf) - return FALSE; - return TRUE; -} - -Bool -igsModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - int screen_size; - int pixel_width; - int byte_width; - int fb = 0; - - screen_size = 0; - if (screen->fb[fb].depth >= 24) - { - screen->fb[fb].depth = 24; - if (screen->fb[fb].bitsPerPixel != 24) - screen->fb[fb].bitsPerPixel = 32; - } - else if (screen->fb[fb].depth >= 16) - { - screen->fb[fb].depth = 16; - screen->fb[fb].bitsPerPixel = 16; - } - else if (screen->fb[fb].depth >= 15) - { - screen->fb[fb].depth = 15; - screen->fb[fb].bitsPerPixel = 16; - } - else if (screen->fb[fb].depth >= 12) - { - screen->fb[fb].depth = 12; - screen->fb[fb].bitsPerPixel = 16; - } - else - { - screen->fb[fb].depth = 8; - screen->fb[fb].bitsPerPixel = 8; - } - - byte_width = screen->width * (screen->fb[fb].bitsPerPixel >> 3); - pixel_width = screen->width; - screen->fb[fb].pixelStride = pixel_width; - screen->fb[fb].byteStride = byte_width; - screen_size += byte_width * screen->height; - - return TRUE; -} - -Bool -igsScreenInit (KdScreenInfo *screen) -{ - IgsCardInfo *igsc = screen->card->driver; - int fb = 0; - IgsScreenInfo *igss; - int screen_size, memory; - int pattern_size; - int tile_size; - int stipple_size; - int poffset, boffset; - const KdMonitorTiming *t; - - if (!screen->width || !screen->height) - { - screen->width = 800; - screen->height = 600; - screen->rate = 72; - } - if (!screen->fb[0].depth) - screen->fb[0].depth = 8; - - t = KdFindMode (screen, igsModeSupported); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - if (!KdTuneMode (screen, igsModeUsable, igsModeSupported)) - { - return FALSE; - } - - igss = (IgsScreenInfo *) xalloc (sizeof (IgsScreenInfo)); - if (!igss) - return FALSE; - - memset (igss, '\0', sizeof (IgsScreenInfo)); - - screen_size = screen->fb[fb].byteStride * screen->height; - memory = IGS_MEM; - memory -= screen_size; - if (memory >= 1024) - { - igss->cursor_offset = memory - 1024; -#if BITMAP_BIT_ORDER == MSBFirst - igss->cursor_base = (CARD8 *) KdMapDevice (card->attr.address[0] + - igss->cursor_offset, - 1024); -#else - igss->cursor_base = igsc->frameBuffer + igss->cursor_offset; -#endif - memory -= 1024; - } - else - igss->cursor_base = 0; - - tile_size = IgsTileSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN; - stipple_size = IgsStippleSize(screen->fb[fb].bitsPerPixel) * IGS_NUM_PATTERN; - pattern_size = tile_size + stipple_size; - if (memory >= pattern_size) - { - boffset = screen_size; - poffset = boffset * 8 / screen->fb[fb].bitsPerPixel; - igss->tile.offset = poffset; - igss->tile.base = igsc->frameBuffer + boffset; - - boffset = screen_size + tile_size; - poffset = boffset * 8 / screen->fb[fb].bitsPerPixel; - igss->stipple.offset = poffset; - igss->stipple.base = igsc->frameBuffer + boffset; - - memory -= pattern_size; - } - else - { - igss->tile.base = 0; - igss->stipple.base = 0; - } - - switch (screen->fb[fb].depth) { - case 8: - screen->fb[fb].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[fb].blueMask = 0x00; - screen->fb[fb].greenMask = 0x00; - screen->fb[fb].redMask = 0x00; - break; - case 15: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x001f; - screen->fb[fb].greenMask = 0x03e0; - screen->fb[fb].redMask = 0x7c00; - break; - case 16: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x001f; - screen->fb[fb].greenMask = 0x07e0; - screen->fb[fb].redMask = 0xf800; - break; - case 24: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x0000ff; - screen->fb[fb].greenMask = 0x00ff00; - screen->fb[fb].redMask = 0xff0000; - break; - } - - screen->fb[fb].pixelStride = screen->width; - screen->fb[fb].byteStride = screen->width * (screen->fb[fb].bitsPerPixel >> 3); - screen->fb[fb].frameBuffer = igsc->frameBuffer; - if (!igsc->cop) - screen->dumb = TRUE; - screen->driver = igss; - return TRUE; -} - -Bool -igsInitScreen(ScreenPtr pScreen) -{ - return TRUE; -} - -void -igsPreserve (KdCardInfo *card) -{ - IgsCardInfo *igsc = card->driver; - IgsVga *igsvga = &igsc->igsvga; - - igsSave (igsvga); -} - -void -igsSetBlank (IgsVga *igsvga, Bool blank) -{ - igsSetImm(igsvga, igs_screen_off, blank ? 1 : 0); -} - -void -igsSetSync (IgsCardInfo *igsc, int hsync, int vsync) -{ - IgsVga *igsvga = &igsc->igsvga; - - igsSet (igsvga, igs_mexhsyn, hsync); - igsSet (igsvga, igs_mexvsyn, vsync); - VgaFlush (&igsvga->card); -} - - -/* - * Clock synthesis: - * - * scale = p ? (2 * p) : 1 - * f_out = f_ref * ((M + 1) / ((N + 1) * scale)) - * - * Constraints: - * - * 1. 115MHz <= f_ref * ((M + 1) / (N + 1)) <= 260 MHz - * 2. N >= 1 - * - * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) - * Horizontal refresh rate = clock / (hsize + hblank) - */ - -/* all in kHz */ - -void -igsGetClock (int target, int *Mp, int *Np, int *Pp, int maxM, int maxN, int maxP, int minVco) -{ - int M, N, P, bestM, bestN; - int f_vco, f_out; - int err, abserr, besterr; - - /* - * Compute correct P value to keep VCO in range - */ - for (P = 0; P <= maxP; P++) - { - f_vco = target * IGS_SCALE(P); - if (f_vco >= minVco) - break; - } - - /* M = f_out / f_ref * ((N + 1) * IGS_SCALE(P)); */ - besterr = target; - for (N = 1; N <= maxN; N++) - { - M = ((target * (N + 1) * IGS_SCALE(P) + (IGS_CLOCK_REF/2)) + IGS_CLOCK_REF/2) / IGS_CLOCK_REF - 1; - if (0 <= M && M <= maxM) - { - f_out = IGS_CLOCK(M,N,P); - err = target - f_out; - if (err < 0) - err = -err; - if (err < besterr) - { - besterr = err; - bestM = M; - bestN = N; - } - } - } - *Mp = bestM; - *Np = bestN; - *Pp = P; -} - -Bool -igsEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - KdScreenInfo *screen = pScreenPriv->screen; - IgsCardInfo *igsc = card->driver; - IgsVga *igsvga = &igsc->igsvga; - const KdMonitorTiming *t; - int hactive, hblank, hfp, hbp; - int vactive, vblank, vfp, vbp; - int hsize; - int fb = 0; - int m, n, r; - int h_total; - int h_display_end; - int h_blank_start; - int h_blank_end; - int h_sync_start; - int h_sync_end; - int h_screen_off; - int v_total; - int v_retrace_start; - int v_retrace_end; - int v_display_end; - int v_blank_start; - int v_blank_end; - int offset; - int num_fetch; - int m_m, m_n, m_r; - - - igsSetBlank (igsvga, TRUE); - - t = KdFindMode (screen, igsModeSupported); - - igsGetClock (t->clock, &m, &n, &r, 2047, 255, 7, IGS_MIN_VCO); - - /* - * Set the chip so that 0x400000 is a big-endian frame buffer - * with the correct byte swapping enabled - */ - igsSet (igsvga, igs_biga22force, 0); - igsSet (igsvga, igs_biga22en, 1); - igsSet (igsvga, igs_biga24en, 1); - /* - * Enable 8-bit DACs - */ - igsSet (igsvga, igs_rampwdn, 0); - igsSet (igsvga, igs_dac6_8, 1); - igsSet (igsvga, igs_dacpwdn, 0); - /* - * Set overscan to black - */ - igsSet (igsvga, igs_overscan_red, 0x00); - igsSet (igsvga, igs_overscan_green, 0x00); - igsSet (igsvga, igs_overscan_blue, 0x00); - /* - * Enable PCI retries - */ - igsSet (igsvga, igs_iow_retry, 1); - igsSet (igsvga, igs_mw_retry, 1); - igsSet (igsvga, igs_mr_retry, 1); - igsSet (igsvga, igs_pci_burst_write, 1); - igsSet (igsvga, igs_pci_burst_read, 1); - /* - * Set FIFO - */ - igsSet (igsvga, igs_memgopg, 1); - igsSet (igsvga, igs_memr2wpg, 0); - igsSet (igsvga, igs_crtff16, 0); - igsSet (igsvga, igs_fifomust, 0xff); - igsSet (igsvga, igs_fifogen, 0xff); - /* - * Enable CRT reg access - */ - igsSetImm (igsvga, igs_ena_vr_access, 1); - igsSetImm (igsvga, igs_crt_protect, 0); - - hfp = t->hfp; - hbp = t->hbp; - hblank = t->hblank; - hactive = t->horizontal; - offset = screen->fb[0].byteStride; - - vfp = t->vfp; - vbp = t->vbp; - vblank = t->vblank; - vactive = t->vertical; - - /* - * Compute character lengths for horizontal timing values - */ - hactive = screen->width / 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - offset /= 8; - - switch (screen->fb[fb].bitsPerPixel) { - case 8: - igsSet (igsvga, igs_overscan_red, pScreen->blackPixel); - igsSet (igsvga, igs_overscan_green, pScreen->blackPixel); - igsSet (igsvga, igs_overscan_blue, pScreen->blackPixel); - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8); - igsSet (igsvga, igs_mode_sel, IGS_MODE_8); - igsSet (igsvga, igs_ramdacbypass, 0); - break; - case 16: - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_16); - igsSet (igsvga, igs_ramdacbypass, 1); - switch (screen->fb[fb].depth) { - case 12: - igsSet (igsvga, igs_mode_sel, IGS_MODE_4444); - break; - case 15: - igsSet (igsvga, igs_mode_sel, IGS_MODE_5551); - break; - case 16: - igsSet (igsvga, igs_mode_sel, IGS_MODE_565); - break; - } - break; - case 24: - igsSet (igsvga, igs_ramdacbypass, 1); - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_8); - igsSet (igsvga, igs_mode_sel, IGS_MODE_888); - break; - case 32: - igsSet (igsvga, igs_ramdacbypass, 1); - igsSet (igsvga, igs_bigswap, IGS_BIGSWAP_32); - igsSet (igsvga, igs_mode_sel, IGS_MODE_8888); - break; - } - - /* - * Compute horizontal register values from timings - */ - h_total = hactive + hblank - 5; - h_display_end = hactive - 1; - - h_sync_start = hactive + hfp; - h_sync_end = hactive + hblank - hbp; - /* - * pad the blank values narrow a bit and use the border_select to - * eliminate the remaining border; don't know why, but it doesn't - * work in the documented fashion - */ - h_blank_start = hactive - 1; - h_blank_end = hactive + hblank - 1 - 1; - - num_fetch = (t->horizontal * screen->fb[fb].bitsPerPixel / 64) + 1; - - v_total = vactive + vblank - 2; - v_display_end = vactive - 1; - - v_blank_start = vactive - 1; - v_blank_end = v_blank_start + vblank - 1; - - v_retrace_start = vactive + vfp; - v_retrace_end = vactive + vblank - vbp; - -#if 0 -#define chk(a,b,c) fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", a, igsGet(igsvga, b), c); - - chk("h_total", igs_h_total, h_total); - chk("h_display_end", igs_h_de_end, h_display_end); - chk("h_sync_start", igs_h_rstart, h_sync_start); - chk("h_sync_end", igs_h_rend, h_sync_end&0x1f); - chk("h_blank_start", igs_h_bstart, h_blank_start); - chk("h_blank_end", igs_h_bend, h_blank_end&0x3f); - chk("offset", igs_offset, offset); - chk("num_fetch", igs_num_fetch, num_fetch); - - chk("v_total", igs_v_total, v_total); - chk("v_display_end", igs_v_de_end, v_display_end); - chk("v_blank_start", igs_v_bstart, v_blank_start); - chk("v_blank_end", igs_v_bend, v_blank_end&0xf); - chk("v_retrace_start", igs_v_rstart, v_retrace_start); - chk("v_retrace_end", igs_v_rend, v_retrace_end&0xf); - chk("vclk_m", igs_vclk_m, m); - chk("vclk_n", igs_vclk_n, n); - chk("vclk_p", igs_vclk_p, r); - - fprintf (stderr, "%20.20s: BIOS %6d X %6d\n", "vclk", - IGS_CLOCK(igsGet(igsvga,igs_vclk_m), - igsGet(igsvga,igs_vclk_n), - igsGet(igsvga,igs_vclk_p)), - IGS_CLOCK(m,n,r)); -#endif - igsSet (igsvga, igs_h_total, h_total); - igsSet (igsvga, igs_h_de_end, h_display_end); - igsSet (igsvga, igs_h_rstart, h_sync_start); - igsSet (igsvga, igs_h_rend, h_sync_end); - igsSet (igsvga, igs_h_bstart, h_blank_start); - igsSet (igsvga, igs_h_bend, h_blank_end); - igsSet (igsvga, igs_offset, offset); - igsSet (igsvga, igs_num_fetch, num_fetch); - - igsSet (igsvga, igs_v_total, v_total); - igsSet (igsvga, igs_v_de_end, v_display_end); - igsSet (igsvga, igs_v_bstart, v_blank_start); - igsSet (igsvga, igs_v_bend, v_blank_end&0xf); - igsSet (igsvga, igs_v_rstart, v_retrace_start); - igsSet (igsvga, igs_v_rend, v_retrace_end&0xf); - - igsSet (igsvga, igs_vclk_m, m); - igsSet (igsvga, igs_vclk_n, n); - igsSet (igsvga, igs_vclk_p, r); - igsSet (igsvga, igs_vfsel, IGS_CLOCK(m, n, 0) >= 180000); - VgaFlush (&igsvga->card); - - igsSetImm (igsvga, igs_frqlat, 0); - igsSetImm (igsvga, igs_frqlat, 1); - igsSetImm (igsvga, igs_frqlat, 0); - - igsSetBlank (igsvga, FALSE); -#if 0 -#define dbg(a,b) fprintf(stderr, "%20.20s = 0x%x\n", a, igsGet(igsvga,b)) - -#include "reg.dbg" - - { - VGA16 reg; - char buf[128]; - - for (reg = 0; reg < IGS_NREG; reg++) - fprintf(stderr, "%20.20s = 0x%02x\n", igsRegName(buf, reg), - VgaFetch (&igsvga->card, reg)); - } -#endif - return TRUE; -} - -Bool -igsDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - IgsCardInfo *igsc = pScreenPriv->card->driver; - IgsVga *igsvga = &igsc->igsvga; - - switch (mode) { - case KD_DPMS_NORMAL: - igsSetSync (igsc, 0, 0); - igsSetBlank (igsvga, FALSE); - break; - case KD_DPMS_STANDBY: - igsSetBlank (igsvga, TRUE); - igsSetSync (igsc, 1, 0); - break; - case KD_DPMS_SUSPEND: - igsSetBlank (igsvga, TRUE); - igsSetSync (igsc, 0, 1); - break; - case KD_DPMS_POWERDOWN: - igsSetBlank (igsvga, TRUE); - igsSetSync (igsc, 1, 1); - break; - } - return TRUE; -} - -void -igsDisable (ScreenPtr pScreen) -{ -} - -void -igsRestore (KdCardInfo *card) -{ - IgsCardInfo *igsc = card->driver; - IgsVga *igsvga = &igsc->igsvga; - - igsReset (igsvga); -} - -void -igsScreenFini (KdScreenInfo *screen) -{ - IgsScreenInfo *igss = (IgsScreenInfo *) screen->driver; - -#if BITMAP_BIT_ORDER == MSBFirst - if (igss->cursor_base) - KdUnmapDevice ((void *) igss->cursor_base, 1024); -#endif - xfree (igss); - screen->driver = 0; -} - -void -igsCardFini (KdCardInfo *card) -{ - IgsCardInfo *igsc = card->driver; - - if (igsc->copData) - KdUnmapDevice ((void *) igsc->copData, IGS_COP_DATA_LEN); - if (igsc->cop) - KdUnmapDevice ((void *) igsc->cop, sizeof (Cop5xxx)); - if (igsc->vga) - KdUnmapDevice ((void *) igsc->vga, 64 * 1024); - if (igsc->frameBuffer) - KdUnmapDevice (igsc->frameBuffer, IGS_MEM); - xfree (igsc); - card->driver = 0; -} - -KdCardFuncs igsFuncs = { - igsCardInit, /* cardinit */ - igsScreenInit, /* scrinit */ - igsInitScreen, - igsPreserve, /* preserve */ - igsEnable, /* enable */ - igsDPMS, /* dpms */ - igsDisable, /* disable */ - igsRestore, /* restore */ - igsScreenFini, /* scrfini */ - igsCardFini, /* cardfini */ - - igsCursorInit, /* initCursor */ - igsCursorEnable, /* enableCursor */ - igsCursorDisable, /* disableCursor */ - igsCursorFini, /* finiCursor */ - 0, /* recolorCursor */ - - igsDrawInit, /* initAccel */ - igsDrawEnable, /* enableAccel */ - igsDrawSync, /* drawSync */ - igsDrawDisable, /* disableAccel */ - igsDrawFini, /* finiAccel */ - - igsGetColors, /* getColors */ - igsPutColors, /* putColors */ -}; diff --git a/hw/kdrive/igs/igs.h b/hw/kdrive/igs/igs.h deleted file mode 100644 index 9f0336b7d..000000000 --- a/hw/kdrive/igs/igs.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright © 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifndef _IGS_H_ -#define _IGS_H_ - -#include "kdrive.h" -#include "igsreg.h" - -extern KdCardFuncs igsFuncs; - -/* - * FB 0x00000000 - * VGA 0x00800000 - * Blt window 0x008a0000 - * Coprocessor 0x008bf000 - */ - -#if BITMAP_BIT_ORDER == MSBFirst -#define IGS_FB 0x00400000 -#else -#define IGS_FB 0x00000000 -#endif -#define IGS_VGA 0x00800000 -#define IGS_COP_DATA 0x008a0000 -#define IGS_COP_DATA_LEN 0x00010000 -#define IGS_COP_OFFSET 0x008bf000 -/* give audio 1/2 meg at end */ -#if 1 -#define IGS_MEM ((4096-512)*1024) -#else -#define IGS_MEM ((4096)*1024) -#endif - -#define IGS_CLOCK_REF 24576 /* KHz */ - -#define IGS_SCALE(p) ((p) ? (2 * (p)) : 1) - -#define IGS_CLOCK(m,n,p) ((IGS_CLOCK_REF * ((m) + 1)) / (((n) + 1) * IGS_SCALE(p))) - -#define IGS_MAX_CLOCK 260000 - -#define IGS_MIN_VCO 115000 - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _Cop5xxx { - VOL8 pad000[0x10]; /* 0x000 */ - - VOL32 control; /* 0x010 */ -#define IGS_CONTROL_HBLTW_RDYZ 0x0100 -#define IGS_CONTROL_MALLWBEPTZ 0x0200 -#define IGS_CONTROL_CMDFF 0x0400 -#define IGS_CONTROL_SOP 0x0800 -#define IGS_CONTROL_OPS 0x1000 -#define IGS_CONTROL_TER 0x2000 -#define IGS_CONTROL_HBACKZ 0x4000 -#define IGS_CONTROL_BUSY 0x8000 - - VOL8 pad014[0x04]; /* 0x014 */ - - VOL32 src1_stride; /* 0x018 */ - - VOL32 format; /* 0x01c */ - -#define IGS_FORMAT_8BPP 0 -#define IGS_FORMAT_16BPP 1 -#define IGS_FORMAT_24BPP 2 -#define IGS_FORMAT_32BPP 3 - - VOL32 bres_error; /* 0x020 */ - VOL32 bres_k1; /* 0x024 */ - VOL32 bres_k2; /* 0x028 */ - VOL8 pad02c[0x1c]; /* 0x02c */ - - VOL32 mix; /* 0x048 */ -#define IGS_MIX_FG 0x00ff -#define IGS_MIX_BG 0xff00 -#define IGS_MAKE_MIX(fg,bg) ((fg) | ((bg) << 8)) - -#define IGS_MIX_ZERO 0x0 -#define IGS_MIX_SRC_AND_DST 0x1 -#define IGS_MIX_SRC_AND_NOT_DST 0x2 -#define IGS_MIX_SRC 0x3 -#define IGS_MIX_NOT_SRC_AND_DST 0x4 -#define IGS_MIX_DST 0x5 -#define IGS_MIX_SRC_XOR_DST 0x6 -#define IGS_MIX_SRC_OR_DST 0x7 -#define IGS_MIX_NOT_SRC_AND_NOT_DST 0x8 -#define IGS_MIX_SRC_XOR_NOT_DST 0x9 -#define IGS_MIX_NOT_DST 0xa -#define IGS_MIX_SRC_OR_NOT_DST 0xb -#define IGS_MIX_NOT_SRC 0xc -#define IGS_MIX_NOT_SRC_OR_DST 0xd -#define IGS_MIX_NOT_SRC_OR_NOT_DST 0xe -#define IGS_MIX_ONE 0xf - - VOL32 colorComp; /* 0x04c */ - VOL32 planemask; /* 0x050 */ - - VOL8 pad054[0x4]; /* 0x054 */ - - VOL32 fg; /* 0x058 */ - VOL32 bg; /* 0x05c */ - VOL32 dim; /* 0x060 */ -#define IGS_MAKE_DIM(w,h) ((w) | ((h) << 16)) - VOL8 pad5[0x0c]; /* 0x064 */ - - VOL32 src1_base_address; /* 0x070 */ - VOL8 pad074[0x04]; /* 0x074 */ - - VOL32 rotate; /* 0x078 */ -#define IGS_MAKE_ROTATE(x,y) ((x) | ((y) << 16)) - VOL32 operation; /* 0x07c */ - -/* OCT[2:0] */ -#define IGS_DRAW_X_MAJOR 0x00000000 -#define IGS_DRAW_Y_MAJOR 0x00000001 -#define IGS_DRAW_T_B 0x00000000 -#define IGS_DRAW_B_T 0x00000002 -#define IGS_DRAW_L_R 0x00000000 -#define IGS_DRAW_R_L 0x00000004 - -/* Draw_Mode[1:0] */ -#define IGS_DRAW_ALL 0x00000000 -#define IGS_DRAW_NOT_FIRST 0x00000010 -#define IGS_DRAW_NOT_LAST 0x00000020 -#define IGS_DRAW_NOT_FIRST_LAST 0x00000030 - -/* TRPS[1:0] */ -#define IGS_TRANS_SRC1 0x00000000 -#define IGS_TRANS_SRC2 0x00000100 -#define IGS_TRANS_DST 0x00000200 -/* TRPS2 Transparent Invert */ -#define IGS_TRANS_INVERT 0x00000400 -/* TRPS3, Transparent Enable */ -#define IGS_TRANS_ENABLE 0x00000800 - -/* PPS[3:0], Pattern Pixel Select */ -#define IGS_PIXEL_TEXT_OPAQUE 0x00001000 -#define IGS_PIXEL_STIP_OPAQUE 0x00002000 -#define IGS_PIXEL_LINE_OPAQUE 0x00003000 -#define IGS_PIXEL_TEXT_TRANS 0x00005000 -#define IGS_PIXEL_STIP_TRANS 0x00006000 -#define IGS_PIXEL_LINE_TRANS 0x00007000 -#define IGS_PIXEL_FG 0x00008000 -#define IGS_PIXEL_TILE 0x00009000 -#define IGS_PIXEL_TILE_OPAQUE 0x0000d000 - -/* HostBltEnable[1:0] */ -#define IGS_HBLT_DISABLE 0x00000000 -#define IGS_HBLT_READ 0x00010000 -#define IGS_HBLT_WRITE_1 0x00020000 -#define IGS_HBLT_WRITE_2 0x00030000 - -/* Src2MapSelect[2:0], Src2 map select mode */ -#define IGS_SRC2_NORMAL 0x00000000 -#define IGS_SRC2_MONO_OPAQUE 0x00100000 -#define IGS_SRC2_FG 0x00200000 -#define IGS_SRC2_MONO_TRANS 0x00500000 - -/* StepFunction[3:0], Step function select */ -#define IGS_STEP_DRAW_AND_STEP 0x04000000 -#define IGS_STEP_LINE_DRAW 0x05000000 -#define IGS_STEP_PXBLT 0x08000000 -#define IGS_STEP_INVERT_PXBLT 0x09000000 -#define IGS_STEP_TERNARY_PXBLT 0x0b000000 - -/* FGS */ -#define IGS_FGS_FG 0x00000000 -#define IGS_FGS_SRC 0x20000000 - -/* BGS */ -#define IGS_BGS_BG 0x00000000 -#define IGS_BGS_SRC 0x80000000 - VOL8 pad080[0x90]; /* 0x080 */ - - VOL32 debug_control; /* 0x110 */ - VOL8 pad114[0x04]; /* 0x114 */ - - VOL32 src2_stride; /* 0x118 */ - VOL8 pad11c[0x14]; /* 0x11c */ - - VOL32 extension; /* 0x130 */ - -#define IGS_BURST_ENABLE 0x01 -#define IGS_STYLE_LINE 0x02 -#define IGS_ADDITIONAL_WAIT 0x04 -#define IGS_BLOCK_COP_REG 0x08 -#define IGS_TURBO_MONO 0x10 -#define IGS_SELECT_SAMPLE 0x40 -#define IGS_MDSBL_RD_B_WR 0x80 -#define IGS_WRMRSTZ 0x100 -#define IGS_TEST_MTST 0x200 - - VOL32 style_line; /* 0x134 */ -#define IGS_MAKE_STILE_LINE(roll_over,inc,pattern,accumulator) \ - ((roll_over) | \ - ((style_line_inc) << 8) | \ - ((style_line_patern) << 16) | \ - ((style_line_accumullator) << 24)) - VOL32 style_line_pattern_index; /* 0x138 */ - - VOL32 mono_burst_total; /* 0x13c */ - VOL8 pad140[0x10]; /* 0x140 */ - - VOL32 pat_x_rotate; /* 0x150 */ - VOL8 pad154[0x1c]; /* 0x154 */ - - VOL32 src1_start; /* 0x170 */ - VOL32 src2_start; /* 0x174 */ - VOL32 dst_start; /* 0x178 */ - VOL8 pad17c[0x9c]; /* 0x17c */ - - VOL32 dst_stride; /* 0x218 */ -} Cop5xxx; - -typedef struct _igsCardInfo { - Cop5xxx *cop; - VOL8 *vga; - VOL32 *copData; - CARD8 *frameBuffer; - IgsVga igsvga; -} IgsCardInfo; - -#define getIgsCardInfo(kd) ((IgsCardInfo *) ((kd)->card->driver)) -#define igsCardInfo(kd) IgsCardInfo *igsc = getIgsCardInfo(kd) - -typedef struct _igsCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} IgsCursor; - -#define IGS_CURSOR_WIDTH 64 -#define IGS_CURSOR_HEIGHT 64 - -typedef struct _igsPattern { - INT32 xrot, yrot; - CARD32 serial_number; - CARD8 *base; - CARD32 offset; -} IgsPattern; - -#define IGS_NUM_PATTERN 8 -#define IGS_PATTERN_WIDTH 8 -#define IGS_PATTERN_HEIGHT 8 - -typedef struct _igsPatternCache { - CARD8 *base; - CARD32 offset; - IgsPattern pattern[IGS_NUM_PATTERN]; - int next; -} IgsPatternCache; - -typedef struct _igsScreenInfo { - CARD8 *cursor_base; - CARD32 cursor_offset; - IgsCursor cursor; - IgsPatternCache tile; - IgsPatternCache stipple; -} IgsScreenInfo; - -#define IgsTileSize(bpp) (IGS_PATTERN_WIDTH*(bpp)/8*IGS_PATTERN_HEIGHT) -#define IgsStippleSize(bpp) (IGS_PATTERN_WIDTH/8*IGS_PATTERN_HEIGHT) - -#define getIgsScreenInfo(kd) ((IgsScreenInfo *) ((kd)->screen->driver)) -#define igsScreenInfo(kd) IgsScreenInfo *igss = getIgsScreenInfo(kd) - -Bool -igsDrawInit (ScreenPtr pScreen); - -void -igsDrawEnable (ScreenPtr pScreen); - -void -igsDrawDisable (ScreenPtr pScreen); - -void -igsDrawSync (ScreenPtr pScreen); - -void -igsDrawFini (ScreenPtr pScreen); - -void -igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -void -igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -Bool -igsCursorInit (ScreenPtr pScreen); - -void -igsCursorEnable (ScreenPtr pScreen); - -void -igsCursorDisable (ScreenPtr pScreen); - -void -igsCursorFini (ScreenPtr pScreen); - -#endif /* _IGS_H_ */ diff --git a/hw/kdrive/igs/igscmap.c b/hw/kdrive/igs/igscmap.c deleted file mode 100644 index dff028e7d..000000000 --- a/hw/kdrive/igs/igscmap.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2000 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "igs.h" - -#define IGS_DAC_SHIFT 8 -void -igsGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - IgsVga *igsvga = &igsc->igsvga; - - while (ndef--) - { - igsSetImm (igsvga, igs_dac_read_index, pdefs->pixel); - pdefs->red = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; - pdefs->green = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; - pdefs->blue = igsGetImm (igsvga, igs_dac_data) << IGS_DAC_SHIFT; - pdefs++; - } -} - -void -igsPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - IgsVga *igsvga = &igsc->igsvga; - - while (ndef--) - { - igsSetImm (igsvga, igs_dac_write_index, pdefs->pixel); - igsSetImm (igsvga, igs_dac_data, pdefs->red >> IGS_DAC_SHIFT); - igsSetImm (igsvga, igs_dac_data, pdefs->green >> IGS_DAC_SHIFT); - igsSetImm (igsvga, igs_dac_data, pdefs->blue >> IGS_DAC_SHIFT); - pdefs++; - } -} - diff --git a/hw/kdrive/igs/igscurs.c b/hw/kdrive/igs/igscurs.c deleted file mode 100644 index b8bd50956..000000000 --- a/hw/kdrive/igs/igscurs.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright © 2000 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "igs.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - igsCardInfo(pScreenPriv); \ - igsScreenInfo(pScreenPriv); \ - IgsCursor *pCurPriv = &igss->cursor; \ - IgsVga *igsvga = &igsc->igsvga - -static void -_igsMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - - igsSet (igsvga, igs_sprite_x, x); - igsSet (igsvga, igs_sprite_preset_x, xoff); - igsSet (igsvga, igs_sprite_y, y); - igsSet (igsvga, igs_sprite_preset_y, yoff); -} - -static void -igsMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _igsMoveCursor (pScreen, x, y); - VgaFlush (&igsvga->card); -} - - -static void -igsSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - igsSetImm (igsvga, igs_cursor_write_index, 0); - igsSetImm (igsvga, igs_cursor_data, pCursor->backRed >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->backGreen >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->backBlue >> 8); - igsSetImm (igsvga, igs_cursor_write_index, 1); - igsSetImm (igsvga, igs_cursor_data, pCursor->foreRed >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->foreGreen >> 8); - igsSetImm (igsvga, igs_cursor_data, pCursor->foreBlue >> 8); -} - -#if BITMAP_BIT_ORDER == MSBFirst -#define IgsAdjustCursor(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ - v = ((v & 0x00ff00ff) << 8) | ((v >> 8) & 0x00ff00ff); \ - v = ((v & 0x0000ffff) <<16) | ((v >>16) & 0x0000ffff); \ -} -#else -#define IgsAdjustCursor(v) -#endif - -#define ExplodeBits2(v) (((v) & 1) | (((v) & 2) << 1)) -#define ExplodeBits4(v) ((ExplodeBits2((v) >> 2) << 4) | \ - (ExplodeBits2((v) & 0x3))) -#define ExplodeBits8(v) ((ExplodeBits4((v) >> 4) << 8) | \ - (ExplodeBits4((v) & 0xf))) -#define ExplodeBits16(v) ((ExplodeBits8((v) >> 8) << 16) | \ - (ExplodeBits8((v) & 0xff))) -static void -igsLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - CARD32 b0, b1; - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (CARD32 *) igss->cursor_base; - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > IGS_CURSOR_HEIGHT) - h = IGS_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ - - for (i = 0; i < IGS_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < IGS_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - IgsAdjustCursor(m); - IgsAdjustCursor(s); - } - else - { - m = 0; - s = 0; - } - s &= m; - m = ~m; - b0 = ExplodeBits16(s&0xffff) | (ExplodeBits16(m&0xffff)<<1); - b1 = ExplodeBits16(s>>16) | (ExplodeBits16(m>>16)<<1); - *ram++ = b0; - *ram++ = b1; - } - } - - /* Set new color */ - igsSetCursorColors (pScreen); - - /* Set address for cursor bits */ - offset = igss->cursor_offset; - offset >>= 10; - igsSet (igsvga, igs_sprite_addr, offset); - - /* Assume TV interpolation off */ - igsSet (igsvga, igs_hcshf, 3); - /* Enable the cursor */ - igsSet (igsvga, igs_sprite_visible, 1); - igsSet (igsvga, igs_sprite_64x64, 1); - /* Move to new position */ - _igsMoveCursor (pScreen, x, y); - - VgaFlush (&igsvga->card); -} - -static void -igsUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - igsSet (igsvga, igs_sprite_visible, 0); - VgaFlush (&igsvga->card); -} - -static Bool -igsRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - igsLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -igsUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -igsSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - igsLoadCursor (pScreen, x, y); - else - igsUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec igsPointerSpriteFuncs = { - igsRealizeCursor, - igsUnrealizeCursor, - igsSetCursor, - igsMoveCursor, -}; - -static void -igsQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -igsCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!igss->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = IGS_CURSOR_WIDTH; - pCurPriv->height= IGS_CURSOR_HEIGHT; - pScreen->QueryBestSize = igsQueryBestSize; - miPointerInitialize (pScreen, - &igsPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -igsCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - igsLoadCursor (pScreen, x, y); - } - else - igsUnloadCursor (pScreen); - } -} - -void -igsCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - igsUnloadCursor (pScreen); - } - } -} - -void -igsCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/igs/igsdraw.c b/hw/kdrive/igs/igsdraw.c deleted file mode 100644 index 677436be5..000000000 --- a/hw/kdrive/igs/igsdraw.c +++ /dev/null @@ -1,1463 +0,0 @@ -/* - * Copyright © 2000 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "igs.h" -#include "igsdraw.h" - -#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" - -CARD8 igsPatRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -/* - * Handle pixel transfers - */ - -#define BURST -#ifdef BURST -#define PixTransDeclare VOL32 *pix_trans_base = igsc->copData,\ - *pix_trans = pix_trans_base -#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 16384) pix_trans = pix_trans_base -#define PixTransStore(t) *pix_trans++ = (t) -#else -#define PixTransDeclare VOL32 *pix_trans = igsc->copData -#define PixTransStart(n) -#define PixTransStore(t) *pix_trans = (t) -#endif - -static IgsPattern * -igsSetPattern (ScreenPtr pScreen, - PixmapPtr pPixmap, - CARD8 fillStyle, - INT32 xrot, - INT32 yrot) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - igsScreenInfo(pScreenPriv); - int i; - IgsPatternCache *c; - IgsPattern *p; - - if (fillStyle == FillTiled) - c = &igss->tile; - else - c = &igss->stipple; - for (i = 0; i < IGS_NUM_PATTERN; i++) - { - p = &c->pattern[i]; - if (p->serial_number == pPixmap->drawable.serialNumber && - p->xrot == xrot && - p->yrot == yrot) - { - return p; - } - } - p = &c->pattern[c->next]; - if (++c->next == IGS_NUM_PATTERN) - c->next = 0; - p->serial_number = pPixmap->drawable.serialNumber; - p->xrot = xrot; - p->yrot = yrot; - - if (fillStyle != FillTiled) - { - FbStip *pix; - FbStride pixStride; - int pixBpp; - int pixXoff, pixYoff; - CARD8 tmp[8]; - CARD32 *pat; - int stipX, stipY; - int y; - FbStip bits; - - fbGetStipDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, pixXoff, pixYoff); - - modulus (-yrot - pixYoff, pPixmap->drawable.height, stipY); - modulus (-xrot - pixXoff, FB_UNIT, stipX); - - pat = (CARD32 *) p->base; - - for (y = 0; y < 8; y++) - { - bits = pix[stipY * pixStride]; - FbRotLeft (bits, stipX); - tmp[y] = (CARD8) bits; - stipY++; - if (stipY == pPixmap->drawable.height) - stipY = 0; - } - for (i = 0; i < 2; i++) - { - bits = (tmp[i*4+0] | - (tmp[i*4+1] << 8) | - (tmp[i*4+2] << 16) | - (tmp[i*4+3] << 24)); - IgsAdjustBits32 (bits); - *pat++ = bits; - } - } - else - { - FbBits *pix; - FbStride pixStride; - int pixBpp; - FbBits *pat; - FbStride patStride; - int patBpp; - int patXoff, patYoff; - - fbGetDrawable (&pPixmap->drawable, pix, pixStride, pixBpp, patXoff, patYoff); - - pat = (FbBits *) p->base; - patBpp = pixBpp; - patStride = (patBpp * IGS_PATTERN_WIDTH) / (8 * sizeof (FbBits)); - - fbTile (pat, patStride, 0, - patBpp * IGS_PATTERN_WIDTH, IGS_PATTERN_HEIGHT, - - pix, pixStride, - pPixmap->drawable.width * pixBpp, - pPixmap->drawable.height, - GXcopy, FB_ALLONES, pixBpp, - (xrot - patXoff) * pixBpp, yrot - patYoff); - } - return p; -} - -void -igsFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - - _igsSetSolidRect(cop,alu,planemask,pixel,cmd); - while (nBox--) - { - _igsRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -void -igsFillBoxTiled (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - PixmapPtr pPixmap, int xrot, int yrot, int alu) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - IgsPattern *p = igsSetPattern (pDrawable->pScreen, - pPixmap, - FillTiled, - xrot, yrot); - - _igsSetTiledRect(cop,alu,planemask,p->offset,cmd); - while (nBox--) - { - _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -void -igsFillBoxStippled (DrawablePtr pDrawable, GCPtr pGC, - int nBox, BoxPtr pBox) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int xrot = pGC->patOrg.x + pDrawable->x; - int yrot = pGC->patOrg.y + pDrawable->y; - IgsPattern *p = igsSetPattern (pDrawable->pScreen, - pGC->stipple, - pGC->fillStyle, - xrot, yrot); - if (pGC->fillStyle == FillStippled) - { - _igsSetStippledRect (cop,pGC->alu,planemask,pGC->fgPixel,p->offset,cmd); - } - else - { - _igsSetOpaqueStippledRect (cop,pGC->alu,planemask, - pGC->fgPixel,pGC->bgPixel,p->offset,cmd); - } - while (nBox--) - { - _igsPatRect(cop,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - - -void -igsStipple (ScreenPtr pScreen, - CARD32 cmd, - FbStip *psrcBase, - FbStride widthSrc, - int srcx, - int srcy, - int dstx, - int dsty, - int width, - int height) -{ - SetupIgs(pScreen); - FbStip *psrcLine, *psrc; - FbStride widthRest; - FbStip bits, tmp, lastTmp; - int leftShift, rightShift; - int nl, nlMiddle; - int r; - PixTransDeclare; - - /* Compute blt address and parameters */ - psrc = psrcBase + srcy * widthSrc + (srcx >> 5); - nlMiddle = (width + 31) >> 5; - leftShift = srcx & 0x1f; - rightShift = 32 - leftShift; - widthRest = widthSrc - nlMiddle; - - _igsPlaneBlt(cop,dstx,dsty,width,height,cmd); - - if (leftShift == 0) - { - while (height--) - { - nl = nlMiddle; - PixTransStart(nl); - while (nl--) - { - tmp = *psrc++; - IgsAdjustBits32 (tmp); - PixTransStore (tmp); - } - psrc += widthRest; - } - } - else - { - widthRest--; - while (height--) - { - bits = *psrc++; - nl = nlMiddle; - PixTransStart(nl); - while (nl--) - { - tmp = FbStipLeft(bits, leftShift); - bits = *psrc++; - tmp |= FbStipRight(bits, rightShift); - IgsAdjustBits32(tmp); - PixTransStore (tmp); - } - psrc += widthRest; - } - } -} - -void -igsCopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupIgs(pDstDrawable->pScreen); - int srcX, srcY, dstX, dstY; - int w, h; - CARD32 flags; - CARD32 cmd; - CARD8 alu; - - if (pGC) - { - alu = pGC->alu; - if (sourceInvarient (pGC->alu)) - { - igsFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); - return; - } - } - else - alu = GXcopy; - - _igsSetBlt(cop,alu,pGC->planemask,reverse,upsidedown,cmd); - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - if (reverse) - dstX = pbox->x2 - 1; - else - dstX = pbox->x1; - srcX = dstX + dx; - - if (upsidedown) - dstY = pbox->y2 - 1; - else - dstY = pbox->y1; - - srcY = dstY + dy; - - _igsBlt (cop, srcX, srcY, dstX, dstY, w, h, cmd); - pbox++; - } - KdMarkSync (pDstDrawable->pScreen); -} - -RegionPtr -igsCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - KdScreenPriv(pDstDrawable->pScreen); - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pSrcDrawable->type == DRAWABLE_WINDOW && - pDstDrawable->type == DRAWABLE_WINDOW) - { - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, igsCopyNtoN, 0, 0); - } - return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, dsty); -} - -typedef struct _igs1toNargs { - unsigned long copyPlaneFG, copyPlaneBG; - Bool opaque; -} igs1toNargs; - -void -igsCopy1toN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupIgs(pDstDrawable->pScreen); - - igs1toNargs *args = closure; - int dstx, dsty; - FbStip *psrcBase; - FbStride widthSrc; - int srcBpp; - int srcXoff, srcYoff; - CARD32 cmd; - - if (args->opaque && sourceInvarient (pGC->alu)) - { - igsFillBoxSolid (pDstDrawable, nbox, pbox, - pGC->bgPixel, pGC->alu, pGC->planemask); - return; - } - - fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); - - if (args->opaque) - { - _igsSetOpaquePlaneBlt (cop, pGC->alu, pGC->planemask, args->copyPlaneFG, - args->copyPlaneBG, cmd); - } - else - { - _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, - args->copyPlaneFG, cmd); - } - - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - - igsStipple (pDstDrawable->pScreen, cmd, - psrcBase, widthSrc, - dstx + dx - srcXoff, dsty + dy - srcYoff, - dstx, dsty, - pbox->x2 - dstx, pbox->y2 - dsty); - pbox++; - } - KdMarkSync (pDstDrawable->pScreen); -} - -RegionPtr -igsCopyPlane (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty, - unsigned long bitPlane) -{ - RegionPtr ret; - igs1toNargs args; - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pDstDrawable->type == DRAWABLE_WINDOW && - pSrcDrawable->depth == 1) - { - args.copyPlaneFG = pGC->fgPixel; - args.copyPlaneBG = pGC->bgPixel; - args.opaque = TRUE; - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, igsCopy1toN, bitPlane, &args); - } - return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); -} - -#if 0 -/* would you believe this is slower than fb? */ -void -igsPushPixels (GCPtr pGC, - PixmapPtr pBitmap, - DrawablePtr pDrawable, - int w, - int h, - int x, - int y) -{ - igs1toNargs args; - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pDrawable->type == DRAWABLE_WINDOW && - pGC->fillStyle == FillSolid) - { - args.opaque = FALSE; - args.copyPlaneFG = pGC->fgPixel; - (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC, - 0, 0, w, h, x, y, igsCopy1toN, 1, &args); - } - else - { - KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); - } -} -#else -#define igsPushPixels KdCheckPushPixels -#endif - -BOOL -igsFillOk (GCPtr pGC) -{ - FbBits depthMask; - - depthMask = FbFullMask(pGC->depth); - if ((pGC->planemask & depthMask) != depthMask) - return FALSE; - switch (pGC->fillStyle) { - case FillSolid: - return TRUE; - case FillTiled: - return (igsPatternDimOk (pGC->tile.pixmap->drawable.width) && - igsPatternDimOk (pGC->tile.pixmap->drawable.height)); - case FillStippled: - case FillOpaqueStippled: - return (igsPatternDimOk (pGC->stipple->drawable.width) && - igsPatternDimOk (pGC->stipple->drawable.height)); - } - return FALSE; -} - -void -igsFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - SetupIgs(pDrawable->pScreen); - DDXPointPtr pptFree; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - int *pwidthFree;/* copies of the pointers to free */ - CARD32 cmd; - int nTmp; - INT16 x, y; - int width; - IgsPattern *p; - - if (!igsFillOk (pGC)) - { - KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); - return; - } - nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); - pwidthFree = (int *)xalloc(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - n = miClipSpans(fbGetCompositeClip(pGC), - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - switch (pGC->fillStyle) { - case FillSolid: - _igsSetSolidRect(cop,pGC->alu,pGC->planemask,pGC->fgPixel,cmd); - break; - case FillTiled: - p = igsSetPattern (pDrawable->pScreen, - pGC->tile.pixmap, - FillTiled, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y); - _igsSetTiledRect (cop,pGC->alu,pGC->planemask,p->offset,cmd); - break; - default: - p = igsSetPattern (pDrawable->pScreen, - pGC->stipple, - pGC->fillStyle, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y); - if (pGC->fillStyle == FillStippled) - { - _igsSetStippledRect (cop,pGC->alu,pGC->planemask, - pGC->fgPixel,p->offset,cmd); - } - else - { - _igsSetOpaqueStippledRect (cop,pGC->alu,pGC->planemask, - pGC->fgPixel,pGC->bgPixel,p->offset,cmd); - } - break; - } - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - width = *pwidth++; - if (width) - { - _igsPatRect(cop,x,y,width,1,cmd); - } - } - xfree(pptFree); - xfree(pwidthFree); - KdMarkSync (pDrawable->pScreen); -} - -#define NUM_STACK_RECTS 1024 - -void -igsPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - SetupIgs(pDrawable->pScreen); - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); - int numRects; - int n; - int xorg, yorg; - int x, y; - - if (!igsFillOk (pGC)) - { - KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); - return; - } - prgnClip = fbGetCompositeClip (pGC); - xorg = pDrawable->x; - yorg = pDrawable->y; - - if (xorg || yorg) - { - prect = prectInit; - n = nrectFill; - while(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) - { - switch (pGC->fillStyle) { - case FillSolid: - igsFillBoxSolid(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->fgPixel, pGC->alu, pGC->planemask); - break; - case FillTiled: - igsFillBoxTiled(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->tile.pixmap, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y, - pGC->alu); - break; - case FillStippled: - case FillOpaqueStippled: - igsFillBoxStippled (pDrawable, pGC, - pboxClipped-pboxClippedBase, pboxClippedBase); - break; - } - } - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} - -int -igsTextInRegion (GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppci) -{ - int w; - FontPtr pfont = pGC->font; - BoxRec bbox; - - if (FONTCONSTMETRICS(pfont)) - w = FONTMAXBOUNDS(pfont,characterWidth) * nglyph; - else - { - w = 0; - while (nglyph--) - w += (*ppci++)->metrics.characterWidth; - } - if (w < 0) - { - bbox.x1 = x + w; - bbox.x2 = x; - } - else - { - bbox.x1 = x; - bbox.x2 = x + w; - } - w = FONTMINBOUNDS(pfont,leftSideBearing); - if (w < 0) - bbox.x1 += w; - w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); - if (w > 0) - bbox.x2 += w; - bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); - bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); - - return RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox); -} - -void -igsGlyphBltClipped (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - Bool image) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int h; - int w; - int xBack, yBack; - int hBack, wBack; - int lw; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *bits; - BoxPtr extents; - BoxRec bbox; - CARD32 b; - CharInfoPtr *ppci; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - RegionPtr pClip = fbGetCompositeClip(pGC); - BoxPtr pBox; - int nbox; - int x1, y1, x2, y2; - unsigned char alu; - Bool set; - PixTransDeclare; - - if (image) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - h = nglyph; - ppci = ppciInit; - while (h--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - if (wBack) - { - _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd); - for (nbox = REGION_NUM_RECTS (pClip), - pBox = REGION_RECTS (pClip); - nbox--; - pBox++) - { - x1 = xBack; - x2 = xBack + wBack; - y1 = yBack; - y2 = yBack + hBack; - if (x1 < pBox->x1) x1 = pBox->x1; - if (x2 > pBox->x2) x2 = pBox->x2; - if (y1 < pBox->y1) y1 = pBox->y1; - if (y2 > pBox->y2) y2 = pBox->y2; - if (x1 < x2 && y1 < y2) - { - _igsRect (cop, x1, y1, x2 - x1, y2 - y1, cmd); - } - } - KdMarkSync (pDrawable->pScreen); - } - } - else - { - wBack = 0; - alu = pGC->alu; - } - - ppci = ppciInit; - set = FALSE; - while (nglyph--) - { - pci = *ppci++; - h = pci->metrics.ascent + pci->metrics.descent; - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - x1 = x + pci->metrics.leftSideBearing; - y1 = y - pci->metrics.ascent; - bbox.x1 = x1; - bbox.y1 = y1; - bbox.x2 = x1 + w; - bbox.y2 = y1 + h; - switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox)) - { - case rgnIN: - lw = h * ((w + 31) >> 5); - if (lw) - { - if (!set) - { - _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd); - set = TRUE; - } - _igsPlaneBlt(cop, - x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, - w, h, cmd); - bits = (unsigned long *) pci->bits; - PixTransStart (lw); - while (lw--) - { - b = *bits++; - IgsAdjustBits32 (b); - PixTransStore(b); - } - KdMarkSync (pDrawable->pScreen); - } - break; - case rgnPART: - set = FALSE; - KdCheckSync (pDrawable->pScreen); - fbPutXYImage (pDrawable, - pClip, - fbPriv->fg, - fbPriv->bg, - fbPriv->pm, - alu, - FALSE, - x1, y1, - w, h, - (FbStip *) pci->bits, - (w + 31) >> 5, - 0); - break; - case rgnOUT: - break; - } - x += pci->metrics.characterWidth; - } -} - -void -igsGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - Bool image) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int h; - int w; - int xBack, yBack; - int hBack, wBack; - int lw; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *bits; - BoxPtr extents; - BoxRec bbox; - CARD32 b; - CharInfoPtr *ppci; - unsigned char alu; - PixTransDeclare; - - /* - * Paint background for image text - */ - if (image) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - h = nglyph; - ppci = ppciInit; - while (h--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - if (wBack) - { - _igsSetSolidRect (cop, GXcopy, pGC->planemask, pGC->bgPixel, cmd); - _igsRect (cop, xBack, yBack, wBack, hBack, cmd); - } - } - else - { - wBack = 0; - alu = pGC->alu; - } - - _igsSetTransparentPlaneBlt (cop, alu, pGC->planemask, pGC->fgPixel, cmd); - ppci = ppciInit; - while (nglyph--) - { - pci = *ppci++; - h = pci->metrics.ascent + pci->metrics.descent; - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - lw = h * ((w + 31) >> 5); - if (lw) - { - _igsPlaneBlt(cop, - x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, - w, h, cmd); - bits = (unsigned long *) pci->bits; - PixTransStart(lw); - while (lw--) - { - b = *bits++; - IgsAdjustBits32 (b); - PixTransStore(b); - } - } - x += pci->metrics.characterWidth; - } - KdMarkSync (pDrawable->pScreen); -} - -void -igsTEGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, - int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - Bool image) -{ - SetupIgs(pDrawable->pScreen); - CARD32 cmd; - int x, y; - int h, lw, lwTmp; - int w; - FontPtr pfont = pGC->font; - unsigned long *char1, *char2, *char3, *char4; - int widthGlyphs, widthGlyph; - BoxRec bbox; - CARD32 tmp; - PixTransDeclare; - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - if (!widthGlyph) - return; - - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - if (!h) - return; - - x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing); - y = yInit - FONTASCENT(pfont); - - if (image) - { - _igsSetOpaquePlaneBlt (cop, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel, cmd); - } - else - { - _igsSetTransparentPlaneBlt (cop, pGC->alu, pGC->planemask, pGC->fgPixel, cmd); - } - -#if BITMAP_BIT_ORDER == LSBFirst -#define SHIFT << -#else -#define SHIFT >> -#endif - -#define LoopIt(count, w, loadup, fetch) \ - while (nglyph >= count) \ - { \ - nglyph -= count; \ - _igsPlaneBlt (cop, x, y, w, h, cmd); \ - x += w; \ - loadup \ - lwTmp = h; \ - PixTransStart(h); \ - while (lwTmp--) { \ - tmp = fetch; \ - IgsAdjustBits32(tmp); \ - PixTransStore(tmp); \ - } \ - } - - if (widthGlyph <= 8) - { - widthGlyphs = widthGlyph << 2; - LoopIt(4, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits; - char4 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | ((*char3++ | (*char4++ - SHIFT widthGlyph)) - SHIFT widthGlyph)) - SHIFT widthGlyph))) - } - else if (widthGlyph <= 10) - { - widthGlyphs = (widthGlyph << 1) + widthGlyph; - LoopIt(3, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph))) - } - else if (widthGlyph <= 16) - { - widthGlyphs = widthGlyph << 1; - LoopIt(2, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | (*char2++ SHIFT widthGlyph))) - } - lw = h * ((widthGlyph + 31) >> 5); - while (nglyph--) - { - _igsPlaneBlt (cop, x, y, widthGlyph, h, cmd); - x += widthGlyph; - char1 = (unsigned long *) (*ppci++)->bits; - lwTmp = lw; - PixTransStart(lw); - while (lwTmp--) - { - tmp = *char1++; - IgsAdjustBits32(tmp); - PixTransStore(tmp); - } - } - KdMarkSync (pDrawable->pScreen); -} - -/* - * Blt glyphs using image transfer window - */ - -void -igsPolyGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - if (pGC->fillStyle != FillSolid || - fbGetGCPrivate(pGC)->pm != FB_ALLONES) - { - KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - return; - } - x += pDrawable->x; - y += pDrawable->y; - - switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) { - case rgnIN: - if (TERMINALFONT(pGC->font)) - igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE); - else - igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE); - break; - case rgnPART: - igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, FALSE); - break; - case rgnOUT: - break; - } -} - -void -igsImageGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - if (fbGetGCPrivate(pGC)->pm != FB_ALLONES) - { - KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - return; - } - x += pDrawable->x; - y += pDrawable->y; - - switch (igsTextInRegion (pGC, x, y, nglyph, ppci)) { - case rgnIN: - if (TERMINALFONT(pGC->font)) - igsTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE); - else - igsGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE); - break; - case rgnPART: - igsGlyphBltClipped (pDrawable, pGC, x, y, nglyph, ppci, TRUE); - break; - case rgnOUT: - break; - } -} - -static void -igsInvalidatePattern (IgsPatternCache *c, - PixmapPtr pPixmap) -{ - int i; - - if (c->base) - { - for (i = 0; i < IGS_NUM_PATTERN; i++) - { - if (c->pattern[i].serial_number == pPixmap->drawable.serialNumber) - c->pattern[i].serial_number = ~0; - } - } -} - -static void -igsInitPattern (IgsPatternCache *c, int bsize, int psize) -{ - int i; - int boffset; - int poffset; - - for (i = 0; i < IGS_NUM_PATTERN; i++) - { - boffset = i * bsize; - poffset = i * psize; - c->pattern[i].xrot = -1; - c->pattern[i].yrot = -1; - c->pattern[i].serial_number = ~0; - c->pattern[i].offset = c->offset + poffset; - c->pattern[i].base = c->base + boffset; - } - c->next = 0; -} - -static const GCOps igsOps = { - igsFillSpans, - KdCheckSetSpans, - KdCheckPutImage, - igsCopyArea, - igsCopyPlane, - KdCheckPolyPoint, - KdCheckPolylines, - KdCheckPolySegment, - miPolyRectangle, - KdCheckPolyArc, - miFillPolygon, - igsPolyFillRect, - KdCheckPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - igsImageGlyphBlt, - igsPolyGlyphBlt, - igsPushPixels, -}; - -void -igsValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) -{ - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - - fbValidateGC (pGC, changes, pDrawable); - - if (pDrawable->type == DRAWABLE_WINDOW) - pGC->ops = (GCOps *) &igsOps; - else - pGC->ops = (GCOps *) &fbGCOps; -} - -GCFuncs igsGCFuncs = { - igsValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -int -igsCreateGC (GCPtr pGC) -{ - if (!fbCreateGC (pGC)) - return FALSE; - - if (pGC->depth != 1) - pGC->funcs = &igsGCFuncs; - - return TRUE; -} - -void -igsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - KdScreenPriv(pScreen); - RegionRec rgnDst; - int dx, dy; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - 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); - - fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - 0, - &rgnDst, dx, dy, igsCopyNtoN, 0, 0); - - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - - -Bool -igsDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - igsCardInfo(pScreenPriv); - igsScreenInfo(pScreenPriv); - int i; - int pattern_size; - int boffset, poffset; - - KdScreenInitAsync (pScreen); - - /* - * Replace various fb screen functions - */ - pScreen->CreateGC = igsCreateGC; - pScreen->CopyWindow = igsCopyWindow; - - /* - * Initialize patterns - */ - if (igss->tile.base) - { - pattern_size = IgsTileSize(pScreenPriv->screen->fb[0].bitsPerPixel); - igsInitPattern (&igss->tile, - pattern_size, - pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel); - pattern_size = IgsStippleSize(pScreenPriv->screen->fb[0].bitsPerPixel); - igsInitPattern (&igss->stipple, - pattern_size, - pattern_size * 8 / pScreenPriv->screen->fb[0].bitsPerPixel); - } - return TRUE; -} - -void -igsDrawEnable (ScreenPtr pScreen) -{ - SetupIgs(pScreen); - CARD32 cmd; - CARD32 base; - CARD16 stride; - CARD32 format; - - stride = pScreenPriv->screen->fb[0].pixelStride; - _igsWaitIdleEmpty(cop); - _igsReset(cop); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - format = IGS_FORMAT_8BPP; - break; - case 16: - format = IGS_FORMAT_16BPP; - break; - case 24: - format = IGS_FORMAT_24BPP; - break; - case 32: - format = IGS_FORMAT_32BPP; - break; - } - cop->format = format; - cop->dst_stride = stride - 1; - cop->src1_stride = stride - 1; - cop->src2_stride = stride - 1; - cop->src1_start = 0; - cop->src2_start = 0; - cop->extension |= IGS_BLOCK_COP_REG | IGS_BURST_ENABLE; - - _igsSetSolidRect(cop, GXcopy, ~0, pScreen->blackPixel, cmd); - _igsRect (cop, 0, 0, - pScreenPriv->screen->width, pScreenPriv->screen->height, - cmd); - _igsWaitIdleEmpty (cop); -} - -void -igsDrawDisable (ScreenPtr pScreen) -{ -} - -void -igsDrawFini (ScreenPtr pScreen) -{ -} - -void -igsDrawSync (ScreenPtr pScreen) -{ - SetupIgs(pScreen); - - _igsWaitIdleEmpty(cop); -} diff --git a/hw/kdrive/igs/igsdraw.h b/hw/kdrive/igs/igsdraw.h deleted file mode 100644 index ab80f9acd..000000000 --- a/hw/kdrive/igs/igsdraw.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright © 2000 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. - */ - -#ifndef _IGSDRAW_H_ -#define _IGSDRAW_H_ - -extern CARD8 igsPatRop[]; - -#define SetupIgs(s) KdScreenPriv(s); \ - igsCardInfo(pScreenPriv); \ - Cop5xxx *cop = igsc->cop; \ - int cop_stride = pScreenPriv->screen->fb[0].pixelStride - -#define _igsWaitLoop(cop,mask,value) { \ - int __loop = 1000000; \ - while (((cop)->control & (mask)) != (value)) { \ - if (--__loop <= 0) { \ - FatalError("Warning: igsWaitLoop 0x%x 0x%x failed\n", mask, value); \ - } \ - } \ -} - -#define _igsWaitDone(cop) _igsWaitLoop(cop, \ - (IGS_CONTROL_BUSY| \ - IGS_CONTROL_MALLWBEPTZ), \ - 0) - -#if 1 -#define _igsWaitFull(cop) _igsWaitLoop(cop, \ - IGS_CONTROL_CMDFF, \ - 0) -#else -#define _igsWaitFull(cop) _igsWaitDone(cop) -#endif - -#define _igsWaitIdleEmpty(cop) _igsWaitDone(cop) -#define _igsWaitHostBltAck(cop) _igsWaitLoop(cop, \ - (IGS_CONTROL_HBACKZ| \ - IGS_CONTROL_CMDFF), \ - 0) - -#define _igsReset(cop) ((cop)->control = 0) - -#define IgsInvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -#define IgsInvertBits16(v) { \ - v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ - v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ - v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ -} - -#define IgsInvertBits8(v) { \ - v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ - v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ - v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ -} - -#define IgsByteSwap32(x) ((x) = (((x) >> 24) | \ - (((x) >> 8) & 0xff00) | \ - (((x) << 8) & 0xff0000) | \ - ((x) << 24))) - -#define IgsByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8)) - -#define igsPatternDimOk(d) ((d) <= IGS_PATTERN_WIDTH && (((d) & ((d) - 1)) == 0)) - -#if BITMAP_BIT_ORDER == LSBFirst -#define IgsAdjustBits32(b) IgsInvertBits32(b) -#define IgsAdjustBits16(x) IgsInvertBits16(x) -#else -#define IgsAdjustBits32(x) IgsByteSwap32(x) -#define IgsAdjustBits16(x) IgsByteSwap16(x) -#endif - -#define _igsSetSolidRect(cop,alu,pm,pix,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->fg = (pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsSetTiledRect(cop,alu,pm,base,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_stride = IGS_PATTERN_WIDTH - 1; \ - (cop)->src1_start = (base); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_TILE | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_SRC | \ - IGS_BGS_BG); \ -} - -#define _igsSetStippledRect(cop,alu,pm,pix,base,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_start = (base); \ - (cop)->fg = (pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_STIP_TRANS | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsSetOpaqueStippledRect(cop,alu,pm,_fg,_bg,base,cmd) {\ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_start = (base); \ - (cop)->fg = (_fg); \ - (cop)->bg = (_bg); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_STIP_OPAQUE | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsRect(cop,x,y,w,h,cmd) { \ - _igsWaitFull(cop); \ - (cop)->dst_start = (x) + (y) * (cop_stride); \ - (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ - (cop)->operation = (cmd); \ -} - -#define _igsPatRect(cop,x,y,w,h,cmd) { \ - _igsWaitFull(cop); \ - (cop)->dst_start = (x) + (y) * (cop_stride); \ - (cop)->rotate = IGS_MAKE_ROTATE(x&7,y&7); \ - (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ - (cop)->operation = (cmd); \ -} - -#define _igsSetBlt(cop,alu,pm,backwards,upsidedown,cmd) { \ - _igsWaitFull(cop); \ - (cop)->mix = IGS_MAKE_MIX(alu,alu); \ - (cop)->src1_stride = cop_stride - 1; \ - (cmd) = (IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_DISABLE | \ - IGS_SRC2_NORMAL | \ - IGS_STEP_PXBLT | \ - IGS_FGS_SRC | \ - IGS_BGS_BG); \ - if (backwards) (cmd) |= IGS_DRAW_R_L; \ - if (upsidedown) (cmd) |= IGS_DRAW_B_T; \ -} - -#if 0 -#define _igsPreparePlaneBlt(cop) { \ - _igsReset(cop); \ - (cop)->dst_stride = cop_stride - 1; \ - (cop)->src1_stride = cop_stride - 1; \ - (cop)->src2_stride = cop_stride - 1; \ - (cop)->format = IGS_FORMAT_16BPP; \ - (cop)->src1_start = 0; \ - (cop)->src2_start = 0; \ -} -#else -#define _igsPreparePlaneBlt(cop) -#endif - -#define _igsSetTransparentPlaneBlt(cop,alu,pm,fg_pix,cmd) { \ - _igsWaitIdleEmpty(cop); \ - _igsPreparePlaneBlt(cop); \ - (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \ - (cop)->fg = (fg_pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_WRITE_2 | \ - IGS_SRC2_MONO_TRANS | \ - IGS_STEP_TERNARY_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsSetOpaquePlaneBlt(cop,alu,pm,fg_pix,bg_pix,cmd) { \ - _igsWaitIdleEmpty(cop); \ - _igsPreparePlaneBlt(cop); \ - (cop)->mix = IGS_MAKE_MIX(igsPatRop[alu],igsPatRop[alu]); \ - (cop)->fg = (fg_pix); \ - (cop)->bg = (bg_pix); \ - (cmd) = (IGS_DRAW_T_B | \ - IGS_DRAW_L_R | \ - IGS_DRAW_ALL | \ - IGS_PIXEL_FG | \ - IGS_HBLT_WRITE_2 | \ - IGS_SRC2_MONO_OPAQUE | \ - IGS_STEP_TERNARY_PXBLT | \ - IGS_FGS_FG | \ - IGS_BGS_BG); \ -} - -#define _igsPlaneBlt(cop,x,y,w,h,cmd) { \ -/* _igsWaitFull(cop); */ \ - (cop)->dst_start = (x) + (y) * (cop_stride); \ - (cop)->dim = IGS_MAKE_DIM((w)-1,(h)-1); \ - (cop)->operation = (cmd); \ -/* _igsWaitHostBltAck(cop); */ \ -} - -#define _igsBlt(cop,sx,sy,dx,dy,w,h,cmd) { \ - _igsWaitFull(cop); \ - (cop)->dst_start = (dx) + (dy) * cop_stride; \ - (cop)->src1_start = (sx) + (sy) * cop_stride; \ - (cop)->src1_stride = cop_stride - 1; \ - (cop)->dim = IGS_MAKE_DIM(w-1,h-1); \ - (cop)->operation = (cmd); \ -} - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#endif diff --git a/hw/kdrive/igs/igsreg.c b/hw/kdrive/igs/igsreg.c deleted file mode 100644 index 6d6f28b73..000000000 --- a/hw/kdrive/igs/igsreg.c +++ /dev/null @@ -1,969 +0,0 @@ -/* - * Copyright © 2000 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "igsreg.h" -#include <stdio.h> - -#define CR00 IGS_CR+0x00 -#define CR01 IGS_CR+0x01 -#define CR02 IGS_CR+0x02 -#define CR03 IGS_CR+0x03 -#define CR04 IGS_CR+0x04 -#define CR05 IGS_CR+0x05 -#define CR06 IGS_CR+0x06 -#define CR07 IGS_CR+0x07 -#define CR08 IGS_CR+0x08 -#define CR09 IGS_CR+0x09 -#define CR0A IGS_CR+0x0A -#define CR0B IGS_CR+0x0B -#define CR0C IGS_CR+0x0C -#define CR0D IGS_CR+0x0D -#define CR0E IGS_CR+0x0E -#define CR0F IGS_CR+0x0F -#define CR10 IGS_CR+0x10 -#define CR11 IGS_CR+0x11 -#define CR12 IGS_CR+0x12 -#define CR13 IGS_CR+0x13 -#define CR14 IGS_CR+0x14 -#define CR15 IGS_CR+0x15 -#define CR16 IGS_CR+0x16 -#define CR17 IGS_CR+0x17 -#define CR18 IGS_CR+0x18 -#define CR19 IGS_CR+0x19 -#define CR1A IGS_CR+0x1A -#define CR1B IGS_CR+0x1B -#define CR1C IGS_CR+0x1C -#define CR1D IGS_CR+0x1D -#define CR1E IGS_CR+0x1E -#define CR1F IGS_CR+0x1F -#define CR20 IGS_CR+0x20 -#define CR21 IGS_CR+0x21 -#define CR22 IGS_CR+0x22 -#define CR23 IGS_CR+0x23 -#define CR24 IGS_CR+0x24 -#define CR25 IGS_CR+0x25 -#define CR26 IGS_CR+0x26 -#define CR27 IGS_CR+0x27 -#define CR28 IGS_CR+0x28 -#define CR29 IGS_CR+0x29 -#define CR2A IGS_CR+0x2A -#define CR2B IGS_CR+0x2B -#define CR2C IGS_CR+0x2C -#define CR2D IGS_CR+0x2D -#define CR2E IGS_CR+0x2E -#define CR2F IGS_CR+0x2F -#define CR30 IGS_CR+0x30 -#define CR31 IGS_CR+0x31 -#define CR32 IGS_CR+0x32 -#define CR33 IGS_CR+0x33 -#define CR34 IGS_CR+0x34 -#define CR35 IGS_CR+0x35 -#define CR36 IGS_CR+0x36 -#define CR37 IGS_CR+0x37 -#define CR38 IGS_CR+0x38 -#define CR39 IGS_CR+0x39 -#define CR3A IGS_CR+0x3A -#define CR3B IGS_CR+0x3B -#define CR3C IGS_CR+0x3C -#define CR3D IGS_CR+0x3D -#define CR3E IGS_CR+0x3E -#define CR3F IGS_CR+0x3F -#define CR40 IGS_CR+0x40 -#define CR41 IGS_CR+0x41 -#define CR42 IGS_CR+0x42 -#define CR43 IGS_CR+0x43 -#define CR44 IGS_CR+0x44 -#define CR45 IGS_CR+0x45 -#define CR46 IGS_CR+0x46 -#define CR47 IGS_CR+0x47 -#define CR48 IGS_CR+0x48 - -#define CR_FIRST CR00 -#define CR_LAST CR48 - -#define SR00 IGS_SR+0x00 -#define SR01 IGS_SR+0x01 -#define SR02 IGS_SR+0x02 -#define SR03 IGS_SR+0x03 -#define SR04 IGS_SR+0x04 - -#define SR_FIRST SR00 -#define SR_LAST SR04 - -#define AR00 IGS_AR+0x00 -#define AR01 IGS_AR+0x01 -#define AR02 IGS_AR+0x02 -#define AR03 IGS_AR+0x03 -#define AR04 IGS_AR+0x04 -#define AR05 IGS_AR+0x05 -#define AR06 IGS_AR+0x06 -#define AR07 IGS_AR+0x07 -#define AR08 IGS_AR+0x08 -#define AR09 IGS_AR+0x09 -#define AR0A IGS_AR+0x0A -#define AR0B IGS_AR+0x0B -#define AR0C IGS_AR+0x0C -#define AR0D IGS_AR+0x0D -#define AR0E IGS_AR+0x0E -#define AR0F IGS_AR+0x0F -#define AR10 IGS_AR+0x10 -#define AR11 IGS_AR+0x11 -#define AR12 IGS_AR+0x12 -#define AR13 IGS_AR+0x13 -#define AR14 IGS_AR+0x14 - -#define AR_FIRST AR00 -#define AR_LAST AR14 - -#define GR00 IGS_GR+0x00 -#define GR01 IGS_GR+0x01 -#define GR02 IGS_GR+0x02 -#define GR03 IGS_GR+0x03 -#define GR04 IGS_GR+0x04 -#define GR05 IGS_GR+0x05 -#define GR06 IGS_GR+0x06 -#define GR07 IGS_GR+0x07 -#define GR08 IGS_GR+0x08 -#define GR09 IGS_GR+0x09 -#define GR0A IGS_GR+0x0A -#define GR0B IGS_GR+0x0B -#define GR0C IGS_GR+0x0C -#define GR0D IGS_GR+0x0D -#define GR0E IGS_GR+0x0E -#define GR0F IGS_GR+0x0F -#define GR10 IGS_GR+0x10 -#define GR11 IGS_GR+0x11 -#define GR12 IGS_GR+0x12 -#define GR13 IGS_GR+0x13 -#define GR14 IGS_GR+0x14 -#define GR15 IGS_GR+0x15 -#define GR16 IGS_GR+0x16 -#define GR17 IGS_GR+0x17 -#define GR18 IGS_GR+0x18 -#define GR19 IGS_GR+0x19 -#define GR1A IGS_GR+0x1A -#define GR1B IGS_GR+0x1B -#define GR1C IGS_GR+0x1C -#define GR1D IGS_GR+0x1D -#define GR1E IGS_GR+0x1E -#define GR1F IGS_GR+0x1F -#define GR20 IGS_GR+0x20 -#define GR21 IGS_GR+0x21 -#define GR22 IGS_GR+0x22 -#define GR23 IGS_GR+0x23 -#define GR24 IGS_GR+0x24 -#define GR25 IGS_GR+0x25 -#define GR26 IGS_GR+0x26 -#define GR27 IGS_GR+0x27 -#define GR28 IGS_GR+0x28 -#define GR29 IGS_GR+0x29 -#define GR2A IGS_GR+0x2A -#define GR2B IGS_GR+0x2B -#define GR2C IGS_GR+0x2C -#define GR2D IGS_GR+0x2D -#define GR2E IGS_GR+0x2E -#define GR2F IGS_GR+0x2F -#define GR30 IGS_GR+0x30 -#define GR31 IGS_GR+0x31 -#define GR32 IGS_GR+0x32 -#define GR33 IGS_GR+0x33 -#define GR34 IGS_GR+0x34 -#define GR35 IGS_GR+0x35 -#define GR36 IGS_GR+0x36 -#define GR37 IGS_GR+0x37 -#define GR38 IGS_GR+0x38 -#define GR39 IGS_GR+0x39 -#define GR3A IGS_GR+0x3A -#define GR3B IGS_GR+0x3B -#define GR3C IGS_GR+0x3C -#define GR3D IGS_GR+0x3D -#define GR3E IGS_GR+0x3E -#define GR3F IGS_GR+0x3F -#define GR40 IGS_GR+0x40 -#define GR41 IGS_GR+0x41 -#define GR42 IGS_GR+0x42 -#define GR43 IGS_GR+0x43 -#define GR44 IGS_GR+0x44 -#define GR45 IGS_GR+0x45 -#define GR46 IGS_GR+0x46 -#define GR47 IGS_GR+0x47 -#define GR48 IGS_GR+0x48 -#define GR49 IGS_GR+0x49 -#define GR4A IGS_GR+0x4A -#define GR4B IGS_GR+0x4B -#define GR4C IGS_GR+0x4C -#define GR4D IGS_GR+0x4D -#define GR4E IGS_GR+0x4E -#define GR4F IGS_GR+0x4F -#define GR50 IGS_GR+0x50 -#define GR51 IGS_GR+0x51 -#define GR52 IGS_GR+0x52 -#define GR53 IGS_GR+0x53 -#define GR54 IGS_GR+0x54 -#define GR55 IGS_GR+0x55 -#define GR56 IGS_GR+0x56 -#define GR57 IGS_GR+0x57 -#define GR58 IGS_GR+0x58 -#define GR59 IGS_GR+0x59 -#define GR5A IGS_GR+0x5A -#define GR5B IGS_GR+0x5B -#define GR5C IGS_GR+0x5C -#define GR5D IGS_GR+0x5D -#define GR5E IGS_GR+0x5E -#define GR5F IGS_GR+0x5F -#define GR60 IGS_GR+0x60 -#define GR61 IGS_GR+0x61 -#define GR62 IGS_GR+0x62 -#define GR63 IGS_GR+0x63 -#define GR64 IGS_GR+0x64 -#define GR65 IGS_GR+0x65 -#define GR66 IGS_GR+0x66 -#define GR67 IGS_GR+0x67 -#define GR68 IGS_GR+0x68 -#define GR69 IGS_GR+0x69 -#define GR6A IGS_GR+0x6A -#define GR6B IGS_GR+0x6B -#define GR6C IGS_GR+0x6C -#define GR6D IGS_GR+0x6D -#define GR6E IGS_GR+0x6E -#define GR6F IGS_GR+0x6F -#define GR70 IGS_GR+0x70 -#define GR71 IGS_GR+0x71 -#define GR72 IGS_GR+0x72 -#define GR73 IGS_GR+0x73 -#define GR74 IGS_GR+0x74 -#define GR75 IGS_GR+0x75 -#define GR76 IGS_GR+0x76 -#define GR77 IGS_GR+0x77 -#define GR78 IGS_GR+0x78 -#define GR79 IGS_GR+0x79 -#define GR7A IGS_GR+0x7A -#define GR7B IGS_GR+0x7B -#define GR7C IGS_GR+0x7C -#define GR7D IGS_GR+0x7D -#define GR7E IGS_GR+0x7E -#define GR7F IGS_GR+0x7F -#define GR80 IGS_GR+0x80 -#define GR81 IGS_GR+0x81 -#define GR82 IGS_GR+0x82 -#define GR83 IGS_GR+0x83 -#define GR84 IGS_GR+0x84 -#define GR85 IGS_GR+0x85 -#define GR86 IGS_GR+0x86 -#define GR87 IGS_GR+0x87 -#define GR88 IGS_GR+0x88 -#define GR89 IGS_GR+0x89 -#define GR8A IGS_GR+0x8A -#define GR8B IGS_GR+0x8B -#define GR8C IGS_GR+0x8C -#define GR8D IGS_GR+0x8D -#define GR8E IGS_GR+0x8E -#define GR8F IGS_GR+0x8F -#define GR90 IGS_GR+0x90 -#define GR91 IGS_GR+0x91 -#define GR92 IGS_GR+0x92 -#define GR93 IGS_GR+0x93 -#define GR94 IGS_GR+0x94 -#define GR95 IGS_GR+0x95 -#define GR96 IGS_GR+0x96 -#define GR97 IGS_GR+0x97 -#define GR98 IGS_GR+0x98 -#define GR99 IGS_GR+0x99 -#define GR9A IGS_GR+0x9A -#define GR9B IGS_GR+0x9B -#define GR9C IGS_GR+0x9C -#define GR9D IGS_GR+0x9D -#define GR9E IGS_GR+0x9E -#define GR9F IGS_GR+0x9F -#define GRA0 IGS_GR+0xA0 -#define GRA1 IGS_GR+0xA1 -#define GRA2 IGS_GR+0xA2 -#define GRA3 IGS_GR+0xA3 -#define GRA4 IGS_GR+0xA4 -#define GRA5 IGS_GR+0xA5 -#define GRA6 IGS_GR+0xA6 -#define GRA7 IGS_GR+0xA7 -#define GRA8 IGS_GR+0xA8 -#define GRA9 IGS_GR+0xA9 -#define GRAA IGS_GR+0xAA -#define GRAB IGS_GR+0xAB -#define GRAC IGS_GR+0xAC -#define GRAD IGS_GR+0xAD -#define GRAE IGS_GR+0xAE -#define GRAF IGS_GR+0xAF -#define GRB0 IGS_GR+0xB0 -#define GRB1 IGS_GR+0xB1 -#define GRB2 IGS_GR+0xB2 -#define GRB3 IGS_GR+0xB3 -#define GRB4 IGS_GR+0xB4 -#define GRB5 IGS_GR+0xB5 -#define GRB6 IGS_GR+0xB6 -#define GRB7 IGS_GR+0xB7 -#define GRB8 IGS_GR+0xB8 -#define GRB9 IGS_GR+0xB9 -#define GRBA IGS_GR+0xBA -#define GRBB IGS_GR+0xBB -#define GRBC IGS_GR+0xBC -#define GRBD IGS_GR+0xBD -#define GRBE IGS_GR+0xBE -#define GRBF IGS_GR+0xBF - -#define GR_FIRST GR00 -#define GR_LAST GRBF - -#define GREX3C IGS_GREX+(0x3c-IGS_GREXBASE) - -VgaReg igs_h_total[] = { - CR00, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_de_end[] = { - CR01, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_bstart[] = { - CR02, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_bend[] = { - CR03, 0, 5, - CR05, 7, 1, - VGA_REG_END -}; - -VgaReg igs_de_skew[] = { - CR03, 5, 2, - VGA_REG_END -}; - -VgaReg igs_ena_vr_access[] = { - CR03, 7, 1, - VGA_REG_END -}; - -VgaReg igs_h_rstart[] = { - CR04, 0, 8, - VGA_REG_END -}; - -VgaReg igs_h_rend[] = { - CR05, 0, 5, - VGA_REG_END -}; - -VgaReg igs_h_rdelay[] = { - CR05, 5, 2, - VGA_REG_END -}; - -VgaReg igs_v_total[] = { - CR06, 0, 8, - CR07, 0, 1, - CR07, 5, 1, - GR11, 0, 1, - VGA_REG_END -}; - -VgaReg igs_v_rstart[] = { - CR10, 0, 8, - CR07, 2, 1, - CR07, 7, 1, - GR11, 2, 1, - VGA_REG_END -}; - -VgaReg igs_v_rend[] = { - CR11, 0, 4, - VGA_REG_END -}; - -VgaReg igs_clear_v_int[] = { - CR11, 4, 1, - VGA_REG_END -}; - -VgaReg igs_disable_v_int[] = { - CR11, 5, 1, - VGA_REG_END -}; - -VgaReg igs_bandwidth[] = { - CR11, 6, 1, - VGA_REG_END -}; - -VgaReg igs_crt_protect[] = { - CR11, 7, 1, - VGA_REG_END -}; - -VgaReg igs_v_de_end[] = { - CR12, 0, 8, - CR07, 1, 1, - CR07, 6, 1, - GR11, 1, 1, - VGA_REG_END -}; - -VgaReg igs_offset[] = { - CR13, 0, 8, - GR15, 4, 2, - VGA_REG_END -}; - -VgaReg igs_v_bstart[] = { - CR15, 0, 8, - CR07, 3, 1, - CR09, 5, 1, - GR11, 3, 1, - VGA_REG_END -}; - -VgaReg igs_v_bend[] = { - CR16, 0, 7, - VGA_REG_END -}; - -VgaReg igs_linecomp[] = { - CR18, 0, 8, - CR07, 4, 1, - CR09, 6, 1, - GR11, 4, 1, - VGA_REG_END -}; - -VgaReg igs_ivideo[] = { - GR11, 5, 1, - VGA_REG_END -}; - -VgaReg igs_num_fetch[] = { - GR14, 0, 8, - GR15, 0, 2, - VGA_REG_END -}; - -VgaReg igs_wcrt0[] = { - CR1F, 0, 1, - VGA_REG_END -}; - -VgaReg igs_wcrt1[] = { - CR1F, 1, 1, - VGA_REG_END -}; - -VgaReg igs_rcrts1[] = { - CR1F, 4, 1, - VGA_REG_END -}; - -VgaReg igs_selwk[] = { - CR1F, 6, 1, - VGA_REG_END -}; - -VgaReg igs_dot_clock_8[] = { - SR01, 0, 1, - VGA_REG_END -}; - -VgaReg igs_screen_off[] = { - SR01, 5, 1, - VGA_REG_END -}; - -VgaReg igs_enable_write_plane[] = { - SR02, 0, 4, - VGA_REG_END -}; - -VgaReg igs_mexhsyn[] = { - GR16, 0, 2, - VGA_REG_END -}; - -VgaReg igs_mexvsyn[] = { - GR16, 2, 2, - VGA_REG_END -}; - -VgaReg igs_pci_burst_write[] = { - GR30, 5, 1, - VGA_REG_END -}; - -VgaReg igs_pci_burst_read[] = { - GR30, 7, 1, - VGA_REG_END -}; - -VgaReg igs_iow_retry[] = { - GREX3C, 0, 1, - VGA_REG_END -}; - -VgaReg igs_mw_retry[] = { - GREX3C, 1, 1, - VGA_REG_END -}; - -VgaReg igs_mr_retry[] = { - GREX3C, 2, 1, - VGA_REG_END -}; - - - -VgaReg igs_biga22en[] = { - GR3D, 4, 1, - VGA_REG_END -}; - -VgaReg igs_biga24en[] = { - GR3D, 5, 1, - VGA_REG_END -}; - -VgaReg igs_biga22force[] = { - GR3D, 6, 1, - VGA_REG_END -}; - -VgaReg igs_bigswap[] = { - GR3F, 0, 6, - VGA_REG_END -}; - -/* #define IGS_BIGSWAP_8 0x3f */ -/* #define IGS_BIGSWAP_16 0x2a */ -/* #define IGS_BIGSWAP_32 0x00 */ - -VgaReg igs_sprite_x[] = { - GR50, 0, 8, - GR51, 0, 3, - VGA_REG_END -}; - -VgaReg igs_sprite_preset_x[] = { - GR52, 0, 6, - VGA_REG_END -}; - -VgaReg igs_sprite_y[] = { - GR53, 0, 8, - GR54, 0, 3, - VGA_REG_END -}; - -VgaReg igs_sprite_preset_y[] = { - GR55, 0, 6, - VGA_REG_END -}; - -VgaReg igs_sprite_visible[] = { - GR56, 0, 1, - VGA_REG_END -}; - -VgaReg igs_sprite_64x64[] = { - GR56, 1, 1, - VGA_REG_END -}; - -VgaReg igs_mgrext[] = { - GR57, 0, 1, - VGA_REG_END -}; - -VgaReg igs_hcshf[] = { - GR57, 4, 2, - VGA_REG_END -}; - -VgaReg igs_mbpfix[] = { - GR57, 6, 2, - VGA_REG_END -}; - -VgaReg igs_overscan_red[] = { - GR58, 0, 8, - VGA_REG_END -}; - -VgaReg igs_overscan_green[] = { - GR59, 0, 8, - VGA_REG_END -}; - -VgaReg igs_overscan_blue[] = { - GR5A, 0, 8, - VGA_REG_END -}; - -VgaReg igs_memgopg[] = { - GR73, 2, 1, - VGA_REG_END -}; - -VgaReg igs_memr2wpg[] = { - GR73, 1, 1, - VGA_REG_END -}; - -VgaReg igs_crtff16[] = { - GR73, 3, 1, - VGA_REG_END -}; - -VgaReg igs_fifomust[] = { - GR74, 0, 5, - VGA_REG_END -}; - -VgaReg igs_fifogen[] = { - GR75, 0, 5, - VGA_REG_END -}; - -VgaReg igs_mode_sel[] = { - GR77, 0, 4, - VGA_REG_END -}; - -/* #define IGS_MODE_TEXT 0 */ -/* #define IGS_MODE_8 1 */ -/* #define IGS_MODE_565 2 */ -/* #define IGS_MODE_5551 6 */ -/* #define IGS_MODE_8888 3 */ -/* #define IGS_MODE_888 4 */ -/* #define IGS_MODE_332 9 */ -/* #define IGS_MODE_4444 10 */ - -VgaReg igs_sprite_addr[] = { - GR7E, 0, 8, - GR7F, 0, 4, - VGA_REG_END -}; - -VgaReg igs_fastmpie[] = { - GR9E, 0, 1, - VGA_REG_END -}; - -VgaReg igs_vclk_m[] = { - GRB0, 0, 8, - GRBA, 0, 3, - VGA_REG_END -}; - -VgaReg igs_vclk_n[] = { - GRB1, 0, 5, - GRBA, 3, 3, - VGA_REG_END -}; - -VgaReg igs_vfsel[] = { - GRB1, 5, 1, - VGA_REG_END -}; - -VgaReg igs_vclk_p[] = { - GRB1, 6, 2, - GRBA, 6, 1, - VGA_REG_END -}; - -VgaReg igs_frqlat[] = { - GRB9, 7, 1, - VGA_REG_END -}; - - -VgaReg igs_dac_mask[] = { - IGS_DAC + 0, 0, 8, - VGA_REG_END -}; - -VgaReg igs_dac_read_index[] = { - IGS_DAC + 1, 0, 8, - VGA_REG_END -}; - -VgaReg igs_dac_write_index[] = { - IGS_DAC + 2, 0, 8, - VGA_REG_END -}; - -VgaReg igs_dac_data[] = { - IGS_DAC + 3, 0, 8, - VGA_REG_END -}; - -VgaReg igs_rampwdn[] = { - IGS_DACEX + 0, 0, 1, - VGA_REG_END -}; - -VgaReg igs_dac6_8[] = { - IGS_DACEX + 0, 1, 1, - VGA_REG_END -}; - -VgaReg igs_ramdacbypass[] = { - IGS_DACEX + 0, 4, 1, - VGA_REG_END -}; - -VgaReg igs_dacpwdn[] = { - IGS_DACEX + 0, 6, 1, - VGA_REG_END -}; - -VgaReg igs_cursor_read_index[] = { - IGS_DACEX + 1, 0, 8, - VGA_REG_END -}; - -VgaReg igs_cursor_write_index[] = { - IGS_DACEX + 2, 0, 8, - VGA_REG_END -}; - -VgaReg igs_cursor_data[] = { - IGS_DACEX + 3, 0, 8, - VGA_REG_END -}; - -VGA8 -_igsInb (VgaCard *card, VGA16 port) -{ - VGAVOL8 *reg; - - if (card->closure) - return VgaReadMemb ((VGA32) card->closure + port); - else - return VgaInb (port); -} - -void -_igsOutb (VgaCard *card, VGA8 value, VGA16 port) -{ - if (card->closure) - VgaWriteMemb (value, (VGA32) card->closure + port); - else - VgaOutb (value, port); -} - -void -_igsRegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write) -{ - if (reg < IGS_SR + IGS_NSR) - { - map->access = VgaAccessIndIo; - map->port = 0x3c4; - map->addr = 0; - map->value = 1; - map->index = reg - IGS_SR; - } - else if (reg < IGS_GR + IGS_NGR) - { - map->access = VgaAccessIndIo; - map->port = 0x3ce; - map->addr = 0; - map->value = 1; - map->index = reg - IGS_GR; - } - else if (reg < IGS_GREX + IGS_NGREX) - { - VGA8 gr33; - - map->access = VgaAccessDone; - _igsOutb (card, 0x33, 0x3ce); - gr33 = _igsInb (card, 0x3cf); - _igsOutb (card, gr33 | 0x40, 0x3cf); - _igsOutb (card, IGS_GREXBASE + reg - IGS_GREX, 0x3ce); - if (write) - _igsOutb (card, map->value, 0x3cf); - else - map->value = _igsInb (card, 0x3cf); - _igsOutb (card, 0x33, 0x3ce); - _igsOutb (card, gr33, 0x3cf); - return; - } - else if (reg < IGS_AR + IGS_NAR) - { - reg -= IGS_AR; - map->access = VgaAccessDone; - /* reset AFF to index */ - (void) _igsInb (card, 0x3da); - if (reg >= 16) - reg |= 0x20; - _igsOutb (card, reg, 0x3c0); - if (write) - _igsOutb (card, map->value, 0x3c0); - else - map->value = _igsInb (card, 0x3c1); - if (!(reg & 0x20)) - { - /* enable video display again */ - (void) _igsInb (card, 0x3da); - _igsOutb (card, 0x20, 0x3c0); - } - return; - } - else if (reg < IGS_CR + IGS_NCR) - { - map->access = VgaAccessIndIo; - map->port = 0x3d4; - map->addr = 0; - map->value = 1; - map->index = reg - IGS_CR; - } - else if (reg < IGS_DAC + IGS_NDAC) - { - map->access = VgaAccessIo; - map->port = 0x3c6 + reg - IGS_DAC; - } - else if (reg < IGS_DACEX + IGS_NDACEX) - { - VGA8 gr56; - reg = 0x3c6 + reg - IGS_DACEX; - map->access = VgaAccessDone; - _igsOutb (card, 0x56, 0x3ce); - gr56 = _igsInb (card, 0x3cf); - _igsOutb (card, gr56 | 4, 0x3cf); - if (write) - _igsOutb (card, map->value, reg); - else - map->value = _igsInb (card, reg); - _igsOutb (card, gr56, 0x3cf); - return; - } - else switch (reg) { - case IGS_MISC_OUT: - map->access = VgaAccessIo; - if (write) - map->port = 0x3c2; - else - map->port = 0x3cc; - break; - case IGS_INPUT_STATUS_1: - map->access = VgaAccessIo; - map->port = 0x3da; - break; - } - if (card->closure) - { - map->port = map->port + (VGA32) card->closure; - if (map->access == VgaAccessIo) - map->access = VgaAccessMem; - if (map->access == VgaAccessIndIo) - map->access = VgaAccessIndMem; - } -} - -VgaSave igsSaves[] = { - CR00, CR18, - SR01, SR02, - GR11, GRBA, - IGS_MISC_OUT, IGS_MISC_OUT, - VGA_SAVE_END -}; - -void -igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio) -{ - igsvga->card.map = _igsRegMap; - igsvga->card.closure = (void *) mmio; - igsvga->card.max = IGS_NREG; - igsvga->card.values = igsvga->values; - igsvga->card.saves = igsSaves; -} - -void -igsSave (IgsVga *igsvga) -{ - igsSetImm (igsvga, igs_wcrt0, 1); - igsSetImm (igsvga, igs_wcrt1, 1); - igsSetImm (igsvga, igs_rcrts1, 1); - igsSetImm (igsvga, igs_selwk, 1); - VgaPreserve (&igsvga->card); -} - -void -igsReset (IgsVga *igsvga) -{ - VgaRestore (&igsvga->card); - igsSetImm (igsvga, igs_frqlat, 0); - igsSetImm (igsvga, igs_frqlat, 1); - igsSetImm (igsvga, igs_frqlat, 0); - VgaFinish (&igsvga->card); -} - -char * -igsRegName(char *buf, VGA16 reg) -{ - if (reg < IGS_SR + IGS_NSR) - { - sprintf (buf, " SR%02X", reg - IGS_SR); - } - else if (reg < IGS_GR + IGS_NGR) - { - sprintf (buf, " GR%02X", reg - IGS_GR); - } - else if (reg < IGS_GREX + IGS_NGREX) - { - sprintf (buf, " GRX%02X", reg - IGS_GREX + IGS_GREXBASE); - } - else if (reg < IGS_AR + IGS_NAR) - { - sprintf (buf, " AR%02X", reg - IGS_AR); - } - else if (reg < IGS_CR + IGS_NCR) - { - sprintf (buf, " CR%02X", reg - IGS_CR); - } - else if (reg < IGS_DAC + IGS_NDAC) - { - sprintf (buf, " DAC%02X", reg - IGS_DAC); - } - else if (reg < IGS_DACEX + IGS_NDACEX) - { - sprintf (buf, "DACX%02X", reg - IGS_DACEX); - } - else switch (reg) { - case IGS_MISC_OUT: - sprintf (buf, "MISC_O"); - break; - case IGS_INPUT_STATUS_1: - sprintf (buf, "IN_S_1"); - break; - } - return buf; -} diff --git a/hw/kdrive/igs/igsreg.h b/hw/kdrive/igs/igsreg.h deleted file mode 100644 index 2230ff01b..000000000 --- a/hw/kdrive/igs/igsreg.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright © 2000 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. - */ - -#ifndef _IGSREG_H_ -#define _IGSREG_H_ - -#include "vga.h" - -#define IGS_SR 0 -#define IGS_NSR 5 -#define IGS_GR (IGS_SR+IGS_NSR) -#define IGS_NGR 0xC0 -#define IGS_GREX (IGS_GR+IGS_NGR) -#define IGS_GREXBASE 0x3c -#define IGS_NGREX 1 -#define IGS_AR (IGS_GREX+IGS_NGREX) -#define IGS_NAR 0x15 -#define IGS_CR (IGS_AR+IGS_NAR) -#define IGS_NCR 0x48 -#define IGS_DAC (IGS_CR+IGS_NCR) -#define IGS_NDAC 4 -#define IGS_DACEX (IGS_DAC+IGS_NDAC) -#define IGS_NDACEX 4 -#define IGS_MISC_OUT (IGS_DACEX + IGS_NDACEX) -#define IGS_INPUT_STATUS_1 (IGS_MISC_OUT+1) -#define IGS_NREG (IGS_INPUT_STATUS_1+1) - -extern VgaReg igs_h_total[]; -extern VgaReg igs_h_de_end[]; -extern VgaReg igs_h_bstart[]; -extern VgaReg igs_h_bend[]; -extern VgaReg igs_de_skew[]; -extern VgaReg igs_ena_vr_access[]; -extern VgaReg igs_h_rstart[]; -extern VgaReg igs_h_rend[]; -extern VgaReg igs_h_rdelay[]; -extern VgaReg igs_v_total[]; -extern VgaReg igs_v_rstart[]; -extern VgaReg igs_v_rend[]; -extern VgaReg igs_clear_v_int[]; -extern VgaReg igs_disable_v_int[]; -extern VgaReg igs_bandwidth[]; -extern VgaReg igs_crt_protect[]; -extern VgaReg igs_v_de_end[]; -extern VgaReg igs_offset[]; -extern VgaReg igs_v_bstart[]; -extern VgaReg igs_v_bend[]; -extern VgaReg igs_linecomp[]; -extern VgaReg igs_ivideo[]; -extern VgaReg igs_num_fetch[]; -extern VgaReg igs_wcrt0[]; -extern VgaReg igs_wcrt1[]; -extern VgaReg igs_rcrts1[]; -extern VgaReg igs_selwk[]; -extern VgaReg igs_dot_clock_8[]; -extern VgaReg igs_screen_off[]; -extern VgaReg igs_enable_write_plane[]; -extern VgaReg igs_mexhsyn[]; -extern VgaReg igs_mexvsyn[]; -extern VgaReg igs_pci_burst_write[]; -extern VgaReg igs_pci_burst_read[]; -extern VgaReg igs_iow_retry[]; -extern VgaReg igs_mw_retry[]; -extern VgaReg igs_mr_retry[]; -extern VgaReg igs_biga22en[]; -extern VgaReg igs_biga24en[]; -extern VgaReg igs_biga22force[]; -extern VgaReg igs_bigswap[]; -#define IGS_BIGSWAP_8 0x3f -#define IGS_BIGSWAP_16 0x2a -#define IGS_BIGSWAP_32 0x00 -extern VgaReg igs_sprite_x[]; -extern VgaReg igs_sprite_preset_x[]; -extern VgaReg igs_sprite_y[]; -extern VgaReg igs_sprite_preset_y[]; -extern VgaReg igs_sprite_visible[]; -extern VgaReg igs_sprite_64x64[]; -extern VgaReg igs_mgrext[]; -extern VgaReg igs_hcshf[]; -extern VgaReg igs_mbpfix[]; -extern VgaReg igs_overscan_red[]; -extern VgaReg igs_overscan_green[]; -extern VgaReg igs_overscan_blue[]; -extern VgaReg igs_memgopg[]; -extern VgaReg igs_memr2wpg[]; -extern VgaReg igs_crtff16[]; -extern VgaReg igs_fifomust[]; -extern VgaReg igs_fifogen[]; -extern VgaReg igs_mode_sel[]; -#define IGS_MODE_TEXT 0 -#define IGS_MODE_8 1 -#define IGS_MODE_565 2 -#define IGS_MODE_5551 6 -#define IGS_MODE_8888 3 -#define IGS_MODE_888 4 -#define IGS_MODE_332 9 -#define IGS_MODE_4444 10 -extern VgaReg igs_sprite_addr[]; -extern VgaReg igs_fastmpie[]; -extern VgaReg igs_vclk_m[]; -extern VgaReg igs_vclk_n[]; -extern VgaReg igs_vfsel[]; -extern VgaReg igs_vclk_p[]; -extern VgaReg igs_frqlat[]; -extern VgaReg igs_dac_mask[]; -extern VgaReg igs_dac_read_index[]; -extern VgaReg igs_dac_write_index[]; -extern VgaReg igs_dac_data[]; -extern VgaReg igs_rampwdn[]; -extern VgaReg igs_dac6_8[]; -extern VgaReg igs_ramdacbypass[]; -extern VgaReg igs_dacpwdn[]; -extern VgaReg igs_cursor_read_index[]; -extern VgaReg igs_cursor_write_index[]; -extern VgaReg igs_cursor_data[]; - -#define igsGet(sv,r) VgaGet(&(sv)->card, (r)) -#define igsGetImm(sv,r) VgaGetImm(&(sv)->card, (r)) -#define igsSet(sv,r,v) VgaSet(&(sv)->card, (r), (v)) -#define igsSetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v)) - -typedef struct _igsVga { - VgaCard card; - VgaValue values[IGS_NREG]; -} IgsVga; - -void -igsRegInit (IgsVga *igsvga, VGAVOL8 *mmio); - -void -igsSave (IgsVga *igsvga); - -void -igsReset (IgsVga *igsvga); - -#endif /* _IGSREG_H_ */ diff --git a/hw/kdrive/igs/igsstub.c b/hw/kdrive/igs/igsstub.c deleted file mode 100644 index 1c588271c..000000000 --- a/hw/kdrive/igs/igsstub.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright © 2000 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "igs.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - CARD32 count; - - count = 0; -#ifdef EMBED - attr.address[0] = 0x10000000; /* Adomo Wing video base address */ - attr.io = 0; - attr.naddr = 1; -#else - while (LinuxFindPci (0x10ea, 0x5000, count, &attr)) -#endif - { - KdCardInfoAdd (&igsFuncs, &attr, 0); - count++; - } -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg (); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/ipaq/ipaq.c b/hw/kdrive/ipaq/ipaq.c deleted file mode 100644 index 057b799f4..000000000 --- a/hw/kdrive/ipaq/ipaq.c +++ /dev/null @@ -1,70 +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. - * - * Adapted from ts300.c by Alan Hourihane <alanh@fairlite.demon.co.uk> - * For the Compaq IPAQ handheld, with the HP VGA Out Card (F1252A). - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "pcmcia.h" - -extern KdCardFuncs pcmciaFuncs; - -void -InitCard (char *name) -{ - KdCardAttr attr; - if (name && !strcmp(name, "pcmcia")) - KdCardInfoAdd (&pcmciaFuncs, &attr, 0); - else - KdCardInfoAdd (&fbdevFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); -#ifdef TOUCHSCREEN - KdAddMouseDriver (&TsFuncs); -#endif -} - -extern pcmciaDisplayModeRec pcmciaDefaultModes[]; - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/itsy/itsy.c b/hw/kdrive/itsy/itsy.c deleted file mode 100644 index 47cc05041..000000000 --- a/hw/kdrive/itsy/itsy.c +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "itsy.h" - -/* struct with LCD characteristics defined in fb_brutus.h */ -static struct FbLcdParamsStruct fbLcdParams; -static int fb_d; -static int fbn; -Bool -itsyCardInit (KdCardInfo *card) -{ - int k; - char *fb; - char *pixels; - - if ((fb_d = open("/dev/fbclone", O_RDWR)) < 0) { - perror("Error opening /dev/fb\n"); - return FALSE; - } - if ((k=ioctl(fb_d, FB_LCD_PARAMS, &fbLcdParams)) != 0) { - perror("Error with /dev/fb ioctl FB_LCD_PARAMS call"); - return FALSE; - } - - fb = (char *) mmap ((caddr_t) NULL, fbLcdParams.frameBufferSize, - PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fb_d, 0); - - fprintf (stderr, "fb mapped at 0x%x\n", fb); - if (fb == (char *)-1) { - perror("ERROR: mmap framebuffer fails!"); - return FALSE; - } - - card->driver = fb; - - return TRUE; -} - -Bool -itsyScreenInit (KdScreenInfo *screen) -{ - CARD8 *fb = screen->card->driver; - - screen->width = fbLcdParams.screenSizeH; - screen->height = fbLcdParams.screenSizeV; - screen->depth = fbLcdParams.bitsPerPixel; - screen->bitsPerPixel = fbLcdParams.bitsPerPixel; - screen->byteStride = fbLcdParams.frameBufferSizeH; - screen->pixelStride = (fbLcdParams.frameBufferSizeH * 8 / - fbLcdParams.bitsPerPixel); - fprintf (stderr, "width %d height %d depth %d pstride %d bstride %d\n", - screen->width, screen->height, screen->depth, - screen->pixelStride, screen->byteStride); - screen->dumb = FALSE; - screen->softCursor = TRUE; - screen->blueMask = 0; - screen->greenMask = 0; - screen->redMask = 0; - screen->visuals = 1 << StaticGray; - screen->rate = 72; - screen->frameBuffer = (CARD8 *) (fb + - fbLcdParams.pixelDataOffset + - (fbLcdParams.reserveTopRows * - screen->byteStride)); - fprintf (stderr, "Frame buffer 0x%x\n", screen->frameBuffer); - return TRUE; -} - -static unsigned short itsyIntensity[16] = { - 0xffff, - 0xffff, - 0xedb6, - 0xdb6d, - 0xc924, - 0xb6db, - 0xa492, - 0x9249, - 0x8000, - 0x6db6, - 0x5b6d, - 0x4924, - 0x36db, - 0x2492, - 0x1249, - 0x0000, -}; - -Bool -itsyCreateColormap (ColormapPtr pmap) -{ - int i; - - for (i = 0; i < 16; i++) - { - pmap->red[i].co.local.red = itsyIntensity[i]; - pmap->red[i].co.local.green = itsyIntensity[i]; - pmap->red[i].co.local.blue = itsyIntensity[i]; - } - return TRUE; -} - -Bool -itsyInitScreen (ScreenPtr pScreen) -{ - pScreen->CreateColormap = itsyCreateColormap; - return TRUE; -} - -void -itsyPreserve (KdCardInfo *card) -{ -} - -void -itsyEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - - fprintf (stderr, "Enabling LCD display\n"); - /* display it on the LCD */ - ioctl(fb_d, FB_LCD_SHOW, 0); -} - -Bool -itsyDPMS (ScreenPtr pScreen, int mode) -{ - if (mode) - ioctl (fb_d, FB_LCD_OFF, 0); - else - ioctl (fb_d, FB_LCD_ON, 0); - return TRUE; -} - -void -itsyDisable (ScreenPtr pScreen) -{ -/* ioctl (fb_d, FB_LCD_SWITCH, 0); */ -/* fprintf (stderr, "Disabling LCD display\n");*/ -} - -void -itsyRestore (KdCardInfo *card) -{ -} - -void -itsyScreenFini (KdScreenInfo *screen) -{ -} - -void -itsyCardFini (KdCardInfo *card) -{ - int k; - - fprintf (stderr, "Unmapping driver at 0x%x\n", card->driver); - munmap (card->driver, fbLcdParams.frameBufferSize); - fprintf (stderr, "Releasing fbn %d\n", fbn); - /* release it */ - if (ioctl(fb_d, FB_LCD_FREE, fbn) != 0) { - printf("FB_LCD_FREE of %d fails!\n", fbn); - } - close (fb_d); - fprintf (stderr, "itsyFini done\n"); -} - -KdCardFuncs itsyFuncs = { - itsyCardInit, /* cardinit */ - itsyScreenInit, /* scrinit */ - itsyInitScreen, /* initScreen */ - itsyPreserve, /* preserve */ - itsyEnable, /* enable */ - itsyDPMS, /* dpms */ - itsyDisable, /* disable */ - itsyRestore, /* restore */ - itsyScreenFini, /* scrfini */ - itsyCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - 0, /* initAccel */ - 0, /* enableAccel */ - 0, /* disableAccel */ - 0, /* finiAccel */ - - 0, /* getColors */ - 0, /* putColors */ -}; - -void -InitCard (void) -{ - KdCardAttr attr; - - KdCardInfoAdd (&itsyFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdInitInput (&itsyTsMouseFuncs, &itsyKeyboardFuncs); -} - -int itsySessionFd = -1; - -int -ItsyOsInit (void) -{ - pid_t sid; - int i; - itsy_session_info info; - - if (itsySessionFd < 0) - { - itsySessionFd = open ("/dev/session", 0); - ErrorF("itsySessionFD %d\n", itsySessionFd); - } - - (void) setsid (); - sid = getsid (0); - ErrorF ("Session ID %d PID %d\n", sid, getpid ()); - info.sid = sid; - strcpy (info.name, "X"); - if (itsySessionFd >= 0) - { - i = ioctl (itsySessionFd, SESSION_SET_INFO, &info); - if (i < 0) - perror ("SESSION_SET_INFO"); - } - return 1; -} - -void -ItsyOsEnable (void) -{ - itsy_session_request req; - int i; - -#define MANAGER_SID_TO_FOREGROUND 2 - - req.operation = MANAGER_SID_TO_FOREGROUND; - req.data = 0; - if (itsySessionFd >= 0) - { - i = ioctl (itsySessionFd, SESSION_MANAGER_REQUEST, &req); - if (i < 0) - perror ("SESSION_MANAGER_REQUEST"); - } -} - -Bool -ItsyOsSpecialKey (KeySym sym) -{ - return FALSE; -} - -void -ItsyOsDisable (void) -{ -} - -void -ItsyOsFini (void) -{ -} - -KdOsFuncs ItsyOsFuncs = { - ItsyOsInit, - ItsyOsEnable, - ItsyOsSpecialKey, - ItsyOsDisable, - ItsyOsFini, - 0 -}; - -void -OsVendorInit (void) -{ - KdOsInit (&ItsyOsFuncs); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/itsy/itsy.h b/hw/kdrive/itsy/itsy.h deleted file mode 100644 index fc8fb8f4f..000000000 --- a/hw/kdrive/itsy/itsy.h +++ /dev/null @@ -1,39 +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. - */ - -#include "kdrive.h" -#include <stdio.h> -#include <sys/ioctl.h> -#include <linux/itsy_fb.h> -#include <linux/itsy_ts.h> -#include <linux/itsy_buttons.h> -#include <linux/itsy_session.h> -#include <unistd.h> -#include <sys/mman.h> - -#define FB_HEIGHT 200 -#define FB_WIDTH 320 -#define FB_DEPTH 4 -#define FB_PALETTE_SIZE 16 - -extern KdMouseFuncs itsyTsMouseFuncs; -extern KdKeyboardFuncs itsyKeyboardFuncs; diff --git a/hw/kdrive/itsy/kbd.c b/hw/kdrive/itsy/kbd.c deleted file mode 100644 index 83ed49e72..000000000 --- a/hw/kdrive/itsy/kbd.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. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "itsy.h" -#include <X11/keysym.h> -#include <linux/itsy_buttons.h> - -#define ITSY_WIDTH 2 - -KeySym ItsyKeymap[] = { -/* 1 8 */ XK_Escape, NoSymbol, -/* 2 9 */ XK_1, XK_exclam, -/* 3 10 */ XK_2, XK_at, -/* 4 11 */ XK_3, XK_numbersign, -/* 5 12 */ XK_4, XK_dollar, -/* 6 13 */ XK_5, XK_percent, -/* 7 14 */ XK_6, XK_asciicircum, -/* 8 15 */ XK_7, XK_ampersand, -/* 9 16 */ XK_8, XK_asterisk, -/* 10 17 */ XK_9, XK_parenleft, -/* 11 18 */ XK_0, XK_parenright, -/* 12 19 */ XK_minus, XK_underscore, -/* 13 20 */ XK_equal, XK_plus, -/* 14 21 */ XK_BackSpace, NoSymbol, -/* 15 22 */ XK_Tab, NoSymbol, -/* 16 23 */ XK_Q, NoSymbol, -/* 17 24 */ XK_W, NoSymbol, -/* 18 25 */ XK_E, NoSymbol, -/* 19 26 */ XK_R, NoSymbol, -/* 20 27 */ XK_T, NoSymbol, -/* 21 28 */ XK_Y, NoSymbol, -/* 22 29 */ XK_U, NoSymbol, -/* 23 30 */ XK_I, NoSymbol, -/* 24 31 */ XK_O, NoSymbol, -/* 25 32 */ XK_P, NoSymbol, -/* 26 33 */ XK_bracketleft, XK_braceleft, -/* 27 34 */ XK_bracketright, XK_braceright, -/* 28 35 */ XK_Return, NoSymbol, -/* 29 36 */ XK_Control_L, NoSymbol, -/* 30 37 */ XK_A, NoSymbol, -/* 31 38 */ XK_S, NoSymbol, -/* 32 39 */ XK_D, NoSymbol, -/* 33 40 */ XK_F, NoSymbol, -/* 34 41 */ XK_G, NoSymbol, -/* 35 42 */ XK_H, NoSymbol, -/* 36 43 */ XK_J, NoSymbol, -/* 37 44 */ XK_K, NoSymbol, -/* 38 45 */ XK_L, NoSymbol, -/* 39 46 */ XK_semicolon, XK_colon, -/* 40 47 */ XK_apostrophe, XK_quotedbl, -/* 41 48 */ XK_grave, XK_asciitilde, -/* 42 49 */ XK_Shift_L, NoSymbol, -/* 43 50 */ XK_backslash, XK_bar, -/* 44 51 */ XK_Z, NoSymbol, -/* 45 52 */ XK_X, NoSymbol, -/* 46 53 */ XK_C, NoSymbol, -/* 47 54 */ XK_V, NoSymbol, -/* 48 55 */ XK_B, NoSymbol, -/* 49 56 */ XK_N, NoSymbol, -/* 50 57 */ XK_M, NoSymbol, -/* 51 58 */ XK_comma, XK_less, -/* 52 59 */ XK_period, XK_greater, -/* 53 60 */ XK_slash, XK_question, -/* 54 61 */ XK_Shift_R, NoSymbol, -/* 55 62 */ XK_KP_Multiply, NoSymbol, -/* 56 63 */ XK_Alt_L, XK_Meta_L, -/* 57 64 */ XK_space, NoSymbol, -/* 58 65 */ XK_Caps_Lock, NoSymbol, -/* 59 66 */ XK_F1, NoSymbol, -/* 60 67 */ XK_F2, NoSymbol, -/* 61 68 */ XK_F3, NoSymbol, -/* 62 69 */ XK_F4, NoSymbol, -/* 63 70 */ XK_F5, NoSymbol, -/* 64 71 */ XK_F6, NoSymbol, -/* 65 72 */ XK_F7, NoSymbol, -/* 66 73 */ XK_F8, NoSymbol, -/* 67 74 */ XK_F9, NoSymbol, -/* 68 75 */ XK_F10, NoSymbol, -/* 69 76 */ XK_Break, XK_Pause, -/* 70 77 */ XK_Scroll_Lock, NoSymbol, -/* 71 78 */ XK_KP_Home, XK_KP_7, -/* 72 79 */ XK_KP_Up, XK_KP_8, -/* 73 80 */ XK_KP_Page_Up, XK_KP_9, -/* 74 81 */ XK_KP_Subtract, NoSymbol, -/* 75 82 */ XK_KP_Left, XK_KP_4, -/* 76 83 */ XK_KP_5, NoSymbol, -/* 77 84 */ XK_KP_Right, XK_KP_6, -/* 78 85 */ XK_KP_Add, NoSymbol, -/* 79 86 */ XK_KP_End, XK_KP_1, -/* 80 87 */ XK_KP_Down, XK_KP_2, -/* 81 88 */ XK_KP_Page_Down, XK_KP_3, -/* 82 89 */ XK_KP_Insert, XK_KP_0, -/* 83 90 */ XK_KP_Delete, XK_KP_Decimal, -/* 84 91 */ NoSymbol, NoSymbol, -/* 85 92 */ NoSymbol, NoSymbol, -/* 86 93 */ NoSymbol, NoSymbol, -/* 87 94 */ XK_F11, NoSymbol, -/* 88 95 */ XK_F12, NoSymbol, - -/* These are remapped from the extended set (using ExtendMap) */ - -/* 89 96 */ XK_Control_R, NoSymbol, -/* 90 97 */ XK_KP_Enter, NoSymbol, -/* 91 98 */ XK_KP_Divide, NoSymbol, -/* 92 99 */ XK_Sys_Req, XK_Print, -/* 93 100 */ XK_Alt_R, XK_Meta_R, -/* 94 101 */ XK_Num_Lock, NoSymbol, -/* 95 102 */ XK_Home, NoSymbol, -/* 96 103 */ XK_Up, NoSymbol, -/* 97 104 */ XK_Page_Up, NoSymbol, -/* 98 105 */ XK_Left, NoSymbol, -/* 99 106 */ XK_Right, NoSymbol, -/* 100 107 */ XK_End, NoSymbol, -/* 101 108 */ XK_Down, NoSymbol, -/* 102 109 */ XK_Page_Down, NoSymbol, -/* 103 110 */ XK_Insert, NoSymbol, -/* 104 111 */ XK_Delete, NoSymbol, -/* 105 112 */ XK_Super_L, NoSymbol, -/* 106 113 */ XK_Super_R, NoSymbol, -/* 107 114 */ XK_Menu, NoSymbol, - -/* Itsy hardware buttons */ -#define ITSY_BUTTON_FIRST 108 -#define ITSY_BUTTON_LAST 116 - -/* 108 115 */ XK_Next, NoSymbol, /* right button on side */ -/* 109 116 */ XK_Prior, NoSymbol, /* left button on side */ -/* 110 117 */ XK_Up, NoSymbol, /* joypad */ -/* 111 118 */ XK_Down, NoSymbol, -/* 112 119 */ XK_Left, NoSymbol, -/* 113 120 */ XK_Right, NoSymbol, -/* 114 121 */ NoSymbol, NoSymbol, /* left near speaker */ -/* 115 122 */ NoSymbol, NoSymbol, /* right near speaker */ -/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */ -}; - -static unsigned long itsyButtonState; - -void -ItsyKeyboardLoad (void) -{ - KeySym *k; - -} - -static Status -ItsyKeyboardInit (KdKeyboardInfo *ki) -{ - if (!ki) - return BadImplementation; - - ki->driverPrivate = open ("/dev/buttons", 0); - - itsyButtonState = 0; - ki->keySyms.minKeyCode = 1; - ki->keySyms.maxKeyCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH; - ki->minScanCode = ki->keySyms.minKeyCode; - ki->maxScanCode = ki->keySyms.maxKeyCode; - ki->keySyms.mapWidth = ITSY_WIDTH; - - if (ki->keySyms.map) - xfree(ki->keySyms.map); - ki->keySyms.map = xalloc(sizeof(ItsyKeymap)); - if (!ki->keySyms.map) - return BadAlloc; - memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap)); - - return Success; -} - -static void -ItsyKeyboardDisable (KdKeybdInfo *ki) -{ - if (fd >= 0) - close ((int)ki->driverPrivate); -} - -static void -ItsyKeyboardFini (KdKeybdInfo *ki) -{ - return; -} - -void -ItsyKeyboardRead (int fd) -{ - itsy_buttons_event event; - int b; - unsigned long bit; - unsigned long change; - unsigned long buttons; - - if (read (fd, &event, sizeof (event)) == sizeof (event)) - { - buttons = event.state; - change = buttons ^ itsyButtonState; - if (!change) - return; - for (b = ITSY_BUTTON_FIRST; b <= ITSY_BUTTON_LAST; b++) - { - bit = (1 << (b - ITSY_BUTTON_FIRST)); - if (change & bit) - KdEnqueueKeyboardEvent (b, (buttons & bit) == 0); - } - itsyButtonState = buttons; - } -} - -void -ItsyKeyboardLeds (int leds) -{ -} - -void -ItsyKeyboardBell (int volume, int frequency, int duration) -{ -} - -KdKeyboardFuncs itsyKeyboardFuncs = { - "itsy", - ItsyKeyboardInit, - ItsyKeyboardEnable, - ItsyKeyboardRead, - ItsyKeyboardLeds, - ItsyKeyboardBell, - ItsyKeyboardDisable - ItsyKeyboardFini, - NULL, -}; diff --git a/hw/kdrive/itsy/ts.c b/hw/kdrive/itsy/ts.c deleted file mode 100644 index 34ff6a880..000000000 --- a/hw/kdrive/itsy/ts.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#define NEED_EVENTS -#include "itsy.h" -#include <X11/Xproto.h> -#include "inputstr.h" -#include "Xpoll.h" - -int -itsyTsReadBytes (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; -} - -void -itsyTsRead (KdPointerInfo *pi, int tsPort) -{ - ts_event event; - long buf[3]; - int n; - long pressure; - long x, y; - unsigned long flags; - unsigned long buttons; - - n = itsyTsReadBytes (tsPort, (char *) &event, - sizeof (event), sizeof (event)); - if (n == sizeof (event)) - { - if (event.pressure) - { - flags = KD_BUTTON_1; - x = event.point.x; - y = event.point.y; - } - else - { - flags = KD_MOUSE_DELTA; - x = 0; - y = 0; - } - KdEnqueuePointerEvent (pi, flags, x, y, 0); - } -} - -#if 0 -#define ITSY_DEBUG_LOW 1 - -// -// Touch screen parameters are stored -// in the flash. This code is taken from 'wm1'. -// -void itsySetTouchCalibration (int mou_filedsc, - int xs, int xt, int ys, int yt, int xys) -{ - int k, ibuf[10]; - - ibuf[0] = xs; - ibuf[1] = xt; - ibuf[2] = ys; - ibuf[3] = yt; - ibuf[4] = xys; - if ((k=ioctl(mou_filedsc, TS_SET_CALM, ibuf)) != 0) { - fprintf(stderr, "ERROR: ioctl TS_SET_CALM returns %d\n", k); - } -} - - -int itsyReadFlashBlock(int location, signed char *data, int dbytes) -{ - int offset, bytes; - int flashfd; - - flashfd = open("/dev/flash1", O_RDONLY); - if (flashfd < 0) return(0); - - offset = lseek(flashfd, location, SEEK_SET); - if (offset != location) { - close(flashfd); - return(0); - } - - bytes = read(flashfd, data, dbytes); - if (bytes != dbytes) { - close(flashfd); - return(0); - } - - close(flashfd); - return(1); -} - -/**********************************************************************/ -#define RAMSIZE (0x400000) -#define MONITOR_BLOCKSIZE (32) -/**********************************************************************/ - -/* code for storing calibration into flash */ - -#define CALIBRATE_BLOCKSIZE (32) -#define CALIBRATE_OFFSET (RAMSIZE-MONITOR_BLOCKSIZE-CALIBRATE_BLOCKSIZE) -#define CALIBRATE_MAGIC_NUM (0x0babedee) - - -static int check_if_calibrated_and_set(int mou_filedsc) -{ - signed char cal_data[CALIBRATE_BLOCKSIZE]; - int *iptr; - - if (itsyReadFlashBlock(CALIBRATE_OFFSET, - cal_data, CALIBRATE_BLOCKSIZE) == 0) { - if ( ITSY_DEBUG_LOW ) { - fprintf(stderr,"unable to read calibration data for touch screen\n"); - } - return(0); - } - - iptr = (int *) cal_data; - if (iptr[0] == CALIBRATE_MAGIC_NUM) { - if ( ITSY_DEBUG_LOW ) { - fprintf(stderr,"Calibrating touch screen using %d, %d, %d, %d, %d\n", - iptr[1], iptr[2], iptr[3], iptr[4], iptr[5]); - } - itsySetTouchCalibration(mou_filedsc, iptr[1], iptr[2], iptr[3], iptr[4], iptr[5]); - return(1); - } - else { - if ( ITSY_DEBUG_LOW ) { - fprintf(stderr,"Couldn't calibrate screen\n"); - } - return(0); - } -} -#endif - -int -itsyTsInit (void) -{ - int tsPort; - - tsPort = open ("/dev/ts", 0); - fprintf (stderr, "tsPort %d\n", tsPort); -#if 0 - if (tsPort >= 0) - check_if_calibrated_and_set (tsPort); -#endif - return tsPort; -} - -void -itsyTsFini (int tsPort) -{ - if (tsPort >= 0) - close (tsPort); -} - -KdPointerDriver itsyTsMouseDriver = { - "itsyts", - itsyTsInit, - itsyTsRead, - itsyTsFini -}; - diff --git a/hw/kdrive/mach64/Makefile.am b/hw/kdrive/mach64/Makefile.am deleted file mode 100644 index 6ca376ab2..000000000 --- a/hw/kdrive/mach64/Makefile.am +++ /dev/null @@ -1,43 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xmach64 - -if TSLIB -TSLIB_FLAG = -lts -endif - - -noinst_LIBRARIES = libmach64.a - -libmach64_a_SOURCES = \ - mach64.c \ - mach64draw.c \ - mach64video.c \ - mach64.h \ - mach64draw.h - -Xmach64_SOURCES = \ - mach64stub.c - -MACH64_LIBS = \ - libmach64.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a - - -if GLX -Xmach64_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xmach64_LDADD = \ - $(MACH64_LIBS) \ - @KDRIVE_LIBS@ - -Xmach64_DEPENDENCIES = \ - libmach64.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/mach64/mach64.c b/hw/kdrive/mach64/mach64.c deleted file mode 100644 index 3c513ba17..000000000 --- a/hw/kdrive/mach64/mach64.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mach64.h" -#include "kaa.h" - -static Bool -mach64CardInit (KdCardInfo *card) -{ - Mach64CardInfo *mach64c; - - mach64c = (Mach64CardInfo *) xalloc (sizeof (Mach64CardInfo)); - if (!mach64c) - return FALSE; - - (void) mach64MapReg (card, mach64c); - mach64c->lcdEnabled = FALSE; - - if (!vesaInitialize (card, &mach64c->vesa)) - { - xfree (mach64c); - return FALSE; - } - - card->driver = mach64c; - - return TRUE; -} - -static Bool -mach64ScreenInit (KdScreenInfo *screen) -{ - Mach64CardInfo *mach64c = screen->card->driver; - Mach64ScreenInfo *mach64s; - - mach64s = (Mach64ScreenInfo *) xalloc (sizeof (Mach64ScreenInfo)); - if (!mach64s) - return FALSE; - memset (mach64s, '\0', sizeof (Mach64ScreenInfo)); - if (!vesaScreenInitialize (screen, &mach64s->vesa)) - { - xfree (mach64s); - return FALSE; - } - if (!mach64c->reg) - screen->dumb = TRUE; - if (mach64s->vesa.mapping != VESA_LINEAR) - screen->dumb = TRUE; - switch (screen->fb[0].depth) { - case 8: - mach64s->colorKey = 0xff; - break; - case 15: - case 16: - mach64s->colorKey = 0x001e; - break; - case 24: - mach64s->colorKey = 0x0000fe; - break; - default: - mach64s->colorKey = 1; - break; - } - screen->driver = mach64s; - return TRUE; -} - -static Bool -mach64InitScreen (ScreenPtr pScreen) -{ -#ifdef XV - mach64InitVideo(pScreen); -#endif - return vesaInitScreen (pScreen); -} - -#ifdef RANDR -static Bool -mach64RandRSetConfig (ScreenPtr pScreen, - Rotation rotation, - int rate, - RRScreenSizePtr pSize) -{ - kaaWaitSync (pScreen); - - if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) - return FALSE; - - return TRUE; -} - -static void -mach64RandRInit (ScreenPtr pScreen) -{ - rrScrPriv(pScreen); - - pScrPriv->rrSetConfig = mach64RandRSetConfig; -} -#endif - -static Bool -mach64FinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - ret = vesaFinishInitScreen (pScreen); -#ifdef RANDR - mach64RandRInit (pScreen); -#endif - return ret; -} - -static Bool -mach64CreateResources (ScreenPtr pScreen) -{ - return vesaCreateResources (pScreen); -} - -CARD32 -mach64ReadLCD (Reg *reg, int id) -{ - CARD32 LCD_INDEX; - - LCD_INDEX = reg->LCD_INDEX & ~(0x3f); - reg->LCD_INDEX = (LCD_INDEX | id); - return reg->LCD_DATA; -} - -void -mach64WriteLCD (Reg *reg, int id, CARD32 data) -{ - CARD32 LCD_INDEX; - - LCD_INDEX = reg->LCD_INDEX & ~(0x3f); - reg->LCD_INDEX = (LCD_INDEX | id); - reg->LCD_DATA = data; -} - -void -mach64Preserve (KdCardInfo *card) -{ - Mach64CardInfo *mach64c = card->driver; - Reg *reg = mach64c->reg; - - vesaPreserve(card); - if (reg) - { - mach64c->save.LCD_GEN_CTRL = mach64ReadLCD (reg, 1); - } -} - -Bool -mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c) -{ - mach64c->reg_base = (CARD8 *) KdMapDevice (MACH64_REG_BASE(card), - MACH64_REG_SIZE(card)); - - if (!mach64c->reg_base) - { - mach64c->reg = 0; - mach64c->media_reg = 0; - return FALSE; - } - - KdSetMappedMode (MACH64_REG_BASE(card), - MACH64_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - mach64c->reg = (Reg *) (mach64c->reg_base + MACH64_REG_OFF(card)); - mach64c->media_reg = (MediaReg *) (mach64c->reg_base + MACH64_MEDIA_REG_OFF(card)); - return TRUE; -} - -void -mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c) -{ - if (mach64c->reg_base) - { - KdResetMappedMode (MACH64_REG_BASE(card), - MACH64_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice ((void *) mach64c->reg_base, MACH64_REG_SIZE(card)); - mach64c->reg_base = 0; - mach64c->reg = 0; - mach64c->media_reg = 0; - } -} - -void -mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c) -{ - if (!mach64c->reg_base) - mach64MapReg (card, mach64c); - if (mach64c->reg) - { - if (mach64c->reg->GUI_STAT == 0xffffffff) - FatalError ("Mach64 REG not visible\n"); - } -} - -void -mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c) -{ - mach64UnmapReg (card, mach64c); -} - -Bool -mach64Enable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - Mach64CardInfo *mach64c = pScreenPriv->card->driver; - - if (!vesaEnable (pScreen)) - return FALSE; - - mach64SetMMIO (pScreenPriv->card, mach64c); - mach64DPMS (pScreen, KD_DPMS_NORMAL); -#ifdef XV - KdXVEnable (pScreen); -#endif - return TRUE; -} - -void -mach64Disable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - Mach64CardInfo *mach64c = pScreenPriv->card->driver; - -#ifdef XV - KdXVDisable (pScreen); -#endif - mach64ResetMMIO (pScreenPriv->card, mach64c); - vesaDisable (pScreen); -} - -const CARD8 mach64DPMSModes[4] = { - 0x80, /* KD_DPMS_NORMAL */ - 0x8c, /* KD_DPMS_STANDBY */ - 0x8c, /* KD_DPMS_STANDBY */ - 0x8c, /* KD_DPMS_STANDBY */ -/* 0xb0, KD_DPMS_SUSPEND */ -/* 0xbc, KD_DPMS_POWERDOWN */ -}; - -#define PWR_MGT_ON (1 << 0) -#define PWR_MGT_MODE (3 << 1) -#define PWR_MGT_MODE_PIN (0 << 1) -#define PWR_MGT_MODE_REG (1 << 1) -#define PWR_MGT_MODE_TIMER (2 << 1) -#define PWR_MGR_MODE_PCI (3 << 1) -#define AUTO_PWRUP_EN (1 << 3) -#define ACTIVITY_PIN_ON (1 << 4) -#define STANDBY_POL (1 << 5) -#define SUSPEND_POL (1 << 6) -#define SELF_REFRESH (1 << 7) -#define ACTIVITY_PIN_EN (1 << 8) -#define KEYBD_SNOOP (1 << 9) -#define DONT_USE_F32KHZ (1 << 10) -#define TRISTATE_MEM_EN (1 << 11) -#define LCDENG_TEST_MODE (0xf << 12) -#define STANDBY_COUNT (0xf << 16) -#define SUSPEND_COUNT (0xf << 20) -#define BIASON (1 << 24) -#define BLON (1 << 25) -#define DIGON (1 << 26) -#define PM_D3_RST_ENB (1 << 27) -#define STANDBY_NOW (1 << 28) -#define SUSPEND_NOW (1 << 29) -#define PWR_MGT_STATUS (3 << 30) -#define PWR_MGT_STATUS_ON (0 << 30) -#define PWR_MGT_STATUS_STANDBY (1 << 30) -#define PWR_MGT_STATUS_SUSPEND (2 << 30) -#define PWR_MGT_STATUS_TRANSITION (3 << 30) - -Bool -mach64DPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - Mach64CardInfo *mach64c = pScreenPriv->card->driver; - int hsync_off = 0, vsync_off = 0, blank = 0; - CARD32 CRTC_GEN_CNTL; - CARD32 LCD_GEN_CTRL; - Reg *reg = mach64c->reg; - - if (!reg) - return FALSE; - - CRTC_GEN_CNTL = reg->CRTC_GEN_CNTL; - LCD_GEN_CTRL = mach64ReadLCD (reg, 1); - - switch (mode) { - case KD_DPMS_NORMAL: - hsync_off = 0; - vsync_off = 0; - blank = 0; - break; - case KD_DPMS_STANDBY: - hsync_off = 1; - vsync_off = 0; - blank = 1; - break; - case KD_DPMS_SUSPEND: - hsync_off = 0; - vsync_off = 1; - blank = 1; - break; - case KD_DPMS_POWERDOWN: - hsync_off = 1; - vsync_off = 1; - blank = 1; - } - - if (hsync_off) - CRTC_GEN_CNTL |= (1 << 2); - else - CRTC_GEN_CNTL &= ~(1 << 2); - if (vsync_off) - CRTC_GEN_CNTL |= (1 << 3); - else - CRTC_GEN_CNTL &= ~(1 << 3); - if (blank) - { - mach64c->lcdEnabled = (LCD_GEN_CTRL & (1 << 1)) != 0; - LCD_GEN_CTRL &= ~(1 << 1); - CRTC_GEN_CNTL |= (1 << 6); - - } - else - { - if (!(LCD_GEN_CTRL & 3) || mach64c->lcdEnabled) - LCD_GEN_CTRL |= (1 << 1); - CRTC_GEN_CNTL &= ~(1 << 6); - } - - kaaWaitSync (pScreen); - - mach64WriteLCD (reg, 1, LCD_GEN_CTRL); - - reg->CRTC_GEN_CNTL = CRTC_GEN_CNTL; - return TRUE; -} - -static void -mach64Restore (KdCardInfo *card) -{ - Mach64CardInfo *mach64c = card->driver; - Reg *reg = mach64c->reg; - - if (reg) - { - mach64WriteLCD (reg, 1, mach64c->save.LCD_GEN_CTRL); - } - mach64ResetMMIO (card, mach64c); - vesaRestore (card); -} - -static void -mach64ScreenFini (KdScreenInfo *screen) -{ - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; -#ifdef XV - mach64FiniVideo(screen->pScreen); -#endif - vesaScreenFini (screen); - xfree (mach64s); - screen->driver = 0; -} - -static void -mach64CardFini (KdCardInfo *card) -{ - Mach64CardInfo *mach64c = card->driver; - - mach64UnmapReg (card, mach64c); - vesaCardFini (card); - xfree (mach64c); -} - -#define mach64CursorInit 0 /* initCursor */ -#define mach64CursorEnable 0 /* enableCursor */ -#define mach64CursorDisable 0 /* disableCursor */ -#define mach64CursorFini 0 /* finiCursor */ -#define mach64RecolorCursor 0 /* recolorCursor */ - -KdCardFuncs mach64Funcs = { - mach64CardInit, /* cardinit */ - mach64ScreenInit, /* scrinit */ - mach64InitScreen, /* initScreen */ - mach64FinishInitScreen, /* finishInitScreen */ - mach64CreateResources, /* createRes */ - mach64Preserve, /* preserve */ - mach64Enable, /* enable */ - mach64DPMS, /* dpms */ - mach64Disable, /* disable */ - mach64Restore, /* restore */ - mach64ScreenFini, /* scrfini */ - mach64CardFini, /* cardfini */ - - mach64CursorInit, /* initCursor */ - mach64CursorEnable, /* enableCursor */ - mach64CursorDisable, /* disableCursor */ - mach64CursorFini, /* finiCursor */ - mach64RecolorCursor, /* recolorCursor */ - - mach64DrawInit, /* initAccel */ - mach64DrawEnable, /* enableAccel */ - mach64DrawDisable, /* disableAccel */ - mach64DrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; diff --git a/hw/kdrive/mach64/mach64.h b/hw/kdrive/mach64/mach64.h deleted file mode 100644 index fbb10b2ba..000000000 --- a/hw/kdrive/mach64/mach64.h +++ /dev/null @@ -1,653 +0,0 @@ -/* - * Copyright © 2001 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. - */ - -#ifndef _MACH64_H_ -#define _MACH64_H_ -#include <vesa.h> -#include "kxv.h" - -/* - * offset from ioport beginning - */ - -#define MACH64_REG_BASE(c) ((c)->attr.address[1]) -#define MACH64_REG_SIZE(c) (4096) - -#define MACH64_REG_OFF(c) (1024) -#define MACH64_MEDIA_REG_OFF(c) (0) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _Reg { - VOL32 CRTC_H_TOTAL_DISP; /* 0x00 */ - VOL32 CRTC_H_SYNC_STRT_WID; /* 0x01 */ - VOL32 CRTC_V_TOTAL_DISP; /* 0x02 */ - VOL32 CRTC_V_SYNC_STRT_WID; /* 0x03 */ - VOL32 CRTC_VLINE_CRNT_VLINE; /* 0x04 */ - VOL32 CRTC_OFF_PITCH; /* 0x05 */ - VOL32 CRTC_INT_CNTL; /* 0x06 */ - VOL32 CRTC_GEN_CNTL; /* 0x07 */ - VOL32 DSP_CONFIG; /* 0x08 */ - VOL32 DSP_ON_OFF; /* 0x09 */ - VOL32 TIMER_CONFIG; /* 0x0a */ - VOL32 MEM_BUF_CNTL; /* 0x0b */ - VOL32 unused0; /* 0x0c */ - VOL32 MEM_ADDR_CONFIG; /* 0x0d */ - VOL32 CRT_TRAP; /* 0x0e */ - VOL32 I2C_CNTL_0; /* 0x0f */ - VOL32 OVR_CLR; /* 0x10 */ - VOL32 OVR_WID_LEFT_RIGHT; /* 0x11 */ - VOL32 OVR_WID_TOP_BOTTOM; /* 0x12 */ - VOL32 VGA_DSP_CONFIG; /* 0x13 */ - VOL32 VGA_DSP_ON_OFF; /* 0x14 */ - VOL32 DSP2_CONFIG; /* 0x15 */ - VOL32 DSP2_ON_OFF; /* 0x16 */ - VOL32 CRTC2_OFF_PITCH; /* 0x17 */ - VOL32 CUR_CLR0; /* 0x18 */ - VOL32 CUR_CLR1; /* 0x19 */ - VOL32 CUR_OFFSET; /* 0x1a */ - VOL32 CUR_HORZ_VERT_POSN; /* 0x1b */ - VOL32 CUR_HORZ_VERT_OFF; /* 0x1c */ - VOL32 TV_OUT_INDEX; /* 0x1d */ - VOL32 GP_IO; /* 0x1e */ - VOL32 HW_DEBUG; /* 0x1f */ - VOL32 SCRATCH_REG0; /* 0x20 */ - VOL32 SCRATCH_REG1; - VOL32 SCRATCH_REG2; - VOL32 SCRATCH_REG3; - VOL32 CLOCK_CNTL; - VOL32 CONFIG_STAT1; - VOL32 CONFIG_STAT2; - VOL32 TV_OUT_DATA; - VOL32 BUS_CNTL; /* 0x28 */ - VOL32 LCD_INDEX; /* 0x29 */ - VOL32 LCD_DATA; /* 0x2a */ - VOL32 EXT_MEM_CNTL; - VOL32 MEM_CNTL; - VOL32 MEM_VGA_WP_SEL; - VOL32 MEM_VGA_RP_SEL; - VOL32 I2C_CNTL_1; - VOL32 DAC_REGS; /* 0x30 */ - VOL32 DAC_CNTL; /* 0x31 */ - VOL32 unused_32; - VOL32 unused_33; - VOL32 GEN_TEST_CNTL; /* 0x34 */ - VOL32 CUSTOM_MACRO_CNTL; - VOL32 unused36; - VOL32 CONFIG_CNTL; - VOL32 CONFIG_CHIP_ID; - VOL32 CONFIG_STAT0; - VOL32 CRC_SIG; - VOL32 unused_3b; - VOL32 unused_3c; - VOL32 unused_3d; - VOL32 unused_3e; - VOL32 unused_3f; - VOL32 DST_OFF_PITCH; /* 0x40 */ - VOL32 DST_X; - VOL32 DST_Y; - VOL32 DST_Y_X; - VOL32 DST_WIDTH; - VOL32 DST_HEIGHT; - VOL32 DST_HEIGHT_WIDTH; - VOL32 DST_X_WIDTH; - VOL32 DST_BRES_LNTH; - VOL32 DST_BRES_ERR; - VOL32 DST_BRES_INC; - VOL32 DST_BRES_DEC; - VOL32 DST_CNTL; - VOL32 DST_Y_X_ALIAS; - VOL32 TRAIL_BRES_ERR; - VOL32 TRAIL_BRES_INC; - VOL32 TRAIL_BRES_DEC; - VOL32 LEAD_BRES_LNTH; - VOL32 Z_OFF_PITCH; - VOL32 Z_CNTL; - VOL32 ALPHA_TST_CNTL; - VOL32 unused55; - VOL32 SECONDARY_STW_EXP; - VOL32 SECONDARY_S_X_INC; - VOL32 SECONDARY_S_Y_INC; - VOL32 SECONDARY_S_START; - VOL32 SECONDARY_W_X_INC; - VOL32 SECONDARY_W_Y_INC; - VOL32 SECONDARY_W_START; - VOL32 SECONDARY_T_X_INC; - VOL32 SECONDARY_T_Y_INC; - VOL32 SECONDARY_T_START; - VOL32 SRC_OFF_PITCH; - VOL32 SRC_X; - VOL32 SRC_Y; - VOL32 SRC_Y_X; - VOL32 SRC_WIDTH1; - VOL32 SRC_HEIGHT1; - VOL32 SRC_HEIGHT1_WIDTH1; - VOL32 SRC_X_START; - VOL32 SRC_Y_START; - VOL32 SRC_Y_X_START; - VOL32 SRC_WIDTH2; - VOL32 SRC_HEIGHT2; - VOL32 SRC_HEIGHT2_WIDTH2; - VOL32 SRC_CNTL; - VOL32 unused6e; - VOL32 unused6f; - union { - struct { - VOL32 SCALE_OFF; /* 0x70 */ - VOL32 unused71; - VOL32 unused72; - VOL32 unused73; - VOL32 unused74; - VOL32 unused75; - VOL32 unused76; - VOL32 SCALE_WIDTH; - VOL32 SCALE_HEIGHT; - VOL32 unused79; - VOL32 unused7a; - VOL32 SCALE_PITCH; - VOL32 SCALE_X_INC; - VOL32 SCALE_Y_INC; - VOL32 SCALE_VACC; - VOL32 SCALE_3D_CNTL; /* 0x7f */ - } scaler; - struct { - VOL32 TEX_0_OFF; /* 0x70 */ - VOL32 TEX_1_OFF; - VOL32 TEX_2_OFF; - VOL32 TEX_3_OFF; - VOL32 TEX_4_OFF; - VOL32 TEX_5_OFF; - VOL32 TEX_6_OFF; - VOL32 TEX_7_OFF; - VOL32 TEX_8_OFF; - VOL32 TEX_9_OFF; - VOL32 TEX_10_OFF; - VOL32 S_Y_INC; - VOL32 RED_X_INC; - VOL32 GREEN_X_INC; /* 0x7d */ - VOL32 unused7e; - VOL32 unused7f; - } texture; - } u; - VOL32 HOST_DATA[16]; /* 0x80 */ - VOL32 HOST_CNTL; /* 0x90 */ - VOL32 BM_HOSTDATA; /* 0x91 */ - VOL32 BM_ADDR; /* 0x92 */ - VOL32 BM_GUI_TABLE_CMD; /* 0x93 */ - VOL32 unused94; /* 0x94 */ - VOL32 unused95; /* 0x95 */ - VOL32 unused96; /* 0x96 */ - VOL32 FOG_TABLE_INDEX; /* 0x97 */ - VOL32 FOG_TABLE_DATA[8]; /* 0x98 */ - VOL32 PAT_REG0; /* 0xa0 */ - VOL32 PAT_REG1; - VOL32 PAT_CNTL; - VOL32 unused_0a3; - VOL32 unused_0a4; - VOL32 unused_0a5; - VOL32 unused_0a6; - VOL32 unused_0a7; - VOL32 SC_LEFT; - VOL32 SC_RIGHT; - VOL32 SC_LEFT_RIGHT; - VOL32 SC_TOP; - VOL32 SC_BOTTOM; - VOL32 SC_TOP_BOTTOM; - VOL32 USR1_DST_OFF_PITCH; - VOL32 USR2_DST_OFF_PITCH; - VOL32 DP_BKGD_CLR; /* 0xb0 */ - VOL32 DP_FRGD_CLR; - VOL32 DP_WRITE_MSK; - VOL32 unused_0b3; - VOL32 DP_PIX_WIDTH; - VOL32 DP_MIX; - VOL32 DP_SRC; - VOL32 DP_FRGD_CLR_MIX; - VOL32 DP_FRGD_BKGD_CLR; - VOL32 unused_0b9; - VOL32 DST_X_Y; - VOL32 DST_WIDTH_HEIGHT; - VOL32 USR_DST_PITCH; - VOL32 unused_0bd; - VOL32 DP_SET_GUI_ENGINE2; - VOL32 DP_SET_GUI_ENGINE; - VOL32 CLR_CMP_CLR; /* 0xc0 */ - VOL32 CLR_CMP_MSK; - VOL32 CLR_CMP_CNTL; - VOL32 unused_0c3; - VOL32 FIFO_STAT; - VOL32 unused_0c5; - VOL32 unused_0c6; - VOL32 unused_0c7; - VOL32 unused_0c8; - VOL32 unused_0c9; - VOL32 unused_0ca; - VOL32 unused_0cb; - VOL32 GUI_TRAJ_CNTL; - VOL32 unused_0cd; - VOL32 GUI_STAT; - VOL32 unused_0cf; - VOL32 TEX_PALETTE_INDEX; - VOL32 STW_EXP; - VOL32 LOG_MAX_INC; - VOL32 S_X_INC; - VOL32 S_Y_INC_2_SCALE_PITCH; - VOL32 S_START; - VOL32 W_X_INC; - VOL32 W_Y_INC; - VOL32 W_START; - VOL32 T_X_INC; - VOL32 T_Y_INC_SECONDARY_SCALE_PITCH; - VOL32 T_START; - VOL32 TEX_SIZE_PITCH; - VOL32 TEX_CNTL; - VOL32 SECONDARY_TEX_OFFSET_SECONDARY_SCALE_OFF; - VOL32 TEX_PALETTE; - VOL32 SCALE_PITCH_BOTH; /* 0xe0 */ - VOL32 SECONDARY_SCALE_OFF_ACC; - VOL32 SCALE_OFF_ACC; - VOL32 SCALE_DST_Y_X; - VOL32 unused_0e4; - VOL32 unused_0e5; - VOL32 COMPOSITE_SHADOW_ID; - VOL32 SECONDARY_SCALE_X_INC_SPECULAR_RED_X_INC; - VOL32 SPECULAR_RED_Y_INC; - VOL32 SPECULAR_RED_START_SECONDARY_SCALE_HACC;; - VOL32 SPECULAR_GREEN_X_INC; - VOL32 SPECULAR_GREEN_Y_INC; - VOL32 SPECULAR_GREEN_START; - VOL32 SPECULAR_BLUE_X_INC; - VOL32 SPECULAR_BLUE_Y_INC; - VOL32 SPECULAR_BLUE_START; - VOL32 RED_X_INC_SCALE_X_INC; - VOL32 RED_Y_INC; - VOL32 RED_START_SCALE_HACC; - VOL32 GREEN_X_INC_SCALE_Y_INC; - VOL32 GREEN_Y_INC_SECONDARY_SCALE_Y_INC; - VOL32 GREEN_START_SECONDARY_SCALE_VACC; - VOL32 BLUE_X_INC; - VOL32 BLUE_Y_INC; - VOL32 BLUE_START; - VOL32 Z_X_INC; - VOL32 Z_Y_INC; - VOL32 Z_START; - VOL32 ALPHA_X_INC; - VOL32 FOG_X_INC; - VOL32 ALPHA_Y_INC; - VOL32 FOG_Y_INC; - VOL32 ALPHA_START; - VOL32 FOG_START; - VOL32 unused_0ff; -} Reg; /* 0x100 */ - -#define DST_X_DIR (1 << 0) -#define DST_Y_DIR (1 << 1) -#define DST_Y_MAJOR (1 << 2) -#define DST_X_TILE (1 << 3) -#define DST_Y_TILE (1 << 4) -#define DST_LAST_PEL (1 << 5) -#define DST_POLYGON_EN (1 << 6) -#define DST_24_ROT_EN (1 << 7) -#define DST_24_ROT(n) ((n) << 8) -#define DST_BRES_ZERO (1 << 11) -#define DST_POLYGON_RTEDGE_DIS (1 << 12) -#define TRAIL_X_DIR (1 << 13) -#define TRAP_FILL_DIR (1 << 14) -#define TRAIL_BRES_SIGN (1 << 15) -#define SRC_PATT_EN (1 << 16) -#define SRC_PATT_ROT_EN (1 << 17) -#define SRC_LINEAR_EN (1 << 18) -#define SRC_BYTE_ALIGN (1 << 19) -#define SRC_LINE_X_DIR (1 << 20) -#define SRC_8x8x8_BRUSH (1 << 21) -#define FAST_FILL_EN (1 << 22) -#define SRC_TRACK_DST (1 << 23) -#define PAT_MONO_EN (1 << 24) -#define PAT_CLR_4x2_EN (1 << 25) -#define PAT_CLR_8x1_EN (1 << 26) -#define HOST_BYTE_ALIGN (1 << 28) -#define HOST_BIG_ENDIAN_EN (1 << 29) - -/* BUS_CNTL bits */ -#define BUS_DBL_RESYNC (1 << 0) -#define BUS_MSTR_RESET (1 << 1) -#define BUS_FLUSH_BUF (1 << 2) -#define BUS_STOP_REQ_DIS (1 << 3) -#define BUS_APER_REG_DIS (1 << 4) -#define BUS_EXTRA_PIPE_DIS (1 << 5) -#define BUS_MASTER_DIS (1 << 6) -#define ROM_WRT_EN (1 << 7) -#define CHIP_HIDDEN_REV (3 << 8) -#define BUS_PCI_READ_RETRY_EN (1 << 13) -#define BUS_PCI_WRT_RETRY_EN (1 << 15) -#define BUS_RETRY_WS (0xf << 16) -#define BUS_MSTR_RD_MULT (1 << 20) -#define BUS_MSTR_RD_LINE (1 << 21) -#define BUS_SUSPEND (1 << 22) -#define LAT16X (1 << 23) -#define BUS_RD_DISCARD_EN (1 << 24) -#define BUS_RD_ABORT_EN (1 << 25) -#define BUS_MSTR_WS (1 << 26) -#define BUS_EXT_REG_EN (1 << 27) -#define BUS_MSTR_DISCONNECT_EN (1 << 28) -#define BUS_WRT_BURST (1 << 29) -#define BUS_READ_BURST (1 << 30) -#define BUS_RDY_READ_DLY (1 << 31) - -#define SCALE_PIX_EXPAND (1 << 0) -#define SCALE_Y2R_TEMP (1 << 1) -#define SCALE_HORZ_MODE (1 << 2) -#define SCALE_VERT_MODE (1 << 3) -#define SCALE_SIGNED_UV (1 << 4) -#define SCALE_GAMMA_SEL (3 << 5) -#define SCALE_GAMMA_BRIGHT (0 << 5) -#define SCALE_GAMMA_22 (1 << 5) -#define SCALE_GAMMA_18 (2 << 5) -#define SCALE_GAMMA_14 (3 << 5) -#define SCALE_DISP_SEL (1 << 7) -#define SCALE_BANDWIDTH (1 << 26) -#define SCALE_DIS_LIMIT (1 << 27) -#define SCALE_CLK_FORCE_ON (1 << 29) -#define SCALE_OVERLAY_EN (1 << 30) -#define SCALE_EN (1 << 31) - -#define VIDEO_IN_VYUY422 (0xb) -#define VIDEO_IN_YVYU422 (0xc) -#define SCALER_IN_15bpp (0x3 << 16) -#define SCALER_IN_16bpp (0x4 << 16) -#define SCALER_IN_32bpp (0x6 << 16) -#define SCALER_IN_YUV_9 (0x9 << 16) -#define SCALER_IN_YUV_12 (0xa << 16) -#define SCALER_IN_VYUY422 (0xb << 16) -#define SCALER_IN_YVYU422 (0xc << 16) - -#define CAP_INPUT_MODE (1 << 0) -#define CAP_BUF_MODE (1 << 2) -#define CAP_START_BUF (1 << 3) -#define CAP_BUF_TYPE_FIELD (0 << 4) -#define CAP_BUF_TYPE_ALTERNATING (1 << 4) -#define CAP_BUF_TYPE_FRAME (2 << 4) - -#define OVL_BUF_MODE (1 << 28) -#define OVL_BUF_NEXT (1 << 29) - -#define CAP_TRIGGER (3 << 0) -#define OVL_CUR_BUF (1 << 5) -#define OVL_BUF_STATUS (1 << 6) -#define CAP_BUF_STATUS (1 << 7) -#define CAPTURE_EN (1 << 31) - -typedef struct _MediaReg { - VOL32 OVERLAY_Y_X_START; /* 0x100 */ - VOL32 OVERLAY_Y_X_END; - VOL32 OVERLAY_VIDEO_KEY_CLR; - VOL32 OVERLAY_VIDEO_KEY_MSK; - VOL32 OVERLAY_GRAPHICS_KEY_CLR; - VOL32 OVERLAY_GRAPHICS_KEY_MSK; - VOL32 OVERLAY_KEY_CNTL; - VOL32 unused_107; - VOL32 OVERLAY_SCALE_INC; - VOL32 OVERLAY_SCALE_CNTL; - VOL32 SCALER_HEIGHT_WIDTH; - VOL32 SCALER_TEST; - VOL32 unused_10c; - VOL32 SCALER_BUF0_OFFSET; - VOL32 SCALER_BUF1_OFFSET; - VOL32 SCALER_BUF_PITCH; - VOL32 CAPTURE_START_END; /* 0x110 */ - VOL32 CAPTURE_X_WIDTH; - VOL32 VIDEO_FORMAT; - VOL32 VBI_START_END; - VOL32 CAPTURE_CONFIG; - VOL32 TRIG_CNTL; - VOL32 OVERLAY_EXCLUSIVE_HORZ; - VOL32 OVERLAY_EXCLUSIVE_VERT; - VOL32 VBI_WIDTH; - VOL32 CAPTURE_DEBUG; - VOL32 VIDEO_SYNC_TEST; - VOL32 unused_11b; - VOL32 SNAPSHOT_VH_COUNTS; - VOL32 SNAPSHOT_F_COUNT; - VOL32 N_VIF_COUNT; - VOL32 SNAPSHOT_VIF_COUNT; - VOL32 CAPTURE_BUF0_OFFSET; /* 0x120 */ - VOL32 CAPTURE_BUF1_OFFSET; - VOL32 ONESHOT_BUF_OFFSET; - VOL32 unused_123; - VOL32 unused_124; - VOL32 unused_125; - VOL32 unused_126; - VOL32 unused_127; - VOL32 unused_128; - VOL32 unused_129; - VOL32 unused_12a; - VOL32 unused_12b; - VOL32 SNAPSHOT2_VH_COUNTS; - VOL32 SNAPSHOT2_F_COUNT; - VOL32 N_VIF2_COUNT; - VOL32 SNAPSHOT2_VIF_COUNT; - VOL32 MPP_CONFIG; /* 0x130 */ - VOL32 MPP_STROBE_SEQ; - VOL32 MPP_ADDR; - VOL32 MPP_DATA; - VOL32 unused_134; - VOL32 unused_135; - VOL32 unused_136; - VOL32 unused_137; - VOL32 unused_138; - VOL32 unused_139; - VOL32 unused_13a; - VOL32 unused_13b; - VOL32 unused_13c; - VOL32 unused_13d; - VOL32 unused_13e; - VOL32 unused_13f; - VOL32 TVO_CNTL; /* 0x140 */ - VOL32 unused_141[15]; - VOL32 unused_150; /* 0x150 */ - VOL32 CRT_HORZ_VERT_LOAD; /* 0x151 */ - VOL32 AGP_BASE; /* 0x152 */ - VOL32 AGP_CNTL; /* 0x153 */ - VOL32 SCALER_COLOUR_CNTL; /* 0x154 */ - VOL32 SCALER_H_COEFF0; /* 0x155 */ - VOL32 SCALER_H_COEFF1; /* 0x156 */ - VOL32 SCALER_H_COEFF2; /* 0x157 */ - VOL32 SCALER_H_COEFF3; /* 0x158 */ - VOL32 SCALER_H_COEFF4; /* 0x159 */ - VOL32 unused_15a; - VOL32 unused_15b; - VOL32 GUI_CMDFIFO_DEBUG; - VOL32 GUI_CMDFIFO_DATA; - VOL32 GUI_CNTL; - VOL32 unused_15f; - VOL32 BM_FRAME_BUF_OFFSET; /* 0x160 */ - VOL32 BM_SYSTEM_MEM_ADDR; - VOL32 BM_COMMAND; - VOL32 BM_STATUS; - VOL32 unused_164[10]; - VOL32 BM_GUI_TABLE; - VOL32 BM_SYSTEM_TABLE; - VOL32 unused_170[5]; /* 0x170 */ - VOL32 SCALER_BUF0_OFFSET_U; - VOL32 SCALER_BUF0_OFFSET_V; - VOL32 SCALER_BUF1_OFFSET_U; - VOL32 SCALER_BUF1_OFFSET_V; - VOL32 unused_179[7]; - VOL32 unused_180[16]; /* 0x180 */ - VOL32 setup_engine[0x40]; /* 0x190 */ - VOL32 dvd_subpicture[0x30]; /* 0x1d0 */ -} MediaReg; - -#define MACH64_XY(x,y) (((x) & 0x7fff) | (((y) & 0x7fff) << 16)) -#define MACH64_YX(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16)) - -typedef struct _mach64Save { - CARD32 LCD_GEN_CTRL; -} Mach64Save; - -typedef struct _mach64CardInfo { - VesaCardPrivRec vesa; - CARD8 *reg_base; - Reg *reg; - MediaReg *media_reg; - Mach64Save save; - Bool lcdEnabled; -} Mach64CardInfo; - -#define getMach64CardInfo(kd) ((Mach64CardInfo *) ((kd)->card->driver)) -#define mach64CardInfo(kd) Mach64CardInfo *mach64c = getMach64CardInfo(kd) - -typedef struct _mach64Cursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} Mach64Cursor; - -#define MACH64_CURSOR_WIDTH 64 -#define MACH64_CURSOR_HEIGHT 64 - -/* - * Xv information, optional - */ -typedef struct _mach64PortPriv { - CARD32 YBuf0Offset; - - CARD32 YBuf1Offset; - - CARD8 currentBuf; - - int brightness; - int saturation; - - RegionRec clip; - CARD32 colorKey; - - Bool videoOn; - Time offTime; - Time freeTime; - CARD32 size; - CARD32 offset; - KdOffscreenArea *off_screen; -} Mach64PortPrivRec, *Mach64PortPrivPtr; - -Bool mach64InitVideo(ScreenPtr pScreen); -void mach64FiniVideo(ScreenPtr pScreen); - -/* - * These values are per-format, which is essentially per-depth/per-bpp. - * Because bpp is fixed for the screen by depth, they're computed - * per-screen per-depth. - */ - -typedef struct _mach64ScreenInfo { - VesaScreenPrivRec vesa; - Mach64Cursor cursor; - CARD32 colorKey; - KdVideoAdaptorPtr pAdaptor; - KaaScreenInfoRec kaa; -} Mach64ScreenInfo; - -#define getMach64ScreenInfo(kd) ((Mach64ScreenInfo *) ((kd)->screen->driver)) -#define mach64ScreenInfo(kd) Mach64ScreenInfo *mach64s = getMach64ScreenInfo(kd) - -CARD32 -mach64ReadLCD (Reg *reg, int id); - -void -mach64WriteLCD (Reg *reg, int id, CARD32 data); - -void -mach64Preserve (KdCardInfo *card); - -Bool -mach64MapReg (KdCardInfo *card, Mach64CardInfo *mach64c); - -void -mach64UnmapReg (KdCardInfo *card, Mach64CardInfo *mach64c); - -void -mach64SetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c); - -void -mach64ResetMMIO (KdCardInfo *card, Mach64CardInfo *mach64c); - -Bool -mach64Enable (ScreenPtr pScreen); - -void -mach64Disable (ScreenPtr pScreen); - -Bool -mach64DPMS (ScreenPtr pScreen, int mode); - -void -mach64WaitAvail(Reg *reg, int n); - -void -mach64WaitIdle (Reg *reg); - -Bool -mach64DrawSetup (ScreenPtr pScreen); - -Bool -mach64DrawInit (ScreenPtr pScreen); - -void -mach64DrawReinit (ScreenPtr pScreen); - -void -mach64DrawEnable (ScreenPtr pScreen); - -void -mach64DrawDisable (ScreenPtr pScreen); - -void -mach64DrawFini (ScreenPtr pScreen); - -CARD8 -mach64ReadIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index); - -void -mach64WriteIndex (Mach64CardInfo *mach64c, CARD16 port, CARD8 index, CARD8 value); - -Bool -mach64CursorInit (ScreenPtr pScreen); - -void -mach64CursorEnable (ScreenPtr pScreen); - -void -mach64CursorDisable (ScreenPtr pScreen); - -void -mach64CursorFini (ScreenPtr pScreen); - -void -mach64RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -extern KdCardFuncs mach64Funcs; - -#endif /* _MACH64_H_ */ diff --git a/hw/kdrive/mach64/mach64curs.c b/hw/kdrive/mach64/mach64curs.c deleted file mode 100644 index 4a5938162..000000000 --- a/hw/kdrive/mach64/mach64curs.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "trident.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - tridentCardInfo(pScreenPriv); \ - tridentScreenInfo(pScreenPriv); \ - TridentCursor *pCurPriv = &tridents->cursor - -static void -_tridentMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - - - /* This is the recommended order to move the cursor */ - - tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); - tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); - tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); - tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); - tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); - tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); -} - -static void -tridentMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _tridentMoveCursor (pScreen, x, y); -} - -static void -tridentAllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -tridentSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CARD32 fg, bg; - - fg = pCurPriv->source; - bg = pCurPriv->mask; - tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); - tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); - tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); - - tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); - tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); - tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); -} - -void -tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - tridentAllocCursorColors (pScreen); - tridentSetCursorColors (pScreen); -} - -#define InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -static void -tridentLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - - /* - * Allocate new colors - */ - tridentAllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (CARD32 *) tridents->cursor_base; - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > TRIDENT_CURSOR_HEIGHT) - h = TRIDENT_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ - - for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - -#if 1 - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - InvertBits32(m); - InvertBits32(s); - } - else - { - m = 0; - s = 0; - } -#endif - *ram++ = m; - *ram++ = s; - } - } - - /* Set address for cursor bits */ - offset = tridents->cursor_base - (CARD8 *) tridents->screen; - offset >>= 10; - tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); - tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); - - /* Set new color */ - tridentSetCursorColors (pScreen); - - /* Enable the cursor */ - tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); - - /* Move to new position */ - tridentMoveCursor (pScreen, x, y); -} - -static void -tridentUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); -} - -static Bool -tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - tridentLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - tridentLoadCursor (pScreen, x, y); - else - tridentUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec tridentPointerSpriteFuncs = { - tridentRealizeCursor, - tridentUnrealizeCursor, - tridentSetCursor, - tridentMoveCursor, -}; - -static void -tridentQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -tridentCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!tridents->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = TRIDENT_CURSOR_WIDTH; - pCurPriv->height= TRIDENT_CURSOR_HEIGHT; - pScreen->QueryBestSize = tridentQueryBestSize; - miPointerInitialize (pScreen, - &tridentPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -tridentCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - tridentLoadCursor (pScreen, x, y); - } - else - tridentUnloadCursor (pScreen); - } -} - -void -tridentCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - tridentUnloadCursor (pScreen); - } - } -} - -void -tridentCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/mach64/mach64draw.c b/hw/kdrive/mach64/mach64draw.c deleted file mode 100644 index 15d4d417a..000000000 --- a/hw/kdrive/mach64/mach64draw.c +++ /dev/null @@ -1,590 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mach64.h" -#include "mach64draw.h" - -#include <X11/Xmd.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" -#include "kaa.h" - -CARD8 mach64Rop[16] = { - /* GXclear */ 0x01, /* 0 */ - /* GXand */ 0x0c, /* src AND dst */ - /* GXandReverse */ 0x0d, /* src AND NOT dst */ - /* GXcopy */ 0x07, /* src */ - /* GXandInverted*/ 0x0e, /* NOT src AND dst */ - /* GXnoop */ 0x03, /* dst */ - /* GXxor */ 0x05, /* src XOR dst */ - /* GXor */ 0x0b, /* src OR dst */ - /* GXnor */ 0x0f, /* NOT src AND NOT dst */ - /* GXequiv */ 0x06, /* NOT src XOR dst */ - /* GXinvert */ 0x00, /* NOT dst */ - /* GXorReverse */ 0x0a, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x04, /* NOT src */ - /* GXorInverted */ 0x09, /* NOT src OR dst */ - /* GXnand */ 0x08, /* NOT src OR NOT dst */ - /* GXset */ 0x02, /* 1 */ -}; - -#define MACH64_DRAW_COMBO_SOLID 0x1 -#define MACH64_DRAW_COMBO_COPY 0x8 - -#define SYNC_ALWAYS 0 -static Reg *reg; -static CARD32 avail; -static CARD32 triple; - -#define IDX(reg,n) (&(reg)->n - &(reg)->CRTC_H_TOTAL_DISP) - -void -mach64WaitAvail(Reg *reg, int n) -{ - if (avail < n) - { - while ((avail = ((reg->GUI_STAT) >> 16) & 0x3ff) < n) - ; - } - avail -= n; -} - -void -mach64WaitIdle (Reg *reg) -{ - while (reg->GUI_STAT & 1) - ; -} - -#define PIX_FORMAT_MONO 0 -#define PIX_FORMAT_PSEUDO_8 2 -#define PIX_FORMAT_TRUE_1555 3 -#define PIX_FORMAT_TRUE_565 4 -#define PIX_FORMAT_TRUE_8888 6 -#define PIX_FORMAT_TRUE_332 7 -#define PIX_FORMAT_GRAY_8 8 -#define PIX_FORMAT_YUV_422 0xb -#define PIX_FORMAT_YUV_444 0xe -#define PIX_FORMAT_TRUE_4444 0xf - -typedef struct _mach64AccelReg { - int depth; - int bitsPerPixel; - CARD32 DP_PIX_WIDTH; - CARD32 DP_SET_GUI_ENGINE; -} Mach64AccelReg; - -static const Mach64AccelReg mach64AccelReg[] = { - { 1, 1, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_MONO << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_MONO << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_MONO << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_MONO << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_MONO << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_MONO << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - }, - { 8, 8, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_PSEUDO_8 << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_PSEUDO_8 << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - }, - { 15, 16, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_TRUE_1555 << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_TRUE_1555 << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_TRUE_1555 << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_TRUE_1555 << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_TRUE_1555 << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_TRUE_1555 << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - }, - { 16, 16, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_TRUE_565 << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_TRUE_565 << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_TRUE_565 << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_TRUE_565 << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_TRUE_565 << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_TRUE_565 << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - }, - { 24, 24, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_PSEUDO_8 << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_PSEUDO_8 << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_PSEUDO_8 << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_PSEUDO_8 << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_PSEUDO_8 << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_PSEUDO_8 << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - }, - { 24, 32, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_TRUE_8888 << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - }, - { 32, 32, - /* DP_PIX_WIDTH */ - ((PIX_FORMAT_TRUE_8888 << 0) | /* DP_DST_PIX_WIDTH */ - (PIX_FORMAT_TRUE_8888 << 4) | /* COMPOSITE_PIX_WIDTH */ - (PIX_FORMAT_TRUE_8888 << 8) | /* DP_SRC_PIX_WIDTH */ - (0 << 13) | /* DP_HOST_TRIPLE_EN */ - (0 << 14) | /* DP_PALETTE_TYPE */ - (PIX_FORMAT_TRUE_8888 << 16) | /* DP_HOST_PIX_WIDTH */ - (0 << 20) | /* DP_C14_RGB_INDEX */ - (0 << 24) | /* DP_BYTE_PIX_ORDER */ - (0 << 25) | /* DP_CONVERSION_TEMP */ - (0 << 26) | /* DP_C14_RGB_LOW_NIBBLE */ - (0 << 27) | /* DP_C14_RGB_HIGH_NIBBLE */ - (PIX_FORMAT_TRUE_8888 << 28) | /* DP_SCALE_PIX_WIDTH */ - 0), - /* DP_SET_GUI_ENGINE */ - ((PIX_FORMAT_TRUE_8888 << 3) | - (1 << 6) | /* SET_DP_SRC_PIX_WIDTH */ - (6 << 7) | /* SET_DST_OFFSET */ - (0 << 10) | /* SET_DST_PITCH */ - (0 << 14) | /* SET_DST_PITCH_BY_2 */ - (0 << 15) | /* SET_SRC_OFFPITCH_COPY */ - (0 << 16) | /* SET_SRC_HGTWID1_2 */ - (0 << 20) | /* SET_DRAWING_COMBO */ - (1 << 24) | /* SET_BUS_MASTER_OP */ - (0 << 26) | /* SET_BUS_MASTER_EN */ - (0 << 27) | /* SET_BUS_MASTER_SYNC */ - (0 << 28) | /* DP_HOST_TRIPLE_EN */ - (0 << 29) | /* FAST_FILL_EN */ - (0 << 30) | /* BLOCK_WRITE_EN */ - 0) - } -}; - -#define NACCELREG (sizeof mach64AccelReg / sizeof mach64AccelReg[0]) - -static void -mach64WaitMarker (ScreenPtr pScreen, int marker) -{ - KdScreenPriv(pScreen); - mach64CardInfo(pScreenPriv); - reg = mach64c->reg; - - mach64WaitIdle (reg); -} - -static Bool -mach64Setup (PixmapPtr pDst, PixmapPtr pSrc, CARD32 combo, int wait) -{ - ScreenPtr pScreen = pDst->drawable.pScreen; - KdScreenPriv(pScreen); - mach64CardInfo(pScreenPriv); - CARD32 DST_PITCH; - CARD32 DST_OFFSET; - CARD32 SRC_PITCH; - CARD32 SRC_OFFSET; - CARD32 DP_PIX_WIDTH; - CARD32 DP_SET_GUI_ENGINE; - int i; - - for (i = 0; i < NACCELREG; i++) - if (mach64AccelReg[i].depth == pDst->drawable.depth && - mach64AccelReg[i].bitsPerPixel == pDst->drawable.bitsPerPixel) - break; - if (i == NACCELREG) - return FALSE; - DP_PIX_WIDTH = mach64AccelReg[i].DP_PIX_WIDTH; - DP_SET_GUI_ENGINE = mach64AccelReg[i].DP_SET_GUI_ENGINE; - - reg = mach64c->reg; - if (!reg) - return FALSE; - - triple = (pDst->drawable.bitsPerPixel == 24); - - if (triple) - { - /* bytes / 8 = bytes >> 3 */ - DST_PITCH = pDst->devKind >> 3; - } - else - { - /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */ - DST_PITCH = pDst->devKind / pDst->drawable.bitsPerPixel; - } - - /* bytes / 8 */ - DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3; - - mach64WaitAvail(reg, wait + (pSrc ? 5 : 4)); - reg->DP_SET_GUI_ENGINE = DP_SET_GUI_ENGINE | (combo << 20); - reg->DP_PIX_WIDTH = DP_PIX_WIDTH; - reg->DST_OFF_PITCH = ((DST_OFFSET << 0) | /* USR1_DST_OFFSET */ - (DST_PITCH << 22) | /* USR1_DST_PITCH */ - 0); - if (pSrc) - { - if (triple) - { - SRC_PITCH = pSrc->devKind >> 3; - } - else - { - /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */ - SRC_PITCH = pSrc->devKind / pSrc->drawable.bitsPerPixel; - } - /* bytes / 8 */ - SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3; - - reg->SRC_OFF_PITCH = ((SRC_OFFSET << 0) | - (SRC_PITCH << 22) | - 0); - } - return TRUE; -} - -static Bool -mach64PrepareSolid (PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - if (!mach64Setup (pPixmap, 0, 1, 3)) - return FALSE; - reg->DP_MIX = (mach64Rop[alu] << 16) | 0; - reg->DP_WRITE_MSK = pm; - reg->DP_FRGD_CLR = fg; - return TRUE; -} - -static void -mach64Solid (int x1, int y1, int x2, int y2) -{ - if (triple) - { - CARD32 traj; - - x1 *= 3; - x2 *= 3; - - traj = (DST_X_DIR | - DST_Y_DIR | - DST_24_ROT_EN | - DST_24_ROT((x1 / 4) % 6)); - mach64WaitAvail (reg, 1); - reg->GUI_TRAJ_CNTL = traj; - } - mach64WaitAvail(reg,2); - reg->DST_X_Y = MACH64_XY(x1,y1); - reg->DST_WIDTH_HEIGHT = MACH64_XY(x2-x1,y2-y1); -} - -static void -mach64DoneSolid (void) -{ -#if SYNC_ALWAYS - mach64WaitIdle (reg); -#endif -} - -static int copyDx; -static int copyDy; -static CARD32 copyCombo; - -static Bool -mach64PrepareCopy (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - int dx, - int dy, - int alu, - Pixel pm) -{ - copyCombo = 8 | 2 | 1; - copyDx = dx; - copyDy = dy; - - /* - * Avoid going backwards when copying pixmaps to the screen. - * This should reduce tearing somewhat - */ - if (pSrcPixmap == pDstPixmap) - { - if (dx <= 0) - copyCombo &= ~1; - if (dy <= 0) - copyCombo &= ~2; - } - - if (!mach64Setup (pDstPixmap, pSrcPixmap, copyCombo, 2)) - return FALSE; - - reg->DP_MIX = (mach64Rop[alu] << 16) | 0; - reg->DP_WRITE_MSK = pm; - return TRUE; -} - -static void -mach64Copy (int srcX, - int srcY, - int dstX, - int dstY, - int w, - int h) -{ - if (triple) - { - CARD32 traj; - - srcX *= 3; - dstX *= 3; - w *= 3; - - traj = DST_24_ROT_EN | DST_24_ROT((dstX / 4) % 6); - - if (copyCombo & 1) - traj |= 1; - if (copyCombo & 2) - traj |= 2; - - mach64WaitAvail (reg, 1); - reg->GUI_TRAJ_CNTL = traj; - } - if ((copyCombo & 1) == 0) - { - srcX += w - 1; - dstX += w - 1; - } - if ((copyCombo & 2) == 0) - { - srcY += h - 1; - dstY += h - 1; - } - mach64WaitAvail (reg, 4); - reg->SRC_Y_X = MACH64_YX(srcX, srcY); - reg->SRC_WIDTH1 = w; - reg->DST_Y_X = MACH64_YX(dstX, dstY); - reg->DST_HEIGHT_WIDTH = MACH64_YX(w,h); -} - -static void -mach64DoneCopy (void) -{ -#if SYNC_ALWAYS - mach64WaitIdle (reg); -#endif -} - - -Bool -mach64DrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - mach64ScreenInfo(pScreenPriv); - - memset(&mach64s->kaa, 0, sizeof(KaaScreenInfoRec)); - mach64s->kaa.waitMarker = mach64WaitMarker; - mach64s->kaa.PrepareSolid = mach64PrepareSolid; - mach64s->kaa.Solid = mach64Solid; - mach64s->kaa.DoneSolid = mach64DoneSolid; - mach64s->kaa.PrepareCopy = mach64PrepareCopy; - mach64s->kaa.Copy = mach64Copy; - mach64s->kaa.DoneCopy = mach64DoneCopy; - mach64s->kaa.offsetAlign = 64; - mach64s->kaa.pitchAlign = 64; - mach64s->kaa.flags = KAA_OFFSCREEN_PIXMAPS; - - if (pScreenPriv->screen->fb[0].depth == 4) - return FALSE; - - if (!kaaDrawInit (pScreen, &mach64s->kaa)) - return FALSE; - - return TRUE; -} - -void -mach64DrawEnable (ScreenPtr pScreen) -{ - kaaMarkSync (pScreen); -} - -void -mach64DrawDisable (ScreenPtr pScreen) -{ -} - -void -mach64DrawFini (ScreenPtr pScreen) -{ - kaaDrawFini (pScreen); -} diff --git a/hw/kdrive/mach64/mach64draw.h b/hw/kdrive/mach64/mach64draw.h deleted file mode 100644 index bac11c2a6..000000000 --- a/hw/kdrive/mach64/mach64draw.h +++ /dev/null @@ -1,69 +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. - */ - -#ifndef _TRIDENTDRAW_H_ -#define _TRIDENTDRAW_H_ - -#define SetupTrident(s) KdScreenPriv(s); \ - tridentCardInfo(pScreenPriv); \ - Cop *cop = tridentc->cop - -#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) - -#define _tridentInit(cop,tridentc) { \ - if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \ - (cop)->multi = (tridentc)->cop_depth; \ - (cop)->multi = (tridentc)->cop_stride; \ - (cop)->multi = TridentAlpha; \ -} \ - -#define _tridentSetSolidRect(cop,pix,alu,cmd) {\ - cop->multi = COP_MULTI_PATTERN; \ - cop->multi = COP_MULTI_ROP | tridentRop[alu]; \ - cop->fg = (pix); \ - cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ -} - -#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \ - (cop)->dst_start_xy = TRI_XY (x1,y1); \ - (cop)->dst_end_xy = TRI_XY(x2,y2); \ - _tridentWaitDone(cop); \ - (cop)->command = (cmd); \ -} - -#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ - COP_STATUS_DPE_BUSY | \ - COP_STATUS_MI_BUSY) - -#define _tridentWaitDone(cop) { \ - int __q__ = 500000; \ - while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ - ; \ - if (!__q__) \ - (cop)->status = 0; \ -} - -#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop) - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#endif diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c deleted file mode 100644 index 5895a3cb7..000000000 --- a/hw/kdrive/mach64/mach64stub.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mach64.h" -#include <klinux.h> - -void -InitCard (char *name) -{ - KdCardAttr attr; - - if (LinuxFindPci (0x1002, 0x4750, 0, &attr)) - KdCardInfoAdd (&mach64Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr)) - KdCardInfoAdd (&mach64Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) - KdCardInfoAdd (&mach64Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x4c49, 0, &attr)) - KdCardInfoAdd (&mach64Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x4c4d, 0, &attr)) - KdCardInfoAdd (&mach64Funcs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/mach64/mach64video.c b/hw/kdrive/mach64/mach64video.c deleted file mode 100644 index 38fcef7eb..000000000 --- a/hw/kdrive/mach64/mach64video.c +++ /dev/null @@ -1,994 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mach64.h" - -#include <X11/extensions/Xv.h> -#include "fourcc.h" - -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -static Atom xvBrightness, xvSaturation, xvColorKey; - -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 - -static void -mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - Reg *reg = mach64c->reg; - MediaReg *media = mach64c->media_reg; - - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - - if (!media) - return; - - if(pPortPriv->videoOn) - { - mach64WaitIdle (reg); - /* wait for buffer to be displayed */ - while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) - ; - /* wait for buffer to be finished */ - while (((media->TRIG_CNTL >> 6) & 1) != 0) - ; - mach64WaitAvail (reg, 1); - media->OVERLAY_SCALE_CNTL = 0; - pPortPriv->videoOn = FALSE; - mach64WaitIdle (reg); - } - if (pPortPriv->off_screen) - { - KdOffscreenFree (pScreen, pPortPriv->off_screen); - pPortPriv->off_screen = 0; - } -} - -static int -mach64SetPortAttribute(KdScreenInfo *screen, - Atom attribute, - int value, - pointer data) -{ - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - - if(attribute == xvBrightness) - { - if(value < -1000) - value = -1000; - if (value > 1000) - value = 1000; - pPortPriv->brightness = value; - } - else if(attribute == xvSaturation) - { - if (value < -1000) - value = -1000; - if (value > 1000) - value = 1000; - pPortPriv->saturation = value; - } - else if(attribute == xvColorKey) - { - if (pPortPriv->colorKey != value) - { - pPortPriv->colorKey = value; - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - } - } - else - return BadMatch; - - return Success; -} - -static int -mach64GetPortAttribute(KdScreenInfo *screen, - Atom attribute, - int *value, - pointer data) -{ - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; - - if(attribute == xvBrightness) - *value = pPortPriv->brightness; - else if(attribute == xvSaturation) - *value = pPortPriv->saturation; - else if(attribute == xvColorKey) - *value = pPortPriv->colorKey; - else - return BadMatch; - - return Success; -} - -static void -mach64QueryBestSize(KdScreenInfo *screen, - Bool motion, - short vid_w, - short vid_h, - short drw_w, - short drw_h, - unsigned int *p_w, - unsigned int *p_h, - pointer data) -{ - *p_w = drw_w; - *p_h = drw_h; -} - - -static void -mach64CopyPackedData(KdScreenInfo *screen, - unsigned char *buf, - int randr, - int srcPitch, - int dstPitch, - int srcW, - int srcH, - int top, - int left, - int h, - int w) -{ - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - CARD8 *src = buf, *dst; - int srcDown = srcPitch, srcRight = 2, srcNext; - int p; - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - src = buf; - srcDown = srcPitch; - srcRight = 2; - break; - case RR_Rotate_90: - src = buf + (srcH - 1) * 2; - srcDown = -2; - srcRight = srcPitch; - break; - case RR_Rotate_180: - src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2; - srcDown = -srcPitch; - srcRight = -2; - break; - case RR_Rotate_270: - src = buf + srcPitch * (srcW - 1); - srcDown = 2; - srcRight = -srcPitch; - break; - } - - src = src + top*srcDown + left*srcRight; - - if (pPortPriv->currentBuf == 0) - dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; - else - dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; - - w >>= 1; - srcRight >>= 1; - srcNext = srcRight >> 1; - while(h--) - { - CARD16 *s = (CARD16 *) src; - CARD32 *d = (CARD32 *) dst; - p = w; - while (p--) - { - *d++ = s[0] | (s[srcNext] << 16); - s += srcRight; - } - src += srcPitch; - dst += dstPitch; - } -} - -static void -mach64CopyPlanarData(KdScreenInfo *screen, - unsigned char *buf, - int randr, - int srcPitch, - int srcPitch2, - int dstPitch, /* of chroma */ - int srcW, - int srcH, - int height, - int top, - int left, - int h, - int w, - int id) -{ - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - int i, j; - CARD8 *src1, *src2, *src3, *dst1; - int srcDown = srcPitch, srcDown2 = srcPitch2; - int srcRight = 2, srcRight2 = 1, srcNext = 1; - - /* compute source data pointers */ - src1 = buf; - src2 = src1 + height * srcPitch; - src3 = src2 + (height >> 1) * srcPitch2; - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - srcDown = srcPitch; - srcDown2 = srcPitch2; - srcRight = 2; - srcRight2 = 1; - srcNext = 1; - break; - case RR_Rotate_90: - src1 = src1 + srcH - 1; - src2 = src2 + (srcH >> 1) - 1; - src3 = src3 + (srcH >> 1) - 1; - srcDown = -1; - srcDown2 = -1; - srcRight = srcPitch * 2; - srcRight2 = srcPitch2; - srcNext = srcPitch; - break; - case RR_Rotate_180: - src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); - src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - srcDown = -srcPitch; - srcDown2 = -srcPitch2; - srcRight = -2; - srcRight2 = -1; - srcNext = -1; - break; - case RR_Rotate_270: - src1 = src1 + srcPitch * (srcW - 1); - src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); - srcDown = 1; - srcDown2 = 1; - srcRight = -srcPitch * 2; - srcRight2 = -srcPitch2; - srcNext = -srcPitch; - break; - } - - /* adjust for origin */ - src1 += top * srcDown + left * srcNext; - src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - - if (id == FOURCC_I420) - { - CARD8 *srct = src2; - src2 = src3; - src3 = srct; - } - - if (pPortPriv->currentBuf == 0) - dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; - else - dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; - - w >>= 1; - for (j = 0; j < h; j++) - { - CARD32 *dst = (CARD32 *) dst1; - CARD8 *s1l = src1; - CARD8 *s1r = src1 + srcNext; - CARD8 *s2 = src2; - CARD8 *s3 = src3; - - for (i = 0; i < w; i++) - { - *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); - s1l += srcRight; - s1r += srcRight; - s2 += srcRight2; - s3 += srcRight2; - } - src1 += srcDown; - dst1 += dstPitch; - if (j & 1) - { - src2 += srcDown2; - src3 += srcDown2; - } - } -} - - -/* Mach64ClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -static void -Mach64ClipVideo(BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - BoxPtr extents, /* extents of the clip region */ - INT32 width, - INT32 height) -{ - INT32 vscale, hscale, delta; - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } -} - -static void -mach64DisplayVideo(KdScreenInfo *screen, - int id, - int dstPitch, /* of chroma for 4:2:0 */ - int x1, - int y1, - int x2, - int y2, - int dst_x1, - int dst_y1, - int dst_x2, - int dst_y2, - short src_w, - short src_h, - short drw_w, - short drw_h) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - Reg *reg = mach64c->reg; - MediaReg *media = mach64c->media_reg; - int HORZ_INC, VERT_INC; - CARD32 SCALER_IN; - int bright; - int sat; - - if (id == FOURCC_UYVY) - SCALER_IN = SCALER_IN_YVYU422; - else - SCALER_IN = SCALER_IN_VYUY422; - - mach64WaitAvail (reg, 4); - - media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; - - /* color key */ - media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; - media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey; - /* set key control to obey only graphics color key */ - media->OVERLAY_KEY_CNTL = 0x50; - - mach64WaitAvail (reg, 9); - media->CAPTURE_DEBUG = 0; - /* no exclusive video region */ - media->OVERLAY_EXCLUSIVE_HORZ = 0; - media->OVERLAY_EXCLUSIVE_VERT = 0; - /* scaling coefficients */ - media->SCALER_H_COEFF0 = 0x00002000; - media->SCALER_H_COEFF1 = 0x0D06200D; - media->SCALER_H_COEFF2 = 0x0D0A1C0D; - media->SCALER_H_COEFF3 = 0x0C0E1A0C; - media->SCALER_H_COEFF4 = 0x0C14140C; - media->SCALER_TEST = 0; - - mach64WaitAvail (reg, 2); - media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | - SCALE_GAMMA_BRIGHT | - SCALE_BANDWIDTH | - SCALE_OVERLAY_EN | - SCALE_EN); - - bright = (pPortPriv->brightness * 64 / 1000); - if (bright < -0x40) - bright = -0x40; - if (bright > 0x3f) - bright = 0x3f; - bright = bright & 0x7f; - sat = ((pPortPriv->saturation * 31 + 31000) / 2000); - if (sat > 0x1f) - sat = 0x1f; - if (sat < 0) - sat = 0; - - media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ - (sat << 8) | /* SATURATION_U */ - (sat << 16) | /* SATURATION_V */ - (0 << 21) | /* SCALER_VERT_ADJ_UV */ - (0 << 28)); /* SCALER_HORZ_ADJ_UV */ - - VERT_INC = (src_h << 12) / drw_h; - HORZ_INC = (src_w << 12) / drw_w; - - mach64WaitAvail (reg, 13); - - /* lock registers to prevent non-atomic update */ - media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1); - /* ending screen coordinate */ - media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2); - - media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC); - - media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset; - - media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; - - media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; - - media->SCALER_BUF_PITCH = dstPitch >> 1; - media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); - - media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28; - - /* set XY location and unlock */ - media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1); -} - -static void -mach64VideoSave (ScreenPtr pScreen, KdOffscreenArea *area) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - - if (pPortPriv->off_screen == area) - pPortPriv->off_screen = 0; -} - -static int -mach64PutImage(KdScreenInfo *screen, - DrawablePtr pDraw, - short src_x, - short src_y, - short drw_x, - short drw_y, - short src_w, - short src_h, - short drw_w, - short drw_h, - int id, - unsigned char *buf, - short width, - short height, - Bool sync, - RegionPtr clipBoxes, - pointer data) -{ - KdCardInfo *card = screen->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; - MediaReg *media = mach64c->media_reg; - INT32 x1, x2, y1, y2; - int randr = mach64s->vesa.randr; - int srcPitch, srcPitch2, dstPitch; - int top, left, npixels, nlines, size; - BoxRec dstBox; - int dst_width = width, dst_height = height; - int rot_x1, rot_y1, rot_x2, rot_y2; - int dst_x1, dst_y1, dst_x2, dst_y2; - int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; - - /* Clip */ - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - - if((x1 >= x2) || (y1 >= y2)) - return Success; - - if (!media) - return BadAlloc; - - if (randr & (RR_Rotate_0|RR_Rotate_180)) - { - dst_width = width; - dst_height = height; - rot_src_w = src_w; - rot_src_h = src_h; - rot_drw_w = drw_w; - rot_drw_h = drw_h; - } - else - { - dst_width = height; - dst_height = width; - rot_src_w = src_h; - rot_src_h = src_w; - rot_drw_w = drw_h; - rot_drw_h = drw_w; - } - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - default: - dst_x1 = dstBox.x1; - dst_y1 = dstBox.y1; - dst_x2 = dstBox.x2; - dst_y2 = dstBox.y2; - rot_x1 = x1; - rot_y1 = y1; - rot_x2 = x2; - rot_y2 = y2; - break; - case RR_Rotate_90: - dst_x1 = dstBox.y1; - dst_y1 = screen->height - dstBox.x2; - dst_x2 = dstBox.y2; - dst_y2 = screen->height - dstBox.x1; - - rot_x1 = y1; - rot_y1 = (src_w << 16) - x2; - rot_x2 = y2; - rot_y2 = (src_w << 16) - x1; - break; - case RR_Rotate_180: - dst_x1 = screen->width - dstBox.x2; - dst_y1 = screen->height - dstBox.y2; - dst_x2 = screen->width - dstBox.x1; - dst_y2 = screen->height - dstBox.y1; - rot_x1 = (src_w << 16) - x2; - rot_y1 = (src_h << 16) - y2; - rot_x2 = (src_w << 16) - x1; - rot_y2 = (src_h << 16) - y1; - break; - case RR_Rotate_270: - dst_x1 = screen->width - dstBox.y2; - dst_y1 = dstBox.x1; - dst_x2 = screen->width - dstBox.y1; - dst_y2 = dstBox.x2; - rot_x1 = (src_h << 16) - y2; - rot_y1 = x1; - rot_x2 = (src_h << 16) - y1; - rot_y2 = x2; - break; - } - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width + 3) & ~3; - srcPitch2 = ((width >> 1) + 3) & ~3; - size = dstPitch * (int) dst_height; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width << 1); - srcPitch2 = 0; - size = dstPitch * (int) dst_height; - break; - } - - if (pPortPriv->off_screen && size != pPortPriv->size) - { - KdOffscreenFree (screen->pScreen, pPortPriv->off_screen); - pPortPriv->off_screen = 0; - } - - if (!pPortPriv->off_screen) - { - pPortPriv->off_screen = KdOffscreenAlloc (screen->pScreen, size * 2, 64, - TRUE, mach64VideoSave, - pPortPriv); - if (!pPortPriv->off_screen) - return BadAlloc; - } - - pPortPriv->offset = pPortPriv->off_screen->offset; - pPortPriv->size = size; - /* fixup pointers */ - - pPortPriv->YBuf0Offset = pPortPriv->offset; - pPortPriv->YBuf1Offset = pPortPriv->offset + size; - -#if 0 - mach64WaitIdle (reg); - - if (pPortPriv->videoOn) - { - /* wait for buffer to be displayed */ - while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) - ; - } -#endif - /* - * Use the other buffer - */ - pPortPriv->currentBuf = 1 - pPortPriv->currentBuf; - - /* copy data */ - top = rot_y1 >> 16; - left = (rot_x1 >> 16) & ~1; - npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; - mach64CopyPlanarData(screen, buf, randr, - srcPitch, srcPitch2, dstPitch, - rot_src_w, rot_src_h, height, - top, left, nlines, npixels, id); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - nlines = ((rot_y2 + 0xffff) >> 16) - top; - mach64CopyPackedData(screen, buf, randr, - srcPitch, dstPitch, - rot_src_w, rot_src_h, - top, left, nlines, - npixels); - break; - } - - mach64DisplayVideo(screen, id, dstPitch, - rot_x1, rot_y1, rot_x2, rot_y2, - dst_x1, dst_y1, - dst_x2, dst_y2, - rot_src_w, rot_src_h, rot_drw_w, rot_drw_h); - - /* update cliplist */ - if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) - { - REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); - } - - pPortPriv->videoOn = TRUE; - - return Success; -} - -static int -mach64QueryImageAttributes(KdScreenInfo *screen, - int id, - unsigned short *w, - unsigned short *h, - int *pitches, - int *offsets) -{ - int size, tmp; - - if(*w > IMAGE_MAX_WIDTH) - *w = IMAGE_MAX_WIDTH; - if(*h > IMAGE_MAX_HEIGHT) - *h = IMAGE_MAX_HEIGHT; - - *w = (*w + 1) & ~1; - if(offsets) offsets[0] = 0; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if(pitches) - pitches[0] = size; - size *= *h; - if(offsets) - offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if(pitches) - pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if(offsets) - offsets[2] = size; - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) - pitches[0] = size; - size *= *h; - break; - } - - return size; -} - - -/* client libraries expect an encoding */ -static KdVideoEncodingRec DummyEncoding[1] = -{ - { - 0, - "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, - {1, 1} - } -}; - -#define NUM_FORMATS 3 - -static KdVideoFormatRec Formats[NUM_FORMATS] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; - -#define NUM_ATTRIBUTES 3 - -static KdAttributeRec Attributes[NUM_ATTRIBUTES] = -{ - {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, - {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} -}; - -#define NUM_IMAGES 4 - -static KdImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY -}; - -static void mach64ResetVideo(KdScreenInfo *screen) -{ -} - -static int -mach64ReputImage (KdScreenInfo *screen, - DrawablePtr pDraw, - short drw_x, - short drw_y, - RegionPtr clipBoxes, - pointer data) -{ - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; - BoxPtr pOldExtents = REGION_EXTENTS (screen->pScreen, &pPortPriv->clip); - BoxPtr pNewExtents = REGION_EXTENTS (screen->pScreen, clipBoxes); - - if (pOldExtents->x1 == pNewExtents->x1 && - pOldExtents->x2 == pNewExtents->x2 && - pOldExtents->y1 == pNewExtents->y1 && - pOldExtents->y2 == pNewExtents->y2) - { - /* update cliplist */ - if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) - { - REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - KXVPaintRegion (pDraw, &pPortPriv->clip, pPortPriv->colorKey); - } - return Success; - } - return BadMatch; -} - -static KdVideoAdaptorPtr -mach64SetupImageVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - mach64ScreenInfo(pScreenPriv); - KdScreenInfo *screen = pScreenPriv->screen; - KdVideoAdaptorPtr adapt; - Mach64PortPrivPtr pPortPriv; - - if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + - sizeof(Mach64PortPrivRec) + - sizeof(DevUnion)))) - return NULL; - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "Mach64 Video Overlay"; - adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = 1; - adapt->pPortPrivates = (DevUnion*)(&adapt[1]); - - pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); - - adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv); - adapt->pAttributes = Attributes; - adapt->nImages = NUM_IMAGES; - adapt->nAttributes = NUM_ATTRIBUTES; - adapt->pImages = Images; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = mach64StopVideo; - adapt->SetPortAttribute = mach64SetPortAttribute; - adapt->GetPortAttribute = mach64GetPortAttribute; - adapt->QueryBestSize = mach64QueryBestSize; - adapt->PutImage = mach64PutImage; - adapt->ReputImage = mach64ReputImage; - adapt->QueryImageAttributes = mach64QueryImageAttributes; - - pPortPriv->colorKey = mach64s->colorKey; - pPortPriv->videoOn = FALSE; - pPortPriv->brightness = 0; - pPortPriv->saturation = 0; - pPortPriv->currentBuf = 0; - pPortPriv->off_screen = 0; - pPortPriv->size = 0; - pPortPriv->offset = 0; - - /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); - - mach64s->pAdaptor = adapt; - - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvSaturation = MAKE_ATOM("XV_SATURATION"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - - mach64ResetVideo(screen); - - return adapt; -} - -Bool mach64InitVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; - KdVideoAdaptorPtr newAdaptor = NULL; - int num_adaptors; - KdCardInfo *card = pScreenPriv->card; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - - mach64s->pAdaptor = NULL; - - if (!mach64c->media_reg) - return FALSE; - - newAdaptor = mach64SetupImageVideo(pScreen); - - num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); - - if(newAdaptor) - { - if(!num_adaptors) - { - num_adaptors = 1; - adaptors = &newAdaptor; - } - else - { - newAdaptors = xalloc((num_adaptors + 1) * - sizeof(KdVideoAdaptorPtr*)); - if(newAdaptors) - { - memcpy(newAdaptors, adaptors, - num_adaptors * sizeof(KdVideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } - } - - if(num_adaptors) - KdXVScreenInit(pScreen, adaptors, num_adaptors); - - if(newAdaptors) - xfree(newAdaptors); - return TRUE; -} - -void -mach64FiniVideo (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - mach64ScreenInfo(pScreenPriv); - KdVideoAdaptorPtr adapt = mach64s->pAdaptor; - - if (adapt) - { - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); - REGION_UNINIT (pScreen, &pPortPriv->clip); - xfree (adapt); - } -} diff --git a/hw/kdrive/mga/Makefile.am b/hw/kdrive/mga/Makefile.am deleted file mode 100644 index a7dd2cbf6..000000000 --- a/hw/kdrive/mga/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xmga - -noinst_LIBRARIES = libmga.a - -libmga_a_SOURCES = \ - mgadraw.c \ - g400_composite.c \ - g400_common.h \ - mga.c \ - mga.h - -Xmga_SOURCES = \ - mgastub.c - -MGA_LIBS = \ - libmga.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - @KDRIVE_LIBS@ - -if GLX -Xmga_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xmga_LDADD = \ - $(MGA_LIBS) \ - @KDRIVE_LIBS@ - -Xmga_DEPENDENCIES = \ - libmga.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/mga/g400_common.h b/hw/kdrive/mga/g400_common.h deleted file mode 100644 index 9f16d2431..000000000 --- a/hw/kdrive/mga/g400_common.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright © 2004 Damien Ciabrini - * - * 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. - * - * DAMIEN CIABRINI 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. - */ - -#ifndef __G400_COMMON_H__ -#define __G400_COMMON_H__ - -/* Color registers */ -#define MGA_REG_DR4 (0x1CD0) -#define MGA_REG_DR6 (0x1CD8) -#define MGA_REG_DR7 (0x1CDC) -#define MGA_REG_DR8 (0x1CE0) -#define MGA_REG_DR10 (0x1CE8) -#define MGA_REG_DR11 (0x1CEC) -#define MGA_REG_DR12 (0x1CF0) -#define MGA_REG_DR14 (0x1CF8) -#define MGA_REG_DR15 (0x1CFC) - -/* Alpha registers */ -#define MGA_REG_ALPHASTART (0x2C70) -#define MGA_REG_ALPHAXINC (0x2C74) -#define MGA_REG_ALPHAYINC (0x2C78) -#define MGA_REG_ALPHACTRL (0x2C7C) -# define MGA_SRC_ZERO (0x00000000) -# define MGA_SRC_ONE (0x00000001) -# define MGA_SRC_DST_COLOR (0x00000002) -# define MGA_SRC_ONE_MINUS_DST_COLOR (0x00000003) -# define MGA_SRC_ALPHA (0x00000004) -# define MGA_SRC_ONE_MINUS_SRC_ALPHA (0x00000005) -# define MGA_SRC_DST_ALPHA (0x00000006) -# define MGA_SRC_ONE_MINUS_DST_ALPHA (0x00000007) -# define MGA_SRC_SRC_ALPHA_SATURATE (0x00000008) -# define MGA_SRC_BLEND_MASK (0x0000000f) - -# define MGA_DST_ZERO (0x00000000) -# define MGA_DST_ONE (0x00000010) -# define MGA_DST_SRC_COLOR (0x00000020) -# define MGA_DST_ONE_MINUS_SRC_COLOR (0x00000030) -# define MGA_DST_SRC_ALPHA (0x00000040) -# define MGA_DST_ONE_MINUS_SRC_ALPHA (0x00000050) -# define MGA_DST_DST_ALPHA (0x00000060) -# define MGA_DST_ONE_MINUS_DST_ALPHA (0x00000070) -# define MGA_DST_BLEND_MASK (0x00000070) - -# define MGA_ALPHACHANNEL (0x00000100) -# define MGA_VIDEOALPHA (0x00000200) -# define MGA_DIFFUSEDALPHA (0x01000000) -# define MGA_MODULATEDALPHA (0x02000000) - -/* Textures registers */ -#define MGA_REG_TEXORG (0x2c24) -#define MGA_REG_TEXORG1 (0x2ca4) -#define MGA_REG_TEXWIDTH (0x2C28) -#define MGA_REG_TEXHEIGHT (0x2C2C) -#define MGA_REG_TMR0 (0x2C00) -#define MGA_REG_TMR1 (0x2C04) -#define MGA_REG_TMR2 (0x2C08) -#define MGA_REG_TMR3 (0x2C0C) -#define MGA_REG_TMR4 (0x2C10) -#define MGA_REG_TMR5 (0x2C14) -#define MGA_REG_TMR6 (0x2C18) -#define MGA_REG_TMR7 (0x2C1C) -#define MGA_REG_TMR8 (0x2C20) - -/* Texture Control Registers */ -#define MGA_REG_TEXCTL (0x2C30) -# define MGA_TW4 (0x00000000) -# define MGA_TW8 (0x00000001) -# define MGA_TW15 (0x00000002) -# define MGA_TW16 (0x00000003) -# define MGA_TW12 (0x00000004) -# define MGA_TW32 (0x00000006) -# define MGA_TW8A (0x00000007) -# define MGA_TW8AL (0x00000008) -# define MGA_TW422 (0x0000000A) -# define MGA_TW422UYVY (0x0000000B) -# define MGA_PITCHLIN (0x00000100) -# define MGA_NOPERSPECTIVE (0x00200000) -# define MGA_TAKEY (0x02000000) -# define MGA_TAMASK (0x04000000) -# define MGA_CLAMPUV (0x18000000) -#define MGA_REG_TEXCTL2 (0x2C3C) -# define MGA_G400_TC2_MAGIC (0x00008000) -# define MGA_TC2_DECALBLEND (0x00000001) -# define MGA_TC2_IDECAL (0x00000002) -# define MGA_TC2_DECALDIS (0x00000004) -# define MGA_TC2_CKSTRANSDIS (0x00000010) -# define MGA_TC2_BORDEREN (0x00000020) -# define MGA_TC2_SPECEN (0x00000040) -# define MGA_TC2_DUALTEX (0x00000080) -# define MGA_TC2_TABLEFOG (0x00000100) -# define MGA_TC2_BUMPMAP (0x00000200) -# define MGA_TC2_SELECT_TMU1 (0x80000000) -#define MGA_REG_TEXFILTER (0x2C58) -# define MGA_MIN_NRST (0x00000000) -# define MGA_MIN_BILIN (0x00000002) -# define MGA_MIN_ANISO (0x0000000D) -# define MGA_MAG_NRST (0x00000000) -# define MGA_MAG_BILIN (0x00000020) - -/* Multi-Textures Control Registers */ -#define MGA_REG_TDUALSTAGE0 (0x2CF8) -#define MGA_REG_TDUALSTAGE1 (0x2CFC) -# define MGA_TDS_COLOR_ARG2_DIFFUSE (0x00000000) -# define MGA_TDS_COLOR_ARG2_SPECULAR (0x00000001) -# define MGA_TDS_COLOR_ARG2_FCOL (0x00000002) -# define MGA_TDS_COLOR_ARG2_PREVSTAGE (0x00000003) -# define MGA_TDS_COLOR_ALPHA_DIFFUSE (0x00000000) -# define MGA_TDS_COLOR_ALPHA_FCOL (0x00000004) -# define MGA_TDS_COLOR_ALPHA_CURRTEX (0x00000008) -# define MGA_TDS_COLOR_ALPHA_PREVTEX (0x0000000c) -# define MGA_TDS_COLOR_ALPHA_PREVSTAGE (0x00000010) -# define MGA_TDS_COLOR_ARG1_REPLICATEALPHA (0x00000020) -# define MGA_TDS_COLOR_ARG1_INV (0x00000040) -# define MGA_TDS_COLOR_ARG2_REPLICATEALPHA (0x00000080) -# define MGA_TDS_COLOR_ARG2_INV (0x00000100) -# define MGA_TDS_COLOR_ALPHA1INV (0x00000200) -# define MGA_TDS_COLOR_ALPHA2INV (0x00000400) -# define MGA_TDS_COLOR_ARG1MUL_ALPHA1 (0x00000800) -# define MGA_TDS_COLOR_ARG2MUL_ALPHA2 (0x00001000) -# define MGA_TDS_COLOR_ARG1ADD_MULOUT (0x00002000) -# define MGA_TDS_COLOR_ARG2ADD_MULOUT (0x00004000) -# define MGA_TDS_COLOR_MODBRIGHT_2X (0x00008000) -# define MGA_TDS_COLOR_MODBRIGHT_4X (0x00010000) -# define MGA_TDS_COLOR_ADD_SUB (0x00000000) -# define MGA_TDS_COLOR_ADD_ADD (0x00020000) -# define MGA_TDS_COLOR_ADD2X (0x00040000) -# define MGA_TDS_COLOR_ADDBIAS (0x00080000) -# define MGA_TDS_COLOR_BLEND (0x00100000) -# define MGA_TDS_COLOR_SEL_ARG1 (0x00000000) -# define MGA_TDS_COLOR_SEL_ARG2 (0x00200000) -# define MGA_TDS_COLOR_SEL_ADD (0x00400000) -# define MGA_TDS_COLOR_SEL_MUL (0x00600000) -# define MGA_TDS_ALPHA_ARG1_INV (0x00800000) -# define MGA_TDS_ALPHA_ARG2_DIFFUSE (0x00000000) -# define MGA_TDS_ALPHA_ARG2_FCOL (0x01000000) -# define MGA_TDS_ALPHA_ARG2_PREVTEX (0x02000000) -# define MGA_TDS_ALPHA_ARG2_PREVSTAGE (0x03000000) -# define MGA_TDS_ALPHA_ARG2_INV (0x04000000) -# define MGA_TDS_ALPHA_ADD (0x08000000) -# define MGA_TDS_ALPHA_ADDBIAS (0x10000000) -# define MGA_TDS_ALPHA_ADD2X (0x20000000) -# define MGA_TDS_ALPHA_SEL_ARG1 (0x00000000) -# define MGA_TDS_ALPHA_SEL_ARG2 (0x40000000) -# define MGA_TDS_ALPHA_SEL_ADD (0x80000000) -# define MGA_TDS_ALPHA_SEL_MUL (0xc0000000) - - - -/* Composition Prototypes. MMIO Access */ -Bool -mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture); - -Bool -mgaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture, PixmapPtr pSrc, - PixmapPtr pMask, PixmapPtr pDst); - -void -mgaComposite(int srcX, int srcY, int maskX, int maskY, - int dstX, int dstY, int w, int h); - -void -mgaDoneComposite(void); - -#endif diff --git a/hw/kdrive/mga/g400_composite.c b/hw/kdrive/mga/g400_composite.c deleted file mode 100644 index dda9d9347..000000000 --- a/hw/kdrive/mga/g400_composite.c +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright © 2004 Damien Ciabrini - * - * 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. - * - * DAMIEN CIABRINI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include "mga.h" -#include "g400_common.h" - - -static PicturePtr currentSrcPicture; -static PicturePtr currentMaskPicture; -static PixmapPtr currentSrc; -static PixmapPtr currentMask; -static int src_w2; -static int src_h2; -static int mask_w2; -static int mask_h2; - -struct blendinfo { - Bool dst_alpha; - Bool src_alpha; - CARD32 blend_cntl; -}; - -static struct blendinfo mgaBlendOP[] = { - /* Clear */ - {0, 0, MGA_SRC_ZERO | MGA_DST_ZERO}, - /* Src */ - {0, 0, MGA_SRC_ONE | MGA_DST_ZERO}, - /* Dst */ - {0, 0, MGA_SRC_ZERO | MGA_DST_ONE}, - /* Over */ - {0, 1, MGA_SRC_ONE | MGA_DST_ONE_MINUS_SRC_ALPHA}, - /* OverReverse */ - {1, 0, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE}, - /* In */ - {1, 0, MGA_SRC_DST_ALPHA | MGA_DST_ZERO}, - /* InReverse */ - {0, 1, MGA_SRC_ZERO | MGA_DST_SRC_ALPHA}, - /* Out */ - {1, 0, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ZERO}, - /* OutReverse */ - {0, 1, MGA_SRC_ZERO | MGA_DST_ONE_MINUS_SRC_ALPHA}, - /* Atop */ - {1, 1, MGA_SRC_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA}, - /* AtopReverse */ - {1, 1, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_SRC_ALPHA}, - /* Xor */ - {1, 1, MGA_SRC_ONE_MINUS_DST_ALPHA | MGA_DST_ONE_MINUS_SRC_ALPHA}, - /* Add */ - {0, 0, MGA_SRC_ONE | MGA_DST_ONE}, -}; - -struct formatinfo { - int fmt; - CARD32 card_fmt; -}; - -static struct formatinfo texformats[] = { - {PICT_a8r8g8b8, MGA_TW32}, - {PICT_x8r8g8b8, MGA_TW32}, - {PICT_r5g6b5, MGA_TW16}, - {PICT_a1r5g5b5, MGA_TW15}, - {PICT_x1r5g5b5, MGA_TW15}, - {PICT_a4r4g4b4, MGA_TW12}, - {PICT_x4r4g4b4, MGA_TW12}, - {PICT_a8, MGA_TW8A}, -}; - -static int -MGA_LOG2( int val ) -{ - int ret = 0; - if (val==1) return 0; - while (val >> ret) - ret++; - - return ((1 << (ret-1)) == val) ? (ret-1) : ret; -} - - -static Bool -mgaCheckSourceTexture (int tmu, - PicturePtr pPict) -{ - int w = pPict->pDrawable->width; - int h = pPict->pDrawable->height; - int i; - CARD32 texctl = 0; - - if ((w > 2047) || (h > 2047)) - MGA_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); - - for (i = 0; i < sizeof(texformats) / sizeof(texformats[0]); i++) { - if (texformats[i].fmt == pPict->format) { - texctl = texformats[i].card_fmt; - break; - } - } - if (texctl == 0) { - MGA_FALLBACK(("Unsupported picture format 0x%x\n", pPict->format)); - } - - if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) - MGA_FALLBACK(("NPOT repeat unsupported (%dx%d)\n", w, h)); - - if (pPict->filter != PictFilterNearest && - pPict->filter != PictFilterBilinear) - MGA_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter)); - - return TRUE; -} - -static Bool -PrepareSourceTexture (int tmu, - PicturePtr pSrcPicture, - PixmapPtr pSrc) -{ - KdScreenPriv (pSrc->drawable.pScreen); - int mem_base=(int)pScreenPriv->screen->memory_base; - int pitch = pSrc->devKind / (pSrc->drawable.bitsPerPixel >> 3); - int i; - - int w = pSrc->drawable.width; - int h = pSrc->drawable.height; - int w_log2 = MGA_LOG2(w); - int h_log2 = MGA_LOG2(h); - - int texctl = MGA_PITCHLIN | ((pitch & (2048 - 1)) << 9) | - MGA_CLAMPUV | MGA_NOPERSPECTIVE; - int flags = 0; - int texctl2 = MGA_G400_TC2_MAGIC | flags; - - for (i = 0; i < sizeof(texformats) / sizeof(texformats[0]); i++) { - if (texformats[i].fmt == pSrcPicture->format) { - texctl |= texformats[i].card_fmt; - break; - } - } - - if (PICT_FORMAT_A(pSrcPicture->format) != 0) { - texctl |= MGA_TAKEY; - } else { - texctl |= MGA_TAMASK | MGA_TAKEY; - } - - if (pSrcPicture->repeat) { - texctl &= ~MGA_CLAMPUV; - } - - if (tmu == 1) - texctl2 |= MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1 | flags; - - mgaWaitAvail (6); - MGA_OUT32 (mmio, MGA_REG_TEXCTL2, texctl2); - MGA_OUT32 (mmio, MGA_REG_TEXCTL, texctl); - /* Source (texture) address + pitch */ - MGA_OUT32 (mmio, MGA_REG_TEXORG, ((int)pSrc->devPrivate.ptr - mem_base)); - MGA_OUT32 (mmio, MGA_REG_TEXWIDTH, (w-1)<<18 | ((8-w_log2)&63)<<9 | w_log2); - MGA_OUT32 (mmio, MGA_REG_TEXHEIGHT, (h-1)<<18 | ((8-h_log2)&63)<<9 | h_log2); - /* Set blit filtering flags */ - if (pSrcPicture->filter == PictFilterBilinear) { - MGA_OUT32 (mmio, MGA_REG_TEXFILTER, - (0x10<<21) | MGA_MAG_BILIN | MGA_MIN_BILIN); - } else { - MGA_OUT32 (mmio, MGA_REG_TEXFILTER, - (0x10<<21) | MGA_MAG_NRST | MGA_MIN_NRST); - } - - if (tmu == 1) { - mgaWaitAvail (1); - MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | flags); - } - - return TRUE; -} - - -/* - * The formals params are the elements of the following matrix: - * - * Dest Transform Src - * coords coords - * / Xdst \ / X_incx X_incy X_init \ / Xsrc \ - * | Ydst | = | Y_incx Y_incy Y_init | x | Ysrc | - * \ 1 / \ H_incx H_incy H_init / \ 1 / - * - * matrix elements are 32bits fixed points (16.16) - * mga_fx_* is the size of the fixed point for the TMU - */ -static void -setTMIncrementsRegs(int X_incx, - int X_incy, - int X_init, - int Y_incx, - int Y_incy, - int Y_init, - int H_incx, - int H_incy, - int H_init, - int mga_fx_width_size, - int mga_fx_height_size) { - int decalw = mga_fx_width_size - 16; - int decalh = mga_fx_height_size - 16; - - /* Convert 16 bits fixpoint -> MGA variable size fixpoint */ - if (decalw >= 0) { - X_incx = X_incx << decalw; - X_incy = X_incy << decalw; - X_init = X_init << decalw; - } else { - decalw =- decalw; - X_incx = X_incx >> decalw; - X_incy = X_incy >> decalw; - X_init = X_init >> decalw; - } - - /* Convert 16 bits fixpoint -> MGA variable size fixpoint */ - if (decalh >= 0) { - Y_incx = Y_incx << decalh; - Y_incy = Y_incy << decalh; - Y_init = Y_init << decalh; - } else { - decalh =- decalh; - Y_incx = Y_incx >> decalh; - Y_incy = Y_incy >> decalh; - Y_init = Y_init >> decalh; - } - - /* Set TM registers */ - mgaWaitAvail (9); - MGA_OUT32 (mmio, MGA_REG_TMR0, X_incx); - MGA_OUT32 (mmio, MGA_REG_TMR1, Y_incx); - MGA_OUT32 (mmio, MGA_REG_TMR2, X_incy); - MGA_OUT32 (mmio, MGA_REG_TMR3, Y_incy); - MGA_OUT32 (mmio, MGA_REG_TMR4, H_incx); - MGA_OUT32 (mmio, MGA_REG_TMR5, H_incy); - MGA_OUT32 (mmio, MGA_REG_TMR6, X_init); - MGA_OUT32 (mmio, MGA_REG_TMR7, Y_init); - MGA_OUT32 (mmio, MGA_REG_TMR8, H_init); -} - - - - -Bool -mgaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture) -{ - if (op >= sizeof(mgaBlendOP) / sizeof(mgaBlendOP[0])) - MGA_FALLBACK(("unsupported op %x", op)); - if (!mgaCheckSourceTexture (0, pSrcPicture)) - return FALSE; - - if (pMaskPicture != NULL) { - if (PICT_FORMAT_A(pMaskPicture->format) == 0) - MGA_FALLBACK(("Mask without alpha unsupported")); - if (!mgaCheckSourceTexture (1, pMaskPicture)) - return FALSE; - } - - if (pMaskPicture->componentAlpha) - MGA_FALLBACK(("Component alpha unsupported")); - - if (pDstPicture->format == PICT_a8) - MGA_FALLBACK(("render to A8 unsupported")); - - return TRUE; -} - -#define C_ARG1_CUR 0x0 -#define C_ARG1_ALPHA MGA_TDS_COLOR_ARG1_REPLICATEALPHA -#define C_ARG2_DIFFUSE MGA_TDS_COLOR_ARG2_DIFFUSE -#define C_ARG2_FCOL MGA_TDS_COLOR_ARG2_FCOL -#define C_ARG2_PREV MGA_TDS_COLOR_ARG2_PREVSTAGE -#define C_ARG1_INV MGA_TDS_COLOR_ARG1_INV -#define C_ARG2_INV MGA_TDS_COLOR_ARG2_INV -#define COLOR_MUL MGA_TDS_COLOR_SEL_MUL -#define COLOR_ARG1 MGA_TDS_COLOR_SEL_ARG1 -#define COLOR_ARG2 MGA_TDS_COLOR_SEL_ARG2 -#define A_ARG1_CUR 0x0 -#define A_ARG2_IGN A_ARG2_DIFFUSE -#define A_ARG2_FCOL MGA_TDS_ALPHA_ARG2_FCOL -#define A_ARG2_DIFFUSE MGA_TDS_ALPHA_ARG2_DIFFUSE -#define A_ARG2_PREV MGA_TDS_ALPHA_ARG2_PREVSTAGE -#define ALPHA_MUL MGA_TDS_ALPHA_SEL_MUL -#define ALPHA_ARG1 MGA_TDS_ALPHA_SEL_ARG1 -#define ALPHA_ARG2 MGA_TDS_ALPHA_SEL_ARG2 - - -Bool -mgaPrepareComposite (int op, - PicturePtr pSrcPicture, - PicturePtr pMaskPicture, - PicturePtr pDstPicture, - PixmapPtr pSrc, - PixmapPtr pMask, - PixmapPtr pDst) -{ - KdScreenPriv (pSrc->drawable.pScreen); - int mem_base=(int)pScreenPriv->screen->memory_base; - int cmd, blendcntl; - int ds0, ds1; - - /* Init MGA (clipping) */ - mgaSetup (pSrc->drawable.pScreen, pDst->drawable.bitsPerPixel, 1); - - /* Initialize fg color to 0, used in the src = A8 case */ - MGA_OUT32 (mmio, MGA_REG_FCOL, 0xff000000); - - /* Destination flags */ - mgaWaitAvail (2); - MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDst->devPrivate.ptr - mem_base)); - MGA_OUT32 (mmio, MGA_REG_PITCH, - pDst->devKind / (pDst->drawable.bitsPerPixel >> 3)); - - - /* Source(s) flags */ - if (!PrepareSourceTexture (0, pSrcPicture, pSrc)) return FALSE; - if (pMask != NULL) { - if (!PrepareSourceTexture (1, pMaskPicture, pMask)) return FALSE; - } - - /* Prepare multi-texture registers */ - ds0=ds1=0; - - if (pSrcPicture->format == PICT_a8) { - /* C = 0 A = As */ - /* MGA HW: A8 format makes RGB white. We use FCOL for the black - * If FCOL was not 0, it would have been be premultiplied (RENDER) - * color component would have been: - * C_ARG1_ALPHA | C_ARG2_FCOL | COLOR_MUL - */ - ds0=C_ARG2_FCOL | COLOR_ARG2 | - A_ARG1_CUR | ALPHA_ARG1; - /* MGA HW: TMU1 must be enabled when DUALSTAGE0 contains something */ - if (pMask == NULL) { - if (!PrepareSourceTexture (1, pSrcPicture, pSrc)) return FALSE; - ds1=C_ARG2_PREV | COLOR_ARG2 | - A_ARG2_PREV | ALPHA_ARG2; - } - } else { - /* C = Cs A = As */ - ds0=C_ARG1_CUR | COLOR_ARG1 | - A_ARG1_CUR | ALPHA_ARG1; - } - - if (pMask != NULL) { - /* As or Am might be NULL. in this case we don't multiply because, - * the alpha component holds garbage. - */ - int color,alpha; - if (PICT_FORMAT_A (pMaskPicture->format) == 0) { - /* C = Cs */ - color = C_ARG2_PREV | COLOR_ARG2; - } else { - /* C = Am * Cs */ - color = C_ARG1_ALPHA | C_ARG2_PREV | COLOR_MUL; - } - - if (PICT_FORMAT_A (pMaskPicture->format) == 0) { - /* A = As */ - alpha = A_ARG2_PREV | ALPHA_ARG2; - } else if (PICT_FORMAT_A (pSrcPicture->format) == 0) { - /* A = Am */ - alpha = A_ARG1_CUR | ALPHA_ARG1; - } else { - /* A = Am * As */ - alpha = A_ARG1_CUR | A_ARG2_PREV | ALPHA_MUL; - } - - ds1 = color | alpha; - } - - /* MultiTexture modulation */ - mgaWaitAvail (2); - MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE0, ds0); - MGA_OUT32 (mmio, MGA_REG_TDUALSTAGE1, ds1); - - - cmd = MGA_OPCOD_TEXTURE_TRAP | MGA_ATYPE_RSTR | 0x000c0000 | - MGA_DWGCTL_SHIFTZERO | MGA_DWGCTL_SGNZERO | MGA_DWGCTL_ARZERO | - MGA_ATYPE_I; - - blendcntl = mgaBlendOP[op].blend_cntl; - if (PICT_FORMAT_A(pDstPicture->format) == 0 && mgaBlendOP[op].dst_alpha) { - if ((blendcntl & MGA_SRC_BLEND_MASK) == MGA_SRC_DST_ALPHA) - blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ONE; - else if ((blendcntl & MGA_SRC_BLEND_MASK) == MGA_SRC_ONE_MINUS_DST_ALPHA) - blendcntl = (blendcntl & ~MGA_SRC_BLEND_MASK) | MGA_SRC_ZERO; - } - - mgaWaitAvail (2); - MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd); - MGA_OUT32 (mmio, MGA_REG_ALPHACTRL, MGA_ALPHACHANNEL | blendcntl); - - currentSrcPicture = pSrcPicture; - currentMaskPicture = pMaskPicture; - currentSrc = pSrc; - currentMask = pMask; - src_w2 = MGA_LOG2 (currentSrc->drawable.width); - src_h2 = MGA_LOG2 (currentSrc->drawable.height); - mask_w2 = MGA_LOG2 (currentMask->drawable.width); - mask_h2 = MGA_LOG2 (currentMask->drawable.height); - - return TRUE; -} - - -void -mgaComposite (int srcX, - int srcY, - int maskX, - int maskY, - int dstX, - int dstY, - int width, - int height) -{ - /* Source positions can be outside source textures' boundaries. - * We clamp the values here to avoid rendering glitches. - */ - srcX=srcX % currentSrc->drawable.width; - srcY=srcY % currentSrc->drawable.height; - maskX=maskX % currentMask->drawable.width; - maskY=maskY % currentMask->drawable.height; - - if (currentSrcPicture->transform) { - setTMIncrementsRegs (currentSrcPicture->transform->matrix[0][0], - currentSrcPicture->transform->matrix[0][1], - currentSrcPicture->transform->matrix[0][2] + - (srcX << 16), - currentSrcPicture->transform->matrix[1][0], - currentSrcPicture->transform->matrix[1][1], - currentSrcPicture->transform->matrix[1][2] + - (srcY << 16), - currentSrcPicture->transform->matrix[2][0], - currentSrcPicture->transform->matrix[2][1], - currentSrcPicture->transform->matrix[2][2], - 20-src_w2, 20-src_h2); - } else { - setTMIncrementsRegs (1 << 16, 0, srcX << 16, - 0, 1 << 16, srcY << 16, - 0, 0, 0x10000, - 20-src_w2, 20-src_h2); - } - - if (currentMask != NULL) { - mgaWaitAvail (1); - MGA_OUT32 (mmio, MGA_REG_TEXCTL2, - MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX | MGA_TC2_SELECT_TMU1); - if (currentMaskPicture->transform) { - setTMIncrementsRegs (currentMaskPicture->transform->matrix[0][0], - currentMaskPicture->transform->matrix[0][1], - currentMaskPicture->transform->matrix[0][2] + - (maskX << 16), - currentMaskPicture->transform->matrix[1][0], - currentMaskPicture->transform->matrix[1][1], - currentMaskPicture->transform->matrix[1][2] + - (maskY << 16), - currentMaskPicture->transform->matrix[2][0], - currentMaskPicture->transform->matrix[2][1], - currentMaskPicture->transform->matrix[2][2], - 20-mask_w2, 20-mask_h2); - } else { - setTMIncrementsRegs (1 << 16, 0, maskX << 16, - 0, 1 << 16, maskY << 16, - 0, 0, 0x10000, - 20-mask_w2, 20-mask_h2); - } - - mgaWaitAvail (1); - MGA_OUT32 (mmio, MGA_REG_TEXCTL2, MGA_G400_TC2_MAGIC | MGA_TC2_DUALTEX); - } - - /* Destination Bounding Box - * (Boundary Right | Boundary Left, Y dest | Height) - */ - mgaWaitAvail (2); - MGA_OUT32 (mmio, MGA_REG_FXBNDRY, - ((dstX + width) << 16) | (dstX & 0xffff)); - MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, - (dstY << 16) | (height & 0xffff)); -} - -void -mgaDoneComposite (void) -{ -} diff --git a/hw/kdrive/mga/mga.c b/hw/kdrive/mga/mga.c deleted file mode 100644 index 2ae35d143..000000000 --- a/hw/kdrive/mga/mga.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright © 2003 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mga.h" - -static Bool -mgaCardInit (KdCardInfo *card) -{ - MgaCardInfo *mgac; - - mgac = (MgaCardInfo *) xalloc (sizeof (MgaCardInfo)); - if (!mgac) - return FALSE; - - mgaMapReg (card, mgac); - - if (!vesaInitialize (card, &mgac->vesa)) - { - xfree (mgac); - return FALSE; - } - - mgac->fifo_size = 0; - - card->driver = mgac; - - return TRUE; -} - -static Bool -mgaScreenInit (KdScreenInfo *screen) -{ - MgaScreenInfo *mgas; - - mgas = (MgaScreenInfo *) xalloc (sizeof (MgaScreenInfo)); - if (!mgas) - return FALSE; - memset (mgas, '\0', sizeof (MgaScreenInfo)); - if (!vesaScreenInitialize (screen, &mgas->vesa)) - { - xfree (mgas); - return FALSE; - } -#if 0 - /* if (!mgac->reg) - screen->dumb = TRUE; */ - - if (mgas->vesa.mapping != VESA_LINEAR) - screen->dumb = TRUE; - - fprintf (stderr, "vesa mapping is %d\n", mgas->vesa.mapping); -#endif - screen->driver = mgas; - return TRUE; -} - -static Bool -mgaInitScreen (ScreenPtr pScreen) -{ - return vesaInitScreen (pScreen); -} - -static Bool -mgaFinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - - ret = vesaFinishInitScreen (pScreen); - - return ret; -} - -static Bool -mgaCreateResources (ScreenPtr pScreen) -{ - return vesaCreateResources (pScreen); -} - -static void -mgaPreserve (KdCardInfo *card) -{ - vesaPreserve (card); -} - -Bool -mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac) -{ - mgac->reg_base = (CARD8 *) KdMapDevice (MGA_REG_BASE (card), - MGA_REG_SIZE (card)); - - if (!mgac->reg_base) - { - return FALSE; - } - - KdSetMappedMode (MGA_REG_BASE (card), - MGA_REG_SIZE (card), - KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -void -mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac) -{ - if (mgac->reg_base) - { - KdResetMappedMode (MGA_REG_BASE (card), - MGA_REG_SIZE (card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice ((void *) mgac->reg_base, MGA_REG_SIZE (card)); - mgac->reg_base = 0; - /* mgac->reg = 0; */ - } -} - -void -mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac) -{ - if (!mgac->reg_base) - mgaMapReg (card, mgac); -} - -void -mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac) -{ - mgaUnmapReg (card, mgac); -} - -static Bool -mgaDPMS (ScreenPtr pScreen, int mode) -{ - /* XXX */ - return TRUE; -} - -static Bool -mgaEnable (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - MgaCardInfo *mgac = pScreenPriv->card->driver; - - if (!vesaEnable (pScreen)) - return FALSE; - - mgaSetMMIO (pScreenPriv->card, mgac); - mgaDPMS (pScreen, KD_DPMS_NORMAL); - - return TRUE; -} - -static void -mgaDisable (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - MgaCardInfo *mgac = pScreenPriv->card->driver; - - mgaResetMMIO (pScreenPriv->card, mgac); - - vesaDisable (pScreen); -} - -static void -mgaRestore (KdCardInfo *card) -{ - MgaCardInfo *mgac = card->driver; - - mgaResetMMIO (card, mgac); - vesaRestore (card); -} - -static void -mgaScreenFini (KdScreenInfo *screen) -{ - MgaScreenInfo *mgas = (MgaScreenInfo *) screen->driver; - - vesaScreenFini (screen); - xfree (mgas); - screen->driver = 0; -} - -static void -mgaCardFini (KdCardInfo *card) -{ - MgaCardInfo *mgac = (MgaCardInfo *)card->driver; - - mgaUnmapReg (card, mgac); - vesaCardFini (card); -} - -KdCardFuncs mgaFuncs = { - mgaCardInit, /* cardinit */ - mgaScreenInit, /* scrinit */ - mgaInitScreen, /* initScreen */ - mgaFinishInitScreen, /* finishInitScreen */ - mgaCreateResources, /* createRes */ - mgaPreserve, /* preserve */ - mgaEnable, /* enable */ - mgaDPMS, /* dpms */ - mgaDisable, /* disable */ - mgaRestore, /* restore */ - mgaScreenFini, /* scrfini */ - mgaCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - mgaDrawInit, /* initAccel */ - mgaDrawEnable, /* enableAccel */ - mgaDrawDisable, /* disableAccel */ - mgaDrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; - diff --git a/hw/kdrive/mga/mga.h b/hw/kdrive/mga/mga.h deleted file mode 100644 index 8fa956096..000000000 --- a/hw/kdrive/mga/mga.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright © 2003-2004 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. - */ - -#ifndef _MGA_H_ -#define _MGA_H_ -#include <vesa.h> -#include <klinux.h> - -#define MGA_REG_BASE(c) ((c)->attr.address[1]) -#define MGA_REG_SIZE(c) (0x4000) - -#define MGA_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v)) -#define MGA_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a))) - -#define MGA_REG_EXEC (0x0100) -#define MGA_REG_DWGCTL (0x1c00) -#define MGA_REG_PLNWT (0x1c1c) -#define MGA_REG_FCOL (0x1c24) -#define MGA_REG_MACCESS (0x1c04) -#define MGA_REG_SGN (0x1c58) -#define MGA_REG_AR0 (0x1c60) -#define MGA_REG_AR1 (0x1c64) -#define MGA_REG_AR2 (0x1c68) -#define MGA_REG_AR3 (0x1c6C) -#define MGA_REG_AR4 (0x1c70) -#define MGA_REG_AR5 (0x1c74) -#define MGA_REG_AR6 (0x1c78) - -#define MGA_REG_CXBNDRY (0x1c80) -#define MGA_REG_FXBNDRY (0x1c84) -#define MGA_REG_YDSTLEN (0x1c88) -#define MGA_REG_PITCH (0x1c8c) -#define MGA_REG_YTOP (0x1c98) -#define MGA_REG_YBOT (0x1c9c) -#define MGA_REG_FIFOSTATUS (0x1e10) -#define MGA_REG_STATUS (0x1e14) -#define MGA_REG_CACHEFLUSH (0x1fff) -#define MGA_REG_SRCORG (0x2cb4) -#define MGA_REG_DSTORG (0x2cb8) - -#define MGA_G4XX_DEVICE_ID (0x0525) - -#define MGA_PW8 (0) -#define MGA_PW16 (1) -#define MGA_PW24 (2) -#define MGA_PW32 (3) - -/* Drawing opcodes */ -#define MGA_OPCOD_TRAP (4) -#define MGA_OPCOD_TEXTURE_TRAP (6) -#define MGA_OPCOD_BITBLT (8) - -#define MGA_DWGCTL_SOLID (1 << 11) -#define MGA_DWGCTL_ARZERO (1 << 12) -#define MGA_DWGCTL_SGNZERO (1 << 13) -#define MGA_DWGCTL_SHIFTZERO (1 << 14) - -#define MGA_DWGCTL_BFCOL (2 << 25) - -#define MGA_ATYPE_RPL (0 << 4) -#define MGA_ATYPE_RSTR (1 << 4) -#define MGA_ATYPE_ZI (3 << 4) -#define MGA_ATYPE_BLK (4 << 4) -#define MGA_ATYPE_I (7 << 4) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _mgaCardInfo { - VesaCardPrivRec vesa; - CARD8 *reg_base; - int fifo_size; -} MgaCardInfo; - -#define getMgaCardInfo(kd) ((MgaCardInfo *) ((kd)->card->driver)) -#define mgaCardInfo(kd) MgaCardInfo *mgac = getMgaCardInfo(kd) - -typedef struct _mgaScreenInfo { - VesaScreenPrivRec vesa; - - KaaScreenInfoRec kaa; - - int pitch; - int pw; -} MgaScreenInfo; - -#define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver)) -#define mgaScreenInfo(kd) MgaScreenInfo *mgas = getMgaScreenInfo(kd) - - -VOL8 *mmio; - - -Bool -mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac); - -void -mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac); - -void -mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac); - -void -mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac); - -Bool -mgaDrawSetup (ScreenPtr pScreen); - -Bool -mgaDrawInit (ScreenPtr pScreen); - -void -mgaDrawEnable (ScreenPtr pScreen); - -void -mgaDrawDisable (ScreenPtr pScreen); - -void -mgaDrawFini (ScreenPtr pScreen); - -extern KdCardFuncs mgaFuncs; - - -void -mgaWaitAvail (int n); - -void -mgaWaitIdle (void); - -Bool -mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait); - - -#if 0 -#define MGA_FALLBACK(x) \ -do { \ - ErrorF x; \ - return FALSE; \ -} while (0); -#else -#define MGA_FALLBACK(x) return FALSE; -#endif - -#endif /* _MGA_H_ */ diff --git a/hw/kdrive/mga/mgadraw.c b/hw/kdrive/mga/mgadraw.c deleted file mode 100644 index d27e8c9cc..000000000 --- a/hw/kdrive/mga/mgadraw.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright © 2003-2004 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mga.h" -#include "g400_common.h" -#include "kaa.h" -#include <unistd.h> - -CARD32 mgaRop[16] = { - /* GXclear */ MGA_ATYPE_RPL | 0x00000000, /* 0 */ - /* GXand */ MGA_ATYPE_RSTR | 0x00080000, /* src AND dst */ - /* GXandReverse */ MGA_ATYPE_RSTR | 0x00040000, /* src AND NOT dst */ - /* GXcopy */ MGA_ATYPE_RSTR | 0x000c0000, /* src */ - /* GXandInverted */ MGA_ATYPE_RSTR | 0x00020000, /* NOT src AND dst */ - /* GXnoop */ MGA_ATYPE_RSTR | 0x000a0000, /* dst */ - /* GXxor */ MGA_ATYPE_RSTR | 0x00060000, /* src XOR dst */ - /* GXor */ MGA_ATYPE_RSTR | 0x000e0000, /* src OR dst */ - /* GXnor */ MGA_ATYPE_RSTR | 0x00010000, /* NOT src AND NOT dst */ - /* GXequiv */ MGA_ATYPE_RSTR | 0x00090000, /* NOT src XOR dst */ - /* GXinvert */ MGA_ATYPE_RSTR | 0x00050000, /* NOT dst */ - /* GXorReverse */ MGA_ATYPE_RSTR | 0x000d0000, /* src OR NOT dst */ - /* GXcopyInverted */ MGA_ATYPE_RPL | 0x00030000, /* NOT src */ - /* GXorInverted */ MGA_ATYPE_RSTR | 0x000b0000, /* NOT src OR dst */ - /* GXnand */ MGA_ATYPE_RSTR | 0x00070000, /* NOT src OR NOT dst */ - /* GXset */ MGA_ATYPE_RPL | 0x000f0000 /* 1 */ -}; - -VOL8 *mmio; -int fifo_size; -int pitch, src_pitch; -int dir; - -void -mgaWaitAvail (int n) -{ - if (fifo_size < n) { - while ((fifo_size = MGA_IN32 (mmio, MGA_REG_FIFOSTATUS) & 0xff) < n) - ; - } - - fifo_size -= n; -} - -#define MGA_OUT8(mmio, a, v) (*(VOL8 *) ((mmio) + (a)) = (v)) -#define MGA_REG_CRTC_INDEX (0x1fd4) - -void -mgaWaitIdle (void) -{ - - mgaWaitAvail (2); - MGA_OUT32(mmio, MGA_REG_CACHEFLUSH, 0); - /* MGA_OUT8 (mmio, MGA_REG_CRTC_INDEX, 0); */ - while (MGA_IN32 (mmio, MGA_REG_STATUS) & 0x10000) - ; -} - -static void -mgaWaitMarker (ScreenPtr pScreen, int marker) -{ - KdScreenPriv (pScreen); - mgaCardInfo (pScreenPriv); - - mmio = mgac->reg_base; - - mgaWaitIdle (); -} - -Bool -mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait) -{ - KdScreenPriv (pScreen); - mgaScreenInfo (pScreenPriv); - mgaCardInfo (pScreenPriv); - - fifo_size = 0; - mmio = mgac->reg_base; - pitch = mgas->pitch; - - if (!mmio) - return FALSE; - - mgaWaitAvail (wait + 4); - /* Set the format of the destination pixmap */ - switch (dest_bpp) { - case 8: - MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW8); - break; - case 16: - MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW16); - break; - case 24: - case 32: - MGA_OUT32 (mmio, MGA_REG_MACCESS, MGA_PW24); - break; - } - MGA_OUT32 (mmio, MGA_REG_CXBNDRY, 0xffff0000); - MGA_OUT32 (mmio, MGA_REG_YTOP, 0x00000000); - MGA_OUT32 (mmio, MGA_REG_YBOT, 0x007fffff); - - return TRUE; -} - -static Bool -mgaPrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) -{ - - KdScreenPriv(pPixmap->drawable.pScreen); - int cmd; - int dst_org; - /* We must pad pm and fg depending on the format of the - * destination pixmap - */ - switch (pPixmap->drawable.bitsPerPixel) { - case 16: - fg |= fg << 16; - pm |= pm << 16; - break; - case 8: - fg |= (fg << 8) | (fg << 16) | (fg << 24); - pm |= (pm << 8) | (pm << 16) | (pm << 24); - break; - } - - cmd = MGA_OPCOD_TRAP | MGA_DWGCTL_SOLID | MGA_DWGCTL_ARZERO | MGA_DWGCTL_SGNZERO | - MGA_DWGCTL_SHIFTZERO | mgaRop[alu]; - - dst_org = (int)pPixmap->devPrivate.ptr - (int)pScreenPriv->screen->memory_base; - - mgaSetup (pPixmap->drawable.pScreen, pPixmap->drawable.bitsPerPixel, 5); - MGA_OUT32 (mmio, MGA_REG_DSTORG, dst_org); - MGA_OUT32 (mmio, MGA_REG_PITCH, pPixmap->devKind / (pPixmap->drawable.bitsPerPixel >> 3)); - MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd); - MGA_OUT32 (mmio, MGA_REG_FCOL, fg); - MGA_OUT32 (mmio, MGA_REG_PLNWT, pm); - - return TRUE; -} - -static void -mgaSolid (int x1, int y1, int x2, int y2) -{ - mgaWaitAvail (2); - MGA_OUT32 (mmio, MGA_REG_FXBNDRY, (x2 << 16) | (x1 & 0xffff)); - MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (y1 << 16) | (y2 - y1)); -} - -static void -mgaDoneSolid (void) -{ -} - -#define BLIT_LEFT 1 -#define BLIT_UP 4 - -static Bool -mgaPrepareCopy (PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, - int dx, int dy, int alu, Pixel pm) -{ - KdScreenPriv(pSrcPixmap->drawable.pScreen); - int cmd; - - cmd = MGA_OPCOD_BITBLT | MGA_DWGCTL_BFCOL | MGA_DWGCTL_SHIFTZERO | mgaRop[alu]; - - dir = 0; - - if (dy < 0) - dir |= BLIT_UP; - if (dx < 0) - dir |= BLIT_LEFT; - - mgaSetup (pSrcPixmap->drawable.pScreen, - pDstPixmap->drawable.bitsPerPixel, 7); - - MGA_OUT32 (mmio, MGA_REG_SRCORG, ((int)pSrcPixmap->devPrivate.ptr - - (int)pScreenPriv->screen->memory_base)); - MGA_OUT32 (mmio, MGA_REG_DSTORG, ((int)pDstPixmap->devPrivate.ptr - - (int)pScreenPriv->screen->memory_base)); - MGA_OUT32 (mmio, MGA_REG_PITCH, (pDstPixmap->devKind / - (pDstPixmap->drawable.bitsPerPixel >> 3))); - src_pitch = pSrcPixmap->devKind / (pSrcPixmap->drawable.bitsPerPixel >> 3); - - MGA_OUT32 (mmio, MGA_REG_DWGCTL, cmd); - MGA_OUT32 (mmio, MGA_REG_SGN, dir); - MGA_OUT32 (mmio, MGA_REG_PLNWT, pm); - MGA_OUT32 (mmio, MGA_REG_AR5, src_pitch * (dy < 0 ? -1 : 1) ); - - return TRUE; -} - -static void -mgaCopy (int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - int start, end; - if (dir & BLIT_UP) - { - srcY += h - 1; - dstY += h - 1; - } - - w--; - start = end = srcY * src_pitch + srcX; - - if (dir & BLIT_LEFT) - start += w; - else - end += w; - - mgaWaitAvail (4); - MGA_OUT32 (mmio, MGA_REG_AR0, end); - MGA_OUT32 (mmio, MGA_REG_AR3, start); - MGA_OUT32 (mmio, MGA_REG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); - MGA_OUT32 (mmio, MGA_REG_YDSTLEN | MGA_REG_EXEC, (dstY << 16) | h); -} - -static void -mgaDoneCopy (void) -{ -} - -#if 0 -static Bool -mgaUploadToScreen(PixmapPtr pDst, char *src, int src_pitch) { - /*fprintf(stderr,"Upload to Screen %p [%d]\n",src,src_pitch);*/ - return TRUE; -} -#endif - -Bool -mgaDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - mgaScreenInfo (pScreenPriv); - KdCardInfo *card = pScreenPriv->card; - - memset(&mgas->kaa, 0, sizeof(KaaScreenInfoRec)); - mgas->kaa.waitMarker = mgaWaitMarker; - mgas->kaa.PrepareSolid = mgaPrepareSolid; - mgas->kaa.Solid = mgaSolid; - mgas->kaa.DoneSolid = mgaDoneSolid; - mgas->kaa.PrepareCopy = mgaPrepareCopy; - mgas->kaa.Copy = mgaCopy; - mgas->kaa.DoneCopy = mgaDoneCopy; - /* In PW24 mode, we need to align to "3 64-bytes" */ - mgas->kaa.offsetAlign = 192; - /* Pitch alignment is in sets of 32 pixels, and we need to cover 32bpp, so - * 128 bytes - */ - mgas->kaa.pitchAlign = 128; - mgas->kaa.flags = KAA_OFFSCREEN_PIXMAPS; - - if (card->attr.deviceID == MGA_G4XX_DEVICE_ID) { - mgas->kaa.CheckComposite = mgaCheckComposite; - mgas->kaa.PrepareComposite = mgaPrepareComposite; - mgas->kaa.Composite = mgaComposite; - mgas->kaa.DoneComposite = mgaDoneComposite; - } - - /*mgas->kaa.UploadToScreen=mgaUploadToScreen;*/ - - if (!kaaDrawInit (pScreen, &mgas->kaa)) - return FALSE; - - return TRUE; -} - -void -mgaDrawEnable (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - mgaScreenInfo (pScreenPriv); - - mgas->pitch = pScreenPriv->screen->width; - - switch (pScreenPriv->screen->fb[0].depth) { - case 8: - mgas->pw = MGA_PW8; - break; - case 16: - mgas->pw = MGA_PW16; - break; - case 24: - case 32: - mgas->pw = MGA_PW24; - break; - default: - FatalError ("unsupported pixel format"); - } - - kaaMarkSync (pScreen); -} - -void -mgaDrawDisable (ScreenPtr pScreen) -{ - kaaWaitSync(pScreen); -} - -void -mgaDrawFini (ScreenPtr pScreen) -{ -} - diff --git a/hw/kdrive/mga/mgastub.c b/hw/kdrive/mga/mgastub.c deleted file mode 100644 index 61e6963b8..000000000 --- a/hw/kdrive/mga/mgastub.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 2003 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mga.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - - if (LinuxFindPci (0x102b, 0x0525, 0, &attr)) - KdCardInfoAdd (&mgaFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/neomagic/Makefile.am b/hw/kdrive/neomagic/Makefile.am deleted file mode 100644 index b449c37c5..000000000 --- a/hw/kdrive/neomagic/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -if KDRIVEFBDEV -FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev -FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a -endif - -if KDRIVEVESA -VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa -VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a -endif - -INCLUDES = \ - @KDRIVE_INCS@ \ - $(FBDEV_INCLUDES) \ - $(VESA_INCLUDES) \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xneomagic - -noinst_LIBRARIES = libneomagic.a - -libneomagic_a_SOURCES = \ - neomagic.c \ - neomagic.h \ - neo_draw.c - -Xneomagic_SOURCES = \ - neomagicstub.c - -NEOMAGIC_LIBS = \ - libneomagic.a \ - ${FBDEV_LIBS} \ - ${VESA_LIBS} \ - @KDRIVE_LIBS@ - -if GLX -Xneomagic_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xneomagic_LDADD = \ - $(NEOMAGIC_LIBS) \ - @KDRIVE_LIBS@ \ - @XSERVER_LIBS@ - -Xneomagic_DEPENDENCIES = \ - libneomagic.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/neomagic/README b/hw/kdrive/neomagic/README deleted file mode 100644 index 2b086d75c..000000000 --- a/hw/kdrive/neomagic/README +++ /dev/null @@ -1,15 +0,0 @@ -Neomagic KDrive driver for xserver - -This is a very simple implementation for Neomagic based cards. -Almost all functions are handled by the VESA driver, and -only solid drawing and bitblt are done with acceleration, - -This driver has been tested in MagicGraph 256AV+(NM2230) card -but it should work on other cards as well. - -The only warning is to choose a working mode. You can ask -for supported modes using -listmodes. I use -mode 0x117. - --- -Franco Catrin L. -fcatrin@tuxpan.com diff --git a/hw/kdrive/neomagic/neo_draw.c b/hw/kdrive/neomagic/neo_draw.c deleted file mode 100644 index 89452b3d8..000000000 --- a/hw/kdrive/neomagic/neo_draw.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "neomagic.h" - -#include <X11/Xmd.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" - -NeoMMIO *mmio; -NeoScreenInfo *screen; -NeoCardInfo *card; -CARD32 fgColor; -CARD32 rop; - -CARD32 neoRop[16] = { - 0x000000, /* GXclear */ - 0x080000, /* GXand */ - 0x040000, /* GXandReverse */ - 0x0c0000, /* GXcopy */ - 0x020000, /* GXandInvert */ - 0x0a0000, /* GXnoop */ - 0x060000, /* GXxor */ - 0x0e0000, /* GXor */ - 0x010000, /* GXnor */ - 0x090000, /* GXequiv */ - 0x050000, /* GXinvert */ - 0x0d0000, /* GXorReverse */ - 0x030000, /* GXcopyInvert */ - 0x0b0000, /* GXorInverted */ - 0x070000, /* GXnand */ - 0x0f0000 /* GXset */ -}; - -static void neoWaitIdle(NeoCardInfo *neoc) -{ - // if MMIO is not working it may halt the machine - unsigned int i = 0; - while ((mmio->bltStat & 1) && ++i<100000); -} - -static void neoWaitMarker (ScreenPtr pScreen, int marker) -{ - KdScreenPriv(pScreen); - neoCardInfo(pScreenPriv); - - neoWaitIdle(neoc); -} - - -static Bool neoPrepareSolid(PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - FbBits depthMask = FbFullMask(pPixmap->drawable.depth); - if ((pm & depthMask) != depthMask) { - return FALSE; - } else { - fgColor = fg; - if (alu!=3) DBGOUT("used ROP %i\n", alu); - rop = neoRop[alu]; - return TRUE; - } -} - -static void neoSolid (int x1, int y1, int x2, int y2) -{ - int x, y, w, h; - x = x1; - y = y1; - w = x2-x1; - h = y2-y1; - neoWaitIdle(card); - mmio->fgColor = fgColor; - mmio->bltCntl = - NEO_BC3_FIFO_EN | - NEO_BC0_SRC_IS_FG | - NEO_BC3_SKIP_MAPPING | rop; - mmio->dstStart = y * screen->pitch + x * screen->depth; - - mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff); - -} - - -static void neoDoneSolid(void) -{ -} - -static Bool neoPrepareCopy (PixmapPtr pSrcPixpam, PixmapPtr pDstPixmap, - int dx, int dy, int alu, Pixel pm) -{ - rop = neoRop[alu]; - return TRUE; -} - -static void neoCopy (int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - neoWaitIdle(card); - - if ((dstY < srcY) || ((dstY == srcY) && (dstX < srcX))) { - mmio->bltCntl = - NEO_BC3_FIFO_EN | - NEO_BC3_SKIP_MAPPING | rop; - mmio->srcStart = srcY * screen->pitch + srcX * screen->depth; - mmio->dstStart = dstY * screen->pitch + dstX * screen->depth; - - mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff); - } else { - mmio->bltCntl = NEO_BC0_X_DEC | - NEO_BC0_DST_Y_DEC | - NEO_BC0_SRC_Y_DEC | - NEO_BC3_FIFO_EN | - NEO_BC3_SKIP_MAPPING | rop; - srcX+=w-1; - dstX+=w-1; - srcY+=h-1; - dstY+=h-1; - mmio->srcStart = srcY * screen->pitch + srcX * screen->depth; - mmio->dstStart = dstY * screen->pitch + dstX * screen->depth; - mmio->xyExt = (unsigned long)(h << 16) | (w & 0xffff); - } - -} - -static void neoDoneCopy (void) -{ -} - - -Bool neoDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - neoScreenInfo(pScreenPriv); - - ENTER(); - - memset(&neos->kaa, 0, sizeof(KaaScreenInfoRec)); - neos->kaa.waitMarker = neoWaitMarker; - neos->kaa.PrepareSolid = neoPrepareSolid; - neos->kaa.Solid = neoSolid; - neos->kaa.DoneSolid = neoDoneSolid; - neos->kaa.PrepareCopy = neoPrepareCopy; - neos->kaa.Copy = neoCopy; - neos->kaa.DoneCopy = neoDoneCopy; - - if (!kaaDrawInit (pScreen, &neos->kaa)) { - return FALSE; - } - LEAVE(); - return TRUE; -} - -void neoDrawEnable (ScreenPtr pScreen) -{ - ENTER(); - SetupNeo(pScreen); - screen = neos; - card = neoc; - mmio = neoc->mmio; - screen->depth = (screen->backendScreen.mode.BitsPerPixel+7)/8; - screen->pitch = screen->backendScreen.mode.BytesPerScanLine; - DBGOUT("NEO depth=%x, pitch=%x\n", screen->depth, screen->pitch); - LEAVE(); -} - -void neoDrawDisable (ScreenPtr pScreen) -{ - ENTER(); - LEAVE(); -} - -void neoDrawFini (ScreenPtr pScreen) -{ - ENTER(); - LEAVE(); -} - diff --git a/hw/kdrive/neomagic/neomagic.c b/hw/kdrive/neomagic/neomagic.c deleted file mode 100644 index ac0c7569a..000000000 --- a/hw/kdrive/neomagic/neomagic.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "neomagic.h" -#include <sys/io.h> - -struct NeoChipInfo neoChips[] = { - {NEO_VENDOR, 0x0001, CAP_NM2070, "MagicGraph 128(NM2070)", - 896, 65000, 2048, 0x100, 1024, 1024, 1024}, - {NEO_VENDOR, 0x0002, CAP_NM2090, "MagicGraph 128V(NM2090)", - 1152, 80000, 2048, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0003, CAP_NM2090, "MagicGraph 128ZV(NM2093)", - 1152, 80000, 2048, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0083, CAP_NM2097, "MagicGraph 128ZV+(NM2097)", - 1152, 80000, 1024, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0004, CAP_NM2097, "MagicGraph 128XD(NM2160)", - 2048, 90000, 1024, 0x100, 2048, 1024, 1024}, - {NEO_VENDOR, 0x0005, CAP_NM2200, "MagicGraph 256AV(NM2200)", - 2560, 110000, 1024, 0x1000, 4096, 1280, 1024}, - {NEO_VENDOR, 0x0025, CAP_NM2200, "MagicGraph 256AV+(NM2230)", - 3008, 110000, 1024, 0x1000, 4096, 1280, 1024}, - {NEO_VENDOR, 0x0006, CAP_NM2200, "MagicGraph 256ZX(NM2360)", - 4096, 110000, 1024, 0x1000, 4096, 1280, 1024}, - {NEO_VENDOR, 0x0016, CAP_NM2200, "MagicGraph 256XL+(NM2380)", - 6144, 110000, 1024, 0x1000, 8192, 1280, 1024}, - {0, 0, 0, NULL}, -}; - -static Bool -neoCardInit(KdCardInfo *card) -{ - NeoCardInfo *neoc; - struct NeoChipInfo *chip; - - neoc =(NeoCardInfo *) xalloc(sizeof(NeoCardInfo)); - if(!neoc) { - return FALSE; - } - - if(!vesaInitialize(card, &neoc->backendCard)) { - xfree(neoc); - return FALSE; - } - - for(chip = neoChips; chip->name != NULL; ++chip) { - if(chip->device == card->attr.deviceID) { - neoc->chip = chip; - break; - } - } - - ErrorF("Using Neomagic card: %s\n", neoc->chip->name); - - neoMapReg(card, neoc); - - card->driver = neoc; - - return TRUE; -} - -static Bool -neoScreenInit(KdScreenInfo *screen) -{ - NeoScreenInfo *neos; - int screen_size, memory; - - neos = xcalloc(sizeof(NeoScreenInfo), 1); - if(neos == NULL) { - return FALSE; - } - - memset (neos, '\0', sizeof (NeoScreenInfo)); - - - if(!vesaScreenInitialize(screen, &neos->backendScreen)) { - xfree(neos); - return FALSE; - } - - screen->softCursor = TRUE; // no hardware color cursor available - - neos->screen = neos->backendScreen.fb; - - memory = neos->backendScreen.fb_size; - screen_size = screen->fb[0].byteStride * screen->height; - memory -= screen_size; - - if(memory > screen->fb[0].byteStride) { - neos->off_screen = neos->screen + screen_size; - neos->off_screen_size = memory; - } else { - neos->off_screen = 0; - neos->off_screen_size = 0; - } - - screen->driver = neos; - - return TRUE; -} - -static Bool -neoInitScreen(ScreenPtr pScreen) -{ - return vesaInitScreen(pScreen); -} - -static Bool -neoFinishInitScreen(ScreenPtr pScreen) -{ - return vesaFinishInitScreen(pScreen); -} - -static Bool -neoCreateResources(ScreenPtr pScreen) -{ - return vesaCreateResources(pScreen); -} - -void -neoPreserve(KdCardInfo *card) -{ - vesaPreserve(card); -} - -CARD8 -neoGetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index) -{ - outb(index, addr); - - return inb(addr+1); -} - -void -neoSetIndex(NeoCardInfo *nvidiac, CARD16 addr, CARD8 index, CARD8 val) -{ - outb(index, addr); - outb(val, addr+1); -} - -static void neoLock(NeoCardInfo *neoc){ - CARD8 cr11; - neoSetIndex(neoc, 0x3ce, 0x09, 0x00); - neoSetIndex(neoc, 0x3ce, 0x11, 0x0); // disable MMIO and linear mode - cr11 = neoGetIndex(neoc, 0x3d4, 0x11); - neoSetIndex(neoc, 0x3d4, 0x11, cr11 | 0x80); -} - -static void neoUnlock(NeoCardInfo *neoc){ - CARD8 cr11; - cr11 = neoGetIndex(neoc, 0x3d4, 0x11); - neoSetIndex(neoc, 0x3d4, 0x11, cr11 & 0x7F); - neoSetIndex(neoc, 0x3ce, 0x09, 0x26); - neoSetIndex(neoc, 0x3ce, 0x11, 0xc0); // enable MMIO and linear mode -} - - -Bool -neoMapReg(KdCardInfo *card, NeoCardInfo *neoc) -{ - neoc->reg_base = card->attr.address[1] & 0xFFF80000; - if(!neoc->reg_base) { - return FALSE; - } - - neoc->mmio = KdMapDevice(neoc->reg_base, NEO_REG_SIZE(card)); - if(!neoc->mmio) { - return FALSE; - } - - KdSetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -void -neoUnmapReg(KdCardInfo *card, NeoCardInfo *neoc) -{ - if(neoc->reg_base) - { - neoSetIndex(neoc, 0x3ce, 0x82,0); - KdResetMappedMode(neoc->reg_base, NEO_REG_SIZE(card), KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice((void *)neoc->mmio, NEO_REG_SIZE(card)); - neoc->reg_base = 0; - } -} - -static void -neoSetMMIO(KdCardInfo *card, NeoCardInfo *neoc) -{ - if(!neoc->reg_base) - neoMapReg(card, neoc); - neoUnlock(neoc); -} - -static void -neoResetMMIO(KdCardInfo *card, NeoCardInfo *neoc) -{ - neoUnmapReg(card, neoc); - neoLock(neoc); -} - - -Bool -neoEnable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - neoCardInfo(pScreenPriv); - - if(!vesaEnable(pScreen)) { - return FALSE; - } - - neoSetMMIO(pScreenPriv->card, neoc); - return TRUE; -} - -void -neoDisable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - neoCardInfo(pScreenPriv); - - neoResetMMIO(pScreenPriv->card, neoc); - - vesaDisable(pScreen); -} - -static void -neoGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - vesaGetColors(pScreen, fb, n, pdefs); -} - -static void -neoPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - vesaPutColors(pScreen, fb, n, pdefs); -} - -static Bool -neoDPMS(ScreenPtr pScreen, int mode) -{ - return vesaDPMS(pScreen, mode); -} - -static void -neoRestore(KdCardInfo *card) -{ - NeoCardInfo *neoc = card->driver; - - neoResetMMIO(card, neoc); - vesaRestore(card); -} - -static void -neoScreenFini(KdScreenInfo *screen) -{ - NeoScreenInfo *neos =(NeoScreenInfo *) screen->driver; - - vesaScreenFini(screen); - xfree(neos); - screen->driver = 0; -} - -static void -neoCardFini(KdCardInfo *card) -{ - NeoCardInfo *neoc = card->driver; - - neoUnmapReg(card, neoc); - vesaCardFini(card); -} - -#define neoCursorInit 0 // initCursor -#define neoCursorEnable 0 // enableCursor -#define neoCursorDisable 0 // disableCursor -#define neoCursorFini 0 // finiCursor */ -#define neoRecolorCursor 0 // recolorCursor */ -//#define neoDrawInit 0 // initAccel -//#define neoDrawEnable 0 // enableAccel -//#define neoDrawSync 0 // syncAccel -//#define neoDrawDisable 0 // disableAccel -//#define neoDrawFini 0 // finiAccel - -KdCardFuncs neoFuncs = { - neoCardInit, // cardinit - neoScreenInit, // scrinit - neoInitScreen, // initScreen - neoFinishInitScreen, // finishInitScreen - neoCreateResources, // createRes - neoPreserve, // preserve - neoEnable, // enable - neoDPMS, // dpms - neoDisable, // disable - neoRestore, // restore - neoScreenFini, // scrfini - neoCardFini, // cardfini - - neoCursorInit, // initCursor - neoCursorEnable, // enableCursor - neoCursorDisable, // disableCursor - neoCursorFini, // finiCursor - neoRecolorCursor, // recolorCursor - - neoDrawInit, // initAccel - neoDrawEnable, // enableAccel - neoDrawDisable, // disableAccel - neoDrawFini, // finiAccel - - neoGetColors, // getColors - neoPutColors, // putColors -}; diff --git a/hw/kdrive/neomagic/neomagic.h b/hw/kdrive/neomagic/neomagic.h deleted file mode 100644 index 9b100051b..000000000 --- a/hw/kdrive/neomagic/neomagic.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN 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 _NEOMAGIC_H_ -#define _NEOMAGIC_H_ -#include <backend.h> -#include "kxv.h" -#include "klinux.h" -#include "vesa.h" - - -#define DBGOUT DebugF - -#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__) -#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__) - -#define NEO_VENDOR 0x10c8 -#define CAP_NM2070 0x01 /* If it's a NM2070 series */ -#define CAP_NM2090 0x02 /* If it's a NM2090 series */ -#define CAP_NM2097 0x03 /* If it's a NM2097 series */ -#define CAP_NM2200 0x04 /* If it's a NM2200 series */ - -#define NEO_BS0_BLT_BUSY 0x00000001 -#define NEO_BS0_FIFO_AVAIL 0x00000002 -#define NEO_BS0_FIFO_PEND 0x00000004 - -#define NEO_BC0_DST_Y_DEC 0x00000001 -#define NEO_BC0_X_DEC 0x00000002 -#define NEO_BC0_SRC_TRANS 0x00000004 -#define NEO_BC0_SRC_IS_FG 0x00000008 -#define NEO_BC0_SRC_Y_DEC 0x00000010 -#define NEO_BC0_FILL_PAT 0x00000020 -#define NEO_BC0_SRC_MONO 0x00000040 -#define NEO_BC0_SYS_TO_VID 0x00000080 - -#define NEO_BC1_DEPTH8 0x00000100 -#define NEO_BC1_DEPTH16 0x00000200 -#define NEO_BC1_X_320 0x00000400 -#define NEO_BC1_X_640 0x00000800 -#define NEO_BC1_X_800 0x00000c00 -#define NEO_BC1_X_1024 0x00001000 -#define NEO_BC1_X_1152 0x00001400 -#define NEO_BC1_X_1280 0x00001800 -#define NEO_BC1_X_1600 0x00001c00 -#define NEO_BC1_DST_TRANS 0x00002000 -#define NEO_BC1_MSTR_BLT 0x00004000 -#define NEO_BC1_FILTER_Z 0x00008000 - -#define NEO_BC2_WR_TR_DST 0x00800000 - -#define NEO_BC3_SRC_XY_ADDR 0x01000000 -#define NEO_BC3_DST_XY_ADDR 0x02000000 -#define NEO_BC3_CLIP_ON 0x04000000 -#define NEO_BC3_FIFO_EN 0x08000000 -#define NEO_BC3_BLT_ON_ADDR 0x10000000 -#define NEO_BC3_SKIP_MAPPING 0x80000000 - -#define NEO_MODE1_DEPTH8 0x0100 -#define NEO_MODE1_DEPTH16 0x0200 -#define NEO_MODE1_DEPTH24 0x0300 -#define NEO_MODE1_X_320 0x0400 -#define NEO_MODE1_X_640 0x0800 -#define NEO_MODE1_X_800 0x0c00 -#define NEO_MODE1_X_1024 0x1000 -#define NEO_MODE1_X_1152 0x1400 -#define NEO_MODE1_X_1280 0x1800 -#define NEO_MODE1_X_1600 0x1c00 -#define NEO_MODE1_BLT_ON_ADDR 0x2000 - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -#define NEO_REG_SIZE(c) (0x200000L) - -typedef volatile struct { - CARD32 bltStat; - CARD32 bltCntl; - CARD32 xpColor; - CARD32 fgColor; - CARD32 bgColor; - CARD32 pitch; - CARD32 clipLT; - CARD32 clipRB; - CARD32 srcBitOffset; - CARD32 srcStart; - CARD32 reserved0; - CARD32 dstStart; - CARD32 xyExt; - - CARD32 reserved1[19]; - - CARD32 pageCntl; - CARD32 pageBase; - CARD32 postBase; - CARD32 postPtr; - CARD32 dataPtr; -} NeoMMIO; - -typedef struct _neoCardInfo { - VesaCardPrivRec backendCard; - - CARD32 reg_base; - NeoMMIO *mmio; - int dstOrg; - int dstPitch; - int dstPixelWidth; - - int srcOrg; - int srcPitch; - int srcPixelWidth; - - struct NeoChipInfo *chip; - - CARD32 bltCntl; - -} NeoCardInfo; - -struct NeoChipInfo { - CARD16 vendor; - CARD16 device; - CARD8 caps; - char *name; - int videoRam; - int maxClock; - int cursorMem; - int cursorOff; - int linearSize; - int maxWidth; - int maxHeight; -}; - -#define getNeoCardInfo(kd) ((NeoCardInfo *) ((kd)->card->driver)) -#define neoCardInfo(kd) NeoCardInfo *neoc = getNeoCardInfo(kd) - -typedef struct _neoScreenInfo { - VesaScreenPrivRec backendScreen; - - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - int pitch; - int depth; - KdVideoAdaptorPtr pAdaptor; - KaaScreenInfoRec kaa; -} NeoScreenInfo; - -#define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver)) -#define neoScreenInfo(kd) NeoScreenInfo *neos = getNeoScreenInfo(kd) - -#define SetupNeo(s) KdScreenPriv(s); \ - neoCardInfo(pScreenPriv); \ - neoScreenInfo(pScreenPriv); - -void -neoPreserve (KdCardInfo *card); - -Bool -neoEnable (ScreenPtr pScreen); - -void -neoDisable (ScreenPtr pScreen); - -Bool -neoMapReg (KdCardInfo *card, NeoCardInfo *nvidiac); - -void -neoUnmapReg (KdCardInfo *card, NeoCardInfo *nvidiac); - -CARD8 -neoGetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id); - -void -neoSetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id, CARD8 val); - -Bool -neoDrawInit (ScreenPtr pScreen); - -void -neoDrawEnable (ScreenPtr pScreen); - -void -neoDrawDisable (ScreenPtr pScreen); - -void -neoDrawFini (ScreenPtr pScreen); - -extern KdCardFuncs neoFuncs; - -#endif /* _NEOMAGIC_H_ */ diff --git a/hw/kdrive/neomagic/neomagicstub.c b/hw/kdrive/neomagic/neomagicstub.c deleted file mode 100644 index c7ec83b44..000000000 --- a/hw/kdrive/neomagic/neomagicstub.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * Copyright © 2004 Franco Catrin - * - * 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 Franco Catrin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Franco Catrin makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "neomagic.h" - -extern struct NeoChipInfo neoChips[]; - -void -InitCard (char *name) -{ - KdCardAttr attr; - struct NeoChipInfo *chip; - - for (chip = neoChips; chip->name != NULL; ++chip) { - int j = 0; - while (LinuxFindPci(chip->vendor, chip->device, j++, &attr)) { - KdCardInfoAdd(&neoFuncs, &attr, 0); - } - } -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/nvidia/Makefile.am b/hw/kdrive/nvidia/Makefile.am deleted file mode 100644 index 81736c311..000000000 --- a/hw/kdrive/nvidia/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xnvidia - -noinst_LIBRARIES = libnvidia.a - -# nvidiavideo.c - -libnvidia_a_SOURCES = \ - nvidia.c \ - nvidiadraw.c \ - nvidia.h \ - nvidiadraw.h - -Xnvidia_SOURCES = \ - nvidiastub.c - -NVIDIA_LIBS = \ - libnvidia.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - @KDRIVE_LIBS@ - -if GLX -Xnvidia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xnvidia_LDADD = \ - $(NVIDIA_LIBS) \ - @KDRIVE_LIBS@ - -Xnvidia_DEPENDENCIES = \ - libnvidia.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/nvidia/nvidia.c b/hw/kdrive/nvidia/nvidia.c deleted file mode 100644 index be42e561a..000000000 --- a/hw/kdrive/nvidia/nvidia.c +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "nvidia.h" -#include "kaa.h" -#include <sys/io.h> - -static Bool -nvidiaCardInit (KdCardInfo *card) -{ - NvidiaCardInfo *nvidiac; - - nvidiac = (NvidiaCardInfo *) xalloc (sizeof (NvidiaCardInfo)); - if (!nvidiac) - return FALSE; - - (void) nvidiaMapReg (card, nvidiac); - - if (!vesaInitialize (card, &nvidiac->vesa)) - { - xfree (nvidiac); - return FALSE; - } - - card->driver = nvidiac; - - return TRUE; -} - -static Bool -nvidiaScreenInit (KdScreenInfo *screen) -{ - NvidiaCardInfo *nvidiac = screen->card->driver; - NvidiaScreenInfo *nvidias; - int screen_size, memory; - - nvidias = (NvidiaScreenInfo *) xalloc (sizeof (NvidiaScreenInfo)); - if (!nvidias) - return FALSE; - memset (nvidias, '\0', sizeof (NvidiaScreenInfo)); - if (!vesaScreenInitialize (screen, &nvidias->vesa)) - { - xfree (nvidias); - return FALSE; - } - if (!nvidiac->reg_base) - screen->dumb = TRUE; - if (nvidias->vesa.mapping != VESA_LINEAR) - screen->dumb = TRUE; - nvidias->screen = nvidias->vesa.fb; - memory = nvidias->vesa.fb_size; - screen_size = screen->fb[0].byteStride * screen->height; - if (nvidias->screen && memory >= screen_size + 2048) - { - memory -= 2048; - nvidias->cursor_base = nvidias->screen + memory - 2048; - } - else - nvidias->cursor_base = 0; - screen->softCursor = TRUE; /* XXX for now */ - memory -= screen_size; - if (memory > screen->fb[0].byteStride) - { - nvidias->off_screen = nvidias->screen + screen_size; - nvidias->off_screen_size = memory; - } - else - { - nvidias->off_screen = 0; - nvidias->off_screen_size = 0; - } - screen->driver = nvidias; - return TRUE; -} - -static Bool -nvidiaInitScreen (ScreenPtr pScreen) -{ -#if 0 -#ifdef XV - KdScreenPriv(pScreen); - NvidiaCardInfo *nvidiac = pScreenPriv->screen->card->driver; - if (nvidiac->media_reg && nvidiac->reg) - nvidiaInitVideo(pScreen); -#endif -#endif - return vesaInitScreen (pScreen); -} - -#ifdef RANDR -static Bool -nvidiaRandRSetConfig (ScreenPtr pScreen, - Rotation rotation, - int rate, - RRScreenSizePtr pSize) -{ - kaaWaitSync (pScreen); - - if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) - return FALSE; - - return TRUE; -} - -static void -nvidiaRandRInit (ScreenPtr pScreen) -{ - rrScrPriv(pScreen); - - pScrPriv->rrSetConfig = nvidiaRandRSetConfig; -} -#endif - -static Bool -nvidiaFinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - ret = vesaFinishInitScreen (pScreen); -#ifdef RANDR - nvidiaRandRInit (pScreen); -#endif - return ret; -} - -void -nvidiaPreserve (KdCardInfo *card) -{ - vesaPreserve(card); -} - -void -nvidiaOutb (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 val) -{ - asm volatile ("outb %b0,%w1" : : "a" (val), "d" (port)); -} - -CARD8 -nvidiaInb (NvidiaCardInfo *nvidiac, CARD16 port) -{ - CARD8 v; - asm volatile ("inb %w1,%b0" : "=a" (v) : "d" (port)); - return v; -} - -CARD8 -nvidiaGetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id) -{ - CARD8 ret; - DBGOUT ("nvidiaGetIndex(0x%x,0x%x)\n", addr, id); - nvidiaOutb (nvidiac, addr, id); - ret = nvidiaInb (nvidiac, data); - DBGOUT (" -> 0x%x\n", ret); - return ret; -} - -void -nvidiaSetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id, CARD8 val) -{ - DBGOUT ("nvidiaSetIndex(0x%x,0x%x) = 0x%x\n", addr, id, val); - nvidiaOutb (nvidiac, addr, id); - nvidiaOutb (nvidiac, data, val); -} - -static void vgaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock) -{ - CARD8 cr11; - ENTER (); - cr11 = nvidiaGetIndex (nvidiac, 0x3d4, 0x3d5, 0x11); - if (lock) cr11 |= 0x80; - else cr11 &= ~0x80; - nvidiaSetIndex (nvidiac, 0x3d4, 0x3d5, 0x11, cr11); - LEAVE (); -} - -static void nvidiaLockUnlock (NvidiaCardInfo *nvidiac, Bool lock) -{ - if (NVIDIA_IS_3(nvidiac)) - nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x06, lock ? 0x99 : 0x57); - else - nvidiaSetIndex (nvidiac, 0x3c4, 0x3c5, 0x1f, lock ? 0x99 : 0x57); - vgaLockUnlock(nvidiac, lock); -} - -Bool -nvidiaMapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac) -{ - nvidiac->reg_base = (CARD8 *) KdMapDevice (NVIDIA_REG_BASE(card), - NVIDIA_REG_SIZE(card)); - - if (!nvidiac->reg_base) - { - nvidiac->mmio = 0; - nvidiac->rop = 0; - nvidiac->blt = 0; - nvidiac->rect = 0; - return FALSE; - } - - nvidiac->mmio = (CARD8 *) (nvidiac->reg_base + NVIDIA_MMIO_OFF(card)); - nvidiac->rop = (NvidiaRop *) (nvidiac->reg_base + NVIDIA_ROP_OFF(card)); - nvidiac->rect = (NvidiaRectangle *) (nvidiac->reg_base + NVIDIA_RECTANGLE_OFF(card)); - nvidiac->blt = (NvidiaScreenBlt *) (nvidiac->reg_base + NVIDIA_BLT_OFF(card)); - nvidiac->busy = (NvidiaBusy *) (nvidiac->reg_base + NVIDIA_BUSY_OFF(card)); - KdSetMappedMode (NVIDIA_REG_BASE(card), - NVIDIA_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - return TRUE; -} - -void -nvidiaUnmapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac) -{ - if (nvidiac->reg_base) - { - KdResetMappedMode (NVIDIA_REG_BASE(card), - NVIDIA_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice ((void *) nvidiac->reg_base, NVIDIA_REG_SIZE(card)); - nvidiac->reg_base = 0; - nvidiac->rop = 0; - nvidiac->blt = 0; - nvidiac->rect = 0; - } -} - -void -nvidiaSetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac) -{ - if (!nvidiac->reg_base) - nvidiaMapReg (card, nvidiac); - nvidiaLockUnlock (nvidiac, FALSE); - nvidiac->fifo_free = 0; - nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree; -} - -void -nvidiaResetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac) -{ - nvidiaUnmapReg (card, nvidiac); - nvidiaLockUnlock (nvidiac, TRUE); -} - -Bool -nvidiaEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - NvidiaCardInfo *nvidiac = pScreenPriv->card->driver; - - if (!vesaEnable (pScreen)) - return FALSE; - - nvidiaSetMMIO (pScreenPriv->card, nvidiac); -#ifdef XV - KdXVEnable (pScreen); -#endif - return TRUE; -} - -void -nvidiaDisable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - NvidiaCardInfo *nvidiac = pScreenPriv->card->driver; - -#ifdef XV - KdXVDisable (pScreen); -#endif - nvidiaResetMMIO (pScreenPriv->card, nvidiac); - vesaDisable (pScreen); -} - -static Bool -nvidiaDPMS (ScreenPtr pScreen, int mode) -{ - return vesaDPMS (pScreen, mode); -} - -static void -nvidiaRestore (KdCardInfo *card) -{ - NvidiaCardInfo *nvidiac = card->driver; - - nvidiaResetMMIO (card, nvidiac); - vesaRestore (card); -} - -static void -nvidiaScreenFini (KdScreenInfo *screen) -{ - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - - vesaScreenFini (screen); - xfree (nvidias); - screen->driver = 0; -} - -static void -nvidiaCardFini (KdCardInfo *card) -{ - NvidiaCardInfo *nvidiac = card->driver; - - nvidiaUnmapReg (card, nvidiac); - vesaCardFini (card); -} - -#define nvidiaCursorInit 0 /* initCursor */ -#define nvidiaCursorEnable 0 /* enableCursor */ -#define nvidiaCursorDisable 0 /* disableCursor */ -#define nvidiaCursorFini 0 /* finiCursor */ -#define nvidiaRecolorCursor 0 /* recolorCursor */ - -KdCardFuncs nvidiaFuncs = { - nvidiaCardInit, /* cardinit */ - nvidiaScreenInit, /* scrinit */ - nvidiaInitScreen, /* initScreen */ - nvidiaFinishInitScreen, /* finishInitScreen */ - vesaCreateResources, /* createRes */ - nvidiaPreserve, /* preserve */ - nvidiaEnable, /* enable */ - nvidiaDPMS, /* dpms */ - nvidiaDisable, /* disable */ - nvidiaRestore, /* restore */ - nvidiaScreenFini, /* scrfini */ - nvidiaCardFini, /* cardfini */ - - nvidiaCursorInit, /* initCursor */ - nvidiaCursorEnable, /* enableCursor */ - nvidiaCursorDisable, /* disableCursor */ - nvidiaCursorFini, /* finiCursor */ - nvidiaRecolorCursor, /* recolorCursor */ - - nvidiaDrawInit, /* initAccel */ - nvidiaDrawEnable, /* enableAccel */ - nvidiaDrawDisable, /* disableAccel */ - nvidiaDrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; diff --git a/hw/kdrive/nvidia/nvidia.h b/hw/kdrive/nvidia/nvidia.h deleted file mode 100644 index 026233cc1..000000000 --- a/hw/kdrive/nvidia/nvidia.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright © 2003 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. - */ - -#ifndef _NVIDIA_H_ -#define _NVIDIA_H_ -#include <vesa.h> -#include "kxv.h" -#include "klinux.h" - -/* - * offset from ioport beginning - */ - -#define DEBUG -#ifdef DEBUG -#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a) -#else -#define DBGOUT(fmt,a...) -#endif - -#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__) -#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__) - -#define NVIDIA_REG_BASE(c) ((c)->attr.address[0]) -#define NVIDIA_REG_SIZE(c) (16 * 1024 * 1024) - -#define NVIDIA_PCIO_OFF(c) (0x601000) -#define NVIDIA_MMIO_OFF(c) (NVIDIA_PCIO_OFF(c) + 0) -#define NVIDIA_FIFO_OFF(c) (0x800000) -#define NVIDIA_ROP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0) -#define NVIDIA_CLIP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x2000) -#define NVIDIA_PATT_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x4000) -#define NVIDIA_PIXMAP_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x6000) -#define NVIDIA_BLT_OFF(c) (NVIDIA_FIFO_OFF(c) + 0x8000) -#define NVIDIA_RECTANGLE_OFF(c) (NVIDIA_FIFO_OFF(c) + 0xa000) -#define NVIDIA_LINE_OFF(c) (NVIDIA_FIFO_OFF(c) + 0xc000) -#define NVIDIA_IS_3(c) (0) -#define NVIDIA_BUSY(c) (NVIDIA_IS_3(c) ? 0x6b0 : 0x700) -#define NVIDIA_BUSY_OFF(c) (0x400000 + NVIDIA_BUSY(c)) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -#define NVIDIA_XY(x,y) ((x) | ((y) << 16)) - -typedef struct { -#if X_BYTE_ORDER == X_BIG_ENDIAN - VOL32 FifoFree; -#else - VOL16 FifoFree; - VOL16 Nop; -#endif -} NvidiaFifoFree; - -/* - * Raster OPeration. Windows style ROP3. - */ -typedef struct { - VOL32 reserved00[4]; - NvidiaFifoFree FifoFree; - VOL32 reserved01[0x0BB]; - VOL32 Rop3; -} NvidiaRop; - -/* - * 2D filled rectangle. - */ -typedef struct { - VOL32 reserved00[4]; - NvidiaFifoFree FifoFree; - VOL32 reserved01[0x0BB]; - VOL32 reserved03[(0x040)-1]; - VOL32 Color1A; - VOL32 TopLeft; - VOL32 WidthHeight; -} NvidiaRectangle; - -/* - * 2D screen-screen BLT. - */ -typedef struct { - VOL32 reserved00[4]; - NvidiaFifoFree FifoFree; - VOL32 reserved01[0x0BB]; - VOL32 TopLeftSrc; - VOL32 TopLeftDst; - VOL32 WidthHeight; -} NvidiaScreenBlt; - -typedef struct { - VOL32 busy; -} NvidiaBusy; - -typedef struct _nvidiaCardInfo { - VesaCardPrivRec vesa; - CARD8 *reg_base; - int fifo_free; - int fifo_size; - CARD8 *mmio; - NvidiaRop *rop; - NvidiaRectangle *rect; - NvidiaScreenBlt *blt; - NvidiaBusy *busy; -} NvidiaCardInfo; - -#define getNvidiaCardInfo(kd) ((NvidiaCardInfo *) ((kd)->card->driver)) -#define nvidiaCardInfo(kd) NvidiaCardInfo *nvidiac = getNvidiaCardInfo(kd) - -/* - * Xv information, optional - */ -typedef struct _nvidiaPortPriv { - CARD32 YBuf0Offset; - - CARD32 YBuf1Offset; - - CARD8 currentBuf; - - int brightness; - int saturation; - - RegionRec clip; - CARD32 colorKey; - - Bool videoOn; - Time offTime; - Time freeTime; - CARD32 size; - CARD32 offset; -} NvidiaPortPrivRec, *NvidiaPortPrivPtr; - -Bool nvidiaInitVideo(ScreenPtr pScreen); - -typedef struct _nvidiaScreenInfo { - VesaScreenPrivRec vesa; - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - KdVideoAdaptorPtr pAdaptor; - KaaScreenInfoRec kaa; -} NvidiaScreenInfo; - -#define getNvidiaScreenInfo(kd) ((NvidiaScreenInfo *) ((kd)->screen->driver)) -#define nvidiaScreenInfo(kd) NvidiaScreenInfo *nvidias = getNvidiaScreenInfo(kd) - -void -nvidiaPreserve (KdCardInfo *card); - -void -nvidiaOutb (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 val); - -CARD8 -nvidiaInb (NvidiaCardInfo *nvidiac, CARD16 port); - -CARD8 -nvidiaGetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id); - -void -nvidiaSetIndex (NvidiaCardInfo *nvidiac, CARD16 addr, CARD16 data, CARD8 id, CARD8 val); - -Bool -nvidiaMapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac); - -void -nvidiaUnmapReg (KdCardInfo *card, NvidiaCardInfo *nvidiac); - -void -nvidiaSetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac); - -void -nvidiaResetMMIO (KdCardInfo *card, NvidiaCardInfo *nvidiac); - -Bool -nvidiaEnable (ScreenPtr pScreen); - -void -nvidiaDisable (ScreenPtr pScreen); - -void -nvidiaWait (NvidiaCardInfo *card, NvidiaFifoFree *free, int n); - -void -nvidiaWaitIdle (NvidiaCardInfo *card); - -Bool -nvidiaDrawSetup (ScreenPtr pScreen); - -Bool -nvidiaDrawInit (ScreenPtr pScreen); - -void -nvidiaDrawReinit (ScreenPtr pScreen); - -void -nvidiaDrawEnable (ScreenPtr pScreen); - -void -nvidiaDrawDisable (ScreenPtr pScreen); - -void -nvidiaDrawFini (ScreenPtr pScreen); - -CARD8 -nvidiaReadIndex (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 index); - -void -nvidiaWriteIndex (NvidiaCardInfo *nvidiac, CARD16 port, CARD8 index, CARD8 value); - -Bool -nvidiaCursorInit (ScreenPtr pScreen); - -void -nvidiaCursorEnable (ScreenPtr pScreen); - -void -nvidiaCursorDisable (ScreenPtr pScreen); - -void -nvidiaCursorFini (ScreenPtr pScreen); - -void -nvidiaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -extern KdCardFuncs nvidiaFuncs; - -#endif /* _NVIDIA_H_ */ diff --git a/hw/kdrive/nvidia/nvidiacurs.c b/hw/kdrive/nvidia/nvidiacurs.c deleted file mode 100644 index 4a5938162..000000000 --- a/hw/kdrive/nvidia/nvidiacurs.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "trident.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - tridentCardInfo(pScreenPriv); \ - tridentScreenInfo(pScreenPriv); \ - TridentCursor *pCurPriv = &tridents->cursor - -static void -_tridentMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - - - /* This is the recommended order to move the cursor */ - - tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); - tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); - tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); - tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); - tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); - tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); -} - -static void -tridentMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _tridentMoveCursor (pScreen, x, y); -} - -static void -tridentAllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -tridentSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CARD32 fg, bg; - - fg = pCurPriv->source; - bg = pCurPriv->mask; - tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); - tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); - tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); - - tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); - tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); - tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); -} - -void -tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - tridentAllocCursorColors (pScreen); - tridentSetCursorColors (pScreen); -} - -#define InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -static void -tridentLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - - /* - * Allocate new colors - */ - tridentAllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (CARD32 *) tridents->cursor_base; - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > TRIDENT_CURSOR_HEIGHT) - h = TRIDENT_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ - - for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - -#if 1 - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - InvertBits32(m); - InvertBits32(s); - } - else - { - m = 0; - s = 0; - } -#endif - *ram++ = m; - *ram++ = s; - } - } - - /* Set address for cursor bits */ - offset = tridents->cursor_base - (CARD8 *) tridents->screen; - offset >>= 10; - tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); - tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); - - /* Set new color */ - tridentSetCursorColors (pScreen); - - /* Enable the cursor */ - tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); - - /* Move to new position */ - tridentMoveCursor (pScreen, x, y); -} - -static void -tridentUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); -} - -static Bool -tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - tridentLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - tridentLoadCursor (pScreen, x, y); - else - tridentUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec tridentPointerSpriteFuncs = { - tridentRealizeCursor, - tridentUnrealizeCursor, - tridentSetCursor, - tridentMoveCursor, -}; - -static void -tridentQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -tridentCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!tridents->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = TRIDENT_CURSOR_WIDTH; - pCurPriv->height= TRIDENT_CURSOR_HEIGHT; - pScreen->QueryBestSize = tridentQueryBestSize; - miPointerInitialize (pScreen, - &tridentPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -tridentCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - tridentLoadCursor (pScreen, x, y); - } - else - tridentUnloadCursor (pScreen); - } -} - -void -tridentCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - tridentUnloadCursor (pScreen); - } - } -} - -void -tridentCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/nvidia/nvidiadraw.c b/hw/kdrive/nvidia/nvidiadraw.c deleted file mode 100644 index a39f79888..000000000 --- a/hw/kdrive/nvidia/nvidiadraw.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "nvidia.h" -#include "nvidiadraw.h" - -#include <X11/Xmd.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" -#include "kaa.h" - -CARD8 nvidiaRop[16] = { - /* GXclear */ 0x01, /* 0 */ - /* GXand */ 0x0c, /* src AND dst */ - /* GXandReverse */ 0x0d, /* src AND NOT dst */ - /* GXcopy */ 0x07, /* src */ - /* GXandInverted*/ 0x0e, /* NOT src AND dst */ - /* GXnoop */ 0x03, /* dst */ - /* GXxor */ 0x05, /* src XOR dst */ - /* GXor */ 0x0b, /* src OR dst */ - /* GXnor */ 0x0f, /* NOT src AND NOT dst */ - /* GXequiv */ 0x06, /* NOT src XOR dst */ - /* GXinvert */ 0x00, /* NOT dst */ - /* GXorReverse */ 0x0a, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x04, /* NOT src */ - /* GXorInverted */ 0x09, /* NOT src OR dst */ - /* GXnand */ 0x08, /* NOT src OR NOT dst */ - /* GXset */ 0x02, /* 1 */ -}; - -static NvidiaCardInfo *card; - -void -nvidiaWait (NvidiaCardInfo *card, NvidiaFifoFree *free, int n) -{ - while (card->fifo_free < n) - { - card->fifo_free = free->FifoFree >> 2; - } - card->fifo_free -= n; -} - -void -nvidiaWaitIdle (NvidiaCardInfo *card) -{ - while (card->fifo_free < card->fifo_size || (card->busy->busy & 1)) - { - card->fifo_free = card->rop->FifoFree.FifoFree >> 2; - } -} - -static void -nvidiaWaitMarker (ScreenPtr pScreen, int marker) -{ - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - - nvidiaWaitIdle (nvidiac); -} - -static Bool -nvidiaPrepareSolid (PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - - card = nvidiac; - if (~pm & FbFullMask(pPixmap->drawable.depth)) - return FALSE; - nvidiaWait (nvidiac, &nvidiac->rop->FifoFree, 1); - nvidiac->rop->Rop3 = nvidiaRop[alu]; - nvidiaWait (nvidiac, &nvidiac->rect->FifoFree, 1); - nvidiac->rect->Color1A = fg; - return TRUE; -} - -static void -nvidiaSolid (int x1, int y1, int x2, int y2) -{ - nvidiaWait (card, &card->rect->FifoFree, 2); - card->rect->TopLeft = NVIDIA_XY(x1,y1); - card->rect->WidthHeight = NVIDIA_XY(x2-x1,y2-y1); -} - -static void -nvidiaDoneSolid (void) -{ -} - - -static Bool -nvidiaPrepareCopy (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - int dx, - int dy, - int alu, - Pixel pm) -{ - ScreenPtr pScreen = pDstPixmap->drawable.pScreen; - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - - card = nvidiac; - if (~pm & FbFullMask(pDstPixmap->drawable.depth)) - return FALSE; - nvidiaWait (nvidiac, &card->rop->FifoFree, 1); - nvidiac->rop->Rop3 = nvidiaRop[alu]; - return TRUE; -} - -static void -nvidiaCopy (int srcX, - int srcY, - int dstX, - int dstY, - int w, - int h) -{ - nvidiaWait (card, &card->blt->FifoFree, 3); - card->blt->TopLeftSrc = NVIDIA_XY(srcX, srcY); - card->blt->TopLeftDst = NVIDIA_XY(dstX, dstY); - card->blt->WidthHeight = NVIDIA_XY(w, h); -} - -static void -nvidiaDoneCopy (void) -{ -} - -Bool -nvidiaDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - nvidiaScreenInfo(pScreenPriv); - Bool ret = TRUE; - - ENTER (); - if (pScreenPriv->screen->fb[0].depth == 4) - ret = FALSE; - - memset(&nvidias->kaa, 0, sizeof(KaaScreenInfoRec)); - nvidias->kaa.waitMarker = nvidiaWaitMarker; - nvidias->kaa.PrepareSolid = nvidiaPrepareSolid; - nvidias->kaa.Solid = nvidiaSolid; - nvidias->kaa.DoneSolid = nvidiaDoneSolid; - nvidias->kaa.PrepareCopy = nvidiaPrepareCopy; - nvidias->kaa.Copy = nvidiaCopy; - nvidias->kaa.DoneCopy = nvidiaDoneCopy; - - if (ret && !nvidiac->rop) - { - ErrorF ("Failed to map fifo registers\n"); - ret = FALSE; - } - if (ret && !nvidiac->rop->FifoFree.FifoFree) - { - ErrorF ("Fifo appears broken\n"); - ret = FALSE; - } - if (ret && !kaaDrawInit (pScreen, &nvidias->kaa)) - { - ErrorF ("kaaDrawInit failed\n"); - ret = FALSE; - } - - LEAVE (); - return ret; -} - -#define PIX_FORMAT_MONO 0 -#define PIX_FORMAT_PSEUDO_8 2 -#define PIX_FORMAT_TRUE_1555 3 -#define PIX_FORMAT_TRUE_565 4 -#define PIX_FORMAT_TRUE_8888 6 -#define PIX_FORMAT_TRUE_332 7 -#define PIX_FORMAT_GRAY_8 8 -#define PIX_FORMAT_YUV_422 0xb -#define PIX_FORMAT_YUV_444 0xe -#define PIX_FORMAT_TRUE_4444 0xf - -void -nvidiaDrawEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - - ENTER (); - nvidiac->fifo_size = nvidiac->rop->FifoFree.FifoFree; - nvidiac->fifo_free = 0; - kaaMarkSync (pScreen); - LEAVE (); -} - -void -nvidiaDrawDisable (ScreenPtr pScreen) -{ -} - -void -nvidiaDrawFini (ScreenPtr pScreen) -{ -} - diff --git a/hw/kdrive/nvidia/nvidiadraw.h b/hw/kdrive/nvidia/nvidiadraw.h deleted file mode 100644 index bac11c2a6..000000000 --- a/hw/kdrive/nvidia/nvidiadraw.h +++ /dev/null @@ -1,69 +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. - */ - -#ifndef _TRIDENTDRAW_H_ -#define _TRIDENTDRAW_H_ - -#define SetupTrident(s) KdScreenPriv(s); \ - tridentCardInfo(pScreenPriv); \ - Cop *cop = tridentc->cop - -#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) - -#define _tridentInit(cop,tridentc) { \ - if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \ - (cop)->multi = (tridentc)->cop_depth; \ - (cop)->multi = (tridentc)->cop_stride; \ - (cop)->multi = TridentAlpha; \ -} \ - -#define _tridentSetSolidRect(cop,pix,alu,cmd) {\ - cop->multi = COP_MULTI_PATTERN; \ - cop->multi = COP_MULTI_ROP | tridentRop[alu]; \ - cop->fg = (pix); \ - cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ -} - -#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \ - (cop)->dst_start_xy = TRI_XY (x1,y1); \ - (cop)->dst_end_xy = TRI_XY(x2,y2); \ - _tridentWaitDone(cop); \ - (cop)->command = (cmd); \ -} - -#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ - COP_STATUS_DPE_BUSY | \ - COP_STATUS_MI_BUSY) - -#define _tridentWaitDone(cop) { \ - int __q__ = 500000; \ - while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ - ; \ - if (!__q__) \ - (cop)->status = 0; \ -} - -#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop) - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#endif diff --git a/hw/kdrive/nvidia/nvidiastub.c b/hw/kdrive/nvidia/nvidiastub.c deleted file mode 100644 index 0e8250e31..000000000 --- a/hw/kdrive/nvidia/nvidiastub.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "nvidia.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - - if (LinuxFindPci (0x10de, 0x0112, 0, &attr)) - KdCardInfoAdd (&nvidiaFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/nvidia/nvidiavideo.c b/hw/kdrive/nvidia/nvidiavideo.c deleted file mode 100644 index 2ab41edfd..000000000 --- a/hw/kdrive/nvidia/nvidiavideo.c +++ /dev/null @@ -1,1016 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "nvidia.h" - -#include <X11/extensions/Xv.h> -#include "fourcc.h" - -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -static Atom xvBrightness, xvSaturation, xvColorKey; - -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 - -static void -nvidiaStopVideo(KdScreenInfo *screen, pointer data, Bool exit) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; - Reg *reg = nvidiac->reg; - MediaReg *media = nvidiac->media_reg; - - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - - if (!media) - return; - - if(pPortPriv->videoOn) - { - nvidiaWaitIdle (reg); - /* wait for buffer to be displayed */ - while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) - ; - /* wait for buffer to be finished */ - while (((media->TRIG_CNTL >> 6) & 1) != 0) - ; - nvidiaWaitAvail (reg, 1); - media->OVERLAY_SCALE_CNTL = 0; - pPortPriv->videoOn = FALSE; - nvidiaWaitIdle (reg); - } -} - -static int -nvidiaSetPortAttribute(KdScreenInfo *screen, - Atom attribute, - int value, - pointer data) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; - MediaReg *media = nvidiac->media_reg; - - if(attribute == xvBrightness) - { - if(value < -1000) - value = -1000; - if (value > 1000) - value = 1000; - pPortPriv->brightness = value; - } - else if(attribute == xvSaturation) - { - if (value < -1000) - value = -1000; - if (value > 1000) - value = 1000; - pPortPriv->saturation = value; - } - else if(attribute == xvColorKey) - { - if (pPortPriv->colorKey != value) - { - pPortPriv->colorKey = value; - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - } - } - else - return BadMatch; - - return Success; -} - -static int -nvidiaGetPortAttribute(KdScreenInfo *screen, - Atom attribute, - int *value, - pointer data) -{ - NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data; - - if(attribute == xvBrightness) - *value = pPortPriv->brightness; - else if(attribute == xvSaturation) - *value = pPortPriv->saturation; - else if(attribute == xvColorKey) - *value = pPortPriv->colorKey; - else - return BadMatch; - - return Success; -} - -static void -nvidiaQueryBestSize(KdScreenInfo *screen, - Bool motion, - short vid_w, - short vid_h, - short drw_w, - short drw_h, - unsigned int *p_w, - unsigned int *p_h, - pointer data) -{ - *p_w = drw_w; - *p_h = drw_h; -} - - -static void -nvidiaCopyPackedData(KdScreenInfo *screen, - unsigned char *buf, - int randr, - int srcPitch, - int dstPitch, - int srcW, - int srcH, - int top, - int left, - int h, - int w) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; - CARD8 *src, *dst; - int srcDown, srcRight, srcNext; - int p; - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - src = buf; - srcDown = srcPitch; - srcRight = 2; - break; - case RR_Rotate_90: - src = buf + (srcH - 1) * 2; - srcDown = -2; - srcRight = srcPitch; - break; - case RR_Rotate_180: - src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2; - srcDown = -srcPitch; - srcRight = -2; - break; - case RR_Rotate_270: - src = buf + srcPitch * (srcW - 1); - srcDown = 2; - srcRight = -srcPitch; - break; - } - - src = src + top*srcDown + left*srcRight; - - if (pPortPriv->currentBuf == 0) - dst = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf0Offset; - else - dst = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf1Offset; - - w >>= 1; - srcRight >>= 1; - srcNext = srcRight >> 1; - while(h--) - { - CARD16 *s = (CARD16 *) src; - CARD32 *d = (CARD32 *) dst; - p = w; - while (p--) - { - *d++ = s[0] | (s[srcNext] << 16); - s += srcRight; - } - src += srcPitch; - dst += dstPitch; - } -} - -static void -nvidiaCopyPlanarData(KdScreenInfo *screen, - unsigned char *buf, - int randr, - int srcPitch, - int srcPitch2, - int dstPitch, /* of chroma */ - int srcW, - int srcH, - int height, - int top, - int left, - int h, - int w, - int id) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; - int i, j; - CARD8 *src1, *src2, *src3, *dst1; - int srcDown, srcDown2, srcRight, srcRight2, srcNext; - - /* compute source data pointers */ - src1 = buf; - src2 = src1 + height * srcPitch; - src3 = src2 + (height >> 1) * srcPitch2; - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - srcDown = srcPitch; - srcDown2 = srcPitch2; - srcRight = 2; - srcRight2 = 1; - srcNext = 1; - break; - case RR_Rotate_90: - src1 = src1 + srcH - 1; - src2 = src2 + (srcH >> 1) - 1; - src3 = src3 + (srcH >> 1) - 1; - srcDown = -1; - srcDown2 = -1; - srcRight = srcPitch * 2; - srcRight2 = srcPitch2; - srcNext = srcPitch; - break; - case RR_Rotate_180: - src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); - src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - srcDown = -srcPitch; - srcDown2 = -srcPitch2; - srcRight = -2; - srcRight2 = -1; - srcNext = -1; - break; - case RR_Rotate_270: - src1 = src1 + srcPitch * (srcW - 1); - src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); - srcDown = 1; - srcDown2 = 1; - srcRight = -srcPitch * 2; - srcRight2 = -srcPitch2; - srcNext = -srcPitch; - break; - } - - /* adjust for origin */ - src1 += top * srcDown + left * srcNext; - src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - - if (id == FOURCC_I420) - { - CARD8 *srct = src2; - src2 = src3; - src3 = srct; - } - - if (pPortPriv->currentBuf == 0) - dst1 = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf0Offset; - else - dst1 = (CARD8 *) nvidias->vesa.fb + pPortPriv->YBuf1Offset; - - w >>= 1; - for (j = 0; j < h; j++) - { - CARD32 *dst = (CARD32 *) dst1; - CARD8 *s1l = src1; - CARD8 *s1r = src1 + srcNext; - CARD8 *s2 = src2; - CARD8 *s3 = src3; - - for (i = 0; i < w; i++) - { - *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); - s1l += srcRight; - s1r += srcRight; - s2 += srcRight2; - s3 += srcRight2; - } - src1 += srcDown; - dst1 += dstPitch; - if (j & 1) - { - src2 += srcDown2; - src3 += srcDown2; - } - } -} - -static void -nvidiaPaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg) -{ - WindowPtr pRoot = WindowTable[pScreen->myNum]; - GCPtr pGC; - CARD32 val[2]; - xRectangle *rects, *r; - BoxPtr pBox = REGION_RECTS (pRgn); - int nBox = REGION_NUM_RECTS (pRgn); - - rects = xalloc (nBox * sizeof (xRectangle)); - if (!rects) - goto bail0; - r = rects; - while (nBox--) - { - r->x = pBox->x1; - r->y = pBox->y1; - r->width = pBox->x2 - pBox->x1; - r->height = pBox->y2 - pBox->y1; - r++; - pBox++; - } - - pGC = GetScratchGC (pRoot->drawable.depth, pScreen); - if (!pGC) - goto bail1; - - val[0] = fg; - val[1] = IncludeInferiors; - ChangeGC (pGC, GCForeground|GCSubwindowMode, val); - - ValidateGC (&pRoot->drawable, pGC); - - (*pGC->ops->PolyFillRect) (&pRoot->drawable, pGC, - REGION_NUM_RECTS (pRgn), rects); - - FreeScratchGC (pGC); -bail1: - xfree (rects); -bail0: - ; -} - -/* NvidiaClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -static void -NvidiaClipVideo(BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - BoxPtr extents, /* extents of the clip region */ - INT32 width, - INT32 height) -{ - INT32 vscale, hscale, delta; - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } -} - -static void -nvidiaDisplayVideo(KdScreenInfo *screen, - int id, - int dstPitch, /* of chroma for 4:2:0 */ - int x1, - int y1, - int x2, - int y2, - int dst_x1, - int dst_y1, - int dst_x2, - int dst_y2, - short src_w, - short src_h, - short drw_w, - short drw_h) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; - Reg *reg = nvidiac->reg; - MediaReg *media = nvidiac->media_reg; - int xscaleInt, xscaleFract, yscaleInt, yscaleFract; - int xscaleIntUV = 0, xscaleFractUV = 0; - int yscaleIntUV = 0, yscaleFractUV = 0; - int randr = nvidias->vesa.randr; - int HORZ_INC, VERT_INC; - CARD32 SCALER_IN; - CARD32 OVERLAY_SCALE_CNTL; - int tmp; - int left; - int bright; - int sat; - - if (id == FOURCC_UYVY) - SCALER_IN = SCALER_IN_YVYU422; - else - SCALER_IN = SCALER_IN_VYUY422; - - nvidiaWaitAvail (reg, 4); - - media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; - - /* color key */ - media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; - media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey; - /* set key control to obey only graphics color key */ - media->OVERLAY_KEY_CNTL = 0x50; - - nvidiaWaitAvail (reg, 9); - media->CAPTURE_DEBUG = 0; - /* no exclusive video region */ - media->OVERLAY_EXCLUSIVE_HORZ = 0; - media->OVERLAY_EXCLUSIVE_VERT = 0; - /* scaling coefficients */ - media->SCALER_H_COEFF0 = 0x00002000; - media->SCALER_H_COEFF1 = 0x0D06200D; - media->SCALER_H_COEFF2 = 0x0D0A1C0D; - media->SCALER_H_COEFF3 = 0x0C0E1A0C; - media->SCALER_H_COEFF4 = 0x0C14140C; - media->SCALER_TEST = 0; - - nvidiaWaitAvail (reg, 2); - media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | - SCALE_GAMMA_BRIGHT | - SCALE_BANDWIDTH | - SCALE_OVERLAY_EN | - SCALE_EN); - - bright = (pPortPriv->brightness * 64 / 1000); - if (bright < -0x40) - bright = -0x40; - if (bright > 0x3f) - bright = 0x3f; - bright = bright & 0x7f; - sat = ((pPortPriv->saturation * 31 + 31000) / 2000); - if (sat > 0x1f) - sat = 0x1f; - if (sat < 0) - sat = 0; - - media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ - (sat << 8) | /* SATURATION_U */ - (sat << 16) | /* SATURATION_V */ - (0 << 21) | /* SCALER_VERT_ADJ_UV */ - (0 << 28)); /* SCALER_HORZ_ADJ_UV */ - - VERT_INC = (src_h << 12) / drw_h; - HORZ_INC = (src_w << 12) / drw_w; - - nvidiaWaitAvail (reg, 13); - - /* lock registers to prevent non-atomic update */ - media->OVERLAY_Y_X_START = 0x80000000 | NVIDIA_YX (dst_x1, dst_y1); - /* ending screen coordinate */ - media->OVERLAY_Y_X_END = 0x80000000 | NVIDIA_YX (dst_x2, dst_y2); - - media->OVERLAY_SCALE_INC = NVIDIA_YX(HORZ_INC, VERT_INC); - - media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset; - - media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; - - media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; - - media->SCALER_BUF_PITCH = dstPitch >> 1; - media->SCALER_HEIGHT_WIDTH = NVIDIA_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); - - media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28; - - /* set XY location and unlock */ - media->OVERLAY_Y_X_START = NVIDIA_YX (dst_x1, dst_y1); -} - -static int -nvidiaPutImage(KdScreenInfo *screen, - short src_x, - short src_y, - short drw_x, - short drw_y, - short src_w, - short src_h, - short drw_w, - short drw_h, - int id, - unsigned char *buf, - short width, - short height, - Bool sync, - RegionPtr clipBoxes, - pointer data) -{ - KdCardInfo *card = screen->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data; - Reg *reg = nvidiac->reg; - MediaReg *media = nvidiac->media_reg; - INT32 x1, x2, y1, y2; - int randr = nvidias->vesa.randr; - int srcPitch, srcPitch2, dstPitch; - int top, left, npixels, nlines, size; - BoxRec dstBox; - int dst_width = width, dst_height = height; - int rot_x1, rot_y1, rot_x2, rot_y2; - int dst_x1, dst_y1, dst_x2, dst_y2; - int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; - - /* Clip */ - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - NvidiaClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - - if((x1 >= x2) || (y1 >= y2)) - return Success; - - if (!media) - return BadAlloc; - - if (randr & (RR_Rotate_0|RR_Rotate_180)) - { - dst_width = width; - dst_height = height; - rot_src_w = src_w; - rot_src_h = src_h; - rot_drw_w = drw_w; - rot_drw_h = drw_h; - } - else - { - dst_width = height; - dst_height = width; - rot_src_w = src_h; - rot_src_h = src_w; - rot_drw_w = drw_h; - rot_drw_h = drw_w; - } - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - dst_x1 = dstBox.x1; - dst_y1 = dstBox.y1; - dst_x2 = dstBox.x2; - dst_y2 = dstBox.y2; - rot_x1 = x1; - rot_y1 = y1; - rot_x2 = x2; - rot_y2 = y2; - break; - case RR_Rotate_90: - dst_x1 = dstBox.y1; - dst_y1 = screen->height - dstBox.x2; - dst_x2 = dstBox.y2; - dst_y2 = screen->height - dstBox.x1; - - rot_x1 = y1; - rot_y1 = (src_w << 16) - x2; - rot_x2 = y2; - rot_y2 = (src_w << 16) - x1; - break; - case RR_Rotate_180: - dst_x1 = screen->width - dstBox.x2; - dst_y1 = screen->height - dstBox.y2; - dst_x2 = screen->width - dstBox.x1; - dst_y2 = screen->height - dstBox.y1; - rot_x1 = (src_w << 16) - x2; - rot_y1 = (src_h << 16) - y2; - rot_x2 = (src_w << 16) - x1; - rot_y2 = (src_h << 16) - y1; - break; - case RR_Rotate_270: - dst_x1 = screen->width - dstBox.y2; - dst_y1 = dstBox.x1; - dst_x2 = screen->width - dstBox.y1; - dst_y2 = dstBox.x2; - rot_x1 = (src_h << 16) - y2; - rot_y1 = x1; - rot_x2 = (src_h << 16) - y1; - rot_y2 = x2; - break; - } - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width + 3) & ~3; - srcPitch2 = ((width >> 1) + 3) & ~3; - size = dstPitch * (int) dst_height; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width << 1); - size = dstPitch * (int) dst_height; - break; - } - - pPortPriv->offset = nvidias->off_screen - (CARD8 *) nvidias->vesa.fb; - /* fixup pointers */ - - pPortPriv->YBuf0Offset = pPortPriv->offset; - pPortPriv->YBuf1Offset = pPortPriv->offset + size; - -#if 0 - nvidiaWaitIdle (reg); - - if (pPortPriv->videoOn) - { - /* wait for buffer to be displayed */ - while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) - ; - } -#endif - /* - * Use the other buffer - */ - pPortPriv->currentBuf = 1 - pPortPriv->currentBuf; - - /* copy data */ - top = rot_y1 >> 16; - left = (rot_x1 >> 16) & ~1; - npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; - nvidiaCopyPlanarData(screen, buf, randr, - srcPitch, srcPitch2, dstPitch, - rot_src_w, rot_src_h, height, - top, left, nlines, npixels, id); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - nlines = ((rot_y2 + 0xffff) >> 16) - top; - nvidiaCopyPackedData(screen, buf, randr, - srcPitch, dstPitch, - rot_src_w, rot_src_h, - top, left, nlines, - npixels); - break; - } - - nvidiaDisplayVideo(screen, id, dstPitch, - rot_x1, rot_y1, rot_x2, rot_y2, - dst_x1, dst_y1, - dst_x2, dst_y2, - rot_src_w, rot_src_h, rot_drw_w, rot_drw_h); - - /* update cliplist */ - if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) - { - REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - nvidiaPaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); - } - - pPortPriv->videoOn = TRUE; - - return Success; -} - -static int -nvidiaQueryImageAttributes(KdScreenInfo *screen, - int id, - unsigned short *w, - unsigned short *h, - int *pitches, - int *offsets) -{ - int size, tmp; - - if(*w > IMAGE_MAX_WIDTH) - *w = IMAGE_MAX_WIDTH; - if(*h > IMAGE_MAX_HEIGHT) - *h = IMAGE_MAX_HEIGHT; - - *w = (*w + 1) & ~1; - if(offsets) offsets[0] = 0; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if(pitches) - pitches[0] = size; - size *= *h; - if(offsets) - offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if(pitches) - pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if(offsets) - offsets[2] = size; - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) - pitches[0] = size; - size *= *h; - break; - } - - return size; -} - - -/* client libraries expect an encoding */ -static KdVideoEncodingRec DummyEncoding[1] = -{ - { - 0, - "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, - {1, 1} - } -}; - -#define NUM_FORMATS 3 - -static KdVideoFormatRec Formats[NUM_FORMATS] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; - -#define NUM_ATTRIBUTES 3 - -static KdAttributeRec Attributes[NUM_ATTRIBUTES] = -{ - {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, - {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} -}; - -#define NUM_IMAGES 4 - -static KdImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY -}; - -static void nvidiaResetVideo(KdScreenInfo *screen) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - NvidiaPortPrivPtr pPortPriv = nvidias->pAdaptor->pPortPrivates[0].ptr; - MediaReg *media = nvidiac->media_reg; - - /* - * Default to maximum image size in YV12 - */ - -} - -static int -nvidiaReputImage (KdScreenInfo *screen, - short drw_x, - short drw_y, - RegionPtr clipBoxes, - pointer data) -{ - ScreenPtr pScreen = screen->pScreen; - NvidiaPortPrivPtr pPortPriv = (NvidiaPortPrivPtr)data; - BoxPtr pOldExtents = REGION_EXTENTS (pScreen, &pPortPriv->clip); - BoxPtr pNewExtents = REGION_EXTENTS (pScreen, clipBoxes); - - if (pOldExtents->x1 == pNewExtents->x1 && - pOldExtents->x2 == pNewExtents->x2 && - pOldExtents->y1 == pNewExtents->y1 && - pOldExtents->y2 == pNewExtents->y2) - { - /* update cliplist */ - if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) - { - REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - nvidiaPaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); - } - return Success; - } - return BadMatch; -} - -static KdVideoAdaptorPtr -nvidiaSetupImageVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - nvidiaCardInfo(pScreenPriv); - nvidiaScreenInfo(pScreenPriv); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = pScreenPriv->card; - KdVideoAdaptorPtr adapt; - NvidiaPortPrivPtr pPortPriv; - - if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + - sizeof(NvidiaPortPrivRec) + - sizeof(DevUnion)))) - return NULL; - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "Nvidia Video Overlay"; - adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = 1; - adapt->pPortPrivates = (DevUnion*)(&adapt[1]); - - pPortPriv = (NvidiaPortPrivPtr)(&adapt->pPortPrivates[1]); - - adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv); - adapt->pAttributes = Attributes; - adapt->nImages = NUM_IMAGES; - adapt->nAttributes = NUM_ATTRIBUTES; - adapt->pImages = Images; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = nvidiaStopVideo; - adapt->SetPortAttribute = nvidiaSetPortAttribute; - adapt->GetPortAttribute = nvidiaGetPortAttribute; - adapt->QueryBestSize = nvidiaQueryBestSize; - adapt->PutImage = nvidiaPutImage; - adapt->ReputImage = nvidiaReputImage; - adapt->QueryImageAttributes = nvidiaQueryImageAttributes; - - pPortPriv->colorKey = nvidias->colorKey; - pPortPriv->videoOn = FALSE; - pPortPriv->brightness = 0; - pPortPriv->saturation = 0; - pPortPriv->currentBuf = 0; - - /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); - - nvidias->pAdaptor = adapt; - - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvSaturation = MAKE_ATOM("XV_SATURATION"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - - nvidiaResetVideo(screen); - - return adapt; -} - -Bool nvidiaInitVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; - KdVideoAdaptorPtr newAdaptor = NULL; - int num_adaptors; - KdCardInfo *card = pScreenPriv->card; - NvidiaScreenInfo *nvidias = (NvidiaScreenInfo *) screen->driver; - NvidiaCardInfo *nvidiac = (NvidiaCardInfo *) card->driver; - - if (!nvidiac->media_reg) - return FALSE; - - newAdaptor = nvidiaSetupImageVideo(pScreen); - - num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); - - if(newAdaptor) - { - if(!num_adaptors) - { - num_adaptors = 1; - adaptors = &newAdaptor; - } - else - { - newAdaptors = xalloc((num_adaptors + 1) * - sizeof(KdVideoAdaptorPtr*)); - if(newAdaptors) - { - memcpy(newAdaptors, adaptors, - num_adaptors * sizeof(KdVideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } - } - - if(num_adaptors) - KdXVScreenInit(pScreen, adaptors, num_adaptors); - - if(newAdaptors) - xfree(newAdaptors); - return TRUE; -} diff --git a/hw/kdrive/pcmcia/modes.h b/hw/kdrive/pcmcia/modes.h deleted file mode 100644 index 0a078736f..000000000 --- a/hw/kdrive/pcmcia/modes.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ - -#define V_NHSYNC 0x01 -#define V_NVSYNC 0x02 -#define V_PHSYNC 0x04 -#define V_PVSYNC 0x08 -#define V_INTERLACE 0x10 - -pcmciaDisplayModeRec pcmciaDefaultModes [] = { -/* 640x400 @ 70Hz (VGA) hsync: 37.9kHz */ - {640, 400, 70 ,31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC}, -/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */ - {640, 480, 60 ,25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC}, -/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */ - {640, 480, 72 ,31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC}, -/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */ - {640, 480, 75 ,31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC}, -/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */ - {640, 480, 85 ,36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC}, -/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */ - {800, 600, 56 ,36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */ - {800, 600, 60 ,40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */ - {800, 600, 72 ,50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */ - {800, 600, 75 ,49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC}, -/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */ - {800, 600, 85 ,56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC}, -/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */ - {1024, 768, 43 ,44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE}, -/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */ - {1024, 768, 60 ,65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC}, -/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */ - {1024, 768, 70 ,75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC}, -/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */ - {1024, 768, 75 ,78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC}, -/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */ - {1024, 768, 85 ,94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC}, -/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */ - {1152, 864, 75 ,108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -}; diff --git a/hw/kdrive/pcmcia/pcmcia.c b/hw/kdrive/pcmcia/pcmcia.c deleted file mode 100644 index a1728c783..000000000 --- a/hw/kdrive/pcmcia/pcmcia.c +++ /dev/null @@ -1,1199 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * A driver for the following PCMCIA cards... - * Hewlett Packards HP VGA Out (Model F1252A) - * Colorgraphics Voyager VGA - * - * Tested running under a Compaq IPAQ Pocket PC running Linux - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "pcmcia.h" -#define extern -#include <asm/io.h> -#undef extern - -#define CLOCK 14318 /* KHz */ -#define CLK_N(a,b) (a & 0xff) -#define CLK_M(a,b) ((b) & 0x3f) -#define CLK_K(a,b) (((b) >> 6) & 3) -#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b))) - -extern void -tridentUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); -extern void -cirrusUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); - -static Bool -tridentSetCLK(int clock, CARD8 *a, CARD8 *b); - -static Bool -CirrusFindClock(int freq, int *num_out, int *den_out); - -Bool -pcmciaCardInit (KdCardInfo *card) -{ - pcmciaCardInfo *pcmciac; - CARD8 r9; - - pcmciac = (pcmciaCardInfo *) xalloc (sizeof (pcmciaCardInfo)); - if (!pcmciac) - return FALSE; - - pcmciac->cop_base = (CARD8 *) KdMapDevice (PCMCIA_COP_BASE(card), - PCMCIA_COP_SIZE(card)); - - r9 = pcmciaReadIndex (pcmciac, 0x3c4, 0x09); - /* - * Crude detection.... - * The trident chip has a read only register at 0x09, which returns 0x4. - * If it's not that, we assume the cirrus chip. - * BREAKAGE.! If we have an anonymous PCMCIA card inserted, we could - * potentially smash something here. FIXME ! - */ - if (r9 == 0x04) { - ErrorF("PCMCIA: Found HP VGA card\n"); - pcmciac->HP = TRUE; /* Select HP VGA Out Card */ - } else { - ErrorF("PCMCIA: Found Voyager VGA card\n"); - pcmciac->HP = FALSE; /* Select Voyager VGA Card */ - } - - if (pcmciac->HP) { - /* needed by the accelerator - later */ - pcmciac->cop = (Cop *) (pcmciac->cop_base + TRIDENT_COP_OFF(card)); - } - - /* - * Map frame buffer - */ - if (pcmciac->HP) - pcmciac->fb = KdMapDevice (0x2ce00000, 0x80000); - else - pcmciac->fb = KdMapDevice (0x2c0a0000, 0x10000); /*64K bank switched*/ - - if (!pcmciac->fb) - return FALSE; - - pcmciac->window = 0; - - card->driver = pcmciac; - - return TRUE; -} - -Bool -pcmciaModeSupported (KdScreenInfo *screen, - const KdMonitorTiming *t) -{ - KdCardInfo *card = screen->card; - pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver; - - if (pcmciac->HP) - { - CARD8 a, b; - if (!tridentSetCLK (t->clock, &a, &b)) - return FALSE; - } - else - { - int a, b; - if (!CirrusFindClock (t->clock, &a, &b)) - return FALSE; - } - - /* width must be a multiple of 16 */ - if (t->horizontal & 0xf) - return FALSE; - return TRUE; -} - -Bool -pcmciaModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - pcmciaCardInfo *pcmciac = (pcmciaCardInfo *) card->driver; - int screen_size; - int pixel_width; - int byte_width; - int fb; - - if (screen->fb[0].depth == 8) - screen->fb[0].bitsPerPixel = 8; - else if (screen->fb[0].depth == 15 || screen->fb[0].depth == 16) - screen->fb[0].bitsPerPixel = 16; - else - return FALSE; - - screen_size = 0; - screen->fb[0].pixelStride = screen->width; - screen->fb[0].byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3); - screen->fb[0].frameBuffer = pcmciac->fb; - screen_size = screen->fb[0].byteStride * screen->height; - - return screen_size <= pcmciac->memory; -} - -Bool -pcmciaScreenInit (KdScreenInfo *screen) -{ - pcmciaCardInfo *pcmciac = screen->card->driver; - pcmciaScreenInfo *pcmcias; - int screen_size, memory; - int i; - const KdMonitorTiming *t; - - pcmcias = (pcmciaScreenInfo *) xalloc (sizeof (pcmciaScreenInfo)); - if (!pcmcias) - return FALSE; - memset (pcmcias, '\0', sizeof (pcmciaScreenInfo)); - - /* if (!pcmciac->cop) */ - screen->dumb = TRUE; - - if (screen->fb[0].depth < 8) - screen->fb[0].depth = 8; - - /* default to 16bpp */ - if (!screen->fb[0].depth) - screen->fb[0].depth = 16; - - /* default to 60Hz refresh */ - if (!screen->width || !screen->height) - { - screen->width = 640; - screen->height = 400; - screen->rate = 60; - } - - pcmciac->memory = 512 * 1024; - if (pcmciac->HP && !screen->softCursor && screen->fb[0].depth == 8) - { - /* ack, bail on the HW cursor for everything -- no ARGB falback */ - pcmcias->cursor_base = 0; -#if 0 - /* Let's do hw cursor for the HP card, only in 8bit mode though */ - pcmcias->cursor_base = pcmcias->screen + pcmciac->memory - 4096; - pcmciac->memory -= 4096; -#endif - } - - pcmcias->screen = pcmciac->fb; - screen->driver = pcmcias; - - t = KdFindMode (screen, pcmciaModeSupported); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - pcmcias->randr = screen->randr; - - if (!KdTuneMode (screen, pcmciaModeUsable, pcmciaModeSupported)) - { - xfree (pcmcias); - return FALSE; - } - - switch (screen->fb[0].depth) { - case 4: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 8: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 15: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x03e0; - screen->fb[0].redMask = 0x7c00; - break; - case 16: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x07e0; - screen->fb[0].redMask = 0xf800; - break; - } - - return TRUE; -} - -void * -tridentWindowLinear (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - if (!pScreenPriv->enabled) - return 0; - - *size = pScreenPriv->screen->fb[0].byteStride; - return (CARD8 *) pcmciac->fb + row * pScreenPriv->screen->fb[0].byteStride + offset; -} - -void * -cirrusWindowWindowed (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - int bank, boffset; - - if (!pScreenPriv->enabled) - return 0; - - bank = (row * pScreenPriv->screen->fb[0].byteStride) / 0x1000; - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0B, 0x0c); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x09, bank); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0A, bank); - *size = pScreenPriv->screen->fb[0].byteStride; - return (CARD8 *) pcmciac->fb + (row * pScreenPriv->screen->fb[0].byteStride) - (bank * 0x1000) + offset; -} - -LayerPtr -pcmciaLayerCreate (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - ShadowUpdateProc update; - ShadowWindowProc window; - PixmapPtr pPixmap; - int kind; - - if (pcmciac->HP) { - window = tridentWindowLinear; - if (pcmcias->randr == RR_Rotate_0) - update = tridentUpdatePacked; - else - update = pcmciaUpdateRotatePacked; - } else { - window = cirrusWindowWindowed; - if (pcmcias->randr == RR_Rotate_0) - update = cirrusUpdatePacked; - else - update = pcmciaUpdateRotatePacked; - } - - if (!update) - abort (); - - kind = LAYER_SHADOW; - pPixmap = 0; - - return LayerCreate (pScreen, kind, screen->fb[0].depth, - pPixmap, update, window, pcmcias->randr, 0); -} - -void -pcmciaConfigureScreen (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - FbdevPriv *priv = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; - KdMouseMatrix m; - - KdComputeMouseMatrix (&m, pcmcias->randr, - screen->width, screen->height); - - if (m.matrix[0][0]) - { - pScreen->width = screen->width; - pScreen->height = screen->height; - pScreen->mmWidth = screen->width_mm; - pScreen->mmHeight = screen->height_mm; - } - else - { - pScreen->width = screen->height; - pScreen->height = screen->width; - pScreen->mmWidth = screen->height_mm; - pScreen->mmHeight = screen->width_mm; - } - KdSetMouseMatrix (&m); -} - -#ifdef RANDR - -Bool -pcmciaRandRSupported (ScreenPtr pScreen, - const KdMonitorTiming *t) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - KdScreenInfo *screen = pScreenPriv->screen; - int screen_size; - int byteStride; - - /* Make sure the clock is supported */ - if (!pcmciaModeSupported (screen, t)) - return FALSE; - /* Check for sufficient memory */ - byteStride = screen->width * (screen->fb[0].bitsPerPixel >>3); - screen_size = byteStride * screen->height; - - return screen_size <= pcmciac->memory; -} - -Bool -pcmciaRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - KdScreenPriv(pScreen); - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - - *rotations = (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270| - RR_Reflect_X|RR_Reflect_Y); - - return KdRandRGetInfo (pScreen, pcmcias->randr, pcmciaRandRSupported); -} - -int -pcmciaLayerAdd (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - if (!LayerWindowAdd (pScreen, pLayer, pWin)) - return WT_STOPWALKING; - - return WT_WALKCHILDREN; -} - -int -pcmciaLayerRemove (WindowPtr pWin, pointer value) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - LayerPtr pLayer = (LayerPtr) value; - - LayerWindowRemove (pScreen, pLayer, pWin); - - return WT_WALKCHILDREN; -} - -pcmciaRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - FbdevPriv *priv = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - Bool wasEnabled = pScreenPriv->enabled; - int newwidth, newheight; - LayerPtr pNewLayer; - int kind; - int oldrandr = pcmcias->randr; - PixmapPtr pPixmap; - const KdMonitorTiming *t; - - randr = KdAddRotation (screen->randr, randr); - - t = KdRandRGetTiming (pScreen, pcmciaRandRSupported, rate, pSize); - - if (wasEnabled) - KdDisableScreen (pScreen); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - pcmcias->randr = randr; - pcmciaConfigureScreen (pScreen); - - pNewLayer = pcmciaLayerCreate (pScreen); - - if (!pNewLayer) - { - pcmcias->randr = oldrandr; - pcmciaConfigureScreen (pScreen); - if (wasEnabled) - KdEnableScreen (pScreen); - return FALSE; - } - - if (WalkTree (pScreen, pcmciaLayerAdd, (pointer) pNewLayer) == WT_STOPWALKING) - { - WalkTree (pScreen, pcmciaLayerRemove, (pointer) pNewLayer); - LayerDestroy (pScreen, pNewLayer); - pcmcias->randr = oldrandr; - pcmciaConfigureScreen (pScreen); - if (wasEnabled) - KdEnableScreen (pScreen); - return FALSE; - } - WalkTree (pScreen, pcmciaLayerRemove, (pointer) pcmcias->pLayer); - LayerDestroy (pScreen, pcmcias->pLayer); - pcmcias->pLayer = pNewLayer; - if (wasEnabled) - KdEnableScreen (pScreen); - return TRUE; -} - -Bool -pcmciaRandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit (pScreen)) - return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = pcmciaRandRGetInfo; - pScrPriv->rrSetConfig = pcmciaRandRSetConfig; - return TRUE; -} -#endif - -Bool -pcmciaInitScreen (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - FbdevPriv *priv = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) pScreenPriv->screen->driver; - - if (!LayerStartInit (pScreen)) - return FALSE; - if (!LayerFinishInit (pScreen)) - return FALSE; - - pcmciaConfigureScreen (pScreen); - - pcmcias->pLayer = pcmciaLayerCreate (pScreen); - if (!pcmcias->pLayer) - return FALSE; -#ifdef RANDR - if (!pcmciaRandRInit (pScreen)) - return FALSE; -#endif - return TRUE; -} - -CARD8 -pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index) -{ - CARD8 value; - - pcmciac->cop_base[port] = index; - value = pcmciac->cop_base[port+1]; - return value; -} - -void -pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value) -{ - pcmciac->cop_base[port] = index; - pcmciac->cop_base[port+1] = value; -} - -CARD8 -pcmciaReadReg (pcmciaCardInfo *pcmciac, CARD16 port) -{ - CARD8 value; - - value = pcmciac->cop_base[port]; - - return value; -} - -void -pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value) -{ - pcmciac->cop_base[port] = value; -} - - -void -pcmciaPause () -{ - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = 50 * 1000; - select (1, 0, 0, 0, &tv); -} - -void -pcmciaPreserve (KdCardInfo *card) -{ -} - -/* CLOCK_FACTOR is double the osc freq in kHz (osc = 14.31818 MHz) */ -#define CLOCK_FACTOR 28636 - -/* stability constraints for internal VCO -- MAX_VCO also determines the maximum Video pixel clock */ -#define MIN_VCO CLOCK_FACTOR -#define MAX_VCO 111000 - -/* clock in kHz is (numer * CLOCK_FACTOR / (denom & 0x3E)) >> (denom & 1) */ -#define VCOVAL(n, d) \ - ((((n) & 0x7F) * CLOCK_FACTOR / ((d) & 0x3E)) ) - -#define CLOCKVAL(n, d) \ - (VCOVAL(n, d) >> ((d) & 1)) - -static Bool -CirrusFindClock(int freq, int *num_out, int *den_out) -{ - int n; - int num = 0, den = 0; - int mindiff; - - /* - * If max_clock is greater than the MAX_VCO default, ignore - * MAX_VCO. On the other hand, if MAX_VCO is higher than max_clock, - * make use of the higher MAX_VCO value. - */ - - mindiff = freq; - for (n = 0x10; n < 0x7f; n++) { - int d; - for (d = 0x14; d < 0x3f; d++) { - int c, diff; - /* Avoid combinations that can be unstable. */ - if ((VCOVAL(n, d) < MIN_VCO) || (VCOVAL(n, d) > MAX_VCO)) - continue; - c = CLOCKVAL(n, d); - diff = abs(c - freq); - if (diff < mindiff) { - mindiff = diff; - num = n; - den = d; - } - } - } - if (n == 0x80) - return FALSE; - - *num_out = num; - *den_out = den; - - return TRUE; -} - - -static Bool -tridentSetCLK(int clock, CARD8 *a, CARD8 *b) -{ - int powerup[4] = { 1,2,4,8 }; - int clock_diff = 750; - int freq, ffreq; - int m, n, k; - int p, q, r, s; - int startn, endn; - int endm, endk; - - p = q = r = s = 0; - - startn = 0; - endn = 121; - endm = 31; - endk = 1; - - freq = clock; - - for (k=0;k<=endk;k++) - for (n=startn;n<=endn;n++) - for (m=1;m<=endm;m++) - { - ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) )); - if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) - { - clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; - p = n; q = m; r = k; s = ffreq; - } - } - -#if 0 - ErrorF ("ffreq %d clock %d\n", s, clock); -#endif - if (s == 0) - return FALSE; - - /* N is first 7bits, first M bit is 8th bit */ - *a = ((1 & q) << 7) | p; - /* first 4bits are rest of M, 1bit for K value */ - *b = (((q & 0xFE) >> 1) | (r << 4)); - return TRUE; -} - -Bool -pcmciaEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; - int i,j; - unsigned char Sequencer[6]; - unsigned char CRTC[31]; - unsigned char Graphics[9]; - unsigned char Attribute[21]; - unsigned char MiscOutReg; - const KdMonitorTiming *t; - int hactive, hblank, hfp, hbp; - int vactive, vblank, vfp, vbp; - - int h_active; - int h_total; - int h_display_end; - int h_sync_start; - int h_sync_end; - int h_skew = 0; - - int v_active; - int v_total; - int v_sync_start; - int v_sync_end; - int v_skew = 0; - - t = KdFindMode (screen, pcmciaModeSupported); - - hactive = t->horizontal; - hfp = t->hfp; - hbp = t->hbp; - hblank = t->hblank; - - h_active = hactive; - h_sync_start = hactive + hfp; - h_sync_end = hactive + hblank - hbp; - h_total = hactive + hblank; - - vactive = t->vertical; - vfp = t->vfp; - vbp = t->vbp; - vblank = t->vblank; - - v_active = vactive; - v_sync_start = vactive + vfp; - v_sync_end = vactive + vblank - vbp; - v_total = vactive + vblank; - - /* - * compute correct Hsync & Vsync polarity - */ - - MiscOutReg = 0x23; - if (t->hpol == KdSyncNegative) - MiscOutReg |= 0x40; - if (t->vpol == KdSyncNegative) - MiscOutReg |= 0x80; - - /* - * Time Sequencer - */ - if (pScreenPriv->screen->fb[0].depth == 4) - Sequencer[0] = 0x02; - else - Sequencer[0] = 0x00; - Sequencer[1] = 0x01; - Sequencer[2] = 0x0F; - Sequencer[3] = 0x00; /* Font select */ - if (pScreenPriv->screen->fb[0].depth < 8) - Sequencer[4] = 0x06; /* Misc */ - else - Sequencer[4] = 0x0E; /* Misc */ - Sequencer[5] = 0x00; - - /* - * CRTC Controller - */ - CRTC[0] = ((h_total) >> 3) - 5; - CRTC[1] = (hactive >> 3) - 1; - CRTC[2] = ((min(h_sync_start,h_active)) >> 3) - 1; - CRTC[3] = ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F) | 0x80; - i = (((h_skew << 2) + 0x10) & ~0x1F); - if (i < 0x80) - CRTC[3] |= i; - CRTC[4] = (h_sync_start >> 3); - CRTC[5] = (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2) - | (((h_sync_end >> 3)) & 0x1F); - - CRTC[6] = (v_total - 2) & 0xFF; - CRTC[7] = (((v_total - 2) & 0x100) >> 8) - | (((v_active - 1) & 0x100) >> 7) - | ((v_sync_start & 0x100) >> 6) - | ((((min(v_sync_start,v_active)) - 1) & 0x100) >> 5) - | 0x10 - | (((v_total - 2) & 0x200) >> 4) - | (((v_active - 1) & 0x200) >> 3) - | ((v_sync_start & 0x200) >> 2); - CRTC[8] = 0x00; - CRTC[9] = ((((min(v_sync_start,v_active))-1) & 0x200) >> 4) | 0x40; - CRTC[10] = 0x00; - CRTC[11] = 0x00; - CRTC[12] = 0x00; - CRTC[13] = 0x00; - CRTC[14] = 0x00; - CRTC[15] = 0x00; - CRTC[16] = v_sync_start & 0xFF; - CRTC[17] = (v_sync_end & 0x0F) | 0x20; - CRTC[18] = (v_active - 1) & 0xFF; - if (pScreenPriv->screen->fb[0].depth == 4) - CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 4; - else - if (pScreenPriv->screen->fb[0].depth == 8) - CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 3; - else - if (pScreenPriv->screen->fb[0].depth == 16 || - pScreenPriv->screen->fb[0].depth == 15) - CRTC[19] = pScreenPriv->screen->fb[0].pixelStride >> 2; - CRTC[20] = 0x00; - CRTC[21] = ((min(v_sync_end,v_active)) - 1) & 0xFF; - CRTC[22] = ((min(v_sync_end,v_active)) - 1) & 0xFF; - if (pScreenPriv->screen->fb[0].depth < 8) - CRTC[23] = 0xE3; - else - CRTC[23] = 0xC3; - CRTC[24] = 0xFF; - CRTC[25] = 0x00; - CRTC[26] = 0x00; -#if 0 - if (!pcmciac->HP) - if (mode.Flags & V_INTERLACE) CRTC[26] |= 0x01; -#endif - if (pcmciac->HP) - CRTC[27] = 0x00; - else - CRTC[27] = 0x22; - CRTC[28] = 0x00; - CRTC[29] = 0x00; - CRTC[30] = 0x80; -#if 0 - if (pcmciac->HP) - if (mode.Flags & V_INTERLACE) CRTC[30] |= 0x04; -#endif - -{ - int nExtBits = 0; - CARD32 ExtBits; - CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6; - - CRTC[3] = (CRTC[3] & ~0x1F) - | ((((min(h_sync_end,h_total)) >> 3) - 1) & 0x1F); - CRTC[5] = (CRTC[5] & ~0x80) - | (((((min(h_sync_end,h_total)) >> 3) - 1) & 0x20) << 2); - ExtBits = (((min(h_sync_end,h_total)) >> 3) - 1) & ExtBitMask; - - /* First the horizontal case */ - if ((((min(h_sync_end,h_total)) >> 3) == (h_total >> 3))) - { - int i = (CRTC[3] & 0x1F) - | ((CRTC[5] & 0x80) >> 2) - | ExtBits; - if ((i-- > ((((min(h_sync_start,h_active)) >> 3) - 1) - & (0x3F | ExtBitMask))) - && ((min(h_sync_end,h_total)) == h_total)) - i = 0; - CRTC[3] = (CRTC[3] & ~0x1F) | (i & 0x1F); - CRTC[5] = (CRTC[5] & ~0x80) | ((i << 2) & 0x80); - ExtBits = i & ExtBitMask; - } -} -{ - CARD32 ExtBits; - CARD32 ExtBitMask = 0; - /* If width is not known nBits should be 0. In this - * case BitMask is set to 0 so we can check for it. */ - CARD32 BitMask = 0; - int VBlankStart = ((min(v_sync_start,v_active)) - 1) & 0xFF; - CRTC[22] = ((min(v_sync_end,v_total)) - 1) & 0xFF; - ExtBits = ((min(v_sync_end,v_total)) - 1) & ExtBitMask; - - if ((min(v_sync_end,v_total)) == v_total) - /* Null top overscan */ - { - int i = CRTC[22] | ExtBits; - if (((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) - || ((i > VBlankStart) && /* 8-bit case */ - ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */ - !(CRTC[9] & 0x9F)) /* 1 scanline/row */ - i = 0; - else - i = (i - 1); - CRTC[22] = i & 0xFF; - ExtBits = i & 0xFF00; - } -} - - /* - * Graphics Display Controller - */ - Graphics[0] = 0x00; - Graphics[1] = 0x00; - Graphics[2] = 0x00; - Graphics[3] = 0x00; - Graphics[4] = 0x00; - if (pScreenPriv->screen->fb[0].depth == 4) - Graphics[5] = 0x02; - else - Graphics[5] = 0x40; - Graphics[6] = 0x05; /* only map 64k VGA memory !!!! */ - Graphics[7] = 0x0F; - Graphics[8] = 0xFF; - - Attribute[0] = 0x00; /* standard colormap translation */ - Attribute[1] = 0x01; - Attribute[2] = 0x02; - Attribute[3] = 0x03; - Attribute[4] = 0x04; - Attribute[5] = 0x05; - Attribute[6] = 0x06; - Attribute[7] = 0x07; - Attribute[8] = 0x08; - Attribute[9] = 0x09; - Attribute[10] = 0x0A; - Attribute[11] = 0x0B; - Attribute[12] = 0x0C; - Attribute[13] = 0x0D; - Attribute[14] = 0x0E; - Attribute[15] = 0x0F; - if (pScreenPriv->screen->fb[0].depth == 4) - Attribute[16] = 0x81; - else - Attribute[16] = 0x41; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) - Attribute[17] = 0x00; - else - Attribute[17] = 0xFF; - Attribute[18] = 0x0F; - Attribute[19] = 0x00; - Attribute[20] = 0x00; - - /* Wake up the card */ - if (pcmciac->HP) { - pcmciaWriteReg(pcmciac, 0x3c3, 0x1); - pcmciaWriteReg(pcmciac, 0x46e8, 0x10); - } else { - pcmciaWriteReg(pcmciac, 0x105, 0x1); - pcmciaWriteReg(pcmciac, 0x46e8, 0x1f); - pcmciaWriteReg(pcmciac, 0x102, 0x1); - pcmciaWriteReg(pcmciac, 0x46e8, 0xf); - pcmciaWriteReg(pcmciac, 0x3c3, 0x1); - } - - if (pcmciac->HP) { - /* unlock */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x11, 0x92); - j = pcmciaReadIndex(pcmciac, 0x3c4, 0xb); - pcmciaWriteIndex(pcmciac, 0x3c4, 0xe, 0xc2); - - /* switch on dac */ - pcmciaWriteIndex(pcmciac, 0x3d4, 0x29, 0x24); - /* switch on the accelerator */ - pcmciaWriteIndex(pcmciac, 0x3d4, 0x36, 0x80); - - /* bump up memory clk */ - pcmciaWriteReg(pcmciac, 0x43c6, 0x65); - pcmciaWriteReg(pcmciac, 0x43c7, 0x00); - } else { - /* unlock */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x06, 0x12); - pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg); - } - - /* synchronous reset */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0); - - pcmciaWriteReg(pcmciac, 0x3da, 0x10); - - for (i=0;i<6;i++) - pcmciaWriteIndex(pcmciac, 0x3c4, i, Sequencer[i]); - - if (pcmciac->HP) { - /* Stick chip into color mode */ - pcmciaWriteIndex(pcmciac, 0x3ce, 0x2f, 0x06); - /* Switch on Linear addressing */ - pcmciaWriteIndex(pcmciac, 0x3d4, 0x21, 0x2e); - } else { - /* Stick chip into 8bit access mode - ugh! */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x0F, 0x20); /* 0x26 ? */ - /* reset mclk */ - pcmciaWriteIndex(pcmciac, 0x3c4, 0x1F, 0); - } - - pcmciaWriteIndex(pcmciac, 0x3c4, 0, 0x3); - - for (i=0;i<31;i++) - pcmciaWriteIndex(pcmciac, 0x3d4, i, CRTC[i]); - - for (i=0;i<9;i++) - pcmciaWriteIndex(pcmciac, 0x3ce, i, Graphics[i]); - - j = pcmciaReadReg(pcmciac, 0x3da); - - for (i=0;i<21;i++) { - pcmciaWriteReg(pcmciac, 0x3c0, i); - pcmciaWriteReg(pcmciac, 0x3c0, Attribute[i]); - } - - j = pcmciaReadReg(pcmciac, 0x3da); - pcmciaWriteReg(pcmciac, 0x3c0, 0x20); - - j = pcmciaReadReg(pcmciac, 0x3c8); - j = pcmciaReadReg(pcmciac, 0x3c6); - j = pcmciaReadReg(pcmciac, 0x3c6); - j = pcmciaReadReg(pcmciac, 0x3c6); - j = pcmciaReadReg(pcmciac, 0x3c6); - switch (pScreenPriv->screen->fb[0].depth) { - /* This is here for completeness, when/if we ever do 4bpp */ - case 4: - pcmciaWriteReg(pcmciac, 0x3c6, 0x0); - if (pcmciac->HP) { - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x90); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00); - } else - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x00); - break; - case 8: - pcmciaWriteReg(pcmciac, 0x3c6, 0x0); - if (pcmciac->HP) { - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x92); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x00); - } else - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x01); - break; - case 15: - if (pcmciac->HP) { - pcmciaWriteReg(pcmciac, 0x3c6, 0x10); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04); - } else { - pcmciaWriteReg(pcmciac, 0x3c6, 0xC0); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03); - } - break; - case 16: - if (pcmciac->HP) { - pcmciaWriteReg(pcmciac, 0x3c6, 0x30); - pcmciaWriteIndex(pcmciac, 0x3ce, 0x0f, 0x9a); - pcmciaWriteIndex(pcmciac, 0x3d4, 0x38, 0x04); - } else { - pcmciaWriteReg(pcmciac, 0x3c6, 0xC1); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x07, 0x03); - } - break; - } - j = pcmciaReadReg(pcmciac, 0x3c8); - - pcmciaWriteReg(pcmciac, 0x3c6, 0xff); - - for (i=0;i<256;i++) { - pcmciaWriteReg(pcmciac, 0x3c8, i); - pcmciaWriteReg(pcmciac, 0x3c9, i); - pcmciaWriteReg(pcmciac, 0x3c9, i); - pcmciaWriteReg(pcmciac, 0x3c9, i); - } - - /* Set the Clock */ - if (pcmciac->HP) { - CARD8 a,b; - int clock = t->clock; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) - clock *= 2; - tridentSetCLK(clock, &a, &b); - pcmciaWriteReg(pcmciac, 0x43c8, a); - pcmciaWriteReg(pcmciac, 0x43c9, b); - } else { - int num, den; - unsigned char tmp; - int clock = t->clock; - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) - clock *= 2; - - CirrusFindClock(clock, &num, &den); - - tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x0d); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x0d, (tmp & 0x80) | num); - tmp = pcmciaReadIndex(pcmciac, 0x3c4, 0x1d); - pcmciaWriteIndex(pcmciac, 0x3c4, 0x1d, (tmp & 0xc0) | den); - } - pcmciaWriteReg(pcmciac, 0x3c2, MiscOutReg | 0x08); - -#if 1 - for (i=1;i<0x3f;i++) - ErrorF("0x3c4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3c4, i)); - - ErrorF("\n"); - - for (i=0;i<0x3f;i++) - ErrorF("0x3ce:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3ce, i)); - - ErrorF("\n"); - - for (i=0;i<0x3f;i++) - ErrorF("0x3d4:%02x: 0x%x\n",i,pcmciaReadIndex(pcmciac, 0x3d4, i)); -#endif - - return TRUE; -} - -void -pcmciaDisable (ScreenPtr pScreen) -{ -} - -const CARD8 tridentDPMSModes[4] = { - 0x00, /* KD_DPMS_NORMAL */ - 0x01, /* KD_DPMS_STANDBY */ - 0x02, /* KD_DPMS_SUSPEND */ - 0x03, /* KD_DPMS_POWERDOWN */ -}; - -Bool -pcmciaDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - if (pcmciac->HP) { - pcmciaWriteIndex (pcmciac, 0x3ce, 0x23, tridentDPMSModes[mode]); - pcmciaPause (); - } else { - /* Voyager */ - } - - return TRUE; -} - -void -pcmciaRestore (KdCardInfo *card) -{ -} - -void -pcmciaScreenFini (KdScreenInfo *screen) -{ - pcmciaScreenInfo *pcmcias = (pcmciaScreenInfo *) screen->driver; - - xfree (pcmcias); - screen->driver = 0; -} - -void -pcmciaCardFini (KdCardInfo *card) -{ - pcmciaCardInfo *pcmciac = card->driver; - - if (pcmciac->cop_base) - KdUnmapDevice ((void *) pcmciac->cop_base, PCMCIA_COP_SIZE(card)); -} - -void -pcmciaGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - while (ndef--) - { - pcmciaWriteReg (pcmciac, 0x3C7, pdefs->pixel); - pdefs->red = pcmciaReadReg (pcmciac, 0x3C9) << 10; - pdefs->green = pcmciaReadReg (pcmciac, 0x3C9) << 10; - pdefs->blue = pcmciaReadReg (pcmciac, 0x3C9) << 10; - pdefs++; - } -} - -void -pcmciaPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - pcmciaCardInfo *pcmciac = pScreenPriv->card->driver; - - while (ndef--) - { - pcmciaWriteReg (pcmciac, 0x3C8, pdefs->pixel); - pcmciaWriteReg (pcmciac, 0x3C9, pdefs->red >> 10); - pcmciaWriteReg (pcmciac, 0x3C9, pdefs->green >> 10); - pcmciaWriteReg (pcmciac, 0x3C9, pdefs->blue >> 10); - pdefs++; - } -} - - -KdCardFuncs pcmciaFuncs = { - pcmciaCardInit, /* cardinit */ - pcmciaScreenInit, /* scrinit */ - pcmciaInitScreen, /* initScreen */ - pcmciaPreserve, /* preserve */ - pcmciaEnable, /* enable */ - pcmciaDPMS, /* dpms */ - pcmciaDisable, /* disable */ - pcmciaRestore, /* restore */ - pcmciaScreenFini, /* scrfini */ - pcmciaCardFini, /* cardfini */ - - pcmciaCursorInit, /* initCursor */ - pcmciaCursorEnable, /* enableCursor */ - pcmciaCursorDisable, /* disableCursor */ - pcmciaCursorFini, /* finiCursor */ - pcmciaRecolorCursor, /* recolorCursor */ - -#if 0 /* not yet */ - pcmciaDrawInit, /* initAccel */ - pcmciaDrawEnable, /* enableAccel */ - pcmciaDrawSync, /* syncAccel */ - pcmciaDrawDisable, /* disableAccel */ - pcmciaDrawFini, /* finiAccel */ -#else - 0, - 0, - 0, - 0, - 0, -#endif - - pcmciaGetColors, /* getColors */ - pcmciaPutColors, /* putColors */ -}; diff --git a/hw/kdrive/pcmcia/pcmcia.h b/hw/kdrive/pcmcia/pcmcia.h deleted file mode 100644 index 245e51b77..000000000 --- a/hw/kdrive/pcmcia/pcmcia.h +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ - -#ifndef _PCMCIA_H_ -#define _PCMCIA_H_ - -#include <fbdev.h> - -/* - * offset from ioport beginning - */ - -#define PCMCIA_COP_BASE(c) 0x20000000 -#define PCMCIA_COP_SIZE(c) 0x10000 -#define TRIDENT_COP_OFF(c) 0x2100 - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _cop { - VOL32 src_start_xy; /* 0x00 */ - VOL32 src_end_xy; /* 0x04 */ - VOL32 dst_start_xy; /* 0x08 */ - VOL32 dst_end_xy; /* 0x0c */ - VOL32 alpha; /* 0x10 */ - CARD8 pad14[0xc]; /* 0x14 */ - VOL32 multi; /* 0x20 */ - -#define COP_MULTI_CLIP_TOP_LEFT 0x10000000 -#define COP_MULTI_DEPTH 0x40000000 -#define COP_MULTI_COLOR_KEY 0x70000000 -#define COP_MULTI_STYLE 0x50000000 -#define COP_MULTI_PATTERN 0x80000000 -#define COP_MULTI_ROP 0x90000000 -#define COP_MULTI_STRIDE 0x60000000 -#define COP_MULTI_Z 0xa0000000 -#define COP_MULTI_ALPHA 0xb0000000 -#define COP_MULTI_TEXTURE 0xd0000000 -#define COP_MULTI_TEXTURE_BOUND 0xe0000000 -#define COP_MULTI_TEXTURE_ADVANCED 0x20000000 -#define COP_MULTI_MASK 0xf0000000 - -#define COP_DEPTH_8 0x00000000 -#define COP_DEPTH_16 0x00000001 -#define COP_DEPTH_24_32 0x00000002 -#define COP_DEPTH_15 0x00000005 -#define COP_DEPTH_DITHER_DISABLE 0x00000008 - - -#define COP_ALPHA_SRC_BLEND_0 0x00000000 -#define COP_ALPHA_SRC_BLEND_1 0x00000001 -#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002 -#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003 -#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004 -#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005 -#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006 -#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007 -#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008 -#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009 -#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A -#define COP_ALPHA_SRC_BLEND_BG 0x0000000B - -#define COP_ALPHA_DST_BLEND_0 0x00000000 -#define COP_ALPHA_DST_BLEND_1 0x00000010 -#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020 -#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030 -#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040 -#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050 -#define COP_ALPHA_DST_BLEND_DST_A 0x00000060 -#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070 -#define COP_ALPHA_DST_BLEND_DST_C 0x00000080 -#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090 -#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0 - -#define COP_ALPHA_RESULT_ALPHA 0x00100000 -#define COP_ALPHA_DEST_ALPHA 0x00200000 -#define COP_ALPHA_SOURCE_ALPHA 0x00400000 -#define COP_ALPHA_WRITE_ENABLE 0x00800000 -#define COP_ALPHA_TEST_ENABLE 0x01000000 -#define COP_ALPHA_BLEND_ENABLE 0x02000000 -#define COP_ALPHA_DEST_VALUE 0x04000000 -#define COP_ALPHA_SOURCE_VALUE 0x08000000 - - VOL32 command; /* 0x24 */ -#define COP_OP_NULL 0x00000000 -#define COP_OP_LINE 0x20000000 -#define COP_OP_BLT 0x80000000 -#define COP_OP_TEXT 0x90000000 -#define COP_OP_POLY 0xb0000000 -#define COP_OP_POLY2 0xe0000000 -#define COP_SCL_EXPAND 0x00800000 -#define COP_SCL_OPAQUE 0x00400000 -#define COP_SCL_REVERSE 0x00200000 -#define COP_SCL_MONO_OFF 0x001c0000 -#define COP_LIT_TEXTURE 0x00004000 -#define COP_BILINEAR 0x00002000 -#define COP_OP_ZBUF 0x00000800 -#define COP_OP_ROP 0x00000400 -#define COP_OP_FG 0x00000200 -#define COP_OP_FB 0x00000080 -#define COP_X_REVERSE 0x00000004 -#define COP_CLIP 0x00000001 - VOL32 texture_format; /* 0x28 */ - CARD8 pad2c[0x4]; /* 0x2c */ - - VOL32 clip_bottom_right; /* 0x30 */ - VOL32 dataIII; /* 0x34 */ - VOL32 dataIV; /* 0x38 */ - CARD8 pad3c[0x8]; /* 0x3c */ - - VOL32 fg; /* 0x44 */ - VOL32 bg; /* 0x48 */ - CARD8 pad4c[0x4]; /* 0x4c */ - - VOL32 pattern_fg; /* 0x50 */ - VOL32 pattern_bg; /* 0x54 */ - CARD8 pad58[0xc]; /* 0x58 */ - - VOL32 status; /* 0x64 */ -#define COP_STATUS_BE_BUSY 0x80000000 -#define COP_STATUS_DPE_BUSY 0x20000000 -#define COP_STATUS_MI_BUSY 0x10000000 -#define COP_STATUS_FIFO_BUSY 0x08000000 -#define COP_STATUS_WB_BUSY 0x00800000 -#define COP_STATUS_Z_FAILED 0x00400000 -#define COP_STATUS_EFFECTIVE 0x00200000 -#define COP_STATUS_LEFT_VIEW 0x00080000 - - CARD8 pad68[0x4]; /* 0x68 */ - - VOL32 src_offset; /* 0x6c */ - VOL32 z_offset; /* 0x70 */ - CARD8 pad74[0x4]; /* 0x74 */ - - VOL32 display_offset; /* 0x78 */ - VOL32 dst_offset; /* 0x7c */ - CARD8 pad80[0x34]; /* 0x80 */ - - VOL32 semaphore; /* 0xb4 */ -} Cop; - -#define TRI_XY(x,y) ((y) << 16 | (x)) - -typedef struct _pcmciaCardInfo { - CARD8 *fb; - Bool HP; - CARD32 memory; - CARD8 *cop_base; - Cop *cop; - CARD32 *window; - CARD32 cop_depth; - CARD32 cop_stride; -} pcmciaCardInfo; - -#define getpcmciaCardInfo(kd) ((pcmciaCardInfo *) ((kd)->card->driver)) -#define pcmciaCardInfo(kd) pcmciaCardInfo *pcmciac = getpcmciaCardInfo(kd) - -typedef struct _pcmciaCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} pcmciaCursor; - -#define PCMCIA_CURSOR_WIDTH 64 -#define PCMCIA_CURSOR_HEIGHT 64 - -typedef struct _pcmciaScreenInfo { - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - int randr; - LayerPtr pLayer; - pcmciaCursor cursor; -} pcmciaScreenInfo; - -#define getpcmciaScreenInfo(kd) ((pcmciaScreenInfo *) ((kd)->screen->driver)) -#define pcmciaScreenInfo(kd) pcmciaScreenInfo *pcmcias = getpcmciaScreenInfo(kd) - -Bool -pcmciaDrawInit (ScreenPtr pScreen); - -void -pcmciaDrawEnable (ScreenPtr pScreen); - -void -pcmciaDrawSync (ScreenPtr pScreen); - -void -pcmciaDrawDisable (ScreenPtr pScreen); - -void -pcmciaDrawFini (ScreenPtr pScreen); - -CARD8 -pcmciaReadIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index); - -void -pcmciaWriteIndex (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 index, CARD8 value); - -void -pcmciaWriteReg (pcmciaCardInfo *pcmciac, CARD16 port, CARD8 value); - -Bool -pcmciaCursorInit (ScreenPtr pScreen); - -void -pcmciaCursorEnable (ScreenPtr pScreen); - -void -pcmciaCursorDisable (ScreenPtr pScreen); - -void -pcmciaCursorFini (ScreenPtr pScreen); - -void -pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -void -pcmciaUpdateRotatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf); - -typedef struct _pcmciaDisplayModeRec { - int Width; - int Height; - int Refresh; - int Clock; /* pixel clock freq */ - int HDisplay; /* horizontal timing */ - int HSyncStart; - int HSyncEnd; - int HTotal; - int HSkew; - int VDisplay; /* vertical timing */ - int VSyncStart; - int VSyncEnd; - int VTotal; - int VScan; - int Flags; -} pcmciaDisplayModeRec, *pcmciaDisplayModePtr; - -extern KdCardFuncs pcmciaFuncs; - -#endif /* _PCMCIA_H_ */ diff --git a/hw/kdrive/pcmcia/pcmciacurs.c b/hw/kdrive/pcmcia/pcmciacurs.c deleted file mode 100644 index 21d2d4adb..000000000 --- a/hw/kdrive/pcmcia/pcmciacurs.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "pcmcia.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - pcmciaCardInfo(pScreenPriv); \ - pcmciaScreenInfo(pScreenPriv); \ - pcmciaCursor *pCurPriv = &pcmcias->cursor - -static void -_pcmciaMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - - /* This is the recommended order to move the cursor */ - if (pcmciac->HP) { - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x40, xlow); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x41, xhigh); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x42, ylow); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x43, yhigh); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x46, xoff); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x47, yoff); - } else { - x >>= 3; - y >>= 3; - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - /* Don't be alarmed, yes the upper 3bits of the index are correct */ - pcmciaWriteIndex (pcmciac, 0x3c4, 0x10 | xhigh << 5, xlow); - pcmciaWriteIndex (pcmciac, 0x3c4, 0x11 | yhigh << 5, ylow); - } -} - -static void -pcmciaMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _pcmciaMoveCursor (pScreen, x, y); -} - -static void -pcmciaAllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -pcmciaSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CARD32 fg, bg; - - fg = pCurPriv->source; - bg = pCurPriv->mask; - - if (pcmciac->HP) { - /* - * This trident chip uses the palette for it's cursor colors - ouch! - * We enforce it to always stay the black/white colors as we don't - * want it to muck with the overscan color. Tough. Use softCursor - * if you want to change cursor colors. - */ - pcmciaWriteReg (pcmciac, 0x3c8, 0xff); /* DAC 0 */ - pcmciaWriteReg (pcmciac, 0x3c9, 0x00); - pcmciaWriteReg (pcmciac, 0x3c9, 0x00); - pcmciaWriteReg (pcmciac, 0x3c9, 0x00); - pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 255 */ - pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); - pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); - pcmciaWriteReg (pcmciac, 0x3c9, 0x3f); - } else { - CARD8 temp; - temp = pcmciaReadIndex(pcmciac, 0x3c4, 0x12); - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, (temp & 0xFE) | 0x02); - - pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 256 */ - pcmciaWriteReg (pcmciac, 0x3c9, fg); - pcmciaWriteReg (pcmciac, 0x3c9, fg >> 8); - pcmciaWriteReg (pcmciac, 0x3c9, fg >> 16); - pcmciaWriteReg (pcmciac, 0x3c8, 0x00); /* DAC 257 */ - pcmciaWriteReg (pcmciac, 0x3c9, bg); - pcmciaWriteReg (pcmciac, 0x3c9, bg >> 8); - pcmciaWriteReg (pcmciac, 0x3c9, bg >> 16); - - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, temp); - } -} - -void -pcmciaRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - pcmciaAllocCursorColors (pScreen); - pcmciaSetCursorColors (pScreen); -} - -#define InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -static void -pcmciaLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD8 *ram; - CARD32 *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - - /* - * Allocate new colors - */ - pcmciaAllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - if (pcmciac->HP) { - ram = (CARD8 *) pcmcias->cursor_base; - } else { - /* The last bank */ - ram = (CARD8 *) pcmciac->fb; - pcmciaWriteIndex (pcmciac, 0x3ce, 0x09, 0x7f); - pcmciaWriteIndex (pcmciac, 0x3ce, 0x0A, 0x7f); - } - - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > PCMCIA_CURSOR_HEIGHT) - h = PCMCIA_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; - - for (i = 0; i < PCMCIA_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < PCMCIA_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - InvertBits32(m); - InvertBits32(s); - } - else - { - m = 0; - s = 0; - } - - /* Do 8bit access */ - *ram++ = (m & 0xff); - *ram++ = (m & 0xff00) >> 8; - *ram++ = (m & 0xff0000) >> 16; - *ram++ = (m & 0xff000000) >> 24; - *ram++ = (s & 0xff); - *ram++ = (s & 0xff00) >> 8; - *ram++ = (s & 0xff0000) >> 16; - *ram++ = (s & 0xff000000) >> 24; - } - } - - /* Set address for cursor bits */ - if (pcmciac->HP) { - offset = pcmcias->cursor_base - (CARD8 *) pcmcias->screen; - offset >>= 10; - pcmciaWriteIndex (pcmciac, 0x3d4, 0x44, (CARD8) (offset & 0xff)); - pcmciaWriteIndex (pcmciac, 0x3d4, 0x45, (CARD8) (offset >> 8)); - } else { - pcmciaWriteIndex (pcmciac, 0x3c4, 0x13, 15); /* ?? */ - } - - /* Set new color */ - pcmciaSetCursorColors (pScreen); - - /* Enable the cursor */ - if (pcmciac->HP) - pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0xc1); - else - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0x05); - - /* Move to new position */ - pcmciaMoveCursor (pScreen, x, y); -} - -static void -pcmciaUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - if (pcmciac->HP) - pcmciaWriteIndex (pcmciac, 0x3d4, 0x50, 0); - else - pcmciaWriteIndex (pcmciac, 0x3c4, 0x12, 0); -} - -static Bool -pcmciaRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - pcmciaLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -pcmciaUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -pcmciaSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - pcmciaLoadCursor (pScreen, x, y); - else - pcmciaUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec pcmciaPointerSpriteFuncs = { - pcmciaRealizeCursor, - pcmciaUnrealizeCursor, - pcmciaSetCursor, - pcmciaMoveCursor, -}; - -static void -pcmciaQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -pcmciaCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pcmcias->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = PCMCIA_CURSOR_WIDTH; - pCurPriv->height= PCMCIA_CURSOR_HEIGHT; - pScreen->QueryBestSize = pcmciaQueryBestSize; - miPointerInitialize (pScreen, - &pcmciaPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -pcmciaCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - pcmciaLoadCursor (pScreen, x, y); - } - else - pcmciaUnloadCursor (pScreen); - } -} - -void -pcmciaCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - pcmciaUnloadCursor (pScreen); - } - } -} - -void -pcmciaCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/pcmcia/pcmciarotate.c b/hw/kdrive/pcmcia/pcmciarotate.c deleted file mode 100644 index e5dc1cb41..000000000 --- a/hw/kdrive/pcmcia/pcmciarotate.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include <X11/X.h> -#include "scrnintstr.h" -#include "windowstr.h" -#include "font.h" -#include "dixfontstr.h" -#include "fontstruct.h" -#include "mi.h" -#include "regionstr.h" -#include "globals.h" -#include "gcstruct.h" -#include "shadow.h" -#include "fb.h" - -/* - * These indicate which way the source (shadow) is scanned when - * walking the screen in a particular direction - */ - -#define LEFT_TO_RIGHT 1 -#define RIGHT_TO_LEFT -1 -#define TOP_TO_BOTTOM 2 -#define BOTTOM_TO_TOP -2 - -typedef CARD16 PcBits; -typedef INT32 PcStride; - -#define PC_SHIFT 4 -#define PC_UNIT (1 << PC_SHIFT) -#define PC_HALFUNIT (1 << (PC_SHIFT-1)) -#define PC_MASK (PC_UNIT - 1) -#define PC_ALLONES ((PcBits) -1) - -#define PcScrRight(x,b) FbScrRight(x,b) -#define PcScrLeft(x,b) FbScrLeft(x,b) -#define PcBitsMask(x,w) (PcScrRight(PC_ALLONES,(x) & PC_MASK) & \ - PcScrLeft(PC_ALLONES,(PC_UNIT - ((x) + (w))) & PC_MASK)) - -#define pcGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ - PixmapPtr _pPix; \ - if ((pDrawable)->type != DRAWABLE_PIXMAP) \ - _pPix = fbGetWindowPixmap(pDrawable); \ - else \ - _pPix = (PixmapPtr) (pDrawable); \ - (pointer) = (PcBits *) _pPix->devPrivate.ptr; \ - (stride) = ((int) _pPix->devKind) / sizeof (PcBits); \ - (bpp) = _pPix->drawable.bitsPerPixel; \ - (xoff) = 0; \ - (yoff) = 0; \ -} - -void -pcmciaUpdateRotatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - PixmapPtr pShadow = pBuf->pPixmap; - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - PcBits *shaBits; - PcStride shaStride; - int shaBpp; - int shaXoff, shaYoff; - int box_x1, box_x2, box_y1, box_y2; - int sha_x1, sha_y1; - int scr_x1, scr_x2, scr_y1, scr_y2, scr_w, scr_h; - int scr_x, scr_y; - int w; - int pixelsPerBits; - int pixelsMask; - PcStride shaStepOverY, shaStepDownY, shaStepOverX, shaStepDownX; - PcBits *shaLine, *sha; - int shaHeight = pShadow->drawable.height; - int shaWidth = pShadow->drawable.width; - PcBits shaMask; - int shaFirstShift, shaShift; - int o_x_dir; - int o_y_dir; - int x_dir; - int y_dir; - - pcGetDrawable (&pShadow->drawable, shaBits, shaStride, shaBpp, shaXoff, shaYoff); - pixelsPerBits = (sizeof (PcBits) * 8) / shaBpp; - pixelsMask = ~(pixelsPerBits - 1); - shaMask = PcBitsMask (PC_UNIT-shaBpp, shaBpp); - /* - * Compute rotation related constants to walk the shadow - */ - o_x_dir = LEFT_TO_RIGHT; - o_y_dir = TOP_TO_BOTTOM; - if (pBuf->randr & SHADOW_REFLECT_X) - o_x_dir = -o_x_dir; - if (pBuf->randr & SHADOW_REFLECT_Y) - o_y_dir = -o_y_dir; - switch (pBuf->randr & (SHADOW_ROTATE_ALL)) { - case SHADOW_ROTATE_0: /* upper left shadow -> upper left screen */ - default: - x_dir = o_x_dir; - y_dir = o_y_dir; - break; - case SHADOW_ROTATE_90: /* upper right shadow -> upper left screen */ - x_dir = o_y_dir; - y_dir = -o_x_dir; - break; - case SHADOW_ROTATE_180: /* lower right shadow -> upper left screen */ - x_dir = -o_x_dir; - y_dir = -o_y_dir; - break; - case SHADOW_ROTATE_270: /* lower left shadow -> upper left screen */ - x_dir = -o_y_dir; - y_dir = o_x_dir; - break; - } - switch (x_dir) { - case LEFT_TO_RIGHT: - shaStepOverX = shaBpp; - shaStepOverY = 0; - break; - case TOP_TO_BOTTOM: - shaStepOverX = 0; - shaStepOverY = shaStride; - break; - case RIGHT_TO_LEFT: - shaStepOverX = -shaBpp; - shaStepOverY = 0; - break; - case BOTTOM_TO_TOP: - shaStepOverX = 0; - shaStepOverY = -shaStride; - break; - } - switch (y_dir) { - case TOP_TO_BOTTOM: - shaStepDownX = 0; - shaStepDownY = shaStride; - break; - case RIGHT_TO_LEFT: - shaStepDownX = -shaBpp; - shaStepDownY = 0; - break; - case BOTTOM_TO_TOP: - shaStepDownX = 0; - shaStepDownY = -shaStride; - break; - case LEFT_TO_RIGHT: - shaStepDownX = shaBpp; - shaStepDownY = 0; - break; - } - - while (nbox--) - { - box_x1 = pbox->x1; - box_y1 = pbox->y1; - box_x2 = pbox->x2; - box_y2 = pbox->y2; - pbox++; - - /* - * Compute screen and shadow locations for this box - */ - switch (x_dir) { - case LEFT_TO_RIGHT: - scr_x1 = box_x1 & pixelsMask; - scr_x2 = (box_x2 + pixelsPerBits - 1) & pixelsMask; - - sha_x1 = scr_x1; - break; - case TOP_TO_BOTTOM: - scr_x1 = box_y1 & pixelsMask; - scr_x2 = (box_y2 + pixelsPerBits - 1) & pixelsMask; - - sha_y1 = scr_x1; - break; - case RIGHT_TO_LEFT: - scr_x1 = (shaWidth - box_x2) & pixelsMask; - scr_x2 = (shaWidth - box_x1 + pixelsPerBits - 1) & pixelsMask; - - sha_x1 = (shaWidth - scr_x1 - 1); - break; - case BOTTOM_TO_TOP: - scr_x1 = (shaHeight - box_y2) & pixelsMask; - scr_x2 = (shaHeight - box_y1 + pixelsPerBits - 1) & pixelsMask; - - sha_y1 = (shaHeight - scr_x1 - 1); - break; - } - switch (y_dir) { - case TOP_TO_BOTTOM: - scr_y1 = box_y1; - scr_y2 = box_y2; - - sha_y1 = scr_y1; - break; - case RIGHT_TO_LEFT: - scr_y1 = (shaWidth - box_x2); - scr_y2 = (shaWidth - box_x1); - - sha_x1 = box_x2 - 1; - break; - case BOTTOM_TO_TOP: - scr_y1 = shaHeight - box_y2; - scr_y2 = shaHeight - box_y1; - - sha_y1 = box_y2 - 1; - break; - case LEFT_TO_RIGHT: - scr_y1 = box_x1; - scr_y2 = box_x2; - - sha_x1 = box_x1; - break; - } - scr_w = ((scr_x2 - scr_x1) * shaBpp) >> PC_SHIFT; - scr_h = scr_y2 - scr_y1; - scr_y = scr_y1; - - /* shift amount for first pixel on screen */ - shaFirstShift = PC_UNIT - ((sha_x1 * shaBpp) & PC_MASK) - shaBpp; - - /* pointer to shadow data first placed on screen */ - shaLine = (shaBits + - sha_y1 * shaStride + - ((sha_x1 * shaBpp) >> PC_SHIFT)); - - /* - * Copy the bits, always write across the physical frame buffer - * to take advantage of write combining. - */ - while (scr_h--) - { - int p; - PcBits bits; - PcBits *win; - int i; - CARD32 winSize; - - sha = shaLine; - shaShift = shaFirstShift; - w = scr_w; - scr_x = scr_x1 * shaBpp >> PC_SHIFT; - - while (w) - { - /* - * Map some of this line - */ - win = (PcBits *) (*pBuf->window) (pScreen, - scr_y, - scr_x << 1, - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - i = (winSize >> 1); - if (i > w) - i = w; - w -= i; - scr_x += i; - /* - * Copy the portion of the line mapped - */ - while (i--) - { - bits = 0; - p = pixelsPerBits; - /* - * Build one word of output from multiple inputs - * - * Note that for 90/270 rotations, this will walk - * down the shadow hitting each scanline once. - * This is probably not very efficient. - */ - while (p--) - { - bits = PcScrLeft(bits, shaBpp); - bits |= PcScrRight (*sha, shaShift) & shaMask; - - shaShift -= shaStepOverX; - if (shaShift >= PC_UNIT) - { - shaShift -= PC_UNIT; - sha--; - } - else if (shaShift < 0) - { - shaShift += PC_UNIT; - sha++; - } - sha += shaStepOverY; - } - *win++ = bits; - } - } - scr_y++; - shaFirstShift -= shaStepDownX; - if (shaFirstShift >= PC_UNIT) - { - shaFirstShift -= PC_UNIT; - shaLine--; - } - else if (shaFirstShift < 0) - { - shaFirstShift += PC_UNIT; - shaLine++; - } - shaLine += shaStepDownY; - } - } -} diff --git a/hw/kdrive/pcmcia/pcmciashadow.c b/hw/kdrive/pcmcia/pcmciashadow.c deleted file mode 100644 index f578f1bff..000000000 --- a/hw/kdrive/pcmcia/pcmciashadow.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include <X11/X.h> -#include "scrnintstr.h" -#include "windowstr.h" -#include "font.h" -#include "dixfontstr.h" -#include "fontstruct.h" -#include "mi.h" -#include "regionstr.h" -#include "globals.h" -#include "gcstruct.h" -#include "shadow.h" -#include "fb.h" - -void -tridentUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - PixmapPtr pShadow = pBuf->pPixmap; - shadowScrPriv(pScreen); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - FbBits *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - int shaXoff, shaYoff; /* XXX assumed to be zero */ - int x, y, w, h, width; - int i; - FbBits *winBase, *win; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = pbox->x1 * shaBpp; - y = pbox->y1; - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; - - scrLine = (x >> FB_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - x &= FB_MASK; - w = (w + x + FB_MASK) >> FB_SHIFT; - - while (h--) - { - winSize = 0; - scrBase = 0; - width = w; - scr = scrLine; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (FbBits *) (*pBuf->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (FbBits); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - { - CARD16 *sha16 = (CARD16*)sha; - CARD16 *win16 = (CARD16*)win; - while (i--) - { - *win16++ = *sha16++; - *win16++ = *sha16++; - } - } - } - shaLine += shaStride; - y++; - } - pbox++; - } -} - -void -cirrusUpdatePacked (ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - PixmapPtr pShadow = pBuf->pPixmap; - shadowScrPriv(pScreen); - int nbox = REGION_NUM_RECTS (damage); - BoxPtr pbox = REGION_RECTS (damage); - FbBits *shaBase, *shaLine, *sha; - FbStride shaStride; - int scrBase, scrLine, scr; - int shaBpp; - int shaXoff, shaYoff; /* XXX assumed to be zero */ - int x, y, w, h, width; - int i; - FbBits *winBase, *win; - CARD32 winSize; - - fbGetDrawable (&pShadow->drawable, shaBase, shaStride, shaBpp, shaXoff, shaYoff); - while (nbox--) - { - x = pbox->x1 * shaBpp; - y = pbox->y1; - w = (pbox->x2 - pbox->x1) * shaBpp; - h = pbox->y2 - pbox->y1; - - scrLine = (x >> FB_SHIFT); - shaLine = shaBase + y * shaStride + (x >> FB_SHIFT); - - x &= FB_MASK; - w = (w + x + FB_MASK) >> FB_SHIFT; - - while (h--) - { - winSize = 0; - scrBase = 0; - width = w; - scr = scrLine; - sha = shaLine; - while (width) { - /* how much remains in this window */ - i = scrBase + winSize - scr; - if (i <= 0 || scr < scrBase) - { - winBase = (FbBits *) (*pBuf->window) (pScreen, - y, - scr * sizeof (FbBits), - SHADOW_WINDOW_WRITE, - &winSize, - pBuf->closure); - if(!winBase) - return; - scrBase = scr; - winSize /= sizeof (FbBits); - i = winSize; - } - win = winBase + (scr - scrBase); - if (i > width) - i = width; - width -= i; - scr += i; - { - CARD8 *sha8 = (CARD8*)sha; - CARD8 *win8 = (CARD8*)win; - while (i--) - { - *win8++ = *sha8++; - *win8++ = *sha8++; - *win8++ = *sha8++; - *win8++ = *sha8++; - } - } - } - shaLine += shaStride; - y++; - } - pbox++; - } -} diff --git a/hw/kdrive/pcmcia/pcmciastub.c b/hw/kdrive/pcmcia/pcmciastub.c deleted file mode 100644 index 779ad7f1b..000000000 --- a/hw/kdrive/pcmcia/pcmciastub.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2001 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * 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 Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE 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. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "pcmcia.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - - KdCardInfoAdd (&pcmciaFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -extern pcmciaDisplayModeRec pcmciaDefaultModes[]; - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/pm2/Makefile.am b/hw/kdrive/pm2/Makefile.am deleted file mode 100644 index cb28de6cb..000000000 --- a/hw/kdrive/pm2/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xpm2 - -noinst_LIBRARIES = libpm2.a - -libpm2_a_SOURCES = \ - glint_regs.h \ - pm2.c \ - pm2_draw.c \ - pm2.h - -Xpm2_SOURCES = \ - pm2stub.c - -PM2_LIBS = \ - libpm2.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - @KDRIVE_LIBS@ - -if GLX -Xpm2_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xpm2_LDADD = \ - $(PM2_LIBS) \ - @KDRIVE_LIBS@ - -Xpm2_DEPENDENCIES = \ - libpm2.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/pm2/glint_regs.h b/hw/kdrive/pm2/glint_regs.h deleted file mode 100644 index 84f220298..000000000 --- a/hw/kdrive/pm2/glint_regs.h +++ /dev/null @@ -1,1370 +0,0 @@ - -/* - * glint register file - * - * Copyright by Stefan Dirsch, Dirk Hohndel, Alan Hourihane - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * Dirk Hohndel, <hohndel@suse.de> - * Stefan Dirsch, <sndirsch@suse.de> - * Simon P., <sim@suse.de> - * - * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and - * Siemens Nixdorf Informationssysteme - * - */ - -#ifndef _GLINTREG_H_ -#define _GLINTREG_H_ - -/* The chips we know */ -#define PCI_CHIP_3DLABS_300SX 0x01 -#define PCI_CHIP_3DLABS_500TX 0x02 -#define PCI_CHIP_3DLABS_DELTA 0x03 -#define PCI_CHIP_3DLABS_PERMEDIA 0x04 -#define PCI_CHIP_3DLABS_MX 0x06 -#define PCI_CHIP_3DLABS_PERMEDIA2 0x07 -#define PCI_CHIP_3DLABS_GAMMA 0x08 -#define PCI_CHIP_3DLABS_PERMEDIA2V 0x09 -#define PCI_CHIP_3DLABS_PERMEDIA3 0x0A -#define PCI_CHIP_3DLABS_PERMEDIA4 0x0C -#define PCI_CHIP_3DLABS_R4 0x0D -#define PCI_CHIP_3DLABS_GAMMA2 0x0E - -/* The boards we know */ -#define IS_GLORIAXXL ((pGlint->PciInfo->subsysVendor == 0x1048) && \ - (pGlint->PciInfo->subsysCard == 0x0a42)) - -#define IS_GLORIASYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \ - (pGlint->PciInfo->subsysCard == 0x0a32)) - -#define IS_GMX2000 ((pGlint->PciInfo->subsysVendor == 0x3d3d) && \ - (pGlint->PciInfo->subsysCard == 0x0106)) - -#define IS_J2000 ((pGlint->PciInfo->subsysVendor == 0x1097) && \ - (pGlint->PciInfo->subsysCard == 0x3d32)) - -#define IS_JPRO ((pGlint->PciInfo->subsysVendor == 0x1097) && \ - (pGlint->PciInfo->subsysCard == 0x3db3)) - -/* COMPAQ OEM VX1 PCI - * subsys == 0x0121 if VGA is enabled - * subsys == 0x000a if VGA has never been enabled - */ -#define IS_PCI_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \ - ((pGlint->PciInfo->subsysCard == 0x0121) || \ - (pGlint->PciInfo->subsysCard == 0x000a))) - -/* COMPAQ OEM VX1 AGP - * subsys == 0x0144 if VGA is enabled - * subsys == 0x000c if VGA has never been enabled - */ -#define IS_AGP_QVX1 (pGlint->PciInfo->subsysVendor == 0x3d3d && \ - ((pGlint->PciInfo->subsysCard == 0x0144) || \ - (pGlint->PciInfo->subsysCard == 0x000c))) - -#define IS_QVX1 (IS_PCI_QVX1 || IS_AGP_QVX1) - -#define IS_ELSA_SYNERGY ((pGlint->PciInfo->subsysVendor == 0x1048) && \ - (pGlint->PciInfo->subsysCard == 0x0a32)) - -/* COMPAQ OEM Permedia 2V with VGA disable jumper - 0x13e9 ? */ -#define IS_QPM2V ((pGlint->PciInfo->subsysVendor == 0x13e9) && \ - ((pGlint->PciInfo->subsysCard == 0x0100) || \ - (pGlint->PciInfo->subsysCard == 0x0002))) - -/********************************************** -* GLINT 500TX Configuration Region Registers * -***********************************************/ - -/* Device Identification */ -#define CFGVendorId 0x0000 -#define PCI_VENDOR_3DLABS 0x3D3D -#define PCI_VENDOR_TI 0x104C -#define CFGDeviceId 0x0002 - -#define CFGRevisionId 0x08 -#define CFGClassCode 0x09 -#define CFGHeaderType 0x0E - -/* Device Control/Status */ -#define CFGCommand 0x04 -#define CFGStatus 0x06 - -/* Miscellaneous Functions */ -#define CFGBist 0x0f -#define CFGLatTimer 0x0d -#define CFGCacheLine 0x0c -#define CFGMaxLat 0x3f -#define CFGMinGrant 0x3e -#define CFGIntPin 0x3d -#define CFGIntLine 0x3c - -/* Base Adresses */ -#define CFGBaseAddr0 0x10 -#define CFGBaseAddr1 0x14 -#define CFGBaseAddr2 0x18 -#define CFGBaseAddr3 0x1C -#define CFGBaseAddr4 0x20 -#define CFGRomAddr 0x30 - - - -/********************************** - * GLINT 500TX Region 0 Registers * - **********************************/ - -/* Control Status Registers */ -#define ResetStatus 0x0000 -#define IntEnable 0x0008 -#define IntFlags 0x0010 -#define InFIFOSpace 0x0018 -#define OutFIFOWords 0x0020 -#define DMAAddress 0x0028 -#define DMACount 0x0030 -#define ErrorFlags 0x0038 -#define VClkCtl 0x0040 -#define TestRegister 0x0048 -#define Aperture0 0x0050 -#define Aperture1 0x0058 -#define DMAControl 0x0060 -#define FIFODis 0x0068 - -/* GLINT PerMedia Region 0 additional Registers */ -#define ChipConfig 0x0070 -# define SCLK_SEL_MASK (3 << 10) -# define SCLK_SEL_MCLK_HALF (3 << 10) - -#define ByDMAControl 0x00D8 - -/* GLINT 500TX LocalBuffer Registers */ -#define LBMemoryCtl 0x1000 -# define LBNumBanksMask 0x00000001 -# define LBNumBanks1 (0) -# define LBNumBanks2 (1) -# define LBPageSizeMask 0x00000006 -# define LBPageSize256 (0<<1) -# define LBPageSize512 (1<<1) -# define LBPageSize1024 (2<<1) -# define LBPageSize2048 (3<<1) -# define LBRASCASLowMask 0x00000018 -# define LBRASCASLow2 (0<<3) -# define LBRASCASLow3 (1<<3) -# define LBRASCASLow4 (2<<3) -# define LBRASCASLow5 (3<<3) -# define LBRASPrechargeMask 0x00000060 -# define LBRASPrecharge2 (0<<5) -# define LBRASPrecharge3 (1<<5) -# define LBRASPrecharge4 (2<<5) -# define LBRASPrecharge5 (3<<5) -# define LBCASLowMask 0x00000180 -# define LBCASLow1 (0<<7) -# define LBCASLow2 (1<<7) -# define LBCASLow3 (2<<7) -# define LBCASLow4 (3<<7) -# define LBPageModeMask 0x00000200 -# define LBPageModeEnabled (0<<9) -# define LBPageModeDisabled (1<<9) -# define LBRefreshCountMask 0x0003fc00 -# define LBRefreshCountShift 10 - -#define LBMemoryEDO 0x1008 -# define LBEDOMask 0x00000001 -# define LBEDODisabled (0) -# define LBEDOEnabled (1) -# define LBEDOBankSizeMask 0x0000000e -# define LBEDOBankSizeDiabled (0<<1) -# define LBEDOBankSize256K (1<<1) -# define LBEDOBankSize512K (2<<1) -# define LBEDOBankSize1M (3<<1) -# define LBEDOBankSize2M (4<<1) -# define LBEDOBankSize4M (5<<1) -# define LBEDOBankSize8M (6<<1) -# define LBEDOBankSize16M (7<<1) -# define LBTwoPageDetectorMask 0x00000010 -# define LBSinglePageDetector (0<<4) -# define LBTwoPageDetector (1<<4) - -/* GLINT PerMedia Memory Control Registers */ -#define PMReboot 0x1000 -#define PMRomControl 0x1040 -#define PMBootAddress 0x1080 -#define PMMemConfig 0x10C0 -# define RowCharge8 1 << 10 -# define TimeRCD8 1 << 7 -# define TimeRC8 0x6 << 3 -# define TimeRP8 1 -# define CAS3Latency8 0 << 16 -# define BootAdress8 0x10 -# define NumberBanks8 0x3 << 29 -# define RefreshCount8 0x41 << 21 -# define TimeRASMin8 1 << 13 -# define DeadCycle8 1 << 17 -# define BankDelay8 0 << 18 -# define Burst1Cycle8 1 << 31 -# define SDRAM8 0 << 4 - -# define RowCharge6 1 << 10 -# define TimeRCD6 1 << 7 -# define TimeRC6 0x6 << 3 -# define TimeRP6 0x2 -# define CAS3Latency6 1 << 16 -# define BootAdress6 0x60 -# define NumberBanks6 0x2 << 29 -# define RefreshCount6 0x41 << 21 -# define TimeRASMin6 1 << 13 -# define DeadCycle6 1 << 17 -# define BankDelay6 0 << 18 -# define Burst1Cycle6 1 << 31 -# define SDRAM6 0 << 4 - -# define RowCharge4 0 << 10 -# define TimeRCD4 0 << 7 -# define TimeRC4 0x4 << 3 -# define TimeRP4 1 -# define CAS3Latency4 0 << 16 -# define BootAdress4 0x10 -# define NumberBanks4 1 << 29 -# define RefreshCount4 0x30 << 21 -# define TimeRASMin4 1 << 13 -# define DeadCycle4 0 << 17 -# define BankDelay4 0 << 18 -# define Burst1Cycle4 1 << 31 -# define SDRAM4 0 << 4 - -/* Permedia 2 Control */ -#define MemControl 0x1040 - -#define PMBypassWriteMask 0x1100 -#define PMFramebufferWriteMask 0x1140 -#define PMCount 0x1180 - -/* Framebuffer Registers */ -#define FBMemoryCtl 0x1800 -#define FBModeSel 0x1808 -#define FBGCWrMask 0x1810 -#define FBGCColorLower 0x1818 -#define FBTXMemCtl 0x1820 -#define FBWrMaskk 0x1830 -#define FBGCColorUpper 0x1838 - -/* Core FIFO */ -#define OutputFIFO 0x2000 - -/* 500TX Internal Video Registers */ -#define VTGHLimit 0x3000 -#define VTGHSyncStart 0x3008 -#define VTGHSyncEnd 0x3010 -#define VTGHBlankEnd 0x3018 -#define VTGVLimit 0x3020 -#define VTGVSyncStart 0x3028 -#define VTGVSyncEnd 0x3030 -#define VTGVBlankEnd 0x3038 -#define VTGHGateStart 0x3040 -#define VTGHGateEnd 0x3048 -#define VTGVGateStart 0x3050 -#define VTGVGateEnd 0x3058 -#define VTGPolarity 0x3060 -#define VTGFrameRowAddr 0x3068 -#define VTGVLineNumber 0x3070 -#define VTGSerialClk 0x3078 -#define VTGModeCtl 0x3080 - -/* Permedia Video Control Registers */ -#define PMScreenBase 0x3000 -#define PMScreenStride 0x3008 -#define PMHTotal 0x3010 -#define PMHgEnd 0x3018 -#define PMHbEnd 0x3020 -#define PMHsStart 0x3028 -#define PMHsEnd 0x3030 -#define PMVTotal 0x3038 -#define PMVbEnd 0x3040 -#define PMVsStart 0x3048 -#define PMVsEnd 0x3050 -#define PMVideoControl 0x3058 -#define PMInterruptLine 0x3060 -#define PMDDCData 0x3068 -# define DataIn (1<<0) -# define ClkIn (1<<1) -# define DataOut (1<<2) -# define ClkOut (1<<3) -#define PMLineCount 0x3070 -#define PMFifoControl 0x3078 - -/* Permedia 2 RAMDAC Registers */ -#define PM2DACWriteAddress 0x4000 -#define PM2DACIndexReg 0x4000 -#define PM2DACData 0x4008 -#define PM2DACReadMask 0x4010 -#define PM2DACReadAddress 0x4018 -#define PM2DACCursorColorAddress 0x4020 -#define PM2DACCursorColorData 0x4028 -#define PM2DACIndexData 0x4050 -#define PM2DACCursorData 0x4058 -#define PM2DACCursorXLsb 0x4060 -#define PM2DACCursorXMsb 0x4068 -#define PM2DACCursorYLsb 0x4070 -#define PM2DACCursorYMsb 0x4078 -#define PM2DACCursorControl 0x06 - -#define PM2DACIndexCMR 0x18 -# define PM2DAC_TRUECOLOR 0x80 -# define PM2DAC_RGB 0x20 -# define PM2DAC_GRAPHICS 0x10 -# define PM2DAC_PACKED 0x09 -# define PM2DAC_8888 0x08 -# define PM2DAC_565 0x06 -# define PM2DAC_4444 0x05 -# define PM2DAC_5551 0x04 -# define PM2DAC_2321 0x03 -# define PM2DAC_2320 0x02 -# define PM2DAC_332 0x01 -# define PM2DAC_CI8 0x00 - -#define PM2DACIndexMDCR 0x19 -#define PM2DACIndexPalettePage 0x1c -#define PM2DACIndexMCR 0x1e -#define PM2DACIndexClockAM 0x20 -#define PM2DACIndexClockAN 0x21 -#define PM2DACIndexClockAP 0x22 -#define PM2DACIndexClockBM 0x23 -#define PM2DACIndexClockBN 0x24 -#define PM2DACIndexClockBP 0x25 -#define PM2DACIndexClockCM 0x26 -#define PM2DACIndexClockCN 0x27 -#define PM2DACIndexClockCP 0x28 -#define PM2DACIndexClockStatus 0x29 -#define PM2DACIndexMemClockM 0x30 -#define PM2DACIndexMemClockN 0x31 -#define PM2DACIndexMemClockP 0x32 -#define PM2DACIndexMemClockStatus 0x33 -#define PM2DACIndexColorKeyControl 0x40 -#define PM2DACIndexColorKeyOverlay 0x41 -#define PM2DACIndexColorKeyRed 0x42 -#define PM2DACIndexColorKeyGreen 0x43 -#define PM2DACIndexColorKeyBlue 0x44 - -/* Permedia 2V extensions */ -#define PM2VDACRDMiscControl 0x000 -#define PM2VDACRDSyncControl 0x001 -#define PM2VDACRDDACControl 0x002 -#define PM2VDACRDPixelSize 0x003 -#define PM2VDACRDColorFormat 0x004 -#define PM2VDACRDCursorMode 0x005 -#define PM2VDACRDCursorXLow 0x007 -#define PM2VDACRDCursorXHigh 0x008 -#define PM2VDACRDCursorYLow 0x009 -#define PM2VDACRDCursorYHigh 0x00A -#define PM2VDACRDCursorHotSpotX 0x00B -#define PM2VDACRDCursorHotSpotY 0x00C -#define PM2VDACRDOverlayKey 0x00D -#define PM2VDACRDPan 0x00E -#define PM2VDACRDSense 0x00F -#define PM2VDACRDCheckControl 0x018 -#define PM2VDACIndexClockControl 0x200 -#define PM2VDACRDDClk0PreScale 0x201 -#define PM2VDACRDDClk0FeedbackScale 0x202 -#define PM2VDACRDDClk0PostScale 0x203 -#define PM2VDACRDDClk1PreScale 0x204 -#define PM2VDACRDDClk1FeedbackScale 0x205 -#define PM2VDACRDDClk1PostScale 0x206 -#define PM2VDACRDMClkControl 0x20D -#define PM2VDACRDMClkPreScale 0x20E -#define PM2VDACRDMClkFeedbackScale 0x20F -#define PM2VDACRDMClkPostScale 0x210 -#define PM2VDACRDCursorPalette 0x303 -#define PM2VDACRDCursorPattern 0x400 -#define PM2VDACIndexRegLow 0x4020 -#define PM2VDACIndexRegHigh 0x4028 -#define PM2VDACIndexData 0x4030 - -#define PM2VDACRDIndexControl 0x4038 -/* Permedia 2 Video Streams Unit Registers */ -# define VSBIntFlag (1<<8) -# define VSAIntFlag (1<<9) - -#define VSConfiguration 0x5800 -# define VS_UnitMode_ROM 0 -# define VS_UnitMode_AB8 3 -# define VS_UnitMode_Mask 7 -# define VS_GPBusMode_A (1<<3) -# define VS_HRefPolarityA (1<<9) -# define VS_VRefPolarityA (1<<10) -# define VS_VActivePolarityA (1<<11) -# define VS_UseFieldA (1<<12) -# define VS_FieldPolarityA (1<<13) -# define VS_FieldEdgeA (1<<14) -# define VS_VActiveVBIA (1<<15) -# define VS_InterlaceA (1<<16) -# define VS_ReverseDataA (1<<17) -# define VS_HRefPolarityB (1<<18) -# define VS_VRefPolarityB (1<<19) -# define VS_VActivePolarityB (1<<20) -# define VS_UseFieldB (1<<21) -# define VS_FieldPolarityB (1<<22) -# define VS_FieldEdgeB (1<<23) -# define VS_VActiveVBIB (1<<24) -# define VS_InterlaceB (1<<25) -# define VS_ColorSpaceB_RGB (1<<26) -# define VS_ReverseDataB (1<<27) -# define VS_DoubleEdgeB (1<<28) - -#define VSStatus 0x5808 -# define VS_FieldOne0A (1<<9) -# define VS_FieldOne1A (1<<10) -# define VS_FieldOne2A (1<<11) -# define VS_InvalidInterlaceA (1<<12) -# define VS_FieldOne0B (1<<17) -# define VS_FieldOne1B (1<<18) -# define VS_FieldOne2B (1<<19) -# define VS_InvalidInterlaceB (1<<20) - -#define VSSerialBusControl 0x5810 - -#define VSABase 0x5900 -# define VSA_Video (1<<0) -# define VSA_VBI (1<<1) -# define VSA_BufferCtl (1<<2) -# define VSA_MirrorX (1<<7) -# define VSA_MirrorY (1<<8) -# define VSA_Discard_None (0<<9) -# define VSA_Discard_FieldOne (1<<9) -# define VSA_Discard_FieldTwo (2<<9) -# define VSA_CombineFields (1<<11) -# define VSA_LockToStreamB (1<<12) - -#define VSBBase 0x5A00 -# define VSB_Video (1<<0) -# define VSB_VBI (1<<1) -# define VSB_BufferCtl (1<<2) -# define VSB_CombineFields (1<<3) -# define VSB_RGBOrder (1<<11) -# define VSB_GammaCorrect (1<<12) -# define VSB_LockToStreamA (1<<13) - -#define VSControl 0x0000 -#define VSInterrupt 0x0008 -#define VSCurrentLine 0x0010 -#define VSVideoAddressHost 0x0018 -#define VSVideoAddressIndex 0x0020 -#define VSVideoAddress0 0x0028 -#define VSVideoAddress1 0x0030 -#define VSVideoAddress2 0x0038 -#define VSVideoStride 0x0040 -#define VSVideoStartLine 0x0048 -#define VSVideoEndLine 0x0050 -#define VSVideoStartData 0x0058 -#define VSVideoEndData 0x0060 -#define VSVBIAddressHost 0x0068 -#define VSVBIAddressIndex 0x0070 -#define VSVBIAddress0 0x0078 -#define VSVBIAddress1 0x0080 -#define VSVBIAddress2 0x0088 -#define VSVBIStride 0x0090 -#define VSVBIStartLine 0x0098 -#define VSVBIEndLine 0x00A0 -#define VSVBIStartData 0x00A8 -#define VSVBIEndData 0x00B0 -#define VSFifoControl 0x00B8 - -/********************************** - * GLINT Delta Region 0 Registers * - **********************************/ - -/* Control Status Registers */ -#define DResetStatus 0x0800 -#define DIntEnable 0x0808 -#define DIntFlags 0x0810 -#define DErrorFlags 0x0838 -#define DTestRegister 0x0848 -#define DFIFODis 0x0868 - - - -/********************************** - * GLINT Gamma Region 0 Registers * - **********************************/ - -/* Control Status Registers */ -#define GInFIFOSpace 0x0018 -#define GDMAAddress 0x0028 -#define GDMACount 0x0030 -#define GDMAControl 0x0060 -#define GOutDMA 0x0080 -#define GOutDMACount 0x0088 -#define GResetStatus 0x0800 -#define GIntEnable 0x0808 -#define GIntFlags 0x0810 -#define GErrorFlags 0x0838 -#define GTestRegister 0x0848 -#define GFIFODis 0x0868 - -#define GChipConfig 0x0870 -# define GChipAGPCapable 1 << 0 -# define GChipAGPSideband 1 << 1 -# define GChipMultiGLINTApMask 3 << 19 -# define GChipMultiGLINTAp_0M 0 << 19 -# define GChipMultiGLINTAp_16M 1 << 19 -# define GChipMultiGLINTAp_32M 2 << 19 -# define GChipMultiGLINTAp_64M 3 << 19 - -#define GCSRAperture 0x0878 -# define GCSRSecondaryGLINTMapEn 1 << 0 -# define GCSRBitSwap 1 << 1 - -#define GPageTableAddr 0x0c00 -#define GPageTableLength 0x0c08 -#define GDelayTimer 0x0c38 -#define GCommandMode 0x0c40 -#define GCommandIntEnable 0x0c48 -#define GCommandIntFlags 0x0c50 -#define GCommandErrorFlags 0x0c58 -#define GCommandStatus 0x0c60 -#define GCommandFaultingAddr 0x0c68 -#define GVertexFaultingAddr 0x0c70 -#define GWriteFaultingAddr 0x0c88 -#define GFeedbackSelectCount 0x0c98 -#define GGammaProcessorMode 0x0cb8 -#define GVGAShadow 0x0d00 -#define GMultGLINTAperture 0x0d08 -#define GMultGLINT1 0x0d10 -#define GMultGLINT2 0x0d18 - -/************************ - * GLINT Core Registers * - ************************/ - -#define GLINT_TAG(major,offset) (((major) << 7) | ((offset) << 3)) -#define GLINT_TAG_ADDR(major,offset) (0x8000 | GLINT_TAG((major),(offset))) - -#define UNIT_DISABLE 0 -#define UNIT_ENABLE 1 - -#define StartXDom GLINT_TAG_ADDR(0x00,0x00) -#define dXDom GLINT_TAG_ADDR(0x00,0x01) -#define StartXSub GLINT_TAG_ADDR(0x00,0x02) -#define dXSub GLINT_TAG_ADDR(0x00,0x03) -#define StartY GLINT_TAG_ADDR(0x00,0x04) -#define dY GLINT_TAG_ADDR(0x00,0x05) -#define GLINTCount GLINT_TAG_ADDR(0x00,0x06) - -#define Render GLINT_TAG_ADDR(0x00,0x07) -# define AreaStippleEnable 0x00001 -# define LineStippleEnable 0x00002 -# define ResetLineStipple 0x00004 -# define FastFillEnable 0x00008 -# define PrimitiveLine 0 -# define PrimitiveTrapezoid 0x00040 -# define PrimitivePoint 0x00080 -# define PrimitiveRectangle 0x000C0 -# define AntialiasEnable 0x00100 -# define AntialiasingQuality 0x00200 -# define UsePointTable 0x00400 -# define SyncOnBitMask 0x00800 -# define SyncOnHostData 0x01000 -# define TextureEnable 0x02000 -# define FogEnable 0x04000 -# define CoverageEnable 0x08000 -# define SubPixelCorrectionEnable 0x10000 -# define SpanOperation 0x40000 -# define XPositive 1<<21 -# define YPositive 1<<22 - -#define ContinueNewLine GLINT_TAG_ADDR(0x00,0x08) -#define ContinueNewDom GLINT_TAG_ADDR(0x00,0x09) -#define ContinueNewSub GLINT_TAG_ADDR(0x00,0x0a) -#define Continue GLINT_TAG_ADDR(0x00,0x0b) -#define FlushSpan GLINT_TAG_ADDR(0x00,0x0c) -#define BitMaskPattern GLINT_TAG_ADDR(0x00,0x0d) - -#define PointTable0 GLINT_TAG_ADDR(0x01,0x00) -#define PointTable1 GLINT_TAG_ADDR(0x01,0x01) -#define PointTable2 GLINT_TAG_ADDR(0x01,0x02) -#define PointTable3 GLINT_TAG_ADDR(0x01,0x03) - -#define RasterizerMode GLINT_TAG_ADDR(0x01,0x04) -#define RMMultiGLINT 1<<17 -#define BitMaskPackingEachScanline 1<<9 -#define ForceBackgroundColor 1<<6 -#define InvertBitMask 1<<1 - -#define YLimits GLINT_TAG_ADDR(0x01,0x05) -#define ScanLineOwnership GLINT_TAG_ADDR(0x01,0x06) -#define WaitForCompletion GLINT_TAG_ADDR(0x01,0x07) -#define PixelSize GLINT_TAG_ADDR(0x01,0x08) -#define XLimits GLINT_TAG_ADDR(0x01,0x09) /* PM only */ - -#define RectangleOrigin GLINT_TAG_ADDR(0x01,0x0A) /* PM2 only */ -#define RectangleSize GLINT_TAG_ADDR(0x01,0x0B) /* PM2 only */ - -#define PackedDataLimits GLINT_TAG_ADDR(0x02,0x0a) /* PM only */ - -#define ScissorMode GLINT_TAG_ADDR(0x03,0x00) -# define SCI_USER 0x01 -# define SCI_SCREEN 0x02 -# define SCI_USERANDSCREEN 0x03 - -#define ScissorMinXY GLINT_TAG_ADDR(0x03,0x01) -#define ScissorMaxXY GLINT_TAG_ADDR(0x03,0x02) -#define ScreenSize GLINT_TAG_ADDR(0x03,0x03) -#define AreaStippleMode GLINT_TAG_ADDR(0x03,0x04) - /* 0: */ - /* NoMirrorY */ - /* NoMirrorX */ - /* NoInvertPattern */ - /* YAddress_1bit */ - /* XAddress_1bit */ - /* UNIT_DISABLE */ - -# define ASM_XAddress_2bit 1 << 1 -# define ASM_XAddress_3bit 2 << 1 -# define ASM_XAddress_4bit 3 << 1 -# define ASM_XAddress_5bit 4 << 1 -# define ASM_YAddress_2bit 1 << 4 -# define ASM_YAddress_3bit 2 << 4 -# define ASM_YAddress_4bit 3 << 4 -# define ASM_YAddress_5bit 4 << 4 -# define ASM_InvertPattern 1 << 17 -# define ASM_MirrorX 1 << 18 -# define ASM_MirrorY 1 << 19 - -#define LineStippleMode GLINT_TAG_ADDR(0x03,0x05) -#define LoadLineStippleCounters GLINT_TAG_ADDR(0x03,0x06) -#define UpdateLineStippleCounters GLINT_TAG_ADDR(0x03,0x07) -#define SaveLineStippleState GLINT_TAG_ADDR(0x03,0x08) -#define WindowOrigin GLINT_TAG_ADDR(0x03,0x09) - -#define AreaStipplePattern0 GLINT_TAG_ADDR(0x04,0x00) -#define AreaStipplePattern1 GLINT_TAG_ADDR(0x04,0x01) -#define AreaStipplePattern2 GLINT_TAG_ADDR(0x04,0x02) -#define AreaStipplePattern3 GLINT_TAG_ADDR(0x04,0x03) -#define AreaStipplePattern4 GLINT_TAG_ADDR(0x04,0x04) -#define AreaStipplePattern5 GLINT_TAG_ADDR(0x04,0x05) -#define AreaStipplePattern6 GLINT_TAG_ADDR(0x04,0x06) -#define AreaStipplePattern7 GLINT_TAG_ADDR(0x04,0x07) - -#define TextureAddressMode GLINT_TAG_ADDR(0x07,0x00) -#define SStart GLINT_TAG_ADDR(0x07,0x01) -#define dSdx GLINT_TAG_ADDR(0x07,0x02) -#define dSdyDom GLINT_TAG_ADDR(0x07,0x03) -#define TStart GLINT_TAG_ADDR(0x07,0x04) -#define dTdx GLINT_TAG_ADDR(0x07,0x05) -#define dTdyDom GLINT_TAG_ADDR(0x07,0x06) -#define QStart GLINT_TAG_ADDR(0x07,0x07) -#define dQdx GLINT_TAG_ADDR(0x07,0x08) -#define dQdyDom GLINT_TAG_ADDR(0x07,0x09) -#define LOD GLINT_TAG_ADDR(0x07,0x0A) -#define dSdy GLINT_TAG_ADDR(0x07,0x0B) -#define dTdy GLINT_TAG_ADDR(0x07,0x0C) -#define dQdy GLINT_TAG_ADDR(0x07,0x0D) - -#define TextureReadMode GLINT_TAG_ADDR(0x09,0x00) - -#define TextureFormat GLINT_TAG_ADDR(0x09,0x01) -# define Texture_4_Components 3 << 3 -# define Texture_Texel 0 - -#define TextureCacheControl GLINT_TAG_ADDR(0x09,0x02) -# define TextureCacheControlEnable 2 -# define TextureCacheControlInvalidate 1 - -#define GLINTBorderColor GLINT_TAG_ADDR(0x09,0x05) - -#define TexelLUTIndex GLINT_TAG_ADDR(0x09,0x08) -#define TexelLUTData GLINT_TAG_ADDR(0x09,0x09) -#define TexelLUTAddress GLINT_TAG_ADDR(0x09,0x0A) -#define TexelLUTTransfer GLINT_TAG_ADDR(0x09,0x0B) - -#define TextureFilterMode GLINT_TAG_ADDR(0x09,0x0C) - -#define TextureChromaUpper GLINT_TAG_ADDR(0x09,0x0D) -#define TextureChromaLower GLINT_TAG_ADDR(0x09,0x0E) - -#define TxBaseAddr0 GLINT_TAG_ADDR(0x0A,0x00) -#define TxBaseAddr1 GLINT_TAG_ADDR(0x0A,0x01) -#define TxBaseAddr2 GLINT_TAG_ADDR(0x0A,0x02) -#define TxBaseAddr3 GLINT_TAG_ADDR(0x0A,0x03) -#define TxBaseAddr4 GLINT_TAG_ADDR(0x0A,0x04) -#define TxBaseAddr5 GLINT_TAG_ADDR(0x0A,0x05) -#define TxBaseAddr6 GLINT_TAG_ADDR(0x0A,0x06) -#define TxBaseAddr7 GLINT_TAG_ADDR(0x0A,0x07) -#define TxBaseAddr8 GLINT_TAG_ADDR(0x0A,0x08) -#define TxBaseAddr9 GLINT_TAG_ADDR(0x0A,0x09) -#define TxBaseAddr10 GLINT_TAG_ADDR(0x0A,0x0A) -#define TxBaseAddr11 GLINT_TAG_ADDR(0x0A,0x0B) - -#define PMTextureBaseAddress GLINT_TAG_ADDR(0x0b,0x00) -#define PMTextureMapFormat GLINT_TAG_ADDR(0x0b,0x01) -#define PMTextureDataFormat GLINT_TAG_ADDR(0x0b,0x02) - -#define Texel0 GLINT_TAG_ADDR(0x0c,0x00) -#define Texel1 GLINT_TAG_ADDR(0x0c,0x01) -#define Texel2 GLINT_TAG_ADDR(0x0c,0x02) -#define Texel3 GLINT_TAG_ADDR(0x0c,0x03) -#define Texel4 GLINT_TAG_ADDR(0x0c,0x04) -#define Texel5 GLINT_TAG_ADDR(0x0c,0x05) -#define Texel6 GLINT_TAG_ADDR(0x0c,0x06) -#define Texel7 GLINT_TAG_ADDR(0x0c,0x07) - -#define Interp0 GLINT_TAG_ADDR(0x0c,0x08) -#define Interp1 GLINT_TAG_ADDR(0x0c,0x09) -#define Interp2 GLINT_TAG_ADDR(0x0c,0x0a) -#define Interp3 GLINT_TAG_ADDR(0x0c,0x0b) -#define Interp4 GLINT_TAG_ADDR(0x0c,0x0c) - -#define TextureFilter GLINT_TAG_ADDR(0x0c,0x0d) -#define PMTextureReadMode GLINT_TAG_ADDR(0x0c,0x0e) -#define TexelLUTMode GLINT_TAG_ADDR(0x0c,0x0f) - -#define TextureColorMode GLINT_TAG_ADDR(0x0d,0x00) -# define TextureTypeOpenGL 0 -# define TextureTypeApple 1 << 4 -# define TextureKsDDA 1 << 5 /* only Apple-Mode */ -# define TextureKdDDA 1 << 6 /* only Apple-Mode */ - -#define TextureEnvColor GLINT_TAG_ADDR(0x0d,0x01) -#define FogMode GLINT_TAG_ADDR(0x0d,0x02) - /* 0: */ - /* FOG RGBA */ - /* UNIT_DISABLE */ -# define FOG_CI 0x0002 - -#define FogColor GLINT_TAG_ADDR(0x0d,0x03) -#define FStart GLINT_TAG_ADDR(0x0d,0x04) -#define dFdx GLINT_TAG_ADDR(0x0d,0x05) -#define dFdyDom GLINT_TAG_ADDR(0x0d,0x06) -#define KsStart GLINT_TAG_ADDR(0x0d,0x09) -#define dKsdx GLINT_TAG_ADDR(0x0d,0x0a) -#define dKsdyDom GLINT_TAG_ADDR(0x0d,0x0b) -#define KdStart GLINT_TAG_ADDR(0x0d,0x0c) -#define dKdStart GLINT_TAG_ADDR(0x0d,0x0d) -#define dKddyDom GLINT_TAG_ADDR(0x0d,0x0e) - -#define RStart GLINT_TAG_ADDR(0x0f,0x00) -#define dRdx GLINT_TAG_ADDR(0x0f,0x01) -#define dRdyDom GLINT_TAG_ADDR(0x0f,0x02) -#define GStart GLINT_TAG_ADDR(0x0f,0x03) -#define dGdx GLINT_TAG_ADDR(0x0f,0x04) -#define dGdyDom GLINT_TAG_ADDR(0x0f,0x05) -#define BStart GLINT_TAG_ADDR(0x0f,0x06) -#define dBdx GLINT_TAG_ADDR(0x0f,0x07) -#define dBdyDom GLINT_TAG_ADDR(0x0f,0x08) -#define AStart GLINT_TAG_ADDR(0x0f,0x09) -#define dAdx GLINT_TAG_ADDR(0x0f,0x0a) -#define dAdyDom GLINT_TAG_ADDR(0x0f,0x0b) -#define ColorDDAMode GLINT_TAG_ADDR(0x0f,0x0c) - /* 0:*/ - /* UNIT_DISABLE */ -# define CDDA_FlatShading 0 -# define CDDA_GouraudShading 0x0002 - - -#define ConstantColor GLINT_TAG_ADDR(0x0f,0x0d) -#define GLINTColor GLINT_TAG_ADDR(0x0f,0x0e) -#define AlphaTestMode GLINT_TAG_ADDR(0x10,0x00) -#define AntialiasMode GLINT_TAG_ADDR(0x10,0x01) -#define AlphaBlendMode GLINT_TAG_ADDR(0x10,0x02) - /* 0: */ - /* SrcZERO */ - /* DstZERO */ - /* ColorFormat8888 */ - /* AlphaBuffer present */ - /* ColorOrderBGR */ - /* TypeOpenGL */ - /* DstFBData */ - /* UNIT_DISABLE */ - -# define ABM_SrcONE 1 << 1 -# define ABM_SrcDST_COLOR 2 << 1 -# define ABM_SrcONE_MINUS_DST_COLOR 3 << 1 -# define ABM_SrcSRC_ALPHA 4 << 1 -# define ABM_SrcONE_MINUS_SRC_ALPHA 5 << 1 -# define ABM_SrcDST_ALPHA 6 << 1 -# define ABM_SrcONE_MINUS_DST_ALPHA 7 << 1 -# define ABM_SrcSRC_ALPHA_SATURATE 8 << 1 -# define ABM_DstONE 1 << 5 -# define ABM_DstSRC_COLOR 2 << 5 -# define ABM_DstONE_MINUS_SRC_COLOR 3 << 5 -# define ABM_DstSRC_ALPHA 4 << 5 -# define ABM_DstONE_MINUS_SRC_ALPHA 5 << 5 -# define ABM_DstDST_ALPHA 6 << 5 -# define ABM_DstONE_MINUS_DST_ALPHA 7 << 5 -# define ABM_ColorFormat5555 1 << 8 -# define ABM_ColorFormat4444 2 << 8 -# define ABM_ColorFormat4444_Front 3 << 8 -# define ABM_ColorFormat4444_Back 4 << 8 -# define ABM_ColorFormat332_Front 5 << 8 -# define ABM_ColorFormat332_Back 6 << 8 -# define ABM_ColorFormat121_Front 7 << 8 -# define ABM_ColorFormat121_Back 8 << 8 -# define ABM_ColorFormat555_Back 13 << 8 -# define ABM_ColorFormat_CI8 14 << 8 -# define ABM_ColorFormat_CI4 15 << 8 -# define ABM_NoAlphaBuffer 0x1000 -# define ABM_ColorOrderRGB 0x2000 -# define ABM_TypeQuickDraw3D 0x4000 -# define ABM_DstFBSourceData 0x8000 - -#define DitherMode GLINT_TAG_ADDR(0x10,0x03) - /* 0: */ - /* ColorOrder BGR */ - /* AlphaDitherDefault */ - /* ColorFormat8888 */ - /* TruncateMode */ - /* DitherDisable */ - /* UNIT_DISABLE */ - -# define DTM_DitherEnable 1 << 1 -# define DTM_ColorFormat5555 1 << 2 -# define DTM_ColorFormat4444 2 << 2 -# define DTM_ColorFormat4444_Front 3 << 2 -# define DTM_ColorFormat4444_Back 4 << 2 -# define DTM_ColorFormat332_Front 5 << 2 -# define DTM_ColorFormat332_Back 6 << 2 -# define DTM_ColorFormat121_Front 7 << 2 -# define DTM_ColorFormat121_Back 8 << 2 -# define DTM_ColorFormat555_Back 13 << 2 -# define DTM_ColorFormat_CI8 14 << 2 -# define DTM_ColorFormat_CI4 15 << 2 -# define DTM_ColorOrderRGB 1 << 10 -# define DTM_NoAlphaDither 1 << 14 -# define DTM_RoundMode 1 << 15 - -#define FBSoftwareWriteMask GLINT_TAG_ADDR(0x10,0x04) -#define LogicalOpMode GLINT_TAG_ADDR(0x10,0x05) -# define Use_ConstantFBWriteData 0x40 - - -#define FBWriteData GLINT_TAG_ADDR(0x10,0x06) -#define RouterMode GLINT_TAG_ADDR(0x10,0x08) -# define ROUTER_Depth_Texture 1 -# define ROUTER_Texture_Depth 0 - - -#define LBReadMode GLINT_TAG_ADDR(0x11,0x00) - /* 0: */ - /* SrcNoRead */ - /* DstNoRead */ - /* DataLBDefault */ - /* WinTopLeft */ - /* NoPatch */ - /* ScanlineInterval1 */ - -# define LBRM_SrcEnable 1 << 9 -# define LBRM_DstEnable 1 << 10 -# define LBRM_DataLBStencil 1 << 16 -# define LBRM_DataLBDepth 2 << 16 -# define LBRM_WinBottomLeft 1 << 18 -# define LBRM_DoPatch 1 << 19 - -# define LBRM_ScanlineInt2 1 << 20 -# define LBRM_ScanlineInt4 2 << 20 -# define LBRM_ScanlineInt8 3 << 20 - - -#define LBReadFormat GLINT_TAG_ADDR(0x11,0x01) -# define LBRF_DepthWidth15 0x03 /* only permedia */ -# define LBRF_DepthWidth16 0x00 -# define LBRF_DepthWidth24 0x01 -# define LBRF_DepthWidth32 0x02 - -# define LBRF_StencilWidth0 (0 << 2) -# define LBRF_StencilWidth4 (1 << 2) -# define LBRF_StencilWidth8 (2 << 2) - -# define LBRF_StencilPos16 (0 << 4) -# define LBRF_StencilPos20 (1 << 4) -# define LBRF_StencilPos24 (2 << 4) -# define LBRF_StencilPos28 (3 << 4) -# define LBRF_StencilPos32 (4 << 4) - -# define LBRF_FrameCount0 (0 << 7) -# define LBRF_FrameCount4 (1 << 7) -# define LBRF_FrameCount8 (2 << 7) - -# define LBRF_FrameCountPos16 (0 << 9) -# define LBRF_FrameCountPos20 (1 << 9) -# define LBRF_FrameCountPos24 (2 << 9) -# define LBRF_FrameCountPos28 (3 << 9) -# define LBRF_FrameCountPos32 (4 << 9) -# define LBRF_FrameCountPos36 (5 << 9) -# define LBRF_FrameCountPos40 (6 << 9) - -# define LBRF_GIDWidth0 (0 << 12) -# define LBRF_GIDWidth4 (1 << 12) - -# define LBRF_GIDPos16 (0 << 13) -# define LBRF_GIDPos20 (1 << 13) -# define LBRF_GIDPos24 (2 << 13) -# define LBRF_GIDPos28 (3 << 13) -# define LBRF_GIDPos32 (4 << 13) -# define LBRF_GIDPos36 (5 << 13) -# define LBRF_GIDPos40 (6 << 13) -# define LBRF_GIDPos44 (7 << 13) -# define LBRF_GIDPos48 (8 << 13) - -# define LBRF_Compact32 (1 << 17) - - - -#define LBSourceOffset GLINT_TAG_ADDR(0x11,0x02) -#define LBStencil GLINT_TAG_ADDR(0x11,0x05) -#define LBDepth GLINT_TAG_ADDR(0x11,0x06) -#define LBWindowBase GLINT_TAG_ADDR(0x11,0x07) -#define LBWriteMode GLINT_TAG_ADDR(0x11,0x08) -# define LBWM_WriteEnable 0x1 -# define LBWM_UpLoad_LBDepth 0x2 -# define LBWM_UpLoad_LBStencil 0x4 - -#define LBWriteFormat GLINT_TAG_ADDR(0x11,0x09) - - -#define TextureData GLINT_TAG_ADDR(0x11,0x0d) -#define TextureDownloadOffset GLINT_TAG_ADDR(0x11,0x0e) -#define LBWindowOffset GLINT_TAG_ADDR(0x11,0x0f) - -#define GLINTWindow GLINT_TAG_ADDR(0x13,0x00) -# define GWIN_UnitEnable (1 << 0) -# define GWIN_ForceLBUpdate (1 << 3) -# define GWIN_LBUpdateSourceREG (1 << 4) -# define GWIN_LBUpdateSourceLB (0 << 4) -# define GWIN_StencilFCP (1 << 17) -# define GWIN_DepthFCP (1 << 18) -# define GWIN_OverrideWriteFilter (1 << 19) -# define GWIN_DisableLBUpdate 0x40000 /* ??? is this needed, set by permedia (2) modules */ - -#define StencilMode GLINT_TAG_ADDR(0x13,0x01) -#define StencilData GLINT_TAG_ADDR(0x13,0x02) -#define GLINTStencil GLINT_TAG_ADDR(0x13,0x03) -#define DepthMode GLINT_TAG_ADDR(0x13,0x04) - /* 0: */ - /* WriteDisable */ - /* SrcCompFragment */ - /* CompFuncNEVER */ - /* UNIT_DISABLE */ - -# define DPM_WriteEnable 1 << 1 -# define DPM_SrcCompLBData 1 << 2 -# define DPM_SrcCompDregister 2 << 2 -# define DPM_SrcCompLBSourceData 3 << 2 -# define DPM_CompFuncLESS 1 << 4 -# define DPM_CompFuncEQUAL 2 << 4 -# define DPM_CompFuncLESS_OR_EQ 3 << 4 -# define DPM_CompFuncGREATER 4 << 4 -# define DPM_CompFuncNOT_EQ 5 << 4 -# define DPM_CompFuncGREATER_OR_EQ 6 << 4 -# define DPM_CompFuncALWAYS 7 << 4 - -#define GLINTDepth GLINT_TAG_ADDR(0x13,0x05) -#define ZStartU GLINT_TAG_ADDR(0x13,0x06) -#define ZStartL GLINT_TAG_ADDR(0x13,0x07) -#define dZdxU GLINT_TAG_ADDR(0x13,0x08) -#define dZdxL GLINT_TAG_ADDR(0x13,0x09) -#define dZdyDomU GLINT_TAG_ADDR(0x13,0x0a) -#define dZdyDomL GLINT_TAG_ADDR(0x13,0x0b) -#define FastClearDepth GLINT_TAG_ADDR(0x13,0x0c) - -#define FBReadMode GLINT_TAG_ADDR(0x15,0x00) - /* 0: */ - /* SrcNoRead */ - /* DstNoRead */ - /* DataFBDefault */ - /* WinTopLeft */ - /* ScanlineInterval1 */ - -# define FBRM_SrcEnable 1 << 9 -# define FBRM_DstEnable 1 << 10 -# define FBRM_DataFBColor 1 << 15 -# define FBRM_WinBottomLeft 1 << 16 -# define FBRM_Packed 1 << 19 -# define FBRM_ScanlineInt2 1 << 23 -# define FBRM_ScanlineInt4 2 << 23 -# define FBRM_ScanlineInt8 3 << 23 - - -#define FBSourceOffset GLINT_TAG_ADDR(0x15,0x01) -#define FBPixelOffset GLINT_TAG_ADDR(0x15,0x02) -#define FBColor GLINT_TAG_ADDR(0x15,0x03) -#define FBData GLINT_TAG_ADDR(0x15,0x04) -#define FBSourceData GLINT_TAG_ADDR(0x15,0x05) - -#define FBWindowBase GLINT_TAG_ADDR(0x15,0x06) -#define FBWriteMode GLINT_TAG_ADDR(0x15,0x07) - /* 0: */ - /* FBWM_NoColorUpload */ - /* FBWM_WriteDisable */ -# define FBWM_WriteEnable 1 -# define FBWM_UploadColor 1 << 3 -# define FBWM_Enable0 1 << 12 /* PM3 */ - -#define FBHardwareWriteMask GLINT_TAG_ADDR(0x15,0x08) -#define FBBlockColor GLINT_TAG_ADDR(0x15,0x09) -#define FBReadPixel GLINT_TAG_ADDR(0x15,0x0a) /* PM */ -#define PatternRamMode GLINT_TAG_ADDR(0x15,0x0f) - -#define PatternRamData0 GLINT_TAG_ADDR(0x16,0x00) -#define PatternRamData1 GLINT_TAG_ADDR(0x16,0x01) -#define PatternRamData2 GLINT_TAG_ADDR(0x16,0x02) -#define PatternRamData3 GLINT_TAG_ADDR(0x16,0x03) -#define PatternRamData4 GLINT_TAG_ADDR(0x16,0x04) -#define PatternRamData5 GLINT_TAG_ADDR(0x16,0x05) -#define PatternRamData6 GLINT_TAG_ADDR(0x16,0x06) -#define PatternRamData7 GLINT_TAG_ADDR(0x16,0x07) - -#define FilterMode GLINT_TAG_ADDR(0x18,0x00) - /* 0: */ - /* CullDepthTags */ - /* CullDepthData */ - /* CullStencilTags */ - /* CullStencilData */ - /* CullColorTag */ - /* CullColorData */ - /* CullSyncTag */ - /* CullSyncData */ - /* CullStatisticTag */ - /* CullStatisticData */ - -# define FM_PassDepthTags 0x0010 -# define FM_PassDepthData 0x0020 -# define FM_PassStencilTags 0x0040 -# define FM_PassStencilData 0x0080 -# define FM_PassColorTag 0x0100 -# define FM_PassColorData 0x0200 -# define FM_PassSyncTag 0x0400 -# define FM_PassSyncData 0x0800 -# define FM_PassStatisticTag 0x1000 -# define FM_PassStatisticData 0x2000 - -#define Sync_tag 0x0188 - -#define StatisticMode GLINT_TAG_ADDR(0x18,0x01) -#define MinRegion GLINT_TAG_ADDR(0x18,0x02) -#define MaxRegion GLINT_TAG_ADDR(0x18,0x03) -#define ResetPickResult GLINT_TAG_ADDR(0x18,0x04) -#define MitHitRegion GLINT_TAG_ADDR(0x18,0x05) -#define MaxHitRegion GLINT_TAG_ADDR(0x18,0x06) -#define PickResult GLINT_TAG_ADDR(0x18,0x07) -#define GlintSync GLINT_TAG_ADDR(0x18,0x08) - -#define FBBlockColorU GLINT_TAG_ADDR(0x18,0x0d) -#define FBBlockColorL GLINT_TAG_ADDR(0x18,0x0e) -#define SuspendUntilFrameBlank GLINT_TAG_ADDR(0x18,0x0f) - -#define KsRStart GLINT_TAG_ADDR(0x19,0x00) -#define dKsRdx GLINT_TAG_ADDR(0x19,0x01) -#define dKsRdyDom GLINT_TAG_ADDR(0x19,0x02) -#define KsGStart GLINT_TAG_ADDR(0x19,0x03) -#define dKsGdx GLINT_TAG_ADDR(0x19,0x04) -#define dKsGdyDom GLINT_TAG_ADDR(0x19,0x05) -#define KsBStart GLINT_TAG_ADDR(0x19,0x06) -#define dKsBdx GLINT_TAG_ADDR(0x19,0x07) -#define dKsBdyDom GLINT_TAG_ADDR(0x19,0x08) - -#define KdRStart GLINT_TAG_ADDR(0x1A,0x00) -#define dKdRdx GLINT_TAG_ADDR(0x1A,0x01) -#define dKdRdyDom GLINT_TAG_ADDR(0x1A,0x02) -#define KdGStart GLINT_TAG_ADDR(0x1A,0x03) -#define dKdGdx GLINT_TAG_ADDR(0x1A,0x04) -#define dKdGdyDom GLINT_TAG_ADDR(0x1A,0x05) -#define KdBStart GLINT_TAG_ADDR(0x1A,0x06) -#define dKdBdx GLINT_TAG_ADDR(0x1A,0x07) -#define dKdBdyDom GLINT_TAG_ADDR(0x1A,0x08) - -#define FBSourceBase GLINT_TAG_ADDR(0x1B,0x00) -#define FBSourceDelta GLINT_TAG_ADDR(0x1B,0x01) -#define Config GLINT_TAG_ADDR(0x1B,0x02) -#define CFBRM_SrcEnable 1<<0 -#define CFBRM_DstEnable 1<<1 -#define CFBRM_Packed 1<<2 -#define CWM_Enable 1<<3 -#define CCDDA_Enable 1<<4 -#define CLogOp_Enable 1<<5 -#define ContextDump GLINT_TAG_ADDR(0x1B,0x08) -#define ContextRestore GLINT_TAG_ADDR(0x1B,0x09) -#define ContextData GLINT_TAG_ADDR(0x1B,0x0a) - -#define TexelLUT0 GLINT_TAG_ADDR(0x1D,0x00) -#define TexelLUT1 GLINT_TAG_ADDR(0x1D,0x01) -#define TexelLUT2 GLINT_TAG_ADDR(0x1D,0x02) -#define TexelLUT3 GLINT_TAG_ADDR(0x1D,0x03) -#define TexelLUT4 GLINT_TAG_ADDR(0x1D,0x04) -#define TexelLUT5 GLINT_TAG_ADDR(0x1D,0x05) -#define TexelLUT6 GLINT_TAG_ADDR(0x1D,0x06) -#define TexelLUT7 GLINT_TAG_ADDR(0x1D,0x07) -#define TexelLUT8 GLINT_TAG_ADDR(0x1D,0x08) -#define TexelLUT9 GLINT_TAG_ADDR(0x1D,0x09) -#define TexelLUT10 GLINT_TAG_ADDR(0x1D,0x0A) -#define TexelLUT11 GLINT_TAG_ADDR(0x1D,0x0B) -#define TexelLUT12 GLINT_TAG_ADDR(0x1D,0x0C) -#define TexelLUT13 GLINT_TAG_ADDR(0x1D,0x0D) -#define TexelLUT14 GLINT_TAG_ADDR(0x1D,0x0E) -#define TexelLUT15 GLINT_TAG_ADDR(0x1D,0x0F) - -#define YUVMode GLINT_TAG_ADDR(0x1E,0x00) -#define ChromaUpper GLINT_TAG_ADDR(0x1E,0x01) -#define ChromaLower GLINT_TAG_ADDR(0x1E,0x02) -#define ChromaTestMode GLINT_TAG_ADDR(0x1E,0x03) - - -/****************************** - * GLINT Delta Core Registers * - ******************************/ - -#define V0FixedTag GLINT_TAG_ADDR(0x20,0x00) -#define V1FixedTag GLINT_TAG_ADDR(0x21,0x00) -#define V2FixedTag GLINT_TAG_ADDR(0x22,0x00) -#define V0FloatTag GLINT_TAG_ADDR(0x23,0x00) -#define V1FloatTag GLINT_TAG_ADDR(0x24,0x00) -#define V2FloatTag GLINT_TAG_ADDR(0x25,0x00) - -#define VPAR_s 0x00 -#define VPAR_t 0x08 -#define VPAR_q 0x10 -#define VPAR_Ks 0x18 -#define VPAR_Kd 0x20 - -/* have changed colors in ramdac ! -#define VPAR_R 0x28 -#define VPAR_G 0x30 -#define VPAR_B 0x38 -#define VPAR_A 0x40 -*/ -#define VPAR_B 0x28 -#define VPAR_G 0x30 -#define VPAR_R 0x38 -#define VPAR_A 0x40 - -#define VPAR_f 0x48 - -#define VPAR_x 0x50 -#define VPAR_y 0x58 -#define VPAR_z 0x60 - -#define DeltaModeTag GLINT_TAG_ADDR(0x26,0x00) - /* 0: */ - /* GLINT_300SX */ - - /* DeltaMode Register Bit Field Assignments */ -# define DM_GLINT_300SX 0x0000 -# define DM_GLINT_500TX 0x0001 -# define DM_PERMEDIA 0x0002 -# define DM_Depth_16BPP (1 << 2) -# define DM_Depth_24BPP (2 << 2) -# define DM_Depth_32BPP (3 << 2) -# define DM_FogEnable 0x0010 -# define DM_TextureEnable 0x0020 -# define DM_SmoothShadingEnable 0x0040 -# define DM_DepthEnable 0x0080 -# define DM_SpecularTextureEnable 0x0100 -# define DM_DiffuseTextureEnable 0x0200 -# define DM_SubPixelCorrectionEnable 0x0400 -# define DM_DiamondExit 0x0800 -# define DM_NoDraw 0x1000 -# define DM_ClampEnable 0x2000 -# define DM_ClampedTexParMode 0x4000 -# define DM_NormalizedTexParMode 0xC000 - - -# define DDCMD_AreaStrippleEnable 0x0001 -# define DDCMD_LineStrippleEnable 0x0002 -# define DDCMD_ResetLineStripple 1 << 2 -# define DDCMD_FastFillEnable 1 << 3 - /* 2 Bits reserved */ -# define DDCMD_PrimitiveType_Point 2 << 6 -# define DDCMD_PrimitiveType_Line 0 << 6 -# define DDCMD_PrimitiveType_Trapezoid 1 << 6 -# define DDCMD_AntialiasEnable 1 << 8 -# define DDCMD_AntialiasingQuality 1 << 9 -# define DDCMD_UsePointTable 1 << 10 -# define DDCMD_SyncOnBitMask 1 << 11 -# define DDCMD_SyncOnHostDate 1 << 12 -# define DDCMD_TextureEnable 1 << 13 -# define DDCMD_FogEnable 1 << 14 -# define DDCMD_CoverageEnable 1 << 15 -# define DDCMD_SubPixelCorrectionEnable 1 << 16 - - - -#define DrawTriangle GLINT_TAG_ADDR(0x26,0x01) -#define RepeatTriangle GLINT_TAG_ADDR(0x26,0x02) -#define DrawLine01 GLINT_TAG_ADDR(0x26,0x03) -#define DrawLine10 GLINT_TAG_ADDR(0x26,0x04) -#define RepeatLine GLINT_TAG_ADDR(0x26,0x05) -#define BroadcastMask GLINT_TAG_ADDR(0x26,0x0F) - -/* Permedia 3 - Accelerator Extensions */ -#define FillRectanglePosition 0x8348 -#define FillRender2D 0x8350 -#define FBDstReadBufAddr0 0xAE80 -#define FBDstReadBufOffset0 0xAEA0 -#define FBDstReadBufWidth0 0xAEC0 -#define FBDstReadMode 0xAEE0 -#define FBDRM_Enable0 1<<8 -#define FBDRM_Blocking 1<<24 -#define FBDstReadEnables 0xAEE8 -#define FBSrcReadMode 0xAF00 -#define FBSRM_Blocking 1<<11 -#define FBSrcReadBufAddr 0xAF08 -#define FBSrcReadBufOffset0 0xAF10 -#define FBSrcReadBufWidth 0xAF18 -#define FBWriteBufAddr0 0xB000 -#define FBWriteBufOffset0 0xB020 -#define FBWriteBufWidth0 0xB040 -#define FBBlockColorBack 0xB0A0 -#define ForegroundColor 0xB0C0 -#define BackgroundColor 0xB0C8 -#define RectanglePosition 0xB600 -#define Render2D 0xB640 - -/* Colorformats */ -#define BGR555 1 -#define BGR565 16 -#define CI8 14 -#define CI4 15 - -#if 0 - -#ifdef DEBUG -#define GLINT_WRITE_REG(v,r) \ - GLINT_VERB_WRITE_REG(pGlint,v,r,__FILE__,__LINE__) -#define GLINT_READ_REG(r) \ - GLINT_VERB_READ_REG(pGlint,r,__FILE__,__LINE__) -#else - -#define GLINT_WRITE_REG(v,r) \ - MMIO_OUT32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r), (v)) -#define GLINT_READ_REG(r) \ - MMIO_IN32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r)) - -#endif /* DEBUG */ - -#define GLINT_WAIT(n) \ -do{ \ - if (pGlint->InFifoSpace>=(n)) \ - pGlint->InFifoSpace -= (n); \ - else { \ - int tmp; \ - while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \ - /* Clamp value due to bugs in PM3 */ \ - if (tmp > pGlint->FIFOSize) \ - tmp = pGlint->FIFOSize; \ - pGlint->InFifoSpace = tmp - (n); \ - } \ -}while(0) - -#define GLINTDACDelay(x) do { \ - int delay = x; \ - while(delay--){(void)GLINT_READ_REG(InFIFOSpace);}; \ - } while(0) - -#define GLINT_MASK_WRITE_REG(v,m,r) \ - GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r) - -#define GLINT_SLOW_WRITE_REG(v,r) \ -do{ \ - mem_barrier(); \ - GLINT_WAIT(pGlint->FIFOSize); \ - mem_barrier(); \ - GLINT_WRITE_REG(v,r); \ -}while(0) - -#define GLINT_SET_INDEX(index) \ -do{ \ - GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh); \ - GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow); \ -} while(0) - -#define REPLICATE(r) \ -{ \ - if (pScrn->bitsPerPixel == 16) { \ - r &= 0xFFFF; \ - r |= (r<<16); \ - } else \ - if (pScrn->bitsPerPixel == 8) { \ - r &= 0xFF; \ - r |= (r<<8); \ - r |= (r<<16); \ - } \ -} - -#ifndef XF86DRI -#define LOADROP(rop) \ -{ \ - if (pGlint->ROP != rop) { \ - GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \ - pGlint->ROP = rop; \ - } \ -} -#else -#define LOADROP(rop) \ - { \ - GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \ - pGlint->ROP = rop; \ - } -#endif - -#define CHECKCLIPPING \ -{ \ - if (pGlint->ClippingOn) { \ - pGlint->ClippingOn = FALSE; \ - GLINT_WAIT(1); \ - GLINT_WRITE_REG(0, ScissorMode); \ - } \ -} - -#ifndef XF86DRI -#define DO_PLANEMASK(planemask) \ -{ \ - if (planemask != pGlint->planemask) { \ - pGlint->planemask = planemask; \ - REPLICATE(planemask); \ - GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ - } \ -} -#else -#define DO_PLANEMASK(planemask) \ - { \ - pGlint->planemask = planemask; \ - REPLICATE(planemask); \ - GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ - } -#endif - -/* Permedia Save/Restore functions */ - -#define STOREREG(address,value) \ - pReg->glintRegs[address >> 3] = value; - -#define SAVEREG(address) \ - pReg->glintRegs[address >> 3] = GLINT_READ_REG(address); - -#define RESTOREREG(address) \ - GLINT_SLOW_WRITE_REG(pReg->glintRegs[address >> 3], address); - -#define STOREDAC(address,value) \ - pReg->DacRegs[address] = value; - -#define P2VOUT(address) \ - Permedia2vOutIndReg(pScrn, address, 0x00, pReg->DacRegs[address]); - -#define P2VIN(address) \ - pReg->DacRegs[address] = Permedia2vInIndReg(pScrn, address); - -/* RamDac Save/Restore functions, used by external DAC's */ - -#define STORERAMDAC(address,value) \ - ramdacReg->DacRegs[address] = value; - -/* Multi Chip access */ - -#define ACCESSCHIP1() \ - pGlint->IOOffset = 0; - -#define ACCESSCHIP2() \ - pGlint->IOOffset = 0x10000; - -#endif /* 0 */ - -#define GLINT_XY(x,y) (((x) & 0x0FFF) | (((y) & 0x0FFF) << 16)) - -#endif diff --git a/hw/kdrive/pm2/pm2.c b/hw/kdrive/pm2/pm2.c deleted file mode 100644 index 148f03abd..000000000 --- a/hw/kdrive/pm2/pm2.c +++ /dev/null @@ -1,295 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kaa.h" - -#include "pm2.h" - -#define PARTPROD(a,b,c) (((a)<<6) | ((b)<<3) | (c)) - -char bppand[4] = { 0x03, /* 8bpp */ - 0x01, /* 16bpp */ - 0x00, /* 24bpp */ - 0x00 /* 32bpp */}; - -int partprodPermedia[] = { - -1, - PARTPROD(0,0,1), PARTPROD(0,1,1), PARTPROD(1,1,1), PARTPROD(1,1,2), - PARTPROD(1,2,2), PARTPROD(2,2,2), PARTPROD(1,2,3), PARTPROD(2,2,3), - PARTPROD(1,3,3), PARTPROD(2,3,3), PARTPROD(1,2,4), PARTPROD(3,3,3), - PARTPROD(1,3,4), PARTPROD(2,3,4), -1, PARTPROD(3,3,4), - PARTPROD(1,4,4), PARTPROD(2,4,4), -1, PARTPROD(3,4,4), - -1, PARTPROD(2,3,5), -1, PARTPROD(4,4,4), - PARTPROD(1,4,5), PARTPROD(2,4,5), PARTPROD(3,4,5), -1, - -1, -1, -1, PARTPROD(4,4,5), - PARTPROD(1,5,5), PARTPROD(2,5,5), -1, PARTPROD(3,5,5), - -1, -1, -1, PARTPROD(4,5,5), - -1, -1, -1, PARTPROD(3,4,6), - -1, -1, -1, PARTPROD(5,5,5), - PARTPROD(1,5,6), PARTPROD(2,5,6), -1, PARTPROD(3,5,6), - -1, -1, -1, PARTPROD(4,5,6), - -1, -1, -1, -1, - -1, -1, -1, PARTPROD(5,5,6), - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - -1, -1, -1, -1, - 0}; - -static Bool -pmMapReg(KdCardInfo *card, PM2CardInfo *pm2c) -{ - pm2c->reg_base = (CARD8 *)KdMapDevice(PM2_REG_BASE(card), - PM2_REG_SIZE(card)); - - if (pm2c->reg_base == NULL) - return FALSE; - - KdSetMappedMode(PM2_REG_BASE(card), PM2_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -static void -pmUnmapReg(KdCardInfo *card, PM2CardInfo *pm2c) -{ - if (pm2c->reg_base) { - KdResetMappedMode(PM2_REG_BASE(card), PM2_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice((void *)pm2c->reg_base, PM2_REG_SIZE(card)); - pm2c->reg_base = 0; - } -} - -Bool -pmCardInit (KdCardInfo *card) -{ - PM2CardInfo *pm2c; - - pm2c = (PM2CardInfo *) xalloc (sizeof (PM2CardInfo)); - if (!pm2c) - return FALSE; - memset (pm2c, '\0', sizeof (PM2CardInfo)); - - (void) pmMapReg (card, pm2c); - - if (!vesaInitialize (card, &pm2c->vesa)) - { - xfree (pm2c); - return FALSE; - } - - pm2c->InFifoSpace = 0; - - card->driver = pm2c; - - return TRUE; -} - -static void -pmCardFini (KdCardInfo *card) -{ - PM2CardInfo *pm2c = (PM2CardInfo *) card->driver; - - pmUnmapReg (card, pm2c); - vesaCardFini (card); -} - -Bool -pmScreenInit (KdScreenInfo *screen) -{ - PM2CardInfo *pm2c = screen->card->driver; - PM2ScreenInfo *pm2s; - int screen_size, memory; - - pm2s = (PM2ScreenInfo *) xalloc (sizeof (PM2ScreenInfo)); - if (!pm2s) - return FALSE; - memset (pm2s, '\0', sizeof (PM2ScreenInfo)); - - if (!vesaScreenInitialize (screen, &pm2s->vesa)) - { - xfree (pm2s); - return FALSE; - } - - pm2c->pprod = partprodPermedia[screen->width >> 5]; - pm2c->bppalign = bppand[(screen->fb[0].bitsPerPixel>>3)-1]; - - pm2s->screen = pm2s->vesa.fb; - memory = pm2s->vesa.fb_size; - - screen_size = screen->fb[0].byteStride * screen->height; - - if (pm2s->screen && memory >= screen_size + 2048) - { - memory -= 2048; - pm2s->cursor_base = pm2s->screen + memory - 2048; - } - else - pm2s->cursor_base = 0; - memory -= screen_size; - if (memory > screen->fb[0].byteStride) - { - pm2s->off_screen = pm2s->screen + screen_size; - pm2s->off_screen_size = memory; - } - else - { - pm2s->off_screen = 0; - pm2s->off_screen_size = 0; - } - - switch (screen->fb[0].bitsPerPixel) { - case 8: - pm2c->BppShift = 2; - break; - case 16: - pm2c->BppShift = 1; - break; - case 24: - pm2c->BppShift = 2; - break; - case 32: - pm2c->BppShift = 0; - break; - } - - screen->driver = pm2s; - - return TRUE; -} - -static void -pmScreenFini (KdScreenInfo *screen) -{ - PM2ScreenInfo *pm2s = (PM2ScreenInfo *) screen->driver; - - vesaScreenFini (screen); - xfree (pm2s); - screen->driver = 0; -} - -static Bool -pmInitScreen (ScreenPtr pScreen) -{ - return vesaInitScreen (pScreen); -} - -#ifdef RANDR -static Bool -pmRandRSetConfig (ScreenPtr pScreen, - Rotation rotation, - int rate, - RRScreenSizePtr pSize) -{ - kaaWaitSync (pScreen); - - if (!vesaRandRSetConfig (pScreen, rotation, rate, pSize)) - return FALSE; - - return TRUE; -} - -static void -pmRandRInit (ScreenPtr pScreen) -{ - rrScrPriv(pScreen); - - pScrPriv->rrSetConfig = pmRandRSetConfig; -} -#endif - -static Bool -pmFinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - ret = vesaFinishInitScreen (pScreen); -#ifdef RANDR - pmRandRInit (pScreen); -#endif - return ret; -} - -static void -pmPreserve(KdCardInfo *card) -{ - vesaPreserve(card); -} - -static void -pmRestore(KdCardInfo *card) -{ - vesaRestore (card); -} - -static Bool -pmEnable (ScreenPtr pScreen) -{ - if (!vesaEnable (pScreen)) - return FALSE; - -#ifdef XV - KdXVEnable (pScreen); -#endif - - return TRUE; -} - -static void -pmDisable(ScreenPtr pScreen) -{ -#ifdef XV - KdXVDisable (pScreen); -#endif - vesaDisable (pScreen); -} - -static Bool -pmDPMS(ScreenPtr pScreen, int mode) -{ - return vesaDPMS (pScreen, mode); -} - -KdCardFuncs PM2Funcs = { - pmCardInit, /* cardinit */ - pmScreenInit, /* scrinit */ - pmInitScreen, /* initScreen */ - pmFinishInitScreen, /* finishInitScreen */ - vesaCreateResources, /* createRes */ - pmPreserve, /* preserve */ - pmEnable, /* enable */ - pmDPMS, /* dpms */ - pmDisable, /* disable */ - pmRestore, /* restore */ - pmScreenFini, /* scrfini */ - pmCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - NULL, /* recolorCursor */ - - pmDrawInit, /* initAccel */ - pmDrawEnable, /* enableAccel */ - pmDrawDisable, /* disableAccel */ - pmDrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; diff --git a/hw/kdrive/pm2/pm2.h b/hw/kdrive/pm2/pm2.h deleted file mode 100644 index e05903365..000000000 --- a/hw/kdrive/pm2/pm2.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef _PM2_H_ -#define _PM2_H_ -#include <vesa.h> -#include "kxv.h" -#include "klinux.h" - -#include "glint_regs.h" - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -#define PM2_REG_BASE(c) ((c)->attr.address[0] & 0xFFFFC000) -#define PM2_REG_SIZE(c) (0x10000) - -typedef struct _PM2CardInfo { - VesaCardPrivRec vesa; - CARD8 *reg_base; - - int InFifoSpace; - int FIFOSize; - - int pprod; - int bppalign; - - int ClippingOn; - - int ROP; - - int x; - int y; - int w; - int h; - - int FrameBufferReadMode; - int BppShift; - int BltScanDirection; - - int RasterizerSwap; - int PixelWidth; - int TexMapFormat; - int startxdom; - int startxsub; - int starty; - int count; - int dy; - int dxdom; - - int planemask; -} PM2CardInfo; - -#define getPM2CardInfo(kd) ((PM2CardInfo *) ((kd)->card->driver)) -#define pmCardInfo(kd) PM2CardInfo *pm2c = getPM2CardInfo(kd) - -typedef struct _PM2ScreenInfo { - VesaScreenPrivRec vesa; - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - KdVideoAdaptorPtr pAdaptor; - KaaScreenInfoRec kaa; -} PM2ScreenInfo; - -#define getPM2ScreenInfo(kd) ((PM2ScreenInfo *) ((kd)->screen->driver)) -#define pmScreenInfo(kd) PM2ScreenInfo *pm2s = getPM2ScreenInfo(kd) - -Bool -pmCardInit (KdCardInfo *card); - -Bool -pmScreenInit (KdScreenInfo *screen); - -Bool -pmDrawInit(ScreenPtr); - -void -pmDrawEnable (ScreenPtr); - -void -pmDrawDisable (ScreenPtr); - -void -pmDrawFini (ScreenPtr); - - -extern KdCardFuncs PM2Funcs; - -#define MMIO_OUT32(base, offset, val) \ -do { \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ -} while (0) - -# define MMIO_IN32(base, offset) \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) - -#define GLINT_WRITE_REG(v,r) \ - MMIO_OUT32(mmio,(unsigned long)(r), (v)) - -#define GLINT_READ_REG(r) \ - MMIO_IN32(mmio,(unsigned long)(r)) - -#define GLINT_SLOW_WRITE_REG(v,r) \ -do{ \ - GLINT_WAIT(card->FIFOSize); \ - GLINT_WRITE_REG(v,r); \ -}while(0) - -#define REPLICATE(r) \ -{ \ - if (pScreenPriv->screen->fb[0].bitsPerPixel == 16) { \ - r &= 0xFFFF; \ - r |= (r<<16); \ - } else \ - if (pScreenPriv->screen->fb[0].bitsPerPixel == 8) { \ - r &= 0xFF; \ - r |= (r<<8); \ - r |= (r<<16); \ - } \ -} - -#define DO_PLANEMASK(planemask) \ -{ \ - if (planemask != card->planemask) { \ - card->planemask = planemask; \ - REPLICATE(planemask); \ - GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ - } \ -} - -#define LOADROP(rop) \ -{ \ - if (card->ROP != rop) { \ - GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); \ - card->ROP = rop; \ - } \ -} - -#define GLINT_WAIT(n) \ -do{ \ - if (card->InFifoSpace>=(n)) \ - card->InFifoSpace -= (n); \ - else { \ - int tmp; \ - while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \ - /* Clamp value due to bugs in PM3 */ \ - if (tmp > card->FIFOSize) \ - tmp = card->FIFOSize; \ - card->InFifoSpace = tmp - (n); \ - } \ -}while(0) - -#define CHECKCLIPPING \ -{ \ - if (card->ClippingOn) { \ - card->ClippingOn = FALSE; \ - GLINT_WAIT(1); \ - GLINT_WRITE_REG(0, ScissorMode); \ - } \ -} - -#endif /* _PM2_H_ */ diff --git a/hw/kdrive/pm2/pm2_draw.c b/hw/kdrive/pm2/pm2_draw.c deleted file mode 100644 index 332fc8c8a..000000000 --- a/hw/kdrive/pm2/pm2_draw.c +++ /dev/null @@ -1,318 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kaa.h" - -#include "pm2.h" - -static PM2CardInfo *card; -static VOL8 *mmio; - -static void Permedia2LoadCoord(int x, int y, int w, int h); - -static void -pmWaitMarker (ScreenPtr pScreen, int marker) -{ - CHECKCLIPPING; - - while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(2); - GLINT_WRITE_REG(0x400, FilterMode); - GLINT_WRITE_REG(0, GlintSync); - do { - while(GLINT_READ_REG(OutFIFOWords) == 0); - } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); -} - -static Bool -pmPrepareSolid (PixmapPtr pPixmap, - int rop, - Pixel planemask, - Pixel color) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - KdScreenPriv(pScreen); - pmCardInfo(pScreenPriv); - - card = pm2c; - mmio = pm2c->reg_base; - - if (~planemask & FbFullMask(pPixmap->drawable.depth)) - return FALSE; - - REPLICATE(color); - - GLINT_WAIT(6); - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - GLINT_WRITE_REG(card->pprod, FBReadMode); - GLINT_WRITE_REG(color, FBBlockColor); - } else { - GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); - GLINT_WRITE_REG(color, ConstantColor); - /* We can use Packed mode for filling solid non-GXcopy rasters */ - GLINT_WRITE_REG(card->pprod|FBRM_DstEnable|FBRM_Packed, FBReadMode); - } - LOADROP(rop); - - return TRUE; -} - -static void -pmSolid (int x1, int y1, int x2, int y2) -{ - int speed = 0; - - if (card->ROP == GXcopy) { - GLINT_WAIT(3); - Permedia2LoadCoord(x1, y1, x2-x1, y2-y1); - speed = FastFillEnable; - } else { - GLINT_WAIT(4); - Permedia2LoadCoord(x1>>card->BppShift, y1, - ((x2-x1)+7)>>card->BppShift, y2-y1); - GLINT_WRITE_REG(x1<<16|(x1+(x2-x1)), PackedDataLimits); - speed = 0; - } - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | speed, Render); -} - -static void -pmDoneSolid (void) -{ -} - -static Bool -pmPrepareCopy (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - int dx, - int dy, - int rop, - Pixel planemask) -{ - ScreenPtr pScreen = pDstPixmap->drawable.pScreen; - KdScreenPriv(pScreen); - pmCardInfo(pScreenPriv); - - card = pm2c; - mmio = pm2c->reg_base; - - if (~planemask & FbFullMask(pDstPixmap->drawable.depth)) - return FALSE; - - card->BltScanDirection = ((dx >= 0 ? XPositive : 0) | (dy >= 0 ? YPositive : 0)); - - GLINT_WAIT(4); - DO_PLANEMASK(planemask); - - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - if ((rop == GXset) || (rop == GXclear)) { - card->FrameBufferReadMode = card->pprod; - } else - if ((rop == GXcopy) || (rop == GXcopyInverted)) { - card->FrameBufferReadMode = card->pprod |FBRM_SrcEnable; - } else { - card->FrameBufferReadMode = card->pprod | FBRM_SrcEnable | - FBRM_DstEnable; - } - LOADROP(rop); - - return TRUE; -} - - -static void -pmCopy (int x1, - int y1, - int x2, - int y2, - int w, - int h) -{ - char align; - - /* We can only use GXcopy for Packed modes */ - if (card->ROP != GXcopy) { - GLINT_WAIT(5); - GLINT_WRITE_REG(card->FrameBufferReadMode, FBReadMode); - Permedia2LoadCoord(x2, y2, w, h); - GLINT_WRITE_REG(((y1-y2)&0x0FFF)<<16 | ((x1-x2)&0x0FFF), FBSourceDelta); - } else { - align = (x2 & card->bppalign) - (x1 & card->bppalign); - GLINT_WAIT(6); - GLINT_WRITE_REG(card->FrameBufferReadMode|FBRM_Packed, FBReadMode); - Permedia2LoadCoord(x2>>card->BppShift, y2, - (w+7)>>card->BppShift, h); - GLINT_WRITE_REG(align<<29|x2<<16|(x2+w), PackedDataLimits); - GLINT_WRITE_REG(((y1-y2)&0x0FFF)<<16 | (((x1 & ~card->bppalign)-(x2 & ~card->bppalign))&0x0FFF), FBSourceDelta); - } - - GLINT_WRITE_REG(PrimitiveRectangle | card->BltScanDirection, Render); -} - - -static void -pmDoneCopy (void) -{ -} - -static void -Permedia2LoadCoord(int x, int y, - int w, int h) -{ - if ((h != card->h) || (w != card->w)) { - card->w = w; - card->h = h; - GLINT_WRITE_REG(((h&0x0FFF)<<16)|(w&0x0FFF), RectangleSize); - } - if ((y != card->y) || (x != card->x)) { - card->x = x; - card->y = y; - GLINT_WRITE_REG(((y&0x0FFF)<<16)|(x&0x0FFF), RectangleOrigin); - } -} - - -Bool -pmDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - pmCardInfo(pScreenPriv); - pmScreenInfo(pScreenPriv); - Bool ret = TRUE; - - card = pm2c; - mmio = pm2c->reg_base; - - memset(&pm2s->kaa, 0, sizeof(KaaScreenInfoRec)); - pm2s->kaa.waitMarker = pmWaitMarker; - pm2s->kaa.PrepareSolid = pmPrepareSolid; - pm2s->kaa.Solid = pmSolid; - pm2s->kaa.DoneSolid = pmDoneSolid; - pm2s->kaa.PrepareCopy = pmPrepareCopy; - pm2s->kaa.Copy = pmCopy; - pm2s->kaa.DoneCopy = pmDoneCopy; - - if (ret && !kaaDrawInit (pScreen, &pm2s->kaa)) - { - ErrorF ("kaaDrawInit failed\n"); - ret = FALSE; - } - - return ret; -} - - -void -pmDrawEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - pmCardInfo(pScreenPriv); - - card = pm2c; - mmio = pm2c->reg_base; - - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); - GLINT_SLOW_WRITE_REG(UNIT_ENABLE, FBWriteMode); - GLINT_SLOW_WRITE_REG(0, dXSub); - GLINT_SLOW_WRITE_REG(GWIN_DisableLBUpdate, GLINTWindow); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DitherMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureColorMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PMTextureReadMode); - GLINT_SLOW_WRITE_REG(card->pprod, LBReadMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TexelLUTMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, YUVMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FogMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AntialiasMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaTestMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AreaStippleMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - GLINT_SLOW_WRITE_REG(0x400, FilterMode); - GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); - GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBSourceOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, WindowOrigin); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBWindowBase); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceBase); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWindowBase); - -#if X_BYTE_ORDER == X_BIG_ENDIAN - card->RasterizerSwap = 1; -#else - card->RasterizerSwap = 0; -#endif - - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - card->PixelWidth = 0x0; /* 8 Bits */ - card->TexMapFormat = card->pprod; -#if X_BYTE_ORDER == X_BIG_ENDIAN - card->RasterizerSwap |= 3<<15; /* Swap host data */ -#endif - break; - case 16: - card->PixelWidth = 0x1; /* 16 Bits */ - card->TexMapFormat = card->pprod | 1<<19; -#if X_BYTE_ORDER == X_BIG_ENDIAN - card->RasterizerSwap |= 2<<15; /* Swap host data */ -#endif - break; - case 24: - card->PixelWidth = 0x4; /* 24 Bits */ - card->TexMapFormat = card->pprod | 2<<19; - break; - case 32: - card->PixelWidth = 0x2; /* 32 Bits */ - card->TexMapFormat = card->pprod | 2<<19; - break; - } - card->ClippingOn = FALSE; - card->startxdom = 0; - card->startxsub = 0; - card->starty = 0; - card->count = 0; - card->dy = 1<<16; - card->dxdom = 0; - card->x = 0; - card->y = 0; - card->h = 0; - card->w = 0; - card->ROP = 0xFF; - GLINT_SLOW_WRITE_REG(card->PixelWidth, FBReadPixel); - GLINT_SLOW_WRITE_REG(card->TexMapFormat, PMTextureMapFormat); - GLINT_SLOW_WRITE_REG(0, RectangleSize); - GLINT_SLOW_WRITE_REG(0, RectangleOrigin); - GLINT_SLOW_WRITE_REG(0, dXDom); - GLINT_SLOW_WRITE_REG(1<<16, dY); - GLINT_SLOW_WRITE_REG(0, StartXDom); - GLINT_SLOW_WRITE_REG(0, StartXSub); - GLINT_SLOW_WRITE_REG(0, StartY); - GLINT_SLOW_WRITE_REG(0, GLINTCount); - - kaaMarkSync (pScreen); -} - -void -pmDrawDisable (ScreenPtr pScreen) -{ -} - -void -pmDrawFini (ScreenPtr pScreen) -{ -} diff --git a/hw/kdrive/pm2/pm2stub.c b/hw/kdrive/pm2/pm2stub.c deleted file mode 100644 index 1f824b347..000000000 --- a/hw/kdrive/pm2/pm2stub.c +++ /dev/null @@ -1,54 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "klinux.h" - -#include "pm2.h" - -static const int PM2Cards[]={ PCI_CHIP_3DLABS_PERMEDIA2, PCI_CHIP_3DLABS_PERMEDIA2V }; - - -#define numPM2Cards (sizeof(PM2Cards) / sizeof(PM2Cards[0])) - -void -InitCard (char *name) -{ - KdCardAttr attr; - int i; - - for (i = 0; i < numPM2Cards; i++) - if (LinuxFindPci (0x3d3d, PM2Cards[i], 0, &attr)) - KdCardInfoAdd (&PM2Funcs, &attr, (void *) PM2Cards[i]); -} - - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/r128/Makefile.am b/hw/kdrive/r128/Makefile.am deleted file mode 100644 index 344fbebf7..000000000 --- a/hw/kdrive/r128/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xr128 - -noinst_LIBRARIES = libr128.a - -libr128_a_SOURCES = \ - r128draw.c \ - r128.c \ - r128.h - -Xr128_SOURCES = \ - r128stub.c - -R128_LIBS = \ - libr128.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - @KDRIVE_LIBS@ - -if GLX -Xr128_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xr128_LDADD = \ - $(R128_LIBS) \ - @KDRIVE_LIBS@ - -Xr128_DEPENDENCIES = \ - libr128.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/r128/r128.c b/hw/kdrive/r128/r128.c deleted file mode 100644 index 9e7f312e0..000000000 --- a/hw/kdrive/r128/r128.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright © 2003 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "r128.h" - -static Bool -r128CardInit (KdCardInfo *card) -{ - R128CardInfo *r128c; - - r128c = (R128CardInfo *) xalloc (sizeof (R128CardInfo)); - if (!r128c) - return FALSE; - - r128MapReg (card, r128c); - - if (!vesaInitialize (card, &r128c->vesa)) - { - xfree (r128c); - return FALSE; - } - - r128c->fifo_size = 0; - - card->driver = r128c; - - return TRUE; -} - -static Bool -r128ScreenInit (KdScreenInfo *screen) -{ - R128ScreenInfo *r128s; - int screen_size, memory; - - r128s = (R128ScreenInfo *) xalloc (sizeof (R128ScreenInfo)); - if (!r128s) - return FALSE; - memset (r128s, '\0', sizeof (R128ScreenInfo)); - if (!vesaScreenInitialize (screen, &r128s->vesa)) - { - xfree (r128s); - return FALSE; - } -#if 0 - /* if (!r128c->reg) - screen->dumb = TRUE; */ - - if (r128s->vesa.mapping != VESA_LINEAR) - screen->dumb = TRUE; - - fprintf (stderr, "vesa mapping is %d\n", r128s->vesa.mapping); -#endif - r128s->screen = r128s->vesa.fb; - - memory = r128s->vesa.fb_size; - screen_size = screen->fb[0].byteStride * screen->height; - - memory -= screen_size; - if (memory > screen->fb[0].byteStride) - { - r128s->off_screen = r128s->screen + screen_size; - r128s->off_screen_size = memory; - } - else - { - r128s->off_screen = 0; - r128s->off_screen_size = 0; - } - screen->driver = r128s; - return TRUE; -} - -static Bool -r128InitScreen (ScreenPtr pScreen) -{ - return vesaInitScreen (pScreen); -} - -static Bool -r128FinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - - ret = vesaFinishInitScreen (pScreen); - - return ret; -} - -static void -r128Preserve (KdCardInfo *card) -{ - vesaPreserve (card); -} - -Bool -r128MapReg (KdCardInfo *card, R128CardInfo *r128c) -{ - r128c->reg_base = (CARD8 *) KdMapDevice (R128_REG_BASE (card), - R128_REG_SIZE (card)); - - if (!r128c->reg_base) - { - return FALSE; - } - - KdSetMappedMode (R128_REG_BASE (card), - R128_REG_SIZE (card), - KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -void -r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c) -{ - if (r128c->reg_base) - { - KdResetMappedMode (R128_REG_BASE (card), - R128_REG_SIZE (card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice ((void *) r128c->reg_base, R128_REG_SIZE (card)); - r128c->reg_base = 0; - } -} - -void -r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c) -{ - if (!r128c->reg_base) - r128MapReg (card, r128c); -} - -void -r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c) -{ - r128UnmapReg (card, r128c); -} - - -static Bool -r128DPMS (ScreenPtr pScreen, int mode) -{ - /* XXX */ - return TRUE; -} - -static Bool -r128Enable (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - R128CardInfo *r128c = pScreenPriv->card->driver; - - if (!vesaEnable (pScreen)) - return FALSE; - - r128SetMMIO (pScreenPriv->card, r128c); - r128DPMS (pScreen, KD_DPMS_NORMAL); - - return TRUE; -} - -static void -r128Disable (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - R128CardInfo *r128c = pScreenPriv->card->driver; - - r128ResetMMIO (pScreenPriv->card, r128c); - vesaDisable (pScreen); -} - -static void -r128Restore (KdCardInfo *card) -{ - R128CardInfo *r128c = card->driver; - - r128ResetMMIO (card, r128c); - vesaRestore (card); -} - -static void -r128ScreenFini (KdScreenInfo *screen) -{ - R128ScreenInfo *r128s = (R128ScreenInfo *) screen->driver; - - vesaScreenFini (screen); - xfree (r128s); - screen->driver = 0; -} - -static void -r128CardFini (KdCardInfo *card) -{ - R128CardInfo *r128c = (R128CardInfo *)card->driver; - - r128UnmapReg (card, r128c); - vesaCardFini (card); -} - -KdCardFuncs r128Funcs = { - r128CardInit, /* cardinit */ - r128ScreenInit, /* scrinit */ - r128InitScreen, /* initScreen */ - r128FinishInitScreen, /* finishInitScreen */ - vesaCreateResources,/* createRes */ - r128Preserve, /* preserve */ - r128Enable, /* enable */ - r128DPMS, /* dpms */ - r128Disable, /* disable */ - r128Restore, /* restore */ - r128ScreenFini, /* scrfini */ - r128CardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - r128DrawInit, /* initAccel */ - r128DrawEnable, /* enableAccel */ - r128DrawDisable, /* disableAccel */ - r128DrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; - diff --git a/hw/kdrive/r128/r128.h b/hw/kdrive/r128/r128.h deleted file mode 100644 index ae9ae03aa..000000000 --- a/hw/kdrive/r128/r128.h +++ /dev/null @@ -1,123 +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. - */ - -#ifndef _R128_H_ -#define _R128_H_ -#include <vesa.h> - -#define R128_REG_BASE(c) ((c)->attr.address[1]) -#define R128_REG_SIZE(c) (0x4000) - -#define R128_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v)) -#define R128_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a))) - -#define R128_REG_GUI_STAT 0x1740 -#define R128_REG_DEFAULT_OFFSET 0x16e0 -#define R128_REG_DEFAULT_PITCH 0x16e4 -#define R128_REG_DP_GUI_MASTER_CNTL 0x146c -#define R128_REG_DP_BRUSH_FRGD_CLR 0x147c -#define R128_REG_DP_WRITE_MASK 0x16cc -#define R128_REG_DP_CNTL 0x16c0 -#define R128_REG_DST_WIDTH_HEIGHT 0x1598 -#define R128_REG_DST_Y_X 0x1438 -#define R128_REG_PC_NGUI_CTLSTAT 0x0184 -#define R128_REG_DST_HEIGHT_WIDTH 0x143c -#define R128_REG_SRC_Y_X 0x1434 -#define R128_DEFAULT_SC_BOTTOM_RIGHT 0x16e8 -#define R128_AUX_SC_CNTL 0x1660 -#define R128_SC_TOP_LEFT 0x16ec -#define R128_SC_BOTTOM_RIGHT 0x16f0 - -#define R128_GMC_DST_DATATYPE_SHIFT 8 -#define R128_GMC_CLR_CMP_CNTL_DIS (1 << 28) -#define R128_GMC_AUX_CLIP_DIS (1 << 29) -#define R128_GMC_BRUSH_SOLID_COLOR (13 << 4) -#define R128_GMC_SRC_DATATYPE_COLOR (3 << 12) -#define R128_GMC_ROP3_SHIFT 16 -#define R128_DST_X_LEFT_TO_RIGHT (1 << 0) -#define R128_DST_Y_TOP_TO_BOTTOM (1 << 1) -#define R128_GUI_ACTIVE (1 << 31) -#define R128_PC_BUSY (1 << 31) -#define R128_DP_SRC_SOURCE_MEMORY (2 << 24) -#define R128_DEFAULT_SC_RIGHT_MAX (0x1fff << 0) -#define R128_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _r128CardInfo { - VesaCardPrivRec vesa; - CARD8 *reg_base; - int fifo_size; -} R128CardInfo; - -#define getR128CardInfo(kd) ((R128CardInfo *) ((kd)->card->driver)) -#define r128CardInfo(kd) R128CardInfo *r128c = getR128CardInfo(kd) - -typedef struct _r128ScreenInfo { - VesaScreenPrivRec vesa; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - - KaaScreenInfoRec kaa; - - int pitch; - int datatype; - - int dp_gui_master_cntl; -} R128ScreenInfo; - -#define getR128ScreenInfo(kd) ((R128ScreenInfo *) ((kd)->screen->driver)) -#define r128ScreenInfo(kd) R128ScreenInfo *r128s = getR128ScreenInfo(kd) - -Bool -r128MapReg (KdCardInfo *card, R128CardInfo *r128c); - -void -r128UnmapReg (KdCardInfo *card, R128CardInfo *r128c); - -void -r128SetMMIO (KdCardInfo *card, R128CardInfo *r128c); - -void -r128ResetMMIO (KdCardInfo *card, R128CardInfo *r128c); - -Bool -r128DrawSetup (ScreenPtr pScreen); - -Bool -r128DrawInit (ScreenPtr pScreen); - -void -r128DrawEnable (ScreenPtr pScreen); - -void -r128DrawDisable (ScreenPtr pScreen); - -void -r128DrawFini (ScreenPtr pScreen); - -extern KdCardFuncs r128Funcs; - -#endif /* _R128_H_ */ diff --git a/hw/kdrive/r128/r128draw.c b/hw/kdrive/r128/r128draw.c deleted file mode 100644 index 142cc8b3e..000000000 --- a/hw/kdrive/r128/r128draw.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright © 2003 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "r128.h" -#include "kaa.h" - -CARD8 r128SolidRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -CARD8 r128BltRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -int copydx, copydy; -int fifo_size; -char *mmio; - -static void -r128WaitAvail (int n) -{ - if (fifo_size < n) - { - while ((fifo_size = R128_IN32 (mmio, R128_REG_GUI_STAT) & 0xfff) < n) - ; - } - - fifo_size -= n; -} - -static void -r128WaitIdle (void) -{ - int tries; - - r128WaitAvail (64); - - tries = 1000000; - while (tries--) - { - if ((R128_IN32 (mmio, R128_REG_GUI_STAT) & R128_GUI_ACTIVE) == 0) - break; - } - - R128_OUT32 (mmio, R128_REG_PC_NGUI_CTLSTAT, - R128_IN32 (mmio, R128_REG_PC_NGUI_CTLSTAT | 0xff)); - - tries = 1000000; - while (tries--) - { - if ((R128_IN32 (mmio, R128_REG_PC_NGUI_CTLSTAT) & R128_PC_BUSY) != R128_PC_BUSY) - break; - } - -} - -static void -r128WaitMarker (ScreenPtr pScreen, int marker) -{ - KdScreenPriv (pScreen); - r128CardInfo (pScreenPriv); - - mmio = r128c->reg_base; - - r128WaitIdle (); -} - -static Bool -r128Setup (ScreenPtr pScreen, int wait) -{ - KdScreenPriv (pScreen); - r128ScreenInfo (pScreenPriv); - r128CardInfo (pScreenPriv); - - fifo_size = 0; - - mmio = r128c->reg_base; - - if (!mmio) - return FALSE; - - r128WaitAvail (2); - R128_OUT32 (mmio, R128_REG_DEFAULT_OFFSET, 0); - R128_OUT32 (mmio, R128_REG_DEFAULT_PITCH, r128s->pitch); - - r128WaitAvail (4); - R128_OUT32 (mmio, R128_AUX_SC_CNTL, 0); - R128_OUT32 (mmio, R128_DEFAULT_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX - | R128_DEFAULT_SC_BOTTOM_MAX)); - R128_OUT32 (mmio, R128_SC_TOP_LEFT, 0); - R128_OUT32 (mmio, R128_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX - | R128_DEFAULT_SC_BOTTOM_MAX)); - r128WaitAvail (wait); - return TRUE; -} - -static Bool -r128PrepareSolid (PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) -{ - KdScreenPriv (pPixmap->drawable.pScreen); - r128ScreenInfo (pScreenPriv); - - r128Setup (pPixmap->drawable.pScreen, 4); - R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl - | R128_GMC_BRUSH_SOLID_COLOR - | R128_GMC_SRC_DATATYPE_COLOR - | (r128SolidRop[alu] << R128_GMC_ROP3_SHIFT)); - R128_OUT32 (mmio, R128_REG_DP_BRUSH_FRGD_CLR, fg); - R128_OUT32 (mmio, R128_REG_DP_WRITE_MASK, pm); - R128_OUT32 (mmio, R128_REG_DP_CNTL, - (R128_DST_X_LEFT_TO_RIGHT | R128_DST_Y_TOP_TO_BOTTOM)); - - return TRUE; -} - -static void -r128Solid (int x1, int y1, int x2, int y2) -{ - r128WaitAvail (2); - R128_OUT32 (mmio, R128_REG_DST_Y_X, (y1 << 16) | x1); - R128_OUT32 (mmio, R128_REG_DST_WIDTH_HEIGHT, ((x2 - x1) << 16) | (y2 - y1)); - -} - -static void -r128DoneSolid (void) -{ -} - -static Bool -r128PrepareCopy (PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, Pixel pm) -{ - KdScreenPriv (pSrc->drawable.pScreen); - r128ScreenInfo (pScreenPriv); - - copydx = dx; - copydy = dy; - - r128Setup (pSrc->drawable.pScreen, 3); - R128_OUT32 (mmio, R128_REG_DP_GUI_MASTER_CNTL, r128s->dp_gui_master_cntl - | R128_GMC_BRUSH_SOLID_COLOR - | R128_GMC_SRC_DATATYPE_COLOR - | (r128BltRop[alu] << R128_GMC_ROP3_SHIFT) - | R128_DP_SRC_SOURCE_MEMORY); - R128_OUT32 (mmio, R128_REG_DP_WRITE_MASK, pm); - R128_OUT32 (mmio, R128_REG_DP_CNTL, - ((dx >= 0 ? R128_DST_X_LEFT_TO_RIGHT : 0) - | (dy >= 0 ? R128_DST_Y_TOP_TO_BOTTOM : 0))); - - - return TRUE; -} - -static void -r128Copy (int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - if (copydx < 0) - { - srcX += w - 1; - dstX += w - 1; - } - - if (copydy < 0) - { - srcY += h - 1; - dstY += h - 1; - } - - r128WaitAvail (3); - R128_OUT32 (mmio, R128_REG_SRC_Y_X, (srcY << 16) | srcX); - R128_OUT32 (mmio, R128_REG_DST_Y_X, (dstY << 16) | dstX); - R128_OUT32 (mmio, R128_REG_DST_HEIGHT_WIDTH, (h << 16) | w); -} - -static void -r128DoneCopy (void) -{ -} - - -Bool -r128DrawInit (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - r128ScreenInfo (pScreenPriv); - - memset(&r128s->kaa, 0, sizeof(KaaScreenInfoRec)); - r128s->kaa.waitMarker = r128WaitMarker; - r128s->kaa.PrepareSolid = r128PrepareSolid; - r128s->kaa.Solid = r128Solid; - r128s->kaa.DoneSolid = r128DoneSolid; - r128s->kaa.PrepareCopy = r128PrepareCopy; - r128s->kaa.Copy = r128Copy; - r128s->kaa.DoneCopy = r128DoneCopy; - - if (!kaaDrawInit (pScreen, &r128s->kaa)) - return FALSE; - - return TRUE; -} - -void -r128DrawEnable (ScreenPtr pScreen) -{ - KdScreenPriv (pScreen); - r128ScreenInfo (pScreenPriv); - - r128s->pitch = pScreenPriv->screen->width >> 3; - - switch (pScreenPriv->screen->fb[0].depth) { - case 8: - r128s->datatype = 2; - break; - case 15: - r128s->datatype = 3; - break; - case 16: - r128s->datatype = 4; - break; - case 24: - r128s->datatype = 5; - break; - case 32: - r128s->datatype = 6; - break; - default: - FatalError ("unsupported pixel format"); - } - - r128s->dp_gui_master_cntl = ((r128s->datatype << R128_GMC_DST_DATATYPE_SHIFT) - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_AUX_CLIP_DIS); - - kaaMarkSync (pScreen); -} - -void -r128DrawDisable (ScreenPtr pScreen) -{ -} - -void -r128DrawFini (ScreenPtr pScreen) -{ -} diff --git a/hw/kdrive/r128/r128stub.c b/hw/kdrive/r128/r128stub.c deleted file mode 100644 index b5ffd9d77..000000000 --- a/hw/kdrive/r128/r128stub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright © 2003 Anders Carlsson - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Anders Carlsson not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Anders Carlsson makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "r128.h" -#include "klinux.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - - if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) - KdCardInfoAdd (&r128Funcs, &attr, 0); - else if (LinuxFindPci (0x1002, 0x5046, 0, &attr)) - KdCardInfoAdd (&r128Funcs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - vesaUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = vesaProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/savage/s3.c b/hw/kdrive/savage/s3.c deleted file mode 100644 index c1b01e701..000000000 --- a/hw/kdrive/savage/s3.c +++ /dev/null @@ -1,1835 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -#define REGISTERS_OFFSET (0x1000000) -#define PACKED_OFFSET (0x8100) -#define IOMAP_OFFSET (0x8000) - -#define S3_MIN_CLOCK 250000 - -static void -_s3SetBlank (S3Ptr s3, S3Vga *s3vga, Bool blank) -{ - CARD8 clock_mode; - - s3SetImm(s3vga, s3_screen_off, blank ? 1 : 0); -} - -Bool -s3CardInit (KdCardInfo *card) -{ - S3CardInfo *s3c; - S3Ptr s3; - S3Vga *s3vga; - int size; - CARD8 *registers; - CARD32 s3FrameBuffer; - CARD32 s3Registers; - CARD8 *temp_buffer; - CARD32 max_memory; - VGA32 save_linear_window_size; - VGA32 save_enable_linear; - VGA32 save_register_lock_2; - VGA32 save_misc_output; - - s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo)); - if (!s3c) - { - goto bail0; - } - - memset (s3c, '\0', sizeof (S3CardInfo)); - - card->driver = s3c; - -#ifdef VXWORKS - s3c->bios_initialized = 0; -#else - s3c->bios_initialized = 1; -#endif - - if (card->attr.naddr > 1 && card->attr.address[1]) - { - s3FrameBuffer = card->attr.address[1]; - s3Registers = card->attr.address[0]; - max_memory = 32 * 1024 * 1024; - } - else - { - s3FrameBuffer = card->attr.address[0]; - s3Registers = s3FrameBuffer + REGISTERS_OFFSET; - max_memory = 16 * 1024 * 1024; - } - -#ifdef DEBUG - fprintf (stderr, "S3 at 0x%x/0x%x\n", s3Registers, s3FrameBuffer); -#endif - registers = KdMapDevice (s3Registers, - sizeof (S3) + PACKED_OFFSET); - if (!registers) - { - ErrorF ("Can't map s3 device\n"); - goto bail2; - } - s3 = (S3Ptr) (registers + PACKED_OFFSET); - s3c->registers = registers; - s3c->s3 = s3; - - s3vga = &s3c->s3vga; - s3RegInit (s3vga, (VGAVOL8 *) (registers + IOMAP_OFFSET)); - - if (!s3c->bios_initialized) - { - volatile CARD32 *wakeup; - - wakeup = (volatile CARD32 *) (registers + 0x8510); - ErrorF ("Wakeup S3 chip at 0x%x\n", wakeup); - ErrorF ("Wakeup was 0x%x\n", *wakeup); - /* wakeup the chip */ - *(volatile CARD32 *) (registers + 0x8510) = 1; - ErrorF ("Wakeup is 0x%x\n", *wakeup); - } - s3Set (s3vga, s3_io_addr_select, 1); - s3Set (s3vga, s3_enable_ram, 1); - VgaFlush (&s3vga->card); - - save_register_lock_2 = s3Get (s3vga, s3_register_lock_2); - s3SetImm (s3vga, s3_register_lock_2, 0xa0); - save_linear_window_size = s3Get (s3vga, s3_linear_window_size); - save_enable_linear = s3Get (s3vga, s3_enable_linear); - s3Set (s3vga, s3_linear_window_size, 3); - s3Set (s3vga, s3_enable_linear, 1); - VgaFlush (&s3vga->card); - VgaFinish (&s3vga->card); - - /* - * Can't trust S3 register value for frame buffer amount, must compute - */ - temp_buffer = KdMapDevice (s3FrameBuffer, max_memory); - - s3c->memory = KdFrameBufferSize (temp_buffer, max_memory); - - s3Set (s3vga, s3_linear_window_size, save_linear_window_size); - s3Set (s3vga, s3_enable_linear, save_enable_linear); - VgaFlush (&s3vga->card); - s3SetImm (s3vga, s3_register_lock_2, save_register_lock_2); - VgaFinish (&s3vga->card); -#ifdef DEBUG - fprintf (stderr, "Frame buffer 0x%x\n", s3c->memory); -#endif - KdUnmapDevice (temp_buffer, max_memory); - - if (!s3c->memory) - { - ErrorF ("Can't detect s3 frame buffer at 0x%x\n", s3FrameBuffer); - goto bail3; - } - - s3c->frameBuffer = KdMapDevice (s3FrameBuffer, s3c->memory); - if (!s3c->frameBuffer) - { - ErrorF ("Can't map s3 frame buffer\n"); - goto bail3; - } - - card->driver = s3c; - - return TRUE; -bail3: - KdUnmapDevice ((void *) s3, sizeof (S3)); -bail2: -bail1: - xfree (s3c); -bail0: - return FALSE; -} - -Bool -s3ModeSupported (KdScreenInfo *screen, - const KdMonitorTiming *t) -{ - if (screen->fb[1].depth) - { - /* - * Must have at least one true color stream - */ - if (screen->fb[0].depth <= 8 && - screen->fb[1].depth <= 8) - return FALSE; - } - /* make sure the clock isn't too fast */ - if (t->clock > S3_MAX_CLOCK * 2) - return FALSE; - /* width must be a multiple of 16 */ - if (t->horizontal & 0xf) - return FALSE; - return TRUE; -} - -Bool -s3ModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - S3CardInfo *s3c = (S3CardInfo *) card->driver; - int screen_size; - int pixel_width; - int byte_width; - int fb; - - screen_size = 0; - for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++) - { - if (screen->fb[fb].depth >= 24) - { - screen->fb[fb].depth = 24; - if (screen->fb[fb].bitsPerPixel != 24) - screen->fb[fb].bitsPerPixel = 32; - } - else if (screen->fb[fb].depth >= 16) - { - screen->fb[fb].depth = 16; - screen->fb[fb].bitsPerPixel = 16; - } - else if (screen->fb[fb].depth >= 15) - { - screen->fb[fb].depth = 15; - screen->fb[fb].bitsPerPixel = 16; - } - else - { - screen->fb[fb].depth = 8; - screen->fb[fb].bitsPerPixel = 8; - } - - /* - * SGRAM requires stride % 64 == 0 - */ - screen->fb[fb].pixelStride = (screen->width + 63) & ~63; - screen->fb[fb].byteStride = screen->fb[fb].pixelStride * (screen->fb[fb].bitsPerPixel >> 3); - screen_size += screen->fb[fb].byteStride * screen->height; - } - - return screen_size <= s3c->memory; -} - -Bool -s3ScreenInit (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - S3CardInfo *s3c = (S3CardInfo *) card->driver; - S3ScreenInfo *s3s; - int memory; - int requested_memory; - int v_total, h_total; - int m, n, r; - int i; - const KdMonitorTiming *t; - int screen_size; - int fb; - int ma; - - s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo)); - if (!s3s) - return FALSE; - - memset (s3s, '\0', sizeof (S3ScreenInfo)); - -#ifdef PHOENIX - screen->width = 1152; - screen->height = 900; - screen->rate = 85; - screen->depth = 32; -#endif - if (!screen->width || !screen->height) - { - screen->width = 800; - screen->height = 600; - screen->rate = 72; - } - if (!screen->fb[0].depth) - screen->fb[0].depth = 8; - - t = KdFindMode (screen, s3ModeSupported); - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - s3GetClock (t->clock, &m, &n, &r, 511, 127, 4, 250000); -#ifdef DEBUG - fprintf (stderr, "computed %d,%d,%d (%d)\n", - m, n, r, S3_CLOCK(m,n,r)); -#endif -#if 0 - /* - * Can only operate in pixel-doubled mode at 8 or 16 bits per pixel - */ - if (screen->depth > 16 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK) - screen->depth = 16; -#endif - - if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported)) - { - xfree (s3s); - return FALSE; - } - - s3s->fbmap[2] = -1; - if (screen->fb[1].depth) - { - if (screen->fb[0].bitsPerPixel >= 16) - { - s3s->fbmap[0] = 1; - s3s->fbmap[1] = 0; - } - else - { - s3s->fbmap[0] = 0; - s3s->fbmap[1] = 1; - } - } - else - { - s3s->fbmap[0] = 0; - s3s->fbmap[1] = -1; - } - - screen_size = 0; - for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++) - screen_size += screen->fb[fb].byteStride * screen->height; - - memory = s3c->memory - screen_size; - - /* - * Stick cursor at end of memory - */ - if (memory >= 2048) - { - s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048); - memory -= 2048; - } - else - s3s->cursor_base = 0; - - screen_size = 0; - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) - { - fb = s3s->fbmap[ma]; - screen->fb[fb].frameBuffer = s3c->frameBuffer + screen_size; - screen_size += screen->fb[fb].byteStride * screen->height; - - REGION_INIT(pScreen, (&s3s->region[fb]), NullBox, 0); - if (screen->fb[fb].bitsPerPixel == 8) - s3s->fb[ma].chroma_key = 0xff; - else - s3s->fb[ma].chroma_key = 0; - - /* - * Use remaining memory for off-screen storage, but only use - * one piece (either right or bottom). - */ - if (memory >= screen->fb[fb].byteStride * S3_TILE_SIZE) - { - s3s->fb[ma].offscreen = screen->fb[fb].frameBuffer; - s3s->fb[ma].offscreen_x = 0; - s3s->fb[ma].offscreen_y = screen->height; - s3s->fb[ma].offscreen_width = screen->fb[fb].pixelStride; - s3s->fb[ma].offscreen_height = S3_TILE_SIZE; - memory -= s3s->fb[ma].offscreen_height * screen->fb[fb].byteStride; - screen_size += s3s->fb[ma].offscreen_height * screen->fb[fb].byteStride; - } - else - s3s->fb[ma].offscreen = 0; - - switch (screen->fb[fb].depth) { - case 8: - screen->fb[fb].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[fb].blueMask = 0x00; - screen->fb[fb].greenMask = 0x00; - screen->fb[fb].redMask = 0x00; - break; - case 15: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x001f; - screen->fb[fb].greenMask = 0x03e0; - screen->fb[fb].redMask = 0x7c00; - break; - case 16: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x001f; - screen->fb[fb].greenMask = 0x07e0; - screen->fb[fb].redMask = 0xf800; - break; - case 24: - screen->fb[fb].visuals = (1 << TrueColor); - screen->fb[fb].blueMask = 0x0000ff; - screen->fb[fb].greenMask = 0x00ff00; - screen->fb[fb].redMask = 0xff0000; - break; - } - } - - screen->driver = s3s; - - return TRUE; -} - -typedef struct _biosInit { - VGA16 reg; - VGA8 value; -} s3BiosInit; - -s3BiosInit s3BiosReg[] = { - S3_SR +0x15, 0x23, - S3_MISC_OUT, 0x2f, - 0xffff, 1, - S3_SR +0x15, 0x03, - - S3_SR + 0x0, 0x03, - S3_SR + 0x1, 0x00, - S3_SR + 0x2, 0x03, - S3_SR + 0x3, 0x00, - S3_SR + 0x4, 0x02, - S3_SR + 0x5, 0x05, - S3_SR + 0x6, 0x06, - S3_SR + 0x7, 0x07, -/* S3_SR + 0x8, 0x06, */ - S3_SR + 0x9, 0x00, - S3_SR + 0xa, 0x0a, - S3_SR + 0xb, 0x00, - S3_SR + 0xc, 0x0c, - S3_SR + 0xd, 0x00, - S3_SR + 0xe, 0x0e, - S3_SR + 0xf, 0x0f, - -/* S3_SR +0x10, 0x00, */ -/* S3_SR +0x11, 0x0c, */ - S3_SR +0x12, 0x01, - S3_SR +0x13, 0x52, - S3_SR +0x14, 0x00, - -/* S3_SR +0x15, 0x03, */ - - S3_SR +0x16, 0xc5, - S3_SR +0x17, 0xfc, - S3_SR +0x18, 0x40, - S3_SR +0x19, 0x00, - S3_SR +0x1a, 0x01, - S3_SR +0x1b, 0x02, - S3_SR +0x1c, 0x5d, - S3_SR +0x1d, 0x00, - S3_SR +0x1e, 0x00, - S3_SR +0x1f, 0x00, - S3_SR +0x20, 0x20, - S3_SR +0x21, 0x21, - S3_SR +0x22, 0x22, - S3_SR +0x23, 0x23, - S3_SR +0x24, 0x24, - S3_SR +0x25, 0x25, - S3_SR +0x26, 0x26, - S3_SR +0x27, 0x04, - S3_SR +0x28, 0xff, - S3_SR +0x29, 0x00, - S3_SR +0x2a, 0x2a, - S3_SR +0x2b, 0x2b, - S3_SR +0x2c, 0x2c, - S3_SR +0x2d, 0x2d, - S3_SR +0x2e, 0x2e, - S3_SR +0x2f, 0x2f, - S3_SR +0x30, 0x00, - S3_SR +0x31, 0x06, - S3_SR +0x32, 0x41, - S3_SR +0x33, 0x67, - S3_SR +0x34, 0x00, - S3_SR +0x35, 0x00, - S3_SR +0x36, 0x01, - S3_SR +0x37, 0x52, - S3_SR +0x38, 0x5d, - S3_SR +0x39, 0x05, - S3_SR +0x3a, 0x3a, - S3_SR +0x3b, 0x3b, - S3_SR +0x3c, 0x3c, - S3_SR +0x3d, 0x00, - S3_SR +0x3e, 0x3e, - S3_SR +0x3f, 0x00, - S3_SR +0x40, 0x40, - S3_SR +0x41, 0x41, - S3_SR +0x42, 0x42, - S3_SR +0x43, 0x43, - S3_SR +0x44, 0x44, - S3_SR +0x45, 0x45, - S3_SR +0x46, 0x46, - S3_SR +0x47, 0x47, - S3_SR +0x48, 0x48, - S3_SR +0x49, 0x49, - S3_SR +0x4a, 0x4a, - S3_SR +0x4b, 0x4b, - S3_SR +0x4c, 0x4c, - S3_SR +0x4d, 0x4d, - S3_SR +0x4e, 0x4e, - S3_SR +0x4f, 0x4f, - S3_SR +0x50, 0x00, - S3_SR +0x51, 0x00, - S3_SR +0x52, 0x00, - S3_SR +0x53, 0x00, - S3_SR +0x54, 0x00, - S3_SR +0x55, 0x00, - S3_SR +0x56, 0x00, - S3_SR +0x57, 0x00, - S3_SR +0x58, 0x00, - S3_SR +0x59, 0x70, - S3_SR +0x5a, 0x38, - S3_SR +0x5b, 0x08, - S3_SR +0x5c, 0x77, - S3_SR +0x5d, 0x77, - S3_SR +0x5e, 0x00, - S3_SR +0x5f, 0x00, - S3_SR +0x60, 0xff, - S3_SR +0x61, 0xbf, - S3_SR +0x62, 0xff, - S3_SR +0x63, 0xff, - S3_SR +0x64, 0xf7, - S3_SR +0x65, 0xff, - S3_SR +0x66, 0xff, - S3_SR +0x67, 0xff, - S3_SR +0x68, 0xff, - S3_SR +0x69, 0xff, - S3_SR +0x6a, 0xff, - S3_SR +0x6b, 0xff, - S3_SR +0x6c, 0xff, - S3_SR +0x6d, 0xff, - S3_SR +0x6e, 0x9b, - S3_SR +0x6f, 0xbf, - - S3_AR + 0x00, 0x00, - S3_AR + 0x01, 0x01, - S3_AR + 0x02, 0x02, - S3_AR + 0x03, 0x03, - S3_AR + 0x04, 0x04, - S3_AR + 0x05, 0x05, - S3_AR + 0x06, 0x06, - S3_AR + 0x07, 0x07, - S3_AR + 0x08, 0x08, - S3_AR + 0x09, 0x09, - S3_AR + 0x0a, 0x0a, - S3_AR + 0x0b, 0x0b, - S3_AR + 0x0c, 0x0c, - S3_AR + 0x0d, 0x0d, - S3_AR + 0x0e, 0x0e, - S3_AR + 0x0f, 0x0f, - S3_AR + 0x10, 0x05, - S3_AR + 0x11, 0x00, - S3_AR + 0x12, 0x0f, - S3_AR + 0x13, 0x08, - S3_AR + 0x14, 0x00, - - S3_GR + 0x00, 0x00, - S3_GR + 0x01, 0x00, - S3_GR + 0x02, 0x00, - S3_GR + 0x03, 0x00, - S3_GR + 0x04, 0x00, - S3_GR + 0x05, 0x10, - S3_GR + 0x06, 0x0e, - S3_GR + 0x07, 0x00, - - S3_CR + 0x00, 0x5f, - S3_CR + 0x01, 0x4f, - S3_CR + 0x02, 0x50, - S3_CR + 0x03, 0x82, - S3_CR + 0x04, 0x55, - S3_CR + 0x05, 0x81, - S3_CR + 0x06, 0xbf, - S3_CR + 0x07, 0x1f, - S3_CR + 0x08, 0x00, - S3_CR + 0x09, 0x4f, - S3_CR + 0x0a, 0x0d, - S3_CR + 0x0b, 0x0e, - S3_CR + 0x0c, 0x00, - S3_CR + 0x0d, 0x00, - S3_CR + 0x0e, 0x3f, - S3_CR + 0x0f, 0xff, - S3_CR + 0x10, 0x9c, - S3_CR + 0x11, 0x0e, - S3_CR + 0x12, 0x8f, - S3_CR + 0x13, 0x28, - S3_CR + 0x14, 0x1f, - S3_CR + 0x15, 0x96, - S3_CR + 0x16, 0xb9, - S3_CR + 0x17, 0xa3, - S3_CR + 0x18, 0xff, - S3_CR + 0x19, 0xdf, - S3_CR + 0x1a, 0xdf, - S3_CR + 0x1b, 0xdf, - S3_CR + 0x1c, 0xdf, - S3_CR + 0x1d, 0xdf, - S3_CR + 0x1e, 0xdf, - S3_CR + 0x1f, 0xdf, - S3_CR + 0x20, 0xdf, - S3_CR + 0x21, 0x00, -/* S3_CR + 0x22, 0x07, */ - S3_CR + 0x23, 0x00, - S3_CR + 0x24, 0xdf, - S3_CR + 0x25, 0xdf, - S3_CR + 0x26, 0x00, - S3_CR + 0x27, 0xdf, - S3_CR + 0x28, 0xdf, - S3_CR + 0x29, 0xdf, - S3_CR + 0x2a, 0xdf, - S3_CR + 0x2b, 0xdf, - S3_CR + 0x2c, 0xdf, - S3_CR + 0x2d, 0x8a, - S3_CR + 0x2e, 0x22, - S3_CR + 0x2f, 0x02, - S3_CR + 0x30, 0xe1, - S3_CR + 0x31, 0x05, - S3_CR + 0x32, 0x40, - S3_CR + 0x33, 0x08, - S3_CR + 0x34, 0x00, - S3_CR + 0x35, 0x00, - S3_CR + 0x36, 0xbf, - S3_CR + 0x37, 0x9b, -/* S3_CR + 0x38, 0x7b, */ -/* S3_CR + 0x39, 0xb8, */ - S3_CR + 0x3a, 0x45, - S3_CR + 0x3b, 0x5a, - S3_CR + 0x3c, 0x10, - S3_CR + 0x3d, 0x00, - S3_CR + 0x3e, 0xfd, - S3_CR + 0x3f, 0x00, - S3_CR + 0x40, 0x00, - S3_CR + 0x41, 0x92, - S3_CR + 0x42, 0xc0, - S3_CR + 0x43, 0x68, - S3_CR + 0x44, 0xff, - S3_CR + 0x45, 0xe8, - S3_CR + 0x46, 0xff, - S3_CR + 0x47, 0xff, - S3_CR + 0x48, 0xf8, - S3_CR + 0x49, 0xff, - S3_CR + 0x4a, 0xfe, - S3_CR + 0x4b, 0xff, - S3_CR + 0x4c, 0xff, - S3_CR + 0x4d, 0xff, - S3_CR + 0x4e, 0xff, - S3_CR + 0x4f, 0xff, - S3_CR + 0x50, 0x00, - S3_CR + 0x51, 0x00, - S3_CR + 0x52, 0x00, - S3_CR + 0x53, 0x00, - S3_CR + 0x54, 0x00, - S3_CR + 0x55, 0x00, - S3_CR + 0x56, 0x00, - S3_CR + 0x57, 0x00, -#if 0 - S3_CR + 0x58, 0x00, - S3_CR + 0x59, 0xf0, -#endif - S3_CR + 0x5a, 0x00, - S3_CR + 0x5b, 0x00, -#if 0 - S3_CR + 0x5c, 0x00, -#endif - S3_CR + 0x5d, 0x00, - S3_CR + 0x5e, 0x00, - S3_CR + 0x5f, 0x00, - S3_CR + 0x60, 0x09, - S3_CR + 0x61, 0x9d, - S3_CR + 0x62, 0xff, - S3_CR + 0x63, 0x00, - S3_CR + 0x64, 0xfd, - S3_CR + 0x65, 0x04, - S3_CR + 0x66, 0x88, - S3_CR + 0x67, 0x00, - S3_CR + 0x68, 0x7f, - S3_CR + 0x69, 0x00, - S3_CR + 0x6a, 0x00, - S3_CR + 0x6b, 0x00, - S3_CR + 0x6c, 0x00, - S3_CR + 0x6d, 0x11, - S3_CR + 0x6e, 0xff, - S3_CR + 0x6f, 0xfe, - - S3_CR + 0x70, 0x30, - S3_CR + 0x71, 0xc0, - S3_CR + 0x72, 0x07, - S3_CR + 0x73, 0x1f, - S3_CR + 0x74, 0x1f, - S3_CR + 0x75, 0x1f, - S3_CR + 0x76, 0x0f, - S3_CR + 0x77, 0x1f, - S3_CR + 0x78, 0x01, - S3_CR + 0x79, 0x01, - S3_CR + 0x7a, 0x1f, - S3_CR + 0x7b, 0x1f, - S3_CR + 0x7c, 0x17, - S3_CR + 0x7d, 0x17, - S3_CR + 0x7e, 0x17, - S3_CR + 0x7f, 0xfd, - S3_CR + 0x80, 0x00, - S3_CR + 0x81, 0x92, - S3_CR + 0x82, 0x10, - S3_CR + 0x83, 0x07, - S3_CR + 0x84, 0x42, - S3_CR + 0x85, 0x00, - S3_CR + 0x86, 0x00, - S3_CR + 0x87, 0x00, - S3_CR + 0x88, 0x10, - S3_CR + 0x89, 0xfd, - S3_CR + 0x8a, 0xfd, - S3_CR + 0x8b, 0xfd, - S3_CR + 0x8c, 0xfd, - S3_CR + 0x8d, 0xfd, - S3_CR + 0x8e, 0xfd, - S3_CR + 0x8f, 0xfd, - S3_CR + 0x90, 0x00, - S3_CR + 0x91, 0x4f, - S3_CR + 0x92, 0x10, - S3_CR + 0x93, 0x00, - S3_CR + 0x94, 0xfd, - S3_CR + 0x95, 0xfd, - S3_CR + 0x96, 0xfd, - S3_CR + 0x97, 0xfd, - S3_CR + 0x98, 0xfd, - S3_CR + 0x99, 0xff, - S3_CR + 0x9a, 0xfd, - S3_CR + 0x9b, 0xff, - S3_CR + 0x9c, 0xfd, - S3_CR + 0x9d, 0xfd, - S3_CR + 0x9e, 0xfd, - S3_CR + 0x9f, 0xff, - S3_CR + 0xa0, 0x0f, -#if 0 - S3_CR + 0xa1, 0x00, - S3_CR + 0xa2, 0x00, - S3_CR + 0xa3, 0x00, - S3_CR + 0xa4, 0x55, -#endif - S3_CR + 0xa5, 0x09, - S3_CR + 0xa6, 0x20, -#if 0 - S3_CR + 0xa7, 0x00, - S3_CR + 0xa8, 0x00, - S3_CR + 0xa9, 0x00, - S3_CR + 0xaa, 0x00, - S3_CR + 0xab, 0x00, - S3_CR + 0xac, 0x00, - S3_CR + 0xad, 0x00, - S3_CR + 0xae, 0x00, - S3_CR + 0xaf, 0x00, - S3_CR + 0xb0, 0xff, -#endif - S3_CR + 0xb1, 0x0e, -#if 0 - S3_CR + 0xb2, 0x55, - S3_CR + 0xb3, 0x00, - S3_CR + 0xb4, 0x55, - S3_CR + 0xb5, 0x00, - S3_CR + 0xb6, 0x00, -#endif - S3_CR + 0xb7, 0x84, -#if 0 - S3_CR + 0xb8, 0xff, - S3_CR + 0xb9, 0xff, - S3_CR + 0xba, 0xff, - S3_CR + 0xbb, 0xff, - S3_CR + 0xbc, 0xff, - S3_CR + 0xbd, 0xff, - S3_CR + 0xbe, 0xff, - S3_CR + 0xbf, 0xff, -#endif - - S3_SR +0x15, 0x23, - 0xffff, 1, - S3_SR +0x15, 0x03, - 0xffff, 1, -}; - -#define S3_NUM_BIOS_REG (sizeof (s3BiosReg) / sizeof (s3BiosReg[0])) - -typedef struct _bios32Init { - VGA16 offset; - VGA32 value; -} s3Bios32Init; - -s3Bios32Init s3Bios32Reg[] = { - 0x8168, 0x00000000, - 0x816c, 0x00000001, - 0x8170, 0x00000000, - 0x8174, 0x00000000, - 0x8178, 0x00000000, - 0x817c, 0x00000000, -#if 0 - 0x8180, 0x00140000, - 0x8184, 0x00000000, - 0x8188, 0x00000000, - 0x8190, 0x00000000, - 0x8194, 0x00000000, - 0x8198, 0x00000000, - 0x819c, 0x00000000, - 0x81a0, 0x00000000, -#endif - 0x81c0, 0x00000000, - 0x81c4, 0x01fbffff, - 0x81c8, 0x00f7ffbf, - 0x81cc, 0x00f7ff00, - 0x81d0, 0x11ffff7f, - 0x81d4, 0x7fffffdf, - 0x81d8, 0xfdfff9ff, - 0x81e0, 0xfd000000, - 0x81e4, 0x00000000, - 0x81e8, 0x00000000, - 0x81ec, 0x00010000, - 0x81f0, 0x07ff057f, - 0x81f4, 0x07ff07ff, - 0x81f8, 0x00000000, - 0x81fc, 0x00000000, - 0x8200, 0x00000000, - 0x8204, 0x00000000, - 0x8208, 0x33000000, - 0x820c, 0x7f000000, - 0x8210, 0x80000000, - 0x8214, 0x00000000, - 0x8218, 0xffffffff, - 0x8300, 0xff007fef, - 0x8304, 0xfffdf7bf, - 0x8308, 0xfdfffbff, -}; - -#define S3_NUM_BIOS32_REG (sizeof (s3Bios32Reg) / sizeof (s3Bios32Reg[0])) - -/* - * Initialize the card precisely as the bios does - */ -s3DoBiosInit (KdCardInfo *card) -{ - S3CardInfo *s3c = card->driver; - CARD32 *regs = (CARD32 *) s3c->registers; - S3Vga *s3vga = &s3c->s3vga; - int r; - - for (r = 0; r < S3_NUM_BIOS_REG; r++) - { - if (s3BiosReg[r].reg == 0xffff) - sleep (s3BiosReg[r].value); - else - VgaStore (&s3vga->card, s3BiosReg[r].reg, s3BiosReg[r].value); - } - VgaStore (&s3vga->card, S3_SR+0x10, 0x22); - VgaStore (&s3vga->card, S3_SR+0x11, 0x44); - VgaStore (&s3vga->card, S3_SR+0x15, 0x01); - sleep (1); - VgaStore (&s3vga->card, S3_SR+0x15, 0x03); - VgaStore (&s3vga->card, S3_CR+0x6f, 0xff); - VgaStore (&s3vga->card, S3_CR+0x3f, 0x3f); - sleep (1); - VgaStore (&s3vga->card, S3_CR+0x3f, 0x00); - VgaStore (&s3vga->card, S3_CR+0x6f, 0xfe); - VgaInvalidate (&s3vga->card); - for (r = 0; r < S3_NUM_BIOS32_REG; r++) - regs[s3Bios32Reg[r].offset/4] = s3Bios32Reg[r].value; -} - -void -s3Preserve (KdCardInfo *card) -{ - S3CardInfo *s3c = card->driver; - S3Ptr s3 = s3c->s3; - S3Vga *s3vga = &s3c->s3vga; - S3Save *save = &s3c->save; - CARD8 t1, t2; - CARD8 *cursor_base; - CARD8 streams_mode; - - s3Save (s3vga); - if (!s3c->bios_initialized) - s3DoBiosInit (card); - - _s3SetBlank (s3, s3vga, TRUE); - /* - * Preserve the first part of the frame buffer which holds - * the text mode fonts and data - */ - s3Set (s3vga, s3_linear_window_size, 3); - s3Set (s3vga, s3_enable_linear, 1); - VgaFlush (&s3vga->card); - memcpy (save->text_save, s3c->frameBuffer, S3_TEXT_SAVE); - /* - * Preserve graphics engine state - */ - save->alt_mix = s3->alt_mix; - save->write_mask = s3->write_mask; - save->fg = s3->fg; - save->bg = s3->bg; - /* - * Preserve streams processor state - */ - streams_mode = s3Get (s3vga, s3_streams_mode); - s3SetImm (s3vga, s3_streams_mode, 3); - save->global_bitmap_1 = s3->global_bitmap_1; - save->global_bitmap_2 = s3->global_bitmap_2; - save->adv_func_cntl = s3->adv_func_cntl; - save->primary_bitmap_1 = s3->primary_bitmap_1; - save->primary_bitmap_2 = s3->primary_bitmap_2; - save->secondary_bitmap_1 = s3->secondary_bitmap_1; - save->secondary_bitmap_2 = s3->secondary_bitmap_2; - save->primary_stream_control = s3->primary_stream_control; - save->blend_control = s3->blend_control; - save->primary_stream_addr_0 = s3->primary_stream_addr_0; - save->primary_stream_addr_1 = s3->primary_stream_addr_1; - save->primary_stream_stride = s3->primary_stream_stride; - save->primary_stream_xy = s3->primary_stream_xy; - save->primary_stream_size = s3->primary_stream_size; - save->primary_stream_mem = s3->primary_stream_mem; - save->secondary_stream_xy = s3->secondary_stream_xy; - save->secondary_stream_size = s3->secondary_stream_size; - save->streams_fifo = s3->streams_fifo; - s3SetImm (s3vga, s3_streams_mode, streams_mode); - _s3SetBlank (s3, s3vga, FALSE); -} - -/* - * Enable the card for rendering. Manipulate the initial settings - * of the card here. - */ -int s3CpuTimeout, s3AccelTimeout; - -void -s3SetGlobalBitmap (ScreenPtr pScreen, int ma) -{ - KdScreenPriv(pScreen); - s3ScreenInfo (pScreenPriv); - - if (s3s->current_ma != ma) - { - s3CardInfo (pScreenPriv); - S3Vga *s3vga = &s3c->s3vga; - S3Ptr s3 = s3c->s3; - CARD32 gb1, gb2; - int depth; - int length; - KdCheckSync (pScreen); - switch (s3s->fb[ma].accel_bpp) { - case 8: - case 24: - length = 0; - break; - case 16: - length = 1; - break; - case 32: - length = 3; - break; - } - s3SetImm (s3vga, s3_pixel_length, length); - gb1 = s3s->fb[ma].bitmap_offset; - gb2 = ((1 << 0) | - (0 << 2) | - (1 << 3) | - ((s3s->fb[ma].accel_stride >> 4) << 4) | - (s3s->fb[ma].accel_bpp << 16) | - (0 << 24) | - (1 << 28)); - s3->global_bitmap_1 = gb1; - s3->global_bitmap_2 = gb2; - s3->global_bitmap_2 = gb2; - s3s->current_ma = ma; - } -} - -Bool -s3Enable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - KdScreenInfo *screen = pScreenPriv->screen; - s3CardInfo (pScreenPriv); - s3ScreenInfo (pScreenPriv); - - S3Vga *s3vga = &s3c->s3vga; - S3Ptr s3 = s3c->s3; - int hactive, hblank, hfp, hbp; - int vactive, vblank, vfp, vbp; - int hsize; - - int h_total; - int h_display_end; - int h_blank_start; - int h_blank_end; - int h_sync_start; - int h_sync_end; - int h_screen_off; - int h_start_fifo_fetch; - - int primary_stream_l1[KD_MAX_FB]; - - int v_total; - int v_retrace_start; - int v_retrace_end; - int v_display_end; - int v_blank_start; - int v_blank_end; - int v_blank_start_adjust = 0; - int v_blank_end_adjust = 0; - - int h_blank_start_adjust = 0; - int h_blank_end_adjust = 0; - int h_sync_start_adjust = 0; - int h_sync_end_adjust = 0; - int h_start_fifo_fetch_adjust = 0; - int h_sync_extend; - int h_blank_extend; - int i; - CARD16 cursor_address; - const KdMonitorTiming *t; - int m, n, r; - Bool clock_double; - int cpu_timeout; - int accel_timeout; - int bytes_per_ms; - CARD32 control[2]; - int fb; - int ma; - - s3s->primary_depth = screen->fb[s3s->fbmap[0]].depth; - - s3s->use_streams = TRUE; - - t = KdFindMode (screen, s3ModeSupported); - - hfp = t->hfp; - hbp = t->hbp; - hblank = t->hblank; - hactive = t->horizontal; - - vfp = t->vfp; - vbp = t->vbp; - vblank = t->vblank; - vactive = t->vertical; - - - m = s3Get (s3vga, s3_dclk_m); - n = s3Get (s3vga, s3_dclk_n); - r = s3Get (s3vga, s3_dclk_r); -#define DEBUG_CLOCK -#ifdef DEBUG_CLOCK - fprintf (stderr, "old clock %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); -#endif - clock_double = FALSE; - s3GetClock (t->clock, &m, &n, &r, 511, 127, 4, 250000); - if (S3_CLOCK(m,n,r) > S3_MAX_CLOCK && !s3s->use_streams) - clock_double = TRUE; - s3Set (s3vga, s3_clock_select, 3); - s3Set (s3vga, s3_dclk_m, m); - s3Set (s3vga, s3_dclk_n, n); - s3Set (s3vga, s3_dclk_r, r); -#ifdef DEBUG_CLOCK - fprintf (stderr, "new clock %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); -#endif - - if (s3s->use_streams) - { - s3Set (s3vga, s3_streams_mode, 3); - s3Set (s3vga, s3_enable_l1_parameter, 1); - } - else - { - s3Set (s3vga, s3_streams_mode, 0); - s3Set (s3vga, s3_enable_l1_parameter, 0); - } - s3Set (s3vga, s3_flat_panel_output_control_1, 0); - s3Set (s3vga, s3_flat_panel_output_control_2, 0); - s3Set (s3vga, s3_select_graphics_mode, 1); - s3Set (s3vga, s3_enable_blinking, 0); - s3Set (s3vga, s3_enable_vga_16bit, 0); - s3Set (s3vga, s3_enhanced_memory_mapping, 1); - s3Set (s3vga, s3_enable_sff, 1); - s3Set (s3vga, s3_enable_2d_access, 1); - s3Set (s3vga, s3_2bk_cga, 1); - s3Set (s3vga, s3_4bk_hga, 1); - s3Set (s3vga, s3_v_total_double, 0); - s3Set (s3vga, s3_address_16k_wrap, 1); - s3Set (s3vga, s3_word_mode, 0); - s3Set (s3vga, s3_byte_mode, 1); - s3Set (s3vga, s3_hardware_reset, 1); - s3Set (s3vga, s3_max_scan_line, 0); - s3Set (s3vga, s3_linear_window_size, 3); - s3Set (s3vga, s3_enable_linear, 1); - s3Set (s3vga, s3_enable_2d_3d, 1); - s3Set (s3vga, s3_refresh_control, 1); - s3Set (s3vga, s3_disable_pci_read_bursts, 0); - s3Set (s3vga, s3_pci_disconnect_enable, 1); - s3Set (s3vga, s3_primary_load_control, 0); - s3Set (s3vga, s3_secondary_load_control, 0); - s3Set (s3vga, s3_pci_retry_enable, 1); - s3Set (s3vga, s3_enable_256, 1); - s3Set (s3vga, s3_border_select, 1); /* eliminate white border */ - s3SetImm (s3vga, s3_lock_palette, 0); /* unlock palette/border regs */ - s3Set (s3vga, s3_disable_v_retrace_int, 1); - if (t->hpol == KdSyncPositive) - s3Set (s3vga, s3_horz_sync_neg, 0); - else - s3Set (s3vga, s3_horz_sync_neg, 1); - if (t->vpol == KdSyncPositive) - s3Set (s3vga, s3_vert_sync_neg, 0); - else - s3Set (s3vga, s3_vert_sync_neg, 1); - - s3Set (s3vga, s3_dot_clock_8, 1); - s3Set (s3vga, s3_enable_write_plane, 0xf); - s3Set (s3vga, s3_extended_memory_access, 1); - s3Set (s3vga, s3_sequential_addressing_mode, 1); - s3Set (s3vga, s3_select_chain_4_mode, 1); - s3Set (s3vga, s3_linear_addressing_control, 1); - - s3Set (s3vga, s3_enable_gamma_correction, 0); - - s3Set (s3vga, s3_enable_8_bit_luts, 1); - - s3Set (s3vga, s3_dclk_invert, 0); - s3Set (s3vga, s3_enable_clock_double, 0); - s3Set (s3vga, s3_dclk_over_2, 0); - - s3Set (s3vga, s3_delay_h_enable, 0); - s3Set (s3vga, s3_sdclk_skew, 0); - - s3Set (s3vga, s3_dac_mask, 0xff); - -#if 0 -#ifdef DEBUG_CLOCK - m = s3Get (s3vga, s3_mclk_m); - n = s3Get (s3vga, s3_mclk_n); - r = s3Get (s3vga, s3_mclk_r); - fprintf (stderr, "old mclk %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); -#endif - - s3GetClock (125282, &m, &n, &r, 127, 31, 3, 250000); - -#ifdef DEBUG_CLOCK - fprintf (stderr, "new mclk %d, %d, %d (%d)\n", m, n, r,S3_CLOCK(m,n,r)); -#endif - - s3Set (s3vga, s3_mclk_m, m); - s3Set (s3vga, s3_mclk_n, n); - s3Set (s3vga, s3_mclk_r, r); - -#ifdef DEBUG_CLOCK - m = s3Get (s3vga, s3_eclk_m); - n = s3Get (s3vga, s3_eclk_n); - r = s3Get (s3vga, s3_eclk_r); - fprintf (stderr, "old eclk %d, %d, %d (%d)\n", m, n, r, S3_CLOCK(m,n,r)); -#endif - -#define S3_ECLK 125282 - - s3GetClock (S3_ECLK, &m, &n, &r, 127, 31, 3, 250000); - -#ifdef DEBUG_CLOCK - fprintf (stderr, "new eclk %d, %d, %d (%d)\n", m, n, r,S3_CLOCK(m,n,r)); -#endif - - s3Set (s3vga, s3_eclk_m, m); - s3Set (s3vga, s3_eclk_n, n); - s3Set (s3vga, s3_eclk_r, r); -#endif - - /* - * Compute character lengths for horizontal timing values - */ - hactive = screen->width / 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - /* - * Set pixel size, choose clock doubling mode - */ - - bytes_per_ms = 0; - - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) - { - fb = s3s->fbmap[ma]; - s3s->fb[ma].accel_bpp = screen->fb[fb].bitsPerPixel; - s3s->fb[ma].accel_stride = screen->fb[fb].pixelStride; - s3s->fb[ma].bitmap_offset = screen->fb[fb].frameBuffer - s3c->frameBuffer; - switch (s3s->fb[ma].accel_bpp) { - case 8: - h_screen_off = hactive; - s3Set (s3vga, s3_pixel_length, 0); - s3Set (s3vga, s3_color_mode, 0); - control[ma] = 0; - /* - * Set up for double-pixel mode, switch color modes, - * divide the dclk and delay h blank by 2 dclks - */ - if (clock_double) - { - s3Set (s3vga, s3_color_mode, 1); - s3Set (s3vga, s3_dclk_over_2, 1); - s3Set (s3vga, s3_enable_clock_double, 1); - s3Set (s3vga, s3_h_skew, 1); - h_blank_start_adjust = -3; - h_blank_end_adjust = -4; - s3Set (s3vga, s3_border_select, 0); - } - break; - case 16: - h_screen_off = hactive * 2; - s3Set (s3vga, s3_pixel_length, 1); - if (screen->fb[fb].depth == 15) - control[ma] = 3 << 24; - else - control[ma] = 5 << 24; - if (clock_double) - { - if (screen->fb[fb].depth == 15) - s3Set (s3vga, s3_color_mode, 3); - else - s3Set (s3vga, s3_color_mode, 5); - s3Set (s3vga, s3_dclk_over_2, 1); - s3Set (s3vga, s3_enable_clock_double, 1); - s3Set (s3vga, s3_border_select, 0); - h_blank_start_adjust = 4; - h_blank_end_adjust = -4; - } - else - { - if (screen->fb[fb].depth == 15) - s3Set (s3vga, s3_color_mode, 2); - else - s3Set (s3vga, s3_color_mode, 4); - s3Set (s3vga, s3_dclk_over_2, 0); - s3Set (s3vga, s3_enable_clock_double, 0); - s3Set (s3vga, s3_delay_blank, 0); - } - break; - case 24: - control[ma] = 6 << 24; - h_screen_off = hactive * 3; - s3s->fb[ma].accel_bpp = 8; - s3s->fb[ma].accel_stride = screen->fb[fb].pixelStride * 3; - break; - case 32: - control[ma] = 7 << 24; - h_screen_off = hactive * 4; - s3Set (s3vga, s3_pixel_length, 3); - s3Set (s3vga, s3_color_mode, 0xd); - break; - } - bytes_per_ms += t->clock * (screen->fb[fb].bitsPerPixel / 8); - primary_stream_l1[ma] = (screen->width * screen->fb[fb].bitsPerPixel / (8 * 8)) - 1; - } - - /* - * X server starts frame buffer at top of memory - */ - s3Set (s3vga, s3_start_address, 0); - - /* - * Set various registers to avoid snow on the screen - */ - - fprintf (stderr, "bytes_per_ms %d\n", bytes_per_ms); - fprintf (stderr, "primary 0x%x master 0x%x command 0x%x lpb 0x%x cpu 0x%x 2d 0x%x\n", - s3Get (s3vga, s3_primary_stream_timeout), - s3Get (s3vga, s3_master_control_unit_timeout), - s3Get (s3vga, s3_command_buffer_timeout), - s3Get (s3vga, s3_lpb_timeout), - s3Get (s3vga, s3_cpu_timeout), - s3Get (s3vga, s3_2d_graphics_engine_timeout)); - - /* - * Test: - * accel x11perf -line500 - * cpu x11perf -circle500 - * - * cpu accel - * 1600x1200x32x85 (918000) 1 1 not enough - * 1600x1200x32x75 (810000) 3 2 - * 1600x1200x32x70 (756000) 4 3 - * 1600x1200x32x60 (648000) 6 5 - * - * 1280x1024x32x85 (630000) 6 4 - * 1280x1024x32x75 (540000) a 6 - * 1280x1024x32x60 (432000) 1f a - * - * 1152x900x32x85 (490000) a 6 - * 1152x900x32x75 (433000) 1f 8 - * 1152x900x32x70 (401000) 1f a - * 1152x900x32x66 (380000) 1f a - * - * 1024x768x32x85 (378000) 1f a - * 1024x768x32x75 (315000) 1f b - * 1024x768x32x70 (300000) 1f b - * 1024x768x32x60 (260000) 1f 12 - * - * 800x600x32x85 (225000) 1f 1a - * 800x600x32x72 (200000) 1f 1d - * 800x600x32x75 (198000) 1f 1d - * - * 1600x1200x16x85 (459000) 1f 8 - * 1600x1200x16x75 (405000) 1f a - * 1600x1200x16x70 (378000) 1f b - * 1600x1200x16x60 (324000) 1f f - * - * 1280x1024x16x85 (315000) 1f 12 - * 1280x1024x16x75 (270000) 1f 16 - * 1280x1024x16x60 (216000) 1f 1d - * - * 1600x1200x8x85 (229000) 1f 1f - * - */ - - if (s3CpuTimeout) - { - if (s3CpuTimeout < 0) - cpu_timeout = 0; - else - cpu_timeout = s3CpuTimeout; - if (s3AccelTimeout < 0) - accel_timeout = 0; - else if (s3AccelTimeout) - accel_timeout = s3AccelTimeout; - else - accel_timeout = s3CpuTimeout; - } - else if (bytes_per_ms >= 900000) - { - cpu_timeout = 0x01; - accel_timeout = 0x01; - } - else if (bytes_per_ms >= 800000) - { - cpu_timeout = 0x03; - accel_timeout = 0x02; - } - else if (bytes_per_ms >= 700000) - { - cpu_timeout = 0x04; - accel_timeout = 0x03; - } - else if (bytes_per_ms >= 600000) - { - cpu_timeout = 0x06; - accel_timeout = 0x04; - } - else if (bytes_per_ms >= 475000) - { - cpu_timeout = 0x0a; - accel_timeout = 0x06; - } - else if (bytes_per_ms >= 425000) - { - cpu_timeout = 0x1f; - accel_timeout = 0x8; - } - else if (bytes_per_ms >= 300000) - { - cpu_timeout = 0x1f; - accel_timeout = 0x0a; - } - else if (bytes_per_ms >= 250000) - { - cpu_timeout = 0x1f; - accel_timeout = 0x12; - } - else if (bytes_per_ms >= 200000) - { - cpu_timeout = 0x1f; - accel_timeout = 0x1a; - } - else - { - cpu_timeout = 0x1f; - accel_timeout = 0x1f; - } - - fprintf (stderr, "cpu 0x%x accel 0x%x\n", cpu_timeout, accel_timeout); - - s3Set (s3vga, s3_primary_stream_timeout, 0xc0); - s3Set (s3vga, s3_master_control_unit_timeout, 0xf); - s3Set (s3vga, s3_command_buffer_timeout, 0x1f); - s3Set (s3vga, s3_lpb_timeout, 0xf); - s3Set (s3vga, s3_2d_graphics_engine_timeout, accel_timeout); - s3Set (s3vga, s3_cpu_timeout, cpu_timeout); - - s3Set (s3vga, s3_fifo_fetch_timing, 1); - s3Set (s3vga, s3_fifo_drain_delay, 2); - - /* - * Compute horizontal register values from timings - */ - h_total = hactive + hblank - 5; - h_display_end = hactive - 1; - - h_sync_start = hactive + hfp + h_sync_start_adjust; - h_sync_end = hactive + hblank - hbp + h_sync_end_adjust; - /* - * pad the blank values narrow a bit and use the border_select to - * eliminate the remaining border; don't know why, but it doesn't - * work in the documented fashion - */ - h_blank_start = hactive + 1 + h_blank_start_adjust; - h_blank_end = hactive + hblank - 2 + h_blank_end_adjust; - /* - * The manual says h_total - 5, but the - * bios does differently... - */ - if (screen->width >= 1600) - h_start_fifo_fetch = h_total - 24; - else if (screen->width >= 1280) - h_start_fifo_fetch = h_total - 19; - else if (screen->width >= 1024) - h_start_fifo_fetch = h_total - 14; - else if (screen->width >= 800) - h_start_fifo_fetch = h_total - 10; - else - h_start_fifo_fetch = h_total - 5; - - h_start_fifo_fetch += h_start_fifo_fetch_adjust; - if (h_blank_end - h_blank_start >= 0x40) - h_blank_extend = 1; - else - h_blank_extend = 0; - - if (h_sync_end - h_sync_start >= 0x20) - h_sync_extend = 1; - else - h_sync_extend = 0; - -#ifdef DEBUG - fprintf (stderr, "h_total %d h_display_end %d\n", - h_total, h_display_end); - fprintf (stderr, "h_sync_start %d h_sync_end %d h_sync_extend %d\n", - h_sync_start, h_sync_end, h_sync_extend); - fprintf (stderr, "h_blank_start %d h_blank_end %d h_blank_extend %d\n", - h_blank_start, h_blank_end, h_blank_extend); -#endif - - s3Set (s3vga, s3_h_total, h_total); - s3Set (s3vga, s3_h_display_end, h_display_end); - s3Set (s3vga, s3_h_blank_start, h_blank_start); - s3Set (s3vga, s3_h_blank_end, h_blank_end); - s3Set (s3vga, s3_h_sync_start, h_sync_start); - s3Set (s3vga, s3_h_sync_end, h_sync_end); - s3Set (s3vga, s3_screen_offset, h_screen_off); - s3Set (s3vga, s3_h_start_fifo_fetch, h_start_fifo_fetch); - s3Set (s3vga, s3_h_sync_extend, h_sync_extend); - s3Set (s3vga, s3_h_blank_extend, h_blank_extend); - - s3Set (s3vga, s3_dac_power_saving_disable, 0); - s3Set (s3vga, s3_dac_power_up_time, hactive + hblank); - - s3Set (s3vga, s3_primary_stream_l1, primary_stream_l1[0]); - - s3Set (s3vga, s3_streams_fifo_delay, 0); - - v_total = vactive + vblank - 2; - v_display_end = vactive - 1; - - v_blank_start = vactive - 1 + v_blank_start_adjust; - v_blank_end = v_blank_start + vblank - 1 + v_blank_end_adjust; - - v_retrace_start = vactive + vfp; - v_retrace_end = vactive + vblank - vbp; - - s3Set (s3vga, s3_v_total, v_total); - s3Set (s3vga, s3_v_retrace_start, v_retrace_start); - s3Set (s3vga, s3_v_retrace_end, v_retrace_end); - s3Set (s3vga, s3_v_display_end, v_display_end); - s3Set (s3vga, s3_v_blank_start, v_blank_start); - s3Set (s3vga, s3_v_blank_end, v_blank_end); - - if (vactive >= 1024) - s3Set (s3vga, s3_line_compare, 0x7ff); - else - s3Set (s3vga, s3_line_compare, 0x3ff); - - /* - * Set cursor - */ - if (!screen->softCursor) - { - cursor_address = (s3s->cursor_base - s3c->frameBuffer) / 1024; - - s3Set (s3vga, s3_cursor_address, cursor_address); - s3Set (s3vga, s3_cursor_ms_x11, 0); - s3Set (s3vga, s3_cursor_enable, 1); - } - else - s3Set (s3vga, s3_cursor_enable, 0); - -#define MAKE_GBF(bds,be,stride,bpp,tile) (\ - ((bds) << 0) | \ - ((be) << 3) | \ - ((stride) << 4) | \ - ((bpp) << 16) | \ - ((tile) << 24)) - /* - * Set accelerator - */ - switch (screen->width) { -#if 0 - case 640: s3Set (s3vga, s3_ge_screen_width, 1); break; - case 800: s3Set (s3vga, s3_ge_screen_width, 2); break; - case 1024: s3Set (s3vga, s3_ge_screen_width, 0); break; - case 1152: s3Set (s3vga, s3_ge_screen_width, 4); break; - case 1280: s3Set (s3vga, s3_ge_screen_width, 3); break; - case 1600: s3Set (s3vga, s3_ge_screen_width, 6); break; -#endif - default: - s3Set (s3vga, s3_ge_screen_width, 7); /* use global bitmap descriptor */ - } - -#if 0 - crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */ -#endif - - /* - * Set DPMS to normal - */ - s3Set (s3vga, s3_hsync_control, 0); - s3Set (s3vga, s3_vsync_control, 0); - - _s3SetBlank (s3, s3vga, TRUE); - if (s3s->use_streams) - s3Set (s3vga, s3_primary_stream_definition, 1); - else - s3Set (s3vga, s3_primary_stream_definition, 0); - - VgaFlush(&s3vga->card); - VgaSetImm (&s3vga->card, s3_clock_load_imm, 1); - VgaSetImm(&s3vga->card, s3_clock_load_imm, 0); - - - if (s3s->use_streams) - { - fb = s3s->fbmap[0]; - s3->primary_stream_control = control[0]; - s3->primary_stream_addr_0 = - s3->primary_stream_addr_1 = s3s->fb[0].bitmap_offset; - s3->primary_stream_stride = screen->fb[fb].byteStride; - s3->primary_stream_xy = (1 << 16) | 1; - s3->primary_stream_size = ((screen->fb[fb].pixelStride - 1) << 16) | screen->height; - s3->primary_stream_mem = (screen->fb[fb].byteStride * screen->height) / 8 - 1; - if (s3s->fbmap[1] >= 0) - { - fb = s3s->fbmap[1]; - s3->blend_control = 5 << 24; - if (s3s->fb[0].accel_bpp == 8) - s3->chroma_key_control = 0x33000000 | s3s->fb[0].chroma_key; - else - s3->chroma_key_control = 0x13010101; - s3->secondary_stream_control = control[1] | screen->width; - s3->secondary_stream_h_scale = (1 << 15); - s3->color_adjustment = 0; - s3->secondary_stream_vscale = (1 << 15); - s3->secondary_stream_vinit = 0; - s3->secondary_stream_mbuf = 0; - s3->secondary_stream_addr_0 = - s3->secondary_stream_addr_1 = s3s->fb[1].bitmap_offset; - s3->secondary_stream_stride = screen->fb[fb].byteStride; - s3->secondary_stream_scount = screen->height; - s3->secondary_stream_xy = (1 << 16) | 1; - s3->secondary_stream_size = ((screen->fb[fb].pixelStride - 1) << 16) | screen->height; - s3->secondary_stream_mem = (1 << 22) | ((screen->fb[fb].byteStride * screen->height) / 8 - 1); - } - else - { - s3->blend_control = 1 << 24; - s3->secondary_stream_xy = 0x07ff07ff; - s3->secondary_stream_size = 0x00010001; - } - s3->streams_fifo = (0x20 << 11) | (0x20 << 5) | 0x2; - } - s3->mult_misc_read_sel = (((1 << 9) | - (1 << 11) | - (0xe << 12)) | - (((0xe << 0) | - (0xf << 12)) << 16)); - - s3->cmd_overflow_buf_ptr = (1 << 3); - s3->bci_power_management = (1 << 9); - s3->adv_func_cntl = (3 << 8) | (1 << 4) | (1 << 2) | 1; - s3->primary_bitmap_1 = 0; - s3->primary_bitmap_2 = 0; - s3->secondary_bitmap_1 = 0; - s3->secondary_bitmap_2 = 0; - s3s->current_ma = -1; - _s3SetBlank (s3, s3vga, FALSE); -#if 0 - { - VGA16 r; - static CARD32 streams[][2] = { - /* PCI registers */ - 0x8000, 0x8024, - 0x802c, 0x8034, - 0x803c, 0x8040, -#if 0 - 0x8080, 0x808c, /* AGP */ -#endif - 0x80dc, 0x80e0, - - /* 2D registers */ - 0x8168, 0x8188, - 0x8190, 0x81a0, - 0x81c0, 0x81d8, - 0x81e0, 0x8218, - 0x8300, 0x8308, - 0x8504, 0x8510, - - /* LPB/VIP registers */ - 0xff00, 0xff18, - 0xff20, 0xff38, - 0xff40, 0xff40, - 0xff70, 0xff78, - 0xff8c, 0xffa0, - -#if 0 - /* 3D registers */ - 0x48508, 0x48508, - 0x48528, 0x48528, - 0x48548, 0x48548, - 0x48584, 0x485f0, -#endif - - /* motion compensation registers */ - 0x48900, 0x48924, -#if 0 - 0x48928, 0x48928, -#endif - - /* Mastered data transfer registers */ - 0x48a00, 0x48a1c, - - /* configuation/status registers */ - 0x48c00, 0x48c18, - 0x48c20, 0x48c24, - 0x48c40, 0x48c50, - 0x48c60, 0x48c64, - - 0, 0, - }; -#ifdef PHOENIX -#undef stderr -#define stderr stdout -#endif - CARD32 *regs = (CARD32 *) s3c->registers; - int i; - CARD32 reg; - - - for (r = S3_SR + 0; r < S3_SR + S3_NSR; r++) - fprintf (stderr, "SR%02x = %02x\n", r-S3_SR, VgaFetch (&s3vga->card, r)); - for (r = S3_GR + 0; r < S3_GR + S3_NGR; r++) - fprintf (stderr, "GR%02x = %02x\n", r-S3_GR, VgaFetch (&s3vga->card, r)); - for (r = S3_AR + 0; r < S3_AR + S3_NAR; r++) - fprintf (stderr, "AR%02x = %02x\n", r-S3_AR, VgaFetch (&s3vga->card, r)); - for (r = S3_CR + 0; r < S3_CR + S3_NCR; r++) - fprintf (stderr, "CR%02x = %02x\n", r-S3_CR, VgaFetch (&s3vga->card, r)); - for (r = S3_DAC + 0; r < S3_DAC + S3_NDAC; r++) - fprintf (stderr, "DAC%02x = %02x\n", r-S3_DAC, VgaFetch (&s3vga->card, r)); - fprintf (stderr, "MISC_OUT = %02x\n", VgaFetch (&s3vga->card, S3_MISC_OUT)); - fprintf (stderr, "INPUT_STATUS = %02x\n", VgaFetch (&s3vga->card, S3_INPUT_STATUS_1)); - - - for (i = 0; streams[i][0]; i++) - { - for (reg = streams[i][0]; reg <= streams[i][1]; reg += 4) - fprintf (stderr, "0x%4x: 0x%08x\n", reg, regs[reg/4]); - } - } -#endif - return TRUE; -} - -void -s3Disable (ScreenPtr pScreen) -{ -} - -void -s3Restore (KdCardInfo *card) -{ - S3CardInfo *s3c = card->driver; - S3Ptr s3 = s3c->s3; - S3Vga *s3vga = &s3c->s3vga; - S3Save *save = &s3c->save; - CARD8 *cursor_base; - CARD8 streams_mode; - - _s3SetBlank (s3, s3vga, TRUE); - /* streams processor state */ - streams_mode = s3Get (s3vga, s3_streams_mode); - s3SetImm (s3vga, s3_streams_mode, 3); - s3->global_bitmap_1 = save->global_bitmap_1; - s3->global_bitmap_2 = save->global_bitmap_2; - s3->adv_func_cntl = save->adv_func_cntl; - s3->primary_bitmap_1 = save->primary_bitmap_1; - s3->primary_bitmap_2 = save->primary_bitmap_2; - s3->secondary_bitmap_1 = save->secondary_bitmap_1; - s3->secondary_bitmap_2 = save->secondary_bitmap_2; - s3->primary_stream_control = save->primary_stream_control; - s3->blend_control = save->blend_control; - s3->primary_stream_addr_0 = save->primary_stream_addr_0; - s3->primary_stream_addr_0 = save->primary_stream_addr_0; - s3->primary_stream_stride = save->primary_stream_stride; - s3->primary_stream_xy = save->primary_stream_xy; - s3->primary_stream_size = save->primary_stream_size; - s3->primary_stream_mem = save->primary_stream_mem; - s3->secondary_stream_xy = save->secondary_stream_xy; - s3->secondary_stream_size = save->secondary_stream_size; - s3->streams_fifo = save->streams_fifo; - s3SetImm (s3vga, s3_streams_mode, streams_mode); - /* graphics engine state */ - s3->alt_mix = save->alt_mix; - s3->write_mask = save->write_mask; - s3->fg = save->fg; - s3->bg = save->bg; - /* XXX should save and restore real values? */ - s3->scissors_tl = 0x00000000; - s3->scissors_br = 0x0fff0fff; - - VgaRestore (&s3vga->card); - s3Set (s3vga, s3_linear_window_size, 3); - s3Set (s3vga, s3_enable_linear, 1); - VgaFlush (&s3vga->card); - memcpy (s3c->frameBuffer, save->text_save, S3_TEXT_SAVE); - s3Reset (s3vga); - _s3SetBlank (s3, s3vga, FALSE); -} - -void -_s3SetSync (S3CardInfo *s3c, int hsync, int vsync) -{ - /* this abuses the macros defined to access the crtc structure */ - S3Ptr s3 = s3c->s3; - S3Vga *s3vga = &s3c->s3vga; - - s3Set (s3vga, s3_hsync_control, hsync); - s3Set (s3vga, s3_vsync_control, vsync); - VgaFlush (&s3vga->card); -} - -Bool -s3DPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - s3CardInfo(pScreenPriv); - S3Vga *s3vga = &s3c->s3vga; - - switch (mode) { - case KD_DPMS_NORMAL: - _s3SetSync (s3c, 0, 0); - _s3SetBlank (s3c->s3, s3vga, FALSE); - break; - case KD_DPMS_STANDBY: - _s3SetBlank (s3c->s3, s3vga, TRUE); - _s3SetSync (s3c, 1, 0); - break; - case KD_DPMS_SUSPEND: - _s3SetBlank (s3c->s3, s3vga, TRUE); - _s3SetSync (s3c, 0, 1); - break; - case KD_DPMS_POWERDOWN: - _s3SetBlank (s3c->s3, s3vga, TRUE); - _s3SetSync (s3c, 1, 1); - break; - } - return TRUE; -} - -Bool -s3InitScreen(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - KdScreenInfo *screen = pScreenPriv->screen; - s3CardInfo (pScreenPriv); - s3ScreenInfo (pScreenPriv); - int ma, fb; - - if (screen->fb[1].depth) - { - FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); - - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) - { - fb = s3s->fbmap[ma]; - pScrPriv->layer[fb].key = s3s->fb[ma].chroma_key; - } - } - return TRUE; -} - -void -s3ScreenFini (KdScreenInfo *screen) -{ - S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver; - - xfree (s3s); - screen->driver = 0; -} - -void -s3CardFini (KdCardInfo *card) -{ - S3CardInfo *s3c = (S3CardInfo *) card->driver; - - KdUnmapDevice (s3c->frameBuffer, s3c->memory); - KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET); - xfree (s3c); - card->driver = 0; -} - -KdCardFuncs s3Funcs = { - s3CardInit, - s3ScreenInit, - s3InitScreen, - s3Preserve, - s3Enable, - s3DPMS, - s3Disable, - s3Restore, - s3ScreenFini, - s3CardFini, - s3CursorInit, - s3CursorEnable, - s3CursorDisable, - s3CursorFini, - s3RecolorCursor, - s3DrawInit, - s3DrawEnable, - s3DrawSync, - s3DrawDisable, - s3DrawFini, - s3GetColors, - s3PutColors, -}; diff --git a/hw/kdrive/savage/s3.h b/hw/kdrive/savage/s3.h deleted file mode 100644 index d8db0ebbf..000000000 --- a/hw/kdrive/savage/s3.h +++ /dev/null @@ -1,533 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifndef _S3_H_ -#define _S3_H_ - -#include "kdrive.h" -#include "s3reg.h" - -/* VESA Approved Register Definitions */ - -/* - * Linear Addressing 000 0000 - 0ff ffff (16m) - * Image data transfer 100 0000 - 100 7fff (32k) - * PCI config 100 8000 - 100 8043 - * Packed enhanced regs 100 8100 - 100 814a - * Streams regs 100 8180 - 100 81ff - * Current Y pos 100 82e8 - * CRT VGA 3b? regs 100 83b0 - 100 83bf - * CRT VGA 3c? regs 100 83c0 - 100 83cf - * CRT VGA 3d? regs 100 83d0 - 100 83df - * Subsystem status (42e8h) 100 8504 - * Advanced function (42e8h) 100 850c - * Enhanced regs 100 86e8 - 100 eeea - * Local peripheral bus 100 ff00 - 100 ff5c - * - * We don't care about the image transfer or PCI regs, so - * this structure starts at the packed enhanced regs - */ - -typedef volatile CARD32 VOL32; -typedef volatile CARD16 VOL16; -typedef volatile CARD8 VOL8; - -typedef volatile struct _s3 { - VOL32 alt_curxy; /* 8100 */ - VOL32 _pad0; /* 8104 */ - VOL32 alt_step; /* 8108 */ - VOL32 _pad1; /* 810c */ - VOL32 err_term; /* 8110 */ - VOL32 _pad2; /* 8114 */ - VOL32 cmd_gp_stat; /* 8118 */ - VOL32 short_stroke; /* 811c */ - VOL32 bg; /* 8120 */ - VOL32 fg; /* 8124 */ - VOL32 write_mask; /* 8128 */ - VOL32 read_mask; /* 812c */ - VOL32 color_cmp; /* 8130 */ - VOL32 alt_mix; /* 8134 */ - VOL32 scissors_tl; /* 8138 */ - VOL32 scissors_br; /* 813c */ -#if 0 - VOL16 pix_cntl; /* 8140 */ - VOL16 mult_misc2; /* 8142 */ -#else - VOL32 pix_cntl_mult_misc2; /* 8140 */ -#endif - VOL32 mult_misc_read_sel; /* 8144 */ - VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */ - VOL8 _pad3a[0x1c]; /* 814c */ - VOL32 global_bitmap_1; /* 8168 */ - VOL32 global_bitmap_2; /* 816c */ - VOL32 primary_bitmap_1; /* 8170 */ - VOL32 primary_bitmap_2; /* 8174 */ - VOL32 secondary_bitmap_1; /* 8178 */ - VOL32 secondary_bitmap_2; /* 817c */ - VOL32 primary_stream_control; /* 8180 */ - VOL32 chroma_key_control; /* 8184 */ - VOL32 genlocking_control; /* 8188 */ - VOL8 _pad3b[0x4]; /* 818c */ - VOL32 secondary_stream_control; /* 8190 */ - VOL32 chroma_key_upper_bound; /* 8194 */ - VOL32 secondary_stream_h_scale; /* 8198 */ - VOL32 color_adjustment; /* 819c */ - VOL32 blend_control; /* 81a0 */ - VOL8 _pad3c[0x1c]; /* 81a4 */ - VOL32 primary_stream_addr_0; /* 81c0 */ - VOL32 primary_stream_addr_1; /* 81c4 */ - VOL32 primary_stream_stride; /* 81c8 */ - VOL32 secondary_stream_mbuf; /* 81cc */ - VOL32 secondary_stream_addr_0;/* 81d0 */ - VOL32 secondary_stream_addr_1;/* 81d4 */ - VOL32 secondary_stream_stride;/* 81d8 */ - VOL8 _pad81dc[4]; /* 81dc */ - VOL32 secondary_stream_vscale;/* 81e0 */ - VOL32 secondary_stream_vinit; /* 81e4 */ - VOL32 secondary_stream_scount;/* 81e8 */ - VOL32 streams_fifo; /* 81ec */ - VOL32 primary_stream_xy; /* 81f0 */ - VOL32 primary_stream_size; /* 81f4 */ - VOL32 secondary_stream_xy; /* 81f8 */ - VOL32 secondary_stream_size; /* 81fc */ - VOL8 _pad8200[0xe8]; /* 8200 */ - VOL32 cur_y; /* 82e8 */ - VOL8 _pad4[0x14]; /* 82ec */ - VOL32 primary_stream_mem; /* 8300 */ - VOL32 secondary_stream_mem; /* 8304 */ - VOL8 _pad8308[0xD2]; /* 8308 */ - VOL8 input_status_1; /* 83da */ - VOL8 _pad83db[0x131]; /* 83db */ - VOL32 adv_func_cntl; /* 850c */ - VOL8 _pad8510[0x5dd8]; /* 8510 */ - VOL32 pix_trans; /* e2e8 */ - VOL8 _pade2ec[0x3a92c]; /* e2ec */ - VOL32 cmd_overflow_buf_ptr; /* 48c18 */ - VOL8 _pad48c1c[0x8]; /* 48c1c */ - VOL32 bci_power_management; /* 48c24 */ - VOL8 _pad48c28[0x38]; /* 48c28 */ - VOL32 alt_status_0; /* 48c60 */ - VOL32 alt_status_1; /* 48c64 */ -} S3, *S3Ptr; - -#define VGA_STATUS_1_DTM 0x01 -#define VGA_STATUS_1_VSY 0x08 - -#define DAC_MASK 0x03c6 -#define DAC_R_INDEX 0x03c7 -#define DAC_W_INDEX 0x03c8 -#define DAC_DATA 0x03c9 -#define DISP_STAT 0x02e8 -#define H_TOTAL 0x02e8 -#define H_DISP 0x06e8 -#define H_SYNC_STRT 0x0ae8 -#define H_SYNC_WID 0x0ee8 -#define V_TOTAL 0x12e8 -#define V_DISP 0x16e8 -#define V_SYNC_STRT 0x1ae8 -#define V_SYNC_WID 0x1ee8 -#define DISP_CNTL 0x22e8 -#define ADVFUNC_CNTL 0x4ae8 -#define SUBSYS_STAT 0x42e8 -#define SUBSYS_CNTL 0x42e8 -#define ROM_PAGE_SEL 0x46e8 -#define CUR_Y 0x82e8 -#define CUR_X 0x86e8 -#define DESTY_AXSTP 0x8ae8 -#define DESTX_DIASTP 0x8ee8 -#define ERR_TERM 0x92e8 -#define MAJ_AXIS_PCNT 0x96e8 -#define GP_STAT 0x9ae8 -#define CMD 0x9ae8 -#define SHORT_STROKE 0x9ee8 -#define BKGD_COLOR 0xa2e8 -#define FRGD_COLOR 0xa6e8 -#define WRT_MASK 0xaae8 -#define RD_MASK 0xaee8 -#define COLOR_CMP 0xb2e8 -#define BKGD_MIX 0xb6e8 -#define FRGD_MIX 0xbae8 -#define MULTIFUNC_CNTL 0xbee8 -#define MIN_AXIS_PCNT 0x0000 -#define SCISSORS_T 0x1000 -#define SCISSORS_L 0x2000 -#define SCISSORS_B 0x3000 -#define SCISSORS_R 0x4000 -#define MEM_CNTL 0x5000 -#define PATTERN_L 0x8000 -#define PATTERN_H 0x9000 -#define PIX_CNTL 0xa000 -#define CONTROL_MISC2 0xd000 -#define PIX_TRANS 0xe2e8 - -/* Advanced Function Control Regsiter */ -#define CLKSEL 0x0004 -#define DISABPASSTHRU 0x0001 - -/* Graphics Processor Status Register */ - -#define GPNSLOT 13 - -#define GPBUSY_1 0x0080 -#define GPBUSY_2 0x0040 -#define GPBUSY_3 0x0020 -#define GPBUSY_4 0x0010 -#define GPBUSY_5 0x0008 -#define GPBUSY_6 0x0004 -#define GPBUSY_7 0x0002 -#define GPBUSY_8 0x0001 -#define GPBUSY_9 0x8000 -#define GPBUSY_10 0x4000 -#define GPBUSY_11 0x2000 -#define GPBUSY_12 0x1000 -#define GPBUSY_13 0x0800 - -#define GPEMPTY 0x0400 -#define GPBUSY 0x0200 -#define DATDRDY 0x0100 - -/* Command Register */ -#define CMD_NOP 0x0000 -#define CMD_LINE 0x2000 -#define CMD_RECT 0x4000 -#define CMD_RECTV1 0x6000 -#define CMD_RECTV2 0x8000 -#define CMD_LINEAF 0xa000 -#define CMD_BITBLT 0xc000 -#define CMD_PATBLT 0xe000 -#define CMD_OP_MSK 0xe000 -#define BYTSEQ 0x1000 -#define _32BITNOPAD 0x0600 -#define _32BIT 0x0400 -#define _16BIT 0x0200 -#define _8BIT 0x0000 -#define PCDATA 0x0100 -#define INC_Y 0x0080 -#define YMAJAXIS 0x0040 -#define INC_X 0x0020 -#define DRAW 0x0010 -#define LINETYPE 0x0008 -#define LASTPIX 0x0004 /* Draw last pixel in line */ -#define PLANAR 0x0002 -#define WRTDATA 0x0001 - -/* Background Mix Register */ -#define BSS_BKGDCOL 0x0000 -#define BSS_FRGDCOL 0x0020 -#define BSS_PCDATA 0x0040 -#define BSS_BITBLT 0x0060 - -/* Foreground Mix Register */ -#define FSS_BKGDCOL 0x0000 -#define FSS_FRGDCOL 0x0020 -#define FSS_PCDATA 0x0040 -#define FSS_BITBLT 0x0060 - -/* The Mixes */ -#define MIX_MASK 0x001f - -#define MIX_NOT_DST 0x0000 -#define MIX_0 0x0001 -#define MIX_1 0x0002 -#define MIX_DST 0x0003 -#define MIX_NOT_SRC 0x0004 -#define MIX_XOR 0x0005 -#define MIX_XNOR 0x0006 -#define MIX_SRC 0x0007 -#define MIX_NAND 0x0008 -#define MIX_NOT_SRC_OR_DST 0x0009 -#define MIX_SRC_OR_NOT_DST 0x000a -#define MIX_OR 0x000b -#define MIX_AND 0x000c -#define MIX_SRC_AND_NOT_DST 0x000d -#define MIX_NOT_SRC_AND_DST 0x000e -#define MIX_NOR 0x000f - -#define MIX_MIN 0x0010 -#define MIX_DST_MINUS_SRC 0x0011 -#define MIX_SRC_MINUS_DST 0x0012 -#define MIX_PLUS 0x0013 -#define MIX_MAX 0x0014 -#define MIX_HALF__DST_MINUS_SRC 0x0015 -#define MIX_HALF__SRC_MINUS_DST 0x0016 -#define MIX_AVERAGE 0x0017 -#define MIX_DST_MINUS_SRC_SAT 0x0018 -#define MIX_SRC_MINUS_DST_SAT 0x001a -#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c -#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e -#define MIX_AVERAGE_SAT 0x001f - -/* Pixel Control Register */ -#define MIXSEL_FRGDMIX 0x0000 -#define MIXSEL_PATT 0x0040 -#define MIXSEL_EXPPC 0x0080 -#define MIXSEL_EXPBLT 0x00c0 -#define COLCMPOP_F 0x0000 -#define COLCMPOP_T 0x0008 -#define COLCMPOP_GE 0x0010 -#define COLCMPOP_LT 0x0018 -#define COLCMPOP_NE 0x0020 -#define COLCMPOP_EQ 0x0028 -#define COLCMPOP_LE 0x0030 -#define COLCMPOP_GT 0x0038 -#define PLANEMODE 0x0004 - -/* Multifunction Control Misc 8144 */ -#define MISC_DST_BA_0 (0x0 << 0) -#define MISC_DST_BA_1 (0x1 << 0) -#define MISC_DST_BA_2 (0x2 << 0) -#define MISC_DST_BA_3 (0x3 << 0) -#define MISC_SRC_BA_0 (0x0 << 2) -#define MISC_SRC_BA_1 (0x1 << 2) -#define MISC_SRC_BA_2 (0x2 << 2) -#define MISC_SRC_BA_3 (0x3 << 2) -#define MISC_RSF (1 << 4) -#define MISC_EXT_CLIP (1 << 5) -#define MISC_SRC_NE (1 << 7) -#define MISC_ENB_CMP (1 << 8) -#define MISC_32B (1 << 9) -#define MISC_DC (1 << 11) -#define MISC_INDEX_E (0xe << 12) - -#define S3_SAVAGE4_SLOTS 0x0001ffff -#define S3_SAVAGE4_2DI 0x00800000 - -#define _s3WaitLoop(s3,mask,value){ \ - int __loop = 1000000; \ - while (((s3)->alt_status_0 & (mask)) != (value)) \ - if (--__loop == 0) { \ - ErrorF ("savage wait loop failed 0x%x\n", s3->alt_status_0); \ - break; \ - } \ -} - -#define S3_SAVAGE4_ROOM 10 - -#define _s3WaitSlots(s3,n) { \ - int __loop = 1000000; \ - while (((s3)->alt_status_0 & S3_SAVAGE4_SLOTS) >= S3_SAVAGE4_ROOM-(n)) \ - if (--__loop == 0) { \ - ErrorF ("savage wait loop failed 0x%x\n", s3->alt_status_0); \ - break; \ - } \ -} - -#define _s3WaitEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS, 0) -#define _s3WaitIdleEmpty(s3) _s3WaitLoop(s3,S3_SAVAGE4_SLOTS|S3_SAVAGE4_2DI, S3_SAVAGE4_2DI) -#define _s3WaitIdle(s3) _s3WaitLoop(s3,S3_SAVAGE4_2DI, S3_SAVAGE4_2DI) - -typedef struct _s3Cursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} S3Cursor; - -typedef struct _s3PatternCache { - int id; - int x, y; -} S3PatternCache; - -typedef struct _s3Patterns { - S3PatternCache *cache; - int ncache; - int last_used; - int last_id; -} S3Patterns; - -#define S3_CLOCK_REF 14318 /* KHz */ - -#define S3_CLOCK(m,n,r) ((S3_CLOCK_REF * ((m) + 2)) / (((n) + 2) * (1 << (r)))) - -#define S3_MAX_CLOCK 150000 /* KHz */ - -typedef struct _s3Timing { - /* label */ - int horizontal; - int vertical; - int rate; - /* horizontal timing */ - int hfp; /* front porch */ - int hbp; /* back porch */ - int hblank; /* blanking */ - /* vertical timing */ - int vfp; /* front porch */ - int vbp; /* back porch */ - int vblank; /* blanking */ - /* clock values */ - int dac_m; - int dac_n; - int dac_r; -} S3Timing; - -#define S3_TEXT_SAVE (64*1024) - -typedef struct _s3Save { - CARD8 cursor_fg; - CARD8 cursor_bg; - CARD8 lock1; - CARD8 lock2; - CARD8 locksrtc; - CARD8 clock_mode; - CARD32 alt_mix; - CARD32 write_mask; - CARD32 fg; - CARD32 bg; - CARD32 global_bitmap_1; - CARD32 global_bitmap_2; - CARD32 adv_func_cntl; - CARD32 primary_bitmap_1; - CARD32 primary_bitmap_2; - CARD32 secondary_bitmap_1; - CARD32 secondary_bitmap_2; - CARD32 primary_stream_control; - CARD32 blend_control; - CARD32 primary_stream_addr_0; - CARD32 primary_stream_addr_1; - CARD32 primary_stream_stride; - CARD32 primary_stream_xy; - CARD32 primary_stream_size; - CARD32 primary_stream_mem; - CARD32 secondary_stream_xy; - CARD32 secondary_stream_size; - CARD32 streams_fifo; - CARD8 text_save[S3_TEXT_SAVE]; -} S3Save; - -typedef struct _s3CardInfo { - S3Ptr s3; /* pointer to register structure */ - int memory; /* amount of memory */ - CARD8 *frameBuffer; /* pointer to frame buffer */ - CARD8 *registers; /* pointer to register map */ - S3Vga s3vga; - S3Save save; - Bool need_sync; - Bool bios_initialized; /* whether the bios has been run */ -} S3CardInfo; - -typedef struct _s3FbInfo { - CARD8 *offscreen; /* pointer to offscreen area */ - int offscreen_y; /* top y coordinate of offscreen area */ - int offscreen_x; /* top x coordinate of offscreen area */ - int offscreen_width; /* width of offscreen area */ - int offscreen_height; /* height of offscreen area */ - S3Patterns patterns; - CARD32 bitmap_offset; - int accel_stride; - int accel_bpp; - CARD32 chroma_key; -} S3FBInfo; - -typedef struct _s3ScreenInfo { - CARD8 *cursor_base; /* pointer to cursor area */ - S3Cursor cursor; - Bool managing_border; - Bool use_streams; - int primary_depth; - int current_ma; - CARD32 border_pixel; - S3FBInfo fb[KD_MAX_FB]; - RegionRec region[KD_MAX_FB]; - int fbmap[KD_MAX_FB+1]; /* map from fb to stream */ -} S3ScreenInfo; - -#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver)) -#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd) - -#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver)) -#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd) - -Bool s3CardInit (KdCardInfo *); -Bool s3ScreenInit (KdScreenInfo *); -Bool s3Enable (ScreenPtr pScreen); -void s3Disable (ScreenPtr pScreen); -void s3Fini (ScreenPtr pScreen); - -Bool s3CursorInit (ScreenPtr pScreen); -void s3CursorEnable (ScreenPtr pScreen); -void s3CursorDisable (ScreenPtr pScreen); -void s3CursorFini (ScreenPtr pScreen); -void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs); - -void s3DumbCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); - -Bool s3DrawInit (ScreenPtr pScreen); -void s3DrawEnable (ScreenPtr pScreen); -void s3DrawSync (ScreenPtr pScreen); -void s3DrawDisable (ScreenPtr pScreen); -void s3DrawFini (ScreenPtr pScreen); - -void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); -void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -void S3InitCard (KdCardAttr *attr); - -void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco); - -extern KdCardFuncs s3Funcs; - -/* - * Wait for the begining of the retrace interval - */ - -#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\ - DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \ - __FILE__, __LINE__)); \ - break; \ -} - -#define DRAW_DEBUG(a) - -#define _s3WaitVRetrace(s3vga) { \ - int _loop_count; \ - _loop_count = 0; \ - while (s3GetImm(s3vga, s3_vertical_sync_active) != 0) S3_RETRACE_LOOP_CHECK; \ - _loop_count = 0; \ - while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \ -} -#define _s3WaitVRetraceFast(s3) { \ - int _loop_count; \ - _loop_count = 0; \ - while (s3->input_status_1 & 8) S3_RETRACE_LOOP_CHECK; \ - _loop_count = 0; \ - while ((s3->input_status_1 & 8) == 0) S3_RETRACE_LOOP_CHECK; \ -} -/* - * Wait for the begining of the retrace interval - */ -#define _s3WaitVRetraceEnd(s3vga) { \ - int _loop_count; \ - _loop_count = 0; \ - while (s3GetImm(s3vga, s3_vertical_sync_active) == 0) S3_RETRACE_LOOP_CHECK; \ - _loop_count = 0; \ - while (s3GetImm(s3vga, s3_vertical_sync_active) != 0) S3_RETRACE_LOOP_CHECK; \ -} - -#define S3_CURSOR_WIDTH 64 -#define S3_CURSOR_HEIGHT 64 -#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8) - -#define S3_TILE_SIZE 8 - -#endif /* _S3_H_ */ diff --git a/hw/kdrive/savage/s3.nick b/hw/kdrive/savage/s3.nick deleted file mode 100644 index 8f6791f87..000000000 --- a/hw/kdrive/savage/s3.nick +++ /dev/null @@ -1,41 +0,0 @@ -/* $RCSId: $ */ - -global f_ref = 14318000; - -function s3_clock (m, n, r) -{ - return f_ref * (m + 2) / ((n + 2) * (2 ^ r)); -} - -function s3_near (f1, f2) -{ - return abs (f1 - f2) < f1 / 10; -} - -function s3_clocks (f) -{ - auto m, n, r, ft; - auto dist, min_dist; - auto min_m, min_n, min_r; - - min_dist = f / 5; - for (r = 0; r <= 3; r++) - for (n = 0; n <= 31; n++) - for (m = 0; m <= 127; m++) - { - ft = s3_clock (m, n, r); - if (s3_near (ft, f)) - printf ("m %d n %d r %d = %d\n", - m, n, r, ft); - dist = abs (f - ft); - if (dist < min_dist) - { - min_dist = dist; - min_m = m; - min_n = n; - min_r = r; - } - } - printf ("m %d n %d r %d f %d dist %d\n", - min_m, min_n, min_r, s3_clock(min_m, min_n, min_r), min_dist); -} diff --git a/hw/kdrive/savage/s3clock.c b/hw/kdrive/savage/s3clock.c deleted file mode 100644 index 9e3f8b3e0..000000000 --- a/hw/kdrive/savage/s3clock.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -/* - * Clock synthesis: - * - * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R))) - * - * Constraints: - * - * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz - * 2. N >= 1 - * - * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) - * Horizontal refresh rate = clock / (hsize + hblank) - */ - -/* all in kHz */ - -void -s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR, int minVco) -{ - int M, N, R, bestM, bestN; - int f_vco, f_out; - int err, abserr, besterr; - - /* - * Compute correct R value to keep VCO in range - */ - for (R = 0; R <= maxR; R++) - { - f_vco = target * (1 << R); - if (f_vco >= minVco) - break; - } - - /* M = f_out / f_ref * ((N + 2) * (1 << R)); */ - besterr = target; - for (N = 1; N <= maxN; N++) - { - M = ((target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) + S3_CLOCK_REF/2) / S3_CLOCK_REF - 2; - if (0 <= M && M <= maxM) - { - f_out = S3_CLOCK(M,N,R); - err = target - f_out; - if (err < 0) - err = -err; - if (err < besterr) - { - besterr = err; - bestM = M; - bestN = N; - } - } - } - *Mp = bestM; - *Np = bestN; - *Rp = R; -} diff --git a/hw/kdrive/savage/s3cmap.c b/hw/kdrive/savage/s3cmap.c deleted file mode 100644 index 094a24755..000000000 --- a/hw/kdrive/savage/s3cmap.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -void -s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - s3CardInfo(pScreenPriv); - S3Vga *s3vga = &s3c->s3vga; - - while (ndef--) - { - s3SetImm (s3vga, s3_dac_read_index, pdefs->pixel); - pdefs->red = s3GetImm (s3vga, s3_dac_data) << 8; - pdefs->green = s3GetImm (s3vga, s3_dac_data) << 8; - pdefs->blue = s3GetImm (s3vga, s3_dac_data) << 8; - pdefs++; - } -} - -#ifndef S3_TRIO -#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d))) - -void -s3SetTrueChromaKey (ScreenPtr pScreen, int pfb, xColorItem *pdef) -{ - FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); - KdScreenPriv(pScreen); - s3ScreenInfo(pScreenPriv); - int fb, ma; - CARD32 key; - int r, g, b; - - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) - { - fb = s3s->fbmap[ma]; - if (fb != pfb && pScreenPriv->screen->fb[fb].redMask) - { - r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask); - g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask); - b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask); - key = ((Shift(pdef->red,r) & pScreenPriv->screen->fb[fb].redMask) | - (Shift(pdef->green,g) & pScreenPriv->screen->fb[fb].greenMask) | - (Shift(pdef->blue,b) & pScreenPriv->screen->fb[fb].blueMask)); - if (pScrPriv->layer[fb].key != key) - { - pScrPriv->layer[fb].key = key; - (*pScrPriv->PaintKey) (&pScrPriv->layer[fb].u.run.pixmap->drawable, - &pScrPriv->layer[pfb].u.run.region, - pScrPriv->layer[fb].key, fb); - } - } - } -} -#endif - -void -s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - s3CardInfo(pScreenPriv); - s3ScreenInfo(pScreenPriv); - S3Vga *s3vga = &s3c->s3vga; - xColorItem *chroma = 0; - CARD32 key; - -#if 0 - _s3WaitVRetrace (s3vga); -#else - S3Ptr s3 = s3c->s3; - _s3WaitVRetraceFast(s3); -#endif -#ifndef S3_TRIO - if (pScreenPriv->screen->fb[1].depth) - { - FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); - key = pScrPriv->layer[fb].key; - } -#endif - else - key = ~0; - while (ndef--) - { - if (pdefs->pixel == key) - chroma = pdefs; - s3SetImm (s3vga, s3_dac_write_index, pdefs->pixel); - s3SetImm (s3vga, s3_dac_data, pdefs->red >> 8); - s3SetImm (s3vga, s3_dac_data, pdefs->green >> 8); - s3SetImm (s3vga, s3_dac_data, pdefs->blue >> 8); - pdefs++; - } -#ifndef S3_TRIO - if (chroma && !pScreenPriv->closed) - s3SetTrueChromaKey (pScreen, fb, chroma); -#endif -} - diff --git a/hw/kdrive/savage/s3curs.c b/hw/kdrive/savage/s3curs.c deleted file mode 100644 index 5928989a6..000000000 --- a/hw/kdrive/savage/s3curs.c +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" -#include "s3draw.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - s3CardInfo(pScreenPriv); \ - s3ScreenInfo(pScreenPriv); \ - S3Ptr s3 = s3c->s3; \ - S3Vga *s3vga = &s3c->s3vga; \ - S3Cursor *pCurPriv = &s3s->cursor - -static void -_s3MoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - DRAW_DEBUG ((DEBUG_CURSOR, "s3MoveCursor %d %d", x, y)); - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - - - /* This is the recommended order to move the cursor */ - - s3SetImm (s3vga, s3_cursor_xhigh, xhigh); - s3SetImm (s3vga, s3_cursor_xlow, xlow); - s3SetImm (s3vga, s3_cursor_ylow, ylow); - s3SetImm (s3vga, s3_cursor_xoff, xoff); - s3SetImm (s3vga, s3_cursor_yoff, yoff); - s3SetImm (s3vga, s3_cursor_yhigh, yhigh); - - DRAW_DEBUG ((DEBUG_CURSOR, "s3MoveCursor done")); -} - -static void -s3MoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _s3MoveCursor (pScreen, x, y); -} - -#define S3Trunc(c) (((c) >> 8) & 0xff) - -#define S3CursColor(r,g,b) ((S3Trunc(r) << 16) | \ - (S3Trunc(g) << 8) | \ - (S3Trunc(b))) - -static void -s3AllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - if (s3s->use_streams) - { - pCurPriv->source = S3CursColor(pCursor->foreRed, - pCursor->foreGreen, - pCursor->foreBlue); - pCurPriv->mask = S3CursColor(pCursor->backRed, - pCursor->backGreen, - pCursor->backBlue); - } - else - { - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } - } -} - -static void -_s3SetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - /* set foreground */ - /* Reset cursor color stack pointers */ - (void) s3GetImm (s3vga, s3_cursor_enable); - s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source); - s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source >> 8); - s3SetImm (s3vga, s3_cursor_fg, pCurPriv->source >> 16); - - /* set background */ - /* Reset cursor color stack pointers */ - (void) s3GetImm (s3vga, s3_cursor_enable); - s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask); - s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask >> 8); - s3SetImm (s3vga, s3_cursor_bg, pCurPriv->mask >> 16); -} - -void -s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - s3AllocCursorColors (pScreen); - _s3SetCursorColors (pScreen); -} - -static void -s3LoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - unsigned char r[2], g[2], b[2]; - unsigned long *ram; - unsigned long *msk, *mskLine, *src, *srcLine; - unsigned long and, xor; - int i, j; - int cursor_address; - int wsrc; - unsigned char ramdac_control_; - - /* - * Allocate new colors - */ - s3AllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (unsigned long *) s3s->cursor_base; - mskLine = (unsigned long *) bits->mask; - srcLine = (unsigned long *) bits->source; - - h = bits->height; - if (h > S3_CURSOR_HEIGHT) - h = S3_CURSOR_HEIGHT; - - wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */ - - for (i = 0; i < S3_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += wsrc; - srcLine += wsrc; - for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) { - - unsigned long m, s; - - if (i < h && j < wsrc) - { - m = *msk++; - s = *src++; - xor = m & s; - and = ~m; - } - else - { - and = 0xffffffff; - xor = 0x00000000; - } - - S3AdjustBits32(and); - S3AdjustBits32(xor); -#define S3SwapNibbles(x) ((x) = (((x) & 0x0f0f0f0f) << 4 | \ - ((x) >> 4) & 0x0f0f0f0f)) - if (s3s->use_streams) - { - S3SwapNibbles(and); - S3SwapNibbles(xor); - } - *ram++ = (and & 0xffff) | (xor << 16); - *ram++ = (and >> 16) | (xor & 0xffff0000); - } - } - - _s3WaitIdle (s3); - - /* Set new color */ - _s3SetCursorColors (pScreen); - - /* Enable the cursor */ - s3SetImm (s3vga, s3_cursor_ms_x11, 0); - s3SetImm (s3vga, s3_cursor_enable, 1); - - /* Wait for VRetrace to make sure the position is read */ - _s3WaitVRetrace (s3vga); - - /* Move to new position */ - _s3MoveCursor (pScreen, x, y); -} - -static void -s3UnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - s3SetImm (s3vga, s3_cursor_enable, 0); -} - -static Bool -s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - s3LoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - s3LoadCursor (pScreen, x, y); - else - s3UnloadCursor (pScreen); -} - -miPointerSpriteFuncRec s3PointerSpriteFuncs = { - s3RealizeCursor, - s3UnrealizeCursor, - s3SetCursor, - s3MoveCursor, -}; - -static void -s3QueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -s3CursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!s3s->cursor_base) - { - DRAW_DEBUG ((DEBUG_CURSOR,"Not enough screen memory for cursor %d", s3d->memory)); - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = S3_CURSOR_WIDTH; - pCurPriv->height= S3_CURSOR_HEIGHT; - pScreen->QueryBestSize = s3QueryBestSize; - miPointerInitialize (pScreen, - &s3PointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -s3CursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - DRAW_DEBUG ((DEBUG_INIT, "s3CursorEnable")); - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - s3LoadCursor (pScreen, x, y); - } - else - s3UnloadCursor (pScreen); - } -} - -void -s3CursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - s3UnloadCursor (pScreen); - } - } -} - -void -s3CursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/savage/s3draw.c b/hw/kdrive/savage/s3draw.c deleted file mode 100644 index da0d6849f..000000000 --- a/hw/kdrive/savage/s3draw.c +++ /dev/null @@ -1,3114 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" -#include "s3draw.h" - -#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" - -/* - * Map X rops to S3 rops - */ - -short s3alu[16] = { - MIX_0, - MIX_AND, - MIX_SRC_AND_NOT_DST, - MIX_SRC, - MIX_NOT_SRC_AND_DST, - MIX_DST, - MIX_XOR, - MIX_OR, - MIX_NOR, - MIX_XNOR, - MIX_NOT_DST, - MIX_SRC_OR_NOT_DST, - MIX_NOT_SRC, - MIX_NOT_SRC_OR_DST, - MIX_NAND, - MIX_1 -}; - -/* - * Handle pixel transfers - */ - -#define BURST -#ifdef BURST -#define PixTransDeclare VOL32 *pix_trans_base = (VOL32 *) (s3c->registers),\ - *pix_trans = pix_trans_base -#define PixTransStart(n) if (pix_trans + (n) > pix_trans_base + 8192) pix_trans = pix_trans_base -#define PixTransStore(t) *pix_trans++ = (t) -#else -#define PixTransDeclare VOL32 *pix_trans = &s3->pix_trans -#define PixTransStart(n) -#define PixTransStore(t) *pix_trans = (t) -#endif - -DevPrivateKey s3GCPrivateKey = &s3GCPrivateKey; -DevPrivateKey s3WindowPrivateKey = &s3WindowPrivateKey; - -/* - s3DoBitBlt - ============= - Bit Blit for all window to window blits. -*/ - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -void -s3CopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupS3(pDstDrawable->pScreen); - int srcX, srcY, dstX, dstY; - int w, h; - int flags; - - if (sourceInvarient (pGC->alu)) - { - s3FillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); - return; - } - - s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC)); - _s3SetBlt(s3,pGC->alu,pGC->planemask); - DRAW_DEBUG ((DEBUG_RENDER, "s3CopyNtoN alu %d planemask 0x%x", - pGC->alu, pGC->planemask)); - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - flags = 0; - if (reverse) - { - dstX = pbox->x2 - 1; - } - else - { - dstX = pbox->x1; - flags |= INC_X; - } - srcX = dstX + dx; - - if (upsidedown) - { - dstY = pbox->y2 - 1; - } - else - { - dstY = pbox->y1; - flags |= INC_Y; - } - srcY = dstY + dy; - - _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); - pbox++; - } - MarkSyncS3 (pSrcDrawable->pScreen); -} - -RegionPtr -s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - SetupS3(pDstDrawable->pScreen); - - if (pSrcDrawable->type == DRAWABLE_WINDOW && - pDstDrawable->type == DRAWABLE_WINDOW) - { - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, s3CopyNtoN, 0, 0); - } - return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, dsty); -} - -typedef struct _s31toNargs { - unsigned long copyPlaneFG, copyPlaneBG; - Bool opaque; -} s31toNargs; - -void -_s3Stipple (S3CardInfo *s3c, - FbStip *psrcBase, - FbStride widthSrc, - int srcx, - int srcy, - int dstx, - int dsty, - int width, - int height) -{ - S3Ptr s3 = s3c->s3; - FbStip *psrcLine, *psrc; - FbStride widthRest; - FbStip bits, tmp, lastTmp; - int leftShift, rightShift; - int nl, nlMiddle; - int r; - PixTransDeclare; - - /* Compute blt address and parameters */ - psrc = psrcBase + srcy * widthSrc + (srcx >> 5); - nlMiddle = (width + 31) >> 5; - leftShift = srcx & 0x1f; - rightShift = 32 - leftShift; - widthRest = widthSrc - nlMiddle; - - _s3PlaneBlt(s3,dstx,dsty,width,height); - - if (leftShift == 0) - { - while (height--) - { - nl = nlMiddle; - PixTransStart(nl); - while (nl--) - { - tmp = *psrc++; - S3AdjustBits32 (tmp); - PixTransStore (tmp); - } - psrc += widthRest; - } - } - else - { - widthRest--; - while (height--) - { - bits = *psrc++; - nl = nlMiddle; - PixTransStart(nl); - while (nl--) - { - tmp = FbStipLeft(bits, leftShift); - bits = *psrc++; - tmp |= FbStipRight(bits, rightShift); - S3AdjustBits32(tmp); - PixTransStore (tmp); - } - psrc += widthRest; - } - } -} - -void -s3Copy1toN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupS3(pDstDrawable->pScreen); - - s31toNargs *args = closure; - int dstx, dsty; - FbStip *psrcBase; - FbStride widthSrc; - int srcBpp; - int srcXoff, srcYoff; - - if (args->opaque && sourceInvarient (pGC->alu)) - { - s3FillBoxSolid (pDstDrawable, nbox, pbox, - pGC->bgPixel, pGC->alu, pGC->planemask); - return; - } - - s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC)); - fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); - - if (args->opaque) - { - _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask,args->copyPlaneFG, - args->copyPlaneBG); - } - else - { - _s3SetTransparentPlaneBlt (s3, pGC->alu, - pGC->planemask, args->copyPlaneFG); - } - - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - - _s3Stipple (s3c, - psrcBase, widthSrc, - dstx + dx - srcXoff, dsty + dy - srcYoff, - dstx, dsty, - pbox->x2 - dstx, pbox->y2 - dsty); - pbox++; - } - MarkSyncS3 (pDstDrawable->pScreen); -} - -RegionPtr -s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - SetupS3 (pDstDrawable->pScreen); - RegionPtr ret; - s31toNargs args; - - if (pDstDrawable->type == DRAWABLE_WINDOW && - pSrcDrawable->depth == 1) - { - args.copyPlaneFG = pGC->fgPixel; - args.copyPlaneBG = pGC->bgPixel; - args.opaque = TRUE; - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, s3Copy1toN, bitPlane, &args); - } - return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); -} - -void -s3PushPixels (GCPtr pGC, PixmapPtr pBitmap, - DrawablePtr pDrawable, - int w, int h, int x, int y) -{ - SetupS3 (pDrawable->pScreen); - s31toNargs args; - - if (pDrawable->type == DRAWABLE_WINDOW && pGC->fillStyle == FillSolid) - { - args.opaque = FALSE; - args.copyPlaneFG = pGC->fgPixel; - (void) fbDoCopy ((DrawablePtr) pBitmap, pDrawable, pGC, - 0, 0, w, h, x, y, s3Copy1toN, 1, &args); - } - else - { - KdCheckPushPixels (pGC, pBitmap, pDrawable, w, h, x, y); - } -} - -void -s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask) -{ - SetupS3(pDrawable->pScreen); - register int r; - - s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); - _s3SetSolidFill(s3,pixel,alu,planemask); - - while (nBox--) { - _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1); - pBox++; - } - MarkSyncS3 (pDrawable->pScreen); -} - -void -_s3SetPattern (ScreenPtr pScreen, int ma, - int alu, unsigned long planemask, s3PatternPtr pPattern) -{ - SetupS3(pScreen); - S3PatternCache *cache; - - _s3LoadPattern (pScreen, ma, pPattern); - cache = pPattern->cache; - - switch (pPattern->fillStyle) { - case FillTiled: - _s3SetTile(s3,alu,planemask); - break; - case FillStippled: - _s3SetStipple(s3,alu,planemask,pPattern->fore); - break; - case FillOpaqueStippled: - _s3SetOpaqueStipple(s3,alu,planemask,pPattern->fore,pPattern->back); - break; - } -} - -void -s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - int alu, unsigned long planemask, s3PatternPtr pPattern) -{ - SetupS3(pDrawable->pScreen); - S3PatternCache *cache; - int patx, paty; - - s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); - _s3SetPattern (pDrawable->pScreen, s3DrawMap(pDrawable), alu, planemask, pPattern); - cache = pPattern->cache; - while (nBox--) - { - _s3PatRect(s3,cache->x, cache->y, - pBox->x1, pBox->y1, - pBox->x2-pBox->x1, pBox->y2-pBox->y1); - pBox++; - } - MarkSyncS3 (pDrawable->pScreen); -} - -void -s3FillBoxLargeStipple (DrawablePtr pDrawable, GCPtr pGC, - int nBox, BoxPtr pBox) -{ - SetupS3(pDrawable->pScreen); - DrawablePtr pStipple = &pGC->stipple->drawable; - int xRot = pGC->patOrg.x + pDrawable->x; - int yRot = pGC->patOrg.y + pDrawable->y; - FbStip *stip; - FbStride stipStride; - int stipBpp; - int stipXoff, stipYoff; - int stipWidth, stipHeight; - int dstX, dstY, width, height; - - stipWidth = pStipple->width; - stipHeight = pStipple->height; - fbGetStipDrawable (pStipple, stip, stipStride, stipBpp, stipXoff, stipYoff); - - s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); - if (pGC->fillStyle == FillOpaqueStippled) - { - _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask, - pGC->fgPixel, pGC->bgPixel); - - } - else - { - _s3SetTransparentPlaneBlt(s3,pGC->alu,pGC->planemask, pGC->fgPixel); - } - - while (nBox--) - { - int stipX, stipY, sx; - int widthTmp; - int h, w; - int x, y; - - dstX = pBox->x1; - dstY = pBox->y1; - width = pBox->x2 - pBox->x1; - height = pBox->y2 - pBox->y1; - pBox++; - modulus (dstY - yRot - stipYoff, stipHeight, stipY); - modulus (dstX - xRot - stipXoff, stipWidth, stipX); - y = dstY; - while (height) - { - h = stipHeight - stipY; - if (h > height) - h = height; - height -= h; - widthTmp = width; - x = dstX; - sx = stipX; - while (widthTmp) - { - w = (stipWidth - sx); - if (w > widthTmp) - w = widthTmp; - widthTmp -= w; - _s3Stipple (s3c, - stip, - stipStride, - sx, stipY, - x, y, - w, h); - x += w; - sx = 0; - } - y += h; - stipY = 0; - } - } - MarkSyncS3 (pDrawable->pScreen); -} - -#define NUM_STACK_RECTS 1024 - -void -s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - s3GCPrivate(pGC); - 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; - int x, y; - - prgnClip = fbGetCompositeClip(pGC); - xorg = pDrawable->x; - yorg = pDrawable->y; - - if (xorg || yorg) - { - prect = prectInit; - n = nrectFill; - while(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) - { - if (pGC->fillStyle == FillSolid) - s3FillBoxSolid(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->fgPixel, pGC->alu, pGC->planemask); - else if (s3Priv->pPattern) - s3FillBoxPattern (pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->alu, pGC->planemask, - s3Priv->pPattern); - else - s3FillBoxLargeStipple (pDrawable, pGC, - pboxClipped-pboxClippedBase, - pboxClippedBase); - } - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} - -void -_s3FillSpanLargeStipple (DrawablePtr pDrawable, GCPtr pGC, - int n, DDXPointPtr ppt, int *pwidth) -{ - SetupS3 (pDrawable->pScreen); - DrawablePtr pStipple = &pGC->stipple->drawable; - int xRot = pGC->patOrg.x + pDrawable->x; - int yRot = pGC->patOrg.y + pDrawable->y; - FbStip *stip; - FbStride stipStride; - int stipBpp; - int stipXoff, stipYoff; - int stipWidth, stipHeight; - int dstX, dstY, width, height; - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - stipWidth = pStipple->width; - stipHeight = pStipple->height; - fbGetStipDrawable (pStipple, stip, stipStride, stipBpp, stipXoff, stipYoff); - if (pGC->fillStyle == FillOpaqueStippled) - { - _s3SetOpaquePlaneBlt(s3,pGC->alu,pGC->planemask, - pGC->fgPixel, pGC->bgPixel); - - } - else - { - _s3SetTransparentPlaneBlt(s3,pGC->alu,pGC->planemask, pGC->fgPixel); - } - while (n--) - { - int stipX, stipY, sx; - int w; - int x, y; - - dstX = ppt->x; - dstY = ppt->y; - ppt++; - width = *pwidth++; - modulus (dstY - yRot - stipYoff, stipHeight, stipY); - modulus (dstX - xRot - stipXoff, stipWidth, stipX); - y = dstY; - x = dstX; - sx = stipX; - while (width) - { - w = (stipWidth - sx); - if (w > width) - w = width; - width -= w; - _s3Stipple (s3c, - stip, - stipStride, - sx, stipY, - x, y, - w, 1); - x += w; - sx = 0; - } - } -} - -void -s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - s3GCPrivate(pGC); - SetupS3(pDrawable->pScreen); - int x, y, x1, y1, x2, y2; - int width; - /* next three parameters are post-clip */ - int nTmp; - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - BoxPtr extents; - S3PatternCache *cache; - RegionPtr pClip = fbGetCompositeClip (pGC); - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - if (REGION_NUM_RECTS(pClip) == 1 && - (pGC->fillStyle == FillSolid || s3Priv->pPattern)) - { - extents = REGION_RECTS(pClip); - x1 = extents->x1; - x2 = extents->x2; - y1 = extents->y1; - y2 = extents->y2; - if (pGC->fillStyle == FillSolid) - { - _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); - cache = 0; - } - else - { - _s3SetPattern (pDrawable->pScreen, s3GCMap(pGC), pGC->alu, pGC->planemask, - s3Priv->pPattern); - cache = s3Priv->pPattern->cache; - } - while (n--) - { - y = ppt->y; - if (y1 <= y && y < y2) - { - x = ppt->x; - width = *pwidth; - if (x < x1) - { - width -= (x1 - x); - x = x1; - } - if (x2 < x + width) - width = x2 - x; - if (width > 0) - { - if (cache) - { - _s3PatRect(s3, cache->x, cache->y, x, y, width, 1); - } - else - { - _s3SolidRect(s3,x,y,width,1); - } - } - } - ppt++; - pwidth++; - } - } - else - { - nTmp = n * miFindMaxBand(pClip); - pwidthFree = (int *)xalloc(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - n = miClipSpans(fbGetCompositeClip(pGC), - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - if (pGC->fillStyle == FillSolid) - { - _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - width = *pwidth++; - if (width) - { - _s3SolidRect(s3,x,y,width,1); - } - } - } - else if (s3Priv->pPattern) - { - _s3SetPattern (pDrawable->pScreen, s3GCMap(pGC), pGC->alu, pGC->planemask, - s3Priv->pPattern); - cache = s3Priv->pPattern->cache; - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - width = *pwidth++; - if (width) - { - _s3PatRect(s3, cache->x, cache->y, x, y, width, 1); - } - } - } - else - { - _s3FillSpanLargeStipple (pDrawable, pGC, n, ppt, pwidth); - } - xfree(pptFree); - xfree(pwidthFree); - } - MarkSyncS3 (pDrawable->pScreen); -} - -#include "mifillarc.h" - -#define FILLSPAN(s3,y,__x1,__x2) {\ - DRAW_DEBUG ((DEBUG_ARCS, "FILLSPAN %d: %d->%d", y, __x1, __x2)); \ - if ((__x2) >= (__x1)) {\ - _s3SolidRect(s3,(__x1),(y),(__x2)-(__x1)+1,1); \ - } \ -} - -#define FILLSLICESPANS(flip,__y) \ - if (!flip) \ - { \ - FILLSPAN(s3,__y,xl,xr) \ - } \ - else \ - { \ - xc = xorg - x; \ - FILLSPAN(s3, __y, xc, xr) \ - xc += slw - 1; \ - FILLSPAN(s3, __y, xl, xc) \ - } - -static void -_s3FillEllipse (DrawablePtr pDraw, S3Ptr s3, xArc *arc) -{ - KdScreenPriv(pDraw->pScreen); - int x, y, e; - int yk, xk, ym, xm, dx, dy, xorg, yorg; - int y_top, y_bot; - miFillArcRec info; - register int xpos; - int slw; - - s3SetGlobalBitmap (pDraw->pScreen, s3DrawMap (pDraw)); - miFillArcSetup(arc, &info); - MIFILLARCSETUP(); - y_top = pDraw->y + yorg - y; - y_bot = pDraw->y + yorg + y + dy; - xorg += pDraw->x; - while (y) - { - y_top++; - y_bot--; - MIFILLARCSTEP(slw); - if (!slw) - continue; - xpos = xorg - x; - _s3SolidRect (s3,xpos,y_top,slw,1); - if (miFillArcLower(slw)) - _s3SolidRect (s3,xpos,y_bot,slw,1); - } -} - - -static void -_s3FillArcSlice (DrawablePtr pDraw, GCPtr pGC, S3Ptr s3, xArc *arc) -{ - KdScreenPriv(pDraw->pScreen); - int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; - register int x, y, e; - miFillArcRec info; - miArcSliceRec slice; - int xl, xr, xc; - int y_top, y_bot; - - s3SetGlobalBitmap (pDraw->pScreen, s3DrawMap (pDraw)); - DRAW_DEBUG ((DEBUG_ARCS, "slice %dx%d+%d+%d %d->%d", - arc->width, arc->height, arc->x, arc->y, - arc->angle1, arc->angle2)); - miFillArcSetup(arc, &info); - miFillArcSliceSetup(arc, &slice, pGC); - DRAW_DEBUG ((DEBUG_ARCS, "edge1.x %d edge2.x %d", - slice.edge1.x, slice.edge2.x)); - MIFILLARCSETUP(); - DRAW_DEBUG ((DEBUG_ARCS, "xorg %d yorg %d", - xorg, yorg)); - xorg += pDraw->x; - yorg += pDraw->y; - y_top = yorg - y; - y_bot = yorg + y + dy; - slice.edge1.x += pDraw->x; - slice.edge2.x += pDraw->x; - DRAW_DEBUG ((DEBUG_ARCS, "xorg %d y_top %d y_bot %d", - xorg, y_top, y_bot)); - while (y > 0) - { - y_top++; - y_bot--; - MIFILLARCSTEP(slw); - MIARCSLICESTEP(slice.edge1); - MIARCSLICESTEP(slice.edge2); - if (miFillSliceUpper(slice)) - { - MIARCSLICEUPPER(xl, xr, slice, slw); - FILLSLICESPANS(slice.flip_top, y_top); - } - if (miFillSliceLower(slice)) - { - MIARCSLICELOWER(xl, xr, slice, slw); - FILLSLICESPANS(slice.flip_bot, y_bot); - } - } -} - -void -s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs) -{ - SetupS3(pDraw->pScreen); - xArc *arc; - int i; - int x, y; - BoxRec box; - RegionPtr pClip = fbGetCompositeClip(pGC); - BOOL set; - - set = FALSE; - for (; --narcs >= 0; parcs++) - { - if (miFillArcEmpty(parcs)) - continue; - if (miCanFillArc(parcs)) - { - box.x1 = parcs->x + pDraw->x; - box.y1 = parcs->y + pDraw->y; - box.x2 = box.x1 + (int)parcs->width + 1; - box.y2 = box.y1 + (int)parcs->height + 1; - switch (RECT_IN_REGION(pDraw->pScreen, pClip, &box)) - { - case rgnIN: - if (!set) - { - _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask); - set = TRUE; - } - if ((parcs->angle2 >= FULLCIRCLE) || - (parcs->angle2 <= -FULLCIRCLE)) - { - DRAW_DEBUG ((DEBUG_ARCS, "Full circle ellipse %dx%d", - parcs->width, parcs->height)); - _s3FillEllipse (pDraw, s3, parcs); - } - else - { - DRAW_DEBUG ((DEBUG_ARCS, "Partial ellipse %dx%d", - parcs->width, parcs->height)); - _s3FillArcSlice (pDraw, pGC, s3, parcs); - } - /* fall through ... */ - case rgnOUT: - continue; - case rgnPART: - break; - } - } - if (set) - { - MarkSyncS3 (pDraw->pScreen); - set = FALSE; - } - KdCheckPolyFillArc(pDraw, pGC, 1, parcs); - } - if (set) - { - MarkSyncS3 (pDraw->pScreen); - set = FALSE; - } -} - -void -s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int countInit, DDXPointPtr ptsIn) -{ - SetupS3(pDrawable->pScreen); - int nwidth; - int maxy; - int origin; - int count; - register int vertex1, vertex2; - int c; - RegionPtr pClip = fbGetCompositeClip(pGC); - BoxPtr extents; - int clip; - int y, sy; - int *vertex1p, *vertex2p; - int *endp; - int x1, x2, sx; - int dx1, dx2; - int dy1, dy2; - int e1, e2; - int step1, step2; - int sign1, sign2; - int h; - int l, r; - int nmiddle; - - if (mode == CoordModePrevious || REGION_NUM_RECTS(pClip) != 1) - { - KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); - return; - } - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - sy = pDrawable->y; - sx = pDrawable->x; - origin = *((int *) &pDrawable->x); - origin -= (origin & 0x8000) << 1; - extents = &pClip->extents; - vertex1 = *((int *) &extents->x1) - origin; - vertex2 = *((int *) &extents->x2) - origin - 0x00010001; - clip = 0; - - y = 32767; - maxy = 0; - vertex2p = (int *) ptsIn; - endp = vertex2p + countInit; - if (shape == Convex) - { - count = countInit; - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c)); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - } - } - else - { - int yFlip = 0; - dx1 = 1; - x2 = -1; - x1 = -1; - count = countInit; - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - DRAW_DEBUG ((DEBUG_POLYGON, "Y coordinate %d", c)); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - if (c == x1) - continue; - if (dx1 > 0) - { - if (x2 < 0) - x2 = c; - else - dx2 = dx1 = (c - x1) >> 31; - } - else - if ((c - x1) >> 31 != dx1) - { - dx1 = ~dx1; - yFlip++; - } - x1 = c; - } - x1 = (x2 - c) >> 31; - if (x1 != dx1) - yFlip++; - if (x1 != dx2) - yFlip++; - if (yFlip != 2) - clip = 0x8000; - } - if (y == maxy) - return; - - if (clip & 0x80008000) - { - KdCheckFillPolygon (pDrawable, pGC, shape, mode, countInit, ptsIn); - return; - } - _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); - - 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 += sx; \ - vertex = c; \ -} - -#define Step(x,dx,dy,e,sign,step) {\ - x += step; \ - if ((e += dx) > 0) \ - { \ - x += sign; \ - e -= dy; \ - } \ -} - sy += y; - DRAW_DEBUG ((DEBUG_POLYGON, "Starting polygon at %d", sy)); - for (;;) - { - DRAW_DEBUG ((DEBUG_POLYGON, "vertex1 0x%x vertex2 0x%x y %d vy1 %d vy2 %d", - vertex1, vertex2, - y, intToY(vertex1), intToY (vertex2))); - if (y == intToY(vertex1)) - { - DRAW_DEBUG ((DEBUG_POLYGON, "Find next -- vertext")); - do - { - if (vertex1p == (int *) ptsIn) - vertex1p = endp; - c = *--vertex1p; - Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1); - DRAW_DEBUG ((DEBUG_POLYGON, "-- vertex 0x%x y %d", - vertex1, intToY(vertex1))); - } while (y >= intToY(vertex1)); - h = dy1; - } - else - { - Step(x1,dx1,dy1,e1,sign1,step1) - h = intToY(vertex1) - y; - } - if (y == intToY(vertex2)) - { - DRAW_DEBUG ((DEBUG_POLYGON, "Find next ++ vertext")); - do - { - c = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) - DRAW_DEBUG ((DEBUG_POLYGON, "++ vertex 0x%x y %d", - vertex1, intToY(vertex1))); - } 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; - } - DRAW_DEBUG ((DEBUG_POLYGON, "This band %d", h)); - /* fill spans for this segment */ - for (;;) - { - nmiddle = x2 - x1; - DRAW_DEBUG ((DEBUG_POLYGON, "This span %d->%d", x1, x2)); - if (nmiddle) - { - l = x1; - if (nmiddle < 0) - { - nmiddle = -nmiddle; - l = x2; - } - _s3SolidRect(s3,l,sy,nmiddle,1); - } - y++; - sy++; - if (!--h) - break; - Step(x1,dx1,dy1,e1,sign1,step1) - Step(x2,dx2,dy2,e2,sign2,step2) - } - if (y == maxy) - break; - } - MarkSyncS3 (pDrawable->pScreen); -} - -void -s3PolyGlyphBltClipped (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - pointer pglyphBase) -{ - SetupS3(pDrawable->pScreen); - int h; - int w; - int xBack, yBack; - int hBack, wBack; - int lw; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *bits; - BoxPtr extents; - BoxRec bbox; - CARD32 b; - CharInfoPtr *ppci; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - RegionPtr pClip = fbGetCompositeClip(pGC); - BoxPtr pBox; - int nbox; - int x1, y1, x2, y2; - unsigned char alu; - Bool set; - PixTransDeclare; - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - x += pDrawable->x; - y += pDrawable->y; - - if (pglyphBase == (pointer) 1) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - h = nglyph; - ppci = ppciInit; - while (h--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - } - else - { - wBack = 0; - alu = pGC->alu; - } - - if (wBack) - { - _s3SetSolidFill (s3, pGC->bgPixel, GXcopy, pGC->planemask); - for (nbox = REGION_NUM_RECTS (pClip), - pBox = REGION_RECTS (pClip); - nbox--; - pBox++) - { - x1 = xBack; - x2 = xBack + wBack; - y1 = yBack; - y2 = yBack + hBack; - if (x1 < pBox->x1) x1 = pBox->x1; - if (x2 > pBox->x2) x2 = pBox->x2; - if (y1 < pBox->y1) y1 = pBox->y1; - if (y2 > pBox->y2) y2 = pBox->y2; - if (x1 < x2 && y1 < y2) - { - _s3SolidRect (s3, x1, y1, x2 - x1, y2 - y1); - } - } - MarkSyncS3 (pDrawable->pScreen); - } - ppci = ppciInit; - set = FALSE; - while (nglyph--) - { - pci = *ppci++; - h = pci->metrics.ascent + pci->metrics.descent; - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - x1 = x + pci->metrics.leftSideBearing; - y1 = y - pci->metrics.ascent; - bbox.x1 = x1; - bbox.y1 = y1; - bbox.x2 = x1 + w; - bbox.y2 = y1 + h; - switch (RECT_IN_REGION(pGC->pScreen, pClip, &bbox)) - { - case rgnIN: -#if 1 - lw = h * ((w + 31) >> 5); - if (lw) - { - if (!set) - { - _s3SetTransparentPlaneBlt (s3, alu, pGC->planemask, pGC->fgPixel); - set = TRUE; - } - _s3PlaneBlt(s3, - x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, - w, h); - bits = (unsigned long *) pci->bits; - PixTransStart (lw); - while (lw--) - { - b = *bits++; - S3AdjustBits32 (b); - PixTransStore(b); - } - MarkSyncS3 (pDrawable->pScreen); - } - break; -#endif - case rgnPART: - set = FALSE; - CheckSyncS3 (pDrawable->pScreen); - fbPutXYImage (pDrawable, - pClip, - fbPriv->fg, - fbPriv->bg, - fbPriv->pm, - alu, - FALSE, - x1, y1, - w, h, - (FbStip *) pci->bits, - (w + 31) >> 5, - 0); - break; - case rgnOUT: - break; - } - x += pci->metrics.characterWidth; - } -} - -/* - * Blt glyphs using S3 image transfer register, this does both - * poly glyph blt and image glyph blt (when pglyphBase == 1) - */ - -void -s3PolyGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - pointer pglyphBase) -{ - SetupS3(pDrawable->pScreen); - int h; - int w; - int xBack, yBack; - int hBack, wBack; - int lw; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - unsigned long *bits; - BoxPtr extents; - BoxRec bbox; - CARD32 b; - CharInfoPtr *ppci; - unsigned char alu; - PixTransDeclare; - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - x += pDrawable->x; - y += pDrawable->y; - - /* compute an approximate (but covering) bounding box */ - ppci = ppciInit; - w = 0; - h = nglyph; - while (h--) - w += (*ppci++)->metrics.characterWidth; - if (w < 0) - { - bbox.x1 = x + w; - bbox.x2 = x; - } - else - { - bbox.x1 = x; - bbox.x2 = x + w; - } - w = FONTMINBOUNDS(pfont,leftSideBearing); - if (w < 0) - bbox.x1 += w; - w = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); - if (w > 0) - bbox.x2 += w; - bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); - bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); - - DRAW_DEBUG ((DEBUG_TEXT, "PolyGlyphBlt %d box is %d %d", nglyph, - bbox.x1, bbox.x2)); - switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) - { - case rgnIN: - break; - case rgnPART: - s3PolyGlyphBltClipped(pDrawable, pGC, x - pDrawable->x, - y - pDrawable->y, - nglyph, ppciInit, pglyphBase); - case rgnOUT: - return; - } - - if (pglyphBase == (pointer) 1) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - h = nglyph; - ppci = ppciInit; - while (h--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - } - else - { - wBack = 0; - alu = pGC->alu; - } - - if (wBack) - { - _s3SetSolidFill (s3, pGC->bgPixel, GXcopy, pGC->planemask); - _s3SolidRect (s3, xBack, yBack, wBack, hBack); - } - _s3SetTransparentPlaneBlt (s3, alu, pGC->planemask, pGC->fgPixel); - ppci = ppciInit; - while (nglyph--) - { - pci = *ppci++; - h = pci->metrics.ascent + pci->metrics.descent; - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - lw = h * ((w + 31) >> 5); - if (lw) - { - _s3PlaneBlt(s3, - x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, - w, h); - bits = (unsigned long *) pci->bits; - PixTransStart(lw); - while (lw--) - { - b = *bits++; - S3AdjustBits32 (b); - PixTransStore(b); - } - } - x += pci->metrics.characterWidth; - } - MarkSyncS3 (pDrawable->pScreen); -} - -void -s3ImageGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - s3PolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1); -} - -/* - * Blt TE fonts using S3 image transfer. Differs from - * above in that it doesn't need to fill a solid rect for - * the background and it can draw multiple characters at a time - */ - -void -s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - SetupS3(pDrawable->pScreen); - int x, y; - int h, lw, lwTmp; - int w; - FontPtr pfont = pGC->font; - unsigned long *char1, *char2, *char3, *char4; - int widthGlyphs, widthGlyph; - BoxRec bbox; - CARD32 tmp; - PixTransDeclare; - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - if (!widthGlyph) - return; - - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - if (!h) - return; - - DRAW_DEBUG ((DEBUG_TEXT, "ImageTEGlyphBlt chars are %d %d", - widthGlyph, h)); - - x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x; - y = yInit - FONTASCENT(pfont) + pDrawable->y; - - bbox.x1 = x; - bbox.x2 = x + (widthGlyph * nglyph); - bbox.y1 = y; - bbox.y2 = y + h; - - switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) - { - case rgnIN: - break; - case rgnPART: - if (pglyphBase == (pointer) 1) - pglyphBase = 0; - else - pglyphBase = (pointer) 1; - s3PolyGlyphBltClipped(pDrawable, pGC, - xInit, - yInit, - nglyph, ppci, - pglyphBase); - case rgnOUT: - return; - } - - if (pglyphBase == (pointer) 1) - { - _s3SetTransparentPlaneBlt (s3, pGC->alu, pGC->planemask, pGC->fgPixel); - } - else - { - _s3SetOpaquePlaneBlt (s3, GXcopy, pGC->planemask, pGC->fgPixel, pGC->bgPixel); - } - -#if BITMAP_BIT_ORDER == LSBFirst -#define SHIFT << -#else -#define SHIFT >> -#endif - -#define LoopIt(count, w, loadup, fetch) \ - while (nglyph >= count) \ - { \ - nglyph -= count; \ - _s3PlaneBlt (s3, x, y, w, h); \ - x += w; \ - loadup \ - lwTmp = h; \ - PixTransStart(h); \ - while (lwTmp--) { \ - tmp = fetch; \ - S3AdjustBits32(tmp); \ - PixTransStore(tmp); \ - } \ - } - - if (widthGlyph <= 8) - { - widthGlyphs = widthGlyph << 2; - LoopIt(4, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits; - char4 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | ((*char3++ | (*char4++ - SHIFT widthGlyph)) - SHIFT widthGlyph)) - SHIFT widthGlyph))) - } - else if (widthGlyph <= 10) - { - widthGlyphs = (widthGlyph << 1) + widthGlyph; - LoopIt(3, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | (*char3++ SHIFT widthGlyph)) SHIFT widthGlyph))) - } - else if (widthGlyph <= 16) - { - widthGlyphs = widthGlyph << 1; - LoopIt(2, widthGlyphs, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | (*char2++ SHIFT widthGlyph))) - } - lw = h * ((widthGlyph + 31) >> 5); - while (nglyph--) - { - _s3PlaneBlt (s3, x, y, widthGlyph, h); - x += widthGlyph; - char1 = (unsigned long *) (*ppci++)->bits; - lwTmp = lw; - PixTransStart(lw); - while (lwTmp--) - { - tmp = *char1++; - S3AdjustBits32(tmp); - PixTransStore(tmp); - } - } - MarkSyncS3 (pDrawable->pScreen); -} - -void -s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase) -{ - s3ImageTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (pointer) 1); -} - -Bool -_s3Segment (DrawablePtr pDrawable, - GCPtr pGC, - int x1, - int y1, - int x2, - int y2, - Bool drawLast, - Bool s3Set) -{ - SetupS3(pDrawable->pScreen); - FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); - RegionPtr pClip = fbGetCompositeClip(pGC); - BoxPtr pBox; - int nBox; - 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; - int cmd; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - unsigned int oc1; /* outcode of point 1 */ - unsigned int oc2; /* outcode of point 2 */ - - CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, - 1, 1, octant); - - cmd = LASTPIX; - - if (adx > ady) - { - axis = X_AXIS; - e1 = ady << 1; - e2 = e1 - (adx << 1); - e = e1 - adx; - len = adx; - } - else - { - cmd |= YMAJAXIS; - axis = Y_AXIS; - e1 = adx << 1; - e2 = e1 - (ady << 1); - e = e1 - ady; - SetYMajorOctant(octant); - len = ady; - } - - /* S3 line drawing hardware has limited resolution for error terms */ - if (len >= 4096) - { - int dashOff = 0; - - KdCheckSync (pDrawable->pScreen); - fbSegment (pDrawable, pGC, x1, y1, x2, y2, drawLast, &dashOff); - return FALSE; - } - - FIXUP_ERROR (e, octant, bias); - - nBox = REGION_NUM_RECTS (pClip); - pBox = REGION_RECTS (pClip); - - if (signdx > 0) - cmd |= INC_X; - if (signdy > 0) - cmd |= INC_Y; - - /* we have bresenham parameters and two points. - all we have to do now is clip and draw. - */ - - if (drawLast) - len++; - while(nBox--) - { - oc1 = 0; - oc2 = 0; - OUTCODES(oc1, x1, y1, pBox); - OUTCODES(oc2, x2, y2, pBox); - if ((oc1 | oc2) == 0) - { - if (!s3Set) - { - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask); - s3Set = TRUE; - } - _s3SetCur (s3, x1, y1); - _s3ClipLine (s3, cmd, e1, e2, e, 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); - if (clip2 != 0 || drawLast) - len++; - if (len) - { - /* unwind bresenham error term to first point */ - err = e; - if (clip1) - { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - if (axis == X_AXIS) - err += (e2 - e1) * clipdy + e1 * clipdx; - else - err += (e2 - e1) * clipdx + e1 * clipdy; - } - if (!s3Set) - { - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - _s3SetSolidFill (s3, pGC->fgPixel, pGC->alu, pGC->planemask); - s3Set = TRUE; - } - _s3SetCur (s3, new_x1, new_y1); - _s3ClipLine (s3, cmd, e1, e2, err, len); - } - pBox++; - } - } /* while (nBox--) */ - return s3Set; -} - -void -s3Polylines (DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr ppt) -{ - SetupS3(pDrawable->pScreen); - int x, y, nx, ny; - int ox = pDrawable->x, oy = pDrawable->y; - Bool s3Set = FALSE; - - if (!npt) - return; - - x = ppt->x + ox; - y = ppt->y + oy; - while (--npt) - { - ++ppt; - if (mode == CoordModePrevious) - { - nx = x + ppt->x; - ny = y + ppt->y; - } - else - { - nx = ppt->x + ox; - ny = ppt->y + oy; - } - s3Set = _s3Segment (pDrawable, pGC, x, y, nx, ny, - npt == 1 && pGC->capStyle != CapNotLast, - s3Set); - x = nx; - y = ny; - } - if (s3Set) - MarkSyncS3 (pDrawable->pScreen); -} - -void -s3PolySegment (DrawablePtr pDrawable, GCPtr pGC, - int nsegInit, xSegment *pSegInit) -{ - SetupS3(pDrawable->pScreen); - int x, y; - int ox = pDrawable->x, oy = pDrawable->y; - RegionPtr pClip = fbGetCompositeClip (pGC); - BoxPtr pBox; - int nbox; - int nseg; - xSegment *pSeg; - int dx, dy; - int maj, min, len, inc; - int t; - CARD32 cmd; - CARD32 init_cmd; - Bool drawLast; - Bool s3Set = FALSE; - - drawLast = pGC->capStyle != CapNotLast; - - for (nseg = nsegInit, pSeg = pSegInit; nseg--; pSeg++) - { - s3Set = _s3Segment (pDrawable, pGC, pSeg->x1 + ox, pSeg->y1 + oy, - pSeg->x2 + ox, pSeg->y2 + oy, drawLast, s3Set); - - } - if (s3Set) - MarkSyncS3 (pDrawable->pScreen); -} - -/* - * Check to see if a pattern can be painted with the S3 - */ - -#define _s3CheckPatternSize(s) ((s) <= S3_TILE_SIZE && ((s) & ((s) - 1)) == 0) -#define s3CheckPattern(w,h) (_s3CheckPatternSize(w) && _s3CheckPatternSize(h)) - -Bool -s3AllocPattern (ScreenPtr pScreen, - int ma, - PixmapPtr pPixmap, - int xorg, int yorg, - int fillStyle, Pixel fg, Pixel bg, - s3PatternPtr *ppPattern) -{ - KdScreenPriv(pScreen); - s3ScreenInfo(pScreenPriv); - s3PatternPtr pPattern; - - if (s3s->fb[ma].patterns.cache && fillStyle != FillSolid && - s3CheckPattern (pPixmap->drawable.width, pPixmap->drawable.height)) - { - if (!(pPattern = *ppPattern)) - { - pPattern = (s3PatternPtr) xalloc (sizeof (s3PatternRec)); - if (!pPattern) - return FALSE; - *ppPattern = pPattern; - } - - pPattern->cache = 0; - pPattern->id = 0; - pPattern->pPixmap = pPixmap; - pPattern->fillStyle = fillStyle; - pPattern->xrot = (-xorg) & (S3_TILE_SIZE-1); - pPattern->yrot = (-yorg) & (S3_TILE_SIZE-1); - pPattern->fore = fg; - pPattern->back = bg; - return TRUE; - } - else - { - if (*ppPattern) - { - xfree (*ppPattern); - *ppPattern = 0; - } - return FALSE; - } -} - -void -s3CheckGCFill (GCPtr pGC) -{ - s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC); - PixmapPtr pPixmap; - - switch (pGC->fillStyle) { - case FillSolid: - pPixmap = 0; - break; - case FillOpaqueStippled: - case FillStippled: - pPixmap = pGC->stipple; - break; - case FillTiled: - pPixmap = pGC->tile.pixmap; - break; - } - s3AllocPattern (pGC->pScreen, - s3GCMap(pGC), - pPixmap, - pGC->patOrg.x + pGC->lastWinOrg.x, - pGC->patOrg.y + pGC->lastWinOrg.y, - pGC->fillStyle, pGC->fgPixel, pGC->bgPixel, - &s3Priv->pPattern); -} - -void -s3MoveGCFill (GCPtr pGC) -{ - s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC); - int xorg, yorg; - s3PatternPtr pPattern; - - if (pPattern = s3Priv->pPattern) - { - /* - * Reset origin - */ - xorg = pGC->patOrg.x + pGC->lastWinOrg.x; - yorg = pGC->patOrg.y + pGC->lastWinOrg.y; - pPattern->xrot = (-xorg) & (S3_TILE_SIZE - 1); - pPattern->yrot = (-yorg) & (S3_TILE_SIZE - 1); - /* - * Invalidate cache entry - */ - pPattern->id = 0; - pPattern->cache = 0; - } -} - -/* - * S3 Patterns. These are always full-depth images, stored in off-screen - * memory. - */ - -Pixel -s3FetchPatternPixel (s3PatternPtr pPattern, int x, int y) -{ - CARD8 *src; - CARD16 *src16; - CARD32 *src32; - PixmapPtr pPixmap = pPattern->pPixmap; - - x = (x + pPattern->xrot) % pPixmap->drawable.width; - y = (y + pPattern->yrot) % pPixmap->drawable.height; - src = (CARD8 *) pPixmap->devPrivate.ptr + y * pPixmap->devKind; - switch (pPixmap->drawable.bitsPerPixel) { - case 1: - return (src[x>>3] >> (x & 7)) & 1 ? 0xffffffff : 0x00; - case 4: - if (x & 1) - return src[x>>1] >> 4; - else - return src[x>>1] & 0xf; - case 8: - return src[x]; - case 16: - src16 = (CARD16 *) src; - return src16[x]; - case 32: - src32 = (CARD32 *) src; - return src32[x]; - } -} - -/* - * Place pattern image on screen; done with S3 locked - */ -void -_s3PutPattern (ScreenPtr pScreen, int ma, s3PatternPtr pPattern) -{ - SetupS3(pScreen); - s3ScreenInfo(pScreenPriv); - int x, y; - CARD8 *dstLine, *dst8; - CARD16 *dst16; - CARD32 *dst32; - S3PatternCache *cache = pPattern->cache; -#ifdef S3_TRIO - int fb = 0; -#else - int fb = s3s->fbmap[ma]; -#endif - - DRAW_DEBUG ((DEBUG_PATTERN, "_s3PutPattern 0x%x id %d to %d %d", - pPattern, pPattern->id, cache->x, cache->y)); - - dstLine = (pScreenPriv->screen->fb[fb].frameBuffer + - cache->y * pScreenPriv->screen->fb[fb].byteStride + - cache->x * pScreenPriv->bytesPerPixel[fb]); - - CheckSyncS3 (pScreen); - - for (y = 0; y < S3_TILE_SIZE; y++) - { - switch (pScreenPriv->screen->fb[fb].bitsPerPixel) { - case 8: - dst8 = dstLine; - for (x = 0; x < S3_TILE_SIZE; x++) - *dst8++ = s3FetchPatternPixel (pPattern, x, y); - DRAW_DEBUG ((DEBUG_PATTERN, "%c%c%c%c%c%c%c%c", - dstLine[0] ? 'X' : ' ', - dstLine[1] ? 'X' : ' ', - dstLine[2] ? 'X' : ' ', - dstLine[3] ? 'X' : ' ', - dstLine[4] ? 'X' : ' ', - dstLine[5] ? 'X' : ' ', - dstLine[6] ? 'X' : ' ', - dstLine[7] ? 'X' : ' ')); - break; - case 16: - dst16 = (CARD16 *) dstLine; - for (x = 0; x < S3_TILE_SIZE; x++) - *dst16++ = s3FetchPatternPixel (pPattern, x, y); - break; - case 32: - dst32 = (CARD32 *) dstLine; - for (x = 0; x < S3_TILE_SIZE; x++) - *dst32++ = s3FetchPatternPixel (pPattern, x, y); - break; - } - dstLine += pScreenPriv->screen->fb[fb].byteStride; - } -} - -/* - * Load a stipple to off-screen memory; done with S3 locked - */ -void -_s3LoadPattern (ScreenPtr pScreen, int ma, s3PatternPtr pPattern) -{ - SetupS3(pScreen); - s3ScreenInfo(pScreenPriv); - S3PatternCache *cache; - - DRAW_DEBUG((DEBUG_PATTERN, - "s3LoadPattern 0x%x id %d cache 0x%x cacheid %d", - pPattern, pPattern->id, pPattern->cache, - pPattern->cache ? pPattern->cache->id : -1)); - /* - * Check to see if its still loaded - */ - cache = pPattern->cache; - if (cache && cache->id == pPattern->id) - return; - /* - * Lame replacement strategy; assume we'll have plenty of room. - */ - cache = &s3s->fb[ma].patterns.cache[s3s->fb[ma].patterns.last_used]; - if (++s3s->fb[ma].patterns.last_used == s3s->fb[ma].patterns.ncache) - s3s->fb[ma].patterns.last_used = 0; - cache->id = ++s3s->fb[ma].patterns.last_id; - pPattern->id = cache->id; - pPattern->cache = cache; - _s3PutPattern (pScreen, ma, pPattern); -} - -void -s3DestroyGC (GCPtr pGC) -{ - s3PrivGCPtr s3Priv = s3GetGCPrivate (pGC); - - if (s3Priv->pPattern) - xfree (s3Priv->pPattern); - miDestroyGC (pGC); -} - -GCFuncs s3GCFuncs = { - s3ValidateGC, - miChangeGC, - miCopyGC, - s3DestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -int -s3CreateGC (GCPtr pGC) -{ - KdScreenPriv(pGC->pScreen); - s3ScreenInfo(pScreenPriv); - s3PrivGCPtr s3Priv; - - if (!fbCreateGC (pGC)) - return FALSE; - - if (pGC->depth != 1) - pGC->funcs = &s3GCFuncs; - - s3Priv = s3GetGCPrivate(pGC); - s3Priv->type = DRAWABLE_PIXMAP; - s3Priv->pPattern = 0; -#ifndef S3_TRIO - if (pGC->depth == s3s->primary_depth) - s3Priv->ma = 0; - else - s3Priv->ma = 1; -#endif - return TRUE; -} - -Bool -s3CreateWindow (WindowPtr pWin) -{ - KdScreenPriv(pWin->drawable.pScreen); - s3ScreenInfo(pScreenPriv); - - dixSetPrivate(&pWin->devPrivates, s3WindowPrivateKey, NULL); - return KdCreateWindow (pWin); -} - -Bool -s3DestroyWindow (WindowPtr pWin) -{ - s3PatternPtr pPattern; - if (pPattern = s3GetWindowPrivate(pWin)) - xfree (pPattern); - return fbDestroyWindow (pWin); -} - -Bool -s3ChangeWindowAttributes (WindowPtr pWin, Mask mask) -{ - KdScreenPriv(pWin->drawable.pScreen); - Bool ret; - s3PatternPtr pPattern; - PixmapPtr pPixmap; - int fillStyle; - - ret = fbChangeWindowAttributes (pWin, mask); - if (mask & CWBackPixmap) - { - if (pWin->backgroundState == BackgroundPixmap) - { - pPixmap = pWin->background.pixmap; - fillStyle = FillTiled; - } - else - { - pPixmap = 0; - fillStyle = FillSolid; - } - pPattern = s3GetWindowPrivate(pWin); - s3AllocPattern (pWin->drawable.pScreen, - s3DrawMap (&pWin->drawable), - pPixmap, - pWin->drawable.x, pWin->drawable.y, - fillStyle, 0, 0, &pPattern); - DRAW_DEBUG ((DEBUG_PAINT_WINDOW, "Background pattern 0x%x pixmap 0x%x style %d", - pPattern, pPixmap, fillStyle)); - s3SetWindowPrivate (pWin, pPattern); - } - return ret; -} - - -#ifndef S3_TRIO -void -s3PaintKey (DrawablePtr pDrawable, - RegionPtr pRegion, - CARD32 pixel, - int fb) -{ - SetupS3 (pDrawable->pScreen); - s3ScreenInfo (pScreenPriv); - int nBox = REGION_NUM_RECTS(pRegion); - BoxPtr pBox = REGION_RECTS(pRegion); - int ma; - - if (!nBox) - return; - - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) - if (s3s->fbmap[ma] == fb) - break; - s3SetGlobalBitmap (pDrawable->pScreen, ma); - _s3SetSolidFill (s3, pixel, GXcopy, 0xffffffff); - while (nBox--) - { - _s3SolidRect(s3,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1); - pBox++; - } - MarkSyncS3 (pDrawable->pScreen); -} -#endif - -void -s3CopyWindowProc (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pboxOrig, - int nboxOrig, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupS3(pDstDrawable->pScreen); - s3ScreenInfo(pScreenPriv); - KdScreenInfo *screen = pScreenPriv->screen; - int srcX, srcY, dstX, dstY; - int x1, x2; - int w, h; - int flags; - int fb = (int) closure; - int ma; - BoxPtr pbox; - int nbox; - int bitsPerPixel; - -#ifdef S3_TRIO - ma = 0; -#else - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) - if (s3s->fbmap[ma] == fb) - break; -#endif - bitsPerPixel = screen->fb[fb].bitsPerPixel; - if (bitsPerPixel == 24) - dx *= 3; - nbox = nboxOrig; - pbox = pboxOrig; - s3SetGlobalBitmap (pDstDrawable->pScreen, ma); - _s3SetBlt(s3,GXcopy,~0); - while (nbox--) - { - x1 = pbox->x1; - x2 = pbox->x2; - if (bitsPerPixel == 24) - { - x1 *= 3; - x2 *= 3; - } - - w = x2 - x1; - h = pbox->y2 - pbox->y1; - flags = 0; - if (reverse) - { - dstX = x2 - 1; - } - else - { - dstX = x1; - flags |= INC_X; - } - srcX = dstX + dx; - - if (upsidedown) - { - dstY = pbox->y2 - 1; - } - else - { - dstY = pbox->y1; - flags |= INC_Y; - } - srcY = dstY + dy; - - _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); - pbox++; - } - MarkSyncS3 (pDstDrawable->pScreen); -} - -void -s3CopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - KdScreenPriv (pScreen); - s3ScreenInfo (pScreenPriv); - KdScreenInfo *screen = pScreenPriv->screen; - RegionRec rgnDst; - int dx, dy; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - 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); - - fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - 0, - &rgnDst, dx, dy, s3CopyWindowProc, 0, 0); - - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - -void -s3_24FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask) -{ - SetupS3(pDrawable->pScreen); - register int r; - int x1, x2; - - s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); - _s3SetSolidFill(s3,pixel,alu,planemask); - - while (nBox--) { - x1 = pBox->x1 * 3; - x2 = pBox->x2 * 3; - _s3SolidRect(s3,x1,pBox->y1,x2-x1,pBox->y2-pBox->y1); - pBox++; - } - MarkSyncS3 (pDrawable->pScreen); -} - -#define ok24(p) (((p) & 0xffffff) == ((((p) & 0xff) << 16) | (((p) >> 8) & 0xffff))) - -void -s3_24FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - SetupS3(pDrawable->pScreen); - int x, y, x1, y1, x2, y2; - int width; - /* next three parameters are post-clip */ - int nTmp; - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - BoxPtr extents; - RegionPtr pClip = fbGetCompositeClip (pGC); - - if (pGC->fillStyle != FillSolid || !ok24 (pGC->fgPixel) || !ok24(pGC->planemask)) - { - KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); - return; - } - - s3SetGlobalBitmap (pDrawable->pScreen, s3GCMap (pGC)); - if (REGION_NUM_RECTS(pClip) == 1) - { - extents = REGION_RECTS(pClip); - x1 = extents->x1; - x2 = extents->x2; - y1 = extents->y1; - y2 = extents->y2; - _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); - while (n--) - { - y = ppt->y; - if (y1 <= y && y < y2) - { - x = ppt->x; - width = *pwidth; - if (x < x1) - { - width -= (x1 - x); - x = x1; - } - if (x2 < x + width) - width = x2 - x; - if (width > 0) - { - _s3SolidRect(s3,x*3,y,width*3,1); - } - } - ppt++; - pwidth++; - } - } - else - { - nTmp = n * miFindMaxBand(pClip); - pwidthFree = (int *)xalloc(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - n = miClipSpans(fbGetCompositeClip(pGC), - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - _s3SetSolidFill(s3,pGC->fgPixel,pGC->alu,pGC->planemask); - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - width = *pwidth++; - if (width) - { - _s3SolidRect(s3,x*3,y,width*3,1); - } - } - xfree(pptFree); - xfree(pwidthFree); - } - MarkSyncS3 (pDrawable->pScreen); -} - -void -s3_24CopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupS3(pDstDrawable->pScreen); - int srcX, srcY, dstX, dstY; - int w, h; - int flags; - int x1, x2; - - if (sourceInvarient (pGC->alu)) - { - s3_24FillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu, pGC->planemask); - return; - } - - s3SetGlobalBitmap (pDstDrawable->pScreen, s3GCMap (pGC)); - _s3SetBlt(s3,pGC->alu,pGC->planemask); - DRAW_DEBUG ((DEBUG_RENDER, "s3CopyNtoN alu %d planemask 0x%x", - pGC->alu, pGC->planemask)); - dx *= 3; - while (nbox--) - { - x1 = pbox->x1 * 3; - x2 = pbox->x2 * 3; - w = x2 - x1; - h = pbox->y2 - pbox->y1; - flags = 0; - if (reverse) - { - dstX = x2 - 1; - } - else - { - dstX = x1; - flags |= INC_X; - } - srcX = dstX + dx; - - if (upsidedown) - { - dstY = pbox->y2 - 1; - } - else - { - dstY = pbox->y1; - flags |= INC_Y; - } - srcY = dstY + dy; - - _s3Blt (s3, srcX, srcY, dstX, dstY, w, h, flags); - pbox++; - } - MarkSyncS3 (pSrcDrawable->pScreen); -} - -RegionPtr -s3_24CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - SetupS3(pDstDrawable->pScreen); - - if (pSrcDrawable->type == DRAWABLE_WINDOW && - pDstDrawable->type == DRAWABLE_WINDOW && - ok24(pGC->planemask)) - { - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, s3_24CopyNtoN, 0, 0); - } - return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, dsty); -} - - -#define NUM_STACK_RECTS 1024 - -void -s3_24PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - s3GCPrivate(pGC); - 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; - int x, y; - - if (pGC->fillStyle != FillSolid || !ok24 (pGC->fgPixel) || !ok24(pGC->planemask)) - { - KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); - return; - } - - prgnClip = fbGetCompositeClip(pGC); - xorg = pDrawable->x; - yorg = pDrawable->y; - - if (xorg || yorg) - { - prect = prectInit; - n = nrectFill; - while(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) - { - s3_24FillBoxSolid(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->fgPixel, pGC->alu, pGC->planemask); - } - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} - -void -s3_24SolidBoxClipped (DrawablePtr pDrawable, - RegionPtr pClip, - int x1, - int y1, - int x2, - int y2, - FbBits fg) -{ - SetupS3 (pDrawable->pScreen); - BoxPtr pbox; - int nbox; - int partX1, partX2, partY1, partY2; - - s3SetGlobalBitmap (pDrawable->pScreen, s3DrawMap (pDrawable)); - _s3SetSolidFill(s3,fg,GXcopy,~0); - - 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; - - partX1 *= 3; - partX2 *= 3; - _s3SolidRect(s3,partX1, partY1, partX2-partX1, partY2-partY1); - } - MarkSyncS3(pDrawable->pScreen); -} - -void -s3_24ImageGlyphBlt (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; - FbBits *dst; - FbStride dstStride; - int dstBpp; - int dstXoff, dstYoff; - FbBits depthMask; - int xBack, widthBack; - int yBack, heightBack; - - depthMask = FbFullMask(pDrawable->depth); - if (!ok24 (pGC->fgPixel) || - !ok24(pGC->bgPixel) || - !ok24(pGC->planemask)) - { - KdCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase); - return; - } - fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - - x += pDrawable->x; - y += pDrawable->y; - - 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); - s3_24SolidBoxClipped (pDrawable, - fbGetCompositeClip(pGC), - xBack, - yBack, - xBack + widthBack, - yBack + heightBack, - pPriv->bg); - - KdCheckSync (pDrawable->pScreen); - - 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 (gWidth <= sizeof (FbStip) * 8 && - fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) - { - fbGlyph24 (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, - FALSE, - - gx, - gy, - gWidth, gHeight, - - (FbStip *) pglyph, - gStride, - 0); - } - } - x += pci->metrics.characterWidth; - } -} - -static const GCOps s3_24GCOps = { - s3_24FillSpans, - KdCheckSetSpans, - KdCheckPutImage, - KdCheckCopyArea, - KdCheckCopyPlane, - KdCheckPolyPoint, - KdCheckPolylines, - KdCheckPolySegment, - KdCheckPolyRectangle, - KdCheckPolyArc, - KdCheckFillPolygon, - s3_24PolyFillRect, - KdCheckPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - s3_24ImageGlyphBlt, - KdCheckPolyGlyphBlt, - KdCheckPushPixels, -}; - -void -s3_24ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) -{ - if (pDrawable->type != DRAWABLE_WINDOW) - pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; - else - pGC->ops = (GCOps *) &s3_24GCOps; - fbValidateGC (pGC, changes, pDrawable); -} - -GCFuncs s3_24GCFuncs = { - s3_24ValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -Bool -s3_24CreateGC (GCPtr pGC) -{ - if (!fbCreateGC (pGC)) - return FALSE; - - if (pGC->depth != 1) - pGC->funcs = &s3_24GCFuncs; - - return TRUE; -} - -Bool -s3_24CreateWindow(WindowPtr pWin) -{ - return fbCreateWindow (pWin); -} - - -Bool -s3DrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - s3ScreenInfo(pScreenPriv); - int ncache_w, ncache_h, ncache; - int px, py; - S3PatternCache *cache; - Bool dumb = FALSE; - int ma; - - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - case 16: - case 32: - break; - case 24: - dumb = TRUE; - break; - default: - return FALSE; - } - /* - * Hook up asynchronous drawing - */ - RegisterSync (pScreen); - /* - * Replace various fb screen functions - */ - if (dumb) - { - pScreen->CreateGC = s3_24CreateGC; - pScreen->CreateWindow = s3_24CreateWindow; - pScreen->CopyWindow = s3CopyWindow; - } - else - { - if (!dixRequestPrivate(s3GCPrivateKey, sizeof (s3PrivGCRec))) - return FALSE; - pScreen->CreateGC = s3CreateGC; - pScreen->CreateWindow = s3CreateWindow; - pScreen->ChangeWindowAttributes = s3ChangeWindowAttributes; - pScreen->DestroyWindow = s3DestroyWindow; -#ifndef S3_TRIO - if (pScreenPriv->screen->fb[1].depth) - { - FbOverlayScrPrivPtr pScrPriv = fbOverlayGetScrPriv(pScreen); - - pScrPriv->PaintKey = s3PaintKey; - pScrPriv->CopyWindow = s3CopyWindowProc; - pScreen->CopyWindow = fbOverlayCopyWindow; - } - else -#endif - pScreen->CopyWindow = s3CopyWindow; - - /* - * Initialize patterns - */ -#ifdef S3_TRIO - ma = 0; -#else - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) -#endif - { - ncache_w = s3s->fb[ma].offscreen_width / S3_TILE_SIZE; - ncache_h = s3s->fb[ma].offscreen_height / S3_TILE_SIZE; - ncache = ncache_w * ncache_h; - if (ncache > 64) - ncache = 64; - DRAW_DEBUG ((DEBUG_S3INIT, "ncache_w %d ncache_h %d ncache %d", - ncache_w, ncache_h, ncache)); - s3s->fb[ma].patterns.cache = (S3PatternCache *) xalloc (ncache * sizeof (S3PatternCache)); - if (s3s->fb[ma].patterns.cache) - { - DRAW_DEBUG ((DEBUG_S3INIT, "Have pattern cache")); - s3s->fb[ma].patterns.ncache = ncache; - s3s->fb[ma].patterns.last_used = 0; - s3s->fb[ma].patterns.last_id = 0; - cache = s3s->fb[ma].patterns.cache; - for (py = 0; py < ncache_h && ncache; py++) - for (px = 0; px < ncache_w && ncache; px++) - { - cache->id = 0; - cache->x = s3s->fb[ma].offscreen_x + px * S3_TILE_SIZE; - cache->y = s3s->fb[ma].offscreen_y + py * S3_TILE_SIZE; - cache++; - ncache--; - } - } - } - } - return TRUE; -} - -void -s3DrawEnable (ScreenPtr pScreen) -{ - SetupS3(pScreen); - s3ScreenInfo(pScreenPriv); - int c; - int ma; - - s3SetGlobalBitmap (pScreen, 0); - _s3WaitIdleEmpty (s3); - if (pScreenPriv->screen->fb[0].bitsPerPixel == 24) - { - _s3SetScissorsTl(s3, 0, 0); - _s3SetScissorsBr(s3, pScreenPriv->screen->width*3 - 1, pScreenPriv->screen->height - 1); - _s3SetSolidFill(s3, pScreen->whitePixel, GXcopy, ~0); - _s3SolidRect (s3, 0, 0, pScreenPriv->screen->width*3, pScreenPriv->screen->height); - } - else - { - /* - * Flush pattern cache - */ -#ifdef S3_TRIO - ma = 0; -#else - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) -#endif - { - for (c = 0; c < s3s->fb[ma].patterns.ncache; c++) - s3s->fb[ma].patterns.cache[c].id = 0; - } - - _s3SetScissorsTl(s3, 0, 0); - _s3SetScissorsBr(s3, pScreenPriv->screen->width - 1, pScreenPriv->screen->height - 1); - _s3SetSolidFill(s3, pScreen->blackPixel, GXcopy, ~0); - _s3SolidRect (s3, 0, 0, pScreenPriv->screen->width, pScreenPriv->screen->height); - } - MarkSyncS3 (pScreen); -} - -void -s3DrawDisable (ScreenPtr pScreen) -{ - SetupS3 (pScreen); - _s3WaitIdleEmpty (s3); -} - -void -s3DrawFini (ScreenPtr pScreen) -{ - SetupS3(pScreen); - s3ScreenInfo(pScreenPriv); - int ma; - -#ifdef S3_TRIO - ma = 0; -#else - for (ma = 0; s3s->fbmap[ma] >= 0; ma++) -#endif - { - if (s3s->fb[ma].patterns.cache) - { - xfree (s3s->fb[ma].patterns.cache); - s3s->fb[ma].patterns.cache = 0; - s3s->fb[ma].patterns.ncache = 0; - } - } -} - -void -s3DrawSync (ScreenPtr pScreen) -{ - SetupS3(pScreen); - - _s3WaitIdleEmpty(s3c->s3); -} diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h deleted file mode 100644 index eab8e395e..000000000 --- a/hw/kdrive/savage/s3draw.h +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifndef _S3DRAW_H_ -#define _S3DRAW_H_ - -extern DevPrivateKey s3GCPrivateKey; -extern DevPrivateKey s3WindowPrivateKey; - -typedef struct _s3Pattern { - S3PatternCache *cache; - int id; - PixmapPtr pPixmap; - int fillStyle; - int xrot, yrot; - unsigned int fore, back; -} s3PatternRec, *s3PatternPtr; - -typedef struct _s3PrivGC { - int type; /* type of drawable validated against */ - int ma; /* stream descriptor */ - s3PatternPtr pPattern; /* pattern */ -} s3PrivGCRec, *s3PrivGCPtr; - -#define s3GetGCPrivate(g) ((s3PrivGCPtr) \ - dixLookupPrivate(&(g)->devPrivates, s3GCPrivateKey)) - -#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g) - -#define s3GetWindowPrivate(w) ((s3PatternPtr) \ - dixLookupPrivate(&(w)->devPrivates, s3WindowPrivateKey)) - -#define s3SetWindowPrivate(w,p) \ - dixSetPrivate(&(w)->devPrivates, s3WindowPrivateKey, p) - -void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern); - -#define SetupS3(s) KdScreenPriv(s); \ - s3CardInfo(pScreenPriv); \ - S3Ptr s3 = s3c->s3 - -#ifdef S3_SYNC_DEBUG -#define SYNC_DEBUG() fprintf (stderr, "Sync at %s:%d\n", __FILE__,__LINE__) -#else -#define SYNC_DEBUG() -#endif - -#define S3_ASYNC -#ifdef S3_ASYNC -#define CheckSyncS3(s) KdCheckSync(s) -#define MarkSyncS3(s) KdMarkSync(s) -#define RegisterSync(screen) KdScreenInitAsync (screen) -#else -#define CheckSyncS3(s3c) -#define MarkSyncS3(s3c) _s3WaitIdleEmpty(s3c->s3) -#define RegisterSync(screen) -#endif - -#define WIDEN(x) ((unsigned long) (x)) -#define MERGE(a,b) ((WIDEN(a) << 16) | WIDEN(b)) - -#define s3BitmapDescriptor(_stream) ((_stream) + 1) - -#ifdef S3_TRIO -#define s3DrawMap(pDraw) 0 -#define s3SetGlobalBitmap(s,d) -#else -#define s3DrawMap(pDraw) ((pDraw)->depth == \ - getS3ScreenInfo(pScreenPriv)->primary_depth ? 0 : 1) -#endif - -#define s3GCMap(pGC) (s3GetGCPrivate(pGC)->ma) - -/* - * Ok, so the S3 is broken -- it expects bitmaps to come MSB bit order, - * but it's willing to take them in LSB byte order. These macros - * flip bits around without flipping bytes. Instead of using a table - * and burning memory bandwidth, do them in place with the CPU. - */ - -/* The MIPS compiler automatically places these constants in registers */ -#define S3InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -#define S3InvertBits16(v) { \ - v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ - v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ - v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ -} - -#define S3InvertBits8(v) { \ - v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ - v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ - v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ -} - -#define S3ByteSwap32(x) ((x) = (((x) >> 24) | \ - (((x) >> 8) & 0xff00) | \ - (((x) << 8) & 0xff0000) | \ - ((x) << 24))) - -#define S3ByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8)) - -#if BITMAP_BIT_ORDER == LSBFirst -#define S3AdjustBits32(x) S3InvertBits32(x) -#define S3AdjustBits16(x) S3InvertBits16(x) -#else -#define S3AdjustBits32(x) S3ByteSwap32(x) -#define S3AdjustBits16(x) S3ByteSwap16(x) -#endif - -#define _s3WaitSlot(s3) _s3WaitSlots(s3,1) - -#define _s3SetFg(s3,_fg) { \ - DRAW_DEBUG ((DEBUG_REGISTERS, " fg <- 0x%x", _fg));\ - s3->fg = (_fg); \ -} - -#define _s3SetBg(s3,_bg) { \ - DRAW_DEBUG ((DEBUG_REGISTERS, " bg <- 0x%x", _bg));\ - s3->bg = (_bg); \ -} - -#define _s3SetWriteMask(s3,_mask) {\ - DRAW_DEBUG((DEBUG_REGISTERS," write_mask <- 0x%x", _mask)); \ - s3->write_mask = (_mask); \ -} - -#define _s3SetReadMask(s3,_mask) {\ - DRAW_DEBUG((DEBUG_REGISTERS," read_mask <- 0x%x", _mask)); \ - s3->read_mask = (_mask); \ -} - -#define _s3SetPixelControl(s3,_ctl) { \ - DRAW_DEBUG((DEBUG_REGISTERS, " pix_cntl <- 0x%x", PIX_CNTL | (_ctl))); \ - s3->pix_cntl_mult_misc2 = MERGE (CONTROL_MISC2, PIX_CNTL | (_ctl)); \ -} - -#define _s3SetFgMix(s3,_mix) { \ - DRAW_DEBUG((DEBUG_REGISTERS, " fg_mix <- 0x%x", _mix)); \ - s3->enh_fg_mix = (_mix); \ -} - -#define _s3SetBgMix(s3,_mix) { \ - DRAW_DEBUG((DEBUG_REGISTERS, " bg_mix <- 0x%x", _mix)); \ - s3->enh_bg_mix = (_mix); \ -} - -#define _s3SetMix(s3,fg_mix,bg_mix) { \ - DRAW_DEBUG((DEBUG_REGISTERS, " alt_mix <- 0x%x", MERGE(fg_mix,bg_mix))); \ - s3->alt_mix = MERGE(fg_mix,bg_mix); \ -} - -#define _s3SetCur(s3,_x,_y) { \ - DRAW_DEBUG ((DEBUG_REGISTERS, " alt_curxy <- 0x%x", MERGE(_x,_y))); \ - s3->alt_curxy = MERGE(_x,_y); \ -} - -#define _s3SetStep(s3,_x,_y) { \ - DRAW_DEBUG ((DEBUG_REGISTERS, " alt_step <- 0x%x", MERGE(_x,_y))); \ - s3->alt_step = MERGE(_x,_y); \ -} - -#define _s3SetErr(s3,_e) { \ - DRAW_DEBUG ((DEBUG_REGISTERS, " err_term <- 0x%x", _e)); \ - s3->err_term = (_e); \ -} - -#define _s3SetPcnt(s3,_x,_y) { \ - DRAW_DEBUG ((DEBUG_REGISTERS, " alt_pcnt <- 0x%x", MERGE(_x,_y))); \ - s3->alt_pcnt = MERGE(_x,_y); \ -} - -#define _s3SetScissorsTl(s3,t,l) {\ - DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_tl <- 0x%x", MERGE(t,l))); \ - s3->scissors_tl = MERGE(t,l); \ -} - -#define _s3SetScissorsBr(s3,b,r) {\ - DRAW_DEBUG ((DEBUG_REGISTERS, " scissors_br <- 0x%x", MERGE(b,r))); \ - s3->scissors_br = MERGE(b,r); \ -} - -#define _s3CmdWait(s3) - -#define _s3SetCmd(s3,_cmd) { \ - DRAW_DEBUG((DEBUG_REGISTERS, " cmd <- 0x%x", _cmd)); \ - _s3CmdWait(s3); \ - s3->cmd_gp_stat = (_cmd); \ - /* { CARD32 __junk__; __junk__ = s3->cmd_gp_stat; } */ \ -} - -#define _s3SetSolidFill(s3,pix,alu,mask) { \ - DRAW_DEBUG((DEBUG_SET,"set fill 0x%x %d 0x%x",pix,alu,mask)); \ - _s3WaitSlots(s3,4); \ - _s3SetFg (s3, pix); \ - _s3SetWriteMask(s3,mask); \ - _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL | MIX_SRC); \ - _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -#define _s3SolidRect(s3,x,y,w,h) {\ - DRAW_DEBUG((DEBUG_RENDER,"solid rect %d,%d %dx%d",x,y,w,h)); \ - _s3WaitSlots(s3,3); \ - _s3SetCur(s3, x, y); \ - _s3SetPcnt (s3, (w)-1, (h)-1); \ - _s3SetCmd (s3, CMD_RECT|INC_X|INC_Y|DRAW|WRTDATA); \ - DRAW_DEBUG((DEBUG_RENDER," done")); \ -} - -#define _s3SolidLine(s3,maj,min,len,cmd) { \ - DRAW_DEBUG ((DEBUG_RENDER, "solid line 0x%x 0x%x 0x%x", maj, min, cmd)); \ - _s3WaitSlots(s3,4); \ - _s3SetPcnt(s3, (len), 0); \ - _s3SetStep(s3, 2*((min) - (maj)), 2*(min)); \ - _s3SetErr(s3, 2*(min) - (maj)); \ - _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \ -} - -#define _s3ClipLine(s3,cmd,e1,e2,e,len) {\ - DRAW_DEBUG ((DEBUG_RENDER, "clip line 0x%x 0x%x 0x%x 0x%x 0x%x", cmd,e1,e2,e,len)); \ - _s3WaitSlots(s3, 4); \ - _s3SetPcnt (s3, (len), 0); \ - _s3SetStep (s3, e2, e1); \ - _s3SetErr (s3, e); \ - _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \ -} - -#define _s3SetTile(s3,alu,mask) { \ - DRAW_DEBUG ((DEBUG_SET,"set tile %d 0x%x", alu, mask)); \ - _s3WaitSlots(s3,3); \ - _s3SetWriteMask(s3, mask); \ - _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT|s3alu[alu]); \ - _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -/* - * For some reason, MIX_DST doesn't work in this mode; use MIX_OR with - * an explicit 0 pixel value - */ -#define _s3SetStipple(s3,alu,mask,_fg) {\ - DRAW_DEBUG ((DEBUG_SET,"set stipple 0x%x %d 0x%x", _fg, alu, mask)); \ - _s3WaitSlots(s3,5); \ - _s3SetFg (s3, _fg); \ - _s3SetBg (s3, 0); \ - _s3SetWriteMask(s3,mask); \ - _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|MIX_OR); \ - _s3SetPixelControl (s3, MIXSEL_EXPBLT); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -#define _s3SetOpaqueStipple(s3,alu,mask,_fg,_bg) {\ - DRAW_DEBUG ((DEBUG_SET,"set opaque stipple 0x%x 0x%x %d 0x%x", _fg, _bg, alu, mask)); \ - _s3WaitSlots(s3,5); \ - _s3SetFg (s3, _fg); \ - _s3SetBg (s3, _bg); \ - _s3SetWriteMask(s3,mask); \ - _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \ - _s3SetPixelControl (s3, MIXSEL_EXPBLT); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -#define _s3PatRect(s3,px,py,x,y,w,h) {\ - DRAW_DEBUG ((DEBUG_RENDER, "pat rect %d,%d %dx%d", x,y,w,h)); \ - _s3WaitSlots(s3, 4); \ - _s3SetCur (s3, px, py); \ - _s3SetStep (s3, x, y); \ - _s3SetPcnt (s3, (w)-1, (h)-1); \ - _s3SetCmd (s3, CMD_PATBLT|INC_X|INC_Y|DRAW|PLANAR|WRTDATA); \ - DRAW_DEBUG((DEBUG_RENDER," done")); \ -} - -#define _s3SetBlt(s3,alu,mask) { \ - DRAW_DEBUG ((DEBUG_SET,"set blt %d 0x%x", alu, mask)); \ - _s3WaitSlots(s3,3); \ - _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ - _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT | s3alu[alu]); \ - _s3SetWriteMask(s3, mask); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -#define _s3Blt(s3,_sx,_sy,_dx,_dy,_w,_h,_dir) { \ - DRAW_DEBUG ((DEBUG_RENDER, "blt %d,%d -> %d,%d %dx%d 0x%x", \ - _sx,_sy,_dx,_dy,_w,_h,_dir)); \ - _s3WaitSlots(s3,4); \ - _s3SetCur(s3,_sx,_sy); \ - _s3SetStep(s3,_dx,_dy); \ - _s3SetPcnt(s3,(_w)-1,(_h)-1); \ - _s3SetCmd (s3, CMD_BITBLT | (_dir) | DRAW | WRTDATA); \ - DRAW_DEBUG((DEBUG_RENDER," done")); \ -} - -#define _s3SetOpaquePlaneBlt(s3,alu,mask,_fg,_bg) {\ - DRAW_DEBUG ((DEBUG_SET,"set opaque plane blt 0x%x 0x%x %d 0x%x", \ - _fg, _bg, alu, mask)); \ - /* _s3WaitSlots(s3, 5); */ \ - _s3WaitIdleEmpty (s3); \ - _s3SetFg(s3,_fg); \ - _s3SetBg(s3,_bg); \ - _s3SetWriteMask(s3,mask); \ - _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|s3alu[alu]); \ - _s3SetPixelControl(s3,MIXSEL_EXPPC); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -#define _s3SetTransparentPlaneBlt(s3,alu,mask,_fg) {\ - DRAW_DEBUG ((DEBUG_SET,"set transparent plane blt 0x%x %d 0x%x", \ - _fg, alu, mask)); \ - /*_s3WaitSlots(s3, 4); */ \ - _s3WaitIdleEmpty (s3); \ - _s3SetFg(s3,_fg); \ - _s3SetWriteMask(s3,mask); \ - _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|MIX_DST); \ - _s3SetPixelControl(s3,MIXSEL_EXPPC); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -/* Across the plane blt */ -#define _s3PlaneBlt(s3,x,y,w,h) {\ - DRAW_DEBUG ((DEBUG_RENDER, "plane blt %d,%d %dx%d", x,y,w,h)); \ - _s3WaitSlots(s3, 4); \ - _s3SetPixelControl(s3,MIXSEL_EXPPC); \ - _s3SetCur(s3, x, y); \ - _s3SetPcnt (s3, (w)-1, (h)-1); \ - _s3SetCmd (s3, \ - CMD_RECT| /* Fill rectangle */ \ - BYTSEQ| /* LSB byte order */ \ - _32BIT| /* 32 bit data on 32 bit boundaries */ \ - PCDATA| /* Data from CPU */ \ - INC_X|INC_Y| /* X and Y both increasing */ \ - DRAW| /* Draw, not move */ \ - PLANAR| /* multi pixel */ \ - WRTDATA); \ - DRAW_DEBUG((DEBUG_RENDER," done")); \ -} - -#define _s3SetClip(s3,pbox) {\ - DRAW_DEBUG ((DEBUG_SET, "set clip %dx%d -> %dx%d ", \ - pbox->x1, pbox->y1, pbox->x2, pbox->y2)); \ - _s3WaitSlots(s3, 2); \ - _s3SetScissorsTl(s3,(pbox)->x1, (pbox)->y1); \ - _s3SetScissorsBr(s3,(pbox)->x2 - 1, (pbox)->y2 - 1); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -#define _s3ResetClip(s3,pScreen) { \ - DRAW_DEBUG ((DEBUG_SET, "reset clip")); \ - _s3WaitSlots(s3, 2); \ - _s3SetScissorsTl(s3,0,0); \ - _s3SetScissorsBr(s3,pScreen->width - 1, pScreen->height - 1); \ - DRAW_DEBUG((DEBUG_SET," done")); \ -} - -RegionPtr -s3CopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty); - -RegionPtr -s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane); - -void -s3PushPixels (GCPtr pGC, PixmapPtr pBitmap, - DrawablePtr pDrawable, - int w, int h, int x, int y); - -void -s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask); - -void -s3FillBoxPattern (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - int alu, unsigned long planemask, s3PatternPtr pPattern); - -void -s3PolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit); - -void -s3FillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted); - -void -s3PolyFillArcSolid (DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs); - -void -s3FillPoly (DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int count, DDXPointPtr ptsIn); - -void -s3PolyGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, int y, - unsigned int nglyphInit, - CharInfoPtr *ppciInit, - pointer pglyphBase); - -void -s3ImageGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase); - -void -s3ImageTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int xInit, int y, - unsigned int nglyphInit, - CharInfoPtr *ppciInit, - pointer pglyphBase); - -void -s3PolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, - int x, int y, - unsigned int nglyph, CharInfoPtr *ppci, - pointer pglyphBase); - -void -s3Polylines (DrawablePtr pDrawable, GCPtr pGC, - int mode, int nptInit, DDXPointPtr pptInit); - -void -s3PolySegment (DrawablePtr pDrawable, GCPtr pGC, - int nsegInit, xSegment *pSegInit); - -void -s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu, unsigned long planemask); - -void s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable); - -void -s3CheckGCFill (GCPtr pGC); - -void -s3MoveGCFill (GCPtr pGC); - -void -s3SyncProc (DrawablePtr pDrawable); - -#endif diff --git a/hw/kdrive/savage/s3gc.c b/hw/kdrive/savage/s3gc.c deleted file mode 100644 index ade14fa1f..000000000 --- a/hw/kdrive/savage/s3gc.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" -#include "s3draw.h" - -#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "migc.h" - -/* - * Common op groups. Common assumptions: - * - * lineWidth 0 - * lineStyle LineSolid - * fillStyle FillSolid - * rop GXcopy - * font <= 32 pixels wide - */ - -/* TE font */ -static const GCOps s3TEOps = { - s3FillSpans, - KdCheckSetSpans, - KdCheckPutImage, - s3CopyArea, - s3CopyPlane, - KdCheckPolyPoint, - s3Polylines, - s3PolySegment, - KdCheckPolyRectangle, - KdCheckPolyArc, - s3FillPoly, - s3PolyFillRect, - s3PolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - s3ImageTEGlyphBlt, - s3PolyTEGlyphBlt, - s3PushPixels -}; - -/* Non TE font */ -static const GCOps s3NonTEOps = { - s3FillSpans, - KdCheckSetSpans, - KdCheckPutImage, - s3CopyArea, - s3CopyPlane, - KdCheckPolyPoint, - s3Polylines, - s3PolySegment, - KdCheckPolyRectangle, - KdCheckPolyArc, - s3FillPoly, - s3PolyFillRect, - s3PolyFillArcSolid, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - s3ImageGlyphBlt, - s3PolyGlyphBlt, - s3PushPixels -}; - -static GCOps * -s3MatchCommon (DrawablePtr pDraw, GCPtr pGC, FbGCPrivPtr fbPriv) -{ - KdScreenPriv (pDraw->pScreen); - - if (!REGION_NOTEMPTY(pDraw->pScreen,fbGetCompositeClip(pGC))) - { - DRAW_DEBUG ((DEBUG_CLIP, "Empty composite clip, clipping all ops")); - return &kdNoopOps; - } - - if (pDraw->type != DRAWABLE_WINDOW) - return (GCOps *) &kdAsyncPixmapGCOps; - - if (pGC->lineWidth != 0) - return 0; - if (pGC->lineStyle != LineSolid) - return 0; - if (pGC->fillStyle != FillSolid) - return 0; - if (fbPriv->and != 0) - return 0; - if (pGC->font) - { - if (TERMINALFONT(pGC->font)) - return (GCOps *) &s3TEOps; - else - return (GCOps *) &s3NonTEOps; - } - return 0; -} - -void -s3ValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) -{ - int new_type; /* drawable type has changed */ - int new_origin; - - /* flags for changing the proc vector */ - FbGCPrivPtr fbPriv; - s3PrivGCPtr s3Priv; - int oneRect; - GCOps *newops; - - fbPriv = fbGetGCPrivate(pGC); - s3Priv = s3GetGCPrivate(pGC); - - new_type = FALSE; - new_origin = FALSE; - - /* - * If the type of drawable has changed, fix up accelerated functions - */ - if (s3Priv->type != pDrawable->type) - { - new_type = TRUE; - s3Priv->type = pDrawable->type; - } - - /* - * Check tile/stipple origin - */ - if (pGC->lastWinOrg.x != pDrawable->x || pGC->lastWinOrg.y != pDrawable->y) - new_origin = TRUE; - - /* - * Call down to FB to set clip list and rrop values - */ - - fbValidateGC (pGC, changes, pDrawable); - - /* - * Check accelerated pattern if necessary - */ - if (changes & (GCFillStyle|GCStipple|GCTile)) - s3CheckGCFill (pGC); - else if (s3Priv->pPattern && - (new_origin || changes & (GCTileStipXOrigin|GCTileStipYOrigin))) - s3MoveGCFill (pGC); - - /* - * Try to match common vector - */ - - if (newops = s3MatchCommon (pDrawable, pGC, fbPriv)) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - return; - } - - /* - * No common vector matched, create private ops vector and - * fill it in - */ - if (!pGC->ops->devPrivate.val) - { - /* - * Switch from noop vector by first switching to fb - * vector and fixing it up - */ - if (pGC->ops == &kdNoopOps) - { - pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; - new_type = TRUE; - } - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - - /* - * Fills - */ - if (new_type || (changes & (GCFillStyle|GCTile|GCStipple))) - { - pGC->ops->FillSpans = KdCheckFillSpans; - pGC->ops->PolyFillRect = KdCheckPolyFillRect; - if (s3Priv->type == DRAWABLE_WINDOW && - (pGC->fillStyle != FillTiled || s3Priv->pPattern)) - { - pGC->ops->FillSpans = s3FillSpans; - pGC->ops->PolyFillRect = s3PolyFillRect; - } - } - - /* - * Blt - */ - if (new_type) - { - pGC->ops->CopyArea = s3CopyArea; - pGC->ops->CopyPlane = s3CopyPlane; - pGC->ops->PushPixels = s3PushPixels; - } - - /* - * Lines - */ - if (new_type || (changes & (GCLineStyle|GCLineWidth|GCFillStyle))) - { - pGC->ops->Polylines = KdCheckPolylines; - pGC->ops->PolySegment = KdCheckPolySegment; - if (pGC->lineStyle == LineSolid && - pGC->lineWidth == 0 && - pGC->fillStyle == FillSolid && - s3Priv->type == DRAWABLE_WINDOW) - { - pGC->ops->Polylines = s3Polylines; - pGC->ops->PolySegment = s3PolySegment; - } - } - - /* - * Polygons - */ - if (new_type || (changes & (GCFillStyle))) - { - pGC->ops->FillPolygon = KdCheckFillPolygon; - if (s3Priv->type == DRAWABLE_WINDOW && - pGC->fillStyle == FillSolid) - { - pGC->ops->FillPolygon = s3FillPoly; - } - } - - /* - * Filled arcs - */ - if (new_type || (changes & GCFillStyle)) - { - pGC->ops->PolyFillArc = KdCheckPolyFillArc; - if (s3Priv->type == DRAWABLE_WINDOW && - pGC->fillStyle == FillSolid) - { - pGC->ops->PolyFillArc = s3PolyFillArcSolid; - } - } - - /* - * Text - */ - if (new_type || (changes & (GCFont|GCFillStyle))) - { - pGC->ops->PolyGlyphBlt = KdCheckPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = KdCheckImageGlyphBlt; - if (s3Priv->type == DRAWABLE_WINDOW && pGC->font) - { - if (pGC->fillStyle == FillSolid) - { - if (TERMINALFONT(pGC->font)) - pGC->ops->PolyGlyphBlt = s3PolyTEGlyphBlt; - else - pGC->ops->PolyGlyphBlt = s3PolyGlyphBlt; - } - if (TERMINALFONT(pGC->font)) - pGC->ops->ImageGlyphBlt = s3ImageTEGlyphBlt; - else - pGC->ops->ImageGlyphBlt = s3ImageGlyphBlt; - } - } -} diff --git a/hw/kdrive/savage/s3reg.c b/hw/kdrive/savage/s3reg.c deleted file mode 100644 index 673a2ac8f..000000000 --- a/hw/kdrive/savage/s3reg.c +++ /dev/null @@ -1,1301 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3reg.h" - -#define CR00 S3_CR+0x00 -#define CR01 S3_CR+0x01 -#define CR02 S3_CR+0x02 -#define CR03 S3_CR+0x03 -#define CR04 S3_CR+0x04 -#define CR05 S3_CR+0x05 -#define CR06 S3_CR+0x06 -#define CR07 S3_CR+0x07 -#define CR08 S3_CR+0x08 -#define CR09 S3_CR+0x09 -#define CR0A S3_CR+0x0A -#define CR0B S3_CR+0x0B -#define CR0C S3_CR+0x0C -#define CR0D S3_CR+0x0D -#define CR0E S3_CR+0x0E -#define CR0F S3_CR+0x0F -#define CR10 S3_CR+0x10 -#define CR11 S3_CR+0x11 -#define CR12 S3_CR+0x12 -#define CR13 S3_CR+0x13 -#define CR14 S3_CR+0x14 -#define CR15 S3_CR+0x15 -#define CR16 S3_CR+0x16 -#define CR17 S3_CR+0x17 -#define CR18 S3_CR+0x18 -#define CR19 S3_CR+0x19 -#define CR1A S3_CR+0x1A -#define CR1B S3_CR+0x1B -#define CR1C S3_CR+0x1C -#define CR1D S3_CR+0x1D -#define CR1E S3_CR+0x1E -#define CR1F S3_CR+0x1F -#define CR20 S3_CR+0x20 -#define CR21 S3_CR+0x21 -#define CR22 S3_CR+0x22 -#define CR23 S3_CR+0x23 -#define CR24 S3_CR+0x24 -#define CR25 S3_CR+0x25 -#define CR26 S3_CR+0x26 -#define CR27 S3_CR+0x27 -#define CR28 S3_CR+0x28 -#define CR29 S3_CR+0x29 -#define CR2A S3_CR+0x2A -#define CR2B S3_CR+0x2B -#define CR2C S3_CR+0x2C -#define CR2D S3_CR+0x2D -#define CR2E S3_CR+0x2E -#define CR2F S3_CR+0x2F -#define CR30 S3_CR+0x30 -#define CR31 S3_CR+0x31 -#define CR32 S3_CR+0x32 -#define CR33 S3_CR+0x33 -#define CR34 S3_CR+0x34 -#define CR35 S3_CR+0x35 -#define CR36 S3_CR+0x36 -#define CR37 S3_CR+0x37 -#define CR38 S3_CR+0x38 -#define CR39 S3_CR+0x39 -#define CR3A S3_CR+0x3A -#define CR3B S3_CR+0x3B -#define CR3C S3_CR+0x3C -#define CR3D S3_CR+0x3D -#define CR3E S3_CR+0x3E -#define CR3F S3_CR+0x3F -#define CR40 S3_CR+0x40 -#define CR41 S3_CR+0x41 -#define CR42 S3_CR+0x42 -#define CR43 S3_CR+0x43 -#define CR44 S3_CR+0x44 -#define CR45 S3_CR+0x45 -#define CR46 S3_CR+0x46 -#define CR47 S3_CR+0x47 -#define CR48 S3_CR+0x48 -#define CR49 S3_CR+0x49 -#define CR4A S3_CR+0x4A -#define CR4B S3_CR+0x4B -#define CR4C S3_CR+0x4C -#define CR4D S3_CR+0x4D -#define CR4E S3_CR+0x4E -#define CR4F S3_CR+0x4F -#define CR50 S3_CR+0x50 -#define CR51 S3_CR+0x51 -#define CR52 S3_CR+0x52 -#define CR53 S3_CR+0x53 -#define CR54 S3_CR+0x54 -#define CR55 S3_CR+0x55 -#define CR56 S3_CR+0x56 -#define CR57 S3_CR+0x57 -#define CR58 S3_CR+0x58 -#define CR59 S3_CR+0x59 -#define CR5A S3_CR+0x5A -#define CR5B S3_CR+0x5B -#define CR5C S3_CR+0x5C -#define CR5D S3_CR+0x5D -#define CR5E S3_CR+0x5E -#define CR5F S3_CR+0x5F -#define CR60 S3_CR+0x60 -#define CR61 S3_CR+0x61 -#define CR62 S3_CR+0x62 -#define CR63 S3_CR+0x63 -#define CR64 S3_CR+0x64 -#define CR65 S3_CR+0x65 -#define CR66 S3_CR+0x66 -#define CR67 S3_CR+0x67 -#define CR68 S3_CR+0x68 -#define CR69 S3_CR+0x69 -#define CR6A S3_CR+0x6A -#define CR6B S3_CR+0x6B -#define CR6C S3_CR+0x6C -#define CR6D S3_CR+0x6D -#define CR6E S3_CR+0x6E -#define CR6F S3_CR+0x6F -#define CR70 S3_CR+0x70 -#define CR71 S3_CR+0x71 -#define CR72 S3_CR+0x72 -#define CR73 S3_CR+0x73 -#define CR74 S3_CR+0x74 -#define CR75 S3_CR+0x75 -#define CR76 S3_CR+0x76 -#define CR77 S3_CR+0x77 -#define CR78 S3_CR+0x78 -#define CR79 S3_CR+0x79 -#define CR7A S3_CR+0x7A -#define CR7B S3_CR+0x7B -#define CR7C S3_CR+0x7C -#define CR7D S3_CR+0x7D -#define CR7E S3_CR+0x7E -#define CR7F S3_CR+0x7F -#define CR80 S3_CR+0x80 -#define CR81 S3_CR+0x81 -#define CR82 S3_CR+0x82 -#define CR83 S3_CR+0x83 -#define CR84 S3_CR+0x84 -#define CR85 S3_CR+0x85 -#define CR86 S3_CR+0x86 -#define CR87 S3_CR+0x87 -#define CR88 S3_CR+0x88 -#define CR89 S3_CR+0x89 -#define CR8A S3_CR+0x8A -#define CR8B S3_CR+0x8B -#define CR8C S3_CR+0x8C -#define CR8D S3_CR+0x8D -#define CR8E S3_CR+0x8E -#define CR8F S3_CR+0x8F -#define CR90 S3_CR+0x90 -#define CR91 S3_CR+0x91 -#define CR92 S3_CR+0x92 -#define CR93 S3_CR+0x93 -#define CR94 S3_CR+0x94 -#define CR95 S3_CR+0x95 -#define CR96 S3_CR+0x96 -#define CR97 S3_CR+0x97 -#define CR98 S3_CR+0x98 -#define CR99 S3_CR+0x99 -#define CR9A S3_CR+0x9A -#define CR9B S3_CR+0x9B -#define CR9C S3_CR+0x9C -#define CR9D S3_CR+0x9D -#define CR9E S3_CR+0x9E -#define CR9F S3_CR+0x9F -#define CRA0 S3_CR+0xA0 -#define CRA1 S3_CR+0xA1 -#define CRA2 S3_CR+0xA2 -#define CRA3 S3_CR+0xA3 -#define CRA4 S3_CR+0xA4 -#define CRA5 S3_CR+0xA5 -#define CRA6 S3_CR+0xA6 -#define CRA7 S3_CR+0xA7 -#define CRA8 S3_CR+0xA8 -#define CRA9 S3_CR+0xA9 -#define CRAA S3_CR+0xAA -#define CRAB S3_CR+0xAB -#define CRAC S3_CR+0xAC -#define CRAD S3_CR+0xAD -#define CRAE S3_CR+0xAE -#define CRAF S3_CR+0xAF -#define CRB0 S3_CR+0xB0 -#define CRB1 S3_CR+0xB1 -#define CRB2 S3_CR+0xB2 -#define CRB3 S3_CR+0xB3 -#define CRB4 S3_CR+0xB4 -#define CRB5 S3_CR+0xB5 -#define CRB6 S3_CR+0xB6 -#define CRB7 S3_CR+0xB7 -#define CRB8 S3_CR+0xB8 -#define CRB9 S3_CR+0xB9 -#define CRBA S3_CR+0xBA -#define CRBB S3_CR+0xBB -#define CRBC S3_CR+0xBC -#define CRBD S3_CR+0xBD -#define CRBE S3_CR+0xBE -#define CRBF S3_CR+0xBF - -#define CR_FIRST CR00 - -VgaReg s3_h_total[] = { - CR00, 0, 8, - CR5D, 0, 1, - CR5F, 0, 2, - VGA_REG_END -}; - -VgaReg s3_h_display_end[] = { - CR01, 0, 8, - CR5D, 1, 1, - CR5F, 2, 2, - VGA_REG_END -}; - -VgaReg s3_h_blank_start[] = { - CR02, 0, 8, - CR5D, 2, 1, - CR5F, 4, 2, - VGA_REG_END -}; - -VgaReg s3_h_blank_end[] = { - CR03, 0, 5, - CR05, 7, 1, - VGA_REG_END -}; - -VgaReg s3_display_skew[] = { - CR03, 5, 2, - VGA_REG_END -}; - -VgaReg s3_h_sync_start[] = { - CR04, 0, 8, - CR5D, 4, 1, - CR5F, 6, 2, - VGA_REG_END -}; - -VgaReg s3_h_sync_end[] = { - CR05, 0, 5, - VGA_REG_END -}; - -VgaReg s3_h_skew[] = { - CR05, 5, 2, - VGA_REG_END -}; - -VgaReg s3_v_total[] = { - CR06, 0, 8, - CR07, 0, 1, - CR07, 5, 1, - CR5E, 0, 1, - VGA_REG_END -}; - -VgaReg s3_preset_row_scan[] = { - CR08, 0, 8, - VGA_REG_END -}; - -VgaReg s3_max_scan_line[] = { - CR09, 0, 5, - VGA_REG_END -}; - -VgaReg s3_start_address[] = { - CR0D, 0, 8, - CR0C, 0, 8, - CR69, 0, 7, - VGA_REG_END -}; - -VgaReg s3_v_retrace_start[] = { - CR10, 0, 8, - CR07, 2, 1, - CR07, 7, 1, - CR5E, 4, 1, - VGA_REG_END -}; - -VgaReg s3_v_retrace_end[] = { - CR11, 0, 4, - VGA_REG_END -}; - -VgaReg s3_clear_v_retrace_int[] = { - CR11, 4, 1, - VGA_REG_END -}; - -VgaReg s3_disable_v_retrace_int[] = { - CR11, 5, 1, - VGA_REG_END -}; - -VgaReg s3_lock_crtc[] = { - CR11, 7, 1, - VGA_REG_END -}; - -VgaReg s3_v_display_end[] = { - CR12, 0, 8, - CR07, 1, 1, - CR07, 6, 1, - CR5E, 1, 1, - VGA_REG_END -}; - -VgaReg s3_screen_offset[] = { - CR13, 0, 8, - CR51, 4, 2, - VGA_REG_END -}; - -VgaReg s3_count_by_4_mode[] = { - CR14, 5, 1, - VGA_REG_END -}; - -VgaReg s3_doubleword_mode[] = { - CR14, 6, 1, - VGA_REG_END -}; - -VgaReg s3_v_blank_start[] = { - CR15, 0, 8, - CR07, 3, 1, - CR09, 5, 1, - CR5E, 2, 1, - VGA_REG_END -}; - -VgaReg s3_v_blank_end[] = { - CR16, 0, 8, - VGA_REG_END -}; - -VgaReg s3_2bk_cga[] = { - CR17, 0, 1, - VGA_REG_END -}; - -VgaReg s3_4bk_hga[] = { - CR17, 1, 1, - VGA_REG_END -}; - -VgaReg s3_v_total_double[] = { - CR17, 2, 1, - VGA_REG_END -}; - -VgaReg s3_word_mode[] = { - CR17, 3, 1, - VGA_REG_END -}; - -VgaReg s3_address_16k_wrap[] = { - CR17, 5, 1, - VGA_REG_END -}; - -VgaReg s3_byte_mode[] = { - CR17, 6, 1, - VGA_REG_END -}; - -VgaReg s3_hardware_reset[] = { - CR17, 7, 1, - VGA_REG_END -}; - -VgaReg s3_line_compare[] = { - CR18, 0, 8, - CR07, 4, 1, - CR09, 6, 1, - CR5E, 6, 1, - VGA_REG_END -}; - -VgaReg s3_delay_primary_load[] = { - CR21, 1, 1, - VGA_REG_END -}; - -VgaReg s3_device_id[] = { - CR2E, 0, 8, - CR2D, 0, 8, - VGA_REG_END -}; - -VgaReg s3_revision[] = { - CR2F, 0, 8, - VGA_REG_END -}; - -VgaReg s3_enable_vga_16bit[] = { - CR31, 2, 1, - VGA_REG_END -}; - -VgaReg s3_enhanced_memory_mapping[] = { - CR31, 3, 1, - VGA_REG_END -}; - -VgaReg s3_lock_dac_writes[] = { - CR33, 4, 1, - VGA_REG_END -}; - -VgaReg s3_border_select[] = { - CR33, 5, 1, - VGA_REG_END -}; - -VgaReg s3_lock_palette[] = { - CR33, 6, 1, - VGA_REG_END -}; - -VgaReg s3_enable_sff[] = { - CR34, 4, 1, - VGA_REG_END -}; - -VgaReg s3_lock_vert[] = { - CR35, 4, 1, - VGA_REG_END -}; - -VgaReg s3_lock_horz[] = { - CR35, 5, 1, - VGA_REG_END -}; - -VgaReg s3_io_disable[] = { - CR36, 4, 1, - VGA_REG_END -}; - -VgaReg s3_mem_size[] = { - CR36, 5, 3, - VGA_REG_END -}; - -VgaReg s3_register_lock_1 [] = { - CR38, 0, 8, /* load with 0x48 */ - VGA_REG_END -}; - -VgaReg s3_register_lock_2 [] = { - CR39, 0, 8, /* load with 0xa0 */ - VGA_REG_END -}; - -VgaReg s3_refresh_control[] = { - CR3A, 0, 2, - VGA_REG_END -}; - -VgaReg s3_enable_256[] = { - CR3A, 4, 1, - VGA_REG_END -}; - -VgaReg s3_disable_pci_read_bursts[] = { - CR3A, 7, 1, - VGA_REG_END -}; - -VgaReg s3_h_start_fifo_fetch[] = { - CR3B, 0, 8, - CR5D, 6, 1, - CR5B, 2, 2, - VGA_REG_END -}; - -VgaReg s3_enable_2d_access[] = { - CR40, 0, 1, - VGA_REG_END -}; - -VgaReg s3_interlace[] = { - CR42, 5, 1, - VGA_REG_END -}; - -VgaReg s3_old_screen_off_8[] = { - CR43, 2, 1, - VGA_REG_END -}; - -VgaReg s3_h_counter_double_mode[] = { - CR43, 7, 1, - VGA_REG_END -}; - -VgaReg s3_cursor_enable[] = { - CR45, 0, 1, - VGA_REG_END -}; - -VgaReg s3_cursor_right[] = { - CR45, 4, 1, - VGA_REG_END -}; - -VgaReg s3_cursor_xhigh[] = { - CR46, 0, 3, - VGA_REG_END -}; - -VgaReg s3_cursor_xlow[] = { - CR47, 0, 8, - VGA_REG_END -}; - -VgaReg s3_cursor_yhigh[] = { - CR48, 0, 3, - VGA_REG_END -}; - -VgaReg s3_cursor_ylow[] = { - CR49, 0, 8, - VGA_REG_END -}; - -VgaReg s3_cursor_fg[] = { - CR4A, 0, 8, - VGA_REG_END -}; - -VgaReg s3_cursor_bg[] = { - CR4B, 0, 8, - VGA_REG_END -}; - -VgaReg s3_cursor_address[] = { - CR4D, 0, 8, - CR4C, 0, 8, - VGA_REG_END -}; - -VgaReg s3_cursor_xoff[] = { - CR4E, 0, 6, - VGA_REG_END -}; - -VgaReg s3_cursor_yoff[] = { - CR4F, 0, 6, - VGA_REG_END -}; - -VgaReg s3_ge_screen_width[] = { - CR50, 6, 2, - CR50, 0, 1, - VGA_REG_END -}; - -VgaReg s3_pixel_length[] = { - CR50, 4, 2, - VGA_REG_END -}; - -VgaReg s3_big_endian_linear[] = { - CR53, 1, 2, - VGA_REG_END -}; - -VgaReg s3_mmio_select[] = { - CR53, 3, 2, - VGA_REG_END -}; - -VgaReg s3_mmio_window[] = { - CR53, 5, 1, - VGA_REG_END -}; - -VgaReg s3_swap_nibbles[] = { - CR53, 6, 1, - VGA_REG_END -}; - -VgaReg s3_cursor_ms_x11[] = { - CR55, 4, 1, - VGA_REG_END -}; - -VgaReg s3_linear_window_size[] = { - CR58, 0, 2, - VGA_REG_END -}; - -VgaReg s3_enable_linear[] = { - CR58, 4, 1, - VGA_REG_END -}; - -VgaReg s3_h_blank_extend[] = { - CR5D, 3, 1, - VGA_REG_END -}; - -VgaReg s3_h_sync_extend[] = { - CR5D, 5, 1, - VGA_REG_END -}; - -VgaReg s3_sdclk_skew[] = { - CR60, 0, 4, - VGA_REG_END -}; - -VgaReg s3_delay_blank[] = { - CR65, 3, 2, - VGA_REG_END -}; - -VgaReg s3_delay_h_enable[] = { - CR65, 6, 2, - CR65, 0, 1, - VGA_REG_END -}; - -VgaReg s3_enable_2d_3d[] = { - CR66, 0, 1, - VGA_REG_END -}; - -VgaReg s3_pci_disconnect_enable[] = { - CR66, 3, 1, - VGA_REG_END -}; - -VgaReg s3_primary_load_control[] = { - CR66, 4, 1, - VGA_REG_END -}; - -VgaReg s3_secondary_load_control[] = { - CR66, 5, 1, - VGA_REG_END -}; - -VgaReg s3_pci_retry_enable[] = { - CR66, 7, 1, - VGA_REG_END -}; - -VgaReg s3_streams_mode[] = { - CR67, 2, 2, - VGA_REG_END -}; - -VgaReg s3_color_mode[] = { - CR67, 4, 4, - VGA_REG_END -}; - -VgaReg s3_primary_stream_definition[] = { - CR69, 7, 1, - VGA_REG_END -}; - -VgaReg s3_primary_stream_timeout[] = { - CR71, 0, 8, - VGA_REG_END -}; - -VgaReg s3_master_control_unit_timeout[] = { - CR74, 0, 8, - VGA_REG_END -}; - -VgaReg s3_command_buffer_timeout[] = { - CR75, 0, 8, - VGA_REG_END -}; - -VgaReg s3_lpb_timeout[] = { - CR76, 0, 8, - VGA_REG_END -}; - -VgaReg s3_cpu_timeout[] = { - CR78, 0, 8, - VGA_REG_END -}; - -VgaReg s3_2d_graphics_engine_timeout[] = { - CR79, 0, 8, - VGA_REG_END -}; - -VgaReg s3_fifo_drain_delay[] = { - CR85, 0, 3, - VGA_REG_END -}; - -VgaReg s3_fifo_fetch_timing[] = { - CR85, 4, 1, - VGA_REG_END -}; - -VgaReg s3_dac_power_up_time[] = { - CR86, 0, 7, - VGA_REG_END -}; - -VgaReg s3_dac_power_saving_disable[] = { - CR86, 7, 1, - VGA_REG_END -}; - -VgaReg s3_flat_panel_output_control_1[] = { - CR90, 3, 1, - VGA_REG_END -}; - -VgaReg s3_streams_fifo_delay[] = { - CR90, 4, 2, - VGA_REG_END -}; - -VgaReg s3_flat_panel_output_control_2[] = { - CR90, 6, 1, - VGA_REG_END -}; - -VgaReg s3_enable_l1_parameter[] = { - CR90, 7, 1, - VGA_REG_END -}; - -VgaReg s3_primary_stream_l1[] = { - CR91, 0, 8, - CR90, 0, 3, - VGA_REG_END -}; - -#define CR_LAST CR91 - -#define SR00 S3_SR+0x00 -#define SR01 S3_SR+0x01 -#define SR02 S3_SR+0x02 -#define SR03 S3_SR+0x03 -#define SR04 S3_SR+0x04 -#define SR05 S3_SR+0x05 -#define SR06 S3_SR+0x06 -#define SR07 S3_SR+0x07 -#define SR08 S3_SR+0x08 -#define SR09 S3_SR+0x09 -#define SR0A S3_SR+0x0A -#define SR0B S3_SR+0x0B -#define SR0C S3_SR+0x0C -#define SR0D S3_SR+0x0D -#define SR0E S3_SR+0x0E -#define SR0F S3_SR+0x0F -#define SR10 S3_SR+0x10 -#define SR11 S3_SR+0x11 -#define SR12 S3_SR+0x12 -#define SR13 S3_SR+0x13 -#define SR14 S3_SR+0x14 -#define SR15 S3_SR+0x15 -#define SR16 S3_SR+0x16 -#define SR17 S3_SR+0x17 -#define SR18 S3_SR+0x18 -#define SR19 S3_SR+0x19 -#define SR1A S3_SR+0x1A -#define SR1B S3_SR+0x1B -#define SR1C S3_SR+0x1C -#define SR1D S3_SR+0x1D -#define SR1E S3_SR+0x1E -#define SR1F S3_SR+0x1F -#define SR20 S3_SR+0x20 -#define SR21 S3_SR+0x21 -#define SR22 S3_SR+0x22 -#define SR23 S3_SR+0x23 -#define SR24 S3_SR+0x24 -#define SR25 S3_SR+0x25 -#define SR26 S3_SR+0x26 -#define SR27 S3_SR+0x27 -#define SR28 S3_SR+0x28 -#define SR29 S3_SR+0x29 -#define SR2A S3_SR+0x2A -#define SR2B S3_SR+0x2B -#define SR2C S3_SR+0x2C -#define SR2D S3_SR+0x2D -#define SR2E S3_SR+0x2E -#define SR2F S3_SR+0x2F -#define SR30 S3_SR+0x30 -#define SR31 S3_SR+0x31 -#define SR32 S3_SR+0x32 -#define SR33 S3_SR+0x33 -#define SR34 S3_SR+0x34 -#define SR35 S3_SR+0x35 -#define SR36 S3_SR+0x36 -#define SR37 S3_SR+0x37 -#define SR38 S3_SR+0x38 -#define SR39 S3_SR+0x39 -#define SR3A S3_SR+0x3A -#define SR3B S3_SR+0x3B -#define SR3C S3_SR+0x3C -#define SR3D S3_SR+0x3D -#define SR3E S3_SR+0x3E -#define SR3F S3_SR+0x3F -#define SR40 S3_SR+0x40 -#define SR41 S3_SR+0x41 -#define SR42 S3_SR+0x42 -#define SR43 S3_SR+0x43 -#define SR44 S3_SR+0x44 -#define SR45 S3_SR+0x45 -#define SR46 S3_SR+0x46 -#define SR47 S3_SR+0x47 -#define SR48 S3_SR+0x48 -#define SR49 S3_SR+0x49 -#define SR4A S3_SR+0x4A -#define SR4B S3_SR+0x4B -#define SR4C S3_SR+0x4C -#define SR4D S3_SR+0x4D -#define SR4E S3_SR+0x4E -#define SR4F S3_SR+0x4F -#define SR50 S3_SR+0x50 -#define SR51 S3_SR+0x51 -#define SR52 S3_SR+0x52 -#define SR53 S3_SR+0x53 -#define SR54 S3_SR+0x54 -#define SR55 S3_SR+0x55 -#define SR56 S3_SR+0x56 -#define SR57 S3_SR+0x57 -#define SR58 S3_SR+0x58 -#define SR59 S3_SR+0x59 -#define SR5A S3_SR+0x5A -#define SR5B S3_SR+0x5B -#define SR5C S3_SR+0x5C -#define SR5D S3_SR+0x5D -#define SR5E S3_SR+0x5E -#define SR5F S3_SR+0x5F -#define SR60 S3_SR+0x60 -#define SR61 S3_SR+0x61 -#define SR62 S3_SR+0x62 -#define SR63 S3_SR+0x63 -#define SR64 S3_SR+0x64 -#define SR65 S3_SR+0x65 -#define SR66 S3_SR+0x66 -#define SR67 S3_SR+0x67 -#define SR68 S3_SR+0x68 -#define SR69 S3_SR+0x69 -#define SR6A S3_SR+0x6A -#define SR6B S3_SR+0x6B -#define SR6C S3_SR+0x6C -#define SR6D S3_SR+0x6D -#define SR6E S3_SR+0x6E -#define SR6F S3_SR+0x6F - -#define SR_FIRST SR02 - -VgaReg s3_dot_clock_8[] = { - SR01, 0, 1, - VGA_REG_END -}; - -VgaReg s3_screen_off[] = { - SR01, 5, 1, - VGA_REG_END -}; - -VgaReg s3_enable_write_plane[] = { - SR02, 0, 4, - VGA_REG_END -}; - -VgaReg s3_extended_memory_access[] = { - SR04, 1, 1, - VGA_REG_END -}; - -VgaReg s3_sequential_addressing_mode[] = { - SR04, 2, 1, - VGA_REG_END -}; - -VgaReg s3_select_chain_4_mode[] = { - SR04, 3, 1, - VGA_REG_END -}; - -VgaReg s3_unlock_extended_sequencer[] = { - SR08, 0, 8, /* write 0x06 */ - VGA_REG_END -}; - -VgaReg s3_linear_addressing_control[] = { - SR09, 0, 1, - VGA_REG_END -}; - -VgaReg s3_disable_io_ports[] = { - SR09, 7, 1, - VGA_REG_END -}; - -VgaReg s3_hsync_control[] = { - SR0D, 4, 2, - VGA_REG_END -}; - -VgaReg s3_vsync_control[] = { - SR0D, 6, 2, - VGA_REG_END -}; - -VgaReg s3_mclk_n[] = { - SR10, 0, 5, - VGA_REG_END -}; - -VgaReg s3_mclk_r[] = { - SR10, 5, 2, - VGA_REG_END -}; - -VgaReg s3_mclk_m[] = { - SR11, 0, 7, - VGA_REG_END -}; - -VgaReg s3_dclk_n[] = { - SR12, 0, 6, - SR29, 4, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_r[] = { - SR12, 6, 2, - SR29, 2, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_m[] = { - SR13, 0, 8, - SR29, 3, 1, - VGA_REG_END -}; - -VgaReg s3_mclk_load[] = { - SR15, 0, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_load[] = { - SR15, 1, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_over_2[] = { - SR15, 4, 1, - VGA_REG_END -}; - -VgaReg s3_clock_load_imm[] = { - SR15, 5, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_invert[] = { - SR15, 6, 1, - VGA_REG_END -}; - -VgaReg s3_enable_clock_double[] = { - SR18, 7, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_double_15_16_invert[] = { - SR1A, 0, 1, - VGA_REG_END -}; - -VgaReg s3_enable_gamma_correction[] = { - SR1B, 3, 1, - VGA_REG_END -}; - -VgaReg s3_enable_8_bit_luts[] = { - SR1B, 4, 1, - VGA_REG_END -}; - -VgaReg s3_dclk_control[] = { - SR1B, 7, 1, - VGA_REG_END -}; - -VgaReg s3_eclk_n[] = { - SR32, 0, 5, - VGA_REG_END -}; - -VgaReg s3_eclk_r[] = { - SR32, 5, 2, - VGA_REG_END -}; - -VgaReg s3_eclk_m[] = { - SR32, 0, 5, - VGA_REG_END -}; - -VgaReg s3_vga_dclk_n[] = { - SR36, 0, 6, - SR39, 4, 1, - VGA_REG_END -}; - -VgaReg s3_vga_dclk_r[] = { - SR36, 6, 2, - SR39, 2, 1, - VGA_REG_END -}; - -VgaReg s3_vga_dclk_m1[] = { - SR37, 0, 8, - SR39, 3, 1, - VGA_REG_END -}; - -VgaReg s3_vga_dclk_m2[] = { - SR38, 0, 8, - SR39, 3, 1, - VGA_REG_END -}; - -VgaReg s3_vga_clk_select[] = { - SR39, 0, 1, - VGA_REG_END -}; - -#define SR_LAST SR39 - -#define AR00 (S3_AR+0x00) -#define AR10 (S3_AR+0x10) -#define AR11 (S3_AR+0x11) -#define AR12 (S3_AR+0x12) -#define AR13 (S3_AR+0x13) -#define AR14 (S3_AR+0x14) - -#define AR_FIRST AR00 - -VgaReg s3_select_graphics_mode[] = { - AR10, 0, 1, - VGA_REG_END -}; - -VgaReg s3_enable_blinking[] = { - AR10, 3, 1, - VGA_REG_END -}; - -VgaReg s3_border_color[] = { - AR11, 0, 8, - VGA_REG_END -}; - -#define AR_LAST AR11 - -VgaReg s3_io_addr_select[] = { - S3_MISC_OUT, 0, 1, - VGA_REG_END -}; - -VgaReg s3_enable_ram[] = { - S3_MISC_OUT, 1, 1, - VGA_REG_END -}; - -VgaReg s3_clock_select[] = { - S3_MISC_OUT, 2, 2, - VGA_REG_END -}; - -VgaReg s3_horz_sync_neg[] = { - S3_MISC_OUT, 6, 1, - VGA_REG_END -}; - -VgaReg s3_vert_sync_neg[] = { - S3_MISC_OUT, 7, 1, - VGA_REG_END -}; - -VgaReg s3_display_mode_inactive[] = { - S3_INPUT_STATUS_1, 0, 1, - VGA_REG_END -}; - -VgaReg s3_vertical_sync_active[] = { - S3_INPUT_STATUS_1, 3, 1, - VGA_REG_END -}; - -VgaReg s3_dac_mask[] = { - S3_DAC + 0, 0, 8, - VGA_REG_END -}; - -VgaReg s3_dac_read_index[] = { - S3_DAC + 1, 0, 8, - VGA_REG_END -}; - -VgaReg s3_dac_write_index[] = { - S3_DAC + 2, 0, 8, - VGA_REG_END -}; - -VgaReg s3_dac_data[] = { - S3_DAC + 3, 0, 8, - VGA_REG_END -}; - -VGA8 -_s3Inb (VgaCard *card, VGA16 port) -{ - VGAVOL8 *reg; - - if (card->closure) - return VgaReadMemb ((VGA32) card->closure + port); - else - return VgaInb (port); -} - -void -_s3Outb (VgaCard *card, VGA8 value, VGA16 port) -{ - if (card->closure) - VgaWriteMemb (value, (VGA32) card->closure + port); - else - VgaOutb (value, port); -} - -void -_s3RegMap (VgaCard *card, VGA16 reg, VgaMap *map, VGABOOL write) -{ - - if (reg < S3_SR + S3_NSR) - { - map->access = VgaAccessIndIo; - map->port = 0x3c4; - map->addr = 0; - map->value = 1; - map->index = reg - S3_SR; - } - else if (reg < S3_GR + S3_NGR) - { - map->access = VgaAccessIndIo; - map->port = 0x3ce; - map->addr = 0; - map->value = 1; - map->index = reg - S3_GR; - } - else if (reg < S3_AR + S3_NAR) - { - reg -= S3_AR; - map->access = VgaAccessDone; - /* reset AFF to index */ - (void) _s3Inb (card, 0x3da); - if (reg >= 16) - reg |= 0x20; - _s3Outb (card, reg, 0x3c0); - if (write) - _s3Outb (card, map->value, 0x3c0); - else - map->value = _s3Inb (card, 0x3c1); - if (!(reg & 0x20)) - { - /* enable video display again */ - (void) _s3Inb (card, 0x3da); - _s3Outb (card, 0x20, 0x3c0); - } - return; - } - else if (reg < S3_CR + S3_NCR) - { - map->access = VgaAccessIndIo; - map->port = 0x3d4; - map->addr = 0; - map->value = 1; - map->index = reg - S3_CR; - } - else if (reg < S3_DAC + S3_NDAC) - { - map->access = VgaAccessIo; - map->port = 0x3c6 + reg - S3_DAC; - } - else switch (reg) { - case S3_MISC_OUT: - map->access = VgaAccessIo; - if (write) - map->port = 0x3c2; - else - map->port = 0x3cc; - break; - case S3_INPUT_STATUS_1: - map->access = VgaAccessIo; - map->port = 0x3da; - break; - } - if (card->closure) - { - map->port = map->port + (VGA32) card->closure; - if (map->access == VgaAccessIo) - map->access = VgaAccessMem; - if (map->access == VgaAccessIndIo) - map->access = VgaAccessIndMem; - } -} - -VgaSave s3Saves[] = { - CR_FIRST, CR18, - CR31, CR_LAST, - SR_FIRST, SR15, - SR18, SR_LAST, - AR_FIRST, AR_LAST, - S3_MISC_OUT, S3_MISC_OUT, - VGA_SAVE_END -}; - -void -s3RegInit (S3Vga *s3vga, VGAVOL8 *mmio) -{ - s3vga->card.map = _s3RegMap; - s3vga->card.closure = (void *) mmio; - s3vga->card.max = S3_NREG; - s3vga->card.values = s3vga->values; - s3vga->card.saves = s3Saves; -} - -void -s3Save (S3Vga *s3vga) -{ - s3vga->save_lock_crtc = s3Get(s3vga, s3_lock_crtc); - s3SetImm (s3vga, s3_lock_crtc, 0); - s3vga->save_register_lock_1 = s3Get (s3vga, s3_register_lock_1); - s3SetImm (s3vga, s3_register_lock_1, 0x48); - s3vga->save_register_lock_2 = s3Get (s3vga, s3_register_lock_2); - s3SetImm (s3vga, s3_register_lock_2, 0xa5); - s3vga->save_unlock_extended_sequencer = s3Get (s3vga, s3_unlock_extended_sequencer); - s3SetImm (s3vga, s3_unlock_extended_sequencer, 0x06); - s3vga->save_lock_horz = s3Get (s3vga, s3_lock_horz); - s3SetImm (s3vga, s3_lock_horz, 0); - s3vga->save_lock_vert = s3Get (s3vga, s3_lock_vert); - s3SetImm (s3vga, s3_lock_vert, 0); - s3vga->save_dot_clock_8 = s3Get (s3vga, s3_dot_clock_8); - VgaPreserve (&s3vga->card); -} - -void -s3Reset (S3Vga *s3vga) -{ - VgaRestore (&s3vga->card); - s3SetImm (s3vga, s3_clock_load_imm, 1); - s3SetImm (s3vga, s3_clock_load_imm, 0); - s3SetImm (s3vga, s3_dot_clock_8, s3vga->save_dot_clock_8); - s3SetImm (s3vga, s3_lock_vert, s3vga->save_lock_vert); - s3SetImm (s3vga, s3_lock_horz, s3vga->save_lock_horz); - s3SetImm (s3vga, s3_lock_dac_writes, s3vga->save_lock_dac_writes); - s3SetImm (s3vga, s3_unlock_extended_sequencer, s3vga->save_unlock_extended_sequencer); - s3SetImm (s3vga, s3_register_lock_2, s3vga->save_register_lock_2); - s3SetImm (s3vga, s3_register_lock_1, s3vga->save_register_lock_1); - s3SetImm (s3vga, s3_lock_crtc, s3vga->save_lock_crtc); - VgaFinish (&s3vga->card); -} diff --git a/hw/kdrive/savage/s3reg.h b/hw/kdrive/savage/s3reg.h deleted file mode 100644 index 5c5b09f6d..000000000 --- a/hw/kdrive/savage/s3reg.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifndef _S3REG_H_ -#define _S3REG_H_ - -#include "vga.h" - -#define S3_SR 0 -#define S3_NSR 0x70 -#define S3_GR (S3_SR+S3_NSR) -#define S3_NGR 0x09 -#define S3_AR (S3_GR+S3_NGR) -#define S3_NAR 0x15 -#define S3_CR (S3_AR+S3_NAR) -#define S3_NCR 0xc0 -#define S3_DAC (S3_CR+S3_NCR) -#define S3_NDAC 4 -#define S3_MISC_OUT (S3_DAC + S3_NDAC) -#define S3_INPUT_STATUS_1 (S3_MISC_OUT+1) -#define S3_NREG (S3_INPUT_STATUS_1+1) - -extern VgaReg s3_h_total[]; -extern VgaReg s3_h_display_end[]; -extern VgaReg s3_h_blank_start[]; -extern VgaReg s3_h_blank_end[]; -extern VgaReg s3_display_skew[]; -extern VgaReg s3_h_sync_start[]; -extern VgaReg s3_h_sync_end[]; -extern VgaReg s3_h_skew[]; -extern VgaReg s3_v_total[]; -extern VgaReg s3_preset_row_scan[]; -extern VgaReg s3_max_scan_line[]; -extern VgaReg s3_start_address[]; -extern VgaReg s3_v_retrace_start[]; -extern VgaReg s3_v_retrace_end[]; -extern VgaReg s3_clear_v_retrace_int[]; -extern VgaReg s3_disable_v_retrace_int[]; -extern VgaReg s3_lock_crtc[]; -extern VgaReg s3_v_display_end[]; -extern VgaReg s3_screen_offset[]; -extern VgaReg s3_count_by_4_mode[]; -extern VgaReg s3_doubleword_mode[]; -extern VgaReg s3_v_blank_start[]; -extern VgaReg s3_v_blank_end[]; -extern VgaReg s3_2bk_cga[]; -extern VgaReg s3_4bk_hga[]; -extern VgaReg s3_v_total_double[]; -extern VgaReg s3_address_16k_wrap[]; -extern VgaReg s3_word_mode[]; -extern VgaReg s3_byte_mode[]; -extern VgaReg s3_hardware_reset[]; -extern VgaReg s3_line_compare[]; -extern VgaReg s3_delay_primary_load[]; -extern VgaReg s3_device_id[]; -extern VgaReg s3_revision[]; -extern VgaReg s3_enable_vga_16bit[]; -extern VgaReg s3_enhanced_memory_mapping[]; -extern VgaReg s3_enable_sff[]; -extern VgaReg s3_lock_dac_writes[]; -extern VgaReg s3_border_select[]; -extern VgaReg s3_lock_palette[]; -extern VgaReg s3_lock_vert[]; -extern VgaReg s3_lock_horz[]; -extern VgaReg s3_io_disable[]; -extern VgaReg s3_mem_size[]; -extern VgaReg s3_register_lock_1 []; -extern VgaReg s3_register_lock_2 []; -extern VgaReg s3_refresh_control[]; -extern VgaReg s3_enable_256[]; -extern VgaReg s3_disable_pci_read_bursts[]; -extern VgaReg s3_h_start_fifo_fetch[]; -extern VgaReg s3_enable_2d_access[]; -extern VgaReg s3_interlace[]; -extern VgaReg s3_old_screen_off_8[]; -extern VgaReg s3_h_counter_double_mode[]; -extern VgaReg s3_cursor_enable[]; -extern VgaReg s3_cursor_right[]; -extern VgaReg s3_cursor_xhigh[]; -extern VgaReg s3_cursor_xlow[]; -extern VgaReg s3_cursor_yhigh[]; -extern VgaReg s3_cursor_ylow[]; -extern VgaReg s3_cursor_fg[]; -extern VgaReg s3_cursor_bg[]; -extern VgaReg s3_cursor_address[]; -extern VgaReg s3_cursor_xoff[]; -extern VgaReg s3_cursor_yoff[]; -extern VgaReg s3_ge_screen_width[]; -extern VgaReg s3_pixel_length[]; -extern VgaReg s3_big_endian_linear[]; -extern VgaReg s3_mmio_select[]; -extern VgaReg s3_mmio_window[]; -extern VgaReg s3_swap_nibbles[]; -extern VgaReg s3_cursor_ms_x11[]; -extern VgaReg s3_linear_window_size[]; -extern VgaReg s3_enable_linear[]; -extern VgaReg s3_h_blank_extend[]; -extern VgaReg s3_h_sync_extend[]; -extern VgaReg s3_sdclk_skew[]; -extern VgaReg s3_delay_blank[]; -extern VgaReg s3_delay_h_enable[]; -extern VgaReg s3_enable_2d_3d[]; -extern VgaReg s3_pci_disconnect_enable[]; -extern VgaReg s3_primary_load_control[]; -extern VgaReg s3_secondary_load_control[]; -extern VgaReg s3_pci_retry_enable[]; -extern VgaReg s3_streams_mode[]; -extern VgaReg s3_color_mode[]; -extern VgaReg s3_primary_stream_definition[]; -extern VgaReg s3_primary_stream_timeout[]; -extern VgaReg s3_master_control_unit_timeout[]; -extern VgaReg s3_command_buffer_timeout[]; -extern VgaReg s3_lpb_timeout[]; -extern VgaReg s3_cpu_timeout[]; -extern VgaReg s3_2d_graphics_engine_timeout[]; -extern VgaReg s3_fifo_drain_delay[]; -extern VgaReg s3_fifo_fetch_timing[]; -extern VgaReg s3_dac_power_up_time[]; -extern VgaReg s3_dac_power_saving_disable[]; -extern VgaReg s3_flat_panel_output_control_1[]; -extern VgaReg s3_streams_fifo_delay[]; -extern VgaReg s3_flat_panel_output_control_2[]; -extern VgaReg s3_enable_l1_parameter[]; -extern VgaReg s3_primary_stream_l1[]; - -extern VgaReg s3_dot_clock_8[]; -extern VgaReg s3_screen_off[]; -extern VgaReg s3_enable_write_plane[]; -extern VgaReg s3_extended_memory_access[]; -extern VgaReg s3_sequential_addressing_mode[]; -extern VgaReg s3_select_chain_4_mode[]; - -extern VgaReg s3_unlock_extended_sequencer[]; -extern VgaReg s3_linear_addressing_control[]; -extern VgaReg s3_disable_io_ports[]; -extern VgaReg s3_hsync_control[]; -extern VgaReg s3_vsync_control[]; -extern VgaReg s3_mclk_n[]; -extern VgaReg s3_mclk_r[]; -extern VgaReg s3_mclk_m[]; -extern VgaReg s3_dclk_n[]; -extern VgaReg s3_dclk_r[]; -extern VgaReg s3_dclk_m[]; -extern VgaReg s3_mclk_load[]; -extern VgaReg s3_dclk_load[]; -extern VgaReg s3_dclk_over_2[]; -extern VgaReg s3_clock_load_imm[]; -extern VgaReg s3_dclk_invert[]; -extern VgaReg s3_enable_clock_double[]; -extern VgaReg s3_dclk_double_15_16_invert[]; -extern VgaReg s3_enable_gamma_correction[]; -extern VgaReg s3_enable_8_bit_luts[]; -extern VgaReg s3_dclk_control[]; -extern VgaReg s3_eclk_n[]; -extern VgaReg s3_eclk_r[]; -extern VgaReg s3_eclk_m[]; -extern VgaReg s3_vga_dclk_n[]; -extern VgaReg s3_vga_dclk_r[]; -extern VgaReg s3_vga_dclk_m1[]; -extern VgaReg s3_vga_dclk_m2[]; -extern VgaReg s3_vga_clk_select[]; -extern VgaReg s3_select_graphics_mode[]; -extern VgaReg s3_enable_blinking[]; -extern VgaReg s3_border_color[]; - -extern VgaReg s3_io_addr_select[]; -extern VgaReg s3_enable_ram[]; -extern VgaReg s3_clock_select[]; -extern VgaReg s3_horz_sync_neg[]; -extern VgaReg s3_vert_sync_neg[]; - -extern VgaReg s3_display_mode_inactive[]; -extern VgaReg s3_vertical_sync_active[]; - -extern VgaReg s3_dac_mask[]; -extern VgaReg s3_dac_read_index[]; -extern VgaReg s3_dac_write_index[]; -extern VgaReg s3_dac_data[]; - -#define s3Get(sv,r) VgaGet(&(sv)->card, (r)) -#define s3GetImm(sv,r) VgaGetImm(&(sv)->card, (r)) -#define s3Set(sv,r,v) VgaSet(&(sv)->card, (r), (v)) -#define s3SetImm(sv,r,v) VgaSetImm(&(sv)->card, (r), (v)) - -typedef struct _s3Vga { - VgaCard card; - VgaValue values[S3_NREG]; - VGA32 save_lock_crtc; - VGA32 save_register_lock_1; - VGA32 save_register_lock_2; - VGA32 save_unlock_extended_sequencer; - VGA32 save_lock_dac_writes; - VGA32 save_lock_horz; - VGA32 save_lock_vert; - VGA32 save_dot_clock_8; -} S3Vga; - -void -s3RegInit (S3Vga *s3vga, VGAVOL8 *mmio); - -void -s3Save (S3Vga *s3vga); - -void -s3Reset (S3Vga *s3vga); - -#endif /* _S3REG_H_ */ diff --git a/hw/kdrive/savage/s3rtst.c b/hw/kdrive/savage/s3rtst.c deleted file mode 100644 index c24b860ac..000000000 --- a/hw/kdrive/savage/s3rtst.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include <stdio.h> -#include "s3reg.h" - -typedef struct { - VgaReg *reg; - char *name; -} NamedVgaReg; - -NamedVgaReg s3VRegs[] = { - s3_h_total, "h_total", - s3_h_display_end, "h_display_end", - s3_h_blank_start, "h_blank_start", - s3_h_blank_end, "h_blank_end", - s3_display_skew, "display_skew", - s3_h_sync_start, "h_sync_start", - s3_h_sync_end, "h_sync_end", - s3_h_skew, "h_skew", - s3_v_total, "v_total", - s3_preset_row_scan, "preset_row_scan", - s3_max_scan_line, "max_scan_line", - s3_start_address, "start_address", - s3_v_retrace_start, "v_retrace_start", - s3_v_retrace_end, "v_retrace_end", - s3_clear_v_retrace_int, "clear_v_retrace_int", - s3_disable_v_retrace_int, "disable_v_retrace_int", - s3_lock_crtc, "lock_crtc", - s3_v_display_end, "v_display_end", - s3_screen_offset, "screen_offset", - s3_count_by_4_mode, "count_by_4_mode", - s3_doubleword_mode, "doubleword_mode", - s3_v_blank_start, "v_blank_start", - s3_v_blank_end, "v_blank_end", - s3_v_total_double, "v_total_double", - s3_word_mode, "word_mode", - s3_byte_mode, "byte_mode", - s3_line_compare, "line_compare", - s3_device_id, "device_id", - s3_revision, "revision", - s3_lock_vert, "lock_vert", - s3_lock_horz, "lock_horz", - s3_io_disable, "io_disable", - s3_mem_size, "mem_size", - s3_register_lock_1 , "register_lock_1 ", - s3_register_lock_2 , "register_lock_2 ", - s3_refresh_control, "refresh_control", - s3_enable_256, "enable_256", - s3_enable_pci_read_bursts, "enable_pci_read_bursts", - s3_h_start_fifo_fetch, "h_start_fifo_fetch", - s3_interlace, "interlace", - s3_old_screen_off_8, "old_screen_off_8", - s3_h_counter_double_mode, "h_counter_double_mode", - s3_hardware_cursor_enable, "hardware_cursor_enable", - s3_hardware_cursor_right, "hardware_cursor_right", - s3_hardware_cursor_x, "hardware_cursor_x", - s3_hardware_cursor_y, "hardware_cursor_y", - s3_hardware_cursor_fg, "hardware_cursor_fg", - s3_cursor_address, "cursor_address", - s3_cursor_start_x, "cursor_start_x", - s3_cursor_start_y, "cursor_start_y", - s3_ge_screen_width, "ge_screen_width", - s3_pixel_length, "pixel_length", - s3_big_endian_linear, "big_endian_linear", - s3_mmio_select, "mmio_select", - s3_mmio_window, "mmio_window", - s3_swap_nibbles, "swap_nibbles", - s3_hardware_cursor_ms_x11, "hardware_cursor_ms_x11", - s3_h_blank_extend, "h_blank_extend", - s3_h_sync_extend, "h_sync_extend", - s3_enable_2d_3d, "enable_2d_3d", - s3_pci_disconnect_enable, "pci_disconnect_enable", - s3_pci_retry_enable, "pci_retry_enable", - s3_color_mode, "color_mode", - s3_screen_off, "screen_off", - s3_unlock_extended_sequencer, "unlock_extended_sequencer", - s3_disable_io_ports, "disable_io_ports", - s3_hsync_control, "hsync_control", - s3_vsync_control, "vsync_control", - s3_mclk_n, "mclk_n", - s3_mclk_r, "mclk_r", - s3_mclk_m, "mclk_m", - s3_dclk_n, "dclk_n", - s3_dclk_r, "dclk_r", - s3_dclk_m, "dclk_m", - s3_mclk_load, "mclk_load", - s3_dclk_load, "dclk_load", - s3_dclk_over_2, "dclk_over_2", - s3_clock_load_imm, "clock_load_imm", - s3_dclk_invert, "dclk_invert", - s3_enable_clock_double, "enable_clock_double", - s3_dclk_double_15_16_invert, "dclk_double_15_16_invert", - s3_enable_gamma_correction, "enable_gamma_correction", - s3_enable_8_bit_luts, "enable_8_bit_luts", - s3_dclk_control, "dclk_control", - s3_vga_dclk_n, "vga_dclk_n", - s3_vga_dclk_r, "vga_dclk_r", - s3_vga_dclk_m1, "vga_dclk_m1", - s3_vga_dclk_m2, "vga_dclk_m2", - s3_vga_clk_select, "vga_clk_select", - s3_clock_select, "clock_select", -}; - -#define NUM_S3_VREGS (sizeof (s3VRegs)/ sizeof (s3VRegs[0])) - -main (int argc, char **argv) -{ - int i; - - iopl(3); - s3SetImm(s3_register_lock_1, 0x48); - s3SetImm(s3_register_lock_2, 0xa0); - s3SetImm(s3_unlock_extended_sequencer, 0x06); - for (i = 0; i < NUM_S3_VREGS; i++) - printf ("%-20.20s %8x\n", s3VRegs[i].name, s3Get (s3VRegs[i].reg)); - s3Restore (); -} diff --git a/hw/kdrive/savage/s3stub.c b/hw/kdrive/savage/s3stub.c deleted file mode 100644 index 145c5c1f6..000000000 --- a/hw/kdrive/savage/s3stub.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; -#ifdef VXWORKS - attr.naddr = 2; - attr.io = 0; - attr.address[0] = 0xbc000000; /* registers */ - attr.address[1] = 0xba000000; /* frame buffer */ - KdCardInfoAdd (&s3Funcs, &attr, 0); -#else - CARD32 count; - - count = 0; - while (LinuxFindPci (0x5333, 0x8a22, count, &attr)) - { - KdCardInfoAdd (&s3Funcs, &attr, 0); - count++; - } -#endif -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -extern int s3CpuTimeout; -extern int s3AccelTimeout; - -void -ddxUseMsg (void) -{ - ErrorF("\nSavage Driver Options:\n"); - ErrorF("-cpu Sets CPU timout\n"); - ErrorF("-accel Sets acceleration timout\n"); - - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!strcmp (argv[i], "-cpu")) - { - s3CpuTimeout = strtol(argv[i+1], NULL, 0); - return 2; - } - if (!strcmp (argv[i], "-accel")) - { - s3AccelTimeout = strtol (argv[i+1], NULL, 0); - return 2; - } - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/sis300/Makefile.am b/hw/kdrive/sis300/Makefile.am deleted file mode 100644 index af2500aee..000000000 --- a/hw/kdrive/sis300/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -if KDRIVEFBDEV -FBDEV_INCLUDES =-I$(top_srcdir)/hw/kdrive/fbdev -FBDEV_LIBS = $(top_builddir)/hw/kdrive/fbdev/libfbdev.a -endif - -if KDRIVEVESA -VESA_INCLUDES = -I$(top_srcdir)/hw/kdrive/vesa -VESA_LIBS = $(top_builddir)/hw/kdrive/vesa/libvesa.a -endif - -INCLUDES = \ - @KDRIVE_INCS@ \ - $(DRI_INCLUDES) \ - $(FBDEV_INCLUDES) \ - $(VESA_INCLUDES) \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xsis - -noinst_LIBRARIES = libsis.a - -libsis_a_SOURCES = \ - sis.c \ - sis.h \ - sis_draw.c \ - sis_reg.h - -Xsis_SOURCES = \ - sis_stub.c - -SIS_LIBS = \ - libsis.a \ - $(FBDEV_LIBS) \ - $(VESA_LIBS) \ - @KDRIVE_LIBS@ - -if GLX -Xsis_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xsis_LDADD = \ - $(SIS_LIBS) \ - @KDRIVE_LIBS@ \ - $(TSLIB_FLAG) - -Xsis_DEPENDENCIES = \ - libsis.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/sis300/sis.c b/hw/kdrive/sis300/sis.c deleted file mode 100644 index 30b7ac2c5..000000000 --- a/hw/kdrive/sis300/sis.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" -#include "sis_reg.h" - -struct pci_id_entry sis_pci_ids[] = { - {0x1039, 0x0300, 0x1, "SiS 300/305"}, - {0x1039, 0x5300, 0x1, "SiS 540"}, - {0x1039, 0x6300, 0x1, "SiS 630"}, - {0x1039, 0x7300, 0x1, "SiS 730"}, - {0, 0, 0, NULL} -}; - -static Bool -SiSCardInit(KdCardInfo *card) -{ - SiSCardInfo *sisc; - Bool initialized = FALSE; - - sisc = xcalloc(sizeof(SiSCardInfo), 1); - if (sisc == NULL) - return FALSE; - -#ifdef KDRIVEFBDEV - if (!initialized && fbdevInitialize(card, &sisc->backend_priv.fbdev)) { - sisc->use_fbdev = TRUE; - initialized = TRUE; - sisc->backend_funcs.cardfini = fbdevCardFini; - sisc->backend_funcs.scrfini = fbdevScreenFini; - sisc->backend_funcs.initScreen = fbdevInitScreen; - sisc->backend_funcs.finishInitScreen = fbdevFinishInitScreen; - sisc->backend_funcs.createRes = fbdevCreateResources; - sisc->backend_funcs.preserve = fbdevPreserve; - sisc->backend_funcs.restore = fbdevRestore; - sisc->backend_funcs.dpms = fbdevDPMS; - sisc->backend_funcs.enable = fbdevEnable; - sisc->backend_funcs.disable = fbdevDisable; - sisc->backend_funcs.getColors = fbdevGetColors; - sisc->backend_funcs.putColors = fbdevPutColors; - } -#endif -#ifdef KDRIVEVESA - if (!initialized && vesaInitialize(card, &sisc->backend_priv.vesa)) { - sisc->use_vesa = TRUE; - initialized = TRUE; - sisc->backend_funcs.cardfini = vesaCardFini; - sisc->backend_funcs.scrfini = vesaScreenFini; - sisc->backend_funcs.initScreen = vesaInitScreen; - sisc->backend_funcs.finishInitScreen = vesaFinishInitScreen; - sisc->backend_funcs.createRes = vesaCreateResources; - sisc->backend_funcs.preserve = vesaPreserve; - sisc->backend_funcs.restore = vesaRestore; - sisc->backend_funcs.dpms = vesaDPMS; - sisc->backend_funcs.enable = vesaEnable; - sisc->backend_funcs.disable = vesaDisable; - sisc->backend_funcs.getColors = vesaGetColors; - sisc->backend_funcs.putColors = vesaPutColors; - } -#endif - - if (!initialized || !SiSMapReg(card, sisc)) { - xfree(sisc); - return FALSE; - } - - card->driver = sisc; - - return TRUE; -} - -static void -SiSCardFini(KdCardInfo *card) -{ - SiSCardInfo *sisc = (SiSCardInfo *)card->driver; - - SiSUnmapReg(card, sisc); - sisc->backend_funcs.cardfini(card); -} - -static Bool -SiSScreenInit(KdScreenInfo *screen) -{ - SiSScreenInfo *siss; - SiSCardInfo(screen); - int success = FALSE; - - siss = xcalloc(sizeof(SiSScreenInfo), 1); - if (siss == NULL) - return FALSE; - - siss->sisc = sisc; - - screen->driver = siss; - -#ifdef KDRIVEFBDEV - if (sisc->use_fbdev) { - success = fbdevScreenInitialize(screen, - &siss->backend_priv.fbdev); - screen->memory_size = sisc->backend_priv.fbdev.fix.smem_len; - screen->off_screen_base = - sisc->backend_priv.fbdev.var.yres_virtual * - screen->fb[0].byteStride; - } -#endif -#ifdef KDRIVEVESA - if (sisc->use_vesa) { - if (screen->fb[0].depth == 0) - screen->fb[0].depth = 16; - success = vesaScreenInitialize(screen, - &siss->backend_priv.vesa); - } -#endif - if (!success) { - screen->driver = NULL; - xfree(siss); - return FALSE; - } - - return TRUE; -} - -static void -SiSScreenFini(KdScreenInfo *screen) -{ - SiSScreenInfo *siss = (SiSScreenInfo *)screen->driver; - SiSCardInfo *sisc = screen->card->driver; - - sisc->backend_funcs.scrfini(screen); - xfree(siss); - screen->driver = 0; -} - -Bool -SiSMapReg(KdCardInfo *card, SiSCardInfo *sisc) -{ - sisc->reg_base = (CARD8 *)KdMapDevice(SIS_REG_BASE(card), - SIS_REG_SIZE(card)); - - if (sisc->reg_base == NULL) - return FALSE; - - KdSetMappedMode(SIS_REG_BASE(card), SIS_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - - return TRUE; -} - -void -SiSUnmapReg(KdCardInfo *card, SiSCardInfo *sisc) -{ - if (sisc->reg_base) { - KdResetMappedMode(SIS_REG_BASE(card), SIS_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice((void *)sisc->reg_base, SIS_REG_SIZE(card)); - sisc->reg_base = 0; - } -} - -static Bool -SiSInitScreen(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - return sisc->backend_funcs.initScreen(pScreen); -} - -static Bool -SiSFinishInitScreen(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - return sisc->backend_funcs.finishInitScreen(pScreen); -} - -static Bool -SiSCreateResources(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - return sisc->backend_funcs.createRes(pScreen); -} - -static void -SiSPreserve(KdCardInfo *card) -{ - SiSCardInfo *sisc = card->driver; - - sisc->backend_funcs.preserve(card); -} - -static void -SiSRestore(KdCardInfo *card) -{ - SiSCardInfo *sisc = card->driver; - - SiSUnmapReg(card, sisc); - - sisc->backend_funcs.restore(card); -} - -static Bool -SiSDPMS(ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - return sisc->backend_funcs.dpms(pScreen, mode); -} - -static Bool -SiSEnable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - if (!sisc->backend_funcs.enable(pScreen)) - return FALSE; - - if ((sisc->reg_base == NULL) && !SiSMapReg(pScreenPriv->screen->card, - sisc)) - return FALSE; - - SiSDPMS(pScreen, KD_DPMS_NORMAL); - - return TRUE; -} - -static void -SiSDisable(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - SiSUnmapReg(pScreenPriv->card, sisc); - - sisc->backend_funcs.disable(pScreen); -} - -static void -SiSGetColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - sisc->backend_funcs.getColors(pScreen, fb, n, pdefs); -} - -static void -SiSPutColors(ScreenPtr pScreen, int fb, int n, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - SiSCardInfo(pScreenPriv); - - sisc->backend_funcs.putColors(pScreen, fb, n, pdefs); -} - -KdCardFuncs SiSFuncs = { - SiSCardInit, /* cardinit */ - SiSScreenInit, /* scrinit */ - SiSInitScreen, /* initScreen */ - SiSFinishInitScreen, /* finishInitScreen */ - SiSCreateResources, /* createRes */ - SiSPreserve, /* preserve */ - SiSEnable, /* enable */ - SiSDPMS, /* dpms */ - SiSDisable, /* disable */ - SiSRestore, /* restore */ - SiSScreenFini, /* scrfini */ - SiSCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - SiSDrawInit, /* initAccel */ - SiSDrawEnable, /* enableAccel */ - SiSDrawSync, /* syncAccel */ - SiSDrawDisable, /* disableAccel */ - SiSDrawFini, /* finiAccel */ - - SiSGetColors, /* getColors */ - SiSPutColors, /* putColors */ -}; diff --git a/hw/kdrive/sis300/sis.h b/hw/kdrive/sis300/sis.h deleted file mode 100644 index 25d55be31..000000000 --- a/hw/kdrive/sis300/sis.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 _SIS_H_ -#define _SIS_H_ - -#include "kdrive-config.h" - -#ifdef KDRIVEFBDEV -#include <fbdev.h> -#endif -#ifdef KDRIVEVESA -#include <vesa.h> -#endif - -/* XXX */ -#define SIS_REG_BASE(c) ((c)->attr.address[1]) -#define SIS_REG_SIZE(c) (0x10000) - -#ifdef __powerpc__ - -static __inline__ void -MMIO_OUT32(__volatile__ void *base, const unsigned long offset, - const unsigned int val) -{ - __asm__ __volatile__( - "stwbrx %1,%2,%3\n\t" - "eieio" - : "=m" (*((volatile unsigned char *)base+offset)) - : "r" (val), "b" (base), "r" (offset)); -} - -static __inline__ CARD32 -MMIO_IN32(__volatile__ void *base, const unsigned long offset) -{ - register unsigned int val; - __asm__ __volatile__( - "lwbrx %0,%1,%2\n\t" - "eieio" - : "=r" (val) - : "b" (base), "r" (offset), - "m" (*((volatile unsigned char *)base+offset))); - return val; -} - -#else - -#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v)) -#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a))) - -#endif - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -struct pci_id_entry { - CARD16 vendor; - CARD16 device; - CARD8 caps; - char *name; -}; - -struct backend_funcs { - void (*cardfini)(KdCardInfo *); - void (*scrfini)(KdScreenInfo *); - Bool (*initScreen)(ScreenPtr); - Bool (*finishInitScreen)(ScreenPtr pScreen); - Bool (*createRes)(ScreenPtr); - void (*preserve)(KdCardInfo *); - void (*restore)(KdCardInfo *); - Bool (*dpms)(ScreenPtr, int); - Bool (*enable)(ScreenPtr); - void (*disable)(ScreenPtr); - void (*getColors)(ScreenPtr, int, int, xColorItem *); - void (*putColors)(ScreenPtr, int, int, xColorItem *); -}; - -typedef struct _SiSCardInfo { - union { -#ifdef KDRIVEFBDEV - FbdevPriv fbdev; -#endif -#ifdef KDRIVEVESA - VesaCardPrivRec vesa; -#endif - } backend_priv; - struct backend_funcs backend_funcs; - - struct pci_id_entry *pci_id; - CARD8 *reg_base; - Bool use_fbdev, use_vesa; -} SiSCardInfo; - -#define getSiSCardInfo(kd) ((SiSCardInfo *) ((kd)->card->driver)) -#define SiSCardInfo(kd) SiSCardInfo *sisc = getSiSCardInfo(kd) - -typedef struct _SiSScreenInfo { - union { -#ifdef KDRIVEFBDEV - FbdevScrPriv fbdev; -#endif -#ifdef KDRIVEVESA - VesaScreenPrivRec vesa; -#endif - } backend_priv; - CARD32 depthSet; /* depth value for REG_BLT_SRCPITCH */ - KaaScreenInfoRec kaa; - SiSCardInfo *sisc; -} SiSScreenInfo; - -#define getSiSScreenInfo(kd) ((SiSScreenInfo *) ((kd)->screen->driver)) -#define SiSScreenInfo(kd) SiSScreenInfo *siss = getSiSScreenInfo(kd) - -Bool -SiSMapReg(KdCardInfo *card, SiSCardInfo *sisc); - -void -SiSUnmapReg(KdCardInfo *card, SiSCardInfo *sisc); - -Bool -SiSDrawSetup(ScreenPtr pScreen); - -Bool -SiSDrawInit(ScreenPtr pScreen); - -void -SiSDrawEnable(ScreenPtr pScreen); - -void -SiSDrawSync(ScreenPtr pScreen); - -void -SiSDrawDisable(ScreenPtr pScreen); - -void -SiSDrawFini(ScreenPtr pScreen); - -extern KdCardFuncs SiSFuncs; - -#endif /* _SIS_H_ */ diff --git a/hw/kdrive/sis300/sis_draw.c b/hw/kdrive/sis300/sis_draw.c deleted file mode 100644 index bbc905e1d..000000000 --- a/hw/kdrive/sis300/sis_draw.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT 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 <sys/io.h> - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include "sis.h" -#include "sis_reg.h" - -#if 0 -#define SIS_FALLBACK(x) \ -do { \ - ErrorF x; \ - return FALSE; \ -} while (0) -#else -#define SIS_FALLBACK(x) return FALSE -#endif - -CARD8 SiSSolidRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -CARD8 SiSBltRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -int copydx, copydy; -int fifo_size; -SiSScreenInfo *accel_siss; -char *mmio; -CARD32 sis_color = 0; -CARD32 blitCmd; - -static void -SiSWaitAvailMMIO(int n) -{ - while (fifo_size < n) { - fifo_size = MMIO_IN32(mmio, REG_CommandQueue) & MASK_QueueLen; - } - fifo_size -= n; -} - -static void -SiSWaitIdle(void) -{ - CARD32 engineState; - do { - engineState = MMIO_IN32(mmio, REG_CommandQueue); - } while ((engineState & SiS_EngIdle) != SiS_EngIdle); -} - -static Bool -SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel pm, Pixel fg) -{ - KdScreenPriv(pPixmap->drawable.pScreen); - SiSScreenInfo(pScreenPriv); - SiSCardInfo(pScreenPriv); - - /* No acceleration for other formats (yet) */ - if (pPixmap->drawable.bitsPerPixel != - pScreenPriv->screen->fb[0].bitsPerPixel) - return FALSE; - - if ((pm & 0x00ffffff) != 0x00ffffff) /* XXX */ - SIS_FALLBACK(("Unsupported planemask 0x%x\n", pm)); - - accel_siss = siss; - mmio = sisc->reg_base; - - SiSWaitAvailMMIO(4); - MMIO_OUT32(mmio, REG_BLT_PATFG, fg); - MMIO_OUT32(mmio, REG_BLT_DSTRECT, (-1 << 16) | pPixmap->devKind); - MMIO_OUT32(mmio, REG_BLT_SRCPITCH, siss->depthSet); - MMIO_OUT32(mmio, REG_BLT_DSTBASE, ((CARD8 *)pPixmap->devPrivate.ptr - - pScreenPriv->screen->memory_base)); - - blitCmd = BLT_CMD_BITBLT | BLT_PAT_FG | BLT_X_INC | BLT_Y_INC | - BLT_NOCLIP | (SiSSolidRop[alu] << 8); - - return TRUE; -} - -static void -SiSSolid(int x1, int y1, int x2, int y2) -{ - SiSWaitAvailMMIO(3); - MMIO_OUT32(mmio, REG_BLT_DSTXY, (x1 << 16) | y1); - MMIO_OUT32(mmio, REG_BLT_H_W, ((y2 - y1) << 16) | (x2 - x1)); - MMIO_OUT32(mmio, REG_BLT_CMD, blitCmd); -} - -static void -SiSDoneSolid(void) -{ -} - -static Bool -SiSPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, - Pixel pm) -{ - KdScreenPriv(pDst->drawable.pScreen); - SiSScreenInfo(pScreenPriv); - SiSCardInfo(pScreenPriv); - - /* No acceleration for other formats (yet) */ - if (pDst->drawable.bitsPerPixel != - pScreenPriv->screen->fb[0].bitsPerPixel) - return FALSE; - - if ((pm & 0x00ffffff) != 0x00ffffff) /* XXX */ - SIS_FALLBACK(("Unsupported pixel mask 0x%x\n", pm)); - - accel_siss = siss; - mmio = sisc->reg_base; - - SiSWaitAvailMMIO(4); - MMIO_OUT32(mmio, REG_BLT_SRCPITCH, siss->depthSet | pSrc->devKind); - MMIO_OUT32(mmio, REG_BLT_DSTRECT, (-1 << 16) | pDst->devKind); - MMIO_OUT32(mmio, REG_BLT_SRCBASE, ((CARD8 *)pSrc->devPrivate.ptr - - pScreenPriv->screen->memory_base)); - MMIO_OUT32(mmio, REG_BLT_DSTBASE, ((CARD8 *)pDst->devPrivate.ptr - - pScreenPriv->screen->memory_base)); - - blitCmd = BLT_CMD_BITBLT | BLT_PAT_FG | BLT_NOCLIP | - (SiSBltRop[alu] << 8); - - if (pSrc != pDst || dx >= 0) - blitCmd |= BLT_X_INC; - if (pSrc != pDst || dy >= 0) - blitCmd |= BLT_Y_INC; - - return TRUE; -} - -static void -SiSCopy(int srcX, int srcY, int dstX, int dstY, int w, int h) -{ - if (!(blitCmd & BLT_X_INC)) { - srcX += w - 1; - dstX += w - 1; - } - - if (!(blitCmd & BLT_Y_INC)) { - srcY += h - 1; - dstY += h - 1; - } - - SiSWaitAvailMMIO(4); - MMIO_OUT32(mmio, REG_BLT_H_W, (h << 16) | w); - MMIO_OUT32(mmio, REG_BLT_SRCXY, (srcX << 16) | srcY); - MMIO_OUT32(mmio, REG_BLT_DSTXY, (dstX << 16) | dstY); - MMIO_OUT32(mmio, REG_BLT_CMD, blitCmd); -} - -static void -SiSDoneCopy(void) -{ -} - -KaaScreenInfoRec SiSKaa = { - SiSPrepareSolid, - SiSSolid, - SiSDoneSolid, - SiSPrepareCopy, - SiSCopy, - SiSDoneCopy, - KAA_OFFSCREEN_PIXMAPS, - 8, - 8 -}; - -#define USE_TURBOQUEUE 0 - -Bool -SiSDrawInit(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSScreenInfo(pScreenPriv); - CARD8 tmp; -#if USE_TURBOQUEUE - int tqsize; -#endif - - switch (pScreenPriv->screen->fb[0].depth) - { - case 8: - siss->depthSet = 0x00000000; - break; - case 15: - siss->depthSet = 0x40000000; - break; - case 16: - siss->depthSet = 0x80000000; - break; - case 24: - if (pScreenPriv->screen->fb[0].bitsPerPixel == 32) { - siss->depthSet = 0xc0000000; - break; - } - /* FALLTHROUGH*/ - default: - ErrorF("Unsupported depth/bpp %d/%d\n", - pScreenPriv->screen->fb[0].depth, - pScreenPriv->screen->fb[0].bitsPerPixel); - return FALSE; - } - - outb(0x05, 0x3c4); - outb(0x86, 0x3c5); /* unlock registers */ - - outb(0x20, 0x3c4); - outb(0xA1, 0x3c5); /* enable pci linear addressing, MMIO, PCI_IO */ - - outb(0x1e, 0x3c4); - tmp = inb(0x3c5); - outb(tmp | 0x42 | 0x18, 0x3c5); /* Enable 2d and 3d */ - -#if USE_TURBOQUEUE - tqsize = (pScreenPriv->screen->memory_size / 1024) / 64 - 8; - /* Enable TQ */ - outb(0x26, 0x3c4); - outb(tqsize & 0xff, 0x3c5); - outb(0x27, 0x3c4); - tmp = inb(0x3c5); - outb(((tqsize >> 8) & 0x03) | (tmp & 0x0c) | 0xF0, 0x3c5); - - /* XXX: Adjust offscreen size to avoid TQ area (last 512k) */ -#endif - - ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth, - pScreenPriv->screen->fb[0].bitsPerPixel); - - if (!kaaDrawInit(pScreen, &SiSKaa)) - return FALSE; - - return TRUE; -} - -void -SiSDrawEnable(ScreenPtr pScreen) -{ - KdMarkSync(pScreen); -} - -void -SiSDrawDisable(ScreenPtr pScreen) -{ -} - -void -SiSDrawFini(ScreenPtr pScreen) -{ - kaaDrawFini (pScreen); -} - -void -SiSDrawSync(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SiSScreenInfo(pScreenPriv); - SiSCardInfo(pScreenPriv); - - accel_siss = siss; - mmio = sisc->reg_base; - - SiSWaitIdle(); -} diff --git a/hw/kdrive/sis300/sis_reg.h b/hw/kdrive/sis300/sis_reg.h deleted file mode 100644 index 6e5a8f6d5..000000000 --- a/hw/kdrive/sis300/sis_reg.h +++ /dev/null @@ -1,902 +0,0 @@ -/************************************************************************** - -Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. -Copyright 2003 Eric Anholt -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, sub license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL -ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP 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. - -**************************************************************************/ - -/* - * Authors: - * Sung-Ching Lin <sclin@sis.com.tw> - * Eric Anholt <anholt@FreeBSD.org> - */ - -#ifndef _sis_reg_h_ -#define _sis_reg_h_ - -/* - * Define All the Register Address of 6327 - */ - -#define REG_BLT_SRCBASE 0x8200 -#define REG_BLT_SRCPITCH 0x8204 -#define REG_BLT_SRCXY 0x8208 -#define REG_BLT_DSTXY 0x820c -#define REG_BLT_DSTBASE 0x8210 -#define REG_BLT_DSTRECT 0x8214 -#define REG_BLT_H_W 0x8218 -#define REG_BLT_PATFG 0x821c -#define REG_BLT_PATBG 0x8220 -#define REG_BLT_SRCFG 0x8224 -#define REG_BLT_SRCBG 0x8228 -#define REG_BLT_MONOPAT0 0x822c -#define REG_BLT_MONOPAT1 0x8230 -#define REG_BLT_CLIPLT 0x8234 -#define REG_BLT_CLIBRB 0x8238 -#define REG_BLT_CMD 0x823c -#define REG_CommandQueue 0x8240 - -#define REG_3D_TSFSa 0x8800 -#define REG_3D_TSZa 0x8804 -#define REG_3D_TSXa 0x8808 -#define REG_3D_TSYa 0x880C -#define REG_3D_TSARGBa 0x8810 -#define REG_3D_TSWGa 0x8814 -#define REG_3D_TSUAa 0x8818 -#define REG_3D_TSVAa 0x881C -#define REG_3D_TSUBa 0x8820 -#define REG_3D_TSVBa 0x8824 -#define REG_3D_TSUCa 0x8828 -#define REG_3D_TSVCa 0x882C - -#define REG_3D_TSFSb 0x8830 -#define REG_3D_TSZb 0x8834 -#define REG_3D_TSXb 0x8838 -#define REG_3D_TSYb 0x883C -#define REG_3D_TSARGBb 0x8840 -#define REG_3D_TSWGb 0x8844 -#define REG_3D_TSUAb 0x8848 -#define REG_3D_TSVAb 0x884C -#define REG_3D_TSUBb 0x8850 -#define REG_3D_TSVBb 0x8854 -#define REG_3D_TSUCb 0x8858 -#define REG_3D_TSVCb 0x885C - -#define REG_3D_TSFSc 0x8860 -#define REG_3D_TSZc 0x8864 -#define REG_3D_TSXc 0x8868 -#define REG_3D_TSYc 0x886C -#define REG_3D_TSARGBc 0x8870 -#define REG_3D_TSWGc 0x8874 -#define REG_3D_TSUAc 0x8878 -#define REG_3D_TSVAc 0x887C -#define REG_3D_TSUBc 0x8880 -#define REG_3D_TSVBc 0x8884 -#define REG_3D_TSUCc 0x8888 -#define REG_3D_TSVCc 0x888C - -/* - * REG_3D_AGPCmdSetting (89e4h-89f7) - */ -#define REG_3D_AGPCmBase 0x89E4 -#define REG_3D_AGPRmDwNum 0x89E8 -#define REG_3D_AGPTtDwNum 0x89EC -#define REG_3D_AGPCmFire 0x89F0 - -#define REG_3D_ParsingSet 0x89F4 -#define REG_3D_PrimitiveSet 0x89F8 -#define REG_3D_ShadeMode 0x89F8 -#define REG_3D_EngineFire 0x89FC -#define REG_3D_EngineStatus 0x89FC -#define REG_3D_TEnable 0x8A00 -#define REG_3D_TEnable2 0x8A04 - -#define REG_3D_ZSet 0x8A08 -#define REG_3D_ZBias 0x8A0C -#define REG_3D_ZStWriteMask 0x8A10 - -#define REG_3D_ZAddress 0x8A14 -#define REG_3D_AlphaSet 0x8A18 -#define REG_3D_AlphaAddress 0x8A1C -#define REG_3D_DstSet 0x8A20 -#define REG_3D_DstAlphaWriteMask 0x8A24 - -#define REG_3D_DstAddress 0x8A28 - -#define REG_3D_LinePattern 0x8A2C - -#define REG_3D_FogSet 0x8A30 - -#define REG_3D_FogFarDistance 0x8A34 -#define REG_3D_FogInverseDistance 0x8A38 -#define REG_3D_FogFactorDensity 0x8A3C - -#define REG_3D_StencilSet 0x8A44 -#define REG_3D_StencilSet2 0x8A48 -#define REG_3D_StencilAddress 0x8A4C - -#define REG_3D_DstBlendMode 0x8A50 -#define REG_3D_SrcBlendMode 0x8A50 -#define REG_3D_ClipTopBottom 0x8A54 -#define REG_3D_ClipLeftRight 0x8A58 - -#define REG_3D_Brightness 0x8A5C - -#define REG_3D_BumpMapSet 0x8A68 -#define REG_3D_BumpMapAddress 0x8A6C -#define REG_3D_BumpMapPitch 0x8A70 -#define REG_3D_BumpMapMatrix0 0x8A74 -#define REG_3D_BumpMapMatrix1 0x8A78 - -/* - * Define the Texture Register Address of 6326 - */ -#define REG_3D_TextureSet 0x8A7C -#define REG_3D_TextureWidthHeight 0x8A7C -#define REG_3D_TextureMip 0x8A80 - -#define REG_3D_TextureTransparencyColorHigh 0x8A84 -#define REG_3D_TextureTransparencyColorLow 0x8A88 -#define REG_3D_TextureBorderColor 0x8A8C -#define REG_3D_TextureAddress0 0x8A90 -#define REG_3D_TextureAddress1 0x8A94 -#define REG_3D_TextureAddress2 0x8A98 -#define REG_3D_TextureAddress3 0x8A9C -#define REG_3D_TextureAddress4 0x8AA0 -#define REG_3D_TextureAddress5 0x8AA4 -#define REG_3D_TextureAddress6 0x8AA8 -#define REG_3D_TextureAddress7 0x8AAC -#define REG_3D_TextureAddress8 0x8AB0 -#define REG_3D_TextureAddress9 0x8AB4 -#define REG_3D_TextureAddress10 0x8AB8 -#define REG_3D_TextureAddress11 0x8ABC -#define REG_3D_TexturePitch0 0x8AC0 -#define REG_3D_TexturePitch1 0x8AC0 -#define REG_3D_TexturePitch2 0x8AC4 -#define REG_3D_TexturePitch3 0x8AC4 -#define REG_3D_TexturePitch4 0x8AC8 -#define REG_3D_TexturePitch5 0x8AC8 -#define REG_3D_TexturePitch6 0x8ACC -#define REG_3D_TexturePitch7 0x8ACC -#define REG_3D_TexturePitch8 0x8AD0 -#define REG_3D_TexturePitch9 0x8AD0 -#define REG_3D_TexturePitch10 0x8AD4 - -#define REG_3D_Texture1Set 0x8ADC -#define REG_3D_Texture1WidthHeight 0x8ADC -#define REG_3D_Texture1Mip 0x8AE0 - -#define REG_3D_Texture1TransparencyColorHigh 0x8AE4 -#define REG_3D_Texture1TransparencyColorLow 0x8AE8 -#define REG_3D_Texture1BorderColor 0x8AEC -#define REG_3D_Texture1Address0 0x8AF0 -#define REG_3D_Texture1Address1 0x8AF4 -#define REG_3D_Texture1Address2 0x8AF8 -#define REG_3D_Texture1Address3 0x8AFC -#define REG_3D_Texture1Address4 0x8B00 -#define REG_3D_Texture1Address5 0x8B04 -#define REG_3D_Texture1Address6 0x8B08 -#define REG_3D_Texture1Address7 0x8B0C -#define REG_3D_Texture1Address8 0x8B10 -#define REG_3D_Texture1Address9 0x8B14 -#define REG_3D_Texture1Address10 0x8B18 -#define REG_3D_Texture1Address11 0x8B1C -#define REG_3D_Texture1Pitch0 0x8B20 -#define REG_3D_Texture1Pitch1 0x8B20 -#define REG_3D_Texture1Pitch2 0x8B24 -#define REG_3D_Texture1Pitch3 0x8B24 -#define REG_3D_Texture1Pitch4 0x8B28 -#define REG_3D_Texture1Pitch5 0x8B28 -#define REG_3D_Texture1Pitch6 0x8B2C -#define REG_3D_Texture1Pitch7 0x8B2C -#define REG_3D_Texture1Pitch8 0x8B30 -#define REG_3D_Texture1Pitch9 0x8B30 -#define REG_3D_Texture1Pitch10 0x8B34 - -#define REG_3D_TextureBlendFactor 0x8B3C -#define REG_3D_TextureColorBlendSet0 0x8B40 -#define REG_3D_TextureColorBlendSet1 0x8B44 -#define REG_3D_TextureAlphaBlendSet0 0x8B48 -#define REG_3D_TextureAlphaBlendSet1 0x8B4C -/* - * Define the End of Primitive List of 6326 - */ -#define REG_3D_EndPrimitiveList 0X8B50 - - -/* - * Define the Stipple Register Address of 6326 - */ -#define REG_3D_Stipple0 0X8B60 - -#define REG_3D_TexturePalette 0x8C00 - -/* - * REG_BLT_CMD -- (8x823c-0x823f) - */ -#define BLT_CMD_BITBLT 0x00000000 -#define BLT_CMD_COLOREXP 0x00000001 -#define BLT_CMD_ENCOLOREXP 0x00000002 -#define BLT_CMD_MULTIPLE_SCANLINE 0x00000003 -#define BLT_CMD_LINE 0x00000004 -#define BLT_CMD_TRAPAZOID_FILL 0x00000005 -#define BLT_CMD_TRANSPARENT_BITBLT 0x00000006 - -#define BLT_X_INC 0x00010000 -#define BLT_Y_INC 0x00020000 - -#define BLT_SRC_VIDEO 0x00000000 -#define BLT_SRC_SYSTEM 0x00000010 -#define BLT_SRC_CPUBLITBUF BLT_SRC_SYSTEM -#define BLT_SRC_AGP 0x00000020 - -#define BLT_PAT_FG 0x00000000 -#define BLT_PAT_PATREG 0x00000040 -#define BLT_PAT_MONO 0x00000080 - -/* Clipping flags */ -#define BLT_NOCLIP 0x00000000 -#define BLT_NOMERGECLIP 0x04000000 -#define BLT_CLIPENABLE 0x00040000 -#define BLT_CLIPWITHOUTMERGE 0x04040000 - -/* - * REG_CommandQueue -- (8240h-8243h) - */ -#define MASK_QueueLen 0x0000ffff -#define SiS_EngIdle2d 0x80000000 -#define SiS_EngIdle 0xe0000000 -#define MASK_EngState 0xf0000000 - -/* - * REG_3D_ParsingSet -- Define Parsing Mask (89F4h-89F7h) - */ -#define MASK_VertexDWSize 0xF0000000 -#define MASK_VertexDataFormat 0x0FFF0000 -#define MASK_PsVertex_HAS_RHW 0x08000000 -#define MASK_PsVertex_HAS_NORMALXYZ 0x04000000 -#define MASK_PsVertex_HAS_DIFFUSE 0x02000000 -#define MASK_PsVertex_HAS_SPECULAR 0x01000000 -#define MASK_PsUVSet 0x00FF0000 -#define MASK_PsVertex_HAS_1SetUV 0x00800000 -#define MASK_PsVertex_HAS_2SetUV 0x00C00000 -#define MASK_PsVertex_HAS_3SetUV 0x00E00000 -#define MASK_PsVertex_HAS_UVSet1 0x00800000 -#define MASK_PsVertex_HAS_UVSet2 0x00400000 -#define MASK_PsVertex_HAS_UVSet3 0x00200000 -#define MASK_PsCullDirection_CCW 0x00008000 -#define MASK_PsShadingMode 0x00007000 -/* XXX Shading modes just a guess, but seem to work*/ -#define MASK_PsShadingFlatA 0x00001000 -#define MASK_PsShadingFlatB 0x00002000 -#define MASK_PsShadingFlatC 0x00003000 -#define MASK_PsShadingSmooth 0x00004000 -#define MASK_PsTextureFrom 0x000003F0 -#define MASK_PsTexture0FromA 0x00000000 -#define MASK_PsTexture1FromA 0x00000000 -#define MASK_PsTexture1FromB 0x00000040 -#define MASK_PsBumpTextureFromA 0x00000000 -#define MASK_PsBumpTextureFromB 0x00000010 -#define MASK_PsBumpTextureFromC 0x00000020 -#define MASK_PsDataType 0x0000000F -#define MASK_PsPointList 0x00000000 -#define MASK_PsLineList 0x00000004 -#define MASK_PsLineStrip 0x00000005 -#define MASK_PsTriangleList 0x00000008 -#define MASK_PsTriangleStrip 0x00000009 -#define MASK_PsTriangleFan 0x0000000A - -/* - * REG_3D_PrimitiveSet -- Define Fire Primitive Mask (89F8h-89FBh) - */ -#define MASK_DrawPrimitiveCommand 0x00000007 -#define MASK_SetFirePosition 0x00001F00 -#define MASK_BumpTextureFrom 0x00030000 -#define MASK_Texture1From 0x000C0000 -#define MASK_Texture0From 0x00300000 -#define MASK_ShadingMode 0x07000000 -#define MASK_CullDirection 0x08000000 - -#define OP_3D_POINT_DRAW 0x00000000 -#define OP_3D_LINE_DRAW 0x00000001 -#define OP_3D_TRIANGLE_DRAW 0x00000002 - -#define OP_3D_DIRECTION_RIGHT 0x00000000 -#define OP_3D_DIRECTION_LEFT 0x00000100 -#define OP_3D_DIRECTION_HORIZONTAL 0x00000000 -#define OP_3D_DIRECTION_VERTICAL 0x00000100 - -#define OP_3D_FIRE_TFIRE 0x00000000 -#define OP_3D_FIRE_TSARGBa 0x00000100 -#define OP_3D_FIRE_TSWa 0x00000200 -#define OP_3D_FIRE_TSVAa 0x00000300 -#define OP_3D_FIRE_TSVBa 0x00000400 -#define OP_3D_FIRE_TSVCa 0x00000500 - -#define OP_3D_FIRE_TSARGBb 0x00000900 -#define OP_3D_FIRE_TSWb 0x00000a00 -#define OP_3D_FIRE_TSVAb 0x00000b00 -#define OP_3D_FIRE_TSVBb 0x00000c00 -#define OP_3D_FIRE_TSVCb 0x00000d00 - -#define OP_3D_FIRE_TSARGBc 0x00001100 -#define OP_3D_FIRE_TSWc 0x00001200 -#define OP_3D_FIRE_TSVAc 0x00001300 -#define OP_3D_FIRE_TSVBc 0x00001400 -#define OP_3D_FIRE_TSVCc 0x00001500 - -#define OP_3D_Texture0FromA 0x00000000 -#define OP_3D_Texture0FromB 0x00100000 -#define OP_3D_Texture0FromC 0x00200000 -#define OP_3D_Texture1FromA 0x00000000 -#define OP_3D_Texture1FromB 0x00040000 -#define OP_3D_Texture1FromC 0x00080000 -#define OP_3D_TextureBumpFromA 0x00000000 -#define OP_3D_TextureBumpFromB 0x00010000 -#define OP_3D_TextureBumpFromC 0x00020000 - -#define OP_3D_CullDirection_CCW 0x08000000 - -#define SHADE_FLAT_VertexA 0x01000000 -#define SHADE_FLAT_VertexB 0x02000000 -#define SHADE_FLAT_VertexC 0x03000000 -#define SHADE_GOURAUD 0x04000000 - -/* - * Define Command Queue Length Mask (89FCh-89FF) - */ -#define MASK_CmdQueueLen 0x0FFF0000 - -/* - * REG_3D_TEnable -- Define Capility Enable Mask (8A00h-8A03h) - */ -#define MASK_DitherEnable 0x00000001 -#define MASK_BlendEnable 0x00000002 -#define MASK_FogTestEnable 0x00000004 -#define MASK_FogEnable 0x00000008 -#define MASK_SpecularEnable 0x00000010 -#define MASK_FogPerspectiveEnable 0x00000020 -#define MASK_TextureCacheClear 0x00000040 -#define MASK_TextureCacheEnable 0x00000080 -#define MASK_BumpMapEnable 0x00000100 -#define MASK_TexturePerspectiveEnable 0x00000200 -#define MASK_TextureEnable 0x00000400 -#define MASK_CullEnable 0x00000800 -#define MASK_TextureNumUsed 0x0000F000 -#define MASK_AlphaBufferEnable 0x00010000 -#define MASK_AlphaTestEnable 0x00020000 -#define MASK_AlphaWriteEnable 0x00040000 -#define MASK_ZTestEnable 0x00080000 -#define MASK_ZWriteEnable 0x00100000 -#define MASK_StencilBufferEnable 0x00200000 -#define MASK_StencilTestEnable 0x00400000 -#define MASK_StencilWriteEnable 0x00800000 -#define MASK_Texture0TransparencyEnable 0x01000000 -#define MASK_Texture1TransparencyEnable 0x02000000 -#define MASK_TextureAWrapUCorrection 0x04000000 -#define MASK_TextureAWrapVCorrection 0x08000000 -#define MASK_TextureBWrapUCorrection 0x10000000 -#define MASK_TextureBWrapVCorrection 0x20000000 -#define MASK_TextureCWrapUCorrection 0x40000000 -#define MASK_TextureCWrapVCorrection 0x80000000 - -/* - * REG_3D_TEnable2 -- Define Capility Enable Mask2 (8A04h-8A07h) - */ -#define MASK_Texture0BlockTextureEnable 0x00000001 -#define MASK_Texture1BlockTextureEnable 0x00000002 -#define MASK_Texture0AnisotropicEnable 0x00000010 -#define MASK_Texture1AnisotropicEnable 0x00000020 -#define MASK_TextureMipmapBiasEnable 0x00000040 -#define MASK_LinePatternEnable 0x00000100 -#define MASK_StippleAlphaEnable 0x00000200 -#define MASK_StippleEnable 0x00000400 -#define MASK_AntiAliasEnable 0x00000800 -#define MASK_ZMaskWriteEnable 0x00001000 -#define MASK_StencilMaskWriteEnable 0x00002000 -#define MASK_AlphaMaskWriteEnable 0x00004000 -#define MASK_ColorMaskWriteEnable 0x00008000 -#define MASK_ZCacheClear 0x00010000 -#define MASK_ZCacheEnable 0x00020000 -#define MASK_StencilCacheClear 0x00040000 -#define MASK_StencilCacheEnable 0x00080000 -#define MASK_AlphaCacheClear 0x00100000 -#define MASK_AlphaCacheEnable 0x00200000 -#define MASK_ColorCacheClear 0x00400000 -#define MASK_ColorCacheEnable 0x00800000 - -/* - * REG_3D_ZSet -- Define Z Buffer Setting Mask (8A08h-8A0Bh) - */ -#define MASK_ZBufferPitch 0x00000FFF -#define MASK_ZTestMode 0x00070000 -#define MASK_ZBufferInSystem 0x00080000 -#define MASK_ZBufferFormat 0x01F00000 - -#define SiS_Z_COMP_NEVER 0x00000000 -#define SiS_Z_COMP_S_LT_B 0x00010000 -#define SiS_Z_COMP_S_EQ_B 0x00020000 -#define SiS_Z_COMP_S_LE_B 0x00030000 -#define SiS_Z_COMP_S_GT_B 0x00040000 -#define SiS_Z_COMP_S_NE_B 0x00050000 -#define SiS_Z_COMP_S_GE_B 0x00060000 -#define SiS_Z_COMP_ALWAYS 0x00070000 - -#define SiS_ZFORMAT_Z16 0x00000000 -#define SiS_ZFORMAT_Z16_INT 0x00100000 -#define SiS_ZFORMAT_S1Z15 0x00400000 -#define SiS_ZFORMAT_S1Z15_INT 0x00500000 -#define SiS_ZFORMAT_Z32 0x00800000 -#define SiS_ZFORMAT_S1Z31 0x00C00000 -#define SiS_ZFORMAT_S2Z30 0x00D00000 -#define SiS_ZFORMAT_S4Z28 0x00E00000 -#define SiS_ZFORMAT_S8Z24 0x00F00000 -#define SiS_ZFORMAT_FZ30 0x01800000 -#define SiS_ZFORMAT_FS1Z30 0x01C00000 -#define SiS_ZFORMAT_FS2Z30 0x01D00000 - -/* - * REG_3D_ZBias -- Define Z Buffer Setting Mask (8A0Ch-8A0Fh) - */ -#define MASK_ZBias 0xFFFFFFFF - -/* - * REG_3D_ZStWriteMask -- Define Z and Stencil Buffer Mask (8A10h-8A13h) - */ -#define MASK_ZWriteMask 0x00FFFFFF - -/* - * REG_3D_ZAddress -- Define Z Buffer Base Address(8A14h-8A17h) - */ -#define MASK_ZAddress 0xFFFFFFFF - -/* - * REG_3D_AlphaSet -- Define Alpha Buffer Setting Mask (8A18h-8A1Bh) - */ -#define MASK_AlphaBufferPitch 0x000003FF -#define MASK_AlphaRefValue 0x00FF0000 -#define MASK_AlphaTestMode 0x07000000 -#define MASK_AlphaBufferInSystem 0x08000000 -#define MASK_AlphaBufferFormat 0x30000000 - -#define SiS_ALPHA_NEVER 0x00000000 -#define SiS_ALPHA_LESS 0x01000000 -#define SiS_ALPHA_EQUAL 0x02000000 -#define SiS_ALPHA_LEQUAL 0x03000000 -#define SiS_ALPHA_GREATER 0x04000000 -#define SiS_ALPHA_NOTEQUAL 0x05000000 -#define SiS_ALPHA_GEQUAL 0x06000000 -#define SiS_ALPHA_ALWAYS 0x07000000 - -/* - * REG_3D_AlphaAddress -- Define Alpha Buffer Base Address(8A1Ch-8A1Fh) - */ -#define MASK_AlphaAddress 0xFFFFFFFF - -/* - * REG_3D_DstSet -- Define Destination Buffer Setting Mask (8A20h-8A23h) - */ -#define MASK_DstBufferPitch 0x00000FFF -#define MASK_DstBufferFormat 0x000F0000 -#define MASK_DstBufferBitDepth 0x00300000 -#define MASK_DstBufferRgbOrder 0x00400000 -#define MASK_DstBufferInSystem 0x00800000 -#define MASK_Dst7BitFormat 0x007F0000 -#define MASK_ROP2 0x0F000000 - -#define DST_FORMAT_RGB_555 0x00100000 -#define DST_FORMAT_RGB_565 0x00110000 -#define DST_FORMAT_ARGB_1555 0x00120000 -#define DST_FORMAT_ARGB_4444 0x00130000 -#define DST_FORMAT_ARGB_1888 0x00300000 -#define DST_FORMAT_ARGB_2888 0x00310000 -#define DST_FORMAT_ARGB_4888 0x00320000 -#define DST_FORMAT_ARGB_8888 0x00330000 -#define DST_FORMAT_ARGB_0888 0x00340000 - -#define DST_FORMAT_BGR_555 0x00500000 -#define DST_FORMAT_BGR_565 0x00510000 -#define DST_FORMAT_ABGR_1555 0x00520000 -#define DST_FORMAT_ABGR_4444 0x00530000 -#define DST_FORMAT_ABGR_1888 0x00700000 -#define DST_FORMAT_ABGR_2888 0x00710000 -#define DST_FORMAT_ABGR_4888 0x00720000 -#define DST_FORMAT_ABGR_8888 0x00730000 -#define DST_FORMAT_ABGR_0888 0x00740000 - -#define LOP_CLEAR 0x00000000 -#define LOP_NOR 0x01000000 -#define LOP_AND_INVERTED 0x02000000 -#define LOP_COPY_INVERTED 0x03000000 -#define LOP_AND_REVERSE 0x04000000 -#define LOP_INVERT 0x05000000 -#define LOP_XOR 0x06000000 -#define LOP_NAND 0x07000000 -#define LOP_AND 0x08000000 -#define LOP_EQUIV 0x09000000 -#define LOP_NOOP 0x0a000000 -#define LOP_OR_INVERTED 0x0b000000 -#define LOP_COPY 0x0c000000 -#define LOP_OR_REVERSE 0x0d000000 -#define LOP_OR 0x0e000000 -#define LOP_SET 0x0f000000 - -/* - * REG_3D_DstAlphaWriteMask -- Define Destination/Alpha Buffer Write Mask (8A24h-8A27h) - */ -#define MASK_ColorWriteMask 0x00FFFFFF -#define MASK_AlphaWriteMask 0xFF000000 - -/* - * REG_3D_DstAddress -- Define Destination Buffer Base Address(8A1Ch-8A1Fh) - */ -#define MASK_DstAddress 0xFFFFFFFF - -/* - * REG_3D_LinePattern -- Define Line Pattern (8A2Ch-8A2Fh) - */ -#define MASK_LinePatternRepeatFactor 0x00007FFF -#define MASK_LinePatternLastPixelFlag 0x00008000 -#define MASK_LinePattern 0xFFFF0000 - -/* - * REG_3D_FogSet -- Define Fog Mask (8A30h-8A33h) - */ -#define MASK_FogColor 0x00FFFFFF -#define MASK_FogMode 0x07000000 -#define MASK_FogZLookup 0x08000000 - -#define FOGMODE_CHEAP 0x04000000 -#define FOGMODE_LINEAR 0x05000000 -#define FOGMODE_EXP 0x06000000 -#define FOGMODE_EXP2 0x07000000 - -/* - * REG_3D_FogStartEnd -- Define Fog Start End Setting (0x8A34 - 0x8A37) - */ -#define MASK_FogFarDistance 0x0007FFFF - -/* - * REG_3D_FogStartEnd -- Define Fog End Setting (0x8A38 - 0x8A3B) - */ -#define MASK_FogInvFarDistance 0x0007FFFF - -/* - * REG_3D_FogFactorDensity (0x8A3C - 0x8A3F) - */ -#define MASK_FogDensity 0x0003FFFF -#define MASK_FogFactor 0xFF000000 - -/* - * REG_3D_StencilSet -- Define stencil test (8A44h-8A47h) - */ -#define MASK_StencilValueMask 0x000000ff -#define MASK_StencilRefMask 0x0000ff00 -#define MASK_StencilTestMode 0x07000000 -#define MASK_StencilBufferInSystem 0x08000000 -#define MASK_StencilFormat 0x30000000 - -#define SiS_STENCIL_NEVER 0x00000000 -#define SiS_STENCIL_LESS 0x01000000 -#define SiS_STENCIL_EQUAL 0x02000000 -#define SiS_STENCIL_LEQUAL 0x03000000 -#define SiS_STENCIL_GREATER 0x04000000 -#define SiS_STENCIL_NOTEQUAL 0x05000000 -#define SiS_STENCIL_GEQUAL 0x06000000 -#define SiS_STENCIL_ALWAYS 0x07000000 - -#define STENCIL_FORMAT_1 0x00000000 -#define STENCIL_FORMAT_2 0x10000000 -#define STENCIL_FORMAT_4 0x20000000 -#define STENCIL_FORMAT_8 0x30000000 - -/* - * REG_3D_StencilSet2 -- Define stencil test (8A4h-8A47h) - */ -#define MASK_StencilBufferPitch 0x00000FFF -#define MASK_StencilZPassOp 0x00007000 -#define MASK_StencilZFailOp 0x00070000 -#define MASK_StencilFailOp 0x00700000 -#define MASK_StencilWriteMask 0xFF000000 - -#define SiS_SFAIL_KEEP 0x00000000 -#define SiS_SFAIL_ZERO 0x00100000 -#define SiS_SFAIL_REPLACE 0x00200000 -#define SiS_SFAIL_INVERT 0x00500000 -#define SiS_SFAIL_INCR 0x00600000 -#define SiS_SFAIL_DECR 0x00700000 - -#define SiS_SPASS_ZFAIL_KEEP 0x00000000 -#define SiS_SPASS_ZFAIL_ZERO 0x00010000 -#define SiS_SPASS_ZFAIL_REPLACE 0x00020000 -#define SiS_SPASS_ZFAIL_INVERT 0x00050000 -#define SiS_SPASS_ZFAIL_INCR 0x00060000 -#define SiS_SPASS_ZFAIL_DECR 0x00070000 - -#define SiS_SPASS_ZPASS_KEEP 0x00000000 -#define SiS_SPASS_ZPASS_ZERO 0x00001000 -#define SiS_SPASS_ZPASS_REPLACE 0x00002000 -#define SiS_SPASS_ZPASS_INVERT 0x00005000 -#define SiS_SPASS_ZPASS_INCR 0x00006000 -#define SiS_SPASS_ZPASS_DECR 0x00007000 - -/* - * REG_3D_DstBlendMode (0x8A50 - 0x8A53) - */ -#define MASK_SrcBlendMode 0x0000000F -#define MASK_DstBlendMode 0x000000F0 - -#define SiS_D_ZERO 0x00000000 -#define SiS_D_ONE 0x00000010 -#define SiS_D_SRC_COLOR 0x00000020 -#define SiS_D_ONE_MINUS_SRC_COLOR 0x00000030 -#define SiS_D_SRC_ALPHA 0x00000040 -#define SiS_D_ONE_MINUS_SRC_ALPHA 0x00000050 -#define SiS_D_DST_ALPHA 0x00000060 -#define SiS_D_ONE_MINUS_DST_ALPHA 0x00000070 -#define SiS_D_DST_COLOR 0x00000080 -#define SiS_D_ONE_MINUS_DST_COLOR 0x00000090 -#define SiS_D_SRC_ALPHA_SAT 0x000000a0 - -#define SiS_S_ZERO 0x00000000 -#define SiS_S_ONE 0x00000001 -#define SiS_S_SRC_COLOR 0x00000002 -#define SiS_S_ONE_MINUS_SRC_COLOR 0x00000003 -#define SiS_S_SRC_ALPHA 0x00000004 -#define SiS_S_ONE_MINUS_SRC_ALPHA 0x00000005 -#define SiS_S_DST_ALPHA 0x00000006 -#define SiS_S_ONE_MINUS_DST_ALPHA 0x00000007 -#define SiS_S_DST_COLOR 0x00000008 -#define SiS_S_ONE_MINUS_DST_COLOR 0x00000009 -#define SiS_S_SRC_ALPHA_SATURATE 0x0000000a -#define SiS_S_BOTH_SRC_ALPHA 0x0000000b -#define SiS_S_BOTH_ONE_MINUS_SRC_ALPHA 0x0000000c - -/* - * REG_3D_DstBlendMode (0x8A54 - 0x8A57) - */ -#define MASK_BottomClip 0x00001FFF -#define MASK_TopClip 0x03FFE000 - -/* - * REG_3D_DstBlendMode (0x8A58 - 0x8A5B) - */ -#define MASK_RightClip 0x00001FFF -#define MASK_LeftClip 0x03FFE000 - -/* - * REG_3D_TextureSet (0x8A7C - 0x8A7F) - * REG_3D_Texture1Set (0x8ADC - 0x8ADF) - */ -#define MASK_TextureHeight 0x0000000F -#define MASK_TextureWidth 0x000000F0 -#define MASK_TextureLevel 0x00000F00 -#define MASK_TextureSignYUVFormat 0x00001000 -#define MASK_TextureMappingMode 0x00FF0000 -#define MASK_TextureWrapU 0x00010000 -#define MASK_TextureWrapV 0x00020000 -#define MASK_TextureMirrorU 0x00040000 -#define MASK_TextureMirrorV 0x00080000 -#define MASK_TextureClampU 0x00100000 -#define MASK_TextureClampV 0x00200000 -#define MASK_TextureBorderU 0x00400000 -#define MASK_TextureBorderV 0x00800000 -#define MASK_TextureFormat 0xFF000000 -#define MASK_TextureBitDepth 0x70000000 -#define MASK_TextureRgbOrder 0x80000000 - -#define TEXEL_INDEX1 0x00000000 -#define TEXEL_INDEX2 0x01000000 -#define TEXEL_INDEX4 0x02000000 -#define TEXEL_INDEX8 0x03000000 - -#define TEXEL_INDEX1WithAlpha 0x04000000 -#define TEXEL_INDEX2WithAlpha 0x05000000 -#define TEXEL_INDEX4WithAlpha 0x06000000 -#define TEXEL_INDEX8WithAlpha 0x07000000 - -#define TEXEL_I1 0x10000000 -#define TEXEL_I2 0x11000000 -#define TEXEL_I4 0x12000000 -#define TEXEL_I8 0x13000000 - -#define TEXEL_DXT1 0x19000000 -#define TEXEL_DXT2 0x1A000000 -#define TEXEL_DXT3 0x1B000000 - -#define TEXEL_YUV422 0x20000000 -#define TEXEL_YVU422 0x21000000 -#define TEXEL_UVY422 0x22000000 -#define TEXEL_VUY422 0x23000000 -#define TEXEL_YUV411 0x24000000 - -#define TEXEL_L1 0x30000000 -#define TEXEL_L2 0x31000000 -#define TEXEL_L4 0x32000000 -#define TEXEL_L8 0x33000000 - -#define TEXEL_AL11 0x34000000 -#define TEXEL_AL44 0x35000000 -#define TEXEL_AL26 0x37000000 -#define TEXEL_AL88 0x38000000 - -#define TEXEL_A1 0x40000000 -#define TEXEL_A2 0x41000000 -#define TEXEL_A4 0x42000000 -#define TEXEL_A8 0x43000000 - -#define TEXEL_RGB_332_8 0x50000000 -#define TEXEL_RGB_233_8 0x51000000 -#define TEXEL_RGB_232_8 0x52000000 -#define TEXEL_ARGB_1232_8 0x53000000 -#define TEXEL_ARGB_2222_8 0x54000000 - -#define TEXEL_RGB_555_16 0x60000000 -#define TEXEL_RGB_565_16 0x61000000 -#define TEXEL_ARGB_1555_16 0x62000000 -#define TEXEL_ARGB_4444_16 0x63000000 - -#define TEXEL_ARGB_1888_32 0x70000000 -#define TEXEL_ARGB_2888_32 0x71000000 -#define TEXEL_ARGB_4888_32 0x72000000 -#define TEXEL_ARGB_8888_32 0x73000000 -#define TEXEL_ARGB_0888_32 0x74000000 - -#define TEXEL_BGR_332_8 0xD0000000 -#define TEXEL_BGR_233_8 0xD1000000 -#define TEXEL_BGR_232_8 0xD2000000 -#define TEXEL_ABGR_1232_8 0xD3000000 -#define TEXEL_ABGR_2222_8 0xD4000000 - -#define TEXEL_BGR_555_16 0xE0000000 -#define TEXEL_BGR_565_16 0xE1000000 -#define TEXEL_ABGR_1555_16 0xE2000000 -#define TEXEL_ABGR_4444_16 0xE3000000 - -#define TEXEL_ABGR_1888_32 0xF0000000 -#define TEXEL_ABGR_2888_32 0xF1000000 -#define TEXEL_ABGR_4888_32 0xF2000000 -#define TEXEL_ABGR_8888_32 0xF3000000 -#define TEXEL_ABGR_0888_32 0xF4000000 - -#define TEXEL_VU88 0x00000000 -#define TEXEL_LVU655 0x00800000 -#define TEXEL_LVU888 0x01000000 -#define TEXEL_UV88 0x02000000 -#define TEXEL_LUV655 0x02800000 -#define TEXEL_LUV888 0x03000000 - -/* - * REG_3D_TextureMip (0x8A80 - 0x8A83) - * REG_3D_Texture1Mip (0x8AE0 - 0x8AE3) - */ -#define MASK_TextureAnisotropyRatio 0x0000000F -#define MASK_TextureMipmapLodBias 0x00003FF0 -#define MASK_TextureFilterMin 0x0001C000 -#define MASK_TextureFilterMag 0x00020000 -#define MASK_TextureFilter 0x0003C000 -#define MASK_TextureLevelInSystem 0x3FFC0000 -#define MASK_TextureLevel0InSystem 0x00040000 -#define MASK_TextureBlockLength 0xF0000000 - -#define TEXTURE_FILTER_NEAREST 0x00000000 -#define TEXTURE_FILTER_LINEAR 0x00004000 -#define TEXTURE_FILTER_NEAREST_MIP_NEAREST 0x00008000 -#define TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x00010000 -#define TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x0000c000 -#define TEXTURE_FILTER_LINEAR_MIP_LINEAR 0x00014000 - -/* - * REG_3D_TextureTransparencyColorHigh (0x8A84 - 0x8A87) - * REG_3D_Texture1TransparencyColorHigh (0x8AE4 - 0x8AE7) - */ -#define MASK_TextureTransparencyColorHighB 0x000000FF -#define MASK_TextureTransparencyColorHighG 0x0000FF00 -#define MASK_TextureTransparencyColorHighR 0x00FF0000 -#define MASK_TextureAlphaTransparencyMode 0x08000000 - -/* - * REG_3D_TextureTransparencyColorLow (0x8A88 - 0x8A8B) - * REG_3D_Texture1TransparencyColorLow (0x8AE8 - 0x8AEB) - */ -#define MASK_TextureTransparencyColorLowB 0x000000FF -#define MASK_TextureTransparencyColorLowG 0x0000FF00 -#define MASK_TextureTransparencyColorLowR 0x00FF0000 -#define MASK_TextureBlockHeight 0x07000000 -#define MASK_TextureBlockWidth 0x70000000 - -/* - * REG_3D_TextureTransparencyColorLow (0x8A8C - 0x8A8F) - * REG_3D_Texture1TransparencyColorLow (0x8AEC - 0x8AEF) - */ -#define MASK_TextureBorderColorB 0x000000FF -#define MASK_TextureBorderColorG 0x0000FF00 -#define MASK_TextureBorderColorR 0x00FF0000 -#define MASK_TextureBorderColorA 0xFF000000 - -/* - * REG_3D_TexturePitch0-10 (0x8AC0 - 0x8AD7) - * REG_3D_Texture1Pitch0-10 (0x8B20 - 0x8B37) - */ -#define MASK_TexturePitchOdd 0x000003FF -#define MASK_TexturePitchEven 0x03FF0000 -#define SHIFT_TexturePitchEven 16 - -/* - * REG_3D_TextureColorBlendSet0 (0x8B40 - 0x8B43) - * REG_3D_TextureColorBlendSet1 (0x8B44 - 0x8B46) - * REG_3D_TextureAlphaBlendSet0 (0x8B40 - 0x8B43) - * REG_3D_TextureAlphaBlendSet1 (0x8B44 - 0x8B46) - */ -#define STAGE0_C_CF 0xa1485000 -#define STAGE0_C_CS 0xc1485000 -#define STAGE0_C_CFCS 0xa1705000 -#define STAGE0_C_CFOMAS_CSAS 0xc534c001 -#define STAGE0_C_CFOMCS_CCCS 0x4530c001 - -#define STAGE0_A_AF 0x63230000 -#define STAGE0_A_AS 0xc3230000 -#define STAGE0_A_AFAS 0x63c30000 -#define STAGE0_A_AFOMAS_ACAS 0x46c60001 - -#define STAGE1_C_CF 0xa1485000 -#define STAGE1_C_CS 0xe1485000 -#define STAGE1_C_CFCS 0xa1785000 -#define STAGE1_C_CFOMAS_CSAS 0xe5394001 -#define STAGE1_C_CFOMCS_CCCS 0x45394001 - -#define STAGE1_A_AF 0xa3230000 -#define STAGE1_A_AS 0xe3230000 -#define STAGE1_A_AFAS 0xa3e30000 -#define STAGE1_A_AFOMAS_ACAS 0x4aea0001 - -/* What registers are these associated with? */ -#define MASK_BMMemoryInSystem 0x00000080 -#define MASK_BMHeight 0x00000F00 -#define MASK_BMWidth 0x0000F000 -#define MASK_BMFilter 0x00010000 -#define MASK_BMMappingMode 0x007E0000 -#define MASK_BMFormat 0x07800000 -#define MASK_BMTxBumpmap 0x08000000 - -#define MASK_BMAddress 0xFFFFFFFC - -#define MASK_BMOffset 0xFF800000 -#define MASK_BMScale 0x007FE000 -#define MASK_BMPitch 0x00001FFF - -#define MASK_BMMatrix00 0x000007FF -#define MASK_BMMatrix01 0x07FF0000 -#define MASK_BMMatrix10 0x000007FF -#define MASK_BMMatrix11 0x07FF0000 - -#define MASK_TextureRealInSystem 0x00000001 -#define MASK_TextureDowngrade 0x00000002 - -#define ALPHA_BUFFER_FORMAT_1 0x00000000 -#define ALPHA_BUFFER_FORMAT_2 0x10000000 -#define ALPHA_BUFFER_FORMAT_4 0x20000000 -#define ALPHA_BUFFER_FORMAT_8 0x30000000 - -#endif diff --git a/hw/kdrive/sis300/sis_stub.c b/hw/kdrive/sis300/sis_stub.c deleted file mode 100644 index bce7d02d2..000000000 --- a/hw/kdrive/sis300/sis_stub.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright © 2003 Eric Anholt - * - * 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 Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" -#include "klinux.h" - -extern struct pci_id_entry sis_pci_ids[]; - -void -InitCard(char *name) -{ - struct pci_id_entry *id; - KdCardAttr attr; - - for (id = sis_pci_ids; id->name != NULL; id++) { - int j = 0; - while (LinuxFindPci(id->vendor, id->device, j++, &attr)) - KdCardInfoAdd(&SiSFuncs, &attr, 0); - } -} - -void -InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput(pScreenInfo, argc, argv); -} - -void -InitInput(int argc, char **argv) -{ - KdOsAddInputDrivers(); - KdInitInput(); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -#ifdef KDRIVEVESA - vesaUseMsg(); -#endif -} - -int -ddxProcessArgument(int argc, char **argv, int i) -{ - int ret; - -#ifdef KDRIVEVESA - if (!(ret = vesaProcessArgument (argc, argv, i))) -#endif - ret = KdProcessArgument(argc, argv, i); - - return ret; -} diff --git a/hw/kdrive/sis530/sis.c b/hw/kdrive/sis530/sis.c deleted file mode 100644 index e1deb3b28..000000000 --- a/hw/kdrive/sis530/sis.c +++ /dev/null @@ -1,921 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" - -#define MAX_FB_SIZE (4096 * 1024) - -#define MMIO_SIZE (64 * 1024) - -int sisMemoryTable[8] = { - 1, 2, 4, 0, 0, 2, 4, 8 -}; - -Bool -sisCardInit (KdCardInfo *card) -{ - SisCardInfo *sisc; - SisPtr sis; - int size; - CARD8 *registers; - CARD8 *temp_buffer; - CARD8 save_sr5; - - sisc = (SisCardInfo *) xalloc (sizeof (SisCardInfo)); - if (!sisc) - goto bail0; - - sisc->io_base = card->attr.io; - /* - * enable access to SiS ports (no MMIO available) - */ - iopl(3); - save_sr5 = GetSrtc(sisc,0x5); - if (save_sr5 != 0x21) - save_sr5 = 0x86; - PutSrtc(sisc,0x5,0x86); -#if 0 - { - int i; - - for (i = 0; i <= 0x3f; i++) - fprintf (stderr, "SR%02x = %02x\n", i, GetSrtc(sisc,i)); - } -#endif - sisc->memory = sisMemoryTable[GetSrtc(sisc,0xc)&0x7] * 1024 * 1024; - - PutSrtc(sisc,0x5,save_sr5); - - if (!sisc->memory) - { - ErrorF ("Can't detect SiS530 frame buffer\n"); - goto bail1; - } - - /* - * Map frame buffer and MMIO registers - */ - sisc->frameBuffer = KdMapDevice (card->attr.address[0], sisc->memory); - if (!sisc->frameBuffer) - goto bail1; - - sisc->registers = KdMapDevice (card->attr.address[1], MMIO_SIZE); - if (!sisc->registers) - goto bail2; - - /* - * Offset from base of MMIO to registers - */ - sisc->sis = (SisPtr) (sisc->registers + SIS_MMIO_OFFSET); - sisc->cpu_bitblt = (VOL32 *) sisc->registers; - - card->driver = sisc; - - return TRUE; -bail2: - KdUnmapDevice (sisc->frameBuffer, sisc->memory); -bail1: - xfree (sisc); -bail0: - return FALSE; -} - -Bool -sisModeSupported (KdScreenInfo *screen, const KdMonitorTiming *t) -{ - if (t->horizontal != 1600 && - t->horizontal != 1280 && - t->horizontal != 1152 && - t->horizontal != 1024 && - t->horizontal != 800 && - t->horizontal != 640) - return FALSE; - return TRUE; -} - -Bool -sisModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - SisCardInfo *sisc = (SisCardInfo *) card->driver; - SisScreenInfo *siss; - int i; - KdMonitorTiming *t; - CARD32 memory; - int byte_width, pixel_width, screen_size; - - if (screen->fb[0].depth >= 24) - { - screen->fb[0].depth = 24; - screen->fb[0].bitsPerPixel = 24; - screen->dumb = TRUE; - } - else if (screen->fb[0].depth >= 16) - { - screen->fb[0].depth = 16; - screen->fb[0].bitsPerPixel = 16; - } - else if (screen->fb[0].depth >= 15) - { - screen->fb[0].depth = 15; - screen->fb[0].bitsPerPixel = 16; - } - else - { - screen->fb[0].depth = 8; - screen->fb[0].bitsPerPixel = 8; - } - byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); - pixel_width = screen->width; - screen->fb[0].pixelStride = pixel_width; - screen->fb[0].byteStride = byte_width; - - screen_size = byte_width * screen->height; - - return screen_size <= sisc->memory; -} - -Bool -sisScreenInit (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - SisCardInfo *sisc = (SisCardInfo *) card->driver; - SisScreenInfo *siss; - int i; - const KdMonitorTiming *t; - CARD32 memory; - int byte_width, pixel_width, screen_size; - - siss = (SisScreenInfo *) xalloc (sizeof (SisScreenInfo)); - if (!siss) - return FALSE; - - memset (siss, '\0', sizeof (SisScreenInfo)); - - if (!screen->width || !screen->height) - { - screen->width = 800; - screen->height = 600; - screen->rate = 72; - } - if (!screen->fb[0].depth) - screen->fb[0].depth = 8; - - t = KdFindMode (screen, sisModeSupported); - - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - - if (!KdTuneMode (screen, sisModeUsable, sisModeSupported)) - { - xfree (sisc); - return FALSE; - } - - memory = sisc->memory - screen_size; - - screen->fb[0].frameBuffer = sisc->frameBuffer; - - /* - * Cursor lives in the last 16k of memory - */ - if (memory >= 16384 && !screen->softCursor) - { - siss->cursor_base = sisc->frameBuffer + (sisc->memory - 16384); - siss->cursor_off = siss->cursor_base - sisc->frameBuffer; - memory -= 16384; - } - else - { - screen->softCursor = TRUE; - siss->cursor_base = 0; - siss->cursor_off = 0; - } - - if (memory > 8192) - { - siss->expand = screen->fb[0].frameBuffer + screen_size; - siss->expand_off = siss->expand - sisc->frameBuffer; - siss->expand_len = memory; - memory = 0; - } - else - { - siss->expand = 0; - siss->expand_len = 0; - } - - switch (screen->fb[0].depth) { - case 8: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 15: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x03e0; - screen->fb[0].redMask = 0x7c00; - break; - case 16: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x07e0; - screen->fb[0].redMask = 0xf800; - break; - case 24: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x0000ff; - screen->fb[0].greenMask = 0x00ff00; - screen->fb[0].redMask = 0xff0000; - break; - } - - screen->driver = siss; - - return TRUE; -} - -static void -_sisGetCrtc (SisCardInfo *sisc, SisCrtc *crtc) -{ - crtc->misc_output = _sisInb(sisc->io_base+0x4c); - crtc->h_total_0_7 = GetCrtc (sisc, 0x00); - crtc->h_display_end_0_7 = GetCrtc (sisc, 0x01); - crtc->h_blank_start_0_7 = GetCrtc (sisc, 0x02); - crtc->_h_blank_end = GetCrtc (sisc, 0x03); - crtc->h_sync_start_0_7 = GetCrtc (sisc, 0x04); - crtc->_h_sync_end = GetCrtc (sisc, 0x05); - crtc->v_total_0_7 = GetCrtc (sisc, 0x06); - crtc->crtc_overflow = GetCrtc (sisc, 0x07); - crtc->preset_row_scan = GetCrtc (sisc, 0x08); - crtc->_max_scan_line = GetCrtc (sisc, 0x09); - crtc->cursor_start = GetCrtc (sisc, 0x0a); - crtc->cursor_end = GetCrtc (sisc, 0x0a); - crtc->start_address_8_15 = GetCrtc (sisc, 0x0c); - crtc->start_address_0_7 = GetCrtc (sisc, 0x0d); - crtc->text_cursor_15_8 = GetCrtc (sisc, 0x0e); - crtc->text_cursor_7_0 = GetCrtc (sisc, 0x0f); - crtc->v_retrace_start_0_7 = GetCrtc (sisc, 0x10); - crtc->_v_retrace_end = GetCrtc (sisc, 0x11); - crtc->v_display_end_0_7 = GetCrtc (sisc, 0x12); - crtc->screen_off_0_7 = GetCrtc (sisc, 0x13); - crtc->_underline_location = GetCrtc (sisc, 0x14); - crtc->v_blank_start_0_7 = GetCrtc (sisc, 0x15); - crtc->v_blank_end_0_7 = GetCrtc (sisc, 0x16); - crtc->crtc_mode = GetCrtc (sisc, 0x17); - - crtc->line_compare_0_7 = GetCrtc (sisc, 0x18); - - crtc->mode_control = GetArtc (sisc, 0x10); - crtc->screen_border_color = GetArtc (sisc, 0x11); - crtc->enable_color_plane = GetArtc (sisc, 0x12); - crtc->horizontal_pixel_pan = GetArtc (sisc, 0x13); - - crtc->mode_register = GetGrtc (sisc, 0x5); - crtc->misc_register = GetGrtc (sisc, 0x6); - crtc->color_dont_care = GetGrtc (sisc, 0x7); - - crtc->clock_mode = GetSrtc (sisc, 0x1); - crtc->color_plane_w_enable = GetSrtc (sisc, 0x2); - crtc->memory_mode = GetSrtc (sisc, 0x4); - - crtc->graphics_mode = GetSrtc (sisc, 0x6); - crtc->misc_control_0 = GetSrtc (sisc, 0x7); - crtc->crt_cpu_threshold_control_0 = GetSrtc (sisc, 0x8); - crtc->crt_cpu_threshold_control_1 = GetSrtc (sisc, 0x9); - crtc->extended_crt_overflow = GetSrtc (sisc, 0xa); - crtc->misc_control_1 = GetSrtc (sisc, 0xb); - crtc->misc_control_2 = GetSrtc (sisc, 0xc); - - crtc->ddc_and_power_control = GetSrtc (sisc, 0x11); - crtc->extended_horizontal_overflow = GetSrtc (sisc, 0x12); - crtc->extended_clock_generator = GetSrtc (sisc, 0x13); - crtc->cursor_0_red = GetSrtc (sisc, 0x14); - crtc->cursor_0_green = GetSrtc (sisc, 0x15); - crtc->cursor_0_blue = GetSrtc (sisc, 0x16); - crtc->cursor_1_red = GetSrtc (sisc, 0x17); - crtc->cursor_1_green = GetSrtc (sisc, 0x18); - crtc->cursor_1_blue = GetSrtc (sisc, 0x19); - crtc->cursor_h_start_0_7 = GetSrtc (sisc, 0x1a); - crtc->cursor_h_start_1 = GetSrtc (sisc, 0x1b); - crtc->cursor_h_preset_0_5 = GetSrtc (sisc, 0x1c); - crtc->cursor_v_start_0_7 = GetSrtc (sisc, 0x1d); - crtc->cursor_v_start_1 = GetSrtc (sisc, 0x1e); - crtc->cursor_v_preset_0_5 = GetSrtc (sisc, 0x1f); - crtc->linear_base_19_26 = GetSrtc (sisc, 0x20); - crtc->linear_base_1 = GetSrtc (sisc, 0x21); - - crtc->graphics_engine_0 = GetSrtc (sisc, 0x26); - crtc->graphics_engine_1 = GetSrtc (sisc, 0x27); - crtc->internal_mclk_0 = GetSrtc (sisc, 0x28); - crtc->internal_mclk_1 = GetSrtc (sisc, 0x29); - crtc->internal_vclk_0 = GetSrtc (sisc, 0x2A); - crtc->internal_vclk_1 = GetSrtc (sisc, 0x2B); - - crtc->misc_control_7 = GetSrtc (sisc, 0x38); - - crtc->misc_control_11 = GetSrtc (sisc, 0x3E); - crtc->misc_control_12 = GetSrtc (sisc, 0x3F); -} - -static void -_sisSetBlank (SisCardInfo *sisc, Bool blank) -{ - CARD8 clock; - - clock = GetSrtc (sisc, 0x01); - if (blank) - clock |= 0x20; - else - clock &= ~0x20; - PutSrtc (sisc, 0x01, clock); -} - -static void -_sisSetCrtc (SisCardInfo *sisc, SisCrtc *crtc) -{ - _sisSetBlank (sisc, TRUE); - PutCrtc (sisc, 0x00, crtc->h_total_0_7); - PutCrtc (sisc, 0x01, crtc->h_display_end_0_7); - PutCrtc (sisc, 0x02, crtc->h_blank_start_0_7); - PutCrtc (sisc, 0x03, crtc->_h_blank_end); - PutCrtc (sisc, 0x04, crtc->h_sync_start_0_7); - PutCrtc (sisc, 0x05, crtc->_h_sync_end); - PutCrtc (sisc, 0x06, crtc->v_total_0_7); - PutCrtc (sisc, 0x07, crtc->crtc_overflow); - PutCrtc (sisc, 0x08, crtc->preset_row_scan); - PutCrtc (sisc, 0x09, crtc->_max_scan_line); - PutCrtc (sisc, 0x0a, crtc->cursor_start); - PutCrtc (sisc, 0x0b, crtc->cursor_end); - PutCrtc (sisc, 0x0c, crtc->start_address_8_15); - PutCrtc (sisc, 0x0d, crtc->start_address_0_7); - PutCrtc (sisc, 0x0e, crtc->text_cursor_15_8); - PutCrtc (sisc, 0x0f, crtc->text_cursor_7_0); - PutCrtc (sisc, 0x10, crtc->v_retrace_start_0_7); - PutCrtc (sisc, 0x11, crtc->_v_retrace_end); - PutCrtc (sisc, 0x12, crtc->v_display_end_0_7); - PutCrtc (sisc, 0x13, crtc->screen_off_0_7); - PutCrtc (sisc, 0x14, crtc->_underline_location); - PutCrtc (sisc, 0x15, crtc->v_blank_start_0_7); - PutCrtc (sisc, 0x16, crtc->v_blank_end_0_7); - PutCrtc (sisc, 0x17, crtc->crtc_mode); - PutCrtc (sisc, 0x18, crtc->line_compare_0_7); - - PutArtc (sisc, 0x10, crtc->mode_control); - PutArtc (sisc, 0x11, crtc->screen_border_color); - PutArtc (sisc, 0x12, crtc->enable_color_plane); - PutArtc (sisc, 0x13, crtc->horizontal_pixel_pan); - - PutGrtc (sisc, 0x5, crtc->mode_register); - PutGrtc (sisc, 0x6, crtc->misc_register); - PutGrtc (sisc, 0x7, crtc->color_dont_care); - - PutSrtc (sisc, 0x1, crtc->clock_mode | 0x20); - PutSrtc (sisc, 0x2, crtc->color_plane_w_enable); - PutSrtc (sisc, 0x4, crtc->memory_mode); - - PutSrtc (sisc, 0x6, crtc->graphics_mode); - PutSrtc (sisc, 0x7, crtc->misc_control_0); - PutSrtc (sisc, 0x8, crtc->crt_cpu_threshold_control_0); - PutSrtc (sisc, 0x9, crtc->crt_cpu_threshold_control_1); - PutSrtc (sisc, 0xa, crtc->extended_crt_overflow); - PutSrtc (sisc, 0xb, crtc->misc_control_1); - PutSrtc (sisc, 0xc, crtc->misc_control_2); - - PutSrtc (sisc, 0x11, crtc->ddc_and_power_control); - PutSrtc (sisc, 0x12, crtc->extended_horizontal_overflow); - PutSrtc (sisc, 0x13, crtc->extended_clock_generator); - PutSrtc (sisc, 0x14, crtc->cursor_0_red); - PutSrtc (sisc, 0x15, crtc->cursor_0_green); - PutSrtc (sisc, 0x16, crtc->cursor_0_blue); - PutSrtc (sisc, 0x17, crtc->cursor_1_red); - PutSrtc (sisc, 0x18, crtc->cursor_1_green); - PutSrtc (sisc, 0x19, crtc->cursor_1_blue); - PutSrtc (sisc, 0x1a, crtc->cursor_h_start_0_7); - PutSrtc (sisc, 0x1b, crtc->cursor_h_start_1); - PutSrtc (sisc, 0x1c, crtc->cursor_h_preset_0_5); - PutSrtc (sisc, 0x1d, crtc->cursor_v_start_0_7); - PutSrtc (sisc, 0x1e, crtc->cursor_v_start_1); - PutSrtc (sisc, 0x1f, crtc->cursor_v_preset_0_5); - PutSrtc (sisc, 0x20, crtc->linear_base_19_26); - PutSrtc (sisc, 0x21, crtc->linear_base_1); - - PutSrtc (sisc, 0x26, crtc->graphics_engine_0); - PutSrtc (sisc, 0x27, crtc->graphics_engine_1); - PutSrtc (sisc, 0x28, crtc->internal_mclk_0); - PutSrtc (sisc, 0x29, crtc->internal_mclk_1); - PutSrtc (sisc, 0x2A, crtc->internal_vclk_0); - PutSrtc (sisc, 0x2B, crtc->internal_vclk_1); - - PutSrtc (sisc, 0x38, crtc->misc_control_7); - - PutSrtc (sisc, 0x3E, crtc->misc_control_11); - PutSrtc (sisc, 0x3F, crtc->misc_control_12); - -#if 0 - PutCrtc (sisc, 0x5b, 0x27); - PutCrtc (sisc, 0x5c, 0xe1); - PutCrtc (sisc, 0x5d, 0x00); - - PutSrtc (sisc, 0x5a, 0xe6); - PutSrtc (sisc, 0x5d, 0xa1); - PutSrtc (sisc, 0x9a, 0xe6); - PutSrtc (sisc, 0x9d, 0xa1); - PutSrtc (sisc, 0xda, 0xe6); - PutSrtc (sisc, 0xdd, 0x6c); -#endif - - _sisOutb(crtc->misc_output, sisc->io_base+0x42); - - outw (0x3c4, 0x0100); - outw (0x3c4, 0x0300); - - _sisSetBlank (sisc, FALSE); -} - -CARD8 -_sisReadIndexRegister (CARD32 base, CARD8 index) -{ - CARD8 ret; - - _sisOutb (index, base); - ret = _sisInb (base+1); - return ret; -} - -void -_sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value) -{ - _sisOutb (index, base); - _sisOutb (value, base+1); -} - -CARD8 -_sisReadArtc (CARD32 base, CARD8 index) -{ - CARD8 ret; - - _sisInb (base+0x1a); - _sisOutb (index,base); - ret = _sisInb (base+1); - _sisInb (base+0x1a); - _sisOutb (0x20,base); - return ret; -} - -void -_sisWriteArtc (CARD32 base, CARD8 index, CARD8 value) -{ - _sisInb (base+0x1a); - _sisOutb (index|0x20,base); - _sisOutb (value,base); - _sisInb (base+0x1a); - _sisOutb (0x20,base); -} - -void -sisPreserve (KdCardInfo *card) -{ - SisCardInfo *sisc = card->driver; - CARD8 *r = sisc->registers; - int a, i, l; - CARD8 line[16]; - CARD8 prev[16]; - BOOL gotone; - - sisc->save.sr5 = GetSrtc(sisc,0x5); - if (sisc->save.sr5 != 0x21) - sisc->save.sr5 = 0x86; - /* unlock extension registers */ - PutSrtc(sisc,0x5,0x86); - /* unlock CRTC registers */ - PutCrtc(sisc,0x11,GetCrtc(sisc,0x11)&~0x80); - /* enable vga */ - _sisOutb(0x1,sisc->io_base+0x43); - - /* enable MMIO access to registers */ - sisc->save.srb = GetSrtc(sisc,0xb); - PutSrtc(sisc, 0xb, sisc->save.srb | 0x60); - _sisGetCrtc (sisc, &sisc->save.crtc); - memcpy (sisc->save.text_save, sisc->frameBuffer, SIS_TEXT_SAVE); -} - -Bool -sisEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = pScreenPriv->card; - SisCardInfo *sisc = card->driver; - SisScreenInfo *siss = screen->driver; - const KdMonitorTiming *t; - SisCrtc crtc; - unsigned long pixel; - - int hactive; - int hblank; - int hfp; - int hbp; - - int vactive; - int vblank; - int vfp; - int vbp; - - int h_total; - int h_display_end; - int h_blank_start; - int h_blank_end; - int h_sync_start; - int h_sync_end; - int h_screen_off; - - int h_adjust; - - int v_total; - int v_retrace_start; - int v_retrace_end; - int v_display_end; - int v_blank_start; - int v_blank_end; - - crtc = sisc->save.crtc; - - t = KdFindMode (screen, sisModeSupported); - - /* CR9 */ - crtc.max_scan_line = 0; - - /* CRA */ - crtc.cursor_start = 0; - - /* CRB */ - crtc.cursor_end = 0; - - /* CRE */ - crtc.text_cursor_15_8 = 0; - - /* CRF */ - crtc.text_cursor_7_0 = 0; - - /* CR11 */ - crtc.disable_v_retrace_int = 1; - - /* CR14 */ - crtc.underline_location = 0; - crtc.count_by_four = 0; - crtc.doubleword_mode = 1; - - /* 3CC/3C2 */ - crtc.io_address_select = 1; - crtc.display_ram_enable = 1; - crtc.clock_select = 3; - - /* SR1 */ - crtc.clock_mode = 0; - crtc.dot_clock_8_9 = 1; - - /* SR2 */ - crtc.color_plane_w_enable = 0xf; - - /* SR4 */ - crtc.memory_mode = 0; - crtc.chain_4_enable = 1; - crtc.odd_even_disable = 1; - crtc.extended_memory_sz = 1; - - /* SR6 */ - crtc.graphics_mode_linear = 1; - crtc.enhanced_graphics_mode = 1; - - /* SR9 */ - crtc.crt_cpu_threshold_control_1 = 0; - - /* SRB */ -#if 0 - crtc.cpu_bitblt_enable = 1; -#endif - crtc.memory_mapped_mode = 3; - - /* SRC */ - crtc.graphics_mode_32bit_enable = 1; - crtc.read_ahead_enable = 1; - - /* SR11 */ - crtc.acpi_enable = 0; - crtc.kbd_cursor_activate = 0; - crtc.video_memory_activate = 0; - crtc.vga_standby = 0; - crtc.vga_suspend = 0; - - crtc.cursor_0_red = 0x3f; - crtc.cursor_0_green = 0x3f; - crtc.cursor_0_blue = 0x3f; - - /* SR20 */ - crtc.linear_base_19_26 = (card->attr.address[0] & 0x07f80000) >> 19; - - /* SR21 */ - crtc.linear_base_27_31 = (card->attr.address[0] & 0xf8000000) >> 27; - crtc.linear_aperture = SIS_LINEAR_APERTURE_4M; - - /* SR27 */ - crtc.logical_screen_width = 3; - crtc.graphics_prog_enable = 1; - - /* SR38 */ - crtc.extended_clock_select = 0; - - /* AR10 */ - crtc.mode_control = 0; - crtc.graphics_mode_enable = 1; - /* AR11 */ - crtc.screen_border_color = 0; - /* AR12 */ - crtc.enable_color_plane = 0xf; - /* AR13 */ - crtc.horizontal_pixel_pan = 0; - - /* GR5 */ - crtc.mode_register = 0; - - /* GR6 */ - crtc.graphics_enable = 1; - crtc.chain_odd_even = 0; - crtc.memory_address_select = 1; - - /* GR7 */ - crtc.color_dont_care = 0xf; - if (siss->cursor_base) - { - crtc_set_cursor_start_addr (&crtc, siss->cursor_off); - crtc.graphics_mode_hw_cursor = 0; - } - - hactive = t->horizontal; - hblank = t->hblank; - hbp = t->hbp; - hfp = t->hfp; - - vactive = t->vertical; - vblank = t->vblank; - vbp = t->vbp; - vfp = t->vfp; - - pixel = (hactive + hblank) * (vactive + vblank) * t->rate; - - switch (screen->fb[0].bitsPerPixel) { - case 8: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - crtc.color_mode_256 = 1; - h_screen_off = hactive; - h_adjust = 1; - - break; - case 16: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - h_screen_off = hactive * 2; - h_adjust = 1; - - crtc.color_mode_256 = 0; - - if (screen->fb[0].depth == 15) - crtc.graphics_mode_32k = 1; - else - crtc.graphics_mode_64k = 1; - break; - case 24: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - h_screen_off = hactive * 3; - h_adjust = 1; - - crtc.color_mode_256 = 0; - - /* SR6 */ - crtc.graphics_mode_true = 1; - /* SR7 */ - crtc.direct_color_24bit = 0; - /* SR9 */ - crtc.true_color_32bpp = 0; - /* SRB */ - crtc.true_color_order = 1; - break; - case 32: - hactive /= 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - - h_screen_off = hactive * 4; - h_adjust = 1; - - crtc.color_mode_256 = 0; - - /* SR6 */ - crtc.graphics_mode_true = 1; - /* SR7 */ - crtc.direct_color_24bit = 0; - /* SR9 */ - crtc.true_color_32bpp = 1; - /* SRB */ - crtc.true_color_order = 1; - break; - } - - sisGetClock (pixel, &crtc); - - crtc.high_speed_dac_0 = crtc.high_speed_dac_1 = pixel > 135000000; - - sisEngThresh (&crtc, pixel, screen->fb[0].bitsPerPixel); - - /* - * Compute horizontal register values from timings - */ - h_total = hactive + hblank - 5; - h_display_end = hactive - 1; - h_blank_start = h_display_end; - h_blank_end = h_blank_start + hblank; - - h_sync_start = hactive + hfp + h_adjust; - h_sync_end = h_sync_start + hblank - hbp - hfp; - - crtc_set_h_total(&crtc, h_total); - crtc_set_h_display_end (&crtc, h_display_end); - crtc_set_h_blank_start (&crtc, h_blank_start); - crtc_set_h_blank_end (&crtc, h_blank_end); - crtc_set_h_sync_start (&crtc, h_sync_start); - crtc_set_h_sync_end (&crtc, h_sync_end); - crtc_set_screen_off (&crtc, h_screen_off); - - v_total = vactive + vblank - 2; - v_retrace_start = vactive + vfp - 1; - v_retrace_end = v_retrace_start + vblank - vbp - vfp; - v_display_end = vactive - 1; - v_blank_start = vactive - 1; - v_blank_end = v_blank_start + vblank /* - 1 */; - - crtc_set_v_total(&crtc, v_total); - crtc_set_v_retrace_start (&crtc, v_retrace_start); - crtc.v_retrace_end_0_3 = v_retrace_end; - crtc_set_v_display_end (&crtc, v_display_end); - crtc_set_v_blank_start (&crtc, v_blank_start); - crtc.v_blank_end_0_7 = v_blank_end; - -#if 0 - crtc.h_blank_start_0_7 = 0x6a; - crtc._h_blank_end = 0x9a; - crtc.h_sync_start_0_7 = 0x6b; - crtc._h_sync_end = 0x9a; - - crtc.v_retrace_start_0_7 = 0x7d; - crtc._v_retrace_end = 0x23; - crtc.v_blank_start_0_7 = 0x7d; - crtc.v_blank_end_0_7 = 0x84; - - crtc.crt_cpu_threshold_control_0 = 0xdf; /* SR8 */ - crtc.crt_cpu_threshold_control_1 = 0x00; /* SR9 */ - crtc.extended_clock_generator = 0x40; /* SR13 */ - - crtc.cursor_h_start_0_7 = 0x83; - crtc.cursor_v_start_0_7 = 0x6c; - - crtc.internal_vclk_0 = 0x68; - crtc.internal_vclk_1 = 0xc4; - crtc.misc_control_7 = 0x70; -#endif - - _sisSetCrtc (sisc, &crtc); - return TRUE; -} - -Bool -sisDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - sisCardInfo(pScreenPriv); - union ddc_and_power_control_u _ddc_and_power_control_u; - - ddc_and_power_control = sisc->save.crtc.ddc_and_power_control; - - kbd_cursor_activate = 0; - video_memory_activate = 0; - vga_standby = 0; - vga_suspend = 0; - acpi_enable = 0; - switch (mode) { - case KD_DPMS_NORMAL: - break; - case KD_DPMS_STANDBY: - vga_standby = 1; - break; - case KD_DPMS_SUSPEND: - vga_suspend = 1; - break; - case KD_DPMS_POWERDOWN: - acpi_enable = 1; - break; - } - PutSrtc (sisc, 0x11, ddc_and_power_control); - return TRUE; -} - -void -sisDisable (ScreenPtr pScreen) -{ -} - -void -sisRestore (KdCardInfo *card) -{ - SisCardInfo *sisc = (SisCardInfo *) card->driver; - - memcpy (sisc->frameBuffer, sisc->save.text_save, SIS_TEXT_SAVE); - _sisSetCrtc (sisc, &sisc->save.crtc); - PutSrtc (sisc, 0xb, sisc->save.srb); - PutSrtc (sisc, 0x5, sisc->save.sr5); -} - -void -sisScreenFini (KdScreenInfo *screen) -{ - SisScreenInfo *siss = (SisScreenInfo *) screen->driver; - - xfree (siss); - screen->driver = 0; -} - -void -sisCardFini (KdCardInfo *card) -{ - SisCardInfo *sisc = (SisCardInfo *) card->driver; - - KdUnmapDevice (sisc->frameBuffer, sisc->memory); - KdUnmapDevice (sisc->registers, sizeof (SisRec)); -} - -KdCardFuncs sisFuncs = { - sisCardInit, - sisScreenInit, - 0, - sisPreserve, - sisEnable, - sisDPMS, - sisDisable, - sisRestore, - sisScreenFini, - sisCardFini, - sisCursorInit, - sisCursorEnable, - sisCursorDisable, - sisCursorFini, - 0, - sisDrawInit, - sisDrawEnable, - sisDrawSync, - sisDrawDisable, - sisDrawFini, - sisGetColors, - sisPutColors, -}; diff --git a/hw/kdrive/sis530/sis.h b/hw/kdrive/sis530/sis.h deleted file mode 100644 index 194c33c02..000000000 --- a/hw/kdrive/sis530/sis.h +++ /dev/null @@ -1,1215 +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. - */ - -#ifndef _SIS_H_ -#define _SIS_H_ -#include "kdrive.h" -#include <stdio.h> -#include <unistd.h> -#include <sys/mman.h> -#include <asm/io.h> -#include <stdio.h> - -/* - * Linear Addressing 000 0000 - 0ff ffff (16m) - * Image data transfer 100 0000 - 100 7fff (32k) - * Empty 100 8000 - 100 81ff - * MMIO registers 100 8200 - 100 8480 - * - * We don't care about the image transfer or PCI regs, so - * this structure starts at the MMIO regs - */ - -typedef volatile CARD32 VOL32; -typedef volatile CARD16 VOL16; -typedef volatile CARD8 VOL8; - -#define SIS_MMIO_OFFSET 0x8200 - -typedef struct _sis530General { - VOL32 src_base; /* 8200 */ - VOL16 src_pitch; /* 8204 */ - VOL16 _pad0; /* 8206 */ - VOL16 src_y; /* 8208 */ - VOL16 src_x; /* 820a */ - VOL16 dst_y; /* 820c */ - VOL16 dst_x; /* 820e */ - VOL32 dst_base; /* 8210 */ - VOL16 dst_pitch; /* 8214 */ - VOL16 dst_height; /* 8216 */ - VOL16 rect_width; /* 8218 */ - VOL16 rect_height; /* 821a */ - VOL32 pattern_fg; /* 821c */ - VOL32 pattern_bg; /* 8220 */ - VOL32 src_fg; /* 8224 */ - VOL32 src_bg; /* 8228 */ - VOL8 mask[8]; /* 822c */ - VOL16 clip_left; /* 8234 */ - VOL16 clip_top; /* 8236 */ - VOL16 clip_right; /* 8238 */ - VOL16 clip_bottom; /* 823a */ - VOL32 command; /* 823c */ - VOL32 status; /* 8240 */ - VOL8 _pad1[0xbc]; /* 8244 */ - VOL8 pattern[256]; /* 8300 */ - /* 8400 */ -} SisGeneral; - -typedef struct _sis530Line { - VOL8 _pad0[8]; /* 8200 */ - VOL16 x0; /* 8208 */ - VOL16 y0; /* 820a */ - VOL16 x1; /* 820c */ - VOL16 y1; /* 820e */ - VOL32 dst_base; /* 8210 */ - VOL16 dst_pitch; /* 8214 */ - VOL16 dst_height; /* 8216 */ - VOL16 count; /* 8218 */ - VOL16 style_period; /* 821a */ - VOL32 fg; /* 821c */ - VOL32 bg; /* 8220 */ - VOL8 _pad1[8]; /* 8224 */ - VOL32 style0; /* 822c */ - VOL32 style1; /* 8228 */ - VOL16 clip_left; /* 8234 */ - VOL16 clip_top; /* 8236 */ - VOL16 clip_right; /* 8238 */ - VOL16 clip_bottom; /* 823a */ - VOL32 command; /* 823c */ - VOL32 status; /* 8240 */ - VOL8 _pad2[0xbc]; /* 8244 */ - struct { - VOL16 x; - VOL16 y; - } data[96]; /* 8300 */ - /* 8480 */ -} SisLine; - -typedef struct _sis530Transparent { - VOL32 src_base; /* 8200 */ - VOL16 src_pitch; /* 8204 */ - VOL16 _pad0; /* 8206 */ - VOL16 src_y; /* 8208 */ - VOL16 src_x; /* 820a */ - VOL16 dst_y; /* 820c */ - VOL16 dst_x; /* 820e */ - VOL32 dst_base; /* 8210 */ - VOL16 dst_pitch; /* 8214 */ - VOL16 dst_height; /* 8216 */ - VOL16 rect_width; /* 8218 */ - VOL16 rect_height; /* 821a */ - VOL32 dst_key_high; /* 821c */ - VOL32 dst_key_low; /* 8220 */ - VOL32 src_key_high; /* 8224 */ - VOL32 src_key_low; /* 8228 */ - VOL8 _pad1[8]; /* 822c */ - VOL16 clip_left; /* 8234 */ - VOL16 clip_top; /* 8236 */ - VOL16 clip_right; /* 8238 */ - VOL16 clip_bottom; /* 823a */ - VOL32 command; /* 823c */ - VOL32 status; /* 8240 */ - /* 8244 */ -} SisTransparent; - -typedef struct _sis530Multiple { - VOL8 _pad0[8]; /* 8200 */ - VOL16 count; /* 8208 */ - VOL16 y; /* 820a */ - VOL16 x0_start; /* 820c */ - VOL16 x0_end; /* 820e */ - VOL32 dst_base; /* 8210 */ - VOL16 dst_pitch; /* 8214 */ - VOL16 dst_height; /* 8216 */ - VOL8 _pad1[4]; /* 8218 */ - VOL32 fg; /* 821c */ - VOL32 bg; /* 8220 */ - VOL8 _pad2[8]; /* 8224 */ - VOL8 mask[8]; /* 822c */ - VOL16 clip_left; /* 8234 */ - VOL16 clip_top; /* 8236 */ - VOL16 clip_right; /* 8238 */ - VOL16 clip_bottom; /* 823a */ - VOL32 command; /* 823c */ - VOL32 status; /* 8240 */ - VOL16 x1_start; /* 8244 */ - VOL16 x1_end; /* 8246 */ - VOL8 _pad3[0xb8]; /* 8248 */ - VOL8 pattern[64]; /* 8300 */ - struct { - VOL16 x_start; - VOL16 y_end; - } data[80]; /* 8340 */ - /* 8480 */ -} SisMultiple; - -typedef struct _sis530Trapezoid { - VOL8 _pad0[8]; /* 8200 */ - VOL16 height; /* 8208 */ - VOL16 y; /* 820a */ - VOL16 left_x; /* 820c */ - VOL16 right_x; /* 820e */ - VOL32 dst_base; /* 8210 */ - VOL16 dst_pitch; /* 8214 */ - VOL16 dst_height; /* 8216 */ - VOL8 _pad1[4]; /* 8218 */ - VOL32 fg; /* 821c */ - VOL32 bg; /* 8220 */ - VOL8 _pad2[8]; /* 8224 */ - VOL8 mask[8]; /* 822c */ - VOL16 clip_left; /* 8234 */ - VOL16 clip_top; /* 8236 */ - VOL16 clip_right; /* 8238 */ - VOL16 clip_bottom; /* 823a */ - VOL32 command; /* 823c */ - VOL32 status; /* 8240 */ - VOL16 left_dx; /* 8244 */ - VOL16 left_dy; /* 8246 */ - VOL16 right_dx; /* 8248 */ - VOL16 right_dy; /* 824a */ - VOL32 left_error; /* 824c */ - VOL32 right_error; /* 8250 */ - /* 8254 */ -} SisTrapezoid; - -typedef struct _sisAccel { - VOL8 pad[0x80]; /* 8200 */ - VOL32 src_addr; /* 8280 */ - VOL32 dst_addr; /* 8284 */ - VOL32 pitch; /* 8288 */ - VOL32 dimension; /* 828c */ - VOL32 fg; /* 8290 */ - VOL32 bg; /* 8294 */ - - - VOL32 clip_ul; /* 82a0 */ - VOL32 clip_br; /* 82a4 */ - - VOL16 cmd; /* 82aa */ - - VOL8 pattern[256]; /* 82ac */ - -} SisAccel; - -typedef struct _sis530 { - union { - SisGeneral general; - SisLine line; - SisTransparent transparent; - SisMultiple multiple; - SisTrapezoid trapezoid; - SisAccel accel; - } u; -} SisRec, *SisPtr; - -typedef struct _sisCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; -} SisCursor; - -#define SIS_CURSOR_WIDTH 64 -#define SIS_CURSOR_HEIGHT 64 - -typedef struct _sisClock { - CARD32 vclk_numerator; - BOOL vclk_divide_by_2; - CARD32 vclk_denominator; - CARD32 vclk_post_scale; - BOOL vclk_post_scale_2; - BOOL high_speed_dac; -} SisClockRec, *SisClockPtr; - -typedef struct _crtc { - - union { - struct { - CARD8 _io_address_select : 1; - CARD8 _display_ram_enable : 1; - CARD8 _clock_select : 2; - CARD8 : 1; - CARD8 _odd_even_page : 1; - CARD8 _h_sync_polarity : 1; - CARD8 _v_sync_polarity : 1; - } _misc_output_s; - CARD8 _misc_output; - } _misc_output_u; /* 3CC/3C2 */ - -#define misc_output _misc_output_u._misc_output -#define io_address_select _misc_output_u._misc_output_s._io_address_select -#define display_ram_enable _misc_output_u._misc_output_s._display_ram_enable -#define clock_select _misc_output_u._misc_output_s._clock_select -#define odd_even_page _misc_output_u._misc_output_s._odd_even_page -#define h_sync_polarity _misc_output_u._misc_output_s._h_sync_polarity -#define v_sync_polarity _misc_output_u._misc_output_s._v_sync_polarity - - CARD8 h_total_0_7; /* CR0 */ - CARD8 h_display_end_0_7; /* CR1 */ - CARD8 h_blank_start_0_7; /* CR2 */ - union { - struct { - CARD8 _h_blank_end_0_4 : 5; - CARD8 _display_skew : 2; - CARD8 : 1; - } _h_blank_end_s; - CARD8 __h_blank_end; /* CR3 */ - } _h_blank_end_u; -#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4 -#define display_skew _h_blank_end_u._h_blank_end_s._display_skew -#define _h_blank_end _h_blank_end_u.__h_blank_end - - CARD8 h_sync_start_0_7; /* CR4 */ - - union { - struct { - CARD8 _h_sync_end_0_4 : 5; - CARD8 _horizontal_skew : 2; - CARD8 _h_blank_end_5 : 1; - } _h_sync_end_s; - CARD8 __h_sync_end; /* CR5 */ - } _h_sync_end_u; - -#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4 -#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew -#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5 -#define _h_sync_end _h_sync_end_u.__h_sync_end - - CARD8 v_total_0_7; /* CR6 */ - - union { - struct { - CARD8 _v_total_8 : 1; - CARD8 _v_display_end_8 : 1; - CARD8 _v_retrace_start_8 : 1; - CARD8 _v_blank_start_8 : 1; - CARD8 _line_compare_8 : 1; - CARD8 _v_total_9 : 1; - CARD8 _v_display_end_9 : 1; - CARD8 _v_retrace_start_9 : 1; - } _crtc_overflow_s; - CARD8 _crtc_overflow; /* CR7 */ - } _crtc_overflow_u; - -#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8 -#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8 -#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8 -#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8 -#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8 -#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9 -#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9 -#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9 -#define crtc_overflow _crtc_overflow_u._crtc_overflow - - CARD8 preset_row_scan; /* CR8 (unused) */ - - union { - struct { - CARD8 ___max_scan_line : 5; - CARD8 _v_blank_start_9 : 1; - CARD8 _line_compare_9 : 1; - CARD8 _double_scan : 1; - } _max_scan_line_s; - CARD8 __max_scan_line; /* CR9 */ - } _max_scan_line_u; - -#define max_scan_line _max_scan_line_u._max_scan_line_s.___max_scan_line -#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9 -#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9 -#define double_scan _max_scan_line_u._max_scan_line_s._double_scan -#define _max_scan_line _max_scan_line_u.__max_scan_line - - CARD8 cursor_start; /* CRA */ - CARD8 cursor_end; /* CRB */ - - CARD8 start_address_8_15; /* CRC */ - CARD8 start_address_0_7; /* CRD */ - - CARD8 text_cursor_15_8; /* CRE */ - CARD8 text_cursor_7_0; /* CRF */ - - CARD8 cursor_loc_high; - CARD8 cursor_loc_low; - - CARD8 v_retrace_start_0_7; /* CR10 */ - union { - struct { - CARD8 _v_retrace_end_0_3 : 4; - CARD8 _clear_v_retrace_int : 1; - CARD8 _disable_v_retrace_int : 1; - CARD8 _refresh_cycle_select : 1; - CARD8 _lock_crtc : 1; - } _v_retrace_end_s; - CARD8 __v_retrace_end; /* CR11 */ - } _v_retrace_end_u; - -#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3 -#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int -#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int -#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select -#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc -#define _v_retrace_end _v_retrace_end_u.__v_retrace_end - - CARD8 v_display_end_0_7; /* CR12 */ - - CARD8 screen_off_0_7; /* CR13 */ - - union { - struct { - CARD8 ___underline_location : 5; - CARD8 _count_by_four : 1; - CARD8 _doubleword_mode : 1; - CARD8 : 1; - } _underline_location_s; - CARD8 __underline_location; /* CR14 */ - } _underline_location_u; - -#define underline_location _underline_location_u._underline_location_s.___underline_location -#define count_by_four _underline_location_u._underline_location_s._count_by_four -#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode -#define _underline_location _underline_location_u.__underline_location - - CARD8 v_blank_start_0_7; /* CR15 */ - CARD8 v_blank_end_0_7; /* CR16 */ - - union { - struct { - CARD8 _two_bk_cga : 1; - CARD8 _four_bk_cga : 1; - CARD8 _v_total_double : 1; - CARD8 _count_by_two : 1; - CARD8 : 1; - CARD8 _address_wrap : 1; - CARD8 _byte_mode : 1; - CARD8 _hardware_reset : 1; - } _crtc_mode_s; - CARD8 _crtc_mode; /* CR17 */ - } _crtc_mode_u; - -#define crtc_mode _crtc_mode_u._crtc_mode -#define two_bk_cga _crtc_mode_u._crtc_mode_s._two_bk_cga -#define four_bk_cga _crtc_mode_u._crtc_mode_s._four_bk_cga -#define v_total_double _crtc_mode_u._crtc_mode_s._v_total_double -#define count_by_two _crtc_mode_u._crtc_mode_s._count_by_two -#define address_wrap _crtc_mode_u._crtc_mode_s._address_wrap -#define byte_mode _crtc_mode_u._crtc_mode_s._byte_mode -#define hardware_reset _crtc_mode_u._crtc_mode_s._hardware_reset - - CARD8 line_compare_0_7; /* CR18 (unused) */ - - union { - struct { - CARD8 _graphics_mode_enable : 1; - CARD8 _attribute_byte_mda : 1; - CARD8 _line_graphics_enable : 1; - CARD8 _background_blink : 1; - CARD8 : 1; - CARD8 _pel_panning_compat : 1; - CARD8 _pixel_clock_double : 1; - CARD8 p4_p5_source_select : 1; - } _mode_control_s; - CARD8 _mode_control; - } _mode_control_u; /* AR10 */ - -#define mode_control _mode_control_u._mode_control -#define graphics_mode_enable _mode_control_u._mode_control_s._graphics_mode_enable -#define pixel_clock_double _mode_control_u._mode_control_s._pixel_clock_double - - CARD8 screen_border_color; /* AR11 */ - CARD8 enable_color_plane; /* AR12 */ - CARD8 horizontal_pixel_pan; /* AR13 */ - - union { - struct { - CARD8 _write_mode : 2; - CARD8 : 1; - CARD8 _read_mode : 1; - CARD8 _odd_even_addressing : 1; - CARD8 _shift_register_mode : 1; - CARD8 _color_mode_256 : 1; - CARD8 : 1; - } _mode_register_s; - CARD8 _mode_register; - } _mode_register_u; /* GR5 */ - -#define mode_register _mode_register_u._mode_register -#define color_mode_256 _mode_register_u._mode_register_s._color_mode_256 -#define odd_even_addressing _mode_register_u._mode_register_s._odd_even_addressing - - union { - struct { - CARD8 _graphics_enable : 1; - CARD8 _chain_odd_even : 1; - CARD8 _memory_address_select : 2; - CARD8 : 4; - } _misc_register_s; - CARD8 _misc_register; - } _misc_register_u; /* GR6 */ - -#define misc_register _misc_register_u._misc_register -#define graphics_enable _misc_register_u._misc_register_s._graphics_enable -#define chain_odd_even _misc_register_u._misc_register_s._chain_odd_even -#define memory_address_select _misc_register_u._misc_register_s._memory_address_select - - CARD8 color_dont_care; /* GR7 */ - - union { - struct { - CARD8 _dot_clock_8_9 : 1; - CARD8 : 1; - CARD8 _shifter_load_16 : 1; - CARD8 _dot_clock_divide_2 : 1; - CARD8 _shifter_load_32 : 1; - CARD8 _display_off : 1; - CARD8 : 2; - } _clock_mode_s; - CARD8 _clock_mode; - } _clock_mode_u; /* SR1 */ - -#define clock_mode _clock_mode_u._clock_mode -#define dot_clock_8_9 _clock_mode_u._clock_mode_s._dot_clock_8_9 -#define shifter_load_16 _clock_mode_u._clock_mode_s._shifter_load_16 -#define dot_clock_divide_2 _clock_mode_u._clock_mode_s._dot_clock_divide_2 -#define shifter_load_32 _clock_mode_u._clock_mode_s._shifter_load_32 -#define display_off _clock_mode_u._clock_mode_s._display_off - - CARD8 color_plane_w_enable; /* SR2 */ - - union { - struct { - CARD8 : 1; - CARD8 _extended_memory_size : 1; - CARD8 _odd_even_disable : 1; - CARD8 _chain_4_enable : 1; - CARD8 : 4; - } _memory_mode_s; - CARD8 _memory_mode; - } _memory_mode_u; /* SR4 */ - -#define memory_mode _memory_mode_u._memory_mode -#define extended_memory_sz _memory_mode_u._memory_mode_s._extended_memory_size -#define odd_even_disable _memory_mode_u._memory_mode_s._odd_even_disable -#define chain_4_enable _memory_mode_u._memory_mode_s._chain_4_enable - - union { - struct { - CARD8 _enhanced_text_mode : 1; - CARD8 _enhanced_graphics_mode : 1; - CARD8 _graphics_mode_32k : 1; - CARD8 _graphics_mode_64k : 1; - CARD8 _graphics_mode_true : 1; - CARD8 _graphics_mode_interlaced: 1; - CARD8 _graphics_mode_hw_cursor: 1; - CARD8 _graphics_mode_linear : 1; - } _graphics_mode_s; - CARD8 _graphics_mode; - } _graphics_mode_u; /* SR6 */ - -#define graphics_mode _graphics_mode_u._graphics_mode -#define enhanced_text_mode _graphics_mode_u._graphics_mode_s._enhanced_text_mode -#define enhanced_graphics_mode _graphics_mode_u._graphics_mode_s._enhanced_graphics_mode -#define graphics_mode_32k _graphics_mode_u._graphics_mode_s._graphics_mode_32k -#define graphics_mode_64k _graphics_mode_u._graphics_mode_s._graphics_mode_64k -#define graphics_mode_true _graphics_mode_u._graphics_mode_s._graphics_mode_true -#define graphics_mode_interlaced _graphics_mode_u._graphics_mode_s._graphics_mode_interlaced -#define graphics_mode_hw_cursor _graphics_mode_u._graphics_mode_s._graphics_mode_hw_cursor -#define graphics_mode_linear _graphics_mode_u._graphics_mode_s._graphics_mode_linear - - union { - struct { - CARD8 _external_dac_reference : 1; - CARD8 _high_speed_dac_0 : 1; - CARD8 _direct_color_24bit : 1; - CARD8 _multi_line_prefetch : 1; - CARD8 _extended_video_div_2 : 1; - CARD8 _ramdac_power_save : 1; - CARD8 : 1; - CARD8 _merge_video_fifo : 1; - } _misc_control_0_s; - CARD8 _misc_control_0; - } _misc_control_0_u; /* SR7 */ - -#define misc_control_0 _misc_control_0_u._misc_control_0 -#define external_dac_reference _misc_control_0_u._misc_control_0_s._external_dac_reference -#define high_speed_dac_0 _misc_control_0_u._misc_control_0_s._high_speed_dac_0 -#define direct_color_24bit _misc_control_0_u._misc_control_0_s._direct_color_24bit -#define multi_line_prefetch _misc_control_0_u._misc_control_0_s._multi_line_prefetch -#define extended_video_div_2 _misc_control_0_u._misc_control_0_s._extended_video_div_2 -#define ramdac_power_save _misc_control_0_u._misc_control_0_s._ramdac_power_save -#define merge_video_fifo _misc_control_0_u._misc_control_0_s._merge_video_fifo - - union { - struct { - CARD8 _crt_engine_threshold_high_0_3 : 4; - CARD8 _crt_cpu_threshold_low_0_3 : 4; - } _crt_cpu_threshold_control_0_s; - CARD8 _crt_cpu_threshold_control_0; - } _crt_cpu_threshold_control_0_u; /* SR8 */ - -#define crt_cpu_threshold_control_0 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0 -#define crt_engine_threshold_high_0_3 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0_s._crt_engine_threshold_high_0_3 -#define crt_cpu_threshold_low_0_3 _crt_cpu_threshold_control_0_u._crt_cpu_threshold_control_0_s._crt_cpu_threshold_low_0_3 - - union { - struct { - CARD8 _crt_cpu_threshold_high_0_3 : 4; - CARD8 _ascii_attribute_threshold_0_2 : 3; - CARD8 _true_color_32bpp : 1; - } _crt_cpu_threshold_control_1_s; - CARD8 _crt_cpu_threshold_control_1; - } _crt_cpu_threshold_control_1_u; /* SR9 */ - -#define crt_cpu_threshold_control_1 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1 -#define crt_cpu_threshold_high_0_3 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._crt_cpu_threshold_high_0_3 -#define ascii_attribute_threshold_0_2 _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._ascii_attribute_threshold_0_2 -#define true_color_32bpp _crt_cpu_threshold_control_1_u._crt_cpu_threshold_control_1_s._true_color_32bpp - - union { - struct { - CARD8 _v_total_10 : 1; - CARD8 _v_display_end_10 : 1; - CARD8 _v_blank_start_10 : 1; - CARD8 _v_retrace_start_10 : 1; - CARD8 _screen_off_8_11 : 4; - } _extended_crt_overflow_s; - CARD8 _extended_crt_overflow; - } _extended_crt_overflow_u; /* SRA */ - -#define extended_crt_overflow _extended_crt_overflow_u._extended_crt_overflow -#define v_total_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_total_10 -#define v_display_end_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_display_end_10 -#define v_blank_start_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_blank_start_10 -#define v_retrace_start_10 _extended_crt_overflow_u._extended_crt_overflow_s._v_retrace_start_10 -#define screen_off_8_11 _extended_crt_overflow_u._extended_crt_overflow_s._screen_off_8_11 - - union { - struct { - CARD8 _cpu_bitblt_enable : 1; /* enable CPU bitblt */ - CARD8 _packed_16_color_enable : 1; /* 2 pixels per byte? */ - CARD8 _io_gating : 1; /* when write buffer not empty */ - CARD8 _dual_segment_enable : 1; /* ? */ - CARD8 _true_color_modulation : 1; /* ? */ - CARD8 _memory_mapped_mode : 2; /* mmio enable */ - CARD8 _true_color_order : 1; /* 0: RGB 1: BGR */ - } _misc_control_1_s; - CARD8 _misc_control_1; /* SRB */ - } _misc_control_1_u; - -#define misc_control_1 _misc_control_1_u._misc_control_1 -#define cpu_bitblt_enable _misc_control_1_u._misc_control_1_s._cpu_bitblt_enable -#define memory_mapped_mode _misc_control_1_u._misc_control_1_s._memory_mapped_mode -#define true_color_modulation _misc_control_1_u._misc_control_1_s._true_color_modulation -#define true_color_order _misc_control_1_u._misc_control_1_s._true_color_order - - union { - struct { - CARD8 _sync_reset_enable : 1; - CARD8 _memory_configuration : 3; -#define SIS_MEMORY_CONFIG_1M_1BANK 0 -#define SIS_MEMORY_CONFIG_2M_2BANK 1 -#define SIS_MEMORY_CONFIG_4M_2BANK 2 -#define SIS_MEMORY_CONFIG_2M_1BANK 5 -#define SIS_MEMORY_CONFIG_4M_1BANK 6 -#define SIS_MEMORY_CONFIG_8M_2BANK 7 - CARD8 _test_mode_enable : 1; - CARD8 _read_ahead_enable : 1; - CARD8 _text_mode_16bit_enable : 1; - CARD8 _graphics_mode_32bit_enable : 1; - } _misc_control_2_s; - CARD8 _misc_control_2; - } _misc_control_2_u; /* SRC */ - -#define misc_control_2 _misc_control_2_u._misc_control_2 -#define sync_reset_enable _misc_control_2_u._misc_control_2_s._sync_reset_enable -#define memory_configuration _misc_control_2_u._misc_control_2_s._memory_configuration -#define test_mode_enable _misc_control_2_u._misc_control_2_s._test_mode_enable -#define read_ahead_enable _misc_control_2_u._misc_control_2_s._read_ahead_enable -#define text_mode_16bit_enable _misc_control_2_u._misc_control_2_s._text_mode_16bit_enable -#define graphics_mode_32bit_enable _misc_control_2_u._misc_control_2_s._graphics_mode_32bit_enable - - union ddc_and_power_control_u { - struct { - CARD8 _ddc_clk_programming : 1; - CARD8 _ddc_data_programming : 1; - CARD8 : 1; - CARD8 _acpi_enable : 1; - CARD8 _kbd_cursor_activate : 1; - CARD8 _video_memory_activate : 1; - CARD8 _vga_standby : 1; - CARD8 _vga_suspend : 1; - } _ddc_and_power_control_s; - CARD8 _ddc_and_power_control; - } _ddc_and_power_control_u; /* SR11 */ - -#define ddc_and_power_control _ddc_and_power_control_u._ddc_and_power_control -#define ddc_clk_programming _ddc_and_power_control_u._ddc_and_power_control_s._ddc_clk_programming -#define ddc_data_programming _ddc_and_power_control_u._ddc_and_power_control_s._ddc_data_programming -#define acpi_enable _ddc_and_power_control_u._ddc_and_power_control_s._acpi_enable -#define kbd_cursor_activate _ddc_and_power_control_u._ddc_and_power_control_s._kbd_cursor_activate -#define video_memory_activate _ddc_and_power_control_u._ddc_and_power_control_s._video_memory_activate -#define vga_standby _ddc_and_power_control_u._ddc_and_power_control_s._vga_standby -#define vga_suspend _ddc_and_power_control_u._ddc_and_power_control_s._vga_suspend - - union { - struct { - CARD8 _h_total_8 : 1; - CARD8 _h_display_end_8 : 1; - CARD8 _h_blank_start_8 : 1; - CARD8 _h_sync_start_8 : 1; - CARD8 _h_blank_end_6 : 1; - CARD8 _h_retrace_skew : 3; - } _extended_horizontal_overflow_s; - CARD8 _extended_horizontal_overflow; - } _extended_horizontal_overflow_u; /* SR12 */ -#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow -#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8 -#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8 -#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8 -#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8 -#define h_blank_end_6 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_end_6 -#define h_retrace_skew _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_retrace_skew - - union { - struct { - CARD8 : 6; - CARD8 _vclk_post_scale_2 : 1; - CARD8 _mclk_post_scale_2 : 1; - } _extended_clock_generator_s; - CARD8 _extended_clock_generator; - } _extended_clock_generator_u; /* SR13 */ - -#define extended_clock_generator _extended_clock_generator_u._extended_clock_generator -#define vclk_post_scale_2 _extended_clock_generator_u._extended_clock_generator_s._vclk_post_scale_2 -#define mclk_post_scale_2 _extended_clock_generator_u._extended_clock_generator_s._mclk_post_scale_2 - - CARD8 cursor_0_red; /* SR14 */ - CARD8 cursor_0_green; /* SR15 */ - CARD8 cursor_0_blue; /* SR16 */ - - CARD8 cursor_1_red; /* SR17 */ - CARD8 cursor_1_green; /* SR18 */ - CARD8 cursor_1_blue; /* SR19 */ - - CARD8 cursor_h_start_0_7; /* SR1A */ - union { - struct { - CARD8 _cursor_h_start_8_11 : 4; - CARD8 : 3; - CARD8 _cursor_mmio_enable : 1; - } _cusor_h_start_1_s; - CARD8 _cursor_h_start_1; - } _cursor_h_start_1_u; /* SR1B */ - -#define cursor_h_start_1 _cursor_h_start_1_u._cursor_h_start_1 -#define cursor_h_start_8_11 _cursor_h_start_1_u._cursor_h_start_1_s._cursor_h_start_8_11 - - CARD8 cursor_h_preset_0_5; /* SR1C */ - - CARD8 cursor_v_start_0_7; /* SR1D */ - - union { - struct { - CARD8 _cursor_v_start_8_10 : 3; - CARD8 _cursor_side_pattern : 1; - CARD8 _cursor_pattern : 4; - } _cusor_v_start_1_s; - CARD8 _cursor_v_start_1; - } _cursor_v_start_1_u; /* SR1E */ - -#define cursor_v_start_1 _cursor_v_start_1_u._cursor_v_start_1 - - CARD8 cursor_v_preset_0_5; /* SR1F */ - - CARD8 linear_base_19_26; /* SR20 */ - - union { - struct { - CARD8 _linear_base_27_31 : 5; - CARD8 _linear_aperture : 3; -#define SIS_LINEAR_APERTURE_512K 0 -#define SIS_LINEAR_APERTURE_1M 1 -#define SIS_LINEAR_APERTURE_2M 2 -#define SIS_LINEAR_APERTURE_4M 3 -#define SIS_LINEAR_APERTURE_8M 4 - } _linear_base_1_s; - CARD8 _linear_base_1; - } _linear_base_1_u; /* SR21 */ - -#define linear_base_1 _linear_base_1_u._linear_base_1 -#define linear_base_27_31 _linear_base_1_u._linear_base_1_s._linear_base_27_31 -#define linear_aperture _linear_base_1_u._linear_base_1_s._linear_aperture - - union { - struct { - CARD8 _screen_start_addr_20 : 1; - CARD8 : 3; - CARD8 _continuous_mem_access : 1; - CARD8 : 1; - CARD8 _power_down_dac : 1; - CARD8 : 1; - } _graphics_engine_0_s; - CARD8 _graphics_engine_0; - } _graphics_engine_0_u; /* SR26 */ - -#define graphics_engine_0 _graphics_engine_0_u._graphics_engine_0 - - - union { - struct { - CARD8 _screen_start_addr_16_19: 4; - CARD8 _logical_screen_width : 2; -#define SIS_LOG_SCREEN_WIDTH_1024 0 -#define SIS_LOG_SCREEN_WIDTH_2048 1 -#define SIS_LOG_SCREEN_WIDTH_4096 2 - CARD8 _graphics_prog_enable : 1; - CARD8 _turbo_queue_enable : 1; - } _graphics_engine_1_s; - CARD8 _graphics_engine_1; - } _graphics_engine_1_u; /* SR27 */ - -#define graphics_engine_1 _graphics_engine_1_u._graphics_engine_1 -#define screen_start_addr_16_19 _graphics_engine_1_u._graphics_engine_1_s._screen_start_addr_16_19 -#define logical_screen_width _graphics_engine_1_u._graphics_engine_1_s._logical_screen_width -#define graphics_prog_enable _graphics_engine_1_u._graphics_engine_1_s._graphics_prog_enable -#define turbo_queue_enable _graphics_engine_1_u._graphics_engine_1_s._turbo_queue_enable - - - union { - struct { - CARD8 _mclk_numerator : 7; - CARD8 _mclk_divide_by_2 : 1; - } _internal_mclk_0_s; - CARD8 _internal_mclk_0; - } _internal_mclk_0_u; /* SR28 */ - -#define internal_mclk_0 _internal_mclk_0_u._internal_mclk_0 -#define mclk_numerator _internal_mclk_0_u._internal_mclk_0_s._mclk_numerator -#define mclk_divide_by_2 _internal_mclk_0_u._internal_mclk_0_s._mclk_divide_by_2 - - union { - struct { - CARD8 _mclk_denominator : 5; - CARD8 _mclk_post_scale : 2; -#define SIS_MCLK_POST_SCALE_1 0 -#define SIS_MCLK_POST_SCALE_2 1 -#define SIS_MCLK_POST_SCALE_3 2 -#define SIS_MCLK_POST_SCALE_4 3 - CARD8 _mclk_vco_gain : 1; - } _internal_mclk_1_s; - CARD8 _internal_mclk_1; - } _internal_mclk_1_u; /* SR29 */ - -#define internal_mclk_1 _internal_mclk_1_u._internal_mclk_1 -#define mclk_denominator _internal_mclk_1_u._internal_mclk_1_s._mclk_denominator -#define mclk_post_scale _internal_mclk_1_u._internal_mclk_1_s._mclk_post_scale -#define mclk_vco_gain _internal_mclk_1_u._internal_mclk_1_s._mclk_vco_gain - - union { - struct { - CARD8 _vclk_numerator : 7; - CARD8 _vclk_divide_by_2 : 1; - } _internal_vclk_0_s; - CARD8 _internal_vclk_0; - } _internal_vclk_0_u; /* SR2A */ - -#define internal_vclk_0 _internal_vclk_0_u._internal_vclk_0 -#define vclk_numerator _internal_vclk_0_u._internal_vclk_0_s._vclk_numerator -#define vclk_divide_by_2 _internal_vclk_0_u._internal_vclk_0_s._vclk_divide_by_2 - - union { - struct { - CARD8 _vclk_denominator : 5; - CARD8 _vclk_post_scale : 2; -#define SIS_VCLK_POST_SCALE_1 0 -#define SIS_VCLK_POST_SCALE_2 1 -#define SIS_VCLK_POST_SCALE_3 2 -#define SIS_VCLK_POST_SCALE_4 3 - CARD8 _vclk_vco_gain : 1; - } _internal_vclk_1_s; - CARD8 _internal_vclk_1; - } _internal_vclk_1_u; /* SR2B */ - -#define internal_vclk_1 _internal_vclk_1_u._internal_vclk_1 -#define vclk_denominator _internal_vclk_1_u._internal_vclk_1_s._vclk_denominator -#define vclk_post_scale _internal_vclk_1_u._internal_vclk_1_s._vclk_post_scale -#define vclk_vco_gain _internal_vclk_1_u._internal_vclk_1_s._vclk_vco_gain - - union { - struct { - CARD8 _extended_clock_select : 2; -#define SIS_CLOCK_SELECT_INTERNAL 0 -#define SIS_CLOCK_SELECT_25MHZ 1 -#define SIS_CLOCK_SELECT_28MHZ 2 - CARD8 _disable_line_compare : 1; - CARD8 _disable_pci_read_t_o : 1; - CARD8 _cursor_start_addr_18_21: 4; - } _misc_control_7_s; - CARD8 _misc_control_7; - } _misc_control_7_u; /* SR38 */ - -#define misc_control_7 _misc_control_7_u._misc_control_7 -#define extended_clock_select _misc_control_7_u._misc_control_7_s._extended_clock_select -#define disable_line_compare _misc_control_7_u._misc_control_7_s._disable_line_compare -#define disable_pci_read_t_o _misc_control_7_u._misc_control_7_s._disable_pci_read_t_o -#define cursor_start_addr_18_21 _misc_control_7_u._misc_control_7_s._cursor_start_addr_18_21 - - union { - struct { - CARD8 _high_speed_dclk : 1; - CARD8 _sgram_block_write : 1; - CARD8 _cursor_start_addr_22 : 1; - CARD8 _dram_texture_read : 1; - CARD8 _sgram_16mb : 1; - CARD8 _agp_signal_delay : 2; - CARD8 _dclk_off : 1; - } _misc_control_11_s; - CARD8 _misc_control_11; - } _misc_control_11_u; /* SR3E */ - -#define misc_control_11 _misc_control_11_u._misc_control_11 -#define high_speed_dclk _misc_control_11_u._misc_control_11_s._high_speed_dclk -#define sgram_block_write _misc_control_11_u._misc_control_11_s.__sgram_block_write -#define cursor_start_addr_22 _misc_control_11_u._misc_control_11_s._cursor_start_addr_22 -#define dram_texture_read _misc_control_11_u._misc_control_11_s._dram_texture_read -#define sgram_16mb _misc_control_11_u._misc_control_11_s._sgram_16mb -#define agp_signal_delay _misc_control_11_u._misc_control_11_s._agp_signal_delay -#define dclk_off _misc_control_11_u._misc_control_11_s._dclk_off - - union { - struct { - CARD8 : 1; - CARD8 _flat_panel_low_enable : 1; - CARD8 _crt_cpu_threshold_low_4: 1; - CARD8 _crt_engine_threshold_high_4: 1; - CARD8 _crt_cpu_threshold_high_4 : 1; - CARD8 _crt_threshold_full_control : 2; -#define SIS_CRT_32_STAGE_THRESHOLD 0 -#define SIS_CRT_64_STAGE_THRESHOLD 1 -#define SIS_CRT_63_STAGE_THRESHOLD 2 -#define SIS_CRT_256_STAGE_THRESHOLD 3 - CARD8 _high_speed_dac_1 : 1; - } _misc_control_12_s; - CARD8 _misc_control_12; - } _misc_control_12_u; /* SR3F */ -#define misc_control_12 _misc_control_12_u._misc_control_12 -#define flat_panel_low_enable _misc_control_12_u._misc_control_12_s._flat_panel_low_enable -#define crt_cpu_threshold_low_4 _misc_control_12_u._misc_control_12_s._crt_cpu_threshold_low_4 -#define crt_engine_threshold_high_4 _misc_control_12_u._misc_control_12_s._crt_engine_threshold_high_4 -#define crt_cpu_threshold_high_4 _misc_control_12_u._misc_control_12_s._crt_cpu_threshold_high_4 -#define crt_threshold_full_control _misc_control_12_u._misc_control_12_s._crt_threshold_full_control -#define high_speed_dac_1 _misc_control_12_u._misc_control_12_s._high_speed_dac_1 - - /* computed values */ - CARD16 ge_screen_pitch; - CARD8 bits_per_pixel; - CARD8 depth; - CARD8 double_pixel_mode; - CARD16 pixel_width; -} SisCrtc; - -#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \ - ((crtc)->v_total_8 << 8) | \ - ((crtc)->v_total_9 << 9) | \ - ((crtc)->v_total_10 << 10)) - -#define crtc_set_v_total(crtc,v) { \ - ((crtc))->v_total_0_7 = (v); \ - ((crtc))->v_total_8 = (v) >> 8; \ - ((crtc))->v_total_9 = (v) >> 9; \ - ((crtc))->v_total_10 = (v) >> 10; \ -} - -#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \ - ((crtc)->v_display_end_8 << 8) | \ - ((crtc)->v_display_end_9 << 9) | \ - ((crtc)->v_display_end_10 << 10)) - -#define crtc_set_v_display_end(crtc,v) {\ - ((crtc))->v_display_end_0_7 = (v); \ - ((crtc))->v_display_end_8 = (v) >> 8; \ - ((crtc))->v_display_end_9 = (v) >> 9; \ - ((crtc))->v_display_end_10 = (v) >> 10; \ -} - -#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \ - ((crtc)->v_retrace_start_8 << 8) | \ - ((crtc)->v_retrace_start_9 << 9) | \ - ((crtc)->v_retrace_start_10 << 10)) - -#define crtc_set_v_retrace_start(crtc,v) {\ - ((crtc))->v_retrace_start_0_7 = (v); \ - ((crtc))->v_retrace_start_8 = (v) >> 8; \ - ((crtc))->v_retrace_start_9 = (v) >> 9; \ - ((crtc))->v_retrace_start_10 = (v) >> 10; \ -} - -#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \ - ((crtc)->v_blank_start_8 << 8) | \ - ((crtc)->v_blank_start_9 << 9) | \ - ((crtc)->v_blank_start_10 << 10)) - -#define crtc_set_v_blank_start(crtc,v) {\ - ((crtc))->v_blank_start_0_7 = (v); \ - ((crtc))->v_blank_start_8 = (v) >> 8; \ - ((crtc))->v_blank_start_9 = (v) >> 9; \ - ((crtc))->v_blank_start_10 = (v) >> 10; \ -} - -#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \ - ((crtc)->h_total_8 << 8)) - -#define crtc_set_h_total(crtc,v) {\ - ((crtc))->h_total_0_7 = (v); \ - ((crtc))->h_total_8 = (v) >> 8; \ -} - -#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \ - ((crtc)->h_display_end_8 << 8)) - -#define crtc_set_h_display_end(crtc,v) {\ - ((crtc))->h_display_end_0_7 = (v); \ - ((crtc))->h_display_end_8 = (v) >> 8; \ -} - -#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \ - ((crtc)->h_blank_start_8 << 8)) - -#define crtc_set_h_blank_start(crtc,v) {\ - ((crtc))->h_blank_start_0_7 = (v); \ - ((crtc))->h_blank_start_8 = (v) >> 8; \ -} - -#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \ - ((crtc)->h_blank_end_5 << 5)) - -#define crtc_set_h_blank_end(crtc,v) {\ - ((crtc))->h_blank_end_0_4 = (v); \ - ((crtc))->h_blank_end_5 = (v) >> 5; \ -} - -#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \ - ((crtc)->h_sync_start_8 << 8)) - -#define crtc_set_h_sync_start(crtc,v) {\ - ((crtc))->h_sync_start_0_7 = (v); \ - ((crtc))->h_sync_start_8 = (v) >> 8; \ -} - -#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4) - -#define crtc_set_h_sync_end(crtc,v) {\ - ((crtc))->h_sync_end_0_4 = (v); \ -} - -#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \ - ((crtc)->screen_off_8_11 << 8)) - -#define crtc_set_screen_off(crtc,v) {\ - ((crtc))->screen_off_0_7 = (v); \ - ((crtc))->screen_off_8_11 = (v) >> 8; \ -} - -#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \ - ((crtc)->ge_screen_width_2 << 2)) - -#define crtc_set_ge_screen_width(crtc,v) { \ - (crtc)->ge_screen_width_0_1 = (v); \ - (crtc)->ge_screen_width_2 = (v) >> 2; \ -} - -#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \ - ((crtc)->h_start_fifo_fetch_8 << 8)) - -#define crtc_set_h_start_fifo_fetch(crtc,v) {\ - (crtc)->h_start_fifo_fetch_0_7 = (v); \ - (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \ -} - -#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \ - ((crtc)->start_address_8_15 << 8) | \ - ((crtc)->start_address_16_19 << 16)) - -#define crtc_set_start_address(crtc,v) {\ - (crtc)->start_address_0_7 = (v); \ - (crtc)->start_address_8_15 = (v) >> 8; \ - (crtc)->start_address_16_19 = (v) >> 16; \ -} - -#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \ - ((crtc)->line_compare_8 << 8) | \ - ((crtc)->line_compare_9 << 9) | \ - ((crtc)->line_compare_10 << 10)) - -#define crtc_set_line_compare(crtc,v) { \ - ((crtc))->line_compare_0_7 = (v); \ - ((crtc))->line_compare_8 = (v) >> 8; \ - ((crtc))->line_compare_9 = (v) >> 9; \ - ((crtc))->line_compare_10 = (v) >> 10; \ -} - -#define crtc_set_cursor_start_addr(crtc,v) { \ - (crtc)->cursor_start_addr_18_21 = (v) >> 18; \ - (crtc)->cursor_start_addr_22 = (v) >> 22; \ -} - -#define _sisOutb(v,r) outb(v,r) -#define _sisInb(r) inb(r) - -#define SIS_DAC_INDEX_READ 0x47 -#define SIS_DAC_INDEX_WRITE 0x48 -#define SIS_DAC_DATA 0x49 - -#define GetCrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x54,i) -#define PutCrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x54,i,v) - -#define GetSrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x44,i) -#define PutSrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x44,i,v) - -#define GetArtc(sisc,i) _sisReadArtc ((sisc)->io_base+0x40,i) -#define PutArtc(sisc,i,v) _sisWriteArtc ((sisc)->io_base+0x40,i,v) - -#define GetGrtc(sisc,i) _sisReadIndexRegister ((sisc)->io_base+0x4e,i) -#define PutGrtc(sisc,i,v) _sisWriteIndexRegister ((sisc)->io_base+0x4e,i,v) - -#define _sisWaitVRetrace(sisc) - -#define LockSis(sisc) -#define UnlockSis(sisc) - -typedef struct _sisTiming { - /* label */ - int horizontal; - int vertical; - int rate; - /* horizontal timing */ - int hfp; /* front porch */ - int hbp; /* back porch */ - int hblank; /* blanking */ - /* vertical timing */ - int vfp; /* front porch */ - int vbp; /* back porch */ - int vblank; /* blanking */ -} SisTiming; - -#define SIS_TEXT_SAVE (64*1024) - -typedef struct _sisSave { - CARD8 srb; - CARD8 sr5; - SisCrtc crtc; - CARD8 text_save[SIS_TEXT_SAVE]; -} SisSave; - -typedef struct _sisCardInfo { - SisPtr sis; - int memory; - CARD8 *frameBuffer; - CARD8 *registers; - VOL32 *cpu_bitblt; - CARD32 io_base; - SisSave save; -} SisCardInfo; - -typedef struct _sisScreenInfo { - CARD8 *cursor_base; - CARD32 cursor_off; - CARD8 *expand; - CARD32 expand_off; - int expand_len; - SisCursor cursor; -} SisScreenInfo; - -#define getSisCardInfo(kd) ((SisCardInfo *) ((kd)->card->driver)) -#define sisCardInfo(kd) SisCardInfo *sisc = getSisCardInfo(kd) - -#define getSisScreenInfo(kd) ((SisScreenInfo *) ((kd)->screen->driver)) -#define sisScreenInfo(kd) SisScreenInfo *siss = getSisScreenInfo(kd) - -Bool sisCardInit (KdCardInfo *); -Bool sisScreenInit (KdScreenInfo *); -Bool sisEnable (ScreenPtr pScreen); -void sisDisable (ScreenPtr pScreen); -void sisFini (ScreenPtr pScreen); - -Bool sisCursorInit (ScreenPtr pScreen); -void sisCursorEnable (ScreenPtr pScreen); -void sisCursorDisable (ScreenPtr pScreen); -void sisCursorFini (ScreenPtr pScreen); -void sisRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs); - -Bool sisDrawInit (ScreenPtr pScreen); -void sisDrawEnable (ScreenPtr pScreen); -void sisDrawSync (ScreenPtr pScreen); -void sisDrawDisable (ScreenPtr pScreen); -void sisDrawFini (ScreenPtr pScreen); - -void sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); -void sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -void SISInitCard (KdCardAttr *attr); - -CARD8 _sisReadIndexRegister (CARD32 base, CARD8 index); -void _sisWriteIndexRegister (CARD32 base, CARD8 index, CARD8 value); -CARD8 _sisReadArtc (CARD32 base, CARD8 index); -void _sisWriteArtc (CARD32 base, CARD8 index, CARD8 value); - -extern KdCardFuncs sisFuncs; - -/* - * sisclock.c - */ -void -sisGetClock (unsigned long clock, SisCrtc *crtc); - -void -sisEngThresh (SisCrtc *crtc, unsigned long vclk, int bpp); - -/* - * siscurs.c - */ - -Bool -sisCursorInit (ScreenPtr pScreen); - -void -sisCursorEnable (ScreenPtr pScreen); - -void -sisCursorDisable (ScreenPtr pScreen); - -void -sisCursorFini (ScreenPtr pScreen); - -/* sisdraw.c */ -Bool -sisDrawInit (ScreenPtr pScreen); - -void -sisDrawEnable (ScreenPtr pScreen); - -void -sisDrawDisable (ScreenPtr pScreen); - -void -sisDrawFini (ScreenPtr pScreen); - -#endif /* _SIS_H_ */ diff --git a/hw/kdrive/sis530/sisclock.c b/hw/kdrive/sis530/sisclock.c deleted file mode 100644 index f73cdac9d..000000000 --- a/hw/kdrive/sis530/sisclock.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" -#include <stdio.h> - -#define FREF 14318180 -#define MIN_VCO FREF -#define MAX_VCO 230000000 -#define MAX_PSN 0 /* no pre scaler for this chip */ -#define TOLERANCE 0.01 /* search smallest M and N in this tolerance */ -#define max_VLD 1 - -/* - * Compute clock values given target frequency - */ -void -sisGetClock (unsigned long clock, SisCrtc *crtc) -{ - unsigned char reg7, reg13, reg2a, reg2b; - int M, N, P, VLD; - - int bestM, bestN, bestP, bestPSN, bestVLD; - double bestError, abest = 42.0, bestFout; - - double Fvco, Fout; - double error, aerror; - - double target = (double) clock; - - int M_min = 2; - int M_max = 128; - - int low_N = 2; - int high_N = 32; - int PSN = 1; - - /* - * fd = fref*(Numerator/Denumerator)*(Divider/PostScaler) - * - * M = Numerator [1:128] - * N = DeNumerator [1:32] - * VLD = Divider (Vco Loop Divider) : divide by 1, 2 - * P = Post Scaler : divide by 1, 2, 3, 4 - * PSN = Pre Scaler (Reference Divisor Select) - * - * result in vclk[] - */ - - P = 1; - if (target < MAX_VCO / 2) - P = 2; - if (target < MAX_VCO / 3) - P = 3; - if (target < MAX_VCO / 4) - P = 4; - if (target < MAX_VCO / 6) - P = 6; - if (target < MAX_VCO / 8) - P = 8; - - Fvco = P * target; - - for (N = low_N; N <= high_N; N++) - { - double M_desired = Fvco / FREF * N; - - if (M_desired > M_max * max_VLD) - continue; - - if ( M_desired > M_max ) - { - M = (int)(M_desired / 2 + 0.5); - VLD = 2; - } - else - { - M = (int)(M_desired + 0.5); - VLD = 1; - } - - Fout = (double)FREF * (M * VLD)/(N * P); - error = (target - Fout) / target; - aerror = (error < 0) ? -error : error; - if (aerror < abest) - { - abest = aerror; - bestError = error; - bestM = M; - bestN = N; - bestP = P; - bestPSN = PSN; - bestVLD = VLD; - bestFout = Fout; - } - } - - crtc->vclk_numerator = bestM - 1; - crtc->vclk_divide_by_2 = bestVLD == 2; - - crtc->vclk_denominator = bestN - 1; - switch (bestP) { - case 1: - crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_1; - crtc->vclk_post_scale_2 = 0; - break; - case 2: - crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_2; - crtc->vclk_post_scale_2 = 0; - break; - case 3: - crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_3; - crtc->vclk_post_scale_2 = 0; - break; - case 4: - crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_4; - crtc->vclk_post_scale_2 = 0; - break; - case 6: - crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_3; - crtc->vclk_post_scale_2 = 1; - break; - case 8: - crtc->vclk_post_scale = SIS_VCLK_POST_SCALE_4; - crtc->vclk_post_scale_2 = 1; - break; - } - - crtc->vclk_vco_gain = 1; - - /* - * Don't know how to set mclk for local frame buffer; for - * shared frame buffer, mclk is hardwired to bus speed (100MHz)? - */ -} - -sisCalcMclk (SisCrtc *crtc) -{ - int mclk, Numer, DeNumer; - double Divider, Scalar; - - Numer = crtc->mclk_numerator; - DeNumer = crtc->mclk_denominator; - Divider = crtc->mclk_divide_by_2 ? 2.0 : 1.0; - Scalar = 1.0; - if (crtc->mclk_post_scale_2) - { - switch (crtc->mclk_post_scale) { - case 2: - Scalar = 6.0; - break; - case 3: - Scalar = 8.0; - break; - } - } - else - { - switch (crtc->mclk_post_scale) { - case 0: - Scalar = 1.0; - break; - case 1: - Scalar = 2.0; - break; - case 2: - Scalar = 3.0; - break; - case 3: - Scalar = 4.0; - break; - } - } - - mclk = (int)(FREF*((double)(Numer+1)/(double)(DeNumer+1))*(Divider/Scalar)); - - return(mclk); -} - -#define UMA_FACTOR 60 -#define LFB_FACTOR 30 // Only if local frame buffer -#define SIS_SAYS_SO 0x1F // But how is the performance?? -#define CRT_ENG_THRESH 0x0F // But how is the performance?? -#define BUS_WIDTH 64 -#define DFP_BUS_WIDTH 32 // rumour has it for digital flat panel ?? -#define MEGAHZ (1<<20) - -void -sisEngThresh (SisCrtc *crtc, unsigned long vclk, int bpp) -{ - int threshlow, mclk; - - mclk = sisCalcMclk(crtc) / 1000000; - vclk = vclk / 1000000; - threshlow = ((((UMA_FACTOR*vclk*bpp)/ - (mclk*BUS_WIDTH))+1)/2)+4; - - crtc->crt_cpu_threshold_low_0_3 = threshlow; - crtc->crt_cpu_threshold_low_4 = threshlow >> 4; - - crtc->crt_cpu_threshold_high_0_3 = (SIS_SAYS_SO & 0xf); - crtc->crt_cpu_threshold_high_4 = 0; - - crtc->crt_engine_threshold_high_0_3 = CRT_ENG_THRESH; - crtc->crt_engine_threshold_high_4 = 1; - - crtc->ascii_attribute_threshold_0_2 = (SIS_SAYS_SO >> 4); - - crtc->crt_threshold_full_control = SIS_CRT_64_STAGE_THRESHOLD; -} diff --git a/hw/kdrive/sis530/siscmap.c b/hw/kdrive/sis530/siscmap.c deleted file mode 100644 index 2a28420c8..000000000 --- a/hw/kdrive/sis530/siscmap.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" - -void -sisGetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - sisCardInfo(pScreenPriv); - - LockSis (sisc); - while (ndef--) - { - _sisOutb (pdefs->pixel, sisc->io_base+SIS_DAC_INDEX_READ); - pdefs->red = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10; - pdefs->green = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10; - pdefs->blue = _sisInb (sisc->io_base+SIS_DAC_DATA) << 10; - pdefs++; - } - UnlockSis (sisc); -} - -void -sisPutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - sisCardInfo(pScreenPriv); - - LockSis(sisc); - _sisWaitVRetrace (sisc); - while (ndef--) - { - _sisOutb (pdefs->pixel, sisc->io_base+SIS_DAC_INDEX_WRITE); - _sisOutb (pdefs->red >> 10, sisc->io_base+SIS_DAC_DATA); - _sisOutb (pdefs->green >> 10, sisc->io_base+SIS_DAC_DATA); - _sisOutb (pdefs->blue >> 10, sisc->io_base+SIS_DAC_DATA); - pdefs++; - } - UnlockSis(sisc); -} - diff --git a/hw/kdrive/sis530/siscurs.c b/hw/kdrive/sis530/siscurs.c deleted file mode 100644 index dad44471c..000000000 --- a/hw/kdrive/sis530/siscurs.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - sisCardInfo(pScreenPriv); \ - sisScreenInfo(pScreenPriv); \ - SisPtr sis = sisc->sis; \ - SisCursor *pCurPriv = &siss->cursor - -static void -_sisMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - - PutSrtc (sisc, 0x5, 0x86); - PutSrtc (sisc, 0x1c, xoff & 0x3f); - PutSrtc (sisc, 0x1f, yoff & 0x3f); - - PutSrtc (sisc, 0x1a, xlow); - PutSrtc (sisc, 0x1b, xhigh & 0xf); - - PutSrtc (sisc, 0x1d, ylow); - PutSrtc (sisc, 0x1e, yhigh & 0x7); -} - -static void -sisMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - LockSis(sisc); - _sisMoveCursor (pScreen, x, y); - UnlockSis(sisc); -} - -static void -_sisSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - /* set foreground */ - PutSrtc (sisc, 0x17, pCursor->foreRed >> 10); - PutSrtc (sisc, 0x18, pCursor->foreGreen >> 10); - PutSrtc (sisc, 0x19, pCursor->foreBlue >> 10); - - /* set background */ - PutSrtc (sisc, 0x14, pCursor->backRed >> 10); - PutSrtc (sisc, 0x15, pCursor->backGreen >> 10); - PutSrtc (sisc, 0x16, pCursor->backBlue >> 10); -} - -static void -sisLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - unsigned short *ram, r; - unsigned char *msk, *mskLine, *src, *srcLine; - unsigned short m, s; - - int i, j; - int cursor_address; - int src_stride, src_width; - - CARD8 sr6; - - /* - * Lock Sis so the cursor doesn't move while we're setting it - */ - LockSis(sisc); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (unsigned short *) siss->cursor_base; - mskLine = (unsigned char *) bits->mask; - srcLine = (unsigned char *) bits->source; - - h = bits->height; - if (h > SIS_CURSOR_HEIGHT) - h = SIS_CURSOR_HEIGHT; - - src_stride = BitmapBytePad(bits->width); /* bytes per line */ - src_width = (bits->width + 7) >> 3; - - for (i = 0; i < SIS_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += src_stride; - srcLine += src_stride; - for (j = 0; j < SIS_CURSOR_WIDTH / 8; j++) { - - unsigned short m, s; - - if (i < h && j < src_width) - { - m = *msk++; - s = *src++ & m; - m = ~m; - /* mask off right side */ - if (j == src_width - 1 && (bits->width & 7)) - { - m |= 0xff << (bits->width & 7); - } - } - else - { - m = 0xff; - s = 0x00; - } - - /* - * The SIS530 HW cursor format is: source(AND) bit, - * then a mask(XOR) bit, etc. - * byte swapping in sis530 is: - * abcd ==> cdab - */ - -#define bit(a,n) (((a) >> (n)) & 0x1) - - r = ((bit(m, 0) << 7) | (bit(s, 0) << 6) | - (bit(m, 1) << 5) | (bit(s, 1) << 4) | - (bit(m, 2) << 3) | (bit(s, 2) << 2) | - (bit(m, 3) << 1) | (bit(s, 3) << 0) | - (bit(m, 4) << 15) | (bit(s, 4) << 14) | - (bit(m, 5) << 13) | (bit(s, 5) << 12) | - (bit(m, 6) << 11) | (bit(s, 6) << 10) | - (bit(m, 7) << 9) | (bit(s, 7) << 8)); - - *ram++ = r; - } - } - - /* Set new color */ - _sisSetCursorColors (pScreen); - - /* Move to new position */ - _sisMoveCursor (pScreen, x, y); - - /* Enable cursor */ - sr6 = GetSrtc (sisc, 0x6); - sr6 |= 0x40; - PutSrtc (sisc, 0x6, sr6); - - UnlockSis(sisc); -} - -static void -sisUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CARD8 sr6; - - LockSis (sisc); - - /* Disable cursor */ - sr6 = GetSrtc (sisc, 0x6); - sr6 &= ~0x40; - PutSrtc (sisc, 0x6, sr6); - PutSrtc (sisc, 0x1b, 0x00); - - UnlockSis (sisc); -} - -static Bool -sisRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - sisLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -sisUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -sisSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - sisLoadCursor (pScreen, x, y); - else - sisUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec sisPointerSpriteFuncs = { - sisRealizeCursor, - sisUnrealizeCursor, - sisSetCursor, - sisMoveCursor, -}; - -static void -sisQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -sisCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!siss->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = SIS_CURSOR_WIDTH; - pCurPriv->height= SIS_CURSOR_HEIGHT; - pScreen->QueryBestSize = sisQueryBestSize; - miPointerInitialize (pScreen, - &sisPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -sisCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - sisLoadCursor (pScreen, x, y); - } - else - sisUnloadCursor (pScreen); - } -} - -void -sisCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - sisUnloadCursor (pScreen); - } - } -} - -void -sisCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/sis530/sisdraw.c b/hw/kdrive/sis530/sisdraw.c deleted file mode 100644 index 595544348..000000000 --- a/hw/kdrive/sis530/sisdraw.c +++ /dev/null @@ -1,1649 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" -#include "sisdraw.h" - -#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" - -CARD8 sisPatRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -CARD8 sisBltRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -/* Align blts to this boundary or risk trashing an in-progress expand */ -#define SIS_MIN_PATTERN 8 - -/* Do plane bits in this increment to balance CPU and graphics engine */ -#define SIS_PATTERN_INC 1024 - -typedef struct _SisExpand { - SisCardInfo *sisc; - SisScreenInfo *siss; - CARD32 off; - int last; -} SisExpand; - -static void -sisExpandInit (ScreenPtr pScreen, - SisExpand *e) -{ - KdScreenPriv(pScreen); - sisCardInfo(pScreenPriv); - sisScreenInfo(pScreenPriv); - - e->sisc = sisc; - e->siss = siss; - e->off = siss->expand_off; - e->last = 0; -} - -static CARD32 * -sisExpandAlloc (SisExpand *e, - int nb) -{ - SisCardInfo *sisc = e->sisc; - SisScreenInfo *siss = e->siss; - SisPtr sis = sisc->sis; - CARD32 off; - - /* round up to alignment boundary */ - nb = (nb + SIS_MIN_PATTERN-1) & ~(SIS_MIN_PATTERN-1); - - off = e->off + e->last; - if (off + nb > siss->expand_off + siss->expand_len) - { - _sisWaitIdleEmpty (sis); - off = siss->expand_off; - } - e->off = off; - e->last = nb; - return (CARD32 *) (sisc->frameBuffer + off); -} - -void -sisGlyphBltClipped (DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - Bool imageBlt) -{ - SetupSis(pDrawable->pScreen); - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - int height; - int width; - int xBack, yBack; - int hBack, wBack; - int nb, bwidth, nl; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - CARD8 *bits8, b; - CARD16 *bits16; - CARD32 *bits32; - BoxPtr extents; - BoxRec bbox; - unsigned char alu; - CARD32 cmd; - SisExpand expand; - CARD32 *dst, d; - int nbytes; - int shift; - int x1, y1, x2, y2; - RegionPtr pClip = fbGetCompositeClip(pGC); - BoxPtr pBox; - int nbox; - int rect_in; - int widthBlt; - CharInfoPtr *ppci; - - x += pDrawable->x; - y += pDrawable->y; - - if (imageBlt) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - height = nglyph; - ppci = ppciInit; - while (height--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - } - else - { - wBack = 0; - alu = pGC->alu; - } - - if (wBack) - { - _sisSetSolidRect (sis, pGC->bgPixel, GXcopy, cmd); - for (nbox = REGION_NUM_RECTS (pClip), - pBox = REGION_RECTS (pClip); - nbox--; - pBox++) - { - x1 = xBack; - x2 = xBack + wBack; - y1 = yBack; - y2 = yBack + hBack; - if (x1 < pBox->x1) x1 = pBox->x1; - if (x2 > pBox->x2) x2 = pBox->x2; - if (y1 < pBox->y1) y1 = pBox->y1; - if (y2 > pBox->y2) y2 = pBox->y2; - if (x1 < x2 && y1 < y2) - { - _sisRect (sis, x1, y1, x2 - x1, y2 - y1, cmd); - } - } - } - - sisExpandInit (pDrawable->pScreen, &expand); - - sis->u.general.src_fg = pGC->fgPixel; - sis->u.general.src_pitch = 0; - sis->u.general.src_x = 0; - sis->u.general.src_y = 0; - - cmd = (SIS_CMD_ENH_COLOR_EXPAND | - SIS_CMD_SRC_SCREEN | - SIS_CMD_PAT_FG | - (sisBltRop[alu] << 8) | - SIS_CMD_INC_X | - SIS_CMD_INC_Y | - SIS_CMD_RECT_CLIP_ENABLE | - SIS_CMD_TRANSPARENT); - - ppci = ppciInit; - while (nglyph--) - { - pci = *ppci++; - height = pci->metrics.ascent + pci->metrics.descent; - width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - widthBlt = (width + 31) & ~31; - nb = (widthBlt >> 3) * height; - if (nb) - { - x1 = x + pci->metrics.leftSideBearing; - y1 = y - pci->metrics.ascent; - bbox.x1 = x1; - bbox.y1 = y1; - bbox.x2 = x1 + width; - bbox.y2 = y1 + height; - rect_in = RECT_IN_REGION(pGC->pScreen, pClip, &bbox); - if (rect_in != rgnOUT) - { - dst = sisExpandAlloc (&expand, nb); - - sis->u.general.src_base = expand.off; - sis->u.general.dst_x = x1; - sis->u.general.dst_y = y1; - sis->u.general.rect_width = widthBlt; - sis->u.general.rect_height = height; - nb >>= 2; - bits32 = (CARD32 *) pci->bits; - while (nb--) - { - d = *bits32++; - SisInvertBits32 (d); - *dst++ = d; - } - if (rect_in == rgnPART) - { - for (nbox = REGION_NUM_RECTS (pClip), - pBox = REGION_RECTS (pClip); - nbox--; - pBox++) - { - _sisClip (sis, pBox->x1, pBox->y1, pBox->x2, pBox->y2); - sis->u.general.command = cmd; - } - } - else - { - _sisClip (sis, 0, 0, x1+width, pScreenPriv->screen->height); - sis->u.general.command = cmd; - } - } - } - x += pci->metrics.characterWidth; - } - _sisClip (sis, 0, 0, - pScreenPriv->screen->width, pScreenPriv->screen->height); - KdMarkSync (pDrawable->pScreen); -} - -Bool -sisTEGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int xInit, - int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - Bool imageBlt) -{ - SetupSis(pDrawable->pScreen); - int x, y; - int widthGlyphs, widthGlyph; - int widthBlt; - FbBits depthMask; - int glyphsPer; - FontPtr pfont = pGC->font; - unsigned long *char1, *char2, *char3, *char4, *char5; - CARD8 alu; - CARD32 *dst, tmp; - CARD8 *dst8, *bits8; - int nb; - int bwidth; - CARD32 cmd; - int h; - BoxRec bbox; - SisExpand expand; - int lwTmp, lw; - int extra, n; - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - if (!widthGlyph) - return TRUE; - - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - if (!h) - return TRUE; - - x = xInit + FONTMAXBOUNDS(pfont,leftSideBearing) + pDrawable->x; - y = yInit - FONTASCENT(pfont) + pDrawable->y; - - bbox.x1 = x; - bbox.x2 = x + (widthGlyph * nglyph); - bbox.y1 = y; - bbox.y2 = y + h; - - switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) - { - case rgnPART: - if (x < 0 || y < 0) - return FALSE; - sisGlyphBltClipped (pDrawable, pGC, xInit, yInit, nglyph, ppci, imageBlt); - case rgnOUT: - return TRUE; - } - - if (widthGlyph <= 6) - glyphsPer = 5; - else if (widthGlyph <= 8) - glyphsPer = 4; - else if (widthGlyph <= 10) - glyphsPer = 3; - else if (widthGlyph <= 16) - glyphsPer = 2; - else - glyphsPer = 1; - - widthGlyphs = widthGlyph * glyphsPer; - widthBlt = widthGlyphs; - - /* make sure scanlines are 32-bit aligned */ - if (widthGlyphs <= 24) - widthBlt = 25; - - cmd = (SIS_CMD_ENH_COLOR_EXPAND | - SIS_CMD_SRC_SCREEN | - SIS_CMD_PAT_FG | - SIS_CMD_INC_X | - SIS_CMD_INC_Y); - - if (imageBlt) - { - sis->u.general.clip_right = bbox.x2; - cmd |= ((sisBltRop[GXcopy] << 8) | - SIS_CMD_OPAQUE | - SIS_CMD_RECT_CLIP_ENABLE); - } - else - { - cmd |= ((sisBltRop[pGC->alu] << 8) | - SIS_CMD_TRANSPARENT | - SIS_CMD_RECT_CLIP_DISABLE); - } - - sisExpandInit (pDrawable->pScreen, &expand); - - sis->u.general.src_fg = pGC->fgPixel; - sis->u.general.src_bg = pGC->bgPixel; - - bwidth = (widthBlt + 7) >> 3; - - nb = bwidth * h; - -#define LoopIt(count, loadup, fetch) \ - while (nglyph >= count) \ - { \ - nglyph -= count; \ - dst = sisExpandAlloc (&expand, nb); \ - sis->u.general.src_base = expand.off; \ - sis->u.general.src_pitch = 0; \ - sis->u.general.src_x = 0; \ - sis->u.general.src_y = 0; \ - sis->u.general.dst_x = x; \ - sis->u.general.dst_y = y; \ - sis->u.general.rect_width = widthBlt; \ - sis->u.general.rect_height = h; \ - x += widthGlyphs; \ - loadup \ - lwTmp = h; \ - while (lwTmp--) { \ - tmp = fetch; \ - SisInvertBits32(tmp); \ - *dst++ = tmp; \ - } \ - sis->u.general.command = cmd; \ - } - - switch (glyphsPer) { - case 5: - LoopIt(5, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits; - char4 = (unsigned long *) (*ppci++)->bits; - char5 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | ((*char3++ | ((*char4++ | (*char5++ - << widthGlyph)) - << widthGlyph)) - << widthGlyph)) - << widthGlyph))); - break; - case 4: - LoopIt(4, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits; - char4 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | ((*char3++ | (*char4++ - << widthGlyph)) - << widthGlyph)) - << widthGlyph))); - break; - case 3: - LoopIt(3, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits; - char3 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | ((*char2++ | (*char3++ << widthGlyph)) << widthGlyph))); - break; - case 2: - LoopIt(2, - char1 = (unsigned long *) (*ppci++)->bits; - char2 = (unsigned long *) (*ppci++)->bits;, - (*char1++ | (*char2++ << widthGlyph))); - break; - } - - widthBlt = (widthGlyph + 31) & ~31; - - bwidth = widthBlt >> 3; - - nb = bwidth * h; - - lw = (widthBlt >> 5) * h; - - while (nglyph--) - { - dst = (CARD32 *) sisExpandAlloc (&expand, nb); - char1 = (CARD32 *) (*ppci++)->bits; - sis->u.general.src_base = expand.off; - sis->u.general.src_pitch = 0; - sis->u.general.src_x = 0; - sis->u.general.src_y = 0; - sis->u.general.dst_x = x; - sis->u.general.dst_y = y; - sis->u.general.rect_width = widthBlt; - sis->u.general.rect_height = h; - lwTmp = lw; - while (lwTmp--) - { - tmp = *char1++; - SisInvertBits32 (tmp); - *dst++ = tmp; - } - sis->u.general.command = cmd; - x += widthGlyph; - } - if (imageBlt) - sis->u.general.clip_right = pScreenPriv->screen->width; - KdMarkSync (pDrawable->pScreen); - return TRUE; -} - -Bool -sisGlyphBlt(DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppciInit, - Bool imageBlt) -{ - SetupSis(pDrawable->pScreen); - int height; - int width; - int xBack, yBack; - int hBack, wBack; - int nb, bwidth, nl; - FontPtr pfont = pGC->font; - CharInfoPtr pci; - CARD8 *bits8, b; - CARD16 *bits16; - CARD32 *bits32; - BoxPtr extents; - BoxRec bbox; - CharInfoPtr *ppci; - unsigned char alu; - CARD32 cmd; - SisExpand expand; - CARD32 *dst, d; - int nbytes; - int shift; - - x += pDrawable->x; - y += pDrawable->y; - - /* compute an approximate (but covering) bounding box */ - ppci = ppciInit; - width = 0; - height = nglyph; - while (height--) - width += (*ppci++)->metrics.characterWidth; - if (width < 0) - { - bbox.x1 = x + width; - bbox.x2 = x; - } - else - { - bbox.x1 = x; - bbox.x2 = x + width; - } - width = FONTMINBOUNDS(pfont,leftSideBearing); - if (width < 0) - bbox.x1 += width; - width = FONTMAXBOUNDS(pfont, rightSideBearing) - FONTMINBOUNDS(pfont, characterWidth); - if (width > 0) - bbox.x2 += width; - bbox.y1 = y - FONTMAXBOUNDS(pfont,ascent); - bbox.y2 = y + FONTMAXBOUNDS(pfont,descent); - - switch (RECT_IN_REGION(pGC->pScreen, fbGetCompositeClip(pGC), &bbox)) - { - case rgnPART: - if (bbox.x1 < 0 || bbox.y1 < 0) - return FALSE; - sisGlyphBltClipped (pDrawable, pGC, - x - pDrawable->x, y - pDrawable->y, - nglyph, ppciInit, imageBlt); - case rgnOUT: - return TRUE; - } - - if (imageBlt) - { - xBack = x; - yBack = y - FONTASCENT(pGC->font); - wBack = 0; - hBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - if (hBack) - { - height = nglyph; - ppci = ppciInit; - while (height--) - wBack += (*ppci++)->metrics.characterWidth; - } - if (wBack < 0) - { - xBack = xBack + wBack; - wBack = -wBack; - } - if (hBack < 0) - { - yBack = yBack + hBack; - hBack = -hBack; - } - alu = GXcopy; - } - else - { - wBack = 0; - alu = pGC->alu; - } - - if (wBack) - { - _sisSetSolidRect (sis, pGC->bgPixel, GXcopy, cmd); - _sisRect (sis, xBack, yBack, wBack, hBack, cmd); - } - - sisExpandInit (pDrawable->pScreen, &expand); - - sis->u.general.src_fg = pGC->fgPixel; - - cmd = (SIS_CMD_ENH_COLOR_EXPAND | - SIS_CMD_SRC_SCREEN | - SIS_CMD_PAT_FG | - (sisBltRop[alu] << 8) | - SIS_CMD_INC_X | - SIS_CMD_INC_Y | - SIS_CMD_RECT_CLIP_DISABLE | - SIS_CMD_TRANSPARENT); - - ppci = ppciInit; - while (nglyph--) - { - pci = *ppci++; - height = pci->metrics.ascent + pci->metrics.descent; - width = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - /* - * For glyphs wider than 16 pixels, expand the blt to the nearest multiple - * of 32; this allows the scanlines to be padded to a 32-bit boundary - * instead of requiring byte packing - */ - if (width > 16) - width = (width + 31) & ~31; - bwidth = (width + 7) >> 3; - nb = bwidth * height; - if (nb) - { - dst = sisExpandAlloc (&expand, nb); - - sis->u.general.src_base = expand.off; - sis->u.general.src_pitch = 0; - sis->u.general.src_x = 0; - sis->u.general.src_y = 0; - sis->u.general.dst_x = x + pci->metrics.leftSideBearing; - sis->u.general.dst_y = y - pci->metrics.ascent; - sis->u.general.rect_width = width; - sis->u.general.rect_height = height; - switch (bwidth) { - case 1: - bits8 = (CARD8 *) pci->bits; - while (height >= 4) - { - d = (bits8[0] | (bits8[4] << 8) | - (bits8[8] << 16) | (bits8[12] << 24)); - SisInvertBits32(d); - *dst++ = d; - bits8 += 16; - height -= 4; - } - if (height) - { - switch (height) { - case 3: - d = bits8[0] | (bits8[4] << 8) | (bits8[8] << 16); - break; - case 2: - d = bits8[0] | (bits8[4] << 8); - break; - case 1: - d = bits8[0]; - break; - } - SisInvertBits32(d); - *dst++ = d; - } - break; - case 2: - bits16 = (CARD16 *) pci->bits; - while (height >= 2) - { - d = bits16[0] | (bits16[2] << 16); - SisInvertBits32(d); - *dst++ = d; - bits16 += 4; - height -= 2; - } - if (height) - { - d = bits16[0]; - SisInvertBits32(d); - *dst++ = d; - } - break; - default: - nb >>= 2; - bits32 = (CARD32 *) pci->bits; - while (nb--) - { - d = *bits32++; - SisInvertBits32 (d); - *dst++ = d; - } - } - sis->u.general.command = cmd; - } - x += pci->metrics.characterWidth; - } - KdMarkSync (pDrawable->pScreen); - return TRUE; -} -/* - * Blt glyphs using Sis image transfer register, this does both - * poly glyph blt and image glyph blt (when pglyphBase == 1) - */ - -void -sisPolyGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - FbBits depthMask; - - depthMask = FbFullMask (pDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pGC->fillStyle == FillSolid) - { - if (TERMINALFONT(pGC->font)) - { - if (sisTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE)) - return; - } - else - { - if (sisGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, FALSE)) - return; - } - } - KdCheckPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); -} - -void -sisImageGlyphBlt (DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase) -{ - FbBits depthMask; - - depthMask = FbFullMask (pDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask) - { - if (TERMINALFONT(pGC->font)) - { - if (sisTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE)) - return; - } - else - { - if (sisGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, TRUE)) - return; - } - } - KdCheckImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); -} - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#define sisPatternDimOk(d) ((d) <= 8 && (((d) & ((d) - 1)) == 0)) - -BOOL -sisFillOk (GCPtr pGC) -{ - FbBits depthMask; - - depthMask = FbFullMask(pGC->depth); - if ((pGC->planemask & depthMask) != depthMask) - return FALSE; - switch (pGC->fillStyle) { - case FillSolid: - return TRUE; - case FillTiled: - return (sisPatternDimOk (pGC->tile.pixmap->drawable.width) && - sisPatternDimOk (pGC->tile.pixmap->drawable.height)); - case FillStippled: - case FillOpaqueStippled: - return (sisPatternDimOk (pGC->stipple->drawable.width) && - sisPatternDimOk (pGC->stipple->drawable.height)); - } -} - -CARD32 -sisStipplePrepare (DrawablePtr pDrawable, GCPtr pGC) -{ - SetupSis(pGC->pScreen); - PixmapPtr pStip = pGC->stipple; - int stipHeight = pStip->drawable.height; - int xRot, yRot; - int rot, stipX, stipY; - FbStip *stip, *stipEnd, bits; - FbStride stipStride; - int stipBpp; - int stipXoff, stipYoff; /* XXX assumed to be zero */ - int y; - CARD32 cmd; - - xRot = pGC->patOrg.x + pDrawable->x; - yRot = pGC->patOrg.y + pDrawable->y; - modulus (- yRot, stipHeight, stipY); - modulus (- xRot, FB_UNIT, stipX); - rot = stipX; - - fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); - for (y = 0; y < 8; y++) - { - bits = stip[stipY<<1]; - FbRotLeft(bits, rot); - SisInvertBits32(bits); - sis->u.general.mask[y] = (CARD8) bits; - stipY++; - if (stipY == stipHeight) - stipY = 0; - } - sis->u.general.pattern_fg = pGC->fgPixel; - - cmd = (SIS_CMD_BITBLT | - SIS_CMD_SRC_SCREEN | - SIS_CMD_PAT_MONO | - (sisPatRop[pGC->alu] << 8) | - SIS_CMD_INC_X | - SIS_CMD_INC_Y | - SIS_CMD_RECT_CLIP_DISABLE | - SIS_CMD_RECT_CLIP_DONT_MERGE); - if (pGC->fillStyle == FillOpaqueStippled) - { - sis->u.general.pattern_bg = pGC->bgPixel; - cmd |= SIS_CMD_OPAQUE; - } - else - cmd |= SIS_CMD_TRANSPARENT; - return cmd; -} - -CARD32 -sisTilePrepare (PixmapPtr pTile, int xRot, int yRot, CARD8 alu) -{ - SetupSis(pTile->drawable.pScreen); - int tileHeight = pTile->drawable.height; - int tileWidth = pTile->drawable.width; - FbBits *tile; - FbStride tileStride; - int tileBpp; - int tileXoff, tileYoff; /* XXX assumed to be zero */ - - fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); - - /* - * Tile the pattern register - */ - fbTile ((FbBits *) sis->u.general.pattern, - (8 * tileBpp) >> FB_SHIFT, - 0, - - 8 * tileBpp, 8, - - tile, - tileStride, - tileWidth * tileBpp, - tileHeight, - GXcopy, FB_ALLONES, tileBpp, - xRot * tileBpp, - yRot); - - return (SIS_CMD_BITBLT | - SIS_CMD_SRC_SCREEN | - SIS_CMD_PAT_PATTERN | - (sisPatRop[alu] << 8) | - SIS_CMD_INC_X | - SIS_CMD_INC_Y | - SIS_CMD_RECT_CLIP_DISABLE | - SIS_CMD_RECT_CLIP_DONT_MERGE); -} - -void -sisFillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, - unsigned long pixel, int alu) -{ - SetupSis(pDrawable->pScreen); - CARD32 cmd; - - _sisSetSolidRect(sis,pixel,alu,cmd); - - while (nBox--) - { - _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -void -sisFillBoxStipple (DrawablePtr pDrawable, GCPtr pGC, - int nBox, BoxPtr pBox) -{ - SetupSis(pDrawable->pScreen); - CARD32 cmd; - - cmd = sisStipplePrepare (pDrawable, pGC); - - while (nBox--) - { - _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -void -sisFillBoxTiled (DrawablePtr pDrawable, - int nBox, BoxPtr pBox, - PixmapPtr pTile, int xRot, int yRot, CARD8 alu) -{ - SetupSis (pDrawable->pScreen); - CARD32 cmd; - - cmd = sisTilePrepare (pTile, xRot, yRot, alu); - - while (nBox--) - { - _sisRect(sis,pBox->x1,pBox->y1,pBox->x2-pBox->x1,pBox->y2-pBox->y1,cmd); - pBox++; - } - KdMarkSync (pDrawable->pScreen); -} - -/* - sisDoBitBlt - ============= - Bit Blit for all window to window blits. -*/ - -void -sisCopyNtoN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupSis(pDstDrawable->pScreen); - int srcX, srcY, dstX, dstY; - int w, h; - CARD32 flags; - CARD32 cmd; - CARD8 alu; - - if (pGC) - { - alu = pGC->alu; - if (sourceInvarient (pGC->alu)) - { - sisFillBoxSolid (pDstDrawable, nbox, pbox, 0, pGC->alu); - return; - } - } - else - alu = GXcopy; - - _sisSetBlt(sis,alu,cmd); - while (nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - flags = 0; - if (reverse) - { - dstX = pbox->x2 - 1; - } - else - { - dstX = pbox->x1; - flags |= SIS_CMD_INC_X; - } - srcX = dstX + dx; - - if (upsidedown) - { - dstY = pbox->y2 - 1; - } - else - { - dstY = pbox->y1; - flags |= SIS_CMD_INC_Y; - } - srcY = dstY + dy; - - _sisBlt (sis, srcX, srcY, dstX, dstY, w, h, cmd|flags); - pbox++; - } - KdMarkSync (pDstDrawable->pScreen); -} - -RegionPtr -sisCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, int dstx, int dsty) -{ - KdScreenPriv(pDstDrawable->pScreen); - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pSrcDrawable->type == DRAWABLE_WINDOW && - pDstDrawable->type == DRAWABLE_WINDOW) - { - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, sisCopyNtoN, 0, 0); - } - return KdCheckCopyArea (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, dstx, dsty); -} - -typedef struct _sis1toNargs { - unsigned long copyPlaneFG, copyPlaneBG; -} sis1toNargs; - -void -_sisStipple (ScreenPtr pScreen, - FbStip *psrcBase, - FbStride widthSrc, - CARD8 alu, - int srcx, - int srcy, - int dstx, - int dsty, - int width, - int height) -{ - SetupSis(pScreen); - FbStip *psrcLine, *psrc; - FbStride widthRest; - FbStip bits, tmp, lastTmp; - int leftShift, rightShift; - int nl, nlMiddle; - int r; - SisExpand expand; - CARD32 *dst; - int hthis; - int hper; - int bwidth; - CARD32 cmd; - - sisExpandInit (pScreen, &expand); - - /* Compute blt address and parameters */ - psrc = psrcBase + srcy * widthSrc + (srcx >> 5); - nlMiddle = (width + 31) >> 5; - leftShift = srcx & 0x1f; - rightShift = 32 - leftShift; - widthRest = widthSrc - nlMiddle; - - cmd = (SIS_CMD_ENH_COLOR_EXPAND | - SIS_CMD_SRC_SCREEN | - SIS_CMD_PAT_FG | - (sisBltRop[alu] << 8) | - SIS_CMD_INC_X | - SIS_CMD_INC_Y | - SIS_CMD_OPAQUE | - SIS_CMD_RECT_CLIP_ENABLE); - - if (leftShift != 0) - widthRest--; - - sis->u.general.src_x = 0; - sis->u.general.src_y = 0; - sis->u.general.dst_x = dstx; - sis->u.general.rect_width = (width + 31) & ~31; - sis->u.general.clip_right = (dstx + width); - - bwidth = nlMiddle << 2; - hper = SIS_PATTERN_INC / bwidth; - if (hper == 0) - hper = 1; - - while (height) - { - hthis = hper; - if (hthis > height) - hthis = height; - dst = sisExpandAlloc (&expand, bwidth * hthis); - sis->u.general.src_base = expand.off; - sis->u.general.dst_y = dsty; - sis->u.general.rect_height = hthis; - - dsty += hthis; - height -= hthis; - - if (leftShift == 0) - { - while (hthis--) - { - nl = nlMiddle; - while (nl--) - { - tmp = *psrc++; - SisInvertBits32(tmp); - *dst++ = tmp; - } - psrc += widthRest; - } - } - else - { - while (hthis--) - { - bits = *psrc++; - nl = nlMiddle; - while (nl--) - { - tmp = FbStipLeft(bits, leftShift); - bits = *psrc++; - tmp |= FbStipRight(bits, rightShift); - SisInvertBits32(tmp); - *dst++ = tmp; - } - psrc += widthRest; - } - } - sis->u.general.command = cmd; - } - sis->u.general.clip_right = pScreenPriv->screen->width; -} - -void -sisCopy1toN (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pbox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, - Pixel bitplane, - void *closure) -{ - SetupSis(pDstDrawable->pScreen); - - sis1toNargs *args = closure; - int dstx, dsty; - FbStip *psrcBase; - FbStride widthSrc; - int srcBpp; - int srcXoff, srcYoff; - - if (sourceInvarient (pGC->alu)) - { - sisFillBoxSolid (pDstDrawable, nbox, pbox, - pGC->bgPixel, pGC->alu); - return; - } - - fbGetStipDrawable (pSrcDrawable, psrcBase, widthSrc, srcBpp, srcXoff, srcYoff); - - sis->u.general.src_fg = args->copyPlaneFG; - sis->u.general.src_bg = args->copyPlaneBG; - - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - - _sisStipple (pDstDrawable->pScreen, - psrcBase, widthSrc, - pGC->alu, - dstx + dx - srcXoff, dsty + dy - srcYoff, - dstx, dsty, - pbox->x2 - dstx, pbox->y2 - dsty); - pbox++; - } - KdMarkSync (pDstDrawable->pScreen); -} - -RegionPtr -sisCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - KdScreenPriv (pDstDrawable->pScreen); - RegionPtr ret; - sis1toNargs args; - FbBits depthMask; - - depthMask = FbFullMask (pDstDrawable->depth); - if ((pGC->planemask & depthMask) == depthMask && - pDstDrawable->type == DRAWABLE_WINDOW && - pSrcDrawable->depth == 1) - { - args.copyPlaneFG = pGC->fgPixel; - args.copyPlaneBG = pGC->bgPixel; - return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, sisCopy1toN, bitPlane, &args); - } - return KdCheckCopyPlane(pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); -} - -void -sisFillSpans (DrawablePtr pDrawable, GCPtr pGC, int n, - DDXPointPtr ppt, int *pwidth, int fSorted) -{ - SetupSis(pDrawable->pScreen); - DDXPointPtr pptFree; - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - int *pwidthFree;/* copies of the pointers to free */ - CARD32 cmd; - int nTmp; - INT16 x, y; - int width; - - if (!sisFillOk (pGC)) - { - KdCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); - return; - } - nTmp = n * miFindMaxBand(fbGetCompositeClip(pGC)); - pwidthFree = (int *)xalloc(nTmp * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(nTmp * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - n = miClipSpans(fbGetCompositeClip(pGC), - ppt, pwidth, n, - pptFree, pwidthFree, fSorted); - pwidth = pwidthFree; - ppt = pptFree; - switch (pGC->fillStyle) { - case FillSolid: - _sisSetSolidRect(sis,pGC->fgPixel,pGC->alu,cmd); - break; - case FillTiled: - cmd = sisTilePrepare (pGC->tile.pixmap, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y, - pGC->alu); - break; - default: - cmd = sisStipplePrepare (pDrawable, pGC); - break; - } - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - width = *pwidth++; - if (width) - { - _sisRect(sis,x,y,width,1,cmd); - } - } - KdMarkSync (pDrawable->pScreen); - xfree(pptFree); - xfree(pwidthFree); -} - -#define NUM_STACK_RECTS 1024 - -void -sisPolyFillRect (DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - SetupSis(pDrawable->pScreen); - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - FbGCPrivPtr fbPriv = fbGetGCPrivate (pGC); - int numRects; - int n; - int xorg, yorg; - int x, y; - - if (!sisFillOk (pGC)) - { - KdCheckPolyFillRect (pDrawable, pGC, nrectFill, prectInit); - return; - } - prgnClip = fbGetCompositeClip(pGC); - xorg = pDrawable->x; - yorg = pDrawable->y; - - if (xorg || yorg) - { - prect = prectInit; - n = nrectFill; - while(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) - { - switch (pGC->fillStyle) { - case FillSolid: - sisFillBoxSolid(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->fgPixel, pGC->alu); - break; - case FillTiled: - sisFillBoxTiled(pDrawable, - pboxClipped-pboxClippedBase, pboxClippedBase, - pGC->tile.pixmap, - pGC->patOrg.x + pDrawable->x, - pGC->patOrg.y + pDrawable->y, - pGC->alu); - break; - case FillStippled: - case FillOpaqueStippled: - sisFillBoxStipple (pDrawable, pGC, - pboxClipped-pboxClippedBase, pboxClippedBase); - break; - } - } - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} - -static const GCOps sisOps = { - sisFillSpans, - KdCheckSetSpans, - KdCheckPutImage, - sisCopyArea, - sisCopyPlane, - KdCheckPolyPoint, - KdCheckPolylines, - KdCheckPolySegment, - miPolyRectangle, - KdCheckPolyArc, - miFillPolygon, - sisPolyFillRect, - KdCheckPolyFillArc, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - sisImageGlyphBlt, - sisPolyGlyphBlt, - KdCheckPushPixels, -}; - -void -sisValidateGC (GCPtr pGC, Mask changes, DrawablePtr pDrawable) -{ - FbGCPrivPtr fbPriv = fbGetGCPrivate(pGC); - - fbValidateGC (pGC, changes, pDrawable); - - if (pDrawable->type == DRAWABLE_WINDOW) - pGC->ops = (GCOps *) &sisOps; - else - pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; -} - -GCFuncs sisGCFuncs = { - sisValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip -}; - -int -sisCreateGC (GCPtr pGC) -{ - if (!fbCreateGC (pGC)) - return FALSE; - - if (pGC->depth != 1) - pGC->funcs = &sisGCFuncs; - - pGC->ops = (GCOps *) &kdAsyncPixmapGCOps; - - return TRUE; -} - -void -sisCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - KdScreenPriv(pScreen); - RegionRec rgnDst; - int dx, dy; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - 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); - - fbCopyRegion ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - 0, - &rgnDst, dx, dy, sisCopyNtoN, 0, 0); - - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - -Bool -sisDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - sisScreenInfo(pScreenPriv); - - /* - * Hook up asynchronous drawing - */ - KdScreenInitAsync (pScreen); - /* - * Replace various fb screen functions - */ - pScreen->CreateGC = sisCreateGC; - pScreen->CopyWindow = sisCopyWindow; - - return TRUE; -} - -void -sisDrawEnable (ScreenPtr pScreen) -{ - SetupSis(pScreen); - sisScreenInfo(pScreenPriv); - CARD32 cmd; - CARD32 base; - CARD16 stride; - CARD16 op; - - base = pScreenPriv->screen->fb[0].frameBuffer - sisc->frameBuffer; - stride = pScreenPriv->screen->fb[0].byteStride; -#if 0 - sis->u.general.dst_base = base; - sis->u.general.dst_pitch = stride; - sis->u.general.src_pitch = stride; - sis->u.general._pad0 = stride; - sis->u.general.dst_height = pScreenPriv->screen->height; - _sisClip (sis, 0, 0, - pScreenPriv->screen->width, pScreenPriv->screen->height); - _sisSetSolidRect(sis, pScreen->blackPixel, GXcopy, cmd); - _sisRect (sis, 0, 0, - pScreenPriv->screen->width, pScreenPriv->screen->height, - cmd); -#endif - base = (CARD32) (pScreenPriv->screen->fb[0].frameBuffer); - fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr); - sis->u.accel.src_addr = (base & 0x3fffff); - fprintf (stderr, "src 0x%x\n", sis->u.accel.src_addr); - sis->u.accel.dst_addr = (base & 0x3fffff); - sis->u.accel.pitch = (stride << 16) | stride; - sis->u.accel.dimension = ((pScreenPriv->screen->height-1) << 16 | - (pScreenPriv->screen->width - 1)); - sis->u.accel.fg = (sisBltRop[GXcopy] << 24) | 0xf800; - sis->u.accel.bg = (sisBltRop[GXcopy] << 24) | 0x00; - -#define sisLEFT2RIGHT 0x10 -#define sisRIGHT2LEFT 0x00 -#define sisTOP2BOTTOM 0x20 -#define sisBOTTOM2TOP 0x00 - -#define sisSRCSYSTEM 0x03 -#define sisSRCVIDEO 0x02 -#define sisSRCFG 0x01 -#define sisSRCBG 0x00 - -#define sisCMDBLT 0x0000 -#define sisCMDBLTMSK 0x0100 -#define sisCMDCOLEXP 0x0200 -#define sisCMDLINE 0x0300 - -#define sisCMDENHCOLEXP 0x2000 - -#define sisXINCREASE 0x10 -#define sisYINCREASE 0x20 -#define sisCLIPENABL 0x40 -#define sisCLIPINTRN 0x80 -#define sisCLIPEXTRN 0x00 - - -#define sisPATREG 0x08 -#define sisPATFG 0x04 -#define sisPATBG 0x00 - -#define sisLASTPIX 0x0800 -#define sisXMAJOR 0x0400 - - op = sisCMDBLT | sisLEFT2RIGHT | sisTOP2BOTTOM | sisSRCFG | sisPATFG; - - sis->u.accel.cmd = op; - - KdMarkSync (pScreen); -} - -void -sisDrawSync (ScreenPtr pScreen) -{ - SetupSis(pScreen); - - _sisWaitIdleEmpty (sis); -} - -void -sisDrawDisable (ScreenPtr pScreen) -{ -} - -void -sisDrawFini (ScreenPtr pScreen) -{ -} diff --git a/hw/kdrive/sis530/sisdraw.h b/hw/kdrive/sis530/sisdraw.h deleted file mode 100644 index 971ad64ac..000000000 --- a/hw/kdrive/sis530/sisdraw.h +++ /dev/null @@ -1,180 +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. - */ - -#ifndef _SISDRAW_H_ -#define _SISDRAW_H_ - -#define SetupSis(s) KdScreenPriv(s); \ - sisCardInfo(pScreenPriv); \ - SisPtr sis = sisc->sis - -#define SIS_CMD_BITBLT (0) -#define SIS_CMD_COLOR_EXPAND (1) -#define SIS_CMD_ENH_COLOR_EXPAND (2) -#define SIS_CMD_MULTI_SCANLINE (3) -#define SIS_CMD_LINE (4) -#define SIS_CMD_TRAPEZOID (5) -#define SIS_CMD_TRANSPARENT_BITBLT (6) - -#define SIS_CMD_SRC_SCREEN (0 << 4) -#define SIS_CMD_SRC_CPU (1 << 4) - -#define SIS_CMD_PAT_FG (0 << 6) -#define SIS_CMD_PAT_PATTERN (1 << 6) -#define SIS_CMD_PAT_MONO (2 << 6) - -/* 8->15 rop */ - -#define SIS_CMD_DEC_X (0 << 16) -#define SIS_CMD_INC_X (1 << 16) - -#define SIS_CMD_DEC_Y (0 << 17) -#define SIS_CMD_INC_Y (1 << 17) - -#define SIS_CMD_RECT_CLIP_DISABLE (0 << 18) -#define SIS_CMD_RECT_CLIP_ENABLE (1 << 18) - -#define SIS_CMD_OPAQUE (0 << 20) -#define SIS_CMD_TRANSPARENT (1 << 20) - -#define SIS_CMD_RECT_CLIP_MERGE (0 << 26) -#define SIS_CMD_RECT_CLIP_DONT_MERGE (1 << 26) - -#define SIS_STAT_2D_IDLE (1 << 31) -#define SIS_STAT_3D_IDLE (1 << 30) -#define SIS_STAT_EMPTY (1 << 29) -#define SIS_STAT_CPU_BITBLT (0xf << 24) -#define SIS_STAT_ENH_COLOR_EXPAND (1 << 23) -#define SIS_STAT_AVAIL (0x1fff) - -extern CARD8 sisPatRop[16]; -extern CARD8 sisBltRop[16]; - -#define _sisSetSolidRect(sis,pix,alu,cmd) {\ - (sis)->u.general.pattern_fg = (pix); \ - (cmd) = (SIS_CMD_BITBLT | \ - SIS_CMD_SRC_SCREEN | \ - SIS_CMD_PAT_FG | \ - (sisPatRop[alu] << 8) | \ - SIS_CMD_INC_X | \ - SIS_CMD_INC_Y | \ - SIS_CMD_RECT_CLIP_DISABLE | \ - SIS_CMD_OPAQUE | \ - SIS_CMD_RECT_CLIP_DONT_MERGE); \ -} - -#define _sisClip(sis,x1,y1,x2,y2) { \ - (sis)->u.general.clip_left = (x1); \ - (sis)->u.general.clip_top = (y1); \ - (sis)->u.general.clip_right = (x2); \ - (sis)->u.general.clip_bottom = (y2); \ -} - -#define _sisRect(sis,x,y,w,h,cmd) { \ - (sis)->u.general.dst_x = (x); \ - (sis)->u.general.dst_y = (y); \ - (sis)->u.general.rect_width = (w); \ - (sis)->u.general.rect_height = (h); \ - (sis)->u.general.command = (cmd); \ -} - -#define _sisSetTransparentPlaneBlt(sis, alu, fg, cmd) { \ - (sis)->u.general.src_fg = (fg); \ - (cmd) = (SIS_CMD_ENH_COLOR_EXPAND | \ - SIS_CMD_SRC_CPU | \ - SIS_CMD_PAT_FG | \ - (sisBltRop[alu] << 8) | \ - SIS_CMD_INC_X | \ - SIS_CMD_INC_Y | \ - SIS_CMD_RECT_CLIP_DISABLE | \ - SIS_CMD_TRANSPARENT | \ - SIS_CMD_RECT_CLIP_DONT_MERGE); \ -} - -#define _sisSetOpaquePlaneBlt(sis, alu, fg, bg, cmd) { \ - (sis)->u.general.src_fg = (fg); \ - (sis)->u.general.src_bg = (bg); \ - (cmd) = (SIS_CMD_ENH_COLOR_EXPAND | \ - SIS_CMD_SRC_CPU | \ - SIS_CMD_PAT_FG | \ - (sisBltRop[alu] << 8) | \ - SIS_CMD_INC_X | \ - SIS_CMD_INC_Y | \ - SIS_CMD_RECT_CLIP_DISABLE | \ - SIS_CMD_OPAQUE | \ - SIS_CMD_RECT_CLIP_DONT_MERGE); \ -} - -#define _sisPlaneBlt(sis,x,y,w,h,cmd) _sisSolidRect(sis,x,y,w,h,cmd) - -#define _sisSetBlt(sis,alu,cmd) { \ - (sis)->u.general.src_base = (sis)->u.general.dst_base; \ - (sis)->u.general.src_pitch = (sis)->u.general.dst_pitch; \ - (cmd) = (SIS_CMD_RECT_CLIP_DONT_MERGE |\ - (sisBltRop[alu] << 8) |\ - SIS_CMD_PAT_FG |\ - SIS_CMD_SRC_SCREEN |\ - SIS_CMD_BITBLT); \ -} - -#define _sisBlt(sis,sx,sy,dx,dy,w,h,cmd) { \ - (sis)->u.general.src_x = (sx); \ - (sis)->u.general.src_y = (sy); \ - (sis)->u.general.dst_x = (dx); \ - (sis)->u.general.dst_y = (dy); \ - (sis)->u.general.rect_width = (w); \ - (sis)->u.general.rect_height = (h); \ - (sis)->u.general.command = (cmd); \ -} - -#define SIS_IE (SIS_STAT_2D_IDLE|SIS_STAT_EMPTY) - -#define _sisWaitIdleEmpty(sis) \ - while (((sis)->u.general.status & SIS_IE) != SIS_IE) - -/* - * Ok, so the Sis530 is broken -- it expects bitmaps to come MSB bit order, - * but it's willing to take them in LSB byte order. These macros - * flip bits around without flipping bytes. Instead of using a table - * and burning memory bandwidth, do them in place with the CPU. - */ - -/* The MIPS compiler automatically places these constants in registers */ -#define SisInvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -#define SisInvertBits16(v) { \ - v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ - v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ - v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ -} - -#define SisInvertBits8(v) { \ - v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ - v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ - v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ -} - -#endif diff --git a/hw/kdrive/sis530/sisio.c b/hw/kdrive/sis530/sisio.c deleted file mode 100644 index 4741937a4..000000000 --- a/hw/kdrive/sis530/sisio.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#ifdef linux -#define extern -#include <asm/io.h> -#undef extern -#endif diff --git a/hw/kdrive/sis530/sisstub.c b/hw/kdrive/sis530/sisstub.c deleted file mode 100644 index 960510bff..000000000 --- a/hw/kdrive/sis530/sisstub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "sis.h" - -static const int sisCards[] = { 0x6306, 0x0200 }; - -#define numSisCards (sizeof (sisCards) / sizeof (sisCards[0])) - -void -InitCard (char *name) -{ - KdCardAttr attr; - int i; - - for (i = 0; i < numSisCards; i++) - if (LinuxFindPci (0x1039, sisCards[i], 0, &attr)) - KdCardInfoAdd (&sisFuncs, &attr, (void *) sisCards[i]); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/smi/Makefile.am b/hw/kdrive/smi/Makefile.am deleted file mode 100644 index bd7077c56..000000000 --- a/hw/kdrive/smi/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/hw/kdrive/fbdev \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_INCS@ \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xsmi - -noinst_LIBRARIES = libsmi.a - -# smivideo.c # not ready yet - -libsmi_a_SOURCES = \ - smi.c \ - smi.h \ - smidraw.c \ - smidraw.h - -Xsmi_SOURCES = \ - smistub.c - -SMI_LIBS = \ - libsmi.a \ - $(top_builddir)/hw/kdrive/fbdev/libfbdev.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a \ - @KDRIVE_LIBS@ - -if GLX -Xsmi_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xsmi_LDADD = \ - $(SMI_LIBS) \ - @KDRIVE_LIBS@ - -Xsmi_DEPENDENCIES = \ - libsmi.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/smi/smi.c b/hw/kdrive/smi/smi.c deleted file mode 100644 index 7d4d725c7..000000000 --- a/hw/kdrive/smi/smi.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "smi.h" -#include "kaa.h" -#include <sys/io.h> - -static Bool -smiCardInit (KdCardInfo *card) -{ - SmiCardInfo *smic; - - ENTER (); - smic = (SmiCardInfo *) xalloc (sizeof (SmiCardInfo)); - if (!smic) - return FALSE; - memset (smic, '\0', sizeof (SmiCardInfo)); - - (void) smiMapReg (card, smic); - - if (!subInitialize (card, &smic->sub)) - { - xfree (smic); - return FALSE; - } - - card->driver = smic; - LEAVE(); - return TRUE; -} - -static Bool -smiScreenInit (KdScreenInfo *screen) -{ - SmiCardInfo *smic = screen->card->driver; - SmiScreenInfo *smis; - - ENTER(); - smis = (SmiScreenInfo *) xalloc (sizeof (SmiScreenInfo)); - if (!smis) - return FALSE; - memset (smis, '\0', sizeof (SmiScreenInfo)); - screen->driver = smis; - if (!subScreenInitialize (screen, &smis->sub)) - { - xfree (smis); - return FALSE; - } - if (!smic->reg_base) - screen->dumb = TRUE; - screen->softCursor = TRUE; -#if SMI_VESA - smis->screen = smis->sub.fb; -#else - smis->screen = smic->sub.fb; -#endif - LEAVE(); - return TRUE; -} - -static Bool -smiInitScreen (ScreenPtr pScreen) -{ - Bool ret; - ENTER (); -#if 0 -#ifdef XV - KdScreenPriv(pScreen); - SmiCardInfo *smic = pScreenPriv->screen->card->driver; - if (smic->media_reg && smic->reg) - smiInitVideo(pScreen); -#endif -#endif - ret = subInitScreen (pScreen); - LEAVE(); - return ret; -} - -#ifdef RANDR -static Bool -smiRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - Bool ret; - - ENTER (); - kaaWaitSync (pScreen); - - ret = subRandRSetConfig (pScreen, randr, rate, pSize); - LEAVE(); - return ret; -} - -static Bool -smiRandRInit (ScreenPtr pScreen) -{ - rrScrPriv(pScreen); - - ENTER (); - pScrPriv->rrSetConfig = smiRandRSetConfig; - LEAVE (); - return TRUE; -} -#endif - -static Bool -smiFinishInitScreen (ScreenPtr pScreen) -{ - Bool ret; - ret = subFinishInitScreen (pScreen); -#ifdef RANDR - smiRandRInit (pScreen); -#endif - return ret; -} - -void -smiPreserve (KdCardInfo *card) -{ - ENTER (); - subPreserve(card); - LEAVE(); -} - -Bool -smiMapReg (KdCardInfo *card, SmiCardInfo *smic) -{ - ENTER (); - smic->io_base = 0; /* only handles one SMI card at standard VGA address */ - smic->reg_base = (CARD8 *) KdMapDevice (SMI_REG_BASE(card), - SMI_REG_SIZE(card)); - - if (!smic->reg_base) - { - smic->dpr = 0; - return FALSE; - } - - KdSetMappedMode (SMI_REG_BASE(card), - SMI_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - smic->dpr = (DPR *) (smic->reg_base + SMI_DPR_OFF(card)); - LEAVE (); - return TRUE; -} - -void -smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic) -{ - ENTER (); - if (smic->reg_base) - { - KdResetMappedMode (SMI_REG_BASE(card), - SMI_REG_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - KdUnmapDevice ((void *) smic->reg_base, SMI_REG_SIZE(card)); - smic->reg_base = 0; - smic->dpr = 0; - } - LEAVE (); -} - -void -smiOutb (CARD16 port, CARD8 val) -{ - asm volatile ("outb %b0,%w1" : : "a" (val), "d" (port)); -} - -CARD8 -smiInb (CARD16 port) -{ - CARD8 v; - asm volatile ("inb %w1,%b0" : "=a" (v) : "d" (port)); - return v; -} - -CARD8 -smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id) -{ - smiOutb (smic->io_base + addr, id); - return smiInb (smic->io_base + data); -} - -void -smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val) -{ - smiOutb (smic->io_base + addr, id); - smiOutb (smic->io_base + data, val); -} - -void -smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic) -{ - ENTER (); - if (!smic->reg_base) - smiMapReg (card, smic); - LEAVE(); -} - -void -smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic) -{ - smiUnmapReg (card, smic); -} - -static Bool -smiDPMS (ScreenPtr pScreen, int mode) -{ - Bool ret; - ENTER (); - ret = subDPMS (pScreen, mode); - LEAVE (); - return ret; -} - -Bool -smiEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SmiCardInfo *smic = pScreenPriv->card->driver; - - ENTER (); - iopl (3); - if (!subEnable (pScreen)) - return FALSE; - - smiSetMMIO (pScreenPriv->card, smic); - smiDPMS (pScreen, KD_DPMS_NORMAL); -#if 0 -#ifdef XV - KdXVEnable (pScreen); -#endif -#endif - LEAVE (); - return TRUE; -} - -void -smiDisable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - SmiCardInfo *smic = pScreenPriv->card->driver; - - ENTER (); -#if 0 -#ifdef XV - KdXVDisable (pScreen); -#endif -#endif - smiResetMMIO (pScreenPriv->card, smic); - subDisable (pScreen); - LEAVE (); -} - -static void -smiRestore (KdCardInfo *card) -{ - ENTER (); - subRestore (card); - LEAVE(); -} - -static void -smiScreenFini (KdScreenInfo *screen) -{ - SmiScreenInfo *smis = (SmiScreenInfo *) screen->driver; - - ENTER (); - subScreenFini (screen); - xfree (smis); - screen->driver = 0; - LEAVE (); -} - -static void -smiCardFini (KdCardInfo *card) -{ - SmiCardInfo *smic = card->driver; - - ENTER (); - smiUnmapReg (card, smic); - subCardFini (card); - LEAVE (); -} - -#define smiCursorInit 0 /* initCursor */ -#define smiCursorEnable 0 /* enableCursor */ -#define smiCursorDisable 0 /* disableCursor */ -#define smiCursorFini 0 /* finiCursor */ -#define smiRecolorCursor 0 /* recolorCursor */ - -KdCardFuncs smiFuncs = { - smiCardInit, /* cardinit */ - smiScreenInit, /* scrinit */ - smiInitScreen, /* initScreen */ - smiFinishInitScreen, /* finishInitScreen */ - subCreateResources, /* createRes */ - smiPreserve, /* preserve */ - smiEnable, /* enable */ - smiDPMS, /* dpms */ - smiDisable, /* disable */ - smiRestore, /* restore */ - smiScreenFini, /* scrfini */ - smiCardFini, /* cardfini */ - - smiCursorInit, /* initCursor */ - smiCursorEnable, /* enableCursor */ - smiCursorDisable, /* disableCursor */ - smiCursorFini, /* finiCursor */ - smiRecolorCursor, /* recolorCursor */ - - smiDrawInit, /* initAccel */ - smiDrawEnable, /* enableAccel */ - smiDrawDisable, /* disableAccel */ - smiDrawFini, /* finiAccel */ - - subGetColors, /* getColors */ - subPutColors, /* putColors */ -}; diff --git a/hw/kdrive/smi/smi.h b/hw/kdrive/smi/smi.h deleted file mode 100644 index ef0fd110a..000000000 --- a/hw/kdrive/smi/smi.h +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright © 2001 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. - */ - -#ifndef _SMI_H_ -#define _SMI_H_ - -#define SMI_VESA 0 - -#if SMI_VESA -#include <vesa.h> -#define subGetColors vesaGetColors -#define subPutColors vesaPutColors -#define subInitialize vesaInitialize -#define subScreenInitialize vesaScreenInitialize -#define subInitScreen vesaInitScreen -#define subFinishInitScreen vesaFinishInitScreen -#define subCreateResources vesaCreateResources -#define subRandRSetConfig vesaRandRSetConfig -#define subPreserve vesaPreserve -#define subEnable vesaEnable -#define subDPMS vesaDPMS -#define subRestore vesaRestore -#define subScreenFini vesaScreenFini -#define subCardFini vesaCardFini -#define subDisable vesaDisable -#define SubCardPrivRec VesaCardPrivRec -#define SubScreenPrivRec VesaScreenPrivRec -#define subUseMsg() vesaUseMsg() -#define subProcessArgument(c,v,i) vesaProcessArgument(c,v,i) -#else -#include <fbdev.h> -#define subGetColors fbdevGetColors -#define subPutColors fbdevPutColors -#define subInitialize fbdevInitialize -#define subScreenInitialize fbdevScreenInitialize -#define subInitScreen fbdevInitScreen -#define subFinishInitScreen fbdevFinishInitScreen -#define subCreateResources fbdevCreateResources -#define subRandRSetConfig fbdevRandRSetConfig -#define subPreserve fbdevPreserve -#define subEnable fbdevEnable -#define subDPMS fbdevDPMS -#define subRestore fbdevRestore -#define subScreenFini fbdevScreenFini -#define subCardFini fbdevCardFini -#define subDisable fbdevDisable -#define SubCardPrivRec FbdevPriv -#define SubScreenPrivRec FbdevScrPriv -#define subUseMsg() -#define subProcessArgument(c,v,i) 0 -#endif - -#include "kxv.h" - -#define SMI_DEBUG 0 -#if SMI_DEBUG -#define DBGOUT(fmt,a...) fprintf (stderr, fmt, ##a) -#else -#define DBGOUT(fmt,a...) -#endif - -#define ENTER() DBGOUT("Enter %s\n", __FUNCTION__) -#define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__) - -/* - * offset from ioport beginning - */ - -#define SMI_IO_BASE(c) ((c)->attr.io) -#define SMI_REG_BASE(c) ((c)->attr.address[0]) -#define SMI_REG_SIZE(c) (4096) - -#define SMI_DPR_OFF(c) (0x00000) - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -/* DPR reg */ -typedef struct _DPR { - VOL32 src_xy; /* 0x00 */ - VOL32 dst_xy; /* 0x04 */ - VOL32 dst_wh; /* 0x08 */ - VOL32 accel_cmd; /* 0x0c */ - VOL32 src_stride; /* 0x10 */ - VOL32 fg; /* 0x14 */ - VOL32 bg; /* 0x18 */ - VOL32 data_format; /* 0x1c */ - VOL32 transparent; /* 0x20 */ - VOL32 mask1; /* 0x24 ? */ - VOL32 mask2; /* 0x28 ? */ - VOL32 scissors_ul; /* 0x2c */ - VOL32 scissors_lr; /* 0x30 */ - VOL32 mask3; /* 0x34 */ - VOL32 mask4; /* 0x38 */ - VOL32 dst_stride; /* 0x3c */ - VOL32 unknown_40; /* 0x40 */ - VOL32 unknown_44; /* 0x44 */ -} DPR; - -#define SMI_XY(x,y) (((y) & 0x7fff) | (((x) & 0x7fff) << 16)) - -/* 2D Engine commands */ -#define SMI_TRANSPARENT_SRC 0x00000100 -#define SMI_TRANSPARENT_DEST 0x00000300 - -#define SMI_OPAQUE_PXL 0x00000000 -#define SMI_TRANSPARENT_PXL 0x00000400 - -#define SMI_MONO_PACK_8 0x00001000 -#define SMI_MONO_PACK_16 0x00002000 -#define SMI_MONO_PACK_32 0x00003000 - -#define SMI_ROP2_SRC 0x00008000 -#define SMI_ROP2_PAT 0x0000C000 -#define SMI_ROP3 0x00000000 - -#define SMI_BITBLT 0x00000000 -#define SMI_RECT_FILL 0x00010000 -#define SMI_TRAPEZOID_FILL 0x00030000 -#define SMI_SHORT_STROKE 0x00060000 -#define SMI_BRESENHAM_LINE 0x00070000 -#define SMI_HOSTBLT_WRITE 0x00080000 -#define SMI_HOSTBLT_READ 0x00090000 -#define SMI_ROTATE_BLT 0x000B0000 - -#define SMI_SRC_COLOR 0x00000000 -#define SMI_SRC_MONOCHROME 0x00400000 - -#define SMI_GRAPHICS_STRETCH 0x00800000 - -#define SMI_ROTATE_CW 0x01000000 -#define SMI_ROTATE_CCW 0x02000000 - -#define SMI_MAJOR_X 0x00000000 -#define SMI_MAJOR_Y 0x04000000 - -#define SMI_LEFT_TO_RIGHT 0x00000000 -#define SMI_RIGHT_TO_LEFT 0x08000000 - -#define SMI_COLOR_PATTERN 0x40000000 -#define SMI_MONO_PATTERN 0x00000000 - -#define SMI_QUICK_START 0x10000000 -#define SMI_START_ENGINE 0x80000000 - -#define VGA_SEQ_INDEX 0x3C4 -#define VGA_SEQ_DATA 0x3C5 - -typedef struct _smiCardInfo { - SubCardPrivRec sub; - CARD16 io_base; - CARD8 *reg_base; - DPR *dpr; - int avail; -} SmiCardInfo; - -#define getSmiCardInfo(kd) ((SmiCardInfo *) ((kd)->card->driver)) -#define smiCardInfo(kd) SmiCardInfo *smic = getSmiCardInfo(kd) - -typedef struct _smiScreenInfo { - SubScreenPrivRec sub; - CARD8 *screen; - CARD32 stride; - CARD32 data_format; - CARD8 dpr_vpr_enable; - KaaScreenInfoRec kaa; -} SmiScreenInfo; - -#define getSmiScreenInfo(kd) ((SmiScreenInfo *) ((kd)->screen->driver)) -#define smiScreenInfo(kd) SmiScreenInfo *smis = getSmiScreenInfo(kd) - -void -smiPreserve (KdCardInfo *card); - -Bool -smiMapReg (KdCardInfo *card, SmiCardInfo *smic); - -void -smiUnmapReg (KdCardInfo *card, SmiCardInfo *smic); - -void -smiOutb (CARD16 port, CARD8 val); - -CARD8 -smiInb (CARD16 port); - -CARD8 -smiGetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id); - -void -smiSetIndex (SmiCardInfo *smic, CARD16 addr, CARD16 data, CARD8 id, CARD8 val); - -void -smiSetMMIO (KdCardInfo *card, SmiCardInfo *smic); - -void -smiResetMMIO (KdCardInfo *card, SmiCardInfo *smic); - -Bool -smiEnable (ScreenPtr pScreen); - -void -smiDisable (ScreenPtr pScreen); - -void -smiWaitAvail(SmiCardInfo *smic, int n); - -void -smiWaitIdle (SmiCardInfo *smic); - -Bool -smiDrawSetup (ScreenPtr pScreen); - -Bool -smiDrawInit (ScreenPtr pScreen); - -void -smiDrawReinit (ScreenPtr pScreen); - -void -smiDrawEnable (ScreenPtr pScreen); - -void -smiDrawDisable (ScreenPtr pScreen); - -void -smiDrawFini (ScreenPtr pScreen); - -CARD8 -smiReadIndex (SmiCardInfo *smic, CARD16 port, CARD8 index); - -void -smiWriteIndex (SmiCardInfo *smic, CARD16 port, CARD8 index, CARD8 value); - -extern KdCardFuncs smiFuncs; - -#endif /* _SMI_H_ */ diff --git a/hw/kdrive/smi/smidraw.c b/hw/kdrive/smi/smidraw.c deleted file mode 100644 index ba4e3904d..000000000 --- a/hw/kdrive/smi/smidraw.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "smi.h" -#include "smidraw.h" - -#include <X11/Xmd.h> -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" -#include "kaa.h" - -CARD8 smiBltRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -CARD8 smiSolidRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0xa0, /* src AND dst */ - /* GXandReverse */ 0x50, /* src AND NOT dst */ - /* GXcopy */ 0xf0, /* src */ - /* GXandInverted*/ 0x0a, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x5a, /* src XOR dst */ - /* GXor */ 0xfa, /* src OR dst */ - /* GXnor */ 0x05, /* NOT src AND NOT dst */ - /* GXequiv */ 0xa5, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xf5, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x0f, /* NOT src */ - /* GXorInverted */ 0xaf, /* NOT src OR dst */ - /* GXnand */ 0x5f, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - - -#define GET_STATUS(smic) smiGetIndex (smic, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x16) - -#define ENGINE_IDLE_EMPTY(smic) ((GET_STATUS(smic) & 0x18) == 0x10) -#define FIFO_EMPTY(smic) ((GET_STATUS(smic) & 0x10) == 0x10) - -#define MAX_FIFO 16 - -void -smiWaitAvail(SmiCardInfo *smic, int n) -{ - if (smic->avail < n) - { - while (!FIFO_EMPTY (smic)) - ; - smic->avail = MAX_FIFO; - } - smic->avail -= n; -} - -void -smiWaitIdle (SmiCardInfo *smic) -{ - while (!ENGINE_IDLE_EMPTY (smic)) - ; - smic->avail = MAX_FIFO; -} - -static SmiCardInfo *smic; -static SmiScreenInfo *smis; -static DPR *dpr; -static CARD32 accel_cmd; - -static Bool -smiSetup (ScreenPtr pScreen, int wait) -{ - KdScreenPriv(pScreen); - - smis = getSmiScreenInfo (pScreenPriv); - smic = getSmiCardInfo(pScreenPriv); - dpr = smic->dpr; - - if (!dpr) - return FALSE; - - /* enable DPR/VPR registers */ - smiSetIndex (smic, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x21, - smis->dpr_vpr_enable); - - smiWaitAvail (smic, wait + 9); - dpr->src_stride = (smis->stride << 16) | smis->stride; - dpr->data_format = smis->data_format; - dpr->mask1 = 0xffffffff; - dpr->mask2 = 0xffffffff; - dpr->dst_stride = (smis->stride << 16) | smis->stride; - dpr->unknown_40 = 0x0; - dpr->unknown_44 = 0x0; - dpr->scissors_ul = 0x0; - dpr->scissors_lr = SMI_XY(4095,4095); - - return TRUE; -} - -static void -smiWaitMarker (ScreenPtr pScreen, int marker) -{ - KdScreenPriv(pScreen); - smic = getSmiCardInfo(pScreenPriv); - - smiWaitIdle (smic); -} - -static Bool -smiPrepareSolid (PixmapPtr pPixmap, - int alu, - Pixel pm, - Pixel fg) -{ - if (~pm & FbFullMask(pPixmap->drawable.depth)) - return FALSE; - - if (!smiSetup (pPixmap->drawable.pScreen, 3)) - return FALSE; - - accel_cmd = smiSolidRop[alu] | SMI_BITBLT | SMI_START_ENGINE; - dpr->fg = fg; - dpr->mask3 = 0xffffffff; - dpr->mask4 = 0xffffffff; - return TRUE; -} - -static void -smiSolid (int x1, int y1, int x2, int y2) -{ - smiWaitAvail(smic,3); - dpr->dst_xy = SMI_XY(x1,y1); - dpr->dst_wh = SMI_XY(x2-x1,y2-y1); - dpr->accel_cmd = accel_cmd; -} - -static void -smiDoneSolid (void) -{ -} - -static int copyDx; -static int copyDy; - -static Bool -smiPrepareCopy (PixmapPtr pSrcPixmap, - PixmapPtr pDstPixmap, - int dx, - int dy, - int alu, - Pixel pm) -{ - if (~pm & FbFullMask(pSrcPixmap->drawable.depth)) - return FALSE; - - if (!smiSetup (pSrcPixmap->drawable.pScreen, 0)) - return FALSE; - - accel_cmd = smiBltRop[alu] | SMI_BITBLT | SMI_START_ENGINE; - - copyDx = dx; - copyDy = dy; - if (dy < 0 || (dy == 0 && dx < 0)) - accel_cmd |= SMI_RIGHT_TO_LEFT; - return TRUE; -} - -static void -smiCopy (int srcX, - int srcY, - int dstX, - int dstY, - int w, - int h) -{ - if (accel_cmd & SMI_RIGHT_TO_LEFT) - { - srcX += w - 1; - dstX += w - 1; - srcY += h - 1; - dstY += h - 1; - } - smiWaitAvail (smic, 4); - dpr->src_xy = SMI_XY (srcX, srcY); - dpr->dst_xy = SMI_XY (dstX, dstY); - dpr->dst_wh = SMI_XY (w, h); - dpr->accel_cmd = accel_cmd; -} - -static void -smiDoneCopy (void) -{ -} - - -Bool -smiDrawInit (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - smiCardInfo (pScreenPriv); - - ENTER (); - if (pScreenPriv->screen->fb[0].depth == 4) - { - LEAVE (); - return FALSE; - } - - if (!smic->dpr) - { - LEAVE (); - return FALSE; - } - - memset(&smis->kaa, 0, sizeof(KaaScreenInfoRec)); - smis->kaa.PrepareSolid = smiPrepareSolid; - smis->kaa.Solid = smiSolid; - smis->kaa.DoneSolid = smiDoneSolid; - smis->kaa.PrepareCopy = smiPrepareCopy; - smis->kaa.Copy = smiCopy; - smis->kaa.DoneCopy = smiDoneCopy; - smis->kaa.waitMarker = smiWaitMarker; - - if (!kaaDrawInit (pScreen, &smis->kaa)) - { - LEAVE (); - return FALSE; - } - - LEAVE (); - return TRUE; -} - -void -smiDrawEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - int i; - static const int xyAddress[] = { 320, 400, 512, 640, 800, 1024, 1280, 1600, 2048 }; - - ENTER (); - smis = getSmiScreenInfo (pScreenPriv); - smic = getSmiCardInfo(pScreenPriv); - dpr = smic->dpr; - - smis->stride = pScreenPriv->screen->fb[0].byteStride; - smis->dpr_vpr_enable = smiGetIndex (smic, VGA_SEQ_INDEX, - VGA_SEQ_DATA, 0x21) & ~0x03; - - switch (pScreenPriv->screen->fb[0].depth) { - case 8: - smis->data_format = 0x00000000; - break; - case 15: - case 16: - smis->data_format = 0x00100000; - smis->stride >>= 1; - break; - case 24: - smis->data_format = 0x00300000; - break; - case 32: - smis->data_format = 0x00200000; - smis->stride >>= 2; - break; - } - for (i = 0; i < sizeof(xyAddress) / sizeof(xyAddress[0]); i++) - { - if (xyAddress[i] == pScreenPriv->screen->fb[0].pixelStride) - { - smis->data_format |= i << 16; - break; - } - } - - smiSetup (pScreen, 0); - kaaMarkSync (pScreen); - LEAVE (); -} - -void -smiDrawDisable (ScreenPtr pScreen) -{ - ENTER (); - smic = 0; - smis = 0; - dpr = 0; - accel_cmd = 0; - LEAVE (); -} - -void -smiDrawFini (ScreenPtr pScreen) -{ - ENTER (); - LEAVE (); -} diff --git a/hw/kdrive/smi/smidraw.h b/hw/kdrive/smi/smidraw.h deleted file mode 100644 index 4165c7406..000000000 --- a/hw/kdrive/smi/smidraw.h +++ /dev/null @@ -1,69 +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. - */ - -#ifndef _SMIDRAW_H_ -#define _SMIDRAW_H_ - -#define SetupSmi(s) KdScreenPriv(s); \ - smiCardInfo(pScreenPriv); \ - Cop *cop = smic->cop - -#define SmiAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) - -#define _smiInit(cop,smic) { \ - if ((cop)->status == 0xffffffff) smiSetMMIO(smic); \ - (cop)->multi = (smic)->cop_depth; \ - (cop)->multi = (smic)->cop_stride; \ - (cop)->multi = SmiAlpha; \ -} \ - -#define _smiSetSolidRect(cop,pix,alu,cmd) {\ - cop->multi = COP_MULTI_PATTERN; \ - cop->multi = COP_MULTI_ROP | smiRop[alu]; \ - cop->fg = (pix); \ - cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ -} - -#define _smiRect(cop,x1,y1,x2,y2,cmd) { \ - (cop)->dst_start_xy = TRI_XY (x1,y1); \ - (cop)->dst_end_xy = TRI_XY(x2,y2); \ - _smiWaitDone(cop); \ - (cop)->command = (cmd); \ -} - -#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ - COP_STATUS_DPE_BUSY | \ - COP_STATUS_MI_BUSY) - -#define _smiWaitDone(cop) { \ - int __q__ = 500000; \ - while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ - ; \ - if (!__q__) \ - (cop)->status = 0; \ -} - -#define _smiWaitIdleEmpty(cop) _smiWaitDone(cop) - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#endif diff --git a/hw/kdrive/smi/smistub.c b/hw/kdrive/smi/smistub.c deleted file mode 100644 index 59faf2839..000000000 --- a/hw/kdrive/smi/smistub.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "smi.h" -#include "klinux.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - - if (LinuxFindPci (0x126f, 0x0720, 0, &attr)) - KdCardInfoAdd (&smiFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); - subUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!(ret = subProcessArgument (argc, argv, i))) - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/smi/smivideo.c b/hw/kdrive/smi/smivideo.c deleted file mode 100644 index f372498c0..000000000 --- a/hw/kdrive/smi/smivideo.c +++ /dev/null @@ -1,1015 +0,0 @@ -/* - * Copyright © 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "mach64.h" - -#include "Xv.h" -#include "../../xfree86/common/fourcc.h" - -#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) - -static Atom xvBrightness, xvSaturation, xvColorKey; - -#define IMAGE_MAX_WIDTH 720 -#define IMAGE_MAX_HEIGHT 576 - -static void -mach64StopVideo(KdScreenInfo *screen, pointer data, Bool exit) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - Reg *reg = mach64c->reg; - MediaReg *media = mach64c->media_reg; - - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - - if (!media) - return; - - if(pPortPriv->videoOn) - { - mach64WaitIdle (reg); - /* wait for buffer to be displayed */ - while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) - ; - /* wait for buffer to be finished */ - while (((media->TRIG_CNTL >> 6) & 1) != 0) - ; - mach64WaitAvail (reg, 1); - media->OVERLAY_SCALE_CNTL = 0; - pPortPriv->videoOn = FALSE; - mach64WaitIdle (reg); - } -} - -static int -mach64SetPortAttribute(KdScreenInfo *screen, - Atom attribute, - int value, - pointer data) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - MediaReg *media = mach64c->media_reg; - - if(attribute == xvBrightness) - { - if(value < -1000) - value = -1000; - if (value > 1000) - value = 1000; - pPortPriv->brightness = value; - } - else if(attribute == xvSaturation) - { - if (value < -1000) - value = -1000; - if (value > 1000) - value = 1000; - pPortPriv->saturation = value; - } - else if(attribute == xvColorKey) - { - if (pPortPriv->colorKey != value) - { - pPortPriv->colorKey = value; - REGION_EMPTY(screen->pScreen, &pPortPriv->clip); - } - } - else - return BadMatch; - - return Success; -} - -static int -mach64GetPortAttribute(KdScreenInfo *screen, - Atom attribute, - int *value, - pointer data) -{ - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; - - if(attribute == xvBrightness) - *value = pPortPriv->brightness; - else if(attribute == xvSaturation) - *value = pPortPriv->saturation; - else if(attribute == xvColorKey) - *value = pPortPriv->colorKey; - else - return BadMatch; - - return Success; -} - -static void -mach64QueryBestSize(KdScreenInfo *screen, - Bool motion, - short vid_w, - short vid_h, - short drw_w, - short drw_h, - unsigned int *p_w, - unsigned int *p_h, - pointer data) -{ - *p_w = drw_w; - *p_h = drw_h; -} - - -static void -mach64CopyPackedData(KdScreenInfo *screen, - unsigned char *buf, - int randr, - int srcPitch, - int dstPitch, - int srcW, - int srcH, - int top, - int left, - int h, - int w) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - CARD8 *src, *dst; - int srcDown, srcRight, srcNext; - int p; - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - src = buf; - srcDown = srcPitch; - srcRight = 2; - break; - case RR_Rotate_90: - src = buf + (srcH - 1) * 2; - srcDown = -2; - srcRight = srcPitch; - break; - case RR_Rotate_180: - src = buf + srcPitch * (srcH - 1) + (srcW - 1) * 2; - srcDown = -srcPitch; - srcRight = -2; - break; - case RR_Rotate_270: - src = buf + srcPitch * (srcW - 1); - srcDown = 2; - srcRight = -srcPitch; - break; - } - - src = src + top*srcDown + left*srcRight; - - if (pPortPriv->currentBuf == 0) - dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; - else - dst = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; - - w >>= 1; - srcRight >>= 1; - srcNext = srcRight >> 1; - while(h--) - { - CARD16 *s = (CARD16 *) src; - CARD32 *d = (CARD32 *) dst; - p = w; - while (p--) - { - *d++ = s[0] | (s[srcNext] << 16); - s += srcRight; - } - src += srcPitch; - dst += dstPitch; - } -} - -static void -mach64CopyPlanarData(KdScreenInfo *screen, - unsigned char *buf, - int randr, - int srcPitch, - int srcPitch2, - int dstPitch, /* of chroma */ - int srcW, - int srcH, - int height, - int top, - int left, - int h, - int w, - int id) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - int i, j; - CARD8 *src1, *src2, *src3, *dst1; - int srcDown, srcDown2, srcRight, srcRight2, srcNext; - - /* compute source data pointers */ - src1 = buf; - src2 = src1 + height * srcPitch; - src3 = src2 + (height >> 1) * srcPitch2; - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - srcDown = srcPitch; - srcDown2 = srcPitch2; - srcRight = 2; - srcRight2 = 1; - srcNext = 1; - break; - case RR_Rotate_90: - src1 = src1 + srcH - 1; - src2 = src2 + (srcH >> 1) - 1; - src3 = src3 + (srcH >> 1) - 1; - srcDown = -1; - srcDown2 = -1; - srcRight = srcPitch * 2; - srcRight2 = srcPitch2; - srcNext = srcPitch; - break; - case RR_Rotate_180: - src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); - src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - srcDown = -srcPitch; - srcDown2 = -srcPitch2; - srcRight = -2; - srcRight2 = -1; - srcNext = -1; - break; - case RR_Rotate_270: - src1 = src1 + srcPitch * (srcW - 1); - src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); - srcDown = 1; - srcDown2 = 1; - srcRight = -srcPitch * 2; - srcRight2 = -srcPitch2; - srcNext = -srcPitch; - break; - } - - /* adjust for origin */ - src1 += top * srcDown + left * srcNext; - src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - - if (id == FOURCC_I420) - { - CARD8 *srct = src2; - src2 = src3; - src3 = srct; - } - - if (pPortPriv->currentBuf == 0) - dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf0Offset; - else - dst1 = (CARD8 *) mach64s->vesa.fb + pPortPriv->YBuf1Offset; - - w >>= 1; - for (j = 0; j < h; j++) - { - CARD32 *dst = (CARD32 *) dst1; - CARD8 *s1l = src1; - CARD8 *s1r = src1 + srcNext; - CARD8 *s2 = src2; - CARD8 *s3 = src3; - - for (i = 0; i < w; i++) - { - *dst++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); - s1l += srcRight; - s1r += srcRight; - s2 += srcRight2; - s3 += srcRight2; - } - src1 += srcDown; - dst1 += dstPitch; - if (j & 1) - { - src2 += srcDown2; - src3 += srcDown2; - } - } -} - -static void -mach64PaintRegion (ScreenPtr pScreen, RegionPtr pRgn, Pixel fg) -{ - WindowPtr pRoot = WindowTable[pScreen->myNum]; - GCPtr pGC; - CARD32 val[2]; - xRectangle *rects, *r; - BoxPtr pBox = REGION_RECTS (pRgn); - int nBox = REGION_NUM_RECTS (pRgn); - - rects = xalloc (nBox * sizeof (xRectangle)); - if (!rects) - goto bail0; - r = rects; - while (nBox--) - { - r->x = pBox->x1; - r->y = pBox->y1; - r->width = pBox->x2 - pBox->x1; - r->height = pBox->y2 - pBox->y1; - r++; - pBox++; - } - - pGC = GetScratchGC (pRoot->drawable.depth, pScreen); - if (!pGC) - goto bail1; - - val[0] = fg; - val[1] = IncludeInferiors; - ChangeGC (pGC, GCForeground|GCSubwindowMode, val); - - ValidateGC (&pRoot->drawable, pGC); - - (*pGC->ops->PolyFillRect) (&pRoot->drawable, pGC, - REGION_NUM_RECTS (pRgn), rects); - - FreeScratchGC (pGC); -bail1: - xfree (rects); -bail0: - ; -} - -/* Mach64ClipVideo - - - Takes the dst box in standard X BoxRec form (top and left - edges inclusive, bottom and right exclusive). The new dst - box is returned. The source boundaries are given (x1, y1 - inclusive, x2, y2 exclusive) and returned are the new source - boundaries in 16.16 fixed point. -*/ - -static void -Mach64ClipVideo(BoxPtr dst, - INT32 *x1, - INT32 *x2, - INT32 *y1, - INT32 *y2, - BoxPtr extents, /* extents of the clip region */ - INT32 width, - INT32 height) -{ - INT32 vscale, hscale, delta; - int diff; - - hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); - vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); - - *x1 <<= 16; *x2 <<= 16; - *y1 <<= 16; *y2 <<= 16; - - diff = extents->x1 - dst->x1; - if(diff > 0) { - dst->x1 = extents->x1; - *x1 += diff * hscale; - } - diff = dst->x2 - extents->x2; - if(diff > 0) { - dst->x2 = extents->x2; - *x2 -= diff * hscale; - } - diff = extents->y1 - dst->y1; - if(diff > 0) { - dst->y1 = extents->y1; - *y1 += diff * vscale; - } - diff = dst->y2 - extents->y2; - if(diff > 0) { - dst->y2 = extents->y2; - *y2 -= diff * vscale; - } - - if(*x1 < 0) { - diff = (- *x1 + hscale - 1)/ hscale; - dst->x1 += diff; - *x1 += diff * hscale; - } - delta = *x2 - (width << 16); - if(delta > 0) { - diff = (delta + hscale - 1)/ hscale; - dst->x2 -= diff; - *x2 -= diff * hscale; - } - if(*y1 < 0) { - diff = (- *y1 + vscale - 1)/ vscale; - dst->y1 += diff; - *y1 += diff * vscale; - } - delta = *y2 - (height << 16); - if(delta > 0) { - diff = (delta + vscale - 1)/ vscale; - dst->y2 -= diff; - *y2 -= diff * vscale; - } -} - -static void -mach64DisplayVideo(KdScreenInfo *screen, - int id, - int dstPitch, /* of chroma for 4:2:0 */ - int x1, - int y1, - int x2, - int y2, - int dst_x1, - int dst_y1, - int dst_x2, - int dst_y2, - short src_w, - short src_h, - short drw_w, - short drw_h) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - Reg *reg = mach64c->reg; - MediaReg *media = mach64c->media_reg; - int xscaleInt, xscaleFract, yscaleInt, yscaleFract; - int xscaleIntUV = 0, xscaleFractUV = 0; - int yscaleIntUV = 0, yscaleFractUV = 0; - int randr = mach64s->vesa.randr; - int HORZ_INC, VERT_INC; - CARD32 SCALER_IN; - CARD32 OVERLAY_SCALE_CNTL; - int tmp; - int left; - int bright; - int sat; - - if (id == FOURCC_UYVY) - SCALER_IN = SCALER_IN_YVYU422; - else - SCALER_IN = SCALER_IN_VYUY422; - - mach64WaitAvail (reg, 4); - - media->VIDEO_FORMAT = SCALER_IN | VIDEO_IN_VYUY422; - - /* color key */ - media->OVERLAY_GRAPHICS_KEY_MSK = (1 << screen->fb[0].depth) - 1; - media->OVERLAY_GRAPHICS_KEY_CLR = pPortPriv->colorKey; - /* set key control to obey only graphics color key */ - media->OVERLAY_KEY_CNTL = 0x50; - - mach64WaitAvail (reg, 9); - media->CAPTURE_DEBUG = 0; - /* no exclusive video region */ - media->OVERLAY_EXCLUSIVE_HORZ = 0; - media->OVERLAY_EXCLUSIVE_VERT = 0; - /* scaling coefficients */ - media->SCALER_H_COEFF0 = 0x00002000; - media->SCALER_H_COEFF1 = 0x0D06200D; - media->SCALER_H_COEFF2 = 0x0D0A1C0D; - media->SCALER_H_COEFF3 = 0x0C0E1A0C; - media->SCALER_H_COEFF4 = 0x0C14140C; - media->SCALER_TEST = 0; - - mach64WaitAvail (reg, 2); - media->OVERLAY_SCALE_CNTL = (SCALE_PIX_EXPAND | - SCALE_GAMMA_BRIGHT | - SCALE_BANDWIDTH | - SCALE_OVERLAY_EN | - SCALE_EN); - - bright = (pPortPriv->brightness * 64 / 1000); - if (bright < -0x40) - bright = -0x40; - if (bright > 0x3f) - bright = 0x3f; - bright = bright & 0x7f; - sat = ((pPortPriv->saturation * 31 + 31000) / 2000); - if (sat > 0x1f) - sat = 0x1f; - if (sat < 0) - sat = 0; - - media->SCALER_COLOUR_CNTL = ((bright << 0) | /* BRIGHTNESS */ - (sat << 8) | /* SATURATION_U */ - (sat << 16) | /* SATURATION_V */ - (0 << 21) | /* SCALER_VERT_ADJ_UV */ - (0 << 28)); /* SCALER_HORZ_ADJ_UV */ - - VERT_INC = (src_h << 12) / drw_h; - HORZ_INC = (src_w << 12) / drw_w; - - mach64WaitAvail (reg, 13); - - /* lock registers to prevent non-atomic update */ - media->OVERLAY_Y_X_START = 0x80000000 | MACH64_YX (dst_x1, dst_y1); - /* ending screen coordinate */ - media->OVERLAY_Y_X_END = 0x80000000 | MACH64_YX (dst_x2, dst_y2); - - media->OVERLAY_SCALE_INC = MACH64_YX(HORZ_INC, VERT_INC); - - media->SCALER_BUF0_OFFSET = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET = pPortPriv->YBuf1Offset; - - media->SCALER_BUF0_OFFSET_U = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET_U = pPortPriv->YBuf1Offset; - - media->SCALER_BUF0_OFFSET_V = pPortPriv->YBuf0Offset; - media->SCALER_BUF1_OFFSET_V = pPortPriv->YBuf1Offset; - - media->SCALER_BUF_PITCH = dstPitch >> 1; - media->SCALER_HEIGHT_WIDTH = MACH64_YX(src_w - (x1 >> 16), src_h - (y1 >> 16)); - - media->CAPTURE_CONFIG = pPortPriv->currentBuf << 28; - - /* set XY location and unlock */ - media->OVERLAY_Y_X_START = MACH64_YX (dst_x1, dst_y1); -} - -static int -mach64PutImage(KdScreenInfo *screen, - short src_x, - short src_y, - short drw_x, - short drw_y, - short src_w, - short src_h, - short drw_w, - short drw_h, - int id, - unsigned char *buf, - short width, - short height, - Bool sync, - RegionPtr clipBoxes, - pointer data) -{ - KdCardInfo *card = screen->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; - Reg *reg = mach64c->reg; - MediaReg *media = mach64c->media_reg; - INT32 x1, x2, y1, y2; - int randr = mach64s->vesa.randr; - int srcPitch, srcPitch2, dstPitch; - int top, left, npixels, nlines, size; - BoxRec dstBox; - int dst_width = width, dst_height = height; - int rot_x1, rot_y1, rot_x2, rot_y2; - int dst_x1, dst_y1, dst_x2, dst_y2; - int rot_src_w, rot_src_h, rot_drw_w, rot_drw_h; - - /* Clip */ - x1 = src_x; - x2 = src_x + src_w; - y1 = src_y; - y2 = src_y + src_h; - - dstBox.x1 = drw_x; - dstBox.x2 = drw_x + drw_w; - dstBox.y1 = drw_y; - dstBox.y2 = drw_y + drw_h; - - Mach64ClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - - if((x1 >= x2) || (y1 >= y2)) - return Success; - - if (!media) - return BadAlloc; - - if (randr & (RR_Rotate_0|RR_Rotate_180)) - { - dst_width = width; - dst_height = height; - rot_src_w = src_w; - rot_src_h = src_h; - rot_drw_w = drw_w; - rot_drw_h = drw_h; - } - else - { - dst_width = height; - dst_height = width; - rot_src_w = src_h; - rot_src_h = src_w; - rot_drw_w = drw_h; - rot_drw_h = drw_w; - } - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - dst_x1 = dstBox.x1; - dst_y1 = dstBox.y1; - dst_x2 = dstBox.x2; - dst_y2 = dstBox.y2; - rot_x1 = x1; - rot_y1 = y1; - rot_x2 = x2; - rot_y2 = y2; - break; - case RR_Rotate_90: - dst_x1 = dstBox.y1; - dst_y1 = screen->height - dstBox.x2; - dst_x2 = dstBox.y2; - dst_y2 = screen->height - dstBox.x1; - - rot_x1 = y1; - rot_y1 = (src_w << 16) - x2; - rot_x2 = y2; - rot_y2 = (src_w << 16) - x1; - break; - case RR_Rotate_180: - dst_x1 = screen->width - dstBox.x2; - dst_y1 = screen->height - dstBox.y2; - dst_x2 = screen->width - dstBox.x1; - dst_y2 = screen->height - dstBox.y1; - rot_x1 = (src_w << 16) - x2; - rot_y1 = (src_h << 16) - y2; - rot_x2 = (src_w << 16) - x1; - rot_y2 = (src_h << 16) - y1; - break; - case RR_Rotate_270: - dst_x1 = screen->width - dstBox.y2; - dst_y1 = dstBox.x1; - dst_x2 = screen->width - dstBox.y1; - dst_y2 = dstBox.x2; - rot_x1 = (src_h << 16) - y2; - rot_y1 = x1; - rot_x2 = (src_h << 16) - y1; - rot_y2 = x2; - break; - } - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width + 3) & ~3; - srcPitch2 = ((width >> 1) + 3) & ~3; - size = dstPitch * (int) dst_height; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - dstPitch = ((dst_width << 1) + 15) & ~15; - srcPitch = (width << 1); - size = dstPitch * (int) dst_height; - break; - } - - pPortPriv->offset = mach64s->off_screen - (CARD8 *) mach64s->vesa.fb; - /* fixup pointers */ - - pPortPriv->YBuf0Offset = pPortPriv->offset; - pPortPriv->YBuf1Offset = pPortPriv->offset + size; - -#if 0 - mach64WaitIdle (reg); - - if (pPortPriv->videoOn) - { - /* wait for buffer to be displayed */ - while (((media->TRIG_CNTL >> 5) & 1) != pPortPriv->currentBuf) - ; - } -#endif - /* - * Use the other buffer - */ - pPortPriv->currentBuf = 1 - pPortPriv->currentBuf; - - /* copy data */ - top = rot_y1 >> 16; - left = (rot_x1 >> 16) & ~1; - npixels = ((((rot_x2 + 0xffff) >> 16) + 1) & ~1) - left; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((rot_y2 + 0xffff) >> 16) + 1) & ~1) - top; - mach64CopyPlanarData(screen, buf, randr, - srcPitch, srcPitch2, dstPitch, - rot_src_w, rot_src_h, height, - top, left, nlines, npixels, id); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - nlines = ((rot_y2 + 0xffff) >> 16) - top; - mach64CopyPackedData(screen, buf, randr, - srcPitch, dstPitch, - rot_src_w, rot_src_h, - top, left, nlines, - npixels); - break; - } - - mach64DisplayVideo(screen, id, dstPitch, - rot_x1, rot_y1, rot_x2, rot_y2, - dst_x1, dst_y1, - dst_x2, dst_y2, - rot_src_w, rot_src_h, rot_drw_w, rot_drw_h); - - /* update cliplist */ - if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) - { - REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); - } - - pPortPriv->videoOn = TRUE; - - return Success; -} - -static int -mach64QueryImageAttributes(KdScreenInfo *screen, - int id, - unsigned short *w, - unsigned short *h, - int *pitches, - int *offsets) -{ - int size, tmp; - - if(*w > IMAGE_MAX_WIDTH) - *w = IMAGE_MAX_WIDTH; - if(*h > IMAGE_MAX_HEIGHT) - *h = IMAGE_MAX_HEIGHT; - - *w = (*w + 1) & ~1; - if(offsets) offsets[0] = 0; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - *h = (*h + 1) & ~1; - size = (*w + 3) & ~3; - if(pitches) - pitches[0] = size; - size *= *h; - if(offsets) - offsets[1] = size; - tmp = ((*w >> 1) + 3) & ~3; - if(pitches) - pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if(offsets) - offsets[2] = size; - size += tmp; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) - pitches[0] = size; - size *= *h; - break; - } - - return size; -} - - -/* client libraries expect an encoding */ -static KdVideoEncodingRec DummyEncoding[1] = -{ - { - 0, - "XV_IMAGE", - IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, - {1, 1} - } -}; - -#define NUM_FORMATS 3 - -static KdVideoFormatRec Formats[NUM_FORMATS] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; - -#define NUM_ATTRIBUTES 3 - -static KdAttributeRec Attributes[NUM_ATTRIBUTES] = -{ - {XvSettable | XvGettable, 0, ~0, "XV_COLORKEY"}, - {XvSettable | XvGettable, -1000, 1000, "XV_BRIGHTNESS"}, - {XvSettable | XvGettable, -1000, 1000, "XV_SATURATION"} -}; - -#define NUM_IMAGES 4 - -static KdImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YUY2, - XVIMAGE_YV12, - XVIMAGE_I420, - XVIMAGE_UYVY -}; - -static void mach64ResetVideo(KdScreenInfo *screen) -{ - ScreenPtr pScreen = screen->pScreen; - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - Mach64PortPrivPtr pPortPriv = mach64s->pAdaptor->pPortPrivates[0].ptr; - MediaReg *media = mach64c->media_reg; - - /* - * Default to maximum image size in YV12 - */ - -} - -static int -mach64ReputImage (KdScreenInfo *screen, - short drw_x, - short drw_y, - RegionPtr clipBoxes, - pointer data) -{ - ScreenPtr pScreen = screen->pScreen; - Mach64PortPrivPtr pPortPriv = (Mach64PortPrivPtr)data; - BoxPtr pOldExtents = REGION_EXTENTS (pScreen, &pPortPriv->clip); - BoxPtr pNewExtents = REGION_EXTENTS (pScreen, clipBoxes); - - if (pOldExtents->x1 == pNewExtents->x1 && - pOldExtents->x2 == pNewExtents->x2 && - pOldExtents->y1 == pNewExtents->y1 && - pOldExtents->y2 == pNewExtents->y2) - { - /* update cliplist */ - if (!REGION_EQUAL (screen->pScreen, &pPortPriv->clip, clipBoxes)) - { - REGION_COPY (screen->pScreen, &pPortPriv->clip, clipBoxes); - mach64PaintRegion (screen->pScreen, &pPortPriv->clip, pPortPriv->colorKey); - } - return Success; - } - return BadMatch; -} - -static KdVideoAdaptorPtr -mach64SetupImageVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - mach64CardInfo(pScreenPriv); - mach64ScreenInfo(pScreenPriv); - KdScreenInfo *screen = pScreenPriv->screen; - KdCardInfo *card = pScreenPriv->card; - KdVideoAdaptorPtr adapt; - Mach64PortPrivPtr pPortPriv; - - if(!(adapt = xcalloc(1, sizeof(KdVideoAdaptorRec) + - sizeof(Mach64PortPrivRec) + - sizeof(DevUnion)))) - return NULL; - - adapt->type = XvWindowMask | XvInputMask | XvImageMask; - adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - adapt->name = "Mach64 Video Overlay"; - adapt->nEncodings = 1; - adapt->pEncodings = DummyEncoding; - adapt->nFormats = NUM_FORMATS; - adapt->pFormats = Formats; - adapt->nPorts = 1; - adapt->pPortPrivates = (DevUnion*)(&adapt[1]); - - pPortPriv = (Mach64PortPrivPtr)(&adapt->pPortPrivates[1]); - - adapt->pPortPrivates[0].ptr = (pointer)(pPortPriv); - adapt->pAttributes = Attributes; - adapt->nImages = NUM_IMAGES; - adapt->nAttributes = NUM_ATTRIBUTES; - adapt->pImages = Images; - adapt->PutVideo = NULL; - adapt->PutStill = NULL; - adapt->GetVideo = NULL; - adapt->GetStill = NULL; - adapt->StopVideo = mach64StopVideo; - adapt->SetPortAttribute = mach64SetPortAttribute; - adapt->GetPortAttribute = mach64GetPortAttribute; - adapt->QueryBestSize = mach64QueryBestSize; - adapt->PutImage = mach64PutImage; - adapt->ReputImage = mach64ReputImage; - adapt->QueryImageAttributes = mach64QueryImageAttributes; - - pPortPriv->colorKey = mach64s->colorKey; - pPortPriv->videoOn = FALSE; - pPortPriv->brightness = 0; - pPortPriv->saturation = 0; - pPortPriv->currentBuf = 0; - - /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPortPriv->clip, NullBox, 0); - - mach64s->pAdaptor = adapt; - - xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); - xvSaturation = MAKE_ATOM("XV_SATURATION"); - xvColorKey = MAKE_ATOM("XV_COLORKEY"); - - mach64ResetVideo(screen); - - return adapt; -} - -Bool mach64InitVideo(ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL; - KdVideoAdaptorPtr newAdaptor = NULL; - int num_adaptors; - KdCardInfo *card = pScreenPriv->card; - Mach64ScreenInfo *mach64s = (Mach64ScreenInfo *) screen->driver; - Mach64CardInfo *mach64c = (Mach64CardInfo *) card->driver; - - if (!mach64c->media_reg) - return FALSE; - - newAdaptor = mach64SetupImageVideo(pScreen); - - num_adaptors = KdXVListGenericAdaptors(screen, &adaptors); - - if(newAdaptor) - { - if(!num_adaptors) - { - num_adaptors = 1; - adaptors = &newAdaptor; - } - else - { - newAdaptors = xalloc((num_adaptors + 1) * - sizeof(KdVideoAdaptorPtr*)); - if(newAdaptors) - { - memcpy(newAdaptors, adaptors, - num_adaptors * sizeof(KdVideoAdaptorPtr)); - newAdaptors[num_adaptors] = newAdaptor; - adaptors = newAdaptors; - num_adaptors++; - } - } - } - - if(num_adaptors) - KdXVScreenInit(pScreen, adaptors, num_adaptors); - - if(newAdaptors) - xfree(newAdaptors); - return TRUE; -} diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 50148c49c..e2ee4adea 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -1353,12 +1353,6 @@ KdInitOutput (ScreenInfo *pScreenInfo, KdCardInfo *card; KdScreenInfo *screen; -#ifdef COMPOSITE - /* kind of a hack: we want Composite enabled, but it's disabled per - * default. */ - noCompositeExtension = FALSE; -#endif - if (!kdCardInfo) { InitCard (0); diff --git a/hw/kdrive/trident/trident.c b/hw/kdrive/trident/trident.c deleted file mode 100644 index 694a70810..000000000 --- a/hw/kdrive/trident/trident.c +++ /dev/null @@ -1,612 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "trident.h" -#include <sys/io.h> - -#undef TRI_DEBUG - -int trident_clk = 0; -int trident_mclk = 0; - -#define CLOCK 14318 /* KHz */ -#define CLK_N(a,b) (a & 0xff) -#define CLK_M(a,b) ((b) & 0x3f) -#define CLK_K(a,b) (((b) >> 6) & 3) -#define CLK_FREQ(a,b) (((CLK_N(a,b) + 8) * CLOCK) / ((CLK_M(a,b)+2) << CLK_K(a,b))) - -Bool -tridentCardInit (KdCardInfo *card) -{ - int k; - char *pixels; - TridentCardInfo *tridentc; - CARD8 r39; - - tridentc = (TridentCardInfo *) xalloc (sizeof (TridentCardInfo)); - if (!tridentc) - return FALSE; - - iopl (3); - tridentc->cop_base = (CARD8 *) KdMapDevice (TRIDENT_COP_BASE(card), - TRIDENT_COP_SIZE(card)); - - if (tridentc->cop_base) - { - KdSetMappedMode (TRIDENT_COP_BASE(card), - TRIDENT_COP_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - } - tridentc->cop = (Cop *) (tridentc->cop_base + TRIDENT_COP_OFF(card)); - tridentc->mmio = FALSE; - r39 = tridentReadIndex (tridentc, 0x3d4, 0x39); - if (r39 & 1) - { - tridentc->mmio = TRUE; - r39 = tridentReadIndex (tridentc, 0x3d4, 0x39); - if ((r39 & 1) == 0) - { - ErrorF ("Trident: inconsisent IO mapping values\n"); - return FALSE; - } - } - -#ifdef VESA - if (!vesaInitialize (card, &tridentc->vesa)) -#else - if (!fbdevInitialize (card, &tridentc->fb)) -#endif - { - xfree (tridentc); - return FALSE; - } - -#ifdef USE_PCI - tridentc->window = (CARD32 *) (tridentc->cop_base + 0x10000); -#else - tridentc->window = 0; -#endif - card->driver = tridentc; - - return TRUE; -} - -Bool -tridentScreenInit (KdScreenInfo *screen) -{ - TridentCardInfo *tridentc = screen->card->driver; - TridentScreenInfo *tridents; - int screen_size, memory; - - tridents = (TridentScreenInfo *) xalloc (sizeof (TridentScreenInfo)); - if (!tridents) - return FALSE; - memset (tridents, '\0', sizeof (TridentScreenInfo)); -#ifdef VESA - if (!vesaScreenInitialize (screen, &tridents->vesa)) -#else - if (!fbdevScreenInitialize (screen, &tridents->fbdev)) -#endif - { - xfree (tridents); - return FALSE; - } - if (!tridentc->cop) - screen->dumb = TRUE; -#ifdef VESA - if (tridents->vesa.mapping != VESA_LINEAR) - screen->dumb = TRUE; - tridents->screen = tridents->vesa.fb; - memory = tridents->vesa.fb_size; -#else - tridents->screen = tridentc->fb.fb; - memory = (2048 + 512) * 1024; -#endif - screen_size = screen->fb[0].byteStride * screen->height; - if (tridents->screen && memory >= screen_size + 2048) - { - memory -= 2048; - tridents->cursor_base = tridents->screen + memory - 2048; - } - else - tridents->cursor_base = 0; - memory -= screen_size; - if (memory > screen->fb[0].byteStride) - { - tridents->off_screen = tridents->screen + screen_size; - tridents->off_screen_size = memory; - } - else - { - tridents->off_screen = 0; - tridents->off_screen_size = 0; - } - screen->driver = tridents; - return TRUE; -} - -Bool -tridentInitScreen (ScreenPtr pScreen) -{ -#ifdef VESA - return vesaInitScreen (pScreen); -#else - return fbdevInitScreen (pScreen); -#endif -} - -Bool -tridentFinishInitScreen (ScreenPtr pScreen) -{ -#ifdef VESA - return vesaFinishInitScreen (pScreen); -#endif -} - -CARD8 -tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index) -{ - CARD8 value; - - if (tridentc->mmio) - { - tridentc->cop_base[port] = index; - value = tridentc->cop_base[port+1]; - } - else - { - outb (index, port); - value = inb (port+1); - } - return value; -} - -void -tridentWriteIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index, CARD8 value) -{ - if (tridentc->mmio) - { - tridentc->cop_base[port] = index; - tridentc->cop_base[port+1] = value; - } - else - { - outb (index, port); - outb (value, port+1); - } -} - -CARD8 -tridentReadReg (TridentCardInfo *tridentc, CARD16 port) -{ - CARD8 value; - - if (tridentc->mmio) - { - value = tridentc->cop_base[port]; - } - else - { - value = inb (port); - } - return value; -} - -void -tridentWriteReg (TridentCardInfo *tridentc, CARD16 port, CARD8 value) -{ - if (tridentc->mmio) - { - tridentc->cop_base[port] = value; - } - else - { - outb (value, port); - } -} - - -void -tridentPause () -{ - struct timeval tv; - - tv.tv_sec = 0; - tv.tv_usec = 50 * 1000; - select (1, 0, 0, 0, &tv); -} - -void -tridentPreserve (KdCardInfo *card) -{ - TridentCardInfo *tridentc = card->driver; - -#ifdef VESA - vesaPreserve(card); -#else - fbdevPreserve (card); -#endif - tridentPause (); - tridentc->save.reg_3c4_0e = tridentReadIndex (tridentc, 0x3c4, 0x0e); - tridentc->save.reg_3d4_36 = tridentReadIndex (tridentc, 0x3d4, 0x36); - tridentc->save.reg_3d4_39 = tridentReadIndex (tridentc, 0x3d4, 0x39); - tridentc->save.reg_3d4_62 = tridentReadIndex (tridentc, 0x3d4, 0x62); - tridentc->save.reg_3ce_21 = tridentReadIndex (tridentc, 0x3ce, 0x21); - tridentc->save.reg_3c2 = tridentReadReg (tridentc, 0x3cc); - tridentc->save.reg_3c4_16 = tridentReadIndex (tridentc, 0x3c4, 0x16); - tridentc->save.reg_3c4_17 = tridentReadIndex (tridentc, 0x3c4, 0x17); - tridentc->save.reg_3c4_18 = tridentReadIndex (tridentc, 0x3c4, 0x18); - tridentc->save.reg_3c4_19 = tridentReadIndex (tridentc, 0x3c4, 0x19); - ErrorF ("clk low 0x%x high 0x%x freq %d\n", - tridentc->save.reg_3c4_18, - tridentc->save.reg_3c4_19, - CLK_FREQ(tridentc->save.reg_3c4_18, - tridentc->save.reg_3c4_19)); -#ifdef TRI_DEBUG - fprintf (stderr, "3c4 0e: %02x\n", tridentc->save.reg_3c4_0e); - fprintf (stderr, "3d4 36: %02x\n", tridentc->save.reg_3d4_36); - fprintf (stderr, "3d4 39: %02x\n", tridentc->save.reg_3d4_39); - fprintf (stderr, "3d4 62: %02x\n", tridentc->save.reg_3d4_62); - fprintf (stderr, "3ce 21: %02x\n", tridentc->save.reg_3ce_21); - fflush (stderr); -#endif - tridentPause (); -} - -void -tridentSetCLK(int clock, CARD8 *a, CARD8 *b) -{ - int powerup[4] = { 1,2,4,8 }; - int clock_diff = 750; - int freq, ffreq; - int m, n, k; - int p, q, r, s; - int startn, endn; - int endm, endk; - - p = q = r = s = 0; - - startn = 64; - endn = 255; - endm = 63; - endk = 3; - - freq = clock; - - for (k=0;k<=endk;k++) - for (n=startn;n<=endn;n++) - for (m=1;m<=endm;m++) - { - ffreq = ( ( ((n + 8) * CLOCK) / ((m + 2) * powerup[k]) )); - if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) - { - clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; - p = n; q = m; r = k; s = ffreq; - } - } - - ErrorF ("ffreq %d clock %d\n", s, clock); - if (s == 0) - { - FatalError("Unable to set programmable clock.\n" - "Frequency %d is not a valid clock.\n" - "Please modify XF86Config for a new clock.\n", - freq); - } - - /* N is all 8bits */ - *a = p; - /* M is first 6bits, with K last 2bits */ - *b = (q & 0x3F) | (r << 6); -} - -void -tridentSetMCLK(int clock, CARD8 *a, CARD8 *b) -{ - int powerup[4] = { 1,2,4,8 }; - int clock_diff = 750; - int freq, ffreq; - int m,n,k; - int p, q, r, s; - int startn, endn; - int endm, endk; - - p = q = r = s = 0; - - startn = 64; - endn = 255; - endm = 63; - endk = 3; - - freq = clock; - - for (k=0;k<=endk;k++) - for (n=startn;n<=endn;n++) - for (m=1;m<=endm;m++) { - ffreq = ((((n+8)*CLOCK)/((m+2)*powerup[k]))); - if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) - { - clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq; - p = n; q = m; r = k; s = ffreq; - } - } - - if (s == 0) - { - FatalError("Unable to set memory clock.\n" - "Frequency %d is not a valid clock.\n" - "Please modify XF86Config for a new clock.\n", - freq); - } - - /* N is all 8bits */ - *a = p; - /* M is first 6bits, with K last 2bits */ - *b = (q & 0x3F) | (r << 6); -} - -void -tridentSetMMIO (TridentCardInfo *tridentc) -{ - int tries; - CARD8 v; - -#ifdef TRI_DEBUG - fprintf (stderr, "Set MMIO\n"); -#endif - /* enable config port writes */ - for (tries = 0; tries < 3; tries++) - { - /* enable direct read when GE busy, enable PCI retries */ - tridentWriteIndex (tridentc, 0x3d4, 0x62, - tridentc->save.reg_3d4_62 | 0x70); - /* make sure the chip is in new mode */ - tridentReadIndex (tridentc, 0x3c4, 0xb); - /* enable access to upper registers */ - tridentWriteIndex (tridentc, 0x3c4, 0xe, - tridentc->save.reg_3c4_0e | 0x80); - v = tridentReadIndex (tridentc, 0x3c4, 0xe); - if (!(v & 0x80)) - { - fprintf (stderr, "Trident GE not enabled 0x%x\n", v); - continue; - } - /* enable screen */ - tridentWriteIndex (tridentc, 0x3ce, 0x21, 0x80); -#ifdef USE_PCI - /* enable burst r/w, enable memory mapped ports */ - tridentWriteIndex (tridentc, 0x3d4, 0x39, 7); - tridentc->mmio = TRUE; - /* reset GE, enable GE, set GE to pci 1 */ - tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x90); -#else - /* enable burst r/w, disable memory mapped ports */ - tridentWriteIndex (tridentc, 0x3d4, 0x39, 0x6); - /* reset GE, enable GE, set GE to 0xbff00 */ - tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x92); -#endif - /* set clock */ - if (trident_clk) - { - CARD8 a, b; - - a = tridentReadIndex (tridentc, 0x3c4, 0x18); - b = tridentReadIndex (tridentc, 0x3c4, 0x19); - ErrorF ("old clock 0x%x 0x%x %d\n", - a, b, CLK_FREQ(a,b)); - tridentSetCLK (trident_clk, &a, &b); - ErrorF ("clk %d-> 0x%x 0x%x %d\n", trident_clk, a, b, - CLK_FREQ(a,b)); -#if 1 - tridentWriteIndex (tridentc, 0x3c4, 0x18, a); - tridentWriteIndex (tridentc, 0x3c4, 0x19, b); -#endif - } - if (trident_mclk) - { - CARD8 a, b; - - tridentSetMCLK (trident_mclk, &a, &b); - ErrorF ("mclk %d -> 0x%x 0x%x\n", trident_mclk, a, b); -#if 0 - tridentWriteIndex (tridentc, 0x3c4, 0x16, a); - tridentWriteIndex (tridentc, 0x3c4, 0x17, b); -#endif - } - if (trident_clk || trident_mclk) - { - CARD8 mode; - - mode = tridentReadReg (tridentc, 0x3cc); - ErrorF ("old mode 0x%x\n", mode); - mode = (mode & 0xf3) | 0x08; - ErrorF ("new mode 0x%x\n", mode); -#if 1 - tridentWriteReg (tridentc, 0x3c2, mode); -#endif - } -#ifdef TRI_DEBUG - fprintf (stderr, "0x36: 0x%02x\n", - tridentReadIndex (tridentc, 0x3d4, 0x36)); -#endif - if (tridentc->cop->status != 0xffffffff) - break; - } -#ifdef TRI_DEBUG - fprintf (stderr, "COP status 0x%x\n", tridentc->cop->status); -#endif - if (tridentc->cop->status == 0xffffffff) - FatalError ("Trident COP not visible\n"); -} - -void -tridentResetMMIO (TridentCardInfo *tridentc) -{ -#ifdef TRI_DEBUG - fprintf (stderr, "Reset MMIO\n"); -#endif - tridentPause (); -#if 0 - tridentWriteIndex (tridentc, 0x3c4, 0x16, tridentc->save.reg_3c4_16); - tridentWriteIndex (tridentc, 0x3c4, 0x17, tridentc->save.reg_3c4_17); -#endif - tridentWriteIndex (tridentc, 0x3c4, 0x18, tridentc->save.reg_3c4_18); - tridentWriteIndex (tridentc, 0x3c4, 0x19, tridentc->save.reg_3c4_19); - tridentWriteReg (tridentc, 0x3c2, tridentc->save.reg_3c2); - tridentPause (); - tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentc->save.reg_3ce_21); - tridentPause (); - tridentWriteIndex (tridentc, 0x3d4, 0x62, tridentc->save.reg_3d4_62); - tridentWriteIndex (tridentc, 0x3d4, 0x39, tridentc->save.reg_3d4_39); - tridentc->mmio = FALSE; - tridentWriteIndex (tridentc, 0x3d4, 0x36, tridentc->save.reg_3d4_36); - tridentWriteIndex (tridentc, 0x3c4, 0x0e, tridentc->save.reg_3c4_0e); - tridentPause (); -} - -Bool -tridentEnable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - TridentCardInfo *tridentc = pScreenPriv->card->driver; - -#ifdef VESA - if (!vesaEnable (pScreen)) - return FALSE; -#else - if (!fbdevEnable (pScreen)) - return FALSE; -#endif - tridentSetMMIO (tridentc); - return TRUE; -} - -void -tridentDisable (ScreenPtr pScreen) -{ -#ifdef VESA - vesaDisable (pScreen); -#else - fbdevDisable (pScreen); -#endif -} - -const CARD8 tridentDPMSModes[4] = { - 0x80, /* KD_DPMS_NORMAL */ - 0x8c, /* KD_DPMS_STANDBY */ - 0x8c, /* KD_DPMS_STANDBY */ - 0x8c, /* KD_DPMS_STANDBY */ -/* 0xb0, /* KD_DPMS_SUSPEND */ -/* 0xbc, /* KD_DPMS_POWERDOWN */ -}; - -Bool -tridentDPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - TridentCardInfo *tridentc = pScreenPriv->card->driver; - - tridentWriteIndex (tridentc, 0x3ce, 0x21, tridentDPMSModes[mode]); - tridentPause (); - return TRUE; -} - -void -tridentRestore (KdCardInfo *card) -{ - TridentCardInfo *tridentc = card->driver; - - tridentResetMMIO (tridentc); -#ifdef VESA - vesaRestore (card); -#else - fbdevRestore (card); -#endif -} - -void -tridentScreenFini (KdScreenInfo *screen) -{ - TridentScreenInfo *tridents = (TridentScreenInfo *) screen->driver; - -#ifdef VESA - vesaScreenFini (screen); -#endif - xfree (tridents); - screen->driver = 0; -} - -void -tridentCardFini (KdCardInfo *card) -{ - TridentCardInfo *tridentc = card->driver; - - if (tridentc->cop_base) - { - KdUnmapDevice ((void *) tridentc->cop_base, TRIDENT_COP_SIZE(card)); - KdResetMappedMode (TRIDENT_COP_BASE(card), - TRIDENT_COP_SIZE(card), - KD_MAPPED_MODE_REGISTERS); - } -#ifdef VESA - vesaCardFini (card); -#else - fbdevCardFini (card); -#endif -} - -KdCardFuncs tridentFuncs = { - tridentCardInit, /* cardinit */ - tridentScreenInit, /* scrinit */ - tridentInitScreen, /* initScreen */ - tridentPreserve, /* preserve */ - tridentEnable, /* enable */ - tridentDPMS, /* dpms */ - tridentDisable, /* disable */ - tridentRestore, /* restore */ - tridentScreenFini, /* scrfini */ - tridentCardFini, /* cardfini */ - - tridentCursorInit, /* initCursor */ - tridentCursorEnable, /* enableCursor */ - tridentCursorDisable, /* disableCursor */ - tridentCursorFini, /* finiCursor */ - tridentRecolorCursor, /* recolorCursor */ - - tridentDrawInit, /* initAccel */ - tridentDrawEnable, /* enableAccel */ - tridentDrawSync, /* syncAccel */ - tridentDrawDisable, /* disableAccel */ - tridentDrawFini, /* finiAccel */ - -#ifdef VESA - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -#else - fbdevGetColors, /* getColors */ - fbdevPutColors, /* putColors */ -#endif - tridentFinishInitScreen /* finishInitScreen */ -}; diff --git a/hw/kdrive/trident/trident.h b/hw/kdrive/trident/trident.h deleted file mode 100644 index feb939de3..000000000 --- a/hw/kdrive/trident/trident.h +++ /dev/null @@ -1,269 +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. - */ - -#ifndef _TRIDENT_H_ -#define _TRIDENT_H_ -#ifdef VESA -#include <vesa.h> -#else -#include <fbdev.h> -#endif - -/* - * offset from ioport beginning - */ - -#ifdef USE_PCI -#define TRIDENT_COP_BASE(c) (c->attr.address[1]) -#define TRIDENT_COP_OFF(c) 0x2100 -#define TRIDENT_COP_SIZE(c) 0x20000 -#else -#define TRIDENT_COP_BASE(c) 0xbf000 -#define TRIDENT_COP_OFF(c) 0x00f00 -#define TRIDENT_COP_SIZE(c) (0x2000) -#endif - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -typedef struct _cop { - VOL32 src_start_xy; /* 0x00 */ - VOL32 src_end_xy; /* 0x04 */ - VOL32 dst_start_xy; /* 0x08 */ - VOL32 dst_end_xy; /* 0x0c */ - VOL32 alpha; /* 0x10 */ - CARD8 pad14[0xc]; /* 0x14 */ - VOL32 multi; /* 0x20 */ - -#define COP_MULTI_CLIP_TOP_LEFT 0x10000000 -#define COP_MULTI_DEPTH 0x40000000 -#define COP_MULTI_COLOR_KEY 0x70000000 -#define COP_MULTI_STYLE 0x50000000 -#define COP_MULTI_PATTERN 0x80000000 -#define COP_MULTI_ROP 0x90000000 -#define COP_MULTI_STRIDE 0x60000000 -#define COP_MULTI_Z 0xa0000000 -#define COP_MULTI_ALPHA 0xb0000000 -#define COP_MULTI_TEXTURE 0xd0000000 -#define COP_MULTI_TEXTURE_BOUND 0xe0000000 -#define COP_MULTI_TEXTURE_ADVANCED 0x20000000 -#define COP_MULTI_MASK 0xf0000000 - -#define COP_DEPTH_8 0x00000000 -#define COP_DEPTH_16 0x00000001 -#define COP_DEPTH_24_32 0x00000002 -#define COP_DEPTH_15 0x00000005 -#define COP_DEPTH_DITHER_DISABLE 0x00000008 - - -#define COP_ALPHA_SRC_BLEND_0 0x00000000 -#define COP_ALPHA_SRC_BLEND_1 0x00000001 -#define COP_ALPHA_SRC_BLEND_SRC_C 0x00000002 -#define COP_ALPHA_SRC_BLEND_1_SRC_C 0x00000003 -#define COP_ALPHA_SRC_BLEND_SRC_A 0x00000004 -#define COP_ALPHA_SRC_BLEND_1_SRC_A 0x00000005 -#define COP_ALPHA_SRC_BLEND_DST_A 0x00000006 -#define COP_ALPHA_SRC_BLEND_1_DST_A 0x00000007 -#define COP_ALPHA_SRC_BLEND_DST_C 0x00000008 -#define COP_ALPHA_SRC_BLEND_1_DST_C 0x00000009 -#define COP_ALPHA_SRC_BLEND_SAT 0x0000000A -#define COP_ALPHA_SRC_BLEND_BG 0x0000000B - -#define COP_ALPHA_DST_BLEND_0 0x00000000 -#define COP_ALPHA_DST_BLEND_1 0x00000010 -#define COP_ALPHA_DST_BLEND_SRC_C 0x00000020 -#define COP_ALPHA_DST_BLEND_1_SRC_C 0x00000030 -#define COP_ALPHA_DST_BLEND_SRC_A 0x00000040 -#define COP_ALPHA_DST_BLEND_1_SRC_A 0x00000050 -#define COP_ALPHA_DST_BLEND_DST_A 0x00000060 -#define COP_ALPHA_DST_BLEND_1_DST_A 0x00000070 -#define COP_ALPHA_DST_BLEND_DST_C 0x00000080 -#define COP_ALPHA_DST_BLEND_1_DST_C 0x00000090 -#define COP_ALPHA_DST_BLEND_OTHER 0x000000A0 - -#define COP_ALPHA_RESULT_ALPHA 0x00100000 -#define COP_ALPHA_DEST_ALPHA 0x00200000 -#define COP_ALPHA_SOURCE_ALPHA 0x00400000 -#define COP_ALPHA_WRITE_ENABLE 0x00800000 -#define COP_ALPHA_TEST_ENABLE 0x01000000 -#define COP_ALPHA_BLEND_ENABLE 0x02000000 -#define COP_ALPHA_DEST_VALUE 0x04000000 -#define COP_ALPHA_SOURCE_VALUE 0x08000000 - - VOL32 command; /* 0x24 */ -#define COP_OP_NULL 0x00000000 -#define COP_OP_LINE 0x20000000 -#define COP_OP_BLT 0x80000000 -#define COP_OP_TEXT 0x90000000 -#define COP_OP_POLY 0xb0000000 -#define COP_OP_POLY2 0xe0000000 -#define COP_SCL_EXPAND 0x00800000 -#define COP_SCL_OPAQUE 0x00400000 -#define COP_SCL_REVERSE 0x00200000 -#define COP_SCL_MONO_OFF 0x001c0000 -#define COP_LIT_TEXTURE 0x00004000 -#define COP_BILINEAR 0x00002000 -#define COP_OP_ZBUF 0x00000800 -#define COP_OP_ROP 0x00000400 -#define COP_OP_FG 0x00000200 -#define COP_OP_FB 0x00000080 -#define COP_X_REVERSE 0x00000004 -#define COP_CLIP 0x00000001 - VOL32 texture_format; /* 0x28 */ - CARD8 pad2c[0x4]; /* 0x2c */ - - VOL32 clip_bottom_right; /* 0x30 */ - VOL32 dataIII; /* 0x34 */ - VOL32 dataIV; /* 0x38 */ - CARD8 pad3c[0x8]; /* 0x3c */ - - VOL32 fg; /* 0x44 */ - VOL32 bg; /* 0x48 */ - CARD8 pad4c[0x4]; /* 0x4c */ - - VOL32 pattern_fg; /* 0x50 */ - VOL32 pattern_bg; /* 0x54 */ - CARD8 pad58[0xc]; /* 0x58 */ - - VOL32 status; /* 0x64 */ -#define COP_STATUS_BE_BUSY 0x80000000 -#define COP_STATUS_DPE_BUSY 0x20000000 -#define COP_STATUS_MI_BUSY 0x10000000 -#define COP_STATUS_FIFO_BUSY 0x08000000 -#define COP_STATUS_WB_BUSY 0x00800000 -#define COP_STATUS_Z_FAILED 0x00400000 -#define COP_STATUS_EFFECTIVE 0x00200000 -#define COP_STATUS_LEFT_VIEW 0x00080000 - - CARD8 pad68[0x4]; /* 0x68 */ - - VOL32 src_offset; /* 0x6c */ - VOL32 z_offset; /* 0x70 */ - CARD8 pad74[0x4]; /* 0x74 */ - - VOL32 display_offset; /* 0x78 */ - VOL32 dst_offset; /* 0x7c */ - CARD8 pad80[0x34]; /* 0x80 */ - - VOL32 semaphore; /* 0xb4 */ -} Cop; - -#define TRI_XY(x,y) ((y) << 16 | (x)) - -typedef struct _tridentSave { - CARD8 reg_3c4_0e; /* config port value */ - CARD8 reg_3d4_36; - CARD8 reg_3d4_39; - CARD8 reg_3d4_62; /* GE setup */ - CARD8 reg_3ce_21; /* DPMS */ - CARD8 reg_3c2; /* clock config */ - CARD8 reg_3c4_16; /* MCLKLow */ - CARD8 reg_3c4_17; /* MCLKHigh */ - CARD8 reg_3c4_18; /* ClockLow */ - CARD8 reg_3c4_19; /* ClockHigh */ -} TridentSave; - -typedef struct _tridentCardInfo { -#ifdef VESA - VesaCardPrivRec vesa; -#else - FbdevPriv fb; -#endif - CARD8 *cop_base; - Cop *cop; - CARD32 *window; - CARD32 cop_depth; - CARD32 cop_stride; - Bool mmio; - TridentSave save; -} TridentCardInfo; - -#define getTridentCardInfo(kd) ((TridentCardInfo *) ((kd)->card->driver)) -#define tridentCardInfo(kd) TridentCardInfo *tridentc = getTridentCardInfo(kd) - -typedef struct _tridentCursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} TridentCursor; - -#define TRIDENT_CURSOR_WIDTH 64 -#define TRIDENT_CURSOR_HEIGHT 64 - -typedef struct _tridentScreenInfo { -#ifdef VESA - VesaScreenPrivRec vesa; -#else - FbdevScrPriv fbdev; -#endif - CARD8 *cursor_base; - CARD8 *screen; - CARD8 *off_screen; - int off_screen_size; - TridentCursor cursor; -} TridentScreenInfo; - -#define getTridentScreenInfo(kd) ((TridentScreenInfo *) ((kd)->screen->driver)) -#define tridentScreenInfo(kd) TridentScreenInfo *tridents = getTridentScreenInfo(kd) - -Bool -tridentDrawInit (ScreenPtr pScreen); - -void -tridentDrawEnable (ScreenPtr pScreen); - -void -tridentDrawSync (ScreenPtr pScreen); - -void -tridentDrawDisable (ScreenPtr pScreen); - -void -tridentDrawFini (ScreenPtr pScreen); - -CARD8 -tridentReadIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index); - -void -tridentWriteIndex (TridentCardInfo *tridentc, CARD16 port, CARD8 index, CARD8 value); - -Bool -tridentCursorInit (ScreenPtr pScreen); - -void -tridentCursorEnable (ScreenPtr pScreen); - -void -tridentCursorDisable (ScreenPtr pScreen); - -void -tridentCursorFini (ScreenPtr pScreen); - -void -tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef); - -extern KdCardFuncs tridentFuncs; - -#endif /* _TRIDENT_H_ */ diff --git a/hw/kdrive/trident/tridentcurs.c b/hw/kdrive/trident/tridentcurs.c deleted file mode 100644 index 4a5938162..000000000 --- a/hw/kdrive/trident/tridentcurs.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "trident.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - tridentCardInfo(pScreenPriv); \ - tridentScreenInfo(pScreenPriv); \ - TridentCursor *pCurPriv = &tridents->cursor - -static void -_tridentMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - - - /* This is the recommended order to move the cursor */ - - tridentWriteIndex (tridentc, 0x3d4, 0x41, xhigh); - tridentWriteIndex (tridentc, 0x3d4, 0x40, xlow); - tridentWriteIndex (tridentc, 0x3d4, 0x42, ylow); - tridentWriteIndex (tridentc, 0x3d4, 0x46, xoff); - tridentWriteIndex (tridentc, 0x3d4, 0x47, yoff); - tridentWriteIndex (tridentc, 0x3d4, 0x43, yhigh); -} - -static void -tridentMoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - _tridentMoveCursor (pScreen, x, y); -} - -static void -tridentAllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -tridentSetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CARD32 fg, bg; - - fg = pCurPriv->source; - bg = pCurPriv->mask; - tridentWriteIndex (tridentc, 0x3d4, 0x48, fg); - tridentWriteIndex (tridentc, 0x3d4, 0x49, fg >> 8); - tridentWriteIndex (tridentc, 0x3d4, 0x4a, fg >> 16); - - tridentWriteIndex (tridentc, 0x3d4, 0x4c, bg); - tridentWriteIndex (tridentc, 0x3d4, 0x4d, bg >> 8); - tridentWriteIndex (tridentc, 0x3d4, 0x4e, bg >> 16); -} - -void -tridentRecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - tridentAllocCursorColors (pScreen); - tridentSetCursorColors (pScreen); -} - -#define InvertBits32(v) { \ - v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ - v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ - v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ -} - -static void -tridentLoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - CARD32 *ram, *msk, *mskLine, *src, *srcLine; - int i, j; - int cursor_address; - int lwsrc; - unsigned char ramdac_control_; - CARD32 offset; - - /* - * Allocate new colors - */ - tridentAllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (CARD32 *) tridents->cursor_base; - mskLine = (CARD32 *) bits->mask; - srcLine = (CARD32 *) bits->source; - - h = bits->height; - if (h > TRIDENT_CURSOR_HEIGHT) - h = TRIDENT_CURSOR_HEIGHT; - - lwsrc = BitmapBytePad(bits->width) / 4; /* words per line */ - - for (i = 0; i < TRIDENT_CURSOR_HEIGHT; i++) { - msk = mskLine; - src = srcLine; - mskLine += lwsrc; - srcLine += lwsrc; - for (j = 0; j < TRIDENT_CURSOR_WIDTH / 32; j++) { - - CARD32 m, s; - -#if 1 - if (i < h && j < lwsrc) - { - m = *msk++; - s = *src++; - InvertBits32(m); - InvertBits32(s); - } - else - { - m = 0; - s = 0; - } -#endif - *ram++ = m; - *ram++ = s; - } - } - - /* Set address for cursor bits */ - offset = tridents->cursor_base - (CARD8 *) tridents->screen; - offset >>= 10; - tridentWriteIndex (tridentc, 0x3d4, 0x44, (CARD8) (offset & 0xff)); - tridentWriteIndex (tridentc, 0x3d4, 0x45, (CARD8) (offset >> 8)); - - /* Set new color */ - tridentSetCursorColors (pScreen); - - /* Enable the cursor */ - tridentWriteIndex (tridentc, 0x3d4, 0x50, 0xc1); - - /* Move to new position */ - tridentMoveCursor (pScreen, x, y); -} - -static void -tridentUnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - /* Disable cursor */ - tridentWriteIndex (tridentc, 0x3d4, 0x50, 0); -} - -static Bool -tridentRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - tridentLoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -tridentUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -tridentSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - tridentLoadCursor (pScreen, x, y); - else - tridentUnloadCursor (pScreen); -} - -miPointerSpriteFuncRec tridentPointerSpriteFuncs = { - tridentRealizeCursor, - tridentUnrealizeCursor, - tridentSetCursor, - tridentMoveCursor, -}; - -static void -tridentQueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -tridentCursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!tridents->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = TRIDENT_CURSOR_WIDTH; - pCurPriv->height= TRIDENT_CURSOR_HEIGHT; - pScreen->QueryBestSize = tridentQueryBestSize; - miPointerInitialize (pScreen, - &tridentPointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -tridentCursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - tridentLoadCursor (pScreen, x, y); - } - else - tridentUnloadCursor (pScreen); - } -} - -void -tridentCursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - tridentUnloadCursor (pScreen); - } - } -} - -void -tridentCursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/trident/tridentdraw.c b/hw/kdrive/trident/tridentdraw.c deleted file mode 100644 index c26d0be8b..000000000 --- a/hw/kdrive/trident/tridentdraw.c +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "trident.h" -#include "tridentdraw.h" - -#include "Xmd.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mistruct.h" -#include "fontstruct.h" -#include "dixfontstr.h" -#include "fb.h" -#include "migc.h" -#include "miline.h" -#include "picturestr.h" - -CARD8 tridentRop[16] = { - /* GXclear */ 0x00, /* 0 */ - /* GXand */ 0x88, /* src AND dst */ - /* GXandReverse */ 0x44, /* src AND NOT dst */ - /* GXcopy */ 0xcc, /* src */ - /* GXandInverted*/ 0x22, /* NOT src AND dst */ - /* GXnoop */ 0xaa, /* dst */ - /* GXxor */ 0x66, /* src XOR dst */ - /* GXor */ 0xee, /* src OR dst */ - /* GXnor */ 0x11, /* NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* NOT src XOR dst */ - /* GXinvert */ 0x55, /* NOT dst */ - /* GXorReverse */ 0xdd, /* src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* NOT src */ - /* GXorInverted */ 0xbb, /* NOT src OR dst */ - /* GXnand */ 0x77, /* NOT src OR NOT dst */ - /* GXset */ 0xff, /* 1 */ -}; - -#define tridentFillPix(bpp,pixel) {\ - if (bpp == 8) \ - { \ - pixel = pixel & 0xff; \ - pixel = pixel | pixel << 8; \ - } \ - if (bpp <= 16) \ - { \ - pixel = pixel & 0xffff; \ - pixel = pixel | pixel << 16; \ - } \ -} - -static Cop *cop; -static CARD32 cmd; - -Bool -tridentPrepareSolid (DrawablePtr pDrawable, - int alu, - Pixel pm, - Pixel fg) -{ - FbBits depthMask = FbFullMask(pDrawable->depth); - - if ((pm & depthMask) != depthMask) - return FALSE; - else - { - KdScreenPriv(pDrawable->pScreen); - tridentCardInfo(pScreenPriv); - cop = tridentc->cop; - - tridentFillPix(pDrawable->bitsPerPixel,fg); - _tridentInit(cop,tridentc); - _tridentSetSolidRect(cop,fg,alu,cmd); - return TRUE; - } -} - -void -tridentSolid (int x1, int y1, int x2, int y2) -{ - _tridentRect (cop, x1, y1, x2 - 1, y2 - 1, cmd); -} - -void -tridentDoneSolid (void) -{ -} - -Bool -tridentPrepareCopy (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - int dx, - int dy, - int alu, - Pixel pm) -{ - FbBits depthMask = FbFullMask(pDstDrawable->depth); - - if ((pm & depthMask) == depthMask) - { - KdScreenPriv(pDstDrawable->pScreen); - tridentCardInfo(pScreenPriv); - cop = tridentc->cop; - _tridentInit(cop,tridentc); - cop->multi = COP_MULTI_PATTERN; - cop->multi = COP_MULTI_ROP | tridentRop[alu]; - cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FB; - if (dx < 0 || dy < 0) - cmd |= COP_X_REVERSE; - return TRUE; - } - else - return FALSE; -} - -void -tridentCopy (int srcX, - int srcY, - int dstX, - int dstY, - int w, - int h) -{ - if (cmd & COP_X_REVERSE) - { - cop->src_start_xy = TRI_XY (srcX + w - 1, srcY + h - 1); - cop->src_end_xy = TRI_XY (srcX, srcY); - cop->dst_start_xy = TRI_XY (dstX + w - 1, dstY + h - 1); - cop->dst_end_xy = TRI_XY (dstX, dstY); - } - else - { - cop->src_start_xy = TRI_XY (srcX, srcY); - cop->src_end_xy = TRI_XY (srcX + w - 1, srcY + h - 1); - cop->dst_start_xy = TRI_XY (dstX, dstY); - cop->dst_end_xy = TRI_XY (dstX + w - 1, dstY + h - 1); - } - _tridentWaitDone (cop); - cop->command = cmd; -} - -void -tridentDoneCopy (void) -{ -} - -void -tridentComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - SetupTrident (pDst->pDrawable->pScreen); - tridentScreenInfo(pScreenPriv); - RegionRec region; - int n; - BoxPtr pbox; - CARD32 rgb; - CARD8 *msk, *mskLine; - FbBits *mskBits; - FbStride mskStride; - int mskBpp; - int mskXoff, mskYoff; - CARD32 *src, *srcLine; - CARD32 *off, *offLine; - FbBits *srcBits; - FbStride srcStride; - int srcXoff, srcYoff; - FbStride offStride; - int srcBpp; - int x_msk, y_msk, x_src, y_src, x_dst, y_dst; - int x2; - int w, h, w_this, h_this, w_remain; - CARD32 *off_screen; - int off_size = tridents->off_screen_size >> 2; - int off_width, off_height; - int stride = pScreenPriv->screen->fb[0].pixelStride; - int mskExtra; - CARD32 off_screen_offset = tridents->off_screen - tridents->screen; - int mode; - -#define MODE_NONE 0 -#define MODE_IMAGE 1 -#define MODE_MASK 2 - - rgb = *((CARD32 *) ((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr); - if (pMask && - !pMask->repeat && - pMask->format == PICT_a8 && - op == PictOpOver && - pSrc->repeat && - pSrc->pDrawable->width == 1 && - pSrc->pDrawable->height == 1 && - PICT_FORMAT_BPP(pSrc->format) == 32 && - (PICT_FORMAT_A(pSrc->format) == 0 || - (rgb & 0xff000000) == 0xff000000) && - pDst->pDrawable->bitsPerPixel == 32 && - pDst->pDrawable->type == DRAWABLE_WINDOW) - { - mode = MODE_MASK; - } - else if (!pMask && - op == PictOpOver && - !pSrc->repeat && - PICT_FORMAT_A(pSrc->format) == 8 && - PICT_FORMAT_BPP(pSrc->format) == 32 && - pDst->pDrawable->bitsPerPixel == 32 && - pDst->pDrawable->type == DRAWABLE_WINDOW) - { - mode = MODE_IMAGE; - } - else - mode = MODE_NONE; - - if (mode != MODE_NONE) - { - xDst += pDst->pDrawable->x; - yDst += pDst->pDrawable->y; - xSrc += pSrc->pDrawable->x; - ySrc += pSrc->pDrawable->y; - - fbGetDrawable (pSrc->pDrawable, srcBits, srcStride, srcBpp, srcXoff, srcYoff); - - if (pMask) - { - xMask += pMask->pDrawable->x; - yMask += pMask->pDrawable->y; - fbGetDrawable (pMask->pDrawable, mskBits, mskStride, mskBpp, mskXoff, mskYoff); - mskStride = mskStride * sizeof (FbBits) / sizeof (CARD8); - } - - if (!miComputeCompositeRegion (®ion, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height)) - return; - - _tridentInit(cop,tridentc); - - cop->multi = COP_MULTI_PATTERN; - cop->src_offset = off_screen_offset; - - if (mode == MODE_IMAGE) - { - cop->multi = (COP_MULTI_ALPHA | - COP_ALPHA_BLEND_ENABLE | - COP_ALPHA_WRITE_ENABLE | - 0x7 << 16 | - COP_ALPHA_DST_BLEND_1_SRC_A | - COP_ALPHA_SRC_BLEND_1); - } - else - { - rgb &= 0xffffff; - cop->multi = (COP_MULTI_ALPHA | - COP_ALPHA_BLEND_ENABLE | - COP_ALPHA_WRITE_ENABLE | - 0x7 << 16 | - COP_ALPHA_DST_BLEND_1_SRC_A | - COP_ALPHA_SRC_BLEND_SRC_A); - } - - n = REGION_NUM_RECTS (®ion); - pbox = REGION_RECTS (®ion); - - while (n--) - { - h = pbox->y2 - pbox->y1; - w = pbox->x2 - pbox->x1; - - offStride = (w + 7) & ~7; - off_height = off_size / offStride; - if (off_height > h) - off_height = h; - - cop->multi = COP_MULTI_STRIDE | (stride << 16) | offStride; - - y_dst = pbox->y1; - y_src = y_dst - yDst + ySrc; - y_msk = y_dst - yDst + yMask; - - x_dst = pbox->x1; - x_src = x_dst - xDst + xSrc; - x_msk = x_dst - xDst + xMask; - - if (mode == MODE_IMAGE) - srcLine = (CARD32 *) srcBits + (y_src - srcYoff) * srcStride + (x_src - srcXoff); - else - mskLine = (CARD8 *) mskBits + (y_msk - mskYoff) * mskStride + (x_msk - mskXoff); - - while (h) - { - h_this = h; - if (h_this > off_height) - h_this = off_height; - h -= h_this; - - offLine = (CARD32 *) tridents->off_screen; - - _tridentWaitDone(cop); - - cop->dst_start_xy = TRI_XY(x_dst, y_dst); - cop->dst_end_xy = TRI_XY(x_dst + w - 1, y_dst + h_this - 1); - cop->src_start_xy = TRI_XY(0,0); - cop->src_end_xy = TRI_XY(w - 1, h_this - 1); - - if (mode == MODE_IMAGE) - { - while (h_this--) - { - w_remain = w; - src = srcLine; - srcLine += srcStride; - off = offLine; - offLine += offStride; - while (w_remain--) - *off++ = *src++; - } - } - else - { - while (h_this--) - { - w_remain = w; - msk = mskLine; - mskLine += mskStride; - off = offLine; - offLine += offStride; - while (w_remain--) - *off++ = rgb | (*msk++ << 24); - } - } - - cop->command = (COP_OP_BLT | - COP_SCL_OPAQUE | - COP_OP_FB); - } - pbox++; - } - cop->src_offset = 0; - - KdMarkSync (pDst->pDrawable->pScreen); - } - else - { - KdCheckComposite (op, - pSrc, - pMask, - pDst, - xSrc, - ySrc, - xMask, - yMask, - xDst, - yDst, - width, - height); - } -} - -KaaScreenPrivRec tridentKaa = { - tridentPrepareSolid, - tridentSolid, - tridentDoneSolid, - - tridentPrepareCopy, - tridentCopy, - tridentDoneCopy, -}; - -Bool -tridentDrawInit (ScreenPtr pScreen) -{ - SetupTrident(pScreen); - tridentScreenInfo(pScreenPriv); - PictureScreenPtr ps = GetPictureScreen(pScreen); - - if (!kaaDrawInit (pScreen, &tridentKaa)) - return FALSE; - - if (ps && tridents->off_screen) - ps->Composite = tridentComposite; - - return TRUE; -} - -void -tridentDrawEnable (ScreenPtr pScreen) -{ - SetupTrident(pScreen); - CARD32 cmd; - CARD32 base; - CARD16 stride; - CARD32 format; - CARD32 alpha; - int tries; - int nwrite; - - stride = pScreenPriv->screen->fb[0].pixelStride; - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 8: - format = COP_DEPTH_8; - break; - case 16: - format = COP_DEPTH_16; - break; - case 24: - format = COP_DEPTH_24_32; - break; - case 32: - format = COP_DEPTH_24_32; - break; - } - /* - * compute a few things which will be set every time the - * accelerator is used; this avoids problems with APM - */ - tridentc->cop_depth = COP_MULTI_DEPTH | format; - tridentc->cop_stride = COP_MULTI_STRIDE | (stride << 16) | (stride); - -#define NUM_TRIES 100000 - for (tries = 0; tries < NUM_TRIES; tries++) - if (!(cop->status & COP_STATUS_BUSY)) - break; - if (cop->status & COP_STATUS_BUSY) - FatalError ("Can't initialize graphics coprocessor"); - cop->multi = COP_MULTI_CLIP_TOP_LEFT; - cop->multi = COP_MULTI_MASK | 0; - cop->src_offset = 0; - cop->dst_offset = 0; - cop->z_offset = 0; - cop->clip_bottom_right = 0x0fff0fff; - - _tridentInit(cop,tridentc); - _tridentSetSolidRect(cop, pScreen->blackPixel, GXcopy, cmd); - _tridentRect (cop, 0, 0, - pScreenPriv->screen->width, pScreenPriv->screen->height, - cmd); - KdMarkSync (pScreen); -} - -void -tridentDrawDisable (ScreenPtr pScreen) -{ -} - -void -tridentDrawFini (ScreenPtr pScreen) -{ -} - -void -tridentDrawSync (ScreenPtr pScreen) -{ - SetupTrident(pScreen); - - _tridentWaitIdleEmpty(cop); -} diff --git a/hw/kdrive/trident/tridentdraw.h b/hw/kdrive/trident/tridentdraw.h deleted file mode 100644 index bac11c2a6..000000000 --- a/hw/kdrive/trident/tridentdraw.h +++ /dev/null @@ -1,69 +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. - */ - -#ifndef _TRIDENTDRAW_H_ -#define _TRIDENTDRAW_H_ - -#define SetupTrident(s) KdScreenPriv(s); \ - tridentCardInfo(pScreenPriv); \ - Cop *cop = tridentc->cop - -#define TridentAlpha (COP_MULTI_ALPHA|COP_ALPHA_WRITE_ENABLE) - -#define _tridentInit(cop,tridentc) { \ - if ((cop)->status == 0xffffffff) tridentSetMMIO(tridentc); \ - (cop)->multi = (tridentc)->cop_depth; \ - (cop)->multi = (tridentc)->cop_stride; \ - (cop)->multi = TridentAlpha; \ -} \ - -#define _tridentSetSolidRect(cop,pix,alu,cmd) {\ - cop->multi = COP_MULTI_PATTERN; \ - cop->multi = COP_MULTI_ROP | tridentRop[alu]; \ - cop->fg = (pix); \ - cmd = COP_OP_BLT | COP_SCL_OPAQUE | COP_OP_ROP | COP_OP_FG; \ -} - -#define _tridentRect(cop,x1,y1,x2,y2,cmd) { \ - (cop)->dst_start_xy = TRI_XY (x1,y1); \ - (cop)->dst_end_xy = TRI_XY(x2,y2); \ - _tridentWaitDone(cop); \ - (cop)->command = (cmd); \ -} - -#define COP_STATUS_BUSY (COP_STATUS_BE_BUSY | \ - COP_STATUS_DPE_BUSY | \ - COP_STATUS_MI_BUSY) - -#define _tridentWaitDone(cop) { \ - int __q__ = 500000; \ - while (__q__-- && (cop)->status & COP_STATUS_BUSY) \ - ; \ - if (!__q__) \ - (cop)->status = 0; \ -} - -#define _tridentWaitIdleEmpty(cop) _tridentWaitDone(cop) - -#define sourceInvarient(alu) (((alu) & 3) == (((alu) >> 2) & 3)) - -#endif diff --git a/hw/kdrive/trident/tridentstub.c b/hw/kdrive/trident/tridentstub.c deleted file mode 100644 index 0792a50d4..000000000 --- a/hw/kdrive/trident/tridentstub.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "trident.h" - -extern int trident_clk, trident_mclk; - -void -InitCard (char *name) -{ - KdCardAttr attr; - - if (LinuxFindPci (0x1023, 0x9525, 0, &attr)) - KdCardInfoAdd (&tridentFuncs, &attr, 0); -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ -#if 0 - ErrorF("\nTrident Driver Options:\n"); - ErrorF("-clk XXX: what's this?\n"); - ErrorF("-mclk XXX: what's this?\n"); -#endif - KdUseMsg(); -#ifdef VESA - vesaUseMsg() -#endif -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - int ret; - - if (!strcmp (argv[i], "-clk")) - { - if (i+1 < argc) - trident_clk = atoi (argv[i+1]); - else - UseMsg (); - return 2; - } - if (!strcmp (argv[i], "-mclk")) - { - if (i+1 < argc) - trident_mclk = atoi (argv[i+1]); - else - UseMsg (); - return 2; - } - -#ifdef VESA - if (!(ret = vesaProcessArgument (argc, argv, i))) -#endif - ret = KdProcessArgument(argc, argv, i); - return ret; -} diff --git a/hw/kdrive/trio/s3.c b/hw/kdrive/trio/s3.c deleted file mode 100644 index cb5104926..000000000 --- a/hw/kdrive/trio/s3.c +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -#define REGISTERS_OFFSET (0x1000000) -#define PACKED_OFFSET (0x8100) - - -CARD8 -_s3ReadIndexRegister (volatile CARD8 *base, CARD8 index) -{ - CARD8 ret; - *base = index; - ret = *(base + 1); - DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x -> 0x%02x", - ((int) base) & 0xfff, index, ret)); - return ret; -} - -void -_s3WriteIndexRegister (volatile CARD8 *base, CARD8 index, CARD8 value) -{ - DRAW_DEBUG ((DEBUG_CRTC, " 0x%3x 0x%02x <- 0x%02x", - ((int) base) & 0xfff, index, value)); - *base = index; - *(base + 1) = value; -} - -/* - * Map the S3 card and detect its configuration. Do not touch the card - */ - -static void -_s3LoadCrtc (S3Ptr s3, S3Crtc *crtc) -{ - crtc->h_total_0_7 = GetCrtc (s3, 0x00); - crtc->h_display_end_0_7 = GetCrtc (s3, 0x01); - crtc->h_blank_start_0_7 = GetCrtc (s3, 0x02); - crtc->_h_blank_end = GetCrtc (s3, 0x03); - crtc->h_sync_start_0_7 = GetCrtc (s3, 0x04); - crtc->_h_sync_end = GetCrtc (s3, 0x05); - crtc->v_total_0_7 = GetCrtc (s3, 0x06); - crtc->crtc_overflow = GetCrtc (s3, 0x07); - crtc->preset_row_scan = GetCrtc (s3, 0x08); - crtc->_max_scan_line = GetCrtc (s3, 0x09); - - crtc->start_address_8_15 = GetCrtc (s3, 0x0c); - crtc->start_address_0_7 = GetCrtc (s3, 0x0d); - - crtc->v_retrace_start_0_7 = GetCrtc (s3, 0x10); - crtc->_v_retrace_end = GetCrtc (s3, 0x11); - crtc->v_display_end_0_7 = GetCrtc (s3, 0x12); - crtc->screen_off_0_7 = GetCrtc (s3, 0x13); - - crtc->v_blank_start_0_7 = GetCrtc (s3, 0x15); - crtc->v_blank_end_0_7 = GetCrtc (s3, 0x16); - - crtc->line_compare_0_7 = GetCrtc (s3, 0x18); - - crtc->memory_configuration = GetCrtc (s3, 0x31); - - crtc->misc_1 = GetCrtc (s3, 0x3a); - crtc->h_start_fifo_fetch_0_7 = GetCrtc (s3, 0x3b); - - crtc->mode_control = GetCrtc (s3, 0x42); - - crtc->hardware_cursor_mode = GetCrtc (s3, 0x45); - crtc->cursor_address_8_15 = GetCrtc (s3, 0x4C); - crtc->cursor_address_0_7 = GetCrtc (s3, 0x4D); - - crtc->extended_system_control_1 = GetCrtc (s3, 0x50); - crtc->extended_system_control_2 = GetCrtc (s3, 0x51); - - crtc->extended_memory_control = GetCrtc (s3, 0x53); - - crtc->extended_ramdac_control = GetCrtc (s3, 0x55); - - crtc->extended_horizontal_overflow = GetCrtc (s3, 0x5d); - crtc->extended_vertical_overflow = GetCrtc (s3, 0x5e); - - crtc->l_parm_0_7 = GetCrtc (s3, 0x62); - - crtc->extended_misc_control = GetCrtc (s3, 0x65); - - crtc->extended_misc_control_2 = GetCrtc (s3, 0x67); - - crtc->configuration_3 = GetCrtc (s3, 0x68); - - crtc->extended_system_control_3 = GetCrtc (s3, 0x69); - - crtc->extended_bios_5 = GetCrtc (s3, 0x6d); - - crtc->extended_sequencer_b = GetSrtc (s3, 0x0b); - crtc->extended_sequencer_d = GetSrtc (s3, 0x0d); - crtc->dclk_value_low = GetSrtc (s3, 0x12); - crtc->dclk_value_high = GetSrtc (s3, 0x13); - crtc->control_2 = GetSrtc (s3, 0x15); - crtc->ramdac_control = GetSrtc (s3, 0x18); - -/* combine values */ - - switch (crtc_ge_screen_width(crtc)) { - case 0: - if (crtc->enable_two_page) - crtc->ge_screen_pitch = 2048; - else - crtc->ge_screen_pitch = 1024; - break; - case 1: - crtc->ge_screen_pitch = 640; - break; - case 2: - /* ignore magic 1600x1200x4 mode */ - crtc->ge_screen_pitch = 800; - break; - case 3: - crtc->ge_screen_pitch = 1280; - break; - case 4: - crtc->ge_screen_pitch = 1152; - break; - case 5: - crtc->ge_screen_pitch = 0; /* reserved */ - break; - case 6: - crtc->ge_screen_pitch = 1600; - break; - case 7: - crtc->ge_screen_pitch = 0; /* reserved */ - break; - } - switch (crtc->pixel_length) { - case 0: - crtc->bits_per_pixel = 8; - crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8; - break; - case 1: - crtc->bits_per_pixel = 16; - crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 4; - break; - case 3: - crtc->bits_per_pixel = 32; - crtc->pixel_width = (crtc_h_display_end(crtc) + 1) * 8; - break; - } - crtc->double_pixel_mode = 0; - switch (crtc->color_mode) { - case 0x0: - crtc->depth = 8; break; - case 0x1: - crtc->depth = 8; crtc->double_pixel_mode = 1; break; - case 0x3: - crtc->depth = 15; break; - case 0x5: - crtc->depth = 16; break; - case 0x7: - crtc->depth = 24; break; /* unused */ - case 0xd: - crtc->depth = 24; break; - } -} - -static void -_s3SetBlank (S3Ptr s3, Bool blank) -{ - CARD8 clock_mode; - - DRAW_DEBUG ((DEBUG_S3INIT, "3c4 at 0x%x\n", &s3->crt_vga_3c4)); - clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01); - if (blank) - clock_mode |= 0x20; - else - clock_mode &= ~0x20; - _s3WaitVRetrace (s3); - _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, clock_mode); - DRAW_DEBUG ((DEBUG_S3INIT, "blank is set to 0x%x", clock_mode)); -} - -static void -_s3SetDepth (S3Ptr s3, S3Crtc *crtc) -{ - CARD8 save_3c2; - _s3SetBlank (s3, TRUE); - PutCrtc(s3, 0x38, 0x48); - PutCrtc(s3, 0x39, 0xA0); - PutCrtc(s3, 0x00, crtc->h_total_0_7); - PutCrtc(s3, 0x01, crtc->h_display_end_0_7); - PutCrtc(s3, 0x02, crtc->h_blank_start_0_7); - PutCrtc(s3, 0x03, crtc->_h_blank_end); - PutCrtc(s3, 0x04, crtc->h_sync_start_0_7); - PutCrtc(s3, 0x05, crtc->_h_sync_end); - PutCrtc(s3, 0x06, crtc->v_total_0_7); - PutCrtc(s3, 0x07, crtc->crtc_overflow); - PutCrtc(s3, 0x09, crtc->_max_scan_line); - PutCrtc(s3, 0x0c, crtc->start_address_8_15); - PutCrtc(s3, 0x0d, crtc->start_address_0_7); - PutCrtc(s3, 0x10, crtc->v_retrace_start_0_7); - PutCrtc(s3, 0x11, crtc->_v_retrace_end); - PutCrtc(s3, 0x12, crtc->v_display_end_0_7); - PutCrtc(s3, 0x13, crtc->screen_off_0_7); - PutCrtc(s3, 0x15, crtc->v_blank_start_0_7); - PutCrtc(s3, 0x16, crtc->v_blank_end_0_7); - PutCrtc(s3, 0x18, crtc->line_compare_0_7); - PutCrtc(s3, 0x31, crtc->memory_configuration); - PutCrtc(s3, 0x3a, crtc->misc_1); - PutCrtc(s3, 0x3b, crtc->h_start_fifo_fetch_0_7); - PutCrtc(s3, 0x42, crtc->mode_control); - PutCrtc(s3, 0x45, crtc->hardware_cursor_mode); - PutCrtc(s3, 0x4c, crtc->cursor_address_8_15); - PutCrtc(s3, 0x4d, crtc->cursor_address_0_7); - PutCrtc(s3, 0x50, crtc->extended_system_control_1); - PutCrtc(s3, 0x51, crtc->extended_system_control_2); - PutCrtc(s3, 0x53, crtc->extended_memory_control); - PutCrtc(s3, 0x55, crtc->extended_ramdac_control); - PutCrtc(s3, 0x5d, crtc->extended_horizontal_overflow); - PutCrtc(s3, 0x5e, crtc->extended_vertical_overflow); - PutCrtc(s3, 0x62, crtc->l_parm_0_7); - PutCrtc(s3, 0x65, crtc->extended_misc_control); - PutCrtc(s3, 0x67, crtc->extended_misc_control_2); - PutCrtc(s3, 0x68, crtc->configuration_3); - PutCrtc(s3, 0x69, crtc->extended_system_control_3); - PutCrtc(s3, 0x6d, crtc->extended_bios_5); - PutCrtc(s3, 0x39, 0x00); - PutCrtc(s3, 0x38, 0x00); - PutSrtc(s3, 0x0b, crtc->extended_sequencer_b); - PutSrtc(s3, 0x0d, crtc->extended_sequencer_d); - /* - * Move new dclk/mclk values into PLL - */ - save_3c2 = s3->crt_vga_3cc; - DRAW_DEBUG ((DEBUG_S3INIT, "save_3c2 0x%x", save_3c2)); - s3->crt_vga_3c2 = save_3c2 | 0x0c; - - PutSrtc(s3, 0x12, crtc->dclk_value_low); - PutSrtc(s3, 0x13, crtc->dclk_value_high); - - DRAW_DEBUG ((DEBUG_S3INIT, "Set PLL load enable, frobbing clk_load...")); - crtc->dfrq_en = 1; - PutSrtc(s3, 0x15, crtc->control_2); - PutSrtc(s3, 0x18, crtc->ramdac_control); - - DRAW_DEBUG ((DEBUG_S3INIT, "Clk load frobbed, restoring 3c2 to 0x%x", save_3c2)); - s3->crt_vga_3c2 = save_3c2; - - DRAW_DEBUG ((DEBUG_S3INIT, "Enabling display")); - _s3SetBlank (s3, FALSE); -} - -void -_s3RestoreCrtc (S3Ptr s3, S3Crtc *crtc) -{ - _s3SetDepth (s3, crtc); -} - -s3Reset (S3CardInfo *s3c) -{ - S3Ptr s3 = s3c->s3; - S3Save *save = &s3c->save; - CARD8 *cursor_base; - - LockS3 (s3c); - - _s3UnlockExt (s3); - - _s3RestoreCrtc (s3, &save->crtc); - - /* set foreground */ - /* Reset cursor color stack pointers */ - (void) GetCrtc(s3, 0x45); - PutCrtc(s3, 0x4a, save->cursor_fg); - /* XXX for deeper screens? */ - - /* set background */ - /* Reset cursor color stack pointers */ - (void) GetCrtc(s3, 0x45); - PutCrtc(s3, 0x4b, save->cursor_bg); - - _s3LockExt (s3); - - /* graphics engine state */ - s3->alt_mix = save->alt_mix; - s3->write_mask = save->write_mask; - s3->fg = save->fg; - s3->bg = save->bg; - /* XXX should save and restore real values? */ - s3->scissors_tl = 0x00000000; - s3->scissors_br = 0x0fff0fff; - - _s3WriteIndexRegister (&s3->crt_vga_3c4, 0x01, save->clock_mode); - PutCrtc(s3, 0x39, save->lock2); - PutCrtc(s3, 0x38, save->lock1); - - UnlockS3 (s3c); -} - -void -s3Save (S3CardInfo *s3c) -{ - S3Ptr s3 = s3c->s3; - S3Save *save = &s3c->save; - S3Crtc newCrtc; - CARD8 t1, t2; - CARD8 *cursor_base; - - LockS3 (s3c); - - save->alt_mix = s3->alt_mix; - save->write_mask = s3->write_mask; - save->fg = s3->fg; - save->bg = s3->bg; - - save->lock1 = GetCrtc(s3, 0x38); - save->lock2 = GetCrtc(s3, 0x39); - save->clock_mode = _s3ReadIndexRegister (&s3->crt_vga_3c4, 0x01); - - _s3UnlockExt (s3); - save->cursor_fg = GetCrtc(s3, 0x4a); - save->cursor_bg = GetCrtc(s3, 0x4b); - - _s3LoadCrtc (s3, &save->crtc); - - _s3LockExt (s3); - - UnlockS3 (s3c); -} -Bool -s3CardInit (KdCardInfo *card) -{ - S3CardInfo *s3c; - S3Ptr s3; - int size; - CARD8 *registers; - CARD32 s3Address = card->attr.address[0]; - CARD8 *temp_buffer; - - DRAW_DEBUG ((DEBUG_S3INIT, "s3CardInit")); - s3c = (S3CardInfo *) xalloc (sizeof (S3CardInfo)); - if (!s3c) - { - DRAW_DEBUG ((DEBUG_FAILURE, "can't alloc s3 card info")); - goto bail0; - } - - memset (s3c, '\0', sizeof (S3CardInfo)); - - card->driver = s3c; - - fprintf (stderr, "S3 at 0x%x\n", s3Address); - registers = KdMapDevice (s3Address + REGISTERS_OFFSET, - sizeof (S3) + PACKED_OFFSET); - if (!registers) - { - ErrorF ("Can't map s3 device\n"); - goto bail2; - } - s3 = (S3Ptr) (registers + PACKED_OFFSET); - s3c->registers = registers; - s3c->s3 = s3; - - s3->crt_vga_3c3 = 1; /* wake up part from deep sleep */ - s3->crt_vga_3c2 = 0x01 | 0x02 | 0x0c; - - s3->crt_vga_3c4 = 0x58; - s3->crt_vga_3c5 = 0x10 | 0x3; - - /* - * Can't trust S3 register value for frame buffer amount, must compute - */ - temp_buffer = KdMapDevice (s3Address, 4096 * 1024); - - s3c->memory = KdFrameBufferSize (temp_buffer, 4096 * 1024); - - DRAW_DEBUG ((DEBUG_S3INIT, "Detected frame buffer %d", s3c->memory)); - - KdUnmapDevice (temp_buffer, 4096 * 1024); - - if (!s3c->memory) - { - ErrorF ("Can't detect s3 frame buffer\n"); - goto bail3; - } - - s3c->frameBuffer = KdMapDevice (s3Address, s3c->memory); - if (!s3c->frameBuffer) - { - ErrorF ("Can't map s3 frame buffer\n"); - goto bail3; - } - - card->driver = s3c; - - return TRUE; -bail3: - KdUnmapDevice ((void *) s3, sizeof (S3)); -bail2: -bail1: - xfree (s3c); -bail0: - return FALSE; -} - -Bool -s3ModeSupported (KdScreenInfo *screen, - const KdMonitorTiming *t) -{ - if (t->horizontal != 1600 && - t->horizontal != 1280 && - t->horizontal != 1152 && - t->horizontal != 1024 && - t->horizontal != 800 && - t->horizontal != 640) - return FALSE; - if (t->clock > S3_MAX_CLOCK * 2) - return FALSE; - return TRUE; -} - -Bool -s3ModeUsable (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - S3CardInfo *s3c = (S3CardInfo *) card->driver; - int screen_size; - int pixel_width; - int byte_width; - - if (screen->fb[0].depth >= 24) - { - screen->fb[0].depth = 24; - screen->fb[0].bitsPerPixel = 32; - } - else if (screen->fb[0].depth >= 16) - { - screen->fb[0].depth = 16; - screen->fb[0].bitsPerPixel = 16; - } - else if (screen->fb[0].depth >= 15) - { - screen->fb[0].depth = 15; - screen->fb[0].bitsPerPixel = 16; - } - else - { - screen->fb[0].depth = 8; - screen->fb[0].bitsPerPixel = 8; - } - - byte_width = screen->width * (screen->fb[0].bitsPerPixel >> 3); - pixel_width = screen->width; - screen->fb[0].pixelStride = pixel_width; - screen->fb[0].byteStride = byte_width; - - screen_size = byte_width * screen->height; - - return screen_size <= s3c->memory; -} - -Bool -s3ScreenInit (KdScreenInfo *screen) -{ - KdCardInfo *card = screen->card; - S3CardInfo *s3c = (S3CardInfo *) card->driver; - S3ScreenInfo *s3s; - int screen_size; - int memory; - int requested_memory; - int v_total, h_total; - int byte_width; - int pixel_width; - int m, n, r; - int i; - const KdMonitorTiming *t; - - DRAW_DEBUG ((DEBUG_S3INIT, "s3ScreenInit")); - s3s = (S3ScreenInfo *) xalloc (sizeof (S3ScreenInfo)); - if (!s3s) - return FALSE; - - memset (s3s, '\0', sizeof (S3ScreenInfo)); - - if (!screen->width || !screen->height) - { - screen->width = 800; - screen->height = 600; - screen->rate = 72; - } - if (!screen->fb[0].depth) - screen->fb[0].depth = 8; - - DRAW_DEBUG ((DEBUG_S3INIT, "Requested parameters %dx%dx%d", - screen->width, screen->height, screen->rate)); - t = KdFindMode (screen, s3ModeSupported); - screen->rate = t->rate; - screen->width = t->horizontal; - screen->height = t->vertical; - s3GetClock (t->clock, &m, &n, &r, 127, 31, 3); -#if 0 - fprintf (stderr, "computed %d,%d,%d (%d) provided %d,%d,%d (%d)\n", - m, n, r, S3_CLOCK(m,n,r), - t->dac_m, t->dac_n, t->dac_r, - S3_CLOCK(t->dac_m, t->dac_n, t->dac_r)); -#endif - /* - * Can only operate in pixel-doubled mode at 8 bits per pixel - */ - if (screen->fb[0].depth > 8 && S3_CLOCK(m,n,r) > S3_MAX_CLOCK) - screen->fb[0].depth = 8; - - if (!KdTuneMode (screen, s3ModeUsable, s3ModeSupported)) - { - xfree (s3s); - return FALSE; - } - - memory = s3c->memory - screen_size; - - /* - * Stick frame buffer at start of memory - */ - screen->fb[0].frameBuffer = s3c->frameBuffer; - - /* - * Stick cursor at end of memory - */ - if (memory >= 2048) - { - s3s->cursor_base = s3c->frameBuffer + (s3c->memory - 2048); - memory -= 2048; - } - else - s3s->cursor_base = 0; - - /* - * Use remaining memory for off-screen storage, but only use - * one piece (either right or bottom). - */ - if (memory >= byte_width * S3_TILE_SIZE) - { - s3s->fb[0].offscreen = s3c->frameBuffer + screen_size; - s3s->fb[0].offscreen_x = 0; - s3s->fb[0].offscreen_y = screen_size / byte_width; - s3s->fb[0].offscreen_width = pixel_width; - s3s->fb[0].offscreen_height = memory / byte_width; - memory -= s3s->fb[0].offscreen_height * byte_width; - } - else if (pixel_width - screen->width >= S3_TILE_SIZE) - { - s3s->fb[0].offscreen = s3c->frameBuffer + screen->width; - s3s->fb[0].offscreen_x = screen->width; - s3s->fb[0].offscreen_y = 0; - s3s->fb[0].offscreen_width = pixel_width - screen->width; - s3s->fb[0].offscreen_height = screen->height; - } - else - s3s->fb[0].offscreen = 0; - - DRAW_DEBUG ((DEBUG_S3INIT, "depth %d bits %d", screen->fb[0].depth, screen->fb[0].bitsPerPixel)); - - DRAW_DEBUG ((DEBUG_S3INIT, "Screen size %dx%d memory %d", - screen->width, screen->height, s3c->memory)); - DRAW_DEBUG ((DEBUG_S3INIT, "frame buffer 0x%x cursor 0x%x offscreen 0x%x", - s3c->frameBuffer, s3s->cursor_base, s3s->offscreen)); - DRAW_DEBUG ((DEBUG_S3INIT, "offscreen %dx%d+%d+%d", - s3s->offscreen_width, s3s->offscreen_height, - s3s->offscreen_x, s3s->offscreen_y)); - - switch (screen->fb[0].depth) { - case 8: - screen->fb[0].visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - screen->fb[0].blueMask = 0x00; - screen->fb[0].greenMask = 0x00; - screen->fb[0].redMask = 0x00; - break; - case 15: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x03e0; - screen->fb[0].redMask = 0x7c00; - break; - case 16: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x001f; - screen->fb[0].greenMask = 0x07e0; - screen->fb[0].redMask = 0xf800; - break; - case 24: - screen->fb[0].visuals = (1 << TrueColor); - screen->fb[0].blueMask = 0x0000ff; - screen->fb[0].greenMask = 0x00ff00; - screen->fb[0].redMask = 0xff0000; - break; - } - - screen->driver = s3s; - - return TRUE; -} - -void -s3Preserve (KdCardInfo *card) -{ - S3CardInfo *s3c = card->driver; - - s3Save (s3c); -} - -/* - * Enable the card for rendering. Manipulate the initial settings - * of the card here. - */ -Bool -s3Enable (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdCardInfo *card = pScreenPriv->card; - KdScreenInfo *screen = pScreenPriv->screen; - s3CardInfo (pScreenPriv); - s3ScreenInfo (pScreenPriv); - - S3Crtc crtcR, *crtc; - int hactive, hblank, hfp, hbp; - int vactive, vblank, vfp, vbp; - int hsize; - - int h_total; - int h_display_end; - int h_blank_start; - int h_blank_end; - int h_sync_start; - int h_sync_end; - int h_screen_off; - int h_start_fifo_fetch; - - int v_total; - int v_retrace_start; - int v_retrace_end; - int v_display_end; - int v_blank_start; - int v_blank_end; - - int h_adjust; - int h_sync_extend_; - int h_blank_extend_; - int i; - CARD16 cursor_address; - const KdMonitorTiming *t; - int m, n, r; - - DRAW_DEBUG ((DEBUG_S3INIT, "s3Enable")); - - DRAW_DEBUG ((DEBUG_S3INIT, "requested bpp %d current %d", - pScreenPriv->bitsPerPixel, s3c->save.crtc.bits_per_pixel)); - - t = KdFindMode (screen, s3ModeSupported); - - hfp = t->hfp; - hbp = t->hbp; - hblank = t->hblank; - hactive = t->horizontal; - - vfp = t->vfp; - vbp = t->vbp; - vblank = t->vblank; - vactive = t->vertical; - - crtcR = s3c->save.crtc; - crtc = &crtcR; - - s3GetClock (t->clock, &m, &n, &r, 127, 31, 3); - crtc->dclk_pll_m_trio = m; - crtc->dclk_pll_n_trio = n; - crtc->dclk_pll_r_trio = r; - - crtc->alt_refresh_count = 0x02; - crtc->enable_alt_refresh = 1; - crtc->enable_256_or_more = 1; - - DRAW_DEBUG ((DEBUG_S3INIT, "memory_bus_size %d\n", crtc->memory_bus_size)); - crtc->memory_bus_size = 1; - - crtc->dclk_over_2 = 0; - crtc->dclk_invert = 0; - crtc->enable_clock_double = 0; - crtc->delay_blank = 0; - crtc->extended_bios_5 = 0; - /* - * Compute character lengths for horizontal timing values - */ - switch (screen->fb[0].bitsPerPixel) { - case 8: - hactive = screen->width / 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - h_screen_off = hactive; - crtc->pixel_length = 0; - crtc->color_mode = 0; - /* - * Set up for double-pixel mode, switch color modes, - * divide the dclk and delay h blank by 2 dclks - */ - if (S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio, - crtc->dclk_pll_r_trio) > S3_MAX_CLOCK) - { - DRAW_DEBUG ((DEBUG_S3INIT, "S3 clock %g > 80MHz, using pixel double mode", - S3_CLOCK(crtc->dclk_pll_m_trio, crtc->dclk_pll_n_trio, - crtc->dclk_pll_r_trio))); - crtc->color_mode = 1; - crtc->dclk_over_2 = 1; - crtc->enable_clock_double = 1; - crtc->delay_blank = 2; - crtc->extended_bios_5 = 2; - } - h_adjust = 1; - break; - case 16: - hactive = screen->width / 4; - hblank /= 4; - hfp /= 4; - hbp /= 4; - h_screen_off = hactive; - crtc->pixel_length = 1; - crtc->extended_bios_5 = 2; - if (crtc->depth == 15) - crtc->color_mode = 3; - else - crtc->color_mode = 5; - h_adjust = 2; - break; - case 32: - hactive = screen->width / 8; - hblank /= 8; - hfp /= 8; - hbp /= 8; - h_screen_off = hactive * 4; - crtc->pixel_length = 3; - crtc->color_mode = 0xd; - h_adjust = 1; - break; - } - - /* - * X server starts frame buffer at top of memory - */ - DRAW_DEBUG ((DEBUG_S3INIT, "Old start address 0x%x\n", - crtc_start_address (crtc))); - crtc_set_start_address (crtc, 0); - - /* - * Compute horizontal register values from timings - */ - h_total = hactive + hblank - 5; - h_display_end = hactive - 1; - h_blank_start = h_display_end; - h_blank_end = h_blank_start + hblank - h_adjust; - h_sync_start = hactive + hfp + h_adjust; - h_sync_end = h_sync_start + hblank - hbp - hfp; - h_start_fifo_fetch = h_total - 5; - - DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x sync_start 0x%x\n", - h_blank_end, h_sync_end, h_sync_start)); - - if (h_blank_end - h_blank_start > 0x40) - h_blank_extend_ = 1; - else - h_blank_extend_ = 0; - - if (h_sync_end - h_sync_start > 0x20) - h_sync_extend_ = 1; - else - h_sync_extend_ = 0; - - DRAW_DEBUG ((DEBUG_S3INIT, "blank_end 0x%x sync_end 0x%x extend %d\n", - h_blank_end, h_sync_end, h_sync_extend_)); - - crtc_set_h_total(crtc, h_total); - crtc_set_h_display_end (crtc, h_display_end); - crtc_set_h_blank_start (crtc, h_blank_start); - crtc_set_h_blank_end (crtc, h_blank_end); - crtc_set_h_sync_start (crtc, h_sync_start); - crtc_set_h_sync_end (crtc, h_sync_end); - crtc_set_screen_off (crtc, h_screen_off); - crtc_set_h_start_fifo_fetch (crtc, h_start_fifo_fetch); - crtc->h_sync_extend = h_sync_extend_; - crtc->h_blank_extend = h_blank_extend_; - - - v_total = vactive + vblank - 2; - v_retrace_start = vactive + vfp - 1; - v_retrace_end = v_retrace_start + vblank - vbp - 1; - v_display_end = vactive - 1; - v_blank_start = vactive - 1; - v_blank_end = v_blank_start + vblank - 1; - - crtc_set_v_total(crtc, v_total); - crtc_set_v_retrace_start (crtc, v_retrace_start); - crtc->v_retrace_end_0_3 = v_retrace_end; - crtc_set_v_display_end (crtc, v_display_end); - crtc_set_v_blank_start (crtc, v_blank_start); - crtc->v_blank_end_0_7 = v_blank_end; - - /* - * Set cursor - */ - if (!screen->softCursor) - { - cursor_address = (s3s->cursor_base - screen->fb[0].frameBuffer) / 1024; - - crtc->cursor_address_0_7 = cursor_address; - crtc->cursor_address_8_15 = cursor_address >> 8; - crtc->hardware_cursor_ms_x11 = 0; - crtc->hardware_cursor_enable = 1; - } - else - crtc->hardware_cursor_enable = 0; - - /* - * Set accelerator - */ - switch (screen->width) { - case 640: crtc_set_ge_screen_width(crtc,1); break; - case 800: crtc_set_ge_screen_width(crtc,2); break; - case 1024: crtc_set_ge_screen_width(crtc,0); break; - case 1152: crtc_set_ge_screen_width(crtc,4); break; - case 1280: crtc_set_ge_screen_width(crtc,3); break; - case 1600: crtc_set_ge_screen_width(crtc,6); break; - } - - /* - * Set depth values - */ - crtc->bits_per_pixel = screen->fb[0].bitsPerPixel; - crtc->depth = screen->fb[0].depth; - - crtc->l_parm_0_7 = screen->width / 4; /* Undocumented. */ - - crtc->disable_v_retrace_int = 1; /* don't let retrace interrupt */ - - DRAW_DEBUG ((DEBUG_S3INIT, "new h total %d display_end %d", - crtc_h_total(crtc), - crtc_h_display_end(crtc))); - DRAW_DEBUG ((DEBUG_S3INIT, " sync_start %d sync_end %d (%d)", - crtc_h_sync_start(crtc), - crtc_h_sync_end(crtc), h_sync_end)); - - DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d", - crtc_h_blank_start(crtc), - crtc_h_blank_end(crtc))); - - DRAW_DEBUG ((DEBUG_S3INIT, " screen_off %d start_fifo %d", - crtc_screen_off(crtc), crtc_h_start_fifo_fetch(crtc))); - - DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d", - hactive, hblank, hfp, hbp)); - - DRAW_DEBUG ((DEBUG_S3INIT, "new v total %d display_end %d", - crtc_v_total(crtc), - crtc_v_display_end(crtc))); - DRAW_DEBUG ((DEBUG_S3INIT, " retrace_start %d retrace_end %d (%d)", - crtc_v_retrace_start(crtc), - crtc->v_retrace_end, - v_retrace_end)); - DRAW_DEBUG ((DEBUG_S3INIT, " blank_start %d blank_end %d", - crtc_v_blank_start(crtc), - crtc->v_blank_end_0_7)); - - DRAW_DEBUG ((DEBUG_S3INIT, " active %d blank %d fp %d bp %d", - vactive, vblank, vfp, vbp)); - - /* - * Set DPMS to normal - */ - crtc->hsync_control = 0; - crtc->vsync_control = 0; - - LockS3 (s3c); - _s3SetDepth (s3c->s3, crtc); - UnlockS3 (s3c); - return TRUE; -} - -void -s3Disable (ScreenPtr pScreen) -{ -} - -void -s3Restore (KdCardInfo *card) -{ - S3CardInfo *s3c = card->driver; - - s3Reset (s3c); -} - -void -_s3SetSync (S3CardInfo *s3c, int hsync, int vsync) -{ - /* this abuses the macros defined to access the crtc structure */ - union extended_sequencer_d_u _extended_sequencer_d_u; - S3Ptr s3 = s3c->s3; - - extended_sequencer_d = s3c->save.crtc.extended_sequencer_d; - hsync_control = hsync; - vsync_control = vsync; - PutSrtc (s3, 0x0d, extended_sequencer_d); -} - -Bool -s3DPMS (ScreenPtr pScreen, int mode) -{ - KdScreenPriv(pScreen); - s3CardInfo(pScreenPriv); - - switch (mode) { - case KD_DPMS_NORMAL: - _s3SetSync (s3c, 0, 0); - _s3SetBlank (s3c->s3, FALSE); - break; - case KD_DPMS_STANDBY: - _s3SetBlank (s3c->s3, TRUE); - _s3SetSync (s3c, 1, 0); - break; - case KD_DPMS_SUSPEND: - _s3SetBlank (s3c->s3, TRUE); - _s3SetSync (s3c, 0, 1); - break; - case KD_DPMS_POWERDOWN: - _s3SetBlank (s3c->s3, TRUE); - _s3SetSync (s3c, 1, 1); - break; - } - return TRUE; -} - -void -s3ScreenFini (KdScreenInfo *screen) -{ - S3ScreenInfo *s3s = (S3ScreenInfo *) screen->driver; - - xfree (s3s); - screen->driver = 0; -} - -void -s3CardFini (KdCardInfo *card) -{ - S3CardInfo *s3c = (S3CardInfo *) card->driver; - - KdUnmapDevice (s3c->frameBuffer, s3c->memory); - KdUnmapDevice (s3c->registers, sizeof (S3) + PACKED_OFFSET); -/* DeleteCriticalSection (&s3c->lock); */ - xfree (s3c); - card->driver = 0; -} - -KdCardFuncs s3Funcs = { - s3CardInit, - s3ScreenInit, - 0, - s3Preserve, - s3Enable, - s3DPMS, - s3Disable, - s3Restore, - s3ScreenFini, - s3CardFini, - s3CursorInit, - s3CursorEnable, - s3CursorDisable, - s3CursorFini, - s3RecolorCursor, - s3DrawInit, - s3DrawEnable, - s3DrawSync, - s3DrawDisable, - s3DrawFini, - s3GetColors, - s3PutColors, -}; - -void -S3InitCard (KdCardAttr *attr) -{ - KdCardInfoAdd (&s3Funcs, attr, 0); -} diff --git a/hw/kdrive/trio/s3.h b/hw/kdrive/trio/s3.h deleted file mode 100644 index b45a8ba80..000000000 --- a/hw/kdrive/trio/s3.h +++ /dev/null @@ -1,1200 +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. - */ - -#ifndef _S3_H_ -#define _S3_H_ - -#include "kdrive.h" - -#define PLATFORM 300 - -#define DRAW_DEBUG(a) - -#define DEBUG_S3INIT (DEBUG_ACCEL) -#define DEBUG_CRTC (DEBUG_ACCEL+1) -#define DEBUG_PATTERN (DEBUG_ACCEL+2) -#define DEBUG_RECT (DEBUG_ACCEL+3) -#define DEBUG_PAINT_WINDOW (DEBUG_ACCEL+4) -#define DEBUG_SET (DEBUG_ACCEL+5) -#define DEBUG_RENDER (DEBUG_ACCEL+6) -#define DEBUG_REGISTERS (DEBUG_ACCEL+7) -#define DEBUG_ARCS (DEBUG_ACCEL+8) -#define DEBUG_TEXT (DEBUG_ACCEL+9) -#define DEBUG_POLYGON (DEBUG_ACCEL+10) -#define DEBUG_CLIP (DEBUG_ACCEL+11) - -/* VESA Approved Register Definitions */ - -/* - * Linear Addressing 000 0000 - 0ff ffff (16m) - * Image data transfer 100 0000 - 100 7fff (32k) - * PCI config 100 8000 - 100 8043 - * Packed enhanced regs 100 8100 - 100 814a - * Streams regs 100 8180 - 100 81ff - * Current Y pos 100 82e8 - * CRT VGA 3b? regs 100 83b0 - 100 83bf - * CRT VGA 3c? regs 100 83c0 - 100 83cf - * CRT VGA 3d? regs 100 83d0 - 100 83df - * Subsystem status (42e8h) 100 8504 - * Advanced function (42e8h) 100 850c - * Enhanced regs 100 86e8 - 100 eeea - * Local peripheral bus 100 ff00 - 100 ff5c - * - * We don't care about the image transfer or PCI regs, so - * this structure starts at the packed enhanced regs - */ - -typedef volatile CARD32 VOL32; -typedef volatile CARD16 VOL16; -typedef volatile CARD8 VOL8; - -typedef volatile struct _s3 { - VOL32 alt_curxy; /* 8100 */ - VOL32 _pad0; /* 8104 */ - VOL32 alt_step; /* 8108 */ - VOL32 _pad1; /* 810c */ - VOL32 err_term; /* 8110 */ - VOL32 _pad2; /* 8114 */ - VOL32 cmd_gp_stat; /* 8118 */ - VOL32 short_stroke; /* 811c */ - VOL32 bg; /* 8120 */ - VOL32 fg; /* 8124 */ - VOL32 write_mask; /* 8128 */ - VOL32 read_mask; /* 812c */ - VOL32 color_cmp; /* 8130 */ - VOL32 alt_mix; /* 8134 */ - VOL32 scissors_tl; /* 8138 */ - VOL32 scissors_br; /* 813c */ - VOL32 pix_cntl_mult_misc2; /* 8140 */ - VOL32 mult_misc_read_sel; /* 8144 */ - VOL32 alt_pcnt; /* 8148 min_axis_pcnt, maj_axis_pcnt */ - VOL8 _pad3[0x19c]; /* 814c */ - VOL16 cur_y; /* 82e8 */ - VOL8 _pad4[0xc6]; /* 82ea */ - - VOL8 crt_vga_3b0; /* 83b0 */ - VOL8 crt_vga_3b1; /* 83b1 */ - VOL8 crt_vga_3b2; /* 83b2 */ - VOL8 crt_vga_3b3; /* 83b3 */ - VOL8 crt_vga_3b4; /* 83b4 */ - VOL8 crt_vga_3b5; /* 83b5 */ - VOL8 crt_vga_3b6; /* 83b6 */ - VOL8 crt_vga_3b7; /* 83b7 */ - VOL8 crt_vga_3b8; /* 83b8 */ - VOL8 crt_vga_3b9; /* 83b9 */ - VOL8 crt_vga_3ba; /* 83ba */ - VOL8 crt_vga_3bb; /* 83bb */ - VOL8 crt_vga_3bc; /* 83bc */ - VOL8 crt_vga_3bd; /* 83bd */ - VOL8 crt_vga_3be; /* 83be */ - VOL8 crt_vga_3bf; /* 83bf */ - - VOL8 crt_vga_3c0; /* 83c0 */ - VOL8 crt_vga_3c1; /* 83c1 */ - VOL8 crt_vga_3c2; /* 83c2 */ - VOL8 crt_vga_3c3; /* 83c3 */ - VOL8 crt_vga_3c4; /* 83c4 */ - VOL8 crt_vga_3c5; /* 83c5 */ - VOL8 crt_vga_dac_ad_mk; /* 83c6 */ - VOL8 crt_vga_dac_rd_ad; /* 83c7 */ - VOL8 crt_vga_dac_wt_ad; /* 83c8 */ - VOL8 crt_vga_dac_data; /* 83c9 */ - VOL8 crt_vga_3ca; /* 83ca */ - VOL8 crt_vga_3cb; /* 83cb */ - VOL8 crt_vga_3cc; /* 83cc */ - VOL8 crt_vga_3cd; /* 83cd */ - VOL8 crt_vga_3ce; /* 83ce */ - VOL8 crt_vga_3cf; /* 83cf */ - - VOL8 crt_vga_3d0; /* 83d0 */ - VOL8 crt_vga_3d1; /* 83d1 */ - VOL8 crt_vga_3d2; /* 83d2 */ - VOL8 crt_vga_3d3; /* 83d3 */ - VOL8 crt_vga_3d4; /* 83d4 */ - VOL8 crt_vga_3d5; /* 83d5 */ - VOL8 crt_vga_3d6; /* 83d6 */ - VOL8 crt_vga_3d7; /* 83d7 */ - VOL8 crt_vga_3d8; /* 83d8 */ - VOL8 crt_vga_3d9; /* 83d9 */ - VOL8 crt_vga_status_1; /* 83da */ - VOL8 crt_vga_3db; /* 83db */ - VOL8 crt_vga_3dc; /* 83dc */ - VOL8 crt_vga_3dd; /* 83dd */ - VOL8 crt_vga_3de; /* 83de */ - VOL8 crt_vga_3df; /* 83df */ - - VOL8 _pad5[0x124]; /* 83e0 */ - VOL16 subsys_status; /* 8504 */ - VOL8 _pad6[0x6]; /* 8506 */ - VOL16 adv_control; /* 850c */ - VOL8 _pad7[0x1da]; /* 850e */ - VOL16 cur_x; /* 86e8 */ - VOL8 _pad8[0x3fe]; /* 86ea */ - VOL16 desty_axstp; /* 8ae8 */ - VOL8 _pad9[0x3fe]; /* 8aea */ - VOL16 destx_diastp; /* 8ee8 */ - VOL8 _pad10[0x3fe]; /* 8eea */ - VOL16 enh_err_term; /* 92e8 */ - VOL8 _pad11[0x3fe]; /* 92ea */ - VOL16 maj_axis_pcnt; /* 96e8 */ - VOL8 _pad12[0x3fe]; /* 96ea */ - VOL16 enh_cmd_gp_stat; /* 9ae8 */ - VOL8 _pad13[0x3fe]; /* 9aea */ - VOL16 enh_short_stroke; /* 9ee8 */ - VOL8 _pad14[0x3fe]; /* 9eea */ - VOL16 enh_bg; /* a2e8 */ - VOL8 _pad15[0x3fe]; /* a2ea */ - VOL16 enh_fg; /* a6e8 */ - VOL8 _pad16[0x3fe]; /* a6ea */ - VOL16 enh_wrt_mask; /* aae8 */ - VOL8 _pad17[0x3fe]; /* aaea */ - VOL16 enh_rd_mask; /* aee8 */ - VOL8 _pad18[0x3fe]; /* aeea */ - VOL16 enh_color_cmp; /* b2e8 */ - VOL8 _pad19[0x3fe]; /* b2ea */ - VOL16 enh_bg_mix; /* b6e8 */ - VOL8 _pad20[0x3fe]; /* b6ea */ - VOL16 enh_fg_mix; /* bae8 */ - VOL8 _pad21[0x3fe]; /* baea */ - VOL16 enh_rd_reg_dt; /* bee8 */ - VOL8 _pad22[0x23fe]; /* beea */ - VOL32 pix_trans; /* e2e8 */ -} S3, *S3Ptr; - -#define VGA_STATUS_1_DTM 0x01 -#define VGA_STATUS_1_VSY 0x08 - -#define DAC_MASK 0x03c6 -#define DAC_R_INDEX 0x03c7 -#define DAC_W_INDEX 0x03c8 -#define DAC_DATA 0x03c9 -#define DISP_STAT 0x02e8 -#define H_TOTAL 0x02e8 -#define H_DISP 0x06e8 -#define H_SYNC_STRT 0x0ae8 -#define H_SYNC_WID 0x0ee8 -#define V_TOTAL 0x12e8 -#define V_DISP 0x16e8 -#define V_SYNC_STRT 0x1ae8 -#define V_SYNC_WID 0x1ee8 -#define DISP_CNTL 0x22e8 -#define ADVFUNC_CNTL 0x4ae8 -#define SUBSYS_STAT 0x42e8 -#define SUBSYS_CNTL 0x42e8 -#define ROM_PAGE_SEL 0x46e8 -#define CUR_Y 0x82e8 -#define CUR_X 0x86e8 -#define DESTY_AXSTP 0x8ae8 -#define DESTX_DIASTP 0x8ee8 -#define ERR_TERM 0x92e8 -#define MAJ_AXIS_PCNT 0x96e8 -#define GP_STAT 0x9ae8 -#define CMD 0x9ae8 -#define SHORT_STROKE 0x9ee8 -#define BKGD_COLOR 0xa2e8 -#define FRGD_COLOR 0xa6e8 -#define WRT_MASK 0xaae8 -#define RD_MASK 0xaee8 -#define COLOR_CMP 0xb2e8 -#define BKGD_MIX 0xb6e8 -#define FRGD_MIX 0xbae8 -#define MULTIFUNC_CNTL 0xbee8 -#define MIN_AXIS_PCNT 0x0000 -#define SCISSORS_T 0x1000 -#define SCISSORS_L 0x2000 -#define SCISSORS_B 0x3000 -#define SCISSORS_R 0x4000 -#define MEM_CNTL 0x5000 -#define PATTERN_L 0x8000 -#define PATTERN_H 0x9000 -#define PIX_CNTL 0xa000 -#define CONTROL_MISC2 0xd000 -#define PIX_TRANS 0xe2e8 - -/* Advanced Function Control Regsiter */ -#define CLKSEL 0x0004 -#define DISABPASSTHRU 0x0001 - -/* Graphics Processor Status Register */ - -#define GPNSLOT 13 - -#define GPBUSY_1 0x0080 -#define GPBUSY_2 0x0040 -#define GPBUSY_3 0x0020 -#define GPBUSY_4 0x0010 -#define GPBUSY_5 0x0008 -#define GPBUSY_6 0x0004 -#define GPBUSY_7 0x0002 -#define GPBUSY_8 0x0001 -#define GPBUSY_9 0x8000 -#define GPBUSY_10 0x4000 -#define GPBUSY_11 0x2000 -#define GPBUSY_12 0x1000 -#define GPBUSY_13 0x0800 - -#define GPEMPTY 0x0400 -#define GPBUSY 0x0200 -#define DATDRDY 0x0100 - -/* Command Register */ -#define CMD_NOP 0x0000 -#define CMD_LINE 0x2000 -#define CMD_RECT 0x4000 -#define CMD_RECTV1 0x6000 -#define CMD_RECTV2 0x8000 -#define CMD_LINEAF 0xa000 -#define CMD_BITBLT 0xc000 -#define CMD_PATBLT 0xe000 -#define CMD_OP_MSK 0xe000 -#define BYTSEQ 0x1000 -#define _32BITNOPAD 0x0600 -#define _32BIT 0x0400 -#define _16BIT 0x0200 -#define _8BIT 0x0000 -#define PCDATA 0x0100 -#define INC_Y 0x0080 -#define YMAJAXIS 0x0040 -#define INC_X 0x0020 -#define DRAW 0x0010 -#define LINETYPE 0x0008 -#define LASTPIX 0x0004 /* Draw last pixel in line */ -#define PLANAR 0x0002 -#define WRTDATA 0x0001 - -/* Background Mix Register */ -#define BSS_BKGDCOL 0x0000 -#define BSS_FRGDCOL 0x0020 -#define BSS_PCDATA 0x0040 -#define BSS_BITBLT 0x0060 - -/* Foreground Mix Register */ -#define FSS_BKGDCOL 0x0000 -#define FSS_FRGDCOL 0x0020 -#define FSS_PCDATA 0x0040 -#define FSS_BITBLT 0x0060 - -/* The Mixes */ -#define MIX_MASK 0x001f - -#define MIX_NOT_DST 0x0000 -#define MIX_0 0x0001 -#define MIX_1 0x0002 -#define MIX_DST 0x0003 -#define MIX_NOT_SRC 0x0004 -#define MIX_XOR 0x0005 -#define MIX_XNOR 0x0006 -#define MIX_SRC 0x0007 -#define MIX_NAND 0x0008 -#define MIX_NOT_SRC_OR_DST 0x0009 -#define MIX_SRC_OR_NOT_DST 0x000a -#define MIX_OR 0x000b -#define MIX_AND 0x000c -#define MIX_SRC_AND_NOT_DST 0x000d -#define MIX_NOT_SRC_AND_DST 0x000e -#define MIX_NOR 0x000f - -#define MIX_MIN 0x0010 -#define MIX_DST_MINUS_SRC 0x0011 -#define MIX_SRC_MINUS_DST 0x0012 -#define MIX_PLUS 0x0013 -#define MIX_MAX 0x0014 -#define MIX_HALF__DST_MINUS_SRC 0x0015 -#define MIX_HALF__SRC_MINUS_DST 0x0016 -#define MIX_AVERAGE 0x0017 -#define MIX_DST_MINUS_SRC_SAT 0x0018 -#define MIX_SRC_MINUS_DST_SAT 0x001a -#define MIX_HALF__DST_MINUS_SRC_SAT 0x001c -#define MIX_HALF__SRC_MINUS_DST_SAT 0x001e -#define MIX_AVERAGE_SAT 0x001f - -/* Pixel Control Register */ -#define MIXSEL_FRGDMIX 0x0000 -#define MIXSEL_PATT 0x0040 -#define MIXSEL_EXPPC 0x0080 -#define MIXSEL_EXPBLT 0x00c0 -#define COLCMPOP_F 0x0000 -#define COLCMPOP_T 0x0008 -#define COLCMPOP_GE 0x0010 -#define COLCMPOP_LT 0x0018 -#define COLCMPOP_NE 0x0020 -#define COLCMPOP_EQ 0x0028 -#define COLCMPOP_LE 0x0030 -#define COLCMPOP_GT 0x0038 -#define PLANEMODE 0x0004 - -#define FIFO_SLOTS 13 - -#define GPSLOT(n) (1 << ((n) > 8 ? (15 - ((n) - 9)) : (8 - (n)))) - -/* Wait for n slots to become available */ -#if 0 -#define _s3WaitSlots(s3,n) { \ - DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitSlots 0x%x %d", (s3)->cmd_gp_stat, n)); \ - while (((s3)->cmd_gp_stat & GPSLOT(n)) != 0); \ - DRAW_DEBUG ((DEBUG_CRTC, " s3 0x%x %d slots ready", (s3)->cmd_gp_stat, n)); \ -} -#else -/* let PCI retries solve this problem */ -#define _s3WaitSlots(s3,n) -#endif - -/* Wait until queue is empty */ -#define _s3WaitEmpty(s3) { \ - DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitEmpty 0x%x", (s3)->cmd_gp_stat)); \ - while (!((s3)->cmd_gp_stat & GPEMPTY)) ; \ - DRAW_DEBUG ((DEBUG_CRTC, " s3 empty")); \ -} - -/* Wait until GP is idle and queue is empty */ -#define _s3WaitIdleEmpty(s3) { \ - DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdleEmpty 0x%x", (s3)->cmd_gp_stat)); \ - while (((s3)->cmd_gp_stat & (GPBUSY|GPEMPTY)) != GPEMPTY) ; \ - DRAW_DEBUG ((DEBUG_CRTC, " s3 idle empty")); \ -} - -/* Wait until GP is idle */ -#define _s3WaitIdle(s3) { \ - DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitIdle 0x%x", (s3)->cmd_gp_stat)); \ - while ((s3)->cmd_gp_stat & GPBUSY) ; \ - DRAW_DEBUG ((DEBUG_CRTC, " s3 idle")); \ -} - -typedef struct _s3Cursor { - int width, height; - int xhot, yhot; - Bool has_cursor; - CursorPtr pCursor; - Pixel source, mask; -} S3Cursor; - -typedef struct _s3PatternCache { - int id; - int x, y; -} S3PatternCache; - -typedef struct _s3Patterns { - S3PatternCache *cache; - int ncache; - int last_used; - int last_id; -} S3Patterns; - -typedef struct _crtc { - CARD8 h_total_0_7; /* CR0 */ - CARD8 h_display_end_0_7; /* CR1 */ - CARD8 h_blank_start_0_7; /* CR2 */ - union { - struct { - CARD8 _h_blank_end_0_4 : 5; - CARD8 _display_skew : 2; - CARD8 : 1; - } _h_blank_end_s; - CARD8 __h_blank_end; /* CR3 */ - } _h_blank_end_u; -#define h_blank_end_0_4 _h_blank_end_u._h_blank_end_s._h_blank_end_0_4 -#define display_skew _h_blank_end_u._h_blank_end_s._display_skew -#define _h_blank_end _h_blank_end_u.__h_blank_end - - CARD8 h_sync_start_0_7; /* CR4 */ - - union { - struct { - CARD8 _h_sync_end_0_4 : 5; - CARD8 _horizontal_skew : 2; - CARD8 _h_blank_end_5 : 1; - } _h_sync_end_s; - CARD8 __h_sync_end; /* CR5 */ - } _h_sync_end_u; - -#define h_sync_end_0_4 _h_sync_end_u._h_sync_end_s._h_sync_end_0_4 -#define horizontal_skew _h_sync_end_u._h_sync_end_s._horizontal_skew -#define h_blank_end_5 _h_sync_end_u._h_sync_end_s._h_blank_end_5 -#define _h_sync_end _h_sync_end_u.__h_sync_end - - CARD8 v_total_0_7; /* CR6 */ - - union { - struct { - CARD8 _v_total_8 : 1; - CARD8 _v_display_end_8 : 1; - CARD8 _v_retrace_start_8 : 1; - CARD8 _v_blank_start_8 : 1; - CARD8 _line_compare_8 : 1; - CARD8 _v_total_9 : 1; - CARD8 _v_display_end_9 : 1; - CARD8 _v_retrace_start_9 : 1; - } _crtc_overflow_s; - CARD8 _crtc_overflow; /* CR7 */ - } _crtc_overflow_u; - -#define v_total_8 _crtc_overflow_u._crtc_overflow_s._v_total_8 -#define v_display_end_8 _crtc_overflow_u._crtc_overflow_s._v_display_end_8 -#define v_retrace_start_8 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_8 -#define v_blank_start_8 _crtc_overflow_u._crtc_overflow_s._v_blank_start_8 -#define line_compare_8 _crtc_overflow_u._crtc_overflow_s._line_compare_8 -#define v_total_9 _crtc_overflow_u._crtc_overflow_s._v_total_9 -#define v_display_end_9 _crtc_overflow_u._crtc_overflow_s._v_display_end_9 -#define v_retrace_start_9 _crtc_overflow_u._crtc_overflow_s._v_retrace_start_9 -#define crtc_overflow _crtc_overflow_u._crtc_overflow - - CARD8 preset_row_scan; /* CR8 (unused) */ - - union { - struct { - CARD8 _max_scan_line : 5; - CARD8 _v_blank_start_9 : 1; - CARD8 _line_compare_9 : 1; - CARD8 _double_scan : 1; - } _max_scan_line_s; - CARD8 __max_scan_line; /* CR9 */ - } _max_scan_line_u; - -#define max_scan_line _max_scan_line_u._max_scan_line_s._max_scan_line -#define v_blank_start_9 _max_scan_line_u._max_scan_line_s._v_blank_start_9 -#define line_compare_9 _max_scan_line_u._max_scan_line_s._line_compare_9 -#define double_scan _max_scan_line_u._max_scan_line_s._double_scan -#define _max_scan_line _max_scan_line_u.__max_scan_line - - CARD8 cursor_start; - CARD8 cursor_end; - - CARD8 start_address_8_15; /* CRC */ - CARD8 start_address_0_7; /* CRD */ - - CARD8 cursor_loc_high; - CARD8 cursor_loc_low; - - CARD8 v_retrace_start_0_7; /* CR10 */ - union { - struct { - CARD8 _v_retrace_end_0_3 : 4; - CARD8 _clear_v_retrace_int : 1; - CARD8 _disable_v_retrace_int : 1; - CARD8 _refresh_cycle_select : 1; - CARD8 _lock_crtc : 1; - } _v_retrace_end_s; - CARD8 __v_retrace_end; /* CR11 */ - } _v_retrace_end_u; - -#define v_retrace_end_0_3 _v_retrace_end_u._v_retrace_end_s._v_retrace_end_0_3 -#define clear_v_retrace_int _v_retrace_end_u._v_retrace_end_s._clear_v_retrace_int -#define disable_v_retrace_int _v_retrace_end_u._v_retrace_end_s._disable_v_retrace_int -#define refresh_cycle_select _v_retrace_end_u._v_retrace_end_s._refresh_cycle_select -#define lock_crtc _v_retrace_end_u._v_retrace_end_s._lock_crtc -#define _v_retrace_end _v_retrace_end_u.__v_retrace_end - - CARD8 v_display_end_0_7; /* CR12 */ - - CARD8 screen_off_0_7; /* CR13 */ - - union { - struct { - CARD8 _underline_location : 5; - CARD8 _count_by_four : 1; - CARD8 _doubleword_mode : 1; - CARD8 : 1; - } _underline_location_s; - CARD8 __underline_location; /* CR14 (unused) */ - } _underline_location_u; - -#define underline_location _underline_location_u._underline_location_s._underline_location -#define count_by_four _underline_location_u._underline_location_s._count_by_four -#define doubleword_mode _underline_location_u._underline_location_s._doubleword_mode -#define _underline_location _underline_location_u.__underline_location - - CARD8 v_blank_start_0_7; /* CR15 */ - CARD8 v_blank_end_0_7; /* CR16 */ - - union { - struct { - CARD8 _two_bk_cga : 1; - CARD8 _four_bk_cga : 1; - CARD8 _v_total_double : 1; - CARD8 _word_mode : 1; - CARD8 : 1; - CARD8 _address_wrap : 1; - CARD8 _byte_mode : 1; - CARD8 _hardware_reset : 1; - } _crtc_mode_s; - CARD8 _crtc_mode; /* CR17 (unused) */ - } _crtc_mode_u; - - CARD8 line_compare_0_7; /* CR18 (unused) */ - - union { - struct { - CARD8 _enable_base_offset : 1; - CARD8 _enable_two_page : 1; - CARD8 _enable_vga_16_bit : 1; - CARD8 _enhanced_mode_mapping : 1; - CARD8 _old_display_start : 2; - CARD8 _enable_high_speed_text : 1; - CARD8 : 1; - } _memory_configuration_s; - CARD8 _memory_configuration; /* CR31 (unused) */ - } _memory_configuration_u; - -#define memory_configuration _memory_configuration_u._memory_configuration -#define enable_base_offset _memory_configuration_u._memory_configuration_s._enable_base_offset -#define enable_two_page _memory_configuration_u._memory_configuration_s._enable_two_page -#define enable_vga_16_bit _memory_configuration_u._memory_configuration_s._enable_vga_16_bit -#define enhanved_mode_mapping _memory_configuration_u._memory_configuration_s._enhanced_mode_mapping -#define old_display_start _memory_configuration_u._memory_configuration_s._old_display_start -#define enable_high_speed_text _memory_configuration_u._memory_configuration_s._enable_high_speed_text - - union { - struct { - CARD8 _alt_refresh_count : 2; - CARD8 _enable_alt_refresh : 1; - CARD8 _enable_top_memory : 1; - CARD8 _enable_256_or_more : 1; - CARD8 _high_speed_text : 1; - CARD8 : 1; - CARD8 _pci_burst_disabled : 1; - } _misc_1_s; - CARD8 _misc_1; /* CR3A */ - } _misc_1_u; -#define misc_1 _misc_1_u._misc_1 -#define alt_refresh_count _misc_1_u._misc_1_s._alt_refresh_count -#define enable_alt_refresh _misc_1_u._misc_1_s._enable_alt_refresh -#define enable_top_memory _misc_1_u._misc_1_s._enable_top_memory -#define enable_256_or_more _misc_1_u._misc_1_s._enable_256_or_more -#define high_speed_text _misc_1_u._misc_1_s._high_speed_text -#define pci_burst_disabled _misc_1_u._misc_1_s._pci_burst_disabled - - CARD8 h_start_fifo_fetch_0_7; /* CR3B */ - - union { - struct { - CARD8 : 5; - CARD8 interlace : 1; - CARD8 : 2; - } _mode_control_s; - CARD8 _mode_control; /* CR42 */ - } _mode_control_u; - -#define mode_control _mode_control_u._mode_control - - union { - struct { - CARD8 : 2; - CARD8 _old_screen_off_8 : 1; - CARD8 : 4; - CARD8 h_counter_double_mode : 1; - } _extended_mode_s; - CARD8 _extended_mode; /* CR43 (unused) */ - } _extended_mode_u; - -#define extended_mode _extended_mode_u._extended_mode -#define old_screen_off_8 _extended_mode_u._extended_mode_s._old_screen_off_8 - - union { - struct { - CARD8 _hardware_cursor_enable : 1; - CARD8 : 3; - CARD8 _hardware_cursor_right : 1; - CARD8 : 3; - } _hardware_cursor_mode_s; - CARD8 _hardware_cursor_mode; /* CR45 */ - } _hardware_cursor_mode_u; - -#define hardware_cursor_mode _hardware_cursor_mode_u._hardware_cursor_mode -#define hardware_cursor_enable _hardware_cursor_mode_u._hardware_cursor_mode_s._hardware_cursor_enable - - CARD8 cursor_address_8_15; /* CR4C */ - CARD8 cursor_address_0_7; /* CR4D */ - - union { - struct { - CARD8 _ge_screen_width_2 : 1; - CARD8 : 3; - CARD8 _pixel_length : 2; - CARD8 _ge_screen_width_0_1 : 2; - } _extended_system_control_1_s; - CARD8 _extended_system_control_1; /* CR50 */ - } _extended_system_control_1_u; -#define ge_screen_width_2 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_2 -#define pixel_length _extended_system_control_1_u._extended_system_control_1_s._pixel_length -#define ge_screen_width_0_1 _extended_system_control_1_u._extended_system_control_1_s._ge_screen_width_0_1 -#define extended_system_control_1 _extended_system_control_1_u._extended_system_control_1 - - union { - struct { - CARD8 : 4; - CARD8 _screen_off_8_9 : 2; - CARD8 : 2; - } _extended_system_control_2_s; - CARD8 _extended_system_control_2; /* CR51 */ - } _extended_system_control_2_u; -#define extended_system_control_2 _extended_system_control_2_u._extended_system_control_2 -#define screen_off_8_9 _extended_system_control_2_u._extended_system_control_2_s._screen_off_8_9 - - union { - struct { - CARD8 : 1; - CARD8 big_endian_linear : 2; - CARD8 mmio_select : 2; - CARD8 mmio_window : 1; - CARD8 swap_nibbles : 1; - CARD8 : 1; - } _extended_memory_control_s; - CARD8 _extended_memory_control; /* CR53 */ - } _extended_memory_control_u; -#define extended_memory_control _extended_memory_control_u._extended_memory_control - - union { - struct { - CARD8 : 2; - CARD8 _enable_gir : 1; - CARD8 : 1; - CARD8 _hardware_cursor_ms_x11 : 1; - CARD8 : 2; - CARD8 _tri_state_off_vclk : 1; - } _extended_ramdac_control_s; - CARD8 _extended_ramdac_control; /* CR55 */ - } _extended_ramdac_control_u; -#define extended_ramdac_control _extended_ramdac_control_u._extended_ramdac_control -#define hardware_cursor_ms_x11 _extended_ramdac_control_u._extended_ramdac_control_s._hardware_cursor_ms_x11 - - - union { - struct { - CARD8 _h_total_8 : 1; - CARD8 _h_display_end_8 : 1; - CARD8 _h_blank_start_8 : 1; - CARD8 _h_blank_extend : 1; /* extend h_blank by 64 */ - CARD8 _h_sync_start_8 : 1; - CARD8 _h_sync_extend : 1; /* extend h_sync by 32 */ - CARD8 _h_start_fifo_fetch_8 : 1; - CARD8 : 1; - } _extended_horizontal_overflow_s; - CARD8 _extended_horizontal_overflow; /* CR5D */ - } _extended_horizontal_overflow_u; -#define extended_horizontal_overflow _extended_horizontal_overflow_u._extended_horizontal_overflow -#define h_total_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_total_8 -#define h_display_end_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_display_end_8 -#define h_blank_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_start_8 -#define h_blank_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_blank_extend -#define h_sync_start_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_start_8 -#define h_sync_extend _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_sync_extend -#define h_start_fifo_fetch_8 _extended_horizontal_overflow_u._extended_horizontal_overflow_s._h_start_fifo_fetch_8 - - - union { - struct { - CARD8 _v_total_10 : 1; - CARD8 _v_display_end_10 : 1; - CARD8 _v_blank_start_10 : 1; - CARD8 : 1; - CARD8 _v_retrace_start_10 : 1; - CARD8 : 1; - CARD8 _line_compare_10 : 1; - CARD8 : 1; - } _extended_vertical_overflow_s; - CARD8 _extended_vertical_overflow; /* CR5E */ - } _extended_vertical_overflow_u; -#define extended_vertical_overflow _extended_vertical_overflow_u._extended_vertical_overflow -#define v_total_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_total_10 -#define v_display_end_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_display_end_10 -#define v_blank_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_blank_start_10 -#define v_retrace_start_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._v_retrace_start_10 -#define line_compare_10 _extended_vertical_overflow_u._extended_vertical_overflow_s._line_compare_10 - - - CARD8 l_parm_0_7; /* CR62 (undocumented) */ - - union { - struct { - CARD8 : 3; - CARD8 _delay_blank : 2; - CARD8 : 3; - } _extended_misc_control_s; - CARD8 _extended_misc_control; /* CR65 */ - } _extended_misc_control_u; -#define extended_misc_control _extended_misc_control_u._extended_misc_control -#define delay_blank _extended_misc_control_u._extended_misc_control_s._delay_blank - - union { - struct { - CARD8 _v_clock_phase : 1; - CARD8 : 3; - CARD8 _color_mode : 4; - } _extended_misc_control_2_s; - CARD8 _extended_misc_control_2; /* CR67 */ - } _extended_misc_control_2_u; - -#define v_clock_phase _extended_misc_control_2_u._extended_misc_control_2_s._v_clock_phase -#define color_mode _extended_misc_control_2_u._extended_misc_control_2_s._color_mode -#define extended_misc_control_2 _extended_misc_control_2_u._extended_misc_control_2 - - - union { - struct { - CARD8 cas_oe_str : 2; - CARD8 ras_low : 1; - CARD8 ras_precharge : 1; - CARD8 : 3; - CARD8 _memory_bus_size : 1; /* 0 = 32, 1 = 32/64 */ - } _configuration_3_s; - CARD8 _configuration_3; /* CR68 */ - } _configuration_3_u; -#define configuration_3 _configuration_3_u._configuration_3 -#define memory_bus_size _configuration_3_u._configuration_3_s._memory_bus_size - - union { - struct { - CARD8 _start_address_16_19 : 4; - CARD8 : 4; - } _extended_system_control_3_s; - CARD8 _extended_system_control_3; /* CR69 */ - } _extended_system_control_3_u; -#define extended_system_control_3 _extended_system_control_3_u._extended_system_control_3 -#define start_address_16_19 _extended_system_control_3_u._extended_system_control_3_s._start_address_16_19 - - CARD8 extended_bios_5; /* CR6D */ - - union { - struct { - CARD8 dot_clock_vclki : 1; /* testing only */ - CARD8 vclki_with_vafc : 1; /* feature connector */ - CARD8 : 1; - CARD8 bpp_24_mode : 1; /* 24 bpp mode */ - CARD8 alt_color_mode : 4; /* feature connector mode */ - } _extended_sequencer_b_s; - CARD8 _extended_sequencer_b; /* SRB */ - } _extended_sequencer_b_u; - -#define extended_sequencer_b _extended_sequencer_b_u._extended_sequencer_b - - union extended_sequencer_d_u { - struct { - CARD8 enable_feature : 1; - CARD8 lpb_feature : 1; - CARD8 : 2; - CARD8 _hsync_control : 2; - CARD8 _vsync_control : 2; - } _extended_sequencer_d_s; - CARD8 _extended_sequencer_d; - } _extended_sequencer_d_u; - -#define extended_sequencer_d _extended_sequencer_d_u._extended_sequencer_d -#define hsync_control _extended_sequencer_d_u._extended_sequencer_d_s._hsync_control -#define vsync_control _extended_sequencer_d_u._extended_sequencer_d_s._vsync_control - - union { - struct { - CARD8 _dclk_pll_n : 5; - CARD8 _dclk_pll_r : 2; - CARD8 : 1; - } _dclk_value_low_s; - CARD8 _dclk_value_low; /* SR12 */ - } _dclk_value_low_u; - -#define dclk_value_low _dclk_value_low_u._dclk_value_low -#define dclk_pll_n_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_n -#define dclk_pll_r_trio _dclk_value_low_u._dclk_value_low_s._dclk_pll_r - - union { - struct { - CARD8 _dclk_pll_m : 7; - CARD8 : 1; - } _dclk_value_high_s; - CARD8 _dclk_value_high; /* SR13 */ - } _dclk_value_high_u; - -#define dclk_value_high _dclk_value_high_u._dclk_value_high -#define dclk_pll_m_trio _dclk_value_high_u._dclk_value_high_s._dclk_pll_m - - union { - struct { - CARD8 _mfrq_en : 1; - CARD8 _dfrq_en : 1; - CARD8 _mclk_out : 1; - CARD8 _vclk_out : 1; - CARD8 _dclk_over_2 : 1; - CARD8 _clk_load : 1; - CARD8 _dclk_invert : 1; - CARD8 _ena_2_cycle_write : 1; - } _control_2_s; - CARD8 _control_2; /* SR15 */ - } _control_2_u; - -#define control_2 _control_2_u._control_2 -#define mfrq_en _control_2_u._control_2_s._mfrq_en -#define dfrq_en _control_2_u._control_2_s._dfrq_en -#define mclk_out _control_2_u._control_2_s._mclk_out -#define vclk_out _control_2_u._control_2_s._vclk_out -#define dclk_over_2 _control_2_u._control_2_s._dclk_over_2 -#define clk_load _control_2_u._control_2_s._clk_load -#define dclk_invert _control_2_u._control_2_s._dclk_invert -#define ena_2_cycle_write _control_2_u._control_2_s._ena_2_cycle_write - - union { - struct { - CARD8 : 5; - CARD8 _dac_power_down : 1; - CARD8 _lut_write_control : 1; - CARD8 _enable_clock_double : 1; - } _ramdac_control_s; - CARD8 _ramdac_control; /* SR18 */ - } _ramdac_control_u; - -#define ramdac_control _ramdac_control_u._ramdac_control -#define enable_clock_double _ramdac_control_u._ramdac_control_s._enable_clock_double - - union { - struct { - CARD8 _dclk_pll_n : 6; - CARD8 _dclk_pll_r : 2; - } _dclk_value_low_s; - CARD8 _dclk_value_low; /* SR36 */ - } _dclk_value_low_savage_u; - -#define dclk_value_low_savage _dclk_value_low_savage_u._dclk_value_low -#define dclk_pll_n_savage_0_5 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_n -#define dclk_pll_r_savage_0_1 _dclk_value_low_savage_u._dclk_value_low_s._dclk_pll_r - - CARD8 dclk_pll_m0_savage_0_7; /* SR37 */ - CARD8 dclk_pll_m1_savage_0_7; /* SR38 */ - - struct { - CARD8 _dclk_pll_m : 8; - } _dclk_value_high_s_savage; - - union { - struct { - CARD8 _dclk_select : 1; - CARD8 : 1; - CARD8 _dclk_pll_r_2 : 1; - CARD8 _dclk_pll_m_8 : 1; - CARD8 _dclk_pll_n_6 : 1; - CARD8 _pce : 1; - CARD8 _ccg : 1; - CARD8 _csp : 1; - } _extended_seq_39_s; - CARD8 _extended_seq_39; /* SR39 */ - } _extended_seq_39_u; - -#define extended_seq_39 _extended_seq_39_u._extended_seq_39 -#define dclk_pll_select_savage _extended_seq_39_u._extended_seq_39_s._dclk_select -#define dclk_pll_r_savage_2 _extended_seq_39_u._extended_seq_39_s._dclk_pll_r_2 -#define dclk_pll_m_savage_8 _extended_seq_39_u._extended_seq_39_s._dclk_pll_m_8 -#define dclk_pll_n_savage_6 _extended_seq_39_u._extended_seq_39_s._dclk_pll_n_6 - - /* computed values */ - CARD16 ge_screen_pitch; - CARD8 bits_per_pixel; - CARD8 depth; - CARD8 double_pixel_mode; - CARD16 pixel_width; -} S3Crtc; - -#define crtc_v_total(crtc) ((crtc)->v_total_0_7 | \ - ((crtc)->v_total_8 << 8) | \ - ((crtc)->v_total_9 << 9) | \ - ((crtc)->v_total_10 << 10)) - -#define crtc_set_v_total(crtc,v) { \ - ((crtc))->v_total_0_7 = (v); \ - ((crtc))->v_total_8 = (v) >> 8; \ - ((crtc))->v_total_9 = (v) >> 9; \ - ((crtc))->v_total_10 = (v) >> 10; \ -} - -#define crtc_v_display_end(crtc) ((crtc)->v_display_end_0_7 | \ - ((crtc)->v_display_end_8 << 8) | \ - ((crtc)->v_display_end_9 << 9) | \ - ((crtc)->v_display_end_10 << 10)) - -#define crtc_set_v_display_end(crtc,v) {\ - ((crtc))->v_display_end_0_7 = (v); \ - ((crtc))->v_display_end_8 = (v) >> 8; \ - ((crtc))->v_display_end_9 = (v) >> 9; \ - ((crtc))->v_display_end_10 = (v) >> 10; \ -} - -#define crtc_v_retrace_start(crtc) ((crtc)->v_retrace_start_0_7 | \ - ((crtc)->v_retrace_start_8 << 8) | \ - ((crtc)->v_retrace_start_9 << 9) | \ - ((crtc)->v_retrace_start_10 << 10)) - -#define crtc_set_v_retrace_start(crtc,v) {\ - ((crtc))->v_retrace_start_0_7 = (v); \ - ((crtc))->v_retrace_start_8 = (v) >> 8; \ - ((crtc))->v_retrace_start_9 = (v) >> 9; \ - ((crtc))->v_retrace_start_10 = (v) >> 10; \ -} - -#define crtc_v_blank_start(crtc) ((crtc)->v_blank_start_0_7 | \ - ((crtc)->v_blank_start_8 << 8) | \ - ((crtc)->v_blank_start_9 << 9) | \ - ((crtc)->v_blank_start_10 << 10)) - -#define crtc_set_v_blank_start(crtc,v) {\ - ((crtc))->v_blank_start_0_7 = (v); \ - ((crtc))->v_blank_start_8 = (v) >> 8; \ - ((crtc))->v_blank_start_9 = (v) >> 9; \ - ((crtc))->v_blank_start_10 = (v) >> 10; \ -} - -#define crtc_h_total(crtc) ((crtc)->h_total_0_7 | \ - ((crtc)->h_total_8 << 8)) - -#define crtc_set_h_total(crtc,v) {\ - ((crtc))->h_total_0_7 = (v); \ - ((crtc))->h_total_8 = (v) >> 8; \ -} - -#define crtc_h_display_end(crtc) ((crtc)->h_display_end_0_7 | \ - ((crtc)->h_display_end_8 << 8)) - -#define crtc_set_h_display_end(crtc,v) {\ - ((crtc))->h_display_end_0_7 = (v); \ - ((crtc))->h_display_end_8 = (v) >> 8; \ -} - -#define crtc_h_blank_start(crtc) ((crtc)->h_blank_start_0_7 | \ - ((crtc)->h_blank_start_8 << 8)) - -#define crtc_set_h_blank_start(crtc,v) {\ - ((crtc))->h_blank_start_0_7 = (v); \ - ((crtc))->h_blank_start_8 = (v) >> 8; \ -} - -#define crtc_h_blank_end(crtc) ((crtc)->h_blank_end_0_4 | \ - ((crtc)->h_blank_end_5 << 5)) - -#define crtc_set_h_blank_end(crtc,v) {\ - ((crtc))->h_blank_end_0_4 = (v); \ - ((crtc))->h_blank_end_5 = (v) >> 5; \ -} - -#define crtc_h_sync_start(crtc) ((crtc)->h_sync_start_0_7 | \ - ((crtc)->h_sync_start_8 << 8)) - -#define crtc_set_h_sync_start(crtc,v) {\ - ((crtc))->h_sync_start_0_7 = (v); \ - ((crtc))->h_sync_start_8 = (v) >> 8; \ -} - -#define crtc_h_sync_end(crtc) ((crtc)->h_sync_end_0_4) - -#define crtc_set_h_sync_end(crtc,v) {\ - ((crtc))->h_sync_end_0_4 = (v); \ -} - -#define crtc_screen_off(crtc) ((crtc)->screen_off_0_7 | \ - (((crtc)->screen_off_8_9 ? \ - ((crtc))->screen_off_8_9 : \ - ((crtc))->old_screen_off_8) << 8)) - -#define crtc_set_screen_off(crtc,v) {\ - ((crtc))->screen_off_0_7 = (v); \ - ((crtc))->old_screen_off_8 = 0; \ - ((crtc))->screen_off_8_9 = (v) >> 8; \ -} - -#define crtc_ge_screen_width(crtc) ((crtc)->ge_screen_width_0_1 | \ - ((crtc)->ge_screen_width_2 << 2)) - -#define crtc_set_ge_screen_width(crtc,v) { \ - (crtc)->ge_screen_width_0_1 = (v); \ - (crtc)->ge_screen_width_2 = (v) >> 2; \ -} - -#define crtc_h_start_fifo_fetch(crtc) ((crtc)->h_start_fifo_fetch_0_7 | \ - ((crtc)->h_start_fifo_fetch_8 << 8)) - -#define crtc_set_h_start_fifo_fetch(crtc,v) {\ - (crtc)->h_start_fifo_fetch_0_7 = (v); \ - (crtc)->h_start_fifo_fetch_8 = (v) >> 8; \ -} - -#define crtc_start_address(crtc) ((crtc)->start_address_0_7 | \ - ((crtc)->start_address_8_15 << 8) | \ - ((crtc)->start_address_16_19 << 16)) - -#define crtc_set_start_address(crtc,v) {\ - (crtc)->start_address_0_7 = (v); \ - (crtc)->start_address_8_15 = (v) >> 8; \ - (crtc)->start_address_16_19 = (v) >> 16; \ -} - -#define crtc_line_compare(crtc) ((crtc)->line_compare_0_7 | \ - ((crtc)->line_compare_8 << 8) | \ - ((crtc)->line_compare_9 << 9) | \ - ((crtc)->line_compare_10 << 10)) - -#define crtc_set_line_compare(crtc,v) { \ - ((crtc))->line_compare_0_7 = (v); \ - ((crtc))->line_compare_8 = (v) >> 8; \ - ((crtc))->line_compare_9 = (v) >> 9; \ - ((crtc))->line_compare_10 = (v) >> 10; \ -} - - -#define GetCrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3d4, (i)) -#define PutCrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3d4, (i), (v)) - -#define GetSrtc(s3,i) _s3ReadIndexRegister (&(s3)->crt_vga_3c4, (i)) -#define PutSrtc(s3,i,v) _s3WriteIndexRegister (&(s3)->crt_vga_3c4, (i), (v)) - -#define S3_CLOCK_REF 14318 /* KHz */ - -#define S3_CLOCK(m,n,r) (S3_CLOCK_REF * ((m) + 2) / (((n) + 2) * (1 << (r)))) - -#if PLATFORM == 200 -#define S3_MAX_CLOCK 80000 /* KHz */ -#endif -#if PLATFORM == 300 -#define S3_MAX_CLOCK 135000 /* KHz */ -#endif - -typedef struct _s3Save { - CARD8 cursor_fg; - CARD8 cursor_bg; - CARD8 lock1; - CARD8 lock2; - CARD8 locksrtc; - CARD8 clock_mode; - CARD32 alt_mix; - CARD32 write_mask; - CARD32 fg; - CARD32 bg; - S3Crtc crtc; -} S3Save; - -typedef struct _s3CardInfo { - S3Ptr s3; /* pointer to register structure */ - int memory; /* amount of memory */ - CARD8 *frameBuffer; /* pointer to frame buffer */ - CARD8 *registers; /* pointer to register map */ - S3Save save; - Bool savage; - Bool need_sync; -} S3CardInfo; - -typedef struct _s3FbInfo { - CARD8 *offscreen; /* pointer to offscreen area */ - int offscreen_y; /* top y coordinate of offscreen area */ - int offscreen_x; /* top x coordinate of offscreen area */ - int offscreen_width; /* width of offscreen area */ - int offscreen_height; /* height of offscreen area */ - S3Patterns patterns; - CARD32 bitmap_offset; - int accel_stride; - int accel_bpp; -} S3FBInfo; - -typedef struct _s3ScreenInfo { - CARD8 *cursor_base; /* pointer to cursor area */ - S3Cursor cursor; - S3FBInfo fb[1]; -} S3ScreenInfo; - -#define LockS3(s3c) -#define UnlockS3(s3c) - -#define getS3CardInfo(kd) ((S3CardInfo *) ((kd)->card->driver)) -#define s3CardInfo(kd) S3CardInfo *s3c = getS3CardInfo(kd) - -#define getS3ScreenInfo(kd) ((S3ScreenInfo *) ((kd)->screen->driver)) -#define s3ScreenInfo(kd) S3ScreenInfo *s3s = getS3ScreenInfo(kd) - -Bool s3CardInit (KdCardInfo *); -Bool s3ScreenInit (KdScreenInfo *); -Bool s3Enable (ScreenPtr pScreen); -void s3Disable (ScreenPtr pScreen); -void s3Fini (ScreenPtr pScreen); - -Bool s3CursorInit (ScreenPtr pScreen); -void s3CursorEnable (ScreenPtr pScreen); -void s3CursorDisable (ScreenPtr pScreen); -void s3CursorFini (ScreenPtr pScreen); -void s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdefs); - -Bool s3DrawInit (ScreenPtr pScreen); -void s3DrawEnable (ScreenPtr pScreen); -void s3DrawSync (ScreenPtr pScreen); -void s3DrawDisable (ScreenPtr pScreen); -void s3DrawFini (ScreenPtr pScreen); - -void s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); -void s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs); - -void S3InitCard (KdCardAttr *attr); - -void s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR); - -CARD8 _s3ReadIndexRegister (VOL8 *base, CARD8 index); -void _s3WriteIndexRegister (VOL8 *base, CARD8 index, CARD8 value); - -extern KdCardFuncs s3Funcs; - -/* - * Wait for the begining of the retrace interval - */ - -#define S3_RETRACE_LOOP_CHECK if (++_loop_count > 300000) {\ - DRAW_DEBUG ((DEBUG_FAILURE, "S3 wait loop failed at %s:%d", \ - __FILE__, __LINE__)); \ - break; \ -} - -#define _s3WaitVRetrace(s3) { \ - VOL8 *_status = &s3->crt_vga_status_1; \ - int _loop_count; \ - DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetrace 0x%x", *_status)); \ - _loop_count = 0; \ - while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \ - _loop_count = 0; \ - while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \ -} -/* - * Wait for the begining of the retrace interval - */ -#define _s3WaitVRetraceEnd(s3) { \ - VOL8 *_status = &s3->crt_vga_status_1; \ - int _loop_count; \ - DRAW_DEBUG ((DEBUG_CRTC, "_s3WaitVRetraceEnd 0x%x", *_status)); \ - _loop_count = 0; \ - while ((*_status & VGA_STATUS_1_VSY) == 0) S3_RETRACE_LOOP_CHECK; \ - _loop_count = 0; \ - while ((*_status & VGA_STATUS_1_VSY) != 0) S3_RETRACE_LOOP_CHECK; \ -} - -/* - * This extension register must contain a magic bit pattern to enable - * the remaining extended registers - */ - -#define _s3UnlockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0xa0) -#define _s3LockExt(s3) _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x39, 0x00) - -#define S3_CURSOR_WIDTH 64 -#define S3_CURSOR_HEIGHT 64 -#define S3_CURSOR_SIZE ((S3_CURSOR_WIDTH * S3_CURSOR_HEIGHT + 7) / 8) - -#define S3_TILE_SIZE 8 - -#endif /* _S3_H_ */ diff --git a/hw/kdrive/trio/s3clock.c b/hw/kdrive/trio/s3clock.c deleted file mode 100644 index 9f2d313ca..000000000 --- a/hw/kdrive/trio/s3clock.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -/* - * Clock synthesis: - * - * f_out = f_ref * ((M + 2) / ((N + 2) * (1 << R))) - * - * Constraints: - * - * 1. 135MHz <= f_ref * ((M + 2) / (N + 2)) <= 270 MHz - * 2. N >= 1 - * - * Vertical refresh rate = clock / ((hsize + hblank) * (vsize + vblank)) - * Horizontal refresh rate = clock / (hsize + hblank) - */ - -/* all in kHz */ -#define MIN_VCO 180000.0 -#define MAX_VCO 360000.0 - -void -s3GetClock (int target, int *Mp, int *Np, int *Rp, int maxM, int maxN, int maxR) -{ - int M, N, R, bestM, bestN; - int f_vco, f_out; - int err, abserr, besterr; - - /* - * Compute correct R value to keep VCO in range - */ - for (R = 0; R <= maxR; R++) - { - f_vco = target * (1 << R); - if (MIN_VCO <= f_vco && f_vco < MAX_VCO) - break; - } - - /* M = f_out / f_ref * ((N + 2) * (1 << R)); */ - besterr = target; - for (N = 0; N <= maxN; N++) - { - M = (target * (N + 2) * (1 << R) + (S3_CLOCK_REF/2)) / S3_CLOCK_REF - 2; - if (0 <= M && M <= maxM) - { - f_out = S3_CLOCK(M,N,R); - err = target - f_out; - if (err < 0) - err = -err; - if (err < besterr) - { - besterr = err; - bestM = M; - bestN = N; - } - } - } - *Mp = bestM; - *Np = bestN; - *Rp = R; -} diff --git a/hw/kdrive/trio/s3cmap.c b/hw/kdrive/trio/s3cmap.c deleted file mode 100644 index cc32da38c..000000000 --- a/hw/kdrive/trio/s3cmap.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -void -s3GetColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - s3CardInfo(pScreenPriv); - S3Ptr s3 = s3c->s3; - VOL8 *dac_rd_ad = &s3->crt_vga_dac_rd_ad; - VOL8 *dac_data = &s3->crt_vga_dac_data; - - LockS3 (s3c); - while (ndef--) - { - *dac_rd_ad = pdefs->pixel; - pdefs->red = *dac_data << 10; - pdefs->green = *dac_data << 10; - pdefs->blue = *dac_data << 10; - pdefs++; - } - UnlockS3(s3c); -} - -void -s3PutColors (ScreenPtr pScreen, int fb, int ndef, xColorItem *pdefs) -{ - KdScreenPriv(pScreen); - s3CardInfo(pScreenPriv); - S3Ptr s3 = s3c->s3; - VOL8 *dac_wt_ad = &s3->crt_vga_dac_wt_ad; - VOL8 *dac_data = &s3->crt_vga_dac_data; - - LockS3(s3c); - _s3WaitVRetrace (s3); - while (ndef--) - { - *dac_wt_ad = pdefs->pixel; - *dac_data = pdefs->red >> 10; - *dac_data = pdefs->green >> 10; - *dac_data = pdefs->blue >> 10; - pdefs++; - } - UnlockS3(s3c); -} - diff --git a/hw/kdrive/trio/s3curs.c b/hw/kdrive/trio/s3curs.c deleted file mode 100644 index 20afad756..000000000 --- a/hw/kdrive/trio/s3curs.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" -#include "s3draw.h" -#include "cursorstr.h" - -#define SetupCursor(s) KdScreenPriv(s); \ - s3CardInfo(pScreenPriv); \ - s3ScreenInfo(pScreenPriv); \ - S3Ptr s3 = s3c->s3; \ - S3Cursor *pCurPriv = &s3s->cursor - -static void -_s3MoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CARD8 xlow, xhigh, ylow, yhigh; - CARD8 xoff, yoff; - - x -= pCurPriv->xhot; - xoff = 0; - if (x < 0) - { - xoff = -x; - x = 0; - } - y -= pCurPriv->yhot; - yoff = 0; - if (y < 0) - { - yoff = -y; - y = 0; - } - xlow = (CARD8) x; - xhigh = (CARD8) (x >> 8); - ylow = (CARD8) y; - yhigh = (CARD8) (y >> 8); - - - /* This is the recommended order to move the cursor */ - - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x46, xhigh); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x47, xlow); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x49, ylow); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4e, xoff); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4f, yoff); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x48, yhigh); -} - -static void -s3MoveCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor (pScreen); - - if (!pCurPriv->has_cursor) - return; - - if (!pScreenPriv->enabled) - return; - - LockS3(s3c); - _s3UnlockExt(s3); - _s3MoveCursor (pScreen, x, y); - _s3LockExt(s3); - UnlockS3(s3c); -} - -static void -s3AllocCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - KdAllocateCursorPixels (pScreen, 0, pCursor, - &pCurPriv->source, &pCurPriv->mask); - switch (pScreenPriv->screen->fb[0].bitsPerPixel) { - case 4: - pCurPriv->source |= pCurPriv->source << 4; - pCurPriv->mask |= pCurPriv->mask << 4; - case 8: - pCurPriv->source |= pCurPriv->source << 8; - pCurPriv->mask |= pCurPriv->mask << 8; - case 16: - pCurPriv->source |= pCurPriv->source << 16; - pCurPriv->mask |= pCurPriv->mask << 16; - } -} - -static void -_s3SetCursorColors (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - /* set foreground */ - /* Reset cursor color stack pointers */ - (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 8); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4a, pCurPriv->source >> 16); - - /* set background */ - /* Reset cursor color stack pointers */ - (void) _s3ReadIndexRegister(&s3->crt_vga_3d4, 0x45); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 8); - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x4b, pCurPriv->mask >> 16); -} - -void -s3RecolorCursor (ScreenPtr pScreen, int ndef, xColorItem *pdef) -{ - SetupCursor (pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - xColorItem sourceColor, maskColor; - - if (!pCurPriv->has_cursor || !pCursor) - return; - - if (!pScreenPriv->enabled) - return; - - if (pdef) - { - while (ndef) - { - if (pdef->pixel == pCurPriv->source || - pdef->pixel == pCurPriv->mask) - break; - ndef--; - } - if (!ndef) - return; - } - s3AllocCursorColors (pScreen); - LockS3 (s3c); - _s3UnlockExt(s3); - _s3SetCursorColors (pScreen); - _s3LockExt (s3); - UnlockS3 (s3c); -} - -static void -s3LoadCursor (ScreenPtr pScreen, int x, int y) -{ - SetupCursor(pScreen); - CursorPtr pCursor = pCurPriv->pCursor; - CursorBitsPtr bits = pCursor->bits; - int w, h; - unsigned char r[2], g[2], b[2]; - unsigned long *ram; - unsigned long *msk, *mskLine, *src, *srcLine; - unsigned long and, xor; - int i, j; - int cursor_address; - int wsrc; - unsigned char ramdac_control_; - - /* - * Allocate new colors - */ - s3AllocCursorColors (pScreen); - - pCurPriv->pCursor = pCursor; - pCurPriv->xhot = pCursor->bits->xhot; - pCurPriv->yhot = pCursor->bits->yhot; - - /* - * Stick new image into cursor memory - */ - ram = (unsigned long *) s3s->cursor_base; - mskLine = (unsigned long *) bits->mask; - srcLine = (unsigned long *) bits->source; - - h = bits->height; - if (h > S3_CURSOR_HEIGHT) - h = S3_CURSOR_HEIGHT; - - wsrc = BitmapBytePad(bits->width) / 4; /* ulongs per line */ - - for (i = 0; i < S3_CURSOR_HEIGHT; i++) - { - msk = mskLine; - src = srcLine; - mskLine += wsrc; - srcLine += wsrc; - for (j = 0; j < S3_CURSOR_WIDTH / 32; j++) { - - unsigned long m, s; - - if (i < h && j < wsrc) - { - m = *msk++; - s = *src++; - xor = m & s; - and = ~m; - } - else - { - and = 0xffffffff; - xor = 0x00000000; - } - - S3AdjustBits32(and); - S3AdjustBits32(xor); - *ram++ = (and & 0xffff) | (xor << 16); - *ram++ = (and >> 16) | (xor & 0xffff0000); - } - } - - _s3WaitIdle (s3); - _s3UnlockExt (s3); - - /* Set new color */ - _s3SetCursorColors (pScreen); - - /* Enable the cursor */ - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0x01); - - /* Wait for VRetrace to make sure the position is read */ - _s3WaitVRetrace (s3); - - /* Move to new position */ - _s3MoveCursor (pScreen, x, y); - - _s3LockExt (s3); - UnlockS3(s3c); -} - -static void -s3UnloadCursor (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - LockS3 (s3c); - _s3UnlockExt(s3); - - /* Disable cursor */ - _s3WriteIndexRegister (&s3->crt_vga_3d4, 0x45, 0); - - _s3LockExt(s3); - UnlockS3 (s3c); -} - -static Bool -s3RealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - SetupCursor(pScreen); - - if (!pScreenPriv->enabled) - return TRUE; - - /* miRecolorCursor does this */ - if (pCurPriv->pCursor == pCursor) - { - if (pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - s3LoadCursor (pScreen, x, y); - } - } - return TRUE; -} - -static Bool -s3UnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) -{ - return TRUE; -} - -static void -s3SetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - SetupCursor(pScreen); - - pCurPriv->pCursor = pCursor; - - if (!pScreenPriv->enabled) - return; - - if (pCursor) - s3LoadCursor (pScreen, x, y); - else - s3UnloadCursor (pScreen); -} - -miPointerSpriteFuncRec s3PointerSpriteFuncs = { - s3RealizeCursor, - s3UnrealizeCursor, - s3SetCursor, - s3MoveCursor, -}; - -static void -s3QueryBestSize (int class, - unsigned short *pwidth, unsigned short *pheight, - ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - switch (class) - { - case CursorShape: - if (*pwidth > pCurPriv->width) - *pwidth = pCurPriv->width; - if (*pheight > pCurPriv->height) - *pheight = pCurPriv->height; - if (*pwidth > pScreen->width) - *pwidth = pScreen->width; - if (*pheight > pScreen->height) - *pheight = pScreen->height; - break; - default: - fbQueryBestSize (class, pwidth, pheight, pScreen); - break; - } -} - -Bool -s3CursorInit (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!s3s->cursor_base) - { - pCurPriv->has_cursor = FALSE; - return FALSE; - } - - pCurPriv->width = S3_CURSOR_WIDTH; - pCurPriv->height= S3_CURSOR_HEIGHT; - pScreen->QueryBestSize = s3QueryBestSize; - miPointerInitialize (pScreen, - &s3PointerSpriteFuncs, - &kdPointerScreenFuncs, - FALSE); - pCurPriv->has_cursor = TRUE; - pCurPriv->pCursor = NULL; - return TRUE; -} - -void -s3CursorEnable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - int x, y; - - miPointerPosition (&x, &y); - s3LoadCursor (pScreen, x, y); - } - else - s3UnloadCursor (pScreen); - } -} - -void -s3CursorDisable (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - if (!pScreenPriv->enabled) - return; - - if (pCurPriv->has_cursor) - { - if (pCurPriv->pCursor) - { - s3UnloadCursor (pScreen); - } - } -} - -void -s3CursorFini (ScreenPtr pScreen) -{ - SetupCursor (pScreen); - - pCurPriv->pCursor = NULL; -} diff --git a/hw/kdrive/trio/s3stub.c b/hw/kdrive/trio/s3stub.c deleted file mode 100644 index f44ad84c6..000000000 --- a/hw/kdrive/trio/s3stub.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 1999 SuSE, 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "s3.h" - -void -InitCard (char *name) -{ - KdCardAttr attr; - CARD32 count; - - count = 0; - while (LinuxFindPci (0x5333, 0x8904, count, &attr)) - { - KdCardInfoAdd (&s3Funcs, &attr, 0); - count++; - } -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdOsAddInputDrivers (); - KdInitInput (); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/ts300/ts300.c b/hw/kdrive/ts300/ts300.c deleted file mode 100644 index e9ff3a3da..000000000 --- a/hw/kdrive/ts300/ts300.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright © 1999 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" - -extern KdCardFuncs sisFuncs; -extern KdCardFuncs s3Funcs; - -/* - * Kludgy code to parse the ascii /proc/pci file as the TS300 - * is running a 2.0 kernel - */ -BOOL -HasPCI (char *name, KdCardAttr *attr) -{ - FILE *f; - char line[1024]; - BOOL waiting; - BOOL found = FALSE; - char *mem; - - f = fopen ("/proc/pci", "r"); - if (!f) - return FALSE; - waiting = FALSE; - attr->naddr = 0; - while (fgets (line, sizeof (line), f)) - { - if (waiting) - { - - if (mem = strstr (line, "memory at ")) - { - mem += strlen ("memory at "); - attr->address[attr->naddr++] = strtoul (mem, NULL, 0); - found = TRUE; - } - else if (mem = strstr (line, "I/O at ")) - { - mem += strlen ("I/O at "); - attr->io = strtoul (mem, NULL, 0); - found = TRUE; - } - else if (strstr (line, "Bus") && strstr (line, "device") && - strstr (line, "function")) - break; - } - else if (strstr (line, "VGA compatible controller")) - { - if (strstr (line, name)) - waiting = TRUE; - } - } - fclose (f); - return found; -} - -typedef struct _PCICard { - char *user; - char *name; - KdCardFuncs *funcs; -} PCICard; - -PCICard PCICards[] = { - "sis", "Silicon Integrated Systems", &sisFuncs, - "s3", "S3 Inc.", &s3Funcs, -}; - -#define NUM_PCI_CARDS (sizeof (PCICards) / sizeof (PCICards[0])) - -void -InitCard (char *name) -{ - KdCardInfo *card; - CARD32 fb; - int i; - KdCardAttr attr; - - for (i = 0; i < NUM_PCI_CARDS; i++) - { - if (!name || !strcmp (name, PCICards[i].user)) - { - if (HasPCI (PCICards[i].name, &attr)) - { - KdCardInfoAdd (PCICards[i].funcs, &attr, 0); - return; - } - } - } -} - -void -InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) -{ - KdInitOutput (pScreenInfo, argc, argv); -} - -void -InitInput (int argc, char **argv) -{ - KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); -} - -void -ddxUseMsg (void) -{ - KdUseMsg(); -} - -int -ddxProcessArgument (int argc, char **argv, int i) -{ - return KdProcessArgument (argc, argv, i); -} diff --git a/hw/kdrive/via/Makefile.am b/hw/kdrive/via/Makefile.am deleted file mode 100644 index c659379f0..000000000 --- a/hw/kdrive/via/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -INCLUDES = \ - @KDRIVE_INCS@ \ - -I$(top_srcdir)/hw/kdrive/vesa \ - @KDRIVE_CFLAGS@ - -bin_PROGRAMS = Xvia - -noinst_LIBRARIES = libvia.a - -libvia_a_SOURCES = \ - via.c \ - viadraw.c \ - viadraw.h \ - via.h \ - via_regs.h - -Xvia_SOURCES = \ - viastub.c - -VIA_LIBS = \ - libvia.a \ - $(top_builddir)/hw/kdrive/vesa/libvesa.a - -if GLX -Xvia_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -endif - -Xvia_LDADD = \ - $(VIA_LIBS) \ - @KDRIVE_LIBS@ - -Xvia_DEPENDENCIES = \ - libvia.a \ - @KDRIVE_LOCAL_LIBS@ - -relink: - rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS) diff --git a/hw/kdrive/via/via.c b/hw/kdrive/via/via.c deleted file mode 100644 index b8e1036aa..000000000 --- a/hw/kdrive/via/via.c +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Copyright © 2004 Ralph Thomas - * - * 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 Ralph Thomas not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Ralph Thomas makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL RALPH THOMAS 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. - */ -/* -** VIA CLE266 driver -** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> -** -** http://www.viatech.com.tw/ -*/ - -#include "via.h" -#include "viadraw.h" - -/* -** viaCardInit( KdCardInfo* card ) -** -** Description: -** Create card specific structures, map chip registers and initialize the -** VESA driver. We make the VESA driver do boring stuff for us, like set -** up a framebuffer and program a mode. -** -** Parameters: -** card Information stucture for the card we want to bring up. -** It should be a VIA card. -** -** Return: -** TRUE Initialization went ok. -** FALSE Initialization failed. -*/ -static Bool -viaCardInit( KdCardInfo* card ) { - ViaCardInfo* viac; - - viac = (ViaCardInfo*) xalloc( sizeof( ViaCardInfo ) ); - if( !viac ) return FALSE; - memset( viac, '\0', sizeof( ViaCardInfo ) ); - - - viaMapReg( card, viac ); - - if( !vesaInitialize( card, &viac->vesa ) ) { - xfree( viac ); - return FALSE; - } - - card->driver = viac; - - return TRUE; -} - -/* -** Bool viaScreenInit( KdScreenInfo* screen ) -** -** Description: -** Initialize a single screen, described by the screen parameter. -** This is where fairly low-level screen related things get setup, -** such as video mode and resolution. Currently that all gets -** handed off to the VESA driver. -** -** Parameters: -** screen Information structure for the screen to enable. -** -** Return: -** TRUE Screen was initialized successfully -** FALSE Screen initialization failed -*/ -static Bool -viaScreenInit( KdScreenInfo* screen ) { - ViaCardInfo* viac = screen->card->driver; - ViaScreenInfo* vias; - - vias = (ViaScreenInfo*) xalloc( sizeof( ViaScreenInfo ) ); - if( !vias ) return FALSE; - memset( vias, '\0', sizeof( ViaScreenInfo ) ); - - if( !vesaScreenInitialize( screen, &vias->vesa ) ) { - xfree( vias ); - return FALSE; - } - - /* - ** XXX: What does this do? - */ - if( !viac->mapBase ) - screen->dumb = TRUE; - if( vias->vesa.mapping != VESA_LINEAR ) - screen->dumb = TRUE; - - screen->driver = vias; - return TRUE; -} - -/* -** Bool viaInitScreen( ScreenPtr pScreen ) -** -** Description: -** High level screen initialization occurs here. We could register XV -** adaptors, etc, here. -** -** Arguments: -** pScreen X screen information -** -** Return: -** TRUE Initialization was successful, -** FALSE Initialization failed. -*/ -static Bool -viaInitScreen( ScreenPtr pScreen ) { - return vesaInitScreen( pScreen ); -} - -/* -** Bool viaFinishInitScreen -** -** Description: -** Finish up any high-level screen initialization. Per-Screen extension -** initialization can be done here. -** -** Arguments: -** pScreen X screen information -** -** Return: -** TRUE Initialization was successful. -** FALSE Initialization failed. -*/ -static Bool -viaFinishInitScreen( ScreenPtr pScreen ) { - return vesaFinishInitScreen( pScreen ); -} - -/* -** Bool viaCreateResources( ScreenPtr pScreen ) -** -** Description: -** Do any screen specific configuration. -** -** Arguments: -** pScreen X screen information -** -** Return: -** TRUE configuration was successful. -** FALSE configuration failed. -*/ -static Bool -viaCreateResources( ScreenPtr pScreen ) { - return vesaCreateResources( pScreen ); -} - -/* -** void viaPreserve( KdCardInfo* card ) -** -** Description: -** Save the current state of the chip, so that it can be restored by -** viaRestore at a later time. -** -** Arguments: -** card Information structure for the chip we want to preserve the -** state of. -** -** Return: -** None. -** -** See Also: -** viaRestore -*/ -static void -viaPreserve( KdCardInfo* card ) { - vesaPreserve( card ); -} - -/* -** void viaRestore( KdCardInfo* card ) -** -** Description: -** Restore the previous state of the chip, as saved by viaPreserve -** earlier. -** -** Arguments: -** card Information structure for the chip we want to restore the -** state of. -** -** Return: -** None. -** -** See Also: -** viaPreserve -*/ -static void viaRestore( KdCardInfo* card ) { - ViaCardInfo* viac = card->driver; - - viaResetMMIO( card, viac ); - vesaRestore( card ); -} - -/* -** Bool viaEnable( ScreenPtr pScreen ) -** -** Description: -** This is where we set the card up for drawing the specified screen, e.g.: -** set the mode and mmap the framebuffer. -** -** Arguments: -** pScreen X screen information -** -** Return: -** TRUE the screen was enabled -** FALSE the screen could not be enabled -*/ -static Bool -viaEnable( ScreenPtr pScreen ) { - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - - if( !vesaEnable( pScreen ) ) return FALSE; - - viaSetMMIO( pScreenPriv->card, viac ); - - if( !viac->mapBase ) { - ErrorF( "Could not map CLE266 graphics registers" ); - return FALSE; - } - - return TRUE; -} - -/* -** void viaDisable( ScreenPtr pScreen ) -** -** Description: -** Shut down drawing: save some state and unmap the framebuffer. -** -** Arguments: -** pScreen X screen information -** -** Return: -** None. -*/ -static void -viaDisable( ScreenPtr pScreen ) { - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - - viaResetMMIO( pScreenPriv->card, viac ); - vesaDisable( pScreen ); -} - -/* -** void viaScreenFini( KdScreenInfo* screen ) -** -** Description: -** Release memory and resources allocated by viaScreenInit. -** -** Arguments: -** screen Information structure for the screen to release. -** -** Return: -** None. -** -** See Also: -** viaScreenInit -*/ -static void -viaScreenFini( KdScreenInfo* screen ) { - ViaScreenInfo* vias = screen->driver; - - vesaScreenFini( screen ); - xfree( vias ); - screen->driver = 0; -} - -/* -** void viaCardFini( KdCardInfo* card ) -** -** Description: -** Release memory and resources allocated by viaCardInit. -** -** Arguments: -** card Information structure for the chip to release. -** -** Return: -** None. -** -** See Also: -** viaCardInit -*/ -static void -viaCardFini( KdCardInfo* card ) { - ViaCardInfo* viac = card->driver; - - viaUnmapReg( card, viac ); - vesaCardFini( card ); - xfree( viac ); -} - -/* -** void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ) -** -** Description: -** Map the card's registers, if they're not already -** mapped. -** -** Arguments: -** card generic chip information -** viac VIA-driver specific chip information -** -** Return: -** None. -*/ -void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ) { - if( !viac->mapBase ) viaMapReg( card, viac ); -} - -/* -** void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ) -** -** Description: -** Unmap chip's registers. -** -** Arguments: -** card generic chip information -** viac VIA-driver specific chip information -** -** Return: -** None. -*/ -void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ) { - viaUnmapReg( card, viac ); -} - -/* -** Bool viaMapReg( KdCardInfo* card, ViaCardInfo* viac ) -** -** Description: -** Map the chip's registers into our address space. -** -** Arguments: -** card the card information -** viac the VIA-driver specific card information -** -** Return: -** TRUE the registers were succesfully mapped -** FALSE the registers could not be mapped -*/ -Bool -viaMapReg( KdCardInfo* card, ViaCardInfo* viac ) { - viac->mapBase = (VOL8*) KdMapDevice( VIA_REG_BASE( card ), - VIA_REG_SIZE( card ) ); - - if( !viac->mapBase ) { - ErrorF( "Couldn't allocate viac->mapBase\n" ); - return FALSE; - } - - KdSetMappedMode( VIA_REG_BASE( card ), VIA_REG_SIZE( card ), - KD_MAPPED_MODE_REGISTERS ); - - /* - ** Enable extended IO space - */ - VGAOUT8( 0x3C4, 0x10 ); - VGAOUT8( 0x3C5, 0x01 ); - - return TRUE; -} - -/* -** void viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ) -** -** Description: -** Unmap the the chip's registers. -** -** Arguments: -** card the card information -** viac the VIA-driver specific card information -** -** Return: -** None. -*/ -void -viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ) { - if( !viac->mapBase ) return; - - KdResetMappedMode( VIA_REG_BASE( card ), VIA_REG_SIZE( card ), - KD_MAPPED_MODE_REGISTERS ); - KdUnmapDevice( (void*) viac->mapBase, VIA_REG_SIZE( card ) ); - viac->mapBase = 0; -} - -KdCardFuncs viaFuncs = { - viaCardInit, /* cardinit */ - viaScreenInit, /* scrinit */ - viaInitScreen, /* initScreen */ - viaFinishInitScreen, /* finishInitScreen */ - viaCreateResources, /* createRes */ - viaPreserve, /* preserve */ - viaEnable, /* enable */ - vesaDPMS, /* dpms */ - viaDisable, /* disable */ - viaRestore, /* restore */ - viaScreenFini, /* scrfini */ - viaCardFini, /* cardfini */ - - 0, /* initCursor */ - 0, /* enableCursor */ - 0, /* disableCursor */ - 0, /* finiCursor */ - 0, /* recolorCursor */ - - viaDrawInit, /* initAccel */ - viaDrawEnable, /* enableAccel */ - viaDrawDisable, /* disableAccel */ - viaDrawFini, /* finiAccel */ - - vesaGetColors, /* getColors */ - vesaPutColors, /* putColors */ -}; - diff --git a/hw/kdrive/via/via.h b/hw/kdrive/via/via.h deleted file mode 100644 index 00f40bc04..000000000 --- a/hw/kdrive/via/via.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright © 2004 Ralph Thomas - * - * 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 Ralph Thomas not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Ralph Thomas makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL RALPH THOMAS 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. - */ -/* -** VIA CLE266 driver -** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> -** -** http://www.viatech.com.tw/ -*/ - -#ifndef _VIA_H_ -#define _VIA_H_ - -#include <vesa.h> -#include <klinux.h> - -/* -** Define DebugF so that we can spot debug statements easily. -*/ -#define DebugF ErrorF - -typedef volatile CARD8 VOL8; -typedef volatile CARD16 VOL16; -typedef volatile CARD32 VOL32; - -/* -** These macros provide access to data on the card. The VIA graphics chips -** are only available on IA-32 architecture, so PCI address space and CPU -** address space are always the same (hence accesses can be performed by -** dereferencing a pointer into PCI space). -*/ -#define MMIO_OUT32( mmio, a, v ) (*(VOL32 *)((mmio) + (a)) = (v)) -#define MMIO_IN32( mmio, a ) (*(VOL32 *)((mmio) + (a))) -#define MMIO_OUT16( mmio, a, v ) (*(VOL16 *)((mmio) + (a)) = (v)) -#define MMIO_IN16( mmio, a ) (*(VOL16 *)((mmio) + (a))) -#define MMIO_OUT8( mmio, a, v ) (*(VOL8 *)((mmio) + (a)) = (v)) -#define MMIO_IN8( mmio, a, v ) (*(VOL8 *)((mmio) + (a))) - -/* -** VGA regisers are offset 0x8000 from the beginning of the mmap'd register -** space. -*/ -#define VIA_MMIO_VGABASE 0x8000 - -/* -** The size of the register space, used when we mmap the registers. The -** argument "c" should be a KdCardInfo*. -*/ -#define VIA_REG_SIZE(c) (0x9000) - -/* -** The base of the register space, used when we mmap the registers. The -** argument "c" should be a KdCardInfo*. -*/ -#define VIA_REG_BASE(c) ((c)->attr.address[1]) - -/* -** Access to the mmap'd VGA registers. The VGA registers are offset from the -** beginning of the 16M pci space by 0x8000. These macros get used just like -** outb/inb would be used to access VGA. -*/ -#define VGAOUT32( addr, v ) MMIO_OUT32( viac->mapBase + VIA_MMIO_VGABASE, addr, v ) -#define VGAIN32( addr ) MMIO_IN32( viac->mapBase + VIA_MMIO_VGABASE, addr ) -#define VGAOUT16( addr, v ) MMIO_OUT16( viac->mapBase + VIA_MMIO_VGABASE, addr, v ) -#define VGAIN16( addr ) MIIO_IN16( viac->mapBase + VIA_MMIO_VGABASE, addr ) -#define VGAOUT8( addr, v ) MMIO_OUT8( viac->mapBase + VIA_MMIO_VGABASE, addr, v ) -#define VGAIN8( addr ) MMIO_IN8( viac->mapBase + VIA_MMIO_VGABASE, addr ) - -/* -** Access to any of the registers on the chip. -*/ -#define OUTREG32( addr, v ) MMIO_OUT32( viac->mapBase, addr, v ) -#define INREG32( addr ) MMIO_IN32( viac->mapBase, addr ) -#define OUTREG16( addr, v ) MMIO_OUT16( viac->mapBase, addr, v ) -#define INREG16( addr ) MMIO_IN16( viac->mapBase, addr ) - -/* -** We keep all of our chip specific data in a ViaCardInfo. -*/ -typedef struct _viaCardInfo { - VesaCardPrivRec vesa; /* card info for VESA driver */ - VOL8* mapBase; /* mmap'd registers */ - CARD32 savedCommand; /* command to issue to GE */ - CARD32 savedFgColor; /* color to issue to GE */ -} ViaCardInfo; - -/* -** We keep all of our screen specific data in a ViaScreenInfo. -*/ -typedef struct _viaScreenInfo { - VesaScreenPrivRec vesa; - KaaScreenInfoRec kaa; -} ViaScreenInfo; - -/* -** These function prototypes are for support functions. More infomation on each -** function is available at the place the function is implemented, in via.c. -*/ -Bool viaMapReg( KdCardInfo* card, ViaCardInfo* viac ); -void viaUnmapReg( KdCardInfo* card, ViaCardInfo* viac ); -void viaSetMMIO( KdCardInfo* card, ViaCardInfo* viac ); -void viaResetMMIO( KdCardInfo* card, ViaCardInfo* viac ); - -/* -** The viaFuncs structure gets filled with the addresses of the functions -** that we use to talk to the graphics chip. -*/ -extern KdCardFuncs viaFuncs; - -#endif - diff --git a/hw/kdrive/via/via_regs.h b/hw/kdrive/via/via_regs.h deleted file mode 100644 index 2d8195d5d..000000000 --- a/hw/kdrive/via/via_regs.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. - * Copyright 2001-2003 S3 Graphics, 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, sub license, - * 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS 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. - */ - -/************************************************************************* - * - * File: via_regs.h - * Content: The defines of Via registers - * - ************************************************************************/ - -#ifndef _VIA_REGS_H_ -#define _VIA_REGS_H_ - -/* defines for VIA 2D registers */ -#define VIA_REG_GECMD 0x000 -#define VIA_REG_GEMODE 0x004 -#define VIA_REG_GESTATUS 0x004 /* as same as VIA_REG_GEMODE */ -#define VIA_REG_SRCPOS 0x008 -#define VIA_REG_DSTPOS 0x00C -#define VIA_REG_LINE_K1K2 0x008 -#define VIA_REG_LINE_XY 0x00C -#define VIA_REG_DIMENSION 0x010 /* width and height */ -#define VIA_REG_PATADDR 0x014 -#define VIA_REG_FGCOLOR 0x018 -#define VIA_REG_DSTCOLORKEY 0x018 /* as same as VIA_REG_FG */ -#define VIA_REG_BGCOLOR 0x01C -#define VIA_REG_SRCCOLORKEY 0x01C /* as same as VIA_REG_BG */ -#define VIA_REG_CLIPTL 0x020 /* top and left of clipping */ -#define VIA_REG_CLIPBR 0x024 /* bottom and right of clipping */ -#define VIA_REG_OFFSET 0x028 -#define VIA_REG_LINE_ERROR 0x028 -#define VIA_REG_KEYCONTROL 0x02C /* color key control */ -#define VIA_REG_SRCBASE 0x030 -#define VIA_REG_DSTBASE 0x034 -#define VIA_REG_PITCH 0x038 /* pitch of src and dst */ -#define VIA_REG_MONOPAT0 0x03C -#define VIA_REG_MONOPAT1 0x040 -#define VIA_REG_COLORPAT 0x100 /* from 0x100 to 0x1ff */ - - - -/* defines for VIA video registers */ -#define VIA_REG_INTERRUPT 0x200 -#define VIA_REG_CRTCSTART 0x214 - - -/* defines for VIA HW cursor registers */ -#define VIA_REG_CURSOR_MODE 0x2D0 -#define VIA_REG_CURSOR_POS 0x2D4 -#define VIA_REG_CURSOR_ORG 0x2D8 -#define VIA_REG_CURSOR_BG 0x2DC -#define VIA_REG_CURSOR_FG 0x2E0 - - -/* defines for VIA 3D registers */ -#define VIA_REG_STATUS 0x400 -#define VIA_REG_TRANSET 0x43C -#define VIA_REG_TRANSPACE 0x440 - -/* VIA_REG_STATUS(0x400): Engine Status */ -#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */ -#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */ -#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */ -#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */ -#define VIA_BUSY (VIA_CMD_RGTR_BUSY|VIA_2D_ENG_BUSY|VIA_3D_ENG_BUSY) - - -/* VIA_REG_GECMD(0x00): 2D Engine Command */ -#define VIA_GEC_NOOP 0x00000000 -#define VIA_GEC_BLT 0x00000001 -#define VIA_GEC_LINE 0x00000005 - -#define VIA_GEC_SRC_XY 0x00000000 -#define VIA_GEC_SRC_LINEAR 0x00000010 -#define VIA_GEC_DST_XY 0x00000000 -#define VIA_GEC_DST_LINRAT 0x00000020 - -#define VIA_GEC_SRC_FB 0x00000000 -#define VIA_GEC_SRC_SYS 0x00000040 -#define VIA_GEC_DST_FB 0x00000000 -#define VIA_GEC_DST_SYS 0x00000080 - -#define VIA_GEC_SRC_MONO 0x00000100 /* source is mono */ -#define VIA_GEC_PAT_MONO 0x00000200 /* pattern is mono */ - -#define VIA_GEC_MSRC_OPAQUE 0x00000000 /* mono src is opaque */ -#define VIA_GEC_MSRC_TRANS 0x00000400 /* mono src is transparent */ - -#define VIA_GEC_PAT_FB 0x00000000 /* pattern is in frame buffer */ -#define VIA_GEC_PAT_REG 0x00000800 /* pattern is from reg setting */ - -#define VIA_GEC_CLIP_DISABLE 0x00000000 -#define VIA_GEC_CLIP_ENABLE 0x00001000 - -#define VIA_GEC_FIXCOLOR_PAT 0x00002000 - -#define VIA_GEC_INCX 0x00000000 -#define VIA_GEC_DECY 0x00004000 -#define VIA_GEC_INCY 0x00000000 -#define VIA_GEC_DECX 0x00008000 - -#define VIA_GEC_MPAT_OPAQUE 0x00000000 /* mono pattern is opaque */ -#define VIA_GEC_MPAT_TRANS 0x00010000 /* mono pattern is transparent */ - -#define VIA_GEC_MONO_UNPACK 0x00000000 -#define VIA_GEC_MONO_PACK 0x00020000 -#define VIA_GEC_MONO_DWORD 0x00000000 -#define VIA_GEC_MONO_WORD 0x00040000 -#define VIA_GEC_MONO_BYTE 0x00080000 - -#define VIA_GEC_LASTPIXEL_ON 0x00000000 -#define VIA_GEC_LASTPIXEL_OFF 0x00100000 -#define VIA_GEC_X_MAJOR 0x00000000 -#define VIA_GEC_Y_MAJOR 0x00200000 -#define VIA_GEC_QUICK_START 0x00800000 - - -/* VIA_REG_GEMODE(0x04): GE mode */ -#define VIA_GEM_8bpp 0x00000000 -#define VIA_GEM_16bpp 0x00000100 -#define VIA_GEM_32bpp 0x00000300 - -#define VIA_GEM_640 0x00000000 /* 640*480 */ -#define VIA_GEM_800 0x00000400 /* 800*600 */ -#define VIA_GEM_1024 0x00000800 /* 1024*768 */ -#define VIA_GEM_1280 0x00000C00 /* 1280*1024 */ -#define VIA_GEM_1600 0x00001000 /* 1600*1200 */ -#define VIA_GEM_2048 0x00001400 /* 2048*1536 */ - -/* VIA_REG_PITCH(0x38): Pitch Setting */ -#define VIA_PITCH_ENABLE 0x80000000 - -#endif /* _VIA_REGS_H_ */ diff --git a/hw/kdrive/via/viadraw.c b/hw/kdrive/via/viadraw.c deleted file mode 100644 index a6544ee36..000000000 --- a/hw/kdrive/via/viadraw.c +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Copyright © 2004 Ralph Thomas - * - * 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 Ralph Thomas not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Ralph Thomas makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL RALPH THOMAS 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. - */ -/* -** VIA CLE266 driver -** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> -** -** http://www.viatech.com.tw/ -** -** This code is for accelerated drawing of solids and accelerated -** copies. Note that there is currently no software FIFO implemented, -** and no documentation on any hardware FIFO. -*/ - -#include "via.h" -#include "viadraw.h" -#include "via_regs.h" -#include <sched.h> -#include "kdrive.h" -#include "kaa.h" - -/* -** A global to contain card information between calls into this file. -** XXX: This is totally brain-damaged. Why don't I get the information -** I want in viaSolid/viaCopy/viaDoneXXX? -*/ -static ViaCardInfo* card; - -/* -** Translation table from GC raster operation values into ROP3 values -** that the VIA chip understands. -** -** viaPatternRop is used by viaPrepareSolid. -** viaCopyRop is used by viaPrepareCopy. -*/ -CARD8 viaPatternRop[16] = { - /* GXclear */ 0x00, /* ROP_0 0 */ - /* GXand */ 0xA0, /* ROP_DPa src AND dst */ - /* GXandReverse */ 0x50, /* ROP_PDna src AND NOT dst */ - /* GXcopy */ 0xF0, /* ROP_P src */ - /* GXandInverted*/ 0x0A, /* ROP_DPna NOT src AND dst */ - /* GXnoop */ 0xAA, /* ROP_D dst */ - /* GXxor */ 0x5A, /* ROP_DPx src XOR dst */ - /* GXor */ 0xFA, /* ROP_DPo src OR dst */ - /* GXnor */ 0x05, /* ROP_DPon NOT src AND NOT dst */ - /* GXequiv */ 0xA5, /* ROP_PDxn NOT src XOR dst */ - /* GXinvert */ 0x55, /* ROP_Dn NOT dst */ - /* GXorReverse */ 0xF5, /* ROP_PDno src OR NOT dst */ - /* GXcopyInverted*/ 0x0F, /* ROP_Pn NOT src */ - /* GXorInverted */ 0xAF, /* ROP_DPno NOT src OR dst */ - /* GXnand */ 0x5F, /* ROP_DPan NOT src OR NOT dst */ - /* GXset */ 0xFF, /* ROP_1 1 */ -}; - -CARD8 viaCopyRop[16] = { - /* GXclear */ 0x00, /* ROP_0 0 */ - /* GXand */ 0x88, /* ROP_DSa src AND dst */ - /* GXandReverse */ 0x44, /* ROP_SDna src AND NOT dst */ - /* GXcopy */ 0xCC, /* ROP_S src */ - /* GXandInverted*/ 0x22, /* ROP_DSna NOT src AND dst */ - /* GXnoop */ 0xAA, /* ROP_D dst */ - /* GXxor */ 0x66, /* ROP_DSx src XOR dst */ - /* GXor */ 0xEE, /* ROP_DSo src OR dst */ - /* GXnor */ 0x11, /* ROP_DSon NOT src AND NOT dst */ - /* GXequiv */ 0x99, /* ROP_DSxn NOT src XOR dst */ - /* GXinvert */ 0x55, /* ROP_Dn NOT dst */ - /* GXorReverse */ 0xDD, /* ROP_SDno src OR NOT dst */ - /* GXcopyInverted*/ 0x33, /* ROP_Sn NOT src */ - /* GXorInverted */ 0xBB, /* ROP_DSno NOT src OR dst */ - /* GXnand */ 0x77, /* ROP_DSan NOT src OR NOT dst */ - /* GXset */ 0xFF, /* ROP_1 1 */ -}; - -/* -** void viaWaitIdle( ViaCardInfo* viac ) -** -** Description: -** Block up the CPU while waiting for the last command sent to -** the chip to complete. As an experiment I'm going to try to -** yield my process to others instead of just tight looping. -** -** Arguments: -** viac VIA-driver specific chip information -** -** Return: -** None. -*/ -void -viaWaitIdle( ViaCardInfo* viac ) { - while( INREG32( VIA_REG_STATUS ) & VIA_BUSY ) - sched_yield(); -} - -/* -** void viaDrawSync( ScreenPtr pScreen, int marker ) -** -** Description: -** Block until the graphics chip has finished all outstanding drawing -** operations and the framebuffer contents is static. -** -** Arguments: -** pScreen Pointer to screen strucutre for the screen we're -** waiting for drawing to end on. -** -** Return: -** None. -*/ -static void -viaWaitMarker( ScreenPtr pScreen, int marker ) { - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - - viaWaitIdle( viac ); -} - - -/* -** Bool viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg ) -** -** Description: -** Decide if the specified solid fill operation can be accelerated or not, -** and if the fill can be accelerated, prepare the hardware for doing it. -** -** Arguments: -** pPixmap Pixmap to draw solid into. -** alu Raster operation to draw using, these are the same -** values which get set by XSetFunction(3X). See the -** Xlib PM p. 140 for a list of raster operations as -** well as descriptions. -** planemask This is the GC plane mask. We only copy bits which -** match the plane mask. -** fg The foreground pixel of the GC, the pixel to draw in. -** -** Return: -** TRUE This operation can be accelerated, call viaSolid to actually -** have it drawn. -** FALSE This operation cannot be accelerated, fall back to software. -** -** See Also: -** viaSolid - the function which actually draws the solid. -*/ -static Bool -viaPrepareSolid( PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg ) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - - /* - ** We don't accelerate when the plane mask is not everything. - */ - if( ~planeMask & FbFullMask( pPixmap->drawable.depth ) ) return FALSE; - - /* - ** Compose the command, then store the composed command and color - ** in the viac structure so that when viaSolid gets called we can - ** write them out. - */ - viac->savedCommand = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | - (viaPatternRop[alu] << 24); - viac->savedFgColor = fg; - - /* - ** Store pointer to chip information, due to brain-damaged KAA. - */ - card = viac; - - return TRUE; -} - -/* -** void viaSolid( int x1, int y1, int x2, int y2 ) -** -** Description: -** Perform a solid fill, using the data that was stored by viaPrepareSolid. -** -** Arguments: -** x1 x-coordinate of fill origin -** y1 y-coordinate of fill origin -** x2 x-coordinate of fill end point -** y2 y-coordinate of fill end point -** -** Return: -** None. -** -** See Also: -** viaPrepareSolid - the function that composes the GE command and saves -** the color for us. -*/ -static void -viaSolid( int x1, int y1, int x2, int y2 ) { - ViaCardInfo* viac = card; - int w = x2 - x1; int h = y2 - y1; - - if( !viac ) return; - if( !w || !h ) return; - - /* - ** Wait for the card to finish the current draw. - */ - viaWaitIdle( viac ); - - /* - ** Do the draw. - */ - OUTREG32( VIA_REG_DSTPOS, ((y1 << 16) | x1) ); - OUTREG32( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)) ); - OUTREG32( VIA_REG_FGCOLOR, viac->savedFgColor ); - OUTREG32( VIA_REG_GECMD, viac->savedCommand ); -} - -/* -** void viaDoneSolid -** -** Description: -** Finish up drawing of the solid. -** -** Arguments: -** None. -** -** Return: -** None. -*/ -static void -viaDoneSolid(void) { -} - -/* -** Bool viaPrepareCopy( PixmapPtr pSrcPixmap, PixmapPtr pDestPixmap, int dx, -** int dy, int alu, Pixel planeMask ) -** -** Description: -** Set up the VIA chip for a BitBlt. -** -** Arguments: -** pSrcPixmap the source pixmap to copy from -** pDestPixmap the destination pixmap to copy to -** dx direction of copy in x -** dy direction of copy in y -** alu Raster operation to draw using, these are the same -** values which get set by XSetFunction(3X). See the -** Xlib PM p. 140 for a list of raster operations as -** well as descriptions. -** planeMask This is the GC plane mask. We only copy bits which -** match the plane mask. -** -** Return: -** TRUE the requested copy operation can be accelerated using hardware, -** call viaCopy next. -** FALSE the requested copy operation cannot be accelerated using -** hardware - fallback to software. -** -** See Also: -** viaCopy - the function which does the actual copy. -*/ -static Bool -viaPrepareCopy( PixmapPtr pSrcPixmap, PixmapPtr pDestPixmap, int dx, int dy, - int alu, Pixel planeMask ) { - ScreenPtr pScreen = pDestPixmap->drawable.pScreen; - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - - /* - ** Don't accelerate when the plane mask is set. - */ - if( ~planeMask & FbFullMask( pDestPixmap->drawable.depth ) ) return FALSE; - - viac->savedCommand = VIA_GEC_BLT | (viaCopyRop[alu] << 24); - - if( dx < 0 ) viac->savedCommand |= VIA_GEC_DECX; - if( dy < 0 ) viac->savedCommand |= VIA_GEC_DECY; - - /* - ** Store pointer to chip structure, due to brain-damaged KAA. - */ - card = viac; - - return TRUE; -} - -/* -** void viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) -** -** Description: -** Perform a BitBlt from one screen area to another. -** -** Arguments: -** srcX source x-coordinate -** srcY source y-coordinate -** dstX destination x-coordinate -** dstY destination y-coordinate -** w width of area to copy (pixels) -** h height of area to copy (pixels) -** -** Return: -** None. -** -** See Also: -** viaPrepareCopy - the function which sets up for the copy. -*/ -static void -viaCopy( int srcX, int srcY, int dstX, int dstY, int w, int h ) { - ViaCardInfo* viac = card; - - if( !viac ) return; - if( !w | !h ) return; - - /* - ** XXX: Check these two "if"s out. - */ - if( viac->savedCommand & VIA_GEC_DECX ) { - srcX += ( w - 1 ); - dstX += ( w - 1 ); - } - - if( viac->savedCommand & VIA_GEC_DECY ) { - srcY += ( h - 1 ); - dstY += ( h - 1 ); - } - - OUTREG32( VIA_REG_SRCPOS, ((srcY << 16) | srcX) ); - OUTREG32( VIA_REG_DSTPOS, ((dstY << 16) | dstX) ); - OUTREG32( VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)) ); - OUTREG32( VIA_REG_GECMD, viac->savedCommand ); -} - -/* -** void viaDoneCopy() -** -** Description: -** Finish up the copy. -** -** Arguments: -** None. -** -** Return: -** None. -*/ -static void -viaDoneCopy(void) { -} - - -/* -** Bool viaDrawInit( ScreenPtr pScreen ) -** -** Description: -** Initialize the 2D acceleration hardware and register the KAA -** acceleration layer with the VIA acceleration functions (above). -** -** Arguments: -** pScreen Pointer to screen structure for the screen we're -** enabling acceleration on. -** -** Return: -** TRUE initialization and setup of KAA acceleration was successful. -** FALSE initialization and setup of KAA acceleration failed. -*/ -Bool -viaDrawInit( ScreenPtr pScreen ) { - KdScreenPriv( pScreen ); - ViaCardInfo* viac = pScreenPriv->card->driver; - ViaScreenInfo* vias = pScreenPriv->card->driver; - CARD32 geMode = 0; - - if( !viac ) return FALSE; - DebugF( "viac->mapBase = 0x%x\n", viac->mapBase ); - - /* - ** We reset the 2D engine to a known state by setting all of it's - ** registers to zero. - */ - OUTREG32( VIA_REG_GEMODE, 0x0 ); - OUTREG32( VIA_REG_SRCPOS, 0x0 ); - OUTREG32( VIA_REG_DSTPOS, 0x0 ); - OUTREG32( VIA_REG_DIMENSION, 0x0 ); - OUTREG32( VIA_REG_PATADDR, 0x0 ); - OUTREG32( VIA_REG_FGCOLOR, 0x0 ); - OUTREG32( VIA_REG_BGCOLOR, 0x0 ); - OUTREG32( VIA_REG_CLIPTL, 0x0 ); - OUTREG32( VIA_REG_CLIPBR, 0x0 ); - OUTREG32( VIA_REG_OFFSET, 0x0 ); - OUTREG32( VIA_REG_KEYCONTROL, 0x0 ); - OUTREG32( VIA_REG_SRCBASE, 0x0 ); - OUTREG32( VIA_REG_DSTBASE, 0x0 ); - OUTREG32( VIA_REG_PITCH, 0x0 ); - OUTREG32( VIA_REG_MONOPAT0, 0x0 ); - OUTREG32( VIA_REG_MONOPAT1, 0x0 ); - - /* - ** Set the GE mode up. - ** XXX: What happens in 24bpp mode? - */ - switch( pScreenPriv->screen->fb[0].bitsPerPixel ) { - case 16: - geMode = VIA_GEM_16bpp; - break; - case 32: - geMode = VIA_GEM_32bpp; - break; - default: - geMode = VIA_GEM_8bpp; - break; - } - - OUTREG32( VIA_REG_GEMODE, geMode ); - - /* - ** Set the source and destination base addresses, and set pitch. - */ - OUTREG32( VIA_REG_SRCBASE, 0x0 ); - OUTREG32( VIA_REG_DSTBASE, 0x0 ); - OUTREG32( VIA_REG_PITCH, VIA_PITCH_ENABLE | - ((pScreen->width * pScreenPriv->screen->fb[0].bitsPerPixel >> 3) >> 3) | - (((pScreen->width * pScreenPriv->screen->fb[0].bitsPerPixel >> 3) >> 3) << 16)); - - DebugF( "Initialized 2D engine!\n" ); - - memset(&vias->kaa, 0, sizeof(KaaScreenInfoRec)); - vias->kaa.waitMarker = viaWaitMarker; - vias->kaa.PrepareSolid = viaPrepareSolid; - vias->kaa.Solid = viaSolid; - vias->kaa.DoneSolid = viaDoneSolid; - vias->kaa.PrepareCopy = viaPrepareCopy; - vias->kaa.Copy = viaCopy; - vias->kaa.DoneCopy = viaDoneCopy; - - return kaaDrawInit( pScreen, &vias->kaa ); -} - -/* -** void viaDrawEnable( ScreenPtr pScreen ) -** -** Description: -** Enable accelerated drawing on the specified screen. -** -** Arguments: -** pScreen Pointer to screen structure for the screen we're -** enabling acceleration on. -** -** Return: -** None. -*/ -void -viaDrawEnable( ScreenPtr pScreen ) { - kaaMarkSync( pScreen ); -} - -/* -** void viaDrawDisable( ScreenPtr pScreen ) -** -** Description: -** Disable accelerated drawing to the specified screen. -** -** Arguments: -** pScreen Pointer to screen structure for the screen we're -** disabling acceleration on. -** -** Return: -** None -*/ -void -viaDrawDisable( ScreenPtr pScreen ) { -} - -/* -** void viaDrawFini( ScreenPtr pScreen ) -** -** Description: -** Shutdown accelerated drawing and free associated strucures and -** resources. -** -** Arguments: -** pScreen Pointer to screen structure for the screen we're -** disabling acceleration on. -** -** Return: -** None. -*/ -void -viaDrawFini( ScreenPtr pScreen ) { -} diff --git a/hw/kdrive/via/viadraw.h b/hw/kdrive/via/viadraw.h deleted file mode 100644 index 404923053..000000000 --- a/hw/kdrive/via/viadraw.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright © 2004 Ralph Thomas - * - * 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 Ralph Thomas not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Ralph Thomas makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL RALPH THOMAS 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. - */ -/* -** VIA CLE266 driver -** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> -** -** http://www.viatech.com.tw/ -** -** This header has some function prototypes for the hardware -** accelerated drawing code in viadraw.c. -*/ - -#ifndef _VIA_DRAW_H_ -#define _VIA_DRAW_H_ - -/* -** More information on these functions is in viadraw.c. -*/ -void viaWaitIdle( ViaCardInfo* card ); -Bool viaDrawInit( ScreenPtr pScreen ); -void viaDrawEnable( ScreenPtr pScreen ); -void viaDrawDisable( ScreenPtr pScreen ); -void viaDrawFini( ScreenPtr pScreen ); -void viaDrawSync( ScreenPtr pScreen ); - -#endif diff --git a/hw/kdrive/via/viastub.c b/hw/kdrive/via/viastub.c deleted file mode 100644 index 1439010a9..000000000 --- a/hw/kdrive/via/viastub.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright © 2004 Ralph Thomas - * - * 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 Ralph Thomas not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Ralph Thomas makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * RALPH THOMAS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL RALPH THOMAS 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. - */ -/* -** VIA CLE266 driver -** Copyright 2004 (C) Ralph Thomas <ralpht@gmail.com> -** -** http://www.viatech.com.tw/ -** -** This is the stub code which links the VIA drawing code into the kdrive -** framework. -*/ - -#include "via.h" -#include <klinux.h> - -/* -** void InitCard( char* name ) -** -** Description: -** Initialize the graphics chip. We find the chip on the PCI bus, -** register the functions to access the chip. -** -** Arguments: -** name XXX: unknown. -** -** Return: -** None. -*/ -void -InitCard( char* name ) { - KdCardAttr attr; - - if( LinuxFindPci( 0x1106, 0x3122, 0, &attr ) ) - KdCardInfoAdd( &viaFuncs, &attr, 0 ); -} - -/* -** void InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv ) -** -** Description: -** Initialize I/O, or something. XXX: Or what? -** -** Arguments: -** pScreenInfo XXX -** argc command line argument count -** argv command line arguments -** -** Return: -** None. -*/ -void -InitOutput( ScreenInfo* pScreenInfo, int argc, char** argv ) { - KdInitOutput( pScreenInfo, argc, argv ); -} - -/* -** void InitInput( int argc, char** argv ) -** -** Description: -** Initialize keyboard and mouse input. -** -** Arguments: -** argc command line argument count -** argv command line arguments -** -** Return: -** None. -*/ -void -InitInput( int argc, char** argv ) { - KdOsAddInputDrivers(); - KdInitInput(); -} - -/* -** void ddxUseMsg() -** -** Description: -** Print the usage message for Xvia. -** -** Arguments: -** None. -** -** Return: -** None. -*/ -void -ddxUseMsg() { - KdUseMsg(); - vesaUseMsg(); -} - - -/* -** int ddxProcessArgument( int argc, char** argv, int i ) -** -** Description: -** Process a single command line argument. -** -** Arguments: -** argc command line argument count -** argv command line arguments -** i number of argument to process -** -** Return: -** some values. -*/ -int -ddxProcessArgument( int argc, char** argv, int i ) { - int ret; - - if( !( ret = vesaProcessArgument( argc, argv, i ) )) - ret = KdProcessArgument( argc, argv, i ); - return ret; -} - diff --git a/hw/kdrive/vxworks/vxkbd.c b/hw/kdrive/vxworks/vxkbd.c deleted file mode 100644 index ac83ef729..000000000 --- a/hw/kdrive/vxworks/vxkbd.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright © 1999 Network Computing Devices, Inc. All rights reserved. - * - * Author: Keith Packard - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include "kkeymap.h" -#include <X11/keysym.h> -#include <inputstr.h> - -#define VXWORKS_WIDTH 2 - -KeySym VxWorksKeymap[] = { -/*7 f1 */ XK_F1, NoSymbol, -/*8 escape */ XK_Escape, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, -/*13 tab */ XK_Tab, NoSymbol, -/*14 ` */ XK_grave, XK_asciitilde, -/*15 f2 */ XK_F2, NoSymbol, - NoSymbol, NoSymbol, -/*17 lctrl */ XK_Control_L, NoSymbol, -/*18 lshift */ XK_Shift_L, NoSymbol, - NoSymbol, NoSymbol, -/*20 lock */ XK_Caps_Lock, NoSymbol, -/*21 q */ XK_Q, NoSymbol, -/*22 1 */ XK_1, XK_exclam, -/*23 f3 */ XK_F3, NoSymbol, - NoSymbol, NoSymbol, -/*25 lalt */ XK_Meta_L, XK_Alt_L, -/*26 z */ XK_Z, NoSymbol, -/*27 s */ XK_S, NoSymbol, -/*28 a */ XK_A, NoSymbol, -/*29 w */ XK_W, NoSymbol, -/*30 2 */ XK_2, XK_at, -/*31 f4 */ XK_F4, NoSymbol, - NoSymbol, NoSymbol, -/*33 c */ XK_C, NoSymbol, -/*34 x */ XK_X, NoSymbol, -/*35 d */ XK_D, NoSymbol, -/*36 e */ XK_E, NoSymbol, -/*37 4 */ XK_4, XK_dollar, -/*38 3 */ XK_3, XK_numbersign, -/*39 f5 */ XK_F5, NoSymbol, - NoSymbol, NoSymbol, -/*41 space */ XK_space, NoSymbol, -/*42 v */ XK_V, NoSymbol, -/*43 f */ XK_F, NoSymbol, -/*44 t */ XK_T, NoSymbol, -/*45 r */ XK_R, NoSymbol, -/*46 5 */ XK_5, XK_percent, -/*47 f6 */ XK_F6, NoSymbol, - NoSymbol, NoSymbol, -/*49 n */ XK_N, NoSymbol, -/*50 b */ XK_B, NoSymbol, -/*51 h */ XK_H, NoSymbol, -/*52 g */ XK_G, NoSymbol, -/*53 y */ XK_Y, NoSymbol, -/*54 6 */ XK_6, XK_asciicircum, -/*55 f7 */ XK_F7, NoSymbol, - NoSymbol, NoSymbol, -/*57 ralt */ XK_Meta_R, XK_Alt_R, -/*58 m */ XK_M, NoSymbol, -/*59 j */ XK_J, NoSymbol, -/*60 u */ XK_U, NoSymbol, -/*61 7 */ XK_7, XK_ampersand, -/*62 8 */ XK_8, XK_asterisk, -/*63 f8 */ XK_F8, NoSymbol, - NoSymbol, NoSymbol, -/*65 , */ XK_comma, XK_less, -/*66 k */ XK_K, NoSymbol, -/*67 i */ XK_I, NoSymbol, -/*68 o */ XK_O, NoSymbol, -/*69 0 */ XK_0, XK_parenright, -/*70 9 */ XK_9, XK_parenleft, -/*71 f9 */ XK_F9, NoSymbol, - NoSymbol, NoSymbol, -/*73 . */ XK_period, XK_greater, -/*74 / */ XK_slash, XK_question, -/*75 l */ XK_L, NoSymbol, -/*76 ; */ XK_semicolon, XK_colon, -/*77 p */ XK_P, NoSymbol, -/*78 - */ XK_minus, XK_underscore, -/*79 f10 */ XK_F10, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, -/*82 ' */ XK_apostrophe, XK_quotedbl, - NoSymbol, NoSymbol, -/*84 [ */ XK_bracketleft, XK_braceleft, -/*85 = */ XK_equal, XK_plus, -/*86 f11 */ XK_F11, NoSymbol, -/*87 sysrq */ XK_Sys_Req, XK_Print, -/*88 rctrl */ XK_Control_R, NoSymbol, -/*89 rshift */ XK_Shift_R, NoSymbol, -/*90 enter */ XK_Return, NoSymbol, -/*91 ] */ XK_bracketright, XK_braceright, -/*92 \ */ XK_backslash, XK_bar, - NoSymbol, NoSymbol, -/*94 f12 */ XK_F12, NoSymbol, -/*95 scrolllock*/ XK_Scroll_Lock, NoSymbol, -/*96 down */ XK_Down, NoSymbol, -/*97 left */ XK_Left, NoSymbol, -/*98 pause */ XK_Break, XK_Pause, -/*99 up */ XK_Up, NoSymbol, -/*100 delete */ XK_Delete, NoSymbol, -/*101 end */ XK_End, NoSymbol, -/*102 bs */ XK_BackSpace, NoSymbol, -/*103 insert */ XK_Insert, NoSymbol, - NoSymbol, NoSymbol, -/*105 np 1 */ XK_KP_End, XK_KP_1, -/*106 right */ XK_Right, NoSymbol, -/*107 np 4 */ XK_KP_Left, XK_KP_4, -/*108 np 7 */ XK_KP_Home, XK_KP_7, -/*109 pgdn */ XK_Page_Down, NoSymbol, -/*110 home */ XK_Home, NoSymbol, -/*111 pgup */ XK_Page_Up, NoSymbol, -/*112 np 0 */ XK_KP_Insert, XK_KP_0, -/*113 np . */ XK_KP_Delete, XK_KP_Decimal, -/*114 np 2 */ XK_KP_Down, XK_KP_2, -/*115 np 5 */ XK_KP_5, NoSymbol, -/*116 np 6 */ XK_KP_Right, XK_KP_6, -/*117 np 8 */ XK_KP_Up, XK_KP_8, -/*118 numlock */ XK_Num_Lock, NoSymbol, -/*119 np / */ XK_KP_Divide, NoSymbol, - NoSymbol, NoSymbol, -/*121 np enter */ XK_KP_Enter, NoSymbol, -/*122 np 3 */ XK_KP_Page_Down, XK_KP_3, - NoSymbol, NoSymbol, -/*124 np + */ XK_KP_Add, NoSymbol, -/*125 np 9 */ XK_KP_Page_Up, XK_KP_9, -/*126 np * */ XK_KP_Multiply, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, -/*132 np - */ XK_KP_Subtract, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, - NoSymbol, NoSymbol, -/*139 lwin */ XK_Super_L, NoSymbol, -/*140 rwin */ XK_Super_R, NoSymbol, -/*141 menu */ XK_Menu, NoSymbol, -}; - -void -VxWorksKeyboardLoad (void) -{ - KeySym *k; - - kdMinScanCode = 7; - kdKeymapWidth = VXWORKS_WIDTH; - kdMaxScanCode = 141; - memcpy (kdKeymap, VxWorksKeymap, sizeof (VxWorksKeymap)); -} - -static int kbdFd = -1; - -#include <errno.h> -#include <event.h> -#include <kbd_ioctl.h> - -extern KeyboardCtrl defaultKeyboardControl; - -static void -VxWorksSetAutorepeat (unsigned char *repeats, Bool on) -{ - int i; - unsigned char mask; - int scan_code; - int key_code; - unsigned char realkc; - - if (on) - { - realkc = 1; - ioctl (kbdFd, KBD_ALL_REPEAT, &realkc); - for (scan_code = 7; scan_code <= 141; scan_code++) - { - key_code = scan_code + 1; - i = key_code >> 3; - mask = 1 << (key_code & 7); - if ((repeats[i] & mask) == 0) - { - realkc = scan_code; - ioctl (kbdFd, KBD_NO_REPEAT, &realkc); - } - } - } - else - { - realkc = 0; - ioctl (kbdFd, KBD_ALL_REPEAT, &realkc); - } -} - -int -VxWorksKeyboardInit (void) -{ - - kbdFd = open ("/dev/kbd", O_RDONLY, 0); - if (kbdFd < 0) - ErrorF ("keyboard open failure %d\n", errno); - VxWorksSetAutorepeat (defaultKeyboardControl.autoRepeats, TRUE); - return -1; -} - -void -VxWorksKeyboardFini (int fd) -{ - if (kbdFd >= 0) - { - close (kbdFd); - kbdFd = -1; - } -} - -void -VxWorksKeyboardRead (int fd) -{ -} - -void -VxWorksKeyboardLeds (int leds) -{ - DeviceIntPtr pKeyboard = inputInfo.keyboard; - KeyboardCtrl *ctrl = &pKeyboard->kbdfeed->ctrl; - led_ioctl_info led_info; - int i; - - VxWorksSetAutorepeat (ctrl->autoRepeats, ctrl->autoRepeat); - for (i = 0; i < 3; i++) - { - led_info.bit_n = 1 << i; - led_info.OFF_or_ON = (leds & (1 << i)) != 0; - led_info.reversed = 0; - ioctl (kbdFd, KBD_SET_LED, &led_info); - } -} - -void -VxWorksKeyboardBell (int volume, int frequency, int duration) -{ -} - -KdKeyboardFuncs VxWorksKeyboardFuncs = { - VxWorksKeyboardLoad, - VxWorksKeyboardInit, - VxWorksKeyboardRead, - VxWorksKeyboardLeds, - VxWorksKeyboardBell, - VxWorksKeyboardFini, - 3, -}; diff --git a/hw/kdrive/vxworks/vxmouse.c b/hw/kdrive/vxworks/vxmouse.c deleted file mode 100644 index 8192d7e5a..000000000 --- a/hw/kdrive/vxworks/vxmouse.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright © 1999 Network Computing Devices, Inc. All rights reserved. - * - * Author: Keith Packard - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#define NEED_EVENTS -#include <X11/X.h> -#include <X11/Xproto.h> -#include "inputstr.h" -#include "scrnintstr.h" -#include "kdrive.h" -#include "Xpoll.h" -#include <event.h> -#include <smem.h> - -static unsigned long mouseState; - -#define BUTTON1 0x01 -#define BUTTON2 0x02 -#define BUTTON3 0x04 - -#include <errno.h> - -static int mouseFd = -1; - -static eventqueue *eventQueue; - -void -VxMouseRead (int mousePort) -{ - Event ev; - int dx, dy; - unsigned long flags; - unsigned long mask; - int n; - - while (eventQueue->head != eventQueue->tail) - { - ev = *eventQueue->head; - if (eventQueue->head >= &eventQueue->events[eventQueue->size-1]) - eventQueue->head = &eventQueue->events[0]; - else - eventQueue->head++; - switch (ev.e_type) { - case E_BUTTON: - switch (ev.e_device) { - case E_MOUSE: - switch (ev.e_key) { - case BUTTON1: - mask = KD_BUTTON_1; - break; - case BUTTON2: - mask = KD_BUTTON_2; - break; - case BUTTON3: - mask = KD_BUTTON_3; - break; - default: - mask = 0; - break; - } - if (ev.e_direction == E_KBUP) - mouseState &= ~mask; - else - mouseState |= mask; - KdEnqueueMouseEvent (mouseState | KD_MOUSE_DELTA, 0, 0); - break; - case E_DKB: - KdEnqueueKeyboardEvent (ev.e_key, ev.e_direction == E_KBUP); - break; - } - break; - case E_MMOTION: - KdEnqueueMouseEvent (mouseState | KD_MOUSE_DELTA, - ev.e_x, ev.e_y); - break; - } - } -} - -int -VxMouseInit (void) -{ - int mousePort; - unsigned long ev_size; - - mouseState = 0; - mousePort = open ("/dev/xdev", O_RDONLY, 0); - if (mousePort < 0) - ErrorF ("event port open failure %d\n", errno); - mouseFd = open ("/dev/mouse", O_RDONLY, 0); - if (mouseFd < 0) - ErrorF ("mouse open failure %d\n", errno); - if (eventQueue == 0) - { - ioctl (mousePort, EVENT_QUEUE_SMSIZE, &ev_size); - eventQueue = (eventqueue *) smem_get ("event", ev_size, (SM_READ|SM_WRITE)); - } - return mousePort; -} - -void -VxMouseFini (int mousePort) -{ - if (mousePort >= 0) - close (mousePort); - if (mouseFd >= 0) - { - close (mouseFd); - mouseFd = -1; - } -} - -KdMouseFuncs VxWorksMouseFuncs = { - VxMouseInit, - VxMouseRead, - VxMouseFini -}; diff --git a/hw/kdrive/vxworks/vxworks.c b/hw/kdrive/vxworks/vxworks.c deleted file mode 100644 index c9e2be7cc..000000000 --- a/hw/kdrive/vxworks/vxworks.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 1999 Network Computing Devices, Inc. All rights reserved. - * - * Author: Keith Packard - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" -#include <X11/keysym.h> - -Bool -VxWorksSpecialKey (KeySym sym) -{ - switch (sym) { - case XK_Sys_Req: - download(1, "setup", 0); - return TRUE; - case XK_Break: - download(1, "launcher", 0); - return TRUE; - } - return FALSE; -} - -void -KdOsAddInputDrivers (void) -{ - KdAddPointerDriver(&VxWorksMouseDriver); - KdAddPointerDriver(&VxWorksKeyboardDriver); -} - -KdOsFuncs VxWorksFuncs = { - .SpecialKey = VxWorksSpecialKey, -}; - -void -OsVendorInit (void) -{ - KdOsInit (&VxWorksFuncs); -} diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 0f44075ba..c4be599f1 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -25,6 +25,7 @@ MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES) cat $(MODEDEFSOURCES) | $(AWK) -f $(srcdir)/modeline2c.awk > $@ + echo >> $@ BUILT_SOURCES = xf86DefModeSet.c diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index ce899d854..6dec8d271 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -628,10 +628,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* * Locate bus slot that had register IO enabled at server startup */ - - xf86AccessInit(); - xf86FindPrimaryDevice(); - + if (xorgHWAccess) { + xf86AccessInit(); + xf86FindPrimaryDevice(); + } /* * Now call each of the Probe functions. Each successful probe will * result in an extra entry added to the xf86Screens[] list for each @@ -1180,9 +1180,6 @@ OsVendorInit() signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ #endif OsDelayInitColors = TRUE; -#ifndef BUILTIN_FONTS - loadableFonts = TRUE; -#endif if (!beenHere) xf86LogInit(); diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index a1f67486f..4d514226e 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -310,12 +310,12 @@ fbdev_open_pci(struct pci_device * pPci, char **namep) /* There are two ways to that we can determine which fb device is * associated with this PCI device. The more modern way is to look in * the sysfs directory for the PCI device for a file named - * "graphics:fb*" + * "graphics/fb*" */ for (i = 0; i < 8; i++) { sprintf(filename, - "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d", + "/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics/fb%d", pPci->domain, pPci->bus, pPci->dev, pPci->func, i); fd = open(filename, O_RDONLY, 0); diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 8c2b24786..41ac2f6e0 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1137,10 +1137,10 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation); break; case OPTION_ABOVE: - output->initial_y -= xf86ModeHeight (modes[o], relative->initial_rotation); + output->initial_y -= xf86ModeHeight (modes[o], output->initial_rotation); break; case OPTION_LEFT_OF: - output->initial_x -= xf86ModeWidth (modes[o], relative->initial_rotation); + output->initial_x -= xf86ModeWidth (modes[o], output->initial_rotation); break; default: break; @@ -1300,6 +1300,50 @@ preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output) return preferred_mode; } +static void +GuessRangeFromModes(MonPtr mon, DisplayModePtr mode) +{ + if (!mon || !mode) + return; + + mon->nHsync = 1; + mon->hsync[0].lo = 1024.0; + mon->hsync[0].hi = 0.0; + + mon->nVrefresh = 1; + mon->vrefresh[0].lo = 1024.0; + mon->vrefresh[0].hi = 0.0; + + while (mode) { + if (!mode->HSync) + mode->HSync = ((float) mode->Clock ) / ((float) mode->HTotal); + + if (!mode->VRefresh) + mode->VRefresh = (1000.0 * ((float) mode->Clock)) / + ((float) (mode->HTotal * mode->VTotal)); + + if (mode->HSync < mon->hsync[0].lo) + mon->hsync[0].lo = mode->HSync; + + if (mode->HSync > mon->hsync[0].hi) + mon->hsync[0].hi = mode->HSync; + + if (mode->VRefresh < mon->vrefresh[0].lo) + mon->vrefresh[0].lo = mode->VRefresh; + + if (mode->VRefresh > mon->vrefresh[0].hi) + mon->vrefresh[0].hi = mode->VRefresh; + + mode = mode->next; + } + + /* stretch out the bottom to fit 640x480@60 */ + if (mon->hsync[0].lo > 31.0) + mon->hsync[0].lo = 31.0; + if (mon->vrefresh[0].lo > 58.0) + mon->vrefresh[0].lo = 58.0; +} + _X_EXPORT void xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) { @@ -1417,6 +1461,10 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) OPTUNITS_KHZ, &clock)) max_clock = (int) clock; + /* If we still don't have a sync range, guess wildly */ + if (!mon_rec.nHsync || !mon_rec.nVrefresh) + GuessRangeFromModes(&mon_rec, output_modes); + /* * These limits will end up setting a 1024x768@60Hz mode by default, * which seems like a fairly good mode to use when nothing else is @@ -1436,7 +1484,14 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) } default_modes = xf86GetDefaultModes (output->interlaceAllowed, output->doubleScanAllowed); - + + /* + * If this is not an RB monitor, remove RB modes from the default + * pool. RB modes from the config or the monitor itself are fine. + */ + if (!mon_rec.reducedblanking) + xf86ValidateModesReducedBlanking (scrn, default_modes); + if (sync_source == sync_config) { /* @@ -1545,7 +1600,98 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y); -_X_EXPORT void +static DisplayModePtr +biggestMode(DisplayModePtr a, DisplayModePtr b) +{ + int A, B; + + if (!a) + return b; + if (!b) + return a; + + A = a->HDisplay * a->VDisplay; + B = b->HDisplay * b->VDisplay; + + if (A > B) + return a; + + return b; +} + +static xf86OutputPtr +SetCompatOutput(xf86CrtcConfigPtr config) +{ + xf86OutputPtr output = NULL, test = NULL; + DisplayModePtr maxmode = NULL, testmode, mode; + int o, compat = -1, count, mincount = 0; + + /* Look for one that's definitely connected */ + for (o = 0; o < config->num_output; o++) + { + test = config->output[o]; + if (!test->crtc) + continue; + if (test->status != XF86OutputStatusConnected) + continue; + if (!test->probed_modes) + continue; + + testmode = mode = test->probed_modes; + for (count = 0; mode; mode = mode->next, count++) + testmode = biggestMode(testmode, mode); + + if (!output) { + output = test; + compat = o; + maxmode = testmode; + mincount = count; + } else if (maxmode == biggestMode(maxmode, testmode)) { + output = test; + compat = o; + maxmode = testmode; + mincount = count; + } else if ((maxmode->HDisplay == testmode->HDisplay) && + (maxmode->VDisplay == testmode->VDisplay) && + count <= mincount) { + output = test; + compat = o; + maxmode = testmode; + mincount = count; + } + } + + /* If we didn't find one, take anything we can get */ + if (!output) + { + for (o = 0; o < config->num_output; o++) + { + test = config->output[o]; + if (!test->crtc) + continue; + if (!test->probed_modes) + continue; + + if (!output) { + output = test; + compat = o; + } else if (test->probed_modes->HDisplay < output->probed_modes->HDisplay) { + output = test; + compat = o; + } + } + } + + if (compat >= 0) { + config->compat_output = compat; + } else { + /* Don't change the compat output when no valid outputs found */ + output = config->output[config->compat_output]; + } + + return output; +} + xf86SetScrnInfoModes (ScrnInfoPtr scrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); @@ -1553,23 +1699,11 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) xf86CrtcPtr crtc; DisplayModePtr last, mode; - output = config->output[config->compat_output]; - if (!output->crtc) - { - int o; + output = SetCompatOutput(config); + + if (!output) + return; /* punt */ - output = NULL; - for (o = 0; o < config->num_output; o++) - if (config->output[o]->crtc) - { - config->compat_output = o; - output = config->output[o]; - break; - } - /* no outputs are active, punt and leave things as they are */ - if (!output) - return; - } crtc = output->crtc; /* Clear any existing modes from scrn->modes */ @@ -1633,46 +1767,65 @@ nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index) } static Bool -xf86TargetExact(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, - DisplayModePtr *modes, Bool *enabled, - int width, int height) +xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + DisplayModePtr *modes, Bool *enabled, + int width, int height) { - int o; - int pref_width = 0, pref_height = 0; - DisplayModePtr *preferred; + int o, p; + int max_pref_width = 0, max_pref_height = 0; + DisplayModePtr *preferred, *preferred_match; Bool ret = FALSE; preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr)); + preferred_match = xnfcalloc(config->num_output, sizeof(DisplayModePtr)); + + /* Check if the preferred mode is available on all outputs */ + for (p = -1; nextEnabledOutput(config, enabled, &p); ) { + Rotation r = config->output[p]->initial_rotation; + DisplayModePtr mode; + if ((preferred[p] = xf86OutputHasPreferredMode(config->output[p], + width, height))) { + int pref_width = xf86ModeWidth(preferred[p], r); + int pref_height = xf86ModeHeight(preferred[p], r); + Bool all_match = TRUE; + + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + Bool match = FALSE; + xf86OutputPtr output = config->output[o]; + if (o == p) + continue; - /* Find all the preferred modes; fail if any outputs lack them */ - for (o = -1; nextEnabledOutput(config, enabled, &o); ) { - preferred[o] = - xf86OutputHasPreferredMode(config->output[o], width, height); + for (mode = output->probed_modes; mode; mode = mode->next) { + Rotation r = output->initial_rotation; + if (xf86ModeWidth(mode, r) == pref_width && + xf86ModeHeight(mode, r) == pref_height) { + preferred[o] = mode; + match = TRUE; + } + } - if (!preferred[o]) - goto out; - } + all_match &= match; + } - /* check that they're all the same size */ - for (o = -1; nextEnabledOutput(config, enabled, &o); ) { - Rotation r = config->output[o]->initial_rotation; - if (!pref_width) { - pref_width = xf86ModeWidth(preferred[o], r); - pref_height = xf86ModeHeight(preferred[o], r); - } else { - if (pref_width != xf86ModeWidth(preferred[o], r)) - goto out; - if (pref_height != xf86ModeHeight(preferred[o], r)) - goto out; + if (all_match && + (pref_width*pref_height > max_pref_width*max_pref_height)) { + for (o = -1; nextEnabledOutput(config, enabled, &o); ) + preferred_match[o] = preferred[o]; + max_pref_width = pref_width; + max_pref_height = pref_height; + ret = TRUE; + } } } - /* oh good, they match. stash the selected modes and return. */ - memcpy(modes, preferred, config->num_output * sizeof(DisplayModePtr)); - ret = TRUE; + if (ret) { + /* oh good, there is a match. stash the selected modes and return. */ + memcpy(modes, preferred_match, + config->num_output * sizeof(DisplayModePtr)); + } -out: xfree(preferred); + xfree(preferred_match); return ret; } @@ -1734,25 +1887,6 @@ bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect) return match; } -static DisplayModePtr -biggestMode(DisplayModePtr a, DisplayModePtr b) -{ - int A, B; - - if (!a) - return b; - if (!b) - return a; - - A = a->HDisplay * a->VDisplay; - B = b->HDisplay * b->VDisplay; - - if (A > B) - return a; - - return b; -} - static Bool xf86TargetAspect(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, DisplayModePtr *modes, Bool *enabled, @@ -1917,7 +2051,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) if (xf86TargetUserpref(scrn, config, modes, enabled, width, height)) xf86DrvMsg(i, X_INFO, "Using user preference for initial modes\n"); - else if (xf86TargetExact(scrn, config, modes, enabled, width, height)) + else if (xf86TargetPreferred(scrn, config, modes, enabled, width, height)) xf86DrvMsg(i, X_INFO, "Using exact sizes for initial modes\n"); else if (xf86TargetAspect(scrn, config, modes, enabled, width, height)) xf86DrvMsg(i, X_INFO, "Using fuzzy aspect match for initial modes\n"); @@ -1989,6 +2123,8 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) crtc->x = output->initial_x; crtc->y = output->initial_y; output->crtc = crtc; + } else { + output->crtc = NULL; } } @@ -2115,6 +2251,10 @@ xf86SetDesiredModes (ScrnInfoPtr scrn) xf86OutputPtr output = NULL; int o; + /* Skip disabled CRTCs */ + if (!crtc->enabled) + continue; + if (config->output[config->compat_output]->crtc == crtc) output = config->output[config->compat_output]; else @@ -2126,9 +2266,7 @@ xf86SetDesiredModes (ScrnInfoPtr scrn) break; } } - /* - * Skip disabled crtcs - */ + /* paranoia */ if (!output) continue; diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 73a46635f..5dddaddb0 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -616,18 +616,17 @@ xf86_reload_cursors (ScreenPtr screen) if (cursor) { +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) + void *src = dixLookupPrivate(&cursor->devPrivates, screen); +#else + void *src = cursor->devPriv[screen->myNum]; +#endif #ifdef ARGB_CURSOR if (cursor->bits->argb && cursor_info->LoadCursorARGB) (*cursor_info->LoadCursorARGB) (scrn, cursor); - else -#endif - (*cursor_info->LoadCursorImage)(cursor_info->pScrn, -#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) - dixLookupPrivate(&cursor->devPrivates, screen) -#else - cursor->devPriv[screen->myNum] + else if (src) #endif - ); + (*cursor_info->LoadCursorImage)(cursor_info->pScrn, src); (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y); (*cursor_info->ShowCursor)(cursor_info->pScrn); diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 09d00393e..057b93d7b 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -363,7 +363,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, /* We only do seperate sync currently */ if (timing->sync != 0x03) { xf86DrvMsg(scrnIndex, X_INFO, - "%s: %dx%d Warning: We only handle seperate" + "%s: %dx%d Warning: We only handle separate" " sync.\n", __func__, timing->h_active, timing->v_active); } diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 2dff31b3a..3a9f3ff24 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -519,6 +519,28 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, } /** + * Marks as bad any reduced-blanking modes. + * + * \param modeList doubly-linked list of modes. + */ +_X_EXPORT void +xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList) +{ + Bool mode_is_reduced = FALSE; + DisplayModePtr mode; + + for (mode = modeList; mode != NULL; mode = mode->next) { + /* gratuitous duplication from pre-randr validation code */ + if ((((mode->HDisplay * 5 / 4) & ~0x07) > mode->HTotal) && + ((mode->HTotal - mode->HDisplay) == 160) && + ((mode->HSyncEnd - mode->HDisplay) == 80) && + ((mode->HSyncEnd - mode->HSyncStart) == 32) && + ((mode->VSyncStart - mode->VDisplay) == 3)) + mode->status = MODE_NO_REDUCED; + } +} + +/** * Frees any modes from the list with a status other than MODE_OK. * * \param modeList pointer to a doubly-linked or circular list of modes. diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index 5d49c9314..acdea65d8 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -85,6 +85,9 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, unsigned int bandwidth, int depth); void +xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList); + +void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList, Bool verbose); diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index cbe7a32d3..ac0b438d3 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -130,9 +130,7 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations) return FALSE; RRRegisterRate (pScreen, pSize, refresh); - if (xf86ModesEqual(mode, scrp->currentMode) && - mode->HDisplay == scrp->virtualX && - mode->VDisplay == scrp->virtualY) + if (xf86ModesEqual(mode, scrp->currentMode)) { RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize); } diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index e2f6420d8..505659e5a 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -55,7 +55,7 @@ #endif #endif -#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__)) +#if defined(__OpenBSD__) && defined(__amd64__) #include <machine/mtrr.h> #include <machine/sysarch.h> #endif @@ -108,7 +108,7 @@ static pointer NetBSDsetWC(int, unsigned long, unsigned long, Bool, MessageType); static void NetBSDundoWC(int, pointer); #endif -#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__) +#if defined(__OpenBSD__) && defined(__amd64__) static pointer amd64setWC(int, unsigned long, unsigned long, Bool, MessageType); static void amd64undoWC(int, pointer); @@ -229,7 +229,7 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->setWC = NetBSDsetWC; pVidMem->undoWC = NetBSDundoWC; #endif -#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__) +#if defined(__OpenBSD__) && defined(__amd64__) pVidMem->setWC = amd64setWC; pVidMem->undoWC = amd64undoWC; #endif @@ -953,7 +953,7 @@ NetBSDundoWC(int screenNum, pointer list) } #endif -#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__)) +#if defined(__OpenBSD__) && defined(__amd64__) static pointer amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, MessageType from) diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 892cbcfc3..22a35a0a0 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -342,7 +342,9 @@ XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint) if (!infoRec->offscreenDepthsInitialized) XAAInitializeOffscreenDepths (pScreen); - if(pScrn->vtSema && (infoRec->offscreenDepths & (1 << (depth - 1))) && + if(pScrn->vtSema && + (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) && + (infoRec->offscreenDepths & (1 << (depth - 1))) && (size >= MIN_OFFPIX_SIZE) && !SwitchedOut && (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) && (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight)) ) diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c index 74e90e3b6..784c649a4 100644 --- a/hw/xfree86/xaa/xaaPict.c +++ b/hw/xfree86/xaa/xaaPict.c @@ -588,150 +588,6 @@ XAADoGlyphs (CARD8 op, IS_OFFSCREEN_PIXMAP(pSrc->pDrawable)) return FALSE; - if(maskFormat && (maskFormat->depth == 1) && - (pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1) && - (op == PictOpOver) && infoRec->WriteBitmap && - !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) - { - CARD16 red, green, blue, alpha; - CARD32 pixel = - *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr)); - CARD32 *bits, *pntr, *pnt; - int x, y, i, n, left, top, right, bottom, width, height, pitch; - int L, T, R, B, X, Y, h, w, dwords, row, column, nbox; - int leftEdge, rightEdge, topLine, botLine; - BoxPtr pbox; - GlyphPtr glyph; - - if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format)) - return FALSE; - - if(alpha != 0xffff) return FALSE; - - XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format); - - if((infoRec->WriteBitmapFlags & RGB_EQUAL) && !((red == green) && (green == blue))) - return FALSE; - - x = pDst->pDrawable->x; - y = pDst->pDrawable->y; - - while(nlist--) { - x += list->xOff; - y += list->yOff; - left = right = X = x; - top = bottom = Y = y; - for(i = 0; i < list->len; i++) { - glyph = glyphs[i]; - - L = X - glyph->info.x; - if(L < left) left = L; - R = L + glyph->info.width; - if(R > right) right = R; - - T = Y - glyph->info.y; - if(T < top) top = T; - B = T + glyph->info.height; - if(B > bottom) bottom = B; - - X += glyph->info.xOff; - Y += glyph->info.yOff; - } - - width = right - left; - height = bottom - top; - - if(width && height) { - pitch = (((width + 31) & ~31) >> 5) + 1; - pntr = (CARD32*)xalloc(sizeof(CARD32) * pitch * height); - if(!pntr) - return TRUE; - bzero(pntr, sizeof(CARD32) * pitch * height); - n = list->len; - - X = x; Y = y; - while(n--) { - glyph = *glyphs++; - h = glyph->info.height; - w = glyph->info.width; - if(h && w) { - row = y - top - glyph->info.y; - column = x - left - glyph->info.x; - pnt = pntr + (row * pitch) + (column >> 5); - column &= 31; - dwords = ((w + 31) >> 5) - 1; - bits = (CARD32*)(glyph + 1); - if(dwords) { - while(h--) { - for(i = 0; i <= dwords; i++) { - if(column) { - pnt[i] |= SHIFT_L(*bits, column); - pnt[i + 1] |= SHIFT_R(*bits, 32 - column); - } else - pnt[i] |= *bits; - - if(i != dwords) bits++; - } - bits++; - pnt += pitch; - } - } else { - if(column) { - while(h--) { - pnt[0] |= SHIFT_L(*bits, column); - pnt[0 + 1] |= SHIFT_R(*bits, 32 - column); - bits++; - pnt += pitch; - } - } else { - while(h--) { - *pnt |= *bits++; - pnt += pitch; - } - } - } - } - x += glyph->info.xOff; - y += glyph->info.yOff; - } - - nbox = REGION_NUM_RECTS(pDst->pCompositeClip); - pbox = REGION_RECTS(pDst->pCompositeClip); - - while(nbox && (top >= pbox->y2)) { - pbox++; nbox--; - } - - while(nbox && (bottom > pbox->y1)) { - leftEdge = max(left, pbox->x1); - rightEdge = min(right, pbox->x2); - - if(rightEdge > leftEdge) { - column = leftEdge - left; - topLine = max(top, pbox->y1); - botLine = min(bottom, pbox->y2); - h = botLine - topLine; - - if(h > 0) { - (*infoRec->WriteBitmap)(infoRec->pScrn, - leftEdge, topLine, rightEdge - leftEdge, h, - (unsigned char*)(pntr + - ((topLine - top) * pitch) + (column >> 5)), - pitch << 2, column & 31, pixel, -1, GXcopy, ~0); - } - } - nbox--; pbox++; - } - xfree(pntr); - } else { - x = X; y = Y; - } - list++; - } - - return TRUE; - } - /* * If it looks like we have a chance of being able to draw these * glyphs with an accelerated Composite, do that now to avoid diff --git a/hw/xnest/Font.c b/hw/xnest/Font.c index 9f30085b1..26faf1633 100644 --- a/hw/xnest/Font.c +++ b/hw/xnest/Font.c @@ -44,11 +44,6 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont) FontSetPrivate(pFont, xnestFontPrivateIndex, NULL); -#ifdef XPRINT - if (requestingClient && XpClientIsPrintClient(requestingClient, NULL)) - return True; -#endif - name_atom = MakeAtom("FONT", 4, True); value_atom = 0L; diff --git a/hw/xprint/AttrValid.c b/hw/xprint/AttrValid.c deleted file mode 100644 index f8c292faa..000000000 --- a/hw/xprint/AttrValid.c +++ /dev/null @@ -1,701 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <scrnintstr.h> - -#include "attributes.h" - -/* - * default medium-source-sizes supported = na-letter w/.25" margins - */ -static XpOidMediumDiscreteSize DefaultMediumSize = { - xpoid_val_medium_size_na_letter, xFalse, {6.35, 209.55, 6.35, 273.05} -}; -static XpOidMediumDiscreteSizeList DefaultMediumSizeList = { - &DefaultMediumSize, 1 -}; -static XpOidMediumSourceSize DefaultMediumSourceSize = { - xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList } -}; -static XpOidMediumSS DefaultMediumSS = { - &DefaultMediumSourceSize, 1 -}; - -/* - * if 'valid_oid_list' is NULL any oid found is considered valid - */ -XpOid -XpGetOidAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oid_list) -{ - XpOid value_oid; - - value_oid = XpOidFromString(XpGetStringAttr(pContext, pool, oid)); - if((const XpOidList*)NULL == valid_oid_list - || - XpOidListHasOid(valid_oid_list, value_oid)) - { - return value_oid; - } - else - { - return xpoid_none; - } -} - -void -XpPutOidAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - XpOid value_oid) -{ - XpPutStringAttr(pContext, pool, oid, XpOidString(value_oid)); -} - -void -XpValidateOidAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oids, - XpOid default_oid) -{ - XpOid value_oid; - value_oid = XpGetOidAttr(pContext, pool, oid, valid_oids); - XpPutOidAttr(pContext, pool, oid, - value_oid == xpoid_none ? default_oid : value_oid); -} - -/* - * if 'valid_card_list' is NULL any cardinal found is considered valid - */ -unsigned long -XpGetCardAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_card_list) -{ - unsigned long value_card; - - if(XpOidParseUnsignedValue(XpGetStringAttr(pContext, pool, oid), - (const char**)NULL, - &value_card)) - { - if((const XpOidCardList*)NULL == valid_card_list - || - XpOidCardListHasCard(valid_card_list, value_card)) - { - return value_card; - } - } - return 0; -} - -void -XpPutCardAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - unsigned long value_card) -{ - if(value_card > 0) - { - char value_out[16]; - sprintf(value_out, "%lu", value_card); - XpPutStringAttr(pContext, pool, oid, value_out); - } - else - XpPutStringAttr(pContext, pool, oid, (const char*)NULL); -} - -void -XpValidateCardAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_cards, - unsigned long default_card) -{ - unsigned long value_card; - value_card = XpGetCardAttr(pContext, pool, oid, valid_cards); - XpPutCardAttr(pContext, pool, oid, - value_card == 0 ? default_card : value_card); -} - -XpOidList* -XpGetListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oid_list) -{ - return XpOidListNew(XpGetStringAttr(pContext, pool, oid), valid_oid_list); -} - -void -XpPutListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* list) -{ - char* value_out; - - value_out = XpOidListString(list); - XpPutStringAttr(pContext, pool, oid, value_out); - XpOidFree(value_out); -} - -void -XpValidateListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oids, - const XpOidList* default_oids) -{ - XpOidList* list = XpGetListAttr(pContext, pool, oid, valid_oids); - if(XpOidListCount(list) == 0) - XpPutListAttr(pContext, pool, oid, default_oids); - else - XpPutListAttr(pContext, pool, oid, list); - XpOidListDelete(list); -} - -XpOidCardList* -XpGetCardListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_card_list) -{ - return XpOidCardListNew(XpGetStringAttr(pContext, pool, oid), - valid_card_list); -} - -void -XpPutCardListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* list) -{ - char* value_out; - - value_out = XpOidCardListString(list); - XpPutStringAttr(pContext, pool, oid, value_out); - XpOidFree(value_out); -} - -void -XpValidateCardListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_cards, - const XpOidCardList* default_cards) -{ - XpOidCardList* list = XpGetCardListAttr(pContext, pool, oid, valid_cards); - if(XpOidCardListCount(list) == 0 && (XpOidCardList*)NULL != default_cards) - XpPutCardListAttr(pContext, pool, oid, default_cards); - else - XpPutCardListAttr(pContext, pool, oid, list); - XpOidCardListDelete(list); -} - -XpOidDocFmtList* -XpGetDocFmtListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidDocFmtList* valid_fmt_list) -{ - return XpOidDocFmtListNew(XpGetStringAttr(pContext, pool, oid), - valid_fmt_list); -} - -void -XpPutDocFmtListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidDocFmtList* list) -{ - char* value_out; - - value_out = XpOidDocFmtListString(list); - XpPutStringAttr(pContext, pool, oid, value_out); - XpOidFree(value_out); -} - -void -XpValidateDocFmtListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidDocFmtList* valid_fmts, - const XpOidDocFmtList* default_fmts) -{ - XpOidDocFmtList* list; - - list = XpGetDocFmtListAttr(pContext, pool, oid, valid_fmts); - if(XpOidDocFmtListCount(list) == 0 - && - (XpOidDocFmtList*)NULL != default_fmts) - { - XpPutDocFmtListAttr(pContext, pool, oid, default_fmts); - } - else - { - XpPutDocFmtListAttr(pContext, pool, oid, list); - } - XpOidDocFmtListDelete(list); -} - -XpOidMediumSS* -XpGetMediumSSAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_trays, - const XpOidList* valid_sizes) -{ - return XpOidMediumSSNew(XpGetStringAttr(pContext, pool, oid), - valid_trays, valid_sizes); -} - -void -XpPutMediumSSAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidMediumSS* msss) -{ - char* value_out; - - value_out = XpOidMediumSSString(msss); - XpPutStringAttr(pContext, pool, oid, value_out); - XpOidFree(value_out); -} - -const XpOidMediumSS* -XpGetDefaultMediumSS() -{ - return &DefaultMediumSS; -} - -XpOidTrayMediumList* -XpGetTrayMediumListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_trays, - const XpOidMediumSS* msss) -{ - return XpOidTrayMediumListNew(XpGetStringAttr(pContext, pool, oid), - valid_trays, msss); -} - -void -XpPutTrayMediumListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidTrayMediumList* tm) -{ - char* value_out; - - value_out = XpOidTrayMediumListString(tm); - XpPutStringAttr(pContext, pool, oid, value_out); - XpOidFree(value_out); -} - -void -XpValidatePrinterMediaAttrs(XpContextPtr pContext, - const XpOidList* valid_trays, - const XpOidList* valid_sizes) -{ - const XpOidMediumSS* msss; - XpOidMediumSS* pool_msss; - XpOidTrayMediumList* tm; - - pool_msss = XpGetMediumSSAttr(pContext, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, - valid_trays, valid_sizes); - if(0 == XpOidMediumSSCount(pool_msss)) - msss = XpGetDefaultMediumSS(); - else - msss = pool_msss; - XpPutMediumSSAttr(pContext, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, msss); - - tm = XpGetTrayMediumListAttr(pContext, XPPrinterAttr, - xpoid_att_input_trays_medium, - valid_trays, msss); - XpPutTrayMediumListAttr(pContext, XPPrinterAttr, - xpoid_att_input_trays_medium, tm); - - XpOidMediumSSDelete(pool_msss); - XpOidTrayMediumListDelete(tm); -} - - -void -XpValidatePrinterPool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr) -{ - /* - * content-orientations-supported - */ - XpValidateListAttr(pContext, XPPrinterAttr, - xpoid_att_content_orientations_supported, - vpr->valid_content_orientations_supported, - vpr->default_content_orientations_supported); - /* - * document-formats-supported - */ - XpValidateDocFmtListAttr(pContext, XPPrinterAttr, - xpoid_att_document_formats_supported, - vpr->valid_document_formats_supported, - vpr->default_document_formats_supported); - /* - * plexes-supported - */ - XpValidateListAttr(pContext, XPPrinterAttr, xpoid_att_plexes_supported, - vpr->valid_plexes_supported, - vpr->default_plexes_supported); - /* - * printer-resolutions-supported - */ - XpValidateCardListAttr(pContext, XPPrinterAttr, - xpoid_att_printer_resolutions_supported, - vpr->valid_printer_resolutions_supported, - vpr->default_printer_resolutions_supported); - /* - * xp-embedded-formats-supported - */ - XpValidateDocFmtListAttr(pContext, XPPrinterAttr, - xpoid_att_xp_embedded_formats_supported, - vpr->valid_xp_embedded_formats_supported, - vpr->default_xp_embedded_formats_supported); - /* - * xp-listfonts-modes-supported - */ - XpValidateListAttr(pContext, XPPrinterAttr, - xpoid_att_xp_listfonts_modes_supported, - vpr->valid_xp_listfonts_modes_supported, - vpr->default_xp_listfonts_modes_supported); - /* - * xp-raw-formats-supported - */ - XpValidateDocFmtListAttr(pContext, XPPrinterAttr, - xpoid_att_xp_raw_formats_supported, - vpr->valid_xp_raw_formats_supported, - vpr->default_xp_raw_formats_supported); - /* - * xp-setup-proviso - */ - XpValidateOidAttr(pContext, XPPrinterAttr, xpoid_att_xp_setup_proviso, - vpr->valid_xp_setup_proviso, xpoid_none); - /* - * medium-source-sizes-supported - * input-trays-mdeium - */ - XpValidatePrinterMediaAttrs(pContext, - vpr->valid_input_trays, - vpr->valid_medium_sizes); - /* - * available-compressions-supported - */ - XpValidateListAttr(pContext, XPPrinterAttr, - xpoid_att_available_compressions_supported, - vpr->valid_available_compressions_supported, - vpr->default_available_compressions_supported); -} - - -void -XpValidateNotificationProfile(XpContextPtr pContext) -{ - const char* value_in; - const char* value_out; - - value_in = XpGetStringAttr(pContext, XPJobAttr, - xpoid_att_notification_profile); - value_out = XpOidNotifyString(XpOidNotifyParse(value_in)); - XpPutStringAttr(pContext, XPJobAttr, - xpoid_att_notification_profile, value_out); -} - -void -XpValidateJobPool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr) -{ - /* - * Note: the 'vpr' argument is unused in this - * implementation; it is reserved for future use - */ - XpOidList* job_attrs_supported; - /* - * only validate attributes found in job-attributes-supported - */ - job_attrs_supported = XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_job_attributes_supported, - (const XpOidList*)NULL); - /* - * notification-profile - */ - if(XpOidListHasOid(job_attrs_supported, xpoid_att_notification_profile)) - { - XpValidateNotificationProfile(pContext); - } - /* - * clean up - */ - XpOidListDelete(job_attrs_supported); -} - - -static void -XpValidateDocOrPagePool(XpContextPtr pContext, - XPAttributes pool, /* XPDocAttr or XPPageAttr */ - const XpOidList* attrs_supported, - const XpValidatePoolsRec* vpr) -{ - /* - * content-orientation - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_content_orientation)) - { - XpOidList* content_orientations_supported; - content_orientations_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_content_orientations_supported, - vpr->valid_content_orientations_supported); - XpValidateOidAttr(pContext, pool, xpoid_att_content_orientation, - content_orientations_supported, xpoid_none); - XpOidListDelete(content_orientations_supported); - } - /* - * copy-count - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_copy_count)) - XpValidateCardAttr(pContext, pool, xpoid_att_copy_count, - (const XpOidCardList*)NULL, 0); - /* - * default-printer-resolution - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_default_printer_resolution)) - { - XpOidCardList* printer_resolutions_supported; - printer_resolutions_supported = - XpGetCardListAttr(pContext, XPPrinterAttr, - xpoid_att_printer_resolutions_supported, - vpr->valid_printer_resolutions_supported); - XpValidateCardAttr(pContext, pool, - xpoid_att_default_printer_resolution, - printer_resolutions_supported, 0); - XpOidCardListDelete(printer_resolutions_supported); - } - /* - * default-input-tray - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_default_input_tray)) - { - XpOidTrayMediumList* input_trays_medium; - const char* value_in; - XpOid value_tray; - - input_trays_medium = - XpGetTrayMediumListAttr(pContext, XPPrinterAttr, - xpoid_att_input_trays_medium, - (const XpOidList*)NULL, - (const XpOidMediumSS*)NULL); - value_in = - XpGetStringAttr(pContext, pool, xpoid_att_default_input_tray); - value_tray = XpOidFromString(value_in); - if(!XpOidTrayMediumListHasTray(input_trays_medium, value_tray)) - value_tray = xpoid_none; - XpPutOidAttr(pContext, pool, xpoid_att_default_input_tray, value_tray); - XpOidTrayMediumListDelete(input_trays_medium); - } - /* - * default-medium - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_default_medium)) - { - XpOidMediumSS* msss; - const char* value_in; - XpOid value_size; - - msss = XpGetMediumSSAttr(pContext, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, - (const XpOidList*)NULL, - (const XpOidList*)NULL); - value_in = XpGetStringAttr(pContext, pool, xpoid_att_default_medium); - value_size = XpOidFromString(value_in); - if(!XpOidMediumSSHasSize(msss, value_size)) - value_size = xpoid_none; - XpPutOidAttr(pContext, pool, xpoid_att_default_medium, value_size); - XpOidMediumSSDelete(msss); - } - /* - * document-format - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_document_format)) - { - XpOidDocFmtList* document_formats_supported; - const char* value_in; - XpOidDocFmt* document_format; - const char* value_out; - - document_formats_supported = - XpGetDocFmtListAttr(pContext, XPPrinterAttr, - xpoid_att_document_formats_supported, - vpr->valid_document_formats_supported); - value_in = XpGetStringAttr(pContext, pool, xpoid_att_document_format); - document_format = XpOidDocFmtNew(value_in); - if(XpOidDocFmtListHasFmt(document_formats_supported, document_format)) - value_out = XpOidDocFmtString(document_format); - else - value_out = XpOidDocFmtString(vpr->default_document_format); - XpOidDocFmtListDelete(document_formats_supported); - XpOidDocFmtDelete(document_format); - XpPutStringAttr(pContext, pool, xpoid_att_document_format, value_out); - XpOidFree(value_out); - } - /* - * plex - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_plex)) - { - XpOidList* plexes_supported; - plexes_supported = - XpGetListAttr(pContext, XPPrinterAttr, xpoid_att_plexes_supported, - vpr->valid_plexes_supported); - XpValidateOidAttr(pContext, pool, xpoid_att_plex, - plexes_supported, xpoid_none); - XpOidListDelete(plexes_supported); - } - /* - * xp-listfonts-modes - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_xp_listfonts_modes)) - { - XpOidList* xp_listfonts_modes_supported; - xp_listfonts_modes_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_xp_listfonts_modes_supported, - vpr->valid_xp_listfonts_modes_supported); - XpValidateListAttr(pContext, pool, xpoid_att_xp_listfonts_modes, - xp_listfonts_modes_supported, - (const XpOidList*)NULL); - XpOidListDelete(xp_listfonts_modes_supported); - } - /* - * available-compressions - */ - if(XpOidListHasOid(attrs_supported, xpoid_att_available_compression)) - { - XpOidList* available_compressions_supported; - available_compressions_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_available_compressions_supported, - vpr->valid_available_compressions_supported); - XpValidateOidAttr(pContext, pool, xpoid_att_available_compression, - available_compressions_supported, xpoid_none); - XpOidListDelete(available_compressions_supported); - } -} - -void -XpValidateDocumentPool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr) -{ - XpOidList* document_attrs_supported; - /* - * only validate attributes found in document-attributes-supported - */ - document_attrs_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_document_attributes_supported, - (const XpOidList*)NULL); - /* - * validate - */ - XpValidateDocOrPagePool(pContext, XPDocAttr, - document_attrs_supported, vpr); - /* - * clean up - */ - XpOidListDelete(document_attrs_supported); -} - -void -XpValidatePagePool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr) -{ - XpOidList* page_attrs_supported; - /* - * only validate attributes found in xp-page-attributes-supported - */ - page_attrs_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_xp_page_attributes_supported, - (const XpOidList*)NULL); - /* - * validate - */ - XpValidateDocOrPagePool(pContext, XPPageAttr, - page_attrs_supported, vpr); - /* - * clean up - */ - XpOidListDelete(page_attrs_supported); -} - -void -XpValidateAttributePool(XpContextPtr pContext, - XPAttributes pool, - const XpValidatePoolsRec* vpr) -{ - switch(pool) - { - case XPPrinterAttr: - XpValidatePrinterPool(pContext, vpr); - break; - - case XPDocAttr: - XpValidateDocumentPool(pContext, vpr); - break; - - case XPJobAttr: - XpValidateJobPool(pContext, vpr); - break; - - case XPPageAttr: - XpValidatePagePool(pContext, vpr); - break; - - default: - break; - } -} diff --git a/hw/xprint/AttrValid.h b/hw/xprint/AttrValid.h deleted file mode 100644 index 7bb7ce1c8..000000000 --- a/hw/xprint/AttrValid.h +++ /dev/null @@ -1,219 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _Xp_AttrValid_h -#define _Xp_AttrValid_h - -#include <X11/extensions/Printstr.h> -#include "Oid.h" - -#define XpNumber(a) (sizeof(a) / sizeof(*(a))) - -/* - * Attribute pool validation valid values and defaults - */ -typedef struct -{ - XpOidList* valid_content_orientations_supported; - XpOidList* default_content_orientations_supported; - - XpOidDocFmtList* valid_document_formats_supported; - XpOidDocFmtList* default_document_formats_supported; - - XpOidList* valid_input_trays; - XpOidList* valid_medium_sizes; - - XpOidList* valid_plexes_supported; - XpOidList* default_plexes_supported; - - XpOidCardList* valid_printer_resolutions_supported; - XpOidCardList* default_printer_resolutions_supported; - - XpOidDocFmtList* valid_xp_embedded_formats_supported; - XpOidDocFmtList* default_xp_embedded_formats_supported; - - XpOidList* valid_xp_listfonts_modes_supported; - XpOidList* default_xp_listfonts_modes_supported; - - XpOidDocFmtList* valid_xp_raw_formats_supported; - XpOidDocFmtList* default_xp_raw_formats_supported; - - XpOidList* valid_xp_setup_proviso; - - XpOidDocFmt* default_document_format; - XpOidList* valid_available_compressions_supported; - XpOidList* default_available_compressions_supported; - -} XpValidatePoolsRec; - -/* - * XpOid resource access - */ -#define XpGetStringAttr(pContext, pool, oid) \ - (const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid)) -#define XpPutStringAttr(pContext, pool, oid, value) \ - XpPutOneAttribute(pContext, pool, XpOidString(oid), value) - -#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */ - -/* - * XpOid-valued attribute access - */ -XpOid XpGetOidAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oid_list); -void XpPutOidAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - XpOid value_oid); -void XpValidateOidAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oids, - XpOid default_oid); -/* - * cardinal-valued attribute access - */ -unsigned long XpGetCardAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_card_list); -void XpPutCardAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - unsigned long value_card); -void XpValidateCardAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_cards, - unsigned long default_card); -/* - * XpOidList-valued attribute access - */ -XpOidList* XpGetListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oid_list); -void XpPutListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* list); -void XpValidateListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_oids, - const XpOidList* default_oids); -/* - * XpOidCardList-valued attribute access - */ -XpOidCardList* XpGetCardListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_card_list); -void XpPutCardListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* list); -void XpValidateCardListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidCardList* valid_cards, - const XpOidCardList* default_cards); -/* - * XpOidDocFmtList-valued attribute access - */ -XpOidDocFmtList* XpGetDocFmtListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidDocFmtList* valid_fmt_list); -void XpPutDocFmtListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidDocFmtList* list); -void XpValidateDocFmtListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidDocFmtList* valid_fmts, - const XpOidDocFmtList* default_fmts); -/* - * XpOidMediumSS-valued attribute access - */ -XpOidMediumSS* XpGetMediumSSAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_trays, - const XpOidList* valid_sizes); -void XpPutMediumSSAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidMediumSS* msss); -const XpOidMediumSS* XpGetDefaultMediumSS(void); - -/* - * XpOidTrayMediumList-valued attribute access - */ -XpOidTrayMediumList* XpGetTrayMediumListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidList* valid_trays, - const XpOidMediumSS* msss); -void XpPutTrayMediumListAttr(XpContextPtr pContext, - XPAttributes pool, - XpOid oid, - const XpOidTrayMediumList* tm); -void XpValidatePrinterMediaAttrs(XpContextPtr pContext, - const XpOidList* valid_trays, - const XpOidList* valid_sizes); -/* - * Attribute pool validation - */ -void XpValidateAttributePool(XpContextPtr pContext, - XPAttributes pool, - const XpValidatePoolsRec* vpr); -void XpValidatePrinterPool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr); -void XpValidateNotificationProfile(XpContextPtr pContext); -void XpValidateJobPool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr); -void XpValidateDocumentPool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr); -void XpValidatePagePool(XpContextPtr pContext, - const XpValidatePoolsRec* vpr); - -#endif /* _XP_PRINT_SERVER_ */ - -#endif /* _Xp_AttrValid_h - don't add anything after this line */ diff --git a/hw/xprint/DiPrint.h b/hw/xprint/DiPrint.h deleted file mode 100644 index 22cbf0d43..000000000 --- a/hw/xprint/DiPrint.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/* - * The XpDiListEntry struct is the type of each element of the array - * handed back to the extension code to handle a GetPrinterList request. - * We don't use the printerDb directly because of the desire to handle - * multiple locales. Creating this new array for each GetPrinterList - * request will allow us to build it with the description in the locale of - * the requesting client. - */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif -#include <X11/fonts/fontstruct.h> - -#ifndef _XpDiPrint_H_ -#define _XpDiPrint_H_ 1 - -#include "scrnintstr.h" - -typedef struct _diListEntry { - char *name; - char *description; - char *localeName; - unsigned long rootWinId; -} XpDiListEntry; - -extern void XpDiFreePrinterList(XpDiListEntry **list); - -extern XpDiListEntry **XpDiGetPrinterList( - int nameLen, - char *name, - int localeLen, - char *locale); - -extern char * XpDiGetDriverName(int index, char *printerName); - -extern WindowPtr XpDiValidatePrinter(char *printerName, int printerNameLen); - -extern int PrinterOptions(int argc, char **argv, int i); - -extern void PrinterUseMsg(void); - -extern void PrinterInitGlobals(void); - -extern void PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv); - -extern Bool XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe); - -extern Bool XpClientIsBitmapClient(ClientPtr client); - -extern void _XpVoidNoop(void); - -extern Bool _XpBoolNoop(void); - -#endif /* _XpDiPrint_H_ */ diff --git a/hw/xprint/Init.c b/hw/xprint/Init.c deleted file mode 100644 index 69100d390..000000000 --- a/hw/xprint/Init.c +++ /dev/null @@ -1,1920 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996-2004 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. -(c) Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/******************************************************************* -** -** ********************************************************* -** * -** * File: printer/Init.c -** * -** * Contents: -** * The InitOutput routine here would presumably -** * be called from the normal server's InitOutput -** * after all display screens have been added. -** * There is are ifdef'd routines suitable for -** * use in building a printer-only server. Turn -** * on the "PRINTER_ONLY_SERVER" define if this is -** * to be the only ddx-level driver. -** * -** * Copyright: Copyright 1993,1995 Hewlett-Packard Company -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <locale.h> -#ifdef __hpux -#include <sys/sysmacros.h> -#endif - -#include <X11/X.h> -#define NEED_EVENTS 1 -#include <X11/Xproto.h> -#include <servermd.h> - -#include "screenint.h" -#include "input.h" -#include "cursor.h" -#include "misc.h" -#include "windowstr.h" -#include "inputstr.h" - -#include "gcstruct.h" -#include <X11/fonts/fontstruct.h> -#include "errno.h" - -typedef char *XPointer; -#define HAVE_XPointer 1 - -#define Status int -#include <X11/Xresource.h> - -#include "DiPrint.h" -#include "attributes.h" - -#include "os.h" -#include "spooler.h" - -static void GenericScreenInit( - int index, - ScreenPtr pScreen, - int argc, - char **argv); -static Bool InitPrintDrivers( - int index, - ScreenPtr pScreen, - int argc, - char **argv); - -/* - * The following two defines are used to build the name "X*printers", where - * the "*" is replaced by the display number. This is used to construct - * the name of the default printers configuration file if the -XpFile - * command line option was not specified. - */ -#define XNPRINTERSFILEPREFIX "/X" -#define XNPRINTERSFILESUFFIX "printers" -#define XPRINTERSFILENAME "Xprinters" - -#define MODELDIRNAME "/models" -#define FONTDIRNAME "/fonts" - -#ifdef XPRASTERDDX - -static -PixmapFormatRec RasterPixmapFormats[] = { - { 1, 1, BITMAP_SCANLINE_PAD } -}; -#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0]) - -#include "raster/Raster.h" - -#endif - -#ifdef XPPCLDDX - -static -PixmapFormatRec ColorPclPixmapFormats[] = { - { 1, 1, BITMAP_SCANLINE_PAD }, - { 8, 8, BITMAP_SCANLINE_PAD }, - { 24, 32, BITMAP_SCANLINE_PAD } -}; - -#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0]) - -#endif - -#ifdef XPMONOPCLDDX - -static -PixmapFormatRec MonoPclPixmapFormats[] = { - { 1, 1, BITMAP_SCANLINE_PAD } -}; - -#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0]) - -#endif - -#if defined(XPPCLDDX) || defined(XPMONOPCLDDX) -#include "pcl/Pcl.h" -#endif - -#ifdef XPPSDDX - -static -PixmapFormatRec PSPixmapFormats[] = { - { 1, 1, BITMAP_SCANLINE_PAD }, - { 8, 8, BITMAP_SCANLINE_PAD }, - { 12, 16, BITMAP_SCANLINE_PAD }, - { 14, 16, BITMAP_SCANLINE_PAD }, - { 16, 16, BITMAP_SCANLINE_PAD }, - { 24, 32, BITMAP_SCANLINE_PAD } -}; - -#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0]) - -#include "ps/Ps.h" - -#endif - -/* - * The driverInitArray contains an entry for each driver the - * server knows about. Each element contains pointers to pixmap formats, the - * driver's initialization routine, and pointers to the driver's - * attribute validation rec, and/or a driver function which - * returns the maximum medium width&height, and maximum resolution - * given a printer name. Either the validation rec OR the dimension - * function can be NULL. If the function is non-NULL then it - * will be called, and will be passed the (possibly NULL) validation rec. - * If the function is NULL, then XpGetMaxWidthHeightRes() is called. - */ -typedef struct _driverInitRec { - char *driverName; - pBFunc initFunc; - XpValidatePoolsRec *pValRec; - pVFunc dimensionsFunc; - PixmapFormatRec *pFmts; - int numFmts; -} driverInitRec; - -static driverInitRec driverInits[] = { -#ifdef XPRASTERDDX - { - "XP-RASTER", - InitializeRasterDriver, - &RasterValidatePoolsRec, - (pVFunc) NULL, - RasterPixmapFormats, - NUMRASTFORMATS - }, -#endif -#ifdef XPPCLDDX - { - "XP-PCL-COLOR", - InitializeColorPclDriver, - &PclValidatePoolsRec, - (pVFunc) NULL, - ColorPclPixmapFormats, - NUMCPCLFORMATS - }, -#endif -#ifdef XPMONOPCLDDX - { - "XP-PCL-MONO", - InitializeMonoPclDriver, - &PclValidatePoolsRec, - (pVFunc) NULL, - MonoPclPixmapFormats, - NUMMPCLFORMATS - }, -#endif -#ifdef XPPSDDX - { - "XP-POSTSCRIPT", - InitializePsDriver, - &PsValidatePoolsRec, - (pVFunc) NULL, - PSPixmapFormats, - NUMPSFORMATS - }, -#endif -}; - - -/* - * The printerDb variable points to a list of PrinterDbEntry structs - * which map printer names with screen numbers and driver names. - */ -typedef struct _printerDbEntry { - struct _printerDbEntry *next; - char *name; - char *qualifier; - int screenNum; - char *driverName; - char *desc; -} PrinterDbEntry, *PrinterDbPtr; - -static PrinterDbPtr printerDb = (PrinterDbPtr)NULL; - -/* - * The nameMap is a list used in initializing the attribute store - * for each printer. The list is freed once the printerDb is built - * and the attribute stores for all printers have been initialized. - */ -typedef struct _nameMapEntry { - struct _nameMapEntry *next; - char *name; - char *qualifier; -} NameMapEntry, *NameMapPtr; - -static NameMapPtr nameMap = (NameMapPtr)NULL; - -/* - * The driverMap is a list which provides the mapping between driver names - * and screen numbers. It is built and used - * by RehashPrinterList to correctly fill in the screenNum field in the - * printerDb entries. The list is freed before RehashPrinterList terminates. - */ -typedef struct _driverMapping { - struct _driverMapping *next; - char *driverName; - int screenNum; -} DriverMapEntry, *DriverMapPtr; - -static const char configFilePath[] = -"/etc/dt/config/print:/usr/dt/config/print"; - -static const char printServerConfigDir[] = "XPSERVERCONFIGDIR"; - -static char *configFileName = (char *)NULL; -static Bool freeDefaultFontPath = FALSE; -static char *origFontPath = (char *)NULL; - -static Bool xprintInitGlobalsCalled = FALSE; -/* - * This function is responsible for doing initalisation of any global - * variables at an very early point of server startup (even before - * |ProcessCommandLine()|. - */ -void PrinterInitGlobals(void) -{ - xprintInitGlobalsCalled = TRUE; - -#ifdef DAMAGE - /* Disable DAMAGE extension for now as it does not work with - * the Postscript DDX yet (see - * https://bugs.freedesktop.org/show_bug.cgi?id=1660) ... - * (you can enable the DAMAGE extension explicitly via - * % X +extension DAMAGE ... #) ;-( */ - noDamageExtension = TRUE; -#endif /* DAMAGE */ - -#ifdef SMART_SCHEDULE - /* Somehow the XF86 "smart scheduler" completely kills the Xprint DDX - * (see http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=467 - * ("Xfree86's "smart scheduler" breaks Xprt") */ - SmartScheduleDisable = TRUE; -#endif /* SMART_SCHEDULE */ - - /* Disable internal screensaver for Xprint (workaround for - * http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=567 ("Xorg - * Xprt starts to consume 100% CPU when being idle for some time")) */ - defaultScreenSaverTime = 0; - - /* Ensure that the maximum request size for the BIGREQUESTS extension - * is at least 8MB (see - * http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=622 - "RFE: - * Xprt's default BIGREQUESTS extension buffer size should be 8MB") - */ - maxBigRequestSize = (8*1048576)-1; - - /* Xprt should not reset by default when the last client exists - * (default for Xprt is |0|, video Xservers use |DE_RESET|) */ - dispatchExceptionAtReset = 0; -} - -/* - * PrinterUseMsg() prints usage for the Xprint-specific options - */ -void PrinterUseMsg(void) -{ - XpSpoolerTypePtr curr = xpstm; - - /* Option '-XpFile' */ - ErrorF("-XpFile file specifies an alternate `Xprinters' file, rather\n"); - ErrorF(" than the default one (e.g.\n"); - ErrorF(" `${XPCONFIGDIR}/${LANG}/print/Xprinters') or\n"); - ErrorF(" `${XPCONFIGDIR}/C/print/Xprinters'.\n"); - - /* Option '-XpSpoolerType' */ - ErrorF("-XpSpoolerType string specifies a spooler type.\n"); - ErrorF(" Supported values are:\n"); - - while( curr->name != NULL ) - { - ErrorF(" - '%s'\n", curr->name); - curr++; - } - ErrorF(" (multiple values can be specified, seperated by ':',\n"); - ErrorF(" the first active spooler will be chosen).\n"); - ErrorF(" default is '%s'.\n", XPDEFAULTSPOOLERNAMELIST); -} - -/* - * PrinterOptions checks argv[i] to see if it is our command line - * option specifying a configuration file name. It returns the index - * of the next option to process. - */ -int -PrinterOptions( - int argc, - char **argv, - int i) -{ - if(strcmp(argv[i], "-XpFile") == 0) - { - if ((i + 1) >= argc) { - ddxUseMsg (); - return i + 2; - } - configFileName = argv[i + 1]; - return i + 2; - } - else if(strcmp(argv[i], "-XpSpoolerType") == 0) - { - if ((i + 1) >= argc) { - ddxUseMsg (); - return i + 2; - } - XpSetSpoolerTypeNameList(argv[i + 1]); - return i + 2; - } - else - { - return i; - } -} - -/************************************************************ - * GetInitFunc -- - * - * This routine is called from the InitPrintDrivers function. - * Given the name of a driver, return a pointer to the driver's - * initialization function. - * - * Results: - * Returns a pointer to the initialization function for the driver. - * - * - ************************************************************/ - -/* -typedef Bool (*pIFunc)(); -static pIFunc -GetInitFunc(driverName) -*/ - -static pBFunc GetInitFunc(char *driverName) -{ - driverInitRec *pInitRec; - int numDrivers = sizeof(driverInits)/sizeof(driverInitRec); - int i; - - for(pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++) - { - if( !strcmp( driverName, pInitRec->driverName ) ) - return pInitRec->initFunc; - } - - return 0; -} - -static void -GetDimFuncAndRec( - char *driverName, - XpValidatePoolsRec **pValRec, - pVFunc *dimensionsFunc) -{ - driverInitRec *pInitRec; - int numDrivers = sizeof(driverInits)/sizeof(driverInitRec); - int i; - - for(pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++) - { - if( !strcmp( driverName, pInitRec->driverName ) ) - { - *dimensionsFunc = pInitRec->dimensionsFunc; - *pValRec = pInitRec->pValRec; - return ; - } - } - - *dimensionsFunc = 0; - *pValRec = 0; - return; -} - -static void -FreePrinterDb(void) -{ - PrinterDbPtr pCurEntry, pNextEntry; - - for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL; - pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry) - { - pNextEntry = pCurEntry->next; - if(pCurEntry->name != (char *)NULL) - xfree(pCurEntry->name); - if(pCurEntry->desc != (char *)NULL) - xfree(pCurEntry->desc); - /* - * We don't free the driver name, because it's expected to simply - * be a pointer into the xrm database. - */ - xfree(pCurEntry); - } - printerDb = (PrinterDbPtr)NULL; -} - -/* - * AddPrinterDbName allocates an entry in the printerDb list, and - * initializes the "name". It returns TRUE if the element was - * successfully added, and FALSE if an allocation error ocurred. - * XXX AddPrinterDbName needs to check for (and not add) duplicate names. - */ -static Bool -AddPrinterDbName(char *name, char *desc) -{ - PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry)); - - if(pEntry == (PrinterDbPtr)NULL) return FALSE; - pEntry->name = (name != NULL) ? strdup(name) : NULL; - pEntry->desc = (desc != NULL) ? strdup(desc) : NULL; - pEntry->qualifier = (char *)NULL; - - if(printerDb == (PrinterDbPtr)NULL) - { - pEntry->next = (PrinterDbPtr)NULL; - printerDb = pEntry; - } - else - { - pEntry->next = printerDb; - printerDb = pEntry; - } - return TRUE; -} - -static int -AugmentPrinterDb(const char *command) -{ - FILE *fp; - char name[256]; - int num_printers = 0; /* Number of printers we found */ - size_t namelen; - char *desc = NULL; - - fp = popen(command, "r"); - /* XXX is a 256 character limit overly restrictive for printer names? */ - while(fgets(name, 256, fp) != (char *)NULL && (namelen=strlen(name))) - { - char *option = name; - - name[namelen-1] = (char)'\0'; /* strip the \n */ - -#define XP_DESCRIPTOR "xp-printerattr.descriptor=" -#define XP_DESCRIPTOR_LEN (sizeof(XP_DESCRIPTOR)-1) - while ((option = strchr(option, '\t'))) { - option++; /* Skip the '\t' */ - if (!strncmp(option, XP_DESCRIPTOR, XP_DESCRIPTOR_LEN)) { - *(option-1) = '\0'; /* Kill the '\t' (only if we found a valid option) */ - option += XP_DESCRIPTOR_LEN; - if (*option != '\0') { - desc = option; - } - } - else - { - /* Unknown option */ - ErrorF("AugmentPrinterDb: Unknown option '%s'\n", option); - } - } - AddPrinterDbName(name, desc); - num_printers++; - } - pclose(fp); - return num_printers; -} - -/* - * FreeNameMap frees all remaining memory associated with the nameMap. - */ -static void -FreeNameMap(void) -{ - NameMapPtr pEntry, pTmp; - - for(pEntry = nameMap, pTmp = (NameMapPtr)NULL; - pEntry != (NameMapPtr)NULL; - pEntry = pTmp) - { - if(pEntry->name != (char *)NULL) - xfree(pEntry->name); - if(pEntry->qualifier != (char *)NULL) - xfree(pEntry->qualifier); - pTmp = pEntry->next; - xfree(pEntry); - } - nameMap = (NameMapPtr)NULL; -} - -/* - * AddNameMap adds an element to the nameMap linked list. - */ -static Bool -AddNameMap(char *name, char *qualifier) -{ - NameMapPtr pEntry; - - if((pEntry = (NameMapPtr)xalloc(sizeof(NameMapEntry))) == (NameMapPtr)NULL) - return FALSE; - pEntry->name = name; - pEntry->qualifier = qualifier; - pEntry->next = nameMap; - nameMap = pEntry; - return TRUE; -} - -/* - * MergeNameMap - puts the "map" names (aka qualifiers, aliases) into - * the printerDb. This should be called once, after both the printerDb - * and nameMap lists are complete. When/if MergeNameMap finds a map for - * an entry in the printerDb, the qualifier is _moved_ (not copied) to - * the printerDb. This means that the qualifier pointer in the nameMap - * is NULLed out. - */ -static void -MergeNameMap(void) -{ - NameMapPtr pMap; - PrinterDbPtr pDb; - - for(pMap = nameMap; pMap != (NameMapPtr)NULL; pMap = pMap->next) - { - for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) - { - if(!strcmp(pMap->name, pDb->name)) - { - pDb->qualifier = pMap->qualifier; - pMap->qualifier = (char *)NULL; - } - } - } -} - -/* - * CreatePrinterAttrs causes the attribute stores to be built for - * each printer in the printerDb. - */ -static void -CreatePrinterAttrs(void) -{ - PrinterDbPtr pDb; - - for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) - { - XpBuildAttributeStore(pDb->name, (pDb->qualifier)? - pDb->qualifier : pDb->name); - } -} - -#ifdef XPPSDDX -#define defaultDriver "XP-POSTSCRIPT" -#else -#ifdef XPPCLDDX -#define defaultDriver "XP-PCL-COLOR" -#else -#ifdef XPMONOPCLDDX -#define defaultDriver "XP-PCL-MONO" -#else -#define defaultDriver "XP-RASTER" -#endif -#endif -#endif - -/* - * StoreDriverNames - queries the attribute store for the ddx-identifier. - * if the ddx-identifier is not in the attribute database, then a default - * ddx-identifier is store in both the attribute store for the printer, - * and in the printerDb. - * The ddx-identifier is stored in the printerDb for use in initializing - * the screens. - */ -static void -StoreDriverNames(void) -{ - PrinterDbPtr pEntry; - - for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL; - pEntry = pEntry->next) - { - pEntry->driverName = (char*)XpGetPrinterAttribute(pEntry->name, - "xp-ddx-identifier"); - if(pEntry->driverName == (char *)NULL || - strlen(pEntry->driverName) == 0 || - GetInitFunc(pEntry->driverName) == (Bool(*)())NULL) - { - if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) { - ErrorF("Xp Extension: Can't load driver %s\n", - pEntry->driverName); - ErrorF(" init function missing\n"); - } - - pEntry->driverName = defaultDriver; - XpAddPrinterAttribute(pEntry->name, - (pEntry->qualifier != (char *)NULL)? - pEntry->qualifier : pEntry->name, - "*xp-ddx-identifier", pEntry->driverName); - } - } -} - -/* - * StoreDescriptors - queries the attribute store for the descriptor. - * if the descriptor is not in the attribute database, then the descriptor - * from the printerDb is store in the attribute store for the printer. - */ -static void -StoreDescriptors(void) -{ - PrinterDbPtr pEntry; - - for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL; - pEntry = pEntry->next) - { - if (pEntry->desc != NULL) - { - XpAddPrinterAttribute(pEntry->name, - (pEntry->qualifier != (char *)NULL)? - pEntry->qualifier : pEntry->name, - "*descriptor", pEntry->desc); - } - } -} - -static char * -MbStrchr( - char *str, - int ch) -{ - size_t mbCurMax = MB_CUR_MAX; - wchar_t targetChar, curChar; - char tmpChar; - int i, numBytes, byteLen; - - if(mbCurMax <= 1) return strchr(str, ch); - - tmpChar = (char)ch; - mbtowc(&targetChar, &tmpChar, mbCurMax); - for(i = 0, numBytes = 0, byteLen = strlen(str); i < byteLen; i += numBytes) - { - numBytes = mbtowc(&curChar, &str[i], mbCurMax); - if(curChar == targetChar) return &str[i]; - } - return (char *)NULL; -} - -/* - * GetConfigFileName - Looks for a "Xprinters" file in - * $(XPRINTDIR)/$LANG/print, and then in $(XPRINTDIR)/C/print. If it - * finds such a file, it returns the path to the file. The returned - * string must be freed by the caller. - */ -static char * -GetConfigFileName(void) -{ - /* - * We need to find the system-wide file, if one exists. This - * file can be in either $(XPRINTDIR)/$LANG/print, or in - * $(PRINTDIR)/C/print, and the file itself is named "Xprinters". - */ - char *dirName, *filePath; - - /* - * Check for a LANG-specific file. - */ - if((dirName = XpGetConfigDir(TRUE))) - { - filePath = (char *)xalloc(strlen(dirName) + - strlen(XPRINTERSFILENAME) + 2); - - if(filePath == (char *)NULL) - { - xfree(dirName); - return (char *)NULL; - } - - sprintf(filePath, "%s/%s", dirName, XPRINTERSFILENAME); - xfree(dirName); - if(access(filePath, R_OK) == 0) - return filePath; - - xfree(filePath); - } - - if((dirName = XpGetConfigDir(FALSE))) - { - filePath = (char *)xalloc(strlen(dirName) + - strlen(XPRINTERSFILENAME) + 2); - if(filePath == (char *)NULL) - { - xfree(dirName); - return (char *)NULL; - } - sprintf(filePath, "%s/%s", dirName, XPRINTERSFILENAME); - xfree(dirName); - if(access(filePath, R_OK) == 0) - return filePath; - xfree(filePath); - } - return (char *)NULL; -} - -/* - * BuildPrinterDb - reads the config file if it exists, and if necessary - * executes a command such as lpstat to generate a list of printers. - * XXX - * XXX BuildPrinterDb must be rewritten to allow 16-bit characters in - * XXX printer names. The will involve replacing the use of strtok() and its - * XXX related functions. - * XXX At the same time, BuildPrinterDb and it's support routines should have - * XXX allocation error checking added. - * XXX - */ -static PrinterDbPtr -BuildPrinterDb(void) -{ - Bool defaultAugment = TRUE, freeConfigFileName; - - if(configFileName && access(configFileName, R_OK) != 0) - { - ErrorF("Xp Extension: Can't open file %s\n", configFileName); - } - if(!configFileName && (configFileName = GetConfigFileName())) - freeConfigFileName = TRUE; - else - freeConfigFileName = FALSE; - - if(configFileName != (char *)NULL && access(configFileName, R_OK) == 0) - { - char line[256]; - FILE *fp = fopen(configFileName, "r"); - - while(fgets(line, 256, fp) != (char *)NULL) - { - char *tok, *ptr; - if((tok = strtok(line, " \t\012")) != (char *)NULL) - { - if(tok[0] == (char)'#') continue; - if(strcmp(tok, "Printer") == 0) - { - while((tok = strtok((char *)NULL, " \t")) != (char *)NULL) - { - if((ptr = MbStrchr(tok, '\012'))) - *ptr = (char)'\0'; - AddPrinterDbName(tok, NULL); - } - } - else if(strcmp(tok, "Map") == 0) - { - char *name, *qualifier; - - if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL) - continue; - name = strdup(tok); - if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL) - { - xfree(name); - continue; - } - qualifier = strdup(tok); - AddNameMap(name, qualifier); - } - else if(strcmp(tok, "Augment_Printer_List") == 0) - { - if((tok = strtok((char *)NULL, " \t\012")) == (char *)NULL) - continue; - - if(strcmp(tok, "%default%") == 0) - continue; - defaultAugment = FALSE; - if(strcmp(tok, "%none%") == 0) - continue; - AugmentPrinterDb(tok); - } - else - break; /* XXX Generate an error? */ - } - } - fclose(fp); - } - - if(defaultAugment == TRUE) - { - XpSpoolerTypePtr curr_spooler_type; /* spooler we are currently probing for queues */ - int num_printers_found; /* number of printers found by |AugmentPrinterDb()| */ - char *tok_lasts; /* strtok_r() position token */ - char *spnamelist; /* list of spooler names, seperated by ":" */ - char *spname; /* spooler name */ - - spnamelist = strdup(XpGetSpoolerTypeNameList()); /* strtok_r() modifies string so dup' it first */ - - for( spname = strtok_r(spnamelist, ":", &tok_lasts) ; - spname != NULL ; - spname = strtok_r(NULL, ":", &tok_lasts) ) - { - curr_spooler_type = XpSpoolerNameToXpSpoolerType(spname); - if(!curr_spooler_type) - { - FatalError("BuildPrinterDb: No spooler type entry found for '%s'.\n", spname); - } - - if(curr_spooler_type->list_queues_command == NULL || - strlen(curr_spooler_type->list_queues_command) == 0) - { - continue; - } - - num_printers_found = AugmentPrinterDb(curr_spooler_type->list_queues_command); - /* Did we found a spooler which works ? */ - if(num_printers_found > 0) - { - spooler_type = curr_spooler_type; -#ifdef DEBUG_gisburn - fprintf(stderr, "BuildPrinterDb: using '%s'.\n", spooler_type->name); -#endif /* DEBUG_gisburn */ - break; - } - } - - free(spnamelist); - } - - MergeNameMap(); - FreeNameMap(); - - /* Create the attribute stores for all printers */ - CreatePrinterAttrs(); - - /* - * Find the drivers for each printers, and store the driver names - * in the printerDb - */ - StoreDriverNames(); - StoreDescriptors(); - - if(freeConfigFileName) - { - xfree(configFileName); - configFileName = (char *)NULL; - } - - return printerDb; -} - -static void -FreeDriverMap(DriverMapPtr driverMap) -{ - DriverMapPtr pCurEntry, pNextEntry; - - for(pCurEntry = driverMap, pNextEntry = (DriverMapPtr)NULL; - pCurEntry != (DriverMapPtr)NULL; pCurEntry = pNextEntry) - { - pNextEntry = pCurEntry->next; - if(pCurEntry->driverName != (char *)NULL) - xfree(pCurEntry->driverName); - xfree(pCurEntry); - } -} - -/* - * XpRehashPrinterList rebuilds the list of printers known to the - * server. It first walks the printerDb to build a table mapping - * driver names and screen numbers, since this is not an easy mapping - * to change in the sample server. The normal configuration files are - * then read & parsed to create the new list of printers. Printers - * which require drivers other than those already initialized are - * deleted from the printerDb. This leaves attribute stores in place - * for inaccessible printers, but those stores will be cleaned up in - * the next rehash or server recycle. - */ -int -XpRehashPrinterList(void) -{ - PrinterDbPtr pEntry, pPrev; - DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt; - int result; - - /* Build driverMap */ - for(pEntry = printerDb; pEntry != (PrinterDbPtr)NULL; pEntry = pEntry->next) - { - for(pDrvEnt = driverMap; pDrvEnt != (DriverMapPtr)NULL; - pDrvEnt = pDrvEnt->next) - { - if(!strcmp(pEntry->driverName, pDrvEnt->driverName)) - break; - } - - if(pDrvEnt != (DriverMapPtr)NULL) - continue; - - if((pDrvEnt = (DriverMapPtr)xalloc(sizeof(DriverMapEntry))) == - (DriverMapPtr)NULL) - { - FreeDriverMap(driverMap); - return BadAlloc; - } - pDrvEnt->driverName = strdup(pEntry->driverName); - pDrvEnt->screenNum = pEntry->screenNum; - pDrvEnt->next = driverMap; - driverMap = pDrvEnt; - } - - /* Free the old printerDb */ - FreePrinterDb(); - - /* Free/Rehash attribute stores */ - if((result = XpRehashAttributes()) != Success) - return result; - - /* Build a new printerDb */ - if(BuildPrinterDb() == (PrinterDbPtr)NULL) - return BadAlloc; - - /* Walk PrinterDb & either store screenNum, or delete printerDb entry */ - for(pEntry = printerDb, pPrev = (PrinterDbPtr)NULL; - pEntry != (PrinterDbPtr)NULL; pEntry = pEntry->next) - { - for(pDrvEnt = driverMap; pDrvEnt != (DriverMapPtr)NULL; - pDrvEnt = pDrvEnt->next) - { - if(!strcmp(printerDb->driverName, pDrvEnt->driverName)) - break; - } - - /* - * Either store the screen number, or delete the printerDb entry. - * Deleting the entry leaves orphaned attribute stores, but they'll - * get cleaned up at the next rehash or server recycle. - */ - if(pDrvEnt != (DriverMapPtr)NULL) - { - pEntry->screenNum = pDrvEnt->screenNum; - pPrev = pEntry; - } - else { - if(pPrev) - pPrev->next = pEntry->next; - else - pPrev = pEntry->next; - if(pEntry->name != (char *)NULL) - xfree(pEntry->name); - xfree(pEntry); - pEntry = pPrev; - } - } - - FreeDriverMap(driverMap); - - return Success; -} - -/* - * ValidateFontDir looks for a valid font directory for the specified - * printer model within the specified configuration directory. It returns - * the directory name, or NULL if no valid font directory was found. - * It is the caller's responsibility to free the returned font directory - * name. - */ -static char * -ValidateFontDir( - char *configDir, - char *modelName) -{ - char *pathName; - - if(!configDir || !modelName) - return (char *)NULL; - - pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) + - strlen(modelName) + strlen(FONTDIRNAME) + - strlen("fonts.dir") + 5); - if(!pathName) - return (char *)NULL; - sprintf(pathName, "%s/%s/%s/%s/%s", configDir, MODELDIRNAME, modelName, - FONTDIRNAME, "fonts.dir"); - if(access(pathName, R_OK) != 0) - { - xfree(pathName); - return (char *)NULL; - } - pathName[strlen(pathName) - 9] = (char)'\0'; /* erase fonts.dir */ - return pathName; -} - -/* - * FindFontDir returns a pointer to the path name of the font directory - * for the specified printer model name, if such a directory exists. - * The directory contents are superficially checked for validity. - * The caller must free the returned char *. - * - * We first look in the locale-specific model-config directory, and - * then fall back to the C language model-config directory. - */ -static char * -FindFontDir( - char *modelName) -{ - char *configDir, *fontDir; - - if(!modelName || !strlen(modelName)) - return (char *)NULL; - - configDir = XpGetConfigDir(TRUE); - if((fontDir = ValidateFontDir(configDir, modelName))) - { - xfree(configDir); - return fontDir; - } - - if(configDir) - xfree(configDir); - configDir = XpGetConfigDir(FALSE); - fontDir = ValidateFontDir(configDir, modelName); - - xfree(configDir); - - return fontDir; -} - -/* - * AddToFontPath adds the specified font path element to the global - * defaultFontPath string. It adds the keyword "PRINTER:" to the front - * of the path to denote that this is a printer-specific font path - * element. - */ -static char PATH_PREFIX[] = "PRINTER:"; -static int PATH_PREFIX_LEN = sizeof(PATH_PREFIX) - 1; /* same as strlen() */ - -static void -AddToFontPath( - char *pathName) -{ - char *newPath; - Bool freeOldPath; - - if(defaultFontPath == origFontPath) - freeOldPath = FALSE; - else - freeOldPath = TRUE; - - newPath = (char *)xalloc(strlen(defaultFontPath) + strlen(pathName) + - PATH_PREFIX_LEN + 2); - - sprintf(newPath, "%s%s,%s", PATH_PREFIX, pathName, defaultFontPath); - - if(freeOldPath) - xfree(defaultFontPath); - - defaultFontPath = newPath; - return; -} - -/* - * AugmentFontPath adds printer-model-specific font path elements to - * the front of the font path global variable "defaultFontPath" (dix/globals.c). - * We can't call SetFontPath() because the font code has not yet been - * initialized when InitOutput is called (from whence this routine is called). - * - * This utilizes the static variables origFontPath and - * freeDefaultFontPath to track the original contents of defaultFontPath, - * and to properly free the modified version upon server recycle. - */ -static void -AugmentFontPath(void) -{ - char *modelID, **allIDs = (char **)NULL; - PrinterDbPtr pDbEntry; - int numModels, i; - - if(!origFontPath) - origFontPath = defaultFontPath; - - if(freeDefaultFontPath) - { - xfree(defaultFontPath); - defaultFontPath = origFontPath; - freeDefaultFontPath = FALSE; - } - - /* - * Build a list of printer models to check for internal fonts. - */ - for(pDbEntry = printerDb, numModels = 0; - pDbEntry != (PrinterDbPtr)NULL; - pDbEntry = pDbEntry->next) - { - modelID = - (char*)XpGetPrinterAttribute(pDbEntry->name, - "xp-model-identifier"); - - if(modelID && strlen(modelID) != 0) - { - /* look for current model in the list of allIDs */ - for(i = 0; i < numModels; i++) - { - if(!strcmp(modelID, allIDs[i])) - { - modelID = (char *)NULL; - break; - } - } - } - - /* - * If this printer's model-identifier isn't in the allIDs list, - * then add it to allIDs. - */ - if(modelID && strlen(modelID) != 0) - { - allIDs = (char **)xrealloc(allIDs, (numModels+2) * sizeof(char *)); - if(allIDs == (char **)NULL) - return; - allIDs[numModels] = modelID; - allIDs[numModels + 1] = (char *)NULL; - numModels++; - } - } - - /* for each model, check for a valid font directory, and add it to - * the front of defaultFontPath. - */ - for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++) - { - char *fontDir; - if((fontDir = FindFontDir(allIDs[i]))) - { - AddToFontPath(fontDir); - xfree(fontDir); - freeDefaultFontPath = TRUE; - } - } - - if(allIDs) - xfree(allIDs); - - return; -} - -/* - * XpClientIsBitmapClient is called by the font code to find out if - * a particular client should be granted access to bitmap fonts. - * This function works by - * calling XpContextOfClient (in Xserver/Xext/xprint.c) to determine - * the context associated with the client, and then queries the context's - * attributes to determine whether the bitmap fonts should be visible. - * It looks at the value of the xp-listfonts-modes document/page attribute to - * see if xp-list-glyph-fonts has been left out of the mode list. Only - * if the xp-listfonts-modes attribute exists, and it does not contain - * xp-list-glyph-fonts does this function return FALSE. In any other - * case the funtion returns TRUE, indicating that the bitmap fonts - * should be visible to the client. - */ -Bool -XpClientIsBitmapClient( - ClientPtr client) -{ - XpContextPtr pContext; - char *mode; - - if(!(pContext = XpContextOfClient(client))) - return TRUE; - - /* - * Check the page attributes, and if it's not defined there, then - * check the document attributes. - */ - mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-modes"); - if(!mode || !strlen(mode)) - { - mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-modes"); - if(!mode || !strlen(mode)) - return TRUE; - } - - if(!strstr(mode, "xp-list-glyph-fonts")) - return FALSE; - - return TRUE; -} - -/* - * XpClientIsPrintClient is called by the font code to find out if - * a particular client has set a context which references a printer - * which utilizes a particular font path. - * This function works by calling XpContextOfClient - * (in Xserver/Xext/xprint.c) to determine the context associated with - * the client and then looks at the value of the xp-listfonts-modes - * document/page attribute to see if xp-list-internal-printer-fonts has - * been left out of the mode list. - * If the xp-listfonts-modes attribute exists, and it does not contain - * xp-list-internal-printer-fonts this function returns FALSE. - * Otherwise it looks up the font directory for the context. The font - * directory is then compared with the directory specified in the - * FontPathElement which is passed in. - */ -Bool -XpClientIsPrintClient( - ClientPtr client, - FontPathElementPtr fpe) -{ - XpContextPtr pContext; - char *mode; - char *modelID, *fontDir; - - if(!(pContext = XpContextOfClient(client))) - return FALSE; - - /* - * Check the page attributes, and if it's not defined there, then - * check the document attributes. - */ - mode = XpGetOneAttribute(pContext, XPPageAttr, "xp-listfonts-modes"); - if(!mode || !strlen(mode)) - { - mode = XpGetOneAttribute(pContext, XPDocAttr, "xp-listfonts-modes"); - } - - if(mode && strlen(mode)) - { - if(!strstr(mode, "xp-list-internal-printer-fonts")) - return FALSE; - } - - if (!fpe) - return TRUE; - - modelID = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-model-identifier"); - if(!modelID || !strlen(modelID)) - return FALSE; - - if(!(fontDir = FindFontDir(modelID))) - return FALSE; - - /* - * The grunge here is to ignore the PATH_PREFIX at the front of the - * fpe->name. - */ - if(fpe->name_length < PATH_PREFIX_LEN || - (strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) || - strncmp(fontDir, fpe->name + PATH_PREFIX_LEN, - fpe->name_length - PATH_PREFIX_LEN)) - { - xfree(fontDir); - return FALSE; - } - xfree(fontDir); - return TRUE; -} - -static void -AddFormats(ScreenInfo *pScreenInfo, char *driverName) -{ - int i, j; - driverInitRec *pInitRec; - int numDrivers = sizeof(driverInits)/sizeof(driverInitRec); - PixmapFormatRec *formats; - int numfmts; - - for (pInitRec = driverInits, i = 0; i < numDrivers; pInitRec++, i++) - { - if ( !strcmp( driverName, pInitRec->driverName ) ) - break; - } - if (i >= numDrivers) - return; - formats = pInitRec->pFmts; - numfmts = pInitRec->numFmts; - for (i = 0; i < numfmts && pScreenInfo->numPixmapFormats < MAXFORMATS; i++) - { - for (j = 0; j < pScreenInfo->numPixmapFormats; j++) { - if (pScreenInfo->formats[j].depth == formats[i].depth && - pScreenInfo->formats[j].bitsPerPixel == formats[i].bitsPerPixel && - pScreenInfo->formats[j].scanlinePad == formats[i].scanlinePad) - break; - } - if (j == pScreenInfo->numPixmapFormats) { - pScreenInfo->formats[j] = formats[i]; - pScreenInfo->numPixmapFormats++; - } - } -} - -/************************************************************ - * PrinterInitOutput -- - * This routine is to be called from a ddx's InitOutput - * during the server startup initialization, and when - * the server is to be reset. The routine creates the - * screens associated with configured printers by calling - * dix:AddScreen. The configuration information comes from a - * database read from the X*printers file. - * - * Results: - * The array of ScreenRec pointers referenced by - * pScreenInfo->screen is increased by the addition - * of the printer screen(s), as is the value of - * pScreenInfo->numScreens. This is done via calls - * to AddScreen() in dix. - * - ************************************************************/ - -void -PrinterInitOutput( - ScreenInfo *pScreenInfo, - int argc, - char **argv) -{ - PrinterDbPtr pDb, pDbEntry; - int driverCount = 0, i; - char **driverNames; - char *configDir; - - /* This should NEVER happen, but... */ - if( !xprintInitGlobalsCalled ) - { - FatalError("Internal error: PrinterInitGlobals() not called."); - } -#ifdef SMART_SCHEDULE - /* |PrinterInitGlobals| should have set |SmartScheduleDisable| to - * |TRUE| - if not we will trigger this safeguard. */ - if( SmartScheduleDisable != TRUE ) - { - FatalError("Internal error: XF86 smart scheduler incompatible to Xprint DDX."); - } -#endif /* SMART_SCHEDULE */ - /* Safeguard for - * http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=567 ("Xorg - * Xprt starts to consume 100% CPU when being idle for some time") - * |PrinterInitGlobals| should have set |defaultScreenSaverTime| to - * |0| - if not we will trigger this trap. */ - if( defaultScreenSaverTime != 0 ) - { - FatalError("Internal screen saver must be OFF for printing."); - } - - /* Print a warnung when the maximum request size of the BIGREQUESTS - * extension is smaller than 8MB (see - * http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=622) - */ - if (maxBigRequestSize < (8*1048576)-1) { - ErrorF("Xp Extension: BIGREQUESTS max. request is currently %ld bytes " - ", recommemded minimum for Xprint is 8MB.\n", (long)maxBigRequestSize); - } - - /* - * this little test is just a warning at startup to make sure - * that the config directory exists. - * - * what this ugly looking if says is that if both ways of - * calling configDir works and both directories don't exist, - * then print an error saying we can't find the non-lang one. - */ - if (((configDir = XpGetConfigDir(TRUE)) != NULL) && - (access(configDir, F_OK) == 0)) - { - xfree(configDir); - } - else if (((configDir = XpGetConfigDir(FALSE)) != NULL) && - (access(configDir, F_OK) == 0)) - { - xfree(configDir); - } - else { - /* Refuse to start when we do not have our config dir... */ - FatalError("Xp Extension: could not find config dir %s\n", - configDir ? configDir : XPRINTDIR); - } - - if(printerDb != (PrinterDbPtr)NULL) - FreePrinterDb(); - - /* - * Calling BuildPrinterDb serves to build the printer database, - * and to initialize the attribute store for each printer. - * The driver can, if it so desires, modify the attribute - * store at a later time. - */ - if((pDb = BuildPrinterDb()) == (PrinterDbPtr)NULL) return; - - /* - * We now have to decide how many screens to initialize, and call - * AddScreen for each one. The printerDb must be properly initialized - * for at least one screen's worth of printers prior to calling AddScreen - * because InitPrintDrivers reads the printerDb to determine which - * driver(s) to init on a particular screen. - * We put each driver's printers on a different - * screen, and call AddScreen for each screen/driver pair. - */ - /* count the number of printers */ - for(pDbEntry = pDb, driverCount = 0; pDbEntry != (PrinterDbPtr)NULL; - pDbEntry = pDbEntry->next, driverCount++) - ; - /* - * Allocate memory for the worst case - a driver per printer - */ - driverNames = (char **)xalloc(sizeof(char *) * driverCount); - - /* - * Assign the driver for the first printer to the first screen - */ - pDb->screenNum = screenInfo.numScreens; - driverNames[0] = pDb->driverName; - driverCount = 1; - AddFormats(pScreenInfo, pDb->driverName); - - /* - * For each printer, look to see if its driver is already assigned - * to a screen, and if so copy that screen number into the printerDb. - * Otherwise, assign a new screen number to the driver for this - * printer. - */ - for(pDbEntry = pDb; pDbEntry != (PrinterDbPtr)NULL; - pDbEntry = pDbEntry->next) - { - Bool foundMatch; - - for(i = 0, foundMatch = FALSE; i < driverCount; i++) - { - if(!strcmp(driverNames[i], pDbEntry->driverName)) - { - foundMatch = TRUE; - pDbEntry->screenNum = screenInfo.numScreens + i; - break; - } - } - if(foundMatch == FALSE) - { - driverNames[driverCount] = pDbEntry->driverName; - pDbEntry->screenNum = screenInfo.numScreens + driverCount; - AddFormats(pScreenInfo, pDbEntry->driverName); - driverCount++; - } - } - - for(i = 0; i < driverCount; i++) - { - int curScreen = screenInfo.numScreens; - if(AddScreen(InitPrintDrivers, argc, argv) < 0) - { - PrinterDbPtr pPrev; - /* - * AddScreen failed, so we pull the associated printers - * from the list. - */ - ErrorF("Xp Extension: Could not add screen for driver %s\n", - driverNames[i]); - for(pPrev = pDbEntry = printerDb; pDbEntry != (PrinterDbPtr)NULL; - pDbEntry = pDbEntry->next) - { - if(pDbEntry->screenNum == curScreen) - { - if(pPrev == printerDb) - { - printerDb = pDbEntry->next; - pPrev = printerDb; - } - else - pPrev->next = pDbEntry->next; - - xfree(pDbEntry->name); - xfree(pDbEntry); - pDbEntry = pPrev; - } - else - { - if(pDbEntry->screenNum > curScreen) - pDbEntry->screenNum--; - pPrev = pDbEntry; - } - } - } - } - - xfree(driverNames); - - AugmentFontPath(); - - if(pScreenInfo->numScreens > MAXSCREENS) - { - ErrorF("The number of printer screens requested "); - ErrorF("exceeds the allowable limit of %d screens.\n", MAXSCREENS); - ErrorF("Please reduce the number of requested printers in your "); - ErrorF("\nX%sprinters file.", display); - ErrorF("Server exiting...\n"); - exit(-1); - } -} - -/* - * InitPrintDrivers is called from dix:AddScreen. It in turn calls the - * driver initialization routine for any and all drivers which are - * implicated in supporting printers on the particular screen number - * specified by the "index" parameter. The printerDb variable is used - * to determine which printers are to be associated with a particular - * screen. - */ -static Bool -InitPrintDrivers( - int index, - ScreenPtr pScreen, - int argc, - char **argv) -{ - PrinterDbPtr pDb, pDb2; - - GenericScreenInit(index, pScreen, argc, argv); - - for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) - { - if(pDb->screenNum == index) - { - Bool callInit = TRUE; - for(pDb2 = printerDb; pDb2 != pDb; pDb2 = pDb2->next) - { - if(!strcmp(pDb->driverName, pDb2->driverName)) - { - callInit = FALSE; - break; - } - } - if(callInit == TRUE) - { - Bool (*initFunc)(BFuncArgs); - initFunc = GetInitFunc(pDb->driverName); - if(initFunc(index, pScreen, argc, argv) == FALSE) - { - /* XXX - What do I do if the driver's init fails? */ - } - } - } - } - return TRUE; -} - -void -_XpVoidNoop(void) -{ - return; -} - -Bool -_XpBoolNoop(void) -{ - return TRUE; -} - -/* - * GenericScreenInit - The common initializations required by all - * printer screens and drivers. It sets the screen's cursor functions - * to Noops, and computes the maximum screen (i.e. medium) dimensions. - */ - -static void -GenericScreenInit( - int index, - ScreenPtr pScreen, - int argc, - char **argv) -{ - float fWidth, fHeight, maxWidth, maxHeight; - unsigned short width, height; - PrinterDbPtr pDb; - int res, maxRes; - - /* - * Set the cursor ops to no-op functions. - */ - pScreen->DisplayCursor = (DisplayCursorProcPtr)_XpBoolNoop; - pScreen->RealizeCursor = (RealizeCursorProcPtr)_XpBoolNoop; - pScreen->UnrealizeCursor = (UnrealizeCursorProcPtr)_XpBoolNoop; - pScreen->SetCursorPosition = (SetCursorPositionProcPtr)_XpBoolNoop; - pScreen->ConstrainCursor = (ConstrainCursorProcPtr)_XpVoidNoop; - pScreen->CursorLimits = (CursorLimitsProcPtr)_XpVoidNoop; - pScreen->RecolorCursor = (RecolorCursorProcPtr)_XpVoidNoop; - - /* - * Find the largest paper size for all the printers on the given - * screen. - */ - maxRes = 0; - maxWidth = maxHeight = 0.0; - for( pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) - { - if(pDb->screenNum == index) - { - - XpValidatePoolsRec *pValRec; - pVFunc dimensionsFunc; - - GetDimFuncAndRec(pDb->driverName, &pValRec, &dimensionsFunc); - if(dimensionsFunc != (pVFunc)NULL) - dimensionsFunc(pDb->name, pValRec, &fWidth, &fHeight, &res); - else - XpGetMaxWidthHeightRes(pDb->name, pValRec, &fWidth, - &fHeight, &res); - if( res > maxRes ) - maxRes = res; - if( fWidth > maxWidth ) - maxWidth = fWidth; - if( fHeight > maxHeight ) - maxHeight = fHeight; - } - } - - width = (unsigned short) (maxWidth * maxRes / 25.4); - height = (unsigned short) (maxHeight * maxRes / 25.4); - pScreen->width = pScreen->height = ( width > height ) ? width : - height; - - pScreen->mmWidth = pScreen->mmHeight = ( maxWidth > maxHeight ) ? - (unsigned short)(maxWidth + 0.5) : - (unsigned short)(maxHeight + 0.5); -} - -#if 0 /* No one uses this anymore... */ -/* - * QualifyName - takes an unqualified file name such as X6printers and - * a colon-separated list of directory path names such as - * /etc/opt/dt:/opt/dt/config. - * - * Returns a fully qualified file path name such as /etc/opt/dt/X6printers. - * The returned value is malloc'd, and the caller is responsible for - * freeing the associated memory. - */ -static char * -QualifyName(char *fileName, char *searchPath) -{ - char * curPath = searchPath; - char * nextPath; - char * chance; - FILE *pFile; - - if (fileName == NULL || searchPath == NULL) - return NULL; - - while (1) { - if ((nextPath = strchr(curPath, ':')) != NULL) - *nextPath = 0; - - chance = (char *)xalloc(strlen(curPath) + strlen(fileName) + 2); - sprintf(chance,"%s/%s",curPath,fileName); - - /* see if we can read from the file */ - if((pFile = fopen(chance, "r")) != (FILE *)NULL) - { - fclose(pFile); - /* ... restore the colon, .... */ - if (nextPath) - *nextPath = ':'; - - return chance; - } - - xfree(chance); - - if (nextPath == NULL) /* End of path list? */ - break; - - /* try the next path */ - curPath = nextPath + 1; - } - return NULL; -} -#endif - -/* - * FillPrinterListEntry fills in a single XpDiListEntry element with data - * derived from the supplied PrinterDbPtr element. - * - * XXX A smarter (i.e. future) version of this routine might inspect the - * XXX "locale" parameter and attempt to match the "description" and - * XXX "localeName" elements of the XpDiListEntry to the specified locale. - */ -static void -FillPrinterListEntry( - XpDiListEntry *pEntry, - PrinterDbPtr pDb, - int localeLen, - char *locale) -{ - static char *localeStr = (char *)NULL; - - if(localeStr == (char *)NULL) - localeStr = strdup(setlocale(LC_ALL, (const char *)NULL)); - - pEntry->name = pDb->name; - pEntry->description = - (char*)XpGetPrinterAttribute(pDb->name, "descriptor"); - pEntry->localeName = localeStr; - pEntry->rootWinId = WindowTable[pDb->screenNum]->drawable.id; -} - -/* - * GetPrinterListInfo fills in the XpDiListEntry struct pointed to by the - * parameter pEntry with the information regarding the printer specified - * by the name and nameLen parameters. The pointers placed in the - * XpDiListEntry structure MUST NOT be freed by the caller. They are - * pointers into existing long-lived databases. - * - */ -static Bool -GetPrinterListInfo( - XpDiListEntry *pEntry, - int nameLen, - char *name, - int localeLen, - char *locale) -{ - PrinterDbPtr pDb; - - for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next) - { - if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen)) - { - FillPrinterListEntry(pEntry, pDb, localeLen, locale); - return TRUE; - } - } - return FALSE; -} - -/* - * XpDiFreePrinterList is the approved method of releasing memory used - * for a printer list. - */ -void -XpDiFreePrinterList(XpDiListEntry **list) -{ - int i; - - for(i = 0; list[i] != (XpDiListEntry *)NULL; i++) - xfree(list[i]); - xfree(list); -} - -/* - * XpDiGetPrinterList returns a pointer to a NULL-terminated array of - * XpDiListEntry pointers. Each entry structure contains the name, - * description, root window, and locale of a printer. The call returns - * either a list of all printers configured on the server, or it returns - * the information for one specific printer depending on the values passed - * in. Non-NULL values passed in indicate that only the information for - * the one specific printer is desired, while NULL values indicate that - * the information for all printers is desired. - */ -XpDiListEntry ** -XpDiGetPrinterList( - int nameLen, - char *name, - int localeLen, - char *locale) -{ - XpDiListEntry **pList; - - if(!nameLen || name == (char *)NULL) - { - int i; - PrinterDbPtr pDb; - - for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL; - pDb = pDb->next, i++) - ; - - if((pList = (XpDiListEntry **)xalloc((i+1) * sizeof(XpDiListEntry *))) - == (XpDiListEntry **)NULL) - return pList; - - pList[i] = (XpDiListEntry *)NULL; - for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL; - pDb = pDb->next, i++) - { - if((pList[i] = (XpDiListEntry *)xalloc(sizeof(XpDiListEntry)))== - (XpDiListEntry *)NULL) - { - XpDiFreePrinterList(pList); - return (XpDiListEntry **)NULL; - } - FillPrinterListEntry(pList[i], pDb, localeLen, locale); - } - } - else - { - if((pList = (XpDiListEntry **)xalloc(2 * sizeof(XpDiListEntry *))) == - (XpDiListEntry **)NULL) - return pList; - - if((pList[0] = (XpDiListEntry *)xalloc(sizeof(XpDiListEntry))) == - (XpDiListEntry *)NULL) - { - xfree(pList); - return (XpDiListEntry **)NULL; - } - pList[1] = (XpDiListEntry *)NULL; - if(GetPrinterListInfo(pList[0], nameLen, name, localeLen, locale) == - FALSE) - { - xfree(pList[0]); - pList[0] = (XpDiListEntry *)NULL; - } - } - return pList; -} - -WindowPtr -XpDiValidatePrinter(char *printerName, int printerNameLen) -{ - PrinterDbPtr pCurEntry; - - for(pCurEntry = printerDb; - pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next) - { - if(strlen(pCurEntry->name) == printerNameLen && - !strncmp(pCurEntry->name, printerName, printerNameLen)) - return WindowTable[pCurEntry->screenNum]; - } - return (WindowPtr)NULL; -} - -/* - * XpDiGetDriverName takes a screen index and a printer name, and returns - * a pointer to the name of the driver to be used for the specified printer - * on the specified screen. - */ -char * -XpDiGetDriverName(int index, char *printerName) -{ - - PrinterDbPtr pCurEntry; - - for(pCurEntry = printerDb; - pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next) - { - if(pCurEntry->screenNum == index && - !strcmp(pCurEntry->name, printerName)) - return pCurEntry->driverName; - } - - return (char *)NULL; /* XXX Should we supply a default driverName? */ -} - diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am deleted file mode 100644 index 2ed7aaf57..000000000 --- a/hw/xprint/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -SUBDIRS = doc pcl pcl-mono raster ps etc config - -bin_PROGRAMS = Xprt - -Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \ - -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \ - -DXPRINTDIR=\"$(libdir)/X11/xserver\" \ - -DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \ - -DXFree86Server - -Xprt_LDFLAGS = -L$(top_srcdir) -XPRINT_LIBS = \ - @XPRINT_LIBS@ \ - ps/libps.la \ - raster/libraster.la \ - pcl/libpcl.la \ - pcl-mono/libpcl.la \ - $(top_builddir)/fb/libfb.la \ - $(top_builddir)/render/librender.la \ - $(top_builddir)/dix/libXpdix.la \ - $(XSERVER_LIBS) \ - $(top_builddir)/Xext/libXext.la \ - $(top_builddir)/xkb/libxkb.la \ - $(top_builddir)/xkb/libxkbstubs.la \ - $(top_builddir)/os/libos.la # for Xprintf - -Xprt_DEPENDENCIES = $(XPRINT_LIBS) -Xprt_LDADD = $(XPRINT_LIBS) $(XPRINT_SYS_LIBS) $(XSERVER_SYS_LIBS) - -miinitext-wrapper.c: - echo "#include \"$(top_srcdir)/mi/miinitext.c\"" >> $@ - -dpmsstubs-wrapper.c: - echo "#include \"$(top_srcdir)/Xext/dpmsstubs.c\"" >> $@ - -Xprt_SOURCES = \ - attributes.c \ - attributes.h \ - AttrValid.c \ - AttrValid.h \ - ddxInit.c \ - DiPrint.h \ - Init.c \ - mediaSizes.c \ - Oid.c \ - OidDefs.h \ - Oid.h \ - OidStrs.h \ - spooler.c \ - spooler.h \ - Util.c \ - miinitext-wrapper.c \ - dpmsstubs-wrapper.c \ - $(top_srcdir)/fb/fbcmap_mi.c - -EXTRA_DIST = ValTree.c - -CLEANFILES = miinitext-wrapper.c dpmsstubs-wrapper.c diff --git a/hw/xprint/Oid.c b/hw/xprint/Oid.c deleted file mode 100644 index a2af00108..000000000 --- a/hw/xprint/Oid.c +++ /dev/null @@ -1,3181 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "attributes.h" - -/* - * XpOidNotify value strings - */ -#define NOTIFY_EMAIL_STR "{{event-report-job-completed} electronic-mail}" -#define NOTIFY_NONE_STR "{}" - -#define SafeStrLen(s) ((s) ? strlen((s)) : 0) - -/* - * entry type for the object identifier string map - */ -typedef struct _XpOidStringMapEntry -{ - const char* string; - int length; - int msg_set; - int msg_number; - const char* default_message; - -} XpOidStringMapEntry; - -/* - * include the auto-generated static XpOidStringMap - */ -#include "OidStrs.h" - -/* - * XpOid static function declarations - */ -static XpOid XpOidParse(const char* value_string, - const char** ptr_return); -/* - * XpOidList static function declarations - */ -static XpOidList* XpOidListParse(const char* value_string, - const XpOidList* valid_oids, - const char** ptr_return, int i); - -/* - * XpOidList static function declarations - */ -static XpOidCardList* XpOidCardListParse(const char* value_string, - const XpOidCardList* valid_cards, - const char** ptr_return, int i); - -/* - * XpOidMediumSourceSize static function declarations - */ -static XpOidMediumSS* MediumSSParse(const char* value_string, - const XpOidList* valid_trays, - const XpOidList* valid_medium_sizes, - const char** ptr_return, int i); -static XpOidMediumContinuousSize* MediumContinuousSizeParse(const char*, - const char**); -static void MediumContinuousSizeDelete(XpOidMediumContinuousSize* me); -static XpOidMediumDiscreteSizeList* MediumDiscreteSizeListParse(const char*, - const XpOidList*, - const char**, - int i); -static void MediumDiscreteSizeListDelete(XpOidMediumDiscreteSizeList* list); - -static BOOL ParseArea(const char* value_string, - const char** ptr_return, - XpOidArea* area_return); -static BOOL ParseRealRange(const char* value_string, - const char** ptr_return, - XpOidRealRange* range_return); - -/* - * XpOidTrayMediumList static function declarations - */ -static XpOidTrayMediumList* TrayMediumListParse(const char* value_string, - const XpOidList* valid_trays, - const char** ptr_return, - int i); -static void TrayMediumListValidate(XpOidTrayMediumList* me, - const XpOidMediumSS* msss); - -/* - * XpOidDocFmt - */ -static BOOL XpOidDocFmtNext(XpOidDocFmt* doc_fmt, - const char* value_string, - const char** ptr_return); - -/* - * XpOidDocFmtListParse - */ -static XpOidDocFmtList* XpOidDocFmtListParse(const char* value_string, - const XpOidDocFmtList* valid_fmts, - const char** ptr_return, int i); - -/* - * misc. parsing static function declarations - */ -static BOOL ParseBoolValue(const char* value_string, - const char** ptr_return, - BOOL* bool_return); -static BOOL ParseRealValue(const char* value_string, - const char** ptr_return, - float* real_return); -static BOOL ParseSeqEnd( - const char* value_string, - const char** ptr_return); -static BOOL ParseSeqStart( - const char* value_string, - const char** ptr_return); -static BOOL ParseUnspecifiedValue( - const char* value_string, - const char** ptr_return); -static int SpanToken( - const char* string); -static int SpanWhitespace( - const char* string); - -/* - * String comparison function. - */ -#ifdef HAVE_STRCASECMP -# define StrnCaseCmp(s1, s2, len) strncasecmp(s1, s2, len) -#else -static int StrnCaseCmp(const char *s1, const char *s2, size_t len); -#endif - -/* - * ------------------------------------------------------------------------ - * Name: XpOidString - * - * Description: - * - * Obtain the string representation of an XpOid. - * - * Example: XpOidString(xpoid_copy_count) returns "copy-count". - * - * Return value: - * - * A const pointer to the string. - */ -const char* -XpOidString(XpOid xp_oid) -{ - /* - * XpOid enum values are index values into the string map - */ - return XpOidStringMap[xp_oid].string; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidStringLength - * - * Description: - * - * Obtain the length of the string representation for a given - * XpOid. - * - * Return value: - * - * The string length in bytes. - * - */ -int -XpOidStringLength(XpOid xp_oid) -{ - /* - * XpOid enum values are index values into the string map - */ - return XpOidStringMap[xp_oid].length; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidFromString - * - * Description: - * - * Obtains the XpOid given a string representation of an XpOid. - * - * Example: XpOidFromString("copy-count") returns 'xpoid_copy_count'. - * - * Return value: - * - * The XpOid if successful. 'xpoid_none' if the string pointed to by - * 'value is not recognized or if 'value' is NULL. - */ -XpOid -XpOidFromString(const char* value) -{ - if(value == (const char*)NULL) - return xpoid_none; - else - return XpOidParse(value, (const char**)NULL); -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidParse - * - * Description: - * - * Parse the next whitespace-delimited string from 'value_string' - * updating 'ptr_return' to point to the next unparsed location in - * 'value_string'. 'ptr_return' can be NULL. - * - * Return value: - * - * The corresponding XpOid for the parsed name string. - * A return value of xpoid_none is returned if the parsed name - * was not a valid oid or if no name was found. - * - */ -static XpOid -XpOidParse(const char* value_string, - const char** ptr_return) -{ - const char* ptr; - int length; - int i; - /* - * skip leading whitespace - */ - ptr = value_string + SpanWhitespace(value_string); - /* - * get the whitespace-delimited token length - */ - length = SpanToken(ptr); - /* - * match the oid string in the map - */ - for(i = 0; i < XpOidStringMapCount; i++) - if(length == XpOidStringMap[i].length) - if(strncmp(ptr, XpOidStringMap[i].string, length) == 0) - break; - if(i == XpOidStringMapCount) - i = xpoid_none; - /* - * update the return pointer and return - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr+length; - return i; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidListNew - * - * Description: - * - * Creates a new XpOidList initialized from a whitespace-delimited - * list of recognized string representations of oids. The returned - * list will contain only oids found within the passed 'valid_oids' - * XpOidList. - * - * Note: One may notice that in order to create an XpOidList with - * this function, an XpOidList is needed; the 'valid_oids' list - * is often an statically initialized structure. XpOidListInit - * can also be used. - * - * Return value: - * - * NULL if the passed 'value_string' is NULL. - * - * If the list indicated by 'value_string' is empty or contains only - * unrecognized oid string representations, a new XpOidList - * containing zero elements is returned. - * - * If 'valid_oids' is NULL all oids are considered valid. - * - */ -XpOidList* -XpOidListNew(const char* value_string, - const XpOidList* valid_oids) -{ - if(value_string == (const char*)NULL) - return (XpOidList*)NULL; - else - { - const char* ptr; - return XpOidListParse(value_string, valid_oids, &ptr, 0); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidListDelete - * - * Description: - * - * Frees the memory allocated for 'list'. - * - * Return value: - * - * None. - * - */ -void -XpOidListDelete(XpOidList* list) -{ - if(list != (XpOidList*)NULL) - { - XpOidFree((char*)list->list); - XpOidFree((char*)list); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidListParse - * - * Description: - * - * This function recursively parses the whitespace-delimited list of - * oid string representations passed via 'value_string'. Oids are - * only added to the resulting list if they are found within the - * passed 'valid_oids' XpOidList. - * - * 'ptr_return' points to a char* variable allocated by the - * caller, and is really only of use during recursion (upon return to - * the original caller, it will point to the end of value_string). - * - * 'value_string' and 'ptr_return' *cannot* be NULL. - * - * Return value: - * - * A newly allocated and initialized XpOidList. - * - * If the list indicated by 'value_string' is empty or contains only - * unrecognized oid string representations, a new XpOidList - * containing zero elements is returned. - * - * If 'valid_oids' is NULL all oids are considered valid. - * - */ -static XpOidList* -XpOidListParse(const char* value_string, - const XpOidList* valid_oids, - const char** ptr_return, - int i) -{ - XpOid oid; - XpOidList* list; - /* - * parse the next valid oid out of the value string - */ - ptr_return = &value_string; - while(1) - { - if(**ptr_return == '\0') - { - /* - * end of value string; stop parsing - */ - oid = xpoid_none; - break; - } - /* - * parse the next oid from the value - */ - oid = XpOidParse(*ptr_return, ptr_return); - if(xpoid_none == oid) - { - /* - * unrecognized oid; keep parsing - */ - continue; - } - if((const XpOidList*)NULL == valid_oids - || - XpOidListHasOid(valid_oids, oid)) - { - /* - * valid oid found; stop parsing - */ - break; - } - } - - if(oid == xpoid_none) - { - /* - * end of value string; allocate the list structure - */ - list = (XpOidList*)XpOidCalloc(1, sizeof(XpOidList)); - list->count = i; - list->list = (XpOid*)XpOidCalloc(i, sizeof(XpOid)); - } - else - { - /* - * recurse - */ - list = XpOidListParse(*ptr_return, valid_oids, ptr_return, i+1); - /* - * set the oid in the list - */ - list->list[i] = oid; - } - /* - * return - */ - return list; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidListHasOid - * - * Description: - * - * Determines if 'oid' is an element of 'list'. - * - * Return value: - * - * xTrue if the oid is found in the list. - * - * xFalse if the oid is not in the list, or if 'list' is NULL. - * - */ -BOOL -XpOidListHasOid(const XpOidList* list, XpOid oid) -{ - int i; - if(list != (XpOidList*)NULL) - for(i = 0; i < list->count; i++) - if(list->list[i] == oid) - return xTrue; - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidListGetIndex - * - * Description: - * - * Returns the array index of 'oid' in 'list' - * - * Return value: - * - * The index of 'oid' in list. - * - * -1 if the oid is not in the list, or if 'list' is NULL. - * - */ -int -XpOidListGetIndex(const XpOidList* list, XpOid oid) -{ - int i; - if(list != (XpOidList*)NULL) - for(i = 0; i < list->count; i++) - if(list->list[i] == oid) - return i; - return -1; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidListString - * - * Description: - * - * Creates a string representation of an XpOidList structure. - * - * Return value: - * - * A newly allocated - * - */ -char* -XpOidListString(const XpOidList* me) -{ - int i; - int length; - char* str; - char* ptr; - /* - * allocate enough memory for the oid string representations, - * including intervening whitespace - */ - for(i = 0, length = 0; i < XpOidListCount(me); i++) - length += XpOidStringLength(XpOidListGetOid(me, i)) + 1; - str = XpOidMalloc(length+1); - /* - * format the list - */ - for(i = 0, ptr = str; i < XpOidListCount(me); i++) -#if defined(sun) && !defined(SVR4) - { - sprintf(ptr, "%s ", XpOidString(XpOidListGetOid(me, i))); - ptr += strlen(ptr); - } -#else - ptr += sprintf(ptr, "%s ", XpOidString(XpOidListGetOid(me, i))); -#endif - /* - * chop trailing whitespace or terminate empty string - */ - str[length] = '\0'; - /* - * return - */ - return str; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListNew - * - * Description: - * - * Creates a new instance of an empty XpOidLinkedList. - * - * Return value: - * - * The new XpOidLinkedList. - * - */ -XpOidLinkedList* -XpOidLinkedListNew() -{ - return (XpOidLinkedList*)XpOidCalloc(1, sizeof(XpOidLinkedList)); -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListDelete - * - * Description: - * - * Frees the memory allocated for a XpOidLinkedList. - * - * Return value: - * - * None. - * - */ -void -XpOidLinkedListDelete(XpOidLinkedList* me) -{ - if(me != (XpOidLinkedList*)NULL) - { - while(me->head) - { - me->current = me->head; - me->head = me->current->next; - XpOidFree((char*)me->current); - } - XpOidFree((char*)me); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListGetOid - * - * Description: - * - * Retrieves the oid at position 'i' (zero-based) in the - * XpOidLinkedList 'me'. - * - * Return value: - * - * The oid at position 'i'. - * - * xpoid_none if the oid was not found, or the list is empty (or if - * the list contains xpoid_none at position 'i'). - */ -XpOid -XpOidLinkedListGetOid(XpOidLinkedList* me, int i) -{ - if(me == (XpOidLinkedList*)NULL || i < 0 || i >= me->count) - { - return xpoid_none; - } - else - { - me->current = me->head; - while(i--) me->current = me->current->next; - return me->current->oid; - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListAddOid - * - * Description: - * - * Adds an oid to the end of an XpOidLinkedList. - * - * Return value: - * - * None. - * - */ -void -XpOidLinkedListAddOid(XpOidLinkedList* me, XpOid oid) -{ - me->current = (XpOidNode)XpOidCalloc(1, sizeof(struct XpOidNodeStruct)); - me->current->oid = oid; - ++me->count; - if(me->tail) - { - me->tail->next = me->current; - me->tail = me->current; - } - else - me->head = me->tail = me->current; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListGetIndex - * - * Description: - * - * Returns the position of an oid in a XpOidLinkedList. - * - * Return value: - * - * The zero-based position of 'oid' in the list. - * - * -1 if the oid is not in the list, or if 'me' is NULL. - * - */ -int -XpOidLinkedListGetIndex(XpOidLinkedList* me, XpOid oid) -{ - if((XpOidLinkedList*)NULL != me) - { - int i = 0; - me->current = me->head; - while(me->current) - if(me->current->oid == oid) - { - return i; - } - else - { - ++i; - me->current = me->current->next; - } - } - return -1; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListHasOid - * - * Description: - * - * Determines if an oid is an element of a XpOidLinkedList. - * - * Return value: - * - * xTrue if the oid is found in the list. - * - * xFalse if the oid is not in the list, or if 'me' is NULL. - */ -BOOL -XpOidLinkedListHasOid(XpOidLinkedList* me, - XpOid oid) -{ - if((XpOidLinkedList*)NULL != me) - { - me->current = me->head; - while(me->current) - if(me->current->oid == oid) - return xTrue; - else - me->current = me->current->next; - } - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListFirstOid - * - * Description: - * - * Positions the XpOidLinkedList 'current' pointer to the first entry - * in the list. - * - * Return value: - * - * The first oid in the list, or xpoid_none if the list NULL or - * empty. - */ -XpOid -XpOidLinkedListFirstOid(XpOidLinkedList* me) -{ - if((XpOidLinkedList*)NULL != me && (me->current = me->head)) - return me->current->oid; - else - return xpoid_none; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidLinkedListNextOid - * - * Description: - * - * Positions the XpOidLinkedList 'current' pointer to the next entry - * in the list. - * - * Return value: - * - * The next oid, or xpoid_none if the end of the list has been - * reached. - */ -XpOid -XpOidLinkedListNextOid(XpOidLinkedList* me) -{ - if(me->current ? (me->current = me->current->next) : xFalse) - return me->current->oid; - else - return xpoid_none; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidMediumSSNew - * - * Description: - * - * Creates a new XpOidMediumSS initialized from a string value - * specified using the medium-source-sizes syntax. See - * MediumSSParse() below for parsing details. - * - * Return value: - * - * NULL if the passed 'value_string' is NULL, or if a syntax error is - * encountered while parsing the medium-source-sizes value. - * - */ -XpOidMediumSS* -XpOidMediumSSNew(const char* value_string, - const XpOidList* valid_trays, - const XpOidList* valid_medium_sizes) -{ - if(value_string == (const char*)NULL) - return (XpOidMediumSS*)NULL; - else - { - const char* ptr = value_string + SpanWhitespace(value_string); - if(*ptr == '\0') - return (XpOidMediumSS*)NULL; - else - return MediumSSParse(ptr, valid_trays, valid_medium_sizes, - &ptr, 0); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: MediumSSParse - * - * Description: - * - * 'ptr_return' *cannot* be NULL. - * - * - * Return value: - * - * - * - */ -static XpOidMediumSS* -MediumSSParse(const char* value_string, - const XpOidList* valid_trays, - const XpOidList* valid_medium_sizes, - const char** ptr_return, - int i) -{ - XpOidMediumSS* medium_ss; - XpOidMediumSourceSize mss; - /* - * check for the start of a new MediumSourceSize sequence - */ - if(ParseSeqStart(value_string, ptr_return)) - { - /* - * check for an unspecified tray value - */ - if(ParseUnspecifiedValue(*ptr_return, ptr_return)) - mss.input_tray = xpoid_unspecified; - else - { - const char* tray_str; - *ptr_return += SpanWhitespace(*ptr_return); - tray_str = *ptr_return; - /* - * parse out the input tray - */ - mss.input_tray = XpOidParse(*ptr_return, ptr_return); - if((const XpOidList*)NULL != valid_trays - && - !XpOidListHasOid(valid_trays, mss.input_tray) - ) - mss.input_tray = xpoid_none; - if(xpoid_none == mss.input_tray) - { - char* invalid_tray_str; - int len = *ptr_return - tray_str; - if(len > 0) - { - invalid_tray_str = XpOidMalloc(len+1); - strncpy(invalid_tray_str, tray_str, len); - invalid_tray_str[len] = '\0'; - ErrorF("%s\nInvalid tray (%s) found. Will attempt to continue parsing.\n", - XPMSG_WARN_MSS, invalid_tray_str); - XpOidFree(invalid_tray_str); - } - } - } - /* - * attempt to parse a Continuous MediumSize sequence - */ - mss.ms.continuous_size = - MediumContinuousSizeParse(*ptr_return, ptr_return); - if(mss.ms.continuous_size != (XpOidMediumContinuousSize*)NULL) - { - mss.mstag = XpOidMediumSS_CONTINUOUS; - } - else - { - /* - * not continuous, try Discrete MediumSize - */ - mss.ms.discrete = - MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes, - ptr_return, 0); - if(mss.ms.discrete == (XpOidMediumDiscreteSizeList*)NULL) - { - const char* tray_str; - /* - * syntax error (MediumDiscreteSizeListParse reports error) - */ - switch(mss.input_tray) - { - case xpoid_none: - tray_str = "an invalid"; - break; - case xpoid_unspecified: - tray_str = "default (tray specifier omitted)"; - break; - default: - tray_str = XpOidString(mss.input_tray); - break; - } - ErrorF("%s\nError occurred while parsing medium sizes for %s tray.\n", - XPMSG_WARN_MSS, tray_str); - return NULL; - } - mss.mstag = XpOidMediumSS_DISCRETE; - } - /* - * parse out the MediumSourceSize sequence end - */ - if(!ParseSeqEnd(*ptr_return, ptr_return)) - { - /* - * syntax error - */ - ErrorF("%s\nSequence End expected. Unparsed data: %s\n", - XPMSG_WARN_MSS, *ptr_return); - return NULL; - } - /* - * recurse to parse the next MediumSourceSize sequence - */ - medium_ss = MediumSSParse(*ptr_return, - valid_trays, valid_medium_sizes, - ptr_return, - xpoid_none == mss.input_tray ? i : i+1); - if(medium_ss == (XpOidMediumSS*)NULL - || - xpoid_none == mss.input_tray) - { - /* - * syntax error or invalid tray - clean up - */ - switch(mss.mstag) - { - case XpOidMediumSS_CONTINUOUS: - MediumContinuousSizeDelete(mss.ms.continuous_size); - break; - case XpOidMediumSS_DISCRETE: - MediumDiscreteSizeListDelete(mss.ms.discrete); - break; - } - if(medium_ss == (XpOidMediumSS*)NULL) - /* - * syntax error - return - */ - return NULL; - } - if(xpoid_none != mss.input_tray) - { - /* - * copy the current MediumSourceSize into the array - */ - memmove((medium_ss->mss)+i, &mss, sizeof(XpOidMediumSourceSize)); - } - } - else - { - /* - * MediumSourceSize sequence start not found - */ - if(**ptr_return == '\0') - { - if(0 == i) - { - ErrorF("%s\nNo valid trays found.\n", XPMSG_WARN_MSS); - return NULL; - } - /* - * end of value string; allocate the MediumSS structure - */ - medium_ss = (XpOidMediumSS*)XpOidCalloc(1, sizeof(XpOidMediumSS)); - medium_ss->count = i; - medium_ss->mss = (XpOidMediumSourceSize*) - XpOidCalloc(i, sizeof(XpOidMediumSourceSize)); - } - else - { - /* - * syntax error - */ - ErrorF("%s\nSequence Start expected.\nunparsed data: %s\n", - XPMSG_WARN_MSS, *ptr_return); - return NULL; - } - } - return medium_ss; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidMediumSSDelete - * - * Description: - * - * - * - * Return value: - * - * - * - */ -void -XpOidMediumSSDelete(XpOidMediumSS* me) -{ - if(me != (XpOidMediumSS*)NULL) - { - int i; - for(i = 0; i < me->count; i++) - { - switch((me->mss)[i].mstag) - { - case XpOidMediumSS_CONTINUOUS: - MediumContinuousSizeDelete((me->mss)[i].ms.continuous_size); - break; - case XpOidMediumSS_DISCRETE: - MediumDiscreteSizeListDelete((me->mss)[i].ms.discrete); - break; - } - } - XpOidFree((char*)me); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidMediumSSHasSize - * - * Description: - * - * - * - * Return value: - * - * - * - */ -BOOL -XpOidMediumSSHasSize(XpOidMediumSS* me, XpOid page_size) -{ - int i_mss, i_ds; - XpOidMediumDiscreteSizeList* ds_list; - - if(me != (XpOidMediumSS*)NULL && page_size != xpoid_none) - for(i_mss = 0; i_mss < me->count; i_mss++) - { - switch((me->mss)[i_mss].mstag) - { - case XpOidMediumSS_DISCRETE: - ds_list = (me->mss)[i_mss].ms.discrete; - for(i_ds = 0; i_ds < ds_list->count; i_ds++) - if(page_size == (ds_list->list)[i_ds].page_size) - return xTrue; - break; - - case XpOidMediumSS_CONTINUOUS: - /* - * unsupported - */ - break; - } - } - /* - * return - */ - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidMediumSSString - * - * Description: - * - * Creates a string representation of an XpOidMediumSS structure. - * - * Return value: - * - * A newly allocated - * - */ -char* XpOidMediumSSString(const XpOidMediumSS* me) -{ - int itray, isize; - int valid_size_count; - int length; - char* str; - char* ptr; - XpOidMediumDiscreteSize* ds; - char buf[128]; - /* - * determine the size of the string representation - */ - for(itray = 0, length = 0; itray < XpOidMediumSSCount(me); itray++) - { - if(xpoid_none == me->mss[itray].input_tray - || - XpOidMediumSS_CONTINUOUS == me->mss[itray].mstag) - { - /* - * skip invalid tray or unsupported continuous size spec - */ - continue; - } - for(isize = 0, valid_size_count = 0; - isize < me->mss[itray].ms.discrete->count; - isize++) - { - ds = me->mss[itray].ms.discrete->list+isize; - if(ds->page_size == xpoid_none) - continue; - ++valid_size_count; - length += XpOidStringLength(ds->page_size); - length += ds->long_edge_feeds ? 4 : 5; /* "True" or "False" */ -#if defined(sun) && !defined(SVR4) - sprintf(buf, "{%.4f %.4f %.4f %.4f}", - ds->assured_reproduction_area.minimum_x, - ds->assured_reproduction_area.maximum_x, - ds->assured_reproduction_area.minimum_y, - ds->assured_reproduction_area.maximum_y); - length += strlen(buf); -#else - length += sprintf(buf, "{%.4f %.4f %.4f %.4f}", - ds->assured_reproduction_area.minimum_x, - ds->assured_reproduction_area.maximum_x, - ds->assured_reproduction_area.minimum_y, - ds->assured_reproduction_area.maximum_y); -#endif - length += 5; /* "{<size> <feed> <area>} " */ - } - if(valid_size_count == 0) - { - /* - * no valid sizes, skip - */ - continue; - } - if(xpoid_unspecified == me->mss[itray].input_tray) - length += 2; /* "''" */ - else - length += XpOidStringLength(me->mss[itray].input_tray); - length += 4; /* "{<tray> <sizes>} " */ - } - /* - * allocate - */ - str = XpOidMalloc(length+1); - /* - * format - */ - for(itray = 0, ptr = str; itray < XpOidMediumSSCount(me); itray++) - { - if(xpoid_none == me->mss[itray].input_tray - || - XpOidMediumSS_CONTINUOUS == me->mss[itray].mstag) - { - /* - * skip invalid tray or unsupported continuous size spec - */ - continue; - } - /* - * check to ensure all of the specified sizes are valid - */ - for(isize = 0, valid_size_count = 0; - isize < me->mss[itray].ms.discrete->count; - isize++) - { - ds = me->mss[itray].ms.discrete->list+isize; - if(ds->page_size != xpoid_none) - ++valid_size_count; - } - if(valid_size_count == 0) - { - /* - * no valid sizes, skip - */ - continue; - } - - if(xpoid_unspecified == me->mss[itray].input_tray) - { -#if defined(sun) && !defined(SVR4) - sprintf(ptr, "{'' "); - ptr += strlen(ptr); -#else - ptr += sprintf(ptr, "{'' "); -#endif - } - else - { -#if defined(sun) && !defined(SVR4) - sprintf(ptr, "{%s ", XpOidString(me->mss[itray].input_tray)); - ptr += strlen(ptr); -#else - ptr += sprintf(ptr, "{%s ", - XpOidString(me->mss[itray].input_tray)); -#endif - } - for(isize = 0; isize < me->mss[itray].ms.discrete->count; isize++) - { - ds = me->mss[itray].ms.discrete->list+isize; - if(ds->page_size != xpoid_none) -#if defined(sun) && !defined(SVR4) - { - sprintf(ptr, "{%s %s {%.4f %.4f %.4f %.4f}} ", - XpOidString(ds->page_size), - ds->long_edge_feeds ? "True" : "False", - ds->assured_reproduction_area.minimum_x, - ds->assured_reproduction_area.maximum_x, - ds->assured_reproduction_area.minimum_y, - ds->assured_reproduction_area.maximum_y); - ptr += strlen(ptr); - } -#else - ptr += sprintf(ptr, "{%s %s {%.4f %.4f %.4f %.4f}} ", - XpOidString(ds->page_size), - ds->long_edge_feeds ? "True" : "False", - ds->assured_reproduction_area.minimum_x, - ds->assured_reproduction_area.maximum_x, - ds->assured_reproduction_area.minimum_y, - ds->assured_reproduction_area.maximum_y); -#endif - } -#if defined(sun) && !defined(SVR4) - sprintf(ptr, "} "); - ptr += strlen(ptr); -#else - ptr += sprintf(ptr, "} "); -#endif - } - /* - * chop trailing whitespace or terminate empty string - */ - str[length] = '\0'; - /* - * return - */ - return str; -} - -/* - * ------------------------------------------------------------------------ - * Name: MediumContinuousSizeParse - * - * Description: - * - * 'ptr_return' *cannot* be NULL. - * - * - * Return value: - * - * - * - */ -static XpOidMediumContinuousSize* -MediumContinuousSizeParse(const char* value_string, - const char** ptr_return) -{ - const char* first_nonws_ptr; - XpOidMediumContinuousSize* mcs = NULL; - /* - * skip leading whitespace - */ - first_nonws_ptr = value_string + SpanWhitespace(value_string); - /* - * parse out the MediumSize sequence start char - */ - if(!ParseSeqStart(first_nonws_ptr, ptr_return)) - goto MediumContinuousSizeParse_error; - /* - * peek ahead to see if it looks like we actually have a continuous - * size spec (looking for the sequence start char on the 1st range spec) - */ - if(!ParseSeqStart(*ptr_return, (const char**)NULL)) - goto MediumContinuousSizeParse_error; - /* - * Ok, let's go for it - */ - mcs = (XpOidMediumContinuousSize*) - XpOidCalloc(1, sizeof(XpOidMediumContinuousSize)); - /* - * "range across the feed direction" - */ - if(!ParseRealRange(*ptr_return, ptr_return, &mcs->range_across_feed)) - goto MediumContinuousSizeParse_error; - /* - * "increment across the feed direction" (optional, default 0) - */ - if(!ParseUnspecifiedValue(*ptr_return, ptr_return)) - if(!ParseRealValue(*ptr_return, ptr_return, - &mcs->increment_across_feed)) - goto MediumContinuousSizeParse_error; - /* - * "range in the feed direction" - */ - if(!ParseRealRange(*ptr_return, ptr_return, &mcs->range_in_feed)) - goto MediumContinuousSizeParse_error; - /* - * "increment in the feed direction" (optional, default 0) - */ - if(!ParseUnspecifiedValue(*ptr_return, ptr_return)) - if(!ParseRealValue(*ptr_return, ptr_return, - &mcs->increment_in_feed)) - goto MediumContinuousSizeParse_error; - /* - * "long edge feeds" flag (default TRUE) - */ - if(ParseUnspecifiedValue(*ptr_return, ptr_return)) - mcs->long_edge_feeds = xTrue; - else - if(!ParseBoolValue(*ptr_return, ptr_return, &mcs->long_edge_feeds)) - goto MediumContinuousSizeParse_error; - /* - * "generic assured reproduction area" - */ - if(!ParseArea(*ptr_return, ptr_return, &mcs->assured_reproduction_area)) - goto MediumContinuousSizeParse_error; - /* - * parse out the MediumSize sequence end character - */ - if(!ParseSeqEnd(*ptr_return, ptr_return)) - goto MediumContinuousSizeParse_error; - /* - * return - */ - return mcs; - - - MediumContinuousSizeParse_error: - /* - * syntax error - don't log since this function may be called - * as a lookahead - */ - *ptr_return = first_nonws_ptr; - XpOidFree((char*)mcs); - return NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: MediumContinuousSizeDelete - * - * Description: - * - * 'ptr_return' *cannot* be NULL. - * - * - * Return value: - * - * - * - */ -static void -MediumContinuousSizeDelete(XpOidMediumContinuousSize* me) -{ - XpOidFree((char*)me); -} - -/* - * ------------------------------------------------------------------------ - * Name: MediumDiscreteSizeListParse - * - * Description: - * - * 'ptr_return' *cannot* be NULL. - * - * Return value: - * - * - * - */ -static XpOidMediumDiscreteSizeList* -MediumDiscreteSizeListParse(const char* value_string, - const XpOidList* valid_medium_sizes, - const char** ptr_return, - int i) -{ - XpOidMediumDiscreteSizeList* list; - XpOidMediumDiscreteSize mds; - /* - * check for the start of a new MediumSize sequence - */ - if(ParseSeqStart(value_string, ptr_return)) - { - /* - * "page size" - */ - mds.page_size = XpOidParse(*ptr_return, ptr_return); - if((const XpOidList*)NULL != valid_medium_sizes - && - !XpOidListHasOid(valid_medium_sizes, mds.page_size) - ) - mds.page_size = xpoid_none; - /* - * "long edge feeds" flag (default TRUE) - */ - if(ParseUnspecifiedValue(*ptr_return, ptr_return)) - mds.long_edge_feeds = xTrue; - else - if(!ParseBoolValue(*ptr_return, ptr_return, - &mds.long_edge_feeds)) - { - /* - * syntax error - */ - ErrorF("%s\nBoolean expected.\nunparsed data: %s\n", - XPMSG_WARN_MSS, *ptr_return); - return (XpOidMediumDiscreteSizeList*)NULL; - } - /* - * "assured reproduction area" - */ - if(!ParseArea(*ptr_return, ptr_return, - &mds.assured_reproduction_area)) - { - /* - * syntax error - */ - ErrorF("%s\nArea specification error.\nunparsed data: %s\n", - XPMSG_WARN_MSS, *ptr_return); - return (XpOidMediumDiscreteSizeList*)NULL; - } - /* - * parse out the MediumSize sequence end character - */ - if(!ParseSeqEnd(*ptr_return, ptr_return)) - { - ErrorF("%s\nSequence End expected. Unparsed data: %s\n", - XPMSG_WARN_MSS, *ptr_return); - return (XpOidMediumDiscreteSizeList*)NULL; - } - /* - * recurse to parse the next Discrete MediumSize sequence - */ - if(mds.page_size == xpoid_none) - { - list = MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes, - ptr_return, i); - } - else - { - list = MediumDiscreteSizeListParse(*ptr_return, valid_medium_sizes, - ptr_return, i+1); - if(list != (XpOidMediumDiscreteSizeList*)NULL) - { - /* - * copy the current discrete MediumSize into the list - */ - memmove((list->list)+i, &mds, sizeof(XpOidMediumDiscreteSize)); - } - } - } - else - { - /* - * MediumSize sequence start not found; end of the discrete sizes - * list - */ - if(0 == i) - { - ErrorF("%s\nNo valid medium sizes found for tray.\n", - XPMSG_WARN_MSS); - return (XpOidMediumDiscreteSizeList*)NULL; - } - list = (XpOidMediumDiscreteSizeList*) - XpOidCalloc(1, sizeof(XpOidMediumDiscreteSizeList)); - list->count = i; - list->list = (XpOidMediumDiscreteSize*) - XpOidCalloc(i, sizeof(XpOidMediumDiscreteSize)); - } - return list; -} - -/* - * ------------------------------------------------------------------------ - * Name: MediumDiscreteSizeListDelete - * - * Description: - * - * - * - * Return value: - * - * - * - */ -static void -MediumDiscreteSizeListDelete(XpOidMediumDiscreteSizeList* list) -{ - if(list != (XpOidMediumDiscreteSizeList*)NULL) - { - XpOidFree((char*)list->list); - XpOidFree((char*)list); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidTrayMediumListNew - * - * Description: - * - * Only need the valid trays; validation requires bumping up against - * msss using TrayMediumListValidate; this needs valid trays - * because of unspecified trays ion msss, but - * TrayMediumListValidate will take care of invalid sizes... - * - * Return value: - * - * - * - */ -XpOidTrayMediumList* -XpOidTrayMediumListNew(const char* value_string, - const XpOidList* valid_trays, - const XpOidMediumSS* msss) -{ - if(value_string == (const char*)NULL) - return (XpOidTrayMediumList*)NULL; - else - { - const char* ptr; - XpOidTrayMediumList* me; - me = TrayMediumListParse(value_string, valid_trays, &ptr, 0); - if((XpOidTrayMediumList*)NULL != me) - TrayMediumListValidate(me, msss); - return me; - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidTrayMediumListDelete - * - * Description: - * - * - * - * Return value: - * - * - * - */ -void -XpOidTrayMediumListDelete(XpOidTrayMediumList* list) -{ - if(list != (XpOidTrayMediumList*)NULL) - { - XpOidFree((char*)list->list); - XpOidFree((char*)list); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: TrayMediumListParse - * - * Description: - * - * 'ptr_return' *cannot* be NULL. - * - * Return value: - * - * - * - */ -static XpOidTrayMediumList* -TrayMediumListParse(const char* value_string, - const XpOidList* valid_trays, - const char** ptr_return, int i) -{ - XpOidTrayMedium tm; - XpOidTrayMediumList* list; - /* - * check for the start of a new InputTrayMedium sequence - */ - if(ParseSeqStart(value_string, ptr_return)) - { - /* - * "input tray" - */ - tm.input_tray = XpOidParse(*ptr_return, ptr_return); - if((XpOidList*)NULL != valid_trays - && - !XpOidListHasOid(valid_trays, tm.input_tray) - ) - tm.input_tray = xpoid_none; - /* - * "medium" - */ - tm.medium = XpOidParse(*ptr_return, ptr_return); - /* - * parse out the InputTrayMedium sequence end character - */ - if(!ParseSeqEnd(*ptr_return, ptr_return)) - { - ErrorF("%s\n", XPMSG_WARN_ITM); - return NULL; - } - /* - * recurse to parse the next InputTrayMedium sequence - */ - list = TrayMediumListParse(*ptr_return, valid_trays, ptr_return, i+1); - if(list != (XpOidTrayMediumList*)NULL) - { - /* - * copy the current InputTrayMedium into the list - */ - memmove((list->list)+i, &tm, sizeof(XpOidTrayMedium)); - } - } - else - { - /* - * InputTrayMedium sequence start not found - */ - if(**ptr_return == '\0') - { - /* - * end of the list - */ - list = (XpOidTrayMediumList*) - XpOidCalloc(1, sizeof(XpOidTrayMediumList)); - list->count = i; - list->list = (XpOidTrayMedium*) - XpOidCalloc(i, sizeof(XpOidTrayMedium)); - } - else - { - /* - * syntax error - */ - ErrorF("%s\n", XPMSG_WARN_ITM); - return NULL; - } - } - /* - * return - */ - return list; -} - -/* - * ------------------------------------------------------------------------ - * Name: TrayMediumListValidate - * - * Description: - * - * Validate the input-trays-medium list based on a passed - * medium-source-sizes-supported structure. The validated - * input-trays-medium list will have the same number of entries upon - * return from this function. Invalid entries are indicated by - * setting the tray specification to xpoid_none. - * - * Return value: - * - * None. - * - */ -static void -TrayMediumListValidate(XpOidTrayMediumList* me, - const XpOidMediumSS* msss) -{ - int i_mss, i_ds, i_itm; - XpOid current_tray, current_medium; - XpOidMediumDiscreteSizeList* unspecified_tray_ds; - XpOidMediumDiscreteSizeList* tray_ds; - - if(msss == (XpOidMediumSS*)NULL - || - me == (XpOidTrayMediumList*)NULL) - { - return; - } - /* - * loop through the input trays medium list - */ - for(i_itm = 0; i_itm < XpOidTrayMediumListCount(me); i_itm++) - { - current_tray = XpOidTrayMediumListTray(me, i_itm); - if(current_tray == xpoid_none) - continue; - current_medium = XpOidTrayMediumListMedium(me, i_itm); - if(current_medium == xpoid_none) - { - /* - * no medium; invalidate this entry - */ - me->list[i_itm].input_tray = xpoid_none; - continue; - } - /* - * loop through the MediumSourceSizes, looking for an appropriate - * discrete sizes spec for the current tray - */ - unspecified_tray_ds = (XpOidMediumDiscreteSizeList*)NULL; - tray_ds = (XpOidMediumDiscreteSizeList*)NULL; - for(i_mss = 0; - i_mss < msss->count && - tray_ds == (XpOidMediumDiscreteSizeList*)NULL; - i_mss++) - { - switch((msss->mss)[i_mss].mstag) - { - case XpOidMediumSS_DISCRETE: - if((msss->mss)[i_mss].input_tray == current_tray) - tray_ds = (msss->mss)[i_mss].ms.discrete; - else if((msss->mss)[i_mss].input_tray == xpoid_unspecified) - unspecified_tray_ds = (msss->mss)[i_mss].ms.discrete; - break; - - case XpOidMediumSS_CONTINUOUS: - /* - * unsupported - */ - break; - } - } - /* - * if the tray was not matched, use the unspecified tray size - * list - */ - if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL) - { - if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL) - { - /* - * not even an unspecified tray, invalidate this - * input-trays-medium entry. - */ - me->list[i_itm].input_tray = xpoid_none; - continue; - } - else - tray_ds = unspecified_tray_ds; - } - /* - * loop through the discrete sizes list, looking for a size that - * matches the medium for the current input tray - */ - for(i_ds = 0; i_ds < tray_ds->count; i_ds++) - { - /* - * check to see if the current input tray's medium size - * matches the current discrete size - * - * Note: in the CDEnext SI, medium identifiers coincide with - * medium-size identifiers. If the DP-Medium object is - * ever implemented, this check would need to be - * changed so that the input tray's medium size is - * obtained from the indicated Medium object, and not - * inferred from the medium identifier itself. - */ - if((tray_ds->list)[i_ds].page_size == current_medium) - { - /* - * The current input tray's medium size matches the - * current discrete medium size. - */ - break; - } - } - if(i_ds == tray_ds->count) - { - /* - * The current input tray's medium size was not found in the - * discrete size list; mark the input tray medium entry - * invalid - */ - me->list[i_itm].input_tray = xpoid_none; - } - - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidTrayMediumListString - * - * Description: - * - * Creates a string representation of an XpOidTrayMediumList structure. - * - * Return value: - * - * A newly allocated - * - */ -char* XpOidTrayMediumListString(const XpOidTrayMediumList* me) -{ - int i; - int length; - char* str; - char* ptr; - XpOid tray; - /* - * allocate enough memory for the string representation, - * including intervening delimiters and whitespace - */ - for(i = 0, length = 0; i < XpOidTrayMediumListCount(me); i++) - { - tray = XpOidTrayMediumListTray(me, i); - if(xpoid_none != tray) - { - length += XpOidStringLength(tray); - length += XpOidStringLength(XpOidTrayMediumListMedium(me, i)); - length += 4; - } - } - str = XpOidMalloc(length+1); - /* - * format the list - */ - for(i = 0, ptr = str; i < XpOidTrayMediumListCount(me); i++) - { - tray = XpOidTrayMediumListTray(me, i); - if(xpoid_none != tray) - { -#if defined(sun) && !defined(SVR4) - sprintf(ptr, "{%s %s} ", - XpOidString(tray), - XpOidString(XpOidTrayMediumListMedium(me, i))); - ptr += strlen(ptr); -#else - ptr += sprintf(ptr, "{%s %s} ", - XpOidString(tray), - XpOidString(XpOidTrayMediumListMedium(me, i))); -#endif - } - } - /* - * chop trailing whitespace or terminate empty string - */ - str[length] = '\0'; - /* - * return - */ - return str; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidTrayMediumListHasTray - * - * Description: - * - * Determines if 'tray' is found in 'list'. - * - * Return value: - * - * xTrue if the tray is found in the list. - * - * xFalse if the tray is not in the list, or if 'list' is NULL. - * - */ -BOOL -XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray) -{ - int i; - if(list != (XpOidTrayMediumList*)NULL && tray != xpoid_none) - for(i = 0; i < list->count; i++) - if(XpOidTrayMediumListTray(list, i) == tray) - return xTrue; - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseArea - * - * Description: - * - * Skips leading whitespace and parses out and returns a XpOidArea. - * - * Return value: - * - * xTrue if the XpOidArea was successfully parsed. ptr_return is - * updated to point to location where the parsing ended. - * - * xFalse if a XpOidArea was not found; ptr_return is updated - * to point to the first non-whitespace char in value_string. - * - */ -static BOOL -ParseArea(const char* value_string, - const char** ptr_return, - XpOidArea* area_return) -{ - const char* first_nonws_ptr; - const char* ptr; - /* - * skip leading whitespace - */ - first_nonws_ptr = value_string + SpanWhitespace(value_string); - /* - * parse out the area sequence start - */ - if(!ParseSeqStart(first_nonws_ptr, &ptr)) - goto ParseArea_error; - /* - * parse the minimum x value - */ - if(!ParseRealValue(ptr, &ptr, - area_return ? &area_return->minimum_x : NULL)) - goto ParseArea_error; - /* - * parse the maximum x value - */ - if(!ParseRealValue(ptr, &ptr, - area_return ? &area_return->maximum_x : NULL)) - goto ParseArea_error; - /* - * parse the minimum y value - */ - if(!ParseRealValue(ptr, &ptr, - area_return ? &area_return->minimum_y : NULL)) - goto ParseArea_error; - /* - * parse the maximum y value - */ - if(!ParseRealValue(ptr, &ptr, - area_return ? &area_return->maximum_y : NULL)) - goto ParseArea_error; - /* - * parse out the area sequence end - */ - if(!ParseSeqEnd(ptr, &ptr)) - goto ParseArea_error; - /* - * update the return pointer - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - /* - * return - */ - return xTrue; - - - ParseArea_error: - /* - * syntax error - */ - if(ptr_return != (const char**)NULL) - *ptr_return = first_nonws_ptr; - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseRealRange - * - * Description: - * - * Skips leading whitespace and parses out and returns a - * XpOidRealRange. - * - * Return value: - * - * xTrue if the XpOidRealRange was successfully - * parsed. ptr_return is updated to point to location where the - * parsing ended. - * - * xFalse if a XpOidRealRange was not found; ptr_return is - * updated to point to the first non-whitespace char in value_string. - * - */ -static BOOL -ParseRealRange(const char* value_string, - const char** ptr_return, - XpOidRealRange* range_return) -{ - const char* first_nonws_ptr; - const char* ptr; - /* - * skip leading whitespace - */ - first_nonws_ptr = value_string + SpanWhitespace(value_string); - /* - * parse out the range sequence start - */ - if(!ParseSeqStart(first_nonws_ptr, &ptr)) - goto ParseRealRange_error; - /* - * parse the lower bound - */ - if(!ParseRealValue(ptr, &ptr, - range_return ? &range_return->lower_bound : NULL)) - goto ParseRealRange_error; - /* - * parse the upper bound - */ - if(!ParseRealValue(ptr, &ptr, - range_return ? &range_return->upper_bound : NULL)) - goto ParseRealRange_error; - /* - * parse out the range sequence end - */ - if(!ParseSeqEnd(ptr, &ptr)) - goto ParseRealRange_error; - /* - * update the return pointer - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - /* - * return - */ - return xTrue; - - - ParseRealRange_error: - /* - * syntax error - */ - if(ptr_return != (const char**)NULL) - *ptr_return = first_nonws_ptr; - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidNotifyParse - * - * Description: - * - * - * Return value: - * - * - */ -XpOidNotify XpOidNotifyParse(const char* value_string) -{ - const char* ptr = value_string; - - if(value_string == (const char*)NULL) - return XPOID_NOTIFY_NONE; - /* - * look for an event handling profile sequence start - */ - if(!ParseSeqStart(value_string, &ptr)) - { - if('\0' == *ptr) - /* - * empty value is valid - */ - return XPOID_NOTIFY_NONE; - else - return XPOID_NOTIFY_UNSUPPORTED; - } - /* - * look for an event set sequence start - */ - if(!ParseSeqStart(ptr, &ptr)) - { - /* - * check for an empty event handling profile - */ - if(ParseSeqEnd(ptr, &ptr)) - { - ptr += SpanWhitespace(ptr); - if(*ptr == '\0') - /* - * valid empty event handling profile sequence - */ - return XPOID_NOTIFY_NONE; - } - return XPOID_NOTIFY_UNSUPPORTED; - } - /* - * the only event in the set should be report job completed - */ - if(xpoid_val_event_report_job_completed != XpOidParse(ptr, &ptr)) - return XPOID_NOTIFY_UNSUPPORTED; - /* - * event set sequence end - */ - if(!ParseSeqEnd(ptr, &ptr)) - return XPOID_NOTIFY_UNSUPPORTED; - /* - * delivery method of electronic mail - */ - if(xpoid_val_delivery_method_electronic_mail != XpOidParse(ptr, &ptr)) - return XPOID_NOTIFY_UNSUPPORTED; - /* - * event handling profile sequence end - */ - if(!ParseSeqEnd(ptr, &ptr)) - return XPOID_NOTIFY_UNSUPPORTED; - /* - * end of value - */ - ptr += SpanWhitespace(ptr); - if('\0' == *ptr) - /* - * valid supported notification profile - */ - return XPOID_NOTIFY_EMAIL; - else - return XPOID_NOTIFY_UNSUPPORTED; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidNotifyString - * - * Description: - * - * - * Return value: - * - * - */ -const char* XpOidNotifyString(XpOidNotify notify) -{ - switch(notify) - { - case XPOID_NOTIFY_NONE: - return NOTIFY_NONE_STR; - case XPOID_NOTIFY_EMAIL: - return NOTIFY_EMAIL_STR; - case XPOID_NOTIFY_UNSUPPORTED: - return (const char *)NULL; - } - - ErrorF("XpOidNotifyString: Unsupported notify=%ld\n", (long)notify); - return (const char *)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtNew - * - * Description: - * - * - * Return value: - * - * - */ -XpOidDocFmt* -XpOidDocFmtNew(const char* value_string) -{ - XpOidDocFmt* doc_fmt; - const char* ptr; - - if((const char*)NULL == value_string) - return (XpOidDocFmt*)NULL; - ptr = value_string + SpanWhitespace(value_string); - if('\0' == *ptr) - return (XpOidDocFmt*)NULL; - /* - * get the document format from the value string - */ - doc_fmt = (XpOidDocFmt*)XpOidCalloc(1, sizeof(XpOidDocFmt)); - if(xTrue == XpOidDocFmtNext(doc_fmt, ptr, &ptr)) - { - /* - * verify that the document format is the only value specified - */ - ptr += SpanWhitespace(ptr); - if('\0' == *ptr) - /* - * valid document-format value - */ - return doc_fmt; - } - /* - * invalid - */ - XpOidDocFmtDelete(doc_fmt); - ErrorF("%s\n", XPMSG_WARN_DOC_FMT); - return (XpOidDocFmt*)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtDelete - * - * Description: - * - * - * Return value: - * - * - */ -void -XpOidDocFmtDelete(XpOidDocFmt* doc_fmt) -{ - if((XpOidDocFmt*)NULL != doc_fmt) - { - XpOidFree(doc_fmt->format); - XpOidFree(doc_fmt->variant); - XpOidFree(doc_fmt->version); - XpOidFree(doc_fmt); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtString - * - * Description: - * - * - * Return value: - * - * - */ -char* -XpOidDocFmtString(XpOidDocFmt* doc_fmt) -{ - if((XpOidDocFmt*)NULL != doc_fmt) - { - if((char*)NULL != doc_fmt->format) - { - char* str = XpOidMalloc(1+SafeStrLen(doc_fmt->format)+ - 1+SafeStrLen(doc_fmt->variant)+ - 1+SafeStrLen(doc_fmt->version)+ - 1+1); - sprintf(str, "{%s %s %s}", doc_fmt->format, - (char*)NULL != doc_fmt->variant ? doc_fmt->variant : "", - (char*)NULL != doc_fmt->version ? doc_fmt->version : ""); - return str; - } - } - return (char*)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtNext - * - * Description: - * - * Assumes non-NULL value string. - * - * Return value: - * - * - */ -static BOOL -XpOidDocFmtNext(XpOidDocFmt* doc_fmt, - const char* value_string, - const char** ptr_return) -{ - const char* ptr; - const char* first_nonws_ptr; - const char* format; - const char* variant; - const char* version; - int format_len; - int variant_len; - int version_len; - /* - * skip leading whitespace - */ - ptr = value_string + SpanWhitespace(value_string); - first_nonws_ptr = ptr; - /* - * sequence start - */ - if(!ParseSeqStart(ptr, &ptr)) - goto XpOidDocFmtNext_error; - /* - * skip whitepace to the start of the document format, and save the - * location - */ - ptr += SpanWhitespace(ptr); - format = ptr; - /* - * document format - */ - if(0 == (format_len = SpanToken(ptr))) - goto XpOidDocFmtNext_error; - ptr += format_len; - /* - * optional variant - */ - ptr += SpanWhitespace(ptr); - variant = ptr; - if(0 != (variant_len = SpanToken(ptr))) - { - ptr += variant_len; - /* - * optional version - */ - ptr += SpanWhitespace(ptr); - version = ptr; - version_len = SpanToken(ptr); - ptr += version_len; - } - else - version_len = 0; - /* - * sequence end - */ - if(!ParseSeqEnd(ptr, &ptr)) - goto XpOidDocFmtNext_error; - /* - * update return pointer - */ - if((const char**)NULL != ptr_return) - *ptr_return = ptr; - /* - * update the passed document format struct - */ - memset(doc_fmt, 0, sizeof(XpOidDocFmt)); - doc_fmt->format = XpOidMalloc(format_len+1); - strncpy(doc_fmt->format, format, format_len); - doc_fmt->format[format_len] = '\0'; - if(0 < variant_len) - { - doc_fmt->variant = XpOidMalloc(variant_len+1); - strncpy(doc_fmt->variant, variant, variant_len); - doc_fmt->variant[variant_len] = '\0'; - if(0 < version_len) - { - doc_fmt->version = XpOidMalloc(version_len+1); - strncpy(doc_fmt->version, version, version_len); - doc_fmt->version[version_len] = '\0'; - } - } - return xTrue; - - XpOidDocFmtNext_error: - if((const char**)NULL != ptr_return) - *ptr_return = first_nonws_ptr; - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtListNew - * - * Description: - * - * - * Return value: - * - * - */ -XpOidDocFmtList* -XpOidDocFmtListNew(const char* value_string, - const XpOidDocFmtList* valid_fmts) -{ - if((char*)NULL != value_string) - { - const char* ptr; - return XpOidDocFmtListParse(value_string, valid_fmts, &ptr, 0); - } - return (XpOidDocFmtList*)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtListDelete - * - * Description: - * - * - * Return value: - * - * - */ -void -XpOidDocFmtListDelete(XpOidDocFmtList* list) -{ - if((XpOidDocFmtList*)NULL != list) - { - int i; - for(i = 0; i < list->count; i++) - { - XpOidFree(list->list[i].format); - XpOidFree(list->list[i].variant); - XpOidFree(list->list[i].version); - } - XpOidFree(list->list); - XpOidFree(list); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtListString - * - * Description: - * - * Assumes the passed structure is valid. - * - * Return value: - * - * - */ -char* -XpOidDocFmtListString(const XpOidDocFmtList* list) -{ - if((XpOidDocFmtList*)NULL != list) - { - if(0 < list->count) - { - int i; - int str_len; - char* str; - char* ptr; - /* - * allocate the return string - */ - for(i = 0, str_len = 0; i < list->count; i++) - { - str_len += - 1 + SafeStrLen(list->list[i].format) + - 1 + SafeStrLen(list->list[i].variant) + - 1 + SafeStrLen(list->list[i].version) + 2; - } - str = XpOidMalloc(str_len+1); - /* - * print the list into the string and return it - */ - ptr = str; - for(i = 0; i < list->count; i++) - { - XpOidDocFmt* df = &list->list[i]; - -#if defined(sun) && !defined(SVR4) - sprintf(ptr, "{%s %s %s} ", - df->format, - (char*)NULL != df->variant ? df->variant : "", - (char*)NULL != df->version ? df->version : ""); - ptr += strlen(ptr); -#else - ptr += - sprintf(ptr, "{%s %s %s} ", - df->format, - (char*)NULL != df->variant ? df->variant : "", - (char*)NULL != df->version ? df->version : ""); -#endif - } - return str; - } - } - return (char*)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtListParse - * - * Description: - * - * Assumes the passed value_string and ptr_return are non-NULL. - * - * Return value: - * - * - */ -static XpOidDocFmtList* -XpOidDocFmtListParse(const char* value_string, - const XpOidDocFmtList* valid_fmts, - const char** ptr_return, - int i) -{ - XpOidDocFmt doc_fmt; - XpOidDocFmtList* list; - BOOL status; - /* - * get the next document-format from the value string, skipping - * values not found in the passed list of valid formats - */ - *ptr_return = value_string; - while((status = XpOidDocFmtNext(&doc_fmt, *ptr_return, ptr_return)) - && - (const XpOidDocFmtList*)NULL != valid_fmts - && - !XpOidDocFmtListHasFmt(valid_fmts, &doc_fmt) - ); - - if(xFalse == status) - { - if('\0' == **ptr_return) - { - if(0 == i) - { - /* - * empty value string - */ - return (XpOidDocFmtList*)NULL; - } - else - { - /* - * done parsing; allocate the list and return - */ - list = - (XpOidDocFmtList*)XpOidCalloc(1, sizeof(XpOidDocFmtList)); - list->count = i; - list->list = (XpOidDocFmt*)XpOidCalloc(i, sizeof(XpOidDocFmt)); - return list; - } - } - else - { - /* - * invalid document format - */ - ErrorF("%s\n", XPMSG_WARN_DOCFMT_LIST); - return (XpOidDocFmtList*)NULL; - } - } - else - { - /* - * recurse to parse remaining document formats - */ - list = XpOidDocFmtListParse(*ptr_return, valid_fmts, ptr_return, i+1); - if((XpOidDocFmtList*)NULL != list) - { - /* - * add this doc fmt to the list - */ - list->list[i].format = doc_fmt.format; - list->list[i].variant = doc_fmt.variant; - list->list[i].version = doc_fmt.version; - } - return list; - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidDocFmtListHasFmt - * - * Description: - * - * Assumes the passed structure is valid. - * - * Return value: - * - * - */ -BOOL -XpOidDocFmtListHasFmt(const XpOidDocFmtList* list, - const XpOidDocFmt* fmt) -{ - int i; - if(list != (XpOidDocFmtList*)NULL - && - fmt != (XpOidDocFmt*)NULL - && - fmt->format != (char*)NULL - ) - { - for(i = 0; i < list->count; i++) - { - /* - * formats must match - */ - if(strcmp(fmt->format, list->list[i].format) != 0) - continue; - /* - * variants must both be NULL or match - */ - if(fmt->variant == (char*)NULL) - { - if(list->list[i].variant == (char*)NULL) - return xTrue; - else - continue; - } - if(list->list[i].variant == (char*)NULL) - continue; - if(strcmp(fmt->variant, list->list[i].variant) != 0) - continue; - /* - * versions must both be NULL or match - */ - if(fmt->version == (char*)NULL) - { - if(list->list[i].version == (char*)NULL) - return xTrue; - else - continue; - } - if(list->list[i].version == (char*)NULL) - continue; - if(strcmp(fmt->version, list->list[i].version) == 0) - return xTrue; - } - } - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidCardListNew - * - * Description: - * - * - * Return value: - * - * - */ -XpOidCardList* -XpOidCardListNew(const char* value_string, const XpOidCardList* valid_cards) -{ - if((const char*)NULL != value_string) - { - const char* ptr; - - return XpOidCardListParse(value_string, valid_cards, &ptr, 0); - } - else - return (XpOidCardList*)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidCardListDelete - * - * Description: - * - * - * Return value: - * - * - */ -void -XpOidCardListDelete(XpOidCardList* list) -{ - if((XpOidCardList*)NULL != list) - { - XpOidFree(list->list); - XpOidFree(list); - } -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidCardListString - * - * Description: - * - * - * Return value: - * - * - */ -char* -XpOidCardListString(const XpOidCardList* list) -{ - if((XpOidCardList*)NULL != list) - { - char buf[48]; - int str_len; - char* str; - int i; - char* ptr; - /* - * allocate the output string - */ - for(i = 0, str_len = 0; i < list->count; i++) -#if defined(sun) && !defined(SVR4) - { - sprintf(buf, "%lu", list->list[i]) + 1; - str_len += strlen(buf); - } -#else - str_len += sprintf(buf, "%lu", list->list[i]) + 1; -#endif - str = XpOidMalloc(str_len+1); - /* - * write the list to the string - */ - for(i = 0, ptr = str; i < list->count; i++) -#if defined(sun) && !defined(SVR4) - { - sprintf(ptr, "%lu ", list->list[i]); - ptr += strlen(ptr); - } -#else - ptr += sprintf(ptr, "%lu ", list->list[i]); -#endif - return str; - } - else - return (char*)NULL; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidCardListHasCard - * - * Description: - * - * Determines if 'card' is an element of 'list'. - * - * Return value: - * - * xTrue if the card is found in the list. - * - * xFalse if the card is not in the list, or if 'list' is NULL. - * - */ -BOOL -XpOidCardListHasCard(const XpOidCardList* list, unsigned long card) -{ - int i; - if(list != (XpOidCardList*)NULL) - for(i = 0; i < list->count; i++) - if(list->list[i] == card) - return xTrue; - return xFalse; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidCardListParse - * - * Description: - * - * Assumes the passed value_string and ptr_return are non-NULL. - * - * Return value: - * - * - */ -static XpOidCardList* -XpOidCardListParse(const char* value_string, - const XpOidCardList* valid_cards, - const char** ptr_return, - int i) -{ - unsigned long card; - XpOidCardList* list; - BOOL status; - - /* - * get the next card from the value string, skipping values not - * found in the passed list of valid cards - */ - *ptr_return = value_string; - while((status = XpOidParseUnsignedValue(*ptr_return, ptr_return, &card)) - && - (const XpOidCardList*)NULL != valid_cards - && - !XpOidCardListHasCard(valid_cards, card) - ); - - if(xFalse == status) - { - if('\0' == **ptr_return) - { - if(0 == i) - { - /* - * empty value string - */ - return (XpOidCardList*)NULL; - } - else - { - /* - * done parsing; allocate the list and return - */ - list = (XpOidCardList*)XpOidCalloc(1, sizeof(XpOidCardList)); - list->count = i; - list->list = - (unsigned long*)XpOidCalloc(i, sizeof(unsigned long)); - return list; - } - } - else - { - /* - * parsing error - */ - ErrorF("%s\n", XPMSG_WARN_CARD_LIST); - return (XpOidCardList*)NULL; - } - } - else - { - /* - * recurse to parse remaining cardinal values - */ - list = XpOidCardListParse(*ptr_return, valid_cards, ptr_return, i+1); - if((XpOidCardList*)NULL != list) - { - /* - * add this value to the list - */ - list->list[i] = card; - } - return list; - } -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseBoolValue - * - * Description: - * - * - * Return value: - * - * - */ -static BOOL -ParseBoolValue(const char* value_string, - const char** ptr_return, - BOOL* bool_return) -{ - const char* ptr; - int length; - BOOL status; - /* - * skip leading whitespace - */ - ptr = value_string + SpanWhitespace(value_string); - /* - * get the whitespace-delimited token length - */ - length = SpanToken(ptr); - /* - * determine if true or false or bad - */ - if(StrnCaseCmp(ptr, "TRUE", length) == 0) - { - if(bool_return != (BOOL*)NULL) - *bool_return = xTrue; - status = xTrue; - } - else if(StrnCaseCmp(ptr, "FALSE", length) == 0) - { - if(bool_return != (BOOL*)NULL) - *bool_return = xFalse; - status = xTrue; - } - else - { - /* - * syntax error - */ - status = xFalse; - } - /* - * update the return pointer and return - */ - if(ptr_return != (const char**)NULL) - *ptr_return = status ? ptr+length : ptr; - return status; -} - -/* - * ------------------------------------------------------------------------ - * Name: XpOidParseUnsignedValue - * - * Description: - * - * Skips leading whitespace and parses out and returns a unsigned number. - * - * Return value: - * - * xTrue if a unsigned number was successfully parsed. ptr_return is - * updated to point to location where the unsigned number parsing - * ended. - * - * xFalse if a unsigned number was not found; ptr_return is updated - * to point to the first non-whitespace char in value_string. - * - */ -BOOL -XpOidParseUnsignedValue(const char* value_string, - const char** ptr_return, - unsigned long* unsigned_return) -{ - long value; - BOOL status; - const char* first_nonws_ptr; - const char* ptr; - /* - * skip leading whitespace - */ - first_nonws_ptr = value_string + SpanWhitespace(value_string); - value = strtol(first_nonws_ptr, (char**)(&ptr), 0); - if(ptr == first_nonws_ptr || value < 0) - status = xFalse; - else - status = xTrue; - /* - * update return parms - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - if(unsigned_return != (unsigned long*)NULL) - *unsigned_return = (unsigned long)value; - /* - * return - */ - return status; -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseRealValue - * - * Description: - * - * Skips leading whitespace and parses out and returns a real number. - * - * Return value: - * - * xTrue if a real number was successfully parsed. ptr_return is - * updated to point to location where the real number parsing - * ended. - * - * xFalse if a real number was not found; ptr_return is updated - * to point to the first non-whitespace char in value_string. - * - */ -static BOOL -ParseRealValue(const char* value_string, - const char** ptr_return, - float* real_return) -{ - float real_value; - BOOL status; - const char* first_nonws_ptr; - const char* ptr; - /* - * skip leading whitespace - */ - first_nonws_ptr = value_string + SpanWhitespace(value_string); - real_value = (float)strtod(first_nonws_ptr, (char**)(&ptr)); - if(ptr == first_nonws_ptr) - status = xFalse; - else - status = xTrue; - /* - * update return parms - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - if(real_return != (float*)NULL) - *real_return = real_value; - /* - * return - */ - return status; -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseSeqEnd - * - * Description: - * - * Description: - * - * Skips leading whitespace and parses out the sequence end - * character '}'. - * - * Return value: - * - * xTrue if the sequence end character was parsed; ptr_return is - * updated to point to the first char following the sequence end - * character. - * - * xFalse if the sequence end character was not found; ptr_return is - * updated to point to the first non-whitespace char in value_string. - * - */ -static BOOL -ParseSeqEnd(const char* value_string, - const char** ptr_return) -{ - const char* ptr; - BOOL status; - /* - * skip leading whitespace - */ - ptr = value_string + SpanWhitespace(value_string); - /* - * parse out the sequence end character - */ - if(*ptr == '}') - { - status = xTrue; - ++ptr; - } - else - status = xFalse; - /* - * update the return pointer - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - /* - * return - */ - return status; -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseSeqStart - * - * Description: - * - * Skips leading whitespace and parses out the sequence start - * character '{'. - * - * Return value: - * - * xTrue if the sequence start character was parsed; ptr_return is - * updated to point to the first char following the sequence start - * character. - * - * xFalse if the sequence start character was not found; ptr_return is - * updated to point to the first non-whitespace char in value_string. - * - */ -static BOOL -ParseSeqStart(const char* value_string, - const char** ptr_return) -{ - const char* ptr; - BOOL status; - /* - * skip leading whitespace - */ - ptr = value_string + SpanWhitespace(value_string); - /* - * parse out the sequence start character - */ - if(*ptr == '{') - { - status = xTrue; - ++ptr; - } - else - status = xFalse; - /* - * update the return pointer - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - /* - * return - */ - return status; -} - -/* - * ------------------------------------------------------------------------ - * Name: ParseUnspecifiedValue - * - * Description: - * - * Skips leading whitespace and parses out an unspecified optional - * value (i.e. matching '' or "" - skips all data between the set of - * quotes). - * - * Return value: - * - * xTrue if an unspecified value was parsed; ptr_return is updated to - * point to the first char following the trailing quote. - * - * xFalse if an unspecified value was not found; ptr_return is updated - * to point to the first non-whitespace char in value_string. - * - */ -static BOOL -ParseUnspecifiedValue(const char* value_string, - const char** ptr_return) -{ - BOOL status; - const char* ptr; - /* - * skip leading whitespace - */ - ptr = value_string + SpanWhitespace(value_string); - /* - * parse out an unspecified optional value ('' or "") - */ - if(*ptr == '\'' || *ptr == '"') - { - char delim[2]; - - if(ptr_return != (const char**)NULL) - { - delim[0] = *ptr; - delim[1] = '\0'; - /* - * skip over the matching delimiter - */ - ++ptr; - ptr += strcspn(ptr, delim); - if(*ptr != '\0') - ++ptr; - } - status = xTrue; - } - else - status = xFalse; - /* - * update the return pointer - */ - if(ptr_return != (const char**)NULL) - *ptr_return = ptr; - /* - * return - */ - return status; -} - -/* - * ------------------------------------------------------------------------ - * Name: SpanToken - * - * Description: - * - * Returns the length of the initial segment of the passed string - * that consists entirely of non-whitespace and non-sequence - * delimiter characters. - * - * - */ -static int -SpanToken(const char* string) -{ - const char* ptr; - for(ptr = string; - *ptr != '\0' && !isspace(*ptr) && *ptr != '{' && *ptr != '}'; - ++ptr); - return ptr - string; -} - -/* - * ------------------------------------------------------------------------ - * Name: SpanWhitespace - * - * Description: - * - * Returns the length of the initial segment of the passed string - * that consists entirely of whitespace characters. - * - * - */ -static int -SpanWhitespace(const char* string) -{ - const char* ptr; - for(ptr = string; *ptr != '\0' && isspace(*ptr); ++ptr); - return ptr - string; -} - -#ifndef HAVE_STRCASECMP -/* - * ------------------------------------------------------------------------ - * Name: StrnCaseCmp - * - * Description: - * - * Implements strncasecmp() for those platforms that need it. - * - * - */ -static int -StrnCaseCmp(const char *s1, const char *s2, size_t len) -{ - char c1, c2; - int result; - - while (len--) - { - c1 = *s1++; - c2 = *s2++; - result = tolower(c1) - tolower(c2); - - if (result != 0) - return result; - } - - return 0; -} -#endif diff --git a/hw/xprint/Oid.h b/hw/xprint/Oid.h deleted file mode 100644 index 79e85ec64..000000000 --- a/hw/xprint/Oid.h +++ /dev/null @@ -1,293 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _Xp_Oid_h -#define _Xp_Oid_h - -#include <X11/Xproto.h> - -/* - * include the auto-generated XpOid enum definition - */ -#include "OidDefs.h" - -/* - * messages - */ -#define XPMSG_WARN_MSS "Syntax error parsing medium-source-sizes" -#define XPMSG_WARN_ITM "Syntax error parsing input-trays-medium" -#define XPMSG_WARN_DOC_FMT "Syntax error parsing document format" -#define XPMSG_WARN_DOCFMT_LIST "Syntax error parsing document format list" -#define XPMSG_WARN_CARD_LIST "Syntax error parsing cardinal list" - -/* - * macros for memory allocation - */ -#define XpOidMalloc(size) ((char*)Xalloc((unsigned long)(size))) -#define XpOidCalloc(count, size) \ - ((char*)Xcalloc((unsigned long)((count)*(size)))) -#define XpOidFree(mem) (Xfree((unsigned long*)(mem))) - -/* - * list of object identifiers - */ -typedef struct _XpOidList -{ - XpOid* list; - int count; -} XpOidList; - -/* - * linked list of object identifiers - */ -typedef struct XpOidNodeStruct -{ - XpOid oid; - struct XpOidNodeStruct* next; -} *XpOidNode; - -typedef struct _XpOidLinkedList -{ - XpOidNode head; - XpOidNode tail; - XpOidNode current; - int count; -} XpOidLinkedList; - -/* - * XpOidMediumSourceSize and related definitions - */ -typedef struct -{ - float minimum_x; - float maximum_x; - float minimum_y; - float maximum_y; -} XpOidArea; - -typedef struct -{ - float lower_bound; - float upper_bound; -} XpOidRealRange; - -typedef struct -{ - XpOidRealRange range_across_feed; - float increment_across_feed; - XpOidRealRange range_in_feed; - float increment_in_feed; - BOOL long_edge_feeds; - XpOidArea assured_reproduction_area; -} XpOidMediumContinuousSize; - -typedef struct -{ - XpOid page_size; - BOOL long_edge_feeds; - XpOidArea assured_reproduction_area; -} XpOidMediumDiscreteSize; - -typedef struct -{ - XpOidMediumDiscreteSize* list; - int count; -} XpOidMediumDiscreteSizeList; - -typedef struct -{ - XpOid input_tray; /* may be set to xpoid_none or xpoid_unspecified */ - enum { XpOidMediumSS_DISCRETE, XpOidMediumSS_CONTINUOUS } mstag; - union - { - XpOidMediumDiscreteSizeList* discrete; - XpOidMediumContinuousSize* continuous_size; - } ms; /* "ms" is short for medium-size */ - -} XpOidMediumSourceSize; - -typedef struct -{ - XpOidMediumSourceSize* mss; - int count; -} XpOidMediumSS; - - -typedef struct -{ - XpOid input_tray; /* may be set to xpoid_none */ - XpOid medium; -} XpOidTrayMedium; - -typedef struct -{ - XpOidTrayMedium* list; - int count; -} XpOidTrayMediumList; - -typedef enum { - XPOID_NOTIFY_UNSUPPORTED, - XPOID_NOTIFY_NONE, - XPOID_NOTIFY_EMAIL -} XpOidNotify; - -typedef struct -{ - unsigned long *list; - int count; -} XpOidCardList; - -typedef struct -{ - char* format; - char* variant; - char* version; -} XpOidDocFmt; - -typedef struct -{ - XpOidDocFmt* list; - int count; -} XpOidDocFmtList; - - -/* - * XpOid public methods - */ -const char* XpOidString(XpOid); -int XpOidStringLength(XpOid); -XpOid XpOidFromString(const char* value); -BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray); - -/* - * XpOidList public methods - */ -XpOidList* XpOidListNew(const char* value_string, - const XpOidList* valid_oids); -#define XpOidListInit(l, a, c) { (l)->list = (a); (l)->count = (c); } -void XpOidListDelete(XpOidList*); -#define XpOidListCount(l) ((l) ? (l)->count : 0) -#define XpOidListGetOid(l, i) ((l) ? (l)->list[(i)] : xpoid_none) -int XpOidListGetIndex(const XpOidList* list, XpOid oid); -BOOL XpOidListHasOid(const XpOidList* list, XpOid oid); -char* XpOidListString(const XpOidList*); - - -/* - * XpOidLinkedList public methods - */ -XpOidLinkedList* XpOidLinkedListNew(void); -void XpOidLinkedListDelete(XpOidLinkedList*); -#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0) -XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i); -void XpOidLinkedListAddOid(XpOidLinkedList* list, XpOid oid); -int XpOidLinkedListGetIndex(XpOidLinkedList* list, XpOid oid); -BOOL XpOidLinkedListHasOid(XpOidLinkedList* list, - XpOid oid); -XpOid XpOidLinkedListFirstOid(XpOidLinkedList* list); -XpOid XpOidLinkedListNextOid(XpOidLinkedList* list); - -/* - * XpOidMediumSourceSize public methods - */ -XpOidMediumSS* XpOidMediumSSNew(const char* value_string, - const XpOidList* valid_trays, - const XpOidList* valid_medium_sizes); -void XpOidMediumSSDelete(XpOidMediumSS*); -#define XpOidMediumSSCount(me) ((me) ? (me)->count : 0) -BOOL XpOidMediumSSHasSize(XpOidMediumSS*, XpOid medium_size); -char* XpOidMediumSSString(const XpOidMediumSS*); - -/* - * XpOidTrayMediumList public methods - */ -XpOidTrayMediumList* XpOidTrayMediumListNew(const char* value_string, - const XpOidList* valid_trays, - const XpOidMediumSS* msss); -void XpOidTrayMediumListDelete(XpOidTrayMediumList* me); -#define XpOidTrayMediumListCount(me) ((me) ? (me)->count : 0) -#define XpOidTrayMediumListTray(me, i) \ - ((me) ? (me)->list[(i)].input_tray : xpoid_none) -#define XpOidTrayMediumListMedium(me, i) \ - ((me) ? (me)->list[(i)].medium : xpoid_none) -char* XpOidTrayMediumListString(const XpOidTrayMediumList*); - -/* - * XpOidNotify public methods - */ -XpOidNotify XpOidNotifyParse(const char* value_string); -const char* XpOidNotifyString(XpOidNotify notify); - -/* - * XpOidDocFmt public methods - */ -XpOidDocFmt* XpOidDocFmtNew(const char* value_string); -void XpOidDocFmtDelete(XpOidDocFmt*); -char* XpOidDocFmtString(XpOidDocFmt*); - -/* - * XpOidDocFmtList public methods - */ -XpOidDocFmtList* XpOidDocFmtListNew(const char* value_string, - const XpOidDocFmtList* valid_fmts); -void XpOidDocFmtListDelete(XpOidDocFmtList*); -char* XpOidDocFmtListString(const XpOidDocFmtList*); -#define XpOidDocFmtListCount(me) ((me) ? (me)->count : 0) -#define XpOidDocFmtListGetDocFmt(me, i) \ - ((me) ? &(me)->list[(i)] : (XpDocFmt*)NULL) -BOOL XpOidDocFmtListHasFmt(const XpOidDocFmtList* list, - const XpOidDocFmt* fmt); -/* - * XpOidCardList public methods - */ -XpOidCardList* XpOidCardListNew(const char* value_string, - const XpOidCardList* valid_cards); -#define XpOidCardListInit(l, a, c) { (l)->list = (a); (l)->count = (c); } -void XpOidCardListDelete(XpOidCardList*); -char* XpOidCardListString(const XpOidCardList*); -#define XpOidCardListCount(me) ((me) ? (me)->count : 0) -#define XpOidCardListGetCard(me, i) ((me) ? (me)->list[(i)] : 0) -BOOL XpOidCardListHasCard(const XpOidCardList*, unsigned long); - -/* - * misc parsing functions - */ -BOOL XpOidParseUnsignedValue(const char* value_string, - const char** ptr_return, - unsigned long* unsigned_return); - - -#endif /* _Xp_Oid_h - don't add anything after this line */ diff --git a/hw/xprint/OidDefs.h b/hw/xprint/OidDefs.h deleted file mode 100644 index a3b37eaaf..000000000 --- a/hw/xprint/OidDefs.h +++ /dev/null @@ -1,170 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/* This is an automatically-generated file. Do not edit. */ - -typedef enum { - xpoid_none, - xpoid_unspecified, - xpoid_att_descriptor, - xpoid_att_content_orientation, - xpoid_att_copy_count, - xpoid_att_default_printer_resolution, - xpoid_att_default_input_tray, - xpoid_att_default_medium, - xpoid_att_document_format, - xpoid_att_plex, - xpoid_att_xp_listfonts_modes, - xpoid_att_job_name, - xpoid_att_job_owner, - xpoid_att_notification_profile, - xpoid_att_xp_setup_state, - xpoid_att_xp_spooler_command_options, - xpoid_att_content_orientations_supported, - xpoid_att_document_formats_supported, - xpoid_att_dt_pdm_command, - xpoid_att_input_trays_medium, - xpoid_att_medium_source_sizes_supported, - xpoid_att_plexes_supported, - xpoid_att_printer_model, - xpoid_att_printer_name, - xpoid_att_printer_resolutions_supported, - xpoid_att_xp_embedded_formats_supported, - xpoid_att_xp_listfonts_modes_supported, - xpoid_att_xp_page_attributes_supported, - xpoid_att_xp_raw_formats_supported, - xpoid_att_xp_setup_proviso, - xpoid_att_document_attributes_supported, - xpoid_att_job_attributes_supported, - xpoid_att_locale, - xpoid_att_multiple_documents_supported, - xpoid_att_available_compression, - xpoid_att_available_compressions_supported, - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape, - xpoid_val_content_orientation_reverse_portrait, - xpoid_val_content_orientation_reverse_landscape, - xpoid_val_medium_size_iso_a0, - xpoid_val_medium_size_iso_a1, - xpoid_val_medium_size_iso_a2, - xpoid_val_medium_size_iso_a3, - xpoid_val_medium_size_iso_a4, - xpoid_val_medium_size_iso_a5, - xpoid_val_medium_size_iso_a6, - xpoid_val_medium_size_iso_a7, - xpoid_val_medium_size_iso_a8, - xpoid_val_medium_size_iso_a9, - xpoid_val_medium_size_iso_a10, - xpoid_val_medium_size_iso_b0, - xpoid_val_medium_size_iso_b1, - xpoid_val_medium_size_iso_b2, - xpoid_val_medium_size_iso_b3, - xpoid_val_medium_size_iso_b4, - xpoid_val_medium_size_iso_b5, - xpoid_val_medium_size_iso_b6, - xpoid_val_medium_size_iso_b7, - xpoid_val_medium_size_iso_b8, - xpoid_val_medium_size_iso_b9, - xpoid_val_medium_size_iso_b10, - xpoid_val_medium_size_na_letter, - xpoid_val_medium_size_na_legal, - xpoid_val_medium_size_executive, - xpoid_val_medium_size_folio, - xpoid_val_medium_size_invoice, - xpoid_val_medium_size_ledger, - xpoid_val_medium_size_quarto, - xpoid_val_medium_size_iso_c3, - xpoid_val_medium_size_iso_c4, - xpoid_val_medium_size_iso_c5, - xpoid_val_medium_size_iso_c6, - xpoid_val_medium_size_iso_designated_long, - xpoid_val_medium_size_na_10x13_envelope, - xpoid_val_medium_size_na_9x12_envelope, - xpoid_val_medium_size_na_number_10_envelope, - xpoid_val_medium_size_na_7x9_envelope, - xpoid_val_medium_size_na_9x11_envelope, - xpoid_val_medium_size_na_10x14_envelope, - xpoid_val_medium_size_na_number_9_envelope, - xpoid_val_medium_size_na_6x9_envelope, - xpoid_val_medium_size_na_10x15_envelope, - xpoid_val_medium_size_monarch_envelope, - xpoid_val_medium_size_a, - xpoid_val_medium_size_b, - xpoid_val_medium_size_c, - xpoid_val_medium_size_d, - xpoid_val_medium_size_e, - xpoid_val_medium_size_jis_b0, - xpoid_val_medium_size_jis_b1, - xpoid_val_medium_size_jis_b2, - xpoid_val_medium_size_jis_b3, - xpoid_val_medium_size_jis_b4, - xpoid_val_medium_size_jis_b5, - xpoid_val_medium_size_jis_b6, - xpoid_val_medium_size_jis_b7, - xpoid_val_medium_size_jis_b8, - xpoid_val_medium_size_jis_b9, - xpoid_val_medium_size_jis_b10, - xpoid_val_medium_size_hp_2x_postcard, - xpoid_val_medium_size_hp_european_edp, - xpoid_val_medium_size_hp_mini, - xpoid_val_medium_size_hp_postcard, - xpoid_val_medium_size_hp_tabloid, - xpoid_val_medium_size_hp_us_edp, - xpoid_val_medium_size_hp_us_government_legal, - xpoid_val_medium_size_hp_us_government_letter, - xpoid_val_plex_simplex, - xpoid_val_plex_duplex, - xpoid_val_plex_tumble, - xpoid_val_input_tray_top, - xpoid_val_input_tray_middle, - xpoid_val_input_tray_bottom, - xpoid_val_input_tray_envelope, - xpoid_val_input_tray_manual, - xpoid_val_input_tray_large_capacity, - xpoid_val_input_tray_main, - xpoid_val_input_tray_side, - xpoid_val_event_report_job_completed, - xpoid_val_delivery_method_electronic_mail, - xpoid_val_xp_setup_mandatory, - xpoid_val_xp_setup_optional, - xpoid_val_xp_setup_ok, - xpoid_val_xp_setup_incomplete, - xpoid_val_xp_list_glyph_fonts, - xpoid_val_xp_list_internal_printer_fonts, - xpoid_val_available_compressions_0, - xpoid_val_available_compressions_01, - xpoid_val_available_compressions_02, - xpoid_val_available_compressions_03, - xpoid_val_available_compressions_012, - xpoid_val_available_compressions_013, - xpoid_val_available_compressions_023, - xpoid_val_available_compressions_0123 -} XpOid; diff --git a/hw/xprint/OidStrs.h b/hw/xprint/OidStrs.h deleted file mode 100644 index 5ed2089e0..000000000 --- a/hw/xprint/OidStrs.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/* This is an automatically-generated file. Do not edit. */ - -static int XpOidStringMapCount = 127; - -static const XpOidStringMapEntry XpOidStringMap[] = { - { "", 0 }, - { "", 0 }, - { "descriptor", 10 }, - { "content-orientation", 19 }, - { "copy-count", 10 }, - { "default-printer-resolution", 26 }, - { "default-input-tray", 18 }, - { "default-medium", 14 }, - { "document-format", 15 }, - { "plex", 4 }, - { "xp-listfonts-modes", 18 }, - { "job-name", 8 }, - { "job-owner", 9 }, - { "notification-profile", 20 }, - { "xp-setup-state", 14 }, - { "xp-spooler-command-options", 26 }, - { "content-orientations-supported", 30 }, - { "document-formats-supported", 26 }, - { "dt-pdm-command", 14 }, - { "input-trays-medium", 18 }, - { "medium-source-sizes-supported", 29 }, - { "plexes-supported", 16 }, - { "printer-model", 13 }, - { "printer-name", 12 }, - { "printer-resolutions-supported", 29 }, - { "xp-embedded-formats-supported", 29 }, - { "xp-listfonts-modes-supported", 28 }, - { "xp-page-attributes-supported", 28 }, - { "xp-raw-formats-supported", 24 }, - { "xp-setup-proviso", 16 }, - { "document-attributes-supported", 29 }, - { "job-attributes-supported", 24 }, - { "locale", 6 }, - { "multiple-documents-supported", 28 }, - { "available-compression", 21 }, - { "available-compressions-supported", 32 }, - { "portrait", 8 }, - { "landscape", 9 }, - { "reverse-portrait", 16 }, - { "reverse-landscape", 17 }, - { "iso-a0", 6 }, - { "iso-a1", 6 }, - { "iso-a2", 6 }, - { "iso-a3", 6 }, - { "iso-a4", 6 }, - { "iso-a5", 6 }, - { "iso-a6", 6 }, - { "iso-a7", 6 }, - { "iso-a8", 6 }, - { "iso-a9", 6 }, - { "iso-a10", 7 }, - { "iso-b0", 6 }, - { "iso-b1", 6 }, - { "iso-b2", 6 }, - { "iso-b3", 6 }, - { "iso-b4", 6 }, - { "iso-b5", 6 }, - { "iso-b6", 6 }, - { "iso-b7", 6 }, - { "iso-b8", 6 }, - { "iso-b9", 6 }, - { "iso-b10", 7 }, - { "na-letter", 9 }, - { "na-legal", 8 }, - { "executive", 9 }, - { "folio", 5 }, - { "invoice", 7 }, - { "ledger", 6 }, - { "quarto", 6 }, - { "iso-c3", 6 }, - { "iso-c4", 6 }, - { "iso-c5", 6 }, - { "iso-c6", 6 }, - { "iso-designated-long", 19 }, - { "na-10x13-envelope", 17 }, - { "na-9x12-envelope", 16 }, - { "na-number-10-envelope", 21 }, - { "na-7x9-envelope", 15 }, - { "na-9x11-envelope", 16 }, - { "na-10x14-envelope", 17 }, - { "na-number-9-envelope", 20 }, - { "na-6x9-envelope", 15 }, - { "na-10x15-envelope", 17 }, - { "monarch-envelope", 16 }, - { "a", 1 }, - { "b", 1 }, - { "c", 1 }, - { "d", 1 }, - { "e", 1 }, - { "jis-b0", 6 }, - { "jis-b1", 6 }, - { "jis-b2", 6 }, - { "jis-b3", 6 }, - { "jis-b4", 6 }, - { "jis-b5", 6 }, - { "jis-b6", 6 }, - { "jis-b7", 6 }, - { "jis-b8", 6 }, - { "jis-b9", 6 }, - { "jis-b10", 7 }, - { "hp-2x-postcard", 14 }, - { "hp-european-edp", 15 }, - { "hp-mini", 7 }, - { "hp-postcard", 11 }, - { "hp-tabloid", 10 }, - { "hp-us-edp", 9 }, - { "hp-us-government-legal", 22 }, - { "hp-us-government-letter", 23 }, - { "simplex", 7 }, - { "duplex", 6 }, - { "tumble", 6 }, - { "top", 3 }, - { "middle", 6 }, - { "bottom", 6 }, - { "envelope", 8 }, - { "manual", 6 }, - { "large-capacity", 14 }, - { "main", 4 }, - { "side", 4 }, - { "event-report-job-completed", 26 }, - { "electronic-mail", 15 }, - { "xp-setup-mandatory", 18 }, - { "xp-setup-optional", 17 }, - { "xp-setup-ok", 11 }, - { "xp-setup-incomplete", 19 }, - { "xp-list-glyph-fonts", 19 }, - { "xp-list-internal-printer-fonts", 30 }, - { "0", 1 }, - { "01", 2 }, - { "02", 2 }, - { "03", 2 }, - { "012", 3 }, - { "013", 3 }, - { "023", 3 }, - { "0123", 4 } -}; diff --git a/hw/xprint/Util.c b/hw/xprint/Util.c deleted file mode 100644 index eb7f839c9..000000000 --- a/hw/xprint/Util.c +++ /dev/null @@ -1,370 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -/* To get the tempnam() prototype in <stdio.h> */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#if defined(linux) && defined(__STRICT_ANSI__) -#undef __STRICT_ANSI__ -#endif - -#include <X11/Xos.h> /* for unistd.h and string.h */ -#include <stdio.h> -#include <sys/wait.h> -#include <sys/stat.h> -#include "misc.h" -#include "dixstruct.h" - -#include <X11/extensions/Print.h> - -#include "attributes.h" - -#define IN_FILE_STRING "%(InFile)%" -#define OUT_FILE_STRING "%(OutFile)%" - -/* - * ReplaceAnyString returns a string combining the input strings. - * It replaces all occurances of 'target' with the supplied - * 'replacement'. - * The original input string will generally be freed, - * and the caller is responsible for freeing whatever string is returned. - */ -char * -ReplaceAnyString( - char *string, - char *target, - char *replacement) -{ - char *pKeyString; - - if(replacement != (char *)NULL) - { - while((pKeyString = strstr(string, target)) != (char *)NULL) - { - char *newString; - - newString = (char *)xalloc(strlen(string) + strlen(replacement) - - strlen(target) + 1); - strncpy(newString, string, pKeyString - string); - newString[pKeyString - string] = '\0'; - strcat(newString, replacement); - strcat(newString, pKeyString + strlen(target)); - xfree(string); - string = newString; - } - } - - return string; -} - -/* - * ReplaceFileString returns a string combining the input strings. - * It replaces all occurances of IN_FILE_STRING with the supplied - * inFileName, and all occurances of OUT_FILE_STRING with the - * supplied outFileName. The original input string will generally be freed, - * and the caller is responsible for freeing whatever string is returned. - */ -char * -ReplaceFileString( - char *string, - char *inFileName, - char *outFileName) -{ - char *pKeyString, - *pInFileString = IN_FILE_STRING, - *pOutFileString = OUT_FILE_STRING; - - if(inFileName != (char *)NULL) - { - while((pKeyString = strstr(string, pInFileString)) != - (char *)NULL) - { - char *newString; - - newString = (char *)xalloc(strlen(string) + - strlen(inFileName) + 1); - strncpy(newString, string, pKeyString - string); - newString[pKeyString - string] = '\0'; - strcat(newString, inFileName); - strcat(newString, pKeyString + strlen(pInFileString)); - xfree(string); - string = newString; - } - } - - if(outFileName != (char *)NULL) - { - while((pKeyString = strstr(string, pOutFileString)) != - (char *)NULL) - { - char *newString; - - newString = (char *)xalloc(strlen(string) + - strlen(outFileName) + 1); - strncpy(newString, string, pKeyString - string); - newString[pKeyString - string] = '\0'; - strcat(newString, outFileName); - strcat(newString, pKeyString + strlen(pOutFileString)); - xfree(string); - string = newString; - } - } - return string; -} - - -/* - * TransferBytes reads numBytes of data from pSrcFile and writes them - * to pDstFile. It returns the number of bytes actually transfered, - * which will be numBytes if it's successful. Neither pSrcFile nor - * pDstFile are rewound or their pointers otherwise modified prior to - * beginning the transfer. - */ -int -TransferBytes( - FILE *pSrcFile, - FILE *pDstFile, - int numBytes) -{ - char buf[10240]; -#define BUF_SIZE (sizeof(buf)*sizeof(char)) - int bytesWritten = 0; - unsigned bytesToXfer; - - for(bytesToXfer = min(BUF_SIZE, (unsigned)numBytes); - bytesToXfer > 0; - bytesToXfer = min(BUF_SIZE, (unsigned)(numBytes - bytesWritten))) - { - if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer) - return bytesWritten; - if(fwrite((void *)buf, (size_t) 1, bytesToXfer, pDstFile) < bytesToXfer) - return bytesWritten; - bytesWritten += bytesToXfer; - } - return bytesWritten; -} - -/* - * CopyContentsAndDelete - does the work of copying and deleting the - * pre, no, and post raster files as well as the raster file itself. - */ -Bool -CopyContentsAndDelete( - FILE **ppSrcFile, - char **pSrcFileName, - FILE *pDstFile) -{ - struct stat statBuf; - - if(stat(*pSrcFileName, &statBuf) < 0) - return FALSE; - rewind(*ppSrcFile); - if(TransferBytes(*ppSrcFile, pDstFile, - (int)statBuf.st_size) != (int)statBuf.st_size) - return FALSE; - fclose(*ppSrcFile); - *ppSrcFile = (FILE *)NULL; - unlink(*pSrcFileName); - xfree(*pSrcFileName); - *pSrcFileName = (char *)NULL; - - return TRUE; -} - - -#define QUADPAD(x) ((((x)+3)>>2)<<2) - -int -XpSendDocumentData( - ClientPtr client, - FILE *fp, - int fileLen, - int maxBufSize) -{ - xPrintGetDocumentDataReply *pRep; - int bytesWritten; - unsigned bytesToWrite; - int result = Success; - - if(client->clientGone) - return Success; - - pRep = (xPrintGetDocumentDataReply *)xalloc(sz_xPrintGetDocumentDataReply+ - QUADPAD(maxBufSize)); - - for(bytesToWrite = min(maxBufSize, fileLen), - bytesWritten = 0; - bytesToWrite > 0; - bytesToWrite = min(maxBufSize, fileLen - bytesWritten)) - { - pRep->type = X_Reply; - pRep->sequenceNumber = client->sequence; - pRep->length = (QUADPAD(bytesToWrite)) >> 2; - pRep->dataLen = bytesToWrite; - - if(fread((void *)(pRep + 1), 1, bytesToWrite, fp) < bytesToWrite) - { - result = BadAlloc; /* XXX poor error choice? */ - pRep->statusCode = 2; /* XXX Is this the right value??? */ - } - else - pRep->statusCode = 0; /* XXX Ignored??? */ - - pRep->finishedFlag = FALSE; - - if (client->swapped) { - int n; - long l; - - swaps(&pRep->sequenceNumber, n); - swapl(&pRep->length, l); - swapl(&pRep->statusCode, l); /* XXX Why are these longs??? */ - swapl(&pRep->finishedFlag, l); /* XXX Why are these longs??? */ - swapl(&pRep->dataLen, l); - } - - (void)WriteToClient(client, - sz_xPrintGetDocumentDataReply + bytesToWrite, - (char *)pRep); - bytesWritten += bytesToWrite; - } - - xfree(pRep); - return result; -} - -/* - * XpFinishDocData - send a DocumentData reply with the "finishedFlag" - * field set to TRUE. This routine should be called from the EndJob - * function of a driver after the driver has sent all required - * document data (presumably via XpSendDocumentData). - */ -int -XpFinishDocData( - ClientPtr client) -{ - xPrintGetDocumentDataReply rep; - - if(client->clientGone) - return Success; - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.dataLen = 0; - rep.finishedFlag = TRUE; - rep.statusCode = 0; - - if (client->swapped) { - int n; - long l; - - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, l); - swapl(&rep.statusCode, l); /* XXX Why are these longs??? */ - swapl(&rep.finishedFlag, l); /* XXX Why are these longs??? */ - swapl(&rep.dataLen, l); - } - - (void)WriteToClient(client, sz_xPrintGetDocumentDataReply, (char *)&rep); - return Success; -} - -#ifndef HAVE_MKSTEMP -static -char *XpDirName(char *fname) -{ - char *fn, *ptr; - - fn = (char *)xalloc(strlen(fname) + 1); - if (fn) { - strcpy(fn, fname); - ptr = strrchr(fn, '/'); - if (!ptr) { - ptr = fn; - *ptr++ = '.'; - } else if (ptr == fn) - ptr++; - *ptr = '\0'; - } - return fn; -} -#endif - -Bool -XpOpenTmpFile( - char *mode, - char **fname, - FILE **stream) -{ -#ifndef HAVE_MKSTEMP - char *fn = NULL; - - /* note that there is a small race condition here... */ - if (!(*fname = tempnam(NULL, NULL)) || - !(fn = XpDirName(*fname)) || - access(fn, W_OK) || - !(*stream = fopen(*fname, mode))) - - { - xfree(fn); - xfree(*fname); - *fname = NULL; - *stream = NULL; - return FALSE; - } - xfree(fn); -#else - int fd; - - *stream = NULL; - *fname = (char *)xalloc(14); - if (*fname == NULL) - return FALSE; - strcpy(*fname, "/tmp/xpXXXXXX"); - fd = mkstemp(*fname); - if (fd < 0) { - xfree(*fname); - *fname = NULL; - return FALSE; - } - *stream = fdopen(fd, mode); - if (stream == NULL) { - xfree(*fname); - *fname = NULL; - return FALSE; - } -#endif - return TRUE; -} diff --git a/hw/xprint/ValTree.c b/hw/xprint/ValTree.c deleted file mode 100644 index 5f58de7ec..000000000 --- a/hw/xprint/ValTree.c +++ /dev/null @@ -1,191 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> -#include "scrnintstr.h" -#include "validate.h" -#include "windowstr.h" -#include "mi.h" -#include "regionstr.h" -#include "mivalidate.h" - -/* - * XpValidateTree - a validateTree routine which ignores overlapping - * top-level windows when computing the clip lists for such windows. - * This can be used by any driver which maintains a separate memory - * store for each top-level window (with its respective children). - * If the pParent is not the root window, then miValidateTree - * is used unmodified. - * - * The strategy if pParent is the root is to save off the - * current values of pParent->firstChild and pParent->lastChild, - * replacing both with the single child of interest. We save off - * pChild->prevSib and pChild->nextSib, and replace them with NullWindow. - * We save off pParent->clipList, and replace it with - * pParent->winSize - pChild->winSize. We then call miValidateTree - * to do the needed ComputeClips on the pChild's heirarchy. - * pParent's clipList is then recomputed based on the sizes - * of its children, and the saved pointers are restored. - * The trees associated with the siblings of pChild must be descended - * and cleaned of any marks (i.e. the valdata pointer freed, and set to NULL), - * and pParent' AfterValidate structure's exposed field must be updated. - */ -/*ARGSUSED*/ -int -XpValidateTree (pParent, pChild, kind) - WindowPtr pParent; /* Parent to validate */ - WindowPtr pChild; /* First child of pParent that was - * affected */ - VTKind kind; /* What kind of configuration caused call */ -{ - RegionRec origPrntClip; /* orig clipList for parent */ - RegionRec childClip; /* The new borderClip for the current - * child */ - RegionRec tmpPrntClip; /* parent clipList - child borderClip */ - RegionRec exposed; /* For intermediate calculations */ - register ScreenPtr pScreen; - register WindowPtr pWin; - Bool overlap; - int viewvals; - Bool forward; - - WindowPtr origFirstChild, origLastChild, origPrevSib, origNextSib; - - /* - * If we're validating something other than a top-level window, - * then just invoke miValidateTree. - */ - if(pParent->parent != NullWindow) - return miValidateTree(pParent, pChild, kind); - - /* - * If it's a stack change of top levels then it's a no-op for - * this scheme, so we just clean up any marks on windows and return. - */ - if(kind == VTStack) - { - CleanMarks(pParent); - return 1; - } - - pScreen = pParent->drawable.pScreen; - if (pChild == NullWindow) - pChild = pParent->firstChild; - - /* Save off the existing window heirarchy */ - origFirstChild = pParent->firstChild; - origLastChild = pParent->lastChild; - origPrevSib = pChild->prevSib; - origNextSib = pChild->nextSib; - pParent->firstChild = pChild; - pParent->lastChild = pChild; - pChild->prevSib = NullWindow; - pChild->nextSib = NullWindow; - - /* - * Set pParent's clipList to be its winSize minus the pChild's - * borderSize. - */ - origPrntClip = pParent->clipList; - REGION_NULL(pScreen, &tmpPrntClip); - REGION_SUBRACT(pScreen, &tmpPrntClip, &pParent->winSize, - &pChild->borderSize); - pParent->clipList = tmpPrntClip; - - /* - * Call miValidateTree on the pruned tree. - */ - (void) miValidateTree(pParent, pChild, kind); - - /* Restore the saved heirarchy */ - pChild->prevSib = origPrevSib; - pChild->nextSib = origNextSib; - pParent->firstChild = origFirstChild; - pParent->lastChild = origLastChild; - - /* - * Compute pParent's clipList by taking its winSize and subracting - * the borderSize of each of its children. - */ - for(pWin = pParent->firstChild, - REGION_COPY(pScreen, &pParent->clipList, &pParent->winSize); - pWin != NullWindow; - pWin = pWin->nextSib) - { - REGION_SUBTRACT(pScreen, &pParent->clipList, &pParent->clipList, - &pWin->borderSize); - } - - /* - * Compute pParent's AfterValidate structure by subracting the original - * clipList from the newly computed clipList. - */ - REGION_NULL(pScreen, &pParent->valdata->after.exposed); - REGION_SUBTRACT(pScreen, &pParent->valdata->after.exposed, - &pParent->clipList, &origPrntClip); - - /* - * Remove the marks from all but pParent and pChild's heirarchy. - * i.e. from all of pChild's siblings and their children. - */ - for(pWin = pParent->firstChild; pWin != NullWindow; pWin = pWin->nextSib) - { - WindowPtr pCurChild = pWin; - - if(pCurChild == pChild) - continue; - - while (1) - { - if(pCurChild->valdata) - { - xfree(pCurChild->valdata); - pCurChild->valdata = (ValidatePtr)NULL; - } - - if (pCurChild->firstChild) - { - pCurChild = pCurChild->firstChild; - continue; - } - while (!pCurChild->nextSib && (pCurChild != pWin)) - pCurChild = pCurChild->parent; - if (pCurChild == pWin) - break; - pCurChild = pCurChild->nextSib; - } - } -} diff --git a/hw/xprint/attributes.c b/hw/xprint/attributes.c deleted file mode 100644 index e79360496..000000000 --- a/hw/xprint/attributes.c +++ /dev/null @@ -1,1740 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/******************************************************************* -** -** ********************************************************* -** * -** * File: attributes.c -** * -** * Contents: -** * Implementation of the attribute store for Xp. -** * -** * Copyright: Copyright 1995 Hewlett-Packard Company -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/Xproto.h> -#include <stdio.h> -#include <ctype.h> -#include <string.h> -#include <stdlib.h> -#include <sys/wait.h> -#include <pwd.h> -#include <grp.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#if (defined(sun) && defined(SVR4)) || defined(__SCO__) || defined(__UNIXWARE__) -#include <wchar.h> -#endif -#include "scrnintstr.h" - -#include <X11/extensions/Printstr.h> - -#include "attributes.h" - -#include <X11/Xlib.h> -#include <X11/Xresource.h> - -#include "spooler.h" - -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - - -static XrmDatabase CopyDb(XrmDatabase inDb); - -extern XrmDatabase XpSpoolerGetServerAttributes(void); - -static int attrGeneration = 0; - -typedef struct { - XrmDatabase *pDb; - char *qualifier; - char *modelId; -} DbEnumStruct; - -typedef struct { - char *stringDb; - int nextPos; - int space; -} StringDbStruct; - -typedef struct _printerAttrs { - struct _printerAttrs *next; - char *name; - char *qualifier; - XrmDatabase printerAttrs; - XrmDatabase docAttrs; - XrmDatabase jobAttrs; -} PrAttrs, *PrAttrPtr; - -static PrAttrPtr attrList = (PrAttrPtr)NULL; - -typedef struct _systemAttrs { - XrmDatabase doc; - XrmDatabase job; - XrmDatabase printers; - XrmDatabase server; -} SysAttrs, *SysAttrsPtr; - -SysAttrs systemAttributes; - -/* - * attrCtxtPrivIndex hold the attribute store's context private index. - * This index is allocated at the time the attribute store is initialized. - */ -static DevPrivateKey attrCtxtPrivKey = &attrCtxtPrivKey; - -/* - * The ContextAttrs structure descibes the context private space reserved - * by the attribute store. - */ -typedef struct _contextAttrs { - XrmDatabase printerAttrs; - XrmDatabase docAttrs; - XrmDatabase jobAttrs; - XrmDatabase pageAttrs; -} ContextAttrs, *ContextAttrPtr; - -/* - * XPDIR is relative to (i.e. is a subdir of) XPRINTDIR/$LANG. - */ -static const char XPDIR[] = "/print"; -/* - * The following files/directories define or are within subdirectories of the - * above-defined XPDIR. - */ -static const char XPPRINTERATTRFILE[] = "/attributes/printer"; -static const char XPJOBATTRFILE[] = "/attributes/job"; -static const char XPDOCATTRFILE[] = "/attributes/document"; -static const char XPMODELDIR[] = "/models"; - -static char NULL_STRING[] = "\0"; - -/* - * XpGetConfigDirBase returns a string containing the path name of the base - * where the print server configuration directory is localed. - */ -static -char *XpGetConfigDirBase(void) -{ - char *configDir; - - /* - * If the XPCONFIGDIR environment variable is not set, then use the - * compile-time constant XPRINTDIR. XPRINTDIR is passed in on the - * compile command line, and is defined in $(TOP)/config/cf/Project.tmpl. - */ - if((configDir = getenv("XPCONFIGDIR")) == (char *)NULL) - configDir = XPRINTDIR; - - return configDir; -} - -/* - * XpGetConfigDir returns a string containing the path name of the print - * server configuration directory. If the useLocale parameter is False - * the it returns the path to the "/C" directory. If the useLocale - * parameter is True it returns the path to the directory associated with - * $LANG. It makes no attempt to ensure that the directory actually exists. - */ -char * -XpGetConfigDir(Bool useLocale) -{ - char *dirName, *langName, *langDir, *configDir; - Bool freeLangDir = False; - - if(useLocale == False) langDir = "/C"; - else - { - langName = getenv("LC_ALL"); - if (langName == NULL) { - langName = getenv("LANG"); - } - - if(langName == (char *)NULL) - return (char *)NULL; - else - { - if(strcmp(langName, "C") == 0) - return (char *)NULL; - langDir = (char *)xalloc(strlen(langName) + 2); - sprintf(langDir, "/%s", langName); - freeLangDir = True; - } - } - - configDir = XpGetConfigDirBase(); - - dirName = (char *)xalloc(strlen(configDir) + strlen(XPDIR) + - strlen(langDir) + 1); - sprintf(dirName, "%s%s%s", configDir, langDir, XPDIR); - - if(freeLangDir == True) - xfree(langDir); - - return dirName; -} - -/* - * GetMergedDatabase reads and merges xrmdb files from the top-level printer - * config directory, and from the directory associated with the current - * locale (if other than the top-level). - */ -static XrmDatabase -GetMergedDatabase(const char *attrName) -{ - char *dirName, *fileName; - XrmDatabase db; - - if((dirName = XpGetConfigDir(False)) == (char *)NULL) - return (XrmDatabase)NULL; - if((fileName = (char *)xalloc(strlen(dirName) + strlen(attrName) + 1)) == - (char *)NULL) - return (XrmDatabase)NULL; - sprintf(fileName, "%s%s", dirName, attrName); - db = XrmGetFileDatabase(fileName); - xfree(fileName); - xfree(dirName); - - if((dirName = XpGetConfigDir(True)) == (char *)NULL) - return db; - if((fileName = (char *)xalloc(strlen(dirName) + strlen(attrName) + 1)) == - (char *)NULL) - return db; - sprintf(fileName, "%s%s", dirName, attrName); - (void)XrmCombineFileDatabase(fileName, &db, True); - xfree(fileName); - xfree(dirName); - - return db; -} - -/* - * BuildSystemAttributes reads the on-disk configuration files for printers, - * initial job, and initial document attributes. The resulting xrm - * databases are then dissected as needed for each printer. - * It also allocates a contextPrivate space for the attributes, - * reserving space to store pointers to the attribute stores for - * the context. - */ -static void -BuildSystemAttributes(void) -{ - if(systemAttributes.printers != (XrmDatabase)NULL) - XrmDestroyDatabase(systemAttributes.printers); - systemAttributes.printers = GetMergedDatabase(XPPRINTERATTRFILE); - if(systemAttributes.job != (XrmDatabase)NULL) - XrmDestroyDatabase(systemAttributes.job); - systemAttributes.job = GetMergedDatabase(XPJOBATTRFILE); - if(systemAttributes.doc != (XrmDatabase)NULL) - XrmDestroyDatabase(systemAttributes.doc); - systemAttributes.doc = GetMergedDatabase(XPDOCATTRFILE); - if(systemAttributes.server != (XrmDatabase)NULL) - XrmDestroyDatabase(systemAttributes.server); - systemAttributes.server = XpSpoolerGetServerAttributes(); - return; -} - -/* - * AddDbEntry is called by XrmEnumerateDatabase, and adds the supplied - * database entry to the database pointed to within the "DbEnumStruct" - * passed as the client_data (aka "closure"). - */ -static Bool -AddDbEntry( - XrmDatabase *sourceDB, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation *type, - XrmValue *value, - XPointer client_data) -{ - DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data; - XrmName xrm_name[5]; - XrmClass xrm_class[5]; - XrmBinding xrm_bind[3]; - XrmValue realVal; - XrmRepresentation rep_type; - - xrm_name[0] = XrmStringToQuark (pEnumStruct->qualifier); - xrm_class[0] = XrmStringToQuark (pEnumStruct->modelId); - - for(;*quarks; quarks++) - xrm_name[1] = xrm_class[1] = *quarks; - - xrm_name[2] = (XrmQuark)NULL; - xrm_class[2] = (XrmQuark)NULL; - - if(XrmQGetResource (*sourceDB, xrm_name, xrm_class, &rep_type, &realVal)) - { - xrm_bind[0] = XrmBindLoosely; - - xrm_name[0] = xrm_name[1]; - xrm_name[1] = NULLQUARK; - - XrmQPutStringResource(pEnumStruct->pDb, xrm_bind, xrm_name, - (char *)realVal.addr); - } - - return FALSE; -} - -/* - * BuildPrinterAttrs - builds and returns an XrmDatabase for the printer - * of the specified name/qualifier, if we have enough information. - * If we don't have a model-config - * file, then just enumerate the systemAttributes->printers database, - * otherwise read in the model-config database and merge into it the - * systemAttributes->printers database. This database is then enumerated - * with the printer qualifier (and the model name as class if we have it), and - * the resulting elements are stored into the database for this particular - * printer. - */ -static XrmDatabase -BuildPrinterAttrs( - char *printerName, - char *qualifierName) -{ - XrmDatabase printerDB = (XrmDatabase)NULL; - - if(systemAttributes.printers != (XrmDatabase)NULL) - { - char *fileName; - XrmDatabase modelDB = (XrmDatabase)NULL; - XrmName xrm_name[5], xrm_class[2]; - XrmRepresentation rep_type; - XrmValue value; - DbEnumStruct enumStruct; - Bool freeModelDB = False; - /* - * Build the initial db based on the model-config files - */ - xrm_name[0] = XrmStringToQuark (qualifierName); - xrm_name[1] = XrmStringToQuark ("xp-model-identifier"); - xrm_name[2] = (XrmQuark)NULL; - XrmQGetResource (systemAttributes.printers, xrm_name, xrm_name, - &rep_type, &value); - - if(value.addr != (XPointer)NULL) - { - fileName = (char *)xalloc(strlen(XPMODELDIR) + - strlen((char *)value.addr) + - strlen("model-config") + 3); - sprintf(fileName, "%s/%s/%s", XPMODELDIR, value.addr, - "model-config"); - modelDB = GetMergedDatabase(fileName); - xfree(fileName); - if(modelDB != (XrmDatabase)NULL) - { - XrmDatabase tempDB = (XrmDatabase)NULL; - /* - * have to make a temp copy because MergeDatabase destroys - * the "source" database. Merge in the printers DB - */ - tempDB = CopyDb(systemAttributes.printers); - XrmMergeDatabases(tempDB, &modelDB); - freeModelDB = True; - } - } - - /* - * Check to see if we knew the name AND found a database file - */ - if(modelDB == (XrmDatabase)NULL) - modelDB = systemAttributes.printers; - - xrm_name[0] = XrmStringToQuark (qualifierName); - xrm_name[1] = (XrmQuark)NULL; - xrm_class[0] = XrmStringToQuark((char *)value.addr); - xrm_class[1] = (XrmQuark)NULL; - enumStruct.pDb = &printerDB; - enumStruct.qualifier = (char *)qualifierName; - enumStruct.modelId = (char *)value.addr; - XrmEnumerateDatabase(modelDB, xrm_name, xrm_class, XrmEnumAllLevels, - AddDbEntry, (XPointer) &enumStruct); - - if(freeModelDB == True) XrmDestroyDatabase(modelDB); - } - XrmPutStringResource(&printerDB, "*printer-name", printerName); - XrmPutStringResource(&printerDB, "*qualifier", qualifierName); - return printerDB; -} - -/* - * BuildABase - builds an XrmDatabase by enumerating the supplied sourceBase - * database for elements relevant for the printer named by printerName, - * and deriving a class for printerName from the model declared in the - * systemAttributes.printers database. If no model is defined for this - * printer then the printerName is used as the class as well. - * - * This is used to build the initial value document and initial value - * job attribute databases for each printer by searching the system - * level doc and job databases. - */ -static XrmDatabase -BuildABase( - char *printerName, - char *qualifierName, - XrmDatabase sourceBase) -{ - XrmDatabase builtDB = (XrmDatabase)NULL; - - if(sourceBase != (XrmDatabase)NULL) - { - XrmName xrm_name[5], xrm_class[2]; - XrmRepresentation rep_type; - XrmValue value; - DbEnumStruct enumStruct; - - /* - * Retrieve the model name for use as the class. - */ - xrm_name[0] = XrmStringToQuark (printerName); - xrm_name[1] = XrmStringToQuark ("xp-model-identifier"); - xrm_name[2] = (XrmQuark)NULL; - XrmQGetResource (systemAttributes.printers, xrm_name, xrm_name, - &rep_type, &value); - /* - * if we have a model name then use it as the class, otherwise - * just use the printer name as the class as well as the name. - */ - if(value.addr != (XPointer)NULL) - xrm_class[0] = XrmStringToQuark((char *)value.addr); - else - xrm_class[0] = xrm_name[0]; - xrm_class[1] = (XrmQuark)NULL; - - xrm_name[1] = (XrmQuark)NULL; - - enumStruct.pDb = &builtDB; - enumStruct.qualifier = (char *)qualifierName; - enumStruct.modelId = (char *)value.addr; - XrmEnumerateDatabase(sourceBase, xrm_name, xrm_class, XrmEnumAllLevels, - AddDbEntry, (XPointer) &enumStruct); - } - - XrmPutStringResource(&builtDB, "*qualifier", qualifierName); - - return builtDB; -} - -/* - * FreeAttrList is called upon server recycle, and frees the printer - * databases stored in the global attrList. - */ -static void -FreeAttrList(void) -{ - PrAttrPtr pAttr, pNext; - - for(pAttr = attrList, pNext = attrList; - pAttr != (PrAttrPtr)NULL; - pAttr = pNext) - { - pNext = pAttr->next; - if(pAttr->printerAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pAttr->printerAttrs); - if(pAttr->docAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pAttr->docAttrs); - if(pAttr->jobAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pAttr->jobAttrs); - xfree(pAttr->name); - xfree(pAttr->qualifier); - xfree(pAttr); - } - attrList = (PrAttrPtr)NULL; -} - -/* - * XpRehashAttributes - frees the per-printer attribute list and - * calls BuildSystemAttributes to rebuild the overall attribute - * store. It is expected that a caller of this will follow it - * by calling XpBuildAttributeStore for a new list of printers. - */ -int -XpRehashAttributes(void) -{ - if(attrList != (PrAttrPtr)NULL) - FreeAttrList(); - BuildSystemAttributes(); - return Success; -} - -/* - * XpBuildAttributeStore - creates the attribute database associated - * with the specified printer. The first time this is called it - * calls BuildSystemAttributes to create the system-level databases. - */ -void -XpBuildAttributeStore( - char *printerName, - char *qualifierName) -{ - PrAttrPtr pAttr; - - if((pAttr = (PrAttrPtr)xalloc(sizeof(PrAttrs))) == (PrAttrPtr)NULL) - return; - - if(attrGeneration != serverGeneration) - { - if(attrList != (PrAttrPtr)NULL) - FreeAttrList(); - dixRequestPrivate(attrCtxtPrivKey, sizeof(ContextAttrs)); - BuildSystemAttributes(); - - attrGeneration = serverGeneration; - } - - if(attrList == (PrAttrPtr)NULL) - { - pAttr->next = (PrAttrPtr)NULL; - attrList = pAttr; - } - else - { - pAttr->next = attrList; - attrList = pAttr; - } - - pAttr->name = strdup(printerName); - pAttr->qualifier = strdup(qualifierName); - pAttr->printerAttrs = BuildPrinterAttrs(printerName, qualifierName); - pAttr->docAttrs = BuildABase(printerName, qualifierName, - systemAttributes.doc); - pAttr->jobAttrs = BuildABase(printerName, qualifierName, - systemAttributes.job); -} - - -static Bool -StoreEntry( - XrmDatabase *sourceDB, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation *type, - XrmValue *value, - XPointer client_data) -{ - XrmDatabase *outDb = (XrmDatabase *)client_data; - - XrmQPutStringResource(outDb, bindings, quarks, (char *)value->addr); - - return FALSE; -} - -/* - * XpCopyDb - makes a copy of the specified XrmDatabase and returns - * the copy. - */ -static XrmDatabase -CopyDb(XrmDatabase inDb) -{ - XrmDatabase outDb = (XrmDatabase)NULL; - XrmQuark empty = NULLQUARK; - - (void)XrmEnumerateDatabase(inDb, &empty, &empty, XrmEnumAllLevels, - StoreEntry, (XPointer) &outDb); - return outDb; -} - -/* - * XpInitAttributes - initializes the attribute store for the specified - * context. It does this by making copies of the printer, doc, and job - * attributes databases for the printer associated with the context. - */ -void -XpInitAttributes(XpContextPtr pContext) -{ - ContextAttrPtr pCtxtAttrs; - PrAttrPtr pPrAttr = attrList; - - /* Initialize all the pointers to NULL */ - pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - (void)memset((void *)pCtxtAttrs, 0, (size_t) sizeof(ContextAttrs)); - - for(pPrAttr = attrList; pPrAttr != (PrAttrPtr)NULL; pPrAttr = pPrAttr->next) - if(!strcmp(pPrAttr->name, pContext->printerName)) break; - - if(pPrAttr != (PrAttrPtr)NULL) - { - pCtxtAttrs->printerAttrs = CopyDb(pPrAttr->printerAttrs); - pCtxtAttrs->docAttrs = CopyDb(pPrAttr->docAttrs); - pCtxtAttrs->jobAttrs = CopyDb(pPrAttr->jobAttrs); - } -} - -void -XpDestroyAttributes( - XpContextPtr pContext) -{ - ContextAttrPtr pCtxtAttrs; - - pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->printerAttrs); - if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->docAttrs); - if(pCtxtAttrs->jobAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->jobAttrs); - if(pCtxtAttrs->pageAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->pageAttrs); -} - -/* - * XpGetOneAttribute returns the string value of the specified attribute - * in the specified class for the specified print context. If the attribute - * doesn't exist in the database for this context, or if the class database - * doesn't exist for this context, then NULL is returned. The caller must - * not free the returned string, as the returned pointer points into the - * database. This function can also return a value from the server attributes, - * in which case the pContext parameter is ignored. - */ -char * -XpGetOneAttribute( - XpContextPtr pContext, - XPAttributes class, - char *attributeName) -{ - ContextAttrPtr pCtxtAttrs; - XrmDatabase db = (XrmDatabase)NULL; - XrmName xrm_name[3]; - XrmRepresentation rep_type; - XrmValue value; - - if(class == XPServerAttr) - { - if(systemAttributes.server == (XrmDatabase)NULL) - return NULL_STRING; - - xrm_name[0] = XrmStringToQuark (attributeName); - xrm_name[1] = (XrmQuark)NULL; - XrmQGetResource(systemAttributes.server, xrm_name, xrm_name, - &rep_type, &value); - - if(value.addr == (char *)NULL) - return NULL_STRING; - return (char *)value.addr; - } - else - { - pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - switch(class) - { - case XPPrinterAttr: - db = pCtxtAttrs->printerAttrs; - break; - case XPDocAttr: - db = pCtxtAttrs->docAttrs; - break; - case XPJobAttr: - db = pCtxtAttrs->jobAttrs; - break; - case XPPageAttr: - db = pCtxtAttrs->pageAttrs; - break; - default: - break; - } - } - if(db == (XrmDatabase)NULL) - return NULL_STRING; - - xrm_name[0] = XrmStringToQuark ("qualifier"); - xrm_name[1] = (XrmQuark)NULL; - XrmQGetResource(db, xrm_name, xrm_name, &rep_type, &value); - - xrm_name[0] = XrmStringToQuark (value.addr); - xrm_name[1] = XrmStringToQuark (attributeName); - xrm_name[2] = (XrmQuark)NULL; - if(XrmQGetResource(db, xrm_name, xrm_name, &rep_type, &value)) - return (char *)value.addr; - else - return NULL_STRING; -} - -/* - * XpPutOneAttribute updates one attribute for the specified - * context and class. This function is intended for use by the attribute - * validation module which updates the XrmDatabases directly. This - * function does not recognize XPServerAttr. - */ -void -XpPutOneAttribute( - XpContextPtr pContext, - XPAttributes class, - const char* attributeName, - const char* value) -{ - ContextAttrPtr pCtxtAttrs; - XrmDatabase db; - XrmBinding bindings[1]; - XrmQuark quarks[2]; - - pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - switch(class) - { - case XPPrinterAttr: - db = pCtxtAttrs->printerAttrs; - break; - case XPDocAttr: - db = pCtxtAttrs->docAttrs; - break; - case XPJobAttr: - db = pCtxtAttrs->jobAttrs; - break; - case XPPageAttr: - db = pCtxtAttrs->pageAttrs; - break; - default: - return; - } - bindings[0] = XrmBindLoosely; - quarks[0] = XrmStringToQuark(attributeName); - quarks[1] = (XrmQuark)NULL; - XrmQPutStringResource(&db, bindings, quarks, value ? value : ""); -} - - - -/******************************************************************************* - * - * The following routines: ExpandSpace, PutString, PutByte, and AppendEntry - * form the functional core of the GetAttributes routine. Xrm does not - * supply a routine to form a string database from an XrmDatabase, except - * by writing the database to a file. This code avoids the file system - * overhead, but is a bit clunky in its memory management. - * - ******************************************************************************/ - -/* - * ExpandSpace expands the memory allocated for the string database in - * the StringDbStruct passed in, and updates the "space" field of the - * struct to indicate the new amount of space available. - */ -static Bool -ExpandSpace( - StringDbStruct *pStr) -{ - char *newSpace; - - if((newSpace = (char *)xrealloc(pStr->stringDb, pStr->nextPos + pStr->space - + 1024)) == (char *)NULL) - return False; - pStr->space += 1024; - pStr->stringDb = newSpace; - return True; -} - -/* - * PutString puts the contents of a null-terminated string into the string - * database in the StringDbStruct passed in. If there is insufficient room - * for the string, ExpandSpace is called, and the nextPos and space fields - * are updated. - */ -static void -PutString( - StringDbStruct *pStr, - char *pString) -{ - int len = strlen(pString); - - if(len >= pStr->space) - if(!ExpandSpace(pStr)) - return; - strcpy(&pStr->stringDb[pStr->nextPos], pString); - pStr->nextPos += len; - pStr->space -= len; -} - -/* - * PutByte puts a single byte value in to the string database in the passed-in - * StringDbStruct. ExpandSpace is called if there is insufficient room for - * the byte, and the nextPos and space fields are updated. - */ -static void -PutByte( - StringDbStruct *pStr, - char byte) -{ - if(pStr->space <= 1) - if(!ExpandSpace(pStr)) - return; - pStr->stringDb[pStr->nextPos] = byte; - pStr->nextPos++; - pStr->space--; -} - -#define XrmQString XrmPermStringToQuark("String") - -/* - * AppendEntry is called by XrmEnumerateDatabase, and serves to append - * a database entry onto a string database. The passed-in "closure" - * struct contains a pointer to the string, and a count of the remaining - * bytes. If there are insufficient remaining bytes then the struct - * is realloced, and the count of the space remaining is updated. - * Database elements of types other than String are ignored! - * This code is based directly on that in "DumpEntry" in Xrm.c. - */ -static Bool -AppendEntry( - XrmDatabase *db, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation *type, - XrmValuePtr value, - XPointer data) -{ - StringDbStruct *pEnumStr = (StringDbStruct *)data; - Bool firstNameSeen; - unsigned int i; - char *s, c; - - if (*type != XrmQString) - return False; - - for (firstNameSeen = False; *quarks; bindings++, quarks++) { - if (*bindings == XrmBindLoosely) { - PutString(pEnumStr, "*"); - } else if (firstNameSeen) { - PutString(pEnumStr, "."); - } - firstNameSeen = True; - PutString(pEnumStr, XrmQuarkToString(*quarks)); - } - s = value->addr; - i = value->size; - PutString(pEnumStr, ":\t"); - if(i) i--; - - if (i && (*s == ' ' || *s == '\t')) - PutByte(pEnumStr, '\\'); /* preserve leading whitespace */ - - while (i--) { - c = *s++; - if (c == '\n') { - if (i) - PutString(pEnumStr, "\\n\\\n"); - else - PutString(pEnumStr, "\\n"); - } else if (c == '\\') - PutString(pEnumStr, "\\\\"); - else if ((c < ' ' && c != '\t') || - ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0)) - { - char temp[4]; - (void) sprintf(temp, "\\%03o", (unsigned char)c); - PutString(pEnumStr, temp); - } - else - PutByte(pEnumStr, c); - } - PutByte(pEnumStr, '\n'); - pEnumStr->stringDb[pEnumStr->nextPos] = (char)'\0'; - return False; -} - -/* - * XpGetAttributes returns a string database version of the Xrm database - * for the specified context and class. This function can also return the - * contents of the server attributes, in which case the pContext parameter - * is ignored. - * - * The caller is responsible for freeing the returned string, - * unlike XpGetOneAttribute, where the caller must not free the string. - */ -char * -XpGetAttributes( - XpContextPtr pContext, - XPAttributes class) -{ - ContextAttrPtr pCtxtAttrs; - XrmDatabase db = (XrmDatabase)NULL; - StringDbStruct enumStruct; - XrmQuark empty = NULLQUARK; - - if(class == XPServerAttr) - db = systemAttributes.server; - else - { - pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - switch(class) - { - case XPServerAttr: - db = systemAttributes.server; - break; - case XPPrinterAttr: - db = pCtxtAttrs->printerAttrs; - break; - case XPDocAttr: - db = pCtxtAttrs->docAttrs; - break; - case XPJobAttr: - db = pCtxtAttrs->jobAttrs; - break; - case XPPageAttr: - db = pCtxtAttrs->pageAttrs; - break; - default: - break; - } - } - if(db == (XrmDatabase)NULL) - { - char *retval = (char *)xalloc(1); - retval[0] = (char)'\0'; - return retval; - } - - if((enumStruct.stringDb = (char *)xalloc(1024)) == (char *)NULL) - return (char *)NULL; - enumStruct.stringDb[0] = (char)'\0'; - enumStruct.nextPos = 0; - enumStruct.space = 1024; - (void)XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, - AppendEntry, (XPointer) &enumStruct); - - return enumStruct.stringDb; -} - -int -XpAugmentAttributes( - XpContextPtr pContext, - XPAttributes class, - char *attributes) -{ - XrmDatabase db; - ContextAttrPtr pCtxtAttrs; - - db = XrmGetStringDatabase(attributes); - if(db == (XrmDatabase)NULL) return BadAlloc; - - pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - switch(class) - { - case XPPrinterAttr: - XrmMergeDatabases(db, &pCtxtAttrs->printerAttrs); - break; - case XPDocAttr: - XrmMergeDatabases(db, &pCtxtAttrs->docAttrs); - break; - case XPJobAttr: - XrmMergeDatabases(db, &pCtxtAttrs->jobAttrs); - break; - case XPPageAttr: - XrmMergeDatabases(db, &pCtxtAttrs->pageAttrs); - break; - default: - break; - } - return Success; -} - -/* - * XpSetAttributes - sets the attribute stores for a specified context. - */ -int -XpSetAttributes( - XpContextPtr pContext, - XPAttributes class, - char *attributes) -{ - XrmDatabase db; - ContextAttrPtr pCtxtAttrs; - - db = XrmGetStringDatabase(attributes); - if(db == (XrmDatabase)NULL) return BadAlloc; - - pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, - attrCtxtPrivKey); - switch(class) - { - case XPPrinterAttr: - if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->printerAttrs); - pCtxtAttrs->printerAttrs = db; - break; - case XPDocAttr: - if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->docAttrs); - pCtxtAttrs->docAttrs = db; - break; - case XPJobAttr: - if(pCtxtAttrs->jobAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->jobAttrs); - pCtxtAttrs->jobAttrs = db; - break; - case XPPageAttr: - if(pCtxtAttrs->pageAttrs != (XrmDatabase)NULL) - XrmDestroyDatabase(pCtxtAttrs->pageAttrs); - pCtxtAttrs->pageAttrs = db; - break; - default: - break; - } - return Success; -} - -void -XpAddPrinterAttribute( - char *printerName, - char *printerQualifier, - char *attributeName, - char *attributeValue) -{ - PrAttrPtr pAttr; - - for(pAttr = attrList; pAttr != (PrAttrPtr)NULL; pAttr = pAttr->next) - { - if(!strcmp(printerQualifier, pAttr->qualifier)) - { - XrmPutStringResource(&pAttr->printerAttrs, attributeName, - attributeValue); - break; - } - } -} - -const char * -XpGetPrinterAttribute(const char *printerName, - const char *attribute) -{ - PrAttrPtr pAttr; - XrmValue value; - char *type; - - for(pAttr = attrList; pAttr != (PrAttrPtr)NULL; pAttr = pAttr->next) - { - if(!strcmp(printerName, pAttr->qualifier)) - { - char *attrStr; - - attrStr = (char *)xalloc(strlen(printerName) + strlen(attribute) + - 2); - sprintf(attrStr, "%s.%s", printerName, attribute); - XrmGetResource(pAttr->printerAttrs, attrStr, attrStr, - &type, &value); - xfree(attrStr); - break; - } - } - if(value.addr != (XPointer)NULL && strlen(value.addr) != 0) - return value.addr; - else - return ""; -} - -/******************************************************************************* - * - * The following routines are not attribute routines, but are rather - * spooler interface functions. They should presumably move to - * a SpoolerIf.c of some similarly named file. - * - ******************************************************************************/ -#include <locale.h> - -static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\ -*job-attributes-supported: job-name job-owner\ - notification-profile xp-spooler-command-options\n\ -*multiple-documents-supported: False"; - -XrmDatabase -XpSpoolerGetServerAttributes(void) -{ - char *totalAttrs, *localeName; - XrmDatabase db; - - localeName = setlocale(LC_CTYPE, (char *)NULL); - if(!localeName || strlen(localeName) == 0) - localeName = "C"; - - if((totalAttrs = (char *)xalloc(strlen(serverAttrStr) + strlen(localeName) - + 11)) == (char *)NULL) - return (XrmDatabase)NULL; - sprintf(totalAttrs, "%s\n%s\t%s", serverAttrStr, "*locale:", localeName); - - db = XrmGetStringDatabase(totalAttrs); - xfree(totalAttrs); - return db; -} - -/* - * Tailf() works similar to "/bin/tail -f fd_in >fd_out" until - * the process |child| terminates (the child status is - * returned in |child_status|). - * This function is used to copy the stdout/stderr output of a - * child to fd_out until the child terminates. - */ -static -void Tailf(int fd_in, int fd_out, pid_t child, int *child_status) -{ - char b[256]; - ssize_t sz; - Bool childDone = FALSE; - struct timeval timeout; - long fpos = 0; /* XXX: this is not correct for largefile support */ - - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - - for(;;) - { - /* Check whether the child is still alive or not */ - if (waitpid(child, child_status, WNOHANG) == child) - childDone = TRUE; - - /* Copy traffic from |fd_in| to |fd_out| - * (Note we have to use |pread()| here to avoid race conditions - * between a child process writing to the same file using the - * same file pointer (|dup(2)| and |fork(2)| just duplicate the - * file handle but not the pointer)). - */ - while ((sz = pread(fd_in, b, sizeof(b), fpos)) > 0) - { - fpos += sz; - write(fd_out, b, sz); - } - - if (childDone) - break; - - (void)select(0, NULL, NULL, NULL, &timeout); - } -} - -/* - * SendFileToCommand takes three character pointers - the file name, - * the command to execute, - * and the "argv" style NULL-terminated vector of arguments for the command. - * The command is exec'd, and the file contents are sent to the command - * via stdin. - * - * WARNING: This function will try to adopt the userId of the supplied - * user name prior to exec'ing the supplied command. - */ -static void -SendFileToCommand( - XpContextPtr pContext, - char *fileName, - char *pCommand, - char **argVector, - char *userName) -{ - pid_t childPid; - int pipefd[2]; - int status; - struct stat statBuf; - FILE *fp, *outPipe; - FILE *resFp; /* output from launched command */ - int resfd; - - resFp = tmpfile(); - if (resFp == NULL) - { - ErrorF("SendFileToCommand: Cannot open temporary file for command output\n"); - return; - } - resfd = fileno(resFp); - - if(pipe(pipefd)) - { - ErrorF("SendFileToCommand: Cannot open pipe\n"); - fclose(resFp); - return; - } - - if(stat(fileName, &statBuf) < 0 || (int)statBuf.st_size == 0) - { - close(pipefd[0]); - close(pipefd[1]); - fclose(resFp); - return; - } - - fp = fopen(fileName, "r"); - if(fp == (FILE *)NULL) - { - ErrorF("SendFileToCommand: Cannot open scratch spool file '%s'\n", fileName); - close(pipefd[0]); - close(pipefd[1]); - fclose(resFp); - return; - } - - if((childPid = fork()) == 0) - { - close(pipefd[1]); - - /* Replace current stdin with input from the pipe */ - close(STDIN_FILENO); - dup(pipefd[0]); - close(pipefd[0]); - - /* Close current stdout and redirect it to resfd */ - close(STDOUT_FILENO); - dup(resfd); - - /* Close current stderr and redirect it to resfd - * (valgrind may not like that, in this case simply start it using - * % valgrind 50>/dev/tty --logfile-fd=50 <more-options> ./Xprt ... #) - */ - close(STDERR_FILENO); - dup(resfd); - - fclose(resFp); - - /* - * If a user name is specified, try to set our uid to match that - * user name. This is to allow e.g. a banner page to show the - * name of the printing user rather than the user who started - * the print server. - */ - if(userName) - { - uid_t myUid; - - if((myUid = geteuid()) == (uid_t)0) - { - struct passwd *pPasswd; - - if((pPasswd = getpwnam(userName))) - { - if (setgid((gid_t)pPasswd->pw_gid) != 0) - perror("SendFileToCommand: setgid() failure."); - - if (initgroups(userName, (gid_t)pPasswd->pw_gid) != 0) - perror("SendFileToCommand: initgroups() failure."); - - if (setuid((uid_t)pPasswd->pw_uid) != 0) - perror("SendFileToCommand: setuid() failure."); - } - } - } - /* return BadAlloc? */ - if (execv(pCommand, argVector) == -1) { - FatalError("unable to exec '%s'", pCommand); - } - } - else - { - (void) close(pipefd[0]); - - outPipe = fdopen(pipefd[1], "w"); - (void) TransferBytes(fp, outPipe, (int)statBuf.st_size); - - (void) fclose(outPipe); - (void) fclose(fp); - - /* Wait for spooler child (and send all it's output to stderr) */ - Tailf(resfd, STDERR_FILENO, childPid, &status); - - if (status != EXIT_SUCCESS) - { - ErrorF("SendFileToCommand: spooler command returned non-zero status %d.\n", status); - } - - /* Store "xp-spooler-command-results" XPJobAttr that the - * client can fetch it on demand */ - if ((fstat(resfd, &statBuf) >= 0) && (statBuf.st_size >= 0)) - { - long bufSize; - char *buf; - - bufSize = statBuf.st_size; - - /* Clamp buffer size to 4MB to prevent that we allocate giant - * buffers if the spooler goes mad and spams it's stdout/stderr - * channel. */ - bufSize = MIN(bufSize, 4*1024*1024); - - buf = xalloc(bufSize+1); - if (buf != NULL) - { - bufSize = pread(resfd, buf, bufSize, 0); - buf[bufSize]='\0'; - - /* XXX: This should be converted from local multibyte encoding to - * Compound Text encoding first */ - XpPutOneAttribute(pContext, XPJobAttr, "xp-spooler-command-results", buf); - - xfree(buf); - } - } - else - { - ErrorF("SendFileToCommand: fstat() failed.\n"); - } - - fclose(resFp); - } - return; -} - -/* - * ReplaceAllKeywords causes all the predefined keywords (e.g. %options%) - * to be replaced with the appropriate values derived from the attribute - * store for the supplied print context. The ReplaceAnyString utility - * routine is used to perform the actual replacements. - */ - -static char * -ReplaceAllKeywords( - XpContextPtr pContext, - char *command) -{ - char *cmdOpt; - - cmdOpt = XpGetOneAttribute(pContext, XPPrinterAttr, - "xp-spooler-printer-name"); - if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0) - command = ReplaceAnyString(command, "%printer-name%", cmdOpt); - else - command = ReplaceAnyString(command, "%printer-name%", - pContext->printerName); - - cmdOpt = XpGetOneAttribute(pContext, XPDocAttr, "copy-count"); - if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0) - command = ReplaceAnyString(command, "%copy-count%", cmdOpt); - else - command = ReplaceAnyString(command, "%copy-count%", "1"); - - cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, "job-name"); - if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0) - command = ReplaceAnyString(command, "%job-name%", cmdOpt); - else - command = ReplaceAnyString(command, "%job-name%", ""); - - cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, "job-owner"); - if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0) - command = ReplaceAnyString(command, "%job-owner%", cmdOpt); - else - command = ReplaceAnyString(command, "%job-owner%", ""); - - cmdOpt = XpGetOneAttribute(pContext, XPJobAttr, - "xp-spooler-command-options"); - if(cmdOpt != (char *)NULL && strlen(cmdOpt) != 0) - command = ReplaceAnyString(command, "%options%", cmdOpt); - else - command = ReplaceAnyString(command, "%options%", ""); - - /* New in xprint.mozdev.org release 007 - replace "%xpconfigdir%" with - * location of $XPCONFIGDIR */ - command = ReplaceAnyString(command, "%xpconfigdir%", XpGetConfigDirBase()); - - return command; -} - -#ifdef __QNX__ -#define toascii( c ) ((unsigned)(c) & 0x007f) -#endif - -#if defined(CSRG_BASED) || \ - defined(linux) || \ - defined(__CYGWIN__) || \ - (defined(sun) && !defined(SVR4)) || \ - (defined(SVR4) && !defined(sun) && !defined(__UNIXWARE__)) || \ - defined(ISC) || \ - defined(Lynx) || \ - defined(__QNX__) || \ - defined(__APPLE__) -#define iswspace(c) (isascii(c) && isspace(toascii(c))) -#endif - -/* - * GetToken - takes in a string and returns a malloc'd copy of the - * first non-white-space sequence of characters in the string. - * It returns the number of _bytes_ (NOT characters) parsed through - * the inStr to get to the end of the returned token. - */ -static int -GetToken( - char *inStr, - char **outStr) -{ - size_t mbCurMax = MB_CUR_MAX; - wchar_t curChar; - int i, numBytes, byteLen = strlen(inStr); - char *tok; - - /* - * read through any leading white space. - */ - for(i = 0, numBytes = 0; i < byteLen; i += numBytes) - { - numBytes = mbtowc(&curChar, &inStr[i], mbCurMax); - if(!iswspace(curChar)) - break; - } - tok = inStr + i; - - /* - * find the end of the token. - */ - byteLen = strlen(tok); - for(i = 0, numBytes = 0; i < byteLen; i += numBytes) - { - numBytes = mbtowc(&curChar, &tok[i], mbCurMax); - if(iswspace(curChar)) - break; - } - - if((*outStr = (char *)xalloc(i + 1)) == (char *)NULL) - return 0; - strncpy(*outStr, tok, i); - (*outStr)[i] = (char)'\0'; - return (tok + i) - inStr; -} - -static void -FreeVector( - char **vector) -{ - int i; - - if(vector == (char **)NULL) return; - - for(i = 0; vector[i] != (char *)NULL; i++) - xfree(vector[i]); - xfree(vector); -} - - -/* - * AddVector appends the pAddition arg vector to the pTarget arg vector. - * If the pTarget cannot be realloc'd, then pTarget is set to NULL. - */ -static void -AddVector( - char ***pTarget, - char **pAddition) -{ - int numTarget, numAdd, i; - - for(numTarget = 0; (*pTarget)[numTarget] != (char *)NULL; numTarget++) - ; - for(numAdd = 0; pAddition[numAdd] != (char *)NULL; numAdd++) - ; - - *pTarget = (char **)xrealloc((void *)*pTarget, (numTarget + numAdd + 1) * - sizeof(char *)); - if(*pTarget == (char **)NULL) - return; - for(i = 0; i < numAdd; i++) - (*pTarget)[numTarget + i] = pAddition[i]; - - (*pTarget)[numTarget + numAdd] = (char *)NULL; -} - -static char ** -BuildArgVector( - char *argString, - XpContextPtr pContext) -{ - char **pVector; - char *curTok; - int numChars, i; - static int beenHere = 0; /* prevent recursion on embedded %options% - */ - - pVector = (char **)xalloc(sizeof(char *)); - pVector[0] = (char *)NULL; - for(i = 0; (numChars = GetToken(argString, &curTok)) != 0; - i++, argString += numChars) - { - if(beenHere || strcmp(curTok, "%options%")) - { - if(curTok[0] == (char)'\0') - { - xfree(curTok); - } - else - { - pVector = (char **)xrealloc((void *)pVector, - (i + 2)*sizeof(char *)); - if(pVector == (char **)NULL) - return (char **)NULL; - pVector[i] = curTok; - pVector[i + 1] = (char *)NULL; - } - } - else if(!beenHere) - { - char **optionsVec; - - curTok = ReplaceAllKeywords(pContext, curTok); - beenHere = 1; - optionsVec = BuildArgVector(curTok, pContext); - xfree(curTok); - beenHere = 0; - AddVector(&pVector, optionsVec); - xfree(optionsVec); - } - } - if(numChars == 0 && curTok != (char *)NULL) - xfree(curTok); - return pVector; -} - -/* - * VectorizeCommand takes a string and breaks it into a command name and - * an array of character pointers suitable for handing to execv. The - * array is NULL-terminated. - * The returned char * is the command name, and should be freed when no - * longer needed. The array elements returned in the pVector parameter - * should be individually freed, and the array itself should also be - * freed when no longer needed. - */ -static char * -VectorizeCommand( - char *command, - char ***pVector, - XpContextPtr pContext) -{ - char *cmdName; - int numChars; - - if(command == (char *)NULL) - return (char *)NULL; - - numChars = GetToken(command, &cmdName); - - if(cmdName == (char *)NULL) - return (char *)NULL; - - /* Mangle the command name, too... */ - cmdName = ReplaceAllKeywords(pContext, cmdName); - - if(cmdName == (char *)NULL) - return (char *)NULL; - - *pVector = BuildArgVector(command, pContext); - - return cmdName; -} - -int -XpSubmitJob(fileName, pContext) - char *fileName; - XpContextPtr pContext; -{ - char **vector, *cmdNam, *command, *userName; - int i; - - command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command"); - if(command == (char *)NULL || strlen(command) == 0) - { - if( spooler_type ) - { - command = strdup(spooler_type->spool_command); - } - else - { - ErrorF("XpSubmitJob: No default spool command defined.\n"); - } - } - else - { - command = strdup(command); - } - if(command == (char *)NULL) - { - ErrorF("XpSubmitJob: No spooler command found, cannot submit job.\n"); - return BadAlloc; - } - - cmdNam = VectorizeCommand(command, &vector, pContext); - xfree(command); - - if(cmdNam == (char *)NULL) - return BadAlloc; - - for(i = 0; vector[i] != (char *)NULL; i++) - { - vector[i] = ReplaceAllKeywords(pContext, vector[i]); - if(vector[i] == (char *)NULL) - { - xfree(cmdNam); - for(i = 0; vector[i] != (char *)NULL; i++) - xfree(vector[i]); - xfree(vector); - return BadAlloc; - } - } - - userName = XpGetOneAttribute(pContext, XPJobAttr, "job-owner"); - if(userName != (char *)NULL && strlen(userName) == 0) - userName = (char *)NULL; - - SendFileToCommand(pContext, fileName, cmdNam, vector, userName); - - FreeVector(vector); - xfree(cmdNam); - - return Success; -} - -/* - * SearchInputTrays() - * - * Given a tray, return the medium in the tray. Conversely, given a - * medium, return a tray in which it can be found. In either case, - * return NULL if the given tray or medium cannot be found. - */ -#define TRAY 0 -#define MEDIUM 1 - -static char * -SearchInputTrays(XpContextPtr pCon, - int which, - char *val) -{ - char *inputTraysMedium, tray[80], medium[80], *copy; - char *pS, *pE, *pLast; - - inputTraysMedium = XpGetOneAttribute( pCon, XPPrinterAttr, - "input-trays-medium" ); - - copy = strdup( inputTraysMedium ); - pS = copy; - pLast = copy + strlen( copy ); - - while( pS < pLast ) - { - while( *pS && *pS != '{' ) - pS++; - - pE = ++pS; - while( *pE && *pE != '}' ) - pE++; - *pE = '\0'; - - sscanf( pS, "%s %s", tray, medium ); - - if( which == MEDIUM && !strcmp( val, medium ) ) - { - xfree( copy ); - return strdup( tray ); - } - - if( which == TRAY && !strcmp( val, tray ) ) - { - xfree( copy ); - return strdup( medium ); - } - - pS = pE + 1; - } - - xfree( copy ); - return strdup( NULL_STRING ); -} - -/* - * XpGetTrayMediumFromContext() - * - * Given a print context, hit the input-trays-medium, - * default-input-tray and default-medium attributes to find the - * appropriate tray to use, and the medium in that tray. - */ -void -XpGetTrayMediumFromContext(XpContextPtr pCon, - char **medium, - char **tray) -{ - char *defMedium, *defTray; - char *t, *m; - - defMedium = XpGetOneAttribute( pCon, XPPageAttr, - "default-medium" ); - if( *defMedium == '\0' ) - defMedium = XpGetOneAttribute( pCon, XPDocAttr, - "default-medium" ); - - defTray = XpGetOneAttribute( pCon, XPPageAttr, - "default-input-tray" ); - if( *defTray == '\0' ) - defTray = XpGetOneAttribute( pCon, XPDocAttr, - "default-input-tray" ); - - /* - * First, check to see if the default tray has the default medium - * installed. This is the ideal case. - */ - m = SearchInputTrays( pCon, TRAY, defTray ); - if( !strcmp( m, defMedium ) ) - { - xfree( m ); - *tray = strdup( defTray ); - *medium = strdup( defMedium ); - return; - } - - /* - * If the default tray doesn't have the default medium, search for - * a tray which has the default medium. - */ - t = SearchInputTrays( pCon, MEDIUM, defMedium ); - if( t ) - { - *tray = t; - *medium = strdup( defMedium ); - return; - } - - /* - * If all else fails, just return the default tray, and whatever - * medium happens to be there. Note that we simply return - * whatever is in the attribute store. Any further correction is - * left up to the DDX driver. - */ - *tray = strdup( defTray ); - *medium = m; - xfree( t ); -} diff --git a/hw/xprint/attributes.h b/hw/xprint/attributes.h deleted file mode 100644 index 26864a2f0..000000000 --- a/hw/xprint/attributes.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _Xp_attributes_h -#define _Xp_attributes_h 1 - -#include "scrnintstr.h" -#include "AttrValid.h" - -#define BFuncArgs int ndx, ScreenPtr pScreen, int argc, char **argv -typedef Bool (*pBFunc)(BFuncArgs); - -#define VFuncArgs char *name, XpValidatePoolsRec *pValRec, float *width, float *height, int *res -typedef void (*pVFunc)(VFuncArgs); - -/* - * attributes.c - */ -void XpInitAttributes(XpContextPtr pContext); -void XpBuildAttributeStore(char *printerName, - char *qualifierName); -void XpAddPrinterAttribute(char *printerName, - char *printerQualifier, - char *attributeName, - char *attributeValue); -void XpDestroyAttributes(XpContextPtr pContext); -char *XpGetConfigDir(Bool useLocale); -char *XpGetOneAttribute(XpContextPtr pContext, - XPAttributes class, - char *attributeName); -void XpPutOneAttribute(XpContextPtr pContext, - XPAttributes class, - const char* attributeName, - const char* value); -int XpRehashAttributes(void); -char *XpGetAttributes(XpContextPtr pContext, - XPAttributes class); -int XpAugmentAttributes(XpContextPtr pContext, - XPAttributes class, - char *attributes); -int XpSetAttributes(XpContextPtr pContext, - XPAttributes class, - char *attributes); -const char *XpGetPrinterAttribute(const char *printerName, - const char *attribute); -void XpGetTrayMediumFromContext(XpContextPtr pCon, - char **medium, - char **tray); -int XpSubmitJob(char *fileName, XpContextPtr pContext); - -/* - * mediaSizes.c - */ -int XpGetResolution(XpContextPtr pContext); -XpOid XpGetContentOrientation(XpContextPtr pContext); -XpOid XpGetAvailableCompression(XpContextPtr pContext); -XpOid XpGetPlex(XpContextPtr pContext); -XpOid XpGetPageSize(XpContextPtr pContext, - XpOid* pTray, - const XpOidMediumSS* msss); -void XpGetMediumMillimeters(XpOid page_size, - float *width, - float *height); -void XpGetMediumDimensions(XpContextPtr pContext, - unsigned short *width, - unsigned short *height); -void XpGetReproductionArea(XpContextPtr pContext, - xRectangle *pRect); -void XpGetMaxWidthHeightRes(const char *printer_name, - const XpValidatePoolsRec* vpr, - float *width, - float *height, - int* resolution); - -/* Util.c */ -char *ReplaceAnyString(char *string, - char *target, - char *replacement); -char *ReplaceFileString(char *string, - char *inFileName, - char *outFileName); -int TransferBytes(FILE *pSrcFile, - FILE *pDstFile, - int numBytes); -Bool CopyContentsAndDelete(FILE **ppSrcFile, - char **pSrcFileName, - FILE *pDstFile); -int XpSendDocumentData(ClientPtr client, - FILE *fp, - int fileLen, - int maxBufSize); -int XpFinishDocData(ClientPtr client); -Bool XpOpenTmpFile(char *mode, - char **fname, - FILE **stream); - -#endif /* _Xp_attributes_h */ diff --git a/hw/xprint/config/C/Makefile.am b/hw/xprint/config/C/Makefile.am deleted file mode 100644 index 0390ed2d4..000000000 --- a/hw/xprint/config/C/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = print diff --git a/hw/xprint/config/C/print/Makefile.am b/hw/xprint/config/C/print/Makefile.am deleted file mode 100644 index e3c01da60..000000000 --- a/hw/xprint/config/C/print/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -SUBDIRS = attributes ddx-config models - -xpcdir = @xpconfigdir@/C/print - - -Xprinters.ghostscript: $(srcdir)/Xprinters - sed < $(srcdir)/Xprinters "s/#Printer xp_pdf_spooldir_tmp_Xprintjobs/Printer xp_pdf_spooldir_tmp_Xprintjobs/" > Xprinters.ghostscript - - - -dist_xpc_DATA = Xprinters -xpc_DATA = Xprinters.ghostscript - -CLEANFILES = Xprinters.ghostscript diff --git a/hw/xprint/config/C/print/Xprinters b/hw/xprint/config/C/print/Xprinters deleted file mode 100644 index a32c02dc2..000000000 --- a/hw/xprint/config/C/print/Xprinters +++ /dev/null @@ -1,49 +0,0 @@ -######################################################################## -# -# $Xorg: Xprinters,v 1.3 2000/08/17 19:48:02 cpqbld Exp $ -# -# X*printers sample configuration file -# -# -# This file belongs in /usr/lib/X11/X*printers, where the "*" is the -# display number of the server. For example, if the server is -# invoked using the command X :0, then the X0printers file is used. -######################################################################## - -######################################################################## -# Use lpstat to augment the list of printers managed by the -# server. (This is the default behavior if the X*printers file does -# not exist, or if an "Augment_Printer_List" line is not specified.) -######################################################################## -#Augment_Printer_List %(default)% - -######################################################################## -# Use the specified command pipeline to augment the list of printers -# managed by the server. -######################################################################## -#Augment_Printer_List lpstat -a | cut -d " " -f 1 # equivalent to default - -######################################################################## -# Do not augment the list of printers managed by the server. -######################################################################## -#Augment_Printer_List %none% - -######################################################################## -# Preconfigured entry for the PSspooldir model -# (which sends jobs to /tmp/Xprintjobs instead to a physical printer) -######################################################################## -#Printer xp_pdf_spooldir_tmp_Xprintjobs -Printer xp_ps_spooldir_tmp_Xprintjobs - -######################################################################## -# Add individual printers to the list of printers managed by the -# server. These are aliases, determined by driver name. -######################################################################## - - -# EXAMPLES -# -# Printer xppspr -# Printer xppclpr -# Printer xppclmonopr -# Printer xprasterpr diff --git a/hw/xprint/config/C/print/attributes/Makefile.am b/hw/xprint/config/C/print/attributes/Makefile.am deleted file mode 100644 index 0d2cceaff..000000000 --- a/hw/xprint/config/C/print/attributes/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/attributes - -dist_xpc_DATA = document job printer diff --git a/hw/xprint/config/C/print/attributes/document b/hw/xprint/config/C/print/attributes/document deleted file mode 100644 index b1651bd94..000000000 --- a/hw/xprint/config/C/print/attributes/document +++ /dev/null @@ -1,49 +0,0 @@ -# $Xorg: document,v 1.3 2000/08/17 19:48:03 cpqbld Exp $ -# Document DPA-Object initial attribute values - -# Attribute IDs must be qualified by using one of the following -# (listed in order of precedence): -# -# printer-name -# Set this attribute for a specific printer. -# Example: "dj_1.plex: duplex" -# -# printer-model -# Set this attribute for all printers of a specific model. -# Example: "HPDJ1600C.plex: duplex" -# -# '*' -# Set this attribute for all printers. -# Example: "*.plex: duplex" - - -*content-orientation: portrait -*copy-count: 1 -*default-medium: iso-a4 -*default-printer-resolution: 600 - -# "PSspooldir" jobs should always be 300 DPI -# (to be compatible to DPS-based PostScript viewers such as sdtimage) -PSspooldir.default-printer-resolution: 300 - -# "PS2PDFspooldir-GS" jobs should always be 600 DPI -PS2PDFspooldir-GS.default-printer-resolution: 600 - -# Some resolution defaults to make applications happy which are too lazy -# to pick an own default in absence of "default-printer-resolution" -HPLJ4050-PS.default-printer-resolution: 600 -SPSPARC2.default-printer-resolution: 300 -CANONBJ10E-GS.default-printer-resolution: 360 -CANONC3200-PS.default-printer-resolution: 600 - -# EXAMPLES -# -# *content-orientation: landscape -# *copy-count: 3 -# *default-input-tray: main -# *default-medium: iso-a4 -# *default-printer-resolution: 600 -# *document-format: {PCL 5} -# *plex: simplex -# *xp-listfonts-modes: xp-list-internal-printer-fonts - diff --git a/hw/xprint/config/C/print/attributes/job b/hw/xprint/config/C/print/attributes/job deleted file mode 100644 index aa1911dcd..000000000 --- a/hw/xprint/config/C/print/attributes/job +++ /dev/null @@ -1,25 +0,0 @@ -# $Xorg: job,v 1.3 2000/08/17 19:48:03 cpqbld Exp $ -# Job DPA-Object initial attribute values - -# Attribute IDs must be qualified by using one of the following -# (listed in order of precedence): -# -# printer-name -# Set this attribute for a specific printer. -# Example: "laser_1.job-priority: 1" -# -# printer-model -# Set this attribute for all printers of a specific model. -# Example: "HPDJ1600C.job-priority: 1" -# -# '*' -# Set this attribute for all printers. -# Example: "*.job-priority: 1" - -*notification-profile: {} - -# EXAMPLES -# -# *job-name: Example Job Name -# *notification-profile: {{event-report-job-completed} electronic-mail} -# *xp-spooler-command-options: -onb diff --git a/hw/xprint/config/C/print/attributes/printer b/hw/xprint/config/C/print/attributes/printer deleted file mode 100644 index 41e13b44b..000000000 --- a/hw/xprint/config/C/print/attributes/printer +++ /dev/null @@ -1,96 +0,0 @@ -# $Xorg: printer,v 1.3 2000/08/17 19:48:03 cpqbld Exp $ -# Printer DPA-Object initial attribute values - -# Attribute IDs must be qualified by using one of the following -# (listed in order of precedence): -# -# printer-name -# Set this attribute for a specific printer. -# Example: "dj_1.document-formats-ready: {pcl 5}" -# -# printer-model -# Set this attribute for all printers of a specific model. -# Example: "HPDJ1600C.document-formats-ready: {pcl 5}" -# -# '*' -# Set this attribute for all printers. -# Example: "*.document-formats-ready: {pcl 5}" - -# Remove this line and replace them with per printer settings -# if you want to use more than one DDX!! -*xp-model-identifier: PSdefault - - -# Sample entry for the "PSspooldir" model -# Just add a printer called "xp_ps_spooldir_tmp_Xprintjobs" to "Xprinters" -# and you will get an extra printer which files the PostScript jobs -# in the "/tmp/Xprintjobs/" directory. -xp_ps_spooldir_tmp_Xprintjobs.xp-model-identifier: PSspooldir - -# Sample entry for the "PS2PDFspooldir-GS" model -# Just add a printer called "xp_pdf_spooldir_tmp_Xprintjobs" to "Xprinters" -# and you will get an extra printer which convertes the PostScript jobs -# to PDF using "ps2pdf" and files them into the "/tmp/Xprintjobs/" directory. -# NOTE: Future versions of Xprint will use the PDF DDX instead directly -# instead of relying on GhostScript/ps2pdf... -xp_pdf_spooldir_tmp_Xprintjobs.xp-model-identifier: PS2PDFspooldir-GS - - -# IMPORTANT EXAMPLES -# -# The following are examples of how a printer name is bound -# to a model-config file and ddx driver. -# -# Warning: most X-Servers have a hard limit on the number of ddx -# drivers (ie, screens) they can support at runtime (usually 3 or -# 4). Whatever the number of printers, they cannot create a -# dependency for more than the limit on ddx drivers. Assuming -# "Xprinters" listed all four xp*pr printers below, X-Servers -# with a limit of 3 would not work. -# -# xppspr.xp-model-identifier: HPDJ1600C -# xppspr.xp-ddx-identifier: XP-POSTSCRIPT -# xppspr.document-formats-ready: { PostScript 2 } -# -# xppclpr.xp-model-identifier: HPDJ1600C -# xppclpr.xp-ddx-identifier: XP-PCL-COLOR -# xppclpr.document-formats-ready: { PCL 5 } -# -# xppclmonopr.xp-model-identifier: HPDJ1600C -# xppclmonopr.xp-ddx-identifier: XP-PCL-MONO -# xppclmonopr.document-formats-ready: { PCL 5 } -# -# xprasterpr.xp-model-identifier: HPDJ1600C -# xprasterpr.xp-ddx-identifier: XP-RASTER - - -# MORE EXAMPLES of items often configured in this file -# -# *descriptor: This printer has not been given a name -# *dt-pdm-command: dtpdm -# *input-trays-medium: {top na-letter} {bottom iso-a4} -# *xp-model-identifier: HPDJ1600C -# *xp-spooler-command: /opt/mystuff/bin/mylp -p %printer-name% -c %copy-count% \ -# -j %job-name% -o %options% - - -# USUALLY SET BY THE ddx driver -# -# *content-orientations-supported: portrait landscape reverse-portrait reverse-landscape - - -# USUALLY SET BY THE model-config FILE -# -# *document-formats-supported: {PCL 5} -# *medium-source-sizes-supported: \ -# { top {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} } \ -# { bottom {iso-a4 FALSE {10 200 10 287}} {iso-a5 FALSE {10 138 10 200}} } -# *plexes-supported: simplex duplex tumble -# *printer-model: Hewlett-Packard LaserJet IV -# *printer-resolutions-supported: 300 -# *xp-ddx-identifier: XP-PCL-COLOR -# *xp-embedded-formats-supported: {PCL 5} {HPGL 2} -# *xp-listfonts-modes-supported: xp-list-internal-printer-fonts -# *xp-raw-formats-supported: {PCL 5} -# *xp-setup-proviso: xp-setup-optional - diff --git a/hw/xprint/config/C/print/ddx-config/Makefile.am b/hw/xprint/config/C/print/ddx-config/Makefile.am deleted file mode 100644 index 907edca75..000000000 --- a/hw/xprint/config/C/print/ddx-config/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = raster diff --git a/hw/xprint/config/C/print/ddx-config/raster/Makefile.am b/hw/xprint/config/C/print/ddx-config/raster/Makefile.am deleted file mode 100644 index 79bfb59df..000000000 --- a/hw/xprint/config/C/print/ddx-config/raster/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/ddx-config/raster - -dist_xpc_DATA = pcl postscript diff --git a/hw/xprint/config/C/print/ddx-config/raster/pcl b/hw/xprint/config/C/print/ddx-config/raster/pcl deleted file mode 100644 index 15d33e7b3..000000000 --- a/hw/xprint/config/C/print/ddx-config/raster/pcl +++ /dev/null @@ -1,39 +0,0 @@ -# $Xorg: pcl,v 1.3 2000/08/17 19:48:03 cpqbld Exp $ -# This is the file which you should customize to include the printers that -# will print through the raster driver. The early part of this file -# specifies some commn useful defaults. You can override them when -# you list your printers in the second part of this file. This file is -# an X Resource file. To learn more about this file format, consult -# the functional specification. - -# Note that the reference printer for CDEnext is the HP DeskJet 1600C. -# This driver may work for other printers, but the reference printer -# is the only officially supported printer. - - -# DEFAULTS -# ======== - -# The attributes below apply to all printers unless the section below -# specifies something different for the printer. - -# Default printer attributes -# -------------------------- -# Printer attributes control the choices that users will see in the -# setup dialog for those printers. - -# The attributes below apply to all printes unless the section below -# specifies something different for the printer. - -*.media-ready: na-letter-white -*.descriptor: Printer supported by CDEnext DtPrint System. -*.printer-model: HPDJ1600C - -# Printer Specifics - -# Use this section to override the defaults listed above or to override the -# printer attributes described in the model file. -# The lines describing "laser" are just a sample to help you get started. - -# laser.printer-name: laser -# laser.spooler-name: laser diff --git a/hw/xprint/config/C/print/ddx-config/raster/postscript b/hw/xprint/config/C/print/ddx-config/raster/postscript deleted file mode 100644 index e69de29bb..000000000 --- a/hw/xprint/config/C/print/ddx-config/raster/postscript +++ /dev/null diff --git a/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am b/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am deleted file mode 100644 index 951b9af97..000000000 --- a/hw/xprint/config/C/print/models/CANONBJ10E-GS/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/CANONBJ10E-GS - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config b/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config deleted file mode 100644 index 97bfd8196..000000000 --- a/hw/xprint/config/C/print/models/CANONBJ10E-GS/model-config +++ /dev/null @@ -1,23 +0,0 @@ -# $Xprint.org: CANONBJ10E-GS model-config,v 1.4 2003/02/10 14:48:04 gisburn Exp $ - -*content-orientations-supported: portrait landscape -*descriptor: Canon BJ-10e (GhostScript) -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ -} - -*plexes-supported: simplex -*printer-model: "Canon BJ-10e (GhostScript)" -*printer-resolutions-supported: 360 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional -# EOF. diff --git a/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am b/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am deleted file mode 100644 index 771b40864..000000000 --- a/hw/xprint/config/C/print/models/CANONC3200-PS/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = fonts - -xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am b/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am deleted file mode 100644 index 7a7ecc31a..000000000 --- a/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS/fonts - -parentdir = ../../PSdefault/fonts - -XPFONTS = \ - AvantGarde-Book.pmf \ - AvantGarde-BookOblique.pmf \ - AvantGarde-Demi.pmf \ - AvantGarde-DemiOblique.pmf \ - Courier-Bold.pmf \ - Courier-BoldOblique.pmf \ - Courier-Oblique.pmf \ - Courier.pmf \ - Helvetica-Bold.pmf \ - Helvetica-BoldOblique.pmf \ - Helvetica-Oblique.pmf \ - Helvetica.pmf \ - LubalinGraph-Book.pmf \ - LubalinGraph-BookOblique.pmf \ - LubalinGraph-Demi.pmf \ - LubalinGraph-DemiOblique.pmf \ - NewCentSchlbk-Bold.pmf \ - NewCentSchlbk-BoldItal.pmf \ - NewCentSchlbk-Ital.pmf \ - NewCentSchlbk-Roman.pmf \ - Souvenir-Demi.pmf \ - Souvenir-DemiItalic.pmf \ - Souvenir-Light.pmf \ - Souvenir-LightItalic.pmf \ - Symbol.pmf \ - Times-Bold.pmf \ - Times-BoldItalic.pmf \ - Times-Italic.pmf \ - Times-Roman.pmf \ - ZapfDingbats.pmf - -dest = $(DESTDIR)$(xpcdir) - -remove-stuff: - for x in $(XPFONTS) ; do \ - rm -f $(dest)/$$x ; \ - done - - @rm -f $(dest)/fonts.dir - -install-data-hook: remove-stuff - mkdir -p $(dest) ; \ - for x in $(XPFONTS) ; do \ - ln -s $(parentdir)/$$x $(dest)/$$x ; \ - done - - $(MKFONTSCALE) -b -s -l $(dest) - -uninstall-hook: remove-stuff diff --git a/hw/xprint/config/C/print/models/CANONC3200-PS/model-config b/hw/xprint/config/C/print/models/CANONC3200-PS/model-config deleted file mode 100644 index cdb3f4958..000000000 --- a/hw/xprint/config/C/print/models/CANONC3200-PS/model-config +++ /dev/null @@ -1,40 +0,0 @@ -# $Xprint.org: CANONC3200-PS model-config,v 1.1 2004/06/24 09:18:04 gisburn Exp $ -# model-config for the PostScript DDX -# -# automatically generated by xpppdtomodelconfig V0.1 -# -# DO NOT MODIFY THIS FILE!! -# -# Attributes supported for this printer model -*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape -*descriptor: Canon iR C3200 -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {iso-a4 FALSE {4.002 206 4.002 293}}\ - {na-letter FALSE {4.002 211.9 4.002 275.4}}\ - {na-legal FALSE {4.002 211.9 4.002 351.6}}\ - {iso-a3 FALSE {4.002 293 4.002 416}}\ - {iso-a5 FALSE {4.002 144 4.002 206}}\ - {iso-b4 FALSE {4.002 246 4.002 349}}\ - {iso-b5 FALSE {4.002 172 4.002 246}}\ - {executive FALSE {4.002 180.1 4.002 262.7}}\ - {invoice FALSE {4.002 135.7 4.002 211.9}}\ - {monarch-envelope FALSE {4.002 94.3 4.002 186.5}}\ - {na-number-10-envelop FALSE {4.002 100.8 4.002 237.3}}\ - {iso-c5 FALSE {4.002 158 4.002 225}}\ -} - -*plexes-supported: simplex duplex tumble -*printer-model: "Canon iR C3200" -*printer-resolutions-supported: 600 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional -# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. -*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc -*xp-psddx-download-font-type: pstype1 -# EOF. diff --git a/hw/xprint/config/C/print/models/GSdefault/Makefile.am b/hw/xprint/config/C/print/models/GSdefault/Makefile.am deleted file mode 100644 index be0426c76..000000000 --- a/hw/xprint/config/C/print/models/GSdefault/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/GSdefault - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/GSdefault/model-config b/hw/xprint/config/C/print/models/GSdefault/model-config deleted file mode 100644 index 61dac18b8..000000000 --- a/hw/xprint/config/C/print/models/GSdefault/model-config +++ /dev/null @@ -1,137 +0,0 @@ -# $Xprint.org: GSdefault model-config,v 1.1 2003/02/10 14:48:04 gisburn Exp $ -# Generic default model-config for the PostScript DDX when using GhostScript -# as printer driver -# -# DO NOT MODIFY THIS FILE!! -# -# If you want to make customisations for your printer create a copy -# of this printer model. -# Example (for creating a model config "MYCOMPANYlaserxx"): -# 1. Create model config dir: -# % mkdir MYCOMPANYlaserxx -# 2. Link (or copy) the PMF (printer font metrics) for the -# printer buildin fonts: -# % ln -s GSdefault/fonts MYCOMPANYlaserxx/. -# 3. Copy the model config file: -# % cp GSdefault/model-config MYCOMPANYlaserxx/. -# 4. Customize MYCOMPANYlaserxx/model-config to match your needs. -# - -# Attributes supported for this printer model -# You may want to cut the lists here down to the attributes supported -# by your printer. -*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape -*descriptor: GhostScript default model -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {executive FALSE {6.35 177.80 6.35 260.35}}\ - {folio FALSE {6.35 204.47 6.35 323.85}}\ - {invoice FALSE {6.35 133.35 6.35 209.55}}\ - {ledger FALSE {6.35 273.05 6.35 425.45}}\ - {quarto FALSE {6.35 209.55 6.35 268.732}}\ - {a FALSE {6.35 209.55 6.35 273.05}}\ - {b FALSE {6.35 273.05 6.35 425.45}}\ - {c FALSE {6.35 425.45 6.35 552.45}}\ - {d FALSE {6.35 552.45 6.35 857.25}}\ - {e FALSE {6.35 857.25 6.35 1111.25}}\ - {na-6x9-envelope FALSE {6.35 146.05 6.35 222.25}}\ - {na-10x15-envelope FALSE {6.35 247.65 6.35 374.65}}\ - {monarch-envelope FALSE {6.35 91.948 6.35 184.15}}\ - {na-10x13-envelope FALSE {6.35 247.65 6.35 323.85}}\ - {na-9x12-envelope FALSE {6.35 222.25 6.35 298.45}}\ - {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}}\ - {na-7x9-envelope FALSE {6.35 171.45 6.35 222.25}}\ - {na-9x11-envelope FALSE {6.35 222.25 6.35 273.05}}\ - {na-10x14-envelope FALSE {6.35 247.65 6.35 349.25}}\ - {na-number-9-envelope FALSE {6.35 92.075 6.35 219.075}}\ - {iso-a0 FALSE {6.35 834.65 6.35 1182.65}}\ - {iso-a1 FALSE {6.35 587.65 6.35 834.65}}\ - {iso-a2 FALSE {6.35 413.65 6.35 587.65}}\ - {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\ - {iso-a6 FALSE {6.35 98.65 6.35 141.65}}\ - {iso-a7 FALSE {6.35 67.65 6.35 98.65}}\ - {iso-a8 FALSE {6.35 45.65 6.35 67.65}}\ - {iso-a9 FALSE {6.35 30.65 6.35 45.65}}\ - {iso-a10 FALSE {6.35 19.65 6.35 30.65}}\ - {iso-b1 FALSE {6.35 700.65 6.35 993.65}}\ - {iso-b2 FALSE {6.35 493.65 6.35 700.65}}\ - {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\ - {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\ - {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ - {iso-b6 FALSE {6.35 118.65 6.35 169.65}}\ - {iso-b7 FALSE {6.35 81.65 6.35 118.65}}\ - {iso-b8 FALSE {6.35 55.65 6.35 81.65}}\ - {iso-b9 FALSE {6.35 37.65 6.35 55.65}}\ - {iso-b10 FALSE {6.35 24.65 6.35 37.65}}\ - {jis-b1 FALSE {6.35 721.65 6.35 1023.65}}\ - {jis-b2 FALSE {6.35 508.65 6.35 721.65}}\ - {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\ - {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ - {jis-b6 FALSE {6.35 121.65 6.35 175.65}}\ - {jis-b7 FALSE {6.35 84.65 6.35 121.65}}\ - {jis-b8 FALSE {6.35 57.65 6.35 84.65}}\ - {jis-b9 FALSE {6.35 38.65 6.35 57.65}}\ - {jis-b10 FALSE {6.35 25.65 6.35 38.65}}\ - {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\ - {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\ - {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ - {iso-c6 FALSE {6.35 107.65 6.35 155.65}}\ - {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\ - {hp-2x-postcard FALSE {6.35 141.65 6.35 193.65}}\ - {hp-european-edp FALSE {6.35 298.45 6.35 349.25}}\ - {hp-mini FALSE {6.35 133.35 6.35 209.55}}\ - {hp-postcard FALSE {6.35 93.65 6.35 141.65}}\ - {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\ - {hp-us-edp FALSE {6.35 273.05 6.35 349.25}}\ - {hp-us-government-legal FALSE {6.35 196.85 6.35 323.85}}\ - {hp-us-government-letter FALSE {6.35 196.85 6.35 247.65}}\ -} -# If you have more than one tray use the following example: -# 1. List the supported trays -#*input-trays-supported: main manual -# 2. Define each tray and it's paper sizes -#*medium-source-sizes-supported: \ -#{ main \ -# {na-letter FALSE {6.35 209.55 6.35 273.05}} \ -# {na-legal FALSE {6.35 209.55 6.35 349.25}} \ -# {iso-a4 FALSE {6.35 203.65 6.35 290.65}} \ -#} \ -#{ manual \ -# {iso-a5 FALSE {6.35 141.65 6.35 203.65}} \ -# {iso-c5 FALSE {6.35 155.65 6.35 222.65}} \ -# {iso-designated-long FALSE {6.35 103.65 6.35 213.65}} \ -# {jis-b5 FALSE {6.35 175.65 6.35 250.65}} \ -# {monarch-envelope FALSE {6.35 91.948 6.35 184.15}} \ -# {na-legal FALSE {6.35 209.55 6.35 349.25}} \ -# {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}} \ -# {executive FALSE {6.35 177.8 6.35 260.35}} \ -# {iso-a3 FALSE {6.35 290.65 6.35 413.65}} \ -# {iso-a0 FALSE {6.35 834.65 6.35 1182.65}} \ -#} -*plexes-supported: simplex duplex tumble -*printer-model: "GhostScript default model" -# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, -# 940, 1200 and 2440 are supported DPI values, we limit it here -# to some common values: -*printer-resolutions-supported: 300 360 400 600 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional - -# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. -# xp-psddx-download-fonts defines which fonts should be downloaded as outlines -# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc") -*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc -# xp-psddx-download-font-type defines which font type is used to download outlines -# (valid values are "bitmap", "pstype1" and "pstype3") -*xp-psddx-download-font-type: pstype1 -# EOF. diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am b/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am deleted file mode 100644 index 1c8b3b5c6..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = fonts - -xpcdir = @xpconfigdir@/C/print/models/HPDJ1600C - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmf Binary files differdeleted file mode 100644 index 09cc489a5..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00051.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmf Binary files differdeleted file mode 100644 index b21a9a2a8..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00052.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmf Binary files differdeleted file mode 100644 index 485b874c5..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00053.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmf Binary files differdeleted file mode 100644 index 524934c71..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00054.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmf Binary files differdeleted file mode 100644 index 2ef9bc52c..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00055.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmf Binary files differdeleted file mode 100644 index 3d69311ef..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00056.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmf Binary files differdeleted file mode 100644 index 3833d4f54..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00057.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmf Binary files differdeleted file mode 100644 index 289a95e5c..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00058.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmf Binary files differdeleted file mode 100644 index a5984bed1..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00059.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmf Binary files differdeleted file mode 100644 index df27cd71e..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00060.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmf Binary files differdeleted file mode 100644 index fb2b5a433..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00061.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmf Binary files differdeleted file mode 100644 index f0e58c435..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00062.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmf Binary files differdeleted file mode 100644 index 8821ff155..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00063.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmf Binary files differdeleted file mode 100644 index e5980fc0e..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00064.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmf Binary files differdeleted file mode 100644 index d9a151d7f..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00065.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmf Binary files differdeleted file mode 100644 index d14fca56f..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00066.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmf Binary files differdeleted file mode 100644 index 7a341506f..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00067.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmf Binary files differdeleted file mode 100644 index c20e39a21..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00068.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmf Binary files differdeleted file mode 100644 index 4a4a35281..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00069.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmf Binary files differdeleted file mode 100644 index 8d97d4339..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00070.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmf Binary files differdeleted file mode 100644 index 19844c9c6..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00071.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmf Binary files differdeleted file mode 100644 index 5415c3f44..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00072.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmf Binary files differdeleted file mode 100644 index 038dfdb46..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00073.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmf Binary files differdeleted file mode 100644 index 382a78575..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00074.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmf Binary files differdeleted file mode 100644 index 1c7edf653..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00075.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmf Binary files differdeleted file mode 100644 index 2f077f40f..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00076.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmf Binary files differdeleted file mode 100644 index 1ce190d51..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00077.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmf Binary files differdeleted file mode 100644 index 45d6906ba..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00079.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmf Binary files differdeleted file mode 100644 index b991b5edb..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00080.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmf Binary files differdeleted file mode 100644 index 1935a9f00..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00081.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmf Binary files differdeleted file mode 100644 index 2000dc057..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00082.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmf Binary files differdeleted file mode 100644 index 90f0e45a8..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00083.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmf Binary files differdeleted file mode 100644 index 52ba39b96..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00084.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmf Binary files differdeleted file mode 100644 index f5c9053af..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00085.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmf Binary files differdeleted file mode 100644 index b7586ca61..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00086.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmf Binary files differdeleted file mode 100644 index 82f054999..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00087.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmf Binary files differdeleted file mode 100644 index 591c96b59..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00088.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmf Binary files differdeleted file mode 100644 index c8160954a..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00089.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmf Binary files differdeleted file mode 100644 index 895cfe26a..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00090.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmf Binary files differdeleted file mode 100644 index 3bdcae4ba..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00091.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmf Binary files differdeleted file mode 100644 index a56d47504..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00092.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmf Binary files differdeleted file mode 100644 index c85f3b4de..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00093.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmf Binary files differdeleted file mode 100644 index 875bf1df8..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/9nb00094.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am deleted file mode 100644 index b32079e1d..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/HPDJ1600C/fonts - -dist_xpc_DATA = \ - 9nb00051.pmf \ - 9nb00052.pmf \ - 9nb00053.pmf \ - 9nb00054.pmf \ - 9nb00055.pmf \ - 9nb00056.pmf \ - 9nb00057.pmf \ - 9nb00058.pmf \ - 9nb00059.pmf \ - 9nb00060.pmf \ - 9nb00061.pmf \ - 9nb00062.pmf \ - 9nb00063.pmf \ - 9nb00064.pmf \ - 9nb00065.pmf \ - 9nb00066.pmf \ - 9nb00067.pmf \ - 9nb00068.pmf \ - 9nb00069.pmf \ - 9nb00070.pmf \ - 9nb00071.pmf \ - 9nb00072.pmf \ - 9nb00073.pmf \ - 9nb00074.pmf \ - 9nb00075.pmf \ - 9nb00076.pmf \ - 9nb00077.pmf \ - 9nb00079.pmf \ - 9nb00080.pmf \ - 9nb00081.pmf \ - 9nb00082.pmf \ - 9nb00083.pmf \ - 9nb00084.pmf \ - 9nb00085.pmf \ - 9nb00086.pmf \ - 9nb00087.pmf \ - 9nb00088.pmf \ - 9nb00089.pmf \ - 9nb00090.pmf \ - 9nb00091.pmf \ - 9nb00092.pmf \ - 9nb00093.pmf \ - 9nb00094.pmf \ - lpr0ye1a.pmf \ - fonts.alias \ - fonts.dir \ - README diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README deleted file mode 100644 index cccc2be32..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/README +++ /dev/null @@ -1,197 +0,0 @@ -$Xorg: README,v 1.3 2000/08/17 19:48:04 cpqbld Exp $ - -This directory contains "printer metric files" for the X Print -Server suitable for the DeskJet 1600C printer. The following -*.pmf files were generated by the Hewlett-Packard Company. - - 9nb00051.pmf - 9nb00052.pmf - 9nb00053.pmf - 9nb00054.pmf - 9nb00055.pmf - 9nb00056.pmf - 9nb00057.pmf - 9nb00058.pmf - 9nb00059.pmf - 9nb00060.pmf - 9nb00061.pmf - 9nb00062.pmf - 9nb00063.pmf - 9nb00064.pmf - 9nb00065.pmf - 9nb00066.pmf - 9nb00067.pmf - 9nb00068.pmf - 9nb00069.pmf - 9nb00070.pmf - 9nb00071.pmf - 9nb00072.pmf - 9nb00073.pmf - 9nb00074.pmf - 9nb00075.pmf - 9nb00076.pmf - 9nb00077.pmf - 9nb00079.pmf - 9nb00080.pmf - 9nb00081.pmf - 9nb00082.pmf - 9nb00083.pmf - 9nb00084.pmf - 9nb00085.pmf - 9nb00086.pmf - 9nb00087.pmf - 9nb00088.pmf - 9nb00089.pmf - 9nb00090.pmf - 9nb00091.pmf - 9nb00092.pmf - 9nb00093.pmf - 9nb00094.pmf - lpr0ye1a.pmf - -For reasons of not supporting iso8859.1 and hp-roman8, the following -DeskJet 1600C printer fonts were not converted to *.pmf files. - - 9nb00078.pmf - 9nb00095.pmf - lpr0ylga.pmf - lpr0ypca.pmf - lpr0ypda.pmf - lpr0ypma.pmf - lpr0yr8a.pmf - -Output from the conversion utility is as follows: - - Creating iso8859 1 pmf for 9nb00051.tfm as iso8859.1/9nb00051.pmf - -COMPUGRAPHIC-Albertus-Extra Bold-r-Normal--8782-2500-2540-2540-P-42480-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00052.tfm as iso8859.1/9nb00052.pmf - -COMPUGRAPHIC-Albertus-Semi Bold-r-Normal--8782-2500-2540-2540-P-37640-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00053.tfm as iso8859.1/9nb00053.pmf - -COMPUGRAPHIC-Antique Olive-Bold-r-Normal--8782-2500-2540-2540-P-50490-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00054.tfm as iso8859.1/9nb00054.pmf - -COMPUGRAPHIC-Antique Olive-Medium-i-Normal--8782-2500-2540-2540-P-46140-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00055.tfm as iso8859.1/9nb00055.pmf - -COMPUGRAPHIC-Antique Olive-Medium-r-Normal--8782-2500-2540-2540-P-46380-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00056.tfm as iso8859.1/9nb00056.pmf - -Monotype-Arial-Bold-r-Normal--2048-2500-589-589-P-9800-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00057.tfm as iso8859.1/9nb00057.pmf - -Monotype-Arial-Medium-i-Normal--2048-2500-589-589-P-9040-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00058.tfm as iso8859.1/9nb00058.pmf - -Monotype-Arial-Bold-i-Normal--2048-2500-589-589-P-9800-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00059.tfm as iso8859.1/9nb00059.pmf - -Monotype-Arial-Medium-r-Normal--2048-2500-589-589-P-9040-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00060.tfm as iso8859.1/9nb00060.pmf - -COMPUGRAPHIC-Clarendon-Bold-r-Condensed--8782-2500-2540-2540-P-35080-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00061.tfm as iso8859.1/9nb00061.pmf - -COMPUGRAPHIC-Courier-Bold-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00062.tfm as iso8859.1/9nb00062.pmf - -COMPUGRAPHIC-Courier-Medium-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00063.tfm as iso8859.1/9nb00063.pmf - -COMPUGRAPHIC-Courier-Bold-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00064.tfm as iso8859.1/9nb00064.pmf - -COMPUGRAPHIC-Courier-Medium-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00065.tfm as iso8859.1/9nb00065.pmf - -COMPUGRAPHIC-Garamond-Bold-r-Normal--8782-2500-2540-2540-P-38730-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00066.tfm as iso8859.1/9nb00066.pmf - -COMPUGRAPHIC-Garamond-Medium-i-Normal--8782-2500-2540-2540-P-34280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00067.tfm as iso8859.1/9nb00067.pmf - -COMPUGRAPHIC-Garamond-Bold-i-Normal--8782-2500-2540-2540-P-37020-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00068.tfm as iso8859.1/9nb00068.pmf - -COMPUGRAPHIC-Garamond-Medium-r-Normal--8782-2500-2540-2540-P-36560-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00069.tfm as iso8859.1/9nb00069.pmf - -COMPUGRAPHIC-Letter Gothic-Bold-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00070.tfm as iso8859.1/9nb00070.pmf - -COMPUGRAPHIC-Letter Gothic-Medium-i-Normal--8782-2500-2540-2540-M-44090-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00071.tfm as iso8859.1/9nb00071.pmf - -COMPUGRAPHIC-Letter Gothic-Medium-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00072.tfm as iso8859.1/9nb00072.pmf - -COMPUGRAPHIC-Marigold-Medium-r-Normal--8782-2500-2540-2540-P-21890-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00073.tfm as iso8859.1/9nb00073.pmf - -COMPUGRAPHIC-Omega-Bold-r-Normal--8782-2500-2540-2540-P-38600-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00074.tfm as iso8859.1/9nb00074.pmf - -COMPUGRAPHIC-Omega-Medium-i-Normal--8782-2500-2540-2540-P-37980-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00075.tfm as iso8859.1/9nb00075.pmf - -COMPUGRAPHIC-Omega-Bold-i-Normal--8782-2500-2540-2540-P-38560-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00076.tfm as iso8859.1/9nb00076.pmf - -COMPUGRAPHIC-Omega-Medium-r-Normal--8782-2500-2540-2540-P-37770-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00077.tfm as iso8859.1/9nb00077.pmf - -COMPUGRAPHIC-Coronet-Medium-i-Normal--8782-2500-2540-2540-P-22870-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00079.tfm as iso8859.1/9nb00079.pmf - -Monotype-Times New Roman-Bold-r-Normal--2048-2500-589-589-P-8740-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00080.tfm as iso8859.1/9nb00080.pmf - -Monotype-Times New Roman-Medium-i-Normal--2048-2500-589-589-P-8230-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00081.tfm as iso8859.1/9nb00081.pmf - -Monotype-Times New Roman-Bold-i-Normal--2048-2500-589-589-P-8440-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00082.tfm as iso8859.1/9nb00082.pmf - -Monotype-Times New Roman-Medium-r-Normal--2048-2500-589-589-P-8210-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00083.tfm as iso8859.1/9nb00083.pmf - -COMPUGRAPHIC-Times-Bold-r-Normal--8782-2500-2540-2540-P-38200-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00084.tfm as iso8859.1/9nb00084.pmf - -COMPUGRAPHIC-Times-Medium-i-Normal--8782-2500-2540-2540-P-36000-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00085.tfm as iso8859.1/9nb00085.pmf - -COMPUGRAPHIC-Times-Bold-i-Normal--8782-2500-2540-2540-P-36900-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00086.tfm as iso8859.1/9nb00086.pmf - -COMPUGRAPHIC-Times-Medium-r-Normal--8782-2500-2540-2540-P-36080-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00087.tfm as iso8859.1/9nb00087.pmf - -COMPUGRAPHIC-Univers-Medium-i-Condensed--8782-2500-2540-2540-P-29970-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00088.tfm as iso8859.1/9nb00088.pmf - -COMPUGRAPHIC-Univers-Bold-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00089.tfm as iso8859.1/9nb00089.pmf - -COMPUGRAPHIC-Univers-Medium-r-Condensed--8782-2500-2540-2540-P-29970-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00090.tfm as iso8859.1/9nb00090.pmf - -COMPUGRAPHIC-Univers-Bold-r-Condensed--8782-2500-2540-2540-P-33030-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00091.tfm as iso8859.1/9nb00091.pmf - -COMPUGRAPHIC-Univers-Bold-i-Condensed--8782-2500-2540-2540-P-33030-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00092.tfm as iso8859.1/9nb00092.pmf - -COMPUGRAPHIC-Univers-Medium-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00093.tfm as iso8859.1/9nb00093.pmf - -COMPUGRAPHIC-Univers-Bold-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00094.tfm as iso8859.1/9nb00094.pmf - -COMPUGRAPHIC-Univers-Medium-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for lpr0ye1a.tfm as iso8859.1/lpr0ye1a.pmf - -HP-Line Printer-Medium-r-Normal--35-85-300-300-M-180-iso8859-1 - ------------------------------------ - diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias deleted file mode 100644 index e69de29bb..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.alias +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir deleted file mode 100644 index da702ccc1..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/fonts.dir +++ /dev/null @@ -1,45 +0,0 @@ -44 -lpr0ye1a.pmf -hp-line printer-medium-r-normal--35-85-300-300-m-180-iso8859-1 -9nb00080.pmf -monotype-times new roman-medium-i-normal--2048-2500-589-589-p-8230-iso8859-1 -9nb00092.pmf -compugraphic-univers-medium-i-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00081.pmf -monotype-times new roman-bold-i-normal--2048-2500-589-589-p-8440-iso8859-1 -9nb00093.pmf -compugraphic-univers-bold-i-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00082.pmf -monotype-times new roman-medium-r-normal--2048-2500-589-589-p-8210-iso8859-1 -9nb00090.pmf -compugraphic-univers-bold-r-condensed--8782-2500-2540-2540-p-33030-iso8859-1 -9nb00083.pmf -compugraphic-times-bold-r-normal--8782-2500-2540-2540-p-38200-iso8859-1 -9nb00091.pmf -compugraphic-univers-bold-i-condensed--8782-2500-2540-2540-p-33030-iso8859-1 -9nb00084.pmf -compugraphic-times-medium-i-normal--8782-2500-2540-2540-p-36000-iso8859-1 -9nb00085.pmf -compugraphic-times-bold-i-normal--8782-2500-2540-2540-p-36900-iso8859-1 -9nb00086.pmf -compugraphic-times-medium-r-normal--8782-2500-2540-2540-p-36080-iso8859-1 -9nb00094.pmf -compugraphic-univers-medium-r-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00087.pmf -compugraphic-univers-medium-i-condensed--8782-2500-2540-2540-p-29970-iso8859-1 -9nb00088.pmf -compugraphic-univers-bold-r-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00089.pmf -compugraphic-univers-medium-r-condensed--8782-2500-2540-2540-p-29970-iso8859-1 -9nb00058.pmf -monotype-arial-bold-i-normal--2048-2500-589-589-p-9800-iso8859-1 -9nb00059.pmf -monotype-arial-medium-r-normal--2048-2500-589-589-p-9040-iso8859-1 -9nb00068.pmf -compugraphic-garamond-medium-r-normal--8782-2500-2540-2540-p-36560-iso8859-1 -9nb00069.pmf -compugraphic-letter gothic-bold-r-normal--8782-2500-2540-2540-m-44090-iso8859-1 -9nb00079.pmf -monotype-times new roman-bold-r-normal--2048-2500-589-589-p-8740-iso8859-1 -9nb00052.pmf -compugraphic-albertus-semi bold-r-normal--8782-2500-2540-2540-p-37640-iso8859-1 -9nb00064.pmf -compugraphic-courier-medium-r-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00076.pmf -compugraphic-omega-medium-r-normal--8782-2500-2540-2540-p-37770-iso8859-1 -9nb00053.pmf -compugraphic-antique olive-bold-r-normal--8782-2500-2540-2540-p-50490-iso8859-1 -9nb00065.pmf -compugraphic-garamond-bold-r-normal--8782-2500-2540-2540-p-38730-iso8859-1 -9nb00077.pmf -compugraphic-coronet-medium-i-normal--8782-2500-2540-2540-p-22870-iso8859-1 -9nb00066.pmf -compugraphic-garamond-medium-i-normal--8782-2500-2540-2540-p-34280-iso8859-1 -9nb00074.pmf -compugraphic-omega-medium-i-normal--8782-2500-2540-2540-p-37980-iso8859-1 -9nb00051.pmf -compugraphic-albertus-extra bold-r-normal--8782-2500-2540-2540-p-42480-iso8859-1 -9nb00067.pmf -compugraphic-garamond-bold-i-normal--8782-2500-2540-2540-p-37020-iso8859-1 -9nb00075.pmf -compugraphic-omega-bold-i-normal--8782-2500-2540-2540-p-38560-iso8859-1 -9nb00056.pmf -monotype-arial-bold-r-normal--2048-2500-589-589-p-9800-iso8859-1 -9nb00060.pmf -compugraphic-clarendon-bold-r-condensed--8782-2500-2540-2540-p-35080-iso8859-1 -9nb00072.pmf -compugraphic-marigold-medium-r-normal--8782-2500-2540-2540-p-21890-iso8859-1 -9nb00057.pmf -monotype-arial-medium-i-normal--2048-2500-589-589-p-9040-iso8859-1 -9nb00061.pmf -compugraphic-courier-bold-r-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00073.pmf -compugraphic-omega-bold-r-normal--8782-2500-2540-2540-p-38600-iso8859-1 -9nb00054.pmf -compugraphic-antique olive-medium-i-normal--8782-2500-2540-2540-p-46140-iso8859-1 -9nb00062.pmf -compugraphic-courier-medium-i-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00070.pmf -compugraphic-letter gothic-medium-i-normal--8782-2500-2540-2540-m-44090-iso8859-1 -9nb00055.pmf -compugraphic-antique olive-medium-r-normal--8782-2500-2540-2540-p-46380-iso8859-1 -9nb00063.pmf -compugraphic-courier-bold-i-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00071.pmf -compugraphic-letter gothic-medium-r-normal--8782-2500-2540-2540-m-44090-iso8859-1 diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf b/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf Binary files differdeleted file mode 100644 index 483748893..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/fonts/lpr0ye1a.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPDJ1600C/model-config b/hw/xprint/config/C/print/models/HPDJ1600C/model-config deleted file mode 100644 index 5d45d4495..000000000 --- a/hw/xprint/config/C/print/models/HPDJ1600C/model-config +++ /dev/null @@ -1,40 +0,0 @@ -# $Xprint.org: HPDJ1600C model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $ -# This is the configuration file for the HP DeskJet 1600C printer. -# -# The CDEnext SI supports two 1600C drivers XP-PCL-MONO and -# XP-PCL-COLOR, which work with this configuration file. -# - -*content-orientations-supported: portrait landscape -*descriptor: Hewlett-Packard DeskJet 1600C -*document-formats-supported: {PCL 5} {PostScript 2} -*input-trays-supported: -# 1/4" unprintable margins -*medium-source-sizes-supported:\ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {executive FALSE {6.35 177.75 6.35 260.35}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {iso-a3 FALSE {6.35 290.65 6.35 413.35}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {jis-b4 FALSE {6.35 251.65 6.35 367.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ - {monarch-envelope FALSE {6.35 91.94 6.35 184.15}}\ - {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\ - {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ - {na-number-10-envelope FALSE {6.35 98.45 6.35 234.95}}\ - {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\ - {ledger FALSE {6.35 273.05 6.35 425.45}}\ - {b FALSE {6.35 273.05 6.35 425.45}}\ - {hp-japanese-postcard FALSE {6 94 6 142 }}\ - {hp-japanese-doublepostcard FALSE {6 142 6 194 }}\ -} -*plexes-supported: simplex duplex -*printer-model: "Hewlett-Packard DeskJet 1600C" -*printer-resolutions-supported: 300 -*xp-ddx-identifier: XP-PCL-COLOR -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: { PCL 5 } { PostScript 2 } -*xp-raw-formats-supported: { PCL 5 } -*xp-setup-proviso: setup-optional -# EOF. diff --git a/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am b/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am deleted file mode 100644 index b8cdfa6c4..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4050-PS/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = fonts - -xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am b/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am deleted file mode 100644 index f4f4243e9..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS/fonts - -parentdir = ../../PSdefault/fonts - -XPFONTS = \ - AvantGarde-Book.pmf \ - AvantGarde-BookOblique.pmf \ - AvantGarde-Demi.pmf \ - AvantGarde-DemiOblique.pmf \ - Courier-Bold.pmf \ - Courier-BoldOblique.pmf \ - Courier-Oblique.pmf \ - Courier.pmf \ - Helvetica-Bold.pmf \ - Helvetica-BoldOblique.pmf \ - Helvetica-Oblique.pmf \ - Helvetica.pmf \ - LubalinGraph-Book.pmf \ - LubalinGraph-BookOblique.pmf \ - LubalinGraph-Demi.pmf \ - LubalinGraph-DemiOblique.pmf \ - NewCentSchlbk-Bold.pmf \ - NewCentSchlbk-BoldItal.pmf \ - NewCentSchlbk-Ital.pmf \ - NewCentSchlbk-Roman.pmf \ - Souvenir-Demi.pmf \ - Souvenir-DemiItalic.pmf \ - Souvenir-Light.pmf \ - Souvenir-LightItalic.pmf \ - Symbol.pmf \ - Times-Bold.pmf \ - Times-BoldItalic.pmf \ - Times-Italic.pmf \ - Times-Roman.pmf \ - ZapfDingbats.pmf - -dest = $(DESTDIR)$(xpcdir) - -remove-stuff: - for x in $(XPFONTS) ; do \ - rm -f $(dest)/$$x ; \ - done - - @rm -f $(dest)/fonts.dir - -install-data-hook: remove-stuff - mkdir -p $(dest) ; \ - for x in $(XPFONTS) ; do \ - ln -s $(parentdir)/$$x $(dest)/$$x ; \ - done - - $(MKFONTSCALE) -b -s -l $(dest) - -uninstall-hook: remove-stuff diff --git a/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config b/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config deleted file mode 100644 index 159206de2..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4050-PS/model-config +++ /dev/null @@ -1,36 +0,0 @@ -# $Xprint.org: HPLJ4050-PS model-config,v 1.1 2003/12/16 00:48:04 gisburn Exp $ -# model-config for the HP LaserJet 4050 PostScript printer series -# -*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape -*descriptor: Hewlett-Packard LaserJet 4050 PostScript printer -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {executive FALSE {6.35 177.80 6.35 260.35}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\ - {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ -} - -# Duplex unit is optional for HPLJ4050 series -*plexes-supported: simplex -*printer-model: "Hewlett-Packard LaserJet 4050 PostScript printer" -*printer-resolutions-supported: 600 1200 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional - -# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. -# xp-psddx-download-fonts defines which fonts should be downloaded as outlines -# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc") -*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc -# xp-psddx-download-font-type defines which font type is used to download outlines -# (valid values are "bitmap", "pstype1" and "pstype3") -*xp-psddx-download-font-type: pstype1 -# EOF. diff --git a/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am b/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am deleted file mode 100644 index 2089737a9..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = fonts - -xpcdir = @xpconfigdir@/C/print/models/HPLJ4family - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmf Binary files differdeleted file mode 100644 index 09cc489a5..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00051.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmf Binary files differdeleted file mode 100644 index b21a9a2a8..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00052.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmf Binary files differdeleted file mode 100644 index 485b874c5..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00053.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmf Binary files differdeleted file mode 100644 index 524934c71..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00054.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmf Binary files differdeleted file mode 100644 index 2ef9bc52c..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00055.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmf Binary files differdeleted file mode 100644 index 3d69311ef..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00056.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmf Binary files differdeleted file mode 100644 index 3833d4f54..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00057.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmf Binary files differdeleted file mode 100644 index 289a95e5c..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00058.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmf Binary files differdeleted file mode 100644 index a5984bed1..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00059.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmf Binary files differdeleted file mode 100644 index df27cd71e..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00060.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmf Binary files differdeleted file mode 100644 index fb2b5a433..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00061.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmf Binary files differdeleted file mode 100644 index f0e58c435..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00062.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmf Binary files differdeleted file mode 100644 index 8821ff155..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00063.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmf Binary files differdeleted file mode 100644 index e5980fc0e..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00064.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmf Binary files differdeleted file mode 100644 index d9a151d7f..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00065.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmf Binary files differdeleted file mode 100644 index d14fca56f..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00066.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmf Binary files differdeleted file mode 100644 index 7a341506f..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00067.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmf Binary files differdeleted file mode 100644 index c20e39a21..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00068.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmf Binary files differdeleted file mode 100644 index 4a4a35281..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00069.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmf Binary files differdeleted file mode 100644 index 8d97d4339..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00070.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmf Binary files differdeleted file mode 100644 index 19844c9c6..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00071.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmf Binary files differdeleted file mode 100644 index 5415c3f44..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00072.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmf Binary files differdeleted file mode 100644 index 038dfdb46..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00073.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmf Binary files differdeleted file mode 100644 index 382a78575..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00074.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmf Binary files differdeleted file mode 100644 index 1c7edf653..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00075.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmf Binary files differdeleted file mode 100644 index 2f077f40f..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00076.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmf Binary files differdeleted file mode 100644 index 1ce190d51..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00077.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmf Binary files differdeleted file mode 100644 index 45d6906ba..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00079.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmf Binary files differdeleted file mode 100644 index b991b5edb..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00080.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmf Binary files differdeleted file mode 100644 index 1935a9f00..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00081.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmf Binary files differdeleted file mode 100644 index 2000dc057..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00082.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmf Binary files differdeleted file mode 100644 index 90f0e45a8..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00083.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmf Binary files differdeleted file mode 100644 index 52ba39b96..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00084.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmf Binary files differdeleted file mode 100644 index f5c9053af..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00085.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmf Binary files differdeleted file mode 100644 index b7586ca61..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00086.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmf Binary files differdeleted file mode 100644 index 82f054999..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00087.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmf Binary files differdeleted file mode 100644 index 591c96b59..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00088.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmf Binary files differdeleted file mode 100644 index c8160954a..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00089.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmf Binary files differdeleted file mode 100644 index 895cfe26a..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00090.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmf Binary files differdeleted file mode 100644 index 3bdcae4ba..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00091.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmf Binary files differdeleted file mode 100644 index a56d47504..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00092.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmf Binary files differdeleted file mode 100644 index c85f3b4de..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00093.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmf Binary files differdeleted file mode 100644 index 875bf1df8..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/9nb00094.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am b/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am deleted file mode 100644 index daec9d20e..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/HPLJ4family/fonts - -dist_xpc_DATA = \ - 9nb00051.pmf \ - 9nb00052.pmf \ - 9nb00053.pmf \ - 9nb00054.pmf \ - 9nb00055.pmf \ - 9nb00056.pmf \ - 9nb00057.pmf \ - 9nb00058.pmf \ - 9nb00059.pmf \ - 9nb00060.pmf \ - 9nb00061.pmf \ - 9nb00062.pmf \ - 9nb00063.pmf \ - 9nb00064.pmf \ - 9nb00065.pmf \ - 9nb00066.pmf \ - 9nb00067.pmf \ - 9nb00068.pmf \ - 9nb00069.pmf \ - 9nb00070.pmf \ - 9nb00071.pmf \ - 9nb00072.pmf \ - 9nb00073.pmf \ - 9nb00074.pmf \ - 9nb00075.pmf \ - 9nb00076.pmf \ - 9nb00077.pmf \ - 9nb00079.pmf \ - 9nb00080.pmf \ - 9nb00081.pmf \ - 9nb00082.pmf \ - 9nb00083.pmf \ - 9nb00084.pmf \ - 9nb00085.pmf \ - 9nb00086.pmf \ - 9nb00087.pmf \ - 9nb00088.pmf \ - 9nb00089.pmf \ - 9nb00090.pmf \ - 9nb00091.pmf \ - 9nb00092.pmf \ - 9nb00093.pmf \ - 9nb00094.pmf \ - fonts.alias \ - fonts.dir \ - lpr0ye1a.pmf \ - README diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/README b/hw/xprint/config/C/print/models/HPLJ4family/fonts/README deleted file mode 100644 index 2c9821834..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/README +++ /dev/null @@ -1,203 +0,0 @@ -$Xorg: README,v 1.3 2000/08/17 19:48:04 cpqbld Exp $ - -This directory contains "printer metric files" for the X Print -Server suitable for the LaserJet 4 family of printers - 4, 4L, -4M, 4ML, 4MP, 4P, 4Si, 4Si-MX. The following *.pmf files were -generated by the Hewlett-Packard Company. - - 9nb00051.pmf - 9nb00052.pmf - 9nb00053.pmf - 9nb00054.pmf - 9nb00055.pmf - * 9nb00056.pmf - * 9nb00057.pmf - * 9nb00058.pmf - * 9nb00059.pmf - * 9nb00060.pmf - 9nb00061.pmf - 9nb00062.pmf - 9nb00063.pmf - 9nb00064.pmf - * 9nb00065.pmf - * 9nb00066.pmf - * 9nb00067.pmf - * 9nb00068.pmf - 9nb00069.pmf - 9nb00070.pmf - 9nb00071.pmf - * 9nb00072.pmf - * 9nb00073.pmf - * 9nb00074.pmf - * 9nb00075.pmf - * 9nb00076.pmf - 9nb00077.pmf - * 9nb00079.pmf - * 9nb00080.pmf - * 9nb00081.pmf - * 9nb00082.pmf - 9nb00083.pmf - 9nb00084.pmf - 9nb00085.pmf - 9nb00086.pmf - 9nb00087.pmf - 9nb00088.pmf - 9nb00089.pmf - 9nb00090.pmf - 9nb00091.pmf - 9nb00092.pmf - 9nb00093.pmf - 9nb00094.pmf - lpr0ye1a.pmf - - - * note - the marked fonts are NOT supported by the 4L printer. If - making extensive use of the 4L, you may want to create a special - 4L model-config area and exclude these fonts. - -For reasons of not supporting iso8859.1 and hp-roman8, the following -Laserjet 4 printer fonts were not converted to *.pmf files. - - 9nb00078.pmf - 9nb00095.pmf - lpr0ylga.pmf - lpr0ypca.pmf - lpr0ypda.pmf - lpr0ypma.pmf - lpr0yr8a.pmf - -Output from the conversion utility is as follows: - - Creating iso8859 1 pmf for 9nb00051.tfm as iso8859.1/9nb00051.pmf - -COMPUGRAPHIC-Albertus-Extra Bold-r-Normal--8782-2500-2540-2540-P-42480-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00052.tfm as iso8859.1/9nb00052.pmf - -COMPUGRAPHIC-Albertus-Semi Bold-r-Normal--8782-2500-2540-2540-P-37640-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00053.tfm as iso8859.1/9nb00053.pmf - -COMPUGRAPHIC-Antique Olive-Bold-r-Normal--8782-2500-2540-2540-P-50490-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00054.tfm as iso8859.1/9nb00054.pmf - -COMPUGRAPHIC-Antique Olive-Medium-i-Normal--8782-2500-2540-2540-P-46140-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00055.tfm as iso8859.1/9nb00055.pmf - -COMPUGRAPHIC-Antique Olive-Medium-r-Normal--8782-2500-2540-2540-P-46380-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00056.tfm as iso8859.1/9nb00056.pmf - -Monotype-Arial-Bold-r-Normal--2048-2500-589-589-P-9800-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00057.tfm as iso8859.1/9nb00057.pmf - -Monotype-Arial-Medium-i-Normal--2048-2500-589-589-P-9040-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00058.tfm as iso8859.1/9nb00058.pmf - -Monotype-Arial-Bold-i-Normal--2048-2500-589-589-P-9800-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00059.tfm as iso8859.1/9nb00059.pmf - -Monotype-Arial-Medium-r-Normal--2048-2500-589-589-P-9040-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00060.tfm as iso8859.1/9nb00060.pmf - -COMPUGRAPHIC-Clarendon-Bold-r-Condensed--8782-2500-2540-2540-P-35080-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00061.tfm as iso8859.1/9nb00061.pmf - -COMPUGRAPHIC-Courier-Bold-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00062.tfm as iso8859.1/9nb00062.pmf - -COMPUGRAPHIC-Courier-Medium-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00063.tfm as iso8859.1/9nb00063.pmf - -COMPUGRAPHIC-Courier-Bold-i-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00064.tfm as iso8859.1/9nb00064.pmf - -COMPUGRAPHIC-Courier-Medium-r-Normal--8782-2500-2540-2540-M-52910-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00065.tfm as iso8859.1/9nb00065.pmf - -COMPUGRAPHIC-Garamond-Bold-r-Normal--8782-2500-2540-2540-P-38730-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00066.tfm as iso8859.1/9nb00066.pmf - -COMPUGRAPHIC-Garamond-Medium-i-Normal--8782-2500-2540-2540-P-34280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00067.tfm as iso8859.1/9nb00067.pmf - -COMPUGRAPHIC-Garamond-Bold-i-Normal--8782-2500-2540-2540-P-37020-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00068.tfm as iso8859.1/9nb00068.pmf - -COMPUGRAPHIC-Garamond-Medium-r-Normal--8782-2500-2540-2540-P-36560-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00069.tfm as iso8859.1/9nb00069.pmf - -COMPUGRAPHIC-Letter Gothic-Bold-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00070.tfm as iso8859.1/9nb00070.pmf - -COMPUGRAPHIC-Letter Gothic-Medium-i-Normal--8782-2500-2540-2540-M-44090-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00071.tfm as iso8859.1/9nb00071.pmf - -COMPUGRAPHIC-Letter Gothic-Medium-r-Normal--8782-2500-2540-2540-M-44090-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00072.tfm as iso8859.1/9nb00072.pmf - -COMPUGRAPHIC-Marigold-Medium-r-Normal--8782-2500-2540-2540-P-21890-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00073.tfm as iso8859.1/9nb00073.pmf - -COMPUGRAPHIC-Omega-Bold-r-Normal--8782-2500-2540-2540-P-38600-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00074.tfm as iso8859.1/9nb00074.pmf - -COMPUGRAPHIC-Omega-Medium-i-Normal--8782-2500-2540-2540-P-37980-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00075.tfm as iso8859.1/9nb00075.pmf - -COMPUGRAPHIC-Omega-Bold-i-Normal--8782-2500-2540-2540-P-38560-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00076.tfm as iso8859.1/9nb00076.pmf - -COMPUGRAPHIC-Omega-Medium-r-Normal--8782-2500-2540-2540-P-37770-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00077.tfm as iso8859.1/9nb00077.pmf - -COMPUGRAPHIC-Coronet-Medium-i-Normal--8782-2500-2540-2540-P-22870-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00079.tfm as iso8859.1/9nb00079.pmf - -Monotype-Times New Roman-Bold-r-Normal--2048-2500-589-589-P-8740-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00080.tfm as iso8859.1/9nb00080.pmf - -Monotype-Times New Roman-Medium-i-Normal--2048-2500-589-589-P-8230-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00081.tfm as iso8859.1/9nb00081.pmf - -Monotype-Times New Roman-Bold-i-Normal--2048-2500-589-589-P-8440-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00082.tfm as iso8859.1/9nb00082.pmf - -Monotype-Times New Roman-Medium-r-Normal--2048-2500-589-589-P-8210-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00083.tfm as iso8859.1/9nb00083.pmf - -COMPUGRAPHIC-Times-Bold-r-Normal--8782-2500-2540-2540-P-38200-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00084.tfm as iso8859.1/9nb00084.pmf - -COMPUGRAPHIC-Times-Medium-i-Normal--8782-2500-2540-2540-P-36000-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00085.tfm as iso8859.1/9nb00085.pmf - -COMPUGRAPHIC-Times-Bold-i-Normal--8782-2500-2540-2540-P-36900-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00086.tfm as iso8859.1/9nb00086.pmf - -COMPUGRAPHIC-Times-Medium-r-Normal--8782-2500-2540-2540-P-36080-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00087.tfm as iso8859.1/9nb00087.pmf - -COMPUGRAPHIC-Univers-Medium-i-Condensed--8782-2500-2540-2540-P-29970-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00088.tfm as iso8859.1/9nb00088.pmf - -COMPUGRAPHIC-Univers-Bold-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00089.tfm as iso8859.1/9nb00089.pmf - -COMPUGRAPHIC-Univers-Medium-r-Condensed--8782-2500-2540-2540-P-29970-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00090.tfm as iso8859.1/9nb00090.pmf - -COMPUGRAPHIC-Univers-Bold-r-Condensed--8782-2500-2540-2540-P-33030-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00091.tfm as iso8859.1/9nb00091.pmf - -COMPUGRAPHIC-Univers-Bold-i-Condensed--8782-2500-2540-2540-P-33030-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00092.tfm as iso8859.1/9nb00092.pmf - -COMPUGRAPHIC-Univers-Medium-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00093.tfm as iso8859.1/9nb00093.pmf - -COMPUGRAPHIC-Univers-Bold-i-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for 9nb00094.tfm as iso8859.1/9nb00094.pmf - -COMPUGRAPHIC-Univers-Medium-r-Normal--8782-2500-2540-2540-P-41280-iso8859-1 - ------------------------------------ - Creating iso8859 1 pmf for lpr0ye1a.tfm as iso8859.1/lpr0ye1a.pmf - -HP-Line Printer-Medium-r-Normal--35-85-300-300-M-180-iso8859-1 - ------------------------------------ - diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias b/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias deleted file mode 100644 index e69de29bb..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.alias +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir b/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir deleted file mode 100644 index da702ccc1..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/fonts.dir +++ /dev/null @@ -1,45 +0,0 @@ -44 -lpr0ye1a.pmf -hp-line printer-medium-r-normal--35-85-300-300-m-180-iso8859-1 -9nb00080.pmf -monotype-times new roman-medium-i-normal--2048-2500-589-589-p-8230-iso8859-1 -9nb00092.pmf -compugraphic-univers-medium-i-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00081.pmf -monotype-times new roman-bold-i-normal--2048-2500-589-589-p-8440-iso8859-1 -9nb00093.pmf -compugraphic-univers-bold-i-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00082.pmf -monotype-times new roman-medium-r-normal--2048-2500-589-589-p-8210-iso8859-1 -9nb00090.pmf -compugraphic-univers-bold-r-condensed--8782-2500-2540-2540-p-33030-iso8859-1 -9nb00083.pmf -compugraphic-times-bold-r-normal--8782-2500-2540-2540-p-38200-iso8859-1 -9nb00091.pmf -compugraphic-univers-bold-i-condensed--8782-2500-2540-2540-p-33030-iso8859-1 -9nb00084.pmf -compugraphic-times-medium-i-normal--8782-2500-2540-2540-p-36000-iso8859-1 -9nb00085.pmf -compugraphic-times-bold-i-normal--8782-2500-2540-2540-p-36900-iso8859-1 -9nb00086.pmf -compugraphic-times-medium-r-normal--8782-2500-2540-2540-p-36080-iso8859-1 -9nb00094.pmf -compugraphic-univers-medium-r-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00087.pmf -compugraphic-univers-medium-i-condensed--8782-2500-2540-2540-p-29970-iso8859-1 -9nb00088.pmf -compugraphic-univers-bold-r-normal--8782-2500-2540-2540-p-41280-iso8859-1 -9nb00089.pmf -compugraphic-univers-medium-r-condensed--8782-2500-2540-2540-p-29970-iso8859-1 -9nb00058.pmf -monotype-arial-bold-i-normal--2048-2500-589-589-p-9800-iso8859-1 -9nb00059.pmf -monotype-arial-medium-r-normal--2048-2500-589-589-p-9040-iso8859-1 -9nb00068.pmf -compugraphic-garamond-medium-r-normal--8782-2500-2540-2540-p-36560-iso8859-1 -9nb00069.pmf -compugraphic-letter gothic-bold-r-normal--8782-2500-2540-2540-m-44090-iso8859-1 -9nb00079.pmf -monotype-times new roman-bold-r-normal--2048-2500-589-589-p-8740-iso8859-1 -9nb00052.pmf -compugraphic-albertus-semi bold-r-normal--8782-2500-2540-2540-p-37640-iso8859-1 -9nb00064.pmf -compugraphic-courier-medium-r-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00076.pmf -compugraphic-omega-medium-r-normal--8782-2500-2540-2540-p-37770-iso8859-1 -9nb00053.pmf -compugraphic-antique olive-bold-r-normal--8782-2500-2540-2540-p-50490-iso8859-1 -9nb00065.pmf -compugraphic-garamond-bold-r-normal--8782-2500-2540-2540-p-38730-iso8859-1 -9nb00077.pmf -compugraphic-coronet-medium-i-normal--8782-2500-2540-2540-p-22870-iso8859-1 -9nb00066.pmf -compugraphic-garamond-medium-i-normal--8782-2500-2540-2540-p-34280-iso8859-1 -9nb00074.pmf -compugraphic-omega-medium-i-normal--8782-2500-2540-2540-p-37980-iso8859-1 -9nb00051.pmf -compugraphic-albertus-extra bold-r-normal--8782-2500-2540-2540-p-42480-iso8859-1 -9nb00067.pmf -compugraphic-garamond-bold-i-normal--8782-2500-2540-2540-p-37020-iso8859-1 -9nb00075.pmf -compugraphic-omega-bold-i-normal--8782-2500-2540-2540-p-38560-iso8859-1 -9nb00056.pmf -monotype-arial-bold-r-normal--2048-2500-589-589-p-9800-iso8859-1 -9nb00060.pmf -compugraphic-clarendon-bold-r-condensed--8782-2500-2540-2540-p-35080-iso8859-1 -9nb00072.pmf -compugraphic-marigold-medium-r-normal--8782-2500-2540-2540-p-21890-iso8859-1 -9nb00057.pmf -monotype-arial-medium-i-normal--2048-2500-589-589-p-9040-iso8859-1 -9nb00061.pmf -compugraphic-courier-bold-r-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00073.pmf -compugraphic-omega-bold-r-normal--8782-2500-2540-2540-p-38600-iso8859-1 -9nb00054.pmf -compugraphic-antique olive-medium-i-normal--8782-2500-2540-2540-p-46140-iso8859-1 -9nb00062.pmf -compugraphic-courier-medium-i-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00070.pmf -compugraphic-letter gothic-medium-i-normal--8782-2500-2540-2540-m-44090-iso8859-1 -9nb00055.pmf -compugraphic-antique olive-medium-r-normal--8782-2500-2540-2540-p-46380-iso8859-1 -9nb00063.pmf -compugraphic-courier-bold-i-normal--8782-2500-2540-2540-m-52910-iso8859-1 -9nb00071.pmf -compugraphic-letter gothic-medium-r-normal--8782-2500-2540-2540-m-44090-iso8859-1 diff --git a/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf b/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf Binary files differdeleted file mode 100644 index 483748893..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/fonts/lpr0ye1a.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/HPLJ4family/model-config b/hw/xprint/config/C/print/models/HPLJ4family/model-config deleted file mode 100644 index 1ac997ebe..000000000 --- a/hw/xprint/config/C/print/models/HPLJ4family/model-config +++ /dev/null @@ -1,39 +0,0 @@ -# $Xprint.org: HPLJ4family model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $ -# This is the configuration file for the HP LaserJet 4 Printers. -# -# Though not a deliverable for the CDEnext SI, the XP-PCL-MONO -# driver should be able to support the LaserJet 4 printers. -# -*content-orientations-supported: portrait landscape -*descriptor: Hewlett-Packard LaserJet 4 Series -*document-formats-supported: {PCL 5} {PostScript 2} -*input-trays-supported: -# 1/4" unprintable margins -*medium-source-sizes-supported:\ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {executive FALSE {6.35 177.75 6.35 260.35}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {iso-a3 FALSE {6.35 290.65 6.35 413.35}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {jis-b4 FALSE {6.35 251.65 6.35 367.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ - {monarch-envelope FALSE {6.35 91.94 6.35 184.15}}\ - {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\ - {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ - {na-number-10-envelope FALSE {6.35 98.45 6.35 234.95}}\ - {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\ - {ledger FALSE {6.35 273.05 6.35 425.45}}\ - {b FALSE {6.35 273.05 6.35 425.45}}\ - {hp-japanese-postcard FALSE {6 94 6 142 }}\ - {hp-japanese-doublepostcard FALSE {6 142 6 194 }}\ -} -*plexes-supported: simplex duplex -*printer-model: "Hewlett-Packard LaserJet 4 Series" -*printer-resolutions-supported: 300 600 -*xp-ddx-identifier: XP-PCL-MONO -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: { PCL 5 } { PostScript 2 } -*xp-raw-formats-supported: { PCL 5 } -*xp-setup-proviso: setup-optional -# EOF. diff --git a/hw/xprint/config/C/print/models/Makefile.am b/hw/xprint/config/C/print/models/Makefile.am deleted file mode 100644 index 488a06a75..000000000 --- a/hw/xprint/config/C/print/models/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -SUBDIRS = \ - PSdefault \ - CANONBJ10E-GS \ - CANONC3200-PS \ - GSdefault \ - HPDJ1600C \ - HPLJ4050-PS \ - HPLJ4family \ - PS2PDFspooldir-GS \ - PSspooldir \ - SPSPARC2 diff --git a/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am b/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am deleted file mode 100644 index 2b73b9dad..000000000 --- a/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/PS2PDFspooldir-GS - -dist_xpc_DATA = model-config -dist_xpc_SCRIPTS = ps2pdf_spooltodir.sh diff --git a/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config b/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config deleted file mode 100644 index 1d74b8676..000000000 --- a/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/model-config +++ /dev/null @@ -1,72 +0,0 @@ -# $Xprint.org: PS2PDFspooldir-GS model-config,v 1.1 2003/11/20 03:48:04 gisburn Exp $ -# PostScript DDX model-config which converts jobs to PDF via GhostScript's "ps2pdf" -# and then sends them to a spool dir instead to a print queue -# -# This model is basically a cut-down GSdefault model with a custom *xp-spooler-command -# -# DO NOT MODIFY THIS FILE!! -# -# If you want to make customisations for your printer create a copy -# of this printer model. -# Example (for creating a model config "MYCOMPANYlaserxx"): -# 1. Create model config dir: -# % mkdir MYCOMPANYlaserxx -# 2. Link (or copy) the PMF (printer font metrics) for the -# printer buildin fonts: -# % ln -s PS2PDFspooldir-GS/fonts MYCOMPANYlaserxx/. -# 3. Copy the model config file: -# % cp PS2PDFspooldir-GS/model-config MYCOMPANYlaserxx/. -# 4. Customize MYCOMPANYlaserxx/model-config to match your needs. -# -# Attributes supported for this printer model -*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape -*descriptor: PDF job spool dir /tmp/Xprintjobs -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {executive FALSE {6.35 177.80 6.35 260.35}}\ - {ledger FALSE {6.35 273.05 6.35 425.45}}\ - {quarto FALSE {6.35 209.55 6.35 268.732}}\ - {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\ - {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\ - {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\ - {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ - {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\ - {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ - {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\ - {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\ - {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ -} - -*plexes-supported: simplex duplex tumble -*printer-model: "PDF job spool dir /tmp/Xprintjobs" -# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, -# 940, 1200 and 2440 are supported DPI values, we limit it here -# to some common values: -*printer-resolutions-supported: 300 360 400 600 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional - -# Use custom spooler script which sends the output to a dir instead to a printer queue -# Note that "%xpconfigdir%" is currently only supported in Xprt servers build -# from xprint.mozdev.org sources, other platforms have replace it with the -# absolute path name to the script -*xp-spooler-command: %xpconfigdir%/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh -d /tmp/Xprintjobs -s .pdf -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" - -# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. -# xp-psddx-download-fonts defines which fonts should be downloaded as outlines -# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc") -*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc -# xp-psddx-download-font-type defines which font type is used to download outlines -# (valid values are "bitmap", "pstype1" and "pstype3") -*xp-psddx-download-font-type: pstype1 -# EOF. diff --git a/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh b/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh deleted file mode 100755 index 5739807d8..000000000 --- a/hw/xprint/config/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh -PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin -export PATH - -verbose_msgs="false" -DEFAULT_SPOOLDIR=/tmp/Xprintjobs - -usage() -{ - printf "Usage: ${0}: [options]\n" - printf "-v\tbe verbose\n" - printf "-d dirname\tdefine spool dir\n" - printf "-p string\tname of printer selected by user\n" - printf "-c integer\tnumber of copies\n" - printf "-t string\tjob title\n" - printf "-s string\tfile name suffix\n" - printf "-o string\tspooler options\n" - printf "-u mask\tpermission mask for new files (see umask)\n" - exit 2 -} - -verbose() -{ - if ${verbose_msgs} ; then - echo "$1" - fi -} - -spooldir="${DEFAULT_SPOOLDIR}" -printername= -num_job_copies= -job_title= -filename_suffix= -spooler_options= -permmask= -while getopts va:b:d:p:c:t:s:o:u: i -do - case $i in - v) - verbose_msgs="true" - ;; - d) - spooldir="$OPTARG" - ;; - p) - printername="$OPTARG" - ;; - c) - num_job_copies="$OPTARG" - ;; - t) - job_title="$OPTARG" - ;; - s) - filename_suffix="$OPTARG" - ;; - o) - spooler_options="$OPTARG" - ;; - u) - permmask="$OPTARG" - ;; - ?) usage - ;; - esac -done - -verbose "# spooldir=\"$spooldir\"" -verbose "# printername=\"$printername\"" -verbose "# num_job_copies=\"$num_job_copies\"" -verbose "# job_title=\"$job_title\"" -verbose "# spooler_options=\"$spooler_options\"" -verbose "# umask=\"$permmask\"" - -if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then - mkdir "${DEFAULT_SPOOLDIR}" - chmod a+rwxt "${DEFAULT_SPOOLDIR}" -fi - -if [ "${permmask}" != "" ] ; then - umask ${permmask} -fi - -if [ ! -d "$spooldir" ] ; then - echo "$0: spooldir \"$spooldir\" does not exits." >&2 - exit 1 -fi -if [ ! -w "$spooldir" ] ; then - echo "$0: Cannot write to spooldir \"$spooldir\"." >&2 - exit 1 -fi - -# Create first part of the output file name (prefix and an "unique" -# id(=date and time))... -filename="Xpjob_`date +%Y%m%d%H%M%S`" - -# ... then add options ... -if [ "${printername}" != "" ] ; then - filename="${filename}_${printername}" -fi -if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then - filename="${filename}_copies_${num_job_copies}" -fi -if [ "${job_title}" != "" ] ; then - filename="${filename}_title_${job_title}" -fi - -# ... mangle output file name and filter chars (like whitespaces) -# which may screw-up further processing by other shell scripts ... -filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`" - -# ... add path and suffix ... -filename="${spooldir}/${filename}${filename_suffix}" - -verbose "# File name is \"$filename\"." - -# ... and finally capture stdin to the file (we are using "gs" directly to -# avoid the problem that "ps2pdf" is not available in all Linux -# distributions by default). -#ps2pdf - - | cat >"${filename}" -gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=-" -dCompatibilityLevel=1.2 -c .setpdfwrite -f - | cat >"${filename}" - -if ${verbose_msgs} ; then - printf "# File is " ; ls -l "${filename}" -fi - -verbose "# Done." - -exit 0 -# EOF. diff --git a/hw/xprint/config/C/print/models/PSdefault/Makefile.am b/hw/xprint/config/C/print/models/PSdefault/Makefile.am deleted file mode 100644 index 040f26077..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = fonts - -xpcdir = @xpconfigdir@/C/print/models/PSdefault - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmf Binary files differdeleted file mode 100644 index 331178985..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Book.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmf Binary files differdeleted file mode 100644 index 61bcb22b9..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-BookOblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmf Binary files differdeleted file mode 100644 index 88ccf0834..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-Demi.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmf Binary files differdeleted file mode 100644 index 45cc8857b..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/AvantGarde-DemiOblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmf Binary files differdeleted file mode 100644 index ac760fdb9..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Bold.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmf Binary files differdeleted file mode 100644 index 8db974018..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-BoldOblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmf Binary files differdeleted file mode 100644 index 87aee16cc..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier-Oblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmf Binary files differdeleted file mode 100644 index 6109c8c11..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Courier.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmf Binary files differdeleted file mode 100644 index 30d462d95..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Bold.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmf Binary files differdeleted file mode 100644 index 89619516f..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-BoldOblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmf Binary files differdeleted file mode 100644 index 2a0de8afc..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica-Oblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmf Binary files differdeleted file mode 100644 index b1fd475bb..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Helvetica.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmf Binary files differdeleted file mode 100644 index aff4b4949..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Book.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmf Binary files differdeleted file mode 100644 index b5b77f353..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-BookOblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmf Binary files differdeleted file mode 100644 index 100339854..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-Demi.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmf Binary files differdeleted file mode 100644 index a8550e70d..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/LubalinGraph-DemiOblique.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am b/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am deleted file mode 100644 index 40f1e3da5..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/PSdefault/fonts - -dist_xpc_DATA = \ - AvantGarde-BookOblique.pmf \ - AvantGarde-Book.pmf \ - AvantGarde-DemiOblique.pmf \ - AvantGarde-Demi.pmf \ - Courier-BoldOblique.pmf \ - Courier-Bold.pmf \ - Courier-Oblique.pmf \ - Courier.pmf \ - Helvetica-BoldOblique.pmf \ - Helvetica-Bold.pmf \ - Helvetica-Oblique.pmf \ - Helvetica.pmf \ - LubalinGraph-BookOblique.pmf \ - LubalinGraph-Book.pmf \ - LubalinGraph-DemiOblique.pmf \ - LubalinGraph-Demi.pmf \ - NewCentSchlbk-Bold.pmf \ - NewCentSchlbk-BoldItal.pmf \ - NewCentSchlbk-Ital.pmf \ - NewCentSchlbk-Roman.pmf \ - Souvenir-DemiItalic.pmf \ - Souvenir-Demi.pmf \ - Souvenir-LightItalic.pmf \ - Souvenir-Light.pmf \ - Symbol.pmf \ - Times-BoldItalic.pmf \ - Times-Bold.pmf \ - Times-Italic.pmf \ - Times-Roman.pmf \ - ZapfDingbats.pmf - - -dest = $(DESTDIR)$(xpcdir) - -remove-stuff: - @rm -f $(dest)/fonts.dir - -install-data-hook: remove-stuff - $(MKFONTSCALE) -b -s -l $(dest) - -uninstall-hook: remove-stuff diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf Binary files differdeleted file mode 100644 index ab22aabf5..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf Binary files differdeleted file mode 100644 index e68811eb7..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf Binary files differdeleted file mode 100644 index 390f223cb..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf Binary files differdeleted file mode 100644 index 655b9b6c0..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmf Binary files differdeleted file mode 100644 index 5e786ec42..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Demi.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmf Binary files differdeleted file mode 100644 index 094b348cc..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-DemiItalic.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmf Binary files differdeleted file mode 100644 index 0bb62bde6..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-Light.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmf Binary files differdeleted file mode 100644 index 3c19a7fbf..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Souvenir-LightItalic.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmf Binary files differdeleted file mode 100644 index 48925f816..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Symbol.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmf Binary files differdeleted file mode 100644 index cf46ca03f..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Bold.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmf Binary files differdeleted file mode 100644 index ffe51af80..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-BoldItalic.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmf Binary files differdeleted file mode 100644 index 865433f83..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Italic.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmf Binary files differdeleted file mode 100644 index 625e0c43f..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/Times-Roman.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmf Binary files differdeleted file mode 100644 index 1ae9a7688..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/fonts/ZapfDingbats.pmf +++ /dev/null diff --git a/hw/xprint/config/C/print/models/PSdefault/model-config b/hw/xprint/config/C/print/models/PSdefault/model-config deleted file mode 100644 index 05a19d859..000000000 --- a/hw/xprint/config/C/print/models/PSdefault/model-config +++ /dev/null @@ -1,136 +0,0 @@ -# $Xprint.org: PSdefault model-config,v 1.2 2002/11/07 19:48:04 gisburn Exp $ -# Generic default model-config for the PostScript DDX -# -# DO NOT MODIFY THIS FILE!! -# -# If you want to make customisations for your printer create a copy -# of this printer model. -# Example (for creating a model config "MYCOMPANYlaserxx"): -# 1. Create model config dir: -# % mkdir MYCOMPANYlaserxx -# 2. Link (or copy) the PMF (printer font metrics) for the -# printer buildin fonts: -# % ln -s PSdefault/fonts MYCOMPANYlaserxx/. -# 3. Copy the model config file: -# % cp PSdefault/model-config MYCOMPANYlaserxx/. -# 4. Customize MYCOMPANYlaserxx/model-config to match your needs. -# - -# Attributes supported for this printer model -# You may want to cut the lists here down to the attributes supported -# by your printer. -*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape -*descriptor: PostScript default model -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {executive FALSE {6.35 177.80 6.35 260.35}}\ - {folio FALSE {6.35 204.47 6.35 323.85}}\ - {invoice FALSE {6.35 133.35 6.35 209.55}}\ - {ledger FALSE {6.35 273.05 6.35 425.45}}\ - {quarto FALSE {6.35 209.55 6.35 268.732}}\ - {a FALSE {6.35 209.55 6.35 273.05}}\ - {b FALSE {6.35 273.05 6.35 425.45}}\ - {c FALSE {6.35 425.45 6.35 552.45}}\ - {d FALSE {6.35 552.45 6.35 857.25}}\ - {e FALSE {6.35 857.25 6.35 1111.25}}\ - {na-6x9-envelope FALSE {6.35 146.05 6.35 222.25}}\ - {na-10x15-envelope FALSE {6.35 247.65 6.35 374.65}}\ - {monarch-envelope FALSE {6.35 91.948 6.35 184.15}}\ - {na-10x13-envelope FALSE {6.35 247.65 6.35 323.85}}\ - {na-9x12-envelope FALSE {6.35 222.25 6.35 298.45}}\ - {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}}\ - {na-7x9-envelope FALSE {6.35 171.45 6.35 222.25}}\ - {na-9x11-envelope FALSE {6.35 222.25 6.35 273.05}}\ - {na-10x14-envelope FALSE {6.35 247.65 6.35 349.25}}\ - {na-number-9-envelope FALSE {6.35 92.075 6.35 219.075}}\ - {iso-a0 FALSE {6.35 834.65 6.35 1182.65}}\ - {iso-a1 FALSE {6.35 587.65 6.35 834.65}}\ - {iso-a2 FALSE {6.35 413.65 6.35 587.65}}\ - {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\ - {iso-a6 FALSE {6.35 98.65 6.35 141.65}}\ - {iso-a7 FALSE {6.35 67.65 6.35 98.65}}\ - {iso-a8 FALSE {6.35 45.65 6.35 67.65}}\ - {iso-a9 FALSE {6.35 30.65 6.35 45.65}}\ - {iso-a10 FALSE {6.35 19.65 6.35 30.65}}\ - {iso-b1 FALSE {6.35 700.65 6.35 993.65}}\ - {iso-b2 FALSE {6.35 493.65 6.35 700.65}}\ - {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\ - {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\ - {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ - {iso-b6 FALSE {6.35 118.65 6.35 169.65}}\ - {iso-b7 FALSE {6.35 81.65 6.35 118.65}}\ - {iso-b8 FALSE {6.35 55.65 6.35 81.65}}\ - {iso-b9 FALSE {6.35 37.65 6.35 55.65}}\ - {iso-b10 FALSE {6.35 24.65 6.35 37.65}}\ - {jis-b1 FALSE {6.35 721.65 6.35 1023.65}}\ - {jis-b2 FALSE {6.35 508.65 6.35 721.65}}\ - {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\ - {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ - {jis-b6 FALSE {6.35 121.65 6.35 175.65}}\ - {jis-b7 FALSE {6.35 84.65 6.35 121.65}}\ - {jis-b8 FALSE {6.35 57.65 6.35 84.65}}\ - {jis-b9 FALSE {6.35 38.65 6.35 57.65}}\ - {jis-b10 FALSE {6.35 25.65 6.35 38.65}}\ - {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\ - {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\ - {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ - {iso-c6 FALSE {6.35 107.65 6.35 155.65}}\ - {iso-designated-long FALSE {6.35 103.65 6.35 213.65}}\ - {hp-2x-postcard FALSE {6.35 141.65 6.35 193.65}}\ - {hp-european-edp FALSE {6.35 298.45 6.35 349.25}}\ - {hp-mini FALSE {6.35 133.35 6.35 209.55}}\ - {hp-postcard FALSE {6.35 93.65 6.35 141.65}}\ - {hp-tabloid FALSE {6.35 273.05 6.35 425.45}}\ - {hp-us-edp FALSE {6.35 273.05 6.35 349.25}}\ - {hp-us-government-legal FALSE {6.35 196.85 6.35 323.85}}\ - {hp-us-government-letter FALSE {6.35 196.85 6.35 247.65}}\ -} -# If you have more than one tray use the following example: -# 1. List the supported trays -#*input-trays-supported: main manual -# 2. Define each tray and it's paper sizes -#*medium-source-sizes-supported: \ -#{ main \ -# {na-letter FALSE {6.35 209.55 6.35 273.05}} \ -# {na-legal FALSE {6.35 209.55 6.35 349.25}} \ -# {iso-a4 FALSE {6.35 203.65 6.35 290.65}} \ -#} \ -#{ manual \ -# {iso-a5 FALSE {6.35 141.65 6.35 203.65}} \ -# {iso-c5 FALSE {6.35 155.65 6.35 222.65}} \ -# {iso-designated-long FALSE {6.35 103.65 6.35 213.65}} \ -# {jis-b5 FALSE {6.35 175.65 6.35 250.65}} \ -# {monarch-envelope FALSE {6.35 91.948 6.35 184.15}} \ -# {na-legal FALSE {6.35 209.55 6.35 349.25}} \ -# {na-number-10-envelope FALSE {6.35 98.425 6.35 234.95}} \ -# {executive FALSE {6.35 177.8 6.35 260.35}} \ -# {iso-a3 FALSE {6.35 290.65 6.35 413.65}} \ -# {iso-a0 FALSE {6.35 834.65 6.35 1182.65}} \ -#} -*plexes-supported: simplex duplex tumble -*printer-model: "PostScript default model" -# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, -# 940, 1200 and 2440 are supported DPI values, we limit it here -# to some common values: -*printer-resolutions-supported: 300 360 400 600 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional - -# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. -# xp-psddx-download-fonts defines which fonts should be downloaded as outlines -# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc") -*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc -# xp-psddx-download-font-type defines which font type is used to download outlines -# (valid values are "bitmap", "pstype1" and "pstype3") -*xp-psddx-download-font-type: pstype1 -# EOF. diff --git a/hw/xprint/config/C/print/models/PSspooldir/Makefile.am b/hw/xprint/config/C/print/models/PSspooldir/Makefile.am deleted file mode 100644 index 717cd2c36..000000000 --- a/hw/xprint/config/C/print/models/PSspooldir/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/PSspooldir - -dist_xpc_DATA = model-config -dist_xpc_SCRIPTS = spooltodir.sh diff --git a/hw/xprint/config/C/print/models/PSspooldir/model-config b/hw/xprint/config/C/print/models/PSspooldir/model-config deleted file mode 100644 index 6bb477767..000000000 --- a/hw/xprint/config/C/print/models/PSspooldir/model-config +++ /dev/null @@ -1,71 +0,0 @@ -# $Xprint.org: PSspooldir model-config,v 1.1 2002/11/25 19:48:04 gisburn Exp $ -# PostScript DDX model-config which sends jobs to a spool dir instead to a print queue -# -# This model is basically a cut-down PSdefault model with a custom *xp-spooler-command -# -# DO NOT MODIFY THIS FILE!! -# -# If you want to make customisations for your printer create a copy -# of this printer model. -# Example (for creating a model config "MYCOMPANYlaserxx"): -# 1. Create model config dir: -# % mkdir MYCOMPANYlaserxx -# 2. Link (or copy) the PMF (printer font metrics) for the -# printer buildin fonts: -# % ln -s PSspooldir/fonts MYCOMPANYlaserxx/. -# 3. Copy the model config file: -# % cp PSspooldir/model-config MYCOMPANYlaserxx/. -# 4. Customize MYCOMPANYlaserxx/model-config to match your needs. -# -# Attributes supported for this printer model -*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape -*descriptor: PostScript job spool dir /tmp/Xprintjobs -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ -{ '' \ - {na-letter FALSE {6.35 209.55 6.35 273.05}}\ - {na-legal FALSE {6.35 209.55 6.35 349.25}}\ - {executive FALSE {6.35 177.80 6.35 260.35}}\ - {ledger FALSE {6.35 273.05 6.35 425.45}}\ - {quarto FALSE {6.35 209.55 6.35 268.732}}\ - {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ - {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\ - {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\ - {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\ - {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ - {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\ - {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\ - {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ - {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\ - {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\ - {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ -} - -*plexes-supported: simplex duplex tumble -*printer-model: "PostScript job spool dir /tmp/Xprintjobs" -# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, -# 940, 1200 and 2440 are supported DPI values, we limit it here -# to some common values: -*printer-resolutions-supported: 300 360 400 600 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional - -# Use custom spooler script which sends the output to a dir instead to a printer queue -# Note that "%xpconfigdir%" is currently only supported in Xprt servers build -# from xprint.mozdev.org sources, other platforms have replace it with the -# absolute path name to the script -*xp-spooler-command: %xpconfigdir%/C/print/models/PSspooldir/spooltodir.sh -d /tmp/Xprintjobs -s .ps -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" - -# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. -# xp-psddx-download-fonts defines which fonts should be downloaded as outlines -# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc") -*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc -# xp-psddx-download-font-type defines which font type is used to download outlines -# (valid values are "bitmap", "pstype1" and "pstype3") -*xp-psddx-download-font-type: pstype1 -# EOF. diff --git a/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh b/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh deleted file mode 100755 index aba14e1b3..000000000 --- a/hw/xprint/config/C/print/models/PSspooldir/spooltodir.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh -PATH=/usr/bin:/usr/sbin:/bin:/sbin -export PATH - -verbose_msgs="false" -DEFAULT_SPOOLDIR=/tmp/Xprintjobs - -usage() -{ - printf "Usage: ${0}: [options]\n" - printf "-v\tbe verbose\n" - printf "-d dirname\tdefine spool dir\n" - printf "-p string\tname of printer selected by user\n" - printf "-c integer\tnumber of copies\n" - printf "-t string\tjob title\n" - printf "-s string\tfile name suffix\n" - printf "-o string\tspooler options\n" - printf "-u mask\tpermission mask for new files (see umask)\n" - exit 2 -} - -verbose() -{ - if ${verbose_msgs} ; then - echo "$1" - fi -} - -spooldir="${DEFAULT_SPOOLDIR}" -printername= -num_job_copies= -job_title= -filename_suffix= -spooler_options= -permmask= -while getopts va:b:d:p:c:t:s:o:u: i -do - case $i in - v) - verbose_msgs="true" - ;; - d) - spooldir="$OPTARG" - ;; - p) - printername="$OPTARG" - ;; - c) - num_job_copies="$OPTARG" - ;; - t) - job_title="$OPTARG" - ;; - s) - filename_suffix="$OPTARG" - ;; - o) - spooler_options="$OPTARG" - ;; - u) - permmask="$OPTARG" - ;; - ?) usage - ;; - esac -done - -verbose "# spooldir=\"$spooldir\"" -verbose "# printername=\"$printername\"" -verbose "# num_job_copies=\"$num_job_copies\"" -verbose "# job_title=\"$job_title\"" -verbose "# spooler_options=\"$spooler_options\"" -verbose "# umask=\"$permmask\"" - -if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then - mkdir "${DEFAULT_SPOOLDIR}" - chmod a+rwxt "${DEFAULT_SPOOLDIR}" -fi - -if [ "${permmask}" != "" ] ; then - umask ${permmask} -fi - -if [ ! -d "$spooldir" ] ; then - echo "$0: spooldir \"$spooldir\" does not exits." >&2 - exit 1 -fi -if [ ! -w "$spooldir" ] ; then - echo "$0: Cannot write to spooldir \"$spooldir\"." >&2 - exit 1 -fi - -# Create first part of the output file name (prefix and an "unique" -# id(=date and time))... -filename="Xpjob_`date +%Y%m%d%H%M%S`" - -# ... then add options ... -if [ "${printername}" != "" ] ; then - filename="${filename}_${printername}" -fi -if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then - filename="${filename}_copies_${num_job_copies}" -fi -if [ "${job_title}" != "" ] ; then - filename="${filename}_title_${job_title}" -fi - -# ... mangle output file name and filter chars (like whitespaces) -# which may screw-up further processing by other shell scripts ... -filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`" - -# ... add path and suffix ... -filename="${spooldir}/${filename}${filename_suffix}" - -verbose "# File name is \"$filename\"." - -# ... and finally capture stdin to the file. -cat >"${filename}" - -if ${verbose_msgs} ; then - printf "# File is " ; ls -l "${filename}" -fi - -verbose "# Done." - -exit 0 -# EOF. diff --git a/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am b/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am deleted file mode 100644 index 5a56f90fb..000000000 --- a/hw/xprint/config/C/print/models/SPSPARC2/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -SUBDIRS = fonts - -xpcdir = @xpconfigdir@/C/print/models/SPSPARC2 - -dist_xpc_DATA = model-config diff --git a/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am b/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am deleted file mode 100644 index d1ee6cf42..000000000 --- a/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -xpcdir = @xpconfigdir@/C/print/models/SPSPARC2/fonts - -parentdir = ../../PSdefault/fonts - -XPFONTS = \ - Courier-Bold.pmf \ - Courier-BoldOblique.pmf \ - Courier-Oblique.pmf \ - Courier.pmf \ - Helvetica-Bold.pmf \ - Helvetica-BoldOblique.pmf \ - Helvetica-Oblique.pmf \ - Helvetica.pmf \ - Symbol.pmf \ - Times-Bold.pmf \ - Times-BoldItalic.pmf \ - Times-Italic.pmf \ - Times-Roman.pmf - -dest = $(DESTDIR)$(xpcdir) - -remove-stuff: - for x in $(XPFONTS) ; do \ - rm -f $(dest)/$$x ; \ - done - - rm -f $(dest)/fonts.dir - -install-data-hook: remove-stuff - mkdir -p $(dest) ; \ - for x in $(XPFONTS) ; do \ - ln -s $(parentdir)/$$x $(dest)/$$x ; \ - done - - $(MKFONTSCALE) -b -s -l $(dest) - -uninstall-hook: remove-stuff diff --git a/hw/xprint/config/C/print/models/SPSPARC2/model-config b/hw/xprint/config/C/print/models/SPSPARC2/model-config deleted file mode 100644 index 9f29b9992..000000000 --- a/hw/xprint/config/C/print/models/SPSPARC2/model-config +++ /dev/null @@ -1,18 +0,0 @@ -# $Xprint.org: SPSPARC2 model-config,v 1.4 2002/11/07 19:48:04 gisburn Exp $ -*content-orientations-supported: portrait landscape -*descriptor: SunPics SPARCprinter II -*document-formats-supported: {POSTSCRIPT 2} -*input-trays-supported: -*medium-source-sizes-supported: \ - { '' {na-letter FALSE {6.35 209.55 6.35 273.05}} \ - {na-legal FALSE {6.35 209.55 6.35 349.25}} \ - {iso-a4 FALSE {6.35 203.65 6.35 290.65}}} -*plexes-supported: simplex -*printer-model: "SunPics SPARCprinter II" -*printer-resolutions-supported: 300 -*xp-ddx-identifier: XP-POSTSCRIPT -*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts -*xp-embedded-formats-supported: {POSTSCRIPT 2} -*xp-raw-formats-supported: {POSTSCRIPT 2} -*xp-setup-proviso: setup-optional -# EOF. diff --git a/hw/xprint/config/Makefile.am b/hw/xprint/config/Makefile.am deleted file mode 100644 index 197d19de0..000000000 --- a/hw/xprint/config/Makefile.am +++ /dev/null @@ -1,712 +0,0 @@ -## Locale mappings -## Notes: -## - only ASCII chars are allowed -## - "C" and "en_US" should not be used, they are real directories - -# List of locales which should be linked to the "C" locale - -SUBDIRS = C en_US - -xpconfigdir = @xpconfigdir@ - -C_LOCALES= \ - POSIX \ - af_ZA \ - af_ZA.iso88591 \ - ar \ - ar_AE \ - ar_AE.iso88596 \ - ar_AE.utf8 \ - ar_BH \ - ar_BH.iso88596 \ - ar_BH.utf8 \ - ar_DZ \ - ar_DZ.iso88596 \ - ar_DZ.utf8 \ - ar_EG \ - ar_EG.ISO8859-6 \ - ar_EG.UTF-8 \ - ar_EG.iso88596 \ - ar_EG.utf8 \ - ar_IN.utf8 \ - ar_IQ \ - ar_IQ.iso88596 \ - ar_IQ.utf8 \ - ar_JO \ - ar_JO.iso88596 \ - ar_JO.utf8 \ - ar_KW \ - ar_KW.iso88596 \ - ar_KW.utf8 \ - ar_LB \ - ar_LB.iso88596 \ - ar_LB.utf8 \ - ar_LY \ - ar_LY.iso88596 \ - ar_LY.utf8 \ - ar_MA \ - ar_MA.iso88596 \ - ar_MA.utf8 \ - ar_OM \ - ar_OM.iso88596 \ - ar_OM.utf8 \ - ar_QA \ - ar_QA.iso88596 \ - ar_QA.utf8 \ - ar_SA \ - ar_SA.iso88596 \ - ar_SA.utf8 \ - ar_SD \ - ar_SD.iso88596 \ - ar_SD.utf8 \ - ar_SY \ - ar_SY.iso88596 \ - ar_SY.utf8 \ - ar_TN \ - ar_TN.iso88596 \ - ar_TN.utf8 \ - ar_YE \ - ar_YE.iso88596 \ - ar_YE.utf8 \ - be_BY \ - be_BY.cp1251 \ - be_BY.utf8 \ - bg_BG \ - bg_BG.ISO8859-5 \ - bg_BG.cp1251 \ - bg_BG.utf8 \ - bn_IN.UTF-8 \ - bn_IN.utf8 \ - br_FR \ - br_FR.iso88591 \ - bs \ - bs_BA \ - bs_BA.iso88592 \ - bs_BA.ISO8859-2 \ - bs_BA.ISO-8859-2 \ - bs_BA.ISO_8859-2 \ - bs_BA.UTF-8 \ - bokmal \ - ca \ - ca.ISO8859-1 \ - ca.ISO8859-15 \ - ca_ES \ - ca_ES.ISO8859-1 \ - ca_ES.ISO8859-15 \ - ca_ES.iso88591 \ - ca_ES.iso885915@euro \ - ca_ES.utf8 \ - ca_ES@euro \ - catalan \ - croatian \ - cs_CZ \ - cs_CZ.ISO8859-2 \ - cs_CZ.iso88592 \ - cs_CZ.utf8 \ - cy_GB \ - cy_GB.iso885914 \ - cz \ - cz.ISO8859-2 \ - czech \ - da \ - da.ISO8859-1 \ - da.ISO8859-15 \ - danish \ - dansk \ - da_DK \ - da_DK.ISO8859-1 \ - da_DK.ISO8859-15 \ - da_DK.iso88591 \ - da_DK.iso885915 \ - da_DK.utf8 \ - de \ - de.ISO8859-1 \ - de.ISO8859-15 \ - de.UTF-8 \ - deutsch \ - de_AT \ - de_AT.ISO8859-1 \ - de_AT.ISO8859-15 \ - de_AT.iso88591 \ - de_AT.iso885915@euro \ - de_AT.utf8 \ - de_AT@euro \ - de_BE \ - de_BE.iso88591 \ - de_BE.iso885915@euro \ - de_BE@euro \ - de_CH \ - de_CH.ISO8859-1 \ - de_CH.iso88591 \ - de_CH.utf8 \ - de_DE \ - de_DE.ISO8859-1 \ - de_DE.ISO8859-15 \ - de_DE.UTF-8 \ - de_DE.iso88591 \ - de_DE.iso885915@euro \ - de_DE.utf8 \ - de_DE@euro \ - de_LU \ - de_LU.iso88591 \ - de_LU.iso885915@euro \ - de_LU.utf8 \ - de_LU@euro \ - el_GR \ - el_GR.ISO8859-7 \ - el_GR.ISO8859-7@euro \ - el_GR.iso88597 \ - el_GR.utf8 \ - en_AU \ - en_AU.ISO8859-1 \ - en_AU.iso88591 \ - en_AU.utf8 \ - en_BW \ - en_BW.iso88591 \ - en_DK \ - en_DK.iso88591 \ - en_GB \ - en_GB.ISO8859-1 \ - en_GB.ISO8859-15 \ - en_GB.iso88591 \ - en_GB.iso885915 \ - en_GB.utf8 \ - en_HK \ - en_HK.iso88591 \ - en_IE \ - en_IE.ISO8859-1 \ - en_IE.ISO8859-15 \ - en_IE.iso88591 \ - en_IE.iso885915@euro \ - en_IE.utf8 \ - en_IE@euro \ - en_IN \ - en_IN.utf8 \ - en_NZ \ - en_NZ.ISO8859-1 \ - en_NZ.iso88591 \ - en_NZ.utf8 \ - en_PH \ - en_PH.iso88591 \ - en_SG \ - en_SG.iso88591 \ - en_ZA \ - en_ZA.iso88591 \ - en_ZA.utf8 \ - en_ZW \ - en_ZW.iso88591 \ - es_AR \ - es_AR.ISO8859-1 \ - es_AR.iso88591 \ - es_AR.utf8 \ - es_BO \ - es_BO.ISO8859-1 \ - es_BO.iso88591 \ - es_BO.utf8 \ - es_CL \ - es_CL.ISO8859-1 \ - es_CL.iso88591 \ - es_CL.utf8 \ - es_CO \ - es_CO.ISO8859-1 \ - es_CO.iso88591 \ - es_CO.utf8 \ - es_CR \ - es_CR.ISO8859-1 \ - es_CR.iso88591 \ - es_CR.utf8 \ - es_DO \ - es_DO.iso88591 \ - es_DO.utf8 \ - es_EC \ - es_EC.ISO8859-1 \ - es_EC.iso88591 \ - es_EC.utf8 \ - es_ES \ - es_ES.ISO8859-1 \ - es_ES.ISO8859-15 \ - es_ES.UTF-8 \ - es_ES.iso88591 \ - es_ES.iso885915@euro \ - es_ES.utf8 \ - es_ES@euro \ - es_GT \ - es_GT.ISO8859-1 \ - es_GT.iso88591 \ - es_GT.utf8 \ - es_HN \ - es_HN.iso88591 \ - es_HN.utf8 \ - es_MX \ - es_MX.ISO8859-1 \ - es_MX.iso88591 \ - es_MX.utf8 \ - es_NI \ - es_NI.ISO8859-1 \ - es_NI.iso88591 \ - es_NI.utf8 \ - es_PA \ - es_PA.ISO8859-1 \ - es_PA.iso88591 \ - es_PA.utf8 \ - es_PE \ - es_PE.ISO8859-1 \ - es_PE.iso88591 \ - es_PE.utf8 \ - es_PY \ - es_PY.ISO8859-1 \ - es_PY.iso88591 \ - es_PY.utf8 \ - es_SV \ - es_SV.ISO8859-1 \ - es_SV.iso88591 \ - es_SV.utf8 \ - es_UY \ - es_UY.ISO8859-1 \ - es_UY.iso88591 \ - es_UY.utf8 \ - es_VE \ - es_VE.ISO8859-1 \ - es_VE.iso88591 \ - es_VE.utf8 \ - et_EE \ - et_EE.ISO8859-15 \ - et_EE.iso88591 \ - et_EE.utf8 \ - eu_ES \ - eu_ES.iso88591 \ - eu_ES.iso885915@euro \ - eu_ES@euro \ - fa_IR.utf8 \ - fi_FI \ - fi_FI.ISO8859-1 \ - fi_FI.ISO8859-15 \ - fi_FI.UTF-8 \ - fi_FI.iso88591 \ - fi_FI.iso885915@euro \ - fi_FI.utf8 \ - fi_FI@euro \ - fo_FO \ - fo_FO.iso88591 \ - fo_FO.utf8 \ - fr_BE \ - fr_BE.ISO8859-1 \ - fr_BE.ISO8859-15 \ - fr_BE.UTF-8 \ - fr_BE.iso88591 \ - fr_BE.iso885915@euro \ - fr_BE.utf8 \ - fr_BE@euro \ - fr_CH \ - fr_CH.ISO8859-1 \ - fr_CH.iso88591 \ - fr_CH.utf8 \ - fr_FR \ - fr_FR.ISO8859-1 \ - fr_FR.ISO8859-15 \ - fr_FR.UTF-8 \ - fr_FR.iso88591 \ - fr_FR.iso885915@euro \ - fr_FR.utf8 \ - fr_FR@euro \ - fr_LU \ - fr_LU.iso88591 \ - fr_LU.iso885915@euro \ - fr_LU.utf8 \ - fr_LU@euro \ - ga_IE \ - ga_IE.iso88591 \ - ga_IE.iso885915@euro \ - ga_IE.utf8 \ - ga_IE@euro \ - gl_ES \ - gl_ES.iso88591 \ - gl_ES.iso885915@euro \ - gl_ES.utf8 \ - gl_ES@euro \ - gu_IN.UTF-8 \ - gu_IN.utf8 \ - gv_GB \ - gv_GB.iso88591 \ - hebrew \ - he \ - he_IL \ - he_IL.ISO8859-8 \ - he_IL.UTF-8 \ - he_IL.iso88598 \ - he_IL.utf8 \ - hi_IN.UTF-8 \ - hi_IN.utf8 \ - hr_HR \ - hr_HR.ISO8859-2 \ - hr_HR.iso88592 \ - hr_HR.utf8 \ - hu_HU \ - hu_HU.ISO8859-2 \ - hu_HU.iso88592 \ - hu_HU.utf8 \ - id_ID \ - id_ID.iso88591 \ - id_ID.utf8 \ - is_IS \ - is_IS.ISO8859-1 \ - is_IS.iso88591 \ - is_IS.utf8 \ - it \ - it.ISO8859-1 \ - it.ISO8859-15 \ - it.UTF-8 \ - italian \ - it_CH \ - it_CH.iso88591 \ - it_CH.utf8 \ - it_IT \ - it_IT.ISO8859-1 \ - it_IT.ISO8859-15 \ - it_IT.UTF-8 \ - it_IT.iso88591 \ - it_IT.iso885915@euro \ - it_IT.utf8 \ - it_IT@euro \ - iw_IL \ - iw_IL.iso88598 \ - ja \ - japan \ - japanese \ - japanese.euc \ - japanese.sjis \ - ja_JP \ - ja_JP.EUC \ - ja_JP.PCK \ - ja_JP.UTF-8 \ - ja_JP.eucJP \ - ja_JP.eucjp \ - ja_JP.sjis \ - ja_JP.ujis \ - ja_JP.utf8 \ - ka_GE \ - ka_GE.georgianps \ - kl_GL \ - kl_GL.iso88591 \ - kl_GL.utf8 \ - ko \ - ko.UTF-8 \ - korean \ - korean.euc \ - ko_KR \ - ko_KR.EUC \ - ko_KR.EUC@dict \ - ko_KR.UTF-8 \ - ko_KR.UTF-8@dict \ - ko_KR.euckr \ - ko_KR.utf8 \ - kw_GB \ - kw_GB.iso88591 \ - lt_LT \ - lt_LT.ISO8859-13 \ - lt_LT.iso885913 \ - lt_LT.utf8 \ - lithuanian \ - lt \ - lt.ISO8859-13 \ - lv \ - lv.ISO8859-13 \ - lv_LV \ - lv_LV.ISO8859-13 \ - lv_LV.iso885913 \ - lv_LV.utf8 \ - mi_NZ \ - mi_NZ.iso885913 \ - mk_MK \ - mk_MK.ISO8859-5 \ - mk_MK.iso88595 \ - mk_MK.utf8 \ - mr_IN.utf8 \ - ms_MY \ - ms_MY.iso88591 \ - mt_MT \ - mt_MT.iso88593 \ - nb_NO \ - nb_NO.ISO-8859-1 \ - nl \ - nl.ISO8859-1 \ - nl.ISO8859-15 \ - nl_BE \ - nl_BE.ISO8859-1 \ - nl_BE.ISO8859-15 \ - nl_BE.iso88591 \ - nl_BE.iso885915@euro \ - nl_BE.utf8 \ - nl_BE@euro \ - nl_NL \ - nl_NL.ISO8859-1 \ - nl_NL.ISO8859-15 \ - nl_NL.iso88591 \ - nl_NL.iso885915@euro \ - nl_NL.utf8 \ - nl_NL@euro \ - nn_NO \ - nn_NO.iso88591 \ - no \ - no.ISO8859-1 \ - no_NO \ - no_NO.ISO8859-1@bokmal \ - no_NO.ISO8859-1@nynorsk \ - no_NO.iso88591 \ - no_NO.utf8 \ - norwegian \ - oc_FR \ - oc_FR.iso88591 \ - pa_IN.UTF-8 \ - pa_IN.utf8 \ - polish \ - pl_PL \ - pl_PL.ISO8859-2 \ - pl_PL.UTF-8 \ - pl_PL.iso88592 \ - pl_PL.utf8 \ - portuguese \ - pt \ - pt.ISO8859-1 \ - pt.ISO8859-15 \ - pt_BR \ - pt_BR.ISO8859-1 \ - pt_BR.ISO-8859-1 \ - pt_BR.ISO_8859-1 \ - pt_BR.iso88591 \ - pt_BR.iso885915 \ - pt_BR.88591 \ - pt_BR.88591.en \ - pt_BR.utf8 \ - pt_BR.UTF-8 \ - pt_PT \ - pt_PT.ISO8859-1 \ - pt_PT.ISO8859-15 \ - pt_PT.iso88591 \ - pt_PT.iso885915@euro \ - pt_PT.utf8 \ - pt_PT@euro \ - ro_RO \ - ro_RO.ISO8859-2 \ - ro_RO.iso88592 \ - ro_RO.utf8 \ - ru \ - ru.ISO8859-5 \ - ru.UTF-8 \ - ru.ansi1251 \ - ru.koi8-r \ - ru_SU \ - russian \ - ru_RU \ - ru_RU.ANSI1251 \ - ru_RU.ISO8859-5 \ - ru_RU.KOI8-R \ - ru_RU.UTF-8 \ - ru_RU.iso88595 \ - ru_RU.koi8r \ - ru_RU.utf8 \ - ru_UA \ - ru_UA.koi8u \ - romanian \ - se_NO \ - se_NO.utf8 \ - si \ - sinhala \ - si_LK \ - si_LK.UTF8 \ - sk \ - sk.ISO8859-2 \ - slovak \ - slovene \ - slovenian \ - spanish \ - sk_SK \ - sk_SK.ISO8859-2 \ - sk_SK.iso88592 \ - sk_SK.utf8 \ - sh \ - sh.ISO8859-2 \ - sh_BA.ISO8859-2@bosnia \ - sh_YU \ - sh_YU.iso88592 \ - sh_YU.utf8 \ - sl_SI \ - sl_SI.ISO8859-2 \ - sl_SI.iso88592 \ - sl_SI.utf8 \ - su \ - su.ISO8859-1 \ - sq_AL \ - sq_AL.ISO8859-2 \ - sq_AL.iso88591 \ - sq_AL.utf8 \ - sr_SP \ - sr_SP.ISO8859-5 \ - sr_YU \ - sr_YU.ISO8859-5 \ - sr_YU.iso88592 \ - sr_YU.iso88595@cyrillic \ - sr_YU.utf8 \ - sr_YU@cyrillic \ - sv \ - sv.ISO8859-1 \ - sv.ISO8859-15 \ - sv.UTF-8 \ - sv_FI \ - sv_FI.iso88591 \ - sv_FI.iso885915@euro \ - sv_FI.utf8 \ - sv_FI@euro \ - sv_SE \ - sv_SE.ISO8859-1 \ - sv_SE.ISO8859-15 \ - sv_SE.UTF-8 \ - sv_SE.iso88591 \ - sv_SE.iso885915 \ - sv_SE.utf8 \ - swedish \ - ta_IN \ - ta_IN.utf8 \ - te_IN \ - te_IN.utf8 \ - tg_TJ \ - tg_TJ.koi8t \ - th \ - thai \ - th_TH \ - th_TH.ISO8859-11 \ - th_TH.TIS620 \ - th_TH.UTF-8 \ - th_TH.tis620 \ - th_TH.utf8 \ - tl_PH \ - tl_PH.iso88591 \ - tr \ - tr.ISO8859-9 \ - turkish \ - tr_TR \ - tr_TR.ISO8859-9 \ - tr_TR.UTF-8 \ - tr_TR.iso88599 \ - tr_TR.utf8 \ - uk_UA \ - uk_UA.koi8u \ - uk_UA.utf8 \ - ur_PK \ - ur_PK.utf8 \ - uz_UZ \ - uz_UZ.iso88591 \ - vi_VN \ - vi_VN.tcvn \ - vi_VN.utf8 \ - wa_BE \ - wa_BE.iso88591 \ - wa_BE.iso885915@euro \ - wa_BE@euro \ - zh \ - zh.GBK \ - zh.UTF-8 \ - zh_CN \ - zh_CN.EUC \ - zh_CN.EUC@pinyin \ - zh_CN.EUC@radical \ - zh_CN.EUC@stroke \ - zh_CN.GB18030 \ - zh_CN.GB18030@pinyin \ - zh_CN.GB18030@radical \ - zh_CN.GB18030@stroke \ - zh_CN.GBK \ - zh_CN.GBK@pinyin \ - zh_CN.GBK@radical \ - zh_CN.GBK@stroke \ - zh_CN.UTF-8 \ - zh_CN.UTF-8@pinyin \ - zh_CN.UTF-8@radical \ - zh_CN.UTF-8@stroke \ - zh_CN.gb18030 \ - zh_CN.gb2312 \ - zh_CN.gbk \ - zh_CN.utf8 \ - zh_HK \ - zh_HK.BIG5HK \ - zh_HK.BIG5HK@radical \ - zh_HK.BIG5HK@stroke \ - zh_HK.UTF-8 \ - zh_HK.UTF-8@radical \ - zh_HK.UTF-8@stroke \ - zh_HK.big5hkscs \ - zh_HK.utf8 \ - zh_TW \ - zh_TW.BIG5 \ - zh_TW.BIG5@pinyin \ - zh_TW.BIG5@radical \ - zh_TW.BIG5@stroke \ - zh_TW.BIG5@zhuyin \ - zh_TW.EUC \ - zh_TW.EUC@pinyin \ - zh_TW.EUC@radical \ - zh_TW.EUC@stroke \ - zh_TW.EUC@zhuyin \ - zh_TW.UTF-8 \ - zh_TW.UTF-8@pinyin \ - zh_TW.UTF-8@radical \ - zh_TW.UTF-8@stroke \ - zh_TW.UTF-8@zhuyin \ - zh_TW.big5 \ - zh_TW.euctw \ - zh_TW.utf8 - - -# List of locales which should be linked to the "en_US" locale, -# e.g. these locales should get the defaults (for example that -# US-Letter is used as default papersize) mainly used in the USA -US_LOCALES= \ - en_CA \ - en_CA.ISO8859-1 \ - en_CA.iso88591 \ - en_CA.utf8 \ - en_US.ISO8859-1 \ - en_US.ISO8859-15 \ - en_US.UTF-8 \ - en_US.iso88591 \ - en_US.iso885915 \ - en_US.utf8 \ - es_PR \ - es_PR.iso88591 \ - es_PR.utf8 \ - es_US \ - es_US.iso88591 \ - fr_CA \ - fr_CA.ISO8859-1 \ - fr_CA.iso88591 \ - fr_CA.utf8 \ - yi_US \ - yi_US.cp1255 - -dest = $(DESTDIR)$(xpconfigdir) - -remove-links: - for dir in $(US_LOCALES) ; do \ - rm -f $(dest)/$${dir} ; \ - done ; \ - \ - for dir in $(C_LOCALES) ; do \ - rm -f $(dest)/$${dir} ; \ - done ; - -install-data-local: remove-links - mkdir -p $(dest) ; \ - mkdir -p $(dest)/C; \ - mkdir -p $(dest)/en_US; \ - \ - for dir in $(US_LOCALES) ; do \ - ln -s en_US $(dest)/$${dir} ; \ - done ; \ - \ - for dir in $(C_LOCALES) ; do \ - ln -s C $(dest)/$${dir} ; \ - done ; - -uninstall-hook: remove-links - -dist_xpconfig_DATA = README diff --git a/hw/xprint/config/README b/hw/xprint/config/README deleted file mode 100644 index d7447815d..000000000 --- a/hw/xprint/config/README +++ /dev/null @@ -1,318 +0,0 @@ - - -------------------------------------- - The X Print Service - The Basics - -------------------------------------- - -Index - - 1.0 X Print Service Overview - - - 2.0 How the X Print Service Works - - - 3.0 Using the X Print Service - - 3.1 X Print Server Configuration - - 3.2 Starting the X Print Service - - 3.3 Configuring the environment - - 3.4 General End-User Sequence - - -1.0 X Print Service Overview -============================= - -The "X Print Service" technology allows X rendering to devices such as -printers and fax. Most of the service is available in the X11 -technology stack as Xp, with the remainder in the CDE technology stack -as DtPrint. Modifications have also been made to the Motif technology -stack to support Xp and DtPrint. - -The Xp portion consists of: - * Xp Extension for the X-Server (included in the X-Server Xprt) - * Xp Extension API for the client side (libXp) - * PCL ddx driver that converts core X to native PCL - * Postscript ddx driver that converts core X to native Postscript - * Raster ddx driver that generates xwd rasters which can be - converted to PCL or Postscript rasters - -The DtPrint portion consists of: - * A collection of print GUIs (libDtPrint) - * A Print Dialog Manager that can assist a client in - setting printing options (dtpdm, dtpdmd) - -From an X clients perspective, it can attach to one of two nearly -identical X-Servers, a "Video" X-Server, and a "Print" X-Server -which has the additional Xp capability but otherwise looks and -behaves the same. - - - -2.0 How the X Print Service Works -================================== - -The X Print Service expands on the traditional X-Server and Xlib world -in four ways. - -1. Most obvious is the use of "print ddx drivers" instead of - "video ddx drivers". While a video ddx driver modifies pixels - in a video frame buffer, a print ddx driver generates "page - description language (PDL)" output such as PCL or Postscript. - - Once a print ddx driver generates PDL output, it can be sent to - a spooler such as lp(1) or retrieved by the client. - - Though not currently done, a single X-Server can support both - print and video ddx drivers. - -2. Since printers support "paged" output, unlike video, a portion - of the Xp Extension supports APIs to delineate printed output. - For example, XpStartPage and XpEndPage tell the X-Server where - a physical page starts and ends in an otherwise continuous - stream of X rendering primitives. Likewise, XpStartJob and - XpEndJob determine when a collection of pages starts and ends. - XpEndJob typically causes the generated PDL to be submitted to - a spooler, such as lp(1). - -3. Since printers have extensive capabilities, another portion of - the Xp Extension supports APIs to manipulate "print contexts". - - Once a printer is selected using the Xp Extension API, a print - context to represent it can be created. A print context - embodies the printer selected - it contains the printer's - default capabilities, selectable range of capabilities, - printer state, and generated output. Some "attributes" within - the print context can be modified by the user, and the - X-Server and print ddx driver will react accordingly. For - example, the attribute "content-orientation" can be set to - "landscape" or "portrait". - -4. Since printers can have "built in" fonts, the Xp Extension in - the X-Server works with the print ddx drivers to make - available (for printing only) additional fonts on a per print - context basis. - - When a print context is created and set for a given printer, - the X font calls may be able to access additional printer - fonts. To do this (typically), the X-Server must have access - to "printer metric files" (.pmf) that describe at minimum the - metrics of the built in fonts. - - - -3.0 Using the X Print Service -============================== - -There are three tasks to start the X Print Service: 1) configuring the -X Print Server, 2) starting the X Print Service, 3) configuring the user -session so that clients can find the running X Print Service. - -The tasks are described in detail below. - - -3.1 X Print Server Configuration ---------------------------------- - -The X Print Server (Xprt) can read a number of configuration files which -control its behavior and support for printers. Each vendor platform has -a default location for this information. Xprt can also read the -environment variable XPCONFIGDIR to locate alternate configuration -directories. Common settings include: - - * export XPCONFIGDIR=/X11/lib/X11/XpConfig/ - - * export XPCONFIGDIR=/proj/x11/xc/programs/Xserver/XpConfig/ - -Xprt has many built-in defaults, and lacking any configuration files, -will immediately try to support all printers visible via lpstat(1). - -In order of importance for configuration by a system administrator, the -configuration files for a "C" locale are as follows. - - ${XPCONFIGDIR}/C/print/Xprinters - - `Xprinters' is the top most configuration file. It tells - Xprt which specific printer names (e.g. mylaser) should - be supported, and whether lpstat(1) or other commands - should be used to automatically supplement the list of - printers. - - ${XPCONFIGDIR}/C/print/attributes/printer - - The `printer' file maps printer names to model - configurations (see `model-config' below). For example, - "mylaser" could be mapped to a "HPDJ1600C", and all other - arbitrary printers could be mapped to a default, such as - "HPLJ4SI". When depending on lpstat(1) in the Xprinters - file, setting up defaults in `printer' becomes all the - more important. - - ${XPCONFIGDIR}/C/print/attributes/document - - The `document' file specifies the initial document values - for any print jobs. For example, which paper tray to - use, what default resolution, etc. - - ${XPCONFIGDIR}/C/print/attributes/job - - The `job' file specifies the initial job values for any - print jobs. For example, "notification-profile" can be - set so that when a print job is successfully sent to a - printer, e-mail is sent to the user. - - ${XPCONFIGDIR}/C/print/models/HPDJ1600C/model-config - ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/fonts.dir - ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/9nb00051.pmf - ${XPCONFIGDIR}/C/print/models/HPDJ1600C/fonts/9nb00093.pmf - - The `model-config' file has attributes that describe the - printer model's capabilities and default settings. - Printer model fonts may also be present. The model-config - file also identifies the print ddx driver to be used. - - For each printer model supported, a complete hierarchy of - files should exist. In most cases, these files do not - need to be modified. - - ${XPCONFIGDIR}/C/print/ddx-config/raster/pcl - ${XPCONFIGDIR}/C/print/ddx-config/raster/postscript - - The print ddx drivers can have highly specific - configuration files to control their behavior. In most - cases, these files do not need to be modified. - - -3.2 Starting the X Print Service ---------------------------------- - -The summary checklist for starting the X Print Service is as follows: - -1. Choose an execution model for the X Print Service. The X - Print Service can be run on a per-user session basis, per - machine basis, or can be run on a few machines globally - available to a number of users. - -2. If print jobs are to be submitted to a spooler (almost always - the case), make sure all needed printers are available to the - spooler subsystem (most often lp(1)) on the same machine - running the X Print Service. - -3. Configure the X Print Server. See ``X Print Server - Configuration''. - -4. Depending on #1, start the X Print Server process "Xprt", and - then the Print Dialog Manager Daemon process "dtpdmd" at the - appropriate times. - -The details are described below. - -Because the X Print Service is based on X, it can be easily distributed. -The most significant factors in which execution model to choose will be -driven by: - - * how many printers will be accessable through the printer - subsystem on any given machine. A system administrator may - choose to cluster printers on a few given machines, or - scatter them across an organization and possibly make - extensive use of remote spoolers to make them globally - available. - - * how many machines will need a copy of the X Print Server - configuration files. The files have been architected so - that one super-set version of them can be maintained and - distributed (e.g. via NFS), and a per-machine or per-user - version of the `Xprinters' is all that is needed to have the - appropriate information in them utilized or ignored. - - * how many users can demand services from a given X Print - Service. - -With the above in mind, some obvious execution models include: - - * Global - in this model, the system administrator is choosing - to run the X Print Service on a *few* select machines with - appropriate printers configured, and allow clients access to - the global resource. This can centralize the administration - of printers and configuration files, but may have to be - monitored for performance loading. - - Startup would likely be done by boot-up scripts. - - * Per-machine - every machine with potential X Print Service - users would run the service. Printer and configuration file - administration is decentralized, and usage would be limited - to the users on the machine. - - Startup would likely be done by boot-up scripts. - - * Per-user session - every user would run an entire X Print - Service for themselves. In the future, the Video X Server - normally started may contain Print X Server capability, so - this model becomes very natural. - - Startup would likely be done at session login or by - launching actions or processes manually once the user - logs in. Note: the dtpdmd must be started after Xprt. - -Starting of the processes is straight forward. In strict order: - - [machineA] % Xprt [-XpFile <Xprinters file>] [:dispNum] & - - Note that Xprt will look for configuration files in either - a default location or where XPCONFIGDIR points. - - -XpFile specifies an alternate `Xprinters' file, rather - than the default one or `${XPCONFIGDIR}/C/print/Xprinters'. - - [machineA] % dtpdmd -d machineA[:dispNum] [-l /tmp/dtpdmd.log] & - - The dtpdmd will maintain an X-Selection on the X-Server, - and will start dtpdm's as required to service requests. - -In all but the per-user session model, the machine running the dtpdmd -(thus dtpdm's) will need display authorization to the users video -display. - - - -3.3 Configuring the environment --------------------------------- - -Once a X Print Server and dtpdmd have been started -- many of them -in some cases -- clients will need to find and use them. There are -two mechanisms that allow clients to discover X Print Servers and -printers. - - * "X Print Specifier" - assuming usage of the DtPrint print - dialogs, the following notation is understood: - - printer_name@machine[:dispNum] - - For example: - - colorlj7@printhub:2 - - In the above example, the X Print Server running at `printhub:2' - is assumed to support the printer named `colorlj7'. - - * "XPSERVERLIST" - assuming usage of the DtPrint print dialogs, - the environment variable "XPSERVERLIST" can contain a list - of X Print Servers. For example: - - XPSERVERLIST="printhub:2 printhub:3 otherdept:0" - - Then in the dialogs, only a printer name needs to be entered. - The dialog will then search the X Print Servers in XPSERVERLIST - for a server than supports the printer, and then establish - contact. - -3.4 General End-User Sequence ------------------------------- - -From most CDEnext applications, printing is accomplished by bringing -down the <File> menu and selecting <Print...>. This will result in -the DtPrintSetupBox dialog, which will request the name of a printer, -and offer limited capability to configure print options (e.g. number -of copies). If the user wishes, they can select <Setup...>, which -will start a dtpdm capable of modifying additional print options. -Finally, the user should select <Print>. - - - -$Xorg: README,v 1.3 2000/08/17 19:48:02 cpqbld Exp $ diff --git a/hw/xprint/config/en_US/Makefile.am b/hw/xprint/config/en_US/Makefile.am deleted file mode 100644 index 0390ed2d4..000000000 --- a/hw/xprint/config/en_US/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = print diff --git a/hw/xprint/config/en_US/print/Makefile.am b/hw/xprint/config/en_US/print/Makefile.am deleted file mode 100644 index 025003339..000000000 --- a/hw/xprint/config/en_US/print/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = attributes diff --git a/hw/xprint/config/en_US/print/attributes/Makefile.am b/hw/xprint/config/en_US/print/attributes/Makefile.am deleted file mode 100644 index 8a05004d1..000000000 --- a/hw/xprint/config/en_US/print/attributes/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -xpcdir = @xpconfigdir@/en_US/print/attributes - -dist_xpc_DATA = document diff --git a/hw/xprint/config/en_US/print/attributes/document b/hw/xprint/config/en_US/print/attributes/document deleted file mode 100644 index 253c46bce..000000000 --- a/hw/xprint/config/en_US/print/attributes/document +++ /dev/null @@ -1,13 +0,0 @@ -# $Xorg: document,v 1.2 2002/11/30 22:10:03 gisburn Exp $ -# Document DPA-Object initial attribute values for en_US(-like) locales -# -# Note that the defaults (for all locales) are set in -# ${XPCONFIGDIR}/C/print/attributes/document -# Values in ${XPCONFIGDIR}/${LANG}/print/attributes/document are used to -# set/override these defaults for a specific locale on demand - -# US and some other countries use US-Letter as default paper size -# ("C"-locale default is "ISO-A4") -*default-medium: na-letter - -# EOF. diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c deleted file mode 100644 index 5cb24726b..000000000 --- a/hw/xprint/ddxInit.c +++ /dev/null @@ -1,380 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xos.h> -#include <X11/Xproto.h> -#include "windowstr.h" -#include "servermd.h" -#include "DiPrint.h" - -/*- - *----------------------------------------------------------------------- - * InitOutput -- - * If this is built as a print-only server, then we must supply - * an InitOutput routine. If a normal server's real ddx InitOutput - * is used, then it should call PrinterInitOutput if it so desires. - * The ddx-level hook is needed to allow the printer stuff to - * create additional screens. An extension can't reliably do - * this for two reasons: - * - * 1) If InitOutput doesn't create any screens, then main() - * exits before calling InitExtensions(). - * - * 2) Other extensions may rely on knowing about all screens - * when they initialize, and we can't guarantee the order - * of extension initialization. - * - * Results: - * ScreenInfo filled in, and PrinterInitOutput is called to create - * the screens associated with printers. - * - * Side Effects: - * None - * - *----------------------------------------------------------------------- - */ - -void -InitOutput( - ScreenInfo *pScreenInfo, - int argc, - char **argv) - -{ - pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - - pScreenInfo->numPixmapFormats = 0; /* get them in PrinterInitOutput */ - screenInfo.numVideoScreens = 0; - -#ifdef PRINT_ONLY_SERVER - PrinterInitOutput(pScreenInfo, argc, argv); -#endif - -} - -void -DDXRingBell(int volume, int pitch, int duration) -{ - /* dummy func; link fails without */ -} - -static void -BellProc( - int volume, - DeviceIntPtr pDev) -{ - return; -} - -static void -KeyControlProc( - DeviceIntPtr pDev, - KeybdCtrl *ctrl) -{ - return; -} - -static KeySym printKeyMap[256]; -static CARD8 printModMap[256]; - -static int -KeyboardProc( - DevicePtr pKbd, - int what, - int argc, - char *argv[]) -{ - KeySymsRec keySyms; - - keySyms.minKeyCode = 8; - keySyms.maxKeyCode = 8; - keySyms.mapWidth = 1; - keySyms.map = printKeyMap; - - switch(what) - { - case DEVICE_INIT: - InitKeyboardDeviceStruct(pKbd, &keySyms, printModMap, - (BellProcPtr)BellProc, - KeyControlProc); - break; - case DEVICE_ON: - break; - case DEVICE_OFF: - break; - case DEVICE_CLOSE: - break; - } - return Success; -} - -#include "../mi/mipointer.h" -static int -PointerProc( - DevicePtr pPtr, - int what, - int argc, - char *argv[]) -{ -#define NUM_BUTTONS 1 - CARD8 map[NUM_BUTTONS]; - - switch(what) - { - case DEVICE_INIT: - { - map[0] = 0; - InitPointerDeviceStruct(pPtr, map, NUM_BUTTONS, - GetMotionHistory, - (PtrCtrlProcPtr)_XpVoidNoop, - GetMotionHistorySize(), 2); - break; - } - case DEVICE_ON: - break; - case DEVICE_OFF: - break; - case DEVICE_CLOSE: - break; - } - return Success; -} - -void -InitInput( - int argc, - char **argv) -{ - DeviceIntPtr ptr, kbd; - - ptr = AddInputDevice((DeviceProc)PointerProc, TRUE); - kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE); - RegisterPointerDevice(ptr); - RegisterKeyboardDevice(kbd); - return; -} - - -Bool -LegalModifier( - unsigned int key, - DeviceIntPtr dev) -{ - return TRUE; -} - -void -ProcessInputEvents(void) -{ -} - -#ifdef __APPLE__ -#include "micmap.h" - -void GlxExtensionInit(void); -void GlxWrapInitVisuals(miInitVisualsProcPtr *procPtr); - -void -DarwinHandleGUI(int argc, char *argv[]) -{ -} - -void DarwinGlxExtensionInit(void) -{ - GlxExtensionInit(); -} - -void DarwinGlxWrapInitVisuals( - miInitVisualsProcPtr *procPtr) -{ - GlxWrapInitVisuals(procPtr); -} -#endif - -#ifdef DDXOSINIT -void -OsVendorInit(void) -{ -} -#endif - -#ifdef DDXOSFATALERROR -void -OsVendorFatalError(void) -{ -} -#endif - -#ifdef DDXBEFORERESET -void -ddxBeforeReset(void) -{ - return; -} -#endif - -/* ddxInitGlobals - called by |InitGlobals| from os/util.c */ -void ddxInitGlobals(void) -{ - PrinterInitGlobals(); -} - -/**************************************** -* ddxUseMsg() -* -* Called my usemsg from os/utils/c -* -*****************************************/ - -void ddxUseMsg(void) -{ -} - -void AbortDDX (void) -{ -} - -void ddxGiveUp(void) /* Called by GiveUp() */ -{ -} - -int -ddxProcessArgument ( - int argc, - char *argv[], - int i) -{ - return(0); -} - -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "XIstubs.h" -#include "exglobals.h" - -int -ChangePointerDevice ( - DeviceIntPtr old_dev, - DeviceIntPtr new_dev, - unsigned char x, - unsigned char y) -{ - return (BadDevice); -} - -int -ChangeDeviceControl ( - register ClientPtr client, - DeviceIntPtr dev, - xDeviceCtl *control) -{ - return BadMatch; -} - -int -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) -{ - return BadValue; -} - -void -DeleteInputDeviceRequest(DeviceIntPtr dev) -{ -} - -void -OpenInputDevice ( - DeviceIntPtr dev, - ClientPtr client, - int *status) -{ - return; -} - -void -AddOtherInputDevices (void) -{ - return; -} - -void -CloseInputDevice ( - DeviceIntPtr dev, - ClientPtr client) -{ - return; -} - -int -ChangeKeyboardDevice ( - DeviceIntPtr old_dev, - DeviceIntPtr new_dev) -{ - return (Success); -} - -int -SetDeviceMode ( - register ClientPtr client, - DeviceIntPtr dev, - int mode) -{ - return BadMatch; -} - -int -SetDeviceValuators ( - register ClientPtr client, - DeviceIntPtr dev, - int *valuators, - int first_valuator, - int num_valuators) -{ - return BadMatch; -} - - -#ifdef AIXV3 -/* - * This is just to get the server to link on AIX, where some bits - * that should be in os/ are instead in hw/ibm. - */ -int SelectWaitTime = 10000; /* usec */ -#endif diff --git a/hw/xprint/doc/Makefile.am b/hw/xprint/doc/Makefile.am deleted file mode 100644 index c0cb9d3d9..000000000 --- a/hw/xprint/doc/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -MAN_SRCS = Xprt.man.pre - -appmandir = $(APP_MAN_DIR) - -appman_PRE = Xprt.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -include $(top_srcdir)/cpprules.in - -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(appman_PRE) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -rm -f $@ - $(LN_S) $< $@ - -EXTRA_DIST = $(MAN_SRCS) Xprt.html Xprt.sgml diff --git a/hw/xprint/doc/Xprt.html b/hw/xprint/doc/Xprt.html deleted file mode 100644 index 2aa0c9e3c..000000000 --- a/hw/xprint/doc/Xprt.html +++ /dev/null @@ -1,115 +0,0 @@ -<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Xprt</title><meta name="generator" content="DocBook XSL Stylesheets V1.62.4"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="Xprt"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>Xprt — Print server for X Version 11</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><tt class="command">Xprt</tt> [<tt class="option">-ac</tt>] [<tt class="option">-audit <i class="replaceable"><tt>level</tt></i></tt>] [<tt class="option">-pn</tt>] [<tt class="option">-fp <i class="replaceable"><tt>fontpath</tt></i></tt>] [<tt class="option">-XpFile <i class="replaceable"><tt>file</tt></i></tt>] [<tt class="option">-XpSpoolerType <i class="replaceable"><tt>spoolername</tt></i></tt>] [<tt class="option">:<i class="replaceable"><tt>display</tt></i></tt>]</p></div></div><div class="refsect1" lang="en"><a name="id2804962"></a><h2>DESCRIPTION</h2><p><span><b class="command">Xprt</b></span> is the Xprint print server - for version 11 of the X Window system for non display devices - such as printers and fax machines.</p><p>Xprint is an advanced printing system which enables X11 - applications to use devices like printers, FAX or create - documents in formats like PostScript, PCL or PDF. It may be used by - clients such as <span class="application">mozilla</span>. - </p><p>Xprint is a very flexible, extensible, scalable, client/server - print system based on ISO 10175 (and some other specs) and the X11 - rendering protocol. - Using Xprint an application can search, query and use devices like - printers, FAX machines or create documents in formats like PDF. - In particular, an application can seek a printer, query supported - attributes (like paper size, trays, fonts etc.), configure the printer - device to match it's needs and print on it like on any other X device - reusing parts of the code which is used for the video card Xserver. - </p></div><div xmlns:ns1="" class="refsect1" lang="en"><a name="id2805117"></a><h2>USAGE</h2><p> - Although Xprt may be invoked from the command line, it is - preferable to run it as a daemon via the init script - <tt class="filename">/etc/init.d/xprint</tt> (where this script exists). - </p><p>Client programs such as mozilla will require environment - variable <tt class="envar">${XPSERVERLIST}</tt> to be set, identifying the - "display" on which Xprt is running. This variable may be set - for all users via <tt class="filename">/etc/profile</tt> (or similar), using - <b class="userinput"><tt>/etc/init.d/xprint get_xpserverlist</tt></b>: - </p><div class="informalexample"><pre class="programlisting">export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`</pre></div></div><div class="refsect1" lang="en"><a name="id2805150"></a><h2>OPTIONS</h2><p>Many of Xprt's command line options are shared in common - with the usual X servers (see <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>). - Commonly used options include:</p><div class="variablelist"><dl><dt><span class="term"><tt class="option">:<i class="replaceable"><tt>display</tt></i></tt></span></dt><dd><p> The X server runs on the given display. If multiple X - servers are to run simultaneously on a host, each must - have a unique display number. Note that the standard X - server (for video displays) typically runs on display - :0. If <tt class="filename">/etc/init.d/xprint</tt> is used - to invoke Xprt, it may be configured to automatically assign an available - display number.</p></dd><dt><span class="term"><tt class="option">-ac</tt></span></dt><dd><p>disables host-based access control mechanisms. Enables access - by any host, and permits any host to modify the access control - list. Use with extreme caution. This option exists primarily - for running test suites remotely.</p></dd><dt><span class="term"><tt class="option">-audit <i class="replaceable"><tt>level</tt></i></tt></span></dt><dd><p>sets the audit trail level. The default level is 1, meaning - only connection rejections are reported. Level 2 additionally - reports all successful connections and disconnects. Level 4 - enables messages from the SECURITY extension, if present, - including generation and revocation of authorizations and - violations of the security policy. Level 0 turns off the audit - trail. Audit lines are sent as standard error output.</p></dd><dt><span class="term"><tt class="option">-fp <i class="replaceable"><tt>fontpath</tt></i></tt></span></dt><dd><p>sets the search path for fonts. This path is a comma - separated list of directories which Xprt searches for - font databases.</p></dd><dt><span class="term"><tt class="option">-pn</tt></span></dt><dd><p>permits the server to continue running if it fails to - establish all of its well-known sockets (connection - points for clients), but establishes at least - one.</p></dd><dt><span class="term"><tt class="option">-XpFile <i class="replaceable"><tt>file</tt></i></tt></span></dt><dd><p>Sets an alternate Xprinters file (see section FILES).</p></dd><dt><span class="term"><tt class="option">-XpSpoolerType <i class="replaceable"><tt>spoolername</tt></i></tt></span></dt><dd xmlns:ns2=""><p> - Defines the spooler system to be used for print job spooling. - Supported values in xprint.mozdev.org release 009 are: - </p><table class="simplelist" border="0" summary="Simple list"><tr><td>aix</td></tr><tr><td>aix4</td></tr><tr><td>bsd</td></tr><tr><td>osf</td></tr><tr><td>solaris</td></tr><tr><td>sysv</td></tr><tr><td>uxp</td></tr><tr><td>cups</td></tr><tr><td>lprng</td></tr><tr><td>other</td></tr><tr><td>none</td></tr></table><p> - (multiple values can be specified, separated by ':', the first active spooler will be chosen). - The default value is platform-specific and can be obtained via - </p><pre class="programlisting">Xprt -h</pre><p>. - </p></dd></dl></div></div><div xmlns:ns3="" class="refsect1" lang="en"><a name="id2805336"></a><h2>ENVIRONMENT</h2><p> - The following environment variables are recognized by the X print server - (environment variables recognized by Xprint clients are described in - <span class="citerefentry"><span class="refentrytitle">Xprint</span>(7)</span>): - - </p><div class="variablelist"><dl><dt><span class="term"><tt class="envar">${XPCONFIGDIR}</tt></span></dt><dd><p> This environment variable points to the root - of the Xprint server configuration directory hierarchy. - If the variable is not defined, the default - path is be assumed. The default path may be - <tt class="filename">/usr/X11R6/lib/X11/xserver/</tt>, - <tt class="filename">/usr/lib/X11/xserver/</tt>, - <tt class="filename">/usr/share/Xprint/xserver/</tt> or - <tt class="filename">/usr/openwin/server/etc/XpConfig</tt>, depending on the - system, and may be configured in <tt class="filename">/etc/init.d/xprint</tt>.</p></dd><dt><span class="term"><tt class="envar">${LANG}</tt></span></dt><dd><p> - This environment variable selects the locale settings used by the Xprint server. - Xprt allows language-specific settings (stored in <tt class="filename">${XPCONFIGDIR}/${LANG}/print/</tt>) - which will override the default settings (stored in <tt class="filename">${XPCONFIGDIR}/C/print/</tt>). - If <tt class="envar">${LANG}</tt> is not set "C" is assumed. - </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2805421"></a><h2>FILES</h2><div class="variablelist"><dl><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/Xprinters</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/Xprinters</tt></span></dt><dd><p> - `Xprinters' is the top most configuration file. It tells - Xprt which specific printer names (e.g. mylaser) should - be supported, and whether <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> or other commands - should be used to automatically supplement the list of - printers. - </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/printer</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/printer</tt></span></dt><dd><p> - The `printer' file maps printer names to model - configurations (see `model-config' below). For example, - "mylaser" could be mapped to a "HPDJ1600C", and all other - arbitrary printers could be mapped to a default, such as - "HPLJ4SI". When depending on <span class="citerefentry"><span class="refentrytitle">lpstat</span>(1)</span> in the Xprinters - file, setting up defaults in `printer' becomes all the - more important. - </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/document</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/document</tt></span></dt><dd><p> - The `document' file specifies the initial document values - for any print jobs. For example, which paper tray to - use, what default resolution, etc. - </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/${LANG}/print/attributes/job</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/attributes/job</tt></span></dt><dd><p> - The `job' file specifies the initial job values for any - print jobs. For example, "notification-profile" can be - set so that when a print job is successfully sent to a - printer, e-mail is sent to the user. - </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/model-config</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</tt></span></dt><dd><p> - The `model-config' file has attributes that describe the - printer model's capabilities and default settings. - Printer model fonts may also be present. The model-config - file also identifies the print ddx driver to be used. - - For each printer model supported, a complete hierarchy of - files should exist. In most cases, these files do not - need to be modified. - </p></dd><dt><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</tt>, </span><span class="term"><tt class="filename">${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</tt></span></dt><dd><p> - The print ddx drivers can have highly specific - configuration files to control their behavior. In most - cases, these files do not need to be modified. - </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2805584"></a><h2>SEE ALSO</h2><p><span class="simplelist"><span class="citerefentry"><span class="refentrytitle">Xprint</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">X11</span>(7)</span>, <span class="citerefentry"><span class="refentrytitle">xplsprinters</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xprehashprinterlist</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xphelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxmhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpawhelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpxthelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">xpsimplehelloworld</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1x)</span>, <span class="citerefentry"><span class="refentrytitle">libXp</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">libXprintAppUtils</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XmPrintShell</span>(3x)</span>, <span class="citerefentry"><span class="refentrytitle">XawPrintShell</span>(3x)</span>, Xprint FAQ (<a href="http://xprint.mozdev.org/docs/Xprint_FAQ.html" target="_top">http://xprint.mozdev.org/docs/Xprint_FAQ.html</a>), Xprint main site (<a href="http://xprint.mozdev.org/" target="_top">http://xprint.mozdev.org/</a>)</span></p></div><div class="refsect1" lang="en"><a name="id2805757"></a><h2>AUTHORS</h2><p> - This manual page was written by - Drew Parsons <tt class="email"><<a href="mailto:dparsons@debian.org">dparsons@debian.org</a>></tt> and - Roland Mainz <tt class="email"><<a href="mailto:roland.mainz@nrubsig.org">roland.mainz@nrubsig.org</a>></tt>, - with some help from the man page at - <a href="http://www.sins.com.au/unix/manpages/Xprt.html" target="_top">http://www.sins.com.au/unix/manpages/Xprt.html</a> and the XFree86 - man page for <span class="citerefentry"><span class="refentrytitle">Xserver</span>(1)</span>. - </p></div></div></body></html> diff --git a/hw/xprint/doc/Xprt.man.pre b/hw/xprint/doc/Xprt.man.pre deleted file mode 100644 index 837619cb2..000000000 --- a/hw/xprint/doc/Xprt.man.pre +++ /dev/null @@ -1,196 +0,0 @@ -.\" -*- coding: us-ascii -*- -.TH Xprt __appmansuffix__ "25 November 2004" -.SH NAME -Xprt \- Print server for X Version 11 -.SH SYNOPSIS -.ad l -\fBXprt\fR \kx -.if (\nxu > (\n(.lu / 2)) .nr x (\n(.lu / 5) -'in \n(.iu+\nxu -[\fB\-ac\fR] [\fB\-audit \fBlevel\fR\fR] [\fB\-pn\fR] [\fB\-fp \fBfontpath\fR\fR] [\fB\-XpFile \fBfile\fR\fR] [\fB\-XpSpoolerType \fBspoolername\fR\fR] [\fB:\fBdisplay\fR\fR] -'in \n(.iu-\nxu -.ad b -.SH DESCRIPTION -Xprt is the Xprint print server -for version 11 of the X Window system for non display devices -such as printers and fax machines. -.PP -Xprint is an advanced printing system which enables X11 -applications to use devices like printers, FAX or create -documents in formats like PostScript, PCL or PDF. It may be used by -clients such as mozilla. -.PP -Xprint is a very flexible, extensible, scalable, client/server -print system based on ISO 10175 (and some other specs) and the X11 -rendering protocol. -Using Xprint an application can search, query and use devices like -printers, FAX machines or create documents in formats like PDF. -In particular, an application can seek a printer, query supported -attributes (like paper size, trays, fonts etc.), configure the printer -device to match it's needs and print on it like on any other X device -reusing parts of the code which is used for the video card Xserver. -.SH USAGE -Although Xprt may be invoked from the command line, it is -preferable to run it as a daemon via the init script -\fB/etc/init.d/xprint\fR (where this script exists). -.PP -Client programs such as mozilla will require environment -variable \fB${XPSERVERLIST}\fR to be set, identifying the -"display" on which Xprt is running. This variable may be set -for all users via \fB/etc/profile\fR (or similar), using -\fB/etc/init.d/xprint get_xpserverlist\fR: - -.nf -export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist` -.fi - -.SH OPTIONS -Many of Xprt's command line options are shared in common -with the usual X servers (see \fBXserver\fR(__appmansuffix__)). -Commonly used options include: -.TP -\fB:\fIdisplay\fB\fR -The X server runs on the given display. If multiple X -servers are to run simultaneously on a host, each must -have a unique display number. Note that the standard X -server (for video displays) typically runs on display -:0. If \fB/etc/init.d/xprint\fR is used -to invoke Xprt, it may be configured to automatically assign an available -display number. -.TP -\fB\-ac\fR -disables host-based access control mechanisms. Enables access -by any host, and permits any host to modify the access control -list. Use with extreme caution. This option exists primarily -for running test suites remotely. -.TP -\fB\-audit \fIlevel\fB\fR -sets the audit trail level. The default level is 1, meaning -only connection rejections are reported. Level 2 additionally -reports all successful connections and disconnects. Level 4 -enables messages from the SECURITY extension, if present, -including generation and revocation of authorizations and -violations of the security policy. Level 0 turns off the audit -trail. Audit lines are sent as standard error output. -.TP -\fB\-fp \fIfontpath\fB\fR -sets the search path for fonts. This path is a comma -separated list of directories which Xprt searches for -font databases. -.TP -\fB\-pn\fR -permits the server to continue running if it fails to -establish all of its well-known sockets (connection -points for clients), but establishes at least -one. -.TP -\fB\-XpFile \fIfile\fB\fR -Sets an alternate Xprinters file (see section FILES). -.TP -\fB\-XpSpoolerType \fIspoolername\fB\fR -Defines the spooler system to be used for print job spooling. -Supported values in xprint.mozdev.org release 009 are: - -aix - -aix4 - -bsd - -osf - -solaris - -sysv - -uxp - -cups - -lprng - -other - -none - -(multiple values can be specified, separated by ':', the first active spooler will be chosen). -The default value is platform-specific and can be obtained via - -.nf -Xprt \-h -.fi - -\&. -.SH ENVIRONMENT -The following environment variables are recognized by the X print server -(environment variables recognized by Xprint clients are described in -\fBXprint\fR(__miscmansuffix__)): -.TP -\fB${XPCONFIGDIR}\fR -This environment variable points to the root -of the Xprint server configuration directory hierarchy. -If the variable is not defined, the default -path is be assumed. The default path may be -\fB/usr/X11R6/lib/X11/xserver/\fR, -\fB/usr/lib/X11/xserver/\fR, -\fB/usr/share/Xprint/xserver/\fR or -\fB/usr/openwin/server/etc/XpConfig\fR, depending on the -system, and may be configured in \fB/etc/init.d/xprint\fR. -.TP -\fB${LANG}\fR -This environment variable selects the locale settings used by the Xprint server. -Xprt allows language-specific settings (stored in \fB${XPCONFIGDIR}/${LANG}/print/\fR) -which will override the default settings (stored in \fB${XPCONFIGDIR}/C/print/\fR). -If \fB${LANG}\fR is not set "C" is assumed. -.PP -.SH FILES -.TP -\fB${XPCONFIGDIR}/${LANG}/print/Xprinters\fR, \fB${XPCONFIGDIR}/C/print/Xprinters\fR -`Xprinters' is the top most configuration file. It tells -Xprt which specific printer names (e.g. mylaser) should -be supported, and whether \fBlpstat\fR(1) or other commands -should be used to automatically supplement the list of -printers. -.TP -\fB${XPCONFIGDIR}/${LANG}/print/attributes/printer\fR, \fB${XPCONFIGDIR}/C/print/attributes/printer\fR -The `printer' file maps printer names to model -configurations (see `model-config' below). For example, -"mylaser" could be mapped to a "HPDJ1600C", and all other -arbitrary printers could be mapped to a default, such as -"HPLJ4SI". When depending on \fBlpstat\fR(1) in the Xprinters -file, setting up defaults in `printer' becomes all the -more important. -.TP -\fB${XPCONFIGDIR}/${LANG}/print/attributes/document\fR, \fB${XPCONFIGDIR}/C/print/attributes/document\fR -The `document' file specifies the initial document values -for any print jobs. For example, which paper tray to -use, what default resolution, etc. -.TP -\fB${XPCONFIGDIR}/${LANG}/print/attributes/job\fR, \fB${XPCONFIGDIR}/C/print/attributes/job\fR -The `job' file specifies the initial job values for any -print jobs. For example, "notification-profile" can be -set so that when a print job is successfully sent to a -printer, e-mail is sent to the user. -.TP -\fB${XPCONFIGDIR}/C/print/models/PSdefault/model\-config\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf\fR, \fB${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf\fR -The `model-config' file has attributes that describe the -printer model's capabilities and default settings. -Printer model fonts may also be present. The model-config -file also identifies the print ddx driver to be used. -For each printer model supported, a complete hierarchy of -files should exist. In most cases, these files do not -need to be modified. -.TP -\fB${XPCONFIGDIR}/C/print/ddx\-config/raster/pdf\fR, \fB${XPCONFIGDIR}/C/print/ddx\-config/raster/pcl\fR, \fB${XPCONFIGDIR}/C/print/ddx\-config/raster/postscript\fR -The print ddx drivers can have highly specific -configuration files to control their behavior. In most -cases, these files do not need to be modified. -.SH "SEE ALSO" -\fBXprint\fR(__miscmansuffix__), \fBX11\fR(__miscmansuffix__), \fBxplsprinters\fR(__appmansuffix__), \fBxprehashprinterlist\fR(__appmansuffix__), \fBxphelloworld\fR(__appmansuffix__), \fBxpxmhelloworld\fR(__appmansuffix__), \fBxpawhelloworld\fR(__appmansuffix__), \fBxpxthelloworld\fR(__appmansuffix__), \fBxpsimplehelloworld\fR(__appmansuffix__), \fBXserver\fR(__appmansuffix__), \fBlibXp\fR(__libmansuffix__), \fBlibXprintUtils\fR(__libmansuffix__), \fBlibXprintAppUtils\fR(__libmansuffix__), \fBXmPrintShell\fR(__libmansuffix__), \fBXawPrintShell\fR(__libmansuffix__), Xprint FAQ (http://xprint.mozdev.org/docs/Xprint_FAQ.html), Xprint main site (http://xprint.mozdev.org/) -.SH AUTHORS -This manual page was written by -Drew Parsons <dparsons@debian.org> and -Roland Mainz <roland.mainz@nrubsig.org>, -with some help from the man page at -http://www.sins.com.au/unix/manpages/Xprt.html and the XFree86 -man page for \fBXserver\fR(1). diff --git a/hw/xprint/doc/Xprt.sgml b/hw/xprint/doc/Xprt.sgml deleted file mode 100644 index a62499263..000000000 --- a/hw/xprint/doc/Xprt.sgml +++ /dev/null @@ -1,371 +0,0 @@ -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" 'http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'> - -<!-- Process this file with docbook-to-man to generate an nroff manual - page: 'docbook-to-man manpage.sgml > manpage.1'. You may view - the manual page with: 'docbook-to-man manpage.sgml | nroff -man | less'. - A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - -HTML generation can be done like this: -% xsltproc ==docbook /usr/share/sgml/docbook/docbook-xsl-stylesheets-1.60.1/html/docbook.xsl Xprint.sgml >Xprint.html - --> - -<refentry id="Xprt"> - <refmeta> - <refentrytitle>Xprt</refentrytitle> - <manvolnum>__appmansuffix__</manvolnum> - </refmeta> - <refnamediv> - <refname>Xprt</refname> - - <refpurpose>Print server for X Version 11</refpurpose> - </refnamediv> - <refsynopsisdiv> - <cmdsynopsis> - <command>Xprt</command> - - <arg><option>-ac</option></arg> - - <arg><option>-audit <replaceable>level</replaceable></option></arg> - - <arg><option>-pn</option></arg> - - <arg><option>-fp <replaceable>fontpath</replaceable></option></arg> - - <arg><option>-XpFile <replaceable>file</replaceable></option></arg> - - <arg><option>-XpSpoolerType <replaceable>spoolername</replaceable></option></arg> - - <arg><option>:<replaceable>display</replaceable></option></arg> - - </cmdsynopsis> - </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> - - <para><command>Xprt</command> is the Xprint print server - for version 11 of the X Window system for non display devices - such as printers and fax machines.</para> - - <para>Xprint is an advanced printing system which enables X11 - applications to use devices like printers, FAX or create - documents in formats like PostScript, PCL or PDF. It may be used by - clients such as <application>mozilla</application>. - </para> - - <para>Xprint is a very flexible, extensible, scalable, client/server - print system based on ISO 10175 (and some other specs) and the X11 - rendering protocol. - Using Xprint an application can search, query and use devices like - printers, FAX machines or create documents in formats like PDF. - In particular, an application can seek a printer, query supported - attributes (like paper size, trays, fonts etc.), configure the printer - device to match it's needs and print on it like on any other X device - reusing parts of the code which is used for the video card Xserver. - </para> - </refsect1> - - <refsect1> - <title>USAGE</title> - - <para> - Although Xprt may be invoked from the command line, it is - preferable to run it as a daemon via the init script - <filename>/etc/init.d/xprint</filename> (where this script exists). - </para> - - <para>Client programs such as mozilla will require environment - variable <envar>${XPSERVERLIST}</envar> to be set, identifying the - "display" on which Xprt is running. This variable may be set - for all users via <filename>/etc/profile</filename> (or similar), using - <userinput>/etc/init.d/xprint get_xpserverlist</userinput>: - <informalexample> - <programlisting>export XPSERVERLIST=`/etc/init.d/xprint get_xpserverlist`</programlisting> - </informalexample> - </para> - </refsect1> - - <refsect1> - <title>OPTIONS</title> - - <para>Many of Xprt's command line options are shared in common - with the usual X servers (see <citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry>). - Commonly used options include:</para> - - <variablelist> - <varlistentry> - <term><option>:<replaceable>display</replaceable></option> - </term> - <listitem> - <para> The X server runs on the given display. If multiple X - servers are to run simultaneously on a host, each must - have a unique display number. Note that the standard X - server (for video displays) typically runs on display - :0. If <filename>/etc/init.d/xprint</filename> is used - to invoke Xprt, it may be configured to automatically assign an available - display number.</para> - </listitem> - </varlistentry> - <varlistentry> - <term><option>-ac</option> - </term> - <listitem> - <para>disables host-based access control mechanisms. Enables access - by any host, and permits any host to modify the access control - list. Use with extreme caution. This option exists primarily - for running test suites remotely.</para> - </listitem> - </varlistentry> - <varlistentry> - <term><option>-audit <replaceable>level</replaceable></option> - </term> - <listitem> - <para>sets the audit trail level. The default level is 1, meaning - only connection rejections are reported. Level 2 additionally - reports all successful connections and disconnects. Level 4 - enables messages from the SECURITY extension, if present, - including generation and revocation of authorizations and - violations of the security policy. Level 0 turns off the audit - trail. Audit lines are sent as standard error output.</para> - </listitem> - </varlistentry> - <varlistentry> - <term><option>-fp <replaceable>fontpath</replaceable></option> - </term> - <listitem> - <para>sets the search path for fonts. This path is a comma - separated list of directories which Xprt searches for - font databases.</para> - </listitem> - </varlistentry> - <varlistentry> - <term><option>-pn</option> - </term> - <listitem> - <para>permits the server to continue running if it fails to - establish all of its well-known sockets (connection - points for clients), but establishes at least - one.</para> - </listitem> - </varlistentry> - - <varlistentry> - <term><option>-XpFile <replaceable>file</replaceable></option> - </term> - <listitem> - <para>Sets an alternate Xprinters file (see section FILES).</para> - </listitem> - </varlistentry> - <varlistentry> - <term><option>-XpSpoolerType <replaceable>spoolername</replaceable></option> - </term> - <listitem> - <para> - Defines the spooler system to be used for print job spooling. - Supported values in xprint.mozdev.org release 009 are: - <simplelist type="vert"> - <member>aix</member> - <member>aix4</member> - <member>bsd</member> - <member>osf</member> - <member>solaris</member> - <member>sysv</member> - <member>uxp</member> - <member>cups</member> - <member>lprng</member> - <member>other</member> - <member>none</member> - </simplelist> - (multiple values can be specified, separated by ':', the first active spooler will be chosen). - The default value is platform-specific and can be obtained via - <programlisting>Xprt -h</programlisting>. - </para> - </listitem> - </varlistentry> - </variablelist> - </refsect1> - - <refsect1> - <title>ENVIRONMENT</title> - <para> - The following environment variables are recognized by the X print server - (environment variables recognized by Xprint clients are described in - <citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry>): - - <variablelist> - <varlistentry> - <term><envar>${XPCONFIGDIR}</envar></term> - <listitem> - <para> This environment variable points to the root - of the Xprint server configuration directory hierarchy. - If the variable is not defined, the default - path is be assumed. The default path may be - <filename>/usr/X11R6/lib/X11/xserver/</filename>, - <filename>/usr/lib/X11/xserver/</filename>, - <filename>/usr/share/Xprint/xserver/</filename> or - <filename>/usr/openwin/server/etc/XpConfig</filename>, depending on the - system, and may be configured in <filename>/etc/init.d/xprint</filename>.</para> - </listitem> - </varlistentry> - - <varlistentry> - <term><envar>${LANG}</envar></term> - <listitem> - <para> - This environment variable selects the locale settings used by the Xprint server. - Xprt allows language-specific settings (stored in <filename>${XPCONFIGDIR}/${LANG}/print/</filename>) - which will override the default settings (stored in <filename>${XPCONFIGDIR}/C/print/</filename>). - If <envar>${LANG}</envar> is not set "C" is assumed. - </para> - </listitem> - </varlistentry> - </variablelist> - </para> - </refsect1> - - <refsect1> - <title>FILES</title> - - <variablelist> - <varlistentry> - <term><filename>${XPCONFIGDIR}/${LANG}/print/Xprinters</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/Xprinters</filename></term> - <listitem> - <para> - `Xprinters' is the top most configuration file. It tells - Xprt which specific printer names (e.g. mylaser) should - be supported, and whether <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> or other commands - should be used to automatically supplement the list of - printers. - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/printer</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/attributes/printer</filename></term> - <listitem> - <para> - The `printer' file maps printer names to model - configurations (see `model-config' below). For example, - "mylaser" could be mapped to a "HPDJ1600C", and all other - arbitrary printers could be mapped to a default, such as - "HPLJ4SI". When depending on <citerefentry><refentrytitle>lpstat</refentrytitle><manvolnum>1</manvolnum></citerefentry> in the Xprinters - file, setting up defaults in `printer' becomes all the - more important. - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/document</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/attributes/document</filename></term> - <listitem> - <para> - The `document' file specifies the initial document values - for any print jobs. For example, which paper tray to - use, what default resolution, etc. - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term><filename>${XPCONFIGDIR}/${LANG}/print/attributes/job</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/attributes/job</filename></term> - <listitem> - <para> - The `job' file specifies the initial job values for any - print jobs. For example, "notification-profile" can be - set so that when a print job is successfully sent to a - printer, e-mail is sent to the user. - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/model-config</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/fonts.dir</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00051.pmf</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/models/PSdefault/fonts/9nb00093.pmf</filename></term> - - <listitem> - <para> - The `model-config' file has attributes that describe the - printer model's capabilities and default settings. - Printer model fonts may also be present. The model-config - file also identifies the print ddx driver to be used. - - For each printer model supported, a complete hierarchy of - files should exist. In most cases, these files do not - need to be modified. - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pdf</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/pcl</filename></term> - <term><filename>${XPCONFIGDIR}/C/print/ddx-config/raster/postscript</filename></term> - - <listitem> - <para> - The print ddx drivers can have highly specific - configuration files to control their behavior. In most - cases, these files do not need to be modified. - </para> - </listitem> - </varlistentry> - - </variablelist> - </refsect1> - - <refsect1> - <title>SEE ALSO</title> - <para> - <simplelist type="inline"> - <!-- specific references --> - <!-- none --> - - <!-- Xprint general references --> - <member><citerefentry><refentrytitle>Xprint</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>X11</refentrytitle><manvolnum>__miscmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xplsprinters</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xprehashprinterlist</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xphelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xpxmhelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xpawhelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xpxthelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>xpsimplehelloworld</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> -<!-- - <member><citerefentry><refentrytitle>Xprt</refentrytitle><manvolnum>__appmansuffix__</manvolnum></citerefentry></member> ---> - <!-- ToDO: Add manual pages for the single Xprint DDX implementations (PostScript/PDF/PCL/PCL-MONO/Raster/etc.) --> - <member><citerefentry><refentrytitle>libXp</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>libXprintUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>libXprintAppUtils</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>XmPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member> - <member><citerefentry><refentrytitle>XawPrintShell</refentrytitle><manvolnum>__libmansuffix__</manvolnum></citerefentry></member> - <member>Xprint FAQ (<ulink url="http://xprint.mozdev.org/docs/Xprint_FAQ.html">http://xprint.mozdev.org/docs/Xprint_FAQ.html</ulink>)</member> - <member>Xprint main site (<ulink url="http://xprint.mozdev.org/">http://xprint.mozdev.org/</ulink>)</member> - </simplelist> - </para> - </refsect1> - - <refsect1> - <title>AUTHORS</title> - <para> - This manual page was written by - Drew Parsons <email>dparsons@debian.org</email> and - Roland Mainz <email>roland.mainz@nrubsig.org</email>, - with some help from the man page at - <ulink url="http://www.sins.com.au/unix/manpages/Xprt.html">http://www.sins.com.au/unix/manpages/Xprt.html</ulink> and the XFree86 - man page for <citerefentry><refentrytitle>Xserver</refentrytitle><manvolnum>1</manvolnum></citerefentry>. - </para> - </refsect1> -</refentry> - - - diff --git a/hw/xprint/etc/Makefile.am b/hw/xprint/etc/Makefile.am deleted file mode 100644 index 0a960cd1b..000000000 --- a/hw/xprint/etc/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = init.d profile.d Xsession.d diff --git a/hw/xprint/etc/Xsession.d/92xprint-xpserverlist b/hw/xprint/etc/Xsession.d/92xprint-xpserverlist deleted file mode 100644 index 60d964a34..000000000 --- a/hw/xprint/etc/Xsession.d/92xprint-xpserverlist +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -##################################################################### -### File: 92xprint-xpserverlist -### -### Default Location: /etc/X11/Xsession.d/ -### -### Purpose: Setup Xprint env vars -### -### Description: This script is invoked by means of the Xsession file -### at user login. -### -### Invoked by: /etc/X11/Xsession -### -### (c) Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> -### -### please send bugfixes or comments to https://bugs.freedesktop.org -### -##################################################################### - - -# -# Obtain list of Xprint servers -# - -if [ -x "/etc/init.d/xprint" ] ; then - XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`" - export XPSERVERLIST -fi - -########################## eof ##################### diff --git a/hw/xprint/etc/Xsession.d/Makefile.am b/hw/xprint/etc/Xsession.d/Makefile.am deleted file mode 100644 index 96a5ee73b..000000000 --- a/hw/xprint/etc/Xsession.d/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -xpcdir = $(sysconfdir)/X11/Xsession.d -dist_xpc_DATA = 92xprint-xpserverlist diff --git a/hw/xprint/etc/init.d/Makefile.am b/hw/xprint/etc/init.d/Makefile.am deleted file mode 100644 index 0cf1adc92..000000000 --- a/hw/xprint/etc/init.d/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -include $(top_srcdir)/cpprules.in - -noinst_PRE = xprint -BUILT_SOURCES = $(noinst_PRE) -CLEANFILES = $(noinst_PRE) xprint.pre - -CPP_FILES_FLAGS = -DProjectRoot='"$(PROJECTROOT)"' -DOS_LINUX - -xprint.pre: xprint.cpp - $(SED) -e 's/^\(\s\+\)#/\1XCOMM/' ${srcdir}/xprint.cpp > $@ - -EXTRA_DIST = xprint.cpp diff --git a/hw/xprint/etc/init.d/xprint.cpp b/hw/xprint/etc/init.d/xprint.cpp deleted file mode 100644 index dbfd1e139..000000000 --- a/hw/xprint/etc/init.d/xprint.cpp +++ /dev/null @@ -1,1277 +0,0 @@ -XCOMM!/bin/sh -XCOMM -XCOMM Copyright 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org>. -XCOMM -XCOMM This script manages the Xprint server side - -XCOMM Basic support for IRIX-style "chkconfig" -XCOMM chkconfig: 2345 61 61 -XCOMM description: Startup/shutdown script for Xprint server(s) - -XCOMM Basic support for the Linux Standard Base Specification 1.0.0 -XCOMM (Note: The Should-Start/Stop lines are there so that this works in the -XCOMM future, when the LSB adopts these. The X-UnitedLinux lines are there -XCOMM so that it works right now.) -XCOMM## BEGIN INIT INFO -XCOMM Provides: xprint -XCOMM Required-Start: $local_fs $remote_fs $syslog $network -XCOMM Required-Stop: $local_fs $remote_fs $syslog -XCOMM Should-Start: cups lpd xfs -XCOMM Should-Stop: cups lpd xfs -XCOMM X-UnitedLinux-Should-Start: cups lpd xfs -XCOMM X-UnitedLinux-Should-Stop: cups lpd xfs -XCOMM Default-Start: 3 5 -XCOMM Default-Stop: 0 1 2 6 -XCOMM Description: Startup/shutdown script for Xprint server(s) -XCOMM## END INIT INFO - -#undef sun -#undef unix - -XCOMM########################################################################### -XCOMM -XCOMM This script has three main tasks: -XCOMM 1. Start Xprint servers ("Xprt") at boot time. -XCOMM 2. Shutdown Xprint servers when the machine is being shut down. -XCOMM 3. Query the list of available printers. -XCOMM -XCOMM Additional tasks are: -XCOMM 4. Restart ('restart'|'force-reload') and conditional restart -XCOMM ('condrestart'/'try-restart') for Linux support -XCOMM 5. Wrapping of application call with setting XPSERVERLIST ('wrapper') -XCOMM -XCOMM Usage: -XCOMM - Start Xprint server(s) manually: -XCOMM % /etc/init.d/xprint start -XCOMM -XCOMM - Stop Xprint server(s) manually: -XCOMM % /etc/init.d/xprint stop -XCOMM -XCOMM - Populate $XPSERVERLIST env var (for example as part of a global -XCOMM login script like /etc/profile or per-user login scripts like -XCOMM $HOME/.profile (sh/ksh/bash)) -XCOMM % XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`" -XCOMM % export XPSERVERLIST -XCOMM -XCOMM Installation: -XCOMM Copy this script to /etc/init.d/xprint and make sure that it is -XCOMM executable. If your installation is LSB-compliant, then run -XCOMM % /usr/lib/lsb/install_initd /etc/init.d/xprint -XCOMM to start the service on startup. Otherwise, manually create links -XCOMM to the matching run levels. -XCOMM Examples: -XCOMM - Solaris 2.7/2.8/2.9: -XCOMM % cp xprint /etc/init.d/xprint -XCOMM % chmod a+rx /etc/init.d/xprint -XCOMM % ln /etc/init.d/xprint /etc/rc0.d/K38xprint -XCOMM % ln /etc/init.d/xprint /etc/rc1.d/K38xprint -XCOMM % ln /etc/init.d/xprint /etc/rc2.d/S81xprint -XCOMM % ln /etc/init.d/xprint /etc/rcS.d/K38xprint -XCOMM -XCOMM - SuSE Linux 7.3 -XCOMM % cp xprint /etc/init.d/xprint -XCOMM % chmod a+rx /etc/init.d/xprint -XCOMM % ln -s ../xprint /etc/init.d/rc3.d/K13xprint -XCOMM % ln -s ../xprint /etc/init.d/rc3.d/S12xprint -XCOMM % ln -s ../xprint /etc/init.d/rc5.d/K13xprint -XCOMM % ln -s ../xprint /etc/init.d/rc5.d/S12xprint -XCOMM % ln -s ../xprint /etc/init.d/rc2.d/K13xprint -XCOMM % ln -s ../xprint /etc/init.d/rc2.d/S12xprint -XCOMM -XCOMM - SuSE Linux 6.4: -XCOMM % cp xprint /sbin/init.d/xprint -XCOMM % chmod a+rx /sbin/init.d/xprint -XCOMM % ln -s ../xprint /sbin/init.d/rc2.d/K20xprint -XCOMM % ln -s ../xprint /sbin/init.d/rc2.d/S20xprint -XCOMM % ln -s ../xprint /sbin/init.d/rc3.d/K20xprint -XCOMM % ln -s ../xprint /sbin/init.d/rc3.d/S20xprint -XCOMM -XCOMM Notes: -XCOMM - The Xprint servers must be started _after_ the print -XCOMM spooler or the server(s) may refuse to start -XCOMM - The script should be readable by all users to ensure that they -XCOMM can use the "get_xpserverlist"-option -XCOMM -XCOMM Custom configuration: -XCOMM - Edit the function setup_config() in this script to match your needs -XCOMM -XCOMM Known bugs/ToDo/Notes: -XCOMM - The shell script assumes that a Xserver can be reached via -XCOMM "hostname:displaynum" where "hostname" is obtained from -XCOMM "/usr/bin/hostname". It may happen that a kernel firewall -XCOMM blocks an X connection on the same host (e.g. client && Xserver -XCOMM are running on the same host). -XCOMM Suggested fix: Fix the firewall config. -XCOMM Suggested workaround: Edit this script and replace the use of -XCOMM /usr/bin/hostname with "echo 'localhost'". -XCOMM -XCOMM########################################################################### -XCOMM - - -XCOMM########################################################################### - -fatal_error() -{ - echo "${0}: ## FATAL ERROR: ${1}" 1>&2 - exit 1 -} - -error_echo() -{ - echo "${0}: ## ERROR: ${1}" 1>&2 -} - -warning_echo() -{ - echo "${0}: ## WARNING: ${1}" 1>&2 -} - -verbose_echo() -{ - echo "${0}: ${1}" -} - -msg() -{ - echo "${1}" -} - -XCOMM########################################################################### - -#ifndef OS_LINUX -XCOMM Force use of a POSIX conformant sh -XCOMM (Solaris /sbin/sh is plain Bourne shell) -[ "$1" != "posix_sh_forced" -a -x /bin/ksh ] && exec /bin/ksh "$0" posix_sh_forced "$@" -[ "$1" != "posix_sh_forced" -a -x /bin/bash ] && exec /bin/bash --norc --noprofile "$0" posix_sh_forced "$@" -[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/ksh ] && exec /usr/local/bin/ksh "$0" posix_sh_forced "$@" -[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/bash ] && exec /usr/local/bin/bash --norc --noprofile "$0" posix_sh_forced "$@" -if [ "$1" != "posix_sh_forced" ] ; then - echo "${0}: ## FATAL ERROR: No POSIX-shell found." 1>&2 - exit 1 -fi - -shift # Drop "posix_sh_forced" -#endif /* !OS_LINUX */ - -XCOMM#debug -XCOMM set -x - -XCOMM Change current dir to a location which is writeable by everyone -cd /tmp - -XCOMM Clear some environment variables -unset TEMP TMPDIR SCREENDIR - -XCOMM Set search path for commands -export PATH=/usr/bin:/bin:/usr/sbin:/sbin -#ifdef OS_SOLARIS -export PATH=/usr/xpg4/bin:${PATH} -#endif - -XCOMM# Try to figure-out where X11 was installed -#if defined(OS_SOLARIS) -XPROJECTROOT=/usr/openwin -export OPENWINHOME=/usr/openwin -#elif defined(OS_AIX) -XPROJECTROOT=/usr/lpp/X11 -#else -#if defined(ProjectRoot) -[ -d ProjectRoot/bin ] && XPROJECTROOT=ProjectRoot -#endif -[ -d /usr/X11/bin ] && XPROJECTROOT=/usr/X11 -[ -d /usr/X11R6/bin ] && XPROJECTROOT=/usr/X11R6 -#endif -XPCUSTOMGLUE=DEF_XPCUSTOMGLUE # This is used for customizing this script -export XPROJECTROOT XPCUSTOMGLUE - -if [ -z "${XPROJECTROOT}" ] ; then - fatal_error "Unknown XProjectRoot." -fi - -XCOMM Set the location of the Xprt binary we want to use. -XPRT_BIN="${XPROJECTROOT}/bin/Xprt" - -XCOMM Set the location of the global file where we store the locations -XCOMM of the system-wide servers -if [ -d /var/run ] ; then - XP_GLOBAL_SERVERS=/var/run/Xprint_servers -else - XP_GLOBAL_SERVERS=/tmp/.Xprint_servers -fi - -XCOMM ${LOGNAME} will not work if user su'ed into another account -export CURRLOGNAME="$(id -u -n)" - -XCOMM Set location where we want to store the list of Xprint servers managed -XCOMM by this user -XCOMM - If we start as "root" use the global file -XCOMM - If we start as normal user use a per-user file - -if [ "${CURRLOGNAME}" != "root" -a "${CURRLOGNAME}" != "" ] ; then - XP_PER_USER_SERVERS="/tmp/.Xprint_servers_${CURRLOGNAME}" - XP_SERVERS="${XP_PER_USER_SERVERS}" -else - XP_SERVERS="${XP_GLOBAL_SERVERS}" -fi - -XCOMM Set umask that owner can r/w all files and everyone else can read them -umask 022 - -XCOMM Bump limit for per-process open files to ensure that Xprt can open many many fonts -ulimit -n 1024 - -XCOMM########################################################################### - -XCOMM Get list of fonts for a given display -get_fontlist_from_display() -{ - ${XPROJECTROOT}/bin/xset -display "${1}" q | - awk "/Font Path:/ { i=1 ; next } i==1 { print \$0 ; i=0 }" | - fontpath2fontlist -} - -XCOMM Get list from a fontserver config -get_fontlist_from_xfs_config() -{ - if [ ! -r "${1}" ] ; then - return 0 - fi - - ( - cat "${1}" | - while read -r i ; do - for val in $i; do - case $val in - \#*) break ;; - ?*=*) key="${val%%=*}" ;; - =*) key="${tok}" ;; - *) [ "${key}" = "catalogue" -a "${tok}" != "" ] && echo "${tok}" ;; - esac - tok="${val#*=}" - done - done - ) | tr "," "\n" | fontpath2fontlist -} - -get_fontlist_from_all_xfs_configs() -{ - get_fontlist_from_xfs_config "/etc/openwin/fs/fontserver.cfg" - get_fontlist_from_xfs_config "/usr/openwin/lib/X11/fontserver.cfg" - get_fontlist_from_xfs_config "/etc/X11/fs-xtt/config" - get_fontlist_from_xfs_config "/etc/X11/fs/config" - get_fontlist_from_xfs_config "/etc/X11/xfs/config" - get_fontlist_from_xfs_config "${XPROJECTROOT}/lib/X11/fs/config" -} - -get_fontlist_from_xf86config() -{ - srcxconf="" - - XCOMM see xorg.conf(5x) manual page for the list of locations used here - [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf" ] && srcxconf="/etc/X11/xorg.conf" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf" - [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf-4" ] && srcxconf="/etc/X11/xorg.conf-4" - [ "${srcxconf}" = "" -a -f "/etc/X11/xorg.conf" ] && srcxconf="/etc/X11/xorg.conf" - [ "${srcxconf}" = "" -a -f "/etc/xorg.conf" ] && srcxconf="/etc/xorg.conf" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf.${hostname}" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf.${hostname}" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf-4" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf-4" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/etc/X11/xorg.conf" ] && srcxconf="/usr/X11R6/etc/X11/xorg.conf" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf.${hostname}" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf.${hostname}" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf-4" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf-4" - [ "${srcxconf}" = "" -a -f "/usr/X11R6/lib/X11/xorg.conf" ] && srcxconf="/usr/X11R6/lib/X11/xorg.conf" - - XCOMM Xfree86 locations - [ "${srcxconf}" = "" -a -f "/etc/X11/XF86Config-4" ] && srcxconf="/etc/X11/XF86Config-4" - [ "${srcxconf}" = "" -a -f "/etc/X11/XF86Config" ] && srcxconf="/etc/X11/XF86Config" - - - if [ "${srcxconf}" = "" ] ; then - return 0 - fi - - currsection="" - cat "${srcxconf}" | - while read i1 i2 i3 i4 ; do - # Strip "\"" from I2 - i2="${i2#\"}" ; i2="${i2%\"}" - - case "${i1}" in - \#*) - continue - ;; - 'Section') - currsection="${i2}" - ;; - 'EndSection') - currsection="" - ;; - 'FontPath') - [ "$currsection" = "Files" ] && echo "${i2%:unscaled}" - ;; - esac - done | egrep -v -i "tcp/|tcp4/|tcp6/|unix/" - - return 0 -} - -get_fontlist_from_defoma() -{ - # Include Debian defoma font directory where relevant - if [ -d "/var/lib/defoma/x-ttcidfont-conf.d/dirs" ] ; then - find "/var/lib/defoma/x-ttcidfont-conf.d/dirs" -name fonts.dir | - while read i ; do echo "${i%/fonts.dir}" ; done - fi -} - -XCOMM Get list of system fonts -get_system_fontlist() -{ -#if defined(OS_SOLARIS) - ## List the standard X11 fonts - # echo "${XPROJECTROOT}/lib/X11/fonts/F3/" - # echo "${XPROJECTROOT}/lib/X11/fonts/F3bitmaps/" - echo "${XPROJECTROOT}/lib/X11/fonts/Type1/" - echo "${XPROJECTROOT}/lib/X11/fonts/Type1/outline/" - # We cannot use /usr/openwin/lib/X11/fonts/Type1/sun/ - see - # http://xprint.mozdev.org/bugs/show_bug.cgi?id=5726 - # ("Xprint doesn't start under Solaris 2.9 due *.ps files in /usr/openwin/lib/X11/fonts/Type1/sun/fonts.dir") - #echo "${XPROJECTROOT}/lib/X11/fonts/Type1/sun/" - echo "${XPROJECTROOT}/lib/X11/fonts/TrueType/" - echo "${XPROJECTROOT}/lib/X11/fonts/Speedo/" - echo "${XPROJECTROOT}/lib/X11/fonts/misc/" - echo "${XPROJECTROOT}/lib/X11/fonts/75dpi/" - echo "${XPROJECTROOT}/lib/X11/fonts/100dpi/" - - ## List all fonts in all locales installed on this machine - cat /usr/openwin/lib/locale/''*/OWfontpath | tr "," "\n" | sort -u -#elif defined(OS_LINUX) - ( - get_fontlist_from_defoma - - get_fontlist_from_xf86config - - # Getting font paths from XFS is mainly required for compatibilty to RedHat - get_fontlist_from_all_xfs_configs - - ## List all fonts in all locales installed on this machine - ( - [ -d "/usr/share/fonts" ] && find /usr/share/fonts -name fonts.dir - find "${XPROJECTROOT}/lib/X11/fonts" -name fonts.dir - ) | - while read i ; do echo "${i%/fonts.dir}" ; done - ) | sort -u -#else - ## List the standard X11 fonts - # (AIX should be handled like Solaris but I did not found a way to - # enumerate all fonts in all installed locales without scanning the - # dirs manually) - echo "${XPROJECTROOT}/lib/X11/fonts/Type1/" - echo "${XPROJECTROOT}/lib/X11/fonts/TrueType/" - echo "${XPROJECTROOT}/lib/X11/fonts/TTF/" - echo "${XPROJECTROOT}/lib/X11/fonts/Speedo/" - echo "${XPROJECTROOT}/lib/X11/fonts/misc/" - echo "${XPROJECTROOT}/lib/X11/fonts/75dpi/" - echo "${XPROJECTROOT}/lib/X11/fonts/100dpi/" - echo "${XPROJECTROOT}/lib/X11/fonts/" -#endif -} - -XCOMM Filter fonts per given extended regular expressions -XCOMM (and make sure we filter any model-config fonts - they are managed by Xprt internally) -filter_fontlist() -{ - egrep -- "${1}" | fgrep -v "/models/" | egrep -v -- "${2}" -} - -XCOMM Filter font paths with unsupported font types -XCOMM (such as CID fonts) -filter_unsupported_fonts() -{ - egrep -v -i "/cid(/$|$)|/csl(/$|$)" -} - -XCOMM Validate fontpath -XCOMM Only return valid font path entries (note that these entries may -XCOMM include non-file stuff like font server references) -validate_fontlist() -{ - while read i ; do - case "${i}" in - # Check if font path entry is a font server... - tcp/''*|tcp4/''*|tcp6/''*|unix/''*) - echo "${i}" - ;; - # ... if not check if the path is accessible - # and has a valid "fonts.dir" index - *) - [ -f "${i}/fonts.dir" ] && echo "${i}" - ;; - esac - done -} - -XCOMM Build a comma-seperated list of fonts (font path) from a list of fonts -fontlist2fontpath() -{ - fp="" - read fp; - while read i ; do - fp="${fp},${i}" - done - - echo "$fp" -} - -XCOMM Build a list (one item per line) of fonts from a font path -fontpath2fontlist() -{ - while read i ; do - echo "${i}" | tr "," "\n" - done -} - -XCOMM Sort scaleable fonts (PS Type1 and TrueType) first in a font list -sort_scaleable_fonts_first() -{ - i="$(fontlist2fontpath)" - # First list PS Type1 fonts... - echo "${i}" | fontpath2fontlist | fgrep "/Type1" - # ... then TrueType fonts ... - echo "${i}" | fontpath2fontlist | egrep -i "/TrueType|/TT(/$|$)|/TTF(/$|$)" - # ... then all others - echo "${i}" | fontpath2fontlist | egrep -v -i "/Type1|/TrueType|/TT(/$|$)|/TTF(/$|$)" -} - -XCOMM Check if a X display is used by a Xserver or not -XCOMM Known bugs: -XCOMM - there is no way in plain bourne shell or bash (see comment about ksh93 -XCOMM below) to test if a Xserver sits only on a socket and not on a pipe -XCOMM - some Xserver's don't cleanup their stuff in /tmp on exit which may end -XCOMM in the problem that we don't detect possible free display numbers -XCOMM (one problem is that only ksh93 can do stuff like -XCOMM "cat </dev/tcp/0.0.0.0/6001") -CheckIfDisplayIsInUse() -{ - id=$1 - - [ -r "/tmp/.X${id}-lock" ] && return 0; - [ -r "/tmp/.X11-unix/X${id}" ] && return 0; - [ -r "/tmp/.X11-pipe/X${id}" ] && return 0; - - return 1; -} - -lastdisplaynumreturned_store=/tmp/.Xp_last_display_returned_by_findfreexdisplaynum_${RANDOM}_${RANDOM} - -XCOMM Try to find a free display number -FindFreeXDisplayNum() -{ - if [ -r "${lastdisplaynumreturned_store}" ] ; then - i="$(cat "${lastdisplaynumreturned_store}")" - else - i=32 # start at display 32 - fi - - while [ $i -lt 127 ] ; do - i=$(($i + 1)) - - if CheckIfDisplayIsInUse $i ; then - true - else - echo "$i" - echo "$i" >"${lastdisplaynumreturned_store}" - return 0 - fi - done - - # Using "magic" value of 189 here due lack of a better solution - echo "189" - echo "189" >"${lastdisplaynumreturned_store}" - return 0 -} - -XCOMM Check if a process exists or not -pexists() -{ - [ "$1" = "" ] && return 1; - - # Use of /proc would be better but not all platforms (like AIX) have procfs - [ "$(ps -p $1 | fgrep $1)" != "" ] && return 0; - return 1 -} - -XCOMM Check if there is a spooler running... -is_spooler_running() -{ - # This covers Linux lpd, CUPS, Solaris and AIX 4.x - but what about - # AIX 5.x, HP-UX and IRIX ? - - [ "$(ps -A | egrep 'lpd|lpsched|cupsd|qdaemon' | fgrep -v 'grep')" != "" ] && return 0; - return 1 -} - -XCOMM Wait until the spooler system has been started (but not more than 30secs) -wait_for_print_spooler() -{ - for i in 1 2 3 4 5 6 7 8 9 10 ; do - is_spooler_running && return 0; - sleep 3 - done - - return 0 -} - -lock_server_registry() -{ - lock_counter=0 # counts in 1/100s - waiting_for_lock_msg_send="false" - while ! mkdir "${XP_SERVERS}.lock" 2>/dev/null ; do - # print notice after 2 seconds - if [ ${lock_counter} -gt 200 -a "${waiting_for_lock_msg_send}" != "true" ] ; then - echo "${0}: waiting for lock(=${XP_SERVERS}.lock)..." - waiting_for_lock_msg_send="true" - fi - - # tread the lock as "broken" after 20 seconds - if [ ${lock_counter} -gt 2000 ] ; then - echo "${0}: WARNING: lock timeout for lock(=${XP_SERVERS}.lock)." - return 0 - fi - - if [ -x /bin/usleep ] ; then - /bin/usleep 200000 - lock_counter=$((${lock_counter} + 20)) # 20/100s - else - sleep 1 - lock_counter=$((${lock_counter} + 100)) # 100/100s - fi - done -} - -unlock_server_registry() -{ - rmdir "${XP_SERVERS}.lock" -} - -XCOMM Kill dead registry locks (silently!) -kill_dead_registry_locks() -{ - rm -Rf "${XP_SERVERS}.lock" -} - -XCOMM Start Xprint servers -start_servers() -{ - # Write registry "intro" ... - lock_server_registry - echo "# Xprint server list" >>"${XP_SERVERS}" - echo "# File is for private use for ${0}." >>"${XP_SERVERS}" - echo "# Do not edit, rely on the content or file format." >>"${XP_SERVERS}" - unlock_server_registry - - hostname="$(hostname)" - - default_fontpath="$(get_system_fontlist | fontlist2fontpath)" - default_fontpath_acceptpattern=".*"; - default_fontpath_rejectpattern="_No_Match_"; # Match nothing - - curr=0 - while [ $curr -lt $num_xpstart ] ; do - if [ "${xpstart_remote_server[$curr]}" != "" ] ; then - # Remote Xprt, just put the entry into the registry - lock_server_registry - echo "display=${xpstart_remote_server[$curr]}" >>"${XP_SERVERS}" - unlock_server_registry - else - # Run block in seperate process to avoid that changes to the - # xpstart_* variables affect the next cycle - ( - # Use defaults if there are no special options - [ "${xpstart_fontpath[$curr]}" = "" ] && xpstart_fontpath[$curr]="${default_fontpath}"; - [ "${xpstart_fontpath_acceptpattern[$curr]}" = "" ] && xpstart_fontpath_acceptpattern[$curr]="$default_fontpath_acceptpattern"; - [ "${xpstart_fontpath_rejectpattern[$curr]}" = "" ] && xpstart_fontpath_rejectpattern[$curr]="$default_fontpath_rejectpattern"; - [ "${xpstart_displayid[$curr]}" = "" ] && xpstart_displayid[$curr]="$(FindFreeXDisplayNum)" - [ "${xpstart_logger[$curr]}" = "" ] && xpstart_logger[$curr]="logger -p lpr.notice -t Xprt_${xpstart_displayid[$curr]}"; - [ "${xpstart_logfile[$curr]}" = "" ] && xpstart_logfile[$curr]="/dev/null"; - [ "${xpstart_xprt_binary[$curr]}" = "" ] && xpstart_xprt_binary[$curr]="${XPRT_BIN}"; - if [ "${xpstart_xprt_binary[$curr]}" = "/usr/openwin/bin/Xprt" -o "$(uname -s)" = "SunOS" ] ; then - # Solaris /usr/openwin/bin/Xprt does not support "-nolisten tcp" - # yet nor is it possible to run a Xserver on a unix socket only - # in Solaris since access to the unix domain sockets in - # /tmp/.X11-pipe and /tmp/.X11-unix is restricted to applications - # with group-id "root" (e.g. the Xprt server would need to be - # setgid "root" that plain users can start it listening on a unix - # socket only) - [ "${xpstart_options[$curr]}" = "" ] && xpstart_options[$curr]="-ac -pn" - else - [ "${xpstart_options[$curr]}" = "" ] && xpstart_options[$curr]="-ac -pn -nolisten tcp" - fi - - # Check if the Xprt binary is available - if [ ! -x "${xpstart_xprt_binary[$curr]}" ] ; then - error_echo "Can't find \"${xpstart_xprt_binary[$curr]}\"." - exit 1 # exit block - fi - - # Verify and set location of font encodings directory file - if [ "${xpstart_font_encodings_dir[$curr]}" = "" ] ; then - if [ -f "${XPROJECTROOT}/lib/X11/fonts/xf86encodings/encodings.dir" ] ; then - xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/lib/X11/fonts/xf86encodings/encodings.dir" - else - xpstart_font_encodings_dir[$curr]="${XPROJECTROOT}/lib/X11/fonts/encodings/encodings.dir"; - fi - fi - - unset FONT_ENCODINGS_DIRECTORY - if [ ! -f "${xpstart_font_encodings_dir[$curr]}" ] ; then - warning_echo "Can't find \"${xpstart_font_encodings_dir[$curr]}\", TrueType font support may not work." - fi - - export FONT_ENCODINGS_DIRECTORY="${xpstart_font_encodings_dir[$curr]}" - - # Generate font path (containing only valid font path elements) - # from input font path and filter expressions - curr_fp=$(echo "${xpstart_fontpath[$curr]}" | - fontpath2fontlist | - filter_fontlist "${xpstart_fontpath_acceptpattern[$curr]}" "${xpstart_fontpath_rejectpattern[$curr]}" | - filter_unsupported_fonts | - sort_scaleable_fonts_first | - validate_fontlist | - fontlist2fontpath) - - # Set Xserver auditing level option - unset curr_audit - if [ "${xpstart_auditlevel[$curr]}" != "" ] ; then - curr_audit="-audit ${xpstart_auditlevel[$curr]}" - fi - - # Set Xprt -XpFile option - unset curr_xpfile - if [ "${xpstart_xpfile[$curr]}" != "" ] ; then - curr_xpfile="-XpFile ${xpstart_xpfile[$curr]}" - fi - - # Set custom XPCONFIGDIR (if there is one) - unset XPCONFIGDIR - if [ "${xpstart_xpconfigdir[$curr]}" != "" ] ; then - export XPCONFIGDIR="${xpstart_xpconfigdir[$curr]}" - fi - - # If someone uses "-nolisten tcp" make sure we do not add a hostname to force local transport - if [ "$(echo "${xpstart_options[$curr]}" | egrep "nolisten.*tcp")" != "" ] ; then - xp_display=":${xpstart_displayid[$curr]}" - else - xp_display="${hostname}:${xpstart_displayid[$curr]}" - fi - - ( - ( - "${xpstart_xprt_binary[$curr]}" \ - ${xpstart_options[$curr]} \ - ${curr_xpfile} ${curr_audit} \ - -fp ${curr_fp} \ - :${xpstart_displayid[$curr]} & - server_pid="$!" - - # Append the new server to the registry - lock_server_registry - echo "display=${xp_display} display_id=${xpstart_displayid[$curr]} pid=${server_pid}" >>"${XP_SERVERS}" - unlock_server_registry - - wait - echo "Xprint server pid=${server_pid} done, exitcode=$?." - - # Remove the dead server from the registry - # (only if the registry still exists - if /etc/init.d/xprint stop" gets called the registry - # will be removed - and we should not re-create it afterwards...) - lock_server_registry - if [ -f "${XP_SERVERS}" ] ; then - x="$(cat "${XP_SERVERS}")" # Store content of file "${XP_SERVERS}" in var "x" - echo "${x}" | fgrep -v "display_id=${xpstart_displayid[$curr]} pid=${server_pid}" >"${XP_SERVERS}" - fi - unlock_server_registry - ) 2>&1 | while read i ; do echo "$i" | tee -a "${xpstart_logfile[$curr]}" | ${xpstart_logger[$curr]} ; done - ) & - ) - fi - - curr=$(($curr + 1)) - done - - # Remove tmp. file created by |FindFreeXDisplayNum()| - rm -f "${lastdisplaynumreturned_store}" - - # Done. - lock_server_registry - echo "# EOF." >>"${XP_SERVERS}" - unlock_server_registry - return 0 -} - - -XCOMM Convenience function to check setup and start Xprt server(s) -do_start() -{ - if [ -f "${XP_SERVERS}" ] ; then - numservers="$(do_get_xpserverlist | wc -l)" - if [ ${numservers} -gt 0 ] ; then - verbose_echo "Xprint servers are already running." - return 0 - else - verbose_echo "Old server registry found, cleaning-up..." - do_stop - fi - fi - - # Check if we can write the registry file - touch "${XP_SERVERS}" 2>/dev/null - if [ ! -f "${XP_SERVERS}" ] ; then - error_echo "Cannot create \"${XP_SERVERS}\"." - # exit code 4 = user had insufficient privilege (LSB) - exit 4 - fi - - if ! setup_config ; then - error_echo "setup_config failed." - exit 1 - fi - - # Provide two paths here - one which simply starts the Xprt servers, - # assuming that there is a print spooler already running (or that - # ${XPCONFIG}/C/print/Xprinters provides static print queue entries - # (like for the PSspooldir print model)) and a 2nd path which - # explicitly checks if the print queue daemons are running - if true ; then - msg "Starting Xprint servers: Xprt." - start_servers - else - # Continue in the background if there is no spooler running yet (that - # we don't hold off the boot process nor run in a possible race-condition - # when /etc/init.d/lpd was not called yet but the runlevel script waits - # for us to finish first ... - if is_spooler_running ; then - msg "Starting Xprint servers: Xprt." - start_servers - else - msg "Starting Xprint servers (in the background): Xprt." - (wait_for_print_spooler ; start_servers) & - sleep 5 - fi - fi - - if [ "${CURRLOGNAME}" = "root" -a -d /var/lock/subsys/ ] ; then - touch /var/lock/subsys/xprint - fi -} - -XCOMM Convenience function to stop Xprt server(s) -do_stop() -{ - msg "Stopping Xprint servers: Xprt." - - lock_server_registry - if [ -f "${XP_SERVERS}" ] ; then - reglist="$(cat "${XP_SERVERS}")" - rm -f "${XP_SERVERS}" - fi - unlock_server_registry - - if [ "${reglist}" != "" ] ; then - echo "${reglist}" | - grep "^display=.*:.* pid=[0-9]*$" | - while read i ; do - ( - eval ${i} - if pexists ${pid} ; then - kill ${pid} - fi - - # Remove the X sockets/pipes which are not in use anymore - # (It would be better if the Xservers would cleanup this - # automatically, but most Xservers do not do that... ;-( - # Note that this will not work on Solaris where applications - # must run with groupid="root" if they want to write into - # /tmp/.X11-unix/ and/or /tmp/.X11-pipe/) - if [ "${display_id}" != "" ] ; then - rm -f "/tmp/.X${display_id}-lock" 2>/dev/null - rm -f "/tmp/.X11-unix/X${display_id}" 2>/dev/null - rm -f "/tmp/.X11-pipe/X${display_id}" 2>/dev/null - fi - ) - done - fi - - if [ "${CURRLOGNAME}" = "root" -a -d /var/lock/subsys/ ] ; then - rm -f /var/lock/subsys/xprint - fi - - # Remove any outstanding (dead) locks and cleanup - rm -f "${XP_SERVERS}" - kill_dead_registry_locks -} - -XCOMM Convenience function to obtain a list of available Xprint servers -do_get_xpserverlist() -{ - if [ -f "${XP_PER_USER_SERVERS}" -o -f "${XP_GLOBAL_SERVERS}" ] ; then - xpserverlist=$( - # Enumerate both per-user and global servers (in that order) - ( - [ -f "${XP_PER_USER_SERVERS}" ] && cat "${XP_PER_USER_SERVERS}" - [ -f "${XP_GLOBAL_SERVERS}" ] && cat "${XP_GLOBAL_SERVERS}" - ) | - egrep "^display=.*:.* pid=[0-9]*$|^display=.*:[0-9]*$" | - while read i ; do - ( - pid="none" - eval ${i} - # Check if the Xprt process exists (if possible) - if [ "$pid" != "none" ] ; then - if pexists ${pid} ; then - echo ${display} - fi - else - echo ${display} - fi - ) - done | tr "\n" " " - ) - # Only produce output if we have some entries... - [ "${xpserverlist}" != "" ] && echo "${xpserverlist}" - fi -} - -do_restart() -{ - msg "Restarting Xprint server(s): Xprt." - do_stop - sleep 1 - do_start -} - -do_diag() -{ - echo "##### Diag start $(date)." - - # General info - echo "## General info start." - ( - echo "PATH=\"${PATH}\"" - echo "TZ=\"${TZ}\"" - echo "LANG=\"${LANG}\"" - echo "uname -a=\"$(uname -a)\"" - echo "uname -s=\"$(uname -s)\"" - echo "uname -p=\"$(uname -p)\"" - echo "uname -i=\"$(uname -i)\"" - echo "uname -m=\"$(uname -m)\"" - echo "has /etc/SuSE-release ... $([ -f "/etc/SuSE-release" ] && echo "yes" || echo "no")" - echo "has /etc/redhat-release ... $([ -f "/etc/redhat-release" ] && echo "yes" || echo "no")" - echo "has /etc/debian_version ... $([ -f "/etc/debian_version" ] && echo "yes" || echo "no")" - echo "how many Xprt servers are running ...$(ps -ef | fgrep Xprt | fgrep -v "grep" | wc -l)" - ) 2>&1 | while read i ; do echo " $i" ; done - echo "## General info end." - - # Testing font paths - echo "## Testing font paths start." - ( - get_system_fontlist | - filter_unsupported_fonts | - sort_scaleable_fonts_first | - validate_fontlist | while read d ; do - echo "#### Testing \"${d}\" ..." - if [ ! -d "$d" ] ; then - echo "# Error: $d does not exists." - continue - fi - if [ ! -r "$d" ] ; then - echo "# Error: $d not readable." - continue - fi - if [ ! -f "${d}/fonts.dir" ] ; then - echo "# Error: ${d}/fonts.dir not found." - continue - else - if [ ! -r "${d}/fonts.dir" ] ; then - echo "# Error: ${d}/fonts.dir not readable." - continue - fi - fi - if [ -f "${d}/fonts.alias" ] ; then - if [ ! -r "${d}/fonts.alias" ] ; then - echo "# Error: ${d}/fonts.alias not readable." - fi - fi - - if [ "$(cat "${d}/fonts.dir" | fgrep 'cursor')" != "" ] ; then - echo "${d}/fonts.dir has cursor font." - fi - if [ "$(cat "${d}/fonts.dir" | fgrep 'fixed')" != "" ] ; then - echo "${d}/fonts.dir has fixed font." - fi - - if [ -r "${d}/fonts.alias" ] ; then - if [ "$(cat "${d}/fonts.alias" | fgrep 'cursor')" != "" ] ; then - echo "${d}/fonts.alias has cursor font." - fi - if [ "$(cat "${d}/fonts.alias" | fgrep 'fixed')" != "" ] ; then - echo "${d}/fonts.alias has fixed font." - fi - fi - - linenum=0 - cat "${d}/fonts.dir" | while read i1 i2 i3 i4 ; do - linenum=$((${linenum} + 1)) - [ ${linenum} -eq 1 ] && continue - - if [ ! -f "${d}/${i1}" ] ; then - echo "ERROR: ${d}/fonts.dir line ${linenum} has non-exististant font \"${i1}\" (=\"${i1} ${i2} ${i3} ${i4}\")" - fi - done - done - ) 2>&1 | while read i ; do echo " $i" ; done - echo "## Testing font paths end." - - echo "##### Diag End $(date)." -} - -XCOMM Set platform-defaults for setup_config() -setup_config_defaults() -{ - curr_num_xpstart="${1}" - - #### Defaults for Linux/Solaris - # Start Xprt using builtin XPCONFIGDIR at a free display numer - # (Solaris(=SunOS5.x)'s /usr/openwin/bin/Xprt supports TrueType fonts, - # therefore we don't need to filter them) - xpstart_fontpath[${curr_num_xpstart}]=""; - xpstart_fontpath_acceptpattern[${curr_num_xpstart}]=".*"; - xpstart_fontpath_rejectpattern[${curr_num_xpstart}]="/Speedo|/F3bitmaps|/F3"; - xpstart_displayid[${curr_num_xpstart}]=""; - xpstart_xpconfigdir[${curr_num_xpstart}]=""; - xpstart_xpfile[${curr_num_xpstart}]=""; - xpstart_auditlevel[${curr_num_xpstart}]="4"; - xpstart_options[${curr_num_xpstart}]=""; - xpstart_logger[${curr_num_xpstart}]=""; - # Check whether we have /dev/stderr (needed for old AIX + old Debian) - if [ -w "/dev/stderr" ] ; then - xpstart_logfile[${curr_num_xpstart}]="/dev/stderr"; - else - xpstart_logfile[${curr_num_xpstart}]="/dev/tty"; - fi - xpstart_xprt_binary[${curr_num_xpstart}]=""; - - # Custom rules for the GISWxprintglue package on Solaris - # (which uses Solaris's /usr/openwin/bin/Xprt but a custom config) - if [ "${XPCUSTOMGLUE}" = "GISWxprintglue" ] ; then - xpstart_xpconfigdir[${curr_num_xpstart}]="/opt/GISWxprintglue/server/etc/XpConfig" - xpstart_xprt_binary[${curr_num_xpstart}]="/usr/openwin/bin/Xprt" - fi - # Custom rules for the GISWxprint package on Solaris - # (which uses both it's own Xprt and a custom config) - if [ "${XPCUSTOMGLUE}" = "GISWxprint" ] ; then - xpstart_xpconfigdir[${curr_num_xpstart}]="/opt/GISWxprint/server/etc/XpConfig" - xpstart_xprt_binary[${curr_num_xpstart}]="/opt/GISWxprint/bin/Xprt" - xpstart_font_encodings_dir[${curr_num_xpstart}]="/opt/GISWxprint/lib/X11/fonts/encodings/encodings.dir" - fi - - ####################################################### - ### - ### Debian Xprint package default configuration - ### - if [ "${XPCUSTOMGLUE}" = "DebianGlue" ] ; then - # Set XPCONFIGDIR=/usr/share/Xprint/xserver - xpstart_xpconfigdir[${curr_num_xpstart}]="/usr/share/Xprint/xserver"; - - # Use fixed display ID (":64"), or else all client programs will have to be - # restarted simply to update XPSERVERLIST to the latest ID when upgrading, - # which would be a nightmare. - xpstart_displayid[${curr_num_xpstart}]=64; - - # Do not send any messages to console - xpstart_logfile[${curr_num_xpstart}]="/dev/null"; - - # By default use binary provided by Debian's "xprt-xprintorg" package - # (=/usr/bin/Xprt), otherwise leave blank (e.g. use script's default - # (=/usr/X11R6/bin/Xprt)) - if [ -x "/usr/bin/Xprt" ] ; then - xpstart_xprt_binary[${curr_num_xpstart}]="/usr/bin/Xprt"; - fi - fi - ### - ### End Debian default configuration - ### - ####################################################### -} - -fetch_etc_initd_xprint_envvars() -{ - curr_num_xpstart="${1}" - - ## Process some $ETC_INITD_XPRINT_* vars after all which may be used by - # a user to override the hardcoded values here when starting Xprt per-user - # (a more flexible way is to provide an own setup config script in - # "~./Xprint_per_user_startup" - see above) - if [ "${ETC_INITD_XPRINT_XPRT_PATH}" != "" ] ; then - xpstart_xprt_binary[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPRT_PATH}" - fi - if [ "${ETC_INITD_XPRINT_XPCONFIGDIR}" != "" ] ; then - xpstart_xpconfigdir[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPCONFIGDIR}" - fi - if [ "${ETC_INITD_XPRINT_XPFILE}" != "" ] ; then - xpstart_xpfile[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPFILE}" - fi - if [ "${ETC_INITD_XPRINT_LOGFILE}" != "" ] ; then - xpstart_logfile[${curr_num_xpstart}]="${ETC_INITD_XPRINT_LOGFILE}" - fi - if [ "${ETC_INITD_XPRINT_DISPLAYID}" != "" ] ; then - xpstart_displayid[${curr_num_xpstart}]="${ETC_INITD_XPRINT_DISPLAYID}" - fi - if [ "${ETC_INITD_XPRINT_FONTPATH}" != "" ] ; then - xpstart_fontpath[${curr_num_xpstart}]="${ETC_INITD_XPRINT_FONTPATH}" - fi - if [ "${ETC_INITD_XPRINT_XPRT_OPTIONS}" != "" ] ; then - xpstart_options[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XPRT_OPTIONS}" - fi - if [ "${ETC_INITD_XPRINT_AUDITLEVEL}" != "" ] ; then - xpstart_auditlevel[${curr_num_xpstart}]="${ETC_INITD_XPRINT_AUDITLEVEL}" - fi - if [ "${ETC_INITD_XPRINT_XF86ENCODINGSDIR}" != "" ] ; then - xpstart_font_encodings_dir[${curr_num_xpstart}]="${ETC_INITD_XPRINT_XF86ENCODINGSDIR}" - fi -} - -XCOMM########################################################################### -XCOMM setup_config() sets the configuration parameters used to start one -XCOMM or more Xprint servers ("Xprt"). -XCOMM The following variables are used: -XCOMM - "num_xpstart" - number of servers to start -XCOMM - "xpstart_fontpath[index]" - custom font path. Leave blank if you want -XCOMM the platform-specific default -XCOMM - "xpstart_fontpath_acceptpattern[index]" - extended regular expression -XCOMM (see egrep(1)) used to filter the font path - items only pass this -XCOMM filter if they match the pattern (leave blank if you want to filter -XCOMM nothing) -XCOMM - "xpstart_fontpath_rejectpattern[index]" - extended regular expression -XCOMM (see egrep(1)) used to filter the font path - items only pass this -XCOMM filter if they do not match the pattern (leave blank if you want to -XCOMM filter nothing) -XCOMM - "xpstart_font_encodings_dir[index]" - location of "encodings.dir". -XCOMM Leave blank to use the default. -XCOMM - "xpstart_displayid[index]" - display id to use for the Xprint server -XCOMM (leave blank to choose the next available free display id) -XCOMM - "xpstart_xpconfigdir[index]" - value for custom XPCONFIGDIR (leave blank -XCOMM if you don not want that that XPCONFIGDIR is set at Xprt startup) -XCOMM - "xpstart_xpfile[index]" - value used for Xprt's "-XpFile" option (leave -XCOMM blank if you do not want to set this option) -XCOMM - "xpstart_auditlevel[index]" - set Xserver auditing level (leave blank to -XCOMM use no auditing) -XCOMM - "xpstart_options[index]" - set further Xprt options (leave blank to set -XCOMM no further options) -XCOMM - "xpstart_logger[index]" - utility which gets stderr/stdout messages from -XCOMM Xprt and sends them to a logging daemon. Leave blank to use /usr/bin/logger -XCOMM to send such messages to the lpr.notice syslog) -XCOMM - "xpstart_logfile[index]" - log file to append stderr/stdout messages from -XCOMM Xprt to. Leave blank to send messages to /dev/null -XCOMM - "xpstart_xprt_binary[index]" - set custom Xprt binary (leave blank to use -XCOMM the platform-specifc default) -setup_config() -{ - num_xpstart=0; - - if [ "${ETC_INITD_XPRINT_CUSTOM_SETUP_CONFIG}" != "" ] ; then - user_cfg="${ETC_INITD_XPRINT_CUSTOM_SETUP_CONFIG}" - else - user_cfg="${HOME}/.Xprint_per_user_startup" - fi - - # Source per-user ~/.Xprint_per_user_startup file if there is one - # (and do not use the script's defaults below) - if [ -r "${user_cfg}" ] ; then - # Define API version which should be checked by ${HOME}/.Xprint_per_user_startup - # ${HOME}/.Xprint_per_user_startup should bail-out if the version differ - etc_initd_xprint_api_version=2 - - # Source per-user settings script - . "${user_cfg}" - - # done with setting the config for per-user Xprt instances - return 0; - else - # Use /etc/init.d/xprint's builtin config - # Each entry should start with |setup_config_defaults| to pull the - # platform defaults and finish with |num_xpstart=$(($num_xpstart + 1))| - # to end the entry - - # Set platform-defaults - setup_config_defaults "${num_xpstart}" - - ## -- snip -- - - # Admins can put their stuff "in" here... - - ## -- snip -- - - # Override script's builtin values with those a user may set via the - # $ETC_INIITD_XPRINT_* env vars - fetch_etc_initd_xprint_envvars "${num_xpstart}" - - num_xpstart=$((${num_xpstart} + 1)) - - return 0; - fi - - #### Sample 1: - # # Start Xprt on a free display ID with custom XPCONFIGDIR and without - # # Speedo and TrueType fonts - # xpstart_fontpath_rejectpattern[$num_xpstart]="/Speedo|/TrueType|/TT(/$|$)|/TTF(/$|$)"; - # xpstart_xpconfigdir[$num_xpstart]="/home/gisburn/cwork/Xprint/Xprt_config/XpConfig"; - # xpstart_auditlevel[$num_xpstart]="4"; - # xpstart_options[$num_xpstart]="-ac -pn"; - #num_xpstart=$(($num_xpstart + 1)) - - - #### Sample 2: - # # Start Xprt without TrueType fonts on a display 55 with custom - # # XPCONFIGDIR - # xpstart_fontpath_rejectpattern[$num_xpstart]="/TrueType|/TT(/$|$)|/TTF(/$|$)"; - # xpstart_displayid[$num_xpstart]=55; - # xpstart_xpconfigdir[$num_xpstart]="/home/gisburn/cwork/Xprint/Xprt_config/XpConfig"; - # xpstart_auditlevel[$num_xpstart]=4; - # xpstart_options[$num_xpstart]="-ac -pn"; - #num_xpstart=$(($num_xpstart + 1)) - - #### Sample 3: - # # Start Xprt without TrueType fonts on a display 56 with custom - # # XPCONFIGDIR and alternate "Xprinters" file - # xpstart_fontpath_rejectpattern[$num_xpstart]="/TrueType|/TT(/$|$)|/TTF(/$|$)"; - # xpstart_displayid[$num_xpstart]=56; - # xpstart_xpconfigdir[$num_xpstart]="/etc/XpConfig/default"; - # xpstart_xpfile[$num_xpstart]="/etc/XpConfig/default/Xprinters_test2" - # xpstart_auditlevel[$num_xpstart]="4"; - # xpstart_options[$num_xpstart]="-ac -pn"; - # xpstart_xprt_binary[$num_xpstart]=""; - #num_xpstart=$(($num_xpstart + 1)) - - #### Sample 4: - # # Start Xprt with Solaris ISO-8859-7 (greek(="el") locale) fonts on - # # display 57 - # xpstart_fontpath[$num_xpstart]="/usr/openwin/lib/locale/iso_8859_7/X11/fonts/75dpi,/usr/openwin/lib/locale/iso_8859_7/X11/fonts/Type1,/usr/openwin/lib/X11/fonts/misc/"; - # xpstart_fontpath_acceptpattern[$num_xpstart]=""; - # xpstart_fontpath_rejectpattern[$num_xpstart]="_No_Match_"; - # xpstart_displayid[$num_xpstart]="57"; - # xpstart_auditlevel[$num_xpstart]="4"; - # xpstart_options[$num_xpstart]="-ac -pn"; - #num_xpstart=$(($num_xpstart + 1)) - - #### Sample 5: - # # Start Xprt with the font list of an existing Xserver (excluding Speedo fonts) on - # # display 58 - # # Note that this only works within a X session. At system boot time - # # there will be no $DISPLAY to fetch the information from!! - # xpstart_fontpath[$num_xpstart]="$(get_fontlist_from_display ${DISPLAY} | fontlist2fontpath)"; - # xpstart_fontpath_acceptpattern[$num_xpstart]=""; - # xpstart_fontpath_rejectpattern[$num_xpstart]=""; - # xpstart_displayid[$num_xpstart]="58"; - # xpstart_xpconfigdir[$num_xpstart]=""; - # xpstart_auditlevel[$num_xpstart]="4"; - # xpstart_options[$num_xpstart]="-ac -pn"; - # xpstart_xprt_binary[$num_xpstart]=""; - #num_xpstart=$(($num_xpstart + 1)) - - #### Sample 6: - # # List remote Xprt's here - # # (note that there is no test to check whether these DISPLAYs are valid!) - # xpstart_remote_server[$num_xpstart]="sera:12" ; num_xpstart=$(($num_xpstart + 1)) - # xpstart_remote_server[$num_xpstart]="gandalf:19" ; num_xpstart=$(($num_xpstart + 1)) -} - -XCOMM########################################################################### - -XCOMM Main -case "$1" in - ## Start Xprint servers - 'start') - do_start - ;; - - ## Stop Xprint servers - # Note that this does _not_ kill Xprt instances started using this script - # by non-root users - 'stop') - do_stop - ;; - - ## Restart Xprint servers - 'restart'|'force-reload') - do_restart - ;; - - ## Reload configuration without stopping and restarting - 'reload') - # not supported - msg "reload not supported, use 'restart' or 'force-reload'" - exit 3 - ;; - - ## Restart Xprint only if it is already running - 'condrestart'|'try-restart') - # only restart if it is already running - [ -f /var/lock/subsys/xprint ] && do_restart || : - ;; - - ## Get list of all Xprint servers for this user - # (incl. per-user and system-wide instances) - 'get_xpserverlist') - do_get_xpserverlist - ;; - - ## Get status of Xprint servers, RedHat-style - 'status') - x="$(do_get_xpserverlist)" - if [ "${x}" != "" ] ; then - msg "Xprint (${x}) is running..." - exit 0 - else - msg "Xprint is stopped" - exit 3 - fi - ;; - - ## Wrapper - 'wrapper') - cmd="${2}" - [ "${cmd}" = "" ] && fatal_error "No command given." - shift ; shift - export XPSERVERLIST="$(do_get_xpserverlist)" - [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found." - exec "${cmd}" "$@" - ;; - - ## Wrapper for "xplsprinters" - 'lsprinters') - [ "${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" != "" ] && cmd="${ETC_INITD_XPRINT_XPLSPRINTERS_PATH}" - [ "${cmd}" = "" -a "${XPCUSTOMGLUE}" = "GISWxprintglue" ] && cmd="/opt/GISWxprintglue/bin/xplsprinters" - [ "${cmd}" = "" -a "${XPCUSTOMGLUE}" = "GISWxprint" ] && cmd="/opt/GISWxprint/bin/xplsprinters" - [ "${cmd}" = "" -a "${XPROJECTROOT}" != "" ] && cmd="${XPROJECTROOT}/bin/xplsprinters" - [ "${cmd}" = "" ] && cmd="xplsprinters" - - shift - export XPSERVERLIST="$(do_get_xpserverlist)" - [ "${XPSERVERLIST}" = "" ] && fatal_error "No Xprint servers found." - exec "${cmd}" "$@" - ;; - - ## Diagnostics - 'diag') - do_diag - ;; - - ## Print usage - *) - msg "Usage: $0 { start | stop | restart | reload | force-reload | status | condrestart | try-restart | wrapper | lsprinters | get_xpserverlist | diag }" - exit 2 -esac -exit 0 - -XCOMM EOF. diff --git a/hw/xprint/etc/profile.d/Makefile.am b/hw/xprint/etc/profile.d/Makefile.am deleted file mode 100644 index b91a9115a..000000000 --- a/hw/xprint/etc/profile.d/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST = xprint.csh xprint.sh diff --git a/hw/xprint/etc/profile.d/xprint.csh b/hw/xprint/etc/profile.d/xprint.csh deleted file mode 100644 index 7cc675840..000000000 --- a/hw/xprint/etc/profile.d/xprint.csh +++ /dev/null @@ -1,16 +0,0 @@ -# -# /etc/profile.d/xprint.csh -# -# Copyright (c) 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org> -# please send bugfixes or comments to http://xprint.mozdev.org/ - - -# -# Obtain list of Xprint servers -# - -if ( -f /etc/init.d/xprint ) then - setenv XPSERVERLIST "`/bin/sh /etc/init.d/xprint get_xpserverlist`" -endif - -# /etc/profile.d/xprint.csh ends here. diff --git a/hw/xprint/etc/profile.d/xprint.sh b/hw/xprint/etc/profile.d/xprint.sh deleted file mode 100644 index b5b46c1e7..000000000 --- a/hw/xprint/etc/profile.d/xprint.sh +++ /dev/null @@ -1,16 +0,0 @@ -# -# /etc/profile.d/xprint.sh -# -# Copyright (c) 2002-2004 by Roland Mainz <roland.mainz@nrubsig.org> -# please send bugfixes or comments to http://xprint.mozdev.org/ - -# -# Obtain list of Xprint servers -# - -if [ -f "/etc/init.d/xprint" ] ; then - XPSERVERLIST="`/bin/sh /etc/init.d/xprint get_xpserverlist`" - export XPSERVERLIST -fi - -# /etc/profile.d/xprint.sh ends here. diff --git a/hw/xprint/mediaSizes.c b/hw/xprint/mediaSizes.c deleted file mode 100644 index 7acc70679..000000000 --- a/hw/xprint/mediaSizes.c +++ /dev/null @@ -1,782 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/******************************************************************* -** -** ********************************************************* -** * -** * File: mediaSizes.c -** * -** * Contents: -** * Routines to return the sizes associated -** * with particular media and particular printers. -** * -** * Created: 2/19/96 -** * -** * Copyright: Copyright 1993,1995 Hewlett-Packard Company -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <string.h> -#include <locale.h> - -#include <X11/X.h> -#include "dixstruct.h" -#include "screenint.h" -#include "misc.h" -#include "scrnintstr.h" -#include <X11/fonts/fontstruct.h> - -#include "DiPrint.h" -#include "attributes.h" - -typedef struct { - XpOid page_size; - float width; - float height; -} PageDimensionsRec; - -static PageDimensionsRec PageDimensions[] = -{ - {xpoid_val_medium_size_na_letter, 215.9, 279.4}, - {xpoid_val_medium_size_na_legal, 215.9, 355.6}, - {xpoid_val_medium_size_executive, 184.15, 266.7}, - {xpoid_val_medium_size_folio, 210.82, 330.2}, - {xpoid_val_medium_size_invoice, 139.7, 215.9}, - {xpoid_val_medium_size_ledger, 279.4, 431.8}, - {xpoid_val_medium_size_quarto, 215.9, 275.082}, - {xpoid_val_medium_size_a, 215.9, 279.4}, - {xpoid_val_medium_size_b, 279.4, 431.8}, - {xpoid_val_medium_size_c, 431.8, 558.8}, - {xpoid_val_medium_size_d, 558.8, 863.6}, - {xpoid_val_medium_size_e, 863.6, 1117.6}, - {xpoid_val_medium_size_na_6x9_envelope, 152.4, 228.6}, - {xpoid_val_medium_size_na_10x15_envelope, 254, 381}, - {xpoid_val_medium_size_monarch_envelope, 98.298, 190.5}, - {xpoid_val_medium_size_na_10x13_envelope, 254, 330.2}, - {xpoid_val_medium_size_na_9x12_envelope, 228.6, 304.8}, - {xpoid_val_medium_size_na_number_10_envelope, 104.775, 241.3}, - {xpoid_val_medium_size_na_7x9_envelope, 177.8, 228.6}, - {xpoid_val_medium_size_na_9x11_envelope, 228.6, 279.4}, - {xpoid_val_medium_size_na_10x14_envelope, 254, 355.6}, - {xpoid_val_medium_size_na_number_9_envelope, 98.425, 225.425}, - {xpoid_val_medium_size_iso_a0, 841, 1189}, - {xpoid_val_medium_size_iso_a1, 594, 841}, - {xpoid_val_medium_size_iso_a2, 420, 594}, - {xpoid_val_medium_size_iso_a3, 297, 420}, - {xpoid_val_medium_size_iso_a4, 210, 297}, - {xpoid_val_medium_size_iso_a5, 148, 210}, - {xpoid_val_medium_size_iso_a6, 105, 148}, - {xpoid_val_medium_size_iso_a7, 74, 105}, - {xpoid_val_medium_size_iso_a8, 52, 74}, - {xpoid_val_medium_size_iso_a9, 37, 52}, - {xpoid_val_medium_size_iso_a10, 26, 37}, - {xpoid_val_medium_size_iso_b0, 1000, 1414}, - {xpoid_val_medium_size_iso_b1, 707, 1000}, - {xpoid_val_medium_size_iso_b2, 500, 707}, - {xpoid_val_medium_size_iso_b3, 353, 500}, - {xpoid_val_medium_size_iso_b4, 250, 353}, - {xpoid_val_medium_size_iso_b5, 176, 250}, - {xpoid_val_medium_size_iso_b6, 125, 176}, - {xpoid_val_medium_size_iso_b7, 88, 125}, - {xpoid_val_medium_size_iso_b8, 62, 88}, - {xpoid_val_medium_size_iso_b9, 44, 62}, - {xpoid_val_medium_size_iso_b10, 31, 44}, - {xpoid_val_medium_size_jis_b0, 1030, 1456}, - {xpoid_val_medium_size_jis_b1, 728, 1030}, - {xpoid_val_medium_size_jis_b2, 515, 728}, - {xpoid_val_medium_size_jis_b3, 364, 515}, - {xpoid_val_medium_size_jis_b4, 257, 364}, - {xpoid_val_medium_size_jis_b5, 182, 257}, - {xpoid_val_medium_size_jis_b6, 128, 182}, - {xpoid_val_medium_size_jis_b7, 91, 128}, - {xpoid_val_medium_size_jis_b8, 64, 91}, - {xpoid_val_medium_size_jis_b9, 45, 64}, - {xpoid_val_medium_size_jis_b10, 32, 45}, - {xpoid_val_medium_size_hp_2x_postcard, 148, 200}, - {xpoid_val_medium_size_hp_european_edp, 304.8, 355.6}, - {xpoid_val_medium_size_hp_mini, 139.7, 215.9}, - {xpoid_val_medium_size_hp_postcard, 100, 148}, - {xpoid_val_medium_size_hp_tabloid, 279.4, 431.8}, - {xpoid_val_medium_size_hp_us_edp, 279.4, 355.6}, - {xpoid_val_medium_size_hp_us_government_legal, 203.2, 330.2}, - {xpoid_val_medium_size_hp_us_government_letter, 203.2, 254}, - {xpoid_val_medium_size_iso_c3, 324, 458}, - {xpoid_val_medium_size_iso_c4, 229, 324}, - {xpoid_val_medium_size_iso_c5, 162, 229}, - {xpoid_val_medium_size_iso_c6, 114, 162}, - {xpoid_val_medium_size_iso_designated_long, 110, 220} -}; - -/* - * XpGetResolution returns an integer representing the printer resolution - * in dots-per-inch for the specified print context. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -int -XpGetResolution( - XpContextPtr pContext) -{ - unsigned long resolution; - - resolution = XpGetCardAttr(pContext, XPPageAttr, - xpoid_att_default_printer_resolution, - (XpOidCardList*)NULL); - if(0 == resolution) - resolution = XpGetCardAttr(pContext, XPDocAttr, - xpoid_att_default_printer_resolution, - (XpOidCardList*)NULL); - if(0 == resolution) - { - XpOidCardList* resolutions_supported; - /* - * default-printer-resolution not specified; default to 1st entry - * in printer-resolutions-supported. - */ - resolutions_supported = - XpGetCardListAttr(pContext, XPPrinterAttr, - xpoid_att_printer_resolutions_supported, - (XpOidCardList*)NULL); - resolution = XpOidCardListGetCard(resolutions_supported, 0); - XpOidCardListDelete(resolutions_supported); - } - return (int)resolution; -} - -/* - * XpGetContentOrientation determines the content-orientation as - * determined by the passed context. The page and document pools are - * queried in turn for a specified content-orientation attribute. If none - * is found the first content-orientation in the - * content-orientations-supported printer attribute is taken as the - * default. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -XpOid -XpGetContentOrientation( - XpContextPtr pContext) -{ - XpOid orientation; - - orientation = XpGetOidAttr(pContext, XPPageAttr, - xpoid_att_content_orientation, - (XpOidList*)NULL); - if(xpoid_none == orientation) - orientation = XpGetOidAttr(pContext, XPDocAttr, - xpoid_att_content_orientation, - (XpOidList*)NULL); - if(xpoid_none == orientation) - { - XpOidList* content_orientations_supported; - - content_orientations_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_content_orientations_supported, - (XpOidList*)NULL); - orientation = XpOidListGetOid(content_orientations_supported, 0); - XpOidListDelete(content_orientations_supported); - } - return orientation; -} - -/* - * XpGetAvailableCompression determines the available-compression as - * determined by the passed context. The page and document pools are - * queried in turn for a specified content-orientation attribute. If none - * is found the first available-compression in the - * avaiable-compressions-supported printer attribute is taken as the - * default. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -XpOid -XpGetAvailableCompression( - XpContextPtr pContext) -{ - XpOid compression; - - compression = XpGetOidAttr(pContext, XPPageAttr, - xpoid_att_available_compression, - (XpOidList*)NULL); - if(xpoid_none == compression) - compression = XpGetOidAttr(pContext, XPDocAttr, - xpoid_att_available_compression, - (XpOidList*)NULL); - if(xpoid_none == compression) - { - XpOidList* available_compressions_supported; - - available_compressions_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_available_compressions_supported, - (XpOidList*)NULL); - compression = XpOidListGetOid(available_compressions_supported, 0); - XpOidListDelete(available_compressions_supported); - } - return compression; -} - -/* - * XpGetPlex determines the plex as determined by the passed context. The page - * and document pools are queried in turn for a specified plex attribute. If - * none is found the first plex in the plexes-supported printer attribute is - * taken as the default. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -XpOid -XpGetPlex( - XpContextPtr pContext) -{ - XpOid plex; - - plex = XpGetOidAttr(pContext, XPPageAttr, xpoid_att_plex, - (XpOidList*)NULL); - if(xpoid_none == plex) - plex = XpGetOidAttr(pContext, XPDocAttr, xpoid_att_plex, - (XpOidList*)NULL); - if(xpoid_none == plex) - { - XpOidList* plexes_supported; - - plexes_supported = - XpGetListAttr(pContext, XPPrinterAttr, - xpoid_att_plexes_supported, - (XpOidList*)NULL); - plex = XpOidListGetOid(plexes_supported, 0); - XpOidListDelete(plexes_supported); - } - return plex; -} - -/* - * XpGetPageSize returns the XpOid of the current page size (medium names - * are page sizes in this implementation) as indicated by the passed - * context. - * - * The relevant input-tray is returned in pTray. This parm must not be - * NULL. If the input-tray is not indicated or irrelevant, xpoid_none - * will be returned. - * - * This function optionally takes a XpOidMediumSS representation of the - * medium-source-sizes-supported attribute in order to avoid parsing the - * string value twice for calling functions that need to parse m-s-s-s - * anyway (e.g. XpGetReproductionArea). If the caller has no other reason - * to parse medium-source-sizes-supported, it is recommended that NULL be - * passed. This function will obtain medium-source-sizes-supported if it - * needs to. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -XpOid -XpGetPageSize(XpContextPtr pContext, - XpOid* pTray, - const XpOidMediumSS* msss) -{ - XpOid medium; - /* - * check to see if default-medium is specified - */ - medium = XpGetOidAttr(pContext, XPPageAttr, xpoid_att_default_medium, - (const XpOidList*)NULL); - if(medium == xpoid_none) - { - /* - * default-medium not in page pool; try the document pool - */ - medium = XpGetOidAttr(pContext, XPDocAttr, xpoid_att_default_medium, - (const XpOidList*)NULL); - } - if(medium == xpoid_none) - { - /* - * default-medium not specified; try default-input-tray - */ - *pTray = XpGetOidAttr(pContext, XPPageAttr, - xpoid_att_default_input_tray, - (const XpOidList*)NULL); - if(*pTray == xpoid_none) - { - /* - * default-input-tray not in page pool; try the document pool - */ - *pTray = XpGetOidAttr(pContext, XPDocAttr, - xpoid_att_default_input_tray, - (const XpOidList*)NULL); - } - if(*pTray != xpoid_none) - { - /* - * default-input-tray found; get corresponding medium from - * input-trays-medium - */ - XpOidTrayMediumList* input_trays_medium; - int i; - - input_trays_medium = - XpGetTrayMediumListAttr(pContext, XPPrinterAttr, - xpoid_att_input_trays_medium, - (const XpOidList*)NULL, - (const XpOidMediumSS*)NULL); - for(i = 0; i < XpOidTrayMediumListCount(input_trays_medium); i++) - { - if(*pTray == XpOidTrayMediumListTray(input_trays_medium, i)) - { - medium = XpOidTrayMediumListMedium(input_trays_medium, i); - break; - } - } - XpOidTrayMediumListDelete(input_trays_medium); - } - } - else - *pTray = xpoid_none; - - if(medium == xpoid_none) - { - XpOidMediumSS* local_msss = (XpOidMediumSS*)NULL; - int i_mss, i_ds; - XpOidMediumDiscreteSizeList* ds_list; - /* - * no medium specified; use 1st page size found in - * medium-source-sizes-supported - */ - if((XpOidMediumSS*)NULL == msss) - msss = local_msss = - XpGetMediumSSAttr(pContext, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, - (const XpOidList*)NULL, - (const XpOidList*)NULL); - for(i_mss = 0; - i_mss < XpOidMediumSSCount(msss) && xpoid_none == medium; - i_mss++) - { - if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag - && - xpoid_none != (msss->mss)[i_mss].input_tray) - { - ds_list = (msss->mss)[i_mss].ms.discrete; - for(i_ds = 0; i_ds < ds_list->count; i_ds++) - { - if(xpoid_none != (ds_list->list)[i_ds].page_size) - { - medium = (ds_list->list)[i_ds].page_size; - break; - } - } - } - } - XpOidMediumSSDelete(local_msss); - } - return medium; -} - -/* - * XpGetMediumMillimeters returns into the supplied float pointers the - * width and height in millimeters of the passed page size identifier. - */ -void -XpGetMediumMillimeters( - XpOid page_size, - float *width, /* return */ - float *height) /* return */ -{ - int i; - - *width = *height = 0; - for(i = 0; i < XpNumber(PageDimensions); i++) - { - if(page_size == PageDimensions[i].page_size) - { - *width = PageDimensions[i].width; - *height = PageDimensions[i].height; - return; - } - } -} - -/* - * Converts a millimeter specification into pixels given a resolution in - * DPI. - */ -static float -MmToPixels(float mm, int resolution) -{ - float f; - - f = mm * resolution; - f /= 25.4; - return f; -} - -/* - * XpGetMediumDimensions returns into the supplied short pointers the - * width and height in pixels of the medium associated with the specified - * print context. It obtains the page size associated with the current - * medium by calling XpGetPageSize. It passes XpGetMediumMillimeters the - * page size, and converts the returned millimeter dimensions into pixels - * using the resolution returned by XpGetResolution. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -void -XpGetMediumDimensions( - XpContextPtr pContext, - unsigned short *width, /* return */ - unsigned short *height) /* return */ -{ - XpOid page_size; - XpOid tray; - XpOid orientation; - - int resolution; - float w_mm, h_mm; - - page_size = XpGetPageSize(pContext, &tray, (XpOidMediumSS*)NULL); - if(page_size == xpoid_none) - { - /* - * fail-safe: if the pools have been validated, this defaulting logic - * isn't needed. - */ - page_size = xpoid_val_medium_size_na_letter; - } - XpGetMediumMillimeters(page_size, &w_mm, &h_mm); - resolution = XpGetResolution(pContext); - orientation = XpGetContentOrientation(pContext); - switch(orientation) - { - case xpoid_val_content_orientation_landscape: - case xpoid_val_content_orientation_reverse_landscape: - /* - * transpose width and height - */ - *height = MmToPixels(w_mm, resolution); - *width = MmToPixels(h_mm, resolution); - break; - - default: - *width = MmToPixels(w_mm, resolution); - *height = MmToPixels(h_mm, resolution); - break; - } -} - -/* - * XRectangleFromXpOidArea converts an XpOidArea area specification - * into an XRectangle. The passed resolution is used to convert from - * millimeters (XpOidArea) into pixels (XRectangle). - */ -static void -XRectangleFromXpOidArea( - xRectangle *pRect, - const XpOidArea* repro, - int resolution, - XpOid orientation) -{ - switch(orientation) - { - case xpoid_val_content_orientation_landscape: - case xpoid_val_content_orientation_reverse_landscape: - /* - * transpose x and y, width and height - */ - pRect->y = MmToPixels(repro->minimum_x, resolution); - pRect->x = MmToPixels(repro->minimum_y, resolution); - pRect->height = - MmToPixels(repro->maximum_x - repro->minimum_x, resolution); - pRect->width = - MmToPixels(repro->maximum_y - repro->minimum_y, resolution); - break; - - default: - pRect->x = MmToPixels(repro->minimum_x, resolution); - pRect->y = MmToPixels(repro->minimum_y, resolution); - pRect->width = - MmToPixels(repro->maximum_x - repro->minimum_x, resolution); - pRect->height = - MmToPixels(repro->maximum_y - repro->minimum_y, resolution); - break; - } -} - -/* - * XpGetReproductionArea queries the current pool attribute values in - * order to determine the reproduction area for the currently selected - * medium. - * - * First the current page size (equivalent to current medium) and tray - * (if specified) is retrieved via XpGetPageSize. The value of the - * medium-source-sizes-supported attribute is interrogated until a matching - * entry for the current page size and tray is found. The reproduction - * area defined for the current entry is converted into an XRectangle - * using XRectangleFromXpOidArea and returned to the caller. - * - * Note: This routine assumes the values found in the passed context's - * attributes pools have been validated. - */ -void -XpGetReproductionArea(XpContextPtr pContext, - xRectangle *pRect) -{ - XpOid page_size; - XpOid tray; - XpOidMediumSS* msss; - int i_mss, i_ds; - XpOidMediumDiscreteSizeList* ds_list; - XpOidArea* repro; - BOOL done; - int resolution; - XpOid orientation; - /* - * find the appropriate assured reproduction area for the current - * tray and page size in the medium-source-sizes-supported attribute. - */ - msss = XpGetMediumSSAttr(pContext, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, - (const XpOidList*)NULL, - (const XpOidList*)NULL); - page_size = XpGetPageSize(pContext, &tray, msss); - resolution = XpGetResolution(pContext); - orientation = XpGetContentOrientation(pContext); - - memset(pRect, 0, sizeof(xRectangle)); - - if(xpoid_none == tray) - { - /* - * no tray specified; use 1st matching page size - */ - for(i_mss = 0, done = xFalse; - i_mss < XpOidMediumSSCount(msss) && !done; - i_mss++) - { - if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag - && - xpoid_none != (msss->mss)[i_mss].input_tray) - { - ds_list = (msss->mss)[i_mss].ms.discrete; - for(i_ds = 0; i_ds < ds_list->count; i_ds++) - { - if(page_size == (ds_list->list)[i_ds].page_size) - { - repro = - &(ds_list->list)[i_ds].assured_reproduction_area; - XRectangleFromXpOidArea(pRect, repro, - resolution, orientation); - done = xTrue; - break; - } - } - } - } - } - else - { - /* - * tray && page size specified; find matching entry - */ - for(i_mss = 0, done = xFalse; - i_mss < XpOidMediumSSCount(msss) && !done; - i_mss++) - { - if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag - && - xpoid_none != (msss->mss)[i_mss].input_tray - && - (tray == (msss->mss)[i_mss].input_tray - || - xpoid_unspecified == (msss->mss)[i_mss].input_tray) - ) - { - ds_list = (msss->mss)[i_mss].ms.discrete; - for(i_ds = 0; i_ds < ds_list->count; i_ds++) - { - if(page_size == (ds_list->list)[i_ds].page_size) - { - repro = - &(ds_list->list)[i_ds].assured_reproduction_area; - XRectangleFromXpOidArea(pRect, repro, - resolution, orientation); - if(xpoid_unspecified != (msss->mss)[i_mss].input_tray) - { - /* - * exact match on tray takes precendence over - * unspecified tray entry in m-s-s-s - */ - done = xTrue; - } - break; - } - } - } - } - } - XpOidMediumSSDelete(msss); -} - -/* - * XpGetMaxWidthHeightRes returns into the supplied width and height - * unsigned short pointers the dimensions in millimeters of the largest - * supported media for a specific printer. It looks at the - * medium-source-sizes-supported attribute (if it exists) to determine - * the list of possible media, and calls XpGetMediumMillimeters to get the - * dimensions for each medium. If the m-s-s-s attribute is not defined, - * then the dimensions for the na-letter medium is returned. - * - * This function also returns the largest resolution in DPI defined in - * printer-resolutions-supported. If printer-resolutions-supported is not - * specified, the default is obtained from the passed XpValidatePoolsRec. - * - * The passed XpValidatePoolsRec is also used to determine valid values - * when parsing attribute values. - */ -void -XpGetMaxWidthHeightRes( - const char *printer_name, - const XpValidatePoolsRec* vpr, - float *width, - float *height, - int* resolution) -{ - const char* value; - const char* attr_str; - XpOidMediumSS* pool_msss; - const XpOidMediumSS* msss; - int i_mss, i_ds; - XpOidMediumDiscreteSizeList* ds_list; - float w, h; - XpOidCardList* pool_resolutions_supported; - const XpOidCardList* resolutions_supported; - int i; - int res; - /* - * get the max medium width and height - */ - attr_str = XpOidString(xpoid_att_medium_source_sizes_supported); - value = XpGetPrinterAttribute(printer_name, attr_str); - pool_msss = XpOidMediumSSNew(value, - vpr->valid_input_trays, - vpr->valid_medium_sizes); - if(0 == XpOidMediumSSCount(pool_msss)) - msss = XpGetDefaultMediumSS(); - else - msss = pool_msss; - *width = *height = 0; - for(i_mss = 0; i_mss < XpOidMediumSSCount(msss); i_mss++) - { - if(XpOidMediumSS_DISCRETE == (msss->mss)[i_mss].mstag - && - xpoid_none != (msss->mss)[i_mss].input_tray) - { - ds_list = (msss->mss)[i_mss].ms.discrete; - for(i_ds = 0; i_ds < ds_list->count; i_ds++) - { - if(xpoid_none != (ds_list->list)[i_ds].page_size) - { - XpGetMediumMillimeters((ds_list->list)[i_ds].page_size, - &w, &h); - if(w > *width) *width = w; - if(h > *height) *height = h; - } - } - } - } - XpOidMediumSSDelete(pool_msss); - /* - * get the maximum resolution - */ - attr_str = XpOidString(xpoid_att_printer_resolutions_supported); - value = XpGetPrinterAttribute(printer_name, attr_str); - pool_resolutions_supported = - XpOidCardListNew(value, vpr->valid_printer_resolutions_supported); - if(0 == XpOidCardListCount(pool_resolutions_supported)) - resolutions_supported = vpr->default_printer_resolutions_supported; - else - resolutions_supported = pool_resolutions_supported; - *resolution = 0; - for(i = 0; i < XpOidCardListCount(resolutions_supported); i++) - { - res = XpOidCardListGetCard(resolutions_supported, i); - if(res > *resolution) *resolution = res; - } - XpOidCardListDelete(pool_resolutions_supported); -} - -FontResolutionPtr -XpGetClientResolutions(client, num) - ClientPtr client; - int *num; -{ - static struct _FontResolution res; - int resolution = XpGetResolution(XpContextOfClient(client)); - - res.x_resolution = resolution; - res.y_resolution = resolution; - - res.point_size = 120; - - *num = 1; - - return &res; -} - - -void XpSetFontResFunc(client) - ClientPtr client; -{ - client->fontResFunc = XpGetClientResolutions; -} - - -void XpUnsetFontResFunc(client) - ClientPtr client; -{ - client->fontResFunc = NULL; -} diff --git a/hw/xprint/pcl-mono/Makefile.am b/hw/xprint/pcl-mono/Makefile.am deleted file mode 100644 index 4d8dfc682..000000000 --- a/hw/xprint/pcl-mono/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_LTLIBRARIES = libpcl.la - -PCL_DRIVER = -DXP_PCL_MONO - -include ../pcl/Makefile.am.inc diff --git a/hw/xprint/pcl/Makefile.am b/hw/xprint/pcl/Makefile.am deleted file mode 100644 index 90133e8e2..000000000 --- a/hw/xprint/pcl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_LTLIBRARIES = libpcl.la - -PCL_DRIVER = -DXP_PCL_COLOR - -include ../pcl/Makefile.am.inc - diff --git a/hw/xprint/pcl/Makefile.am.inc b/hw/xprint/pcl/Makefile.am.inc deleted file mode 100644 index c3af606ee..000000000 --- a/hw/xprint/pcl/Makefile.am.inc +++ /dev/null @@ -1,27 +0,0 @@ -INCLUDES = -I$(top_srcdir)/hw/xprint - -AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ $(PCL_DRIVER) - -libpcl_la_SOURCES = \ - $(srcdir)/../pcl/PclArc.c \ - $(srcdir)/../pcl/PclArea.c \ - $(srcdir)/../pcl/PclAttr.c \ - $(srcdir)/../pcl/PclAttVal.c \ - $(srcdir)/../pcl/PclColor.c \ - $(srcdir)/../pcl/PclCursor.c \ - $(srcdir)/../pcl/PclDef.h \ - $(srcdir)/../pcl/PclFonts.c \ - $(srcdir)/../pcl/PclGC.c \ - $(srcdir)/../pcl/Pcl.h \ - $(srcdir)/../pcl/PclInit.c \ - $(srcdir)/../pcl/PclLine.c \ - $(srcdir)/../pcl/Pclmap.h \ - $(srcdir)/../pcl/PclMisc.c \ - $(srcdir)/../pcl/PclPixel.c \ - $(srcdir)/../pcl/PclPolygon.c \ - $(srcdir)/../pcl/PclPrint.c \ - $(srcdir)/../pcl/PclSFonts.c \ - $(srcdir)/../pcl/PclSFonts.h \ - $(srcdir)/../pcl/PclSpans.c \ - $(srcdir)/../pcl/PclText.c \ - $(srcdir)/../pcl/PclWindow.c diff --git a/hw/xprint/pcl/Pcl.h b/hw/xprint/pcl/Pcl.h deleted file mode 100644 index d46a03401..000000000 --- a/hw/xprint/pcl/Pcl.h +++ /dev/null @@ -1,619 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: Pcl.h -** * -** * Contents: defines and includes for the Pcl driver -** * for a printing X server. -** * -** * Created: 1/30/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _PCL_H_ -#define _PCL_H_ - -#include <stdio.h> -#include "scrnintstr.h" - -#include "PclDef.h" -#include "Pclmap.h" -#include "PclSFonts.h" - -#include <X11/extensions/Print.h> -#include <X11/extensions/Printstr.h> - -#include "regionstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" -#include "gcstruct.h" - -/* - * Some sleazes to force the XrmDB stuff into the server - */ -#ifndef HAVE_XPointer -typedef char *XPointer; -#endif -#define Status int -#define True 1 -#define False 0 -#include "misc.h" -#include <X11/Xfuncproto.h> -#include <X11/Xresource.h> -#include "attributes.h" - -/****** - * externally visible variables from PclInit.c - ******/ -extern DevPrivateKey PclScreenPrivateKey, PclWindowPrivateKey; -extern DevPrivateKey PclContextPrivateKey; -extern DevPrivateKey PclPixmapPrivateKey; -extern DevPrivateKey PclGCPrivateKey; - -/****** - * externally visible variables from PclAttVal.c - ******/ -extern XpValidatePoolsRec PclValidatePoolsRec; - -/* - * This structure defines a mapping from an X colormap ID to a list of - * print contexts which use the colormap. - */ -typedef struct _pclcontextlist { - XpContextPtr context; - struct _pclcontextlist *next; -} PclContextList, *PclContextListPtr; - -typedef struct _pclcmaptocontexts { - long colormapId; - PclContextListPtr contexts; - struct _pclcmaptocontexts *next; -} PclCmapToContexts; - -typedef struct { - PclCmapToContexts *colormaps; - CloseScreenProcPtr CloseScreen; -} PclScreenPrivRec, *PclScreenPrivPtr; - -/* - * This structure defines a mapping from an X colormap ID to a PCL - * palette ID. - */ -typedef struct _palettemap { - long colormapId; - int paletteId; - int downloaded; - struct _palettemap *next; -} PclPaletteMap, *PclPaletteMapPtr; - -typedef struct { - char *jobFileName; - FILE *pJobFile; - char *pageFileName; - FILE *pPageFile; - GC lastGC; - unsigned char *dash; - int validGC; - ClientPtr getDocClient; - int getDocBufSize; - PclSoftFontInfoPtr pSoftFontInfo; - PclPaletteMapPtr palettes; - int currentPalette; - int nextPaletteId; - PclPaletteMap staticGrayPalette; - PclPaletteMap trueColorPalette; - PclPaletteMap specialTrueColorPalette; - unsigned char *ctbl; - int ctbldim; - int isRaw; -#ifdef XP_PCL_LJ3 - unsigned int fcount; - unsigned int fcount_max; - char *figures; -#endif /* XP_PCL_LJ3 */ -} PclContextPrivRec, *PclContextPrivPtr; - -typedef struct { - int validContext; - XpContextPtr context; -} PclWindowPrivRec, *PclWindowPrivPtr; - -typedef struct { - unsigned long stippleFg, stippleBg; -} PclGCPrivRec, *PclGCPrivPtr; - -typedef struct { - XpContextPtr context; - char *tempFileName; - FILE *tempFile; - GC lastGC; - int validGC; -} PclPixmapPrivRec, *PclPixmapPrivPtr; - -/****** - * Defined functions - ******/ -#define SEND_PCL(f,c) fwrite( c, sizeof( char ), strlen( c ), f ) -#define SEND_PCL_COUNT(f,c,n) fwrite( c, sizeof( char ), n, f ) - -#ifndef XP_PCL_LJ3 -#define SAVE_PCL(f,p,c) SEND_PCL(f,c) -#define SAVE_PCL_COUNT(f,p,c,n) SEND_PCL_COUNT(f,c,n) -#define MACRO_START(f,p) SEND_PCL(f, "\033&f1Y\033&f0X") -#define MACRO_END(f) SEND_PCL(f, "\033&f1X") -#else -#define SAVE_PCL(f,p,c) PclSpoolFigs(p, c, strlen(c)) -#define SAVE_PCL_COUNT(f,p,c,n) PclSpoolFigs(p, c, n) -#define MACRO_START(f,p) p->fcount = 0 -#define MACRO_END(f) /* do nothing */ -#endif /* XP_PCL_LJ3 */ - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - -/****** - * Functions in PclArc.c - ******/ -extern void PclPolyArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs); -extern void PclPolyFillArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs); - -/****** - * Functions in PclArea.c - ******/ -extern void PclPutImage( - DrawablePtr pDrawable, - GCPtr pGC, - int depth, - int x, - int y, - int w, - int h, - int leftPad, - int format, - char *pImage); -extern RegionPtr PclCopyArea( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty); -RegionPtr PclCopyPlane( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty, - unsigned long plane); - - -/****** - * Functions in PclAttr.c - ******/ -extern char *PclGetAttributes( - XpContextPtr pCon, - XPAttributes pool ); -extern char *PclGetOneAttribute( - XpContextPtr pCon, - XPAttributes pool, - char *attr ); -extern int PclAugmentAttributes( - XpContextPtr pCon, - XPAttributes pool, - char *attrs ); -extern int PclSetAttributes( - XpContextPtr pCon, - XPAttributes pool, - char *attrs ); - -/****** - * Functions in PclColor.c - ******/ -extern Bool PclCreateDefColormap(ScreenPtr pScreen); -extern Bool PclCreateColormap(ColormapPtr pColor); -extern void PclDestroyColormap(ColormapPtr pColor); -extern void PclInstallColormap(ColormapPtr pColor); -extern void PclUninstallColormap(ColormapPtr pColor); -extern int PclListInstalledColormaps(ScreenPtr pScreen, - XID *pCmapList); -extern void PclStoreColors(ColormapPtr pColor, - int ndef, - xColorItem *pdefs); -extern void PclResolveColor(unsigned short *pRed, - unsigned short *pGreen, - unsigned short *pBlue, - VisualPtr pVisual); -extern int PclUpdateColormap(DrawablePtr pDrawable, - XpContextPtr pCon, - GCPtr gc, - FILE *outFile); -extern void PclLookUp(ColormapPtr cmap, - PclContextPrivPtr cPriv, - unsigned short *r, - unsigned short *g, - unsigned short *b); -extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv, - ColormapPtr cmap, - GCPtr gc); -extern unsigned char *PclReadMap(char *, int *); - - -/****** - * Functions in PclCursor.c - ******/ -extern void PclConstrainCursor( - ScreenPtr pScreen, - BoxPtr pBox); -extern void PclCursorLimits( - ScreenPtr pScreen, - CursorPtr pCursor, - BoxPtr pHotBox, - BoxPtr pTopLeftbox); -extern Bool PclDisplayCursor( - ScreenPtr pScreen, - CursorPtr pCursor); -extern Bool PclRealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor); -extern Bool PclUnrealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor); -extern void PclRecolorCursor( - ScreenPtr pScreen, - CursorPtr pCursor, - Bool displayed); -extern Bool PclSetCursorPosition( - ScreenPtr pScreen, - int x, - int y, - Bool generateEvent); - -/****** - * Functions in PclSFonts.c - ******/ -extern void -PclDownloadSoftFont8( - FILE *fp, - PclSoftFontInfoPtr pSoftFontInfo, - PclFontHead8Ptr pfh, - PclCharDataPtr pcd, - unsigned char *code); -extern void PclDownloadSoftFont16( - FILE *fp, - PclSoftFontInfoPtr pSoftFontInfo, - PclFontHead16Ptr pfh, - PclCharDataPtr pcd, - unsigned char row, - unsigned char col); -extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void); -extern void PclDestroySoftFontInfo( - PclSoftFontInfoPtr pSoftFontInfo ); - -/****** - * Functions in PclGC.c - ******/ -extern Bool PclCreateGC(GCPtr pGC); -extern void PclDestroyGC(GCPtr pGC); -extern int PclUpdateDrawableGC( - GCPtr pGC, - DrawablePtr pDrawable, - FILE **outFile); -extern void PclValidateGC( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable); -extern void PclSetDrawablePrivateStuff( - DrawablePtr pDrawable, - GC gc ); -extern int PclGetDrawablePrivateStuff( - DrawablePtr pDrawable, - GC *gc, - unsigned long *valid, - FILE **file ); -extern void PclSetDrawablePrivateGC( - DrawablePtr pDrawable, - GC gc); -extern void PclComputeCompositeClip( - GCPtr pGC, - DrawablePtr pDrawable); - -/****** - * Functions in PclInit.c - ******/ -extern Bool PclCloseScreen( - int index, - ScreenPtr pScreen); -extern Bool InitializeColorPclDriver( - int ndx, - ScreenPtr pScreen, - int argc, - char **argv); -extern Bool InitializeMonoPclDriver( - int ndx, - ScreenPtr pScreen, - int argc, - char **argv); -extern Bool InitializeLj3PclDriver( - int ndx, - ScreenPtr pScreen, - int argc, - char **argv); -extern XpContextPtr PclGetContextFromWindow( WindowPtr win ); - -/****** - * Functions in PclLine.c - ******/ -extern void PclPolyLine( - DrawablePtr pDrawable, - GCPtr pGC, - int mode, - int nPoints, - xPoint *pPoints); -extern void PclPolySegment( - DrawablePtr pDrawable, - GCPtr pGC, - int nSegments, - xSegment *pSegments); - -/****** - * Functions in PclMisc.c - ******/ -extern void PclQueryBestSize( - int class, - short *pwidth, - short *pheight, - ScreenPtr pScreen); -extern char *GetPropString(WindowPtr pWin, char *propName); -extern int SystemCmd(char *cmdStr); -extern int PclGetMediumDimensions( - XpContextPtr pCon, - CARD16 *pWidth, - CARD16 *pHeight); -extern int PclGetReproducibleArea( - XpContextPtr pCon, - xRectangle *pRect); -extern void PclSendData( - FILE *outFile, - PclContextPrivPtr pConPriv, - BoxPtr pbox, - int nbox, - double ratio); - -/****** - * Functions in PclPixel.c - ******/ -extern void PclPolyPoint( - DrawablePtr pDrawable, - GCPtr pGC, - int mode, - int nPoints, - xPoint *pPoints); -extern void PclPushPixels( - GCPtr pGC, - PixmapPtr pBitmap, - DrawablePtr pDrawable, - int width, - int height, - int x, - int y); - -/****** - * Functions in PclPixmap.c - ******/ -extern PixmapPtr PclCreatePixmap( - ScreenPtr pScreen, - int width, - int height, - int depth); -extern Bool PclDestroyPixmap(PixmapPtr pPixmap); - -/****** - * Functions in PclPolygon.c - ******/ -extern void PclPolyRectangle( - DrawablePtr pDrawable, - GCPtr pGC, - int nRects, - xRectangle *pRects); -extern void PclFillPolygon( - DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, - int nPoints, - DDXPointPtr pPoints); -extern void PclPolyFillRect( - DrawablePtr pDrawable, - GCPtr pGC, - int nRects, - xRectangle *pRects); - -/****** - * Functions in PclSpans.c - ******/ -extern void PclFillSpans( - DrawablePtr pDrawable, - GCPtr pGC, - int nSpans, - DDXPointPtr pPoints, - int *pWidths, - int fSorted); -extern void PclSetSpans( - DrawablePtr pDrawable, - GCPtr pGC, - char *pSrc, - DDXPointPtr pPoints, - int *pWidths, - int nSpans, - int fSorted); - -/****** - * Functions in PclText.c - ******/ -extern int PclPolyText8( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - char *string); -extern int PclPolyText16( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *string); -extern void PclImageText8( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - char *string); -extern void PclImageText16( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *string); -extern void PclImageGlyphBlt( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nGlyphs, - CharInfoPtr *pCharInfo, - pointer pGlyphBase); -extern void PclPolyGlyphBlt( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nGlyphs, - CharInfoPtr *pCharInfo, - pointer pGlyphBase); - -/****** - * Functions in PclWindow.c - ******/ -extern Bool PclCreateWindow(register WindowPtr pWin); -extern Bool PclDestroyWindow(WindowPtr pWin); -extern Bool PclMapWindow(WindowPtr pWindow); -extern Bool PclPositionWindow( - register WindowPtr pWin, - int x, - int y); -extern Bool PclUnmapWindow(WindowPtr pWindow); -extern void PclCopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc); -extern Bool PclChangeWindowAttributes( - register WindowPtr pWin, - register unsigned long mask); - -/****** - * Functions in PclFonts.c - ******/ -extern Bool PclRealizeFont( - ScreenPtr pscr, - FontPtr pFont); -extern Bool PclUnrealizeFont( - ScreenPtr pscr, - FontPtr pFont); - -/****** - * Functions in PclPrint.c - ******/ -extern int PclStartJob( - XpContextPtr pCon, - Bool sendClientData, - ClientPtr client); -extern int PclEndJob( - XpContextPtr pCon, - Bool cancel); -extern int PclStartPage( - XpContextPtr pCon, - WindowPtr pWin); -extern int PclEndPage( - XpContextPtr pCon, - WindowPtr pWin); -extern int PclStartDoc(XpContextPtr pCon, - XPDocumentType type); -extern int PclEndDoc( - XpContextPtr pCon, - Bool cancel); -extern int PclDocumentData( - XpContextPtr pCon, - DrawablePtr pDraw, - char *pData, - int len_data, - char *pFmt, - int len_fmt, - char *pOpt, - int len_opt, - ClientPtr client); -extern int PclGetDocumentData( - XpContextPtr pCon, - ClientPtr client, - int maxBufferSize); - - -#endif /* _PCL_H_ */ diff --git a/hw/xprint/pcl/PclArc.c b/hw/xprint/pcl/PclArc.c deleted file mode 100644 index 20d3f723d..000000000 --- a/hw/xprint/pcl/PclArc.c +++ /dev/null @@ -1,268 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclArc.c -** * -** * Contents: -** * Arc-drawing code for the PCL DDX driver -** * -** * Created: 10/23/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <math.h> -#include <errno.h> - -#include "Pcl.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "attributes.h" - -static void -PclDoArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs, - void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc)) -{ - char t[80]; - FILE *outFile; - int nbox, i; - BoxPtr pbox; - BoxRec r; - RegionPtr drawRegion, region, transClip; - short fudge; - int xoffset, yoffset; - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - xRectangle repro; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - fudge = 3 * pGC->lineWidth; - - pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - XpGetReproductionArea( pCon, &repro ); - - /* - * Generate the PCL code to draw the collection of arcs, by - * defining it as a macro which uses the HP-GL/2 arc drawing - * function. - */ - - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - for( i = 0; i < nArcs; i++ ) - { - xArc Arc = pArcs[i]; - double b, X, Y, ratio; - double angle1; - - MACRO_START( outFile, pConPriv ); - SAVE_PCL( outFile, pConPriv, "\033%0B" ); - - /* Calculate the start of the arc */ - if( ( Arc.angle1 / 64 ) % 360 == 90 ) - { - X = 0; - Y = -Arc.height / 2.0; - } - else if( ( Arc.angle1 / 64 ) % 360 == 270 ) - { - X = 0; - Y = Arc.height / 2.0; - } - else - { - /* Convert the angle to radians */ - angle1 = ( Arc.angle1 / 64.0 ) * 3.141592654 / 180.0; - - b = (Arc.height / 2.0); - X = b * cos( angle1 ); - Y = -b * sin( angle1 ); - } - - /* Change the coordinate system to scale the ellipse */ - ratio = (double)Arc.height / (double)Arc.width; - - sprintf( t, "SC%.2f,%.2f,%d,%d;", - (repro.x - Arc.width / 2 - xoffset - Arc.x) * ratio, - (repro.x - Arc.width / 2 - xoffset - Arc.x + - repro.width) * ratio, - repro.y - Arc.height / 2 - yoffset - Arc.y + repro.height, - repro.y - Arc.height / 2 - yoffset - Arc.y); - SAVE_PCL( outFile, pConPriv, t ); - - DoIt( outFile, pConPriv, X, Y, Arc ); - - /* Build the bounding box */ - r.x1 = -Arc.width / 2 - fudge; - r.y1 = -Arc.height / 2 - fudge; - r.x2 = Arc.width / 2 + fudge; - r.y2 = Arc.height / 2 + fudge; - drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 ); - - SAVE_PCL( outFile, pConPriv, "\033%0A" ); - MACRO_END( outFile ); - - /* - * Intersect the bounding box with the clip region. - */ - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - transClip = REGION_CREATE( pGC->pScreen, NULL, 0 ); - REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip ); - REGION_TRANSLATE( pGC->pScreen, transClip, - -(xoffset + Arc.x + Arc.width / 2), - -(yoffset + Arc.y + Arc.height / 2) ); - REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the collection of arcs to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, ratio); - - /* - * Restore the coordinate system - */ - sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, - repro.x + repro.width, repro.y + repro.height, - repro.y ); - SEND_PCL( outFile, t ); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - REGION_DESTROY( pGC->pScreen, transClip ); - } -} - -/* - * Draw a simple non-filled arc, centered on the origin and starting - * at the given point. - */ -static void -DrawArc(FILE *outFile, - PclContextPrivPtr pConPriv, - double X, - double Y, - xArc A) -{ - char t[80]; - - sprintf( t, "PU%d,%d;PD;AA0,0,%.2f;", (int)X, (int)Y, - (float)A.angle2 / -64.0 ); - SAVE_PCL(outFile, pConPriv, t); -} - -void -PclPolyArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs) -{ - PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc ); -} - -/* - * Draw a filled wedge, from the origin, to the given point, through - * the appropriate angle, and back to the origin. - */ -static void -DoWedge(FILE *outFile, - PclContextPrivPtr pConPriv, - double X, - double Y, - xArc A) -{ - char t[80]; - - sprintf( t, "PU0,0;WG%.2f,%.2f,%.2f;", sqrt( X * X + Y * Y ), - (float)A.angle1 / -64.0, - (float)A.angle2 / -64.0 ); - SAVE_PCL(outFile, pConPriv, t); -} - -static void -DoChord(FILE *outFile, - PclContextPrivPtr pConPriv, - double X, - double Y, - xArc A) -{ - char t[80]; - - sprintf( t, "PU%d,%d;PM0;AA0,0,%.2f;PA%d,%d;PM2;FP;", (int)X, (int)Y, - (float)A.angle2 / -64.0 , (int)X, (int)Y ); - SAVE_PCL(outFile, pConPriv, t); -} - - -void -PclPolyFillArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs) -{ - switch( pGC->arcMode ) - { - case ArcChord: - PclDoArc( pDrawable, pGC, nArcs, pArcs, DoChord ); - break; - case ArcPieSlice: - PclDoArc( pDrawable, pGC, nArcs, pArcs, DoWedge ); - break; - } -} diff --git a/hw/xprint/pcl/PclArea.c b/hw/xprint/pcl/PclArea.c deleted file mode 100644 index a4e53dad6..000000000 --- a/hw/xprint/pcl/PclArea.c +++ /dev/null @@ -1,436 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclArea.c -** * -** * Contents: -** * Image and Area functions for the PCL DDX driver -** * -** * Created: 10/23/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include "Pcl.h" -#include "pixmapstr.h" -#include "region.h" - -#include "fb.h" - -void -PclPutImage(DrawablePtr pDrawable, - GCPtr pGC, - int depth, - int x, - int y, - int w, - int h, - int leftPad, - int format, - char *pImage) -{ - PixmapPtr pPixmap; - unsigned long oldFg, oldBg; - XID gcv[3]; - unsigned long oldPlanemask; - unsigned long i; - long bytesPer; - - if( ( w == 0 ) || ( h == 0 ) ) - return; - - if( format != XYPixmap ) - { - pPixmap = GetScratchPixmapHeader( pDrawable->pScreen, - w+leftPad, h, depth, - BitsPerPixel( depth ), - PixmapBytePad( w + leftPad, - depth ), (pointer)pImage ); - if( !pPixmap ) - return; - - if( format == ZPixmap ) - (void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC, - leftPad, 0, w, h, x, y ); - else - (void)(*pGC->ops->CopyPlane)( (DrawablePtr)pPixmap, pDrawable, pGC, - leftPad, 0, w, h, x, y, 1 ); - FreeScratchPixmapHeader( pPixmap ); - } - else - { - pPixmap = GetScratchPixmapHeader( pDrawable->pScreen, - w+leftPad, h, depth, - BitsPerPixel( depth ), - PixmapBytePad( w + leftPad, - depth ), (pointer)pImage ); - - if( !pPixmap ) - return; - - depth = pGC->depth; - oldPlanemask = pGC->planemask; - oldFg = pGC->fgPixel; - oldBg = pGC->bgPixel; - gcv[0] = ~0L; - gcv[1] = 0; - DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 ); - bytesPer = (long)h * BitmapBytePad( w + leftPad ); - - for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer ) - { - if( i & oldPlanemask ) - { - gcv[0] = i; - DoChangeGC( pGC, GCPlaneMask, gcv, 0 ); - ValidateGC( pDrawable, pGC ); - fbPutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h, - leftPad, XYBitmap, pImage ); - } - } - gcv[0] = oldPlanemask; - gcv[1] = oldFg; - gcv[2] = oldBg; - DoChangeGC( pGC, GCPlaneMask | GCForeground | GCBackground, - gcv, 0 ); - - PclCopyArea( (DrawablePtr)pPixmap, pDrawable, pGC, leftPad, - 0, w, h, x, y ); - FreeScratchPixmapHeader( pPixmap ); - } -} - -/* - * PclMonoPixmapFragment() - * - * Given a 1-bit-deep pixmap, send the appropriate part of it to the - * output file as a PCL raster graphics command. - */ -static void -PclMonoPixmapFragment(FILE *outFile, - PixmapPtr pix, - short x1, - short y1, - short x2, - short y2, - short dstx, - short dsty) -{ - char *bits, t[80], *row; - int h, w, i; - - /* - * Create a storage area large enough to hold the entire pixmap, - * then use fbGetImage to get the appropriate bits. - */ - h = y2 - y1; - w = BitmapBytePad( x2 - x1 ); - - bits = (char *)xalloc( h * w ); - fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, - XYPixmap, ~0, bits ); - - /* - * Move the cursor to the appropriate place on the page. We have - * to jump into HP-GL/2 to do this correctly, then go back to PCL - * for the actual drawing. - */ - sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty ); - SEND_PCL( outFile, t ); - - /* - * Now, wrap the raster in the appropriate PCL code. Right now, - * it's going to go down the wire without any compression. That - * will have to be good enough for the sample implementation. - */ - sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M", - h, x2 - x1 ); - SEND_PCL( outFile, t ); - - sprintf( t, "\033*b%dW", w ); - for( row = bits, i = 0; i <= h; i++, row += w ) - { - SEND_PCL( outFile, t ); - SEND_PCL_COUNT( outFile, row, w ); - } - - SEND_PCL( outFile, "\033*rC" ); - - /* - * Clean things up a bit - */ - xfree( bits ); -} - -static void -PclColorPixmapFragment(FILE *outFile, - PixmapPtr pix, - short x1, - short y1, - short x2, - short y2, - short dstx, - short dsty) -{ - char *bits, t[80], *row; - int h, w, i; - - /* - * Create a storage area large enough to hold the entire pixmap, - * then use fbGetImage to get the appropriate bits. - */ - h = y2 - y1; - w = PixmapBytePad( x2 - x1, pix->drawable.depth ); - - bits = (char *)xalloc( h * w ); - fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, ZPixmap, ~0, bits ); - - /* - * Move the cursor to the appropriate place on the page. We have - * to jump into HP-GL/2 to do this correctly, then go back to PCL - * for the actual drawing. - */ - sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty ); - SEND_PCL( outFile, t ); - - /* - * Now, wrap the raster in the appropriate PCL code. Right now, - * it's going to go down the wire without any compression. That - * will have to be good enough for the sample implementation. - */ - sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M", - h, x2 - x1 ); - SEND_PCL( outFile, t ); - - sprintf( t, "\033*b%dW", w ); - for( row = bits, i = 0; i < h; i++, row += w ) - { - SEND_PCL( outFile, t ); - SEND_PCL_COUNT( outFile, row, w ); - } - - SEND_PCL( outFile, "\033*rC" ); - - /* - * Clean things up a bit - */ - xfree( bits ); -} - -RegionPtr -PclCopyArea(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty) -{ - PixmapPtr pixSrc = (PixmapPtr)pSrc; -/* - FILE *srcFile; - GC srcGC; -*/ - FILE *dstFile; - GC dstGC; - unsigned long valid; - RegionPtr drawRegion, region, whole, ret; - BoxRec box; - BoxPtr prect; - int nrect; - void (*doFragment)(FILE *, PixmapPtr, short, short, short, short, - short, short ); - - /* - * Since we don't store any information on a per-window basis, we - * can't copy from a window. - */ - if( pSrc->type == DRAWABLE_WINDOW ) - return NULL; - - /* - * If we're copying from a pixmap to a pixmap, we just use the - * fb code to do the work. - */ - if( pDst->type == DRAWABLE_PIXMAP ) - fbCopyArea( pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty ); - -/* - PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile ); -*/ - PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile ); - - /* - * If we're copying to a window, we have to do some actual - * drawing, instead of just handing it off to fb. Start - * by determining the region that will be drawn. - */ - box.x1 = srcx; - box.y1 = srcy; - box.x2 = srcx + width; - box.y2 = srcy + height; - drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 ); - REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty ); - - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - - /* - * Now select the operation to be performed on each box in the - * region. - */ - if( pSrc->depth == 1 ) - doFragment = PclMonoPixmapFragment; - else - doFragment = PclColorPixmapFragment; - - /* - * Actually draw each section of the bitmap. - */ - nrect = REGION_NUM_RECTS( region ); - prect = REGION_RECTS( region ); - - while( nrect ) - { - (*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx, - prect->y1 - dsty, prect->x2 - dstx, - prect->y2 - dsty, prect->x1, prect->y1 ); - - nrect--; - prect++; - } - - /* - * Update the destination's GC to the source's GC. - */ -/* - PclSetDrawablePrivateGC( pDst, srcGC ); -*/ - - /* - * Determine the region that needs to be returned. This is the - * region of the source that falls outside the boundary of the - * pixmap. - */ - box.x1 = 0; - box.y1 = 0; - box.x2 = pixSrc->drawable.width; - box.y2 = pixSrc->drawable.height; - whole = REGION_CREATE( pGC->pScreen, &box, 0 ); - ret = REGION_CREATE( pGC->pScreen, NULL, 0 ); - - REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty ); - REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole ); - - /* - * Clean up the regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - REGION_DESTROY( pGC->pScreen, whole ); - - if( REGION_NOTEMPTY( pGC->pScreen, ret ) ) - return ret; - else - { - REGION_DESTROY( pGC->pScreen, ret ); - return NULL; - } -} - -RegionPtr -PclCopyPlane(DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, - int srcy, - int width, - int height, - int dstx, - int dsty, - unsigned long plane) -{ - RegionPtr reg; - GCPtr scratchGC; - PixmapPtr scratchPix; - - /* - * Since we don't store PCL on a per-window basis, there's no good - * way to copy from a window. - */ - if( pSrc->type == DRAWABLE_WINDOW ) - return NULL; - - /* Copying from a pixmap to a pixmap is already implemented by fb. */ - if( pSrc->type == DRAWABLE_PIXMAP && - pDst->type == DRAWABLE_PIXMAP ) - fbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width, height, - dstx, dsty, plane ); - - /* - * We can use fbCopyPlane to do the work of grabbing the plane and - * converting it to the desired visual. Once that's done, we already - * know how to do a CopyArea. - */ - scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width, - height, pDst->depth, - CREATE_PIXMAP_USAGE_SCRATCH ); - - scratchGC = GetScratchGC( pDst->depth, pDst->pScreen ); - CopyGC( pGC, scratchGC, ~0L ); - - fbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix ); - fbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC, - srcx, srcy, width, height, 0, 0, plane ); - - reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width, - height, dstx, dsty ); - - FreeScratchGC( scratchGC ); - - (*pDst->pScreen->DestroyPixmap)( scratchPix ); - - return reg; -} diff --git a/hw/xprint/pcl/PclAttVal.c b/hw/xprint/pcl/PclAttVal.c deleted file mode 100644 index f0f204764..000000000 --- a/hw/xprint/pcl/PclAttVal.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Pcl.h" -#include "AttrValid.h" - -/* - * define valid values and defaults for Printer pool - */ -static XpOid ValidContentOrientationsOids[] = { - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape, - xpoid_val_content_orientation_reverse_portrait, - xpoid_val_content_orientation_reverse_landscape -}; -static XpOidList ValidContentOrientations = { - ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids) -}; - -static XpOid DefaultContentOrientationsOids[] = { - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape -}; -static XpOidList DefaultContentOrientations = { - DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids) -}; - -static XpOid ValidPlexesOids[] = { - xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble -}; -static XpOidList ValidPlexes = { - ValidPlexesOids, XpNumber(ValidPlexesOids) -}; - -static XpOid DefaultPlexesOids[] = { - xpoid_val_plex_simplex -}; -static XpOidList DefaultPlexes = { - DefaultPlexesOids, XpNumber(DefaultPlexesOids) -}; - -static unsigned long ValidPrinterResolutionsCards[] = { - 300 -}; -static XpOidCardList ValidPrinterResolutions = { - ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards) -}; - -static unsigned long DefaultPrinterResolutionsCards[] = { - 300 -}; -static XpOidCardList DefaultPrinterResolutions = { - DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards) -}; - -static XpOid ValidListfontsModesOids[] = { - xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts -}; -static XpOidList ValidListfontsModes = { - ValidListfontsModesOids, XpNumber(ValidListfontsModesOids) -}; - -static XpOid DefaultListfontsModesOids[] = { - xpoid_val_xp_list_glyph_fonts -}; -static XpOidList DefaultListfontsModes = { - DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids) -}; - -static XpOid ValidSetupProvisoOids[] = { - xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional -}; -static XpOidList ValidSetupProviso = { - - - ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids) -}; - -static XpOidDocFmt ValidDocFormatsSupportedFmts[] = { - { "PCL", "5", NULL }, -}; -static XpOidDocFmtList ValidDocFormatsSupported = { - ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = { - { "PCL", "5", NULL } -}; -static XpOidDocFmtList DefaultDocFormatsSupported = { - DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts) -}; - -static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = { - { "HPGL", "2", NULL }, -}; -static XpOidDocFmtList ValidEmbeddedFormatsSupported = { - ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = { - { "HPGL", "2", NULL } -}; -static XpOidDocFmtList DefaultEmbeddedFormatsSupported = { - DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts) -}; - -static XpOidDocFmt ValidRawFormatsSupportedFmts[] = { - { "PCL", "5", NULL }, - { "Postscript", "2", NULL }, - { "ASCII", NULL, NULL } - -}; -static XpOidDocFmtList ValidRawFormatsSupported = { - ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = { - { "PCL", "5", NULL } -}; -static XpOidDocFmtList DefaultRawFormatsSupported = { - DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts) -}; - -static XpOid ValidInputTraysOids[] = { - xpoid_val_input_tray_manual, - xpoid_val_input_tray_main, - xpoid_val_input_tray_envelope, - xpoid_val_input_tray_large_capacity, - xpoid_val_input_tray_bottom -}; -static XpOidList ValidInputTrays = { - ValidInputTraysOids, XpNumber(ValidInputTraysOids) -}; - -static XpOid ValidMediumSizesOids[] = { - xpoid_val_medium_size_iso_a3, - xpoid_val_medium_size_iso_a4, - xpoid_val_medium_size_na_letter, - xpoid_val_medium_size_na_legal, - xpoid_val_medium_size_executive, - xpoid_val_medium_size_ledger, - xpoid_val_medium_size_iso_c5, - xpoid_val_medium_size_iso_designated_long, - xpoid_val_medium_size_na_number_10_envelope, - xpoid_val_medium_size_monarch_envelope, - xpoid_val_medium_size_jis_b5, -}; -static XpOidList ValidMediumSizes = { - ValidMediumSizesOids, XpNumber(ValidMediumSizesOids) -}; - -static XpOidDocFmt DefaultDocumentFormat = { - "PCL", "5", NULL -}; - - -/* - * init struct for XpValidate*Pool - */ -XpValidatePoolsRec PclValidatePoolsRec = { - &ValidContentOrientations, &DefaultContentOrientations, - &ValidDocFormatsSupported, &DefaultDocFormatsSupported, - &ValidInputTrays, &ValidMediumSizes, - &ValidPlexes, &DefaultPlexes, - &ValidPrinterResolutions, &DefaultPrinterResolutions, - &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported, - &ValidListfontsModes, &DefaultListfontsModes, - &ValidRawFormatsSupported, &DefaultRawFormatsSupported, - &ValidSetupProviso, - &DefaultDocumentFormat -}; diff --git a/hw/xprint/pcl/PclAttr.c b/hw/xprint/pcl/PclAttr.c deleted file mode 100644 index b27bf4fce..000000000 --- a/hw/xprint/pcl/PclAttr.c +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclAttr.c -** * -** * Contents: -** * Attribute-handling functions for the PCL driver -** * -** * Created: 2/2/96 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Pcl.h" -#include "attributes.h" - -char * -PclGetAttributes( - XpContextPtr pCon, - XPAttributes pool ) -{ - return XpGetAttributes( pCon, pool ); -} - -char * -PclGetOneAttribute( - XpContextPtr pCon, - XPAttributes pool, - char *attr ) -{ - return XpGetOneAttribute( pCon, pool, attr ); -} -int -PclAugmentAttributes( - XpContextPtr pCon, - XPAttributes pool, - char *attrs ) -{ - return XpAugmentAttributes( pCon, pool, attrs ); -} - -int -PclSetAttributes( - XpContextPtr pCon, - XPAttributes pool, - char *attrs ) -{ - return XpSetAttributes( pCon, pool, attrs ); -} diff --git a/hw/xprint/pcl/PclColor.c b/hw/xprint/pcl/PclColor.c deleted file mode 100644 index 5e8ffa63c..000000000 --- a/hw/xprint/pcl/PclColor.c +++ /dev/null @@ -1,851 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclColorInit.c -** * -** * Contents: -** * Colormap handing code of Pcl driver for the -** * print server. -** * -** * Created: 4/8/96 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> -#include <math.h> - -#include "colormapst.h" -#include "windowstr.h" -#include "resource.h" - -#include "Pcl.h" -#include "fb.h" - -static void lookup(unsigned char *src, - unsigned char *dst, - int num, - unsigned char *map, - int dim); -static void trilinear(unsigned char *p, - unsigned char *out, - unsigned char *d, - int dim, - unsigned char def); - - -/* - * This seems to be (and is) a duplication of effort; one would think - * that fbCreateDefColormap would be sufficient. It almost is. The - * only change made in this function is that the black and white pixels - * are allocated with three separate variables for red, green and blue - * values, instead of the single variable in fbCreateDefColormap. The - * single variable leads to the one value being corrected by - * ResolveColor three times, which leads to incorrect colors. - */ - -Bool -PclCreateDefColormap(ScreenPtr pScreen) -{ - unsigned short wp_red = ~0, wp_green = ~0, wp_blue = ~0; - unsigned short bp_red = 0, bp_green = 0, bp_blue = 0; - VisualPtr pVisual; - ColormapPtr cmap; - Pixel wp, bp; - - for (pVisual = pScreen->visuals; - pVisual->vid != pScreen->rootVisual; - pVisual++) - ; - - if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap, - (pVisual->class & DynamicClass) ? AllocNone : AllocAll, - 0) - != Success) - return FALSE; - wp = pScreen->whitePixel; - bp = pScreen->blackPixel; - if ((AllocColor(cmap, &wp_red, &wp_green, &wp_blue, &wp, 0) != - Success) || - (AllocColor(cmap, &bp_red, &bp_green, &bp_blue, &bp, 0) != - Success)) - return FALSE; - - pScreen->whitePixel = wp; - pScreen->blackPixel = bp; - - (*pScreen->InstallColormap)(cmap); - return TRUE; -} - -/* - * Add colormap to list of colormaps on screen - */ -Bool -PclCreateColormap(ColormapPtr pColor) -{ - PclCmapToContexts *new; - PclScreenPrivPtr sPriv; - - sPriv = (PclScreenPrivPtr) - dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); - - /* - * Use existing code to initialize the values in the colormap - */ - fbInitializeColormap( pColor ); - - /* - * Set up the mapping between the color map and the context - */ - new = (PclCmapToContexts *)xalloc( sizeof( PclCmapToContexts ) ); - - if( new ) - { - new->colormapId = pColor->mid; - new->contexts = NULL; - new->next = sPriv->colormaps; - sPriv->colormaps = new; - - return TRUE; - } - else - return FALSE; -} - -void -PclDestroyColormap(ColormapPtr pColor) -{ - PclScreenPrivPtr sPriv; - PclCmapToContexts *pCmap, *tCmap = 0; - PclContextListPtr con, tCon; - PclContextPrivPtr cPriv; - PclPaletteMapPtr pPal; - char t[80]; - - /* - * At DestroyContext time, colormaps may be destroyed twice, so if the - * pointer is NULL, just crash out. - */ - if( !pColor ) - return; - - /* - * Find the colormap <-> contexts mapping - */ - sPriv = (PclScreenPrivPtr) - dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); - pCmap = sPriv->colormaps; - while( pCmap ) - { - if( pCmap->colormapId == pColor->mid ) - break; - tCmap = pCmap; - pCmap = pCmap->next; - } - - /* - * For each context, delete the palette in the printer and - * free the mapping. - */ - if( pCmap ) - { - con = pCmap->contexts; - while( con ) - { - cPriv = dixLookupPrivate(&con->context->devPrivates, - PclContextPrivateKey); - pPal = cPriv->palettes; - while( pPal ) - { - if( pPal->colormapId == pColor->mid ) - break; - pPal = pPal->next; - } - - if( cPriv->pPageFile ) - { - sprintf( t, "\033&p%dI\033*p2C", pPal->paletteId ); - SEND_PCL( cPriv->pPageFile, t ); - } - - tCon = con; - con = con->next; - xfree( tCon ); - } - - /* - * Delete the colormap<->contexts mapping - */ - if( sPriv->colormaps == pCmap ) - /* Delete from the front */ - sPriv->colormaps = pCmap->next; - else - /* Delete from the middle */ - tCmap->next = pCmap->next; - free( pCmap ); - } -} - -void -PclInstallColormap(ColormapPtr pColor) -{ -} - -void -PclUninstallColormap(ColormapPtr pColor) -{ -} - -int -PclListInstalledColormaps(ScreenPtr pScreen, - XID *pCmapList) -{ - return 0; -} - -void -PclStoreColors(ColormapPtr pColor, - int ndef, - xColorItem *pdefs) -{ - PclCmapToContexts *p; - PclScreenPrivPtr sPriv; - PclContextListPtr con; - PclContextPrivPtr cPriv; - PclPaletteMapPtr pMap; - char t[80]; - int i; - - sPriv = (PclScreenPrivPtr) - dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); - p = sPriv->colormaps; - while( p ) - { - if( p->colormapId == pColor->mid ) - break; - p = p->next; - } - - if( p ) - { - con = p->contexts; - while( con ) - { - /* - * For each context, get the palette ID and update the - * appropriate palette. - */ - cPriv = dixLookupPrivate(&con->context->devPrivates, - PclContextPrivateKey); - pMap = PclFindPaletteMap( cPriv, pColor, NULL ); - - /* - * Update the palette - */ - sprintf( t, "\033&p%dS", pMap->paletteId ); - SEND_PCL( cPriv->pPageFile, t ); - - if( pColor->class == PseudoColor ) - { - unsigned short r, g, b; - unsigned int pID; - for( i = 0; i < ndef; i++ ) - { - pID = pdefs[i].pixel; - if ( pColor->red[i].fShared ) - { - r = pColor->red[pID].co.shco.red->color; - g = pColor->red[pID].co.shco.green->color; - b = pColor->red[pID].co.shco.blue->color; - } - else - { - r = pColor->red[pID].co.local.red; - g = pColor->red[pID].co.local.green; - b = pColor->red[pID].co.local.blue; - } - - if( pdefs[i].flags & DoRed ) - r = pdefs[i].red; - if( pdefs[i].flags & DoGreen ) - g = pdefs[i].green; - if( pdefs[i].flags & DoBlue ) - b = pdefs[i].blue; - PclLookUp(pColor, cPriv, &r, &g, &b); - sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, pID); - SEND_PCL( cPriv->pPageFile, t ); - } - } - - sprintf( t, "\033&p%dS", cPriv->currentPalette ); - SEND_PCL( cPriv->pPageFile, t ); - - con = con->next; - } - } -} - -void -PclResolveColor(unsigned short *pRed, - unsigned short *pGreen, - unsigned short *pBlue, - VisualPtr pVisual) -{ - /* - * We need to map the X color range of [0,65535] to the PCL color - * range of [0,32767]. - */ - *pRed >>= 1; - *pGreen >>= 1; - *pBlue >>= 1; -} - -PclPaletteMapPtr -PclFindPaletteMap(PclContextPrivPtr cPriv, - ColormapPtr cmap, - GCPtr gc) -{ - PclPaletteMapPtr p = cPriv->palettes, new; - - /* - * If the colormap is static, grab one of the special palettes. If we come - * into this from StoreColors, there will be no GC, but by definition we're - * looking at a dynamic color map, so the special colors will not be - * needed. - */ - if( gc ) - { - if( cmap->pVisual->class == StaticGray ) - return &( cPriv->staticGrayPalette ); - else if( cmap->pVisual->class == TrueColor ) - { - if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) ) - return &( cPriv->specialTrueColorPalette ); - else - return &( cPriv->trueColorPalette ); - } - } - - - /* Look for the colormap ID <-> palette ID mapping */ - while( p ) - { - if( p->colormapId == cmap->mid ) - return p; - p = p->next; - } - - /* If the colormap isn't already there, make an entry for it */ - new = (PclPaletteMapPtr)xalloc( sizeof( PclPaletteMap ) ); - new->colormapId = cmap->mid; - new->paletteId = cPriv->nextPaletteId++; - new->downloaded = 0; - new->next = cPriv->palettes; - cPriv->palettes = new; - return new; -} - -int -PclUpdateColormap(DrawablePtr pDrawable, - XpContextPtr pCon, - GCPtr gc, - FILE *outFile) -{ - PclScreenPrivPtr sPriv; - - PclContextPrivPtr cPriv; - PclPaletteMapPtr pMap; - PclCmapToContexts *pCmap; - PclContextListPtr new; - char t[80]; - Colormap c; - ColormapPtr cmap; - WindowPtr win = (WindowPtr)pDrawable; - unsigned short r, g, b, rr, gg, bb; - int i; - - cPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - c = wColormap( win ); - cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP ); - pMap = PclFindPaletteMap( cPriv, cmap, gc ); - - if( cPriv->currentPalette == pMap->paletteId ) - /* - * If the requested colormap is already active, nothing needs to - * be done. - */ - return FALSE; - - /* - * Now we activate the palette in the printer - */ - sprintf( t, "\033&p%dS", pMap->paletteId ); - SEND_PCL( outFile, t ); - cPriv->currentPalette = pMap->paletteId; - - if( pMap->downloaded == 0 ) - /* - * If the requested colormap has not been downloaded to the - * printer, we need to do that before activating it. - */ - { - /* - * Add the colormap to the screen-level colormap<->context mapping. - */ - sPriv = (PclScreenPrivPtr) - dixLookupPrivate(&cmap->pScreen->devPrivates, - PclScreenPrivateKey); - pCmap = sPriv->colormaps; - while( pCmap && ( pCmap->colormapId != cmap->mid ) ) - pCmap = pCmap->next; - new = (PclContextListPtr)xalloc( sizeof( PclContextList ) ); - new->context = pCon; - new->next = pCmap->contexts; - pCmap->contexts = new; - - /* - * XXX Download the colormap - */ - if( cmap->class == StaticGray ) - { -#ifdef XP_PCL_COLOR - sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1, 1, 1, 1, 1 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 12 ); - - /* Send the white reference point... */ - sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff, - 0x7f, 0xff ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* ... and the black reference point */ - sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* Now program the two colors */ - sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel ); - SEND_PCL( cPriv->pPageFile, t ); - sprintf( t, "\033*v32767a32767b32767c%ldI", - (long) cmap->pScreen->whitePixel ); - SEND_PCL( cPriv->pPageFile, t ); -#endif /* XP_PCL_COLOR */ - } - else if( cmap->class == PseudoColor ) - { - sprintf( t, - "\033*v18W%c%c%c%c%c%c", - 0, 1, cmap->pVisual->nplanes, 16, 16, 16 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 12 ); - - /* Send the white reference point... */ - if ( cPriv->ctbl != NULL ) - sprintf( t, "%c%c%c%c%c%c", 0x00, 0xff, 0x00, 0xff, - 0x00, 0xff ); - else - sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff, - 0x7f, 0xff ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* ... and the black reference point */ - sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - for(i = 0; i < cmap->pVisual->ColormapEntries; i++ ) - { - if( cmap->red[i].fShared ) - { - r = cmap->red[i].co.shco.red->color; - g = cmap->red[i].co.shco.green->color; - b = cmap->red[i].co.shco.blue->color; - } - else - { - r = cmap->red[i].co.local.red; - g = cmap->red[i].co.local.green; - b = cmap->red[i].co.local.blue; - } - PclLookUp(cmap, cPriv, &r, &g, &b); - sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, i ); - SEND_PCL( outFile, t ); - } - } - else if( cmap->class == TrueColor ) - { - unsigned short lim; - - if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) ) - { - if( cPriv->ctbl != NULL ) - { - /* Send the "special" colormap for 24-bit fills */ - sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1, - 8, - cmap->pVisual->bitsPerRGBValue, - cmap->pVisual->bitsPerRGBValue, - cmap->pVisual->bitsPerRGBValue ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 12 ); - - /* Send the white reference point... */ - sprintf( t, "%c%c%c%c%c%c", - 0x00, 0xff, - 0x00, 0xff, - 0x00, 0xff ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* ... and the black reference point */ - sprintf( t, "%c%c%c%c%c%c", - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* Now send the color entries, RRRGGGBB */ - i=0; - for( r = 0; r < 8; r++ ) - for( g = 0; g < 8; g ++ ) - for( b = 0; b < 4; b++ ) - { - rr = (r * 0xff)/7; - gg = (g * 0xff)/7; - bb = (b * 0xff)/3; - PclLookUp(cmap, cPriv, &rr, &gg, &bb); - sprintf( t, "\033*v%ua%ub%uc%dI", - rr, gg, bb, i ); - SEND_PCL( outFile, t ); - i++; - } - } - else - { - /* Send the "special" colormap for 24-bit fills */ - sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1, - 8, - cmap->pVisual->bitsPerRGBValue, - cmap->pVisual->bitsPerRGBValue, - cmap->pVisual->bitsPerRGBValue ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 12 ); - - /* Send the white reference point... */ - sprintf( t, "%c%c%c%c%c%c", - 0x00, 0x07, - 0x00, 0x07, - 0x00, 0x03 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* ... and the black reference point */ - sprintf( t, "%c%c%c%c%c%c", - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* Now send the color entries, RRRGGGBB */ - i=0; - for( r = 0; r < 8; r++ ) - for( g = 0; g < 8; g ++ ) - for( b = 0; b < 4; b++ ) - { - sprintf( t, "\033*v%ua%ub%uc%dI", - r, g, b, i ); - SEND_PCL( outFile, t ); - i++; - } - } - - } - else - { - lim = (1 << cmap->pVisual->bitsPerRGBValue) - 1; - - /* Send the "special" colormap for 24-bit fills */ - sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 3, - cmap->pVisual->nplanes, - cmap->pVisual->bitsPerRGBValue, - cmap->pVisual->bitsPerRGBValue, - cmap->pVisual->bitsPerRGBValue ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 12 ); - - /* Send the white reference point... */ - sprintf( t, "%c%c%c%c%c%c", - (lim >> 8) & 0xff, lim & 0xff, - (lim >> 8) & 0xff, lim & 0xff, - (lim >> 8) & 0xff, lim & 0xff); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - - /* ... and the black reference point */ - sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 ); - SEND_PCL_COUNT( cPriv->pPageFile, t, 6 ); - } - - } - pMap->downloaded = 1; - } - return TRUE; - -} - -void PclLookUp( - ColormapPtr cmap, - PclContextPrivPtr cPriv, - unsigned short *r, - unsigned short *g, - unsigned short *b -) -{ - unsigned char cdata[3]; - - if( cmap->class == PseudoColor ) - { - if( cPriv->ctbl != NULL ) - { - cdata[0] = *r >> 8; - cdata[1] = *g >> 8; - cdata[2] = *b >> 8; - lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim); - *r = cdata[0]; - *g = cdata[1]; - *b = cdata[2]; - } - else - { - *r >>= 1; - *g >>= 1; - *b >>= 1; - } - } - else if( cmap->class == TrueColor ) - { - if( cPriv->ctbl != NULL ) - { - cdata[0] = *r; - cdata[1] = *g; - cdata[2] = *b; - lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim); - *r = cdata[0]; - *g = cdata[1]; - *b = cdata[2]; - } - } - return; -} - -unsigned char *PclReadMap(char *name, int *dim) -{ - FILE *fp; - unsigned char *data; - long size; - - if ((fp=fopen(name, "r")) == NULL) { - return(NULL); - } - - fseek(fp, 0, SEEK_END); - size = ftell(fp); - - /* Could do this with a lookup table, if the constraint is that the - 3 map dimensions must be equal. */ - switch (size) { - case 8*8*8*3: - *dim = 8; - break; - case 16*16*16*3: - *dim = 16; - break; - case 17*17*17*3: - *dim = 17; - break; - case 65*65*65*3: - *dim = 65; - break; - default: - fclose(fp); - return(NULL); - } - - if ((data = (unsigned char *) xalloc(sizeof(char) * size)) == NULL) { - fclose(fp); - return(NULL); - } - - fseek(fp, 0, SEEK_SET); - - if (fread(data, sizeof(char), size, fp) != (unsigned) size) { - fclose(fp); - free(data); - return(NULL); - } - - fclose(fp); - return(data); -} - -/************************************************************************ - * - * Here is the mapper. - * - ************************************************************************/ - -#define SCL(x) ((x)*(dim-1)/255) -/* Interleaved-map lookup */ -static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim) -{ - int i; - -#define _INTERPOLATE -#ifndef _INTERPOLATE - unsigned char *p1, *p2, *p3; - - for (i=0; i<num; i++) { - p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3; - *dst++ = *p1++; - *dst++ = *p1++; - *dst++ = *p1++; - src += 3; - } -#else - for (i=0; i<num; i++) { - trilinear(src, dst, map, dim, 128); - src += 3; - dst += 3; - } -#endif -} - -/* - * C code from the article - * "Tri-linear Interpolation" - * by Steve Hill, sah@ukc.ac.uk - * in "Graphics Gems IV", Academic Press, 1994 - * - * Fri Feb 16 14:12:43 PST 1996 - * Modified to use for 8-bit color mapping -- A. Fitzhugh, - * HP Labs, Printing Technology Department - */ - -/* linear interpolation from l (when a=0) to h (when a=1)*/ -/* (equal to (a*h)+((1-a)*l) */ -#define LERP(a,l,h) ((l)+((((h)-(l))*(a))>>8)) - -static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, int dim, unsigned char def) -{ -#define DENS(X, Y, Z, ch) d[((X*dim+Y)*dim+Z)*3+ch] - - int x0, y0, z0, - x1, y1, z1, - i; - unsigned char *dp, - fx, fy, fz, - d000, d001, d010, d011, - d100, d101, d110, d111, - dx00, dx01, dx10, dx11, - dxy0, dxy1; - float scale; - - scale = 255.0 / (dim-1); - - x0 = p[0] / scale; - y0 = p[1] / scale; - z0 = p[2] / scale; - - /* Fractions should range from 0-1.0 (fixed point 8-256) */ - fx = (((int) (p[0] - x0 * scale)) << 8) / 255; - fy = (((int) (p[1] - y0 * scale)) << 8) / 255; - fz = (((int) (p[2] - z0 * scale)) << 8) / 255; - - x1 = x0 + 1; - y1 = y0 + 1; - z1 = z0 + 1; - - for (i=0; i<3; i++) { - - if (x0 >= 0 && x1 < dim && - y0 >= 0 && y1 < dim && - z0 >= 0 && z1 < dim) { - dp = &DENS(x0, y0, z0, i); - d000 = dp[0]; - d100 = dp[3]; - dp += dim*3; - d010 = dp[0]; - d110 = dp[3]; - dp += dim*dim*3; - d011 = dp[0]; - d111 = dp[3]; - dp -= dim*3; - d001 = dp[0]; - d101 = dp[3]; - } else { -# define INRANGE(X, Y, Z) \ - ((X) >= 0 && (X) < dim && \ - (Y) >= 0 && (Y) < dim && \ - (Z) >= 0 && (Z) < dim) - - d000 = INRANGE(x0, y0, z0) ? DENS(x0, y0, z0, i) : def; - d001 = INRANGE(x0, y0, z1) ? DENS(x0, y0, z1, i) : def; - d010 = INRANGE(x0, y1, z0) ? DENS(x0, y1, z0, i) : def; - d011 = INRANGE(x0, y1, z1) ? DENS(x0, y1, z1, i) : def; - - d100 = INRANGE(x1, y0, z0) ? DENS(x1, y0, z0, i) : def; - d101 = INRANGE(x1, y0, z1) ? DENS(x1, y0, z1, i) : def; - d110 = INRANGE(x1, y1, z0) ? DENS(x1, y1, z0, i) : def; - d111 = INRANGE(x1, y1, z1) ? DENS(x1, y1, z1, i) : def; - } - - dx00 = LERP(fx, d000, d100); - dx01 = LERP(fx, d001, d101); - dx10 = LERP(fx, d010, d110); - dx11 = LERP(fx, d011, d111); - - dxy0 = LERP(fy, dx00, dx10); - dxy1 = LERP(fy, dx01, dx11); - - out[i] = LERP(fz, dxy0, dxy1); - } -} - diff --git a/hw/xprint/pcl/PclCursor.c b/hw/xprint/pcl/PclCursor.c deleted file mode 100644 index a3eeb1610..000000000 --- a/hw/xprint/pcl/PclCursor.c +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclCursor.c -** * -** * Contents: -** * Cursor-handling code for the PCL DDX driver -** * -** * Created: 1/18/96 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> - -#include "Pcl.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PclConstrainCursor( - ScreenPtr pScreen, - BoxPtr pBox) -{ -} - -void -PclCursorLimits( - ScreenPtr pScreen, - CursorPtr pCursor, - BoxPtr pHotBox, - BoxPtr pTopLeftBox) -{ -} - -Bool -PclDisplayCursor( - ScreenPtr pScreen, - CursorPtr pCursor) -{ - return True; -} - -Bool -PclRealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor) -{ - return True; -} - -Bool -PclUnrealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor) -{ - return True; -} - -void -PclRecolorCursor( - ScreenPtr pScreen, - CursorPtr pCursor, - Bool displayed) -{ -} - -Bool -PclSetCursorPosition( - ScreenPtr pScreen, - int x, - int y, - Bool generateEvent) -{ - return True; -} diff --git a/hw/xprint/pcl/PclDef.h b/hw/xprint/pcl/PclDef.h deleted file mode 100644 index dcd54c4fe..000000000 --- a/hw/xprint/pcl/PclDef.h +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclDef.h -** * -** * Contents: extran defines and includes for the Pcl driver -** * for a printing X server. -** * -** * Created: 7/31/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _PCLDEF_H_ -#define _PCLDEF_H_ - -#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER" -#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER" -#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND" -#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND" -#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION" -#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER" -#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER" -#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND" - -#define DT_IN_FILE_STRING "%(InFile)%" -#define DT_OUT_FILE_STRING "%(OutFile)%" -#define DT_ALLOWED_COMMANDS_FILE "printCommands" - -#endif /* _PCLDEF_H_ */ diff --git a/hw/xprint/pcl/PclFonts.c b/hw/xprint/pcl/PclFonts.c deleted file mode 100644 index 9e993f79c..000000000 --- a/hw/xprint/pcl/PclFonts.c +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclFonts.c -** * -** * Contents: -** * Font code for Pcl driver. -** * -** * Created: 2/03/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "regionstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" -#include "scrnintstr.h" - -#include "Pcl.h" - -Bool -PclRealizeFont( - ScreenPtr pscr, - FontPtr pFont) -{ - return TRUE; -} - -Bool -PclUnrealizeFont( - ScreenPtr pscr, - FontPtr pFont) -{ - return TRUE; -} diff --git a/hw/xprint/pcl/PclGC.c b/hw/xprint/pcl/PclGC.c deleted file mode 100644 index fbadf5d5d..000000000 --- a/hw/xprint/pcl/PclGC.c +++ /dev/null @@ -1,971 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclGC.c -** * -** * Contents: -** * Graphics Context handling for the PCL driver -** * -** * Created: 10/11/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "gcstruct.h" - -#include "Pcl.h" -#include "pixmapstr.h" -#include "colormapst.h" -#include "windowstr.h" -#include "fb.h" -#include "scrnintstr.h" -#include "resource.h" - -static GCOps PclGCOps = -{ - PclFillSpans, - PclSetSpans, - PclPutImage, - PclCopyArea, - PclCopyPlane, - PclPolyPoint, - PclPolyLine, - PclPolySegment, - PclPolyRectangle, - PclPolyArc, - PclFillPolygon, - PclPolyFillRect, - PclPolyFillArc, - PclPolyText8, - PclPolyText16, - PclImageText8, - PclImageText16, - PclImageGlyphBlt, - PclPolyGlyphBlt, - PclPushPixels -} -; - - -static GCFuncs PclGCFuncs = -{ - PclValidateGC, - miChangeGC, - miCopyGC, - PclDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip, -} -; - -Bool -PclCreateGC(GCPtr pGC) -{ - if (fbCreateGC(pGC) == FALSE) - return FALSE; - - pGC->clientClip = NULL; - pGC->clientClipType = CT_NONE; - - pGC->ops = &PclGCOps; - pGC->funcs = &PclGCFuncs; - - return TRUE; -} - -void -PclDestroyGC(GCPtr pGC) -{ - /* fb doesn't specialize DestroyGC */ - miDestroyGC( pGC ); -} - - -int -PclGetDrawablePrivateStuff( - DrawablePtr pDrawable, - GC *gc, - unsigned long *valid, - FILE **file) -{ - XpContextPtr pCon; - PclContextPrivPtr cPriv; - - switch( pDrawable->type ) - { - case DRAWABLE_PIXMAP: - /* - * If we ever get here, something is wrong. - */ - return FALSE; - - case DRAWABLE_WINDOW: - pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - - if( pCon == NULL ) - return FALSE; - else - { - cPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - *gc = cPriv->lastGC; - *valid = cPriv->validGC; - *file = cPriv->pPageFile; - return TRUE; - } - - default: - return FALSE; - } -} - -void -PclSetDrawablePrivateGC( - DrawablePtr pDrawable, - GC gc) -{ - PixmapPtr pix; - XpContextPtr pCon; - PclPixmapPrivPtr pixPriv; - PclContextPrivPtr pPriv; - int i; - - switch( pDrawable->type ) - { - case DRAWABLE_PIXMAP: - pix = (PixmapPtr)pDrawable; - pixPriv = (PclPixmapPrivPtr) - dixLookupPrivate(&pix->devPrivates, PclPixmapPrivateKey); - - pixPriv->lastGC = gc; - pixPriv->validGC = 1; - break; - - case DRAWABLE_WINDOW: - pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - pPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - pPriv->validGC = 1; - pPriv->lastGC = gc; - - /* - * Store the dash list separately, to avoid having it freed - * out from under us. - */ - if( pPriv->dash != NULL ) - xfree( pPriv->dash ); - if( gc.numInDashList != 0 ) - { - pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char ) - * gc.numInDashList ); - for( i = 0; i < gc.numInDashList; i++ ) - pPriv->dash[i] = gc.dash[i]; - } - else - pPriv->dash = NULL; - - - /* - * Store the dash list separately, to avoid having it freed - * out from under us. - */ - if( pPriv->dash != NULL ) - xfree( pPriv->dash ); - if( gc.numInDashList != 0 ) - { - pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char ) - * gc.numInDashList ); - for( i = 0; i < gc.numInDashList; i++ ) - pPriv->dash[i] = gc.dash[i]; - } - else - pPriv->dash = NULL; - - break; - } -} - -static void -PclSendPattern(char *bits, - int sz, - int depth, - int h, - int w, - int patNum, - FILE *outFile) -{ - char t[80], *row, *mod; - int w2; - int i, j; - - SEND_PCL( outFile, "\033%0A" ); - - if( depth == 1 ) - { - /* Each row must be word-aligned */ - w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 ); -/* - if( w2 % 2 ) - w2++; -*/ - - sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 ); - SEND_PCL( outFile, t ); - - sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8, - w&0xff ); - SEND_PCL_COUNT( outFile, t, 8 ); - - for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) ) - SEND_PCL_COUNT( outFile, row, w2 ); - } - else if( depth == 8 ) - { - w2 = ( w % 2 ) ? w + 1 : w; - - sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 ); - SEND_PCL( outFile, t ); - - sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff, - w>>8, w&0xff ); - SEND_PCL_COUNT( outFile, t, 8 ); - - for( row = bits, i = 0; i < h; i++, - row += PixmapBytePad( w, 8 ) ) - SEND_PCL_COUNT( outFile, row, w2 ); - } - else - { - w2 = ( w % 2 ) ? w + 1 : w; - - sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 ); - SEND_PCL( outFile, t ); - - sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff, - w>>8, w&0xff ); - SEND_PCL_COUNT( outFile, t, 8 ); - - mod = (char *)xalloc( w2 ); - - for( row = bits, i = 0; i < h; i++, - row += PixmapBytePad( w, 24 ) ) - { - char r, g, b; - for( j = 0; j < w2; j++ ) { - r = ((row[j*4+1] >> 5) & 0x7) << 5; - g = ((row[j*4+2] >> 5) & 0x7) << 2; - b = ((row[j*4+3] >> 6) & 0x3); - mod[j] = r | g | b; - } - SEND_PCL_COUNT( outFile, mod, w2 ); - } - - xfree( mod ); - } - - SEND_PCL( outFile, "\033%0B" ); -} - -int -PclUpdateDrawableGC( - GCPtr pGC, - DrawablePtr pDrawable, - FILE **outFile) -{ - Mask changeMask = 0; - GC dGC; - unsigned long valid; - int i; - XpContextPtr pCon; - PclContextPrivPtr cPriv; - PclGCPrivPtr gcPriv = (PclGCPrivPtr) - dixLookupPrivate(&pGC->devPrivates, PclGCPrivateKey); - - if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) ) - return FALSE; - - pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - cPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - /* - * Here's where we update the colormap. Since there can be - * different colormaps installed on each window, we need to check - * before each drawing request that the correct palette is active in - * the printer. This is as good a place as any. - */ - if( !PclUpdateColormap( pDrawable, pCon, pGC, *outFile ) ) - return FALSE; - - /* - * If the drawable's last GC is NULL, this means that this is - * the first time the drawable is being used. Therefore, we need - * to emit PCL for all the GC fields. - */ - if( valid == 0 ) - changeMask = ~0; - - /* - * If we have two different GC structures, there is no alternative - * but to scan through them both to determine the changeMask. - */ - else - { - if( dGC.alu != pGC->alu ) - changeMask |= GCFunction; - if( dGC.fgPixel != pGC->fgPixel ) - changeMask |= GCForeground; - if( dGC.bgPixel != pGC->bgPixel ) - changeMask |= GCBackground; - if( dGC.lineWidth != pGC->lineWidth ) - changeMask |= GCLineWidth; - if( dGC.lineStyle != pGC->lineStyle ) - changeMask |= GCLineStyle; - if( dGC.capStyle != pGC->capStyle ) - changeMask |= GCCapStyle; - if( dGC.joinStyle != pGC->joinStyle ) - changeMask |= GCJoinStyle; - if( dGC.fillStyle != pGC->fillStyle ) - changeMask |= GCFillStyle; - if( dGC.tile.pixmap != pGC->tile.pixmap ) - changeMask |= GCTile; - if( dGC.stipple != pGC->stipple ) - changeMask |= GCStipple; - if( dGC.patOrg.x != pGC->patOrg.x ) - changeMask |= GCTileStipXOrigin; - if( dGC.patOrg.y != pGC->patOrg.y ) - changeMask |= GCTileStipYOrigin; - - if( dGC.numInDashList == pGC->numInDashList ) - { - for( i = 0; i < dGC.numInDashList; i++ ) - if( cPriv->dash[i] != pGC->dash[i] ) - { - changeMask |= GCDashList; - break; - } - } - else - changeMask |= GCDashList; - } - - /* - * Once the changeMask has been determined, we scan it and emit - * the appropriate PCL code to set the drawing attributes. - */ - - /* Must be in HP-GL/2 mode to set attributes */ - SEND_PCL( *outFile, "\033%0B" ); - - if( changeMask & GCFunction ) - { -#ifdef XP_PCL_COLOR - - if( pGC->alu == GXclear ) - SEND_PCL( *outFile, "SP0;" ); - else - SEND_PCL( *outFile, "SP1;" ); -#else - if( pGC->alu == GXclear ) - SEND_PCL( *outFile, "SP0;" ); - else - SEND_PCL( *outFile, "SP1;" ); -#endif /* XP_PCL_COLOR */ - } - -#if 0 - if( changeMask & GCFunction ) - { - int rop = -1; - char t[10]; - - switch( pGC->alu ) - { - case GXclear: - rop = 1; - break; - case GXand: - rop = 136; - break; - case GXandReverse: - rop = 68; - break; - case GXcopy: - rop = 204; - break; - case GXandInverted: - rop = 34; - break; - case GXnoop: - rop = 170; - break; - case GXxor: - rop = 238; - break; - case GXor: - rop = 238; - break; - case GXnor: - rop = 17; - break; - case GXequiv: - rop = 153; - break; - case GXinvert: - rop = 85; - break; - case GXorReverse: - rop = 221; - break; - case GXcopyInverted: - rop = 51; - break; - case GXorInverted: - rop = 187; - break; - case GXnand: - rop = 119; - break; - case GXset: - rop = 0; - break; - } - if( rop != -1 ) - { - sprintf( t, "MC1,%d;", rop ); - SEND_PCL( *outFile, t ); -#endif - - if( changeMask & GCForeground ) - switch( pGC->fgPixel ) - { - case 1: - SEND_PCL( *outFile, "SP1;" ); - break; - default: - SEND_PCL( *outFile, "SP0;" ); - break; - } - - if( changeMask & GCForeground ) - { -#ifdef XP_PCL_COLOR - ColormapPtr cmap; - Colormap c; - char t[40]; - - c = wColormap( ((WindowPtr)pDrawable) ); - cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP ); - - if( cmap->class == TrueColor ) - { - if( pGC->fillStyle != FillTiled || pGC->tileIsPixel ) { - unsigned short r, g, b; - - r = (pGC->fgPixel & cmap->pVisual->redMask) - >> (cmap->pVisual->offsetRed ); - g = (pGC->fgPixel & cmap->pVisual->greenMask) - >> (cmap->pVisual->offsetGreen); - b = (pGC->fgPixel & cmap->pVisual->blueMask) - >> (cmap->pVisual->offsetBlue); - - PclLookUp(cmap, cPriv, &r, &g, &b); - sprintf( t, "\033%%0A\033*v%ua%ub%uc0I\033%%0B", r, g, b); - SEND_PCL( *outFile, t ); - } - } - else /* PseudoColor or StaticGray */ - { - sprintf( t, "SP%ld;", (long) pGC->fgPixel ); - SEND_PCL( *outFile, t ); - } -#else - ScreenPtr screen; - screen = pDrawable->pScreen; - if ( pGC->fgPixel == screen->whitePixel ) - SEND_PCL( *outFile, "SP0;"); - else - SEND_PCL( *outFile, "SP1;"); -#endif /* XP_PCL_COLOR */ - } - - if( changeMask & GCJoinStyle ) - switch( pGC->joinStyle ) - { - case JoinMiter: - SEND_PCL( *outFile, "LA2,1;" ); - break; - case JoinRound: - SEND_PCL( *outFile, "LA2,4;" ); - break; - case JoinBevel: - SEND_PCL( *outFile, "LA2,5;" ); - break; - } - - if( changeMask & GCCapStyle ) - switch( pGC->capStyle ) - { - case CapNotLast: - case CapButt: - SEND_PCL( *outFile, "LA1,1;" ); - break; - case CapRound: - SEND_PCL( *outFile, "LA1,4;" ); - break; - case CapProjecting: - SEND_PCL( *outFile, "LA1,2;" ); - break; - } - - if( changeMask & GCLineWidth ) - { - float penWidth, pixelsPerMM; - ScreenPtr screen; - char temp[30]; - - if( pGC->lineWidth == 0 || pGC->lineWidth == 1 ) - /* A pen width of 0.0 mm gives a one-pixel-wide line */ - penWidth = 0.0; - else - { - screen = pDrawable->pScreen; - pixelsPerMM = (float)screen->width / (float)screen->mmWidth; - - penWidth = pGC->lineWidth / pixelsPerMM; - } - sprintf( temp, "PW%g;", penWidth ); - SEND_PCL( *outFile, temp ); - } - - if( changeMask & GCLineStyle ) - { - int i, num = pGC->numInDashList; - double total; - char t[30]; - - switch( pGC->lineStyle ) - { - case LineSolid: - SEND_PCL( *outFile, "LT;" ); - break; - case LineOnOffDash: - /* - * Calculate the pattern length of the dashes, in pixels, - * then convert to mm - */ - for( i = 0, total = 0.0; i < 20 && i < num; i++ ) - total += pGC->dash[i]; - if( num % 2 ) - for( i = num; i < 20 && i < num + num; i++ ) - total += pGC->dash[i-num]; - - total *= ( (double)pDrawable->pScreen->mmWidth / - (double)pDrawable->pScreen->width ); - - sprintf( t, "LT8,%f,1;", total ); - SEND_PCL( *outFile, t ); - break; - } - } - - - if( changeMask & GCFillStyle ) - switch( pGC->fillStyle ) - { - case FillSolid: - SEND_PCL( *outFile, "FT1;TR0;CF;" ); - break; - case FillTiled: - SEND_PCL( *outFile, "FT22,100;TR0;CF2,0;" ); - break; - case FillOpaqueStippled: - SEND_PCL( *outFile, "FT22,101;TR0;CF2,0;" ); - if( pGC->fgPixel != gcPriv->stippleFg || - pGC->bgPixel != gcPriv->stippleBg ) - changeMask |= GCStipple; - break; - case FillStippled: - SEND_PCL( *outFile, "FT22,102;TR1;CF2,0;" ); - break; - } - - if( changeMask & GCTile && !pGC->tileIsPixel ) - { - char *bits; - int h, w, sz; - - h = pGC->tile.pixmap->drawable.height; - w = pGC->tile.pixmap->drawable.width; - - sz = h * PixmapBytePad(w, pGC->tile.pixmap->drawable.depth); - bits = (char *)xalloc(sz); - fbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, - bits); - PclSendPattern( bits, sz, 1, h, w, 100, *outFile ); - xfree( bits ); - } - - if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) ) - { - char t[30]; - - sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y ); - SEND_PCL( *outFile, t ); - } - - /* - * We have to resend the stipple pattern either when the stipple itself - * changes, or if we're in FillOpaqueStippled mode and either the - * foreground or the background color changes. - */ - if( changeMask & GCStipple || - ( pGC->fillStyle == FillOpaqueStippled && - ( pGC->fgPixel != gcPriv->stippleFg || - pGC->bgPixel != gcPriv->stippleBg ) ) ) - { - int h, w, i, sz, w2; - char *bits, *row, t[30]; - PixmapPtr scratchPix; - GCPtr scratchGC; - - if( pGC->stipple != NULL ) - { - SEND_PCL( *outFile, "\033%0A" ); - - h = pGC->stipple->drawable.height; - w = pGC->stipple->drawable.width; - sz = h * BitmapBytePad( w ); - - bits = (char *)xalloc( sz ); - fbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits ); - - w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 ); - /* - * XXX The PCL docs say that I need to word-align each - * XXX row, but I get garbage when I do... - */ - /* - if( w2 % 2 ) - w2++; - */ - - sprintf( t, "\033*c102g%dW", h * w2 + 8 ); - SEND_PCL( *outFile, t ); - - sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8, - w&0xff ); - SEND_PCL_COUNT( *outFile, t, 8 ); - - for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) ) - SEND_PCL_COUNT( *outFile, row, w2 ); - - SEND_PCL( *outFile, "\033%0B" ); - - xfree( bits ); - - /* - * Also do the opaque stipple, as a tile - */ - if( pGC->depth != 1 ) - sz = h * PixmapBytePad( w, pGC->depth ); - bits = (char *)xalloc( sz ); - - scratchPix = - (*pGC->pScreen->CreatePixmap)( pGC->pScreen, - w, h, pGC->depth, - CREATE_PIXMAP_USAGE_SCRATCH ); - scratchGC = GetScratchGC( pGC->depth, pGC->pScreen ); - CopyGC( pGC, scratchGC, ~0L ); - - fbValidateGC(scratchGC, ~0L, (DrawablePtr)scratchPix); - fbCopyPlane(&(pGC->stipple->drawable), (DrawablePtr)scratchPix, - scratchGC, 0, 0, w, h, 0, 0, 1); - fbGetImage(&(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0, - bits); - PclSendPattern( bits, sz, pGC->depth, h, w, 101, *outFile ); - FreeScratchGC( scratchGC ); - (*pGC->pScreen->DestroyPixmap)( scratchPix ); - xfree( bits ); - } - } - - if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) ) - { - char t[30]; - - sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y ); - SEND_PCL( *outFile, t ); - } - - if( changeMask & GCDashList ) - { - int num = pGC->numInDashList; - double total; - char dashes[20]; - char t[100], t2[20]; - - /* Make up the doubled dash list, if necessary */ - for( i = 0; i < 20 && i < num; i++ ) - dashes[i] = pGC->dash[i]; - - if( num % 2 ) - { - for( i = num; i < 20 && i < num + num; i++ ) - dashes[i] = dashes[i-num]; - if( ( num *= 2 ) > 20 ) - num = 20; - } - - /* Add up dash lengths to get percentage */ - for( i = 0, total = 0; i < num; i++ ) - total += dashes[i]; - - /* Build up the HP-GL/2 for the dash list */ - strcpy( t, "UL8" ); - for( i = 0; i < num; i++ ) - { - sprintf( t2, ",%d", - (int)( ( (double)dashes[i] / total * 100.0 ) + 0.5 ) ); - strcat( t, t2 ); - } - strcat( t, ";" ); - SEND_PCL( *outFile, t ); - } - - - /* Go back to PCL mode */ - SEND_PCL( *outFile, "\033%0A" ); - - /* - * Update the drawable's private information, which includes - * erasing the drawable's private changeMask, since all the - * changes have been made. - */ - if( changeMask ) - PclSetDrawablePrivateGC( pDrawable, *pGC ); - - return TRUE; -} - -/* - * PclComputeCompositeClip() - * - * I'd like to use the miComputeCompositeClip function, but it sticks - * things into the mi GC privates, where the PCL driver can't get at - * it. So, rather than mess around with the mi code, I ripped it out - * and made the appropriate changes here. - */ - - -void -PclComputeCompositeClip( - GCPtr pGC, - DrawablePtr pDrawable) -{ - if (pDrawable->type == DRAWABLE_WINDOW) - { - WindowPtr pWin = (WindowPtr) pDrawable; - 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 composite clip for pixmap */ -} - -/* - * PclValidateGC() - * - * Unlike many screen GCValidate routines, this function should not need - * to mess with setting the drawing functions. Different drawing - * functions are usually needed to optimize such things as drawing - * wide or dashed lines; this functionality will be handled primarily - * by the printer itself, while the necessary PCL code to set the - * attributes will be done in PclUpdateDrawableGC(). - */ - -/*ARGSUSED*/ -void -PclValidateGC( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable) -{ - /* - * Pixmaps should be handled by their respective validation - * functions. - */ - if( pDrawable->type == DRAWABLE_PIXMAP ) - { - fbValidateGC(pGC, ~0, pDrawable); - return; - } - - /* - * Reset the drawing operations - */ - pGC->ops = &PclGCOps; - - /* - * Validate the information, and correct it if necessary. - */ - - /* - * If necessary, compute the composite clip region. (Code ripped - * from migc.c) - */ - if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || - (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) - ) - { - PclComputeCompositeClip(pGC, pDrawable); - } - - /* - * PCL does not directly support the DoubleDash line style, nor is - * there an easy way to simulate it, so we'll just change it to a - * LineOnOffDash, which is supported by PCL. - */ - if( ( changes & GCLineStyle ) && ( pGC->lineStyle == LineDoubleDash ) ) - pGC->lineStyle = LineOnOffDash; - - /* - * Update the drawable's changeMask to reflect the changes made to the GC. - */ -/* - PclSetDrawablePrivateGC( pDrawable, *pGC, changes ); -*/ -} diff --git a/hw/xprint/pcl/PclInit.c b/hw/xprint/pcl/PclInit.c deleted file mode 100644 index e738e3e54..000000000 --- a/hw/xprint/pcl/PclInit.c +++ /dev/null @@ -1,575 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclInit.c -** * -** * Contents: -** * Initialization code of Pcl driver for the print server. -** * -** * Created: 1/30/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/wait.h> - -#include "Pcl.h" - -#include "fb.h" -#include <X11/Xos.h> /* for unlink() */ - -#include "attributes.h" -#include "DiPrint.h" - -#define MODELDIRNAME "/models" - -static void AllocatePclPrivates(ScreenPtr pScreen); -static int PclInitContext(XpContextPtr pCon); -static Bool PclDestroyContext(XpContextPtr pCon); - -DevPrivateKey PclScreenPrivateKey = &PclScreenPrivateKey; -DevPrivateKey PclContextPrivateKey = &PclContextPrivateKey; -DevPrivateKey PclPixmapPrivateKey = &PclPixmapPrivateKey; -DevPrivateKey PclWindowPrivateKey = &PclWindowPrivateKey; -DevPrivateKey PclGCPrivateKey = &PclGCPrivateKey; - -#ifdef XP_PCL_COLOR -/* - * The supported visuals on this screen - */ -static VisualRec Visuals[] = -{ - { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0 }, - { 2, PseudoColor, 8, 256, 8, 0, 0, 0, 0, 0, 0 }, - { 3, TrueColor, 8, 256, 24, 0xFF0000, 0xFF00, 0xFF, 16, 8, 0 } -}; - -/* - * The supported depths on this screen - */ -static DepthRec Depths[] = -{ - { 1, 1, NULL }, - { 8, 1, NULL }, - { 24, 1, NULL } -}; -#else -/* - * The supported visuals on this screen - */ -static VisualRec Visuals[] = -{ - { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0} -}; - -/* - * The supported depths on this screen - */ -static DepthRec Depths[] = -{ - { 1, 1, NULL } -}; -#endif /* XP_PCL_COLOR */ - - -#define NUM_VISUALS(visuals) (sizeof(visuals) / sizeof(VisualRec)) -#define NUM_DEPTHS(depths) (sizeof(depths) / sizeof(DepthRec)) - -Bool -PclCloseScreen(int index, - ScreenPtr pScreen) -{ - PclScreenPrivPtr pPriv = (PclScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); - - pScreen->CloseScreen = pPriv->CloseScreen; - xfree( pPriv ); - - return (*pScreen->CloseScreen)(index, pScreen); -} - -Bool -InitializePclDriver( - int ndx, - ScreenPtr pScreen, - int argc, - char **argv) -{ - int maxRes, xRes, yRes, maxDim; - unsigned i; - PclScreenPrivPtr pPriv; - - /* - * Register this driver's InitContext function with the print - * extension. This is a bit sleazy, as the extension hasn't yet - * been initialized, but the extensionneeds to know this, and this - * seems the best time to provide the information. - */ -#ifdef XP_PCL_COLOR - XpRegisterInitFunc( pScreen, "XP-PCL-COLOR", PclInitContext ); -#elif XP_PCL_MONO - XpRegisterInitFunc( pScreen, "XP-PCL-MONO", PclInitContext ); -#else - XpRegisterInitFunc( pScreen, "XP-PCL-LJ3", PclInitContext ); -#endif /* XP_PCL_MONO */ - - /* - * Create and fill in the devPrivate for the PCL driver. - */ - AllocatePclPrivates(pScreen); - - pPriv = (PclScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); - - maxDim = MAX( pScreen->height, pScreen->width ); - xRes = pScreen->width / ( pScreen->mmWidth / 25.4 ); - yRes = pScreen->height / ( pScreen->mmHeight / 25.4 ); - maxRes = MAX( xRes, yRes ); - -#ifdef XP_PCL_COLOR - fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes, - maxRes, 8 ); /* XXX what's the depth here? */ - /* Clean up the fields that we stomp (code taken from fbCloseScreen) */ - for( i = 0; (int) i < pScreen->numDepths; i++ ) - xfree( pScreen->allowedDepths[i].vids ); - xfree( pScreen->allowedDepths ); - xfree( pScreen->visuals ); -#else - fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes, - maxRes, 1 ); -#endif /* XP_PCL_COLOR */ - - miInitializeBackingStore ( pScreen ); - - pScreen->defColormap = FakeClientID(0); - pScreen->blackPixel = 1; - pScreen->whitePixel = 0; - - pPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = PclCloseScreen; - - pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize; - pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop; - pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop; - pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop; - pScreen->CreateWindow = PclCreateWindow; - pScreen->DestroyWindow = PclDestroyWindow; -/* - pScreen->PositionWindow = PclPositionWindow; -*/ - pScreen->ChangeWindowAttributes = PclChangeWindowAttributes; -/* - pScreen->RealizeWindow = PclMapWindow; - pScreen->UnrealizeWindow = PclUnmapWindow; -*/ - pScreen->CopyWindow = PclCopyWindow; /* XXX Hard routine to write! */ - - pScreen->CreatePixmap = fbCreatePixmap; - pScreen->DestroyPixmap = fbDestroyPixmap; - pScreen->RealizeFont = PclRealizeFont; - pScreen->UnrealizeFont = PclUnrealizeFont; - pScreen->CreateGC = PclCreateGC; - - pScreen->CreateColormap = PclCreateColormap; - pScreen->DestroyColormap = PclDestroyColormap; - pScreen->InstallColormap = (InstallColormapProcPtr)NoopDDA; - pScreen->UninstallColormap = (UninstallColormapProcPtr)NoopDDA; - pScreen->ListInstalledColormaps = PclListInstalledColormaps; - pScreen->StoreColors = PclStoreColors; -/* - pScreen->ResolveColor = PclResolveColor; -*/ - - pScreen->BitmapToRegion = fbPixmapToRegion; - - pScreen->ConstrainCursor = PclConstrainCursor; - pScreen->CursorLimits = PclCursorLimits; - pScreen->DisplayCursor = PclDisplayCursor; - pScreen->RealizeCursor = PclRealizeCursor; - pScreen->UnrealizeCursor = PclUnrealizeCursor; - pScreen->RecolorCursor = PclRecolorCursor; - pScreen->SetCursorPosition = PclSetCursorPosition; - - pScreen->visuals = Visuals; - pScreen->numVisuals = NUM_VISUALS( Visuals ); - pScreen->allowedDepths = Depths; - pScreen->numDepths = NUM_DEPTHS( Depths ); - - for( i = 0; i < NUM_DEPTHS( Depths ); i++ ) - { - pScreen->allowedDepths[i].vids = - (VisualID *)xalloc( sizeof(VisualID ) ); - pScreen->allowedDepths[i].vids[0] = i + 1; - } - -#ifdef XP_PCL_COLOR - pScreen->rootVisual = 2; - pScreen->rootDepth = 8; -#else - pScreen->rootVisual = 1; - pScreen->rootDepth = 1; -#endif /* XP_PCL_COLOR */ - - pPriv->colormaps = NULL; - PclCreateDefColormap( pScreen ); - - return TRUE; -} - -static void -AllocatePclPrivates(ScreenPtr pScreen) -{ - dixRequestPrivate(PclWindowPrivateKey, sizeof( PclWindowPrivRec ) ); - dixRequestPrivate(PclContextPrivateKey, sizeof( PclContextPrivRec ) ); - dixRequestPrivate(PclGCPrivateKey, sizeof( PclGCPrivRec ) ); - dixRequestPrivate(PclPixmapPrivateKey, sizeof( PclPixmapPrivRec ) ); - - dixSetPrivate(&pScreen->devPrivates, PclScreenPrivateKey, - xalloc(sizeof(PclScreenPrivRec))); -} - -/* - * PclInitContext - * - * Establish the appropriate values for a PrintContext used with the PCL - * driver. - */ - -static char DOC_ATT_SUPP[]="document-attributes-supported"; -static char DOC_ATT_VAL[]="document-format xp-listfonts-modes"; -static char JOB_ATT_SUPP[]="job-attributes-supported"; -static char JOB_ATT_VAL[]=""; -static char PAGE_ATT_SUPP[]="xp-page-attributes-supported"; -static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \ -default-input-tray default-medium plex xp-listfonts-modes"; - -static int -PclInitContext(XpContextPtr pCon) -{ - XpDriverFuncsPtr pFuncs; - PclContextPrivPtr pConPriv; - char *server, *attrStr; - char *modelID; - char *configDir; - char *pathName; - int i, j; - float width, height; - XpOidMediumDiscreteSizeList* ds_list; - XpOidArea* repro; - XpOid page_size; - XpOidMediumSS* m; - - /* - * Initialize the attribute store for this printer. - */ - XpInitAttributes( pCon ); - - /* - * Initialize the function pointers - */ - pFuncs = &( pCon->funcs ); - pFuncs->StartJob = PclStartJob; - pFuncs->EndJob = PclEndJob; - pFuncs->StartDoc = PclStartDoc; - pFuncs->EndDoc = PclEndDoc; - pFuncs->StartPage = PclStartPage; - pFuncs->EndPage = PclEndPage; - pFuncs->PutDocumentData = PclDocumentData; - pFuncs->GetDocumentData = PclGetDocumentData; - pFuncs->GetAttributes = PclGetAttributes; - pFuncs->SetAttributes = PclSetAttributes; - pFuncs->AugmentAttributes = PclAugmentAttributes; - pFuncs->GetOneAttribute = PclGetOneAttribute; - pFuncs->DestroyContext = PclDestroyContext; - pFuncs->GetMediumDimensions = PclGetMediumDimensions; - pFuncs->GetReproducibleArea = PclGetReproducibleArea; - - - /* - * Set up the context privates - */ - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - pConPriv->jobFileName = (char *)NULL; - pConPriv->pageFileName = (char *)NULL; - pConPriv->pJobFile = (FILE *)NULL; - pConPriv->pPageFile = (FILE *)NULL; - pConPriv->dash = NULL; - pConPriv->validGC = 0; - - pConPriv->getDocClient = (ClientPtr)NULL; - pConPriv->getDocBufSize = 0; - modelID = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-model-identifier"); - if ( (configDir = XpGetConfigDir(False)) != (char *) NULL ) { - pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) + - strlen(modelID) + strlen("color.map") + 4); - if (pathName) { - sprintf(pathName, "%s/%s/%s/%s", configDir, MODELDIRNAME, modelID, - "color.map"); - pConPriv->ctbl = PclReadMap(pathName, &pConPriv->ctbldim); - xfree(pathName); - - } else - pConPriv->ctbl = NULL; - } else - pConPriv->ctbl = NULL; - -#ifdef XP_PCL_LJ3 - /* - * Initialize the spooling buffer for saving the figures temporary - * (LaserJet IIIs printers don't support the macro function which - * includes some HP-GL/2 commands.) - */ - pConPriv->fcount = 0; - if ( !(pConPriv->figures = (char *)xalloc(1024)) ) - pConPriv->fcount_max = 0; - else - pConPriv->fcount_max = 1024; -#endif /* XP_PCL_LJ3 */ - - /* - * document-attributes-supported - */ - server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP ); - if( ( attrStr = (char *)xalloc(strlen(server) + strlen(DOC_ATT_SUPP) - + strlen(DOC_ATT_VAL) + - strlen(PAGE_ATT_VAL) + 8 ) ) - == (char *)NULL ) - return BadAlloc; - sprintf( attrStr, "*%s:\t%s %s %s", DOC_ATT_SUPP, server, - DOC_ATT_VAL, PAGE_ATT_VAL ); - XpAugmentAttributes( pCon, XPPrinterAttr, attrStr ); - xfree( attrStr ); - - /* - * job-attributes-supported - */ - server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP ); - if( ( attrStr = (char *)xalloc(strlen(server) + strlen(JOB_ATT_SUPP) - + strlen(JOB_ATT_VAL) + 8 ) ) - == (char *)NULL ) - return BadAlloc; - sprintf( attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL ); - XpAugmentAttributes( pCon, XPPrinterAttr, attrStr ); - xfree( attrStr ); - - /* - * xp-page-attributes-supported - */ - server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP ); - if( ( attrStr = (char *)xalloc(strlen(server) + strlen(PAGE_ATT_SUPP) - + strlen(PAGE_ATT_VAL) + 8 ) ) - == (char *)NULL ) - return BadAlloc; - sprintf( attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL ); - XpAugmentAttributes( pCon, XPPrinterAttr, attrStr ); - xfree( attrStr ); - - /* - * Validate the attribute pools - */ - XpValidateAttributePool( pCon, XPPrinterAttr, &PclValidatePoolsRec ); - - /* - * Munge the reproducible areas to reflect the fact that PCL will not let - * me move the right or left margins closer than .25" to the edge of the - * paper. - */ - m = XpGetMediumSSAttr( pCon, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, - (const XpOidList*) NULL, - (const XpOidList*) NULL ); - for( i = 0; i < XpOidMediumSSCount( m ); i++ ) - { - if( XpOidMediumSS_DISCRETE == (m->mss)[i].mstag ) - { - ds_list = (m->mss)[i].ms.discrete; - for( j = 0; j < ds_list->count; j++ ) - { - repro = &(ds_list->list)[j].assured_reproduction_area; - page_size = (ds_list->list)[j].page_size; - XpGetMediumMillimeters( page_size, &width, &height ); - - if( repro->minimum_x < 6.35 ) - repro->minimum_x = 6.35; - if( width - repro->maximum_x < 6.35 ) - repro->maximum_x = width - 6.35; - } - } - } - XpPutMediumSSAttr( pCon, XPPrinterAttr, - xpoid_att_medium_source_sizes_supported, m ); - XpOidMediumSSDelete( m ); - - /* - * Finish validating the attribute pools - */ - - XpValidateAttributePool( pCon, XPDocAttr, &PclValidatePoolsRec ); - XpValidateAttributePool( pCon, XPJobAttr, &PclValidatePoolsRec ); - XpValidateAttributePool( pCon, XPPageAttr, &PclValidatePoolsRec ); - - /* - * Clear out the colormap storage - */ - pConPriv->palettes = NULL; - - return Success; -} - -static Bool -PclDestroyContext(XpContextPtr pCon) -{ - PclContextPrivPtr pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - PclPaletteMapPtr p, t; - PclCmapToContexts *pCmap; - ScreenPtr screen; - PclScreenPrivPtr sPriv; - PclContextListPtr con, prevCon, temp; - - - /* - * Clean up the temporary files - */ - if( pConPriv->pPageFile != (FILE *)NULL ) - { - fclose( pConPriv->pPageFile ); - pConPriv->pPageFile = (FILE *)NULL; - } - if( pConPriv->pageFileName != (char *)NULL ) - { - unlink( pConPriv->pageFileName ); - xfree( pConPriv->pageFileName ); - pConPriv->pageFileName = (char *)NULL; - } - - if( pConPriv->pJobFile != (FILE *)NULL ) - { - fclose( pConPriv->pJobFile ); - pConPriv->pJobFile = NULL; - } - if( pConPriv->jobFileName != (char *)NULL ) - { - unlink( pConPriv->jobFileName ); - xfree( pConPriv->jobFileName ); - pConPriv->jobFileName = (char *)NULL; - } - - xfree( pConPriv->dash ); - xfree(pConPriv->ctbl); - pConPriv->ctbl = NULL; -#ifdef XP_PCL_LJ3 - xfree( pConPriv->figures ); -#endif /* XP_PCL_LJ3 */ - - /* - * Destroy the colormap<->palette mappings - */ - p = pConPriv->palettes; - while( p ) - { - t = p; - p = p->next; - xfree( t ); - } - pConPriv->palettes = NULL; - - /* - * Remove the context from the screen-level colormap<->contexts mappings - */ - screen = screenInfo.screens[pCon->screenNum]; - sPriv = (PclScreenPrivPtr) - dixLookupPrivate(&screen->devPrivates, PclScreenPrivateKey); - pCmap = sPriv->colormaps; - while( pCmap ) - { - con = pCmap->contexts; - prevCon = NULL; - - while( con ) - { - if( con->context->contextID == pCon->contextID ) - { - if( prevCon ) - { - temp = con; - prevCon->next = con = con->next; - } - else - { - temp = pCmap->contexts; - pCmap->contexts = con = con->next; - } - xfree( temp ); - } - else - con = con->next; - } - - pCmap = pCmap->next; - } - - XpDestroyAttributes(pCon); - - return Success; -} - -XpContextPtr -PclGetContextFromWindow(WindowPtr win) -{ - PclWindowPrivPtr pPriv; - - while( win ) - { - pPriv = (PclWindowPrivPtr) - dixLookupPrivate(&win->devPrivates, PclWindowPrivateKey); - if( pPriv->validContext ) - return pPriv->context; - - win = win->parent; - } - - return NULL; -} diff --git a/hw/xprint/pcl/PclLine.c b/hw/xprint/pcl/PclLine.c deleted file mode 100644 index 68d55a525..000000000 --- a/hw/xprint/pcl/PclLine.c +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclLine.c -** * -** * Contents: -** * Line drawing routines for the PCL driver -** * -** * Created: 10/11/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Pcl.h" -#include "gcstruct.h" -#include "windowstr.h" - -/* - * PclPolyLine() - * PclPolySegment() - * - * Generates PCL code to draw a polyline, or a collection of distinct - * line segments, clipped by the current clip region. Since PCL - * supports clipping to a rectangle, and the clip region is - * represented as a collection of visible rectangles, we can draw and - * clip the line by repeatedly drawing the complete line, clipped to - * each rectangle in the clip region. - * - * Since each box in the clipping region generates approximately 30 - * bytes of PCL code, we have to have a way to avoid having a large - * number of boxes. The worst problem the case where the clipping - * region is a collection of one-pixel-high boxes, perhaps arising - * from a bitmap clip mask, or a region defined by a non-rectangular - * polygon. - * - * To alleviate this problem, we create a second clipping region, - * which consists of the union of the bounding boxes of each line - * segment. (Each bounding box is also increased by some amount - * related to the current line width to allow for non-zero-width - * lines, and for the various end and join styles.) This region is - * intersected with the "real" clipping region to get the region used - * to actually clip the polyline. This should result in a significant - * reduction in the number of clip rectangles, as the region-handling - * code should consolidate many of the fragments of one-pixel-high - * rectangles into larger rectangles. - */ - -void -PclPolyLine( - DrawablePtr pDrawable, - GCPtr pGC, - int mode, - int nPoints, - xPoint *pPoints) -{ - char t[80]; - FILE *outFile; - int xoffset = 0, yoffset = 0; - int nbox; - BoxPtr pbox; - xRectangle *drawRects, *r; - RegionPtr drawRegion, region; - short fudge; - int i; - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - /* - * Allocate the storage required to deal with the clipping - * regions. - */ - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - drawRects = (xRectangle *) - xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) ); - - /* - * Calculate the "fudge factor" based on the line width. - * Multiplying by three seems to be a good first guess. - * XXX I need to think of a way to test this. - */ - fudge = 3 * pGC->lineWidth + 1; - - /* - * Generate the PCL code to draw the polyline, by defining it as a - * macro which uses the HP-GL/2 line drawing function. - */ - - MACRO_START( outFile, pConPriv ); - SAVE_PCL( outFile, pConPriv, "\033%0B" ); - - sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x, - pPoints[0].y + pDrawable->y ); - SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */ - - switch( mode ) - { - case CoordModeOrigin: - xoffset = pDrawable->x; - yoffset = pDrawable->y; - SAVE_PCL( outFile, pConPriv, "PA" ); - break; - case CoordModePrevious: - xoffset = yoffset = 0; - SAVE_PCL( outFile, pConPriv, "PR" ); - break; - } - - /* - * Build the "drawing region" as we build the PCL to draw the - * line. - */ - for(i = 1, r = drawRects; i < nPoints; i++, r++ ) - { - if( i != 1 ) - SAVE_PCL( outFile, pConPriv, "," ); - - sprintf( t, "%d,%d", pPoints[i].x + xoffset, - pPoints[i].y + yoffset ); - SAVE_PCL( outFile, pConPriv, t ); - - r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge; - r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge; - r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge; - r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge; - } - SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ - MACRO_END( outFile ); - - /* - * Convert the collection of rectangles into a proper region, then - * intersect it with the clip region. - */ - drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1, - drawRects, CT_UNSORTED ); - if( mode == CoordModePrevious ) - REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y ); - REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the entire polyline to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - xfree( drawRects ); -} - -void -PclPolySegment( - DrawablePtr pDrawable, - GCPtr pGC, - int nSegments, - xSegment *pSegments) -{ - FILE *outFile, *dummy; - char t[80]; - int xoffset, yoffset; - int nbox, i; - unsigned long valid; - BoxPtr pbox; - xRectangle *drawRects, *r; - RegionPtr drawRegion, region; - short fudge; - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - GC cacheGC; - - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - /* - * Allocate the storage for the temporary regions. - */ - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - drawRects = (xRectangle *) - xalloc( nSegments * sizeof( xRectangle ) ); - - /* - * Calculate the fudge factor, based on the line width - */ - fudge = pGC->lineWidth * 3 + 1; - - /* - * Turn off line joining. - */ - SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" ); - - /* - * Generate the PCL code to draw the segments, by defining them as - * a macro which uses the HP-GL/2 line drawing function. - * - * XXX I wonder if this should be implemented using the Encoded - * XXX Polyline function. Since I'm only sending it once, it's not - * XXX necessarily too important. - */ - - MACRO_START( outFile, pConPriv ); - SAVE_PCL( outFile, pConPriv, "\033%0B" ); - - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - for( i = 0, r = drawRects; i < nSegments; i++, r++ ) - { - r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset; - r->y = MIN( pSegments[i].y1, pSegments[i].y2 ) + yoffset; - r->width = abs( pSegments[i].x1 - pSegments[i].x2 ); - r->height = abs( pSegments[i].y1 - pSegments[i].y2 ); - - sprintf( t, "PU%d,%d;PD%d,%d;", pSegments[i].x1 + xoffset, - pSegments[i].y1 + yoffset, pSegments[i].x2 + - xoffset, pSegments[i].y2 + yoffset ); - SAVE_PCL( outFile, pConPriv, t ); - - r->x -= fudge; - r->y -= fudge; - r->width += 2 * fudge; - r->height += 2 * fudge; - } - SAVE_PCL( outFile, pConPriv, "\033%0A" ); - MACRO_END ( outFile ); - - /* - * Convert the collection of rectangles into a proper region, then - * intersect it with the clip region. - */ - drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments, - drawRects, CT_UNSORTED ); - REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the entire set of segments to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Now we need to reset the line join mode to whatever it was at before. - * The easiest way is to force the cached GC's joinstyle to be different - * from the current GC's joinstyle, then re-update the GC. This way, we - * don't have to duplicate code unnecessarily. - */ - PclGetDrawablePrivateStuff( pDrawable, &cacheGC, &valid, &dummy ); - cacheGC.joinStyle = !cacheGC.joinStyle; - PclSetDrawablePrivateGC( pDrawable, cacheGC ); - PclUpdateDrawableGC( pGC, pDrawable, &outFile ); - - /* - * Clean up - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - xfree( drawRects ); -} diff --git a/hw/xprint/pcl/PclMisc.c b/hw/xprint/pcl/PclMisc.c deleted file mode 100644 index 0b37836e9..000000000 --- a/hw/xprint/pcl/PclMisc.c +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclMisc.c -** * -** * Contents: -** * Miscellaneous code for Pcl driver. -** * -** * Created: 2/01/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdlib.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */ -#include "Pcl.h" - -#include "cursor.h" -#include "resource.h" - -#include "windowstr.h" -#include "propertyst.h" -#include "attributes.h" - - -/*ARGSUSED*/ -void -PclQueryBestSize( - int type, - short *pwidth, - short *pheight, - ScreenPtr pScreen) -{ - unsigned width, highBit; - - switch(type) - { - case CursorShape: - *pwidth = 0; - *pheight = 0; - break; - case TileShape: - case StippleShape: - width = *pwidth; - if (!width) break; - /* Return the nearest power of two >= what they gave us */ - highBit = 0x80000000; - /* Find the highest 1 bit in the given width */ - while(!(highBit & width)) - highBit >>= 1; - /* If greater than that then return the next power of two */ - if((highBit - 1) & width) - highBit <<= 1; - *pwidth = highBit; - /* height is a don't-care */ - break; - } -} - -/* - * GetPropString searches the window heirarchy from pWin up looking for - * a property by the name of propName. If found, returns the property's - * value. If not, it returns NULL. - */ -char * -GetPropString( - WindowPtr pWin, - char *propName) -{ - Atom atom; - PropertyPtr pProp = (PropertyPtr)NULL; - char *retVal; - - atom = MakeAtom(propName, strlen(propName), FALSE); - if(atom != BAD_RESOURCE) - { - WindowPtr pPropWin; - int rc, n; - - /* - * The atom has been defined, but it might only exist as a - * property on an unrelated window. - */ - for(pPropWin = pWin; pPropWin != (WindowPtr)NULL; - pPropWin = pPropWin->parent) - { - rc = dixLookupProperty(&pProp, pPropWin, atom, - serverClient, DixReadAccess); - if (rc == Success) - break; - else - pProp = NULL; - } - if(pProp == (PropertyPtr)NULL) - return (char *)NULL; - - n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */ - retVal = (char *)xalloc(n + 1); - (void)memcpy((void *)retVal, (void *)pProp->data, n); - retVal[n] = '\0'; - - return retVal; - } - - return (char *)NULL; -} - -#include <signal.h> -#include <errno.h> - -/* ARGSUSED */ -static void SigchldHndlr ( - int dummy) -{ - int status; - int olderrno = errno; - struct sigaction act; - sigfillset(&act.sa_mask); - act.sa_flags = 0; - act.sa_handler = SigchldHndlr; - - (void) wait (&status); - - /* - * Is this really necessary? - */ - sigaction(SIGCHLD, &act, (struct sigaction *)NULL); - errno = olderrno; -} - -/* - * SystemCmd provides a wrapper for the 'system' library call. The call - * appears to be sensitive to the handling of SIGCHLD, so this wrapper - * sets the status to SIG_DFL, and then resets the established handler - * after system returns. - */ -int -SystemCmd(char *cmdStr) -{ - int status; - struct sigaction newAct, oldAct; - sigfillset(&newAct.sa_mask); - newAct.sa_flags = 0; - newAct.sa_handler = SIG_DFL; - sigfillset(&oldAct.sa_mask); - oldAct.sa_flags = 0; - oldAct.sa_handler = SigchldHndlr; - - /* - * get the old handler, and set the action to IGN - */ - sigaction(SIGCHLD, &newAct, &oldAct); - - status = system (cmdStr); - - sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL); - return status; -} - - -/* - * PclGetMediumDimensions is installed in the GetMediumDimensions field - * of each Pcl-initialized context. - */ -int -PclGetMediumDimensions(XpContextPtr pCon, - CARD16 *width, - CARD16 *height) -{ - XpGetMediumDimensions(pCon, width, height); - return Success; -} - -/* - * PclGetReproducibleArea is installed in the GetReproducibleArea field - * of each Pcl-initialized context. - */ -int -PclGetReproducibleArea(XpContextPtr pCon, - xRectangle *pRect) -{ - XpGetReproductionArea(pCon, pRect); - return Success; -} - -#ifdef XP_PCL_LJ3 -/* - * PclSpoolFigs spooled the rendering PCL/HP-GL2 commands into the - * temporary buffer pointed by figures pointer in pcl private context. - * LaserJet IIIs printers don't support the macro function which - * includes some HP-GL/2 commands. - */ -void -PclSpoolFigs(PclContextPrivPtr pConPriv, char *t, int n) -{ -char *ptr; - - ptr = pConPriv->figures; - while ( ( pConPriv->fcount + n) > pConPriv->fcount_max ) { - ptr = (char *)xrealloc(ptr, 1024 + pConPriv->fcount_max); - if ( !ptr ) - return; - pConPriv->figures = ptr; - pConPriv->fcount_max += 1024; - } - ptr += pConPriv->fcount; - pConPriv->fcount += n; - memcpy(ptr, t, n); -} -#endif /* XP_PCL_LJ3 */ - -/* - * PclSendData: - * For XP-PCL-COLOR/XP-PCL-MONO, it executes the macro stored before - * in the clipped area. - * For XP-PCL-LJ3, it draws the spooled figures in the clipped area. - */ -void -PclSendData( - FILE *outFile, - PclContextPrivPtr pConPriv, - BoxPtr pbox, - int nbox, - double ratio -) -{ -char *ptr; -int n; -char t[80]; - -#ifdef XP_PCL_LJ3 - ptr = pConPriv->figures; - n = pConPriv->fcount; -#else - ptr = "\033&f3X"; - n = 5; -#endif /* XP_PCL_LJ3 */ - - while( nbox ) - { - /* - * Set the HP-GL/2 input window to the current - * rectangle in the clip region, then send the code to - * execute the macro defined above. - */ - if (ratio == 1.0) - sprintf( t, "\033%%0BIW%d,%d,%d,%d;\033%%0A", - pbox->x1, pbox->y1, - pbox->x2, pbox->y2 ); - else - sprintf( t, "\033%%0BIW%g,%d,%g,%d;\033%%0A", - ratio * pbox->x1, pbox->y1, - ratio * pbox->x2, pbox->y2 ); - - SEND_PCL( outFile, t ); - SEND_PCL_COUNT( outFile, ptr, n); - - nbox--; - pbox++; - } -} diff --git a/hw/xprint/pcl/PclPixel.c b/hw/xprint/pcl/PclPixel.c deleted file mode 100644 index d219838f0..000000000 --- a/hw/xprint/pcl/PclPixel.c +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclPixel.c -** * -** * Contents: -** * Pixel-drawing code for the PCL DDX driver -** * -** * Created: 10/23/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> - -#include "windowstr.h" -#include "gcstruct.h" - -#include "Pcl.h" - -void -PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints ) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; - int nPoints; - xPoint *pPoints; -{ - char t[80]; - FILE *outFile; - int xoffset, yoffset; - BoxRec box; - int xloc, yloc, i; -#if 0 - XpContextPtr pCon; - PclContextPrivPtr cPriv; - PclPixmapPrivPtr pPriv; -#endif - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - /* - * Enter HP-GL/2 and change the line style to one in which only - * the vertices of the specified polyline are drawn. We must also - * temporarily change the line width so that only a single pixel - * is drawn. Then move to the first possible location. - */ - xloc = pPoints[0].x + pDrawable->x; - yloc = pPoints[0].y + pDrawable->y; - - sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc ); - SEND_PCL( outFile, t ); - - /* - * Check each point against the clip region. If it is outside the - * region, don't send the PCL to the printer. - */ - - for( i = 0; i < nPoints; i++ ) - { - if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) ) - { - sprintf( t, ",%d,%d", xloc, yloc ); - SEND_PCL( outFile, t ); - } - - if( mode == CoordModeOrigin ) - { - xloc = pPoints[i+1].x + xoffset; - yloc = pPoints[i+1].y + yoffset; - } - else - { - xloc += pPoints[i+1].x; - yloc += pPoints[i+1].y; - } - } - -#if 0 - /* - * Change the line style and width back to what they were before - * this routine was called. No, this isn't pretty... - */ - if( pDrawable->type == DRAWABLE_WINDOW ) - { - pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - cPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - cPriv->changeMask = GCLineWidth | GCLineStyle; - } - else - { - pPriv = (PclPixmapPrivPtr) - dixLookupPrivate(&((PixmapPtr)pDrawable)->devPrivates, - PclPixmapPrivateKey); - pPriv->changeMask = GCLineWidth | GCLineStyle; - } -#endif - - PclUpdateDrawableGC( pGC, pDrawable, &outFile ); - - /* - * Go back to PCL - */ - SEND_PCL( outFile, "\27%0A" ); -} - -void -PclPushPixels( pGC, pBitmap, pDrawable, width, height, x, y ) - GCPtr pGC; - PixmapPtr pBitmap; - DrawablePtr pDrawable; - int width; - int height; - int x; - int y; -{ -} diff --git a/hw/xprint/pcl/PclPolygon.c b/hw/xprint/pcl/PclPolygon.c deleted file mode 100644 index 7d95d6484..000000000 --- a/hw/xprint/pcl/PclPolygon.c +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclPolygon.c -** * -** * Contents: -** * Draws Polygons and Rectangles for the PCL DDX -** * -** * Created: 10/23/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Pcl.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PclPolyRectangle( - DrawablePtr pDrawable, - GCPtr pGC, - int nRects, - xRectangle *pRects) -{ - char t[80]; - FILE *outFile; - int nbox, i; - BoxPtr pbox; - xRectangle *drawRects, *r; - RegionPtr drawRegion, region; - short fudge; - int xoffset, yoffset; - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - /* - * Allocate the storage required to deal with the clipping - * regions. - */ - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) ); - - fudge = 3 * pGC->lineWidth + 1; - - /* - * Generate the PCL code to draw the rectangles, by defining them - * as a macro which uses the HP-GL/2 rectangle drawing function. - */ - MACRO_START( outFile, pConPriv ); - SAVE_PCL( outFile, pConPriv, "\033%0B" ); - - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - for( i = 0, r = drawRects; i < nRects; i++, r++ ) - { - xRectangle rect = pRects[i]; - - /* Draw the rectangle */ - sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset, - rect.y + yoffset, rect.width, rect.height ); - SAVE_PCL( outFile, pConPriv, t ); - - /* Build the bounding box */ - r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - - fudge; - r->y = MIN( rect.y, rect.y + rect.height ) + yoffset - - fudge; - r->width = rect.width + 2 * fudge; - r->height = rect.height + 2 * fudge; - } - SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ - MACRO_END( outFile ); - - /* - * Convert the collection of rectangles to a proper region, then - * intersect it with the clip region. - */ - drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects, - drawRects, CT_UNSORTED ); - - REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the set of rectangles to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - xfree( drawRects ); -} - -void -PclFillPolygon( - DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, - int nPoints, - DDXPointPtr pPoints) -{ - char t[80]; - FILE *outFile; - int nbox, i; - BoxPtr pbox; - BoxRec box; - RegionPtr drawRegion, region; - int xoffset, yoffset; - int xtop, xbottom, yleft, yright; - int fillRule; - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - char *command; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - /* - * Generate the PCL code to draw the filled polygon, by defining - * it as a macro which uses the HP-GL/2 polygon drawing function. - */ - MACRO_START( outFile, pConPriv ); - SAVE_PCL( outFile, pConPriv, "\033%0B" ); - - if( mode == CoordModeOrigin ) - { - xoffset = pDrawable->x; - yoffset = pDrawable->y; - command = "PA"; - } - else - { - xoffset = yoffset = 0; - command = "PR"; - } - - /* Begin the polygon */ - sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y - + yoffset, command ); - SAVE_PCL( outFile, pConPriv, t ); - - /* Seed the bounding box */ - xtop = xbottom = pPoints[0].x + xoffset; - yleft = yright = pPoints[0].y + yoffset; - - /* Add the rest of the points to the polygon */ - for( i = 1; i < nPoints; i++ ) - { - if( i != 1 ) - SAVE_PCL( outFile, pConPriv, "," ); - - sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y + - yoffset ); - SAVE_PCL( outFile, pConPriv, t ); - - /* Update the bounding box */ - xtop = MIN( xtop, pPoints[i].x + xoffset ); - xbottom = MAX( xbottom, pPoints[i].x + xoffset ); - yleft = MIN( yleft, pPoints[i].y + yoffset ); - yright = MAX( yright, pPoints[i].y + yoffset ); - } - - /* Close the polygon and the macro */ - - if( pGC->fillRule == EvenOddRule ) - fillRule = 0; - else - fillRule = 1; - - sprintf( t, ";PM2;FP%d;\033%%0A", fillRule ); - SAVE_PCL( outFile, pConPriv, t ); - MACRO_END ( outFile ); - - /* - * Build the bounding region from the bounding box of the polygon - */ - box.x1 = xtop; - box.y1 = yleft; - box.x2 = xbottom; - box.y2 = yright; - drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 ); - - if( mode == CoordModePrevious ) - REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y ); - - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - - REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the polygon to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); -} - -void -PclPolyFillRect( - DrawablePtr pDrawable, - GCPtr pGC, - int nRects, - xRectangle *pRects) -{ - char t[80]; - FILE *outFile; - int nbox, i; - BoxPtr pbox; - xRectangle *drawRects, *r; - RegionPtr drawRegion, region; - int xoffset, yoffset; - short fudge; - XpContextPtr pCon; - PclContextPrivPtr pConPriv; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - /* - * Allocate the storage required to deal with the clipping - * regions. - */ - region = REGION_CREATE( pGC->pScreen, NULL, 0 ); - drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) ); - - - fudge = 3 * pGC->lineWidth + 1; - - /* - * Generate the PCL code to draw the filled rectangles, by - * defining them as a macro which uses the HP-GL/2 rectangle - * drawing function. - */ - MACRO_START( outFile, pConPriv ); - SAVE_PCL( outFile, pConPriv, "\033%0B" ); - - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - for( i = 0, r = drawRects; i < nRects; i++, r++ ) - { - xRectangle rect = pRects[i]; - - /* Draw the rectangle */ - sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y + - yoffset, rect.width, rect.height ); - SAVE_PCL( outFile, pConPriv, t ); - - /* Build the bounding box */ - r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge; - r->y = MIN( rect.y, rect.y + rect.height ) + yoffset - - fudge; - r->width = rect.width + 2 * fudge; - r->height = rect.height + 2 * fudge; - } - SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */ - MACRO_END( outFile ); - - /* - * Convert the collection of rectangles to a proper region, then - * intersect it with the clip region. - */ - drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects, - drawRects, CT_UNSORTED ); - REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the set of rectangles to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - xfree( drawRects ); -} diff --git a/hw/xprint/pcl/PclPrint.c b/hw/xprint/pcl/PclPrint.c deleted file mode 100644 index ac8ea1537..000000000 --- a/hw/xprint/pcl/PclPrint.c +++ /dev/null @@ -1,709 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclPrint.c -** * -** * Contents: Print extension code of Pcl driver -** * -** * Created: 2/03/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <unistd.h> -#include <X11/Xprotostr.h> - -#define NEED_EVENTS -#include <X11/Xproto.h> -#undef NEED_EVENTS - -#include "Pcl.h" - -#include "windowstr.h" -#include "attributes.h" -#include "AttrValid.h" -#include "Oid.h" - -int -PclStartJob( - XpContextPtr pCon, - Bool sendClientData, - ClientPtr client) -{ - PclContextPrivPtr pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - PclPaletteMap *pal; - - /* - * Check for existing page file, and delete it if it exists. - */ - if(pConPriv->pageFileName != (char *)NULL) - { - if(pConPriv->pPageFile != (FILE *)NULL) - { - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - } - unlink(pConPriv->pageFileName); - xfree(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - } - - /* - * Create a temporary file to store the printer output. - */ - if (!XpOpenTmpFile("w+", &pConPriv->jobFileName, &pConPriv->pJobFile)) - return BadAlloc; - - /* - * Create/Initialize the SoftFontInfo structure - */ - pConPriv->pSoftFontInfo = PclCreateSoftFontInfo(); - - /* - * Set up the colormap handling - */ - pConPriv->palettes = NULL; - pConPriv->nextPaletteId = 4; - pConPriv->currentPalette = 0; - - pal = &( pConPriv->staticGrayPalette ); - pal->paletteId = 1; - pal->downloaded = 0; - - pal = &( pConPriv->trueColorPalette ); - pal->paletteId = 2; - pal->downloaded = 0; - - pal = &( pConPriv->specialTrueColorPalette ); - pal->paletteId = 3; - pal->downloaded = 0; - - return Success; -} - -int -PclEndJob( - XpContextPtr pCon, - Bool cancel) -{ - PclContextPrivPtr priv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - -#ifdef CCP_DEBUG - FILE *xpoutput; -#endif - FILE *fp; - int retVal; - char *fileName, *trailer; - struct stat statBuf; - PclPaletteMapPtr p; - - trailer = "\033%-12345X@PJL RESET\n"; - - if( cancel == True ) - { - if( priv->getDocClient != (ClientPtr)NULL ) { - XpFinishDocData( priv->getDocClient ); - - priv->getDocClient = NULL; - priv->getDocBufSize = 0; - } - - return Success; - } - - if( priv->getDocClient != (ClientPtr)NULL && priv->getDocBufSize > 0 ) - { - /* - * We need to stash the trailer information somewhere... - */ - if (!XpOpenTmpFile("w+", &fileName, &fp)) - return BadAlloc; - -#ifndef XP_PCL_LJ3 - SEND_PCL( fp, trailer ); - rewind( fp ); - - retVal = XpSendDocumentData( priv->getDocClient, fp, - strlen( trailer ), - priv->getDocBufSize ); -#endif /* XP_PCL_LJ3 */ - - fclose( fp ); - unlink( fileName ); - xfree( fileName ); - - if( priv->getDocClient != (ClientPtr)NULL ) { - XpFinishDocData( priv->getDocClient ); - - priv->getDocClient = NULL; - priv->getDocBufSize = 0; - } - - return retVal; - } - -#ifndef XP_PCL_LJ3 - SEND_PCL( priv->pJobFile, trailer ); -#endif /* XP_PCL_LJ3 */ - - /* - * Submit the job to the spooler - */ - fflush( priv->pJobFile ); - - /* - * Dump the job file to another output file, for testing - * purposes. - */ - rewind( priv->pJobFile ); - stat( priv->jobFileName, &statBuf ); - -#ifdef CCP_DEBUG - unlink( "/users/prince/XpOutput" ); - xpoutput = fopen( "/users/prince/XpOutput", "w" ); - - rewind( priv->pJobFile ); - TransferBytes( priv->pJobFile, xpoutput, - (int)statBuf.st_size ); - fclose( xpoutput ); -#endif - - XpSubmitJob( priv->jobFileName, pCon ); - fclose( priv->pJobFile ); - unlink( priv->jobFileName ); - xfree( priv->jobFileName ); - priv->jobFileName = NULL; - - PclDestroySoftFontInfo(priv->pSoftFontInfo); - priv->pSoftFontInfo = (PclSoftFontInfoPtr) NULL; - - /* - * Clear out the colormap cache - */ - p = priv->palettes; - while( p ) - { - p->downloaded = 0; - p = p->next; - } - - return Success; -} - -/* StartPage - * - * If page file exists - * close page file - * set page file pointer = NULL - * unlink page file - * Create a new page file - * Send the page header information to the page file - * ClearArea the window and all descendant windows - */ -int -PclStartPage( - XpContextPtr pCon, - WindowPtr pWin) -{ - PclContextPrivPtr pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); - xRectangle repro; - char t[80]; - XpOid orient, plex, tray, medium; - int dir, plexNum, num; - - /* - * Put a pointer to the context in the window private structure - */ - pWinPriv->validContext = 1; - pWinPriv->context = pCon; - - /* - * Clear out the old page file, if necessary - */ - if(pConPriv->pPageFile != (FILE *)NULL) - { - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - } - if(pConPriv->pageFileName != (char *)NULL) - { - unlink(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - } - - /* - * Make up a new page file. - */ - if (!XpOpenTmpFile("w+", &pConPriv->pageFileName, &pConPriv->pPageFile)) - return BadAlloc; - - /* - * Reset the GC cached in the context private struct. - */ - pConPriv->validGC = 0; - - /* - * Set the page orientation - */ - orient = XpGetContentOrientation( pCon ); - switch( orient ) - { - case xpoid_val_content_orientation_landscape: - dir = 1; - break; - case xpoid_val_content_orientation_reverse_portrait: - dir = 2; - break; - case xpoid_val_content_orientation_reverse_landscape: - dir = 3; - break; - case xpoid_val_content_orientation_portrait: - default: - dir = 0; - break; - } - sprintf( t, "\033&l%dO", dir ); - SEND_PCL( pConPriv->pPageFile, t ); - - /* - * Set the duplexing method. Since PCL wants to think of it in - * terms of the "binding edge," and the attribute store thinks in - * "duplex/tumble," this is a little complicated. - * - * Actually, this has no bearing on the output, since the HP1600C - * will only print on one side of the paper, and ignore all - * requests to enable duplexing. But, in an attempt to keep this - * driver somewhat generic, we'll enable it anyway. - */ - plex = XpGetPlex( pCon ); - - if( plex == xpoid_val_plex_duplex ) - { - if( dir == 0 || dir == 2 ) - plexNum = 1; - else - plexNum = 2; - } - else if( plex == xpoid_val_plex_tumble ) - { - if( dir == 0 || dir == 2 ) - plexNum = 2; - else - plexNum = 1; - } - else - plexNum = 0; - sprintf( t, "\033&l%dS", plexNum ); - SEND_PCL( pConPriv->pPageFile, t ); - - /* - * Set the input tray or medium. If XpGetPageSize gives us a valid medium, - * we can just send that to the printer, and let the printer handle the - * details. Otherwise, we select the tray returned from XpGetPageSize, - * which will be either a tray that should contain the correct medium - * (possibly with operator intervention), or the default tray from the - * config files. - */ - medium = XpGetPageSize( pCon, &tray, NULL ); - if( medium != xpoid_none ) - { - switch( medium ) - { - case xpoid_val_medium_size_na_legal: - num = 3; - break; - case xpoid_val_medium_size_iso_a3: - num = 27; - break; - case xpoid_val_medium_size_iso_a4: - num = 26; - break; - case xpoid_val_medium_size_executive: - num = 1; - break; - case xpoid_val_medium_size_ledger: - num = 6; - break; - case xpoid_val_medium_size_monarch_envelope: - num = 80; - break; - case xpoid_val_medium_size_na_number_10_envelope: - num = 81; - break; - case xpoid_val_medium_size_iso_designated_long: - num = 90; - break; - case xpoid_val_medium_size_iso_c5: - num = 91; - break; - case xpoid_val_medium_size_iso_b5: - num = 100; - break; - case xpoid_val_medium_size_jis_b5: - num = 45; - break; - case xpoid_val_medium_size_na_letter: - default: - num = 2; - break; - } - sprintf( t, "\033&l%dA", num ); - SEND_PCL( pConPriv->pPageFile, t ); - } - else - { - switch( tray ) - { - case xpoid_val_input_tray_manual: - num = 2; - break; - case xpoid_val_input_tray_envelope: - num = 3; - break; - case xpoid_val_input_tray_large_capacity: - num = 5; - break; - case xpoid_val_input_tray_bottom: - num = 4; - break; - case xpoid_val_input_tray_main: - default: - num = 1; - break; - } - sprintf( t, "\033&l%dH", num ); - SEND_PCL( pConPriv->pPageFile, t ); - } - - /* - * Set the scaling factors so that the HP-GL/2 coordinate system - * matches the X coordinate system, both in axis orientation and - * in unit<->pixel conversion. - */ - XpGetReproductionArea( pCon, &repro ); - - sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y ); - SEND_PCL( pConPriv->pPageFile, t ); - - sprintf( t, "\033*c%dx%dY\033*c0T", (int)(repro.width / 300.0 * 720.0), - (int)(repro.height / 300.0 * 720.0) ); - SEND_PCL( pConPriv->pPageFile, t ); - - sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x + - repro.width, repro.y + repro.height, repro.y ); - SEND_PCL( pConPriv->pPageFile, t ); - - return Success; -} - -/* - * When sending the generated PCL code back to the client, we send everything - * that we have generated so far for the job. After sending the data, we clean - * out the job file, to avoid repeatedly sending the same data. - */ - -static int -SendDocData( PclContextPrivPtr pPriv ) -{ - struct stat statBuf; - int ret; - - rewind( pPriv->pJobFile ); - if( stat( pPriv->jobFileName, &statBuf ) < 0 ) - return BadAlloc; - - ret = XpSendDocumentData( pPriv->getDocClient, pPriv->pJobFile, - (int)statBuf.st_size, pPriv->getDocBufSize ); - - /* - * Clean out the job file - */ - fclose( pPriv->pJobFile ); - unlink( pPriv->jobFileName ); - - xfree(pPriv->jobFileName); - - if (!XpOpenTmpFile("w+", &pPriv->jobFileName, &pPriv->pJobFile)) - return BadAlloc; - - return ret; -} - -/* - * EndPage: - * - * Write page trailer to page file - * Write page file to job file - */ -int -PclEndPage( - XpContextPtr pCon, - WindowPtr pWin) -{ - PclContextPrivPtr pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - struct stat statBuf; - - /* - * Send the page trailer to the page file. - */ - SEND_PCL( pConPriv->pPageFile, "\014" ); - fflush( pConPriv->pPageFile ); - - /* - * Write the page file contents to the job file, or to the - * whatever client has called GetDocumentData. - * - * pWinPriv->pPageFile must first be set to the start of the page file. - */ - rewind(pConPriv->pPageFile); - if(stat(pConPriv->pageFileName, &statBuf) < 0) - return BadAlloc; - - if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile, - (int)statBuf.st_size) != (int)statBuf.st_size) - return BadAlloc; - - if( pConPriv->getDocClient != (ClientPtr)NULL && - pConPriv->getDocBufSize > 0 ) - { - return SendDocData( pConPriv ); - } - - return Success; -} - -/* - * The PclStartDoc() and PclEndDoc() functions serve basically as NOOP - * placeholders. This driver doesn't deal with the notion of multiple - * documents per page. - */ - -int -PclStartDoc(XpContextPtr pCon, - XPDocumentType type) -{ - PclContextPrivPtr pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - -#ifndef XP_PCL_LJ3 - /* - * Set the printer resolution for the page. Since we can only - * render color at 300dpi, we just hard-code this. - */ - SEND_PCL( pConPriv->pJobFile, - "\033%-12345X@PJL SET RESOLUTION = 300\r\n" ); -#endif /* XP_PCL_LJ3 */ - - /* - * Initialize HP-GL/2 - */ - SEND_PCL( pConPriv->pJobFile, "\033E\033%0BIN,SP1,TR0;\033%0A" ); - - /* - * Stash the type of the document (used by PutDocumentData operation) - */ - pConPriv->isRaw = (type == XPDocRaw); - - return Success; -} - -int -PclEndDoc( - XpContextPtr pCon, - Bool cancel) -{ - /* - * XXX What should I do if I get cancel == TRUE? - */ - return Success; -} - -/* - * PclDocumentData() - * - * Hand any pre-generated PDL down to the spool files, formatting it - * as necessary to fit the given window. - * - */ - -#define DOC_PCL 1 -#define DOC_HPGL 2 - -int -PclDocumentData( - XpContextPtr pCon, - DrawablePtr pDraw, - char *pData, - int len_data, - char *pFmt, - int len_fmt, - char *pOpt, - int len_opt, - ClientPtr client) -{ - int type = 0; - PclContextPrivPtr pPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - XpOidDocFmtList *formats; - XpOidDocFmt *f; - char t[80]; - xRectangle repro; - - /* - * Verify the input format - */ - formats = XpGetDocFmtListAttr( pCon, XPPrinterAttr, - (pPriv->isRaw) ? - xpoid_att_xp_raw_formats_supported : - xpoid_att_xp_embedded_formats_supported, - NULL ); - f = XpOidDocFmtNew( pFmt ); - if( !XpOidDocFmtListHasFmt( formats, f ) ) - { - XpOidDocFmtListDelete( formats ); - XpOidDocFmtDelete( f ); - return BadMatch; - } - XpOidDocFmtListDelete( formats ); - - if( !(pPriv->isRaw) ) - { - if( !strcmp( f->format, "PCL" ) ) - type = DOC_PCL; - else if( !strcmp( f->format, "HPGL" ) ) - type = DOC_HPGL; - else - { - XpOidDocFmtDelete( f ); - return BadMatch; - } - - switch( type ) - { - case DOC_HPGL: - /* - * Move the picture frame to the appropriate place on the page, - * then assume that the embedded code will scale it properly. - */ - sprintf( t, "\033&l0E\033*p%dx%dY", - pDraw->x - 75, - pDraw->y ); - SEND_PCL( pPriv->pPageFile, t ); - - sprintf( t, "\033*c%dx%dY\033*coT", - (int)( pDraw->width / 300.0 * 720.0 ), - (int)( pDraw->height / 300.0 * 720.0 ) ); - SEND_PCL( pPriv->pPageFile, t ); - break; - } - } - - - /* - * Send the data down the pipe - */ - SEND_PCL_COUNT( pPriv->pPageFile, pData, len_data ); - - /* - * If it's not a raw document, clean up the embedding - */ - if( !(pPriv->isRaw) ) - switch( type ) - { - case DOC_HPGL: - /* - * Reset the picture frame - */ - XpGetReproductionArea( pCon, &repro ); - - sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y ); - SEND_PCL( pPriv->pPageFile, t ); - - sprintf( t, "\033*c%dx%dY\033*c0T", - (int)(repro.width / 300.0 * 720.0), - (int)(repro.height / 300.0 * 720.0) ); - SEND_PCL( pPriv->pPageFile, t ); - - sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x + - repro.width, repro.y + repro.height, repro.y ); - SEND_PCL( pPriv->pPageFile, t ); - break; - } - - XpOidDocFmtDelete( f ); - return Success; -} - -/* - * - * PclGetDocumentData() - * - * This function allows the driver to send the generated PCL back to - * the client. - * - * XXX This function is barely spec'ed, much less implemented! - */ - -int -PclGetDocumentData( - XpContextPtr pCon, - ClientPtr client, - int maxBufferSize) -{ - PclContextPrivPtr pPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - - pPriv->getDocClient = client; - pPriv->getDocBufSize = maxBufferSize; - - return Success; -} diff --git a/hw/xprint/pcl/PclSFonts.c b/hw/xprint/pcl/PclSFonts.c deleted file mode 100644 index 2474d90d7..000000000 --- a/hw/xprint/pcl/PclSFonts.c +++ /dev/null @@ -1,427 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclSFonts.c -** * -** * Contents: -** * Send Soft Font Download data to the specified -** * file pointer. -** * -** * Created: 3/4/96 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include "Pcl.h" - -static char tmp1; -static short tmp2; -#define Put1byte(fp, x) tmp1=x; fwrite((char *)&tmp1, 1, 1, fp) -#define Put2bytes(fp, x) tmp2=x; fwrite((char *)&tmp2, 2, 1, fp) - -#define ESC 0x1b -#define SYMBOL_SET 277 - -static unsigned int PclDownloadChar(FILE *,PclCharDataPtr,unsigned short,unsigned char); -static unsigned int PclDownloadHeader(FILE *, PclFontDescPtr, unsigned short); - -#ifdef PCL_FONT_COMPRESS -static unsigned char *compress_bitmap_data(PclCharDataPtr, unsigned int *); -#endif /* PCL_FONT_COMPRESS */ - -/* -*- PclDownloadSoftFont8 -*- - * Send the Character Definition Command for 8-bit font - * **************************************************************************/ -void -PclDownloadSoftFont8( - FILE *fp, - PclSoftFontInfoPtr pSoftFontInfo, - PclFontHead8Ptr pfh, - PclCharDataPtr pcd, - unsigned char *code -) -{ - /* - * Check whether the font header has already been downloaded. - * If not, download it. - */ - - if ( !pfh->fid ) { - pfh->fid = pSoftFontInfo->cur_max_fid++; - PclDownloadHeader(fp, &(pfh->fd), pfh->fid); - } - pfh->index[*code] = *code; - PclDownloadChar(fp, pcd, pfh->fid, pfh->index[*code]); - -} - -/* -*- PclDownloadSoftFont16 -*- - * Send the Character Definition Command for 16 bit font - * **************************************************************************/ -void -PclDownloadSoftFont16( - FILE *fp, - PclSoftFontInfoPtr pSoftFontInfo, - PclFontHead16Ptr pfh, - PclCharDataPtr pcd, - unsigned char row, - unsigned char col -) -{ - /* - * Check whether the font header is already downloaded. - * If not, download it. - */ - - if ( !pfh->cur_cindex ) { - pfh->cur_fid = pSoftFontInfo->cur_max_fid++; - PclDownloadHeader(fp, &(pfh->fd), pfh->cur_fid); - } - pfh->index[row][col].fid = pfh->cur_fid; - pfh->index[row][col].cindex = pfh->cur_cindex++; - - PclDownloadChar(fp, pcd, pfh->index[row][col].fid, pfh->index[row][col].cindex); -} - -/* -*- PclCreateSoftFontInfo -*- - * Create and Initialize the structure for storing the information - * of the downloaded soft font. - * **************************************************************************/ -PclSoftFontInfoPtr -PclCreateSoftFontInfo(void) -{ -PclSoftFontInfoPtr pSoftFontInfo; - - pSoftFontInfo = (PclSoftFontInfoPtr)xalloc(sizeof(PclSoftFontInfoRec)); - if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL) - return (PclSoftFontInfoPtr) NULL; - pSoftFontInfo->phead8 = (PclFontHead8Ptr)NULL; - pSoftFontInfo->phead16 = (PclFontHead16Ptr)NULL; - pSoftFontInfo->pinfont = (PclInternalFontPtr)NULL; - pSoftFontInfo->cur_max_fid = 1; - return pSoftFontInfo; -} - -/* -*- PclDestroySoftFontInfo -*- - * Destroy the soft font information structure - * **************************************************************************/ -void -PclDestroySoftFontInfo( PclSoftFontInfoPtr pSoftFontInfo ) -{ -PclFontHead8Ptr pfh8, pfh8_next; -PclFontHead16Ptr pfh16, pfh16_next; -PclInternalFontPtr pin, pin_next; -unsigned char nindex_row; -int i; - - if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL ) - return; - - pfh8 = pSoftFontInfo->phead8; - while (pfh8 != (PclFontHead8Ptr) NULL) { - xfree(pfh8->fontname); - xfree(pfh8->index); - pfh8_next = pfh8->next; - xfree(pfh8); - pfh8 = pfh8_next; - } - - pfh16 = pSoftFontInfo->phead16; - while (pfh16 != (PclFontHead16Ptr) NULL) { - xfree(pfh16->fontname); - nindex_row = pfh16->lastRow - pfh16->firstRow + 1; - for (i=0; i<nindex_row; i++) - xfree(pfh16->index[i]); - xfree(pfh16->index); - pfh16_next = pfh16->next; - xfree(pfh16); - pfh16 = pfh16_next; - } - - pin = pSoftFontInfo->pinfont; - while (pin != (PclInternalFontPtr) NULL) { - xfree(pin->fontname); - pin_next = pin->next; - xfree(pin); - pin = pin_next; - } - - xfree(pSoftFontInfo); -} - -/* -*- PclDownloadHeader -*- - * Send the Font Header Commnad. - * Format 0 : Font Header for Pcl Bitmapped Fonts - * Format 20 : Font Header for Resolution Specified Bitmapped Fonts - * **************************************************************************/ -static unsigned int -PclDownloadHeader( - FILE *fp, - PclFontDescPtr fd, - unsigned short fid -) -{ -int nbytes; - -#ifdef XP_PCL_LJ3 - nbytes = 64; -#else - nbytes = 68; -#endif /* XP_PCL_LJ3 */ - /* - * Font ID Command : Esc *c#D - * (Default = 0, Range = 0 - 32767) - */ - fprintf(fp, "%c*c%dD", ESC, fid); - - /* - * Font Header Commnad : Esc )s#W[font header data] - * (Default = 0, Range = 0 - 32767) - */ - fprintf(fp, "%c)s%dW", ESC, nbytes); - - Put2bytes(fp, nbytes); /* Font Description Size */ -#ifdef XP_PCL_LJ3 - Put1byte(fp, 0); /* Header Format */ -#else - Put1byte(fp, 20); /* Header Format */ -#endif /* XP_PCL_LJ3 */ - Put1byte(fp, 2); /* Font Type */ - Put2bytes(fp, 0); /* Style MSB */ - Put2bytes(fp, fd->ascent); /* BaseLine Position */ - Put2bytes(fp, fd->cellwidth); /* Cell Width */ - Put2bytes(fp, fd->cellheight); /* Cell Height */ - Put1byte(fp, 0); /* Orienation */ - Put1byte(fp, fd->spacing); /* Spacing */ - Put2bytes(fp, SYMBOL_SET); /* Symbol Set */ - Put2bytes(fp, fd->pitch*4); /* font pitch */ - Put2bytes(fp, fd->cellheight * 4); /* Height */ - Put2bytes(fp, 0); /* x-Height */ - Put1byte(fp, 0); /* width type (normal) */ - Put1byte(fp, 0); /* Style LSB */ - Put1byte(fp, 0); /* Stroke Weight */ - Put1byte(fp, 5); /* Typeface LSB */ - Put1byte(fp, 0); /* Typeface MSB */ - Put1byte(fp, 0); /* Serif Style */ - Put1byte(fp, 0); /* Quality */ - Put1byte(fp, 0); /* Placement */ - Put1byte(fp, 0); /* Underline Position */ - Put1byte(fp, 0); /* Underline Thickness */ - Put2bytes(fp, fd->cellheight*1.2); /* Text Height */ - Put2bytes(fp, fd->cellwidth * 4); /* Text Width */ - Put2bytes(fp, 0); /* First Code */ - Put2bytes(fp, 255); /* Last Code */ - Put1byte(fp, 0); /* Pitch Extend */ - Put1byte(fp, 0); /* Height Extend */ - Put2bytes(fp, 0); /* Cap Height */ - Put2bytes(fp, 0); /* Font Number 1 */ - Put2bytes(fp, 0); /* Font Number 2 */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - Put2bytes(fp, 0); /* Font Name */ - -#ifdef XP_PCL_LJ3 - return 64; -#else - Put2bytes(fp, 300); /* X Resolution */ - Put2bytes(fp, 300); /* Y Resolution */ - return 68; -#endif /* XP_PCL_LJ3 */ - -} - -/* -*- PclDownloadCharacter -*- - * Send the Character Definition Command. - * **************************************************************************/ -static unsigned int -PclDownloadChar( - FILE *fp, - PclCharDataPtr cd, - unsigned short fid, - unsigned char code -) -{ -unsigned int nbytes, n; -unsigned char *raster; - - /* - * Font ID Command : Esc *c#D - * (Default = 0, Range = 0 - 32767) - * Character Code Command : Esc *c#E - * (Default = 0, Range = 0 - 65535) - */ - fprintf(fp, "%c*c%dd%dE", ESC, fid, code); - - /* - * Character Definition Command : Esc (s#W[character descriptor and data] - * (Default = N/A, Range = 0 - 32767) - */ - - nbytes = n = cd->height * ((cd->width + 7) / 8); -#ifdef PCL_FONT_COMPRESS - raster = compress_bitmap_data(cd, &nbytes); -#else - raster = (unsigned char *)NULL; -#endif /* PCL_FONT_COMPRESS */ - fprintf(fp, "%c(s%dW", ESC, nbytes + 16); - - Put1byte(fp, 4); /* Format */ - Put1byte(fp, 0); /* Continuation */ - Put1byte(fp, 14); /* Descriptor Size */ - if (raster) { /* Class */ - Put1byte(fp, 2); - } else { - Put1byte(fp, 1); /* Class */ - } - Put2bytes(fp, 0); /* Orientation */ - Put2bytes(fp, cd->h_offset); /* left offset */ - Put2bytes(fp, cd->v_offset); /* top offset */ - Put2bytes(fp, cd->width); /* character width */ - Put2bytes(fp, cd->height); /* character height */ - Put2bytes(fp, cd->font_pitch*4); /* delta X */ - - /* - * Raster Character Data - */ - if (raster) { - fwrite(raster, nbytes, 1, fp); - xfree(raster); - } else - fwrite(cd->raster_top, nbytes, 1, fp); - - return n + 16; -} - - -#ifdef PCL_FONT_COMPRESS -/* -*- compress_bitmap_data -*- - * Compress Bitmap data - * **************************************************************************/ -static unsigned char * -compress_bitmap_data( - PclCharDataPtr cd, - unsigned int *nbytes -) -{ -unsigned int byte_width; -unsigned char *raster, *rptr_s, *rptr_e, *rptr_end; -unsigned char *tmp_s, *tmp_ptr; -unsigned char *p; -unsigned char cur, pixel; -unsigned int num; - -int i, j, k, w; - - byte_width = (cd->width + 7) / 8; - *nbytes = cd->height * byte_width; - - /* Create buffer for storing compress bitmap glyph */ - raster = (unsigned char *)xalloc(*nbytes); - rptr_s = raster; - rptr_e = raster; - rptr_end = raster + *nbytes; - - tmp_s = (unsigned char *)xalloc(cd->width * 8 + 2); - - p = cd->raster_top; - for (i=0; i<cd->height; i++) { - tmp_ptr = tmp_s; - *tmp_ptr++ = 0; - if ( (*p>>7)&0x1 == 1 ) { - *tmp_ptr++ = 0; - cur = 1; - } else { - cur = 0; - } - num = 0; - for (j=0, w=0; j<byte_width; j++, p++) { - for (k=0; k<8 && w<cd->width; k++, w++) { - pixel = (*p>>(7-k))&0x1; - if ( pixel == cur ) { - num++; - } else { - cur = pixel; - while (num > 255) { - *tmp_ptr++ = 255; - *tmp_ptr++ = 0; - num -= 255; - } - *tmp_ptr++ = num; - num = 1; - } - } - } - if ( pixel == cur ) { - while (num > 255) { - *tmp_ptr++ = 255; - *tmp_ptr++ = 0; - num -= 255; - } - *tmp_ptr++ = num&0xff; - } else - *tmp_ptr++ = num; - - if ( ((rptr_e - rptr_s) == (tmp_ptr - tmp_s)) && - !memcmp(rptr_s+1, tmp_s+1, (tmp_ptr - tmp_s) - 1) ) - *rptr_s += 1; - else { - if ( rptr_e + (tmp_ptr - tmp_s) > rptr_end ) { - xfree(raster); - xfree(tmp_s); - return (unsigned char *)NULL; - } - memcpy (rptr_e, tmp_s, tmp_ptr - tmp_s); - rptr_s = rptr_e; - rptr_e = rptr_s + (tmp_ptr - tmp_s); - } - } - xfree(tmp_s); - *nbytes = rptr_e - raster; - - return raster; -} -#endif /* PCL_FONT_COMPRESS */ diff --git a/hw/xprint/pcl/PclSFonts.h b/hw/xprint/pcl/PclSFonts.h deleted file mode 100644 index c991263df..000000000 --- a/hw/xprint/pcl/PclSFonts.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _PCLFONTS_H -#define _PCLFONTS_H - -/* -*-H-*- -****************************************************************************** -****************************************************************************** -* -* File: PclFonts.h -* Description: Send Soft Font Download data to the specified file pointer. -* -* -****************************************************************************** -****************************************************************************** -*/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -typedef struct { - unsigned char fid; /* sfont font ID */ - unsigned char cindex; /* character indext */ -} PclFontMapRec, PclFontMapPtr; - -typedef struct { - int h_offset; - int v_offset; - unsigned int width; - unsigned int height; - int font_pitch; - unsigned char *raster_top; -} PclCharDataRec, *PclCharDataPtr; - -typedef struct { - unsigned char spacing; - unsigned int pitch; - unsigned int cellheight; - unsigned int cellwidth; - int ascent; - int descent; -} PclFontDescRec, *PclFontDescPtr; - -typedef struct _PclFontHead8Rec { - char *fontname; - PclFontDescRec fd; - unsigned short fid; - unsigned char *index; - struct _PclFontHead8Rec *next; -} PclFontHead8Rec, *PclFontHead8Ptr; - -typedef struct _PclFontHead16Rec { - char *fontname; - PclFontDescRec fd; - unsigned short cur_fid; - unsigned char cur_cindex; - PclFontMapRec **index; - unsigned short firstCol; - unsigned short lastCol; - unsigned short firstRow; - unsigned short lastRow; - struct _PclFontHead16Rec *next; -} PclFontHead16Rec, *PclFontHead16Ptr; - -typedef struct _PclInternalFontRec { - char *fontname; - float pitch; - float height; - char *pcl_font_name; - char *spacing; - struct _PclInternalFontRec *next; -} PclInternalFontRec, *PclInternalFontPtr; - -typedef struct { - PclFontHead8Ptr phead8; - PclFontHead16Ptr phead16; - PclInternalFontPtr pinfont; - unsigned char cur_max_fid; -} PclSoftFontInfoRec, *PclSoftFontInfoPtr; - -#define MONOSPACE 0 -#define PROPSPACE 1 - -#endif /* _PCLFONTS_H */ diff --git a/hw/xprint/pcl/PclSpans.c b/hw/xprint/pcl/PclSpans.c deleted file mode 100644 index 4951899ab..000000000 --- a/hw/xprint/pcl/PclSpans.c +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclSpans.c -** * -** * Contents: -** * Code to set and fill spans in the PCL DDX -** * -** * Created: 10/23/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Pcl.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PclFillSpans( - DrawablePtr pDrawable, - GCPtr pGC, - int nSpans, - DDXPointPtr pPoints, - int *pWidths, - int fSorted) -{ - char t[80]; - FILE *outFile; - int xoffset, yoffset; - xRectangle *rects, *r; - RegionPtr fillRegion, region = 0; - int i; - int nbox; - BoxPtr pbox; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return; - - /* - * Build a region out of the spans - */ - rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) ); - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - for( i = 0, r = rects; i < nSpans; i++, r++ ) - { - r->x = pPoints[i].x + xoffset; - r->y = pPoints[i].y + yoffset; - r->width = pWidths[i]; - r->height = 1; - } - fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ? - CT_YSORTED : CT_UNSORTED ); - - /* - * Intersect this region with the clip region. Whatever's left, - * should be filled. - */ - REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip ); - - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - /* Enter HP-GL/2 */ - SEND_PCL( outFile, "\27%0B" ); - - while( nbox ) - { - sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, - pbox->x2, pbox->y2 ); - SEND_PCL( outFile, t ); - - nbox--; - pbox++; - } - - /* Go back to PCL */ - SEND_PCL( outFile, "\27%0A" ); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, fillRegion ); - REGION_DESTROY( pGC->pScreen, region ); - xfree( rects ); -} - -void -PclSetSpans( - DrawablePtr pDrawable, - GCPtr pGC, - char *pSrc, - DDXPointPtr pPoints, - int *pWidths, - int nSpans, - int fSorted) -{ -} diff --git a/hw/xprint/pcl/PclText.c b/hw/xprint/pcl/PclText.c deleted file mode 100644 index 324de3014..000000000 --- a/hw/xprint/pcl/PclText.c +++ /dev/null @@ -1,934 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclText.c -** * -** * Contents: -** * Character-drawing routines for the PCL DDX -** * -** * Created: 10/23/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifdef DO_TWO_BYTE_PCL -#include "iconv.h" -#endif /* DO_TWO_BYTE_PCL */ -#include "gcstruct.h" -#include "windowstr.h" - -#include "Pcl.h" -#include "migc.h" -#include <X11/Xatom.h> - -#include "PclSFonts.h" - -static PclFontHead8Ptr makeFontHeader8 (FontPtr, PclSoftFontInfoPtr); -static PclFontHead16Ptr makeFontHeader16(FontPtr, PclSoftFontInfoPtr); -static PclInternalFontPtr makeInternalFont(FontPtr, PclSoftFontInfoPtr); -static void fillFontDescData(FontPtr, PclFontDescPtr, unsigned int); -static PclCharDataPtr fillCharDescData(PclCharDataPtr, CharInfoPtr); -static void output_text(FILE *, PclContextPrivPtr, unsigned char); -static char * getFontName(FontPtr); -static char isInternal(FontPtr); -static void selectInternalFont(FILE *, PclInternalFontPtr, int); -static void selectSize(FILE *, PclContextPrivPtr, PclInternalFontPtr); -static char t[80]; - -#ifdef DO_TWO_BYTE_PCL -static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *); -#endif /* DO_TWO_BYTE_PCL */ - -#define ESC 0x1b -#define PER 0x25 -#define ETX 0x3 -#define ETX_ALT 0x2a -#define DOWNLOAD_FONT 0 -#define INTERNAL_FONT 1 - -int -PclPolyText8( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - char *string) -{ -XpContextPtr pCon; -PclContextPrivPtr pConPriv; -unsigned long n, i; -int w; -CharInfoPtr charinfo[255], *chinfo; - -FILE *outFile; -PclSoftFontInfoPtr pSoftFontInfo; -PclFontHead8Ptr pfh8 = (PclFontHead8Ptr)NULL; -PclInternalFontPtr pin = (PclInternalFontPtr)NULL; -PclCharDataRec cd; -unsigned char *p; -unsigned char last_fid; -int max_ascent, max_descent; - -int nbox; -BoxPtr pbox; -BoxRec box; -RegionPtr drawRegion, region; -char font_type; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return x; - - GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string, - Linear8Bit, &n, charinfo); - if ( n == 0 ) - return x; - - pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - pSoftFontInfo = pConPriv->pSoftFontInfo; - font_type = isInternal(pGC->font); - if ( font_type == DOWNLOAD_FONT ) { - /* - * Create Soft Font Header Information - */ - pfh8 = makeFontHeader8(pGC->font, pSoftFontInfo); - if (!pfh8) - return x; - - /* - * exec Soft Font Downloading - */ - p = (unsigned char *)string; - for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) { - if ( !pfh8->index[*p] ) { - fillCharDescData(&cd, *chinfo); - PclDownloadSoftFont8(pConPriv->pJobFile, pSoftFontInfo, - pfh8, &cd, p); - xfree(cd.raster_top); - } - } - - /* - * print characters - */ - MACRO_START( outFile, pConPriv ); - sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;", - x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent, - ETX); - SAVE_PCL( outFile, pConPriv, t ); - SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 ); - - last_fid = 0; - w = 0; - max_ascent = charinfo[0]->metrics.ascent; - max_descent = charinfo[0]->metrics.descent; - p = (unsigned char *)string; - for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) { - if ( last_fid != pfh8->fid ) { - sprintf(t, "%c;FI%d;SS;LB", ETX, pfh8->fid); - SAVE_PCL( outFile, pConPriv, t ); - - last_fid = pfh8->fid; - } - - output_text(outFile, pConPriv, pfh8->index[*p]); - - w += (*chinfo)->metrics.characterWidth; - max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent); - max_descent = MAX(max_descent, (*chinfo)->metrics.descent); - } - - sprintf(t, "%c", ETX); - SAVE_PCL_COUNT( outFile, pConPriv, t, 1 ); - sprintf(t, "TD0;\033%%1A"); - SAVE_PCL( outFile, pConPriv, t ); - MACRO_END( outFile ); - - } else { - int fid = 0; - - pin = makeInternalFont(pGC->font, pSoftFontInfo); - if (!pin) - return x; - - selectInternalFont(outFile, pin, fid); - - /* - * print characters - */ - MACRO_START( outFile, pConPriv ); - sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;", - x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent, - ETX); - SAVE_PCL( outFile, pConPriv, t ); - selectSize(outFile, pConPriv, pin); - SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 ); - - w = 0; - max_ascent = charinfo[0]->metrics.ascent; - max_descent = charinfo[0]->metrics.descent; - p = (unsigned char *)string; - for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) { - output_text(outFile, pConPriv, *p); - - w += (*chinfo)->metrics.characterWidth; - max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent); - max_descent = MAX(max_descent, (*chinfo)->metrics.descent); - } - sprintf(t, "%c", ETX); - SAVE_PCL_COUNT( outFile, pConPriv, t, 1 ); - sprintf(t, "TD0;\033%%1A"); - SAVE_PCL( outFile, pConPriv, t ); - MACRO_END( outFile ); - } - - /* - * Convert the collection of rectangles into a proper region, then - * intersect it with the clip region. - */ - box.x1 = x + pDrawable->x; - box.y1 = y - max_ascent + pDrawable->y + pGC->font->info.fontAscent; - box.x2 = x + w + pDrawable->x; - box.y2 = y + max_descent + pDrawable->y + pGC->font->info.fontAscent; - - drawRegion = miRegionCreate( &box, 0 ); - region = miRegionCreate( NULL, 0 ); - miIntersect( region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the entire polyline to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - - return x+w; -} - -int -PclPolyText16( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *string) -{ -XpContextPtr pCon; -PclContextPrivPtr pConPriv; -unsigned long n, i; -int w; -CharInfoPtr charinfo[255], *chinfo; - -FILE *outFile; -PclSoftFontInfoPtr pSoftFontInfo; -PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL; -PclCharDataRec cd; -FontInfoPtr pfi; -unsigned char row, col; -char *p; -unsigned char last_fid; -int max_ascent, max_descent; -unsigned short def; - -int nbox; -BoxPtr pbox; -BoxRec box; -RegionPtr drawRegion, region; -char font_type; - - if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE ) - return x; - - GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string, - (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, - &n, charinfo); - - pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - pConPriv = (PclContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); - pSoftFontInfo = pConPriv->pSoftFontInfo; - - font_type = isInternal(pGC->font); - if ( font_type == DOWNLOAD_FONT ) { - /* - * Create Soft Font Header Information - */ - pfh16 = makeFontHeader16(pGC->font, pSoftFontInfo); - if (!pfh16) - return x; - - /* - * exec Soft Font Downloading - */ - pfi = (FontInfoRec *)&pGC->font->info; - p = (char *)string; - for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) { - row = *p & 0xff; - col = *(p+1) & 0xff; - if ( (pfi->firstRow <= row) && (row <= pfi->lastRow) - && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) { - row = row - pfi->firstRow; - col = col - pfi->firstCol; - } else { - def = pfi->defaultCh; - row = ((def>>8)&0xff) - pfi->firstRow; - col = (def&0xff) - pfi->firstCol; - } - if ( !pfh16->index[row][col].fid ) { - fillCharDescData(&cd, *chinfo); - PclDownloadSoftFont16(pConPriv->pJobFile, pSoftFontInfo, - pfh16, &cd, row, col); - xfree(cd.raster_top); - } - } - - /* - * print characters - */ - MACRO_START( outFile, pConPriv ); - sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;", - x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent, - ETX); - SAVE_PCL( outFile, pConPriv, t ); - SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 ); - - last_fid = 0; - - w = 0; - max_ascent = charinfo[0]->metrics.ascent; - max_descent = charinfo[0]->metrics.descent; - for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) { - row = *p & 0xff; - col = *(p+1) & 0xff; - if ( (pfi->firstRow <= row) && (row <= pfi->lastRow) - && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) { - row = row - pfi->firstRow; - col = col - pfi->firstCol; - } else { - def = pfi->defaultCh; - row = ((def>>8)&0xff) - pfi->firstRow; - col = (def&0xff) - pfi->firstCol; - } - if ( last_fid != pfh16->index[row][col].fid ) { - sprintf(t, "%cFI%d;SS;LB", - ETX, pfh16->index[row][col].fid); - SAVE_PCL( outFile, pConPriv, t ); - last_fid = pfh16->index[row][col].fid; - } - - output_text(outFile, pConPriv, pfh16->index[row][col].cindex); - - w += (*chinfo)->metrics.characterWidth; - max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent); - max_descent = MAX(max_descent, (*chinfo)->metrics.descent); - } - sprintf(t, "%c", ETX); - SAVE_PCL_COUNT( outFile, pConPriv, t, 1 ); - sprintf(t, "TD0;\033%%1A"); - SAVE_PCL( outFile, pConPriv, t ); - MACRO_END( outFile ); - - } else { -#ifdef DO_TWO_BYTE_PCL - PclInternalFontPtr pin; - int fid = 0; - - pin = makeInternalFont(pGC->font, pSoftFontInfo); - if (!pin) - return x; - - selectInternalFont(outFile, pin, fid); - fprintf(outFile, "%c&t31P", ESC); - - /* - * print characters - */ - MACRO_START( outFile, pConPriv ); - sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;", - x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent, - ETX); - SAVE_PCL( outFile, pConPriv, t ); - sprintf(t, "TD0;\033%%1A"); - SAVE_PCL( outFile, pConPriv, t ); - - w = 0; - last_fid = 0; - max_ascent = charinfo[0]->metrics.ascent; - max_descent = charinfo[0]->metrics.descent; - for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) { - char tobuf[3]; - code_conv(pSoftFontInfo, pGC->font, (char *)p, tobuf); - fprintf(outFile, "%c%c", tobuf[0], tobuf[1]); - - w += (*chinfo)->metrics.characterWidth; - max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent); - max_descent = MAX(max_descent, (*chinfo)->metrics.descent); - } - MACRO_END( outFile ); -#else - return x; -#endif /* DO_TWO_BYTE_PCL */ - } - - /* - * Convert the collection of rectangles into a proper region, then - * intersect it with the clip region. - */ - box.x1 = x + pDrawable->x; - box.y1 = y - max_ascent + pDrawable->y + pGC->font->info.fontAscent; - box.x2 = x + w + pDrawable->x; - box.y2 = y + max_descent + pDrawable->y + pGC->font->info.fontAscent; - - drawRegion = miRegionCreate( &box, 0 ); - region = miRegionCreate( NULL, 0 ); - miIntersect( region, drawRegion, pGC->pCompositeClip ); - - /* - * For each rectangle in the clip region, set the HP-GL/2 "input - * window" and render the entire polyline to it. - */ - pbox = REGION_RECTS( region ); - nbox = REGION_NUM_RECTS( region ); - - PclSendData(outFile, pConPriv, pbox, nbox, 1.0); - - /* - * Clean up the temporary regions - */ - REGION_DESTROY( pGC->pScreen, drawRegion ); - REGION_DESTROY( pGC->pScreen, region ); - - return x+w; -} - -void -PclImageText8( - DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - int count, - char *string) -{ -} - -void -PclImageText16( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *string) -{ -} - -void -PclImageGlyphBlt( - DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nGlyphs, - CharInfoPtr *pCharInfo, - pointer pGlyphBase) -{ -} - -void -PclPolyGlyphBlt( - DrawablePtr pDrawable, - GCPtr pGC, - int x, int y, - unsigned int nGlyphs, - CharInfoPtr *pCharInfo, - pointer pGlyphBase) -{ -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -static PclFontHead8Ptr -makeFontHeader8(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo) -{ -PclFontHead8Ptr phead8 = pSoftFontInfo->phead8; -PclFontHead8Ptr pfh8 = phead8; -PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL; -FontInfoPtr pfi; -char *fontname; -unsigned char nindex; -int i; -unsigned long n; -CharInfoPtr charinfo[1]; -unsigned int space_width; - - if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL) - return (PclFontHead8Ptr)NULL; - - /* - * Verify it has already been created, if so, return it. - */ - if ( (fontname = getFontName(pfont)) == (char *)NULL) - return (PclFontHead8Ptr)NULL; - - while (pfh8 != (PclFontHead8Ptr) NULL) { - if (!strcmp(pfh8->fontname, fontname)) - return pfh8; - prev = pfh8; - pfh8 = pfh8->next; - } - - /* - * Create Font Header Information - */ - pfh8 = (PclFontHead8Ptr)xalloc(sizeof(PclFontHead8Rec)); - if (pfh8 == (PclFontHead8Ptr)NULL) - return (PclFontHead8Ptr)NULL; - - pfi = (FontInfoRec *)&pfont->info; - GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh, - Linear8Bit, &n, charinfo); - if ( n ) - space_width = charinfo[0]->metrics.characterWidth; - else - space_width = FONTMAXBOUNDS(pfont,characterWidth); - - fillFontDescData(pfont, &(pfh8->fd), space_width); - pfh8->fid = 0; - pfh8->fontname = (char *)xalloc(strlen(fontname) + 1); - if (pfh8->fontname == (char *)NULL) { - xfree(pfh8); - return (PclFontHead8Ptr) NULL; - } - strcpy(pfh8->fontname, fontname); - - nindex = 0xff; - pfh8->index = (unsigned char *)xalloc(nindex); - if ( pfh8->index == (unsigned char *) NULL ) { - xfree(pfh8->fontname); - xfree(pfh8); - return (PclFontHead8Ptr) NULL; - } - - for (i=0; i<=nindex; i++) - pfh8->index[i] = 0x0; - - pfh8->next = (PclFontHead8Ptr)NULL; - - if ( prev == (PclFontHead8Ptr) NULL) - pSoftFontInfo->phead8 = pfh8; - else - prev->next = pfh8; - - return pfh8; -} - -static PclFontHead16Ptr -makeFontHeader16(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo) -{ -PclFontHead16Ptr phead16 = pSoftFontInfo->phead16; -PclFontHead16Ptr pfh16 = phead16; -PclFontHead16Ptr prev = (PclFontHead16Ptr)NULL; -PclFontMapRec ** index; -FontInfoPtr pfi; -char *fontname; -unsigned char nindex_row, nindex_col; -int i, j; -unsigned long n; -CharInfoPtr charinfo[1]; -unsigned int space_width; - - if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL) - return (PclFontHead16Ptr)NULL; - - /* - * Verify it has already been created, if so, return it. - */ - if ( (fontname = getFontName(pfont)) == (char *)NULL) - return (PclFontHead16Ptr)NULL; - - while (pfh16 != (PclFontHead16Ptr) NULL) { - if (!strcmp(pfh16->fontname, fontname)) - return pfh16; - prev = pfh16; - pfh16 = pfh16->next; - } - - /* - * Create Font Header Information - */ - pfh16 = (PclFontHead16Ptr)xalloc(sizeof(PclFontHead16Rec)); - if (pfh16 == (PclFontHead16Ptr)NULL) - return (PclFontHead16Ptr)NULL; - - pfi = (FontInfoRec *)&pfont->info; - GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh, - (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit, - &n, charinfo); - - if ( n ) - space_width = charinfo[0]->metrics.characterWidth; - else - space_width = FONTMAXBOUNDS(pfont,characterWidth); - - fillFontDescData(pfont, &(pfh16->fd), space_width); - pfh16->cur_fid = 0; - pfh16->cur_cindex = 0; - pfh16->fontname = (char *)xalloc(strlen(fontname) + 1); - if (pfh16->fontname == (char *)NULL) { - xfree(pfh16); - return (PclFontHead16Ptr) NULL; - } - strcpy(pfh16->fontname, fontname); - - pfi = (FontInfoRec *)&pfont->info; - nindex_col = pfi->lastCol - pfi->firstCol + 1; - nindex_row = pfi->lastRow - pfi->firstRow + 1; - index = (PclFontMapRec **)xalloc(sizeof(PclFontMapRec *)*nindex_row); - if (index == (PclFontMapRec **)NULL) { - xfree(pfh16->fontname); - xfree(pfh16); - return (PclFontHead16Ptr) NULL; - } - for (i=0; i<nindex_row; i++) { - index[i] = (PclFontMapRec *)xalloc(sizeof(PclFontMapRec)*nindex_col); - if (index[i] == (PclFontMapRec *)NULL) { - for(j=0; j<i; j++) - xfree(index[j]); - xfree(pfh16->fontname); - xfree(pfh16); - return (PclFontHead16Ptr) NULL; - } - for (j=0; j<=nindex_col; j++) - index[i][j].fid = 0x0; - } - - pfh16->index = index; - pfh16->firstCol = pfi->firstCol; - pfh16->lastCol = pfi->lastCol; - pfh16->firstRow = pfi->firstRow; - pfh16->lastRow = pfi->lastRow; - pfh16->next = (PclFontHead16Ptr)NULL; - - if ( prev == (PclFontHead16Ptr) NULL) - pSoftFontInfo->phead16 = pfh16; - else - prev->next = pfh16; - - return pfh16; -} - -static PclInternalFontPtr -makeInternalFont(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo) -{ -PclInternalFontPtr pinfont = pSoftFontInfo->pinfont; -PclInternalFontPtr pin = pinfont; -PclInternalFontPtr prev = (PclInternalFontPtr)NULL; -FontPropPtr props; -FontInfoPtr pfi; -char *fontname; -Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing; -int width = 1; -int mask; -int i; - - if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL) - return (PclInternalFontPtr)NULL; - - /* - * Verify it has already been created, if so, return it. - */ - if ( (fontname = getFontName(pfont)) == (char *)NULL) - return (PclInternalFontPtr)NULL; - - while (pin != (PclInternalFontPtr) NULL) { - if (!strcmp(pin->fontname, fontname)) - return pin; - prev = pin; - pin = pin->next; - } - - /* - * Create Internal Font Information - */ - pin = (PclInternalFontPtr)xalloc(sizeof(PclInternalFontRec)); - if (pin == (PclInternalFontPtr)NULL) - return (PclInternalFontPtr)NULL; - - pin->fontname = (char *)xalloc(strlen(fontname) + 1); - if (pin->fontname == (char *)NULL) { - xfree(pin); - return (PclInternalFontPtr) NULL; - } - strcpy(pin->fontname, fontname); - - xa_pcl_font_name = MakeAtom("PCL_FONT_NAME", strlen("PCL_FONT_NAME"), TRUE); - xa_res = MakeAtom("RESOLUTION_X", strlen("RESOLUTION_X"), TRUE); - xa_ave_width = MakeAtom("AVERAGE_WIDTH", strlen("AVERAGE_WIDTH"), TRUE); - xa_spacing = MakeAtom("SPACING", strlen("SPACING"), TRUE); - pfi = (FontInfoRec *)&pfont->info; - props = pfi->props; - - mask = 0; - for (i=0; i<pfi->nprops; i++, props++) { - if ( (Atom) props->name == xa_pcl_font_name ) { - pin->pcl_font_name = NameForAtom(props->value); - mask |= 0x1; - } else if ( props->name == XA_POINT_SIZE ) { - pin->height = (float) props->value / 10.0; - mask |= 0x2; - } else if ( (Atom) props->name == xa_res ) { - mask |= 0x4; - } else if ( (Atom) props->name == xa_ave_width ) { - width = (int) props->value / 10; - mask |= 0x8; - } else if ( (Atom) props->name == xa_spacing ) { - pin->spacing = NameForAtom(props->value); - mask |= 0x10; - } - } - if ( mask != 0x1f ) { - xfree(pin->fontname); - xfree(pin); - return (PclInternalFontPtr) NULL; - } - - if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) { - if (width == 0) - width = 1; - pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */ - } - - pin->next = (PclInternalFontPtr)NULL; - if ( prev == (PclInternalFontPtr) NULL) - pSoftFontInfo->pinfont = pin; - else - prev->next = pin; - - return pin; -} - -static void -fillFontDescData(FontPtr pfont, PclFontDescPtr pfd, unsigned int space) -{ -FontInfoPtr pfi; - - pfi = (FontInfoRec *)&pfont->info; - - if ( (pfi->maxbounds.leftSideBearing == pfi->minbounds.leftSideBearing) - && (pfi->maxbounds.rightSideBearing == pfi->minbounds.rightSideBearing) - && (pfi->maxbounds.characterWidth == pfi->minbounds.characterWidth) - && (pfi->maxbounds.ascent == pfi->minbounds.ascent) - && (pfi->maxbounds.descent == pfi->minbounds.descent) - ) - pfd->spacing = MONOSPACE; - else - pfd->spacing = PROPSPACE; - - pfd->pitch = space; - pfd->cellheight = FONTMAXBOUNDS(pfont,ascent) - + FONTMAXBOUNDS(pfont,descent); - pfd->cellwidth = FONTMAXBOUNDS(pfont,rightSideBearing) - - FONTMINBOUNDS(pfont,leftSideBearing); - pfd->ascent = FONTMAXBOUNDS(pfont,ascent); /*FONTASCENT(pfont);*/ - pfd->descent = FONTMAXBOUNDS(pfont,descent); /*FONTDESCENT(pfont);*/ -} - -static PclCharDataPtr -fillCharDescData(PclCharDataPtr pcd, CharInfoPtr pci) -{ -unsigned int byte_width; -unsigned char *p; -register int nbyGlyphWidth; -unsigned char *pglyph, *pg; -unsigned int i, j; - - pcd->h_offset = pci->metrics.leftSideBearing; - pcd->v_offset = pci->metrics.ascent; - pcd->width = pci->metrics.rightSideBearing - - pci->metrics.leftSideBearing; - pcd->height = pci->metrics.ascent + pci->metrics.descent; - pcd->font_pitch = pci->metrics.characterWidth; - - byte_width = (pcd->width + 7)/8; - pcd->raster_top = (unsigned char *)xalloc(byte_width * pcd->height); - if (pcd->raster_top == (unsigned char *)NULL) - return (PclCharDataPtr)NULL; - - p = pcd->raster_top; - nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci); - pglyph = FONTGLYPHBITS(pglyphBase, pci); - for (i=0; i<pcd->height; i++) { - pg = pglyph + nbyGlyphWidth * i; - for (j=0; j<byte_width; j++) - *p++ = *pg++; - } - return pcd; -} - -static void -output_text(FILE *outFile, - PclContextPrivPtr pConPriv, - unsigned char index) -{ - if ( index == ETX ) { - sprintf(t, "%c;DT%c,1;LB%c%c;DT%c,1;LB", - ETX, ETX_ALT, ETX, ETX_ALT, ETX); - SAVE_PCL( outFile, pConPriv, t ); - } else { - sprintf(t, "%c", index); - SAVE_PCL_COUNT( outFile, pConPriv, t, 1 ); - } -} - -static char * -getFontName(FontPtr pfont) -{ -int i; -FontInfoPtr pfi; -FontPropPtr props; -char *fontname; - - pfi = (FontInfoRec *)&pfont->info; - props = pfi->props; - fontname = (char *) NULL; - for (i=0; i<pfi->nprops; i++, props++) { - if ( props->name == XA_FONT ) { - fontname = (char *)NameForAtom(props->value); - break; - } - } - return fontname; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Internal Font Selection */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -static char -isInternal(FontPtr pfont) -{ -int i; -FontInfoPtr pfi; -FontPropPtr props; -Atom dest; - - dest = MakeAtom("PRINTER_RESIDENT_FONT", strlen("PRINTER_RESIDENT_FONT"), TRUE); - - pfi = (FontInfoRec *)&pfont->info; - props = pfi->props; - for (i=0; i<pfi->nprops; i++, props++) { - if ( (Atom) props->name == dest && props->value == 2 ) - return INTERNAL_FONT; - } - return DOWNLOAD_FONT; -} - -static void -selectInternalFont(FILE *outFile, PclInternalFontPtr pin, int fid) -{ - fprintf(outFile, "%c*c%dD", ESC, fid); - if ( *pin->spacing == 'P' || *pin->spacing == 'p' ) - fprintf(outFile, pin->pcl_font_name, pin->height); - else - fprintf(outFile, pin->pcl_font_name, pin->pitch); - fprintf(outFile, "%c*c6F", ESC); -} - -static void -selectSize(FILE *outFile, - PclContextPrivPtr pConPriv, - PclInternalFontPtr pin) -{ - if ( *pin->spacing == 'P' || *pin->spacing == 'p' ) { - sprintf(t, "SD4,%f;", pin->height); - SAVE_PCL( outFile, pConPriv, t ); - } else { - sprintf(t, "SD3,%f;", pin->pitch); - SAVE_PCL( outFile, pConPriv, t ); - } - return; -} - -#ifdef DO_TWO_BYTE_PCL -static void -code_conv( - PclSoftFontInfoPtr pSoftFontInfo, - FontPtr pfont, - char *from, - char *to -) -{ -iconv_t cd; -char frombuf[9], *fromptr; -size_t inbyte = 5, outbyte=2; - - fromptr = frombuf; - frombuf[0] = 0x1b; /* Esc */ - frombuf[1] = 0x24; /* $ */ - frombuf[2] = 0x42; /* B */ - frombuf[3] = *from; - frombuf[4] = *(from+1); - frombuf[5] = 0x1b; /* Esc */ - frombuf[6] = 0x28; /* ( */ - frombuf[7] = 0x4a; /* J */ - frombuf[8] = 0x0; - if ((cd = iconv_open("sjis", "jis")) == (iconv_t)(-1)) { - *to = (unsigned char)NULL; - return; - } - - if ( iconv(cd, &fromptr, &inbyte, &to, &outbyte) == -1 ) - *to = (unsigned char)NULL; - - iconv_close(cd); - return; -} -#endif /* DO_TWO_BYTE_PCL */ diff --git a/hw/xprint/pcl/PclWindow.c b/hw/xprint/pcl/PclWindow.c deleted file mode 100644 index 950933e49..000000000 --- a/hw/xprint/pcl/PclWindow.c +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************* -** -** ********************************************************* -** * -** * File: PclWindow.c -** * -** * Contents: -** * Window code for Pcl driver. -** * -** * Created: 2/02/95 -** * -** ********************************************************* -** -********************************************************************/ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/wait.h> - -#include "mistruct.h" -#include "regionstr.h" -#include "windowstr.h" -#include "gcstruct.h" - -#include "Pcl.h" - -#if 0 -/* - * The following list of strings defines the properties which will be - * placed on the screen's root window if the property was defined in - * the start-up configuration resource database. - */ -static /* const */ char *propStrings[] = { - DT_PRINT_JOB_HEADER, - DT_PRINT_JOB_TRAILER, - DT_PRINT_JOB_COMMAND, /* old-obsolete */ - DT_PRINT_JOB_EXEC_COMMAND, - DT_PRINT_JOB_EXEC_OPTIONS, - DT_PRINT_PAGE_HEADER, - DT_PRINT_PAGE_TRAILER, - DT_PRINT_PAGE_COMMAND, - (char *)NULL -}; -#endif - -/* - * PclCreateWindow - watch for the creation of the root window. - * When it's created, register the screen with the print extension, - * and put the default command/header properties on it. - */ -/*ARGSUSED*/ - -Bool -PclCreateWindow( - register WindowPtr pWin) -{ - PclWindowPrivPtr pPriv; - -#if 0 - Bool status = Success; - ScreenPtr pScreen = pWin->drawable.pScreen; - PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); - PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); - - /* - * Initialize this window's private struct. - */ - pWinPriv->jobFileName = (char *)NULL; - pWinPriv->pJobFile = (FILE *)NULL; - pWinPriv->pageFileName = (char *)NULL; - pWinPriv->pPageFile = (FILE *)NULL; - - if(pWin->parent == (WindowPtr)NULL) /* root window? */ - { - Atom propName; /* type = XA_STRING */ - char *propVal; - int i; - XrmDatabase rmdb = pScreenPriv->resDB; - - /* - * Put the defaults spec'd in the config files in properties on this - * screen's root window. - */ - for(i = 0; propStrings[i] != (char *)NULL; i++) - { - if((propVal = _DtPrintGetPrinterResource(pWin, rmdb, - propStrings[i])) != - (char *)NULL) - { - propName = MakeAtom(propStrings[i], strlen(propStrings[i]), - TRUE); - dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING, - 8, PropModeReplace, strlen(propVal), - (pointer)propVal, FALSE); - xfree(propVal); - } - } - } - - return status; -#endif - - /* - * Invalidate the window's private print context. - */ - pPriv = (PclWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); - pPriv->validContext = 0; - - return TRUE; -} - - -/*ARGSUSED*/ -Bool PclMapWindow( - WindowPtr pWindow) -{ - return TRUE; -} - -/*ARGSUSED*/ -Bool -PclPositionWindow( - register WindowPtr pWin, - int x, - int y) -{ - return TRUE; -} - -/*ARGSUSED*/ -Bool -PclUnmapWindow( - WindowPtr pWindow) -{ - return TRUE; -} - -/*ARGSUSED*/ -void -PclCopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ -} - -/*ARGSUSED*/ -Bool -PclChangeWindowAttributes( - register WindowPtr pWin, - register unsigned long mask) -{ - if( pWin->backingStore != NotUseful ) - { - pWin->backingStore = NotUseful; - mask |= CWBackingStore; - } - - return TRUE; -} - -/*ARGSUSED*/ -Bool -PclDestroyWindow( - WindowPtr pWin) -{ - return TRUE; -} - diff --git a/hw/xprint/pcl/Pclmap.h b/hw/xprint/pcl/Pclmap.h deleted file mode 100644 index 18ac31d90..000000000 --- a/hw/xprint/pcl/Pclmap.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _PCLMAP_H_ -#define _PCLMAP_H_ - -#ifdef XP_PCL_COLOR -#ifdef CATNAME -#undef CATNAME -#endif -#if !defined(UNIXCPP) || defined(ANSICPP) -#define PCLNAME(subname) PclCr##subname -#define CATNAME(prefix,subname) prefix##Color##subname -#else -#define PCLNAME(subname) PclCr/**/subname -#define CATNAME(prefix,subname) prefix/**/Color/**/subname -#endif -#endif /* XP_PCL_COLOR */ - -#ifdef XP_PCL_MONO -#ifdef CATNAME -#undef CATNAME -#endif -#if !defined(UNIXCPP) || defined(ANSICPP) -#define PCLNAME(subname) PclMn##subname -#define CATNAME(prefix,subname) prefix##Mono##subname -#else -#define PCLNAME(subname) PclMn/**/subname -#define CATNAME(prefix,subname) prefix/**/Mono/**/subname -#endif -#endif /* XP_PCL_MONO */ - -#ifdef XP_PCL_LJ3 -#ifdef CATNAME -#undef CATNAME -#endif -#if !defined(UNIXCPP) || defined(ANSICPP) -#define PCLNAME(subname) PclLj3##subname -#define CATNAME(prefix,subname) prefix##Lj3##subname -#else -#define PCLNAME(subname) PclLj3/**/subname -#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname -#endif -#endif /* XP_PCL_LJ3 */ - -#ifdef PCLNAME - -/* PclInit.c */ -#define InitializePclDriver CATNAME(Initialize, PclDriver) -#define PclCloseScreen PCLNAME(CloseScreen) -#define PclGetContextFromWindow PCLNAME(GetContextFromWindow) -#define PclScreenPrivateKey PCLNAME(ScreenPrivateKey) -#define PclWindowPrivateKey PCLNAME(WindowPrivateKey) -#define PclContextPrivateKey PCLNAME(ContextPrivateKey) -#define PclPixmapPrivateKey PCLNAME(PixmapPrivateKey) -#define PclGCPrivateKey PCLNAME(GCPrivateKey) - -/* PclPrint.c */ -#define PclStartJob PCLNAME(StartJob) -#define PclEndJob PCLNAME(EndJob) -#define PclStartPage PCLNAME(StartPage) -#define PclEndPage PCLNAME(EndPage) -#define PclStartDoc PCLNAME(StartDoc) -#define PclEndDoc PCLNAME(EndDoc) -#define PclDocumentData PCLNAME(DocumentData) -#define PclGetDocumentData PCLNAME(GetDocumentData) - -/* PclWindow.c */ -#define PclCreateWindow PCLNAME(CreateWindow) -#define PclMapWindow PCLNAME(MapWindow) -#define PclPositionWindow PCLNAME(PositionWindow) -#define PclUnmapWindow PCLNAME(UnmapWindow) -#define PclCopyWindow PCLNAME(CopyWindow) -#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes) -#define PclDestroyWindow PCLNAME(DestroyWindow) - -/* PclGC.c */ -#define PclCreateGC PCLNAME(CreateGC) -#define PclDestroyGC PCLNAME(DestroyGC) -#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff) -#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC) -#define PclSendPattern PCLNAME(SendPattern) -#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC) -#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip) -#define PclValidateGC PCLNAME(ValidateGC) - -/* PclAttr.c */ -#define PclGetAttributes PCLNAME(GetAttributes) -#define PclGetOneAttribute PCLNAME(GetOneAttribute) -#define PclAugmentAttributes PCLNAME(AugmentAttributes) -#define PclSetAttributes PCLNAME(SetAttributes) - -/* PclColor.c */ -#define PclLookUp PCLNAME(LookUp) -#define PclCreateDefColormap PCLNAME(CreateDefColormap) -#define PclCreateColormap PCLNAME(CreateColormap) -#define PclDestroyColormap PCLNAME(DestroyColormap) -#define PclInstallColormap PCLNAME(InstallColormap) -#define PclUninstallColormap PCLNAME(UninstallColormap) -#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps) -#define PclStoreColors PCLNAME(StoreColors) -#define PclResolveColor PCLNAME(ResolveColor) -#define PclFindPaletteMap PCLNAME(FindPaletteMap) -#define PclUpdateColormap PCLNAME(UpdateColormap) -#define PclReadMap PCLNAME(ReadMap) - -/* PclPixmap.c */ -#define PclCreatePixmap PCLNAME(CreatePixmap) -#define PclDestroyPixmap PCLNAME(DestroyPixmap) - -/* PclArc.c */ -#define PclDoArc PCLNAME(DoArc) -#define PclPolyArc PCLNAME(PolyArc) -#define PclPolyFillArc PCLNAME(PolyFillArc) - -/* PclArea.c */ -#define PclPutImage PCLNAME(PutImage) -#define PclCopyArea PCLNAME(CopyArea) -#define PclCopyPlane PCLNAME(CopyPlane) - -/* PclLine */ -#define PclPolyLine PCLNAME(PolyLine) -#define PclPolySegment PCLNAME(PolySegment) - -/* PclPixel.c */ -#define PclPolyPoint PCLNAME(PolyPoint) -#define PclPushPixels PCLNAME(PushPixels) - -/* PclPolygon.c */ -#define PclPolyRectangle PCLNAME(PolyRectangle) -#define PclFillPolygon PCLNAME(FillPolygon) -#define PclPolyFillRect PCLNAME(PolyFillRect) - -/* PclSpans.c */ -#define PclFillSpans PCLNAME(FillSpans) -#define PclSetSpans PCLNAME(SetSpans) - -/* PclText.c */ -#define PclPolyText8 PCLNAME(PolyText8) -#define PclPolyText16 PCLNAME(PolyText16) -#define PclImageText8 PCLNAME(ImageText8) -#define PclImageText16 PCLNAME(ImageText16) -#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt) -#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt) -#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt) - -/* PclFonts.c */ -#define PclRealizeFont PCLNAME(RealizeFont) -#define PclUnrealizeFont PCLNAME(UnrealizeFont) - -/* PclSFonts.c */ -#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8) -#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16) -#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo) -#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo) - -/* PclMisc.c */ -#define PclQueryBestSize PCLNAME(QueryBestSize) -#define GetPropString PCLNAME(GetPropString) -#define SystemCmd PCLNAME(SystemCmd) -#define PclGetMediumDimensions PCLNAME(GetMediumDimensions) -#define PclGetReproducibleArea PCLNAME(GetReproducibleArea) -#define PclSpoolFigs PCLNAME(SpoolFigs) -#define PclSendData PCLNAME(SendData) - -/* PclCursor.c */ -#define PclConstrainCursor PCLNAME(ConstrainCursor) -#define PclCursorLimits PCLNAME(CursorLimits) -#define PclDisplayCursor PCLNAME(DisplayCursor) -#define PclRealizeCursor PCLNAME(RealizeCursor) -#define PclUnrealizeCursor PCLNAME(UnrealizeCursor) -#define PclRecolorCursor PCLNAME(RecolorCursor) -#define PclSetCursorPosition PCLNAME(SetCursorPosition) - -#endif - -#endif /* _PCLMAP_H_ */ diff --git a/hw/xprint/ps/Makefile.am b/hw/xprint/ps/Makefile.am deleted file mode 100644 index 08638b19d..000000000 --- a/hw/xprint/ps/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -noinst_LTLIBRARIES = libps.la - -INCLUDES = -I$(top_srcdir)/hw/xprint - -AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ @FREETYPE_CFLAGS@ \ - -D_XP_PRINT_SERVER_ -DXP_PSTEXT - -libps_la_SOURCES = \ - PsArc.c \ - PsArea.c \ - PsAttr.c \ - PsAttVal.c \ - PsCache.c \ - PsColor.c \ - PsDef.h \ - PsFonts.c \ - PsGC.c \ - Ps.h \ - PsImageUtil.c \ - PsInit.c \ - PsLine.c \ - PsMisc.c \ - psout.c \ - psout.h \ - PsPixel.c \ - PsPixmap.c \ - PsPolygon.c \ - PsPrint.c \ - PsSpans.c \ - PsText.c \ - PsWindow.c - -EXTRA_DIST = PsFTFonts.c \ - psout_ft.c \ - psout_ftpstype1.c \ - psout_ftpstype3.c \ - ttf2pt1wrap.c - -if XP_USE_FREETYPE - AM_CFLAGS += -DXP_USE_FREETYPE - libps_la_SOURCES += $(EXTRA_DIST) -endif diff --git a/hw/xprint/ps/Ps.h b/hw/xprint/ps/Ps.h deleted file mode 100644 index a25e9891a..000000000 --- a/hw/xprint/ps/Ps.h +++ /dev/null @@ -1,600 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: Ps.h -** * -** * Contents: defines and includes for the Ps driver -** * for a printing X server. -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _PS_H_ -#define _PS_H_ - -#include <stdio.h> - -#ifdef abs -#undef abs /* this is because of a non-Spec1170ness in misc.h */ -#endif -#include <stdlib.h> -#include "scrnintstr.h" -#include "dix.h" - -#include "PsDef.h" -#include "psout.h" - -#include <X11/extensions/Print.h> -#include <X11/extensions/Printstr.h> - -#include "regionstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" -#include "gcstruct.h" - -/* - * Some sleazes to force the XrmDB stuff into the server - */ -#ifndef HAVE_XPointer -typedef char *XPointer; -#define Status int -#define True 1 -#define False 0 -#endif - -#include "misc.h" -#include <X11/Xfuncproto.h> -#include <X11/Xresource.h> -#include "attributes.h" - - -/* - * Public index variables from PsInit.c - */ - -extern DevPrivateKey PsScreenPrivateKey; -extern DevPrivateKey PsWindowPrivateKey; -extern DevPrivateKey PsContextPrivateKey; -extern DevPrivateKey PsPixmapPrivateKey; -extern XpValidatePoolsRec PsValidatePoolsRec; - -/* - * Display list structures - */ - -#define DPY_BLOCKSIZE 4096 - -typedef struct -{ - int mode; - int nPoints; - xPoint *pPoints; -} PsPolyPointsRec; - -typedef struct -{ - int nSegments; - xSegment *pSegments; -} PsSegmentsRec; - -typedef struct -{ - int nRects; - xRectangle *pRects; -} PsRectanglesRec; - -typedef struct -{ - int nArcs; - xArc *pArcs; -} PsArcsRec; - -typedef struct -{ - int x; - int y; - int count; - char *string; -} PsText8Rec; - -typedef struct -{ - int x; - int y; - int count; - unsigned short *string; -} PsText16Rec; - -typedef struct -{ - int depth; - int x; - int y; - int w; - int h; - int leftPad; - int format; - int res; /* image resolution */ - char *pData; -} PsImageRec; - -typedef struct -{ - int x; - int y; - int w; - int h; -} PsFrameRec; - -typedef enum -{ - PolyPointCmd, - PolyLineCmd, - PolySegmentCmd, - PolyRectangleCmd, - FillPolygonCmd, - PolyFillRectCmd, - PolyArcCmd, - PolyFillArcCmd, - Text8Cmd, - Text16Cmd, - TextI8Cmd, - TextI16Cmd, - PutImageCmd, - BeginFrameCmd, - EndFrameCmd -} DisplayElmType; - -typedef struct _DisplayElmRec -{ - DisplayElmType type; - GCPtr gc; - union - { - PsPolyPointsRec polyPts; - PsSegmentsRec segments; - PsRectanglesRec rects; - PsArcsRec arcs; - PsText8Rec text8; - PsText16Rec text16; - PsImageRec image; - PsFrameRec frame; - } c; -} DisplayElmRec; - -typedef DisplayElmRec *DisplayElmPtr; - -typedef struct _DisplayListRec -{ - struct _DisplayListRec *next; - int nelms; - DisplayElmRec elms[DPY_BLOCKSIZE]; -} DisplayListRec; - -typedef DisplayListRec *DisplayListPtr; - -/* - * Private structures - */ - -typedef struct -{ - XrmDatabase resDB; - Bool (*DestroyWindow)(WindowPtr); -} PsScreenPrivRec, *PsScreenPrivPtr; - -typedef struct PsFontTypeInfoRec PsFontTypeInfoRec; - -/* Structure to hold information about one font on disk - * Notes: - * - multiple XLFD names can refer to the same |PsFontTypeInfoRec| (if - * they all use the same font on the disk) - * - the FreeType font download code uses multiple |PsFontTypeInfoRec| - * records for one font on disk if they differ in the encoding being - * used (this is an exception from the - * 'one-|PsFontTypeInfoRec|-per-font-on-disk'-design; maybe it it is better - * to rework that in a later step and add a new per-encoding structure). - */ -struct PsFontTypeInfoRec -{ - PsFontTypeInfoRec *next; /* Next record in list... */ - char *adobe_ps_name; /* PostScript font name (from the - * "_ADOBE_POSTSCRIPT_FONTNAME" atom) */ - char *download_ps_name; /* PostScript font name used for font download */ - char *filename; /* File name of font */ -#ifdef XP_USE_FREETYPE - char *ft_download_encoding; /* encoding used for download */ - PsFTDownloadFontType ft_download_font_type; /* PS font type used for download (e.g. Type1/Type3/CID/etc.) */ -#endif /* XP_USE_FREETYPE */ - int is_iso_encoding; /* Is this font encoded in ISO Latin 1 ? */ - int font_type; /* See PSFTI_FONT_TYPE_* below... */ - Bool downloadableFont; /* Font can be downloaded */ - Bool alreadyDownloaded[256]; /* Font has been downloaded (for 256 8bit "sub"-font) */ -}; - -#define PSFTI_FONT_TYPE_OTHER (0) -#define PSFTI_FONT_TYPE_PMF (1) -#define PSFTI_FONT_TYPE_PS_TYPE1_PFA (2) -#define PSFTI_FONT_TYPE_PS_TYPE1_PFB (3) -#define PSFTI_FONT_TYPE_TRUETYPE (4) -/* PSFTI_FONT_TYPE_FREETYPE is means the font is handled by the freetype engine */ -#define PSFTI_FONT_TYPE_FREETYPE (5) - -typedef struct PsFontInfoRec PsFontInfoRec; - -/* Structure which represents our context info for a single XLFD font - * Note that multiple |PsFontInfoRec| records can share the same - * |PsFontTypeInfoRec| record - the |PsFontInfoRec| records represent - * different appearances of the same font on disk(=|PsFontTypeInfoRec|)). - */ -struct PsFontInfoRec -{ - PsFontInfoRec *next; /* Next record in list... */ - /* |font| and |font_fontPrivate| are used by |PsFindFontInfoRec()| to - * identify a font */ - FontPtr font; /* The font this record is for */ - pointer font_fontPrivate; - PsFontTypeInfoRec *ftir; /* Record about the font file on disk */ - const char *dfl_name; /* XLFD for this font */ - int size; /* Font size. Use |mtx| if |size==0| */ - float mtx[4]; /* Transformation matrix (see |size|) */ -}; - -typedef struct -{ - char *jobFileName; - FILE *pJobFile; - GC lastGC; - unsigned char *dash; - int validGC; - ClientPtr getDocClient; - int getDocBufSize; - PsOutPtr pPsOut; - PsFontTypeInfoRec *fontTypeInfoRecords; - PsFontInfoRec *fontInfoRecords; -} PsContextPrivRec, *PsContextPrivPtr; - -typedef struct -{ - int validContext; - XpContextPtr context; -} PsWindowPrivRec, *PsWindowPrivPtr; - -typedef struct -{ - XpContextPtr context; - GC lastGC; - int validGC; - DisplayListPtr dispList; -} PsPixmapPrivRec, *PsPixmapPrivPtr; - -/* - * Macro functions - */ - -#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f ) -#define MIN(a,b) (((a)<(b))?(a):(b)) -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - -/* - * Functions in PsInit.c - */ - -extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc, - char **argv); -extern XpContextPtr PsGetContextFromWindow(WindowPtr win); - -/* - * Functions in PsCache.c - */ - -extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer); -extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer); -extern void PsBmClearImageCache(void); - -/* - * Functions in PsPrint.c - */ - -extern int PsStartJob(XpContextPtr pCon, Bool sendClientData, ClientPtr client); -extern int PsEndJob(XpContextPtr pCon, Bool cancel); -extern int PsStartPage(XpContextPtr pCon, WindowPtr pWin); -extern int PsEndPage(XpContextPtr pCon, WindowPtr pWin); -extern int PsStartDoc(XpContextPtr pCon, XPDocumentType type); -extern int PsEndDoc(XpContextPtr pCon, Bool cancel); -extern int PsDocumentData(XpContextPtr pCon, DrawablePtr pDraw, char *pData, - int len_data, char *pFmt, int len_fmt, char *pOpt, int len_opt, - ClientPtr client); -extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client, - int maxBufferSize); - -/* - * Functions in PsGC.c - */ - -extern Bool PsCreateGC(GCPtr pGC); -extern PsContextPrivPtr PsGetPsContextPriv( DrawablePtr pDrawable ); -extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable, - PsOutPtr *psOut, ColormapPtr *cMap); -extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable); -extern void PsChangeGC(GCPtr pGC, unsigned long changes); -extern void PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -extern void PsDestroyGC(GCPtr pGC); -extern void PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects); -extern void PsDestroyClip(GCPtr pGC); -extern void PsCopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -extern GCPtr PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc); - -/* - * Functions in PsMisc.c - */ - -extern void PsQueryBestSize(int type, short *pwidth, short *pheight, - ScreenPtr pScreen); -extern Bool PsCloseScreen(int index, ScreenPtr pScreen); -extern void PsLineAttrs(PsOutPtr psOut, GCPtr pGC, ColormapPtr cMap); -extern int PsGetMediumDimensions( - XpContextPtr pCon, - CARD16 *pWidth, - CARD16 *pHeight); -extern int PsGetReproducibleArea( - XpContextPtr pCon, - xRectangle *pRect); -extern int PsSetImageResolution( - XpContextPtr pCon, - int imageRes, - Bool *status); - -/* - * Functions in PsSpans.c - */ - -extern void PsFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, - DDXPointPtr pPoints, int *pWidths, int fSorted); -extern void PsSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *pSrc, - DDXPointPtr pPoints, int *pWidths, int nSpans, - int fSorted); - -/* - * Functions in PsArea.c - */ - -extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, int format, - int imageRes, char *pImage); -extern void PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, - int format, int imageRes, char *pImage); -extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, - int x, int y, int w, int h, int leftPad, int format, - char *pImage); -extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, char *pImage); -extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty); -extern RegionPtr PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long plane); - -/* - * Functions in PsPixel.c - */ - -extern void PsPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, - int nPoints, xPoint *pPoints); -extern void PsPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDrawable, - int width, int height, int x, int y); - -/* - * Functions in PsLine.c - */ - -extern void PsPolyLine(DrawablePtr pDrawable, GCPtr pGC, int mode, - int nPoints, xPoint *pPoints); -extern void PsPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments, - xSegment *pSegments); - -/* - * Functions in PsPolygon.c - */ - -extern void PsPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRects, - xRectangle *pRects); -extern void PsFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, - int mode, int nPoints, DDXPointPtr pPoints); -extern void PsPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRects, - xRectangle *pRects); - -/* - * Functions in PsPolygon.c - */ - -extern void PsPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, - xArc *pArcs); -extern void PsPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, - xArc *pArcs); - -/* - * Functions in PsText.c - */ - -extern int PsPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - int count, char *string); -extern int PsPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - int count, unsigned short *string); -extern void PsImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - int count, char *string); -extern void PsImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - int count, unsigned short *string); -extern void PsImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nGlyphs, CharInfoPtr *pCharInfo, - pointer pGlyphBase); -extern void PsPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, - unsigned int nGlyphs, CharInfoPtr *pCharInfo, - pointer pGlyphBase); - -/* - * Functions in PsWindow.c - */ - -extern Bool PsCreateWindow(WindowPtr pWin); -extern Bool PsMapWindow(WindowPtr pWin); -extern Bool PsPositionWindow(WindowPtr pWin, int x, int y); -extern Bool PsUnmapWindow(WindowPtr pWin); -extern void PsCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, - RegionPtr prgnSrc); -extern Bool PsChangeWindowAttributes(WindowPtr pWin, unsigned long mask); -extern Bool PsDestroyWindow(WindowPtr pWin); - -/* - * Functions in PsFonts.c - */ - -extern Bool PsRealizeFont(ScreenPtr pscr, FontPtr pFont); -extern Bool PsUnrealizeFont(ScreenPtr pscr, FontPtr pFont); -extern char *PsGetFontName(FontPtr pFont); -extern int PsGetFontSize(FontPtr pFont, float *mtx); -extern char *PsGetPSFontName(FontPtr pFont); -extern char *PsGetPSFaceOrFontName(FontPtr pFont); -extern int PsIsISOLatin1Encoding(FontPtr pFont); -extern char *PsGetEncodingName(FontPtr pFont); -extern PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont); -extern void PsFreeFontInfoRecords(PsContextPrivPtr priv); -extern PsFTDownloadFontType PsGetFTDownloadFontType(void); - -/* - * Functions in PsFTFonts.c - */ - -extern char *PsGetFTFontFileName(FontPtr pFont); -extern Bool PsIsFreeTypeFont(FontPtr pFont); - -/* - * Functions in PsAttr.c - */ - -extern char *PsGetAttributes(XpContextPtr pCon, XPAttributes pool); -extern char *PsGetOneAttribute(XpContextPtr pCon, XPAttributes pool, - char *attr); -extern int PsAugmentAttributes(XpContextPtr pCon, XPAttributes pool, - char *attrs); -extern int PsSetAttributes(XpContextPtr pCon, XPAttributes pool, char *attrs); - -/* - * Functions in PsColor.c - */ - -extern Bool PsCreateColormap(ColormapPtr pColor); -extern void PsDestroyColormap(ColormapPtr pColor); -extern void PsInstallColormap(ColormapPtr pColor); -extern void PsUninstallColormap(ColormapPtr pColor); -extern int PsListInstalledColormaps(ScreenPtr pScreen, XID *pCmapList); -extern void PsStoreColors(ColormapPtr pColor, int ndef, xColorItem *pdefs); -extern void PsResolveColor(unsigned short *pRed, unsigned short *pGreen, - unsigned short *pBlue, VisualPtr pVisual); -extern PsOutColor PsGetPixelColor(ColormapPtr cMap, int pixval); -extern void PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut, - ColormapPtr cMap); - -/* - * Functions in PsPixmap.c - */ - -extern PixmapPtr PsCreatePixmap(ScreenPtr pScreen, int width, int height, - int depth, unsigned usage_hint); -extern void PsScrubPixmap(PixmapPtr pPixmap); -extern Bool PsDestroyPixmap(PixmapPtr pPixmap); -extern DisplayListPtr PsGetFreeDisplayBlock(PsPixmapPrivPtr priv); -extern void PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable); -extern void PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable); -extern int PsCloneDisplayElm(PixmapPtr dst, - DisplayElmPtr elm, DisplayElmPtr newElm, - int xoff, int yoff); -extern void PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff, - int yoff, int x, int y, int w, int h); -extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms); -extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms); -extern void PsDestroyFillElementList(int nElms, PsElmPtr elms); - -/* - * Functions in PsImageUtil.c - */ - -extern unsigned long -PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format, - int px, int py); - -#endif /* _PS_H_ */ diff --git a/hw/xprint/ps/PsArc.c b/hw/xprint/ps/PsArc.c deleted file mode 100644 index 0684307dd..000000000 --- a/hw/xprint/ps/PsArc.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsArc.c -** * -** * Contents: Arc-drawing code for the PS DDX driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PsPolyArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolyArcCmd; - elm->gc = gc; - elm->c.arcs.nArcs = nArcs; - elm->c.arcs.pArcs = (xArc *)xalloc(nArcs*sizeof(xArc)); - memcpy(elm->c.arcs.pArcs, pArcs, nArcs*sizeof(xArc)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - PsLineAttrs(psOut, pGC, cMap); - for( i=0 ; i<nArcs ; i++ ) - { - PsOut_DrawArc(psOut, (int)pArcs[i].x, (int)pArcs[i].y, - (int)pArcs[i].width, (int)pArcs[i].height, - (float)pArcs[i].angle1/64., - (float)pArcs[i].angle2/64.); - } - } -} - -void -PsPolyFillArc( - DrawablePtr pDrawable, - GCPtr pGC, - int nArcs, - xArc *pArcs) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolyFillArcCmd; - elm->gc = gc; - elm->c.arcs.nArcs = nArcs; - elm->c.arcs.pArcs = (xArc *)xalloc(nArcs*sizeof(xArc)); - memcpy(elm->c.arcs.pArcs, pArcs, nArcs*sizeof(xArc)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - PsArcEnum styl; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsSetFillColor(pDrawable, pGC, psOut, cMap); - PsLineAttrs(psOut, pGC, cMap); - if( pGC->arcMode==ArcChord ) styl = PsChord; - else styl = PsPieSlice; - for( i=0 ; i<nArcs ; i++ ) - { - PsOut_FillArc(psOut, (int)pArcs[i].x, (int)pArcs[i].y, - (int)pArcs[i].width, (int)pArcs[i].height, - (float)pArcs[i].angle1/64., - (float)pArcs[i].angle2/64., styl); - } - } -} diff --git a/hw/xprint/ps/PsArea.c b/hw/xprint/ps/PsArea.c deleted file mode 100644 index 6ab9fa25c..000000000 --- a/hw/xprint/ps/PsArea.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996, 2000 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsArea.c -** * -** * Contents: Image and Area functions for the PS DDX driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" - - -void -PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, int imageRes, char *pImage) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - int size = PixmapBytePad(w, depth)*h; - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - elm = &disp->elms[disp->nelms]; - elm->type = PutImageCmd; - elm->gc = gc; - elm->c.image.depth = depth; - elm->c.image.x = x; - elm->c.image.y = y; - elm->c.image.w = w; - elm->c.image.h = h; - elm->c.image.leftPad = leftPad; - elm->c.image.format = format; - elm->c.image.res = imageRes; - elm->c.image.pData = (char *)xalloc(size); - memcpy(elm->c.image.pData, pImage, size); - disp->nelms += 1; - } - else - { - int i, j; - int r, c; - PsOutPtr psOut; - ColormapPtr cMap; - int pageRes, sw, sh; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - if (!imageRes) { - sw = w; - sh = h; - } else { - pageRes = XpGetResolution(XpGetPrintContext(requestingClient)); - sw = (float)w * (float)pageRes / (float)imageRes + 0.5; - sh = (float)h * (float)pageRes / (float)imageRes + 0.5; - } - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - - if( depth!=1 ) - { - PsOut_BeginImage(psOut, 0, 0, x, y, w, h, sw, sh, 3); - - for( r=0 ; r<h ; r++ ) - { - for( c=0 ; c<w ; c++ ) - { - unsigned long pv = PsGetImagePixel(pImage, depth, w, h, leftPad, format, c, r); - PsOutColor clr = PsGetPixelColor(cMap, pv); - /* XXX: This needs to be fixed for endian swapping and to support - * depths deeper than 8bit per R-,G-,B-gun... */ - unsigned long val = PSOUTCOLOR_TO_RGB24BIT(clr); - char *ipt = (char *)&val; -/* XXX: Is this the right way to detect the platform endianess ? */ -#if IMAGE_BYTE_ORDER == LSBFirst - { - long l; - swapl(&val, l); - } -#elif IMAGE_BYTE_ORDER == MSBFirst -#else -#error Unsupported byte order -#endif - PsOut_OutImageBytes(psOut, 3, &ipt[1]); - } - } - - PsOut_EndImage(psOut); - } - else - { - int rowsiz = BitmapBytePad(w); - int psrsiz = (w+7)/8; - PsOut_BeginImage(psOut, PsGetPixelColor(cMap, pGC->bgPixel), - PsGetPixelColor(cMap, pGC->fgPixel), - x, y, w, h, sw, sh, 1); - for( r=0 ; r<h ; r++ ) - { - char *pt = &pImage[rowsiz*r]; - for( i=0 ; i<psrsiz ; i++ ) - { - int iv_, iv = (int)pt[i]&0xFF; - char c; -/* XXX: Is this the right way to detect the platform endianess ? */ -#if IMAGE_BYTE_ORDER == LSBFirst - { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); } -#elif IMAGE_BYTE_ORDER == MSBFirst - iv_ = iv; -#else -#error Unsupported byte order -#endif - c = iv_; - PsOut_OutImageBytes(psOut, 1, &c); - } - } - PsOut_EndImage(psOut); - } - } -} - -void -PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, int imageRes, char *pImage) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - int size = PixmapBytePad(w, depth)*h; - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - elm = &disp->elms[disp->nelms]; - elm->type = PutImageCmd; - elm->gc = gc; - elm->c.image.depth = depth; - elm->c.image.x = x; - elm->c.image.y = y; - elm->c.image.w = w; - elm->c.image.h = h; - elm->c.image.leftPad = leftPad; - elm->c.image.format = format; - elm->c.image.res = imageRes; - elm->c.image.pData = (char *)xalloc(size); - memcpy(elm->c.image.pData, pImage, size); - disp->nelms += 1; - } - else - { - int i, j; - int r, c; - PsOutPtr psOut; - ColormapPtr cMap; - int pageRes, sw, sh; -#ifdef BM_CACHE - long cache_id = 0; -#endif - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - if (!imageRes) { - sw = w; - sh = h; - } else { - pageRes = XpGetResolution(XpGetPrintContext(requestingClient)); - sw = (float)w * (float)pageRes / (float)imageRes + 0.5; - sh = (float)h * (float)pageRes / (float)imageRes + 0.5; - } - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - -#ifdef BM_CACHE - cache_id = PsBmIsImageCached(w, h, pImage); - - if(!cache_id) - { - cache_id = PsBmPutImageInCache(w, h, pImage); - - if(!cache_id) - return; - - PsOut_BeginImageCache(psOut, cache_id); -#endif - if( depth!=1 ) - { - PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3); - - for( r=0 ; r<h ; r++ ) - { - for( c=0 ; c<w ; c++ ) - { - unsigned long pv = PsGetImagePixel(pImage, depth, w, h, leftPad, format, c, r); - PsOutColor clr = PsGetPixelColor(cMap, pv); - /* XXX: This needs to be fixed for endian swapping and to support - * depths deeper than 8bit per R-,G-,B-gun... */ - unsigned long val = PSOUTCOLOR_TO_RGB24BIT(clr); - char *ipt = (char *)&val; -/* XXX: Is this the right way to detect the platform endianess ? */ -#if IMAGE_BYTE_ORDER == LSBFirst - { - long l; - swapl(&val, l); - } -#elif IMAGE_BYTE_ORDER == MSBFirst -#else -#error Unsupported byte order -#endif - PsOut_OutImageBytes(psOut, 3, &ipt[1]); - } - } - - PsOut_EndImage(psOut); - } - else - { - int rowsiz = BitmapBytePad(w); - int psrsiz = (w+7)/8; - PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel), - PsGetPixelColor(cMap, pGC->fgPixel), - x, y, w, h, sw, sh, 1); - for( r=0 ; r<h ; r++ ) - { - char *pt = &pImage[rowsiz*r]; - for( i=0 ; i<psrsiz ; i++ ) - { - int iv_, iv = (int)pt[i]&0xFF; - char c; -/* XXX: Is this the right way to detect the platform endianess ? */ -#if IMAGE_BYTE_ORDER == LSBFirst - { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); } -#elif IMAGE_BYTE_ORDER == MSBFirst - iv_ = iv; -#else -#error Unsupported byte order -#endif - c = iv_; - PsOut_OutImageBytes(psOut, 1, &c); - } - } - PsOut_EndImage(psOut); - } -#ifdef BM_CACHE - PsOut_EndImageCache(psOut); - } - PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel), - PsGetPixelColor(cMap, pGC->fgPixel)); -#endif - } -} -void -PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, char *pImage) -{ - XpContextPtr pcon; - if (requestingClient && (pcon = XpGetPrintContext(requestingClient))) - PsPutScaledImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, - pcon->imageRes, pImage); -} -void -PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, - int w, int h, int leftPad, int format, char *pImage) -{ - XpContextPtr pcon; - if (requestingClient && (pcon = XpGetPrintContext(requestingClient))) - PsPutScaledImageIM(pDrawable, pGC, depth, x, y, w, h, leftPad, format, - pcon->imageRes, pImage); -} - -RegionPtr -PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, - int width, int height, int dstx, int dsty) -{ - PixmapPtr src = (PixmapPtr)pSrc; - PixmapPtr dst = (PixmapPtr)pDst; - - if( pSrc->type!=DRAWABLE_PIXMAP ) return NULL; - if( pDst->type!=DRAWABLE_PIXMAP ) - { - PsOutPtr psOut; - ColormapPtr cMap; - if( PsUpdateDrawableGC(pGC, pDst, &psOut, &cMap)==FALSE ) return NULL; - PsOut_Offset(psOut, pDst->x, pDst->y); - PsOut_BeginFrame(psOut, dstx-srcx, dsty-srcy, dstx, dsty, width, height); - PsReplayPixmap(src, pDst); - PsOut_EndFrame(psOut); - } - else PsCopyDisplayList(src, dst, dstx-srcx, dsty-srcy, dstx, dsty, - width, height); - return NULL; -} - -RegionPtr -PsCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, - int width, int height, int dstx, int dsty, unsigned long plane) -{ - PixmapPtr src = (PixmapPtr)pSrc; - PixmapPtr dst = (PixmapPtr)pDst; - - if( pSrc->type!=DRAWABLE_PIXMAP ) return NULL; - if( pDst->type!=DRAWABLE_PIXMAP ) - { - PsOutPtr psOut; - ColormapPtr cMap; - if( PsUpdateDrawableGC(pGC, pDst, &psOut, &cMap)==FALSE ) return NULL; - PsOut_Offset(psOut, pDst->x, pDst->y); - PsOut_BeginFrame(psOut, dstx-srcx, dsty-srcy, dstx, dsty, width, height); - PsReplayPixmap(src, pDst); - PsOut_EndFrame(psOut); - } - else PsCopyDisplayList(src, dst, dstx-srcx, dsty-srcy, dstx, dsty, - width, height); - return NULL; -} diff --git a/hw/xprint/ps/PsAttVal.c b/hw/xprint/ps/PsAttVal.c deleted file mode 100644 index de2e6c8e4..000000000 --- a/hw/xprint/ps/PsAttVal.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - */ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "AttrValid.h" - -/* - * define valid values and defaults for Printer pool - */ -static XpOid ValidContentOrientationsOids[] = { - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape, - xpoid_val_content_orientation_reverse_portrait, - xpoid_val_content_orientation_reverse_landscape -}; -static XpOidList ValidContentOrientations = { - ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids) -}; - -static XpOid DefaultContentOrientationsOids[] = { - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape -}; -static XpOidList DefaultContentOrientations = { - DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids) -}; - -static XpOid ValidPlexesOids[] = { - xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble -}; -static XpOidList ValidPlexes = { - ValidPlexesOids, XpNumber(ValidPlexesOids) -}; - -static XpOid DefaultPlexesOids[] = { - xpoid_val_plex_simplex -}; -static XpOidList DefaultPlexes = { - DefaultPlexesOids, XpNumber(DefaultPlexesOids) -}; - -static unsigned long ValidPrinterResolutionsCards[] = { - 75, - 100, - 120, - 150, - 180, - 200, - 240, - 300, - 360, - 400, - 600, - 720, - 940, - 1200, - 1440, - 2400 -}; -static XpOidCardList ValidPrinterResolutions = { - ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards) -}; - -static unsigned long DefaultPrinterResolutionsCards[] = { - 75, - 100, - 120, - 150, - 180, - 200, - 240, - 300, - 360, - 400, - 600, - 720, - 940, - 1200 -}; -static XpOidCardList DefaultPrinterResolutions = { - DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards) -}; - -static XpOid ValidListfontsModesOids[] = { - xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts -}; -static XpOidList ValidListfontsModes = { - ValidListfontsModesOids, XpNumber(ValidListfontsModesOids) -}; - -static XpOid DefaultListfontsModesOids[] = { - xpoid_val_xp_list_glyph_fonts -}; -static XpOidList DefaultListfontsModes = { - DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids) -}; - -static XpOid ValidSetupProvisoOids[] = { - xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional -}; -static XpOidList ValidSetupProviso = { - - - ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids) -}; - -static XpOidDocFmt ValidDocFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList ValidDocFormatsSupported = { - ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList DefaultDocFormatsSupported = { - DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts) -}; - -static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList ValidEmbeddedFormatsSupported = { - ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList DefaultEmbeddedFormatsSupported = { - DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts) -}; - -static XpOidDocFmt ValidRawFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } - -}; -static XpOidDocFmtList ValidRawFormatsSupported = { - ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList DefaultRawFormatsSupported = { - DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts) -}; - -static XpOid ValidInputTraysOids[] = { - xpoid_val_input_tray_manual, - xpoid_val_input_tray_main, - xpoid_val_input_tray_envelope, - xpoid_val_input_tray_large_capacity, - xpoid_val_input_tray_bottom -}; -static XpOidList ValidInputTrays = { - ValidInputTraysOids, XpNumber(ValidInputTraysOids) -}; - -static XpOid ValidMediumSizesOids[] = { - xpoid_val_medium_size_iso_a0, - xpoid_val_medium_size_iso_a1, - xpoid_val_medium_size_iso_a2, - xpoid_val_medium_size_iso_a3, - xpoid_val_medium_size_iso_a4, - xpoid_val_medium_size_iso_a5, - xpoid_val_medium_size_iso_a6, - xpoid_val_medium_size_iso_a7, - xpoid_val_medium_size_iso_a8, - xpoid_val_medium_size_iso_a9, - xpoid_val_medium_size_iso_a10, - xpoid_val_medium_size_iso_b0, - xpoid_val_medium_size_iso_b1, - xpoid_val_medium_size_iso_b2, - xpoid_val_medium_size_iso_b3, - xpoid_val_medium_size_iso_b4, - xpoid_val_medium_size_iso_b5, - xpoid_val_medium_size_iso_b6, - xpoid_val_medium_size_iso_b7, - xpoid_val_medium_size_iso_b8, - xpoid_val_medium_size_iso_b9, - xpoid_val_medium_size_iso_b10, - xpoid_val_medium_size_na_letter, - xpoid_val_medium_size_na_legal, - xpoid_val_medium_size_executive, - xpoid_val_medium_size_folio, - xpoid_val_medium_size_invoice, - xpoid_val_medium_size_ledger, - xpoid_val_medium_size_quarto, - xpoid_val_medium_size_iso_c3, - xpoid_val_medium_size_iso_c4, - xpoid_val_medium_size_iso_c5, - xpoid_val_medium_size_iso_c6, - xpoid_val_medium_size_iso_designated_long, - xpoid_val_medium_size_na_10x13_envelope, - xpoid_val_medium_size_na_9x12_envelope, - xpoid_val_medium_size_na_number_10_envelope, - xpoid_val_medium_size_na_7x9_envelope, - xpoid_val_medium_size_na_9x11_envelope, - xpoid_val_medium_size_na_10x14_envelope, - xpoid_val_medium_size_na_number_9_envelope, - xpoid_val_medium_size_na_6x9_envelope, - xpoid_val_medium_size_na_10x15_envelope, - xpoid_val_medium_size_monarch_envelope, - xpoid_val_medium_size_a, - xpoid_val_medium_size_b, - xpoid_val_medium_size_c, - xpoid_val_medium_size_d, - xpoid_val_medium_size_e, - xpoid_val_medium_size_jis_b0, - xpoid_val_medium_size_jis_b1, - xpoid_val_medium_size_jis_b2, - xpoid_val_medium_size_jis_b3, - xpoid_val_medium_size_jis_b4, - xpoid_val_medium_size_jis_b5, - xpoid_val_medium_size_jis_b6, - xpoid_val_medium_size_jis_b7, - xpoid_val_medium_size_jis_b8, - xpoid_val_medium_size_jis_b9, - xpoid_val_medium_size_jis_b10, - xpoid_val_medium_size_hp_2x_postcard, - xpoid_val_medium_size_hp_european_edp, - xpoid_val_medium_size_hp_mini, - xpoid_val_medium_size_hp_postcard, - xpoid_val_medium_size_hp_tabloid, - xpoid_val_medium_size_hp_us_edp, - xpoid_val_medium_size_hp_us_government_legal, - xpoid_val_medium_size_hp_us_government_letter, -}; -static XpOidList ValidMediumSizes = { - ValidMediumSizesOids, XpNumber(ValidMediumSizesOids) -}; - -static XpOidDocFmt DefaultDocumentFormat = { - "Postscript", "2", NULL -}; - - -/* - * init struct for XpValidate*Pool - */ -XpValidatePoolsRec PsValidatePoolsRec = { - &ValidContentOrientations, &DefaultContentOrientations, - &ValidDocFormatsSupported, &DefaultDocFormatsSupported, - &ValidInputTrays, &ValidMediumSizes, - &ValidPlexes, &DefaultPlexes, - &ValidPrinterResolutions, &DefaultPrinterResolutions, - &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported, - &ValidListfontsModes, &DefaultListfontsModes, - &ValidRawFormatsSupported, &DefaultRawFormatsSupported, - &ValidSetupProviso, - &DefaultDocumentFormat -}; diff --git a/hw/xprint/ps/PsAttr.c b/hw/xprint/ps/PsAttr.c deleted file mode 100644 index 0925716f5..000000000 --- a/hw/xprint/ps/PsAttr.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsAttr.c -** * -** * Contents: Attribute-handling functions for the PS driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "attributes.h" - -char * -PsGetAttributes( - XpContextPtr pCon, - XPAttributes pool) -{ - return XpGetAttributes(pCon, pool); -} - -char * -PsGetOneAttribute( - XpContextPtr pCon, - XPAttributes pool, - char *attr) -{ - return XpGetOneAttribute(pCon, pool, attr); -} - -int -PsAugmentAttributes( - XpContextPtr pCon, - XPAttributes pool, - char *attrs) -{ - return XpAugmentAttributes(pCon, pool, attrs); -} - -int -PsSetAttributes( - XpContextPtr pCon, - XPAttributes pool, - char *attrs) -{ - return XpSetAttributes(pCon, pool, attrs); -} diff --git a/hw/xprint/ps/PsCache.c b/hw/xprint/ps/PsCache.c deleted file mode 100644 index 5c823a13e..000000000 --- a/hw/xprint/ps/PsCache.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996, 2000 Sun Microsystems, Inc. All Rights Reserved. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsCache.c -** * -** * Contents: Character-caching routines -** * -** * Created By: Jay Hobson (Sun MicroSystems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" -#include <X11/fonts/fntfil.h> -#include <X11/fonts/fntfilst.h> - -#define GET 0 -#define RESET 1 - -struct bm_cache_list { - struct bm_cache_list *next; - struct bm_cache_list *prev; - int height; - long id; - char *pBuffer; -}; - -struct bm_cache_head { - struct bm_cache_list *head; - int width; - struct bm_cache_head *next; - struct bm_cache_head *prev; -}; - -static struct bm_cache_head *bm_cache = NULL; - -static long -PsBmUniqueId(int func) -{ - static long unique_id = 0; - - if(func == RESET) - { - unique_id = 0; - return 0; - } - else - return ++unique_id; -} - -int -PsBmIsImageCached( - int gWidth, - int gHeight, - char *pBuffer) -{ - int return_val = 0; - struct bm_cache_head *pList = bm_cache; - - while(pList != NULL && !return_val) - { - if(pList->width == gWidth) - { - struct bm_cache_list *pItem = pList->head; - - while(pItem != NULL) - { - if(pItem->height == gHeight) - { - int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight; - - if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length)) - { - return_val = pItem->id; - break; - } - } - else if(pItem->height > gHeight) - break; - - pItem = pItem->next; - } - } - else if(pList->width > gWidth) - break; - - pList = pList->next; - } - return return_val; -} - -int -PsBmPutImageInCache( - int gWidth, - int gHeight, - char *pBuffer) -{ - int return_val = 0; - struct bm_cache_head *pList = bm_cache; - struct bm_cache_list *pNew; - int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight; - - if(gWidth == 1 && gHeight == 1 && pBuffer[0] == 0) - return return_val; - - pNew = (struct bm_cache_list *)malloc(sizeof(struct bm_cache_list)); - pNew->next = NULL; - pNew->prev = NULL; - pNew->height = gHeight; - pNew->id = PsBmUniqueId(GET); - pNew->pBuffer = (char *)malloc(sizeof(char)*length); - - memcpy(pNew->pBuffer, pBuffer, length); - - while(pList != NULL) - { - if(pList->width == gWidth) - { - struct bm_cache_list *pItem = pList->head; - - while(pItem != NULL) - { - if(pItem->height >= gHeight) - { - pNew->next = pItem; - pNew->prev = pItem->prev; - if(pItem->prev != NULL) - pItem->prev->next = pNew; - else - pList->head = pNew; - pItem->prev = pNew; - - return_val = pNew->id; - - break; - } - else if(pItem->next == NULL) - { - pNew->prev = pItem; - pItem->next = pNew; - - return_val = pNew->id; - - break; - } - - pItem = pItem->next; - } - - break; - } - - pList = pList->next; - } - - if(pList == NULL) - { - struct bm_cache_head *pNewList; - - pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head)); - - pNewList->next = NULL; - pNewList->prev = NULL; - pNewList->width = gWidth; - pNewList->head = pNew; - - if(bm_cache == NULL) - { - bm_cache = pNewList; - return_val = pNew->id; - } - else - { - pList = bm_cache; - - while(pList != NULL) - { - if(pList->width > gWidth) - { - pNewList->next = pList; - pNewList->prev = pList->prev; - - if(pList->prev != NULL) - pList->prev->next = pNewList; - else - bm_cache = pNewList; - pList->prev = pNewList; - - return_val = pNew->id; - - break; - } - else if(pList->next == NULL) - { - pNewList->prev = pList; - pList->next = pNewList; - - return_val = pNew->id; - - break; - } - - pList = pList->next; - } - } - } - - return return_val; -} - - -static void -PsBmClearImageCacheItem( - struct bm_cache_list *pItem) -{ - if(pItem != NULL) - { - if(pItem->pBuffer != NULL) - free(pItem->pBuffer); - pItem->pBuffer = NULL; - - if(pItem->next) - PsBmClearImageCacheItem(pItem->next); - pItem->next = NULL; - - free(pItem); - pItem = NULL; - } -} - -static void -PsBmClearImageCacheList( - struct bm_cache_head *pList) -{ - if(pList != NULL) - { - if(pList->head) - PsBmClearImageCacheItem(pList->head); - pList->head = NULL; - - if(pList->next) - PsBmClearImageCacheList(pList->next); - pList->next = NULL; - - free(pList); - pList = NULL; - } -} - -void -PsBmClearImageCache(void) -{ - PsBmClearImageCacheList(bm_cache); - - bm_cache = NULL; - - PsBmUniqueId(RESET); -} - diff --git a/hw/xprint/ps/PsColor.c b/hw/xprint/ps/PsColor.c deleted file mode 100644 index a91272db0..000000000 --- a/hw/xprint/ps/PsColor.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsColor.c -** * -** * Contents: Color routines for the PS driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "mi.h" -#include "micmap.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "colormapst.h" - -Bool -PsCreateColormap(ColormapPtr pColor) -{ - return miInitializeColormap(pColor); -} - -void -PsDestroyColormap(ColormapPtr pColor) -{ - /* NO-OP */ -} - -void -PsInstallColormap(ColormapPtr pColor) -{ - miInstallColormap(pColor); -} - -void -PsUninstallColormap(ColormapPtr pColor) -{ - miUninstallColormap(pColor); -} - -int -PsListInstalledColormaps( - ScreenPtr pScreen, - XID *pCmapList) -{ - return miListInstalledColormaps(pScreen, pCmapList); -} - -void -PsStoreColors( - ColormapPtr pColor, - int ndef, - xColorItem *pdefs) -{ - int i; - for( i=0 ; i<ndef ; i++ ) - { - if( pdefs[i].flags&DoRed ) - pColor->red[pdefs[i].pixel].co.local.red = pdefs[i].red; - if( pdefs[i].flags&DoGreen ) - pColor->red[pdefs[i].pixel].co.local.green = pdefs[i].green; - if( pdefs[i].flags&DoBlue ) - pColor->red[pdefs[i].pixel].co.local.blue = pdefs[i].blue; - } -} - -void -PsResolveColor( - unsigned short *pRed, - unsigned short *pGreen, - unsigned short *pBlue, - VisualPtr pVisual) -{ - miResolveColor(pRed, pGreen, pBlue, pVisual); -} - -PsOutColor -PsGetPixelColor(ColormapPtr cMap, int pixval) -{ - VisualPtr v = cMap->pVisual; - switch( v->class ) - { - case TrueColor: - { - PsOutColor p = pixval; - PsOutColor r, g, b; - - r = (p & v->redMask) >> v->offsetRed; - g = (p & v->greenMask) >> v->offsetGreen; - b = (p & v->blueMask) >> v->offsetBlue; - - r = cMap->red[r].co.local.red; - g = cMap->green[g].co.local.green; - b = cMap->blue[b].co.local.blue; - -#ifdef PSOUT_USE_DEEPCOLOR - return((r<<32)|(g<<16)|b); -#else - r >>= 8; - g >>= 8; - b >>= 8; - - return((r<<16)|(g<<8)|b); -#endif /* PSOUT_USE_DEEPCOLOR */ - } - case PseudoColor: - case GrayScale: - case StaticGray: - { - PsOutColor r, g, b; - - if( pixval < 0 || pixval > v->ColormapEntries) - return(0); - - r = cMap->red[pixval].co.local.red; - g = cMap->red[pixval].co.local.green; - b = cMap->red[pixval].co.local.blue; - - if ((v->class | DynamicClass) == GrayScale) - { - /* rescale to gray (see |miResolveColor()|) */ - r = g = b = (30L*r + 59L*g + 11L*b) / 100L; - } - -#ifdef PSOUT_USE_DEEPCOLOR - return((r<<32)|(g<<16)|b); -#else - r >>= 8; - g >>= 8; - b >>= 8; - - return((r<<16)|(g<<8)|b); -#endif /* PSOUT_USE_DEEPCOLOR */ - } - default: - FatalError("PsGetPixelColor: Unsupported visual %x\n", - (int)cMap->pVisual->class); - break; - } - - return 0; /* NO-OP*/ -} - -void -PsSetFillColor(DrawablePtr pDrawable, GCPtr pGC, PsOutPtr psOut, - ColormapPtr cMap) -{ - switch(pGC->fillStyle) - { - case FillSolid: - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - break; - case FillTiled: - if( !PsOut_BeginPattern(psOut, pGC->tile.pixmap, - pGC->tile.pixmap->drawable.width, - pGC->tile.pixmap->drawable.height, PsTile, 0, 0) ) - { - PsReplayPixmap(pGC->tile.pixmap, pDrawable); - PsOut_EndPattern(psOut); - } - PsOut_SetPattern(psOut, pGC->tile.pixmap, PsTile); - break; - case FillStippled: - if( !PsOut_BeginPattern(psOut, pGC->stipple, - pGC->stipple->drawable.width, - pGC->stipple->drawable.height, PsStip, 0, - PsGetPixelColor(cMap, pGC->fgPixel)) ) - { - PsReplayPixmap(pGC->stipple, pDrawable); - PsOut_EndPattern(psOut); - } - PsOut_SetPattern(psOut, pGC->stipple, PsStip); - break; - case FillOpaqueStippled: - if( !PsOut_BeginPattern(psOut, pGC->stipple, - pGC->stipple->drawable.width, - pGC->stipple->drawable.height, PsOpStip, - PsGetPixelColor(cMap, pGC->bgPixel), - PsGetPixelColor(cMap, pGC->fgPixel)) ) - { - PsReplayPixmap(pGC->stipple, pDrawable); - PsOut_EndPattern(psOut); - } - PsOut_SetPattern(psOut, pGC->stipple, PsOpStip); - break; - } -} diff --git a/hw/xprint/ps/PsDef.h b/hw/xprint/ps/PsDef.h deleted file mode 100644 index 5af274dec..000000000 --- a/hw/xprint/ps/PsDef.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsDef.h -** * -** * Contents: extran defines and includes for the Ps driver -** * for a printing X server. -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _PSDEF_H_ -#define _PSDEF_H_ - -#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER" -#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER" -#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND" -#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND" -#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION" -#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER" -#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER" -#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND" - -#define DT_IN_FILE_STRING "%(InFile)%" -#define DT_OUT_FILE_STRING "%(OutFile)%" -#define DT_ALLOWED_COMMANDS_FILE "printCommands" - -#endif /* _PSDEF_H_ */ diff --git a/hw/xprint/ps/PsFTFonts.c b/hw/xprint/ps/PsFTFonts.c deleted file mode 100644 index 8857ae43e..000000000 --- a/hw/xprint/ps/PsFTFonts.c +++ /dev/null @@ -1,85 +0,0 @@ - -/* -Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> - -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 -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. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <ctype.h> -#include <limits.h> -#include <sys/stat.h> - -#include "regionstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" -#include "scrnintstr.h" -#include <X11/fonts/fontxlfd.h> -#include <X11/fonts/fntfil.h> -#include <X11/fonts/fntfilst.h> - -#include "Ps.h" - -#include <ft2build.h> -#include FT_FREETYPE_H - -#include <X11/fonts/ft.h> -#define NOT_IN_FTFUNCS -#include <X11/fonts/ftfuncs.h> - -char * -PsGetFTFontFileName(FontPtr pFont) -{ - FTFontPtr tf = (FTFontPtr)pFont->fontPrivate; - return tf->instance->face->filename; -} - -Bool -PsIsFreeTypeFont(FontPtr pFont) -{ - int i; - int nprops = pFont->info.nprops; - FontPropPtr props = pFont->info.props; - /* "RASTERIZER_NAME" must match the rasterizer name set in - * xc/lib/font/FreeType/ftfuncs.c */ - Atom name = MakeAtom("RASTERIZER_NAME", 15, True); - Atom value = (Atom)0; - char *rv; - - for( i=0 ; i<nprops ; i++ ) - { - if( props[i].name==name ) - { value = props[i].value; break; } - } - if( !value ) - return False; - - rv = NameForAtom(value); - if( !rv ) - return False; - - if( memcmp(rv, "FreeType", 8) == 0 ) - return True; - - return False; -} - diff --git a/hw/xprint/ps/PsFonts.c b/hw/xprint/ps/PsFonts.c deleted file mode 100644 index 8ab631441..000000000 --- a/hw/xprint/ps/PsFonts.c +++ /dev/null @@ -1,873 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsFonts.c -** * -** * Contents: Font code for PS driver. -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "regionstr.h" -#include <X11/fonts/fontstruct.h> -#include "dixfontstr.h" -#include "scrnintstr.h" -#include <X11/fonts/fontxlfd.h> -#include <X11/fonts/fntfil.h> -#include <X11/fonts/fntfilst.h> - -#include "Ps.h" - -#include <ctype.h> -#include <limits.h> -#include <sys/stat.h> - -Bool -PsRealizeFont( - ScreenPtr pscr, - FontPtr pFont) -{ - return TRUE; -} - -Bool -PsUnrealizeFont( - ScreenPtr pscr, - FontPtr pFont) -{ - return TRUE; -} - -char * -PsGetFontName(FontPtr pFont) -{ - int i; - int nprops = pFont->info.nprops; - FontPropPtr props = pFont->info.props; - Atom name = MakeAtom("FONT", 4, True); - Atom value = (Atom)0; - - for( i=0 ; i<nprops ; i++ ) - { - if( (Atom)props[i].name==name ) - { value = props[i].value; break; } - } - if( !value ) return (char *)0; - return NameForAtom(value); -} - -int -PsGetFontSize(FontPtr pFont, float *mtx) -{ - FontScalableRec vals; - char *name = PsGetFontName(pFont); - int value = 0; - - FontParseXLFDName(name, &vals, FONT_XLFD_REPLACE_NONE); - if( vals.values_supplied&PIXELSIZE_ARRAY ) - { - int i; - for( i=0 ; i<4 ; i++ ) - mtx[i] = (float)vals.pixel_matrix[i]; - } - else - { - value = vals.pixel; - if( !value ) value = 20; - } - return value; -} - -char * -PsGetPSFontName(FontPtr pFont) -{ - int i; - int nprops = pFont->info.nprops; - FontPropPtr props = pFont->info.props; - /* "_ADOBE_POSTSCRIPT_FONTNAME" maps directly to a PMF OBJ_NAME attribute - * name - changing the name will break printer-builtin fonts. */ - Atom name = MakeAtom("_ADOBE_POSTSCRIPT_FONTNAME", 26, True); - Atom value = (Atom)0; - - for( i=0 ; i<nprops ; i++ ) - { - if( (Atom)props[i].name==name ) - { value = props[i].value; break; } - } - if( !value ) return (char *)0; - return NameForAtom(value); -} - -int -PsIsISOLatin1Encoding(FontPtr pFont) -{ - int i; - int nprops = pFont->info.nprops; - FontPropPtr props = pFont->info.props; - Atom reg = MakeAtom("CHARSET_REGISTRY", 16, True); - Atom enc = MakeAtom("CHARSET_ENCODING", 16, True); - Atom rv = 0, ev = 0; - char *rp = 0; - char *ep = 0; - - for( i=0 ; i<nprops ; i++ ) - { - if( (Atom)props[i].name==reg ) rv = props[i].value; - if( (Atom)props[i].name==enc ) ev = props[i].value; - } - if( rv ) rp = NameForAtom(rv); - if( ev ) ep = NameForAtom(ev); - if( (!rp) || (!ep) ) return(0); - if( (char)tolower(rp[0])!='i' || - (char)tolower(rp[1])!='s' || - (char)tolower(rp[2])!='o' || - memcmp(&rp[3], "8859", 4)!=0 || - ep[0]!='1' ) return(0); - return(1); -} - -/* Return the encoding part of the XLFD (e.g. "*-iso8859-6.8x" etc.)*/ -char *PsGetEncodingName(FontPtr pFont) -{ - int i; - int nprops = pFont->info.nprops; - FontPropPtr props = pFont->info.props; - Atom fnt = MakeAtom("FONT", 4, True); - Atom reg = MakeAtom("CHARSET_REGISTRY", 16, True); - Atom enc = MakeAtom("CHARSET_ENCODING", 16, True); - Atom fv = 0, rv = 0, ev = 0; - char *fp = 0; - char *rp = 0; - char *ep = 0; - char *encname; - - for( i=0 ; i<nprops ; i++ ) - { - if( props[i].name==fnt ) fv = props[i].value; - if( props[i].name==reg ) rv = props[i].value; - if( props[i].name==enc ) ev = props[i].value; - } - if( fv ) fp = NameForAtom(fv); - if( rv ) rp = NameForAtom(rv); - if( ev ) ep = NameForAtom(ev); - - if( (!rp) || (!ep) || (!fp)) - return(0); - - encname = fp; - encname += strlen(encname) - (strlen(rp) + strlen(ep) + 1); - - return encname; -} - -/* strstr(), case-insensitive */ -static -char *str_case_str(const char *s, const char *find) -{ - size_t len; - char c, - sc; - - if ((c = tolower(*find++)) != '\0') - { - len = strlen(find); - do - { - do - { - if ((sc = tolower(*s++)) == '\0') - return NULL; - } while (sc != c); - } while (strncasecmp(s, find, len) != 0); - s--; - } - return ((char *)s); -} - -/* Check if the font path element is a directory which can be examined - * (for example the font may be from a font server - * (e.g. pFont->fpe->name == "tcp/:7100")) - */ -static -Bool IsFPEaReadableDir(FontPtr pFont) -{ - const char *fpe_name = pFont->fpe->name; - if (!fpe_name) - return False; - -#define MODEL_FONTPATH_PREFIX "PRINTER:" -#define MODEL_FONTPATH_PREFIX_LEN 8 - /* Strip model-specific font path prefix if there is one... */ - if (!strncmp(fpe_name, MODEL_FONTPATH_PREFIX, MODEL_FONTPATH_PREFIX_LEN)) - fpe_name += MODEL_FONTPATH_PREFIX_LEN; - - if (access(fpe_name, F_OK) == 0) - { - return True; - } - - return False; -} - -static -char *getFontFilename(FontPtr pFont) -{ - FontDirectoryPtr dir; - const char *dlfnam; - FILE *file; - struct stat statb; - char buf[512]; - char *front, *fn; - char font_dir_fname[PATH_MAX], /* Full path of fonts.dir */ - font_file_fname[PATH_MAX]; /* Name of font file (excluding path) */ - -#ifdef XP_USE_FREETYPE - if( PsIsFreeTypeFont(pFont) ) - { - const char *fontname = PsGetFTFontFileName(pFont); - -#ifdef DEBUG_gisburn - fprintf(stderr, "getFontFilename: freetype font, file='%s'\n", fontname?fontname:"<NULL>"); -#endif /* DEBUG_gisburn */ - - if( !fontname ) - return NULL; - - return strdup(fontname); - } -#endif /* XP_USE_FREETYPE */ - - if (!IsFPEaReadableDir(pFont)) - { -#ifdef DEBUG_gisburn - fprintf(stderr, "getFontFilename: '%s' no valid font path on disk\n", pFont->fpe->name); -#endif /* DEBUG_gisburn */ - return NULL; - } - - dir = pFont->fpe->private; - sprintf(font_dir_fname, "%s%s", dir->directory, "fonts.dir"); - - if (!(dlfnam = PsGetFontName(pFont))) - return NULL; - - file = fopen(font_dir_fname, "r"); - if (file) - { - if (fstat (fileno(file), &statb) == -1) - return NULL; - - while( fgets(buf, sizeof(buf)-1, file) ) - { - if ((fn = strstr(buf, " -"))) - { - strcpy(font_file_fname, buf); - font_file_fname[fn - buf] = '\0'; - fn++; - if ((front = str_case_str(fn, "normal-"))) - { - fn[front - fn] = '\0'; - if (str_case_str(dlfnam, fn)) - { - char full_font_file_path[PATH_MAX]; - - fclose(file); - - sprintf(full_font_file_path, "%s%s", dir->directory, font_file_fname); - -#ifdef xDEBUG_gisburn - fprintf(stderr, "getFontFilename: returning '%s'\n", full_font_file_path); -#endif /* DEBUG_gisburn */ - return strdup(full_font_file_path); - } - } - } - } - } - font_file_fname[0] = '\0'; - fclose(file); - -#ifdef DEBUG_gisburn - fprintf(stderr, "getFontFilename: returning NULL\n"); -#endif /* DEBUG_gisburn */ - - return NULL; -} - -static -PsFontTypeInfoRec *PsFindFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont) -{ - PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable); - PsFontTypeInfoRec *rec; - const char *psname; - char *font_filename; - char *encname; -#ifdef XP_USE_FREETYPE - Bool is_freetypefont; -#endif /* XP_USE_FREETYPE */ - -#ifdef XP_USE_FREETYPE - is_freetypefont = PsIsFreeTypeFont(pFont); -#endif /* XP_USE_FREETYPE */ - encname = PsGetEncodingName(pFont); - - /* First try: Search by PostScript font name */ - psname = PsGetPSFontName(pFont); - if (psname) - { - for( rec = cPriv->fontTypeInfoRecords ; rec != NULL ; rec = rec->next ) - { -#ifdef XP_USE_FREETYPE - if (is_freetypefont) - { - if (rec->adobe_ps_name) - { - if ((rec->font_type == PSFTI_FONT_TYPE_FREETYPE) && - (!strcmp(rec->adobe_ps_name, psname)) && - (!strcmp(rec->ft_download_encoding, encname))) - { - return rec; - } - } - } - else -#endif /* XP_USE_FREETYPE */ - { - if (rec->adobe_ps_name) - { - if ((rec->font_type != PSFTI_FONT_TYPE_FREETYPE) && - (!strcmp(rec->adobe_ps_name, psname))) - { - return rec; - } - } - } - } - } - - /* Last attempt: Search by filename */ - font_filename = getFontFilename(pFont); - if (font_filename) - { - for( rec = cPriv->fontTypeInfoRecords ; rec != NULL ; rec = rec->next ) - { - if (rec->filename) - { -#ifdef XP_USE_FREETYPE - if (is_freetypefont) - { - if ( (rec->font_type == PSFTI_FONT_TYPE_FREETYPE) && - (!strcasecmp(rec->filename, font_filename)) && - (!strcasecmp(rec->ft_download_encoding, encname)) ) - { - free(font_filename); - return rec; - } - } - else -#endif /* XP_USE_FREETYPE */ - { - if ( (rec->font_type != PSFTI_FONT_TYPE_FREETYPE) && - (!strcasecmp(rec->filename, font_filename)) ) - { - free(font_filename); - return rec; - } - } - } - } - - free(font_filename); - } - - return NULL; -} - -static -void PsAddFontTypeInfoRec(DrawablePtr pDrawable, PsFontTypeInfoRec *add_rec) -{ - PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable); - - /* ToDO: Always move the last used entry to the top that the list get's - * sorted in an efficient order... :-) */ - add_rec->next = cPriv->fontTypeInfoRecords; - cPriv->fontTypeInfoRecords = add_rec; -} - -static -Bool strcaseendswith(const char *str, const char *suffix) -{ - const char *s; - - s = str + strlen(str) - strlen(suffix); - - if (!strcasecmp(s, suffix)) - return True; - - return False; -} - - -static -int getFontFileType( const char *filename ) -{ - int type; - - /* Is this a Adobe PostScript Type 1 binary font (PFB) ? */ - if( strcaseendswith(filename, ".pfb") ) - { - type = PSFTI_FONT_TYPE_PS_TYPE1_PFB; - } - /* Is this a Adobe PostScript ASCII font (PFA) ? */ - else if( strcaseendswith(filename, ".pfa") ) - { - type = PSFTI_FONT_TYPE_PS_TYPE1_PFA; - } - /* Is this a PMF(=Printer Metrics File) ? */ - else if( strcaseendswith(filename, ".pmf") ) - { - type = PSFTI_FONT_TYPE_PMF; - } - /* Is this a TrueType font file ? */ - else if( strcaseendswith(filename, ".ttf") || - strcaseendswith(filename, ".ttc") || - strcaseendswith(filename, ".otf") || - strcaseendswith(filename, ".otc") ) - { - type = PSFTI_FONT_TYPE_TRUETYPE; - } - else - { - type = PSFTI_FONT_TYPE_OTHER; - } - -#ifdef XP_USE_FREETYPE - { - XpContextPtr pCon; - char *downloadfonts; - pCon = XpGetPrintContext(requestingClient); - downloadfonts = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-psddx-download-fonts"); - if( downloadfonts ) - { - /* Should we download PS Type1 fonts as PS Type1||Type3 ? */ - if( (type == PSFTI_FONT_TYPE_PS_TYPE1_PFA) && - (strstr(downloadfonts, "pfa") != NULL) ) - { - type = PSFTI_FONT_TYPE_FREETYPE; - } - - if( (type == PSFTI_FONT_TYPE_PS_TYPE1_PFB) && - (strstr(downloadfonts, "pfb") != NULL) ) - { - type = PSFTI_FONT_TYPE_FREETYPE; - } - - /* Should we download TrueType fonts as PS Type1||Type3 ? */ - if( (type == PSFTI_FONT_TYPE_TRUETYPE) && - ((strstr(downloadfonts, "ttf") != NULL) || - (strstr(downloadfonts, "ttc") != NULL) || - (strstr(downloadfonts, "otf") != NULL) || - (strstr(downloadfonts, "otc") != NULL)) ) - { - type = PSFTI_FONT_TYPE_FREETYPE; - } - } - } -#endif /* XP_USE_FREETYPE */ - -#ifdef DEBUG_gisburn - fprintf(stderr, "getFontFileType: '%s' is %d\n", filename, (int)type); -#endif /* DEBUG_gisburn */ - return type; -} - -PsFTDownloadFontType PsGetFTDownloadFontType(void) -{ - PsFTDownloadFontType downloadfonttype; - XpContextPtr pCon; - char *psfonttype; - - pCon = XpGetPrintContext(requestingClient); - psfonttype = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-psddx-download-font-type"); - - if( !psfonttype || !strlen(psfonttype) ) - { - return PsFontType1; /* Default download font type is PS Type1 */ - } - - if( !strcmp(psfonttype, "bitmap") ) - { - downloadfonttype = PsFontBitmap; - } - else if( !strcmp(psfonttype, "pstype3") ) - { - downloadfonttype = PsFontType3; - } - else if( !strcmp(psfonttype, "pstype1") ) - { - downloadfonttype = PsFontType1; - } - else - { - FatalError("PS DDX: XPPrinterAttr/xp-psddx-download-freetype-font-type='%s' not implemented\n", psfonttype); - return 0; /* NO-OP, FatalError() will call |exit()| */ - } - - return downloadfonttype; -} - -static -PsFontTypeInfoRec *PsCreateFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont) -{ - char *dlfnam; - PsFontTypeInfoRec *rec; - - if (!(dlfnam = PsGetFontName(pFont))) - return NULL; - - if (!(rec = (PsFontTypeInfoRec *)xalloc(sizeof(PsFontTypeInfoRec)))) - return NULL; - memset(rec, 0, sizeof(PsFontTypeInfoRec)); - - rec->next = NULL; - - if ((rec->filename = getFontFilename(pFont))) - { - rec->font_type = getFontFileType(rec->filename); - } - else - { - rec->filename = NULL; - rec->font_type = PSFTI_FONT_TYPE_OTHER; - } - - rec->adobe_ps_name = PsGetPSFontName(pFont); -#ifdef XP_USE_FREETYPE - rec->ft_download_encoding = PsGetEncodingName(pFont); - rec->ft_download_font_type = PsGetFTDownloadFontType(); -#endif /* XP_USE_FREETYPE */ - rec->download_ps_name = NULL; - -#define SET_FONT_DOWNLOAD_STATUS(rec, downloaded) { int i; for (i = 0 ; i < 256 ; i++) { (rec)->alreadyDownloaded[i]=(downloaded); } } - - /* Set some flags based on the font type */ - switch( rec->font_type ) - { - case PSFTI_FONT_TYPE_PS_TYPE1_PFA: - case PSFTI_FONT_TYPE_PS_TYPE1_PFB: - rec->downloadableFont = True; - SET_FONT_DOWNLOAD_STATUS(rec, False); - rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont); - break; - - case PSFTI_FONT_TYPE_PMF: - rec->downloadableFont = True; /* This font is in printer's ROM */ - SET_FONT_DOWNLOAD_STATUS(rec, True); - rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont); - break; - - case PSFTI_FONT_TYPE_TRUETYPE: - /* Note: TrueType font download not implemented */ - rec->downloadableFont = False; - SET_FONT_DOWNLOAD_STATUS(rec, False); - rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont); - break; - -#ifdef XP_USE_FREETYPE - case PSFTI_FONT_TYPE_FREETYPE: - if( rec->ft_download_font_type == PsFontType1 || - rec->ft_download_font_type == PsFontType3 ) - { - rec->downloadableFont = True; - } - else - { - rec->downloadableFont = False; - } - - SET_FONT_DOWNLOAD_STATUS(rec, False); - rec->is_iso_encoding = False; /* Freetype--->PS Type1/Type3 uses always non-iso PS encoding for now */ - break; -#endif /* XP_USE_FREETYPE */ - - case PSFTI_FONT_TYPE_OTHER: - default: - rec->downloadableFont = False; - SET_FONT_DOWNLOAD_STATUS(rec, False); - rec->is_iso_encoding = PsIsISOLatin1Encoding(pFont); - break; - } - -#ifdef XP_USE_FREETYPE - if( (rec->font_type == PSFTI_FONT_TYPE_FREETYPE) ) - { - char *s; - register int c; - - if( rec->adobe_ps_name ) - { - rec->download_ps_name = malloc(strlen(rec->adobe_ps_name) + strlen(rec->ft_download_encoding) + 2); - sprintf(rec->download_ps_name, "%s_%s", rec->adobe_ps_name, rec->ft_download_encoding); - } - else - { - /* Unfortunately not all TTF fonts have a PostScript font name (like - * Solaris TTF fonts in /usr/openwin/lib/locale/ko.UTF-8/X11/fonts/TrueType, - * /usr/openwin/lib/locale/ko/X11/fonts/TrueType) - in this case we - * have to generate a font name - */ - char ftfontname[64]; - static long myfontindex = 0L; - sprintf(ftfontname, "psfont_%lx", myfontindex++); - - rec->download_ps_name = malloc(strlen(ftfontname) + strlen(rec->ft_download_encoding) + 2); - sprintf(rec->download_ps_name, "%s_%s", ftfontname, rec->ft_download_encoding); - - fprintf(stderr, "PsCreateFontTypeInfoRec: Note: '%s' has no PS font name, using '%s' for now.\n", dlfnam, rec->download_ps_name); - } - - /* Make sure the font name we use for download is a valid PS font name */ - for( s = rec->download_ps_name ; *s != '\0'; s++ ) - { - c = *s; - - /* Check for allowed chars, invalid ones are replaced with a '_' - * (and check that the first char is not a digit) */ - if( !(isalnum(c) || c == '.' || c == '_' || c == '-') || (s==rec->download_ps_name && isdigit(c)) ) - { - *s = '_'; - } - } - } - else -#endif /* XP_USE_FREETYPE */ - { - if( rec->adobe_ps_name ) - { - rec->download_ps_name = strdup(rec->adobe_ps_name); - } - else - { - rec->download_ps_name = NULL; - } - } - - /* Safeguard - only treat font as downloadable when we have a PS font name!! */ - if (!rec->download_ps_name && rec->downloadableFont) - { - /* XXX: Log this message to the log when the logging service has been hook'ed up */ - fprintf(stderr, "PsCreateFontTypeInfoRec: Safeguard: No PS font name for '%s'!\n", dlfnam); - rec->downloadableFont = False; - } - -#ifdef DEBUG_gisburn - fprintf(stderr, "PsCreateFontTypeInfoRec: Created PsFontTypeInfoRec '%s' ('%s'/'%s')\n", - ((rec->filename) ?(rec->filename) :("<null>")), - ((rec->adobe_ps_name) ?(rec->adobe_ps_name):("<null>")), - ((rec->download_ps_name)?(rec->download_ps_name):("<null>"))); -#endif /* DEBUG_gisburn */ - - return rec; -} - -static -PsFontTypeInfoRec *PsGetFontTypeInfoRec(DrawablePtr pDrawable, FontPtr pFont) -{ - PsFontTypeInfoRec *rec; - char *dlfnam; - - if(!(dlfnam = PsGetFontName(pFont))) - return NULL; - - rec = PsFindFontTypeInfoRec(pDrawable, pFont); - if (rec) - return rec; - - rec = PsCreateFontTypeInfoRec(pDrawable, pFont); - if (!rec) - return NULL; - - PsAddFontTypeInfoRec(pDrawable, rec); - - return rec; -} - -static -void PsFreeFontTypeInfoRecords( PsContextPrivPtr priv ) -{ - PsFontTypeInfoRec *curr, *next; - curr = priv->fontTypeInfoRecords; - while( curr != NULL ) - { - if (curr->filename) - free(curr->filename); /* Free memory allocated by |strdup()| */ - - if (curr->download_ps_name) - free(curr->download_ps_name); - - next = curr->next; - xfree(curr); - curr = next; - } -} - -static -PsFontInfoRec *PsFindFontInfoRec(DrawablePtr pDrawable, FontPtr pFont) -{ - PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable); - PsFontInfoRec *rec; - - if (!pFont) - return NULL; - - for( rec = cPriv->fontInfoRecords ; rec != NULL ; rec = rec->next ) - { - if ((rec->font == pFont) && - (rec->font_fontPrivate == pFont->fontPrivate)) - return rec; - } - - return NULL; -} - -static -void PsAddFontInfoRec(DrawablePtr pDrawable, PsFontInfoRec *add_rec) -{ - PsContextPrivRec *cPriv = PsGetPsContextPriv(pDrawable); - - /* ToDO: Always move the last used entry to the top that the list get's - * sorted in an efficient order... :-) */ - add_rec->next = cPriv->fontInfoRecords; - cPriv->fontInfoRecords = add_rec; -} - -static -PsFontInfoRec *PsCreateFontInfoRec(DrawablePtr pDrawable, FontPtr pFont) -{ - PsFontInfoRec *rec; - PsFontTypeInfoRec *ftir; - - if (!(ftir = PsGetFontTypeInfoRec(pDrawable, pFont))) - return NULL; - - if (!(rec = (PsFontInfoRec *)xalloc(sizeof(PsFontInfoRec)))) - return NULL; - memset(rec, 0, sizeof(PsFontInfoRec)); - - rec->font = pFont; - rec->font_fontPrivate = pFont->fontPrivate; - rec->ftir = ftir; - rec->next = NULL; - rec->dfl_name = PsGetFontName(pFont); - rec->size = PsGetFontSize(pFont, rec->mtx); - -#ifdef DEBUG_gisburn - fprintf(stderr, "PsCreateFontInfoRec: Created PsFontInfoRec '%s'\n", - ((rec->dfl_name)?(rec->dfl_name):("<null>"))); -#endif /* DEBUG_gisburn */ - - return rec; -} - -PsFontInfoRec *PsGetFontInfoRec(DrawablePtr pDrawable, FontPtr pFont) -{ - PsFontInfoRec *rec; - - rec = PsFindFontInfoRec(pDrawable, pFont); - if (rec) - return rec; - - rec = PsCreateFontInfoRec(pDrawable, pFont); - if (!rec) - return NULL; - - PsAddFontInfoRec(pDrawable, rec); - - return rec; -} - -void PsFreeFontInfoRecords( PsContextPrivPtr priv ) -{ - PsFontInfoRec *curr, *next; - curr = priv->fontInfoRecords; - while( curr != NULL ) - { - next = curr->next; - xfree(curr); - curr = next; - } - - PsFreeFontTypeInfoRecords(priv); - - priv->fontTypeInfoRecords = NULL; - priv->fontInfoRecords = NULL; -} diff --git a/hw/xprint/ps/PsGC.c b/hw/xprint/ps/PsGC.c deleted file mode 100644 index 19898c90e..000000000 --- a/hw/xprint/ps/PsGC.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsGC.c -** * -** * Contents: Graphics Context handling for the PS driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "migc.h" -#include "scrnintstr.h" - -static GCOps PsGCOps = -{ - PsFillSpans, - PsSetSpans, - PsPutImage, - PsCopyArea, - PsCopyPlane, - PsPolyPoint, - PsPolyLine, - PsPolySegment, - PsPolyRectangle, - PsPolyArc, - PsFillPolygon, - PsPolyFillRect, - PsPolyFillArc, - PsPolyText8, - PsPolyText16, - PsImageText8, - PsImageText16, - PsImageGlyphBlt, - PsPolyGlyphBlt, - PsPushPixels -}; - - -static GCFuncs PsGCFuncs = -{ - PsValidateGC, - PsChangeGC, - PsCopyGC, - PsDestroyGC, - PsChangeClip, - PsDestroyClip, - PsCopyClip -}; - -Bool -PsCreateGC(pGC) - GCPtr pGC; -{ - pGC->clientClip = NULL; - pGC->clientClipType = CT_NONE; - - pGC->ops = &PsGCOps; - pGC->funcs = &PsGCFuncs; - - pGC->clientClip = (pointer)xalloc(sizeof(PsClipRec)); - memset(pGC->clientClip, 0, sizeof(PsClipRec)); - return TRUE; -} - -static int -PsGetDrawablePrivateStuff( - DrawablePtr pDrawable, - GC *gc, - unsigned long *valid, - PsOutPtr *psOut, - ColormapPtr *cMap) -{ - XpContextPtr pCon; - PsContextPrivPtr cPriv; - PsScreenPrivPtr sPriv; - - switch(pDrawable->type) - { - case DRAWABLE_PIXMAP: - return FALSE; - case DRAWABLE_WINDOW: - pCon = PsGetContextFromWindow((WindowPtr)pDrawable); - if( pCon==NULL ) return FALSE; - else - { - Colormap c; - ColormapPtr cmap; - - c = wColormap((WindowPtr)pDrawable); - cmap = (ColormapPtr)LookupIDByType(c, RT_COLORMAP); - - cPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - sPriv = (PsScreenPrivPtr) - dixLookupPrivate(&pDrawable->pScreen->devPrivates, - PsScreenPrivateKey); - *gc = cPriv->lastGC; - *valid = cPriv->validGC; - *psOut = cPriv->pPsOut; - *cMap = cmap; - return TRUE; - } - default: - return FALSE; - } -} - -PsContextPrivPtr -PsGetPsContextPriv( DrawablePtr pDrawable ) -{ - XpContextPtr pCon; - - switch(pDrawable->type) - { - case DRAWABLE_PIXMAP: - return FALSE; - case DRAWABLE_WINDOW: - pCon = PsGetContextFromWindow((WindowPtr)pDrawable); - if (pCon != NULL) - { - return (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - } - } - return NULL; -} - -int -PsUpdateDrawableGC( - GCPtr pGC, - DrawablePtr pDrawable, - PsOutPtr *psOut, - ColormapPtr *cMap) -{ - GC dGC; - unsigned long valid; - int i; - PsContextPrivPtr cPriv; - BoxPtr boxes; - - if (!PsGetDrawablePrivateStuff(pDrawable, &dGC, &valid, psOut, cMap)) - return FALSE; - - switch (pDrawable->type) { - - case DRAWABLE_PIXMAP: - /* we don't support pixmaps yet! */ - return FALSE; - break; - case DRAWABLE_WINDOW: - if( pGC ) - { - RegionPtr pReg; - WindowPtr pWin = (WindowPtr)pDrawable; - Bool freeClip; - PsClipPtr clp = (PsClipPtr)pGC->clientClip; - if( clp->outterClips ) - { xfree(clp->outterClips); clp->outterClips = 0; } - clp->nOutterClips = 0; - if( pGC->subWindowMode==IncludeInferiors ) - { - pReg = NotClippedByChildren(pWin); - freeClip = TRUE; - } - else - { - pReg = &pWin->clipList; - freeClip = FALSE; - } - - if( pReg->data ) - { - boxes = (BoxPtr)((char *)pReg->data+sizeof(long)*2); - clp->nOutterClips = pReg->data->numRects; - clp->outterClips = - (PsRectPtr)xalloc(clp->nOutterClips*sizeof(PsRectRec)); - for( i=0 ; i<clp->nOutterClips ; i++ ) - { - clp->outterClips[i].x = boxes[i].x1; - clp->outterClips[i].y = boxes[i].y1; - clp->outterClips[i].w = (boxes[i].x2-boxes[i].x1)+1; - clp->outterClips[i].h = (boxes[i].y2-boxes[i].y1)+1; - } - } - - if( freeClip ) REGION_DESTROY(pGC->pScreen, pReg); - PsOut_Offset(*psOut, pDrawable->x, pDrawable->y); - PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip); - } - cPriv = (PsContextPrivPtr)dixLookupPrivate( - &PsGetContextFromWindow((WindowPtr)pDrawable)->devPrivates, - PsContextPrivateKey); - break; - } - return TRUE; -} - -void -PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - pGC->ops = &PsGCOps; -} - -void -PsChangeGC(GCPtr pGC, unsigned long changes) -{ -} - -void -PsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) -{ -} - -void -PsDestroyGC(GCPtr pGC) -{ - PsDestroyClip(pGC); - xfree(pGC->clientClip); -} - -void -PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) -{ - int i; - PsClipPtr clp = (PsClipPtr)pGC->clientClip; - RegionPtr rgn; - BoxPtr boxes; - xRectangle *rects; - - PsDestroyClip(pGC); - pGC->clientClipType = type; - switch(type) - { - case CT_NONE: break; - case CT_PIXMAP: - clp->elms = PsCreateFillElementList((PixmapPtr)pValue, &clp->nElms); - (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue); - break; - case CT_REGION: - rgn = (RegionPtr)pValue; - boxes = (BoxPtr)((char *)rgn->data+sizeof(long)*2); - clp->nRects = rgn->data->numRects; - clp->rects = (PsRectPtr)xalloc(clp->nRects*sizeof(PsRectRec)); - for( i=0 ; i<clp->nRects ; i++ ) - { - clp->rects[i].x = boxes[i].x1; - clp->rects[i].y = boxes[i].y1; - clp->rects[i].w = (boxes[i].x2-boxes[i].x1)+1; - clp->rects[i].h = (boxes[i].y2-boxes[i].y1)+1; - } - REGION_DESTROY(pGC->pScreen, (RegionPtr)pValue); - break; - case CT_UNSORTED: - case CT_YSORTED: - case CT_YXSORTED: - case CT_YXBANDED: - rects = (xRectangle *)pValue; - clp->nRects = nrects; - clp->rects = (PsRectPtr)xalloc(clp->nRects*sizeof(PsRectRec)); - for( i=0 ; i<clp->nRects ; i++ ) - { - clp->rects[i].x = rects[i].x; - clp->rects[i].y = rects[i].y; - clp->rects[i].w = rects[i].width; - clp->rects[i].h = rects[i].height; - } - xfree(pValue); - break; - } -} - -void -PsDestroyClip(GCPtr pGC) -{ - PsClipPtr clp = (PsClipPtr)pGC->clientClip; - - if( clp->rects ) xfree(clp->rects); - if( clp->outterClips ) xfree(clp->outterClips); - clp->rects = (PsRectPtr)0; - clp->outterClips = (PsRectPtr)0; - clp->nRects = 0; - clp->nOutterClips = 0; - if( clp->elms ) PsDestroyFillElementList(clp->nElms, clp->elms); - clp->elms = (PsElmPtr)0; - clp->nElms = 0; - pGC->clientClipType = CT_NONE; -} - -void -PsCopyClip(GCPtr pDst, GCPtr pSrc) -{ - PsClipPtr src = (PsClipPtr)pSrc->clientClip; - PsClipPtr dst = (PsClipPtr)pDst->clientClip; - - PsDestroyClip(pDst); - pDst->clientClipType = pSrc->clientClipType; - *dst = *src; - if( src->rects ) - { - dst->rects = (PsRectPtr)xalloc(src->nRects*sizeof(PsRectRec)); - memcpy(dst->rects, src->rects, src->nRects*sizeof(PsRectRec)); - } - if( src->elms ) - dst->elms = PsCloneFillElementList(src->nElms, src->elms); -} - - -GCPtr -PsCreateAndCopyGC(DrawablePtr pDrawable, GCPtr pSrc) -{ - GCPtr pDst; - - if (pSrc == NULL) { - /* https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 ("'x11perf - * -copypixpix500' crashes Xprt's PostScript DDX [PsCreateAndCopyGC"): - * I have no clue whether this is the real fix or just wallpapering - * over the crash (that's why we warn here loudly when this - * happens) ... */ - fprintf(stderr, "PsCreateAndCopyGC: pSrc == NULL\n"); - return NULL; - } - - if ((pDst = - CreateScratchGC(pDrawable->pScreen, pDrawable->depth)) == NULL) - { - return NULL; - } - - if (CopyGC(pSrc, pDst, - GCFunction | GCPlaneMask | GCForeground | GCBackground | - GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle | - GCFillStyle | GCFillRule | GCTile | GCStipple | - GCTileStipXOrigin | GCTileStipYOrigin | GCFont | - GCSubwindowMode | GCGraphicsExposures | GCClipXOrigin | - GCClipYOrigin | GCClipMask | GCDashOffset | GCDashList | - GCArcMode) != Success) - { - (void)FreeGC(pDst, (GContext)0); - - return NULL; - } - - return pDst; -} - diff --git a/hw/xprint/ps/PsImageUtil.c b/hw/xprint/ps/PsImageUtil.c deleted file mode 100644 index 668a23f65..000000000 --- a/hw/xprint/ps/PsImageUtil.c +++ /dev/null @@ -1,329 +0,0 @@ - -/* -Copyright (c) 2005 Roland Mainz <roland.mainz@nrubsig.org> - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -/* Please do not beat me for this ugly code - most of it has been stolen from - * xc/lib/X11/ImUtil.c */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "servermd.h" -#include "attributes.h" - -static unsigned char const _reverse_byte[0x100] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -static -int XReverse_Bytes( - register unsigned char *bpt, - register int nb) -{ - do { - *bpt = _reverse_byte[*bpt]; - bpt++; - } while (--nb > 0); - return 0; -} - -/* - * Data structure for "image" data, used by image manipulation routines. - */ -typedef struct { - int width, height; /* size of image */ - int xoffset; /* number of pixels offset in X direction */ - int format; /* XYBitmap, XYPixmap, ZPixmap */ - char *data; /* pointer to image data */ - int byte_order; /* data byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* quant. of scanline 8, 16, 32 */ - int bitmap_bit_order; /* LSBFirst, MSBFirst */ - int depth; /* depth of image */ - int bytes_per_line; /* accelarator to next line */ - int bits_per_pixel; /* bits per pixel (ZPixmap) */ -} TmpImage; - - -static void xynormalizeimagebits ( - register unsigned char *bp, - register TmpImage *img) -{ - register unsigned char c; - - if (img->byte_order != img->bitmap_bit_order) { - switch (img->bitmap_unit) { - - case 16: - c = *bp; - *bp = *(bp + 1); - *(bp + 1) = c; - break; - - case 32: - c = *(bp + 3); - *(bp + 3) = *bp; - *bp = c; - c = *(bp + 2); - *(bp + 2) = *(bp + 1); - *(bp + 1) = c; - break; - } - } - if (img->bitmap_bit_order == MSBFirst) - XReverse_Bytes (bp, img->bitmap_unit >> 3); -} - -static void znormalizeimagebits ( - register unsigned char *bp, - register TmpImage *img) -{ - register unsigned char c; - switch (img->bits_per_pixel) { - - case 4: - *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF); - break; - - case 16: - c = *bp; - *bp = *(bp + 1); - *(bp + 1) = c; - break; - - case 24: - c = *(bp + 2); - *(bp + 2) = *bp; - *bp = c; - break; - - case 32: - c = *(bp + 3); - *(bp + 3) = *bp; - *bp = c; - c = *(bp + 2); - *(bp + 2) = *(bp + 1); - *(bp + 1) = c; - break; - } -} - -/* - * Macros - * - * The ROUNDUP macro rounds up a quantity to the specified boundary, - * then truncates to bytes. - * - * The XYNORMALIZE macro determines whether XY format data requires - * normalization and calls a routine to do so if needed. The logic in - * this module is designed for LSBFirst byte and bit order, so - * normalization is done as required to present the data in this order. - * - * The ZNORMALIZE macro performs byte and nibble order normalization if - * required for Z format data. - * - * The XYINDEX macro computes the index to the starting byte (char) boundary - * for a bitmap_unit containing a pixel with coordinates x and y for image - * data in XY format. - * - * The ZINDEX macro computes the index to the starting byte (char) boundary - * for a pixel with coordinates x and y for image data in ZPixmap format. - * - */ - -#if defined(Lynx) && defined(ROUNDUP) -#undef ROUNDUP -#endif - -#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) - -#define XYNORMALIZE(bp, img) \ - if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \ - xynormalizeimagebits((unsigned char *)(bp), img) - -#define ZNORMALIZE(bp, img) \ - if (img->byte_order == MSBFirst) \ - znormalizeimagebits((unsigned char *)(bp), img) - -#define XYINDEX(x, y, img) \ - ((y) * img->bytes_per_line) + \ - (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3) - -#define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \ - (((x) * img->bits_per_pixel) >> 3) - -/* - * GetPixel - * - * Returns the specified pixel. The X and Y coordinates are relative to - * the origin (upper left [0,0]) of the image. The pixel value is returned - * in normalized format, i.e. the LSB of the long is the LSB of the pixel. - * The algorithm used is: - * - * copy the source bitmap_unit or Zpixel into temp - * normalize temp if needed - * extract the pixel bits into return value - * - */ - -static unsigned long const low_bits_table[] = { - 0x00000000, 0x00000001, 0x00000003, 0x00000007, - 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, - 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, - 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, - 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, - 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, - 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, - 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, - 0xffffffff -}; - -static unsigned long XGetPixel (TmpImage *ximage, int x, int y) -{ - unsigned long pixel, px; - register char *src; - register char *dst; - register int i, j; - int bits, nbytes; - long plane; - - if ((ximage->bits_per_pixel | ximage->depth) == 1) { - src = &ximage->data[XYINDEX(x, y, ximage)]; - dst = (char *)&pixel; - pixel = 0; - for (i = ximage->bitmap_unit >> 3; --i >= 0; ) *dst++ = *src++; - XYNORMALIZE(&pixel, ximage); - bits = (x + ximage->xoffset) % ximage->bitmap_unit; - pixel = ((((char *)&pixel)[bits>>3])>>(bits&7)) & 1; - } else if (ximage->format == XYPixmap) { - pixel = 0; - plane = 0; - nbytes = ximage->bitmap_unit >> 3; - for (i = ximage->depth; --i >= 0; ) { - src = &ximage->data[XYINDEX(x, y, ximage)+ plane]; - dst = (char *)&px; - px = 0; - for (j = nbytes; --j >= 0; ) *dst++ = *src++; - XYNORMALIZE(&px, ximage); - bits = (x + ximage->xoffset) % ximage->bitmap_unit; - pixel = (pixel << 1) | - (((((char *)&px)[bits>>3])>>(bits&7)) & 1); - plane = plane + (ximage->bytes_per_line * ximage->height); - } - } else if (ximage->format == ZPixmap) { - src = &ximage->data[ZINDEX(x, y, ximage)]; - dst = (char *)&px; - px = 0; - for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; ) - *dst++ = *src++; - ZNORMALIZE(&px, ximage); - pixel = 0; - for (i=sizeof(unsigned long); --i >= 0; ) - pixel = (pixel << 8) | ((unsigned char *)&px)[i]; - if (ximage->bits_per_pixel == 4) { - if (x & 1) - pixel >>= 4; - else - pixel &= 0xf; - } - } else { - return 0; /* bad image */ - } - if (ximage->bits_per_pixel == ximage->depth) - return pixel; - else - return (pixel & low_bits_table[ximage->depth]); -} - -unsigned long -PsGetImagePixel(char *pImage, int depth, int w, int h, int leftPad, int format, - int px, int py) -{ - TmpImage xi = {0}; - - xi.width = w; - xi.height = h; - xi.xoffset = 0/*leftPad*/; - xi.format = format; - xi.data = pImage; - xi.byte_order = IMAGE_BYTE_ORDER; - xi.bitmap_bit_order = BITMAP_BIT_ORDER; - xi.bitmap_unit = ((depth > 16)?(32): - ((depth > 8)?(16): - ((depth > 1)? (8): - (1)))); - xi.depth = depth; - xi.bits_per_pixel = xi.bitmap_unit; - - /* - * compute per line accelerator. - */ - if (format == ZPixmap) - xi.bytes_per_line = - ROUNDUP((xi.bits_per_pixel * xi.width), 32); - else - xi.bytes_per_line = - ROUNDUP((xi.width + xi.xoffset), 32); - - return XGetPixel(&xi, px, py); -} - - - diff --git a/hw/xprint/ps/PsInit.c b/hw/xprint/ps/PsInit.c deleted file mode 100644 index 72bd7bd7c..000000000 --- a/hw/xprint/ps/PsInit.c +++ /dev/null @@ -1,648 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsInit.c -** * -** * Contents: Initialization code of Ps driver for the print server. -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/wait.h> - -#include "Ps.h" -#include "mi.h" -#include "micmap.h" -#include "AttrValid.h" -#include "fb.h" - -#include "windowstr.h" -#include "DiPrint.h" - -static void AllocatePsPrivates(ScreenPtr pScreen); -static int PsInitContext(XpContextPtr pCon); -static int PsDestroyContext(XpContextPtr pCon); - -DevPrivateKey PsScreenPrivateKey = &PsScreenPrivateKey; -DevPrivateKey PsContextPrivateKey = &PsContextPrivateKey; -DevPrivateKey PsPixmapPrivateKey = &PsPixmapPrivateKey; -DevPrivateKey PsWindowPrivateKey = &PsWindowPrivateKey; - -#ifdef GLXEXT -extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); -#endif /* GLXEXT */ - -Bool -InitializePsDriver(ndx, pScreen, argc, argv) - int ndx; - ScreenPtr pScreen; - int argc; - char **argv; -{ -#if 0 - int maxXres, maxYres, maxWidth, maxHeight; - int maxRes, maxDim, numBytes; - PsScreenPrivPtr pPriv; -#endif - int nv, /* total number of visuals */ - nv_1bit, /* number of 8bit visuals */ - nv_8bit, /* number of 8bit visuals */ - nv_12bit, /* number of 12bit visuals */ - nv_14bit, /* number of 14bit visuals */ - nv_16bit, /* number of 16bit visuals */ - nv_24bit, /* number of 24bit visuals*/ - nv_30bit; /* number of 30bit visuals*/ - int nd; /* number of depths */ - int defaultVisualIndex = -1; - VisualID *vids_1bit, - *vids_8bit, - *vids_12bit, - *vids_14bit, - *vids_16bit, - *vids_24bit, - *vids_30bit; - VisualPtr visuals; - DepthPtr depths; - VisualID defaultVisual; - int rootDepth; - -/* - * Register this driver's InitContext function with the print - * extension. - */ - XpRegisterInitFunc(pScreen, "XP-POSTSCRIPT", PsInitContext); - -/* - * Create and fill in the devPrivate for the PS driver. - */ - AllocatePsPrivates(pScreen); - -#if 0 - pPriv = (PsScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey); - pPriv->resDB = rmdb; -#endif - - pScreen->defColormap = (Colormap) FakeClientID(0); - pScreen->blackPixel = 1; - pScreen->whitePixel = 0; - pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize; - pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop; - pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop; - pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop; - pScreen->CreateWindow = PsCreateWindow; - pScreen->DestroyWindow = PsDestroyWindow; - pScreen->PositionWindow = PsPositionWindow; - pScreen->ChangeWindowAttributes = PsChangeWindowAttributes; - pScreen->RealizeWindow = PsMapWindow; - pScreen->UnrealizeWindow = PsUnmapWindow; - pScreen->CloseScreen = PsCloseScreen; - pScreen->CopyWindow = PsCopyWindow; - /* XXX Hard routine to write! */ - -/* - * These two are going to be VERY different... - */ - pScreen->CreatePixmap = PsCreatePixmap; - pScreen->DestroyPixmap = PsDestroyPixmap; - pScreen->RealizeFont = PsRealizeFont; - pScreen->UnrealizeFont = PsUnrealizeFont; - pScreen->CreateGC = PsCreateGC; - pScreen->CreateColormap = PsCreateColormap; - pScreen->DestroyColormap = PsDestroyColormap; - pScreen->InstallColormap = PsInstallColormap; - pScreen->UninstallColormap = PsUninstallColormap; - pScreen->ListInstalledColormaps = PsListInstalledColormaps; - pScreen->StoreColors = PsStoreColors; - pScreen->ResolveColor = PsResolveColor; - /* Will BitmapToRegion make any difference at all? */ - pScreen->BitmapToRegion = fbPixmapToRegion; - - visuals = (VisualPtr) xalloc(16*sizeof(VisualRec)); - depths = (DepthPtr) xalloc(16*sizeof(DepthRec)); - vids_1bit = (VisualID *)xalloc(16*sizeof(VisualID)); - vids_8bit = (VisualID *)xalloc(16*sizeof(VisualID)); - vids_12bit = (VisualID *)xalloc(16*sizeof(VisualID)); - vids_14bit = (VisualID *)xalloc(16*sizeof(VisualID)); - vids_16bit = (VisualID *)xalloc(16*sizeof(VisualID)); - vids_24bit = (VisualID *)xalloc(16*sizeof(VisualID)); - vids_30bit = (VisualID *)xalloc(16*sizeof(VisualID)); - - nv = nv_1bit = nv_8bit = nv_12bit = nv_14bit = nv_16bit = nv_24bit = nv_30bit = nd = 0; - -#ifdef PSOUT_USE_DEEPCOLOR -/* gisburn: 30bit TrueColor has been disabled for now since it causes problems - * with GLX - see https://bugs.freedesktop.org/show_bug.cgi?id=2868 ("Mesa - * seems to be unable to handle 30bit TrueColor visuals") for details... - */ -#ifdef DISABLED_FOR_NOW - /* TrueColor, 30bit, 10bit per R-,G-,B-gun */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = TrueColor; - visuals[nv].bitsPerRGBValue = 10; - visuals[nv].ColormapEntries = 1024; - visuals[nv].nplanes = 30; - visuals[nv].redMask = 0X3FF00000; - visuals[nv].greenMask = 0X000FFC00; - visuals[nv].blueMask = 0X000003FF; - visuals[nv].offsetRed = 20; - visuals[nv].offsetGreen = 10; - visuals[nv].offsetBlue = 0; - vids_30bit[nv_30bit] = visuals[nv].vid; - nv++; nv_30bit++; -#endif /* DISABLED_FOR_NOW */ -#endif /* PSOUT_USE_DEEPCOLOR */ - - /* TrueColor, 24bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = TrueColor; - visuals[nv].bitsPerRGBValue = 8; - visuals[nv].ColormapEntries = 256; - visuals[nv].nplanes = 24; - visuals[nv].redMask = 0X00FF0000; - visuals[nv].greenMask = 0X0000FF00; - visuals[nv].blueMask = 0X000000FF; - visuals[nv].offsetRed = 16; - visuals[nv].offsetGreen = 8; - visuals[nv].offsetBlue = 0; - vids_24bit[nv_24bit] = visuals[nv].vid; - nv++; nv_24bit++; - - /* TrueColor, 16bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = TrueColor; - visuals[nv].bitsPerRGBValue = 6; - visuals[nv].ColormapEntries = 64; - visuals[nv].nplanes = 16; - visuals[nv].redMask = 0x0000f800; - visuals[nv].greenMask = 0x000007e0; - visuals[nv].blueMask = 0x0000001f; - visuals[nv].offsetRed = 11; - visuals[nv].offsetGreen = 5; - visuals[nv].offsetBlue = 0; - vids_16bit[nv_16bit] = visuals[nv].vid; - nv++; nv_16bit++; - -#ifdef PSOUT_USE_DEEPCOLOR - /* PostScript Level 2 and above, colors can have 12 bits per component - * (36 bit for RGB) */ - - /* PseudoColor, 14bit (15bit won't work as |ColormapEntries==32768| - * is too large for a |signed short|... xx@@!!!... ;-( ) */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = PseudoColor; - visuals[nv].bitsPerRGBValue = 12; - visuals[nv].ColormapEntries = 16384; - visuals[nv].nplanes = 14; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_14bit[nv_14bit] = visuals[nv].vid; - nv++; nv_14bit++; - - /* PseudoColor, 12bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = PseudoColor; - visuals[nv].bitsPerRGBValue = 12; - visuals[nv].ColormapEntries = 4096; - visuals[nv].nplanes = 12; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_12bit[nv_12bit] = visuals[nv].vid; - defaultVisualIndex = nv; - nv++; nv_12bit++; - - /* GrayScale, 12bit, 12bit per R-,G-,B-gun */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = GrayScale; - visuals[nv].bitsPerRGBValue = 12; - visuals[nv].ColormapEntries = 4096; - visuals[nv].nplanes = 12; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_12bit[nv_12bit] = visuals[nv].vid; - nv++; nv_12bit++; - - /* StaticGray, 12bit, 12bit per R-,G-,B-gun */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = StaticGray; - visuals[nv].bitsPerRGBValue = 12; - visuals[nv].ColormapEntries = 4096; - visuals[nv].nplanes = 12; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_12bit[nv_12bit] = visuals[nv].vid; - nv++; nv_12bit++; -#endif /* PSOUT_USE_DEEPCOLOR */ - - /* PseudoColor, 8bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = PseudoColor; - visuals[nv].bitsPerRGBValue = 8; - visuals[nv].ColormapEntries = 256; - visuals[nv].nplanes = 8; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_8bit[nv_8bit] = visuals[nv].vid; -#ifndef PSOUT_USE_DEEPCOLOR - defaultVisualIndex = nv; -#endif /* !PSOUT_USE_DEEPCOLOR */ - nv++; nv_8bit++; - - /* GrayScale, 8bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = GrayScale; - visuals[nv].bitsPerRGBValue = 8; - visuals[nv].ColormapEntries = 256; - visuals[nv].nplanes = 8; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_8bit[nv_8bit] = visuals[nv].vid; - nv++; nv_8bit++; - - /* StaticGray, 8bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = StaticGray; - visuals[nv].bitsPerRGBValue = 8; - visuals[nv].ColormapEntries = 256; - visuals[nv].nplanes = 8; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_8bit[nv_8bit] = visuals[nv].vid; - nv++; nv_8bit++; - - /* StaticGray, 1bit */ - visuals[nv].vid = FakeClientID(0); - visuals[nv].class = StaticGray; - visuals[nv].bitsPerRGBValue = 1; - visuals[nv].ColormapEntries = 2; - visuals[nv].nplanes = 1; - visuals[nv].redMask = 0x0; - visuals[nv].greenMask = 0x0; - visuals[nv].blueMask = 0x0; - visuals[nv].offsetRed = 0x0; - visuals[nv].offsetGreen = 0x0; - visuals[nv].offsetBlue = 0x0; - vids_1bit[nv_1bit] = visuals[nv].vid; - nv++; nv_1bit++; - - if( nv_30bit > 0 ) - { - depths[nd].depth = 30; - depths[nd].numVids = nv_30bit; - depths[nd].vids = vids_30bit; - nd++; - } - - if( nv_24bit > 0 ) - { - depths[nd].depth = 24; - depths[nd].numVids = nv_24bit; - depths[nd].vids = vids_24bit; - nd++; - } - - if( nv_16bit > 0 ) - { - depths[nd].depth = 16; - depths[nd].numVids = nv_16bit; - depths[nd].vids = vids_16bit; - nd++; - } - - if( nv_14bit > 0 ) - { - depths[nd].depth = 14; - depths[nd].numVids = nv_14bit; - depths[nd].vids = vids_14bit; - nd++; - } - - if( nv_12bit > 0 ) - { - depths[nd].depth = 12; - depths[nd].numVids = nv_12bit; - depths[nd].vids = vids_12bit; - nd++; - } - - if( nv_8bit > 0 ) - { - depths[nd].depth = 8; - depths[nd].numVids = nv_8bit; - depths[nd].vids = vids_8bit; - nd++; - } - - if( nv_1bit > 0 ) - { - depths[nd].depth = 1; - depths[nd].numVids = nv_1bit; - depths[nd].vids = vids_1bit; - nd++; - } - - /* Defaul visual is 12bit PseudoColor */ - defaultVisual = visuals[defaultVisualIndex].vid; - rootDepth = visuals[defaultVisualIndex].nplanes; - -#ifdef GLXEXT - { - miInitVisualsProcPtr proc = NULL; - - GlxWrapInitVisuals(&proc); - /* GlxInitVisuals ignores the last three arguments. */ - proc(&visuals, &depths, &nv, &nd, - &rootDepth, &defaultVisual, 0, 0, 0); - } -#endif /* GLXEXT */ - - miScreenInit(pScreen, (pointer)0, - pScreen->width, pScreen->height, - (int) (pScreen->width / (pScreen->mmWidth / 25.40)), - (int) (pScreen->height / (pScreen->mmHeight / 25.40)), - 0, rootDepth, nd, - depths, defaultVisual, nv, visuals); - - if( miCreateDefColormap(pScreen)==FALSE ) return FALSE; - -/*scalingScreenInit(pScreen);*/ - - return TRUE; -} - -static void -AllocatePsPrivates(ScreenPtr pScreen) -{ - dixRequestPrivate(PsWindowPrivateKey, sizeof(PsWindowPrivRec)); - dixRequestPrivate(PsContextPrivateKey, sizeof(PsContextPrivRec)); - dixRequestPrivate(PsPixmapPrivateKey, sizeof(PsPixmapPrivRec)); - - dixSetPrivate(&pScreen->devPrivates, PsScreenPrivateKey, - xalloc(sizeof(PsScreenPrivRec))); -} - -/* - * PsInitContext - * - * Establish the appropriate values for a PrintContext used with the PS - * driver. - */ - -static char DOC_ATT_SUPP[]="document-attributes-supported"; -static char DOC_ATT_VAL[]="document-format xp-listfonts-modes"; -static char JOB_ATT_SUPP[]="job-attributes-supported"; -static char JOB_ATT_VAL[]=""; -static char PAGE_ATT_SUPP[]="xp-page-attributes-supported"; -static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \ -default-input-tray default-medium plex xp-listfonts-modes"; - -static int -PsInitContext(pCon) - XpContextPtr pCon; -{ - XpDriverFuncsPtr pFuncs; - PsContextPrivPtr pConPriv; - char *server, *attrStr; - - /* - * Initialize the attribute store for this printer. - */ - XpInitAttributes(pCon); - - /* - * Initialize the function pointers - */ - pFuncs = &(pCon->funcs); - pFuncs->StartJob = PsStartJob; - pFuncs->EndJob = PsEndJob; - pFuncs->StartDoc = PsStartDoc; - pFuncs->EndDoc = PsEndDoc; - pFuncs->StartPage = PsStartPage; - pFuncs->EndPage = PsEndPage; - pFuncs->PutDocumentData = PsDocumentData; - pFuncs->GetDocumentData = PsGetDocumentData; - pFuncs->GetAttributes = PsGetAttributes; - pFuncs->SetAttributes = PsSetAttributes; - pFuncs->AugmentAttributes = PsAugmentAttributes; - pFuncs->GetOneAttribute = PsGetOneAttribute; - pFuncs->DestroyContext = PsDestroyContext; - pFuncs->GetMediumDimensions = PsGetMediumDimensions; - pFuncs->GetReproducibleArea = PsGetReproducibleArea; - pFuncs->SetImageResolution = PsSetImageResolution; - - /* - * Set up the context privates - */ - pConPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - memset(pConPriv, 0, sizeof(PsContextPrivRec)); - pConPriv->jobFileName = (char *)NULL; - pConPriv->pJobFile = (FILE *)NULL; - pConPriv->dash = (unsigned char *)NULL; - pConPriv->validGC = 0; - pConPriv->getDocClient = (ClientPtr)NULL; - pConPriv->getDocBufSize = 0; - pConPriv->pPsOut = NULL; - pConPriv->fontInfoRecords = NULL; - pConPriv->fontTypeInfoRecords = NULL; - - /* - * document-attributes-supported - */ - server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP ); - if ((attrStr = (char *) xalloc(strlen(server) + - strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL) - + strlen(PAGE_ATT_VAL) + 8)) == NULL) - { - return BadAlloc; - } - sprintf(attrStr, "*%s:\t%s %s %s", - DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL); - XpAugmentAttributes( pCon, XPPrinterAttr, attrStr); - xfree(attrStr); - - /* - * job-attributes-supported - */ - server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP ); - if ((attrStr = (char *) xalloc(strlen(server) + strlen(JOB_ATT_SUPP) + - strlen(JOB_ATT_VAL) + 8)) == NULL) - { - return BadAlloc; - } - sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL); - XpAugmentAttributes(pCon, XPPrinterAttr, attrStr); - xfree(attrStr); - - /* - * xp-page-attributes-supported - */ - server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP ); - if ((attrStr = (char *) xalloc(strlen(server) + strlen(PAGE_ATT_SUPP) + - strlen(PAGE_ATT_VAL) + 8)) == NULL) - { - return BadAlloc; - } - sprintf(attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL); - XpAugmentAttributes(pCon, XPPrinterAttr, attrStr); - xfree(attrStr); - - /* - * Validate the attribute pools - */ - XpValidateAttributePool(pCon, XPPrinterAttr, &PsValidatePoolsRec); - XpValidateAttributePool(pCon, XPDocAttr, &PsValidatePoolsRec); - XpValidateAttributePool(pCon, XPJobAttr, &PsValidatePoolsRec); - XpValidateAttributePool(pCon, XPPageAttr, &PsValidatePoolsRec); - - return Success; -} - -static Bool -PsDestroyContext(pCon) - XpContextPtr pCon; -{ - PsContextPrivPtr pConPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - if( pConPriv->pJobFile!=(FILE *)NULL ) - { - fclose(pConPriv->pJobFile); - pConPriv->pJobFile = NULL; - } - if( pConPriv->jobFileName!=(char *)NULL ) - { - unlink(pConPriv->jobFileName); - xfree(pConPriv->jobFileName); - pConPriv->jobFileName = (char *)NULL; - } - - PsFreeFontInfoRecords(pConPriv); - - /* Reset context to make sure we do not use any stale/invalid/obsolete data */ - memset(pConPriv, 0, sizeof(PsContextPrivRec)); - -/*### free up visuals/depths ###*/ - - return Success; -} - -XpContextPtr -PsGetContextFromWindow(win) - WindowPtr win; -{ - PsWindowPrivPtr pPriv; - - while( win ) - { - pPriv = (PsWindowPrivPtr) - dixLookupPrivate(&win->devPrivates, PsWindowPrivateKey); - if( pPriv->validContext ) return pPriv->context; - win = win->parent; - } - - return NULL; -} diff --git a/hw/xprint/ps/PsLine.c b/hw/xprint/ps/PsLine.c deleted file mode 100644 index aca186642..000000000 --- a/hw/xprint/ps/PsLine.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsLine.c -** * -** * Contents: Line drawing routines for the PS driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PsPolyLine( - DrawablePtr pDrawable, - GCPtr pGC, - int mode, - int nPoints, - xPoint *pPoints) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolyLineCmd; - elm->gc = gc; - elm->c.polyPts.mode = mode; - elm->c.polyPts.nPoints = nPoints; - elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint)); - memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - PsPointPtr pts; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - PsLineAttrs(psOut, pGC, cMap); - pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints); - if( mode==CoordModeOrigin ) - { - for( i=0 ; i<nPoints ; i++ ) - { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; } - } - else - { - pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y; - for( i=1 ; i<nPoints ; i++ ) - { - pts[i].x = pts[i-1].x+pPoints[i].x; - pts[i].y = pts[i-1].y+pPoints[i].y; - } - } - PsOut_Lines(psOut, nPoints, pts); - xfree(pts); - } -} - -void -PsPolySegment( - DrawablePtr pDrawable, - GCPtr pGC, - int nSegments, - xSegment *pSegments) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolySegmentCmd; - elm->gc = gc; - elm->c.segments.nSegments = nSegments; - elm->c.segments.pSegments = (xSegment *)xalloc(nSegments*sizeof(xSegment)); - memcpy(elm->c.segments.pSegments, pSegments, nSegments*sizeof(xSegment)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - PsPointRec pts[2]; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - PsLineAttrs(psOut, pGC, cMap); - for( i=0 ; i<nSegments ; i++ ) - { - pts[0].x = pSegments[i].x1; - pts[0].y = pSegments[i].y1; - pts[1].x = pSegments[i].x2; - pts[1].y = pSegments[i].y2; - PsOut_Lines(psOut, 2, pts); - } - } -} diff --git a/hw/xprint/ps/PsMisc.c b/hw/xprint/ps/PsMisc.c deleted file mode 100644 index 8d5005f91..000000000 --- a/hw/xprint/ps/PsMisc.c +++ /dev/null @@ -1,320 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsMisc.c -** * -** * Contents: Miscellaneous code for Ps driver. -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */ -#include <stdio.h> -#include "Ps.h" - -#include "cursor.h" -#include "resource.h" - -#include "windowstr.h" -#include "propertyst.h" - - -/*ARGSUSED*/ -void -PsQueryBestSize( - int type, - short *pwidth, - short *pheight, - ScreenPtr pScreen) -{ - unsigned width, highBit; - - switch(type) - { - case CursorShape: - *pwidth = 0; - *pheight = 0; - break; - case TileShape: - case StippleShape: - width = *pwidth; - if (!width) break; - /* Return the nearest power of two >= what they gave us */ - highBit = 0x80000000; - /* Find the highest 1 bit in the given width */ - while(!(highBit & width)) - highBit >>= 1; - /* If greater than that then return the next power of two */ - if((highBit - 1) & width) - highBit <<= 1; - *pwidth = highBit; - /* height is a don't-care */ - break; - } -} - -/* - * PsGetMediumDimensions is installed in the GetMediumDimensions field - * of each Ps-initialized context. - */ -int -PsGetMediumDimensions(XpContextPtr pCon, CARD16 *width, CARD16 *height) -{ - XpGetMediumDimensions(pCon, width, height); - return Success; -} - -/* - * PsGetReproducibleArea is installed in the GetReproducibleArea field - * of each Ps-initialized context. - */ -int -PsGetReproducibleArea(XpContextPtr pCon, xRectangle *pRect) -{ - XpGetReproductionArea(pCon, pRect); - return Success; -} - -/* - * PsSetImageResolution is installed in the SetImageResolution field - * of each Ps-initialized context. - */ -int -PsSetImageResolution(XpContextPtr pCon, int imageRes, Bool *status) -{ - pCon->imageRes = imageRes; - *status = True; - return Success; -} - -/* - * GetPropString searches the window heirarchy from pWin up looking for - * a property by the name of propName. If found, returns the property's - * value. If not, it returns NULL. - */ -/* -char * -GetPropString( - WindowPtr pWin, - char *propName) -{ - Atom atom; - PropertyPtr pProp = (PropertyPtr)NULL; - char *retVal; - - atom = MakeAtom(propName, strlen(propName), FALSE); - if(atom != BAD_RESOURCE) - { - WindowPtr pPropWin; - int rc, n; -*/ - - /* - * The atom has been defined, but it might only exist as a - * property on an unrelated window. - */ -/* - for(pPropWin = pWin; pPropWin != (WindowPtr)NULL; - pPropWin = pPropWin->parent) - { - rc = dixLookupProperty(&pProp, pPropWin, atom, - serverClient, DixReadAccess); - if (rc == Success) - break; - else - pProp = NULL; - } - if(pProp == (PropertyPtr)NULL) - return (char *)NULL; - - n = (pProp->format/8) * pProp->size; *//* size (bytes) of prop */ -/* - retVal = (char *)xalloc(n + 1); - (void)memcpy((void *)retVal, (void *)pProp->data, n); - retVal[n] = '\0'; - - return retVal; - } - - return (char *)NULL; -} - -#include <signal.h> - -*/ -/* ARGSUSED */ -/* -static void SigchldHndlr (int dummy) -{ - int status, w; - struct sigaction act; - sigfillset(&act.sa_mask); - act.sa_flags = 0; - act.sa_handler = SigchldHndlr; - - w = wait (&status); - -*/ - /* - * Is this really necessary? - */ -/* - sigaction(SIGCHLD, &act, (struct sigaction *)NULL); -} -*/ - -/* - * SystemCmd provides a wrapper for the 'system' library call. The call - * appears to be sensitive to the handling of SIGCHLD, so this wrapper - * sets the status to SIG_DFL, and then resets the established handler - * after system returns. - */ -/* -int -SystemCmd(char *cmdStr) -{ - int status; - struct sigaction newAct, oldAct; - sigfillset(&newAct.sa_mask); - newAct.sa_flags = 0; - newAct.sa_handler = SIG_DFL; - sigfillset(&oldAct.sa_mask); - oldAct.sa_flags = 0; - oldAct.sa_handler = SigchldHndlr; - -*/ - /* - * get the old handler, and set the action to IGN - */ -/* - sigaction(SIGCHLD, &newAct, &oldAct); - - status = system (cmdStr); - - sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL); - return status; -} -*/ - -Bool -PsCloseScreen( - int index, - ScreenPtr pScreen) -{ - return TRUE; -} - -void -PsLineAttrs( - PsOutPtr psOut, - GCPtr pGC, - ColormapPtr cMap) -{ - int i; - int nDsh; - int dshOff; - int *dsh; - PsCapEnum cap; - PsJoinEnum join; - - switch(pGC->capStyle) { - case CapButt: cap = PsCButt; break; - case CapRound: cap = PsCRound; break; - case CapProjecting: cap = PsCSquare; break; - default: cap = PsCButt; break; } - switch(pGC->joinStyle) { - case JoinMiter: join = PsJMiter; break; - case JoinRound: join = PsJRound; break; - case JoinBevel: join = PsJBevel; break; - default: join = PsJBevel; break; } - if( pGC->lineStyle==LineSolid ) { nDsh = dshOff = 0; dsh = (int *)0; } - else - { - nDsh = pGC->numInDashList; - dshOff = pGC->dashOffset; - if( !nDsh ) dsh = (int *)0; - else - { - dsh = (int *)xalloc(sizeof(int)*nDsh); - for( i=0 ; i<nDsh ; i++ ) dsh[i] = (int)pGC->dash[i]&0xFF; - } - } - - if( pGC->lineStyle!=LineDoubleDash ) - PsOut_LineAttrs(psOut, (int)pGC->lineWidth, - cap, join, nDsh, dsh, dshOff, -1); - else - PsOut_LineAttrs(psOut, (int)pGC->lineWidth, - cap, join, nDsh, dsh, dshOff, - PsGetPixelColor(cMap, pGC->bgPixel)); - if( nDsh && dsh ) xfree(dsh); -} diff --git a/hw/xprint/ps/PsPixel.c b/hw/xprint/ps/PsPixel.c deleted file mode 100644 index d51cb6ecf..000000000 --- a/hw/xprint/ps/PsPixel.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsPixel.c -** * -** * Contents: Pixel-drawing code for the PS DDX driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1995 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> - -#include "windowstr.h" -#include "gcstruct.h" - -#include "Ps.h" - -void -PsPolyPoint( - DrawablePtr pDrawable, - GCPtr pGC, - int mode, - int nPoints, - xPoint *pPoints) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolyPointCmd; - elm->gc = gc; - elm->c.polyPts.mode = mode; - elm->c.polyPts.nPoints = nPoints; - elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint)); - memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - PsPointPtr pts; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints); - if( mode==CoordModeOrigin ) - { - for( i=0 ; i<nPoints ; i++ ) - { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; } - } - else - { - pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y; - for( i=1 ; i<nPoints ; i++ ) - { - pts[i].x = pts[i-1].x+pPoints[i].x; - pts[i].y = pts[i-1].y+pPoints[i].y; - } - } - PsOut_Points(psOut, nPoints, pts); - xfree(pts); - } -} - -void -PsPushPixels( - GCPtr pGC, - PixmapPtr pBitmap, - DrawablePtr pDrawable, - int width, - int height, - int x, - int y) -{ -} diff --git a/hw/xprint/ps/PsPixmap.c b/hw/xprint/ps/PsPixmap.c deleted file mode 100644 index a588f4276..000000000 --- a/hw/xprint/ps/PsPixmap.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsPixmap.c -** * -** * Contents: Pixmap functions for the PS DDX driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1995 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "windowstr.h" -#include "gcstruct.h" -#include "privates.h" - -#include "Ps.h" - -#define _BitsPerPixel(d) (\ - (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \ - (PixmapWidthPaddingInfo[d].padRoundUp+1)) - -PixmapPtr -PsCreatePixmap( - ScreenPtr pScreen, - int width, - int height, - int depth, - unsigned usage_hint) -{ - PixmapPtr pPixmap; - - pPixmap = (PixmapPtr)xcalloc(1, sizeof(PixmapRec)); - if( !pPixmap) return NullPixmap; - pPixmap->drawable.type = DRAWABLE_PIXMAP; - pPixmap->drawable.class = 0; - pPixmap->drawable.pScreen = pScreen; - pPixmap->drawable.depth = depth; - pPixmap->drawable.bitsPerPixel = _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 = 0; - pPixmap->refcnt = 1; - pPixmap->devPrivates = NULL; - - pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xcalloc(1, sizeof(PsPixmapPrivRec)); - if( !pPixmap->devPrivate.ptr ) - { xfree(pPixmap); return NullPixmap; } - return pPixmap; -} - -/* PsScrubPixmap: Remove all content from a pixmap (used by - * |PsPolyFillRect()| when the "solid fill" operation covers - * the whole pixmap) */ -void -PsScrubPixmap(PixmapPtr pPixmap) -{ - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr; - DisplayListPtr disp = priv->dispList; - - while( disp ) - { - int i; - DisplayListPtr oldDisp = disp; - disp = disp->next; - for( i=0 ; i<oldDisp->nelms ; i++ ) - { - DisplayElmPtr elm = &oldDisp->elms[i]; - - switch(elm->type) - { - case PolyPointCmd: - case PolyLineCmd: - if( elm->c.polyPts.pPoints ) xfree(elm->c.polyPts.pPoints); - break; - case PolySegmentCmd: - if( elm->c.segments.pSegments ) xfree(elm->c.segments.pSegments); - break; - case PolyRectangleCmd: - if( elm->c.rects.pRects ) xfree(elm->c.rects.pRects); - break; - case FillPolygonCmd: - if( elm->c.polyPts.pPoints ) xfree(elm->c.polyPts.pPoints); - break; - case PolyFillRectCmd: - if( elm->c.rects.pRects ) xfree(elm->c.rects.pRects); - break; - case PolyArcCmd: - if( elm->c.arcs.pArcs ) xfree(elm->c.arcs.pArcs); - break; - case PolyFillArcCmd: - if( elm->c.arcs.pArcs ) xfree(elm->c.arcs.pArcs); - break; - case Text8Cmd: - case TextI8Cmd: - if( elm->c.text8.string ) xfree(elm->c.text8.string); - break; - case Text16Cmd: - case TextI16Cmd: - if( elm->c.text16.string ) xfree(elm->c.text16.string); - break; - case PutImageCmd: - if( elm->c.image.pData ) xfree(elm->c.image.pData); - break; - case BeginFrameCmd: - break; - case EndFrameCmd: - break; - } - - if (elm->type != BeginFrameCmd && elm->type != EndFrameCmd) { - (void) FreeGC(elm->gc, (GContext) 0); - } - } - xfree(oldDisp); - } - - priv->dispList = NULL; -} - -Bool -PsDestroyPixmap(PixmapPtr pPixmap) -{ - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pPixmap->devPrivate.ptr; - - if( --pPixmap->refcnt ) return TRUE; - - PsScrubPixmap(pPixmap); - - xfree(priv); - dixFreePrivates(pPixmap->devPrivates); - xfree(pPixmap); - return TRUE; -} - -DisplayListPtr -PsGetFreeDisplayBlock(PsPixmapPrivPtr priv) -{ - DisplayListPtr disp = priv->dispList; - - for(; disp ; disp=disp->next ) - { - if( disp->nelms>=DPY_BLOCKSIZE && disp->next ) continue; - if( disp->nelms<DPY_BLOCKSIZE ) return(disp); - disp->next = (DisplayListPtr)xcalloc(1, sizeof(DisplayListRec)); - disp->next->next = (DisplayListPtr)0; - disp->next->nelms = 0; - } - disp = (DisplayListPtr)xcalloc(1, sizeof(DisplayListRec)); - disp->next = (DisplayListPtr)0; - disp->nelms = 0; - priv->dispList = disp; - return(disp); -} - -void -PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable) -{ - switch(elm->type) - { - case PolyPointCmd: - PsPolyPoint(pDrawable, elm->gc, elm->c.polyPts.mode, - elm->c.polyPts.nPoints, elm->c.polyPts.pPoints); - break; - case PolyLineCmd: - PsPolyLine(pDrawable, elm->gc, elm->c.polyPts.mode, - elm->c.polyPts.nPoints, elm->c.polyPts.pPoints); - break; - case PolySegmentCmd: - PsPolySegment(pDrawable, elm->gc, elm->c.segments.nSegments, - elm->c.segments.pSegments); - break; - case PolyRectangleCmd: - PsPolyRectangle(pDrawable, elm->gc, elm->c.rects.nRects, - elm->c.rects.pRects); - break; - case FillPolygonCmd: - PsFillPolygon(pDrawable, elm->gc, 0, elm->c.polyPts.mode, - elm->c.polyPts.nPoints, elm->c.polyPts.pPoints); - break; - case PolyFillRectCmd: - PsPolyFillRect(pDrawable, elm->gc, elm->c.rects.nRects, - elm->c.rects.pRects); - break; - case PolyArcCmd: - PsPolyArc(pDrawable, elm->gc, elm->c.arcs.nArcs, elm->c.arcs.pArcs); - break; - case PolyFillArcCmd: - PsPolyFillArc(pDrawable, elm->gc, elm->c.arcs.nArcs, elm->c.arcs.pArcs); - break; - case Text8Cmd: - PsPolyText8(pDrawable, elm->gc, elm->c.text8.x, elm->c.text8.y, - elm->c.text8.count, elm->c.text8.string); - break; - case Text16Cmd: - PsPolyText16(pDrawable, elm->gc, elm->c.text16.x, elm->c.text16.y, - elm->c.text16.count, elm->c.text16.string); - break; - case TextI8Cmd: - PsImageText8(pDrawable, elm->gc, elm->c.text8.x, elm->c.text8.y, - elm->c.text8.count, elm->c.text8.string); - break; - case TextI16Cmd: - PsImageText16(pDrawable, elm->gc, elm->c.text16.x, elm->c.text16.y, - elm->c.text16.count, elm->c.text16.string); - break; - case PutImageCmd: - PsPutScaledImage(pDrawable, elm->gc, elm->c.image.depth, - elm->c.image.x, elm->c.image.y, - elm->c.image.w, elm->c.image.h, elm->c.image.leftPad, - elm->c.image.format, elm->c.image.res, - elm->c.image.pData); - break; - case BeginFrameCmd: - { - PsOutPtr psOut; - ColormapPtr cMap; - if( PsUpdateDrawableGC(NULL, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_BeginFrame(psOut, 0, 0, elm->c.frame.x, elm->c.frame.y, - elm->c.frame.w, elm->c.frame.h); - } - break; - case EndFrameCmd: - { - PsOutPtr psOut; - ColormapPtr cMap; - if( PsUpdateDrawableGC(NULL, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_EndFrame(psOut); - } - break; - } -} - -void -PsReplayPixmap(PixmapPtr pix, DrawablePtr pDrawable) -{ - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp = priv->dispList; - DisplayElmPtr elm; - - for(; disp ; disp=disp->next ) - { - int i; - for( i=0,elm=disp->elms ; i<disp->nelms ; i++,elm++ ) - PsReplay(elm, pDrawable); - } -} - -int -PsCloneDisplayElm(PixmapPtr dst, DisplayElmPtr elm, DisplayElmPtr newElm, - int xoff, int yoff) -{ - int i; - int size; - int status = 0; - - *newElm = *elm; - - /* I think this is the correct return value */ - if ((newElm->gc = PsCreateAndCopyGC(&dst->drawable, elm->gc)) == NULL) { - return 1; - } - - switch(elm->type) - { - case PolyPointCmd: - case PolyLineCmd: - newElm->c.polyPts.pPoints = - (xPoint *)xalloc(elm->c.polyPts.nPoints*sizeof(xPoint)); - for( i=0 ; i<elm->c.polyPts.nPoints ; i++ ) - { - newElm->c.polyPts.pPoints[i].x = elm->c.polyPts.pPoints[i].x+xoff; - newElm->c.polyPts.pPoints[i].y = elm->c.polyPts.pPoints[i].y+yoff; - } - break; - case PolySegmentCmd: - newElm->c.segments.pSegments = - (xSegment *)xalloc(elm->c.segments.nSegments*sizeof(xSegment)); - for( i=0 ; i<elm->c.segments.nSegments ; i++ ) - { - newElm->c.segments.pSegments[i].x1 = - elm->c.segments.pSegments[i].x1+xoff; - newElm->c.segments.pSegments[i].y1 = - elm->c.segments.pSegments[i].y1+yoff; - newElm->c.segments.pSegments[i].x2 = - elm->c.segments.pSegments[i].x2+xoff; - newElm->c.segments.pSegments[i].y2 = - elm->c.segments.pSegments[i].y2+yoff; - } - break; - case PolyRectangleCmd: - newElm->c.rects.pRects = - (xRectangle *)xalloc(elm->c.rects.nRects*sizeof(xRectangle)); - for( i=0 ; i<elm->c.rects.nRects ; i++ ) - { - newElm->c.rects.pRects[i].x = elm->c.rects.pRects[i].x+xoff; - newElm->c.rects.pRects[i].y = elm->c.rects.pRects[i].y+yoff; - newElm->c.rects.pRects[i].width = elm->c.rects.pRects[i].width; - newElm->c.rects.pRects[i].height = elm->c.rects.pRects[i].height; - } - break; - case FillPolygonCmd: - newElm->c.polyPts.pPoints = - (xPoint *)xalloc(elm->c.polyPts.nPoints*sizeof(xPoint)); - for( i=0 ; i<elm->c.polyPts.nPoints ; i++ ) - { - newElm->c.polyPts.pPoints[i].x = elm->c.polyPts.pPoints[i].x+xoff; - newElm->c.polyPts.pPoints[i].y = elm->c.polyPts.pPoints[i].y+yoff; - } - break; - case PolyFillRectCmd: - newElm->c.rects.pRects = - (xRectangle *)xalloc(elm->c.rects.nRects*sizeof(xRectangle)); - for( i=0 ; i<elm->c.rects.nRects ; i++ ) - { - newElm->c.rects.pRects[i].x = elm->c.rects.pRects[i].x+xoff; - newElm->c.rects.pRects[i].y = elm->c.rects.pRects[i].y+yoff; - newElm->c.rects.pRects[i].width = elm->c.rects.pRects[i].width; - newElm->c.rects.pRects[i].height = elm->c.rects.pRects[i].height; - } - break; - case PolyArcCmd: - newElm->c.arcs.pArcs = - (xArc *)xalloc(elm->c.arcs.nArcs*sizeof(xArc)); - for( i=0 ; i<elm->c.arcs.nArcs ; i++ ) - { - newElm->c.arcs.pArcs[i].x = elm->c.arcs.pArcs[i].x+xoff; - newElm->c.arcs.pArcs[i].y = elm->c.arcs.pArcs[i].y+yoff; - newElm->c.arcs.pArcs[i].width = elm->c.arcs.pArcs[i].width; - newElm->c.arcs.pArcs[i].height = elm->c.arcs.pArcs[i].height; - newElm->c.arcs.pArcs[i].angle1 = elm->c.arcs.pArcs[i].angle1; - newElm->c.arcs.pArcs[i].angle2 = elm->c.arcs.pArcs[i].angle2; - } - break; - case PolyFillArcCmd: - newElm->c.arcs.pArcs = - (xArc *)xalloc(elm->c.arcs.nArcs*sizeof(xArc)); - for( i=0 ; i<elm->c.arcs.nArcs ; i++ ) - { - newElm->c.arcs.pArcs[i].x = elm->c.arcs.pArcs[i].x+xoff; - newElm->c.arcs.pArcs[i].y = elm->c.arcs.pArcs[i].y+yoff; - newElm->c.arcs.pArcs[i].width = elm->c.arcs.pArcs[i].width; - newElm->c.arcs.pArcs[i].height = elm->c.arcs.pArcs[i].height; - newElm->c.arcs.pArcs[i].angle1 = elm->c.arcs.pArcs[i].angle1; - newElm->c.arcs.pArcs[i].angle2 = elm->c.arcs.pArcs[i].angle2; - } - break; - case Text8Cmd: - case TextI8Cmd: - newElm->c.text8.string = (char *)xalloc(elm->c.text8.count); - memcpy(newElm->c.text8.string, elm->c.text8.string, elm->c.text8.count); - newElm->c.text8.x += xoff; - newElm->c.text8.y += yoff; - break; - case Text16Cmd: - case TextI16Cmd: - newElm->c.text16.string = - (unsigned short *)xalloc(elm->c.text16.count*sizeof(unsigned short)); - memcpy(newElm->c.text16.string, elm->c.text16.string, - elm->c.text16.count*sizeof(unsigned short)); - newElm->c.text16.x += xoff; - newElm->c.text16.y += yoff; - break; - case PutImageCmd: - size = PixmapBytePad(elm->c.image.w, elm->c.image.depth)*elm->c.image.h; - newElm->c.image.pData = (char *)xalloc(size); - memcpy(newElm->c.image.pData, elm->c.image.pData, size); - newElm->c.image.x += xoff; - newElm->c.image.y += yoff; - break; - case BeginFrameCmd: - case EndFrameCmd: - status = 1; - break; - } - return(status); -} - -void -PsCopyDisplayList(PixmapPtr src, PixmapPtr dst, int xoff, int yoff, - int x, int y, int w, int h) -{ - PsPixmapPrivPtr sPriv = (PsPixmapPrivPtr)src->devPrivate.ptr; - PsPixmapPrivPtr dPriv = (PsPixmapPrivPtr)dst->devPrivate.ptr; - DisplayListPtr sDisp; - DisplayListPtr dDisp = PsGetFreeDisplayBlock(dPriv); - DisplayElmPtr elm = &dDisp->elms[dDisp->nelms]; - - elm->type = BeginFrameCmd; - elm->c.frame.x = x; - elm->c.frame.y = y; - elm->c.frame.w = w; - elm->c.frame.h = h; - dDisp->nelms += 1; - - sDisp = sPriv->dispList; - for(; sDisp ; sDisp=sDisp->next ) - { - int i; - for( i=0,elm=sDisp->elms ; i<sDisp->nelms ; i++,elm++ ) - { - dDisp = PsGetFreeDisplayBlock(dPriv); - if (PsCloneDisplayElm(dst, elm, &dDisp->elms[dDisp->nelms], - xoff, yoff)==0) - { - dDisp->nelms += 1; - } - } - } - - dDisp = PsGetFreeDisplayBlock(dPriv); - elm = &dDisp->elms[dDisp->nelms]; - elm->type = EndFrameCmd; - dDisp->nelms += 1; -} - -PsElmPtr -PsCreateFillElementList(PixmapPtr pix, int *nElms) -{ - PsElmPtr elms = (PsElmPtr)0; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp = priv->dispList; - PsArcEnum styl; - - *nElms = 0; - for(; disp ; disp=disp->next ) - { - int i; - DisplayElmPtr elm = disp->elms; - - for( i=0 ; i<disp->nelms ; i++,elm++ ) - { - if( !elm->gc ) continue; /* workaround for https://freedesktop.org/bugzilla/show_bug.cgi?id=1416 */ - if( !elm->gc->fgPixel ) continue; - switch(elm->type) - { - case FillPolygonCmd: - *nElms += 1; - break; - case PolyFillRectCmd: - *nElms += elm->c.rects.nRects; - break; - case PolyFillArcCmd: - *nElms += elm->c.arcs.nArcs; - break; - default: /* keep the compiler happy with unhandled enums */ - break; - } - } - } - - if( (*nElms) ) - { - elms = (PsElmPtr)xcalloc(1, (*nElms)*sizeof(PsElmRec)); - if( elms ) - { - disp = priv->dispList; - *nElms = 0; - for(; disp ; disp=disp->next ) - { - int i, k; - DisplayElmPtr elm = disp->elms; - - for( i=0 ; i<disp->nelms ; i++,elm++ ) - { - if( !elm->gc->fgPixel ) continue; - switch(elm->type) - { - case FillPolygonCmd: - elms[*nElms].type = PSOUT_POINTS; - elms[*nElms].nPoints = elm->c.polyPts.nPoints; - elms[*nElms].c.points = - (PsPointPtr)xalloc(elms[*nElms].nPoints*sizeof(PsPointRec)); - for( k=0 ; k<elms[*nElms].nPoints ; k++ ) - { - elms[*nElms].c.points[k].x = elm->c.polyPts.pPoints[k].x; - elms[*nElms].c.points[k].y = elm->c.polyPts.pPoints[k].y; - } - *nElms += 1; - break; - case PolyFillRectCmd: - for( k=0 ; k<elm->c.rects.nRects ; k++ ) - { - elms[*nElms].type = PSOUT_RECT; - elms[*nElms].nPoints = 0; - elms[*nElms].c.rect.x = elm->c.rects.pRects[k].x; - elms[*nElms].c.rect.y = elm->c.rects.pRects[k].y; - elms[*nElms].c.rect.w = elm->c.rects.pRects[k].width; - elms[*nElms].c.rect.h = elm->c.rects.pRects[k].height; - *nElms += 1; - } - break; - case PolyFillArcCmd: - if( elm->gc->arcMode==ArcChord ) styl = PsChord; - else styl = PsPieSlice; - for( k=0 ; k<elm->c.rects.nRects ; k++ ) - { - elms[*nElms].type = PSOUT_ARC; - elms[*nElms].nPoints = 0; - elms[*nElms].c.arc.x = elm->c.arcs.pArcs[k].x; - elms[*nElms].c.arc.y = elm->c.arcs.pArcs[k].y; - elms[*nElms].c.arc.w = elm->c.arcs.pArcs[k].width; - elms[*nElms].c.arc.h = elm->c.arcs.pArcs[k].height; - elms[*nElms].c.arc.a1 = elm->c.arcs.pArcs[k].angle1; - elms[*nElms].c.arc.a2 = elm->c.arcs.pArcs[k].angle2; - elms[*nElms].c.arc.style = styl; - *nElms += 1; - } - break; - default: /* keep the compiler happy with unhandled enums */ - break; - } - } - } - } - } - return(elms); -} - -PsElmPtr -PsCloneFillElementList(int nElms, PsElmPtr elms) -{ - int i; - PsElmPtr newElms; - - newElms = (PsElmPtr)xcalloc(1, nElms*sizeof(PsElmRec)); - if( !newElms ) return(newElms); - for( i=0 ; i<nElms ; i++ ) - { - newElms[i] = elms[i]; - - if( elms[i].type==PSOUT_POINTS ) - { - newElms[i].c.points = - (PsPointPtr)xalloc(elms[i].nPoints*sizeof(PsElmRec)); - memcpy(newElms[i].c.points, elms[i].c.points, - elms[i].nPoints*sizeof(PsPointRec)); - } - } - return(newElms); -} - -void -PsDestroyFillElementList(int nElms, PsElmPtr elms) -{ - int i; - - for( i=0 ; i<nElms ; i++ ) - { if( elms[i].type==PSOUT_POINTS ) xfree(elms[i].c.points); } - - xfree(elms); -} diff --git a/hw/xprint/ps/PsPolygon.c b/hw/xprint/ps/PsPolygon.c deleted file mode 100644 index fe4626085..000000000 --- a/hw/xprint/ps/PsPolygon.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsPolygon.c -** * -** * Contents: Draws Polygons and Rectangles for the PS DDX -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PsPolyRectangle( - DrawablePtr pDrawable, - GCPtr pGC, - int nRects, - xRectangle *pRects) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolyRectangleCmd; - elm->gc = gc; - elm->c.rects.nRects = nRects; - elm->c.rects.pRects = (xRectangle *)xalloc(nRects*sizeof(xRectangle)); - memcpy(elm->c.rects.pRects, pRects, nRects*sizeof(xRectangle)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - PsLineAttrs(psOut, pGC, cMap); - for( i=0 ; i<nRects ; i++ ) - { - PsOut_DrawRect(psOut, (int)pRects[i].x, (int)pRects[i].y, - (int)pRects[i].width, (int)pRects[i].height); - } - } -} - -void -PsFillPolygon( - DrawablePtr pDrawable, - GCPtr pGC, - int shape, - int mode, - int nPoints, - DDXPointPtr pPoints) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = FillPolygonCmd; - elm->gc = gc; - elm->c.polyPts.mode = mode; - elm->c.polyPts.nPoints = nPoints; - elm->c.polyPts.pPoints = (xPoint *)xalloc(nPoints*sizeof(xPoint)); - memcpy(elm->c.polyPts.pPoints, pPoints, nPoints*sizeof(xPoint)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - PsPointPtr pts; - PsRuleEnum rule; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsSetFillColor(pDrawable, pGC, psOut, cMap); - if( pGC->fillRule==EvenOddRule ) rule = PsEvenOdd; - else rule = PsNZWinding; - PsOut_FillRule(psOut, rule); - pts = (PsPointPtr)xalloc(sizeof(PsPointRec)*nPoints); - if( mode==CoordModeOrigin ) - { - for( i=0 ; i<nPoints ; i++ ) - { pts[i].x = pPoints[i].x; pts[i].y = pPoints[i].y; } - } - else - { - i = 0; - pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y; - for( i=1 ; i<nPoints ; i++ ) - { - pts[i].x = pts[i-1].x+pPoints[i].x; - pts[i].y = pts[i-1].y+pPoints[i].y; - } - } - PsOut_Polygon(psOut, nPoints, pts); - xfree(pts); - } -} - -void -PsPolyFillRect( - DrawablePtr pDrawable, - GCPtr pGC, - int nRects, - xRectangle *pRects) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - -#ifdef DBE - /* Remove previous pixmap content if we render one single rect which - * covers the whole pixmap surface (this optimisation was added for - * the double-buffer extension ("DBE") which uses |PolyFillRect()| - * to clear the buffer - but it makes sense in other cases, too). - */ - if (nRects == 1) - { - if ( (pRects[0].x==0) && (pRects[0].y==0) && - (pRects[0].width==pDrawable->width) && (pRects[0].height==pDrawable->height) && - (pGC->fillStyle == FillSolid) && - (noDbeExtension == False)) - { -#ifdef DEBUG_gismobile - ErrorF("PsPolyFillRect: scrubbing pixmap...\n"); -#endif /* DEBUG_gismobile */ - /* Remove all content from the pixmap as it would be covered - * by the whole rect anyway */ - PsScrubPixmap((PixmapPtr)pDrawable); - } - } -#endif /* DBE */ - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = PolyFillRectCmd; - elm->gc = gc; - elm->c.rects.nRects = nRects; - elm->c.rects.pRects = (xRectangle *)xalloc(nRects*sizeof(xRectangle)); - memcpy(elm->c.rects.pRects, pRects, nRects*sizeof(xRectangle)); - disp->nelms += 1; - } - else - { - int i; - PsOutPtr psOut; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsSetFillColor(pDrawable, pGC, psOut, cMap); - for( i=0 ; i<nRects ; i++ ) - { - PsOut_FillRect(psOut, (int)pRects[i].x, (int)pRects[i].y, - (int)pRects[i].width, (int)pRects[i].height); - } - } -} diff --git a/hw/xprint/ps/PsPrint.c b/hw/xprint/ps/PsPrint.c deleted file mode 100644 index 386646858..000000000 --- a/hw/xprint/ps/PsPrint.c +++ /dev/null @@ -1,459 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996, 2000 Sun Microsystems, Inc. All rights reserved. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsPrint.c -** * -** * Contents: Print extension code of Ps driver -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <unistd.h> -#include <errno.h> -#include <X11/Xprotostr.h> - -#define NEED_EVENTS -#include <X11/Xproto.h> -#undef NEED_EVENTS - -#include "Ps.h" - -#include "windowstr.h" -#include "attributes.h" -#include "Oid.h" - -/* static utility function to get document/page attributes */ -static void -S_GetPageAttributes(XpContextPtr pCon,int *iorient,int *icount, int *iplex, - int *ires, unsigned short *iwd, unsigned short *iht) -{ - char *count; - XpOid orient, plex; - /* - * Get the orientation - */ - orient = XpGetContentOrientation(pCon); - switch (orient) { - case xpoid_val_content_orientation_landscape: - *iorient = 1; - break; - case xpoid_val_content_orientation_reverse_portrait: - *iorient = 2; - break; - case xpoid_val_content_orientation_reverse_landscape: - *iorient = 3; - break; - case xpoid_val_content_orientation_portrait: - default: - *iorient = 0; - break; - } - - /* - * Get the count - */ - count = XpGetOneAttribute(pCon, XPDocAttr, "copy-count"); - if( count ) - { - int ii = sscanf(count, "%d", icount); - if( ii!=1 ) *icount = 1; - } - else *icount = 1; - - /* - * Get the plex - */ - plex = XpGetPlex(pCon); - switch(plex) - { - case xpoid_val_plex_duplex: - *iplex = 1; - break; - case xpoid_val_plex_tumble: - *iplex = 2; - break; - default: - *iplex = 0; - break; - } - - /* - * Get the resolution and media size - */ - *ires = XpGetResolution(pCon); - XpGetMediumDimensions(pCon, iwd, iht); -} - - -int -PsStartJob( - XpContextPtr pCon, - Bool sendClientData, - ClientPtr client) -{ - PsContextPrivPtr pConPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - /* - * Create a temporary file to store the printer output. - */ - if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile)) - return BadAlloc; - - return Success; -} - - - -/* I thought about making this following code into a set of routines - or using a goto, or something, but in the end decided not to, - because the plain old listing here makes the logic clearer. */ -int -PsEndJob( - XpContextPtr pCon, - Bool cancel) -{ - int r; - struct stat buffer; - int error; - - PsContextPrivPtr priv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - if (cancel == True) { - if (priv->getDocClient != (ClientPtr) NULL) { - (void) XpFinishDocData( priv->getDocClient ); - - priv->getDocClient = NULL; - priv->getDocBufSize = 0; - } - - /* job is cancelled - do we really care if we're out of space? */ - (void) fclose(priv->pJobFile); - priv->pJobFile = NULL; - - unlink(priv->jobFileName); - xfree(priv->jobFileName); - priv->jobFileName = (char *)NULL; - - PsFreeFontInfoRecords(priv); - - return Success; - } - - /* - * Append any trailing information here - */ - PsOut_EndFile(priv->pPsOut, 0); - priv->pPsOut = NULL; - - /* this is where we find out if we're out of space */ - error = (fclose(priv->pJobFile) == EOF); - priv->pJobFile = NULL; - - /* status to the client if we have ran out of space on the disk or - some other resource problem with the temporary file... */ - if (error) { - if (priv->getDocClient != (ClientPtr) NULL) { - (void) XpFinishDocData( priv->getDocClient ); - - priv->getDocClient = NULL; - priv->getDocBufSize = 0; - } - - unlink(priv->jobFileName); - xfree(priv->jobFileName); - priv->jobFileName = (char *)NULL; - - PsFreeFontInfoRecords(priv); - - return BadAlloc; - } - - /* we have finished without incident & no cancel */ - - if (priv->getDocClient != NULL && priv->getDocBufSize > 0) { - FILE *file; - - file = fopen(priv->jobFileName, "r"); - if (!file || (fstat(fileno(file), &buffer) < 0)) - r = BadAlloc; - else - r = XpSendDocumentData(priv->getDocClient, file, buffer.st_size, - priv->getDocBufSize); - if (file) - fclose(file); - - (void) XpFinishDocData(priv->getDocClient); - - priv->getDocClient = NULL; - priv->getDocBufSize = 0; - } - else { - XpSubmitJob(priv->jobFileName, pCon); - - r = Success; - } - - unlink(priv->jobFileName); - xfree(priv->jobFileName); - priv->jobFileName = (char *)NULL; - - PsFreeFontInfoRecords(priv); - -#ifdef BM_CACHE - PsBmClearImageCache(); -#endif - - return r; -} - -/* StartPage - */ -int -PsStartPage( - XpContextPtr pCon, - WindowPtr pWin) -{ - int iorient, iplex, icount, ires; - unsigned short iwd, iht; - PsContextPrivPtr pConPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); - -/* - * Put a pointer to the context in the window private structure - */ - pWinPriv->validContext = 1; - pWinPriv->context = pCon; - - /* get page level attributes */ - S_GetPageAttributes(pCon,&iorient,&icount,&iplex,&ires,&iwd,&iht); - /* - * Start the page - */ - if (pConPriv->pPsOut == NULL) { - char *title; - - /* get job level attributes */ - title = XpGetOneAttribute(pCon, XPJobAttr, "job-name"); - - pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile, - title, iorient, icount, iplex, ires, - (int)iwd, (int)iht, False); - pConPriv->fontInfoRecords = NULL; - pConPriv->fontTypeInfoRecords = NULL; - } - PsOut_BeginPage(pConPriv->pPsOut, iorient, icount, iplex, ires, - (int)iwd, (int)iht); - - return Success; -} - - -/* - * EndPage: - * - * Write page trailer to page file - * Write page file to job file - */ -int -PsEndPage( - XpContextPtr pCon, - WindowPtr pWin) -{ - PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); - PsContextPrivPtr pConPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - PsOut_EndPage(pConPriv->pPsOut); - - pWinPriv->validContext = 0; - pWinPriv->context = NULL; - - /* status to the client if we have ran out of space on the disk or - some other resource problem with the temporary file... */ -/* if (ferror(pConPriv->pJobFile)) return BadAlloc; */ - - return Success; -} - -/* - * The PsStartDoc() and PsEndDoc() functions serve basically as NOOP - * placeholders. This driver doesn't deal with the notion of multiple - * documents per page. - */ - -int -PsStartDoc(XpContextPtr pCon, XPDocumentType type) -{ - int iorient, iplex, icount, ires; - unsigned short iwd, iht; - char *title; - PsContextPrivPtr pConPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - /* get job level attributes */ - title = XpGetOneAttribute(pCon, XPJobAttr, "job-name"); - - /* get document level attributes */ - S_GetPageAttributes(pCon,&iorient,&icount,&iplex,&ires,&iwd,&iht); - - pConPriv->pPsOut = PsOut_BeginFile(pConPriv->pJobFile, - title, iorient, icount, iplex, ires, - (int)iwd, (int)iht, (Bool)(type == XPDocRaw)); - - pConPriv->fontInfoRecords = NULL; - pConPriv->fontTypeInfoRecords = NULL; - - return Success; -} - -int -PsEndDoc( - XpContextPtr pCon, - Bool cancel) -{ - return Success; -} - -/* - * PsDocumentData() - * - * Hand any pre-generated PDL down to the spool files, formatting it - * as necessary to fit the given window. - */ - -int -PsDocumentData( - XpContextPtr pCon, - DrawablePtr pDraw, - char *pData, - int len_data, - char *pFmt, - int len_fmt, - char *pOpt, - int len_opt, - ClientPtr client) -{ - PsContextPrivPtr cPriv; - PsOutPtr psOut; - - if (len_fmt != 12 || - strncasecmp(pFmt, "PostScript 2", len_fmt) != 0 || - len_opt) - return BadValue; - - cPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - psOut = cPriv->pPsOut; - - if (pDraw) - PsOut_BeginFrame(psOut, 0, 0, pDraw->x, pDraw->y, - pDraw->width, pDraw->height); - PsOut_RawData(psOut, pData, len_data); - if (pDraw) - PsOut_EndFrame(psOut); - - return Success; -} - -/* - * - * PsGetDocumentData() - * - * This function allows the driver to send the generated PS back to - * the client. - */ - -int -PsGetDocumentData( - XpContextPtr pCon, - ClientPtr client, - int maxBufferSize) -{ - PsContextPrivPtr pPriv = (PsContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); - - pPriv->getDocClient = client; - pPriv->getDocBufSize = maxBufferSize; - - return Success; -} - diff --git a/hw/xprint/ps/PsSpans.c b/hw/xprint/ps/PsSpans.c deleted file mode 100644 index c0e66ee7a..000000000 --- a/hw/xprint/ps/PsSpans.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsSpans.c -** * -** * Contents: Code to set and fill spans in the PS DDX -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" - -void -PsFillSpans( - DrawablePtr pDrawable, - GCPtr pGC, - int nSpans, - DDXPointPtr pPoints, - int *pWidths, - int fSorted) -{ - PsOutPtr psOut; - int xoffset, yoffset; - xRectangle *rects, *r; - RegionPtr fillRegion, region = 0; - int i; - int nbox; - BoxPtr pbox; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - - /* - * Build a region out of the spans - */ - rects = (xRectangle *)xalloc(nSpans*sizeof(xRectangle)); - xoffset = pDrawable->x; - yoffset = pDrawable->y; - - for( i = 0, r = rects; i < nSpans; i++, r++ ) - { - r->x = pPoints[i].x + xoffset; - r->y = pPoints[i].y + yoffset; - r->width = pWidths[i]; - r->height = 1; - } - fillRegion = RECTS_TO_REGION(pGC->pScreen, nSpans, rects, - (fSorted)?CT_YSORTED:CT_UNSORTED); - - /* - * Intersect this region with the clip region. Whatever's left, - * should be filled. - */ -/*REGION_INTERSECT(pGC->pScreen, region, fillRegion, pGC->clientClip);*/ - - pbox = REGION_RECTS(region); - nbox = REGION_NUM_RECTS(region); - - /* Enter HP-GL/2 */ - /*###SEND_PCL( outFile, "\27%0B" );*/ - - while( nbox ) - { -/*### - sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, pbox->x2, pbox->y2); - SEND_PCL( outFile, t ); -*/ - nbox--; - pbox++; - } - - /* Go back to PCL */ - /*###SEND_PCL( outFile, "\27%0A" );*/ - - /* - * Clean up the temporary regions - */ - REGION_DESTROY(pGC->pScreen, fillRegion); - REGION_DESTROY(pGC->pScreen, region); - xfree(rects); -} - -void -PsSetSpans( - DrawablePtr pDrawable, - GCPtr pGC, - char *pSrc, - DDXPointPtr pPoints, - int *pWidths, - int nSpans, - int fSorted) -{ -} diff --git a/hw/xprint/ps/PsText.c b/hw/xprint/ps/PsText.c deleted file mode 100644 index 872c0f427..000000000 --- a/hw/xprint/ps/PsText.c +++ /dev/null @@ -1,581 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsText.c -** * -** * Contents: Character-drawing routines for the PS DDX -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "Ps.h" -#include "gcstruct.h" -#include "windowstr.h" -#include <X11/fonts/fntfil.h> -#include <X11/fonts/fntfilst.h> -#include <limits.h> - -int -PsPolyText8( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - char *string) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return x; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = Text8Cmd; - elm->gc = gc; - elm->c.text8.x = x; - elm->c.text8.y = y; - elm->c.text8.count = count; - elm->c.text8.string = (char *)xalloc(count); - memcpy(elm->c.text8.string, string, count); - disp->nelms += 1; - - return x; - } - else - { - PsFontInfoRec *firec; - - /* We need a context for rendering... */ - if (PsGetPsContextPriv(pDrawable) == NULL) - return x; - - firec = PsGetFontInfoRec(pDrawable, pGC->font); - if (!firec) - return x; - -#ifdef XP_USE_FREETYPE - if (firec->ftir->downloadableFont && - (firec->ftir->font_type == PSFTI_FONT_TYPE_FREETYPE)) - { - PsOutPtr psOut; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) - return x; - - if (firec->ftir->alreadyDownloaded[0] == False) - { - PsOut_DownloadFreeType(psOut, - firec->ftir->ft_download_font_type, - firec->ftir->download_ps_name, pGC->font, 0); - firec->ftir->alreadyDownloaded[0] = True; - } - - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - if (!firec->size) - PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding); - else - PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding); - PsOut_FreeType_Text(pGC->font, psOut, x, y, string, count); - - return x; - } - else -#endif /* XP_USE_FREETYPE */ - if (firec->ftir->downloadableFont && - (firec->ftir->font_type != PSFTI_FONT_TYPE_FREETYPE)) - { - PsOutPtr psOut; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) - return x; - - if (firec->ftir->alreadyDownloaded[0] == False) - { - PsOut_DownloadType1(psOut, "PsPolyText8", - firec->ftir->download_ps_name, firec->ftir->filename); - firec->ftir->alreadyDownloaded[0] = True; - } - - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - if (!firec->size) - PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding); - else - PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding); - PsOut_Text(psOut, x, y, string, count, -1); - - return x; - } - - /* Render glyphs as bitmaps */ - { - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; - - GetGlyphs(pGC->font, (unsigned long)count, - (unsigned char *)string, Linear8Bit, &n, charinfo); - w = 0; - for (i=0; i < n; i++) - w += charinfo[i]->metrics.characterWidth; - - if (n != 0) - PsPolyGlyphBlt(pDrawable, pGC, x, y, n, - charinfo, FONTGLYPHS(pGC->font)); - x += w; - - return x; - } - } - return x; -} - -int -PsPolyText16( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *string) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return x; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = Text16Cmd; - elm->gc = gc; - elm->c.text16.x = x; - elm->c.text16.y = y; - elm->c.text16.count = count; - elm->c.text16.string = - (unsigned short *)xalloc(count*sizeof(unsigned short)); - memcpy(elm->c.text16.string, string, count*sizeof(unsigned short)); - disp->nelms += 1; - - return x; - } - else - { - PsFontInfoRec *firec; - - /* We need a context for rendering... */ - if (PsGetPsContextPriv(pDrawable) == NULL) - return x; - - firec = PsGetFontInfoRec(pDrawable, pGC->font); - if (!firec) - return x; - -#ifdef XP_USE_FREETYPE - if (firec->ftir->downloadableFont && - (firec->ftir->font_type == PSFTI_FONT_TYPE_FREETYPE)) - { - PsOutPtr psOut; - ColormapPtr cMap; - unsigned short c, - c_hiByte, - c_lowByte, - fontPage; - int i; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) - return x; - - /* Scan the string we want to render and download all neccesary parts - * of the font (one part(="font page") has 256 glyphs) - */ - for( i = 0 ; i < count ; i++ ) - { - c = string[i]; -#if IMAGE_BYTE_ORDER == LSBFirst - c_hiByte = c & 0x00FF; - c_lowByte = (c >> 8) & 0x00FF; -#elif IMAGE_BYTE_ORDER == MSBFirst - c_hiByte = (c >> 8) & 0x00FF; - c_lowByte = c & 0x00FF; -#else -#error Unsupported byte order -#endif - fontPage = c_hiByte; - - if (firec->ftir->alreadyDownloaded[fontPage] == False) - { - char buffer[256]; - const char *ps_name; - - if (fontPage > 0) - { - sprintf(buffer, "%s_%x", firec->ftir->download_ps_name, (int)fontPage); - ps_name = buffer; - } - else - { - ps_name = firec->ftir->download_ps_name; - } - - PsOut_DownloadFreeType(psOut, - firec->ftir->ft_download_font_type, - ps_name, pGC->font, (fontPage * 0x100)); /* same as (fontPage << 8) */ - - firec->ftir->alreadyDownloaded[fontPage] = True; - } - } - - - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - if (!firec->size) - PsOut_FreeType_TextAttrsMtx16(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding); - else - PsOut_FreeType_TextAttrs16(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding); - PsOut_FreeType_Text16(pGC->font, psOut, x, y, string, count); - - return x; - } - else -#endif /* XP_USE_FREETYPE */ - if (firec->ftir->downloadableFont && - (firec->ftir->font_type != PSFTI_FONT_TYPE_FREETYPE)) - { - PsOutPtr psOut; - ColormapPtr cMap; - unsigned short fontPage; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) - return x; - - PsOut_DownloadType1(psOut, "PsPolyText16", - firec->ftir->download_ps_name, firec->ftir->filename); - firec->ftir->alreadyDownloaded[fontPage] = True; - - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - if (!firec->size) - PsOut_TextAttrsMtx(psOut, firec->ftir->download_ps_name, firec->mtx, firec->ftir->is_iso_encoding); - else - PsOut_TextAttrs(psOut, firec->ftir->download_ps_name, firec->size, firec->ftir->is_iso_encoding); - PsOut_Text16(psOut, x, y, string, count, -1); - - return x; - } - - /* Render glyphs as bitmaps */ - { - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ - - GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string, - (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, - &n, charinfo); - w = 0; - for (i=0; i < n; i++) - w += charinfo[i]->metrics.characterWidth; - if (n != 0) - PsPolyGlyphBlt(pDrawable, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); - x += w; - - return x; - } - } - return x; -} - -void -PsImageText8( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - char *string) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = TextI8Cmd; - elm->gc = gc; - elm->c.text8.x = x; - elm->c.text8.y = y; - elm->c.text8.count = count; - elm->c.text8.string = (char *)xalloc(count); - memcpy(elm->c.text8.string, string, count); - disp->nelms += 1; - } - else - { - int iso; - int siz; - float mtx[4]; - char *fnam; - PsOutPtr psOut; - ColormapPtr cMap; - - if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return; - PsOut_Offset(psOut, pDrawable->x, pDrawable->y); - PsOut_Color(psOut, PsGetPixelColor(cMap, pGC->fgPixel)); - fnam = PsGetPSFontName(pGC->font); - if( !fnam ) fnam = "Times-Roman"; - siz = PsGetFontSize(pGC->font, mtx); - iso = PsIsISOLatin1Encoding(pGC->font); - if( !siz ) PsOut_TextAttrsMtx(psOut, fnam, mtx, iso); - else PsOut_TextAttrs(psOut, fnam, siz, iso); - PsOut_Text(psOut, x, y, string, count, PsGetPixelColor(cMap, pGC->bgPixel)); - } -} - -void -PsImageText16( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *string) -{ - if( pDrawable->type==DRAWABLE_PIXMAP ) - { - DisplayElmPtr elm; - PixmapPtr pix = (PixmapPtr)pDrawable; - PsPixmapPrivPtr priv = (PsPixmapPrivPtr)pix->devPrivate.ptr; - DisplayListPtr disp; - GCPtr gc; - - if ((gc = PsCreateAndCopyGC(pDrawable, pGC)) == NULL) return; - - disp = PsGetFreeDisplayBlock(priv); - - elm = &disp->elms[disp->nelms]; - elm->type = TextI16Cmd; - elm->gc = gc; - elm->c.text16.x = x; - elm->c.text16.y = y; - elm->c.text16.count = count; - elm->c.text16.string = - (unsigned short *)xalloc(count*sizeof(unsigned short)); - memcpy(elm->c.text16.string, string, count*sizeof(unsigned short)); - disp->nelms += 1; - } - else - { - int i; - char *str; - if( !count ) return; - str = (char *)xalloc(count); - for( i=0 ; i<count ; i++ ) str[i] = string[i]; - PsImageText8(pDrawable, pGC, x, y, count, str); - free(str); - } -} - -void -PsImageGlyphBlt( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nGlyphs, - CharInfoPtr *pCharInfo, - pointer pGlyphBase) -{ - /* NOT TO BE IMPLEMENTED */ -} - -void -PsPolyGlyphBlt( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nGlyphs, - CharInfoPtr *pCharInfo, - pointer pGlyphBase) -{ - int width, height; - PixmapPtr pPixmap; - int nbyLine; /* bytes per line of padded pixmap */ - FontPtr pfont; - GCPtr pGCtmp; - register int i; - register int j; - unsigned char *pbits; /* buffer for PutImage */ - register unsigned char *pb; /* temp pointer into buffer */ - register CharInfoPtr pci; /* currect char info */ - register unsigned char *pglyph; /* pointer bits in glyph */ - int gWidth, gHeight; /* width and height of glyph */ - register int nbyGlyphWidth; /* bytes per scanline of glyph */ - int nbyPadGlyph; /* server padded line of glyph */ - int w, tmpx; - XID gcvals[3]; - - pfont = pGC->font; - width = FONTMAXBOUNDS(pfont,rightSideBearing) - - FONTMINBOUNDS(pfont,leftSideBearing); - height = FONTMAXBOUNDS(pfont,ascent) + - FONTMAXBOUNDS(pfont,descent); - - if ((width == 0) || (height == 0) ) - return; - { - int i; - w = 0; - for (i=0; i < nGlyphs; i++) w += pCharInfo[i]->metrics.characterWidth; - } - pGCtmp = GetScratchGC(1, pDrawable->pScreen); - if (!pGCtmp) - { - (*pDrawable->pScreen->DestroyPixmap)(pPixmap); - return; - } - - gcvals[0] = GXcopy; - gcvals[1] = pGC->fgPixel; - gcvals[2] = pGC->bgPixel; - - DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0); - - - nbyLine = BitmapBytePad(width); - pbits = (unsigned char *)xalloc(height*nbyLine); - if (!pbits){ - PsDestroyPixmap(pPixmap); - return; - } - tmpx = 0; - while(nGlyphs--) - { - pci = *pCharInfo++; - pglyph = FONTGLYPHBITS(pGlyphBase, pci); - gWidth = GLYPHWIDTHPIXELS(pci); - gHeight = GLYPHHEIGHTPIXELS(pci); - if (gWidth && gHeight) - { - nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci); - nbyPadGlyph = BitmapBytePad(gWidth); - - if (nbyGlyphWidth == nbyPadGlyph -#if GLYPHPADBYTES != 4 - && (((int) pglyph) & 3) == 0 -#endif - ) - { - pb = pglyph; - } - else - { - for (i=0, pb = pbits; i<gHeight; i++, pb = pbits+(i*nbyPadGlyph)) - for (j = 0; j < nbyGlyphWidth; j++) - *pb++ = *pglyph++; - pb = pbits; - } - - PsPutImageMask((DrawablePtr)pDrawable, pGCtmp, - 1, x + pci->metrics.leftSideBearing, - y - pci->metrics.ascent, gWidth, gHeight, - 0, XYBitmap, (char *)pb); - } - - x += pci->metrics.characterWidth; - } - xfree(pbits); - FreeScratchGC(pGCtmp); -} diff --git a/hw/xprint/ps/PsWindow.c b/hw/xprint/ps/PsWindow.c deleted file mode 100644 index 8bfde4b0d..000000000 --- a/hw/xprint/ps/PsWindow.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: PsWindow.c -** * -** * Contents: Window code for PS driver. -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <sys/wait.h> - -#include "mistruct.h" -#include "regionstr.h" -#include "windowstr.h" -#include "gcstruct.h" - -#include "Ps.h" - -/* - * The following list of strings defines the properties which will be - * placed on the screen's root window if the property was defined in - * the start-up configuration resource database. - */ -#if 0 -static char *propStrings[] = { - DT_PRINT_JOB_HEADER, - DT_PRINT_JOB_TRAILER, - DT_PRINT_JOB_COMMAND, - DT_PRINT_JOB_EXEC_COMMAND, - DT_PRINT_JOB_EXEC_OPTIONS, - DT_PRINT_PAGE_HEADER, - DT_PRINT_PAGE_TRAILER, - DT_PRINT_PAGE_COMMAND, - (char *)NULL -}; -#endif - -/* - * PsCreateWindow - watch for the creation of the root window. - * When it's created, register the screen with the print extension, - * and put the default command/header properties on it. - */ -/*ARGSUSED*/ - -Bool -PsCreateWindow(WindowPtr pWin) -{ - PsWindowPrivPtr pPriv; - -#if 0 - Bool status = Success; - ScreenPtr pScreen = pWin->drawable.pScreen; - PsScreenPrivPtr pScreenPriv = (PsScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey); - PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); - - /* - * Initialize this window's private struct. - */ - pWinPriv->jobFileName = (char *)NULL; - pWinPriv->pJobFile = (FILE *)NULL; - pWinPriv->pageFileName = (char *)NULL; - pWinPriv->pPageFile = (FILE *)NULL; - - if(pWin->parent == (WindowPtr)NULL) /* root window? */ - { - Atom propName; /* type = XA_STRING */ - char *propVal; - int i; - XrmDatabase rmdb = pScreenPriv->resDB; - - /* - * Put the defaults spec'd in the config files in properties on this - * screen's root window. - */ - for(i = 0; propStrings[i] != (char *)NULL; i++) - { - if((propVal = _DtPrintGetPrinterResource(pWin, rmdb, - propStrings[i])) != - (char *)NULL) - { - propName = MakeAtom(propStrings[i], strlen(propStrings[i]), - TRUE); - dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING, - 8, PropModeReplace, strlen(propVal), - (pointer)propVal, FALSE); - xfree(propVal); - } - } - } - - return status; -#endif - - pPriv = (PsWindowPrivPtr) - dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); - pPriv->validContext = 0; - - return TRUE; -} - - -/*ARGSUSED*/ -Bool PsMapWindow(WindowPtr pWindow) -{ - return TRUE; -} - -/*ARGSUSED*/ -Bool -PsPositionWindow( - WindowPtr pWin, - int x, - int y) -{ - return TRUE; -} - -/*ARGSUSED*/ -Bool -PsUnmapWindow(WindowPtr pWindow) -{ - return TRUE; -} - -/*ARGSUSED*/ -void -PsCopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ -} - -/*ARGSUSED*/ -Bool -PsChangeWindowAttributes( - WindowPtr pWin, - unsigned long mask) -{ - return TRUE; -} - -/*ARGSUSED*/ -Bool -PsDestroyWindow(WindowPtr pWin) -{ - return TRUE; -} diff --git a/hw/xprint/ps/psout.c b/hw/xprint/ps/psout.c deleted file mode 100644 index c24f88b3d..000000000 --- a/hw/xprint/ps/psout.c +++ /dev/null @@ -1,1789 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996, 2000 Sun Microsystems, Inc. All Rights Reserved. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: psout.c -** * -** * Contents: Code to output PostScript to file -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include "os.h" -#define USE_PSOUT_PRIVATE 1 -#include "Ps.h" -#include "psout.h" -#ifdef XP_USE_FREETYPE -#include <ft2build.h> -#include FT_FREETYPE_H -#endif /* XP_USE_FREETYPE */ -/* For VENDOR_STRING and VENDOR_RELEASE */ -#include "site.h" - -/* - * Standard definitions - */ - -static char *S_StandardDefs = "\ -/d{def}bind def\ -/b{bind}bind d\ -/bd{b d}b d\ -/x{exch}bd\ -/xd{x d}bd\ -/dp{dup}bd\ -/t{true}bd\ -/f{false}bd\ -/p{pop}bd\ -/r{roll}bd\ -/c{copy}bd\ -/i{index}bd\ -/rp{repeat}bd\ -/n{newpath}bd\ -/w{setlinewidth}bd\ -/lc{setlinecap}bd\ -/lj{setlinejoin}bd\ -/sml{setmiterlimit}bd\ -/ds{setdash}bd\ -/ie{ifelse}bd\ -/len{length}bd\ -/m{moveto}bd\ -/rm{rmoveto}bd\ -/l{lineto}bd\ -/rl{rlineto}bd\ -/a{arc}bd\ -/an{arcn}bd\ -/st{stroke}bd\ -/fl{fill}bd\ -/ef{eofill}bd\ -/sp{showpage}bd\ -/cp{closepath}bd\ -/clp{clippath}bd\ -/cl{clip}bd\ -/pb{pathbbox}bd\ -/tr{translate}bd\ -/rt{rotate}bd\ -/dv{div}bd\ -/ml{mul}bd\ -/ad{add}bd\ -/ng{neg}bd\ -/scl{scale}bd\ -/sc{setrgbcolor}bd\ -/g{setgray}bd\ -/gs{gsave}bd\ -/gr{grestore}bd\ -/sv{save}bd\ -/rs{restore}bd\ -/mx{matrix}bd\ -/cm{currentmatrix}bd\ -/sm{setmatrix}bd\ -/ccm{concatmatrix}bd\ -/cc{concat}bd\ -/ff{findfont}bd\ -/mf{makefont}bd\ -/sf{setfont}bd\ -/cft{currentfont}bd\ -/fd{FontDirectory}bd\ -/sh{show}bd\ -/stw{stringwidth}bd\ -/ci{colorimage}bd\ -/ig{image}bd\ -/im{imagemask}bd\ -/cf{currentfile}bd\ -/rh{readhexstring}bd\ -/str{string}bd\ -/al{aload}bd\ -/wh{where}bd\ -/kn{known}bd\ -/stp{stopped}bd\ -/bg{begin}bd\ -/ed{end}bd\ -/fa{forall}bd\ -/pi{putinterval}bd\ -/mk{mark}bd\ -/ctm{cleartomark}bd\ -/df{definefont}bd\ -/cd{currentdict}bd\ -/db{20 dict dp bg}bd\ -/de{ed}bd\ -/languagelevel wh{p languagelevel}{1}ie\ - 1 eq{/makepattern{p}bd/setpattern{p}bd/setpagedevice{p}bd}if\ -/mp{makepattern}bd\ -/spt{setpattern}bd\ -/spd{setpagedevice}bd\ -" -#ifdef XP_USE_FREETYPE -"/trmoveto{currentfont /FontMatrix get transform rm}d" -#endif /* XP_USE_FREETYPE */ -; - -/* - * Composite definitions - * - * - * XYr - Return X/Y dpi for device - * - * XYr <xdpi> <ydpi> - * - * Cs - Coordinate setup (for origin upper left) - * - * <orient(0,1,2,3)> Cs - * - * P - Draw a point - * - * <x> <y> P - * - * R - Add rectangle to path - * - * <x> <y> <w> <h> R - * - * Ac - Add arc to path - * - * <x> <y> <w> <h> <ang1> <ang2> Ac - * - * An - Add arc to path (counterclockwise) - * - * <x> <y> <w> <h> <ang1> <ang2> An - * - * Tf - Set font - * - * <font_name> <size> <iso> Tf - * - * Tfm - Set font with matrix - * - * <font_name> <matrix> <iso> Tfm - * - * T - Draw text - * - * <text> <x> <y> T - * - * Tb - Draw text with background color - * - * <text> <x> <y> <bg_red> <bg_green> <bg_blue> Tb - * - * Im1 - Image 1 bit monochrome imagemask - * - * <x> <y> <w> <h> <sw> <sh> Im1 - * - * Im24 - Image 24 bit RGB color - * - * <x> <y> <w> <h> <sw> <sh> Im24 - * - * Im1t - Image 1 bit monochrome imagemask (in tile) - * - * <data> <x> <y> <w> <h> <sw> <sh> Im1t - * - * Im24t - Image 24 bit RGB color (in tile) - * - * <data> <x> <y> <w> <h> <sw> <sh> Im24t - */ - -static char *S_CompositeDefs = "\ -/XYr{/currentpagedevice wh\ - {p currentpagedevice dp /HWResolution kn\ - {/HWResolution get al p}{p 300 300}ie}{300 300}ie}bd\ -/Cs{dp 0 eq{0 pHt tr XYr -1 x dv 72 ml x 1 x dv 72 ml x scl}if\ - dp 1 eq{90 rt XYr -1 x dv 72 ml x 1 x dv 72 ml x scl}if\ - dp 2 eq{pWd 0 tr XYr 1 x dv 72 ml x -1 x dv 72 ml x scl}if\ - 3 eq{pHt pWd tr 90 rt XYr 1 x dv 72 ml x -1 x dv 72 ml x scl}if}bd\ -/P{gs 1 w [] 0 ds 2 c m .1 ad x .1 ad x l st gr}bd\ -/R{4 2 r m 1 i 0 rl 0 x rl ng 0 rl cp}bd\ -/Ac{mx_ cm p 6 -2 r tr 4 2 r ng scl 0 0 .5 5 3 r a mx_ sm}bd\ -/An{mx_ cm p 6 -2 r tr 4 2 r ng scl 0 0 .5 5 3 r an mx_ sm}bd\ -/ISO{dp len dict bg{1 i/FID ne{d}{p p}ie}fa\ - /Encoding ISOLatin1Encoding d cd ed df}bd\ -/iN{dp len str cvs dp len x 1 i 3 ad str 2 c c p x p dp 3 -1 r(ISO)pi}bd\ -/Tp{{x dp iN dp fd x kn{x p dp/f_ x d ff}{dp/f_ x d x ff ISO}ie x}\ - {x dp/f_ x d ff x}ie}bd\ -/Tf{Tp[x 0 0 2 i ng 0 0] dp/fm_ x d mf sf}bd\ -/Tfm{Tp 1 -1 tm1_ scl tm2_ ccm dp/fm_ x d mf sf}bd\ -/T{m sh}bd\ -/Tb{gs sc f_ ff sf cft/FontMatrix get 3 get\ - cft/FontBBox get dp 1 get x 3 get 2 i ml 3 1 r ml\ - 0 0 m 4 i stw p 4 i 4 i m fm_ cc\ - 0 2 i rl dp 0 rl 0 2 i ng rl 0 3 i rl ng 0 rl cp fl p p\ - gr T}bd\ -/Im1{6 4 r tr scl t [3 i 0 0 5 i 0 0]{cf str1 rh p} im}bd\ -/Im1rev{6 4 r tr scl f [3 i 0 0 5 i 0 0]{cf str1 rh p} im}bd\ -/Im24{gs 6 4 r tr scl 8 [3 i 0 0 5 i 0 0]{cf str3 rh p} f 3 ci}bd\ -/Im1t{6 4 r tr scl t [3 i 0 0 5 i 0 0]{} im}bd\ -/Im24t{gs 6 4 r tr scl 8 [3 i 0 0 5 i 0 0]{} f 3 ci}bd\ -/ck2{/currentpagedevice wh \ -{p dp currentpagedevice dp 3 -1 r kn \ -{x get al p 3 -1 r eq 3 1 r eq and } \ -{p p p p t}ie} \ -{p p p t}ie}bd \ -/ck1{/currentpagedevice wh \ -{p dp currentpagedevice dp 3 -1 r kn \ -{x get eq} {p p p t}ie} \ -{p p t}ie}bd \ -/mtx{scl t [3 i 0 0 5 i 0 0]}bd \ -"; - -char *pg_orient[] = {"Portrait","Landscape","Reverse Portrait","Reverse Landscape"}; -/* - * Setup definitions - */ - -static char *S_SetupDefs = "\ - /mx_ mx d\ - /im_ mx d\ - /tm1_ mx d\ - /tm2_ mx d\ - /str3 3 str d\ - /str1 1 str d\ -"; - -/******************************************************************* - * PRIVATE FUNCTIONS * - *******************************************************************/ - -void -S_Flush(PsOutPtr self) -{ - int len; - - if( self->Buf[0] == '\0' ) - return; - - len = strlen(self->Buf); - - /* Append a newline char ('\n') if there isn't one there already */ - if( self->Buf[len-1] != '\n' ) - { - self->Buf[len++] = '\n'; - self->Buf[len] = '\0'; - } - - (void)fwrite(self->Buf, len, 1, self->Fp); - - self->Buf[0] = '\0'; -} - -static void -S_Comment(PsOutPtr self, char *comment) -{ - S_Flush(self); - strcpy(self->Buf, comment); - S_Flush(self); -} - -static void -S_OutDefs(PsOutPtr self, char *defs) -{ - int i, k=0; - S_Flush(self); - memset(self->Buf, 0, sizeof(self->Buf)); - for( i=0 ; defs[i]!='\0' ;) - { - if( k>70 && (i==0 || (i && defs[i-1]!='/')) && - (defs[i]==' ' || defs[i]=='/' || defs[i]=='{') ) - { - S_Flush(self); - k = 0; - memset(self->Buf, 0, sizeof(self->Buf)); - } - if( k && self->Buf[k-1]==' ' && defs[i]==' ' ) { i++; continue; } - self->Buf[k] = defs[i]; - k++; i++; - } - S_Flush(self); -} - -void -S_OutNum(PsOutPtr self, float num) -{ - int i; - char buf[64]; - int len; - - sprintf(buf, "%.3f", num); - - /* Remove any zeros at the end */ - for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0'; - /* Remove '.' if it is the last character */ - i = strlen(buf)-1; if( buf[i]=='.' ) buf[i] = '\0'; - - len = strlen(self->Buf); - if( len > 0 ) - { - self->Buf[len++] = ' '; - self->Buf[len] = '\0'; - } - strcpy(&self->Buf[len], buf); - if( (len+i)>70 ) S_Flush(self); -} - -static void -S_OutStr(PsOutPtr self, char *txt, int txtl) -{ - int i, k; - char buf[1024]; - for( i=0,k=0 ; i<txtl ; i++ ) - { - if( (txt[i]>=' ' && txt[i]<='~') && - txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' ) - { buf[k] = txt[i]; k++; continue; } - buf[k] = '\\'; k++; - sprintf(&buf[k], "%03o", txt[i]&0xFF); - /* Skip to the end of the buffer */ - while( buf[k] != '\0' ) - k++; - } - strcat(self->Buf, "("); - i = strlen(self->Buf); - memcpy(&self->Buf[i], buf, k); - self->Buf[i+k] = '\0'; - strcat(self->Buf, ")"); - if( strlen(self->Buf)>70 ) S_Flush(self); -} - -/* Same as S_OutStr() but takes |short *| instead of |char *| */ -static void -S_OutStr16(PsOutPtr self, unsigned short *txt, int txtl) -{ - int i, k; - char buf[2048]; - for( i=0,k=0 ; i<txtl ; i++ ) - { - if( (txt[i]>=' ' && txt[i]<='~') && - txt[i]!='(' && txt[i]!=')' && txt[i]!='\\' ) - { buf[k] = txt[i]; k++; continue; } - buf[k] = '\\'; k++; - sprintf(&buf[k], "%03o", txt[i]&0xFFFF); - /* Skip to the end of the buffer */ - while( buf[k] != '\0' ) - k++; - } - strcat(self->Buf, "("); - i = strlen(self->Buf); - memcpy(&self->Buf[i], buf, k); - self->Buf[i+k] = '\0'; - strcat(self->Buf, ")"); - if( strlen(self->Buf)>70 ) S_Flush(self); -} - -void -S_OutTok(PsOutPtr self, char *tok, int cr) -{ - int len = strlen(self->Buf); - if( len > 0 ) - { - self->Buf[len++] = ' '; - self->Buf[len] = '\0'; - } - strcpy(&self->Buf[len], tok); - if( cr ) S_Flush(self); -} - -static void -S_Color(PsOutPtr self, PsOutColor clr) -{ - int ir, ig, ib; - ir = PSOUTCOLOR_TO_REDBITS(clr); - ig = PSOUTCOLOR_TO_GREENBITS(clr); - ib = PSOUTCOLOR_TO_BLUEBITS(clr); - if( ir==ig && ig==ib ) - { S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); S_OutTok(self, "g", 1); } - else - { - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig)); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib)); - S_OutTok(self, "sc", 1); - } -} - -static void -S_SetPageDevice(PsOutPtr self, int orient, int count, int plex, int res, - int wd, int ht, int isPage) -{ - float fwd = ((float)wd/(float)res)*72.; - float fht = ((float)ht/(float)res)*72.; - -#define USE_WORKAROUND_COPY_COUNT_BUG 1 - -#ifdef USE_WORKAROUND_COPY_COUNT_BUG - /* Workaround (see http://xprint.mozdev.org/bugs/show_bug.cgi?id=1861 - - * 'Need workaround for bug 1378 ...') to avoid that we print n^2 copies - * instead of n copies. - * The problem is that we use both /NumCopies here but pass the - * %copy-count% to the spooler, too. - * But we only have to use _one_ way... - * - * The final fix for bug 1378 (http://xprint.mozdev.org/bugs/show_bug.cgi?id=1378 - - * "PS DDX creates n^2 copies of a job instead of n copies") will back this - * workaround out and replace it with a better solution. - * (see mozilla.org bug 140030 - * (http://bugzilla.mozilla.org/show_bug.cgi?id=140030 - "Setting number - * of copies causes too many copies to print") for the initial report for - * this issue...) - */ - count = 1; -#endif /* USE_WORKAROUND_COPY_COUNT_BUG */ - - S_OutTok(self, "/pWd", 0); - S_OutNum(self, fwd); - S_OutTok(self, "d /pHt", 0); - S_OutNum(self, fht); - S_OutTok(self, "d", 1); - - /* - * if these are page attributes, have PostScript check to see if they - * have changed. If not, don't do setpagedevice, since it will cause - * a page flush and screw up duplex printing. Having PostScript check - * means we don't have to keep track ourselves. - */ - if(isPage) { - S_OutNum(self, (float) orient); - S_OutTok(self, "/Orientation ck1", 0); - S_OutTok(self, "pWd pHt /PageSize ck2 and not {", 1); - } - S_OutTok(self, "{db", 0); - - S_OutTok(self, "/Orientation", 0); - S_OutNum(self, (float) orient); - S_OutTok(self, " d ", 0); - S_OutTok(self, "/PageSize [pWd pHt] d", 0); - - S_OutTok(self, " de spd", 0); - /* - * save a flag to show if we failed to set orientation... determined - * by both/either Orientation and/or PageSize, use this - * later to set/not set orientation using Cs command. - */ - S_OutTok(self,"}stp /orientationFailed x d", 1); - /* - * if these are page attributes, have PostScript check to see if they - * have changed. If not, don't do setpagedevice, since it will cause - * a page flush and screw up duplex printing. Having PostScript check - * means we don't have to keep track ourselves. - */ - if(isPage) - { - S_OutTok(self,"}if",1); - - S_OutTok(self, (plex==0)?"f":"t", 0); - S_OutTok(self, "/Duplex ck1 ", 0); - - S_OutTok(self, (plex==2)?"t":"f", 0); - S_OutTok(self, "/Tumble ck1 and ", 0); - - - S_OutNum(self, (float)res); - S_OutNum(self, (float)res); - S_OutTok(self, " /HWResolution ck2 and", 0); - - if( count>1 ) - { - S_OutNum(self, (float)count); - S_OutTok(self, " /NumCopies", 0); - S_OutTok(self, " ck1 and ", 0); - } - S_OutTok(self," not {",1); - } - S_OutTok(self, "{db", 0); - - S_OutTok(self, "/Duplex ", 0); - S_OutTok(self, (plex==0)?"f":"t", 0); - S_OutTok(self, " d ", 0); - - S_OutTok(self, "/Tumble ", 0); - S_OutTok(self, (plex==2)?"t":"f", 0); - S_OutTok(self, " d ", 0); - - S_OutTok(self, " /HWResolution [", 0); - S_OutNum(self, (float)res); - S_OutNum(self, (float)res); - S_OutTok(self, "] d ", 0); - - if( count>1 ) - { - S_OutTok(self, " /NumCopies", 0); - S_OutNum(self, (float)count); - S_OutTok(self, " d ", 0); - } - S_OutTok(self, " de spd}stp p", 1); - - if(isPage) - { - S_OutTok(self, "}if", 1); - } -} - -/******************************************************************* - * PUBLIC FUNCTIONS * - *******************************************************************/ - -FILE * -PsOut_ChangeFile(PsOutPtr self, FILE *fp) -{ - FILE *nfp; - - nfp = self->Fp; - - self->Fp = fp; - - return nfp; -} - -PsOutPtr -PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex, int res, - int wd, int ht, Bool raw) -{ - int i; - char buffer[256+32]; /* enougth space for a title with 256 chars... */ -/* - * Get ready to output PostScript header - */ - PsOutPtr psout; - psout = (PsOutPtr)xalloc(sizeof(PsOutRec)); - memset(psout, 0, sizeof(PsOutRec)); - psout->Fp = fp; - psout->isRaw = raw; - psout->pagenum = 0; - - if (!raw) { -/* - * Output PostScript header - */ - /* GhostScript will rant about the missing BoundingBox if we use - * "%!PS-Adobe-3.0 EPSF-3.0" here... */ - S_Comment(psout, "%!PS-Adobe-3.0"); -#ifdef XP_USE_FREETYPE - { - FT_Int ftmajor = 0, - ftminor = 0, - ftpatch = 0; - extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */ - - FT_Library_Version(ftypeLibrary, &ftmajor, &ftminor, &ftpatch); - sprintf(buffer, - "%%%%Creator: The X Print Server's PostScript DDX " - "(%s, release %d, FreeType version %d.%d.%d)", - VENDOR_STRING, VENDOR_RELEASE, - (int)ftmajor, (int)ftminor, (int)ftpatch); - } -#else - sprintf(buffer, - "%%%%Creator: The X Print Server's PostScript DDX (%s, release %d)", - VENDOR_STRING, VENDOR_RELEASE); -#endif /* XP_USE_FREETYPE */ - S_Comment(psout, buffer); - - if (title) - { - sprintf(buffer, "%%%%Title: %.256s", title); - S_Comment(psout, buffer); - } - S_Comment(psout, "%%EndComments"); - S_Comment(psout, "%%BeginProlog"); - S_Comment(psout, "%%BeginProcSet: XServer_PS_Functions"); - S_OutDefs(psout, S_StandardDefs); - S_OutDefs(psout, S_CompositeDefs); - S_Comment(psout, "%%EndProcSet"); - S_Comment(psout, "%%EndProlog"); - S_Comment(psout, "%%BeginSetup"); - /* set document level page attributes */ - S_SetPageDevice(psout, orient, count, plex, res, wd, ht, 0); - S_Comment(psout, "%%Pages: atend"); - S_OutDefs(psout, S_SetupDefs); - S_Comment(psout, "%%EndSetup"); - } -/* - * Initialize the structure - */ - psout->CurColor = PSOUTCOLOR_NOCOLOR; - psout->LineWidth = 1; - psout->LineCap = PsCButt; - psout->LineJoin = PsJMiter; - psout->NDashes = 0; - psout->Dashes = (int *)0; - psout->FontName = (char *)0; - psout->FontSize = 0; - psout->start_image = 0; - for( i=0 ; i<4 ; i++ ) psout->FontMtx[i] = 0.; - psout->ImageFormat = 0; - return(psout); -} - -void -PsOut_EndFile(PsOutPtr self, int closeFile) -{ - char coms[50]; - - if (!self) - return; - - if (!self->isRaw) { - S_Comment(self,"%%Trailer"); - sprintf(coms,"%%%%Pages: %d", self->pagenum); - S_Comment(self, coms); - S_Comment(self, "%%EOF"); - } - if( self->NDashes && self->Dashes ) xfree(self->Dashes); - if( self->FontName ) xfree(self->FontName); - if( self->Patterns ) xfree(self->Patterns); - if( self->Clip.rects ) xfree(self->Clip.rects); - if( closeFile ) fclose(self->Fp); - xfree(self); -} - -void -PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex, int res, - int wd, int ht) -{ - char coms[50]; - -/*** comment for pagenumbers *****/ - - S_Comment(self,"%%PageHeader"); - self->pagenum++; - sprintf(coms,"%%%%Page: %d %d", self->pagenum, self->pagenum); - S_Comment(self, coms); - sprintf(coms,"%%%%PageOrientation: %s",pg_orient[orient]); - S_Comment(self, coms); - -/*** end comment *****************/ - - /* set page level page attributes */ - S_SetPageDevice(self, orient, count, plex, res, wd, ht, 1); - - S_OutTok(self, "gs ", 0); - /* - * check to see if we set orientation already; if it wasn't set, - * use Cs to set orientation here. - */ - S_OutNum(self, (float)orient); - S_OutTok(self, "orientationFailed { ", 0); - S_OutNum(self, (float)orient); - S_OutTok(self, " } { 0 }ie Cs 100 sml gs", 1); -} - -void -PsOut_EndPage(PsOutPtr self) -{ - S_OutTok(self, "gr gr sp", 1); - - /* did grestore: mark attributes 'dirty' so they will be re-sent */ - PsOut_DirtyAttributes(self); - -/*** comment for pagenumbers *****/ - - S_Comment(self,"%%PageTrailer"); - -/*** end comment *****************/ -} - -void -PsOut_DirtyAttributes(PsOutPtr self) -{ - int i; - self->CurColor = PSOUTCOLOR_NOCOLOR; - self->LineWidth = -1; - self->LineCap = (PsCapEnum)-1; - self->LineJoin = (PsJoinEnum)-1; - self->NDashes = -1; - self->FontSize = -1; - for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.; - if( self->Dashes ) { xfree(self->Dashes); self->Dashes = (int *)0; } - if( self->FontName ) { xfree(self->FontName); self->FontName = (char *)0; } -} - -void -PsOut_Comment(PsOutPtr self, char *comment) -{ - S_Comment(self, comment); -} - -void -PsOut_Offset(PsOutPtr self, int x, int y) -{ - self->XOff = x; - self->YOff = y; -} - -void -PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf) -{ - int i, k; - int changed = 0; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InTile ) return; - if( self->InFrame ) xo = yo = 0; - if( clpTyp!=self->ClipType ) changed = 1; - else - { - if( clpinf->nRects!=self->Clip.nRects ) changed = 1; - else - { - if( clpinf->nOutterClips!=self->Clip.nOutterClips ) changed = 1; - else - { - for( i=0 ; i<clpinf->nOutterClips ; i++ ) - { - if( memcmp(&clpinf->outterClips[i], &self->Clip.outterClips[i], - sizeof(PsRectRec))!=0 ) break; - } - if( i<clpinf->nOutterClips ) changed = 1; - else - { - for( i=0 ; i<clpinf->nRects ; i++ ) - { - if( memcmp(&clpinf->rects[i], &self->Clip.rects[i], - sizeof(PsRectRec))!=0 ) { changed = 1; break; } - } - } - } - } - if( clpinf->nElms!=self->Clip.nElms ) changed = 1; - else - { - for( i=0 ; i<clpinf->nElms ; i++ ) - { - if( clpinf->elms[i].type!=PSOUT_POINTS ) - { - if( memcmp(&clpinf->elms[i], &self->Clip.elms[i], - sizeof(PsElmRec))!=0 ) { changed = 1; break; } - } - else - { - if( clpinf->elms[i].type!=self->Clip.elms[i].type || - clpinf->elms[i].nPoints!=self->Clip.elms[i].nPoints ) - { changed = 1; break; } - else - { - for( k=0 ; k<clpinf->elms[i].nPoints ; k++ ) - { - if( memcmp(&clpinf->elms[i].c.points[k], - &self->Clip.elms[i].c.points[k], sizeof(PsPointRec)) ) - { changed = 1; break; } - } - if( changed ) break; - } - } - } - } - } - - if( self->Clip.rects ) xfree(self->Clip.rects); - if( self->Clip.outterClips ) xfree(self->Clip.outterClips); - if( self->Clip.elms ) - PsDestroyFillElementList(self->Clip.nElms, self->Clip.elms); - self->ClipType = clpTyp; - self->Clip.nRects = clpinf->nRects; - self->Clip.nElms = clpinf->nElms; - self->Clip.nOutterClips = clpinf->nOutterClips; - if( clpinf->nRects ) - { - self->Clip.rects = (PsRectPtr)xalloc(clpinf->nRects*sizeof(PsRectRec)); - memcpy(self->Clip.rects, clpinf->rects, clpinf->nRects*sizeof(PsRectRec)); - } - else self->Clip.rects = 0; - if( clpinf->nOutterClips ) - { - self->Clip.outterClips = (PsRectPtr)xalloc(clpinf->nOutterClips* - sizeof(PsRectRec)); - memcpy(self->Clip.outterClips, clpinf->outterClips, - clpinf->nOutterClips*sizeof(PsRectRec)); - } - else self->Clip.outterClips = 0; - if( clpinf->nElms ) - self->Clip.elms = PsCloneFillElementList(clpinf->nElms, clpinf->elms); - else self->Clip.elms = 0; - - PsOut_DirtyAttributes(self); - S_OutTok(self, "gr gs", 1); - if( self->Clip.nOutterClips ) - { - for( i=0 ; i<self->Clip.nOutterClips ; i++ ) - { - S_OutNum(self, (float)(self->Clip.outterClips[i].x)); - S_OutNum(self, (float)(self->Clip.outterClips[i].y)); - S_OutNum(self, (float)self->Clip.outterClips[i].w); - S_OutNum(self, (float)self->Clip.outterClips[i].h); - S_OutTok(self, "R", 1); - } - S_OutTok(self, "cl n", 1); - } - if( self->Clip.nRects ) - { - for( i=0 ; i<self->Clip.nRects ; i++ ) - { - S_OutNum(self, (float)(self->Clip.rects[i].x+xo)); - S_OutNum(self, (float)(self->Clip.rects[i].y+yo)); - S_OutNum(self, (float)self->Clip.rects[i].w); - S_OutNum(self, (float)self->Clip.rects[i].h); - S_OutTok(self, "R", 1); - } - S_OutTok(self, "cl n", 1); - } - if( self->Clip.nElms ) - { - PsElmPtr elm = self->Clip.elms; - for( i=0 ; i<self->Clip.nElms ; i++,elm++ ) - { - switch(elm->type) - { - case PSOUT_POINTS: - for( k=0 ; k<elm->nPoints ; k++ ) - { - S_OutNum(self, (float)elm->c.points[k].x+xo); - S_OutNum(self, (float)elm->c.points[k].y+yo); - if( k==0 ) S_OutTok(self, "m", 0); - else S_OutTok(self, "l", 0); - } - S_OutTok(self, "cp", 1); - break; - case PSOUT_RECT: - S_OutNum(self, (float)elm->c.rect.x+xo); - S_OutNum(self, (float)elm->c.rect.y+yo); - S_OutNum(self, (float)elm->c.rect.w); - S_OutNum(self, (float)elm->c.rect.h); - S_OutTok(self, "R", 1); - break; - case PSOUT_ARC: - if( elm->c.arc.style==PsPieSlice ) - { - S_OutNum(self, (float)elm->c.arc.x+xo+(float)elm->c.arc.w/2.); - S_OutNum(self, (float)elm->c.arc.y+yo+(float)elm->c.arc.h/2.); - S_OutTok(self, "m", 0); - } - S_OutNum(self, (float)elm->c.arc.x+xo+(float)elm->c.arc.w/2.); - S_OutNum(self, (float)elm->c.arc.y+yo+(float)elm->c.arc.h/2.); - S_OutNum(self, (float)elm->c.arc.w); - S_OutNum(self, (float)elm->c.arc.h); - S_OutNum(self, (float)elm->c.arc.a1/64.); - S_OutNum(self, (float)elm->c.arc.a1/64.+(float)elm->c.arc.a2/64.); - if( elm->c.arc.a2<0 ) S_OutTok(self, "An cp", 1); - else S_OutTok(self, "Ac cp", 1); - break; - } - } - S_OutTok(self, "cl n", 1); - } -} - -void -PsOut_Color(PsOutPtr self, PsOutColor clr) -{ - if( clr==self->CurColor || self->InTile>=PsStip ) return; - self->CurColor = clr; - S_Color(self, clr); -} - -void -PsOut_FillRule(PsOutPtr self, PsRuleEnum rule) -{ - self->FillRule = rule; -} - -void -PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap, PsJoinEnum join, - int nDsh, int *dsh, int dshOff, PsOutColor bclr) -{ - int i; - int same = 1; - - if( wd!=self->LineWidth && wd>=0 ) - { - if( wd==0 ) wd = 1; - self->LineWidth = wd; - S_OutNum(self, (float)wd); S_OutTok(self, "w", 1); - } - if( cap!=self->LineCap ) - { - self->LineCap = cap; - S_OutNum(self, (float)cap); S_OutTok(self, "lc", 1); - } - if( join!=self->LineJoin ) - { - self->LineJoin = join; - S_OutNum(self, (float)join); S_OutTok(self, "lj", 1); - } - if( nDsh!=self->NDashes ) same = 0; - else if( dshOff!=self->DashOffset ) same = 0; - else if( nDsh ) - { - for( i=0 ; i<nDsh ; i++ ) - { if( dsh[i]!=self->Dashes[i] ) break; } - if( i<nDsh ) same = 0; - } - if( !same ) - { - if( self->NDashes && self->Dashes ) - { xfree(self->Dashes); self->Dashes = (int *)0; } - self->NDashes = nDsh; - self->DashOffset = dshOff; - if( nDsh ) self->Dashes = (int *)xalloc(sizeof(int)*nDsh); - S_OutTok(self, "[", 0); - for( i=0 ; i<nDsh ; i++ ) - { - self->Dashes[i] = dsh[i]; - S_OutNum(self, (float)dsh[i]); - } - S_OutTok(self, "]", 0); - S_OutNum(self, (float)dshOff); - S_OutTok(self, "ds", 1); - } - - if( nDsh ) - self->LineBClr = bclr; - else - bclr = PSOUTCOLOR_NOCOLOR; -} - -void -PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso) -{ - int i; - char buf[256]; - if( self->FontName && strcmp(fnam, self->FontName)==0 && - siz==self->FontSize ) return; - if( self->FontName ) xfree(self->FontName); - self->FontName = (char *)xalloc(strlen(fnam)+1); - strcpy(self->FontName, fnam); - self->FontSize = siz; - for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.; - strcpy(buf, "/"); strcat(buf, fnam); - S_OutTok(self, buf, 0); - S_OutNum(self, (float)siz); - if( iso ) S_OutTok(self, "t", 0); - else S_OutTok(self, "f", 0); - S_OutTok(self, "Tf", 1); -} - -void -PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso) -{ - int i; - char buf[256]; - if( self->FontName && strcmp(fnam, self->FontName)==0 && - mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] && - mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return; - if( self->FontName ) xfree(self->FontName); - self->FontName = (char *)xalloc(strlen(fnam)+1); - strcpy(self->FontName, fnam); - for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = mtx[i]; - self->FontSize = -1; - strcpy(buf, "/"); strcat(buf, fnam); strcat(buf, " ["); - S_OutTok(self, buf, 0); - for( i=0 ; i<4 ; i++ ) S_OutNum(self, mtx[i]); - S_OutTok(self, "0 0]", 0); - if( iso ) S_OutTok(self, "t", 0); - else S_OutTok(self, "f", 0); - S_OutTok(self, "Tfm", 1); -} - -void -PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts) -{ - int i; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - if( nPts<=2 ) return; - for( i=0 ; i<nPts ; i++ ) - { - S_OutNum(self, (float)(pts[i].x+xo)); - S_OutNum(self, (float)(pts[i].y+yo)); - if( i==0 ) S_OutTok(self, "m", 0); - else S_OutTok(self, "l", 0); - } - if( self->FillRule==PsEvenOdd ) S_OutTok(self, "cp ef", 1); - else S_OutTok(self, "cp fl", 1); -} - -void -PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutTok(self, "R fl", 1); -} - -void -PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h, - float ang1, float ang2, PsArcEnum style) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - if( style==PsPieSlice ) - { - S_OutNum(self, (float)x+(float)w/2.); - S_OutNum(self, (float)y+(float)h/2.); - S_OutTok(self, "m", 0); - } - S_OutNum(self, (float)x+(float)w/2.); - S_OutNum(self, (float)y+(float)h/2.); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutNum(self, ang1); - S_OutNum(self, ang1+ang2); - if( ang2<0 ) S_OutTok(self, "An cp fl", 1); - else S_OutTok(self, "Ac cp fl", 1); -} - -void -PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts) -{ - int i; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - if( nPts<1 ) return; - for( i=0 ; i<nPts ; i++ ) - { - S_OutNum(self, (float)(pts[i].x+xo)); - S_OutNum(self, (float)(pts[i].y+yo)); - if( i==0 ) S_OutTok(self, "m", 0); - else S_OutTok(self, "l", 0); - } - if( self->LineBClr != PSOUTCOLOR_NOCOLOR ) - { - S_OutTok(self, "gs", 0); - S_Color(self, self->LineBClr); - S_OutTok(self, "[] 0 ds st gr", 0); - } - S_OutTok(self, "st", 1); -} - -void -PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts) -{ - int i; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - if( nPts<1 ) return; - for( i=0 ; i<nPts ; i++ ) - { - S_OutNum(self, (float)(pts[i].x+xo)); - S_OutNum(self, (float)(pts[i].y+yo)); - S_OutTok(self, "P", 1); - } -} - -void -PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutTok(self, "R", 0); - if( self->LineBClr != PSOUTCOLOR_NOCOLOR ) - { - S_OutTok(self, "gs", 0); - S_Color(self, self->LineBClr); - S_OutTok(self, "[] 0 ds st gr", 0); - } - S_OutTok(self, "st", 1); -} - -void -PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h, - float ang1, float ang2) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - S_OutNum(self, (float)x+(float)w/2.); - S_OutNum(self, (float)y+(float)h/2.); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutNum(self, ang1); - S_OutNum(self, ang1+ang2); - if( ang2<0 ) S_OutTok(self, "An", 0); - else S_OutTok(self, "Ac", 0); - if( self->LineBClr != PSOUTCOLOR_NOCOLOR ) - { - S_OutTok(self, "gs", 0); - S_Color(self, self->LineBClr); - S_OutTok(self, "[] 0 ds st gr", 0); - } - S_OutTok(self, "st", 1); -} - -void -PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, PsOutColor bclr) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - S_OutStr(self, text, textl); - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - if( bclr == PSOUTCOLOR_NOCOLOR ) - S_OutTok(self, "T", 1); - else - { - int ir = PSOUTCOLOR_TO_REDBITS(bclr); - int ig = PSOUTCOLOR_TO_GREENBITS(bclr); - int ib = PSOUTCOLOR_TO_BLUEBITS(bclr); - - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig)); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib)); - S_OutTok(self, "Tb", 1); - } -} - -void -PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - S_OutStr16(self, text, textl); - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - if( bclr == PSOUTCOLOR_NOCOLOR ) - S_OutTok(self, "T", 1); - else - { - int ir = PSOUTCOLOR_TO_REDBITS(bclr); - int ig = PSOUTCOLOR_TO_GREENBITS(bclr); - int ib = PSOUTCOLOR_TO_BLUEBITS(bclr); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ig)); - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ib)); - S_OutTok(self, "Tb", 1); - } -} - -#ifdef BM_CACHE -void /* new */ -PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, PsOutColor bclr, PsOutColor fclr) -{ - char cacheID[10]; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - sprintf(cacheID, "c%di", cache_id); - - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - - if( fclr==PSOUTCOLOR_WHITE ) - { - int ir = PSOUTCOLOR_TO_REDBITS(bclr); - int ig = PSOUTCOLOR_TO_GREENBITS(bclr); - int ib = PSOUTCOLOR_TO_BLUEBITS(bclr); - - if( ir==ig && ig==ib ) - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); - else - S_OutNum(self, (float)0); - self->RevImage = 1; - } - else - { - int ir = PSOUTCOLOR_TO_REDBITS(fclr); - int ig = PSOUTCOLOR_TO_GREENBITS(fclr); - int ib = PSOUTCOLOR_TO_BLUEBITS(fclr); - - if( ir==ig && ig==ib ) - S_OutNum(self, PSOUTCOLOR_BITS_TO_PSFLOAT(ir)); - else - S_OutNum(self, (float)0); - } - - S_OutTok(self, cacheID, 1); -} /* new */ - -void /* new */ -PsOut_BeginImageCache(PsOutPtr self, long cache_id) -{ - char cacheID[10]; - - sprintf(cacheID, "/c%di {", cache_id); - - S_OutTok(self, cacheID, 0); -} /* new */ - -void /* new */ -PsOut_EndImageCache(PsOutPtr self) -{ - S_OutTok(self, "}bd", 1); -} /* new */ -#endif - -void -PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y, - int w, int h, int sw, int sh, int format) -{ - PsOutColor savClr = self->CurColor; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - if( self->InTile ) - { - if( self->InTile>=PsStip && format!=1 ) { self->ImgSkip = 1; return; } - self->ImgBClr = bclr; self->ImgFClr = fclr; - self->ImgX = x; self->ImgY = y; - self->ImgW = w; self->ImgH = h; - self->SclW = sw; self->SclH = sh; - S_OutTok(self, "<", 0); - self->ImageFormat = format; - self->RevImage = 0; - if( self->InTile==PsTile && format==1 && fclr==PSOUTCOLOR_WHITE ) - self->RevImage = 1; - return; - } - - self->RevImage = 0; - if( format==1 ) - { - S_OutTok(self, "gs", 0); - if( fclr==PSOUTCOLOR_WHITE ) - { - PsOut_Color(self, fclr); - PsOut_FillRect(self, x, y, sw, sh); - PsOut_Color(self, bclr); - self->RevImage = 1; - } - else - { - PsOut_Color(self, bclr); - PsOut_FillRect(self, x, y, sw, sh); - PsOut_Color(self, fclr); - } - } - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutNum(self, (float)sw); - S_OutNum(self, (float)sh); - if( format==1 ) { - if(self->RevImage) - S_OutTok(self, "Im1rev", 1); - else - S_OutTok(self, "Im1", 1); - } - else S_OutTok(self, "Im24", 1); - self->ImageFormat = format; - self->CurColor = savClr; -} - -void -PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y, - int w, int h, int sw, int sh, int format) -{ - PsOutColor savClr = self->CurColor; - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - if( self->InTile ) - { - if( self->InTile>=PsStip && format!=1 ) { self->ImgSkip = 1; return; } - self->ImgBClr = bclr; self->ImgFClr = fclr; - self->ImgX = x; self->ImgY = y; - self->ImgW = w; self->ImgH = h; - self->SclW = sw; self->SclH = sh; - S_OutTok(self, "<", 0); - self->ImageFormat = format; - self->RevImage = 0; - if( self->InTile==PsTile && format==1 && fclr==PSOUTCOLOR_WHITE ) - self->RevImage = 1; - return; - } - - self->RevImage = 0; - if( format==1 ) - { - S_OutTok(self, "gs", 0); -#ifdef BM_CACHE - S_OutTok(self, "g", 1); -#else - if( fclr==PSOUTCOLOR_WHITE ) - { - PsOut_Color(self, bclr); - self->RevImage = 1; - } - else - { - PsOut_Color(self, fclr); - } -#endif - } - -#ifdef BM_CACHE - S_OutTok(self, "tr", 0); /* new */ -#else - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); -#endif - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutNum(self, (float)sw); - S_OutNum(self, (float)sh); -#ifdef BM_CACHE - S_OutTok(self, "mtx", 1); /* new */ - S_OutTok(self, "<", 0); /* new */ - self->start_image = 1; -#else - if( format==1 ){ - if(self->RevImage) - S_OutTok(self, "Im1rev", 1); - else - S_OutTok(self, "Im1", 1); - } - else S_OutTok(self, "Im24", 1); -#endif - self->ImageFormat = format; - self->CurColor = savClr; -} - -void -PsOut_EndImage(PsOutPtr self) -{ - if( self->ImgSkip ) { self->ImgSkip = 0; return; } - if( self->InTile ) - { - S_OutTok(self, ">", 1); - if( self->ImageFormat==1 && self->InTile==PsTile ) - { - if( self->ImgFClr==PSOUTCOLOR_WHITE ) - { - PsOut_Color(self, self->ImgFClr); - PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH); - PsOut_Color(self, self->ImgBClr); - } - else - { - PsOut_Color(self, self->ImgBClr); - PsOut_FillRect(self, self->ImgX, self->ImgY, self->SclW, self->SclH); - PsOut_Color(self, self->ImgFClr); - } - } - S_OutNum(self, (float)self->ImgX); - S_OutNum(self, (float)self->ImgY); - S_OutNum(self, (float)self->ImgW); - S_OutNum(self, (float)self->ImgH); - S_OutNum(self, (float)self->SclW); - S_OutNum(self, (float)self->SclH); - if( self->ImageFormat==1 ) S_OutTok(self, "Im1t", 1); - else S_OutTok(self, "Im24t", 1); - self->ImageFormat = 0; - self->RevImage = 0; - return; - } - /* - * Bug 4639307: Move flush before "> im" to get all of bitmap into ps file. - */ - S_Flush(self); -#ifdef BM_CACHE - if(self->start_image) - S_OutTok(self, "> im", 1); /* new */ -#endif - self->ImageFormat = 0; - self->RevImage = 0; -#ifdef BM_CACHE - if(self->start_image) - { - self->start_image = 0; - S_OutTok(self, "gr", 0); - } - else - S_OutTok(self, "gr", 1); -#else - S_OutTok(self, "gr", 1); -#endif -} - -void -PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes) -{ - int i; - int b; - int len; - const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - - if( (!self->ImageFormat) || self->ImgSkip ) return; - - len = strlen(self->Buf); - - for( i=0 ; i<nBytes ; i++ ) - { - if( self->RevImage ) b = (int)((bytes[i]^0xFF)&0xFF); - else b = (int)(bytes[i]&0xFF); - - self->Buf[len++] = hex[(b&0xF0) >> 4]; - self->Buf[len++] = hex[(b&0x0F)]; - self->Buf[len] = '\0'; - - if( len>70 ) - { - S_Flush(self); - len = 0; - } - } -} - -void -PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y, - int w, int h) -{ - int xo = self->XOff; - int yo = self->YOff; - - if( self->InFrame ) xo = yo = 0; - S_OutTok(self, "gs", 0); - S_OutNum(self, (float)(x+xo)); - S_OutNum(self, (float)(y+yo)); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutTok(self, "R cl n", 0); - xoff += xo; yoff += yo; - if( xoff || yoff ) - { - S_OutNum(self, (float)xoff); - S_OutNum(self, (float)yoff); - S_OutTok(self, "tr", 0); - } - S_OutTok(self, "gs", 1); - self->InFrame += 1; -} - -void -PsOut_EndFrame(PsOutPtr self) -{ - self->InFrame -= 1; - if( self->InFrame<0 ) self->InFrame = 0; - S_OutTok(self, "gr gr", 1); - PsOut_DirtyAttributes(self); -} - -int -PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type, - PsOutColor bclr, PsOutColor fclr) -{ - int i; - char key[64]; - - for( i=0 ; i<self->NPatterns ; i++ ) - { if( self->Patterns[i].tag==tag && self->Patterns[i].type==type ) break; } - if( i<self->NPatterns ) return(1); - if( (self->NPatterns+1)>self->MxPatterns ) - { - if( self->Patterns ) - { - self->MxPatterns *= 2; - self->Patterns = - (PsPatPtr)xrealloc(self->Patterns, sizeof(PsPatRec)*self->MxPatterns); - } - else - { - self->MxPatterns = 64; - self->Patterns = (PsPatPtr)xalloc(sizeof(PsPatRec)*self->MxPatterns); - } - } - self->Patterns[self->NPatterns].tag = tag; - self->Patterns[self->NPatterns].type = type; - sprintf(key, "/ %d", (int)tag); - switch(type) { - case PsTile: key[1] = 't'; break; - case PsStip: key[1] = 's'; break; - case PsOpStip: key[1] = 'o'; break; - default: break; } - S_OutTok(self, key, 0); - S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0); - S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutTok(self, "]d/XStep", 0); - S_OutNum(self, (float)w); - S_OutTok(self, "d/YStep", 0); - S_OutNum(self, (float)h); - S_OutTok(self, "d/PaintProc{bg sv", 1); - if( type==PsOpStip ) - { - S_Color(self, bclr); - S_OutTok(self, "0 0", 0); - S_OutNum(self, (float)w); - S_OutNum(self, (float)h); - S_OutTok(self, "R fl", 1); - } - if( type!=PsTile ) S_Color(self, fclr); - self->NPatterns += 1; - self->InTile = type; - return(0); -} - -void -PsOut_EndPattern(PsOutPtr self) -{ - self->InTile = PsSolid; - S_OutTok(self, "rs ed}d de im_ mp d", 1); -} - -void -PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type) -{ - int i; - char key[64]; - - for( i=0 ; i<self->NPatterns ; i++ ) - { if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; } - if( i>=self->NPatterns ) return; - sprintf(key, " %d", (int)tag); - switch(type) { - case PsTile: key[0] = 't'; break; - case PsStip: key[0] = 's'; break; - case PsOpStip: key[0] = 'o'; break; - default: break; } - S_OutTok(self, key, 0); - S_OutTok(self, "spt", 1); - self->CurColor = PSOUTCOLOR_NOCOLOR; -} - -void -PsOut_RawData(PsOutPtr self, char *data, int len) -{ - S_Flush(self); - if (!ferror(self->Fp)) { - (void) fwrite(data, 1, len, self->Fp); - } -} - -typedef enum PsDownfontFontType_ -{ - PsDFT_Type1PFA=0, - PsDFT_Type1PFB, - PsDFT_TrueType /* not implemented yet */ -} PsDownfontFontType; - -/* Download a PS Type1 font */ -int -PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname) -{ - int stt; - char buf[256]; - FILE *fp; - PsDownfontFontType type; - - fp = fopen(fname, "r"); - if( !fp ) - return 0; - -#ifdef DEBUG_gisburn - /* This should be log-able! */ - fprintf(stderr, "PsOut_DownloadType1: %s: Downloading '%s' from '%s'\n", auditmsg, name, fname); -#endif /* DEBUG_gisburn */ - - fread(buf, 32, 1, fp); - fseek(fp, (long)0, 0); - - /* Is this a Adobe PostScript Type 1 binary font (PFB) ? */ - if( (buf[0]&0xFF)==0x80 && (buf[1]&0xFF)==0x01 ) - { - type = PsDFT_Type1PFB; - } - /* Is this a Adobe PostScript ASCII font (PFA) ? */ - else if (!strncmp(buf, "%!PS-AdobeFont", 14)) - { - type = PsDFT_Type1PFA; - } - else - { - /* This should be log-able! */ - fprintf(stderr, "PsOut_DownloadType1: Unknown font type for '%s'\n", fname); - return 0; - } - - S_Flush(self); - sprintf(buf, "%%%%BeginFont: %s", name); - S_Comment(self, buf); - - if( type == PsDFT_Type1PFB ) - { - char *buf, - *pt; - int len, - ch, - stype; - - ch = fgetc(fp); - /* Strip out the binary headers and de-binary it */ - while( (ch&0xFF) == 0x80 ) - { - stype = fgetc(fp); - if( stype==3 ) /* eof mark */ - break; - len = fgetc(fp); - len |= fgetc(fp)<<8; - len |= fgetc(fp)<<16; - len |= fgetc(fp)<<24; - buf = (char *)xalloc(len+1); - if( stype==1 ) - { - /* Process ASCII section */ - len = fread(buf, 1, len, fp); - /* convert any lone CRs (ie Mac eol) to LFs */ - for( pt = buf ; (pt = memchr(pt, '\r', len-(pt-buf))) != NULL ; pt++ ) - { - if ( pt[1]!='\n' ) - *pt = '\n'; - } - fwrite(buf, 1, len, self->Fp); - } - else if( stype==2 ) - { - int i; - - /* Process binary section */ - len = fread(buf, 1, len, fp); - for( i=0 ; i<len ; i++ ) - { - ch = buf[i]; - if( ((ch>>4)&0xf) <= 9 ) - fputc('0'+((ch>>4)&0xf), self->Fp); - else - fputc('A'-10+((ch>>4)&0xf), self->Fp); - - if( (ch&0xf) <= 9 ) - fputc('0'+(ch&0xf), self->Fp); - else - fputc('A'-10+(ch&0xf), self->Fp); - - if( (i&0x1f)==0x1f ) - fputc('\n', self->Fp); - } - } - xfree(buf); - - /* Next block... */ - ch = fgetc(fp); - } - } - /* Is this a Adobe PostScript ASCII font (PFA) ? */ - else if (type == PsDFT_Type1PFA) - { - for(;;) - { - stt = fread(buf, 1, 256, fp); - if( stt<=0 ) break; - if (!ferror(self->Fp)) { - (void) fwrite(buf, 1, stt, self->Fp); - } - if( stt<256 ) - break; - } - } - fclose(fp); - S_Flush(self); - S_Comment(self, "%%EndFont"); - - /* Success... */ - return 1; -} - - - - - - diff --git a/hw/xprint/ps/psout.h b/hw/xprint/ps/psout.h deleted file mode 100644 index 1138e4afe..000000000 --- a/hw/xprint/ps/psout.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - -Copyright 1996, 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. - -*/ -/* - * (c) Copyright 1996 Hewlett-Packard Company - * (c) Copyright 1996 International Business Machines Corp. - * (c) Copyright 1996 Sun Microsystems, Inc. - * (c) Copyright 1996 Novell, Inc. - * (c) Copyright 1996 Digital Equipment Corp. - * (c) Copyright 1996 Fujitsu Limited - * (c) Copyright 1996 Hitachi, Ltd. - * - * 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 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. - * - * Except as contained in this notice, the names of the copyright holders - * shall not be used in advertising or otherwise to promote the sale, use - * or other dealings in this Software without prior written authorization - * from said copyright holders. - */ - -/******************************************************************* -** -** ********************************************************* -** * -** * File: psout.h -** * -** * Contents: Include file for psout.c -** * -** * Created By: Roger Helmendach (Liberty Systems) -** * -** * Copyright: Copyright 1996 The Open Group, Inc. -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _psout_ -#define _psout_ - -#include <stdio.h> - -typedef enum PsCapEnum_ { PsCButt=0, PsCRound, PsCSquare } PsCapEnum; -typedef enum PsJoinEnum_ { PsJMiter=0, PsJRound, PsJBevel } PsJoinEnum; -typedef enum PsArcEnum_ { PsChord, PsPieSlice } PsArcEnum; -typedef enum PsRuleEnum_ { PsEvenOdd, PsNZWinding } PsRuleEnum; -typedef enum PsFillEnum_ { PsSolid=0, PsTile, PsStip, PsOpStip } PsFillEnum; - -typedef struct PsPointRec_ -{ - int x; - int y; -} PsPointRec; - -typedef PsPointRec *PsPointPtr; - -typedef struct PsRectRec_ -{ - int x; - int y; - int w; - int h; -} PsRectRec; - -typedef PsRectRec *PsRectPtr; - -typedef struct PsArcRec_ -{ - int x; - int y; - int w; - int h; - int a1; - int a2; - PsArcEnum style; -} PsArcRec; - -typedef PsArcRec *PsArcPtr; - -#define PSOUT_RECT 0 -#define PSOUT_ARC 1 -#define PSOUT_POINTS 2 - -typedef struct PsElmRec_ -{ - int type; - int nPoints; - union - { - PsRectRec rect; - PsArcRec arc; - PsPointPtr points; - } c; -} PsElmRec; - -typedef PsElmRec *PsElmPtr; - -typedef struct PsClipRec_ -{ - int nRects; - PsRectPtr rects; - int nElms; - PsElmPtr elms; - int nOutterClips; - PsRectPtr outterClips; -} PsClipRec; - -typedef PsClipRec *PsClipPtr; - -typedef enum PsFTDownloadFontType_ -{ - PsFontBitmap=0, - PsFontType1, - PsFontType3 -} PsFTDownloadFontType; - -/* Define |PsOutColor| color type which can hold one RGB value - * (note: this needs to be |signed| long/long long to represent - * special values such as |PSOUTCOLOR_NOCOLOR|) - */ -#ifdef PSOUT_USE_DEEPCOLOR -/* 64bit |PsOutColor| which can hold 16bit R-,G-,B-values */ -#ifdef WIN32 -typedef signed __int64 PsOutColor; -#else -# if defined(__alpha__) || defined(__alpha) || \ - defined(ia64) || defined(__ia64__) || \ - defined(__sparc64__) || defined(_LP64) || \ - defined(__s390x__) || \ - defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \ - defined (__powerpc64__) || \ - (defined(sgi) && (_MIPS_SZLONG == 64)) -typedef signed long PsOutColor; -# else -typedef signed long long PsOutColor; -# endif /* native 64bit platform */ -#endif /* WIN32 */ - -#define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 32) -#define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 16) & 0xFFFF) -#define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFFFF) -#define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 65535.) -#define PSOUTCOLOR_WHITE (0xFFFFFFFFFFFFLL) -#define PSOUTCOLOR_NOCOLOR (-1LL) -#define PSOUTCOLOR_TO_RGB24BIT(clr) (((PSOUTCOLOR_TO_REDBITS(clr) >> 8) << 16) | \ - ((PSOUTCOLOR_TO_GREENBITS(clr) >> 8) << 8) | \ - ((PSOUTCOLOR_TO_BLUEBITS(clr) >> 8) << 0)) -#else -/* 32bit |PsOutColor| which can hold 8bit R-,G-,B-values */ -typedef signed long PsOutColor; -#define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 16) -#define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 8) & 0xFF) -#define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFF) -#define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 255.) -#define PSOUTCOLOR_WHITE (0xFFFFFF) -#define PSOUTCOLOR_NOCOLOR (-1) -#define PSOUTCOLOR_TO_RGB24BIT(clr) ((PSOUTCOLOR_TO_REDBITS(clr) << 16) | \ - (PSOUTCOLOR_TO_GREENBITS(clr) << 8) | \ - (PSOUTCOLOR_TO_BLUEBITS(clr) << 0)) -#endif /* PSOUT_USE_DEEPCOLOR */ - -#ifdef USE_PSOUT_PRIVATE -typedef void *voidPtr; - -typedef struct PsPatRec_ -{ - PsFillEnum type; - voidPtr tag; -} PsPatRec; - -typedef PsPatRec *PsPatPtr; - -typedef struct PsOutRec_ -{ - FILE *Fp; - char Buf[16384]; - PsOutColor CurColor; - int LineWidth; - PsCapEnum LineCap; - PsJoinEnum LineJoin; - int NDashes; - int *Dashes; - int DashOffset; - PsOutColor LineBClr; - PsRuleEnum FillRule; - char *FontName; - int FontSize; - float FontMtx[4]; - int ImageFormat; - int RevImage; - int NPatterns; - int MxPatterns; - PsPatPtr Patterns; - int ClipType; - PsClipRec Clip; - int InFrame; - int XOff; - int YOff; - - PsFillEnum InTile; - int ImgSkip; - PsOutColor ImgBClr; - PsOutColor ImgFClr; - int ImgX; - int ImgY; - int ImgW; - int ImgH; - int SclW; - int SclH; - - Bool isRaw; - - int pagenum; - - int start_image; -} PsOutRec; - -typedef struct PsOutRec_ *PsOutPtr; - -extern void S_Flush(PsOutPtr self); -extern void S_OutNum(PsOutPtr self, float num); -extern void S_OutTok(PsOutPtr self, char *tok, int cr); -#else -typedef struct PsOutRec_ *PsOutPtr; -#endif /* USE_PSOUT_PRIVATE */ - -extern FILE * PsOut_ChangeFile(PsOutPtr self, FILE *fp); -extern PsOutPtr PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex, - int res, int wd, int ht, Bool raw); -extern void PsOut_EndFile(PsOutPtr self, int closeFile); -extern void PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex, - int res, int wd, int ht); -extern void PsOut_EndPage(PsOutPtr self); -extern void PsOut_DirtyAttributes(PsOutPtr self); -extern void PsOut_Comment(PsOutPtr self, char *comment); -extern void PsOut_Offset(PsOutPtr self, int x, int y); - -extern void PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf); - -extern void PsOut_Color(PsOutPtr self, PsOutColor clr); -extern void PsOut_FillRule(PsOutPtr self, PsRuleEnum rule); -extern void PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap, - PsJoinEnum join, int nDsh, int *dsh, int dshOff, - PsOutColor bclr); -extern void PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso); -extern void PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso); - -extern void PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts); -extern void PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h); -extern void PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h, - float ang1, float ang2, PsArcEnum style); - -extern void PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts); -extern void PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts); -extern void PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h); -extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h, - float ang1, float ang2); - -extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl, - PsOutColor bclr); -extern void PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr); - -extern void PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y, - int w, int h, int sw, int sh, int format); -extern void PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y, - int w, int h, int sw, int sh, int format); -extern void PsOut_EndImage(PsOutPtr self); -extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes); - -extern void PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y, - int w, int h); -extern void PsOut_EndFrame(PsOutPtr self); - -extern int PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, - PsFillEnum type, PsOutColor bclr, PsOutColor fclr); -extern void PsOut_EndPattern(PsOutPtr self); -extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type); - -extern void PsOut_RawData(PsOutPtr self, char *data, int len); - -extern int PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname); - -extern int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset); -extern int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset); - -extern int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset); -extern void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex); -extern void PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl); -extern void PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl); - -extern void PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso); -extern void PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso); -#endif diff --git a/hw/xprint/ps/psout_ft.c b/hw/xprint/ps/psout_ft.c deleted file mode 100644 index 30939f972..000000000 --- a/hw/xprint/ps/psout_ft.c +++ /dev/null @@ -1,337 +0,0 @@ - -/* -Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> - -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 -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. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include "os.h" -#define USE_PSOUT_PRIVATE 1 -#include "psout.h" - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TYPE1_TABLES_H - -#include <X11/Xproto.h> -#include <X11/fonts/font.h> -#include <X11/fonts/fontstruct.h> -#include <X11/fonts/fntfilst.h> -#include <X11/fonts/fontutil.h> -#include <X11/fonts/fontenc.h> -#include <X11/fonts/ft.h> -#define NOT_IN_FTFUNCS -#include <X11/fonts/ftfuncs.h> -#include "servermd.h" /* needed for endian test (IMAGE_BYTE_ORDER) */ - -#define USE_FT_PS_NAMES 1 - -#ifdef USE_FT_PS_NAMES -void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex) -{ - FTFontPtr tf = (FTFontPtr)pFont->fontPrivate; - FT_Face ttface = tf->instance->face->face; - FT_Error error; - char buf[256]; - unsigned long ftindex; - - /* Remap X11 font index to FreeType font index */ - ftindex = FTRemap(ttface, &tf->mapping, x11fontindex); - - if( FT_Has_PS_Glyph_Names(ttface) ) - { - error = FT_Get_Glyph_Name(ttface, ftindex, buf, 64); - } - else - { - error = 1; - } - - if( error ) - { - /* Check for unicode mapping - * See Adobe document "Unicode and Glyph Names" - * (http://partners.adobe.com/asn/tech/type/unicodegn.jsp) - */ - if( (tf->mapping.mapping->type == FONT_ENCODING_UNICODE) && - (ftindex < 0xFFFE) ) - { - sprintf(buf, "uni%04lx", ftindex); - } - else - { - sprintf(buf, "ch%02lx", ftindex); - } - } - - strcpy(destbuf, buf); -} -#endif /* USE_FT_PS_NAMES */ - -int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset) -{ - switch(downloadfonttype) - { - case PsFontType3: - return PsOut_DownloadFreeType3(self, psfontname, pFont, block_offset); - case PsFontType1: - return PsOut_DownloadFreeType1(self, psfontname, pFont, block_offset); - default: - FatalError("PS DDX: PsOut_DownloadFreeType(downloadfonttype='%d' not implemented\n", - (int)downloadfonttype); - return 0; /* NO-OP, FatalError() will call |exit()| */ - } -} - -/* cloned from |PsOut_TextAttrs16| */ -void -PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso) -{ - int i; - if( self->FontName && strcmp(fnam, self->FontName)==0 && - siz==self->FontSize ) return; - if( self->FontName ) xfree(self->FontName); - self->FontName = (char *)xalloc(strlen(fnam)+1); - strcpy(self->FontName, fnam); - self->FontSize = siz; - for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = -1.; -} - -/* cloned from |PsOut_TextAttrsMtx16| */ -void -PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso) -{ - int i; - if( self->FontName && strcmp(fnam, self->FontName)==0 && - mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] && - mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return; - if( self->FontName ) xfree(self->FontName); - self->FontName = (char *)xalloc(strlen(fnam)+1); - strcpy(self->FontName, fnam); - for( i=0 ; i<4 ; i++ ) self->FontMtx[i] = mtx[i]; - self->FontSize = -1; -} - -static -int FT_Get_CharcellMetricsCharacterHeight(FontPtr pFont) -{ - FTFontPtr ftfont = (FTFontPtr)pFont->fontPrivate; - - return ftfont->instance->charcellMetrics->ascent + - ftfont->instance->charcellMetrics->descent; -} - -static -int FT_Get_CharcellMetricsCharacterWidth(FontPtr pFont) -{ - FTFontPtr ftfont = (FTFontPtr)pFont->fontPrivate; - - if( ftfont->instance->spacing != FT_PROPORTIONAL ) - { - int width = ftfont->instance->charcellMetrics->characterWidth; - - /* If the font uses a matrix make sure we transform the |characterWidth| - * back to it's original value since we download the untransformed font - * and use a PostScript transformation matrix to transform the font when - * rendering the text - */ - if( ftfont->instance->transformation.nonIdentity ) - { - FT_Vector v; - - FT_Matrix m = ftfont->instance->transformation.matrix; - (void)FT_Matrix_Invert(&m); /* FixMe: We should check the return code */ - v.x = width; - v.y = FT_Get_CharcellMetricsCharacterHeight(pFont); - FT_Vector_Transform(&v, &m); - width = v.x; - } - - return width; - } - - return 0; -} - -void -PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl) -{ - int i; - int xo = self->XOff, - yo = self->YOff; - char buf[256]; - int cwidth = FT_Get_CharcellMetricsCharacterWidth(pFont); - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - S_OutTok(self, "moveto", 1); - - S_OutTok(self, "[ ", 0); - - for( i = 0 ; i < textl ; i++ ) - { -#ifdef USE_FT_PS_NAMES - char namebuf[256]; - unsigned int ch = text[i]&0xFF; - unsigned long block_offset = 0; - PsOut_Get_FreeType_Glyph_Name(namebuf, pFont, ch+block_offset); - - sprintf(buf, "/%s ", namebuf); -#else - sprintf(buf, "/ch%02x ", text[i]&0xFF); -#endif /* USE_FT_PS_NAMES */ - S_OutTok(self, buf, 0); - } - - /* Check whether we have any special spacing requirements (e.g. non-proportional fonts) ... */ - if( cwidth != 0 ) - { - /* If the we use a matrix to render the font (instead of using |self->FontSize|) - * we must apply the matrix to the "rmoveto" which is used to force the exact - * character width. The "trmoveto" macro will do that for us... - */ - if( self->FontSize == -1 ) - { - sprintf(buf, "]{gs glyphshow gr %d 0 trmoveto}fa", cwidth); - } - else - { - sprintf(buf, "]{gs glyphshow gr %d 0 rm}fa", cwidth); - } - } - else - { - sprintf(buf, "]{glyphshow}fa"); - } - S_OutTok(self, buf, 0); -} - -/* XXX: |PsOut_FreeType_Text16| should be rewritten - currently it uses lame, - * slow hacks and makes some risky assumtions about how |PsOut_Text16| - * allocates memory */ -void -PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl) -{ - int i; - int xo = self->XOff, - yo = self->YOff; - unsigned short c, - c_hiByte, - c_lowByte, - fontPage; - long lastFontPage = -1; - char baseFontName[256]; - char buf[256]; - - if( self->InFrame || self->InTile ) xo = yo = 0; - x += xo; y += yo; - - strcpy(baseFontName, self->FontName); - - S_OutNum(self, (float)x); - S_OutNum(self, (float)y); - S_OutTok(self, "moveto", 1); - - for( i = 0 ; i < textl ; i++ ) - { - c = text[i]; -#if IMAGE_BYTE_ORDER == LSBFirst - c_hiByte = c & 0x00FF; - c_lowByte = (c >> 8) & 0x00FF; -#elif IMAGE_BYTE_ORDER == MSBFirst - c_hiByte = (c >> 8) & 0x00FF; - c_lowByte = c & 0x00FF; -#else -#error Unsupported byte order -#endif - fontPage = c_hiByte; - - if( fontPage != lastFontPage ) - { - if( fontPage > 0 ) - { - sprintf(buf, "%s_%x", baseFontName, fontPage); - } - else - { - sprintf(buf, "%s", baseFontName); - xfree(self->FontName); - self->FontName = NULL; - } - - if( self->FontSize == -1 ) - { - PsOut_TextAttrsMtx(self, buf, self->FontMtx, FALSE); - } - else - { - PsOut_TextAttrs(self, buf, self->FontSize, FALSE); - } - lastFontPage = fontPage; - } - -#ifdef USE_FT_PS_NAMES - { - char namebuf[256]; - unsigned int ch = c_lowByte; - unsigned long block_offset = c_hiByte * 0x100 /* same as c_hiByte << 8 */; - int cwidth = FT_Get_CharcellMetricsCharacterWidth(pFont); - PsOut_Get_FreeType_Glyph_Name(namebuf, pFont, ch+block_offset); - - /* Check whether we have any special spacing requirements (e.g. non-proportional fonts) ... */ - if( cwidth != 0 ) - { - /* If the we use a matrix to render the font (instead of using |self->FontSize|) - * we must apply the matrix to the "rmoveto" which is used to force the exact - * character width. The "trmoveto" macro will do that for us... - */ - if( self->FontSize == -1 ) - { - sprintf(buf, "gs /%s glyphshow gr %d 0 trmoveto", namebuf, cwidth); - } - else - { - sprintf(buf, "gs /%s glyphshow gr %d 0 rm", namebuf, cwidth); - } - } - else - { - sprintf(buf, "/%s glyphshow", namebuf); - } - } -#else - sprintf(buf, "/ch%02x glyphshow", c_lowByte); -#endif /* USE_FT_PS_NAMES */ - S_OutTok(self, buf, 1); - } - - if( self->FontName ) xfree(self->FontName); - self->FontName = (char *)xalloc(strlen(baseFontName)+1); - strcpy(self->FontName, baseFontName); -} - diff --git a/hw/xprint/ps/psout_ftpstype1.c b/hw/xprint/ps/psout_ftpstype1.c deleted file mode 100644 index 572e13601..000000000 --- a/hw/xprint/ps/psout_ftpstype1.c +++ /dev/null @@ -1,185 +0,0 @@ - -/* -Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> - -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 -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. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <errno.h> -#include <sys/wait.h> - -#include "os.h" -#define USE_PSOUT_PRIVATE 1 -#include "psout.h" - -#include <ft2build.h> -#include FT_FREETYPE_H - -#include <X11/Xproto.h> -#include <X11/fonts/font.h> -#include <X11/fonts/fontstruct.h> -#include <X11/fonts/fntfilst.h> -#include <X11/fonts/fontutil.h> -#include <X11/fonts/fontenc.h> -#include <X11/fonts/ft.h> -#define NOT_IN_FTFUNCS -#include <X11/fonts/ftfuncs.h> - -int do_debug_ft2pt1 = FALSE; -int do_enable_ft2pt1_optimizer = FALSE; - -/* Defined in ttf2pt1.c */ -int ft2pt1_main(int argc, char **argv, - FTFontPtr tf, const char *download_psfontname, unsigned long download_font_block_offset); - -/* Download FreeType outlines as PS Type1 font */ -int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset) -{ - FTFontPtr tf; - FT_Face face; - int ft2pt1_numargs = 0; - char *ft2pt1_args[40]; - char *pstype1filename_prefix; - char pstype1filename[PATH_MAX+1]; - int ft2pt1_main_retval; - pid_t childpid; - - tf = (FTFontPtr)pFont->fontPrivate; - face = tf->instance->face->face; - - /* Set debugging flags */ - do_debug_ft2pt1 = (getenv("XPRT_PSDDX_DO_DEBUG_FT2PT1") != NULL); - do_enable_ft2pt1_optimizer = (getenv("XPRT_PSDDX_DO_ENABLE_FT2PT1_OPTIMIZER") != NULL); - - if( do_debug_ft2pt1 ) - { - fprintf(stderr, "# Converting FT2 font to PS Type1 filename='%s', ttface=%lx\n", tf->instance->face->filename, (long)face); - } - - pstype1filename_prefix = tempnam(NULL, "Xprt_"); - - ft2pt1_args[ft2pt1_numargs] = "ft2pt1"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-Ob"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-e"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-a"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-Ga"; ft2pt1_numargs++; - if( do_enable_ft2pt1_optimizer ) - { - /* Scale fonts to a 1000x1000 matrix */ - ft2pt1_args[ft2pt1_numargs] = "-Ot"; ft2pt1_numargs++; - } - else - { - /* Disable the ttf2pt1 optimisations */ - ft2pt1_args[ft2pt1_numargs] = "-Ou"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-Oo"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-Os"; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = "-Oh"; ft2pt1_numargs++; - } - - if( !do_debug_ft2pt1 ) - { - ft2pt1_args[ft2pt1_numargs] = "-W 0"; ft2pt1_numargs++; - } - ft2pt1_args[ft2pt1_numargs] = tf->instance->face->filename; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = pstype1filename_prefix; ft2pt1_numargs++; - ft2pt1_args[ft2pt1_numargs] = NULL; - -/* XXX: ttf2pt1 has lots of leaks and global vars which are not cleaned-up - * As long this problem exists we will simply fork() and call the converter - * from the child process (all resources are free'ed when the child process - * exists) as a workaround. - */ -#define FT2PT1_NEEDS_SEPERATE_PROCESS 1 - -#ifdef FT2PT1_NEEDS_SEPERATE_PROCESS - /* Flush internal buffer and then the stdio stream before fork()! */ - S_Flush(self); - fflush(self->Fp); - - childpid = fork(); - switch(childpid) - { - case -1: - FatalError("PS DDX internal error: Cannot fork() converter child process, %s\n", strerror(errno)); - break; - case 0: /* child */ - fclose(self->Fp); - self->Fp = NULL; - - ft2pt1_main_retval = ft2pt1_main(ft2pt1_numargs, ft2pt1_args, tf, psfontname, block_offset); - if( do_debug_ft2pt1 ) - { - fprintf(stderr, "## ft2pt1_main returned %d (child)\n", ft2pt1_main_retval); - } - exit(ft2pt1_main_retval); - break; - default: /* parent */ - waitpid(childpid, &ft2pt1_main_retval, 0); - break; - } - - if( do_debug_ft2pt1 ) - { - fprintf(stderr, "## ft2pt1_main returned %d (parent)\n", ft2pt1_main_retval); - } -#else - S_Flush(self); - - ft2pt1_main_retval = ft2pt1_main(ft2pt1_numargs, ft2pt1_args, tf, psfontname, block_offset); - if( do_debug_ft2pt1 ) - { - fprintf(stderr, "## ft2pt1_main returned %d (child)\n", ft2pt1_main_retval); - } -#endif /* FT2PT1_NEEDS_SEPERATE_PROCESS */ - - if( ft2pt1_main_retval != EXIT_SUCCESS ) - { - FatalError("PS DDX internal error while converting FreeType font '%s' to PS Type1, error=%d\n", - tf->instance->face->filename, ft2pt1_main_retval); - } - - sprintf(pstype1filename, "%s.pfa", pstype1filename_prefix); - if( do_debug_ft2pt1 ) - { - fprintf(stderr, "# Downloading converted FT2/PS Type1 filename='%s'\n", pstype1filename); - } - - PsOut_DownloadType1(self, "PsOut_DownloadFreeType1", psfontname, pstype1filename); - - if( !do_debug_ft2pt1 ) - { - unlink(pstype1filename); - } - - free(pstype1filename_prefix); - - S_Flush(self); - - return 0; -} - - diff --git a/hw/xprint/ps/psout_ftpstype3.c b/hw/xprint/ps/psout_ftpstype3.c deleted file mode 100644 index 733b5386b..000000000 --- a/hw/xprint/ps/psout_ftpstype3.c +++ /dev/null @@ -1,439 +0,0 @@ - -/* -Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> - -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 -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. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include "os.h" -#define USE_PSOUT_PRIVATE 1 -#include "psout.h" - -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_TRUETYPE_TABLES_H -#include FT_BBOX_H -#include FT_GLYPH_H - -#include FT_CONFIG_CONFIG_H -#include FT_CONFIG_OPTIONS_H -#include FT_ERRORS_H -#include FT_SYSTEM_H -#include FT_IMAGE_H -#include FT_TYPES_H -#include FT_OUTLINE_H -#include FT_MODULE_H -#include FT_RENDER_H -#include FT_TYPE1_TABLES_H -#include FT_TRUETYPE_IDS_H -#include FT_TRUETYPE_TAGS_H -#include FT_CACHE_H -#include FT_CACHE_IMAGE_H -#include FT_CACHE_SMALL_BITMAPS_H -#include FT_MULTIPLE_MASTERS_H -#include FT_SFNT_NAMES_H - -#include <X11/Xproto.h> -#include <X11/fonts/font.h> -#include <X11/fonts/fontstruct.h> -#include <X11/fonts/fntfilst.h> -#include <X11/fonts/fontutil.h> -#include <X11/fonts/fontenc.h> -#include <X11/fonts/ft.h> -#define NOT_IN_FTFUNCS -#include <X11/fonts/ftfuncs.h> - -struct ft2info -{ - FontPtr pFont; - FTFontPtr tf; - FT_Face ttface; - struct - { - char *full_name; - char *copyright; - char *family; - char *subfamily; - char *version; - } nameid; - TT_Postscript *ttpostscript; - TT_Header *ttheader; -}; - -/* Local prototypes */ -static FT_Error PSType3_createOutlineGlyphs(FILE *out, struct ft2info *ti, unsigned long unicode, const char *psglyphname); -static int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset); - -extern FT_Library ftypeLibrary; /* defined in xc/lib/font/FreeType/ftfuncs.c */ - -#define USE_FT_PS_NAMES 1 - -static -FT_Error PSType3_createOutlineGlyphs( FILE *out, struct ft2info *ti, unsigned long x11fontindex, const char *psglyphname ) -{ - unsigned long ftindex; - FT_BBox bbox; - FT_Error error; - FT_Outline outline; - - /* Remap X11 font index to FreeType font index */ - ftindex = FTRemap(ti->ttface, &ti->tf->mapping, x11fontindex); - - error = FT_Load_Glyph(ti->ttface, ftindex, (FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING)); - if( error ) - { - fprintf(stderr, "PSType3_createOutlineGlyphs: FT_Load_Glyph() failure, error=%d\n", (int)error); - return error; - } - - outline = ti->ttface->glyph->outline; - - FT_Outline_Get_CBox(&outline, &bbox); - - fprintf(out, "/%s {\n", psglyphname); - fprintf(out, "%ld 0 %ld %ld %ld %ld setcachedevice\n", - (signed long)ti->ttface->glyph->metrics.horiAdvance, - (long)bbox.xMin, - (long)bbox.yMin, - (long)bbox.xMax, - (long)bbox.yMax); - - if( outline.n_contours > 0 ) - { - long i, - j, - k, k1, - cs, ce, - nguide, - contour_start, - contour_end, - last_point; - Bool first; - FT_Vector *vec; - - contour_start = ce = 0; - - vec = outline.points; - last_point = outline.n_points; - - i = j = k = 0; - first = TRUE; - - while( i <= outline.contours[outline.n_contours - 1] ) - { - contour_end = outline.contours[j]; - - if( first ) - { - fprintf(out, "%ld %ld moveto\n", vec[i].x, vec[i].y); - contour_start = i; - first = FALSE; - } - else if( outline.tags[i] & FT_CURVE_TAG_ON ) - { - fprintf(out, "%ld %ld lineto\n", vec[i].x, vec[i].y); - } - else - { - Bool finished = FALSE; - - cs = i-1; - nguide = 0; - while( !finished ) - { - if( i == contour_end+1 ) - { - ce = contour_start; - finished = TRUE; - } - else if( outline.tags[i] & FT_CURVE_TAG_ON ) - { - ce = i; - finished = TRUE; - } - else - { - i++; - nguide++; - } - } - - switch( nguide ) - { - case 0: - fprintf(out, "%ld %ld lineto\n", vec[ce].x, vec[ce].y); - break; - - case 1: - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[cs].x+2*vec[cs+1].x)/3, - (vec[cs].y+2*vec[cs+1].y)/3, - (2*vec[cs+1].x+vec[ce].x)/3, - (2*vec[cs+1].y+vec[ce].y)/3, - vec[ce].x, vec[ce].y); - break; - - case 2: - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (-vec[cs].x+4*vec[cs+1].x)/3, - (-vec[cs].y+4*vec[cs+1].y)/3, - (4*vec[cs+2].x-vec[ce].x)/3, - (4*vec[cs+2].y-vec[ce].y)/3, - vec[ce].x, vec[ce].y); - break; - - case 3: - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[cs].x+2*vec[cs+1].x)/3, - (vec[cs].y+2*vec[cs+1].y)/3, - (5*vec[cs+1].x+vec[cs+2].x)/6, - (5*vec[cs+1].y+vec[cs+2].y)/6, - (vec[cs+1].x+vec[cs+2].x)/2, - (vec[cs+1].y+vec[cs+2].y)/2); - - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[cs+1].x+5*vec[cs+2].x)/6, - (vec[cs+1].y+5*vec[cs+2].y)/6, - (5*vec[cs+2].x+vec[cs+3].x)/6, - (5*vec[cs+2].y+vec[cs+3].y)/6, - (vec[cs+3].x+vec[cs+2].x)/2, - (vec[cs+3].y+vec[cs+2].y)/2); - - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[cs+2].x+5*vec[cs+3].x)/6, - (vec[cs+2].y+5*vec[cs+3].y)/6, - (2*vec[cs+3].x+vec[ce].x)/3, - (2*vec[cs+3].y+vec[ce].y)/3, - vec[ce].x, vec[ce].y); - break; - - default: /* anything |nguide > 3| */ - k1 = cs + nguide; - - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[cs].x+2*vec[cs+1].x)/3, - (vec[cs].y+2*vec[cs+1].y)/3, - (5*vec[cs+1].x+vec[cs+2].x)/6, - (5*vec[cs+1].y+vec[cs+2].y)/6, - (vec[cs+1].x+vec[cs+2].x)/2, - (vec[cs+1].y+vec[cs+2].y)/2); - - for( k = cs+2 ; k <= k1-1 ; k++ ) - { - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[k-1].x+5*vec[k].x)/6, - (vec[k-1].y+5*vec[k].y)/6, - (5*vec[k].x+vec[k+1].x)/6, - (5*vec[k].y+vec[k+1].y)/6, - (vec[k].x+vec[k+1].x)/2, - (vec[k].y+vec[k+1].y)/2); - } - - fprintf(out, "%ld %ld %ld %ld %ld %ld curveto\n", - (vec[k1-1].x+5*vec[k1].x)/6, - (vec[k1-1].y+5*vec[k1].y)/6, - (2*vec[k1].x+vec[ce].x)/3, - (2*vec[k1].y+vec[ce].y)/3, - vec[ce].x, vec[ce].y); - break; - } - } - - if( i >= contour_end ) - { - fprintf(out, "closepath\n"); - first = TRUE; - i = contour_end + 1; - j++; - } - else - { - i++; - } - } - } - - fprintf(out, "fill } bind def\n"); - - return 0; -} - -static -int PSType3_generateOutlineFont(FILE *out, const char *psfontname, struct ft2info *ti, long block_offset) -{ - long i; - double scaler; - const int numchars = 256; -#ifdef USE_FT_PS_NAMES - int linewidth = 0; -#endif /* USE_FT_PS_NAMES */ - - fprintf(out, "%%%%BeginFont: %s\n", psfontname); - fprintf(out, "22 dict begin\n"); - fprintf(out, "/FontType 3 def\n"); - fprintf(out, "/StrokeWidth 0 def\n"); - fprintf(out, "/PaintType 0 def\n"); - fprintf(out, "/FontName (%s) def\n", psfontname); - fprintf(out, "/FontInfo 9 dict dup begin\n"); - fprintf(out, " /FullName (%s) def\n", ti->nameid.full_name?ti->nameid.full_name:psfontname); - fprintf(out, " /Notice (%s) def\n", ti->nameid.copyright?ti->nameid.copyright:"nothing here"); - fprintf(out, " /FamilyName (%s) def\n", ti->nameid.family?ti->nameid.family:psfontname); - fprintf(out, " /Weight (%s) def\n", ti->nameid.subfamily?ti->nameid.subfamily:"Regular"); - fprintf(out, " /version (%s) def\n", ti->nameid.version?ti->nameid.version:"0.1"); - - if( ti->ttpostscript ) - { - fprintf(out, " /italicAngle %.9g def\n", (double)ti->ttpostscript->italicAngle); - fprintf(out, " /underlineThickness %d def\n", (int)ti->ttpostscript->underlineThickness); - fprintf(out, " /underlinePosition %d def\n", (int)ti->ttpostscript->underlinePosition); - fprintf(out, " /isFixedPitch %s def\n", ((ti->ttpostscript->isFixedPitch)?("true"):("false"))); - } - else - { - fprintf(out, " /italicAngle %.9g def\n", 0.0); - fprintf(out, " /underlineThickness %d def\n", 100); - fprintf(out, " /underlinePosition %d def\n", 0); - fprintf(out, " /isFixedPitch false def\n"); - } - - fprintf(out, "end def\n"); - - scaler = (1000.0 / (double)ti->ttface->units_per_EM) / 1000.0; - fprintf(out, "/FontMatrix [%.9g 0 0 %.9g 0 0] def\n", scaler, scaler); - - if( ti->ttheader ) - { - fprintf(out, "/FontBBox [%d %d %d %d] def\n", - (int)ti->ttheader->xMin, - (int)ti->ttheader->yMin, - (int)ti->ttheader->xMax, - (int)ti->ttheader->yMax); - } - else - { - fprintf(out, "/FontBBox [%ld %ld %ld %ld] def\n", - ti->ttface->bbox.xMin, - ti->ttface->bbox.yMin, - ti->ttface->bbox.xMax, - ti->ttface->bbox.yMax); - - } - - fprintf(out, "/Encoding [\n"); - for( i = 0 ; i < 256 ; i++ ) - { -#ifdef USE_FT_PS_NAMES - char namebuf[256]; - PsOut_Get_FreeType_Glyph_Name(namebuf, ti->pFont, i+block_offset); - linewidth += strlen(namebuf) + 2; - fprintf(out, "/%s%s", namebuf, (linewidth > 70)?(linewidth = 0, "\n"):(" ")); -#else - fprintf(out, "/ch%02x%s", i, (((i % 10) == 9)?("\n"):(" "))); -#endif /* USE_FT_PS_NAMES */ - } - fprintf(out, "] def\n"); - - fprintf(out, "/CharProcs %d dict def CharProcs begin\n", (int)(numchars + 1)); - fprintf(out, "/.notdef {\n" - "1000 0 0 0 0 0 setcachedevice\n" - "fill } bind def\n"); - for( i = 0 ; i < numchars ; i++ ) - { - char buf[32]; -#ifdef USE_FT_PS_NAMES - char namebuf[256]; - PsOut_Get_FreeType_Glyph_Name(namebuf, ti->pFont, i+block_offset); - sprintf(buf, "%s ", namebuf); -#else - sprintf(buf, "ch%02lx ", i); -#endif /* USE_FT_PS_NAMES */ - PSType3_createOutlineGlyphs(out, ti, i+block_offset, buf); - } - fprintf(out, "end\n" - "/BuildGlyph {\n" - " exch /CharProcs get exch\n" - " 2 copy known not {pop /.notdef} if get exec } bind def\n" - "/BuildChar { 1 index /Encoding get exch get\n" - " 1 index /Encoding get exec } bind def\n"); - fprintf(out, "currentdict end /%s exch definefont pop\n", psfontname); - fprintf(out, "%%EndFont\n"); - - return 0; -} - -static -char *FT_Get_TT_NAME_ID(FT_Face ttface, int index) -{ - FT_SfntName name; - char *s; - - if( index >= FT_Get_Sfnt_Name_Count(ttface) ) - return NULL; - - FT_Get_Sfnt_Name(ttface, index, &name); - s = (char *)malloc(name.string_len+2); - if( !s ) - return NULL; - memcpy(s, (char *)name.string, name.string_len); - s[name.string_len] = '\0'; - return s; -} - -int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset) -{ - struct ft2info cft2info = { 0 }; - struct ft2info *ti = &cft2info; - - S_Flush(self); - - ti->tf = (FTFontPtr)pFont->fontPrivate; - ti->ttface = ti->tf->instance->face->face; - ti->pFont = pFont; -#ifdef DEBUG_gisburn - fprintf(stderr, "# Downloading FT2 font filename='%s', ttface=%lx\n", ti->tf->instance->face->filename, (long)ti->ttface); -#endif /* DEBUG_gisburn */ - - ti->nameid.full_name = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FULL_NAME); - ti->nameid.copyright = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_COPYRIGHT); - ti->nameid.family = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FONT_FAMILY); - ti->nameid.subfamily = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_FONT_SUBFAMILY); - ti->nameid.version = FT_Get_TT_NAME_ID(ti->ttface, TT_NAME_ID_VERSION_STRING); - - ti->ttheader = (TT_Header *)FT_Get_Sfnt_Table(ti->ttface, ft_sfnt_head); - ti->ttpostscript = (TT_Postscript *)FT_Get_Sfnt_Table(ti->ttface, ft_sfnt_post); - - PSType3_generateOutlineFont(self->Fp, psfontname, ti, block_offset); - - free(ti->nameid.full_name); - free(ti->nameid.copyright); - free(ti->nameid.family); - free(ti->nameid.subfamily); - free(ti->nameid.version); - - S_Flush(self); - - return 0; -} - diff --git a/hw/xprint/ps/ttf2pt1wrap.c b/hw/xprint/ps/ttf2pt1wrap.c deleted file mode 100644 index 57bb777d2..000000000 --- a/hw/xprint/ps/ttf2pt1wrap.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Wrapper to add missing symbol to externally supplied code - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifdef Lynx -extern int optind; -extern char *optarg; -#endif - -#include "ttf2pt1.c" diff --git a/hw/xprint/raster/Makefile.am b/hw/xprint/raster/Makefile.am deleted file mode 100644 index 1ee1122f2..000000000 --- a/hw/xprint/raster/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -noinst_LTLIBRARIES = libraster.la - -INCLUDES = -I$(top_srcdir)/hw/xprint - -AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ - -libraster_la_SOURCES = \ - RasterAttVal.c \ - Raster.c \ - Raster.h diff --git a/hw/xprint/raster/Raster.c b/hw/xprint/raster/Raster.c deleted file mode 100644 index dccef613c..000000000 --- a/hw/xprint/raster/Raster.c +++ /dev/null @@ -1,1563 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - - -/******************************************************************* -** -** ********************************************************* -** * -** * File: printer/Raster.c -** * -** * Contents: -** * Raster driver for the print server. -** * -** * Copyright: Copyright 1993, 1995 Hewlett-Packard Company -** * -** ********************************************************* -** -********************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <errno.h> -#include <stdio.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/wait.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <X11/X.h> -#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */ -#define NEED_EVENTS -#include <X11/Xproto.h> -#undef NEED_EVENTS -#include <X11/Xatom.h> -#include "misc.h" -#include "dixstruct.h" -#include "scrnintstr.h" -#include "screenint.h" -#include "colormapst.h" -#include "windowstr.h" -#include "propertyst.h" -#include "servermd.h" /* needed for IMAGE_BUFSIZE */ -#include "fb.h" -#include "mi.h" - -#include <X11/extensions/Print.h> -#include "Raster.h" - -#include "attributes.h" -#include "AttrValid.h" -#include "DiPrint.h" - -static void AllocateRasterPrivates( - ScreenPtr pScreen); -static Bool RasterChangeWindowAttributes( - WindowPtr pWin, - unsigned long mask); -static int StartJob( - XpContextPtr pCon, - Bool sendClientData, - ClientPtr client); -static int StartPage( - XpContextPtr pCon, - WindowPtr pWin); -static int StartDoc( - XpContextPtr pCon, - XPDocumentType type); -static int EndDoc( - XpContextPtr pCon, - Bool cancel); -static int EndJob( - XpContextPtr pCon, - Bool cancel); -static int EndPage( - XpContextPtr pCon, - WindowPtr pWin); -static int DocumentData( - XpContextPtr pCon, - DrawablePtr pDraw, - char *pData, - int len_data, - char *pDoc_fmt, - int len_fmt, - char *pOptions, - int len_options, - ClientPtr client); -static int GetDocumentData( - XpContextPtr pContext, - ClientPtr client, - int maxBufferSize); -static void FreePageFiles( - RasterContextPrivPtr pWinPriv); -static int SystemCmd( - char *pCommand); -static Bool RasterCloseScreen( - int index, - ScreenPtr pScreen); -static int RasterInitContext(XpContextPtr pCon); -static Bool RasterDestroyContext(XpContextPtr pCon); -static char *RasterGetAttributes( - XpContextPtr pContext, - XPAttributes class); -static char *RasterGetOneAttribute(XpContextPtr pCon, - XPAttributes class, - char *attribute); -static int RasterSetAttributes(XpContextPtr pCon, - XPAttributes class, - char *attributes); -static int RasterAugmentAttributes(XpContextPtr pCon, - XPAttributes class, - char *attributes); -static int RasterMediumDimensions(XpContextPtr pCon, - CARD16 *width, - CARD16 *height); -static int RasterReproducibleArea(XpContextPtr pCon, - xRectangle *pRect); - -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#define DOC_PCL 1 -#define DOC_RASTER 2 - -static DevPrivateKey RasterScreenPrivateKey = &RasterScreenPrivateKey; -static DevPrivateKey RasterContextPrivateKey = &RasterContextPrivateKey; -static char RASTER_DRIV_NAME[] = "XP-RASTER"; -static int doc_type = DOC_RASTER; - -#define ABSOLUTE_PCLCOMP_PATH1 "/usr/openwin/bin/pclcomp" -#define ABSOLUTE_PCLCOMP_PATH2 "/usr/X11/bin/pclcomp" - -static char *pcl3_output_cmds[] = { - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -0 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -01 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -02 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -03 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -012 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -013 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -023 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% | pclcomp -0123 > %(OutFile)%", - "xpr -device ljet -rv -landscape < %(InFile)% > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -0 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -01 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -02 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -03 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -012 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -013 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -023 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% | pclcomp -0123 > %(OutFile)%", - "xpr -device ljet -rv < %(InFile)% > %(OutFile)%"}; - -Bool -InitializeRasterDriver( - int ndx, - ScreenPtr pScreen, - int argc, - char **argv) -{ - int xRes, yRes; - int maxRes, maxDim, numBytes; - RasterScreenPrivPtr pPriv; - - /* - * Register this driver's InitContext function with the print extension. - * This is a bit - * sleazy, as the extension hasn't yet been initialized, but the - * extension needs to know this, and this seems the best time to - * provide the information. - */ - XpRegisterInitFunc( pScreen, RASTER_DRIV_NAME, RasterInitContext ); - - /* - * Create and load the devPrivate for the printer layer. - */ - AllocateRasterPrivates(pScreen); - - pPriv = (RasterScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey); - - maxDim = MAX( pScreen->height, pScreen->width ); - numBytes = maxDim + BITMAP_SCANLINE_PAD - 1; /* pixels per row */ - numBytes *= maxDim; - numBytes /= 8; /* bytes per row */ - xRes = pScreen->width / (pScreen->mmWidth / 25.4); - yRes = pScreen->height / (pScreen->mmHeight / 25.4); - maxRes = MAX( xRes, yRes ); - - pPriv->pBits = (char *)xalloc(numBytes); - - /* - * Have to allocate maxDim X maxDim to allow for landscape mode. - */ - fbScreenInit(pScreen, pPriv->pBits, maxDim, maxDim, maxRes, - maxRes, maxDim, 1); - miInitializeBackingStore(pScreen); - pScreen->blackPixel = 1; - pScreen->whitePixel = 0; - if(fbCreateDefColormap(pScreen) == FALSE) - ; /* XXX what do I do if it fails? */ - - pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop; - pPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; - pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes; - pPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = RasterCloseScreen; - - return TRUE; -} - -/* - * GetPropString searches the context's config database for a property - * by the name of propName. If found, it returns the property's - * value, otherwise it returns NULL unless the requested attribute - * is RASTER_PRINT_PAGE_COMMAND, in which case it returns a hard-coded - * default string to invoke xpr to produce a PostScript(tm) formatted - * raster. - */ - -static char * -GetPropString( - XpContextPtr pCon, - char *propName) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - char *type; - XrmValue val; - struct stat status; - int pclcomp_exists = 0; - - if( XrmGetResource(pConPriv->config, propName, propName, &type, &val) == - True ) - return (char *)val.addr; - - if( !strcmp( propName, RASTER_PRINT_PAGE_COMMAND ) ) - if( doc_type == DOC_RASTER ) - return "xpr -device ps %(InFile)% > %(OutFile)%"; - else - { - XpOid orientation; - XpOid compression; - int pcl3_output_index = 0; - - orientation = XpGetContentOrientation(pCon); - compression = XpGetAvailableCompression(pCon); - - switch(orientation) { - case xpoid_val_content_orientation_landscape: - pcl3_output_index = 0; - break; - default: - pcl3_output_index += 9; - break; - } - - if(stat(ABSOLUTE_PCLCOMP_PATH1, &status) != -1) - pclcomp_exists = 1; - else if(stat(ABSOLUTE_PCLCOMP_PATH2, &status) != -1) - pclcomp_exists = 1; - - if(pclcomp_exists) - switch(compression) { - case xpoid_val_available_compressions_0: - pcl3_output_index += 0; - break; - case xpoid_val_available_compressions_01: - pcl3_output_index += 1; - break; - case xpoid_val_available_compressions_02: - pcl3_output_index += 2; - break; - case xpoid_val_available_compressions_03: - pcl3_output_index += 3; - break; - case xpoid_val_available_compressions_012: - pcl3_output_index += 4; - break; - case xpoid_val_available_compressions_013: - pcl3_output_index += 5; - break; - case xpoid_val_available_compressions_023: - pcl3_output_index += 6; - break; - default: - pcl3_output_index += 7; - break; - } - else - pcl3_output_index += 8; - - return pcl3_output_cmds[pcl3_output_index]; - } - else - return NULL; -} - -static void -SetDocumentType( - XpContextPtr pCon) -{ - XpOidList* attrs_supported; - - /* - * only validate attributes found in document-attributes-supported - */ - attrs_supported = - XpGetListAttr(pCon, XPPrinterAttr, - xpoid_att_document_attributes_supported, - (const XpOidList*)NULL); - - if(XpOidListHasOid(attrs_supported, xpoid_att_document_format)) - { - const char* value_in; - XpOidDocFmt *f; - - value_in = XpGetStringAttr(pCon, XPDocAttr, xpoid_att_document_format); - - f = XpOidDocFmtNew( value_in ); - - if( f != NULL ) - { - if( !strcmp( f->format, "PCL" ) ) - doc_type = DOC_PCL; - else - doc_type = DOC_RASTER; - - XpOidDocFmtDelete( f ); - } - } - - /* - * clean up - */ - XpOidListDelete(attrs_supported); -} - -static int -StartJob( - XpContextPtr pCon, - Bool sendClientData, - ClientPtr client) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - - SetDocumentType( pCon ); - - /* - * Check for existing page file, and delete it if it exists. - */ - if(pConPriv->pageFileName != (char *)NULL) - { - if(pConPriv->pPageFile != (FILE *)NULL) - { - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - } - unlink(pConPriv->pageFileName); - Xfree(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - } - - /* - * Create a temporary file to store the printer output. - */ - if(!sendClientData) - { - /* - * Create a temporary file to store the printer output. - */ - if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile)) - return BadAlloc; - } - - return Success; -} - -/* - * StartDoc and EndDoc are just no-ops in this implementation, since - * our view of the spooler really doesn't recognize documents. - */ - -static int -StartDoc( - XpContextPtr pCon, - XPDocumentType type) -{ - return Success; -} - -static int EndDoc( - XpContextPtr pCon, - Bool cancel) -{ - return Success; -} - -#if 0 - -/* XXX Not used. */ - -/* - * BuidArgVector takes a pointer to a comma-separated list of command - * options and splits it out into an array of argument pointers. The - * caller must not free the optionList after calling this function until - * the returned arg vector is no longer needed, at which time the arg - * vector should also be freed. - */ - -#define SEPARATOR_CHAR (char)',' - -static char ** -BuildArgVector( - char *optionList, - char **argVector, - int argCount) -{ - char *curArg, *lastChar, *endArg; - - curArg = optionList; - lastChar = optionList + strlen(optionList); /* includes final NULL */ - - while(curArg != (char *)NULL && curArg < lastChar) - { - /* strip leading white space */ - while(curArg < lastChar && isascii((int)*curArg) && - isspace((int)*curArg)) - curArg++; - - if(curArg < lastChar) - { - argVector = (char **)Xrealloc(argVector, - sizeof(char *) * (argCount + 2)); - argVector[argCount] = curArg; - argVector[++argCount] = (char *)NULL; - - endArg = strchr(curArg, SEPARATOR_CHAR); - - /* Should I strip trailing white space ??? */ - - if(endArg != (char *)NULL) - { - *endArg = (char)'\0'; - curArg = endArg + 1; - } - else - curArg = (char *)NULL; - } - } - - return argVector; -} -#endif - -static int -EndJob( - XpContextPtr pCon, - Bool cancel) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - - if( cancel == True ) - { - if(pConPriv->getDocClient != (ClientPtr)NULL) { - XpFinishDocData(pConPriv->getDocClient); - - pConPriv->getDocClient = (ClientPtr)NULL; - pConPriv->getDocBufSize = 0; - } - - if(pConPriv->jobFileName != (char *)NULL) - { - unlink(pConPriv->jobFileName); - Xfree(pConPriv->jobFileName); - pConPriv->jobFileName = (char *)NULL; - } - - return Success; - } - - if(pConPriv->getDocClient != (ClientPtr)NULL&&pConPriv->getDocBufSize > 0) - { - XpFinishDocData(pConPriv->getDocClient); - - pConPriv->getDocClient = (ClientPtr)NULL; - pConPriv->getDocBufSize = 0; - - return Success; - } - - if(pConPriv->pJobFile != (FILE *)NULL) - { - fclose(pConPriv->pJobFile); - pConPriv->pJobFile = (FILE *)NULL; - - if(pConPriv->jobFileName != (char *)NULL) - { - XpSubmitJob( pConPriv->jobFileName, pCon ); - unlink(pConPriv->jobFileName); - Xfree(pConPriv->jobFileName); - pConPriv->jobFileName = (char *)NULL; - } - } - - return Success; -} - -/* StartPage - * - * If page file exists - * close page file - * set page file pointer = NULL - * unlink page file - */ -static int -StartPage( - XpContextPtr pCon, - WindowPtr pWin) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - - if(pConPriv->pPageFile != (FILE *)NULL) - { - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - } - if(pConPriv->pageFileName != (char *)NULL) - { - unlink(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - } - - return Success; -} - -#include "X11/XWDFile.h" - - -#define lowbit(x) ((x) & (~(x) + 1)) - -/* - * Get the XWDColors of all pixels in colormap - returns # of colors - */ -static XWDColor * -Get_XWDColors( - ColormapPtr pCmap) -{ - int i, ncolors; - xrgb *prgbList; - Pixel *pPixels; - XWDColor *colors; - - ncolors = pCmap->pVisual->ColormapEntries; - if (!(colors = (XWDColor *) malloc (sizeof(XWDColor) * ncolors))) - return (XWDColor *) NULL; - if (!(prgbList = (xrgb*) malloc(sizeof(xrgb) * ncolors))) - { - Xfree(colors); - return (XWDColor *) NULL; - } - if (!(pPixels = (Pixel*) malloc(sizeof(Pixel) * ncolors))) - { - Xfree(colors); - Xfree(prgbList); - return (XWDColor *) NULL; - } - - if (pCmap->pVisual->class == DirectColor || - pCmap->pVisual->class == TrueColor) { - Pixel red, green, blue, red1, green1, blue1; - - red = green = blue = 0; - red1 = lowbit(pCmap->pVisual->redMask); - green1 = lowbit(pCmap->pVisual->greenMask); - blue1 = lowbit(pCmap->pVisual->blueMask); - for (i=0; i<ncolors; i++) { - colors[i].pixel = red|green|blue; - colors[i].pad = 0; - red += red1; - if (red > pCmap->pVisual->redMask) - red = 0; - green += green1; - if (green > pCmap->pVisual->greenMask) - green = 0; - blue += blue1; - if (blue > pCmap->pVisual->blueMask) - blue = 0; - } - } else { - for (i=0; i<ncolors; i++) { - colors[i].pixel = i; - colors[i].pad = 0; - } - } - - for(i = 0; i < ncolors; i++) - pPixels[i] = colors[i].pixel; - - QueryColors(pCmap, ncolors, pPixels, prgbList); - Xfree(pPixels); - - for(i = 0; i < ncolors; i++) - { - colors[i].red = prgbList[i].red; - colors[i].green = prgbList[i].green; - colors[i].blue = prgbList[i].blue; - } - Xfree(prgbList); - - return(colors); -} - -static void -_swapshort ( - register char *bp, - register unsigned n) -{ - register char c; - register char *ep = bp + n; - - while (bp < ep) { - c = *bp; - *bp = *(bp + 1); - bp++; - *bp++ = c; - } -} - -static void -_swaplong ( - register char *bp, - register unsigned n) -{ - register char c; - register char *ep = bp + n; - register char *sp; - - while (bp < ep) { - sp = bp + 3; - c = *sp; - *sp = *bp; - *bp++ = c; - sp = bp + 1; - c = *sp; - *sp = *bp; - *bp++ = c; - bp += 2; - } -} -static int -WriteWindowRaster( - WindowPtr pWin, - FILE *pRasterFile) -{ - long widthBytesLine, length; - int nlines, linesPerBuf, height, linesDone; - char *pBuf; - DrawablePtr pDraw = &pWin->drawable; - XWDFileHeader header; - int win_name_size; - int header_size; - int ncolors, i; - char *win_name; - VisualPtr pVisual; - ColormapPtr pCmap; - XWDColor *pColors; - unsigned long swaptest = 1; - - widthBytesLine = PixmapBytePad(pWin->drawable.width, pWin->drawable.depth); - length = widthBytesLine * pWin->drawable.height; - height = pWin->drawable.height; - - if(length <= 0) - return Success; - - if (widthBytesLine >= IMAGE_BUFSIZE) - linesPerBuf = 1; - else - { - linesPerBuf = IMAGE_BUFSIZE / widthBytesLine; - if (linesPerBuf > height) - linesPerBuf = height; - } - length = linesPerBuf * widthBytesLine; - if (linesPerBuf < height) - { - /* we have to make sure intermediate buffers don't need padding */ - while ((linesPerBuf > 1) && (length & 3)) - { - linesPerBuf--; - length -= widthBytesLine; - } - while (length & 3) - { - linesPerBuf++; - length += widthBytesLine; - } - } - if(!(pBuf = (char *) Xalloc(length))) - return (BadAlloc); - - /* - * Start of Xwd header code. - */ - - /* - * XXX - Should we use the real window name??? - */ - win_name = "xwdump"; - /* sizeof(char) is included for the null string terminator. */ - win_name_size = strlen(win_name) + sizeof(char); - - pCmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP); - pVisual = pCmap->pVisual; - if((pColors = Get_XWDColors(pCmap)) == (XWDColor *)NULL) - { - Xfree(pBuf); - return (BadAlloc); - } - - /* - * Write out header information. - */ - header_size = sizeof(header) + win_name_size; - header.header_size = (CARD32) header_size; - header.file_version = (CARD32) XWD_FILE_VERSION; - header.pixmap_format = (CARD32) ZPixmap; /* Must match GetImage below */ - header.pixmap_depth = (CARD32) pDraw->depth; - header.pixmap_width = (CARD32) pDraw->width; - header.pixmap_height = (CARD32) pDraw->height; - header.xoffset = (CARD32) 0; - header.byte_order = (CARD32) screenInfo.imageByteOrder; - header.bitmap_unit = (CARD32) screenInfo.bitmapScanlineUnit; - header.bitmap_bit_order = (CARD32) screenInfo.bitmapBitOrder; - header.bitmap_pad = (CARD32) screenInfo.bitmapScanlinePad; - header.bits_per_pixel = (CARD32) pDraw->bitsPerPixel; - header.bytes_per_line = (CARD32) widthBytesLine; - header.visual_class = (CARD32) pVisual->class; - header.red_mask = (CARD32) pVisual->redMask; - header.green_mask = (CARD32) pVisual->greenMask; - header.blue_mask = (CARD32) pVisual->blueMask; - header.bits_per_rgb = (CARD32) pVisual->bitsPerRGBValue; - header.colormap_entries = (CARD32) pVisual->ColormapEntries; - header.ncolors = ncolors = (CARD32) pVisual->ColormapEntries; - header.window_width = (CARD32) pDraw->width; - header.window_height = (CARD32) pDraw->height; - header.window_x = 0; - header.window_y = 0; - header.window_bdrwidth = (CARD32) 0; - - if (*(char *) &swaptest) { - _swaplong((char *) &header, sizeof(header)); - for (i = 0; i < ncolors; i++) { - _swaplong((char *) &pColors[i].pixel, sizeof(long)); - _swapshort((char *) &pColors[i].red, 3 * sizeof(short)); - } - } - - (void) fwrite((char *)&header, sizeof(header), 1, pRasterFile); - (void) fwrite(win_name, win_name_size, 1, pRasterFile); - (void) fwrite((char *) pColors, sizeof(XWDColor), ncolors, pRasterFile); - - Xfree(pColors); - - /* - * End of Xwd header code. - */ - - linesDone = 0; - while(height - linesDone > 0) - { - nlines = min(linesPerBuf, height - linesDone); - (*pDraw->pScreen->GetImage) (pDraw, - 0, - linesDone, - pWin->drawable.width, - nlines, - ZPixmap, - ~0, - pBuf); - - if(fwrite(pBuf, sizeof(char), (size_t)(nlines * widthBytesLine), - pRasterFile) != - (size_t)(nlines * widthBytesLine)) - { - Xfree(pBuf); - return BadAlloc; - } - linesDone += nlines; - } - Xfree(pBuf); - return Success; -} - - -static int -SendPage( XpContextPtr pCon ) -{ - struct stat statBuf; - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - - if(stat(pConPriv->pageFileName, &statBuf) < 0) - return BadAlloc; - - return XpSendDocumentData(pConPriv->getDocClient, - pConPriv->pPageFile, (int)statBuf.st_size, - pConPriv->getDocBufSize); -} - -/* - * EndPage: - * - * If page file doesn't exist: - * { - * Create page file - * Open page file - * Write page header to page file - * if(preRasterFile exists) - * copy preRasterFile contents to page file - * if(noRasterFile exists) - * write noRasterFile contents to page file - * else - * Create raster image file - * Open raster image file - * GetImage data - * Write Image data to raster image file - * invoke page_command on raster image file - * Write raster image file contents to page file - * Unlink tempPage file - * if(postRasterFile exists) - * write postRasterFile contents to page file - * Write page trailer to page file - * } - * Write page file to job file - */ -static int -EndPage( - XpContextPtr pCon, - WindowPtr pWin) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - struct stat statBuf; - char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL; - FILE *pRasterFile = (FILE *)NULL; - - if(pConPriv->pageFileName == (char *)NULL) - { - /* - * Open the page file. - */ - if (!XpOpenTmpFile("w+", &pConPriv->pageFileName, - &pConPriv->pPageFile)) - goto BAD_PAGE_ALLOC; - - /* - * Copy any pre-raster document data to the page file. - */ - if(pConPriv->pPreRasterFile != (FILE *)NULL) - { - if(CopyContentsAndDelete(&pConPriv->pPreRasterFile, - &pConPriv->preRasterFileName, - pConPriv->pPageFile) == FALSE) - goto BAD_PAGE_ALLOC; - } - - /* - * Copy either the no-raster document data, or the raster - * data itself to the page file. - * If the no-raster file exists, then we don't process the - * actual window raster bits. - */ - if(pConPriv->pNoRasterFile != (FILE *)NULL) - { - if(CopyContentsAndDelete(&pConPriv->pNoRasterFile, - &pConPriv->noRasterFileName, - pConPriv->pPageFile) == FALSE) - goto BAD_PAGE_ALLOC; - } - else - { - /* - * Open the raster image file. - */ - if (!XpOpenTmpFile("w", &rasterFileName, &pRasterFile)) - goto BAD_PAGE_ALLOC; - - /* - * Write the page image data to the raster image file. - */ - if(WriteWindowRaster(pWin, pRasterFile) != Success) - goto BAD_PAGE_ALLOC; - - /* - * Invoke the page_command on the raster image file. - */ - if((pCommand = GetPropString(pCon, RASTER_PRINT_PAGE_COMMAND)) != - (char *)NULL) - { - char *outFileName; - FILE *pOutFile; - - if (!XpOpenTmpFile("w", &outFileName, &pOutFile)) - goto BAD_PAGE_ALLOC; - fclose(pOutFile); - - pCommand = ReplaceFileString(strdup(pCommand), rasterFileName, - outFileName); - fclose(pRasterFile); - SystemCmd(pCommand); - free(pCommand); - /* - * Delete the unprocessed raster file. - */ - unlink(rasterFileName); - Xfree(rasterFileName); - rasterFileName = outFileName; - if((pRasterFile = fopen(rasterFileName, "r")) == (FILE *)NULL) - goto BAD_PAGE_ALLOC; - } - else - { - fclose(pRasterFile); - if((pRasterFile = fopen(rasterFileName, "r")) == (FILE *)NULL) - goto BAD_PAGE_ALLOC; - } - - /* - * Copy the raster image file contents to the page file. - * Note that pRasterFile must be set to the start of the - * raster file. - */ - if(CopyContentsAndDelete(&pRasterFile, - &rasterFileName, - pConPriv->pPageFile) == FALSE) - goto BAD_PAGE_ALLOC; - } - - /* - * Copy any post-raster document data to the page file. - */ - if(pConPriv->pPostRasterFile != (FILE *)NULL) - { - if(CopyContentsAndDelete(&pConPriv->pPostRasterFile, - &pConPriv->postRasterFileName, - pConPriv->pPageFile) == FALSE) - goto BAD_PAGE_ALLOC; - } - - } - - /* - * Write the page file contents to the job file or to the client - * performing GetDocumentData. - * pConPriv->pPageFile must first be set to the start of the page file. - */ - rewind(pConPriv->pPageFile); - if(stat(pConPriv->pageFileName, &statBuf) < 0) - goto BAD_PAGE_ALLOC; - - /* - * Send the page data to whatever client has called GetDocumentData. - */ - if(pConPriv->getDocClient != (ClientPtr)NULL&&pConPriv->getDocBufSize > 0) - { - int retval; - /* - * We should do something like the following: suspend the - * caller until we can gracefully write all the data in small - * chunks to the receiver, but for now we'll just call WriteToClient - * on the huge chunk - */ - retval = SendPage(pCon); - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - unlink(pConPriv->pageFileName); - free(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - return retval; - } - - if(pConPriv->pJobFile == (FILE *)NULL) - { - /* - * This shouldn't be necessary. I believe we only get here if - * someone calls "EndPage" prior to "StartJob". This error - * condition should probably be trapped at a higher level. - */ - - if(pConPriv->jobFileName != (char *)NULL) - Xfree(pConPriv->jobFileName); - /* - * Create a temporary file to store the printer output. - */ - if (!XpOpenTmpFile("w", &pConPriv->jobFileName, &pConPriv->pJobFile)) - goto BAD_PAGE_ALLOC; - } - - if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile, - (int)statBuf.st_size) != (int)statBuf.st_size) - goto BAD_PAGE_ALLOC; - - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - unlink(pConPriv->pageFileName); - free(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - - return Success; - - BAD_PAGE_ALLOC: - - FreePageFiles(pConPriv); - - if(pRasterFile != (FILE *)NULL) - fclose(pRasterFile); - if(rasterFileName != (char *)NULL) - { - unlink(rasterFileName); - Xfree(rasterFileName); - } - return BadAlloc; -} - -static int -DocumentData( - XpContextPtr pCon, - DrawablePtr pDraw, - char *pData, - int len_data, - char *pDoc_fmt, - int len_fmt, - char *pOptions, - int len_options, - ClientPtr client) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - char *preRasterStr = PRE_RASTER, *postRasterStr = POST_RASTER, - *noRasterStr = NO_RASTER; - - /* - * Check that options equals either PRE_RASTER or POST_RASTER. - */ - if(len_options == strlen(preRasterStr) && - strncmp(pOptions, preRasterStr, strlen(preRasterStr)) == 0) - { - if(pConPriv->pPreRasterFile == (FILE *)NULL) - { - if (!XpOpenTmpFile("w+", &pConPriv->preRasterFileName, - &pConPriv->pPreRasterFile)) - return BadAlloc; - } - if(fwrite(pData, sizeof(char), (size_t)len_data, - pConPriv->pPreRasterFile) != (size_t)len_data) - return BadAlloc; - fflush(pConPriv->pPreRasterFile); - } - else if(len_options == strlen(postRasterStr) && - strncmp(pOptions, postRasterStr, strlen(postRasterStr)) == 0) - { - if(pConPriv->pPostRasterFile == (FILE *)NULL) - { - if (!XpOpenTmpFile("w+", &pConPriv->postRasterFileName, - &pConPriv->pPostRasterFile)) - return BadAlloc; - } - if(fwrite(pData, sizeof(char), (size_t)len_data, - pConPriv->pPostRasterFile) != (size_t)len_data) - return BadAlloc; - fflush(pConPriv->pPostRasterFile); - } - else if(len_options == strlen(noRasterStr) && - strncmp(pOptions, noRasterStr, strlen(noRasterStr)) == 0) - { - if(pConPriv->pNoRasterFile == (FILE *)NULL) - { - if (!XpOpenTmpFile("w+", &pConPriv->noRasterFileName, - &pConPriv->pNoRasterFile)) - return BadAlloc; - } - if(fwrite(pData, sizeof(char), (size_t)len_data, - pConPriv->pNoRasterFile) != (size_t)len_data) - return BadAlloc; - fflush(pConPriv->pNoRasterFile); - } - else - return BadValue; - - return Success; -} - -/* - * GetDocumentData notes which client is requesting the document data for - * a particular context. The Raster driver's EndPage function causes the - * data to be written to the proper client. - */ -static int -GetDocumentData( - XpContextPtr pContext, - ClientPtr client, - int maxBufferSize) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pContext->devPrivates, RasterContextPrivateKey); - - pConPriv->getDocClient = client; - pConPriv->getDocBufSize = maxBufferSize; - return Success; -} - -static void -AllocateRasterPrivates( - ScreenPtr pScreen) -{ - dixRequestPrivate(RasterContextPrivateKey, sizeof( RasterContextPrivRec ) ); - dixSetPrivate(&pScreen->devPrivates, RasterScreenPrivateKey, - Xalloc(sizeof(RasterScreenPrivRec))); -} - -/* - * RasterChangeWindowAttributes - Make sure that the window's backing - * store is turned on. - */ -static Bool -RasterChangeWindowAttributes( - WindowPtr pWin, - unsigned long mask) -{ - Bool status = Success; - ScreenPtr pScreen = pWin->drawable.pScreen; - RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey); - - if(pWin->backingStore == NotUseful) - { - pWin->backingStore = WhenMapped; - mask |= CWBackingStore; - } - - if(pScreenPriv->ChangeWindowAttributes != NULL) - { - pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; - status = pScreen->ChangeWindowAttributes(pWin, mask); - pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes; - } - return status; -} - -/* - * RasterValidateDocFormats - Inspects the files available in the - * ddx-config/XP-RASTER directory to find the names of PDLs for which - * we have processing commands. These names are then intersected with - * the contents of the printer's document-formats-supported attribute, - * and the result is stored back into document-formats-supported. - * We have hard-coded knowledge of how to produce PS, so we always - * leave that in, if it's listed in document-formats-supported, - * even if we don't have a configuration file. If there is a - * configuration file for PS, then its contents will override our default. - */ -static void -RasterValidateDocFormats( - XpContextPtr pCon) -{ -} - -/* - * RasterValidateAttrs - Inspects and Corrects the attribute values - * in the specified context. - */ -static void -RasterValidateAttrs( - XpContextPtr pCon) -{ - RasterValidateDocFormats(pCon); - XpValidatePrinterPool(pCon, &RasterValidatePoolsRec); - XpValidateJobPool(pCon, &RasterValidatePoolsRec); - XpValidateDocumentPool(pCon, &RasterValidatePoolsRec); -} - -/* - * RasterInitContext - Establish the appropriate values for a - * PrintContext used with the Raster Driver. - */ -static char DOC_ATT_SUPP[]="document-attributes-supported:\tdefault-medium document-format"; -static char JOB_ATT_SUPP[]="job-attributes-supported:\t"; -static char DDX_DIR[]="ddx-config"; - -static int -RasterInitContext( - XpContextPtr pCon) -{ - char *configFileName, *val, *attrStr; - RasterContextPrivPtr pConPriv; - XpDriverFuncsPtr pFuncs; - - /* - * Initialize the attribute store for this printer. - */ - XpInitAttributes( pCon ); - - /* - * Validate the attributes - */ - RasterValidateAttrs( pCon ); - - - /* - * Initialize the function pointers - */ - pFuncs = &( pCon->funcs ); - pFuncs->StartJob = StartJob; - pFuncs->EndJob = EndJob; - pFuncs->StartDoc = StartDoc; - pFuncs->EndDoc = EndDoc; - pFuncs->StartPage = StartPage; - pFuncs->EndPage = EndPage; - pFuncs->PutDocumentData = DocumentData; - pFuncs->GetDocumentData = GetDocumentData; - pFuncs->DestroyContext = RasterDestroyContext; - pFuncs->GetAttributes = RasterGetAttributes; - pFuncs->GetOneAttribute = RasterGetOneAttribute; - pFuncs->SetAttributes = RasterSetAttributes; - pFuncs->AugmentAttributes = RasterAugmentAttributes; - pFuncs->GetMediumDimensions = RasterMediumDimensions; - pFuncs->GetReproducibleArea = RasterReproducibleArea; - - /* - * Set up the context privates - */ - pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - - pConPriv->jobFileName = (char *)NULL; - pConPriv->pageFileName = (char *)NULL; - pConPriv->preRasterFileName = (char *)NULL; - pConPriv->postRasterFileName = (char *)NULL; - pConPriv->noRasterFileName = (char *)NULL; - pConPriv->pJobFile = (FILE *)NULL; - pConPriv->pPageFile = (FILE *)NULL; - pConPriv->pPreRasterFile = (FILE *)NULL; - pConPriv->pPostRasterFile = (FILE *)NULL; - pConPriv->pNoRasterFile = (FILE *)NULL; - - pConPriv->getDocClient = (ClientPtr)NULL; - pConPriv->getDocBufSize = 0; - - /* - * Get the configuration information for the context's printer - */ - configFileName = XpGetOneAttribute( pCon, XPPrinterAttr, - "xp-ddx-config-file-name" ); - if(configFileName && strlen(configFileName)) - { - if( configFileName[0] == '/' ) - pConPriv->config = XrmGetFileDatabase( configFileName ); - else - { - char *configDir, *configFilePath; - - configDir = XpGetConfigDir(FALSE); - configFilePath = (char *)malloc((strlen(configDir) + - strlen(DDX_DIR) + - strlen(RASTER_DRIV_NAME) + - strlen(configFileName) + - 4)* sizeof(char)); - sprintf(configFilePath, "%s/%s/%s/%s", configDir, DDX_DIR, - RASTER_DRIV_NAME, configFileName); - pConPriv->config = XrmGetFileDatabase(configFilePath); - free(configDir); - free(configFilePath); - } - } - else - pConPriv->config = (XrmDatabase)NULL; - - /* - * Add our own attribute initialization - */ - /* - * document-attributes-supported - */ - val = XpGetOneAttribute(pCon, XPServerAttr, "document-attributes-supported"); - if((attrStr = (char *)xalloc(strlen(val) + strlen(DOC_ATT_SUPP) + 4)) == - (char *)NULL) - return BadAlloc; - sprintf(attrStr, "*%s %s", DOC_ATT_SUPP, val); - XpAugmentAttributes(pCon, XPPrinterAttr, attrStr); - xfree(attrStr); - - /* - * job-attributes-supported - */ - val = XpGetOneAttribute(pCon, XPServerAttr, "job-attributes-supported"); - if((attrStr = (char *)xalloc(strlen(val) + strlen(JOB_ATT_SUPP) + 4)) == - (char *)NULL) - return BadAlloc; - sprintf(attrStr, "*%s %s", JOB_ATT_SUPP, val); - XpAugmentAttributes(pCon, XPPrinterAttr, attrStr); - xfree(attrStr); - - /* - * PageAttributesSupported - */ - XpAugmentAttributes(pCon, XPPrinterAttr, "*xp-page-attributes-supported:"); - - return Success; -} - - - -static Bool -RasterDestroyContext( - XpContextPtr pCon) -{ - RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); - - /* - * Clean up the temporary files - */ - FreePageFiles( pConPriv ); - - if( pConPriv->pJobFile != (FILE *)NULL ) - { - fclose( pConPriv->pJobFile ); - pConPriv->pJobFile = (FILE *)NULL; - } - if( pConPriv->jobFileName != (char *)NULL ) - { - unlink( pConPriv->jobFileName ); - Xfree( pConPriv->jobFileName ); - } - if(pConPriv->config) - { - XrmDestroyDatabase(pConPriv->config); - pConPriv->config = (XrmDatabase)NULL; - } - - XpDestroyAttributes( pCon ); - return Success; -} - -static char * -RasterGetAttributes( - XpContextPtr pContext, - XPAttributes class) -{ - return XpGetAttributes( pContext, class ); -} - -static char * -RasterGetOneAttribute( - XpContextPtr pContext, - XPAttributes class, - char *attr) -{ - return XpGetOneAttribute( pContext, class, attr ); -} - -static int -RasterSetAttributes(XpContextPtr pCon, - XPAttributes class, - char *attributes) -{ - return XpSetAttributes( pCon, class, attributes ); -} - -static int -RasterAugmentAttributes( - XpContextPtr pCon, - XPAttributes class, - char *attributes) -{ - return XpAugmentAttributes( pCon, class, attributes ); -} - -static void -FreePageFiles( - RasterContextPrivPtr pConPriv) -{ - if(pConPriv->pPageFile != (FILE *)NULL) - { - fclose(pConPriv->pPageFile); - pConPriv->pPageFile = (FILE *)NULL; - } - if(pConPriv->pageFileName != (char *)NULL) - { - unlink(pConPriv->pageFileName); - Xfree(pConPriv->pageFileName); - pConPriv->pageFileName = (char *)NULL; - } - if(pConPriv->pPreRasterFile != (FILE *)NULL) - { - fclose(pConPriv->pPreRasterFile); - pConPriv->pPreRasterFile = (FILE *)NULL; - } - if(pConPriv->preRasterFileName != (char *)NULL) - { - unlink(pConPriv->preRasterFileName); - Xfree(pConPriv->preRasterFileName); - pConPriv->preRasterFileName = (char *)NULL; - } - if(pConPriv->pPostRasterFile != (FILE *)NULL) - { - fclose(pConPriv->pPostRasterFile); - pConPriv->pPostRasterFile = (FILE *)NULL; - } - if(pConPriv->postRasterFileName != (char *)NULL) - { - unlink(pConPriv->postRasterFileName); - Xfree(pConPriv->postRasterFileName); - pConPriv->postRasterFileName = (char *)NULL; - } - if(pConPriv->pNoRasterFile != (FILE *)NULL) - { - fclose(pConPriv->pNoRasterFile); - pConPriv->pNoRasterFile = (FILE *)NULL; - } - if(pConPriv->noRasterFileName != (char *)NULL) - { - unlink(pConPriv->noRasterFileName); - Xfree(pConPriv->noRasterFileName); - pConPriv->noRasterFileName = (char *)NULL; - } -} - -/* - * RasterCloseScreen - Call any wrapped CloseScreen function, - * and free the screen memory. - */ -static Bool -RasterCloseScreen( - int index, - ScreenPtr pScreen) -{ - Bool status = Success; - RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr) - dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey); - - /* - * Call any wrapped CloseScreen proc. - */ - if(pScreenPriv->CloseScreen != NULL) - { - pScreen->CloseScreen = pScreenPriv->CloseScreen; - status = pScreen->CloseScreen(index, pScreen); - pScreen->CloseScreen = RasterCloseScreen; - } - - Xfree(pScreenPriv->pBits); - Xfree(pScreenPriv); - - return status; -} - -#include <signal.h> - -/* ARGSUSED */ -static void SigchldHndlr (int dummy) -{ - int status; - int olderrno = errno; - struct sigaction act; - sigfillset(&act.sa_mask); - act.sa_flags = 0; - act.sa_handler = SigchldHndlr; - - (void) wait (&status); - - /* - * Is this really necessary? - */ - sigaction(SIGCHLD, &act, (struct sigaction *)NULL); - errno = olderrno; -} - -/* - * SystemCmd provides a wrapper for the 'system' library call. The call - * appears to be sensitive to the handling of SIGCHLD, so this wrapper - * sets the status to SIG_DFL, and then resets the established handler - * after system returns. - */ -static int -SystemCmd(char *cmdStr) -{ - int status; - struct sigaction newAct, oldAct; - sigfillset(&newAct.sa_mask); - newAct.sa_flags = 0; - newAct.sa_handler = SIG_DFL; - sigfillset(&oldAct.sa_mask); - oldAct.sa_flags = 0; - oldAct.sa_handler = SigchldHndlr; - - /* - * get the old handler, and set the action to IGN - */ - sigaction(SIGCHLD, &newAct, &oldAct); - - status = system (cmdStr); - - sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL); - return status; -} - -/* - * RasterMediumDimensions is installed in the GetMediumDimensions field - * of each raster-initialized context. - */ -static int -RasterMediumDimensions(XpContextPtr pCon, - CARD16 *width, - CARD16 *height) -{ - XpGetMediumDimensions(pCon, width, height); - return Success; -} - -/* - * RasterReproducibleArea is installed in the GetReproducibleArea field - * of each raster-initialized context. - */ -static int -RasterReproducibleArea(XpContextPtr pCon, - xRectangle *pRect) -{ - XpGetReproductionArea(pCon, pRect); - return Success; -} diff --git a/hw/xprint/raster/Raster.h b/hw/xprint/raster/Raster.h deleted file mode 100644 index 7a613f0b0..000000000 --- a/hw/xprint/raster/Raster.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ -/******************************************************************* -** -** ********************************************************* -** * -** * File: printer/Raster.h -** * -** * Contents: defines and includes for the raster layer -** * for a printing X server. -** * -** * Copyright: Copyright 1993 Hewlett-Packard Company -** * -** ********************************************************* -** -********************************************************************/ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef _RASTER_H_ -#define _RASTER_H_ - -/* - * Some sleazes to force the XrmDB stuff into the server - */ -#ifndef HAVE_XPointer -#define HAVE_XPointer 1 -typedef char *XPointer; -#endif -#define Status int -#define True 1 -#define False 0 -#include "misc.h" -#include <X11/Xfuncproto.h> -#include <X11/Xresource.h> -#include "attributes.h" - -#include <X11/extensions/Printstr.h> - -#define MAX_TOKEN_LEN 512 - -#define RASTER_PRINT_PAGE_COMMAND "_XP_RASTER_PAGE_PROC_COMMAND" - -#define RASTER_IN_FILE_STRING "%(InFile)%" -#define RASTER_OUT_FILE_STRING "%(OutFile)%" - -#define RASTER_ALLOWED_COMMANDS_FILE "printCommands" - -/* - * Defines for the "options" in DtPrintDocumentData. - */ -#define PRE_RASTER "PRE-RASTER" -#define POST_RASTER "POST-RASTER" -#define NO_RASTER "NO-RASTER" - - -typedef struct { - char *pBits; - CreateWindowProcPtr CreateWindow; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - DestroyWindowProcPtr DestroyWindow; - CloseScreenProcPtr CloseScreen; -} RasterScreenPrivRec, *RasterScreenPrivPtr; - -typedef struct { - XrmDatabase config; - char *jobFileName; - FILE *pJobFile; - char *pageFileName; - FILE *pPageFile; - char *preRasterFileName; /* Pre-raster document data */ - FILE *pPreRasterFile; - char *noRasterFileName; /* Raster replacement document data */ - FILE *pNoRasterFile; - char *postRasterFileName; /* Post-raster document data */ - FILE *pPostRasterFile; - ClientPtr getDocClient; - int getDocBufSize; -} RasterContextPrivRec, *RasterContextPrivPtr; - - -extern XpValidatePoolsRec RasterValidatePoolsRec; - -extern Bool InitializeRasterDriver(int ndx, ScreenPtr pScreen, int argc, - char **argv); - -#endif /* _RASTER_H_ */ diff --git a/hw/xprint/raster/RasterAttVal.c b/hw/xprint/raster/RasterAttVal.c deleted file mode 100644 index 8189be47c..000000000 --- a/hw/xprint/raster/RasterAttVal.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -(c) Copyright 1996 Hewlett-Packard Company -(c) Copyright 1996 International Business Machines Corp. -(c) Copyright 1996 Sun Microsystems, Inc. -(c) Copyright 1996 Novell, Inc. -(c) Copyright 1996 Digital Equipment Corp. -(c) Copyright 1996 Fujitsu Limited -(c) Copyright 1996 Hitachi, Ltd. - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <X11/X.h> -#include "misc.h" -#include "dixstruct.h" -#include "scrnintstr.h" -#include "screenint.h" -#include <X11/extensions/Print.h> -#include "Raster.h" - -#include "attributes.h" -#include "AttrValid.h" - -/* - * define valid values and defaults for Printer pool - */ -static XpOid ValidContentOrientationsOids[] = { - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape -}; -static XpOidList ValidContentOrientations = { - ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids) -}; - -static XpOid DefaultContentOrientationsOids[] = { - xpoid_val_content_orientation_portrait, - xpoid_val_content_orientation_landscape -}; -static XpOidList DefaultContentOrientations = { - DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids) -}; - -static XpOid ValidPlexesOids[] = { - xpoid_val_plex_simplex -}; -static XpOidList ValidPlexes = { - ValidPlexesOids, XpNumber(ValidPlexesOids) -}; - -static XpOid DefaultPlexesOids[] = { - xpoid_val_plex_simplex -}; -static XpOidList DefaultPlexes = { - DefaultPlexesOids, XpNumber(DefaultPlexesOids) -}; - -static unsigned long ValidPrinterResolutionsCards[] = { - 150, 300, 600 -}; -static XpOidCardList ValidPrinterResolutions = { - ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards) -}; - -static unsigned long DefaultPrinterResolutionsCards[] = { - 300 -}; -static XpOidCardList DefaultPrinterResolutions = { - DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards) -}; - -static XpOid ValidListfontsModesOids[] = { - xpoid_val_xp_list_glyph_fonts -}; -static XpOidList ValidListfontsModes = { - ValidListfontsModesOids, XpNumber(ValidListfontsModesOids) -}; - -static XpOid DefaultListfontsModesOids[] = { - xpoid_val_xp_list_glyph_fonts -}; -static XpOidList DefaultListfontsModes = { - DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids) -}; - -static XpOid ValidSetupProvisoOids[] = { - xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional -}; -static XpOidList ValidSetupProviso = { - ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids) -}; - -static XpOidDocFmt ValidDocFormatsSupportedFmts[] = { - { "Postscript", "2", NULL }, - { "PCL", "3", NULL } -}; -static XpOidDocFmtList ValidDocFormatsSupported = { - ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList DefaultDocFormatsSupported = { - DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts) -}; - -static XpOidDocFmtList ValidEmbeddedFormatsSupported = { - (XpOidDocFmt *)NULL, 0 -}; - -static XpOidDocFmtList DefaultEmbeddedFormatsSupported = { - (XpOidDocFmt *)NULL, 0 -}; - -static XpOidDocFmt ValidRawFormatsSupportedFmts[] = { - { "Postscript", "2", NULL }, - { "PCL", "3", NULL } -}; -static XpOidDocFmtList ValidRawFormatsSupported = { - ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts) -}; - -static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = { - { "Postscript", "2", NULL } -}; -static XpOidDocFmtList DefaultRawFormatsSupported = { - DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts) -}; - -static XpOidList ValidInputTrays = { - (XpOid *)NULL, 0 -}; - -static XpOid ValidMediumSizesOids[] = { - xpoid_val_medium_size_iso_a0, - xpoid_val_medium_size_iso_a1, - xpoid_val_medium_size_iso_a2, - xpoid_val_medium_size_iso_a3, - xpoid_val_medium_size_iso_a4, - xpoid_val_medium_size_iso_a5, - xpoid_val_medium_size_iso_a6, - xpoid_val_medium_size_iso_a7, - xpoid_val_medium_size_iso_a8, - xpoid_val_medium_size_iso_a9, - xpoid_val_medium_size_iso_a10, - xpoid_val_medium_size_iso_b0, - xpoid_val_medium_size_iso_b1, - xpoid_val_medium_size_iso_b2, - xpoid_val_medium_size_iso_b3, - xpoid_val_medium_size_iso_b4, - xpoid_val_medium_size_iso_b5, - xpoid_val_medium_size_iso_b6, - xpoid_val_medium_size_iso_b7, - xpoid_val_medium_size_iso_b8, - xpoid_val_medium_size_iso_b9, - xpoid_val_medium_size_iso_b10, - xpoid_val_medium_size_na_letter, - xpoid_val_medium_size_na_legal, - xpoid_val_medium_size_executive, - xpoid_val_medium_size_folio, - xpoid_val_medium_size_invoice, - xpoid_val_medium_size_ledger, - xpoid_val_medium_size_quarto, - xpoid_val_medium_size_iso_c3, - xpoid_val_medium_size_iso_c4, - xpoid_val_medium_size_iso_c5, - xpoid_val_medium_size_iso_c6, - xpoid_val_medium_size_iso_designated_long, - xpoid_val_medium_size_na_10x13_envelope, - xpoid_val_medium_size_na_9x12_envelope, - xpoid_val_medium_size_na_number_10_envelope, - xpoid_val_medium_size_na_7x9_envelope, - xpoid_val_medium_size_na_9x11_envelope, - xpoid_val_medium_size_na_10x14_envelope, - xpoid_val_medium_size_na_number_9_envelope, - xpoid_val_medium_size_monarch_envelope, - xpoid_val_medium_size_a, - xpoid_val_medium_size_b, - xpoid_val_medium_size_c, - xpoid_val_medium_size_d, - xpoid_val_medium_size_e, - xpoid_val_medium_size_jis_b0, - xpoid_val_medium_size_jis_b1, - xpoid_val_medium_size_jis_b2, - xpoid_val_medium_size_jis_b3, - xpoid_val_medium_size_jis_b4, - xpoid_val_medium_size_jis_b5, - xpoid_val_medium_size_jis_b6, - xpoid_val_medium_size_jis_b7, - xpoid_val_medium_size_jis_b8, - xpoid_val_medium_size_jis_b9, - xpoid_val_medium_size_jis_b10 -}; -static XpOidList ValidMediumSizes = { - ValidMediumSizesOids, XpNumber(ValidMediumSizesOids) -}; - -static XpOidDocFmt DefaultDocumentFormat = { - "Postscript", "2", NULL -}; - -static XpOid ValidAvailableCompressionsOids[] = { - xpoid_val_available_compressions_0, - xpoid_val_available_compressions_01, - xpoid_val_available_compressions_02, - xpoid_val_available_compressions_03, - xpoid_val_available_compressions_012, - xpoid_val_available_compressions_013, - xpoid_val_available_compressions_023, - xpoid_val_available_compressions_0123 -}; - -static XpOidList ValidAvailableCompressions = { - ValidAvailableCompressionsOids, XpNumber(ValidAvailableCompressionsOids) -}; - -static XpOid DefaultAvailableCompressionsOids[] = { - xpoid_val_available_compressions_0123, - xpoid_val_available_compressions_0 -}; - -static XpOidList DefaultAvailableCompressions = { - DefaultAvailableCompressionsOids, XpNumber(DefaultAvailableCompressionsOids) -}; - - -/* - * init struct for XpValidate*Pool - */ -XpValidatePoolsRec RasterValidatePoolsRec = { - &ValidContentOrientations, &DefaultContentOrientations, - &ValidDocFormatsSupported, &DefaultDocFormatsSupported, - &ValidInputTrays, &ValidMediumSizes, - &ValidPlexes, &DefaultPlexes, - &ValidPrinterResolutions, &DefaultPrinterResolutions, - &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported, - &ValidListfontsModes, &DefaultListfontsModes, - &ValidRawFormatsSupported, &DefaultRawFormatsSupported, - &ValidSetupProviso, - &DefaultDocumentFormat, - &ValidAvailableCompressions, &DefaultAvailableCompressions -}; diff --git a/hw/xprint/spooler.c b/hw/xprint/spooler.c deleted file mode 100644 index 69b5eed0e..000000000 --- a/hw/xprint/spooler.c +++ /dev/null @@ -1,202 +0,0 @@ -/* -Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> -Copyright (c) 2004 Sun Microsystems, 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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#ifdef __hpux -#include <sys/sysmacros.h> -#endif - -#include "spooler.h" - -/* - * The string LIST_QUEUES_* is fed to a shell to generate an ordered - * list of available printers on the system. These string definitions - * are taken from the file PrintSubSys.C within the code for the - * dtprintinfo program. - */ -#define LIST_QUEUES_AIX4 \ - "lsallq | grep -v '^bsh$' | sort | uniq" - -#define LIST_QUEUES_HPUX \ - "LANG=C lpstat -v | " \ - "awk '" \ - " $2 == \"for\" " \ - " { " \ - " x = match($3, /:/); " \ - " print substr($3, 1, x-1)" \ - " }' | sort | uniq" - -#define LIST_QUEUES_OSF \ - "LANG=C lpstat -v | " \ - "nawk '" \ - " $2 == \"for\" " \ - " { print $4 }' " \ - " | sort | uniq" - -#define LIST_QUEUES_UXP \ - "LANG=C lpstat -v |" \ - "nawk '" \ - " $4 == \"for\" " \ - " { " \ - " x = match($5, /:/); " \ - " print substr($5, 1, x-1)" \ - " }' | sort | uniq" - -/* Support both normal and LPRng output of "lpc status" */ -#define LIST_QUEUES_BSD \ - "PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \ - "export PATH\n" \ - \ - "which_tool()\n" \ - "{\n" \ - " echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \ - "}\n" \ - \ - "(\n" \ - "WHICH_LPC=\"`which_tool lpc`\"\n" \ - \ - "if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \ - " NAWK=\"nawk\"\n" \ - "else\n" \ - " NAWK=\"awk\"\n" \ - "fi\n" \ - \ - "[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc status | ${NAWK} '/^[^ ]*:$/ && !/@/ && !/ / { print $1 }' | sed -e /:/s///)\n" \ - "[ \"${WHICH_LPC}\" != \"\" ] && (LANG=C lpc -a status | ${NAWK} '/^[^ ]*@[^ ]/ && !/:$/ { split( $1, name, \"@\" ); print name[1]; }')\n" \ - ") | egrep -v -i \" |^all$\" | sort | uniq" - -#define LIST_QUEUES_SYSV \ - "PATH=\"${PATH}:/usr/bin:/usr/sbin:/bin:/sbin\"\n" \ - "export PATH\n" \ - \ - "which_tool()\n" \ - "{\n" \ - " echo \"${PATH}\" | tr \":\" \"\n\" | while read i ; do ls -1ad \"${i}/${1}\" 2>/dev/null ; done\n" \ - "}\n" \ - \ - "(\n" \ - "WHICH_LPSTAT=\"`which_tool lpstat`\"\n" \ - \ - "if [ \"`which_tool nawk`\" != \"\" ] ; then\n" \ - " NAWK=\"nawk\"\n" \ - "else\n" \ - " NAWK=\"awk\"\n" \ - "fi\n" \ - \ - "[ \"${WHICH_LPSTAT}\" != \"\" ] && (LANG=C lpstat -v | ${NAWK} ' $2 == \"for\" { x = match($3, /:/); print substr($3, 1, x-1) }')\n" \ - ") | egrep -v -i \" |^all$\" | sort | uniq" - -#define LIST_QUEUES_SOLARIS "LANG=C lpget -k description " \ - "`lpstat -v " \ - "| nawk '$2 == \"for\" { x = match($3, /:/); print substr($3, 1,x-1) }' " \ - "| sort -u` " \ - "| nawk -F: ' NF == 2 { name=$1 } " \ - " NF == 1 { sub(\"^.*description\\( - undefined|=\\)\",\"\"); " \ - " printf \"%s\txp-printerattr.descriptor=%s\\n\", name, $1 } '" - -#define LIST_QUEUES_OTHER \ - "LANG=C lpstat -v | " \ - "nawk '" \ - " $2 == \"for\" " \ - " { " \ - " x = match($3, /:/); " \ - " print substr($3, 1, x-1)" \ - " }' | sort | uniq" - -#define DEFAULT_SPOOL_COMMAND_HPUX "/usr/bin/lp -d %printer-name% -o raw -n %copy-count% -t %job-name% %options%" -#define DEFAULT_SPOOL_COMMAND_BSD "/usr/bin/lpr -P %printer-name% -#%copy-count% -T %job-name% %options%" -#define DEFAULT_SPOOL_COMMAND_SYSV "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%" -#define DEFAULT_SPOOL_COMMAND_SOLARIS "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%" -#define DEFAULT_SPOOL_COMMAND_OTHER "/usr/bin/lp -d %printer-name% -n %copy-count% -t %job-name% %options%" - - -/* List of spooler types and the commands used to enumerate - * print queues and submit print jobs */ -XpSpoolerType xpstm[] = -{ - /* OS-specific spoolers */ - { "aix", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER }, - { "aix4", LIST_QUEUES_AIX4, DEFAULT_SPOOL_COMMAND_OTHER }, - { "bsd", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD }, - { "osf", LIST_QUEUES_OSF, DEFAULT_SPOOL_COMMAND_OTHER }, - { "solaris", LIST_QUEUES_SOLARIS, DEFAULT_SPOOL_COMMAND_SOLARIS }, - { "sysv", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV }, - { "uxp", LIST_QUEUES_UXP, DEFAULT_SPOOL_COMMAND_OTHER }, - /* crossplatform spoolers */ - { "cups", LIST_QUEUES_SYSV, DEFAULT_SPOOL_COMMAND_SYSV }, - { "lprng", LIST_QUEUES_BSD, DEFAULT_SPOOL_COMMAND_BSD }, - /* misc */ - { "other", LIST_QUEUES_OTHER, DEFAULT_SPOOL_COMMAND_OTHER }, - { "none", NULL, NULL }, - { NULL, NULL, NULL } -}; - -/* Used by Init.c and attributes.c */ -XpSpoolerTypePtr spooler_type = NULL; - -XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name) -{ - XpSpoolerTypePtr curr = xpstm; - - while( curr->name != NULL ) - { - if( !strcasecmp(name, curr->name) ) - return curr; - - curr++; - } - - return NULL; -} - -static char *spooler_namelist = NULL; - -char *XpGetSpoolerTypeNameList(void) -{ - if( spooler_namelist ) - return spooler_namelist; - - return XPDEFAULTSPOOLERNAMELIST; -} - -void XpSetSpoolerTypeNameList(char *namelist) -{ - spooler_namelist = namelist; -} - - diff --git a/hw/xprint/spooler.h b/hw/xprint/spooler.h deleted file mode 100644 index 4e056ceeb..000000000 --- a/hw/xprint/spooler.h +++ /dev/null @@ -1,75 +0,0 @@ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef SPOOLER_H -#define SPOOLER_H 1 - -/* -Copyright (c) 2003-2004 Roland Mainz <roland.mainz@nrubsig.org> - -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 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. - -Except as contained in this notice, the names of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from said -copyright holders. -*/ - -/* - * Define platform-specific default spooler type - */ -#if defined(sun) -#define XPDEFAULTSPOOLERNAMELIST "solaris" -#elif defined(AIXV4) -#define XPDEFAULTSPOOLERNAMELIST "aix4" -#elif defined(hpux) -#define XPDEFAULTSPOOLERNAMELIST "hpux" -#elif defined(__osf__) -#define XPDEFAULTSPOOLERNAMELIST "osf" -#elif defined(__uxp__) -#define XPDEFAULTSPOOLERNAMELIST "uxp" -#elif defined(CSRG_BASED) || defined(linux) -/* ToDo: This should be "cups:bsd" in the future, but for now - * the search order first-bsd-then-cups is better for backwards - * compatibility. - */ -#define XPDEFAULTSPOOLERNAMELIST "bsd:cups" -#else -#define XPDEFAULTSPOOLERNAMELIST "other" -#endif - -typedef struct -{ - const char *name; - const char *list_queues_command; - const char *spool_command; -} XpSpoolerType, *XpSpoolerTypePtr; - -/* prototypes */ -extern XpSpoolerTypePtr XpSpoolerNameToXpSpoolerType(char *name); -extern void XpSetSpoolerTypeNameList(char *namelist); -extern char *XpGetSpoolerTypeNameList(void); - -/* global vars */ -extern XpSpoolerTypePtr spooler_type; -extern XpSpoolerType xpstm[]; - -#endif /* !SPOOLER_H */ - diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am index b2674be4f..cc39c9da1 100644 --- a/hw/xquartz/Makefile.am +++ b/hw/xquartz/Makefile.am @@ -8,13 +8,9 @@ AM_CPPFLAGS = \ -DUSE_NEW_CLUT \ -DXFree86Server \ -I$(top_srcdir)/miext/rootless +# -DNEW_LAUNCH_METHOD -if X11APP -X11APP_SUBDIRS = bundle -endif - -SUBDIRS = . GL xpr $(X11APP_SUBDIRS) -DIST_SUBDIRS = GL xpr bundle +SUBDIRS = bundle . GL xpr mach-startup doc libXquartz_la_SOURCES = \ $(top_srcdir)/fb/fbcmap_mi.c \ diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 646b9ef12..d687c1f5f 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -38,12 +38,16 @@ #import "X11Application.h" -# include "darwin.h" -# include "darwinEvents.h" -# include "quartz.h" -# define _APPLEWM_SERVER_ -# include "X11/extensions/applewm.h" -# include "micmap.h" +#include "darwin.h" +#include "darwinEvents.h" +#include "quartz.h" +#define _APPLEWM_SERVER_ +#include "X11/extensions/applewm.h" +#include "micmap.h" + +#include "os.h" +#include "mach-startup/launchd_fd.h" + #include <mach/mach.h> #include <unistd.h> @@ -59,11 +63,9 @@ int X11EnableKeyEquivalents = TRUE; int quartzHasRoot = FALSE, quartzEnableRootless = TRUE; -extern int darwinFakeButtons, input_check_flag; +extern int darwinFakeButtons; extern Bool enable_stereo; -extern xEvent *darwinEvents; - X11Application *X11App; #define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask) @@ -143,18 +145,21 @@ static void message_kit_thread (SEL selector, NSObject *arg) { NSMutableDictionary *dict; NSDictionary *infoDict; NSString *tem; - - dict = [NSMutableDictionary dictionaryWithCapacity:2]; + + dict = [NSMutableDictionary dictionaryWithCapacity:3]; infoDict = [[NSBundle mainBundle] infoDictionary]; - + [dict setObject: NSLocalizedString (@"The X Window System", @"About panel") - forKey:@"ApplicationName"]; - + forKey:@"ApplicationName"]; + tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - - [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] - forKey:@"ApplicationVersion"]; - + + [dict setObject:[NSString stringWithFormat:@"XQuartz %@", tem] + forKey:@"ApplicationVersion"]; + + [dict setObject:[NSString stringWithFormat:@"xorg-server %s", XSERVER_VERSION] + forKey:@"Version"]; + [self orderFrontStandardAboutPanelWithOptions: dict]; } @@ -809,6 +814,14 @@ void X11ApplicationMain (int argc, char **argv, char **envp) { /* Tell the server thread that it can proceed */ QuartzInitServer(argc, argv, envp); + +#ifndef NEW_LAUNCH_METHOD + /* Start listening on the launchd fd */ + int launchd_fd = launchd_display_fd(); + if(launchd_fd != -1) { + DarwinListenOnOpenFD(launchd_fd); + } +#endif [NSApp run]; /* not reached */ @@ -839,7 +852,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) { int pointer_x, pointer_y, ev_button, ev_type; float pressure, tilt_x, tilt_y; - /* convert location to global top-left coordinates */ + /* convert location to be relative to top-left of primary display */ location = [e locationInWindow]; window = [e window]; screen = [[[NSScreen screens] objectAtIndex:0] frame]; diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index df328f38c..107d8ee9b 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -42,6 +42,7 @@ #include "opaque.h" #include "darwin.h" +#include "darwinEvents.h" #include "quartz.h" #define _APPLEWM_SERVER_ #include "X11/extensions/applewm.h" diff --git a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib Binary files differdeleted file mode 100644 index 95420e4f7..000000000 --- a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib +++ /dev/null diff --git a/hw/xquartz/bundle/Info.plist b/hw/xquartz/bundle/Info.plist index 6ba02dda2..30bb3c891 100644 --- a/hw/xquartz/bundle/Info.plist +++ b/hw/xquartz/bundle/Info.plist @@ -19,7 +19,11 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>2.2.0</string> + <string>2.3.0</string> + <key>CFBundleVersion</key> + <string>2.3.0</string> + <key>CFBundleVersionString</key> + <string>2.3.0</string> <key>CFBundleSignature</key> <string>x11a</string> <key>CSResourcesFileMapped</key> diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am index 801fdc7d8..89d04c783 100644 --- a/hw/xquartz/bundle/Makefile.am +++ b/hw/xquartz/bundle/Makefile.am @@ -1,77 +1,271 @@ -bin_SCRIPTS = x11app - -.PHONY: x11app - -x11app: - xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)" - install-data-hook: - xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)" - -clean-local: - rm -rf build + ./mk_bundke.sh $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/X11.app resourcedir=$(libdir)/X11/xserver resource_DATA = Xquartz.plist EXTRA_DIST = \ - $(resource_DATA) \ + mk_bundke.sh \ Info.plist \ - X11.icns \ - bundle-main.c \ - X11.xcodeproj/project.pbxproj \ - Dutch.lproj/InfoPlist.strings \ - Dutch.lproj/Localizable.strings \ - Dutch.lproj/main.nib/keyedobjects.nib \ - English.lproj/InfoPlist.strings \ - English.lproj/Localizable.strings \ - English.lproj/main.nib/designable.nib \ - English.lproj/main.nib/keyedobjects.nib \ - French.lproj/InfoPlist.strings \ - French.lproj/Localizable.strings \ - French.lproj/main.nib/keyedobjects.nib \ - German.lproj/InfoPlist.strings \ - German.lproj/Localizable.strings \ - German.lproj/main.nib/keyedobjects.nib \ - Italian.lproj/InfoPlist.strings \ - Italian.lproj/Localizable.strings \ - Italian.lproj/main.nib/keyedobjects.nib \ - Japanese.lproj/InfoPlist.strings \ - Japanese.lproj/Localizable.strings \ - Japanese.lproj/main.nib/keyedobjects.nib \ - Spanish.lproj/InfoPlist.strings \ - Spanish.lproj/Localizable.strings \ - Spanish.lproj/main.nib/keyedobjects.nib \ - da.lproj/InfoPlist.strings \ - da.lproj/Localizable.strings \ - da.lproj/main.nib/keyedobjects.nib \ - fi.lproj/InfoPlist.strings \ - fi.lproj/Localizable.strings \ - fi.lproj/main.nib/keyedobjects.nib \ - ko.lproj/InfoPlist.strings \ - ko.lproj/Localizable.strings \ - ko.lproj/main.nib/keyedobjects.nib \ - no.lproj/InfoPlist.strings \ - no.lproj/Localizable.strings \ - no.lproj/main.nib/keyedobjects.nib \ - pl.lproj/InfoPlist.strings \ - pl.lproj/Localizable.strings \ - pl.lproj/main.nib/keyedobjects.nib \ - pt.lproj/InfoPlist.strings \ - pt.lproj/Localizable.strings \ - pt.lproj/main.nib/keyedobjects.nib \ - pt_PT.lproj/InfoPlist.strings \ - pt_PT.lproj/Localizable.strings \ - pt_PT.lproj/main.nib/keyedobjects.nib \ - ru.lproj/InfoPlist.strings \ - ru.lproj/Localizable.strings \ - ru.lproj/main.nib/keyedobjects.nib \ - sv.lproj/InfoPlist.strings \ - sv.lproj/Localizable.strings \ - sv.lproj/main.nib/keyedobjects.nib \ - zh_CN.lproj/InfoPlist.strings \ - zh_CN.lproj/Localizable.strings \ - zh_CN.lproj/main.nib/keyedobjects.nib \ - zh_TW.lproj/InfoPlist.strings \ - zh_TW.lproj/Localizable.strings \ - zh_TW.lproj/main.nib/keyedobjects.nib + PkgInfo \ + $(resource_DATA) \ + Resources/da.lproj/InfoPlist.strings \ + Resources/da.lproj/Localizable.strings \ + Resources/da.lproj/main.nib/keyedobjects.nib \ + Resources/Dutch.lproj/InfoPlist.strings \ + Resources/Dutch.lproj/Localizable.strings \ + Resources/Dutch.lproj/main.nib/keyedobjects.nib \ + Resources/English.lproj/InfoPlist.strings \ + Resources/English.lproj/Localizable.strings \ + Resources/English.lproj/main.nib/designable.nib \ + Resources/English.lproj/main.nib/keyedobjects.nib \ + Resources/fi.lproj/InfoPlist.strings \ + Resources/fi.lproj/Localizable.strings \ + Resources/fi.lproj/main.nib/keyedobjects.nib \ + Resources/French.lproj/InfoPlist.strings \ + Resources/French.lproj/Localizable.strings \ + Resources/French.lproj/main.nib/keyedobjects.nib \ + Resources/German.lproj/InfoPlist.strings \ + Resources/German.lproj/Localizable.strings \ + Resources/German.lproj/main.nib/keyedobjects.nib \ + Resources/Italian.lproj/InfoPlist.strings \ + Resources/Italian.lproj/Localizable.strings \ + Resources/Italian.lproj/main.nib/keyedobjects.nib \ + Resources/Japanese.lproj/InfoPlist.strings \ + Resources/Japanese.lproj/Localizable.strings \ + Resources/Japanese.lproj/main.nib/keyedobjects.nib \ + Resources/ko.lproj/InfoPlist.strings \ + Resources/ko.lproj/Localizable.strings \ + Resources/ko.lproj/main.nib/keyedobjects.nib \ + Resources/no.lproj/InfoPlist.strings \ + Resources/no.lproj/Localizable.strings \ + Resources/no.lproj/main.nib/keyedobjects.nib \ + Resources/pl.lproj/InfoPlist.strings \ + Resources/pl.lproj/Localizable.strings \ + Resources/pl.lproj/main.nib/keyedobjects.nib \ + Resources/pt.lproj/InfoPlist.strings \ + Resources/pt.lproj/Localizable.strings \ + Resources/pt.lproj/main.nib/keyedobjects.nib \ + Resources/pt_PT.lproj/InfoPlist.strings \ + Resources/pt_PT.lproj/Localizable.strings \ + Resources/pt_PT.lproj/main.nib/keyedobjects.nib \ + Resources/ru.lproj/InfoPlist.strings \ + Resources/ru.lproj/Localizable.strings \ + Resources/ru.lproj/main.nib/keyedobjects.nib \ + Resources/Spanish.lproj/InfoPlist.strings \ + Resources/Spanish.lproj/Localizable.strings \ + Resources/Spanish.lproj/main.nib/keyedobjects.nib \ + Resources/sv.lproj/InfoPlist.strings \ + Resources/sv.lproj/Localizable.strings \ + Resources/sv.lproj/main.nib/keyedobjects.nib \ + Resources/X11.icns \ + Resources/zh_CN.lproj/InfoPlist.strings \ + Resources/zh_CN.lproj/Localizable.strings \ + Resources/zh_CN.lproj/main.nib/keyedobjects.nib \ + Resources/zh_TW.lproj/InfoPlist.strings \ + Resources/zh_TW.lproj/Localizable.strings \ + Resources/zh_TW.lproj/main.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h \ + Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h \ + Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h \ + Sparkle.framework/Versions/A/Headers/NSString+extras.h \ + Sparkle.framework/Versions/A/Headers/RSS.h \ + Sparkle.framework/Versions/A/Headers/Sparkle.h \ + Sparkle.framework/Versions/A/Headers/SUAppcast.h \ + Sparkle.framework/Versions/A/Headers/SUAppcastItem.h \ + Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h \ + Sparkle.framework/Versions/A/Headers/SUConstants.h \ + Sparkle.framework/Versions/A/Headers/SUStatusChecker.h \ + Sparkle.framework/Versions/A/Headers/SUStatusController.h \ + Sparkle.framework/Versions/A/Headers/SUUnarchiver.h \ + Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h \ + Sparkle.framework/Versions/A/Headers/SUUpdater.h \ + Sparkle.framework/Versions/A/Headers/SUUtilities.h \ + Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/cy.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/hu.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/id.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/Info.plist \ + Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/no.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/classes.nib \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/info.nib \ + Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/keyedobjects.nib \ + Sparkle.framework/Versions/A/Sparkle + diff --git a/hw/xquartz/bundle/PkgInfo b/hw/xquartz/bundle/PkgInfo new file mode 100644 index 000000000..b8e0aec42 --- /dev/null +++ b/hw/xquartz/bundle/PkgInfo @@ -0,0 +1 @@ +APPLx11a
\ No newline at end of file diff --git a/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/Dutch.lproj/InfoPlist.strings Binary files differindex 8f978d63f..8f978d63f 100644 --- a/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/Dutch.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Dutch.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings Binary files differindex 1ff39fe67..1ff39fe67 100644 --- a/hw/xquartz/bundle/Dutch.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/Dutch.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib Binary files differindex 95c26d7b3..95c26d7b3 100644 --- a/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/Dutch.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/English.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/English.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/hw/xquartz/bundle/English.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/English.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings Binary files differindex 63a135255..63a135255 100644 --- a/hw/xquartz/bundle/English.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib index c159d6ee1..c93d02372 100644 --- a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib +++ b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib @@ -66,6 +66,14 @@ <reference key="NSOnImage" ref="531645050"/> <reference key="NSMixedImage" ref="351811234"/> </object> + <object class="NSMenuItem" id="858487910"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Check for updates...</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> <object class="NSMenuItem" id="272876017"> <reference key="NSMenu" ref="576521955"/> <bool key="NSIsDisabled">YES</bool> @@ -1500,6 +1508,9 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <string key="NSName"/> </object> + <object class="NSCustomObject" id="556755705"> + <string key="NSClassName">SUUpdater</string> + </object> </object> <object class="IBObjectContainer" key="IBDocument.Objects"> <object class="NSMutableArray" key="connectionRecords"> @@ -2000,6 +2011,14 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> <int key="connectionID">300394</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">checkForUpdates:</string> + <reference key="source" ref="556755705"/> + <reference key="destination" ref="858487910"/> + </object> + <int key="connectionID">300397</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -2136,6 +2155,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference ref="1023546148"/> <reference ref="6876565"/> <reference ref="479677589"/> + <reference ref="858487910"/> </object> <reference key="parent" ref="365880285"/> </object> @@ -3050,6 +3070,17 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <reference key="object" ref="989804990"/> <reference key="parent" ref="57161931"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">300395</int> + <reference key="object" ref="556755705"/> + <reference key="parent" ref="330408435"/> + <string key="objectName">Updater</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300396</int> + <reference key="object" ref="858487910"/> + <reference key="parent" ref="576521955"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -3121,7 +3152,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>244.IBWindowTemplateEditedContentRect</string> <string>244.ImportedFromIB2</string> <string>244.editorWindowContentRectSynchronizationRect</string> - <string>244.lastResizeAction</string> <string>244.windowTemplate.hasMaxSize</string> <string>244.windowTemplate.hasMinSize</string> <string>244.windowTemplate.maxSize</string> @@ -3142,7 +3172,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>285.IBWindowTemplateEditedContentRect</string> <string>285.ImportedFromIB2</string> <string>285.editorWindowContentRectSynchronizationRect</string> - <string>285.lastResizeAction</string> <string>285.windowTemplate.hasMaxSize</string> <string>285.windowTemplate.hasMinSize</string> <string>285.windowTemplate.maxSize</string> @@ -3188,6 +3217,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>300368.ImportedFromIB2</string> <string>300370.IBPluginDependency</string> <string>300370.ImportedFromIB2</string> + <string>300395.IBPluginDependency</string> + <string>300396.IBPluginDependency</string> <string>305.IBPluginDependency</string> <string>305.ImportedFromIB2</string> <string>310.IBPluginDependency</string> @@ -3368,19 +3399,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>{{313, 353}, {484, 280}}</string> <reference ref="9"/> <string>{{184, 290}, {481, 345}}</string> - <object class="NSDictionary"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>IBResizeActionFinalFrame</string> - <string>IBResizeActionInitialFrame</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>{{182, 481}, {484, 280}}</string> - <string>{{182, 103}, {536, 658}}</string> - </object> - </object> <reference ref="9"/> <reference ref="9"/> <string>{3.40282e+38, 3.40282e+38}</string> @@ -3401,19 +3419,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>{{407, 545}, {454, 311}}</string> <reference ref="9"/> <string>{{433, 406}, {486, 327}}</string> - <object class="NSDictionary"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSMutableArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>IBResizeActionFinalFrame</string> - <string>IBResizeActionInitialFrame</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>{{537, 554}, {454, 311}}</string> - <string>{{537, 576}, {471, 289}}</string> - </object> - </object> <integer value="0"/> <reference ref="9"/> <string>{3.40282e+38, 3.40282e+38}</string> @@ -3460,6 +3465,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <reference ref="9"/> @@ -3593,7 +3600,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> <nil key="sourceID"/> - <int key="maxID">300394</int> + <int key="maxID">300397</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -3624,6 +3631,18 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="IBPartialClassDescription"> + <string key="className">SUUpdater</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">checkForUpdates:</string> + <string key="NS.object.0">id</string> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBDocumentRelativeSource</string> + <string key="minorKey">../Sparkle.framework/Versions/A/Headers/SUUpdater.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">X11Controller</string> <string key="superclassName">NSObject</string> <object class="NSMutableDictionary" key="actions"> @@ -3728,7 +3747,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> <int key="IBDocument.localizationMode">0</int> - <nil key="IBDocument.LastKnownRelativeProjectPath"/> + <string key="IBDocument.LastKnownRelativeProjectPath">../X11.xcodeproj</string> <int key="IBDocument.defaultPropertyAccessControl">3</int> </data> </archive> diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..066fdbe9e --- /dev/null +++ b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/French.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/French.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/hw/xquartz/bundle/French.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/French.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/French.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings Binary files differindex 2770dfb8c..2770dfb8c 100644 --- a/hw/xquartz/bundle/French.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/French.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib Binary files differindex 9f9a7da67..9f9a7da67 100644 --- a/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/French.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/German.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/German.lproj/InfoPlist.strings Binary files differindex aa37e7555..aa37e7555 100644 --- a/hw/xquartz/bundle/German.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/German.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/German.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings Binary files differindex a5489ab5c..a5489ab5c 100644 --- a/hw/xquartz/bundle/German.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/German.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib Binary files differindex 19532a9c2..19532a9c2 100644 --- a/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/German.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/Italian.lproj/InfoPlist.strings Binary files differindex 412169880..412169880 100644 --- a/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/Italian.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Italian.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings Binary files differindex d05d73d44..d05d73d44 100644 --- a/hw/xquartz/bundle/Italian.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/Italian.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib Binary files differindex b6e2e1bb1..b6e2e1bb1 100644 --- a/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/Italian.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/Japanese.lproj/InfoPlist.strings Binary files differindex 2d6330fa7..2d6330fa7 100644 --- a/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/Japanese.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Japanese.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings Binary files differindex 99821ea1f..99821ea1f 100644 --- a/hw/xquartz/bundle/Japanese.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/Japanese.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib Binary files differindex 523fd0856..523fd0856 100644 --- a/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/Japanese.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/Spanish.lproj/InfoPlist.strings Binary files differindex 0e4287d14..0e4287d14 100644 --- a/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/Spanish.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Spanish.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings Binary files differindex 652f432a5..652f432a5 100644 --- a/hw/xquartz/bundle/Spanish.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/Spanish.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib Binary files differindex 029349dd0..029349dd0 100644 --- a/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/Spanish.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Resources/X11.icns b/hw/xquartz/bundle/Resources/X11.icns Binary files differnew file mode 100644 index 000000000..d19cc6301 --- /dev/null +++ b/hw/xquartz/bundle/Resources/X11.icns diff --git a/hw/xquartz/bundle/da.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/da.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/hw/xquartz/bundle/da.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/da.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/da.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings Binary files differindex 9608a2e6b..9608a2e6b 100644 --- a/hw/xquartz/bundle/da.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/da.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib Binary files differindex 4a2bd4bde..4a2bd4bde 100644 --- a/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/da.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/fi.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/fi.lproj/InfoPlist.strings Binary files differindex 8e4f6474f..8e4f6474f 100644 --- a/hw/xquartz/bundle/fi.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/fi.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/fi.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings Binary files differindex e8420fbaa..e8420fbaa 100644 --- a/hw/xquartz/bundle/fi.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/fi.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib Binary files differindex b5039fd44..b5039fd44 100644 --- a/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/fi.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/ko.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/ko.lproj/InfoPlist.strings Binary files differindex 4c738f8b2..4c738f8b2 100644 --- a/hw/xquartz/bundle/ko.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/ko.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/ko.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings Binary files differindex 56a335859..56a335859 100644 --- a/hw/xquartz/bundle/ko.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/ko.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib Binary files differindex 925945c4d..925945c4d 100644 --- a/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/ko.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/no.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/no.lproj/InfoPlist.strings Binary files differindex eb1cfb002..eb1cfb002 100644 --- a/hw/xquartz/bundle/no.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/no.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/no.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings Binary files differindex 5157a67de..5157a67de 100644 --- a/hw/xquartz/bundle/no.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/no.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib Binary files differindex ca25327f5..ca25327f5 100644 --- a/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/no.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/pl.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/pl.lproj/InfoPlist.strings Binary files differindex b9c950214..b9c950214 100644 --- a/hw/xquartz/bundle/pl.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/pl.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/pl.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings Binary files differindex 4ae12d77f..4ae12d77f 100644 --- a/hw/xquartz/bundle/pl.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/pl.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib Binary files differindex e9ca5404b..e9ca5404b 100644 --- a/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/pl.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/pt.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/pt.lproj/InfoPlist.strings Binary files differindex 33c637448..33c637448 100644 --- a/hw/xquartz/bundle/pt.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/pt.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/pt.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings Binary files differindex 23ea96847..23ea96847 100644 --- a/hw/xquartz/bundle/pt.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/pt.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib Binary files differindex e88cccdba..e88cccdba 100644 --- a/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/pt.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/pt_PT.lproj/InfoPlist.strings Binary files differindex 33c637448..33c637448 100644 --- a/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/pt_PT.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings Binary files differindex 71c33ad14..71c33ad14 100644 --- a/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/pt_PT.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib Binary files differindex a61933475..a61933475 100644 --- a/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/pt_PT.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/ru.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/ru.lproj/InfoPlist.strings Binary files differindex 7f722e4b6..7f722e4b6 100644 --- a/hw/xquartz/bundle/ru.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/ru.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/ru.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings Binary files differindex 3b3811234..3b3811234 100644 --- a/hw/xquartz/bundle/ru.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/ru.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib Binary files differindex 9354e0264..9354e0264 100644 --- a/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/ru.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/sv.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/sv.lproj/InfoPlist.strings Binary files differindex 655d5ff63..655d5ff63 100644 --- a/hw/xquartz/bundle/sv.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/sv.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/sv.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings Binary files differindex 796f06c21..796f06c21 100644 --- a/hw/xquartz/bundle/sv.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/sv.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib Binary files differindex bd01c2dac..bd01c2dac 100644 --- a/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/sv.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/zh_CN.lproj/InfoPlist.strings Binary files differindex b5df36885..b5df36885 100644 --- a/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/zh_CN.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings Binary files differindex f88a6da4b..f88a6da4b 100644 --- a/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/zh_CN.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib Binary files differindex e36c15fb6..e36c15fb6 100644 --- a/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/zh_CN.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings b/hw/xquartz/bundle/Resources/zh_TW.lproj/InfoPlist.strings Binary files differindex 92d5473b0..92d5473b0 100644 --- a/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/Resources/zh_TW.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings Binary files differindex f009302c2..f009302c2 100644 --- a/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings +++ b/hw/xquartz/bundle/Resources/zh_TW.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib Binary files differindex 36602c53e..36602c53e 100644 --- a/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib +++ b/hw/xquartz/bundle/Resources/zh_TW.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Headers b/hw/xquartz/bundle/Sparkle.framework/Headers new file mode 120000 index 000000000..a177d2a6b --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Resources b/hw/xquartz/bundle/Sparkle.framework/Resources new file mode 120000 index 000000000..953ee36f3 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Sparkle b/hw/xquartz/bundle/Sparkle.framework/Sparkle new file mode 120000 index 000000000..b2c52731e --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Sparkle @@ -0,0 +1 @@ +Versions/Current/Sparkle
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h new file mode 100644 index 000000000..ee901e685 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSApplication+AppCopies.h @@ -0,0 +1,13 @@ +// +// NSApplication+AppCopies.h +// Sparkle +// +// Created by Andy Matuschak on 3/16/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +@interface NSApplication (SUAppCopies) +- (int)copiesRunning; +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h new file mode 100644 index 000000000..c995911ca --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSFileManager+Authentication.h @@ -0,0 +1,11 @@ +// +// NSFileManager+Authentication.m +// Sparkle +// +// Created by Andy Matuschak on 3/9/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +@interface NSFileManager (SUAuthenticationAdditions) +- (BOOL)movePathWithAuthentication:(NSString *)src toPath:(NSString *)dst; +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h new file mode 100644 index 000000000..f0ce7c20c --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSFileManager+Verification.h @@ -0,0 +1,15 @@ +// +// NSFileManager+Verification.h +// Sparkle +// +// Created by Andy Matuschak on 3/16/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +// For the paranoid folks! +@interface NSFileManager (SUVerification) +- (BOOL)validatePath:(NSString *)path withMD5Hash:(NSString *)hash; +- (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature; +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSString+extras.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSString+extras.h new file mode 100755 index 000000000..498e4d01c --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/NSString+extras.h @@ -0,0 +1,61 @@ +/* + +BSD License + +Copyright (c) 2002, Brent Simmons +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* 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. +* Neither the name of ranchero.com or Brent Simmons 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + + +*/ + + +/* + NSString+extras.h + NetNewsWire + + Created by Brent Simmons on Fri Jun 14 2002. + Copyright (c) 2002 Brent Simmons. All rights reserved. +*/ + + +#import <Foundation/Foundation.h> +#import <CoreFoundation/CoreFoundation.h> + + +@interface NSString (extras) + +- (NSString *)stringWithSubstitute:(NSString *)subs forCharactersFromSet:(NSCharacterSet *)set; + +- (NSString *) trimWhiteSpace; + +- (NSString *) stripHTML; + +- (NSString *) ellipsizeAfterNWords: (int) n; + ++ (BOOL) stringIsEmpty: (NSString *) s; + + +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/RSS.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/RSS.h new file mode 100755 index 000000000..82da04a44 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/RSS.h @@ -0,0 +1,98 @@ +/* + +BSD License + +Copyright (c) 2002, Brent Simmons +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* 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. +* Neither the name of ranchero.com or Brent Simmons 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. + + +*/ + +/* + RSS.h + A class for reading RSS feeds. + + Created by Brent Simmons on Wed Apr 17 2002. + Copyright (c) 2002 Brent Simmons. All rights reserved. +*/ + + +#import <Cocoa/Cocoa.h> +#import <CoreFoundation/CoreFoundation.h> +#import "NSString+extras.h" + + +@interface RSS : NSObject { + + NSDictionary *headerItems; + NSMutableArray *newsItems; + NSString *version; + + BOOL flRdf; + BOOL normalize; + } + + +/*Public*/ + +- (RSS *) initWithTitle: (NSString *) title andDescription: (NSString *) description; + +- (RSS *) initWithData: (NSData *) rssData normalize: (BOOL) fl; + +- (RSS *) initWithURL: (NSURL *) url normalize: (BOOL) fl; +- (RSS *) initWithURL: (NSURL *) url normalize: (BOOL) fl userAgent:(NSString *)userAgent; + +- (NSDictionary *) headerItems; + +- (NSMutableArray *) newsItems; + +- (NSString *) version; + +// AMM's extensions for Sparkle +- (NSDictionary *)newestItem; + + +/*Private*/ + +- (void) createheaderdictionary: (CFXMLTreeRef) tree; + +- (void) createitemsarray: (CFXMLTreeRef) tree; + +- (void) setversionstring: (CFXMLTreeRef) tree; + +- (void) flattenimagechildren: (CFXMLTreeRef) tree into: (NSMutableDictionary *) dictionary; + +- (void) flattensourceattributes: (CFXMLNodeRef) node into: (NSMutableDictionary *) dictionary; + +- (CFXMLTreeRef) getchanneltree: (CFXMLTreeRef) tree; + +- (CFXMLTreeRef) getnamedtree: (CFXMLTreeRef) currentTree name: (NSString *) name; + +- (void) normalizeRSSItem: (NSMutableDictionary *) rssItem; + +- (NSString *) getelementvalue: (CFXMLTreeRef) tree; + +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAppcast.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAppcast.h new file mode 100644 index 000000000..209fe2061 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAppcast.h @@ -0,0 +1,27 @@ +// +// SUAppcast.h +// Sparkle +// +// Created by Andy Matuschak on 3/12/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +@class RSS, SUAppcastItem; +@interface SUAppcast : NSObject { + NSArray *items; + id delegate; +} + +- (void)fetchAppcastFromURL:(NSURL *)url; +- (void)setDelegate:delegate; + +- (SUAppcastItem *)newestItem; +- (NSArray *)items; + +@end + +@interface NSObject (SUAppcastDelegate) +- appcastDidFinishLoading:(SUAppcast *)appcast; +@end
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h new file mode 100644 index 000000000..c0202e3d9 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAppcastItem.h @@ -0,0 +1,57 @@ +// +// SUAppcastItem.h +// Sparkle +// +// Created by Andy Matuschak on 3/12/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + + +@interface SUAppcastItem : NSObject { + NSString *title; + NSDate *date; + NSString *description; + + NSURL *releaseNotesURL; + + NSString *DSASignature; + NSString *MD5Sum; + + NSURL *fileURL; + NSString *fileVersion; + NSString *versionString; +} + +// Initializes with data from a dictionary provided by the RSS class. +- initWithDictionary:(NSDictionary *)dict; + +- (NSString *)title; +- (void)setTitle:(NSString *)aTitle; + +- (NSDate *)date; +- (void)setDate:(NSDate *)aDate; + +- (NSString *)description; +- (void)setDescription:(NSString *)aDescription; + +- (NSURL *)releaseNotesURL; +- (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL; + +- (NSString *)DSASignature; +- (void)setDSASignature:(NSString *)aDSASignature; + +- (NSString *)MD5Sum; +- (void)setMD5Sum:(NSString *)aMd5Sum; + +- (NSURL *)fileURL; +- (void)setFileURL:(NSURL *)aFileURL; + +- (NSString *)fileVersion; +- (void)setFileVersion:(NSString *)aFileVersion; + +- (NSString *)versionString; +- (void)setVersionString:(NSString *)versionString; + +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h new file mode 100644 index 000000000..fc0ac9fd0 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUAutomaticUpdateAlert.h @@ -0,0 +1,21 @@ +// +// SUAutomaticUpdateAlert.h +// Sparkle +// +// Created by Andy Matuschak on 3/18/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +@class SUAppcastItem; +@interface SUAutomaticUpdateAlert : NSWindowController { + SUAppcastItem *updateItem; +} + +- initWithAppcastItem:(SUAppcastItem *)item; + +- (IBAction)relaunchNow:sender; +- (IBAction)relaunchLater:sender; + +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUConstants.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUConstants.h new file mode 100644 index 000000000..bfbe625bb --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUConstants.h @@ -0,0 +1,20 @@ +// +// SUConstants.h +// Sparkle +// +// Created by Andy Matuschak on 3/16/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +extern NSString *SUUpdaterWillRestartNotification; + +extern NSString *SUCheckAtStartupKey; +extern NSString *SUFeedURLKey; +extern NSString *SUShowReleaseNotesKey; +extern NSString *SUSkippedVersionKey; +extern NSString *SUScheduledCheckIntervalKey; +extern NSString *SULastCheckTimeKey; +extern NSString *SUExpectsDSASignatureKey; +extern NSString *SUPublicDSAKeyKey; +extern NSString *SUAutomaticallyUpdateKey; +extern NSString *SUAllowsAutomaticUpdatesKey;
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h new file mode 100644 index 000000000..e83d15206 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUStatusChecker.h @@ -0,0 +1,26 @@ +// +// SUStatusChecker.h +// Sparkle +// +// Created by Evan Schoenberg on 7/6/06. +// + +#import <Cocoa/Cocoa.h> +#import <Sparkle/SUUpdater.h> + +@class SUStatusChecker; + +@protocol SUStatusCheckerDelegate <NSObject> +//versionString will be nil and isNewVersion will be NO if version checking fails. +- (void)statusChecker:(SUStatusChecker *)statusChecker foundVersion:(NSString *)versionString isNewVersion:(BOOL)isNewVersion; +@end + +@interface SUStatusChecker : SUUpdater { + id<SUStatusCheckerDelegate> scDelegate; +} + +// Create a status checker which will notifiy delegate once the appcast version is determined. +// Notification occurs via the method defined in the SUStatusCheckerDelegate informal protocol. ++ (SUStatusChecker *)statusCheckerForDelegate:(id<SUStatusCheckerDelegate>)delegate; + +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUStatusController.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUStatusController.h new file mode 100644 index 000000000..19a3f89ec --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUStatusController.h @@ -0,0 +1,33 @@ +// +// SUStatusController.h +// Sparkle +// +// Created by Andy Matuschak on 3/14/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + + +@interface SUStatusController : NSWindowController { + double progressValue, maxProgressValue; + NSString *title, *statusText, *buttonTitle; + IBOutlet NSButton *actionButton; +} + +// Pass 0 for the max progress value to get an indeterminate progress bar. +// Pass nil for the status text to not show it. +- (void)beginActionWithTitle:(NSString *)title maxProgressValue:(double)maxProgressValue statusText:(NSString *)statusText; + +// If isDefault is YES, the button's key equivalent will be \r. +- (void)setButtonTitle:(NSString *)buttonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault; +- (void)setButtonEnabled:(BOOL)enabled; + +- (double)progressValue; +- (void)setProgressValue:(double)value; +- (double)maxProgressValue; +- (void)setMaxProgressValue:(double)value; + +- (void)setStatusText:(NSString *)statusText; + +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h new file mode 100644 index 000000000..da111c158 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUnarchiver.h @@ -0,0 +1,25 @@ +// +// SUUnarchiver.h +// Sparkle +// +// Created by Andy Matuschak on 3/16/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + + +@interface SUUnarchiver : NSObject { + id delegate; +} + +- (void)unarchivePath:(NSString *)path; +- (void)setDelegate:delegate; + +@end + +@interface NSObject (SUUnarchiverDelegate) +- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(long)length; +- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver; +- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver; +@end
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h new file mode 100644 index 000000000..69c281749 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUpdateAlert.h @@ -0,0 +1,40 @@ +// +// SUUpdateAlert.h +// Sparkle +// +// Created by Andy Matuschak on 3/12/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +typedef enum +{ + SUInstallUpdateChoice, + SURemindMeLaterChoice, + SUSkipThisVersionChoice +} SUUpdateAlertChoice; + +@class WebView, SUAppcastItem; +@interface SUUpdateAlert : NSWindowController { + SUAppcastItem *updateItem; + id delegate; + + IBOutlet WebView *releaseNotesView; + IBOutlet NSTextField *description; + NSProgressIndicator *releaseNotesSpinner; + BOOL webViewFinishedLoading; +} + +- initWithAppcastItem:(SUAppcastItem *)item; +- (void)setDelegate:delegate; + +- (IBAction)installUpdate:sender; +- (IBAction)skipThisVersion:sender; +- (IBAction)remindMeLater:sender; + +@end + +@interface NSObject (SUUpdateAlertDelegate) +- (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice; +@end diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUpdater.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUpdater.h new file mode 100644 index 000000000..5f82914bc --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUpdater.h @@ -0,0 +1,55 @@ +// +// SUUpdater.h +// Sparkle +// +// Created by Andy Matuschak on 1/4/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +// Before you use Sparkle in your app, you must set SUFeedURL in Info.plist to the +// address of the appcast on your webserver. If you don't already have an +// appcast, please see the Sparkle documentation to learn about how to set one up. + +// .zip, .dmg, .tar, .tbz, .tgz archives are supported at this time. + +// By default, Sparkle offers to show the user the release notes of the build they'll be +// getting, which it assumes are in the description (or body) field of the relevant RSS item. +// Set SUShowReleaseNotes to <false/> in Info.plist to hide the button. + +@class SUAppcastItem, SUUpdateAlert, SUStatusController; +@interface SUUpdater : NSObject { + SUAppcastItem *updateItem; + + SUStatusController *statusController; + SUUpdateAlert *updateAlert; + + NSURLDownload *downloader; + NSString *downloadPath; + + NSTimer *checkTimer; + NSTimeInterval checkInterval; + + BOOL verbose; + BOOL updateInProgress; +} + +// This IBAction is meant for a main menu item. Hook up any menu item to this action, +// and Sparkle will check for updates and report back its findings verbosely. +- (IBAction)checkForUpdates:sender; + +// This method is similar to the above, but it's intended for updates initiated by +// the computer instead of by the user. It does not alert the user when he is up to date, +// and it remains silent about network errors in fetching the feed. This is what you +// want to call to update programmatically; only use checkForUpdates: with buttons and menu items. +- (void)checkForUpdatesInBackground; + +// This method allows you to schedule a check to run every time interval. You can +// pass 0 to this method to cancel a previously scheduled timer. You probably don't want +// to call this directly: if you set a SUScheduledCheckInterval key in Info.plist or +// the user defaults, Sparkle will set this up for you automatically on startup. You might +// just want to call this every time the user changes the setting in the preferences. +- (void)scheduleCheckWithInterval:(NSTimeInterval)interval; + +@end
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUtilities.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUtilities.h new file mode 100644 index 000000000..5af355083 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/SUUtilities.h @@ -0,0 +1,20 @@ +// +// SUUtilities.h +// Sparkle +// +// Created by Andy Matuschak on 3/12/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import <Cocoa/Cocoa.h> + +id SUInfoValueForKey(NSString *key); +NSString *SUHostAppName(); +NSString *SUHostAppDisplayName(); +NSString *SUHostAppVersion(); +NSString *SUHostAppVersionString(); + +NSComparisonResult SUStandardVersionComparison(NSString * versionA, NSString * versionB); + +// If running make localizable-strings for genstrings, ignore the error on this line. +NSString *SULocalizedString(NSString *key, NSString *comment); diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/Sparkle.h b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/Sparkle.h new file mode 100644 index 000000000..13e9b2156 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Headers/Sparkle.h @@ -0,0 +1,22 @@ +// +// Sparkle.h +// Sparkle +// +// Created by Andy Matuschak on 3/16/06. +// Copyright 2006 Andy Matuschak. All rights reserved. +// + +#import "SUUpdater.h" +#import "SUUtilities.h" +#import "SUConstants.h" +#import "SUAppcast.h" +#import "SUAppcastItem.h" +#import "SUUpdateAlert.h" +#import "SUAutomaticUpdateAlert.h" +#import "SUStatusController.h" +#import "SUUnarchiver.h" +#import "SUStatusChecker.h" + +#import "NSApplication+AppCopies.h" +#import "NSFileManager+Authentication.h" +#import "NSFileManager+Verification.h"
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/Info.plist b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/Info.plist new file mode 100644 index 000000000..c154cb61e --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>Sparkle</string> + <key>CFBundleIdentifier</key> + <string>org.andymatuschak.Sparkle</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Sparkle</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.1</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib new file mode 100644 index 000000000..ff40c9ddf --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + CLASS = SUStatusController; + LANGUAGE = ObjC; + OUTLETS = {actionButton = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib new file mode 100644 index 000000000..99183444c --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>69 10 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8H14</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..378b22f2a --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/SUStatus.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..15daf3081 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..17f2f3de0 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..329426ca3 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ca.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..ac43a0cee --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..208496318 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..232852ca0 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..81c59b757 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/cy.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..d371ff21d --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..d51f9ad2e --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..f9790999d --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/da.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..0808fc651 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..aeec00876 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..92064db7f --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/de.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2f65f2f49 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8H14</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..c4201cf26 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..be3dbd906 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..6bf42f79b --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/en.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..236c082b7 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/es.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..e7f61432a --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..ac21bcba2 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..c52cf30ce --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fi.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..26ef48443 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>439.0</string> + <key>IBSystem Version</key> + <string>8J133</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..552a5bdd3 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..b0e7f7bd7 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 51 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>439.0</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8J133</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..0cd65e6c0 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..9cca1c370 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/fr.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..e4c7ba07d --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..af7bfbb25 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..60da7d5ee --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/he.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..4fbd2d684 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/hu.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..c815112f6 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/id.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..44b9da5f9 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..85c1567de --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/is.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..53fa5b319 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..0e8d6a6ae --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..7a5a38459 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/it.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..d31704664 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..f213cf3be --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>531 94 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..00b088dee --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..6c2e6eaea --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..aeb4628f8 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ko.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..26b2e8aff --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/nl.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..a28ff7a56 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>528 61 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..36947a7ba --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..2c989294d --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/no.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..6da4ab11d --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..dc2fbf34b --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..32c75670b --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/pl.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b2f8b50ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..7c8b8eae5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/ru.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..7a79f4dc1 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..13cdb318f --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..fd3ec529c --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sk.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..c4116cc62 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..9d3a515bc --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/sv.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..2b1c6e30e --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..08538d327 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/th.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..6e2046083 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..4f31fd758 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..c15c890fa --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/tr.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..082030262 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>136 94 356 240 0 0 1024 746 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..f165c1a80 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0071ac077 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {description = NSTextField; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..2b25ad033 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>425 40 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>446.1</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..0d56dd12c --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..9f7b3901e --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..3e65b1ff5 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/classes.nib @@ -0,0 +1,12 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {relaunchLater = id; relaunchNow = id; }; + CLASS = SUAutomaticUpdateAlert; + LANGUAGE = ObjC; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/info.nib new file mode 100644 index 000000000..5a7568096 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/info.nib @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>188 142 356 240 0 0 1280 1002 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b619eb4ab --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUAutomaticUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/classes.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/classes.nib new file mode 100644 index 000000000..0ac32ad75 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/classes.nib @@ -0,0 +1,21 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = NSObject; LANGUAGE = ObjC; }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlert; + LANGUAGE = ObjC; + OUTLETS = {delegate = id; description = id; releaseNotesView = WebView; }; + SUPERCLASS = NSWindowController; + }, + { + ACTIONS = {installUpdate = id; remindMeLater = id; skipThisVersion = id; }; + CLASS = SUUpdateAlertController; + LANGUAGE = ObjC; + OUTLETS = {releaseNotesView = id; }; + SUPERCLASS = NSWindowController; + } + ); + IBVersion = 1; +}
\ No newline at end of file diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/info.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/info.nib new file mode 100644 index 000000000..83a4377b3 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/info.nib @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IBDocumentLocation</key> + <string>62 61 356 240 0 0 1280 832 </string> + <key>IBFramework Version</key> + <string>443.0</string> + <key>IBOpenObjects</key> + <array> + <integer>5</integer> + </array> + <key>IBSystem Version</key> + <string>8I127</string> +</dict> +</plist> diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/keyedobjects.nib b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..9be94287a --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/SUUpdateAlert.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings Binary files differnew file mode 100644 index 000000000..a5486800d --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Resources/zh_TW.lproj/Sparkle.strings diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/A/Sparkle b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Sparkle Binary files differnew file mode 100755 index 000000000..9dbf9e7fa --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/A/Sparkle diff --git a/hw/xquartz/bundle/Sparkle.framework/Versions/Current b/hw/xquartz/bundle/Sparkle.framework/Versions/Current new file mode 120000 index 000000000..8c7e5a667 --- /dev/null +++ b/hw/xquartz/bundle/Sparkle.framework/Versions/Current @@ -0,0 +1 @@ +A
\ No newline at end of file diff --git a/hw/xquartz/bundle/X11.icns b/hw/xquartz/bundle/X11.icns Binary files differdeleted file mode 100644 index d770e617d..000000000 --- a/hw/xquartz/bundle/X11.icns +++ /dev/null diff --git a/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj b/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj deleted file mode 100644 index ae8ec07e6..000000000 --- a/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj +++ /dev/null @@ -1,458 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; }; - 527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; }; - 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; }; - 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; }; - 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; }; - 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; }; - 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; - 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E460D1B6C05005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E470D1B6C05005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E480D1B6C05005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E490D1B6C05005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4A0D1B6C05005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4B0D1B6C05005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4C0D1B6C05005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4D0D1B6C05005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4E0D1B6C05005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E4F0D1B6C05005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E500D1B6C05005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E510D1B6C05005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E520D1B6C05005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E530D1B6C05005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E540D1B6C05005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E550D1B6C05005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E560D1B6C05005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Localizable.strings; sourceTree = "<group>"; }; - 3FB03E570D1B6C17005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E580D1B6C17005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E590D1B6C17005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5A0D1B6C17005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5B0D1B6C17005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5C0D1B6C17005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5D0D1B6C17005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5E0D1B6C17005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E5F0D1B6C17005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E600D1B6C17005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E610D1B6C17005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E620D1B6C17005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E630D1B6C17005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E640D1B6C17005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E650D1B6C17005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E660D1B6C17005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E670D1B6C17005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 3FB03E680D1B6C34005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = da; path = da.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E690D1B6C34005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Dutch; path = Dutch.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6A0D1B6C34005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = fi; path = fi.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6B0D1B6C34005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = French; path = French.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6C0D1B6C34005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path = German.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6D0D1B6C34005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = Italian.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6E0D1B6C34005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E6F0D1B6C34005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ko; path = ko.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E700D1B6C34005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = no; path = no.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E710D1B6C34005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pl; path = pl.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E720D1B6C34005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt; path = pt.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E730D1B6C34005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt_PT; path = pt_PT.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E740D1B6C34005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ru; path = ru.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E750D1B6C34005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = Spanish.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E760D1B6C34005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sv; path = sv.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E770D1B6C34005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_CN; path = zh_CN.lproj/main.nib; sourceTree = "<group>"; }; - 3FB03E780D1B6C34005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_TW; path = zh_TW.lproj/main.nib; sourceTree = "<group>"; }; - 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; }; - 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; }; - 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; - 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; }; - 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 52D9C0EC0BCDDF6B00CD2AFC /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; }; - 570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 527F241E0B5D938C007840A7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */, - 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 195DF8CFFE9D517E11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 527F24270B5D938C007840A7 /* X11.app */, - ); - name = Products; - sourceTree = "<group>"; - }; - 20286C29FDCF999611CA2CEA /* X11 */ = { - isa = PBXGroup; - children = ( - 20286C2AFDCF999611CA2CEA /* Sources */, - 20286C2CFDCF999611CA2CEA /* Resources */, - 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */, - 195DF8CFFE9D517E11CA2CBB /* Products */, - 527F24260B5D938C007840A7 /* Info.plist */, - ); - name = X11; - sourceTree = "<group>"; - }; - 20286C2AFDCF999611CA2CEA /* Sources */ = { - isa = PBXGroup; - children = ( - 50EE2AB703849F0B0ECA21EC /* bundle-main.c */, - ); - name = Sources; - sourceTree = "<group>"; - }; - 20286C2CFDCF999611CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */, - 50459C5F038587C60ECA21EC /* X11.icns */, - 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */, - 02345980000FD03B11CA0E72 /* main.nib */, - ); - name = Resources; - sourceTree = "<group>"; - }; - 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */, - 570C5748047186C400ACF82F /* SystemConfiguration.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 527F24170B5D938C007840A7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 527F24160B5D938C007840A7 /* X11 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */; - buildPhases = ( - 527F24170B5D938C007840A7 /* Headers */, - 527F24180B5D938C007840A7 /* Resources */, - 527F241C0B5D938C007840A7 /* Sources */, - 527F241E0B5D938C007840A7 /* Frameworks */, - 527F24210B5D938C007840A7 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = X11; - productName = X11; - productReference = 527F24270B5D938C007840A7 /* X11.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 20286C28FDCF999611CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */; - compatibilityVersion = "Xcode 2.4"; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - da, - Dutch, - fi, - Italian, - ko, - no, - pl, - pt, - pt_PT, - ru, - Spanish, - sv, - zh_CN, - zh_TW, - ); - mainGroup = 20286C29FDCF999611CA2CEA /* X11 */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 527F24160B5D938C007840A7 /* X11 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 527F24180B5D938C007840A7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F24370B5D9D89007840A7 /* Info.plist in Resources */, - 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */, - 527F241A0B5D938C007840A7 /* main.nib in Resources */, - 527F241B0B5D938C007840A7 /* X11.icns in Resources */, - 52D9C0ED0BCDDF6B00CD2AFC /* Localizable.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 527F24210B5D938C007840A7 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 527F241C0B5D938C007840A7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 02345980000FD03B11CA0E72 /* main.nib */ = { - isa = PBXVariantGroup; - children = ( - 1870340FFE93FCAF11CA0CD7 /* English */, - 3FB03E680D1B6C34005958A5 /* da */, - 3FB03E690D1B6C34005958A5 /* Dutch */, - 3FB03E6A0D1B6C34005958A5 /* fi */, - 3FB03E6B0D1B6C34005958A5 /* French */, - 3FB03E6C0D1B6C34005958A5 /* German */, - 3FB03E6D0D1B6C34005958A5 /* Italian */, - 3FB03E6E0D1B6C34005958A5 /* Japanese */, - 3FB03E6F0D1B6C34005958A5 /* ko */, - 3FB03E700D1B6C34005958A5 /* no */, - 3FB03E710D1B6C34005958A5 /* pl */, - 3FB03E720D1B6C34005958A5 /* pt */, - 3FB03E730D1B6C34005958A5 /* pt_PT */, - 3FB03E740D1B6C34005958A5 /* ru */, - 3FB03E750D1B6C34005958A5 /* Spanish */, - 3FB03E760D1B6C34005958A5 /* sv */, - 3FB03E770D1B6C34005958A5 /* zh_CN */, - 3FB03E780D1B6C34005958A5 /* zh_TW */, - ); - name = main.nib; - sourceTree = "<group>"; - }; - 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 0867D6ABFE840B52C02AAC07 /* English */, - 3FB03E570D1B6C17005958A5 /* da */, - 3FB03E580D1B6C17005958A5 /* Dutch */, - 3FB03E590D1B6C17005958A5 /* fi */, - 3FB03E5A0D1B6C17005958A5 /* French */, - 3FB03E5B0D1B6C17005958A5 /* German */, - 3FB03E5C0D1B6C17005958A5 /* Italian */, - 3FB03E5D0D1B6C17005958A5 /* Japanese */, - 3FB03E5E0D1B6C17005958A5 /* ko */, - 3FB03E5F0D1B6C17005958A5 /* no */, - 3FB03E600D1B6C17005958A5 /* pl */, - 3FB03E610D1B6C17005958A5 /* pt */, - 3FB03E620D1B6C17005958A5 /* pt_PT */, - 3FB03E630D1B6C17005958A5 /* ru */, - 3FB03E640D1B6C17005958A5 /* Spanish */, - 3FB03E650D1B6C17005958A5 /* sv */, - 3FB03E660D1B6C17005958A5 /* zh_CN */, - 3FB03E670D1B6C17005958A5 /* zh_TW */, - ); - name = InfoPlist.strings; - sourceTree = "<group>"; - }; - 52D9C0EB0BCDDF6B00CD2AFC /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - 52D9C0EC0BCDDF6B00CD2AFC /* English */, - 3FB03E460D1B6C05005958A5 /* da */, - 3FB03E470D1B6C05005958A5 /* Dutch */, - 3FB03E480D1B6C05005958A5 /* fi */, - 3FB03E490D1B6C05005958A5 /* French */, - 3FB03E4A0D1B6C05005958A5 /* German */, - 3FB03E4B0D1B6C05005958A5 /* Italian */, - 3FB03E4C0D1B6C05005958A5 /* Japanese */, - 3FB03E4D0D1B6C05005958A5 /* ko */, - 3FB03E4E0D1B6C05005958A5 /* no */, - 3FB03E4F0D1B6C05005958A5 /* pl */, - 3FB03E500D1B6C05005958A5 /* pt */, - 3FB03E510D1B6C05005958A5 /* pt_PT */, - 3FB03E520D1B6C05005958A5 /* ru */, - 3FB03E530D1B6C05005958A5 /* Spanish */, - 3FB03E540D1B6C05005958A5 /* sv */, - 3FB03E550D1B6C05005958A5 /* zh_CN */, - 3FB03E560D1B6C05005958A5 /* zh_TW */, - ); - name = Localizable.strings; - sourceTree = "<group>"; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 527F24090B5D8FFC007840A7 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Development; - }; - 527F240A0B5D8FFC007840A7 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Deployment; - }; - 527F240B0B5D8FFC007840A7 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Default; - }; - 527F24230B5D938C007840A7 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /usr/X11; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Development; - }; - 527F24240B5D938C007840A7 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /usr/X11; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Deployment; - }; - 527F24250B5D938C007840A7 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /usr/X11; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 527F24090B5D8FFC007840A7 /* Development */, - 527F240A0B5D8FFC007840A7 /* Deployment */, - 527F240B0B5D8FFC007840A7 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 527F24230B5D938C007840A7 /* Development */, - 527F24240B5D938C007840A7 /* Deployment */, - 527F24250B5D938C007840A7 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 20286C28FDCF999611CA2CEA /* Project object */; -} diff --git a/hw/xquartz/bundle/bundle-main.c b/hw/xquartz/bundle/bundle-main.c deleted file mode 100644 index e97770a55..000000000 --- a/hw/xquartz/bundle/bundle-main.c +++ /dev/null @@ -1,136 +0,0 @@ -/* main.c -- X application launcher - - Copyright (c) 2007 Jeremy Huddleston - Copyright (c) 2007 Apple 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 ABOVE LISTED COPYRIGHT - HOLDER(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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ - -#include <X11/Xlib.h> -#include <unistd.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include <CoreFoundation/CoreFoundation.h> - -#define DEFAULT_CLIENT "/usr/X11/bin/xterm" -#define DEFAULT_STARTX "/usr/X11/bin/startx" -#define DEFAULT_SHELL "/bin/sh" - -static int execute(const char *command); -static char *command_from_prefs(const char *key, const char *default_value); - -int main(int argc, char **argv) { - Display *display; - const char *s; - - size_t i; - fprintf(stderr, "X11.app: main(): argc=%d\n", argc); - for(i=0; i < argc; i++) { - fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); - } - - /* If we have a process serial number and it's our only arg, act as if - * the user double clicked the app bundle: launch app_to_run if possible - */ - if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { - /* Now, try to open a display, if so, run the launcher */ - display = XOpenDisplay(NULL); - if(display) { - fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n"); - /* Could open the display, start the launcher */ - XCloseDisplay(display); - - /* Give 2 seconds for the server to start... - * TODO: *Really* fix this race condition - */ - usleep(2000); - return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); - } - } - - /* Start the server */ - if(s = getenv("DISPLAY")) { - fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); - unsetenv("DISPLAY"); - } else { - fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); - } - return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); -} - -static int execute(const char *command) { - const char *newargv[7]; - const char **s; - - newargv[0] = "/usr/bin/login"; - newargv[1] = "-fp"; - newargv[2] = getlogin(); - newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL); - newargv[4] = "-c"; - newargv[5] = command; - newargv[6] = NULL; - - fprintf(stderr, "X11.app: Launching %s:\n", command); - for(s=newargv; *s; s++) { - fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); - } - - execvp (newargv[0], (char * const *) newargv); - perror ("X11.app: Couldn't exec."); - return(1); -} - -static char *command_from_prefs(const char *key, const char *default_value) { - char *command = NULL; - - CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); - CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); - - if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { - CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); - - CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); - CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); - - int len = strlen(default_value) + 1; - command = (char *)malloc(len * sizeof(char)); - if(!command) - return NULL; - strcpy(command, default_value); - } else { - int len = CFStringGetLength((CFStringRef)PlistRef) + 1; - command = (char *)malloc(len * sizeof(char)); - if(!command) - return NULL; - CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); - } - - if (PlistRef) - CFRelease(PlistRef); - - return command; -} diff --git a/hw/xquartz/bundle/mk_bundke.sh b/hw/xquartz/bundle/mk_bundke.sh new file mode 100755 index 000000000..0b2a14433 --- /dev/null +++ b/hw/xquartz/bundle/mk_bundke.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 'Cause xcodebuild is hard to deal with + +BUNDLE_ROOT=$1 + +localities="Dutch English French German Italian Japanese Spanish da fi ko no pl pt pt_PT ru sv zh_CN zh_TW" +for lang in ${localities} ; do + mkdir -p ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib + [ -d ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/main.nib ] || exit 1 + + for f in InfoPlist.strings Localizable.strings main.nib/keyedobjects.nib ; do + install -m 644 Resources/${lang}.lproj/$f ${BUNDLE_ROOT}/Contents/Resources/${lang}.lproj/${f} + done +done + +install -m 644 Resources/English.lproj/main.nib//designable.nib ${BUNDLE_ROOT}/Contents/Resources/English.lproj/main.nib +install -m 644 Resources/X11.icns ${BUNDLE_ROOT}/Contents/Resources + +install -m 644 Info.plist ${BUNDLE_ROOT}/Contents +install -m 644 PkgInfo ${BUNDLE_ROOT}/Contents + +if [[ $(id -u) == 0 ]] ; then + chown -R root:admin ${BUNDLE_ROOT} +fi diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index b2e81bd2f..79f82c6e7 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -151,7 +151,6 @@ DarwinPrintBanner(void) { // this should change depending on which specific server we are building ErrorF("Xquartz starting:\n"); - ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages. ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE ); } diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 7b3091d40..0ecb064c4 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -45,6 +45,7 @@ in this Software without prior written authorization from The Open Group. #include "mi.h" #include "scrnintstr.h" #include "mipointer.h" +#include "os.h" #include "darwin.h" #include "quartz.h" @@ -76,27 +77,24 @@ in this Software without prior written authorization from The Open Group. /* FIXME: Abstract this better */ void QuartzModeEQInit(void); -int input_check_zero, input_check_flag; - static int old_flags = 0; // last known modifier state -xEvent *darwinEvents = NULL; - -pthread_mutex_t mieqEnqueue_mutex = PTHREAD_MUTEX_INITIALIZER; +static xEvent *darwinEvents = NULL; +static pthread_mutex_t darwinEvents_mutex = PTHREAD_MUTEX_INITIALIZER; -static inline void mieqEnqueue_lock(void) { +static inline void darwinEvents_lock(void) { int err; - if((err = pthread_mutex_lock(&mieqEnqueue_mutex))) { - ErrorF("%s:%s:%d: Failed to lock mieqEnqueue_mutex: %d\n", + if((err = pthread_mutex_lock(&darwinEvents_mutex))) { + ErrorF("%s:%s:%d: Failed to lock darwinEvents_mutex: %d\n", __FILE__, __FUNCTION__, __LINE__, err); spewCallStack(); } } -static inline void mieqEnqueue_unlock(void) { +static inline void darwinEvents_unlock(void) { int err; - if((err = pthread_mutex_unlock(&mieqEnqueue_mutex))) { - ErrorF("%s:%s:%d: Failed to unlock mieqEnqueue_mutex: %d\n", + if((err = pthread_mutex_unlock(&darwinEvents_mutex))) { + ErrorF("%s:%s:%d: Failed to unlock darwinEvents_mutex: %d\n", __FILE__, __FUNCTION__, __LINE__, err); spewCallStack(); } @@ -217,6 +215,15 @@ 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; i<nevents; i++) { + ListenOnOpenFD(xe[i].u.clientMessage.u.l.longs0); + } +} + /* Generic handler for Xquartz-specifc events. When possible, these should be moved into their own individual functions and set as handlers using mieqSetHandler. */ @@ -308,11 +315,6 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in } Bool DarwinEQInit(void) { - if (!darwinEvents) - darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!darwinEvents) - FatalError("Couldn't allocate event buffer\n"); - mieqInit(); mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler); mieqSetHandler(kXquartzActivate, DarwinEventHandler); @@ -327,8 +329,14 @@ Bool DarwinEQInit(void) { mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler); mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler); mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler); - + mieqSetHandler(kXquartzListenOnOpenFD, kXquartzListenOnOpenFDHandler); + QuartzModeEQInit(); + + if (!darwinEvents) + darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + if (!darwinEvents) + FatalError("Couldn't allocate event buffer\n"); return TRUE; } @@ -355,33 +363,59 @@ void ProcessInputEvents(void) { Dispatch() event loop to check out event queue */ static void DarwinPokeEQ(void) { char nullbyte=0; - input_check_flag++; // <daniels> oh, i ... er ... christ. write(darwinEventWriteFD, &nullbyte, 1); } +/* Convert from Appkit pointer input values to X input values: + * Note: pointer_x and pointer_y are relative to the upper-left of primary + * display. + */ +static void DarwinPrepareValuators(int *valuators, ScreenPtr screen, + int pointer_x, int pointer_y, + float pressure, float tilt_x, float tilt_y) { + /* Fix offset between darwin and X screens */ + pointer_x -= darwinMainScreenX + dixScreenOrigins[screen->myNum].x; + pointer_y -= darwinMainScreenY + dixScreenOrigins[screen->myNum].y; + + /* Setup our array of values */ + valuators[0] = pointer_x; + valuators[1] = pointer_y; + valuators[2] = pressure * SCALEFACTOR_PRESSURE; + valuators[3] = tilt_x * SCALEFACTOR_TILT; + valuators[4] = tilt_y * SCALEFACTOR_TILT; + + DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n", + valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]); +} + void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y, float pressure, float tilt_x, float tilt_y) { static int darwinFakeMouseButtonDown = 0; static int darwinFakeMouseButtonMask = 0; int i, num_events; DeviceIntPtr dev; + ScreenPtr screen; + int valuators[5]; -// DEBUG_LOG("x=%d, y=%d, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y); + DEBUG_LOG("x=%d, y=%d, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y); if(!darwinEvents) { - ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n"); + DEBUG_LOG("DarwinSendPointerEvents called before darwinEvents was initialized\n"); return; } - int valuators[5] = {pointer_x, pointer_y, pressure * SCALEFACTOR_PRESSURE, - tilt_x * SCALEFACTOR_TILT, tilt_y * SCALEFACTOR_TILT}; - - if (pressure == 0 && tilt_x == 0 && tilt_y == 0) dev = darwinPointer; - else dev = darwinTablet; + if (pressure == 0 && tilt_x == 0 && tilt_y == 0) + dev = darwinPointer; + else + dev = darwinTablet; + + screen = miPointerGetScreen(dev); + if(!screen) { + DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n"); + return; + } - DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n", - valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]); if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) { // Mimic multi-button mouse with modifier-clicks // If both sets of modifiers are pressed, @@ -411,22 +445,23 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags); darwinFakeMouseButtonMask = 0; return; - } + } - mieqEnqueue_lock(); { + DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + darwinEvents_lock(); { num_events = GetPointerEvents(darwinEvents, dev, ev_type, ev_button, POINTER_ABSOLUTE, 0, dev==darwinTablet?5:2, valuators); - for(i=0; i<num_events; i++) mieqEnqueue (dev,&darwinEvents[i]); + for(i=0; i<num_events; i++) mieqEnqueue (dev, &darwinEvents[i]); DarwinPokeEQ(); - } mieqEnqueue_unlock(); + } darwinEvents_unlock(); } void DarwinSendKeyboardEvents(int ev_type, int keycode) { int i, num_events; if(!darwinEvents) { - ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n"); + DEBUG_LOG("DarwinSendKeyboardEvents called before darwinEvents was initialized\n"); return; } @@ -443,32 +478,39 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { } } - mieqEnqueue_lock(); { + darwinEvents_lock(); { num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE); for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]); DarwinPokeEQ(); - } mieqEnqueue_unlock(); + } darwinEvents_unlock(); } void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y) { int i, num_events; - - // tilt and pressure have no meaning for a Prox event - int valuators[5] = {pointer_x, pointer_y, 0, 0, 0}; + ScreenPtr screen; + DeviceIntPtr dev = darwinTablet; + int valuators[5]; DEBUG_LOG("DarwinSendProximityEvents(%d, %d, %d)\n", ev_type, pointer_x, pointer_y); - + if(!darwinEvents) { - ErrorF("DarwinSendProximityEvents called before darwinEvents was initialized\n"); + DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n"); return; } - - mieqEnqueue_lock(); { - num_events = GetProximityEvents(darwinEvents, darwinTablet, ev_type, + + screen = miPointerGetScreen(dev); + if(!screen) { + DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n"); + return; + } + + DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f); + darwinEvents_lock(); { + num_events = GetProximityEvents(darwinEvents, dev, ev_type, 0, 5, valuators); - for(i=0; i<num_events; i++) mieqEnqueue (darwinTablet,&darwinEvents[i]); + for(i=0; i<num_events; i++) mieqEnqueue (dev,&darwinEvents[i]); DarwinPokeEQ(); - } mieqEnqueue_unlock(); + } darwinEvents_unlock(); } @@ -477,7 +519,7 @@ void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int pointer_y, float pressure, float tilt_x, float tilt_y) { if(!darwinEvents) { - ErrorF("DarwinSendScrollEvents called before darwinEvents was initialized\n"); + DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n"); return; } @@ -508,6 +550,9 @@ void DarwinUpdateModKeys(int flags) { old_flags = flags; } +void DarwinListenOnOpenFD(int fd) { + DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1, fd); +} /* * DarwinSendDDXEvent @@ -533,8 +578,13 @@ void DarwinSendDDXEvent(int type, int argc, ...) { va_end (args); } - mieqEnqueue_lock(); + /* If we're called from something other than the X server thread, we need + * to wait for the X server to setup darwinEvents. + */ + while(darwinEvents == NULL) { + usleep(250000); + } + mieqEnqueue(darwinPointer, &xe); DarwinPokeEQ(); - mieqEnqueue_unlock(); } diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h index a676aeb53..7a1e8ca5d 100644 --- a/hw/xquartz/darwinEvents.h +++ b/hw/xquartz/darwinEvents.h @@ -39,6 +39,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode); void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int pointer_y, float pressure, float tilt_x, float tilt_y); void DarwinUpdateModKeys(int flags); +void DarwinListenOnOpenFD(int fd); /* * Special ddx events understood by the X server @@ -56,6 +57,7 @@ enum { kXquartzToggleFullscreen, // Enable/Disable fullscreen mode kXquartzSetRootless, // Set rootless mode kXquartzSpaceChanged, // Spaces changed + kXquartzListenOnOpenFD, // Listen to the launchd fd (passed as arg) /* * AppleWM events */ diff --git a/hw/xquartz/doc/Makefile.am b/hw/xquartz/doc/Makefile.am new file mode 100644 index 000000000..b812af1cb --- /dev/null +++ b/hw/xquartz/doc/Makefile.am @@ -0,0 +1,14 @@ +appmandir = $(APP_MAN_DIR) +appman_PRE = Xquartz.man.pre +appman_PROCESSED = $(appman_PRE:man.pre=man) +appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) + +CLEANFILES = $(appman_PROCESSED) $(appman_DATA) + +include $(top_srcdir)/cpprules.in + +.man.$(APP_MAN_SUFFIX): + cp $< $@ + +EXTRA_DIST = \ + Xquartz.man.pre diff --git a/hw/xquartz/xpr/Xquartz.man.pre b/hw/xquartz/doc/Xquartz.man.pre index 315db1ca4..315db1ca4 100644 --- a/hw/xquartz/xpr/Xquartz.man.pre +++ b/hw/xquartz/doc/Xquartz.man.pre diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am new file mode 100644 index 000000000..11f6ba607 --- /dev/null +++ b/hw/xquartz/mach-startup/Makefile.am @@ -0,0 +1,62 @@ +AM_CPPFLAGS = \ + -DBUILD_DATE=\"$(BUILD_DATE)\" \ + -DXSERVER_VERSION=\"$(VERSION)\" +# -DNEW_LAUNCH_METHOD -DNEW_LAUNCH_METHOD_2 + +x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS +x11app_PROGRAMS = X11 + +dist_X11_SOURCES = \ + bundle-main.c \ + launchd_fd.c + +#nodist_X11_SOURCES = \ +# mach_startupServer.c \ +# mach_startupUser.c + +X11_LDADD = \ + $(top_builddir)/hw/xquartz/libXquartz.la \ + $(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \ + $(top_builddir)/dix/dixfonts.lo \ + $(top_builddir)/miext/rootless/librootless.la \ + $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin -lX11 + +X11_LDFLAGS = \ + -XCClinker -Objc \ + -Wl,-u,_miDCInitialize \ + -Wl,-framework,Carbon \ + -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ + -Wl,-framework,OpenGL \ + -Wl,-framework,Cocoa \ + -Wl,-framework,CoreAudio \ + -Wl,-framework,IOKit + +bin_PROGRAMS = Xquartz + +dist_Xquartz_SOURCES = \ + stub.c +# launchd_fd.c + +#nodist_Xquartz_SOURCES = \ +# mach_startupUser.c + +Xquartz_LDFLAGS = \ + -Wl,-framework,CoreServices + +BUILT_SOURCES = \ + mach_startupServer.c \ + mach_startupUser.c \ + mach_startupServer.h \ + mach_startup.h + +CLEANFILES = \ + $(BUILT_SOURCES) + +$(BUILT_SOURCES): mach_startup.defs + mig -sheader mach_startupServer.h mach_startup.defs + +EXTRA_DIST = \ + launchd_fd.h \ + mach_startup.defs \ + mach_startup_types.h + diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c new file mode 100644 index 000000000..c9751236f --- /dev/null +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -0,0 +1,490 @@ +/* main.c -- X application launcher + + Copyright (c) 2007 Jeremy Huddleston + Copyright (c) 2007 Apple 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 ABOVE LISTED COPYRIGHT + HOLDER(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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#include <CoreFoundation/CoreFoundation.h> + +#include <X11/Xlib.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <pthread.h> +#include <stdbool.h> + +#include <sys/socket.h> +#include <sys/un.h> + +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <servers/bootstrap.h> +#include "mach_startup.h" +#include "mach_startupServer.h" + +#define DEFAULT_CLIENT "/usr/X11/bin/xterm" +#define DEFAULT_STARTX "/usr/X11/bin/startx" +#define DEFAULT_SHELL "/bin/sh" + +static int execute(const char *command); +static char *command_from_prefs(const char *key, const char *default_value); + +/* This is in quartzStartup.c */ +int server_main(int argc, char **argv, char **envp); + +static int execute(const char *command); +static char *command_from_prefs(const char *key, const char *default_value); + +#ifdef NEW_LAUNCH_METHOD + +struct arg { + int argc; + char **argv; + char **envp; +}; + +/*** Mach-O IPC Stuffs ***/ + +union MaxMsgSize { + union __RequestUnion__mach_startup_subsystem req; + union __ReplyUnion__mach_startup_subsystem rep; +}; + +static mach_port_t checkin_or_register(char *bname) { + kern_return_t kr; + mach_port_t mp; + + /* If we're started by launchd or the old mach_init */ + kr = bootstrap_check_in(bootstrap_port, bname, &mp); + if (kr == KERN_SUCCESS) + return mp; + + /* We probably were not started by launchd or the old mach_init */ + kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &mp); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "mach_port_allocate(): %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + + kr = mach_port_insert_right(mach_task_self(), mp, mp, MACH_MSG_TYPE_MAKE_SEND); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "mach_port_insert_right(): %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + + kr = bootstrap_register(bootstrap_port, bname, mp); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + + return mp; +} + +/*** Pthread Magics ***/ +static pthread_t create_thread(void *func, void *arg) { + pthread_attr_t attr; + pthread_t tid; + + pthread_attr_init (&attr); + pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); + pthread_create (&tid, &attr, func, arg); + pthread_attr_destroy (&attr); + + return tid; +} + +/*** $DISPLAY handoff ***/ +/* From darwinEvents.c ... but don't want to pull in all the server cruft */ +void DarwinListenOnOpenFD(int fd); + +static void accept_fd_handoff(int connected_fd) { + int launchd_fd; + + char databuf[] = "display"; + struct iovec iov[1]; + + iov[0].iov_base = databuf; + iov[0].iov_len = sizeof(databuf); + + union { + struct cmsghdr hdr; + char bytes[CMSG_SPACE(sizeof(int))]; + } buf; + + struct msghdr msg; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = buf.bytes; + msg.msg_controllen = sizeof(buf); + msg.msg_name = 0; + msg.msg_namelen = 0; + msg.msg_flags = 0; + + struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + + msg.msg_controllen = cmsg->cmsg_len; + + *((int*)CMSG_DATA(cmsg)) = -1; + + if(recvmsg(connected_fd, &msg, 0) < 0) { + fprintf(stderr, "Error receiving $DISPLAY file descriptor: %s\n", strerror(errno)); + return; + } + + launchd_fd = *((int*)CMSG_DATA(cmsg)); + + if(launchd_fd > 0) + DarwinListenOnOpenFD(launchd_fd); + else + fprintf(stderr, "Error receiving $DISPLAY file descriptor, no descriptor received? %d\n", launchd_fd); +} + +typedef struct { + string_t socket_filename; + pthread_mutex_t lock; + pthread_cond_t cond; + kern_return_t retval; +} handoff_data_t; + +/* This thread loops accepting incoming connections and handing off the file + * descriptor for the new connection to accept_fd_handoff() + */ +static void socket_handoff_thread(void *arg) { + handoff_data_t *data = (handoff_data_t *)arg; + string_t filename; + struct sockaddr_un servaddr_un; + struct sockaddr *servaddr; + socklen_t servaddr_len; + int handoff_fd, connected_fd; + + /* We need to save it since data dies after we pthread_cond_broadcast */ + strlcpy(filename, data->socket_filename, STRING_T_SIZE); + + /* Make sure we only run once the dispatch thread is waiting for us */ + pthread_mutex_lock(&data->lock); + + /* Setup servaddr_un */ + memset (&servaddr_un, 0, sizeof (struct sockaddr_un)); + servaddr_un.sun_family = AF_UNIX; + strlcpy(servaddr_un.sun_path, filename, sizeof(servaddr_un.sun_path)); + + servaddr = (struct sockaddr *) &servaddr_un; + servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename); + + handoff_fd = socket(AF_UNIX, SOCK_STREAM, 0); + if(handoff_fd == 0) { + fprintf(stderr, "Failed to create socket: %s - %s\n", filename, strerror(errno)); + data->retval = EXIT_FAILURE; + return; + } + + if(bind(handoff_fd, servaddr, servaddr_len) != 0) { + fprintf(stderr, "Failed to bind socket: %s - %s\n", filename, strerror(errno)); + data->retval = EXIT_FAILURE; + return; + } + + if(listen(handoff_fd, 10) != 0) { + fprintf(stderr, "Failed to listen to socket: %s - %s\n", filename, strerror(errno)); + data->retval = EXIT_FAILURE; + return; + } + + /* Let the dispatch thread now tell the caller that we're listening */ + data->retval = EXIT_SUCCESS; + pthread_mutex_unlock(&data->lock); + pthread_cond_broadcast(&data->cond); + + connected_fd = accept(handoff_fd, NULL, NULL); + + /* We delete this temporary socket after we get the connection */ + unlink(filename); + + if(connected_fd == -1) { + fprintf(stderr, "Failed to accept incoming connection on socket: %s - %s\n", filename, strerror(errno)); + return; + } + + /* Now actually get the passed file descriptor from this connection */ + accept_fd_handoff(connected_fd); + + close(handoff_fd); +} + +kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) { + handoff_data_t handoff_data; + + pthread_mutex_init(&handoff_data.lock, NULL); + pthread_cond_init(&handoff_data.cond, NULL); + strlcpy(handoff_data.socket_filename, socket_filename, STRING_T_SIZE); + + pthread_mutex_lock(&handoff_data.lock); + + create_thread(socket_handoff_thread, &handoff_data); + + pthread_cond_wait(&handoff_data.cond, &handoff_data.lock); + + return handoff_data.retval; +} + +/*** Server Startup ***/ +kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv, + mach_msg_type_number_t argvCnt, + string_array_t envp, + mach_msg_type_number_t envpCnt) { + /* And now back to char ** */ + char **_argv = alloca((argvCnt + 1) * sizeof(char *)); + char **_envp = alloca((envpCnt + 1) * sizeof(char *)); + size_t i; + + if(!_argv || !_envp) { + return KERN_FAILURE; + } + + for(i=0; i < argvCnt; i++) { + _argv[i] = argv[i]; + } + _argv[argvCnt] = NULL; + + for(i=0; i < envpCnt; i++) { + _envp[i] = envp[i]; + } + _envp[envpCnt] = NULL; + + if(server_main(argvCnt, _argv, _envp) == 0) + return KERN_SUCCESS; + else + return KERN_FAILURE; +} + +int startup_trigger(int argc, char **argv, char **envp) { +#else +int main(int argc, char **argv, char **envp) { +#endif + Display *display; + const char *s; + + size_t i; +#ifndef NEW_LAUNCH_METHOD + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); + for(i=0; i < argc; i++) { + fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); + } +#endif + + /* Take care of the case where we're called like a normal DDX */ + if(argc > 1 && argv[1][0] == ':') { +#ifdef NEW_LAUNCH_METHOD + kern_return_t kr; + mach_port_t mp; + string_array_t newenvp; + string_array_t newargv; + + /* We need to count envp */ + int envpc; + for(envpc=0; envp[envpc]; envpc++); + + /* We have fixed-size string lengths due to limitations in IPC, + * so we need to copy our argv and envp. + */ + newargv = (string_array_t)alloca(argc * sizeof(string_t)); + newenvp = (string_array_t)alloca(envpc * sizeof(string_t)); + + if(!newargv || !newenvp) { + fprintf(stderr, "Memory allocation failure\n"); + exit(EXIT_FAILURE); + } + + for(i=0; i < argc; i++) { + strlcpy(newargv[i], argv[i], STRING_T_SIZE); + } + for(i=0; i < envpc; i++) { + strlcpy(newenvp[i], envp[i], STRING_T_SIZE); + } + + kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); + exit(EXIT_FAILURE); + } + + kr = start_x11_server(mp, newargv, argc, newenvp, envpc); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr)); + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); +#else + return server_main(argc, argv, envp); +#endif + } + + /* If we have a process serial number and it's our only arg, act as if + * the user double clicked the app bundle: launch app_to_run if possible + */ + if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { + /* Now, try to open a display, if so, run the launcher */ + display = XOpenDisplay(NULL); + if(display) { + fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n"); + /* Could open the display, start the launcher */ + XCloseDisplay(display); + + /* Give 2 seconds for the server to start... + * TODO: *Really* fix this race condition + */ + usleep(2000); + return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); + } + } + + /* Start the server */ + if((s = getenv("DISPLAY"))) { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); + unsetenv("DISPLAY"); + } else { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); + } + return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); +} + +#ifdef NEW_LAUNCH_METHOD +static void startup_trigger_thread(void *arg) { + struct arg args = *((struct arg *)arg); + free(arg); + startup_trigger(args.argc, args.argv, args.envp); +} + +/*** Main ***/ +int main(int argc, char **argv, char **envp) { + Bool listenOnly = FALSE; + int i; + mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE; + mach_port_t mp; + kern_return_t kr; + + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); + for(i=1; i < argc; i++) { + fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); + if(!strcmp(argv[i], "--listenonly")) { + listenOnly = TRUE; + } + } + + mp = checkin_or_register(SERVER_BOOTSTRAP_NAME); + if(mp == MACH_PORT_NULL) { + fprintf(stderr, "NULL mach service: %s", SERVER_BOOTSTRAP_NAME); + return EXIT_FAILURE; + } + + /* Check if we need to do something other than listen, and make another + * thread handle it. + */ + if(!listenOnly) { + struct arg *args = (struct arg*)malloc(sizeof(struct arg)); + if(!args) { + fprintf(stderr, "Memory allocation error.\n"); + return EXIT_FAILURE; + } + + args->argc = argc; + args->argv = argv; + args->envp = envp; + + create_thread(startup_trigger_thread, args); + } + + /* Main event loop */ + fprintf(stderr, "Statrup coming...\n"); + kr = mach_msg_server(mach_startup_server, mxmsgsz, mp, 0); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "org.x.X11(mp): %s\n", mach_error_string(kr)); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} +#endif + +static int execute(const char *command) { + const char *newargv[7]; + const char **s; + + newargv[0] = "/usr/bin/login"; + newargv[1] = "-fp"; + newargv[2] = getlogin(); + newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL); + newargv[4] = "-c"; + newargv[5] = command; + newargv[6] = NULL; + + fprintf(stderr, "X11.app: Launching %s:\n", command); + for(s=newargv; *s; s++) { + fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); + } + + execvp (newargv[0], (char * const *) newargv); + perror ("X11.app: Couldn't exec."); + return(1); +} + +static char *command_from_prefs(const char *key, const char *default_value) { + char *command = NULL; + + CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); + CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); + + if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { + CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); + + CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); + CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); + + int len = strlen(default_value) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + strcpy(command, default_value); + } else { + int len = CFStringGetLength((CFStringRef)PlistRef) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); + } + + if (PlistRef) + CFRelease(PlistRef); + + return command; +} diff --git a/hw/xquartz/mach-startup/launchd_fd.c b/hw/xquartz/mach-startup/launchd_fd.c new file mode 100644 index 000000000..44a243a58 --- /dev/null +++ b/hw/xquartz/mach-startup/launchd_fd.c @@ -0,0 +1,82 @@ +/* Copyright (c) 2008 Apple 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 ABOVE LISTED COPYRIGHT + * HOLDER(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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include <launch.h> +#include <stdio.h> +#include <errno.h> + +#include "launchd_fd.h" + +int launchd_display_fd() { + launch_data_t sockets_dict, checkin_request, checkin_response; + launch_data_t listening_fd_array, listening_fd; + + /* Get launchd fd */ + if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) { + fprintf(stderr,"launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n"); + return ERROR_FD; + } + + if ((checkin_response = launch_msg(checkin_request)) == NULL) { + fprintf(stderr,"launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno)); + return ERROR_FD; + } + + if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) { + // ignore EACCES, which is common if we weren't started by launchd + if (launch_data_get_errno(checkin_response) != EACCES) + fprintf(stderr,"launchd check-in failed: %s\n", strerror(launch_data_get_errno(checkin_response))); + return ERROR_FD; + } + + sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS); + if (NULL == sockets_dict) { + fprintf(stderr,"launchd check-in: no sockets found to answer requests on!\n"); + return ERROR_FD; + } + + if (launch_data_dict_get_count(sockets_dict) > 1) { + fprintf(stderr,"launchd check-in: some sockets will be ignored!\n"); + return ERROR_FD; + } + + listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0"); + if (NULL == listening_fd_array) { + fprintf(stderr,"launchd check-in: No known sockets found to answer requests on!\n"); + return ERROR_FD; + } + + if (launch_data_array_get_count(listening_fd_array)!=1) { + fprintf(stderr,"launchd check-in: Expected 1 socket from launchd, got %u)\n", + (unsigned)launch_data_array_get_count(listening_fd_array)); + return ERROR_FD; + } + + listening_fd=launch_data_array_get_index(listening_fd_array, 0); + return launch_data_get_fd(listening_fd); +} diff --git a/hw/xquartz/mach-startup/launchd_fd.h b/hw/xquartz/mach-startup/launchd_fd.h new file mode 100644 index 000000000..5083fae21 --- /dev/null +++ b/hw/xquartz/mach-startup/launchd_fd.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2008 Apple 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 ABOVE LISTED COPYRIGHT + * HOLDER(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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#ifndef _XQUARTZ_LAUNCHD_FD_H_ +#define _XQUARTZ_LAUNCHD_FD_H_ + +#define ERROR_FD -1 + +int launchd_display_fd(void); + +#endif /* _XQUARTZ_LAUNCHD_FD_H_ */
\ No newline at end of file diff --git a/hw/xquartz/mach-startup/mach_startup.defs b/hw/xquartz/mach-startup/mach_startup.defs new file mode 100644 index 000000000..19c105cb2 --- /dev/null +++ b/hw/xquartz/mach-startup/mach_startup.defs @@ -0,0 +1,46 @@ +/* Copyright (c) 2008 Apple 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 ABOVE LISTED COPYRIGHT + * HOLDER(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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include <mach/std_types.defs> +#include <mach/mach_types.defs> +import "mach_startup_types.h"; + +subsystem mach_startup 1000; +serverprefix do_; + +type string_t = c_string[1024]; +type string_array_t = array[] of string_t; + +routine start_x11_server( + port : mach_port_t; + argv : string_array_t; + envp : string_array_t); + +routine prep_fd_handoff( + port : mach_port_t; + socket_filename : string_t); diff --git a/hw/xquartz/mach-startup/mach_startup_types.h b/hw/xquartz/mach-startup/mach_startup_types.h new file mode 100644 index 000000000..97ac147cd --- /dev/null +++ b/hw/xquartz/mach-startup/mach_startup_types.h @@ -0,0 +1,10 @@ +#ifndef _MACH_STARTUP_TYPES_H_ +#define _MACH_STARTUP_TYPES_H_ + +#define SERVER_BOOTSTRAP_NAME "org.x.X11" +#define STRING_T_SIZE 1024 + +typedef char string_t[STRING_T_SIZE]; +typedef string_t * string_array_t; + +#endif diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c new file mode 100644 index 000000000..0a9ab669c --- /dev/null +++ b/hw/xquartz/mach-startup/stub.c @@ -0,0 +1,286 @@ +/* Copyright (c) 2008 Apple 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 ABOVE LISTED COPYRIGHT + * HOLDER(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(s) of the above + * copyright holders shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization. + */ + +#include <CoreServices/CoreServices.h> + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> + +#include <sys/socket.h> +#include <sys/un.h> + +#define kX11AppBundleId "org.x.X11" +#define kX11AppBundlePath "/Contents/MacOS/X11" + +#include <mach/mach.h> +#include <mach/mach_error.h> +#include <servers/bootstrap.h> +#include "mach_startup.h" + +#include "launchd_fd.h" + +#ifndef BUILD_DATE +#define BUILD_DATE "?" +#endif +#ifndef XSERVER_VERSION +#define XSERVER_VERSION "?" +#endif + +static char x11_path[PATH_MAX + 1]; + +static void set_x11_path() { + CFURLRef appURL = NULL; + CFBundleRef bundle = NULL; + OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL); + UInt32 ver; + + switch (osstatus) { + case noErr: + if (appURL == NULL) { + fprintf(stderr, "Xquartz: Invalid response from LSFindApplicationForInfo(%s)\n", + kX11AppBundleId); + exit(1); + } + + bundle = CFBundleCreate(NULL, appURL); + if(!bundle) { + fprintf(stderr, "Xquartz: Null value returned from CFBundleCreate().\n"); + exit(2); + } + + if (!CFURLGetFileSystemRepresentation(appURL, true, (unsigned char *)x11_path, sizeof(x11_path))) { + fprintf(stderr, "Xquartz: Error resolving URL for %s\n", kX11AppBundleId); + exit(3); + } + + ver = CFBundleGetVersionNumber(bundle); + if(ver < 0x02308000) { + CFStringRef versionStr = CFBundleGetValueForInfoDictionaryKey(bundle, kCFBundleVersionKey); + const char * versionCStr = "Unknown"; + + if(versionStr) + versionCStr = CFStringGetCStringPtr(versionStr, kCFStringEncodingMacRoman); + + fprintf(stderr, "Xquartz: Could not find a new enough X11.app LSFindApplicationForInfo() returned\n"); + fprintf(stderr, " X11.app = %s\n", x11_path); + fprintf(stderr, " Version = %s (%x), Expected Version > 2.3.0\n", versionCStr, (unsigned)ver); + exit(9); + } + + strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path)); +#ifdef DEBUG + fprintf(stderr, "Xquartz: X11.app = %s\n", x11_path); +#endif + break; + case kLSApplicationNotFoundErr: + fprintf(stderr, "Xquartz: Unable to find application for %s\n", kX11AppBundleId); + exit(10); + default: + fprintf(stderr, "Xquartz: Unable to find application for %s, error code = %d\n", + kX11AppBundleId, (int)osstatus); + exit(11); + } +} + +static void send_fd_handoff(int connected_fd, int launchd_fd) { + char databuf[] = "display"; + struct iovec iov[1]; + + iov[0].iov_base = databuf; + iov[0].iov_len = sizeof(databuf); + + union { + struct cmsghdr hdr; + char bytes[CMSG_SPACE(sizeof(int))]; + } buf; + + struct msghdr msg; + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_control = buf.bytes; + msg.msg_controllen = sizeof(buf); + msg.msg_name = 0; + msg.msg_namelen = 0; + msg.msg_flags = 0; + + struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + + msg.msg_controllen = cmsg->cmsg_len; + + *((int*)CMSG_DATA(cmsg)) = launchd_fd; + + if (sendmsg(connected_fd, &msg, 0) < 0) { + fprintf(stderr, "Error sending $DISPLAY file descriptor: %s\n", strerror(errno)); + return; + } + + fprintf(stderr, "send %d %d %d %s\n", connected_fd, launchd_fd, errno, strerror(errno)); +} + +static void handoff_fd(const char *filename, int launchd_fd) { + struct sockaddr_un servaddr_un; + struct sockaddr *servaddr; + socklen_t servaddr_len; + int handoff_fd, connected_fd; + + /* Setup servaddr_un */ + memset (&servaddr_un, 0, sizeof (struct sockaddr_un)); + servaddr_un.sun_family = AF_UNIX; + strlcpy(servaddr_un.sun_path, filename, sizeof(servaddr_un.sun_path)); + + servaddr = (struct sockaddr *) &servaddr_un; + servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename); + + handoff_fd = socket(PF_UNIX, SOCK_STREAM, 0); + if(handoff_fd == 0) { + fprintf(stderr, "Failed to create socket: %s - %s\n", filename, strerror(errno)); + return; + } + + connected_fd = connect(handoff_fd, servaddr, servaddr_len); + + if(connected_fd == -1) { + fprintf(stderr, "Failed to establish connection on socket: %s - %s\n", filename, strerror(errno)); + return; + } + + send_fd_handoff(connected_fd, launchd_fd); + + close(handoff_fd); +} + +int main(int argc, char **argv, char **envp) { +#ifdef NEW_LAUNCH_METHOD + int envpc; + kern_return_t kr; + mach_port_t mp; + string_array_t newenvp; + string_array_t newargv; + size_t i; + int launchd_fd; + string_t handoff_socket; +#endif + + if(argc == 2 && !strcmp(argv[1], "-version")) { + fprintf(stderr, "X.org Release 7.3\n"); + fprintf(stderr, "X.Org X Server %s\n", XSERVER_VERSION); + fprintf(stderr, "Build Date: %s\n", BUILD_DATE); + return EXIT_SUCCESS; + } + +#ifdef NEW_LAUNCH_METHOD + /* Get the $DISPLAY FD */ + launchd_fd = launchd_display_fd(); + + kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + if(kr != KERN_SUCCESS) { + set_x11_path(); + + /* This forking is ugly and will be cleaned up later */ + pid_t child = fork(); + if(child == -1) { + fprintf(stderr, "Could not fork: %s\n", strerror(errno)); + return EXIT_FAILURE; + } + + if(child == 0) { + char *_argv[3]; + _argv[0] = x11_path; + _argv[1] = "--listenonly"; + _argv[2] = NULL; + fprintf(stderr, "Starting X server: %s --listenonly\n", x11_path); + return execvp(x11_path, _argv); + } + + /* Try connecting for 10 seconds */ + for(i=0; i < 80; i++) { + usleep(250000); + kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + if(kr == KERN_SUCCESS) + break; + } + + if(kr != KERN_SUCCESS) { + fprintf(stderr, "bootstrap_look_up(): Timed out: %s\n", bootstrap_strerror(kr)); + return EXIT_FAILURE; + } + } + + /* Handoff the $DISPLAY FD */ + if(launchd_fd != -1) { + tmpnam(handoff_socket); + if(prep_fd_handoff(mp, handoff_socket) == KERN_SUCCESS) { + handoff_fd(handoff_socket, launchd_fd); + } else { + fprintf(stderr, "Unable to hand of $DISPLAY file descriptor\n"); + } + } + + /* Count envp */ + for(envpc=0; envp[envpc]; envpc++); + + /* We have fixed-size string lengths due to limitations in IPC, + * so we need to copy our argv and envp. + */ + newargv = (string_array_t)alloca(argc * sizeof(string_t)); + newenvp = (string_array_t)alloca(envpc * sizeof(string_t)); + + if(!newargv || !newenvp) { + fprintf(stderr, "Memory allocation failure\n"); + exit(EXIT_FAILURE); + } + + for(i=0; i < argc; i++) { + strlcpy(newargv[i], argv[i], STRING_T_SIZE); + } + for(i=0; i < envpc; i++) { + strlcpy(newenvp[i], envp[i], STRING_T_SIZE); + } + + kr = start_x11_server(mp, newargv, argc, newenvp, envpc); + if (kr != KERN_SUCCESS) { + fprintf(stderr, "start_x11_server: %s\n", mach_error_string(kr)); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; + +#else + set_x11_path(); + argv[0] = x11_path; + return execvp(x11_path, argv); +#endif +} diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index 698f39a22..5b8d32dae 100644 --- a/hw/xquartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -43,7 +43,7 @@ // Define this to get a diagnostic output to stderr which is helpful // in determining how the X server is interpreting the Darwin keymap. #define DUMP_DARWIN_KEYMAP -#define XQUARTZ_USE_XKB +//#define XQUARTZ_USE_XKB #define HACK_MISSING 1 #define HACK_KEYPAD 1 @@ -901,7 +901,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) { QuartzXkbUpdate(pDev); #else -#error FAIL assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms, keyInfo.modMap, QuartzBell, DarwinChangeKeyboardControl )); @@ -911,25 +910,26 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) { void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) { - if (pDev == NULL) pDev = darwinKeyboard; - - DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev); + if (pDev == NULL) pDev = darwinKeyboard; + + DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev); #ifdef XQUARTZ_USE_XKB - QuartzXkbUpdate(pDev); + QuartzXkbUpdate(pDev); #else -#error FAIL - if (pDev->key) { - if (pDev->key->curKeySyms.map) xfree(pDev->key->curKeySyms.map); - if (pDev->key->modifierKeyMap) xfree(pDev->key->modifierKeyMap); - xfree(pDev->key); - } - KeySymsRec keySyms; - if (!InitKeyClassDeviceStruct(pDev, &keySyms, keyInfo.modMap)) { - DEBUG_LOG("InitKeyClassDeviceStruct failed\n"); - return; - } + DarwinLoadKeyboardMapping(&keySyms); + + if (pDev->key) { + if (pDev->key->curKeySyms.map) xfree(pDev->key->curKeySyms.map); + if (pDev->key->modifierKeyMap) xfree(pDev->key->modifierKeyMap); + xfree(pDev->key); + } + + if (!InitKeyClassDeviceStruct(pDev, &keySyms, keyInfo.modMap)) { + DEBUG_LOG("InitKeyClassDeviceStruct failed\n"); + return; + } SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0); SendMappingNotify(MappingModifier, 0, 0, 0); diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c index a4472e659..43f1502a1 100644 --- a/hw/xquartz/quartzStartup.c +++ b/hw/xquartz/quartzStartup.c @@ -94,7 +94,7 @@ void QuartzInitServer(int argc, char **argv, char **envp) { } } -int main(int argc, char **argv, char **envp) { +int server_main(int argc, char **argv, char **envp) { int i; int fd[2]; diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am index 41f2b8655..e74580f73 100644 --- a/hw/xquartz/xpr/Makefile.am +++ b/hw/xquartz/xpr/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = Xquartz +noinst_LTLIBRARIES = libXquartzXpr.la AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ @@ -6,7 +6,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/miext \ -I$(top_srcdir)/miext/rootless -Xquartz_SOURCES = \ +libXquartzXpr_la_SOURCES = \ appledri.c \ dri.c \ xprAppleWM.c \ @@ -18,36 +18,7 @@ Xquartz_SOURCES = \ x-hook.c \ x-list.c -Xquartz_LDADD = \ - $(top_builddir)/hw/xquartz/libXquartz.la \ - $(top_builddir)/dix/dixfonts.lo \ - $(top_builddir)/miext/rootless/librootless.la \ - $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin - -Xquartz_LDFLAGS = \ - -XCClinker -Objc \ - -Wl,-u,_miDCInitialize \ - -Wl,-framework,Carbon \ - -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL \ - -Wl,-framework,OpenGL \ - -Wl,-framework,Cocoa \ - -Wl,-framework,CoreAudio \ - -Wl,-framework,IOKit - -appmandir = $(APP_MAN_DIR) -appman_PRE = Xquartz.man.pre -appman_PROCESSED = $(appman_PRE:man.pre=man) -appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) - -CLEANFILES = $(appman_PROCESSED) $(appman_DATA) - -include $(top_srcdir)/cpprules.in - -.man.$(APP_MAN_SUFFIX): - cp $< $@ - EXTRA_DIST = \ - Xquartz.man.pre \ dri.h \ dristruct.h \ appledri.h \ diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 731222607..d8eb72a48 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -40,6 +40,7 @@ #include "xprEvent.h" #include "pseudoramiX.h" #include "darwin.h" +#include "darwinEvents.h" #include "rootless.h" #include "dri.h" #include "globals.h" diff --git a/include/dix-config.h.in b/include/dix-config.h.in index dd0c66b61..ec2b7e584 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -193,6 +193,9 @@ /* Define to 1 if you have the <rpcsvc/dbm.h> header file. */ #undef HAVE_RPCSVC_DBM_H +/* Define to use libmd SHA1 functions instead of OpenSSL libcrypto */ +#undef HAVE_SHA1_IN_LIBMD + /* Define to 1 if you have the `shmctl64' function. */ #undef HAVE_SHMCTL64 @@ -202,6 +205,9 @@ /* Define to 1 if you have the <stdlib.h> 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 diff --git a/include/dix.h b/include/dix.h index 970b1d880..300718dd9 100644 --- a/include/dix.h +++ b/include/dix.h @@ -119,9 +119,6 @@ typedef struct _Client *ClientPtr; /* also in misc.h */ typedef struct _WorkQueue *WorkQueuePtr; -#ifdef XPRINT -extern ClientPtr requestingClient; -#endif extern ClientPtr *clients; extern ClientPtr serverClient; extern int currentMaxClients; diff --git a/include/globals.h b/include/globals.h index e2e48044c..0aba78ae1 100644 --- a/include/globals.h +++ b/include/globals.h @@ -17,7 +17,6 @@ extern Bool screenSaverSuspended; extern char *defaultFontPath; extern int monitorResolution; -extern Bool loadableFonts; extern int defaultColorVisualClass; extern Bool Must_have_memory; diff --git a/include/opaque.h b/include/opaque.h index 3d19d275f..d5abcbd50 100644 --- a/include/opaque.h +++ b/include/opaque.h @@ -49,8 +49,6 @@ extern int ScreenSaverBlanking; extern int ScreenSaverAllowExposures; extern int defaultScreenSaverBlanking; extern int defaultScreenSaverAllowExposures; -extern int argcGlobal; -extern char **argvGlobal; extern char *display; extern int defaultBackingStore; diff --git a/include/os.h b/include/os.h index c0f04c6af..fd3407718 100644 --- a/include/os.h +++ b/include/os.h @@ -166,6 +166,10 @@ extern void MakeClientGrabImpervious(ClientPtr /*client*/); extern void MakeClientGrabPervious(ClientPtr /*client*/); +#ifdef XQUARTZ +extern void ListenOnOpenFD(int /* fd */); +#endif + extern void AvailableClientInput(ClientPtr /* client */); extern CARD32 GetTimeInMillis(void); diff --git a/mi/miinitext.c b/mi/miinitext.c index 00f0d271a..a4374d51e 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -88,34 +88,6 @@ SOFTWARE. #undef GLXEXT #endif -/* Make sure Xprt only announces extensions it supports */ -#ifdef PRINT_ONLY_SERVER -#undef MITSHM /* this is incompatible to the vector-based Xprint DDX */ -#undef XKB -#undef PANORAMIX -#undef RES -#undef XINPUT -#undef XV -#undef SCREENSAVER -#undef XIDLE -#undef XRECORD -#undef XF86VIDMODE -#undef XF86MISC -#undef XFreeXDGA -#undef XF86DRI -#undef DPMSExtension -#undef FONTCACHE -#undef COMPOSITE -#undef DAMAGE -#undef XFIXES -#undef XEVIE -#else -#ifndef LOADABLEPRINTDDX -#undef XPRINT -#endif /* LOADABLEPRINTDDX */ -#endif /* PRINT_ONLY_SERVER */ - - extern Bool noTestExtensions; #ifdef BIGREQS @@ -227,9 +199,6 @@ typedef void (*InitExtension)(INITARGS); #ifdef XKB #include <X11/extensions/XKB.h> #endif -#ifdef XPRINT -#include <X11/extensions/Print.h> -#endif #ifdef XCSECURITY #include "securitysrv.h" #include <X11/extensions/securstr.h> @@ -301,9 +270,6 @@ extern void SecurityExtensionInit(INITARGS); #ifdef XSELINUX extern void SELinuxExtensionInit(INITARGS); #endif -#ifdef XPRINT -extern void XpExtensionInit(INITARGS); -#endif #ifdef XF86BIGFONT extern void XFree86BigfontExtensionInit(INITARGS); #endif @@ -494,7 +460,7 @@ InitExtensions(argc, argv) if (!noGEExtension) GEExtensionInit(); #ifdef PANORAMIX -# if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX) +# if !defined(NO_PANORAMIX) if (!noPanoramiXExtension) PanoramiXExtensionInit(); # endif #endif @@ -525,7 +491,7 @@ InitExtensions(argc, argv) #ifdef XTRAP if (!noTestExtensions) DEC_XTRAPInit(); #endif -#if defined(SCREENSAVER) && !defined(PRINT_ONLY_SERVER) +#if defined(SCREENSAVER) if (!noScreenSaverExtension) ScreenSaverExtensionInit (); #endif #ifdef XV @@ -537,7 +503,7 @@ InitExtensions(argc, argv) #ifdef XSYNC if (!noSyncExtension) SyncExtensionInit(); #endif -#if defined(XKB) && !defined(PRINT_ONLY_SERVER) +#if defined(XKB) if (!noXkbExtension) XkbExtensionInit(); #endif #ifdef XCMISC @@ -555,9 +521,6 @@ InitExtensions(argc, argv) #ifdef XSELINUX if (!noSELinuxExtension) SELinuxExtensionInit(); #endif -#ifdef XPRINT - XpExtensionInit(); /* server-specific extension, cannot be disabled */ -#endif #if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS) if (!noDPMSExtension) DPMSExtensionInit(); #endif @@ -567,7 +530,7 @@ InitExtensions(argc, argv) #ifdef XF86BIGFONT if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit(); #endif -#if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS) +#if !defined(NO_HW_ONLY_EXTS) #if defined(XF86VIDMODE) if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit(); #endif @@ -639,9 +602,6 @@ static ExtensionModule staticExtensions[] = { #ifdef XCSECURITY { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL }, #endif -#ifdef XPRINT - { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL }, -#endif #ifdef PANORAMIX { PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL }, #endif diff --git a/mi/mivaltree.c b/mi/mivaltree.c index 74483e354..d9d07caad 100644 --- a/mi/mivaltree.c +++ b/mi/mivaltree.c @@ -255,7 +255,11 @@ miComputeClips ( if (pParent->redirectDraw != RedirectDrawNone) { if (miSetRedirectBorderClipProc) + { + if (TreatAsTransparent (pParent)) + REGION_EMPTY (pScreen, universe); (*miSetRedirectBorderClipProc) (pParent, universe); + } REGION_COPY(pScreen, universe, &pParent->borderSize); } #endif diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index df1d3a879..0edafe7ea 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -1338,34 +1338,55 @@ RootlessResizeWindow(WindowPtr pWin, int x, int y, RegionRec saveRoot; RL_DEBUG_MSG("resizewindow start (win 0x%x) ", pWin); + + if(pWin->parent) { + if (winRec) { + oldBW = winRec->borderWidth; + oldX = winRec->x; + oldY = winRec->y; + oldW = winRec->width; + oldH = winRec->height; - if (winRec) { - oldBW = winRec->borderWidth; - oldX = winRec->x; - oldY = winRec->y; - oldW = winRec->width; - oldH = winRec->height; - - newBW = oldBW; - newX = x; - newY = y; - newW = w + 2*newBW; - newH = h + 2*newBW; - - resize_after = StartFrameResize(pWin, TRUE, - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } + newBW = oldBW; + newX = x; + newY = y; + newW = w + 2*newBW; + newH = h + 2*newBW; - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, ResizeWindow); - pScreen->ResizeWindow(pWin, x, y, w, h, pSib); - SCREEN_WRAP(pScreen, ResizeWindow); - NORMAL_ROOT(pWin); + resize_after = StartFrameResize(pWin, TRUE, + oldX, oldY, oldW, oldH, oldBW, + newX, newY, newW, newH, newBW); + } - if (winRec) { - FinishFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW, resize_after); + HUGE_ROOT(pWin); + SCREEN_UNWRAP(pScreen, ResizeWindow); + pScreen->ResizeWindow(pWin, x, y, w, h, pSib); + SCREEN_WRAP(pScreen, ResizeWindow); + NORMAL_ROOT(pWin); + + if (winRec) { + FinishFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW, + newX, newY, newW, newH, newBW, resize_after); + } + } else { + /* Special case for resizing the root window */ + BoxRec box; + + pWin->drawable.x = x; + pWin->drawable.y = y; + pWin->drawable.width = w; + pWin->drawable.height = h; + + box.x1 = x; box.y1 = y; + box.x2 = x + w; box.y2 = y + h; + REGION_UNINIT(pScreen, &pWin->winSize); + REGION_INIT(pScreen, &pWin->winSize, &box, 1); + REGION_COPY(pScreen, &pWin->borderSize, &pWin->winSize); + REGION_COPY(pScreen, &pWin->clipList, &pWin->winSize); + REGION_COPY(pScreen, &pWin->borderClip, &pWin->winSize); + + miSendExposures(pWin, &pWin->borderClip, + pWin->drawable.x, pWin->drawable.y); } RL_DEBUG_MSG("resizewindow end\n"); diff --git a/os/connection.c b/os/connection.c index 396593698..316e347f2 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1297,3 +1297,42 @@ MakeClientGrabPervious(ClientPtr client) } } +#ifdef XQUARTZ +/* Add a fd (from launchd) to our listeners */ +_X_EXPORT void ListenOnOpenFD(int fd) { + char port[20]; + XtransConnInfo ciptr; + + /* Sigh for inconsistencies. */ + sprintf (port, ":%d", atoi(display)); + + /* Make our XtransConnInfo + * TRANS_SOCKET_LOCAL_INDEX = 5 from Xtrans.c + */ + ciptr = _XSERVTransReopenCOTSServer(5, fd, port); + if(ciptr == NULL) { + ErrorF("Got NULL while trying to Reopen launchd port.\n"); + return; + } + + /* Allocate space to store it */ + ListenTransFds = (int *) xrealloc(ListenTransFds, (ListenTransCount + 1) * sizeof (int)); + ListenTransConns = (XtransConnInfo *) xrealloc(ListenTransConns, (ListenTransCount + 1) * sizeof (XtransConnInfo)); + + /* Store it */ + ListenTransConns[ListenTransCount] = ciptr; + ListenTransFds[ListenTransCount] = fd; + + FD_SET(fd, &WellKnownConnections); + + /* It is always local + if (!_XSERVTransIsLocal(ciptr)) { + // DefineSelf (fd); + } + */ + + /* Increment the count */ + ListenTransCount++; +} + +#endif @@ -410,9 +410,7 @@ AbortServer(void) exit (1); } -#ifndef AUDIT_PREFIX -#define AUDIT_PREFIX "AUDIT: %s: %ld %s: " -#endif +#define AUDIT_PREFIX "AUDIT: %s: %ld: " #ifndef AUDIT_TIMEOUT #define AUDIT_TIMEOUT ((CARD32)(120 * 1000)) /* 2 mn */ #endif @@ -444,15 +442,11 @@ AuditPrefix(void) autime = ctime(&tm); if ((s = strchr(autime, '\n'))) *s = '\0'; - if ((s = strrchr(argvGlobal[0], '/'))) - s++; - else - s = argvGlobal[0]; - len = strlen(AUDIT_PREFIX) + strlen(autime) + 10 + strlen(s) + 1; + len = strlen(AUDIT_PREFIX) + strlen(autime) + 10 + 1; tmpBuf = malloc(len); if (!tmpBuf) return NULL; - snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long)getpid(), s); + snprintf(tmpBuf, len, AUDIT_PREFIX, autime, (unsigned long)getpid()); return tmpBuf; } @@ -498,15 +492,6 @@ VAuditF(const char *f, va_list args) prefix = AuditPrefix(); len = vsnprintf(buf, sizeof(buf), f, args); -#if 1 - /* XXX Compressing duplicated messages is temporarily disabled to - * work around bugzilla 964: - * https://freedesktop.org/bugzilla/show_bug.cgi?id=964 - */ - ErrorF("%s%s", prefix != NULL ? prefix : "", buf); - oldlen = -1; - nrepeat = 0; -#else if (len == oldlen && strcmp(buf, oldbuf) == 0) { /* Message already seen */ nrepeat++; @@ -520,7 +505,6 @@ VAuditF(const char *f, va_list args) nrepeat = 0; auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL); } -#endif if (prefix != NULL) free(prefix); } diff --git a/os/utils.c b/os/utils.c index 4bebeca9e..90342c64a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -128,10 +128,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #include "picture.h" #endif -#ifdef XPRINT -#include "DiPrint.h" -#endif - _X_EXPORT Bool noTestExtensions; #ifdef BIGREQS _X_EXPORT Bool noBigReqExtension = FALSE; @@ -613,9 +609,6 @@ void UseMsg(void) ErrorF("-render [default|mono|gray|color] set render color alloc policy\n"); #endif ErrorF("-s # screen-saver timeout (minutes)\n"); -#ifdef XPRINT - PrinterUseMsg(); -#endif ErrorF("-su disable any save under support\n"); ErrorF("-t # mouse threshold (pixels)\n"); ErrorF("-terminate terminate at server reset\n"); @@ -1027,12 +1020,6 @@ ProcessCommandLine(int argc, char *argv[]) i = skip - 1; } #endif -#ifdef XPRINT - else if ((skip = PrinterOptions(argc, argv, i)) != i) - { - i = skip - 1; - } -#endif #ifdef AIXV3 else if ( strcmp( argv[i], "-timeout") == 0) { diff --git a/os/xdmcp.c b/os/xdmcp.c index 310f33bc0..d896c8ba3 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -44,6 +44,7 @@ #include "input.h" #include "dixstruct.h" #include "opaque.h" +#include "site.h" #if defined(DGUX) #include <net/net_ioctl.h> @@ -68,7 +69,7 @@ #define X_INCLUDE_NETDB_H #include <X11/Xos_r.h> -extern char *defaultDisplayClass; +static char *defaultDisplayClass = COMPILEDDISPLAYCLASS; static int xdmcpSocket, sessionSocket; static xdmcp_states state; diff --git a/render/glyph.c b/render/glyph.c index 286e39d63..de0197083 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -26,8 +26,12 @@ #include <dix-config.h> #endif -#include <stddef.h> /* buggy openssl/sha.h wants size_t */ -#include <openssl/sha.h> +#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */ +# include <sha1.h> +#else /* Use OpenSSL's libcrypto */ +# include <stddef.h> /* buggy openssl/sha.h wants size_t */ +# include <openssl/sha.h> +#endif #include "misc.h" #include "scrnintstr.h" @@ -202,6 +206,14 @@ HashGlyph (xGlyphInfo *gi, unsigned long size, unsigned char sha1[20]) { +#ifdef HAVE_SHA1_IN_LIBMD /* Use libmd for SHA1 */ + SHA1_CTX ctx; + + SHA1Init (&ctx); + SHA1Update (&ctx, gi, sizeof (xGlyphInfo)); + SHA1Update (&ctx, bits, size); + SHA1Final (sha1, &ctx); +#else /* Use OpenSSL's libcrypto */ SHA_CTX ctx; int success; @@ -220,6 +232,7 @@ HashGlyph (xGlyphInfo *gi, success = SHA1_Final (sha1, &ctx); if (! success) return BadAlloc; +#endif return Success; } diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index ee64c3be7..ade13c3af 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -274,7 +274,7 @@ char tmpname[PATH_MAX]; return True; } else - DebugF("[xkb] Error compiling keymap (%s)\n",keymap); + LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap); #ifdef WIN32 /* remove the temporary file */ unlink(tmpname); @@ -282,9 +282,9 @@ char tmpname[PATH_MAX]; } else { #ifndef WIN32 - DebugF("[xkb] Could not invoke keymap compiler\n"); + LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n"); #else - DebugF("[xkb] Could not open file %s\n", tmpname); + LogMessage(X_ERROR, "Could not open file %s\n", tmpname); #endif } if (nameRtrn) @@ -350,11 +350,13 @@ unsigned missing; if ((names->keycodes==NULL)&&(names->types==NULL)&& (names->compat==NULL)&&(names->symbols==NULL)&& (names->geometry==NULL)) { + LogMessage(X_ERROR, "XKB: No components provided for device %s\n", + keybd->name); return 0; } else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, nameRtrn,nameRtrnLen)){ - DebugF("[xkb] Couldn't compile keymap file\n"); + LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n"); return 0; } file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX); @@ -369,8 +371,8 @@ unsigned missing; (void) unlink (fileName); return 0; } - else if (xkbDebugFlags) { - DebugF("[xkb] Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined); + else { + DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined); } fclose(file); (void) unlink (fileName); @@ -390,32 +392,40 @@ XkbRF_RulesPtr rules; if (!rules_name) return False; - if (XkbBaseDirectory==NULL) { - if (strlen(rules_name)+7 > PATH_MAX) - return False; - sprintf(buf,"rules/%s",rules_name); - } - else { - if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX) - return False; - sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name); + + if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) { + LogMessage(X_ERROR, "XKB: Rules name is too long\n"); + return False; } - if ((file= fopen(buf,"r"))==NULL) + sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name); + + file = fopen(buf, "r"); + if (!file) { + LogMessage(X_ERROR, "XKB: Couldn't open rules file %s\n", buf); return False; - if ((rules= XkbRF_Create(0,0))==NULL) { + } + + rules = XkbRF_Create(0, 0); + if (!rules) { + LogMessage(X_ERROR, "XKB: Couldn't create rules struct\n"); fclose(file); return False; } - if (!XkbRF_LoadRules(file,rules)) { + + if (!XkbRF_LoadRules(file, rules)) { + LogMessage(X_ERROR, "XKB: Couldn't parse rules file %s\n", rules_name); fclose(file); XkbRF_Free(rules,True); return False; } - bzero((char *)names,sizeof(XkbComponentNamesRec)); - complete= XkbRF_GetComponents(rules,defs,names); + + memset(names, 0, sizeof(*names)); + complete = XkbRF_GetComponents(rules,defs,names); fclose(file); - XkbRF_Free(rules,True); - return complete; -} + XkbRF_Free(rules, True); + if (!complete) + LogMessage(X_ERROR, "XKB: Rules returned no components\n"); + return complete; +} |