From f6d51797a523ecc2d4a8f18b2681160fcd5d1d55 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Wed, 27 Feb 2008 23:44:39 +0100 Subject: [PATCH 001/183] EXA: Let the driver decide what repeat/extend types are supported. --- exa/exa_render.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/exa/exa_render.c b/exa/exa_render.c index 6df2a23c8..38e2a04bd 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -696,8 +696,6 @@ exaComposite(CARD8 op, pMask->repeat = 0; if (pExaScr->info->PrepareComposite && - (!pSrc->repeat || pSrc->repeatType == RepeatNormal) && - (!pMask || !pMask->repeat || pMask->repeatType == RepeatNormal) && !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) { Bool isSrcSolid; From 08afc70513e5496cc5cd8b76c8658c4292119e4b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 28 Feb 2008 10:45:41 +1000 Subject: [PATCH 002/183] quirks: another LPL panel with the cm/mm wrong --- hw/xfree86/modes/xf86EdidModes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index b865727ef..c366a3839 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -110,8 +110,9 @@ static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC) { /* Bug #10304: "LGPhilipsLCD LP154W01-A5" */ /* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */ + /* Red Hat #435216 "LGPhilipsLCD LP154W01-TLAE" */ if (memcmp (DDC->vendor.name, "LPL", 4) == 0 && - DDC->vendor.prod_id == 0) + (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00) return TRUE; /* Bug #11603: Funai Electronics PM36B */ From 3b1df47bd400be9dca34b5e5d1ac2b117f8cc4ed Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Wed, 27 Feb 2008 22:28:54 -0500 Subject: [PATCH 003/183] XACE: Require "manage" permission for XKBSetNames. --- xkb/xkb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xkb/xkb.c b/xkb/xkb.c index b0d2f0d3d..07f57a73b 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -3545,7 +3545,7 @@ ProcXkbSetNames(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixUnknownAccess); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask); xkb = dev->key->xkbInfo->desc; From e40cc5305bec656108077ab13fcc8e6e82b3707a Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Wed, 27 Feb 2008 22:29:15 -0500 Subject: [PATCH 004/183] xselinux: Don't throw BadAccess if DixUnknownAccess is passed in to a hook. The avc will still appear, however, so that the callsite can be fixed. --- Xext/xselinux.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index d3fe86b3a..6862bb304 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -312,6 +312,8 @@ SELinuxDoCheck(SELinuxSubjectRec *subj, SELinuxObjectRec *obj, if (avc_has_perm(subj->sid, obj->sid, class, mode, &subj->aeref, auditdata) < 0) { + if (mode == DixUnknownAccess) + return Success; /* DixUnknownAccess requests OK ... for now */ if (errno == EACCES) return BadAccess; ErrorF("ServerPerm: unexpected error %d\n", errno); From f616735f17a681e3add866bf199540327c322490 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Wed, 27 Feb 2008 22:46:14 -0500 Subject: [PATCH 005/183] xselinux: Prefix a few remaining error messages with "SELinux". --- Xext/xselinux.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 6862bb304..98e1ec563 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -316,7 +316,7 @@ SELinuxDoCheck(SELinuxSubjectRec *subj, SELinuxObjectRec *obj, return Success; /* DixUnknownAccess requests OK ... for now */ if (errno == EACCES) return BadAccess; - ErrorF("ServerPerm: unexpected error %d\n", errno); + ErrorF("SELinux: avc_has_perm: unexpected error %d\n", errno); return BadValue; } @@ -348,7 +348,7 @@ SELinuxLabelClient(ClientPtr client) /* For local clients, can get context from the socket */ if (getpeercon(fd, &ctx) < 0) - FatalError("Client %d: couldn't get context from socket\n", + FatalError("SELinux: client %d: couldn't get context from socket\n", client->index); /* Try and determine the client's executable name */ @@ -375,13 +375,12 @@ SELinuxLabelClient(ClientPtr client) } else /* For remote clients, need to use a default context */ if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0) - FatalError("Client %d: couldn't get default remote context\n", - client->index); + FatalError("SELinux: failed to look up remote-client context\n"); finish: /* Get a SID from the context */ if (avc_context_to_sid(ctx, &subj->sid) < 0) - FatalError("Client %d: context_to_sid(%s) failed\n", + FatalError("SELinux: client %d: context_to_sid(%s) failed\n", client->index, ctx); sidget(subj->sid); @@ -410,11 +409,11 @@ SELinuxLabelInitial(void) /* Use the context of the X server process for the serverClient */ if (getcon(&ctx) < 0) - FatalError("Couldn't get context of X server process\n"); + FatalError("SELinux: couldn't get context of X server process\n"); /* Get a SID from the context */ if (avc_context_to_sid(ctx, &subj->sid) < 0) - FatalError("serverClient: context_to_sid(%s) failed\n", ctx); + FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx); sidget(subj->sid); obj->sid = subj->sid; From aebd9dc252449747416b23c740a550d914275399 Mon Sep 17 00:00:00 2001 From: Tiago Vignatti Date: Thu, 28 Feb 2008 01:22:31 -0300 Subject: [PATCH 006/183] Oops, there's one more parenthesis. --- hw/xfree86/modes/xf86EdidModes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index c366a3839..a1bdb0b99 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -112,7 +112,7 @@ static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC) /* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */ /* Red Hat #435216 "LGPhilipsLCD LP154W01-TLAE" */ if (memcmp (DDC->vendor.name, "LPL", 4) == 0 && - (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00) + (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00)) return TRUE; /* Bug #11603: Funai Electronics PM36B */ From 453661a9e193a511cf5e54e6d330454163817316 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 27 Feb 2008 20:43:50 +1030 Subject: [PATCH 007/183] Xi: swap the control attached to a ChangeDeviceControl request. Bug #14170 Just swapping the request's data isn't enough, we need to swap the actual control as well. X.Org Bug 14170 --- Xi/chgdctl.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 30174f496..89410d68f 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -77,11 +77,46 @@ int SProcXChangeDeviceControl(ClientPtr client) { char n; + xDeviceCtl *ctl; + xDeviceAbsCalibCtl *calib; + xDeviceAbsAreaCtl *area; REQUEST(xChangeDeviceControlReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); swaps(&stuff->control, n); + ctl = (xDeviceCtl*)&stuff[1]; + swaps(&ctl->control, n); + swaps(&ctl->length, n); + switch(stuff->control) { + case DEVICE_ABS_CALIB: + calib = (xDeviceAbsCalibCtl*)ctl; + swaps(&calib->length, n); + swapl(&calib->min_x, n); + swapl(&calib->max_x, n); + swapl(&calib->min_y, n); + swapl(&calib->max_y, n); + swapl(&calib->flip_x, n); + swapl(&calib->flip_y, n); + swapl(&calib->rotation, n); + swapl(&calib->button_threshold, n); + break; + case DEVICE_ABS_AREA: + area = (xDeviceAbsAreaCtl*)ctl; + swapl(&area->offset_x, n); + swapl(&area->offset_y, n); + swapl(&area->width, n); + swapl(&area->height, n); + swapl(&area->screen, n); + swapl(&area->following, n); + break; + case DEVICE_CORE: + case DEVICE_ENABLE: + case DEVICE_RESOLUTION: + /* hmm. beer. *drool* */ + break; + + } return (ProcXChangeDeviceControl(client)); } From 27bcf40cda1d7c52b189cc76528f1f51cbe1d5eb Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 28 Feb 2008 16:43:43 -0500 Subject: [PATCH 008/183] XACE: Fix instances of DixUnknownAccess at hook callsites. --- GL/glx/glxcmds.c | 8 ++++---- Xext/panoramiX.c | 6 +++--- Xext/panoramiXprocs.c | 8 ++++---- Xext/shm.c | 6 +++--- Xext/xprint.c | 2 +- Xi/exevents.c | 2 +- composite/compwindow.c | 2 +- config/dbus.c | 2 +- hw/dmx/glxProxy/glxcmds.c | 24 ++++++++++++------------ hw/xquartz/pseudoramiX.c | 6 +++--- randr/rrxinerama.c | 6 +++--- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index 21f3206c3..32d1bc834 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -479,7 +479,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, * resource ID clashes. Effectively, the X Window is now also a * GLXWindow. */ - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); if (rc != Success || pDraw->type != DRAWABLE_WINDOW) { client->errorValue = drawId; *error = __glXError(GLXBadDrawable); @@ -1086,7 +1086,7 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *c DrawablePtr pDraw; int err; - err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixUnknownAccess); + err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess); if (err != Success || pDraw->type != DRAWABLE_PIXMAP) { client->errorValue = drawableId; return BadPixmap; @@ -1364,7 +1364,7 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err)) return err; - err = dixLookupDrawable(&pDraw, req->window, client, 0, DixUnknownAccess); + err = dixLookupDrawable(&pDraw, req->window, client, 0, DixAddAccess); if (err != Success || pDraw->type != DRAWABLE_WINDOW) { client->errorValue = req->window; return BadWindow; @@ -2004,7 +2004,7 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) int screen, rc; __GLXscreen *pGlxScreen; - rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess); pGlxScreen = glxGetScreen(pDraw->pScreen); if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) { screen = pDraw->pScreen->myNum; diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index d8ec588aa..f92414764 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -919,7 +919,7 @@ ProcPanoramiXGetState(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -946,7 +946,7 @@ ProcPanoramiXGetScreenCount(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -972,7 +972,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index d19b3039a..30aff7460 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -525,7 +525,7 @@ int PanoramiXGetGeometry(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess); if (rc != Success) return rc; @@ -1024,7 +1024,7 @@ int PanoramiXCopyArea(ClientPtr client) FOR_NSCREENS(j) { rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; } @@ -1779,7 +1779,7 @@ int PanoramiXGetImage(ClientPtr client) return (*SavedProcVector[X_GetImage])(client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixReadAccess); if (rc != Success) return rc; @@ -1817,7 +1817,7 @@ int PanoramiXGetImage(ClientPtr client) drawables[0] = pDraw; for(i = 1; i < PanoramiXNumScreens; i++) { rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; } diff --git a/Xext/shm.c b/Xext/shm.c index a7a1ecf75..b2973bff6 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -655,7 +655,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) return ProcShmGetImage(client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixReadAccess); if (rc != Success) return rc; @@ -692,7 +692,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) drawables[0] = pDraw; for(i = 1; i < PanoramiXNumScreens; i++) { rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, - DixUnknownAccess); + DixReadAccess); if (rc != Success) return rc; } @@ -767,7 +767,7 @@ ProcPanoramiXShmCreatePixmap( return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xext/xprint.c b/Xext/xprint.c index dba7989cc..a5d8fcc33 100644 --- a/Xext/xprint.c +++ b/Xext/xprint.c @@ -1800,7 +1800,7 @@ ProcXpPutDocumentData(ClientPtr client) if (pContext->state & DOC_RAW_STARTED) return BadDrawable; result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixWriteAccess); if (result != Success) return result; if (pDraw->pScreen->myNum != pContext->screenNum) diff --git a/Xi/exevents.c b/Xi/exevents.c index ac6b92383..fb84bef6f 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -833,7 +833,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, } else effectiveFocus = pWin = inputFocus; } else - dixLookupWindow(&pWin, dest, client, DixUnknownAccess); + dixLookupWindow(&pWin, dest, client, DixSendAccess); if (!pWin) return BadWindow; if ((propagate != xFalse) && (propagate != xTrue)) { diff --git a/composite/compwindow.c b/composite/compwindow.c index ee0f7d270..c022027db 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -92,7 +92,7 @@ static Bool compRepaintBorder (ClientPtr pClient, pointer closure) { WindowPtr pWindow; - int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess); + int rc = dixLookupWindow(&pWindow, (XID)closure, pClient, DixWriteAccess); if (rc == Success) { RegionRec exposed; diff --git a/config/dbus.c b/config/dbus.c index 0be42afb6..cef8ed5db 100644 --- a/config/dbus.c +++ b/config/dbus.c @@ -213,7 +213,7 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error) MALFORMED_MESSAGE_ERROR(); } - dixLookupDevice(&dev, deviceid, serverClient, DixUnknownAccess); + dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess); if (!dev) { DebugF("[config/dbus] bogus device id %d given\n", deviceid); ret = BadMatch; diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index 85e0f8701..ab7ee96b9 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -431,7 +431,7 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) __glXWindow *pGlxWindow = NULL; int rc; - rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess); if (rc != Success) { pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, __glXPixmapRes); @@ -461,7 +461,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) __glXWindow *pGlxWindow = NULL; int rc; - rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess); if (rc != Success) { pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, __glXPixmapRes); @@ -481,7 +481,7 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) if (req->member != None) { rc = dixLookupDrawable(&pMember, req->member, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) { pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member, __glXPixmapRes); @@ -780,7 +780,7 @@ static int MakeCurrent(__GLXclientState *cl, } if (drawId != None) { - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { /* @@ -887,7 +887,7 @@ static int MakeCurrent(__GLXclientState *cl, } if (readId != None && readId != drawId ) { - rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess); + rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess); if (rc == Success) { if (pReadDraw->type == DRAWABLE_WINDOW) { /* @@ -1645,7 +1645,7 @@ static int CreateGLXPixmap(__GLXclientState *cl, #endif rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP, - DixUnknownAccess); + DixAddAccess); if (rc != Success) return rc; @@ -1779,7 +1779,7 @@ static int CreateGLXPixmap(__GLXclientState *cl, #ifdef PANORAMIX if (pXinDraw) { dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0, - DixUnknownAccess); + DixAddAccess); } #endif @@ -1950,7 +1950,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) /* ** Check that the GLX drawable is valid. */ - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); if (rc == Success) { from_screen = to_screen = pDraw->pScreen->myNum; @@ -2104,7 +2104,7 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) /* ** Check that the GLX drawable is valid. */ - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); if (rc == Success) { if (pDraw->type != DRAWABLE_WINDOW) { /* @@ -2893,7 +2893,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc) ** Check if windowId is valid */ rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW, - DixUnknownAccess); + DixAddAccess); if (rc != Success) return rc; @@ -3277,7 +3277,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #endif if (drawId != None) { - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr)pDraw; @@ -3438,7 +3438,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #endif if (drawId != None) { - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess); if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { WindowPtr pWin = (WindowPtr)pDraw; diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c index 4a9d8e1f1..49d5eb6d4 100644 --- a/hw/xquartz/pseudoramiX.c +++ b/hw/xquartz/pseudoramiX.c @@ -179,7 +179,7 @@ static int ProcPseudoramiXGetState(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -206,7 +206,7 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -233,7 +233,7 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 896f61fb5..240fca27a 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -122,7 +122,7 @@ ProcRRXineramaGetState(ClientPtr client) Bool active = FALSE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if(rc != Success) return rc; @@ -184,7 +184,7 @@ ProcRRXineramaGetScreenCount(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -211,7 +211,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client) register int n, rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; From 5675ae1f72145e9b719c613023da525731b42461 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 28 Feb 2008 18:12:52 -0500 Subject: [PATCH 009/183] XACE: Call the creation hook to properly label COMPOSITE window pixmaps. --- composite/compext.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composite/compext.c b/composite/compext.c index 2918556f8..97ea6d616 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -291,6 +291,12 @@ ProcCompositeNameWindowPixmap (ClientPtr client) ++pPixmap->refcnt; + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, + pPixmap, RT_WINDOW, pWin, DixCreateAccess); + if (rc != Success) + return rc; + if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap)) return BadAlloc; From 4d91b1d5e422c5c460b1b7050baa9487a59b8aa8 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 28 Feb 2008 21:52:32 -0500 Subject: [PATCH 010/183] XACE: Adjust the location of the COMPOSITE creation hook. Avoids incrementing the refcnt if the hook fails. --- composite/compext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composite/compext.c b/composite/compext.c index 97ea6d616..b3433f72b 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -289,14 +289,14 @@ ProcCompositeNameWindowPixmap (ClientPtr client) if (!pPixmap) return BadMatch; - ++pPixmap->refcnt; - /* security creation/labeling check */ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP, pPixmap, RT_WINDOW, pWin, DixCreateAccess); if (rc != Success) return rc; + ++pPixmap->refcnt; + if (!AddResource (stuff->pixmap, RT_PIXMAP, (pointer) pPixmap)) return BadAlloc; From 3fb17a3e647e926688c91a49a9b5b97f37dbc367 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 28 Feb 2008 21:52:57 -0500 Subject: [PATCH 011/183] xselinux: Log messages to both libaudit and Xorg.0.log. --- Xext/xselinux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 98e1ec563..3aa62e2c6 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -497,6 +497,7 @@ SELinuxLog(int type, const char *fmt, ...) vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap); rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0); va_end(ap); + LogMessageVerb(X_WARNING, 0, "%s", buf); return 0; } From d04ea267a4a51c16088d9ef429681a1edde536b1 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 28 Feb 2008 21:53:16 -0500 Subject: [PATCH 012/183] xselinux: Don't require device "read" permission for XQueryPointer. These keyboard and pointer state polling calls are a real problem. --- Xext/xselinux.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 3aa62e2c6..9adc93195 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -532,6 +532,17 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) dsubj->sid = subj->sid; } + /* XXX only check read permission on XQueryKeymap */ + /* This is to allow the numerous apps that call XQueryPointer to work */ + if (rec->access_mode & DixReadAccess) { + ClientPtr client = rec->client; + REQUEST(xReq); + if (stuff && stuff->reqType != X_QueryKeymap) { + rec->access_mode &= ~DixReadAccess; + rec->access_mode |= DixGetAttrAccess; + } + } + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DEVICE, rec->access_mode, &auditdata); if (rc != Success) From 13bfa5937d43392f686b76a99ea6331e3dce5987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 29 Feb 2008 15:10:36 -0500 Subject: [PATCH 013/183] GLX: Adjust to changes in DRI driver interface. --- GL/glx/glxdri.c | 32 ++++++++++++++++++++++------ GL/glx/glxdri2.c | 48 ++++++++++++++---------------------------- hw/xfree86/dri2/dri2.c | 10 --------- hw/xfree86/dri2/dri2.h | 4 ---- 4 files changed, 41 insertions(+), 53 deletions(-) diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index f9b28e427..dc15b0fcc 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -828,18 +828,38 @@ static void __glXReportDamage(__DRIdrawable *driDraw, } /* Table of functions that we export to the driver. */ -static const __DRIinterfaceMethods interface_methods = { +static const __DRIcontextModesExtension contextModesExtension = { + { __DRI_CONTEXT_MODES, __DRI_CONTEXT_MODES_VERSION }, _gl_context_modes_create, _gl_context_modes_destroy, +}; - getDrawableInfo, - +static const __DRIsystemTimeExtension systemTimeExtension = { + { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION }, getUST, - NULL, /* glXGetMscRateOML, */ + NULL, +}; +static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = { + { __DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION }, + getDrawableInfo +}; + +static const __DRIdamageExtension damageExtension = { + { __DRI_DAMAGE, __DRI_DAMAGE_VERSION }, __glXReportDamage, }; +static const __DRIextension *loader_extensions[] = { + &contextModesExtension.base, + &systemTimeExtension.base, + &getDrawableInfoExtension.base, + &damageExtension.base, + NULL +}; + + + static const char dri_driver_path[] = DRI_DRIVER_PATH; static Bool @@ -926,7 +946,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __DRIframebuffer framebuffer; int fd = -1; int status; - int api_ver = 20070121; drm_magic_t magic; drmVersionPtr version; int newlyopened; @@ -1091,8 +1110,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) &framebuffer, pSAREA, fd, - api_ver, - &interface_methods, + loader_extensions, &screen->base.fbconfigs); if (screen->driScreen.private == NULL) { diff --git a/GL/glx/glxdri2.c b/GL/glx/glxdri2.c index d1c8d417e..b0082a040 100644 --- a/GL/glx/glxdri2.c +++ b/GL/glx/glxdri2.c @@ -414,18 +414,30 @@ static void __glXReportDamage(__DRIdrawable *driDraw, } /* Table of functions that we export to the driver. */ -static const __DRIinterfaceMethods interface_methods = { +static const __DRIcontextModesExtension contextModesExtension = { + { __DRI_CONTEXT_MODES, __DRI_CONTEXT_MODES_VERSION }, _gl_context_modes_create, _gl_context_modes_destroy, +}; - NULL, - +static const __DRIsystemTimeExtension systemTimeExtension = { + { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION }, getUST, NULL, +}; +static const __DRIdamageExtension damageExtension = { + { __DRI_DAMAGE, __DRI_DAMAGE_VERSION }, __glXReportDamage, }; +static const __DRIextension *loader_extensions[] = { + &contextModesExtension.base, + &systemTimeExtension.base, + &damageExtension.base, + NULL +}; + static const char dri_driver_path[] = DRI_DRIVER_PATH; static Bool @@ -502,10 +514,6 @@ static __GLXscreen * __glXDRIscreenProbe(ScreenPtr pScreen) { __DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen; - __DRIversion ddx_version; - __DRIversion dri_version; - __DRIversion drm_version; - drmVersionPtr version; const char *driverName; __GLXDRIscreen *screen; char filename[128]; @@ -522,9 +530,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) !DRI2Connect(pScreen, &screen->fd, &driverName, - &ddx_version.major, - &ddx_version.minor, - &ddx_version.patch, &sareaHandle)) { LogMessage(X_INFO, "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum); @@ -539,24 +544,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXInitExtensionEnableBits(screen->glx_enable_bits); - /* DRI protocol version. */ - dri_version.major = XF86DRI_MAJOR_VERSION; - dri_version.minor = XF86DRI_MINOR_VERSION; - dri_version.patch = XF86DRI_PATCH_VERSION; - - version = drmGetVersion(screen->fd); - if (version) { - drm_version.major = version->version_major; - drm_version.minor = version->version_minor; - drm_version.patch = version->version_patchlevel; - drmFreeVersion(version); - } - else { - drm_version.major = -1; - drm_version.minor = -1; - drm_version.patch = -1; - } - snprintf(filename, sizeof filename, "%s/%s_dri.so", dri_driver_path, driverName); @@ -577,12 +564,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->driScreen.private = (*createNewScreen)(pScreen->myNum, &screen->driScreen, - &ddx_version, - &dri_version, - &drm_version, screen->fd, sareaHandle, - &interface_methods, + loader_extensions, &screen->base.fbconfigs); if (screen->driScreen.private == NULL) { diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 3bc533ede..9b4c18c61 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -58,9 +58,6 @@ typedef struct _DRI2Screen { void *sarea; unsigned int sareaSize; const char *driverName; - int ddxVersionMajor; - int ddxVersionMinor; - int ddxVersionPatch; __DRIEventBuffer *buffer; int locked; @@ -330,7 +327,6 @@ DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw) Bool DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName, - int *ddxMajor, int *ddxMinor, int *ddxPatch, unsigned int *sareaHandle) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); @@ -340,9 +336,6 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName, *fd = ds->fd; *driverName = ds->driverName; - *ddxMajor = ds->ddxVersionMajor; - *ddxMinor = ds->ddxVersionMinor; - *ddxPatch = ds->ddxVersionPatch; *sareaHandle = ds->sareaBO.handle; return TRUE; @@ -406,9 +399,6 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->fd = info->fd; ds->driverName = info->driverName; - ds->ddxVersionMajor = info->ddxVersionMajor; - ds->ddxVersionMinor = info->ddxVersionMinor; - ds->ddxVersionPatch = info->ddxVersionPatch; ds->getPixmapHandle = info->getPixmapHandle; ds->beginClipNotify = info->beginClipNotify; diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index c687a93f6..c8482477e 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -43,7 +43,6 @@ typedef struct { int fd; size_t driverSareaSize; const char *driverName; - int ddxVersionMajor, ddxVersionMinor, ddxVersionPatch; DRI2GetPixmapHandleProcPtr getPixmapHandle; DRI2BeginClipNotifyProcPtr beginClipNotify; DRI2EndClipNotifyProcPtr endClipNotify; @@ -57,9 +56,6 @@ void DRI2CloseScreen(ScreenPtr pScreen); Bool DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName, - int *ddxMajor, - int *ddxMinor, - int *ddxPatch, unsigned int *sareaHandle); unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap, From 8ac19d16a030ec416e30d3650cf43e024ada167f Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 21:58:21 -0500 Subject: [PATCH 014/183] Add several comments documenting our EDID failures. --- hw/xfree86/modes/xf86EdidModes.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index a1bdb0b99..39328398f 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -264,7 +264,22 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing, } /* + * This is not really correct. Appendix B of the EDID 1.4 spec defines + * the right thing to do here. If the timing given here matches a mode + * defined in the VESA DMT standard, we _must_ use that. If the device + * supports CVT modes, then we should generate a CVT timing. If both + * of the above fail, use GTF. * + * There are some wrinkles here. EDID 1.1 and 1.0 sinks can't really + * "support" GTF, since it wasn't a standard yet; so if they ask for a + * timing in this section that isn't defined in DMT, returning a GTF mode + * may not actually be valid. EDID 1.3 sinks often report support for + * some CVT modes, but they are not required to support CVT timings for + * modes in the standard timing descriptor, so we should _not_ treat them + * as CVT-compliant (unless specified in an extension block I suppose). + * + * EDID 1.4 requires that all sink devices support both GTF and CVT timings + * for modes in this section, but does say that CVT is preferred. */ static DisplayModePtr DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing, @@ -405,7 +420,11 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) /* - * + * This is only valid when the sink claims to be continuous-frequency + * but does not supply a detailed range descriptor. Such sinks are + * arguably broken. Currently the mode validation code isn't aware of + * this; the non-RANDR code even punts the decision of optional sync + * range checking to the driver. Loss. */ static void DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes) @@ -623,10 +642,12 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC) Monitor->widthmm = 10 * DDC->features.hsize; Monitor->heightmm = 10 * DDC->features.vsize; - /* If this is a digital display, then we can use reduced blanking */ + /* + * If this is a digital display, then we can use reduced blanking. + * XXX This is a 1.3 heuristic. 1.4 explicitly defines rb support. + */ if (DDC->features.input_type) Monitor->reducedblanking = TRUE; - /* Allow the user to also enable this through config */ Modes = xf86DDCGetModes(scrnIndex, DDC); From fd41f46ac62033a724bd1f4612f19448a21c1224 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 22:38:21 -0500 Subject: [PATCH 015/183] Allow xf86DuplicateMode() to work correctly on read-only modes. Before this it was meaningless to try to mark DisplayModeRec tables const, since the mode name would be emitted as a pointer to an anonymous string constant, and therefore would have to be fixed up by ld.so and so couldn't live in .rodata. With this change the standard mode lists can live in .rodata, and modes duplicated from them will have their names filled in on the fly. --- hw/xfree86/modes/xf86Modes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 3d222cc73..d6aa61aaf 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -214,10 +214,8 @@ xf86DuplicateMode(DisplayModePtr pMode) *pNew = *pMode; pNew->next = NULL; pNew->prev = NULL; - if (pNew->name == NULL) { - xf86SetModeDefaultName(pMode); - } - pNew->name = xnfstrdup(pMode->name); + if (pNew->name == NULL) + xf86SetModeDefaultName(pNew); return pNew; } From 85617b56e5e00e7b8c7d8ce5b49af289056921a7 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 22:55:37 -0500 Subject: [PATCH 016/183] Remove some #if 0 guarding code duplicated in xf86Modes.c --- hw/xfree86/common/xf86Mode.c | 140 ----------------------------------- 1 file changed, 140 deletions(-) diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index fb899a1e4..c1b0a5fc9 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -636,146 +636,6 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, return MODE_OK; } - -#if 0 -/* - * xf86SetModeCrtc - * - * Initialises the Crtc parameters for a mode. The initialisation includes - * adjustments for interlaced and double scan modes. - */ -_X_EXPORT void -xf86SetModeCrtc(DisplayModePtr p, int adjustFlags) -{ - if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN)) - return; - - p->CrtcHDisplay = p->HDisplay; - p->CrtcHSyncStart = p->HSyncStart; - p->CrtcHSyncEnd = p->HSyncEnd; - p->CrtcHTotal = p->HTotal; - p->CrtcHSkew = p->HSkew; - p->CrtcVDisplay = p->VDisplay; - p->CrtcVSyncStart = p->VSyncStart; - p->CrtcVSyncEnd = p->VSyncEnd; - p->CrtcVTotal = p->VTotal; - if (p->Flags & V_INTERLACE) { - if (adjustFlags & INTERLACE_HALVE_V) { - p->CrtcVDisplay /= 2; - p->CrtcVSyncStart /= 2; - p->CrtcVSyncEnd /= 2; - p->CrtcVTotal /= 2; - } - /* Force interlaced modes to have an odd VTotal */ - /* maybe we should only do this when INTERLACE_HALVE_V is set? */ - p->CrtcVTotal |= 1; - } - - if (p->Flags & V_DBLSCAN) { - p->CrtcVDisplay *= 2; - p->CrtcVSyncStart *= 2; - p->CrtcVSyncEnd *= 2; - p->CrtcVTotal *= 2; - } - if (p->VScan > 1) { - p->CrtcVDisplay *= p->VScan; - p->CrtcVSyncStart *= p->VScan; - p->CrtcVSyncEnd *= p->VScan; - p->CrtcVTotal *= p->VScan; - } - p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay); - p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal); - p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay); - p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal); - - p->CrtcHAdjusted = FALSE; - p->CrtcVAdjusted = FALSE; -} -#endif - -#if 0 -/** - * Allocates and returns a copy of pMode, including pointers within pMode. - */ -_X_EXPORT DisplayModePtr -xf86DuplicateMode(DisplayModePtr pMode) -{ - DisplayModePtr pNew; - - pNew = xnfalloc(sizeof(DisplayModeRec)); - *pNew = *pMode; - pNew->next = NULL; - pNew->prev = NULL; - if (pNew->name == NULL) { - xf86SetModeDefaultName(pMode); - } else { - pNew->name = xnfstrdup(pMode->name); - } - - return pNew; -} - -/** - * Duplicates every mode in the given list and returns a pointer to the first - * mode. - * - * \param modeList doubly-linked mode list - */ -_X_EXPORT DisplayModePtr -xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList) -{ - DisplayModePtr first = NULL, last = NULL; - DisplayModePtr mode; - - for (mode = modeList; mode != NULL; mode = mode->next) { - DisplayModePtr new; - - new = xf86DuplicateMode(mode); - - /* Insert pNew into modeList */ - if (last) { - last->next = new; - new->prev = last; - } else { - first = new; - new->prev = NULL; - } - new->next = NULL; - last = new; - } - - return first; -} - -/** - * Returns true if the given modes should program to the same timings. - * - * This doesn't use Crtc values, as it might be used on ModeRecs without the - * Crtc values set. So, it's assumed that the other numbers are enough. - */ -_X_EXPORT Bool -xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2) -{ - if (pMode1->Clock == pMode2->Clock && - pMode1->HDisplay == pMode2->HDisplay && - pMode1->HSyncStart == pMode2->HSyncStart && - pMode1->HSyncEnd == pMode2->HSyncEnd && - pMode1->HTotal == pMode2->HTotal && - pMode1->HSkew == pMode2->HSkew && - pMode1->VDisplay == pMode2->VDisplay && - pMode1->VSyncStart == pMode2->VSyncStart && - pMode1->VSyncEnd == pMode2->VSyncEnd && - pMode1->VTotal == pMode2->VTotal && - pMode1->VScan == pMode2->VScan && - pMode1->Flags == pMode2->Flags) - { - return TRUE; - } else { - return FALSE; - } -} -#endif - /* * xf86CheckModeForMonitor * From 6828d8fc2b464e0755f46e3fbdeb07be0c38b620 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 22:57:42 -0500 Subject: [PATCH 017/183] Clean up DisplayModeRec handling in many places. Use xf86DuplicateMode() instead of rolling our own, and change malloc+memset to calloc. --- hw/xfree86/common/xf86Config.c | 8 ++------ hw/xfree86/common/xf86cvt.c | 4 +--- hw/xfree86/fbdevhw/fbdevhw.c | 7 ++----- hw/xfree86/modes/xf86EdidModes.c | 3 +-- hw/xfree86/modes/xf86cvt.c | 4 +--- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 605c6b347..de3edf638 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -2088,8 +2088,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) */ cmodep = conf_monitor->mon_modeline_lst; while( cmodep ) { - mode = xnfalloc(sizeof(DisplayModeRec)); - memset(mode,'\0',sizeof(DisplayModeRec)); + mode = xnfcalloc(1, sizeof(DisplayModeRec)); mode->type = 0; mode->Clock = cmodep->ml_clock; mode->HDisplay = cmodep->ml_hdisplay; @@ -2426,10 +2425,7 @@ addDefaultModes(MonPtr monitorp) if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) ) do { - mode = xnfalloc(sizeof(DisplayModeRec)); - memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec)); - if (xf86DefaultModes[i].name) - mode->name = xnfstrdup(xf86DefaultModes[i].name); + mode = xf86DuplicateMode(&xf86DefaultModes[i]); if( last ) { mode->prev = last; last->next = mode; diff --git a/hw/xfree86/common/xf86cvt.c b/hw/xfree86/common/xf86cvt.c index dfb6e71e4..f8185a38c 100644 --- a/hw/xfree86/common/xf86cvt.c +++ b/hw/xfree86/common/xf86cvt.c @@ -56,7 +56,7 @@ _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced) { - DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec)); + DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); /* 1) top/bottom margin size (% of height) - default: 1.8 */ #define CVT_MARGIN_PERCENTAGE 1.8 @@ -79,8 +79,6 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, int VDisplayRnd, VMargin, VSync; float Interlace; /* Please rename this */ - memset(Mode, 0, sizeof(DisplayModeRec)); - /* CVT default is 60.0Hz */ if (!VRefresh) VRefresh = 60.0; diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index 13be7858f..a1f67486f 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -625,14 +625,11 @@ fbdevHWSetVideoModes(ScrnInfoPtr pScrn) pScrn->virtualY = mode->VDisplay; if (NULL == pScrn->modes) { - pScrn->modes = xnfalloc(sizeof(DisplayModeRec)); - this = pScrn->modes; - memcpy(this,mode,sizeof(DisplayModeRec)); + this = pScrn->modes = xf86DuplicateMode(mode); this->next = this; this->prev = this; } else { - this = xnfalloc(sizeof(DisplayModeRec)); - memcpy(this,mode,sizeof(DisplayModeRec)); + this = xf86DuplicateMode(mode); this->next = pScrn->modes; this->prev = last; last->next = this; diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 39328398f..47b984d0f 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -336,8 +336,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, " sync.\n", __func__, timing->h_active, timing->v_active); } - Mode = xnfalloc(sizeof(DisplayModeRec)); - memset(Mode, 0, sizeof(DisplayModeRec)); + Mode = xnfcalloc(1, sizeof(DisplayModeRec)); Mode->type = M_T_DRIVER; if (preferred) diff --git a/hw/xfree86/modes/xf86cvt.c b/hw/xfree86/modes/xf86cvt.c index 69ccc4259..68a94627c 100644 --- a/hw/xfree86/modes/xf86cvt.c +++ b/hw/xfree86/modes/xf86cvt.c @@ -72,7 +72,7 @@ _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced) { - DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec)); + DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); /* 1) top/bottom margin size (% of height) - default: 1.8 */ #define CVT_MARGIN_PERCENTAGE 1.8 @@ -95,8 +95,6 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, int VDisplayRnd, VMargin, VSync; float Interlace; /* Please rename this */ - memset(Mode, 0, sizeof(DisplayModeRec)); - /* CVT default is 60.0Hz */ if (!VRefresh) VRefresh = 60.0; From e65e51a99b17a0510782775f010e9820ca567fcb Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 23:19:20 -0500 Subject: [PATCH 018/183] Constify the built-in mode tables. --- hw/xfree86/common/modeline2c.awk | 16 ++++++------- hw/xfree86/common/xf86Priv.h | 2 +- hw/xfree86/modes/xf86EdidModes.c | 40 ++++++++++++++++---------------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk index d4b9649c8..b9ad3cdf9 100644 --- a/hw/xfree86/common/modeline2c.awk +++ b/hw/xfree86/common/modeline2c.awk @@ -44,8 +44,6 @@ BEGIN { flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE" flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE" - print "/* $" "XFree86$ */" - print print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at" print " * modeline2c.awk */" print "" @@ -68,12 +66,12 @@ BEGIN { print "" print "#include \"globals.h\"" print "" - print "#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT" - print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0" + print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT" + print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0" print "" - print "DisplayModeRec xf86DefaultModes [] = {" + print "const DisplayModeRec xf86DefaultModes [] = {" - modeline = "\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n" + modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n" modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+" } @@ -81,10 +79,10 @@ BEGIN { flags = $0 gsub(modeline_data, "", flags) flags = tolower(flags) - printf(modeline, $4, $8, $3 * 1000, $4, $5, $6, $7, + printf(modeline, $3 * 1000, $4, $5, $6, $7, $8, $9, $10, $11, flagsdict[flags]) # Half-width double scanned modes - printf(modeline, $4/2, $8/2, $3 * 500, $4/2, $5/2, $6/2, $7/2, + printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2, $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN") } @@ -93,5 +91,5 @@ BEGIN { } END { - printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n") + printf("\t{MODEPREFIX,0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n") } diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index fb9ecaea8..dd8b5a022 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -153,7 +153,7 @@ Bool xf86PathIsSafe(const char *path); /* xf86DefaultModes */ -extern DisplayModeRec xf86DefaultModes []; +extern const DisplayModeRec xf86DefaultModes[]; /* xf86DoProbe.c */ void DoProbe(void); diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 47b984d0f..467f03251 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -221,27 +221,27 @@ static const ddc_quirk_map_t ddc_quirks[] = { * TODO: * - for those with access to the VESA DMT standard; review please. */ -#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER -#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 +#define MODEPREFIX NULL, NULL, NULL, 0, M_T_DRIVER +#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 -static DisplayModeRec DDCEstablishedModes[17] = { - { MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */ - { MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */ - { MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */ - { MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */ - { MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */ - { MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */ - { MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */ - { MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */ - { MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */ - { MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */ - { MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */ - { MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */ - { MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */ - { MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */ - { MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */ - { MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */ - { MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */ +static const DisplayModeRec DDCEstablishedModes[17] = { + { MODEPREFIX, 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */ + { MODEPREFIX, 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */ + { MODEPREFIX, 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */ + { MODEPREFIX, 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */ + { MODEPREFIX, 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */ + { MODEPREFIX, 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */ + { MODEPREFIX, 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */ + { MODEPREFIX, 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */ + { MODEPREFIX, 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */ + { MODEPREFIX, 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */ + { MODEPREFIX, 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */ + { MODEPREFIX, 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */ + { MODEPREFIX, 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */ + { MODEPREFIX, 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */ + { MODEPREFIX, 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */ + { MODEPREFIX, 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */ + { MODEPREFIX, 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */ }; static DisplayModePtr From 4cb4817c1072e1d31333db47d95f71d08bf0d1dc Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Jan 2008 23:38:48 -0500 Subject: [PATCH 019/183] Remove the duplicate copy of xf86cvt.c --- hw/xfree86/common/Makefile.am | 2 +- hw/xfree86/common/xf86cvt.c | 290 ------------------------------- hw/xfree86/modes/xf86cvt.c | 5 - hw/xfree86/utils/cvt/Makefile.am | 6 +- 4 files changed, 5 insertions(+), 298 deletions(-) delete mode 100644 hw/xfree86/common/xf86cvt.c diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 4f0a2d6b3..0f44075ba 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -30,7 +30,7 @@ BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ - xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \ + xf86Cursor.c xf86DGA.c xf86DPMS.c \ xf86DoProbe.c xf86Events.c \ xf86Globals.c xf86AutoConfig.c \ xf86MiscExt.c xf86Option.c \ diff --git a/hw/xfree86/common/xf86cvt.c b/hw/xfree86/common/xf86cvt.c deleted file mode 100644 index f8185a38c..000000000 --- a/hw/xfree86/common/xf86cvt.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright 2005-2006 Luc Verhaegen. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * The reason for having this function in a file of its own is - * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode - * code is shared directly. - */ - -#include "xf86.h" - -/* - * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh. - * - * These calculations are stolen from the CVT calculation spreadsheet written - * by Graham Loveridge. He seems to be claiming no copyright and there seems to - * be no license attached to this. He apparently just wants to see his name - * mentioned. - * - * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls - * - * Comments and structure corresponds to the comments and structure of the xls. - * This should ease importing of future changes to the standard (not very - * likely though). - * - * About margins; i'm sure that they are to be the bit between HDisplay and - * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and - * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking - * outside sync "margin" for some reason. Since we prefer seeing proper - * blanking instead of the overscan colour, and since the Crtc* values will - * probably get altered after us, we will disable margins altogether. With - * these calculations, Margins will plainly expand H/VDisplay, and we don't - * want that. -- libv - * - */ -_X_EXPORT DisplayModePtr -xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, - Bool Interlaced) -{ - DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); - - /* 1) top/bottom margin size (% of height) - default: 1.8 */ -#define CVT_MARGIN_PERCENTAGE 1.8 - - /* 2) character cell horizontal granularity (pixels) - default 8 */ -#define CVT_H_GRANULARITY 8 - - /* 4) Minimum vertical porch (lines) - default 3 */ -#define CVT_MIN_V_PORCH 3 - - /* 4) Minimum number of vertical back porch lines - default 6 */ -#define CVT_MIN_V_BPORCH 6 - - /* Pixel Clock step (kHz) */ -#define CVT_CLOCK_STEP 250 - - Bool Margins = FALSE; - float VFieldRate, HPeriod; - int HDisplayRnd, HMargin; - int VDisplayRnd, VMargin, VSync; - float Interlace; /* Please rename this */ - - /* CVT default is 60.0Hz */ - if (!VRefresh) - VRefresh = 60.0; - - /* 1. Required field rate */ - if (Interlaced) - VFieldRate = VRefresh * 2; - else - VFieldRate = VRefresh; - - /* 2. Horizontal pixels */ - HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY); - - /* 3. Determine left and right borders */ - if (Margins) { - /* right margin is actually exactly the same as left */ - HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); - HMargin -= HMargin % CVT_H_GRANULARITY; - } else - HMargin = 0; - - /* 4. Find total active pixels */ - Mode->HDisplay = HDisplayRnd + 2*HMargin; - - /* 5. Find number of lines per field */ - if (Interlaced) - VDisplayRnd = VDisplay / 2; - else - VDisplayRnd = VDisplay; - - /* 6. Find top and bottom margins */ - /* nope. */ - if (Margins) - /* top and bottom margins are equal again. */ - VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0); - else - VMargin = 0; - - Mode->VDisplay = VDisplay + 2*VMargin; - - /* 7. Interlace */ - if (Interlaced) - Interlace = 0.5; - else - Interlace = 0.0; - - /* Determine VSync Width from aspect ratio */ - if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) - VSync = 4; - else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) - VSync = 5; - else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) - VSync = 6; - else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) - VSync = 7; - else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)) - VSync = 7; - else /* Custom */ - VSync = 10; - - if (!Reduced) { /* simplified GTF calculation */ - - /* 4) Minimum time of vertical sync + back porch interval (µs) - * default 550.0 */ -#define CVT_MIN_VSYNC_BP 550.0 - - /* 3) Nominal HSync width (% of line period) - default 8 */ -#define CVT_HSYNC_PERCENTAGE 8 - - float HBlankPercentage; - int VSyncAndBackPorch, VBackPorch; - int HBlank; - - /* 8. Estimated Horizontal period */ - HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) / - (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace); - - /* 9. Find number of lines in sync + backporch */ - if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH)) - VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH; - else - VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1; - - /* 10. Find number of lines in back porch */ - VBackPorch = VSyncAndBackPorch - VSync; - - /* 11. Find total number of lines in vertical field */ - Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace - + CVT_MIN_V_PORCH; - - /* 5) Definition of Horizontal blanking time limitation */ - /* Gradient (%/kHz) - default 600 */ -#define CVT_M_FACTOR 600 - - /* Offset (%) - default 40 */ -#define CVT_C_FACTOR 40 - - /* Blanking time scaling factor - default 128 */ -#define CVT_K_FACTOR 128 - - /* Scaling factor weighting - default 20 */ -#define CVT_J_FACTOR 20 - -#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256 -#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \ - CVT_J_FACTOR - - /* 12. Find ideal blanking duty cycle from formula */ - HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0; - - /* 13. Blanking time */ - if (HBlankPercentage < 20) - HBlankPercentage = 20; - - HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage); - HBlank -= HBlank % (2*CVT_H_GRANULARITY); - - /* 14. Find total number of pixels in a line. */ - Mode->HTotal = Mode->HDisplay + HBlank; - - /* Fill in HSync values */ - Mode->HSyncEnd = Mode->HDisplay + HBlank / 2; - - Mode->HSyncStart = Mode->HSyncEnd - - (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100; - Mode->HSyncStart += CVT_H_GRANULARITY - - Mode->HSyncStart % CVT_H_GRANULARITY; - - /* Fill in VSync values */ - Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH; - Mode->VSyncEnd = Mode->VSyncStart + VSync; - - } else { /* Reduced blanking */ - /* Minimum vertical blanking interval time (µs) - default 460 */ -#define CVT_RB_MIN_VBLANK 460.0 - - /* Fixed number of clocks for horizontal sync */ -#define CVT_RB_H_SYNC 32.0 - - /* Fixed number of clocks for horizontal blanking */ -#define CVT_RB_H_BLANK 160.0 - - /* Fixed number of lines for vertical front porch - default 3 */ -#define CVT_RB_VFPORCH 3 - - int VBILines; - - /* 8. Estimate Horizontal period. */ - HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) / - (VDisplayRnd + 2*VMargin); - - /* 9. Find number of lines in vertical blanking */ - VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1; - - /* 10. Check if vertical blanking is sufficient */ - if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH)) - VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH; - - /* 11. Find total number of lines in vertical field */ - Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines; - - /* 12. Find total number of pixels in a line */ - Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK; - - /* Fill in HSync values */ - Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2; - Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC; - - /* Fill in VSync values */ - Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH; - Mode->VSyncEnd = Mode->VSyncStart + VSync; - } - - /* 15/13. Find pixel clock frequency (kHz for xf86) */ - Mode->Clock = Mode->HTotal * 1000.0 / HPeriod; - Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP; - - /* 16/14. Find actual Horizontal Frequency (kHz) */ - Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal); - - /* 17/15. Find actual Field rate */ - Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) / - ((float) (Mode->HTotal * Mode->VTotal)); - - /* 18/16. Find actual vertical frame frequency */ - /* ignore - just set the mode flag for interlaced */ - if (Interlaced) - Mode->VTotal *= 2; - - { - char Name[256]; - Name[0] = 0; - - snprintf(Name, 256, "%dx%d", HDisplay, VDisplay); - - Mode->name = xnfalloc(strlen(Name) + 1); - memcpy(Mode->name, Name, strlen(Name) + 1); - } - - if (Reduced) - Mode->Flags |= V_PHSYNC | V_NVSYNC; - else - Mode->Flags |= V_NHSYNC | V_PVSYNC; - - if (Interlaced) - Mode->Flags |= V_INTERLACE; - - return Mode; -} diff --git a/hw/xfree86/modes/xf86cvt.c b/hw/xfree86/modes/xf86cvt.c index 68a94627c..e9c74aa62 100644 --- a/hw/xfree86/modes/xf86cvt.c +++ b/hw/xfree86/modes/xf86cvt.c @@ -20,11 +20,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -/** - * @file This is a copy of xf86cvt.c from the X Server, for compatibility with - * old servers (pre-1.2). - */ - /* * The reason for having this function in a file of its own is * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode diff --git a/hw/xfree86/utils/cvt/Makefile.am b/hw/xfree86/utils/cvt/Makefile.am index 365c6cb88..4db175fbd 100644 --- a/hw/xfree86/utils/cvt/Makefile.am +++ b/hw/xfree86/utils/cvt/Makefile.am @@ -28,11 +28,13 @@ bin_PROGRAMS = cvt -INCLUDES = $(XORG_INCS) +INCLUDES = $(XORG_INCS) \ + -I$(top_srcdir)/hw/xfree86/ddc \ + -I$(top_srcdir)/hw/xfree86/parser DUMMYLIB_SRCDIR = $(XFREE86_SRCDIR)/dummylib # gah -cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/common/xf86cvt.c +cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) cvt_LDADD = $(top_builddir)/hw/xfree86/dummylib/libdummy-nonserver.a From ca5625b911e65fdfd410247b3eff57fedcfc1f79 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 12 Jan 2008 00:08:00 -0500 Subject: [PATCH 020/183] Add xf86GTFMode(). This should probably be shared like xf86CVTMode(). --- hw/xfree86/loader/xf86sym.c | 1 + hw/xfree86/modes/Makefile.am | 1 + hw/xfree86/modes/xf86Modes.h | 1 + hw/xfree86/modes/xf86gtf.c | 384 +++++++++++++++++++++++++++++++++++ 4 files changed, 387 insertions(+) create mode 100644 hw/xfree86/modes/xf86gtf.c diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 754e9c06b..50a19b916 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -949,6 +949,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86CrtcSetSizeRange) SYMFUNC(xf86CrtcScreenInit) SYMFUNC(xf86CVTMode) + SYMFUNC(xf86GTFMode) SYMFUNC(xf86DisableUnusedFunctions) SYMFUNC(xf86DPMSSet) SYMFUNC(xf86DuplicateMode) diff --git a/hw/xfree86/modes/Makefile.am b/hw/xfree86/modes/Makefile.am index 6ee85757a..331e4061c 100644 --- a/hw/xfree86/modes/Makefile.am +++ b/hw/xfree86/modes/Makefile.am @@ -5,6 +5,7 @@ libxf86modes_a_SOURCES = \ xf86Crtc.h \ xf86Cursors.c \ xf86cvt.c \ + xf86gtf.c \ xf86DiDGA.c \ xf86EdidModes.c \ xf86Modes.c \ diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index 9ad5ee653..5d49c9314 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -62,6 +62,7 @@ DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC); DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, Bool Interlaced); +DisplayModePtr xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins); void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, diff --git a/hw/xfree86/modes/xf86gtf.c b/hw/xfree86/modes/xf86gtf.c new file mode 100644 index 000000000..acbac83b6 --- /dev/null +++ b/hw/xfree86/modes/xf86gtf.c @@ -0,0 +1,384 @@ +/* + * gtf.c Generate mode timings using the GTF Timing Standard + * + * gcc gtf.c -o gtf -lm -Wall + * + * Copyright (c) 2001, Andy Ritger aritger@nvidia.com + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * o 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. + * o Neither the name of NVIDIA 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 REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * This program is based on the Generalized Timing Formula(GTF TM) + * Standard Version: 1.0, Revision: 1.0 + * + * The GTF Document contains the following Copyright information: + * + * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards + * Association. Duplication of this document within VESA member + * companies for review purposes is permitted. All other rights + * reserved. + * + * While every precaution has been taken in the preparation + * of this standard, the Video Electronics Standards Association and + * its contributors assume no responsibility for errors or omissions, + * and make no warranties, expressed or implied, of functionality + * of suitability for any purpose. The sample code contained within + * this standard may be used without restriction. + * + * + * + * The GTF EXCEL(TM) SPREADSHEET, a sample (and the definitive) + * implementation of the GTF Timing Standard, is available at: + * + * ftp://ftp.vesa.org/pub/GTF/GTF_V1R1.xls + */ + +/* Ruthlessly converted to server code by Adam Jackson */ + +#ifdef HAVE_XORG_CONFIG_H +# include +#endif + +#include "xf86.h" +#include "xf86Modes.h" +#include + +#define MARGIN_PERCENT 1.8 /* % of active vertical image */ +#define CELL_GRAN 8.0 /* assumed character cell granularity */ +#define MIN_PORCH 1 /* minimum front porch */ +#define V_SYNC_RQD 3 /* width of vsync in lines */ +#define H_SYNC_PERCENT 8.0 /* width of hsync as % of total line */ +#define MIN_VSYNC_PLUS_BP 550.0 /* min time of vsync + back porch (microsec) */ +#define M 600.0 /* blanking formula gradient */ +#define C 40.0 /* blanking formula offset */ +#define K 128.0 /* blanking formula scaling factor */ +#define J 20.0 /* blanking formula scaling factor */ + +/* C' and M' are part of the Blanking Duty Cycle computation */ + +#define C_PRIME (((C - J) * K/256.0) + J) +#define M_PRIME (K/256.0 * M) + + +/* + * xf86GTFMode() - as defined by the GTF Timing Standard, compute the + * Stage 1 Parameters using the vertical refresh frequency. In other + * words: input a desired resolution and desired refresh rate, and + * output the GTF mode timings. + * + * XXX All the code is in place to compute interlaced modes, but I don't + * feel like testing it right now. + * + * XXX margin computations are implemented but not tested (nor used by + * XServer of fbset mode descriptions, from what I can tell). + */ + +_X_EXPORT DisplayModePtr +xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins) +{ + DisplayModeRec *mode = xnfcalloc(1, sizeof(DisplayModeRec)); + + float h_pixels_rnd; + float v_lines_rnd; + float v_field_rate_rqd; + float top_margin; + float bottom_margin; + float interlace; + float h_period_est; + float vsync_plus_bp; + float v_back_porch; + float total_v_lines; + float v_field_rate_est; + float h_period; + float v_field_rate; + float v_frame_rate; + float left_margin; + float right_margin; + float total_active_pixels; + float ideal_duty_cycle; + float h_blank; + float total_pixels; + float pixel_freq; + float h_freq; + + float h_sync; + float h_front_porch; + float v_odd_front_porch_lines; + + /* 1. In order to give correct results, the number of horizontal + * pixels requested is first processed to ensure that it is divisible + * by the character size, by rounding it to the nearest character + * cell boundary: + * + * [H PIXELS RND] = ((ROUND([H PIXELS]/[CELL GRAN RND],0))*[CELLGRAN RND]) + */ + + h_pixels_rnd = rint((float) h_pixels / CELL_GRAN) * CELL_GRAN; + + /* 2. If interlace is requested, the number of vertical lines assumed + * by the calculation must be halved, as the computation calculates + * the number of vertical lines per field. In either case, the + * number of lines is rounded to the nearest integer. + * + * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0), + * ROUND([V LINES],0)) + */ + + v_lines_rnd = interlaced ? + rint((float) v_lines) / 2.0 : + rint((float) v_lines); + + /* 3. Find the frame rate required: + * + * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2, + * [I/P FREQ RQD]) + */ + + v_field_rate_rqd = interlaced ? (freq * 2.0) : (freq); + + /* 4. Find number of lines in Top margin: + * + * [TOP MARGIN (LINES)] = IF([MARGINS RQD?]="Y", + * ROUND(([MARGIN%]/100*[V LINES RND]),0), + * 0) + */ + + top_margin = margins ? rint(MARGIN_PERCENT / 100.0 * v_lines_rnd) : (0.0); + + /* 5. Find number of lines in Bottom margin: + * + * [BOT MARGIN (LINES)] = IF([MARGINS RQD?]="Y", + * ROUND(([MARGIN%]/100*[V LINES RND]),0), + * 0) + */ + + bottom_margin = margins ? rint(MARGIN_PERCENT/100.0 * v_lines_rnd) : (0.0); + + /* 6. If interlace is required, then set variable [INTERLACE]=0.5: + * + * [INTERLACE]=(IF([INT RQD?]="y",0.5,0)) + */ + + interlace = interlaced ? 0.5 : 0.0; + + /* 7. Estimate the Horizontal period + * + * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) / + * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) + + * [MIN PORCH RND]+[INTERLACE]) * 1000000 + */ + + h_period_est = (((1.0/v_field_rate_rqd) - (MIN_VSYNC_PLUS_BP/1000000.0)) + / (v_lines_rnd + (2*top_margin) + MIN_PORCH + interlace) + * 1000000.0); + + /* 8. Find the number of lines in V sync + back porch: + * + * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0) + */ + + vsync_plus_bp = rint(MIN_VSYNC_PLUS_BP/h_period_est); + + /* 9. Find the number of lines in V back porch alone: + * + * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND] + * + * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]? + */ + + v_back_porch = vsync_plus_bp - V_SYNC_RQD; + + /* 10. Find the total number of lines in Vertical field period: + * + * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] + + * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] + + * [MIN PORCH RND] + */ + + total_v_lines = v_lines_rnd + top_margin + bottom_margin + vsync_plus_bp + + interlace + MIN_PORCH; + + /* 11. Estimate the Vertical field frequency: + * + * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000 + */ + + v_field_rate_est = 1.0 / h_period_est / total_v_lines * 1000000.0; + + /* 12. Find the actual horizontal period: + * + * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST]) + */ + + h_period = h_period_est / (v_field_rate_rqd / v_field_rate_est); + + /* 13. Find the actual Vertical field frequency: + * + * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000 + */ + + v_field_rate = 1.0 / h_period / total_v_lines * 1000000.0; + + /* 14. Find the Vertical frame frequency: + * + * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE])) + */ + + v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate; + + /* 15. Find number of pixels in left margin: + * + * [LEFT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", + * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / + * [CELL GRAN RND]),0)) * [CELL GRAN RND], + * 0)) + */ + + left_margin = margins ? + rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : + 0.0; + + /* 16. Find number of pixels in right margin: + * + * [RIGHT MARGIN (PIXELS)] = (IF( [MARGINS RQD?]="Y", + * (ROUND( ([H PIXELS RND] * [MARGIN%] / 100 / + * [CELL GRAN RND]),0)) * [CELL GRAN RND], + * 0)) + */ + + right_margin = margins ? + rint(h_pixels_rnd * MARGIN_PERCENT / 100.0 / CELL_GRAN) * CELL_GRAN : + 0.0; + + /* 17. Find total number of active pixels in image and left and right + * margins: + * + * [TOTAL ACTIVE PIXELS] = [H PIXELS RND] + [LEFT MARGIN (PIXELS)] + + * [RIGHT MARGIN (PIXELS)] + */ + + total_active_pixels = h_pixels_rnd + left_margin + right_margin; + + /* 18. Find the ideal blanking duty cycle from the blanking duty cycle + * equation: + * + * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000) + */ + + ideal_duty_cycle = C_PRIME - (M_PRIME * h_period / 1000.0); + + /* 19. Find the number of pixels in the blanking time to the nearest + * double character cell: + * + * [H BLANK (PIXELS)] = (ROUND(([TOTAL ACTIVE PIXELS] * + * [IDEAL DUTY CYCLE] / + * (100-[IDEAL DUTY CYCLE]) / + * (2*[CELL GRAN RND])), 0)) + * * (2*[CELL GRAN RND]) + */ + + h_blank = rint(total_active_pixels * + ideal_duty_cycle / + (100.0 - ideal_duty_cycle) / + (2.0 * CELL_GRAN)) * (2.0 * CELL_GRAN); + + /* 20. Find total number of pixels: + * + * [TOTAL PIXELS] = [TOTAL ACTIVE PIXELS] + [H BLANK (PIXELS)] + */ + + total_pixels = total_active_pixels + h_blank; + + /* 21. Find pixel clock frequency: + * + * [PIXEL FREQ] = [TOTAL PIXELS] / [H PERIOD] + */ + + pixel_freq = total_pixels / h_period; + + /* 22. Find horizontal frequency: + * + * [H FREQ] = 1000 / [H PERIOD] + */ + + h_freq = 1000.0 / h_period; + + + /* Stage 1 computations are now complete; I should really pass + the results to another function and do the Stage 2 + computations, but I only need a few more values so I'll just + append the computations here for now */ + + + /* 17. Find the number of pixels in the horizontal sync period: + * + * [H SYNC (PIXELS)] =(ROUND(([H SYNC%] / 100 * [TOTAL PIXELS] / + * [CELL GRAN RND]),0))*[CELL GRAN RND] + */ + + h_sync = rint(H_SYNC_PERCENT/100.0 * total_pixels / CELL_GRAN) * CELL_GRAN; + + /* 18. Find the number of pixels in the horizontal front porch period: + * + * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)] + */ + + h_front_porch = (h_blank / 2.0) - h_sync; + + /* 36. Find the number of lines in the odd front porch period: + * + * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE]) + */ + + v_odd_front_porch_lines = MIN_PORCH + interlace; + + /* finally, pack the results in the mode struct */ + + mode->HDisplay = (int) (h_pixels_rnd); + mode->HSyncStart = (int) (h_pixels_rnd + h_front_porch); + mode->HSyncEnd = (int) (h_pixels_rnd + h_front_porch + h_sync); + mode->HTotal = (int) (total_pixels); + mode->VDisplay = (int) (v_lines_rnd); + mode->VSyncStart = (int) (v_lines_rnd + v_odd_front_porch_lines); + mode->VSyncEnd = (int) (v_lines_rnd + v_odd_front_porch_lines + V_SYNC_RQD); + mode->VTotal = (int) (total_v_lines); + + mode->Clock = (int) (pixel_freq * 1000.0); + mode->HSync = h_freq; + mode->VRefresh = freq; + + xf86SetModeDefaultName(mode); + + mode->Flags = V_NHSYNC | V_PVSYNC; + if (interlaced) { + mode->VTotal *= 2; + mode->Flags |= V_INTERLACE; + } + + return mode; +} From 26c2e95fa5bf30726356cf4bdd0fea32a771a179 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 12 Jan 2008 00:09:34 -0500 Subject: [PATCH 021/183] Nuke a duplicate SYMFUNC(xf86CVTMode) --- hw/xfree86/loader/xf86sym.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 50a19b916..f86a1433d 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -348,9 +348,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86AllocateEntityPrivateIndex) SYMFUNC(xf86GetEntityPrivate) - /* xf86cvt.c */ - SYMFUNC(xf86CVTMode) - /* xf86Configure.c */ SYMFUNC(xf86AddDeviceToConfigure) From d1c48955f80692a32ab6adcee1384e3d298f471a Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 12 Jan 2008 00:30:58 -0500 Subject: [PATCH 022/183] Fix CVT abuse in DDCModesFromStandardTiming. CVT is enough different from GTF that it should not be used on monitors that aren't expecting it. This brings us closer to what the spec says the correct behaviour is. --- hw/xfree86/ddc/edid.h | 2 ++ hw/xfree86/modes/xf86EdidModes.c | 40 +++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h index 2496e19e6..c03427683 100644 --- a/hw/xfree86/ddc/edid.h +++ b/hw/xfree86/ddc/edid.h @@ -339,6 +339,8 @@ #define STD_COLOR_SPACE(x) (x & 0x4) #define PREFERRED_TIMING_MODE(x) (x & 0x2) #define GFT_SUPPORTED(x) (x & 0x1) +#define GTF_SUPPORTED(x) (x & 0x1) +#define CVT_SUPPORTED(x) (x & 0x1) /* detailed timing misc */ #define IS_INTERLACED(x) (x) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 467f03251..a9d672265 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -263,6 +263,22 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing, return Modes; } +#define LEVEL_DMT 0 +#define LEVEL_GTF 1 +#define LEVEL_CVT 2 + +static int +MonitorStandardTimingLevel(xf86MonPtr DDC) +{ + if (DDC->ver.revision >= 2) { + if (DDC->ver.revision >= 4 && CVT_SUPPORTED(DDC->features.msc)) { + return LEVEL_CVT; + } + return LEVEL_GTF; + } + return LEVEL_DMT; +} + /* * This is not really correct. Appendix B of the EDID 1.4 spec defines * the right thing to do here. If the timing given here matches a mode @@ -282,16 +298,22 @@ DDCModesFromEstablished(int scrnIndex, struct established_timings *timing, * for modes in this section, but does say that CVT is preferred. */ static DisplayModePtr -DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing, - ddc_quirk_t quirks) +DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks, + int timing_level) { DisplayModePtr Modes = NULL, Mode = NULL; int i; for (i = 0; i < STD_TIMINGS; i++) { if (timing[i].hsize && timing[i].vsize && timing[i].refresh) { - Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize, - timing[i].refresh, FALSE, FALSE); + /* XXX check for DMT first, else... */ + if (timing_level == LEVEL_CVT) + Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize, + timing[i].refresh, FALSE, FALSE); + else + Mode = xf86GTFMode(timing[i].hsize, timing[i].vsize, + timing[i].refresh, FALSE, FALSE); + Mode->type = M_T_DRIVER; Modes = xf86ModesAdd(Modes, Mode); } @@ -565,6 +587,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) DisplayModePtr Modes = NULL, Mode; ddc_quirk_t quirks; Bool preferred; + int timing_level; xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n", DDC->vendor.name, DDC->vendor.prod_id); @@ -579,6 +602,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75)) preferred = FALSE; + timing_level = MonitorStandardTimingLevel(DDC); + for (i = 0; i < DET_TIMINGS; i++) { struct detailed_monitor_section *det_mon = &DDC->det_mon[i]; @@ -592,9 +617,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) Modes = xf86ModesAdd(Modes, Mode); break; case DS_STD_TIMINGS: - Mode = DDCModesFromStandardTiming(scrnIndex, - det_mon->section.std_t, - quirks); + Mode = DDCModesFromStandardTiming(det_mon->section.std_t, + quirks, timing_level); Modes = xf86ModesAdd(Modes, Mode); break; case DS_CVT: @@ -611,7 +635,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) Modes = xf86ModesAdd(Modes, Mode); /* Add standard timings */ - Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2, quirks); + Mode = DDCModesFromStandardTiming(DDC->timings2, quirks, timing_level); Modes = xf86ModesAdd(Modes, Mode); if (quirks & DDC_QUIRK_PREFER_LARGE_60) From 31014d88aff8dc8a502cf0f26e4cde141e1a92f5 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 12 Jan 2008 01:03:44 -0500 Subject: [PATCH 023/183] EDID 1.4: Decode additional CVT support information. Table 3.28: Display Range Limits & CVT Support Definition --- hw/xfree86/ddc/edid.h | 44 +++++++++++++++++++++++++++++++-- hw/xfree86/ddc/interpret_edid.c | 15 ++++++++++- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h index c03427683..a4e79dae0 100644 --- a/hw/xfree86/ddc/edid.h +++ b/hw/xfree86/ddc/edid.h @@ -271,6 +271,39 @@ #define K_2ND_GTF _K_2ND_GTF(c) #define _J_2ND_GTF(x) (x[17] / 2) #define J_2ND_GTF _J_2ND_GTF(c) +#define _HAVE_CVT(x) (x[10] == 0x04) +#define HAVE_CVT _HAVE_CVT(c) +#define _MAX_CLOCK_KHZ(x) (x[12] >> 2) +#define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250) +#define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8) +#define MAXWIDTH _MAXWIDTH(c) +#define _SUPPORTED_ASPECT(x) x[14] +#define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c) +#define SUPPORTED_ASPECT_4_3 0x80 +#define SUPPORTED_ASPECT_16_9 0x40 +#define SUPPORTED_ASPECT_16_10 0x20 +#define SUPPORTED_ASPECT_5_4 0x10 +#define SUPPORTED_ASPECT_15_9 0x08 +#define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5) +#define PREFERRED_ASPECT _PREFERRED_ASPECT(c) +#define PREFERRED_ASPECT_4_3 0 +#define PREFERRED_ASPECT_16_9 1 +#define PREFERRED_ASPECT_16_10 2 +#define PREFERRED_ASPECT_5_4 3 +#define PREFERRED_ASPECT_15_9 4 +#define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3) +#define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c) +#define CVT_STANDARD 0x01 +#define CVT_REDUCED 0x02 +#define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4) +#define SUPPORTED_SCALING _SUPPORTED_SCALING(c) +#define SCALING_HSHRINK 0x08 +#define SCALING_HSTRETCH 0x04 +#define SCALING_VSHRINK 0x02 +#define SCALING_VSTRETCH 0x01 +#define _PREFERRED_REFRESH(x) x[17] +#define PREFERRED_REFRESH _PREFERRED_REFRESH(c) + #define MONITOR_NAME 0xFC #define ADD_COLOR_POINT 0xFB #define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2)) @@ -447,12 +480,19 @@ struct monitor_ranges { int max_v; int min_h; int max_h; - int max_clock; + int max_clock; /* in mhz */ int gtf_2nd_f; int gtf_2nd_c; int gtf_2nd_m; int gtf_2nd_k; int gtf_2nd_j; + int max_clock_khz; + int maxwidth; /* in pixels */ + char supported_aspect; + char preferred_aspect; + char supported_blanking; + char supported_scaling; + int preferred_refresh; /* in hz */ }; struct whitePoints{ @@ -482,7 +522,7 @@ struct detailed_monitor_section { Uchar serial[13]; Uchar ascii_data[13]; Uchar name[13]; - struct monitor_ranges ranges; /* 40 */ + struct monitor_ranges ranges; /* 56 */ struct std_timings std_t[5]; /* 80 */ struct whitePoints wp[2]; /* 32 */ /* color management data */ diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index 14b0fd73a..21391dd66 100644 --- a/hw/xfree86/ddc/interpret_edid.c +++ b/hw/xfree86/ddc/interpret_edid.c @@ -329,8 +329,21 @@ get_monitor_ranges(Uchar *c, struct monitor_ranges *r) r->gtf_2nd_m = M_2ND_GTF; r->gtf_2nd_k = K_2ND_GTF; r->gtf_2nd_j = J_2ND_GTF; - } else + } else { r->gtf_2nd_f = 0; + } + if (HAVE_CVT) { + r->max_clock_khz = MAX_CLOCK_KHZ; + r->max_clock = r->max_clock_khz / 1000; + r->maxwidth = MAXWIDTH; + r->supported_aspect = SUPPORTED_ASPECT; + r->preferred_aspect = PREFERRED_ASPECT; + r->supported_blanking = SUPPORTED_BLANKING; + r->supported_scaling = SUPPORTED_SCALING; + r->preferred_refresh = PREFERRED_REFRESH; + } else { + r->max_clock_khz = 0; + } } static void From b7eb92774a58639aff3f26bb28a3dcff910c3fb6 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sat, 12 Jan 2008 01:22:05 -0500 Subject: [PATCH 024/183] EDID 1.4: Print additional CVT support data in the log. --- hw/xfree86/ddc/print_edid.c | 69 ++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c index d9f18fa9f..f5442adb7 100644 --- a/hw/xfree86/ddc/print_edid.c +++ b/hw/xfree86/ddc/print_edid.c @@ -27,6 +27,9 @@ #include #endif +/* XXX kinda gross */ +#define _PARSE_EDID_ + #include "misc.h" #include "xf86.h" #include "xf86_OSproc.h" @@ -350,23 +353,63 @@ print_detailed_monitor_section(int scrnIndex, xf86DrvMsg(scrnIndex,X_INFO,"Monitor name: %s\n",m[i].section.name); break; case DS_RANGES: + { + struct monitor_ranges *r = &m[i].section.ranges; xf86DrvMsg(scrnIndex,X_INFO, - "Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,", - m[i].section.ranges.min_v, m[i].section.ranges.max_v, - m[i].section.ranges.min_h, m[i].section.ranges.max_h); - if (m[i].section.ranges.max_clock != 0) - xf86ErrorF(" PixClock max %i MHz\n",m[i].section.ranges.max_clock); - else + "Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,", + r->min_v, r->max_v, r->min_h, r->max_h); + if (r->max_clock_khz != 0) { + xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz); + if (r->maxwidth) + xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n", + r->maxwidth); + xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:"); + if (r->supported_aspect & SUPPORTED_ASPECT_4_3) + xf86ErrorF(" 4:3%s", + r->preferred_aspect == PREFERRED_ASPECT_4_3?"*":""); + if (r->supported_aspect & SUPPORTED_ASPECT_16_9) + xf86ErrorF(" 16:9%s", + r->preferred_aspect == PREFERRED_ASPECT_16_9?"*":""); + if (r->supported_aspect & SUPPORTED_ASPECT_16_10) + xf86ErrorF(" 16:10%s", + r->preferred_aspect == PREFERRED_ASPECT_16_10?"*":""); + if (r->supported_aspect & SUPPORTED_ASPECT_5_4) + xf86ErrorF(" 5:4%s", + r->preferred_aspect == PREFERRED_ASPECT_5_4?"*":""); + if (r->supported_aspect & SUPPORTED_ASPECT_15_9) + xf86ErrorF(" 15:9%s", + r->preferred_aspect == PREFERRED_ASPECT_15_9?"*":""); xf86ErrorF("\n"); - if (m[i].section.ranges.gtf_2nd_f > 0) + xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:"); + if (r->supported_blanking & CVT_STANDARD) + xf86ErrorF(" standard"); + if (r->supported_blanking & CVT_REDUCED) + xf86ErrorF(" reduced"); + xf86ErrorF("\n"); + xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:"); + if (r->supported_scaling & SCALING_HSHRINK) + xf86ErrorF(" hshrink"); + if (r->supported_scaling & SCALING_HSTRETCH) + xf86ErrorF(" hstretch"); + if (r->supported_scaling & SCALING_VSHRINK) + xf86ErrorF(" vshrink"); + if (r->supported_scaling & SCALING_VSTRETCH) + xf86ErrorF(" vstretch"); + xf86ErrorF("\n"); + xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n", + r->preferred_refresh); + } else if (r->max_clock != 0) { + xf86ErrorF(" PixClock max %i MHz\n", r->max_clock); + } else { + xf86ErrorF("\n"); + } + if (r->gtf_2nd_f > 0) xf86DrvMsg(scrnIndex,X_INFO," 2nd GTF parameters: f: %i kHz " - "c: %i m: %i k %i j %i\n", - m[i].section.ranges.gtf_2nd_f, - m[i].section.ranges.gtf_2nd_c, - m[i].section.ranges.gtf_2nd_m, - m[i].section.ranges.gtf_2nd_k, - m[i].section.ranges.gtf_2nd_j); + "c: %i m: %i k %i j %i\n", r->gtf_2nd_f, + r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k, + r->gtf_2nd_j); break; + } case DS_STD_TIMINGS: for (j = 0; j<5; j++) xf86DrvMsg(scrnIndex,X_INFO,"#%i: hsize: %i vsize %i refresh: %i " From 8f0a4282f0ac33625eda9466e3db0bcef64e403a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 29 Feb 2008 16:39:29 -0500 Subject: [PATCH 025/183] Bug #10463: Always initialize reference pixel before AllocColor() --- render/miindex.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/render/miindex.c b/render/miindex.c index 0e12dca4a..4e0cf0084 100644 --- a/render/miindex.c +++ b/render/miindex.c @@ -147,6 +147,7 @@ miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump) for (g = 0; g < cube; g++) for (b = 0; b < cube; b++) { + pixel = 0; red = (r * 65535 + (cube-1)/2) / (cube - 1); green = (g * 65535 + (cube-1)/2) / (cube - 1); blue = (b * 65535 + (cube-1)/2) / (cube - 1); @@ -157,6 +158,7 @@ miBuildRenderColormap (ColormapPtr pColormap, Pixel *pixels, int *nump) } for (g = 0; g < gray; g++) { + pixel = 0; red = green = blue = (g * 65535 + (gray-1)/2) / (gray - 1); if (AllocColor (pColormap, &red, &green, &blue, &pixel, 0) != Success) return FALSE; From 5d5fcc7198ca54fa9dc24fe974763eff9fddabee Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 29 Feb 2008 16:42:04 -0500 Subject: [PATCH 026/183] Bug #10464: Set pixel value to 0 before FindColor() --- dix/colormap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dix/colormap.c b/dix/colormap.c index c4c8c8bfe..8b1bad8a3 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -1006,6 +1006,7 @@ FakeAllocColor (ColormapPtr pmap, xColorItem *item) switch (class) { case GrayScale: case PseudoColor: + temp = 0; item->pixel = 0; if (FindColor(pmap, pmap->red, entries, &rgb, &temp, PSEUDOMAP, -1, AllComp) == Success) { From 4a44fe7c8678360d0549cf0e0d63870f3623b1db Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 29 Feb 2008 16:43:14 -0500 Subject: [PATCH 027/183] Bug #10465: Use calloc() for allocating PixmapRec's. --- dix/pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/pixmap.c b/dix/pixmap.c index 82e388cf3..d4b41953e 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -113,7 +113,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) return NullPixmap; - pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); + pPixmap = (PixmapPtr)xcalloc(1, pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; From c0e1959f285d7a7df66f42d55912a5a595decd0f Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 29 Feb 2008 16:45:11 -0500 Subject: [PATCH 028/183] On second thought, revert that, it'll make large pixmaps painfully slow. Need to just fix the callers. --- dix/pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/pixmap.c b/dix/pixmap.c index d4b41953e..82e388cf3 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -113,7 +113,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) return NullPixmap; - pPixmap = (PixmapPtr)xcalloc(1, pScreen->totalPixmapSize + pixDataSize); + pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; From d5715f7beaad6816db27b01b67d7a3c69164d106 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 29 Feb 2008 16:16:12 -0500 Subject: [PATCH 029/183] dix: Refactoring of property code to allow for polyinstantiation. Introduces dixLookupProperty() API. --- dix/property.c | 221 +++++++++++++++++-------------------- hw/xfree86/loader/dixsym.c | 1 + include/property.h | 7 ++ 3 files changed, 112 insertions(+), 117 deletions(-) diff --git a/dix/property.c b/dix/property.c index ce6116992..e74becfa2 100644 --- a/dix/property.c +++ b/dix/property.c @@ -63,11 +63,10 @@ SOFTWARE. /***************************************************************** * Property Stuff * - * ChangeProperty, DeleteProperty, GetProperties, - * ListProperties + * dixLookupProperty, dixChangeProperty, DeleteProperty * - * Properties below to windows. A allocate slots each time - * a property is added. No fancy searching done. + * Properties belong to windows. The list of properties should not be + * traversed directly. Instead, use the three functions listed above. * *****************************************************************/ @@ -91,17 +90,22 @@ PrintPropertys(WindowPtr pWin) } #endif -static _X_INLINE PropertyPtr -FindProperty(WindowPtr pWin, Atom propertyName) +_X_EXPORT int +dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName, + ClientPtr client, Mask access_mode) { - PropertyPtr pProp = wUserProps(pWin); - while (pProp) - { + PropertyPtr pProp; + int rc = BadMatch; + client->errorValue = propertyName; + + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) if (pProp->propertyName == propertyName) break; - pProp = pProp->next; - } - return pProp; + + if (pProp) + rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode); + *result = pProp; + return rc; } static void @@ -125,65 +129,69 @@ ProcRotateProperties(ClientPtr client) WindowPtr pWin; Atom * atoms; PropertyPtr * props; /* array of pointer */ - PropertyPtr pProp; + PropertyPtr pProp, saved; REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); rc = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); - if (rc != Success) + if (rc != Success || stuff->nAtoms <= 0) return rc; - if (!stuff->nAtoms) - return(Success); + atoms = (Atom *) & stuff[1]; props = (PropertyPtr *)xalloc(stuff->nAtoms * sizeof(PropertyPtr)); - if (!props) - return(BadAlloc); + saved = (PropertyPtr)xalloc(stuff->nAtoms * sizeof(PropertyRec)); + if (!props || !saved) { + rc = BadAlloc; + goto out; + } + for (i = 0; i < stuff->nAtoms; i++) { if (!ValidAtom(atoms[i])) { - xfree(props); + rc = BadAtom; client->errorValue = atoms[i]; - return BadAtom; + goto out; } for (j = i + 1; j < stuff->nAtoms; j++) if (atoms[j] == atoms[i]) { - xfree(props); - return BadMatch; + rc = BadMatch; + goto out; } - pProp = FindProperty(pWin, atoms[i]); - if (!pProp) { - xfree(props); - return BadMatch; - } - rc = XaceHookPropertyAccess(client, pWin, pProp, - DixReadAccess|DixWriteAccess); - if (rc != Success) { - xfree(props); - client->errorValue = atoms[i]; - return rc; - } + + rc = dixLookupProperty(&pProp, pWin, atoms[i], client, + DixReadAccess|DixWriteAccess); + if (rc != Success) + goto out; + props[i] = pProp; + saved[i] = *pProp; } delta = stuff->nPositions; /* If the rotation is a complete 360 degrees, then moving the properties around and generating PropertyNotify events should be skipped. */ - if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 ) + if (abs(delta) % stuff->nAtoms) { while (delta < 0) /* faster if abs value is small */ delta += stuff->nAtoms; for (i = 0; i < stuff->nAtoms; i++) { - deliverPropertyNotifyEvent(pWin, PropertyNewValue, - props[i]->propertyName); - - props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms]; + j = (i + delta) % stuff->nAtoms; + deliverPropertyNotifyEvent(pWin, PropertyNewValue, atoms[i]); + + /* Preserve name and devPrivates */ + props[j]->type = saved[i].type; + props[j]->format = saved[i].format; + props[j]->size = saved[i].size; + props[j]->data = saved[i].data; } } +out: + xfree(saved); xfree(props); - return Success; + return rc; } int @@ -253,9 +261,9 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, totalSize = len * sizeInBytes; /* first see if property already exists */ - pProp = FindProperty(pWin, property); + rc = dixLookupProperty(&pProp, pWin, property, pClient, DixWriteAccess); - if (!pProp) /* just add to list */ + if (rc == BadMatch) /* just add to list */ { if (!pWin->optional && !MakeWindowOptional (pWin)) return(BadAlloc); @@ -287,13 +295,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, pProp->next = pWin->optional->userProps; pWin->optional->userProps = pProp; } - else + else if (rc == Success) { - rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess); - if (rc != Success) { - pClient->errorValue = property; - return rc; - } /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode @@ -347,6 +350,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, pProp->size += len; } } + else + return rc; if (sendevent) deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName); @@ -369,37 +374,29 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName) PropertyPtr pProp, prevProp; int rc; - if (!(pProp = wUserProps (pWin))) - return(Success); - prevProp = (PropertyPtr)NULL; - while (pProp) - { - if (pProp->propertyName == propName) - break; - prevProp = pProp; - pProp = pProp->next; - } - if (pProp) - { - rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess); - if (rc != Success) - return rc; + rc = dixLookupProperty(&pProp, pWin, propName, client, DixDestroyAccess); + if (rc == BadMatch) + return Success; /* Succeed if property does not exist */ - if (prevProp == (PropertyPtr)NULL) /* takes care of head */ - { + if (rc == Success) { + if (pWin->optional->userProps == pProp) { + /* Takes care of head */ if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); - } - else - { - prevProp->next = pProp->next; - } + } else { + /* Need to traverse to find the previous element */ + prevProp = pWin->optional->userProps; + while (prevProp->next != pProp) + prevProp = prevProp->next; + prevProp->next = pProp->next; + } + deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); } - return(Success); + return rc; } void @@ -453,15 +450,16 @@ ProcGetProperty(ClientPtr client) int rc; WindowPtr pWin; xGetPropertyReply reply; - Mask access_mode = DixGetPropAccess; + Mask win_mode = DixGetPropAccess, prop_mode = DixReadAccess; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) { UpdateCurrentTime(); - access_mode |= DixSetPropAccess; + win_mode |= DixSetPropAccess; + prop_mode |= DixDestroyAccess; } - rc = dixLookupWindow(&pWin, stuff->window, client, access_mode); + rc = dixLookupWindow(&pWin, stuff->window, client, win_mode); if (rc != Success) return rc; @@ -481,30 +479,14 @@ ProcGetProperty(ClientPtr client) return(BadAtom); } - pProp = wUserProps (pWin); - prevProp = (PropertyPtr)NULL; - while (pProp) - { - if (pProp->propertyName == stuff->property) - break; - prevProp = pProp; - pProp = pProp->next; - } - reply.type = X_Reply; reply.sequenceNumber = client->sequence; - if (!pProp) + + rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode); + if (rc == BadMatch) return NullPropertyReply(client, None, 0, &reply); - - access_mode = DixReadAccess; - if (stuff->delete) - access_mode |= DixDestroyAccess; - - rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode); - if (rc != Success) { - client->errorValue = stuff->property; + else if (rc != Success) return rc; - } /* If the request type and actual type don't match. Return the property information, but not the data. */ @@ -560,15 +542,20 @@ ProcGetProperty(ClientPtr client) (char *)pProp->data + ind); } - if (stuff->delete && (reply.bytesAfter == 0)) - { /* delete the Property */ - if (prevProp == (PropertyPtr)NULL) /* takes care of head */ - { - if (!(pWin->optional->userProps = pProp->next)) + if (stuff->delete && (reply.bytesAfter == 0)) { + /* Delete the Property */ + if (pWin->optional->userProps == pProp) { + /* Takes care of head */ + if (!(pWin->optional->userProps = pProp->next)) CheckWindowOptionalNeed (pWin); - } - else + } else { + /* Need to traverse to find the previous element */ + prevProp = pWin->optional->userProps; + while (prevProp->next != pProp) + prevProp = prevProp->next; prevProp->next = pProp->next; + } + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); @@ -583,7 +570,7 @@ ProcListProperties(ClientPtr client) xListPropertiesReply xlpr; int rc, numProps = 0; WindowPtr pWin; - PropertyPtr pProp; + PropertyPtr pProp, realProp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); @@ -591,34 +578,34 @@ ProcListProperties(ClientPtr client) if (rc != Success) return rc; - pProp = wUserProps (pWin); - while (pProp) - { - pProp = pProp->next; + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) numProps++; + + if (numProps && !(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom)))) + return BadAlloc; + + numProps = 0; + temppAtoms = pAtoms; + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) { + realProp = pProp; + rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess); + if (rc == Success && realProp == pProp) { + *temppAtoms++ = pProp->propertyName; + numProps++; + } } - if (numProps) - if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom)))) - return(BadAlloc); xlpr.type = X_Reply; xlpr.nProperties = numProps; xlpr.length = (numProps * sizeof(Atom)) >> 2; xlpr.sequenceNumber = client->sequence; - pProp = wUserProps (pWin); - temppAtoms = pAtoms; - while (pProp) - { - *temppAtoms++ = pProp->propertyName; - pProp = pProp->next; - } WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); - xfree(pAtoms); } + xfree(pAtoms); return(client->noClientException); } diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 49c7d271b..e6c37fe00 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -193,6 +193,7 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(XineramaGetCursorScreen) #endif /* property.c */ + SYMFUNC(dixLookupProperty) SYMFUNC(ChangeWindowProperty) SYMFUNC(dixChangeWindowProperty) /* extension.c */ diff --git a/include/property.h b/include/property.h index ba7d226cd..1207e8191 100644 --- a/include/property.h +++ b/include/property.h @@ -52,6 +52,13 @@ SOFTWARE. typedef struct _Property *PropertyPtr; +extern int dixLookupProperty( + PropertyPtr * /*result*/, + WindowPtr /*pWin*/, + Atom /*proprty*/, + ClientPtr /*pClient*/, + Mask /*access_mode*/); + extern int dixChangeWindowProperty( ClientPtr /*pClient*/, WindowPtr /*pWin*/, From 34bf308a9e66f1a2f48630a15b1802afad50ec24 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 29 Feb 2008 18:00:23 -0500 Subject: [PATCH 030/183] dix: Refactoring of selection code to allow for polyinstantiation. Introduces dixLookupSelection() API. Removes NumCurrentSelections from API. --- Xext/xselinux.c | 2 - dix/Makefile.am | 1 + dix/dispatch.c | 274 --------------------------------- dix/main.c | 2 + dix/selection.c | 306 +++++++++++++++++++++++++++++++++++++ hw/xfree86/loader/dixsym.c | 8 +- include/dix.h | 23 --- include/selection.h | 47 +++++- 8 files changed, 352 insertions(+), 311 deletions(-) create mode 100644 dix/selection.c diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 9adc93195..8d66ea199 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -967,8 +967,6 @@ SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata) switch (rec->kind) { case SelectionSetOwner: - case SelectionGetOwner: - case SelectionConvertSelection: default: break; } diff --git a/dix/Makefile.am b/dix/Makefile.am index 2cf90142f..b7b1ec071 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -29,6 +29,7 @@ libdix_la_SOURCES = \ property.c \ registry.c \ resource.c \ + selection.c \ swaprep.c \ swapreq.c \ tables.c \ diff --git a/dix/dispatch.c b/dix/dispatch.c index e8e650a91..bb8b0c416 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -165,10 +165,6 @@ typedef const char *string; extern xConnSetupPrefix connSetupPrefix; extern char *ConnectionInfo; -_X_EXPORT Selection *CurrentSelections; -_X_EXPORT int NumCurrentSelections; -CallbackListPtr SelectionCallback = NULL; - static ClientPtr grabClient; #define GrabNone 0 #define GrabActive 1 @@ -181,8 +177,6 @@ extern int connBlockScreenStart; static void KillAllClients(void); -static void DeleteClientFromAnySelections(ClientPtr client); - static int nextFreeClientID; /* always MIN free client ID */ static int nClients; /* number of authorized clients */ @@ -246,14 +240,6 @@ UpdateCurrentTimeIf(void) currentTime = systime; } -static void -InitSelections(void) -{ - if (CurrentSelections) - xfree(CurrentSelections); - CurrentSelections = (Selection *)NULL; - NumCurrentSelections = 0; -} #ifdef SMART_SCHEDULE #undef SMART_DEBUG @@ -372,7 +358,6 @@ Dispatch(void) #endif nextFreeClientID = 1; - InitSelections(); nClients = 0; clientReady = (int *) xalloc(sizeof(int) * MaxClients); @@ -967,217 +952,6 @@ ProcGetAtomName(ClientPtr client) } } -int -ProcSetSelectionOwner(ClientPtr client) -{ - WindowPtr pWin; - TimeStamp time; - int rc; - REQUEST(xSetSelectionOwnerReq); - REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); - - UpdateCurrentTime(); - time = ClientTimeToServerTime(stuff->time); - - /* If the client's time stamp is in the future relative to the server's - time stamp, do not set the selection, just return success. */ - if (CompareTimeStamps(time, currentTime) == LATER) - return Success; - if (stuff->window != None) - { - rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); - if (rc != Success) - return rc; - } - else - pWin = (WindowPtr)None; - if (ValidAtom(stuff->selection)) - { - int i = 0; - - rc = XaceHookSelectionAccess(client, stuff->selection, - DixSetAttrAccess); - if (rc != Success) - return rc; - - /* - * First, see if the selection is already set... - */ - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->selection) - i++; - if (i < NumCurrentSelections) - { - xEvent event; - - /* If the timestamp in client's request is in the past relative - to the time stamp indicating the last time the owner of the - selection was set, do not set the selection, just return - success. */ - if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged) - == EARLIER) - return Success; - if (CurrentSelections[i].client && - (!pWin || (CurrentSelections[i].client != client))) - { - event.u.u.type = SelectionClear; - event.u.selectionClear.time = time.milliseconds; - event.u.selectionClear.window = CurrentSelections[i].window; - event.u.selectionClear.atom = CurrentSelections[i].selection; - (void) TryClientEvents (CurrentSelections[i].client, &event, 1, - NoEventMask, NoEventMask /* CantBeFiltered */, - NullGrab); - } - } - else - { - /* - * It doesn't exist, so add it... - */ - Selection *newsels; - - if (i == 0) - newsels = (Selection *)xalloc(sizeof(Selection)); - else - newsels = (Selection *)xrealloc(CurrentSelections, - (NumCurrentSelections + 1) * sizeof(Selection)); - if (!newsels) - return BadAlloc; - NumCurrentSelections++; - CurrentSelections = newsels; - CurrentSelections[i].selection = stuff->selection; - CurrentSelections[i].devPrivates = NULL; - } - CurrentSelections[i].lastTimeChanged = time; - CurrentSelections[i].window = stuff->window; - CurrentSelections[i].pWin = pWin; - CurrentSelections[i].client = (pWin ? client : NullClient); - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.client = client; - info.kind= SelectionSetOwner; - CallCallbacks(&SelectionCallback, &info); - } - return (client->noClientException); - } - else - { - client->errorValue = stuff->selection; - return (BadAtom); - } -} - -int -ProcGetSelectionOwner(ClientPtr client) -{ - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - if (ValidAtom(stuff->id)) - { - int rc, i; - xGetSelectionOwnerReply reply; - - rc = XaceHookSelectionAccess(client, stuff->id, DixGetAttrAccess); - if (rc != Success) - return rc; - - i = 0; - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->id) i++; - reply.type = X_Reply; - reply.length = 0; - reply.sequenceNumber = client->sequence; - if (i < NumCurrentSelections) { - if (SelectionCallback) { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.client = client; - info.kind= SelectionGetOwner; - CallCallbacks(&SelectionCallback, &info); - } - reply.owner = CurrentSelections[i].window; - } else - reply.owner = None; - WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); - return(client->noClientException); - } - else - { - client->errorValue = stuff->id; - return (BadAtom); - } -} - -int -ProcConvertSelection(ClientPtr client) -{ - Bool paramsOkay; - xEvent event; - WindowPtr pWin; - REQUEST(xConvertSelectionReq); - int rc; - - REQUEST_SIZE_MATCH(xConvertSelectionReq); - rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess); - if (rc != Success) - return rc; - rc = XaceHookSelectionAccess(client, stuff->selection, DixReadAccess); - if (rc != Success) - return rc; - - paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); - if (stuff->property != None) - paramsOkay &= ValidAtom(stuff->property); - if (paramsOkay) - { - int i; - - i = 0; - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->selection) i++; - if (i < NumCurrentSelections && CurrentSelections[i].window != None) { - if (SelectionCallback) { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.client = client; - info.kind= SelectionConvertSelection; - CallCallbacks(&SelectionCallback, &info); - } - event.u.u.type = SelectionRequest; - event.u.selectionRequest.time = stuff->time; - event.u.selectionRequest.owner = CurrentSelections[i].window; - event.u.selectionRequest.requestor = stuff->requestor; - event.u.selectionRequest.selection = stuff->selection; - event.u.selectionRequest.target = stuff->target; - event.u.selectionRequest.property = stuff->property; - if (TryClientEvents( - CurrentSelections[i].client, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab)) - return (client->noClientException); - } - event.u.u.type = SelectionNotify; - event.u.selectionNotify.time = stuff->time; - event.u.selectionNotify.requestor = stuff->requestor; - event.u.selectionNotify.selection = stuff->selection; - event.u.selectionNotify.target = stuff->target; - event.u.selectionNotify.property = None; - (void) TryClientEvents(client, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab); - return (client->noClientException); - } - else - { - client->errorValue = stuff->property; - return (BadAtom); - } -} - int ProcGrabServer(ClientPtr client) { @@ -3980,54 +3754,6 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, WriteEventsToClient (client, 1, (xEvent *)&rep); } -void -DeleteWindowFromAnySelections(WindowPtr pWin) -{ - int i; - - for (i = 0; i< NumCurrentSelections; i++) - if (CurrentSelections[i].pWin == pWin) - { - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.kind = SelectionWindowDestroy; - CallCallbacks(&SelectionCallback, &info); - } - dixFreePrivates(CurrentSelections[i].devPrivates); - CurrentSelections[i].pWin = (WindowPtr)NULL; - CurrentSelections[i].window = None; - CurrentSelections[i].client = NullClient; - CurrentSelections[i].devPrivates = NULL; - } -} - -static void -DeleteClientFromAnySelections(ClientPtr client) -{ - int i; - - for (i = 0; i< NumCurrentSelections; i++) - if (CurrentSelections[i].client == client) - { - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.kind = SelectionWindowDestroy; - CallCallbacks(&SelectionCallback, &info); - } - dixFreePrivates(CurrentSelections[i].devPrivates); - CurrentSelections[i].pWin = (WindowPtr)NULL; - CurrentSelections[i].window = None; - CurrentSelections[i].client = NullClient; - CurrentSelections[i].devPrivates = NULL; - } -} - void MarkClientException(ClientPtr client) { diff --git a/dix/main.c b/dix/main.c index 068dae92e..db4347341 100644 --- a/dix/main.c +++ b/dix/main.c @@ -93,6 +93,7 @@ Equipment Corporation. #include "colormap.h" #include "colormapst.h" #include "cursorstr.h" +#include "selection.h" #include #include "opaque.h" #include "servermd.h" @@ -346,6 +347,7 @@ main(int argc, char *argv[], char *envp[]) InitAtoms(); InitEvents(); + InitSelections(); InitGlyphCaching(); if (!dixResetPrivates()) FatalError("couldn't init private data storage"); diff --git a/dix/selection.c b/dix/selection.c new file mode 100644 index 000000000..e2e279a6f --- /dev/null +++ b/dix/selection.c @@ -0,0 +1,306 @@ +/************************************************************ + +Copyright 1987, 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "windowstr.h" +#include "dixstruct.h" +#include "dispatch.h" +#include "selection.h" +#include "xace.h" + +/***************************************************************** + * Selection Stuff + * + * dixLookupSelection + * + * Selections are global to the server. The list of selections should + * not be traversed directly. Instead, use the functions listed above. + * + *****************************************************************/ + +_X_EXPORT Selection *CurrentSelections; +static int NumCurrentSelections; +CallbackListPtr SelectionCallback; + +_X_EXPORT int +dixLookupSelection(Selection **result, Atom selectionName, + ClientPtr client, Mask access_mode) +{ + Selection *pSel = NULL; + int i, rc = BadMatch; + client->errorValue = selectionName; + + for (i = 0; i < NumCurrentSelections; i++) + if (CurrentSelections[i].selection == selectionName) { + pSel = CurrentSelections + i; + rc = XaceHookSelectionAccess(client, selectionName, access_mode); + break; + } + + *result = pSel; + return rc; +} + +void +InitSelections(void) +{ + Selection *pSel = CurrentSelections; + + for (; pSel - CurrentSelections < NumCurrentSelections; pSel++) + dixFreePrivates(pSel->devPrivates); + + xfree(CurrentSelections); + CurrentSelections = NULL; + NumCurrentSelections = 0; +} + +static _X_INLINE void +CallSelectionCallback(Selection *pSel, ClientPtr client, + SelectionCallbackKind kind) +{ + SelectionInfoRec info = { pSel, client, kind }; + CallCallbacks(&SelectionCallback, &info); +} + +void +DeleteWindowFromAnySelections(WindowPtr pWin) +{ + Selection *pSel = CurrentSelections; + + for (; pSel - CurrentSelections < NumCurrentSelections; pSel++) + if (pSel->pWin == pWin) { + CallSelectionCallback(pSel, NULL, SelectionWindowDestroy); + + pSel->pWin = (WindowPtr)NULL; + pSel->window = None; + pSel->client = NullClient; + } +} + +void +DeleteClientFromAnySelections(ClientPtr client) +{ + Selection *pSel = CurrentSelections; + + for (; pSel - CurrentSelections < NumCurrentSelections; pSel++) + if (pSel->client == client) { + CallSelectionCallback(pSel, NULL, SelectionClientClose); + + pSel->pWin = (WindowPtr)NULL; + pSel->window = None; + pSel->client = NullClient; + } +} + +int +ProcSetSelectionOwner(ClientPtr client) +{ + WindowPtr pWin = NULL; + TimeStamp time; + Selection *pSel; + int rc; + + REQUEST(xSetSelectionOwnerReq); + REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); + + UpdateCurrentTime(); + time = ClientTimeToServerTime(stuff->time); + + /* If the client's time stamp is in the future relative to the server's + time stamp, do not set the selection, just return success. */ + if (CompareTimeStamps(time, currentTime) == LATER) + return Success; + + if (stuff->window != None) { + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); + if (rc != Success) + return rc; + } + if (!ValidAtom(stuff->selection)) { + client->errorValue = stuff->selection; + return BadAtom; + } + + /* + * First, see if the selection is already set... + */ + rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess); + + if (rc == Success) { + xEvent event; + + /* If the timestamp in client's request is in the past relative + to the time stamp indicating the last time the owner of the + selection was set, do not set the selection, just return + success. */ + if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER) + return Success; + if (pSel->client && (!pWin || (pSel->client != client))) + { + event.u.u.type = SelectionClear; + event.u.selectionClear.time = time.milliseconds; + event.u.selectionClear.window = pSel->window; + event.u.selectionClear.atom = pSel->selection; + TryClientEvents(pSel->client, &event, 1, NoEventMask, + NoEventMask /* CantBeFiltered */, NullGrab); + } + } + else if (rc == BadMatch) + { + /* + * It doesn't exist, so add it... + */ + int size = (NumCurrentSelections + 1) * sizeof(Selection); + CurrentSelections = xrealloc(CurrentSelections, size); + if (!CurrentSelections) { + NumCurrentSelections = 0; + return BadAlloc; + } + pSel = CurrentSelections + NumCurrentSelections; + pSel->selection = stuff->selection; + pSel->devPrivates = NULL; + pSel->next = NULL; + if (NumCurrentSelections > 0) + CurrentSelections[NumCurrentSelections - 1].next = pSel; + NumCurrentSelections++; + } + else + return rc; + + pSel->lastTimeChanged = time; + pSel->window = stuff->window; + pSel->pWin = pWin; + pSel->client = (pWin ? client : NullClient); + + CallSelectionCallback(pSel, client, SelectionSetOwner); + return client->noClientException; +} + +int +ProcGetSelectionOwner(ClientPtr client) +{ + int rc; + Selection *pSel; + xGetSelectionOwnerReply reply; + + REQUEST(xResourceReq); + REQUEST_SIZE_MATCH(xResourceReq); + + if (!ValidAtom(stuff->id)) { + client->errorValue = stuff->id; + return BadAtom; + } + + reply.type = X_Reply; + reply.length = 0; + reply.sequenceNumber = client->sequence; + + rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); + if (rc == Success) + reply.owner = pSel->window; + else if (rc == BadMatch) + reply.owner = None; + else + return rc; + + WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); + return client->noClientException; +} + +int +ProcConvertSelection(ClientPtr client) +{ + Bool paramsOkay; + xEvent event; + WindowPtr pWin; + Selection *pSel; + int rc; + + REQUEST(xConvertSelectionReq); + REQUEST_SIZE_MATCH(xConvertSelectionReq); + + rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess); + if (rc != Success) + return rc; + + paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target); + paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property); + if (!paramsOkay) { + client->errorValue = stuff->property; + return BadAtom; + } + + rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess); + + if (rc != Success && rc != BadMatch) + return rc; + else if (rc == Success && pSel->window != None) { + event.u.u.type = SelectionRequest; + event.u.selectionRequest.owner = pSel->window; + event.u.selectionRequest.time = stuff->time; + event.u.selectionRequest.requestor = stuff->requestor; + event.u.selectionRequest.selection = stuff->selection; + event.u.selectionRequest.target = stuff->target; + event.u.selectionRequest.property = stuff->property; + if (TryClientEvents(pSel->client, &event, 1, NoEventMask, + NoEventMask /* CantBeFiltered */, NullGrab)) + return client->noClientException; + } + + event.u.u.type = SelectionNotify; + event.u.selectionNotify.time = stuff->time; + event.u.selectionNotify.requestor = stuff->requestor; + event.u.selectionNotify.selection = stuff->selection; + event.u.selectionNotify.target = stuff->target; + event.u.selectionNotify.property = None; + TryClientEvents(client, &event, 1, NoEventMask, + NoEventMask /* CantBeFiltered */, NullGrab); + return client->noClientException; +} diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index e6c37fe00..d035c762f 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -92,9 +92,6 @@ extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval; #endif -extern Selection *CurrentSelections; -extern int NumCurrentSelections; - /* DIX things */ _X_HIDDEN void *dixLookupTab[] = { @@ -150,8 +147,6 @@ _X_HIDDEN void *dixLookupTab[] = { SYMVAR(isItTimeToYield) SYMVAR(ClientStateCallback) SYMVAR(ServerGrabCallback) - SYMVAR(CurrentSelections) - SYMVAR(NumCurrentSelections) /* dixfonts.c */ SYMFUNC(CloseFont) SYMFUNC(FontToXError) @@ -196,6 +191,9 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(dixLookupProperty) SYMFUNC(ChangeWindowProperty) SYMFUNC(dixChangeWindowProperty) + /* selection.c */ + SYMFUNC(dixLookupSelection) + SYMVAR(CurrentSelections) /* extension.c */ SYMFUNC(AddExtension) SYMFUNC(AddExtensionAlias) diff --git a/include/dix.h b/include/dix.h index 52212e7e7..0790f5847 100644 --- a/include/dix.h +++ b/include/dix.h @@ -166,9 +166,6 @@ extern void SendErrorToClient( XID /*resId*/, int /*errorCode*/); -extern void DeleteWindowFromAnySelections( - WindowPtr /*pWin*/); - extern void MarkClientException( ClientPtr /*client*/); @@ -556,26 +553,6 @@ typedef struct { int count; } DeviceEventInfoRec; -/* - * SelectionCallback stuff - */ - -extern CallbackListPtr SelectionCallback; - -typedef enum { - SelectionSetOwner, - SelectionGetOwner, - SelectionConvertSelection, - SelectionWindowDestroy, - SelectionClientClose -} SelectionCallbackKind; - -typedef struct { - struct _Selection *selection; - ClientPtr client; - SelectionCallbackKind kind; -} SelectionInfoRec; - /* strcasecmp.c */ #if NEED_STRCASECMP #define strcasecmp xstrcasecmp diff --git a/include/selection.h b/include/selection.h index 859b6a3b5..dd9b056fe 100644 --- a/include/selection.h +++ b/include/selection.h @@ -1,7 +1,3 @@ - -#ifndef SELECTION_H -#define SELECTION_H 1 - /*********************************************************** Copyright 1987, 1998 The Open Group @@ -49,10 +45,13 @@ SOFTWARE. ******************************************************************/ +#ifndef SELECTION_H +#define SELECTION_H 1 + #include "dixstruct.h" #include "privates.h" + /* - * * Selection data structures */ @@ -62,11 +61,45 @@ typedef struct _Selection { Window window; WindowPtr pWin; ClientPtr client; - ClientPtr alt_client; /* support for redirection */ - Window alt_window; /* support for redirection */ + struct _Selection *next; PrivateRec *devPrivates; } Selection; + +/* + * Selection API + */ + +int dixLookupSelection(Selection **result, Atom name, + ClientPtr client, Mask access_mode); + +extern Selection *CurrentSelections; + +extern CallbackListPtr SelectionCallback; + +typedef enum { + SelectionSetOwner, + SelectionWindowDestroy, + SelectionClientClose +} SelectionCallbackKind; + +typedef struct { + struct _Selection *selection; + ClientPtr client; + SelectionCallbackKind kind; +} SelectionInfoRec; + + +/* + * Selection server internals + */ + +void InitSelections(void); + +void DeleteWindowFromAnySelections(WindowPtr pWin); + +void DeleteClientFromAnySelections(ClientPtr client); + #endif /* SELECTION_H */ From cc76ea6e3ac6a405f0c198c4e62be40aa8d2b546 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 29 Feb 2008 17:55:31 -0500 Subject: [PATCH 031/183] XACE: Add generic support for property and selection polyinstantiation. --- Xext/security.c | 2 +- Xext/xace.c | 9 +++++---- Xext/xace.h | 7 ++++--- Xext/xacestr.h | 4 ++-- Xext/xselinux.c | 29 +++++++++++++---------------- dix/property.c | 10 ++++++---- dix/selection.c | 6 +++++- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/Xext/security.c b/Xext/security.c index cd67120d9..e82b97626 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -910,7 +910,7 @@ SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) { XacePropertyAccessRec *rec = calldata; SecurityStateRec *subj, *obj; - ATOM name = rec->pProp->propertyName; + ATOM name = (*rec->ppProp)->propertyName; Mask requested = rec->access_mode; Mask allowed = SecurityResourceMask | DixReadAccess; diff --git a/Xext/xace.c b/Xext/xace.c index e88debc5f..8a8f8c61d 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -56,16 +56,17 @@ int XaceHookDispatch(ClientPtr client, int major) } int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin, - PropertyPtr pProp, Mask access_mode) + PropertyPtr *ppProp, Mask access_mode) { - XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success }; + XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success }; CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec); return rec.status; } -int XaceHookSelectionAccess(ClientPtr client, Atom name, Mask access_mode) +int XaceHookSelectionAccess(ClientPtr client, + Selection **ppSel, Mask access_mode) { - XaceSelectionAccessRec rec = { client, name, access_mode, Success }; + XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success }; CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec); return rec.status; } diff --git a/Xext/xace.h b/Xext/xace.h index 1f07d9fd2..bd69bca98 100644 --- a/Xext/xace.h +++ b/Xext/xace.h @@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "region.h" #include "window.h" #include "property.h" +#include "selection.h" /* Default window background */ #define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None) @@ -68,9 +69,9 @@ extern int XaceHook( */ extern int XaceHookDispatch(ClientPtr ptr, int major); extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin, - PropertyPtr pProp, Mask access_mode); -extern int XaceHookSelectionAccess(ClientPtr ptr, Atom name, - Mask access_mode); + PropertyPtr *ppProp, Mask access_mode); +extern int XaceHookSelectionAccess(ClientPtr ptr, + Selection **ppSel, Mask access_mode); extern void XaceHookAuditEnd(ClientPtr ptr, int result); /* Register a callback for a given hook. diff --git a/Xext/xacestr.h b/Xext/xacestr.h index e31d4246a..ba115a427 100644 --- a/Xext/xacestr.h +++ b/Xext/xacestr.h @@ -59,7 +59,7 @@ typedef struct { typedef struct { ClientPtr client; WindowPtr pWin; - PropertyPtr pProp; + PropertyPtr *ppProp; Mask access_mode; int status; } XacePropertyAccessRec; @@ -110,7 +110,7 @@ typedef struct { /* XACE_SELECTION_ACCESS */ typedef struct { ClientPtr client; - Atom name; + Selection **ppSel; Mask access_mode; int status; } XaceSelectionAccessRec; diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 8d66ea199..a7d3999b0 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -134,7 +134,7 @@ static struct security_class_mapping map[] = { { "x_gc", { "", "", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, { "x_font", { "", "", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_glyph", "remove_glyph", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, { "x_colormap", { "read", "write", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_color", "remove_color", "", "", "", "", "", "", "install", "uninstall", "", "", "use", NULL }}, - { "x_property", { "read", "write", "destroy", "create", "getattr", "setattr", NULL }}, + { "x_property", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "write", NULL }}, { "x_selection", { "read", "", "", "", "getattr", "setattr", NULL }}, { "x_cursor", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, { "x_client", { "", "", "destroy", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "manage", NULL }}, @@ -691,14 +691,15 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) SELinuxSubjectRec *subj; SELinuxObjectRec *obj; SELinuxAuditRec auditdata = { .client = rec->client }; + PropertyPtr pProp = *rec->ppProp; int rc; subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); - obj = dixLookupPrivate(&rec->pProp->devPrivates, objectKey); + obj = dixLookupPrivate(&pProp->devPrivates, objectKey); /* If this is a new object that needs labeling, do it now */ if (rec->access_mode & DixCreateAccess) { - const char *name = NameForAtom(rec->pProp->propertyName); + const char *name = NameForAtom(pProp->propertyName); security_context_t con; security_id_t sid; @@ -729,7 +730,7 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) } /* Perform the security check */ - auditdata.property = rec->pProp->propertyName; + auditdata.property = pProp->propertyName; rc = SELinuxDoCheck(subj, obj, SECCLASS_X_PROPERTY, rec->access_mode, &auditdata); if (rc != Success) @@ -870,17 +871,21 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) SELinuxSubjectRec *subj; SELinuxObjectRec sel_sid; SELinuxAuditRec auditdata = { .client = rec->client }; + Selection *pSel = *rec->ppSel; int rc; + if (rec->access_mode & DixCreateAccess) + return; /* don't use create currently */ + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); - rc = SELinuxSelectionToSID(rec->name, &sel_sid); + rc = SELinuxSelectionToSID(pSel->selection, &sel_sid); if (rc != Success) { rec->status = rc; return; } - auditdata.selection = rec->name; + auditdata.selection = pSel->selection; rc = SELinuxDoCheck(subj, &sel_sid, SECCLASS_X_SELECTION, rec->access_mode, &auditdata); if (rc != Success) @@ -1206,16 +1211,8 @@ ProcSELinuxGetPropertyContext(ClientPtr client) if (rc != Success) return rc; - pProp = wUserProps(pWin); - while (pProp) { - if (pProp->propertyName == stuff->property) - break; - pProp = pProp->next; - } - if (!pProp) - return BadValue; - - rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess); + rc = dixLookupProperty(&pProp, pWin, stuff->property, client, + DixGetAttrAccess); if (rc != Success) return rc; diff --git a/dix/property.c b/dix/property.c index e74becfa2..8b66ad6a2 100644 --- a/dix/property.c +++ b/dix/property.c @@ -103,7 +103,7 @@ dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName, break; if (pProp) - rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode); + rc = XaceHookPropertyAccess(client, pWin, &pProp, access_mode); *result = pProp; return rc; } @@ -256,12 +256,14 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, PropertyPtr pProp; int sizeInBytes, totalSize, rc; pointer data; + Mask access_mode; sizeInBytes = format>>3; totalSize = len * sizeInBytes; + access_mode = (mode == PropModeReplace) ? DixWriteAccess : DixBlendAccess; /* first see if property already exists */ - rc = dixLookupProperty(&pProp, pWin, property, pClient, DixWriteAccess); + rc = dixLookupProperty(&pProp, pWin, property, pClient, access_mode); if (rc == BadMatch) /* just add to list */ { @@ -284,7 +286,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, memmove((char *)data, (char *)value, totalSize); pProp->size = len; pProp->devPrivates = NULL; - rc = XaceHookPropertyAccess(pClient, pWin, pProp, + rc = XaceHookPropertyAccess(pClient, pWin, &pProp, DixCreateAccess|DixWriteAccess); if (rc != Success) { xfree(data); @@ -588,7 +590,7 @@ ProcListProperties(ClientPtr client) temppAtoms = pAtoms; for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) { realProp = pProp; - rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess); + rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess); if (rc == Success && realProp == pProp) { *temppAtoms++ = pProp->propertyName; numProps++; diff --git a/dix/selection.c b/dix/selection.c index e2e279a6f..52b1611c5 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -80,7 +80,7 @@ dixLookupSelection(Selection **result, Atom selectionName, for (i = 0; i < NumCurrentSelections; i++) if (CurrentSelections[i].selection == selectionName) { pSel = CurrentSelections + i; - rc = XaceHookSelectionAccess(client, selectionName, access_mode); + rc = XaceHookSelectionAccess(client, &pSel, access_mode); break; } @@ -206,6 +206,10 @@ ProcSetSelectionOwner(ClientPtr client) pSel = CurrentSelections + NumCurrentSelections; pSel->selection = stuff->selection; pSel->devPrivates = NULL; + + /* security creation/labeling check */ + (void)XaceHookSelectionAccess(client, &pSel, DixCreateAccess); + pSel->next = NULL; if (NumCurrentSelections > 0) CurrentSelections[NumCurrentSelections - 1].next = pSel; From ef60632e200853680282016e32a7a9fb01882852 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 29 Feb 2008 18:00:27 -0500 Subject: [PATCH 032/183] dix: Modify callers of property and selection API to use new interfaces. --- hw/xfree86/common/xf86Init.c | 11 ++++---- hw/xprint/pcl/PclMisc.c | 17 +++++------- hw/xprint/pcl/PclWindow.c | 6 ++--- hw/xprint/ps/PsMisc.c | 17 +++++------- hw/xprint/ps/PsWindow.c | 6 ++--- hw/xquartz/applewm.c | 14 ++++------ hw/xquartz/quartzPasteboard.c | 48 ++++++++++++++------------------- hw/xquartz/xpr/xprFrame.c | 4 +-- hw/xwin/winwin32rootless.c | 4 +-- miext/rootless/rootlessWindow.c | 4 +-- xkb/xkbInit.c | 4 +-- 11 files changed, 58 insertions(+), 77 deletions(-) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index d1603c081..6d5eaadc3 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -172,12 +172,11 @@ xf86CreateRootWindow(WindowPtr pWin) Atom prop; prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE); - err = ChangeWindowProperty(pWin, - prop, pProp->type, - pProp->format, PropModeReplace, - pProp->size, pProp->data, - FALSE - ); + err = dixChangeWindowProperty(serverClient, pWin, + prop, pProp->type, + pProp->format, PropModeReplace, + pProp->size, pProp->data, + FALSE); } /* Look at err */ diff --git a/hw/xprint/pcl/PclMisc.c b/hw/xprint/pcl/PclMisc.c index e0b7dced9..0b37836e9 100644 --- a/hw/xprint/pcl/PclMisc.c +++ b/hw/xprint/pcl/PclMisc.c @@ -115,7 +115,7 @@ GetPropString( if(atom != BAD_RESOURCE) { WindowPtr pPropWin; - int n; + int rc, n; /* * The atom has been defined, but it might only exist as a @@ -124,15 +124,12 @@ GetPropString( for(pPropWin = pWin; pPropWin != (WindowPtr)NULL; pPropWin = pPropWin->parent) { - for(pProp = (PropertyPtr)(wUserProps(pPropWin)); - pProp != (PropertyPtr)NULL; - pProp = pProp->next) - { - if (pProp->propertyName == atom) - break; - } - if(pProp != (PropertyPtr)NULL) - break; + rc = dixLookupProperty(&pProp, pPropWin, atom, + serverClient, DixReadAccess); + if (rc == Success) + break; + else + pProp = NULL; } if(pProp == (PropertyPtr)NULL) return (char *)NULL; diff --git a/hw/xprint/pcl/PclWindow.c b/hw/xprint/pcl/PclWindow.c index a87dc0e7a..950933e49 100644 --- a/hw/xprint/pcl/PclWindow.c +++ b/hw/xprint/pcl/PclWindow.c @@ -128,9 +128,9 @@ PclCreateWindow( { propName = MakeAtom(propStrings[i], strlen(propStrings[i]), TRUE); - ChangeWindowProperty(pWin, propName, XA_STRING, 8, - PropModeReplace, strlen(propVal), - (pointer)propVal, FALSE); + dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING, + 8, PropModeReplace, strlen(propVal), + (pointer)propVal, FALSE); xfree(propVal); } } diff --git a/hw/xprint/ps/PsMisc.c b/hw/xprint/ps/PsMisc.c index 0df039e0b..8d5005f91 100644 --- a/hw/xprint/ps/PsMisc.c +++ b/hw/xprint/ps/PsMisc.c @@ -175,7 +175,7 @@ GetPropString( if(atom != BAD_RESOURCE) { WindowPtr pPropWin; - int n; + int rc, n; */ /* @@ -186,15 +186,12 @@ GetPropString( for(pPropWin = pWin; pPropWin != (WindowPtr)NULL; pPropWin = pPropWin->parent) { - for(pProp = (PropertyPtr)(wUserProps(pPropWin)); - pProp != (PropertyPtr)NULL; - pProp = pProp->next) - { - if (pProp->propertyName == atom) - break; - } - if(pProp != (PropertyPtr)NULL) - break; + rc = dixLookupProperty(&pProp, pPropWin, atom, + serverClient, DixReadAccess); + if (rc == Success) + break; + else + pProp = NULL; } if(pProp == (PropertyPtr)NULL) return (char *)NULL; diff --git a/hw/xprint/ps/PsWindow.c b/hw/xprint/ps/PsWindow.c index d17cf8ce0..8bfde4b0d 100644 --- a/hw/xprint/ps/PsWindow.c +++ b/hw/xprint/ps/PsWindow.c @@ -154,9 +154,9 @@ PsCreateWindow(WindowPtr pWin) { propName = MakeAtom(propStrings[i], strlen(propStrings[i]), TRUE); - ChangeWindowProperty(pWin, propName, XA_STRING, 8, - PropModeReplace, strlen(propVal), - (pointer)propVal, FALSE); + dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING, + 8, PropModeReplace, strlen(propVal), + (pointer)propVal, FALSE); xfree(propVal); } } diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index c460ec6ae..072e57ff4 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -154,8 +154,8 @@ AppleWMSetScreenOrigin( data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY); - ChangeWindowProperty(pWin, xa_native_screen_origin(), XA_INTEGER, - 32, PropModeReplace, 2, data, TRUE); + dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(), + XA_INTEGER, 32, PropModeReplace, 2, data, TRUE); } /* Window managers can set the _APPLE_NO_ORDER_IN property on windows @@ -169,15 +169,11 @@ AppleWMDoReorderWindow( { Atom atom; PropertyPtr prop; + int rc; atom = xa_apple_no_order_in(); - for (prop = wUserProps(pWin); prop != NULL; prop = prop->next) - { - if (prop->propertyName == atom && prop->type == atom) - return FALSE; - } - - return TRUE; + rc = dixLookupProperty(&prop, pWin, atom, serverClient, DixReadAccess); + return (rc == Success) && (prop->type == atom); } diff --git a/hw/xquartz/quartzPasteboard.c b/hw/xquartz/quartzPasteboard.c index 0cecff54a..0bf84f5d5 100644 --- a/hw/xquartz/quartzPasteboard.c +++ b/hw/xquartz/quartzPasteboard.c @@ -43,9 +43,6 @@ #include "selection.h" #include "globals.h" -extern Selection *CurrentSelections; -extern int NumCurrentSelections; - // Helper function to read the X11 cut buffer // FIXME: What about multiple screens? Currently, this reads the first @@ -54,18 +51,16 @@ extern int NumCurrentSelections; // Returns NULL if there is no cut text or there is not enough memory. static char * QuartzReadCutBuffer(void) { - int i; + int rc, i; char *text = NULL; for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; PropertyPtr pProp; - pProp = wUserProps (WindowTable[pScreen->myNum]); - while (pProp && pProp->propertyName != XA_CUT_BUFFER0) { - pProp = pProp->next; - } - if (! pProp) continue; + rc = dixLookupProperty(&pProp, WindowTable[pScreen->myNum], + XA_CUT_BUFFER0, serverClient, DixReadAccess); + if (rc != Success) continue; if (pProp->type != XA_STRING) continue; if (pProp->format != 8) continue; @@ -108,43 +103,40 @@ void QuartzReadPasteboard(void) if ((text && oldText && !strequal(text, oldText)) || (text && !oldText)) { - int scrn, sel; + int scrn, rc; + Selection *pSel; for (scrn = 0; scrn < screenInfo.numScreens; scrn++) { ScreenPtr pScreen = screenInfo.screens[scrn]; // Set the cut buffers on each screen // fixme really on each screen? - ChangeWindowProperty(WindowTable[pScreen->myNum], XA_CUT_BUFFER0, - XA_STRING, 8, PropModeReplace, - strlen(text), (pointer)text, TRUE); + dixChangeWindowProperty(serverClient, WindowTable[pScreen->myNum], + XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, + strlen(text), (pointer)text, TRUE); } // Undo any current X selection (similar to code in dispatch.c) // FIXME: what about secondary selection? // FIXME: only touch first XA_PRIMARY selection? - sel = 0; - while ((sel < NumCurrentSelections) && - CurrentSelections[sel].selection != XA_PRIMARY) - sel++; - if (sel < NumCurrentSelections) { + rc = dixLookupSelection(&pSel, XA_PRIMARY, serverClient, + DixSetAttrAccess); + if (rc == Success) { // Notify client if necessary - if (CurrentSelections[sel].client) { + if (pSel->client) { xEvent event; event.u.u.type = SelectionClear; event.u.selectionClear.time = GetTimeInMillis(); - event.u.selectionClear.window = CurrentSelections[sel].window; - event.u.selectionClear.atom = CurrentSelections[sel].selection; - TryClientEvents(CurrentSelections[sel].client, &event, 1, - NoEventMask, NoEventMask /*CantBeFiltered*/, - NullGrab); + event.u.selectionClear.window = pSel->window; + event.u.selectionClear.atom = pSel->selection; + TryClientEvents(pSel->client, &event, 1, NoEventMask, + NoEventMask /*CantBeFiltered*/, NullGrab); } // Erase it - // FIXME: need to erase .selection too? dispatch.c doesn't - CurrentSelections[sel].pWin = NullWindow; - CurrentSelections[sel].window = None; - CurrentSelections[sel].client = NullClient; + pSel->pWin = NullWindow; + pSel->window = None; + pSel->client = NullClient; } } diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c index b9a33de90..864ef0d40 100644 --- a/hw/xquartz/xpr/xprFrame.c +++ b/hw/xquartz/xpr/xprFrame.c @@ -90,8 +90,8 @@ xprSetNativeProperty(RootlessWindowPtr pFrame) /* FIXME: move this to AppleWM extension */ data = native_id; - ChangeWindowProperty(pFrame->win, xa_native_window_id(), - XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE); + dixChangeWindowProperty(serverClient, pFrame->win, xa_native_window_id(), + XA_INTEGER, 32, PropModeReplace, 1, &data, TRUE); } } diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index 4b4cd3ded..6f4e2c97e 100755 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -1087,6 +1087,6 @@ winMWExtWMSetNativeProperty (RootlessWindowPtr pFrame) /* FIXME: move this to WindowsWM extension */ lData = (long) pRLWinPriv->hWnd; - ChangeWindowProperty (pFrame->win, AtmWindowsWmNativeHwnd (), - XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE); + dixChangeWindowProperty(serverClient, pFrame->win, AtmWindowsWmNativeHwnd(), + XA_INTEGER, 32, PropModeReplace, 1, &lData, TRUE); } diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index 7285f959d..0dad44a99 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -181,8 +181,8 @@ set_screen_origin (WindowPtr pWin) data[1] = (dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY); - ChangeWindowProperty (pWin, xa_native_screen_origin (), XA_INTEGER, - 32, PropModeReplace, 2, data, TRUE); + dixChangeWindowProperty(serverClient, pWin, xa_native_screen_origin(), + XA_INTEGER, 32, PropModeReplace, 2, data, TRUE); } /* diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 2b5f1fb68..c0afad026 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -222,8 +222,8 @@ char * pval; ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", out,len); } - ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace, - len,pval,True); + dixChangeWindowProperty(serverClient, WindowTable[0], name, XA_STRING, 8, + PropModeReplace, len, pval, True); xfree(pval); return True; } From 8af2c39bcc4ddc4693d5a2597c9622fa17b6c272 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sat, 1 Mar 2008 16:54:01 +0100 Subject: [PATCH 033/183] Fix big mistake in commit fd41f46ac62033a724bd1f4612f19448a21c1224. - When a mode is deleted, the name pointer is also free()'ed. - This leaves other modes with an invalid pointer. --- hw/xfree86/modes/xf86Modes.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index d6aa61aaf..9e3151254 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -214,8 +214,15 @@ xf86DuplicateMode(DisplayModePtr pMode) *pNew = *pMode; pNew->next = NULL; pNew->prev = NULL; - if (pNew->name == NULL) + /* + * It is important to copy the name explicitly. + * Otherwise a mode could reference an invalid piece of memory, after one of them runs free(). + * This will lead to obscure problems, that you really don't want. + */ + if (pMode->name == NULL) xf86SetModeDefaultName(pNew); + else + pNew->name = xnfstrdup(pMode->name); return pNew; } From cdd46aa3cd2e720558186cdbe48d871ab385fcdd Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Sat, 1 Mar 2008 15:57:57 +0200 Subject: [PATCH 034/183] configure: minor cleanup - dmx - darwin: remove from xorg options - xephyr: libxv is client lib --- configure.ac | 118 +++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 64 deletions(-) diff --git a/configure.ac b/configure.ac index 10aa24158..ebbf87746 100644 --- a/configure.ac +++ b/configure.ac @@ -293,7 +293,6 @@ dnl Bus options and CPU capabilities. Replaces logic in dnl hw/xfree86/os-support/bus/Makefile.am, among others. dnl --------------------------------------------------------------------------- DEFAULT_INT10="x86emu" -use_x86_asm="no" dnl Override defaults as needed for specific platforms: @@ -310,10 +309,8 @@ case $host_cpu in ARM_VIDEO=yes ;; i*86) - use_x86_asm="yes" I386_VIDEO=yes case $host_os in - darwin*) use_x86_asm="no" ;; *linux*) DEFAULT_INT10=vm86 ;; *freebsd*) AC_DEFINE(USE_DEV_IO) ;; *netbsd*) AC_DEFINE(USE_I386_IOPL) @@ -337,10 +334,8 @@ case $host_cpu in GLX_ARCH_DEFINES="-D__GLX_ALIGN64" ;; x86_64*|amd64*) - use_x86_asm="yes" I386_VIDEO=yes case $host_os in - darwin*) use_x86_asm="no" ;; *freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;; *netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl]) SYS_LIBS=-lx86_64 @@ -758,7 +753,6 @@ if test "x$XV" = xyes; then AC_DEFINE(XV, 1, [Support Xv extension]) AC_DEFINE(XvExtension, 1, [Build Xv extension]) REQUIRED_MODULES="$REQUIRED_MODULES videoproto" - PKG_CHECK_MODULES(XV, [xv >= 0.22]) else XVMC=no fi @@ -1160,9 +1154,6 @@ if test "x$GCC" = "xyes"; then LD_EXPORT_SYMBOLS_FLAG="-rdynamic" fi case $host_os in - darwin*) - LD_EXPORT_SYMBOLS_FLAG="" - ;; openbsd*) LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic" ;; @@ -1423,17 +1414,9 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then esac case $host_cpu in - i*86) - case $host_os in - darwin*) ;; - *bsd*) ;; - linux*) ;; - *) xorg_bus_ix86pci=yes ;; - esac - ;; powerpc*) case $host_os in - darwin*|linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu) + linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu) ;; *) xorg_bus_ppcpci="yes" @@ -1444,9 +1427,9 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then xorg_bus_sparcpci="yes" xorg_bus_sparc="yes" ;; - x86_64*|amd64*) + i*86|x86_64*|amd64*) case $host_os in - darwin*|*bsd*|linux*) + *bsd*|linux*) ;; *) xorg_bus_ix86pci="yes" @@ -1649,17 +1632,17 @@ fi AC_MSG_RESULT([$XWIN]) if test "x$XWIN" = xyes; then - XWIN_SERVER_NAME=XWin case $host_os in cygwin*) + XWIN_SERVER_NAME=XWin PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont]) AC_DEFINE(HAS_DEVWINDOWS,1,[Cygwin has /dev/windows for signaling new win32 messages]) AC_DEFINE(ROOTLESS,1,[Build Rootless code]) CFLAGS="$CFLAGS -DFD_SETSIZE=256" ;; mingw*) - PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont]) XWIN_SERVER_NAME=Xming + PKG_CHECK_MODULES([XWINMODULES],[x11 xdmcp xau xfont]) AC_DEFINE(RELOCATE_PROJECTROOT,1,[Make PROJECT_ROOT relative to the xserver location]) AC_DEFINE(HAS_WINSOCK,1,[Use Windows sockets]) XWIN_SYS_LIBS=-lwinsock2 @@ -1755,10 +1738,6 @@ if test "x$XQUARTZ" = xyes; then AC_MSG_NOTICE([Disabling DGA extension]) DGA=no fi - if test "x$DMX" = xyes || test "x$DMX" = xauto; then - AC_MSG_NOTICE([Disabling DMX DDX]) - DMX=no - fi fi # Support for objc in autotools is minimal and not documented. @@ -1801,51 +1780,58 @@ if test "x$LAUNCHD" = "xyes" ; then fi AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"]) + +dnl DMX DDX + AC_MSG_CHECKING([whether to build Xdmx DDX]) PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no]) if test "x$DMX" = xauto; then - DMX="$have_dmx" + DMX="$have_dmx" + case $host_os in + cygwin*) DMX="no" ;; + darwin*) DMX="no" ;; + esac fi AC_MSG_RESULT([$DMX]) AM_CONDITIONAL(DMX, [test "x$DMX" = xyes]) if test "x$DMX" = xyes; then - if test "x$have_dmx" = xno; then - AC_MSG_ERROR([Xdmx build explicitly requested, but required - modules not found.]) - fi - DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC" - XDMX_CFLAGS="$DMXMODULES_CFLAGS" - XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" - XDMX_SYS_LIBS="$DMXMODULES_LIBS" - AC_SUBST([XDMX_CFLAGS]) - AC_SUBST([XDMX_LIBS]) - AC_SUBST([XDMX_SYS_LIBS]) + if test "x$have_dmx" = xno; then + AC_MSG_ERROR([Xdmx build explicitly requested, but required + modules not found.]) + fi + DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC" + XDMX_CFLAGS="$DMXMODULES_CFLAGS" + XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" + XDMX_SYS_LIBS="$DMXMODULES_LIBS" + AC_SUBST([XDMX_CFLAGS]) + AC_SUBST([XDMX_LIBS]) + AC_SUBST([XDMX_SYS_LIBS]) dnl USB sources in DMX require - AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes", - DMX_BUILD_USB="no") + AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes", + DMX_BUILD_USB="no") dnl Linux sources in DMX require - AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes", - DMX_BUILD_LNX="no") - if test "x$GLX" = xyes; then - PKG_CHECK_MODULES([GL], [glproto]) - fi - PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11]) - AC_SUBST(XDMXCONFIG_DEP_CFLAGS) - AC_SUBST(XDMXCONFIG_DEP_LIBS) - PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11]) - AC_SUBST(DMXEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11]) - AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11]) - AC_SUBST(DMXXIEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11]) - AC_SUBST(XTSTEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11]) - AC_SUBST(XRESEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11]) - AC_SUBST(X11EXAMPLES_DEP_LIBS) + AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes", + DMX_BUILD_LNX="no") + if test "x$GLX" = xyes; then + PKG_CHECK_MODULES([GL], [glproto]) + fi + PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11]) + AC_SUBST(XDMXCONFIG_DEP_CFLAGS) + AC_SUBST(XDMXCONFIG_DEP_LIBS) + PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11]) + AC_SUBST(DMXEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11]) + AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11]) + AC_SUBST(DMXXIEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11]) + AC_SUBST(XTSTEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11]) + AC_SUBST(XRESEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11]) + AC_SUBST(X11EXAMPLES_DEP_LIBS) fi AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes]) AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes]) @@ -1909,7 +1895,11 @@ if test "$KDRIVE" = yes; then XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS" fi - PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"]) + XEPHYR_REQUIRED_LIBS="x11 xext xfont xau xdmcp" + if test "x$XV" = xyes; then + XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv" + fi + PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"]) if test "x$XEPHYR" = xauto; then XEPHYR=$xephyr fi @@ -1941,7 +1931,7 @@ if test "$KDRIVE" = yes; then KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux' KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC" - KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS $XV_CFLAGS" + KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS" KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB" KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a' @@ -1955,10 +1945,10 @@ if test "$KDRIVE" = yes; then KDRIVE_LOCAL_LIBS="$TSLIB_LIBS $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB $CONFIG_LIB" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB $OS_LIB" - KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $XV_LIBS" + KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS" # check if we can build Xephyr - PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"]) + PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"]) AC_SUBST([XEPHYR_LIBS]) AC_SUBST([XEPHYR_INCS]) From e7a6f79754816976d92857d55840262cccff80a6 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Sat, 1 Mar 2008 16:16:29 +0200 Subject: [PATCH 035/183] glcore: split mesa and X in build system --- GL/mesa/Makefile.am | 7 +++++-- GL/mesa/X/Makefile.am | 38 ++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/GL/mesa/Makefile.am b/GL/mesa/Makefile.am index 99d3834ac..6d1a439da 100644 --- a/GL/mesa/Makefile.am +++ b/GL/mesa/Makefile.am @@ -1,9 +1,10 @@ -SUBDIRS = main math swrast swrast_setup tnl shader X glapi vbo +SUBDIRS = X +SUBDIRS += main math swrast swrast_setup tnl shader glapi vbo noinst_LTLIBRARIES = libGLcore.la libGLcore_la_SOURCES = dummy.c -libGLcore_la_LIBADD = main/libmain.la \ +MESA_LIBS = main/libmain.la \ math/libmath.la \ swrast/libswrast.la \ swrast_setup/libss.la \ @@ -12,4 +13,6 @@ libGLcore_la_LIBADD = main/libmain.la \ shader/grammar/libgrammar.la \ shader/slang/libslang.la \ vbo/libvbo.la \ + +libGLcore_la_LIBADD = $(MESA_LIBS) \ X/libX.la diff --git a/GL/mesa/X/Makefile.am b/GL/mesa/X/Makefile.am index ace118170..d8abbc6bd 100644 --- a/GL/mesa/X/Makefile.am +++ b/GL/mesa/X/Makefile.am @@ -1,19 +1,10 @@ noinst_LTLIBRARIES = libX.la INCLUDES = -I@MESA_SOURCE@/include \ - -I../X \ - -I../glapi \ - -I../main \ - -I../math \ - -I../shader \ - -I../swrast \ - -I../swrast_setup \ - -I../tnl \ - -I.. \ - -I../../glx \ - -I$(top_srcdir)/GL/glx \ - -I$(top_srcdir)/GL/include \ - -I$(top_srcdir)/hw/xfree86/os-support + -I. \ + -I@MESA_SOURCE@/src/mesa/glapi \ + -I@MESA_SOURCE@/src/mesa/main \ + -I@MESA_SOURCE@/src/mesa # -DXFree86Server is required because the X11 driver in Mesa thinks that # symbol means "being built in the server" @@ -22,12 +13,15 @@ AM_CFLAGS = \ -DXFree86Server \ @GLX_DEFINES@ -nodist_libX_la_SOURCES = \ - xm_api.c \ - xm_buffer.c \ - xm_dd.c \ - xm_image.c \ - xm_line.c \ - xm_span.c \ - xm_tri.c \ - drivers/common/driverfuncs.c +XM_SOURCES = \ + xm_api.c \ + xm_buffer.c \ + xm_dd.c \ + xm_image.c \ + xm_line.c \ + xm_span.c \ + xm_tri.c + +XM_SOURCES += drivers/common/driverfuncs.c + +nodist_libX_la_SOURCES = $(XM_SOURCES) From 3d642905477f4b1ec3223f1fbe0d0d37e959ec81 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Sat, 1 Mar 2008 16:18:18 +0200 Subject: [PATCH 036/183] clean some "unused" warnings --- hw/xfree86/common/xf86Helper.c | 1 - hw/xfree86/ddc/xf86DDC.c | 9 --- hw/xfree86/int10/helper_exec.c | 2 - hw/xfree86/parser/Screen.c | 1 - hw/xfree86/parser/scan.c | 2 +- hw/xfree86/vbe/vbeModes.c | 3 +- mi/midash.c | 32 -------- mi/miexpose.c | 2 - mi/mioverlay.c | 1 - mi/miwindow.c | 1 - os/connection.c | 1 - os/io.c | 129 --------------------------------- randr/rrscreen.c | 1 - 13 files changed, 2 insertions(+), 183 deletions(-) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 0d2471aa1..1dd0bbc0d 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1093,7 +1093,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable) WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = FALSE; - RegionPtr pOldClip = NULL; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index e47b8b80c..28e2ead28 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -13,8 +13,6 @@ #include "ddcPriv.h" #include -static const OptionInfoRec *DDCAvailableOptions(void *unused); - #define RETRIES 4 static unsigned char *EDIDRead_DDC1( @@ -58,13 +56,6 @@ static const OptionInfoRec DDCOptions[] = { { -1, NULL, OPTV_NONE, {0}, FALSE }, }; -/*ARGSUSED*/ -static const OptionInfoRec * -DDCAvailableOptions(void *unused) -{ - return (DDCOptions); -} - /** * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are * unset. EDID information blocks are interpreted and the results returned in diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index e8334262e..de6fde5d8 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -46,8 +46,6 @@ static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set); #define REG pInt -static int pci_config_cycle = 0; - int setup_int(xf86Int10InfoPtr pInt) { diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c index ad08c1382..dfc02bb72 100644 --- a/hw/xfree86/parser/Screen.c +++ b/hw/xfree86/parser/Screen.c @@ -508,7 +508,6 @@ xf86validateScreen (XF86ConfigPtr p) { XF86ConfScreenPtr screen = p->conf_screen_lst; XF86ConfMonitorPtr monitor; - XF86ConfDevicePtr device; XF86ConfAdaptorLinkPtr adaptor; while (screen) diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index 9706d483b..1f9b1b8de 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -612,7 +612,7 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot, { char *result; int i, l; - static const char *env = NULL, *home = NULL; + static const char *env = NULL; static char *hostname = NULL; static char majorvers[3] = ""; diff --git a/hw/xfree86/vbe/vbeModes.c b/hw/xfree86/vbe/vbeModes.c index 061d7b695..fb730a708 100644 --- a/hw/xfree86/vbe/vbeModes.c +++ b/hw/xfree86/vbe/vbeModes.c @@ -127,10 +127,9 @@ CheckMode(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe, int id, { CARD16 major; VbeModeInfoBlock *mode; - DisplayModePtr pMode, p; + DisplayModePtr pMode; VbeModeInfoData *data; Bool modeOK = FALSE; - ModeStatus status = MODE_OK; major = (unsigned)(vbe->VESAVersion >> 8); diff --git a/mi/midash.c b/mi/midash.c index 912fb0389..95a19c295 100644 --- a/mi/midash.c +++ b/mi/midash.c @@ -52,38 +52,6 @@ SOFTWARE. #include "mistruct.h" #include "mifpoly.h" -static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax); - -#define NSEGDELTA 16 - -/* returns a pointer to the pseg[nseg-1], growing the storage as -necessary. this interface seems unnecessarily cumbersome. - -*/ - -static miDashPtr -CheckDashStorage( - miDashPtr *ppseg, /* base pointer */ - int nseg, /* number of segment we want to write to */ - int *pnsegMax) /* size (in segments) of list so far */ -{ - if (nseg > *pnsegMax) - { - miDashPtr newppseg; - - *pnsegMax += NSEGDELTA; - newppseg = (miDashPtr)xrealloc(*ppseg, - (*pnsegMax)*sizeof(miDashRec)); - if (!newppseg) - { - xfree(*ppseg); - return (miDashPtr)NULL; - } - *ppseg = newppseg; - } - return(*ppseg+(nseg-1)); -} - _X_EXPORT void miStepDash (dist, pDashIndex, pDash, numInDashList, pDashOffset) int dist; /* distance to step */ diff --git a/mi/miexpose.c b/mi/miexpose.c index 2d3b0d510..5c2bd0382 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -288,8 +288,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable, #endif if (extents) { - WindowPtr pWin = (WindowPtr)pDstDrawable; - expBox = *REGION_EXTENTS(pscr, &rgnExposed); REGION_RESET(pscr, &rgnExposed, &expBox); } diff --git a/mi/mioverlay.c b/mi/mioverlay.c index a0adac54d..6ddcc052d 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -1528,7 +1528,6 @@ miOverlaySetShape(WindowPtr pWin) { Bool WasViewable = (Bool)(pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; - RegionPtr pOldClip = NULL; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif diff --git a/mi/miwindow.c b/mi/miwindow.c index 77cb75009..cb8400c0c 100644 --- a/mi/miwindow.c +++ b/mi/miwindow.c @@ -938,7 +938,6 @@ miSetShape(pWin) Bool WasViewable = (Bool)(pWin->viewable); ScreenPtr pScreen = pWin->drawable.pScreen; Bool anyMarked = FALSE; - RegionPtr pOldClip = NULL; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif diff --git a/os/connection.c b/os/connection.c index 8b6541ce6..1ae50fef0 100644 --- a/os/connection.c +++ b/os/connection.c @@ -546,7 +546,6 @@ AuthAudit (ClientPtr client, Bool letin, { char addr[128]; char *out = addr; - int client_uid; char client_uid_string[64]; LocalClientCredRec *lcc; #ifdef XSERVER_DTRACE diff --git a/os/io.c b/os/io.c index be89021e5..e7ec60952 100644 --- a/os/io.c +++ b/os/io.c @@ -91,8 +91,6 @@ _X_EXPORT CallbackListPtr FlushCallback; static ConnectionInputPtr AllocateInputBuffer(void); static ConnectionOutputPtr AllocateOutputBuffer(void); -static xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore); -static void SkipRequests(xReqPtr req, ClientPtr client, int numskipped); /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN @@ -618,135 +616,8 @@ ResetCurrentRequest(ClientPtr client) -/***************************************************************** - * PeekNextRequest and SkipRequests were implemented to support DBE - * idioms, but can certainly be used outside of DBE. There are two - * related macros in os.h, ReqLen and CastxReq. See the porting - * layer document for more details. - * - **********************/ - - -/***************************************************************** - * PeekNextRequest - * lets you look ahead at the unexecuted requests in a - * client's request buffer. - * - * Note: this implementation of PeekNextRequest ignores the - * readmore parameter. - * - **********************/ - -static xReqPtr -PeekNextRequest( - xReqPtr req, /* request we're starting from */ - ClientPtr client, /* client whose requests we're skipping */ - Bool readmore) /* attempt to read more if next request isn't there? */ -{ - register ConnectionInputPtr oci = ((OsCommPtr)client->osPrivate)->input; - xReqPtr pnextreq; - int needed, gotnow, reqlen; - - if (!oci) return NULL; - - if (!req) - { - /* caller wants the request after the one currently being executed */ - pnextreq = (xReqPtr) - (((CARD32 *)client->requestBuffer) + client->req_len); - } - else - { - /* caller wants the request after the one specified by req */ - reqlen = get_req_len(req, client); -#ifdef BIGREQS - if (!reqlen) reqlen = get_big_req_len(req, client); -#endif - pnextreq = (xReqPtr)(((char *)req) + (reqlen << 2)); - } - - /* see how much of the next request we have available */ - - gotnow = oci->bufcnt - (((char *)pnextreq) - oci->buffer); - - if (gotnow < sizeof(xReq)) - return NULL; - - needed = get_req_len(pnextreq, client) << 2; -#ifdef BIGREQS - if (!needed) - { - /* it's a big request */ - if (gotnow < sizeof(xBigReq)) - return NULL; - needed = get_big_req_len(pnextreq, client) << 2; - } -#endif - - /* if we have less than we need, return NULL */ - - return (gotnow < needed) ? NULL : pnextreq; -} - -/***************************************************************** - * SkipRequests - * lets you skip over some of the requests in a client's - * request buffer. Presumably the caller has used PeekNextRequest - * to examine the requests being skipped and has performed whatever - * actions they dictate. - * - **********************/ - _X_EXPORT CallbackListPtr SkippedRequestsCallback = NULL; -static void -SkipRequests( - xReqPtr req, /* last request being skipped */ - ClientPtr client, /* client whose requests we're skipping */ - int numskipped) /* how many requests we're skipping */ -{ - OsCommPtr oc = (OsCommPtr)client->osPrivate; - register ConnectionInputPtr oci = oc->input; - int reqlen; - - /* see if anyone wants to snoop the skipped requests */ - - if (SkippedRequestsCallback) - { - SkippedRequestInfoRec skipinfo; - skipinfo.req = req; - skipinfo.client = client; - skipinfo.numskipped = numskipped; - CallCallbacks(&SkippedRequestsCallback, &skipinfo); - } - - /* adjust the sequence number */ - client->sequence += numskipped; - - /* twiddle the oci to skip over the requests */ - - reqlen = get_req_len(req, client); -#ifdef BIGREQS - if (!reqlen) reqlen = get_big_req_len(req, client); -#endif - reqlen <<= 2; - oci->bufptr = (char *)req; - oci->lenLastReq = reqlen; - - /* see if any requests left in the buffer */ - - if ( ((char *)req + reqlen) == (oci->buffer + oci->bufcnt) ) - { - /* no requests; mark input buffer as available and client - * as having no input - */ - int fd = oc->fd; - AvailableInput = oc; - YieldControlNoInput(); - } -} - - /* lookup table for adding padding bytes to data that is read from or written to the X socket. */ static int padlength[4] = {0, 3, 2, 1}; diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 811a5571b..f39197337 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -731,7 +731,6 @@ ProcRRSetScreenConfig (ClientPtr client) int n, rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; - TimeStamp configTime; TimeStamp time; int i; Rotation rotation; From b0b9c811cda3e35a8f6d0813483f750602c55ff6 Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Sat, 1 Mar 2008 20:24:50 +0200 Subject: [PATCH 037/183] fix typo --- GL/mesa/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GL/mesa/Makefile.am b/GL/mesa/Makefile.am index 6d1a439da..7f27c58ba 100644 --- a/GL/mesa/Makefile.am +++ b/GL/mesa/Makefile.am @@ -12,7 +12,7 @@ MESA_LIBS = main/libmain.la \ shader/libshader.la \ shader/grammar/libgrammar.la \ shader/slang/libslang.la \ - vbo/libvbo.la \ + vbo/libvbo.la libGLcore_la_LIBADD = $(MESA_LIBS) \ X/libX.la From 2bb9c1f36f685044b837f42076dec2ea7d22d034 Mon Sep 17 00:00:00 2001 From: David Nusinow Date: Sat, 1 Mar 2008 18:44:58 -0500 Subject: [PATCH 038/183] bug #10008: Make Xvfb.1 document the correct default depth --- hw/vfb/Xvfb.man.pre | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/vfb/Xvfb.man.pre b/hw/vfb/Xvfb.man.pre index e78e296f5..569afe175 100644 --- a/hw/vfb/Xvfb.man.pre +++ b/hw/vfb/Xvfb.man.pre @@ -55,7 +55,7 @@ manual page, \fIXvfb\fP accepts the following command line switches: .B "\-screen \fIscreennum\fP \fIWxHxD\fP" This option creates screen \fIscreennum\fP and sets its width, height, and depth to W, H, and D respectively. By default, only screen 0 exists -and has the dimensions 1280x1024x12. +and has the dimensions 1280x1024x8. .TP 4 .B "\-pixdepths \fIlist-of-depths\fP" This option specifies a list of pixmap depths that the server should @@ -106,12 +106,12 @@ will be depth 32 1600x1200. .TP 8 Xvfb :1 -screen 1 1600x1200x16 The server will listen for connections as server number 1, will have the -default screen configuration (one screen, 1280x1024x12), and screen 1 +default screen configuration (one screen, 1280x1024x8), and screen 1 will be depth 16 1600x1200. .TP 8 Xvfb -pixdepths 3 27 -fbdir /var/tmp The server will listen for connections as server number 0, will have the -default screen configuration (one screen, 1280x1024x12), +default screen configuration (one screen, 1280x1024x8), will also support pixmap depths of 3 and 27, and will use memory mapped files in /var/tmp for the framebuffer. From c934366424b0d20e013c84e6b94b226b20e7baa2 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sun, 2 Mar 2008 19:27:53 +0100 Subject: [PATCH 039/183] use UTILS_SYS_LIBS to pass SYS_LIBS to utils/ioports correctly --- configure.ac | 3 +++ hw/xfree86/utils/ioport/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ebbf87746..6388e747c 100644 --- a/configure.ac +++ b/configure.ac @@ -1137,6 +1137,9 @@ XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${LIBCRYPTO}" AC_SUBST([XSERVER_LIBS]) AC_SUBST([XSERVER_SYS_LIBS]) +UTILS_SYS_LIBS="${SYS_LIBS}" +AC_SUBST([UTILS_SYS_LIBS]) + # The Xorg binary needs to export symbols so that they can be used from modules # Some platforms require extra flags to do this. gcc should set these flags # when -rdynamic is passed to it, other compilers/linkers may need to be added diff --git a/hw/xfree86/utils/ioport/Makefile.am b/hw/xfree86/utils/ioport/Makefile.am index 1839c9a60..c1f9453a8 100644 --- a/hw/xfree86/utils/ioport/Makefile.am +++ b/hw/xfree86/utils/ioport/Makefile.am @@ -37,7 +37,7 @@ ioport_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) ioport_LDADD = \ ../../os-support/libxorgos.la \ ../../dummylib/libdummy-nonserver.a \ - ${SYS_LIBS} + ${UTILS_SYS_LIBS} ioport_SOURCES = \ From b5ce0e1d0b861dc5521fcd9db6287ed6da817726 Mon Sep 17 00:00:00 2001 From: David Nusinow Date: Sun, 2 Mar 2008 17:12:02 -0500 Subject: [PATCH 040/183] Bug #13860: Ensure that the DRI mode is in octal format. --- hw/xfree86/parser/Configint.h | 5 +++++ hw/xfree86/parser/DRI.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h index 4d5fbcfab..684a001fc 100644 --- a/hw/xfree86/parser/Configint.h +++ b/hw/xfree86/parser/Configint.h @@ -71,11 +71,14 @@ #include #include "xf86Parser.h" +typedef enum { PARSE_DECIMAL, PARSE_OCTAL, PARSE_HEX } ParserNumType; + typedef struct { int num; /* returned number */ char *str; /* private copy of the return-string */ double realnum; /* returned number as a real */ + ParserNumType numType; /* used to enforce correct number formatting */ } LexRec, *LexPtr; @@ -211,6 +214,8 @@ else\ "\ta numerical group id." #define MULTIPLE_MSG \ "Multiple \"%s\" lines." +#define MUST_BE_OCTAL_MSG \ +"The number \"%d\" given in this section must be in octal (0xxx) format." /* Warning messages */ #define OBSOLETE_MSG \ diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c index 18644bcc7..68a6db90b 100644 --- a/hw/xfree86/parser/DRI.c +++ b/hw/xfree86/parser/DRI.c @@ -117,6 +117,8 @@ xf86parseDRISection (void) case MODE: if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER) Error (NUMBER_MSG, "Mode"); + if (val.numType != PARSE_OCTAL) + Error (MUST_BE_OCTAL_MSG, val.num); ptr->dri_mode = val.num; break; case BUFFERS: From f7ab2d3821e6bccc943f088e308fd58395a186d2 Mon Sep 17 00:00:00 2001 From: David Nusinow Date: Sun, 2 Mar 2008 18:36:25 -0500 Subject: [PATCH 041/183] Add missing file from previous commit. --- hw/xfree86/parser/scan.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c index 1f9b1b8de..851b91161 100644 --- a/hw/xfree86/parser/scan.c +++ b/hw/xfree86/parser/scan.c @@ -380,11 +380,20 @@ again: if (c == '0') if ((configBuf[configPos] == 'x') || (configBuf[configPos] == 'X')) + { base = 16; + val.numType = PARSE_HEX; + } else + { base = 8; + val.numType = PARSE_OCTAL; + } else + { base = 10; + val.numType = PARSE_DECIMAL; + } configRBuf[0] = c; i = 1; From 7c16b68ab879f5b4b1aedfc6b2aadbe56193dd19 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 3 Mar 2008 15:09:11 -0500 Subject: [PATCH 042/183] 1.5 has branched, start 1.5.99.x. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6388e747c..5417bbbda 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([xorg-server], 1.4.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +AC_INIT([xorg-server], 1.5.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AM_MAINTAINER_MODE From 3b73d62791d925c465ec855f96981d151dd3c179 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 3 Mar 2008 15:43:22 -0500 Subject: [PATCH 043/183] xf86DDCMonitorSet: Honor the DisplaySize from the config file. We honor sync ranges and pixel clock settings from the config here, no reason to ignore DisplaySize. --- hw/xfree86/modes/xf86EdidModes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index a9d672265..ea36d0a59 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -662,8 +662,10 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC) Monitor->DDC = DDC; - Monitor->widthmm = 10 * DDC->features.hsize; - Monitor->heightmm = 10 * DDC->features.vsize; + if (Monitor->widthmm <= 0 && Monitor->heightmm <= 0) { + Monitor->widthmm = 10 * DDC->features.hsize; + Monitor->heightmm = 10 * DDC->features.vsize; + } /* * If this is a digital display, then we can use reduced blanking. From 605e6764dfd3e9cb917b9cfcd92fe89857c1a1c9 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 3 Mar 2008 15:45:17 -0500 Subject: [PATCH 044/183] Fix Motif menu drawing in Xnest. See also Red Hat bug #229350, OpenSolaris bug #6366490. --- hw/xnest/Events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c index 38fefa7a2..073535482 100644 --- a/hw/xnest/Events.c +++ b/hw/xnest/Events.c @@ -88,7 +88,7 @@ xnestCollectExposures(void) while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) { pWin = xnestWindowPtr(X.xexpose.window); - if (pWin) { + if (pWin && X.xexpose.width && X.xexpose.height) { Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x; Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y; Box.x2 = Box.x1 + X.xexpose.width; @@ -96,7 +96,7 @@ xnestCollectExposures(void) REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1); - miWindowExposures(pWin, &Rgn, NullRegion); + miSendExposures(pWin, &Rgn, Box.x2, Box.y2); } } } From 708f07753ff22ade54e9ee8885e4198fff363b87 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 3 Mar 2008 15:49:48 -0500 Subject: [PATCH 045/183] RANDR 1.2: Inherit PreferredMode from the global configuration, if any. If you don't do this, then Modes "800x600" in the Display subsection will be dutifully ignored and the driver will start at whatever resolution it feels like. --- hw/xfree86/modes/xf86Crtc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 266e08195..14b60496a 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1261,6 +1261,23 @@ xf86SortModes (DisplayModePtr input) return output; } +static char * +preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output) +{ + char *preferred_mode = NULL; + + /* Check for a configured preference for a particular mode */ + preferred_mode = xf86GetOptValString (output->options, + OPTION_PREFERRED_MODE); + if (preferred_mode) + return preferred_mode; + + if (pScrn->display->modes && *pScrn->display->modes) + preferred_mode = *pScrn->display->modes; + + return preferred_mode; +} + _X_EXPORT void xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) { @@ -1445,8 +1462,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) output->probed_modes = xf86SortModes (output->probed_modes); /* Check for a configured preference for a particular mode */ - preferred_mode = xf86GetOptValString (output->options, - OPTION_PREFERRED_MODE); + preferred_mode = preferredMode(scrn, output); if (preferred_mode) { From 3f23139137e024e09d207be05a61968100cf53e8 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 3 Mar 2008 13:05:12 -0800 Subject: [PATCH 046/183] Add cscope files to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 406b74c4e..fb2f7e597 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ ltmain.sh missing TAGS tags +cscope* ylwrap xorg-server.pc stamp-h? From 613852ce6a821ce6f6382fc14629f517776a3701 Mon Sep 17 00:00:00 2001 From: James Cloos Date: Mon, 3 Mar 2008 16:10:04 -0500 Subject: [PATCH 047/183] Fix some documentation typos --- hw/xfree86/ddc/DDC.HOWTO | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/ddc/DDC.HOWTO b/hw/xfree86/ddc/DDC.HOWTO index 833a7ab54..1d06ca124 100644 --- a/hw/xfree86/ddc/DDC.HOWTO +++ b/hw/xfree86/ddc/DDC.HOWTO @@ -6,24 +6,24 @@ When implementing DDC in the driver one has the choice between DDC1 and DDC2. - DDC1 data is contiuously transmitted by a DDC1 capable display + DDC1 data is continuously transmitted by a DDC1 capable display device. The data is send serially over a data line; the Vsync signal serves as clock. Only one EDID 1.x data block can be transmitted using DDC1. Since transmission of an EDID1 block using a regular Vsync frequency would take up several seconds the driver can increase the Vsync frequency to up to 25 kHz as - soon as it detects DDC1 activety on the data line. + soon as it detects DDC1 activity on the data line. DDC2 data is transmitted using the I2C protocol. This requires an additional clock line. DDC2 is capable of transmitting EDID1 and EDID2 block as well as a VDIF block on display devices that support these. Display devices switch into the DDC2 mode as soon as they detect - activety on the DDC clock line. Once the are in DDC2 mode they + activity on the DDC clock line. Once the are in DDC2 mode they stop transmitting DDC1 signals until the next power cycle. Some graphics chipset configurations which are not capable of DDC2 might still be able to read DDC1 data. Where available - DDC2 it is preferrable. + DDC2 it is preferable. All relevant prototypes and defines are in xf86DDC.h. DDC2 additionally requires I2C support. The I2C prototypes @@ -37,7 +37,7 @@ unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn) - Additionally a function is required to inclrease the Vsync + Additionally a function is required to increase the Vsync frequency to max. 25 kHz. void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed) @@ -58,7 +58,7 @@ in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed() function, DDC1Read has to point to the DDC1 read function. The function will return a pointer to the xf86Monitor structure - which contains all information retreived by DDC. + which contains all information retrieved by DDC. NULL will be returned on failure. DDC2 Support @@ -73,7 +73,7 @@ to the I2CBusRec of the appropriate I2C Bus has to be passed as the second argument. The function will return a pointer to the xf86Monitor structure - which contains all information retreived by DDC. + which contains all information retrieved by DDC. NULL will be returned on failure. Printing monitor parameters @@ -86,7 +86,7 @@ is provided. Further processing of the xf86Monitor structure is not yet - implemented. Howerver it is planned to use the information + implemented. However, it is planned to use the information about video modes, gamma values etc. Therefore it is strongly recommended to read out DDC data before any video mode processing is done. From 0bd0f90d7c7928052197da7119177e5a1c9eee2c Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 4 Mar 2008 03:47:36 +0200 Subject: [PATCH 048/183] XKB: Fix initial map setting on startup Due to an unwitting sense inversion when eliminating XkbFileInfo, we were setting the complete wrong keymap on startup (non-XKB map if we had an XKB map available, or the XKB map if we didn't have any available). Invert the sense properly, and add two small bits that also went missing in that commit. --- xkb/xkbInit.c | 7 ++++--- xkb/xkbfmisc.c | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index c0afad026..3b47396e5 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -375,7 +375,8 @@ Atom unknown; names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch"); } - if (!(xkb->defined & XkmIndicatorsMask)) { + if (!(xkb->defined & XkmIndicatorsMask) || + !(xkb->defined & XkmGeometryMask)) { initIndicatorNames(NULL,xkb); if (names->indicators[LED_CAPS-1]==None) names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock"); @@ -531,10 +532,10 @@ XkbEventCauseRec cause; XkbDDXInitDevice(pXDev); if (xkb->defined & XkmSymbolsMask) + XkbUpdateCoreDescription(pXDev, True); + else XkbUpdateKeyTypesFromCore(pXDev, xkb->min_key_code, XkbNumKeys(xkb), &changes); - else - XkbUpdateCoreDescription(pXDev, True); XkbSetCauseUnknown(&cause); XkbUpdateActions(pXDev,xkb->min_key_code, XkbNumKeys(xkb),&changes, diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 866b4b154..ae752e945 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -184,9 +184,27 @@ unsigned wantNames,wantConfig,wantDflts; if (want==0) return False; - if (xkb!=NULL) - old_names= xkb->names; - else old_names= NULL; + if (xkb) { + old_names = xkb->names; + + xkb->defined = 0; + /* Wow would it ever be neat if we didn't need this noise. */ + if (xkb->names && xkb->names->keys) + xkb->defined |= XkmKeyNamesMask; + if (xkb->map && xkb->map->types) + xkb->defined |= XkmTypesMask; + if (xkb->compat) + xkb->defined |= XkmCompatMapMask; + if (xkb->map && xkb->map->num_syms) + xkb->defined |= XkmSymbolsMask; + if (xkb->indicators) + xkb->defined |= XkmIndicatorsMask; + if (xkb->geom) + xkb->defined |= XkmGeometryMask; + } + else { + old_names= NULL; + } wantConfig= want&(~complete); if (xkb!=NULL) { From 72f2197545e734cd0aa785d05a57b2fc0351a763 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 4 Mar 2008 02:02:54 -0500 Subject: [PATCH 049/183] dix: Convert selection list to a linked list. Fixes a bug where pointers were being invalidated after a realloc. --- dix/selection.c | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/dix/selection.c b/dix/selection.c index 52b1611c5..11a174ee6 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -66,24 +66,22 @@ SOFTWARE. *****************************************************************/ _X_EXPORT Selection *CurrentSelections; -static int NumCurrentSelections; CallbackListPtr SelectionCallback; _X_EXPORT int dixLookupSelection(Selection **result, Atom selectionName, ClientPtr client, Mask access_mode) { - Selection *pSel = NULL; - int i, rc = BadMatch; + Selection *pSel; + int rc = BadMatch; client->errorValue = selectionName; - for (i = 0; i < NumCurrentSelections; i++) - if (CurrentSelections[i].selection == selectionName) { - pSel = CurrentSelections + i; - rc = XaceHookSelectionAccess(client, &pSel, access_mode); + for (pSel = CurrentSelections; pSel; pSel = pSel->next) + if (pSel->selection == selectionName) break; - } + if (pSel) + rc = XaceHookSelectionAccess(client, &pSel, access_mode); *result = pSel; return rc; } @@ -91,14 +89,17 @@ dixLookupSelection(Selection **result, Atom selectionName, void InitSelections(void) { - Selection *pSel = CurrentSelections; + Selection *pSel, *pNextSel; - for (; pSel - CurrentSelections < NumCurrentSelections; pSel++) + pSel = CurrentSelections; + while (pSel) { + pNextSel = pSel->next; dixFreePrivates(pSel->devPrivates); + xfree(pSel); + pSel = pNextSel; + } - xfree(CurrentSelections); CurrentSelections = NULL; - NumCurrentSelections = 0; } static _X_INLINE void @@ -112,9 +113,9 @@ CallSelectionCallback(Selection *pSel, ClientPtr client, void DeleteWindowFromAnySelections(WindowPtr pWin) { - Selection *pSel = CurrentSelections; + Selection *pSel; - for (; pSel - CurrentSelections < NumCurrentSelections; pSel++) + for (pSel = CurrentSelections; pSel; pSel = pSel->next) if (pSel->pWin == pWin) { CallSelectionCallback(pSel, NULL, SelectionWindowDestroy); @@ -127,9 +128,9 @@ DeleteWindowFromAnySelections(WindowPtr pWin) void DeleteClientFromAnySelections(ClientPtr client) { - Selection *pSel = CurrentSelections; + Selection *pSel; - for (; pSel - CurrentSelections < NumCurrentSelections; pSel++) + for (pSel = CurrentSelections; pSel; pSel = pSel->next) if (pSel->client == client) { CallSelectionCallback(pSel, NULL, SelectionClientClose); @@ -197,23 +198,18 @@ ProcSetSelectionOwner(ClientPtr client) /* * It doesn't exist, so add it... */ - int size = (NumCurrentSelections + 1) * sizeof(Selection); - CurrentSelections = xrealloc(CurrentSelections, size); - if (!CurrentSelections) { - NumCurrentSelections = 0; + pSel = xalloc(sizeof(Selection)); + if (!pSel) return BadAlloc; - } - pSel = CurrentSelections + NumCurrentSelections; + pSel->selection = stuff->selection; pSel->devPrivates = NULL; /* security creation/labeling check */ (void)XaceHookSelectionAccess(client, &pSel, DixCreateAccess); - pSel->next = NULL; - if (NumCurrentSelections > 0) - CurrentSelections[NumCurrentSelections - 1].next = pSel; - NumCurrentSelections++; + pSel->next = CurrentSelections; + CurrentSelections = pSel; } else return rc; From 056a2ce02ce85013e89055ee44a7aa3eabedac09 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 4 Mar 2008 02:44:48 -0500 Subject: [PATCH 050/183] XACE: Check the return value of the selection create hook call. --- dix/selection.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dix/selection.c b/dix/selection.c index 11a174ee6..6a9198e96 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -206,7 +206,12 @@ ProcSetSelectionOwner(ClientPtr client) pSel->devPrivates = NULL; /* security creation/labeling check */ - (void)XaceHookSelectionAccess(client, &pSel, DixCreateAccess); + rc = XaceHookSelectionAccess(client, &pSel, + DixCreateAccess|DixSetAttrAccess); + if (rc != Success) { + xfree(pSel); + return rc; + } pSel->next = CurrentSelections; CurrentSelections = pSel; From 95df04b744c6a3498a9a9e2ea9bb03ee780e60f8 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 4 Mar 2008 10:59:24 -0500 Subject: [PATCH 051/183] Remove all mention of the vga driver from the config logic. --- hw/xfree86/common/xf86AutoConfig.c | 3 --- hw/xfree86/common/xf86Config.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index da6c3f38d..e3e0bb3a3 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -82,7 +82,6 @@ static int builtinLines = 0; static const char *deviceList[] = { "fbdev", "vesa", - "vga", NULL }; @@ -450,8 +449,6 @@ chooseVideoDriver(void) if (chosen_driver == NULL) { #if defined __i386__ || defined __amd64__ || defined __hurd__ chosen_driver = "vesa"; -#elif defined __alpha__ - chosen_driver = "vga"; #elif defined __sparc__ chosen_driver = "sunffb"; #else diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index de3edf638..635a88c91 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -494,7 +494,7 @@ xf86InputDriverlistFromConfig() static void fixup_video_driver_list(char **drivers) { - static const char *fallback[5] = { "vga", "vesa", "fbdev", "wsfb", NULL }; + static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL }; char **end, **drv; char *x; char **ati, **atimisc; From 27e7dacbf7ef17712be31ff90f98ee3a5c5cf909 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 4 Mar 2008 11:38:34 -0500 Subject: [PATCH 052/183] Make xf86InitialConfiguration slightly smarter. Old heuristic was to find the first monitor that expressed a preference, then attempt to get all other monitors to agree. This doesn't work particularly well when the two sets of modes don't precisely intersect, you get overlapping-but-not-identical output geometry and things go wrong. New heuristic is: - Exact user preference, if given - Exact output preference, if the same for all outputs - Best (largest) mode of modes common to all outputs: - with the same aspect ratio as all outputs (may be NULL) - with 4:3 aspect ratio - Then the old heuristic to try to get something lit Note that it is simply not doable to have a reliable initial output guess if you insist on trying to clone all outputs together. It's far too easy to end up with displays that simply don't have modes in common. We need to switch to right-of placement someday, once we're not limited to CRTC size limits and we have working multi-GPU in RANDR. --- hw/xfree86/modes/xf86Crtc.c | 374 ++++++++++++++++++++++++++++-------- 1 file changed, 298 insertions(+), 76 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 14b60496a..4d5d7b848 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1,5 +1,6 @@ /* * Copyright © 2006 Keith Packard + * Copyright © 2008 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -808,7 +809,7 @@ xf86ClosestMode (xf86OutputPtr output, return target_mode; } -static Bool +static DisplayModePtr xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height) { DisplayModePtr mode; @@ -820,9 +821,21 @@ xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height) continue; if (mode->type & M_T_PREFERRED) - return TRUE; + return mode; } - return FALSE; + return NULL; +} + +static DisplayModePtr +xf86OutputHasUserPreferredMode (xf86OutputPtr output) +{ + DisplayModePtr mode, first = output->probed_modes; + + for (mode = first; mode && mode->next != first; mode = mode->next) + if (mode->type & M_T_USERPREF) + return mode; + + return NULL; } static int @@ -1577,6 +1590,265 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn) scrn->currentMode = scrn->modes; } +static void +xf86EnableOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, Bool *enabled) +{ + Bool any_enabled = FALSE; + int o; + + for (o = 0; o < config->num_output; o++) + any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE); + + if (!any_enabled) { + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "No outputs definitely connected, trying again...\n"); + + for (o = 0; o < config->num_output; o++) + enabled[o] = xf86OutputEnabled(config->output[o], FALSE); + } +} + +static Bool +nextEnabledOutput(xf86CrtcConfigPtr config, Bool *enabled, int *index) +{ + int o = *index; + + for (o++; o < config->num_output; o++) { + if (enabled[o]) { + *index = o; + return TRUE; + } + } + + return FALSE; +} + +static Bool +xf86TargetExact(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + DisplayModePtr *modes, Bool *enabled, + int width, int height) +{ + int o; + int pref_width = 0, pref_height = 0; + DisplayModePtr *preferred; + Bool ret = FALSE; + + preferred = xnfcalloc(config->num_output, sizeof(DisplayModePtr)); + + /* 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); + + if (!preferred[o]) + goto out; + } + + /* 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; + } + } + + /* oh good, they match. stash the selected modes and return. */ + memcpy(modes, preferred, config->num_output * sizeof(DisplayModePtr)); + ret = TRUE; + +out: + xfree(preferred); + return ret; +} + +static Bool +aspectMatch(float a, float b) +{ + return fabs(1 - (a / b)) < 0.05; +} + +static DisplayModePtr +nextAspectMode(DisplayModePtr start, float aspect) +{ + DisplayModePtr m = start; + + for (m = m->next; m; m = m->next) + if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay)) + return m; + + return NULL; +} + +static DisplayModePtr +bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect) +{ + int o, p; + DisplayModePtr mode, test = NULL, match = NULL; + + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + mode = config->output[o]->probed_modes; + while ((mode = nextAspectMode(mode, aspect))) { + for (p = o; nextEnabledOutput(config, enabled, &p); ) { + test = xf86OutputFindClosestMode(config->output[p], mode); + if (!test) + break; + if (test->HDisplay != mode->HDisplay || + test->VDisplay != mode->VDisplay) { + test = NULL; + break; + } + } + + /* if we didn't match it on all outputs, try the next one */ + if (!test) + continue; + + /* if it's bigger than the last one, save it */ + if (!match || (test->HDisplay > match->HDisplay)) + match = test; + } + } + + /* return the biggest one found */ + 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, + int width, int height) +{ + int o; + float aspect = 0.0, *aspects; + xf86OutputPtr output; + Bool ret = FALSE; + DisplayModePtr guess = NULL, aspect_guess = NULL, base_guess = NULL; + + aspects = xnfcalloc(config->num_output, sizeof(float)); + + /* collect the aspect ratios */ + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + output = config->output[o]; + if (output->mm_height) + aspects[o] = (float)output->mm_width / (float)output->mm_height; + else + aspects[o] = 4.0 / 3.0; + } + + /* check that they're all the same */ + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + output = config->output[o]; + if (!aspect) { + aspect = aspects[o]; + } else if (!aspectMatch(aspect, aspects[o])) { + goto no_aspect_match; + } + } + + /* if they're all 4:3, just skip ahead and save effort */ + if (!aspectMatch(aspect, 4.0/3.0)) + aspect_guess = bestModeForAspect(config, enabled, aspect); + +no_aspect_match: + base_guess = bestModeForAspect(config, enabled, 4.0/3.0); + + guess = biggestMode(base_guess, aspect_guess); + + if (!guess) + goto out; + + /* found a mode that works everywhere, now apply it */ + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + modes[o] = xf86OutputFindClosestMode(config->output[o], guess); + } + ret = TRUE; + +out: + xfree(aspects); + return ret; +} + +static Bool +xf86TargetFallback(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + DisplayModePtr *modes, Bool *enabled, + int width, int height) +{ + DisplayModePtr target_mode = NULL; + Rotation target_rotation = RR_Rotate_0; + DisplayModePtr default_mode; + int default_preferred, target_preferred = 0, o; + + /* User preferred > preferred > other modes */ + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + default_mode = xf86DefaultMode (config->output[o], width, height); + if (!default_mode) + continue; + + default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) + + ((default_mode->type & M_T_USERPREF) != 0)); + + if (default_preferred > target_preferred || !target_mode) { + target_mode = default_mode; + target_preferred = default_preferred; + target_rotation = config->output[o]->initial_rotation; + config->compat_output = o; + } + } + + if (target_mode) + modes[config->compat_output] = target_mode; + + /* Fill in other output modes */ + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + if (!modes[o]) + modes[o] = xf86ClosestMode(config->output[o], target_mode, + target_rotation, width, height); + } + + return (target_mode != NULL); +} + +static Bool +xf86TargetUserpref(ScrnInfoPtr scrn, xf86CrtcConfigPtr config, + DisplayModePtr *modes, Bool *enabled, + int width, int height) +{ + int o; + + for (o = -1; nextEnabledOutput(config, enabled, &o); ) + if (xf86OutputHasUserPreferredMode(config->output[o])) + return + xf86TargetFallback(scrn, config, modes, enabled, width, height); + + return FALSE; +} + + /** * Construct default screen configuration * @@ -1596,14 +1868,11 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int o, c; - DisplayModePtr target_mode = NULL; - int target_preferred = 0; - Rotation target_rotation = RR_Rotate_0; xf86CrtcPtr *crtcs; DisplayModePtr *modes; - Bool *enabled, any_enabled = FALSE; - int width; - int height; + Bool *enabled; + int width, height; + int i = scrn->scrnIndex; /* Set up the device options */ config->options = xnfalloc (sizeof (xf86DeviceOptions)); @@ -1629,75 +1898,28 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr)); enabled = xnfcalloc (config->num_output, sizeof (Bool)); - for (o = 0; o < config->num_output; o++) - { - xf86OutputPtr output = config->output[o]; - - modes[o] = NULL; - any_enabled |= (enabled[o] = xf86OutputEnabled (output, TRUE)); - } - - if (!any_enabled) - { - xf86DrvMsg (scrn->scrnIndex, X_WARNING, - "No outputs definitely connected, trying again...\n"); + xf86EnableOutputs(scrn, config, enabled); - for (o = 0; o < config->num_output; o++) - { - xf86OutputPtr output = config->output[o]; - - modes[o] = NULL; - enabled[o] = xf86OutputEnabled (output, FALSE); - } - } + 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)) + 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"); + else if (xf86TargetFallback(scrn, config, modes, enabled, width, height)) + xf86DrvMsg(i, X_INFO, "Using sloppy heuristic for initial modes\n"); + else + xf86DrvMsg(i, X_WARNING, "Unable to find initial modes\n"); - /* - * User preferred > preferred > other modes - */ - for (o = 0; o < config->num_output; o++) - { - xf86OutputPtr output = config->output[o]; - DisplayModePtr default_mode; - int default_preferred; - - if (!enabled[o]) - continue; - default_mode = xf86DefaultMode (output, width, height); - if (!default_mode) - continue; - default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) + - ((default_mode->type & M_T_USERPREF) != 0)); - if (default_preferred > target_preferred || !target_mode) - { - target_mode = default_mode; - target_preferred = default_preferred; - target_rotation = output->initial_rotation; - config->compat_output = o; - } - } - if (target_mode) - modes[config->compat_output] = target_mode; - /* - * Fill in other output modes - */ - for (o = 0; o < config->num_output; o++) - { - xf86OutputPtr output = config->output[o]; - - if (enabled[o]) - { - if (!modes[o]) - modes[o] = xf86ClosestMode (output, target_mode, - target_rotation, width, height); - if (!modes[o]) - xf86DrvMsg (scrn->scrnIndex, X_ERROR, - "Output %s enabled but has no modes\n", - output->name); - else - xf86DrvMsg (scrn->scrnIndex, X_INFO, - "Output %s using initial mode %s\n", - output->name, modes[o]->name); - } + for (o = -1; nextEnabledOutput(config, enabled, &o); ) { + if (!modes[o]) + xf86DrvMsg (scrn->scrnIndex, X_ERROR, + "Output %s enabled but has no modes\n", + config->output[o]->name); + else + xf86DrvMsg (scrn->scrnIndex, X_INFO, + "Output %s using initial mode %s\n", + config->output[o]->name, modes[o]->name); } /* From cf984dcc156958d4f8d98110e7add150628ce97e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 4 Mar 2008 16:03:04 -0800 Subject: [PATCH 053/183] Make sure SIOGLIFCONF buffer is properly aligned for socket structures --- os/access.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/os/access.c b/os/access.c index e91dd37e4..db14380df 100644 --- a/os/access.c +++ b/os/access.c @@ -713,19 +713,21 @@ void DefineSelf (int fd) { #ifndef HAS_GETIFADDRS - char buf[2048], *cp, *cplim; - void * bufptr = buf; -#ifdef USE_SIOCGLIFCONF + char *cp, *cplim; +# ifdef USE_SIOCGLIFCONF + struct sockaddr_storage buf[16]; struct lifconf ifc; register struct lifreq *ifr; -#ifdef SIOCGLIFNUM +# ifdef SIOCGLIFNUM struct lifnum ifn; -#endif -#else +# endif +# else /* !USE_SIOCGLIFCONF */ + char buf[2048]; struct ifconf ifc; register struct ifreq *ifr; -#endif -#else +# endif + void * bufptr = buf; +#else /* HAS_GETIFADDRS */ struct ifaddrs * ifap, *ifr; #endif int len; From d4101140f4e569f18554cf0cbf43138d08bd1277 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 4 Mar 2008 22:39:41 -0500 Subject: [PATCH 054/183] xselinux: Implement polyinstantiation support and related protocol. --- Xext/xselinux.c | 1060 ++++++++++++++++++++++++++++++----------------- Xext/xselinux.h | 102 ++--- 2 files changed, 717 insertions(+), 445 deletions(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index a7d3999b0..18c652645 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -60,31 +60,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Globals */ -/* private state record */ +/* private state keys */ static DevPrivateKey subjectKey = &subjectKey; static DevPrivateKey objectKey = &objectKey; +static DevPrivateKey dataKey = &dataKey; -/* This is what we store for security state */ +/* subject state (clients and devices only) */ typedef struct { security_id_t sid; + security_id_t dev_create_sid; + security_id_t win_create_sid; + security_id_t sel_create_sid; + security_id_t prp_create_sid; + security_id_t sel_use_sid; + security_id_t prp_use_sid; struct avc_entry_ref aeref; char *command; int privileged; } SELinuxSubjectRec; +/* object state */ typedef struct { security_id_t sid; int poly; } SELinuxObjectRec; -/* selection manager */ +/* selection and property atom cache */ typedef struct { - Atom selection; - security_id_t sid; -} SELinuxSelectionRec; - -static ClientPtr securityManager; -static Window securityWindow; + SELinuxObjectRec prp; + SELinuxObjectRec sel; +} SELinuxAtomRec; /* audit file descriptor */ static int audit_fd; @@ -123,9 +128,9 @@ static unsigned numKnownTypes; static security_id_t *knownEvents; static unsigned numKnownEvents; -/* Array of selection SID structures */ -static SELinuxSelectionRec *knownSelections; -static unsigned numKnownSelections; +/* Array of property and selection SID structures */ +static SELinuxAtomRec *knownAtoms; +static unsigned numKnownAtoms; /* dynamically allocated security classes and permissions */ static struct security_class_mapping map[] = { @@ -135,7 +140,7 @@ static struct security_class_mapping map[] = { { "x_font", { "", "", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_glyph", "remove_glyph", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, { "x_colormap", { "read", "write", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_color", "remove_color", "", "", "", "", "", "", "install", "uninstall", "", "", "use", NULL }}, { "x_property", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "write", NULL }}, - { "x_selection", { "read", "", "", "", "getattr", "setattr", NULL }}, + { "x_selection", { "read", "", "", "setattr", "getattr", "setattr", NULL }}, { "x_cursor", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, { "x_client", { "", "", "destroy", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "manage", NULL }}, { "x_device", { "read", "write", "", "", "getattr", "setattr", "", "", "", "getfocus", "setfocus", "", "", "", "", "", "", "grab", "freeze", "force_cursor", "", "", "", "", "use", "manage", "", "bell", NULL }}, @@ -159,48 +164,164 @@ static pointer truep = (pointer)1; */ /* - * Looks up the SID corresponding to the given selection atom + * Looks up a name in the selection or property mappings */ static int -SELinuxSelectionToSID(Atom selection, SELinuxObjectRec *sid_return) +SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec *obj, int map, int polymap) { - const char *name; - unsigned i, size; + const char *name = NameForAtom(atom); + security_context_t ctx; + int rc = Success; - for (i = 0; i < numKnownSelections; i++) - if (knownSelections[i].selection == selection) { - sid_return->sid = knownSelections[i].sid; - return Success; - } + obj->poly = 1; - /* Need to increase size of array */ - i = numKnownSelections; - size = (i + 1) * sizeof(SELinuxSelectionRec); - knownSelections = xrealloc(knownSelections, size); - if (!knownSelections) - return BadAlloc; - knownSelections[i].selection = selection; + /* Look in the mappings of names to contexts */ + if (selabel_lookup(label_hnd, &ctx, name, map) == 0) { + obj->poly = 0; + } else if (errno != ENOENT) { + ErrorF("SELinux: a property label lookup failed!\n"); + return BadValue; + } else if (selabel_lookup(label_hnd, &ctx, name, polymap) < 0) { + ErrorF("SELinux: a property label lookup failed!\n"); + return BadValue; + } - /* Look in the mappings of selection names to contexts */ - name = NameForAtom(selection); - if (name) { - security_context_t con; - security_id_t sid; + /* Get a SID for context */ + if (avc_context_to_sid(ctx, &obj->sid) < 0) { + ErrorF("SELinux: a context_to_SID call failed!\n"); + rc = BadAlloc; + } - if (selabel_lookup(label_hnd, &con, name, SELABEL_X_SELN) < 0) { - ErrorF("SELinux: a selection label lookup failed!\n"); + freecon(ctx); + return rc; +} + +/* + * Looks up the SID corresponding to the given property or selection atom + */ +static int +SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn) +{ + SELinuxObjectRec *obj; + int rc, map, polymap; + + if (atom >= numKnownAtoms) { + /* Need to increase size of atoms array */ + unsigned size = sizeof(SELinuxAtomRec); + knownAtoms = xrealloc(knownAtoms, (atom + 1) * size); + if (!knownAtoms) + return BadAlloc; + memset(knownAtoms + numKnownAtoms, 0, + (atom - numKnownAtoms + 1) * size); + numKnownAtoms = atom + 1; + } + + if (prop) { + obj = &knownAtoms[atom].prp; + map = SELABEL_X_PROP; + polymap = SELABEL_X_POLYPROP; + } else { + obj = &knownAtoms[atom].sel; + map = SELABEL_X_SELN; + polymap = SELABEL_X_POLYSELN; + } + + if (!obj->sid) { + rc = SELinuxAtomToSIDLookup(atom, obj, map, polymap); + if (rc != Success) + goto out; + } + + *obj_rtn = obj; + rc = Success; +out: + return rc; +} + +/* + * Looks up a SID for a selection/subject pair + */ +static int +SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj, + security_id_t *sid_rtn, int *poly_rtn) +{ + int rc; + SELinuxObjectRec *obj; + security_id_t tsid; + + /* Get the default context and polyinstantiation bit */ + rc = SELinuxAtomToSID(selection, 0, &obj); + if (rc != Success) + return rc; + + /* Check for an override context next */ + if (subj->sel_use_sid) { + sidget(tsid = subj->sel_use_sid); + goto out; + } + + sidget(tsid = obj->sid); + + /* Polyinstantiate if necessary to obtain the final SID */ + if (obj->poly) { + sidput(tsid); + if (avc_compute_member(subj->sid, obj->sid, + SECCLASS_X_SELECTION, &tsid) < 0) { + ErrorF("SELinux: a compute_member call failed!\n"); return BadValue; } - /* Get a SID for context */ - if (avc_context_to_sid(con, &sid) < 0) { - ErrorF("SELinux: a context_to_SID call failed!\n"); - return BadAlloc; - } - freecon(con); - knownSelections[i].sid = sid_return->sid = sid; - } else - knownSelections[i].sid = sid_return->sid = unlabeled_sid; + } +out: + *sid_rtn = tsid; + if (poly_rtn) + *poly_rtn = obj->poly; + return Success; +} +/* + * Looks up a SID for a property/subject pair + */ +static int +SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj, + security_id_t *sid_rtn, int *poly_rtn) +{ + int rc; + SELinuxObjectRec *obj; + security_id_t tsid, tsid2; + + /* Get the default context and polyinstantiation bit */ + rc = SELinuxAtomToSID(property, 1, &obj); + if (rc != Success) + return rc; + + /* Check for an override context next */ + if (subj->prp_use_sid) { + sidget(tsid = subj->prp_use_sid); + goto out; + } + + /* Perform a transition */ + if (avc_compute_create(subj->sid, obj->sid, + SECCLASS_X_PROPERTY, &tsid) < 0) { + ErrorF("SELinux: a compute_create call failed!\n"); + return BadValue; + } + + /* Polyinstantiate if necessary to obtain the final SID */ + if (obj->poly) { + tsid2 = tsid; + if (avc_compute_member(subj->sid, tsid2, + SECCLASS_X_PROPERTY, &tsid) < 0) { + ErrorF("SELinux: a compute_member call failed!\n"); + sidput(tsid2); + return BadValue; + } + sidput(tsid2); + } +out: + *sid_rtn = tsid; + if (poly_rtn) + *poly_rtn = obj->poly; return Success; } @@ -383,8 +504,7 @@ finish: FatalError("SELinux: client %d: context_to_sid(%s) failed\n", client->index, ctx); - sidget(subj->sid); - obj->sid = subj->sid; + sidget(obj->sid = subj->sid); freecon(ctx); } @@ -415,8 +535,7 @@ SELinuxLabelInitial(void) if (avc_context_to_sid(ctx, &subj->sid) < 0) FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx); - sidget(subj->sid); - obj->sid = subj->sid; + sidget(obj->sid = subj->sid); freecon(ctx); srec.client = serverClient; @@ -434,6 +553,44 @@ SELinuxLabelInitial(void) } } +/* + * Labels new resource objects. + */ +static int +SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj, + SELinuxObjectRec *obj, security_class_t class) +{ + int offset; + security_id_t tsid; + + /* Check for a create context */ + if (rec->rtype == RT_WINDOW && subj->win_create_sid) { + sidget(obj->sid = subj->win_create_sid); + return Success; + } + + if (rec->parent) + offset = dixLookupPrivateOffset(rec->ptype); + + if (rec->parent && offset >= 0) { + /* Use the SID of the parent object in the labeling operation */ + PrivateRec **privatePtr = DEVPRIV_AT(rec->parent, offset); + SELinuxObjectRec *pobj = dixLookupPrivate(privatePtr, objectKey); + tsid = pobj->sid; + } else { + /* Use the SID of the subject */ + tsid = subj->sid; + } + + /* Perform a transition to obtain the final SID */ + if (avc_compute_create(subj->sid, tsid, class, &obj->sid) < 0) { + ErrorF("SELinux: a compute_create call failed!\n"); + return BadValue; + } + + return Success; +} + /* * Libselinux Callbacks @@ -525,11 +682,15 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) sidput(dsubj->sid); sidput(obj->sid); - /* Label the device directly with the process SID */ - sidget(subj->sid); - obj->sid = subj->sid; - sidget(subj->sid); - dsubj->sid = subj->sid; + if (subj->dev_create_sid) { + /* Label the device with the create context */ + sidget(obj->sid = subj->dev_create_sid); + sidget(dsubj->sid = subj->dev_create_sid); + } else { + /* Label the device directly with the process SID */ + sidget(obj->sid = subj->sid); + sidget(dsubj->sid = subj->sid); + } } /* XXX only check read permission on XQueryKeymap */ @@ -684,14 +845,77 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) rec->status = rc; } +static void +SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceSelectionAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj, *data; + Selection *pSel = *rec->ppSel; + Atom name = pSel->selection; + SELinuxAuditRec auditdata = { .client = rec->client, .selection = name }; + security_id_t tsid; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&pSel->devPrivates, objectKey); + + /* If this is a new object that needs labeling, do it now */ + if (rec->access_mode & DixCreateAccess) { + sidput(obj->sid); + rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly); + if (rc != Success) + obj->sid = unlabeled_sid; + } + /* If this is a polyinstantiated object, find the right instance */ + else if (obj->poly) { + rc = SELinuxSelectionToSID(name, subj, &tsid, NULL); + if (rc != Success) { + rec->status = rc; + return; + } + while (pSel->selection != name || obj->sid != tsid) { + if ((pSel = pSel->next) == NULL) + break; + obj = dixLookupPrivate(&pSel->devPrivates, objectKey); + } + sidput(tsid); + + if (pSel) + *rec->ppSel = pSel; + else { + rec->status = BadMatch; + return; + } + } + + /* Perform the security check */ + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SELECTION, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; + + /* Label the content (advisory only) */ + if (rec->access_mode & DixSetAttrAccess) { + data = dixLookupPrivate(&pSel->devPrivates, dataKey); + sidput(data->sid); + if (subj->sel_create_sid) + sidget(data->sid = subj->sel_create_sid); + else + sidget(data->sid = obj->sid); + } +} + static void SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) { XacePropertyAccessRec *rec = calldata; SELinuxSubjectRec *subj; - SELinuxObjectRec *obj; - SELinuxAuditRec auditdata = { .client = rec->client }; + SELinuxObjectRec *obj, *data; PropertyPtr pProp = *rec->ppProp; + Atom name = pProp->propertyName; + SELinuxAuditRec auditdata = { .client = rec->client, .property = name }; + security_id_t tsid; int rc; subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); @@ -699,42 +923,50 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* If this is a new object that needs labeling, do it now */ if (rec->access_mode & DixCreateAccess) { - const char *name = NameForAtom(pProp->propertyName); - security_context_t con; - security_id_t sid; - - /* Look in the mappings of property names to contexts */ - if (selabel_lookup(label_hnd, &con, name, SELABEL_X_PROP) < 0) { - ErrorF("SELinux: a property label lookup failed!\n"); - rec->status = BadValue; - return; - } - /* Get a SID for context */ - if (avc_context_to_sid(con, &sid) < 0) { - ErrorF("SELinux: a context_to_SID call failed!\n"); - rec->status = BadAlloc; - return; - } - sidput(obj->sid); - - /* Perform a transition to obtain the final SID */ - if (avc_compute_create(subj->sid, sid, SECCLASS_X_PROPERTY, - &obj->sid) < 0) { - ErrorF("SELinux: a SID transition call failed!\n"); - freecon(con); - rec->status = BadValue; + rc = SELinuxPropertyToSID(name, subj, &obj->sid, &obj->poly); + if (rc != Success) { + rec->status = rc; + return; + } + } + /* If this is a polyinstantiated object, find the right instance */ + else if (obj->poly) { + rc = SELinuxPropertyToSID(name, subj, &tsid, NULL); + if (rc != Success) { + rec->status = rc; + return; + } + while (pProp->propertyName != name || obj->sid != tsid) { + if ((pProp = pProp->next) == NULL) + break; + obj = dixLookupPrivate(&pProp->devPrivates, objectKey); + } + sidput(tsid); + + if (pProp) + *rec->ppProp = pProp; + else { + rec->status = BadMatch; return; } - freecon(con); } /* Perform the security check */ - auditdata.property = pProp->propertyName; rc = SELinuxDoCheck(subj, obj, SECCLASS_X_PROPERTY, rec->access_mode, &auditdata); if (rc != Success) rec->status = rc; + + /* Label the content (advisory only) */ + if (rec->access_mode & DixWriteAccess) { + data = dixLookupPrivate(&pProp->devPrivates, dataKey); + sidput(data->sid); + if (subj->prp_create_sid) + sidget(data->sid = subj->prp_create_sid); + else + sidget(data->sid = obj->sid); + } } static void @@ -742,14 +974,13 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) { XaceResourceAccessRec *rec = calldata; SELinuxSubjectRec *subj; - SELinuxObjectRec *obj, *sobj, *pobj; + SELinuxObjectRec *obj; SELinuxAuditRec auditdata = { .client = rec->client }; PrivateRec **privatePtr; security_class_t class; int rc, offset; subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); - sobj = dixLookupPrivate(&rec->client->devPrivates, objectKey); /* Determine if the resource object has a devPrivates field */ offset = dixLookupPrivateOffset(rec->rtype); @@ -767,21 +998,9 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* If this is a new object that needs labeling, do it now */ if (rec->access_mode & DixCreateAccess && offset >= 0) { - if (rec->parent) - offset = dixLookupPrivateOffset(rec->ptype); - if (rec->parent && offset >= 0) - /* Use the SID of the parent object in the labeling operation */ - pobj = dixLookupPrivate(DEVPRIV_AT(rec->parent, offset), objectKey); - else - /* Use the SID of the subject */ - pobj = sobj; - - sidput(obj->sid); - - /* Perform a transition to obtain the final SID */ - if (avc_compute_create(subj->sid, pobj->sid, class, &obj->sid) < 0) { - ErrorF("SELinux: a compute_create call failed!\n"); - rec->status = BadValue; + rc = SELinuxLabelResource(rec, subj, obj, class); + if (rc != Success) { + rec->status = rc; return; } } @@ -864,34 +1083,6 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) rec->status = rc; } -static void -SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) -{ - XaceSelectionAccessRec *rec = (XaceSelectionAccessRec *)calldata; - SELinuxSubjectRec *subj; - SELinuxObjectRec sel_sid; - SELinuxAuditRec auditdata = { .client = rec->client }; - Selection *pSel = *rec->ppSel; - int rc; - - if (rec->access_mode & DixCreateAccess) - return; /* don't use create currently */ - - subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); - - rc = SELinuxSelectionToSID(pSel->selection, &sel_sid); - if (rc != Success) { - rec->status = rc; - return; - } - - auditdata.selection = pSel->selection; - rc = SELinuxDoCheck(subj, &sel_sid, SECCLASS_X_SELECTION, rec->access_mode, - &auditdata); - if (rc != Success) - rec->status = rc; -} - /* * DIX Callbacks @@ -907,14 +1098,6 @@ SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) SELinuxLabelClient(pci->client); break; - case ClientStateRetained: - case ClientStateGone: - if (pci->client == securityManager) { - securityManager = NULL; - securityWindow = 0; - } - break; - default: break; } @@ -965,18 +1148,6 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata) FatalError("SELinux: Unexpected unlabeled window found\n"); } -static void -SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata) -{ - SelectionInfoRec *rec = calldata; - - switch (rec->kind) { - case SelectionSetOwner: - default: - break; - } -} - /* * DevPrivates Callbacks @@ -1002,8 +1173,13 @@ SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata) xfree(subj->command); - if (avc_active) + if (avc_active) { sidput(subj->sid); + sidput(subj->dev_create_sid); + sidput(subj->win_create_sid); + sidput(subj->sel_create_sid); + sidput(subj->prp_create_sid); + } } static void @@ -1031,6 +1207,21 @@ SELinuxObjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata) * Extension Dispatch */ +#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid) +#define CTX_WIN offsetof(SELinuxSubjectRec, win_create_sid) +#define CTX_PRP offsetof(SELinuxSubjectRec, prp_create_sid) +#define CTX_SEL offsetof(SELinuxSubjectRec, sel_create_sid) +#define USE_PRP offsetof(SELinuxSubjectRec, prp_use_sid) +#define USE_SEL offsetof(SELinuxSubjectRec, sel_use_sid) + +typedef struct { + security_context_t octx; + security_context_t dctx; + CARD32 octx_len; + CARD32 dctx_len; + CARD32 id; +} SELinuxListItemRec; + static int ProcSELinuxQueryVersion(ClientPtr client) { @@ -1053,65 +1244,101 @@ ProcSELinuxQueryVersion(ClientPtr client) } static int -ProcSELinuxSetSecurityManager(ClientPtr client) +SELinuxSendContextReply(ClientPtr client, security_id_t sid) { - WindowPtr pWin; - int rc; + SELinuxGetContextReply rep; + security_context_t ctx = NULL; + int len = 0; - REQUEST(SELinuxSetSecurityManagerReq); - REQUEST_SIZE_MATCH(SELinuxSetSecurityManagerReq); - - if (stuff->window == None) { - securityManager = NULL; - securityWindow = None; - } else { - rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, - client, DixGetAttrAccess); - if (rc != Success) - return rc; - - securityManager = client; - securityWindow = stuff->window; + if (sid) { + if (avc_sid_to_context(sid, &ctx) < 0) + return BadValue; + len = strlen(ctx) + 1; } - return Success; -} - -static int -ProcSELinuxGetSecurityManager(ClientPtr client) -{ - SELinuxGetSecurityManagerReply rep; - rep.type = X_Reply; - rep.length = 0; + rep.length = (len + 3) >> 2; rep.sequenceNumber = client->sequence; - rep.window = securityWindow; + rep.context_len = len; + if (client->swapped) { int n; - swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); - swapl(&rep.window, n); + swaps(&rep.sequenceNumber, n); + swapl(&rep.context_len, n); } - WriteToClient(client, sizeof(rep), (char *)&rep); - return (client->noClientException); + + WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); + WriteToClient(client, len, ctx); + freecon(ctx); + return client->noClientException; } static int -ProcSELinuxSetDeviceCreateContext(ClientPtr client) +ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset) { + PrivateRec **privPtr = &client->devPrivates; + security_id_t *pSid; + security_context_t ctx; + char *ptr; + + REQUEST(SELinuxSetCreateContextReq); + REQUEST_FIXED_SIZE(SELinuxSetCreateContextReq, stuff->context_len); + + ctx = (char *)(stuff + 1); + if (stuff->context_len > 0 && ctx[stuff->context_len - 1]) + return BadLength; + + if (offset == CTX_DEV) { + /* Device create context currently requires manage permission */ + int rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess); + if (rc != Success) + return rc; + privPtr = &serverClient->devPrivates; + } + else if (offset == USE_SEL) { + /* Selection use context currently requires no selections owned */ + Selection *pSel; + for (pSel = CurrentSelections; pSel; pSel = pSel->next) + if (pSel->client == client) + return BadMatch; + } + + ptr = dixLookupPrivate(privPtr, subjectKey); + pSid = (security_id_t *)(ptr + offset); + sidput(*pSid); + *pSid = NULL; + + if (stuff->context_len > 0) { + if (security_check_context(ctx) < 0) + return BadValue; + if (avc_context_to_sid(ctx, pSid) < 0) + return BadValue; + } return Success; } static int -ProcSELinuxGetDeviceCreateContext(ClientPtr client) +ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset) { - return Success; + security_id_t *pSid; + char *ptr; + + REQUEST_SIZE_MATCH(SELinuxGetCreateContextReq); + + if (offset == CTX_DEV) + ptr = dixLookupPrivate(&serverClient->devPrivates, subjectKey); + else + ptr = dixLookupPrivate(&client->devPrivates, subjectKey); + + pSid = (security_id_t *)(ptr + offset); + return SELinuxSendContextReply(client, *pSid); } static int ProcSELinuxSetDeviceContext(ClientPtr client) { - char *ctx; + security_context_t ctx; security_id_t sid; DeviceIntPtr dev; SELinuxSubjectRec *subj; @@ -1122,15 +1349,16 @@ ProcSELinuxSetDeviceContext(ClientPtr client) REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len); ctx = (char *)(stuff + 1); - if (ctx[stuff->context_len - 1]) + if (stuff->context_len < 1 || ctx[stuff->context_len - 1]) return BadLength; rc = dixLookupDevice(&dev, stuff->id, client, DixManageAccess); if (rc != Success) return rc; - rc = avc_context_to_sid(ctx, &sid); - if (rc != Success) + if (security_check_context(ctx) < 0) + return BadValue; + if (avc_context_to_sid(ctx, &sid) < 0) return BadValue; subj = dixLookupPrivate(&dev->devPrivates, subjectKey); @@ -1138,7 +1366,7 @@ ProcSELinuxSetDeviceContext(ClientPtr client) subj->sid = sid; obj = dixLookupPrivate(&dev->devPrivates, objectKey); sidput(obj->sid); - obj->sid = sid; + sidget(obj->sid = sid); return Success; } @@ -1146,10 +1374,8 @@ ProcSELinuxSetDeviceContext(ClientPtr client) static int ProcSELinuxGetDeviceContext(ClientPtr client) { - char *ctx; DeviceIntPtr dev; SELinuxSubjectRec *subj; - SELinuxGetContextReply rep; int rc; REQUEST(SELinuxGetContextReq); @@ -1160,48 +1386,33 @@ ProcSELinuxGetDeviceContext(ClientPtr client) return rc; subj = dixLookupPrivate(&dev->devPrivates, subjectKey); - rc = avc_sid_to_context(subj->sid, &ctx); + return SELinuxSendContextReply(client, subj->sid); +} + +static int +ProcSELinuxGetWindowContext(ClientPtr client) +{ + WindowPtr pWin; + SELinuxObjectRec *obj; + int rc; + + REQUEST(SELinuxGetContextReq); + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) - return BadValue; + return rc; - rep.type = X_Reply; - rep.length = (strlen(ctx) + 4) >> 2; - rep.sequenceNumber = client->sequence; - rep.context_len = strlen(ctx) + 1; - - if (client->swapped) { - int n; - swapl(&rep.length, n); - swaps(&rep.sequenceNumber, n); - swaps(&rep.context_len, n); - } - - WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); - WriteToClient(client, rep.context_len, ctx); - free(ctx); - return client->noClientException; + obj = dixLookupPrivate(&pWin->devPrivates, objectKey); + return SELinuxSendContextReply(client, obj->sid); } static int -ProcSELinuxSetPropertyCreateContext(ClientPtr client) +ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) { - return Success; -} - -static int -ProcSELinuxGetPropertyCreateContext(ClientPtr client) -{ - return Success; -} - -static int -ProcSELinuxGetPropertyContext(ClientPtr client) -{ - char *ctx; WindowPtr pWin; PropertyPtr pProp; SELinuxObjectRec *obj; - SELinuxGetContextReply rep; int rc; REQUEST(SELinuxGetPropertyContextReq); @@ -1216,96 +1427,191 @@ ProcSELinuxGetPropertyContext(ClientPtr client) if (rc != Success) return rc; - obj = dixLookupPrivate(&pProp->devPrivates, objectKey); - rc = avc_sid_to_context(obj->sid, &ctx); - if (rc != Success) - return BadValue; - - rep.type = X_Reply; - rep.length = (strlen(ctx) + 4) >> 2; - rep.sequenceNumber = client->sequence; - rep.context_len = strlen(ctx) + 1; - - if (client->swapped) { - int n; - swapl(&rep.length, n); - swaps(&rep.sequenceNumber, n); - swaps(&rep.context_len, n); - } - - WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); - WriteToClient(client, rep.context_len, ctx); - free(ctx); - return client->noClientException; + obj = dixLookupPrivate(&pProp->devPrivates, privKey); + return SELinuxSendContextReply(client, obj->sid); } static int -ProcSELinuxSetWindowCreateContext(ClientPtr client) +ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) { - return Success; -} - -static int -ProcSELinuxGetWindowCreateContext(ClientPtr client) -{ - return Success; -} - -static int -ProcSELinuxGetWindowContext(ClientPtr client) -{ - char *ctx; - WindowPtr pWin; + Selection *pSel; SELinuxObjectRec *obj; - SELinuxGetContextReply rep; int rc; REQUEST(SELinuxGetContextReq); REQUEST_SIZE_MATCH(SELinuxGetContextReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; - obj = dixLookupPrivate(&pWin->devPrivates, objectKey); - rc = avc_sid_to_context(obj->sid, &ctx); - if (rc != Success) + obj = dixLookupPrivate(&pSel->devPrivates, privKey); + return SELinuxSendContextReply(client, obj->sid); +} + +static int +SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id, + int *size) +{ + SELinuxObjectRec *obj = dixLookupPrivate(privPtr, objectKey); + SELinuxObjectRec *data = dixLookupPrivate(privPtr, dataKey); + + if (avc_sid_to_context(obj->sid, &i->octx) < 0) + return BadValue; + if (avc_sid_to_context(data->sid, &i->dctx) < 0) return BadValue; - rep.type = X_Reply; - rep.length = (strlen(ctx) + 4) >> 2; - rep.sequenceNumber = client->sequence; - rep.context_len = strlen(ctx) + 1; + i->id = id; + i->octx_len = (strlen(i->octx) + 4) >> 2; + i->dctx_len = (strlen(i->dctx) + 4) >> 2; - if (client->swapped) { - int n; - swapl(&rep.length, n); - swaps(&rep.sequenceNumber, n); - swaps(&rep.context_len, n); + *size += i->octx_len + i->dctx_len + 3; + return Success; +} + +static void +SELinuxFreeItems(SELinuxListItemRec *items, int count) +{ + int k; + for (k = 0; k < count; k++) { + freecon(items[k].octx); + freecon(items[k].dctx); + } + xfree(items); +} + +static int +SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items, + int size, int count) +{ + int rc, k, n, pos = 0; + SELinuxListItemsReply rep; + CARD32 *buf; + + buf = xcalloc(size, sizeof(CARD32)); + if (!buf) { + rc = BadAlloc; + goto out; } - WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); - WriteToClient(client, rep.context_len, ctx); - free(ctx); - return client->noClientException; + /* Fill in the buffer */ + for (k = 0; k < count; k++) { + buf[pos] = items[k].id; + if (client->swapped) + swapl(buf + pos, n); + pos++; + + buf[pos] = items[k].octx_len * 4; + if (client->swapped) + swapl(buf + pos, n); + pos++; + + buf[pos] = items[k].dctx_len * 4; + if (client->swapped) + swapl(buf + pos, n); + pos++; + + memcpy((char *)(buf + pos), items[k].octx, strlen(items[k].octx) + 1); + pos += items[k].octx_len; + memcpy((char *)(buf + pos), items[k].dctx, strlen(items[k].dctx) + 1); + pos += items[k].dctx_len; + } + + /* Send reply to client */ + rep.type = X_Reply; + rep.length = size; + rep.sequenceNumber = client->sequence; + rep.count = count; + + if (client->swapped) { + swapl(&rep.length, n); + swaps(&rep.sequenceNumber, n); + swapl(&rep.count, n); + } + + WriteToClient(client, sizeof(SELinuxListItemsReply), (char *)&rep); + WriteToClient(client, size * 4, (char *)buf); + + /* Free stuff and return */ + rc = client->noClientException; + xfree(buf); +out: + SELinuxFreeItems(items, count); + return rc; } static int -ProcSELinuxSetSelectionCreateContext(ClientPtr client) +ProcSELinuxListProperties(ClientPtr client) { - return Success; + WindowPtr pWin; + PropertyPtr pProp; + SELinuxListItemRec *items; + int rc, count, size, i; + CARD32 id; + + REQUEST(SELinuxGetContextReq); + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + + rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess); + if (rc != Success) + return rc; + + /* Count the number of properties and allocate items */ + count = 0; + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) + count++; + items = xcalloc(count, sizeof(SELinuxListItemRec)); + if (!items) + return BadAlloc; + + /* Fill in the items and calculate size */ + i = 0; + size = 0; + for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) { + id = pProp->propertyName; + rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size); + if (rc != Success) { + SELinuxFreeItems(items, count); + return rc; + } + i++; + } + + return SELinuxSendItemsToClient(client, items, size, count); } static int -ProcSELinuxGetSelectionCreateContext(ClientPtr client) +ProcSELinuxListSelections(ClientPtr client) { - return Success; -} + Selection *pSel; + SELinuxListItemRec *items; + int rc, count, size, i; + CARD32 id; -static int -ProcSELinuxGetSelectionContext(ClientPtr client) -{ - return Success; + REQUEST_SIZE_MATCH(SELinuxGetCreateContextReq); + + /* Count the number of selections and allocate items */ + count = 0; + for (pSel = CurrentSelections; pSel; pSel = pSel->next) + count++; + items = xcalloc(count, sizeof(SELinuxListItemRec)); + if (!items) + return BadAlloc; + + /* Fill in the items and calculate size */ + i = 0; + size = 0; + for (pSel = CurrentSelections; pSel; pSel = pSel->next) { + id = pSel->selection; + rc = SELinuxPopulateItem(items + i, &pSel->devPrivates, id, &size); + if (rc != Success) { + SELinuxFreeItems(items, count); + return rc; + } + i++; + } + + return SELinuxSendItemsToClient(client, items, size, count); } static int @@ -1315,36 +1621,48 @@ ProcSELinuxDispatch(ClientPtr client) switch (stuff->data) { case X_SELinuxQueryVersion: return ProcSELinuxQueryVersion(client); - case X_SELinuxSetSecurityManager: - return ProcSELinuxSetSecurityManager(client); - case X_SELinuxGetSecurityManager: - return ProcSELinuxGetSecurityManager(client); case X_SELinuxSetDeviceCreateContext: - return ProcSELinuxSetDeviceCreateContext(client); + return ProcSELinuxSetCreateContext(client, CTX_DEV); case X_SELinuxGetDeviceCreateContext: - return ProcSELinuxGetDeviceCreateContext(client); + return ProcSELinuxGetCreateContext(client, CTX_DEV); case X_SELinuxSetDeviceContext: return ProcSELinuxSetDeviceContext(client); case X_SELinuxGetDeviceContext: return ProcSELinuxGetDeviceContext(client); - case X_SELinuxSetPropertyCreateContext: - return ProcSELinuxSetPropertyCreateContext(client); - case X_SELinuxGetPropertyCreateContext: - return ProcSELinuxGetPropertyCreateContext(client); - case X_SELinuxGetPropertyContext: - return ProcSELinuxGetPropertyContext(client); case X_SELinuxSetWindowCreateContext: - return ProcSELinuxSetWindowCreateContext(client); + return ProcSELinuxSetCreateContext(client, CTX_WIN); case X_SELinuxGetWindowCreateContext: - return ProcSELinuxGetWindowCreateContext(client); + return ProcSELinuxGetCreateContext(client, CTX_WIN); case X_SELinuxGetWindowContext: return ProcSELinuxGetWindowContext(client); + case X_SELinuxSetPropertyCreateContext: + return ProcSELinuxSetCreateContext(client, CTX_PRP); + case X_SELinuxGetPropertyCreateContext: + return ProcSELinuxGetCreateContext(client, CTX_PRP); + case X_SELinuxSetPropertyUseContext: + return ProcSELinuxSetCreateContext(client, USE_PRP); + case X_SELinuxGetPropertyUseContext: + return ProcSELinuxGetCreateContext(client, USE_PRP); + case X_SELinuxGetPropertyContext: + return ProcSELinuxGetPropertyContext(client, objectKey); + case X_SELinuxGetPropertyDataContext: + return ProcSELinuxGetPropertyContext(client, dataKey); + case X_SELinuxListProperties: + return ProcSELinuxListProperties(client); case X_SELinuxSetSelectionCreateContext: - return ProcSELinuxSetSelectionCreateContext(client); + return ProcSELinuxSetCreateContext(client, CTX_SEL); case X_SELinuxGetSelectionCreateContext: - return ProcSELinuxGetSelectionCreateContext(client); + return ProcSELinuxGetCreateContext(client, CTX_SEL); + case X_SELinuxSetSelectionUseContext: + return ProcSELinuxSetCreateContext(client, USE_SEL); + case X_SELinuxGetSelectionUseContext: + return ProcSELinuxGetCreateContext(client, USE_SEL); case X_SELinuxGetSelectionContext: - return ProcSELinuxGetSelectionContext(client); + return ProcSELinuxGetSelectionContext(client, objectKey); + case X_SELinuxGetSelectionDataContext: + return ProcSELinuxGetSelectionContext(client, dataKey); + case X_SELinuxListSelections: + return ProcSELinuxListSelections(client); default: return BadRequest; } @@ -1363,25 +1681,14 @@ SProcSELinuxQueryVersion(ClientPtr client) } static int -SProcSELinuxSetSecurityManager(ClientPtr client) -{ - REQUEST(SELinuxSetSecurityManagerReq); - int n; - - REQUEST_SIZE_MATCH(SELinuxSetSecurityManagerReq); - swapl(&stuff->window, n); - return ProcSELinuxSetSecurityManager(client); -} - -static int -SProcSELinuxSetDeviceCreateContext(ClientPtr client) +SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset) { REQUEST(SELinuxSetCreateContextReq); int n; REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); - swaps(&stuff->context_len, n); - return ProcSELinuxSetDeviceCreateContext(client); + swapl(&stuff->context_len, n); + return ProcSELinuxSetCreateContext(client, offset); } static int @@ -1392,7 +1699,7 @@ SProcSELinuxSetDeviceContext(ClientPtr client) REQUEST_AT_LEAST_SIZE(SELinuxSetContextReq); swapl(&stuff->id, n); - swaps(&stuff->context_len, n); + swapl(&stuff->context_len, n); return ProcSELinuxSetDeviceContext(client); } @@ -1407,40 +1714,6 @@ SProcSELinuxGetDeviceContext(ClientPtr client) return ProcSELinuxGetDeviceContext(client); } -static int -SProcSELinuxSetPropertyCreateContext(ClientPtr client) -{ - REQUEST(SELinuxSetCreateContextReq); - int n; - - REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); - swaps(&stuff->context_len, n); - return ProcSELinuxSetPropertyCreateContext(client); -} - -static int -SProcSELinuxGetPropertyContext(ClientPtr client) -{ - REQUEST(SELinuxGetPropertyContextReq); - int n; - - REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq); - swapl(&stuff->window, n); - swapl(&stuff->property, n); - return ProcSELinuxGetPropertyContext(client); -} - -static int -SProcSELinuxSetWindowCreateContext(ClientPtr client) -{ - REQUEST(SELinuxSetCreateContextReq); - int n; - - REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); - swaps(&stuff->context_len, n); - return ProcSELinuxSetWindowCreateContext(client); -} - static int SProcSELinuxGetWindowContext(ClientPtr client) { @@ -1453,25 +1726,37 @@ SProcSELinuxGetWindowContext(ClientPtr client) } static int -SProcSELinuxSetSelectionCreateContext(ClientPtr client) +SProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) { - REQUEST(SELinuxSetCreateContextReq); + REQUEST(SELinuxGetPropertyContextReq); int n; - REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); - swaps(&stuff->context_len, n); - return ProcSELinuxSetSelectionCreateContext(client); + REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq); + swapl(&stuff->window, n); + swapl(&stuff->property, n); + return ProcSELinuxGetPropertyContext(client, privKey); } static int -SProcSELinuxGetSelectionContext(ClientPtr client) +SProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) { REQUEST(SELinuxGetContextReq); int n; REQUEST_SIZE_MATCH(SELinuxGetContextReq); swapl(&stuff->id, n); - return ProcSELinuxGetSelectionContext(client); + return ProcSELinuxGetSelectionContext(client, privKey); +} + +static int +SProcSELinuxListProperties(ClientPtr client) +{ + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id, n); + return ProcSELinuxListProperties(client); } static int @@ -1485,36 +1770,48 @@ SProcSELinuxDispatch(ClientPtr client) switch (stuff->data) { case X_SELinuxQueryVersion: return SProcSELinuxQueryVersion(client); - case X_SELinuxSetSecurityManager: - return SProcSELinuxSetSecurityManager(client); - case X_SELinuxGetSecurityManager: - return ProcSELinuxGetSecurityManager(client); case X_SELinuxSetDeviceCreateContext: - return SProcSELinuxSetDeviceCreateContext(client); + return SProcSELinuxSetCreateContext(client, CTX_DEV); case X_SELinuxGetDeviceCreateContext: - return ProcSELinuxGetDeviceCreateContext(client); + return ProcSELinuxGetCreateContext(client, CTX_DEV); case X_SELinuxSetDeviceContext: return SProcSELinuxSetDeviceContext(client); case X_SELinuxGetDeviceContext: return SProcSELinuxGetDeviceContext(client); - case X_SELinuxSetPropertyCreateContext: - return SProcSELinuxSetPropertyCreateContext(client); - case X_SELinuxGetPropertyCreateContext: - return ProcSELinuxGetPropertyCreateContext(client); - case X_SELinuxGetPropertyContext: - return SProcSELinuxGetPropertyContext(client); case X_SELinuxSetWindowCreateContext: - return SProcSELinuxSetWindowCreateContext(client); + return SProcSELinuxSetCreateContext(client, CTX_WIN); case X_SELinuxGetWindowCreateContext: - return ProcSELinuxGetWindowCreateContext(client); + return ProcSELinuxGetCreateContext(client, CTX_WIN); case X_SELinuxGetWindowContext: return SProcSELinuxGetWindowContext(client); + case X_SELinuxSetPropertyCreateContext: + return SProcSELinuxSetCreateContext(client, CTX_PRP); + case X_SELinuxGetPropertyCreateContext: + return ProcSELinuxGetCreateContext(client, CTX_PRP); + case X_SELinuxSetPropertyUseContext: + return SProcSELinuxSetCreateContext(client, USE_PRP); + case X_SELinuxGetPropertyUseContext: + return ProcSELinuxGetCreateContext(client, USE_PRP); + case X_SELinuxGetPropertyContext: + return SProcSELinuxGetPropertyContext(client, objectKey); + case X_SELinuxGetPropertyDataContext: + return SProcSELinuxGetPropertyContext(client, dataKey); + case X_SELinuxListProperties: + return SProcSELinuxListProperties(client); case X_SELinuxSetSelectionCreateContext: - return SProcSELinuxSetSelectionCreateContext(client); + return SProcSELinuxSetCreateContext(client, CTX_SEL); case X_SELinuxGetSelectionCreateContext: - return ProcSELinuxGetSelectionCreateContext(client); + return ProcSELinuxGetCreateContext(client, CTX_SEL); + case X_SELinuxSetSelectionUseContext: + return SProcSELinuxSetCreateContext(client, USE_SEL); + case X_SELinuxGetSelectionUseContext: + return ProcSELinuxGetCreateContext(client, USE_SEL); case X_SELinuxGetSelectionContext: - return SProcSELinuxGetSelectionContext(client); + return SProcSELinuxGetSelectionContext(client, objectKey); + case X_SELinuxGetSelectionDataContext: + return SProcSELinuxGetSelectionContext(client, dataKey); + case X_SELinuxListSelections: + return ProcSELinuxListSelections(client); default: return BadRequest; } @@ -1531,7 +1828,6 @@ SELinuxResetProc(ExtensionEntry *extEntry) /* Unregister callbacks */ DeleteCallback(&ClientStateCallback, SELinuxClientState, NULL); DeleteCallback(&ResourceStateCallback, SELinuxResourceState, NULL); - DeleteCallback(&SelectionCallback, SELinuxSelectionState, NULL); XaceDeleteCallback(XACE_EXT_DISPATCH, SELinuxExtension, NULL); XaceDeleteCallback(XACE_RESOURCE_ACCESS, SELinuxResource, NULL); @@ -1556,9 +1852,9 @@ SELinuxResetProc(ExtensionEntry *extEntry) avc_active = 0; /* Free local state */ - xfree(knownSelections); - knownSelections = NULL; - numKnownSelections = 0; + xfree(knownAtoms); + knownAtoms = NULL; + numKnownAtoms = 0; xfree(knownEvents); knownEvents = NULL; @@ -1615,7 +1911,8 @@ SELinuxExtensionInit(INITARGS) /* Allocate private storage */ if (!dixRequestPrivate(subjectKey, sizeof(SELinuxSubjectRec)) || - !dixRequestPrivate(objectKey, sizeof(SELinuxObjectRec))) + !dixRequestPrivate(objectKey, sizeof(SELinuxObjectRec)) || + !dixRequestPrivate(dataKey, sizeof(SELinuxObjectRec))) FatalError("SELinux: Failed to allocate private storage.\n"); /* Create atoms for doing window labeling */ @@ -1631,10 +1928,11 @@ SELinuxExtensionInit(INITARGS) ret &= dixRegisterPrivateDeleteFunc(subjectKey, SELinuxSubjectFree, NULL); ret &= dixRegisterPrivateInitFunc(objectKey, SELinuxObjectInit, NULL); ret &= dixRegisterPrivateDeleteFunc(objectKey, SELinuxObjectFree, NULL); + ret &= dixRegisterPrivateInitFunc(dataKey, SELinuxObjectInit, NULL); + ret &= dixRegisterPrivateDeleteFunc(dataKey, SELinuxObjectFree, NULL); ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL); ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL); - ret &= AddCallback(&SelectionCallback, SELinuxSelectionState, NULL); ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SELinuxExtension, NULL); ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SELinuxResource, NULL); diff --git a/Xext/xselinux.h b/Xext/xselinux.h index 480276154..2d0de3222 100644 --- a/Xext/xselinux.h +++ b/Xext/xselinux.h @@ -31,21 +31,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* Extension protocol */ #define X_SELinuxQueryVersion 0 -#define X_SELinuxSetSecurityManager 1 -#define X_SELinuxGetSecurityManager 2 -#define X_SELinuxSetDeviceCreateContext 3 -#define X_SELinuxGetDeviceCreateContext 4 -#define X_SELinuxSetDeviceContext 5 -#define X_SELinuxGetDeviceContext 6 -#define X_SELinuxSetPropertyCreateContext 7 -#define X_SELinuxGetPropertyCreateContext 8 -#define X_SELinuxGetPropertyContext 9 -#define X_SELinuxSetWindowCreateContext 10 -#define X_SELinuxGetWindowCreateContext 11 -#define X_SELinuxGetWindowContext 12 -#define X_SELinuxSetSelectionCreateContext 13 -#define X_SELinuxGetSelectionCreateContext 14 -#define X_SELinuxGetSelectionContext 15 +#define X_SELinuxSetDeviceCreateContext 1 +#define X_SELinuxGetDeviceCreateContext 2 +#define X_SELinuxSetDeviceContext 3 +#define X_SELinuxGetDeviceContext 4 +#define X_SELinuxSetWindowCreateContext 5 +#define X_SELinuxGetWindowCreateContext 6 +#define X_SELinuxGetWindowContext 7 +#define X_SELinuxSetPropertyCreateContext 8 +#define X_SELinuxGetPropertyCreateContext 9 +#define X_SELinuxSetPropertyUseContext 10 +#define X_SELinuxGetPropertyUseContext 11 +#define X_SELinuxGetPropertyContext 12 +#define X_SELinuxGetPropertyDataContext 13 +#define X_SELinuxListProperties 14 +#define X_SELinuxSetSelectionCreateContext 15 +#define X_SELinuxGetSelectionCreateContext 16 +#define X_SELinuxSetSelectionUseContext 17 +#define X_SELinuxGetSelectionUseContext 18 +#define X_SELinuxGetSelectionContext 19 +#define X_SELinuxGetSelectionDataContext 20 +#define X_SELinuxListSelections 21 typedef struct { CARD8 reqType; @@ -53,7 +59,6 @@ typedef struct { CARD16 length; CARD8 client_major; CARD8 client_minor; - CARD16 unused; } SELinuxQueryVersionReq; typedef struct { @@ -74,35 +79,7 @@ typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; - CARD32 window; -} SELinuxSetSecurityManagerReq; - -typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; -} SELinuxGetSecurityManagerReq; - -typedef struct { - CARD8 type; - CARD8 pad1; - CARD16 sequenceNumber; - CARD32 length; - CARD32 window; - CARD32 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; -} SELinuxGetSecurityManagerReply; - -typedef struct { - CARD8 reqType; - CARD8 SELinuxReqType; - CARD16 length; - CARD8 permanent; - CARD8 unused; - CARD16 context_len; + CARD32 context_len; } SELinuxSetCreateContextReq; typedef struct { @@ -111,27 +88,12 @@ typedef struct { CARD16 length; } SELinuxGetCreateContextReq; -typedef struct { - CARD8 type; - CARD8 permanent; - CARD16 sequenceNumber; - CARD32 length; - CARD16 context_len; - CARD16 pad1; - CARD32 pad2; - CARD32 pad3; - CARD32 pad4; - CARD32 pad5; - CARD32 pad6; -} SELinuxGetCreateContextReply; - typedef struct { CARD8 reqType; CARD8 SELinuxReqType; CARD16 length; CARD32 id; - CARD16 unused; - CARD16 context_len; + CARD32 context_len; } SELinuxSetContextReq; typedef struct { @@ -154,15 +116,27 @@ typedef struct { CARD8 pad1; CARD16 sequenceNumber; CARD32 length; - CARD16 context_len; - CARD16 pad2; + CARD32 context_len; + CARD32 pad2; CARD32 pad3; CARD32 pad4; CARD32 pad5; CARD32 pad6; - CARD32 pad7; } SELinuxGetContextReply; +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 count; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} SELinuxListItemsReply; + /* Private Flask definitions */ #define SECCLASS_X_DRAWABLE 1 From 34b69e3bc0e6462eb60029fbcb4f5479494007a2 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 5 Mar 2008 23:56:49 -0500 Subject: [PATCH 055/183] Fix distcheck. (cherry picked from commit 2a47accff8dccded4dfe031f9366c028ba927824) --- GL/apple/Makefile.am | 8 ++++---- hw/xfree86/x86emu/Makefile.am | 1 + include/Makefile.am | 4 ++-- xkb/Makefile.am | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/GL/apple/Makefile.am b/GL/apple/Makefile.am index 33ad15714..c064c03f8 100644 --- a/GL/apple/Makefile.am +++ b/GL/apple/Makefile.am @@ -11,10 +11,10 @@ AM_CPPFLAGS = \ if HAVE_AGL_FRAMEWORK noinst_LIBRARIES = libAGLcore.a libAGLcore_a_SOURCES = aglGlx.c \ - $(top_srcdir)/hw/darwin/quartz/xpr/x-list.c \ - $(top_srcdir)/hw/darwin/quartz/xpr/x-list.h \ - $(top_srcdir)/hw/darwin/quartz/xpr/x-hash.c \ - $(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \ + $(top_srcdir)/hw/xquartz/xpr/x-list.c \ + $(top_srcdir)/hw/xquartz/xpr/x-list.h \ + $(top_srcdir)/hw/xquartz/xpr/x-hash.c \ + $(top_srcdir)/hw/xquartz/xpr/x-hash.h \ $(top_srcdir)/hw/dmx/glxProxy/compsize.c endif diff --git a/hw/xfree86/x86emu/Makefile.am b/hw/xfree86/x86emu/Makefile.am index 9f9c87f4f..acd249c7f 100644 --- a/hw/xfree86/x86emu/Makefile.am +++ b/hw/xfree86/x86emu/Makefile.am @@ -21,6 +21,7 @@ EXTRA_DIST = validate.c \ x86emu/ops.h \ x86emu/prim_asm.h \ x86emu/prim_ops.h \ + x86emu/prim_x86_gcc.h \ x86emu/regs.h \ x86emu/types.h \ x86emu/x86emui.h diff --git a/include/Makefile.am b/include/Makefile.am index 0654b5788..673a97685 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -50,10 +50,10 @@ sdk_HEADERS = \ validate.h \ window.h \ windowstr.h \ - xkbsrv.h \ xorg-server.h endif AM_CFLAGS = $(DIX_CFLAGS) -EXTRA_DIST = $(sdk_HEADERS) do-not-use-config.h dix-config.h xorg-config.h +EXTRA_DIST = $(sdk_HEADERS) do-not-use-config.h dix-config.h xorg-config.h \ + xkb-config.h xkbfile.h xkbsrv.h xkbstr.h diff --git a/xkb/Makefile.am b/xkb/Makefile.am index e750d6098..5b594c130 100644 --- a/xkb/Makefile.am +++ b/xkb/Makefile.am @@ -47,7 +47,7 @@ libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \ $(X11_SRCS) libxkbstubs_la_SOURCES = ddxVT.c ddxPrivate.c ddxKillSrv.c -EXTRA_DIST = xkb.h xkbDflts.h +EXTRA_DIST = xkbDflts.h xkbgeom.h xkb.h xkbcompileddir = $(XKB_COMPILED_DIR) dist_xkbcompiled_DATA = README.compiled From ca616b902b2c5d0f046c7a042c11f045479e373a Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 6 Mar 2008 13:47:44 -0800 Subject: [PATCH 056/183] Allow RandR get output property to call into drivers In order to report accurate values to users of the RandR property interface, it's sometimes necessary to ask the driver to update the value (for example when backlight brightness changes without the server's knowledge, due to hotkey events or direct sysfs banging). This patch wires up the core server code with a new xf86CrtcFuncs callback, get_property, to allow for this. The new code is available under the RANDR_13_INTERFACE define, which in turn depends on the RANDR_12_INTERFACE code. --- hw/xfree86/modes/xf86Crtc.h | 23 +++++++++++++++++++++++ hw/xfree86/modes/xf86RandR12.c | 17 +++++++++++++++++ randr/mirandr.c | 11 +++++++++++ randr/randrstr.h | 10 ++++++++++ randr/rrproperty.c | 19 +++++++++++++------ 5 files changed, 74 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index cc045b229..b87a32548 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -215,7 +215,14 @@ typedef struct _xf86CrtcFuncs { Rotation rotation, int x, int y); } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; +#define XF86_CRTC_VERSION 1 + struct _xf86Crtc { + /** + * ABI versioning + */ + int version; + /** * Associated ScrnInfo */ @@ -409,6 +416,14 @@ typedef struct _xf86OutputFuncs { (*set_property)(xf86OutputPtr output, Atom property, RRPropertyValuePtr value); +#endif +#ifdef RANDR_13_INTERFACE + /** + * Callback to get an updated property value + */ + Bool + (*get_property)(xf86OutputPtr output, + Atom property); #endif /** * Clean up driver-specific bits of the output @@ -417,7 +432,15 @@ typedef struct _xf86OutputFuncs { (*destroy) (xf86OutputPtr output); } xf86OutputFuncsRec, *xf86OutputFuncsPtr; + +#define XF86_OUTPUT_VERSION 1 + struct _xf86Output { + /** + * ABI versioning + */ + int version; + /** * Associated ScrnInfo */ diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index e2668fbbc..8b13758af 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -847,6 +847,20 @@ xf86RandR12OutputSetProperty (ScreenPtr pScreen, return output->funcs->set_property(output, property, value); } +static Bool +xf86RandR13OutputGetProperty (ScreenPtr pScreen, + RROutputPtr randr_output, + Atom property) +{ + xf86OutputPtr output = randr_output->devPrivate; + + if (output->funcs->get_property == NULL) + return TRUE; + + /* Should be safe even w/o vtSema */ + return output->funcs->get_property(output, property); +} + static Bool xf86RandR12OutputValidateMode (ScreenPtr pScreen, RROutputPtr randr_output, @@ -1126,6 +1140,9 @@ xf86RandR12Init12 (ScreenPtr pScreen) rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma; rp->rrOutputSetProperty = xf86RandR12OutputSetProperty; rp->rrOutputValidateMode = xf86RandR12OutputValidateMode; +#if RANDR_13_INTERFACE + rp->rrOutputGetProperty = xf86RandR13OutputGetProperty; +#endif rp->rrModeDestroy = xf86RandR12ModeDestroy; rp->rrSetConfig = NULL; pScrn->PointerMoved = xf86RandR12PointerMoved; diff --git a/randr/mirandr.c b/randr/mirandr.c index 3c4991e5a..777785380 100644 --- a/randr/mirandr.c +++ b/randr/mirandr.c @@ -73,6 +73,14 @@ miRROutputSetProperty (ScreenPtr pScreen, return TRUE; } +Bool +miRROutputGetProperty (ScreenPtr pScreen, + RROutputPtr output, + Atom property) +{ + return TRUE; +} + Bool miRROutputValidateMode (ScreenPtr pScreen, RROutputPtr output, @@ -116,6 +124,9 @@ miRandRInit (ScreenPtr pScreen) pScrPriv->rrCrtcSet = miRRCrtcSet; pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma; pScrPriv->rrOutputSetProperty = miRROutputSetProperty; +#if RANDR_13_INTERFACE + pScrPriv->rrOutputGetProperty = miRROutputGetProperty; +#endif pScrPriv->rrOutputValidateMode = miRROutputValidateMode; pScrPriv->rrModeDestroy = miRRModeDestroy; diff --git a/randr/randrstr.h b/randr/randrstr.h index e8358bc0c..3b48f5c2b 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -54,6 +54,7 @@ /* required for ABI compatibility for now */ #define RANDR_10_INTERFACE 1 #define RANDR_12_INTERFACE 1 +#define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */ typedef XID RRMode; typedef XID RROutput; @@ -175,6 +176,12 @@ typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, #endif +#if RANDR_13_INTERFACE +typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen, + RROutputPtr output, + Atom property); +#endif /* RANDR_13_INTERFACE */ + typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations); typedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen); @@ -220,6 +227,9 @@ typedef struct _rrScrPriv { RROutputValidateModeProcPtr rrOutputValidateMode; RRModeDestroyProcPtr rrModeDestroy; #endif +#if RANDR_13_INTERFACE + RROutputGetPropertyProcPtr rrOutputGetProperty; +#endif /* * Private part of the structure; not considered part of the ABI diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 4617064e4..9bb7081ca 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -300,13 +300,21 @@ RRPropertyValuePtr RRGetOutputProperty (RROutputPtr output, Atom property, Bool pending) { RRPropertyPtr prop = RRQueryOutputProperty (output, property); + rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen); if (!prop) return NULL; if (pending && prop->is_pending) return &prop->pending; - else + else { +#if RANDR_13_INTERFACE + /* If we can, try to update the property value first */ + if (pScrPriv->rrOutputGetProperty) + pScrPriv->rrOutputGetProperty(output->pScreen, output, + prop->propertyName); +#endif return &prop->current; + } } int @@ -610,11 +618,10 @@ ProcRRGetOutputProperty (ClientPtr client) if (prop->immutable && stuff->delete) return BadAccess; - if (stuff->pending && prop->is_pending) - prop_value = &prop->pending; - else - prop_value = &prop->current; - + prop_value = RRGetOutputProperty(output, stuff->property, stuff->pending); + if (!prop_value) + return BadAtom; + /* If the request type and actual type don't match. Return the property information, but not the data. */ From a8d760f567b19268329c4682495caa591f08a854 Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Sun, 2 Mar 2008 20:13:11 -0800 Subject: [PATCH 057/183] Get modes code building with old X servers again. This change uses XORG_VERSION_CURRENT < 7.0 to mean "server newer than 1.2" since XORG_VERSION current went backwards at some point. --- hw/xfree86/modes/xf86Cursors.c | 16 ++++++++++++--- hw/xfree86/modes/xf86EdidModes.c | 4 ++++ hw/xfree86/modes/xf86Modes.c | 5 +++++ hw/xfree86/modes/xf86RandR12.c | 35 +++++++++++++++++++++++++++++++- hw/xfree86/modes/xf86gtf.c | 4 ++++ 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 5a4d0f6fa..08cf78d82 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -226,8 +226,13 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); CursorPtr cursor = xf86_config->cursor; int c; - CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates, - screen) : NULL; + CARD8 *bits = cursor ? +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) + dixLookupPrivate(&cursor->devPrivates, screen) +#else + cursor->devPriv[screen->myNum] +#endif + : NULL; /* Save ARGB versions of these colors */ xf86_config->cursor_fg = (CARD32) fg | 0xff000000; @@ -613,7 +618,12 @@ xf86_reload_cursors (ScreenPtr screen) else #endif (*cursor_info->LoadCursorImage)(cursor_info->pScrn, - dixLookupPrivate(&cursor->devPrivates, screen)); +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) + dixLookupPrivate(&cursor->devPrivates, screen) +#else + cursor->devPriv[screen->myNum] +#endif + ); (*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 ea36d0a59..2d1a6abd2 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -410,6 +410,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, return Mode; } +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) static DisplayModePtr DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) { @@ -438,6 +439,7 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) return modes; } +#endif /* @@ -621,10 +623,12 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) quirks, timing_level); Modes = xf86ModesAdd(Modes, Mode); break; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) case DS_CVT: Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt); Modes = xf86ModesAdd(Modes, Mode); break; +#endif default: break; } diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 9e3151254..aa2635c48 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -513,7 +513,12 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, for (mode = modeList; mode != NULL; mode = mode->next) { if (xf86ModeBandwidth(mode, depth) > bandwidth) +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) mode->status = MODE_BANDWIDTH; +#else + /* MODE_BANDWIDTH didn't exist in xserver 1.2 */ + mode->status = MODE_BAD; +#endif } } diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 8b13758af..816175cc3 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -60,11 +60,21 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen); #endif static int xf86RandR12Generation; -static DevPrivateKey xf86RandR12Key; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) +static DevPrivateKey xf86RandR12Key; #define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key)) +#else /* XORG_VERSION_CURRENT < 7.0 */ + +static int xf86RandR12Index; +#define XF86RANDRINFO(p) \ + ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr) + +#endif /* XORG_VERSION_CURRENT < 7.0 */ + + static int xf86RandR12ModeRefresh (DisplayModePtr mode) { @@ -340,13 +350,17 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen, PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen); Bool ret = FALSE; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) if (xf86RandR12Key) { +#endif if (randrp->virtualX == -1 || randrp->virtualY == -1) { randrp->virtualX = pScrn->virtualX; randrp->virtualY = pScrn->virtualY; } +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) } +#endif if (pRoot && pScrn->vtSema) (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE); @@ -468,8 +482,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) mmHeight); } +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) if (xf86RandR12Key == NULL) return TRUE; +#endif if (randrp->virtualX == -1 || randrp->virtualY == -1) { @@ -500,7 +516,11 @@ xf86RandR12Init (ScreenPtr pScreen) if (xf86RandR12Generation != serverGeneration) xf86RandR12Generation = serverGeneration; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) xf86RandR12Key = &xf86RandR12Key; +#else + xf86RandR12Index = AllocateScreenPrivateIndex(); +#endif randrp = xalloc (sizeof (XF86RandRInfoRec)); if (!randrp) @@ -526,7 +546,11 @@ xf86RandR12Init (ScreenPtr pScreen) randrp->maxX = randrp->maxY = 0; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp); +#else + pScreen->devPrivates[xf86RandR12Index].ptr = randrp; +#endif #if RANDR_12_INTERFACE if (!xf86RandR12Init12 (pScreen)) @@ -545,8 +569,10 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) if (xf86RandR12Key == NULL) return; +#endif randrp = XF86RANDRINFO(pScreen); #if RANDR_12_INTERFACE @@ -1090,8 +1116,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) if (xf86RandR12Key == NULL) return TRUE; +#endif for (c = 0; c < config->num_crtc; c++) xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc); @@ -1113,8 +1141,13 @@ xf86RandR12TellChanged (ScreenPtr pScreen) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) if (xf86RandR12Key == NULL) return; +#else + if (!XF86RANDRINFO(pScreen)) + return; +#endif xf86RandR12SetInfo12 (pScreen); for (c = 0; c < config->num_crtc; c++) diff --git a/hw/xfree86/modes/xf86gtf.c b/hw/xfree86/modes/xf86gtf.c index acbac83b6..fed56bd12 100644 --- a/hw/xfree86/modes/xf86gtf.c +++ b/hw/xfree86/modes/xf86gtf.c @@ -62,6 +62,10 @@ #ifdef HAVE_XORG_CONFIG_H # include +#else +#ifdef HAVE_CONFIG_H +#include +#endif #endif #include "xf86.h" From 3fcb6445dc08f42488287162e3b7009d405e9c5b Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 7 Mar 2008 08:29:49 -0500 Subject: [PATCH 058/183] Fix segfault when a monitor exists but has no modes. Thanks to Zhenyu Wang for finding this. --- hw/xfree86/modes/xf86Crtc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 4d5d7b848..0bef5b42f 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1678,6 +1678,9 @@ nextAspectMode(DisplayModePtr start, float aspect) { DisplayModePtr m = start; + if (!m) + return NULL; + for (m = m->next; m; m = m->next) if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay)) return m; From 3bf7ff70323d533a3a05c0f3e22393e63beada99 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 7 Mar 2008 09:25:06 -0500 Subject: [PATCH 059/183] Size xf86DefaultModes explicitly. i.e., don't check for the end of the list by ->name == NULL, since that won't work now. Fix the consumers of xf86DefaultModes to use the new explicit size as well. --- hw/xfree86/common/modeline2c.awk | 3 ++- hw/xfree86/common/xf86Config.c | 30 +++++++++--------------------- hw/xfree86/common/xf86Priv.h | 1 + hw/xfree86/modes/xf86Modes.c | 28 +++++----------------------- 4 files changed, 17 insertions(+), 45 deletions(-) diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk index b9ad3cdf9..ca32e2f2d 100644 --- a/hw/xfree86/common/modeline2c.awk +++ b/hw/xfree86/common/modeline2c.awk @@ -91,5 +91,6 @@ BEGIN { } END { - printf("\t{MODEPREFIX,0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n") + print "};" + printf "const int xf86NumDefaultModes = sizeof(xf86NumDefaultModes) / sizeof(DisplayModeRec);" } diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 635a88c91..4a4aabcb5 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -2420,28 +2420,16 @@ addDefaultModes(MonPtr monitorp) DisplayModePtr last = monitorp->Last; int i = 0; - while (xf86DefaultModes[i].name != NULL) + for (i = 0; i < xf86NumDefaultModes; i++) { - if ( ! modeIsPresent(xf86DefaultModes[i].name,monitorp) ) - do - { - mode = xf86DuplicateMode(&xf86DefaultModes[i]); - if( last ) { - mode->prev = last; - last->next = mode; - } - else { - /* this is the first mode */ - monitorp->Modes = mode; - mode->prev = NULL; - } - last = mode; - i++; - } - while((xf86DefaultModes[i].name != NULL) && - (!strcmp(xf86DefaultModes[i].name,xf86DefaultModes[i-1].name))); - else - i++; + mode = xf86DuplicateMode(&xf86DefaultModes[i]); + if (!modeIsPresent(mode, monitorp)) + { + monitorp->Modes = xf86ModesAdd(monitorp->Modes, mode); + last = mode; + } else { + xfree(mode); + } } monitorp->Last = last; diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index dd8b5a022..c0d240dd5 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -154,6 +154,7 @@ Bool xf86PathIsSafe(const char *path); /* xf86DefaultModes */ extern const DisplayModeRec xf86DefaultModes[]; +extern const int xf86NumDefaultModes; /* xf86DoProbe.c */ void DoProbe(void); diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index aa2635c48..2dff31b3a 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -214,11 +214,7 @@ xf86DuplicateMode(DisplayModePtr pMode) *pNew = *pMode; pNew->next = NULL; pNew->prev = NULL; - /* - * It is important to copy the name explicitly. - * Otherwise a mode could reference an invalid piece of memory, after one of them runs free(). - * This will lead to obscure problems, that you really don't want. - */ + if (pMode->name == NULL) xf86SetModeDefaultName(pNew); else @@ -667,7 +663,7 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) DisplayModePtr head = NULL, prev = NULL, mode; int i; - for (i = 0; xf86DefaultModes[i].name != NULL; i++) + for (i = 0; i < xf86NumDefaultModes; i++) { DisplayModePtr defMode = &xf86DefaultModes[i]; @@ -676,23 +672,9 @@ xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed) if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN)) continue; - mode = xalloc(sizeof(DisplayModeRec)); - if (!mode) - continue; - memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec)); - mode->name = xstrdup(xf86DefaultModes[i].name); - if (!mode->name) - { - xfree (mode); - continue; - } - mode->prev = prev; - mode->next = NULL; - if (prev) - prev->next = mode; - else - head = mode; - prev = mode; + mode = xf86DuplicateMode(defMode); + + head = xf86ModesAdd(head, mode); } return head; } From 9abaad115cb6245b12b2adb3552ace99b634ab4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 7 Mar 2008 14:12:28 -0500 Subject: [PATCH 060/183] Fix DRI2 texture target for GLX_EXT_texture_from_pixmap. Thanks to Dennis Kasprzyk for pointing it out and for reminding me to commit it. --- GL/glx/glxdri2.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/GL/glx/glxdri2.c b/GL/glx/glxdri2.c index b0082a040..27257d3e0 100644 --- a/GL/glx/glxdri2.c +++ b/GL/glx/glxdri2.c @@ -216,8 +216,6 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext) #ifdef __DRI_TEX_BUFFER -#define isPowerOfTwo(n) (((n) & ((n) - 1 )) == 0) - static int __glXDRIbindTexImage(__GLXcontext *baseContext, int buffer, @@ -228,26 +226,17 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, PixmapPtr pixmap; __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; unsigned int flags; - int w, h, target; if (screen->texBuffer == NULL) return Success; pixmap = (PixmapPtr) glxPixmap->pDraw; - w = pixmap->drawable.width; - h = pixmap->drawable.height; - - if (!isPowerOfTwo(w) || !isPowerOfTwo(h)) - target = GL_TEXTURE_RECTANGLE_ARB; - else - target = GL_TEXTURE_2D; - screen->texBuffer->setTexBuffer(&context->driContext, - target, + glxPixmap->target, DRI2GetPixmapHandle(pixmap, &flags), pixmap->drawable.depth, pixmap->devKind, - h); + pixmap->drawable.height); return Success; } From 911f0c147699d3b8d97491be2ef6d2e4a6682a0b Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Fri, 7 Mar 2008 23:24:06 +0100 Subject: [PATCH 061/183] Programs in hw/dmx/examples/ want client-side xkb headers. --- hw/dmx/examples/xinput.c | 2 +- hw/dmx/examples/xled.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c index b6753e4ec..74353a93b 100644 --- a/hw/dmx/examples/xinput.c +++ b/hw/dmx/examples/xinput.c @@ -38,7 +38,7 @@ #include #include #include -#include "xkbstr.h" +#include #include #include diff --git a/hw/dmx/examples/xled.c b/hw/dmx/examples/xled.c index 322dda2f3..270f80511 100644 --- a/hw/dmx/examples/xled.c +++ b/hw/dmx/examples/xled.c @@ -37,7 +37,7 @@ #include #include #include -#include "xkbstr.h" +#include #include int main(int argc, char **argv) From acedc03367e9e69f03b4838f0f0e8d8a8e872b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sun, 9 Mar 2008 21:39:19 -0400 Subject: [PATCH 062/183] DRI2: Return event buffer head index in DRI2CreateDrawable. And pass it to the DRI driver in AIGLX. --- GL/glx/glxdri.c | 2 +- GL/glx/glxdri2.c | 6 ++++-- hw/xfree86/dri2/dri2.c | 5 +++-- hw/xfree86/dri2/dri2.h | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index dc15b0fcc..1e1791122 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -704,7 +704,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, (driScreen->driScreen.createNewDrawable)(&driScreen->driScreen, modes, &private->driDrawable, - hwDrawable, 0, NULL); + hwDrawable, 0, 0, NULL); if (private->driDrawable.private == NULL) { __glXenterServer(GL_FALSE); diff --git a/GL/glx/glxdri2.c b/GL/glx/glxdri2.c index 27257d3e0..fbc018caf 100644 --- a/GL/glx/glxdri2.c +++ b/GL/glx/glxdri2.c @@ -341,6 +341,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, __GLXDRIdrawable *private; GLboolean retval; drm_drawable_t hwDrawable; + unsigned int head; private = xalloc(sizeof *private); if (private == NULL) @@ -359,13 +360,14 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, private->base.swapBuffers = __glXDRIdrawableSwapBuffers; private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer; - retval = DRI2CreateDrawable(screen->pScreen, pDraw, &hwDrawable); + retval = DRI2CreateDrawable(screen->pScreen, pDraw, + &hwDrawable, &head); private->driDrawable.private = (driScreen->driScreen.createNewDrawable)(&driScreen->driScreen, modes, &private->driDrawable, - hwDrawable, 0, NULL); + hwDrawable, head, 0, NULL); return &private->base; } diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 9b4c18c61..d2664b1cb 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -262,8 +262,8 @@ DRI2CloseScreen(ScreenPtr pScreen) } Bool -DRI2CreateDrawable(ScreenPtr pScreen, - DrawablePtr pDraw, drm_drawable_t *pDrmDrawable) +DRI2CreateDrawable(ScreenPtr pScreen, DrawablePtr pDraw, + drm_drawable_t *pDrmDrawable, unsigned int *head) { DRI2ScreenPtr ds = DRI2GetScreen(pScreen); WindowPtr pWin; @@ -293,6 +293,7 @@ DRI2CreateDrawable(ScreenPtr pScreen, *pDrmDrawable = pPriv->drawable; + *head = ds->buffer->head; DRI2PostDrawableConfig(pDraw); DRI2PostBufferAttach(pDraw); DRI2ScreenCommitEvents(ds); diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index c8482477e..a31908508 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -66,7 +66,8 @@ void DRI2Unlock(ScreenPtr pScreen); Bool DRI2CreateDrawable(ScreenPtr pScreen, DrawablePtr pDraw, - drm_drawable_t *pDrmDrawable); + drm_drawable_t *pDrmDrawable, + unsigned int *head); void DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw); From 01c2e01f2aee580438b74bfb9da8f584f3878e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sun, 9 Mar 2008 21:40:27 -0400 Subject: [PATCH 063/183] GLX: Track changes to DRI_TEX_BUFFER extension. We now just pass in the __DRIdrawable. --- GL/glx/glxdri2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/GL/glx/glxdri2.c b/GL/glx/glxdri2.c index fbc018caf..fecfb1977 100644 --- a/GL/glx/glxdri2.c +++ b/GL/glx/glxdri2.c @@ -225,7 +225,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, __GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen); PixmapPtr pixmap; __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; - unsigned int flags; + __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap; if (screen->texBuffer == NULL) return Success; @@ -233,10 +233,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, pixmap = (PixmapPtr) glxPixmap->pDraw; screen->texBuffer->setTexBuffer(&context->driContext, glxPixmap->target, - DRI2GetPixmapHandle(pixmap, &flags), - pixmap->drawable.depth, - pixmap->devKind, - pixmap->drawable.height); + &drawable->driDrawable); return Success; } From 0f6aaf636b7ac4c98467284ff7baf1b83e0b72e7 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 10 Mar 2008 09:14:20 -0400 Subject: [PATCH 064/183] Bug #14927: Fix the math for xf86NumDefaultModes. --- hw/xfree86/common/modeline2c.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk index ca32e2f2d..71a956e05 100644 --- a/hw/xfree86/common/modeline2c.awk +++ b/hw/xfree86/common/modeline2c.awk @@ -92,5 +92,5 @@ BEGIN { END { print "};" - printf "const int xf86NumDefaultModes = sizeof(xf86NumDefaultModes) / sizeof(DisplayModeRec);" + printf "const int xf86NumDefaultModes = sizeof(xf86DefaultModes) / sizeof(DisplayModeRec);" } From ab9b0b36ac8ac72fc48c0abd91a83de49a18313c Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 10 Mar 2008 13:40:00 -0400 Subject: [PATCH 065/183] Add the "amd" driver to magic driver selection. --- hw/xfree86/common/xf86AutoConfig.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index e3e0bb3a3..268b50cb5 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -140,12 +140,13 @@ videoPtrToDriverName(struct pci_device *dev) { /* * things not handled yet: - * amd/cyrix/nsc - * xgi + * cyrix/nsc. should be merged into geode anyway. + * xgi. */ switch (dev->vendor_id) { + case 0x1022: return "amd"; case 0x1142: return "apm"; case 0xedd8: return "ark"; case 0x1a03: return "ast"; From b2657ec5981122e7cc0bda0d8802aec63cde9014 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 6 Feb 2008 16:51:57 -0800 Subject: [PATCH 066/183] XkbCopyKeymap was mangling doodads and overlays --- xkb/xkbUtils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index b3132701d..a3ae655f0 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -1796,6 +1796,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dsection = dst->geom->sections; i < src->geom->num_sections; i++, ssection++, dsection++) { + *dsection = *ssection; if (ssection->num_rows) { tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec)); if (!tmp) @@ -1830,6 +1831,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dsection->doodads = NULL; } + dsection->sz_doodads = ssection->num_doodads; for (k = 0, sdoodad = ssection->doodads, ddoodad = dsection->doodads; @@ -1850,8 +1852,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } ddoodad->any.type = sdoodad->any.type; } - dsection->num_doodads = ssection->num_doodads; - dsection->sz_doodads = ssection->num_doodads; + dsection->overlays = NULL; + dsection->sz_overlays = 0; + dsection->num_overlays = 0; } } else { From bc504ffbba3dec2e3467bab8ba1ac25db6dd317e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 11 Mar 2008 00:35:31 -0400 Subject: [PATCH 067/183] DRI2: Add DRI2AuthConnection(). DRI2 uses the same authentication scheme as XF86DRI, so implement this entry point so DRI2 protocol code can access it. --- hw/xfree86/dri2/dri2.c | 11 +++++++++++ hw/xfree86/dri2/dri2.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index d2664b1cb..d5273877e 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -342,6 +342,17 @@ DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName, return TRUE; } +Bool +DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (ds == NULL || drmAuthMagic(ds->fd, magic)) + return FALSE; + + return TRUE; +} + unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags) { diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index a31908508..126087a2f 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -58,6 +58,8 @@ Bool DRI2Connect(ScreenPtr pScreen, const char **driverName, unsigned int *sareaHandle); +Bool DRI2AuthConnection(ScreenPtr pScreen, drm_magic_t magic); + unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags); From cc05255191413b3f376edbc600122ff085f45f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 11 Mar 2008 00:51:43 -0400 Subject: [PATCH 068/183] Make WriteToClient take a const void * like any decent IO write function. Enough with the casting. Doesn't break API or even ABI, but does make a lot of silly casts superfluos. --- include/os.h | 4 ++-- os/io.c | 10 ++++++---- os/osdep.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/os.h b/include/os.h index 4be6b8010..c0f04c6af 100644 --- a/include/os.h +++ b/include/os.h @@ -115,7 +115,7 @@ extern void FlushIfCriticalOutputPending(void); extern void SetCriticalOutputPending(void); -extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/); +extern int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/); extern void ResetOsBuffers(void); @@ -448,7 +448,7 @@ typedef struct { extern CallbackListPtr ReplyCallback; typedef struct { ClientPtr client; - pointer replyData; + const void *replyData; unsigned long dataLenBytes; unsigned long bytesRemaining; Bool startOfReply; diff --git a/os/io.c b/os/io.c index e7ec60952..4f4a10903 100644 --- a/os/io.c +++ b/os/io.c @@ -730,11 +730,12 @@ SetCriticalOutputPending(void) *****************/ _X_EXPORT int -WriteToClient (ClientPtr who, int count, char *buf) +WriteToClient (ClientPtr who, int count, const void *__buf) { OsCommPtr oc = (OsCommPtr)who->osPrivate; ConnectionOutputPtr oco = oc->output; int padBytes; + const char *buf = __buf; #ifdef DEBUG_COMMUNICATION Bool multicount = FALSE; #endif @@ -871,13 +872,14 @@ WriteToClient (ClientPtr who, int count, char *buf) **********************/ int -FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount) +FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount) { ConnectionOutputPtr oco = oc->output; int connection = oc->fd; XtransConnInfo trans_conn = oc->trans_conn; struct iovec iov[3]; static char padBuffer[3]; + const char *extraBuf = __extraBuf; long written; long padsize; long notWritten; @@ -916,14 +918,14 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount) before = (-len); \ } else { \ iov[i].iov_len = len; \ - iov[i].iov_base = (pointer) + before; \ + iov[i].iov_base = (pointer) + before; \ i++; \ remain -= len; \ before = 0; \ } InsertIOV ((char *)oco->buf, oco->count) - InsertIOV (extraBuf, extraCount) + InsertIOV ((char *)extraBuf, extraCount) InsertIOV (padBuffer, padsize) errno = 0; diff --git a/os/osdep.h b/os/osdep.h index b6894c146..84f7177db 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -184,7 +184,7 @@ typedef struct _osComm { extern int FlushClient( ClientPtr /*who*/, OsCommPtr /*oc*/, - char* /*extraBuf*/, + const void * /*extraBuf*/, int /*extraCount*/ ); From c7536f4b87e089a7e7c43026b189922fec70c565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 11 Mar 2008 13:11:04 -0400 Subject: [PATCH 069/183] Silence REGION_INIT() warning. Evaluating the address of a BoxRec as a boolean gives this warning: i830_driver.c:2317: warning: the address of 'ScreenBox' will always evaluate as 'true' which is pretty annoying. This patch compares the address to NULL to avoid the pointer->bool conversion and gets rid of the warning. Seems like a lame hack, but the warning is worse. --- include/regionstr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/regionstr.h b/include/regionstr.h index f44cab7b0..5a79b1228 100644 --- a/include/regionstr.h +++ b/include/regionstr.h @@ -158,7 +158,7 @@ extern RegDataRec miBrokenData; #define REGION_INIT(_pScreen, _pReg, _rect, _size) \ { \ - if (_rect) \ + if ((_rect) != NULL) \ { \ (_pReg)->extents = *(_rect); \ (_pReg)->data = (RegDataPtr)NULL; \ From 2036851125226065891f13583ade3ce559e7bd37 Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Mon, 10 Mar 2008 19:29:07 +0100 Subject: [PATCH 070/183] Return randr interface version in xf86CrtcScreenInit() Necessary to allow drivers to be run-time backwards compatible when using the modes/ functions w/o providing their own copy. --- hw/xfree86/modes/xf86Crtc.c | 13 +++++++++++-- hw/xfree86/modes/xf86Crtc.h | 4 ++++ randr/randrstr.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 0bef5b42f..39e84e641 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -694,7 +694,12 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen) /* * Called at ScreenInit time to set up */ -_X_EXPORT Bool +_X_EXPORT +#ifdef RANDR_13_INTERFACE +int +#else +Bool +#endif xf86CrtcScreenInit (ScreenPtr screen) { ScrnInfoPtr scrn = xf86Screens[screen->myNum]; @@ -727,7 +732,11 @@ xf86CrtcScreenInit (ScreenPtr screen) config->CloseScreen = screen->CloseScreen; screen->CloseScreen = xf86CrtcCloseScreen; +#ifdef RANDR_13_INTERFACE + return RANDR_INTERFACE_VERSION; +#else return TRUE; +#endif } static DisplayModePtr @@ -2228,7 +2237,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) } } xf86DisableUnusedFunctions(pScrn); -#if RANDR_12_INTERFACE +#ifdef RANDR_12_INTERFACE xf86RandR12TellChanged (pScrn->pScreen); #endif return ok; diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index b87a32548..a542e7f39 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -692,7 +692,11 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY); void xf86SetScrnInfoModes (ScrnInfoPtr pScrn); +#ifdef RANDR_13_INTERFACE +int +#else Bool +#endif xf86CrtcScreenInit (ScreenPtr pScreen); Bool diff --git a/randr/randrstr.h b/randr/randrstr.h index 3b48f5c2b..4d7c9ccfc 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -56,6 +56,8 @@ #define RANDR_12_INTERFACE 1 #define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */ +#define RANDR_INTERFACE_VERSION 0x0103 + typedef XID RRMode; typedef XID RROutput; typedef XID RRCrtc; From 06c0372c3a1b45005eb6d50406f77f4e93f1de1e Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Wed, 12 Mar 2008 21:45:37 +0100 Subject: [PATCH 071/183] OpenBSD support for libpciaccess. xserver and libpciaccess both need to open /dev/xf86, which can only be opened once. I implemented pci_system_init_dev_mem() like Ian suggested. This requires some minor changes to the BSD-specific os-support code. Since pci_system_init_dev_mem() is a no-op on FreeBSD this should be no problem. --- hw/xfree86/os-support/bsd/i386_video.c | 3 +++ hw/xfree86/os-support/bus/bsd_pci.c | 2 ++ hw/xfree86/utils/ioport/Makefile.am | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 0dcff6631..7e4a4d2a3 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -212,6 +212,9 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->mapMem = mapVidMem; pVidMem->unmapMem = unmapVidMem; + if (useDevMem) + pci_system_init_dev_mem(devMemFd); + #ifdef HAS_MTRR_SUPPORT if (useDevMem) { if (cleanMTRR()) { diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c index bceb1087f..57ad09b6a 100644 --- a/hw/xfree86/os-support/bus/bsd_pci.c +++ b/hw/xfree86/os-support/bus/bsd_pci.c @@ -81,4 +81,6 @@ bsdPciInit(void) { pciNumBuses = 1; pciBusInfo[0] = &bsd_pci; + + xf86InitVidMem(); } diff --git a/hw/xfree86/utils/ioport/Makefile.am b/hw/xfree86/utils/ioport/Makefile.am index c1f9453a8..12f861372 100644 --- a/hw/xfree86/utils/ioport/Makefile.am +++ b/hw/xfree86/utils/ioport/Makefile.am @@ -37,7 +37,7 @@ ioport_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) ioport_LDADD = \ ../../os-support/libxorgos.la \ ../../dummylib/libdummy-nonserver.a \ - ${UTILS_SYS_LIBS} + ${UTILS_SYS_LIBS} ${PCIACCESS_LIBS} ioport_SOURCES = \ From 61c3f63a75d8b0cc47ffed4a0e30147fab2ae8f4 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 13 Mar 2008 17:34:54 -0400 Subject: [PATCH 072/183] RANDR 1.2: Don't report a square resolution to RANDR 1.1 clients. It can't possibly do anything useful, and older versions of Gnome (and proably others) get very confused by it. So do the drivers, for that matter. --- hw/xfree86/modes/xf86RandR12.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 816175cc3..af950e61c 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -145,23 +145,6 @@ xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations) randrp->maxY = maxY; } - if (scrp->currentMode->HDisplay != randrp->virtualX || - scrp->currentMode->VDisplay != randrp->virtualY) - { - pSize = RRRegisterSize (pScreen, - randrp->virtualX, randrp->virtualY, - randrp->mmWidth, - randrp->mmHeight); - if (!pSize) - return FALSE; - RRRegisterRate (pScreen, pSize, refresh0); - if (scrp->virtualX == randrp->virtualX && - scrp->virtualY == randrp->virtualY) - { - RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize); - } - } - return TRUE; } From 5d7437c29e686a081b20823450d78c4c2f4e0aec Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 13 Mar 2008 17:37:12 -0400 Subject: [PATCH 073/183] RANDR 1.2: Fix the RANDR 1.1 screen size estimation to approach reality. While the ScreenRec's notion of size in millimeters would get updates, the RANDR 1.1 notion wouldn't, so your screen would appear to be square and probably at some ludicrous DPI. --- hw/xfree86/modes/xf86RandR12.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index af950e61c..1dca223fe 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -355,8 +355,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen, pScreen->width = pScrnPix->drawable.width = width; pScreen->height = pScrnPix->drawable.height = height; - pScreen->mmWidth = mmWidth; - pScreen->mmHeight = mmHeight; + randrp->mmWidth = pScreen->mmWidth = mmWidth; + randrp->mmHeight = pScreen->mmHeight = mmHeight; xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1); xf86SetViewport (pScreen, 0, 0); From f7abe05b3306ed9a6f2cf5e3e45ed524d725d029 Mon Sep 17 00:00:00 2001 From: Doug Chapman Date: Thu, 13 Mar 2008 17:40:34 -0400 Subject: [PATCH 074/183] Bug #14091: Fix build (and runtime) on ia64. --- hw/xfree86/os-support/bus/Makefile.am | 12 ------ hw/xfree86/os-support/bus/Pci.h | 3 +- hw/xfree86/os-support/linux/Makefile.am | 2 +- hw/xfree86/os-support/shared/ia64Pci.c | 55 ------------------------- 4 files changed, 2 insertions(+), 70 deletions(-) diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index 381b9923c..5a15430c1 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -27,18 +27,6 @@ if LINUX_ALPHA PCI_SOURCES += axpPci.c endif -if LINUX_IA64 -PLATFORM_PCI_SOURCES = \ - 460gxPCI.c \ - 460gxPCI.h \ - altixPCI.c \ - altixPCI.h \ - e8870PCI.c \ - e8870PCI.h \ - zx1PCI.c \ - zx1PCI.h -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index 0abb34f98..ebac0905b 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -207,9 +207,8 @@ # endif #elif defined(__ia64__) # if defined(linux) -# define ARCH_PCI_INIT ia64linuxPciInit +# define ARCH_PCI_INIT linuxPciInit # endif -# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper #elif defined(__i386__) || defined(__i386) # if defined(linux) # define ARCH_PCI_INIT linuxPciInit diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index 5a52ffdd4..beaae3d5b 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = liblinux.la if LINUX_IA64 -PLATFORM_PCI_SUPPORT = $(srcdir)/lnx_ia64.c $(srcdir)/../shared/ia64Pci.c +PLATFORM_PCI_SUPPORT = $(srcdir)/../shared/ia64Pci.c PLATFORM_DEFINES = -DOS_PROBE_PCI_CHIPSET=lnxProbePciChipset PLATFORM_INCLUDES = -I$(srcdir)/../shared endif diff --git a/hw/xfree86/os-support/shared/ia64Pci.c b/hw/xfree86/os-support/shared/ia64Pci.c index 45522e933..6f6924b59 100644 --- a/hw/xfree86/os-support/shared/ia64Pci.c +++ b/hw/xfree86/os-support/shared/ia64Pci.c @@ -42,12 +42,7 @@ #include #include "compiler.h" -#include "460gxPCI.h" -#include "e8870PCI.h" -#include "zx1PCI.h" -#include "altixPCI.h" #include "Pci.h" -#include "ia64Pci.h" /* * We use special in/out routines here since Altix platforms require the @@ -191,53 +186,3 @@ _X_EXPORT unsigned int inl(unsigned long port) return val; } -void -ia64ScanPCIWrapper(scanpciWrapperOpt flags) -{ - static IA64Chipset chipset = NONE_CHIPSET; - - if (flags == SCANPCI_INIT) { - - /* PCI configuration space probes should be done first */ - if (xorgProbe460GX(flags)) { - chipset = I460GX_CHIPSET; - xf86PreScan460GX(); - return; - } else if (xorgProbeE8870(flags)) { - chipset = E8870_CHIPSET; - xf86PreScanE8870(); - return; - } -#ifdef OS_PROBE_PCI_CHIPSET - chipset = OS_PROBE_PCI_CHIPSET(flags); - switch (chipset) { - case ZX1_CHIPSET: - xf86PreScanZX1(); - return; - case ALTIX_CHIPSET: - xf86PreScanAltix(); - return; - default: - return; - } -#endif - } else /* if (flags == SCANPCI_TERM) */ { - - switch (chipset) { - case I460GX_CHIPSET: - xf86PostScan460GX(); - return; - case E8870_CHIPSET: - xf86PostScanE8870(); - return; - case ZX1_CHIPSET: - xf86PostScanZX1(); - return; - case ALTIX_CHIPSET: - xf86PostScanAltix(); - return; - default: - return; - } - } -} From 1b9878ffcfc0c0dbc4a6e674827fe508ba77db4b Mon Sep 17 00:00:00 2001 From: Bart Trojanowski Date: Thu, 13 Mar 2008 17:42:16 -0400 Subject: [PATCH 075/183] Bug #14332: Fix PCI access cycles from x86emu. The address written to 0xcf8 contains the PCI slot address to send the config cycle to. However, we would ignore that and always send the cycle to the device whose BIOS we were running. This breaks some integrated graphics platforms that have explicit knowledge about the system's host bridge, for example. --- hw/xfree86/int10/helper_exec.c | 57 +++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index de6fde5d8..9daff22dc 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -33,6 +33,7 @@ #ifdef _X86EMU #include "x86emu/x86emui.h" #endif +#include static int pciCfg1in(CARD16 addr, CARD32 *val); static int pciCfg1out(CARD16 addr, CARD32 val); @@ -459,7 +460,43 @@ Mem_wl(CARD32 addr, CARD32 val) static CARD32 PciCfg1Addr = 0; -#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff) +#define PCI_OFFSET(x) ((x) & 0x000000ff) +#define PCI_TAG(x) ((x) & 0xffffff00) + +static struct pci_device* +pci_device_for_cfg_address (CARD32 addr) +{ + struct pci_device *dev = NULL; + PCITAG tag = PCI_TAG(addr); + struct pci_slot_match slot_match = { + .domain = PCI_DOM_FROM_TAG(tag), + .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)), + .dev = PCI_DEV_FROM_TAG(tag), + .func = PCI_FUNC_FROM_TAG(tag), + .match_data = 0 + }; + + struct pci_device_iterator *iter = + pci_slot_match_iterator_create (&slot_match); + if (iter) + dev = pci_device_next(iter); + if (!dev) { + char buf[128]; /* enough to store "%u@%u" */ + xf86FormatPciBusNumber(tag >> 16, buf); + ErrorF("Failed to find device matching %s:%u:%u\n", + buf, slot_match.dev, slot_match.func); + return NULL; + } + + if (pci_device_next(iter)) { + char buf[128]; /* enough to store "%u@%u" */ + xf86FormatPciBusNumber(tag >> 16, buf); + ErrorF("Multiple devices matching %s:%u:%u\n", + buf, slot_match.dev, slot_match.func); + } + + return dev; +} static int pciCfg1in(CARD16 addr, CARD32 *val) @@ -469,7 +506,8 @@ pciCfg1in(CARD16 addr, CARD32 *val) return 1; } if (addr == 0xCFC) { - pci_device_cfg_read_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr)); + pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr)); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val); return 1; @@ -487,7 +525,8 @@ pciCfg1out(CARD16 addr, CARD32 val) if (addr == 0xCFC) { if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val); - pci_device_cfg_write_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr)); + pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr)); return 1; } return 0; @@ -506,7 +545,8 @@ pciCfg1inw(CARD16 addr, CARD16 *val) if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; - pci_device_cfg_read_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val); return 1; @@ -530,7 +570,8 @@ pciCfg1outw(CARD16 addr, CARD16 val) if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val); - pci_device_cfg_write_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); return 1; } return 0; @@ -549,7 +590,8 @@ pciCfg1inb(CARD16 addr, CARD8 *val) if ((addr >= 0xCFC) && (addr <= 0xCFF)) { const unsigned offset = addr - 0xCFC; - pci_device_cfg_read_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val); return 1; @@ -573,7 +615,8 @@ pciCfg1outb(CARD16 addr, CARD8 val) if (PRINT_PORT && DEBUG_IO_TRACE()) ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val); - pci_device_cfg_write_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset); + pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); return 1; } return 0; From 824853772241acf64bc37ac8b85254194741ae13 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 14 Mar 2008 14:24:21 -0400 Subject: [PATCH 076/183] RANDR 1.2: Fix initial mode aspect ratio match in a corner case. Actually more like in the mainline case, where the ideal mode happens to be the very first aspect match on the first monitor. But let's not split hairs. --- hw/xfree86/modes/xf86Crtc.c | 55 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 39e84e641..6b845b7c9 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -1683,14 +1683,19 @@ aspectMatch(float a, float b) } static DisplayModePtr -nextAspectMode(DisplayModePtr start, float aspect) +nextAspectMode(xf86OutputPtr o, DisplayModePtr last, float aspect) { - DisplayModePtr m = start; + DisplayModePtr m = NULL; - if (!m) + if (!o) return NULL; - for (m = m->next; m; m = m->next) + if (!last) + m = o->probed_modes; + else + m = last->next; + + for (; m; m = m->next) if (aspectMatch(aspect, (float)m->HDisplay / (float)m->VDisplay)) return m; @@ -1700,31 +1705,29 @@ nextAspectMode(DisplayModePtr start, float aspect) static DisplayModePtr bestModeForAspect(xf86CrtcConfigPtr config, Bool *enabled, float aspect) { - int o, p; - DisplayModePtr mode, test = NULL, match = NULL; + int o = -1, p; + DisplayModePtr mode = NULL, test = NULL, match = NULL; - for (o = -1; nextEnabledOutput(config, enabled, &o); ) { - mode = config->output[o]->probed_modes; - while ((mode = nextAspectMode(mode, aspect))) { - for (p = o; nextEnabledOutput(config, enabled, &p); ) { - test = xf86OutputFindClosestMode(config->output[p], mode); - if (!test) - break; - if (test->HDisplay != mode->HDisplay || - test->VDisplay != mode->VDisplay) { - test = NULL; - break; - } - } - - /* if we didn't match it on all outputs, try the next one */ + nextEnabledOutput(config, enabled, &o); + while ((mode = nextAspectMode(config->output[o], mode, aspect))) { + for (p = o; nextEnabledOutput(config, enabled, &p); ) { + test = xf86OutputFindClosestMode(config->output[p], mode); if (!test) - continue; - - /* if it's bigger than the last one, save it */ - if (!match || (test->HDisplay > match->HDisplay)) - match = test; + break; + if (test->HDisplay != mode->HDisplay || + test->VDisplay != mode->VDisplay) { + test = NULL; + break; + } } + + /* if we didn't match it on all outputs, try the next one */ + if (!test) + continue; + + /* if it's bigger than the last one, save it */ + if (!match || (test->HDisplay > match->HDisplay)) + match = test; } /* return the biggest one found */ From 57d48d94b8947c571925e6fd4c9bf041fbd1b2ac Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 14 Mar 2008 14:37:42 -0400 Subject: [PATCH 077/183] Fix a stray use of ALLOCATE_LOCAL. --- hw/xfree86/xf4bpp/ppcSpMcro.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/xf4bpp/ppcSpMcro.h b/hw/xfree86/xf4bpp/ppcSpMcro.h index 2b7f951d4..655a883e5 100644 --- a/hw/xfree86/xf4bpp/ppcSpMcro.h +++ b/hw/xfree86/xf4bpp/ppcSpMcro.h @@ -28,11 +28,11 @@ #define SETSPANPTRS(IN,N,IPW,PW,IPPT,PPT,FPW,FPPT,FSORT) \ { \ N = IN * miFindMaxBand(pGC->pCompositeClip); \ - if(!(PW = (int *)ALLOCATE_LOCAL(N * sizeof(int)))) \ + if(!(PW = (int *)xalloc(N * sizeof(int)))) \ return; \ - if(!(PPT = (DDXPointRec *)ALLOCATE_LOCAL(N * sizeof(DDXPointRec)))) \ + if(!(PPT = (DDXPointRec *)xalloc(N * sizeof(DDXPointRec)))) \ { \ - DEALLOCATE_LOCAL(PW); \ + free(PW); \ return; \ } \ FPW = PW; \ From 88bec0915e3867f8dbf859a3dfbb771d0d07092d Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 14 Mar 2008 21:54:13 +0200 Subject: [PATCH 078/183] mi: More meaningful assert crashes When we fail an assert in miregion.c (which happens every now and then, though I haven't yet checked up why), at least generate a segfault, so we'll get a backtrace. --- mi/miregion.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mi/miregion.c b/mi/miregion.c index 45768a34f..69ecdc246 100644 --- a/mi/miregion.c +++ b/mi/miregion.c @@ -89,9 +89,14 @@ Equipment Corporation. #undef assert #ifdef DEBUG -#define assert(expr) {if (!(expr)) \ - FatalError("Assertion failed file %s, line %d: expr\n", \ - __FILE__, __LINE__); } +#define assert(expr) { \ + CARD32 *foo = NULL; \ + if (!(expr)) { \ + ErrorF("Assertion failed file %s, line %d: %s\n", \ + __FILE__, __LINE__, #expr); \ + *foo = 0xdeadbeef; /* to get a backtrace */ \ + } \ + } #else #define assert(expr) #endif From 090b26db767d296e7a3452da83b136d1caa0ed01 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 14 Mar 2008 21:58:27 +0200 Subject: [PATCH 079/183] XkbCopyKeymap: Fix broken indentation An astute observer will note that the entirety of XkbCopyKeymap is indented with spaces, and no tabs whatsoever, and not commit changes which break the otherwise consistent indentation. A non-astute observer will note the breakage when the commit mail comes through with clearly broken indentation. A polite, non-astute, observer will then fix it. C'est la vie. --- xkb/xkbUtils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index a3ae655f0..8339cef00 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -1796,7 +1796,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dsection = dst->geom->sections; i < src->geom->num_sections; i++, ssection++, dsection++) { - *dsection = *ssection; + *dsection = *ssection; if (ssection->num_rows) { tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec)); if (!tmp) @@ -1852,9 +1852,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } ddoodad->any.type = sdoodad->any.type; } - dsection->overlays = NULL; - dsection->sz_overlays = 0; - dsection->num_overlays = 0; + dsection->overlays = NULL; + dsection->sz_overlays = 0; + dsection->num_overlays = 0; } } else { From a955c3b587b22b8bf20cb6bedbbec4ad5fcb32ac Mon Sep 17 00:00:00 2001 From: Donnie Berkholz Date: Fri, 14 Mar 2008 18:41:07 -0700 Subject: [PATCH 080/183] Xephyr: Distribute ephyrdriext.h in tarballs. --- hw/kdrive/ephyr/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am index d025c201c..81d3d69ea 100644 --- a/hw/kdrive/ephyr/Makefile.am +++ b/hw/kdrive/ephyr/Makefile.am @@ -35,6 +35,7 @@ if XEPHYR_HAS_DRI libxephyr_hostdri_a_SOURCES= \ ephyrdriext.c \ +ephyrdriext.h \ ephyrdri.c \ ephyrdri.h \ XF86dri.c \ From aa231f28d56402d7daea6cbd3002fbf760f79497 Mon Sep 17 00:00:00 2001 From: Donnie Berkholz Date: Fri, 14 Mar 2008 18:41:25 -0700 Subject: [PATCH 081/183] Xephyr: Build fix: Port across XF86dri.c changes from Mesa. --- hw/kdrive/ephyr/XF86dri.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c index 506d7bed8..e656ff5a0 100644 --- a/hw/kdrive/ephyr/XF86dri.c +++ b/hw/kdrive/ephyr/XF86dri.c @@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext) context, hHWContext ); } -GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context) +GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyContextReq *req; @@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid } GLboolean -XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen, - __DRIid drawable, drm_drawable_t * hHWDrawable) +XF86DRICreateDrawable (Display *dpy, int screen, + XID drawable, drm_drawable_t * hHWDrawable) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRICreateDrawableReply rep; xXF86DRICreateDrawableReq *req; @@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen, return True; } -GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, - __DRIid drawable ) +static int noopErrorHandler(Display *dpy, XErrorEvent *xerr) +{ + return 0; +} + +GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen, + XID drawable ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyDrawableReq *req; + int (*oldXErrorHandler)(Display *, XErrorEvent *); TRACE("DestroyDrawable..."); XF86DRICheckExtension (dpy, info, False); + /* This is called from the DRI driver, which used call it like this + * + * if (windowExists(drawable)) + * destroyDrawable(drawable); + * + * which is a textbook race condition - the window may disappear + * from the server between checking for its existance and + * destroying it. Instead we change the semantics of + * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if + * the windows is gone, by wrapping the destroy call in an error + * handler. */ + + XSync(dpy, GL_FALSE); + oldXErrorHandler = XSetErrorHandler(noopErrorHandler); + LockDisplay(dpy); GetReq(XF86DRIDestroyDrawable, req); req->reqType = info->codes->major_opcode; @@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, req->drawable = drawable; UnlockDisplay(dpy); SyncHandle(); + + XSetErrorHandler(oldXErrorHandler); + TRACE("DestroyDrawable... return True"); return True; } From db248ffb840a0c113b6eb508a0fa1e74e752474d Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sun, 16 Mar 2008 18:46:11 +0100 Subject: [PATCH 082/183] test for the presence of pci_system_init_dev_mem() before calling it. This avoids creating a dependency on -current libpciaccess for BSD systems other than OpenBSD (which don't otherwise need it). --- configure.ac | 7 +++++++ hw/xfree86/os-support/bsd/i386_video.c | 2 ++ include/xorg-config.h.in | 3 +++ 3 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index 5417bbbda..49f2395fa 100644 --- a/configure.ac +++ b/configure.ac @@ -1308,6 +1308,13 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB" PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) + SAVE_LIBS=$LIBS + SAVE_CFLAGS=$CFLAGS + CFLAGS=$PCIACCESS_CFLAGS + LIBS=$PCIACCESS_LIBS + AC_CHECK_FUNCS([pci_system_init_dev_mem]) + LIBS=$SAVE_LIBS + CFLAGS=$SAVE_CFLAGS XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS" XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS" diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 7e4a4d2a3..1ebac678d 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -212,8 +212,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem) pVidMem->mapMem = mapVidMem; pVidMem->unmapMem = unmapVidMem; +#if HAVE_PCI_SYSTEM_INIT_DEV_MEM if (useDevMem) pci_system_init_dev_mem(devMemFd); +#endif #ifdef HAS_MTRR_SUPPORT if (useDevMem) { diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index 0603eab67..5587c0a8d 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -115,6 +115,9 @@ /* Have execinfo.h */ #undef HAVE_EXECINFO_H +/* Have pci_system_init_dev_mem() */ +#undef HAVE_PCI_SYSTEM_INIT_DEV_MEM + /* Path to text files containing PCI IDs */ #undef PCI_TXT_IDS_PATH From bee2ddf35f75086cee951142098637f2c756b96b Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 17 Mar 2008 08:33:01 -0700 Subject: [PATCH 083/183] Fail CRTC configuration if !vtSema Unless we check for vtSema before calling into the CRTC and output callbacks, we may end up trying to access video memory that no longer exists, leading to a crash. So if we don't have vtSema, return FALSE to the caller, indicating that we didn't do anything. Fixes #14444. --- hw/xfree86/modes/xf86RandR12.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 1dca223fe..4767f2671 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -743,6 +743,9 @@ xf86RandR12CrtcSet (ScreenPtr pScreen, xf86CrtcPtr *save_crtcs; Bool save_enabled = crtc->enabled; + if (!crtc->scrn->vtSema) + return FALSE; + save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr)); if ((randr_mode != NULL) != crtc->enabled) changed = TRUE; From ba85caacb565b9aa0aeace52a362350304b0566d Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 17 Mar 2008 14:13:09 -0700 Subject: [PATCH 084/183] Make xf86SetDesiredModes aware of current output configuration By adding a new output callback, ->get_crtc, xf86SetDesiredModes is able to avoid turning off outputs & CRTCs if the current output<->CRTC mappings are the same as the desired configuration. This helps avoid flickering displays at startup time, which speeds things up a little and looks better. --- hw/xfree86/modes/xf86Crtc.c | 87 +++++++++++++++++++++++++++++-------- hw/xfree86/modes/xf86Crtc.h | 7 +++ randr/randrstr.h | 1 + 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 6b845b7c9..536b53033 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -2033,6 +2033,72 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) return TRUE; } +/* + * Check the CRTC we're going to map each output to vs. it's current + * CRTC. If they don't match, we have to disable the output and the CRTC + * since the driver will have to re-route things. + */ +static void +xf86PrepareOutputs (ScrnInfoPtr scrn) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int o; + + for (o = 0; o < config->num_output; o++) { + xf86OutputPtr output = config->output[o]; +#if RANDR_GET_CRTC_INTERFACE + /* If we can't get the current CRTC, play it safe */ + if (!output->funcs->get_crtc) { + (*output->funcs->dpms)(output, DPMSModeOff); + continue; + } + /* Disable outputs that are unused or will be re-routed */ + if (output->crtc != (*output->funcs->get_crtc)(output) || + output->crtc == NULL) +#endif + (*output->funcs->dpms)(output, DPMSModeOff); + } +} + +static void +xf86PrepareCrtcs (ScrnInfoPtr scrn) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int c; + + for (c = 0; c < config->num_crtc; c++) { +#if RANDR_GET_CRTC_INTERFACE + xf86CrtcPtr crtc = config->crtc[c]; + xf86OutputPtr output = NULL; + uint32_t desired_outputs = 0, current_outputs = 0; + int o; + + for (o = 0; o < config->num_output; o++) { + output = config->output[o]; + if (output->crtc == crtc) + desired_outputs |= (1<funcs->get_crtc) { + desired_outputs = 0; + break; + } + if ((*output->funcs->get_crtc)(output) == crtc) + current_outputs |= (1<funcs->dpms)(crtc, DPMSModeOff); +#else + (*crtc->funcs->dpms)(crtc, DPMSModeOff); +#endif + } +} + /* * Using the desired mode information in each crtc, set * modes (used in EnterVT functions, or at server startup) @@ -2042,26 +2108,11 @@ _X_EXPORT Bool xf86SetDesiredModes (ScrnInfoPtr scrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); - int c, o; + int c; - /* - * Turn off everything so mode setting is done - * with hardware in a consistent state - */ - for (o = 0; o < config->num_output; o++) - { - xf86OutputPtr output = config->output[o]; - (*output->funcs->dpms)(output, DPMSModeOff); - } + xf86PrepareOutputs(scrn); + xf86PrepareCrtcs(scrn); - for (c = 0; c < config->num_crtc; c++) - { - xf86CrtcPtr crtc = config->crtc[c]; - - crtc->funcs->dpms(crtc, DPMSModeOff); - memset(&crtc->mode, 0, sizeof(crtc->mode)); - } - for (c = 0; c < config->num_crtc; c++) { xf86CrtcPtr crtc = config->crtc[c]; diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index a542e7f39..2d723a5cd 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -424,6 +424,13 @@ typedef struct _xf86OutputFuncs { Bool (*get_property)(xf86OutputPtr output, Atom property); +#endif +#ifdef RANDR_GET_CRTC_INTERFACE + /** + * Callback to get current CRTC for a given output + */ + xf86CrtcPtr + (*get_crtc)(xf86OutputPtr output); #endif /** * Clean up driver-specific bits of the output diff --git a/randr/randrstr.h b/randr/randrstr.h index 4d7c9ccfc..62d4bbf46 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -55,6 +55,7 @@ #define RANDR_10_INTERFACE 1 #define RANDR_12_INTERFACE 1 #define RANDR_13_INTERFACE 1 /* requires RANDR_12_INTERFACE */ +#define RANDR_GET_CRTC_INTERFACE 1 #define RANDR_INTERFACE_VERSION 0x0103 From afd7428690d87097117ab20335658f6d59d60103 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 17 Mar 2008 14:55:44 -0700 Subject: [PATCH 085/183] Cleanup logic in xf86PrepareOutputs Should have done this in the first place. Since we're checking for the absence of the get_crtc callback in the first place, we'll short circuit the later call and disable the output, so the ugly "continue" block is unnecesary. --- hw/xfree86/modes/xf86Crtc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 536b53033..8c2b24786 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -2047,13 +2047,9 @@ xf86PrepareOutputs (ScrnInfoPtr scrn) for (o = 0; o < config->num_output; o++) { xf86OutputPtr output = config->output[o]; #if RANDR_GET_CRTC_INTERFACE - /* If we can't get the current CRTC, play it safe */ - if (!output->funcs->get_crtc) { - (*output->funcs->dpms)(output, DPMSModeOff); - continue; - } /* Disable outputs that are unused or will be re-routed */ - if (output->crtc != (*output->funcs->get_crtc)(output) || + if (!output->funcs->get_crtc || + output->crtc != (*output->funcs->get_crtc)(output) || output->crtc == NULL) #endif (*output->funcs->dpms)(output, DPMSModeOff); From cdadd2ff9bade318caac5c1d9bcdc8a001347da9 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Tue, 18 Mar 2008 14:00:15 +0100 Subject: [PATCH 086/183] [Xephyr/DRI] correctly route motion events targeted at GL drawable --- hw/kdrive/ephyr/ephyr.c | 34 ++++++++++++++++++++++++++++------ hw/kdrive/ephyr/hostx.c | 3 ++- hw/kdrive/ephyr/hostx.h | 1 + 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index e95001dcd..b02f9903c 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -891,9 +891,12 @@ ephyrPoll(void) continue; } { - if (ephyrCurScreen != ev.data.mouse_motion.screen) + if (ev.data.mouse_motion.screen >=0 + && (ephyrCurScreen != ev.data.mouse_motion.screen)) { - EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ; + EPHYR_LOG ("warping mouse cursor. " + "cur_screen%d, motion_screen:%d\n", + ephyrCurScreen, ev.data.mouse_motion.screen) ; if (ev.data.mouse_motion.screen >= 0) { ephyrWarpCursor @@ -904,11 +907,30 @@ ephyrPoll(void) } else { + int x=0, y=0; +#ifdef XEPHYR_DRI + EphyrWindowPair *pair = NULL; +#endif EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ; - KdEnqueuePointerEvent(ephyrMouse, mouseState, - ev.data.mouse_motion.x, - ev.data.mouse_motion.y, - 0); + x = ev.data.mouse_motion.x; + y = ev.data.mouse_motion.y; + EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ; +#ifdef XEPHYR_DRI + EPHYR_LOG ("is this window peered by a gl drawable ?\n") ; + if (findWindowPairFromRemote (ev.data.mouse_motion.window, + &pair)) + { + EPHYR_LOG ("yes, it is peered\n") ; + x += pair->local->drawable.x; + y += pair->local->drawable.y; + } + else + { + EPHYR_LOG ("no, it is not peered\n") ; + } + EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ; +#endif + KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0); } } break; diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index ae1bb4bf9..fd84ec0ef 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -914,8 +914,9 @@ hostx_get_event(EphyrHostXEvent *ev) host_screen_from_window (xev.xmotion.window); ev->type = EPHYR_EV_MOUSE_MOTION; - ev->data.mouse_motion.x = xev.xmotion.x; + ev->data.mouse_motion.x = xev.xmotion.x; ev->data.mouse_motion.y = xev.xmotion.y; + ev->data.mouse_motion.window = xev.xmotion.window; ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1); } return 1; diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h index f72cfe700..48d314748 100644 --- a/hw/kdrive/ephyr/hostx.h +++ b/hw/kdrive/ephyr/hostx.h @@ -70,6 +70,7 @@ struct EphyrHostXEvent int x; int y; int screen; + int window; } mouse_motion; struct mouse_down { From edad0a9dfebcce5c54b2f9c32bd9d45549e20c51 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Tue, 18 Mar 2008 17:51:21 -0400 Subject: [PATCH 087/183] Apply __glXDisp_GetVisualConfigs message patch From http://bugs.freedesktop.org/show_bug.cgi?id=13863 Problem was that the glxcmds.c __glXDisp_GetVisualConfigs function left garbage in the tail end of the message used for extensions. --- GL/glx/glxcmds.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index 32d1bc834..3b79cca20 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -944,6 +944,12 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) buf[p++] = modes->transparentAlpha; buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; buf[p++] = modes->transparentIndex; + buf[p++] = 0; + buf[p++] = 0; + buf[p++] = 0; + buf[p++] = 0; + buf[p++] = 0; + buf[p++] = 0; if (client->swapped) { __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); From f37046984d7839faefa4d716624e4a85ddde9634 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 19 Mar 2008 14:06:53 -0700 Subject: [PATCH 088/183] Xevie cleanups, byteswapping fixes & request length check fixes --- Xext/xevie.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/Xext/xevie.c b/Xext/xevie.c index ea409f104..f36ead478 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -147,8 +147,6 @@ XevieExtensionInit (void) ReqCode = (unsigned char)extEntry->base; ErrorBase = extEntry->errorBase; } - - /* PC servers initialize the desktop colors (citems) here! */ } /*ARGSUSED*/ @@ -218,6 +216,8 @@ int ProcEnd (register ClientPtr client) { xXevieEndReply rep; + REQUEST_SIZE_MATCH (xXevieEndReq); + if (xevieFlag) { if (client->index != xevieClientIndex) return BadAccess; @@ -240,6 +240,8 @@ int ProcSend (register ClientPtr client) xEvent *xE; static unsigned char lastDetail = 0, lastType = 0; + REQUEST_SIZE_MATCH (xXevieSendReq); + if (client->index != xevieClientIndex) return BadAccess; @@ -284,10 +286,12 @@ int ProcSelectInput (register ClientPtr client) REQUEST (xXevieSelectInputReq); xXevieSelectInputReply rep; + REQUEST_SIZE_MATCH (xXevieSelectInputReq); + if (client->index != xevieClientIndex) return BadAccess; - xevieMask = (long)stuff->event_mask; + xevieMask = stuff->event_mask; rep.type = X_Reply; rep.sequence_number = client->sequence; WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep); @@ -321,7 +325,10 @@ int SProcQueryVersion (register ClientPtr client) register int n; REQUEST(xXevieQueryVersionReq); - swaps(&stuff->length, n); + swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXevieQueryVersionReq); + swaps (&stuff->client_major_version, n); + swaps (&stuff->client_minor_version, n); return ProcQueryVersion(client); } @@ -332,8 +339,8 @@ int SProcStart (ClientPtr client) REQUEST (xXevieStartReq); swaps (&stuff->length, n); + REQUEST_SIZE_MATCH (xXevieStartReq); swapl (&stuff->screen, n); - REQUEST_AT_LEAST_SIZE (xXevieStartReq); return ProcStart (client); } @@ -344,8 +351,8 @@ int SProcEnd (ClientPtr client) REQUEST (xXevieEndReq); swaps (&stuff->length, n); - REQUEST_AT_LEAST_SIZE (xXevieEndReq); - swapl(&stuff->cmap, n); + REQUEST_SIZE_MATCH (xXevieEndReq); + swapl (&stuff->cmap, n); return ProcEnd (client); } @@ -353,11 +360,21 @@ static int SProcSend (ClientPtr client) { register int n; + xEvent eventT; + EventSwapPtr proc; REQUEST (xXevieSendReq); swaps (&stuff->length, n); - REQUEST_AT_LEAST_SIZE (xXevieSendReq); - swapl(&stuff->event, n); + REQUEST_SIZE_MATCH (xXevieSendReq); + swapl (&stuff->dataType, n); + + /* Swap event */ + proc = EventSwapVector[stuff->event.u.u.type & 0177]; + if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ + return (BadValue); + (*proc)(&stuff->event, &eventT); + stuff->event = eventT; + return ProcSend (client); } @@ -368,8 +385,8 @@ int SProcSelectInput (ClientPtr client) REQUEST (xXevieSelectInputReq); swaps (&stuff->length, n); - REQUEST_AT_LEAST_SIZE (xXevieSelectInputReq); - swapl(&stuff->event_mask, n); + REQUEST_SIZE_MATCH (xXevieSelectInputReq); + swapl (&stuff->event_mask, n); return ProcSelectInput (client); } From 060a99444ee25a684b0ab9b4819bf8e855aea2d8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 19 Mar 2008 16:04:16 -0700 Subject: [PATCH 089/183] Make Xevie private symbol names less generic Makes it easier to figure out what you're seeing in the stack trace instead of wondering where in the server "ProcSend" is. --- Xext/xevie.c | 83 +++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/Xext/xevie.c b/Xext/xevie.c index f36ead478..5e20bd91c 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -63,11 +63,13 @@ extern Bool noXkbExtension; #endif extern int xeviegrabState; -static int ProcDispatch (register ClientPtr client), SProcDispatch (register ClientPtr client); -static void ResetProc (ExtensionEntry *extEntry); +static DISPATCH_PROC(ProcXevieDispatch); +static DISPATCH_PROC(SProcXevieDispatch); -static unsigned char ReqCode = 0; -static int ErrorBase; +static void XevieResetProc (ExtensionEntry *extEntry); + +static unsigned char XevieReqCode = 0; +static int XevieErrorBase; int xevieFlag = 0; int xevieClientIndex = 0; @@ -77,7 +79,7 @@ Mask xevieMask = 0; int xevieEventSent = 0; int xevieKBEventSent = 0; static DevPrivateKey xevieDevicePrivateKey = &xevieDevicePrivateKey; -static Bool xevieModifiersOn = FALSE; +static Bool xevieModifiersOn = FALSE; #define XEVIEINFO(dev) ((xevieDeviceInfoPtr) \ dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey)) @@ -108,11 +110,6 @@ typedef struct { static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}}; static int keycqHead = 0, keycqTail = 0; -static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr); -static void ResetProc (ExtensionEntry*); - -static int ErrorBase; - static Bool XevieStart(void); static void XevieEnd(int clientIndex); static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata, @@ -140,23 +137,23 @@ XevieExtensionInit (void) if ((extEntry = AddExtension (XEVIENAME, 0, XevieNumberErrors, - ProcDispatch, - SProcDispatch, - ResetProc, + ProcXevieDispatch, + SProcXevieDispatch, + XevieResetProc, StandardMinorOpcode))) { - ReqCode = (unsigned char)extEntry->base; - ErrorBase = extEntry->errorBase; + XevieReqCode = (unsigned char)extEntry->base; + XevieErrorBase = extEntry->errorBase; } } /*ARGSUSED*/ static -void ResetProc (ExtensionEntry *extEntry) +void XevieResetProc (ExtensionEntry *extEntry) { } static -int ProcQueryVersion (register ClientPtr client) +int ProcXevieQueryVersion (register ClientPtr client) { xXevieQueryVersionReply rep; @@ -171,7 +168,7 @@ int ProcQueryVersion (register ClientPtr client) } static -int ProcStart (register ClientPtr client) +int ProcXevieStart (register ClientPtr client) { xXevieStartReply rep; @@ -212,7 +209,7 @@ int ProcStart (register ClientPtr client) } static -int ProcEnd (register ClientPtr client) +int ProcXevieEnd (register ClientPtr client) { xXevieEndReply rep; @@ -233,7 +230,7 @@ int ProcEnd (register ClientPtr client) } static -int ProcSend (register ClientPtr client) +int ProcXevieSend (register ClientPtr client) { REQUEST (xXevieSendReq); xXevieSendReply rep; @@ -281,7 +278,7 @@ int ProcSend (register ClientPtr client) } static -int ProcSelectInput (register ClientPtr client) +int ProcXevieSelectInput (register ClientPtr client) { REQUEST (xXevieSelectInputReq); xXevieSelectInputReply rep; @@ -299,28 +296,28 @@ int ProcSelectInput (register ClientPtr client) } static -int ProcDispatch (register ClientPtr client) +int ProcXevieDispatch (register ClientPtr client) { REQUEST (xReq); switch (stuff->data) { case X_XevieQueryVersion: - return ProcQueryVersion (client); + return ProcXevieQueryVersion (client); case X_XevieStart: - return ProcStart (client); + return ProcXevieStart (client); case X_XevieEnd: - return ProcEnd (client); + return ProcXevieEnd (client); case X_XevieSend: - return ProcSend (client); + return ProcXevieSend (client); case X_XevieSelectInput: - return ProcSelectInput(client); + return ProcXevieSelectInput(client); default: return BadRequest; } } static -int SProcQueryVersion (register ClientPtr client) +int SProcXevieQueryVersion (register ClientPtr client) { register int n; @@ -329,11 +326,11 @@ int SProcQueryVersion (register ClientPtr client) REQUEST_SIZE_MATCH (xXevieQueryVersionReq); swaps (&stuff->client_major_version, n); swaps (&stuff->client_minor_version, n); - return ProcQueryVersion(client); + return ProcXevieQueryVersion(client); } static -int SProcStart (ClientPtr client) +int SProcXevieStart (ClientPtr client) { register int n; @@ -341,11 +338,11 @@ int SProcStart (ClientPtr client) swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXevieStartReq); swapl (&stuff->screen, n); - return ProcStart (client); + return ProcXevieStart (client); } static -int SProcEnd (ClientPtr client) +int SProcXevieEnd (ClientPtr client) { register int n; @@ -353,11 +350,11 @@ int SProcEnd (ClientPtr client) swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXevieEndReq); swapl (&stuff->cmap, n); - return ProcEnd (client); + return ProcXevieEnd (client); } static -int SProcSend (ClientPtr client) +int SProcXevieSend (ClientPtr client) { register int n; xEvent eventT; @@ -375,11 +372,11 @@ int SProcSend (ClientPtr client) (*proc)(&stuff->event, &eventT); stuff->event = eventT; - return ProcSend (client); + return ProcXevieSend (client); } static -int SProcSelectInput (ClientPtr client) +int SProcXevieSelectInput (ClientPtr client) { register int n; @@ -387,26 +384,26 @@ int SProcSelectInput (ClientPtr client) swaps (&stuff->length, n); REQUEST_SIZE_MATCH (xXevieSelectInputReq); swapl (&stuff->event_mask, n); - return ProcSelectInput (client); + return ProcXevieSelectInput (client); } static -int SProcDispatch (register ClientPtr client) +int SProcXevieDispatch (register ClientPtr client) { REQUEST(xReq); switch (stuff->data) { case X_XevieQueryVersion: - return SProcQueryVersion (client); + return SProcXevieQueryVersion (client); case X_XevieStart: - return SProcStart (client); + return SProcXevieStart (client); case X_XevieEnd: - return SProcEnd (client); + return SProcXevieEnd (client); case X_XevieSend: - return SProcSend (client); + return SProcXevieSend (client); case X_XevieSelectInput: - return SProcSelectInput(client); + return SProcXevieSelectInput(client); default: return BadRequest; } From 267352579612155adfd4743432d6569b2cdeebde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 19 Mar 2008 19:12:37 -0400 Subject: [PATCH 090/183] Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB See bug 11796 --- hw/xfree86/modes/xf86Cursors.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 08cf78d82..4fe94f3c6 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -137,7 +137,9 @@ cursor_bitpos (int flags, int x, Bool mask) mask = !mask; if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) x = (x & ~3) | (3 - (x & 3)); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) +#endif x = (x & ~7) | (7 - (x & 7)); if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1) x = (x << 1) + mask; From f8c1eb29e28818895d744c4e1d6897353d51790b Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 20 Mar 2008 09:14:41 -0400 Subject: [PATCH 091/183] Revert "Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB" This reverts commit 267352579612155adfd4743432d6569b2cdeebde. Pushed the wrong patch. --- hw/xfree86/modes/xf86Cursors.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 4fe94f3c6..08cf78d82 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -137,9 +137,7 @@ cursor_bitpos (int flags, int x, Bool mask) mask = !mask; if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) x = (x & ~3) | (3 - (x & 3)); -#if X_BYTE_ORDER == X_LITTLE_ENDIAN if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) -#endif x = (x & ~7) | (7 - (x & 7)); if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1) x = (x << 1) + mask; From da973e962d09854b571320dee7dd9569060bc39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 20 Mar 2008 09:18:29 -0400 Subject: [PATCH 092/183] Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB This patch (and not setting HARDWARE_CURSOR_BIT_ORDER_MSBFIRST on big endian platforms) fixes it for me with the radeon driver and doesn't break intel. Correct patch this time :) --- hw/xfree86/modes/xf86Cursors.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 08cf78d82..57cfcb65a 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -137,7 +137,8 @@ cursor_bitpos (int flags, int x, Bool mask) mask = !mask; if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) x = (x & ~3) | (3 - (x & 3)); - if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) + if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) == + (X_BYTE_ORDER == X_BIG_ENDIAN)) x = (x & ~7) | (7 - (x & 7)); if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1) x = (x << 1) + mask; From e323bb426ce8a072d119cb2720b773241259c137 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 20 Mar 2008 19:42:09 -0400 Subject: [PATCH 093/183] XSELinux: Correctly handle some permission bits that are used more than once. --- Xext/xselinux.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 18c652645..303589860 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -152,6 +152,12 @@ static struct security_class_mapping map[] = { { NULL } }; +/* x_resource "read" bits from the list above */ +#define SELinuxReadMask (DixReadAccess|DixGetAttrAccess|DixListPropAccess| \ + DixGetPropAccess|DixGetFocusAccess|DixListAccess| \ + DixShowAccess|DixBlendAccess|DixReceiveAccess| \ + DixUseAccess|DixDebugAccess) + /* forward declarations */ static void SELinuxScreen(CallbackListPtr *, pointer, pointer); @@ -853,6 +859,7 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) SELinuxObjectRec *obj, *data; Selection *pSel = *rec->ppSel; Atom name = pSel->selection; + Mask access_mode = rec->access_mode; SELinuxAuditRec auditdata = { .client = rec->client, .selection = name }; security_id_t tsid; int rc; @@ -861,11 +868,12 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) obj = dixLookupPrivate(&pSel->devPrivates, objectKey); /* If this is a new object that needs labeling, do it now */ - if (rec->access_mode & DixCreateAccess) { + if (access_mode & DixCreateAccess) { sidput(obj->sid); rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly); if (rc != Success) obj->sid = unlabeled_sid; + access_mode = DixSetAttrAccess; } /* If this is a polyinstantiated object, find the right instance */ else if (obj->poly) { @@ -890,13 +898,13 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) } /* Perform the security check */ - rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SELECTION, rec->access_mode, + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SELECTION, access_mode, &auditdata); if (rc != Success) rec->status = rc; /* Label the content (advisory only) */ - if (rec->access_mode & DixSetAttrAccess) { + if (access_mode & DixSetAttrAccess) { data = dixLookupPrivate(&pSel->devPrivates, dataKey); sidput(data->sid); if (subj->sel_create_sid) @@ -976,6 +984,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) SELinuxSubjectRec *subj; SELinuxObjectRec *obj; SELinuxAuditRec auditdata = { .client = rec->client }; + Mask access_mode = rec->access_mode; PrivateRec **privatePtr; security_class_t class; int rc, offset; @@ -997,7 +1006,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) } /* If this is a new object that needs labeling, do it now */ - if (rec->access_mode & DixCreateAccess && offset >= 0) { + if (access_mode & DixCreateAccess && offset >= 0) { rc = SELinuxLabelResource(rec, subj, obj, class); if (rc != Success) { rec->status = rc; @@ -1005,10 +1014,16 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) } } + /* Collapse generic resource permissions down to read/write */ + if (class == SECCLASS_X_RESOURCE) { + access_mode = !!(rec->access_mode & SELinuxReadMask); /* rd */ + access_mode |= !!(rec->access_mode & ~SELinuxReadMask) << 1; /* wr */ + } + /* Perform the security check */ auditdata.restype = rec->rtype; auditdata.id = rec->id; - rc = SELinuxDoCheck(subj, obj, class, rec->access_mode, &auditdata); + rc = SELinuxDoCheck(subj, obj, class, access_mode, &auditdata); if (rc != Success) rec->status = rc; } From 3bbd77ff98478153afe3251de9ba11d757218213 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Thu, 20 Mar 2008 20:03:02 -0400 Subject: [PATCH 094/183] XSELinux: Do a check for whether background "None" is allowed. --- Xext/xselinux.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 303589860..17ce7af10 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -1026,6 +1026,13 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) rc = SELinuxDoCheck(subj, obj, class, access_mode, &auditdata); if (rc != Success) rec->status = rc; + + /* Perform the background none check on windows */ + if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) { + rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata); + if (rc != Success) + ((WindowPtr)rec->res)->forcedBG = TRUE; + } } static void From 87c64cfd6901083da5a9375d0bde65691d374b5b Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 14 Mar 2008 17:31:54 -0700 Subject: [PATCH 095/183] =?UTF-8?q?=3D=3Futf-8=3Fq=3FApple:=3D20Xserver=3D?= =?UTF-8?q?20half=3D20of=3D20the=3D20Expos=3DC3=3DA9=3D20bug-fix=3D20(requ?= =?UTF-8?q?ires=3D20updated=3D20libXplugin=3D20from=3D20Apple...=3D20comin?= =?UTF-8?q?g=3D20with=3D202.2)?= =20(cherry=20picked=20from=20commit=2037be23e8c1d8e5c7a1157e9d66ef3f30a4c472c5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit --- hw/xquartz/X11Application.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index be5511d30..1cf992d92 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -320,6 +320,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) { SetFrontProcess(&psn); QuartzMessageServerThread(kXDarwinBringAllToFront, 0); + ProcessSerialNumber psn = { 0, kCurrentProcess }; + SetFrontProcess(&psn); } - (void) set_can_quit:(NSNumber *)state { From 4c76607b699431183ee7e88fa7818cb7644a5a02 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Mon, 17 Mar 2008 23:57:41 -0700 Subject: [PATCH 096/183] Rootless: Removed safeAlphaXXXX() in favor of using fb/pixman (cherry picked from commit f03202ad15457c98be7ca78cc59bac88cf5f1966) --- configure.ac | 1 - hw/xquartz/xpr/Makefile.am | 4 +- hw/xquartz/xpr/xprScreen.c | 10 - miext/rootless/Makefile.am | 2 +- miext/rootless/safeAlpha/Makefile.am | 7 - miext/rootless/safeAlpha/safeAlpha.h | 42 ---- miext/rootless/safeAlpha/safeAlphaPicture.c | 211 -------------------- 7 files changed, 2 insertions(+), 275 deletions(-) delete mode 100644 miext/rootless/safeAlpha/Makefile.am delete mode 100644 miext/rootless/safeAlpha/safeAlpha.h delete mode 100644 miext/rootless/safeAlpha/safeAlphaPicture.c diff --git a/configure.ac b/configure.ac index 49f2395fa..3b007051c 100644 --- a/configure.ac +++ b/configure.ac @@ -2120,7 +2120,6 @@ miext/damage/Makefile miext/shadow/Makefile miext/cw/Makefile miext/rootless/Makefile -miext/rootless/safeAlpha/Makefile miext/rootless/accel/Makefile os/Makefile randr/Makefile diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am index ae1b19297..b4d67c7b7 100644 --- a/hw/xquartz/xpr/Makefile.am +++ b/hw/xquartz/xpr/Makefile.am @@ -4,8 +4,7 @@ AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) AM_CPPFLAGS = \ -I$(srcdir) -I$(srcdir)/.. \ -I$(top_srcdir)/miext \ - -I$(top_srcdir)/miext/rootless \ - -I$(top_srcdir)/miext/rootless/safeAlpha + -I$(top_srcdir)/miext/rootless Xquartz_SOURCES = \ appledri.c \ @@ -41,7 +40,6 @@ Xquartz_LDADD = \ $(top_builddir)/record/librecord.la \ $(top_builddir)/XTrap/libxtrap.la \ $(top_builddir)/miext/rootless/librootless.la \ - $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \ $(top_builddir)/miext/rootless/accel/librlAccel.la \ $(DARWIN_LIBS) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) -lXplugin diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index e4e1fda7e..db36403df 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -37,7 +37,6 @@ #include "pseudoramiX.h" #include "darwin.h" #include "rootless.h" -#include "safeAlpha/safeAlpha.h" #include "dri.h" #include "globals.h" #include "Xplugin.h" @@ -341,15 +340,6 @@ xprAddScreen(int index, ScreenPtr pScreen) static Bool xprSetupScreen(int index, ScreenPtr pScreen) { - // Add alpha protecting replacements for fb screen functions - -#ifdef RENDER - { - PictureScreenPtr ps = GetPictureScreen(pScreen); - ps->Composite = SafeAlphaComposite; - } -#endif /* RENDER */ - // Initialize accelerated rootless drawing // Note that this must be done before DamageSetup(). RootlessAccelInit(pScreen); diff --git a/miext/rootless/Makefile.am b/miext/rootless/Makefile.am index aa8528e6a..dc851702f 100644 --- a/miext/rootless/Makefile.am +++ b/miext/rootless/Makefile.am @@ -1,7 +1,7 @@ AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS) AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support -SUBDIRS = safeAlpha accel +SUBDIRS = accel noinst_LTLIBRARIES = librootless.la librootless_la_SOURCES = \ diff --git a/miext/rootless/safeAlpha/Makefile.am b/miext/rootless/safeAlpha/Makefile.am deleted file mode 100644 index a22afb6a2..000000000 --- a/miext/rootless/safeAlpha/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS) -AM_CPPFLAGS = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support - -noinst_LTLIBRARIES = libsafeAlpha.la -libsafeAlpha_la_SOURCES = safeAlphaPicture.c - -EXTRA_DIST = safeAlpha.h diff --git a/miext/rootless/safeAlpha/safeAlpha.h b/miext/rootless/safeAlpha/safeAlpha.h deleted file mode 100644 index 9b9b39c92..000000000 --- a/miext/rootless/safeAlpha/safeAlpha.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Replacement functions to protect the alpha channel - */ -/* - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE 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 _SAFEALPHA_H -#define _SAFEALPHA_H - -#include "picturestr.h" - -#ifdef RENDER -void -SafeAlphaComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); -#endif /* RENDER */ - -#endif /* _SAFEALPHA_H */ diff --git a/miext/rootless/safeAlpha/safeAlphaPicture.c b/miext/rootless/safeAlpha/safeAlphaPicture.c deleted file mode 100644 index 8f6631531..000000000 --- a/miext/rootless/safeAlpha/safeAlphaPicture.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Support for RENDER extension while protecting the alpha channel - */ -/* - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. - * Copyright (c) 2002 Apple Computer, Inc. All Rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE 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. - */ -/* This file is largely based on fbcompose.c and fbpict.c, which contain - * the following copyright: - * - * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. - */ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif -#ifdef RENDER - -#include /* For NULL */ -#include "fb.h" -#include "picturestr.h" -#include "mipict.h" -#include "fbpict.h" -#include "safeAlpha.h" -#include "rootlessCommon.h" -# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) - -/* Optimized version of fbCompositeSolidMask_nx8x8888 */ -void -SafeAlphaCompositeSolidMask_nx8x8888( - CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - CARD32 src, srca; - CARD32 *dstLine, *dst, d, dstMask; - CARD8 *maskLine, *mask, m; - FbStride dstStride, maskStride; - CARD16 w; - - fbComposeGetSolid(pSrc, src, pDst->format); - - dstMask = FbFullMask (pDst->pDrawable->depth); - srca = src >> 24; - if (src == 0) - return; - - fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); - fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); - - if (dstMask == FB_ALLONES && pDst->pDrawable->bitsPerPixel == 32 && - width * height > rootless_CompositePixels_threshold && - SCREENREC(pDst->pDrawable->pScreen)->imp->CompositePixels) - { - void *srcp[2], *destp[2]; - unsigned int dest_rowbytes[2]; - unsigned int fn; - - srcp[0] = &src; srcp[1] = &src; - /* null rowbytes pointer means use first value as a constant */ - destp[0] = dstLine; destp[1] = dstLine; - dest_rowbytes[0] = dstStride * 4; dest_rowbytes[1] = dest_rowbytes[0]; - fn = RL_COMPOSITE_FUNCTION(RL_COMPOSITE_OVER, RL_DEPTH_ARGB8888, - RL_DEPTH_A8, RL_DEPTH_ARGB8888); - - if (SCREENREC(pDst->pDrawable->pScreen)->imp->CompositePixels( - width, height, fn, srcp, NULL, - maskLine, maskStride, - destp, dest_rowbytes) == Success) - { - return; - } - } - - while (height--) - { - dst = dstLine; - dstLine += dstStride; - mask = maskLine; - maskLine += maskStride; - w = width; - - while (w--) - { - m = *mask++; - if (m == 0xff) - { - if (srca == 0xff) - *dst = src & dstMask; - else - *dst = fbOver (src, *dst) & dstMask; - } - else if (m) - { - d = fbIn (src, m); - *dst = fbOver (d, *dst) & dstMask; - } - dst++; - } - } -} - -void -SafeAlphaComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - if (!pSrc) { - ErrorF("SafeAlphaComposite: pSrc must not be null!\n"); - return; - } - - if (!pDst) { - ErrorF("SafeAlphaComposite: pDst must not be null!\n"); - return; - } - - int oldDepth = pDst->pDrawable->depth; - int oldFormat = pDst->format; - - /* - * We can use the more optimized fbpict code, but it sets bits above - * the depth to zero. Temporarily adjust destination depth if needed. - */ - if (pDst->pDrawable->type == DRAWABLE_WINDOW - && pDst->pDrawable->depth == 24 - && pDst->pDrawable->bitsPerPixel == 32) - { - pDst->pDrawable->depth = 32; - } - - /* For rootless preserve the alpha in x8r8g8b8 which really is - * a8r8g8b8 - */ - if (oldFormat == PICT_x8r8g8b8) - { - pDst->format = PICT_a8r8g8b8; - } - - if (pSrc->pDrawable && pMask && pMask->pDrawable && - !pSrc->transform && !pMask->transform && - !pSrc->alphaMap && !pMask->alphaMap && - !pMask->repeat && !pMask->componentAlpha && !pDst->alphaMap && - pMask->format == PICT_a8 && - pSrc->repeatType == RepeatNormal && - pSrc->pDrawable->width == 1 && - pSrc->pDrawable->height == 1 && - (pDst->format == PICT_a8r8g8b8 || - pDst->format == PICT_x8r8g8b8 || - pDst->format == PICT_a8b8g8r8 || - pDst->format == PICT_x8b8g8r8)) - { - fbWalkCompositeRegion (op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height, - TRUE /* srcRepeat */, - FALSE /* maskRepeat */, - SafeAlphaCompositeSolidMask_nx8x8888); - } - else - { - fbComposite (op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); - } - - pDst->pDrawable->depth = oldDepth; - pDst->format = oldFormat; -} - -#endif /* RENDER */ From c49e11268322712c211f29d51d664d3f8a59b00b Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 21 Mar 2008 18:07:38 -0700 Subject: [PATCH 097/183] XQuartz: Initial framework for dealing with spaces on OS-X (cherry picked from commit 9831324998f9d1f05ff944c58c5bf60dcae17355) --- hw/xquartz/darwin.h | 3 ++- hw/xquartz/quartz.c | 14 +++++++++++++- hw/xquartz/xpr/xprScreen.c | 11 ++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index c5e2ed80d..325122dfd 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -106,6 +106,7 @@ enum { kXDarwinBringAllToFront, // bring all X windows to front kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode kXDarwinSetRootless, // Set rootless mode + kXDarwinSpaceChanged, // Spaces changed /* * AppleWM events */ @@ -116,7 +117,7 @@ enum { */ kXDarwinDisplayChanged, // display configuration has changed kXDarwinWindowState, // window visibility state has changed - kXDarwinWindowMoved // window has moved on screen + kXDarwinWindowMoved, // window has moved on screen }; #define ENABLE_DEBUG_LOG 1 diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 6f42c538f..a034c9fac 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -266,7 +266,7 @@ static void QuartzUpdateScreens(void) #ifndef FAKE_RANDR if(!QuartzRandRInit(pScreen)) - FatalError("Failed to init RandR extension.\n"); + FatalError("Failed to init RandR extension.\n"); #endif DarwinAdjustScreenOrigins(&screenInfo); @@ -364,6 +364,14 @@ static void QuartzSetRootClip( } } +/* + * QuartzSpaceChanged + * Unmap offscreen windows, map onscreen windows + */ +static void QuartzSpaceChanged(uint32_t space_id) { + /* Do something special here, so we don't depend on quartz-wm for spaces to work... */ + DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id); +} /* * QuartzMessageServerThread @@ -494,6 +502,10 @@ void QuartzProcessEvent(xEvent *xe) { RootlessOrderAllWindows(); break; + case kXDarwinSpaceChanged: + DEBUG_LOG("kXDarwinSpaceChanged\n"); + QuartzSpaceChanged(xe->u.clientMessage.u.l.longs0); + break; default: ErrorF("Unknown application defined event type %d.\n", xe->u.u.type); } diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index db36403df..4dc5846d5 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -63,6 +63,7 @@ static const char *xprOpenGLBundle = "glxCGL.bundle"; */ static void eventHandler(unsigned int type, const void *arg, unsigned int arg_size, void *data) { + switch (type) { case XP_EVENT_DISPLAY_CHANGED: DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); @@ -105,6 +106,13 @@ static void eventHandler(unsigned int type, const void *arg, DRISurfaceNotify(*(xp_surface_id *) arg, kind); } break; + case XP_EVENT_SPACE_CHANGED: + ErrorF("XP_EVENT_SPACE_CHANGED\n"); + if(arg_size == sizeof(uint32_t)) { + uint32_t space_id = *(uint32_t *)arg; + QuartzMessageServerThread(kXDarwinSpaceChanged, 1, space_id); + } + break; default: ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); } @@ -233,7 +241,8 @@ xprDisplayInit(void) | XP_EVENT_WINDOW_STATE_CHANGED | XP_EVENT_WINDOW_MOVED | XP_EVENT_SURFACE_CHANGED - | XP_EVENT_SURFACE_DESTROYED, + | XP_EVENT_SURFACE_DESTROYED + | XP_EVENT_SPACE_CHANGED, eventHandler, NULL); AppleDRIExtensionInit(); From 93daa3a3bf1a981757024847882ce92b6bdaae83 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 21 Mar 2008 19:11:59 -0700 Subject: [PATCH 098/183] Xquartz: Added separate preference tab for quartz-wm settings Added FFM and "Focus on new window" options (cherry picked from commit 6841d078b7cb0b0db3db948d26b4d5ec7747deb8) --- hw/xquartz/X11Application.h | 4 +- hw/xquartz/X11Controller.h | 2 + hw/xquartz/X11Controller.m | 40 +- .../English.lproj/main.nib/designable.nib | 508 +++++++++++++----- .../English.lproj/main.nib/keyedobjects.nib | Bin 35571 -> 37953 bytes hw/xquartz/quartzCommon.h | 14 +- hw/xquartz/quartzForeground.c | 2 +- 7 files changed, 410 insertions(+), 160 deletions(-) diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h index 86da67f2e..ea9a6b758 100644 --- a/hw/xquartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -98,6 +98,8 @@ extern int quartzHasRoot, quartzEnableRootless; #define PREFS_XP_OPTIONS "xp_options" #define PREFS_ENABLE_STEREO "enable_stereo" #define PREFS_LOGIN_SHELL "login_shell" -#define PREFS_QUARTZ_WM_CLICK_THROUGH "wm_click_through" +#define PREFS_CLICK_THROUGH "wm_click_through" +#define PREFS_FFM "wm_ffm" +#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window" #endif /* X11APPLICATION_H */ diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h index 64d5cd1ce..8d6a38ff0 100644 --- a/hw/xquartz/X11Controller.h +++ b/hw/xquartz/X11Controller.h @@ -45,6 +45,8 @@ IBOutlet NSButton *enable_keyequivs; IBOutlet NSButton *sync_keymap; IBOutlet NSButton *click_through; + IBOutlet NSButton *focus_follows_mouse; + IBOutlet NSButton *focus_on_new_window; IBOutlet NSButton *enable_auth; IBOutlet NSButton *enable_tcp; IBOutlet NSPopUpButton *depth; diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 5111eafc3..3880b3f38 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -609,24 +609,28 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)prefs_changed:sender { - darwinFakeButtons = [fake_buttons intValue]; - quartzUseSysBeep = [use_sysbeep intValue]; - X11EnableKeyEquivalents = [enable_keyequivs intValue]; - darwinSyncKeymap = [sync_keymap intValue]; - - /* after adding prefs here, also add to [X11Application read_defaults] + darwinFakeButtons = [fake_buttons intValue]; + quartzUseSysBeep = [use_sysbeep intValue]; + X11EnableKeyEquivalents = [enable_keyequivs intValue]; + darwinSyncKeymap = [sync_keymap intValue]; + + /* after adding prefs here, also add to [X11Application read_defaults] and below */ - [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons]; - [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep]; - [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents]; - [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap]; - [NSApp prefs_set_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH value:[click_through intValue]]; - [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]]; - [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; - [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; + [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons]; + [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep]; + [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents]; + [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap]; + [NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]]; + [NSApp prefs_set_boolean:@PREFS_FFM value:[focus_follows_mouse intValue]]; + [NSApp prefs_set_boolean:@PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window intValue]]; + [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]]; + [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; + [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; + + system("killall -HUP quartz-wm"); - [NSApp prefs_synchronize]; + [NSApp prefs_synchronize]; } - (IBAction) prefs_show:sender @@ -636,8 +640,10 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [enable_keyequivs setIntValue:X11EnableKeyEquivalents]; [sync_keymap setIntValue:darwinSyncKeymap]; [sync_keymap setEnabled:darwinKeymapFile == NULL]; - [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH default:NO]]; - + [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]]; + [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]]; + [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]]; + [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]]; [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]]; [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]]; diff --git a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib index ea3a0daa8..adc0340ed 100644 --- a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib +++ b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib @@ -8,8 +8,6 @@ 352.00 YES - - YES @@ -448,7 +446,7 @@ 3 2 - {{319, 294}, {481, 345}} + {{266, 392}, {484, 280}} 1350041600 X11 Preferences NSPanel @@ -465,7 +463,7 @@ 256 - {{10, 10}, {458, 325}} + {{13, 10}, {458, 264}} YES @@ -474,14 +472,14 @@ 1 - + 256 YES 256 - {{18, 243}, {402, 18}} + {{18, 182}, {402, 18}} YES @@ -508,7 +506,7 @@ 256 - {{36, 93}, {385, 31}} + {{36, 32}, {385, 31}} YES @@ -544,7 +542,7 @@ 256 - {{36, 208}, {385, 29}} + {{36, 147}, {385, 29}} YES @@ -561,7 +559,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{18, 130}, {402, 18}} + {{18, 69}, {402, 18}} YES @@ -582,7 +580,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{36, 159}, {385, 14}} + {{36, 98}, {385, 14}} YES @@ -598,7 +596,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{18, 179}, {402, 18}} + {{18, 118}, {402, 18}} YES @@ -616,46 +614,8 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 25 - - - 256 - {{18, 69}, {402, 18}} - - YES - - 67239424 - 0 - Click-through Inactive Windows - - - 1211912703 - 2 - - - - 200 - 25 - - - - - 256 - {{33, 32}, {385, 31}} - - YES - - 67239424 - 4194304 - When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it. - - - - - - - {{10, 33}, {438, 279}} - + {{10, 33}, {438, 218}} Input @@ -673,7 +633,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{18, 116}, {402, 18}} + {{18, 55}, {402, 18}} YES @@ -694,7 +654,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{36, 82}, {385, 28}} + {{36, 21}, {385, 28}} YES @@ -710,7 +670,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{74, 235}, {128, 26}} + {{74, 174}, {128, 26}} YES @@ -801,7 +761,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{17, 238}, {55, 20}} + {{17, 177}, {55, 20}} YES @@ -817,7 +777,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{36, 216}, {392, 14}} + {{36, 155}, {392, 14}} YES @@ -833,7 +793,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{18, 182}, {409, 23}} + {{18, 121}, {409, 23}} YES @@ -854,7 +814,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{36, 145}, {385, 31}} + {{36, 84}, {385, 31}} YES @@ -868,12 +828,140 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA - {{10, 33}, {438, 279}} + {{10, 33}, {438, 218}} Output + + + 2 + + + + 256 + + YES + + + 256 + {{15, 184}, {402, 18}} + + YES + + 67239424 + 0 + Click-through Inactive Windows + + + 1211912703 + 2 + + + + 200 + 25 + + + + + 256 + {{23, 147}, {385, 31}} + + YES + + 67239424 + 4194304 + When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it. + + + + + + + + + 256 + {{15, 123}, {402, 18}} + + YES + + 67239424 + 0 + Focus Follows Mouse + + + 1211912703 + 2 + + + + 200 + 25 + + + + + 256 + {{23, 100}, {385, 17}} + + YES + + 67239424 + 4194304 + X11 window focus follows the cursor + + + + + + + + + 256 + {{15, 79}, {402, 18}} + + YES + + 67239424 + 0 + Focus On New Windows + + + 1211912703 + 2 + + + + 200 + 25 + + + + + 256 + {{23, 45}, {385, 28}} + + YES + + 67239424 + 4194304 + When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc. + + + + + + + + {{10, 33}, {438, 218}} + + + Windows + + + @@ -883,7 +971,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{18, 243}, {402, 18}} + {{18, 182}, {402, 18}} YES @@ -904,7 +992,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{18, 166}, {402, 18}} + {{18, 105}, {402, 18}} YES @@ -925,7 +1013,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 256 - {{36, 195}, {385, 42}} + {{36, 134}, {385, 42}} YES @@ -943,7 +1031,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 256 - {{36, 118}, {385, 42}} + {{36, 57}, {385, 42}} YES @@ -959,7 +1047,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 256 - {{20, 17}, {404, 14}} + {{20, -44}, {404, 14}} YES @@ -973,27 +1061,27 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - {{10, 33}, {438, 279}} + {{10, 33}, {438, 218}} Security - + 0 YES YES YES - + - {481, 345} + {484, 280} - {{0, 0}, {1440, 878}} + {{0, 0}, {1280, 938}} {213, 129} {3.40282e+38, 3.40282e+38} x11_prefs @@ -1001,7 +1089,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 11 2 - {{361, 362}, {454, 311}} + {{302, 400}, {454, 311}} 1350041600 X11 Application Menu NSPanel @@ -1011,7 +1099,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 {10000, 10000} {320, 240} - + 256 YES @@ -1353,9 +1441,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 {454, 311} - - {{0, 0}, {1440, 878}} + {{0, 0}, {1280, 938}} {320, 262} x11_apps @@ -1841,14 +1928,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 549 - - - prefs_changed: - - - - 300300 - window_separator @@ -1857,14 +1936,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 300331 - - - click_through - - - - 300332 - menu @@ -1881,6 +1952,54 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 300336 + + + prefs_changed: + + + + 300389 + + + + prefs_changed: + + + + 300390 + + + + prefs_changed: + + + + 300391 + + + + click_through + + + + 300392 + + + + focus_follows_mouse + + + + 300393 + + + + focus_on_new_window + + + + 300394 + @@ -2239,6 +2358,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 + @@ -2262,8 +2382,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - - @@ -2670,34 +2788,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - - 300296 - - - YES - - - - - - 300297 - - - - - 300298 - - - YES - - - - - - 300299 - - - 295 @@ -2853,6 +2943,113 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 + + 300337 + + + YES + + + + + + 300338 + + + YES + + + + + + + + + + + 300358 + + + YES + + + + + + 300359 + + + YES + + + + + + 300360 + + + + + 300361 + + + + + 300362 + + + YES + + + + + + 300363 + + + + + 300364 + + + YES + + + + + + 300365 + + + + + 300368 + + + YES + + + + + + 300369 + + + + + 300370 + + + YES + + + + + + 300371 + + + @@ -2919,10 +3116,12 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 24.IBPluginDependency 24.ImportedFromIB2 24.editorWindowContentRectSynchronizationRect + 244.IBEditorWindowLastContentRect 244.IBPluginDependency 244.IBWindowTemplateEditedContentRect 244.ImportedFromIB2 244.editorWindowContentRectSynchronizationRect + 244.lastResizeAction 244.windowTemplate.hasMaxSize 244.windowTemplate.hasMinSize 244.windowTemplate.maxSize @@ -2971,12 +3170,24 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 299.IBPluginDependency 299.ImportedFromIB2 300295.IBShouldRemoveOnLegacySave - 300296.IBPluginDependency - 300296.ImportedFromIB2 - 300298.IBPluginDependency - 300298.ImportedFromIB2 300330.IBPluginDependency 300330.ImportedFromIB2 + 300337.IBPluginDependency + 300337.ImportedFromIB2 + 300338.IBPluginDependency + 300338.ImportedFromIB2 + 300358.IBPluginDependency + 300358.ImportedFromIB2 + 300359.IBPluginDependency + 300359.ImportedFromIB2 + 300362.IBPluginDependency + 300362.ImportedFromIB2 + 300364.IBPluginDependency + 300364.ImportedFromIB2 + 300368.IBPluginDependency + 300368.ImportedFromIB2 + 300370.IBPluginDependency + 300370.ImportedFromIB2 305.IBPluginDependency 305.ImportedFromIB2 310.IBPluginDependency @@ -3152,10 +3363,24 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 com.apple.InterfaceBuilder.CocoaPlugin {{271, 666}, {301, 153}} + {{460, 353}, {484, 280}} com.apple.InterfaceBuilder.CocoaPlugin - {{184, 290}, {481, 345}} + {{460, 353}, {484, 280}} {{184, 290}, {481, 345}} + + YES + + YES + IBResizeActionFinalFrame + IBResizeActionInitialFrame + + + YES + {{182, 481}, {484, 280}} + {{182, 103}, {536, 658}} + + {3.40282e+38, 3.40282e+38} @@ -3169,11 +3394,11 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 {{100, 746}, {155, 33}} com.apple.InterfaceBuilder.CocoaPlugin - {{537, 545}, {454, 311}} + {{407, 545}, {454, 311}} com.apple.InterfaceBuilder.CocoaPlugin - {{537, 545}, {454, 311}} + {{407, 545}, {454, 311}} {{433, 406}, {486, 327}} @@ -3320,6 +3545,18 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{12, 633}, {218, 203}} com.apple.InterfaceBuilder.CocoaPlugin @@ -3356,7 +3593,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - 300336 + 300394 @@ -3375,6 +3612,17 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 + + X11Controller + NSObject + + IBUserSource + + + + + + YES X11Controller NSObject @@ -3439,6 +3687,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 enable_keyequivs enable_tcp fake_buttons + focus_follows_mouse + focus_on_new_window prefs_panel sync_keymap toggle_fullscreen_item @@ -3460,6 +3710,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 NSButton NSButton NSButton + NSButton + NSButton NSPanel NSButton NSMenuItem @@ -3469,8 +3721,8 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 - IBUserSource - + IBDocumentRelativeSource + ../../X11Controller.h diff --git a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib index f60dcbacb0385caa8292cd06bd178d709632566b..400ee5c286d85b2df5e37b1495b458793faba732 100644 GIT binary patch literal 37953 zcmdRX2YeJo`|!-{?v=e=a+lt7>AhD1N$3L76G~_yBu5fRaxsO_*+H6$G(|)}I*3@o zt|&!BK~zvdQ9&$NzycN&6~1S7?~+RhzP|7O_kX|d^C!8x-PxIW`ZLe-%+AER>Z*pu zl$7@nMg(z)M*`9zBN9hNOtsZFRM~5bA{y;=#Sx|TWtCNMX;g%L;$&M{V}m=w3pXA| zdSn>auSb%0vAndgRKX=?w?T!s+NRseyE`6w+`=^>6OvFW%0!(}H`EjLLVeKybT?Xs zwxC_;5%d~5jNV4?pm)(J^a1(^eS*%Ruh6&X0=kHPM89B99F8M!JkG$GI0xt9VYm>F zz+f5m^`Kk;>f2_XUzi9fNT(gTKF%Kge~Ca2#jg%$yhJ&G~S?To4z*#c;7)9GA>xaoJoBm&f(u z`f>faVO$|MiYwu4+$64+vvZByOl}r8o14Sk&fUc=;qK*DajUsC+ymSOZacSwdz^cM zdzyQOdy#vUJH)-gy~7>nPH^vXA8?;?=eWvvQr$#dm9Adbq?@B#pj)WB zTenoVN_U@bz3xHXHr;mJqtNOx-Q&95y61H->0Z+v)4ip8Uw2aXiSCTX+&7hi_~259&ASx9GR(AJspje?|YA z{;>Xa{Tp!Sg#MKNQ}{fmzo`F3e+|A}H(-No@G^KCd<<4YtRc;iZs;m_81f9=4LuA! z4Sfy$41)}V4Mm3GhS7#Gh6#pJ!z4q6;TOX-!*wGvaz?Y!Vstlp8oi9(#t>t)G2WP9 zOg3g4bBtY$dB%KWcYUF;hq0%z7s@f-V(e!;B~B855q}l0h`))yi&w=z#6QKq#B1Vp z6Ea~FF>xl|B$#w2y~$uQnnaVyB$;GWCzG4WY_gc#O&%sslb6Zc(SO=+fdQ-&$ilx4~` z<(N8~a!p-KT}^qWd{cp`o2k30hpDHjm#Md@kLeauUsFF*f77j|0j7bbL8if`A*P|G zVW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ASwNdKFsRL7ksky0_{SEvH{w#m4KhM9#U+RCDRy(a(TE{e7 zT0)viyOQ>2+LQEZ>F=daOwUg*Nq-cG3bYP<8t?~31%3=n4de$72TliG1pg7t3C;{I z4(12f2G<2Q2e$>c2loXJ(1A3T>eQfiim8*v(?sf_$ux!fX*vy3MolWHqC;o~&7{NW z2s(;>N5|4EnoTFr96Fi)OsCQrbT*ww7t$qk8C^m1=^DD8ZlHyFidAPdSr`jvZ?Gs-evExR;&$c$J((H7&1@ShW;@w#wwLW^hu9HzoSk5&*co74u^a3byTk6W3igma zVo%v~Ru!rqsu>Ckg@+o9oOC=C9^vbDO!t z+->eP_nU{zBj$1Qgn7z5YnGcA%uD7~^M-lbyk}OJmF5%kx%raU;I(*d9>Jq{ef}nY zi@(jA^5(oHf1iKA+w%^*6Yt7<@SeOk@5=}9Sgv!#9o)&|c@p<>AAiNgbIMIF`4FDL zGx=~nl8@$Nc^1#+6Zj;a%ct<^d={U}7x2YAkFVhQd@V2Fg}jJw<;8p#-@{AzL0-y_ z@iKmrpW%P-^ZX*e!msmN{4W2KKje@3GhQXCi<%-#)De-Qo@gix{3L!6)5J_MN6Z(C#8Rmrnn<2#AESPJQpuz4Ovr$%LrLdHjs^Ew2YBWWeeF#wvp}RN3xUbD!a?is2pCRfVU za;;o1H^^V*X1Pu7kb7i_JSa=$G5NbZAy3J(^1Qq(ugRP8o~)3S@`y%So(@{5R;rC^uR5qss;laudZ|9DpBkXPR5s;ME|s8?lt(42RF$p Date: Fri, 21 Mar 2008 19:31:31 -0700 Subject: [PATCH 099/183] XQuartz: Disable 256 color option and fullscreen option (cherry picked from commit 7c1964338a33558d3f25e369dfca99e3ef9d10f9) --- hw/xquartz/X11Application.m | 10 ++++-- hw/xquartz/X11Controller.m | 31 ++++++++++-------- .../English.lproj/main.nib/designable.nib | 14 ++++---- .../English.lproj/main.nib/keyedobjects.nib | Bin 37953 -> 38044 bytes 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 1cf992d92..b7c876365 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -612,8 +612,10 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP default:quartzUseSysBeep]; - quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS - default:quartzEnableRootless]; + + // TODO: Add fullscreen support + //quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS + // default:quartzEnableRootless]; #ifdef DARWIN_DDX_MISSING quartzFullscreenDisableHotkeys = ![self prefs_get_boolean: @PREFS_FULLSCREEN_HOTKEYS default: @@ -645,6 +647,10 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH default:darwinDesiredDepth]; + + // TODO: Add 256 color support + if(darwinDesiredDepth == 8) + darwinDesiredDepth = -1; enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO default:false]; diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 3880b3f38..a9d2addbd 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -635,22 +635,27 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction) prefs_show:sender { - [fake_buttons setIntValue:darwinFakeButtons]; - [use_sysbeep setIntValue:quartzUseSysBeep]; - [enable_keyequivs setIntValue:X11EnableKeyEquivalents]; - [sync_keymap setIntValue:darwinSyncKeymap]; - [sync_keymap setEnabled:darwinKeymapFile == NULL]; - [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]]; - [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]]; - [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]]; + [fake_buttons setIntValue:darwinFakeButtons]; + [use_sysbeep setIntValue:quartzUseSysBeep]; + [enable_keyequivs setIntValue:X11EnableKeyEquivalents]; + [sync_keymap setIntValue:darwinSyncKeymap]; + [sync_keymap setEnabled:darwinKeymapFile == NULL]; + [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]]; + [focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]]; + [focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]]; + + [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]]; + [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]]; - [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]]; - [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]]; - [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]]; + [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]]; + // TODO: Add 256 color support + [depth removeItemAtIndex:[depth indexOfItemWithTag:8]]; - [enable_fullscreen setIntValue:!quartzEnableRootless]; + [enable_fullscreen setIntValue:!quartzEnableRootless]; + // TODO: Add fullscreen support + [enable_fullscreen setEnabled:NO]; - [prefs_panel makeKeyAndOrderFront:sender]; + [prefs_panel makeKeyAndOrderFront:sender]; } - (IBAction) quit:sender diff --git a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib index adc0340ed..672ba904d 100644 --- a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib +++ b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib @@ -472,7 +472,7 @@ 1

- + 256 YES @@ -616,6 +616,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA {{10, 33}, {438, 218}} +
Input @@ -839,7 +840,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 2
- + 256 YES @@ -956,7 +957,6 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA {{10, 33}, {438, 218}} -
Windows @@ -1068,14 +1068,14 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4
- + 0 YES YES YES - +
@@ -3363,9 +3363,9 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4 com.apple.InterfaceBuilder.CocoaPlugin {{271, 666}, {301, 153}} - {{460, 353}, {484, 280}} + {{313, 353}, {484, 280}} com.apple.InterfaceBuilder.CocoaPlugin - {{460, 353}, {484, 280}} + {{313, 353}, {484, 280}} {{184, 290}, {481, 345}} diff --git a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib index 400ee5c286d85b2df5e37b1495b458793faba732..91a7c5adb44e6355d01211d48fe4c5a0121a6b43 100644 GIT binary patch literal 38044 zcmdRX2VfM{+UPlFW_PyCB)jQ7OL|D}2`ThmLlQcKkSrvSWJ5Ngiq1g<1f+@xsPv8n z0R;p^QKTt~3ZfvQ2sT8qW8r;gW;fYT^xpg4f8TrDYj$_$l<$1~eBXCwM%7hU*&C9R z-$NJ?#33GOkQV8YVNk>bYrVb7R$Cm=V5=J(QC44GSp}B{Mc77-wU#&7JrJI``W+-7 z-SF-m64i?pWesIAE;YILDe7sRY^`YT==7|aYeYsQq7;;Ya!@3FUF7IW%voa z2Cv0i@oxMAei0wRZ{oM`S^Nq7x`eObFYwp+I{psdz`qlY@I*u0h%fOY{=`CBkr)z7 zQb`VJLvl$T>5N|>T}V&TpA?Z{@O?NbBh|!C8b~9#k4z)?lUZawSwI$&W#nz;)!haoxE-+yHJEH=L{Fs<;}imaF6HI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Qn_;;_EKR7&4wrB=3_cWICBaipgwJLgtYLWFc8ZmXKv+ zC0Rw*ko9CE`HE~Jn@K6zO16=o$j@X4DI>edUb3H*lL~T#93v;lX>yiaAeYEha*f;| zf0Dn*J@Sw|CQr#fZdJF2Tg$EO)^Y2(4cu4VCT?>#+HK>ucRRYB-LCHI?wjsgZZEfw z+s_^74sm1LSl90=uI3tU&<(rsZp5|SBzL%*?T&coIju%((%Q5Rtw$Tu#Az@q+JnAL`_TS$5FJWmsYF#8pg|g@h+>*ZhtpJ=L9^)yI+Bi}E@f2EF?2kg zNZ+SZ=yW=h&Z2YZT)KdMNxFr$5r4>92Gb-AfP9-{@g_ zjGmyU=~;S#UZ#K08}v_lhu)`;=->1oR+ZIYFR@ox6l=g5v8JpAYsK2K*H|akmA%g1 zWIb7L){hNjLzs{GnZk4iSct{52uonYSjvm5SQg7=`K*u;Mw!P(vvF(!o5Vg~)7T7F z%x1F^HlHnIi`i1Pf~{g}*m|~+ea$wrQnr=-z_zm;Y$w~p_Oo(U!H%-u*(r90ooAQW zRd$`-Vt=uF>>+!?p7AQYIMtCJe%k8JU)uMoN>X&@bP>ipTwu~5BW?!i_hjId_G^u7x5*0 zIbX?F^EG?}-^5G#R{j(Jg_rT&`~d%rSMa0!B(LP>_(gt&U*k9V9e$rb;!pT9?*)Xy zd&R5k)%O~Djl8B_wAaq-;C1%8dfmJpUT?3jH^3Y04fXt<<^??9g*?l%z2RP}m*Hi3 zxn6%EQM*WQ1 Date: Sat, 22 Mar 2008 17:28:48 +0100 Subject: [PATCH 100/183] exa: use xf86ReturnOptValBool instead of xf86IsOptionSet The latter doesn't give you the option's value, it just tells you if it's present in the configuration. So using Option "EXANoComposite" "false" disabled composite acceleration. --- hw/xfree86/exa/examodule.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c index 086639cc5..e18da0a37 100644 --- a/hw/xfree86/exa/examodule.c +++ b/hw/xfree86/exa/examodule.c @@ -148,22 +148,23 @@ exaDDXDriverInit(ScreenPtr pScreen) FALSE); } - if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_COMPOSITE)) { - xf86DrvMsg(pScreen->myNum, X_INFO, + if (xf86ReturnOptValBool(pScreenPriv->options, + EXAOPT_NO_COMPOSITE, FALSE)) { + xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling Composite operation " "(RENDER acceleration)\n"); pExaScr->info->CheckComposite = NULL; pExaScr->info->PrepareComposite = NULL; } - if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_UTS)) { - xf86DrvMsg(pScreen->myNum, X_INFO, + if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) { + xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling UploadToScreen\n"); pExaScr->info->UploadToScreen = NULL; } - if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_DFS)) { - xf86DrvMsg(pScreen->myNum, X_INFO, + if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) { + xf86DrvMsg(pScreen->myNum, X_CONFIG, "EXA: Disabling DownloadFromScreen\n"); pExaScr->info->DownloadFromScreen = NULL; } From 4217ba0cf0c9bbea3774760e836ab372acf3237c Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Sat, 22 Mar 2008 17:31:08 +0100 Subject: [PATCH 101/183] xaa: use xf86ReturnOptValBool instead of xf86IsOptionSet The latter doesn't return the option's value, just whether it's present in the configuration. --- hw/xfree86/xaa/xaaInitAccel.c | 57 ++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c index 1b7c15487..53795f067 100644 --- a/hw/xfree86/xaa/xaaInitAccel.c +++ b/hw/xfree86/xaa/xaaInitAccel.c @@ -181,7 +181,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForScreenToScreenCopy && infoRec->SubsequentScreenToScreenCopy && - !xf86IsOptionSet(options, XAAOPT_SCREEN_TO_SCREEN_COPY)) { + !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) { HaveScreenToScreenCopy = TRUE; } else { infoRec->ScreenToScreenCopyFlags = 0; @@ -192,10 +192,10 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) /**** Solid Filled Rects ****/ if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect && - !xf86IsOptionSet(options, XAAOPT_SOLID_FILL_RECT)) { + !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) { HaveSolidFillRect = TRUE; if(infoRec->SubsequentSolidFillTrap && - !xf86IsOptionSet(options, XAAOPT_SOLID_FILL_TRAP)) + !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE)) HaveSolidFillTrap = TRUE; else infoRec->SubsequentSolidFillTrap = NULL; @@ -210,10 +210,11 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForSolidLine) { if(infoRec->SubsequentSolidTwoPointLine && - !xf86IsOptionSet(options, XAAOPT_SOLID_TWO_POINT_LINE)) + !xf86ReturnOptValBool(options, + XAAOPT_SOLID_TWO_POINT_LINE, FALSE)) HaveSolidTwoPointLine = TRUE; if(infoRec->SubsequentSolidBresenhamLine && - !xf86IsOptionSet(options, XAAOPT_SOLID_BRESENHAM_LINE)) { + !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) { HaveSolidBresenhamLine = TRUE; if(infoRec->SolidBresenhamLineErrorTermBits) @@ -222,7 +223,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) } if(infoRec->SubsequentSolidHorVertLine && - !xf86IsOptionSet(options, XAAOPT_SOLID_HORVERT_LINE)) + !xf86ReturnOptValBool(options, + XAAOPT_SOLID_HORVERT_LINE, FALSE)) HaveSolidHorVertLine = TRUE; else if(HaveSolidTwoPointLine) { infoRec->SubsequentSolidHorVertLine = @@ -265,10 +267,14 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForMono8x8PatternFill && infoRec->SubsequentMono8x8PatternFillRect && - !xf86IsOptionSet(options, XAAOPT_MONO_8x8_PATTERN_FILL_RECT)) { + !xf86ReturnOptValBool(options, + XAAOPT_MONO_8x8_PATTERN_FILL_RECT, + FALSE)) { HaveMono8x8PatternFillRect = TRUE; if(infoRec->SubsequentMono8x8PatternFillTrap && - !xf86IsOptionSet(options, XAAOPT_MONO_8x8_PATTERN_FILL_TRAP)) + !xf86ReturnOptValBool(options, + XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, + FALSE)) HaveMono8x8PatternFillTrap = TRUE; if(infoRec->Mono8x8PatternFillFlags & @@ -318,10 +324,12 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) { if(infoRec->SubsequentDashedTwoPointLine && - !xf86IsOptionSet(options, XAAOPT_DASHED_TWO_POINT_LINE)) + !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE, + FALSE)) HaveDashedTwoPointLine = TRUE; if(infoRec->SubsequentDashedBresenhamLine && - !xf86IsOptionSet(options, XAAOPT_DASHED_BRESENHAM_LINE)) { + !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE, + FALSE)) { HaveDashedBresenhamLine = TRUE; if(infoRec->DashedBresenhamLineErrorTermBits) @@ -345,10 +353,11 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForColor8x8PatternFill && infoRec->SubsequentColor8x8PatternFillRect && - !xf86IsOptionSet(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT)) { + !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) { HaveColor8x8PatternFillRect = TRUE; if(infoRec->SubsequentColor8x8PatternFillTrap && - !xf86IsOptionSet(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP)) + !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP, + FALSE)) HaveColor8x8PatternFillTrap = TRUE; else infoRec->SubsequentColor8x8PatternFillTrap = NULL; @@ -381,7 +390,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForCPUToScreenColorExpandFill && infoRec->ColorExpandBase && infoRec->SubsequentCPUToScreenColorExpandFill && - !xf86IsOptionSet(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL)) { + !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, + FALSE)) { int dwordsNeeded = pScrn->virtualX; infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */ @@ -406,7 +416,9 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) infoRec->SubsequentColorExpandScanline && infoRec->ScanlineColorExpandBuffers && (infoRec->NumScanlineColorExpandBuffers > 0) && - !xf86IsOptionSet(options, XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL)) { + !xf86ReturnOptValBool(options, + XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL, + FALSE)) { HaveScanlineColorExpansion = TRUE; } else { infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0; @@ -419,7 +431,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForScreenToScreenColorExpandFill && infoRec->SubsequentScreenToScreenColorExpandFill && - !xf86IsOptionSet(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL)) { + !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, + FALSE)) { HaveScreenToScreenColorExpandFill = TRUE; if (!infoRec->CacheColorExpandDensity) infoRec->CacheColorExpandDensity = 1; @@ -433,7 +446,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase && infoRec->SubsequentImageWriteRect && - !xf86IsOptionSet(options, XAAOPT_IMAGE_WRITE_RECT)) { + !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) { infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */ if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED) @@ -452,7 +465,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) infoRec->SubsequentImageWriteScanline && infoRec->ScanlineImageWriteBuffers && (infoRec->NumScanlineImageWriteBuffers > 0) && - !xf86IsOptionSet(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT)) { + !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT, + FALSE)) { HaveScanlineImageWriteRect = TRUE; } else { infoRec->ScanlineImageWriteFlags = 0; @@ -518,7 +532,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) #define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0) if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy && - !xf86IsOptionSet(options, XAAOPT_OFFSCREEN_PIXMAPS)) { + !xf86ReturnOptValBool(options, XAAOPT_OFFSCREEN_PIXMAPS, + FALSE)) { XAAMSG("\tOffscreen Pixmaps\n"); } else { infoRec->Flags &= ~OFFSCREEN_PIXMAPS; @@ -800,7 +815,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) /**** WriteBitmap ****/ if(infoRec->WriteBitmap && - !xf86IsOptionSet(options, XAAOPT_WRITE_BITMAP)) { + !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) { XAAMSG("\tDriver provided WriteBitmap replacement\n"); } else if(HaveColorExpansion) { if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) { @@ -959,7 +974,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) /**** WritePixmap ****/ if(infoRec->WritePixmap && - !xf86IsOptionSet(options, XAAOPT_WRITE_PIXMAP)) { + !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) { XAAMSG("\tDriver provided WritePixmap replacement\n"); } else if(HaveImageWriteRect) { infoRec->WritePixmap = XAAWritePixmap; @@ -1433,7 +1448,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) else infoRec->Flags &= ~PIXMAP_CACHE; - if (xf86IsOptionSet(options, XAAOPT_PIXMAP_CACHE)) + if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE)) infoRec->Flags &= ~PIXMAP_CACHE; if(infoRec->WriteMono8x8PatternToCache) {} From 536f2ff5382aaaace3b55481e15366bb15d87801 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 24 Mar 2008 12:22:19 -0400 Subject: [PATCH 102/183] Bug #13962: Re-arm the DPMS timer when re-enabling DPMS. --- Xext/dpms.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Xext/dpms.c b/Xext/dpms.c index 6f01fa348..e3204febb 100644 --- a/Xext/dpms.c +++ b/Xext/dpms.c @@ -188,12 +188,15 @@ static int ProcDPMSEnable(client) register ClientPtr client; { - /* REQUEST(xDPMSEnableReq); */ + Bool was_enabled = DPMSEnabled; REQUEST_SIZE_MATCH(xDPMSEnableReq); - if (DPMSCapableFlag) + if (DPMSCapableFlag) { DPMSEnabled = TRUE; + if (!was_enabled) + SetScreenSaverTimer(); + } return(client->noClientException); } From 87bfd3bd96c714a1c252d42408b5a1a4ff9dab06 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 24 Mar 2008 13:33:38 -0400 Subject: [PATCH 103/183] Bug #11508: Fix build without XV. --- hw/xfree86/loader/xf86sym.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index f86a1433d..24fc44c1b 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -68,8 +68,10 @@ # include "xf86Xinput.h" #endif #include "xf86OSmouse.h" +#ifdef XV #include "xf86xv.h" #include "xf86xvmc.h" +#endif #include "xf86cmap.h" #include "xf86fbman.h" #include "dgaproc.h" From 862ff9ac92037e13629329eb6ba50ff6bd2c5f71 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 24 Mar 2008 13:37:42 -0400 Subject: [PATCH 104/183] Bug #11510: Fix build without RECORD. --- Makefile.am | 6 +++++- hw/xfree86/dixmods/Makefile.am | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index e382d58e7..71ba2c429 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,10 @@ if DBE DBE_DIR=dbe endif +if RECORD +RECORD_DIR=record +endif + SUBDIRS = \ doc \ include \ @@ -48,7 +52,7 @@ SUBDIRS = \ $(AFB_DIR) \ $(CFB_DIR) \ $(CFB32_DIR) \ - record \ + $(RECORD_DIR) \ xfixes \ damageext \ $(XTRAP_DIR) \ diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am index efc5f4a39..dad2dd36b 100644 --- a/hw/xfree86/dixmods/Makefile.am +++ b/hw/xfree86/dixmods/Makefile.am @@ -26,6 +26,10 @@ if MFB MFBMOD = libmfb.la endif +if RECORD +RECORDMOD = librecord.la +endif + module_LTLIBRARIES = $(AFBMOD) \ $(CFBMOD) \ libfb.la \ @@ -34,7 +38,7 @@ module_LTLIBRARIES = $(AFBMOD) \ libshadow.la extsmoduledir = $(moduledir)/extensions -extsmodule_LTLIBRARIES = librecord.la \ +extsmodule_LTLIBRARIES = $(RECORDMOD) \ $(DBEMOD) \ $(GLXMODS) \ $(XTRAPMOD) From f028e245a7932362656701c08fcfbfa8e8949077 Mon Sep 17 00:00:00 2001 From: David Nusinow Date: Thu, 28 Feb 2008 19:45:21 -0500 Subject: [PATCH 105/183] Bug #10016: Implement WM_CLASS hints in Xephyr. --- hw/kdrive/ephyr/ephyr.h | 1 + hw/kdrive/ephyr/ephyrinit.c | 19 +++++++++++++++++++ hw/kdrive/ephyr/hostx.c | 28 ++++++++++++++++++++++++++++ hw/kdrive/ephyr/hostx.h | 3 +++ 4 files changed, 51 insertions(+) diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h index 8ed7e23dd..5d58a216c 100644 --- a/hw/kdrive/ephyr/ephyr.h +++ b/hw/kdrive/ephyr/ephyr.h @@ -28,6 +28,7 @@ #include #include #include +#include #include "os.h" /* for OsSignal() */ #include "kdrive.h" diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 6196996a9..47ddb3d82 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -109,6 +109,7 @@ ddxUseMsg (void) ErrorF("-nodri do not use DRI\n"); #endif ErrorF("-noxv do not use XV\n"); + ErrorF("-name [name] define the name in the WM_CLASS property\n"); ErrorF("\n"); exit(1); @@ -148,6 +149,11 @@ ddxProcessArgument (int argc, char **argv, int i) { EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] ); + if (i == 1) + { + hostx_use_resname(basename(argv[0]), 0); + } + if (!strcmp (argv[i], "-parent")) { if(i+1 < argc) @@ -223,6 +229,19 @@ ddxProcessArgument (int argc, char **argv, int i) EPHYR_LOG ("no XVideo enabled\n") ; return 1 ; } + else if (!strcmp (argv[i], "-name")) + { + if (i+1 < argc && argv[i+1][0] != '-') + { + hostx_use_resname(argv[i+1], 1); + return 2; + } + else + { + UseMsg(); + return 0; + } + } else if (argv[i][0] == ':') { hostx_set_display_name(argv[i]); diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index fd84ec0ef..1a71d0641 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -107,6 +107,9 @@ extern EphyrKeySyms ephyrKeySyms; extern int monitorResolution; +char *ephyrResName = NULL; +int ephyrResNameFromCmd = 0; + static void hostx_set_fullscreen_hint(void); @@ -296,6 +299,13 @@ hostx_handle_signal (int signum) HostXWantDamageDebug); } +void +hostx_use_resname (char *name, int fromcmd) +{ + ephyrResName = name; + ephyrResNameFromCmd = fromcmd; +} + int hostx_init (void) { @@ -304,6 +314,8 @@ hostx_init (void) Pixmap cursor_pxm; XColor col; int index; + char *tmpstr; + XClassHint *class_hint; attr.event_mask = ButtonPressMask @@ -327,6 +339,8 @@ hostx_init (void) HostX.depth = DefaultDepth(HostX.dpy, HostX.screen); HostX.visual = DefaultVisual(HostX.dpy, HostX.screen); + class_hint = XAllocClassHint(); + for (index = 0 ; index < HostX.n_screens ; index++) { struct EphyrHostScreen *host_screen = &HostX.screens[index]; @@ -389,9 +403,23 @@ hostx_init (void) hostx_set_fullscreen_hint(); } + + if (class_hint) + { + tmpstr = getenv("RESOURCE_NAME"); + if (tmpstr && (!ephyrResNameFromCmd)) + ephyrResName = tmpstr; + class_hint->res_name = ephyrResName; + class_hint->res_class = "Xephyr"; + XSetClassHint(hostx_get_display(), host_screen->win, class_hint); + + } + } } + if (class_hint) + XFree(class_hint); XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen), "red", &col); diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h index 48d314748..47ba61b5b 100644 --- a/hw/kdrive/ephyr/hostx.h +++ b/hw/kdrive/ephyr/hostx.h @@ -145,6 +145,9 @@ hostx_want_preexisting_window(EphyrScreenInfo screen); void hostx_use_preexisting_window(unsigned long win_id); +void +hostx_use_resname (char *name, int fromcmd); + void hostx_handle_signal(int signum); From e7a364425547103a98acabfc67d16e1ae0c2967f Mon Sep 17 00:00:00 2001 From: Sascha Hlusiak Date: Tue, 25 Mar 2008 12:32:33 -0400 Subject: [PATCH 106/183] Fix getValuatorEvents to compute number of valuators correctly. --- dix/getevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/getevents.c b/dix/getevents.c index 3e6fe5ae0..6a2f7baf6 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -349,7 +349,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator, for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) { xv->type = DeviceValuator; xv->first_valuator = i; - xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i); + xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (final_valuator - i); xv->deviceid = pDev->id; switch (final_valuator - i) { case 6: From 47eb658e802775021e3efec109f95431cca188ca Mon Sep 17 00:00:00 2001 From: Sascha Hlusiak Date: Tue, 25 Mar 2008 17:37:25 +0100 Subject: [PATCH 107/183] Support to pass arbitrary options via HAL hotplugging Parse "input.x11_options" and pass every key/name pair to the driver. Remove check for input.capabilities, because that's part of the fdi files. Thanks to Dustin Spicuzza for the patch. --- config/hal.c | 194 +++++++++++++++++++++++++------------------ config/x11-input.fdi | 62 ++++++++++++-- configure.ac | 2 + 3 files changed, 173 insertions(+), 85 deletions(-) diff --git a/config/hal.c b/config/hal.c index 1575422c3..f15064646 100644 --- a/config/hal.c +++ b/config/hal.c @@ -38,9 +38,10 @@ #include "config-backends.h" #include "os.h" -#define TYPE_NONE 0 -#define TYPE_KEYS 1 -#define TYPE_POINTER 2 + +#define LIBHAL_PROP_KEY "input.x11_options." +#define LIBHAL_XKB_PROP_KEY "input.xkb." + struct config_hal_info { DBusConnection *system_bus; @@ -50,7 +51,8 @@ struct config_hal_info { static void remove_device(DeviceIntPtr dev) { - DebugF("[config/hal] removing device %s\n", dev->name); + /* this only gets called for devices that have already been added */ + LogMessage(X_INFO, "config/hal: removing device %s\n", dev->name); /* Call PIE here so we don't try to dereference a device that's * already been removed. */ @@ -105,7 +107,7 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name) char *prop, *ret; prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL); - DebugF("[config/hal] getting %s on %s returned %s\n", name, udi, prop); + LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop); if (prop) { ret = xstrdup(prop); libhal_free_string(prop); @@ -117,6 +119,9 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name) return ret; } +/* this function is no longer used... keep it here in case its needed in + * the future. */ +#if 0 static char * get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) { @@ -150,117 +155,146 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) return ret; } +#endif static void device_added(LibHalContext *hal_ctx, const char *udi) { - char **props; - char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL; - char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL; - char *xkb_options = NULL, *config_info = NULL; + char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL; InputOption *options = NULL, *tmpo = NULL; DeviceIntPtr dev; DBusError error; - int type = TYPE_NONE; - int i; - + + LibHalPropertySet *set = NULL; + LibHalPropertySetIterator set_iter; + char *psi_key = NULL, *tmp_val, *tmp_key; + + dbus_error_init(&error); - props = libhal_device_get_property_strlist(hal_ctx, udi, - "info.capabilities", &error); - if (!props) { - DebugF("[config/hal] couldn't get capabilities for %s: %s (%s)\n", - udi, error.name, error.message); - goto out_error; - } - for (i = 0; props[i]; i++) { - /* input.keys is the new, of which input.keyboard is a subset, but - * input.keyboard is the old 'we have keys', so we have to keep it - * around. */ - if (strcmp(props[i], "input.keys") == 0 || - strcmp(props[i], "input.keyboard") == 0) - type |= TYPE_KEYS; - if (strcmp(props[i], "input.mouse") == 0 || - strcmp(props[i], "input.touchpad") == 0) - type |= TYPE_POINTER; - } - libhal_free_string_array(props); - - if (type == TYPE_NONE) - goto out_error; - driver = get_prop_string(hal_ctx, udi, "input.x11_driver"); - path = get_prop_string(hal_ctx, udi, "input.device"); - if (!driver || !path) { - DebugF("[config/hal] no driver or path specified for %s\n", udi); + if (!driver){ + /* verbose, don't tell the user unless they _want_ to see it */ + LogMessageVerb(X_INFO,7,"config/hal: no driver specified for device %s\n", udi); goto unwind; } + + path = get_prop_string(hal_ctx, udi, "input.device"); + if (!path) { + LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi); + goto unwind; + } + name = get_prop_string(hal_ctx, udi, "info.product"); if (!name) name = xstrdup("(unnamed)"); - if (type & TYPE_KEYS) { - xkb_rules = get_prop_string(hal_ctx, udi, "input.xkb.rules"); - xkb_model = get_prop_string(hal_ctx, udi, "input.xkb.model"); - xkb_layout = get_prop_string(hal_ctx, udi, "input.xkb.layout"); - xkb_variant = get_prop_string(hal_ctx, udi, "input.xkb.variant"); - xkb_options = get_prop_string_array(hal_ctx, udi, "input.xkb.options"); - } - options = xcalloc(sizeof(*options), 1); + if (!options){ + LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n"); + goto unwind; + } + options->key = xstrdup("_source"); options->value = xstrdup("server/hal"); if (!options->key || !options->value) { - ErrorF("[config] couldn't allocate first key/value pair\n"); + LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n"); goto unwind; } + /* most drivers use device.. not path. evdev uses both however, but the + * path version isn't documented apparently. support both for now. */ add_option(&options, "path", path); + add_option(&options, "device", path); + add_option(&options, "driver", driver); add_option(&options, "name", name); + config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */ - if (!config_info) + if (!config_info) { + LogMessage(X_ERROR, "config/hal: couldn't allocate name\n"); goto unwind; + } sprintf(config_info, "hal:%s", udi); - if (xkb_rules) - add_option(&options, "xkb_rules", xkb_rules); - if (xkb_model) - add_option(&options, "xkb_model", xkb_model); - if (xkb_layout) - add_option(&options, "xkb_layout", xkb_layout); - if (xkb_variant) - add_option(&options, "xkb_variant", xkb_variant); - if (xkb_options) - add_option(&options, "xkb_options", xkb_options); + /* ok, grab options from hal.. iterate through all properties + * and lets see if any of them are options that we can add */ + set = libhal_device_get_all_properties(hal_ctx, udi, &error); + + if (!set) { + LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n", + udi, error.name, error.message); + goto unwind; + } + + libhal_psi_init(&set_iter,set); + while (libhal_psi_has_more(&set_iter)) { + /* we are looking for supported keys.. extract and add to options */ + psi_key = libhal_psi_get_key(&set_iter); + + if (psi_key){ - DebugF("[config/hal] Adding device %s\n", name); + /* normal options first (input.x11_options.) */ + if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){ + + /* only support strings for all values */ + tmp_val = get_prop_string(hal_ctx, udi, psi_key); + + if (tmp_val){ + add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val); + xfree(tmp_val); + } + + /* evdev's XKB options... we should probably depreciate this usage */ + } else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){ + + /* only support strings for all values */ + tmp_val = get_prop_string(hal_ctx, udi, psi_key); + + if (tmp_val){ + /* add "xkb_" + NULL */ + tmp_key = xalloc(strlen(psi_key) - ( sizeof(LIBHAL_XKB_PROP_KEY) - 1) + 5); + + if (!tmp_key){ + LogMessage(X_ERROR, "config/hal: couldn't allocate memory for option %s\n", psi_key); + } else { + sprintf(tmp_key, "xkb_%s", psi_key + sizeof(LIBHAL_XKB_PROP_KEY)-1); + add_option(&options, tmp_key, tmp_val); + + xfree(tmp_key); + } + xfree(tmp_val); + } + } + } + + /* psi_key doesn't need to be freed */ + libhal_psi_next(&set_iter); + } + + /* this isn't an error, but how else do you output something that the user can see? */ + LogMessage(X_INFO, "config/hal: Adding input device %s\n", name); if (NewInputDeviceRequest(options, &dev) != Success) { - ErrorF("[config/hal] NewInputDeviceRequest failed\n"); + LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n"); dev = NULL; goto unwind; } - for (; dev; dev = dev->next) + for (; dev; dev = dev->next){ + if (dev->config_info) + xfree(dev->config_info); dev->config_info = xstrdup(config_info); + } unwind: + if (set) + libhal_free_property_set(set); if (path) xfree(path); if (driver) xfree(driver); if (name) xfree(name); - if (xkb_rules) - xfree(xkb_rules); - if (xkb_model) - xfree(xkb_model); - if (xkb_layout) - xfree(xkb_layout); - if (xkb_variant) - xfree(xkb_variant); - if (xkb_options) - xfree(xkb_options); if (config_info) xfree(config_info); while (!dev && (tmpo = options)) { @@ -270,7 +304,6 @@ unwind: xfree(tmpo); } -out_error: dbus_error_free(&error); return; @@ -286,7 +319,7 @@ disconnect_hook(void *data) if (dbus_connection_get_is_connected(info->system_bus)) { dbus_error_init(&error); if (!libhal_ctx_shutdown(info->hal_ctx, &error)) - DebugF("[config/hal] couldn't shut down context: %s (%s)\n", + LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n", error.name, error.message); dbus_error_free(&error); } @@ -312,21 +345,21 @@ connect_hook(DBusConnection *connection, void *data) if (!info->hal_ctx) info->hal_ctx = libhal_ctx_new(); if (!info->hal_ctx) { - ErrorF("[config/hal] couldn't create HAL context\n"); + LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n"); goto out_err; } if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) { - ErrorF("[config/hal] couldn't associate HAL context with bus\n"); + LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n"); goto out_ctx; } if (!libhal_ctx_init(info->hal_ctx, &error)) { - ErrorF("[config/hal] couldn't initialise context: %s (%s)\n", + LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n", error.name, error.message); goto out_ctx; } if (!libhal_device_property_watch_all(info->hal_ctx, &error)) { - ErrorF("[config/hal] couldn't watch all properties: %s (%s)\n", + LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n", error.name, error.message); goto out_ctx2; } @@ -346,7 +379,7 @@ connect_hook(DBusConnection *connection, void *data) out_ctx2: if (!libhal_ctx_shutdown(info->hal_ctx, &error)) - DebugF("[config/hal] couldn't shut down context: %s (%s)\n", + LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n", error.name, error.message); out_ctx: libhal_ctx_free(info->hal_ctx); @@ -374,10 +407,13 @@ config_hal_init(void) hal_info.hal_ctx = NULL; if (!config_dbus_core_add_hook(&hook)) { - ErrorF("[config/hal] failed to add D-Bus hook\n"); + LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n"); return 0; } + /* verbose message */ + LogMessageVerb(X_INFO,7,"config/hal: initialized"); + return 1; } diff --git a/config/x11-input.fdi b/config/x11-input.fdi index c390706fb..f2e2d50ab 100644 --- a/config/x11-input.fdi +++ b/config/x11-input.fdi @@ -1,7 +1,57 @@ - + + + mouse - base + base keyboard - pc105 + pc105 evdev - evdev + evdev - us + us - + diff --git a/configure.ac b/configure.ac index 3b007051c..959f0aedf 100644 --- a/configure.ac +++ b/configure.ac @@ -1009,6 +1009,8 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la' AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1, [Do not have 'strcasecmp'.])) +AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1, + [Do not have 'strncasecmp'.])) if test "x$NULL_ROOT_CURSOR" = xyes; then AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor]) From 333e7123dc484888d79c0f5aa3977bd72f1eb341 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 25 Mar 2008 12:48:22 -0400 Subject: [PATCH 108/183] Fix that last commit. I can apply patches, really. --- dix/getevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dix/getevents.c b/dix/getevents.c index 6a2f7baf6..bf9331eae 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -349,7 +349,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator, for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) { xv->type = DeviceValuator; xv->first_valuator = i; - xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (final_valuator - i); + xv->num_valuators = ((final_valuator - i) > 6) ? 6 : (final_valuator - i); xv->deviceid = pDev->id; switch (final_valuator - i) { case 6: From c747030a49dd289e873e2b686cd129d840e55468 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 27 Mar 2008 15:18:39 +1000 Subject: [PATCH 109/183] quirk: fix LPL monitors properly. no point having a h cm fix when we really want to copy the sizes from the other place. RH BZ 435216 --- hw/xfree86/modes/xf86EdidModes.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 2d1a6abd2..777bb70c7 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -108,13 +108,6 @@ static Bool quirk_prefer_large_75 (int scrnIndex, xf86MonPtr DDC) static Bool quirk_detailed_h_in_cm (int scrnIndex, xf86MonPtr DDC) { - /* Bug #10304: "LGPhilipsLCD LP154W01-A5" */ - /* Bug #12784: "LGPhilipsLCD LP154W01-TLA2" */ - /* Red Hat #435216 "LGPhilipsLCD LP154W01-TLAE" */ - if (memcmp (DDC->vendor.name, "LPL", 4) == 0 && - (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00)) - return TRUE; - /* Bug #11603: Funai Electronics PM36B */ if (memcmp (DDC->vendor.name, "FCM", 4) == 0 && DDC->vendor.prod_id == 13600) @@ -137,7 +130,7 @@ static Bool quirk_detailed_use_maximum_size (int scrnIndex, xf86MonPtr DDC) { /* Bug #10304: LGPhilipsLCD LP154W01-A5 */ if (memcmp (DDC->vendor.name, "LPL", 4) == 0 && - DDC->vendor.prod_id == 0) + (DDC->vendor.prod_id == 0 || DDC->vendor.prod_id == 0x2a00)) return TRUE; return FALSE; From c4a616a741e15865ce0ff98781c6f1dca4d62887 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 24 Mar 2008 22:43:10 -0700 Subject: [PATCH 110/183] prevent "fake mouse clicks" from generating spurious extra events (cherry picked from commit bd85a24969427e41389688663ead2d4dd41c9999) --- hw/xquartz/darwinEvents.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 827fd81b8..22d895795 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -391,10 +391,12 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask); darwinFakeMouseButtonDown = 2; darwinFakeMouseButtonMask = darwinFakeMouse2Mask; + return; } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) { DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask); darwinFakeMouseButtonDown = 3; darwinFakeMouseButtonMask = darwinFakeMouse3Mask; + return; } } if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) { @@ -406,6 +408,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin // Bring modifiers back up to date DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags); darwinFakeMouseButtonMask = 0; + return; } num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button, From c1d37efe9aae5f2895b3437418f7e4bb2eb3400f Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Tue, 25 Mar 2008 19:25:00 -0700 Subject: [PATCH 111/183] xquartz: copy in new stubs from Xi/stubs.c to replace our old Xinput stubs. Hey, it's a start. (cherry picked from commit 566412b4aece24ae6af8c7c835986b685aa456a2) --- hw/xquartz/darwinXinput.c | 186 ++++++++++++-------------------------- 1 file changed, 59 insertions(+), 127 deletions(-) diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c index e62ec0ab6..50ba656f8 100644 --- a/hw/xquartz/darwinXinput.c +++ b/hw/xquartz/darwinXinput.c @@ -1,8 +1,7 @@ - /* - * X server support of the XINPUT extension for Darwin + * X server support of the XINPUT extension for xquartz * - * This is currently a copy of mi/stubs.c, but eventually this + * This is currently a copy of Xi/stubs.c, but eventually this * should include more complete XINPUT support. */ @@ -52,100 +51,17 @@ SOFTWARE. ********************************************************/ +#define NEED_EVENTS #ifdef HAVE_DIX_CONFIG_H #include #endif -#define NEED_EVENTS #include #include #include "inputstr.h" #include #include #include "XIstubs.h" -#include "chgkbd.h" - -/*********************************************************************** - * - * Caller: ProcXChangeKeyboardDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the keyboard device. - * - * The X keyboard device has a FocusRec. If the device that has been - * made into the new X keyboard did not have a FocusRec, - * ProcXChangeKeyboardDevice will allocate one for it. - * - * If you do not want clients to be able to focus the old X keyboard - * device, call DeleteFocusClassDeviceStruct to free the FocusRec. - * - * If you support input devices with keys that you do not want to be - * used as the X keyboard, you need to check for them here and return - * a BadDevice error. - * - * The default implementation is to do nothing (assume you do want - * clients to be able to focus the old X keyboard). The commented-out - * sample code shows what you might do if you don't want the default. - * - */ - -int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) { - /*********************************************************************** - DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * - **********************************************************************/ - return BadMatch; -} - - -/*********************************************************************** - * - * Caller: ProcXChangePointerDevice - * - * This procedure does the implementation-dependent portion of the work - * needed to change the pointer device. - * - * The X pointer device does not have a FocusRec. If the device that - * has been made into the new X pointer had a FocusRec, - * ProcXChangePointerDevice will free it. - * - * If you want clients to be able to focus the old pointer device that - * has now become accessible through the input extension, you need to - * add a FocusRec to it here. - * - * The XChangePointerDevice protocol request also allows the client - * to choose which axes of the new pointer device are used to move - * the X cursor in the X- and Y- directions. If the axes are different - * than the default ones, you need to keep track of that here. - * - * If you support input devices with valuators that you do not want to be - * used as the X pointer, you need to check for them here and return a - * BadDevice error. - * - * The default implementation is to do nothing (assume you don't want - * clients to be able to focus the old X pointer). The commented-out - * sample code shows what you might do if you don't want the default. - * - */ - -int -ChangePointerDevice ( - DeviceIntPtr old_dev, - DeviceIntPtr new_dev, - unsigned char x, - unsigned char y) - { - /*********************************************************************** - InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* - - x_axis = x; * keep track of new x-axis* - y_axis = y; * keep track of new y-axis* - if (x_axis != 0 || y_axis != 1) - axes_changed = TRUE; * remember axes have changed* - else - axes_changed = FALSE; - *************************************************************************/ - return BadMatch; - } /*********************************************************************** * @@ -161,11 +77,9 @@ ChangePointerDevice ( */ void -CloseInputDevice (d, client) - DeviceIntPtr d; - ClientPtr client; - { - } +CloseInputDevice(DeviceIntPtr d, ClientPtr client) +{ +} /*********************************************************************** * @@ -194,8 +108,8 @@ CloseInputDevice (d, client) */ void -AddOtherInputDevices () - { +AddOtherInputDevices(void) +{ /********************************************************************** for each uninitialized device, do something like: @@ -209,7 +123,7 @@ AddOtherInputDevices () dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); ************************************************************************/ - } +} /*********************************************************************** * @@ -234,12 +148,9 @@ AddOtherInputDevices () */ void -OpenInputDevice (dev, client, status) - DeviceIntPtr dev; - ClientPtr client; - int *status; - { - } +OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) +{ +} /**************************************************************************** * @@ -254,13 +165,10 @@ OpenInputDevice (dev, client, status) */ int -SetDeviceMode (client, dev, mode) - register ClientPtr client; - DeviceIntPtr dev; - int mode; - { +SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ return BadMatch; - } +} /**************************************************************************** * @@ -275,15 +183,11 @@ SetDeviceMode (client, dev, mode) */ int -SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) - register ClientPtr client; - DeviceIntPtr dev; - int *valuators; - int first_valuator; - int num_valuators; - { +SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, + int *valuators, int first_valuator, int num_valuators) +{ return BadMatch; - } +} /**************************************************************************** * @@ -294,16 +198,44 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) */ int -ChangeDeviceControl (client, dev, control) - register ClientPtr client; - DeviceIntPtr dev; - xDeviceCtl *control; - { - switch (control->control) - { - case DEVICE_RESOLUTION: - return (BadMatch); - default: - return (BadMatch); - } +ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, + xDeviceCtl * control) +{ + switch (control->control) { + case DEVICE_RESOLUTION: + return (BadMatch); + case DEVICE_ABS_CALIB: + case DEVICE_ABS_AREA: + return (BadMatch); + case DEVICE_CORE: + return (BadMatch); + default: + return (BadMatch); } +} + + +/**************************************************************************** + * + * Caller: configAddDevice (and others) + * + * Add a new device with the specified options. + * + */ +int +NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) +{ + return BadValue; +} + +/**************************************************************************** + * + * Caller: configRemoveDevice (and others) + * + * Remove the specified device previously added. + * + */ +void +DeleteInputDeviceRequest(DeviceIntPtr dev) +{ +} From 415e49b940bba2d08870db410ebb47d2add5d836 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 25 Mar 2008 23:01:02 -0700 Subject: [PATCH 112/183] XQuartz: Sanity-check the removal of the 256-color option Fixes the 'one-time-preferences' bug in 2.2.0_rc1 (cherry picked from commit 38cbd13490fc21724e8eef0ec7e1a20a9cc2e39d) --- hw/xquartz/X11Controller.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index a9d2addbd..dfa2074fd 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -649,7 +649,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]]; // TODO: Add 256 color support - [depth removeItemAtIndex:[depth indexOfItemWithTag:8]]; + if([depth indexOfItemWithTag:8] != -1) + [depth removeItemAtIndex:[depth indexOfItemWithTag:8]]; [enable_fullscreen setIntValue:!quartzEnableRootless]; // TODO: Add fullscreen support From b5f98fcea2024c67e598947782913982072cf4fb Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 28 Mar 2008 14:01:34 -0400 Subject: [PATCH 113/183] XSELinux: Add xorg.conf option for permissive/enforcing/disabled. Patch by Joe Nall. The option goes in the "extmod" subsection. TODO: Make it easier for extension modules to handle their own options. --- Xext/xselinux.c | 31 ++++++++++++++++++++++++----- hw/xfree86/dixmods/extmod/modinit.c | 23 ++++++++++++++++++++- hw/xfree86/loader/dixsym.c | 3 +++ include/globals.h | 10 ++++++++++ mi/miinitext.c | 8 +++++++- os/utils.c | 4 ++++ 6 files changed, 72 insertions(+), 7 deletions(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 17ce7af10..2e059a4c3 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -37,6 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include "globals.h" #include "resource.h" #include "privates.h" #include "registry.h" @@ -1891,16 +1892,36 @@ void SELinuxExtensionInit(INITARGS) { ExtensionEntry *extEntry; - struct selinux_opt options[] = { { SELABEL_OPT_VALIDATE, (char *)1 } }; + struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *)1 }; + struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *)0 }; security_context_t con; int ret = TRUE; - /* Setup SELinux stuff */ + /* Check SELinux mode on system */ if (!is_selinux_enabled()) { - ErrorF("SELinux: SELinux not enabled, disabling SELinux support.\n"); + ErrorF("SELinux: Disabled on system, not enabling in X server\n"); return; } + /* Check SELinux mode in configuration file */ + switch(selinuxEnforcingState) { + case SELINUX_MODE_DISABLED: + LogMessage(X_INFO, "SELinux: Disabled in configuration file\n"); + return; + case SELINUX_MODE_ENFORCING: + LogMessage(X_INFO, "SELinux: Configured in enforcing mode\n"); + avc_option.value = (char *)1; + break; + case SELINUX_MODE_PERMISSIVE: + LogMessage(X_INFO, "SELinux: Configured in permissive mode\n"); + avc_option.value = (char *)0; + break; + default: + avc_option.type = AVC_OPT_UNUSED; + break; + } + + /* Set up SELinux stuff */ selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback)SELinuxLog); selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit); @@ -1912,11 +1933,11 @@ SELinuxExtensionInit(INITARGS) FatalError("SELinux: Failed to set up security class mapping\n"); } - if (avc_open(NULL, 0) < 0) + if (avc_open(&avc_option, 1) < 0) FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n"); avc_active = 1; - label_hnd = selabel_open(SELABEL_CTX_X, options, 1); + label_hnd = selabel_open(SELABEL_CTX_X, &selabel_option, 1); if (!label_hnd) FatalError("SELinux: Failed to open x_contexts mapping in policy\n"); diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c index d0d892aaf..8c8a4ceeb 100644 --- a/hw/xfree86/dixmods/extmod/modinit.c +++ b/hw/xfree86/dixmods/extmod/modinit.c @@ -42,7 +42,7 @@ static ExtensionModule extensionModules[] = { { SELinuxExtensionInit, SELINUX_EXTENSION_NAME, - NULL, + &noSELinuxExtension, NULL, NULL }, @@ -258,6 +258,27 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin) } } } + +#ifdef XSELINUX + if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) { + pointer o; + selinuxEnforcingState = SELINUX_MODE_DEFAULT; + + if ((o = xf86FindOption(opts, "SELinux mode disabled"))) { + xf86MarkOptionUsed(o); + selinuxEnforcingState = SELINUX_MODE_DISABLED; + } + if ((o = xf86FindOption(opts, "SELinux mode permissive"))) { + xf86MarkOptionUsed(o); + selinuxEnforcingState = SELINUX_MODE_PERMISSIVE; + } + if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) { + xf86MarkOptionUsed(o); + selinuxEnforcingState = SELINUX_MODE_ENFORCING; + } + } +#endif + LoadExtension(&extensionModules[i], FALSE); } /* Need a non-NULL return */ diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index d035c762f..d6d22c4b9 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -440,6 +440,9 @@ _X_HIDDEN void *dixLookupTab[] = { #ifdef XIDLE SYMVAR(noXIdleExtension) #endif +#ifdef XSELINUX + SYMVAR(noSELinuxExtension) +#endif #ifdef XV SYMVAR(noXvExtension) #endif diff --git a/include/globals.h b/include/globals.h index b230dfc37..2ca9531d9 100644 --- a/include/globals.h +++ b/include/globals.h @@ -175,6 +175,16 @@ extern Bool noXInputExtension; extern Bool noXIdleExtension; #endif +#ifdef XSELINUX +extern Bool noSELinuxExtension; + +#define SELINUX_MODE_DEFAULT 0 +#define SELINUX_MODE_DISABLED 1 +#define SELINUX_MODE_PERMISSIVE 2 +#define SELINUX_MODE_ENFORCING 3 +extern int selinuxEnforcingState; +#endif + #ifdef XV extern Bool noXvExtension; #endif diff --git a/mi/miinitext.c b/mi/miinitext.c index 3c55eebb3..cc4c15c9d 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -215,6 +215,9 @@ extern Bool noXInputExtension; #ifdef XIDLE extern Bool noXIdleExtension; #endif +#ifdef XSELINUX +extern Bool noSELinuxExtension; +#endif #ifdef XV extern Bool noXvExtension; #endif @@ -487,6 +490,9 @@ static ExtensionToggle ExtensionToggleList[] = #endif #ifdef XKB { "XKEYBOARD", &noXkbExtension }, +#endif +#ifdef XSELINUX + { "SELinux", &noSELinuxExtension }, #endif { "XTEST", &noTestExtensions }, #ifdef XV @@ -597,7 +603,7 @@ InitExtensions(argc, argv) if (!noSecurityExtension) SecurityExtensionInit(); #endif #ifdef XSELINUX - SELinuxExtensionInit(); + if (!noSELinuxExtension) SELinuxExtensionInit(); #endif #ifdef XPRINT XpExtensionInit(); /* server-specific extension, cannot be disabled */ diff --git a/os/utils.c b/os/utils.c index 4041028a3..57293ab6f 100644 --- a/os/utils.c +++ b/os/utils.c @@ -232,6 +232,10 @@ _X_EXPORT Bool noXInputExtension = FALSE; #ifdef XIDLE _X_EXPORT Bool noXIdleExtension = FALSE; #endif +#ifdef XSELINUX +_X_EXPORT Bool noSELinuxExtension = FALSE; +_X_EXPORT int selinuxEnforcingState = SELINUX_MODE_DEFAULT; +#endif #ifdef XV _X_EXPORT Bool noXvExtension = FALSE; #endif From 88ece11d6c45c6f4b94f7fb2da64a46e879d7c27 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 3 Dec 2007 15:47:39 -0500 Subject: [PATCH 114/183] Start E-EDID support in the DDC module. Since there's no way to safely know how many blocks xf86DoEDID_DDC2 would return, add a new xf86DoEEDID entrypoint to do that, and implement the one in terms of the other. --- hw/xfree86/ddc/xf86DDC.c | 110 ++++++++++++++++++++++----------------- hw/xfree86/ddc/xf86DDC.h | 2 + 2 files changed, 65 insertions(+), 47 deletions(-) diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 28e2ead28..98f60061e 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -2,6 +2,14 @@ * * Copyright 1998,1999 by Egbert Eich */ + +/* + * Note that DDC1 does not define any method for returning blocks beyond + * the first. DDC2 does, but the original implementation would only ever + * read the first block. If you want to read and parse all blocks, use + * xf86DoEEDID(). + */ + #ifdef HAVE_XORG_CONFIG_H #include #endif @@ -31,11 +39,6 @@ static unsigned int *FetchEDID_DDC1( register unsigned int (*)(ScrnInfoPtr) ); -static unsigned char* EDID1Read_DDC2( - int scrnIndex, - I2CBusPtr pBus -); - static unsigned char * DDCRead_DDC2( int scrnIndex, I2CBusPtr pBus, @@ -107,6 +110,59 @@ xf86DoEDID_DDC1( return tmp; } +/** + * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are + * unset. EDID information blocks are interpreted and the results returned in + * an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return + * the complete EDID data, including all extension blocks. + * + * This function does not affect the list of modes used by drivers -- it is up + * to the driver to decide policy on what to do with EDID information. + * + * @return pointer to a new xf86MonPtr containing the EDID information. + * @return NULL if no monitor attached or failure to interpret the EDID. + * + * nblocks is an in/out parameter. If non-zero, it defines the number of + * blocks to read from the monitor; zero (or NULL pointer) means read all. + * If non-NULL, on return it will be filled in with the number of blocks + * read. + */ +xf86MonPtr +xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + unsigned char *EDID_block = NULL; + xf86MonPtr tmp = NULL; + /* Default DDC and DDC2 to enabled. */ + Bool noddc = FALSE, noddc2 = FALSE; + OptionInfoPtr options; + + options = xnfalloc(sizeof(DDCOptions)); + memcpy(options, DDCOptions, sizeof(DDCOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); + xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); + xfree(options); + + if (noddc || noddc2) + return NULL; + + EDID_block = DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN); + + if (EDID_block) + tmp = xf86InterpretEDID(scrnIndex, EDID_block); + + if (nblocks) { + if (tmp) + *nblocks = tmp->no_sections; + else + *nblocks = 0; + } + + return tmp; +} + /** * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are * unset. EDID information blocks are interpreted and the results returned in @@ -121,42 +177,8 @@ xf86DoEDID_DDC1( xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - unsigned char *EDID_block = NULL; - xf86MonPtr tmp = NULL; - /* Default DDC and DDC2 to enabled. */ - Bool noddc = FALSE, noddc2 = FALSE; - OptionInfoPtr options; - - options = xnfalloc(sizeof(DDCOptions)); - (void)memcpy(options, DDCOptions, sizeof(DDCOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); - - xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); - xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); - xfree(options); - - if (noddc || noddc2) - return NULL; - - EDID_block = EDID1Read_DDC2(scrnIndex,pBus); - - if (EDID_block){ - tmp = xf86InterpretEDID(scrnIndex,EDID_block); - } else { -#ifdef DEBUG - ErrorF("No EDID block returned\n"); -#endif - return NULL; - } -#ifdef DEBUG - if (!tmp) - ErrorF("Cannot interpret EDID block\n"); - else - ErrorF("Sections to follow: %i\n",tmp->no_sections); -#endif - - return tmp; + int nblocks = 1; + return xf86DoEEDID(scrnIndex, pBus, &nblocks); } /* @@ -226,12 +248,6 @@ FetchEDID_DDC1(register ScrnInfoPtr pScrn, return (ptr); } -static unsigned char* -EDID1Read_DDC2(int scrnIndex, I2CBusPtr pBus) -{ - return DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN); -} - static unsigned char * DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len) { diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h index 3b072dda7..6e5bf6f7a 100644 --- a/hw/xfree86/ddc/xf86DDC.h +++ b/hw/xfree86/ddc/xf86DDC.h @@ -35,6 +35,8 @@ extern xf86MonPtr xf86DoEDID_DDC2( I2CBusPtr pBus ); +extern xf86MonPtr xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks); + extern xf86MonPtr xf86PrintEDID( xf86MonPtr monPtr ); From 0b4aef4d6df7a5525d381de035fbbf78c5fffeef Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 3 Dec 2007 16:00:00 -0500 Subject: [PATCH 115/183] Refactor DDC2 code to allow for proper segmented addressing. --- hw/xfree86/ddc/xf86DDC.c | 132 +++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 68 deletions(-) diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 98f60061e..3e51c4e17 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -39,13 +39,6 @@ static unsigned int *FetchEDID_DDC1( register unsigned int (*)(ScrnInfoPtr) ); -static unsigned char * DDCRead_DDC2( - int scrnIndex, - I2CBusPtr pBus, - int start, - int len -); - typedef enum { DDCOPT_NODDC1, DDCOPT_NODDC2, @@ -110,6 +103,64 @@ xf86DoEDID_DDC1( return tmp; } +static I2CDevPtr +DDC2Init(int scrnIndex, I2CBusPtr pBus) +{ + I2CDevPtr dev = NULL; + /* + * Slow down the bus so that older monitors don't + * miss things. + */ + pBus->RiseFallTime = 20; + + if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) { + dev = xf86CreateI2CDevRec(); + dev->DevName = "ddc2"; + dev->SlaveAddr = 0xA0; + dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ + dev->StartTimeout = 550; + dev->BitTimeout = 40; + dev->AcknTimeout = 40; + + dev->pI2CBus = pBus; + if (!xf86I2CDevInit(dev)) { + xf86DrvMsg(scrnIndex, X_PROBED, "No DDC2 device\n"); + return NULL; + } + } + + return dev; +} + +static unsigned char * +DDC2Read(I2CDevPtr dev, int start, int len) +{ + unsigned char W_Buffer[2]; + int w_bytes; + unsigned char *R_Buffer; + int i; + + if (start < 0x100) { + w_bytes = 1; + W_Buffer[0] = start; + } else { + w_bytes = 2; + W_Buffer[0] = start & 0xFF; + W_Buffer[1] = (start & 0xFF00) >> 8; + } + + R_Buffer = xcalloc(sizeof(unsigned char), len); + for (i = 0; i < RETRIES; i++) { + if (xf86I2CWriteRead(dev, W_Buffer, w_bytes, R_Buffer, len)) { + if (!DDC_checksum(R_Buffer, len)) + return R_Buffer; + } + } + + xfree(R_Buffer); + return NULL; +} + /** * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are * unset. EDID information blocks are interpreted and the results returned in @@ -133,6 +184,7 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; unsigned char *EDID_block = NULL; xf86MonPtr tmp = NULL; + I2CDevPtr dev = NULL; /* Default DDC and DDC2 to enabled. */ Bool noddc = FALSE, noddc2 = FALSE; OptionInfoPtr options; @@ -144,11 +196,14 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); xfree(options); - + if (noddc || noddc2) return NULL; - EDID_block = DDCRead_DDC2(scrnIndex, pBus, 0, EDID1_LEN); + if (!(dev = DDC2Init(scrnIndex, pBus))) + return NULL; + + EDID_block = DDC2Read(dev, 0, EDID1_LEN); if (EDID_block) tmp = xf86InterpretEDID(scrnIndex, EDID_block); @@ -247,62 +302,3 @@ FetchEDID_DDC1(register ScrnInfoPtr pScrn, } while(--count); return (ptr); } - -static unsigned char * -DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len) -{ - I2CDevPtr dev; - unsigned char W_Buffer[2]; - int w_bytes; - unsigned char *R_Buffer; - int i; - - /* - * Slow down the bus so that older monitors don't - * miss things. - */ - pBus->RiseFallTime = 20; - - if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) { - dev = xf86CreateI2CDevRec(); - dev->DevName = "ddc2"; - dev->SlaveAddr = 0xA0; - dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ - dev->StartTimeout = 550; - dev->BitTimeout = 40; - dev->AcknTimeout = 40; - - dev->pI2CBus = pBus; - if (!xf86I2CDevInit(dev)) { - xf86DrvMsg(scrnIndex, X_PROBED, "No DDC2 device\n"); - return NULL; - } - } - if (start < 0x100) { - w_bytes = 1; - W_Buffer[0] = start; - } else { - w_bytes = 2; - W_Buffer[0] = start & 0xFF; - W_Buffer[1] = (start & 0xFF00) >> 8; - } - R_Buffer = xcalloc(1,sizeof(unsigned char) - * (len)); - for (i=0; i Date: Mon, 3 Dec 2007 17:38:53 -0500 Subject: [PATCH 116/183] Add E-EDID segment selection. --- hw/xfree86/ddc/xf86DDC.c | 105 ++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 34 deletions(-) diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 3e51c4e17..7e267227f 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -104,19 +104,14 @@ xf86DoEDID_DDC1( } static I2CDevPtr -DDC2Init(int scrnIndex, I2CBusPtr pBus) +DDC2MakeDevice(I2CBusPtr pBus, int address, char *name) { I2CDevPtr dev = NULL; - /* - * Slow down the bus so that older monitors don't - * miss things. - */ - pBus->RiseFallTime = 20; - - if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) { + + if (!(dev = xf86I2CFindDev(pBus, address))) { dev = xf86CreateI2CDevRec(); - dev->DevName = "ddc2"; - dev->SlaveAddr = 0xA0; + dev->DevName = name; + dev->SlaveAddr = address; dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ dev->StartTimeout = 550; dev->BitTimeout = 40; @@ -132,33 +127,70 @@ DDC2Init(int scrnIndex, I2CBusPtr pBus) return dev; } -static unsigned char * -DDC2Read(I2CDevPtr dev, int start, int len) +static I2CDevPtr +DDC2Init(int scrnIndex, I2CBusPtr pBus) { - unsigned char W_Buffer[2]; - int w_bytes; - unsigned char *R_Buffer; - int i; - - if (start < 0x100) { - w_bytes = 1; - W_Buffer[0] = start; - } else { - w_bytes = 2; - W_Buffer[0] = start & 0xFF; - W_Buffer[1] = (start & 0xFF00) >> 8; - } + I2CDevPtr dev = NULL; + + /* + * Slow down the bus so that older monitors don't + * miss things. + */ + pBus->RiseFallTime = 20; + + DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register"); + dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2"); + + return dev; +} + +/* Mmmm, smell the hacks */ +static void +EEDIDStop(I2CDevPtr d) +{ +} + +/* block is the EDID block number. a segment is two blocks. */ +static Bool +DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer) +{ + unsigned char W_Buffer[1]; + int i, segment; + I2CDevPtr seg; + void (*stop)(I2CDevPtr); - R_Buffer = xcalloc(sizeof(unsigned char), len); for (i = 0; i < RETRIES; i++) { - if (xf86I2CWriteRead(dev, W_Buffer, w_bytes, R_Buffer, len)) { - if (!DDC_checksum(R_Buffer, len)) - return R_Buffer; + /* Stop bits reset the segment pointer to 0, so be careful here. */ + segment = block >> 1; + if (segment) { + Bool b; + + if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060))) + return FALSE; + + W_Buffer[0] = segment; + + stop = dev->pI2CBus->I2CStop; + dev->pI2CBus->I2CStop = EEDIDStop; + + b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0); + + dev->pI2CBus->I2CStop = stop; + if (!b) { + dev->pI2CBus->I2CStop(dev); + continue; + } + } + + W_Buffer[0] = (block & 0x01) * EDID1_LEN; + + if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) { + if (!DDC_checksum(R_Buffer, EDID1_LEN)) + return TRUE; } } - xfree(R_Buffer); - return NULL; + return FALSE; } /** @@ -189,7 +221,9 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) Bool noddc = FALSE, noddc2 = FALSE; OptionInfoPtr options; - options = xnfalloc(sizeof(DDCOptions)); + options = xalloc(sizeof(DDCOptions)); + if (!options) + return NULL; memcpy(options, DDCOptions, sizeof(DDCOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); @@ -203,10 +237,13 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, int *nblocks) if (!(dev = DDC2Init(scrnIndex, pBus))) return NULL; - EDID_block = DDC2Read(dev, 0, EDID1_LEN); + EDID_block = xcalloc(1, EDID1_LEN); + if (!EDID_block) + return NULL; - if (EDID_block) + if (DDC2Read(dev, 0, EDID_block)) { tmp = xf86InterpretEDID(scrnIndex, EDID_block); + } if (nblocks) { if (tmp) From 933ffcdf7d2eaaf7caabfe6f861f04bcb149918f Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 28 Mar 2008 17:53:55 -0400 Subject: [PATCH 117/183] Compile fix. --- hw/xfree86/ddc/xf86DDC.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c index 7e267227f..8dda35ac4 100644 --- a/hw/xfree86/ddc/xf86DDC.c +++ b/hw/xfree86/ddc/xf86DDC.c @@ -119,7 +119,7 @@ DDC2MakeDevice(I2CBusPtr pBus, int address, char *name) dev->pI2CBus = pBus; if (!xf86I2CDevInit(dev)) { - xf86DrvMsg(scrnIndex, X_PROBED, "No DDC2 device\n"); + xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n"); return NULL; } } From bd28839eb866a9e6dc3ff80f13a67611da7eaf64 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 28 Mar 2008 17:02:02 -0700 Subject: [PATCH 118/183] =?UTF-8?q?=3D=3Futf-8=3Fq=3FXQuartz:=3D20Another?= =?UTF-8?q?=3D20Expos=3DC3=3DA9=3D20fix:=3D20F9=3D20doesn't=3D20raise=3D20?= =?UTF-8?q?all=3D20windows?= =20(cherry=20picked=20from=20commit=20b9cffa20debae73737c674bf75ab65db1bd74556)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit --- hw/xquartz/X11Application.m | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index b7c876365..e1581af90 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -314,14 +314,10 @@ static void message_kit_thread (SEL selector, NSObject *arg) { } - (void) set_front_process:unused { - /* Hackery needed due to argv[0] hackery */ - // [self activateX:YES]; - ProcessSerialNumber psn = { 0, kCurrentProcess }; - SetFrontProcess(&psn); + [NSApp activateIgnoringOtherApps:YES]; - QuartzMessageServerThread(kXDarwinBringAllToFront, 0); - ProcessSerialNumber psn = { 0, kCurrentProcess }; - SetFrontProcess(&psn); + if ([self modalWindow] == nil) + [self activateX:YES]; } - (void) set_can_quit:(NSNumber *)state { From b8ea9f2a25aad88aee77a68f8e20ac07276f0dab Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 28 Mar 2008 17:00:08 -0700 Subject: [PATCH 119/183] XQuartz: Fixed names of enums to be more consistent (cherry picked from commit c309a08806daf5d716a860c709e51eacad2c745a) --- hw/xquartz/X11Application.m | 10 +++---- hw/xquartz/X11Controller.m | 30 ++++++++++---------- hw/xquartz/darwin.c | 4 +-- hw/xquartz/darwin.h | 36 ++++++++++++------------ hw/xquartz/darwinEvents.c | 18 ++++++------ hw/xquartz/quartz.c | 56 ++++++++++++++++++------------------- hw/xquartz/quartzKeyboard.h | 2 +- hw/xquartz/xpr/xprScreen.c | 8 +++--- 8 files changed, 82 insertions(+), 82 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index e1581af90..31c80dfa8 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -153,7 +153,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] + [dict setObject:[NSString stringWithFormat:@"Xquartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] forKey:@"ApplicationVersion"]; [self orderFrontStandardAboutPanelWithOptions: dict]; @@ -166,7 +166,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { static TSMDocumentID x11_document; DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { - QuartzMessageServerThread (kXDarwinActivate, 0); + QuartzMessageServerThread (kXquartzActivate, 0); if (!_x_active) { if (x11_document == 0 && darwinKeymapFile == NULL) { @@ -178,7 +178,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { if (x11_document != 0) ActivateTSMDocument (x11_document); } } else { - QuartzMessageServerThread (kXDarwinDeactivate, 0); + QuartzMessageServerThread (kXquartzDeactivate, 0); if (_x_active && x11_document != 0) DeactivateTSMDocument (x11_document); @@ -246,7 +246,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { swallow_up = 0; for_x = NO; #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinToggleFullscreen, 0); + QuartzMessageServerThread (kXquartzToggleFullscreen, 0); #endif } } else { @@ -654,7 +654,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { /* This will end up at the end of the responder chain. */ - (void) copy:sender { - QuartzMessageServerThread (kXDarwinPasteboardNotify, 1, + QuartzMessageServerThread (kXquartzPasteboardNotify, 1, AppleWMCopyToPasteboard); } diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index dfa2074fd..aa9fa94be 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -103,7 +103,7 @@ { [NSApp activateIgnoringOtherApps:YES]; - QuartzMessageServerThread (kXDarwinControllerNotify, 2, + QuartzMessageServerThread (kXquartzControllerNotify, 2, AppleWMWindowMenuItem, [sender tag]); } @@ -254,7 +254,7 @@ [self remove_window_menu]; [self install_window_menu:list]; - QuartzMessageServerThread (kXDarwinControllerNotify, 1, + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMWindowMenuNotify); } @@ -539,20 +539,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (void) hide_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideWindow); else NSBeep (); /* FIXME: something here */ } - (IBAction)bring_to_front:sender { - QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront); + QuartzMessageServerThread(kXquartzControllerNotify, 1, AppleWMBringAllToFront); } - (IBAction)close_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMCloseWindow); else [[NSApp keyWindow] performClose:sender]; } @@ -560,7 +560,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)minimize_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMMinimizeWindow); else [[NSApp keyWindow] performMiniaturize:sender]; } @@ -568,19 +568,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)zoom_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMZoomWindow); else [[NSApp keyWindow] performZoom:sender]; } - (IBAction) next_window:sender { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMNextWindow); } - (IBAction) previous_window:sender { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMPreviousWindow); } - (IBAction) enable_fullscreen_changed:sender @@ -588,7 +588,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row int value = ![enable_fullscreen intValue]; #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinSetRootless, 1, value); + QuartzMessageServerThread (kXquartzSetRootless, 1, value); #endif [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value]; @@ -598,7 +598,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction) toggle_fullscreen:sender { #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXDarwinToggleFullscreen, 0); + QuartzMessageServerThread (kXquartzToggleFullscreen, 0); #endif } @@ -661,7 +661,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction) quit:sender { - QuartzMessageServerThread (kXDarwinQuit, 0); + QuartzMessageServerThread (kXquartzQuit, 0); } - (IBAction) x11_help:sender @@ -684,12 +684,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (void) applicationDidHide:(NSNotification *)notify { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideAll); } - (void) applicationDidUnhide:(NSNotification *)notify { - QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll); + QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMShowAll); } - (NSApplicationTerminateReply) applicationShouldTerminate:sender @@ -717,7 +717,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [X11App prefs_synchronize]; /* shutdown the X server, it will exit () for us. */ - QuartzMessageServerThread (kXDarwinQuit, 0); + QuartzMessageServerThread (kXquartzQuit, 0); /* In case it doesn't, exit anyway after a while. */ while (sleep (10) != 0) ; diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 20bcee592..0dbfafefa 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -150,7 +150,7 @@ void DarwinPrintBanner(void) { // this should change depending on which specific server we are building - ErrorF("XQuartz starting:\n"); + 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 ); } @@ -856,7 +856,7 @@ void ddxUseMsg( void ) */ void ddxGiveUp( void ) { - ErrorF( "Quitting XQuartz...\n" ); + ErrorF( "Quitting Xquartz...\n" ); //if (!quartzRootless) // quartzProcs->ReleaseScreens(); diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index 325122dfd..bd1b9a42a 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -90,34 +90,34 @@ extern int darwinMainScreenY; * Special ddx events understood by the X server */ enum { - kXDarwinUpdateModifiers // update all modifier keys + kXquartzUpdateModifiers // update all modifier keys = LASTEvent+1, // (from X.h list of event names) - kXDarwinUpdateButtons, // update state of mouse buttons 2 and up - kXDarwinScrollWheel, // scroll wheel event + kXquartzUpdateButtons, // update state of mouse buttons 2 and up + kXquartzScrollWheel, // scroll wheel event /* * Quartz-specific events -- not used in IOKit mode */ - kXDarwinActivate, // restore X drawing and cursor - kXDarwinDeactivate, // clip X drawing and switch to Aqua cursor - kXDarwinSetRootClip, // enable or disable drawing to the X screen - kXDarwinQuit, // kill the X server and release the display - kXDarwinReadPasteboard, // copy Mac OS X pasteboard into X cut buffer - kXDarwinWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard - kXDarwinBringAllToFront, // bring all X windows to front - kXDarwinToggleFullscreen, // Enable/Disable fullscreen mode - kXDarwinSetRootless, // Set rootless mode - kXDarwinSpaceChanged, // Spaces changed + kXquartzActivate, // restore X drawing and cursor + kXquartzDeactivate, // clip X drawing and switch to Aqua cursor + kXquartzSetRootClip, // enable or disable drawing to the X screen + kXquartzQuit, // kill the X server and release the display + kXquartzReadPasteboard, // copy Mac OS X pasteboard into X cut buffer + kXquartzWritePasteboard, // copy X cut buffer onto Mac OS X pasteboard + kXquartzBringAllToFront, // bring all X windows to front + kXquartzToggleFullscreen, // Enable/Disable fullscreen mode + kXquartzSetRootless, // Set rootless mode + kXquartzSpaceChanged, // Spaces changed /* * AppleWM events */ - kXDarwinControllerNotify, // send an AppleWMControllerNotify event - kXDarwinPasteboardNotify, // notify the WM to copy or paste + kXquartzControllerNotify, // send an AppleWMControllerNotify event + kXquartzPasteboardNotify, // notify the WM to copy or paste /* * Xplugin notification events */ - kXDarwinDisplayChanged, // display configuration has changed - kXDarwinWindowState, // window visibility state has changed - kXDarwinWindowMoved, // window has moved on screen + kXquartzDisplayChanged, // display configuration has changed + kXquartzWindowState, // window visibility state has changed + kXquartzWindowMoved, // window has moved on screen }; #define ENABLE_DEBUG_LOG 1 diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 22d895795..113cfc109 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -152,7 +152,7 @@ static void DarwinUpdateModifiers( /* * DarwinReleaseModifiers * This hacky function releases all modifier keys. It should be called when X11.app - * is deactivated (kXDarwinDeactivate) to prevent modifiers from getting stuck if they + * is deactivated (kXquartzDeactivate) to prevent modifiers from getting stuck if they * are held down during a "context" switch -- otherwise, we would miss the KeyUp. */ static void DarwinReleaseModifiers(void) { @@ -341,22 +341,22 @@ void ProcessInputEvents(void) { break; case MotionNotify: - ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n"); + ErrorF("Unexpected MotionNotify event in DarwinProcessInputEvents\n"); break; - case kXDarwinUpdateModifiers: - ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n"); + case kXquartzUpdateModifiers: + ErrorF("Unexpected kXquartzUpdateModifiers event in DarwinProcessInputEvents\n"); break; - case kXDarwinUpdateButtons: - ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n"); + case kXquartzUpdateButtons: + ErrorF("Unexpected kXquartzUpdateButtons event in DarwinProcessInputEvents\n"); break; - case kXDarwinScrollWheel: - ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n"); + case kXquartzScrollWheel: + ErrorF("Unexpected kXquartzScrollWheel event in DarwinProcessInputEvents\n"); break; - case kXDarwinDeactivate: + case kXquartzDeactivate: DarwinReleaseModifiers(); // fall through default: diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index a034c9fac..971c9b278 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -411,24 +411,24 @@ QuartzMessageServerThread( */ void QuartzProcessEvent(xEvent *xe) { switch (xe->u.u.type) { - case kXDarwinControllerNotify: - DEBUG_LOG("kXDarwinControllerNotify\n"); + case kXquartzControllerNotify: + DEBUG_LOG("kXquartzControllerNotify\n"); AppleWMSendEvent(AppleWMControllerNotify, AppleWMControllerNotifyMask, xe->u.clientMessage.u.l.longs0, xe->u.clientMessage.u.l.longs1); break; - case kXDarwinPasteboardNotify: - DEBUG_LOG("kXDarwinPasteboardNotify\n"); + case kXquartzPasteboardNotify: + DEBUG_LOG("kXquartzPasteboardNotify\n"); AppleWMSendEvent(AppleWMPasteboardNotify, AppleWMPasteboardNotifyMask, xe->u.clientMessage.u.l.longs0, xe->u.clientMessage.u.l.longs1); break; - case kXDarwinActivate: - DEBUG_LOG("kXDarwinActivate\n"); + case kXquartzActivate: + DEBUG_LOG("kXquartzActivate\n"); QuartzShow(xe->u.keyButtonPointer.rootX, xe->u.keyButtonPointer.rootY); AppleWMSendEvent(AppleWMActivationNotify, @@ -436,74 +436,74 @@ void QuartzProcessEvent(xEvent *xe) { AppleWMIsActive, 0); break; - case kXDarwinDeactivate: - DEBUG_LOG("kXDarwinDeactivate\n"); + case kXquartzDeactivate: + DEBUG_LOG("kXquartzDeactivate\n"); AppleWMSendEvent(AppleWMActivationNotify, AppleWMActivationNotifyMask, AppleWMIsInactive, 0); QuartzHide(); break; - case kXDarwinDisplayChanged: - DEBUG_LOG("kXDarwinDisplayChanged\n"); + case kXquartzDisplayChanged: + DEBUG_LOG("kXquartzDisplayChanged\n"); QuartzUpdateScreens(); break; - case kXDarwinWindowState: - DEBUG_LOG("kXDarwinWindowState\n"); + case kXquartzWindowState: + DEBUG_LOG("kXquartzWindowState\n"); RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0, xe->u.clientMessage.u.l.longs1); break; - case kXDarwinWindowMoved: - DEBUG_LOG("kXDarwinWindowMoved\n"); + case kXquartzWindowMoved: + DEBUG_LOG("kXquartzWindowMoved\n"); RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0); break; - case kXDarwinToggleFullscreen: - DEBUG_LOG("kXDarwinToggleFullscreen\n"); + case kXquartzToggleFullscreen: + DEBUG_LOG("kXquartzToggleFullscreen\n"); #ifdef DARWIN_DDX_MISSING if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot); else if (quartzHasRoot) QuartzHide(); else QuartzShow(); #else - // ErrorF("kXDarwinToggleFullscreen not implemented\n"); + // ErrorF("kXquartzToggleFullscreen not implemented\n"); #endif break; - case kXDarwinSetRootless: - DEBUG_LOG("kXDarwinSetRootless\n"); + case kXquartzSetRootless: + DEBUG_LOG("kXquartzSetRootless\n"); #ifdef DARWIN_DDX_MISSING QuartzSetRootless(xe->u.clientMessage.u.l.longs0); if (!quartzEnableRootless && !quartzHasRoot) QuartzHide(); #else - // ErrorF("kXDarwinSetRootless not implemented\n"); + // ErrorF("kXquartzSetRootless not implemented\n"); #endif break; - case kXDarwinSetRootClip: + case kXquartzSetRootClip: QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0); break; - case kXDarwinQuit: + case kXquartzQuit: GiveUp(0); break; - case kXDarwinReadPasteboard: + case kXquartzReadPasteboard: QuartzReadPasteboard(); break; - case kXDarwinWritePasteboard: + case kXquartzWritePasteboard: QuartzWritePasteboard(); break; - case kXDarwinBringAllToFront: - DEBUG_LOG("kXDarwinBringAllToFront\n"); + case kXquartzBringAllToFront: + DEBUG_LOG("kXquartzBringAllToFront\n"); RootlessOrderAllWindows(); break; - case kXDarwinSpaceChanged: - DEBUG_LOG("kXDarwinSpaceChanged\n"); + case kXquartzSpaceChanged: + DEBUG_LOG("kXquartzSpaceChanged\n"); QuartzSpaceChanged(xe->u.clientMessage.u.l.longs0); break; default: diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h index 0c7e70e48..8131b5650 100644 --- a/hw/xquartz/quartzKeyboard.h +++ b/hw/xquartz/quartzKeyboard.h @@ -45,7 +45,7 @@ typedef struct darwinKeyboardInfo_struct { unsigned char modifierKeycodes[32][2]; } darwinKeyboardInfo; -/* These functions need to be implemented by XQuartz, XDarwin, etc. */ +/* These functions need to be implemented by Xquartz, XDarwin, etc. */ void DarwinKeyboardReload(DeviceIntPtr pDev); Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info); unsigned int QuartzSystemKeymapSeed(void); diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 4dc5846d5..b653a6e3b 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -67,7 +67,7 @@ static void eventHandler(unsigned int type, const void *arg, switch (type) { case XP_EVENT_DISPLAY_CHANGED: DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); + QuartzMessageServerThread(kXquartzDisplayChanged, 0); break; case XP_EVENT_WINDOW_STATE_CHANGED: @@ -75,7 +75,7 @@ static void eventHandler(unsigned int type, const void *arg, const xp_window_state_event *ws_arg = arg; DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state); - QuartzMessageServerThread(kXDarwinWindowState, 2, + QuartzMessageServerThread(kXquartzWindowState, 2, ws_arg->id, ws_arg->state); } else { DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); @@ -87,7 +87,7 @@ static void eventHandler(unsigned int type, const void *arg, if (arg_size == sizeof(xp_window_id)) { xp_window_id id = * (xp_window_id *) arg; WindowPtr pWin = xprGetXWindow(id); - QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); + QuartzMessageServerThread(kXquartzWindowMoved, 1, pWin); } break; @@ -110,7 +110,7 @@ static void eventHandler(unsigned int type, const void *arg, ErrorF("XP_EVENT_SPACE_CHANGED\n"); if(arg_size == sizeof(uint32_t)) { uint32_t space_id = *(uint32_t *)arg; - QuartzMessageServerThread(kXDarwinSpaceChanged, 1, space_id); + QuartzMessageServerThread(kXquartzSpaceChanged, 1, space_id); } break; default: From 7034484f0887ea0f8ab956515f2d9301ea5842ce Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 28 Mar 2008 10:23:36 +0200 Subject: [PATCH 120/183] gitignore: Add two more bits Get slightly better at ignoring vim swap files, and let people keep local changes if they want to. --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fb2f7e597..837b0380b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,11 +8,12 @@ Makefile.in *.a *.o *~ -.*.swp +.*sw? *.pbxuser *.mode1v3 obj* build* +local aclocal.m4 autom4te.cache compile From 93d876891dbba41b920a9a29a5de77f647f43928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Mon, 31 Mar 2008 21:15:50 +0200 Subject: [PATCH 121/183] EXA: Improve the algorithm used for tracking offscreen pixmap use. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the current score keeping algorithm with a rolling counter that's incremented in ExaOffscreenMarkUsed, with the previous value being stored in the area. exaOffscreenAlloc uses the difference between the counter value and the value in the area when deciding which area to evict. It now also takes the size of the areas into account, and favors evicting smaller areas. The credit for these ideas goes to Michel Dänzer. --- exa/exa.h | 2 +- exa/exa_offscreen.c | 36 ++++++++++++++---------------------- exa/exa_priv.h | 1 + 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/exa/exa.h b/exa/exa.h index 0774a700a..97ae6c0a5 100644 --- a/exa/exa.h +++ b/exa/exa.h @@ -56,7 +56,7 @@ struct _ExaOffscreenArea { int base_offset; /* allocation base */ int offset; /* aligned offset */ int size; /* total allocation size */ - int score; + unsigned last_use; pointer privData; ExaOffscreenSaveProc save; diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index c666b001b..2701e84cf 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -71,6 +71,8 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area) return exaOffscreenFree (pScreen, area); } +#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use)) + /** * exaOffscreenAlloc allocates offscreen memory * @@ -98,7 +100,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, { ExaOffscreenArea *area, *begin, *best; ExaScreenPriv (pScreen); - int tmp, real_size = 0, best_score; + int tmp, real_size = 0; #if DEBUG_OFFSCREEN static int number = 0; ErrorF("================= ============ allocating a new pixmap %d\n", ++number); @@ -143,6 +145,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, if (!area) { + double best_score; /* * Kick out existing users to make space. * @@ -151,11 +154,12 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, /* prev points at the first object to boot */ best = NULL; - best_score = INT_MAX; + best_score = UINT_MAX; for (begin = pExaScr->info->offScreenAreas; begin != NULL; begin = begin->next) { - int avail, score; + int avail; + double score; ExaOffscreenArea *scan; if (begin->state == ExaOffscreenLocked) @@ -177,8 +181,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, begin = scan; break; } - /* Score should only be non-zero for ExaOffscreenRemovable */ - score += scan->score; + score += AREA_SCORE(scan); avail += scan->size; if (avail >= real_size) break; @@ -230,7 +233,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, new_area->size = area->size - real_size; new_area->state = ExaOffscreenAvail; new_area->save = NULL; - new_area->score = 0; + new_area->last_use = 0; new_area->next = area->next; area->next = new_area; area->size = real_size; @@ -244,7 +247,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, area->state = ExaOffscreenRemovable; area->privData = privData; area->save = save; - area->score = 0; + area->last_use = pExaScr->offScreenCounter++; area->offset = (area->base_offset + align - 1); area->offset -= area->offset % align; @@ -395,7 +398,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area) area->state = ExaOffscreenAvail; area->save = NULL; - area->score = 0; + area->last_use = 0; /* * Find previous area */ @@ -427,23 +430,11 @@ ExaOffscreenMarkUsed (PixmapPtr pPixmap) { ExaPixmapPriv (pPixmap); ExaScreenPriv (pPixmap->drawable.pScreen); - static int iter = 0; if (!pExaPixmap || !pExaPixmap->area) return; - /* The numbers here are arbitrary. We may want to tune these. */ - pExaPixmap->area->score += 100; - if (++iter == 10) { - ExaOffscreenArea *area; - for (area = pExaScr->info->offScreenAreas; area != NULL; - area = area->next) - { - if (area->state == ExaOffscreenRemovable) - area->score = (area->score * 7) / 8; - } - iter = 0; - } + pExaPixmap->area->last_use = pExaScr->offScreenCounter++; } /** @@ -472,10 +463,11 @@ exaOffscreenInit (ScreenPtr pScreen) area->size = pExaScr->info->memorySize - area->base_offset; area->save = NULL; area->next = NULL; - area->score = 0; + area->last_use = 0; /* Add it to the free areas */ pExaScr->info->offScreenAreas = area; + pExaScr->offScreenCounter = 1; ExaOffscreenValidate (pScreen); diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 89f47184f..e41f46aba 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -120,6 +120,7 @@ typedef struct { Bool checkDirtyCorrectness; unsigned disableFbCount; Bool optimize_migration; + unsigned offScreenCounter; } ExaScreenPrivRec, *ExaScreenPrivPtr; /* From 8074676d2df8d577b443e3fa5e22d7c71c944bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Mon, 31 Mar 2008 21:24:59 +0200 Subject: [PATCH 122/183] EXA: Optimize the eviction scanning loop in exaOffscreenAlloc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce the cost of the inner loop, by keeping a set of pointers to the first and the last areas in the series, subtracting the cost of the first area from the score, and adding the cost of the last area while walking the list. This commit also moves the scanning loop from exaOffscreenAlloc into a separate function. Idea by Michel Dänzer. --- exa/exa_offscreen.c | 106 ++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 48 deletions(-) diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c index 2701e84cf..85b538896 100644 --- a/exa/exa_offscreen.c +++ b/exa/exa_offscreen.c @@ -73,6 +73,62 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area) #define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use)) +static ExaOffscreenArea * +exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align) +{ + ExaOffscreenArea *begin, *end, *best; + double score, best_score; + int avail, real_size, tmp; + + best_score = UINT_MAX; + begin = end = pExaScr->info->offScreenAreas; + avail = 0; + score = 0; + best = 0; + + while (end != NULL) + { + restart: + while (begin != NULL && begin->state == ExaOffscreenLocked) + begin = end = begin->next; + + if (begin == NULL) + break; + + /* adjust size needed to account for alignment loss for this area */ + real_size = size; + tmp = begin->base_offset % align; + if (tmp) + real_size += (align - tmp); + + while (avail < real_size && end != NULL) + { + if (end->state == ExaOffscreenLocked) { + /* Can't more room here, restart after this locked area */ + avail = 0; + score = 0; + begin = end; + goto restart; + } + avail += end->size; + score += AREA_SCORE(end); + end = end->next; + } + + /* Check the score, update best */ + if (avail >= real_size && score < best_score) { + best = begin; + best_score = score; + } + + avail -= begin->size; + score -= AREA_SCORE(begin); + begin = begin->next; + } + + return best; +} + /** * exaOffscreenAlloc allocates offscreen memory * @@ -98,7 +154,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, ExaOffscreenSaveProc save, pointer privData) { - ExaOffscreenArea *area, *begin, *best; + ExaOffscreenArea *area; ExaScreenPriv (pScreen); int tmp, real_size = 0; #if DEBUG_OFFSCREEN @@ -145,54 +201,8 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align, if (!area) { - double best_score; - /* - * Kick out existing users to make space. - * - * First, locate a region which can hold the desired object. - */ + area = exaFindAreaToEvict(pExaScr, size, align); - /* prev points at the first object to boot */ - best = NULL; - best_score = UINT_MAX; - for (begin = pExaScr->info->offScreenAreas; begin != NULL; - begin = begin->next) - { - int avail; - double score; - ExaOffscreenArea *scan; - - if (begin->state == ExaOffscreenLocked) - continue; - - /* adjust size needed to account for alignment loss for this area */ - real_size = size; - tmp = begin->base_offset % align; - if (tmp) - real_size += (align - tmp); - - avail = 0; - score = 0; - /* now see if we can make room here, and how "costly" it'll be. */ - for (scan = begin; scan != NULL; scan = scan->next) - { - if (scan->state == ExaOffscreenLocked) { - /* Can't make room here, start after this locked area. */ - begin = scan; - break; - } - score += AREA_SCORE(scan); - avail += scan->size; - if (avail >= real_size) - break; - } - /* Is it the best option we've found so far? */ - if (avail >= real_size && score < best_score) { - best = begin; - best_score = score; - } - } - area = best; if (!area) { DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size)); From c40e0b51f0d9ef5e1f30f233d7db1e6db9d6681b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 26 Mar 2008 19:28:09 -0400 Subject: [PATCH 123/183] Implement DRI2 direct rendering and update AIGLX to DRI interface changes. Get rid of glcontextmodes.[ch] from build, rename __GlcontextModes to __GLXcontext. Drop all #includes of glcontextmodes.h and glcore.h. Drop the DRI context modes extension. Add protocol code to DRI2 module and load DRI2 extension by default. --- GL/glx/Makefile.am | 2 - GL/glx/glxcmds.c | 51 ++-- GL/glx/glxcontext.h | 6 +- GL/glx/glxdrawable.h | 2 +- GL/glx/glxdri.c | 257 ++++++++++---------- GL/glx/glxdri2.c | 427 ++++++++++++++++++++++----------- GL/glx/glxglcore.c | 56 +++-- GL/glx/glxscreens.c | 55 +++-- GL/glx/glxscreens.h | 88 ++++++- GL/glx/glxutil.c | 5 +- GL/glx/glxutil.h | 2 +- GL/symlink-mesa.sh | 2 - configure.ac | 2 +- hw/xfree86/common/xf86Config.c | 1 + hw/xfree86/dri2/Makefile.am | 5 +- hw/xfree86/dri2/dri2.c | 107 ++++++--- hw/xfree86/dri2/dri2.h | 16 +- hw/xfree86/dri2/dri2ext.c | 361 ++++++++++++++++++++++++++++ os/utils.c | 3 + 19 files changed, 1054 insertions(+), 394 deletions(-) create mode 100644 hw/xfree86/dri2/dri2ext.c diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 377d76019..1d4719c88 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -31,8 +31,6 @@ INCLUDES = \ nodist_libglx_la_SOURCES = indirect_size.h \ glapi.c \ - glcontextmodes.c \ - glcontextmode.h \ glthread.c \ indirect_dispatch.c \ indirect_dispatch.h \ diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index 3b79cca20..36aae61b9 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -50,7 +50,6 @@ #include #include "glxutil.h" #include "glxext.h" -#include "glcontextmodes.h" #include "glapitable.h" #include "glapi.h" #include "glthread.h" @@ -83,9 +82,9 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) static int validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id, - __GLcontextModes **config, int *err) + __GLXconfig **config, int *err) { - __GLcontextModes *m; + __GLXconfig *m; for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) if (m->fbconfigID == id) { @@ -101,7 +100,7 @@ validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id, static int validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id, - __GLcontextModes **config, int *err) + __GLXconfig **config, int *err) { int i; @@ -118,7 +117,7 @@ validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id, } static int -validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config, +validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config, DrawablePtr pDraw, int *err) { ScreenPtr pScreen = pDraw->pScreen; @@ -135,7 +134,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config, } /* FIXME: What exactly should we check here... */ - if (pVisual->class != _gl_convert_to_x_visual_type(config->visualType) || + if (pVisual->class != glxConvertToXVisualType(config->visualType) || !(config->drawableType & GLX_WINDOW_BIT)) { client->errorValue = pDraw->id; *err = BadMatch; @@ -161,7 +160,7 @@ static void __glXdirectContextDestroy(__GLXcontext *context) } static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, - __GLcontextModes *modes, + __GLXconfig *modes, __GLXcontext *shareContext) { __GLXcontext *context; @@ -186,7 +185,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen, static int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, - GLXContextID shareList, __GLcontextModes *config, + GLXContextID shareList, __GLXconfig *config, __GLXscreen *pGlxScreen, GLboolean isDirect) { ClientPtr client = cl->client; @@ -248,7 +247,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, ** a GL core that needs windowing information (e.g., Mesa). */ glxc->pGlxScreen = pGlxScreen; - glxc->modes = config; + glxc->config = config; /* ** Register this context as a resource. @@ -276,7 +275,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; int err; @@ -292,7 +291,7 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc) { xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; int err; @@ -309,7 +308,7 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; int err; @@ -462,7 +461,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, * GLXPixmap and we just return the __GLXdrawable. */ pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes); if (pGlxDraw != NULL) { - if (glxc != NULL && pGlxDraw->modes != glxc->modes) { + if (glxc != NULL && pGlxDraw->config != glxc->config) { client->errorValue = drawId; *error = BadMatch; return NULL; @@ -497,12 +496,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, * the context screen and that the context fbconfig is compatible * with the window visual. */ if (pDraw->pScreen != glxc->pGlxScreen->pScreen || - !validGlxFBConfigForWindow(client, glxc->modes, pDraw, error)) + !validGlxFBConfigForWindow(client, glxc->config, pDraw, error)) return NULL; pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen, pDraw, GLX_DRAWABLE_WINDOW, - drawId, glxc->modes); + drawId, glxc->config); /* since we are creating the drawablePrivate, drawId should be new */ if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) { @@ -878,7 +877,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; xGLXGetVisualConfigsReply reply; __GLXscreen *pGlxScreen; - __GLcontextModes *modes; + __GLXconfig *modes; CARD32 buf[__GLX_TOTAL_CONFIG]; int p, i, err; __GLX_DECLARE_SWAP_VARIABLES; @@ -907,7 +906,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) p = 0; buf[p++] = modes->visualID; - buf[p++] = _gl_convert_to_x_visual_type( modes->visualType ); + buf[p++] = glxConvertToXVisualType( modes->visualType ); buf[p++] = modes->rgbMode; buf[p++] = modes->redBits; @@ -980,7 +979,7 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen) __GLXscreen *pGlxScreen; CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH]; int p, err; - __GLcontextModes *modes; + __GLXconfig *modes; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; @@ -1062,7 +1061,7 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) } static int -DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config, +DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, DrawablePtr pDraw, XID glxDrawableId, int type) { __GLXdrawable *pGlxDraw; @@ -1086,7 +1085,7 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes } static int -DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config, +DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config, XID drawableId, XID glxDrawableId) { DrawablePtr pDraw; @@ -1144,7 +1143,7 @@ determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs) int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; int err; @@ -1160,7 +1159,7 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc) { xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; int err; @@ -1184,7 +1183,7 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; int err; @@ -1246,7 +1245,7 @@ static int DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, int width, int height, XID glxDrawableId) { - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; PixmapPtr pPixmap; int err; @@ -1359,7 +1358,7 @@ int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) { xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; - __GLcontextModes *config; + __GLXconfig *config; __GLXscreen *pGlxScreen; ClientPtr client = cl->client; DrawablePtr pDraw; @@ -1473,7 +1472,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId) *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; *pSendBuf++ = (int)(ctx->share_id); *pSendBuf++ = GLX_VISUAL_ID_EXT; - *pSendBuf++ = (int)(ctx->modes->visualID); + *pSendBuf++ = (int)(ctx->config->visualID); *pSendBuf++ = GLX_SCREEN_EXT; *pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum); diff --git a/GL/glx/glxcontext.h b/GL/glx/glxcontext.h index 4c36801c1..18d3c6fe5 100644 --- a/GL/glx/glxcontext.h +++ b/GL/glx/glxcontext.h @@ -40,8 +40,6 @@ ** */ -#include "GL/internal/glcore.h" - typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap; struct __GLXtextureFromPixmap { int (*bindTexImage) (__GLXcontext *baseContext, @@ -77,9 +75,9 @@ struct __GLXcontext { __GLXcontext *nextReadPriv; /* - ** mode struct for this context + ** config struct for this context */ - __GLcontextModes *modes; + __GLXconfig *config; /* ** Pointer to screen info data for this context. This is set diff --git a/GL/glx/glxdrawable.h b/GL/glx/glxdrawable.h index f62d1ee34..98e301b88 100644 --- a/GL/glx/glxdrawable.h +++ b/GL/glx/glxdrawable.h @@ -74,7 +74,7 @@ struct __GLXdrawable { /* ** Configuration of the visual to which this drawable was created. */ - __GLcontextModes *modes; + __GLXconfig *config; /* ** Lists of contexts bound to this drawable. There are two lists here. diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index 1e1791122..ffa9a0b76 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -52,7 +52,6 @@ #define DRI_NEW_INTERFACE_ONLY #include "glxserver.h" #include "glxutil.h" -#include "glcontextmodes.h" #include "g_disptab.h" #include "glapitable.h" @@ -61,26 +60,26 @@ #include "dispatch.h" #include "extension_string.h" -#define containerOf(ptr, type, member) \ - (type *)( (char *)ptr - offsetof(type,member) ) - typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; +typedef struct __GLXDRIconfig __GLXDRIconfig; struct __GLXDRIscreen { __GLXscreen base; - __DRIscreen driScreen; + __DRIscreen *driScreen; void *driver; xf86EnterVTProc *enterVT; xf86LeaveVTProc *leaveVT; - __DRIcopySubBufferExtension *copySubBuffer; - __DRIswapControlExtension *swapControl; + const __DRIcoreExtension *core; + const __DRIlegacyExtension *legacy; + const __DRIcopySubBufferExtension *copySubBuffer; + const __DRIswapControlExtension *swapControl; #ifdef __DRI_TEX_OFFSET - __DRItexOffsetExtension *texOffset; + const __DRItexOffsetExtension *texOffset; DRITexOffsetStartProcPtr texOffsetStart; DRITexOffsetFinishProcPtr texOffsetFinish; __GLXDRIdrawable *texOffsetOverride[16]; @@ -92,13 +91,13 @@ struct __GLXDRIscreen { struct __GLXDRIcontext { __GLXcontext base; - __DRIcontext driContext; + __DRIcontext *driContext; XID hwContextID; }; struct __GLXDRIdrawable { __GLXdrawable base; - __DRIdrawable driDrawable; + __DRIdrawable *driDrawable; /* Pulled in from old __GLXpixmap */ #ifdef __DRI_TEX_OFFSET @@ -109,7 +108,10 @@ struct __GLXDRIdrawable { #endif }; -static const char CREATE_NEW_SCREEN_FUNC[] = __DRI_CREATE_NEW_SCREEN_STRING; +struct __GLXDRIconfig { + __GLXconfig config; + __DRIconfig *driConfig; +}; static void __glXDRIleaveServer(GLboolean rendering) @@ -151,7 +153,7 @@ __glXDRIleaveServer(GLboolean rendering) __GLXDRIdrawable *pGlxPix = texOffsetOverride[j]; if (pGlxPix && pGlxPix->texname) { - screen->texOffset->setTexOffset(&pGlxPix->ctx->driContext, + screen->texOffset->setTexOffset(pGlxPix->ctx->driContext, pGlxPix->texname, pGlxPix->offset, pGlxPix->base.pDraw->depth, @@ -219,24 +221,24 @@ static void __glXDRIdrawableDestroy(__GLXdrawable *drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; - + __GLXDRIscreen *screen; int i; for (i = 0; i < screenInfo.numScreens; i++) { - __glXDRIdoReleaseTexImage((__GLXDRIscreen *) - glxGetScreen(screenInfo.screens[i]), - private); + screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]); + __glXDRIdoReleaseTexImage(screen, private); } - (*private->driDrawable.destroyDrawable)(&private->driDrawable); - /* If the X window was destroyed, the dri DestroyWindow hook will * aready have taken care of this, so only call if pDraw isn't NULL. */ if (drawable->pDraw != NULL) { - __glXenterServer(GL_FALSE); - DRIDestroyDrawable(drawable->pDraw->pScreen, - serverClient, drawable->pDraw); - __glXleaveServer(GL_FALSE); + screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen); + (*screen->core->destroyDrawable)(private->driDrawable); + + __glXenterServer(GL_FALSE); + DRIDestroyDrawable(drawable->pDraw->pScreen, + serverClient, drawable->pDraw); + __glXleaveServer(GL_FALSE); } xfree(private); @@ -255,8 +257,10 @@ static GLboolean __glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; + __GLXDRIscreen *screen = + (__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen); - (*private->driDrawable.swapBuffers)(&private->driDrawable); + (*screen->core->swapBuffers)(private->driDrawable); return TRUE; } @@ -266,11 +270,11 @@ static int __glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval) { __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable; - __GLXDRIscreen *screen = (__GLXDRIscreen *) - glxGetScreen(baseDrawable->pDraw->pScreen); + __GLXDRIscreen *screen = + (__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen); if (screen->swapControl) - screen->swapControl->setSwapInterval(&draw->driDrawable, interval); + screen->swapControl->setSwapInterval(draw->driDrawable, interval); return 0; } @@ -285,20 +289,21 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate, glxGetScreen(basePrivate->pDraw->pScreen); if (screen->copySubBuffer) - screen->copySubBuffer->copySubBuffer(&private->driDrawable, - x, y, w, h); + screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h); } static void __glXDRIcontextDestroy(__GLXcontext *baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; Bool retval; - context->driContext.destroyContext(&context->driContext); + screen->core->destroyContext(context->driContext); __glXenterServer(GL_FALSE); - retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen, context->hwContextID); + retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen, + context->hwContextID); __glXleaveServer(GL_FALSE); __glXContextDestroy(&context->base); @@ -309,20 +314,22 @@ static int __glXDRIcontextMakeCurrent(__GLXcontext *baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; - return (*context->driContext.bindContext)(&context->driContext, - &draw->driDrawable, - &read->driDrawable); + return (*screen->core->bindContext)(context->driContext, + draw->driDrawable, + read->driDrawable); } static int __glXDRIcontextLoseCurrent(__GLXcontext *baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; - return (*context->driContext.unbindContext)(&context->driContext); + return (*screen->core->unbindContext)(context->driContext); } static int @@ -331,13 +338,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, { __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst; __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc; + __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen; - /* FIXME: We will need to add DRIcontext::copyContext for this. */ - - (void) dst; - (void) src; - - return FALSE; + return (*screen->core->copyContext)(dst->driContext, + src->driContext, mask); } static int @@ -346,10 +350,11 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext) __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; - return (*context->driContext.bindContext)(&context->driContext, - &draw->driDrawable, - &read->driDrawable); + return (*screen->core->bindContext)(context->driContext, + draw->driDrawable, + read->driDrawable); } static void @@ -392,10 +397,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, int bpp, override = 0, texname; GLenum format, type; ScreenPtr pScreen = glxPixmap->pDraw->pScreen; - __GLXDRIdrawable *driDraw = - containerOf(glxPixmap, __GLXDRIdrawable, base); - __GLXDRIscreen * const screen = - (__GLXDRIscreen *) glxGetScreen(pScreen); + __GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap; + __GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen); CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ? GL_TEXTURE_BINDING_2D : @@ -439,7 +442,7 @@ alreadyin: driDraw->texname = texname; - screen->texOffset->setTexOffset(&driDraw->ctx->driContext, texname, 0, + screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0, pixmap->drawable.depth, pixmap->devKind); } @@ -568,9 +571,11 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext, int buffer, __GLXdrawable *pixmap) { - __glXDRIdoReleaseTexImage((__GLXDRIscreen *) - glxGetScreen(pixmap->pDraw->pScreen), - containerOf(pixmap, __GLXDRIdrawable, base)); + __GLXDRIscreen *screen = + (__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen); + __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap; + + __glXDRIdoReleaseTexImage(screen, drawable); return Success; } @@ -585,7 +590,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) { __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; - screen->driScreen.destroyScreen(&screen->driScreen); + screen->core->destroyScreen(screen->driScreen); dlclose(screen->driver); @@ -596,11 +601,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) static __GLXcontext * __glXDRIscreenCreateContext(__GLXscreen *baseScreen, - __GLcontextModes *modes, + __GLXconfig *glxConfig, __GLXcontext *baseShareContext) { __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; __GLXDRIcontext *context, *shareContext; + __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; VisualPtr visual; int i; GLboolean retval; @@ -610,7 +616,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, shareContext = (__GLXDRIcontext *) baseShareContext; if (shareContext) - driShare = &shareContext->driContext; + driShare = shareContext->driContext; else driShare = NULL; @@ -632,7 +638,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, /* Find the requested X visual */ visual = pScreen->visuals; for (i = 0; i < pScreen->numVisuals; i++, visual++) - if (visual->vid == modes->visualID) + if (visual->vid == glxConfig->visualID) break; if (i == pScreen->numVisuals) return GL_FALSE; @@ -644,15 +650,15 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, context->hwContextID, &hwContext); __glXleaveServer(GL_FALSE); - context->driContext.private = - screen->driScreen.createNewContext(&screen->driScreen, - modes, - 0, /* render type */ - driShare, - hwContext, - &context->driContext); + context->driContext = + screen->legacy->createNewContext(screen->driScreen, + config->driConfig, + 0, /* render type */ + driShare, + hwContext, + context); - if (context->driContext.private == NULL) { + if (context->driContext == NULL) { __glXenterServer(GL_FALSE); retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID); __glXleaveServer(GL_FALSE); @@ -668,9 +674,10 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, int type, XID drawId, - __GLcontextModes *modes) + __GLXconfig *glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; + __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; __GLXDRIdrawable *private; GLboolean retval; drm_drawable_t hwDrawable; @@ -682,7 +689,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, memset(private, 0, sizeof *private); if (!__glXDrawableInit(&private->base, screen, - pDraw, type, drawId, modes)) { + pDraw, type, drawId, glxConfig)) { xfree(private); return NULL; } @@ -700,13 +707,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, /* The last argument is 'attrs', which is used with pbuffers which * we currently don't support. */ - private->driDrawable.private = - (driScreen->driScreen.createNewDrawable)(&driScreen->driScreen, - modes, - &private->driDrawable, - hwDrawable, 0, 0, NULL); + private->driDrawable = + (driScreen->legacy->createNewDrawable)(driScreen->driScreen, + config->driConfig, + hwDrawable, 0, NULL, private); - if (private->driDrawable.private == NULL) { + if (private->driDrawable == NULL) { __glXenterServer(GL_FALSE); DRIDestroyDrawable(screen->pScreen, serverClient, pDraw); __glXleaveServer(GL_FALSE); @@ -723,10 +729,10 @@ getDrawableInfo(__DRIdrawable *driDrawable, int *x, int *y, int *width, int *height, int *numClipRects, drm_clip_rect_t **ppClipRects, int *backX, int *backY, - int *numBackClipRects, drm_clip_rect_t **ppBackClipRects) + int *numBackClipRects, drm_clip_rect_t **ppBackClipRects, + void *data) { - __GLXDRIdrawable *drawable = containerOf(driDrawable, - __GLXDRIdrawable, driDrawable); + __GLXDRIdrawable *drawable = data; ScreenPtr pScreen; drm_clip_rect_t *pClipRects, *pBackClipRects; GLboolean retval; @@ -810,10 +816,10 @@ getUST(int64_t *ust) static void __glXReportDamage(__DRIdrawable *driDraw, int x, int y, drm_clip_rect_t *rects, int num_rects, - GLboolean front_buffer) + GLboolean front_buffer, + void *data) { - __GLXDRIdrawable *drawable = - containerOf(driDraw, __GLXDRIdrawable, driDrawable); + __GLXDRIdrawable *drawable = data; DrawablePtr pDraw = drawable->base.pDraw; RegionRec region; @@ -827,13 +833,6 @@ static void __glXReportDamage(__DRIdrawable *driDraw, __glXleaveServer(GL_FALSE); } -/* Table of functions that we export to the driver. */ -static const __DRIcontextModesExtension contextModesExtension = { - { __DRI_CONTEXT_MODES, __DRI_CONTEXT_MODES_VERSION }, - _gl_context_modes_create, - _gl_context_modes_destroy, -}; - static const __DRIsystemTimeExtension systemTimeExtension = { { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION }, getUST, @@ -851,7 +850,6 @@ static const __DRIdamageExtension damageExtension = { }; static const __DRIextension *loader_extensions[] = { - &contextModesExtension.base, &systemTimeExtension.base, &getDrawableInfoExtension.base, &damageExtension.base, @@ -897,7 +895,8 @@ initializeExtensions(__GLXDRIscreen *screen) const __DRIextension **extensions; int i; - extensions = screen->driScreen.getExtensions(&screen->driScreen); + extensions = screen->core->getExtensions(screen->driScreen); + for (i = 0; extensions[i]; i++) { #ifdef __DRI_COPY_SUB_BUFFER if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { @@ -931,12 +930,12 @@ initializeExtensions(__GLXDRIscreen *screen) } } -#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314 +extern __GLXconfig * +glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs); static __GLXscreen * __glXDRIscreenProbe(ScreenPtr pScreen) { - PFNCREATENEWSCREENFUNC createNewScreen; drm_handle_t hSAREA; drmAddress pSAREA = NULL; char *BusID; @@ -953,11 +952,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen) drm_handle_t hFB; int junk; __GLXDRIscreen *screen; - void *dev_priv = NULL; char filename[128]; Bool isCapable; size_t buffer_size; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + const __DRIconfig **driConfigs; + const __DRIextension **extensions; + int i; if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") || !DRIQueryDirectRenderingCapable(pScreen, &isCapable) || @@ -985,9 +986,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) dri_version.minor = XF86DRI_MINOR_VERSION; dri_version.patch = XF86DRI_PATCH_VERSION; - framebuffer.base = NULL; - framebuffer.dev_priv = NULL; - if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) { LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n"); goto handle_error; @@ -1046,11 +1044,30 @@ __glXDRIscreenProbe(ScreenPtr pScreen) goto handle_error; } - createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC); - if (createNewScreen == NULL) { - LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n", - CREATE_NEW_SCREEN_FUNC, dlerror()); - goto handle_error; + extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS); + if (extensions == NULL) { + LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", + driverName, dlerror()); + goto handle_error; + } + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_CORE) == 0 && + extensions[i]->version >= __DRI_CORE_VERSION) { + screen->core = (__DRIcoreExtension *) extensions[i]; + } + + if (strcmp(extensions[i]->name, __DRI_LEGACY) == 0 && + extensions[i]->version >= __DRI_LEGACY_VERSION) { + screen->legacy = (__DRIlegacyExtension *) extensions[i]; + } + } + + if (screen->core == NULL || screen->legacy == NULL) { + LogMessage(X_ERROR, + "AIGLX error: %s does not export required DRI extension\n", + driverName); + goto handle_error; } /* @@ -1066,19 +1083,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) goto handle_error; } - /* Sigh... the DRI interface is broken; the DRI driver will free - * the dev private pointer using _mesa_free() on screen destroy, - * but we can't use _mesa_malloc() here. In fact, the DRI driver - * shouldn't free data it didn't allocate itself, but what can you - * do... */ - dev_priv = xalloc(framebuffer.dev_priv_size); - if (dev_priv == NULL) { - LogMessage(X_ERROR, "AIGLX error: dev_priv allocation failed"); - goto handle_error; - } - memcpy(dev_priv, framebuffer.dev_priv, framebuffer.dev_priv_size); - framebuffer.dev_priv = dev_priv; - framebuffer.width = pScreen->width; framebuffer.height = pScreen->height; @@ -1101,28 +1105,30 @@ __glXDRIscreenProbe(ScreenPtr pScreen) goto handle_error; } - screen->driScreen.private = - (*createNewScreen)(pScreen->myNum, - &screen->driScreen, - &ddx_version, - &dri_version, - &drm_version, - &framebuffer, - pSAREA, - fd, - loader_extensions, - &screen->base.fbconfigs); + screen->driScreen = + (*screen->legacy->createNewScreen)(pScreen->myNum, + &ddx_version, + &dri_version, + &drm_version, + &framebuffer, + pSAREA, + fd, + loader_extensions, + &driConfigs, + screen); - if (screen->driScreen.private == NULL) { + screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs); + + if (screen->driScreen == NULL) { LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed"); goto handle_error; } + initializeExtensions(screen); + DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart, &screen->texOffsetFinish); - initializeExtensions(screen); - __glXScreenInit(&screen->base, pScreen); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); @@ -1155,9 +1161,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) if (framebuffer.base != NULL) drmUnmap((drmAddress)framebuffer.base, framebuffer.size); - if (dev_priv != NULL) - xfree(dev_priv); - if (fd >= 0) drmCloseOnce(fd); diff --git a/GL/glx/glxdri2.c b/GL/glx/glxdri2.c index fecfb1977..40590c167 100644 --- a/GL/glx/glxdri2.c +++ b/GL/glx/glxdri2.c @@ -35,20 +35,18 @@ #include #include #include +#include #include #include #define _XF86DRI_SERVER_ #include -#include -#include #include #include #include "glxserver.h" #include "glxutil.h" -#include "glcontextmodes.h" #include "g_disptab.h" #include "glapitable.h" @@ -57,53 +55,56 @@ #include "dispatch.h" #include "extension_string.h" -#define containerOf(ptr, type, member) \ - (type *)( (char *)ptr - offsetof(type,member) ) - typedef struct __GLXDRIscreen __GLXDRIscreen; typedef struct __GLXDRIcontext __GLXDRIcontext; typedef struct __GLXDRIdrawable __GLXDRIdrawable; +typedef struct __GLXDRIconfig __GLXDRIconfig; struct __GLXDRIscreen { __GLXscreen base; - __DRIscreen driScreen; + __DRIscreen *driScreen; void *driver; int fd; xf86EnterVTProc *enterVT; xf86LeaveVTProc *leaveVT; - __DRIcopySubBufferExtension *copySubBuffer; - __DRIswapControlExtension *swapControl; - __DRItexBufferExtension *texBuffer; + const __DRIcoreExtension *core; + const __DRIcopySubBufferExtension *copySubBuffer; + const __DRIswapControlExtension *swapControl; + const __DRItexBufferExtension *texBuffer; unsigned char glx_enable_bits[__GLX_EXT_BYTES]; }; struct __GLXDRIcontext { - __GLXcontext base; - __DRIcontext driContext; - drm_context_t hwContext; + __GLXcontext base; + __DRIcontext *driContext; }; struct __GLXDRIdrawable { - __GLXdrawable base; - __DRIdrawable driDrawable; + __GLXdrawable base; + __DRIdrawable *driDrawable; + __GLXDRIscreen *screen; }; -static const char CREATE_NEW_SCREEN_FUNC[] = __DRI2_CREATE_NEW_SCREEN_STRING; +struct __GLXDRIconfig { + __GLXconfig config; + const __DRIconfig *driConfig; +}; static void __glXDRIdrawableDestroy(__GLXdrawable *drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; - - (*private->driDrawable.destroyDrawable)(&private->driDrawable); + const __DRIcoreExtension *core = private->screen->core; + + (*core->destroyDrawable)(private->driDrawable); /* If the X window was destroyed, the dri DestroyWindow hook will * aready have taken care of this, so only call if pDraw isn't NULL. */ if (drawable->pDraw != NULL) - DRI2DestroyDrawable(drawable->pDraw->pScreen, drawable->pDraw); + DRI2DestroyDrawable(drawable->pDraw); xfree(private); } @@ -118,25 +119,25 @@ __glXDRIdrawableResize(__GLXdrawable *glxPriv) } static GLboolean -__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate) +__glXDRIdrawableSwapBuffers(__GLXdrawable *drawable) { - __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; + __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + const __DRIcoreExtension *core = private->screen->core; - (*private->driDrawable.swapBuffers)(&private->driDrawable); + (*core->swapBuffers)(private->driDrawable); return TRUE; } static int -__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval) +__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval) { - __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable; - __GLXDRIscreen *screen = (__GLXDRIscreen *) - glxGetScreen(baseDrawable->pDraw->pScreen); + __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + const __DRIswapControlExtension *swapControl = private->screen->swapControl; - if (screen->swapControl) - screen->swapControl->setSwapInterval(&draw->driDrawable, interval); + if (swapControl) + swapControl->setSwapInterval(private->driDrawable, interval); return 0; } @@ -147,22 +148,20 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate, int x, int y, int w, int h) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; - __GLXDRIscreen *screen = (__GLXDRIscreen *) - glxGetScreen(basePrivate->pDraw->pScreen); + const __DRIcopySubBufferExtension *copySubBuffer = + private->screen->copySubBuffer; - if (screen->copySubBuffer) - screen->copySubBuffer->copySubBuffer(&private->driDrawable, - x, y, w, h); + if (copySubBuffer) + (*copySubBuffer->copySubBuffer)(private->driDrawable, x, y, w, h); } static void __glXDRIcontextDestroy(__GLXcontext *baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; - __GLXDRIscreen *screen = (__GLXDRIscreen *) baseContext->pGlxScreen; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; - context->driContext.destroyContext(&context->driContext); - drmDestroyContext(screen->fd, context->hwContext); + (*screen->core->destroyContext)(context->driContext); __glXContextDestroy(&context->base); xfree(context); } @@ -173,18 +172,20 @@ __glXDRIcontextMakeCurrent(__GLXcontext *baseContext) __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; - return (*context->driContext.bindContext)(&context->driContext, - &draw->driDrawable, - &read->driDrawable); + return (*screen->core->bindContext)(context->driContext, + draw->driDrawable, + read->driDrawable); } static int __glXDRIcontextLoseCurrent(__GLXcontext *baseContext) { __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; - return (*context->driContext.unbindContext)(&context->driContext); + return (*screen->core->unbindContext)(context->driContext); } static int @@ -193,13 +194,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, { __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst; __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc; + __GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen; - /* FIXME: We will need to add DRIcontext::copyContext for this. */ - - (void) dst; - (void) src; - - return FALSE; + return (*screen->core->copyContext)(dst->driContext, + src->driContext, mask); } static int @@ -208,10 +206,11 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext) __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; + __GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen; - return (*context->driContext.bindContext)(&context->driContext, - &draw->driDrawable, - &read->driDrawable); + return (*screen->core->bindContext)(context->driContext, + draw->driDrawable, + read->driDrawable); } #ifdef __DRI_TEX_BUFFER @@ -221,19 +220,16 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, int buffer, __GLXdrawable *glxPixmap) { - ScreenPtr pScreen = glxPixmap->pDraw->pScreen; - __GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen); - PixmapPtr pixmap; - __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; __GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap; + const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer; + __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; - if (screen->texBuffer == NULL) + if (texBuffer == NULL) return Success; - pixmap = (PixmapPtr) glxPixmap->pDraw; - screen->texBuffer->setTexBuffer(&context->driContext, - glxPixmap->target, - &drawable->driDrawable); + texBuffer->setTexBuffer(context->driContext, + glxPixmap->target, + drawable->driDrawable); return Success; } @@ -277,7 +273,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) { __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; - screen->driScreen.destroyScreen(&screen->driScreen); + (*screen->core->destroyScreen)(screen->driScreen); dlclose(screen->driver); @@ -288,16 +284,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) static __GLXcontext * __glXDRIscreenCreateContext(__GLXscreen *baseScreen, - __GLcontextModes *modes, + __GLXconfig *glxConfig, __GLXcontext *baseShareContext) { __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; __GLXDRIcontext *context, *shareContext; + __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; + const __DRIcoreExtension *core = screen->core; __DRIcontext *driShare; shareContext = (__GLXDRIcontext *) baseShareContext; if (shareContext) - driShare = &shareContext->driContext; + driShare = shareContext->driContext; else driShare = NULL; @@ -313,16 +311,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, context->base.forceCurrent = __glXDRIcontextForceCurrent; context->base.textureFromPixmap = &__glXDRItextureFromPixmap; - if (drmCreateContext(screen->fd, &context->hwContext)) - return GL_FALSE; - - context->driContext.private = - screen->driScreen.createNewContext(&screen->driScreen, - modes, - 0, /* render type */ - driShare, - context->hwContext, - &context->driContext); + context->driContext = + (*core->createNewContext)(screen->driScreen, + config->driConfig, driShare, context); return &context->base; } @@ -332,13 +323,13 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, int type, XID drawId, - __GLcontextModes *modes) + __GLXconfig *glxConfig) { __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; + __GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig; __GLXDRIdrawable *private; GLboolean retval; - drm_drawable_t hwDrawable; - unsigned int head; + unsigned int handle, head; private = xalloc(sizeof *private); if (private == NULL) @@ -346,8 +337,9 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, memset(private, 0, sizeof *private); + private->screen = driScreen; if (!__glXDrawableInit(&private->base, screen, - pDraw, type, drawId, modes)) { + pDraw, type, drawId, glxConfig)) { xfree(private); return NULL; } @@ -357,14 +349,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, private->base.swapBuffers = __glXDRIdrawableSwapBuffers; private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer; - retval = DRI2CreateDrawable(screen->pScreen, pDraw, - &hwDrawable, &head); + retval = DRI2CreateDrawable(pDraw, &handle, &head); - private->driDrawable.private = - (driScreen->driScreen.createNewDrawable)(&driScreen->driScreen, - modes, - &private->driDrawable, - hwDrawable, head, 0, NULL); + private->driDrawable = + (*driScreen->core->createNewDrawable)(driScreen->driScreen, + config->driConfig, + handle, head, private); return &private->base; } @@ -385,44 +375,43 @@ getUST(int64_t *ust) } } -static void __glXReportDamage(__DRIdrawable *driDraw, - int x, int y, - drm_clip_rect_t *rects, int num_rects, - GLboolean front_buffer) -{ - __GLXDRIdrawable *drawable = - containerOf(driDraw, __GLXDRIdrawable, driDrawable); - DrawablePtr pDraw = drawable->base.pDraw; - RegionRec region; - - REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects); - REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y); - DamageDamageRegion(pDraw, ®ion); - REGION_UNINIT(pDraw->pScreen, ®ion); -} - -/* Table of functions that we export to the driver. */ -static const __DRIcontextModesExtension contextModesExtension = { - { __DRI_CONTEXT_MODES, __DRI_CONTEXT_MODES_VERSION }, - _gl_context_modes_create, - _gl_context_modes_destroy, -}; - static const __DRIsystemTimeExtension systemTimeExtension = { { __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION }, getUST, NULL, }; -static const __DRIdamageExtension damageExtension = { - { __DRI_DAMAGE, __DRI_DAMAGE_VERSION }, - __glXReportDamage, +static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail, + void *loaderPrivate) +{ + __GLXDRIdrawable *pdraw = loaderPrivate; + + DRI2ReemitDrawableInfo(pdraw->base.pDraw, tail); +} + +static void dri2PostDamage(__DRIdrawable *draw, + struct drm_clip_rect *rects, + int numRects, void *loaderPrivate) +{ + __GLXDRIdrawable *drawable = loaderPrivate; + DrawablePtr pDraw = drawable->base.pDraw; + RegionRec region; + + REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, numRects); + REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y); + DamageDamageRegion(pDraw, ®ion); + REGION_UNINIT(pDraw->pScreen, ®ion); +} + +static const __DRIloaderExtension loaderExtension = { + { __DRI_LOADER, __DRI_LOADER_VERSION }, + dri2ReemitDrawableInfo, + dri2PostDamage }; static const __DRIextension *loader_extensions[] = { - &contextModesExtension.base, &systemTimeExtension.base, - &damageExtension.base, + &loaderExtension.base, NULL }; @@ -463,11 +452,13 @@ initializeExtensions(__GLXDRIscreen *screen) const __DRIextension **extensions; int i; - extensions = screen->driScreen.getExtensions(&screen->driScreen); + extensions = screen->core->getExtensions(screen->driScreen); + for (i = 0; extensions[i]; i++) { #ifdef __DRI_COPY_SUB_BUFFER if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { - screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; + screen->copySubBuffer = + (const __DRIcopySubBufferExtension *) extensions[i]; __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer"); @@ -477,7 +468,8 @@ initializeExtensions(__GLXDRIscreen *screen) #ifdef __DRI_SWAP_CONTROL if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { - screen->swapControl = (__DRIswapControlExtension *) extensions[i]; + screen->swapControl = + (const __DRIswapControlExtension *) extensions[i]; __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control"); __glXEnableExtension(screen->glx_enable_bits, @@ -489,7 +481,8 @@ initializeExtensions(__GLXDRIscreen *screen) #ifdef __DRI_TEX_BUFFER if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { - screen->texBuffer = (__DRItexBufferExtension *) extensions[i]; + screen->texBuffer = + (const __DRItexBufferExtension *) extensions[i]; /* GLX_EXT_texture_from_pixmap is always enabled. */ LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); } @@ -498,27 +491,176 @@ initializeExtensions(__GLXDRIscreen *screen) } } +#define __ATTRIB(attrib, field) \ + { attrib, offsetof(__GLXconfig, field) } + +static const struct { unsigned int attrib, offset; } attribMap[] = { + __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), + __ATTRIB(__DRI_ATTRIB_LEVEL, level), + __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), + __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), + __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), + __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), + __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), + __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), + __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), + __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), + __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), + __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), + __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), + __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), + __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), + __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), + __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), + __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), + __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), + __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), +}; + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +static void +setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(attribMap); i++) + if (attribMap[i].attrib == attrib) { + *(unsigned int *) ((char *) config + attribMap[i].offset) = value; + return; + } +} + +static __GLXconfig * +createModeFromConfig(const __DRIcoreExtension *core, + const __DRIconfig *driConfig, + unsigned int visualType) +{ + __GLXDRIconfig *config; + unsigned int attrib, value; + int i; + + config = xalloc(sizeof *config); + + config->driConfig = driConfig; + + i = 0; + while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) { + switch (attrib) { + case __DRI_ATTRIB_RENDER_TYPE: + if (value & __DRI_ATTRIB_RGBA_BIT) { + config->config.renderType |= GLX_RGBA_BIT; + config->config.rgbMode = GL_TRUE; + } else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) { + config->config.renderType |= GLX_COLOR_INDEX_BIT; + config->config.rgbMode = GL_FALSE; + } else { + config->config.renderType = 0; + config->config.rgbMode = GL_FALSE; + } + break; + case __DRI_ATTRIB_CONFIG_CAVEAT: + if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG) + config->config.visualRating = GLX_NON_CONFORMANT_CONFIG; + else if (value & __DRI_ATTRIB_SLOW_BIT) + config->config.visualRating = GLX_SLOW_CONFIG; + else + config->config.visualRating = GLX_NONE; + break; + case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS: + config->config.bindToTextureTargets = 0; + if (value & __DRI_ATTRIB_TEXTURE_1D_BIT) + config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT; + if (value & __DRI_ATTRIB_TEXTURE_2D_BIT) + config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT; + if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT) + config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT; + break; + default: + setScalar(&config->config, attrib, value); + break; + } + } + + config->config.next = NULL; + config->config.xRenderable = GL_TRUE; + config->config.visualType = visualType; + config->config.drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; + + return &config->config; +} + +__GLXconfig * +glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs); + +__GLXconfig * +glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs) +{ + __GLXconfig head, *tail; + int i; + + tail = &head; + head.next = NULL; + + for (i = 0; configs[i]; i++) { + tail->next = createModeFromConfig(core, + configs[i], GLX_TRUE_COLOR); + if (tail->next == NULL) + break; + + tail = tail->next; + } + + for (i = 0; configs[i]; i++) { + tail->next = createModeFromConfig(core, + configs[i], GLX_DIRECT_COLOR); + if (tail->next == NULL) + break; + + tail = tail->next; + } + + return head.next; +} + static __GLXscreen * __glXDRIscreenProbe(ScreenPtr pScreen) { - __DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen; const char *driverName; __GLXDRIscreen *screen; char filename[128]; size_t buffer_size; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; unsigned int sareaHandle; + const __DRIextension **extensions; + const __DRIconfig **driConfigs; + int i; screen = xalloc(sizeof *screen); if (screen == NULL) - return NULL; + return NULL; memset(screen, 0, sizeof *screen); if (!xf86LoaderCheckSymbol("DRI2Connect") || - !DRI2Connect(pScreen, - &screen->fd, - &driverName, - &sareaHandle)) { + !DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle)) { LogMessage(X_INFO, "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum); return NULL; @@ -532,8 +674,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen) __glXInitExtensionEnableBits(screen->glx_enable_bits); - snprintf(filename, sizeof filename, "%s/%s_dri.so", - dri_driver_path, driverName); + snprintf(filename, sizeof filename, + "%s/%s_dri.so", dri_driver_path, driverName); screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); if (screen->driver == NULL) { @@ -542,28 +684,43 @@ __glXDRIscreenProbe(ScreenPtr pScreen) goto handle_error; } - createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC); - if (createNewScreen == NULL) { - LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n", - CREATE_NEW_SCREEN_FUNC, dlerror()); - goto handle_error; + extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS); + if (extensions == NULL) { + LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n", + driverName, dlerror()); + goto handle_error; } - screen->driScreen.private = - (*createNewScreen)(pScreen->myNum, - &screen->driScreen, - screen->fd, - sareaHandle, - loader_extensions, - &screen->base.fbconfigs); + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_CORE) == 0 && + extensions[i]->version >= __DRI_CORE_VERSION) { + screen->core = (const __DRIcoreExtension *) extensions[i]; + } + } - if (screen->driScreen.private == NULL) { + if (screen->core == NULL) { + LogMessage(X_ERROR, "AIGLX error: %s exports no DRI extension\n", + driverName); + goto handle_error; + } + + screen->driScreen = + (*screen->core->createNewScreen)(pScreen->myNum, + screen->fd, + sareaHandle, + loader_extensions, + &driConfigs, + screen); + + if (screen->driScreen == NULL) { LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed"); goto handle_error; } initializeExtensions(screen); + screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs); + __glXScreenInit(&screen->base, pScreen); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c index 0750e1282..bbfa02b79 100644 --- a/GL/glx/glxglcore.c +++ b/GL/glx/glxglcore.c @@ -46,7 +46,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include -#include "glcontextmodes.h" #include "os.h" typedef struct __GLXMESAscreen __GLXMESAscreen; @@ -120,7 +119,7 @@ static __GLXdrawable * __glXMesaScreenCreateDrawable(__GLXscreen *screen, DrawablePtr pDraw, int type, XID drawId, - __GLcontextModes *modes) + __GLXconfig *modes) { __GLXMESAdrawable *glxPriv; XMesaVisual xm_vis; @@ -217,7 +216,7 @@ __glXMesaContextForceCurrent(__GLXcontext *baseContext) static __GLXcontext * __glXMesaScreenCreateContext(__GLXscreen *screen, - __GLcontextModes *modes, + __GLXconfig *config, __GLXcontext *baseShareContext) { __GLXMESAcontext *context; @@ -232,7 +231,7 @@ __glXMesaScreenCreateContext(__GLXscreen *screen, memset(context, 0, sizeof *context); context->base.pGlxScreen = screen; - context->base.modes = modes; + context->base.config = config; context->base.destroy = __glXMesaContextDestroy; context->base.makeCurrent = __glXMesaContextMakeCurrent; @@ -240,10 +239,10 @@ __glXMesaScreenCreateContext(__GLXscreen *screen, context->base.copy = __glXMesaContextCopy; context->base.forceCurrent = __glXMesaContextForceCurrent; - xm_vis = find_mesa_visual(screen, modes->fbconfigID); + xm_vis = find_mesa_visual(screen, config->fbconfigID); if (!xm_vis) { ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", - modes->visualID); + config->visualID); xfree(context); return NULL; } @@ -282,11 +281,11 @@ static XMesaVisual find_mesa_visual(__GLXscreen *screen, XID fbconfigID) { __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; - const __GLcontextModes *modes; + const __GLXconfig *config; unsigned i = 0; - for (modes = screen->fbconfigs; modes != NULL; modes = modes->next) { - if (modes->fbconfigID == fbconfigID) + for (config = screen->fbconfigs; config != NULL; config = config->next) { + if (config->fbconfigID == fbconfigID) return mesaScreen->xm_vis[i]; i++; } @@ -298,18 +297,31 @@ const static int numBack = 2; const static int numDepth = 2; const static int numStencil = 2; -static __GLcontextModes * +static const int glx_visual_types[] = { + GLX_STATIC_GRAY, + GLX_GRAY_SCALE, + GLX_STATIC_COLOR, + GLX_PSEUDO_COLOR, + GLX_TRUE_COLOR, + GLX_DIRECT_COLOR +}; + +static __GLXconfig * createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, - VisualPtr visual, __GLcontextModes *config) + VisualPtr visual, __GLXconfig *tail) { int back, depth, stencil; + __GLXconfig *config; /* FIXME: Ok, I'm making all this up... anybody has a better idea? */ for (back = numBack - 1; back >= 0; back--) for (depth = 0; depth < numDepth; depth++) for (stencil = 0; stencil < numStencil; stencil++) { - config->visualType = _gl_convert_from_x_visual_type(visual->class); + config->next = xalloc(sizeof *config); + config = config->next; + + config->visualType = glx_visual_types[visual->class]; config->xRenderable = GL_TRUE; config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; config->rgbMode = (visual->class >= TrueColor); @@ -333,35 +345,35 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, config->alphaMask = 0; config->rgbBits = config->rgbMode ? visual->nplanes : 0; config->indexBits = config->colorIndexMode ? visual->nplanes : 0; - config = config->next; } - return config; + return tail; } static void createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen) { - __GLcontextModes *configs; + __GLXconfig head, *tail; int i; /* We assume here that each existing visual correspond to a * different visual class. Note, this runs before COMPOSITE adds * its visual, so it's not entirely crazy. */ pGlxScreen->numFBConfigs = pScreen->numVisuals * numBack * numDepth * numStencil; - pGlxScreen->fbconfigs = _gl_context_modes_create(pGlxScreen->numFBConfigs, - sizeof *configs); - - configs = pGlxScreen->fbconfigs; + + head.next = NULL; + tail = &head; for (i = 0; i < pScreen->numVisuals; i++) - configs = createFBConfigsForVisual(pGlxScreen, pScreen, - &pScreen->visuals[i], configs); + tail = createFBConfigsForVisual(pGlxScreen, pScreen, + &pScreen->visuals[i], tail); + + pGlxScreen->fbconfigs = head.next; } static void createMesaVisuals(__GLXMESAscreen *pMesaScreen) { - __GLcontextModes *config; + __GLXconfig *config; ScreenPtr pScreen; VisualPtr visual = NULL; int i, j; diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index 6575b271d..b49a775b5 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -37,6 +37,7 @@ #include #endif +#include #include #include #include @@ -46,7 +47,6 @@ #include "glxserver.h" #include "glxutil.h" #include "glxext.h" -#include "glcontextmodes.h" static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey; @@ -280,10 +280,23 @@ void GlxSetVisualConfigs(int nconfigs, * call it. */ } +GLint glxConvertToXVisualType(int visualType) +{ + static const int x_visual_types[] = { + TrueColor, DirectColor, + PseudoColor, StaticColor, + GrayScale, StaticGray + }; + + return ( (unsigned) (visualType - GLX_TRUE_COLOR) < 6 ) + ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1; +} + + static void filterOutNativeConfigs(__GLXscreen *pGlxScreen) { - __GLcontextModes *m, *next, *native_modes, **last; + __GLXconfig *m, *next, **last; ScreenPtr pScreen = pGlxScreen->pScreen; int i, depth; @@ -305,12 +318,12 @@ filterOutNativeConfigs(__GLXscreen *pGlxScreen) } static XID -findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m) +findVisualForConfig(ScreenPtr pScreen, __GLXconfig *m) { int i; for (i = 0; i < pScreen->numVisuals; i++) { - if (_gl_convert_to_x_visual_type(m->visualType) == pScreen->visuals[i].class) + if (glxConvertToXVisualType(m->visualType) == pScreen->visuals[i].class) return pScreen->visuals[i].vid; } @@ -405,10 +418,10 @@ findFirstSet(unsigned int v) } static void -initGlxVisual(VisualPtr visual, __GLcontextModes *config) +initGlxVisual(VisualPtr visual, __GLXconfig *config) { config->visualID = visual->vid; - visual->class = _gl_convert_to_x_visual_type(config->visualType); + visual->class = glxConvertToXVisualType(config->visualType); visual->bitsPerRGBValue = config->redBits; visual->ColormapEntries = 1 << config->redBits; visual->nplanes = config->redBits + config->greenBits + config->blueBits; @@ -426,15 +439,15 @@ typedef struct { GLboolean depthBuffer; } FBConfigTemplateRec, *FBConfigTemplatePtr; -static __GLcontextModes * +static __GLXconfig * pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class) { - __GLcontextModes *config; + __GLXconfig *config; for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) { if (config->visualRating != GLX_NONE) continue; - if (_gl_convert_to_x_visual_type(config->visualType) != class) + if (glxConvertToXVisualType(config->visualType) != class) continue; if ((config->doubleBufferMode > 0) != template->doubleBuffer) continue; @@ -450,32 +463,36 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class) static void addMinimalSet(__GLXscreen *pGlxScreen) { - __GLcontextModes *config; + __GLXconfig *config; VisualPtr visuals; - int i; + int i, j; FBConfigTemplateRec best = { GL_TRUE, GL_TRUE }; FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE }; pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals, - sizeof (__GLcontextModes *)); + sizeof (__GLXconfig *)); if (pGlxScreen->visuals == NULL) { ErrorF("Failed to allocate for minimal set of GLX visuals\n"); return; } - pGlxScreen->numVisuals = pGlxScreen->pScreen->numVisuals; visuals = pGlxScreen->pScreen->visuals; - for (i = 0; i < pGlxScreen->numVisuals; i++) { + for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) { if (visuals[i].nplanes == 32) config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class); else config = pickFBConfig(pGlxScreen, &best, visuals[i].class); if (config == NULL) config = pGlxScreen->fbconfigs; - pGlxScreen->visuals[i] = config; - config->visualID = visuals[i].vid; + if (config == NULL) + continue; + + pGlxScreen->visuals[j] = config; + config->visualID = visuals[j].vid; + j++; } + pGlxScreen->numVisuals = j; } static void @@ -487,12 +504,12 @@ addTypicalSet(__GLXscreen *pGlxScreen) static void addFullSet(__GLXscreen *pGlxScreen) { - __GLcontextModes *config; + __GLXconfig *config; VisualPtr visuals; int i, depth; pGlxScreen->visuals = - xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLcontextModes *)); + xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *)); if (pGlxScreen->visuals == NULL) { ErrorF("Failed to allocate for full set of GLX visuals\n"); return; @@ -522,7 +539,7 @@ void GlxSetVisualConfig(int config) void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) { - __GLcontextModes *m; + __GLXconfig *m; int i; pGlxScreen->pScreen = pScreen; diff --git a/GL/glx/glxscreens.h b/GL/glx/glxscreens.h index f1eef912c..39d162d76 100644 --- a/GL/glx/glxscreens.h +++ b/GL/glx/glxscreens.h @@ -40,8 +40,6 @@ ** */ -#include "GL/internal/glcore.h" - typedef struct { void * (* queryHyperpipeNetworkFunc)(int, int *, int *); void * (* queryHyperpipeConfigFunc)(int, int, int *, int *); @@ -57,6 +55,84 @@ typedef struct { void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs); void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs); +typedef struct __GLXconfig __GLXconfig; +struct __GLXconfig { + __GLXconfig *next; + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; + + /* EXT_texture_from_pixmap */ + GLint bindToTextureRgb; + GLint bindToTextureRgba; + GLint bindToMipmapTexture; + GLint bindToTextureTargets; + GLint yInverted; +}; + +GLint glxConvertToXVisualType(int visualType); + /* ** Screen dependent data. These methods are the interface between the DIX ** and DDX layers of the GLX server extension. The methods provide an @@ -67,14 +143,14 @@ struct __GLXscreen { void (*destroy) (__GLXscreen *screen); __GLXcontext *(*createContext) (__GLXscreen *screen, - __GLcontextModes *modes, + __GLXconfig *modes, __GLXcontext *shareContext); __GLXdrawable *(*createDrawable)(__GLXscreen *context, DrawablePtr pDraw, int type, XID drawId, - __GLcontextModes *modes); + __GLXconfig *modes); int (*swapInterval) (__GLXdrawable *drawable, int interval); @@ -84,11 +160,11 @@ struct __GLXscreen { ScreenPtr pScreen; /* Linked list of valid fbconfigs for this screen. */ - __GLcontextModes *fbconfigs; + __GLXconfig *fbconfigs; int numFBConfigs; /* Subset of fbconfigs that are exposed as GLX visuals. */ - __GLcontextModes **visuals; + __GLXconfig **visuals; GLint numVisuals; char *GLextensions; diff --git a/GL/glx/glxutil.c b/GL/glx/glxutil.c index f531ed954..11e9f898b 100644 --- a/GL/glx/glxutil.c +++ b/GL/glx/glxutil.c @@ -49,7 +49,6 @@ #include "glxutil.h" #include "GL/internal/glcore.h" #include "GL/glxint.h" -#include "glcontextmodes.h" /************************************************************************/ /* Context stuff */ @@ -140,13 +139,13 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv) GLboolean __glXDrawableInit(__GLXdrawable *drawable, __GLXscreen *screen, DrawablePtr pDraw, int type, - XID drawId, __GLcontextModes *modes) + XID drawId, __GLXconfig *config) { drawable->pDraw = pDraw; drawable->type = type; drawable->drawId = drawId; drawable->refCount = 1; - drawable->modes = modes; + drawable->config = config; drawable->eventMask = 0; return GL_TRUE; diff --git a/GL/glx/glxutil.h b/GL/glx/glxutil.h index 6534c3f94..00c7b2084 100644 --- a/GL/glx/glxutil.h +++ b/GL/glx/glxutil.h @@ -51,7 +51,7 @@ extern void __glXUnrefDrawable(__GLXdrawable *glxPriv); extern GLboolean __glXDrawableInit(__GLXdrawable *drawable, __GLXscreen *screen, DrawablePtr pDraw, int type, XID drawID, - __GLcontextModes *modes); + __GLXconfig *config); /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh index af9adbd94..47afdcd37 100755 --- a/GL/symlink-mesa.sh +++ b/GL/symlink-mesa.sh @@ -227,8 +227,6 @@ symlink_glx() { dst_dir glx action indirect_size.h - action glcontextmodes.c - action glcontextmodes.h action indirect_dispatch.c action indirect_dispatch.h action indirect_dispatch_swap.c diff --git a/configure.ac b/configure.ac index 959f0aedf..e72e3b99a 100644 --- a/configure.ac +++ b/configure.ac @@ -860,7 +860,7 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) if test "x$DRI2" = xyes; then # FIXME: Bump the versions once we have releases of these. AC_DEFINE(DRI2, 1, [Build DRI2 extension]) - PKG_CHECK_MODULES([DRIPROTO], [xf86driproto >= 2.0.3]) + PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.0.0]) PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1]) fi diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 4a4aabcb5..8de742620 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -121,6 +121,7 @@ static ModuleDefault ModuleDefaults[] = { {.name = "freetype", .toLoad = TRUE, .load_opt=NULL}, {.name = "record", .toLoad = TRUE, .load_opt=NULL}, {.name = "dri", .toLoad = TRUE, .load_opt=NULL}, + {.name = "dri2", .toLoad = TRUE, .load_opt=NULL}, {.name = NULL, .toLoad = FALSE, .load_opt=NULL} }; diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am index be3cea48f..844c91240 100644 --- a/hw/xfree86/dri2/Makefile.am +++ b/hw/xfree86/dri2/Makefile.am @@ -2,7 +2,7 @@ libdri2_la_LTLIBRARIES = libdri2.la libdri2_la_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ -I@MESA_SOURCE@/include \ - @DIX_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + @DIX_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support/bus @@ -10,6 +10,7 @@ libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ libdri2_ladir = $(moduledir)/extensions libdri2_la_SOURCES = \ dri2.c \ - dri2.h + dri2.h \ + dri2ext.c sdk_HEADERS = dri2.h diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index d5273877e..74aef7196 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -38,6 +38,8 @@ #include "xf86Module.h" #include "scrnintstr.h" #include "windowstr.h" +#include "region.h" +#include "damage.h" #include "dri2.h" #include @@ -48,8 +50,9 @@ static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey; static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey; typedef struct _DRI2DrawablePriv { - drm_drawable_t drawable; - unsigned int handle; + unsigned int refCount; + unsigned int boHandle; + unsigned int dri2Handle; } DRI2DrawablePrivRec, *DRI2DrawablePrivPtr; typedef struct _DRI2Screen { @@ -58,6 +61,7 @@ typedef struct _DRI2Screen { void *sarea; unsigned int sareaSize; const char *driverName; + unsigned int nextHandle; __DRIEventBuffer *buffer; int locked; @@ -147,7 +151,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw) e = DRI2ScreenAllocEvent(ds, size); e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size); - e->drawable = pPriv->drawable; + e->drawable = pPriv->dri2Handle; e->x = pDraw->x - pPixmap->screen_x; e->y = pDraw->y - pPixmap->screen_y; e->width = pDraw->width; @@ -164,7 +168,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw) } static void -DRI2PostBufferAttach(DrawablePtr pDraw) +DRI2PostBufferAttach(DrawablePtr pDraw, Bool force) { ScreenPtr pScreen = pDraw->pScreen; DRI2ScreenPtr ds = DRI2GetScreen(pScreen); @@ -173,7 +177,8 @@ DRI2PostBufferAttach(DrawablePtr pDraw) PixmapPtr pPixmap; __DRIBufferAttachEvent *e; size_t size; - unsigned int handle, flags; + unsigned int flags; + unsigned int boHandle; if (pDraw->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDraw; @@ -187,22 +192,20 @@ DRI2PostBufferAttach(DrawablePtr pDraw) if (!pPriv) return; - size = sizeof *e; - - handle = ds->getPixmapHandle(pPixmap, &flags); - if (handle == 0 || handle == pPriv->handle) + boHandle = ds->getPixmapHandle(pPixmap, &flags); + if (boHandle == pPriv->boHandle && !force) return; + pPriv->boHandle = boHandle; + size = sizeof *e; e = DRI2ScreenAllocEvent(ds, size); e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size); - e->drawable = pPriv->drawable; + e->drawable = pPriv->dri2Handle; e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT; - e->buffer.handle = handle; + e->buffer.handle = pPriv->boHandle; e->buffer.pitch = pPixmap->devKind; e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8; e->buffer.flags = flags; - - pPriv->handle = handle; } static void @@ -223,7 +226,7 @@ DRI2ClipNotify(WindowPtr pWin, int dx, int dy) } DRI2PostDrawableConfig(&pWin->drawable); - DRI2PostBufferAttach(&pWin->drawable); + DRI2PostBufferAttach(&pWin->drawable, FALSE); } static void @@ -262,10 +265,10 @@ DRI2CloseScreen(ScreenPtr pScreen) } Bool -DRI2CreateDrawable(ScreenPtr pScreen, DrawablePtr pDraw, - drm_drawable_t *pDrmDrawable, unsigned int *head) +DRI2CreateDrawable(DrawablePtr pDraw, + unsigned int *handle, unsigned int *head) { - DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); WindowPtr pWin; PixmapPtr pPixmap; DRI2DrawablePrivPtr pPriv; @@ -283,47 +286,66 @@ DRI2CreateDrawable(ScreenPtr pScreen, DrawablePtr pDraw, } pPriv = dixLookupPrivate(devPrivates, key); - if (pPriv == NULL) { + if (pPriv != NULL) { + pPriv->refCount++; + } else { pPriv = xalloc(sizeof *pPriv); - if (drmCreateDrawable(ds->fd, &pPriv->drawable)) - return FALSE; - + pPriv->refCount = 1; + pPriv->boHandle = 0; + pPriv->dri2Handle = ds->nextHandle++; dixSetPrivate(devPrivates, key, pPriv); } - *pDrmDrawable = pPriv->drawable; - + *handle = pPriv->dri2Handle; *head = ds->buffer->head; + DRI2PostDrawableConfig(pDraw); - DRI2PostBufferAttach(pDraw); + DRI2PostBufferAttach(pDraw, TRUE); DRI2ScreenCommitEvents(ds); return TRUE; } void -DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw) +DRI2DestroyDrawable(DrawablePtr pDraw) { - DRI2ScreenPtr ds = DRI2GetScreen(pScreen); - PixmapPtr pPixmap; - WindowPtr pWin; - DRI2DrawablePrivPtr pPriv; + PixmapPtr pPixmap; + WindowPtr pWin; + DRI2DrawablePrivPtr pPriv; + DevPrivateKey key; + PrivateRec **devPrivates; if (pDraw->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDraw; - pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); - dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL); + devPrivates = &pWin->devPrivates; + key = dri2WindowPrivateKey; } else { pPixmap = (PixmapPtr) pDraw; - pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); - dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL); + devPrivates = &pPixmap->devPrivates; + key = dri2PixmapPrivateKey; } + pPriv = dixLookupPrivate(devPrivates, key); if (pPriv == NULL) return; - drmDestroyDrawable(ds->fd, pPriv->drawable); - xfree(pPriv); + pPriv->refCount--; + if (pPriv->refCount == 0) { + dixSetPrivate(devPrivates, key, NULL); + xfree(pPriv); + } +} + +void +DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); + + *head = ds->buffer->head; + + DRI2PostDrawableConfig(pDraw); + DRI2PostBufferAttach(pDraw, TRUE); + DRI2ScreenCommitEvents(ds); } Bool @@ -409,8 +431,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) if (!ds) return NULL; - ds->fd = info->fd; + ds->fd = info->fd; ds->driverName = info->driverName; + ds->nextHandle = 1; ds->getPixmapHandle = info->getPixmapHandle; ds->beginClipNotify = info->beginClipNotify; @@ -434,9 +457,21 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) return p; } +extern ExtensionModule dri2ExtensionModule; + static pointer DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin) { + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + LoadExtension(&dri2ExtensionModule, FALSE); + } else { + if (errmaj) + *errmaj = LDR_ONCEONLY; + } + return (pointer) 1; } diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 126087a2f..85b3da41c 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -66,14 +66,16 @@ unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap, void DRI2Lock(ScreenPtr pScreen); void DRI2Unlock(ScreenPtr pScreen); -Bool DRI2CreateDrawable(ScreenPtr pScreen, - DrawablePtr pDraw, - drm_drawable_t *pDrmDrawable, - unsigned int *head); +Bool DRI2CreateDrawable(DrawablePtr pDraw, + unsigned int *handle, + unsigned int *head); -void DRI2DestroyDrawable(ScreenPtr pScreen, - DrawablePtr pDraw); +void DRI2DestroyDrawable(DrawablePtr pDraw); -void DRI2ExtensionInit(void); +void DRI2ReemitDrawableInfo(DrawablePtr pDraw, + unsigned int *head); + +Bool DRI2PostDamage(DrawablePtr pDrawable, + struct drm_clip_rect *rects, int numRects); #endif diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c new file mode 100644 index 000000000..ca2e02970 --- /dev/null +++ b/hw/xfree86/dri2/dri2ext.c @@ -0,0 +1,361 @@ +/* + * Copyright © 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), 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 Soft- + * ware 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 MERCHANTABIL- + * ITY, 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 CONSE- + * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- + * MANCE 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. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#define NEED_REPLIES +#include +#include +#include "dixstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "extnsionst.h" +#include "xf86drm.h" +#include "dri2proto.h" +#include "dri2.h" + +/* The only xf86 include */ +#include "xf86Module.h" + +static ExtensionEntry *dri2Extension; +static RESTYPE dri2DrawableRes; + +static Bool +validScreen(ClientPtr client, int screen, ScreenPtr *pScreen) +{ + if (screen >= screenInfo.numScreens) { + client->errorValue = screen; + return FALSE; + } + + *pScreen = screenInfo.screens[screen]; + + return TRUE; +} + +static Bool +validDrawable(ClientPtr client, XID drawable, + DrawablePtr *pDrawable, int *status) +{ + *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess); + if (*status != Success) { + client->errorValue = drawable; + return FALSE; + } + + return TRUE; +} + +static int +ProcDRI2QueryVersion(ClientPtr client) +{ + REQUEST(xDRI2QueryVersionReq); + xDRI2QueryVersionReply rep; + int n; + + if (client->swapped) + swaps(&stuff->length, n); + + REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.majorVersion = DRI2_MAJOR; + rep.minorVersion = DRI2_MINOR; + + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); + swapl(&rep.minorVersion, n); + } + + WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2Connect(ClientPtr client) +{ + REQUEST(xDRI2ConnectReq); + xDRI2ConnectReply rep; + ScreenPtr pScreen; + int fd; + const char *driverName; + char *busId; + unsigned int sareaHandle; + + REQUEST_SIZE_MATCH(xDRI2ConnectReq); + if (!validScreen(client, stuff->screen, &pScreen)) + return BadValue; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.driverNameLength = 0; + rep.busIdLength = 0; + rep.sareaHandle = 0; + + if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle)) + goto fail; + + busId = drmGetBusid(fd); + if (busId == NULL) + goto fail; + + rep.driverNameLength = strlen(driverName); + rep.busIdLength = strlen(busId); + rep.sareaHandle = sareaHandle; + rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4; + + fail: + WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); + WriteToClient(client, rep.driverNameLength, driverName); + WriteToClient(client, rep.busIdLength, busId); + drmFreeBusid(busId); + + return client->noClientException; +} + +static int +ProcDRI2AuthConnection(ClientPtr client) +{ + REQUEST(xDRI2AuthConnectionReq); + xDRI2AuthConnectionReply rep; + ScreenPtr pScreen; + + REQUEST_SIZE_MATCH(xDRI2AuthConnectionReq); + if (!validScreen(client, stuff->screen, &pScreen)) + return BadValue; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.authenticated = 1; + + if (!DRI2AuthConnection(pScreen, stuff->magic)) { + ErrorF("DRI2: Failed to authenticate %lu\n", + (unsigned long) stuff->magic); + rep.authenticated = 0; + } + + WriteToClient(client, sizeof(xDRI2AuthConnectionReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2CreateDrawable(ClientPtr client) +{ + REQUEST(xDRI2CreateDrawableReq); + xDRI2CreateDrawableReply rep; + DrawablePtr pDrawable; + unsigned int handle, head; + int status; + + REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq); + + if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) + return status; + + if (!DRI2CreateDrawable(pDrawable, &handle, &head)) + return BadMatch; + + if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) { + DRI2DestroyDrawable(pDrawable); + return BadAlloc; + } + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.handle = handle; + rep.head = head; + + WriteToClient(client, sizeof(xDRI2CreateDrawableReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2DestroyDrawable(ClientPtr client) +{ + REQUEST(xDRI2DestroyDrawableReq); + DrawablePtr pDrawable; + int status; + + REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq); + if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) + return status; + + FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE); + + return client->noClientException; +} + +static int +ProcDRI2ReemitDrawableInfo(ClientPtr client) +{ + REQUEST(xDRI2ReemitDrawableInfoReq); + xDRI2ReemitDrawableInfoReply rep; + DrawablePtr pDrawable; + unsigned int head; + int status; + + REQUEST_SIZE_MATCH(xDRI2ReemitDrawableInfoReq); + if (!validDrawable(client, stuff->drawable, &pDrawable, &status)) + return status; + + DRI2ReemitDrawableInfo(pDrawable, &head); + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.head = head; + + WriteToClient(client, sizeof(xDRI2ReemitDrawableInfoReply), &rep); + + return client->noClientException; +} + +static int +ProcDRI2Dispatch (ClientPtr client) +{ + REQUEST(xReq); + + switch (stuff->data) { + case X_DRI2QueryVersion: + return ProcDRI2QueryVersion(client); + } + + if (!LocalClient(client)) + return BadRequest; + + switch (stuff->data) { + case X_DRI2Connect: + return ProcDRI2Connect(client); + case X_DRI2AuthConnection: + return ProcDRI2AuthConnection(client); + case X_DRI2CreateDrawable: + return ProcDRI2CreateDrawable(client); + case X_DRI2DestroyDrawable: + return ProcDRI2DestroyDrawable(client); + case X_DRI2ReemitDrawableInfo: + return ProcDRI2ReemitDrawableInfo(client); + default: + return BadRequest; + } +} + +static int +SProcDRI2Connect(ClientPtr client) +{ + REQUEST(xDRI2ConnectReq); + xDRI2ConnectReply rep; + int n; + + /* If the client is swapped, it's not local. Talk to the hand. */ + + swaps(&stuff->length, n); + if (sizeof(*stuff) / 4 != client->req_len) + return BadLength; + + rep.sequenceNumber = client->sequence; + swaps(&rep.sequenceNumber, n); + rep.length = 0; + rep.driverNameLength = 0; + rep.busIdLength = 0; + rep.sareaHandle = 0; + + return client->noClientException; +} + +static int +SProcDRI2Dispatch (ClientPtr client) +{ + REQUEST(xReq); + + /* + * Only local clients are allowed DRI access, but remote clients + * still need these requests to find out cleanly. + */ + switch (stuff->data) + { + case X_DRI2QueryVersion: + return ProcDRI2QueryVersion(client); + case X_DRI2Connect: + return SProcDRI2Connect(client); + default: + return BadRequest; + } +} + +static void +DRI2ResetProc (ExtensionEntry *extEntry) +{ +} + +static int DRI2DrawableGone(pointer p, XID id) +{ + DrawablePtr pDrawable = p; + + DRI2DestroyDrawable(pDrawable); + + return Success; +} + +static void +DRI2ExtensionInit(void) +{ + dri2Extension = AddExtension(DRI2_NAME, + DRI2NumberEvents, + DRI2NumberErrors, + ProcDRI2Dispatch, + SProcDRI2Dispatch, + DRI2ResetProc, + StandardMinorOpcode); + + dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone); +} + +extern Bool noDRI2Extension; + +_X_HIDDEN ExtensionModule dri2ExtensionModule = { + DRI2ExtensionInit, + DRI2_NAME, + &noDRI2Extension, + NULL, + NULL +}; diff --git a/os/utils.c b/os/utils.c index 57293ab6f..d785d46d2 100644 --- a/os/utils.c +++ b/os/utils.c @@ -239,6 +239,9 @@ _X_EXPORT int selinuxEnforcingState = SELINUX_MODE_DEFAULT; #ifdef XV _X_EXPORT Bool noXvExtension = FALSE; #endif +#ifdef DRI2 +_X_EXPORT Bool noDRI2Extension = FALSE; +#endif #define X_INCLUDE_NETDB_H #include From 9f56fc580646a519875b5a1452738d8c6e1fa860 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Mon, 31 Mar 2008 17:34:07 -0400 Subject: [PATCH 124/183] XSELinux: Add a request to get a client's context from a resource ID. --- Xext/xselinux.c | 33 +++++++++++++++++++++++++++++++++ Xext/xselinux.h | 1 + 2 files changed, 34 insertions(+) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 2e059a4c3..1e3b4d66c 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -1472,6 +1472,24 @@ ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey) return SELinuxSendContextReply(client, obj->sid); } +static int +ProcSELinuxGetClientContext(ClientPtr client) +{ + ClientPtr target; + SELinuxSubjectRec *subj; + int rc; + + REQUEST(SELinuxGetContextReq); + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + + rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + subj = dixLookupPrivate(&target->devPrivates, subjectKey); + return SELinuxSendContextReply(client, subj->sid); +} + static int SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id, int *size) @@ -1686,6 +1704,8 @@ ProcSELinuxDispatch(ClientPtr client) return ProcSELinuxGetSelectionContext(client, dataKey); case X_SELinuxListSelections: return ProcSELinuxListSelections(client); + case X_SELinuxGetClientContext: + return ProcSELinuxGetClientContext(client); default: return BadRequest; } @@ -1782,6 +1802,17 @@ SProcSELinuxListProperties(ClientPtr client) return ProcSELinuxListProperties(client); } +static int +SProcSELinuxGetClientContext(ClientPtr client) +{ + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id, n); + return ProcSELinuxGetClientContext(client); +} + static int SProcSELinuxDispatch(ClientPtr client) { @@ -1835,6 +1866,8 @@ SProcSELinuxDispatch(ClientPtr client) return SProcSELinuxGetSelectionContext(client, dataKey); case X_SELinuxListSelections: return ProcSELinuxListSelections(client); + case X_SELinuxGetClientContext: + return SProcSELinuxGetClientContext(client); default: return BadRequest; } diff --git a/Xext/xselinux.h b/Xext/xselinux.h index 2d0de3222..7c3ffdcb7 100644 --- a/Xext/xselinux.h +++ b/Xext/xselinux.h @@ -52,6 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define X_SELinuxGetSelectionContext 19 #define X_SELinuxGetSelectionDataContext 20 #define X_SELinuxListSelections 21 +#define X_SELinuxGetClientContext 22 typedef struct { CARD8 reqType; From 19ff23ab0e72a27d05ed4470f75a0934d6f6c1d1 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Fri, 28 Mar 2008 18:25:03 -0700 Subject: [PATCH 125/183] Remove calls to InitValuatorAxisStruct -- these are now handled in dix by InitValuatorDeviceClass. Add InitProximityClassDeviceStruct call to prepare for tablet support. (cherry picked from commit 1bd980a5b114f5320360943214f8f9f23b29c1e3) --- hw/xquartz/darwin.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 0dbfafefa..8f2511dbb 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -353,24 +353,8 @@ static int DarwinMouseProc( InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5, GetMotionHistory, (PtrCtrlProcPtr)NoopDDA, - GetMotionHistorySize(), 2); - -#ifdef XINPUT - InitValuatorAxisStruct( pPointer, - 0, // X axis - 0, // min value - 16000, // max value (fixme screen size?) - 1, // resolution (fixme ?) - 1, // min resolution - 1 ); // max resolution - InitValuatorAxisStruct( pPointer, - 1, // X axis - 0, // min value - 16000, // max value (fixme screen size?) - 1, // resolution (fixme ?) - 1, // min resolution - 1 ); // max resolution -#endif + GetMotionHistorySize(), 5); + InitProximityClassDeviceStruct( (DevicePtr)pPointer); break; case DEVICE_ON: From 6648867d8bd1e86458d2ade77a3ee4567c3d6a97 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Fri, 28 Mar 2008 18:27:02 -0700 Subject: [PATCH 126/183] add debug statements so we can see if/when our Xinput stubs are getting called. (cherry picked from commit 6e160bbe15dd2c2b8685847c06831cb6aebc6f74) --- hw/xquartz/darwinXinput.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c index 50ba656f8..59bae6fde 100644 --- a/hw/xquartz/darwinXinput.c +++ b/hw/xquartz/darwinXinput.c @@ -62,6 +62,7 @@ SOFTWARE. #include #include #include "XIstubs.h" +#include "darwin.h" /*********************************************************************** * @@ -79,6 +80,7 @@ SOFTWARE. void CloseInputDevice(DeviceIntPtr d, ClientPtr client) { + DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client); } /*********************************************************************** @@ -122,7 +124,7 @@ AddOtherInputDevices(void) RegisterOtherDevice(dev); dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); ************************************************************************/ - + DEBUG_LOG("AddOtherInputDevices\n"); } /*********************************************************************** @@ -150,6 +152,7 @@ AddOtherInputDevices(void) void OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) { + DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status); } /**************************************************************************** @@ -167,6 +170,7 @@ OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) { + DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode); return BadMatch; } @@ -186,7 +190,9 @@ int SetDeviceValuators(ClientPtr client, DeviceIntPtr dev, int *valuators, int first_valuator, int num_valuators) { - return BadMatch; + DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client, + dev, valuators, first_valuator, num_valuators); + return BadMatch; } /**************************************************************************** @@ -201,6 +207,8 @@ int ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) { + + DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control); switch (control->control) { case DEVICE_RESOLUTION: return (BadMatch); @@ -225,7 +233,8 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, int NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) { - return BadValue; + DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev); + return BadValue; } /**************************************************************************** @@ -238,4 +247,5 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) void DeleteInputDeviceRequest(DeviceIntPtr dev) { + DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev); } From a4d034941100c6ca3b7cc4e59952c2745b9306cc Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Fri, 28 Mar 2008 20:47:44 -0700 Subject: [PATCH 127/183] Add code to track 5 valuators for pointing device, in preparation for supporting tablet input in Xquartz. (cherry picked from commit 22c8849ea819eb70a14b2e06330b11b22aa63ebc) --- hw/xquartz/X11Application.m | 28 ++++++++++++---- hw/xquartz/darwinEvents.c | 64 ++++++++++++++++++++++++++++++------- hw/xquartz/darwinEvents.h | 8 +++-- 3 files changed, 80 insertions(+), 20 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 31c80dfa8..147b4b4c0 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -61,7 +61,7 @@ int X11EnableKeyEquivalents = TRUE; int quartzHasRoot = FALSE, quartzEnableRootless = TRUE; extern int darwinFakeButtons, input_check_flag; -extern Bool enable_stereo; +extern Bool enable_stereo; extern xEvent *darwinEvents; @@ -153,7 +153,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - [dict setObject:[NSString stringWithFormat:@"Xquartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] + [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] forKey:@"ApplicationVersion"]; [self orderFrontStandardAboutPanelWithOptions: dict]; @@ -501,7 +501,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID () - && CFNumberIsFloatType (value)) + && CFNumberIsFloatType (value)) CFNumberGetValue (value, kCFNumberFloatType, &ret); else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) ret = CFStringGetDoubleValue (value); @@ -862,7 +862,9 @@ static void send_nsevent (NSEventType type, NSEvent *e) { NSRect screen; NSPoint location; NSWindow *window; - int pointer_x, pointer_y, ev_button, ev_type; + int pointer_x, pointer_y, ev_button, ev_type; + float pressure, tilt_x, tilt_y; + // int num_events=0, i=0, state; // xEvent xe; @@ -884,6 +886,10 @@ static void send_nsevent (NSEventType type, NSEvent *e) { pointer_y -= aquaMenuBarHeight; // state = convert_flags ([e modifierFlags]); + pressure = 0; // for tablets + tilt_x = 0; + tilt_y = 0; + switch (type) { case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse; case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse; @@ -894,6 +900,10 @@ static void send_nsevent (NSEventType type, NSEvent *e) { case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse; case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse; case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse; + case NSTabletPoint: + pressure = [e pressure]; + tilt_x = [e tilt].x; + tilt_y = [e tilt].y; // fall through case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse; handle_mouse: @@ -907,10 +917,14 @@ static void send_nsevent (NSEventType type, NSEvent *e) { DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break; */ - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); + + // if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure]; + DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y, + pressure, tilt_x, tilt_y); break; - case NSScrollWheel: - DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y); + case NSScrollWheel: + DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y, + pressure, tilt_x, tilt_y); break; case NSKeyDown: // do we need to translate these keyCodes? diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 113cfc109..2a28b1a31 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -173,6 +173,9 @@ static void DarwinReleaseModifiers(void) { static void DarwinSimulateMouseClick( int pointer_x, int pointer_y, + float pressure, + float tilt_x, + float tilt_y, int whichButton, // mouse button to be pressed int modifierMask) // modifiers used for the fake click { @@ -183,8 +186,10 @@ static void DarwinSimulateMouseClick( DarwinUpdateModifiers(KeyRelease, modifierMask); // push the mouse button - DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y); - DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y); + DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y, + pressure, tilt_x, tilt_y); + DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y, + pressure, tilt_x, tilt_y); // restore old modifiers DarwinUpdateModifiers(KeyPress, modifierMask); @@ -378,22 +383,39 @@ void DarwinPokeEQ(void) { write(darwinEventWriteFD, &nullbyte, 1); } -void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) { +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; - int valuators[2] = {pointer_x, pointer_y}; + + /* I can't find a spec for this, but at least GTK expects that tablets are + just like mice, except they have either one or three extra valuators, in this + order: + + X coord, Y coord, pressure, X tilt, Y tilt + Pressure and tilt should be represented natively as floats; unfortunately, + we can't do that. Again, GTK seems to record the min/max of each valuator, + and then perform scaling back to float itself using that info. Soo.... */ + + int valuators[5] = {pointer_x, pointer_y, + pressure * INT32_MAX * 1.0f, + tilt_x * INT32_MAX * 1.0f, + tilt_y * INT32_MAX * 1.0f}; + if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) { // Mimic multi-button mouse with modifier-clicks // If both sets of modifiers are pressed, // button 2 is clicked. if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) { - DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask); + DarwinSimulateMouseClick(pointer_x, pointer_y, pressure, + tilt_x, tilt_y, 2, darwinFakeMouse2Mask); darwinFakeMouseButtonDown = 2; darwinFakeMouseButtonMask = darwinFakeMouse2Mask; return; } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) { - DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask); + DarwinSimulateMouseClick(pointer_x, pointer_y, pressure, + tilt_x, tilt_y, 3, darwinFakeMouse3Mask); darwinFakeMouseButtonDown = 3; darwinFakeMouseButtonMask = darwinFakeMouse3Mask; return; @@ -412,7 +434,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin } num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button, - POINTER_ABSOLUTE, 0, 2, valuators); + POINTER_ABSOLUTE, 0, 5, valuators); for(i=0; i 0.0f ? 4 : 5; - int valuators[2] = {pointer_x, pointer_y}; + int valuators[5] = {pointer_x, pointer_y, + pressure * INT32_MAX * 1.0f, + tilt_x * INT32_MAX * 1.0f, + tilt_y * INT32_MAX * 1.0f}; for (count = fabs(count); count > 0.0; count = count - 1.0f) { int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button, - POINTER_ABSOLUTE, 0, 2, valuators); + POINTER_ABSOLUTE, 0, 5, valuators); for(i=0; i Date: Tue, 1 Apr 2008 15:27:06 +0300 Subject: [PATCH 128/183] XKB: Fix processInputProc wrapping If input processing is frozen, only wrap realInputProc: don't smash processInputProc as well. When input processing is thawed, pIP will be rewrapped correctly. This supersedes the previous workaround in 50e80c9. Signed-off-by: Daniel Stone --- include/xkbsrv.h | 16 ++++++++++++---- xkb/xkbActions.c | 9 ++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/include/xkbsrv.h b/include/xkbsrv.h index ef99e94e7..040bb936a 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -237,6 +237,14 @@ typedef struct _XkbSrvLedInfo { typedef struct { ProcessInputProc processInputProc; + /* If processInputProc is set to something different than realInputProc, + * UNWRAP and COND_WRAP will not touch processInputProc and update only + * realInputProc. This ensures that + * processInputProc == (frozen ? EnqueueEvent : realInputProc) + * + * WRAP_PROCESS_INPUT_PROC should only be called during initialization, + * since it may destroy this invariant. + */ ProcessInputProc realInputProc; DeviceUnwrapProc unwrapProc; } xkbDeviceInfoRec, *xkbDeviceInfoPtr; @@ -254,14 +262,14 @@ typedef struct device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ - if (proc != device->public.enqueueInputProc) \ - device->public.realInputProc = proc; \ + device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; #define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \ - backupproc = device->public.processInputProc; \ - device->public.processInputProc = oldprocs->processInputProc; \ + backupproc = device->public.realInputProc; \ + if (device->public.processInputProc == device->public.realInputProc)\ + device->public.processInputProc = oldprocs->realInputProc; \ device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 890cf4250..8c72874df 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -49,15 +49,14 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) { xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device); - ProcessInputProc tmp = device->public.processInputProc; - ProcessInputProc dummy; /* unused, but neede for macro */ + ProcessInputProc backupproc; if(xkbPrivPtr->unwrapProc) xkbPrivPtr->unwrapProc = NULL; - UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, dummy); + UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, backupproc); proc(device,data); - WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, - tmp,xkbUnwrapProc); + COND_WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, + backupproc,xkbUnwrapProc); } From 9500033b9ecdfaf5a56a4355ffc94d74cb17ca17 Mon Sep 17 00:00:00 2001 From: Goneri Le Bouder Date: Tue, 1 Apr 2008 20:19:40 +0200 Subject: [PATCH 129/183] xfree86: don't crash in AutoConfig if the primary device is not pci Only call matchDriverFromFiles() if we found a pci device. Debian bug#472823 (http://bugs.debian.org/472823). --- hw/xfree86/common/xf86AutoConfig.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index 268b50cb5..3210e4460 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -436,9 +436,10 @@ chooseVideoDriver(void) if (!info) { ErrorF("Primary device is not PCI\n"); } - #ifdef __linux__ - matchDriverFromFiles(matches, info->vendor_id, info->device_id); + else { + matchDriverFromFiles(matches, info->vendor_id, info->device_id); + } #endif /* __linux__ */ /* TODO Handle multiple drivers claiming to support the same PCI ID */ From ebc56aca8bdfec1918cac3c8380895dfddea48ce Mon Sep 17 00:00:00 2001 From: Hong Liu Date: Wed, 2 Apr 2008 10:43:19 +0800 Subject: [PATCH 130/183] Bug #15160: quirk Proview AY765C prefer first detailed timing --- hw/xfree86/modes/xf86EdidModes.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 777bb70c7..f15c39642 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -153,6 +153,11 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC) DDC->vendor.prod_id == 57364) return TRUE; + /* Proview AY765C 17" LCD. See bug #15160*/ + if (memcmp (DDC->vendor.name, "PTS", 4) == 0 && + DDC->vendor.prod_id == 765) + return TRUE; + return FALSE; } From b31de6a59044f91f8230aa581c9ca8540289c168 Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Wed, 2 Apr 2008 16:29:30 +1000 Subject: [PATCH 131/183] dri2: fix crasher if DRI2Connect fails --- hw/xfree86/dri2/dri2ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index ca2e02970..d1d52a427 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -114,7 +114,7 @@ ProcDRI2Connect(ClientPtr client) ScreenPtr pScreen; int fd; const char *driverName; - char *busId; + char *busId = NULL; unsigned int sareaHandle; REQUEST_SIZE_MATCH(xDRI2ConnectReq); From b13ab156894074fb38cc812738bc7aeeebd9614d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 2 Apr 2008 12:38:36 -0400 Subject: [PATCH 132/183] dri2: Unbreak glcore visual setup. --- GL/glx/glxglcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c index bbfa02b79..972ab88e6 100644 --- a/GL/glx/glxglcore.c +++ b/GL/glx/glxglcore.c @@ -308,10 +308,9 @@ static const int glx_visual_types[] = { static __GLXconfig * createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, - VisualPtr visual, __GLXconfig *tail) + VisualPtr visual, __GLXconfig *config) { int back, depth, stencil; - __GLXconfig *config; /* FIXME: Ok, I'm making all this up... anybody has a better idea? */ @@ -347,7 +346,7 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, config->indexBits = config->colorIndexMode ? visual->nplanes : 0; } - return tail; + return config; } static void From 7c20f65fea3dd3170cde89d7113d85f377671bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 2 Apr 2008 18:00:06 -0400 Subject: [PATCH 133/183] Add @XORG_CFLAGS@ to satisfy xf86* includes. Pointed out by Hasso Tepper. --- hw/xfree86/dri/Makefile.am | 2 +- hw/xfree86/dri2/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/dri/Makefile.am b/hw/xfree86/dri/Makefile.am index 68f1eaefa..bee315288 100644 --- a/hw/xfree86/dri/Makefile.am +++ b/hw/xfree86/dri/Makefile.am @@ -7,7 +7,7 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \ -I$(top_builddir)/GL/include \ -I@MESA_SOURCE@/include \ -DHAVE_XORG_CONFIG_H \ - @DIX_CFLAGS@ @DRIPROTO_CFLAGS@ \ + @DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \ @LIBDRM_CFLAGS@ \ @GL_CFLAGS@ libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am index 844c91240..fd8962ebb 100644 --- a/hw/xfree86/dri2/Makefile.am +++ b/hw/xfree86/dri2/Makefile.am @@ -2,7 +2,7 @@ libdri2_la_LTLIBRARIES = libdri2.la libdri2_la_CFLAGS = \ -DHAVE_XORG_CONFIG_H \ -I@MESA_SOURCE@/include \ - @DIX_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + @DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/os-support/bus From 8cde0af3c57f0375ba8ba77af9fdf74b79d9496d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 2 Apr 2008 19:06:40 -0400 Subject: [PATCH 134/183] Send the GLX_EXT_texture_from_pixmap attributes to the client. --- GL/glx/glxcmds.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index 36aae61b9..dcd83525f 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -959,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) return Success; } -#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28) +#define __GLX_TOTAL_FBCONFIG_ATTRIBS (33) #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2) /** * Send the set of GLXFBConfigs to the client. There is not currently @@ -1037,6 +1037,11 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen) WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha ); WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex ); WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod ); + WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType ); + WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb ); + WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba ); + WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture ); + WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets ); if (client->swapped) { __GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH); From b5a0a865c3045cc08c33388320d4ec3ab7065efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 2 Apr 2008 19:21:41 -0400 Subject: [PATCH 135/183] Pick up dri2proto from the standard proto header include path. --- configure.ac | 2 +- hw/xfree86/dri2/dri2ext.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e72e3b99a..985c8e227 100644 --- a/configure.ac +++ b/configure.ac @@ -860,7 +860,7 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) if test "x$DRI2" = xyes; then # FIXME: Bump the versions once we have releases of these. AC_DEFINE(DRI2, 1, [Build DRI2 extension]) - PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.0.0]) + PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1]) PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1]) fi diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index d1d52a427..4ae0fda3a 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -37,12 +37,12 @@ #define NEED_REPLIES #include #include +#include #include "dixstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" #include "extnsionst.h" #include "xf86drm.h" -#include "dri2proto.h" #include "dri2.h" /* The only xf86 include */ From 8746daa6732d9837f66d925f2fd74818ecbf8ba2 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Wed, 2 Apr 2008 15:01:33 -0700 Subject: [PATCH 136/183] XQuartz: Fixed missing close-paren in preference pane text. (cherry picked from commit ea37e151dc6032d2a1a33cef809f2a7d507aae35) --- .../English.lproj/main.nib/designable.nib | 4 ++-- .../English.lproj/main.nib/keyedobjects.nib | Bin 38044 -> 37918 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib index 672ba904d..c159d6ee1 100644 --- a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib +++ b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib @@ -2,7 +2,7 @@ 1050 - 9C31 + 9C7010 639 949.26 352.00 @@ -948,7 +948,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA 67239424 4194304 - When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc. + When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc.) diff --git a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib index 91a7c5adb44e6355d01211d48fe4c5a0121a6b43..95420e4f77d13556c624c3232b9c713cb056a537 100644 GIT binary patch literal 37918 zcmdRX2YeL8`}fT3?d{#(ZgQ92b0MAd-a|(^goGXlAvuyjk_)+nA|N{;O+f_&3m{!Y zL9mO0f(=Aa1O*#n?+q0@@;Y2EQ@NfH;s#`Y_6)UgG*zh>{F)Ms#+Xg2rt?E zDiV-k;=ta?+QsV1mP!Rzm_3J;4z|s)Rrhi}wAaG5A`_BO8p=X>s3+=!`l1172wI8O zqHX9tv>UyEj-Xf2Npu>WMQ@T4@6bi`6Z#eXiFqty6ZXUYI2ebZ zw{SSN;%JtK`=2858_GuNdO5X zp(KjLk$BRbB#=~+MzTpU=|KjNfn+clN`{eAGM-eB$)uLlkw(%=t|fEHJTjjwB+JPS zWHnhsZY6h+&146;o9raJq3lECNpgT3Cg;ez6#D zIk$$plUvVivDB@x*ob~bi;JRbz^j6brrhFx*A=r z&aP|H&C<=*Ezl{trBH5}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*u)l2!h>)c&cK;?C?1CMa6T@;QA{w!9FM|d@pwEDPsUU6G&~*8z_aiiJRdK_ zi}6zYG5!><#B1<6ya8{*Tktkqf_LKGcrQMH58}i4C_awA#i#HY{2e}rFXBu1GQNU; z!Z&dx{uSTGckw;^5dVcA<9|pMQjI)MYLeQdE~!smAdN_4(v&nKEl4Z!3TaE)kq)F2 z=|Z}Z9;6qECw)i)=|?<7CVrw2jQ|oRiNqupNg{(tI>{iJB%2H)d1M4BB!o~R$Y?T- zOdylU6jDT{k?CY6nN8-9`D77ULOvqP$a1ohtRd^j2C|uaPPUN}vX7KHDNdS`;bb{E zPM-5`N7otYFvoSqIOCm(&Sa;^dC!^Q%yQ;9^PNS`66a&*Q)i{K##!fVbhbF#oDyfJ zv)kF{lsboqFw0gv?uLN-=qn&KlM^SRj5XFn)t5=Wzl4sN(a+SnoVZ}H<&0<*t)`&G>%~%T- z$J(%VtRw5py0IRt7mH_oSwH4sJ{Dvl23Uj{Y#>WwgIGEn!iKV8Y&a`mm^qBIQEV)m zz$URN>|HjU&1AFLT(*EMW=q*8Y&l!SK4a_ICiXe|f_=$$u{~@*JIIc(W9$SgW995T z`<`84Kd~FElHF!^***4vJz|g9Q(lcf&uj5IydH1B8}TN*Id941_^Z4F@4|cVH~4>e z0`JFV9^fh;z{A|+7Ek7>d@#@C**upI=LH;dhr4_XAIIP3lXww-kI&%6d>&uGm+)nL z1z*kA@=bgjFX21+ZoZF~@ Date: Mon, 31 Mar 2008 16:24:01 -0700 Subject: [PATCH 137/183] Begin to move all of our Xquartz DDX-specific event handlers to miEQ, in preparation to remove the DDX-specific code entirely. (cherry picked from commit 3f4447b95f73a82b3aa0f7b0d1640aba5fb0d1bc) --- hw/xquartz/darwinEvents.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 2a28b1a31..b4ff9fd61 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -195,10 +195,34 @@ static void DarwinSimulateMouseClick( DarwinUpdateModifiers(KeyPress, modifierMask); } +void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { + int i; + + DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); + for (i=0; i Date: Mon, 31 Mar 2008 16:30:16 -0700 Subject: [PATCH 138/183] add logging of current thread ID to DEBUG_LOG macro (cherry picked from commit 5848510cc5a8091b30230ab920d904ca6b159480) --- hw/xquartz/darwin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index bd1b9a42a..9384b9dbb 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -125,7 +125,7 @@ enum { #ifdef ENABLE_DEBUG_LOG extern FILE *debug_log_fp; #define DEBUG_LOG_NAME "x11-debug.txt" -#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp); +#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%x:%s:%s:%d " msg, pthread_self(), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp); #else #define DEBUG_LOG(msg, args...) #endif From 5b6c273eaa53d7b554d69c2b4865988068e73a26 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 17:08:45 -0700 Subject: [PATCH 139/183] add prototype for DarwinEventHandler (cherry picked from commit 9a03ae33c4f9de830f15eabf3b994882ead7c000) --- hw/xquartz/darwinEvents.c | 2 -- hw/xquartz/darwinEvents.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index b4ff9fd61..ce21ff540 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -204,8 +204,6 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { - void mieqSetHandler(int event, mieqHandler handler); - darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum()); mieqInit(); mieqSetHandler(kXquartzActivate, DarwinEventHandler); diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h index 496061420..1d8e92a7b 100644 --- a/hw/xquartz/darwinEvents.h +++ b/hw/xquartz/darwinEvents.h @@ -41,4 +41,6 @@ void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y, float pressure, float tilt_x, float tilt_y); void DarwinUpdateModKeys(int flags); +void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, + int nevents); #endif /* _DARWIN_EVENTS_H */ From c6f0d5d1e51326e5110d27918d834eb0096df7db Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 17:48:09 -0700 Subject: [PATCH 140/183] gut darwinEQEnqueue, and make it just call mieqEnqueue (for the moment) (cherry picked from commit a9e081a60ca227c0d96d4613075d97d6b762366a) --- hw/xquartz/darwinEvents.c | 40 +++++++-------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index ce21ff540..f7b141980 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -199,7 +199,11 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven int i; DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); - for (i=0; iu.keyButtonPointer.time < darwinEventQueue.lastEventTime && - darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) - { - darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time = - darwinEventQueue.lastEventTime; - } - darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen; - - // Update the tail after the event is prepared - darwinEventQueue.tail = newtail; - - // Signal there is an event ready to handle - DarwinPokeEQ(); + mieqEnqueue(NULL, e); + DarwinPokeEQ(); } - /* * DarwinEQPointerPost * Post a pointer event. Used by the mipointer.c routines. From 6c5962e44730395f81cdb333322c9ad5242c32d4 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 18:15:18 -0700 Subject: [PATCH 141/183] remove vestigal DarwinEQPointerPost etc (cherry picked from commit a25704c423598d596fd7f2ed4290d4b860bd5d5f) --- hw/xquartz/darwinEvents.c | 17 ----------------- hw/xquartz/quartzCursor.c | 4 ++-- hw/xquartz/xpr/xprCursor.c | 4 ++-- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index f7b141980..46f567536 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -250,23 +250,6 @@ void DarwinEQEnqueue(const xEventPtr e) { DarwinPokeEQ(); } -/* - * DarwinEQPointerPost - * Post a pointer event. Used by the mipointer.c routines. - */ -void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) { - (*darwinEventQueue.pPtr->processInputProc) - (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1); -} - - -void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) { - darwinEventQueue.pEnqueueScreen = pScreen; - if (fromDIX) - darwinEventQueue.pDequeueScreen = pScreen; -} - - /* * ProcessInputEvents * Read and process events from the event queue until it is empty. diff --git a/hw/xquartz/quartzCursor.c b/hw/xquartz/quartzCursor.c index f82ccd380..10e671a7e 100644 --- a/hw/xquartz/quartzCursor.c +++ b/hw/xquartz/quartzCursor.c @@ -539,8 +539,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = { QuartzCursorOffScreen, QuartzCrossScreen, QuartzWarpCursor, - DarwinEQPointerPost, - DarwinEQSwitchScreen + NULL, + NULL }; diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c index e084ef90e..2ad8d6f56 100644 --- a/hw/xquartz/xpr/xprCursor.c +++ b/hw/xquartz/xpr/xprCursor.c @@ -320,8 +320,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = { QuartzCursorOffScreen, QuartzCrossScreen, QuartzWarpCursor, - DarwinEQPointerPost, - DarwinEQSwitchScreen + NULL, + NULL }; From aa6d12e93e8661da841192ef7c3aa7c6a7731c7f Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Wed, 2 Apr 2008 17:46:59 -0700 Subject: [PATCH 142/183] turns out we weren't actually using these files. oops (cherry picked from commit bfec44d7b4baf0ad0aae55c8209bc60ac93c5b58) --- hw/xquartz/Makefile.am | 2 - hw/xquartz/quartzCursor.c | 646 -------------------------------------- hw/xquartz/quartzCursor.h | 42 --- 3 files changed, 690 deletions(-) delete mode 100644 hw/xquartz/quartzCursor.c delete mode 100644 hw/xquartz/quartzCursor.h diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am index 99d23eb1f..075382476 100644 --- a/hw/xquartz/Makefile.am +++ b/hw/xquartz/Makefile.am @@ -50,8 +50,6 @@ EXTRA_DIST = \ quartz.h \ quartzAudio.h \ quartzCommon.h \ - quartzCursor.c \ - quartzCursor.h \ quartzForeground.h \ quartzKeyboard.h \ quartzPasteboard.h diff --git a/hw/xquartz/quartzCursor.c b/hw/xquartz/quartzCursor.c deleted file mode 100644 index 10e671a7e..000000000 --- a/hw/xquartz/quartzCursor.c +++ /dev/null @@ -1,646 +0,0 @@ -/************************************************************** - * - * Support for using the Quartz Window Manager cursor - * - * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE 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. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "quartzCommon.h" -#include "quartzCursor.h" -#include "darwin.h" - -#include - -#include "mi.h" -#include "scrnintstr.h" -#include "cursorstr.h" -#include "mipointrst.h" -#include "globals.h" - -// Size of the QuickDraw cursor -#define CURSORWIDTH 16 -#define CURSORHEIGHT 16 - -typedef struct { - int qdCursorMode; - int qdCursorVisible; - int useQDCursor; - QueryBestSizeProcPtr QueryBestSize; - miPointerSpriteFuncPtr spriteFuncs; -} QuartzCursorScreenRec, *QuartzCursorScreenPtr; - -static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey; -static CursorPtr quartzLatentCursor = NULL; -static QD_Cursor gQDArrow; // QuickDraw arrow cursor - -// Cursor for the main thread to set (NULL = arrow cursor). -static CCrsrHandle currentCursor = NULL; -static pthread_mutex_t cursorMutex; -static pthread_cond_t cursorCondition; - -#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ - dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) - -#define HIDE_QD_CURSOR(pScreen, visible) \ - if (visible) { \ - int ix; \ - for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \ - CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \ - } \ - visible = FALSE; \ - } ((void)0) - -#define SHOW_QD_CURSOR(pScreen, visible) \ - { \ - int ix; \ - for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \ - CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \ - } \ - visible = TRUE; \ - } ((void)0) - -#define CHANGE_QD_CURSOR(cursorH) \ - if (!quartzServerQuitting) { \ - /* Acquire lock and tell the main thread to change cursor */ \ - pthread_mutex_lock(&cursorMutex); \ - currentCursor = (CCrsrHandle) (cursorH); \ - QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \ - \ - /* Wait for the main thread to change the cursor */ \ - pthread_cond_wait(&cursorCondition, &cursorMutex); \ - pthread_mutex_unlock(&cursorMutex); \ - } ((void)0) - - -/* - * MakeQDCursor helpers: CTAB_ENTER, interleave - */ - -// Add a color entry to a ctab -#define CTAB_ENTER(ctab, index, r, g, b) \ - ctab->ctTable[index].value = index; \ - ctab->ctTable[index].rgb.red = r; \ - ctab->ctTable[index].rgb.green = g; \ - ctab->ctTable[index].rgb.blue = b - -// Make an unsigned short by interleaving the bits of bytes c1 and c2. -// High bit of c1 is first; low bit of c2 is last. -// Interleave is a built-in INTERCAL operator. -static unsigned short -interleave( - unsigned char c1, - unsigned char c2 ) -{ - return - ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) | - ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) | - ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) | - ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) | - ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) | - ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) | - ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) | - ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ; -} - -/* - * MakeQDCursor - * Make a QuickDraw color cursor from the given X11 cursor. - * Warning: This code is nasty. Color cursors were meant to be read - * from resources; constructing the structures programmatically is messy. - */ -/* - QuickDraw cursor representation: - Our color cursor is a 2 bit per pixel pixmap. - Each pixel's bits are (source<<1 | mask) from the original X cursor pixel. - The cursor's color table maps the colors like this: - (2-bit value | X result | colortable | Mac result) - 00 | transparent | white | transparent (white outside mask) - 01 | back color | back color | back color - 10 | undefined | black | invert background (just for fun) - 11 | fore color | fore color | fore color -*/ -static CCrsrHandle -MakeQDCursor( - CursorPtr pCursor ) -{ - CCrsrHandle result; - CCrsrPtr curs; - int i, w, h; - unsigned short rowMask; - PixMap *pix; - ColorTable *ctab; - unsigned short *image; - - result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr)); - if (!result) return NULL; - HLock((Handle)result); - curs = *result; - - // Initialize CCrsr - curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color - curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap)); - if (!curs->crsrMap) goto pixAllocFailed; - HLock((Handle)curs->crsrMap); - pix = *curs->crsrMap; - curs->crsrData = NULL; // raw cursor image data (set below) - curs->crsrXData = NULL; // QD's processed data - curs->crsrXValid = 0; // zero means QD must re-process cursor data - curs->crsrXHandle = NULL; // reserved - memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data - memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask - curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot - curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot - curs->crsrXTable = 0; // reserved - curs->crsrID = GetCTSeed(); // unique ID from Color Manager - - // Set the b&w data and mask - w = min(pCursor->bits->width, CURSORWIDTH); - h = min(pCursor->bits->height, CURSORHEIGHT); - rowMask = ~((1 << (CURSORWIDTH - w)) - 1); - for (i = 0; i < h; i++) { - curs->crsr1Data[i] = rowMask & - ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]); - curs->crsrMask[i] = rowMask & - ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]); - } - - // Set the color data and mask - // crsrMap: defines bit depth and size and colortable only - pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap - SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020 - pix->pixelSize = 2; - pix->cmpCount = 1; - pix->cmpSize = 2; - // pix->pmTable set below - - // crsrData is the pixel data. crsrMap's baseAddr is not used. - curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8); - if (!curs->crsrData) goto imageAllocFailed; - HLock((Handle)curs->crsrData); - image = (unsigned short *) *curs->crsrData; - // Pixel data is just 1-bit data and mask interleaved (see above) - for (i = 0; i < h; i++) { - unsigned char s, m; - s = pCursor->bits->source[i*4] & (rowMask >> 8); - m = pCursor->bits->mask[i*4] & (rowMask >> 8); - image[2*i] = interleave(s, m); - s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff); - m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff); - image[2*i+1] = interleave(s, m); - } - - // Build the color table (entries described above) - // NewPixMap allocates a color table handle. - pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3 - * sizeof(ColorSpec)); - if (!pix->pmTable) goto ctabAllocFailed; - HLock((Handle)pix->pmTable); - ctab = *pix->pmTable; - ctab->ctSeed = GetCTSeed(); - ctab->ctFlags = 0; - ctab->ctSize = 3; // color count - 1 - CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff); - CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen, - pCursor->backBlue); - CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000); - CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen, - pCursor->foreBlue); - - HUnlock((Handle)pix->pmTable); // ctab - HUnlock((Handle)curs->crsrData); // image data - HUnlock((Handle)curs->crsrMap); // pix - HUnlock((Handle)result); // cursor - - return result; - - // "What we have here is a failure to allocate" -ctabAllocFailed: - HUnlock((Handle)curs->crsrData); - DisposeHandle((Handle)curs->crsrData); -imageAllocFailed: - HUnlock((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrMap); -pixAllocFailed: - HUnlock((Handle)result); - DisposeHandle((Handle)result); - return NULL; -} - - -/* - * FreeQDCursor - * Destroy a QuickDraw color cursor created with MakeQDCursor(). - * The cursor must not currently be on screen. - */ -static void FreeQDCursor(CCrsrHandle cursHandle) -{ - CCrsrPtr curs; - PixMap *pix; - - HLock((Handle)cursHandle); - curs = *cursHandle; - HLock((Handle)curs->crsrMap); - pix = *curs->crsrMap; - DisposeHandle((Handle)pix->pmTable); - HUnlock((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrData); - HUnlock((Handle)cursHandle); - DisposeHandle((Handle)cursHandle); -} - - -/* -=========================================================================== - - Pointer sprite functions - -=========================================================================== -*/ - -/* - * QuartzRealizeCursor - * Convert the X cursor representation to QuickDraw format if possible. - */ -Bool -QuartzRealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor ) -{ - CCrsrHandle qdCursor; - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if(!pCursor || !pCursor->bits) - return FALSE; - - // if the cursor is too big we use a software cursor - if ((pCursor->bits->height > CURSORHEIGHT) || - (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor) - { - if (quartzRootless) { - // rootless can't use a software cursor - return TRUE; - } else { - return (*ScreenPriv->spriteFuncs->RealizeCursor) - (pScreen, pCursor); - } - } - - // make new cursor image - qdCursor = MakeQDCursor(pCursor); - if (!qdCursor) return FALSE; - - // save the result - dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor); - - return TRUE; -} - - -/* - * QuartzUnrealizeCursor - * Free the storage space associated with a realized cursor. - */ -Bool -QuartzUnrealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor ) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if ((pCursor->bits->height > CURSORHEIGHT) || - (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor) - { - if (quartzRootless) { - return TRUE; - } else { - return (*ScreenPriv->spriteFuncs->UnrealizeCursor) - (pScreen, pCursor); - } - } else { - CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates, - pScreen); - if (currentCursor != oldCursor) { - // This should only fail when quitting, in which case we just leak. - FreeQDCursor(oldCursor); - } - dixSetPrivate(&pCursor->devPrivates, pScreen, NULL); - return TRUE; - } -} - - -/* - * QuartzSetCursor - * Set the cursor sprite and position. - * Use QuickDraw cursor if possible. - */ -static void -QuartzSetCursor( - ScreenPtr pScreen, - CursorPtr pCursor, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - quartzLatentCursor = pCursor; - - // Don't touch Mac OS cursor if X is hidden! - if (!quartzServerVisible) - return; - - if (!pCursor) { - // Remove the cursor completely. - HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - if (! ScreenPriv->qdCursorMode) - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - } - else if ((pCursor->bits->height <= CURSORHEIGHT) && - (pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor) - { - // Cursor is small enough to use QuickDraw directly. - if (! ScreenPriv->qdCursorMode) // remove the X cursor - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - ScreenPriv->qdCursorMode = TRUE; - - CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen)); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - } - else if (quartzRootless) { - // Rootless can't use a software cursor, so we just use Mac OS arrow. - CHANGE_QD_CURSOR(NULL); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - } - else { - // Cursor is too big for QuickDraw. Use X software cursor. - HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - ScreenPriv->qdCursorMode = FALSE; - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y); - } -} - - -/* - * QuartzReallySetCursor - * Set the QuickDraw cursor. Called from the main thread since changing the - * cursor with QuickDraw is not thread safe on dual processor machines. - */ -void -QuartzReallySetCursor() -{ - pthread_mutex_lock(&cursorMutex); - - if (currentCursor) { - SetCCursor(currentCursor); - } else { - SetCursor(&gQDArrow); - } - - pthread_cond_signal(&cursorCondition); - pthread_mutex_unlock(&cursorMutex); -} - - -/* - * QuartzMoveCursor - * Move the cursor. This is a noop for QuickDraw. - */ -static void -QuartzMoveCursor( - ScreenPtr pScreen, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - // only the X cursor needs to be explicitly moved - if (!ScreenPriv->qdCursorMode) - (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); -} - - -static miPointerSpriteFuncRec quartzSpriteFuncsRec = { - QuartzRealizeCursor, - QuartzUnrealizeCursor, - QuartzSetCursor, - QuartzMoveCursor -}; - - -/* -=========================================================================== - - Pointer screen functions - -=========================================================================== -*/ - -/* - * QuartzCursorOffScreen - */ -static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y) -{ - return FALSE; -} - - -/* - * QuartzCrossScreen - */ -static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering) -{ - return; -} - - -/* - * QuartzWarpCursor - * Change the cursor position without generating an event or motion history. - * The input coordinates (x,y) are in pScreen-local X11 coordinates. - * - */ -static void -QuartzWarpCursor( - ScreenPtr pScreen, - int x, - int y) -{ - static int neverMoved = TRUE; - - if (neverMoved) { - // Don't move the cursor the first time. This is the jump-to-center - // initialization, and it's annoying because we may still be in MacOS. - neverMoved = FALSE; - return; - } - - if (quartzServerVisible) { - CGDisplayErr cgErr; - CGPoint cgPoint; - // Only need to do this for one display. Any display will do. - CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0]; - CGRect cgRect = CGDisplayBounds(cgID); - - // Convert (x,y) to CoreGraphics screen-local CG coordinates. - // This is necessary because the X11 screen and CG screen may not - // coincide. (e.g. X11 screen may be moved to dodge the menu bar) - - // Make point in X11 global coordinates - cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x, - y + dixScreenOrigins[pScreen->myNum].y); - // Shift to CoreGraphics global screen coordinates - cgPoint.x += darwinMainScreenX; - cgPoint.y += darwinMainScreenY; - // Shift to CoreGraphics screen-local coordinates - cgPoint.x -= cgRect.origin.x; - cgPoint.y -= cgRect.origin.y; - - cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint); - if (cgErr != CGDisplayNoErr) { - ErrorF("Could not set cursor position with error code 0x%x.\n", - cgErr); - } - } - - miPointerWarpCursor(pScreen, x, y); - miPointerUpdate(); -} - - -static miPointerScreenFuncRec quartzScreenFuncsRec = { - QuartzCursorOffScreen, - QuartzCrossScreen, - QuartzWarpCursor, - NULL, - NULL -}; - - -/* -=========================================================================== - - Other screen functions - -=========================================================================== -*/ - -/* - * QuartzCursorQueryBestSize - * Handle queries for best cursor size - */ -static void -QuartzCursorQueryBestSize( - int class, - unsigned short *width, - unsigned short *height, - ScreenPtr pScreen) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if (class == CursorShape) { - *width = CURSORWIDTH; - *height = CURSORHEIGHT; - } else { - (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); - } -} - - -/* - * QuartzInitCursor - * Initialize cursor support - */ -Bool -QuartzInitCursor( - ScreenPtr pScreen ) -{ - QuartzCursorScreenPtr ScreenPriv; - miPointerScreenPtr PointPriv; - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - - // initialize software cursor handling (always needed as backup) - if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) { - return FALSE; - } - - ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) ); - if (!ScreenPriv) return FALSE; - - CURSOR_PRIV(pScreen) = ScreenPriv; - - // override some screen procedures - ScreenPriv->QueryBestSize = pScreen->QueryBestSize; - pScreen->QueryBestSize = QuartzCursorQueryBestSize; - - // initialize QuickDraw cursor handling - GetQDGlobalsArrow(&gQDArrow); - PointPriv = (miPointerScreenPtr) - dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); - - ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - PointPriv->spriteFuncs = &quartzSpriteFuncsRec; - - if (!quartzRootless) - ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel); - else - ScreenPriv->useQDCursor = TRUE; - ScreenPriv->qdCursorMode = TRUE; - ScreenPriv->qdCursorVisible = TRUE; - - // initialize cursor mutex lock - pthread_mutex_init(&cursorMutex, NULL); - - // initialize condition for waiting - pthread_cond_init(&cursorCondition, NULL); - - return TRUE; -} - - -// X server is hiding. Restore the Aqua cursor. -void QuartzSuspendXCursor( - ScreenPtr pScreen ) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - CHANGE_QD_CURSOR(NULL); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); -} - - -// X server is showing. Restore the X cursor. -void QuartzResumeXCursor( - ScreenPtr pScreen, - int x, - int y ) -{ - QuartzSetCursor(pScreen, quartzLatentCursor, x, y); -} diff --git a/hw/xquartz/quartzCursor.h b/hw/xquartz/quartzCursor.h deleted file mode 100644 index 56a02098d..000000000 --- a/hw/xquartz/quartzCursor.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * quartzCursor.h - * - * External interface for Quartz hardware cursor - * - * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE 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 QUARTZCURSOR_H -#define QUARTZCURSOR_H - -#include "screenint.h" - -Bool QuartzInitCursor(ScreenPtr pScreen); -void QuartzReallySetCursor(void); -void QuartzSuspendXCursor(ScreenPtr pScreen); -void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); - -#endif From 8944b77ec0c18476a25ba3179bcc45b338be22b8 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Wed, 2 Apr 2008 17:47:42 -0700 Subject: [PATCH 143/183] continue with gutting darwinEvents.c (cherry picked from commit c34fce7051b996633291dddc061b696ff737f3fb) --- hw/xquartz/darwinEvents.c | 124 +++++++++----------------------------- 1 file changed, 28 insertions(+), 96 deletions(-) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 46f567536..5b037d2fa 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -78,7 +78,7 @@ typedef struct _EventQueue { } EventQueueRec, *EventQueuePtr; static EventQueueRec darwinEventQueue; -xEvent *darwinEvents; +xEvent *darwinEvents = NULL; /* * DarwinPressModifierMask @@ -207,8 +207,11 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven } Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { + if (!darwinEvents) + darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + if (!darwinEvents) + FatalError("Couldn't allocate event buffer\n"); - darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum()); mieqInit(); mieqSetHandler(kXquartzActivate, DarwinEventHandler); mieqSetHandler(kXquartzDeactivate, DarwinEventHandler); @@ -225,13 +228,6 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { mieqSetHandler(kXquartzWindowState, DarwinEventHandler); mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler); - darwinEventQueue.head = darwinEventQueue.tail = 0; - darwinEventQueue.lastEventTime = GetTimeInMillis (); - darwinEventQueue.pKbd = pKbd; - darwinEventQueue.pPtr = pPtr; - darwinEventQueue.pEnqueueScreen = screenInfo.screens[0]; - darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen; - SetInputCheck(&input_check_zero, &input_check_flag); return TRUE; } @@ -255,8 +251,6 @@ void DarwinEQEnqueue(const xEventPtr e) { * Read and process events from the event queue until it is empty. */ void ProcessInputEvents(void) { - EventRec *e; - int x, y; xEvent xe; // button number and modifier mask of currently pressed fake button input_check_flag=0; @@ -265,92 +259,11 @@ void ProcessInputEvents(void) { mieqProcessInputEvents(); // Empty the signaling pipe - x = sizeof(xe); - while (x == sizeof(xe)) - x = read(darwinEventReadFD, &xe, sizeof(xe)); - - while (darwinEventQueue.head != darwinEventQueue.tail) - { - if (screenIsSaved == SCREEN_SAVER_ON) - dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); - - e = &darwinEventQueue.events[darwinEventQueue.head]; - xe = e->event; - - // Shift from global screen coordinates to coordinates relative to - // the origin of the current screen. - xe.u.keyButtonPointer.rootX -= darwinMainScreenX + - dixScreenOrigins[miPointerCurrentScreen()->myNum].x; - xe.u.keyButtonPointer.rootY -= darwinMainScreenY + - dixScreenOrigins[miPointerCurrentScreen()->myNum].y; - - /* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n", - xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY, - darwinMainScreenX, darwinMainScreenY, - miPointerCurrentScreen()->myNum, - dixScreenOrigins[miPointerCurrentScreen()->myNum].x, - dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */ - - //Assumption - screen switching can only occur on motion events - - if (e->pScreen != darwinEventQueue.pDequeueScreen) - { - darwinEventQueue.pDequeueScreen = e->pScreen; - x = xe.u.keyButtonPointer.rootX; - y = xe.u.keyButtonPointer.rootY; - if (darwinEventQueue.head == QUEUE_SIZE - 1) - darwinEventQueue.head = 0; - else - ++darwinEventQueue.head; - NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y); - } - else - { - if (darwinEventQueue.head == QUEUE_SIZE - 1) - darwinEventQueue.head = 0; - else - ++darwinEventQueue.head; - switch (xe.u.u.type) { - case KeyPress: - case KeyRelease: - ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n"); - break; - - case ButtonPress: - ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n"); - break; - - case ButtonRelease: - ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n"); - break; - - case MotionNotify: - ErrorF("Unexpected MotionNotify event in DarwinProcessInputEvents\n"); - break; - - case kXquartzUpdateModifiers: - ErrorF("Unexpected kXquartzUpdateModifiers event in DarwinProcessInputEvents\n"); - break; - - case kXquartzUpdateButtons: - ErrorF("Unexpected kXquartzUpdateButtons event in DarwinProcessInputEvents\n"); - break; - - case kXquartzScrollWheel: - ErrorF("Unexpected kXquartzScrollWheel event in DarwinProcessInputEvents\n"); - break; - - case kXquartzDeactivate: - DarwinReleaseModifiers(); - // fall through - default: - // Check for mode specific event - QuartzProcessEvent(&xe); - } - } + int x = sizeof(xe); + while (x == sizeof(xe)) { + DEBUG_LOG("draining pipe\n"); + x = read(darwinEventReadFD, &xe, sizeof(xe)); } - - // miPointerUpdate(); } /* Sends a null byte down darwinEventWriteFD, which will cause the @@ -368,6 +281,10 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin static int darwinFakeMouseButtonMask = 0; int i, num_events; + if(!darwinEvents) { + ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n"); + return; + } /* I can't find a spec for this, but at least GTK expects that tablets are just like mice, except they have either one or three extra valuators, in this order: @@ -421,6 +338,11 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin void DarwinSendKeyboardEvents(int ev_type, int keycode) { int i, num_events; + if(!darwinEvents) { + ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n"); + return; + } + if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) { /* See if keymap has changed. */ @@ -447,6 +369,11 @@ void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y, tilt_x * INT32_MAX * 1.0f, tilt_y * INT32_MAX * 1.0f}; + if(!darwinEvents) { + ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n"); + return; +} + num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type, 0, 5, valuators); @@ -465,6 +392,11 @@ void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y, tilt_x * INT32_MAX * 1.0f, tilt_y * INT32_MAX * 1.0f}; + if(!darwinEvents) { + ErrorF("DarwinSendScrollEvents called before darwinEvents was initialized\n"); + return; + } + for (count = fabs(count); count > 0.0; count = count - 1.0f) { int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button, POINTER_ABSOLUTE, 0, 5, valuators); From 89f1d880e83e32b72d35c4dbd6795defa6efa847 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 19:47:28 -0700 Subject: [PATCH 144/183] nuke DarwinEventQueue (cherry picked from commit 1e0ec02202eeaffae480048b91bf02140ee29f8a) --- hw/xquartz/darwinEvents.c | 33 --------------------------------- hw/xquartz/quartz.c | 2 +- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 5b037d2fa..230050f60 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -56,28 +56,10 @@ in this Software without prior written authorization from The Open Group. #define SCROLLWHEELUPFAKE 4 #define SCROLLWHEELDOWNFAKE 5 -#define QUEUE_SIZE 256 - -typedef struct _Event { - xEvent event; - ScreenPtr pScreen; -} EventRec, *EventPtr; - int input_check_zero, input_check_flag; static int old_flags = 0; // last known modifier state -typedef struct _EventQueue { - HWEventQueueType head, tail; /* long for SetInputCheck */ - CARD32 lastEventTime; /* to avoid time running backwards */ - Bool lastMotion; - EventRec events[QUEUE_SIZE]; /* static allocation for signals */ - DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ - ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ - ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ -} EventQueueRec, *EventQueuePtr; - -static EventQueueRec darwinEventQueue; xEvent *darwinEvents = NULL; /* @@ -231,21 +213,6 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { return TRUE; } - -/* - * DarwinEQEnqueue - * Must be thread safe with ProcessInputEvents. - * DarwinEQEnqueue - called from event gathering thread - * ProcessInputEvents - called from X server thread - * DarwinEQEnqueue should never be called from more than one thread. - * - * This should be deprecated in favor of miEQEnqueue -- BB - */ -void DarwinEQEnqueue(const xEventPtr e) { - mieqEnqueue(NULL, e); - DarwinPokeEQ(); -} - /* * ProcessInputEvents * Read and process events from the event queue until it is empty. diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 971c9b278..5dfdeeb30 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -401,7 +401,7 @@ QuartzMessageServerThread( va_end (args); } - DarwinEQEnqueue(&xe); + mieqEnqueue(NULL, &xe); } From 985c631b2e1f113039e6e620f030505435fd9815 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 20:18:58 -0700 Subject: [PATCH 145/183] just a bit of juggling headers around -- we're preparing to call our Xquartz-specific event handlers directly as mieqHandlers (cherry picked from commit 4aedba5aa727e22316e8ca456f7218bea9ee0313) --- hw/xquartz/darwin.c | 2 +- hw/xquartz/darwin.h | 2 +- hw/xquartz/quartz.c | 3 +++ hw/xquartz/quartzCocoa.m | 3 ++- hw/xquartz/quartzPasteboard.c | 10 ++++++---- hw/xquartz/quartzPasteboard.h | 4 ++-- hw/xquartz/xpr/xprScreen.c | 1 + 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 8f2511dbb..002ea413d 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -880,7 +880,7 @@ void AbortDDX( void ) */ void -xf86SetRootClip (ScreenPtr pScreen, BOOL enable) +xf86SetRootClip (ScreenPtr pScreen, int enable) { WindowPtr pWin = WindowTable[pScreen->myNum]; WindowPtr pChild; diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index 9384b9dbb..8c3cabbd1 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -54,7 +54,7 @@ typedef struct { void DarwinPrintBanner(void); int DarwinParseModifierList(const char *constmodifiers); void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo); -void xf86SetRootClip (ScreenPtr pScreen, BOOL enable); +void xf86SetRootClip (ScreenPtr pScreen, int enable); #define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \ dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey)) diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 5dfdeeb30..ec211cf0a 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -33,6 +33,7 @@ #endif #include "quartzCommon.h" +#include "inputstr.h" #include "quartz.h" #include "darwin.h" #include "darwinEvents.h" @@ -489,6 +490,7 @@ void QuartzProcessEvent(xEvent *xe) { GiveUp(0); break; +#if 0 case kXquartzReadPasteboard: QuartzReadPasteboard(); break; @@ -496,6 +498,7 @@ void QuartzProcessEvent(xEvent *xe) { case kXquartzWritePasteboard: QuartzWritePasteboard(); break; +#endif case kXquartzBringAllToFront: DEBUG_LOG("kXquartzBringAllToFront\n"); diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m index 53e3f0897..d8f9c69e4 100644 --- a/hw/xquartz/quartzCocoa.m +++ b/hw/xquartz/quartzCocoa.m @@ -37,13 +37,14 @@ #endif #include "quartzCommon.h" +#include "inputstr.h" #include "quartzPasteboard.h" #define BOOL xBOOL #include "darwin.h" -#undef BOOL #include +#undef BOOL #include "pseudoramiX.h" diff --git a/hw/xquartz/quartzPasteboard.c b/hw/xquartz/quartzPasteboard.c index 0bf84f5d5..d47047ce0 100644 --- a/hw/xquartz/quartzPasteboard.c +++ b/hw/xquartz/quartzPasteboard.c @@ -34,6 +34,8 @@ #include #endif +#include "misc.h" +#include "inputstr.h" #include "quartzPasteboard.h" #include @@ -76,8 +78,8 @@ static char * QuartzReadCutBuffer(void) } // Write X cut buffer to Mac OS X pasteboard -// Called by ProcessInputEvents() in response to request from X server thread. -void QuartzWritePasteboard(void) +// Called by mieqProcessInputEvents() in response to request from X server thread. +void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { char *text; text = QuartzReadCutBuffer(); @@ -90,8 +92,8 @@ void QuartzWritePasteboard(void) #define strequal(a, b) (0 == strcmp((a), (b))) // Read Mac OS X pasteboard into X cut buffer -// Called by ProcessInputEvents() in response to request from X server thread. -void QuartzReadPasteboard(void) +// Called by mieqProcessInputEvents() in response to request from X server thread. +void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { char *oldText = QuartzReadCutBuffer(); char *text = QuartzReadCocoaPasteboard(); diff --git a/hw/xquartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h index d6a8ee815..b51cd88e0 100644 --- a/hw/xquartz/quartzPasteboard.h +++ b/hw/xquartz/quartzPasteboard.h @@ -34,11 +34,11 @@ #define _QUARTZPASTEBOARD_H // Aqua->X -void QuartzReadPasteboard(void); +void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int); char * QuartzReadCocoaPasteboard(void); // caller must free string // X->Aqua -void QuartzWritePasteboard(void); +void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int); void QuartzWriteCocoaPasteboard(char *text); #endif /* _QUARTZPASTEBOARD_H */ diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index b653a6e3b..5e144731d 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -32,6 +32,7 @@ #endif #include "quartzCommon.h" +#include "inputstr.h" #include "quartz.h" #include "xpr.h" #include "pseudoramiX.h" From c1be4e3379d8780dff20390939b657ca0973995a Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 21:04:37 -0700 Subject: [PATCH 146/183] shovelling code around ... (cherry picked from commit 2143182ba49195bbb2e9163ea6872fd68e7a4a85) --- dix/main.c | 14 ++++ hw/xquartz/darwinEvents.c | 106 +++++++++++++++++++++++++++++-- hw/xquartz/darwinKeyboard.c | 8 +++ hw/xquartz/quartz.c | 123 ++---------------------------------- hw/xquartz/quartz.h | 2 +- 5 files changed, 130 insertions(+), 123 deletions(-) diff --git a/dix/main.c b/dix/main.c index db4347341..8f6507f5c 100644 --- a/dix/main.c +++ b/dix/main.c @@ -113,6 +113,9 @@ Equipment Corporation. #include "dispatch.h" /* InitProcVectors() */ #endif +#include +pthread_key_t threadname_key=0; + #ifdef DPMSExtension #define DPMS_SERVER #include @@ -248,6 +251,17 @@ main(int argc, char *argv[], char *envp[]) char *xauthfile; HWEventQueueType alwaysCheckForInput[2]; + if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL)); + ErrorF("threadname_key = %d\n", threadname_key); + if(pthread_getspecific(threadname_key) == NULL) { + char *nameptr = malloc(32); + sprintf(nameptr, "main thread %d", random()); + // strcpy(nameptr, "main thread"); + ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr)); + if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key)); + } else { + if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key)); + } display = "0"; InitGlobals(); diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 230050f60..28a712dab 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -52,6 +52,11 @@ in this Software without prior written authorization from The Open Group. #include #include +#define _APPLEWM_SERVER_ +#include "applewmExt.h" +#include + + /* Fake button press/release for scroll wheel move. */ #define SCROLLWHEELUPFAKE 4 #define SCROLLWHEELDOWNFAKE 5 @@ -177,14 +182,103 @@ static void DarwinSimulateMouseClick( DarwinUpdateModifiers(KeyPress, modifierMask); } +/* Generic handler for Xquartz-specifc events. When possible, these should + be moved into their own individual functions and set as handlers using + mieqSetHandler. */ + void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { int i; DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents); for (i=0; iu.u.type) { - case kXquartzControllerNotify: - DEBUG_LOG("kXquartzControllerNotify\n"); - AppleWMSendEvent(AppleWMControllerNotify, - AppleWMControllerNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXquartzPasteboardNotify: - DEBUG_LOG("kXquartzPasteboardNotify\n"); - AppleWMSendEvent(AppleWMPasteboardNotify, - AppleWMPasteboardNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXquartzActivate: - DEBUG_LOG("kXquartzActivate\n"); - QuartzShow(xe->u.keyButtonPointer.rootX, - xe->u.keyButtonPointer.rootY); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsActive, 0); - break; - - case kXquartzDeactivate: - DEBUG_LOG("kXquartzDeactivate\n"); - AppleWMSendEvent(AppleWMActivationNotify, - AppleWMActivationNotifyMask, - AppleWMIsInactive, 0); - QuartzHide(); - break; - - case kXquartzDisplayChanged: - DEBUG_LOG("kXquartzDisplayChanged\n"); - QuartzUpdateScreens(); - break; - - case kXquartzWindowState: - DEBUG_LOG("kXquartzWindowState\n"); - RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); - break; - - case kXquartzWindowMoved: - DEBUG_LOG("kXquartzWindowMoved\n"); - RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0); - break; - - case kXquartzToggleFullscreen: - DEBUG_LOG("kXquartzToggleFullscreen\n"); -#ifdef DARWIN_DDX_MISSING - if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot); - else if (quartzHasRoot) QuartzHide(); - else QuartzShow(); -#else - // ErrorF("kXquartzToggleFullscreen not implemented\n"); -#endif - break; - - case kXquartzSetRootless: - DEBUG_LOG("kXquartzSetRootless\n"); -#ifdef DARWIN_DDX_MISSING - QuartzSetRootless(xe->u.clientMessage.u.l.longs0); - if (!quartzEnableRootless && !quartzHasRoot) QuartzHide(); -#else - // ErrorF("kXquartzSetRootless not implemented\n"); -#endif - break; - - case kXquartzSetRootClip: - QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0); - break; - - case kXquartzQuit: - GiveUp(0); - break; - -#if 0 - case kXquartzReadPasteboard: - QuartzReadPasteboard(); - break; - - case kXquartzWritePasteboard: - QuartzWritePasteboard(); - break; -#endif - - case kXquartzBringAllToFront: - DEBUG_LOG("kXquartzBringAllToFront\n"); - RootlessOrderAllWindows(); - break; - - case kXquartzSpaceChanged: - DEBUG_LOG("kXquartzSpaceChanged\n"); - QuartzSpaceChanged(xe->u.clientMessage.u.l.longs0); - break; - default: - ErrorF("Unknown application defined event type %d.\n", xe->u.u.type); - } -} diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h index fbe308a92..ffe06f9c6 100644 --- a/hw/xquartz/quartz.h +++ b/hw/xquartz/quartz.h @@ -130,5 +130,5 @@ void QuartzInitOutput(int argc,char **argv); void QuartzInitInput(int argc, char **argv); void QuartzGiveUp(void); void QuartzProcessEvent(xEvent *xe); - +void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); #endif From e9e2d88436597875f102085d216dc0a8fce1450a Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 22:55:24 -0700 Subject: [PATCH 147/183] moved and renamed QuartzMessageServerThread to DarwinSendDDXEvent to make more clear what it actually does. (cherry picked from commit bee2b377efc930e25017636e5112093a3a6549c7) --- hw/xquartz/X11Application.m | 14 +++++++------- hw/xquartz/X11Controller.m | 32 ++++++++++++++++---------------- hw/xquartz/darwin.h | 3 +++ hw/xquartz/darwinEvents.c | 28 ++++++++++++++++++++++++++++ hw/xquartz/darwinEvents.h | 2 ++ hw/xquartz/quartz.c | 31 ------------------------------- hw/xquartz/xpr/xprScreen.c | 8 ++++---- 7 files changed, 60 insertions(+), 58 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 147b4b4c0..28bb52995 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -1,6 +1,6 @@ /* X11Application.m -- subclass of NSApplication to multiplex events - Copyright (c) 2002-2007 Apple Inc. + Copyright (c) 2002-2008 Apple Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -166,7 +166,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { static TSMDocumentID x11_document; DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { - QuartzMessageServerThread (kXquartzActivate, 0); + DarwinSendDDXEvent(kXquartzActivate, 0); if (!_x_active) { if (x11_document == 0 && darwinKeymapFile == NULL) { @@ -178,10 +178,10 @@ static void message_kit_thread (SEL selector, NSObject *arg) { if (x11_document != 0) ActivateTSMDocument (x11_document); } } else { - QuartzMessageServerThread (kXquartzDeactivate, 0); + DarwinSendDDXEvent(kXquartzDeactivate, 0); if (_x_active && x11_document != 0) - DeactivateTSMDocument (x11_document); + DeactivateTSMDocument (x11_document); } _x_active = state; @@ -246,7 +246,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { swallow_up = 0; for_x = NO; #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXquartzToggleFullscreen, 0); + DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); #endif } } else { @@ -271,7 +271,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { case NSApplicationActivatedEventType: for_x = NO; if ([self modalWindow] == nil) { - for_appkit = NO; + for_appkit = NO; /* FIXME: hack to avoid having to pass the event to appkit, which would cause it to raise one of its windows. */ @@ -654,7 +654,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { /* This will end up at the end of the responder chain. */ - (void) copy:sender { - QuartzMessageServerThread (kXquartzPasteboardNotify, 1, + DarwinSendDDXEvent(kXquartzPasteboardNotify, 1, AppleWMCopyToPasteboard); } diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index aa9fa94be..5bf4f4d52 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -1,6 +1,6 @@ /* X11Controller.m -- connect the IB ui, also the NSApp delegate - Copyright (c) 2002-2007 Apple Inc. All rights reserved. + Copyright (c) 2002-2008 Apple Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files @@ -103,7 +103,7 @@ { [NSApp activateIgnoringOtherApps:YES]; - QuartzMessageServerThread (kXquartzControllerNotify, 2, + DarwinSendDDXEvent(kXquartzControllerNotify, 2, AppleWMWindowMenuItem, [sender tag]); } @@ -254,7 +254,7 @@ [self remove_window_menu]; [self install_window_menu:list]; - QuartzMessageServerThread (kXquartzControllerNotify, 1, + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMWindowMenuNotify); } @@ -539,20 +539,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (void) hide_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow); else NSBeep (); /* FIXME: something here */ } - (IBAction)bring_to_front:sender { - QuartzMessageServerThread(kXquartzControllerNotify, 1, AppleWMBringAllToFront); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront); } - (IBAction)close_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMCloseWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow); else [[NSApp keyWindow] performClose:sender]; } @@ -560,7 +560,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)minimize_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMMinimizeWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow); else [[NSApp keyWindow] performMiniaturize:sender]; } @@ -568,19 +568,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction)zoom_window:sender { if ([X11App x_active]) - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMZoomWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow); else [[NSApp keyWindow] performZoom:sender]; } - (IBAction) next_window:sender { - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMNextWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow); } - (IBAction) previous_window:sender { - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMPreviousWindow); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow); } - (IBAction) enable_fullscreen_changed:sender @@ -588,7 +588,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row int value = ![enable_fullscreen intValue]; #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXquartzSetRootless, 1, value); + DarwinSendDDXEvent(kXquartzSetRootless, 1, value); #endif [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value]; @@ -598,7 +598,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction) toggle_fullscreen:sender { #ifdef DARWIN_DDX_MISSING - QuartzMessageServerThread (kXquartzToggleFullscreen, 0); + DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); #endif } @@ -661,7 +661,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (IBAction) quit:sender { - QuartzMessageServerThread (kXquartzQuit, 0); + DarwinSendDDXEvent(kXquartzQuit, 0); } - (IBAction) x11_help:sender @@ -684,12 +684,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (void) applicationDidHide:(NSNotification *)notify { - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideAll); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll); } - (void) applicationDidUnhide:(NSNotification *)notify { - QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMShowAll); + DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll); } - (NSApplicationTerminateReply) applicationShouldTerminate:sender @@ -717,7 +717,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [X11App prefs_synchronize]; /* shutdown the X server, it will exit () for us. */ - QuartzMessageServerThread (kXquartzQuit, 0); + DarwinSendDDXEvent(kXquartzQuit, 0); /* In case it doesn't, exit anyway after a while. */ while (sleep (10) != 0) ; diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index 8c3cabbd1..01e6f41f2 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2008 Apple, Inc. * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -120,6 +121,8 @@ enum { kXquartzWindowMoved, // window has moved on screen }; +void DarwinSendDDXEvent(int type, int argc, ...); + #define ENABLE_DEBUG_LOG 1 #ifdef ENABLE_DEBUG_LOG diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 28a712dab..b6cd3f2b0 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -476,3 +476,31 @@ void DarwinUpdateModKeys(int flags) { DarwinUpdateModifiers(KeyPress, ~old_flags & flags); old_flags = flags; } + + +/* + * DarwinSendDDXEvent + * Send the X server thread a message by placing it on the event queue. + */ +void DarwinSendDDXEvent(int type, int argc, ...) { + xEvent xe; + INT32 *argv; + int i, max_args; + va_list args; + + memset(&xe, 0, sizeof(xe)); + xe.u.u.type = type; + xe.u.clientMessage.u.l.type = type; + + argv = &xe.u.clientMessage.u.l.longs0; + max_args = 4; + + if (argc > 0 && argc <= max_args) { + va_start (args, argc); + for (i = 0; i < argc; i++) + argv[i] = (int) va_arg (args, int); + va_end (args); + } + + mieqEnqueue(NULL, &xe); +} diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h index 1d8e92a7b..7c56be9c8 100644 --- a/hw/xquartz/darwinEvents.h +++ b/hw/xquartz/darwinEvents.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2008 Apple, Inc. * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -43,4 +44,5 @@ void DarwinUpdateModKeys(int flags); void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); + #endif /* _DARWIN_EVENTS_H */ diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index a65bd3748..96dc021a6 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -373,34 +373,3 @@ void QuartzSpaceChanged(uint32_t space_id) { /* Do something special here, so we don't depend on quartz-wm for spaces to work... */ DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id); } - -/* - * QuartzMessageServerThread - * Send the X server thread a message by placing it on the event queue. - */ -void -QuartzMessageServerThread( - int type, - int argc, ...) -{ - xEvent xe; - INT32 *argv; - int i, max_args; - va_list args; - - memset(&xe, 0, sizeof(xe)); - xe.u.u.type = type; - xe.u.clientMessage.u.l.type = type; - - argv = &xe.u.clientMessage.u.l.longs0; - max_args = 4; - - if (argc > 0 && argc <= max_args) { - va_start (args, argc); - for (i = 0; i < argc; i++) - argv[i] = (int) va_arg (args, int); - va_end (args); - } - - mieqEnqueue(NULL, &xe); -} diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 5e144731d..91bf25ac2 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -68,7 +68,7 @@ static void eventHandler(unsigned int type, const void *arg, switch (type) { case XP_EVENT_DISPLAY_CHANGED: DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); - QuartzMessageServerThread(kXquartzDisplayChanged, 0); + DarwinSendDDXEvent(kXquartzDisplayChanged, 0); break; case XP_EVENT_WINDOW_STATE_CHANGED: @@ -76,7 +76,7 @@ static void eventHandler(unsigned int type, const void *arg, const xp_window_state_event *ws_arg = arg; DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state); - QuartzMessageServerThread(kXquartzWindowState, 2, + DarwinSendDDXEvent(kXquartzWindowState, 2, ws_arg->id, ws_arg->state); } else { DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); @@ -88,7 +88,7 @@ static void eventHandler(unsigned int type, const void *arg, if (arg_size == sizeof(xp_window_id)) { xp_window_id id = * (xp_window_id *) arg; WindowPtr pWin = xprGetXWindow(id); - QuartzMessageServerThread(kXquartzWindowMoved, 1, pWin); + DarwinSendDDXEvent(kXquartzWindowMoved, 1, pWin); } break; @@ -111,7 +111,7 @@ static void eventHandler(unsigned int type, const void *arg, ErrorF("XP_EVENT_SPACE_CHANGED\n"); if(arg_size == sizeof(uint32_t)) { uint32_t space_id = *(uint32_t *)arg; - QuartzMessageServerThread(kXquartzSpaceChanged, 1, space_id); + DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id); } break; default: From 15b0084f1ab23042190d8beeb3f088b92dee5a10 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Mon, 31 Mar 2008 23:31:25 -0700 Subject: [PATCH 148/183] formatting cleanup for X11Application.m (no code changes) (cherry picked from commit eb083d3f68f459d90417558da1ed00729b749950) --- hw/xquartz/X11Application.m | 493 +++++++++++++++++------------------- 1 file changed, 237 insertions(+), 256 deletions(-) diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 28bb52995..2844fca10 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -166,171 +166,170 @@ static void message_kit_thread (SEL selector, NSObject *arg) { static TSMDocumentID x11_document; DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { - DarwinSendDDXEvent(kXquartzActivate, 0); - - if (!_x_active) { - if (x11_document == 0 && darwinKeymapFile == NULL) { - OSType types[1]; - types[0] = kUnicodeDocument; - NewTSMDocument (1, types, &x11_document, 0); - } - - if (x11_document != 0) ActivateTSMDocument (x11_document); - } + DarwinSendDDXEvent(kXquartzActivate, 0); + + if (!_x_active) { + if (x11_document == 0 && darwinKeymapFile == NULL) { + OSType types[1]; + types[0] = kUnicodeDocument; + NewTSMDocument (1, types, &x11_document, 0); + } + + if (x11_document != 0) ActivateTSMDocument (x11_document); + } } else { - DarwinSendDDXEvent(kXquartzDeactivate, 0); - - if (_x_active && x11_document != 0) - DeactivateTSMDocument (x11_document); - } - - _x_active = state; + DarwinSendDDXEvent(kXquartzDeactivate, 0); + + if (_x_active && x11_document != 0) + DeactivateTSMDocument (x11_document); + } + + _x_active = state; } - (void) became_key:(NSWindow *)win { - [self activateX:NO]; + [self activateX:NO]; } - (void) sendEvent:(NSEvent *)e { - NSEventType type; - BOOL for_appkit, for_x; + NSEventType type; + BOOL for_appkit, for_x; + + type = [e type]; + + /* By default pass down the responder chain and to X. */ + for_appkit = YES; + for_x = YES; - type = [e type]; - - /* By default pass down the responder chain and to X. */ - for_appkit = YES; - for_x = YES; - - switch (type) { - case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: - case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: - if ([e window] != nil) { - /* Pointer event has an (AppKit) window. Probably something for the kit. */ - for_x = NO; - if (_x_active) [self activateX:NO]; - } else if ([self modalWindow] == nil) { - /* Must be an X window. Tell appkit it doesn't have focus. */ - WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]); - if (pWin) RootlessReorderWindow(pWin); - for_appkit = NO; - - if ([self isActive]) { - [self deactivate]; - - if (!_x_active && quartzProcs->IsX11Window([e window], - [e windowNumber])) - [self activateX:YES]; - } - } - break; - - case NSKeyDown: case NSKeyUp: - if (_x_active) { - static int swallow_up; - - /* No kit window is focused, so send it to X. */ - for_appkit = NO; - if (type == NSKeyDown) { - /* Before that though, see if there are any global - shortcuts bound to it. */ - - if (X11EnableKeyEquivalents - && [[self mainMenu] performKeyEquivalent:e]) { - swallow_up = [e keyCode]; - for_x = NO; - } else if (!quartzEnableRootless - && ([e modifierFlags] & ALL_KEY_MASKS) - == (NSCommandKeyMask | NSAlternateKeyMask) - && ([e keyCode] == 0 /*a*/ - || [e keyCode] == 53 /*Esc*/)) { - swallow_up = 0; - for_x = NO; + switch (type) { + case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: + case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: + if ([e window] != nil) { + /* Pointer event has an (AppKit) window. Probably something for the kit. */ + for_x = NO; + if (_x_active) [self activateX:NO]; + } else if ([self modalWindow] == nil) { + /* Must be an X window. Tell appkit it doesn't have focus. */ + WindowPtr pWin = xprGetXWindowFromAppKit([e windowNumber]); + if (pWin) RootlessReorderWindow(pWin); + for_appkit = NO; + + if ([self isActive]) { + [self deactivate]; + if (!_x_active && quartzProcs->IsX11Window([e window], + [e windowNumber])) + [self activateX:YES]; + } + } + break; + + case NSKeyDown: case NSKeyUp: + if (_x_active) { + static int swallow_up; + + /* No kit window is focused, so send it to X. */ + for_appkit = NO; + if (type == NSKeyDown) { + /* Before that though, see if there are any global + shortcuts bound to it. */ + + if (X11EnableKeyEquivalents + && [[self mainMenu] performKeyEquivalent:e]) { + swallow_up = [e keyCode]; + for_x = NO; + } else if (!quartzEnableRootless + && ([e modifierFlags] & ALL_KEY_MASKS) + == (NSCommandKeyMask | NSAlternateKeyMask) + && ([e keyCode] == 0 /*a*/ + || [e keyCode] == 53 /*Esc*/)) { + swallow_up = 0; + for_x = NO; #ifdef DARWIN_DDX_MISSING - DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); + DarwinSendDDXEvent(kXquartzToggleFullscreen, 0); #endif + } + } else { + /* If we saw a key equivalent on the down, don't pass + the up through to X. */ + + if (swallow_up != 0 && [e keyCode] == swallow_up) { + swallow_up = 0; + for_x = NO; + } + } + } else for_x = NO; + break; + + case NSFlagsChanged: + /* For the l33t X users who remap modifier keys to normal keysyms. */ + if (!_x_active) for_x = NO; + break; + + case NSAppKitDefined: + switch ([e subtype]) { + case NSApplicationActivatedEventType: + for_x = NO; + if ([self modalWindow] == nil) { + for_appkit = NO; + + /* FIXME: hack to avoid having to pass the event to appkit, + which would cause it to raise one of its windows. */ + _appFlags._active = YES; + + [self activateX:YES]; + if ([e data2] & 0x10) X11ApplicationSetFrontProcess(); + } + break; + + case 18: /* ApplicationDidReactivate */ + if (quartzHasRoot) for_appkit = NO; + break; + + case NSApplicationDeactivatedEventType: + for_x = NO; + [self activateX:NO]; + break; + } + break; + + default: break; /* for gcc */ } - } else { - /* If we saw a key equivalent on the down, don't pass - the up through to X. */ - - if (swallow_up != 0 && [e keyCode] == swallow_up) { - swallow_up = 0; - for_x = NO; - } - } - } else for_x = NO; - break; - - case NSFlagsChanged: - /* For the l33t X users who remap modifier keys to normal keysyms. */ - if (!_x_active) for_x = NO; - break; - - case NSAppKitDefined: - switch ([e subtype]) { - case NSApplicationActivatedEventType: - for_x = NO; - if ([self modalWindow] == nil) { - for_appkit = NO; - - /* FIXME: hack to avoid having to pass the event to appkit, - which would cause it to raise one of its windows. */ - _appFlags._active = YES; - - [self activateX:YES]; - if ([e data2] & 0x10) X11ApplicationSetFrontProcess(); - } - break; - - case 18: /* ApplicationDidReactivate */ - if (quartzHasRoot) for_appkit = NO; - break; - - case NSApplicationDeactivatedEventType: - for_x = NO; - [self activateX:NO]; - break; - } - break; - - default: break; /* for gcc */ - } - - if (for_appkit) [super sendEvent:e]; - - if (for_x) send_nsevent (type, e); + + if (for_appkit) [super sendEvent:e]; + + if (for_x) send_nsevent (type, e); } - (void) set_window_menu:(NSArray *)list { - [_controller set_window_menu:list]; + [_controller set_window_menu:list]; } - (void) set_window_menu_check:(NSNumber *)n { - [_controller set_window_menu_check:n]; + [_controller set_window_menu_check:n]; } - (void) set_apps_menu:(NSArray *)list { - [_controller set_apps_menu:list]; + [_controller set_apps_menu:list]; } - (void) set_front_process:unused { - [NSApp activateIgnoringOtherApps:YES]; + [NSApp activateIgnoringOtherApps:YES]; - if ([self modalWindow] == nil) - [self activateX:YES]; + if ([self modalWindow] == nil) + [self activateX:YES]; } - (void) set_can_quit:(NSNumber *)state { - [_controller set_can_quit:[state boolValue]]; + [_controller set_can_quit:[state boolValue]]; } - (void) server_ready:unused { - [_controller server_ready]; + [_controller server_ready]; } - (void) show_hide_menubar:(NSNumber *)state { - if ([state boolValue]) ShowMenuBar (); - else HideMenuBar (); + if ([state boolValue]) ShowMenuBar (); + else HideMenuBar (); } @@ -348,57 +347,57 @@ static void cfrelease (CFAllocatorRef a, const void *b) { } static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) { - CFMutableArrayRef out; - CFArrayCallBacks cb; - NSObject *ns; - const CFTypeRef *cf; - int i, count; - - memset (&cb, 0, sizeof (cb)); - cb.version = 0; - cb.retain = cfretain; - cb.release = cfrelease; - - count = [in count]; - out = CFArrayCreateMutable (NULL, count, &cb); - - for (i = 0; i < count; i++) { - ns = [in objectAtIndex:i]; - - if ([ns isKindOfClass:[NSArray class]]) - cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns); - else - cf = CFRetain ((CFTypeRef) ns); - - CFArrayAppendValue (out, cf); - CFRelease (cf); - } - - return out; + CFMutableArrayRef out; + CFArrayCallBacks cb; + NSObject *ns; + const CFTypeRef *cf; + int i, count; + + memset (&cb, 0, sizeof (cb)); + cb.version = 0; + cb.retain = cfretain; + cb.release = cfrelease; + + count = [in count]; + out = CFArrayCreateMutable (NULL, count, &cb); + + for (i = 0; i < count; i++) { + ns = [in objectAtIndex:i]; + + if ([ns isKindOfClass:[NSArray class]]) + cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns); + else + cf = CFRetain ((CFTypeRef) ns); + + CFArrayAppendValue (out, cf); + CFRelease (cf); + } + + return out; } static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) { - NSMutableArray *out; - const CFTypeRef *cf; - NSObject *ns; - int i, count; - - count = CFArrayGetCount (in); - out = [[NSMutableArray alloc] initWithCapacity:count]; - - for (i = 0; i < count; i++) { - cf = CFArrayGetValueAtIndex (in, i); - - if (CFGetTypeID (cf) == CFArrayGetTypeID ()) - ns = cfarray_to_nsarray ((CFArrayRef) cf); - else - ns = [(id)cf retain]; - - [out addObject:ns]; - [ns release]; - } - - return out; + NSMutableArray *out; + const CFTypeRef *cf; + NSObject *ns; + int i, count; + + count = CFArrayGetCount (in); + out = [[NSMutableArray alloc] initWithCapacity:count]; + + for (i = 0; i < count; i++) { + cf = CFArrayGetValueAtIndex (in, i); + + if (CFGetTypeID (cf) == CFArrayGetTypeID ()) + ns = cfarray_to_nsarray ((CFArrayRef) cf); + else + ns = [(id)cf retain]; + + [out addObject:ns]; + [ns release]; + } + + return out; } - (CFPropertyListRef) prefs_get:(NSString *)key { @@ -855,86 +854,68 @@ convert_flags (unsigned int nsflags) { return xflags; } - -// This code should probably be merged with that in XDarwin's XServer.m - BB static void send_nsevent (NSEventType type, NSEvent *e) { - // static unsigned int button_state = 0; - NSRect screen; - NSPoint location; - NSWindow *window; - int pointer_x, pointer_y, ev_button, ev_type; - float pressure, tilt_x, tilt_y; + NSRect screen; + NSPoint location; + NSWindow *window; + int pointer_x, pointer_y, ev_button, ev_type; + float pressure, tilt_x, tilt_y; + + /* convert location to global top-left coordinates */ + location = [e locationInWindow]; + window = [e window]; + screen = [[[NSScreen screens] objectAtIndex:0] frame]; - // int num_events=0, i=0, state; - // xEvent xe; - - /* convert location to global top-left coordinates */ - location = [e locationInWindow]; - window = [e window]; - screen = [[[NSScreen screens] objectAtIndex:0] frame]; - if (window != nil) { - NSRect frame = [window frame]; - pointer_x = location.x + frame.origin.x; - pointer_y = (((screen.origin.y + screen.size.height) - - location.y) - frame.origin.y); - } else { - pointer_x = location.x; - pointer_y = (screen.origin.y + screen.size.height) - location.y; - } - - pointer_y -= aquaMenuBarHeight; - // state = convert_flags ([e modifierFlags]); - - pressure = 0; // for tablets - tilt_x = 0; - tilt_y = 0; - - switch (type) { - case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse; - case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse; - case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse; - case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse; - case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse; - case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse; - case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse; - case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse; - case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse; - case NSTabletPoint: - pressure = [e pressure]; - tilt_x = [e tilt].x; - tilt_y = [e tilt].y; // fall through - case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse; - handle_mouse: - - /* I'm not sure the below code is necessary or useful (-bb) - if(ev_type==ButtonPress) { - if (!quartzProcs->IsX11Window([e window], [e windowNumber])) { - fprintf(stderr, "Dropping event because it's not a window\n"); - break; + NSRect frame = [window frame]; + pointer_x = location.x + frame.origin.x; + pointer_y = (((screen.origin.y + screen.size.height) + - location.y) - frame.origin.y); + } else { + pointer_x = location.x; + pointer_y = (screen.origin.y + screen.size.height) - location.y; } - button_state |= (1 << ev_button); - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y); - } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break; - */ - // if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure]; - DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y, - pressure, tilt_x, tilt_y); - break; - case NSScrollWheel: - DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y, - pressure, tilt_x, tilt_y); - break; - - case NSKeyDown: // do we need to translate these keyCodes? - case NSKeyUp: - DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); - break; + pointer_y -= aquaMenuBarHeight; - case NSFlagsChanged: - DarwinUpdateModKeys([e modifierFlags]); - break; - default: break; /* for gcc */ - } + pressure = 0; // for tablets + tilt_x = 0; + tilt_y = 0; + + switch (type) { + case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse; + case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse; + case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse; + case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse; + case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse; + case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse; + case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse; + case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse; + case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse; + case NSTabletPoint: + pressure = [e pressure]; + tilt_x = [e tilt].x; + tilt_y = [e tilt].y; // fall through + case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse; + handle_mouse: + +// if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure]; + DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y, + pressure, tilt_x, tilt_y); + break; + + case NSScrollWheel: + DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y, + pressure, tilt_x, tilt_y); + break; + + case NSKeyDown: case NSKeyUp: + DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); + break; + + case NSFlagsChanged: + DarwinUpdateModKeys([e modifierFlags]); + break; + default: break; /* for gcc */ + } } From c737d04c758e03e32f692a31ed2a665ccbafa931 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Tue, 1 Apr 2008 00:40:46 -0700 Subject: [PATCH 149/183] The AppKit thread should not be calling directly into the X server functions to change state when the keyboard is reloaded; instead, pass it as an event. (cherry picked from commit 7e653f806ff5508aace059312156f319a9ed4479) --- hw/xquartz/darwin.h | 7 +------ hw/xquartz/darwinEvents.c | 7 ++++--- hw/xquartz/darwinKeyboard.c | 12 +++++++----- hw/xquartz/darwinKeyboard.h | 2 +- hw/xquartz/quartzKeyboard.h | 1 - 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index 01e6f41f2..df92d8b49 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -91,13 +91,8 @@ extern int darwinMainScreenY; * Special ddx events understood by the X server */ enum { - kXquartzUpdateModifiers // update all modifier keys + kXquartzReloadKeymap // Reload system keymap = LASTEvent+1, // (from X.h list of event names) - kXquartzUpdateButtons, // update state of mouse buttons 2 and up - kXquartzScrollWheel, // scroll wheel event - /* - * Quartz-specific events -- not used in IOKit mode - */ kXquartzActivate, // restore X drawing and cursor kXquartzDeactivate, // clip X drawing and switch to Aqua cursor kXquartzSetRootClip, // enable or disable drawing to the X screen diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index b6cd3f2b0..3afbaf890 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -289,6 +289,7 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { FatalError("Couldn't allocate event buffer\n"); mieqInit(); + mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler); mieqSetHandler(kXquartzActivate, DarwinEventHandler); mieqSetHandler(kXquartzDeactivate, DarwinEventHandler); mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler); @@ -322,7 +323,7 @@ void ProcessInputEvents(void) { // Empty the signaling pipe int x = sizeof(xe); while (x == sizeof(xe)) { - DEBUG_LOG("draining pipe\n"); +// DEBUG_LOG("draining pipe\n"); x = read(darwinEventReadFD, &xe, sizeof(xe)); } } @@ -412,8 +413,8 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { this_seed = QuartzSystemKeymapSeed(); if (this_seed != last_seed) { - last_seed = this_seed; - DarwinKeyboardReload(darwinKeyboard); + last_seed = this_seed; + DarwinSendDDXEvent(kXquartzReloadKeymap, 0); } } diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c index 355d9f066..6f2758e53 100644 --- a/hw/xquartz/darwinKeyboard.c +++ b/hw/xquartz/darwinKeyboard.c @@ -850,16 +850,18 @@ static Bool InitModMap(register KeyClassPtr keyc) { } -void DarwinKeyboardReload(DeviceIntPtr pDev) { +void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) { KeySymsRec keySyms; - + if (dev == NULL) dev = darwinKeyboard; + + DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", dev); DarwinLoadKeyboardMapping(&keySyms); - if (SetKeySymsMap(&pDev->key->curKeySyms, &keySyms)) { + if (SetKeySymsMap(&dev->key->curKeySyms, &keySyms)) { /* now try to update modifiers. */ - memmove(pDev->key->modifierMap, keyInfo.modMap, MAP_LENGTH); - InitModMap(pDev->key); + memmove(dev->key->modifierMap, keyInfo.modMap, MAP_LENGTH); + InitModMap(dev->key); } else DEBUG_LOG("SetKeySymsMap=0\n"); SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0); diff --git a/hw/xquartz/darwinKeyboard.h b/hw/xquartz/darwinKeyboard.h index 5cf64c7d1..762f65919 100644 --- a/hw/xquartz/darwinKeyboard.h +++ b/hw/xquartz/darwinKeyboard.h @@ -31,7 +31,7 @@ /* Provided for darwinEvents.c */ extern darwinKeyboardInfo keyInfo; -void DarwinKeyboardReload(DeviceIntPtr pDev); +void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents); void DarwinKeyboardInit(DeviceIntPtr pDev); int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); int DarwinModifierNXKeyToNXKeycode(int key, int side); diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h index 8131b5650..4f495bb46 100644 --- a/hw/xquartz/quartzKeyboard.h +++ b/hw/xquartz/quartzKeyboard.h @@ -46,7 +46,6 @@ typedef struct darwinKeyboardInfo_struct { } darwinKeyboardInfo; /* These functions need to be implemented by Xquartz, XDarwin, etc. */ -void DarwinKeyboardReload(DeviceIntPtr pDev); Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info); unsigned int QuartzSystemKeymapSeed(void); From 2e42b67b82db0f9128dd00e339b9dfdd9fe6d667 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Wed, 2 Apr 2008 18:05:34 -0700 Subject: [PATCH 150/183] XQuartz: Change reporting of space change to debug log rather than stderr (cherry picked from commit ed15556a9fc4ebdb88f42961052fc8456082165f) --- hw/xquartz/xpr/xprScreen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 91bf25ac2..d685fca33 100644 --- a/hw/xquartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -108,7 +108,7 @@ static void eventHandler(unsigned int type, const void *arg, } break; case XP_EVENT_SPACE_CHANGED: - ErrorF("XP_EVENT_SPACE_CHANGED\n"); + DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n"); if(arg_size == sizeof(uint32_t)) { uint32_t space_id = *(uint32_t *)arg; DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id); From f0915fb3c4a9712200882440a64d11dc595a02bb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 4 Apr 2008 09:29:51 +1000 Subject: [PATCH 151/183] quirk: add quirk for ACER EDID --- hw/xfree86/modes/xf86EdidModes.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index f15c39642..8f7d45dd6 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -158,6 +158,11 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC) DDC->vendor.prod_id == 765) return TRUE; + /* ACR of some sort RH #284231 */ + if (memcmp (DDC->vendor.name, "ACR", 4) == 0 && + DDC->vendor.prod_id == 2423) + return TRUE; + return FALSE; } From 16a8ce75585ea360c39e0ffce4f7bb26a359b754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 3 Apr 2008 16:44:32 -0400 Subject: [PATCH 152/183] Only autoload RECORD if it was enabled. --- hw/xfree86/common/xf86Config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 8de742620..208e23dc4 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -119,7 +119,9 @@ static ModuleDefault ModuleDefaults[] = { {.name = "dbe", .toLoad = TRUE, .load_opt=NULL}, {.name = "glx", .toLoad = TRUE, .load_opt=NULL}, {.name = "freetype", .toLoad = TRUE, .load_opt=NULL}, +#ifdef XRECORD {.name = "record", .toLoad = TRUE, .load_opt=NULL}, +#endif {.name = "dri", .toLoad = TRUE, .load_opt=NULL}, {.name = "dri2", .toLoad = TRUE, .load_opt=NULL}, {.name = NULL, .toLoad = FALSE, .load_opt=NULL} From ec17900f52bbd25d07566834756e5c7e832e0463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 4 Apr 2008 10:46:45 -0400 Subject: [PATCH 153/183] Convert __DRIconfigs after we've made sure createNewScreen succeeded. --- GL/glx/glxdri.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index ffa9a0b76..9cd0738a0 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -1117,13 +1117,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen) &driConfigs, screen); - screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs); - if (screen->driScreen == NULL) { LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed"); goto handle_error; } + screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs); + initializeExtensions(screen); DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart, From d1de3dda8efe501d4192c8a99c34ab4265316c32 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 17 Mar 2008 14:22:39 -0700 Subject: [PATCH 154/183] Fix clock_gettime presence detect on FreeBSD. For non-Linux, _POSIX_C_SOURCE and friends restrict symbols defined rather than enabling defines of symbols. Additionally, CLOCK_MONOTONIC was apparently added to the standard around 2000 anyway, not 1993. --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 985c8e227..1431f4b8f 100644 --- a/configure.ac +++ b/configure.ac @@ -722,7 +722,9 @@ if ! test "x$have_clock_gettime" = xno; then LIBS="$CLOCK_LIBS" AC_RUN_IFELSE([ +#ifdef __linux__ #define _POSIX_C_SOURCE 199309L +#endif #include int main(int argc, char *argv[[]]) { From cc7c045bae01d90d8f1b750080ba48a96e983c68 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 4 Apr 2008 12:58:12 -0400 Subject: [PATCH 155/183] Fix PCI config space cycles from int10 emulator. The top bit of 0xCF8 is an enable bit, not part of the domain. Sending cycles to domain 128 instead of domain 0 is rarely the right thing to do. --- hw/xfree86/int10/helper_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c index 9daff22dc..c3af5bc08 100644 --- a/hw/xfree86/int10/helper_exec.c +++ b/hw/xfree86/int10/helper_exec.c @@ -461,7 +461,7 @@ Mem_wl(CARD32 addr, CARD32 val) static CARD32 PciCfg1Addr = 0; #define PCI_OFFSET(x) ((x) & 0x000000ff) -#define PCI_TAG(x) ((x) & 0xffffff00) +#define PCI_TAG(x) ((x) & 0x7fffff00) static struct pci_device* pci_device_for_cfg_address (CARD32 addr) From 6c0cfe3d43b177c4cfaf7e228f32c655f9a98459 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Fri, 4 Apr 2008 19:01:40 +0200 Subject: [PATCH 156/183] Fix the clock_gettime check for glibc-based non-Linux systems We need to define _POSIX_C_SOURCE on glibc, not just Linux, so add a new test for the __GLIBC__ macro. --- configure.ac | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1431f4b8f..025b91214 100644 --- a/configure.ac +++ b/configure.ac @@ -705,6 +705,15 @@ if test "x$NEED_DBUS" = xyes; then fi CONFIG_LIB='$(top_builddir)/config/libconfig.a' +AC_MSG_CHECKING([for glibc...]) +AC_PREPROC_IFELSE([ +#include +#ifndef __GLIBC__ +#error +#endif +], glibc=yes, glibc=no) +AC_MSG_RESULT([$glibc]) + AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], [AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt], [have_clock_gettime=no])]) @@ -720,11 +729,13 @@ if ! test "x$have_clock_gettime" = xno; then LIBS_SAVE="$LIBS" LIBS="$CLOCK_LIBS" + CPPFLAGS_SAVE="$CPPFLAGS" + + if test x"$glibc" = xyes; then + CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199309L" + fi AC_RUN_IFELSE([ -#ifdef __linux__ -#define _POSIX_C_SOURCE 199309L -#endif #include int main(int argc, char *argv[[]]) { @@ -739,6 +750,7 @@ int main(int argc, char *argv[[]]) { [MONOTONIC_CLOCK="cross compiling"]) LIBS="$LIBS_SAVE" + CPPFLAGS="$CPPFLAGS_SAVE" else MONOTONIC_CLOCK=no fi From 3ab33e7cd46c25dfc461b2a1b13e138225a94524 Mon Sep 17 00:00:00 2001 From: Sascha Hlusiak Date: Sun, 6 Apr 2008 23:23:47 +0200 Subject: [PATCH 157/183] Remove stale code The jstk code for Joysticks is not used by any module, was never actually compiled and uses an API that is deprecated these days. No reason to keep it. --- hw/xfree86/os-support/bsd/Makefile.am | 1 - hw/xfree86/os-support/bsd/bsd_jstk.c | 183 ------------------------ hw/xfree86/os-support/linux/Makefile.am | 1 - hw/xfree86/os-support/linux/lnx_jstk.c | 180 ----------------------- 4 files changed, 365 deletions(-) delete mode 100644 hw/xfree86/os-support/bsd/bsd_jstk.c delete mode 100644 hw/xfree86/os-support/linux/lnx_jstk.c diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am index 4fc270aa9..678903056 100644 --- a/hw/xfree86/os-support/bsd/Makefile.am +++ b/hw/xfree86/os-support/bsd/Makefile.am @@ -72,7 +72,6 @@ libbsd_la_SOURCES = \ # FIXME: Add these files to the build as needed EXTRA_DIST = \ bsd_apm.c \ - bsd_jstk.c \ bsd_kqueue_apm.c \ bsdResource.c \ memrange.h \ diff --git a/hw/xfree86/os-support/bsd/bsd_jstk.c b/hw/xfree86/os-support/bsd/bsd_jstk.c deleted file mode 100644 index b5b91b0c7..000000000 --- a/hw/xfree86/os-support/bsd/bsd_jstk.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 1995 by Frederic Lepied, France. - * - * 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 Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* Modified for FreeBSD by David Dawes */ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include "misc.h" -#include "xf86.h" - -#define JS_RETURN sizeof(struct joystick) - -/*********************************************************************** - * - * xf86JoystickOn -- - * - * open the device and init timeout according to the device value. - * - *********************************************************************** - */ - -int -xf86JoystickOn(char * name, int *timeout, int *centerX, int *centerY) -{ - int status; - int changed = 0; - int timeinmicros; - struct joystick js; - -#ifdef DEBUG - ErrorF("xf86JoystickOn: %s\n", name); -#endif - - if ((status = open(name, O_RDWR | O_NDELAY, 0)) < 0) - { - xf86Msg(X_WARNING, "xf86JoystickOn: Cannot open joystick '%s' (%s)\n", - name, strerror(errno)); - return -1; - } - - if (*timeout <= 0) { - /* Use the current setting */ - ioctl(status, JOY_GETTIMEOUT, (char *)&timeinmicros); - *timeout = timeinmicros / 1000; - if (*timeout == 0) - *timeout = 1; - changed = 1; - } - /* Maximum allowed timeout in the FreeBSD driver is 10ms */ - if (*timeout > 10) { - *timeout = 10; - changed = 1; - } - - if (changed) - xf86Msg(X_PROBED, "Joystick: timeout value = %d\n", *timeout); - - timeinmicros = *timeout * 1000; - - /* Assume the joystick is centred when this is called */ - read(status, &js, JS_RETURN); - if (*centerX < 0) { - *centerX = js.x; - xf86Msg(X_PROBED, "Joystick: CenterX set to %d\n", *centerX); - } - if (*centerY < 0) { - *centerY = js.y; - xf86Msg(X_PROBED, "Joystick: CenterY set to %d\n", *centerY); - } - - return status; -} - -/*********************************************************************** - * - * xf86JoystickInit -- - * - * called when X device is initialized. - * - *********************************************************************** - */ - -void -xf86JoystickInit() -{ - return; -} - -/*********************************************************************** - * - * xf86JoystickOff -- - * - * close the handle. - * - *********************************************************************** - */ - -int -xf86JoystickOff(int *fd, int doclose) -{ - int oldfd; - - if (((oldfd = *fd) >= 0) && doclose) { - close(*fd); - *fd = -1; - } - return oldfd; -} - -/*********************************************************************** - * - * xf86JoystickGetState -- - * - * return the state of buttons and the position of the joystick. - * - *********************************************************************** - */ - -int -xf86JoystickGetState(int fd, int *x, int *y, int *buttons) -{ - struct joystick js; - int status; - - status = read(fd, &js, JS_RETURN); - - if (status != JS_RETURN) - { - Error("Joystick read"); - return 0; - } - - *x = js.x; - *y = js.y; - *buttons = js.b1 | (js.b2 << 1); -#ifdef DEBUG - ErrorF("xf86JoystickGetState: x = %d, y = %d, buttons = %d\n", *x, *y, - *buttons); -#endif - - return 1; -} - -/* - * Entry point for XFree86 Loader - */ -void -bsd_jstkModuleInit(pointer *data, INT32 *magic) -{ - *magic = MAGIC_DONE; - *data = NULL; -} -/* end of bsd_jstk.c */ diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index beaae3d5b..93f09c10c 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -45,7 +45,6 @@ INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) -I/usr/include/drm # FIXME this las # FIXME: These need to be added to the build LNX_EXTRA_SRCS = \ lnx_font.c \ - lnx_jstk.c \ lnxResource.c EXTRA_DIST = \ diff --git a/hw/xfree86/os-support/linux/lnx_jstk.c b/hw/xfree86/os-support/linux/lnx_jstk.c deleted file mode 100644 index d77631ba4..000000000 --- a/hw/xfree86/os-support/linux/lnx_jstk.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 1995 by Frederic Lepied, France. - * - * 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 Frederic Lepied not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Frederic Lepied makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - - -static const char rcs_id[] = "Id: lnx_jstk.c,v 1.1 1995/12/20 14:06:09 lepied Exp"; - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#define inline __inline__ -#include -#include -#include - -#include "xf86.h" - -#if !defined(JSIOCGTIMELIMIT) -/* make 2.1.x joystick.h backward compatable */ -#define JSIOCGTIMELIMIT JS_GET_TIMELIMIT -#define JSIOCSTIMELIMIT JS_SET_TIMELIMIT -#define js_status JS_DATA_TYPE -#endif - - -/*********************************************************************** - * - * xf86JoystickOn -- - * - * open the device and init timeout according to the device value. - * - *********************************************************************** - */ - -int -xf86JoystickOn(char *name, int *timeout, int *centerX, int *centerY) -{ - int fd; - struct js_status js; - -#ifdef DEBUG - ErrorF("xf86JoystickOn %s\n", name); -#endif - - if ((fd = open(name, O_RDWR | O_NDELAY, 0)) < 0) - { - xf86Msg(X_WARNING, "Cannot open joystick '%s' (%s)\n", name, - strerror(errno)); - return -1; - } - - if (*timeout == 0) { - if (ioctl (fd, JSIOCGTIMELIMIT, timeout) == -1) { - Error("joystick JSIOCGTIMELIMIT ioctl"); - } - else { - xf86Msg(X_CONFIG, "Joystick: timeout value = %d\n", *timeout); - } - } - else { - if (ioctl(fd, JSIOCSTIMELIMIT, timeout) == -1) { - Error("joystick JSIOCSTIMELIMIT ioctl"); - } - } - - /* Assume the joystick is centred when this is called */ - read(fd, &js, JS_RETURN); - if (*centerX < 0) { - *centerX = js.x; - xf86Msg(X_CONFIG, "Joystick: CenterX set to %d\n", *centerX); - } - if (*centerY < 0) { - *centerY = js.y; - xf86Msg(X_CONFIG, "Joystick: CenterY set to %d\n", *centerY); - } - - return fd; -} - -/*********************************************************************** - * - * xf86JoystickInit -- - * - * called when X device is initialized. - * - *********************************************************************** - */ - -void -xf86JoystickInit() -{ - return; -} - -/*********************************************************************** - * - * xf86JoystickOff -- - * - * close the handle. - * - *********************************************************************** - */ - -int -xf86JoystickOff(int *fd, int doclose) -{ - int oldfd; - - if (((oldfd = *fd) >= 0) && doclose) { - close(*fd); - *fd = -1; - } - return oldfd; -} - -/*********************************************************************** - * - * xf86JoystickGetState -- - * - * return the state of buttons and the position of the joystick. - * - *********************************************************************** - */ - -int -xf86JoystickGetState(int fd, int *x, int *y, int *buttons) -{ - struct js_status js; - int status; - - status = read(fd, &js, JS_RETURN); - - if (status != JS_RETURN) - { - Error("Joystick read"); - return 0; - } - - *x = js.x; - *y = js.y; - *buttons = js.buttons; - - return 1; -} - -/* - * Entry point for XFree86 Loader - */ -void -linux_jstkModuleInit(pointer *data, INT32 *magic) -{ - *magic = MAGIC_DONE; - *data = NULL; -} - -/* end of lnx_jstk.c */ From 6b1a27023e48b661c4bb3b61181ac57608d8e448 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Thu, 3 Apr 2008 14:50:05 -0400 Subject: [PATCH 158/183] EXA: Fix TS origin computation when implementing RenderComposite with tiling. --- exa/exa_render.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/exa/exa_render.c b/exa/exa_render.c index 38e2a04bd..da8140102 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -650,7 +650,7 @@ exaComposite(CARD8 op, !pSrc->transform && pSrc->repeatType == RepeatNormal) { - DDXPointRec srcOrg; + DDXPointRec patOrg; /* Let's see if the driver can do the repeat in one go */ if (pExaScr->info->PrepareComposite && !pSrc->alphaMap && @@ -674,12 +674,14 @@ exaComposite(CARD8 op, width, height)) goto done; - srcOrg.x = (xSrc - xDst) % pSrc->pDrawable->width; - srcOrg.y = (ySrc - yDst) % pSrc->pDrawable->height; + /* pattern origin is the point in the destination drawable + * corresponding to (0,0) in the source */ + patOrg.x = xDst - xSrc; + patOrg.y = yDst - ySrc; ret = exaFillRegionTiled(pDst->pDrawable, ®ion, (PixmapPtr)pSrc->pDrawable, - &srcOrg, FB_ALLONES, GXcopy); + &patOrg, FB_ALLONES, GXcopy); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); From 0f87b41a432a6472a15ec0c9dee997e3bddbd0f2 Mon Sep 17 00:00:00 2001 From: Hasso Tepper Date: Mon, 7 Apr 2008 14:09:04 +0300 Subject: [PATCH 159/183] configure.ac: DragonFly BSD support Add support for DragonFly BSD, which is just the same as FreeBSD for all of these cases. --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 025b91214..0c84bbca9 100644 --- a/configure.ac +++ b/configure.ac @@ -313,6 +313,7 @@ case $host_cpu in case $host_os in *linux*) DEFAULT_INT10=vm86 ;; *freebsd*) AC_DEFINE(USE_DEV_IO) ;; + *dragonfly*) AC_DEFINE(USE_DEV_IO) ;; *netbsd*) AC_DEFINE(USE_I386_IOPL) SYS_LIBS=-li386 ;; @@ -337,6 +338,7 @@ case $host_cpu in I386_VIDEO=yes case $host_os in *freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;; + *dragonfly*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;; *netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl]) SYS_LIBS=-lx86_64 ;; @@ -367,7 +369,7 @@ DRI2=no KDRIVE_HW=no dnl it would be nice to autodetect these *CONS_SUPPORTs case $host_os in - *freebsd*) + *freebsd* | *dragonfly*) case $host_os in kfreebsd*-gnu) ;; *) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) ;; @@ -1360,7 +1362,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then ;; esac ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) XORG_OS="freebsd" XORG_OS_SUBDIR="bsd" xorg_bus_bsdpci="yes" From 726dcd9e4ebfb09c0685450dca6e9fae7e773814 Mon Sep 17 00:00:00 2001 From: Adam Tkac Date: Mon, 7 Apr 2008 10:20:02 -0400 Subject: [PATCH 160/183] Fix Xvfb input when building against current X sources. --- os/WaitFor.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/os/WaitFor.c b/os/WaitFor.c index 36e01ca38..da12976ca 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -332,13 +332,9 @@ WaitForSomething(int *pClientsReady) if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable)) break; -#ifdef WIN32 - /* Windows keyboard and mouse events are added to the input queue - in Block- and WakupHandlers. There is no device to check if - data is ready. So check here if new input is available */ + /* check here for DDXes that queue events during Block/Wakeup */ if (*checkForInput[0] != *checkForInput[1]) return 0; -#endif } } From 08073862f8c4e1219b6459708ffd28e2bc35885f Mon Sep 17 00:00:00 2001 From: Hasso Tepper Date: Tue, 8 Apr 2008 13:00:38 +0300 Subject: [PATCH 161/183] configure.ac: Fix monotonic test harder This was only introduced in a later version of POSIX, so define that version to get it from more conformant systems. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0c84bbca9..c2109633d 100644 --- a/configure.ac +++ b/configure.ac @@ -734,7 +734,7 @@ if ! test "x$have_clock_gettime" = xno; then CPPFLAGS_SAVE="$CPPFLAGS" if test x"$glibc" = xyes; then - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199309L" + CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L" fi AC_RUN_IFELSE([ From 3f51f493b6daf2464e6c2ba5a924219b88a9e57e Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Tue, 8 Apr 2008 17:02:56 -0700 Subject: [PATCH 162/183] XQuartz: Fix issue where clicking on an X11 window might send that event to an X11 window in another space. (cherry picked from commit df21312c8b0e9ef0c809bfc57cdf64f27db0d8a7) (cherry picked from commit 2d4194a8d124e7a9c7cd1b83635ba6957aa4ae1c) --- configure.ac | 3 ++- dix/events.c | 7 +++++++ dix/window.c | 3 +++ hw/xquartz/darwinEvents.c | 6 +++++- hw/xquartz/quartz.c | 1 - include/windowstr.h | 3 +++ miext/rootless/rootlessWindow.c | 14 ++++++++------ miext/rootless/rootlessWindow.h | 4 +--- 8 files changed, 29 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index c2109633d..94151ded1 100644 --- a/configure.ac +++ b/configure.ac @@ -1732,7 +1732,8 @@ if test "X$XQUARTZ" = Xauto; then fi if test "x$XQUARTZ" = xyes; then - AC_DEFINE([XQUARTZ],[1],[Have Quartz]) + AC_DEFINE(XQUARTZ,1,[Have Quartz]) + AC_DEFINE(ROOTLESS,1,[Build Rootless code]) #glxAGL / glxCGL don't work yet # AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[ diff --git a/dix/events.c b/dix/events.c index 4a8e480c8..aef333ede 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2170,6 +2170,13 @@ XYToWindow(int x, int y) wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) +#endif +#ifdef ROOTLESS + /* In rootless mode windows may be offscreen, even when + * they're in X's stack. (E.g. if the native window system + * implements some form of virtual desktop system). + */ + && !pWin->rootlessUnhittable #endif ) { diff --git a/dix/window.c b/dix/window.c index 9975b5eec..499f58e7a 100644 --- a/dix/window.c +++ b/dix/window.c @@ -292,6 +292,9 @@ SetWindowToDefaults(WindowPtr pWin) pWin->forcedBS = FALSE; pWin->redirectDraw = RedirectDrawNone; pWin->forcedBG = FALSE; +#ifdef ROOTLESS + pWin->rootlessUnhittable = FALSE; +#endif } static void diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 3afbaf890..410acdd76 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -56,6 +56,10 @@ in this Software without prior written authorization from The Open Group. #include "applewmExt.h" #include +/* FIXME: Abstract this away into xpr */ +#include +#include "rootlessWindow.h" +WindowPtr xprGetXWindow(xp_window_id wid); /* Fake button press/release for scroll wheel move. */ #define SCROLLWHEELUPFAKE 4 @@ -228,7 +232,7 @@ void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int neven case kXquartzWindowState: DEBUG_LOG("kXquartzWindowState\n"); - RootlessNativeWindowStateChanged(xe[i].u.clientMessage.u.l.longs0, + RootlessNativeWindowStateChanged(xprGetXWindow(xe[i].u.clientMessage.u.l.longs0), xe[i].u.clientMessage.u.l.longs1); break; diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 96dc021a6..6a8cf7c12 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -52,7 +52,6 @@ #include "windowstr.h" #include "colormapst.h" #include "globals.h" -#include "rootlessWindow.h" // System headers #include diff --git a/include/windowstr.h b/include/windowstr.h index e06a2f1bd..99bd640cc 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -160,6 +160,9 @@ typedef struct _Window { unsigned forcedBS:1; /* system-supplied backingStore */ unsigned redirectDraw:2; /* COMPOSITE rendering redirect */ unsigned forcedBG:1; /* must have an opaque background */ +#ifdef ROOTLESS + unsigned rootlessUnhittable:1; /* doesn't hit-test */ +#endif } WindowRec; /* diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index 0dad44a99..17fe69085 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -117,12 +117,10 @@ rootlessHasRoot (ScreenPtr pScreen) } void -RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state) +RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state) { - WindowPtr pWin; RootlessWindowRec *winRec; - pWin = xprGetXWindow (id); if (pWin == NULL) return; winRec = WINREC (pWin); @@ -130,7 +128,7 @@ RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state) winRec->is_offscreen = ((state & XP_WINDOW_STATE_OFFSCREEN) != 0); winRec->is_obscured = ((state & XP_WINDOW_STATE_OBSCURED) != 0); - // pWin->rootlessUnhittable = winRec->is_offscreen; + pWin->rootlessUnhittable = winRec->is_offscreen; } void @@ -143,7 +141,7 @@ RootlessNativeWindowMoved (WindowPtr pWin) ClientPtr client; RootlessWindowRec *winRec = WINREC(pWin); - if (xp_get_window_bounds (winRec->wid, &bounds) != Success) return; + if (xp_get_window_bounds ((xp_window_id)winRec->wid, &bounds) != Success) return; sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX; sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY; @@ -1426,6 +1424,10 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) pTopWin = TopLevelParent(pWin); assert(pTopWin != pWin); + + pWin->rootlessUnhittable = FALSE; + + DeleteProperty (pWin, xa_native_window_id ()); if (WINREC(pTopWin) != NULL) { /* We're screwed. */ @@ -1482,7 +1484,7 @@ RootlessFlushWindowColormap (WindowPtr pWin) wc.colormap = RootlessColormapCallback; wc.colormap_data = pWin->drawable.pScreen; - configure_window (winRec->wid, XP_COLORMAP, &wc); + configure_window ((xp_window_id)winRec->wid, XP_COLORMAP, &wc); } /* diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h index 055589e79..45bc4c202 100644 --- a/miext/rootless/rootlessWindow.h +++ b/miext/rootless/rootlessWindow.h @@ -36,8 +36,6 @@ #include "rootlessCommon.h" -#include - Bool RootlessCreateWindow(WindowPtr pWin); Bool RootlessDestroyWindow(WindowPtr pWin); @@ -57,6 +55,6 @@ void RootlessResizeWindow(WindowPtr pWin, int x, int y, void RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent); void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width); void RootlessNativeWindowMoved (WindowPtr pWin); -void RootlessNativeWindowStateChanged (xp_window_id id, unsigned int state); +void RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state); #endif From 1f8188656a075dc7b1bb27a0795b5bd43610bbc8 Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Tue, 8 Apr 2008 20:37:25 -0700 Subject: [PATCH 163/183] add missing dix-config include (cherry picked from commit 126e9bc8c480b403dedc44c1e8c4fe1476340ed9) --- hw/xquartz/darwinEvents.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 410acdd76..78708d2b2 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -30,6 +30,10 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #define NEED_EVENTS #include #include From b19027fbaea4c3a146926e862983e0e3411fff3d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 9 Apr 2008 14:27:58 +1000 Subject: [PATCH 164/183] quirk: add quirk for ACR 640x350 default mode is wrong RH #440186 --- hw/xfree86/modes/xf86EdidModes.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 8f7d45dd6..09d00393e 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -93,6 +93,12 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC) DDC->vendor.prod_id == 638) return TRUE; + /* Acer F51 */ + if (memcmp (DDC->vendor.name, "API", 4) == 0 && + DDC->vendor.prod_id == 0x7602) + return TRUE; + + return FALSE; } From 6d031cbdefd8072b61645955f01b470a3e6858c1 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 9 Apr 2008 14:36:26 +0300 Subject: [PATCH 165/183] configure.ac: Do the dolt Use dolt instead of libtool whereever practical. See: http://lists.debian.org/debian-devel/2008/04/msg00286.html --- acinclude.m4 | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 2 files changed, 142 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index f3d8734f3..822adbe0d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,3 +1,144 @@ +dnl dolt, a replacement for libtool +dnl Copyright © 2007-2008 Josh Triplett +dnl Copying and distribution of this file, with or without modification, +dnl are permitted in any medium without royalty provided the copyright +dnl notice and this notice are preserved. +dnl +dnl To use dolt, invoke the DOLT macro immediately after the libtool macros. +dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it +dnl installed when running autoconf on your project. +dnl +dnl git snapshot: 198a3026b347b9220a2f2e2ae23a3049c35af262 + +AC_DEFUN([DOLT], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +# dolt, a replacement for libtool +# Josh Triplett +AC_PATH_PROG(DOLT_BASH, bash) +AC_MSG_CHECKING([if libtool sucks]) +AC_MSG_RESULT([yup, it does]) +AC_MSG_CHECKING([if dolt supports this host]) +dolt_supported=yes +if test x$DOLT_BASH = x; then + dolt_supported=no +fi +if test x$GCC != xyes; then + dolt_supported=no +fi +case $host in +i?86-*-linux*|x86_64-*-linux*) ;; +*) dolt_supported=no ;; +esac +if test x$dolt_supported = xno ; then + AC_MSG_RESULT([no, falling back to libtool]) +else + AC_MSG_RESULT([yes, replacing libtool]) + +dnl Start writing out doltcompile. + cat <<__DOLTCOMPILE__EOF__ >doltcompile +#!$DOLT_BASH +__DOLTCOMPILE__EOF__ + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +args=("$[]@") +for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do + if test x"${args@<:@$arg@:>@}" = x-o ; then + objarg=$((arg+1)) + break + fi +done +if test x$objarg = x ; then + echo 'Error: no -o on compiler command line' 1>&2 + exit 1 +fi +lo="${args@<:@$objarg@:>@}" +obj="${lo%.lo}" +if test x"$lo" = x"$obj" ; then + echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2 + exit 1 +fi +objbase="${obj##*/}" +__DOLTCOMPILE__EOF__ + +dnl Write out shared compilation code. + if test x$enable_shared = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +libobjdir="${obj%$objbase}.libs" +if test ! -d "$libobjdir" ; then + mkdir "$libobjdir" + mkdir_ret=$? + if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then + exit $mkdir_ret + fi +fi +pic_object="$libobjdir/$objbase.o" +args@<:@$objarg@:>@="$pic_object" +"${args@<:@@@:>@}" -fPIC -DPIC +__DOLTCOMPILE__EOF__ + fi + +dnl Write out static compilation code. +dnl Avoid duplicate compiler output if also building shared objects. + if test x$enable_static = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +non_pic_object="$obj.o" +args@<:@$objarg@:>@="$non_pic_object" +__DOLTCOMPILE__EOF__ + if test x$enable_shared = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +"${args@<:@@@:>@}" >/dev/null 2>&1 +__DOLTCOMPILE__EOF__ + else + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +"${args@<:@@@:>@}" +__DOLTCOMPILE__EOF__ + fi + fi + +dnl Write out the code to write the .lo file. +dnl The second line of the .lo file must match "^# Generated by .*libtool" + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +{ +echo "# $lo - a libtool object file" +echo "# Generated by doltcompile, not libtool" +__DOLTCOMPILE__EOF__ + + if test x$enable_shared = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo "pic_object='$pic_object'" +__DOLTCOMPILE__EOF__ + else + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo pic_object=none +__DOLTCOMPILE__EOF__ + fi + + if test x$enable_static = xyes; then + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo "non_pic_object='$non_pic_object'" +__DOLTCOMPILE__EOF__ + else + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +echo non_pic_object=none +__DOLTCOMPILE__EOF__ + fi + + cat <<'__DOLTCOMPILE__EOF__' >>doltcompile +} > "$lo" +__DOLTCOMPILE__EOF__ + +dnl Done writing out doltcompile; substitute it for libtool compilation. + chmod +x doltcompile + LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)' + AC_SUBST(LTCOMPILE) + LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)' + AC_SUBST(LTCXXCOMPILE) +fi +# end dolt +]) + + + + ##### http://autoconf-archive.cryp.to/ac_define_dir.html # # SYNOPSIS diff --git a/configure.ac b/configure.ac index 94151ded1..eb6fcda96 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,7 @@ AC_PROG_LN_S AC_LIBTOOL_WIN32_DLL AC_DISABLE_STATIC AC_PROG_LIBTOOL +DOLT AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG AC_PROG_LEX From 0d1746995d91b55e40f233f0c38b56bafe896d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 9 Apr 2008 13:37:59 +0200 Subject: [PATCH 166/183] Fix off-by-one error in ProcXResQueryClients(). Fixes memory corruption reported at http://bugs.freedesktop.org/show_bug.cgi?id=14004 . --- Xext/xres.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xext/xres.c b/Xext/xres.c index 9bd70c672..f444c4e69 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -64,7 +64,7 @@ ProcXResQueryClients (ClientPtr client) REQUEST_SIZE_MATCH(xXResQueryClientsReq); - current_clients = xalloc((currentMaxClients - 1) * sizeof(int)); + current_clients = xalloc(currentMaxClients * sizeof(int)); num_clients = 0; for(i = 0; i < currentMaxClients; i++) { From b4842d8dc3b1619033c5c123c8adc6e164098dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 9 Apr 2008 16:17:35 +0200 Subject: [PATCH 167/183] dolt works on powerpc Linux. --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 822adbe0d..c496afd73 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -26,7 +26,7 @@ if test x$GCC != xyes; then dolt_supported=no fi case $host in -i?86-*-linux*|x86_64-*-linux*) ;; +i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*) ;; *) dolt_supported=no ;; esac if test x$dolt_supported = xno ; then From 7909ebe7f163716520f843fae11ac7bdeffcb57c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 9 Apr 2008 10:43:25 -0700 Subject: [PATCH 168/183] dolt: add FreeBSD support (this and ppc have been submitted upstream). --- acinclude.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/acinclude.m4 b/acinclude.m4 index c496afd73..0d31e857f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -27,6 +27,7 @@ if test x$GCC != xyes; then fi case $host in i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*) ;; +amd64-*-freebsd*|i386-*-freebsd*|ia64-*-freebsd*) ;; *) dolt_supported=no ;; esac if test x$dolt_supported = xno ; then From a7e3ad1c6b455bda7c4abb352a20845d1d4574a0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 10 Apr 2008 10:33:11 -0700 Subject: [PATCH 169/183] Remove NDEBUG (assert() disable) define from the X Server. A few pieces of code were abusing this define for other purposes, which are converted to #ifndef DEBUG instead. There should be no ABI consequences to this change. The rationale is that having the define in xorg-server.h also disables assert() drivers, which is unexpected, and also difficult to avoid since xorg-server.h is included in their config.h, and you can't put a #undef in config.h. As for removing it from the server instead of moving it to an internal header, we probably shouldn't have unnecessary assert()s in critical server paths anyway, and if we do we could #define NDEBUG in the specific cases needed. --- configure.ac | 2 -- hw/kdrive/ephyr/ephyr_draw.c | 1 - hw/kdrive/ephyr/ephyrlog.h | 4 ++-- hw/kdrive/src/kinput.c | 4 ++-- hw/xgl/egl/kinput.c | 4 ++-- hw/xquartz/darwinKeyboard.c | 6 ------ hw/xquartz/quartzStartup.c | 6 ------ include/dix-config.h.in | 3 --- include/xorg-server.h.in | 3 --- 9 files changed, 6 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index eb6fcda96..b57dc1ab3 100644 --- a/configure.ac +++ b/configure.ac @@ -1099,8 +1099,6 @@ AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrappe if test "x$DEBUGGING" = xyes; then AC_DEFINE(DEBUG, 1, [Enable debugging code]) -else - AC_DEFINE(NDEBUG, 1, [Disable some debugging code]) fi AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes]) diff --git a/hw/kdrive/ephyr/ephyr_draw.c b/hw/kdrive/ephyr/ephyr_draw.c index 422b7c6b6..7b579c24b 100644 --- a/hw/kdrive/ephyr/ephyr_draw.c +++ b/hw/kdrive/ephyr/ephyr_draw.c @@ -28,7 +28,6 @@ #ifdef HAVE_CONFIG_H #include #endif -#undef NDEBUG /* No, really. The whole point of this module is to crash. */ #include "ephyr.h" #include "exa_priv.h" diff --git a/hw/kdrive/ephyr/ephyrlog.h b/hw/kdrive/ephyr/ephyrlog.h index 71f797777..a07a0a097 100644 --- a/hw/kdrive/ephyr/ephyrlog.h +++ b/hw/kdrive/ephyr/ephyrlog.h @@ -31,11 +31,11 @@ #include #include "os.h" -#ifdef NDEBUG +#ifndef DEBUG /*we are not in debug mode*/ #define EPHYR_LOG(...) #define EPHYR_LOG_ERROR(...) -#endif /*NDEBUG*/ +#endif /*!DEBUG*/ #define ERROR_LOG_LEVEL 3 #define INFO_LOG_LEVEL 4 diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index df73942e7..9e8fd5009 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -1744,7 +1744,7 @@ KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b) return keyboard; } -#ifndef NDEBUG +#ifdef DEBUG char *kdStateNames[] = { "start", "button_1_pend", @@ -1777,7 +1777,7 @@ char *kdActionNames[] = { "gen_down_2", "gen_up_2", }; -#endif +#endif /* DEBUG */ static void KdQueueEvent (DeviceIntPtr pDev, xEvent *ev) diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c index 774e00eb5..f892dc173 100644 --- a/hw/xgl/egl/kinput.c +++ b/hw/xgl/egl/kinput.c @@ -977,7 +977,7 @@ KdClassifyInput (KdMouseInfo *mi, xEvent *ev) return keyboard; } -#ifndef NDEBUG +#ifdef DEBUG char *kdStateNames[] = { "start", "button_1_pend", @@ -1010,7 +1010,7 @@ char *kdActionNames[] = { "gen_down_2", "gen_up_2", }; -#endif +#endif /* DEBUG */ static void KdQueueEvent (xEvent *ev) diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c index 6f2758e53..0a8c5c010 100644 --- a/hw/xquartz/darwinKeyboard.c +++ b/hw/xquartz/darwinKeyboard.c @@ -76,13 +76,7 @@ #include "quartzKeyboard.h" #include "quartzAudio.h" -#ifdef NDEBUG -#undef NDEBUG #include -#define NDEBUG 1 -#else -#include -#endif #define AltMask Mod1Mask #define MetaMask Mod2Mask diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c index e25e15583..5ac3017e1 100644 --- a/hw/xquartz/quartzStartup.c +++ b/hw/xquartz/quartzStartup.c @@ -41,13 +41,7 @@ #include "opaque.h" #include "micmap.h" -#ifdef NDEBUG -#undef NDEBUG #include -#define NDEBUG 1 -#else -#include -#endif char **envpGlobal; // argcGlobal and argvGlobal // are from dix/globals.c diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 38639d684..a7c0c6a60 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -264,9 +264,6 @@ /* Support MIT-SHM Extension */ #undef MITSHM -/* Disable some debugging code */ -#undef NDEBUG - /* Enable some debugging code */ #undef DEBUG diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in index 1d41b4ce6..72b45514c 100644 --- a/include/xorg-server.h.in +++ b/include/xorg-server.h.in @@ -52,9 +52,6 @@ /* Support MIT-SHM Extension */ #undef MITSHM -/* Disable some debugging code */ -#undef NDEBUG - /* Need XFree86 helper functions */ #undef NEED_XF86_PROTOTYPES From 13dcde6bf994fae09c67c3edce9de42df61ef043 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 10 Apr 2008 11:08:49 -0700 Subject: [PATCH 170/183] Fix dolt to error out on compile error, and not print errors on race to mkdir. Both of these changes have been submitted upstream. --- acinclude.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 0d31e857f..cbb68e19e 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -65,7 +65,7 @@ dnl Write out shared compilation code. cat <<'__DOLTCOMPILE__EOF__' >>doltcompile libobjdir="${obj%$objbase}.libs" if test ! -d "$libobjdir" ; then - mkdir "$libobjdir" + mkdir -p "$libobjdir" mkdir_ret=$? if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then exit $mkdir_ret @@ -73,7 +73,7 @@ if test ! -d "$libobjdir" ; then fi pic_object="$libobjdir/$objbase.o" args@<:@$objarg@:>@="$pic_object" -"${args@<:@@@:>@}" -fPIC -DPIC +"${args@<:@@@:>@}" -fPIC -DPIC || exit $? __DOLTCOMPILE__EOF__ fi @@ -86,11 +86,11 @@ args@<:@$objarg@:>@="$non_pic_object" __DOLTCOMPILE__EOF__ if test x$enable_shared = xyes; then cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -"${args@<:@@@:>@}" >/dev/null 2>&1 +"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $? __DOLTCOMPILE__EOF__ else cat <<'__DOLTCOMPILE__EOF__' >>doltcompile -"${args@<:@@@:>@}" +"${args@<:@@@:>@}" || exit $? __DOLTCOMPILE__EOF__ fi fi From 3c337e18b933881e22b0d03312511f1d23a8640b Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Thu, 10 Apr 2008 21:36:19 +0200 Subject: [PATCH 171/183] Fixed configure.ac for autoconf 2.62. --- configure.ac | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b57dc1ab3..c0a1f23c9 100644 --- a/configure.ac +++ b/configure.ac @@ -1556,7 +1556,11 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then abi_xinput=`extract_abi XINPUT` abi_extension=`extract_abi EXTENSION` abi_font=`extract_abi FONT` - AC_SUBST([abi_ansic abi_videodrv abi_xinput abi_extension abi_font]) + AC_SUBST([abi_ansic]) + AC_SUBST([abi_videodrv]) + AC_SUBST([abi_xinput]) + AC_SUBST([abi_extension]) + AC_SUBST([abi_font]) fi AM_CONDITIONAL([XORG], [test "x$XORG" = xyes]) AM_CONDITIONAL([XORG_BUS_LINUXPCI], [test "x$xorg_bus_linuxpci" = xyes]) @@ -2096,7 +2100,9 @@ DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS" AC_SUBST([DIX_CFLAGS]) -AC_SUBST([libdir exec_prefix prefix]) +AC_SUBST([libdir]) +AC_SUBST([exec_prefix]) +AC_SUBST([prefix]) # Man page sections - used in config utils & generating man pages XORG_MANPAGE_SECTIONS From 6d22a9615a0e6ab3d00b0bcb22ff001b6ece02ae Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 22 Feb 2008 11:01:51 +1030 Subject: [PATCH 172/183] dix: Call DeleteInputDeviceRequest from CloseDownDevices (#14418) The DDX (xfree86 anyway) maintains its own device list in addition to the one in the DIX. CloseDevice will only remove it from the DIX, not the DDX. If the server then restarts (last client disconnects), the DDX devices are still there, will be re-initialised, then the hal devices come in and are added too. This repeats until we run out of device ids. This also requires us to strdup() the default pointer/keyboard in checkCoreInputDevices. X.Org Bug 14418 --- dix/devices.c | 4 ++-- hw/xfree86/common/xf86Config.c | 12 ++++++------ hw/xfree86/common/xf86Xinput.c | 12 ++++++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/dix/devices.c b/dix/devices.c index 4b20655c6..5a726afe8 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -618,12 +618,12 @@ CloseDownDevices(void) for (dev = inputInfo.devices; dev; dev = next) { next = dev->next; - CloseDevice(dev); + DeleteInputDeviceRequest(dev); } for (dev = inputInfo.off_devices; dev; dev = next) { next = dev->next; - CloseDevice(dev); + DeleteInputDeviceRequest(dev); } inputInfo.devices = NULL; inputInfo.off_devices = NULL; diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 208e23dc4..3cc04f0a1 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -1338,8 +1338,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) /* 5. Built-in default. */ if (!foundPointer) { bzero(&defPtr, sizeof(defPtr)); - defPtr.inp_identifier = ""; - defPtr.inp_driver = "mouse"; + defPtr.inp_identifier = strdup(""); + defPtr.inp_driver = strdup("mouse"); confInput = &defPtr; foundPointer = TRUE; from = X_DEFAULT; @@ -1385,8 +1385,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) if (!found) { xf86Msg(X_INFO, "No default mouse found, adding one\n"); bzero(&defPtr, sizeof(defPtr)); - defPtr.inp_identifier = ""; - defPtr.inp_driver = "mouse"; + defPtr.inp_identifier = strdup(""); + defPtr.inp_driver = strdup("mouse"); confInput = &defPtr; foundPointer = configInput(&Pointer, confInput, from); if (foundPointer) { @@ -1474,8 +1474,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) /* 5. Built-in default. */ if (!foundKeyboard) { bzero(&defKbd, sizeof(defKbd)); - defKbd.inp_identifier = ""; - defKbd.inp_driver = "kbd"; + defKbd.inp_identifier = strdup(""); + defKbd.inp_driver = strdup("kbd"); confInput = &defKbd; foundKeyboard = TRUE; keyboardMsg = "default keyboard configuration"; diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index eafc0e9a0..d34238edc 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -446,11 +446,19 @@ void DeleteInputDeviceRequest(DeviceIntPtr pDev) { LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate; - InputDriverPtr drv = pInfo->drv; - IDevRec *idev = pInfo->conf_idev; + InputDriverPtr drv; + IDevRec *idev; + if (pInfo) /* need to get these before RemoveDevice */ + { + drv = pInfo->drv; + idev = pInfo->conf_idev; + } RemoveDevice(pDev); + if (!pInfo) /* VCP and VCK */ + return; + if(drv->UnInit) drv->UnInit(drv, pInfo, 0); else From 059b4876e6350aa1110648788cdfbb3f45b4d66d Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Apr 2008 09:46:48 -0400 Subject: [PATCH 173/183] Add doltcompile to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 837b0380b..548e78423 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ config.sub configure configure.lineno depcomp +doltcompile install-sh libtool ltmain.sh From 0dab6fa3582b70ccd0f01459902415c28dbc81ff Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Apr 2008 09:47:51 -0400 Subject: [PATCH 174/183] So long, and thanks for all the cfb. --- Makefile.am | 9 - cfb/Makefile.am | 21 - cfb/Makefile.am.inc | 153 --- cfb/cfb.h | 1268 -------------------- cfb/cfb16.h | 93 -- cfb/cfb24.h | 97 -- cfb/cfb32.h | 93 -- cfb/cfb8bit.c | 469 -------- cfb/cfb8bit.h | 1570 ------------------------- cfb/cfb8line.c | 1503 ----------------------- cfb/cfballpriv.c | 70 -- cfb/cfbbitblt.c | 1455 ----------------------- cfb/cfbblt.c | 933 --------------- cfb/cfbbres.c | 340 ------ cfb/cfbbresd.c | 404 ------- cfb/cfbcmap.c | 119 -- cfb/cfbcppl.c | 486 -------- cfb/cfbfillarc.c | 374 ------ cfb/cfbfillrct.c | 305 ----- cfb/cfbfillsp.c | 1004 ---------------- cfb/cfbgc.c | 799 ------------- cfb/cfbgetsp.c | 213 ---- cfb/cfbglblt8.c | 477 -------- cfb/cfbhrzvert.c | 554 --------- cfb/cfbigblt8.c | 106 -- cfb/cfbimage.c | 206 ---- cfb/cfbline.c | 756 ------------ cfb/cfbmap.h | 210 ---- cfb/cfbmskbits.c | 1400 ---------------------- cfb/cfbmskbits.h | 854 -------------- cfb/cfbpixmap.c | 375 ------ cfb/cfbply1rct.c | 363 ------ cfb/cfbpolypnt.c | 202 ---- cfb/cfbpush8.c | 184 --- cfb/cfbrctstp8.c | 593 ---------- cfb/cfbrrop.c | 227 ---- cfb/cfbrrop.h | 343 ------ cfb/cfbscrinit.c | 223 ---- cfb/cfbsetsp.c | 316 ----- cfb/cfbsolid.c | 1365 --------------------- cfb/cfbteblt8.c | 589 ---------- cfb/cfbtegblt.c | 218 ---- cfb/cfbtile32.c | 517 -------- cfb/cfbtileodd.c | 1245 -------------------- cfb/cfbunmap.h | 161 --- cfb/cfbwindow.c | 160 --- cfb/cfbzerarc.c | 322 ----- cfb/stip68kgnu.h | 121 -- cfb/stipmips.s | 281 ----- cfb/stipsparc.s | 290 ----- cfb/stipsprc32.s | 291 ----- cfb32/Makefile.am | 9 - configure.ac | 8 +- hw/xfree86/Makefile.am | 8 +- hw/xfree86/dixmods/Makefile.am | 13 - hw/xfree86/dixmods/cfb32module.c | 57 - hw/xfree86/dixmods/cfbmodule.c | 57 - hw/xfree86/dixmods/extmod/Makefile.am | 1 - hw/xfree86/xf8_32bpp/Makefile.am | 37 - hw/xfree86/xf8_32bpp/cfb8_32.h | 191 --- hw/xfree86/xf8_32bpp/cfb8_32module.c | 39 - hw/xfree86/xf8_32bpp/cfbcpyarea.c | 549 --------- hw/xfree86/xf8_32bpp/cfbcpyplane.c | 41 - hw/xfree86/xf8_32bpp/cfbgc.c | 646 ---------- hw/xfree86/xf8_32bpp/cfbgcmisc.c | 150 --- hw/xfree86/xf8_32bpp/cfbgcunder.c | 620 ---------- hw/xfree86/xf8_32bpp/cfbimage.c | 174 --- hw/xfree86/xf8_32bpp/cfbpntwin.c | 51 - hw/xfree86/xf8_32bpp/cfbscrinit.c | 311 ----- hw/xfree86/xf8_32bpp/cfbwindow.c | 116 -- hw/xfree86/xf8_32bpp/xf86overlay.c | 1179 ------------------- 71 files changed, 3 insertions(+), 28981 deletions(-) delete mode 100644 cfb/Makefile.am delete mode 100644 cfb/Makefile.am.inc delete mode 100644 cfb/cfb.h delete mode 100644 cfb/cfb16.h delete mode 100644 cfb/cfb24.h delete mode 100644 cfb/cfb32.h delete mode 100644 cfb/cfb8bit.c delete mode 100644 cfb/cfb8bit.h delete mode 100644 cfb/cfb8line.c delete mode 100644 cfb/cfballpriv.c delete mode 100644 cfb/cfbbitblt.c delete mode 100644 cfb/cfbblt.c delete mode 100644 cfb/cfbbres.c delete mode 100644 cfb/cfbbresd.c delete mode 100644 cfb/cfbcmap.c delete mode 100644 cfb/cfbcppl.c delete mode 100644 cfb/cfbfillarc.c delete mode 100644 cfb/cfbfillrct.c delete mode 100644 cfb/cfbfillsp.c delete mode 100644 cfb/cfbgc.c delete mode 100644 cfb/cfbgetsp.c delete mode 100644 cfb/cfbglblt8.c delete mode 100644 cfb/cfbhrzvert.c delete mode 100644 cfb/cfbigblt8.c delete mode 100644 cfb/cfbimage.c delete mode 100644 cfb/cfbline.c delete mode 100644 cfb/cfbmap.h delete mode 100644 cfb/cfbmskbits.c delete mode 100644 cfb/cfbmskbits.h delete mode 100644 cfb/cfbpixmap.c delete mode 100644 cfb/cfbply1rct.c delete mode 100644 cfb/cfbpolypnt.c delete mode 100644 cfb/cfbpush8.c delete mode 100644 cfb/cfbrctstp8.c delete mode 100644 cfb/cfbrrop.c delete mode 100644 cfb/cfbrrop.h delete mode 100644 cfb/cfbscrinit.c delete mode 100644 cfb/cfbsetsp.c delete mode 100644 cfb/cfbsolid.c delete mode 100644 cfb/cfbteblt8.c delete mode 100644 cfb/cfbtegblt.c delete mode 100644 cfb/cfbtile32.c delete mode 100644 cfb/cfbtileodd.c delete mode 100644 cfb/cfbunmap.h delete mode 100644 cfb/cfbwindow.c delete mode 100644 cfb/cfbzerarc.c delete mode 100644 cfb/stip68kgnu.h delete mode 100644 cfb/stipmips.s delete mode 100644 cfb/stipsparc.s delete mode 100644 cfb/stipsprc32.s delete mode 100644 cfb32/Makefile.am delete mode 100644 hw/xfree86/dixmods/cfb32module.c delete mode 100644 hw/xfree86/dixmods/cfbmodule.c delete mode 100644 hw/xfree86/xf8_32bpp/Makefile.am delete mode 100644 hw/xfree86/xf8_32bpp/cfb8_32.h delete mode 100644 hw/xfree86/xf8_32bpp/cfb8_32module.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbcpyarea.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbcpyplane.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbgc.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbgcmisc.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbgcunder.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbimage.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbpntwin.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbscrinit.c delete mode 100644 hw/xfree86/xf8_32bpp/cfbwindow.c delete mode 100644 hw/xfree86/xf8_32bpp/xf86overlay.c diff --git a/Makefile.am b/Makefile.am index 71ba2c429..d2e10acaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,11 +9,6 @@ if XTRAP XTRAP_DIR=XTrap endif -if CFB -CFB_DIR=cfb -CFB32_DIR=cfb32 -endif - if AFB AFB_DIR=afb endif @@ -50,8 +45,6 @@ SUBDIRS = \ $(DBE_DIR) \ $(MFB_DIR) \ $(AFB_DIR) \ - $(CFB_DIR) \ - $(CFB32_DIR) \ $(RECORD_DIR) \ xfixes \ damageext \ @@ -96,8 +89,6 @@ DIST_SUBDIRS = \ dbe \ mfb \ afb \ - cfb \ - cfb32 \ record \ xfixes \ damageext \ diff --git a/cfb/Makefile.am b/cfb/Makefile.am deleted file mode 100644 index 901fc95ae..000000000 --- a/cfb/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -noinst_LTLIBRARIES = libcfb.la - -include Makefile.am.inc - -DISTCLEANFILES += cfbglrop8.c - -libcfb_la_SOURCES = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c \ - $(libcfb_gen_sources) $(libcfb_common_sources) - -libcfb_la_LIBADD = ../mfb/libmfb.la - -AM_CFLAGS = -DPSZ=8 $(DIX_CFLAGS) $(PLATFORMDEFS) - -INCLUDES = $(CFB_INCLUDES) -I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/common - -EXTRA_DIST = cfbline.c cfbfillarc.c cfbzerarc.c cfbblt.c cfbsolid.c \ - cfbtileodd.c cfbtile32.c cfb8line.c cfbply1rct.c cfbglblt8.c \ - cfb16.h cfb24.h cfb32.h cfb8bit.h cfbrrop.h \ - stip68kgnu.h stipmips.s stipsparc.s stipsprc32.s - -sdk_HEADERS = cfb.h cfb32.h cfb16.h cfbmap.h cfbunmap.h cfbmskbits.h diff --git a/cfb/Makefile.am.inc b/cfb/Makefile.am.inc deleted file mode 100644 index a2ee143aa..000000000 --- a/cfb/Makefile.am.inc +++ /dev/null @@ -1,153 +0,0 @@ -libcfb_gen_sources = cfbseg.c cfbfillarcC.c cfbfillarcG.c cfbzerarcC.c cfbzerarcX.c cfbzerarcG.c \ - cfbbltC.c cfbbltX.c cfbbltO.c cfbbltG.c cfbsolidC.c cfbsolidX.c cfbsolidG.c cfbtileoddC.c \ - cfbtileoddG.c cfbtile32C.c cfbtile32G.c cfb8lineCO.c cfb8lineCP.c cfb8lineX.c cfb8lineG.c \ - cfb8segCS.c cfb8segC.c cfb8segX.c cfb8setG.c cfbply1rctC.c cfbply1rctG.c - -DISTCLEANFILES = $(libcfb_gen_sources) - -CFB_INCLUDES = -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb - -libcfb_common_sources = $(top_srcdir)/cfb/cfbgc.c $(top_srcdir)/cfb/cfbrrop.c \ - $(top_srcdir)/cfb/cfbwindow.c \ - $(top_srcdir)/cfb/cfbmskbits.c $(top_srcdir)/cfb/cfbpixmap.c \ - $(top_srcdir)/cfb/cfbbitblt.c $(top_srcdir)/cfb/cfbfillsp.c \ - $(top_srcdir)/cfb/cfbsetsp.c $(top_srcdir)/cfb/cfbscrinit.c \ - $(top_srcdir)/cfb/cfballpriv.c $(top_srcdir)/cfb/cfbgetsp.c \ - $(top_srcdir)/cfb/cfbfillrct.c $(top_srcdir)/cfb/cfbigblt8.c \ - $(top_srcdir)/cfb/cfbglblt8.c $(top_srcdir)/cfb/cfbtegblt.c \ - $(top_srcdir)/cfb/cfbpolypnt.c \ - $(top_srcdir)/cfb/cfbbres.c $(top_srcdir)/cfb/cfbline.c \ - $(top_srcdir)/cfb/cfbhrzvert.c $(top_srcdir)/cfb/cfbbresd.c \ - $(top_srcdir)/cfb/cfbimage.c $(top_srcdir)/cfb/cfbcppl.c \ - $(top_srcdir)/cfb/cfbcmap.c - -cfbseg.c: - echo "#define POLYSEGMENT" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbline.c\"" >> $@ - -cfbfillarcC.c: - echo "#define RROP GXcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbfillarc.c\"" >> $@ - -cfbfillarcG.c: - echo "#define RROP GXset" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbfillarc.c\"" >> $@ - -cfbzerarcC.c: - echo "#define RROP GXcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@ - -cfbzerarcX.c: - echo "#define RROP GXxor" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@ - -cfbzerarcG.c: - echo "#define RROP GXset" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbzerarc.c\"" >> $@ - -cfbbltC.c: - echo "#define MROP Mcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@ - -cfbbltX.c: - echo "#define MROP Mxor" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@ - -cfbbltO.c: - echo "#define MROP Mor" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@ - -cfbbltG.c: - echo "#define MROP 0" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbblt.c\"" >> $@ - -cfbsolidC.c: - echo "#define RROP GXcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@ - -cfbsolidX.c: - echo "#define RROP GXxor" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@ - -cfbsolidG.c: - echo "#define RROP GXset" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbsolid.c\"" >> $@ - -cfbtileoddC.c: - echo "#define MROP Mcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbtileodd.c\"" >> $@ - -cfbtileoddG.c: - echo "#define MROP 0" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbtileodd.c\"" >> $@ - -cfbtile32C.c: - echo "#define MROP Mcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbtile32.c\"" >> $@ - -cfbtile32G.c: - echo "#define MROP 0" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbtile32.c\"" >> $@ - -cfb8lineCO.c: - echo "#define RROP GXcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8lineCP.c: - echo "#define RROP GXcopy" > $@ - echo "#define PREVIOUS" >> $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8lineX.c: - echo "#define RROP GXxor" > $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8lineG.c: - echo "#define RROP GXset" > $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8segCS.c: - echo "#define RROP GXcopy" > $@ - echo "#define POLYSEGMENT" >> $@ - echo "#define WIDTH_SHIFT" >> $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8segC.c: - echo "#define RROP GXcopy" > $@ - echo "#define POLYSEGMENT" >> $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8segX.c: - echo "#define RROP GXxor" > $@ - echo "#define POLYSEGMENT" >> $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfb8setG.c: - echo "#define RROP GXset" > $@ - echo "#define POLYSEGMENT" >> $@ - echo "#include \"$(top_srcdir)/cfb/cfb8line.c\"" >> $@ - -cfbply1rctC.c: - echo "#define RROP GXcopy" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbply1rct.c\"" >> $@ - -cfbply1rctG.c: - echo "#define RROP GXset" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbply1rct.c\"" >> $@ - -cfbglrop8.c: - echo "#define GLYPHROP" > $@ - echo "#include \"$(top_srcdir)/cfb/cfbglblt8.c\"" >> $@ - - -if XPRINT - -PLATFORMDEFS = -DXFREE86 - -cfb8bit.o: compiler.h - -compiler.h: - echo "#include \"$(top_srcdir)/hw/xfree86/common/compiler.h\"" >> $@ - -endif - diff --git a/cfb/cfb.h b/cfb/cfb.h deleted file mode 100644 index aece13341..000000000 --- a/cfb/cfb.h +++ /dev/null @@ -1,1268 +0,0 @@ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#if !defined(__CFB_H__) || defined(CFB_PROTOTYPES_ONLY) - -#include -#include "globals.h" -#include "pixmap.h" -#include "region.h" -#include "gc.h" -#include "colormap.h" -#include "miscstruct.h" -#include "servermd.h" -#include "privates.h" -#include "windowstr.h" -#include "mfb.h" -#undef PixelType - -#include "cfbmap.h" - -#ifndef CfbBits -#define CfbBits CARD32 -#endif - -#ifndef CFB_PROTOTYPES_ONLY -#define __CFB_H__ -/* - private filed of pixmap - pixmap.devPrivate = (unsigned int *)pointer_to_bits - pixmap.devKind = width_of_pixmap_in_bytes -*/ - -extern DevPrivateKey cfbGCPrivateKey; - -/* private field of GC */ -typedef struct { - unsigned char rop; /* special case rop values */ - /* next two values unused in cfb, included for compatibility with mfb */ - unsigned char ropOpStip; /* rop for opaque stipple */ - /* this value is ropFillArea in mfb, usurped for cfb */ - unsigned char oneRect; /* drawable has one clip rect */ - CfbBits xor, and; /* reduced rop values */ - } cfbPrivGC; - -typedef cfbPrivGC *cfbPrivGCPtr; - -#define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\ - dixLookupPrivate(&(pGC)->devPrivates, cfbGCPrivateKey)) - -#define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip) - -/* way to carry RROP info around */ -typedef struct { - unsigned char rop; - CfbBits xor, and; -} cfbRRopRec, *cfbRRopPtr; - -/* cfb8bit.c */ - -extern int cfbSetStipple( - int /*alu*/, - CfbBits /*fg*/, - CfbBits /*planemask*/ -); - -extern int cfbSetOpaqueStipple( - int /*alu*/, - CfbBits /*fg*/, - CfbBits /*bg*/, - CfbBits /*planemask*/ -); - -extern int cfbComputeClipMasks32( - BoxPtr /*pBox*/, - int /*numRects*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - CARD32 * /*clips*/ -); -#endif /* !CFB_PROTOTYPES_ONLY */ -/* cfb8cppl.c */ - -extern void cfbCopyImagePlane( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - int /*rop*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); - -#ifndef CFB_PROTOTYPES_ONLY -extern void cfbCopyPlane8to1( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - int /*rop*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/, - unsigned long /*bitPlane*/ -); - -extern void cfbCopyPlane16to1( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - int /*rop*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/, - unsigned long /*bitPlane*/ -); - -extern void cfbCopyPlane24to1( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - int /*rop*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/, - unsigned long /*bitPlane*/ -); - -extern void cfbCopyPlane32to1( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - int /*rop*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/, - unsigned long /*bitPlane*/ -); -#endif - -/* cfb8lineCO.c */ - -extern int cfb8LineSS1RectCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/, - DDXPointPtr /*pptInitOrig*/, - int * /*x1p*/, - int * /*y1p*/, - int * /*x2p*/, - int * /*y2p*/ -); - -extern void cfb8LineSS1Rect( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); - -extern void cfb8ClippedLineCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x1*/, - int /*y1*/, - int /*x2*/, - int /*y2*/, - BoxPtr /*boxp*/, - Bool /*shorten*/ -); -/* cfb8lineCP.c */ - -extern int cfb8LineSS1RectPreviousCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/, - DDXPointPtr /*pptInitOrig*/, - int * /*x1p*/, - int * /*y1p*/, - int * /*x2p*/, - int * /*y2p*/ -); -/* cfb8lineG.c */ - -extern int cfb8LineSS1RectGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/, - DDXPointPtr /*pptInitOrig*/, - int * /*x1p*/, - int * /*y1p*/, - int * /*x2p*/, - int * /*y2p*/ -); - -extern void cfb8ClippedLineGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x1*/, - int /*y1*/, - int /*x2*/, - int /*y2*/, - BoxPtr /*boxp*/, - Bool /*shorten*/ -); -/* cfb8lineX.c */ - -extern int cfb8LineSS1RectXor( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/, - DDXPointPtr /*pptInitOrig*/, - int * /*x1p*/, - int * /*y1p*/, - int * /*x2p*/, - int * /*y2p*/ -); - -extern void cfb8ClippedLineXor( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x1*/, - int /*y1*/, - int /*x2*/, - int /*y2*/, - BoxPtr /*boxp*/, - Bool /*shorten*/ -); -/* cfb8segC.c */ - -extern int cfb8SegmentSS1RectCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSegInit*/ -); -/* cfb8segCS.c */ - -extern int cfb8SegmentSS1RectShiftCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSegInit*/ -); - -extern void cfb8SegmentSS1Rect( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSegInit*/ -); -/* cfb8segG.c */ - -extern int cfb8SegmentSS1RectGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSegInit*/ -); -/* cfbsegX.c */ - -extern int cfb8SegmentSS1RectXor( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSegInit*/ -); -/* cfballpriv.c */ - -extern Bool cfbAllocatePrivates( - ScreenPtr /*pScreen*/, - DevPrivateKey * /*gc_key*/ -); -/* cfbbitblt.c */ - -extern RegionPtr cfbBitBlt( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr/*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - void (* /*doBitBlt*/)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ - ), - unsigned long /*bitPlane*/ -); - -#define cfbCopyPlaneExpand cfbBitBlt - -extern RegionPtr cfbCopyPlaneReduce( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr /*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - void (* /*doCopyPlane*/)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/, - unsigned long /*bitPlane*/ /* We must know which plane to reduce! */ - ), - unsigned long /*bitPlane*/ -); - -extern void cfbDoBitblt( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); - -extern RegionPtr cfbCopyArea( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr/*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/ -); - -#ifndef CFB_PROTOTYPES_ONLY -extern void cfbCopyPlane1to8( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - int /*rop*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); -#endif - -extern RegionPtr cfbCopyPlane( - DrawablePtr /*pSrcDrawable*/, - DrawablePtr /*pDstDrawable*/, - GCPtr /*pGC*/, - int /*srcx*/, - int /*srcy*/, - int /*width*/, - int /*height*/, - int /*dstx*/, - int /*dsty*/, - unsigned long /*bitPlane*/ -); -/* cfbbltC.c */ - -extern void cfbDoBitbltCopy( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); -/* cfbbltG.c */ - -extern void cfbDoBitbltGeneral( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); -/* cfbbltO.c */ - -extern void cfbDoBitbltOr( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); -/* cfbbltX.c */ - -extern void cfbDoBitbltXor( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/ -); -/* cfbbres.c */ - -extern void cfbBresS( - int /*rop*/, - CfbBits /*and*/, - CfbBits /*xor*/, - CfbBits * /*addrl*/, - int /*nlwidth*/, - int /*signdx*/, - int /*signdy*/, - int /*axis*/, - int /*x1*/, - int /*y1*/, - int /*e*/, - int /*e1*/, - int /*e2*/, - int /*len*/ -); -/* cfbbresd.c */ - -extern void cfbBresD( - cfbRRopPtr /*rrops*/, - int * /*pdashIndex*/, - unsigned char * /*pDash*/, - int /*numInDashList*/, - int * /*pdashOffset*/, - int /*isDoubleDash*/, - CfbBits * /*addrl*/, - int /*nlwidth*/, - int /*signdx*/, - int /*signdy*/, - int /*axis*/, - int /*x1*/, - int /*y1*/, - int /*e*/, - int /*e1*/, - int /*e2*/, - int /*len*/ -); - -/* cfbcmap.c */ - -#ifndef CFB_PROTOTYPES_ONLY -extern int cfbListInstalledColormaps( - ScreenPtr /*pScreen*/, - Colormap * /*pmaps*/ -); - -extern void cfbInstallColormap( - ColormapPtr /*pmap*/ -); - -extern void cfbUninstallColormap( - ColormapPtr /*pmap*/ -); - -extern void cfbResolveColor( - unsigned short * /*pred*/, - unsigned short * /*pgreen*/, - unsigned short * /*pblue*/, - VisualPtr /*pVisual*/ -); - -extern Bool cfbInitializeColormap( - ColormapPtr /*pmap*/ -); - -extern int cfbExpandDirectColors( - ColormapPtr /*pmap*/, - int /*ndef*/, - xColorItem * /*indefs*/, - xColorItem * /*outdefs*/ -); - -extern Bool cfbCreateDefColormap( - ScreenPtr /*pScreen*/ -); - -extern Bool cfbSetVisualTypes( - int /*depth*/, - int /*visuals*/, - int /*bitsPerRGB*/ -); - -extern void cfbClearVisualTypes(void); - -extern Bool cfbInitVisuals( - VisualPtr * /*visualp*/, - DepthPtr * /*depthp*/, - int * /*nvisualp*/, - int * /*ndepthp*/, - int * /*rootDepthp*/, - VisualID * /*defaultVisp*/, - unsigned long /*sizes*/, - int /*bitsPerRGB*/ -); -#endif -/* cfbfillarcC.c */ - -extern void cfbPolyFillArcSolidCopy( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); -/* cfbfillarcG.c */ - -extern void cfbPolyFillArcSolidGeneral( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); -/* cfbfillrct.c */ - -extern void cfbFillBoxTileOdd( - DrawablePtr /*pDrawable*/, - int /*n*/, - BoxPtr /*rects*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/ -); - -extern void cfbFillRectTileOdd( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfbPolyFillRect( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nrectFill*/, - xRectangle * /*prectInit*/ -); -/* cfbfillsp.c */ - -extern void cfbUnnaturalTileFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void cfbUnnaturalStippleFS( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -#ifndef CFB_PROTOTYPES_ONLY -extern void cfb8Stipple32FS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); - -extern void cfb8OpaqueStipple32FS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -#endif -/* cfbgc.c */ - -extern GCOpsPtr cfbMatchCommon( - GCPtr /*pGC*/, - cfbPrivGCPtr /*devPriv*/ -); - -extern Bool cfbCreateGC( - GCPtr /*pGC*/ -); - -extern void cfbValidateGC( - GCPtr /*pGC*/, - unsigned long /*changes*/, - DrawablePtr /*pDrawable*/ -); - -/* cfbgetsp.c */ - -extern void cfbGetSpans( - DrawablePtr /*pDrawable*/, - int /*wMax*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - int /*nspans*/, - char * /*pdstStart*/ -); -/* cfbglblt8.c */ - -extern void cfbPolyGlyphBlt8( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* cfbglrop8.c */ - -extern void cfbPolyGlyphRop8( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* cfbhrzvert.c */ - -extern void cfbHorzS( - int /*rop*/, - CfbBits /*and*/, - CfbBits /*xor*/, - CfbBits * /*addrl*/, - int /*nlwidth*/, - int /*x1*/, - int /*y1*/, - int /*len*/ -); - -extern void cfbVertS( - int /*rop*/, - CfbBits /*and*/, - CfbBits /*xor*/, - CfbBits * /*addrl*/, - int /*nlwidth*/, - int /*x1*/, - int /*y1*/, - int /*len*/ -); -/* cfbigblt8.c */ - -extern void cfbImageGlyphBlt8( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* cfbimage.c */ - -extern void cfbPutImage( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*depth*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - int /*leftPad*/, - int /*format*/, - char * /*pImage*/ -); - -extern void cfbGetImage( - DrawablePtr /*pDrawable*/, - int /*sx*/, - int /*sy*/, - int /*w*/, - int /*h*/, - unsigned int /*format*/, - unsigned long /*planeMask*/, - char * /*pdstLine*/ -); -/* cfbline.c */ - -extern void cfbLineSS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); - -extern void cfbLineSD( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - DDXPointPtr /*pptInit*/ -); -/* cfbmskbits.c */ -/* cfbpixmap.c */ - -extern PixmapPtr cfbCreatePixmap( - ScreenPtr /*pScreen*/, - int /*width*/, - int /*height*/, - int /*depth*/, - unsigned /*usage_hint*/ -); - -extern Bool cfbDestroyPixmap( - PixmapPtr /*pPixmap*/ -); - -extern PixmapPtr cfbCopyPixmap( - PixmapPtr /*pSrc*/ -); - -extern void cfbPadPixmap( - PixmapPtr /*pPixmap*/ -); - -extern void cfbXRotatePixmap( - PixmapPtr /*pPix*/, - int /*rw*/ -); - -extern void cfbYRotatePixmap( - PixmapPtr /*pPix*/, - int /*rh*/ -); - -extern void cfbCopyRotatePixmap( - PixmapPtr /*psrcPix*/, - PixmapPtr * /*ppdstPix*/, - int /*xrot*/, - int /*yrot*/ -); -/* cfbply1rctC.c */ - -extern void cfbFillPoly1RectCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*shape*/, - int /*mode*/, - int /*count*/, - DDXPointPtr /*ptsIn*/ -); -/* cfbply1rctG.c */ - -extern void cfbFillPoly1RectGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*shape*/, - int /*mode*/, - int /*count*/, - DDXPointPtr /*ptsIn*/ -); -/* cfbpolypnt.c */ - -extern void cfbPolyPoint( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*mode*/, - int /*npt*/, - xPoint * /*pptInit*/ -); -/* cfbpush8.c */ - -#ifndef CFB_PROTOTYPES_ONLY -extern void cfbPushPixels8( - GCPtr /*pGC*/, - PixmapPtr /*pBitmap*/, - DrawablePtr /*pDrawable*/, - int /*dx*/, - int /*dy*/, - int /*xOrg*/, - int /*yOrg*/ -); -/* cfbrctstp8.c */ - -extern void cfb8FillRectOpaqueStippled32( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfb8FillRectTransparentStippled32( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfb8FillRectStippledUnnatural( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); -#endif -/* cfbrrop.c */ - -extern int cfbReduceRasterOp( - int /*rop*/, - CfbBits /*fg*/, - CfbBits /*pm*/, - CfbBits * /*andp*/, - CfbBits * /*xorp*/ -); -/* cfbscrinit.c */ - -extern Bool cfbCloseScreen( - int /*index*/, - ScreenPtr /*pScreen*/ -); - -extern Bool cfbSetupScreen( - ScreenPtr /*pScreen*/, - pointer /*pbits*/, - int /*xsize*/, - int /*ysize*/, - int /*dpix*/, - int /*dpiy*/, - int /*width*/ -); - -extern Bool cfbFinishScreenInit( - ScreenPtr /*pScreen*/, - pointer /*pbits*/, - int /*xsize*/, - int /*ysize*/, - int /*dpix*/, - int /*dpiy*/, - int /*width*/ -); - -extern Bool cfbScreenInit( - ScreenPtr /*pScreen*/, - pointer /*pbits*/, - int /*xsize*/, - int /*ysize*/, - int /*dpix*/, - int /*dpiy*/, - int /*width*/ -); - -extern PixmapPtr cfbGetScreenPixmap( - ScreenPtr /*pScreen*/ -); - -extern void cfbSetScreenPixmap( - PixmapPtr /*pPix*/ -); - -/* cfbseg.c */ - -extern void cfbSegmentSS( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSeg*/ -); - -extern void cfbSegmentSD( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nseg*/, - xSegment * /*pSeg*/ -); -/* cfbsetsp.c */ - -extern void cfbSetScanline( - int /*y*/, - int /*xOrigin*/, - int /*xStart*/, - int /*xEnd*/, - unsigned int * /*psrc*/, - int /*alu*/, - int * /*pdstBase*/, - int /*widthDst*/, - unsigned long /*planemask*/ -); - -extern void cfbSetSpans( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - char * /*psrc*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - int /*nspans*/, - int /*fSorted*/ -); -/* cfbsolidC.c */ - -extern void cfbFillRectSolidCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfbSolidSpansCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -/* cfbsolidG.c */ - -extern void cfbFillRectSolidGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfbSolidSpansGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -/* cfbsolidX.c */ - -extern void cfbFillRectSolidXor( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfbSolidSpansXor( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -/* cfbteblt8.c */ - -#ifndef CFB_PROTOTYPES_ONLY -extern void cfbTEGlyphBlt8( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*xInit*/, - int /*yInit*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -#endif -/* cfbtegblt.c */ - -extern void cfbTEGlyphBlt( - DrawablePtr /*pDrawable*/, - GCPtr/*pGC*/, - int /*x*/, - int /*y*/, - unsigned int /*nglyph*/, - CharInfoPtr * /*ppci*/, - pointer /*pglyphBase*/ -); -/* cfbtile32C.c */ - -extern void cfbFillRectTile32Copy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfbTile32FSCopy( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -/* cfbtile32G.c */ - -extern void cfbFillRectTile32General( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nBox*/, - BoxPtr /*pBox*/ -); - -extern void cfbTile32FSGeneral( - DrawablePtr /*pDrawable*/, - GCPtr /*pGC*/, - int /*nInit*/, - DDXPointPtr /*pptInit*/, - int * /*pwidthInit*/, - int /*fSorted*/ -); -/* cfbtileoddC.c */ - -extern void cfbFillBoxTileOddCopy( - DrawablePtr /*pDrawable*/, - int /*nBox*/, - BoxPtr /*pBox*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); - -extern void cfbFillSpanTileOddCopy( - DrawablePtr /*pDrawable*/, - int /*n*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); - -extern void cfbFillBoxTile32sCopy( - DrawablePtr /*pDrawable*/, - int /*nBox*/, - BoxPtr /*pBox*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); - -extern void cfbFillSpanTile32sCopy( - DrawablePtr /*pDrawable*/, - int /*n*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); -/* cfbtileoddG.c */ - -extern void cfbFillBoxTileOddGeneral( - DrawablePtr /*pDrawable*/, - int /*nBox*/, - BoxPtr /*pBox*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); - -extern void cfbFillSpanTileOddGeneral( - DrawablePtr /*pDrawable*/, - int /*n*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); - -extern void cfbFillBoxTile32sGeneral( - DrawablePtr /*pDrawable*/, - int /*nBox*/, - BoxPtr /*pBox*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); - -extern void cfbFillSpanTile32sGeneral( - DrawablePtr /*pDrawable*/, - int /*n*/, - DDXPointPtr /*ppt*/, - int * /*pwidth*/, - PixmapPtr /*tile*/, - int /*xrot*/, - int /*yrot*/, - int /*alu*/, - unsigned long /*planemask*/ -); -/* cfbwindow.c */ - -extern Bool cfbCreateWindow( - WindowPtr /*pWin*/ -); - -extern Bool cfbDestroyWindow( - WindowPtr /*pWin*/ -); - -extern Bool cfbMapWindow( - WindowPtr /*pWindow*/ -); - -extern Bool cfbPositionWindow( - WindowPtr /*pWin*/, - int /*x*/, - int /*y*/ -); - -extern Bool cfbUnmapWindow( - WindowPtr /*pWindow*/ -); - -extern void cfbCopyWindow( - WindowPtr /*pWin*/, - DDXPointRec /*ptOldOrg*/, - RegionPtr /*prgnSrc*/ -); - -extern Bool cfbChangeWindowAttributes( - WindowPtr /*pWin*/, - unsigned long /*mask*/ -); -/* cfbzerarcC.c */ - -extern void cfbZeroPolyArcSS8Copy( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); -/* cfbzerarcG.c */ - -extern void cfbZeroPolyArcSS8General( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); -/* cfbzerarcX.c */ - -extern void cfbZeroPolyArcSS8Xor( - DrawablePtr /*pDraw*/, - GCPtr /*pGC*/, - int /*narcs*/, - xArc * /*parcs*/ -); - -#if (!defined(SINGLEDEPTH) && PSZ != 8) || defined(FORCE_SEPARATE_PRIVATE) - -#define CFB_NEED_SCREEN_PRIVATE - -extern DevPrivateKey cfbScreenPrivateKey; -#endif - -#ifndef CFB_PROTOTYPES_ONLY - -/* Common macros for extracting drawing information */ - -#define cfbGetWindowPixmap(d) \ - ((* ((DrawablePtr)(d))->pScreen->GetWindowPixmap)((WindowPtr)(d))) - -#define cfbGetTypedWidth(pDrawable,wtype) (\ - (((pDrawable)->type != DRAWABLE_PIXMAP) ? \ - (int) (cfbGetWindowPixmap(pDrawable)->devKind) : \ - (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype)) - -#define cfbGetByteWidth(pDrawable) cfbGetTypedWidth(pDrawable, unsigned char) - -#define cfbGetPixelWidth(pDrawable) cfbGetTypedWidth(pDrawable, PixelType) - -#define cfbGetLongWidth(pDrawable) cfbGetTypedWidth(pDrawable, CfbBits) - -#define cfbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\ - PixmapPtr _pPix; \ - if ((pDrawable)->type != DRAWABLE_PIXMAP) \ - _pPix = cfbGetWindowPixmap(pDrawable); \ - else \ - _pPix = (PixmapPtr) (pDrawable); \ - (pointer) = (ptype *) _pPix->devPrivate.ptr; \ - (width) = ((int) _pPix->devKind) / sizeof (wtype); \ -} - -#define cfbGetByteWidthAndPointer(pDrawable, width, pointer) \ - cfbGetTypedWidthAndPointer(pDrawable, width, pointer, unsigned char, unsigned char) - -#define cfbGetLongWidthAndPointer(pDrawable, width, pointer) \ - cfbGetTypedWidthAndPointer(pDrawable, width, pointer, CfbBits, CfbBits) - -#define cfbGetPixelWidthAndPointer(pDrawable, width, pointer) \ - cfbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) - -#define cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\ - PixmapPtr _pPix = cfbGetWindowPixmap((DrawablePtr) (pWin)); \ - (pointer) = (ptype *) _pPix->devPrivate.ptr; \ - (width) = ((int) _pPix->devKind) / sizeof (wtype); \ -} - -#define cfbGetWindowLongWidthAndPointer(pWin, width, pointer) \ - cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, CfbBits, CfbBits) - -#define cfbGetWindowByteWidthAndPointer(pWin, width, pointer) \ - cfbGetWindowTypedWidthAndPointer(pWin, width, pointer, unsigned char, unsigned char) - -#define cfbGetWindowPixelWidthAndPointer(pDrawable, width, pointer) \ - cfbGetWindowTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) - -/* - * XFree86 empties the root BorderClip when the VT is inactive, - * here's a macro which uses that to disable GetImage and GetSpans - */ -#define cfbWindowEnabled(pWin) \ - REGION_NOTEMPTY((pWin)->drawable.pScreen, \ - &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) - -#define cfbDrawableEnabled(pDrawable) \ - ((pDrawable)->type == DRAWABLE_PIXMAP ? \ - TRUE : cfbWindowEnabled((WindowPtr) pDrawable)) - -#include "micoord.h" - -#endif /* !CFB_PROTOTYPES_ONLY */ - -#endif diff --git a/cfb/cfb16.h b/cfb/cfb16.h deleted file mode 100644 index 6b5c30209..000000000 --- a/cfb/cfb16.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifndef _CFB16_H_ -#define _CFB16_H_ - -/* - * C's preprocessing language substitutes >text<, not values... - */ - -#ifdef OLDPSZ -# undef OLDPSZ -#endif - -#ifdef PSZ - -# if (PSZ == 8) -# define OLDPSZ 8 -# endif - -# if (PSZ == 16) -# define OLDPSZ 16 -# endif - -# if (PSZ == 24) -# define OLDPSZ 24 -# endif - -# if (PSZ == 32) -# define OLDPSZ 32 -# endif - -# ifndef OLDPSZ - /* Maybe an #error here ? */ -# endif - -# undef PSZ - -#endif - -#define PSZ 16 -#define CFB_PROTOTYPES_ONLY -#include "cfb.h" -#undef CFB_PROTOTYPES_ONLY -#include "cfbunmap.h" - -#undef PSZ -#ifdef OLDPSZ - -# if (OLDPSZ == 8) -# define PSZ 8 -# endif - -# if (OLDPSZ == 16) -# define PSZ 16 -# endif - -# if (OLDPSZ == 24) -# define PSZ 24 -# endif - -# if (OLDPSZ == 32) -# define PSZ 32 -# endif - -# undef OLDPSZ - -#endif - -#endif /* _CFB16_H_ */ diff --git a/cfb/cfb24.h b/cfb/cfb24.h deleted file mode 100644 index ea5fc848e..000000000 --- a/cfb/cfb24.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef _CFB24_H_ -#define _CFB24_H_ - -/* - * C's preprocessing language substitutes >text<, not values... - */ - -#ifdef OLDPSZ -# undef OLDPSZ -#endif - -#ifdef PSZ - -# if (PSZ == 8) -# define OLDPSZ 8 -# endif - -# if (PSZ == 16) -# define OLDPSZ 16 -# endif - -# if (PSZ == 24) -# define OLDPSZ 24 -# endif - -# if (PSZ == 32) -# define OLDPSZ 32 -# endif - -# ifndef OLDPSZ - /* Maybe an #error here ? */ -# endif - -# undef PSZ - -#endif - -#define PSZ 24 -#define CFB_PROTOTYPES_ONLY -#include "cfb.h" -#undef CFB_PROTOTYPES_ONLY -#include "cfbunmap.h" - -#undef PSZ -#ifdef OLDPSZ - -# if (OLDPSZ == 8) -# define PSZ 8 -# endif - -# if (OLDPSZ == 16) -# define PSZ 16 -# endif - -# if (OLDPSZ == 24) -# define PSZ 24 -# endif - -# if (OLDPSZ == 32) -# define PSZ 32 -# endif - -# undef OLDPSZ - -#endif - -#endif /* _CFB24_H_ */ diff --git a/cfb/cfb32.h b/cfb/cfb32.h deleted file mode 100644 index 18a5dc1c3..000000000 --- a/cfb/cfb32.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifndef _CFB32_H_ -#define _CFB32_H_ - -/* - * C's preprocessing language substitutes >text<, not values... - */ - -#ifdef OLDPSZ -# undef OLDPSZ -#endif - -#ifdef PSZ - -# if (PSZ == 8) -# define OLDPSZ 8 -# endif - -# if (PSZ == 16) -# define OLDPSZ 16 -# endif - -# if (PSZ == 24) -# define OLDPSZ 24 -# endif - -# if (PSZ == 32) -# define OLDPSZ 32 -# endif - -# ifndef OLDPSZ - /* Maybe an #error here ? */ -# endif - -# undef PSZ - -#endif - -#define PSZ 32 -#define CFB_PROTOTYPES_ONLY -#include "cfb.h" -#undef CFB_PROTOTYPES_ONLY -#include "cfbunmap.h" - -#undef PSZ -#ifdef OLDPSZ - -# if (OLDPSZ == 8) -# define PSZ 8 -# endif - -# if (OLDPSZ == 16) -# define PSZ 16 -# endif - -# if (OLDPSZ == 24) -# define PSZ 24 -# endif - -# if (OLDPSZ == 32) -# define PSZ 32 -# endif - -# undef OLDPSZ - -#endif - -#endif /* _CFB32_H_ */ diff --git a/cfb/cfb8bit.c b/cfb/cfb8bit.c deleted file mode 100644 index 54a08c53d..000000000 --- a/cfb/cfb8bit.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - -Copyright 1989, 1994, 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. - -*/ - -/* - * cfb8bit.c - * - * 8 bit color frame buffer utility routines - */ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#if PSZ == 8 - -#include -#include -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -PixelGroup cfb8StippleMasks[NUM_MASKS] = { -#if NUM_MASKS == 16 - 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, - 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff, - 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, - 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff -#else /* NUM_MASKS == 256 */ - 0x0000000000000000, 0x00000000000000ff, - 0x000000000000ff00, 0x000000000000ffff, - 0x0000000000ff0000, 0x0000000000ff00ff, - 0x0000000000ffff00, 0x0000000000ffffff, - 0x00000000ff000000, 0x00000000ff0000ff, - 0x00000000ff00ff00, 0x00000000ff00ffff, - 0x00000000ffff0000, 0x00000000ffff00ff, - 0x00000000ffffff00, 0x00000000ffffffff, - 0x000000ff00000000, 0x000000ff000000ff, - 0x000000ff0000ff00, 0x000000ff0000ffff, - 0x000000ff00ff0000, 0x000000ff00ff00ff, - 0x000000ff00ffff00, 0x000000ff00ffffff, - 0x000000ffff000000, 0x000000ffff0000ff, - 0x000000ffff00ff00, 0x000000ffff00ffff, - 0x000000ffffff0000, 0x000000ffffff00ff, - 0x000000ffffffff00, 0x000000ffffffffff, - 0x0000ff0000000000, 0x0000ff00000000ff, - 0x0000ff000000ff00, 0x0000ff000000ffff, - 0x0000ff0000ff0000, 0x0000ff0000ff00ff, - 0x0000ff0000ffff00, 0x0000ff0000ffffff, - 0x0000ff00ff000000, 0x0000ff00ff0000ff, - 0x0000ff00ff00ff00, 0x0000ff00ff00ffff, - 0x0000ff00ffff0000, 0x0000ff00ffff00ff, - 0x0000ff00ffffff00, 0x0000ff00ffffffff, - 0x0000ffff00000000, 0x0000ffff000000ff, - 0x0000ffff0000ff00, 0x0000ffff0000ffff, - 0x0000ffff00ff0000, 0x0000ffff00ff00ff, - 0x0000ffff00ffff00, 0x0000ffff00ffffff, - 0x0000ffffff000000, 0x0000ffffff0000ff, - 0x0000ffffff00ff00, 0x0000ffffff00ffff, - 0x0000ffffffff0000, 0x0000ffffffff00ff, - 0x0000ffffffffff00, 0x0000ffffffffffff, - 0x00ff000000000000, 0x00ff0000000000ff, - 0x00ff00000000ff00, 0x00ff00000000ffff, - 0x00ff000000ff0000, 0x00ff000000ff00ff, - 0x00ff000000ffff00, 0x00ff000000ffffff, - 0x00ff0000ff000000, 0x00ff0000ff0000ff, - 0x00ff0000ff00ff00, 0x00ff0000ff00ffff, - 0x00ff0000ffff0000, 0x00ff0000ffff00ff, - 0x00ff0000ffffff00, 0x00ff0000ffffffff, - 0x00ff00ff00000000, 0x00ff00ff000000ff, - 0x00ff00ff0000ff00, 0x00ff00ff0000ffff, - 0x00ff00ff00ff0000, 0x00ff00ff00ff00ff, - 0x00ff00ff00ffff00, 0x00ff00ff00ffffff, - 0x00ff00ffff000000, 0x00ff00ffff0000ff, - 0x00ff00ffff00ff00, 0x00ff00ffff00ffff, - 0x00ff00ffffff0000, 0x00ff00ffffff00ff, - 0x00ff00ffffffff00, 0x00ff00ffffffffff, - 0x00ffff0000000000, 0x00ffff00000000ff, - 0x00ffff000000ff00, 0x00ffff000000ffff, - 0x00ffff0000ff0000, 0x00ffff0000ff00ff, - 0x00ffff0000ffff00, 0x00ffff0000ffffff, - 0x00ffff00ff000000, 0x00ffff00ff0000ff, - 0x00ffff00ff00ff00, 0x00ffff00ff00ffff, - 0x00ffff00ffff0000, 0x00ffff00ffff00ff, - 0x00ffff00ffffff00, 0x00ffff00ffffffff, - 0x00ffffff00000000, 0x00ffffff000000ff, - 0x00ffffff0000ff00, 0x00ffffff0000ffff, - 0x00ffffff00ff0000, 0x00ffffff00ff00ff, - 0x00ffffff00ffff00, 0x00ffffff00ffffff, - 0x00ffffffff000000, 0x00ffffffff0000ff, - 0x00ffffffff00ff00, 0x00ffffffff00ffff, - 0x00ffffffffff0000, 0x00ffffffffff00ff, - 0x00ffffffffffff00, 0x00ffffffffffffff, - 0xff00000000000000, 0xff000000000000ff, - 0xff0000000000ff00, 0xff0000000000ffff, - 0xff00000000ff0000, 0xff00000000ff00ff, - 0xff00000000ffff00, 0xff00000000ffffff, - 0xff000000ff000000, 0xff000000ff0000ff, - 0xff000000ff00ff00, 0xff000000ff00ffff, - 0xff000000ffff0000, 0xff000000ffff00ff, - 0xff000000ffffff00, 0xff000000ffffffff, - 0xff0000ff00000000, 0xff0000ff000000ff, - 0xff0000ff0000ff00, 0xff0000ff0000ffff, - 0xff0000ff00ff0000, 0xff0000ff00ff00ff, - 0xff0000ff00ffff00, 0xff0000ff00ffffff, - 0xff0000ffff000000, 0xff0000ffff0000ff, - 0xff0000ffff00ff00, 0xff0000ffff00ffff, - 0xff0000ffffff0000, 0xff0000ffffff00ff, - 0xff0000ffffffff00, 0xff0000ffffffffff, - 0xff00ff0000000000, 0xff00ff00000000ff, - 0xff00ff000000ff00, 0xff00ff000000ffff, - 0xff00ff0000ff0000, 0xff00ff0000ff00ff, - 0xff00ff0000ffff00, 0xff00ff0000ffffff, - 0xff00ff00ff000000, 0xff00ff00ff0000ff, - 0xff00ff00ff00ff00, 0xff00ff00ff00ffff, - 0xff00ff00ffff0000, 0xff00ff00ffff00ff, - 0xff00ff00ffffff00, 0xff00ff00ffffffff, - 0xff00ffff00000000, 0xff00ffff000000ff, - 0xff00ffff0000ff00, 0xff00ffff0000ffff, - 0xff00ffff00ff0000, 0xff00ffff00ff00ff, - 0xff00ffff00ffff00, 0xff00ffff00ffffff, - 0xff00ffffff000000, 0xff00ffffff0000ff, - 0xff00ffffff00ff00, 0xff00ffffff00ffff, - 0xff00ffffffff0000, 0xff00ffffffff00ff, - 0xff00ffffffffff00, 0xff00ffffffffffff, - 0xffff000000000000, 0xffff0000000000ff, - 0xffff00000000ff00, 0xffff00000000ffff, - 0xffff000000ff0000, 0xffff000000ff00ff, - 0xffff000000ffff00, 0xffff000000ffffff, - 0xffff0000ff000000, 0xffff0000ff0000ff, - 0xffff0000ff00ff00, 0xffff0000ff00ffff, - 0xffff0000ffff0000, 0xffff0000ffff00ff, - 0xffff0000ffffff00, 0xffff0000ffffffff, - 0xffff00ff00000000, 0xffff00ff000000ff, - 0xffff00ff0000ff00, 0xffff00ff0000ffff, - 0xffff00ff00ff0000, 0xffff00ff00ff00ff, - 0xffff00ff00ffff00, 0xffff00ff00ffffff, - 0xffff00ffff000000, 0xffff00ffff0000ff, - 0xffff00ffff00ff00, 0xffff00ffff00ffff, - 0xffff00ffffff0000, 0xffff00ffffff00ff, - 0xffff00ffffffff00, 0xffff00ffffffffff, - 0xffffff0000000000, 0xffffff00000000ff, - 0xffffff000000ff00, 0xffffff000000ffff, - 0xffffff0000ff0000, 0xffffff0000ff00ff, - 0xffffff0000ffff00, 0xffffff0000ffffff, - 0xffffff00ff000000, 0xffffff00ff0000ff, - 0xffffff00ff00ff00, 0xffffff00ff00ffff, - 0xffffff00ffff0000, 0xffffff00ffff00ff, - 0xffffff00ffffff00, 0xffffff00ffffffff, - 0xffffffff00000000, 0xffffffff000000ff, - 0xffffffff0000ff00, 0xffffffff0000ffff, - 0xffffffff00ff0000, 0xffffffff00ff00ff, - 0xffffffff00ffff00, 0xffffffff00ffffff, - 0xffffffffff000000, 0xffffffffff0000ff, - 0xffffffffff00ff00, 0xffffffffff00ffff, - 0xffffffffffff0000, 0xffffffffffff00ff, - 0xffffffffffffff00, 0xffffffffffffffff -#endif -}; - -int cfb8StippleMode, cfb8StippleAlu, cfb8StippleRRop; -PixelGroup cfb8StippleFg, cfb8StippleBg, cfb8StipplePm; -PixelGroup cfb8StippleAnd[NUM_MASKS], cfb8StippleXor[NUM_MASKS]; - -int -cfb8SetStipple (alu, fg, planemask) -int alu; -CfbBits fg, planemask; -{ - CfbBits and, xor, rrop; - int s; - CfbBits c; - - cfb8StippleMode = FillStippled; - cfb8StippleAlu = alu; - cfb8StippleFg = fg & PMSK; - cfb8StipplePm = planemask & PMSK; - rrop = cfbReduceRasterOp (alu, fg, planemask, &and, &xor); - cfb8StippleRRop = rrop; - /* - * create the appropriate pixel-fill bits for current - * foreground - */ - for (s = 0; s < NUM_MASKS; s++) - { - c = cfb8StippleMasks[s]; - cfb8StippleAnd[s] = and | ~c; - cfb8StippleXor[s] = xor & c; - } - return TRUE; -} - - -int -cfb8SetOpaqueStipple (alu, fg, bg, planemask) -int alu; -CfbBits fg, bg, planemask; -{ - CfbBits andfg, xorfg, andbg, xorbg, rropfg, rropbg; - int s; - CfbBits c; - - cfb8StippleMode = FillOpaqueStippled; - cfb8StippleAlu = alu; - cfb8StippleFg = fg & PMSK; - cfb8StippleBg = bg & PMSK; - cfb8StipplePm = planemask & PMSK; - rropfg = cfbReduceRasterOp (alu, cfb8StippleFg, cfb8StipplePm, &andfg, &xorfg); - rropbg = cfbReduceRasterOp (alu, cfb8StippleBg, cfb8StipplePm, &andbg, &xorbg); - if (rropfg == rropbg) - cfb8StippleRRop = rropfg; - else - cfb8StippleRRop = GXset; - /* - * create the appropriate pixel-fill bits for current - * foreground - */ - for (s = 0; s < NUM_MASKS; s++) - { - c = cfb8StippleMasks[s]; - cfb8StippleAnd[s] = (andfg | ~c) & (andbg | c); - cfb8StippleXor[s] = (xorfg & c) | (xorbg & ~c); - } - return TRUE; -} - -/* - * a grungy little routine. This computes clip masks - * for partial character blts. Returns rgnOUT if the - * entire character is clipped; returns rgnIN if the entire - * character is unclipped; returns rgnPART if a portion of - * the character is visible. Computes clip masks for each - * longword of the character -- and those with the - * contents of the glyph to compute the visible bits. - */ - -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) -PixelGroup cfb8BitLenMasks[PGSZ] = { - 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff, - 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff, - 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, - 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff, - 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, - 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f, - 0x0000000f, 0x00000007, 0x00000003, 0x00000001, -}; -#else -PixelGroup cfb8BitLenMasks[PGSZ] = { - 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8, - 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80, - 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800, - 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000, - 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000, - 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000, - 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000, - 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000, -}; -#endif /* BITMAP_BIT_ORDER */ -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) -PixelGroup cfb8BitLenMasks[PGSZ] = { - 0xffffffffffffffff, 0x7fffffffffffffff, - 0x3fffffffffffffff, 0x1fffffffffffffff, - 0x0fffffffffffffff, 0x07ffffffffffffff, - 0x03ffffffffffffff, 0x01ffffffffffffff, - 0x00ffffffffffffff, 0x007fffffffffffff, - 0x003fffffffffffff, 0x001fffffffffffff, - 0x000fffffffffffff, 0x0007ffffffffffff, - 0x0003ffffffffffff, 0x0001ffffffffffff, - 0x0000ffffffffffff, 0x00007fffffffffff, - 0x00003fffffffffff, 0x00001fffffffffff, - 0x00000fffffffffff, 0x000007ffffffffff, - 0x000003ffffffffff, 0x000001ffffffffff, - 0x000000ffffffffff, 0x0000007fffffffff, - 0x0000003fffffffff, 0x0000001fffffffff, - 0x0000000fffffffff, 0x00000007ffffffff, - 0x00000003ffffffff, 0x00000001ffffffff, - 0x00000000ffffffff, 0x000000007fffffff, - 0x000000003fffffff, 0x000000001fffffff, - 0x000000000fffffff, 0x0000000007ffffff, - 0x0000000003ffffff, 0x0000000001ffffff, - 0x0000000000ffffff, 0x00000000007fffff, - 0x00000000003fffff, 0x00000000001fffff, - 0x00000000000fffff, 0x000000000007ffff, - 0x000000000003ffff, 0x000000000001ffff, - 0x000000000000ffff, 0x0000000000007fff, - 0x0000000000003fff, 0x0000000000001fff, - 0x0000000000000fff, 0x00000000000007ff, - 0x00000000000003ff, 0x00000000000001ff, - 0x00000000000000ff, 0x000000000000007f, - 0x000000000000003f, 0x000000000000001f, - 0x000000000000000f, 0x0000000000000007, - 0x0000000000000003, 0x0000000000000001 -}; -#else -PixelGroup cfb8BitLenMasks[PGSZ] = { - 0xffffffffffffffff, 0xfffffffffffffffe, - 0xfffffffffffffffc, 0xfffffffffffffff8, - 0xfffffffffffffff0, 0xffffffffffffffe0, - 0xffffffffffffffc0, 0xffffffffffffff80, - 0xffffffffffffff00, 0xfffffffffffffe00, - 0xfffffffffffffc00, 0xfffffffffffff800, - 0xfffffffffffff000, 0xffffffffffffe000, - 0xffffffffffffc000, 0xffffffffffff8000, - 0xffffffffffff0000, 0xfffffffffffe0000, - 0xfffffffffffc0000, 0xfffffffffff80000, - 0xfffffffffff00000, 0xffffffffffe00000, - 0xffffffffffc00000, 0xffffffffff800000, - 0xffffffffff000000, 0xfffffffffe000000, - 0xfffffffffc000000, 0xfffffffff8000000, - 0xfffffffff0000000, 0xffffffffe0000000, - 0xffffffffc0000000, 0xffffffff80000000, - 0xffffffff00000000, 0xfffffffe00000000, - 0xfffffffc00000000, 0xfffffff800000000, - 0xfffffff000000000, 0xffffffe000000000, - 0xffffffc000000000, 0xffffff8000000000, - 0xffffff0000000000, 0xfffffe0000000000, - 0xfffffc0000000000, 0xfffff80000000000, - 0xfffff00000000000, 0xffffe00000000000, - 0xffffc00000000000, 0xffff800000000000, - 0xffff000000000000, 0xfffe000000000000, - 0xfffc000000000000, 0xfff8000000000000, - 0xfff0000000000000, 0xffe0000000000000, - 0xffc0000000000000, 0xff80000000000000, - 0xff00000000000000, 0xfe00000000000000, - 0xfc00000000000000, 0xf800000000000000, - 0xf000000000000000, 0xe000000000000000, - 0xc000000000000000, 0x8000000000000000 -}; -#endif /* BITMAP_BIT_ORDER */ -#endif /* PGSZ */ - - - -int -cfb8ComputeClipMasks32 (pBox, numRects, x, y, w, h, clips) - BoxPtr pBox; - int numRects; - int x, y, w, h; - CARD32 *clips; -{ - int yBand, yBandBot; - int ch; - CfbBits clip; - int partIN = FALSE, partOUT = FALSE; - int result; - - if (numRects == 0) - return rgnOUT; - while (numRects && pBox->y2 <= y) - { - --numRects; - ++pBox; - } - if (!numRects || pBox->y1 >= y + h) - return rgnOUT; - yBand = pBox->y1; - while (numRects && pBox->y1 == yBand && pBox->x2 <= x) - { - --numRects; - ++pBox; - } - if (!numRects || pBox->y1 >= y + h) - return rgnOUT; - if (numRects && - x >= pBox->x1 && - x + w <= pBox->x2 && - y >= pBox->y1 && - y + h <= pBox->y2) - { - return rgnIN; - } - ch = 0; - while (numRects && pBox->y1 < y + h) - { - yBand = pBox->y1; - yBandBot = pBox->y2; - while (ch < h && y + ch < yBand) - { - partOUT = TRUE; - clips[ch++] = 0; - } - if (ch >= h) - break; - while (numRects && pBox->y1 == yBand && pBox->x2 <= x) - { - --numRects; - ++pBox; - } - if (!numRects) - break; - clip = 0; - while (numRects && pBox->y1 == yBand && pBox->x1 < x + w) - { - if (x < pBox->x1) - if (pBox->x2 < x + w) - clip |= cfb8BitLenMasks[pBox->x1 - x] & ~cfb8BitLenMasks[pBox->x2 - x]; - else - clip |= cfb8BitLenMasks[pBox->x1 - x]; - else - if (pBox->x2 < x + w) - clip |= ~cfb8BitLenMasks[pBox->x2 - x]; - else - clip = ~0; - --numRects; - ++pBox; - } - if (clip != 0) - partIN = TRUE; - if (clip != ~0) - partOUT = TRUE; - while (ch < h && y + ch < yBandBot) - clips[ch++] = clip; - while (numRects && pBox->y1 == yBand) - { - --numRects; - ++pBox; - } - } - while (ch < h) - { - partOUT = TRUE; - clips[ch++] = 0; - } - result = rgnOUT; - if (partIN) - { - if (partOUT) - result = rgnPART; - else - result = rgnIN; - } - return result; -} - -#endif /* PSZ == 8 */ diff --git a/cfb/cfb8bit.h b/cfb/cfb8bit.h deleted file mode 100644 index 5a17adf4f..000000000 --- a/cfb/cfb8bit.h +++ /dev/null @@ -1,1570 +0,0 @@ -/* - * cfb8bit.h - * - * Defines which are only useful to 8 bit color frame buffers - * - * That doesn't seem to be true any more. Some of the macros in here - * are used for depths other than 8. Perhaps the file should be - * renamed. dpw - */ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include "servermd.h" - -#if (BITMAP_BIT_ORDER == MSBFirst) -#define GetBitGroup(x) (((PixelGroup) (x)) >> (PGSZ - PGSZB)) -#define NextBitGroup(x) ((x) <<= PGSZB) -#define NextSomeBits(x,n) ((x) <<= (n)) -#else -#define GetBitGroup(x) ((x) & PGSZBMSK) -#define NextBitGroup(x) ((x) >>= PGSZB) -#define NextSomeBits(x,n) ((x) >>= (n)) -#endif - -#define RotBitsLeft(x,k) ((x) = BitLeft (x,k) | \ - BitRight (x, PGSZ-(k))) - -#if defined(__GNUC__) && defined(mc68020) -#undef RotBitsLeft -#define RotBitsLeft(x,k) asm("rol%.l %2,%0" \ - : "=d" (x) \ - : "0" (x), "dI" (k)) -#endif - -#if PSZ == 8 - -#define GetPixelGroup(x) (cfb8StippleXor[GetBitGroup(x)]) -#define RRopPixels(dst,x) (DoRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x])) -#define RRopPixelGroup(dst,x) (RRopPixels(dst,GetBitGroup(x))) -#define MaskRRopPixels(dst,x,mask) (DoMaskRRop(dst,cfb8StippleAnd[x], cfb8StippleXor[x], mask)) - -#define NUM_MASKS (1<= MFB_PPW) \ - { \ - inputBits = *srcTemp++; \ - bitsLeft -= MFB_PPW; \ - partBitsLeft = MFB_PPW; \ - } \ - else \ - { \ - inputBits = 0; \ - if (bitsLeft) \ - inputBits = *srcTemp & ~cfb8BitLenMasks[bitsLeft]; \ - srcTemp = srcStart; \ - partBitsLeft = bitsLeft; \ - bitsLeft = bitsWhole; \ - } - -#define NextUnnaturalStippleBits \ - if (partBitsLeft >= PPW) { \ - bits = GetBitGroup (inputBits); \ - NextBitGroup (inputBits); \ - partBitsLeft -= PPW; \ - } else { \ - bits = GetBitGroup (inputBits); \ - nextPartBits = PPW - partBitsLeft; \ - NextUnnaturalStippleWord \ - if (partBitsLeft < nextPartBits) { \ - if (partBitsLeft) {\ - bits |= BitRight (GetBitGroup (inputBits), \ - PPW - nextPartBits) & PPWMSK;\ - nextPartBits -= partBitsLeft; \ - } \ - NextUnnaturalStippleWord \ - } \ - bits |= BitRight (GetBitGroup (inputBits), \ - PPW - nextPartBits) & PPWMSK; \ - NextSomeBits (inputBits, nextPartBits); \ - partBitsLeft -= nextPartBits; \ - } - -#define NextUnnaturalStippleBitsFast \ - if (partBitsLeft >= PPW) { \ - bits = GetBitGroup(inputBits); \ - NextBitGroup(inputBits); \ - partBitsLeft -= PPW; \ - } else { \ - bits = GetBitGroup (inputBits); \ - nextPartBits = PPW - partBitsLeft; \ - inputBits = *srcTemp++; \ - bits |= BitRight (GetBitGroup (inputBits), \ - partBitsLeft) & PPWMSK; \ - NextSomeBits (inputBits, nextPartBits); \ - partBitsLeft = MFB_PPW - nextPartBits; \ - } - -/* - * WriteBitGroup takes the destination address, a pixel - * value (which must be 8 bits duplicated 4 time with PFILL) - * and the PPW bits to write, which must be in the low order - * bits of the register (probably from GetBitGroup) and writes - * the appropriate locations in memory with the pixel value. This - * is a copy-mode only operation. - */ - -#define RRopBitGroup(dst,bits) \ - { \ - *(dst) = RRopPixels(*(dst),bits); \ - } - -#define MaskRRopBitGroup(dst,bits,mask) \ - { \ - *(dst) = MaskRRopPixels(*(dst),bits,mask); \ - } -#endif /* PSZ == 8 */ - -#if !defined(AVOID_MEMORY_READ) && PSZ == 8 - -#define WriteBitGroup(dst,pixel,bits) \ - { \ - register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \ - *(dst) = (*(dst) & ~_maskTmp) | ((pixel) & _maskTmp); \ - } - -#define SwitchBitGroup(dst,pixel,bits) \ - { \ - register PixelGroup _maskTmp = cfb8PixelMasks[(bits)]; \ - register PixelGroup _pixTmp = ((pixel) & _maskTmp); \ - _maskTmp = ~_maskTmp; \ - SwitchBitsLoop (*(dst) = (*(dst) & _maskTmp) | _pixTmp;) \ - } - -#else /* AVOID_MEMORY_READ */ - -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) -#define SinglePixel0 3 -#define SinglePixel1 2 -#define SinglePixel2 1 -#define SinglePixel3 0 -#define SinglePixel4 7 -#define SinglePixel5 6 -#define SinglePixel6 5 -#define SinglePixel7 4 -#define SinglePixel8 0xB -#define SinglePixel9 0xA -#define DoublePixel0 1 -#define DoublePixel1 0 -#define DoublePixel2 3 -#define DoublePixel3 2 -#define DoublePixel4 5 -#define DoublePixel5 4 -#else -#define SinglePixel0 0 -#define SinglePixel1 1 -#define SinglePixel2 2 -#define SinglePixel3 3 -#define SinglePixel4 4 -#define SinglePixel5 5 -#define SinglePixel6 6 -#define SinglePixel7 7 -#define SinglePixel8 8 -#define SinglePixel9 9 -#define DoublePixel0 0 -#define DoublePixel1 1 -#define DoublePixel2 2 -#define DoublePixel3 3 -#define DoublePixel4 4 -#define DoublePixel5 5 -#endif -#define QuadPixel0 0 -#define QuadPixel1 1 -#define QuadPixel2 2 -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) -#define SinglePixel0 7 -#define SinglePixel1 6 -#define SinglePixel2 5 -#define SinglePixel3 4 -#define SinglePixel4 3 -#define SinglePixel5 2 -#define SinglePixel6 1 -#define SinglePixel7 0 -#define DoublePixel0 3 -#define DoublePixel1 2 -#define DoublePixel2 1 -#define DoublePixel3 0 -#define QuadPixel0 1 -#define QuadPixel1 0 -#else -#define SinglePixel0 0 -#define SinglePixel1 1 -#define SinglePixel2 2 -#define SinglePixel3 3 -#define SinglePixel4 4 -#define SinglePixel5 5 -#define SinglePixel6 6 -#define SinglePixel7 7 -#define DoublePixel0 0 -#define DoublePixel1 1 -#define DoublePixel2 2 -#define DoublePixel3 3 -#define QuadPixel0 0 -#define QuadPixel1 1 -#endif -#define OctaPixel0 0 -#endif /* PGSZ == 64 */ - -#if PSZ == 8 - -#if PGSZ == 32 -#define WriteBitGroup(dst,pixel,bits) \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - break; \ - case 4: \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 13: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 14: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[0] = (pixel); \ - break; \ - } -#else /* PGSZ == 64 */ -#define WriteBitGroup(dst,pixel,bits) \ - if ( bits == 0xff ) \ - ((PixelGroup *) (dst))[OctaPixel0] = (pixel); \ - else { \ - switch (bits & 0x0f) { \ - case 0: \ - break; \ - case 1: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - break; \ - case 4: \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 13: \ - ((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 14: \ - ((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[QuadPixel0] = (pixel); \ - break; \ - } \ - switch ((bits & 0xf0) >> 4) { \ - case 0: \ - break; \ - case 1: \ - ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - break; \ - case 2: \ - ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - break; \ - case 3: \ - ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ - break; \ - case 4: \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 5: \ - ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 6: \ - ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 7: \ - ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 8: \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 9: \ - ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 10: \ - ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 11: \ - ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 12: \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - case 13: \ - ((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - case 14: \ - ((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ - break; \ - } \ - } -#endif /* PGSZ == 64 */ - -#if PGSZ == 32 -#define SwitchBitGroup(dst,pixel,bits) { \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \ - break; \ - case 2: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \ - break; \ - case 3: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);) \ - break; \ - case 4: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 5: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 6: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 7: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 8: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 9: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 10: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 11: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 12: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - case 13: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - case 14: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - case 15: \ - SwitchBitsLoop (((CARD32 *) (dst))[0] = (pixel);) \ - break; \ - } \ -} -#else /* PGSZ == 64 */ -#define SwitchBitGroup(dst,pixel,bits) { \ - if ( bits == 0xff ) \ - SwitchBitsLoop (((PixelGroup *) (dst))[OctaPixel0] = (pixel);) \ - else { \ - switch (bits & 0x0f) { \ - case 0: \ - break; \ - case 1: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel);) \ - break; \ - case 2: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel);) \ - break; \ - case 3: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel);)\ - break; \ - case 4: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 5: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 6: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 7: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 8: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 9: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 10: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 11: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 12: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel1] = (pixel);)\ - break; \ - case 13: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\ - break; \ - case 14: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel1] = (pixel);)\ - break; \ - case 15: \ - SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel);) \ - break; \ - } \ - switch ((bits & 0xf0) >> 4) { \ - case 0: \ - break; \ - case 1: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel);) \ - break; \ - case 2: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel);) \ - break; \ - case 3: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel);)\ - break; \ - case 4: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ - break; \ - case 5: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ - break; \ - case 6: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ - break; \ - case 7: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel6] = (pixel);) \ - break; \ - case 8: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ - break; \ - case 9: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ - break; \ - case 10: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ - break; \ - case 11: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel7] = (pixel);) \ - break; \ - case 12: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel);)\ - break; \ - case 13: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\ - break; \ - case 14: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel);)\ - break; \ - case 15: \ - SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel1] = (pixel);) \ - break; \ - } \ - } \ -} -#endif /* PGSZ == 64 */ -#endif /* PSZ == 8 */ - -#if PSZ == 16 - -#if PGSZ == 32 -#define WriteBitGroup(dst,pixel,bits) \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - break; \ - case 4: \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 13: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 14: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - } -#else /* PGSZ == 64 */ -#define WriteBitGroup(dst,pixel,bits) \ - if ( bits == 0xff ) { \ - ((PixelGroup *) (dst))[QuadPixel0] = (pixel); \ - ((PixelGroup *) (dst))[QuadPixel1] = (pixel); \ - } \ - else { \ - switch (bits & 0x0f) { \ - case 0: \ - break; \ - case 1: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - break; \ - case 4: \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 13: \ - ((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 14: \ - ((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel); \ - break; \ - } \ - switch ((bits & 0xf0) >> 4) { \ - case 0: \ - break; \ - case 1: \ - ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ - break; \ - case 2: \ - ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ - break; \ - case 4: \ - ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 5: \ - ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 6: \ - ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 8: \ - ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 9: \ - ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 10: \ - ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - case 13: \ - ((CARD16 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - case 14: \ - ((CARD16 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel3] = (pixel); \ - break; \ - } \ - } -#endif /* PGSZ */ - -#if PGSZ == 32 -#define SwitchBitGroup(dst,pixel,bits) { \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel);) \ - break; \ - case 2: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel);) \ - break; \ - case 3: \ - SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel);) \ - break; \ - case 4: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 5: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 6: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 7: \ - SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 8: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 9: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 10: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 11: \ - SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD16 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 12: \ - SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - case 13: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - case 14: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - case 15: \ - SwitchBitsLoop (((CARD32 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD32 *) (dst))[DoublePixel1] = (pixel);) \ - break; \ - } \ -} -#else /* PGSZ == 64 */ -#define SwitchBitGroup(dst,pixel,bits) { \ - cfb cannot hack 64-bit SwitchBitGroup psz=PSZ -#endif /* PGSZ */ - -#endif /* PSZ == 16 */ - -#if PSZ == 24 -/* 32 000011112222*/ -/* 24 000111222333*/ -/* 16 001122334455*/ -/* 8 0123456789AB*/ -#if PGSZ == 32 -#define WriteBitGroup(dst,pixel,bits) \ - { \ - register CARD32 reg_pixel = (pixel); \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel2] = ((reg_pixel>>16)&0xFF); \ - break; \ - case 2: \ - ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \ - ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \ - break; \ - case 3: \ - ((CARD8 *) (dst))[SinglePixel3] = reg_pixel & 0xFF; \ - ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ - ((CARD16 *) (dst))[DoublePixel2] = (reg_pixel>>8)&0xFFFF; \ - ((CARD8 *) (dst))[SinglePixel2] = (reg_pixel>>16&0xFF); \ - break; \ - case 4: \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel8] = (reg_pixel>>16)&0xFF; \ - break; \ - case 5: \ - ((CARD16 *) (dst))[DoublePixel0] = \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - reg_pixel >>= 16; \ - ((CARD8 *) (dst))[SinglePixel2] = \ - ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ - break; \ - case 6: \ - ((CARD8 *) (dst))[SinglePixel3] = reg_pixel; \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ - break; \ - case 7: \ - ((CARD16 *) (dst))[DoublePixel0] = \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel3] = reg_pixel&0xFF; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel2] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel2] = \ - ((CARD8 *) (dst))[SinglePixel8] = reg_pixel&0xFF; \ - break; \ - case 8: \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ - ((CARD16 *) (dst))[DoublePixel5] = (reg_pixel>>8); \ - break; \ - case 9: \ - ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel2] = reg_pixel&0xFF; \ - break; \ - case 10: \ - ((CARD8 *) (dst))[SinglePixel3] = \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel&0xFF; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel2] = \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - break; \ - case 11: \ - ((CARD8 *) (dst))[SinglePixel3] = \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ - ((CARD16 *) (dst))[DoublePixel0] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel2] = \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \ - break; \ - case 12: \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ - break; \ - case 13: \ - ((CARD16 *) (dst))[DoublePixel0] = \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel2] = \ - ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ - break; \ - case 14: \ - ((CARD8 *) (dst))[SinglePixel3] = \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel2] = \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel8] = reg_pixel; \ - break; \ - case 15: \ - ((CARD16 *) (dst))[DoublePixel0] = \ - ((CARD16 *) (dst))[DoublePixel3] = reg_pixel; \ - ((CARD8 *) (dst))[SinglePixel3] = \ - ((CARD8 *) (dst))[SinglePixel9] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD16 *) (dst))[DoublePixel2] = \ - ((CARD16 *) (dst))[DoublePixel5] = reg_pixel; \ - reg_pixel >>= 8; \ - ((CARD8 *) (dst))[SinglePixel8] = \ - ((CARD8 *) (dst))[SinglePixel2] = reg_pixel; \ - break; \ - } \ - } -#else /* PGSZ == 64 */ -#define WriteBitGroup(dst,pixel,bits) \ - if ( bits == 0xff ) { \ - ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \ - ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \ - ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \ - ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \ - } \ - else { \ - switch (bits & 0x0f) { \ - case 0: \ - break; \ - case 1: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 4: \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 13: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 14: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - } \ - switch ((bits & 0xf0) >> 4) { \ - case 0: \ - break; \ - case 1: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - break; \ - case 2: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - break; \ - case 4: \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 5: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 6: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 8: \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 9: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 10: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 13: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 14: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - } \ - } -#endif /* PGSZ */ - -#if PGSZ == 32 -#define SwitchBitGroup(dst,pixel,bits) { \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 2: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \ - break; \ - case 3: \ - SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel2] = (pixel);) \ - break; \ - case 4: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ - break; \ - case 5: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ - break; \ - case 6: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ - break; \ - case 7: \ - SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel8] = (pixel);) \ - break; \ - case 8: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel9] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ - break; \ - case 9: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ - break; \ - case 10: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel2] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ - break; \ - case 11: \ - SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel);) \ - ((CARD8 *) (dst))[SinglePixel9] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel5] = (pixel);) \ - break; \ - case 12: \ - SwitchBitsLoop (((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ - break; \ - case 13: \ - SwitchBitsLoop (((CARD16 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD8 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD16 *) (dst))[DoublePixel3] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ - break; \ - case 14: \ - SwitchBitsLoop (((CARD8 *) (dst))[SinglePixel3] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ - break; \ - case 15: \ - SwitchBitsLoop (((CARD32 *) (dst))[QuadPixel0] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel1] = (pixel); \ - ((CARD32 *) (dst))[QuadPixel2] = (pixel);) \ - break; \ - } \ -} -#else /* PGSZ == 64 */ -#define SwitchBitGroup(dst,pixel,bits) { \ - cfb cannot hack 64-bit SwitchBitGroup psz=PSZ -#endif /* PGSZ */ - -#endif /* PSZ == 24 */ - -#if PSZ == 32 - -#if PGSZ == 32 -#define WriteBitGroup(dst,pixel,bits) \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 4: \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 13: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 14: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - } -#else /* PGSZ == 64 */ -#define WriteBitGroup(dst,pixel,bits) \ - if ( bits == 0xff ) { \ - ((PixelGroup *) (dst))[DoublePixel0] = (pixel); \ - ((PixelGroup *) (dst))[DoublePixel1] = (pixel); \ - ((PixelGroup *) (dst))[DoublePixel2] = (pixel); \ - ((PixelGroup *) (dst))[DoublePixel3] = (pixel); \ - } \ - else { \ - switch (bits & 0x0f) { \ - case 0: \ - break; \ - case 1: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - break; \ - case 2: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - break; \ - case 4: \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 5: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 6: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - break; \ - case 8: \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 9: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 10: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 13: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 14: \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel); \ - break; \ - } \ - switch ((bits & 0xf0) >> 4) { \ - case 0: \ - break; \ - case 1: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - break; \ - case 2: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - break; \ - case 3: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - break; \ - case 4: \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 5: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 6: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 7: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - break; \ - case 8: \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 9: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 10: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 11: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 12: \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 13: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 14: \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - case 15: \ - ((CARD32 *) (dst))[SinglePixel4] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel5] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel6] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel7] = (pixel); \ - break; \ - } \ - } -#endif /* PGSZ */ - -#if PGSZ == 32 -#define SwitchBitGroup(dst,pixel,bits) { \ - switch (bits) { \ - case 0: \ - break; \ - case 1: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel);) \ - break; \ - case 2: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel);) \ - break; \ - case 3: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel);) \ - break; \ - case 4: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 5: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 6: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 7: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel);) \ - break; \ - case 8: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 9: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 10: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 11: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 12: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 13: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 14: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - case 15: \ - SwitchBitsLoop (((CARD32 *) (dst))[SinglePixel0] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel1] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel2] = (pixel); \ - ((CARD32 *) (dst))[SinglePixel3] = (pixel);) \ - break; \ - } \ -} -#else /* PGSZ == 64 */ -#define SwitchBitGroup(dst,pixel,bits) { \ - cfb cannot hack 64-bit SwitchBitGroup psz=PSZ -#endif /* PGSZ */ - -#endif /* PSZ == 32 */ -#endif /* AVOID_MEMORY_READ */ - -extern PixelGroup cfb8BitLenMasks[PGSZ]; - -extern int cfb8SetStipple ( - int /*alu*/, - CfbBits /*fg*/, - CfbBits /*planemask*/ -); - -extern int cfb8SetOpaqueStipple ( - int /*alu*/, - CfbBits /*fg*/, - CfbBits /*bg*/, - CfbBits /*planemask*/ -); - -extern int cfb8ComputeClipMasks32 ( - BoxPtr /*pBox*/, - int /*numRects*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - CARD32 * /*clips*/ -); diff --git a/cfb/cfb8line.c b/cfb/cfb8line.c deleted file mode 100644 index 8c00d9fea..000000000 --- a/cfb/cfb8line.c +++ /dev/null @@ -1,1503 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - * - * Jeff Anton'x fixes: cfb8line.c 97/02/07 - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "mistruct.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfbrrop.h" -#include "miline.h" - -#ifdef PIXEL_ADDR - -#if defined(__GNUC__) && defined(mc68020) -#define STUPID volatile -#define REARRANGE -#else -#define STUPID -#endif - -#ifdef __GNUC__ -/* lame compiler doesn't even look at 'register' attributes */ -#define I_H do{ -#define I_T }while(0); -#define IMPORTANT_START I_H I_H I_H I_H I_H I_H I_H I_H I_H I_H -#define IMPORTANT_END I_T I_T I_T I_T I_T I_T I_T I_T I_T I_T -#else -#define IMPORTANT_START -#define IMPORTANT_END -#endif - -#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask) - -#ifdef POLYSEGMENT - -# if (defined(sun) || defined(__bsdi__)) && \ - (defined(sparc) || defined(__sparc__)) -# define WIDTH_FAST 1152 -# endif - -# ifdef ultrix -# define WIDTH_FAST 1024 -# endif - -# ifdef Mips -# define WIDTH_FAST 4096 -# endif -# ifdef WIDTH_FAST -# if WIDTH_FAST == 1024 -# define FAST_MUL(y) ((y) << 10) -# endif - -# if WIDTH_FAST == 1152 -# define FAST_MUL(y) (((y) << 10) + ((y) << 7)) -# endif - -# if WIDTH_FAST == 1280 -# define FAST_MUL(y) (((y) << 10) + ((y) << 8)) -# endif - -# if WIDTH_FAST == 2048 -# define FAST_MUL(y) ((y) << 11) -# endif - -# if WIDTH_FAST == 4096 -# define FAST_MUL(y) ((y) << 12) -# endif -# endif - -# if defined(WIDTH_SHIFT) -# ifdef FAST_MUL -# define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Shift)) -# if RROP == GXcopy -# define INCLUDE_OTHERS -# define SERIOUS_UNROLLING -# endif -# define INCLUDE_DRAW -# define NWIDTH(nwidth) WIDTH_FAST -# define WIDTH_MUL(y,w) FAST_MUL(y) -# endif -# else -# define FUNC_NAME(e) RROP_NAME(e) -# define WIDTH_MUL(y,w) ((y) * (w)) -# define NWIDTH(nwidth) (nwidth) -# define INCLUDE_DRAW -# if !defined (FAST_MUL) && RROP == GXcopy -# define INCLUDE_OTHERS -# define SERIOUS_UNROLLING -# endif -# endif -#else - -# define INCLUDE_DRAW -# define WIDTH_MUL(y,w) ((y) * (w)) -# define NWIDTH(nwidth) nwidth -# ifdef PREVIOUS -# define FUNC_NAME(e) RROP_NAME(RROP_NAME_CAT(e,Previous)) -# else -# define FUNC_NAME(e) RROP_NAME(e) -# if RROP == GXcopy -# define INCLUDE_OTHERS -# ifdef PLENTIFUL_REGISTERS -# define SAVE_X2Y2 -# endif -# define ORIGIN -# define SERIOUS_UNROLLING -# else -# define EITHER_MODE -# endif -# endif -#endif - -#if PSZ == 24 -#define PXL2ADR(x) ((x)*3 >> 2) - -#if RROP == GXcopy -#define body_rop \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp = (*addrp & 0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ - break; \ - case 1: \ - *addrp = (*addrp & 0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ - break; \ - case 3: \ - *addrp = (*addrp & 0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ - *(addrp+1)=(*(addrp+1) & 0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ - break; \ - case 2: \ - *addrp = (*addrp & 0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ - *(addrp+1)=(*(addrp+1) & 0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ - break; \ - } -#endif -#if RROP == GXxor -#define body_rop \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp ^= piQxelXor[0] & 0xFFFFFF; \ - break; \ - case 1: \ - *addrp ^= piQxelXor[2] & 0xFFFFFF00; \ - break; \ - case 3: \ - *addrp ^= piQxelXor[0] & 0xFF000000; \ - *(addrp+1) ^= piQxelXor[1] & 0xFFFF; \ - break; \ - case 2: \ - *addrp ^= piQxelXor[1] & 0xFFFF0000; \ - *(addrp+1) ^= piQxelXor[2] & 0xFF; \ - break; \ - } -#endif -#if RROP == GXand -#define body_rop \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp &= piQxelAnd[0] | 0xFF000000; \ - break; \ - case 1: \ - *addrp &= piQxelAnd[2] | 0xFF; \ - break; \ - case 3: \ - *addrp &= 0xFFFFFF | piQxelAnd[0]; \ - *(addrp+1) &= 0xFFFF0000 | piQxelAnd[1]; \ - break; \ - case 2: \ - *addrp &= 0xFFFF | piQxelAnd[1]; \ - *(addrp+1) &= 0xFFFFFF00 | piQxelAnd[2]; \ - break; \ - } -#endif -#if RROP == GXor -#define body_rop \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp |= piQxelOr[0] & 0xFFFFFF; \ - break; \ - case 1: \ - *addrp |= piQxelOr[2] & 0xFFFFFF00; \ - break; \ - case 3: \ - *addrp |= piQxelOr[0] & 0xFF000000; \ - *(addrp+1) |= piQxelOr[1] & 0xFFFF; \ - break; \ - case 2: \ - *addrp |= piQxelOr[1] & 0xFFFF0000; \ - *(addrp+1) |= piQxelOr[2] & 0xFF; \ - break; \ - } -#endif -#if RROP == GXset -#define body_rop \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) \ - ^ (piQxelXor[0] & 0xFFFFFF); \ - break; \ - case 1: \ - *addrp = (*addrp & (piQxelAnd[2]|0xFF)) \ - ^ (piQxelXor[2] & 0xFFFFFF00); \ - break; \ - case 3: \ - *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) \ - ^ (piQxelXor[0] & 0xFF000000); \ - *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) \ - ^ (piQxelXor[1] & 0xFFFF); \ - break; \ - case 2: \ - *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) \ - ^ (piQxelXor[1] & 0xFFFF0000); \ - *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) \ - ^ (piQxelXor[2] & 0xFF); \ - break; \ - } -#endif -#endif /* PSZ == 24 */ - -#define BUGFIX_clip - -#ifdef INCLUDE_DRAW - -int -#ifdef POLYSEGMENT -FUNC_NAME(cfb8SegmentSS1Rect) (pDrawable, pGC, nseg, pSegInit) - DrawablePtr pDrawable; - GCPtr pGC; - int nseg; - xSegment *pSegInit; -#else -FUNC_NAME(cfb8LineSS1Rect) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, - x1p,y1p,x2p,y2p) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; /* number of points */ - DDXPointPtr pptInit, pptInitOrig; - int *x1p, *y1p, *x2p, *y2p; -#endif /* POLYSEGMENT */ -{ - register long e; - register int y1_or_e1; - register PixelType *addrp; - register int stepmajor; - register int stepminor; -#ifndef REARRANGE - register long e3; -#endif -#ifdef mc68000 - register short x1_or_len; -#else - register int x1_or_len; -#endif - RROP_DECLARE - -#ifdef SAVE_X2Y2 -# define c2 y2 -#else - register int c2; -#endif -#if !defined(ORIGIN) && !defined(POLYSEGMENT) - register int _x1 = 0, _y1 = 0, _x2 = 0, _y2 = 0; - int extents_x1, extents_y1, extents_x2, extents_y2; -#endif /* !ORIGIN */ -#ifndef PREVIOUS - register int upperleft, lowerright; - CARD32 ClipMask = 0x80008000; -#endif /* !PREVIOUS */ -#ifdef POLYSEGMENT - register int capStyle; -#endif /* POLYSEGMENT */ -#ifdef SAVE_X2Y2 - register int x2, y2; -# define X1 x1_or_len -# define Y1 y1_or_e1 -# define X2 x2 -# define Y2 y2 -#else -# ifdef POLYSEGMENT -# define X1 x1_or_len -# define Y1 y1_or_e1 -# else -# define X1 intToX(y1_or_e1) -# define Y1 intToY(y1_or_e1) -# endif /* POLYSEGMENT */ -# define X2 intToX(c2) -# define Y2 intToY(c2) -#endif /* SAVE_X2Y2 */ - PixelType *addr; - int nwidth; - cfbPrivGCPtr devPriv; - BoxPtr extents; - int *ppt; -#if PSZ == 24 - int xBase; /* x of addr */ - int xOffset; /* x of addrp */ - PixelType *addrLineEnd; - char *addrb; - int stepmajor3, stepminor3, majordx, minordx; -#endif -#ifndef POLYSEGMENT -#ifndef ORIGIN -#ifdef BUGFIX_clip - int ex_x1, ex_y1, ex_x2, ex_y2; -#endif -#endif -#endif - int octant; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - - devPriv = cfbGetGCPrivate(pGC); - cfbGetPixelWidthAndPointer (pDrawable, nwidth, addr); -#ifndef REARRANGE - RROP_FETCH_GCPRIV(devPriv); -#endif - extents = &pGC->pCompositeClip->extents; -#ifndef PREVIOUS - c2 = *((int *) &pDrawable->x); - c2 -= (c2 & 0x8000) << 1; - upperleft = *((int *) &extents->x1) - c2; - lowerright = *((int *) &extents->x2) - c2 - 0x00010001; -#endif /* !PREVIOUS */ -#ifndef POLYSEGMENT -#ifndef ORIGIN -#ifdef BUGFIX_clip - ex_x1 = extents->x1 - pDrawable->x; - ex_y1 = extents->y1 - pDrawable->y; - ex_x2 = extents->x2 - pDrawable->x; - ex_y2 = extents->y2 - pDrawable->y; -#endif -#endif -#endif -#if PSZ == 24 - xBase = pDrawable->x; - addr += WIDTH_MUL(pDrawable->y,nwidth); -#else - addr = addr + WIDTH_MUL(pDrawable->y,nwidth) + pDrawable->x; -#endif -#ifdef POLYSEGMENT - capStyle = pGC->capStyle - CapNotLast; - ppt = (int *) pSegInit; - while (nseg--) -#else /* POLYSEGMENT */ -#ifdef EITHER_MODE - mode -= CoordModePrevious; - if (!mode) -#endif /* EITHER_MODE */ -#ifndef ORIGIN - { /* CoordModePrevious */ - ppt = (int *)pptInit + 1; - _x1 = *x1p; - _y1 = *y1p; - extents_x1 = extents->x1 - pDrawable->x; - extents_x2 = extents->x2 - pDrawable->x; - extents_y1 = extents->y1 - pDrawable->y; - extents_y2 = extents->y2 - pDrawable->y; - if (_x1 < extents_x1 || _x1 >= extents_x2 || - _y1 < extents_y1 || _y1 >= extents_y2) - { - c2 = *ppt++; - intToCoord(c2, _x2, _y2); - *x2p = _x1 + _x2; - *y2p = _y1 + _y2; - return 1; - } -#if PSZ == 24 - addrLineEnd = addr + WIDTH_MUL(_y1, nwidth); - xOffset = xBase + _x1; - addrb = (char *)addrLineEnd + xOffset * 3; - addrp = (PixelType *)((unsigned long)addrb & ~0x03); -#else - addrp = addr + WIDTH_MUL(_y1, nwidth) + _x1; -#endif - _x2 = _x1; - _y2 = _y1; - } -#endif /* !ORIGIN */ -#ifdef EITHER_MODE - else -#endif /* EITHER_MODE */ -#ifndef PREVIOUS - { - ppt = (int *) pptInit; - c2 = *ppt++; - if (isClipped (c2, upperleft, lowerright)) - { - return 1; - } -#ifdef SAVE_X2Y2 - intToCoord(c2,x2,y2); -#endif -#if PSZ == 24 - addrLineEnd = addr + WIDTH_MUL(Y2, nwidth); - xOffset = xBase + X2; - addrb = (char *)addrLineEnd + xOffset * 3; - addrp = (PixelType *)((unsigned long)addrb & ~0x03); -#else - addrp = addr + WIDTH_MUL(Y2, nwidth) + X2; -#endif - } -#endif /* !PREVIOUS */ - while (--npt) -#endif /* POLYSEGMENT */ - { -#ifdef POLYSEGMENT - y1_or_e1 = ppt[0]; - c2 = ppt[1]; - ppt += 2; - if (isClipped(y1_or_e1,upperleft,lowerright)|isClipped(c2,upperleft,lowerright)) - break; - intToCoord(y1_or_e1,x1_or_len,y1_or_e1); - /* compute now to avoid needing x1, y1 later */ -#if PSZ == 24 - addrLineEnd = addr + WIDTH_MUL(y1_or_e1, nwidth); - xOffset = xBase + x1_or_len; - addrb = (char *)addrLineEnd + xOffset * 3; - addrp = (PixelType *)((unsigned long)addrb & ~0x03); -#else - addrp = addr + WIDTH_MUL(y1_or_e1, nwidth) + x1_or_len; -#endif -#else /* !POLYSEGMENT */ -#ifdef EITHER_MODE - if (!mode) -#endif /* EITHER_MODE */ -#ifndef ORIGIN - { - /* CoordModePrevious */ - _x1 = _x2; - _y1 = _y2; - c2 = *ppt++; - intToCoord(c2, _x2, _y2); - _x2 = _x1 + _x2; - _y2 = _y1 + _y2; - -#ifdef BUGFIX_clip - if (_x2 < ex_x1 || _x2 >= ex_x2 || - _y2 < ex_y1 || _y2 >= ex_y2) -#else - if (_x2 < extents_x1 || _x2 >= extents_x2 || - _y2 < extents_y1 || _y2 >= extents_y2) -#endif - { - break; - } - CalcLineDeltas(_x1, _y1, _x2, _y2, x1_or_len, y1_or_e1, - stepmajor, stepminor, 1, NWIDTH(nwidth), octant); - } -#endif /* !ORIGIN */ -#ifdef EITHER_MODE - else -#endif /* EITHER_MODE */ -#ifndef PREVIOUS - { -#ifndef SAVE_X2Y2 - y1_or_e1 = c2; -#else - y1_or_e1 = y2; - x1_or_len = x2; -#endif /* SAVE_X2Y2 */ - c2 = *ppt++; - - if (isClipped (c2, upperleft, lowerright)) - break; -#ifdef SAVE_X2Y2 - intToCoord(c2,x2,y2); -#endif - CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1, - stepmajor, stepminor, 1, NWIDTH(nwidth), octant); - } -#endif /* !PREVIOUS */ -#endif /* POLYSEGMENT */ - -#ifdef POLYSEGMENT - CalcLineDeltas(X1, Y1, X2, Y2, x1_or_len, y1_or_e1, - stepmajor, stepminor, 1, NWIDTH(nwidth), octant); - /* - * although the horizontal code works for polyline, it - * slows down 10 pixel lines by 15%. Thus, this - * code is optimized for horizontal segments and - * random orientation lines, which seems like a reasonable - * assumption - */ - if (y1_or_e1 != 0) - { -#endif /* POLYSEGMENT */ - if (x1_or_len < y1_or_e1) - { -#ifdef REARRANGE - register int e3; -#endif - - e3 = x1_or_len; - x1_or_len = y1_or_e1; - y1_or_e1 = e3; - - e3 = stepminor; - stepminor = stepmajor; - stepmajor = e3; - SetYMajorOctant(octant); - } - - e = -x1_or_len; -#ifdef POLYSEGMENT - if (!capStyle) - x1_or_len--; -#endif - - { -#ifdef REARRANGE - register int e3; - RROP_DECLARE - RROP_FETCH_GCPRIV(devPriv); -#endif - - y1_or_e1 = y1_or_e1 << 1; - e3 = e << 1; - - FIXUP_ERROR(e, octant, bias); - -#if PSZ == 24 - if (stepmajor == 1 || stepmajor == -1){ - stepmajor3 = stepmajor * 3; - stepminor3 = stepminor * sizeof (CfbBits); - majordx = stepmajor; minordx = 0; - } else { - stepmajor3 = stepmajor * sizeof (CfbBits); - stepminor3 = stepminor * 3; - majordx = 0; minordx = stepminor; - } -#endif - -#if PSZ == 24 -#define body {\ - body_rop \ - addrb += stepmajor3; \ - xOffset += majordx; \ - e += y1_or_e1; \ - if (e >= 0){ \ - addrb += stepminor3; \ - xOffset += minordx; \ - e += e3; \ - } \ - } -#else /* PSZ == 24 */ - -#define body {\ - RROP_SOLID(addrp); \ - addrp += stepmajor; \ - e += y1_or_e1; \ - if (e >= 0) \ - { \ - addrp += stepminor; \ - e += e3; \ - } \ - } -#endif /* PSZ == 24 */ - -#ifdef LARGE_INSTRUCTION_CACHE - -# ifdef SERIOUS_UNROLLING -# define UNROLL 16 -# else -# define UNROLL 4 -# endif -#define CASE(n) case -n: body - - while ((x1_or_len -= UNROLL) >= 0) - { - body body body body -# if UNROLL >= 8 - body body body body -# endif -# if UNROLL >= 12 - body body body body -# endif -# if UNROLL >= 16 - body body body body -# endif - } - switch (x1_or_len) - { - CASE(1) CASE(2) CASE(3) -# if UNROLL >= 8 - CASE(4) CASE(5) CASE(6) CASE(7) -# endif -# if UNROLL >= 12 - CASE(8) CASE(9) CASE(10) CASE(11) -# endif -# if UNROLL >= 16 - CASE(12) CASE(13) CASE(14) CASE(15) -# endif - } -#else /* !LARGE_INSTRUCTION_CACHE */ - - IMPORTANT_START - IMPORTANT_START - - if (x1_or_len & 1) - body - x1_or_len >>= 1; - while (x1_or_len--) { - body body - } - - IMPORTANT_END - IMPORTANT_END -#endif /* LARGE_INSTRUCTION_CACHE */ - -#ifdef POLYSEGMENT -#if PSZ == 24 - body_rop -#else - RROP_SOLID(addrp); -#endif -#endif -#if PSZ == 24 - addrp = (PixelType *)((unsigned long)addrb & ~0x03); -#endif - } -#undef body -#ifdef POLYSEGMENT - } - else /* Polysegment horizontal line optimization */ - { -# ifdef REARRANGE - register int e3; - RROP_DECLARE - RROP_FETCH_GCPRIV(devPriv); -# endif /* REARRANGE */ - if (stepmajor < 0) - { -#if PSZ == 24 - xOffset -= x1_or_len; - addrp = addrLineEnd + PXL2ADR(xOffset); -#else - addrp -= x1_or_len; -#endif - if (capStyle) - x1_or_len++; - else -#if PSZ == 24 - xOffset++; - addrp = addrLineEnd + PXL2ADR(xOffset); -#else - addrp++; -#endif - } - else - { -#if PSZ == 24 - addrp = addrLineEnd + PXL2ADR(xOffset); -#endif - if (capStyle) - x1_or_len++; - } -# if PSZ == 24 - y1_or_e1 = xOffset & 3; -# else -# if PGSZ == 64 /* PIM value from is not it! (for 16/32 PSZ)*/ - y1_or_e1 = ((long) addrp) & 0x7; - addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1); -# else - y1_or_e1 = ((long) addrp) & PIM; - addrp = (PixelType *) (((unsigned char *) addrp) - y1_or_e1); -# endif -#if PGSZ == 32 -# if PWSH != 2 - y1_or_e1 >>= (2 - PWSH); -# endif -#else /* PGSZ == 64 */ -# if PWSH != 3 - y1_or_e1 >>= (3 - PWSH); -# endif -#endif /* PGSZ */ -# endif /* PSZ == 24 */ -#if PSZ == 24 - { -#if RROP == GXcopy - register int nlmiddle; - int leftIndex = xOffset & 3; - int rightIndex = (xOffset + x1_or_len) & 3; -#else - register int pidx; -#endif - -#if RROP == GXcopy - nlmiddle = x1_or_len; - if(leftIndex){ - nlmiddle -= (4 - leftIndex); - } - if(rightIndex){ - nlmiddle -= rightIndex; - } - - nlmiddle >>= 2; - switch(leftIndex+x1_or_len){ - case 4: - switch(leftIndex){ - case 0: - *addrp++ = piQxelXor[0]; - *addrp++ = piQxelXor[1]; - *addrp = piQxelXor[2]; - break; - case 1: - *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - addrp++; - *addrp = piQxelXor[1]; - addrp++; - *addrp = piQxelXor[2]; - break; - case 2: - *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - addrp++; - *addrp = piQxelXor[2]; - break; - case 3: - *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); - break; - } - break; - case 3: - switch(leftIndex){ - case 0: - *addrp++ = piQxelXor[0]; - *addrp++ = piQxelXor[1]; - *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - break; - case 1: - *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - addrp++; - *addrp = piQxelXor[1]; - addrp++; - *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - break; - case 2: - *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - addrp++; - *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - break; - } - break; - case 2: - switch(leftIndex){ -/* - case 2: - *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - addrp++; - *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - break; -*/ - case 1: - *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - addrp++; - *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - break; - case 0: - *addrp++ = piQxelXor[0]; - *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - break; - } - break; - case 1: /*only if leftIndex = 0 and w = 1*/ - if(x1_or_len){ - *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); - } -/* - else{ - *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - addrp++; - *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - } -*/ - break; - case 0: /*never*/ - break; - default: - { -/* - maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) -*/ - switch(leftIndex){ - case 0: - break; - case 1: - *addrp = ((*addrp) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - addrp++; - *addrp = piQxelXor[1]; - addrp++; - *addrp = piQxelXor[2]; - addrp++; - break; - case 2: - *addrp = ((*addrp) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - addrp++; - *addrp = piQxelXor[2]; - addrp++; - break; - case 3: - *addrp = ((*addrp) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); - addrp++; - break; - } - while(nlmiddle--){ - *addrp++ = piQxelXor[0]; - *addrp++ = piQxelXor[1]; - *addrp++ = piQxelXor[2]; - } - switch(rightIndex++){ - case 0: - break; - case 1: - *addrp = ((*addrp) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); - break; - case 2: - *addrp++ = piQxelXor[0]; - *addrp = ((*addrp) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - break; - case 3: - *addrp++ = piQxelXor[0]; - *addrp++ = piQxelXor[1]; - *addrp = ((*addrp) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - break; - } -/* - if (e3){ - e3 &= 0xFFFFFF; - switch(rightIndex&3){ - case 0: - *addrp = ((*addrp) & (0xFF000000 | ~e3)) - | (piQxelXor[0] & 0xFFFFFF & e3); - break; - case 1: - *addrp = ((*addrp) & (0xFFFFFF | ~(e3<<24))) - + (piQxelXor[0] & 0xFF000000 & (e3<<24)); - addrp++; - *addrp = ((*addrp) & (0xFFFF0000|~(e3 >> 8))) - | (piQxelXor[1] & 0xFFFF & (e3 >> 8)); - break; - case 2: - *addrp = ((*addrp) & (0xFFFF|~(e3 << 16))) - | (piQxelXor[1] & 0xFFFF0000 & (e3 << 16)); - addrp++; - *addrp = ((*addrp) & (0xFFFFFF00|~(e3>>16))) - | (piQxelXor[2] & 0xFF & (e3 >> 16)); - break; - case 3: - *addrp = ((*addrp) & (0xFF|~(e3<<8))) - | (piQxelXor[2] & 0xFFFFFF00 & (e3<<8)); - addrp++; - break; - } - } -*/ - } - } -#else /* GXcopy */ - addrp = (PixelType *)((char *)addrLineEnd + ((xOffset * 3) & ~0x03)); - if (x1_or_len <= 1){ - if (x1_or_len) - RROP_SOLID24(addrp, xOffset); - } else { - maskbits(xOffset, x1_or_len, e, e3, x1_or_len); - pidx = xOffset & 3; - if (e){ - RROP_SOLID_MASK(addrp, e, pidx-1); - addrp++; - if (pidx == 3) - pidx = 0; - } - while (--x1_or_len >= 0){ - RROP_SOLID(addrp, pidx); - addrp++; - if (++pidx == 3) - pidx = 0; - } - if (e3) - RROP_SOLID_MASK(addrp, e3, pidx); - } -#endif /* GXcopy */ - } -#else /* PSZ == 24 */ - if (y1_or_e1 + x1_or_len <= PPW) - { - if (x1_or_len) - { - maskpartialbits(y1_or_e1, x1_or_len, e) - RROP_SOLID_MASK((CfbBits *) addrp, e); - } - } - else - { - maskbits(y1_or_e1, x1_or_len, e, e3, x1_or_len) - if (e) - { - RROP_SOLID_MASK((CfbBits *) addrp, e); - addrp += PPW; - } - RROP_SPAN(addrp, x1_or_len) - if (e3) - RROP_SOLID_MASK((CfbBits *) addrp, e3); - } -#endif /* PSZ == 24 */ - } -#endif /* POLYSEGMENT */ - } -#ifdef POLYSEGMENT - if (nseg >= 0) - return (xSegment *) ppt - pSegInit; -#else - if (npt) - { -#ifdef EITHER_MODE - if (!mode) -#endif /* EITHER_MODE */ -#ifndef ORIGIN - { - *x1p = _x1; - *y1p = _y1; - *x2p = _x2; - *y2p = _y2; - } -#endif /* !ORIGIN */ - return ((DDXPointPtr) ppt - pptInit) - 1; - } - -# ifndef ORIGIN -# define C2 c2 -# else -# define C2 ppt[-1] -# endif -#ifdef EITHER_MODE - if (pGC->capStyle != CapNotLast && - ((mode ? (C2 != *((int *) pptInitOrig)) - : ((_x2 != pptInitOrig->x) || - (_y2 != pptInitOrig->y))) - || (ppt == ((int *)pptInitOrig) + 2))) -#endif /* EITHER_MODE */ -#ifdef PREVIOUS - if (pGC->capStyle != CapNotLast && - ((_x2 != pptInitOrig->x) || - (_y2 != pptInitOrig->y) || - (ppt == ((int *)pptInitOrig) + 2))) -#endif /* PREVIOUS */ -#ifdef ORIGIN - if (pGC->capStyle != CapNotLast && - ((C2 != *((int *) pptInitOrig)) || - (ppt == ((int *)pptInitOrig) + 2))) -#endif /* !PREVIOUS */ - { -# ifdef REARRANGE - RROP_DECLARE - - RROP_FETCH_GCPRIV(devPriv); -# endif -#if PSZ == 24 -#if RROP == GXcopy - switch(xOffset & 3){ - case 0: - *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); - break; - case 3: - *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); - break; - case 1: - *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); - *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); - break; - case 2: - *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); - *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); - break; - } -#endif -#if RROP == GXxor - switch(xOffset & 3){ - case 0: - *addrp ^= (piQxelXor[0] & 0xFFFFFF); - break; - case 3: - *addrp ^= (piQxelXor[2] & 0xFFFFFF00); - break; - case 1: - *addrp ^= (piQxelXor[0] & 0xFF000000); - *(addrp+1) ^= (piQxelXor[1] & 0xFFFF); - break; - case 2: - *addrp ^= (piQxelXor[1] & 0xFFFF0000); - *(addrp+1) ^= (piQxelXor[2] & 0xFF); - break; - } -#endif -#if RROP == GXand - switch(xOffset & 3){ - case 0: - *addrp &= (piQxelAnd[0] | 0xFF000000); - break; - case 3: - *addrp &= (piQxelAnd[2] | 0xFF); - break; - case 1: - *addrp &= (0xFFFFFF|piQxelAnd[0]); - *(addrp+1) &= (0xFFFF0000|piQxelAnd[1]); - break; - case 2: - *addrp &= (0xFFFF|piQxelAnd[1]); - *(addrp+1) &= (0xFFFFFF00|piQxelAnd[2]); - break; - } -#endif -#if RROP == GXor - switch(xOffset & 3){ - case 0: - *addrp |= (piQxelOr[0] & 0xFFFFFF); - break; - case 3: - *addrp |= (piQxelOr[2] & 0xFFFFFF00); - break; - case 1: - *addrp |= (piQxelOr[0] & 0xFF000000); - *(addrp+1) |= (piQxelOr[1] & 0xFFFF); - break; - case 2: - *addrp |= (piQxelOr[1] & 0xFFFF0000); - *(addrp+1) |= (piQxelOr[2] & 0xFF); - break; - } -#endif -#if RROP == GXset - switch(xOffset & 3){ - case 0: - *addrp = (((*addrp)&(piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); - break; - case 3: - *addrp = (((*addrp)&(piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); - break; - case 1: - *addrp = (((*addrp)&(piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); - *(addrp+1) = (((*(addrp+1))&(piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); - break; - case 2: - *addrp = (((*addrp)&(piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); - *(addrp+1) = (((*(addrp+1))&(piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); - break; - } -#endif -#else - RROP_SOLID (addrp); -# endif - } -#endif /* !POLYSEGMENT */ - RROP_UNDECLARE; - return -1; -} - -#endif /* INCLUDE_DRAW */ - - -#ifdef INCLUDE_OTHERS - -#ifdef POLYSEGMENT - -void -cfb8SegmentSS1Rect (pDrawable, pGC, nseg, pSegInit) - DrawablePtr pDrawable; - GCPtr pGC; - int nseg; - xSegment *pSegInit; -{ - int (*func)(DrawablePtr, GCPtr, int, xSegment *); - void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool); - int drawn; - cfbPrivGCPtr devPriv; - -#if defined(__arm32__) && PSZ != 8 - /* XXX -JJK */ - /* There is a painting bug when PSZ != 8; I need to track it down! */ - cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); - return; -#endif - - devPriv = cfbGetGCPrivate(pGC); -#ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) - { - cfbSegmentSS(pDrawable, pGC, nseg, pSegInit); - return; - } -#endif - switch (devPriv->rop) - { - case GXcopy: - func = cfb8SegmentSS1RectCopy; - clip = cfb8ClippedLineCopy; -#ifdef FAST_MUL - if (cfbGetPixelWidth (pDrawable) == WIDTH_FAST) - func = cfb8SegmentSS1RectShiftCopy; -#endif - break; - case GXxor: - func = cfb8SegmentSS1RectXor; - clip = cfb8ClippedLineXor; - break; - default: - func = cfb8SegmentSS1RectGeneral; - clip = cfb8ClippedLineGeneral; - break; - } - while (nseg) - { - drawn = (*func) (pDrawable, pGC, nseg, pSegInit); - if (drawn == -1) - break; - (*clip) (pDrawable, pGC, - pSegInit[drawn-1].x1, pSegInit[drawn-1].y1, - pSegInit[drawn-1].x2, pSegInit[drawn-1].y2, - &pGC->pCompositeClip->extents, - pGC->capStyle == CapNotLast); - pSegInit += drawn; - nseg -= drawn; - } -} - -#else /* POLYSEGMENT */ - -void -cfb8LineSS1Rect (pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; - int npt; - DDXPointPtr pptInit; -{ - int (*func)(DrawablePtr, GCPtr, int, int, - DDXPointPtr, DDXPointPtr, - int *, int *, int *, int *); - void (*clip)(DrawablePtr, GCPtr, int, int, int, int, BoxPtr, Bool); - int drawn; - cfbPrivGCPtr devPriv; - int x1, y1, x2, y2; - DDXPointPtr pptInitOrig = pptInit; - -#if defined(__arm32__) && PSZ != 8 - /* XXX -JJK */ - /* There is a painting bug when PSZ != 8; I need to track it down! */ - cfbLineSS(pDrawable, pGC, mode, npt, pptInit); - return; -#endif - - devPriv = cfbGetGCPrivate(pGC); -#ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) - { - cfbLineSS(pDrawable, pGC, mode, npt, pptInit); - return; - } -#endif - switch (devPriv->rop) - { - case GXcopy: - func = cfb8LineSS1RectCopy; - clip = cfb8ClippedLineCopy; - if (mode == CoordModePrevious) - func = cfb8LineSS1RectPreviousCopy; - break; - case GXxor: - func = cfb8LineSS1RectXor; - clip = cfb8ClippedLineXor; - break; - default: - func = cfb8LineSS1RectGeneral; - clip = cfb8ClippedLineGeneral; - break; - } - if (mode == CoordModePrevious) - { - x1 = pptInit->x; - y1 = pptInit->y; - while (npt > 1) - { - drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, - &x1, &y1, &x2, &y2); - if (drawn == -1) - break; - (*clip) (pDrawable, pGC, x1, y1, x2, y2, - &pGC->pCompositeClip->extents, - drawn != npt - 1 || pGC->capStyle == CapNotLast); - pptInit += drawn; - npt -= drawn; - x1 = x2; - y1 = y2; - } - } - else - { - while (npt > 1) - { - drawn = (*func) (pDrawable, pGC, mode, npt, pptInit, pptInitOrig, - &x1, &y1, &x2, &y2); - if (drawn == -1) - break; - (*clip) (pDrawable, pGC, - pptInit[drawn-1].x, pptInit[drawn-1].y, - pptInit[drawn].x, pptInit[drawn].y, - &pGC->pCompositeClip->extents, - drawn != npt - 1 || pGC->capStyle == CapNotLast); - pptInit += drawn; - npt -= drawn; - } - } -} - -#endif /* else POLYSEGMENT */ -#endif /* INCLUDE_OTHERS */ - -#if !defined(POLYSEGMENT) && !defined (PREVIOUS) - -void -RROP_NAME (cfb8ClippedLine) (pDrawable, pGC, x1, y1, x2, y2, boxp, shorten) - DrawablePtr pDrawable; - GCPtr pGC; - int x1, y1, x2, y2; - BoxPtr boxp; - Bool shorten; -{ - int oc1, oc2; - int e, e1, e3, len; - int adx, ady; - - PixelType *addr; - int nwidth; - int stepx, stepy; - int xorg, yorg; - int new_x1, new_y1, new_x2, new_y2; - Bool pt1_clipped, pt2_clipped; - int changex, changey, result; -#if PSZ == 24 - PixelType *addrLineEnd; - char *addrb; - int stepx3, stepy3; -#endif - int octant; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - - cfbGetPixelWidthAndPointer(pDrawable, nwidth, addr); - - xorg = pDrawable->x; - yorg = pDrawable->y; - x1 += xorg; - y1 += yorg; - x2 += xorg; - y2 += yorg; - oc1 = 0; - oc2 = 0; - OUTCODES (oc1, x1, y1, boxp); - OUTCODES (oc2, x2, y2, boxp); - - if (oc1 & oc2) - return; - - CalcLineDeltas(x1, y1, x2, y2, adx, ady, stepx, stepy, 1, nwidth, octant); - - if (adx <= ady) - { - int t; - - t = adx; - adx = ady; - ady = t; - - t = stepx; - stepx = stepy; - stepy = t; - - SetYMajorOctant(octant); - } - e = - adx; - e1 = ady << 1; - e3 = - (adx << 1); - - FIXUP_ERROR(e, octant, bias); - - new_x1 = x1; - new_y1 = y1; - new_x2 = x2; - new_y2 = y2; - pt1_clipped = 0; - pt2_clipped = 0; - - if (IsXMajorOctant(octant)) - { - result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, - &pt1_clipped, &pt2_clipped, - octant, bias, oc1, oc2); - if (result == -1) - return; - - len = abs(new_x2 - new_x1) - 1; /* this routine needs the "-1" */ - - /* if we've clipped the endpoint, always draw the full length - * of the segment, because then the capstyle doesn't matter - * if x2,y2 isn't clipped, use the capstyle - * (shorten == TRUE <--> CapNotLast) - */ - if (pt2_clipped || !shorten) - len++; - - if (pt1_clipped) - { - /* must calculate new error terms */ - changex = abs(new_x1 - x1); - changey = abs(new_y1 - y1); - e = e + changey * e3 + changex * e1; - } - } - else /* Y_AXIS */ - { - result = miZeroClipLine(boxp->x1, boxp->y1, boxp->x2 - 1, boxp->y2 - 1, - &new_x1, &new_y1, &new_x2, &new_y2, - ady, adx, - &pt1_clipped, &pt2_clipped, - octant, bias, oc1, oc2); - if (result == -1) - return; - - len = abs(new_y2 - new_y1) - 1; /* this routine needs the "-1" */ - - /* if we've clipped the endpoint, always draw the full length - * of the segment, because then the capstyle doesn't matter - * if x2,y2 isn't clipped, use the capstyle - * (shorten == TRUE <--> CapNotLast) - */ - if (pt2_clipped || !shorten) - len++; - - if (pt1_clipped) - { - /* must calculate new error terms */ - changex = abs(new_x1 - x1); - changey = abs(new_y1 - y1); - e = e + changex * e3 + changey * e1; - } - } - x1 = new_x1; - y1 = new_y1; - { - register PixelType *addrp; - RROP_DECLARE - - RROP_FETCH_GC(pGC); - -#if PSZ == 24 - addrLineEnd = addr + (y1 * nwidth); - addrb = (char *)addrLineEnd + x1 * 3; - if (stepx == 1 || stepx == -1){ - stepx3 = stepx * 3; - stepy3 = stepy * sizeof (CfbBits); - } else { - stepx3 = stepx * sizeof (CfbBits); - stepy3 = stepy * 3; - } -#else - addrp = addr + (y1 * nwidth) + x1; -#endif - -#ifndef REARRANGE - if (!ady) - { -#if PSZ == 24 -#define body {\ - body_rop \ - addrb += stepx3; \ - } -#else -#define body { RROP_SOLID(addrp); addrp += stepx; } -#endif - while (len >= PGSZB) - { - body body body body -#if PGSZ == 64 - body body body body -#endif - len -= PGSZB; - } - switch (len) - { -#if PGSZ == 64 - case 7: body case 6: body case 5: body case 4: body -#endif - case 3: body case 2: body case 1: body - } -#undef body - } - else -#endif /* !REARRANGE */ - { -#if PSZ == 24 -#define body {\ - body_rop \ - addrb += stepx3; \ - e += e1; \ - if (e >= 0) \ - { \ - addrb += stepy3; \ - e += e3; \ - } \ - } -#else -#define body {\ - RROP_SOLID(addrp); \ - addrp += stepx; \ - e += e1; \ - if (e >= 0) \ - { \ - addrp += stepy; \ - e += e3; \ - } \ - } -#endif - -#ifdef LARGE_INSTRUCTION_CACHE - while ((len -= PGSZB) >= 0) - { - body body body body -#if PGSZ == 64 - body body body body -#endif - } - switch (len) - { - case -1: body case -2: body case -3: body -#if PGSZ == 64 - case -4: body case -5: body case -6: body case -7: body -#endif - } -#else /* !LARGE_INSTRUCTION_CACHE */ - IMPORTANT_START; - - while ((len -= 2) >= 0) - { - body body; - } - if (len & 1) - body; - - IMPORTANT_END; -#endif /* LARGE_INSTRUCTION_CACHE */ - } -#if PSZ == 24 - body_rop -#else - RROP_SOLID(addrp); -#endif -#undef body - RROP_UNDECLARE - } -} - -#endif /* !POLYSEGMENT && !PREVIOUS */ -#endif /* PIXEL_ADDR */ diff --git a/cfb/cfballpriv.c b/cfb/cfballpriv.c deleted file mode 100644 index 3b58266c5..000000000 --- a/cfb/cfballpriv.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "resource.h" -#include "colormap.h" -#include "colormapst.h" -#include "cfb.h" -#include "mi.h" -#include "mistruct.h" -#include "dix.h" -#include "cfbmskbits.h" -#include "mibstore.h" - -#if 1 || PSZ==8 -DevPrivateKey cfbGCPrivateKey = &cfbGCPrivateKey; -#endif -#ifdef CFB_NEED_SCREEN_PRIVATE -DevPrivateKey cfbScreenPrivateKey = &cfbScreenPrivateKey; -#endif - - -Bool -cfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *gc_key) -{ - if (!gc_key || !*gc_key) - { - if (!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey)) - return FALSE; - if (gc_key) - *gc_key = cfbGCPrivateKey; - } - else - { - cfbGCPrivateKey = *gc_key; - } - return dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)); -} diff --git a/cfb/cfbbitblt.c b/cfb/cfbbitblt.c deleted file mode 100644 index 00bf41367..000000000 --- a/cfb/cfbbitblt.c +++ /dev/null @@ -1,1455 +0,0 @@ -/* - * cfb copy area - */ - - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Keith Packard - -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "mi.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" -#include "fastblt.h" -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -#if PSZ == 8 -#define cfbCopyPlane1toN cfbCopyPlane1to8 -#define cfbCopyPlaneNto1 cfbCopyPlane8to1 -#else -static unsigned int FgPixel, BgPixel; -# if PSZ == 16 -#define cfbCopyPlane1toN cfbCopyPlane1to16 -#define cfbCopyPlaneNto1 cfbCopyPlane16to1 -# endif -# if PSZ == 24 -#define cfbCopyPlane1toN cfbCopyPlane1to24 -#define cfbCopyPlaneNto1 cfbCopyPlane24to1 -# endif -# if PSZ == 32 -#define cfbCopyPlane1toN cfbCopyPlane1to32 -#define cfbCopyPlaneNto1 cfbCopyPlane32to1 -# endif -#endif - -/* cfbBitBltcfb == cfbCopyPlaneExpand */ -RegionPtr -cfbBitBlt ( - register DrawablePtr pSrcDrawable, - register DrawablePtr pDstDrawable, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - void (*doBitBlt)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/), - unsigned long bitPlane) -{ - RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ - Bool freeSrcClip = FALSE; - - RegionPtr prgnExposed; - RegionRec rgnDst; - DDXPointPtr pptSrc; - register DDXPointPtr ppt; - register BoxPtr pbox; - int i; - register int dx; - register int dy; - xRectangle origSource; - DDXPointRec origDest; - int numRects; - BoxRec fastBox; - int fastClip = 0; /* for fast clipping with pixmap source */ - int fastExpose = 0; /* for fast exposures with pixmap source */ - - origSource.x = srcx; - origSource.y = srcy; - origSource.width = width; - origSource.height = height; - origDest.x = dstx; - origDest.y = dsty; - - if ((pSrcDrawable != pDstDrawable) && - pSrcDrawable->pScreen->SourceValidate) - { - (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height); - } - - srcx += pSrcDrawable->x; - srcy += pSrcDrawable->y; - - /* clip the source */ - - if (pSrcDrawable->type == DRAWABLE_PIXMAP) - { - if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) - { - prgnSrcClip = cfbGetCompositeClip(pGC); - } - else - { - fastClip = 1; - } - } - else - { - if (pGC->subWindowMode == IncludeInferiors) - { - /* - * XFree86 DDX empties the border clip when the - * VT is inactive - */ - if (!((WindowPtr) pSrcDrawable)->parent && - REGION_NOTEMPTY (pSrcDrawable->pScreen, - &((WindowPtr) pSrcDrawable)->borderClip)) - { - /* - * special case bitblt from root window in - * IncludeInferiors mode; just like from a pixmap - */ - fastClip = 1; - } - else if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) - { - prgnSrcClip = cfbGetCompositeClip(pGC); - } - else - { - prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); - freeSrcClip = TRUE; - } - } - else - { - prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; - } - } - - fastBox.x1 = srcx; - fastBox.y1 = srcy; - fastBox.x2 = srcx + width; - fastBox.y2 = srcy + height; - - /* Don't create a source region if we are doing a fast clip */ - if (fastClip) - { - fastExpose = 1; - /* - * clip the source; if regions extend beyond the source size, - * make sure exposure events get sent - */ - if (fastBox.x1 < pSrcDrawable->x) - { - fastBox.x1 = pSrcDrawable->x; - fastExpose = 0; - } - if (fastBox.y1 < pSrcDrawable->y) - { - fastBox.y1 = pSrcDrawable->y; - fastExpose = 0; - } - if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) - { - fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; - fastExpose = 0; - } - if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) - { - fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; - fastExpose = 0; - } - } - else - { - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); - } - - dstx += pDstDrawable->x; - dsty += pDstDrawable->y; - - if (pDstDrawable->type == DRAWABLE_WINDOW) - { - if (!((WindowPtr)pDstDrawable)->realized) - { - if (!fastClip) - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return NULL; - } - } - - dx = srcx - dstx; - dy = srcy - dsty; - - /* Translate and clip the dst to the destination composite clip */ - if (fastClip) - { - RegionPtr cclip; - - /* Translate the region directly */ - fastBox.x1 -= dx; - fastBox.x2 -= dx; - fastBox.y1 -= dy; - fastBox.y2 -= dy; - - /* If the destination composite clip is one rectangle we can - do the clip directly. Otherwise we have to create a full - blown region and call intersect */ - - /* XXX because CopyPlane uses this routine for 8-to-1 bit - * copies, this next line *must* also correctly fetch the - * composite clip from an mfb gc - */ - - cclip = cfbGetCompositeClip(pGC); - if (REGION_NUM_RECTS(cclip) == 1) - { - BoxPtr pBox = REGION_RECTS(cclip); - - if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; - if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; - if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; - if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; - - /* Check to see if the region is empty */ - if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) - { - REGION_NULL(pGC->pScreen, &rgnDst); - } - else - { - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - } - } - else - { - /* We must turn off fastClip now, since we must create - a full blown region. It is intersected with the - composite clip below. */ - fastClip = 0; - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1); - } - } - else - { - REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); - } - - if (!fastClip) - { - REGION_INTERSECT(pGC->pScreen, &rgnDst, - &rgnDst, - cfbGetCompositeClip(pGC)); - } - - /* Do bit blitting */ - numRects = REGION_NUM_RECTS(&rgnDst); - if (numRects && width && height) - { - if(!(pptSrc = (DDXPointPtr)xalloc(numRects * - sizeof(DDXPointRec)))) - { - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return NULL; - } - pbox = REGION_RECTS(&rgnDst); - ppt = pptSrc; - for (i = numRects; --i >= 0; pbox++, ppt++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask); - xfree(pptSrc); - } - - prgnExposed = NULL; - if (pGC->fExpose) - { - /* Pixmap sources generate a NoExposed (we return NULL to do this) */ - if (!fastExpose) - prgnExposed = - miHandleExposures(pSrcDrawable, pDstDrawable, pGC, - origSource.x, origSource.y, - (int)origSource.width, - (int)origSource.height, - origDest.x, origDest.y, bitPlane); - } - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return prgnExposed; -} - - -RegionPtr -cfbCopyPlaneReduce ( - register DrawablePtr pSrcDrawable, - register DrawablePtr pDstDrawable, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - void (*doCopyPlane)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/, - unsigned long /*bitPlane*/), - unsigned long bitPlane) -{ - RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */ - Bool freeSrcClip = FALSE; - - RegionPtr prgnExposed; - RegionRec rgnDst; - DDXPointPtr pptSrc; - register DDXPointPtr ppt; - register BoxPtr pbox; - int i; - register int dx; - register int dy; - xRectangle origSource; - DDXPointRec origDest; - int numRects; - BoxRec fastBox; - int fastClip = 0; /* for fast clipping with pixmap source */ - int fastExpose = 0; /* for fast exposures with pixmap source */ - - origSource.x = srcx; - origSource.y = srcy; - origSource.width = width; - origSource.height = height; - origDest.x = dstx; - origDest.y = dsty; - - if ((pSrcDrawable != pDstDrawable) && - pSrcDrawable->pScreen->SourceValidate) - { - (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, srcx, srcy, width, height); - } - - srcx += pSrcDrawable->x; - srcy += pSrcDrawable->y; - - /* clip the source */ - - if (pSrcDrawable->type == DRAWABLE_PIXMAP) - { - if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) - { - prgnSrcClip = cfbGetCompositeClip(pGC); - } - else - { - fastClip = 1; - } - } - else - { - if (pGC->subWindowMode == IncludeInferiors) - { - /* - * XFree86 DDX empties the border clip when the - * VT is inactive - */ - if (!((WindowPtr) pSrcDrawable)->parent && - REGION_NOTEMPTY (pSrcDrawable->pScreen, - &((WindowPtr) pSrcDrawable)->borderClip)) - { - /* - * special case bitblt from root window in - * IncludeInferiors mode; just like from a pixmap - */ - fastClip = 1; - } - else if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) - { - prgnSrcClip = cfbGetCompositeClip(pGC); - } - else - { - prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable); - freeSrcClip = TRUE; - } - } - else - { - prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList; - } - } - - fastBox.x1 = srcx; - fastBox.y1 = srcy; - fastBox.x2 = srcx + width; - fastBox.y2 = srcy + height; - - /* Don't create a source region if we are doing a fast clip */ - if (fastClip) - { - fastExpose = 1; - /* - * clip the source; if regions extend beyond the source size, - * make sure exposure events get sent - */ - if (fastBox.x1 < pSrcDrawable->x) - { - fastBox.x1 = pSrcDrawable->x; - fastExpose = 0; - } - if (fastBox.y1 < pSrcDrawable->y) - { - fastBox.y1 = pSrcDrawable->y; - fastExpose = 0; - } - if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) - { - fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width; - fastExpose = 0; - } - if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) - { - fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height; - fastExpose = 0; - } - } - else - { - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); - } - - dstx += pDstDrawable->x; - dsty += pDstDrawable->y; - - if (pDstDrawable->type == DRAWABLE_WINDOW) - { - if (!((WindowPtr)pDstDrawable)->realized) - { - if (!fastClip) - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return NULL; - } - } - - dx = srcx - dstx; - dy = srcy - dsty; - - /* Translate and clip the dst to the destination composite clip */ - if (fastClip) - { - RegionPtr cclip; - - /* Translate the region directly */ - fastBox.x1 -= dx; - fastBox.x2 -= dx; - fastBox.y1 -= dy; - fastBox.y2 -= dy; - - /* If the destination composite clip is one rectangle we can - do the clip directly. Otherwise we have to create a full - blown region and call intersect */ - - /* XXX because CopyPlane uses this routine for 8-to-1 bit - * copies, this next line *must* also correctly fetch the - * composite clip from an mfb gc - */ - - cclip = cfbGetCompositeClip(pGC); - if (REGION_NUM_RECTS(cclip) == 1) - { - BoxPtr pBox = REGION_RECTS(cclip); - - if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1; - if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2; - if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1; - if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2; - - /* Check to see if the region is empty */ - if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) - { - REGION_NULL(pGC->pScreen, &rgnDst); - } - else - { - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - } - } - else - { - /* We must turn off fastClip now, since we must create - a full blown region. It is intersected with the - composite clip below. */ - fastClip = 0; - REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1); - } - } - else - { - REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); - } - - if (!fastClip) - { - REGION_INTERSECT(pGC->pScreen, &rgnDst, - &rgnDst, - cfbGetCompositeClip(pGC)); - } - - /* Do bit blitting */ - numRects = REGION_NUM_RECTS(&rgnDst); - if (numRects && width && height) - { - if(!(pptSrc = (DDXPointPtr)xalloc(numRects * - sizeof(DDXPointRec)))) - { - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return NULL; - } - pbox = REGION_RECTS(&rgnDst); - ppt = pptSrc; - for (i = numRects; --i >= 0; pbox++, ppt++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - (*doCopyPlane) (pSrcDrawable, pDstDrawable, pGC->alu, &rgnDst, pptSrc, pGC->planemask, bitPlane); - xfree(pptSrc); - } - - prgnExposed = NULL; - if (pGC->fExpose) - { - /* Pixmap sources generate a NoExposed (we return NULL to do this) */ - if (!fastExpose) - prgnExposed = - miHandleExposures(pSrcDrawable, pDstDrawable, pGC, - origSource.x, origSource.y, - (int)origSource.width, - (int)origSource.height, - origDest.x, origDest.y, bitPlane); - } - REGION_UNINIT(pGC->pScreen, &rgnDst); - if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); - return prgnExposed; -} - - -void -cfbDoBitblt (pSrc, pDst, alu, prgnDst, pptSrc, planemask) - DrawablePtr pSrc, pDst; - int alu; - RegionPtr prgnDst; - DDXPointPtr pptSrc; - unsigned long planemask; -{ - void (*doBitBlt)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/) - = cfbDoBitbltGeneral; - - if ((planemask & PMSK) == PMSK) { - switch (alu) { - case GXcopy: - doBitBlt = cfbDoBitbltCopy; - break; - case GXxor: - doBitBlt = cfbDoBitbltXor; - break; - case GXor: - doBitBlt = cfbDoBitbltOr; - break; - } - } - (*doBitBlt) (pSrc, pDst, alu, prgnDst, pptSrc, planemask); -} - -RegionPtr -cfbCopyArea(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty) - register DrawablePtr pSrcDrawable; - register DrawablePtr pDstDrawable; - GC *pGC; - int srcx, srcy; - int width, height; - int dstx, dsty; -{ - void (*doBitBlt) ( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/); - - doBitBlt = cfbDoBitbltCopy; - if (pGC->alu != GXcopy || (pGC->planemask & PMSK) != PMSK) - { - doBitBlt = cfbDoBitbltGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - switch (pGC->alu) { - case GXxor: - doBitBlt = cfbDoBitbltXor; - break; - case GXor: - doBitBlt = cfbDoBitbltOr; - break; - } - } - } - return cfbBitBlt (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, doBitBlt, 0L); -} - -#if PSZ == 8 -void -cfbCopyPlane1to8 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, planemask) - DrawablePtr pSrcDrawable; /* must be a bitmap */ - DrawablePtr pDstDrawable; /* must be depth 8 drawable */ - int rop; /* not used; caller must call cfb8CheckOpaqueStipple - * beforehand to get cfb8StippleRRop set correctly */ - RegionPtr prgnDst; /* region in destination to draw to; - * screen relative coords. if dest is a window; - * drawable relative if dest is a pixmap */ - DDXPointPtr pptSrc; /* drawable relative src coords to copy from; - * must be one point for each box in prgnDst */ - unsigned long planemask; /* to apply to destination writes */ -{ - int srcx, srcy; /* upper left corner of box being copied in source */ - int dstx, dsty; /* upper left corner of box being copied in dest */ - int width, height; /* in pixels, unpadded, of box being copied */ - int xoffSrc; /* bit # in leftmost word of row from which copying starts */ - int xoffDst; /* byte # in leftmost word of row from which copying starts */ - CfbBits *psrcBase, *pdstBase; /* start of drawable's pixel data */ - int widthSrc; /* # of groups of 32 pixels (1 bit/pixel) in src bitmap*/ - int widthDst; /* # of groups of 4 pixels (8 bits/pixel) in dst */ - CfbBits *psrcLine, *pdstLine; /* steps a row at a time thru src/dst; - * may point into middle of row */ - register CfbBits *psrc, *pdst; /* steps within the row */ - register CfbBits bits, tmp; /* bits from source */ - register int leftShift; - register int rightShift; - CfbBits startmask; /* left edge pixel mask */ - CfbBits endmask; /* right edge pixel mask */ - register int nlMiddle; /* number of words in middle of the row to draw */ - register int nl; - int firstoff = 0; - int secondoff = 0; - CfbBits src; - int nbox; /* number of boxes in region to copy */ - BoxPtr pbox; /* steps thru boxes in region */ - int pixelsRemainingOnRightEdge; /* # pixels to be drawn on a row after - * the main "middle" loop */ - - cfbGetLongWidthAndPointer (pSrcDrawable, widthSrc, psrcBase) - cfbGetLongWidthAndPointer (pDstDrawable, widthDst, pdstBase) - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; - - psrcLine = psrcBase + srcy * widthSrc + (srcx >> MFB_PWSH); - pdstLine = pdstBase + dsty * widthDst + (dstx >> PWSH); - xoffSrc = srcx & MFB_PIM; /* finds starting bit in src */ - xoffDst = dstx & PIM; /* finds starting byte in dst */ - - /* compute startmask, endmask, nlMiddle */ - - if (xoffDst + width < PPW) /* XXX should this be '<= PPW' ? */ - { /* the copy only affects one word per row in destination */ - maskpartialbits(dstx, width, startmask); - endmask = 0; /* nothing on right edge */ - nlMiddle = 0; /* nothing in middle */ - } - else - { /* the copy will affect multiple words per row in destination */ - maskbits(dstx, width, startmask, endmask, nlMiddle); - } - - /* - * compute constants for the first four bits to be - * copied. This avoids troubles with partial first - * writes, and difficult shift computation - */ - if (startmask) - { - firstoff = xoffSrc - xoffDst; - if (firstoff > (MFB_PPW-PPW)) - secondoff = MFB_PPW - firstoff; - if (xoffDst) - { - srcx += (PPW-xoffDst); - xoffSrc = srcx & MFB_PIM; - } - } - leftShift = xoffSrc; - rightShift = MFB_PPW - leftShift; - - pixelsRemainingOnRightEdge = (nlMiddle & 7) * PPW + - ((dstx + width) & PIM); - - /* setup is done; now let's move some bits */ - - /* caller must call cfb8CheckOpaqueStipple before this function - * to set cfb8StippleRRop! - */ - - if (cfb8StippleRRop == GXcopy) - { - while (height--) - { /* one iteration of this loop copies one row */ - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - bits = *psrc++; - if (startmask) - { - if (firstoff < 0) - tmp = BitRight (bits, -firstoff); - else - { - tmp = BitLeft (bits, firstoff); - /* - * need a more cautious test for partialmask - * case... - */ - if (firstoff >= (MFB_PPW-PPW)) - { - bits = *psrc++; - if (firstoff != (MFB_PPW-PPW)) - tmp |= BitRight (bits, secondoff); - } - } - *pdst = (*pdst & ~startmask) | (GetPixelGroup(tmp) & startmask); - pdst++; - } - nl = nlMiddle; - while (nl >= 8) - { - nl -= 8; - tmp = BitLeft(bits, leftShift); - bits = *psrc++; - if (rightShift != MFB_PPW) - tmp |= BitRight(bits, rightShift); - -#ifdef FAST_CONSTANT_OFFSET_MODE -# define StorePixels(pdst,o,pixels) (pdst)[o] = (pixels) -# define EndStep(pdst,o) (pdst) += (o) -# define StoreRopPixels(pdst,o,and,xor) (pdst)[o] = DoRRop((pdst)[o],and,xor); -#else -# define StorePixels(pdst,o,pixels) *(pdst)++ = (pixels) -# define EndStep(pdst,o) -# define StoreRopPixels(pdst,o,and,xor) *(pdst) = DoRRop(*(pdst),and,xor); (pdst)++; -#endif - -#define Step(c) NextBitGroup(c); -#define StoreBitsPlain(o,c) StorePixels(pdst,o,GetPixelGroup(c)) -#define StoreRopBitsPlain(o,c) StoreRopPixels(pdst,o,\ - cfb8StippleAnd[GetBitGroup(c)], \ - cfb8StippleXor[GetBitGroup(c)]) -#define StoreBits0(c) StoreBitsPlain(0,c) -#define StoreRopBits0(c) StoreRopBitsPlain(0,c) - -#if (BITMAP_BIT_ORDER == MSBFirst) -# define StoreBits(o,c) StoreBitsPlain(o,c) -# define StoreRopBits(o,c) StoreRopBitsPlain(o,c) -# define FirstStep(c) Step(c) -#else /* BITMAP_BIT_ORDER == LSBFirst */ -#if PGSZ == 64 -# define StoreBits(o,c) StorePixels(pdst,o, (cfb8Pixels[c & 0xff])) -# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ - (cfb8StippleAnd[c & 0xff]), \ - (cfb8StippleXor[c & 0xff])) -# define FirstStep(c) c = BitLeft (c, 8); -#else -/* 0x3c is 0xf << 2 (4 bits, long word) */ -# define StoreBits(o,c) StorePixels(pdst,o,*((CfbBits *)\ - (((char *) cfb8Pixels) + (c & 0x3c)))) -# define StoreRopBits(o,c) StoreRopPixels(pdst,o, \ - *((CfbBits *) (((char *) cfb8StippleAnd) + (c & 0x3c))), \ - *((CfbBits *) (((char *) cfb8StippleXor) + (c & 0x3c)))) -# define FirstStep(c) c = BitLeft (c, 2); -#endif /* PGSZ */ -#endif /* BITMAP_BIT_ORDER */ - - StoreBits0(tmp); FirstStep(tmp); - StoreBits(1,tmp); Step(tmp); - StoreBits(2,tmp); Step(tmp); - StoreBits(3,tmp); Step(tmp); - StoreBits(4,tmp); Step(tmp); - StoreBits(5,tmp); Step(tmp); - StoreBits(6,tmp); Step(tmp); - StoreBits(7,tmp); EndStep (pdst,8); - } - - /* do rest of middle and partial word on right edge */ - - if (pixelsRemainingOnRightEdge) - { - tmp = BitLeft(bits, leftShift); - - if (pixelsRemainingOnRightEdge > rightShift) - { - bits = *psrc++; - tmp |= BitRight (bits, rightShift); - } - EndStep (pdst, nl); - switch (nl) - { - case 7: - StoreBitsPlain(-7,tmp); Step(tmp); - case 6: - StoreBitsPlain(-6,tmp); Step(tmp); - case 5: - StoreBitsPlain(-5,tmp); Step(tmp); - case 4: - StoreBitsPlain(-4,tmp); Step(tmp); - case 3: - StoreBitsPlain(-3,tmp); Step(tmp); - case 2: - StoreBitsPlain(-2,tmp); Step(tmp); - case 1: - StoreBitsPlain(-1,tmp); Step(tmp); - } - if (endmask) - *pdst = (*pdst & ~endmask) | (GetPixelGroup(tmp) & endmask); - } - } - } - else /* cfb8StippleRRop != GXcopy */ - { - while (height--) - { /* one iteration of this loop copies one row */ - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - bits = *psrc++; - - /* do partial word on left edge */ - - if (startmask) - { - if (firstoff < 0) - tmp = BitRight (bits, -firstoff); - else - { - tmp = BitLeft (bits, firstoff); - if (firstoff >= (MFB_PPW-PPW)) - { - bits = *psrc++; - if (firstoff != (MFB_PPW-PPW)) - tmp |= BitRight (bits, secondoff); - } - } - src = GetBitGroup(tmp); - *pdst = MaskRRopPixels (*pdst, src, startmask); - pdst++; - } - - /* do middle of row */ - - nl = nlMiddle; - while (nl >= 8) - { - nl -= 8; - tmp = BitLeft(bits, leftShift); - bits = *psrc++; - if (rightShift != MFB_PPW) - tmp |= BitRight(bits, rightShift); - StoreRopBits0(tmp); FirstStep(tmp); - StoreRopBits(1,tmp); Step(tmp); - StoreRopBits(2,tmp); Step(tmp); - StoreRopBits(3,tmp); Step(tmp); - StoreRopBits(4,tmp); Step(tmp); - StoreRopBits(5,tmp); Step(tmp); - StoreRopBits(6,tmp); Step(tmp); - StoreRopBits(7,tmp); EndStep(pdst,8); - } - - /* do rest of middle and partial word on right edge */ - - if (pixelsRemainingOnRightEdge) - { - tmp = BitLeft(bits, leftShift); - - if (pixelsRemainingOnRightEdge > rightShift) - { - bits = *psrc++; /* XXX purify abr here */ - tmp |= BitRight (bits, rightShift); - } - while (nl--) - { - src = GetBitGroup (tmp); - *pdst = RRopPixels (*pdst, src); - pdst++; - NextBitGroup(tmp); - } - if (endmask) - { - src = GetBitGroup (tmp); - *pdst = MaskRRopPixels (*pdst, src, endmask); - } - } - } /* end copy one row */ - } /* end alu is non-copy-mode case */ - } /* end iteration over region boxes */ -} - -#else /* PSZ == 8 */ - -#define mfbmaskbits(x, w, startmask, endmask, nlw) \ - startmask = mfbGetstarttab((x)&0x1f); \ - endmask = mfbGetendtab(((x)+(w)) & 0x1f); \ - if (startmask) \ - nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \ - else \ - nlw = (w) >> 5; - -#define mfbmaskpartialbits(x, w, mask) \ - mask = mfbGetpartmasks((x)&0x1f,(w)&0x1f); - -#define LeftMost 0 -#define StepBit(bit, inc) ((bit) += (inc)) - - -#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ - bits = 0; \ - while (nBits--) \ - { \ - bits |= ((*psrc++ >> bitPos) & 1) << curBit; \ - StepBit (curBit, 1); \ - } \ -} - -/******************************************************************/ - -static void -#if PSZ == 16 -cfbCopyPlane1to16 -#endif -#if PSZ == 24 -cfbCopyPlane1to24 -#endif -#if PSZ == 32 -cfbCopyPlane1to32 -#endif -( - DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask) -{ - int srcx, srcy, dstx, dsty; - int width, height; - int xoffSrc; - CfbBits *psrcBase, *pdstBase; - int widthSrc, widthDst; - unsigned int *psrcLine; - register unsigned int *psrc; -#if PSZ == 16 - unsigned short *pdstLine; - register unsigned short *pdst; -#endif -#if PSZ == 32 - unsigned int *pdstLine; - register unsigned int *pdst; -#endif -#if PSZ == 24 - unsigned char *pdstLine; - register unsigned char *pdst; -#endif - register unsigned int bits, tmp; - register unsigned int fgpixel, bgpixel; - register unsigned int src; -#if PSZ == 24 - register unsigned int dst; -#endif - register int leftShift, rightShift; - register int i, nl; - int nbox; - BoxPtr pbox; - int result; - -#if PSZ == 16 - unsigned int doublet[4]; /* Pixel values for 16bpp expansion. */ -#endif -#if PSZ == 32 - unsigned int doublet[8]; /* Pixel values for 32bpp expansion */ -#endif - - fgpixel = FgPixel & planemask; - bgpixel = BgPixel & planemask; - -#if PSZ == 16 - if (rop == GXcopy && (planemask & PMSK) == PMSK) { - doublet[0] = bgpixel | (bgpixel << 16); - doublet[1] = fgpixel | (bgpixel << 16); - doublet[2] = bgpixel | (fgpixel << 16); - doublet[3] = fgpixel | (fgpixel << 16); - } -#endif -#if PSZ == 32 - if (rop == GXcopy && (planemask & PMSK) == PMSK) { - doublet[0] = bgpixel; doublet[1] = bgpixel; - doublet[2] = fgpixel; doublet[3] = bgpixel; - doublet[4] = bgpixel; doublet[5] = fgpixel; - doublet[6] = fgpixel; doublet[7] = fgpixel; - } -#endif - - /* must explicitly ask for "int" widths, as code below expects it */ - /* on some machines (Alpha), "long" and "int" are not the same size */ - cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits) - cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits) - -#if PSZ == 16 - widthDst <<= 1; -#endif -#if PSZ == 24 - widthDst <<= 2; -#endif - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; - psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + (srcx >> 5); -#if PSZ == 16 - pdstLine = (unsigned short *)pdstBase + dsty * widthDst + dstx; -#endif -#if PSZ == 24 - pdstLine = (unsigned char *)pdstBase + dsty * widthDst + dstx * 3; -#endif -#if PSZ == 32 - pdstLine = (unsigned int *)pdstBase + dsty * widthDst + dstx; -#endif - xoffSrc = srcx & 0x1f; - - /* - * compute constants for the first four bits to be - * copied. This avoids troubles with partial first - * writes, and difficult shift computation - */ - leftShift = xoffSrc; - rightShift = 32 - leftShift; - - if (rop == GXcopy && (planemask & PMSK) == PMSK) - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - bits = *psrc++; - nl = width; - while (nl >= 32) - { - tmp = BitLeft(bits, leftShift); - bits = *psrc++; - if (rightShift != 32) - tmp |= BitRight(bits, rightShift); - i = 0; -#if PSZ == 16 - /* - * I've thrown in some optimization to at least write - * some aligned 32-bit words instead of 16-bit shorts. - */ - if ((unsigned long)psrc & 2) { - /* Write unaligned 16-bit word at left edge. */ - if (tmp & 0x01) - *pdst = fgpixel; - else - *pdst = bgpixel; - pdst++; - i++; - } - while (i <= 24) - { - unsigned tmpbits = tmp >> i; - *(unsigned int *)pdst = doublet[tmpbits & 0x03]; - *(unsigned int *)(pdst + 2) = - doublet[(tmpbits >> 2) & 0x03]; - *(unsigned int *)(pdst + 4) = - doublet[(tmpbits >> 4) & 0x03]; - *(unsigned int *)(pdst + 6) = - doublet[(tmpbits >> 6) & 0x03]; - pdst += 8; /* Advance four 32-bit words. */ - i += 8; - } - while (i <= 30) - { - *(unsigned int *)pdst = - doublet[(tmp >> i) & 0x03]; - pdst += 2; /* Advance one 32-bit word. */ - i += 2; - } - if (i == 31) { - if ((tmp >> 31) & 0x01) - *pdst = fgpixel; - else - *pdst = bgpixel; - pdst++; - } -#endif -#if PSZ == 24 - while (i < 32) { - if ((tmp >> i) & 0x01) { - *pdst = fgpixel; - *(pdst + 1) = fgpixel >> 8; - *(pdst + 2) = fgpixel >> 16; - } - else { - *pdst = bgpixel; - *(pdst + 1) = bgpixel >> 8; - *(pdst + 2) = bgpixel >> 16; - } - pdst += 3; - i++; - } -#endif -#if PSZ == 32 - while (i <= 28) { - int pair; - pair = (tmp >> i) & 0x03; - *pdst = doublet[pair * 2]; - *(pdst + 1) = doublet[pair * 2 + 1]; - pair = (tmp >> (i + 2)) & 0x03; - *(pdst + 2) = doublet[pair * 2]; - *(pdst + 3) = doublet[pair * 2 + 1]; - pdst += 4; - i += 4; - } - while (i < 32) { - *pdst = ((tmp >> i) & 0x01) ? fgpixel : bgpixel; - pdst++; - i++; - } -#endif - nl -= 32; - } - - if (nl) - { - tmp = BitLeft(bits, leftShift); - /* - * better condition needed -- mustn't run - * off the end of the source... - */ - if (rightShift != 32) - { - bits = *psrc++; - tmp |= BitRight (bits, rightShift); - } - i = 32; - while (nl--) - { - --i; -#if PSZ == 24 - if ((tmp >> (31 - i)) & 0x01) { - *pdst = fgpixel; - *(pdst + 1) = fgpixel >> 8; - *(pdst + 2) = fgpixel >> 16; - } - else { - *pdst = bgpixel; - *(pdst + 1) = bgpixel >> 8; - *(pdst + 2) = bgpixel >> 16; - } - pdst += 3; -#else - *pdst = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; - pdst++; -#endif - } - } - } - } - else - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - bits = *psrc++; - nl = width; - while (nl >= 32) - { - tmp = BitLeft(bits, leftShift); - bits = *psrc++; - if (rightShift != 32) - tmp |= BitRight(bits, rightShift); - i = 32; - while (i--) - { - src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; -#if PSZ == 24 - dst = *pdst; - dst |= (*(pdst + 1)) << 8; - dst |= (*(pdst + 2)) << 16; - DoRop (result, rop, src, dst); - *pdst = (dst & ~planemask) | - (result & planemask); - *(pdst+1) = ((dst & ~planemask) >> 8) | - ((result & planemask) >> 8); - *(pdst+2) = ((dst & ~planemask) >> 16) | - ((result & planemask) >> 16); - pdst += 3; -#else - DoRop (result, rop, src, *pdst); - - *pdst = (*pdst & ~planemask) | - (result & planemask); - pdst++; -#endif - } - nl -= 32; - } - - if (nl) - { - tmp = BitLeft(bits, leftShift); - /* - * better condition needed -- mustn't run - * off the end of the source... - */ - if (rightShift != 32) - { - bits = *psrc++; - tmp |= BitRight (bits, rightShift); - } - i = 32; - while (nl--) - { - --i; - src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; -#if PSZ == 24 - dst = *pdst; - dst |= (*(pdst + 1)) << 8; - dst |= (*(pdst + 2)) << 16; - DoRop (result, rop, src, dst); - *pdst = (dst & ~planemask) | - (result & planemask); - *(pdst+1) = ((dst & ~planemask) >> 8) | - ((result & planemask) >> 8); - *(pdst+2) = ((dst & ~planemask) >> 16) | - ((result & planemask) >> 16); - pdst += 3; -#else - DoRop (result, rop, src, *pdst); - - *pdst = (*pdst & ~planemask) | - (result & planemask); - pdst++; -#endif - } - } - } - } - } -} - -#endif /* PSZ == 8 */ - -/* shared among all different cfb depths through linker magic */ - -RegionPtr cfbCopyPlane(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane) - DrawablePtr pSrcDrawable; - DrawablePtr pDstDrawable; - GCPtr pGC; - int srcx, srcy; - int width, height; - int dstx, dsty; - unsigned long bitPlane; -{ - RegionPtr ret; - -#if IMAGE_BYTE_ORDER == LSBFirst - - void (*doCopyPlaneExpand)( - DrawablePtr /*pSrc*/, - DrawablePtr /*pDst*/, - int /*alu*/, - RegionPtr /*prgnDst*/, - DDXPointPtr /*pptSrc*/, - unsigned long /*planemask*/); - - if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == PSZ) - { - if (bitPlane == 1) - { - doCopyPlaneExpand = cfbCopyPlane1toN; -#if PSZ == 8 - cfb8CheckOpaqueStipple (pGC->alu, - pGC->fgPixel, pGC->bgPixel, - pGC->planemask); -#else - FgPixel = pGC->fgPixel; - BgPixel = pGC->bgPixel; -#endif - ret = cfbCopyPlaneExpand (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, doCopyPlaneExpand, bitPlane); - } - else - ret = miHandleExposures (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - } - else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == 1) - { - int oldalu; - - oldalu = pGC->alu; - if ((pGC->fgPixel & 1) == 0 && (pGC->bgPixel&1) == 1) - pGC->alu = mfbGetInverseAlu(pGC->alu); - else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) - pGC->alu = mfbReduceRop(pGC->alu, pGC->fgPixel); - ret = cfbCopyPlaneReduce(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - cfbCopyPlaneNto1, bitPlane); - pGC->alu = oldalu; - } - else if (pSrcDrawable->bitsPerPixel == PSZ && pDstDrawable->bitsPerPixel == PSZ) - { - PixmapPtr pBitmap; - ScreenPtr pScreen = pSrcDrawable->pScreen; - GCPtr pGC1; - - pBitmap = (*pScreen->CreatePixmap) (pScreen, width, height, 1, - CREATE_PIXMAP_USAGE_SCRATCH); - if (!pBitmap) - return NULL; - pGC1 = GetScratchGC (1, pScreen); - if (!pGC1) - { - (*pScreen->DestroyPixmap) (pBitmap); - return NULL; - } - /* - * don't need to set pGC->fgPixel,bgPixel as copyPlaneNto1 - * ignores pixel values, expecting the rop to "do the - * right thing", which GXcopy will. - */ - ValidateGC ((DrawablePtr) pBitmap, pGC1); - /* no exposures here, scratch GC's don't get graphics expose */ - cfbCopyPlaneReduce(pSrcDrawable, (DrawablePtr) pBitmap, - pGC1, srcx, srcy, width, height, 0, 0, - cfbCopyPlaneNto1, bitPlane); -#if PSZ == 8 - cfb8CheckOpaqueStipple (pGC->alu, - pGC->fgPixel, pGC->bgPixel, - pGC->planemask); -#else - FgPixel = pGC->fgPixel; - BgPixel = pGC->bgPixel; -#endif - /* no exposures here, copy bits from inside a pixmap */ - cfbCopyPlaneExpand((DrawablePtr) pBitmap, pDstDrawable, pGC, - 0, 0, width, height, dstx, dsty, cfbCopyPlane1toN, 1); - FreeScratchGC (pGC1); - (*pScreen->DestroyPixmap) (pBitmap); - /* compute resultant exposures */ - ret = miHandleExposures (pSrcDrawable, pDstDrawable, pGC, - srcx, srcy, width, height, - dstx, dsty, bitPlane); - } - else -#endif - ret = miCopyPlane (pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - return ret; -} - - diff --git a/cfb/cfbblt.c b/cfb/cfbblt.c deleted file mode 100644 index ff34589ff..000000000 --- a/cfb/cfbblt.c +++ /dev/null @@ -1,933 +0,0 @@ -/* - * cfb copy area - */ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Keith Packard - -*/ - -/* 24-bit bug fixes: Peter Wainwright, 1998/11/28 */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" -#include "fastblt.h" -#include "mergerop.h" - -#ifdef notdef /* XXX fails right now, walks off end of pixmaps */ -#if defined (FAST_UNALIGNED_READS) && PSZ == 8 -#define DO_UNALIGNED_BITBLT -#endif -#endif - -#if defined(FAST_MEMCPY) && (MROP == Mcopy) && PSZ == 8 -#define DO_MEMCPY -#endif - -/* ................................................. */ -/* SPECIAL CODE FOR 24 BITS by Peter Wainwright */ - -#if PSZ == 24 && (MROP) == 0 - -/* The default macros are defined in mergerop.h, and none of them are - really appropriate for what we want to do. - - There are two ways of fixing this: either define SLOW_24BIT_COPY - to copy pixel by pixel, or (by default) use the following macros - modified from mergerop.h - - MROP_SOLID and MROP_MASK are defined for each of the operations, - i.e. each value of MROP. - - There are special cases for Mcopy, McopyInverted, Mxor, and Mor. - There is a completely generic version for MROP=0, and a simplified - generic version which works for (Mcopy|Mxor|MandReverse|Mor). - - However, the generic version does not work for the 24-bit case - because the pixels cannot be packed exactly into a machine word (32 - bits). - - Alternative macros MROP_SOLID24 and MROP_MASK24 are provided for - the 24-bit case. However, these each copy a single *pixel*, not a - single machine word. They take an rvalue source pixel, an lvalue - destination, and the pixel index. The latter is used to find the - position of the pixel data within the two words *dst and *(dst+1). - - Further macros MROP_SOLID24P and MROP_MASK24P are used to copy from - an lvalue source to an lvalue destination. MROP_PIXEL24 is used to - assemble the source pixel from the adjacent words *src and - *(src+1), and this is then split between the destination words - using the non-P macros above. - - But we want to copy entire words for the sake of efficiency. - Unfortunately if a plane mask is specified this must be shifted - from one word to the next. Fortunately the pattern repeats after 3 - words, so we unroll the planemask here and redefine MROP_SOLID - and MROP_MASK. */ - - -#endif /* MROP == 0 && PSZ == 24 */ - -/* ................................................. */ - -#if PSZ == 24 -#define BYPP 3 -#if PGSZ == 32 -#define P3W 4 /* pixels in 3 machine words */ -#define PAM 3 /* pixel align mask; PAM = P3W -1 */ -#define P2WSH 2 -#else -#define P3W 8 /* pixels in 3 machine words */ -#define PAM 7 /* pixel align mask; PAM = P3W -1 */ -#define P2WSH 3 -#endif -#endif - -void -MROP_NAME(cfbDoBitblt)( - DrawablePtr pSrc, - DrawablePtr pDst, - int alu, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask) -{ - CfbBits *psrcBase, *pdstBase; - /* start of src and dst bitmaps */ - int widthSrc, widthDst; /* add to get to same position in next line */ - - BoxPtr pbox; - int nbox; - - BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - /* temporaries for shuffling rectangles */ - DDXPointPtr pptTmp, pptNew1, pptNew2; - /* shuffling boxes entails shuffling the - source points too */ - int w, h; - int xdir; /* 1 = left right, -1 = right left/ */ - int ydir; /* 1 = top down, -1 = bottom up */ - - CfbBits *psrcLine, *pdstLine; - /* pointers to line with current src and dst */ - register CfbBits *psrc;/* pointer to current src longword */ - register CfbBits *pdst;/* pointer to current dst longword */ - - MROP_DECLARE_REG() - - /* following used for looping through a line */ - CfbBits startmask, endmask; /* masks for writing ends of dst */ - int nlMiddle; /* whole longwords in dst */ - int xoffSrc, xoffDst; - register int nl; /* temp copy of nlMiddle */ - int careful; - -#if (PSZ != 24) || (MROP != 0) - register int leftShift, rightShift; - register CfbBits bits; - register CfbBits bits1; -#endif - -#if PSZ == 24 -#ifdef DO_MEMCPY - int w2; -#endif - -#if MROP == 0 - int widthSrcBytes = cfbGetByteWidth(pSrc); - int widthDstBytes = cfbGetByteWidth(pDst); -#endif -#endif - - MROP_INITIALIZE(alu,planemask) - - cfbGetLongWidthAndPointer (pSrc, widthSrc, psrcBase) - - cfbGetLongWidthAndPointer (pDst, widthDst, pdstBase) - - /* XXX we have to err on the side of safety when both are windows, - * because we don't know if IncludeInferiors is being used. - */ - careful = ((pSrc == pDst) || - ((pSrc->type == DRAWABLE_WINDOW) && - (pDst->type == DRAWABLE_WINDOW))); - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - - pboxNew1 = NULL; - pptNew1 = NULL; - pboxNew2 = NULL; - pptNew2 = NULL; - if (careful && (pptSrc->y < pbox->y1)) - { - /* walk source botttom to top */ - ydir = -1; - widthSrc = -widthSrc; - widthDst = -widthDst; - - if (nbox > 1) - { - /* keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); - if(!pboxNew1) - return; - pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); - if(!pptNew1) - { - xfree(pboxNew1); - return; - } - pboxBase = pboxNext = pbox+nbox-1; - while (pboxBase >= pbox) - { - while ((pboxNext >= pbox) && - (pboxBase->y1 == pboxNext->y1)) - pboxNext--; - pboxTmp = pboxNext+1; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp <= pboxBase) - { - *pboxNew1++ = *pboxTmp++; - *pptNew1++ = *pptTmp++; - } - pboxBase = pboxNext; - } - pboxNew1 -= nbox; - pbox = pboxNew1; - pptNew1 -= nbox; - pptSrc = pptNew1; - } - } - else - { - /* walk source top to bottom */ - ydir = 1; - } - - if (careful && (pptSrc->x < pbox->x1)) - { - /* walk source right to left */ - xdir = -1; - - if (nbox > 1) - { - /* reverse order of rects in each band */ - pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); - pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); - if(!pboxNew2 || !pptNew2) - { - if (pptNew2) xfree(pptNew2); - if (pboxNew2) xfree(pboxNew2); - if (pboxNew1) - { - xfree(pptNew1); - xfree(pboxNew1); - } - return; - } - pboxBase = pboxNext = pbox; - while (pboxBase < pbox+nbox) - { - while ((pboxNext < pbox+nbox) && - (pboxNext->y1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp != pboxBase) - { - *pboxNew2++ = *--pboxTmp; - *pptNew2++ = *--pptTmp; - } - pboxBase = pboxNext; - } - pboxNew2 -= nbox; - pbox = pboxNew2; - pptNew2 -= nbox; - pptSrc = pptNew2; - } - } - else - { - /* walk source left to right */ - xdir = 1; - } - - while(nbox--) - { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - -#if PSZ == 24 -#ifdef DO_MEMCPY - w2 = w * BYPP; -#endif -#endif - if (ydir == -1) /* start at last scanline of rectangle */ - { - psrcLine = psrcBase + ((pptSrc->y+h-1) * -widthSrc); - pdstLine = pdstBase + ((pbox->y2-1) * -widthDst); - } - else /* start at first scanline */ - { - psrcLine = psrcBase + (pptSrc->y * widthSrc); - pdstLine = pdstBase + (pbox->y1 * widthDst); - } -#if PSZ == 24 - if (w == 1 && ((pbox->x1 & PAM) == 0 || (pbox->x1 & PAM) == PAM)) -#else - if ((pbox->x1 & PIM) + w <= PPW) -#endif - { - maskpartialbits (pbox->x1, w, endmask); - startmask = 0; - nlMiddle = 0; - } - else - { - maskbits(pbox->x1, w, startmask, endmask, nlMiddle); - } - -#if PSZ == 24 -#if 0 - nlMiddle = w - (pbox->x2 &PAM);; - if(pbox->x1 & PAM){ - nlMiddle -= (PAM+1 - (pbox->x1 &PAM)); - } - nlMiddle >>= P2WSH; - if(nlMiddle < 0) - nlMiddle = 0; -#endif -#endif - -#ifdef DO_MEMCPY - /* If the src and dst scanline don't overlap, do forward case. */ - - if ((xdir == 1) || (pptSrc->y != pbox->y1) - || (pptSrc->x + w <= pbox->x1)) - { -#if PSZ == 24 - char *psrc = (char *) psrcLine + (pptSrc->x * BYPP); - char *pdst = (char *) pdstLine + (pbox->x1 * BYPP); -#else - char *psrc = (char *) psrcLine + pptSrc->x; - char *pdst = (char *) pdstLine + pbox->x1; -#endif - while (h--) - { -#if PSZ == 24 - memcpy(pdst, psrc, w2); -#else - memcpy(pdst, psrc, w); -#endif - pdst += widthDst << PWSH; - psrc += widthSrc << PWSH; - } - } -#else /* ! DO_MEMCPY */ - if (xdir == 1) - { -#if PSZ == 24 && MROP == 0 - /* Note: x is a pixel number; the byte offset is 3*x; - therefore the offset within a word is (3*x) & 3 == - (4*x-x) & 3 == (-x) & 3. The offsets therefore - DECREASE by 1 for each pixel. - */ - xoffSrc = ( - pptSrc->x) & PAM; - xoffDst = ( - pbox->x1) & PAM; -#if 1 - if((int)xoffSrc != (int)xoffDst /* Alignments must be same. */ - || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1)) -#else - if(1) -#endif - /* Width also must be same, if hight > 1 */ - { - /* ...otherwise, pixel by pixel operation */ - while (h--) - { - register int i, si, sii, di; - - for (i = 0, si = pptSrc->x, di = pbox->x1; - i < w; - i++, si++, di++) { - psrc = psrcLine + ((si * BYPP) >> P2WSH); - pdst = pdstLine + ((di * BYPP) >> P2WSH); - sii = (si & 3); - MROP_SOLID24P(psrc, pdst, sii, di); - } - pdstLine += widthDst; - psrcLine += widthSrc; - } - } - else -#endif - { - -#if PSZ == 24 - -#if MROP != 0 - xoffSrc = ( - pptSrc->x) & PAM; - xoffDst = ( - pbox->x1) & PAM; -#endif - pdstLine += (pbox->x1 * BYPP) >> P2WSH; - psrcLine += (pptSrc->x * BYPP) >> P2WSH; -#else - xoffSrc = pptSrc->x & PIM; - xoffDst = pbox->x1 & PIM; - pdstLine += (pbox->x1 >> PWSH); - psrcLine += (pptSrc->x >> PWSH); -#endif -#ifdef DO_UNALIGNED_BITBLT - nl = xoffSrc - xoffDst; - psrcLine = (CfbBits *) - (((unsigned char *) psrcLine) + nl); -#else -#if PSZ == 24 && MROP == 0 - /* alredy satisfied */ -#else - if (xoffSrc == xoffDst) -#endif -#endif - { - while (h--) - { -#if PSZ == 24 && MROP == 0 - register int index; - register int im3; -#endif /* PSZ == 24 && MROP == 0 */ - psrc = psrcLine; - pdst = pdstLine; - pdstLine += widthDst; - psrcLine += widthSrc; -#if PSZ == 24 && MROP == 0 - index = (int)(pdst - pdstBase); - im3 = index % 3; -#endif /* PSZ == 24 && MROP == 0 */ - if (startmask) - { -#if PSZ == 24 && MROP == 0 - *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, im3); - index++; - im3 = index % 3; -#else /* PSZ != 24 || MROP != 0 */ - *pdst = MROP_MASK(*psrc, *pdst, startmask); -#endif /* PSZ == 24 && MROP == 0 */ - psrc++; - pdst++; - } - - nl = nlMiddle; -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#if PSZ == 24 && MROP == 0 -#define BodyOdd(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3); -#define BodyEven(n) pdst[-n] = DoMergeRop24u(psrc[-n], pdst[-n], ((int)(pdst - n - pdstBase))%3); -#else /* PSZ != 24 || MROP != 0 */ -#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); -#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); -#endif /* PSZ == 24 && MROP == 0 */ - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#if PSZ == 24 && MROP == 0 -#define BodyOdd(n) *pdst = DoMergeRop24u(*psrc, *pdst, im3); pdst++; psrc++; index++; im3 = index % 3; -#define BodyEven(n) BodyOdd(n) -#else /* PSZ != 24 || MROP != 0 */ -#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; -#define BodyEven(n) BodyOdd(n) -#endif /* PSZ == 24 && MROP == 0 */ - -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else -#ifdef NOTDEF - /* you'd think this would be faster -- - * a single instruction instead of 6 - * but measurements show it to be ~15% slower - */ - while ((nl -= 6) >= 0) - { - asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0" - : "=m" (*(char *)pdst) - : "m" (*(char *)psrc) - : "d0", "d1", "d2", "d3", - "a2", "a3"); - pdst += 6; - } - nl += 6; - while (nl--) - *pdst++ = *psrc++; -#endif -#if 0 /*PSZ == 24 && MROP == 0*/ - DuffL(nl, label1, - *pdst = DoMergeRop24u(*psrc, *pdst, im3); - pdst++; psrc++; index++;im3 = index % 3;) -#else /* !(PSZ == 24 && MROP == 0) */ - DuffL(nl, label1, - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++;) -#endif /* PSZ == 24 && MROP == 0 */ -#endif - - if (endmask) -#if PSZ == 24 && MROP == 0 - *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, (int)(pdst - pdstBase) % 3); -#else /* !(PSZ == 24 && MROP == 0) */ - *pdst = MROP_MASK(*psrc, *pdst, endmask); -#endif /* PSZ == 24 && MROP == 0 */ - } - } -#ifndef DO_UNALIGNED_BITBLT -#if PSZ == 24 && MROP == 0 - /* can not happen */ -#else /* !(PSZ == 24 && MROP == 0) */ - else /* xoffSrc != xoffDst */ - { - if (xoffSrc > xoffDst) - { -#if PSZ == 24 - leftShift = (xoffSrc - xoffDst) << 3; -#else -#if PGSZ == 32 - leftShift = (xoffSrc - xoffDst) << (5 - PWSH); -#else /* PGSZ == 64 */ - leftShift = (xoffSrc - xoffDst) << (6 - PWSH); -#endif /* PGSZ */ -#endif - rightShift = PGSZ - leftShift; - } - else - { -#if PSZ == 24 - rightShift = (xoffDst - xoffSrc) << 3; -#else -#if PGSZ == 32 - rightShift = (xoffDst - xoffSrc) << (5 - PWSH); -#else /* PGSZ == 64 */ - rightShift = (xoffDst - xoffSrc) << (6 - PWSH); -#endif /* PGSZ */ -#endif - leftShift = PGSZ - rightShift; - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - pdstLine += widthDst; - psrcLine += widthSrc; - bits = 0; - if (xoffSrc > xoffDst) - bits = *psrc++; - if (startmask) - { - bits1 = BitLeft(bits,leftShift); - bits = *psrc++; - bits1 |= BitRight(bits,rightShift); - *pdst = MROP_MASK(bits1, *pdst, startmask); - pdst++; - } - nl = nlMiddle; -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; - -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) \ -bits = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); - -#define BodyEven(n) \ -bits1 = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) \ -bits = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ -pdst++; - -#define BodyEven(n) \ -bits1 = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ -pdst++; - -#define LoopReset ; - -#endif /* !FAST_CONSTANT_OFFSET_MODE */ - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl,label2, - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); - pdst++; - ) -#endif - - if (endmask) - { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) - { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - } - } -#endif /* (PSZ == 24 && MROP == 0) */ -#endif /* DO_UNALIGNED_BITBLT */ - - } - } -#endif /* ! DO_MEMCPY */ - else /* xdir == -1 */ - { -#if PSZ == 24 && MROP == 0 - xoffSrc = (-(pptSrc->x + w)) & PAM; - xoffDst = (-pbox->x2) & PAM; -#if 1 - if(xoffSrc != xoffDst /* Alignments must be same. */ - || ((widthDstBytes & PAM) != (widthSrcBytes & PAM) && h > 1)) -#else - if(1) -#endif - /* Width also must be same, if hight > 1 */ - { - /* ...otherwise, pixel by pixel operation */ - while (h--) - { - register int i, si, sii, di; - - for (i = 0, si = pptSrc->x + w - 1, di = pbox->x2 - 1; - i < w; - i++, si--, di--) { - psrc = psrcLine + ((si * BYPP) >> P2WSH); - pdst = pdstLine + ((di * BYPP) >> P2WSH); - sii = (si & PAM); - MROP_SOLID24P(psrc, pdst, sii, di); - } - psrcLine += widthSrc; - pdstLine += widthDst; - } - }else -#endif /* MROP == 0 && PSZ == 24 */ - { - -#if PSZ == 24 -#if MROP == 0 - /* already calculated */ -#else - xoffSrc = (pptSrc->x + w) & PAM; - xoffDst = pbox->x2 & PAM; -#endif - pdstLine += ((pbox->x2 * BYPP - 1) >> P2WSH) + 1; - psrcLine += (((pptSrc->x+w) * BYPP - 1) >> P2WSH) + 1; -#else - xoffSrc = (pptSrc->x + w - 1) & PIM; - xoffDst = (pbox->x2 - 1) & PIM; - pdstLine += ((pbox->x2-1) >> PWSH) + 1; - psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1; -#endif -#ifdef DO_UNALIGNED_BITBLT -#if PSZ == 24 - nl = xoffDst - xoffSrc; -#else - nl = xoffSrc - xoffDst; -#endif - psrcLine = (CfbBits *) - (((unsigned char *) psrcLine) + nl); -#else -#if PSZ == 24 && MROP == 0 - /* already satisfied */ -#else - if (xoffSrc == xoffDst) -#endif -#endif - { - while (h--) - { -#if PSZ == 24 && MROP == 0 - register int index; - register int im3; -#endif /* PSZ == 24 && MROP == 0 */ - psrc = psrcLine; - pdst = pdstLine; - pdstLine += widthDst; - psrcLine += widthSrc; -#if PSZ == 24 && MROP == 0 - index = (int)(pdst - pdstBase); -#endif /* PSZ == 24 && MROP == 0 */ - - if (endmask) - { - pdst--; - psrc--; -#if PSZ == 24 && MROP == 0 - index--; - im3 = index % 3; - *pdst = DoMaskMergeRop24u(*psrc, *pdst, endmask, im3); -#else /* !(PSZ == 24 && MROP == 0) */ - *pdst = MROP_MASK (*psrc, *pdst, endmask); -#endif /* PSZ == 24 && MROP == 0 */ - } - nl = nlMiddle; -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - psrc -= nl & (UNROLL - 1); - pdst -= nl & (UNROLL - 1); - -#if PSZ == 24 && MROP == 0 -#define BodyOdd(n) pdst[n-1] = DoMergeRop24u(psrc[n-1], pdst[n-1], ((int)(pdst - (n - 1) -pdstBase)) % 3); -#else /* !(PSZ == 24 && MROP == 0) */ -#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]); -#endif /* PSZ == 24 && MROP == 0 */ - -#define BodyEven(n) BodyOdd(n) - -#define LoopReset \ -pdst -= UNROLL;\ -psrc -= UNROLL; - -#else - -#if PSZ == 24 && MROP == 0 -#define BodyOdd(n) --pdst; --psrc; --index; im3 = index % 3;*pdst = DoMergeRop24u(*psrc, *pdst, im3); -#else /* !(PSZ == 24 && MROP == 0) */ -#define BodyOdd(n) --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst); -#endif /* PSZ == 24 && MROP == 0 */ -#define BodyEven(n) BodyOdd(n) -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else -#if PSZ == 24 && MROP == 0 - DuffL(nl,label3, - --pdst; --psrc; --index; im3= index%3;*pdst = DoMergeRop24u(*psrc, *pdst, im3);) -#else /* !(PSZ == 24 && MROP == 0) */ - DuffL(nl,label3, - --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);) -#endif /* PSZ == 24 && MROP == 0 */ -#endif - - if (startmask) - { - --pdst; - --psrc; -#if PSZ == 24 && MROP == 0 - *pdst = DoMaskMergeRop24u(*psrc, *pdst, startmask, (int)(pdst - pdstBase) % 3); -#else /* !(PSZ == 24 && MROP == 0) */ - *pdst = MROP_MASK(*psrc, *pdst, startmask); -#endif /* PSZ == 24 && MROP == 0 */ - } - } - } -#ifndef DO_UNALIGNED_BITBLT -#if PSZ == 24 && MROP == 0 - /* can not happen */ -#else /* !( PSZ == 24 && MROP == 0) */ - else - { - if (xoffDst > xoffSrc) - { -#if PSZ == 24 - leftShift = (xoffDst - xoffSrc) << 3; - rightShift = PGSZ - leftShift; -#else -#if PGSZ == 32 - rightShift = (xoffDst - xoffSrc) << (5 - PWSH); -#else /* PGSZ == 64 */ - rightShift = (xoffDst - xoffSrc) << (6 - PWSH); -#endif /* PGSZ */ - leftShift = PGSZ - rightShift; -#endif - } - else - { -#if PSZ == 24 - rightShift = (xoffSrc - xoffDst) << 3; - leftShift = PGSZ - rightShift; -#else -#if PGSZ == 32 - leftShift = (xoffSrc - xoffDst) << (5 - PWSH); -#else /* PGSZ == 64 */ - leftShift = (xoffSrc - xoffDst) << (6 - PWSH); -#endif /* PGSZ */ - rightShift = PGSZ - leftShift; -#endif - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - pdstLine += widthDst; - psrcLine += widthSrc; - bits = 0; -#if PSZ == 24 - if (xoffSrc > xoffDst) -#else - if (xoffDst > xoffSrc) -#endif - bits = *--psrc; - if (endmask) - { - bits1 = BitRight(bits, rightShift); - bits = *--psrc; - bits1 |= BitLeft(bits, leftShift); - pdst--; - *pdst = MROP_MASK(bits1, *pdst, endmask); - } - nl = nlMiddle; -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; -#ifdef FAST_CONSTANT_OFFSET_MODE - psrc -= nl & (UNROLL - 1); - pdst -= nl & (UNROLL - 1); - -#define BodyOdd(n) \ -bits = psrc[n-1]; \ -pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]); - -#define BodyEven(n) \ -bits1 = psrc[n-1]; \ -pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]); - -#define LoopReset \ -pdst -= UNROLL; \ -psrc -= UNROLL; - -#else - -#define BodyOdd(n) \ -bits = *--psrc; --pdst; \ -*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst); - -#define BodyEven(n) \ -bits1 = *--psrc; --pdst; \ -*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst); - -#define LoopReset ; - -#endif - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl, label4, - bits1 = BitRight(bits, rightShift); - bits = *--psrc; - --pdst; - *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst); - ) -#endif - - if (startmask) - { - bits1 = BitRight(bits, rightShift); - if (BitRight (startmask, leftShift)) - { - bits = *--psrc; - bits1 |= BitLeft(bits, leftShift); - } - --pdst; - *pdst = MROP_MASK(bits1, *pdst, startmask); - } - } - } -#endif /* PSZ == 24 && MROP == 0 */ -#endif - } - } - pbox++; - pptSrc++; - } - if (pboxNew2) - { - xfree(pptNew2); - xfree(pboxNew2); - } - if (pboxNew1) - { - xfree(pptNew1); - xfree(pboxNew1); - } -} diff --git a/cfb/cfbbres.c b/cfb/cfbbres.c deleted file mode 100644 index fa1ee1379..000000000 --- a/cfb/cfbbres.c +++ /dev/null @@ -1,340 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "servermd.h" -#include "miline.h" - -/* Solid bresenham line */ -/* NOTES - e2 is used less often than e1, so it's not in a register -*/ - -void -cfbBresS(rop, and, xor, addrl, nlwidth, signdx, signdy, axis, x1, y1, e, e1, - e2, len) - int rop; - CfbBits and, xor; - CfbBits *addrl; /* pointer to base of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register int signdx; - int signdy; /* signs of directions */ - int axis; /* major axis (Y_AXIS or X_AXIS) */ - int x1, y1; /* initial point */ - register int e; /* error accumulator */ - register int e1; /* bresenham increments */ - int e2; - int len; /* length of line */ -{ - register int e3 = e2-e1; -#if PSZ == 24 - CfbBits piQxelXor[3],piQxelAnd[3]; - char *addrb; - int nlwidth3, signdx3; -#endif -#ifdef PIXEL_ADDR - register PixelType *addrp; /* Pixel pointer */ - - if (len == 0) - return; - /* point to first point */ - nlwidth <<= PWSH; -#if PSZ == 24 - addrp = (PixelType *)(addrl) + (y1 * nlwidth); - addrb = (char *)addrp + x1 * 3; - - piQxelXor[0] = (xor << 24) | xor; - piQxelXor[1] = (xor << 16)| (xor >> 8); - piQxelXor[2] = (xor << 8) | (xor >> 16); - piQxelAnd[0] = (and << 24) | and; - piQxelAnd[1] = (and << 16)| (and >> 8); - piQxelAnd[2] = (and << 8) | (and >> 16); -#else - addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1; -#endif - if (signdy < 0) - nlwidth = -nlwidth; - e = e-e1; /* to make looping easier */ -#if PSZ == 24 - nlwidth3 = nlwidth * sizeof (CfbBits); - signdx3 = signdx * 3; -#endif - - if (axis == Y_AXIS) - { - int t; - - t = nlwidth; - nlwidth = signdx; - signdx = t; -#if PSZ == 24 - t = nlwidth3; - nlwidth3 = signdx3; - signdx3 = t; -#endif - } - if (rop == GXcopy) - { - --len; -#if PSZ == 24 -#define body_copy \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp = ((*addrp)&0xFF000000)|(piQxelXor[0] & 0xFFFFFF); \ - break; \ - case 1: \ - *addrp = ((*addrp)&0xFF)|(piQxelXor[2] & 0xFFFFFF00); \ - break; \ - case 3: \ - *addrp = ((*addrp)&0xFFFFFF)|(piQxelXor[0] & 0xFF000000); \ - *(addrp+1) = ((*(addrp+1))&0xFFFF0000)|(piQxelXor[1] & 0xFFFF); \ - break; \ - case 2: \ - *addrp = ((*addrp)&0xFFFF)|(piQxelXor[1] & 0xFFFF0000); \ - *(addrp+1) = ((*(addrp+1))&0xFFFFFF00)|(piQxelXor[2] & 0xFF); \ - break; \ - } -#define body {\ - body_copy \ - addrb += signdx3; \ - e += e1; \ - if (e >= 0) \ - { \ - addrb += nlwidth3; \ - e += e3; \ - } \ - } -#else /* PSZ == 24 */ -#define body {\ - *addrp = xor; \ - addrp += signdx; \ - e += e1; \ - if (e >= 0) \ - { \ - addrp += nlwidth; \ - e += e3; \ - } \ - } -#endif /* PSZ == 24 */ - while (len >= 4) - { - body body body body - len -= 4; - } - switch (len) - { - case 3: body case 2: body case 1: body - } -#undef body -#if PSZ == 24 - body_copy -# undef body_copy -#else - *addrp = xor; -#endif - } - else /* not GXcopy */ - { - while(len--) - { -#if PSZ == 24 - addrp = (PixelType *)((unsigned long)addrb & ~0x03); - switch((unsigned long)addrb & 3){ - case 0: - *addrp = (*addrp & (piQxelAnd[0]|0xFF000000)) - ^ (piQxelXor[0] & 0xFFFFFF); - break; - case 1: - *addrp = (*addrp & (piQxelAnd[2]|0xFF)) - ^ (piQxelXor[2] & 0xFFFFFF00); - break; - case 3: - *addrp = (*addrp & (piQxelAnd[0]|0xFFFFFF)) - ^ (piQxelXor[0] & 0xFF000000); - *(addrp+1) = (*(addrp+1) & (piQxelAnd[1]|0xFFFF0000)) - ^ (piQxelXor[1] & 0xFFFF); - break; - case 2: - *addrp = (*addrp & (piQxelAnd[1]|0xFFFF)) - ^ (piQxelXor[1] & 0xFFFF0000); - *(addrp+1) = (*(addrp+1) & (piQxelAnd[2]|0xFFFFFF00)) - ^ (piQxelXor[2] & 0xFF); - break; - } - e += e1; - if (e >= 0) - { - addrb += nlwidth3; - e += e3; - } - addrb += signdx3; -#else /* PSZ == 24 */ - *addrp = DoRRop (*addrp, and, xor); - e += e1; - if (e >= 0) - { - addrp += nlwidth; - e += e3; - } - addrp += signdx; -#endif /* PSZ == 24 */ - } - } -#else /* !PIXEL_ADDR */ - register CfbBits tmp, bit; - CfbBits leftbit, rightbit; - - /* point to longword containing first point */ -#if PSZ == 24 - addrl = (addrl + (y1 * nlwidth) + ((x1 * 3) >>2); -#else - addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH)); -#endif - if (signdy < 0) - nlwidth = -nlwidth; - e = e-e1; /* to make looping easier */ - - leftbit = cfbmask[0]; -#if PSZ == 24 - rightbit = cfbmask[(PPW-1)<<1]; - bit = cfbmask[(x1 & 3)<<1]; -#else - rightbit = cfbmask[PPW-1]; - bit = cfbmask[x1 & PIM]; -#endif - - if (axis == X_AXIS) - { - if (signdx > 0) - { - while (len--) - { - *addrl = DoMaskRRop (*addrl, and, xor, bit); - bit = SCRRIGHT(bit,1); - e += e1; - if (e >= 0) - { - addrl += nlwidth; - e += e3; - } - if (!bit) - { - bit = leftbit; - addrl++; - } - } - } - else - { - while (len--) - { - *addrl = DoMaskRRop (*addrl, and, xor, bit); - e += e1; - bit = SCRLEFT(bit,1); - if (e >= 0) - { - addrl += nlwidth; - e += e3; - } - if (!bit) - { - bit = rightbit; - addrl--; - } - } - } - } /* if X_AXIS */ - else - { - if (signdx > 0) - { - while(len--) - { - *addrl = DoMaskRRop (*addrl, and, xor, bit); - e += e1; - if (e >= 0) - { - bit = SCRRIGHT(bit,1); - if (!bit) - { - bit = leftbit; - addrl++; - } - e += e3; - } - addrl += nlwidth; - } - } - else - { - while(len--) - { - *addrl = DoMaskRRop (*addrl, and, xor, bit); - e += e1; - if (e >= 0) - { - bit = SCRLEFT(bit,1); - if (!bit) - { - bit = rightbit; - addrl--; - } - e += e3; - } - addrl += nlwidth; - } - } - } /* else Y_AXIS */ -#endif -} diff --git a/cfb/cfbbresd.c b/cfb/cfbbresd.c deleted file mode 100644 index ee48a74ec..000000000 --- a/cfb/cfbbresd.c +++ /dev/null @@ -1,404 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "misc.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "miline.h" - -/* Dashed bresenham line */ - -void -cfbBresD(rrops, - pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, e, e1, e2, len) - cfbRRopPtr rrops; - int *pdashIndex; /* current dash */ - unsigned char *pDash; /* dash list */ - int numInDashList; /* total length of dash list */ - int *pdashOffset; /* offset into current dash */ - int isDoubleDash; - CfbBits *addrl; /* pointer to base of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - int signdx, signdy; /* signs of directions */ - int axis; /* major axis (Y_AXIS or X_AXIS) */ - int x1, y1; /* initial point */ - register int e; /* error accumulator */ - register int e1; /* bresenham increments */ - int e2; - int len; /* length of line */ -{ -#ifdef PIXEL_ADDR - register PixelType *addrp; -#endif - register int e3 = e2-e1; - int dashIndex; - int dashOffset; - int dashRemaining; - CfbBits xorFg, andFg, xorBg, andBg; - Bool isCopy; - int thisDash; -#if PSZ == 24 - CfbBits xorPiQxlFg[3], andPiQxlFg[3], xorPiQxlBg[3], andPiQxlBg[3]; - char *addrb; - int signdx3, signdy3; -#endif - - dashOffset = *pdashOffset; - dashIndex = *pdashIndex; - isCopy = (rrops[0].rop == GXcopy && rrops[1].rop == GXcopy); -#if PSZ == 24 - xorFg = rrops[0].xor & 0xffffff; - andFg = rrops[0].and & 0xffffff; - xorBg = rrops[1].xor & 0xffffff; - andBg = rrops[1].and & 0xffffff; - xorPiQxlFg[0] = xorFg | (xorFg << 24); - xorPiQxlFg[1] = (xorFg >> 8) | (xorFg << 16); - xorPiQxlFg[2] = (xorFg >> 16) | (xorFg << 8); - andPiQxlFg[0] = andFg | (andFg << 24); - andPiQxlFg[1] = (andFg >> 8) | (andFg << 16); - andPiQxlFg[2] = (andFg >> 16) | (andFg << 8); - xorPiQxlBg[0] = xorBg | (xorBg << 24); - xorPiQxlBg[1] = (xorBg >> 8) | (xorBg << 16); - xorPiQxlBg[2] = (xorBg >> 16) | (xorBg << 8); - andPiQxlBg[0] = andBg | (andBg << 24); - andPiQxlBg[1] = (andBg >> 8) | (andBg << 16); - andPiQxlBg[2] = (andFg >> 16) | (andBg << 8); -#else - xorFg = rrops[0].xor; - andFg = rrops[0].and; - xorBg = rrops[1].xor; - andBg = rrops[1].and; -#endif - dashRemaining = pDash[dashIndex] - dashOffset; - if ((thisDash = dashRemaining) >= len) - { - thisDash = len; - dashRemaining -= len; - } - e = e-e1; /* to make looping easier */ - -#define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;} - -#define NextDash {\ - dashIndex++; \ - if (dashIndex == numInDashList) \ - dashIndex = 0; \ - dashRemaining = pDash[dashIndex]; \ - if ((thisDash = dashRemaining) >= len) \ - { \ - dashRemaining -= len; \ - thisDash = len; \ - } \ -} - -#ifdef PIXEL_ADDR - -#if PSZ == 24 -#define Loop(store) while (thisDash--) {\ - store; \ - BresStep(addrb+=signdy3,addrb+=signdx3) \ - } - /* point to first point */ - nlwidth <<= PWSH; - addrp = (PixelType *)(addrl) + (y1 * nlwidth); - addrb = (char *)addrp + x1 * 3; - -#else -#define Loop(store) while (thisDash--) {\ - store; \ - BresStep(addrp+=signdy,addrp+=signdx) \ - } - /* point to first point */ - nlwidth <<= PWSH; - addrp = (PixelType *)(addrl) + (y1 * nlwidth) + x1; -#endif - signdy *= nlwidth; -#if PSZ == 24 - signdx3 = signdx * 3; - signdy3 = signdy * sizeof (CfbBits); -#endif - if (axis == Y_AXIS) - { - int t; - - t = signdx; - signdx = signdy; - signdy = t; -#if PSZ == 24 - t = signdx3; - signdx3 = signdy3; - signdy3 = t; -#endif - } - - if (isCopy) - { -#if PSZ == 24 -#define body_copy(pix) { \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp = (*addrp & 0xFF000000)|((pix)[0] & 0xFFFFFF); \ - break; \ - case 1: \ - *addrp = (*addrp & 0xFF)|((pix)[2] & 0xFFFFFF00); \ - break; \ - case 3: \ - *addrp = (*addrp & 0xFFFFFF)|((pix)[0] & 0xFF000000); \ - *(addrp+1) = (*(addrp+1) & 0xFFFF0000)|((pix)[1] & 0xFFFF); \ - break; \ - case 2: \ - *addrp = (*addrp & 0xFFFF)|((pix)[1] & 0xFFFF0000); \ - *(addrp+1) = (*(addrp+1) & 0xFFFFFF00)|((pix)[2] & 0xFF); \ - break; \ - } \ -} -#endif /* PSZ == 24 */ - - for (;;) - { - len -= thisDash; - if (dashIndex & 1) { - if (isDoubleDash) { -#if PSZ == 24 - Loop(body_copy(xorPiQxlBg)) -#else - Loop(*addrp = xorBg) -#endif - } else { - Loop(;) - } - } else { -#if PSZ == 24 - Loop(body_copy(xorPiQxlFg)) -#else - Loop(*addrp = xorFg) -#endif - } - if (!len) - break; - NextDash - } -#undef body_copy - } - else - { -#define body_set(and, xor) { \ - addrp = (PixelType *)((unsigned long)addrb & ~0x03); \ - switch((unsigned long)addrb & 3){ \ - case 0: \ - *addrp = (*addrp & ((and)[0]|0xFF000000)) ^ ((xor)[0] & 0xFFFFFF); \ - break; \ - case 1: \ - *addrp = (*addrp & ((and)[2]|0xFF)) ^ ((xor)[2] & 0xFFFFFF00); \ - break; \ - case 3: \ - *addrp = (*addrp & ((and)[0]|0xFFFFFF)) ^ ((xor)[0] & 0xFF000000); \ - *(addrp+1)=(*(addrp+1)&((and)[1]|0xFFFF0000)) ^ ((xor)[1]&0xFFFF); \ - break; \ - case 2: \ - *addrp = (*addrp & ((and)[1]|0xFFFF)) ^ ((xor)[1] & 0xFFFF0000); \ - *(addrp+1)=(*(addrp+1)&((and)[2]|0xFFFFFF00)) ^ ((xor)[2] & 0xFF); \ - break; \ - } \ -} - - for (;;) - { - len -= thisDash; - if (dashIndex & 1) { - if (isDoubleDash) { -#if PSZ == 24 - Loop(body_set(andPiQxlBg, xorPiQxlBg)) -#else - Loop(*addrp = DoRRop(*addrp,andBg, xorBg)) -#endif - } else { - Loop(;) - } - } else { -#if PSZ == 24 - Loop(body_set(andPiQxlFg, xorPiQxlFg)) -#else - Loop(*addrp = DoRRop(*addrp,andFg, xorFg)) -#endif - } - if (!len) - break; - NextDash - } -#undef body_set - } -#else /* !PIXEL_ADDR */ - { - register CfbBits tmp; - CfbBits startbit, bit; - - /* point to longword containing first point */ -#if PSZ == 24 - addrl = (addrl + (y1 * nlwidth) + ((x1*3) >> 2); -#else - addrl = (addrl + (y1 * nlwidth) + (x1 >> PWSH)); -#endif - signdy = signdy * nlwidth; - - if (signdx > 0) - startbit = cfbmask[0]; - else -#if PSZ == 24 - startbit = cfbmask[(PPW-1)<<1]; - bit = cfbmask[(x1 & 3)<<1]; -#else - startbit = cfbmask[PPW-1]; - bit = cfbmask[x1 & PIM]; -#endif - -#if PSZ == 24 -#define X_Loop(store) while(thisDash--) {\ - store; \ - BresStep(addrl += signdy, \ - if (signdx > 0) \ - bit = SCRRIGHT(bit,1); \ - else \ - bit = SCRLEFT(bit,1); \ - if (!bit) \ - { \ - bit = startbit; \ - addrl += signdx; \ - }) \ - } -#define Y_Loop(store) while(thisDash--) {\ - store; \ - BresStep(if (signdx > 0) \ - bit = SCRRIGHT(bit,1); \ - else \ - bit = SCRLEFT(bit,1); \ - if (!bit) \ - { \ - bit = startbit; \ - addrl += signdx; \ - }, \ - addrl += signdy) \ - } -#else -#define X_Loop(store) while(thisDash--) {\ - store; \ - BresStep(addrl += signdy, \ - if (signdx > 0) \ - bit = SCRRIGHT(bit,1); \ - else \ - bit = SCRLEFT(bit,1); \ - if (!bit) \ - { \ - bit = startbit; \ - addrl += signdx; \ - }) \ - } -#define Y_Loop(store) while(thisDash--) {\ - store; \ - BresStep(if (signdx > 0) \ - bit = SCRRIGHT(bit,1); \ - else \ - bit = SCRLEFT(bit,1); \ - if (!bit) \ - { \ - bit = startbit; \ - addrl += signdx; \ - }, \ - addrl += signdy) \ - } -#endif - - if (axis == X_AXIS) - { - for (;;) - { - len -= thisDash; - if (dashIndex & 1) { - if (isDoubleDash) { - X_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit)); - } else { - X_Loop(;) - } - } else { - X_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit)); - } - if (!len) - break; - NextDash - } - } /* if X_AXIS */ - else - { - for (;;) - { - len -= thisDash; - if (dashIndex & 1) { - if (isDoubleDash) { - Y_Loop(*addrl = DoMaskRRop(*addrl, andBg, xorBg, bit)); - } else { - Y_Loop(;) - } - } else { - Y_Loop(*addrl = DoMaskRRop(*addrl, andFg, xorFg, bit)); - } - if (!len) - break; - NextDash - } - } /* else Y_AXIS */ - } -#endif - *pdashIndex = dashIndex; - *pdashOffset = pDash[dashIndex] - dashRemaining; -} diff --git a/cfb/cfbcmap.c b/cfb/cfbcmap.c deleted file mode 100644 index b96f67170..000000000 --- a/cfb/cfbcmap.c +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "scrnintstr.h" -#include "colormapst.h" -#include "resource.h" -#include "micmap.h" -#include "cfb.h" - -int -cfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) -{ - return miListInstalledColormaps(pScreen, pmaps); -} - -void -cfbInstallColormap(ColormapPtr pmap) -{ - miInstallColormap(pmap); -} - -void -cfbUninstallColormap(ColormapPtr pmap) -{ - miUninstallColormap(pmap); -} - -void -cfbResolveColor(unsigned short *pred, - unsigned short *pgreen, - unsigned short *pblue, - VisualPtr pVisual) -{ - miResolveColor(pred, pgreen, pblue, pVisual); -} - -Bool -cfbInitializeColormap(ColormapPtr pmap) -{ - return miInitializeColormap(pmap); -} - -int -cfbExpandDirectColors (ColormapPtr pmap, int ndef, - xColorItem *indefs, xColorItem *outdefs) -{ - return miExpandDirectColors(pmap, ndef, indefs, outdefs); -} - -Bool -cfbCreateDefColormap(ScreenPtr pScreen) -{ - return miCreateDefColormap(pScreen); -} - -void -cfbClearVisualTypes(void) -{ - miClearVisualTypes(); -} - -Bool -cfbSetVisualTypes (int depth, int visuals, int bitsPerRGB) -{ - return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); -} - -/* - * Given a list of formats for a screen, create a list - * of visuals and depths for the screen which coorespond to - * the set which can be used with this version of cfb. - */ - -Bool -cfbInitVisuals (VisualPtr *visualp, - DepthPtr *depthp, - int *nvisualp, - int *ndepthp, - int *rootDepthp, - VisualID *defaultVisp, - unsigned long sizes, - int bitsPerRGB) -{ - return miInitVisuals(visualp, depthp, nvisualp, ndepthp, rootDepthp, - defaultVisp, sizes, bitsPerRGB, -1); -} diff --git a/cfb/cfbcppl.c b/cfb/cfbcppl.c deleted file mode 100644 index 00714cbc4..000000000 --- a/cfb/cfbcppl.c +++ /dev/null @@ -1,486 +0,0 @@ -/* -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "cfb.h" -#if PSZ == 8 -#undef PSZ /* for maskbits.h */ -#include "maskbits.h" -#define PSZ 8 -#include "mergerop.h" -#endif - - -void -cfbCopyImagePlane( - DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask) -{ - /* note: there must be some sort of trick behind, - passing a planemask value with all bits set - whilst using the current planemask for the bitPlane value. */ -#if PSZ == 8 - cfbCopyPlane8to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, - (unsigned long) ~0L, planemask); -#endif -#if PSZ == 16 - cfbCopyPlane16to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, - (unsigned long) ~0L, planemask); -#endif -#if PSZ == 24 - cfbCopyPlane24to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, - (unsigned long) ~0L, planemask); -#endif -#if PSZ == 32 - cfbCopyPlane32to1 (pSrcDrawable, pDstDrawable, rop, prgnDst, pptSrc, - (unsigned long) ~0L, planemask); -#endif -} - -#if PSZ == 8 - -#if BITMAP_BIT_ORDER == MSBFirst -#define LeftMost (MFB_PPW-1) -#define StepBit(bit, inc) ((bit) -= (inc)) -#else -#define LeftMost 0 -#define StepBit(bit, inc) ((bit) += (inc)) -#endif - -#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ - bits = 0; \ - while (nBits--) \ - { \ - bits |= (PixelType)(((*psrc++ >> bitPos) & 1)) << curBit; \ - StepBit (curBit, 1); \ - } \ -} - -void -cfbCopyPlane8to1( - DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask, - unsigned long bitPlane) -{ - int srcx, srcy, dstx, dsty, width, height; - unsigned char *psrcBase; - PixelType *pdstBase; - int widthSrc, widthDst; - unsigned char *psrcLine; - PixelType *pdstLine; - register unsigned char *psrc; - register int i; - register int curBit; - register int bitPos; - register CfbBits bits; - register PixelType *pdst; - PixelType startmask, endmask; - int niStart = 0, niEnd = 0; - int bitStart = 0, bitEnd = 0; - int nl, nlMiddle; - int nbox; - BoxPtr pbox; - MROP_DECLARE() - - if (!(planemask & 1)) - return; - - if (rop != GXcopy) - MROP_INITIALIZE (rop, planemask); - - cfbGetByteWidthAndPointer (pSrcDrawable, widthSrc, psrcBase) - - mfbGetPixelWidthAndPointer (pDstDrawable, widthDst, pdstBase) - - bitPos = ffs (bitPlane) - 1; - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; - psrcLine = psrcBase + srcy * widthSrc + srcx; - pdstLine = mfbScanline(pdstBase, dstx, dsty, widthDst); - dstx &= MFB_PIM; - if (dstx + width <= MFB_PPW) - { - maskpartialbits(dstx, width, startmask); - nlMiddle = 0; - endmask = 0; - } - else - { - maskbits (dstx, width, startmask, endmask, nlMiddle); - } - if (startmask) - { - niStart = min(MFB_PPW - dstx, width); - bitStart = LeftMost; - StepBit (bitStart, dstx); - } - if (endmask) - { - niEnd = (dstx + width) & MFB_PIM; - bitEnd = LeftMost; - } - if (rop == GXcopy) - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - mfbScanlineInc(pdstLine, widthDst); - if (startmask) - { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = (*pdst & ~startmask) | bits; - pdst++; - } - nl = nlMiddle; - while (nl--) - { - i = MFB_PPW; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst++ = bits; - } - if (endmask) - { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = (*pdst & ~endmask) | bits; - } - } - } - else - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - mfbScanlineInc(pdstLine, widthDst); - if (startmask) - { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = MROP_MASK(bits, *pdst, startmask); - pdst++; - } - nl = nlMiddle; - while (nl--) - { - i = MFB_PPW; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = MROP_SOLID(bits, *pdst); - pdst++; - } - if (endmask) - { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst = MROP_MASK (bits, *pdst, endmask); - } - } - } - } -} - -#else /* PSZ == 8 */ - -#define mfbmaskbits(x, w, startmask, endmask, nlw) \ - startmask = mfbGetstarttab((x)&0x1f); \ - endmask = mfbGetendtab(((x)+(w)) & 0x1f); \ - if (startmask) \ - nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \ - else \ - nlw = (w) >> 5; - -#define mfbmaskpartialbits(x, w, mask) \ - mask = mfbGetpartmasks((x)&0x1f,(w)&0x1f); - -#define LeftMost 0 -#define StepBit(bit, inc) ((bit) += (inc)) - - -#if PSZ == 24 -#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ - bits = 0; \ - while (nBits--) \ - { \ - if (bitPos < 8) \ - { \ - bits |= ((*psrc++ >> bitPos) & 1) << curBit; \ - psrc += 2; \ - } \ - else if (bitPos < 16) \ - { \ - psrc++; \ - bits |= ((*psrc++ >> (bitPos - 8)) & 1) << curBit; \ - psrc++; \ - } \ - else \ - { \ - psrc += 2; \ - bits |= ((*psrc++ >> (bitPos - 16)) & 1) << curBit; \ - } \ - StepBit (curBit, 1); \ - } \ -} -#else -#define GetBits(psrc, nBits, curBit, bitPos, bits) {\ - bits = 0; \ - while (nBits--) \ - { \ - bits |= ((*psrc++ >> bitPos) & 1) << curBit; \ - StepBit (curBit, 1); \ - } \ -} -#endif - -void -#if PSZ == 16 -cfbCopyPlane16to1 -#endif -#if PSZ == 24 -cfbCopyPlane24to1 -#endif -#if PSZ == 32 -cfbCopyPlane32to1 -#endif -( - DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask, - unsigned long bitPlane) -{ - int srcx, srcy, dstx, dsty, width, height; - CfbBits *psrcBase; - CfbBits *pdstBase; - int widthSrc, widthDst; -#if PSZ == 16 - unsigned short *psrcLine; - register unsigned short *psrc; -#endif -#if PSZ == 24 - unsigned char *psrcLine; - register unsigned char *psrc; -#endif -#if PSZ == 32 - unsigned int *psrcLine; - register unsigned int *psrc; -#endif - unsigned int *pdstLine; - register unsigned int *pdst; - register int i; - register int curBit; - register int bitPos; - register unsigned int bits; - unsigned int startmask = 0, endmask = 0; - int niStart = 0, niEnd = 0; - int bitStart = 0, bitEnd = 0; - int nl, nlMiddle; - int nbox; - BoxPtr pbox; - int result; - - - if (!(planemask & 1)) - return; - - /* must explicitly ask for "int" widths, as code below expects it */ - /* on some machines (Alpha), "long" and "int" are not the same size */ - cfbGetTypedWidthAndPointer (pSrcDrawable, widthSrc, psrcBase, int, CfbBits) - cfbGetTypedWidthAndPointer (pDstDrawable, widthDst, pdstBase, int, CfbBits) - -#if PSZ == 16 - widthSrc <<= 1; -#endif -#if PSZ == 24 - widthSrc <<= 2; -#endif - - bitPos = ffs (bitPlane) - 1; - - nbox = REGION_NUM_RECTS(prgnDst); - pbox = REGION_RECTS(prgnDst); - while (nbox--) - { - dstx = pbox->x1; - dsty = pbox->y1; - srcx = pptSrc->x; - srcy = pptSrc->y; - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - pbox++; - pptSrc++; -#if PSZ == 16 - psrcLine = (unsigned short *)psrcBase + srcy * widthSrc + srcx; -#endif -#if PSZ == 24 - psrcLine = (unsigned char *)psrcBase + srcy * widthSrc + srcx * 3; -#endif -#if PSZ == 32 - psrcLine = (unsigned int *)psrcBase + srcy * widthSrc + srcx; -#endif - pdstLine = (unsigned int *)pdstBase + dsty * widthDst + (dstx >> 5); - if (dstx + width <= 32) - { - mfbmaskpartialbits(dstx, width, startmask); - nlMiddle = 0; - endmask = 0; - } - else - { - mfbmaskbits (dstx, width, startmask, endmask, nlMiddle); - } - if (startmask) - { - niStart = 32 - (dstx & 0x1f); - bitStart = LeftMost; - StepBit (bitStart, (dstx & 0x1f)); - } - if (endmask) - { - niEnd = (dstx + width) & 0x1f; - bitEnd = LeftMost; - } - if (rop == GXcopy) - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - if (startmask) - { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - - *pdst = (*pdst & ~startmask) | bits; - pdst++; - } - nl = nlMiddle; - while (nl--) - { - i = 32; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - *pdst++ = bits; - } - if (endmask) - { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - - *pdst = (*pdst & ~endmask) | bits; - } - } - } - else - { - while (height--) - { - psrc = psrcLine; - pdst = pdstLine; - psrcLine += widthSrc; - pdstLine += widthDst; - if (startmask) - { - i = niStart; - curBit = bitStart; - GetBits (psrc, i, curBit, bitPos, bits); - DoRop (result, rop, bits, *pdst); - - *pdst = (*pdst & ~startmask) | - (result & startmask); - pdst++; - } - nl = nlMiddle; - while (nl--) - { - i = 32; - curBit = LeftMost; - GetBits (psrc, i, curBit, bitPos, bits); - DoRop (result, rop, bits, *pdst); - *pdst = result; - ++pdst; - } - if (endmask) - { - i = niEnd; - curBit = bitEnd; - GetBits (psrc, i, curBit, bitPos, bits); - DoRop (result, rop, bits, *pdst); - - *pdst = (*pdst & ~endmask) | - (result & endmask); - } - } - } - } -} - -#endif /* PSZ == 8 */ diff --git a/cfb/cfbfillarc.c b/cfb/cfbfillarc.c deleted file mode 100644 index 0eb5ff469..000000000 --- a/cfb/cfbfillarc.c +++ /dev/null @@ -1,374 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -********************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include "regionstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "mifillarc.h" -#include "cfbrrop.h" -#include "mi.h" - -/* gcc 1.35 is stupid */ -#if defined(__GNUC__) && __GNUC__ < 2 && defined(mc68020) -#define STUPID volatile -#else -#define STUPID -#endif - -static void -RROP_NAME(cfbFillEllipseSolid)( - DrawablePtr pDraw, - GCPtr pGC, - xArc *arc) -{ - STUPID int x, y, e; - STUPID int yk, xk, ym, xm, dx, dy, xorg, yorg; - miFillArcRec info; -#if PSZ == 24 - unsigned char *addrlt, *addrlb; -#else - CfbBits *addrlt, *addrlb; -#endif - register CfbBits *addrl; - register int n; - int nlwidth; - RROP_DECLARE - register int xpos; - register int slw; - CfbBits startmask, endmask; - int nlmiddle; -#if PSZ == 24 - register int pidx; - int xpos3; -#endif - -#if PSZ == 24 - cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt) -#else - cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) -#endif - - RROP_FETCH_GC(pGC); - miFillArcSetup(arc, &info); - MIFILLARCSETUP(); - xorg += pDraw->x; - yorg += pDraw->y; - addrlb = addrlt; - addrlt += nlwidth * (yorg - y); - addrlb += nlwidth * (yorg + y + dy); - while (y) - { - addrlt += nlwidth; - addrlb -= nlwidth; - MIFILLARCSTEP(slw); - if (!slw) - continue; - xpos = xorg - x; -#if PSZ == 24 - xpos3 = (xpos * 3) & ~0x03; - addrl = (CfbBits *)((char *)addrlt + xpos3); - if (slw == 1){ - RROP_SOLID24(addrl, xpos); - if (miFillArcLower(slw)){ - addrl = (CfbBits *)((char *)addrlb + xpos3); - RROP_SOLID24(addrl, xpos); - } - continue; - } - maskbits(xpos, slw, startmask, endmask, nlmiddle); - xpos &= 3; - pidx = xpos; - if (startmask){ - RROP_SOLID_MASK(addrl, startmask, pidx-1); - addrl++; - if (pidx == 3) - pidx = 0; - } - n = nlmiddle; - while (--n >= 0){ - RROP_SOLID(addrl, pidx); - addrl++; - if (++pidx == 3) - pidx = 0; - } - if (endmask) - RROP_SOLID_MASK(addrl, endmask, pidx); - if (!miFillArcLower(slw)) - continue; - addrl = (CfbBits *)((char *)addrlb + xpos3); - pidx = xpos; - if (startmask){ - RROP_SOLID_MASK(addrl, startmask, pidx-1); - addrl++; - if (pidx == 3) - pidx = 0; - } - n = nlmiddle; - while (--n >= 0){ - RROP_SOLID(addrl, pidx); - addrl++; - if (++pidx == 3) - pidx = 0; - } - if (endmask) - RROP_SOLID_MASK(addrl, endmask, pidx); -#else /* PSZ == 24 */ - addrl = addrlt + (xpos >> PWSH); - if (((xpos & PIM) + slw) <= PPW) - { - maskpartialbits(xpos, slw, startmask); - RROP_SOLID_MASK(addrl,startmask); - if (miFillArcLower(slw)) - { - addrl = addrlb + (xpos >> PWSH); - RROP_SOLID_MASK(addrl, startmask); - } - continue; - } - maskbits(xpos, slw, startmask, endmask, nlmiddle); - if (startmask) - { - RROP_SOLID_MASK(addrl, startmask); - addrl++; - } - n = nlmiddle; - RROP_SPAN(addrl,n) - - if (endmask) - RROP_SOLID_MASK(addrl, endmask); - if (!miFillArcLower(slw)) - continue; - addrl = addrlb + (xpos >> PWSH); - if (startmask) - { - RROP_SOLID_MASK(addrl, startmask); - addrl++; - } - n = nlmiddle; - RROP_SPAN(addrl, n); - if (endmask) - RROP_SOLID_MASK(addrl, endmask); -#endif /* PSZ == 24 */ - } - RROP_UNDECLARE -} - -#if PSZ == 24 -#define FILLSPAN(xl,xr,addr) \ - if (xr >= xl){ \ - n = xr - xl + 1; \ - addrl = (CfbBits *)((char *)addr + ((xl * 3) & ~0x03)); \ - if (n <= 1){ \ - if (n) \ - RROP_SOLID24(addrl, xl); \ - } else { \ - maskbits(xl, n, startmask, endmask, n); \ - pidx = xl & 3; \ - if (startmask){ \ - RROP_SOLID_MASK(addrl, startmask, pidx-1); \ - addrl++; \ - if (pidx == 3) \ - pidx = 0; \ - } \ - while (--n >= 0){ \ - RROP_SOLID(addrl, pidx); \ - addrl++; \ - if (++pidx == 3) \ - pidx = 0; \ - } \ - if (endmask) \ - RROP_SOLID_MASK(addrl, endmask, pidx); \ - } \ - } -#else /* PSZ == 24 */ -#define FILLSPAN(xl,xr,addr) \ - if (xr >= xl) \ - { \ - n = xr - xl + 1; \ - addrl = addr + (xl >> PWSH); \ - if (((xl & PIM) + n) <= PPW) \ - { \ - maskpartialbits(xl, n, startmask); \ - RROP_SOLID_MASK(addrl, startmask); \ - } \ - else \ - { \ - maskbits(xl, n, startmask, endmask, n); \ - if (startmask) \ - { \ - RROP_SOLID_MASK(addrl, startmask); \ - addrl++; \ - } \ - while (n--) \ - { \ - RROP_SOLID(addrl); \ - ++addrl; \ - } \ - if (endmask) \ - RROP_SOLID_MASK(addrl, endmask); \ - } \ - } -#endif /* PSZ == 24 */ - -#define FILLSLICESPANS(flip,addr) \ - if (!flip) \ - { \ - FILLSPAN(xl, xr, addr); \ - } \ - else \ - { \ - xc = xorg - x; \ - FILLSPAN(xc, xr, addr); \ - xc += slw - 1; \ - FILLSPAN(xl, xc, addr); \ - } - -static void -RROP_NAME(cfbFillArcSliceSolid)( - DrawablePtr pDraw, - GCPtr pGC, - xArc *arc) -{ - int yk, xk, ym, xm, dx, dy, xorg, yorg, slw; - register int x, y, e; - miFillArcRec info; - miArcSliceRec slice; - int xl, xr, xc; -#if PSZ == 24 - unsigned char *addrlt, *addrlb; -#else - CfbBits *addrlt, *addrlb; -#endif - register CfbBits *addrl; - register int n; - int nlwidth; - RROP_DECLARE - CfbBits startmask, endmask; -#if PSZ == 24 - register int pidx; -#endif /* PSZ == 24 */ - -#if PSZ == 24 - cfbGetByteWidthAndPointer (pDraw, nlwidth, addrlt) -#else - cfbGetLongWidthAndPointer (pDraw, nlwidth, addrlt) -#endif - - RROP_FETCH_GC(pGC); - miFillArcSetup(arc, &info); - miFillArcSliceSetup(arc, &slice, pGC); - MIFILLARCSETUP(); - xorg += pDraw->x; - yorg += pDraw->y; - addrlb = addrlt; - addrlt += nlwidth * (yorg - y); - addrlb += nlwidth * (yorg + y + dy); - slice.edge1.x += pDraw->x; - slice.edge2.x += pDraw->x; - while (y > 0) - { - addrlt += nlwidth; - addrlb -= nlwidth; - MIFILLARCSTEP(slw); - MIARCSLICESTEP(slice.edge1); - MIARCSLICESTEP(slice.edge2); - if (miFillSliceUpper(slice)) - { - MIARCSLICEUPPER(xl, xr, slice, slw); - FILLSLICESPANS(slice.flip_top, addrlt); - } - if (miFillSliceLower(slice)) - { - MIARCSLICELOWER(xl, xr, slice, slw); - FILLSLICESPANS(slice.flip_bot, addrlb); - } - } - RROP_UNDECLARE -} - -void -RROP_NAME(cfbPolyFillArcSolid) (pDraw, pGC, narcs, parcs) - DrawablePtr pDraw; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - register xArc *arc; - register int i; - int x2, y2; - BoxRec box; - RegionPtr cclip; - - cclip = cfbGetCompositeClip(pGC); - for (arc = parcs, i = narcs; --i >= 0; arc++) - { - if (miFillArcEmpty(arc)) - continue; - if (miCanFillArc(arc)) - { - box.x1 = arc->x + pDraw->x; - box.y1 = arc->y + pDraw->y; - /* - * Because box.x2 and box.y2 get truncated to 16 bits, and the - * RECT_IN_REGION test treats the resulting number as a signed - * integer, the RECT_IN_REGION test alone can go the wrong way. - * This can result in a server crash because the rendering - * routines in this file deal directly with cpu addresses - * of pixels to be stored, and do not clip or otherwise check - * that all such addresses are within their respective pixmaps. - * So we only allow the RECT_IN_REGION test to be used for - * values that can be expressed correctly in a signed short. - */ - x2 = box.x1 + (int)arc->width + 1; - box.x2 = x2; - y2 = box.y1 + (int)arc->height + 1; - box.y2 = y2; - if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && - (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) - { - if ((arc->angle2 >= FULLCIRCLE) || - (arc->angle2 <= -FULLCIRCLE)) - RROP_NAME(cfbFillEllipseSolid)(pDraw, pGC, arc); - else - RROP_NAME(cfbFillArcSliceSolid)(pDraw, pGC, arc); - continue; - } - } - miPolyFillArc(pDraw, pGC, 1, arc); - } -} diff --git a/cfb/cfbfillrct.c b/cfb/cfbfillrct.c deleted file mode 100644 index fc2d31bdc..000000000 --- a/cfb/cfbfillrct.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Fill rectangles. - */ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" -#include "mi.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "mergerop.h" - - -void -cfbFillBoxTileOdd (pDrawable, n, rects, tile, xrot, yrot) - DrawablePtr pDrawable; - int n; - BoxPtr rects; - PixmapPtr tile; - int xrot, yrot; -{ -#if PSZ == 24 - if (tile->drawable.width & 3) -#else - if (tile->drawable.width & PIM) -#endif - cfbFillBoxTileOddCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L); - else - cfbFillBoxTile32sCopy (pDrawable, n, rects, tile, xrot, yrot, GXcopy, ~0L); -} - -void -cfbFillRectTileOdd (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; - BoxPtr pBox; -{ - int xrot, yrot; - void (*fill)(DrawablePtr, int, BoxPtr, PixmapPtr, int, int, int, unsigned long); - - xrot = pDrawable->x + pGC->patOrg.x; - yrot = pDrawable->y + pGC->patOrg.y; -#if PSZ == 24 - if (pGC->tile.pixmap->drawable.width & 3) -#else - if (pGC->tile.pixmap->drawable.width & PIM) -#endif - { - fill = cfbFillBoxTileOddGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = cfbFillBoxTileOddCopy; - } - } - else - { - fill = cfbFillBoxTile32sGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = cfbFillBoxTile32sCopy; - } - } - (*fill) (pDrawable, nBox, pBox, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); -} - -#define NUM_STACK_RECTS 1024 - -void -cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) - DrawablePtr pDrawable; - register GCPtr pGC; - int nrectFill; /* number of rectangles to fill */ - xRectangle *prectInit; /* Pointer to first rectangle to fill */ -{ - xRectangle *prect; - RegionPtr prgnClip; - register BoxPtr pbox; - register BoxPtr pboxClipped; - BoxPtr pboxClippedBase; - BoxPtr pextent; - BoxRec stackRects[NUM_STACK_RECTS]; - cfbPrivGC *priv; - int numRects; - void (*BoxFill)(DrawablePtr, GCPtr, int, BoxPtr); - int n; - int xorg, yorg; - -#if PSZ != 8 - if ((pGC->fillStyle == FillStippled) || - (pGC->fillStyle == FillOpaqueStippled)) { - miPolyFillRect(pDrawable, pGC, nrectFill, prectInit); - return; - } -#endif - - priv = cfbGetGCPrivate(pGC); - prgnClip = pGC->pCompositeClip; - - BoxFill = 0; - switch (pGC->fillStyle) - { - case FillSolid: - switch (priv->rop) { - case GXcopy: - BoxFill = cfbFillRectSolidCopy; - break; - case GXxor: - BoxFill = cfbFillRectSolidXor; - break; - default: - BoxFill = cfbFillRectSolidGeneral; - break; - } - break; - case FillTiled: - if (!pGC->pRotatedPixmap) - BoxFill = cfbFillRectTileOdd; - else - { - if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) - BoxFill = cfbFillRectTile32Copy; - else - BoxFill = cfbFillRectTile32General; - } - break; -#if PSZ == 8 - case FillStippled: - if (!pGC->pRotatedPixmap) - BoxFill = cfb8FillRectStippledUnnatural; - else - BoxFill = cfb8FillRectTransparentStippled32; - break; - case FillOpaqueStippled: - if (!pGC->pRotatedPixmap) - BoxFill = cfb8FillRectStippledUnnatural; - else - BoxFill = cfb8FillRectOpaqueStippled32; - break; -#endif - } - prect = prectInit; - 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) - (*BoxFill) (pDrawable, pGC, - pboxClipped-pboxClippedBase, pboxClippedBase); - if (pboxClippedBase != stackRects) - xfree(pboxClippedBase); -} diff --git a/cfb/cfbfillsp.c b/cfb/cfbfillsp.c deleted file mode 100644 index 36710b612..000000000 --- a/cfb/cfbfillsp.c +++ /dev/null @@ -1,1004 +0,0 @@ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" - -#include "mergerop.h" - -#if PSZ == 8 -#include "cfb8bit.h" -#endif - -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -#include "mi.h" -#include "mispans.h" - -/* scanline filling for color frame buffer - written by drewry, oct 1986 modified by smarks - changes for compatibility with Little-endian systems Jul 1987; MIT:yba. - - these routines all clip. they assume that anything that has called -them has already translated the points (i.e. pGC->miTranslate is -non-zero, which is howit gets set in cfbCreateGC().) - - the number of new scnalines created by clipping == -MaxRectsPerBand * nSpans. - - FillSolid is overloaded to be used for OpaqueStipple as well, -if fgPixel == bgPixel. -Note that for solids, PrivGC.rop == PrivGC.ropOpStip - - - FillTiled is overloaded to be used for OpaqueStipple, if -fgPixel != bgPixel. based on the fill style, it uses -{RotatedTile, gc.alu} or {RotatedStipple, PrivGC.ropOpStip} -*/ - -#ifdef notdef -#include -static -dumpspans(n, ppt, pwidth) - int n; - DDXPointPtr ppt; - int *pwidth; -{ - fprintf(stderr,"%d spans\n", n); - while (n--) { - fprintf(stderr, "[%d,%d] %d\n", ppt->x, ppt->y, *pwidth); - ppt++; - pwidth++; - } - fprintf(stderr, "\n"); -} -#endif - -/* Fill spans with tiles that aren't 32 bits wide */ -void -cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) -DrawablePtr pDrawable; -GC *pGC; -int nInit; /* number of spans to fill */ -DDXPointPtr pptInit; /* pointer to list of start points */ -int *pwidthInit; /* pointer to list of n widths */ -int fSorted; -{ - int n; /* number of spans to fill */ - register DDXPointPtr ppt; /* pointer to list of start points */ - register int *pwidth; /* pointer to list of n widths */ - void (*fill)(DrawablePtr, int, DDXPointPtr, int *, PixmapPtr, int, int, int, unsigned long); - int xrot, yrot; - - if (!(pGC->planemask)) - return; - -#if PSZ == 24 - if (pGC->tile.pixmap->drawable.width & 3) -#else - if (pGC->tile.pixmap->drawable.width & PIM) -#endif - { - fill = cfbFillSpanTileOddGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = cfbFillSpanTileOddCopy; - } - } - else - { - fill = cfbFillSpanTile32sGeneral; - if ((pGC->planemask & PMSK) == PMSK) - { - if (pGC->alu == GXcopy) - fill = cfbFillSpanTile32sCopy; - } - } - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - if ( n == 0 ) - return; - pwidth = (int *)xalloc(n * sizeof(int)); - ppt = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!ppt || !pwidth) - { - if (ppt) xfree(ppt); - if (pwidth) xfree(pwidth); - return; - } - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - xrot = pDrawable->x + pGC->patOrg.x; - yrot = pDrawable->y + pGC->patOrg.y; - - (*fill) (pDrawable, n, ppt, pwidth, pGC->tile.pixmap, xrot, yrot, pGC->alu, pGC->planemask); - - xfree(ppt); - xfree(pwidth); -} - -#if PSZ == 8 - -void -cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) -DrawablePtr pDrawable; -GC *pGC; -int nInit; /* number of spans to fill */ -DDXPointPtr pptInit; /* pointer to list of start points */ -int *pwidthInit; /* pointer to list of n widths */ -int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth; /* pointer to list of n widths */ - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - CfbBits *pdstBase; /* pointer to start of bitmap */ - int nlwDst; /* width in longwords of bitmap */ - register CfbBits *pdst; /* pointer to current word in bitmap */ - PixmapPtr pStipple; /* pointer to stipple we want to fill with */ - int nlw; - int x, y, w, xrem, xSrc, ySrc; - int stwidth, stippleWidth; - int stippleHeight; - register CfbBits bits, inputBits; - register int partBitsLeft; - int nextPartBits; - int bitsLeft, bitsWhole; - CfbBits *srcTemp, *srcStart; - CfbBits *psrcBase; - CfbBits startmask, endmask; - - if (pGC->fillStyle == FillStippled) - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - else - cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - if (cfb8StippleRRop == GXnoop) - return; - - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - if ( n == 0 ) - return; - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - /* - * OK, so what's going on here? We have two Drawables: - * - * The Stipple: - * Depth = 1 - * Width = stippleWidth - * Words per scanline = stwidth - * Pointer to pixels = pStipple->devPrivate.ptr - */ - - pStipple = pGC->stipple; - - stwidth = pStipple->devKind >> PWSH; - stippleWidth = pStipple->drawable.width; - stippleHeight = pStipple->drawable.height; - psrcBase = (CfbBits *) pStipple->devPrivate.ptr; - - /* - * The Target: - * Depth = PSZ - * Width = determined from *pwidth - * Words per scanline = nlwDst - * Pointer to pixels = addrlBase - */ - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase) - - /* this replaces rotating the stipple. Instead we just adjust the offset - * at which we start grabbing bits from the stipple. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and xrem always stay within the stipple bounds. - */ - - modulus (pGC->patOrg.x, stippleWidth, xSrc); - xSrc += pDrawable->x - stippleWidth; - modulus (pGC->patOrg.y, stippleHeight, ySrc); - ySrc += pDrawable->y - stippleHeight; - - bitsWhole = stippleWidth; - - while (n--) - { - x = ppt->x; - y = ppt->y; - ppt++; - w = *pwidth++; - pdst = pdstBase + y * nlwDst + (x >> PWSH); - y = (y - ySrc) % stippleHeight; - srcStart = psrcBase + y * stwidth; - xrem = ((x & ~(PGSZB-1)) - xSrc) % stippleWidth; - srcTemp = srcStart + (xrem >> MFB_PWSH); - bitsLeft = stippleWidth - (xrem & ~MFB_PIM); - xrem &= MFB_PIM; - NextUnnaturalStippleWord - if (partBitsLeft < xrem) - FatalError ("cfbUnnaturalStippleFS bad partBitsLeft %d xrem %d", - partBitsLeft, xrem); - NextSomeBits (inputBits, xrem); - partBitsLeft -= xrem; - if (((x & PIM) + w) <= PPW) - { - maskpartialbits (x, w, startmask) - NextUnnaturalStippleBits - *pdst = MaskRRopPixels(*pdst,bits,startmask); - } - else - { - maskbits (x, w, startmask, endmask, nlw); - nextPartBits = (x & (PGSZB-1)) + w; - if (nextPartBits < partBitsLeft) - { - if (startmask) - { - MaskRRopBitGroup(pdst,GetBitGroup(inputBits),startmask) - pdst++; - NextBitGroup (inputBits); - } - while (nlw--) - { - RRopBitGroup (pdst, GetBitGroup (inputBits)); - pdst++; - NextBitGroup (inputBits); - } - if (endmask) - { - MaskRRopBitGroup(pdst,GetBitGroup(inputBits),endmask) - } - } - else if (bitsLeft != bitsWhole && nextPartBits < partBitsLeft + bitsLeft) - { - NextUnnaturalStippleBitsFast - if (startmask) - { - *pdst = MaskRRopPixels(*pdst,bits,startmask); - pdst++; - NextUnnaturalStippleBitsFast - } - while (nlw--) - { - *pdst = RRopPixels(*pdst,bits); - pdst++; - NextUnnaturalStippleBitsFast - } - if (endmask) - *pdst = MaskRRopPixels (*pdst,bits,endmask); - } - else - { - NextUnnaturalStippleBits - if (startmask) - { - *pdst = MaskRRopPixels(*pdst,bits,startmask); - pdst++; - NextUnnaturalStippleBits - } - while (nlw--) - { - *pdst = RRopPixels(*pdst,bits); - pdst++; - NextUnnaturalStippleBits - } - if (endmask) - *pdst = MaskRRopPixels(*pdst,bits,endmask); - } - } - } - xfree(pptFree); - xfree(pwidthFree); -} - -#else /* PSZ != 8 */ - -/* Fill spans with stipples that aren't 32 bits wide */ -void -cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) -DrawablePtr pDrawable; -GC *pGC; -int nInit; /* number of spans to fill */ -DDXPointPtr pptInit; /* pointer to list of start points */ -int *pwidthInit; /* pointer to list of n widths */ -int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - register DDXPointPtr ppt; /* pointer to list of start points */ - register int *pwidth; /* pointer to list of n widths */ - int iline; /* first line of tile to use */ - CfbBits *addrlBase; /* pointer to start of bitmap */ - int nlwidth; /* width in longwords of bitmap */ - register CfbBits *pdst; /* pointer to current word in bitmap */ - PixmapPtr pStipple; /* pointer to stipple we want to fill with */ - register int w; - int width, x, xrem, xSrc, ySrc; - CfbBits tmpSrc, tmpDst1, tmpDst2; - int stwidth, stippleWidth; - CfbBits *psrcS; - int rop, stiprop = 0; - int stippleHeight; - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - CfbBits fgfill, bgfill; - - if (!(pGC->planemask)) - return; - - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - if ( n == 0 ) - return; - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - rop = pGC->alu; - if (pGC->fillStyle == FillStippled) { - switch (rop) { - case GXand: - case GXcopy: - case GXnoop: - case GXor: - stiprop = rop; - break; - default: - stiprop = rop; - rop = GXcopy; - } - } - fgfill = PFILL(pGC->fgPixel); - bgfill = PFILL(pGC->bgPixel); - - /* - * OK, so what's going on here? We have two Drawables: - * - * The Stipple: - * Depth = 1 - * Width = stippleWidth - * Words per scanline = stwidth - * Pointer to pixels = pStipple->devPrivate.ptr - */ - pStipple = pGC->stipple; - - stwidth = pStipple->devKind / PGSZB; - stippleWidth = pStipple->drawable.width; - stippleHeight = pStipple->drawable.height; - - /* - * The Target: - * Depth = PSZ - * Width = determined from *pwidth - * Words per scanline = nlwidth - * Pointer to pixels = addrlBase - */ - - cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrlBase) - - /* this replaces rotating the stipple. Instead we just adjust the offset - * at which we start grabbing bits from the stipple. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and xrem always stay within the stipple bounds. - */ - modulus (pGC->patOrg.x, stippleWidth, xSrc); - xSrc += pDrawable->x - stippleWidth; - modulus (pGC->patOrg.y, stippleHeight, ySrc); - ySrc += pDrawable->y - stippleHeight; - - while (n--) - { - iline = (ppt->y - ySrc) % stippleHeight; - x = ppt->x; - pdst = addrlBase + (ppt->y * nlwidth); - psrcS = (CfbBits *) pStipple->devPrivate.ptr + (iline * stwidth); - - if (*pwidth) - { - width = *pwidth; - while(width > 0) - { - int xtemp; -#if PSZ != 32 || PPW != 1 - int tmpx; -#endif - register CfbBits *ptemp; - register CfbBits *pdsttmp; - /* - * Do a stripe through the stipple & destination w pixels - * wide. w is not more than: - * - the width of the destination - * - the width of the stipple - * - the distance between x and the next word - * boundary in the destination - * - the distance between x and the next word - * boundary in the stipple - */ - - /* width of dest/stipple */ - xrem = (x - xSrc) % stippleWidth; -#if PSZ == 24 - w = 1; -#else - w = min((stippleWidth - xrem), width); - /* dist to word bound in dest */ - w = min(w, PPW - (x & PIM)); - /* dist to word bound in stip */ - w = min(w, MFB_PPW - (x & MFB_PIM)); -#endif - - xtemp = (xrem & MFB_PIM); - ptemp = (CfbBits *)(psrcS + (xrem >> MFB_PWSH)); -#if PSZ == 24 - tmpx = x & 3; - pdsttmp = pdst + ((x * 3)>>2); -#else -#if PSZ != 32 || PPW != 1 - tmpx = x & PIM; -#endif - pdsttmp = pdst + (x>>PWSH); -#endif - switch ( pGC->fillStyle ) { - case FillOpaqueStippled: -#if PSZ == 24 - getstipplepixels24(ptemp, xtemp, 0, &bgfill, &tmpDst1, xrem); - getstipplepixels24(ptemp, xtemp, 1, &fgfill, &tmpDst2, xrem); -#else - getstipplepixels(ptemp, xtemp, w, 0, &bgfill, &tmpDst1); - getstipplepixels(ptemp, xtemp, w, 1, &fgfill, &tmpDst2); -#endif - break; - case FillStippled: - /* Fill tmpSrc with the source pixels */ -#if PSZ == 24 - getbits24(pdsttmp, tmpSrc, x); - getstipplepixels24(ptemp, xtemp, 0, &tmpSrc, &tmpDst1, xrem); -#else - getbits(pdsttmp, tmpx, w, tmpSrc); - getstipplepixels(ptemp, xtemp, w, 0, &tmpSrc, &tmpDst1); -#endif - if (rop != stiprop) { -#if PSZ == 24 - putbitsrop24(fgfill, 0, &tmpSrc, pGC->planemask, stiprop); -#else - putbitsrop(fgfill, 0, w, &tmpSrc, pGC->planemask, stiprop); -#endif - } else { - tmpSrc = fgfill; - } -#if PSZ == 24 - getstipplepixels24(ptemp, xtemp, 1, &tmpSrc, &tmpDst2, xrem); -#else - getstipplepixels(ptemp, xtemp, w, 1, &tmpSrc, &tmpDst2); -#endif - break; - } - tmpDst2 |= tmpDst1; -#if PSZ == 24 - putbitsrop24(tmpDst2, tmpx, pdsttmp, pGC->planemask, rop); -#else - putbitsrop(tmpDst2, tmpx, w, pdsttmp, pGC->planemask, rop); -#endif - x += w; - width -= w; - } - } - ppt++; - pwidth++; - } - xfree(pptFree); - xfree(pwidthFree); -} - -#endif /* PSZ == 8 */ - -#if PSZ == 8 - -void -cfb8Stipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth; /* pointer to list of n widths */ - CfbBits *src; /* pointer to bits in stipple, if needed */ - int stippleHeight; /* height of the stipple */ - PixmapPtr stipple; - - int nlwDst; /* width in longwords of the dest pixmap */ - int x,y,w; /* current span */ - CfbBits startmask; - CfbBits endmask; - register CfbBits *dst; /* pointer to bits we're writing */ - register int nlw; - CfbBits *dstTmp; - int nlwTmp; - - CfbBits *pbits; /* pointer to start of pixmap */ - register CfbBits xor; - register CfbBits mask; - register CfbBits bits; /* bits from stipple */ - int wEnd; - - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - cfbPrivGCPtr devPriv; - - devPriv = cfbGetGCPrivate(pGC); - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - n = nInit * miFindMaxBand(pGC->pCompositeClip); - if ( n == 0 ) - return; - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - stipple = pGC->pRotatedPixmap; - src = (CfbBits *)stipple->devPrivate.ptr; - stippleHeight = stipple->drawable.height; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - while (n--) - { - w = *pwidth++; - x = ppt->x; - y = ppt->y; - ppt++; - dst = pbits + (y * nlwDst) + (x >> PWSH); - if (((x & PIM) + w) <= PPW) - { - maskpartialbits(x, w, startmask); - endmask = 0; - nlw = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlw); - } - bits = src[y % stippleHeight]; - RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); -#if PPW == 4 - if (cfb8StippleRRop == GXcopy) - { - xor = devPriv->xor; - if (w < (PGSZ*2)) - { - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & startmask)) | - (xor & (mask & startmask)); - dst++; - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - WriteBitGroup (dst,xor,GetBitGroup(bits)) - dst++; - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - } - else - { /* XXX constants probably not OK here */ - wEnd = 7 - (nlw & 7); - nlw = (nlw >> 3) + 1; - dstTmp = dst; - nlwTmp = nlw; - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dstTmp = (*dstTmp & ~(mask & startmask)) | - (xor & (mask & startmask)); - dstTmp++; - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - while (w--) - { - dst = dstTmp; - dstTmp++; - nlw = nlwTmp; -#if defined(__GNUC__) && defined(mc68020) - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; - } - xor = devPriv->xor; -#else -#define SwitchBitsLoop(body) \ - while (nlw--) \ - { \ - body \ - dst += 8; \ - } - SwitchBitGroup(dst, xor, GetBitGroup(bits)); -#undef SwitchBitsLoop -#endif - NextBitGroup (bits); - } - nlwTmp--; - w = wEnd + 1; - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - dst = dstTmp + (nlwTmp << 3); - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - while (w--) - { - nlw = nlwTmp; - dst = dstTmp; - dstTmp++; -#if defined(__GNUC__) && defined(mc68020) - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; - } - xor = devPriv->xor; -#else -#define SwitchBitsLoop(body) \ - while (nlw--) \ - { \ - body \ - dst += 8; \ - } - SwitchBitGroup(dst, xor, GetBitGroup(bits)); -#undef SwitchBitsLoop -#endif - NextBitGroup (bits); - } - } - } - else -#endif /* PPW == 4 */ - { - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - xfree(pptFree); - xfree(pwidthFree); -} - -void -cfb8OpaqueStipple32FS (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth; /* pointer to list of n widths */ - CfbBits *src; /* pointer to bits in stipple, if needed */ - int stippleHeight; /* height of the stipple */ - PixmapPtr stipple; - - int nlwDst; /* width in longwords of the dest pixmap */ - int x,y,w; /* current span */ - CfbBits startmask; - CfbBits endmask; - register CfbBits *dst; /* pointer to bits we're writing */ - register int nlw; - CfbBits *dstTmp; - int nlwTmp; - - CfbBits *pbits; /* pointer to start of pixmap */ - register CfbBits xor; - register CfbBits bits; /* bits from stipple */ - int wEnd; - - int *pwidthFree; /* copies of the pointers to free */ - DDXPointPtr pptFree; - cfbPrivGCPtr devPriv; - - devPriv = cfbGetGCPrivate(pGC); - - cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - n = nInit * miFindMaxBand(pGC->pCompositeClip); - if ( n == 0 ) - return; - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - stipple = pGC->pRotatedPixmap; - src = (CfbBits *)stipple->devPrivate.ptr; - stippleHeight = stipple->drawable.height; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - while (n--) - { - w = *pwidth++; - x = ppt->x; - y = ppt->y; - ppt++; - dst = pbits + (y * nlwDst) + (x >> PWSH); - if (((x & PIM) + w) <= PPW) - { - maskpartialbits(x, w, startmask); - endmask = 0; - nlw = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlw); - } - bits = src[y % stippleHeight]; - RotBitsLeft (bits, (x & ((PGSZ-1) & ~PIM))); -#if PPW == 4 - if (cfb8StippleRRop == GXcopy) - { - xor = devPriv->xor; - if (w < PGSZ*2) - { - if (startmask) - { - *dst = (*dst & ~startmask) | - (GetPixelGroup (bits) & startmask); - dst++; - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - *dst++ = GetPixelGroup(bits); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - *dst = (*dst & ~endmask) | - (GetPixelGroup (bits) & endmask); - } - } - else - { /* XXX consts probably not OK here */ - wEnd = 7 - (nlw & 7); - nlw = (nlw >> 3) + 1; - dstTmp = dst; - nlwTmp = nlw; - if (startmask) - { - *dstTmp = (*dstTmp & ~startmask) | - (GetPixelGroup (bits) & startmask); - dstTmp++; - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - while (w--) - { - nlw = nlwTmp; - dst = dstTmp; - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; - } - NextBitGroup (bits); - } - nlwTmp--; - w = wEnd + 1; - if (endmask) - { - dst = dstTmp + (nlwTmp << 3); - *dst = (*dst & ~endmask) | - (GetPixelGroup (bits) & endmask); - } - while (w--) - { - nlw = nlwTmp; - dst = dstTmp; - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; - } - NextBitGroup (bits); - } - } - } - else -#endif /* PPW == 4 */ - { - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; - RotBitsLeft (bits, PGSZB); - } - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - xfree(pptFree); - xfree(pwidthFree); -} - -#endif /* PSZ == 8 */ diff --git a/cfb/cfbgc.c b/cfb/cfbgc.c deleted file mode 100644 index a74c28c15..000000000 --- a/cfb/cfbgc.c +++ /dev/null @@ -1,799 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "region.h" - -#include "mistruct.h" -#include "mibstore.h" -#include "migc.h" - -#include "cfbmskbits.h" -#include "cfb8bit.h" - -#if PSZ == 8 -# define useTEGlyphBlt cfbTEGlyphBlt8 -#else -# ifdef WriteBitGroup -# define useTEGlyphBlt cfbImageGlyphBlt8 -# else -# define useTEGlyphBlt cfbTEGlyphBlt -# endif -#endif - -#ifdef WriteBitGroup -# define useImageGlyphBlt cfbImageGlyphBlt8 -# define usePolyGlyphBlt cfbPolyGlyphBlt8 -#else -# define useImageGlyphBlt miImageGlyphBlt -# define usePolyGlyphBlt miPolyGlyphBlt -#endif - -static void cfbUnPushPixels (GCPtr, PixmapPtr, DrawablePtr, int, int, int, int); - -#ifdef FOUR_BIT_CODE -# define usePushPixels cfbPushPixels8 -#else -# define usePushPixels cfbUnPushPixels -#endif - -#ifdef PIXEL_ADDR -# define ZeroPolyArc cfbZeroPolyArcSS8Copy -#else -# define ZeroPolyArc miZeroPolyArc -#endif - -GCFuncs cfbGCFuncs = { - cfbValidateGC, - miChangeGC, - miCopyGC, - miDestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip, -}; - -GCOps cfbTEOps1Rect = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, -#ifdef PIXEL_ADDR - cfb8LineSS1Rect, - cfb8SegmentSS1Rect, -#else - cfbLineSS, - cfbSegmentSS, -#endif - miPolyRectangle, - ZeroPolyArc, - cfbFillPoly1RectCopy, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useTEGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -GCOps cfbNonTEOps1Rect = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, -#ifdef PIXEL_ADDR - cfb8LineSS1Rect, - cfb8SegmentSS1Rect, -#else - cfbLineSS, - cfbSegmentSS, -#endif - miPolyRectangle, - ZeroPolyArc, - cfbFillPoly1RectCopy, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useImageGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -GCOps cfbTEOps = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, - cfbLineSS, - cfbSegmentSS, - miPolyRectangle, - ZeroPolyArc, - miFillPolygon, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useTEGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -GCOps cfbNonTEOps = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, - cfbLineSS, - cfbSegmentSS, - miPolyRectangle, -#ifdef PIXEL_ADDR - cfbZeroPolyArcSS8Copy, -#else - miZeroPolyArc, -#endif - miFillPolygon, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useImageGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -GCOps * -cfbMatchCommon (pGC, devPriv) - GCPtr pGC; - cfbPrivGCPtr devPriv; -{ - if (pGC->lineWidth != 0) - return 0; - if (pGC->lineStyle != LineSolid) - return 0; - if (pGC->fillStyle != FillSolid) - return 0; - if (devPriv->rop != GXcopy) - return 0; - if (pGC->font && - FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 && - FONTMINBOUNDS(pGC->font,characterWidth) >= 0) - { - if (TERMINALFONT(pGC->font) -#ifdef FOUR_BIT_CODE - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB -#endif - ) -#ifdef NO_ONE_RECT - return &cfbTEOps1Rect; -#else - if (devPriv->oneRect) - return &cfbTEOps1Rect; - else - return &cfbTEOps; -#endif - else -#ifdef NO_ONE_RECT - return &cfbNonTEOps1Rect; -#else - if (devPriv->oneRect) - return &cfbNonTEOps1Rect; - else - return &cfbNonTEOps; -#endif - } - return 0; -} - -Bool -cfbCreateGC(pGC) - register GCPtr pGC; -{ - cfbPrivGC *pPriv; - - if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD) - return (mfbCreateGC(pGC)); - pGC->clientClip = NULL; - pGC->clientClipType = CT_NONE; - - if (cfbNonTEOps.PushPixels == cfbUnPushPixels) - { - cfbTEOps1Rect.PushPixels = mfbPushPixelsWeak(); - cfbNonTEOps1Rect.PushPixels = mfbPushPixelsWeak(); - cfbTEOps.PushPixels = mfbPushPixelsWeak(); - cfbNonTEOps.PushPixels = mfbPushPixelsWeak(); - } - - /* - * some of the output primitives aren't really necessary, since they - * will be filled in ValidateGC because of dix/CreateGC() setting all - * the change bits. Others are necessary because although they depend - * on being a color frame buffer, they don't change - */ - - pGC->ops = &cfbNonTEOps; - pGC->funcs = &cfbGCFuncs; - - /* cfb wants to translate before scan conversion */ - pGC->miTranslate = 1; - - pPriv = cfbGetGCPrivate(pGC); - pPriv->rop = pGC->alu; - pPriv->oneRect = FALSE; - pGC->fExpose = TRUE; - pGC->freeCompClip = FALSE; - pGC->pRotatedPixmap = (PixmapPtr) NULL; - return TRUE; -} - -/* Clipping conventions - if the drawable is a window - CT_REGION ==> pCompositeClip really is the composite - CT_other ==> pCompositeClip is the window clip region - if the drawable is a pixmap - CT_REGION ==> pCompositeClip is the translated client region - clipped to the pixmap boundary - CT_other ==> pCompositeClip is the pixmap bounding box -*/ - -void -cfbValidateGC(pGC, changes, pDrawable) - register GCPtr pGC; - unsigned long changes; - DrawablePtr pDrawable; -{ - int mask; /* stateChanges */ - int index; /* used for stepping through bitfields */ - int new_rrop; - int new_line, new_text, new_fillspans, new_fillarea; - int new_rotate; - int xrot, yrot; - /* flags for changing the proc vector */ - cfbPrivGCPtr devPriv; - int oneRect; - - new_rotate = pGC->lastWinOrg.x != pDrawable->x || - pGC->lastWinOrg.y != pDrawable->y; - - pGC->lastWinOrg.x = pDrawable->x; - pGC->lastWinOrg.y = pDrawable->y; - devPriv = cfbGetGCPrivate(pGC); - - new_rrop = FALSE; - new_line = FALSE; - new_text = FALSE; - new_fillspans = FALSE; - new_fillarea = FALSE; - - /* - * if the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last validation - * we need to recompute the composite clip - */ - - if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || - (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) - ) - { - miComputeCompositeClip (pGC, pDrawable); -#ifdef NO_ONE_RECT - devPriv->oneRect = FALSE; -#else - oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1; - if (oneRect != devPriv->oneRect) - new_line = TRUE; - devPriv->oneRect = oneRect; -#endif - } - - mask = changes; - while (mask) { - index = lowbit (mask); - mask &= ~index; - - /* - * this switch acculmulates a list of which procedures might have - * to change due to changes in the GC. in some cases (e.g. - * changing one 16 bit tile for another) we might not really need - * a change, but the code is being paranoid. this sort of batching - * wins if, for example, the alu and the font have been changed, - * or any other pair of items that both change the same thing. - */ - switch (index) { - case GCFunction: - case GCForeground: - new_rrop = TRUE; - break; - case GCPlaneMask: - new_rrop = TRUE; - new_text = TRUE; - break; - case GCBackground: - break; - case GCLineStyle: - case GCLineWidth: - new_line = TRUE; - break; - case GCJoinStyle: - case GCCapStyle: - break; - case GCFillStyle: - new_text = TRUE; - new_fillspans = TRUE; - new_line = TRUE; - new_fillarea = TRUE; - break; - case GCFillRule: - break; - case GCTile: - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - - case GCStipple: - if (pGC->stipple) - { - int width = pGC->stipple->drawable.width; - PixmapPtr nstipple; - - if ((width <= PGSZ) && !(width & (width - 1)) && - (nstipple = cfbCopyPixmap(pGC->stipple))) - { - cfbPadPixmap(nstipple); - (*pGC->pScreen->DestroyPixmap)(pGC->stipple); - pGC->stipple = nstipple; - } - } - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - - case GCTileStipXOrigin: - new_rotate = TRUE; - break; - - case GCTileStipYOrigin: - new_rotate = TRUE; - break; - - case GCFont: - new_text = TRUE; - break; - case GCSubwindowMode: - break; - case GCGraphicsExposures: - break; - case GCClipXOrigin: - break; - case GCClipYOrigin: - break; - case GCClipMask: - break; - case GCDashOffset: - break; - case GCDashList: - break; - case GCArcMode: - break; - default: - break; - } - } - - /* - * If the drawable has changed, ensure suitable - * entries are in the proc vector. - */ - if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) { - new_fillspans = TRUE; /* deal with FillSpans later */ - } - - if (new_rotate || new_fillspans) - { - Bool new_pix = FALSE; - - xrot = pGC->patOrg.x + pDrawable->x; - yrot = pGC->patOrg.y + pDrawable->y; - - switch (pGC->fillStyle) - { - case FillTiled: - if (!pGC->tileIsPixel) - { - int width = pGC->tile.pixmap->drawable.width * PSZ; - - if ((width <= PGSZ) && !(width & (width - 1))) - { - cfbCopyRotatePixmap(pGC->tile.pixmap, &pGC->pRotatedPixmap, - xrot, yrot); - new_pix = TRUE; - } - } - break; -#ifdef FOUR_BIT_CODE - case FillStippled: - case FillOpaqueStippled: - { - int width = pGC->stipple->drawable.width; - - if ((width <= PGSZ) && !(width & (width - 1))) - { - mfbCopyRotatePixmap(pGC->stipple, &pGC->pRotatedPixmap, - xrot, yrot); - new_pix = TRUE; - } - } - break; -#endif - } - if (!new_pix && pGC->pRotatedPixmap) - { - (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap); - pGC->pRotatedPixmap = (PixmapPtr) NULL; - } - } - - if (new_rrop) - { - int old_rrop; - - old_rrop = devPriv->rop; - devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, - pGC->planemask, - &devPriv->and, &devPriv->xor); - if (old_rrop == devPriv->rop) - new_rrop = FALSE; - else - { -#ifdef PIXEL_ADDR - new_line = TRUE; -#endif -#ifdef WriteBitGroup - new_text = TRUE; -#endif - new_fillspans = TRUE; - new_fillarea = TRUE; - } - } - - if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) - { - GCOps *newops; - - if ((newops = cfbMatchCommon (pGC, devPriv))) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; - } - else - { - if (!pGC->ops->devPrivate.val) - { - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - } - } - - /* deal with the changes we've collected */ - if (new_line) - { - pGC->ops->FillPolygon = miFillPolygon; -#ifdef NO_ONE_RECT - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = cfbFillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; - break; - } - } -#else - if (devPriv->oneRect && pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = cfbFillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; - break; - } - } -#endif - if (pGC->lineWidth == 0) - { -#ifdef PIXEL_ADDR - if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) - { - switch (devPriv->rop) - { - case GXxor: - pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor; - break; - case GXcopy: - pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy; - break; - default: - pGC->ops->PolyArc = cfbZeroPolyArcSS8General; - break; - } - } - else -#endif - pGC->ops->PolyArc = miZeroPolyArc; - } - else - pGC->ops->PolyArc = miPolyArc; - pGC->ops->PolySegment = miPolySegment; - switch (pGC->lineStyle) - { - case LineSolid: - if(pGC->lineWidth == 0) - { - if (pGC->fillStyle == FillSolid) - { -#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT) - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - { - pGC->ops->Polylines = cfb8LineSS1Rect; - pGC->ops->PolySegment = cfb8SegmentSS1Rect; - } else -#endif -#ifdef NO_ONE_RECT - { - pGC->ops->Polylines = cfb8LineSS1Rect; - pGC->ops->PolySegment = cfb8SegmentSS1Rect; - } -#else - { - pGC->ops->Polylines = cfbLineSS; - pGC->ops->PolySegment = cfbSegmentSS; - } -#endif - } - else - pGC->ops->Polylines = miZeroLine; - } - else - pGC->ops->Polylines = miWideLine; - break; - case LineOnOffDash: - case LineDoubleDash: - if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) - { - pGC->ops->Polylines = cfbLineSD; - pGC->ops->PolySegment = cfbSegmentSD; - } else - pGC->ops->Polylines = miWideDash; - break; - } - } - - if (new_text && (pGC->font)) - { - if (FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0) - { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - else - { -#ifdef WriteBitGroup - if (pGC->fillStyle == FillSolid) - { - if (devPriv->rop == GXcopy) - pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8; - else -#ifdef FOUR_BIT_CODE - pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8; -#else - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; -#endif - } - else -#endif - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - /* special case ImageGlyphBlt for terminal emulator fonts */ -#if !defined(WriteBitGroup) || PSZ == 8 - if (TERMINALFONT(pGC->font) && - (pGC->planemask & PMSK) == PMSK -#ifdef FOUR_BIT_CODE - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB -#endif - ) - { - pGC->ops->ImageGlyphBlt = useTEGlyphBlt; - } - else -#endif - { -#ifdef WriteBitGroup - if (devPriv->rop == GXcopy && - pGC->fillStyle == FillSolid && - (pGC->planemask & PMSK) == PMSK) - pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8; - else -#endif - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - } - } - - - if (new_fillspans) { - switch (pGC->fillStyle) { - case FillSolid: - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillSpans = cfbSolidSpansCopy; - break; - case GXxor: - pGC->ops->FillSpans = cfbSolidSpansXor; - break; - default: - pGC->ops->FillSpans = cfbSolidSpansGeneral; - break; - } - break; - case FillTiled: - if (pGC->pRotatedPixmap) - { - if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) - pGC->ops->FillSpans = cfbTile32FSCopy; - else - pGC->ops->FillSpans = cfbTile32FSGeneral; - } - else - pGC->ops->FillSpans = cfbUnnaturalTileFS; - break; - case FillStippled: -#ifdef FOUR_BIT_CODE - if (pGC->pRotatedPixmap) - pGC->ops->FillSpans = cfb8Stipple32FS; - else -#endif - pGC->ops->FillSpans = cfbUnnaturalStippleFS; - break; - case FillOpaqueStippled: -#ifdef FOUR_BIT_CODE - if (pGC->pRotatedPixmap) - pGC->ops->FillSpans = cfb8OpaqueStipple32FS; - else -#endif - pGC->ops->FillSpans = cfbUnnaturalStippleFS; - break; - default: - FatalError("cfbValidateGC: illegal fillStyle\n"); - } - } /* end of new_fillspans */ - - if (new_fillarea) { -#ifndef FOUR_BIT_CODE - pGC->ops->PolyFillRect = miPolyFillRect; - if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) - { - pGC->ops->PolyFillRect = cfbPolyFillRect; - } -#endif -#ifdef FOUR_BIT_CODE - pGC->ops->PushPixels = mfbPushPixelsWeak(); - if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy) - pGC->ops->PushPixels = cfbPushPixels8; -#endif - pGC->ops->PolyFillArc = miPolyFillArc; - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) - { - case GXcopy: - pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy; - break; - default: - pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral; - break; - } - } - } -} - -/* - * this is never called, it just exists to have its address - * taken in mfbCreateGC. - */ -static void -cfbUnPushPixels (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) - GCPtr pGC; - PixmapPtr pBitmap; - DrawablePtr pDrawable; - int dx, dy, xOrg, yOrg; -{ - return; -} diff --git a/cfb/cfbgetsp.c b/cfb/cfbgetsp.c deleted file mode 100644 index 672196a6c..000000000 --- a/cfb/cfbgetsp.c +++ /dev/null @@ -1,213 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" - -#include "misc.h" -#include "region.h" -#include "gc.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" - -/* GetSpans -- for each span, gets bits from drawable starting at ppt[i] - * and continuing for pwidth[i] bits - * Each scanline returned will be server scanline padded, i.e., it will come - * out to an integral number of words. - */ -void -cfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart) - DrawablePtr pDrawable; /* drawable from which to get bits */ - int wMax; /* largest value of all *pwidths */ - register DDXPointPtr ppt; /* points to start copying from */ - int *pwidth; /* list of number of bits to copy */ - int nspans; /* number of scanlines to copy */ - char *pchardstStart; /* where to put the bits */ -{ - PixelGroup *pdstStart = (PixelGroup *)pchardstStart; - register PixelGroup *pdst; /* where to put the bits */ - register PixelGroup *psrc; /* where to get the bits */ - register PixelGroup tmpSrc; /* scratch buffer for bits */ - PixelGroup *psrcBase; /* start of src bitmap */ - int widthSrc; /* width of pixmap in bytes */ - register DDXPointPtr pptLast; /* one past last point to get */ - int xEnd; /* last pixel to copy from */ - int nl, srcBit; - int w; - PixelGroup *pdstNext; -#if PSZ == 24 - register char *psrcb, *pdstb; - register int xIndex = 0; -#else - register int nstart; -#if PSZ != 32 || PPW != 1 - int nend; -#endif - PixelGroup startmask, endmask; - int nlMiddle; -#endif - - switch (pDrawable->bitsPerPixel) { - case 1: - mfbGetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart); - return; - case PSZ: - break; - default: - FatalError("cfbGetSpans: invalid depth\n"); - } - - /* - * XFree86 DDX empties the root borderClip when the VT is - * switched away; this checks for that case - */ - if (!cfbDrawableEnabled(pDrawable)) - return; - - cfbGetLongWidthAndPointer (pDrawable, widthSrc, psrcBase) - -#ifdef PIXEL_ADDR -# if PSZ != 24 - if ((nspans == 1) && (*pwidth == 1)) - { - tmpSrc = *((PixelType *)(psrcBase + (ppt->y * widthSrc)) - + ppt->x); -#if BITMAP_BIT_ORDER == MSBFirst - tmpSrc <<= (sizeof (CfbBits) - sizeof (PixelType)) * 8; -#endif - *pdstStart = tmpSrc; - return; - } -# endif /* PSZ != 24 */ -#endif - pdst = pdstStart; - pptLast = ppt + nspans; - while(ppt < pptLast) - { -#if PSZ == 24 - xEnd = min(ppt->x + *pwidth, widthSrc * sizeof(CfbBits) / 3); - w = xEnd - ppt->x; - psrc = psrcBase + ppt->y * widthSrc; - srcBit = ppt->x; - psrcb = (char *)psrc + (ppt->x * 3); - xIndex = 0; - pdstb = (char *)pdst; - pdstNext = pdst + ((w * 3 + 3) >> 2); -#else - xEnd = min(ppt->x + *pwidth, widthSrc << PWSH); - w = xEnd - ppt->x; - psrc = psrcBase + ppt->y * widthSrc + (ppt->x >> PWSH); - srcBit = ppt->x & PIM; - pdstNext = pdst + ((w + PPW - 1) >> PWSH); -#endif - -#if PSZ == 24 - if (w < 0) - FatalError("cfb24GetSpans: Internal error (w < 0)\n"); - nl = w; - while (nl--){ - psrc = (PixelGroup *)((unsigned long)psrcb & ~0x03); - getbits24(psrc, tmpSrc, srcBit); - pdst = (PixelGroup *)((unsigned long)pdstb & ~0x03); - putbits24(tmpSrc, PPW, pdst, ~((CfbBits)0), xIndex); - srcBit++; - psrcb += 3; - xIndex++; - pdstb += 3; - } - pdst = pdstNext; -#else /* PSZ == 24 */ - if (srcBit + w <= PPW) - { - getbits(psrc, srcBit, w, tmpSrc); - putbits(tmpSrc, 0, w, pdst, ~((CfbBits)0)); - pdst++; - } - else - { - maskbits(ppt->x, w, startmask, endmask, nlMiddle); - nstart = 0; - if (startmask) - { - nstart = PPW - srcBit; - getbits(psrc, srcBit, nstart, tmpSrc); - putbits(tmpSrc, 0, nstart, pdst, ~((CfbBits)0)); - if(srcBit + nstart >= PPW) - psrc++; - } - nl = nlMiddle; - while (nl--) - { - tmpSrc = *psrc; - putbits(tmpSrc, nstart, PPW, pdst, ~((CfbBits)0)); - psrc++; - pdst++; - } - if (endmask) - { -#if PSZ != 32 || PPW != 1 - nend = xEnd & PIM; -#endif - getbits(psrc, 0, nend, tmpSrc); - putbits(tmpSrc, nstart, nend, pdst, ~((CfbBits)0)); - } - pdst = pdstNext; - } -#endif /* PSZ == 24 */ - ppt++; - pwidth++; - } -} diff --git a/cfb/cfbglblt8.c b/cfb/cfbglblt8.c deleted file mode 100644 index 4d964b35d..000000000 --- a/cfb/cfbglblt8.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - -/* - * Poly glyph blt. Accepts an arbitrary font <= 32 bits wide, in Copy mode - * only. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -#define BOX_OVERLAP(box1, box2, xoffset, yoffset) \ - ((box1)->x1 <= ((int) (box2)->x2 + (xoffset)) && \ - ((int) (box2)->x1 + (xoffset)) <= (box1)->x2 && \ - (box1)->y1 <= ((int) (box2)->y2 + (yoffset)) && \ - ((int) (box2)->y1 + (yoffset)) <= (box1)->y2) - -#define BOX_CONTAINS(box1, box2, xoffset, yoffset) \ - ((box1)->x1 <= ((int) (box2)->x1 + (xoffset)) && \ - ((int) (box2)->x2 + (xoffset)) <= (box1)->x2 && \ - (box1)->y1 <= ((int) (box2)->y1 + (yoffset)) && \ - ((int) (box2)->y2 + (yoffset)) <= (box1)->y2) - -#if defined(FOUR_BIT_CODE) || defined(WriteBitGroup) && !defined(GLYPHROP) - -#if GLYPHPADBYTES != 4 -#define USE_LEFTBITS -#endif - -#ifdef USE_LEFTBITS -typedef unsigned char *glyphPointer; - -#define GlyphBits(bits,width,dst) getleftbits(bits,width,dst); \ - (dst) &= widthMask; \ - (bits) += widthGlyph; -#define GlyphBitsS(bits,width,dst,off) GlyphBits(bits,width,dst); \ - dst = BitRight (dst, off); -#else -typedef CARD32 *glyphPointer; - -#define GlyphBits(bits,width,dst) dst = *bits++; -#define GlyphBitsS(bits,width,dst,off) dst = BitRight(*bits++, off); -#endif - -#ifdef GLYPHROP -#define cfbPolyGlyphBlt8 cfbPolyGlyphRop8 -#define cfbPolyGlyphBlt8Clipped cfbPolyGlyphRop8Clipped - -#undef WriteBitGroup -#define WriteBitGroup(dst,pixel,bits) RRopBitGroup(dst,bits) - -#endif - -static void cfbPolyGlyphBlt8Clipped( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppci, /* array of character info */ - unsigned char *pglyphBase); /* start of array of glyphs */ - -#if defined(HAS_STIPPLE_CODE) && !defined(GLYPHROP) && !defined(USE_LEFTBITS) -#define USE_STIPPLE_CODE -#endif - -#if defined(__GNUC__) && !defined(GLYPHROP) && (defined(mc68020) || defined(mc68000) || defined(__mc68000__)) && PSZ == 8 && !defined(USE_LEFTBITS) -#ifdef USE_STIPPLE_CODE -#undef USE_STIPPLE_CODE -#endif -#include "stip68kgnu.h" -#endif - -#if PSZ == 24 -#define DST_INC 3 -#else -#define DST_INC (PGSZB >> PWSH) -#endif - -/* cfbStippleStack/cfbStippleStackTE are coded in assembly language. - * They are only provided on some architecures. - */ -#ifdef USE_STIPPLE_CODE -extern void cfbStippleStack (), cfbStippleStackTE (); -#endif - -void -cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs */ -{ -#ifndef GLYPHROP - register CfbBits pixel; -#endif -#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE) - register CfbBits c; - register CfbBits *dst; -#endif - register glyphPointer glyphBits; - register int xoff; - - FontPtr pfont = pGC->font; - CharInfoPtr pci; - CfbBits *dstLine; - CfbBits *pdstBase; - int hTmp; - int bwidthDst; - int widthDst; - int h; - BoxRec bbox; /* for clipping */ - int w; - RegionPtr clip; - BoxPtr extents; -#ifdef USE_LEFTBITS - int widthGlyph; - CfbBits widthMask; -#endif -#ifndef STIPPLE -#ifdef USE_STIPPLE_CODE - void (*stipple)(); - - stipple = cfbStippleStack; - if (FONTCONSTMETRICS(pfont)) - stipple = cfbStippleStackTE; -#endif -#endif - - x += pDrawable->x; - y += pDrawable->y; - - /* compute an approximate (but covering) bounding box */ - bbox.x1 = 0; - if ((ppci[0]->metrics.leftSideBearing < 0)) - bbox.x1 = ppci[0]->metrics.leftSideBearing; - h = nglyph - 1; - w = ppci[h]->metrics.rightSideBearing; - while (--h >= 0) - w += ppci[h]->metrics.characterWidth; - bbox.x2 = w; - bbox.y1 = -FONTMAXBOUNDS(pfont,ascent); - bbox.y2 = FONTMAXBOUNDS(pfont,descent); - - clip = cfbGetCompositeClip(pGC); - extents = &clip->extents; - - if (!clip->data) - { - if (!BOX_CONTAINS(extents, &bbox, x, y)) - { - if (BOX_OVERLAP (extents, &bbox, x, y)) - cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y, - nglyph, ppci, pglyphBase); - return; - } - } - else - { - /* check to make sure some of the text appears on the screen */ - if (!BOX_OVERLAP (extents, &bbox, x, y)) - return; - - bbox.x1 += x; - bbox.x2 += x; - bbox.y1 += y; - bbox.y2 += y; - - switch (RECT_IN_REGION(pGC->pScreen, clip, &bbox)) - { - case rgnPART: - cfbPolyGlyphBlt8Clipped(pDrawable, pGC, x, y, - nglyph, ppci, pglyphBase); - case rgnOUT: - return; - } - } - -#ifdef GLYPHROP - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); -#else - pixel = cfbGetGCPrivate(pGC)->xor; -#endif - - cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits) - - widthDst = bwidthDst / PGSZB; - while (nglyph--) - { - pci = *ppci++; - glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); - xoff = x + pci->metrics.leftSideBearing; -#if PSZ == 24 - dstLine = pdstBase + (y - pci->metrics.ascent) * widthDst +((xoff>> 2)*3); -#else - dstLine = pdstBase + - (y - pci->metrics.ascent) * widthDst + (xoff >> PWSH); -#endif - x += pci->metrics.characterWidth; - if ((hTmp = pci->metrics.descent + pci->metrics.ascent)) - { -#if PSZ == 24 - xoff &= 0x03; -#else - xoff &= PIM; -#endif /* PSZ == 24 */ -#ifdef STIPPLE - STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else -#ifdef USE_STIPPLE_CODE - (*stipple)(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else -#ifdef USE_LEFTBITS - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - widthGlyph = PADGLYPHWIDTHBYTES(w); - widthMask = mfbGetendtab(w); -#endif - do { - dst = dstLine; - dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst); - GlyphBits(glyphBits, w, c) - WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); - dst += DST_INC; - c = BitLeft(c,PGSZB - xoff); - while (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst += DST_INC; - } - } while (--hTmp); -#endif /* USE_STIPPLE_CODE else */ -#endif /* STIPPLE else */ - } - } -} - -static void -cfbPolyGlyphBlt8Clipped( - DrawablePtr pDrawable, - GCPtr pGC, - int x, - int y, - unsigned int nglyph, - CharInfoPtr *ppci, /* array of character info */ - unsigned char *pglyphBase) /* start of array of glyphs */ -{ -#ifndef GLYPHROP - register CfbBits pixel; -#endif -#if !defined(STIPPLE) && !defined(USE_STIPPLE_CODE) - register CfbBits c; -#endif - register glyphPointer glyphBits; - register int xoff; -#if defined(USE_LEFTBITS) || (!defined(STIPPLE) && !defined(USE_STIPPLE_CODE)) - register CfbBits *dst; -#endif - - CharInfoPtr pci; - FontPtr pfont = pGC->font; - CfbBits *dstLine; - CfbBits *pdstBase; -#ifdef USE_LEFTBITS - CARD32 *cTmp; -#endif - CARD32 *clips; - int maxAscent, maxDescent; - int minLeftBearing; - int hTmp; - int widthDst; - int bwidthDst; - int xG, yG; - BoxPtr pBox; - int numRects; - int w; - RegionPtr pRegion; - int yBand; -#ifdef GLYPHROP - CfbBits bits; -#endif -#ifdef USE_LEFTBITS - int widthGlyph; - CfbBits widthMask; -#endif - -#ifdef GLYPHROP - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); -#else - pixel = cfbGetGCPrivate(pGC)->xor; -#endif - - cfbGetTypedWidthAndPointer (pDrawable, bwidthDst, pdstBase, char, CfbBits) - - widthDst = bwidthDst / PGSZB; - maxAscent = FONTMAXBOUNDS(pfont,ascent); - maxDescent = FONTMAXBOUNDS(pfont,descent); - minLeftBearing = FONTMINBOUNDS(pfont,leftSideBearing); - - pRegion = cfbGetCompositeClip(pGC); - - pBox = REGION_RECTS(pRegion); - numRects = REGION_NUM_RECTS (pRegion); - while (numRects && pBox->y2 <= y - maxAscent) - { - ++pBox; - --numRects; - } - if (!numRects || pBox->y1 >= y + maxDescent) - return; - yBand = pBox->y1; - while (numRects && pBox->y1 == yBand && pBox->x2 <= x + minLeftBearing) - { - ++pBox; - --numRects; - } - if (!numRects) - return; - clips = (CARD32 *)xalloc ((maxAscent + maxDescent) * - sizeof (CARD32)); - while (nglyph--) - { - pci = *ppci++; - glyphBits = (glyphPointer) FONTGLYPHBITS(pglyphBase,pci); - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - xG = x + pci->metrics.leftSideBearing; - yG = y - pci->metrics.ascent; - x += pci->metrics.characterWidth; - if ((hTmp = pci->metrics.descent + pci->metrics.ascent)) - { -#if PSZ == 24 - dstLine = pdstBase + yG * widthDst + ((xG>> 2)*3); - /* never use (xG*3)>>2 */ -#else - dstLine = pdstBase + yG * widthDst + (xG >> PWSH); -#endif -#if PSZ == 24 - xoff = xG & 3; -#else - xoff = xG & PIM; -#endif -#ifdef USE_LEFTBITS - w = pci->metrics.rightSideBearing - pci->metrics.leftSideBearing; - widthGlyph = PADGLYPHWIDTHBYTES(w); - widthMask = mfbGetendtab(w); -#endif - switch (cfb8ComputeClipMasks32 (pBox, numRects, xG, yG, w, hTmp, clips)) - { - case rgnPART: -#ifdef USE_LEFTBITS - cTmp = clips; - do { - dst = dstLine; - dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst); - GlyphBits(glyphBits, w, c) - c &= *cTmp++; - if (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); - c = BitLeft(c,PGSZB - xoff); - dst += DST_INC; - while (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst += DST_INC; - } - } - } while (--hTmp); - break; -#else /* !USE_LEFTBITS */ - { - int h; - - h = hTmp; - do - { - --h; - clips[h] = clips[h] & glyphBits[h]; - } while (h); - } - glyphBits = clips; - /* fall through */ -#endif /* USE_LEFTBITS */ - case rgnIN: -#ifdef STIPPLE - STIPPLE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else -#ifdef USE_STIPPLE_CODE - cfbStippleStackTE(dstLine,glyphBits,pixel,bwidthDst,hTmp,xoff); -#else - do { - dst = dstLine; - dstLine = (CfbBits *) (((char *) dstLine) + bwidthDst); - GlyphBits(glyphBits, w, c) - if (c) - { - /* This code originally could read memory locations - * that were not mapped. Hence we have to check the - * trailing bits to see whether they are zero and if - * then skip them correctly. This is no problem for - * the GXcopy case, since there only the pixels that - * are non-zero are written ... - */ -#ifndef GLYPHROP - WriteBitGroup(dst, pixel, GetBitGroup(BitRight(c,xoff))); - c = BitLeft(c,PGSZB - xoff); - dst += DST_INC; -#else /* GLYPHROP */ - if ((bits = GetBitGroup(BitRight(c,xoff)))) - WriteBitGroup(dst, pixel, bits); - c = BitLeft(c,PGSZB - xoff); - dst += DST_INC; - - while (c && ((bits = GetBitGroup(c)) == 0)) - { - NextBitGroup(c); - dst += DST_INC; - } -#endif /* GLYPHROP */ - while (c) - { - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst += DST_INC; - } - } - } while (--hTmp); -#endif /* USE_STIPPLE_CODE else */ -#endif /* STIPPLE else */ - break; - } - } - } - xfree (clips); -} - -#endif /* FOUR_BIT_CODE */ diff --git a/cfb/cfbhrzvert.c b/cfb/cfbhrzvert.c deleted file mode 100644 index a6a793055..000000000 --- a/cfb/cfbhrzvert.c +++ /dev/null @@ -1,554 +0,0 @@ -/*********************************************************** - -Copyright 1987,1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include "gc.h" -#include "window.h" -#include "pixmap.h" -#include "region.h" - -#include "cfb.h" -#include "cfbmskbits.h" - -/* horizontal solid line - abs(len) > 1 -*/ -void -cfbHorzS(rop, and, xor, addrl, nlwidth, x1, y1, len) -register int rop; -register CfbBits and; -register CfbBits xor; -register CfbBits *addrl; /* pointer to base of bitmap */ -int nlwidth; /* width in longwords of bitmap */ -int x1; /* initial point */ -int y1; -int len; /* length of line */ -{ - register int nlmiddle; - -#if PSZ == 24 - - int leftIndex, rightIndex; - CfbBits piQxelAnd[3], piQxelXor[3]; - piQxelAnd[0] = (and & 0xFFFFFF) | ((and<<24) & 0xFF000000); - piQxelAnd[1] = ((and>>8) & 0xFFFF)| ((and<<16) & 0xFFFF0000); - piQxelAnd[2] = ((and<<8) & 0xFFFFFF00) | ((and>>16) & 0xFF); - - piQxelXor[0] = (xor & 0xFFFFFF) | ((xor<<24) & 0xFF000000); - piQxelXor[1] = ((xor>>8) & 0xFFFF)| ((xor<<16) & 0xFFFF0000); - piQxelXor[2] = ((xor<<8) & 0xFFFFFF00) | ((xor>>16) & 0xFF); - - leftIndex = x1 & 3; - rightIndex = ((x1 + len) < 5)?0:(x1 + len)&3; - nlmiddle = len; - if(leftIndex){ - nlmiddle -= (4 - leftIndex); - } - if(rightIndex){ - nlmiddle -= rightIndex; - } - if (nlmiddle < 0) - nlmiddle = 0; - - nlmiddle >>= 2; - - addrl += (y1 * nlwidth) + (x1 >> 2)*3 + (leftIndex?leftIndex-1:0); - - switch(leftIndex+len){ - case 4: - switch(leftIndex){ - case 0: - *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); - break; - case 1: - *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); - break; - case 2: - *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); - break; - case 3: - *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); - break; - } - break; - case 3: - switch(leftIndex){ - case 0: - *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); - break; - case 1: - *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); - break; - case 2: - *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - addrl++; - *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); - break; - } - break; - case 2: - if(leftIndex){ - *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); - addrl++; - } - else{ - *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); - addrl++; - } - *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF); - break; - case 1: /*only if leftIndex = 0 and w = 1*/ - *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF); - break; - case 0: /*never*/ - break; - default: - { - if (rop == GXcopy){ - switch(leftIndex){ - case 0: - break; - case 1: - *addrl = ((*addrl) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - addrl++; - *addrl++ = piQxelXor[1]; - *addrl++ = piQxelXor[2]; - break; - case 2: - *addrl = ((*addrl) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - addrl++; - *addrl++ = piQxelXor[2]; - break; - case 3: - *addrl = ((*addrl) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); - addrl++; - break; - } - while(nlmiddle--){ - *addrl++ = piQxelXor[0]; - *addrl++ = piQxelXor[1]; - *addrl++ = piQxelXor[2]; - } - switch(rightIndex){ - case 0: - break; - case 1: - *addrl = ((*addrl) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); - break; - case 2: - *addrl++ = piQxelXor[0]; - *addrl = ((*addrl) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - break; - case 3: - *addrl++ = piQxelXor[0]; - *addrl++ = piQxelXor[1]; - *addrl = ((*addrl) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - break; - } - } - else{ - if(rop == GXxor){ - switch(leftIndex){ - case 0: - break; - case 1: - *addrl++ ^= (piQxelXor[0]&0xFF000000); - *addrl++ ^= piQxelXor[1]; - *addrl++ ^= piQxelXor[2]; - break; - case 2: - *addrl++ ^= (piQxelXor[1]& 0xFFFF0000); - *addrl++ ^= piQxelXor[2]; - break; - case 3: - *addrl++ ^= (piQxelXor[2]& 0xFFFFFF00); - break; - } - while(nlmiddle--){ - *addrl++ ^= piQxelXor[0]; - *addrl++ ^= piQxelXor[1]; - *addrl++ ^= piQxelXor[2]; - } - switch(rightIndex){ - case 0: - break; - case 1: - *addrl ^= (piQxelXor[0]& 0xFFFFFF); - break; - case 2: - *addrl++ ^= piQxelXor[0]; - *addrl ^= (piQxelXor[1]&0xFFFF); - break; - case 3: - *addrl++ ^= piQxelXor[0]; - *addrl++ ^= piQxelXor[1]; - *addrl ^= (piQxelXor[2]&0xFF); - break; - } - } - else{ - switch(leftIndex){ - case 0: - break; - case 1: - *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFF000000); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); - addrl++; - break; - case 2: - *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); - addrl++; - break; - case 3: - *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); - addrl++; - break; - } - while(nlmiddle--){ - *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[2], piQxelXor[2]); - addrl++; - } - switch(rightIndex){ - case 0: - break; - case 1: - *addrl = DoMaskRRop (*addrl, piQxelAnd[0], piQxelXor[0], 0xFFFFFF); - addrl++; - break; - case 2: - *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); - addrl++; - *addrl = DoMaskRRop (*addrl, piQxelAnd[1], piQxelXor[1], 0xFFFF); - break; - case 3: - *addrl = DoRRop (*addrl, piQxelAnd[0], piQxelXor[0]); - addrl++; - *addrl = DoRRop (*addrl, piQxelAnd[1], piQxelXor[1]); - addrl++; - *addrl = DoMaskRRop (*addrl, piQxelAnd[2], piQxelXor[2], 0xFF); - break; - } - - } - } - } - } -#else - register CfbBits startmask; - register CfbBits endmask; - - addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH); - - /* all bits inside same longword */ - if ( ((x1 & PIM) + len) < PPW) - { - maskpartialbits(x1, len, startmask); - *addrl = DoMaskRRop (*addrl, and, xor, startmask); - } - else - { - maskbits(x1, len, startmask, endmask, nlmiddle); - if (rop == GXcopy) - { - if (startmask) - { - *addrl = (*addrl & ~startmask) | (xor & startmask); - addrl++; - } - while (nlmiddle--) - *addrl++ = xor; - if (endmask) - *addrl = (*addrl & ~endmask) | (xor & endmask); - } - else - { - if (startmask) - { - *addrl = DoMaskRRop (*addrl, and, xor, startmask); - addrl++; - } - if (rop == GXxor) - { - while (nlmiddle--) - *addrl++ ^= xor; - } - else - { - while (nlmiddle--) - { - *addrl = DoRRop (*addrl, and, xor); - addrl++; - } - } - if (endmask) - *addrl = DoMaskRRop (*addrl, and, xor, endmask); - } - } -#endif -} - -/* vertical solid line */ - -void -cfbVertS(rop, and, xor, addrl, nlwidth, x1, y1, len) -int rop; -register CfbBits and, xor; -register CfbBits *addrl; /* pointer to base of bitmap */ -register int nlwidth; /* width in longwords of bitmap */ -int x1, y1; /* initial point */ -register int len; /* length of line */ -{ -#if PSZ == 24 - int xIdx; - CfbBits and2 = 0, xor2 = 0, mask = 0, mask2; -#endif -#ifdef PIXEL_ADDR - register PixelType *bits = (PixelType *) addrl; - -#if PSZ == 24 - nlwidth <<= PWSH; - xIdx = x1 & 3; - bits = (PixelType *)(addrl + (y1 * nlwidth) + ((x1*3) >> 2)); -#else - nlwidth <<= PWSH; - bits = bits + (y1 * nlwidth) + x1; -#endif -#if PSZ == 24 - mask2 = 0; - switch(xIdx){ - case 0: - mask = 0xFF000000; - xor &= 0xFFFFFF; - and |= 0xFF000000; - break; - case 3: - mask = 0xFF; - xor &= 0xFFFFFF; - xor <<= 8; - and <<= 8; - and |= 0xFF; - break; - case 1: - mask = 0xFFFFFF; - mask2 = 0xFFFF0000; - xor2 = (xor>>8) & 0xFFFF; - xor &= 0xFF; - xor <<= 24; - and2 = (and >> 8 ) | 0xFFFF0000; - and <<= 24; - and |= 0xFFFFFF; - break; - case 2: - mask = 0x0000FFFF; - mask2 = 0xFFFFFF00; - xor2 = (xor >> 16) & 0xFF; - xor <<= 16; - xor &= 0xFFFF0000; - and2 = (and >> 16) | 0xFFFFFF00; - and <<= 16; - and |= 0xFFFF; - break; - } -#endif - - /* - * special case copy and xor to avoid a test per pixel - */ - if (rop == GXcopy) - { -#if PSZ == 24 - switch(xIdx){ - case 0: - case 3: - while (len--){ - *bits = (*bits & mask)| xor; - bits += nlwidth; - } - break; - case 1: - case 2: - while (len--){ - *bits = (*bits & mask)| xor; - bits++; - *bits = (*bits & mask2)| xor2; - bits--; - bits += nlwidth; - } - break; - } -#else - while (len--) - { - *bits = xor; - bits += nlwidth; - } -#endif - } - else if (rop == GXxor) - { -#if PSZ == 24 - switch(xIdx){ - case 0: - case 3: - while (len--){ - *bits ^= xor; - bits += nlwidth; - } - break; - case 1: - case 2: - while (len--){ - *bits ^= xor; - bits++; - *bits ^= xor2; - bits--; - bits += nlwidth; - } - break; - } -#else - while (len--) - { - *bits ^= xor; - bits += nlwidth; - } -#endif - } - else - { -#if PSZ == 24 - switch(xIdx){ - case 0: - while (len--){ - *bits = DoMaskRRop(*bits, and, xor, 0x00FFFFFF); - bits += nlwidth; - } - break; - case 3: - while (len--){ - *bits = DoMaskRRop(*bits, and, xor, 0xFFFFFF00); - bits += nlwidth; - } - break; - case 1: - while (len--){ - *bits = DoMaskRRop(*bits, and, xor, 0xFF000000); - bits++; - *bits = DoMaskRRop(*bits, and2, xor2, 0x0000FFFF); - bits--; - bits += nlwidth; - } - break; - case 2: - while (len--){ - *bits = DoMaskRRop(*bits, and, xor, 0xFFFF0000); - bits++; - *bits = DoMaskRRop(*bits, and2, xor2, 0x000000FF); - bits--; - bits += nlwidth; - } - break; - } -#else - while (len--) - { - *bits = DoRRop(*bits, and, xor); - bits += nlwidth; - } -#endif - } -#else /* !PIXEL_ADDR */ -#if PSZ == 24 - addrl = addrl + (y1 * nlwidth) + ((x1*3) >>2); - - and |= ~cfbmask[(x1 & 3)<<1]; - xor &= cfbmask[(x1 & 3)<<1]; -#else - addrl = addrl + (y1 * nlwidth) + (x1 >> PWSH); - - and |= ~cfbmask[x1 & PIM]; - xor &= cfbmask[x1 & PIM]; -#endif - - while (len--) - { - *addrl = DoRRop (*addrl, and, xor); - addrl += nlwidth; - } -#endif -} diff --git a/cfb/cfbigblt8.c b/cfb/cfbigblt8.c deleted file mode 100644 index 1f1ce6f37..000000000 --- a/cfb/cfbigblt8.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "mi.h" -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -void -cfbImageGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GCPtr pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; - pointer pglyphBase; -{ - ExtentInfoRec info; /* used by QueryGlyphExtents() */ - xRectangle backrect; - int fgPixel; - cfbPrivGC *priv; - - /* - * We can't avoid GC validations if calling mi functions. - */ - if ((pGC->ops->PolyFillRect == miPolyFillRect) || - (pGC->ops->PolyGlyphBlt == miPolyGlyphBlt)) - { - miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - return; - } - - QueryGlyphExtents(pGC->font, ppci, (unsigned long)nglyph, &info); - - if (info.overallWidth >= 0) - { - backrect.x = x; - backrect.width = info.overallWidth; - } - else - { - backrect.x = x + info.overallWidth; - backrect.width = -info.overallWidth; - } - backrect.y = y - FONTASCENT(pGC->font); - backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - - priv = cfbGetGCPrivate(pGC); - - /* this code cheats by knowing that ValidateGC isn't - * necessary for PolyFillRect - */ - - fgPixel = pGC->fgPixel; - - pGC->fgPixel = pGC->bgPixel; - priv->xor = PFILL(pGC->bgPixel); - - (*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &backrect); - - pGC->fgPixel = fgPixel; - - priv->xor = PFILL(pGC->fgPixel); - - (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - -} diff --git a/cfb/cfbimage.c b/cfb/cfbimage.c deleted file mode 100644 index 396e1fcb2..000000000 --- a/cfb/cfbimage.c +++ /dev/null @@ -1,206 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "servermd.h" -#include "mi.h" - -void -cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage) - DrawablePtr pDraw; - GCPtr pGC; - int depth, x, y, w, h; - int leftPad; - int format; - char *pImage; -{ - PixmapPtr pPixmap; - - if ((w == 0) || (h == 0)) - return; - - if (format != XYPixmap) - { - pPixmap = GetScratchPixmapHeader(pDraw->pScreen, w+leftPad, h, depth, - BitsPerPixel(depth), PixmapBytePad(w+leftPad, depth), - (pointer)pImage); - if (!pPixmap) - return; - - pGC->fExpose = FALSE; - if (format == ZPixmap) - (void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, - leftPad, 0, w, h, x, y); - else - (void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, - leftPad, 0, w, h, x, y, 1); - pGC->fExpose = TRUE; - FreeScratchPixmapHeader(pPixmap); - } - else - { - CfbBits oldFg, oldBg; - XID gcv[3]; - CfbBits oldPlanemask; - unsigned long i; - long bytesPer; - - 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(pDraw, pGC); - (*pGC->ops->PutImage)(pDraw, 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); - ValidateGC(pDraw, pGC); - } -} - -void -cfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine) - DrawablePtr pDrawable; - int sx, sy, w, h; - unsigned int format; - unsigned long planeMask; - char *pdstLine; -{ - BoxRec box; - DDXPointRec ptSrc; - RegionRec rgnDst; - ScreenPtr pScreen; - PixmapPtr pPixmap; - - if ((w == 0) || (h == 0)) - return; - if (pDrawable->bitsPerPixel == 1) - { - mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - return; - } - pScreen = pDrawable->pScreen; - /* - * XFree86 DDX empties the root borderClip when the VT is - * switched away; this checks for that case - */ - if (!cfbDrawableEnabled (pDrawable)) - return; - if (format == ZPixmap) - { - pPixmap = GetScratchPixmapHeader(pScreen, w, h, - pDrawable->depth, pDrawable->bitsPerPixel, - PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine); - if (!pPixmap) - return; - if ((planeMask & PMSK) != PMSK) - bzero((char *)pdstLine, pPixmap->devKind * h); - ptSrc.x = sx + pDrawable->x; - ptSrc.y = sy + pDrawable->y; - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - cfbDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, - &ptSrc, planeMask); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(pPixmap); - } - else - { - -#if IMAGE_BYTE_ORDER == LSBFirst - - pPixmap = GetScratchPixmapHeader(pScreen, w, h, /*depth*/ 1, - /*bpp*/ 1, BitmapBytePad(w), (pointer)pdstLine); - if (!pPixmap) - return; - - ptSrc.x = sx + pDrawable->x; - ptSrc.y = sy + pDrawable->y; - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - cfbCopyImagePlane (pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, - &ptSrc, planeMask); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(pPixmap); -#else - miGetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); -#endif - } -} diff --git a/cfb/cfbline.c b/cfb/cfbline.c deleted file mode 100644 index 84c089a73..000000000 --- a/cfb/cfbline.c +++ /dev/null @@ -1,756 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include - -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "mistruct.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "miline.h" - -/* single-pixel lines on a color frame buffer - - NON-SLOPED LINES - horizontal lines are always drawn left to right; we have to -move the endpoints right by one after they're swapped. - horizontal lines will be confined to a single band of a -region. the code finds that band (giving up if the lower -bound of the band is above the line we're drawing); then it -finds the first box in that band that contains part of the -line. we clip the line to subsequent boxes in that band. - vertical lines are always drawn top to bottom (y-increasing.) -this requires adding one to the y-coordinate of each endpoint -after swapping. - - SLOPED LINES - when clipping a sloped line, we bring the second point inside -the clipping box, rather than one beyond it, and then add 1 to -the length of the line before drawing it. this lets us use -the same box for finding the outcodes for both endpoints. since -the equation for clipping the second endpoint to an edge gives us -1 beyond the edge, we then have to move the point towards the -first point by one step on the major axis. - eventually, there will be a diagram here to explain what's going -on. the method uses Cohen-Sutherland outcodes to determine -outsideness, and a method similar to Pike's layers for doing the -actual clipping. - -*/ - -void -#ifdef POLYSEGMENT -cfbSegmentSS (pDrawable, pGC, nseg, pSeg) - DrawablePtr pDrawable; - GCPtr pGC; - int nseg; - register xSegment *pSeg; -#else -cfbLineSS (pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; /* number of points */ - DDXPointPtr pptInit; -#endif -{ - int nboxInit; - register int nbox; - BoxPtr pboxInit; - register BoxPtr pbox; -#ifndef POLYSEGMENT - register DDXPointPtr ppt; /* pointer to list of translated points */ -#endif - - unsigned int oc1; /* outcode of point 1 */ - unsigned int oc2; /* outcode of point 2 */ - - CfbBits *addrl; /* address of destination pixmap */ - int nlwidth; /* width in longwords of destination pixmap */ - int xorg, yorg; /* origin of window */ - - int adx; /* abs values of dx and dy */ - int ady; - int signdx; /* sign of dx and dy */ - int signdy; - int e, e1, e2; /* bresenham error and increments */ - int len; /* length of segment */ - int axis; /* major axis */ - int octant; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - - /* a bunch of temporaries */ - int tmp; - register int y1, y2; - register int x1, x2; - RegionPtr cclip; - cfbPrivGCPtr devPriv; - CfbBits xor, and; - int alu; - - devPriv = cfbGetGCPrivate(pGC); - cclip = pGC->pCompositeClip; - pboxInit = REGION_RECTS(cclip); - nboxInit = REGION_NUM_RECTS(cclip); - - cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl) - - alu = devPriv->rop; - xor = devPriv->xor; - and = devPriv->and; - xorg = pDrawable->x; - yorg = pDrawable->y; -#ifdef POLYSEGMENT - while (nseg--) -#else - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - while(--npt) -#endif - { - nbox = nboxInit; - pbox = pboxInit; - -#ifdef POLYSEGMENT - x1 = pSeg->x1 + xorg; - y1 = pSeg->y1 + yorg; - x2 = pSeg->x2 + xorg; - y2 = pSeg->y2 + yorg; - pSeg++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) - { - xorg = x1; - yorg = y1; - } - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; -#endif - - if (x1 == x2) /* vertical line */ - { - /* make the line go top to bottom of screen, keeping - endpoint semantics - */ - if (y1 > y2) - { - register int tmp; - - tmp = y2; - y2 = y1 + 1; - y1 = tmp + 1; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - y1--; -#endif - } -#ifdef POLYSEGMENT - else if (pGC->capStyle != CapNotLast) - y2++; -#endif - /* get to first band that might contain part of line */ - while ((nbox) && (pbox->y2 <= y1)) - { - pbox++; - nbox--; - } - - if (nbox) - { - /* stop when lower edge of box is beyond end of line */ - while((nbox) && (y2 >= pbox->y1)) - { - if ((x1 >= pbox->x1) && (x1 < pbox->x2)) - { - int y1t, y2t; - /* this box has part of the line in it */ - y1t = max(y1, pbox->y1); - y2t = min(y2, pbox->y2); - if (y1t != y2t) - { - cfbVertS (alu, and, xor, - addrl, nlwidth, - x1, y1t, y2t-y1t); - } - } - nbox--; - pbox++; - } - } -#ifndef POLYSEGMENT - y2 = ppt->y + yorg; -#endif - } - else if (y1 == y2) /* horizontal line */ - { - /* force line from left to right, keeping - endpoint semantics - */ - if (x1 > x2) - { - register int tmp; - - tmp = x2; - x2 = x1 + 1; - x1 = tmp + 1; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - x1--; -#endif - } -#ifdef POLYSEGMENT - else if (pGC->capStyle != CapNotLast) - x2++; -#endif - - /* find the correct band */ - while( (nbox) && (pbox->y2 <= y1)) - { - pbox++; - nbox--; - } - - /* try to draw the line, if we haven't gone beyond it */ - if ((nbox) && (pbox->y1 <= y1)) - { - /* when we leave this band, we're done */ - tmp = pbox->y1; - while((nbox) && (pbox->y1 == tmp)) - { - int x1t, x2t; - - if (pbox->x2 <= x1) - { - /* skip boxes until one might contain start point */ - nbox--; - pbox++; - continue; - } - - /* stop if left of box is beyond right of line */ - if (pbox->x1 >= x2) - { - nbox = 0; - break; - } - - x1t = max(x1, pbox->x1); - x2t = min(x2, pbox->x2); - if (x1t != x2t) - { - cfbHorzS (alu, and, xor, - addrl, nlwidth, - x1t, y1, x2t-x1t); - } - nbox--; - pbox++; - } - } -#ifndef POLYSEGMENT - x2 = ppt->x + xorg; -#endif - } - else /* sloped line */ - { - CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, - 1, 1, octant); - - if (adx > ady) - { - axis = X_AXIS; - e1 = ady << 1; - e2 = e1 - (adx << 1); - e = e1 - adx; - } - else - { - axis = Y_AXIS; - e1 = adx << 1; - e2 = e1 - (ady << 1); - e = e1 - ady; - SetYMajorOctant(octant); - } - - FIXUP_ERROR(e, octant, bias); - - /* we have bresenham parameters and two points. - all we have to do now is clip and draw. - */ - - while(nbox--) - { - oc1 = 0; - oc2 = 0; - OUTCODES(oc1, x1, y1, pbox); - OUTCODES(oc2, x2, y2, pbox); - if ((oc1 | oc2) == 0) - { - if (axis == X_AXIS) - len = adx; - else - len = ady; -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - len++; -#endif - cfbBresS (alu, and, xor, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, len); - break; - } - else if (oc1 & oc2) - { - pbox++; - } - else - { - int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; - int clip1 = 0, clip2 = 0; - int clipdx, clipdy; - int err; - - if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, - pbox->y2-1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, &clip1, &clip2, - octant, bias, oc1, oc2) == -1) - { - pbox++; - continue; - } - - if (axis == X_AXIS) - len = abs(new_x2 - new_x1); - else - len = abs(new_y2 - new_y1); -#ifdef POLYSEGMENT - if (clip2 != 0 || pGC->capStyle != CapNotLast) - len++; -#else - len += (clip2 != 0); -#endif - if (len) - { - /* unwind bresenham error term to first point */ - if (clip1) - { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - if (axis == X_AXIS) - err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); - else - err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); - } - else - err = e; - cfbBresS(alu, and, xor, - addrl, nlwidth, - signdx, signdy, axis, new_x1, new_y1, - err, e1, e2, len); - } - pbox++; - } - } /* while (nbox--) */ - } /* sloped line */ - } /* while (nline--) */ - -#ifndef POLYSEGMENT - /* paint the last point if the end style isn't CapNotLast. - (Assume that a projecting, butt, or round cap that is one - pixel wide is the same as the single pixel of the endpoint.) - */ - - if ((pGC->capStyle != CapNotLast) && - ((ppt->x + xorg != pptInit->x + pDrawable->x) || - (ppt->y + yorg != pptInit->y + pDrawable->y) || - (ppt == pptInit + 1))) - { - nbox = nboxInit; - pbox = pboxInit; - while (nbox--) - { - if ((x2 >= pbox->x1) && - (y2 >= pbox->y1) && - (x2 < pbox->x2) && - (y2 < pbox->y2)) - { - CfbBits mask; - CfbBits scrbits; - -#if PSZ == 24 - mask = cfbmask[(x2 & 3)<<1]; - addrl += (y2 * nlwidth) + ((x2*3) >> 2); -#else - mask = cfbmask[x2 & PIM]; - addrl += (y2 * nlwidth) + (x2 >> PWSH); -#endif - scrbits = *addrl; - *addrl = (scrbits & ~mask) | - (DoRRop (scrbits, and, xor) & mask); - break; - } - else - pbox++; - } - } -#endif -} - -/* - * Draw dashed 1-pixel lines. - */ - -void -#ifdef POLYSEGMENT -cfbSegmentSD (pDrawable, pGC, nseg, pSeg) - DrawablePtr pDrawable; - register GCPtr pGC; - int nseg; - register xSegment *pSeg; -#else -cfbLineSD( pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - register GCPtr pGC; - int mode; /* Origin or Previous */ - int npt; /* number of points */ - DDXPointPtr pptInit; -#endif -{ - int nboxInit; - register int nbox; - BoxPtr pboxInit; - register BoxPtr pbox; -#ifndef POLYSEGMENT - register DDXPointPtr ppt; /* pointer to list of translated points */ -#endif - - register unsigned int oc1; /* outcode of point 1 */ - register unsigned int oc2; /* outcode of point 2 */ - - CfbBits *addrl; /* address of destination pixmap */ - int nlwidth; /* width in longwords of destination pixmap */ - int xorg, yorg; /* origin of window */ - - int adx; /* abs values of dx and dy */ - int ady; - int signdx; /* sign of dx and dy */ - int signdy; - int e, e1, e2; /* bresenham error and increments */ - int len; /* length of segment */ - int axis; /* major axis */ - int octant; - unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - int x1, x2, y1, y2; - RegionPtr cclip; - cfbRRopRec rrops[2]; - unsigned char *pDash; - int dashOffset; - int numInDashList; - int dashIndex; - int isDoubleDash; - int dashIndexTmp, dashOffsetTmp; - int unclippedlen; - cfbPrivGCPtr devPriv; - - devPriv = cfbGetGCPrivate(pGC); - cclip = pGC->pCompositeClip; - rrops[0].rop = devPriv->rop; - rrops[0].and = devPriv->and; - rrops[0].xor = devPriv->xor; - if (pGC->alu == GXcopy) - { - rrops[1].rop = GXcopy; - rrops[1].and = 0; - rrops[1].xor = PFILL (pGC->bgPixel); - } - else - { - rrops[1].rop = cfbReduceRasterOp (pGC->alu, - pGC->bgPixel, pGC->planemask, - &rrops[1].and, &rrops[1].xor); - } - pboxInit = REGION_RECTS(cclip); - nboxInit = REGION_NUM_RECTS(cclip); - - cfbGetLongWidthAndPointer (pDrawable, nlwidth, addrl) - - /* compute initial dash values */ - - pDash = (unsigned char *) pGC->dash; - numInDashList = pGC->numInDashList; - isDoubleDash = (pGC->lineStyle == LineDoubleDash); - dashIndex = 0; - dashOffset = 0; - miStepDash ((int)pGC->dashOffset, &dashIndex, pDash, - numInDashList, &dashOffset); - - xorg = pDrawable->x; - yorg = pDrawable->y; -#ifdef POLYSEGMENT - while (nseg--) -#else - ppt = pptInit; - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; - while(--npt) -#endif - { - nbox = nboxInit; - pbox = pboxInit; - -#ifdef POLYSEGMENT - x1 = pSeg->x1 + xorg; - y1 = pSeg->y1 + yorg; - x2 = pSeg->x2 + xorg; - y2 = pSeg->y2 + yorg; - pSeg++; -#else - x1 = x2; - y1 = y2; - ++ppt; - if (mode == CoordModePrevious) - { - xorg = x1; - yorg = y1; - } - x2 = ppt->x + xorg; - y2 = ppt->y + yorg; -#endif - - CalcLineDeltas(x1, y1, x2, y2, adx, ady, signdx, signdy, 1, 1, octant); - - if (adx > ady) - { - axis = X_AXIS; - e1 = ady << 1; - e2 = e1 - (adx << 1); - e = e1 - adx; - unclippedlen = adx; - } - else - { - axis = Y_AXIS; - e1 = adx << 1; - e2 = e1 - (ady << 1); - e = e1 - ady; - unclippedlen = ady; - SetYMajorOctant(octant); - } - - FIXUP_ERROR(e, octant, bias); - - /* we have bresenham parameters and two points. - all we have to do now is clip and draw. - */ - - while(nbox--) - { - oc1 = 0; - oc2 = 0; - OUTCODES(oc1, x1, y1, pbox); - OUTCODES(oc2, x2, y2, pbox); - if ((oc1 | oc2) == 0) - { -#ifdef POLYSEGMENT - if (pGC->capStyle != CapNotLast) - unclippedlen++; - dashIndexTmp = dashIndex; - dashOffsetTmp = dashOffset; - cfbBresD (rrops, - &dashIndexTmp, pDash, numInDashList, - &dashOffsetTmp, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, unclippedlen); - break; -#else - cfbBresD (rrops, - &dashIndex, pDash, numInDashList, - &dashOffset, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, x1, y1, - e, e1, e2, unclippedlen); - goto dontStep; -#endif - } - else if (oc1 & oc2) - { - pbox++; - } - else /* have to clip */ - { - int new_x1 = x1, new_y1 = y1, new_x2 = x2, new_y2 = y2; - int clip1 = 0, clip2 = 0; - int clipdx, clipdy; - int err; - - if (miZeroClipLine(pbox->x1, pbox->y1, pbox->x2-1, - pbox->y2-1, - &new_x1, &new_y1, &new_x2, &new_y2, - adx, ady, &clip1, &clip2, - octant, bias, oc1, oc2) == -1) - { - pbox++; - continue; - } - - dashIndexTmp = dashIndex; - dashOffsetTmp = dashOffset; - - if (clip1) - { - int dlen; - - if (axis == X_AXIS) - dlen = abs(new_x1 - x1); - else - dlen = abs(new_y1 - y1); - miStepDash (dlen, &dashIndexTmp, pDash, - numInDashList, &dashOffsetTmp); - } - - if (axis == X_AXIS) - len = abs(new_x2 - new_x1); - else - len = abs(new_y2 - new_y1); -#ifdef POLYSEGMENT - if (clip2 != 0 || pGC->capStyle != CapNotLast) - len++; -#else - len += (clip2 != 0); -#endif - if (len) - { - /* unwind bresenham error term to first point */ - if (clip1) - { - clipdx = abs(new_x1 - x1); - clipdy = abs(new_y1 - y1); - if (axis == X_AXIS) - err = e+((clipdy*e2) + ((clipdx-clipdy)*e1)); - else - err = e+((clipdx*e2) + ((clipdy-clipdx)*e1)); - } - else - err = e; - cfbBresD (rrops, - &dashIndexTmp, pDash, numInDashList, - &dashOffsetTmp, isDoubleDash, - addrl, nlwidth, - signdx, signdy, axis, new_x1, new_y1, - err, e1, e2, len); - } - pbox++; - } - } /* while (nbox--) */ -#ifndef POLYSEGMENT - /* - * walk the dash list around to the next line - */ - miStepDash (unclippedlen, &dashIndex, pDash, - numInDashList, &dashOffset); -dontStep: ; -#endif - } /* while (nline--) */ - -#ifndef POLYSEGMENT - /* paint the last point if the end style isn't CapNotLast. - (Assume that a projecting, butt, or round cap that is one - pixel wide is the same as the single pixel of the endpoint.) - */ - - if ((pGC->capStyle != CapNotLast) && - ((dashIndex & 1) == 0 || isDoubleDash) && - ((ppt->x + xorg != pptInit->x + pDrawable->x) || - (ppt->y + yorg != pptInit->y + pDrawable->y) || - (ppt == pptInit + 1))) - { - nbox = nboxInit; - pbox = pboxInit; - while (nbox--) - { - if ((x2 >= pbox->x1) && - (y2 >= pbox->y1) && - (x2 < pbox->x2) && - (y2 < pbox->y2)) - { - CfbBits mask; - int pix; - - pix = 0; - if (dashIndex & 1) - pix = 1; -#if PSZ == 24 - mask = cfbmask[(x2 & 3)<<1]; - addrl += (y2 * nlwidth) + ((x2 *3)>> 2); -#else - mask = cfbmask[x2 & PIM]; - addrl += (y2 * nlwidth) + (x2 >> PWSH); -#endif - *addrl = DoMaskRRop (*addrl, rrops[pix].and, rrops[pix].xor, mask); - break; - } - else - pbox++; - } - } -#endif -} diff --git a/cfb/cfbmap.h b/cfb/cfbmap.h deleted file mode 100644 index 16e4afc3c..000000000 --- a/cfb/cfbmap.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - - -/* - * Map names around so that multiple depths can be supported simultaneously - */ - -/* a losing vendor cpp dumps core if we define CFBNAME in terms of CATNAME */ - -#if PSZ != 8 - -#if PSZ == 32 -#if !defined(UNIXCPP) || defined(ANSICPP) -#define CFBNAME(subname) cfb32##subname -#else -#define CFBNAME(subname) cfb32/**/subname -#endif -#endif - -#if PSZ == 24 -#if !defined(UNIXCPP) || defined(ANSICPP) -#define CFBNAME(subname) cfb24##subname -#else -#define CFBNAME(subname) cfb24/**/subname -#endif -#endif - -#if PSZ == 16 -#if !defined(UNIXCPP) || defined(ANSICPP) -#define CFBNAME(subname) cfb16##subname -#else -#define CFBNAME(subname) cfb16/**/subname -#endif -#endif - -#if PSZ == 4 -#if !defined(UNIXCPP) || defined(ANSICPP) -#define CFBNAME(subname) cfb4##subname -#else -#define CFBNAME(subname) cfb4/**/subname -#endif -#endif - -#ifndef CFBNAME -cfb can not hack PSZ yet -#endif - -#undef CATNAME - -#if !defined(UNIXCPP) || defined(ANSICPP) -#define CATNAME(prefix,subname) prefix##subname -#else -#define CATNAME(prefix,subname) prefix/**/subname -#endif - -#define QuartetBitsTable CFBNAME(QuartetBitsTable) -#define QuartetPixelMaskTable CFBNAME(QuartetPixelMaskTable) -#define cfb8ClippedLineCopy CFBNAME(ClippedLineCopy) -#define cfb8ClippedLineGeneral CFBNAME(ClippedLineGeneral ) -#define cfb8ClippedLineXor CFBNAME(ClippedLineXor) -#define cfb8LineSS1Rect CFBNAME(LineSS1Rect) -#define cfb8LineSS1RectCopy CFBNAME(LineSS1RectCopy) -#define cfb8LineSS1RectGeneral CFBNAME(LineSS1RectGeneral ) -#define cfb8LineSS1RectPreviousCopy CFBNAME(LineSS1RectPreviousCopy) -#define cfb8LineSS1RectXor CFBNAME(LineSS1RectXor) -#define cfb8SegmentSS1Rect CFBNAME(SegmentSS1Rect) -#define cfb8SegmentSS1RectCopy CFBNAME(SegmentSS1RectCopy) -#define cfb8SegmentSS1RectGeneral CFBNAME(SegmentSS1RectGeneral ) -#define cfb8SegmentSS1RectShiftCopy CFBNAME(SegmentSS1RectShiftCopy) -#define cfb8SegmentSS1RectXor CFBNAME(SegmentSS1RectXor) -#define cfbAllocatePrivates CFBNAME(AllocatePrivates) -#define cfbBSFuncRec CFBNAME(BSFuncRec) -#define cfbBitBlt CFBNAME(BitBlt) -#define cfbBresD CFBNAME(BresD) -#define cfbBresS CFBNAME(BresS) -#define cfbChangeWindowAttributes CFBNAME(ChangeWindowAttributes) -#define cfbClearVisualTypes CFBNAME(cfbClearVisualTypes) -#define cfbCloseScreen CFBNAME(CloseScreen) -#define cfbCreateDefColormap CFBNAME (cfbCreateDefColormap) -#define cfbCopyArea CFBNAME(CopyArea) -#define cfbCopyImagePlane CFBNAME(CopyImagePlane) -#define cfbCopyPixmap CFBNAME(CopyPixmap) -#define cfbCopyPlane CFBNAME(CopyPlane) -#define cfbCopyPlaneReduce CFBNAME(CopyPlaneReduce) -#define cfbCopyRotatePixmap CFBNAME(CopyRotatePixmap) -#define cfbCopyWindow CFBNAME(CopyWindow) -#define cfbCreateGC CFBNAME(CreateGC) -#define cfbCreatePixmap CFBNAME(CreatePixmap) -#define cfbCreateScreenResources CFBNAME(CreateScreenResources) -#define cfbCreateWindow CFBNAME(CreateWindow) -#define cfbDestroyPixmap CFBNAME(DestroyPixmap) -#define cfbDestroyWindow CFBNAME(DestroyWindow) -#define cfbDoBitblt CFBNAME(DoBitblt) -#define cfbDoBitbltCopy CFBNAME(DoBitbltCopy) -#define cfbDoBitbltGeneral CFBNAME(DoBitbltGeneral) -#define cfbDoBitbltOr CFBNAME(DoBitbltOr) -#define cfbDoBitbltXor CFBNAME(DoBitbltXor) -#define cfbExpandDirectColors CFBNAME(cfbExpandDirectColors) -#define cfbFillBoxTile32sCopy CFBNAME(FillBoxTile32sCopy) -#define cfbFillBoxTile32sGeneral CFBNAME(FillBoxTile32sGeneral) -#define cfbFillBoxTileOdd CFBNAME(FillBoxTileOdd) -#define cfbFillBoxTileOddCopy CFBNAME(FillBoxTileOddCopy) -#define cfbFillBoxTileOddGeneral CFBNAME(FillBoxTileOddGeneral) -#define cfbFillPoly1RectCopy CFBNAME(FillPoly1RectCopy) -#define cfbFillPoly1RectGeneral CFBNAME(FillPoly1RectGeneral) -#define cfbFillRectSolidCopy CFBNAME(FillRectSolidCopy) -#define cfbFillRectSolidGeneral CFBNAME(FillRectSolidGeneral) -#define cfbFillRectSolidXor CFBNAME(FillRectSolidXor) -#define cfbFillRectTile32Copy CFBNAME(FillRectTile32Copy) -#define cfbFillRectTile32General CFBNAME(FillRectTile32General) -#define cfbFillRectTileOdd CFBNAME(FillRectTileOdd) -#define cfbFillSpanTile32sCopy CFBNAME(FillSpanTile32sCopy) -#define cfbFillSpanTile32sGeneral CFBNAME(FillSpanTile32sGeneral) -#define cfbFillSpanTileOddCopy CFBNAME(FillSpanTileOddCopy) -#define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral) -#define cfbFinishScreenInit CFBNAME(FinishScreenInit) -#define cfbGCFuncs CFBNAME(GCFuncs) -#define cfbGCPrivateKey CFBNAME(GCPrivateKey) -#define cfbGetImage CFBNAME(GetImage) -#define cfbGetScreenPixmap CFBNAME(GetScreenPixmap) -#define cfbGetSpans CFBNAME(GetSpans) -#define cfbHorzS CFBNAME(HorzS) -#define cfbImageGlyphBlt8 CFBNAME(ImageGlyphBlt8) -#define cfbInitializeColormap CFBNAME(InitializeColormap) -#define cfbInitVisuals CFBNAME(cfbInitVisuals) -#define cfbInstallColormap CFBNAME(InstallColormap) -#define cfbLineSD CFBNAME(LineSD) -#define cfbLineSS CFBNAME(LineSS) -#define cfbListInstalledColormaps CFBNAME(ListInstalledColormaps) -#define cfbMapWindow CFBNAME(MapWindow) -#define cfbMatchCommon CFBNAME(MatchCommon) -#define cfbNonTEOps CFBNAME(NonTEOps) -#define cfbNonTEOps1Rect CFBNAME(NonTEOps1Rect) -#define cfbPadPixmap CFBNAME(PadPixmap) -#define cfbPolyFillArcSolidCopy CFBNAME(PolyFillArcSolidCopy) -#define cfbPolyFillArcSolidGeneral CFBNAME(PolyFillArcSolidGeneral) -#define cfbPolyFillRect CFBNAME(PolyFillRect) -#define cfbPolyGlyphBlt8 CFBNAME(PolyGlyphBlt8) -#define cfbPolyGlyphRop8 CFBNAME(PolyGlyphRop8) -#define cfbPolyPoint CFBNAME(PolyPoint) -#define cfbPositionWindow CFBNAME(PositionWindow) -#define cfbPutImage CFBNAME(PutImage) -#define cfbReduceRasterOp CFBNAME(ReduceRasterOp) -#define cfbResolveColor CFBNAME(ResolveColor) -#define cfbRestoreAreas CFBNAME(RestoreAreas) -#define cfbSaveAreas CFBNAME(SaveAreas) -#define cfbScreenInit CFBNAME(ScreenInit) -#define cfbScreenPrivateKey CFBNAME(ScreenPrivateKey) -#define cfbSegmentSD CFBNAME(SegmentSD) -#define cfbSegmentSS CFBNAME(SegmentSS) -#define cfbSetScanline CFBNAME(SetScanline) -#define cfbSetScreenPixmap CFBNAME(SetScreenPixmap) -#define cfbSetSpans CFBNAME(SetSpans) -#define cfbSetVisualTypes CFBNAME(cfbSetVisualTypes) -#define cfbSetupScreen CFBNAME(SetupScreen) -#define cfbSolidSpansCopy CFBNAME(SolidSpansCopy) -#define cfbSolidSpansGeneral CFBNAME(SolidSpansGeneral) -#define cfbSolidSpansXor CFBNAME(SolidSpansXor) -#define cfbStippleStack CFBNAME(StippleStack) -#define cfbStippleStackTE CFBNAME(StippleStackTE) -#define cfbTEGlyphBlt CFBNAME(TEGlyphBlt) -#define cfbTEOps CFBNAME(TEOps) -#define cfbTEOps1Rect CFBNAME(TEOps1Rect) -#define cfbTile32FSCopy CFBNAME(Tile32FSCopy) -#define cfbTile32FSGeneral CFBNAME(Tile32FSGeneral) -#define cfbUninstallColormap CFBNAME(UninstallColormap) -#define cfbUnmapWindow CFBNAME(UnmapWindow) -#define cfbUnnaturalStippleFS CFBNAME(UnnaturalStippleFS) -#define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS) -#define cfbValidateGC CFBNAME(ValidateGC) -#define cfbVertS CFBNAME(VertS) -#define cfbWindowPrivateKey CFBNAME(WindowPrivateKey) -#define cfbXRotatePixmap CFBNAME(XRotatePixmap) -#define cfbYRotatePixmap CFBNAME(YRotatePixmap) -#define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy) -#define cfbZeroPolyArcSS8General CFBNAME(ZeroPolyArcSSGeneral) -#define cfbZeroPolyArcSS8Xor CFBNAME(ZeroPolyArcSSXor) -#define cfbendpartial CFBNAME(endpartial) -#define cfbendtab CFBNAME(endtab) -#define cfbmask CFBNAME(mask) -#define cfbrmask CFBNAME(rmask) -#define cfbstartpartial CFBNAME(startpartial) -#define cfbstarttab CFBNAME(starttab) - -#endif /* PSZ != 8 */ diff --git a/cfb/cfbmskbits.c b/cfb/cfbmskbits.c deleted file mode 100644 index 915ea35c1..000000000 --- a/cfb/cfbmskbits.c +++ /dev/null @@ -1,1400 +0,0 @@ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - - -/* - * ========================================================================== - * Converted to Color Frame Buffer by smarks@sun, April-May 1987. The "bit - * numbering" in the doc below really means "byte numbering" now. - * ========================================================================== - */ - -/* - these tables are used by several macros in the cfb code. - - the vax numbers everything left to right, so bit indices on the -screen match bit indices in longwords. the pc-rt and Sun number -bits on the screen the way they would be written on paper, -(i.e. msb to the left), and so a bit index n on the screen is -bit index 32-n in a longword - - see also cfbmskbits.h -*/ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "cfb.h" -#include "cfbmskbits.h" - -#define _cfbBits(a) (PixelGroup)(a) - -#if (BITMAP_BIT_ORDER == MSBFirst) -#define cfbBits(v) _cfbBits(v) -#else /* BITMAP_BIT_ORDER == LSBFirst */ -#define cfbFlip2(a) ((((a) & 0x1) << 1) | (((a) & 0x2) >> 1)) -#define cfbFlip4(a) ((cfbFlip2(a) << 2) | cfbFlip2(a >> 2)) -#define cfbFlip8(a) ((cfbFlip4(a) << 4) | cfbFlip4(a >> 4)) -#define cfbFlip16(a) ((cfbFlip8(a) << 8) | cfbFlip8(a >> 8)) -#define cfbFlip32(a) ((cfbFlip16(a) << 16) | cfbFlip16(a >> 16)) -#if PGSZ == 32 -#define cfbBits(a) cfbFlip32(_cfbBits(a)) -#else /* PGSZ == 64 */ -#define cfbFlip64(a) ((cfbFlip32(a) << 32) | cfbFlip32(a >> 32)) -#define cfbBits(a) cfbFlip64(_cfbBits(a)) -#endif /* PGSZ */ -#endif /* BITMAP_BIT_ORDER */ - -/* NOTE: -the first element in starttab could be 0xffffffff. making it 0 -lets us deal with a full first word in the middle loop, rather -than having to do the multiple reads and masks that we'd -have to do if we thought it was partial. -*/ -#if PSZ == 4 -#if PGSZ == 32 -PixelGroup cfbstarttab[] = - { - cfbBits(0x00000000), - cfbBits(0x0FFFFFFF), - cfbBits(0x00FFFFFF), - cfbBits(0x000FFFFF), - cfbBits(0x0000FFFF), - cfbBits(0x00000FFF), - cfbBits(0x000000FF), - cfbBits(0x0000000F) - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x00000000), - cfbBits(0xF0000000), - cfbBits(0xFF000000), - cfbBits(0xFFF00000), - cfbBits(0xFFFF0000), - cfbBits(0xFFFFF000), - cfbBits(0xFFFFFF00), - cfbBits(0xFFFFFFF0) - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstarttab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x0FFFFFFFFFFFFFFF), - cfbBits(0x00FFFFFFFFFFFFFF), - cfbBits(0x000FFFFFFFFFFFFF), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x00000FFFFFFFFFFF), - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0x0000000FFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x000000000FFFFFFF), - cfbBits(0x0000000000FFFFFF), - cfbBits(0x00000000000FFFFF), - cfbBits(0x000000000000FFFF), - cfbBits(0x0000000000000FFF), - cfbBits(0x00000000000000FF), - cfbBits(0x000000000000000F), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0xF000000000000000), - cfbBits(0xFF00000000000000), - cfbBits(0xFFF0000000000000), - cfbBits(0xFFFF000000000000), - cfbBits(0xFFFFF00000000000), - cfbBits(0xFFFFFF0000000000), - cfbBits(0xFFFFFFF000000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFFFFF0000000), - cfbBits(0xFFFFFFFFFF000000), - cfbBits(0xFFFFFFFFFFF00000), - cfbBits(0xFFFFFFFFFFFF0000), - cfbBits(0xFFFFFFFFFFFFF000), - cfbBits(0xFFFFFFFFFFFFFF00), - cfbBits(0xFFFFFFFFFFFFFFF0), - }; -#endif /* PGSZ */ -#endif /* PSZ == 4 */ - -#if PSZ == 8 -#if PGSZ == 32 -PixelGroup cfbstarttab[] = - { - cfbBits(0x00000000), - cfbBits(0x00FFFFFF), - cfbBits(0x0000FFFF), - cfbBits(0x000000FF) - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x00000000), - cfbBits(0xFF000000), - cfbBits(0xFFFF0000), - cfbBits(0xFFFFFF00) - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstarttab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x00FFFFFFFFFFFFFF), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x0000000000FFFFFF), - cfbBits(0x000000000000FFFF), - cfbBits(0x00000000000000FF) - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0xFF00000000000000), - cfbBits(0xFFFF000000000000), - cfbBits(0xFFFFFF0000000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFFFFFF000000), - cfbBits(0xFFFFFFFFFFFF0000), - cfbBits(0xFFFFFFFFFFFFFF00) - }; -#endif /* PGSZ */ -#endif /* PSZ == 8 */ - -#if PSZ == 16 -#if PGSZ == 32 -PixelGroup cfbstarttab[] = - { - cfbBits(0x00000000), - cfbBits(0x0000FFFF), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x00000000), - cfbBits(0xFFFF0000), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstarttab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x000000000000FFFF), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0xFFFF000000000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFFFFFFFF0000), - }; -#endif /* PGSZ */ -#endif - -#if PSZ == 24 -#if PGSZ == 32 -PixelGroup cfbstarttab[] = - { - cfbBits(0x00000000), - cfbBits(0x000000FF), - cfbBits(0x0000FFFF), - cfbBits(0x00FFFFFF), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x00000000), - cfbBits(0xFFFFFF00), - cfbBits(0xFFFF0000), - cfbBits(0xFF000000), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstarttab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0x000000000000FFFF), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0xFFFFFFFFFF000000), - cfbBits(0xFFFF000000000000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 24 */ - -#if PSZ == 32 -#if PGSZ == 32 -PixelGroup cfbstarttab[] = - { - cfbBits(0x00000000), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x00000000), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstarttab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x00000000FFFFFFFF), - }; -PixelGroup cfbendtab[] = - { - cfbBits(0x0000000000000000), - cfbBits(0xFFFFFFFF00000000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 32 */ - -/* a hack, for now, since the entries for 0 need to be all - 1 bits, not all zeros. - this means the code DOES NOT WORK for segments of length - 0 (which is only a problem in the horizontal line code.) -*/ -#if PSZ == 4 -#if PGSZ == 32 -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0x0FFFFFFF), - cfbBits(0x00FFFFFF), - cfbBits(0x000FFFFF), - cfbBits(0x0000FFFF), - cfbBits(0x00000FFF), - cfbBits(0x000000FF), - cfbBits(0x0000000F) - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0xF0000000), - cfbBits(0xFF000000), - cfbBits(0xFFF00000), - cfbBits(0xFFFF0000), - cfbBits(0xFFFFF000), - cfbBits(0xFFFFFF00), - cfbBits(0xFFFFFFF0) - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0x0FFFFFFFFFFFFFFF), - cfbBits(0x00FFFFFFFFFFFFFF), - cfbBits(0x000FFFFFFFFFFFFF), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x00000FFFFFFFFFFF), - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0x0000000FFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x000000000FFFFFFF), - cfbBits(0x0000000000FFFFFF), - cfbBits(0x00000000000FFFFF), - cfbBits(0x000000000000FFFF), - cfbBits(0x0000000000000FFF), - cfbBits(0x00000000000000FF), - cfbBits(0x000000000000000F), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0xF000000000000000), - cfbBits(0xFF00000000000000), - cfbBits(0xFFF0000000000000), - cfbBits(0xFFFF000000000000), - cfbBits(0xFFFFF00000000000), - cfbBits(0xFFFFFF0000000000), - cfbBits(0xFFFFFFF000000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFFFFF0000000), - cfbBits(0xFFFFFFFFFF000000), - cfbBits(0xFFFFFFFFFFF00000), - cfbBits(0xFFFFFFFFFFFF0000), - cfbBits(0xFFFFFFFFFFFFF000), - cfbBits(0xFFFFFFFFFFFFFF00), - cfbBits(0xFFFFFFFFFFFFFFF0), - }; -#endif /* PGSZ */ -#endif /* PSZ == 4 */ - -#if PSZ == 8 -#if PGSZ == 32 -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0x00FFFFFF), - cfbBits(0x0000FFFF), - cfbBits(0x000000FF) - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0xFF000000), - cfbBits(0xFFFF0000), - cfbBits(0xFFFFFF00) - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0x00FFFFFFFFFFFFFF), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x0000000000FFFFFF), - cfbBits(0x000000000000FFFF), - cfbBits(0x00000000000000FF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0xFF00000000000000), - cfbBits(0xFFFF000000000000), - cfbBits(0xFFFFFF0000000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFFFFFF000000), - cfbBits(0xFFFFFFFFFFFF0000), - cfbBits(0xFFFFFFFFFFFFFF00), - }; -#endif /* PGSZ */ -#endif /* PSZ == 8 */ - -#if PSZ == 16 -#if PGSZ == 32 -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0x0000FFFF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0xFFFF0000), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x000000000000FFFF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0xFFFF000000000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFFFFFFFF0000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 16 */ - -#if PSZ == 24 -#if PGSZ == 32 -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0x000000FF), - cfbBits(0x0000FFFF), - cfbBits(0x00FFFFFF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFF), - cfbBits(0xFFFFFF00), - cfbBits(0xFFFF0000), - cfbBits(0xFF000000), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - cfbBits(0x0000000000FFFFFF), - cfbBits(0x000000000000FFFF), - cfbBits(0x00000000000000FF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0xFFFFFFFFFFFF0000), - cfbBits(0xFFFFFFFFFF000000), - cfbBits(0xFFFFFFFF00000000), - cfbBits(0xFFFFFF0000000000), - cfbBits(0xFFFF000000000000), - cfbBits(0xFF00000000000000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 24 */ - -#if PSZ == 32 -#if PGSZ == 32 -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFF), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbstartpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0x00000000FFFFFFFF), - }; - -PixelGroup cfbendpartial[] = - { - cfbBits(0xFFFFFFFFFFFFFFFF), - cfbBits(0xFFFFFFFF00000000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 32 */ - -/* used for masking bits in bresenham lines - mask[n] is used to mask out all but bit n in a longword (n is a -screen position). - rmask[n] is used to mask out the single bit at position n (n -is a screen posiotion.) -*/ - -#if PSZ == 4 -#if PGSZ == 32 -PixelGroup cfbmask[] = - { - cfbBits(0xF0000000), - cfbBits(0x0F000000), - cfbBits(0x00F00000), - cfbBits(0x000F0000), - cfbBits(0x0000F000), - cfbBits(0x00000F00), - cfbBits(0x000000F0), - cfbBits(0x0000000F) - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x0FFFFFFF), - cfbBits(0xF0FFFFFF), - cfbBits(0xFF0FFFFF), - cfbBits(0xFFF0FFFF), - cfbBits(0xFFFF0FFF), - cfbBits(0xFFFFF0FF), - cfbBits(0xFFFFFF0F), - cfbBits(0xFFFFFFF0) - }; -#else /* PGSZ == 64 */ -PixelGroup cfbmask[] = - { - cfbBits(0xF000000000000000), - cfbBits(0x0F00000000000000), - cfbBits(0x00F0000000000000), - cfbBits(0x000F000000000000), - cfbBits(0x0000F00000000000), - cfbBits(0x00000F0000000000), - cfbBits(0x000000F000000000), - cfbBits(0x0000000F00000000), - cfbBits(0x00000000F0000000), - cfbBits(0x000000000F000000), - cfbBits(0x0000000000F00000), - cfbBits(0x00000000000F0000), - cfbBits(0x000000000000F000), - cfbBits(0x0000000000000F00), - cfbBits(0x00000000000000F0), - cfbBits(0x000000000000000F), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x0FFFFFFFFFFFFFFF), - cfbBits(0xF0FFFFFFFFFFFFFF), - cfbBits(0xFF0FFFFFFFFFFFFF), - cfbBits(0xFFF0FFFFFFFFFFFF), - cfbBits(0xFFFF0FFFFFFFFFFF), - cfbBits(0xFFFFF0FFFFFFFFFF), - cfbBits(0xFFFFFF0FFFFFFFFF), - cfbBits(0xFFFFFFF0FFFFFFFF), - cfbBits(0xFFFFFFFF0FFFFFFF), - cfbBits(0xFFFFFFFFF0FFFFFF), - cfbBits(0xFFFFFFFFFF0FFFFF), - cfbBits(0xFFFFFFFFFFF0FFFF), - cfbBits(0xFFFFFFFFFFFF0FFF), - cfbBits(0xFFFFFFFFFFFFF0FF), - cfbBits(0xFFFFFFFFFFFFFF0F), - cfbBits(0xFFFFFFFFFFFFFFF0), - }; -#endif /* PGSZ */ -#endif /* PSZ == 4 */ - -#if PSZ == 8 -#if PGSZ == 32 -PixelGroup cfbmask[] = - { - cfbBits(0xFF000000), - cfbBits(0x00FF0000), - cfbBits(0x0000FF00), - cfbBits(0x000000FF) - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x00FFFFFF), - cfbBits(0xFF00FFFF), - cfbBits(0xFFFF00FF), - cfbBits(0xFFFFFF00) - }; -#else /* PGSZ == 64 */ -PixelGroup cfbmask[] = - { - cfbBits(0xFF00000000000000), - cfbBits(0x00FF000000000000), - cfbBits(0x0000FF0000000000), - cfbBits(0x000000FF00000000), - cfbBits(0x00000000FF000000), - cfbBits(0x0000000000FF0000), - cfbBits(0x000000000000FF00), - cfbBits(0x00000000000000FF), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x00FFFFFFFFFFFFFF), - cfbBits(0xFF00FFFFFFFFFFFF), - cfbBits(0xFFFF00FFFFFFFFFF), - cfbBits(0xFFFFFF00FFFFFFFF), - cfbBits(0xFFFFFFFF00FFFFFF), - cfbBits(0xFFFFFFFFFF00FFFF), - cfbBits(0xFFFFFFFFFFFF00FF), - cfbBits(0xFFFFFFFFFFFFFF00), - }; -#endif /* PGSZ */ -#endif /* PSZ == 8 */ - -#if PSZ == 16 -#if PGSZ == 32 -PixelGroup cfbmask[] = - { - cfbBits(0xFFFF0000), - cfbBits(0x0000FFFF), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x0000FFFF), - cfbBits(0xFFFF0000), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbmask[] = - { - cfbBits(0xFFFF000000000000), - cfbBits(0x0000FFFF00000000), - cfbBits(0x00000000FFFF0000), - cfbBits(0x000000000000FFFF), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x0000FFFFFFFFFFFF), - cfbBits(0xFFFF0000FFFFFFFF), - cfbBits(0xFFFFFFFF0000FFFF), - cfbBits(0xFFFFFFFFFFFF0000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 16 */ - -#if PSZ == 24 -#if PGSZ == 32 -PixelGroup cfbmask[] = - { - cfbBits(0xFFFFFF00), - cfbBits(0x00000000), - cfbBits(0x000000FF), - cfbBits(0xFFFF0000), - cfbBits(0x0000FFFF), - cfbBits(0xFF000000), - cfbBits(0x00FFFFFF), - cfbBits(0x00000000), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x000000FF), - cfbBits(0xFFFFFFFF), - cfbBits(0xFFFFFF00), - cfbBits(0x0000FFFF), - cfbBits(0xFFFF0000), - cfbBits(0x00FFFFFF), - cfbBits(0xFF000000), - cfbBits(0xFFFFFFFF), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbmask[] = - { - cfbBits(0xFFFFFF0000000000), - cfbBits(0x000000FFFFFF0000), - cfbBits(0x000000000000FFFF), - }; -PixelGroup cfbmask2[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x0000000000000000), - cfbBits(0xFF00000000000000), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x000000FFFFFFFFFF), - cfbBits(0xFFFFFF000000FFFF), - cfbBits(0xFFFFFFFFFFFF0000), - }; -PixelGroup cfbrmask2[] = - { - cfbBits(0x0000000000000000), - cfbBits(0x0000000000000000), - cfbBits(0x00FFFFFFFFFFFFFF), - }; -#endif /* PGSZ */ -#endif /* PSZ == 24 */ - -#if PSZ == 32 -#if PGSZ == 32 -PixelGroup cfbmask[] = - { - cfbBits(0xFFFFFFFF), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0xFFFFFFFF), - }; -#else /* PGSZ == 64 */ -PixelGroup cfbmask[] = - { - cfbBits(0xFFFFFFFF00000000), - cfbBits(0x00000000FFFFFFFF), - }; -PixelGroup cfbrmask[] = - { - cfbBits(0x00000000FFFFFFFF), - cfbBits(0xFFFFFFFF00000000), - }; -#endif /* PGSZ */ -#endif /* PSZ == 32 */ - -/* - * QuartetBitsTable contains PPW+1 masks whose binary values are masks in the - * low order quartet that contain the number of bits specified in the - * index. This table is used by getstipplepixels. - */ -#if PSZ == 4 -PixelGroup QuartetBitsTable[] = { -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 00000000 */ - 0x00000080, /* 1 - 10000000 */ - 0x000000C0, /* 2 - 11000000 */ - 0x000000E0, /* 3 - 11100000 */ - 0x000000F0, /* 4 - 11110000 */ - 0x000000F8, /* 5 - 11111000 */ - 0x000000FC, /* 6 - 11111100 */ - 0x000000FE, /* 7 - 11111110 */ - 0x000000FF /* 8 - 11111111 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 00000000 */ - 0x00000001, /* 1 - 00000001 */ - 0x00000003, /* 2 - 00000011 */ - 0x00000007, /* 3 - 00000111 */ - 0x0000000F, /* 4 - 00001111 */ - 0x0000001F, /* 5 - 00011111 */ - 0x0000003F, /* 6 - 00111111 */ - 0x0000007F, /* 7 - 01111111 */ - 0x000000FF /* 8 - 11111111 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 0000000000000000 */ - 0x00008000, /* 1 - 1000000000000000 */ - 0x0000C000, /* 2 - 1100000000000000 */ - 0x0000E000, /* 3 - 1110000000000000 */ - 0x0000F000, /* 4 - 1111000000000000 */ - 0x0000F800, /* 5 - 1111100000000000 */ - 0x0000FC00, /* 6 - 1111110000000000 */ - 0x0000FE00, /* 7 - 1111111000000000 */ - 0x0000FF00, /* 8 - 1111111100000000 */ - 0x0000FF80, /* 9 - 1111111110000000 */ - 0x0000FFC0, /* 10- 1111111111000000 */ - 0x0000FFE0, /* 11- 1111111111100000 */ - 0x0000FFF0, /* 12- 1111111111110000 */ - 0x0000FFF8, /* 13- 1111111111111000 */ - 0x0000FFFC, /* 14- 1111111111111100 */ - 0x0000FFFE, /* 15- 1111111111111110 */ - 0x0000FFFF, /* 16- 1111111111111111 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 0000000000000000 */ - 0x00000001, /* 1 - 0000000000000001 */ - 0x00000003, /* 2 - 0000000000000011 */ - 0x00000007, /* 3 - 0000000000000111 */ - 0x0000000F, /* 4 - 0000000000001111 */ - 0x0000001F, /* 5 - 0000000000011111 */ - 0x0000003F, /* 6 - 0000000000111111 */ - 0x0000007F, /* 7 - 0000000001111111 */ - 0x000000FF, /* 8 - 0000000011111111 */ - 0x000001FF, /* 9 - 0000000111111111 */ - 0x000003FF, /* 10- 0000001111111111 */ - 0x000007FF, /* 11- 0000011111111111 */ - 0x00000FFF, /* 12- 0000111111111111 */ - 0x00001FFF, /* 13- 0001111111111111 */ - 0x00003FFF, /* 14- 0011111111111111 */ - 0x00007FFF, /* 15- 0111111111111111 */ - 0x0000FFFF, /* 16- 1111111111111111 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#endif /* PGSZ */ -}; -#endif /* PSZ == 4 */ - -#if PSZ == 8 -PixelGroup QuartetBitsTable[] = { -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 0000 */ - 0x00000008, /* 1 - 1000 */ - 0x0000000C, /* 2 - 1100 */ - 0x0000000E, /* 3 - 1110 */ - 0x0000000F /* 4 - 1111 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 0000 */ - 0x00000001, /* 1 - 0001 */ - 0x00000003, /* 2 - 0011 */ - 0x00000007, /* 3 - 0111 */ - 0x0000000F /* 4 - 1111 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 00000000 */ - 0x00000080, /* 1 - 10000000 */ - 0x000000C0, /* 2 - 11000000 */ - 0x000000E0, /* 3 - 11100000 */ - 0x000000F0, /* 4 - 11110000 */ - 0x000000F8, /* 5 - 11111000 */ - 0x000000FC, /* 6 - 11111100 */ - 0x000000FE, /* 7 - 11111110 */ - 0x000000FF /* 8 - 11111111 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 00000000 */ - 0x00000001, /* 1 - 00000001 */ - 0x00000003, /* 2 - 00000011 */ - 0x00000007, /* 3 - 00000111 */ - 0x0000000F, /* 4 - 10000111 */ - 0x0000001F, /* 5 - 00011111 */ - 0x0000003F, /* 6 - 00111111 */ - 0x0000007F, /* 7 - 01111111 */ - 0x000000FF /* 8 - 11111111 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#endif /* PGSZ */ -}; -#endif /* PSZ == 8 */ - -#if PSZ == 16 -PixelGroup QuartetBitsTable[] = { -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 00 */ - 0x00000002, /* 1 - 10 */ - 0x00000003, /* 2 - 11 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 00 */ - 0x00000001, /* 1 - 01 */ - 0x00000003, /* 2 - 11 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 0000 */ - 0x00000008, /* 1 - 1000 */ - 0x0000000C, /* 2 - 1100 */ - 0x0000000E, /* 3 - 1110 */ - 0x0000000F, /* 4 - 1111 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 0000 */ - 0x00000001, /* 1 - 0001 */ - 0x00000003, /* 2 - 0011 */ - 0x00000007, /* 3 - 0111 */ - 0x0000000F, /* 4 - 1111 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#endif /* PGSZ */ -}; -#endif /* PSZ == 16 */ - -#if PSZ == 24 -PixelGroup QuartetBitsTable[] = { -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 0 */ - 0x00000001, /* 1 - 1 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 0 */ - 0x00000001, /* 1 - 1 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 00 */ - 0x00000002, /* 1 - 10 */ - 0x00000003, /* 2 - 11*/ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 00 */ - 0x00000001, /* 1 - 01 */ - 0x00000003, /* 2 - 11 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#endif /* PGSZ */ -}; -#endif /* PSZ == 24 */ - -#if PSZ == 32 -PixelGroup QuartetBitsTable[] = { -#if PGSZ == 32 -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 0 */ - 0x00000001, /* 1 - 1 */ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 0 */ - 0x00000001, /* 1 - 1 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#else /* PGSZ == 64 */ -#if (BITMAP_BIT_ORDER == MSBFirst) - 0x00000000, /* 0 - 00 */ - 0x00000002, /* 1 - 10 */ - 0x00000003, /* 2 - 11*/ -#else /* (BITMAP_BIT_ORDER == LSBFirst */ - 0x00000000, /* 0 - 00 */ - 0x00000001, /* 1 - 01 */ - 0x00000003, /* 2 - 11 */ -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#endif /* PGSZ */ -}; -#endif /* PSZ == 32 */ - -/* - * QuartetPixelMaskTable is used by getstipplepixels to get a pixel mask - * corresponding to a quartet of bits. Note: the bit/byte order dependency - * is handled by QuartetBitsTable above. - */ -#if PSZ == 4 -#if PGSZ == 32 -PixelGroup QuartetPixelMaskTable[] = { - 0x00000000, - 0x0000000F, - 0x000000F0, - 0x000000FF, - 0x00000F00, - 0x00000F0F, - 0x00000FF0, - 0x00000FFF, - 0x0000F000, - 0x0000F00F, - 0x0000F0F0, - 0x0000F0FF, - 0x0000FF00, - 0x0000FF0F, - 0x0000FFF0, - 0x0000FFFF, - 0x000F0000, - 0x000F000F, - 0x000F00F0, - 0x000F00FF, - 0x000F0F00, - 0x000F0F0F, - 0x000F0FF0, - 0x000F0FFF, - 0x000FF000, - 0x000FF00F, - 0x000FF0F0, - 0x000FF0FF, - 0x000FFF00, - 0x000FFF0F, - 0x000FFFF0, - 0x000FFFFF, - 0x00F00000, - 0x00F0000F, - 0x00F000F0, - 0x00F000FF, - 0x00F00F00, - 0x00F00F0F, - 0x00F00FF0, - 0x00F00FFF, - 0x00F0F000, - 0x00F0F00F, - 0x00F0F0F0, - 0x00F0F0FF, - 0x00F0FF00, - 0x00F0FF0F, - 0x00F0FFF0, - 0x00F0FFFF, - 0x00FF0000, - 0x00FF000F, - 0x00FF00F0, - 0x00FF00FF, - 0x00FF0F00, - 0x00FF0F0F, - 0x00FF0FF0, - 0x00FF0FFF, - 0x00FFF000, - 0x00FFF00F, - 0x00FFF0F0, - 0x00FFF0FF, - 0x00FFFF00, - 0x00FFFF0F, - 0x00FFFFF0, - 0x00FFFFFF, - 0x0F000000, - 0x0F00000F, - 0x0F0000F0, - 0x0F0000FF, - 0x0F000F00, - 0x0F000F0F, - 0x0F000FF0, - 0x0F000FFF, - 0x0F00F000, - 0x0F00F00F, - 0x0F00F0F0, - 0x0F00F0FF, - 0x0F00FF00, - 0x0F00FF0F, - 0x0F00FFF0, - 0x0F00FFFF, - 0x0F0F0000, - 0x0F0F000F, - 0x0F0F00F0, - 0x0F0F00FF, - 0x0F0F0F00, - 0x0F0F0F0F, - 0x0F0F0FF0, - 0x0F0F0FFF, - 0x0F0FF000, - 0x0F0FF00F, - 0x0F0FF0F0, - 0x0F0FF0FF, - 0x0F0FFF00, - 0x0F0FFF0F, - 0x0F0FFFF0, - 0x0F0FFFFF, - 0x0FF00000, - 0x0FF0000F, - 0x0FF000F0, - 0x0FF000FF, - 0x0FF00F00, - 0x0FF00F0F, - 0x0FF00FF0, - 0x0FF00FFF, - 0x0FF0F000, - 0x0FF0F00F, - 0x0FF0F0F0, - 0x0FF0F0FF, - 0x0FF0FF00, - 0x0FF0FF0F, - 0x0FF0FFF0, - 0x0FF0FFFF, - 0x0FFF0000, - 0x0FFF000F, - 0x0FFF00F0, - 0x0FFF00FF, - 0x0FFF0F00, - 0x0FFF0F0F, - 0x0FFF0FF0, - 0x0FFF0FFF, - 0x0FFFF000, - 0x0FFFF00F, - 0x0FFFF0F0, - 0x0FFFF0FF, - 0x0FFFFF00, - 0x0FFFFF0F, - 0x0FFFFFF0, - 0x0FFFFFFF, - 0xF0000000, - 0xF000000F, - 0xF00000F0, - 0xF00000FF, - 0xF0000F00, - 0xF0000F0F, - 0xF0000FF0, - 0xF0000FFF, - 0xF000F000, - 0xF000F00F, - 0xF000F0F0, - 0xF000F0FF, - 0xF000FF00, - 0xF000FF0F, - 0xF000FFF0, - 0xF000FFFF, - 0xF00F0000, - 0xF00F000F, - 0xF00F00F0, - 0xF00F00FF, - 0xF00F0F00, - 0xF00F0F0F, - 0xF00F0FF0, - 0xF00F0FFF, - 0xF00FF000, - 0xF00FF00F, - 0xF00FF0F0, - 0xF00FF0FF, - 0xF00FFF00, - 0xF00FFF0F, - 0xF00FFFF0, - 0xF00FFFFF, - 0xF0F00000, - 0xF0F0000F, - 0xF0F000F0, - 0xF0F000FF, - 0xF0F00F00, - 0xF0F00F0F, - 0xF0F00FF0, - 0xF0F00FFF, - 0xF0F0F000, - 0xF0F0F00F, - 0xF0F0F0F0, - 0xF0F0F0FF, - 0xF0F0FF00, - 0xF0F0FF0F, - 0xF0F0FFF0, - 0xF0F0FFFF, - 0xF0FF0000, - 0xF0FF000F, - 0xF0FF00F0, - 0xF0FF00FF, - 0xF0FF0F00, - 0xF0FF0F0F, - 0xF0FF0FF0, - 0xF0FF0FFF, - 0xF0FFF000, - 0xF0FFF00F, - 0xF0FFF0F0, - 0xF0FFF0FF, - 0xF0FFFF00, - 0xF0FFFF0F, - 0xF0FFFFF0, - 0xF0FFFFFF, - 0xFF000000, - 0xFF00000F, - 0xFF0000F0, - 0xFF0000FF, - 0xFF000F00, - 0xFF000F0F, - 0xFF000FF0, - 0xFF000FFF, - 0xFF00F000, - 0xFF00F00F, - 0xFF00F0F0, - 0xFF00F0FF, - 0xFF00FF00, - 0xFF00FF0F, - 0xFF00FFF0, - 0xFF00FFFF, - 0xFF0F0000, - 0xFF0F000F, - 0xFF0F00F0, - 0xFF0F00FF, - 0xFF0F0F00, - 0xFF0F0F0F, - 0xFF0F0FF0, - 0xFF0F0FFF, - 0xFF0FF000, - 0xFF0FF00F, - 0xFF0FF0F0, - 0xFF0FF0FF, - 0xFF0FFF00, - 0xFF0FFF0F, - 0xFF0FFFF0, - 0xFF0FFFFF, - 0xFFF00000, - 0xFFF0000F, - 0xFFF000F0, - 0xFFF000FF, - 0xFFF00F00, - 0xFFF00F0F, - 0xFFF00FF0, - 0xFFF00FFF, - 0xFFF0F000, - 0xFFF0F00F, - 0xFFF0F0F0, - 0xFFF0F0FF, - 0xFFF0FF00, - 0xFFF0FF0F, - 0xFFF0FFF0, - 0xFFF0FFFF, - 0xFFFF0000, - 0xFFFF000F, - 0xFFFF00F0, - 0xFFFF00FF, - 0xFFFF0F00, - 0xFFFF0F0F, - 0xFFFF0FF0, - 0xFFFF0FFF, - 0xFFFFF000, - 0xFFFFF00F, - 0xFFFFF0F0, - 0xFFFFF0FF, - 0xFFFFFF00, - 0xFFFFFF0F, - 0xFFFFFFF0, - 0xFFFFFFFF, -}; -#else /* PGSZ == 64 */ -No QuartetPixelMaskTable for psz=PSZ -this would be a 64K entry table, a bit much I think. -Try breaking things in two: -mask = table[index&0xff00]<<32 | table[index&0xff] -#endif /* PGSZ */ -#endif /* PSZ == 4 */ - -#if PSZ == 8 -PixelGroup QuartetPixelMaskTable[] = { -#if PGSZ == 32 - 0x00000000, - 0x000000FF, - 0x0000FF00, - 0x0000FFFF, - 0x00FF0000, - 0x00FF00FF, - 0x00FFFF00, - 0x00FFFFFF, - 0xFF000000, - 0xFF0000FF, - 0xFF00FF00, - 0xFF00FFFF, - 0xFFFF0000, - 0xFFFF00FF, - 0xFFFFFF00, - 0xFFFFFFFF -#else /* PGSZ == 64 */ - 0x0000000000000000, 0x00000000000000FF, - 0x000000000000FF00, 0x000000000000FFFF, - 0x0000000000FF0000, 0x0000000000FF00FF, - 0x0000000000FFFF00, 0x0000000000FFFFFF, - 0x00000000FF000000, 0x00000000FF0000FF, - 0x00000000FF00FF00, 0x00000000FF00FFFF, - 0x00000000FFFF0000, 0x00000000FFFF00FF, - 0x00000000FFFFFF00, 0x00000000FFFFFFFF, - 0x000000FF00000000, 0x000000FF000000FF, - 0x000000FF0000FF00, 0x000000FF0000FFFF, - 0x000000FF00FF0000, 0x000000FF00FF00FF, - 0x000000FF00FFFF00, 0x000000FF00FFFFFF, - 0x000000FFFF000000, 0x000000FFFF0000FF, - 0x000000FFFF00FF00, 0x000000FFFF00FFFF, - 0x000000FFFFFF0000, 0x000000FFFFFF00FF, - 0x000000FFFFFFFF00, 0x000000FFFFFFFFFF, - 0x0000FF0000000000, 0x0000FF00000000FF, - 0x0000FF000000FF00, 0x0000FF000000FFFF, - 0x0000FF0000FF0000, 0x0000FF0000FF00FF, - 0x0000FF0000FFFF00, 0x0000FF0000FFFFFF, - 0x0000FF00FF000000, 0x0000FF00FF0000FF, - 0x0000FF00FF00FF00, 0x0000FF00FF00FFFF, - 0x0000FF00FFFF0000, 0x0000FF00FFFF00FF, - 0x0000FF00FFFFFF00, 0x0000FF00FFFFFFFF, - 0x0000FFFF00000000, 0x0000FFFF000000FF, - 0x0000FFFF0000FF00, 0x0000FFFF0000FFFF, - 0x0000FFFF00FF0000, 0x0000FFFF00FF00FF, - 0x0000FFFF00FFFF00, 0x0000FFFF00FFFFFF, - 0x0000FFFFFF000000, 0x0000FFFFFF0000FF, - 0x0000FFFFFF00FF00, 0x0000FFFFFF00FFFF, - 0x0000FFFFFFFF0000, 0x0000FFFFFFFF00FF, - 0x0000FFFFFFFFFF00, 0x0000FFFFFFFFFFFF, - 0x00FF000000000000, 0x00FF0000000000FF, - 0x00FF00000000FF00, 0x00FF00000000FFFF, - 0x00FF000000FF0000, 0x00FF000000FF00FF, - 0x00FF000000FFFF00, 0x00FF000000FFFFFF, - 0x00FF0000FF000000, 0x00FF0000FF0000FF, - 0x00FF0000FF00FF00, 0x00FF0000FF00FFFF, - 0x00FF0000FFFF0000, 0x00FF0000FFFF00FF, - 0x00FF0000FFFFFF00, 0x00FF0000FFFFFFFF, - 0x00FF00FF00000000, 0x00FF00FF000000FF, - 0x00FF00FF0000FF00, 0x00FF00FF0000FFFF, - 0x00FF00FF00FF0000, 0x00FF00FF00FF00FF, - 0x00FF00FF00FFFF00, 0x00FF00FF00FFFFFF, - 0x00FF00FFFF000000, 0x00FF00FFFF0000FF, - 0x00FF00FFFF00FF00, 0x00FF00FFFF00FFFF, - 0x00FF00FFFFFF0000, 0x00FF00FFFFFF00FF, - 0x00FF00FFFFFFFF00, 0x00FF00FFFFFFFFFF, - 0x00FFFF0000000000, 0x00FFFF00000000FF, - 0x00FFFF000000FF00, 0x00FFFF000000FFFF, - 0x00FFFF0000FF0000, 0x00FFFF0000FF00FF, - 0x00FFFF0000FFFF00, 0x00FFFF0000FFFFFF, - 0x00FFFF00FF000000, 0x00FFFF00FF0000FF, - 0x00FFFF00FF00FF00, 0x00FFFF00FF00FFFF, - 0x00FFFF00FFFF0000, 0x00FFFF00FFFF00FF, - 0x00FFFF00FFFFFF00, 0x00FFFF00FFFFFFFF, - 0x00FFFFFF00000000, 0x00FFFFFF000000FF, - 0x00FFFFFF0000FF00, 0x00FFFFFF0000FFFF, - 0x00FFFFFF00FF0000, 0x00FFFFFF00FF00FF, - 0x00FFFFFF00FFFF00, 0x00FFFFFF00FFFFFF, - 0x00FFFFFFFF000000, 0x00FFFFFFFF0000FF, - 0x00FFFFFFFF00FF00, 0x00FFFFFFFF00FFFF, - 0x00FFFFFFFFFF0000, 0x00FFFFFFFFFF00FF, - 0x00FFFFFFFFFFFF00, 0x00FFFFFFFFFFFFFF, - 0xFF00000000000000, 0xFF000000000000FF, - 0xFF0000000000FF00, 0xFF0000000000FFFF, - 0xFF00000000FF0000, 0xFF00000000FF00FF, - 0xFF00000000FFFF00, 0xFF00000000FFFFFF, - 0xFF000000FF000000, 0xFF000000FF0000FF, - 0xFF000000FF00FF00, 0xFF000000FF00FFFF, - 0xFF000000FFFF0000, 0xFF000000FFFF00FF, - 0xFF000000FFFFFF00, 0xFF000000FFFFFFFF, - 0xFF0000FF00000000, 0xFF0000FF000000FF, - 0xFF0000FF0000FF00, 0xFF0000FF0000FFFF, - 0xFF0000FF00FF0000, 0xFF0000FF00FF00FF, - 0xFF0000FF00FFFF00, 0xFF0000FF00FFFFFF, - 0xFF0000FFFF000000, 0xFF0000FFFF0000FF, - 0xFF0000FFFF00FF00, 0xFF0000FFFF00FFFF, - 0xFF0000FFFFFF0000, 0xFF0000FFFFFF00FF, - 0xFF0000FFFFFFFF00, 0xFF0000FFFFFFFFFF, - 0xFF00FF0000000000, 0xFF00FF00000000FF, - 0xFF00FF000000FF00, 0xFF00FF000000FFFF, - 0xFF00FF0000FF0000, 0xFF00FF0000FF00FF, - 0xFF00FF0000FFFF00, 0xFF00FF0000FFFFFF, - 0xFF00FF00FF000000, 0xFF00FF00FF0000FF, - 0xFF00FF00FF00FF00, 0xFF00FF00FF00FFFF, - 0xFF00FF00FFFF0000, 0xFF00FF00FFFF00FF, - 0xFF00FF00FFFFFF00, 0xFF00FF00FFFFFFFF, - 0xFF00FFFF00000000, 0xFF00FFFF000000FF, - 0xFF00FFFF0000FF00, 0xFF00FFFF0000FFFF, - 0xFF00FFFF00FF0000, 0xFF00FFFF00FF00FF, - 0xFF00FFFF00FFFF00, 0xFF00FFFF00FFFFFF, - 0xFF00FFFFFF000000, 0xFF00FFFFFF0000FF, - 0xFF00FFFFFF00FF00, 0xFF00FFFFFF00FFFF, - 0xFF00FFFFFFFF0000, 0xFF00FFFFFFFF00FF, - 0xFF00FFFFFFFFFF00, 0xFF00FFFFFFFFFFFF, - 0xFFFF000000000000, 0xFFFF0000000000FF, - 0xFFFF00000000FF00, 0xFFFF00000000FFFF, - 0xFFFF000000FF0000, 0xFFFF000000FF00FF, - 0xFFFF000000FFFF00, 0xFFFF000000FFFFFF, - 0xFFFF0000FF000000, 0xFFFF0000FF0000FF, - 0xFFFF0000FF00FF00, 0xFFFF0000FF00FFFF, - 0xFFFF0000FFFF0000, 0xFFFF0000FFFF00FF, - 0xFFFF0000FFFFFF00, 0xFFFF0000FFFFFFFF, - 0xFFFF00FF00000000, 0xFFFF00FF000000FF, - 0xFFFF00FF0000FF00, 0xFFFF00FF0000FFFF, - 0xFFFF00FF00FF0000, 0xFFFF00FF00FF00FF, - 0xFFFF00FF00FFFF00, 0xFFFF00FF00FFFFFF, - 0xFFFF00FFFF000000, 0xFFFF00FFFF0000FF, - 0xFFFF00FFFF00FF00, 0xFFFF00FFFF00FFFF, - 0xFFFF00FFFFFF0000, 0xFFFF00FFFFFF00FF, - 0xFFFF00FFFFFFFF00, 0xFFFF00FFFFFFFFFF, - 0xFFFFFF0000000000, 0xFFFFFF00000000FF, - 0xFFFFFF000000FF00, 0xFFFFFF000000FFFF, - 0xFFFFFF0000FF0000, 0xFFFFFF0000FF00FF, - 0xFFFFFF0000FFFF00, 0xFFFFFF0000FFFFFF, - 0xFFFFFF00FF000000, 0xFFFFFF00FF0000FF, - 0xFFFFFF00FF00FF00, 0xFFFFFF00FF00FFFF, - 0xFFFFFF00FFFF0000, 0xFFFFFF00FFFF00FF, - 0xFFFFFF00FFFFFF00, 0xFFFFFF00FFFFFFFF, - 0xFFFFFFFF00000000, 0xFFFFFFFF000000FF, - 0xFFFFFFFF0000FF00, 0xFFFFFFFF0000FFFF, - 0xFFFFFFFF00FF0000, 0xFFFFFFFF00FF00FF, - 0xFFFFFFFF00FFFF00, 0xFFFFFFFF00FFFFFF, - 0xFFFFFFFFFF000000, 0xFFFFFFFFFF0000FF, - 0xFFFFFFFFFF00FF00, 0xFFFFFFFFFF00FFFF, - 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFF00FF, - 0xFFFFFFFFFFFFFF00, 0xFFFFFFFFFFFFFFFF, -#endif /* PGSZ */ -}; -#endif /* PSZ == 8 */ - -#if PSZ == 16 -PixelGroup QuartetPixelMaskTable[] = { -#if PGSZ == 32 - 0x00000000, - 0x0000FFFF, - 0xFFFF0000, - 0xFFFFFFFF, -#else /* PGSZ == 64 */ - 0x0000000000000000, 0x000000000000FFFF, - 0x00000000FFFF0000, 0x00000000FFFFFFFF, - 0x0000FFFF00000000, 0x0000FFFF0000FFFF, - 0x0000FFFFFFFF0000, 0x0000FFFFFFFFFFFF, - 0xFFFF000000000000, 0xFFFF00000000FFFF, - 0xFFFF0000FFFF0000, 0xFFFF0000FFFFFFFF, - 0xFFFFFFFF00000000, 0xFFFFFFFF0000FFFF, - 0xFFFFFFFFFFFF0000, 0xFFFFFFFFFFFFFFFF, -#endif /* PGSZ */ -}; -#endif /* PSZ == 16 */ - -#if PSZ == 24 -PixelGroup QuartetPixelMaskTable[] = { -#if PGSZ == 32 -/* Four pixels consist three pixel groups....*/ - 0x00000000, 0x00FFFFFF, /*0x00000000, *//*0*/ -/* 0x00000000, 0x00000000, 0x00000000,*/ /*0*/ -/* 0x00FFFFFF, 0x00000000, 0x00000000,*/ /*1*/ -/* 0xFF000000, 0x0000FFFF, 0x00000000,*/ /*2*/ -/* 0xFFFFFFFF, 0x0000FFFF, 0x00000000,*/ /*3*/ -/* 0x00000000, 0xFFFF0000, 0x000000FF,*/ /*4*/ -/* 0x00FFFFFF, 0xFFFF0000, 0x000000FF,*/ /*5*/ -/* 0xFF000000, 0xFFFFFFFF, 0x000000FF,*/ /*6*/ -/* 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF,*/ /*7*/ -/* 0x00000000, 0x00000000, 0xFFFFFF00,*/ /*8*/ -/* 0x00FFFFFF, 0x00000000, 0xFFFFFF00,*/ /*9*/ -/* 0xFF000000, 0x0000FFFF, 0xFFFFFF00,*/ /*10*/ -/* 0xFFFFFFFF, 0x0000FFFF, 0xFFFFFF00,*/ /*11*/ -/* 0x00000000, 0xFFFF0000, 0xFFFFFFFF,*/ /*12*/ -/* 0x00FFFFFF, 0xFFFF0000, 0xFFFFFFFF,*/ /*13*/ -/* 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*14*/ -/* 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,*/ /*15*/ -#else /* PGSZ == 64 */ - 0x0000000000000000, 0x0000000000FFFFFF, - 0x0000FFFFFF000000, 0xFFFFFFFFFFFFFFFF -#endif /* PGSZ */ -}; -#endif /* PSZ == 24 */ - -#if PSZ == 32 -PixelGroup QuartetPixelMaskTable[] = { -#if PGSZ == 32 - 0x00000000, - 0xFFFFFFFF, -#else /* PGSZ == 64 */ - 0x0000000000000000, - 0x00000000FFFFFFFF, - 0xFFFFFFFF00000000, - 0xFFFFFFFFFFFFFFFF -#endif /* PGSZ */ -}; -#endif /* PSZ == 32 */ - -#if PSZ == 24 -int cfb24Shift[] = -#if (BITMAP_BIT_ORDER == MSBFirst) -{8,0,16,16,8,24,0,0}; -#else /* (BITMAP_BIT_ORDER == LSBFirst) */ -{0,0,24,8,16,16,8,0}; -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ -#endif diff --git a/cfb/cfbmskbits.h b/cfb/cfbmskbits.h deleted file mode 100644 index 5ee9125dd..000000000 --- a/cfb/cfbmskbits.h +++ /dev/null @@ -1,854 +0,0 @@ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -/* Optimizations for PSZ == 32 added by Kyle Marvin (marvin@vitec.com) */ - -#include -#include -#include "servermd.h" -#include "compiler.h" - -/* - * ========================================================================== - * Converted from mfb to support memory-mapped color framebuffer by smarks@sun, - * April-May 1987. - * - * The way I did the conversion was to consider each longword as an - * array of four bytes instead of an array of 32 one-bit pixels. So - * getbits() and putbits() retain much the same calling sequence, but - * they move bytes around instead of bits. Of course, this entails the - * removal of all of the one-bit-pixel dependencies from the other - * files, but the major bit-hacking stuff should be covered here. - * - * I've created some new macros that make it easier to understand what's - * going on in the pixel calculations, and that make it easier to change the - * pixel size. - * - * name explanation - * ---- ----------- - * PSZ pixel size (in bits) - * PGSZ pixel group size (in bits) - * PGSZB pixel group size (in bytes) - * PGSZBMSK mask with lowest PGSZB bits set to 1 - * PPW pixels per word (pixels per pixel group) - * PPWMSK mask with lowest PPW bits set to 1 - * PLST index of last pixel in a word (should be PPW-1) - * PIM pixel index mask (index within a pixel group) - * PWSH pixel-to-word shift (should be log2(PPW)) - * PMSK mask with lowest PSZ bits set to 1 - * - * - * Here are some sample values. In the notation cfbA,B: A is PSZ, and - * B is PGSZB. All the other values are derived from these - * two. This table does not show all combinations! - * - * name cfb8,4 cfb24,4 cfb32,4 cfb8,8 cfb24,8 cfb32,8 - * ---- ------ ------- ------ ------ ------ ------- - * PSZ 8 24 32 8 24 32 - * PGSZ 32 32 32 64 64 64 - * PGSZB 4 4 4 8 8 8 - * PGSZBMSK 0xF 0xF? 0xF 0xFF 0xFF 0xFF - * PPW 4 1 1 8 2 2 - * PPWMSK 0xF 0x1 0x1 0xFF 0x3? 0x3 - * PLST 3 0 0 7 1 1 - * PIM 0x3 0x0 0x0 0x7 0x1? 0x1 - * PWSH 2 0 0 3 1 1 - * PMSK 0xFF 0xFFFFFF 0xFFFFFFFF 0xFF 0xFFFFFF 0xFFFFFFFF - * - * - * I have also added a new macro, PFILL, that takes one pixel and - * replicates it throughout a word. This macro definition is dependent - * upon pixel and word size; it doesn't use macros like PPW and so - * forth. Examples: for monochrome, PFILL(1) => 0xffffffff, PFILL(0) => - * 0x00000000. For 8-bit color, PFILL(0x5d) => 0x5d5d5d5d. This macro - * is used primarily for replicating a plane mask into a word. - * - * Color framebuffers operations also support the notion of a plane - * mask. This mask determines which planes of the framebuffer can be - * altered; the others are left unchanged. I have added another - * parameter to the putbits and putbitsrop macros that is the plane - * mask. - * ========================================================================== - * - * Keith Packard (keithp@suse.com) - * 64bit code is no longer supported; it requires DIX support - * for repadding images which significantly impacts performance - */ - -/* - * PSZ needs to be defined before we get here. Usually it comes from a - * -DPSZ=foo on the compilation command line. - */ - -#ifndef PSZ -#define PSZ 8 -#endif - -/* - * PixelGroup is the data type used to operate on groups of pixels. - * We typedef it here to CARD32 with the assumption that you - * want to manipulate 32 bits worth of pixels at a time as you can. If CARD32 - * is not appropriate for your server, define it to something else - * before including this file. In this case you will also have to define - * PGSZB to the size in bytes of PixelGroup. - */ -#ifndef PixelGroup -#define PixelGroup CARD32 -#define PGSZB 4 -#endif /* PixelGroup */ - -#ifndef CfbBits -#define CfbBits CARD32 -#endif - -#define PGSZ (PGSZB << 3) -#define PPW (PGSZ/PSZ) -#define PLST (PPW-1) -#define PIM PLST -#define PMSK (((PixelGroup)1 << PSZ) - 1) -#define PPWMSK (((PixelGroup)1 << PPW) - 1) /* instead of BITMSK */ -#define PGSZBMSK (((PixelGroup)1 << PGSZB) - 1) - -/* set PWSH = log2(PPW) using brute force */ - -#if PPW == 1 -#define PWSH 0 -#else -#if PPW == 2 -#define PWSH 1 -#else -#if PPW == 4 -#define PWSH 2 -#else -#if PPW == 8 -#define PWSH 3 -#else -#if PPW == 16 -#define PWSH 4 -#endif /* PPW == 16 */ -#endif /* PPW == 8 */ -#endif /* PPW == 4 */ -#endif /* PPW == 2 */ -#endif /* PPW == 1 */ - -/* Defining PIXEL_ADDR means that individual pixels are addressable by this - * machine (as type PixelType). A possible CFB architecture which supported - * 8-bits-per-pixel on a non byte-addressable machine would not have this - * defined. - * - * Defining FOUR_BIT_CODE means that cfb knows how to stipple on this machine; - * eventually, stippling code for 16 and 32 bit devices should be written - * which would allow them to also use FOUR_BIT_CODE. There isn't that - * much to do in those cases, but it would make them quite a bit faster. - */ - -#if PSZ == 8 -#define PIXEL_ADDR -typedef CARD8 PixelType; -#define FOUR_BIT_CODE -#endif - -#if PSZ == 16 -#define PIXEL_ADDR -typedef CARD16 PixelType; -#endif - -#if PSZ == 24 -#undef PMSK -#define PMSK 0xFFFFFF -/*#undef PIM -#define PIM 3*/ -#define PIXEL_ADDR -typedef CARD32 PixelType; -#endif - -#if PSZ == 32 -#undef PMSK -#define PMSK 0xFFFFFFFF -#define PIXEL_ADDR -typedef CARD32 PixelType; -#endif - - -/* the following notes use the following conventions: -SCREEN LEFT SCREEN RIGHT -in this file and maskbits.c, left and right refer to screen coordinates, -NOT bit numbering in registers. - -cfbstarttab[n] - pixels[0,n-1] = 0's pixels[n,PPW-1] = 1's -cfbendtab[n] = - pixels[0,n-1] = 1's pixels[n,PPW-1] = 0's - -cfbstartpartial[], cfbendpartial[] - these are used as accelerators for doing putbits and masking out -bits that are all contained between longword boudaries. the extra -256 bytes of data seems a small price to pay -- code is smaller, -and narrow things (e.g. window borders) go faster. - -the names may seem misleading; they are derived not from which end -of the word the bits are turned on, but at which end of a scanline -the table tends to be used. - -look at the tables and macros to understand boundary conditions. -(careful readers will note that starttab[n] = ~endtab[n] for n != 0) - ------------------------------------------------------------------------ -these two macros depend on the screen's bit ordering. -in both of them x is a screen position. they are used to -combine bits collected from multiple longwords into a -single destination longword, and to unpack a single -source longword into multiple destinations. - -SCRLEFT(dst, x) - takes dst[x, PPW] and moves them to dst[0, PPW-x] - the contents of the rest of dst are 0 ONLY IF - dst is UNSIGNED. - is cast as an unsigned. - this is a right shift on the VAX, left shift on - Sun and pc-rt. - -SCRRIGHT(dst, x) - takes dst[0,x] and moves them to dst[PPW-x, PPW] - the contents of the rest of dst are 0 ONLY IF - dst is UNSIGNED. - this is a left shift on the VAX, right shift on - Sun and pc-rt. - - -the remaining macros are cpu-independent; all bit order dependencies -are built into the tables and the two macros above. - -maskbits(x, w, startmask, endmask, nlw) - for a span of width w starting at position x, returns -a mask for ragged pixels at start, mask for ragged pixels at end, -and the number of whole longwords between the ends. - -maskpartialbits(x, w, mask) - works like maskbits(), except all the pixels are in the - same longword (i.e. (x&0xPIM + w) <= PPW) - -mask32bits(x, w, startmask, endmask, nlw) - as maskbits, but does not calculate nlw. it is used by - cfbGlyphBlt to put down glyphs <= PPW bits wide. - -getbits(psrc, x, w, dst) - starting at position x in psrc (x < PPW), collect w - pixels and put them in the screen left portion of dst. - psrc is a longword pointer. this may span longword boundaries. - it special-cases fetching all w bits from one longword. - - +--------+--------+ +--------+ - | | m |n| | ==> | m |n| | - +--------+--------+ +--------+ - x x+w 0 w - psrc psrc+1 dst - m = PPW - x - n = w - m - - implementation: - get m pixels, move to screen-left of dst, zeroing rest of dst; - get n pixels from next word, move screen-right by m, zeroing - lower m pixels of word. - OR the two things together. - -putbits(src, x, w, pdst, planemask) - starting at position x in pdst, put down the screen-leftmost - w bits of src. pdst is a longword pointer. this may - span longword boundaries. - it special-cases putting all w bits into the same longword. - - +--------+ +--------+--------+ - | m |n| | ==> | | m |n| | - +--------+ +--------+--------+ - 0 w x x+w - dst pdst pdst+1 - m = PPW - x - n = w - m - - implementation: - get m pixels, shift screen-right by x, zero screen-leftmost x - pixels; zero rightmost m bits of *pdst and OR in stuff - from before the semicolon. - shift src screen-left by m, zero bits n-32; - zero leftmost n pixels of *(pdst+1) and OR in the - stuff from before the semicolon. - -putbitsrop(src, x, w, pdst, planemask, ROP) - like putbits but calls DoRop with the rasterop ROP (see cfb.h for - DoRop) - -getleftbits(psrc, w, dst) - get the leftmost w (w<=PPW) bits from *psrc and put them - in dst. this is used by the cfbGlyphBlt code for glyphs - <=PPW bits wide. -*/ - -#if (BITMAP_BIT_ORDER == MSBFirst) -#define BitRight(lw,n) ((lw) >> (n)) -#define BitLeft(lw,n) ((lw) << (n)) -#else /* (BITMAP_BIT_ORDER == LSBFirst) */ -#define BitRight(lw,n) ((lw) << (n)) -#define BitLeft(lw,n) ((lw) >> (n)) -#endif /* (BITMAP_BIT_ORDER == MSBFirst) */ - -#define SCRLEFT(lw, n) BitLeft (lw, (n) * PSZ) -#define SCRRIGHT(lw, n) BitRight(lw, (n) * PSZ) - -/* - * Note that the shift direction is independent of the byte ordering of the - * machine. The following is portable code. - */ -#if PPW == 16 -#define PFILL(p) ( ((p)&PMSK) | \ - ((p)&PMSK) << PSZ | \ - ((p)&PMSK) << 2*PSZ | \ - ((p)&PMSK) << 3*PSZ | \ - ((p)&PMSK) << 4*PSZ | \ - ((p)&PMSK) << 5*PSZ | \ - ((p)&PMSK) << 6*PSZ | \ - ((p)&PMSK) << 7*PSZ | \ - ((p)&PMSK) << 8*PSZ | \ - ((p)&PMSK) << 9*PSZ | \ - ((p)&PMSK) << 10*PSZ | \ - ((p)&PMSK) << 11*PSZ | \ - ((p)&PMSK) << 12*PSZ | \ - ((p)&PMSK) << 13*PSZ | \ - ((p)&PMSK) << 14*PSZ | \ - ((p)&PMSK) << 15*PSZ ) -#define PFILL2(p, pf) { \ - pf = (p) & PMSK; \ - pf |= (pf << PSZ); \ - pf |= (pf << 2*PSZ); \ - pf |= (pf << 4*PSZ); \ - pf |= (pf << 8*PSZ); \ -} -#endif /* PPW == 16 */ -#if PPW == 8 -#define PFILL(p) ( ((p)&PMSK) | \ - ((p)&PMSK) << PSZ | \ - ((p)&PMSK) << 2*PSZ | \ - ((p)&PMSK) << 3*PSZ | \ - ((p)&PMSK) << 4*PSZ | \ - ((p)&PMSK) << 5*PSZ | \ - ((p)&PMSK) << 6*PSZ | \ - ((p)&PMSK) << 7*PSZ ) -#define PFILL2(p, pf) { \ - pf = (p) & PMSK; \ - pf |= (pf << PSZ); \ - pf |= (pf << 2*PSZ); \ - pf |= (pf << 4*PSZ); \ -} -#endif -#if PPW == 4 -#define PFILL(p) ( ((p)&PMSK) | \ - ((p)&PMSK) << PSZ | \ - ((p)&PMSK) << 2*PSZ | \ - ((p)&PMSK) << 3*PSZ ) -#define PFILL2(p, pf) { \ - pf = (p) & PMSK; \ - pf |= (pf << PSZ); \ - pf |= (pf << 2*PSZ); \ -} -#endif -#if PPW == 2 -#define PFILL(p) ( ((p)&PMSK) | \ - ((p)&PMSK) << PSZ ) -#define PFILL2(p, pf) { \ - pf = (p) & PMSK; \ - pf |= (pf << PSZ); \ -} -#endif -#if PPW == 1 -#define PFILL(p) (p) -#define PFILL2(p,pf) (pf = (p)) -#endif - -/* - * Reduced raster op - using precomputed values, perform the above - * in three instructions - */ - -#define DoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) - -#define DoMaskRRop(dst, and, xor, mask) \ - (((dst) & ((and) | ~(mask))) ^ (xor & mask)) - -#if PSZ != 32 || PPW != 1 - -# if (PSZ == 24 && PPW == 1) -#define maskbits(x, w, startmask, endmask, nlw) {\ - startmask = cfbstarttab[(x)&3]; \ - endmask = cfbendtab[((x)+(w)) & 3]; \ - nlw = ((((x)+(w))*3)>>2) - (((x)*3 +3)>>2); \ -} - -#define mask32bits(x, w, startmask, endmask) \ - startmask = cfbstarttab[(x)&3]; \ - endmask = cfbendtab[((x)+(w)) & 3]; - -#define maskpartialbits(x, w, mask) \ - mask = cfbstartpartial[(x) & 3] & cfbendpartial[((x)+(w)) & 3]; - -#define maskbits24(x, w, startmask, endmask, nlw) \ - startmask = cfbstarttab24[(x) & 3]; \ - endmask = cfbendtab24[((x)+(w)) & 3]; \ - if (startmask){ \ - nlw = (((w) - (4 - ((x) & 3))) >> 2); \ - } else { \ - nlw = (w) >> 2; \ - } - -#define getbits24(psrc, dst, index) {\ - register int idx; \ - switch(idx = ((index)&3)<<1){ \ - case 0: \ - dst = (*(psrc) &cfbmask[idx]); \ - break; \ - case 6: \ - dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]); \ - break; \ - default: \ - dst = BitLeft((*(psrc) &cfbmask[idx]), cfb24Shift[idx]) | \ - BitRight(((*((psrc)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ - }; \ -} - -#define putbits24(src, w, pdst, planemask, index) {\ - register PixelGroup dstpixel; \ - register unsigned int idx; \ - switch(idx = ((index)&3)<<1){ \ - case 0: \ - dstpixel = (*(pdst) &cfbmask[idx]); \ - break; \ - case 6: \ - dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \ - break; \ - default: \ - dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \ - BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ - }; \ - dstpixel &= ~(planemask); \ - dstpixel |= (src & planemask); \ - *(pdst) &= cfbrmask[idx]; \ - switch(idx){ \ - case 0: \ - *(pdst) |= (dstpixel & cfbmask[idx]); \ - break; \ - case 2: \ - case 4: \ - pdst++;idx++; \ - *(pdst) = ((*(pdst)) & cfbrmask[idx]) | \ - (BitLeft(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ - pdst--;idx--; \ - case 6: \ - *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ - break; \ - }; \ -} - -#define putbitsrop24(src, x, pdst, planemask, rop) \ -{ \ - register PixelGroup t1, dstpixel; \ - register unsigned int idx; \ - switch(idx = (x)<<1){ \ - case 0: \ - dstpixel = (*(pdst) &cfbmask[idx]); \ - break; \ - case 6: \ - dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx]); \ - break; \ - default: \ - dstpixel = BitLeft((*(pdst) &cfbmask[idx]), cfb24Shift[idx])| \ - BitRight(((*((pdst)+1)) &cfbmask[idx+1]), cfb24Shift[idx+1]); \ - }; \ - DoRop(t1, rop, (src), dstpixel); \ - dstpixel &= ~planemask; \ - dstpixel |= (t1 & planemask); \ - *(pdst) &= cfbrmask[idx]; \ - switch(idx){ \ - case 0: \ - *(pdst) |= (dstpixel & cfbmask[idx]); \ - break; \ - case 2: \ - case 4: \ - *((pdst)+1) = ((*((pdst)+1)) & cfbrmask[idx+1]) | \ - (BitLeft(dstpixel, cfb24Shift[idx+1]) & (cfbmask[idx+1])); \ - case 6: \ - *(pdst) |= (BitRight(dstpixel, cfb24Shift[idx]) & cfbmask[idx]); \ - }; \ -} -# else /* PSZ == 24 && PPW == 1 */ -#define maskbits(x, w, startmask, endmask, nlw) \ - startmask = cfbstarttab[(x)&PIM]; \ - endmask = cfbendtab[((x)+(w)) & PIM]; \ - if (startmask) \ - nlw = (((w) - (PPW - ((x)&PIM))) >> PWSH); \ - else \ - nlw = (w) >> PWSH; - -#define maskpartialbits(x, w, mask) \ - mask = cfbstartpartial[(x) & PIM] & cfbendpartial[((x) + (w)) & PIM]; - -#define mask32bits(x, w, startmask, endmask) \ - startmask = cfbstarttab[(x)&PIM]; \ - endmask = cfbendtab[((x)+(w)) & PIM]; - -/* FIXME */ -#define maskbits24(x, w, startmask, endmask, nlw) \ - abort() -#define getbits24(psrc, dst, index) \ - abort() -#define putbits24(src, w, pdst, planemask, index) \ - abort() -#define putbitsrop24(src, x, pdst, planemask, rop) \ - abort() - -#endif /* PSZ == 24 && PPW == 1 */ - -#define getbits(psrc, x, w, dst) \ -if ( ((x) + (w)) <= PPW) \ -{ \ - dst = SCRLEFT(*(psrc), (x)); \ -} \ -else \ -{ \ - int m; \ - m = PPW-(x); \ - dst = (SCRLEFT(*(psrc), (x)) & cfbendtab[m]) | \ - (SCRRIGHT(*((psrc)+1), m) & cfbstarttab[m]); \ -} - - -#define putbits(src, x, w, pdst, planemask) \ -if ( ((x)+(w)) <= PPW) \ -{ \ - PixelGroup tmpmask; \ - maskpartialbits((x), (w), tmpmask); \ - tmpmask &= PFILL(planemask); \ - *(pdst) = (*(pdst) & ~tmpmask) | (SCRRIGHT(src, x) & tmpmask); \ -} \ -else \ -{ \ - unsigned int m; \ - unsigned int n; \ - PixelGroup pm = PFILL(planemask); \ - m = PPW-(x); \ - n = (w) - m; \ - *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | \ - (SCRRIGHT(src, x) & (cfbstarttab[x] & pm)); \ - *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \ - (SCRLEFT(src, m) & (cfbendtab[n] & pm)); \ -} -#if defined(__GNUC__) && defined(mc68020) -#undef getbits -#define FASTGETBITS(psrc, x, w, dst) \ - asm ("bfextu %3{%1:%2},%0" \ - : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc))) - -#define getbits(psrc,x,w,dst) \ -{ \ - FASTGETBITS(psrc, (x) * PSZ, (w) * PSZ, dst); \ - dst = SCRLEFT(dst,PPW-(w)); \ -} - -#define FASTPUTBITS(src, x, w, pdst) \ - asm ("bfins %3,%0{%1:%2}" \ - : "=o" (*(char *)(pdst)) \ - : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst))) - -#undef putbits -#define putbits(src, x, w, pdst, planemask) \ -{ \ - if (planemask != PMSK) { \ - PixelGroup _m, _pm; \ - FASTGETBITS(pdst, (x) * PSZ , (w) * PSZ, _m); \ - PFILL2(planemask, _pm); \ - _m &= (~_pm); \ - _m |= (SCRRIGHT(src, PPW-(w)) & _pm); \ - FASTPUTBITS(_m, (x) * PSZ, (w) * PSZ, pdst); \ - } else { \ - FASTPUTBITS(SCRRIGHT(src, PPW-(w)), (x) * PSZ, (w) * PSZ, pdst); \ - } \ -} - - -#endif /* mc68020 */ - -#define putbitsrop(src, x, w, pdst, planemask, rop) \ -if ( ((x)+(w)) <= PPW) \ -{ \ - PixelGroup tmpmask; \ - PixelGroup t1, t2; \ - maskpartialbits((x), (w), tmpmask); \ - PFILL2(planemask, t1); \ - tmpmask &= t1; \ - t1 = SCRRIGHT((src), (x)); \ - DoRop(t2, rop, t1, *(pdst)); \ - *(pdst) = (*(pdst) & ~tmpmask) | (t2 & tmpmask); \ -} \ -else \ -{ \ - CfbBits m; \ - CfbBits n; \ - PixelGroup t1, t2; \ - PixelGroup pm; \ - PFILL2(planemask, pm); \ - m = PPW-(x); \ - n = (w) - m; \ - t1 = SCRRIGHT((src), (x)); \ - DoRop(t2, rop, t1, *(pdst)); \ - *(pdst) = (*(pdst) & (cfbendtab[x] | ~pm)) | (t2 & (cfbstarttab[x] & pm));\ - t1 = SCRLEFT((src), m); \ - DoRop(t2, rop, t1, *((pdst) + 1)); \ - *((pdst)+1) = (*((pdst)+1) & (cfbstarttab[n] | ~pm)) | \ - (t2 & (cfbendtab[n] & pm)); \ -} - -#else /* PSZ == 32 && PPW == 1*/ - -/* - * These macros can be optimized for 32-bit pixels since there is no - * need to worry about left/right edge masking. These macros were - * derived from the above using the following reductions: - * - * - x & PIW = 0 [since PIW = 0] - * - all masking tables are only indexed by 0 [ due to above ] - * - cfbstartab[0] and cfbendtab[0] = 0 [ no left/right edge masks] - * - cfbstartpartial[0] and cfbendpartial[0] = ~0 [no partial pixel mask] - * - * Macro reduction based upon constants cannot be performed automatically - * by the compiler since it does not know the contents of the masking - * arrays in cfbmskbits.c. - */ -#define maskbits(x, w, startmask, endmask, nlw) \ - startmask = endmask = 0; \ - nlw = (w); - -#define maskpartialbits(x, w, mask) \ - mask = 0xFFFFFFFF; - -#define mask32bits(x, w, startmask, endmask) \ - startmask = endmask = 0; - -/* - * For 32-bit operations, getbits(), putbits(), and putbitsrop() - * will only be invoked with x = 0 and w = PPW (1). The getbits() - * macro is only called within left/right edge logic, which doesn't - * happen for 32-bit pixels. - */ -#define getbits(psrc, x, w, dst) (dst) = *(psrc) - -#define putbits(src, x, w, pdst, planemask) \ - *(pdst) = (*(pdst) & ~planemask) | (src & planemask); - -#define putbitsrop(src, x, w, pdst, planemask, rop) \ -{ \ - PixelGroup t1; \ - DoRop(t1, rop, (src), *(pdst)); \ - *(pdst) = (*(pdst) & ~planemask) | (t1 & planemask); \ -} - -#endif /* PSZ != 32 */ - -/* - * Use these macros only when you're using the MergeRop stuff - * in ../mfb/mergerop.h - */ - -/* useful only when not spanning destination longwords */ -#if PSZ == 24 -#define putbitsmropshort24(src,x,w,pdst,index) {\ - PixelGroup _tmpmask; \ - PixelGroup _t1; \ - maskpartialbits ((x), (w), _tmpmask); \ - _t1 = SCRRIGHT((src), (x)); \ - DoMaskMergeRop24(_t1, pdst, _tmpmask, index); \ -} -#endif -#define putbitsmropshort(src,x,w,pdst) {\ - PixelGroup _tmpmask; \ - PixelGroup _t1; \ - maskpartialbits ((x), (w), _tmpmask); \ - _t1 = SCRRIGHT((src), (x)); \ - *pdst = DoMaskMergeRop(_t1, *pdst, _tmpmask); \ -} - -/* useful only when spanning destination longwords */ -#define putbitsmroplong(src,x,w,pdst) { \ - PixelGroup _startmask, _endmask; \ - int _m; \ - PixelGroup _t1; \ - _m = PPW - (x); \ - _startmask = cfbstarttab[x]; \ - _endmask = cfbendtab[(w) - _m]; \ - _t1 = SCRRIGHT((src), (x)); \ - pdst[0] = DoMaskMergeRop(_t1,pdst[0],_startmask); \ - _t1 = SCRLEFT ((src),_m); \ - pdst[1] = DoMaskMergeRop(_t1,pdst[1],_endmask); \ -} - -#define putbitsmrop(src,x,w,pdst) \ -if ((x) + (w) <= PPW) {\ - putbitsmropshort(src,x,w,pdst); \ -} else { \ - putbitsmroplong(src,x,w,pdst); \ -} - -#if GETLEFTBITS_ALIGNMENT == 1 -#define getleftbits(psrc, w, dst) dst = *((unsigned int *) psrc) -#define getleftbits24(psrc, w, dst, idx){ \ - regiseter int index; \ - switch(index = ((idx)&3)<<1){ \ - case 0: \ - dst = (*((unsigned int *) psrc))&cfbmask[index]; \ - break; \ - case 2: \ - case 4: \ - dst = BitLeft(((*((unsigned int *) psrc))&cfbmask[index]), cfb24Shift[index]); \ - dst |= BitRight(((*((unsigned int *) psrc)+1)&cfbmask[index]), cfb4Shift[index]); \ - break; \ - case 6: \ - dst = BitLeft((*((unsigned int *) psrc)),cfb24Shift[index]); \ - break; \ - }; \ -} -#endif /* GETLEFTBITS_ALIGNMENT == 1 */ - -#define getglyphbits(psrc, x, w, dst) \ -{ \ - dst = BitLeft((unsigned) *(psrc), (x)); \ - if ( ((x) + (w)) > 32) \ - dst |= (BitRight((unsigned) *((psrc)+1), 32-(x))); \ -} -#if GETLEFTBITS_ALIGNMENT == 2 -#define getleftbits(psrc, w, dst) \ - { \ - if ( ((int)(psrc)) & 0x01 ) \ - getglyphbits( ((unsigned int *)(((char *)(psrc))-1)), 8, (w), (dst) ); \ - else \ - dst = *((unsigned int *) psrc); \ - } -#endif /* GETLEFTBITS_ALIGNMENT == 2 */ - -#if GETLEFTBITS_ALIGNMENT == 4 -#define getleftbits(psrc, w, dst) \ - { \ - int off, off_b; \ - off_b = (off = ( ((int)(psrc)) & 0x03)) << 3; \ - getglyphbits( \ - (unsigned int *)( ((char *)(psrc)) - off), \ - (off_b), (w), (dst) \ - ); \ - } -#endif /* GETLEFTBITS_ALIGNMENT == 4 */ - -/* - * getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) - * - * Converts bits to pixels in a reasonable way. Takes w (1 <= w <= PPW) - * bits from *psrcstip, starting at bit x; call this a quartet of bits. - * Then, takes the pixels from *psrcpix corresponding to the one-bits (if - * ones is TRUE) or the zero-bits (if ones is FALSE) of the quartet - * and puts these pixels into destpix. - * - * Example: - * - * getstipplepixels( &(0x08192A3B), 17, 4, 1, &(0x4C5D6E7F), dest ) - * - * 0x08192A3B = 0000 1000 0001 1001 0010 1010 0011 1011 - * - * This will take 4 bits starting at bit 17, so the quartet is 0x5 = 0101. - * It will take pixels from 0x4C5D6E7F corresponding to the one-bits in this - * quartet, so dest = 0x005D007F. - * - * XXX Works with both byte order. - * XXX This works for all values of x and w within a doubleword. - */ -#if (BITMAP_BIT_ORDER == MSBFirst) -#define getstipplepixels( psrcstip, x, w, ones, psrcpix, destpix ) \ -{ \ - PixelGroup q; \ - int m; \ - if ((m = ((x) - ((PPW*PSZ)-PPW))) > 0) { \ - q = (*(psrcstip)) << m; \ - if ( (x)+(w) > (PPW*PSZ) ) \ - q |= *((psrcstip)+1) >> ((PPW*PSZ)-m); \ - } \ - else \ - q = (*(psrcstip)) >> -m; \ - q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ - *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ -} -/* I just copied this to get the linker satisfied on PowerPC, - * so this may not be correct at all. - */ -#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \ -{ \ - PixelGroup q; \ - q = *(psrcstip) >> (xt); \ - q = ((ones) ? q : ~q) & 1; \ - *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ -} -#else /* BITMAP_BIT_ORDER == LSB */ - -/* this must load 32 bits worth; for most machines, thats an int */ -#define CfbFetchUnaligned(x) ldl_u(x) - -#define getstipplepixels( psrcstip, xt, w, ones, psrcpix, destpix ) \ -{ \ - PixelGroup q; \ - q = CfbFetchUnaligned(psrcstip) >> (xt); \ - if ( ((xt)+(w)) > (PPW*PSZ) ) \ - q |= (CfbFetchUnaligned((psrcstip)+1)) << ((PPW*PSZ)-(xt)); \ - q = QuartetBitsTable[(w)] & ((ones) ? q : ~q); \ - *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ -} -#if PSZ == 24 -#define getstipplepixels24(psrcstip,xt,ones,psrcpix,destpix,stipindex) \ -{ \ - PixelGroup q; \ - q = *(psrcstip) >> (xt); \ - q = ((ones) ? q : ~q) & 1; \ - *(destpix) = (*(psrcpix)) & QuartetPixelMaskTable[q]; \ -} -#endif /* PSZ == 24 */ -#endif - -extern PixelGroup cfbstarttab[]; -extern PixelGroup cfbendtab[]; -extern PixelGroup cfbstartpartial[]; -extern PixelGroup cfbendpartial[]; -extern PixelGroup cfbrmask[]; -extern PixelGroup cfbmask[]; -extern PixelGroup QuartetBitsTable[]; -extern PixelGroup QuartetPixelMaskTable[]; -#if PSZ == 24 -extern int cfb24Shift[]; -#endif diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c deleted file mode 100644 index 1166f90b7..000000000 --- a/cfb/cfbpixmap.c +++ /dev/null @@ -1,375 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/* pixmap management - written by drewry, september 1986 - - on a monchrome device, a pixmap is a bitmap. -*/ - -#include - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "servermd.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "mi.h" -#include "cfb.h" -#include "cfbmskbits.h" - -PixmapPtr -cfbCreatePixmap (pScreen, width, height, depth, usage_hint) - ScreenPtr pScreen; - int width; - int height; - int depth; - unsigned usage_hint; -{ - PixmapPtr pPixmap; - size_t datasize; - size_t paddedWidth; - - paddedWidth = PixmapBytePad(width, depth); - - if (paddedWidth / 4 > 32767 || height > 32767) - return NullPixmap; - datasize = height * paddedWidth; - pPixmap = AllocatePixmap(pScreen, datasize); - if (!pPixmap) - return NullPixmap; - pPixmap->drawable.type = DRAWABLE_PIXMAP; - pPixmap->drawable.class = 0; - pPixmap->drawable.pScreen = pScreen; - pPixmap->drawable.depth = depth; - pPixmap->drawable.bitsPerPixel = BitsPerPixel(depth); - pPixmap->drawable.id = 0; - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pPixmap->drawable.x = 0; - pPixmap->drawable.y = 0; - pPixmap->drawable.width = width; - pPixmap->drawable.height = height; - pPixmap->devKind = paddedWidth; - pPixmap->refcnt = 1; - pPixmap->devPrivate.ptr = datasize ? - (pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL; - pPixmap->usage_hint = usage_hint; - return pPixmap; -} - -Bool -cfbDestroyPixmap(pPixmap) - PixmapPtr pPixmap; -{ - if(--pPixmap->refcnt) - return TRUE; - dixFreePrivates(pPixmap->devPrivates); - xfree(pPixmap); - return TRUE; -} - -PixmapPtr -cfbCopyPixmap(pSrc) - register PixmapPtr pSrc; -{ - register PixmapPtr pDst; - int size; - ScreenPtr pScreen; - - size = pSrc->drawable.height * pSrc->devKind; - pScreen = pSrc->drawable.pScreen; - pDst = (*pScreen->CreatePixmap) (pScreen, pSrc->drawable.width, - pSrc->drawable.height, pSrc->drawable.depth, 0); - if (!pDst) - return NullPixmap; - memmove((char *)pDst->devPrivate.ptr, (char *)pSrc->devPrivate.ptr, size); - return pDst; -} - - -/* replicates a pattern to be a full 32 bits wide. - relies on the fact that each scnaline is longword padded. - doesn't do anything if pixmap is not a factor of 32 wide. - changes width field of pixmap if successful, so that the fast - cfbXRotatePixmap code gets used if we rotate the pixmap later. - cfbYRotatePixmap code gets used if we rotate the pixmap later. - - calculate number of times to repeat - for each scanline of pattern - zero out area to be filled with replicate - left shift and or in original as many times as needed -*/ -void -cfbPadPixmap(pPixmap) - PixmapPtr pPixmap; -{ - register int width = (pPixmap->drawable.width) * (pPixmap->drawable.bitsPerPixel); - register int h; - register CfbBits mask; - register CfbBits *p; - register CfbBits bits; /* real pattern bits */ - register int i; - int rep; /* repeat count for pattern */ - - if (width >= PGSZ) - return; - - rep = PGSZ/width; - if (rep*width != PGSZ) - return; - - mask = mfbGetendtab(width); - - p = (CfbBits *)(pPixmap->devPrivate.ptr); - for (h=0; h < pPixmap->drawable.height; h++) - { - *p &= mask; - bits = *p; - for(i=1; i>= width; -#else - bits <<= width; -#endif - *p |= bits; - } - p++; - } - pPixmap->drawable.width = PGSZ/(pPixmap->drawable.bitsPerPixel); -} - - -#ifdef notdef -/* - * cfb debugging routine -- assumes pixmap is 1 byte deep - */ -static cfbdumppixmap(pPix) - PixmapPtr pPix; -{ - unsigned int *pw; - char *psrc, *pdst; - int i, j; - char line[66]; - - ErrorF( "pPixmap: 0x%x\n", pPix); - ErrorF( "%d wide %d high\n", pPix->drawable.width, pPix->drawable.height); - if (pPix->drawable.width > 64) - { - ErrorF( "too wide to see\n"); - return; - } - - pw = (unsigned int *) pPix->devPrivate.ptr; - psrc = (char *) pw; - -/* - for ( i=0; idrawable.height; ++i ) - ErrorF( "0x%x\n", pw[i] ); -*/ - - for ( i = 0; i < pPix->drawable.height; ++i ) { - pdst = line; - for(j = 0; j < pPix->drawable.width; j++) { - *pdst++ = *psrc++ ? 'X' : ' ' ; - } - *pdst++ = '\n'; - *pdst++ = '\0'; - ErrorF( "%s", line); - } -} -#endif /* notdef */ - -/* Rotates pixmap pPix by w pixels to the right on the screen. Assumes that - * words are PGSZ bits wide, and that the least significant bit appears on the - * left. - */ -void -cfbXRotatePixmap(pPix, rw) - PixmapPtr pPix; - register int rw; -{ - register CfbBits *pw, *pwFinal; - register CfbBits t; - int rot; - - if (pPix == NullPixmap) - return; - - switch (((DrawablePtr) pPix)->bitsPerPixel) { - case PSZ: - break; - case 1: - mfbXRotatePixmap(pPix, rw); - return; - default: - ErrorF("cfbXRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel); - return; - } - pw = (CfbBits *)pPix->devPrivate.ptr; - modulus (rw, (int) pPix->drawable.width, rot); - if(pPix->drawable.width == PPW) - { - pwFinal = pw + pPix->drawable.height; - while(pw < pwFinal) - { - t = *pw; - *pw++ = SCRRIGHT(t, rot) | - (SCRLEFT(t, (PPW-rot)) & cfbendtab[rot]); - } - } - else - { - ErrorF("cfb internal error: trying to rotate odd-sized pixmap.\n"); -#ifdef notdef - register CfbBits *pwTmp; - int size, tsize; - - tsize = PixmapBytePad(pPix->drawable.width - rot, pPix->drawable.depth); - pwTmp = (CfbBits *) xalloc(pPix->drawable.height * tsize); - if (!pwTmp) - return; - /* divide pw (the pixmap) in two vertically at (w - rot) and swap */ - tsize >>= 2; - size = pPix->devKind >> SIZE0F(PixelGroup); - cfbQuickBlt((CfbBits *)pw, (CfbBits *)pwTmp, - 0, 0, 0, 0, - (int)pPix->drawable.width - rot, (int)pPix->drawable.height, - size, tsize); - cfbQuickBlt((CfbBits *)pw, (CfbBits *)pw, - (int)pPix->drawable.width - rot, 0, 0, 0, - rot, (int)pPix->drawable.height, - size, size); - cfbQuickBlt((CfbBits *)pwTmp, (CfbBits *)pw, - 0, 0, rot, 0, - (int)pPix->drawable.width - rot, (int)pPix->drawable.height, - tsize, size); - xfree(pwTmp); -#endif - } -} - -/* Rotates pixmap pPix by h lines. Assumes that h is always less than - pPix->drawable.height - works on any width. - */ -void -cfbYRotatePixmap(pPix, rh) - register PixmapPtr pPix; - int rh; -{ - int nbyDown; /* bytes to move down to row 0; also offset of - row rh */ - int nbyUp; /* bytes to move up to line rh; also - offset of first line moved down to 0 */ - char *pbase; - char *ptmp; - int rot; - - if (pPix == NullPixmap) - return; - switch (((DrawablePtr) pPix)->bitsPerPixel) { - case PSZ: - break; - case 1: - mfbYRotatePixmap(pPix, rh); - return; - default: - ErrorF("cfbYRotatePixmap: unsupported bitsPerPixel %d\n", ((DrawablePtr) pPix)->bitsPerPixel); - return; - } - - modulus (rh, (int) pPix->drawable.height, rot); - pbase = (char *)pPix->devPrivate.ptr; - - nbyDown = rot * pPix->devKind; - nbyUp = (pPix->devKind * pPix->drawable.height) - nbyDown; - if(!(ptmp = (char *)xalloc(nbyUp))) - return; - - memmove(ptmp, pbase, nbyUp); /* save the low rows */ - memmove(pbase, pbase+nbyUp, nbyDown); /* slide the top rows down */ - memmove(pbase+nbyDown, ptmp, nbyUp); /* move lower rows up to row rot */ - xfree(ptmp); -} - -void -cfbCopyRotatePixmap(psrcPix, ppdstPix, xrot, yrot) - register PixmapPtr psrcPix, *ppdstPix; - int xrot, yrot; -{ - register PixmapPtr pdstPix; - - if ((pdstPix = *ppdstPix) && - (pdstPix->devKind == psrcPix->devKind) && - (pdstPix->drawable.height == psrcPix->drawable.height)) - { - memmove((char *)pdstPix->devPrivate.ptr, - (char *)psrcPix->devPrivate.ptr, - psrcPix->drawable.height * psrcPix->devKind); - pdstPix->drawable.width = psrcPix->drawable.width; - pdstPix->drawable.depth = psrcPix->drawable.depth; - pdstPix->drawable.bitsPerPixel = psrcPix->drawable.bitsPerPixel; - pdstPix->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - else - { - if (pdstPix) - /* FIX XBUG 6168 */ - (*pdstPix->drawable.pScreen->DestroyPixmap)(pdstPix); - *ppdstPix = pdstPix = cfbCopyPixmap(psrcPix); - if (!pdstPix) - return; - } - cfbPadPixmap(pdstPix); - if (xrot) - cfbXRotatePixmap(pdstPix, xrot); - if (yrot) - cfbYRotatePixmap(pdstPix, yrot); -} diff --git a/cfb/cfbply1rct.c b/cfb/cfbply1rct.c deleted file mode 100644 index ce0bcb203..000000000 --- a/cfb/cfbply1rct.c +++ /dev/null @@ -1,363 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include - -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "mistruct.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfbrrop.h" - -void -RROP_NAME(cfbFillPoly1Rect) (pDrawable, pGC, shape, mode, count, ptsIn) - DrawablePtr pDrawable; - GCPtr pGC; - int shape; - int mode; - int count; - DDXPointPtr ptsIn; -{ - cfbPrivGCPtr devPriv; - int nwidth; - CfbBits *addrl, *addr; -#if PSZ == 24 - CfbBits startmask, endmask; - register int pidx; -#else -#if PPW > 1 - CfbBits mask, bits = ~((CfbBits)0); -#endif -#endif - int maxy; - int origin; - register int vertex1, vertex2; - int c = 0; - BoxPtr extents; - int clip; - int y; - int *vertex1p = NULL, *vertex2p; - int *endp; - int x1 = 0, x2 = 0; - int dx1 = 0, dx2 = 0; - int dy1 = 0, dy2 = 0; - int e1 = 0, e2 = 0; - int step1 = 0, step2 = 0; - int sign1 = 0, sign2 = 0; - int h; - int l; -#if PSZ != 24 && PPW > 1 - int r; -#endif - int nmiddle; - RROP_DECLARE - - if (mode == CoordModePrevious) - { - miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); - return; - } - - devPriv = cfbGetGCPrivate(pGC); -#ifdef NO_ONE_RECT - if (REGION_NUM_RECTS(pGC->pCompositeClip) != 1) - { - miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); - return; - } -#endif - origin = *((int *) &pDrawable->x); - vertex2 = origin - ((origin & 0x8000) << 1); - extents = &pGC->pCompositeClip->extents; - RROP_FETCH_GCPRIV(devPriv); - vertex1 = *((int *) &extents->x1) - vertex2; - vertex2 = *((int *) &extents->x2) - vertex2 - 0x00010001; - clip = 0; - y = 32767; - maxy = 0; - vertex2p = (int *) ptsIn; - endp = vertex2p + count; - if (shape == Convex) - { - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - } - } - else - { - int yFlip = 0; - dx1 = 1; - x2 = -1; - x1 = -1; - while (count--) - { - c = *vertex2p; - clip |= (c - vertex1) | (vertex2 - c); - c = intToY(c); - if (c < y) - { - y = c; - vertex1p = vertex2p; - } - vertex2p++; - if (c > maxy) - maxy = c; - if (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) - { - miFillPolygon (pDrawable, pGC, shape, mode, vertex2p - (int *) ptsIn, ptsIn); - return; - } - -#define AddrYPlus(a,y) (CfbBits *) (((unsigned char *) (a)) + (y) * nwidth) - - cfbGetTypedWidthAndPointer(pDrawable, nwidth, addrl, unsigned char, CfbBits); - addrl = AddrYPlus(addrl,y + pDrawable->y); - origin = intToX(origin); - vertex2p = vertex1p; - vertex2 = vertex1 = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; -#define Setup(c,x,vertex,dx,dy,e,sign,step) {\ - x = intToX(vertex); \ - if ((dy = intToY(c) - y)) { \ - dx = intToX(c) - x; \ - step = 0; \ - if (dx >= 0) \ - { \ - e = 0; \ - sign = 1; \ - if (dx >= dy) {\ - step = dx / dy; \ - dx = dx % dy; \ - } \ - } \ - else \ - { \ - e = 1 - dy; \ - sign = -1; \ - dx = -dx; \ - if (dx >= dy) { \ - step = - (dx / dy); \ - dx = dx % dy; \ - } \ - } \ - } \ - x += origin; \ - vertex = c; \ -} - -#define Step(x,dx,dy,e,sign,step) {\ - x += step; \ - if ((e += dx) > 0) \ - { \ - x += sign; \ - e -= dy; \ - } \ -} - for (;;) - { - if (y == intToY(vertex1)) - { - do - { - if (vertex1p == (int *) ptsIn) - vertex1p = endp; - c = *--vertex1p; - Setup (c,x1,vertex1,dx1,dy1,e1,sign1,step1) - } while (y >= intToY(vertex1)); - h = dy1; - } - else - { - Step(x1,dx1,dy1,e1,sign1,step1) - h = intToY(vertex1) - y; - } - if (y == intToY(vertex2)) - { - do - { - c = *vertex2p++; - if (vertex2p == endp) - vertex2p = (int *) ptsIn; - Setup (c,x2,vertex2,dx2,dy2,e2,sign2,step2) - } while (y >= intToY(vertex2)); - if (dy2 < h) - h = dy2; - } - else - { - Step(x2,dx2,dy2,e2,sign2,step2) - if ((c = (intToY(vertex2) - y)) < h) - h = c; - } - /* fill spans for this segment */ - y += h; - for (;;) - { - l = x1; -#if PSZ != 24 && PPW > 1 - r = x2; -#endif - nmiddle = x2 - x1; - if (nmiddle < 0) - { - nmiddle = -nmiddle; - l = x2; -#if PSZ != 24 && PPW > 1 - r = x1; -#endif - } -#if PPW > 1 - c = l & PIM; - l -= c; -#endif - -#if PGSZ == 32 -#define LWRD_SHIFT 2 -#else /* PGSZ == 64 */ -#define LWRD_SHIFT 3 -#endif /* PGSZ */ - -#if PSZ == 24 - addr = (CfbBits *)((char *)addrl + ((l * 3) & ~0x03)); - if (nmiddle <= 1){ - if (nmiddle) - RROP_SOLID24(addr, l); - } else { - maskbits(l, nmiddle, startmask, endmask, nmiddle); - pidx = l & 3; - if (startmask){ - RROP_SOLID_MASK(addr, startmask, pidx-1); - addr++; - if (pidx == 3) - pidx = 0; - } - while (--nmiddle >= 0){ - RROP_SOLID(addr, pidx); - addr++; - if (++pidx == 3) - pidx = 0; - } - if (endmask) - RROP_SOLID_MASK(addr, endmask, pidx); - } -#else /* PSZ == 24 */ -#if PWSH > LWRD_SHIFT - l = l >> (PWSH - LWRD_SHIFT); -#endif -#if PWSH < LWRD_SHIFT - l = l << (LWRD_SHIFT - PWSH); -#endif - addr = (CfbBits *) (((char *) addrl) + l); -#if PPW > 1 - if (c + nmiddle < PPW) - { - mask = SCRRIGHT (bits,c) ^ SCRRIGHT (bits,c+nmiddle); - RROP_SOLID_MASK(addr,mask); - } - else - { - if (c) - { - mask = SCRRIGHT(bits, c); - RROP_SOLID_MASK(addr,mask); - nmiddle += c - PPW; - addr++; - } -#endif - nmiddle >>= PWSH; - while (--nmiddle >= 0) { - RROP_SOLID(addr); addr++; - } -#if PPW > 1 - if ((mask = ~SCRRIGHT(bits, r & PIM))) - RROP_SOLID_MASK(addr,mask); - } -#endif -#endif /* PSZ == 24 */ - if (!--h) - break; - addrl = AddrYPlus (addrl, 1); - Step(x1,dx1,dy1,e1,sign1,step1) - Step(x2,dx2,dy2,e2,sign2,step2) - } - if (y == maxy) - break; - addrl = AddrYPlus (addrl, 1); - } - RROP_UNDECLARE -} diff --git a/cfb/cfbpolypnt.c b/cfb/cfbpolypnt.c deleted file mode 100644 index 06a768e8d..000000000 --- a/cfb/cfbpolypnt.c +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -********************************************************/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "scrnintstr.h" -#include "cfb.h" -#include "cfbmskbits.h" - -#define isClipped(c,ul,lr) ((((c) - (ul)) | ((lr) - (c))) & ClipMask) - -/* WARNING: pbox contains two shorts. This code assumes they are packed - * and can be referenced together as an INT32. - */ - -#define PointLoop(fill) { \ - for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \ - --nbox >= 0; \ - pbox++) \ - { \ - c1 = *((INT32 *) &pbox->x1) - off; \ - c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \ - for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \ - { \ - pt = *ppt++; \ - if (!isClipped(pt,c1,c2)) { \ - fill \ - } \ - } \ - } \ -} - -#if PSZ == 24 -# include "cfbrrop24.h" -#endif - -void -cfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) - DrawablePtr pDrawable; - GCPtr pGC; - int mode; - int npt; - xPoint *pptInit; -{ - register INT32 pt; - register INT32 c1, c2; - register CARD32 ClipMask = 0x80008000; - register CfbBits xor; -#ifdef PIXEL_ADDR - register PixelType *addrp; - register int npwidth; -#if PSZ != 24 - PixelType *addrpt; -#endif -#else - register CfbBits *addrl; - register int nlwidth; - register int xoffset; - CfbBits *addrlt; -#endif -#if PSZ == 24 - RROP_DECLARE - register int xtmp; - register PixelType *p; -#endif - register INT32 *ppt; - RegionPtr cclip; - int nbox; - register int i; - register BoxPtr pbox; - CfbBits and; - int rop = pGC->alu; - int off; - cfbPrivGCPtr devPriv; - xPoint *pptPrev; - - devPriv =cfbGetGCPrivate(pGC); - rop = devPriv->rop; - if (rop == GXnoop) - return; - cclip = pGC->pCompositeClip; - xor = devPriv->xor; - if ((mode == CoordModePrevious) && (npt > 1)) - { - for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++) - { - pptPrev->x += (pptPrev-1)->x; - pptPrev->y += (pptPrev-1)->y; - } - } - off = *((int *) &pDrawable->x); - off -= (off & 0x8000) << 1; -#ifdef PIXEL_ADDR - cfbGetPixelWidthAndPointer(pDrawable, npwidth, addrp); -#if PSZ == 24 - addrp = addrp + pDrawable->y * npwidth; -#else - addrp = addrp + pDrawable->y * npwidth + pDrawable->x; -#endif - if (rop == GXcopy) - { -#if PSZ == 24 - RROP_COPY_SETUP(xor) -#endif - if (!(npwidth & (npwidth - 1))) - { - npwidth = ffs(npwidth) - 1; -#if PSZ == 24 - PointLoop( - xtmp = pDrawable->x + intToX(pt); - p = addrp + (intToY(pt) << npwidth) + ((xtmp * 3) >>2); - RROP_SOLID24_COPY(p, xtmp)) -#else - PointLoop(*(addrp + (intToY(pt) << npwidth) + intToX(pt)) = xor;) -#endif - } -#ifdef sun - else if (npwidth == 1152) - { - register int y; - PointLoop(y = intToY(pt); *(addrp + (y << 10) + (y << 7) + intToX(pt)) = xor;) - } -#endif - else - { -#if PSZ == 24 - PointLoop( - xtmp = pDrawable->x + intToX(pt); - p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2); - RROP_SOLID24_COPY(p, xtmp)) -#else - PointLoop(*(addrp + intToY(pt) * npwidth + intToX(pt)) = xor;) -#endif - } - } - else - { - and = devPriv->and; -#if PSZ == 24 - RROP_SET_SETUP(xor, and) - PointLoop( - xtmp = pDrawable->x + intToX(pt); - p = addrp + intToY(pt) * npwidth + ((xtmp * 3) >> 2); - RROP_SOLID24_SET(p, xtmp)) -#else - PointLoop( addrpt = addrp + intToY(pt) * npwidth + intToX(pt); - *addrpt = DoRRop (*addrpt, and, xor);) -#endif - } -#else /* !PIXEL_ADDR */ - cfbGetLongWidthAndPointer(pDrawable, nlwidth, addrl); - addrl = addrl + pDrawable->y * nlwidth + (pDrawable->x >> PWSH); - xoffset = pDrawable->x & PIM; - and = devPriv->and; -#if PSZ == 24 - PointLoop( addrlt = addrl + intToY(pt) * nlwidth - + ((intToX(pt) + xoffset) >> PWSH); - *addrlt = DoRRop (*addrlt, - and | ~cfbmask[(intToX(pt) + xoffset) & PIM], - xor & cfbmask[(intToX(pt) + xoffset) & PIM]); - ) -#else - PointLoop( addrlt = addrl + intToY(pt) * nlwidth - + ((intToX(pt) + xoffset) >> PWSH); - *addrlt = DoRRop (*addrlt, - and | ~cfbmask[((intToX(pt) + xoffset) & 3)<<1], - xor & cfbmask[((intToX(pt) + xoffset) & 3)<<1]); - ) -#endif -#endif /* PIXEL_ADDR */ -} diff --git a/cfb/cfbpush8.c b/cfb/cfbpush8.c deleted file mode 100644 index 857ec94a6..000000000 --- a/cfb/cfbpush8.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Push Pixels for 8 bit displays. - */ - - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#if PSZ == 8 - -#include -#include -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -void -cfbPushPixels8 (pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg) - GCPtr pGC; - PixmapPtr pBitmap; - DrawablePtr pDrawable; - int dx, dy, xOrg, yOrg; -{ - register CfbBits *src, *dst; - register CfbBits pixel; - register CfbBits c, bits; - CfbBits *pdstLine, *psrcLine; - CfbBits *pdstBase; - int srcWidth; - int dstWidth; - int xoff; - int nBitmapLongs, nPixmapLongs; - int nBitmapTmp, nPixmapTmp; - CfbBits rightMask; - BoxRec bbox; - cfbPrivGCPtr devPriv; - - bbox.x1 = xOrg; - bbox.y1 = yOrg; - bbox.x2 = bbox.x1 + dx; - bbox.y2 = bbox.y1 + dy; - devPriv = cfbGetGCPrivate(pGC); - - switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) - { - case rgnPART: - mfbPushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg); - case rgnOUT: - return; - } - - cfbGetLongWidthAndPointer (pDrawable, dstWidth, pdstBase) - - psrcLine = (CfbBits *) pBitmap->devPrivate.ptr; - srcWidth = (int) pBitmap->devKind >> PWSH; - - pixel = devPriv->xor; - xoff = xOrg & PIM; - nBitmapLongs = (dx + xoff) >> MFB_PWSH; - nPixmapLongs = (dx + PGSZB + xoff) >> PWSH; - - rightMask = ~cfb8BitLenMasks[((dx + xoff) & MFB_PIM)]; - - pdstLine = pdstBase + (yOrg * dstWidth) + (xOrg >> PWSH); - - while (dy--) - { - c = 0; - nPixmapTmp = nPixmapLongs; - nBitmapTmp = nBitmapLongs; - src = psrcLine; - dst = pdstLine; - while (nBitmapTmp--) - { - bits = *src++; - c |= BitRight (bits, xoff); - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - nPixmapTmp -= 8; - c = 0; - if (xoff) - c = BitLeft (bits, PGSZ - xoff); - } - if (BitLeft (rightMask, xoff)) - c |= BitRight (*src, xoff); - c &= rightMask; - switch (nPixmapTmp) { - case 8: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 7: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 6: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 5: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 4: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 3: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 2: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 1: - WriteBitGroup(dst, pixel, GetBitGroup(c)); - NextBitGroup(c); - dst++; - case 0: - break; - } - pdstLine += dstWidth; - psrcLine += srcWidth; - } -} - -#endif diff --git a/cfb/cfbrctstp8.c b/cfb/cfbrctstp8.c deleted file mode 100644 index 485d40998..000000000 --- a/cfb/cfbrctstp8.c +++ /dev/null @@ -1,593 +0,0 @@ -/* - * Fill 32 bit stippled rectangles for 8 bit frame buffers - */ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Author: Keith Packard, MIT X Consortium - -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#if PSZ == 8 - -#include -#include -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -void -cfb8FillRectOpaqueStippled32 (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; /* number of boxes to fill */ - register BoxPtr pBox; /* pointer to list of boxes to fill */ -{ - CfbBits *src; - int stippleHeight; - - int nlwDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - register int h; /* height of current box */ - CfbBits startmask; - CfbBits endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - register int nlw; /* loop version of nlwMiddle */ - CfbBits *dstLine; - register CfbBits *dst; /* pointer to bits we're writing */ - CfbBits *dstTmp; - int y; /* current scan line */ - - CfbBits *pbits;/* pointer to start of pixmap */ - register CfbBits bits; /* bits from stipple */ - int rot; - register CfbBits xor; - PixmapPtr stipple; - int wEnd; - - stipple = pGC->pRotatedPixmap; - - cfb8CheckOpaqueStipple(pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - stippleHeight = stipple->drawable.height; - src = (CfbBits *)stipple->devPrivate.ptr; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - y = pBox->y1; - dstLine = pbits + (pBox->y1 * nlwDst) + ((pBox->x1 & ~PIM) >> PWSH); - if (((pBox->x1 & PIM) + w) <= PPW) - { - maskpartialbits(pBox->x1, w, startmask); - nlwMiddle = 0; - endmask = 0; - } - else - { - maskbits (pBox->x1, w, startmask, endmask, nlwMiddle); - } - rot = (pBox->x1 & ((PGSZ-1) & ~PIM)); - pBox++; - y = y % stippleHeight; -#if PPW == 4 - if (cfb8StippleRRop == GXcopy) - { - if (w < PGSZ*2) - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot) - RotBitsLeft(bits,rot); - dst = dstLine; - dstLine += nlwDst; - if (startmask) - { - *dst = (*dst & ~startmask) | - (GetPixelGroup (bits) & startmask); - dst++; - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - *dst++ = GetPixelGroup(bits); - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - *dst = (*dst & ~endmask) | - (GetPixelGroup (bits) & endmask); - } - } - } - else - { - wEnd = 7 - (nlwMiddle & 7); - nlwMiddle = (nlwMiddle >> 3) + 1; - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dstTmp = dstLine; - dstLine += nlwDst; - if (startmask) - { - *dstTmp = (*dstTmp & ~startmask) | - (GetPixelGroup (bits) & startmask); - dstTmp++; - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; - } - NextBitGroup (bits); - } - nlwMiddle--; - w = wEnd + 1; - if (endmask) - { - dst = dstTmp + (nlwMiddle << 3); - *dst = (*dst & ~endmask) | - (GetPixelGroup(bits) & endmask); - } - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - dstTmp++; - xor = GetPixelGroup (bits); - while (nlw--) - { - *dst = xor; - dst += 8; - } - NextBitGroup (bits); - } - nlwMiddle++; - } - } - } - else -#endif /* PPW == 4 */ - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot) - RotBitsLeft(bits,rot); - dst = dstLine; - dstLine += nlwDst; - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - } -} - -void -cfb8FillRectTransparentStippled32 (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; /* number of boxes to fill */ - BoxPtr pBox; /* pointer to list of boxes to fill */ -{ - int x, y, w, h; - int nlwMiddle, nlwDst; - CfbBits startmask, endmask; - register CfbBits *dst; - CfbBits *dstLine, *pbits, *dstTmp; - CfbBits *src; - register CfbBits xor; - register CfbBits bits, mask; - int rot; - int wEnd; - cfbPrivGCPtr devPriv; - PixmapPtr stipple; - int stippleHeight; - register int nlw; - - devPriv = cfbGetGCPrivate(pGC); - stipple = pGC->pRotatedPixmap; - src = (CfbBits *)stipple->devPrivate.ptr; - stippleHeight = stipple->drawable.height; - - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - while (nBox--) - { - x = pBox->x1; - w = pBox->x2 - x; - if (((x & PIM) + w) <= PPW) - { - maskpartialbits(x, w, startmask); - endmask = 0; - nlwMiddle = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlwMiddle); - } - rot = (x & ((PGSZ-1) & ~PIM)); - y = pBox->y1; - dstLine = pbits + (y * nlwDst) + (x >> PWSH); - h = pBox->y2 - y; - pBox++; - y %= stippleHeight; -#if PPW == 4 - if (cfb8StippleRRop == GXcopy) - { - xor = devPriv->xor; - if (w < PGSZ*2) - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dst = dstLine; - dstLine += nlwDst; - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & startmask)) | - (xor & (mask & startmask)); - dst++; - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - WriteBitGroup (dst,xor,GetBitGroup(bits)) - dst++; - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - } - } - else - { - wEnd = 7 - (nlwMiddle & 7); - nlwMiddle = (nlwMiddle >> 3) + 1; - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dstTmp = dstLine; - dstLine += nlwDst; - if (startmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - *dstTmp = (*dstTmp & ~(mask & startmask)) | - (xor & (mask & startmask)); - dstTmp++; - RotBitsLeft (bits, PGSZB); - } - w = 7 - wEnd; - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - dstTmp++; -#if defined(__GNUC__) && defined(mc68020) - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; - } - xor = devPriv->xor; -#else -#define SwitchBitsLoop(body) \ - while (nlw--) \ - { \ - body \ - dst += 8; \ - } - SwitchBitGroup(dst, xor, GetBitGroup(bits)); -#undef SwitchBitsLoop -#endif - NextBitGroup (bits); - } - nlwMiddle--; - w = wEnd + 1; - if (endmask) - { - mask = cfb8PixelMasks[GetBitGroup(bits)]; - dst = dstTmp + (nlwMiddle << 3); - *dst = (*dst & ~(mask & endmask)) | - (xor & (mask & endmask)); - } - while (w--) - { - nlw = nlwMiddle; - dst = dstTmp; - dstTmp++; -#if defined(__GNUC__) && defined(mc68020) - mask = cfb8PixelMasks[GetBitGroup(bits)]; - xor = xor & mask; - mask = ~mask; - while (nlw--) - { - *dst = (*dst & mask) | xor; - dst += 8; - } - xor = devPriv->xor; -#else -#define SwitchBitsLoop(body) \ - while (nlw--) \ - { \ - body \ - dst += 8; \ - } - SwitchBitGroup(dst, xor, GetBitGroup(bits)); -#undef SwitchBitsLoop -#endif - NextBitGroup (bits); - } - nlwMiddle++; - } - } - } - else -#endif /* PPW == 4 */ - { - while (h--) - { - bits = src[y]; - y++; - if (y == stippleHeight) - y = 0; - if (rot != 0) - RotBitsLeft (bits, rot); - dst = dstLine; - dstLine += nlwDst; - if (startmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, startmask); - dst++; - RotBitsLeft (bits, PGSZB); - } - nlw = nlwMiddle; - while (nlw--) - { - RRopBitGroup(dst, GetBitGroup(bits)); - dst++; - RotBitsLeft (bits, PGSZB); - } - if (endmask) - { - xor = GetBitGroup(bits); - *dst = MaskRRopPixels(*dst, xor, endmask); - } - } - } - } -} - - -void -cfb8FillRectStippledUnnatural (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; - register BoxPtr pBox; -{ - CfbBits *pdstBase; /* pointer to start of bitmap */ - CfbBits *pdstLine; /* current destination line */ - int nlwDst; /* width in longwords of bitmap */ - PixmapPtr pStipple; /* pointer to stipple we want to fill with */ - int nlwMiddle; - register int nlw; - int x, y, w, h, xrem, xSrc, ySrc; - int stwidth, stippleWidth; - int stippleHeight; - register CfbBits bits, inputBits; - register int partBitsLeft; - int nextPartBits; - int bitsLeft, bitsWhole; - register CfbBits *pdst; /* pointer to current word in bitmap */ - CfbBits *srcTemp, *srcStart; - CfbBits *psrcBase; - CfbBits startmask, endmask; - - if (pGC->fillStyle == FillStippled) - cfb8CheckStipple (pGC->alu, pGC->fgPixel, pGC->planemask); - else - cfb8CheckOpaqueStipple (pGC->alu, pGC->fgPixel, pGC->bgPixel, pGC->planemask); - - if (cfb8StippleRRop == GXnoop) - return; - - /* - * OK, so what's going on here? We have two Drawables: - * - * The Stipple: - * Depth = 1 - * Width = stippleWidth - * Words per scanline = stwidth - * Pointer to pixels = pStipple->devPrivate.ptr - */ - - pStipple = pGC->stipple; - - stwidth = pStipple->devKind >> PWSH; - stippleWidth = pStipple->drawable.width; - stippleHeight = pStipple->drawable.height; - psrcBase = (CfbBits *) pStipple->devPrivate.ptr; - - /* - * The Target: - * Depth = PSZ - * Width = determined from *pwidth - * Words per scanline = nlwDst - * Pointer to pixels = addrlBase - */ - - xSrc = pDrawable->x; - ySrc = pDrawable->y; - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pdstBase) - - /* this replaces rotating the stipple. Instead we just adjust the offset - * at which we start grabbing bits from the stipple. - * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, - * so that iline and xrem always stay within the stipple bounds. - */ - - xSrc += (pGC->patOrg.x % stippleWidth) - stippleWidth; - ySrc += (pGC->patOrg.y % stippleHeight) - stippleHeight; - - bitsWhole = stippleWidth; - - while (nBox--) - { - x = pBox->x1; - y = pBox->y1; - w = pBox->x2 - x; - h = pBox->y2 - y; - pBox++; - pdstLine = pdstBase + y * nlwDst + (x >> PWSH); - y = (y - ySrc) % stippleHeight; - srcStart = psrcBase + y * stwidth; - xrem = ((x & ~PIM) - xSrc) % stippleWidth; - if (((x & PIM) + w) < PPW) - { - maskpartialbits (x, w, startmask); - nlwMiddle = 0; - endmask = 0; - } - else - { - maskbits (x, w, startmask, endmask, nlwMiddle); - } - while (h--) - { - srcTemp = srcStart + (xrem >> MFB_PWSH); - bitsLeft = stippleWidth - (xrem & ~MFB_PIM); - NextUnnaturalStippleWord - NextSomeBits (inputBits, (xrem & MFB_PIM)); - partBitsLeft -= (xrem & MFB_PIM); - NextUnnaturalStippleBits - nlw = nlwMiddle; - pdst = pdstLine; - if (startmask) - { - *pdst = MaskRRopPixels(*pdst,bits,startmask); - pdst++; - NextUnnaturalStippleBits - } - while (nlw--) - { - *pdst = RRopPixels(*pdst,bits); - pdst++; - NextUnnaturalStippleBits - } - if (endmask) - *pdst = MaskRRopPixels(*pdst,bits,endmask); - pdstLine += nlwDst; - y++; - srcStart += stwidth; - if (y == stippleHeight) - { - y = 0; - srcStart = psrcBase; - } - } - } -} - -#endif /* PSZ == 8 */ diff --git a/cfb/cfbrrop.c b/cfb/cfbrrop.c deleted file mode 100644 index ffd813853..000000000 --- a/cfb/cfbrrop.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -/* cfb reduced rasterop computations */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "cfb.h" -#include "cfbmskbits.h" - -/* A description: - * - * There are four possible operations on each bit in the destination word, - * - * 1 2 3 4 - * - * 0 0 0 1 1 - * 1 0 1 0 1 - * - * On examination of the reduced rop equation (dst = (dst & and) ^ xor), - * these four fall to reduced rops as follows: - * - * and 0 1 1 0 - * xor 0 0 1 1 - * - * or, (if 'and' is expensive) (dst = (dst | or) ^ xor) - * - * or 1 0 0 1 - * xor 1 0 1 0 - * - * The trouble with using this later equation is that trivial - * rasterop reduction is more difficult; some common rasterops - * use complicated expressions of xor/and instead of the simple - * ones while other common rasterops are not made any simpler: - * - * GXcopy: *dst = ~xor instead of *dst = xor - * GXand: *dst = *dst & ~or instead of *dst = *dst & and - * GXor: *dst = *dst | or instead of *dst = *dst | xor - * GXxor: *dst = *dst ^ xor instead of *dst = *dst ^ xor - * - * If you're really set on using this second mechanism, the changes - * are pretty simple. - * - * All that remains is to provide a mechanism for computing and/xor values - * based on the raster op and foreground value. - * - * The 16 rops fall as follows, with the associated reduced - * rop and/xor and or/xor values. The values in parenthesis following the - * reduced values gives an equation using the source value for - * the reduced value, and is one of {0, src, ~src, 1} as appropriate. - * - * clear and andReverse copy - * src 0 1 0 1 0 1 0 1 - * dst 0 0 0 0 0 0 0 0 1 0 0 1 - * 1 0 0 1 0 1 1 0 0 1 0 1 - * - * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0) - * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src) - * - * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1) - * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src) - * - * andInverted noop xor or - * src 0 1 0 1 0 1 0 1 - * dst 0 0 0 0 0 0 0 0 1 0 0 1 - * 1 1 0 1 1 1 1 1 0 1 1 1 - * - * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src) - * xor 0 0 (0) 0 0 (0) 0 1 (src) 0 1 (src) - * - * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src) - * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0) - * - * nor equiv invert orReverse - * src 0 1 0 1 0 1 0 1 - * dst 0 1 0 0 1 0 0 1 1 0 1 1 - * 1 0 0 1 0 1 1 0 0 1 0 1 - * - * and 1 0 (~src) 1 1 (1) 1 1 (1) 1 0 (~src) - * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1) - * - * or 0 1 (src) 0 0 (0) 0 0 (0) 0 1 (src) - * xor 1 1 (1) 1 0 (~src) 1 1 (1) 1 0 (~src) - * - * copyInverted orInverted nand set - * src 0 1 0 1 0 1 0 1 - * dst 0 1 0 0 1 0 0 1 1 0 1 1 - * 1 1 0 1 1 1 1 1 0 1 1 1 - * - * and 0 0 (0) 0 1 (src) 0 1 (src) 0 0 (0) - * xor 1 0 (~src) 1 0 (~src) 1 1 (1) 1 1 (1) - * - * or 1 1 (1) 1 0 (~src) 1 0 (~src) 1 1 (1) - * xor 0 1 (src) 0 0 (0) 0 1 (src) 0 0 (0) - */ - -int -cfbReduceRasterOp (rop, fg, pm, andp, xorp) - int rop; - CfbBits fg, pm; - CfbBits *andp, *xorp; -{ - CfbBits and, xor; - int rrop; - - fg = PFILL (fg); - pm = PFILL (pm); - switch (rop) - { - case GXclear: - and = 0; - xor = 0; - break; - case GXand: - and = fg; - xor = 0; - break; - case GXandReverse: - and = fg; - xor = fg; - break; - case GXcopy: - and = 0; - xor = fg; - break; - case GXandInverted: - and = ~fg; - xor = 0; - break; - case GXnoop: - and = ~0; - xor = 0; - break; - case GXxor: - and = ~0; - xor = fg; - break; - case GXor: - and = ~fg; - xor = fg; - break; - case GXnor: - and = ~fg; - xor = ~fg; - break; - case GXequiv: - and = ~0; - xor = ~fg; - break; - case GXinvert: - and = ~0; - xor = ~0; - break; - case GXorReverse: - and = ~fg; - xor = ~0; - break; - case GXcopyInverted: - and = 0; - xor = ~fg; - break; - case GXorInverted: - and = fg; - xor = ~fg; - break; - case GXnand: - and = fg; - xor = ~0; - break; - case GXset: - and = 0; - xor = ~0; - break; - default: - and = xor = 0; - break; - } - and |= ~pm; - xor &= pm; - *andp = and; - *xorp = xor; - /* check for some special cases to reduce computation */ - if (and == 0) - rrop = GXcopy; - /* nothing checks for GXnoop - else if (and == ~0 && xor == 0) - rrop = GXnoop; - */ - else if (and == ~0) - rrop = GXxor; - else if (xor == 0) - rrop = GXand; - else if ( (and ^ xor) == ~0) /* fix XBUG 6541 */ - rrop = GXor; - else - rrop = GXset; /* rop not reduced */ - return rrop; -} diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h deleted file mode 100644 index e9ca881be..000000000 --- a/cfb/cfbrrop.h +++ /dev/null @@ -1,343 +0,0 @@ -/* - * -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef GXcopy -#include -#endif - -#define RROP_FETCH_GC(gc) \ - RROP_FETCH_GCPRIV((cfbPrivGCPtr)dixLookupPrivate(&(gc)->devPrivates, \ - cfbGCPrivateKey)) - -#ifndef RROP -#define RROP GXset -#endif - -#if RROP == GXcopy -#if PSZ == 24 -#define RROP_DECLARE register CfbBits rrop_xor; \ - CfbBits piQxelXor[3], spiQxelXor[8]; -#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \ - spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ - spiQxelXor[2] = rrop_xor << 24; \ - spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \ - spiQxelXor[4] = rrop_xor << 16; \ - spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ - spiQxelXor[6] = rrop_xor << 8; \ - spiQxelXor[1] = spiQxelXor[7] = 0; \ - piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ - piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ - piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); -#define RROP_SOLID24(dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - *(dst) = (*(dst) & cfbrmask[idx])|spiQxelXor[idx]; \ - if (idx == 2 || idx == 4){ \ - idx++; \ - *((dst)+1) = (*((dst)+1) & cfbrmask[idx])|spiQxelXor[idx]; \ - } \ - } -#define RROP_SOLID(dst, idx) \ - (*(dst) = piQxelXor[(idx)]) -#define RROP_SOLID_MASK(dst,mask,idx) \ - (*(dst) = (*(dst) & ~(mask))|(piQxelXor[(idx)] & (mask))) -#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor; -#else -#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; -#define RROP_DECLARE register CfbBits rrop_xor; -#define RROP_SOLID(dst) (*(dst) = (rrop_xor)) -#define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask))) -#define RROP_UNDECLARE -#endif -#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy) -#endif /* GXcopy */ - -#if RROP == GXxor -#if PSZ == 24 -#define RROP_DECLARE register CfbBits rrop_xor; \ - CfbBits piQxelXor[3], spiQxelXor[8]; -#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; \ - spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ - spiQxelXor[2] = rrop_xor << 24; \ - spiQxelXor[3] = (rrop_xor & 0xFFFF00)>> 8; \ - spiQxelXor[4] = rrop_xor << 16; \ - spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ - spiQxelXor[6] = rrop_xor << 8; \ - spiQxelXor[1] = spiQxelXor[7] = 0; \ - piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ - piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ - piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); -#define RROP_SOLID24(dst,index) {\ - register int idx = ((index) & 3)<< 1; \ - *(dst) ^= spiQxelXor[idx]; \ - if (idx == 2 || idx == 4) \ - *((dst)+1) ^= spiQxelXor[idx+1]; \ - } -#define RROP_SOLID(dst,idx) \ - (*(dst) ^= piQxelXor[(idx)]) -#define RROP_SOLID_MASK(dst,mask,idx) \ - (*(dst) ^= (piQxelXor[(idx)] & (mask))) -#define RROP_UNDECLARE (void)piQxelXor; (void)spiQxelXor; -#else -#define RROP_DECLARE register CfbBits rrop_xor; -#define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; -#define RROP_SOLID(dst) (*(dst) ^= (rrop_xor)) -#define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask))) -#define RROP_UNDECLARE -#endif -#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor) -#endif /* GXxor */ - -#if RROP == GXand -#if PSZ == 24 -#define RROP_DECLARE register CfbBits rrop_and; \ - CfbBits piQxelAnd[3], spiQxelAnd[6]; -#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ - spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \ - spiQxelAnd[2] = (rrop_and << 24) | 0xFFFFFF; \ - spiQxelAnd[3] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \ - spiQxelAnd[4] = (rrop_and << 16) | 0xFFFF; \ - spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \ - spiQxelAnd[1] = (rrop_and << 8) | 0xFF; \ - piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \ - piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \ - piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); -#define RROP_SOLID24(dst,index) {\ - switch((index) & 3){ \ - case 0: \ - *(dst) &= spiQxelAnd[0]; \ - break; \ - case 3: \ - *(dst) &= spiQxelAnd[1]; \ - break; \ - case 1: \ - *(dst) &= spiQxelAnd[2]; \ - *((dst)+1) &= spiQxelAnd[3]; \ - break; \ - case 2: \ - *(dst) &= spiQxelAnd[4]; \ - *((dst)+1) &= spiQxelAnd[5]; \ - break; \ - } \ - } -#define RROP_SOLID(dst,idx) \ - (*(dst) &= piQxelAnd[(idx)]) -#define RROP_SOLID_MASK(dst,mask,idx) \ - (*(dst) &= (piQxelAnd[(idx)] | ~(mask))) -#define RROP_UNDECLARE (void)piQxelAnd; (void)spiQxelAnd; -#else -#define RROP_DECLARE register CfbBits rrop_and; -#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; -#define RROP_SOLID(dst) (*(dst) &= (rrop_and)) -#define RROP_SOLID_MASK(dst,mask) (*(dst) &= ((rrop_and) | ~(mask))) -#define RROP_UNDECLARE -#endif -#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,And) -#endif /* GXand */ - -#if RROP == GXor -#if PSZ == 24 -#define RROP_DECLARE register CfbBits rrop_or; \ - CfbBits piQxelOr[3], spiQxelOr[6]; -#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; \ - spiQxelOr[0] = rrop_or & 0xFFFFFF; \ - spiQxelOr[1] = rrop_or << 24; \ - spiQxelOr[2] = rrop_or << 16; \ - spiQxelOr[3] = rrop_or << 8; \ - spiQxelOr[4] = (rrop_or & 0xFFFF00)>> 8; \ - spiQxelOr[5] = (rrop_or & 0xFF0000)>> 16; \ - piQxelOr[0] = (rrop_or & 0xFFFFFF)|(rrop_or << 24); \ - piQxelOr[1] = (rrop_or << 16)|((rrop_or & 0xFFFF00)>> 8); \ - piQxelOr[2] = (rrop_or << 8)|((rrop_or & 0xFF0000)>> 16); -#define RROP_SOLID24(dst,index) {\ - switch((index) & 3){ \ - case 0: \ - *(dst) |= spiQxelOr[0]; \ - break; \ - case 3: \ - *(dst) |= spiQxelOr[3]; \ - break; \ - case 1: \ - *(dst) |= spiQxelOr[1]; \ - *((dst)+1) |= spiQxelOr[4]; \ - break; \ - case 2: \ - *(dst) |= spiQxelOr[2]; \ - *((dst)+1) |= spiQxelOr[5]; \ - break; \ - } \ - } -#define RROP_SOLID(dst,idx) \ - (*(dst) |= piQxelOr[(idx)]) -#define RROP_SOLID_MASK(dst,mask,idx) \ - (*(dst) |= (piQxelOr[(idx)] & (mask))) -#define RROP_UNDECLARE (void)piQxelOr; (void)spiQxelOr; -#else -#define RROP_DECLARE register CfbBits rrop_or; -#define RROP_FETCH_GCPRIV(devPriv) rrop_or = (devPriv)->xor; -#define RROP_SOLID(dst) (*(dst) |= (rrop_or)) -#define RROP_SOLID_MASK(dst,mask) (*(dst) |= ((rrop_or) & (mask))) -#define RROP_UNDECLARE -#endif -#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Or) -#endif /* GXor */ - -#if RROP == GXnoop -#define RROP_DECLARE -#define RROP_FETCH_GCPRIV(devPriv) -#define RROP_SOLID(dst) -#define RROP_SOLID_MASK(dst,mask) -#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Noop) -#define RROP_UNDECLARE -#endif /* GXnoop */ - -#if RROP == GXset -#if PSZ == 24 -#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; \ - CfbBits piQxelAnd[3], piQxelXor[3], spiQxelAnd[6], spiQxelXor[6]; -#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ - rrop_xor = (devPriv)->xor; \ - spiQxelXor[0] = rrop_xor & 0xFFFFFF; \ - spiQxelXor[1] = rrop_xor << 24; \ - spiQxelXor[2] = rrop_xor << 16; \ - spiQxelXor[3] = rrop_xor << 8; \ - spiQxelXor[4] = (rrop_xor & 0xFFFF00)>> 8; \ - spiQxelXor[5] = (rrop_xor & 0xFF0000)>> 16; \ - spiQxelAnd[0] = (rrop_and & 0xFFFFFF) | 0xFF000000; \ - spiQxelAnd[1] = (rrop_and << 24) | 0xFFFFFF; \ - spiQxelAnd[2] = (rrop_and << 16) | 0xFFFF; \ - spiQxelAnd[3] = (rrop_and << 8) | 0xFF; \ - spiQxelAnd[4] = ((rrop_and & 0xFFFF00)>> 8) | 0xFFFF0000; \ - spiQxelAnd[5] = ((rrop_and & 0xFF0000)>> 16) | 0xFFFFFF00; \ - piQxelAnd[0] = (rrop_and & 0xFFFFFF)|(rrop_and << 24); \ - piQxelAnd[1] = (rrop_and << 16)|((rrop_and & 0xFFFF00)>> 8); \ - piQxelAnd[2] = (rrop_and << 8)|((rrop_and & 0xFF0000)>> 16); \ - piQxelXor[0] = (rrop_xor & 0xFFFFFF)|(rrop_xor << 24); \ - piQxelXor[1] = (rrop_xor << 16)|((rrop_xor & 0xFFFF00)>> 8); \ - piQxelXor[2] = (rrop_xor << 8)|((rrop_xor & 0xFF0000)>> 16); -#define RROP_SOLID24(dst,index) {\ - switch((index) & 3){ \ - case 0: \ - *(dst) = ((*(dst) & (piQxelAnd[0] |0xFF000000))^(piQxelXor[0] & 0xFFFFFF)); \ - break; \ - case 3: \ - *(dst) = ((*(dst) & (piQxelAnd[2]|0xFF))^(piQxelXor[2] & 0xFFFFFF00)); \ - break; \ - case 1: \ - *(dst) = ((*(dst) & (piQxelAnd[0]|0xFFFFFF))^(piQxelXor[0] & 0xFF000000)); \ - *((dst)+1) = ((*((dst)+1) & (piQxelAnd[1]|0xFFFF0000))^(piQxelXor[1] & 0xFFFF)); \ - break; \ - case 2: \ - *(dst) = ((*(dst) & (piQxelAnd[1]|0xFFFF))^(piQxelXor[1] & 0xFFFF0000)); \ - *((dst)+1) = ((*((dst)+1) & (piQxelAnd[2]|0xFFFFFF00))^(piQxelXor[2] & 0xFF)); \ - break; \ - } \ - } -#define RROP_SOLID(dst,idx) \ - (*(dst) = DoRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)])) -#define RROP_SOLID_MASK(dst,mask,idx) \ - (*(dst) = DoMaskRRop (*(dst), piQxelAnd[(idx)], piQxelXor[(idx)], (mask))) -#define RROP_UNDECLARE (void)piQxelAnd; (void)piQxelXor; \ - (void)spiQxelAnd; (void)spiQxelXor; -#else -#define RROP_DECLARE register CfbBits rrop_and, rrop_xor; -#define RROP_FETCH_GCPRIV(devPriv) rrop_and = (devPriv)->and; \ - rrop_xor = (devPriv)->xor; -#define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor)) -#define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask))) -#define RROP_UNDECLARE -#endif -#define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General) -#endif /* GXset */ - -#define RROP_UNROLL_CASE1(p,i) case (i): RROP_SOLID((p) - (i)); -#define RROP_UNROLL_CASE2(p,i) RROP_UNROLL_CASE1(p,(i)+1) RROP_UNROLL_CASE1(p,i) -#define RROP_UNROLL_CASE4(p,i) RROP_UNROLL_CASE2(p,(i)+2) RROP_UNROLL_CASE2(p,i) -#define RROP_UNROLL_CASE8(p,i) RROP_UNROLL_CASE4(p,(i)+4) RROP_UNROLL_CASE4(p,i) -#define RROP_UNROLL_CASE16(p,i) RROP_UNROLL_CASE8(p,(i)+8) RROP_UNROLL_CASE8(p,i) -#define RROP_UNROLL_CASE32(p,i) RROP_UNROLL_CASE16(p,(i)+16) RROP_UNROLL_CASE16(p,i) -#define RROP_UNROLL_CASE3(p) RROP_UNROLL_CASE2(p,2) RROP_UNROLL_CASE1(p,1) -#define RROP_UNROLL_CASE7(p) RROP_UNROLL_CASE4(p,4) RROP_UNROLL_CASE3(p) -#define RROP_UNROLL_CASE15(p) RROP_UNROLL_CASE8(p,8) RROP_UNROLL_CASE7(p) -#define RROP_UNROLL_CASE31(p) RROP_UNROLL_CASE16(p,16) RROP_UNROLL_CASE15(p) -#ifdef LONG64 -#define RROP_UNROLL_CASE63(p) RROP_UNROLL_CASE32(p,32) RROP_UNROLL_CASE31(p) -#endif /* LONG64 */ - -#define RROP_UNROLL_LOOP1(p,i) RROP_SOLID((p) + (i)); -#define RROP_UNROLL_LOOP2(p,i) RROP_UNROLL_LOOP1(p,(i)) RROP_UNROLL_LOOP1(p,(i)+1) -#define RROP_UNROLL_LOOP4(p,i) RROP_UNROLL_LOOP2(p,(i)) RROP_UNROLL_LOOP2(p,(i)+2) -#define RROP_UNROLL_LOOP8(p,i) RROP_UNROLL_LOOP4(p,(i)) RROP_UNROLL_LOOP4(p,(i)+4) -#define RROP_UNROLL_LOOP16(p,i) RROP_UNROLL_LOOP8(p,(i)) RROP_UNROLL_LOOP8(p,(i)+8) -#define RROP_UNROLL_LOOP32(p,i) RROP_UNROLL_LOOP16(p,(i)) RROP_UNROLL_LOOP16(p,(i)+16) -#ifdef LONG64 -#define RROP_UNROLL_LOOP64(p,i) RROP_UNROLL_LOOP32(p,(i)) RROP_UNROLL_LOOP32(p,(i)+32) -#endif /* LONG64 */ - -#if defined (FAST_CONSTANT_OFFSET_MODE) && defined (SHARED_IDCACHE) && (RROP == GXcopy) - -#ifdef LONG64 -#define RROP_UNROLL_SHIFT 6 -#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE63(p) -#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP64(p,-64) -#else /* not LONG64 */ -#define RROP_UNROLL_SHIFT 5 -#define RROP_UNROLL_CASE(p) RROP_UNROLL_CASE31(p) -#define RROP_UNROLL_LOOP(p) RROP_UNROLL_LOOP32(p,-32) -#endif /* LONG64 */ -#define RROP_UNROLL (1<>= RROP_UNROLL_SHIFT; \ - (pdst) += part * (sizeof (CfbBits) / sizeof (*pdst)); \ - switch (part) {\ - RROP_UNROLL_CASE((CfbBits *) (pdst)) \ - } \ - while (--(nmiddle) >= 0) { \ - (pdst) += RROP_UNROLL * (sizeof (CfbBits) / sizeof (*pdst)); \ - RROP_UNROLL_LOOP((CfbBits *) (pdst)) \ - } \ -} -#else -#define RROP_SPAN(pdst,nmiddle) \ - while (--(nmiddle) >= 0) { \ - RROP_SOLID((CfbBits *) (pdst)); \ - (pdst) += sizeof (CfbBits) / sizeof (*pdst); \ - } -#endif - -#if !defined(UNIXCPP) || defined(ANSICPP) -#define RROP_NAME_CAT(prefix,suffix) prefix##suffix -#else -#define RROP_NAME_CAT(prefix,suffix) prefix/**/suffix -#endif diff --git a/cfb/cfbscrinit.c b/cfb/cfbscrinit.c deleted file mode 100644 index 6f9ba2e85..000000000 --- a/cfb/cfbscrinit.c +++ /dev/null @@ -1,223 +0,0 @@ -/************************************************************ -Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright no- -tice appear in all copies and that both that copyright no- -tice and this permission notice appear in supporting docu- -mentation, and that the names of Sun or The Open Group -not be used in advertising or publicity pertaining to -distribution of the software without specific prior -written permission. Sun and The Open Group make no -representations about the suitability of this software for -any purpose. It is provided "as is" without any express or -implied warranty. - -SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- -NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI- -ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "resource.h" -#include "colormap.h" -#include "colormapst.h" -#include "cfb.h" -#include "mi.h" -#include "mistruct.h" -#include "dix.h" -#include "cfbmskbits.h" -#include "mibstore.h" - -Bool -cfbCloseScreen (index, pScreen) - int index; - ScreenPtr pScreen; -{ - int d; - DepthPtr depths = pScreen->allowedDepths; - - for (d = 0; d < pScreen->numDepths; d++) - xfree (depths[d].vids); - xfree (depths); - xfree (pScreen->visuals); -#ifdef CFB_NEED_SCREEN_PRIVATE - xfree (dixLookupPrivate(&pScreen->devPrivates, cfbScreenPrivateKey)); -#else - xfree (pScreen->devPrivate); -#endif - return TRUE; -} - -static void DestroyColormapNoop( - ColormapPtr pColormap) -{ - /* NOOP */ -} - -static void StoreColorsNoop( - ColormapPtr pColormap, - int ndef, - xColorItem * pdef) -{ - /* NOOP */ -} - -Bool -cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ -{ - if (!cfbAllocatePrivates(pScreen, NULL)) - return FALSE; - pScreen->defColormap = FakeClientID(0); - /* let CreateDefColormap do whatever it wants for pixels */ - pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; - pScreen->QueryBestSize = mfbQueryBestSizeWeak(); - /* SaveScreen */ - pScreen->GetImage = cfbGetImage; - pScreen->GetSpans = cfbGetSpans; - pScreen->CreateWindow = cfbCreateWindow; - pScreen->DestroyWindow = cfbDestroyWindow; - pScreen->PositionWindow = cfbPositionWindow; - pScreen->ChangeWindowAttributes = cfbChangeWindowAttributes; - pScreen->RealizeWindow = cfbMapWindow; - pScreen->UnrealizeWindow = cfbUnmapWindow; - pScreen->CopyWindow = cfbCopyWindow; - pScreen->CreatePixmap = cfbCreatePixmap; - pScreen->DestroyPixmap = cfbDestroyPixmap; - pScreen->RealizeFont = mfbRealizeFontWeak(); - pScreen->UnrealizeFont = mfbUnrealizeFontWeak(); - pScreen->CreateGC = cfbCreateGC; - pScreen->CreateColormap = cfbInitializeColormap; - pScreen->DestroyColormap = DestroyColormapNoop; - pScreen->InstallColormap = cfbInstallColormap; - pScreen->UninstallColormap = cfbUninstallColormap; - pScreen->ListInstalledColormaps = cfbListInstalledColormaps; - pScreen->StoreColors = StoreColorsNoop; - pScreen->ResolveColor = cfbResolveColor; - pScreen->BitmapToRegion = mfbPixmapToRegionWeak(); - - mfbRegisterCopyPlaneProc (pScreen, cfbCopyPlane); - return TRUE; -} - -#ifdef CFB_NEED_SCREEN_PRIVATE -Bool -cfbCreateScreenResources(pScreen) - ScreenPtr pScreen; -{ - Bool retval; - - pointer oldDevPrivate = pScreen->devPrivate; - pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates, - cfbScreenPrivateKey); - retval = miCreateScreenResources(pScreen); - dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey, - pScreen->devPrivate); - pScreen->devPrivate = oldDevPrivate; - return retval; -} -#endif - -Bool -cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ -{ -#ifdef CFB_NEED_SCREEN_PRIVATE - pointer oldDevPrivate; -#endif - VisualPtr visuals; - DepthPtr depths; - int nvisuals; - int ndepths; - int rootdepth; - VisualID defaultVisual; - - rootdepth = 0; - if (!cfbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, - &defaultVisual,((unsigned long)1<<(PSZ-1)), 8)) - return FALSE; -#ifdef CFB_NEED_SCREEN_PRIVATE - oldDevPrivate = pScreen->devPrivate; -#endif - if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, - rootdepth, ndepths, depths, - defaultVisual, nvisuals, visuals)) - return FALSE; - /* overwrite miCloseScreen with our own */ - pScreen->CloseScreen = cfbCloseScreen; -#ifdef CFB_NEED_SCREEN_PRIVATE - pScreen->CreateScreenResources = cfbCreateScreenResources; - dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey, - pScreen->devPrivate); - pScreen->devPrivate = oldDevPrivate; -#endif - pScreen->GetScreenPixmap = cfbGetScreenPixmap; - pScreen->SetScreenPixmap = cfbSetScreenPixmap; - return TRUE; -} - -/* dts * (inch/dot) * (25.4 mm / inch) = mm */ -Bool -cfbScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) - register ScreenPtr pScreen; - pointer pbits; /* pointer to screen bitmap */ - int xsize, ysize; /* in pixels */ - int dpix, dpiy; /* dots per inch */ - int width; /* pixel width of frame buffer */ -{ - if (!cfbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width)) - return FALSE; - return cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width); -} - -PixmapPtr -cfbGetScreenPixmap(pScreen) - ScreenPtr pScreen; -{ -#ifdef CFB_NEED_SCREEN_PRIVATE - return (PixmapPtr)dixLookupPrivate(&pScreen->devPrivates, - cfbScreenPrivateKey); -#else - return (PixmapPtr)pScreen->devPrivate; -#endif -} - -void -cfbSetScreenPixmap(pPix) - PixmapPtr pPix; -{ -#ifdef CFB_NEED_SCREEN_PRIVATE - if (pPix) - dixSetPrivate(&pPix->drawable.pScreen->devPrivates, - cfbScreenPrivateKey, pPix); -#else - if (pPix) - pPix->drawable.pScreen->devPrivate = (pointer)pPix; -#endif -} diff --git a/cfb/cfbsetsp.c b/cfb/cfbsetsp.c deleted file mode 100644 index a000fd9e1..000000000 --- a/cfb/cfbsetsp.c +++ /dev/null @@ -1,316 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" - -#include "misc.h" -#include "regionstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include - -/* cfbSetScanline -- copies the bits from psrc to the drawable starting at - * (xStart, y) and continuing to (xEnd, y). xOrigin tells us where psrc - * starts on the scanline. (I.e., if this scanline passes through multiple - * boxes, we may not want to start grabbing bits at psrc but at some offset - * further on.) - */ -void -cfbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst, planemask) - int y; - int xOrigin; /* where this scanline starts */ - int xStart; /* first bit to use from scanline */ - int xEnd; /* last bit to use from scanline + 1 */ - register unsigned int *psrc; - register int alu; /* raster op */ - int *pdstBase; /* start of the drawable */ - int widthDst; /* width of drawable in words */ - unsigned long planemask; -{ - int w; /* width of scanline in bits */ - register int *pdst; /* where to put the bits */ - register int tmpSrc; /* scratch buffer to collect bits in */ - int offSrc; - int nl; -#if PSZ == 24 - register char *psrcb, *pdstb; - register int xIndex; -#else - int dstBit; /* offset in bits from beginning of - * word */ - register int nstart; /* number of bits from first partial */ -#if PSZ != 32 || PPW != 1 - register int nend; /* " " last partial word */ -#endif - int startmask, endmask, nlMiddle; -#endif - DeclareMergeRop() - - InitializeMergeRop(alu,planemask); -#if PSZ == 24 - pdst = pdstBase + (y * widthDst); - xIndex = xStart; - pdstb = (char *)pdst + (xStart * 3); - offSrc = xStart - xOrigin; - psrcb = (char *)psrc + (offSrc * 3); -#else - pdst = pdstBase + (y * widthDst) + (xStart >> PWSH); - psrc += (xStart - xOrigin) >> PWSH; - offSrc = (xStart - xOrigin) & PIM; -#endif - w = xEnd - xStart; - -#if PSZ == 24 - nl = w; - while (nl--){ - psrc = (unsigned int *)((unsigned long)psrcb & ~0x03); - getbits24(psrc, tmpSrc, offSrc); - pdst = (int *)((unsigned long)pdstb & ~0x03); - DoMergeRop24(tmpSrc, pdst, xIndex); - offSrc++; - psrcb += 3; - xIndex++; - pdstb += 3; - } -#else /* PSZ == 24 */ - dstBit = xStart & PIM; - if (dstBit + w <= PPW) - { - maskpartialbits(dstBit, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits(xStart, w, startmask, endmask, nlMiddle); - } - if (startmask) - nstart = PPW - dstBit; - else - nstart = 0; -#if PSZ != 32 || PPW != 1 - if (endmask) - nend = xEnd & PIM; - else - nend = 0; -#endif - if (startmask) - { - getbits(psrc, offSrc, nstart, tmpSrc); - putbitsmropshort(tmpSrc, dstBit, nstart, pdst); - pdst++; - offSrc += nstart; - if (offSrc > PLST) - { - psrc++; - offSrc -= PPW; - } - } - nl = nlMiddle; - while (nl--) - { - getbits(psrc, offSrc, PPW, tmpSrc); - *pdst = DoMergeRop(tmpSrc, *pdst); - pdst++; - psrc++; - } - if (endmask) - { - getbits(psrc, offSrc, nend, tmpSrc); - putbitsmropshort(tmpSrc, 0, nend, pdst); - } -#endif /* PSZ == 24 */ -} - - - -/* SetSpans -- for each span copy pwidth[i] bits from psrc to pDrawable at - * ppt[i] using the raster op from the GC. If fSorted is TRUE, the scanlines - * are in increasing Y order. - * Source bit lines are server scanline padded so that they always begin - * on a word boundary. - */ -void -cfbSetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - char *pcharsrc; - register DDXPointPtr ppt; - int *pwidth; - int nspans; - int fSorted; -{ - unsigned int *psrc = (unsigned int *)pcharsrc; - CfbBits *pdstBase; /* start of dst bitmap */ - int widthDst; /* width of bitmap in words */ - register BoxPtr pbox, pboxLast, pboxTest; - register DDXPointPtr pptLast; - int alu; - RegionPtr prgnDst; - int xStart, xEnd; - int yMax; - - alu = pGC->alu; - prgnDst = cfbGetCompositeClip(pGC); - pptLast = ppt + nspans; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - yMax = (int) pDrawable->y + (int) pDrawable->height; - - pbox = REGION_RECTS(prgnDst); - pboxLast = pbox + REGION_NUM_RECTS(prgnDst); - - if(fSorted) - { - /* scan lines sorted in ascending order. Because they are sorted, we - * don't have to check each scanline against each clip box. We can be - * sure that this scanline only has to be clipped to boxes at or after the - * beginning of this y-band - */ - pboxTest = pbox; - while(ppt < pptLast) - { - pbox = pboxTest; - if(ppt->y >= yMax) - break; - while(pbox < pboxLast) - { - if(pbox->y1 > ppt->y) - { - /* scanline is before clip box */ - break; - } - else if(pbox->y2 <= ppt->y) - { - /* clip box is before scanline */ - pboxTest = ++pbox; - continue; - } - else if(pbox->x1 > ppt->x + *pwidth) - { - /* clip box is to right of scanline */ - break; - } - else if(pbox->x2 <= ppt->x) - { - /* scanline is to right of clip box */ - pbox++; - continue; - } - - /* at least some of the scanline is in the current clip box */ - xStart = max(pbox->x1, ppt->x); - xEnd = min(ppt->x + *pwidth, pbox->x2); - cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, - (int *)pdstBase, widthDst, pGC->planemask); - if(ppt->x + *pwidth <= pbox->x2) - { - /* End of the line, as it were */ - break; - } - else - pbox++; - } - /* We've tried this line against every box; it must be outside them - * all. move on to the next point */ - ppt++; - psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth); - pwidth++; - } - } - else - { - /* scan lines not sorted. We must clip each line against all the boxes */ - while(ppt < pptLast) - { - if(ppt->y >= 0 && ppt->y < yMax) - { - - for(pbox = REGION_RECTS(prgnDst); pbox< pboxLast; pbox++) - { - if(pbox->y1 > ppt->y) - { - /* rest of clip region is above this scanline, - * skip it */ - break; - } - if(pbox->y2 <= ppt->y) - { - /* clip box is below scanline */ - pbox++; - break; - } - if(pbox->x1 <= ppt->x + *pwidth && - pbox->x2 > ppt->x) - { - xStart = max(pbox->x1, ppt->x); - xEnd = min(pbox->x2, ppt->x + *pwidth); - cfbSetScanline(ppt->y, ppt->x, xStart, xEnd, psrc, alu, - (int *)pdstBase, widthDst, pGC->planemask); - } - - } - } - psrc += PixmapWidthInPadUnits(*pwidth, pDrawable->depth); - ppt++; - pwidth++; - } - } -} - diff --git a/cfb/cfbsolid.c b/cfb/cfbsolid.c deleted file mode 100644 index 6b8238dd9..000000000 --- a/cfb/cfbsolid.c +++ /dev/null @@ -1,1365 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfbrrop.h" - -#include "mi.h" -#include "mispans.h" - -#if defined(FAST_CONSTANT_OFFSET_MODE) && (RROP != GXcopy) -# define Expand(left,right,leftAdjust) {\ - int part = nmiddle & 3; \ - int widthStep; \ - widthStep = widthDst - nmiddle - leftAdjust; \ - nmiddle >>= 2; \ - pdst = pdstRect; \ - while (h--) { \ - left \ - pdst += part; \ - switch (part) { \ - RROP_UNROLL_CASE3(pdst) \ - } \ - m = nmiddle; \ - while (m) { \ - pdst += 4; \ - RROP_UNROLL_LOOP4(pdst,-4) \ - m--; \ - } \ - right \ - pdst += widthStep; \ - } \ -} -#else -# ifdef RROP_UNROLL -# define Expand(left,right,leftAdjust) {\ - int part = nmiddle & RROP_UNROLL_MASK; \ - int widthStep; \ - widthStep = widthDst - nmiddle - leftAdjust; \ - nmiddle >>= RROP_UNROLL_SHIFT; \ - pdst = pdstRect; \ - while (h--) { \ - left \ - pdst += part; \ - switch (part) { \ - RROP_UNROLL_CASE(pdst) \ - } \ - m = nmiddle; \ - while (m) { \ - pdst += RROP_UNROLL; \ - RROP_UNROLL_LOOP(pdst) \ - m--; \ - } \ - right \ - pdst += widthStep; \ - } \ -} - -# else -# define Expand(left, right, leftAdjust) { \ - while (h--) { \ - pdst = pdstRect; \ - left \ - m = nmiddle; \ - while (m--) {\ - RROP_SOLID(pdst); \ - pdst++; \ - } \ - right \ - pdstRect += widthDst; \ - } \ -} -# endif -#endif - - -void -RROP_NAME(cfbFillRectSolid) (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; - BoxPtr pBox; -{ - register int m; - register CfbBits *pdst; - RROP_DECLARE - CfbBits *pdstBase, *pdstRect; - int nmiddle; - int h; - int w; - int widthDst; -#if PSZ == 24 - int leftIndex, rightIndex; -#else - register CfbBits leftMask, rightMask; -#endif - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - RROP_FETCH_GC(pGC) - - for (; nBox; nBox--, pBox++) - { - pdstRect = pdstBase + pBox->y1 * widthDst; - h = pBox->y2 - pBox->y1; - w = pBox->x2 - pBox->x1; -#if PSZ == 8 - if (w == 1) - { - register char *pdstb = ((char *) pdstRect) + pBox->x1; - int incr = widthDst * PGSZB; - - while (h--) - { - RROP_SOLID (pdstb); - pdstb += incr; - } - } - else - { -#endif -#if PSZ == 24 - leftIndex = pBox->x1 &3; -/* rightIndex = ((leftIndex+w)<5)?0:pBox->x2 &3;*/ - rightIndex = pBox->x2 &3; - - nmiddle = w - rightIndex; - if(leftIndex){ - nmiddle -= (4 - leftIndex); - } - nmiddle >>= 2; - if(nmiddle < 0) - nmiddle = 0; - - pdstRect += (pBox->x1 * 3) >> 2; - pdst = pdstRect; - switch(leftIndex+w){ - case 4: - switch(leftIndex){ - case 0: - while(h--){ -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst-- = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst-- &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst-- |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst--; -#endif - pdst--; - pdst += widthDst; - } - break; - case 1: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst++ = piQxelXor[1]; - *pdst-- = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); - *pdst++ &= piQxelAnd[1]; - *pdst-- &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst++ |= piQxelOr[1]; - *pdst-- |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst--; -#endif - pdst--; - pdst += widthDst; - } - break; - case 2: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - pdst++; - *pdst-- = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); - *pdst-- ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF); - *pdst-- &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst-- |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst--; -#endif - pdst += widthDst; - } - break; - case 3: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXxor - *pdst ^= (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXand - *pdst &= (piQxelAnd[2] | 0xFF); -#endif -#if RROP == GXor - *pdst |= (piQxelOr[2] & 0xFFFFFF00); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); -#endif - pdst += widthDst; - } - break; - } - break; - case 3: - switch(leftIndex){ - case 0: - while(h--){ -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst-- &= (piQxeAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - pdst--; - pdst += widthDst; - } - break; - case 1: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst++ = piQxelXor[1]; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); - *pdst++ &= piQxelAnd[1]; - *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst++ |= piQxelOr[1]; - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - pdst--; - pdst += widthDst; - } - break; - case 2: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - pdst++; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF); - *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - pdst += widthDst; - } - break; - case 3: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXxor - *pdst ^= (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXand - *pdst &= (piQxelAnd[2] | 0xFF); -#endif -#if RROP == GXor - *pdst |= (piQxelOr[2] & 0xFFFFFF00); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); -#endif - pdst += widthDst; - } - break; - } - break; - case 2: /* leftIndex + w = 2*/ - switch(leftIndex){ - case 2: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - pdst++; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); - *pdst-- &= (piQxelAnd[2] | 0xFF); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - pdst += widthDst; - } - break; - case 1: - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst-- ^= (piQxelXor[1] & 0xFFFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); - *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst-- |= (piQxelOr[1] & 0xFFFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); - pdst--; -#endif - pdst += widthDst; - } - break; - case 0: /*case 2 leftIndex == 0 */ - while(h--){ -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst-- ^= (piQxelXor[1] & 0xFFFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst-- |= (piQxelOr[1] & 0xFFFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); - pdst--; -#endif - pdst += widthDst; - } - break; - } - break; - case 1: /*only if leftIndex = 0 and w = 1*/ - while(h--){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); -#endif -#if RROP == GXxor - *pdst ^= (piQxelXor[0] & 0xFFFFFF); -#endif -#if RROP == GXand - *pdst &= (piQxelAnd[0] | 0xFF000000); -#endif -#if RROP == GXor - *pdst |= (piQxelOr[0] & 0xFFFFFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); -#endif - pdst += widthDst; - } - break; - case 0: /*never*/ - break; - default: - { - while(h--){ - pdst = pdstRect; - switch(leftIndex){ - case 0: - break; - case 1: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst++ = piQxelXor[1]; - *pdst++ = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst++ ^= piQxelXor[1]; - *pdst++ ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); - *pdst++ &= piQxelAnd[1]; - *pdst++ &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst++ |= piQxelOr[1]; - *pdst++ |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst++; -#endif - break; - case 2: -#if RROP == GXcopy - *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000)); - pdst++; - *pdst++ = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^=(piQxelXor[1] & 0xFFFF0000); - *pdst++ ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF); - *pdst++ &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst++ |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst++; -#endif - break; - case 3: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[2] | 0xFF); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[2] & 0xFFFFFF00); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); - pdst++; -#endif - break; - } - m = nmiddle; - while(m--){ -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst++ = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst++ ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst++ &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst++ |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst++; -#endif - } - switch(rightIndex){ - case 0: - break; - case 1: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFFFFFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0xFF); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFFFFFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); - pdst++; -#endif - break; - case 2: -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= (piQxelXor[1] & 0xFFFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= (piQxelOr[1] & 0xFFFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); - pdst++; -#endif - break; - case 3: -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst++ ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst++ |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst++; -#endif - break; - } - pdstRect += widthDst; - } - } - } -#else /* PSZ != 24 */ - pdstRect += (pBox->x1 >> PWSH); - if ((pBox->x1 & PIM) + w <= PPW) - { - maskpartialbits(pBox->x1, w, leftMask); - pdst = pdstRect; - while (h--) { - RROP_SOLID_MASK (pdst, leftMask); - pdst += widthDst; - } - } - else - { - maskbits (pBox->x1, w, leftMask, rightMask, nmiddle); - if (leftMask) - { - if (rightMask) /* left mask and right mask */ - { - Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;, - RROP_SOLID_MASK (pdst, rightMask);, 1) - } - else /* left mask and no right mask */ - { - Expand(RROP_SOLID_MASK (pdst, leftMask); pdst++;, - ;, 1) - } - } - else - { - if (rightMask) /* no left mask and right mask */ - { - Expand(;, - RROP_SOLID_MASK (pdst, rightMask);, 0) - } - else /* no left mask and no right mask */ - { - Expand(;, - ;, 0) - } - } - } -#endif -#if PSZ == 8 - } -#endif - } - RROP_UNDECLARE -} - -void -RROP_NAME(cfbSolidSpans) (pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - CfbBits *pdstBase; - int widthDst; - - RROP_DECLARE - - register CfbBits *pdst; - register int nlmiddle; - register int w; - int x; - - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - int *pwidth; - cfbPrivGCPtr devPriv; -#if PSZ == 24 - int leftIndex, rightIndex; -#else - register CfbBits startmask, endmask; -#endif - - devPriv = cfbGetGCPrivate(pGC); - RROP_FETCH_GCPRIV(devPriv) - n = nInit * miFindMaxBand(pGC->pCompositeClip); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans(pGC->pCompositeClip, pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - while (n--) - { - x = ppt->x; - pdst = pdstBase + (ppt->y * widthDst); - ++ppt; - w = *pwidth++; - if (!w) - continue; -#if PSZ == 24 - leftIndex = x &3; -/* rightIndex = ((leftIndex+w)<5)?0:(x+w)&3;*/ - rightIndex = (x+w)&3; - - nlmiddle = w - rightIndex; - if(leftIndex){ - nlmiddle -= (4 - leftIndex); - } -/* nlmiddle += 3;*/ - nlmiddle >>= 2; - if(nlmiddle < 0) - nlmiddle = 0; - - pdst += (x >> 2)*3; - pdst += leftIndex? (leftIndex -1):0; - switch(leftIndex+w){ - case 4: - switch(leftIndex){ - case 0: -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst-- = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst-- &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst-- |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst--; -#endif - pdst--; - break; - case 1: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst++ = piQxelXor[1]; - *pdst-- = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); - *pdst++ &= piQxelAnd[1]; - *pdst-- &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst++ |= piQxelOr[1]; - *pdst-- |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst--; -#endif - pdst--; - break; - case 2: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - pdst++; - *pdst-- = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); - *pdst-- ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF); - *pdst-- &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst-- |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst--; -#endif - break; - case 3: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXxor - *pdst ^= (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXand - *pdst &= (piQxelAnd[2] | 0xFF); -#endif -#if RROP == GXor - *pdst |= (piQxelOr[2] & 0xFFFFFF00); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); -#endif - break; - } - break; - case 3: - switch(leftIndex){ - case 0: -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - pdst--; - break; - case 1: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst++ = piQxelXor[1]; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst++ ^= piQxelXor[1]; - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0x00FFFFFF); - *pdst++ &= piQxelAnd[1]; - *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst++ |= piQxelOr[1]; - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - pdst--; - break; - case 2: -/* pdst++;*/ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000); - pdst++; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[1] & 0xFFFF0000); - *pdst-- ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF); - *pdst-- &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst-- |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst--; -#endif - break; - } - break; - case 2: /* leftIndex + w = 2*/ - if(leftIndex){ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst-- ^= (piQxelXor[1] & 0xFFFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); - *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst-- |= (piQxelOr[1] & 0xFFFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); - pdst--; -#endif - } - else{ /*case 2 leftIndex === 0 */ -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - pdst--; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst-- ^= (piQxelXor[1] & 0xFFFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst-- &= (piQxelAnd[1] | 0xFFFF0000); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst-- |= (piQxelOr[1] & 0xFFFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); - pdst--; -#endif - } - break; - case 1: /*only if leftIndex = 0 and w = 1*/ -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); -#endif -#if RROP == GXxor - *pdst ^= (piQxelXor[0] & 0xFFFFFF); -#endif -#if RROP == GXand - *pdst &= (piQxelAnd[0] | 0xFF000000); -#endif -#if RROP == GXor - *pdst |= (piQxelOr[0] & 0xFFFFFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); -#endif - break; - case 0: /*never*/ - break; - default: - { - switch(leftIndex){ - case 0: - break; - case 1: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFFFFFF) | (piQxelXor[0] & 0xFF000000); - pdst++; - *pdst++ = piQxelXor[1]; - *pdst++ = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFF000000); - *pdst++ ^= piQxelXor[1]; - *pdst++ ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0xFFFFFF); - *pdst++ &= piQxelAnd[1]; - *pdst++ &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFF000000); - *pdst++ |= piQxelOr[1]; - *pdst++ |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFF000000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst++; -#endif - break; - case 2: -#if RROP == GXcopy - *pdst = (((*pdst) & 0xFFFF) | (piQxelXor[1] & 0xFFFF0000)); - pdst++; - *pdst++ = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^=(piQxelXor[1] & 0xFFFF0000); - *pdst++ ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[1] | 0xFFFF); - *pdst++ &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[1] & 0xFFFF0000); - *pdst++ |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF0000); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst++; -#endif - break; - case 3: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF) | (piQxelXor[2] & 0xFFFFFF00); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[2] & 0xFFFFFF00); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[2] | 0xFF); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[2] & 0xFFFFFF00); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFFFFFF00); - pdst++; -#endif - break; - } - while(nlmiddle--){ -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst++ = piQxelXor[2]; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst++ ^= piQxelXor[2]; -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst++ &= piQxelAnd[2]; -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst++ |= piQxelOr[2]; -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[2], piQxelXor[2]); - pdst++; -#endif - } - switch(rightIndex){ - case 0: - break; - case 1: -#if RROP == GXcopy - *pdst = ((*pdst) & 0xFF000000) | (piQxelXor[0] & 0xFFFFFF); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= (piQxelXor[0] & 0xFFFFFF); -#endif -#if RROP == GXand - *pdst++ &= (piQxelAnd[0] | 0xFF); -#endif -#if RROP == GXor - *pdst++ |= (piQxelOr[0] & 0xFFFFFF); -#endif -#if RROP == GXset - *pdst = DoMaskRRop((*pdst), piQxelAnd[0], piQxelXor[0], 0xFFFFFF); -#endif - break; - case 2: -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst = ((*pdst) & 0xFFFF0000) | (piQxelXor[1] & 0xFFFF); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= (piQxelXor[1] & 0xFFFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= (piQxelAnd[1] | 0xFFFF0000); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= (piQxelOr[1] & 0xFFFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[1], piQxelXor[1], 0xFFFF); - pdst++; -#endif - break; - case 3: -#if RROP == GXcopy - *pdst++ = piQxelXor[0]; - *pdst++ = piQxelXor[1]; - *pdst = ((*pdst) & 0xFFFFFF00) | (piQxelXor[2] & 0xFF); - pdst++; -#endif -#if RROP == GXxor - *pdst++ ^= piQxelXor[0]; - *pdst++ ^= piQxelXor[1]; - *pdst++ ^= (piQxelXor[2] & 0xFF); -#endif -#if RROP == GXand - *pdst++ &= piQxelAnd[0]; - *pdst++ &= piQxelAnd[1]; - *pdst++ &= (piQxelAnd[2] | 0xFFFFFF00); -#endif -#if RROP == GXor - *pdst++ |= piQxelOr[0]; - *pdst++ |= piQxelOr[1]; - *pdst++ |= (piQxelOr[2] & 0xFF); -#endif -#if RROP == GXset - *pdst = DoRRop((*pdst), piQxelAnd[0], piQxelXor[0]); - pdst++; - *pdst = DoRRop((*pdst), piQxelAnd[1], piQxelXor[1]); - pdst++; - *pdst = DoMaskRRop((*pdst), piQxelAnd[2], piQxelXor[2], 0xFF); - pdst++; -#endif - break; - } - } -} -#else -#if PSZ == 8 - if (w <= PGSZB) - { - register char *addrb; - - addrb = ((char *) pdst) + x; - while (w--) - { - RROP_SOLID (addrb); - addrb++; - } - } -#else - if ((x & PIM) + w <= PPW) - { - pdst += x >> PWSH; - maskpartialbits (x, w, startmask); - RROP_SOLID_MASK (pdst, startmask); - } -#endif - else - { - pdst += x >> PWSH; - maskbits (x, w, startmask, endmask, nlmiddle); - if (startmask) - { - RROP_SOLID_MASK (pdst, startmask); - ++pdst; - } - - RROP_SPAN(pdst,nlmiddle) - if (endmask) - { - RROP_SOLID_MASK (pdst, endmask); - } - } -#endif - } - xfree(pptFree); - xfree(pwidthFree); - RROP_UNDECLARE -} diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c deleted file mode 100644 index 9d4ce5708..000000000 --- a/cfb/cfbteblt8.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * TEGblt - ImageText expanded glyph fonts only. For - * 8 bit displays, in Copy mode with no clipping. - */ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#if PSZ == 8 - -#include -#include -#include -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -/* - * this code supports up to 5 characters at a time. The performance - * differences between 4 and 5 is usually small (~7% on PMAX) and - * frequently negative (SPARC and Sun3), so this file is compiled - * only once for now. If you want to use the other options, you'll - * need to hack cfbgc.c as well. - */ - -#ifndef NGLYPHS -#define NGLYPHS 4 -#define DO_COMMON -#endif - -#ifdef DO_COMMON -#define CFBTEGBLT8 cfbTEGlyphBlt8 -#endif - -/* - * On little-endian machines (or where fonts are padded to 32-bit - * boundaries) we can use some magic to avoid the expense of getleftbits - */ - -#if ((BITMAP_BIT_ORDER == LSBFirst && NGLYPHS >= 4) || GLYPHPADBYTES == 4) - -#if GLYPHPADBYTES == 1 -typedef unsigned char *glyphPointer; -#define USE_LEFTBITS -#endif - -#if GLYPHPADBYTES == 2 -typedef unsigned short *glyphPointer; -#define USE_LEFTBITS -#endif - -#if GLYPHPADBYTES == 4 -typedef unsigned int *glyphPointer; -#endif - -#define GetBitsL c = BitLeft (*leftChar++, lshift) -#define NGetBits1S(r) c = BitRight(*char1++ r, xoff1) -#define NGetBits1L(r) GetBitsL | BitRight(*char1++ r, xoff1) -#define NGetBits1U(r) c = *char1++ r -#define NGetBits2S(r) NGetBits1S(| BitRight(*char2++ r, widthGlyph)) -#define NGetBits2L(r) NGetBits1L(| BitRight(*char2++ r, widthGlyph)) -#define NGetBits2U(r) NGetBits1U(| BitRight(*char2++ r, widthGlyph)) -#define NGetBits3S(r) NGetBits2S(| BitRight(*char3++ r, widthGlyph)) -#define NGetBits3L(r) NGetBits2L(| BitRight(*char3++ r, widthGlyph)) -#define NGetBits3U(r) NGetBits2U(| BitRight(*char3++ r, widthGlyph)) -#define NGetBits4S(r) NGetBits3S(| BitRight(*char4++ r, widthGlyph)) -#define NGetBits4L(r) NGetBits3L(| BitRight(*char4++ r, widthGlyph)) -#define NGetBits4U(r) NGetBits3U(| BitRight(*char4++ r, widthGlyph)) -#define NGetBits5S(r) NGetBits4S(| BitRight(*char5++ r, widthGlyph)) -#define NGetBits5L(r) NGetBits4L(| BitRight(*char5++ r, widthGlyph)) -#define NGetBits5U(r) NGetBits4U(| BitRight(*char5++ r, widthGlyph)) -#define GetBits1S c = BitRight(*char1++, xoff1) -#define GetBits1L GetBitsL | BitRight(*char1++, xoff1) -#define GetBits1U c = *char1++ -#define GetBits2S NGetBits1S(| BitRight(*char2++, widthGlyph)) -#define GetBits2L NGetBits1L(| BitRight(*char2++, widthGlyph)) -#define GetBits2U NGetBits1U(| BitRight(*char2++, widthGlyph)) -#define GetBits3S NGetBits2S(| BitRight(*char3++, widthGlyph)) -#define GetBits3L NGetBits2L(| BitRight(*char3++, widthGlyph)) -#define GetBits3U NGetBits2U(| BitRight(*char3++, widthGlyph)) -#define GetBits4S NGetBits3S(| BitRight(*char4++, widthGlyph)) -#define GetBits4L NGetBits3L(| BitRight(*char4++, widthGlyph)) -#define GetBits4U NGetBits3U(| BitRight(*char4++, widthGlyph)) -#define GetBits5S NGetBits4S(| BitRight(*char5++, widthGlyph)) -#define GetBits5L NGetBits4L(| BitRight(*char5++, widthGlyph)) -#define GetBits5U NGetBits4U(| BitRight(*char5++, widthGlyph)) - -#else - -typedef unsigned int *glyphPointer; - -#define USE_LEFTBITS -#define ALL_LEFTBITS - -#define GetBitsL WGetBitsL -#define GetBits1S WGetBits1S -#define GetBits1L WGetBits1L -#define GetBits1U WGetBits1U - -#define GetBits2S GetBits1S Get1Bits (char2, tmpSrc) \ - c |= BitRight(tmpSrc, xoff2); -#define GetBits2L GetBits1L Get1Bits (char2, tmpSrc) \ - c |= BitRight(tmpSrc, xoff2); -#define GetBits2U GetBits1U Get1Bits (char2, tmpSrc) \ - c |= BitRight(tmpSrc, xoff2); - -#define GetBits3S GetBits2S Get1Bits (char3, tmpSrc) \ - c |= BitRight(tmpSrc, xoff3); -#define GetBits3L GetBits2L Get1Bits (char3, tmpSrc) \ - c |= BitRight(tmpSrc, xoff3); -#define GetBits3U GetBits2U Get1Bits (char3, tmpSrc) \ - c |= BitRight(tmpSrc, xoff3); - -#define GetBits4S GetBits3S Get1Bits (char4, tmpSrc) \ - c |= BitRight(tmpSrc, xoff4); -#define GetBits4L GetBits3L Get1Bits (char4, tmpSrc) \ - c |= BitRight(tmpSrc, xoff4); -#define GetBits4U GetBits3U Get1Bits (char4, tmpSrc) \ - c |= BitRight(tmpSrc, xoff4); - -#define GetBits5S GetBits4S Get1Bits (char5, tmpSrc) \ - c |= BitRight(tmpSrc, xoff5); -#define GetBits5L GetBits4L Get1Bits (char5, tmpSrc) \ - c |= BitRight(tmpSrc, xoff5); -#define GetBits5U GetBits4U Get1Bits (char5, tmpSrc) \ - c |= BitRight(tmpSrc, xoff5); - -#endif - -#ifdef USE_LEFTBITS - -#define IncChar(c) (c = (glyphPointer) (((char *) c) + glyphBytes)) - -#define Get1Bits(ch,dst) glyphbits (ch, widthGlyph, glyphMask, dst); \ - IncChar (ch); - -#define glyphbits(bits,width,mask,dst) getleftbits(bits,width,dst); \ - dst &= mask; - -#define WGetBitsL Get1Bits(leftChar,c); \ - c = BitLeft (c, lshift); -#define WGetBits1S Get1Bits (char1, c) \ - c = BitRight (c, xoff1); -#define WGetBits1L WGetBitsL Get1Bits (char1, tmpSrc) \ - c |= BitRight (tmpSrc, xoff1); -#define WGetBits1U Get1Bits (char1, c) - -#else -#define WGetBitsL GetBitsL -#define WGetBits1S GetBits1S -#define WGetBits1L GetBits1L -#define WGetBits1U GetBits1U -#endif - -#if NGLYPHS == 2 -# define GetBitsNS GetBits2S -# define GetBitsNL GetBits2L -# define GetBitsNU GetBits2U -# define LastChar char2 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 cfbTEGlyphBlt8x2 -#endif -#endif -#if NGLYPHS == 3 -# define GetBitsNS GetBits3S -# define GetBitsNL GetBits3L -# define GetBitsNU GetBits3U -# define LastChar char3 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 cfbTEGlyphBlt8x3 -#endif -#endif -#if NGLYPHS == 4 -# define GetBitsNS GetBits4S -# define GetBitsNL GetBits4L -# define GetBitsNU GetBits4U -# define LastChar char4 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 cfbTEGlyphBlt8x4 -#endif -#endif -#if NGLYPHS == 5 -# define GetBitsNS GetBits5S -# define GetBitsNL GetBits5L -# define GetBitsNU GetBits5U -# define LastChar char5 -#ifndef CFBTEGBLT8 -# define CFBTEGBLT8 cfbTEGlyphBlt8x5 -#endif -#endif - -/* another ugly giant macro */ -#define SwitchEm switch (ew) \ - { \ - case 0: \ - break; \ - case 1: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 \ - Loop \ - } \ - break; \ - case 2: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) \ - Loop \ - } \ - break; \ - case 3: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step StoreBits(2) \ - Loop \ - } \ - break; \ - case 4: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) \ - Loop \ - } \ - break; \ - case 5: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) \ - Loop \ - } \ - break; \ - case 6: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) \ - Loop \ - } \ - break; \ - case 7: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) Step \ - StoreBits(6) \ - Loop \ - } \ - break; \ - case 8: \ - while (hTmp--) { \ - GetBits; \ - StoreBits0 FirstStep StoreBits(1) Step \ - StoreBits(2) Step StoreBits(3) Step \ - StoreBits(4) Step StoreBits(5) Step \ - StoreBits(6) Step StoreBits(7) \ - Loop \ - } \ - break; \ - } - -#ifdef FAST_CONSTANT_OFFSET_MODE -#define StorePixels(o,p) dst[o] = p -#define Loop dst += widthDst; -#else -#define StorePixels(o,p) do { *dst = (p); dst++; } while (0) -#define Loop dst += widthLeft; -#endif - -#define Step NextBitGroup(c); - -#if (BITMAP_BIT_ORDER == MSBFirst) -#define StoreBits(o) StorePixels(o,GetPixelGroup(c)); -#define FirstStep Step -#else -#if PGSZ == 64 -#define StoreBits(o) StorePixels(o,cfb8Pixels[(c) & PGSZBMSK]); -#define FirstStep Step -#else /* PGSZ == 32 */ -#define StoreBits(o) StorePixels(o,*((CfbBits *) (((char *) cfb8Pixels) + (c & 0x3c)))); -#define FirstStep c = BitLeft (c, 2); -#endif /* PGSZ */ -#endif /* BITMAP_BIT_ORDER */ - - -void -CFBTEGBLT8 (pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GC *pGC; - int xInit, yInit; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs */ -{ - register CfbBits c; - register CfbBits *dst; - register CfbBits leftMask, rightMask; - register int hTmp; - register int xoff1; - register glyphPointer char1; - register glyphPointer char2; -#if NGLYPHS >= 3 - register glyphPointer char3; -#endif -#if NGLYPHS >= 4 - register glyphPointer char4; -#endif -#if NGLYPHS >= 5 - register glyphPointer char5; -#endif -#ifdef ALL_LEFTBITS - int xoff2, xoff3, xoff4, xoff5; -#endif - - FontPtr pfont = pGC->font; - CfbBits *dstLine; - glyphPointer oldRightChar; - CfbBits *pdstBase; - glyphPointer leftChar; - int widthDst; -#ifndef FAST_CONSTANT_OFFSET_MODE - int widthLeft; -#endif - int widthGlyph; - int h; - int ew; - int x, y; - BoxRec bbox; /* for clipping */ - int lshift; - int widthGlyphs; -#ifdef USE_LEFTBITS - register CfbBits glyphMask; - register CfbBits tmpSrc; - register int glyphBytes; -#endif - - widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - if (!h) - return; - 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, cfbGetCompositeClip(pGC), &bbox)) - { - case rgnPART: - cfbImageGlyphBlt8(pDrawable, pGC, xInit, yInit, nglyph, ppci, pglyphBase); - case rgnOUT: - return; - } - - if (!cfb8CheckPixels (pGC->fgPixel, pGC->bgPixel)) - cfb8SetPixels (pGC->fgPixel, pGC->bgPixel); - - leftChar = 0; - - cfbGetLongWidthAndPointer(pDrawable, widthDst, pdstBase) - -#if NGLYPHS == 2 - widthGlyphs = widthGlyph << 1; -#else -#if NGLYPHS == 4 - widthGlyphs = widthGlyph << 2; -#else - widthGlyphs = widthGlyph * NGLYPHS; -#endif -#endif - -#ifdef USE_LEFTBITS - glyphMask = mfbGetendtab(widthGlyph); - glyphBytes = GLYPHWIDTHBYTESPADDED(*ppci); -#endif - - pdstBase += y * widthDst; -#ifdef DO_COMMON - if (widthGlyphs <= 32) -#endif - while (nglyph >= NGLYPHS) - { - nglyph -= NGLYPHS; - hTmp = h; - dstLine = pdstBase + (x >> PWSH); - xoff1 = x & PIM; - char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - char2 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); -#ifdef ALL_LEFTBITS - xoff2 = xoff1 + widthGlyph; -#endif -#if NGLYPHS >= 3 - char3 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); -#ifdef ALL_LEFTBITS - xoff3 = xoff2 + widthGlyph; -#endif -#endif -#if NGLYPHS >= 4 - char4 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); -#ifdef ALL_LEFTBITS - xoff4 = xoff3 + widthGlyph; -#endif -#endif -#if NGLYPHS >= 5 - char5 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); -#ifdef ALL_LEFTBITS - xoff5 = xoff4 + widthGlyph; -#endif -#endif - oldRightChar = LastChar; - dst = dstLine; - if (xoff1) - { - ew = ((widthGlyphs - (PGSZB - xoff1)) >> PWSH) + 1; -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - if (!leftChar) - { - leftMask = cfbendtab[xoff1]; - rightMask = cfbstarttab[xoff1]; - -#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \ - (GetPixelGroup(c) & rightMask)); -#define GetBits GetBitsNS - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - else - { - lshift = widthGlyph - xoff1; - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits GetBitsNL - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - } - else - { -#if NGLYPHS == 4 && PGSZ == 32 - ew = widthGlyph; /* widthGlyphs >> 2 */ -#else - ew = widthGlyphs >> PWSH; -#endif -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits GetBitsNU - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - x += widthGlyphs; - leftChar = oldRightChar; - } - while (nglyph--) - { - xoff1 = x & PIM; - char1 = (glyphPointer) FONTGLYPHBITS(pglyphBase, *ppci++); - hTmp = h; - dstLine = pdstBase + (x >> PWSH); - oldRightChar = char1; - dst = dstLine; - if (xoff1) - { - ew = ((widthGlyph - (PGSZB - xoff1)) >> PWSH) + 1; -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - if (!leftChar) - { - leftMask = cfbendtab[xoff1]; - rightMask = cfbstarttab[xoff1]; - -#define StoreBits0 StorePixels (0, (dst[0] & leftMask) | \ - (GetPixelGroup(c) & rightMask)); -#define GetBits WGetBits1S - - SwitchEm -#undef GetBits -#undef StoreBits0 - - } - else - { - lshift = widthGlyph - xoff1; - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits WGetBits1L - - SwitchEm -#undef GetBits -#undef StoreBits0 - - } - } - else - { - ew = widthGlyph >> PWSH; - -#ifndef FAST_CONSTANT_OFFSET_MODE - widthLeft = widthDst - ew; -#endif - -#define StoreBits0 StorePixels (0,GetPixelGroup(c)); -#define GetBits WGetBits1U - - SwitchEm - -#undef GetBits -#undef StoreBits0 - - } - x += widthGlyph; - leftChar = oldRightChar; - } - /* - * draw the tail of the last character - */ - xoff1 = x & PIM; - if (xoff1) - { - rightMask = cfbstarttab[xoff1]; - leftMask = cfbendtab[xoff1]; - lshift = widthGlyph - xoff1; - dst = pdstBase + (x >> PWSH); - hTmp = h; - while (hTmp--) - { - GetBitsL; - *dst = (*dst & rightMask) | (GetPixelGroup(c) & leftMask); - dst += widthDst; - } - } -} -#endif /* PSZ == 8 */ diff --git a/cfb/cfbtegblt.c b/cfb/cfbtegblt.c deleted file mode 100644 index f04ee3faf..000000000 --- a/cfb/cfbtegblt.c +++ /dev/null @@ -1,218 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#include "cfbmskbits.h" -#include "mi.h" -#define MFB_CONSTS_ONLY -#include "maskbits.h" - -/* - this works for fonts with glyphs <= 32 bits wide, on an - arbitrarily deep display. Use cfbTEGlyphBlt8 for 8 bit displays. - - This should be called only with a terminal-emulator font; -this means that the FIXED_METRICS flag is set, and that -glyphbounds == charbounds. - - in theory, this goes faster; even if it doesn't, it reduces the -flicker caused by writing a string over itself with image text (since -the background gets repainted per character instead of per string.) -this seems to be important for some converted X10 applications. - - Image text looks at the bits in the glyph and the fg and bg in the -GC. it paints a rectangle, as defined in the protocol dcoument, -and the paints the characters. - -*/ - -void -cfbTEGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) - DrawablePtr pDrawable; - GC *pGC; - int x, y; - unsigned int nglyph; - CharInfoPtr *ppci; /* array of character info */ - pointer pglyphBase; /* start of array of glyphs */ -{ - FontPtr pfont = pGC->font; - int widthDst; - CfbBits *pdstBase; /* pointer to longword with top row - of current glyph */ - - int w; /* width of glyph and char */ - int h; /* height of glyph and char */ - register int xpos=x; /* current x%32 */ - int ypos=y; /* current y%32 */ - register unsigned char *pglyph; - int widthGlyph; - - register CfbBits *pdst;/* pointer to current longword in dst */ - int hTmp; /* counter for height */ - BoxRec bbox; /* for clipping */ - - register int wtmp,xtemp,width; - CfbBits bgfill,fgfill,*ptemp,tmpDst1,tmpDst2,*pdtmp; -#if PSZ != 24 - int tmpx; -#endif - - xpos += pDrawable->x; - ypos += pDrawable->y; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - wtmp = FONTMAXBOUNDS(pfont,characterWidth); - h = FONTASCENT(pfont) + FONTDESCENT(pfont); - widthGlyph = GLYPHWIDTHBYTESPADDED(*ppci); - - xpos += FONTMAXBOUNDS(pfont,leftSideBearing); - ypos -= FONTASCENT(pfont); - - bbox.x1 = xpos; - bbox.x2 = xpos + (wtmp * nglyph); - bbox.y1 = ypos; - bbox.y2 = ypos + h; - - fgfill = PFILL(pGC->fgPixel); - bgfill = PFILL(pGC->bgPixel); - - switch (RECT_IN_REGION(pGC->pScreen, cfbGetCompositeClip(pGC), &bbox)) - { - case rgnOUT: - break; - case rgnPART: - /* this is the WRONG thing to do, but it works. - calling the non-terminal text is easy, but slow, given - what we know about the font. - - the right thing to do is something like: - for each clip rectangle - compute at which row the glyph starts to be in it, - and at which row the glyph ceases to be in it - compute which is the first glyph inside the left - edge, and the last one inside the right edge - draw a fractional first glyph, using only - the rows we know are in - draw all the whole glyphs, using the appropriate rows - draw any pieces of the last glyph, using the right rows - - this way, the code would take advantage of knowing that - all glyphs are the same height and don't overlap. - - one day... - */ - cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); - break; - case rgnIN: - - pdtmp = pdstBase + (widthDst * ypos); - while(nglyph--) - { - - pglyph = FONTGLYPHBITS(pglyphBase, *ppci++); - pdst = pdtmp; - hTmp = h; - - while (hTmp--) - { - x = xpos; - width = wtmp; - xtemp = 0; - - while (width > 0) - { -#if PSZ == 24 - w = 1; - ptemp = (CfbBits *)(pglyph + ((xtemp *3)>> 2)); - getstipplepixels24(ptemp,xtemp,0,&bgfill,&tmpDst1, xtemp); - getstipplepixels24(ptemp,xtemp,1,&fgfill,&tmpDst2, xtemp); -#else - tmpx = x & PIM; - w = min(width, PPW - tmpx); - w = min(w, (PGSZ - xtemp)); - ptemp = (CfbBits *)(pglyph + (xtemp >> MFB_PWSH)); - getstipplepixels(ptemp,xtemp,w,0,&bgfill,&tmpDst1); - getstipplepixels(ptemp,xtemp,w,1,&fgfill,&tmpDst2); -#endif - - { - CfbBits tmpDst = tmpDst1 | tmpDst2; -#if PSZ == 24 - CfbBits *pdsttmp = pdst + ((x*3) >> 2); - putbits24(tmpDst,w,pdsttmp,pGC->planemask,x); -#else - CfbBits *pdsttmp = pdst + (x >> PWSH); - putbits(tmpDst,tmpx,w,pdsttmp,pGC->planemask); -#endif - } - x += w; - xtemp += w; - width -= w; - } - pglyph += widthGlyph; - pdst += widthDst; - } - xpos += wtmp; - } - break; - } -} diff --git a/cfb/cfbtile32.c b/cfb/cfbtile32.c deleted file mode 100644 index be016a70a..000000000 --- a/cfb/cfbtile32.c +++ /dev/null @@ -1,517 +0,0 @@ -/* - * Fill 32 bit tiled rectangles. Used by PolyFillRect. - * no depth dependencies. - */ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -#include "mergerop.h" - -#include "mi.h" -#include "mispans.h" - -#ifdef sparc -#define SHARED_IDCACHE -#endif - -#if PSZ == 24 -#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) -/*#define STORE24(p,index) {\ - register int idx = ((index) & 3)<< 1; \ - *(p) = (((MROP_PREBUILT_SOLID(srcpix,*(p))<>cfb24Shift[idx])&cfbmask[idx])| \ - (*(p)&cfbrmask[idx])); \ - (p)--; \ - }*/ -#define STORE24(p,index) MROP_PREBUILT_SOLID24(srcpix, (p), index) - -#define STORE_MASK(p,mask) (*(p) = MROP_PREBUILT_MASK(srcpix,*(p),(mask))) -#define QSTORE(p) ((*(p) = MROP_PREBUILT_SOLID(((srcpix<<24)|srcpix),*(p))), \ - (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<16)|(srcpix>>8)),*(p))), \ - (p)++,(*(p) = MROP_PREBUILT_SOLID(((srcpix<<8)|(srcpix>>16)),*(p)))) - -#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) -# define Expand(left,right) {\ - int part = nlwMiddle & ((PGSZB*2)-1); \ - nlwMiddle *= 3; \ - nlwMiddle >>= PWSH + 3; \ - while (h--) { \ - srcpix = psrc[srcy]; \ - MROP_PREBUILD(srcpix); \ - ++srcy; \ - if (srcy == tileHeight) \ - srcy = 0; \ - left \ - p += part; \ - switch (part) { \ - case 7: \ - STORE24(p - 7, xtmp - 7); \ - case 6: \ - STORE24(p - 6, xtmp - 6); \ - case 5: \ - STORE24(p - 5, xtmp - 5); \ - case 4: \ - STORE24(p - 4, xtmp - 4); \ - case 3: \ - STORE24(p - 3, xtmp - 3); \ - case 2: \ - STORE24(p - 2, xtmp - 2); \ - case 1: \ - STORE24(p - 1, xtmp - 1); \ - } \ - nlw = nlwMiddle; \ - while (nlw) { \ - STORE24 (p + 0, xtmp + 0); \ - STORE24 (p + 1, xtmp + 1); \ - STORE24 (p + 2, xtmp + 2); \ - STORE24 (p + 3, xtmp + 3); \ - STORE24 (p + 4, xtmp + 4); \ - STORE24 (p + 5, xtmp + 5); \ - STORE24 (p + 6, xtmp + 6); \ - STORE24 (p + 7, xtmp + 7); \ - p += 8; \ - xtmp += 8; \ - nlw--; \ - } \ - right \ - p += nlwExtra; \ - } \ -} -#else -#define Expand(left,right) {\ - while (h--) { \ - srcpix = psrc[srcy]; \ - MROP_PREBUILD(srcpix); \ - ++srcy; \ - if (srcy == tileHeight) \ - srcy = 0; \ - left \ - while (nlw--) \ - { \ - STORE24(p,xtmp); \ - if(xtmp&3) p++; \ - xtmp++; \ - } \ - right \ - p += nlwExtra; \ - } \ -} -#endif -#else /*PSZ != 24*/ -#define STORE(p) (*(p) = MROP_PREBUILT_SOLID(srcpix,*(p))) - -#if (MROP == Mcopy) && defined(FAST_CONSTANT_OFFSET_MODE) && defined(SHARED_IDCACHE) -# define Expand(left,right) {\ - int part = nlwMiddle & ((PGSZB*2)-1); \ - nlwMiddle >>= PWSH + 1; \ - while (h--) { \ - srcpix = psrc[srcy]; \ - MROP_PREBUILD(srcpix); \ - ++srcy; \ - if (srcy == tileHeight) \ - srcy = 0; \ - left \ - p += part; \ - switch (part) { \ - case 7: \ - STORE(p - 7); \ - case 6: \ - STORE(p - 6); \ - case 5: \ - STORE(p - 5); \ - case 4: \ - STORE(p - 4); \ - case 3: \ - STORE(p - 3); \ - case 2: \ - STORE(p - 2); \ - case 1: \ - STORE(p - 1); \ - } \ - nlw = nlwMiddle; \ - while (nlw) { \ - STORE (p + 0); \ - STORE (p + 1); \ - STORE (p + 2); \ - STORE (p + 3); \ - STORE (p + 4); \ - STORE (p + 5); \ - STORE (p + 6); \ - STORE (p + 7); \ - p += 8; \ - nlw--; \ - } \ - right \ - p += nlwExtra; \ - } \ -} -#else -#define Expand(left,right) {\ - while (h--) { \ - srcpix = psrc[srcy]; \ - MROP_PREBUILD(srcpix); \ - ++srcy; \ - if (srcy == tileHeight) \ - srcy = 0; \ - left \ - nlw = nlwMiddle; \ - while (nlw--) \ - { \ - STORE(p); \ - p++; \ - } \ - right \ - p += nlwExtra; \ - } \ -} -#endif -#endif /*PSZ == 24*/ - -void -MROP_NAME(cfbFillRectTile32) (pDrawable, pGC, nBox, pBox) - DrawablePtr pDrawable; - GCPtr pGC; - int nBox; /* number of boxes to fill */ - BoxPtr pBox; /* pointer to list of boxes to fill */ -{ - register CfbBits srcpix; - CfbBits *psrc; /* pointer to bits in tile, if needed */ - int tileHeight; /* height of the tile */ - - int nlwDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - register int h; /* height of current box */ - register CfbBits startmask; - register CfbBits endmask; /* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwExtra; /* to get from right of box to left of next span */ - register int nlw = 0; /* loop version of nlwMiddle */ - register CfbBits *p; /* pointer to bits we're writing */ - int y; /* current scan line */ - int srcy; /* current tile position */ - - CfbBits *pbits;/* pointer to start of pixmap */ - PixmapPtr tile; /* rotated, expanded tile */ -#if MROP == 0 && PSZ == 24 - DeclareMergeRop() -#else - MROP_DECLARE_REG() -#endif - MROP_PREBUILT_DECLARE() -#if PSZ == 24 - CfbBits xtmp; -#endif - - tile = pGC->pRotatedPixmap; - tileHeight = tile->drawable.height; - psrc = (CfbBits *)tile->devPrivate.ptr; - -#if MROP == 0 && PSZ == 24 - InitializeMergeRop(pGC->alu, pGC->planemask); -#else - MROP_INITIALIZE(pGC->alu, pGC->planemask); -#endif - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - y = pBox->y1; -#if PSZ == 24 - xtmp = pBox->x1; - p = pbits + (y * nlwDst) + ((pBox->x1*3) >> 2); -/* p = pbits + (y * nlwDst) + ((pBox->x1>> 2)*3);*/ -#else - p = pbits + (y * nlwDst) + (pBox->x1 >> PWSH); -#endif - srcy = y % tileHeight; - -#if PSZ == 24 - if (w == 1 && ((pBox->x1 & 3) == 0 || (pBox->x1 & 3) == 3)) -#else - if ( ((pBox->x1 & PIM) + w) <= PPW) -#endif - { - maskpartialbits(pBox->x1, w, startmask); - nlwExtra = nlwDst; - while (h--) - { - srcpix = psrc[srcy]; - MROP_PREBUILD(srcpix); - ++srcy; - if (srcy == tileHeight) - srcy = 0; - *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); - p += nlwExtra; - } - } - else - { - maskbits(pBox->x1, w, startmask, endmask, nlwMiddle); - nlwExtra = nlwDst - nlwMiddle; - - if (startmask) - { - nlwExtra -= 1; - if (endmask) - { - Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;, - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);) - } - else - { - Expand(*p = MROP_PREBUILT_MASK(srcpix, *p, startmask); p++;, - ;) - } - } - else - { - if (endmask) - { - Expand(;, - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask);) - } - else - { - Expand(;, - ;) - } - } - } - pBox++; - } -} - -void -MROP_NAME(cfbTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) - DrawablePtr pDrawable; - GCPtr pGC; - int nInit; /* number of spans to fill */ - DDXPointPtr pptInit; /* pointer to list of start points */ - int *pwidthInit; /* pointer to list of n widths */ - int fSorted; -{ - /* next three parameters are post-clip */ - int n; /* number of spans to fill */ - DDXPointPtr ppt; /* pointer to list of start points */ - int *pwidth;/* pointer to list of n widths */ - CfbBits *pbits; /* pointer to start of bitmap */ - int nlwDst; /* width in longwords of bitmap */ - register CfbBits *p; /* pointer to current longword in bitmap */ - register int w; /* current span width */ - register int nlw; - register int x; - register CfbBits startmask; - register CfbBits endmask; - register CfbBits srcpix; - int y; - int *pwidthFree;/* copies of the pointers to free */ - DDXPointPtr pptFree; - PixmapPtr tile; - CfbBits *psrc; /* pointer to bits in tile */ - int tileHeight;/* height of the tile */ -#if MROP == 0 && PSZ == 24 - DeclareMergeRop() -#else - MROP_DECLARE_REG() -#endif - MROP_PREBUILT_DECLARE() -#if PSZ == 24 - CfbBits xtmp; -#endif - - n = nInit * miFindMaxBand( cfbGetCompositeClip(pGC) ); - pwidthFree = (int *)xalloc(n * sizeof(int)); - pptFree = (DDXPointRec *)xalloc(n * sizeof(DDXPointRec)); - if(!pptFree || !pwidthFree) - { - if (pptFree) xfree(pptFree); - if (pwidthFree) xfree(pwidthFree); - return; - } - pwidth = pwidthFree; - ppt = pptFree; - n = miClipSpans( cfbGetCompositeClip(pGC), - pptInit, pwidthInit, nInit, - ppt, pwidth, fSorted); - - tile = pGC->pRotatedPixmap; - tileHeight = tile->drawable.height; - psrc = (CfbBits *)tile->devPrivate.ptr; - -#if MROP == 0 && PSZ == 24 - InitializeMergeRop(pGC->alu, pGC->planemask); -#else - MROP_INITIALIZE(pGC->alu, pGC->planemask); -#endif - - cfbGetLongWidthAndPointer (pDrawable, nlwDst, pbits) - -#if MROP == Mcopy - if (!(tileHeight & (tileHeight-1))) - { - tileHeight--; - while (n--) - { - x = ppt->x; - y = ppt->y; - ++ppt; - w = *pwidth++; -#if PSZ == 24 -/* p = pbits + (y * nlwDst) + ((x*3) >> 2);*/ - xtmp = x; - p = pbits + (y * nlwDst) + ((x >> 2)*3); -#else - p = pbits + (y * nlwDst) + (x >> PWSH); -#endif - srcpix = psrc[y & tileHeight]; - MROP_PREBUILD(srcpix); - -#if PSZ == 24 - if ((x & 3) + w < 5) -#else - if ((x & PIM) + w < PPW) -#endif - { - maskpartialbits(x, w, startmask); - *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); - } - else - { - maskbits(x, w, startmask, endmask, nlw); - if (startmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); -#if PSZ == 24 - if(xtmp&3) p++; - xtmp++; -#else - p++; -#endif - } - while (nlw--) - { -#if PSZ == 24 - STORE24(p,xtmp); - if(xtmp&3) p++; - ++xtmp; -#else - STORE(p); - ++p; -#endif - } - if (endmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask); - } - } - } - } - else -#endif - { - while (n--) - { - x = ppt->x; - y = ppt->y; - ++ppt; - w = *pwidth++; -#if PSZ == 24 -/* p = pbits + (y * nlwDst) + ((x *3)>> 2);*/ - p = pbits + (y * nlwDst) + ((x >> 2)*3); - xtmp = x; -#else - p = pbits + (y * nlwDst) + (x >> PWSH); -#endif - srcpix = psrc[y % tileHeight]; - MROP_PREBUILD(srcpix); - -#if PSZ == 24 - if ((x & 3) + w < 5) -#else - if ((x & PIM) + w < PPW) -#endif - { - maskpartialbits(x, w, startmask); - *p = MROP_PREBUILT_MASK (srcpix, *p, startmask); - } - else - { - maskbits(x, w, startmask, endmask, nlw); - if (startmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, startmask); -#if PSZ == 24 - if(xtmp&3)p++; - xtmp++; -#else - p++; -#endif - } - while (nlw--) - { -#if PSZ == 24 - STORE24(p,xtmp); - if(xtmp&3)p++; - xtmp++; -#else - STORE(p); - ++p; -#endif - } - if (endmask) - { - *p = MROP_PREBUILT_MASK(srcpix, *p, endmask); - } - } - } - } - xfree(pptFree); - xfree(pwidthFree); -} diff --git a/cfb/cfbtileodd.c b/cfb/cfbtileodd.c deleted file mode 100644 index 86a3fa5b5..000000000 --- a/cfb/cfbtileodd.c +++ /dev/null @@ -1,1245 +0,0 @@ -/* - * Fill odd tiled rectangles and spans. - * no depth dependencies. - */ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. -*/ - - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include "servermd.h" -#include "gcstruct.h" -#include "window.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "windowstr.h" - -#include "cfb.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - -#include "mergerop.h" - -#if PSZ == 24 -#define LEFTSHIFT_AMT (3) -#else /* PSZ != 24 */ -#define LEFTSHIFT_AMT (5 - PWSH) -#endif /* PSZ == 24*/ - -#define LastTileBits {\ - tmp = bits; \ - if (tileEndPart) \ - bits = (*pSrc & tileEndMask) | BitRight (*pSrcLine, tileEndLeftShift); \ - else \ - bits = *pSrc; \ -} - -#if PSZ == 24 -#define ResetTileBits {\ - pSrc = pSrcLine; \ - nlwSrc = widthSrc;\ - if (tileEndPart) { \ - if (4 - xoff + tileEndPart <= 4) {\ - bits = *pSrc++; \ - nlwSrc--; \ - } else \ - bits = BitLeft(tmp, tileEndLeftShift) | \ - BitRight(bits, tileEndRightShift); \ - xoff = (xoff + xoffStep) & 3; \ - leftShift = xoff << LEFTSHIFT_AMT; \ - rightShift = PGSZ - leftShift; \ - }\ -} -#else -#define ResetTileBits {\ - pSrc = pSrcLine; \ - nlwSrc = widthSrc;\ - if (tileEndPart) { \ - if (PPW - xoff + tileEndPart <= PPW) {\ - bits = *pSrc++; \ - nlwSrc--; \ - } else \ - bits = BitLeft(tmp, tileEndLeftShift) | \ - BitRight(bits, tileEndRightShift); \ - xoff = (xoff + xoffStep) & PIM; \ - leftShift = xoff << LEFTSHIFT_AMT; \ - rightShift = PGSZ - leftShift; \ - }\ -} -#endif - -#define NextTileBits {\ - if (nlwSrc == 1) {\ - LastTileBits\ - } else { \ - if (nlwSrc == 0) {\ - ResetTileBits\ - } \ - if (nlwSrc == 1) {\ - LastTileBits\ - } else {\ - tmp = bits; \ - bits = *pSrc++; \ - }\ - }\ - nlwSrc--; \ -} - -void -MROP_NAME(cfbFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int nBox; /* number of boxes to fill */ - register BoxPtr pBox; /* pointer to list of boxes to fill */ - PixmapPtr tile; /* tile */ - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile in pixels */ - int tileHeight; /* height of the tile */ - int widthSrc; - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - int h; /* height of current box */ - CfbBits startmask; - CfbBits endmask;/* masks for reggedy bits at either end of line */ - int nlwMiddle; /* number of longwords between sides of boxes */ - int nlwSrc; /* number of whole longwords in source */ - - register int nlw; /* loop version of nlwMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int xoffDst, xoffSrc; - int leftShift, rightShift; - -#if MROP == 0 && PSZ == 24 - DeclareMergeRop24() -#else - MROP_DECLARE_REG() -#endif - - CfbBits *pdstBase; /* pointer to start of dest */ - CfbBits *pDstLine; /* poitner to start of dest box */ - CfbBits *pSrcBase; /* pointer to start of source */ - CfbBits *pSrcLine; /* pointer to start of source line */ - register CfbBits *pDst; - register CfbBits *pSrc; - register CfbBits bits, tmp = 0; - int xoffStart, xoff; - int leftShiftStart, rightShiftStart, nlwSrcStart; - CfbBits tileEndMask; - int tileEndLeftShift, tileEndRightShift; - int xoffStep; - int tileEndPart; - int needFirst; - CfbBits narrow[2]; - CfbBits narrowMask = 0; - int narrowShift = 0; - Bool narrowTile; - -#if MROP == 0 && PSZ == 24 - InitializeMergeRop24 (alu, planemask) -#else - MROP_INITIALIZE (alu, planemask) -#endif - - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; - widthSrc = tile->devKind / PGSZB; - narrowTile = FALSE; - if (widthSrc == 1) - { - narrowShift = tileWidth; - narrowMask = cfbendpartial [tileWidth]; - tileWidth *= 2; - widthSrc = 2; - narrowTile = TRUE; - } - pSrcBase = (CfbBits *)tile->devPrivate.ptr; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - -#if PSZ == 24 - tileEndPart = (4 - tileWidth) & 3; - tileEndMask = cfbendpartial[tileWidth & 3]; -#else - tileEndPart = tileWidth & PIM; - tileEndMask = cfbendpartial[tileEndPart]; -#endif /* PSZ == 24 */ - tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; - tileEndRightShift = PGSZ - tileEndLeftShift; -#if PSZ == 24 - xoffStep = 4 - tileEndPart; -#else - xoffStep = PPW - tileEndPart; -#endif /* PSZ == 24 */ - /* - * current assumptions: tile > 32 bits wide. - */ - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - modulus (pBox->x1 - xrot, tileWidth, srcx); - modulus (pBox->y1 - yrot, tileHeight, srcy); -#if PSZ == 24 - xoffDst = (4 - pBox->x1) & 3; - if (w == 1 && (xoffDst == 0 || xoffDst == 1)) -#else - xoffDst = pBox->x1 & PIM; - if (xoffDst + w < PPW) -#endif - { - maskpartialbits(pBox->x1, w, startmask); - endmask = 0; - nlwMiddle = 0; - } - else - { - maskbits (pBox->x1, w, startmask, endmask, nlwMiddle) - } -#if PSZ == 24 - pDstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2); -#else - pDstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); -#endif - pSrcLine = pSrcBase + (srcy * widthSrc); -#if PSZ == 24 - xoffSrc = (4 - srcx) & 3; -#else - xoffSrc = srcx & PIM; -#endif - if (xoffSrc >= xoffDst) - { - xoffStart = xoffSrc - xoffDst; - needFirst = 1; - } - else - { -#if PSZ == 24 - xoffStart = 4 - (xoffDst - xoffSrc); -#else - xoffStart = PPW - (xoffDst - xoffSrc); -#endif - needFirst = 0; - } - leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; - rightShiftStart = PGSZ - leftShiftStart; -#if PSZ == 24 - nlwSrcStart = widthSrc - ((srcx*3) >> 2); -#else - nlwSrcStart = widthSrc - (srcx >> PWSH); -#endif - while (h--) - { - /* XXX only works when narrowShift >= PPW/2 */ - if (narrowTile) - { - tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */ - narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); -#if PSZ == 24 - narrow[1] = BitLeft (tmp, 8) | - BitRight(tmp, 16); -#else - narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | - SCRRIGHT(tmp, 2 * narrowShift - PPW); -#endif - pSrcLine = narrow; - } - xoff = xoffStart; - leftShift = leftShiftStart; - rightShift = rightShiftStart; - nlwSrc = nlwSrcStart; -#if PSZ == 24 - pSrc = pSrcLine + ((srcx * 3) >> 2); -#else - pSrc = pSrcLine + (srcx >> PWSH); -#endif - pDst = pDstLine; - bits = 0; - if (needFirst) - { - NextTileBits - } - if (startmask) - { - NextTileBits - tmp = BitLeft(tmp, leftShift); - if (rightShift != PGSZ) - tmp |= BitRight(bits,rightShift); - *pDst = MROP_MASK (tmp, *pDst, startmask); - ++pDst; - } - nlw = nlwMiddle; - while (nlw) - { -#if MROP == Mcopy - if (nlwSrc > 1) - { - int nlwPart = nlw; - - if (nlwPart >= nlwSrc) - nlwPart = nlwSrc - 1; - nlw -= nlwPart; - nlwSrc -= nlwPart; - if (rightShift != PGSZ) - { - while (nlwPart--) - { - tmp = bits; - bits = *pSrc++; - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight (bits, rightShift), - *pDst); - ++pDst; - } - } - else - { - if (nlwPart) - { - *pDst = MROP_SOLID (bits, *pDst); - ++pDst; - nlwPart--; - while (nlwPart--) - { - *pDst = MROP_SOLID(*pSrc, *pDst); - ++pDst; ++pSrc; - } - bits = *pSrc++; - } - } - } - else -#endif - { - NextTileBits - if (rightShift != PGSZ) - { - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight(bits, rightShift), - *pDst); - } - else - { - *pDst = MROP_SOLID (tmp, *pDst); - } - ++pDst; - nlw--; - } - } - if (endmask) - { - NextTileBits - if (rightShift == PGSZ) - bits = 0; - *pDst = MROP_MASK (BitLeft(tmp, leftShift) | - BitRight(bits,rightShift), - *pDst, endmask); - } - pDstLine += widthDst; - pSrcLine += widthSrc; - if (++srcy == tileHeight) - { - srcy = 0; - pSrcLine = pSrcBase; - } - } - pBox++; - } -} - -void -MROP_NAME(cfbFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int n; - DDXPointPtr ppt; - int *pwidth; - PixmapPtr tile; - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile in pixels */ - int tileHeight; /* height of the tile */ - int widthSrc; - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current span */ - CfbBits startmask; - CfbBits endmask; /* masks for reggedy bits at either end of line */ - int nlwSrc; /* number of whole longwords in source */ - - register int nlw; /* loop version of nlwMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int xoffDst, xoffSrc; - int leftShift, rightShift; - -#if MROP == 0 && PSZ == 24 - DeclareMergeRop24() -#else - MROP_DECLARE_REG() -#endif - - CfbBits *pdstBase; /* pointer to start of dest */ - CfbBits *pDstLine; /* poitner to start of dest box */ - CfbBits *pSrcBase; /* pointer to start of source */ - CfbBits *pSrcLine; /* pointer to start of source line */ - register CfbBits *pDst; - register CfbBits *pSrc; - register CfbBits bits, tmp = 0; - int xoffStart, xoff; - int leftShiftStart, rightShiftStart, nlwSrcStart; - CfbBits tileEndMask; - int tileEndLeftShift, tileEndRightShift; - int xoffStep; - int tileEndPart; - int needFirst; - CfbBits narrow[2]; - CfbBits narrowMask = 0; - int narrowShift = 0; - Bool narrowTile; - -#if MROP == 0 && PSZ == 24 - InitializeMergeRop24 (alu, planemask) -#else - MROP_INITIALIZE (alu, planemask) -#endif - - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; - widthSrc = tile->devKind / PGSZB; - narrowTile = FALSE; - if (widthSrc == 1) - { - narrowShift = tileWidth; - narrowMask = cfbendpartial [tileWidth]; - tileWidth *= 2; - widthSrc = 2; - narrowTile = TRUE; - } - pSrcBase = (CfbBits *)tile->devPrivate.ptr; - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - -#if PSZ == 24 - tileEndPart = (4 - tileWidth) & 3; - tileEndMask = cfbendpartial[tileWidth & 3]; -#else - tileEndPart = tileWidth & PIM; - tileEndMask = cfbendpartial[tileEndPart]; -#endif - tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT; - tileEndRightShift = PGSZ - tileEndLeftShift; -#if PSZ == 24 - xoffStep = 4 - tileEndPart; -#else - xoffStep = PPW - tileEndPart; -#endif - while (n--) - { - w = *pwidth++; - modulus (ppt->x - xrot, tileWidth, srcx); - modulus (ppt->y - yrot, tileHeight, srcy); -#if PSZ == 24 - xoffDst = (4 - ppt->x) & 3; - if (w == 1 && (xoffDst == 0 || xoffDst == 1)) -#else - xoffDst = ppt->x & PIM; - if (xoffDst + w < PPW) -#endif - { - maskpartialbits(ppt->x, w, startmask); - endmask = 0; - nlw = 0; - } - else - { - maskbits (ppt->x, w, startmask, endmask, nlw) - } -#if PSZ == 24 - pDstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3)>> 2); -#else - pDstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); -#endif - pSrcLine = pSrcBase + (srcy * widthSrc); -#if PSZ == 24 - xoffSrc = (4 - srcx) & 3; -#else - xoffSrc = srcx & PIM; -#endif - if (xoffSrc >= xoffDst) - { - xoffStart = xoffSrc - xoffDst; - needFirst = 1; - } - else - { -#if PSZ == 24 - xoffStart = 4 - (xoffDst - xoffSrc); -#else - xoffStart = PPW - (xoffDst - xoffSrc); -#endif - needFirst = 0; - } - leftShiftStart = (xoffStart) << LEFTSHIFT_AMT; - rightShiftStart = PGSZ - leftShiftStart; -#if PSZ == 24 - nlwSrcStart = widthSrc - ((srcx*3) >> 2); -#else - nlwSrcStart = widthSrc - (srcx >> PWSH); -#endif - /* XXX only works when narrowShift >= PPW/2 */ - if (narrowTile) - { - tmp = pSrcBase[srcy] & narrowMask; /* source width == 1 */ - narrow[0] = tmp | SCRRIGHT (tmp, narrowShift); -#if PSZ == 24 - narrow[1] = BitLeft (tmp, 8) | - BitRight(tmp, 16); -#else - narrow[1] = SCRLEFT (tmp, PPW - narrowShift) | - SCRRIGHT(tmp, 2 * narrowShift - PPW); -#endif - pSrcLine = narrow; - } - xoff = xoffStart; - leftShift = leftShiftStart; - rightShift = rightShiftStart; - nlwSrc = nlwSrcStart; -#if PSZ == 24 - pSrc = pSrcLine + ((srcx * 3) >> 2); -#else - pSrc = pSrcLine + (srcx >> PWSH); -#endif - pDst = pDstLine; - bits = 0; - if (needFirst) - { - NextTileBits - } - if (startmask) - { - NextTileBits - tmp = BitLeft(tmp, leftShift); - if (rightShift != PGSZ) - tmp |= BitRight(bits,rightShift); - *pDst = MROP_MASK (tmp, *pDst, startmask); - ++pDst; - } - while (nlw) - { -#if MROP == Mcopy - if (nlwSrc > 1) - { - int nlwPart = nlw; - - if (nlwPart >= nlwSrc) - nlwPart = nlwSrc - 1; - nlw -= nlwPart; - nlwSrc -= nlwPart; - if (rightShift != PGSZ) - { - while (nlwPart--) - { - tmp = bits; - bits = *pSrc++; - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight (bits, rightShift), - *pDst); - ++pDst; - } - } - else - { - if (nlwPart) - { - *pDst = MROP_SOLID (bits, *pDst); - ++pDst; - nlwPart--; - while (nlwPart--) - { - *pDst = MROP_SOLID(*pSrc, *pDst); - ++pDst; ++pSrc; - } - bits = *pSrc++; - } - } - } - else -#endif - { - NextTileBits - if (rightShift != PGSZ) - { - *pDst = MROP_SOLID(BitLeft(tmp, leftShift) | - BitRight(bits, rightShift), - *pDst); - ++pDst; - } - else - { - *pDst = MROP_SOLID (tmp, *pDst); - ++pDst; - } - nlw--; - } - } - if (endmask) - { - NextTileBits - if (rightShift == PGSZ) - bits = 0; - *pDst = MROP_MASK (BitLeft(tmp, leftShift) | - BitRight(bits,rightShift), - *pDst, endmask); - } - ppt++; - } -} - -# include "fastblt.h" - -#define IncSrcPtr psrc++; if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; } - -void -MROP_NAME(cfbFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int nBox; /* number of boxes to fill */ - register BoxPtr pBox; /* pointer to list of boxes to fill */ - PixmapPtr tile; /* tile */ - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile */ - int tileHeight; /* height of the tile */ - int widthSrc; /* width in longwords of the source tile */ - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - int h; /* height of current box */ - CfbBits startmask; - CfbBits endmask;/* masks for reggedy bits at either end of line */ - int nlMiddle; /* number of longwords between sides of boxes */ - - register int nl; /* loop version of nlMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int srcRemaining; /* number of longwords remaining in source */ - int xoffDst, xoffSrc; - int srcStart; /* number of longwords source offset at left of box */ - int leftShift, rightShift; - -#if MROP == 0 && PSZ == 24 - DeclareMergeRop24() -#else - MROP_DECLARE_REG() -#endif - - CfbBits *pdstBase; /* pointer to start of dest */ - CfbBits *pdstLine; /* poitner to start of dest box */ - CfbBits *psrcBase; /* pointer to start of source */ - CfbBits *psrcLine; /* pointer to fetch point of source */ - CfbBits *psrcStart; /* pointer to start of source line */ - register CfbBits *pdst; - register CfbBits *psrc; - register CfbBits bits, bits1; - register int nlTemp; - -#if MROP == 0 && PSZ == 24 - InitializeMergeRop24 (alu, planemask) -#else - MROP_INITIALIZE (alu, planemask) -#endif - - psrcBase = (CfbBits *)tile->devPrivate.ptr; - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; -#if PSZ == 24 - widthSrc = tile->devKind / PGSZB; -#else - widthSrc = tileWidth >> PWSH; -#endif - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - while (nBox--) - { - w = pBox->x2 - pBox->x1; - h = pBox->y2 - pBox->y1; - - /* set up source */ - modulus (pBox->x1 - xrot, tileWidth, srcx); - modulus (pBox->y1 - yrot, tileHeight, srcy); -#if PSZ == 24 - xoffSrc = (4 - srcx) & 3; - srcStart = (srcx * 3) >> 2; -#else - xoffSrc = srcx & PIM; - srcStart = (srcx >> PWSH); -#endif - psrcStart = psrcBase + (srcy * widthSrc); - psrcLine = psrcStart + srcStart; - - /* set up dest */ -#if PSZ == 24 - xoffDst = (4 - pBox->x1) & 3; - pdstLine = pdstBase + (pBox->y1 * widthDst) + ((pBox->x1*3) >> 2); -#else - xoffDst = pBox->x1 & PIM; - pdstLine = pdstBase + (pBox->y1 * widthDst) + (pBox->x1 >> PWSH); -#endif - /* set up masks */ -#if PSZ == 24 - if (w == 1 && (xoffDst == 0 || xoffDst == 1)) -#else - if (xoffDst + w < PPW) -#endif - { - maskpartialbits(pBox->x1, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits (pBox->x1, w, startmask, endmask, nlMiddle) - } - if (xoffSrc == xoffDst) - { - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - srcRemaining = widthSrc - srcStart; - if (startmask) - { - *pdst = MROP_MASK (*psrc, *pdst, startmask); - pdst++; - IncSrcPtr - } - nlTemp = nlMiddle; - while (nlTemp) - { - nl = nlTemp; - if (nl > srcRemaining) - nl = srcRemaining; - - nlTemp -= nl; - srcRemaining -= nl; - -#if MROP == Mcopy -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); -#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; -#define BodyEven(n) BodyOdd(n) - -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL(nl, label1, - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++;) -#endif -#else - while (nl--) { - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++; - } -#endif - if (!srcRemaining) - { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - if (endmask) - { - *pdst = MROP_MASK (*psrc, *pdst, endmask); - } - pdstLine += widthDst; - psrcLine += widthSrc; - psrcStart += widthSrc; - if (++srcy == tileHeight) - { - psrcStart = psrcBase; - psrcLine = psrcStart + srcStart; - srcy = 0; - } - } - } - else - { - if (xoffSrc > xoffDst) - { - leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; - rightShift = PGSZ - leftShift; - } - else - { - rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; - leftShift = PGSZ - rightShift; - } - while (h--) - { - psrc = psrcLine; - pdst = pdstLine; - bits = 0; - srcRemaining = widthSrc - srcStart; - if (xoffSrc > xoffDst) - { - bits = *psrc; - IncSrcPtr - } - if (startmask) - { - bits1 = BitLeft(bits,leftShift); - bits = *psrc; - IncSrcPtr - bits1 |= BitRight(bits,rightShift); - *pdst = MROP_MASK(bits1, *pdst, startmask); - pdst++; - } - nlTemp = nlMiddle; - while (nlTemp) - { - nl = nlTemp; - if (nl > srcRemaining) - nl = srcRemaining; - - nlTemp -= nl; - srcRemaining -= nl; - -#if MROP == Mcopy -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; - -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) \ - bits = psrc[-n]; \ - pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); - -#define BodyEven(n) \ - bits1 = psrc[-n]; \ - pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); - -#define LoopReset \ - pdst += UNROLL; \ - psrc += UNROLL; - -#else - -#define BodyOdd(n) \ - bits = *psrc++; \ - *pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ - pdst++; - -#define BodyEven(n) \ - bits1 = *psrc++; \ - *pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ - pdst++; - -#define LoopReset ; - -#endif /* !FAST_CONSTANT_OFFSET_MODE */ - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl,label2, - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); - pdst++; - ) -#endif -#else - while (nl--) { - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); - pdst++; - } -#endif - if (!srcRemaining) - { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - - if (endmask) - { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) - { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - pdstLine += widthDst; - psrcLine += widthSrc; - psrcStart += widthSrc; - if (++srcy == tileHeight) - { - psrcStart = psrcBase; - psrcLine = psrcStart + srcStart; - srcy = 0; - } - } - } - pBox++; - } -} - -void -MROP_NAME(cfbFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask) - DrawablePtr pDrawable; - int n; - DDXPointPtr ppt; - int *pwidth; - PixmapPtr tile; - int xrot, yrot; - int alu; - unsigned long planemask; -{ - int tileWidth; /* width of tile */ - int tileHeight; /* height of the tile */ - int widthSrc; /* width in longwords of the source tile */ - - int widthDst; /* width in longwords of the dest pixmap */ - int w; /* width of current box */ - CfbBits startmask; - CfbBits endmask;/* masks for reggedy bits at either end of line */ - int nlMiddle; /* number of longwords between sides of boxes */ - - register int nl; /* loop version of nlMiddle */ - int srcy; /* current tile y position */ - int srcx; /* current tile x position */ - int srcRemaining; /* number of longwords remaining in source */ - int xoffDst, xoffSrc; - int srcStart; /* number of longwords source offset at left of box */ - int leftShift, rightShift; - -#if MROP == 0 && PSZ == 24 - DeclareMergeRop24() -#else - MROP_DECLARE_REG() -#endif - - CfbBits *pdstBase; /* pointer to start of dest */ - CfbBits *pdstLine; /* poitner to start of dest box */ - CfbBits *psrcBase; /* pointer to start of source */ - CfbBits *psrcLine; /* pointer to fetch point of source */ - CfbBits *psrcStart; /* pointer to start of source line */ - register CfbBits *pdst; - register CfbBits *psrc; - register CfbBits bits, bits1; - register int nlTemp; - -#if MROP == 0 && PSZ == 24 - InitializeMergeRop24 (alu, planemask) -#else - MROP_INITIALIZE (alu, planemask) -#endif - - psrcBase = (CfbBits *)tile->devPrivate.ptr; - tileHeight = tile->drawable.height; - tileWidth = tile->drawable.width; -#if PSZ == 24 - widthSrc = tile->devKind / PGSZB; -#else - widthSrc = tileWidth >> PWSH; -#endif - - cfbGetLongWidthAndPointer (pDrawable, widthDst, pdstBase) - - while (n--) - { - w = *pwidth++; - - /* set up source */ - modulus (ppt->x - xrot, tileWidth, srcx); - modulus (ppt->y - yrot, tileHeight, srcy); -#if PSZ == 24 - xoffSrc = (4 - srcx) & 3; - srcStart = (srcx * 3) >> 2; -#else - xoffSrc = srcx & PIM; - srcStart = (srcx >> PWSH); -#endif - psrcStart = psrcBase + (srcy * widthSrc); - psrcLine = psrcStart + srcStart; - - /* set up dest */ -#if PSZ == 24 - xoffDst = (4 - ppt->x) & 3; - pdstLine = pdstBase + (ppt->y * widthDst) + ((ppt->x *3) >> 2); - /* set up masks */ - if (w == 1 && (xoffDst == 0 || xoffDst == 1)) -#else - xoffDst = ppt->x & PIM; - pdstLine = pdstBase + (ppt->y * widthDst) + (ppt->x >> PWSH); - /* set up masks */ - if (xoffDst + w < PPW) -#endif - { - maskpartialbits(ppt->x, w, startmask); - endmask = 0; - nlMiddle = 0; - } - else - { - maskbits (ppt->x, w, startmask, endmask, nlMiddle) - } - - if (xoffSrc == xoffDst) - { - psrc = psrcLine; - pdst = pdstLine; - srcRemaining = widthSrc - srcStart; - if (startmask) - { - *pdst = MROP_MASK (*psrc, *pdst, startmask); - pdst++; - IncSrcPtr - } - nlTemp = nlMiddle; - while (nlTemp) - { - nl = nlTemp; - if (nl > srcRemaining) - nl = srcRemaining; - - nlTemp -= nl; - srcRemaining -= nl; - -#if MROP == Mcopy -#ifdef LARGE_INSTRUCTION_CACHE -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); -#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++; -#define BodyEven(n) BodyOdd(n) - -#define LoopReset ; - -#endif - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL(nl, label1, - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++;) -#endif -#else - while (nl--) { - *pdst = MROP_SOLID (*psrc, *pdst); - pdst++; psrc++; - } -#endif - if (!srcRemaining) - { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - if (endmask) - { - *pdst = MROP_MASK (*psrc, *pdst, endmask); - } - } - else - { - if (xoffSrc > xoffDst) - { - leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT; - rightShift = PGSZ - leftShift; - } - else - { - rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT; - leftShift = PGSZ - rightShift; - } - psrc = psrcLine; - pdst = pdstLine; - bits = 0; - srcRemaining = widthSrc - srcStart; - if (xoffSrc > xoffDst) - { - bits = *psrc; - IncSrcPtr - } - if (startmask) - { - bits1 = BitLeft(bits,leftShift); - bits = *psrc; - IncSrcPtr - bits1 |= BitRight(bits,rightShift); - *pdst = MROP_MASK(bits1, *pdst, startmask); - pdst++; - } - nlTemp = nlMiddle; - while (nlTemp) - { - nl = nlTemp; - if (nl > srcRemaining) - nl = srcRemaining; - - nlTemp -= nl; - srcRemaining -= nl; - -#if MROP == Mcopy -#ifdef LARGE_INSTRUCTION_CACHE - bits1 = bits; - -#ifdef FAST_CONSTANT_OFFSET_MODE - - psrc += nl & (UNROLL-1); - pdst += nl & (UNROLL-1); - -#define BodyOdd(n) \ -bits = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]); - -#define BodyEven(n) \ -bits1 = psrc[-n]; \ -pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]); - -#define LoopReset \ -pdst += UNROLL; \ -psrc += UNROLL; - -#else - -#define BodyOdd(n) \ -bits = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \ -pdst++; - -#define BodyEven(n) \ -bits1 = *psrc++; \ -*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \ -pdst++; - -#define LoopReset ; - -#endif /* !FAST_CONSTANT_OFFSET_MODE */ - - PackedLoop - -#undef BodyOdd -#undef BodyEven -#undef LoopReset - -#else - DuffL (nl,label2, - bits1 = BitLeft(bits, leftShift); - bits = *psrc++; - *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst); - pdst++; - ) -#endif -#else - while (nl--) { - bits1 = BitLeft(bits,leftShift); - bits = *psrc++; - *pdst = MROP_SOLID(bits1|BitRight(bits,rightShift), *pdst); - pdst++; - } -#endif - if (!srcRemaining) - { - srcRemaining = widthSrc; - psrc = psrcStart; - } - } - - if (endmask) - { - bits1 = BitLeft(bits, leftShift); - if (BitLeft(endmask, rightShift)) - { - bits = *psrc; - bits1 |= BitRight(bits, rightShift); - } - *pdst = MROP_MASK (bits1, *pdst, endmask); - } - } - ppt++; - } -} diff --git a/cfb/cfbunmap.h b/cfb/cfbunmap.h deleted file mode 100644 index db9889217..000000000 --- a/cfb/cfbunmap.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 1994-1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -/* - * Unmap names - */ - -#undef CFBNAME -#undef CATNAME - -#undef QuartetBitsTable -#undef QuartetPixelMaskTable -#undef cfb8ClippedLineCopy -#undef cfb8ClippedLineGeneral -#undef cfb8ClippedLineXor -#undef cfb8LineSS1Rect -#undef cfb8LineSS1RectCopy -#undef cfb8LineSS1RectGeneral -#undef cfb8LineSS1RectPreviousCopy -#undef cfb8LineSS1RectXor -#undef cfb8SegmentSS1Rect -#undef cfb8SegmentSS1RectCopy -#undef cfb8SegmentSS1RectGeneral -#undef cfb8SegmentSS1RectShiftCopy -#undef cfb8SegmentSS1RectXor -#undef cfbAllocatePrivates -#undef cfbBSFuncRec -#undef cfbBitBlt -#undef cfbBresD -#undef cfbBresS -#undef cfbChangeWindowAttributes -#undef cfbClearVisualTypes -#undef cfbCloseScreen -#undef cfbCreateDefColormap -#undef cfbCopyArea -#undef cfbCopyImagePlane -#undef cfbCopyPixmap -#undef cfbCopyPlane -#undef cfbCopyPlaneReduce -#undef cfbCopyRotatePixmap -#undef cfbCopyWindow -#undef cfbCreateGC -#undef cfbCreatePixmap -#undef cfbCreateScreenResources -#undef cfbCreateWindow -#undef cfbDestroyPixmap -#undef cfbDestroyWindow -#undef cfbDoBitblt -#undef cfbDoBitbltCopy -#undef cfbDoBitbltGeneral -#undef cfbDoBitbltOr -#undef cfbDoBitbltXor -#undef cfbExpandDirectColors -#undef cfbFillBoxTile32sCopy -#undef cfbFillBoxTile32sGeneral -#undef cfbFillBoxTileOdd -#undef cfbFillBoxTileOddCopy -#undef cfbFillBoxTileOddGeneral -#undef cfbFillPoly1RectCopy -#undef cfbFillPoly1RectGeneral -#undef cfbFillRectSolidCopy -#undef cfbFillRectSolidGeneral -#undef cfbFillRectSolidXor -#undef cfbFillRectTile32Copy -#undef cfbFillRectTile32General -#undef cfbFillRectTileOdd -#undef cfbFillSpanTile32sCopy -#undef cfbFillSpanTile32sGeneral -#undef cfbFillSpanTileOddCopy -#undef cfbFillSpanTileOddGeneral -#undef cfbFinishScreenInit -#undef cfbGCFuncs -#undef cfbGCPrivateKey -#undef cfbGetImage -#undef cfbGetScreenPixmap -#undef cfbGetSpans -#undef cfbHorzS -#undef cfbImageGlyphBlt8 -#undef cfbInitializeColormap -#undef cfbInitVisuals -#undef cfbInstallColormap -#undef cfbLineSD -#undef cfbLineSS -#undef cfbListInstalledColormaps -#undef cfbMapWindow -#undef cfbMatchCommon -#undef cfbNonTEOps -#undef cfbNonTEOps1Rect -#undef cfbPadPixmap -#undef cfbPolyFillArcSolidCopy -#undef cfbPolyFillArcSolidGeneral -#undef cfbPolyFillRect -#undef cfbPolyGlyphBlt8 -#undef cfbPolyGlyphRop8 -#undef cfbPolyPoint -#undef cfbPositionWindow -#undef cfbPutImage -#undef cfbReduceRasterOp -#undef cfbResolveColor -#undef cfbRestoreAreas -#undef cfbSaveAreas -#undef cfbScreenInit -#undef cfbScreenPrivateKey -#undef cfbSegmentSD -#undef cfbSegmentSS -#undef cfbSetScanline -#undef cfbSetScreenPixmap -#undef cfbSetSpans -#undef cfbSetVisualTypes -#undef cfbSetupScreen -#undef cfbSolidSpansCopy -#undef cfbSolidSpansGeneral -#undef cfbSolidSpansXor -#undef cfbStippleStack -#undef cfbStippleStackTE -#undef cfbTEGlyphBlt -#undef cfbTEOps -#undef cfbTEOps1Rect -#undef cfbTile32FSCopy -#undef cfbTile32FSGeneral -#undef cfbUninstallColormap -#undef cfbUnmapWindow -#undef cfbUnnaturalStippleFS -#undef cfbUnnaturalTileFS -#undef cfbValidateGC -#undef cfbVertS -#undef cfbWindowPrivateKey -#undef cfbXRotatePixmap -#undef cfbYRotatePixmap -#undef cfbZeroPolyArcSS8Copy -#undef cfbZeroPolyArcSS8General -#undef cfbZeroPolyArcSS8Xor -#undef cfbendpartial -#undef cfbendtab -#undef cfbmask -#undef cfbrmask -#undef cfbstartpartial -#undef cfbstarttab diff --git a/cfb/cfbwindow.c b/cfb/cfbwindow.c deleted file mode 100644 index 50728764e..000000000 --- a/cfb/cfbwindow.c +++ /dev/null @@ -1,160 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include "scrnintstr.h" -#include "windowstr.h" -#include "cfb.h" -#include "mistruct.h" -#include "regionstr.h" -#include "cfbmskbits.h" - -Bool -cfbCreateWindow(WindowPtr pWin) -{ -#ifdef PIXMAP_PER_WINDOW - /* Setup pointer to Screen pixmap */ - dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, - cfbGetScreenPixmap(pWin->drawable.pScreen)); -#endif - - return TRUE; -} - -Bool -cfbDestroyWindow(WindowPtr pWin) -{ - return(TRUE); -} - -/*ARGSUSED*/ -Bool -cfbMapWindow(pWindow) - WindowPtr pWindow; -{ - return(TRUE); -} - -/*ARGSUSED*/ -Bool -cfbPositionWindow(WindowPtr pWin, int x, int y) -{ - return (TRUE); -} - -/*ARGSUSED*/ -Bool -cfbUnmapWindow(pWindow) - WindowPtr pWindow; -{ - return (TRUE); -} - -/* UNCLEAN! - this code calls the bitblt helper code directly. - - cfbCopyWindow copies only the parts of the destination that are -visible in the source. -*/ - - -void -cfbCopyWindow(pWin, ptOldOrg, prgnSrc) - WindowPtr pWin; - DDXPointRec ptOldOrg; - RegionPtr prgnSrc; -{ - DDXPointPtr pptSrc; - register DDXPointPtr ppt; - RegionRec rgnDst; - register BoxPtr pbox; - register int dx, dy; - register int i, nbox; - WindowPtr pwinRoot; - - pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; - - REGION_NULL(pWin->drawable.pScreen, &rgnDst); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - pbox = REGION_RECTS(&rgnDst); - nbox = REGION_NUM_RECTS(&rgnDst); - if(!nbox || !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) - { - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); - return; - } - ppt = pptSrc; - - for (i = nbox; --i >= 0; ppt++, pbox++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - cfbDoBitbltCopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - GXcopy, &rgnDst, pptSrc, ~0L); - xfree(pptSrc); - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); -} - -Bool -cfbChangeWindowAttributes(WindowPtr pWin, unsigned long mask) -{ - return (TRUE); -} - diff --git a/cfb/cfbzerarc.c b/cfb/cfbzerarc.c deleted file mode 100644 index 5b8879ee1..000000000 --- a/cfb/cfbzerarc.c +++ /dev/null @@ -1,322 +0,0 @@ -/************************************************************ - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -********************************************************/ - - -/* Derived from: - * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" - * by M. L. V. Pitteway - * The Computer Journal, November 1967, Volume 10, Number 3, pp. 282-289 - */ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include - -#include -#include -#include "regionstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "cfb.h" -#include "cfbmskbits.h" -#include "mizerarc.h" -#include "cfbrrop.h" -#include "mi.h" - -#ifdef PIXEL_ADDR - -static void -RROP_NAME(cfbZeroArcSS8)( - DrawablePtr pDraw, - GCPtr pGC, - xArc *arc) -{ - miZeroArcRec info; - Bool do360; - register int x; - PixelType *addrp; - register PixelType *yorgp, *yorgop; -#if PSZ == 24 - int xorg, xorg3, xorgo, xorgo3; - register int xtmp; -#endif - RROP_DECLARE - register int yoffset; - int npwidth, dyoffset; - register int y, a, b, d, mask; - register int k1, k3, dx, dy; - - cfbGetPixelWidthAndPointer(pDraw,npwidth, addrp) - - RROP_FETCH_GC (pGC); - do360 = miZeroArcSetup(arc, &info, TRUE); - yorgp = addrp + ((info.yorg + pDraw->y) * npwidth); - yorgop = addrp + ((info.yorgo + pDraw->y) * npwidth); - info.xorg += pDraw->x; - info.xorgo += pDraw->x; -#if PSZ == 24 - xorg = info.xorg; - xorg3 = xorg * 3; - info.xorg = (info.xorg * 3) >> 2; - xorgo = info.xorgo; - xorgo3 = xorgo * 3; - info.xorgo = (info.xorgo * 3) >> 2; -#endif - MIARCSETUP(); - yoffset = y ? npwidth : 0; - dyoffset = 0; - mask = info.initialMask; - if (!(arc->width & 1)) - { -#if PSZ == 24 - if (mask & 2) - RROP_SOLID24((yorgp + info.xorgo), xorgo); - if (mask & 8) - RROP_SOLID24((yorgop + info.xorgo), xorgo); -#else - if (mask & 2) - RROP_SOLID((yorgp + info.xorgo)); - if (mask & 8) - RROP_SOLID((yorgop + info.xorgo)); -#endif /* PSZ == 24 */ - } - if (!info.end.x || !info.end.y) - { - mask = info.end.mask; - info.end = info.altend; - } - if (do360 && (arc->width == arc->height) && !(arc->width & 1)) - { - register int xoffset = npwidth; -#if PSZ == 24 - PixelType *yorghb = yorgp + (info.h * npwidth); - register int tmp1, tmp2, tmp1_3, tmp2_3; - - tmp1 = xorg + info.h; - tmp1_3 = tmp1 * 3; - tmp2 = xorg - info.h; - tmp2_3 = tmp2 * 3; - while (1) - { - xtmp = (xorg3 + x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); - RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); - xtmp = (xorg3 - x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorg - x); - RROP_SOLID24(yorgop - yoffset + xtmp, xorg - x); - if (a < 0) - break; - xtmp = (tmp1_3 - y * 3) >> 2; - RROP_SOLID24(yorghb - xoffset + xtmp, tmp1 - y); - RROP_SOLID24(yorghb + xoffset + xtmp, tmp1 - y); - xtmp = (tmp2_3 + y * 3) >> 2; - RROP_SOLID24(yorghb - xoffset + xtmp, tmp2 + y); - RROP_SOLID24(yorghb + xoffset + xtmp, tmp2 + y); - xoffset += npwidth; - MIARCCIRCLESTEP(yoffset += npwidth;); - } -#else - PixelType *yorghb = yorgp + (info.h * npwidth) + info.xorg; - PixelType *yorgohb = yorghb - info.h; - - yorgp += info.xorg; - yorgop += info.xorg; - yorghb += info.h; - while (1) - { - RROP_SOLID(yorgp + yoffset + x); - RROP_SOLID(yorgp + yoffset - x); - RROP_SOLID(yorgop - yoffset - x); - RROP_SOLID(yorgop - yoffset + x); - if (a < 0) - break; - RROP_SOLID(yorghb - xoffset - y); - RROP_SOLID(yorgohb - xoffset + y); - RROP_SOLID(yorgohb + xoffset + y); - RROP_SOLID(yorghb + xoffset - y); - xoffset += npwidth; - MIARCCIRCLESTEP(yoffset += npwidth;); - } - yorgp -= info.xorg; - yorgop -= info.xorg; -#endif /* PSZ == 24 */ - x = info.w; - yoffset = info.h * npwidth; - } - else if (do360) - { - while (y < info.h || x < info.w) - { - MIARCOCTANTSHIFT(dyoffset = npwidth;); -#if PSZ == 24 - xtmp = (xorg3 + x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); - RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); - xtmp = (xorgo3 - x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); - RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); -#else - RROP_SOLID(yorgp + yoffset + info.xorg + x); - RROP_SOLID(yorgp + yoffset + info.xorgo - x); - RROP_SOLID(yorgop - yoffset + info.xorgo - x); - RROP_SOLID(yorgop - yoffset + info.xorg + x); -#endif - MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;); - } - } - else - { - while (y < info.h || x < info.w) - { - MIARCOCTANTSHIFT(dyoffset = npwidth;); - if ((x == info.start.x) || (y == info.start.y)) - { - mask = info.start.mask; - info.start = info.altstart; - } -#if PSZ == 24 - if (mask & 1){ - xtmp = (xorg3 + x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); - } - if (mask & 2){ - xtmp = (xorgo3 - x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); - } - if (mask & 4){ - xtmp = (xorgo3 - x * 3) >> 2; - RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); - } - if (mask & 8){ - xtmp = (xorg3 + x * 3) >> 2; - RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); - } -#else - if (mask & 1) - RROP_SOLID(yorgp + yoffset + info.xorg + x); - if (mask & 2) - RROP_SOLID(yorgp + yoffset + info.xorgo - x); - if (mask & 4) - RROP_SOLID(yorgop - yoffset + info.xorgo - x); - if (mask & 8) - RROP_SOLID(yorgop - yoffset + info.xorg + x); -#endif /* PSZ == 24 */ - if ((x == info.end.x) || (y == info.end.y)) - { - mask = info.end.mask; - info.end = info.altend; - } - MIARCSTEP(yoffset += dyoffset;, yoffset += npwidth;); - } - } - if ((x == info.start.x) || (y == info.start.y)) - mask = info.start.mask; -#if PSZ == 24 - if (mask & 1){ - xtmp = (xorg3 + x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorg + x); - } - if (mask & 4){ - xtmp = (xorgo3 - x * 3) >> 2; - RROP_SOLID24(yorgop - yoffset + xtmp, xorgo - x); - } -#else - if (mask & 1) - RROP_SOLID(yorgp + yoffset + info.xorg + x); - if (mask & 4) - RROP_SOLID(yorgop - yoffset + info.xorgo - x); -#endif /* PSZ == 24 */ - if (arc->height & 1) - { -#if PSZ == 24 - if (mask & 2){ - xtmp = (xorgo3 - x * 3) >> 2; - RROP_SOLID24(yorgp + yoffset + xtmp, xorgo - x); - } - if (mask & 8){ - xtmp = (xorg3 + x * 3) >> 2; - RROP_SOLID24(yorgop - yoffset + xtmp, xorg + x); - } -#else - if (mask & 2) - RROP_SOLID(yorgp + yoffset + info.xorgo - x); - if (mask & 8) - RROP_SOLID(yorgop - yoffset + info.xorg + x); -#endif /* PSZ == 24 */ - } - RROP_UNDECLARE -} - -void -RROP_NAME (cfbZeroPolyArcSS8) (pDraw, pGC, narcs, parcs) - register DrawablePtr pDraw; - GCPtr pGC; - int narcs; - xArc *parcs; -{ - register xArc *arc; - register int i; - BoxRec box; - int x2, y2; - RegionPtr cclip; - - cclip = cfbGetCompositeClip(pGC); - for (arc = parcs, i = narcs; --i >= 0; arc++) - { - if (miCanZeroArc(arc)) - { - box.x1 = arc->x + pDraw->x; - box.y1 = arc->y + pDraw->y; - /* - * Because box.x2 and box.y2 get truncated to 16 bits, and the - * RECT_IN_REGION test treats the resulting number as a signed - * integer, the RECT_IN_REGION test alone can go the wrong way. - * This can result in a server crash because the rendering - * routines in this file deal directly with cpu addresses - * of pixels to be stored, and do not clip or otherwise check - * that all such addresses are within their respective pixmaps. - * So we only allow the RECT_IN_REGION test to be used for - * values that can be expressed correctly in a signed short. - */ - x2 = box.x1 + (int)arc->width + 1; - box.x2 = x2; - y2 = box.y1 + (int)arc->height + 1; - box.y2 = y2; - if ( (x2 <= SHRT_MAX) && (y2 <= SHRT_MAX) && - (RECT_IN_REGION(pDraw->pScreen, cclip, &box) == rgnIN) ) - RROP_NAME (cfbZeroArcSS8) (pDraw, pGC, arc); - else - miZeroPolyArc(pDraw, pGC, 1, arc); - } - else - miPolyArc(pDraw, pGC, 1, arc); - } -} - -#endif diff --git a/cfb/stip68kgnu.h b/cfb/stip68kgnu.h deleted file mode 100644 index 2da27b4dd..000000000 --- a/cfb/stip68kgnu.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -/* - * Stipple stack macro for 68k GCC - */ - -#define STIPPLE(addr,stipple,value,width,count,shift) \ - __asm volatile ( \ - "lea 5f,%/a1\n\ - moveq #28,%/d2\n\ - addl %2,%/d2\n\ - moveq #28,%/d3\n\ - subql #4,%2\n\ - negl %2\n\ -1:\n\ - movel %0,%/a0\n\ - addl %6,%0\n\ - movel %3@+,%/d1\n\ - jeq 3f\n\ - movel %/d1,%/d0\n\ - lsrl %/d2,%/d0\n\ - lsll #5,%/d0\n\ - lsll %2,%/d1\n\ - jmp %/a1@(%/d0:l)\n\ -2:\n\ - addl #4,%/a0\n\ - movel %/d1,%/d0\n\ - lsrl %/d3,%/d0\n\ - lsll #5,%/d0\n\ - lsll #4,%/d1\n\ - jmp %/a1@(%/d0:l)\n\ -5:\n\ - jne 2b ; dbra %1,1b ; jra 4f\n\ - . = 5b + 0x20\n\ - moveb %5,%/a0@(3)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ - . = 5b + 0x40\n\ - moveb %5,%/a0@(2)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ - . = 5b + 0x60\n\ - movew %5,%/a0@(2)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f\n\ - . = 5b + 0x80\n\ - moveb %5,%/a0@(1)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0xa0\n\ - moveb %5,%/a0@(3) ; moveb %5,%/a0@(1)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0xc0\n\ - movew %5,%/a0@(1)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0xe0\n\ - movew %5,%/a0@(2) ; moveb %5,%/a0@(1)\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x100\n\ - moveb %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x120\n\ - moveb %5,%/a0@(3) ; moveb %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x140\n\ - moveb %5,%/a0@(2) ; moveb %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x160\n\ - movew %5,%/a0@(2) ; moveb %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x180\n\ - movew %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x1a0\n\ - moveb %5,%/a0@(3) ; movew %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x1c0\n\ - moveb %5,%/a0@(2) ; movew %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; dbra %1,1b ; jra 4f ;\n\ - . = 5b + 0x1e0\n\ - movel %5,%/a0@\n\ - andl %/d1,%/d1 ; jne 2b ; \n\ -3: dbra %1,1b ; \n\ -4:\n"\ - : "=a" (addr), /* %0 */ \ - "=d" (count), /* %1 */ \ - "=d" (shift), /* %2 */ \ - "=a" (stipple) /* %3 */ \ - : "0" (addr), /* %4 */ \ - "d" (value), /* %5 */ \ - "a" (width), /* %6 */ \ - "1" (count-1), /* %7 */ \ - "2" (shift), /* %8 */ \ - "3" (stipple) /* %9 */ \ - : /* ctemp */ "d0", \ - /* c */ "d1", \ - /* lshift */ "d2", \ - /* rshift */ "d3", \ - /* atemp */ "a0", \ - /* case */ "a1") diff --git a/cfb/stipmips.s b/cfb/stipmips.s deleted file mode 100644 index c42d9b5ae..000000000 --- a/cfb/stipmips.s +++ /dev/null @@ -1,281 +0,0 @@ -/* - * $Xorg: stipmips.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -/* - * MIPS assembly code for optimized text rendering. - * - * Other stippling could be done in assembly, but the payoff is - * not nearly as large. Mostly because large areas are heavily - * optimized already. - */ - -#ifdef MIPSEL -# define BitsR sll -# define BitsL srl -# define BO(o) o -# define HO(o) o -# define WO(o) o -# define FourBits(dest,bits) and dest, bits, 0xf -#else -# define BitsR srl -# define BitsL sll -# define BO(o) 3-o -# define HO(o) 2-o -# define WO(o) o -# define FourBits(dest,bits) srl dest, bits, 28 -#endif - -/* reordering instructions would be fatal here */ - .set noreorder - - -/* - * cfbStippleStack(addr, stipple, value, stride, Count, Shift) - * 4 5 6 7 16(sp) 20(sp) - * - * Apply successive 32-bit stipples starting at addr, addr+stride, ... - * - * Used for text rendering, but only when no data could be lost - * when the stipple is shifted left by Shift bits - */ -/* arguments */ -#define addr $4 -#define stipple $5 -#define value $6 -#define stride $7 -#define Count 16($sp) -#define Shift 20($sp) - -/* local variables */ -#define count $14 -#define shift $13 -#define atemp $12 -#define bits $11 -#define lshift $9 -#define sbase $8 -#define stemp $2 - -#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */ -#define CASE_MASK 0x1e0 /* first case mask */ - -#define ForEachLine $200 -#define NextLine $201 -#define NextLine1 $202 -#define CaseBegin $203 -#define ForEachBits $204 -#define ForEachBits1 $205 -#define NextBits $206 - -#ifdef TETEXT -#define cfbStippleStack cfbStippleStackTE -#endif - - .globl cfbStippleStack - .ent cfbStippleStack 2 -cfbStippleStack: - .frame $sp, 0, $31 - lw count, Count /* fetch stack params */ - la sbase,CaseBegin /* load up switch table */ - lw shift, Shift - li lshift, 4 /* compute offset within */ - subu lshift, lshift, shift /* stipple of remaining bits */ -#ifdef MIPSEL - addu shift, shift, CASE_SIZE /* first shift for LSB */ -#else - addu shift, shift, 28-CASE_SIZE /* first shift for MSB */ -#endif - /* do ... while (--count > 0); */ -ForEachLine: - lw bits, 0(stipple) /* get stipple bits */ - move atemp, addr /* set up for this line */ -#ifdef TETEXT - /* Terminal emulator fonts are expanded and have many 0 rows */ - beqz bits, NextLine /* skip out early on 0 */ -#endif - addu addr, addr, stride /* step for the loop */ - BitsR stemp, bits, shift /* get first bits */ - and stemp, stemp, CASE_MASK /* compute first branch */ - addu stemp, stemp, sbase /* ... */ - j stemp /* ... */ - BitsL bits, bits, lshift /* set remaining bits */ - -ForEachBits: - addu atemp, atemp, 4 -ForEachBits1: - FourBits(stemp, bits) /* compute jump for */ - sll stemp, stemp, CASE_SIZE /* next four bits */ - addu stemp, stemp, sbase /* ... */ - j stemp /* ... */ - BitsL bits, bits, 4 /* step for remaining bits */ -CaseBegin: - bnez bits, ForEachBits1 /* 0 */ - addu atemp, atemp, 4 -NextLine: - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - bnez bits, ForEachBits /* 1 */ - sb value, BO(0)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - bnez bits, ForEachBits /* 2 */ - sb value, BO(1)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - bnez bits, ForEachBits /* 3 */ - sh value, HO(0)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - bnez bits, ForEachBits /* 4 */ - sb value, BO(2)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - sb value, BO(0)(atemp) /* 5 */ - bnez bits, ForEachBits - sb value, BO(2)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - - sb value, BO(1)(atemp) /* 6 */ - bnez bits, ForEachBits - sb value, BO(2)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - - bnez bits, ForEachBits /* 7 */ - swl value, BO(2)(atemp) /* untested on MSB */ - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - bnez bits, ForEachBits /* 8 */ - sb value, BO(3)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - sb value, BO(0)(atemp) /* 9 */ - bnez bits, ForEachBits - sb value, BO(3)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - - sb value, BO(1)(atemp) /* a */ - bnez bits, ForEachBits - sb value, BO(3)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - - sh value, HO(0)(atemp) /* b */ - bnez bits, ForEachBits - sb value, BO(3)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - - bnez bits, ForEachBits /* c */ - sh value, HO(2)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - sb value, BO(0)(atemp) /* d */ - bnez bits, ForEachBits - sh value, HO(2)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - - bnez bits, ForEachBits /* e */ - swr value, BO(1)(atemp) /* untested on MSB */ - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - bnez bits, ForEachBits /* f */ - sw value, WO(0)(atemp) - addu count, count, -1 - bnez count, ForEachLine - addu stipple, stipple, 4 - j $31 - nop - nop - - .end cfbStippleStack diff --git a/cfb/stipsparc.s b/cfb/stipsparc.s deleted file mode 100644 index dcd440b19..000000000 --- a/cfb/stipsparc.s +++ /dev/null @@ -1,290 +0,0 @@ -/* - * $Xorg: stipsparc.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ - * $XdotOrg: $ - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ -/* $XFree86: xc/programs/Xserver/cfb/stipsparc.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */ - -/* - * SPARC assembly code for optimized text rendering. - * - * Other stippling could be done in assembly, but the payoff is - * not nearly as large. Mostly because large areas are heavily - * optimized already. - */ - -/* not that I expect to ever see an LSB SPARC, but ... */ -#ifdef LITTLE_ENDIAN -# define BitsR sll -# define BitsL srl -# define BO(o) o -# define HO(o) o -# define WO(o) o -# define FourBits(dest,bits) and bits, 0xf, dest -#else -# define BitsR srl -# define BitsL sll -# define BO(o) 3-o -# define HO(o) 2-o -# define WO(o) o -# define FourBits(dest,bits) srl bits, 28, dest -#endif - -/* - * cfbStippleStack(addr, stipple, value, stride, Count, Shift) - * 4 5 6 7 16(sp) 20(sp) - * - * Apply successive 32-bit stipples starting at addr, addr+stride, ... - * - * Used for text rendering, but only when no data could be lost - * when the stipple is shifted left by Shift bits - */ -/* arguments */ -#define addr %i0 -#define stipple %i1 -#define value %i2 -#define stride %i3 -#define count %i4 -#define shift %i5 - -/* local variables */ -#define atemp %l0 -#define bits %l1 -#define lshift %l2 -#define sbase %l3 -#define stemp %l4 - -#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */ -#define CASE_MASK 0x1e0 /* first case mask */ - -#define ForEachLine LY1 -#define NextLine LY2 -#define CaseBegin LY3 -#define ForEachBits LY4 -#define NextBits LY5 - -#if defined(SVR4) || defined(__ELF__) -#ifdef TETEXT -#define _cfbStippleStack cfbStippleStackTE -#else -#define _cfbStippleStack cfbStippleStack -#endif -#else -#ifdef TETEXT -#define _cfbStippleStack _cfbStippleStackTE -#endif -#endif - .seg "text" - .proc 16 - .globl _cfbStippleStack -_cfbStippleStack: - save %sp,-64,%sp -#ifdef SHAREDCODE -1: - call 2f - nop -2: - mov %o7,sbase /* sbase = 1b(1:) */ - add sbase, CaseBegin-1b, sbase -#else /* !SHAREDCODE */ - sethi %hi(CaseBegin),sbase /* load up switch table */ - or sbase,%lo(CaseBegin),sbase -#endif /* SHAREDCODE */ - mov 4,lshift /* compute offset within */ - sub lshift, shift, lshift /* stipple of remaining bits */ -#ifdef LITTLE_ENDIAN - inc CASE_SIZE, shift /* first shift for LSB */ -#else - inc 28-CASE_SIZE, shift /* first shift for MSB */ -#endif - /* do ... while (--count > 0); */ -ForEachLine: - ld [stipple],bits /* get stipple bits */ - mov addr,atemp /* set up for this line */ -#ifdef TETEXT - /* Terminal emulator fonts are expanded and have many 0 rows */ - tst bits - bz NextLine /* skip out early on 0 */ -#endif - add addr, stride, addr /* step for the loop */ - BitsR bits, shift, stemp /* get first bits */ - and stemp, CASE_MASK, stemp /* compute first jump */ - BitsL bits, lshift, bits /* set remaining bits */ - jmp sbase+stemp /* ... */ - tst bits - -ForEachBits: - inc 4, atemp -ForEachBits1: - FourBits(stemp, bits) /* compute jump for */ - sll stemp, CASE_SIZE, stemp /* these four bits */ - BitsL bits, 4, bits /* step for remaining bits */ - jmp sbase+stemp /* jump */ - tst bits -CaseBegin: - bnz,a ForEachBits1 /* 0 */ - inc 4, atemp -NextLine: - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - bnz ForEachBits /* 1 */ - stb value, [atemp+BO(0)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - bnz ForEachBits /* 2 */ - stb value, [atemp+BO(1)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - bnz ForEachBits /* 3 */ - sth value, [atemp+HO(0)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - bnz ForEachBits /* 4 */ - stb value, [atemp+BO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - stb value, [atemp+BO(0)] /* 5 */ - bnz ForEachBits - stb value, [atemp+BO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - stb value, [atemp+BO(1)] /* 6 */ - bnz ForEachBits - stb value, [atemp+BO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - sth value, [atemp+HO(0)] /* 7 */ - bnz ForEachBits - stb value, [atemp+BO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - bnz ForEachBits /* 8 */ - stb value, [atemp+BO(3)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - stb value, [atemp+BO(0)] /* 9 */ - bnz ForEachBits - stb value, [atemp+BO(3)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - stb value, [atemp+BO(1)] /* a */ - bnz ForEachBits - stb value, [atemp+BO(3)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - sth value, [atemp+HO(0)] /* b */ - bnz ForEachBits - stb value, [atemp+BO(3)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - bnz ForEachBits /* c */ - sth value, [atemp+HO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - stb value, [atemp+BO(0)] /* d */ - bnz ForEachBits - sth value, [atemp+HO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - stb value, [atemp+BO(1)] /* e */ - bnz ForEachBits - sth value, [atemp+HO(2)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - bnz ForEachBits /* f */ - st value, [atemp+WO(0)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore diff --git a/cfb/stipsprc32.s b/cfb/stipsprc32.s deleted file mode 100644 index 89b031f5a..000000000 --- a/cfb/stipsprc32.s +++ /dev/null @@ -1,291 +0,0 @@ -/* - * $Xorg: stipsprc32.s,v 1.4 2001/02/09 02:04:39 xorgcvs Exp $ - * $XdotOrg: $ - * -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ -/* $XFree86: xc/programs/Xserver/cfb/stipsprc32.s,v 1.4 2001/01/17 22:36:38 dawes Exp $ */ - -/* - * SPARC assembly code for optimized text rendering. - * - * Other stippling could be done in assembly, but the payoff is - * not nearly as large. Mostly because large areas are heavily - * optimized already. - */ - -/* not that I expect to ever see an LSB SPARC, but ... */ -#ifdef LITTLE_ENDIAN -# define BitsR sll -# define BitsL srl -# define WO(o) 3-o -# define FourBits(dest,bits) and bits, 0xf, dest -#else -# define BitsR srl -# define BitsL sll -# define WO(o) o -# define FourBits(dest,bits) srl bits, 28, dest -#endif - -/* - * cfb32StippleStack(addr, stipple, value, stride, Count, Shift) - * 4 5 6 7 16(sp) 20(sp) - * - * Apply successive 32-bit stipples starting at addr, addr+stride, ... - * - * Used for text rendering, but only when no data could be lost - * when the stipple is shifted left by Shift bits - */ -/* arguments */ -#define addr %i0 -#define stipple %i1 -#define value %i2 -#define stride %i3 -#define count %i4 -#define shift %i5 - -/* local variables */ -#define atemp %l0 -#define bits %l1 -#define lshift %l2 -#define sbase %l3 -#define stemp %l4 - -#define CASE_SIZE 5 /* case blocks are 2^5 bytes each */ -#define CASE_MASK 0x1e0 /* first case mask */ - -#define ForEachLine LY1 -#define NextLine LY2 -#define CaseBegin LY3 -#define ForEachBits LY4 -#define NextBits LY5 - -#if defined(SVR4) || defined(__ELF__) -#ifdef TETEXT -#define _cfb32StippleStack cfb32StippleStackTE -#else -#define _cfb32StippleStack cfb32StippleStack -#endif -#else -#ifdef TETEXT -#define _cfb32StippleStack _cfb32StippleStackTE -#endif -#endif - - .seg "text" - .proc 16 - .globl _cfb32StippleStack -_cfb32StippleStack: - save %sp,-64,%sp -#ifdef SHAREDCODE -1: - call 2f - nop -2: - mov %o7,sbase /* sbase = 1b(1:) */ - add sbase, CaseBegin-1b, sbase -#else /* !SHAREDCODE */ - sethi %hi(CaseBegin),sbase /* load up switch table */ - or sbase,%lo(CaseBegin),sbase -#endif /* !SHAREDCODE */ - mov 4,lshift /* compute offset within */ - sub lshift, shift, lshift /* stipple of remaining bits */ -#ifdef LITTLE_ENDIAN - inc CASE_SIZE, shift /* first shift for LSB */ -#else - inc 28-CASE_SIZE, shift /* first shift for MSB */ -#endif - /* do ... while (--count > 0); */ -ForEachLine: - ld [stipple],bits /* get stipple bits */ - mov addr,atemp /* set up for this line */ -#ifdef TETEXT - /* Terminal emulator fonts are expanded and have many 0 rows */ - tst bits - bz NextLine /* skip out early on 0 */ -#endif - add addr, stride, addr /* step for the loop */ - BitsR bits, shift, stemp /* get first bits */ - and stemp, CASE_MASK, stemp /* compute first jump */ - BitsL bits, lshift, bits /* set remaining bits */ - jmp sbase+stemp /* ... */ - tst bits - -ForEachBits: - inc 16, atemp -ForEachBits1: - FourBits(stemp, bits) /* compute jump for */ - sll stemp, CASE_SIZE, stemp /* these four bits */ - BitsL bits, 4, bits /* step for remaining bits */ - jmp sbase+stemp /* jump */ - tst bits -CaseBegin: - bnz,a ForEachBits1 /* 0 */ - inc 16, atemp -NextLine: - deccc 1, count -NextLine1: - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - bnz ForEachBits /* 1 */ - st value, [atemp+WO(12)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - bnz ForEachBits /* 2 */ - st value, [atemp+WO(8)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - st value, [atemp+WO(8)] /* 3 */ - bnz ForEachBits - st value, [atemp+WO(12)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - bnz ForEachBits /* 4 */ - st value, [atemp+WO(4)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - st value, [atemp+WO(4)] /* 5 */ - bnz ForEachBits - st value, [atemp+WO(12)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - st value, [atemp+WO(4)] /* 6 */ - bnz ForEachBits - st value, [atemp+WO(8)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - st value, [atemp+WO(4)] /* 7 */ - st value, [atemp+WO(8)] - bnz ForEachBits - st value, [atemp+WO(12)] - b NextLine1 - deccc 1, count - nop - nop - - bnz ForEachBits /* 8 */ - st value, [atemp+WO(0)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - nop - - st value, [atemp+WO(0)] /* 9 */ - bnz ForEachBits - st value, [atemp+WO(12)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - st value, [atemp+WO(0)] /* a */ - bnz ForEachBits - st value, [atemp+WO(8)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - st value, [atemp+WO(0)] /* b */ - st value, [atemp+WO(8)] - bnz ForEachBits - st value, [atemp+WO(12)] - b NextLine1 - deccc 1, count - nop - nop - - st value, [atemp+WO(0)] /* c */ - bnz ForEachBits - st value, [atemp+WO(4)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore - - st value, [atemp+WO(0)] /* d */ - st value, [atemp+WO(4)] - bnz ForEachBits - st value, [atemp+WO(12)] - b NextLine1 - deccc 1, count - nop - nop - - st value, [atemp+WO(0)] /* e */ - st value, [atemp+WO(4)] - bnz ForEachBits - st value, [atemp+WO(8)] - b NextLine1 - deccc 1, count - nop - nop - - st value, [atemp+WO(0)] /* f */ - st value, [atemp+WO(4)] - st value, [atemp+WO(8)] - bnz ForEachBits - st value, [atemp+WO(12)] - deccc 1, count - bnz,a ForEachLine - inc 4, stipple - ret - restore diff --git a/cfb32/Makefile.am b/cfb32/Makefile.am deleted file mode 100644 index 681a09575..000000000 --- a/cfb32/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -noinst_LTLIBRARIES = libcfb32.la - -include $(top_srcdir)/cfb/Makefile.am.inc - -libcfb32_la_SOURCES = $(libcfb_common_sources) $(libcfb_gen_sources) - -INCLUDES = $(CFB_INCLUDES) $(DIX_CFLAGS) -I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/common - -AM_CFLAGS = -DPSZ=32 $(PLATFORMDEFS) diff --git a/configure.ac b/configure.ac index c0a1f23c9..4e83a4251 100644 --- a/configure.ac +++ b/configure.ac @@ -575,7 +575,6 @@ AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl mo AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no]) dnl legacy fb support AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG]) -AC_ARG_ENABLE(cfb, AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG]) AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG]) dnl kdrive and its subsystems AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no]) @@ -1581,12 +1580,10 @@ AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes]) dnl legacy fb support test "x$MFB" = xauto && MFB="$XORG" -test "x$CFB" = xauto && CFB="$XORG" test "x$AFB" = xauto && AFB="$XORG" AM_CONDITIONAL(MFB, [test "x$MFB" = xyes]) -AM_CONDITIONAL(CFB, [test "x$CFB" = xyes]) AM_CONDITIONAL(AFB, [test "x$AFB" = xyes]) -if test "x$MFB" = xyes -o "x$CFB" = xyes -o "x$AFB" = xyes; then +if test "x$MFB" = xyes -o "x$AFB" = xyes; then if test "x$XORG" != xyes; then AC_MSG_ERROR([legacy fb support requires the Xorg server]) fi @@ -2135,8 +2132,6 @@ fb/Makefile record/Makefile XTrap/Makefile mfb/Makefile -cfb/Makefile -cfb32/Makefile config/Makefile mi/Makefile miext/Makefile @@ -2195,7 +2190,6 @@ hw/xfree86/xaa/Makefile hw/xfree86/xf1bpp/Makefile hw/xfree86/xf4bpp/Makefile hw/xfree86/xf8_16bpp/Makefile -hw/xfree86/xf8_32bpp/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am index 03c2c3a3f..e6cc38a7c 100644 --- a/hw/xfree86/Makefile.am +++ b/hw/xfree86/Makefile.am @@ -16,20 +16,16 @@ if MFB MFB_SUBDIR = xf1bpp xf4bpp endif -if CFB -CFB_SUBDIR = xf8_32bpp -endif - DOC_SUBDIR = doc SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \ - ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \ + ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \ xf8_16bpp loader dixmods exa modes \ $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR) DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \ parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \ - xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \ + xf8_16bpp loader dixmods dri dri2 exa modes \ utils doc bin_PROGRAMS = Xorg diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am index dad2dd36b..67967c52d 100644 --- a/hw/xfree86/dixmods/Makefile.am +++ b/hw/xfree86/dixmods/Makefile.am @@ -18,10 +18,6 @@ if AFB AFBMOD = libafb.la endif -if CFB -CFBMOD = libcfb.la libcfb32.la -endif - if MFB MFBMOD = libmfb.la endif @@ -31,7 +27,6 @@ RECORDMOD = librecord.la endif module_LTLIBRARIES = $(AFBMOD) \ - $(CFBMOD) \ libfb.la \ libwfb.la \ $(MFBMOD) \ @@ -61,14 +56,6 @@ libafb_la_LDFLAGS = -avoid-version libafb_la_LIBADD = $(top_builddir)/afb/libafb.la libafb_la_SOURCES = afbmodule.c -libcfb_la_LDFLAGS = -avoid-version -libcfb_la_LIBADD = $(top_builddir)/cfb/libcfb.la -libcfb_la_SOURCES = cfbmodule.c - -libcfb32_la_LDFLAGS = -avoid-version -libcfb32_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la -libcfb32_la_SOURCES = cfb32module.c - libdbe_la_LDFLAGS = -avoid-version libdbe_la_LIBADD = $(top_builddir)/dbe/libdbe.la libdbe_la_SOURCES = dbemodule.c diff --git a/hw/xfree86/dixmods/cfb32module.c b/hw/xfree86/dixmods/cfb32module.c deleted file mode 100644 index 23708e4c2..000000000 --- a/hw/xfree86/dixmods/cfb32module.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(cfb32Setup); - -static XF86ModuleVersionInfo VersRec = -{ - "cfb32", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_ANSIC, /* Only need the ansic layer */ - ABI_ANSIC_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} /* signature, to be patched into the file by a tool */ -}; - -_X_EXPORT XF86ModuleData cfb32ModuleData = { &VersRec, cfb32Setup, NULL }; - -static pointer -cfb32Setup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - /* This modules requires cfb, so load it */ - return LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL, - errmaj, errmin); -} diff --git a/hw/xfree86/dixmods/cfbmodule.c b/hw/xfree86/dixmods/cfbmodule.c deleted file mode 100644 index 07074c158..000000000 --- a/hw/xfree86/dixmods/cfbmodule.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(cfbSetup); - -static XF86ModuleVersionInfo VersRec = -{ - "cfb", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_ANSIC, /* Only need the ansic layer */ - ABI_ANSIC_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} /* signature, to be patched into the file by a tool */ -}; - -_X_EXPORT XF86ModuleData cfbModuleData = { &VersRec, cfbSetup, NULL }; - -static pointer -cfbSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - /* This modules requires mfb, so load it */ - return LoadSubModule(module, "mfb", NULL, NULL, NULL, NULL, - errmaj, errmin); -} diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am index f90e144ea..77af62da4 100644 --- a/hw/xfree86/dixmods/extmod/Makefile.am +++ b/hw/xfree86/dixmods/extmod/Makefile.am @@ -23,7 +23,6 @@ AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@ INCLUDES = @XORG_INCS@ \ -I$(top_srcdir)/afb \ -I$(top_srcdir)/mfb \ - -I$(top_srcdir)/cfb \ -I$(top_srcdir)/dbe \ -I$(top_srcdir)/hw/xfree86/loader \ -I$(top_srcdir)/miext/shadow diff --git a/hw/xfree86/xf8_32bpp/Makefile.am b/hw/xfree86/xf8_32bpp/Makefile.am deleted file mode 100644 index 6f51a628e..000000000 --- a/hw/xfree86/xf8_32bpp/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -module_LTLIBRARIES = libxf8_32bpp.la - -sdk_HEADERS = cfb8_32.h - -INCLUDES = $(XORG_INCS) -I$(top_srcdir)/mfb -I$(top_srcdir)/cfb - -AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) - -libxf8_32bpp_la_LDFLAGS = -avoid-version - -libxf8_32bpp_la_SOURCES = \ - cfbcpyarea.c \ - cfbcpyplane.c \ - cfbgcmisc.c \ - cfbimage.c \ - cfbpntwin.c \ - cfbscrinit.c \ - cfbwindow.c \ - xf86overlay.c \ - cfb8_32module.c \ - cfbgc8.c \ - cfbgc32.c \ - cfbgcunder.c - -libxf8_32bpp_la_LIBADD = $(top_builddir)/cfb32/libcfb32.la - -EXTRA_DIST = cfbgc.c - -cfbgc8.c: $(srcdir)/cfbgc.c - echo '#define PSZ 8' > $@ - echo '#include "$(srcdir)/cfbgc.c"' >> $@ - -cfbgc32.c: $(srcdir)/cfbgc.c - echo '#define PSZ 32' > $@ - echo '#include "$(srcdir)/cfbgc.c"' >> $@ - -DISTCLEANFILES = cfbgc8.c cfbgc32.c diff --git a/hw/xfree86/xf8_32bpp/cfb8_32.h b/hw/xfree86/xf8_32bpp/cfb8_32.h deleted file mode 100644 index 6e985da20..000000000 --- a/hw/xfree86/xf8_32bpp/cfb8_32.h +++ /dev/null @@ -1,191 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _CFB8_32_H -#define _CFB8_32_H - -#include "gcstruct.h" - -typedef struct { - GCOps *Ops8bpp; - GCOps *Ops32bpp; - unsigned long changes; - Bool OpsAre8bpp; -} cfb8_32GCRec, *cfb8_32GCPtr; - -typedef struct { - unsigned char key; - void (*EnableDisableFBAccess)(int scrnIndex, Bool enable); - pointer visualData; -} cfb8_32ScreenRec, *cfb8_32ScreenPtr; - - -extern DevPrivateKey cfb8_32GetGCPrivateKey(void); -extern DevPrivateKey cfb8_32GetScreenPrivateKey(void); - -RegionPtr -cfb8_32CopyArea( - DrawablePtr pSrcDraw, - DrawablePtr pDstDraw, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty -); - -void -cfbDoBitblt8To32( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask -); - -void -cfbDoBitblt32To8( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long planemask -); - - -void -cfb8_32ValidateGC8( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable -); - -void -cfb8_32ValidateGC32( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable -); - -void -cfb32ValidateGC_Underlay( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable -); - -Bool cfb8_32CreateGC(GCPtr pGC); - -void -cfb8_32GetSpans( - DrawablePtr pDraw, - int wMax, - DDXPointPtr ppt, - int *pwidth, - int nspans, - char *pchardstStart -); - -void -cfb8_32PutImage ( - DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, - int format, - char *pImage -); - -void -cfb8_32GetImage ( - DrawablePtr pDraw, - int sx, int sy, int w, int h, - unsigned int format, - unsigned long planeMask, - char *pdstLine -); - -Bool -cfb8_32ScreenInit ( - ScreenPtr pScreen, - pointer pbits, - int xsize, int ysize, - int dpix, int dpiy, - int width -); - -void -cfb8_32FillBoxSolid8 ( - DrawablePtr pDraw, - int nbox, - BoxPtr pBox, - unsigned long color -); - -RegionPtr -cfb8_32CopyPlane( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - unsigned long bitPlane -); - -void -cfbDoBitblt8To8GXcopy( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long pm -); - -void -cfbDoBitblt24To24GXcopy( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long pm -); - -Bool cfb8_32CreateWindow(WindowPtr pWin); -Bool cfb8_32DestroyWindow(WindowPtr pWin); - -Bool -cfb8_32PositionWindow( - WindowPtr pWin, - int x, int y -); - -void -cfb8_32CopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc -); - -Bool -cfb8_32ChangeWindowAttributes( - WindowPtr pWin, - unsigned long mask -); - - -#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \ - dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey())) - -#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey())) - -Bool xf86Overlay8Plus32Init (ScreenPtr pScreen); - -#endif /* _CFB8_32_H */ diff --git a/hw/xfree86/xf8_32bpp/cfb8_32module.c b/hw/xfree86/xf8_32bpp/cfb8_32module.c deleted file mode 100644 index 5afabe52d..000000000 --- a/hw/xfree86/xf8_32bpp/cfb8_32module.c +++ /dev/null @@ -1,39 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static MODULESETUPPROTO(xf8_32bppSetup); - -static XF86ModuleVersionInfo VersRec = -{ - "xf8_32bpp", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_ANSIC, /* Only need the ansic layer */ - ABI_ANSIC_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} /* signature, to be patched into the file by a tool */ -}; - -_X_EXPORT XF86ModuleData xf8_32bppModuleData = { - &VersRec, - xf8_32bppSetup, - NULL -}; - -static pointer -xf8_32bppSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - if (!LoadSubModule(module, "cfb", NULL, NULL, NULL, NULL, - errmaj, errmin)) - return NULL; - if (!LoadSubModule(module, "cfb32", NULL, NULL, NULL, NULL, - errmaj, errmin)) - return NULL; - return (pointer)1; /* non-NULL required to indicate success */ -} diff --git a/hw/xfree86/xf8_32bpp/cfbcpyarea.c b/hw/xfree86/xf8_32bpp/cfbcpyarea.c deleted file mode 100644 index d8f0c6d76..000000000 --- a/hw/xfree86/xf8_32bpp/cfbcpyarea.c +++ /dev/null @@ -1,549 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include -#include -#include "servermd.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "resource.h" -#include "colormap.h" -#include "colormapst.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include "mi.h" -#include "mistruct.h" -#include "dix.h" -#include "mibstore.h" - - -RegionPtr -cfb8_32CopyArea( - DrawablePtr pSrcDraw, - DrawablePtr pDstDraw, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty -){ - - if(pSrcDraw->bitsPerPixel == 32) { - if(pDstDraw->bitsPerPixel == 32) { - if((pGC->alu == GXcopy) && (pGC->planemask == 0xff000000)) { - return cfb32BitBlt (pSrcDraw, pDstDraw, - pGC, srcx, srcy, width, height, dstx, dsty, - cfbDoBitblt8To8GXcopy, 0L); - } - return(cfb32CopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy, - width, height, dstx, dsty)); - } else { - /* have to translate 32 -> 8 copies */ - return cfb32BitBlt (pSrcDraw, pDstDraw, - pGC, srcx, srcy, width, height, dstx, dsty, - cfbDoBitblt32To8, 0L); - } - } else { - if(pDstDraw->bitsPerPixel == 32) { - /* have to translate 8 -> 32 copies */ - return cfb32BitBlt (pSrcDraw, pDstDraw, - pGC, srcx, srcy, width, height, dstx, dsty, - cfbDoBitblt8To32, 0L); - } else { - return(cfbCopyArea(pSrcDraw, pDstDraw, pGC, srcx, srcy, - width, height, dstx, dsty)); - } - } -} - - - - -void -cfbDoBitblt8To32( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long pm -){ - BoxPtr pbox = REGION_RECTS(prgnDst); - int nbox = REGION_NUM_RECTS(prgnDst); - unsigned char *ptr8, *ptr32; - unsigned char *data8, *data32; - int pitch8, pitch32; - int height, width, i; - - cfbGetByteWidthAndPointer(pSrc, pitch8, ptr8); - cfbGetByteWidthAndPointer(pDst, pitch32, ptr32); - ptr32 += 3; /* point to the top byte */ - - pm >>= 24; - - if((pm == 0xff) && (rop == GXcopy)) { - for(;nbox; pbox++, pptSrc++, nbox--) { - data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x; - data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2); - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - while(height--) { - for(i = 0; i < width; i++) - data32[i << 2] = data8[i]; - data8 += pitch8; - data32 += pitch32; - } - } - } else { /* it ain't pretty, but hey */ - for(;nbox; pbox++, pptSrc++, nbox--) { - data8 = ptr8 + (pptSrc->y * pitch8) + pptSrc->x; - data32 = ptr32 + (pbox->y1 * pitch32) + (pbox->x1 << 2); - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - while(height--) { - switch(rop) { - case GXcopy: - for(i = 0; i < width; i++) - data32[i<<2] = (data8[i] & pm) | (data32[i<<2] & ~pm); - break; - case GXor: - for(i = 0; i < width; i++) - data32[i<<2] |= data8[i] & pm; - break; - case GXclear: - for(i = 0; i < width; i++) - data32[i<<2] &= ~pm; - break; - case GXand: - for(i = 0; i < width; i++) - data32[i<<2] &= data8[i] | ~pm; - break; - case GXandReverse: - for(i = 0; i < width; i++) - data32[i<<2] = ~data32[i<<2] & (data8[i] | ~pm); - break; - case GXandInverted: - for(i = 0; i < width; i++) - data32[i<<2] &= ~data8[i] | ~pm; - break; - case GXnoop: - return; - case GXxor: - for(i = 0; i < width; i++) - data32[i<<2] ^= data8[i] & pm; - break; - case GXnor: - for(i = 0; i < width; i++) - data32[i<<2] = ~(data32[i<<2] | (data8[i] & pm)); - break; - case GXequiv: - for(i = 0; i < width; i++) - data32[i<<2] = ~(data32[i<<2] ^ (data8[i] & pm)); - break; - case GXinvert: - for(i = 0; i < width; i++) - data32[i<<2] ^= pm; - break; - case GXorReverse: - for(i = 0; i < width; i++) - data32[i<<2] = ~data32[i<<2] | (data8[i] & pm); - break; - case GXcopyInverted: - for(i = 0; i < width; i++) - data32[i<<2] = (~data8[i] & pm) | (data32[i<<2] & ~pm); - break; - case GXorInverted: - for(i = 0; i < width; i++) - data32[i<<2] |= ~data8[i] & pm; - break; - case GXnand: - for(i = 0; i < width; i++) - data32[i<<2] = ~(data32[i<<2] & (data8[i] | ~pm)); - break; - case GXset: - for(i = 0; i < width; i++) - data32[i<<2] |= pm; - break; - } - data8 += pitch8; - data32 += pitch32; - } - } - } -} - - -void -cfbDoBitblt32To8( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long pm -){ - BoxPtr pbox = REGION_RECTS(prgnDst); - int nbox = REGION_NUM_RECTS(prgnDst); - unsigned char *ptr8, *ptr32; - unsigned char *data8, *data32; - int pitch8, pitch32; - int height, width, i; - - cfbGetByteWidthAndPointer(pDst, pitch8, ptr8); - cfbGetByteWidthAndPointer(pSrc, pitch32, ptr32); - ptr32 += 3; /* point to the top byte */ - - if(((pm & 0xff) == 0xff) && (rop == GXcopy)) { - for(;nbox; pbox++, pptSrc++, nbox--) { - data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1; - data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2); - - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - while(height--) { - for(i = 0; i < width; i++) - data8[i] = data32[i << 2]; - data8 += pitch8; - data32 += pitch32; - } - } - } else { - for(;nbox; pbox++, pptSrc++, nbox--) { - data8 = ptr8 + (pbox->y1 * pitch8) + pbox->x1; - data32 = ptr32 + (pptSrc->y * pitch32) + (pptSrc->x << 2); - - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - while(height--) { - switch(rop) { - case GXcopy: - for(i = 0; i < width; i++) - data8[i] = (data32[i<<2] & pm) | (data8[i] & ~pm); - break; - case GXor: - for(i = 0; i < width; i++) - data8[i] |= data32[i<<2] & pm; - break; - case GXclear: - for(i = 0; i < width; i++) - data8[i] &= ~pm; - break; - case GXand: - for(i = 0; i < width; i++) - data8[i] &= data32[i<<2] | ~pm; - break; - case GXandReverse: - for(i = 0; i < width; i++) - data8[i] = ~data8[i] & (data32[i<<2] | ~pm); - break; - case GXandInverted: - for(i = 0; i < width; i++) - data8[i] &= ~data32[i<<2] | ~pm; - break; - case GXnoop: - return; - case GXxor: - for(i = 0; i < width; i++) - data8[i] ^= data32[i<<2] & pm; - break; - case GXnor: - for(i = 0; i < width; i++) - data8[i] = ~(data8[i] | (data32[i<<2] & pm)); - break; - case GXequiv: - for(i = 0; i < width; i++) - data8[i] = ~(data8[i] ^ (data32[i<<2] & pm)); - break; - case GXinvert: - for(i = 0; i < width; i++) - data8[i] ^= pm; - break; - case GXorReverse: - for(i = 0; i < width; i++) - data8[i] = ~data8[i] | (data32[i<<2] & pm); - break; - case GXcopyInverted: - for(i = 0; i < width; i++) - data8[i] = (~data32[i<<2] & pm) | (data8[i] & ~pm); - break; - case GXorInverted: - for(i = 0; i < width; i++) - data8[i] |= ~data32[i<<2] & pm; - break; - case GXnand: - for(i = 0; i < width; i++) - data8[i] = ~(data8[i] & (data32[i<<2] | ~pm)); - break; - case GXset: - for(i = 0; i < width; i++) - data8[i] |= pm; - break; - } - data8 += pitch8; - data32 += pitch32; - } - } - } -} - - - -static void -Do8To8Blt( - unsigned char *SrcPtr, - int SrcPitch, - unsigned char *DstPtr, - int DstPitch, - int nbox, - DDXPointPtr pptSrc, - BoxPtr pbox, - int xdir, int ydir -){ - int i, j, width, height, ydir2; - CARD8 *src, *dst; - - SrcPtr += 3; - DstPtr += 3; - xdir *= 4; - ydir2 = ydir * DstPitch; - ydir *= SrcPitch; - - for(;nbox; pbox++, pptSrc++, nbox--) { - src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2); - dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2); - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - if(ydir < 0) { - src += (height - 1) * SrcPitch; - dst += (height - 1) * DstPitch; - } - - if(xdir < 0) { - register int tmp = (width - 1) << 2; - src += tmp; - dst += tmp; - } - - while(height--) { - for(i = width, j = 0; i--; j+=xdir) - dst[j] = src[j]; - src += ydir; - dst += ydir2; - } - } -} - -static void -Do24To24Blt( - unsigned char *SrcPtr, - int SrcPitch, - unsigned char *DstPtr, - int DstPitch, - int nbox, - DDXPointPtr pptSrc, - BoxPtr pbox, - int xdir, int ydir -){ - int i, j, width, height, ydir2; - CARD8 *src, *dst; - - xdir *= 4; - ydir2 = ydir * DstPitch; - ydir *= SrcPitch; - - for(;nbox; pbox++, pptSrc++, nbox--) { - src = SrcPtr + (pptSrc->y * SrcPitch) + (pptSrc->x << 2); - dst = DstPtr + (pbox->y1 * DstPitch) + (pbox->x1 << 2); - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - if(ydir < 0) { - src += (height - 1) * SrcPitch; - dst += (height - 1) * DstPitch; - } - - if(xdir < 0) { - register int tmp = (width - 1) << 2; - src += tmp; - dst += tmp; - } - - while(height--) { - for(i = width, j = 0; i--; j+=xdir) { - *((CARD16*)(dst + j)) = *((CARD32*)(src + j)); - dst[j + 2] = src[j + 2]; - } - src += ydir; - dst += ydir2; - } - } -} - - -static void -cfb8_32DoBitBlt( - DrawablePtr pSrc, - DrawablePtr pDst, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - void (*DoBlt)( - unsigned char *SrcPtr, - int SrcPitch, - unsigned char *DstPtr, - int DstPitch, - int nbox, - DDXPointPtr pptSrc, - BoxPtr pbox, - int xdir, int ydir) -){ - int nbox, careful, SrcPitch, DstPitch; - BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - DDXPointPtr pptTmp, pptNew1, pptNew2; - int xdir, ydir; - unsigned char *SrcPtr, *DstPtr; - - /* XXX we have to err on the side of safety when both are windows, - * because we don't know if IncludeInferiors is being used. - */ - careful = ((pSrc == pDst) || - ((pSrc->type == DRAWABLE_WINDOW) && - (pDst->type == DRAWABLE_WINDOW))); - - pbox = REGION_RECTS(prgnDst); - nbox = REGION_NUM_RECTS(prgnDst); - - pboxNew1 = NULL; - pptNew1 = NULL; - pboxNew2 = NULL; - pptNew2 = NULL; - if (careful && (pptSrc->y < pbox->y1)) { - /* walk source botttom to top */ - ydir = -1; - - if (nbox > 1) { - /* keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); - if(!pboxNew1) - return; - pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); - if(!pptNew1) { - xfree(pboxNew1); - return; - } - pboxBase = pboxNext = pbox+nbox-1; - while (pboxBase >= pbox) { - while ((pboxNext >= pbox) && - (pboxBase->y1 == pboxNext->y1)) - pboxNext--; - pboxTmp = pboxNext+1; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp <= pboxBase) { - *pboxNew1++ = *pboxTmp++; - *pptNew1++ = *pptTmp++; - } - pboxBase = pboxNext; - } - pboxNew1 -= nbox; - pbox = pboxNew1; - pptNew1 -= nbox; - pptSrc = pptNew1; - } - } else { - /* walk source top to bottom */ - ydir = 1; - } - - if (careful && (pptSrc->x < pbox->x1)) { - /* walk source right to left */ - xdir = -1; - - if (nbox > 1) { - /* reverse order of rects in each band */ - pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox); - pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox); - if(!pboxNew2 || !pptNew2) { - if (pptNew2) xfree(pptNew2); - if (pboxNew2) xfree(pboxNew2); - if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); - } - return; - } - pboxBase = pboxNext = pbox; - while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && - (pboxNext->y1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp != pboxBase) { - *pboxNew2++ = *--pboxTmp; - *pptNew2++ = *--pptTmp; - } - pboxBase = pboxNext; - } - pboxNew2 -= nbox; - pbox = pboxNew2; - pptNew2 -= nbox; - pptSrc = pptNew2; - } - } else { - /* walk source left to right */ - xdir = 1; - } - - cfbGetByteWidthAndPointer(pSrc, SrcPitch, SrcPtr); - cfbGetByteWidthAndPointer(pDst, DstPitch, DstPtr); - - (*DoBlt)(SrcPtr,SrcPitch,DstPtr,DstPitch,nbox,pptSrc,pbox,xdir,ydir); - - if (pboxNew2) { - xfree(pptNew2); - xfree(pboxNew2); - } - if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); - } - -} - - -/* A couple routines to speed up full planemask copies */ - -void -cfbDoBitblt8To8GXcopy( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long pm -){ - cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do8To8Blt); -} - - -void -cfbDoBitblt24To24GXcopy( - DrawablePtr pSrc, - DrawablePtr pDst, - int rop, - RegionPtr prgnDst, - DDXPointPtr pptSrc, - unsigned long pm -){ - cfb8_32DoBitBlt(pSrc, pDst, prgnDst, pptSrc, Do24To24Blt); -} diff --git a/hw/xfree86/xf8_32bpp/cfbcpyplane.c b/hw/xfree86/xf8_32bpp/cfbcpyplane.c deleted file mode 100644 index e10b52525..000000000 --- a/hw/xfree86/xf8_32bpp/cfbcpyplane.c +++ /dev/null @@ -1,41 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "gcstruct.h" -#include "windowstr.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "regionstr.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include "mi.h" - - -RegionPtr -cfb8_32CopyPlane( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - unsigned long bitPlane -){ - /* There's actually much more to it than this */ - - if((pDst->bitsPerPixel == 8) && (pSrc->bitsPerPixel != 32)){ - return(cfbCopyPlane(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)); - } - - - return(miCopyPlane (pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)); -} diff --git a/hw/xfree86/xf8_32bpp/cfbgc.c b/hw/xfree86/xf8_32bpp/cfbgc.c deleted file mode 100644 index a7787caa9..000000000 --- a/hw/xfree86/xf8_32bpp/cfbgc.c +++ /dev/null @@ -1,646 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - - -/* - -PSZ 8 16 24 32 -PIXEL_ADDR True True True True -NO_ONE_RECT False False False False -WriteBitGroup True True True True -FOUR_BIT_CODE True False False False -LOWMEMFTPT False False False False - -*/ - - -/* This gets built twice. Once for 8bpp and another for 32bpp */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "region.h" - -#include "mistruct.h" -#include "mibstore.h" -#include "migc.h" -#include "mioverlay.h" - -#include "cfb8_32.h" -#include "cfbmskbits.h" -#include "cfb8bit.h" - - -#if PSZ == 8 -# define useTEGlyphBlt cfbTEGlyphBlt8 -#else -# ifdef WriteBitGroup -# define useTEGlyphBlt cfbImageGlyphBlt8 -# else -# define useTEGlyphBlt cfbTEGlyphBlt -# endif -#endif - -#ifdef WriteBitGroup -# define useImageGlyphBlt cfbImageGlyphBlt8 -# define usePolyGlyphBlt cfbPolyGlyphBlt8 -#else -# define useImageGlyphBlt miImageGlyphBlt -# define usePolyGlyphBlt miPolyGlyphBlt -#endif - -#ifdef FOUR_BIT_CODE -# define usePushPixels cfbPushPixels8 -#else -# define usePushPixels mfbPushPixels -#endif - -#ifdef PIXEL_ADDR -# define ZeroPolyArc cfbZeroPolyArcSS8Copy -#else -# define ZeroPolyArc miZeroPolyArc -#endif - - -static GCOps cfb8_32TEOps1Rect = { - cfbSolidSpansCopy, - cfbSetSpans, - cfb8_32PutImage, - cfb8_32CopyArea, - cfb8_32CopyPlane, - cfbPolyPoint, -#ifdef PIXEL_ADDR - cfb8LineSS1Rect, - cfb8SegmentSS1Rect, -#else - cfbLineSS, - cfbSegmentSS, -#endif - miPolyRectangle, - ZeroPolyArc, - cfbFillPoly1RectCopy, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useTEGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps cfb8_32NonTEOps1Rect = { - cfbSolidSpansCopy, - cfbSetSpans, - cfb8_32PutImage, - cfb8_32CopyArea, - cfb8_32CopyPlane, - cfbPolyPoint, -#ifdef PIXEL_ADDR - cfb8LineSS1Rect, - cfb8SegmentSS1Rect, -#else - cfbLineSS, - cfbSegmentSS, -#endif - miPolyRectangle, - ZeroPolyArc, - cfbFillPoly1RectCopy, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useImageGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps cfb8_32TEOps = { - cfbSolidSpansCopy, - cfbSetSpans, - cfb8_32PutImage, - cfb8_32CopyArea, - cfb8_32CopyPlane, - cfbPolyPoint, - cfbLineSS, - cfbSegmentSS, - miPolyRectangle, - ZeroPolyArc, - miFillPolygon, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useTEGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps cfb8_32NonTEOps = { - cfbSolidSpansCopy, - cfbSetSpans, - cfb8_32PutImage, - cfb8_32CopyArea, - cfb8_32CopyPlane, - cfbPolyPoint, - cfbLineSS, - cfbSegmentSS, - miPolyRectangle, -#ifdef PIXEL_ADDR - cfbZeroPolyArcSS8Copy, -#else - miZeroPolyArc, -#endif - miFillPolygon, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useImageGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps * -cfb8_32MatchCommon (GCPtr pGC, cfbPrivGCPtr devPriv) -{ - if (pGC->lineWidth != 0) - return 0; - if (pGC->lineStyle != LineSolid) - return 0; - if (pGC->fillStyle != FillSolid) - return 0; - if (devPriv->rop != GXcopy) - return 0; - if (pGC->font && - FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 && - FONTMINBOUNDS(pGC->font,characterWidth) >= 0) - { - if (TERMINALFONT(pGC->font) -#ifdef FOUR_BIT_CODE - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB -#endif - ) -#ifdef NO_ONE_RECT - return &cfb8_32TEOps1Rect; -#else - if (devPriv->oneRect) - return &cfb8_32TEOps1Rect; - else - return &cfb8_32TEOps; -#endif - else -#ifdef NO_ONE_RECT - return &cfb8_32NonTEOps1Rect; -#else - if (devPriv->oneRect) - return &cfb8_32NonTEOps1Rect; - else - return &cfb8_32NonTEOps; -#endif - } - return 0; -} - - -/* Clipping conventions - if the drawable is a window - CT_REGION ==> pCompositeClip really is the composite - CT_other ==> pCompositeClip is the window clip region - if the drawable is a pixmap - CT_REGION ==> pCompositeClip is the translated client region - clipped to the pixmap boundary - CT_other ==> pCompositeClip is the pixmap bounding box -*/ - -void -#if PSZ == 8 -cfb8_32ValidateGC8( -#else -cfb8_32ValidateGC32( -#endif - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable -){ - int mask; /* stateChanges */ - int index; /* used for stepping through bitfields */ - int new_rrop; - int new_line, new_text, new_fillspans, new_fillarea; - /* flags for changing the proc vector */ - cfbPrivGCPtr devPriv; - int oneRect; - - pGC->lastWinOrg.x = pDrawable->x; - pGC->lastWinOrg.y = pDrawable->y; - devPriv = cfbGetGCPrivate(pGC); - - new_rrop = FALSE; - new_line = FALSE; - new_text = FALSE; - new_fillspans = FALSE; - new_fillarea = FALSE; - - /* - * if the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last validation - * we need to recompute the composite clip - */ - - if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || - (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) - { - miComputeCompositeClip (pGC, pDrawable); -#ifdef NO_ONE_RECT - devPriv->oneRect = FALSE; -#else - oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1; - if (oneRect != devPriv->oneRect) - new_line = TRUE; - devPriv->oneRect = oneRect; -#endif - } - - mask = changes; - while (mask) { - index = lowbit (mask); - mask &= ~index; - - switch (index) { - case GCFunction: - case GCForeground: - new_rrop = TRUE; - break; - case GCPlaneMask: - new_rrop = TRUE; - new_text = TRUE; - break; - case GCBackground: - break; - case GCLineStyle: - case GCLineWidth: - new_line = TRUE; - break; - case GCJoinStyle: - case GCCapStyle: - break; - case GCFillStyle: - new_text = TRUE; - new_fillspans = TRUE; - new_line = TRUE; - new_fillarea = TRUE; - break; - case GCFillRule: - break; - case GCTile: - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - case GCStipple: - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - case GCTileStipXOrigin: - case GCTileStipYOrigin: - break; - case GCFont: - new_text = TRUE; - break; - case GCSubwindowMode: - case GCGraphicsExposures: - case GCClipXOrigin: - case GCClipYOrigin: - case GCClipMask: - case GCDashOffset: - case GCDashList: - case GCArcMode: - default: - break; - } - } - - /* - * If the drawable has changed, ensure suitable - * entries are in the proc vector. - */ - if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) - new_fillspans = TRUE; /* deal with FillSpans later */ - - if (new_rrop) - { - int old_rrop; - - old_rrop = devPriv->rop; - devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, - pGC->planemask, - &devPriv->and, &devPriv->xor); - if (old_rrop == devPriv->rop) - new_rrop = FALSE; - else - { -#ifdef PIXEL_ADDR - new_line = TRUE; -#endif -#ifdef WriteBitGroup - new_text = TRUE; -#endif - new_fillspans = TRUE; - new_fillarea = TRUE; - } - } - - if(!pGC->ops) - pGC->ops = & cfb8_32NonTEOps; - - if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) - { - GCOps *newops; - - if ((newops = cfb8_32MatchCommon (pGC, devPriv))) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; - } - else - { - if (!pGC->ops->devPrivate.val) - { - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - } - } - - /* deal with the changes we've collected */ - if (new_line) - { - pGC->ops->FillPolygon = miFillPolygon; -#ifdef NO_ONE_RECT - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = cfbFillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; - break; - } - } -#else - if (devPriv->oneRect && pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = cfbFillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; - break; - } - } -#endif - if (pGC->lineWidth == 0) - { -#ifdef PIXEL_ADDR - if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) - { - switch (devPriv->rop) - { - case GXxor: - pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor; - break; - case GXcopy: - pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy; - break; - default: - pGC->ops->PolyArc = cfbZeroPolyArcSS8General; - break; - } - } - else -#endif - pGC->ops->PolyArc = miZeroPolyArc; - } - else - pGC->ops->PolyArc = miPolyArc; - pGC->ops->PolySegment = miPolySegment; - switch (pGC->lineStyle) - { - case LineSolid: - if(pGC->lineWidth == 0) - { - if (pGC->fillStyle == FillSolid) - { -#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT) - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - { - pGC->ops->Polylines = cfb8LineSS1Rect; - pGC->ops->PolySegment = cfb8SegmentSS1Rect; - } else -#endif -#ifdef NO_ONE_RECT - { - pGC->ops->Polylines = cfb8LineSS1Rect; - pGC->ops->PolySegment = cfb8SegmentSS1Rect; - } -#else - { - pGC->ops->Polylines = cfbLineSS; - pGC->ops->PolySegment = cfbSegmentSS; - } -#endif - } - else - pGC->ops->Polylines = miZeroLine; - } - else - pGC->ops->Polylines = miWideLine; - break; - case LineOnOffDash: - case LineDoubleDash: - if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) - { - pGC->ops->Polylines = cfbLineSD; - pGC->ops->PolySegment = cfbSegmentSD; - } else - pGC->ops->Polylines = miWideDash; - break; - } - } - - if (new_text && (pGC->font)) - { - if (FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0) - { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - else - { -#ifdef WriteBitGroup - if (pGC->fillStyle == FillSolid) - { - if (devPriv->rop == GXcopy) - pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8; - else -#ifdef FOUR_BIT_CODE - pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8; -#else - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; -#endif - } - else -#endif - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - /* special case ImageGlyphBlt for terminal emulator fonts */ -#if !defined(WriteBitGroup) || PSZ == 8 - if (TERMINALFONT(pGC->font) && - (pGC->planemask & PMSK) == PMSK -#ifdef FOUR_BIT_CODE - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB -#endif - ) - { - pGC->ops->ImageGlyphBlt = useTEGlyphBlt; - } - else -#endif - { -#ifdef WriteBitGroup - if (devPriv->rop == GXcopy && - pGC->fillStyle == FillSolid && - (pGC->planemask & PMSK) == PMSK) - pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8; - else -#endif - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - } - } - - - if (new_fillspans) { - switch (pGC->fillStyle) { - case FillSolid: - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillSpans = cfbSolidSpansCopy; - break; - case GXxor: - pGC->ops->FillSpans = cfbSolidSpansXor; - break; - default: - pGC->ops->FillSpans = cfbSolidSpansGeneral; - break; - } - break; - case FillTiled: - pGC->ops->FillSpans = cfbUnnaturalTileFS; - break; - case FillStippled: - case FillOpaqueStippled: - pGC->ops->FillSpans = cfbUnnaturalStippleFS; - break; - default: - FatalError("cfbValidateGC: illegal fillStyle\n"); - } - } /* end of new_fillspans */ - - if (new_fillarea) { -#ifndef FOUR_BIT_CODE - pGC->ops->PolyFillRect = miPolyFillRect; - if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) - { - pGC->ops->PolyFillRect = cfbPolyFillRect; - } -#endif -#ifdef FOUR_BIT_CODE - pGC->ops->PushPixels = mfbPushPixels; - if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy) - pGC->ops->PushPixels = cfbPushPixels8; -#endif - pGC->ops->PolyFillArc = miPolyFillArc; - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) - { - case GXcopy: - pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy; - break; - default: - pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral; - break; - } - } - } -} diff --git a/hw/xfree86/xf8_32bpp/cfbgcmisc.c b/hw/xfree86/xf8_32bpp/cfbgcmisc.c deleted file mode 100644 index f009afc0c..000000000 --- a/hw/xfree86/xf8_32bpp/cfbgcmisc.c +++ /dev/null @@ -1,150 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include -#include -#include -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "region.h" - -#include "mistruct.h" -#include "mibstore.h" -#include "migc.h" - - -static void cfb8_32ValidateGC(GCPtr, unsigned long, DrawablePtr); -static void cfb8_32DestroyGC(GCPtr pGC); -static void cfb32DestroyGC_Underlay(GCPtr pGC); - -static -GCFuncs cfb8_32GCFuncs = { - cfb8_32ValidateGC, - miChangeGC, - miCopyGC, - cfb8_32DestroyGC, - miChangeClip, - miDestroyClip, - miCopyClip, -}; - - -static -GCFuncs cfb32GCFuncs_Underlay = { - cfb32ValidateGC_Underlay, - miChangeGC, - miCopyGC, - cfb32DestroyGC_Underlay, - miChangeClip, - miDestroyClip, - miCopyClip, -}; - -static void -cfb32DestroyGC_Underlay(GCPtr pGC) -{ - if (pGC->freeCompClip) - REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); - - if(pGC->ops) - miDestroyGCOps(pGC->ops); -} - - -static void -cfb8_32DestroyGC(GCPtr pGC) -{ - cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC); - - if (pGC->freeCompClip) - REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); - if(pGCPriv->Ops8bpp) - miDestroyGCOps(pGCPriv->Ops8bpp); - if(pGCPriv->Ops32bpp) - miDestroyGCOps(pGCPriv->Ops32bpp); -} - -Bool -cfb8_32CreateGC(GCPtr pGC) -{ - cfb8_32GCPtr pGCPriv; - cfbPrivGC *pPriv; - - if (PixmapWidthPaddingInfo[pGC->depth].padPixelsLog2 == LOG2_BITMAP_PAD) - return (mfbCreateGC(pGC)); - - pGC->clientClip = NULL; - pGC->clientClipType = CT_NONE; - pGC->miTranslate = 1; - pGC->fExpose = TRUE; - pGC->freeCompClip = FALSE; - pGC->pRotatedPixmap = (PixmapPtr) NULL; - - pPriv = cfbGetGCPrivate(pGC); - pPriv->rop = pGC->alu; - pPriv->oneRect = FALSE; - - pGC->ops = NULL; - - if (pGC->depth == 8) { - pGC->funcs = &cfb8_32GCFuncs; - - pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC); - pGCPriv->Ops8bpp = NULL; - pGCPriv->Ops32bpp = NULL; - pGCPriv->OpsAre8bpp = FALSE; - pGCPriv->changes = 0; - } else - pGC->funcs = &cfb32GCFuncs_Underlay; - - return TRUE; -} - - -static void -cfb8_32ValidateGC( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDraw -){ - cfb8_32GCPtr pGCPriv = CFB8_32_GET_GC_PRIVATE(pGC); - - if(pDraw->bitsPerPixel == 32) { - if(pGCPriv->OpsAre8bpp) { - int origChanges = changes; - pGC->ops = pGCPriv->Ops32bpp; - changes |= pGCPriv->changes; - pGCPriv->changes = origChanges; - pGCPriv->OpsAre8bpp = FALSE; - } else - pGCPriv->changes |= changes; - - cfb8_32ValidateGC32(pGC, changes, pDraw); - pGCPriv->Ops32bpp = pGC->ops; - } else { /* bitsPerPixel == 8 */ - if(!pGCPriv->OpsAre8bpp) { - int origChanges = changes; - pGC->ops = pGCPriv->Ops8bpp; - changes |= pGCPriv->changes; - pGCPriv->changes = origChanges; - pGCPriv->OpsAre8bpp = TRUE; - } else - pGCPriv->changes |= changes; - - cfb8_32ValidateGC8(pGC, changes, pDraw); - pGCPriv->Ops8bpp = pGC->ops; - } -} - diff --git a/hw/xfree86/xf8_32bpp/cfbgcunder.c b/hw/xfree86/xf8_32bpp/cfbgcunder.c deleted file mode 100644 index d90321355..000000000 --- a/hw/xfree86/xf8_32bpp/cfbgcunder.c +++ /dev/null @@ -1,620 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -#define PSZ 32 - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include "cfb.h" -#include -#include "dixfontstr.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "region.h" - -#include "mistruct.h" -#include "mibstore.h" -#include "migc.h" -#include "mioverlay.h" - -#include "cfbmskbits.h" -#include "cfb8bit.h" -#include "cfb8_32.h" - -#ifdef WriteBitGroup -# define useTEGlyphBlt cfbImageGlyphBlt8 -#else -# define useTEGlyphBlt cfbTEGlyphBlt -#endif - -#ifdef WriteBitGroup -# define useImageGlyphBlt cfbImageGlyphBlt8 -# define usePolyGlyphBlt cfbPolyGlyphBlt8 -#else -# define useImageGlyphBlt miImageGlyphBlt -# define usePolyGlyphBlt miPolyGlyphBlt -#endif - -#ifdef FOUR_BIT_CODE -# define usePushPixels cfbPushPixels8 -#else -# define usePushPixels mfbPushPixels -#endif - -#ifdef PIXEL_ADDR -# define ZeroPolyArc cfbZeroPolyArcSS8Copy -#else -# define ZeroPolyArc miZeroPolyArc -#endif - - -static GCOps cfbTEOps1Rect = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, -#ifdef PIXEL_ADDR - cfb8LineSS1Rect, - cfb8SegmentSS1Rect, -#else - cfbLineSS, - cfbSegmentSS, -#endif - miPolyRectangle, - ZeroPolyArc, - cfbFillPoly1RectCopy, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useTEGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps cfbNonTEOps1Rect = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, -#ifdef PIXEL_ADDR - cfb8LineSS1Rect, - cfb8SegmentSS1Rect, -#else - cfbLineSS, - cfbSegmentSS, -#endif - miPolyRectangle, - ZeroPolyArc, - cfbFillPoly1RectCopy, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useImageGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps cfbTEOps = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, - cfbLineSS, - cfbSegmentSS, - miPolyRectangle, - ZeroPolyArc, - miFillPolygon, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useTEGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps cfbNonTEOps = { - cfbSolidSpansCopy, - cfbSetSpans, - cfbPutImage, - cfbCopyArea, - cfbCopyPlane, - cfbPolyPoint, - cfbLineSS, - cfbSegmentSS, - miPolyRectangle, -#ifdef PIXEL_ADDR - cfbZeroPolyArcSS8Copy, -#else - miZeroPolyArc, -#endif - miFillPolygon, - cfbPolyFillRect, - cfbPolyFillArcSolidCopy, - miPolyText8, - miPolyText16, - miImageText8, - miImageText16, - useImageGlyphBlt, - usePolyGlyphBlt, - usePushPixels -}; - -static GCOps * -cfb32MatchCommon_Underlay( - GCPtr pGC, - cfbPrivGCPtr devPriv) -{ - if (pGC->lineWidth != 0) - return 0; - if (pGC->lineStyle != LineSolid) - return 0; - if (pGC->fillStyle != FillSolid) - return 0; - if (devPriv->rop != GXcopy) - return 0; - if (pGC->font && - FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 && - FONTMINBOUNDS(pGC->font,characterWidth) >= 0) - { - if (TERMINALFONT(pGC->font) -#ifdef FOUR_BIT_CODE - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB -#endif - ) -#ifdef NO_ONE_RECT - return &cfbTEOps1Rect; -#else - if (devPriv->oneRect) - return &cfbTEOps1Rect; - else - return &cfbTEOps; -#endif - else -#ifdef NO_ONE_RECT - return &cfbNonTEOps1Rect; -#else - if (devPriv->oneRect) - return &cfbNonTEOps1Rect; - else - return &cfbNonTEOps; -#endif - } - return 0; -} - - -void -cfb32ValidateGC_Underlay( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDrawable -){ - int mask; /* stateChanges */ - int index; /* used for stepping through bitfields */ - int new_rrop; - int new_line, new_text, new_fillspans, new_fillarea; - /* flags for changing the proc vector */ - cfbPrivGCPtr devPriv; - int oneRect; - - pGC->lastWinOrg.x = pDrawable->x; - pGC->lastWinOrg.y = pDrawable->y; - devPriv = cfbGetGCPrivate(pGC); - - new_rrop = FALSE; - new_line = FALSE; - new_text = FALSE; - new_fillspans = FALSE; - new_fillarea = FALSE; - - /* - * if the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last validation - * we need to recompute the composite clip - */ - - if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || - (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS)) - ) - { - if(pDrawable->type == DRAWABLE_WINDOW) - miOverlayComputeCompositeClip (pGC, (WindowPtr)pDrawable); - else - miComputeCompositeClip (pGC, pDrawable); -#ifdef NO_ONE_RECT - devPriv->oneRect = FALSE; -#else - oneRect = REGION_NUM_RECTS(pGC->pCompositeClip) == 1; - if (oneRect != devPriv->oneRect) - new_line = TRUE; - devPriv->oneRect = oneRect; -#endif - } - - mask = changes; - while (mask) { - index = lowbit (mask); - mask &= ~index; - - switch (index) { - case GCFunction: - case GCForeground: - new_rrop = TRUE; - break; - case GCPlaneMask: - new_rrop = TRUE; - new_text = TRUE; - break; - case GCBackground: - break; - case GCLineStyle: - case GCLineWidth: - new_line = TRUE; - break; - case GCJoinStyle: - case GCCapStyle: - break; - case GCFillStyle: - new_text = TRUE; - new_fillspans = TRUE; - new_line = TRUE; - new_fillarea = TRUE; - break; - case GCFillRule: - break; - case GCTile: - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - case GCStipple: - new_fillspans = TRUE; - new_fillarea = TRUE; - break; - case GCTileStipXOrigin: - case GCTileStipYOrigin: - break; - case GCFont: - new_text = TRUE; - break; - case GCSubwindowMode: - case GCGraphicsExposures: - case GCClipXOrigin: - case GCClipYOrigin: - case GCClipMask: - case GCDashOffset: - case GCDashList: - case GCArcMode: - default: - break; - } - } - - /* - * If the drawable has changed, ensure suitable - * entries are in the proc vector. - */ - if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) - new_fillspans = TRUE; /* deal with FillSpans later */ - - if (new_rrop) - { - int old_rrop; - - old_rrop = devPriv->rop; - devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, - pGC->planemask, - &devPriv->and, &devPriv->xor); - if (old_rrop == devPriv->rop) - new_rrop = FALSE; - else - { -#ifdef PIXEL_ADDR - new_line = TRUE; -#endif -#ifdef WriteBitGroup - new_text = TRUE; -#endif - new_fillspans = TRUE; - new_fillarea = TRUE; - } - } - - if(!pGC->ops) - pGC->ops = & cfbNonTEOps; - - - if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) - { - GCOps *newops; - - if ((newops = cfb32MatchCommon_Underlay (pGC, devPriv))) - { - if (pGC->ops->devPrivate.val) - miDestroyGCOps (pGC->ops); - pGC->ops = newops; - new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; - } - else - { - if (!pGC->ops->devPrivate.val) - { - pGC->ops = miCreateGCOps (pGC->ops); - pGC->ops->devPrivate.val = 1; - } - } - } - - /* deal with the changes we've collected */ - if (new_line) - { - pGC->ops->FillPolygon = miFillPolygon; -#ifdef NO_ONE_RECT - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = cfbFillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; - break; - } - } -#else - if (devPriv->oneRect && pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillPolygon = cfbFillPoly1RectCopy; - break; - default: - pGC->ops->FillPolygon = cfbFillPoly1RectGeneral; - break; - } - } -#endif - if (pGC->lineWidth == 0) - { -#ifdef PIXEL_ADDR - if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) - { - switch (devPriv->rop) - { - case GXxor: - pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor; - break; - case GXcopy: - pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy; - break; - default: - pGC->ops->PolyArc = cfbZeroPolyArcSS8General; - break; - } - } - else -#endif - pGC->ops->PolyArc = miZeroPolyArc; - } - else - pGC->ops->PolyArc = miPolyArc; - pGC->ops->PolySegment = miPolySegment; - switch (pGC->lineStyle) - { - case LineSolid: - if(pGC->lineWidth == 0) - { - if (pGC->fillStyle == FillSolid) - { -#if defined(PIXEL_ADDR) && !defined(NO_ONE_RECT) - if (devPriv->oneRect && - ((pDrawable->x >= pGC->pScreen->width - 32768) && - (pDrawable->y >= pGC->pScreen->height - 32768))) - { - pGC->ops->Polylines = cfb8LineSS1Rect; - pGC->ops->PolySegment = cfb8SegmentSS1Rect; - } else -#endif -#ifdef NO_ONE_RECT - { - pGC->ops->Polylines = cfb8LineSS1Rect; - pGC->ops->PolySegment = cfb8SegmentSS1Rect; - } -#else - { - pGC->ops->Polylines = cfbLineSS; - pGC->ops->PolySegment = cfbSegmentSS; - } -#endif - } - else - pGC->ops->Polylines = miZeroLine; - } - else - pGC->ops->Polylines = miWideLine; - break; - case LineOnOffDash: - case LineDoubleDash: - if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) - { - pGC->ops->Polylines = cfbLineSD; - pGC->ops->PolySegment = cfbSegmentSD; - } else - pGC->ops->Polylines = miWideDash; - break; - } - } - - if (new_text && (pGC->font)) - { - if (FONTMAXBOUNDS(pGC->font,rightSideBearing) - - FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || - FONTMINBOUNDS(pGC->font,characterWidth) < 0) - { - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - else - { -#ifdef WriteBitGroup - if (pGC->fillStyle == FillSolid) - { - if (devPriv->rop == GXcopy) - pGC->ops->PolyGlyphBlt = cfbPolyGlyphBlt8; - else -#ifdef FOUR_BIT_CODE - pGC->ops->PolyGlyphBlt = cfbPolyGlyphRop8; -#else - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; -#endif - } - else -#endif - pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; - /* special case ImageGlyphBlt for terminal emulator fonts */ -#if !defined(WriteBitGroup) || PSZ == 8 - if (TERMINALFONT(pGC->font) && - (pGC->planemask & PMSK) == PMSK -#ifdef FOUR_BIT_CODE - && FONTMAXBOUNDS(pGC->font,characterWidth) >= PGSZB -#endif - ) - { - pGC->ops->ImageGlyphBlt = useTEGlyphBlt; - } - else -#endif - { -#ifdef WriteBitGroup - if (devPriv->rop == GXcopy && - pGC->fillStyle == FillSolid && - (pGC->planemask & PMSK) == PMSK) - pGC->ops->ImageGlyphBlt = cfbImageGlyphBlt8; - else -#endif - pGC->ops->ImageGlyphBlt = miImageGlyphBlt; - } - } - } - - - if (new_fillspans) { - switch (pGC->fillStyle) { - case FillSolid: - switch (devPriv->rop) { - case GXcopy: - pGC->ops->FillSpans = cfbSolidSpansCopy; - break; - case GXxor: - pGC->ops->FillSpans = cfbSolidSpansXor; - break; - default: - pGC->ops->FillSpans = cfbSolidSpansGeneral; - break; - } - break; - case FillTiled: - pGC->ops->FillSpans = cfbUnnaturalTileFS; - break; - case FillStippled: - case FillOpaqueStippled: - pGC->ops->FillSpans = cfbUnnaturalStippleFS; - break; - default: - FatalError("cfbValidateGC: illegal fillStyle\n"); - } - } /* end of new_fillspans */ - - if (new_fillarea) { -#ifndef FOUR_BIT_CODE - pGC->ops->PolyFillRect = miPolyFillRect; - if (pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) - { - pGC->ops->PolyFillRect = cfbPolyFillRect; - } -#endif -#ifdef FOUR_BIT_CODE - pGC->ops->PushPixels = mfbPushPixels; - if (pGC->fillStyle == FillSolid && devPriv->rop == GXcopy) - pGC->ops->PushPixels = cfbPushPixels8; -#endif - pGC->ops->PolyFillArc = miPolyFillArc; - if (pGC->fillStyle == FillSolid) - { - switch (devPriv->rop) - { - case GXcopy: - pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy; - break; - default: - pGC->ops->PolyFillArc = cfbPolyFillArcSolidGeneral; - break; - } - } - } -} diff --git a/hw/xfree86/xf8_32bpp/cfbimage.c b/hw/xfree86/xf8_32bpp/cfbimage.c deleted file mode 100644 index 01a5a5eb6..000000000 --- a/hw/xfree86/xf8_32bpp/cfbimage.c +++ /dev/null @@ -1,174 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include -#include "windowstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include "servermd.h" -#include "mi.h" - - -void -cfb8_32GetImage ( - DrawablePtr pDraw, - int sx, int sy, int w, int h, - unsigned int format, - unsigned long planemask, - char *pdstLine -){ - if(!w || !h) return; - - if (!cfbDrawableEnabled (pDraw)) - return; - - if(pDraw->depth == 24){ - cfb32GetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine); - return; - } - - if((pDraw->bitsPerPixel == 8) || (pDraw->bitsPerPixel == 1)){ - cfbGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine); - return; - } - - /* source is depth 8, 32 bpp */ - if(format != ZPixmap) { - miGetImage(pDraw, sx, sy, w, h, format, planemask, pdstLine); - return; - } else { - BoxRec box; - DDXPointRec ptSrc; - RegionRec rgnDst; - ScreenPtr pScreen; - PixmapPtr pPixmap; - - pScreen = pDraw->pScreen; - pPixmap = GetScratchPixmapHeader(pScreen, w, h, 8, 8, - PixmapBytePad(w,8), (pointer)pdstLine); - if (!pPixmap) - return; - if ((planemask & 0xff) != 0xff) - memset((char *)pdstLine, 0, pPixmap->devKind * h); - ptSrc.x = sx + pDraw->x; - ptSrc.y = sy + pDraw->y; - box.x1 = 0; - box.y1 = 0; - box.x2 = w; - box.y2 = h; - REGION_INIT(pScreen, &rgnDst, &box, 1); - cfbDoBitblt32To8(pDraw, (DrawablePtr)pPixmap, GXcopy, &rgnDst, - &ptSrc, planemask); - REGION_UNINIT(pScreen, &rgnDst); - FreeScratchPixmapHeader(pPixmap); - } -} - -void -cfb8_32PutImage ( - DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, - int format, - char *pImage -){ - if(!w || !h) return; - - if((pDraw->bitsPerPixel == 8) || (format != XYPixmap)){ - cfbPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage); - return; - } else { /* moving an 8bpp XYPixmap to a 32bpp screen */ - unsigned long oldFg, oldBg; - XID gcv[3]; - unsigned long oldPlanemask; - unsigned long i; - long bytesPer; - - 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 = 0x80000000; i & 0xff000000; i >>= 1, pImage += bytesPer) - { - if (i & oldPlanemask) - { - gcv[0] = i; - DoChangeGC(pGC, GCPlaneMask, gcv, 0); - ValidateGC(pDraw, pGC); - (*pGC->ops->PutImage)(pDraw, 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); - ValidateGC(pDraw, pGC); - } -} - - - - -void -cfb8_32GetSpans( - DrawablePtr pDraw, - int wMax, - DDXPointPtr ppt, - int *pwidth, - int nspans, - char *pDst -){ - int pitch, i; - CARD8 *ptr, *ptrBase; - - if (!cfbDrawableEnabled (pDraw)) - return; - - if(pDraw->bitsPerPixel == 1) { - mfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst); - return; - } - - if(pDraw->depth == 24) { - cfb32GetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst); - return; - } else if(pDraw->bitsPerPixel == 8) { - cfbGetSpans(pDraw, wMax, ppt, pwidth, nspans, pDst); - return; - } - - /* gotta get spans from a depth 8 window */ - cfbGetByteWidthAndPointer(pDraw, pitch, ptrBase); - ptrBase += 3; /* point to top byte */ - - while(nspans--) { - ptr = ptrBase + (ppt->y * pitch) + (ppt->x << 2); - - for(i = *pwidth; i--; ptr += 4) - *(pDst++) = *ptr; - - pDst = (char*)((long)(pDst + 3) & ~3L); - - ppt++; pwidth++; - } -} - - diff --git a/hw/xfree86/xf8_32bpp/cfbpntwin.c b/hw/xfree86/xf8_32bpp/cfbpntwin.c deleted file mode 100644 index fbf597d22..000000000 --- a/hw/xfree86/xf8_32bpp/cfbpntwin.c +++ /dev/null @@ -1,51 +0,0 @@ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include "windowstr.h" -#include "regionstr.h" -#include "pixmapstr.h" -#include "scrnintstr.h" - -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include "mi.h" - -#ifdef PANORAMIX -#include "panoramiX.h" -#include "panoramiXsrv.h" -#endif - -void -cfb8_32FillBoxSolid8( - DrawablePtr pDraw, - int nbox, - BoxPtr pbox, - unsigned long color -){ - CARD8 *ptr, *data; - int pitch, height, width, i; - CARD8 c = (CARD8)color; - - cfbGetByteWidthAndPointer(pDraw, pitch, ptr); - ptr += 3; /* point to the top byte */ - - while(nbox--) { - data = ptr + (pbox->y1 * pitch) + (pbox->x1 << 2); - width = (pbox->x2 - pbox->x1) << 2; - height = pbox->y2 - pbox->y1; - - while(height--) { - for(i = 0; i < width; i+=4) - data[i] = c; - data += pitch; - } - pbox++; - } -} diff --git a/hw/xfree86/xf8_32bpp/cfbscrinit.c b/hw/xfree86/xf8_32bpp/cfbscrinit.c deleted file mode 100644 index c3432b803..000000000 --- a/hw/xfree86/xf8_32bpp/cfbscrinit.c +++ /dev/null @@ -1,311 +0,0 @@ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include "misc.h" -#include "servermd.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "resource.h" -#include "colormap.h" -#include "colormapst.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include "mi.h" -#include "micmap.h" -#include "mistruct.h" -#include "dix.h" -#include "mibstore.h" -#include "mioverlay.h" -#include "xf86.h" -#include "xf86str.h" -#include "globals.h" - -/* CAUTION: We require that cfb8 and cfb32 were NOT - compiled with CFB_NEED_SCREEN_PRIVATE */ - -static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey; -DevPrivateKey cfb8_32GetGCPrivateKey(void) -{ - return cfb8_32GCPrivateKey; -} - -static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey; -DevPrivateKey cfb8_32GetScreenPrivateKey(void) -{ - return cfb8_32ScreenPrivateKey; -} - -static Bool -cfb8_32AllocatePrivates(ScreenPtr pScreen) -{ - cfb8_32ScreenPtr pScreenPriv; - - if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec)))) - return FALSE; - - dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv); - - - /* All cfb will have the same GC and Window private indicies */ - if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey)) - return FALSE; - - if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC))) - return FALSE; - - if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec))) - return FALSE; - - return TRUE; -} - -static void DestroyColormapNoop( - ColormapPtr pColormap) -{ - /* NOOP */ -} - -static void StoreColorsNoop( - ColormapPtr pColormap, - int ndef, - xColorItem * pdef) -{ - /* NOOP */ -} - -static Bool -cfb8_32SetupScreen( - ScreenPtr pScreen, - pointer pbits, /* pointer to screen bitmap */ - int xsize, int ysize, /* in pixels */ - int dpix, int dpiy, /* dots per inch */ - int width /* pixel width of frame buffer */ -){ - if (!cfb8_32AllocatePrivates(pScreen)) - return FALSE; - pScreen->defColormap = FakeClientID(0); - /* let CreateDefColormap do whatever it wants for pixels */ - pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0; - pScreen->QueryBestSize = mfbQueryBestSize; - /* SaveScreen */ - pScreen->GetImage = cfb8_32GetImage; - pScreen->GetSpans = cfb8_32GetSpans; - pScreen->CreateWindow = cfb8_32CreateWindow; - pScreen->DestroyWindow = cfb8_32DestroyWindow; - pScreen->PositionWindow = cfb8_32PositionWindow; - pScreen->ChangeWindowAttributes = cfb8_32ChangeWindowAttributes; - pScreen->RealizeWindow = cfb32MapWindow; /* OK */ - pScreen->UnrealizeWindow = cfb32UnmapWindow; /* OK */ - pScreen->CopyWindow = cfb8_32CopyWindow; - pScreen->CreatePixmap = cfb32CreatePixmap; /* OK */ - pScreen->DestroyPixmap = cfb32DestroyPixmap; /* OK */ - pScreen->RealizeFont = mfbRealizeFont; - pScreen->UnrealizeFont = mfbUnrealizeFont; - pScreen->CreateGC = cfb8_32CreateGC; - pScreen->CreateColormap = miInitializeColormap; - pScreen->DestroyColormap = DestroyColormapNoop; - pScreen->InstallColormap = miInstallColormap; - pScreen->UninstallColormap = miUninstallColormap; - pScreen->ListInstalledColormaps = miListInstalledColormaps; - pScreen->StoreColors = StoreColorsNoop; - pScreen->ResolveColor = miResolveColor; - pScreen->BitmapToRegion = mfbPixmapToRegion; - - mfbRegisterCopyPlaneProc (pScreen, cfb8_32CopyPlane); - return TRUE; -} - -typedef struct { - pointer pbits; - int width; -} miScreenInitParmsRec, *miScreenInitParmsPtr; - -static Bool -cfb8_32CreateScreenResources(ScreenPtr pScreen) -{ - miScreenInitParmsPtr pScrInitParms; - int pitch; - Bool retval; - - /* get the pitch before mi destroys it */ - pScrInitParms = (miScreenInitParmsPtr)pScreen->devPrivate; - pitch = pScrInitParms->width << 2; - - if((retval = miCreateScreenResources(pScreen))) { - /* fix the screen pixmap */ - PixmapPtr pPix = (PixmapPtr)pScreen->devPrivate; - pPix->drawable.bitsPerPixel = 32; - pPix->drawable.depth = 8; - pPix->devKind = pitch; - } - - return retval; -} - - -static Bool -cfb8_32CloseScreen (int i, ScreenPtr pScreen) -{ - cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); - if(pScreenPriv->visualData) - xfree(pScreenPriv->visualData); - - xfree((pointer) pScreenPriv); - dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL); - - return(cfb32CloseScreen(i, pScreen)); -} - -static void -cfb8_32TransFunc( - ScreenPtr pScreen, - int nbox, - BoxPtr pbox -){ - cfb8_32FillBoxSolid8(&(WindowTable[pScreen->myNum]->drawable), - nbox, pbox, xf86Screens[pScreen->myNum]->colorKey); -} - -static Bool -cfb8_32InOverlayFunc(WindowPtr pWin) -{ - return (pWin->drawable.depth == 8); -} - -static Bool -cfb8_32FinishScreenInit( - ScreenPtr pScreen, - pointer pbits, /* pointer to screen bitmap */ - int xsize, int ysize, /* in pixels */ - int dpix, int dpiy, /* dots per inch */ - int width /* pixel width of frame buffer */ -){ - VisualPtr visuals; - DepthPtr depths; - int nvisuals; - int ndepths; - int rootdepth; - VisualID defaultVisual; - - rootdepth = 0; - if (!miInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth, - &defaultVisual,((unsigned long)1<<(32-1)), 8, -1)) - return FALSE; - if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, - rootdepth, ndepths, depths, - defaultVisual, nvisuals, visuals)) - return FALSE; - - pScreen->CreateScreenResources = cfb8_32CreateScreenResources; - pScreen->CloseScreen = cfb8_32CloseScreen; - pScreen->GetScreenPixmap = cfb32GetScreenPixmap; /* OK */ - pScreen->SetScreenPixmap = cfb32SetScreenPixmap; /* OK */ - - if (! miInitOverlay(pScreen, cfb8_32InOverlayFunc, cfb8_32TransFunc)) - return FALSE; - - return TRUE; -} - -static void -cfb8_32EnableDisableFBAccess ( - int index, - Bool enable -){ - ScreenPtr pScreen = screenInfo.screens[index]; - cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); - - miOverlaySetRootClip(pScreen, enable); - - (*pScreenPriv->EnableDisableFBAccess) (index, enable); -} - -static Atom overlayVisualsAtom; - -typedef struct { - CARD32 overlay_visual; - CARD32 transparent_type; - CARD32 value; - CARD32 layer; -} overlayVisualRec; - -static void -cfb8_32SetupVisuals (ScreenPtr pScreen) -{ - cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); - char atomString[] = {"SERVER_OVERLAY_VISUALS"}; - overlayVisualRec *overlayVisuals; - VisualID *visuals = NULL; - int numVisuals = 0; - DepthPtr pDepth = pScreen->allowedDepths; - int numDepths = pScreen->numDepths; - int i; - - /* find depth 8 visuals */ - for(i = 0; i < numDepths; i++, pDepth++) { - if(pDepth->depth == 8) { - numVisuals = pDepth->numVids; - visuals = pDepth->vids; - break; - } - } - - if(!numVisuals || !visuals) { - ErrorF("No overlay visuals found!\n"); - return; - } - - if(!(overlayVisuals = xalloc(numVisuals * sizeof(overlayVisualRec)))) - return; - - for(i = 0; i < numVisuals; i++) { - overlayVisuals[i].overlay_visual = visuals[i]; - overlayVisuals[i].transparent_type = 1; /* transparent pixel */ - overlayVisuals[i].value = pScreenPriv->key; - overlayVisuals[i].layer = 1; - } - - overlayVisualsAtom = MakeAtom(atomString, sizeof(atomString) - 1, TRUE); - xf86RegisterRootWindowProperty(pScreen->myNum, overlayVisualsAtom, - overlayVisualsAtom, 32, numVisuals * 4, overlayVisuals); - pScreenPriv->visualData = (pointer)overlayVisuals; -} - -Bool -cfb8_32ScreenInit( - ScreenPtr pScreen, - pointer pbits, /* pointer to screen bitmap */ - int xsize, int ysize, /* in pixels */ - int dpix, int dpiy, /* dots per inch */ - int w /* pixel width of frame buffer */ -){ - cfb8_32ScreenPtr pScreenPriv; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - if (!cfb8_32SetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, w)) - return FALSE; - - pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); - pScreenPriv->key = pScrn->colorKey; - pScreenPriv->visualData = NULL; - - - pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess; - pScrn->EnableDisableFBAccess = cfb8_32EnableDisableFBAccess; - - - if(cfb8_32FinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, w)) - { - cfb8_32SetupVisuals(pScreen); - return TRUE; - } - return FALSE; -} diff --git a/hw/xfree86/xf8_32bpp/cfbwindow.c b/hw/xfree86/xf8_32bpp/cfbwindow.c deleted file mode 100644 index 2e6057f12..000000000 --- a/hw/xfree86/xf8_32bpp/cfbwindow.c +++ /dev/null @@ -1,116 +0,0 @@ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include - -#include -#include "scrnintstr.h" -#include "windowstr.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" -#include "cfb8_32.h" -#include "mistruct.h" -#include "regionstr.h" -#include "cfbmskbits.h" -#include "mioverlay.h" - - -/* We don't bother with cfb's fastBackground/Border so we don't - need to use the Window privates */ - - -Bool -cfb8_32CreateWindow(WindowPtr pWin) -{ - pWin->drawable.bitsPerPixel = 32; - return TRUE; -} - - -Bool -cfb8_32DestroyWindow(WindowPtr pWin) -{ - return TRUE; -} - -Bool -cfb8_32PositionWindow( - WindowPtr pWin, - int x, int y -){ - return TRUE; -} - -void -cfb8_32CopyWindow(pWin, ptOldOrg, prgnSrc) - WindowPtr pWin; - DDXPointRec ptOldOrg; - RegionPtr prgnSrc; -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - DDXPointPtr ppt, pptSrc; - RegionRec rgnDst; - RegionPtr borderClip = &pWin->borderClip; - BoxPtr pbox; - int dx, dy, i, nbox; - WindowPtr pwinRoot; - Bool doUnderlay = miOverlayCopyUnderlay(pScreen); - Bool freeReg = FALSE; - - pwinRoot = WindowTable[pScreen->myNum]; - - if(doUnderlay) - freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip); - - REGION_NULL(pScreen, &rgnDst); - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); - REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc); - - pbox = REGION_RECTS(&rgnDst); - nbox = REGION_NUM_RECTS(&rgnDst); - if(!nbox || - !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) - { - REGION_UNINIT(pScreen, &rgnDst); - return; - } - ppt = pptSrc; - - for (i = nbox; --i >= 0; ppt++, pbox++) - { - ppt->x = pbox->x1 + dx; - ppt->y = pbox->y1 + dy; - } - - if(doUnderlay) - cfbDoBitblt24To24GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - GXcopy, &rgnDst, pptSrc, ~0); - else - cfbDoBitblt8To8GXcopy((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, - GXcopy, &rgnDst, pptSrc, ~0); - - xfree(pptSrc); - REGION_UNINIT(pScreen, &rgnDst); - if(freeReg) - REGION_DESTROY(pScreen, borderClip); -} - -Bool -cfb8_32ChangeWindowAttributes( - WindowPtr pWin, - unsigned long mask -){ - return TRUE; -} - - - - diff --git a/hw/xfree86/xf8_32bpp/xf86overlay.c b/hw/xfree86/xf8_32bpp/xf86overlay.c deleted file mode 100644 index c63b3cfd1..000000000 --- a/hw/xfree86/xf8_32bpp/xf86overlay.c +++ /dev/null @@ -1,1179 +0,0 @@ - -/* - Copyright (C) 1998. The XFree86 Project Inc. - - Written by Mark Vojkovich (mvojkovi@ucsd.edu) -*/ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "misc.h" -#include "xf86.h" -#include "xf86_OSproc.h" - -#include -#include "scrnintstr.h" -#include "regionstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "migc.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "colormapst.h" -#include "cfb8_32.h" - -#define IS_DIRTY 1 -#define IS_SHARED 2 - -/** Screen Functions **/ - -static Bool OverlayCloseScreen (int, ScreenPtr); -static Bool OverlayCreateGC(GCPtr pGC); -static Bool OverlayDestroyPixmap(PixmapPtr); -static PixmapPtr OverlayCreatePixmap(ScreenPtr, int, int, int, unsigned); -static Bool OverlayChangeWindowAttributes(WindowPtr, unsigned long); - -/** Funcs **/ -static void OverlayValidateGC(GCPtr, unsigned long, DrawablePtr); -static void OverlayChangeGC(GCPtr, unsigned long); -static void OverlayCopyGC(GCPtr, unsigned long, GCPtr); -static void OverlayDestroyGC(GCPtr); -static void OverlayChangeClip(GCPtr, int, pointer, int); -static void OverlayDestroyClip(GCPtr); -static void OverlayCopyClip(GCPtr, GCPtr); - - -static PixmapPtr OverlayRefreshPixmap(PixmapPtr); - -static GCFuncs OverlayGCFuncs = { - OverlayValidateGC, OverlayChangeGC, - OverlayCopyGC, OverlayDestroyGC, - OverlayChangeClip, OverlayDestroyClip, - OverlayCopyClip -}; - - -/** Pixmap Ops */ -static void PixmapFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *, - int); -static void PixmapSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr, - int *, int, int); -static void PixmapPutImage(DrawablePtr, GCPtr, int, int, int, int, int, - int, int, char *); -static void PixmapPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int, - int, int); -static RegionPtr PixmapCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int, - int, int, int, int); -static RegionPtr PixmapCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int, - int, int, int, int, unsigned long); -static void PixmapPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *); -static void PixmapPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr); -static void PixmapPolySegment(DrawablePtr, GCPtr, int, xSegment *); -static void PixmapPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *); -static void PixmapPolyArc(DrawablePtr, GCPtr, int, xArc *); -static void PixmapFillPolygon(DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); -static void PixmapPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *); -static void PixmapPolyFillArc(DrawablePtr, GCPtr, int, xArc *); -static int PixmapPolyText8(DrawablePtr, GCPtr, int, int, int, char *); -static int PixmapPolyText16(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void PixmapImageText8(DrawablePtr, GCPtr, int, int, int, char *); -static void PixmapImageText16(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void PixmapImageGlyphBlt(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); -static void PixmapPolyGlyphBlt(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); - -static GCOps PixmapGCOps = { - PixmapFillSpans, PixmapSetSpans, - PixmapPutImage, PixmapCopyArea, - PixmapCopyPlane, PixmapPolyPoint, - PixmapPolylines, PixmapPolySegment, - PixmapPolyRectangle, PixmapPolyArc, - PixmapFillPolygon, PixmapPolyFillRect, - PixmapPolyFillArc, PixmapPolyText8, - PixmapPolyText16, PixmapImageText8, - PixmapImageText16, PixmapImageGlyphBlt, - PixmapPolyGlyphBlt, PixmapPushPixels, - {NULL} /* devPrivate */ -}; - - -/** Window Ops **/ -static void WindowFillSpans(DrawablePtr, GCPtr, int, DDXPointPtr, int *, - int); -static void WindowSetSpans(DrawablePtr, GCPtr, char *, DDXPointPtr, - int *, int, int); -static void WindowPutImage(DrawablePtr, GCPtr, int, int, int, int, int, - int, int, char *); -static void WindowPushPixels(GCPtr, PixmapPtr, DrawablePtr, int, int, - int, int); -static RegionPtr WindowCopyArea(DrawablePtr, DrawablePtr, GCPtr, int, int, - int, int, int, int); -static RegionPtr WindowCopyPlane(DrawablePtr, DrawablePtr, GCPtr, int, int, - int, int, int, int, unsigned long); -static void WindowPolyPoint(DrawablePtr, GCPtr, int, int, xPoint *); -static void WindowPolylines(DrawablePtr, GCPtr, int, int, DDXPointPtr); -static void WindowPolySegment(DrawablePtr, GCPtr, int, xSegment *); -static void WindowPolyRectangle(DrawablePtr, GCPtr, int, xRectangle *); -static void WindowPolyArc(DrawablePtr, GCPtr, int, xArc *); -static void WindowFillPolygon(DrawablePtr, GCPtr, int, int, int, - DDXPointPtr); -static void WindowPolyFillRect(DrawablePtr, GCPtr, int, xRectangle *); -static void WindowPolyFillArc(DrawablePtr, GCPtr, int, xArc *); -static int WindowPolyText8(DrawablePtr, GCPtr, int, int, int, char *); -static int WindowPolyText16(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void WindowImageText8(DrawablePtr, GCPtr, int, int, int, char *); -static void WindowImageText16(DrawablePtr, GCPtr, int, int, int, - unsigned short *); -static void WindowImageGlyphBlt(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); -static void WindowPolyGlyphBlt(DrawablePtr, GCPtr, int, int, - unsigned int, CharInfoPtr *, pointer); - -static GCOps WindowGCOps = { - WindowFillSpans, WindowSetSpans, - WindowPutImage, WindowCopyArea, - WindowCopyPlane, WindowPolyPoint, - WindowPolylines, WindowPolySegment, - WindowPolyRectangle, WindowPolyArc, - WindowFillPolygon, WindowPolyFillRect, - WindowPolyFillArc, WindowPolyText8, - WindowPolyText16, WindowImageText8, - WindowImageText16, WindowImageGlyphBlt, - WindowPolyGlyphBlt, WindowPushPixels, - {NULL} /* devPrivate */ -}; - -/** privates **/ - -typedef struct { - CloseScreenProcPtr CloseScreen; - CreateGCProcPtr CreateGC; - CreatePixmapProcPtr CreatePixmap; - DestroyPixmapProcPtr DestroyPixmap; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - int LockPrivate; -} OverlayScreenRec, *OverlayScreenPtr; - -typedef struct { - GCFuncs *wrapFuncs; - GCOps *wrapOps; - GCOps *overlayOps; - unsigned long fg; - unsigned long bg; - unsigned long pm; - PixmapPtr tile; -} OverlayGCRec, *OverlayGCPtr; - -typedef struct { - PixmapPtr pix32; - CARD32 dirty; -} OverlayPixmapRec, *OverlayPixmapPtr; - - -static DevPrivateKey OverlayScreenKey = &OverlayScreenKey; -static DevPrivateKey OverlayGCKey = &OverlayGCKey; -static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey; - -/** Macros **/ - -#define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap) - -#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \ - dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey)) - -#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \ - dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey)) - -#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \ - dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey)) - -#define OVERLAY_GC_FUNC_PROLOGUE(pGC)\ - OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\ - (pGC)->funcs = pGCPriv->wrapFuncs;\ - if(pGCPriv->overlayOps) \ - (pGC)->ops = pGCPriv->wrapOps - -#define OVERLAY_GC_FUNC_EPILOGUE(pGC)\ - pGCPriv->wrapFuncs = (pGC)->funcs;\ - (pGC)->funcs = &OverlayGCFuncs;\ - if(pGCPriv->overlayOps) { \ - pGCPriv->wrapOps = (pGC)->ops;\ - (pGC)->ops = pGCPriv->overlayOps;\ - } - -#define WINDOW_GC_OP_PROLOGUE(pGC)\ - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE((pGC)->pScreen);\ - OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\ - unsigned long oldfg = (pGC)->fgPixel;\ - unsigned long oldbg = (pGC)->bgPixel;\ - unsigned long oldpm = (pGC)->planemask;\ - PixmapPtr oldtile = (pGC)->tile.pixmap;\ - (pGC)->fgPixel = pGCPriv->fg;\ - (pGC)->bgPixel = pGCPriv->bg;\ - (pGC)->planemask = pGCPriv->pm;\ - if(pGCPriv->tile) (pGC)->tile.pixmap = pGCPriv->tile;\ - (pGC)->funcs = pGCPriv->wrapFuncs;\ - (pGC)->ops = pGCPriv->wrapOps;\ - pScreenPriv->LockPrivate++ - - -#define WINDOW_GC_OP_EPILOGUE(pGC)\ - pGCPriv->wrapOps = (pGC)->ops;\ - pGCPriv->wrapFuncs = (pGC)->funcs;\ - (pGC)->fgPixel = oldfg;\ - (pGC)->bgPixel = oldbg;\ - (pGC)->planemask = oldpm;\ - (pGC)->tile.pixmap = oldtile;\ - (pGC)->funcs = &OverlayGCFuncs;\ - (pGC)->ops = &WindowGCOps;\ - pScreenPriv->LockPrivate-- - - -#define PIXMAP_GC_OP_PROLOGUE(pGC)\ - OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\ - OverlayPixmapPtr pPixPriv = OVERLAY_GET_PIXMAP_PRIVATE((PixmapPtr)pDraw);\ - pGC->funcs = pGCPriv->wrapFuncs;\ - pGC->ops = pGCPriv->wrapOps - -#define PIXMAP_GC_OP_EPILOGUE(pGC)\ - pGCPriv->wrapOps = pGC->ops;\ - pGC->funcs = &OverlayGCFuncs;\ - pGC->ops = &PixmapGCOps;\ - pPixPriv->dirty |= IS_DIRTY - - -Bool -xf86Overlay8Plus32Init (ScreenPtr pScreen) -{ - OverlayScreenPtr pScreenPriv; - - if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec))) - return FALSE; - - if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec))) - return FALSE; - - if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec)))) - return FALSE; - - dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv); - - pScreenPriv->CreateGC = pScreen->CreateGC; - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreenPriv->CreatePixmap = pScreen->CreatePixmap; - pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap; - pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes; - - pScreen->CreateGC = OverlayCreateGC; - pScreen->CloseScreen = OverlayCloseScreen; - pScreen->CreatePixmap = OverlayCreatePixmap; - pScreen->DestroyPixmap = OverlayDestroyPixmap; - pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes; - - pScreenPriv->LockPrivate = 0; - - /* allocate the key in the default map */ - if(pScreen->defColormap) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - ColormapPtr pmap; - xColorItem color; - - pmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP); - - pmap->red[pScrn->colorKey].refcnt = AllocPrivate; - pmap->red[pScrn->colorKey].fShared = FALSE; - pmap->freeRed--; - - color.red = color.blue = color.green = 0; - color.pixel = pScrn->colorKey; - color.flags = DoRed | DoGreen | DoBlue; - - StoreColors(pmap, 1, &color); - } - - return TRUE; -} - - -/*********************** Screen Funcs ***********************/ - -Bool -OverlayCreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC); - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen); - Bool ret; - - pScreen->CreateGC = pScreenPriv->CreateGC; - - if((ret = (*pScreen->CreateGC)(pGC)) && (pGC->depth != 1)) { - pGCPriv->wrapFuncs = pGC->funcs; - pGC->funcs = &OverlayGCFuncs; - pGCPriv->wrapOps = NULL; - pGCPriv->overlayOps = NULL; - pGCPriv->tile = NULL; - } - - pScreen->CreateGC = OverlayCreateGC; - - return ret; -} - -static PixmapPtr -OverlayCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, - unsigned usage_hint) -{ - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen); - PixmapPtr pPix; - - pScreen->CreatePixmap = pScreenPriv->CreatePixmap; - pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint); - pScreen->CreatePixmap = OverlayCreatePixmap; - - /* We initialize all the privates */ - if(pPix) { - OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix); - pPriv->pix32 = NULL; - pPriv->dirty = IS_DIRTY; - if(!w || !h) - pPriv->dirty |= IS_SHARED; - } - - return pPix; -} - -static Bool -OverlayDestroyPixmap(PixmapPtr pPix) -{ - ScreenPtr pScreen = pPix->drawable.pScreen; - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen); - Bool result; - - pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap; - - if((pPix->refcnt == 1) && (pPix->drawable.bitsPerPixel == 8)) { - OverlayPixmapPtr pPriv = OVERLAY_GET_PIXMAP_PRIVATE(pPix); - if(pPriv->pix32) { - if(pPriv->pix32->refcnt != 1) - ErrorF("Warning! private pix refcnt = %i\n", pPriv->pix32->refcnt); - (*pScreen->DestroyPixmap)(pPriv->pix32); - } - pPriv->pix32 = NULL; - } - - result = (*pScreen->DestroyPixmap) (pPix); - pScreen->DestroyPixmap = OverlayDestroyPixmap; - - return result; -} - -static Bool -OverlayCloseScreen (int i, ScreenPtr pScreen) -{ - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen); - - pScreen->CreateGC = pScreenPriv->CreateGC; - pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->CreatePixmap = pScreenPriv->CreatePixmap; - pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap; - pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; - - xfree ((pointer) pScreenPriv); - - return (*pScreen->CloseScreen) (i, pScreen); -} - - - -static Bool -OverlayChangeWindowAttributes (WindowPtr pWin, unsigned long mask) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen); - Bool result; - - if(pWin->drawable.depth == 8) { - if((mask & CWBackPixmap) && - (pWin->backgroundState == BackgroundPixmap)) - OverlayRefreshPixmap(pWin->background.pixmap); - - if((mask & CWBorderPixmap) && !pWin->borderIsPixel) - OverlayRefreshPixmap(pWin->border.pixmap); - } - - pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes; - result = (*pScreen->ChangeWindowAttributes) (pWin, mask); - pScreen->ChangeWindowAttributes = OverlayChangeWindowAttributes; - - return result; -} - -/*********************** GC Funcs *****************************/ - - -static PixmapPtr -OverlayRefreshPixmap(PixmapPtr pix8) -{ - OverlayPixmapPtr pixPriv = OVERLAY_GET_PIXMAP_PRIVATE(pix8); - ScreenPtr pScreen = pix8->drawable.pScreen; - - if(!pixPriv->pix32) { - PixmapPtr newPix; - - newPix = (*pScreen->CreatePixmap)(pScreen, pix8->drawable.width, - pix8->drawable.height, 24, 0); - newPix->drawable.depth = 8; /* Bad Mark! Bad Mark! */ - pixPriv->pix32 = newPix; - } - - if(pixPriv->dirty) { - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pScreen); - GCPtr pGC; - - pGC = GetScratchGC(8, pScreen); - - pScreenPriv->LockPrivate++; /* don't modify this one */ - ValidateGC((DrawablePtr)pixPriv->pix32, pGC); - - (*pGC->ops->CopyArea)((DrawablePtr)pix8, (DrawablePtr)pixPriv->pix32, - pGC, 0, 0, pix8->drawable.width, pix8->drawable.height, 0, 0); - pScreenPriv->LockPrivate--; - FreeScratchGC(pGC); - - pixPriv->dirty &= ~IS_DIRTY; - pixPriv->pix32->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - - return pixPriv->pix32; -} - - -static void -OverlayValidateGC( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDraw -){ - OverlayScreenPtr pScreenPriv = OVERLAY_GET_SCREEN_PRIVATE(pGC->pScreen); - OVERLAY_GC_FUNC_PROLOGUE (pGC); - - if(pScreenPriv->LockPrivate < 0) { - ErrorF("Something is wrong in OverlayValidateGC!\n"); - pScreenPriv->LockPrivate = 0; - } - - if(pGC->depth == 24) { - unsigned long oldpm = pGC->planemask; - pGCPriv->overlayOps = NULL; - - if(pDraw->type == DRAWABLE_WINDOW) - pGC->planemask &= 0x00ffffff; - else - pGC->planemask |= 0xff000000; - - if(oldpm != pGC->planemask) changes |= GCPlaneMask; - - (*pGC->funcs->ValidateGC)(pGC, changes, pDraw); - - } else { /* depth == 8 */ - unsigned long newChanges = 0; - - if(pDraw->bitsPerPixel == 32) { - - if(pGC->fillStyle == FillTiled) - pGCPriv->tile = OverlayRefreshPixmap(pGC->tile.pixmap); - else pGCPriv->tile = NULL; - - if(pGCPriv->overlayOps != &WindowGCOps) { - newChanges = GCForeground | GCBackground | GCPlaneMask; - if(pGCPriv->tile) - newChanges |= GCTile; - } - pGCPriv->overlayOps = &WindowGCOps; - - if(!pScreenPriv->LockPrivate) { - unsigned long oldfg = pGC->fgPixel; - unsigned long oldbg = pGC->bgPixel; - unsigned long oldpm = pGC->planemask; - PixmapPtr oldtile = pGC->tile.pixmap; - - pGC->fgPixel = pGCPriv->fg = oldfg << 24; - pGC->bgPixel = pGCPriv->bg = oldbg << 24; - pGC->planemask = pGCPriv->pm = oldpm << 24; - if(pGCPriv->tile) - pGC->tile.pixmap = pGCPriv->tile; - - (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw); - - pGC->fgPixel = oldfg; - pGC->bgPixel = oldbg; - pGC->planemask = oldpm; - pGC->tile.pixmap = oldtile; - } else { - pGCPriv->fg = pGC->fgPixel; - pGCPriv->bg = pGC->bgPixel; - pGCPriv->pm = pGC->planemask; - - (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw); - } - - } else { /* bitsPerPixel == 8 */ - if(pGCPriv->overlayOps == &WindowGCOps) { - newChanges = GCForeground | GCBackground | GCPlaneMask; - if(pGCPriv->tile) - newChanges |= GCTile; - } - pGCPriv->overlayOps = &PixmapGCOps; - - (*pGC->funcs->ValidateGC)(pGC, changes | newChanges, pDraw); - } - } - - OVERLAY_GC_FUNC_EPILOGUE (pGC); -} - - -static void -OverlayDestroyGC(GCPtr pGC) -{ - OVERLAY_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->DestroyGC)(pGC); - OVERLAY_GC_FUNC_EPILOGUE (pGC); -} - -static void -OverlayChangeGC ( - GCPtr pGC, - unsigned long mask -){ - OVERLAY_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->ChangeGC) (pGC, mask); - OVERLAY_GC_FUNC_EPILOGUE (pGC); -} - -static void -OverlayCopyGC ( - GCPtr pGCSrc, - unsigned long mask, - GCPtr pGCDst -){ - OVERLAY_GC_FUNC_PROLOGUE (pGCDst); - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - OVERLAY_GC_FUNC_EPILOGUE (pGCDst); -} -static void -OverlayChangeClip ( - GCPtr pGC, - int type, - pointer pvalue, - int nrects -){ - OVERLAY_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - OVERLAY_GC_FUNC_EPILOGUE (pGC); -} - -static void -OverlayCopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - OVERLAY_GC_FUNC_PROLOGUE (pgcDst); - (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); - OVERLAY_GC_FUNC_EPILOGUE (pgcDst); -} - -static void -OverlayDestroyClip(GCPtr pGC) -{ - OVERLAY_GC_FUNC_PROLOGUE (pGC); - (* pGC->funcs->DestroyClip)(pGC); - OVERLAY_GC_FUNC_EPILOGUE (pGC); -} - - - -/******************* Window GC ops ***********************/ - -static void -WindowFillSpans( - DrawablePtr pDraw, - GC *pGC, - int nInit, - DDXPointPtr pptInit, - int *pwidthInit, - int fSorted -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowSetSpans( - DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - register DDXPointPtr ppt, - int *pwidth, - int nspans, - int fSorted -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPutImage( - DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, - int format, - char *pImage -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static RegionPtr -WindowCopyArea( - DrawablePtr pSrc, - DrawablePtr pDst, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty -){ - RegionPtr ret; - - WINDOW_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyArea)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty); - WINDOW_GC_OP_EPILOGUE(pGC); - return ret; -} - -static RegionPtr -WindowCopyPlane( - DrawablePtr pSrc, - DrawablePtr pDst, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - unsigned long bitPlane -){ - RegionPtr ret; - - WINDOW_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyPlane)(pSrc, pDst, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - WINDOW_GC_OP_EPILOGUE(pGC); - return ret; -} - -static void -WindowPolyPoint( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - xPoint *pptInit -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolylines( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pptInit -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolySegment( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolyRectangle( - DrawablePtr pDraw, - GCPtr pGC, - int nRectsInit, - xRectangle *pRectsInit -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolyArc( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowFillPolygon( - DrawablePtr pDraw, - GCPtr pGC, - int shape, - int mode, - int count, - DDXPointPtr ptsIn -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolyFillRect( - DrawablePtr pDraw, - GCPtr pGC, - int nrectFill, - xRectangle *prectInit -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolyFillArc( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static int -WindowPolyText8( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - int ret; - - WINDOW_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - WINDOW_GC_OP_EPILOGUE(pGC); - return ret; -} - -static int -WindowPolyText16( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - int ret; - - WINDOW_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - WINDOW_GC_OP_EPILOGUE(pGC); - return ret; -} - -static void -WindowImageText8( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowImageText16( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowImageGlyphBlt( - DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPolyGlyphBlt( - DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - WINDOW_GC_OP_EPILOGUE(pGC); -} - -static void -WindowPushPixels( - GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg -){ - WINDOW_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - WINDOW_GC_OP_EPILOGUE(pGC); -} - - -/******************* Pixmap GC ops ***********************/ - -static void -PixmapFillSpans( - DrawablePtr pDraw, - GC *pGC, - int nInit, - DDXPointPtr pptInit, - int *pwidthInit, - int fSorted -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapSetSpans( - DrawablePtr pDraw, - GCPtr pGC, - char *pcharsrc, - register DDXPointPtr ppt, - int *pwidth, - int nspans, - int fSorted -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPutImage( - DrawablePtr pDraw, - GCPtr pGC, - int depth, - int x, int y, int w, int h, - int leftPad, - int format, - char *pImage -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h, - leftPad, format, pImage); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static RegionPtr -PixmapCopyArea( - DrawablePtr pSrc, - DrawablePtr pDraw, - GC *pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty -){ - RegionPtr ret; - - PIXMAP_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyArea)(pSrc, pDraw, - pGC, srcx, srcy, width, height, dstx, dsty); - PIXMAP_GC_OP_EPILOGUE(pGC); - return ret; -} - -static RegionPtr -PixmapCopyPlane( - DrawablePtr pSrc, - DrawablePtr pDraw, - GCPtr pGC, - int srcx, int srcy, - int width, int height, - int dstx, int dsty, - unsigned long bitPlane -){ - RegionPtr ret; - - PIXMAP_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->CopyPlane)(pSrc, pDraw, - pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); - PIXMAP_GC_OP_EPILOGUE(pGC); - return ret; -} - -static void -PixmapPolyPoint( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - xPoint *pptInit -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolylines( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pptInit -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolySegment( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolyRectangle( - DrawablePtr pDraw, - GCPtr pGC, - int nRectsInit, - xRectangle *pRectsInit -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolyArc( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapFillPolygon( - DrawablePtr pDraw, - GCPtr pGC, - int shape, - int mode, - int count, - DDXPointPtr ptsIn -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolyFillRect( - DrawablePtr pDraw, - GCPtr pGC, - int nrectFill, - xRectangle *prectInit -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolyFillArc( - DrawablePtr pDraw, - GCPtr pGC, - int narcs, - xArc *parcs -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static int -PixmapPolyText8( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - int ret; - - PIXMAP_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars); - PIXMAP_GC_OP_EPILOGUE(pGC); - return ret; -} - -static int -PixmapPolyText16( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - int ret; - - PIXMAP_GC_OP_PROLOGUE(pGC); - ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars); - PIXMAP_GC_OP_EPILOGUE(pGC); - return ret; -} - -static void -PixmapImageText8( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - char *chars -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapImageText16( - DrawablePtr pDraw, - GCPtr pGC, - int x, - int y, - int count, - unsigned short *chars -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapImageGlyphBlt( - DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPolyGlyphBlt( - DrawablePtr pDraw, - GCPtr pGC, - int xInit, int yInit, - unsigned int nglyph, - CharInfoPtr *ppci, - pointer pglyphBase -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph, - ppci, pglyphBase); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - -static void -PixmapPushPixels( - GCPtr pGC, - PixmapPtr pBitMap, - DrawablePtr pDraw, - int dx, int dy, int xOrg, int yOrg -){ - PIXMAP_GC_OP_PROLOGUE(pGC); - (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg); - PIXMAP_GC_OP_EPILOGUE(pGC); -} - - From eabcfce0a68d504d11be9479f09e66f574dd2f21 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 11 Apr 2008 09:51:26 -0400 Subject: [PATCH 175/183] Stop building mfb/afb/xf1bpp by default. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 4e83a4251..f0cfb1b1a 100644 --- a/configure.ac +++ b/configure.ac @@ -574,8 +574,8 @@ AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server ( AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no]) AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no]) dnl legacy fb support -AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG]) -AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG]) +AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no]) +AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: disable)]), [AFB=$enableval], [AFB=no]) dnl kdrive and its subsystems AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no]) AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto]) From b1f3f42840ec01db417345a0740b59ad5e4471cb Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Fri, 11 Apr 2008 17:49:51 -0700 Subject: [PATCH 176/183] Xquartz: Added applicationShouldHandleReopen:hasVisibleWindows to handle dock icon clicking (cherry picked from commit 55d9973b053f25bb95b26e00351dc5531caf5b04) --- hw/xquartz/X11Controller.m | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 5bf4f4d52..2fd988661 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -743,15 +743,21 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row - (BOOL) application:(NSApplication *)app openFile:(NSString *)filename { - const char *name = [filename UTF8String]; - - if (finished_launching) - [self launch_client:filename]; - else if (name[0] != ':') /* ignore display names */ - pending_apps = x_list_prepend (pending_apps, [filename retain]); - - /* FIXME: report failures. */ - return YES; + const char *name = [filename UTF8String]; + + if (finished_launching) + [self launch_client:filename]; + else if (name[0] != ':') /* ignore display names */ + pending_apps = x_list_prepend (pending_apps, [filename retain]); + + /* FIXME: report failures. */ + return YES; +} + +- (BOOL) applicationShouldHandleReopen:(NSApplication *)app + hasVisibleWindows:(BOOL)hasVis { + DarwinSendDDXEvent(kXquartzBringAllToFront, 0); + return YES; } @end From 1fa4de80fcfc697b5e5879cc351fb3e9dbf6acbe Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sat, 12 Apr 2008 20:39:18 +0200 Subject: [PATCH 177/183] Check for __x86_64__ when we check for __amd64__ It seems Intel C Compiler neglects to define __amd64__, __amd64, or amd64, but *does* define __x86_64__. --- fb/fb.h | 2 +- hw/xfree86/common/compiler.h | 2 +- hw/xfree86/common/xf86AutoConfig.c | 2 +- hw/xfree86/loader/loader.c | 2 +- hw/xfree86/os-support/bsd/bsdResource.c | 2 +- hw/xfree86/os-support/bsd/i386_video.c | 8 ++++---- hw/xfree86/os-support/bus/Pci.h | 2 +- hw/xfree86/utils/xorgcfg/loadmod.c | 4 +++- hw/xfree86/x86emu/prim_ops.c | 2 +- hw/xfree86/x86emu/x86emu/prim_x86_gcc.h | 2 +- hw/xfree86/x86emu/x86emu/types.h | 2 +- hw/xprint/ps/psout.h | 2 +- include/servermd.h | 2 +- mi/micoord.h | 2 +- 14 files changed, 19 insertions(+), 17 deletions(-) diff --git a/fb/fb.h b/fb/fb.h index 01000d79c..1cd947380 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -141,7 +141,7 @@ typedef unsigned __int64 FbBits; defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || defined(_LP64) || \ defined(__s390x__) || \ - defined(amd64) || defined (__amd64__) || \ + defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \ defined (__powerpc64__) || \ (defined(sgi) && (_MIPS_SZLONG == 64)) typedef unsigned long FbBits; diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index 73ca3d0ac..7b65da844 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port); extern unsigned int inw(unsigned long port); extern unsigned int inl(unsigned long port); -# elif defined(linux) && defined(__amd64__) +# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__)) # include diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index 3210e4460..92b204ba0 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -449,7 +449,7 @@ chooseVideoDriver(void) if (info != NULL) chosen_driver = videoPtrToDriverName(info); if (chosen_driver == NULL) { -#if defined __i386__ || defined __amd64__ || defined __hurd__ +#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__ chosen_driver = "vesa"; #elif defined __sparc__ chosen_driver = "sunffb"; diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c index 774a4c4a0..a00269b70 100644 --- a/hw/xfree86/loader/loader.c +++ b/hw/xfree86/loader/loader.c @@ -63,7 +63,7 @@ #include #if defined(linux) && \ (defined(__alpha__) || defined(__powerpc__) || defined(__ia64__) \ - || defined(__amd64__)) + || defined(__amd64__) || defined(__x86_64__)) #include #endif #include diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c index fe166c845..d1ee787f1 100644 --- a/hw/xfree86/os-support/bsd/bsdResource.c +++ b/hw/xfree86/os-support/bsd/bsdResource.c @@ -19,7 +19,7 @@ #ifdef INCLUDE_XF86_NO_DOMAIN -#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) +#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) || defined(__x86_64__) resPtr xf86AccResFromOS(resPtr ret) diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index 1ebac678d..e2f6420d8 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__) +#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__)) #include #include #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(__OpenBSD__) +#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__) 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(__OpenBSD__) +#if (defined(__amd64__) || defined(__x86_64__)) && defined(__OpenBSD__) pVidMem->setWC = amd64setWC; pVidMem->undoWC = amd64undoWC; #endif @@ -953,7 +953,7 @@ NetBSDundoWC(int screenNum, pointer list) } #endif -#if defined(__OpenBSD__) && defined(__amd64__) +#if defined(__OpenBSD__) && (defined(__amd64__) || defined(__x86_64__)) static pointer amd64setWC(int screenNum, unsigned long base, unsigned long size, Bool enable, MessageType from) diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index ebac0905b..b78d30720 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -246,7 +246,7 @@ # if !defined(__FreeBSD__) && !defined(linux) # define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge # endif -#elif defined(__amd64__) || defined(__amd64) +#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) # if defined(linux) # define ARCH_PCI_INIT linuxPciInit # else diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c index 1207820ce..629dfe118 100644 --- a/hw/xfree86/utils/xorgcfg/loadmod.c +++ b/hw/xfree86/utils/xorgcfg/loadmod.c @@ -179,7 +179,9 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86memchr) SYMFUNC(xf86memcmp) SYMFUNC(xf86memcpy) -#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__sparc) || defined(__ia64__) || defined (__amd64__) +#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || \ + defined(__sparc__) || defined(__sparc) || defined(__ia64__) || \ + defined (__amd64__) || defined(__x86_64__) /* * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle * structure copies. This causes a problem both here and in shared diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c index b42cdc0a5..41968e1a7 100644 --- a/hw/xfree86/x86emu/prim_ops.c +++ b/hw/xfree86/x86emu/prim_ops.c @@ -103,7 +103,7 @@ #include "x86emu/x86emui.h" #if defined(__GNUC__) -# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) +# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__) # include "x86emu/prim_x86_gcc.h" # endif #endif diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h index af61e2023..5a443cdbf 100644 --- a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h +++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h @@ -42,7 +42,7 @@ #include "x86emu/types.h" -#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)) +#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) || defined(__x86_64__)) #error This file is intended to be used by gcc on i386 or x86-64 system #endif diff --git a/hw/xfree86/x86emu/x86emu/types.h b/hw/xfree86/x86emu/x86emu/types.h index c0c09c1b0..2d41b0f18 100644 --- a/hw/xfree86/x86emu/x86emu/types.h +++ b/hw/xfree86/x86emu/x86emu/types.h @@ -75,7 +75,7 @@ defined(__sparc64__) || \ defined(__s390x__) || \ (defined(__hppa__) && defined(__LP64)) || \ - defined(__amd64__) || defined(amd64) || \ + defined(__amd64__) || defined(amd64) || defined(__x86_64__) || \ (defined(__sgi) && (_MIPS_SZLONG == 64)) #define NUM32 int #else diff --git a/hw/xprint/ps/psout.h b/hw/xprint/ps/psout.h index 3e19d5a67..1138e4afe 100644 --- a/hw/xprint/ps/psout.h +++ b/hw/xprint/ps/psout.h @@ -169,7 +169,7 @@ typedef signed __int64 PsOutColor; defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || defined(_LP64) || \ defined(__s390x__) || \ - defined(amd64) || defined (__amd64__) || \ + defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \ defined (__powerpc64__) || \ (defined(sgi) && (_MIPS_SZLONG == 64)) typedef signed long PsOutColor; diff --git a/include/servermd.h b/include/servermd.h index 2f511dabe..616841089 100644 --- a/include/servermd.h +++ b/include/servermd.h @@ -393,7 +393,7 @@ SOFTWARE. #endif /* ia64 */ -#if defined(__amd64__) || defined(amd64) || defined(__amd64) +#if defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__) # define IMAGE_BYTE_ORDER LSBFirst # if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) diff --git a/mi/micoord.h b/mi/micoord.h index 16d086117..876e88c95 100644 --- a/mi/micoord.h +++ b/mi/micoord.h @@ -48,7 +48,7 @@ defined(__alpha) || defined(__alpha__) || \ defined(__i386__) || defined(__i386) || defined(__ia64__) || \ defined(__s390x__) || defined(__s390__) || \ - defined(__amd64__) || defined(amd64) || defined(__amd64) + defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__) #define GetHighWord(x) (((int) (x)) >> 16) #else #define GetHighWord(x) (((int) (x)) / 65536) From c61087c82784633e522bd9392172b43656bdf45e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 14 Apr 2008 10:47:28 +1000 Subject: [PATCH 178/183] glcore: zero fbconfigs before filling them in. I'm not sure this the complete proper solution, perhaps it should explicitly fill in ever field. This at least makes glxinfo on glcore return sensible information, it doesn't make gears work yet though. --- GL/glx/glxglcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c index 972ab88e6..16064a96d 100644 --- a/GL/glx/glxglcore.c +++ b/GL/glx/glxglcore.c @@ -317,7 +317,7 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, for (back = numBack - 1; back >= 0; back--) for (depth = 0; depth < numDepth; depth++) for (stencil = 0; stencil < numStencil; stencil++) { - config->next = xalloc(sizeof *config); + config->next = xcalloc(sizeof(*config), 1); config = config->next; config->visualType = glx_visual_types[visual->class]; From 97565c0f394f16d042c614695c8b7b4ac354f2a3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 14 Apr 2008 11:40:38 +1000 Subject: [PATCH 179/183] glcore: make visualRating GLX_NONE - note GLX_NONE is not == 0 Finally glxinfo returns the set of 3 visuals and glxgears works again for me on sw rendering --- GL/glx/glxglcore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/GL/glx/glxglcore.c b/GL/glx/glxglcore.c index 16064a96d..1eac0eb3e 100644 --- a/GL/glx/glxglcore.c +++ b/GL/glx/glxglcore.c @@ -320,6 +320,7 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen, config->next = xcalloc(sizeof(*config), 1); config = config->next; + config->visualRating = GLX_NONE; config->visualType = glx_visual_types[visual->class]; config->xRenderable = GL_TRUE; config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; From 3e12c5bb67f3049156475d5cbf4e899aaded76bb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 14 Apr 2008 11:45:12 +1000 Subject: [PATCH 180/183] glx: silly nitpick... even though i and j are the same, we use i to derefence visuals everywhere else --- GL/glx/glxscreens.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index b49a775b5..41ee029e6 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -488,7 +488,7 @@ addMinimalSet(__GLXscreen *pGlxScreen) continue; pGlxScreen->visuals[j] = config; - config->visualID = visuals[j].vid; + config->visualID = visuals[i].vid; j++; } From bb8868540f017b121d698da45e552ffb55a57cea Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 14 Apr 2008 09:58:49 +0200 Subject: [PATCH 181/183] EXA: Teach exaCompositeFallbackPictDesc() about x8r8g8b8. --- exa/exa_render.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exa/exa_render.c b/exa/exa_render.c index da8140102..1d7b8974c 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -51,6 +51,9 @@ static void exaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n) case PICT_a8r8g8b8: snprintf(format, 20, "ARGB8888"); break; + case PICT_x8r8g8b8: + snprintf(format, 20, "XRGB8888"); + break; case PICT_r5g6b5: snprintf(format, 20, "RGB565 "); break; From f133d85778462134f366389bde7673bff7845fa8 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 14 Apr 2008 11:43:51 +0200 Subject: [PATCH 182/183] EXA: Update pixmaps' accel_blocked field in ModifyPixmapHeader. --- exa/exa.c | 53 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/exa/exa.c b/exa/exa.c index cbe66e875..81dc3e2ab 100644 --- a/exa/exa.c +++ b/exa/exa.c @@ -224,6 +224,30 @@ exaLog2(int val) return bits - 1; } +static void +exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap, + int w, int h, int bpp) +{ + pExaPixmap->accel_blocked = 0; + + if (pExaScr->info->maxPitchPixels) { + int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8; + + if (pExaPixmap->fb_pitch > max_pitch) + pExaPixmap->accel_blocked |= EXA_RANGE_PITCH; + } + + if (pExaScr->info->maxPitchBytes && + pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes) + pExaPixmap->accel_blocked |= EXA_RANGE_PITCH; + + if (w > pExaScr->info->maxX) + pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH; + + if (h > pExaScr->info->maxY) + pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT; +} + /** * exaCreatePixmap() creates a new pixmap. * @@ -339,25 +363,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth, REGION_NULL(pScreen, &pExaPixmap->validSys); REGION_NULL(pScreen, &pExaPixmap->validFB); - /* Check whether this pixmap can be used for acceleration. */ - pExaPixmap->accel_blocked = 0; - - if (pExaScr->info->maxPitchPixels) { - int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8; - - if (pExaPixmap->fb_pitch > max_pitch) - pExaPixmap->accel_blocked |= EXA_RANGE_PITCH; - } - - if (pExaScr->info->maxPitchBytes && - pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes) - pExaPixmap->accel_blocked |= EXA_RANGE_PITCH; - - if (w > pExaScr->info->maxX) - pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH; - - if (h > pExaScr->info->maxY) - pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT; + exaSetAccelBlock(pExaScr, pExaPixmap, + w, h, bpp); return pPixmap; } @@ -373,12 +380,16 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, if (!pPixmap) return FALSE; + pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen); pExaPixmap = ExaGetPixmapPriv(pPixmap); - if (pExaPixmap) + if (pExaPixmap) { pExaPixmap->sys_ptr = pPixData; - pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen); + exaSetAccelBlock(pExaScr, pExaPixmap, + width, height, bitsPerPixel); + } + if (pExaScr->info->ModifyPixmapHeader) { ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth, From 35982bc109d424c464551ab22ec90af69908c884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 11 Apr 2008 11:09:13 -0400 Subject: [PATCH 183/183] Make DRI2 a serverlayout/serverflags option. Add xf86DRI2Enabled() to export the value of the setting. --- hw/xfree86/common/xf86.h | 1 + hw/xfree86/common/xf86Config.c | 25 +++++++++++++++++++++---- hw/xfree86/common/xf86Privstr.h | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 4b3e10463..065102fb5 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -71,6 +71,7 @@ extern Bool sbusSlotClaimed; #endif extern confDRIRec xf86ConfigDRI; extern Bool xf86inSuspend; +extern Bool xf86DRI2Enabled(void); #define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \ xf86ScreenKey)) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 3cc04f0a1..8e412b56d 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -766,6 +766,7 @@ typedef enum { FLAG_AUTO_ADD_DEVICES, FLAG_AUTO_ENABLE_DEVICES, FLAG_GLX_VISUALS, + FLAG_DRI2, } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -837,16 +838,18 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_ALLOW_EMPTY_INPUT, "AllowEmptyInput", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, + { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, + { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN, + { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN, {0}, TRUE }, - { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN, + { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN, {0}, TRUE }, { FLAG_GLX_VISUALS, "GlxVisuals", OPTV_STRING, {0}, FALSE }, + { FLAG_DRI2, "DRI2", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -1179,9 +1182,23 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Msg(from, "Xinerama: enabled\n"); #endif +#ifdef DRI2 + xf86Info.dri2 = FALSE; + xf86Info.dri2From = X_DEFAULT; + if (xf86GetOptValBool(FlagOptions, FLAG_DRI2, &value)) { + xf86Info.dri2 = value; + xf86Info.dri2From = X_CONFIG; + } +#endif + return TRUE; } +Bool xf86DRI2Enabled(void) +{ + return xf86Info.dri2; +} + /* * Locate the core input devices. These can be specified/located in * the following ways, in order of priority: diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index d97ca440e..8cab56ec8 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -149,6 +149,9 @@ typedef struct { Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */ Bool autoEnableDevices; /* Whether to enable, or let the client * control. */ + + Bool dri2; + MessageType dri2From; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension