Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework

Conflicts:

	hw/xfree86/os-support/bus/Pci.c
	hw/xfree86/os-support/bus/linuxPci.c
This commit is contained in:
Ian Romanick 2007-06-18 16:51:13 -07:00
commit ab7a6d860d
220 changed files with 5396 additions and 14713 deletions

View File

@ -46,12 +46,13 @@ libglx_la_SOURCES = \
glxdrawable.h \ glxdrawable.h \
glxext.c \ glxext.c \
glxext.h \ glxext.h \
glxvisuals.c \ glxglcore.c \
glxscreens.c \ glxscreens.c \
glxscreens.h \ glxscreens.h \
glxserver.h \ glxserver.h \
glxutil.c \ glxutil.c \
glxutil.h \ glxutil.h \
glxvisuals.c \
indirect_dispatch.c \ indirect_dispatch.c \
indirect_dispatch.h \ indirect_dispatch.h \
indirect_dispatch_swap.c \ indirect_dispatch_swap.c \

View File

@ -1019,6 +1019,7 @@ __glXCreateARGBConfig(__GLXscreen *screen)
VisualPtr visual; VisualPtr visual;
int i; int i;
/* search for a 32-bit visual */
visual = NULL; visual = NULL;
for (i = 0; i < screen->pScreen->numVisuals; i++) for (i = 0; i < screen->pScreen->numVisuals; i++)
if (screen->pScreen->visuals[i].nplanes == 32) { if (screen->pScreen->visuals[i].nplanes == 32) {
@ -1037,8 +1038,22 @@ __glXCreateARGBConfig(__GLXscreen *screen)
if (modes == NULL) if (modes == NULL)
return; return;
modes->next = screen->modes; /* Insert this new mode at the TAIL of the linked list.
* Previously, the mode was incorrectly inserted at the head of the
* list, causing find_mesa_visual() to be off by one. This would
* GLX clients to blow up if they attempted to use the last mode
* in the list!
*/
{
__GLcontextModes *prev = NULL, *m;
for (m = screen->modes; m; m = m->next)
prev = m;
if (prev)
prev->next = modes;
else
screen->modes = modes; screen->modes = modes;
}
screen->numUsableVisuals++; screen->numUsableVisuals++;
screen->numVisuals++; screen->numVisuals++;
@ -1104,6 +1119,9 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
} }
pGlxScreen = __glXActiveScreens[screen]; pGlxScreen = __glXActiveScreens[screen];
/* Create the "extra" 32bpp ARGB visual, if not already added.
* XXX This is questionable place to do so! Re-examine this someday.
*/
__glXCreateARGBConfig(pGlxScreen); __glXCreateARGBConfig(pGlxScreen);
reply.numFBConfigs = pGlxScreen->numUsableVisuals; reply.numFBConfigs = pGlxScreen->numUsableVisuals;
@ -1661,6 +1679,7 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
xGLXGetDrawableAttributesReply reply; xGLXGetDrawableAttributesReply reply;
CARD32 attributes[4]; CARD32 attributes[4];
int numAttribs; int numAttribs;
PixmapPtr pixmap;
glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes); glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
if (!glxPixmap) { if (!glxPixmap) {
@ -1675,10 +1694,19 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
reply.numAttribs = numAttribs; reply.numAttribs = numAttribs;
attributes[0] = GLX_TEXTURE_TARGET_EXT; attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT; attributes[2] = GLX_Y_INVERTED_EXT;
attributes[3] = GL_FALSE; attributes[3] = GL_FALSE;
/* XXX this is merely less wrong, see fdo bug #8991 */
pixmap = (PixmapPtr) glxPixmap->pDraw;
if ((pixmap->drawable.width & (pixmap->drawable.width - 1)) ||
(pixmap->drawable.height & (pixmap->drawable.height - 1))
/* || strstr(CALL_GetString(GL_EXTENSIONS,
"GL_ARB_texture_non_power_of_two")) */)
attributes[1] = GLX_TEXTURE_RECTANGLE_EXT;
else
attributes[1] = GLX_TEXTURE_2D_EXT;
if (client->swapped) { if (client->swapped) {
__glXSwapGetDrawableAttributesReply(client, &reply, attributes); __glXSwapGetDrawableAttributesReply(client, &reply, attributes);
} else { } else {

View File

@ -40,9 +40,6 @@
** **
*/ */
/* XXX: should be defined somewhere globally */
#define CAPI
#include "GL/internal/glcore.h" #include "GL/internal/glcore.h"
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap; typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;

View File

@ -42,6 +42,10 @@
#include <damage.h> #include <damage.h>
#ifdef XF86DRI
#include <GL/internal/dri_interface.h>
#endif
typedef struct { typedef struct {
DrawablePtr pDraw; DrawablePtr pDraw;
@ -50,7 +54,12 @@ typedef struct {
ScreenPtr pScreen; ScreenPtr pScreen;
Bool idExists; Bool idExists;
int refcnt; int refcnt;
#ifdef XF86DRI
DamagePtr pDamage; DamagePtr pDamage;
__DRIcontext *pDRICtx;
GLint texname;
unsigned long offset;
#endif
} __GLXpixmap; } __GLXpixmap;
struct __GLXdrawable { struct __GLXdrawable {

View File

@ -76,6 +76,11 @@ struct __GLXDRIscreen {
xf86EnterVTProc *enterVT; xf86EnterVTProc *enterVT;
xf86LeaveVTProc *leaveVT; xf86LeaveVTProc *leaveVT;
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
__GLXpixmap* texOffsetOverride[16];
GLuint lastTexOffsetOverride;
unsigned char glx_enable_bits[__GLX_EXT_BYTES]; unsigned char glx_enable_bits[__GLX_EXT_BYTES];
}; };
@ -125,29 +130,74 @@ struct __GLXDRIdrawable {
static const char CREATE_NEW_SCREEN_FUNC[] = static const char CREATE_NEW_SCREEN_FUNC[] =
"__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION); "__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION);
/* The DRI driver entry point version wasn't bumped when the
* copySubBuffer functionality was added to the DRI drivers, but the
* functionality is still conditional on the value of the
* internal_api_version passed to __driCreateNewScreen. However, the
* screen constructor doesn't fail for a DRI driver that's older than
* the passed in version number, so there's no way we can know for
* sure that we can actually use the copySubBuffer functionality. But
* since the earliest (and at this point only) released mesa version
* (6.5) that uses the 20050727 entry point does have copySubBuffer,
* we'll just settle for that. We still have to pass in a higher to
* the screen constructor to enable the functionality.
*/
#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
static void static void
__glXDRIleaveServer(void) __glXDRIleaveServer(GLboolean rendering)
{ {
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(i);
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
int j;
for (j = 0; j < lastOverride; j++) {
__GLXpixmap *pGlxPix = texOffsetOverride[j];
if (pGlxPix && pGlxPix->texname) {
pGlxPix->offset =
screen->texOffsetStart((PixmapPtr)pGlxPix->pDraw);
}
}
}
}
DRIBlockHandler(NULL, NULL, NULL); DRIBlockHandler(NULL, NULL, NULL);
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(i);
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
int j;
for (j = 0; j < lastOverride; j++) {
__GLXpixmap *pGlxPix = texOffsetOverride[j];
if (pGlxPix && pGlxPix->texname) {
screen->driScreen.setTexOffset(pGlxPix->pDRICtx,
pGlxPix->texname,
pGlxPix->offset,
pGlxPix->pDraw->depth,
((PixmapPtr)pGlxPix->pDraw)->
devKind);
}
}
}
}
} }
static void static void
__glXDRIenterServer(void) __glXDRIenterServer(GLboolean rendering)
{ {
int i;
for (i = 0; rendering && i < screenInfo.numScreens; i++) {
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(i);
if (screen->lastTexOffsetOverride) {
CALL_Flush(GET_DISPATCH(), ());
break;
}
}
DRIWakeupHandler(NULL, 0, NULL); DRIWakeupHandler(NULL, 0, NULL);
} }
@ -289,19 +339,6 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
&context->driContext); &context->driContext);
} }
static int
glxCountBits(int word)
{
int ret = 0;
while (word) {
ret += (word & 1);
word >>= 1;
}
return ret;
}
static void static void
glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height) glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
{ {
@ -335,19 +372,75 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
int buffer, int buffer,
__GLXpixmap *glxPixmap) __GLXpixmap *glxPixmap)
{ {
RegionPtr pRegion; RegionPtr pRegion = NULL;
PixmapPtr pixmap; PixmapPtr pixmap;
int bpp; int w, h, bpp, override = 0;
GLenum target, format, type; GLenum target, format, type;
ScreenPtr pScreen = glxPixmap->pScreen;
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
pixmap = (PixmapPtr) glxPixmap->pDraw; pixmap = (PixmapPtr) glxPixmap->pDraw;
w = pixmap->drawable.width;
h = pixmap->drawable.height;
if (h & (h - 1) || w & (w - 1))
target = GL_TEXTURE_RECTANGLE_ARB;
else
target = GL_TEXTURE_2D;
if (screen->texOffsetStart && screen->driScreen.setTexOffset) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
int i, firstEmpty = 16, texname;
for (i = 0; i < 16; i++) {
if (texOffsetOverride[i] == glxPixmap)
goto alreadyin;
if (firstEmpty == 16 && !texOffsetOverride[i])
firstEmpty = i;
}
if (firstEmpty == 16) {
ErrorF("%s: Failed to register texture offset override\n", __func__);
goto nooverride;
}
if (firstEmpty >= screen->lastTexOffsetOverride)
screen->lastTexOffsetOverride = firstEmpty + 1;
texOffsetOverride[firstEmpty] = glxPixmap;
alreadyin:
override = 1;
glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext;
CALL_GetIntegerv(GET_DISPATCH(), (target == GL_TEXTURE_2D ?
GL_TEXTURE_BINDING_2D :
GL_TEXTURE_BINDING_RECTANGLE_NV,
&texname));
if (texname == glxPixmap->texname)
return Success;
glxPixmap->texname = texname;
screen->driScreen.setTexOffset(glxPixmap->pDRICtx, texname, 0,
pixmap->drawable.depth, pixmap->devKind);
}
nooverride:
if (!glxPixmap->pDamage) { if (!glxPixmap->pDamage) {
if (!override) {
glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone, glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
TRUE, glxPixmap->pScreen, NULL); TRUE, pScreen, NULL);
if (!glxPixmap->pDamage) if (!glxPixmap->pDamage)
return BadAlloc; return BadAlloc;
DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage); DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
}
pRegion = NULL; pRegion = NULL;
} else { } else {
pRegion = DamageRegion(glxPixmap->pDamage); pRegion = DamageRegion(glxPixmap->pDamage);
@ -360,30 +453,22 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
bpp = 4; bpp = 4;
format = GL_BGRA; format = GL_BGRA;
type = type =
#if X_BYTE_ORDER == X_LITTLE_ENDIAN #if X_BYTE_ORDER == X_BIG_ENDIAN
GL_UNSIGNED_BYTE; !override ? GL_UNSIGNED_INT_8_8_8_8_REV :
#else
GL_UNSIGNED_INT_8_8_8_8_REV;
#endif #endif
GL_UNSIGNED_BYTE;
} else { } else {
bpp = 2; bpp = 2;
format = GL_RGB; format = GL_RGB;
type = GL_UNSIGNED_SHORT_5_6_5; type = GL_UNSIGNED_SHORT_5_6_5;
} }
if (!(glxCountBits(pixmap->drawable.width) == 1 &&
glxCountBits(pixmap->drawable.height) == 1)
/* || strstr(CALL_GetString(GL_EXTENSIONS,
"GL_ARB_texture_non_power_of_two")) */)
target = GL_TEXTURE_RECTANGLE_ARB;
else
target = GL_TEXTURE_2D;
CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH,
pixmap->devKind / bpp) ); pixmap->devKind / bpp) );
if (pRegion == NULL) if (pRegion == NULL)
{ {
if (pixmap->drawable.depth == 24) if (!override && pixmap->drawable.depth == 24)
glxFillAlphaChannel(pixmap, glxFillAlphaChannel(pixmap,
pixmap->drawable.x, pixmap->drawable.x,
pixmap->drawable.y, pixmap->drawable.y,
@ -404,8 +489,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
0, 0,
format, format,
type, type,
pixmap->devPrivate.ptr) ); override ? NULL : pixmap->devPrivate.ptr) );
} else { } else if (!override) {
int i, numRects; int i, numRects;
BoxPtr p; BoxPtr p;
@ -436,6 +521,7 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
} }
} }
if (!override)
DamageEmpty(glxPixmap->pDamage); DamageEmpty(glxPixmap->pDamage);
return Success; return Success;
@ -446,6 +532,40 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
int buffer, int buffer,
__GLXpixmap *pixmap) __GLXpixmap *pixmap)
{ {
ScreenPtr pScreen = pixmap->pScreen;
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
GLuint lastOverride = screen->lastTexOffsetOverride;
if (lastOverride) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
int i;
for (i = 0; i < lastOverride; i++) {
if (texOffsetOverride[i] == pixmap) {
if (screen->texOffsetFinish)
screen->texOffsetFinish((PixmapPtr)pixmap->pDraw);
texOffsetOverride[i] = NULL;
if (i + 1 == lastOverride) {
lastOverride = 0;
while (i--) {
if (texOffsetOverride[i]) {
lastOverride = i + 1;
break;
}
}
screen->lastTexOffsetOverride = lastOverride;
break;
}
}
}
}
return Success; return Success;
} }
@ -666,9 +786,9 @@ static GLboolean createContext(__DRInativeDisplay *dpy, int screen,
fakeID = FakeClientID(0); fakeID = FakeClientID(0);
*(XID *) contextID = fakeID; *(XID *) contextID = fakeID;
__glXDRIenterServer(); __glXDRIenterServer(GL_FALSE);
retval = DRICreateContext(pScreen, visual, fakeID, hw_context); retval = DRICreateContext(pScreen, visual, fakeID, hw_context);
__glXDRIleaveServer(); __glXDRIleaveServer(GL_FALSE);
return retval; return retval;
} }
@ -677,9 +797,9 @@ static GLboolean destroyContext(__DRInativeDisplay *dpy, int screen,
{ {
GLboolean retval; GLboolean retval;
__glXDRIenterServer(); __glXDRIenterServer(GL_FALSE);
retval = DRIDestroyContext(screenInfo.screens[screen], context); retval = DRIDestroyContext(screenInfo.screens[screen], context);
__glXDRIleaveServer(); __glXDRIleaveServer(GL_FALSE);
return retval; return retval;
} }
@ -694,12 +814,12 @@ createDrawable(__DRInativeDisplay *dpy, int screen,
if (!pDrawable) if (!pDrawable)
return GL_FALSE; return GL_FALSE;
__glXDRIenterServer(); __glXDRIenterServer(GL_FALSE);
retval = DRICreateDrawable(screenInfo.screens[screen], retval = DRICreateDrawable(screenInfo.screens[screen],
drawable, drawable,
pDrawable, pDrawable,
hHWDrawable); hHWDrawable);
__glXDRIleaveServer(); __glXDRIleaveServer(GL_FALSE);
return retval; return retval;
} }
@ -713,11 +833,11 @@ destroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
if (!pDrawable) if (!pDrawable)
return GL_FALSE; return GL_FALSE;
__glXDRIenterServer(); __glXDRIenterServer(GL_FALSE);
retval = DRIDestroyDrawable(screenInfo.screens[screen], retval = DRIDestroyDrawable(screenInfo.screens[screen],
drawable, drawable,
pDrawable); pDrawable);
__glXDRIleaveServer(); __glXDRIleaveServer(GL_FALSE);
return retval; return retval;
} }
@ -754,20 +874,44 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen,
return GL_FALSE; return GL_FALSE;
} }
__glXDRIenterServer(); __glXDRIenterServer(GL_FALSE);
retval = DRIGetDrawableInfo(screenInfo.screens[screen], retval = DRIGetDrawableInfo(screenInfo.screens[screen],
pDrawable, index, stamp, pDrawable, index, stamp,
x, y, width, height, x, y, width, height,
numClipRects, &pClipRects, numClipRects, &pClipRects,
backX, backY, backX, backY,
numBackClipRects, &pBackClipRects); numBackClipRects, &pBackClipRects);
__glXDRIleaveServer(); __glXDRIleaveServer(GL_FALSE);
if (*numClipRects > 0) { if (*numClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numClipRects; size = sizeof (drm_clip_rect_t) * *numClipRects;
*ppClipRects = xalloc (size); *ppClipRects = xalloc (size);
if (*ppClipRects != NULL)
memcpy (*ppClipRects, pClipRects, size); /* Clip cliprects to screen dimensions (redirected windows) */
if (*ppClipRects != NULL) {
ScreenPtr pScreen = screenInfo.screens[screen];
int i, j;
for (i = 0, j = 0; i < *numClipRects; i++) {
(*ppClipRects)[j].x1 = max(pClipRects[i].x1, 0);
(*ppClipRects)[j].y1 = max(pClipRects[i].y1, 0);
(*ppClipRects)[j].x2 = min(pClipRects[i].x2, pScreen->width);
(*ppClipRects)[j].y2 = min(pClipRects[i].y2, pScreen->height);
if ((*ppClipRects)[j].x1 < (*ppClipRects)[j].x2 &&
(*ppClipRects)[j].y1 < (*ppClipRects)[j].y2) {
j++;
}
}
if (*numClipRects != j) {
*numClipRects = j;
*ppClipRects = xrealloc (*ppClipRects,
sizeof (drm_clip_rect_t) *
*numClipRects);
}
} else
*numClipRects = 0;
} }
else { else {
*ppClipRects = NULL; *ppClipRects = NULL;
@ -829,12 +973,16 @@ static Bool
glxDRIEnterVT (int index, int flags) glxDRIEnterVT (int index, int flags)
{ {
__GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index); __GLXDRIscreen *screen = (__GLXDRIscreen *) __glXgetActiveScreen(index);
Bool ret;
LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n"); LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n");
if (!(*screen->enterVT) (index, flags))
return FALSE;
glxResumeClients(); glxResumeClients();
return (*screen->enterVT) (index, flags); return TRUE;
} }
static void static void
@ -862,7 +1010,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__DRIframebuffer framebuffer; __DRIframebuffer framebuffer;
int fd = -1; int fd = -1;
int status; int status;
int api_ver = COPY_SUB_BUFFER_INTERNAL_VERSION; int api_ver = 20070121;
drm_magic_t magic; drm_magic_t magic;
drmVersionPtr version; drmVersionPtr version;
int newlyopened; int newlyopened;
@ -877,13 +1025,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
size_t buffer_size; size_t buffer_size;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable")) { if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
LogMessage(X_ERROR, "AIGLX: DRI module not loaded\n"); !DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
return NULL; !isCapable) {
} LogMessage(X_INFO,
if (!DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
LogMessage(X_ERROR,
"AIGLX: Screen %d is not DRI capable\n", pScreen->myNum); "AIGLX: Screen %d is not DRI capable\n", pScreen->myNum);
return NULL; return NULL;
} }
@ -1044,6 +1189,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error; goto handle_error;
} }
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
&screen->texOffsetFinish);
__glXScreenInit(&screen->base, pScreen); __glXScreenInit(&screen->base, pScreen);
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);

View File

@ -238,9 +238,9 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
* the latter case we need to lift the DRI lock manually. */ * the latter case we need to lift the DRI lock manually. */
if (!glxBlockClients) { if (!glxBlockClients) {
__glXleaveServer(); __glXleaveServer(GL_FALSE);
cx->destroy(cx); cx->destroy(cx);
__glXenterServer(); __glXenterServer(GL_FALSE);
} else { } else {
cx->next = glxPendingDestroyContexts; cx->next = glxPendingDestroyContexts;
glxPendingDestroyContexts = cx; glxPendingDestroyContexts = cx;
@ -275,7 +275,7 @@ static GLboolean errorOccured = GL_FALSE;
/* /*
** The GL was will call this routine if an error occurs. ** The GL was will call this routine if an error occurs.
*/ */
void __glXErrorCallBack(__GLinterface *gc, GLenum code) void __glXErrorCallBack(GLenum code)
{ {
errorOccured = GL_TRUE; errorOccured = GL_TRUE;
} }
@ -439,49 +439,49 @@ void glxResumeClients(void)
AttendClient(__glXClients[i]->client); AttendClient(__glXClients[i]->client);
} }
__glXleaveServer(); __glXleaveServer(GL_FALSE);
for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) { for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
next = cx->next; next = cx->next;
cx->destroy(cx); cx->destroy(cx);
} }
glxPendingDestroyContexts = NULL; glxPendingDestroyContexts = NULL;
__glXenterServer(); __glXenterServer(GL_FALSE);
} }
static void static void
__glXnopEnterServer(void) __glXnopEnterServer(GLboolean rendering)
{ {
} }
static void static void
__glXnopLeaveServer(void) __glXnopLeaveServer(GLboolean rendering)
{ {
} }
static void (*__glXenterServerFunc)(void) = __glXnopEnterServer; static void (*__glXenterServerFunc)(GLboolean) = __glXnopEnterServer;
static void (*__glXleaveServerFunc)(void) = __glXnopLeaveServer; static void (*__glXleaveServerFunc)(GLboolean) = __glXnopLeaveServer;
void __glXsetEnterLeaveServerFuncs(void (*enter)(void), void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
void (*leave)(void)) void (*leave)(GLboolean))
{ {
__glXenterServerFunc = enter; __glXenterServerFunc = enter;
__glXleaveServerFunc = leave; __glXleaveServerFunc = leave;
} }
void __glXenterServer(void) void __glXenterServer(GLboolean rendering)
{ {
glxServerLeaveCount--; glxServerLeaveCount--;
if (glxServerLeaveCount == 0) if (glxServerLeaveCount == 0)
(*__glXenterServerFunc)(); (*__glXenterServerFunc)(rendering);
} }
void __glXleaveServer(void) void __glXleaveServer(GLboolean rendering)
{ {
if (glxServerLeaveCount == 0) if (glxServerLeaveCount == 0)
(*__glXleaveServerFunc)(); (*__glXleaveServerFunc)(rendering);
glxServerLeaveCount++; glxServerLeaveCount++;
} }
@ -546,11 +546,12 @@ static int __glXDispatch(ClientPtr client)
opcode, opcode,
client->swapped); client->swapped);
if (proc != NULL) { if (proc != NULL) {
__glXleaveServer(); GLboolean rendering = opcode <= X_GLXRenderLarge;
__glXleaveServer(rendering);
retval = (*proc)(cl, (GLbyte *) stuff); retval = (*proc)(cl, (GLbyte *) stuff);
__glXenterServer(); __glXenterServer(rendering);
} }
else { else {
retval = BadRequest; retval = BadRequest;

View File

@ -66,7 +66,7 @@ typedef struct {
extern GLboolean __glXFreeContext(__GLXcontext *glxc); extern GLboolean __glXFreeContext(__GLXcontext *glxc);
extern void __glXFlushContextCache(void); extern void __glXFlushContextCache(void);
extern void __glXErrorCallBack(__GLinterface *gc, GLenum code); extern void __glXErrorCallBack(GLenum code);
extern void __glXClearErrorOccured(void); extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void); extern GLboolean __glXErrorOccured(void);
extern void __glXResetLargeCommandStatus(__GLXclientState*); extern void __glXResetLargeCommandStatus(__GLXclientState*);

View File

@ -45,7 +45,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <glxdrawable.h> #include <glxdrawable.h>
#include <glxcontext.h> #include <glxcontext.h>
#include <glxutil.h> #include <glxutil.h>
#include "xmesaP.h"
#include "glcontextmodes.h" #include "glcontextmodes.h"
#include "os.h" #include "os.h"
@ -107,11 +106,11 @@ __glXMesaDrawableSwapBuffers(__GLXdrawable *base)
* why we need to re-take the lock and swap in the server context * why we need to re-take the lock and swap in the server context
* before calling XMesaSwapBuffers() here. /me shakes head. */ * before calling XMesaSwapBuffers() here. /me shakes head. */
__glXenterServer(); __glXenterServer(GL_FALSE);
XMesaSwapBuffers(glxPriv->xm_buf); XMesaSwapBuffers(glxPriv->xm_buf);
__glXleaveServer(); __glXleaveServer(GL_FALSE);
return GL_TRUE; return GL_TRUE;
} }
@ -259,12 +258,14 @@ __glXMesaScreenDestroy(__GLXscreen *screen)
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen; __GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
int i; int i;
if (mesaScreen->xm_vis) {
for (i = 0; i < mesaScreen->num_vis; i++) { for (i = 0; i < mesaScreen->num_vis; i++) {
if (mesaScreen->xm_vis[i]) if (mesaScreen->xm_vis[i])
XMesaDestroyVisual(mesaScreen->xm_vis[i]); XMesaDestroyVisual(mesaScreen->xm_vis[i]);
} }
xfree(mesaScreen->xm_vis); xfree(mesaScreen->xm_vis);
}
__glXScreenDestroy(screen); __glXScreenDestroy(screen);

View File

@ -40,9 +40,6 @@
** **
*/ */
/* XXX: should be defined somewhere globally */
#define CAPI
#include "GL/internal/glcore.h" #include "GL/internal/glcore.h"
/* /*

View File

@ -131,10 +131,10 @@ struct __GLXprovider {
void GlxPushProvider(__GLXprovider *provider); void GlxPushProvider(__GLXprovider *provider);
void __glXsetEnterLeaveServerFuncs(void (*enter)(void), void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
void (*leave)(void)); void (*leave)(GLboolean));
void __glXenterServer(void); void __glXenterServer(GLboolean rendering);
void __glXleaveServer(void); void __glXleaveServer(GLboolean rendering);
void glxSuspendClients(void); void glxSuspendClients(void);
void glxResumeClients(void); void glxResumeClients(void);

View File

@ -211,8 +211,6 @@ extern HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc); extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc); extern HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc);
extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc);
extern HIDDEN void __glXDisp_TexParameterf(GLbyte * pc); extern HIDDEN void __glXDisp_TexParameterf(GLbyte * pc);
extern HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc); extern HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc);
extern HIDDEN void __glXDisp_TexParameteri(GLbyte * pc); extern HIDDEN void __glXDisp_TexParameteri(GLbyte * pc);
@ -519,6 +517,8 @@ extern HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc); extern HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc);
extern HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc); extern HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc); extern HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc);
extern HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc); extern HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc);
extern HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc); extern HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc);
extern HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc); extern HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc);
@ -849,10 +849,8 @@ extern HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *
extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc);
extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc);
extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc); extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc);
@ -877,6 +875,10 @@ extern HIDDEN void __glXDisp_Map2f(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Map2f(GLbyte * pc); extern HIDDEN void __glXDispSwap_Map2f(GLbyte * pc);
extern HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc); extern HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc); extern HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc);
extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);

View File

@ -370,6 +370,7 @@ __glGetBooleanv_size(GLenum e)
case GL_PROJECTION_STACK_DEPTH: case GL_PROJECTION_STACK_DEPTH:
case GL_TEXTURE_STACK_DEPTH: case GL_TEXTURE_STACK_DEPTH:
case GL_ATTRIB_STACK_DEPTH: case GL_ATTRIB_STACK_DEPTH:
case GL_CLIENT_ATTRIB_STACK_DEPTH:
case GL_ALPHA_TEST: case GL_ALPHA_TEST:
case GL_ALPHA_TEST_FUNC: case GL_ALPHA_TEST_FUNC:
case GL_ALPHA_TEST_REF: case GL_ALPHA_TEST_REF:
@ -448,6 +449,7 @@ __glGetBooleanv_size(GLenum e)
case GL_MAX_NAME_STACK_DEPTH: case GL_MAX_NAME_STACK_DEPTH:
case GL_MAX_PROJECTION_STACK_DEPTH: case GL_MAX_PROJECTION_STACK_DEPTH:
case GL_MAX_TEXTURE_STACK_DEPTH: case GL_MAX_TEXTURE_STACK_DEPTH:
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
case GL_SUBPIXEL_BITS: case GL_SUBPIXEL_BITS:
case GL_INDEX_BITS: case GL_INDEX_BITS:
case GL_RED_BITS: case GL_RED_BITS:
@ -639,7 +641,7 @@ __glGetBooleanv_size(GLenum e)
case GL_PROGRAM_ERROR_POSITION_ARB: case GL_PROGRAM_ERROR_POSITION_ARB:
case GL_DEPTH_CLAMP_NV: case GL_DEPTH_CLAMP_NV:
case GL_NUM_COMPRESSED_TEXTURE_FORMATS: case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
/* case GL_NUM_TEXTURE_COMPRESSED_FORMATS_ARB:*/ /* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/
case GL_MAX_VERTEX_UNITS_ARB: case GL_MAX_VERTEX_UNITS_ARB:
case GL_ACTIVE_VERTEX_UNITS_ARB: case GL_ACTIVE_VERTEX_UNITS_ARB:
case GL_WEIGHT_SUM_UNITY_ARB: case GL_WEIGHT_SUM_UNITY_ARB:
@ -699,6 +701,8 @@ __glGetBooleanv_size(GLenum e)
/* case GL_POINT_SPRITE_NV:*/ /* case GL_POINT_SPRITE_NV:*/
case GL_POINT_SPRITE_R_MODE_NV: case GL_POINT_SPRITE_R_MODE_NV:
case GL_MAX_VERTEX_ATTRIBS_ARB: case GL_MAX_VERTEX_ATTRIBS_ARB:
case GL_MAX_TEXTURE_COORDS_ARB:
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
case GL_DEPTH_BOUNDS_TEST_EXT: case GL_DEPTH_BOUNDS_TEST_EXT:
case GL_STENCIL_TEST_TWO_SIDE_EXT: case GL_STENCIL_TEST_TWO_SIDE_EXT:
case GL_ACTIVE_STENCIL_FACE_EXT: case GL_ACTIVE_STENCIL_FACE_EXT:
@ -1005,8 +1009,6 @@ __glGetProgramivARB_size(GLenum e)
case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
case GL_MAX_TEXTURE_COORDS_ARB:
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
case GL_PROGRAM_FORMAT_ARB: case GL_PROGRAM_FORMAT_ARB:
case GL_PROGRAM_INSTRUCTIONS_ARB: case GL_PROGRAM_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:

View File

@ -1231,8 +1231,8 @@ const struct __glXDispatchInfo Render_dispatch_info = {
}; };
/*****************************************************************/ /*****************************************************************/
/* tree depth = 13 */ /* tree depth = 12 */
static const int_fast16_t VendorPriv_dispatch_tree[155] = { static const int_fast16_t VendorPriv_dispatch_tree[152] = {
/* [0] -> opcode range [0, 131072], node depth 1 */ /* [0] -> opcode range [0, 131072], node depth 1 */
2, 2,
5, 5,
@ -1474,17 +1474,12 @@ static const int_fast16_t VendorPriv_dispatch_tree[155] = {
/* [149] -> opcode range [65536, 65568], node depth 12 */ /* [149] -> opcode range [65536, 65568], node depth 12 */
1, 1,
152,
EMPTY_LEAF,
/* [152] -> opcode range [65536, 65552], node depth 13 */
1,
LEAF(88), LEAF(88),
EMPTY_LEAF, EMPTY_LEAF,
}; };
static const void *VendorPriv_function_table[96][2] = { static const void *VendorPriv_function_table[104][2] = {
/* [ 0] = 0 */ {NULL, NULL}, /* [ 0] = 0 */ {NULL, NULL},
/* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT}, /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT},
/* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT}, /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT},
@ -1581,6 +1576,14 @@ static const void *VendorPriv_function_table[96][2] = {
/* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
/* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
/* [ 95] = 65543 */ {NULL, NULL}, /* [ 95] = 65543 */ {NULL, NULL},
/* [ 96] = 65544 */ {NULL, NULL},
/* [ 97] = 65545 */ {NULL, NULL},
/* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX},
/* [ 99] = 65547 */ {NULL, NULL},
/* [ 100] = 65548 */ {NULL, NULL},
/* [ 101] = 65549 */ {NULL, NULL},
/* [ 102] = 65550 */ {NULL, NULL},
/* [ 103] = 65551 */ {NULL, NULL},
}; };
const struct __glXDispatchInfo VendorPriv_dispatch_info = { const struct __glXDispatchInfo VendorPriv_dispatch_info = {

2
GL/mesa/.gitignore vendored
View File

@ -1,6 +1,6 @@
X/drivers X/drivers
X/glxheader.h X/glxheader.h
X/xmesaP.h X/xm*.h
X/xm*.c X/xm*.c
mesa/drivers mesa/drivers
mesa/glxheader.h mesa/glxheader.h

View File

@ -22,14 +22,11 @@ AM_CFLAGS = \
-DXFree86Server \ -DXFree86Server \
@GLX_DEFINES@ @GLX_DEFINES@
libX_la_SOURCES = xf86glx.c \
xf86glx_util.c \
xf86glx_util.h
nodist_libX_la_SOURCES = \ nodist_libX_la_SOURCES = \
xm_api.c \ xm_api.c \
xm_buffer.c \ xm_buffer.c \
xm_dd.c \ xm_dd.c \
xm_image.c \
xm_line.c \ xm_line.c \
xm_span.c \ xm_span.c \
xm_tri.c \ xm_tri.c \

View File

@ -1,149 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include "xf86glx_util.h"
#include <X11/Xmd.h>
#ifdef ROUNDUP
#undef ROUNDUP
#endif
#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data)
{
XMesaImage *image;
image = (XMesaImage *)xalloc(sizeof(XMesaImage));
if (image) {
image->width = width;
image->height = height;
image->data = data;
/* Always pad to 32 bits */
image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32);
image->bits_per_pixel = bitsPerPixel;
}
return image;
}
void XMesaDestroyImage(XMesaImage *image)
{
if (image->data)
free(image->data);
xfree(image);
}
unsigned long XMesaGetPixel(XMesaImage *image, int x, int y)
{
CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
CARD8 *i8;
CARD16 *i16;
CARD32 *i32;
switch (image->bits_per_pixel) {
case 8:
i8 = (CARD8 *)row;
return i8[x];
break;
case 15:
case 16:
i16 = (CARD16 *)row;
return i16[x];
break;
case 24: /* WARNING: architecture specific code */
i8 = (CARD8 *)row;
return (((CARD32)i8[x*3]) |
(((CARD32)i8[x*3+1])<<8) |
(((CARD32)i8[x*3+2])<<16));
break;
case 32:
i32 = (CARD32 *)row;
return i32[x];
break;
}
return 0;
}
#ifndef XMESA_USE_PUTPIXEL_MACRO
void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel)
{
CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line);
CARD8 *i8;
CARD16 *i16;
CARD32 *i32;
switch (image->bits_per_pixel) {
case 8:
i8 = (CARD8 *)row;
i8[x] = (CARD8)pixel;
break;
case 15:
case 16:
i16 = (CARD16 *)row;
i16[x] = (CARD16)pixel;
break;
case 24: /* WARNING: architecture specific code */
i8 = (CARD8 *)__row;
i8[x*3] = (CARD8)(p);
i8[x*3+1] = (CARD8)(p>>8);
i8[x*3+2] = (CARD8)(p>>16);
case 32:
i32 = (CARD32 *)row;
i32[x] = (CARD32)pixel;
break;
}
}
#endif
void XMesaPutImageHelper(ScreenPtr display,
DrawablePtr d, GCPtr gc,
XMesaImage *image,
int src_x, int src_y,
int dest_x, int dest_y,
unsigned int width, unsigned int height)
{
/* NOT_DONE: Verify that the following works for all depths */
char *src = (image->data +
src_y * image->bytes_per_line +
((src_x * image->bits_per_pixel) >> 3));
ValidateGC(d, gc);
(*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height,
0, ZPixmap, src);
}

View File

@ -1,105 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
* Brian Paul <brian@precisioninsight.com>
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _XF86GLX_UTIL_H_
#define _XF86GLX_UTIL_H_
#ifdef __CYGWIN__
#undef WIN32
#undef _WIN32
#endif
#include <screenint.h>
#include <pixmap.h>
#include <gc.h>
#include "GL/xmesa.h"
#define XMESA_USE_PUTPIXEL_MACRO
struct _XMesaImageRec {
int width, height;
char *data;
int bytes_per_line; /* Padded to 32 bits */
int bits_per_pixel;
};
extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height,
char *data);
extern void XMesaDestroyImage(XMesaImage *image);
extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y);
#ifdef XMESA_USE_PUTPIXEL_MACRO
#define XMesaPutPixel(__i,__x,__y,__p) \
{ \
CARD8 *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \
CARD8 *__i8; \
CARD16 *__i16; \
CARD32 *__i32; \
switch (__i->bits_per_pixel) { \
case 8: \
__i8 = (CARD8 *)__row; \
__i8[__x] = (CARD8)__p; \
break; \
case 15: \
case 16: \
__i16 = (CARD16 *)__row; \
__i16[__x] = (CARD16)__p; \
break; \
case 24: /* WARNING: architecture specific code */ \
__i8 = (CARD8 *)__row; \
__i8[__x*3] = (CARD8)(__p); \
__i8[__x*3+1] = (CARD8)(__p>>8); \
__i8[__x*3+2] = (CARD8)(__p>>16); \
break; \
case 32: \
__i32 = (CARD32 *)__row; \
__i32[__x] = (CARD32)__p; \
break; \
} \
}
#else
extern void XMesaPutPixel(XMesaImage *image, int x, int y,
unsigned long pixel);
#endif
extern void XMesaPutImageHelper(ScreenPtr display,
DrawablePtr d, GCPtr gc,
XMesaImage *image,
int src_x, int src_y,
int dest_x, int dest_y,
unsigned int width, unsigned int height);
#endif /* _XF86GLX_UTIL_H_ */

View File

@ -61,10 +61,10 @@ nodist_libmain_la_SOURCES = accum.c \
matrix.c \ matrix.c \
mipmap.c \ mipmap.c \
mm.c \ mm.c \
occlude.c \
pixel.c \ pixel.c \
points.c \ points.c \
polygon.c \ polygon.c \
queryobj.c \
rastpos.c \ rastpos.c \
rbadaptors.c \ rbadaptors.c \
renderbuffer.c \ renderbuffer.c \

View File

@ -31,6 +31,7 @@ nodist_libslang_la_SOURCES = slang_builtin.c \
slang_library_noise.c \ slang_library_noise.c \
slang_link.c \ slang_link.c \
slang_log.c \ slang_log.c \
slang_mem.c \
slang_preprocess.c \ slang_preprocess.c \
slang_print.c \ slang_print.c \
slang_simplify.c \ slang_simplify.c \

View File

@ -21,8 +21,6 @@ INCLUDES = -I@MESA_SOURCE@/include \
nodist_libtnl_la_SOURCES = t_context.c \ nodist_libtnl_la_SOURCES = t_context.c \
t_draw.c \ t_draw.c \
t_pipeline.c \ t_pipeline.c \
t_vb_arbprogram.c \
t_vb_arbprogram_sse.c \
t_vb_cull.c \ t_vb_cull.c \
t_vb_fog.c \ t_vb_fog.c \
t_vb_light.c \ t_vb_light.c \

View File

@ -168,6 +168,8 @@ symlink_mesa_x() {
action xm_api.c action xm_api.c
action xm_buffer.c action xm_buffer.c
action xm_dd.c action xm_dd.c
action xm_image.c
action xm_image.h
action xm_line.c action xm_line.c
action xm_span.c action xm_span.c
action xm_tri.c action xm_tri.c
@ -225,9 +227,6 @@ symlink_glx() {
dst_dir glx dst_dir glx
action indirect_size.h action indirect_size.h
src_dir src/mesa/drivers/dri/common
action glcontextmodes.c action glcontextmodes.c
action glcontextmodes.h action glcontextmodes.h

View File

@ -34,7 +34,6 @@ MODULE_SRCS = \
xcmisc.c xcmisc.c
# Extra configuration files ship with some extensions # Extra configuration files ship with some extensions
SERVERCONFIGdir = $(libdir)/xserver
SERVERCONFIG_DATA = SERVERCONFIG_DATA =
# Optional sources included if extension enabled by configure.ac rules # Optional sources included if extension enabled by configure.ac rules

View File

@ -243,6 +243,11 @@ SyncInitServerTime(
void void
); );
static void
SyncInitIdleTime(
void
);
static void static void
SyncResetProc( SyncResetProc(
ExtensionEntry * /* extEntry */ ExtensionEntry * /* extEntry */
@ -2400,6 +2405,7 @@ SyncExtensionInit(INITARGS)
* because there is always a servertime counter. * because there is always a servertime counter.
*/ */
SyncInitServerTime(); SyncInitServerTime();
SyncInitIdleTime();
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Sync Extension %d.%d\n", fprintf(stderr, "Sync Extension %d.%d\n",
@ -2509,7 +2515,7 @@ ServertimeBracketValues(pCounter, pbracket_less, pbracket_greater)
} }
static void static void
SyncInitServerTime() SyncInitServerTime(void)
{ {
CARD64 resolution; CARD64 resolution;
@ -2520,3 +2526,116 @@ SyncInitServerTime()
ServertimeQueryValue, ServertimeBracketValues); ServertimeQueryValue, ServertimeBracketValues);
pnext_time = NULL; pnext_time = NULL;
} }
/*
* IDLETIME implementation
*/
static pointer IdleTimeCounter;
static XSyncValue *pIdleTimeValueLess;
static XSyncValue *pIdleTimeValueGreater;
static void
IdleTimeQueryValue (pointer pCounter, CARD64 *pValue_return)
{
CARD32 idle = GetTimeInMillis() - lastDeviceEventTime.milliseconds;
XSyncIntsToValue (pValue_return, idle, 0);
}
static void
IdleTimeBlockHandler (pointer env,
struct timeval **wt,
pointer LastSelectMask)
{
XSyncValue idle;
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
return;
IdleTimeQueryValue (NULL, &idle);
if (pIdleTimeValueLess &&
XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))
{
AdjustWaitForDelay (wt, 0);
}
else if (pIdleTimeValueGreater)
{
unsigned long timeout = 0;
if (XSyncValueLessThan (idle, *pIdleTimeValueGreater))
{
XSyncValue value;
Bool overflow;
XSyncValueSubtract (&value, *pIdleTimeValueGreater,
idle, &overflow);
timeout = XSyncValueLow32 (value);
}
AdjustWaitForDelay (wt, timeout);
}
}
static void
IdleTimeWakeupHandler (pointer env,
int rc,
pointer LastSelectMask)
{
XSyncValue idle;
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
return;
IdleTimeQueryValue (NULL, &idle);
if ((pIdleTimeValueGreater &&
XSyncValueGreaterThan (idle, *pIdleTimeValueGreater)) ||
(pIdleTimeValueLess && XSyncValueLessThan (idle, *pIdleTimeValueLess)))
{
SyncChangeCounter (IdleTimeCounter, idle);
}
}
static void
IdleTimeBracketValues (pointer pCounter,
CARD64 *pbracket_less,
CARD64 *pbracket_greater)
{
Bool registered = (pIdleTimeValueLess || pIdleTimeValueGreater);
if (registered && !pbracket_less && !pbracket_greater)
{
RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
IdleTimeWakeupHandler,
NULL);
}
else if (!registered && (pbracket_less || pbracket_greater))
{
RegisterBlockAndWakeupHandlers(IdleTimeBlockHandler,
IdleTimeWakeupHandler,
NULL);
}
pIdleTimeValueGreater = pbracket_greater;
pIdleTimeValueLess = pbracket_less;
}
static void
SyncInitIdleTime (void)
{
CARD64 resolution;
XSyncValue idle;
IdleTimeQueryValue (NULL, &idle);
XSyncIntToValue (&resolution, 4);
IdleTimeCounter = SyncCreateSystemCounter ("IDLETIME", idle, resolution,
XSyncCounterUnrestricted,
IdleTimeQueryValue,
IdleTimeBracketValues);
pIdleTimeValueLess = pIdleTimeValueGreater = NULL;
}

View File

@ -42,6 +42,12 @@ from The Open Group.
#include <X11/extensions/xcmiscstr.h> #include <X11/extensions/xcmiscstr.h>
#include "modinit.h" #include "modinit.h"
#if HAVE_STDINT_H
#include <stdint.h>
#elif !defined(UINT32_MAX)
#define UINT32_MAX 0xffffffffU
#endif
#if 0 #if 0
static unsigned char XCMiscCode; static unsigned char XCMiscCode;
#endif #endif
@ -143,7 +149,10 @@ ProcXCMiscGetXIDList(client)
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
pids = (XID *)ALLOCATE_LOCAL(stuff->count * sizeof(XID)); if (stuff->count > UINT32_MAX / sizeof(XID))
return BadAlloc;
pids = (XID *)Xalloc(stuff->count * sizeof(XID));
if (!pids) if (!pids)
{ {
return BadAlloc; return BadAlloc;
@ -164,7 +173,7 @@ ProcXCMiscGetXIDList(client)
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids); WriteSwappedDataToClient(client, count * sizeof(XID), pids);
} }
DEALLOCATE_LOCAL(pids); Xfree(pids);
return(client->noClientException); return(client->noClientException);
} }

View File

@ -153,7 +153,7 @@ static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
*/ */
void void
XvExtensionInit() XvExtensionInit(void)
{ {
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
@ -205,7 +205,7 @@ XvExtensionInit()
} }
static Bool static Bool
CreateResourceTypes() CreateResourceTypes(void)
{ {
@ -335,13 +335,13 @@ XvResetProc(ExtensionEntry* extEntry)
} }
_X_EXPORT int _X_EXPORT int
XvGetScreenIndex() XvGetScreenIndex(void)
{ {
return XvScreenIndex; return XvScreenIndex;
} }
_X_EXPORT unsigned long _X_EXPORT unsigned long
XvGetRTPort() XvGetRTPort(void)
{ {
return XvRTPort; return XvRTPort;
} }

View File

@ -675,7 +675,7 @@ SProcXvMCDispatch (ClientPtr client)
} }
void void
XvMCExtensionInit() XvMCExtensionInit(void)
{ {
ExtensionEntry *extEntry; ExtensionEntry *extEntry;

View File

@ -226,7 +226,19 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
* *
*/ */
int int
NewInputDeviceRequest(InputOption *options) NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
{ {
return BadValue; return BadValue;
} }
/****************************************************************************
*
* Caller: configRemoveDevice (and others)
*
* Remove the specified device previously added.
*
*/
void
DeleteInputDeviceRequest(DeviceIntPtr dev)
{
}

View File

@ -696,11 +696,13 @@ CompositeExtensionInit (void)
if (GetPictureScreenIfSet(pScreen) == NULL) if (GetPictureScreenIfSet(pScreen) == NULL)
return; return;
} }
#ifdef PANORAMIX
/* Xinerama's rewriting of window drawing before Composite gets to it /* Xinerama's rewriting of window drawing before Composite gets to it
* breaks Composite. * breaks Composite.
*/ */
if (!noPanoramiXExtension) if (!noPanoramiXExtension)
return; return;
#endif
CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow); CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
if (!CompositeClientWindowType) if (!CompositeClientWindowType)

View File

@ -92,12 +92,15 @@ configTeardown(void)
} }
static int static int
configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error) configAddDevice(DBusMessage *message, DBusMessageIter *iter,
DBusMessage *reply, DBusMessageIter *r_iter,
DBusError *error)
{ {
DBusMessageIter subiter; DBusMessageIter subiter;
InputOption *tmpo = NULL, *options = NULL; InputOption *tmpo = NULL, *options = NULL;
char *tmp = NULL; char *tmp = NULL;
int ret = BadMatch; int ret = BadMatch;
DeviceIntPtr dev = NULL;
DebugF("[config] adding device\n"); DebugF("[config] adding device\n");
@ -110,6 +113,11 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
options->key = xstrdup("_source"); options->key = xstrdup("_source");
options->value = xstrdup("client/dbus"); options->value = xstrdup("client/dbus");
if(!options->key || !options->value) {
ErrorF("[config] couldn't allocate first key/value pair\n");
ret = BadAlloc;
goto unwind;
}
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) { while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1); tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1);
@ -118,6 +126,8 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
ret = BadAlloc; ret = BadAlloc;
goto unwind; goto unwind;
} }
tmpo->next = options;
options = tmpo;
dbus_message_iter_recurse(iter, &subiter); dbus_message_iter_recurse(iter, &subiter);
@ -132,8 +142,8 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
tmp); tmp);
MALFORMED_MESSAGE(); MALFORMED_MESSAGE();
} }
tmpo->key = xstrdup(tmp); options->key = xstrdup(tmp);
if (!tmpo->key) { if (!options->key) {
ErrorF("[config] couldn't duplicate key!\n"); ErrorF("[config] couldn't duplicate key!\n");
ret = BadAlloc; ret = BadAlloc;
goto unwind; goto unwind;
@ -148,31 +158,37 @@ configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
dbus_message_iter_get_basic(&subiter, &tmp); dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp) if (!tmp)
MALFORMED_MESSAGE(); MALFORMED_MESSAGE();
tmpo->value = xstrdup(tmp); options->value = xstrdup(tmp);
if (!tmpo->value) { if (!options->value) {
ErrorF("[config] couldn't duplicate option!\n"); ErrorF("[config] couldn't duplicate option!\n");
ret = BadAlloc; ret = BadAlloc;
goto unwind; goto unwind;
} }
tmpo->next = options;
options = tmpo;
dbus_message_iter_next(iter); dbus_message_iter_next(iter);
} }
ret = NewInputDeviceRequest(options); ret = NewInputDeviceRequest(options, &dev);
if (ret != Success) if (ret != Success) {
DebugF("[config] NewInputDeviceRequest failed\n"); DebugF("[config] NewInputDeviceRequest failed\n");
goto unwind;
}
return ret; if (!dev) {
DebugF("[config] NewInputDeviceRequest succeeded, without device\n");
ret = BadMatch;
goto unwind;
}
if (!dbus_message_iter_append_basic(r_iter, DBUS_TYPE_INT32, &(dev->id))) {
ErrorF("[config] couldn't append to iterator\n");
ret = BadAlloc;
goto unwind;
}
unwind: unwind:
if (tmpo->key) if (dev && ret != Success)
xfree(tmpo->key); RemoveDevice(dev);
if (tmpo->value)
xfree(tmpo->value);
if (tmpo)
xfree(tmpo);
while (options) { while (options) {
tmpo = options; tmpo = options;
@ -212,7 +228,7 @@ configRemoveDevice(DBusMessage *message, DBusMessageIter *iter,
* already been removed. */ * already been removed. */
OsBlockSignals(); OsBlockSignals();
ProcessInputEvents(); ProcessInputEvents();
RemoveDevice(pDev); DeleteInputDeviceRequest(pDev);
OsReleaseSignals(); OsReleaseSignals();
return Success; return Success;
@ -221,45 +237,92 @@ unwind:
return ret; return ret;
} }
static int
configListDevices(DBusMessage *message, DBusMessageIter *iter,
DBusMessage *reply, DBusMessageIter *r_iter,
DBusError *error)
{
DeviceIntPtr d;
int ret = BadMatch;
for (d = inputInfo.devices; d; d = d->next) {
if (!dbus_message_iter_append_basic(r_iter, DBUS_TYPE_INT32,
&(d->id))) {
ErrorF("[config] couldn't append to iterator\n");
ret = BadAlloc;
goto unwind;
}
if (!dbus_message_iter_append_basic(r_iter, DBUS_TYPE_STRING,
&(d->name))) {
ErrorF("[config] couldn't append to iterator\n");
ret = BadAlloc;
goto unwind;
}
}
unwind:
return ret;
}
static DBusHandlerResult static DBusHandlerResult
configMessage(DBusConnection *connection, DBusMessage *message, void *closure) configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
{ {
DBusMessageIter iter; DBusMessageIter iter;
DBusError error; DBusError error;
DBusMessage *reply; DBusMessage *reply;
DBusMessageIter r_iter;
DBusConnection *bus = closure; DBusConnection *bus = closure;
int ret = BadDrawable; /* nonsensical value */ int ret = BadDrawable; /* nonsensical value */
dbus_error_init(&error); dbus_error_init(&error);
DebugF("[config] received a message\n");
if (strcmp(dbus_message_get_interface(message), if (strcmp(dbus_message_get_interface(message),
"org.x.config.input") == 0) { "org.x.config.input") == 0) {
if (!(reply = dbus_message_new_method_return(message))) {
ErrorF("[config] failed to create the reply message\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
dbus_message_iter_init_append(reply, &r_iter);
/* listDevices doesn't take any arguments */
if (strcmp(dbus_message_get_member(message), "listDevices") == 0)
ret = configListDevices(message, NULL, reply, &r_iter, &error);
else
{
if (!dbus_message_iter_init(message, &iter)) { if (!dbus_message_iter_init(message, &iter)) {
ErrorF("[config] failed to init iterator\n"); ErrorF("[config] failed to init iterator\n");
dbus_message_unref(reply);
dbus_error_free(&error); dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */ return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
} }
if (strcmp(dbus_message_get_member(message), "add") == 0) if (strcmp(dbus_message_get_member(message), "add") == 0)
ret = configAddDevice(message, &iter, &error); ret = configAddDevice(message, &iter, reply, &r_iter, &error);
else if (strcmp(dbus_message_get_member(message), "remove") == 0) else if (strcmp(dbus_message_get_member(message), "remove") == 0)
ret = configRemoveDevice(message, &iter, &error); ret = configRemoveDevice(message, &iter, &error);
if (ret != BadDrawable && ret != BadAlloc) { }
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) { if (ret != BadDrawable && ret != BadAlloc) {
if (!strlen(dbus_message_get_signature(reply)))
{
ret = -ret; /* return errors as negative numbers */
if (!dbus_message_iter_append_basic(&r_iter, DBUS_TYPE_INT32, &ret)) {
ErrorF("[config] couldn't append to iterator\n"); ErrorF("[config] couldn't append to iterator\n");
dbus_message_unref(reply);
dbus_error_free(&error); dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED; return DBUS_HANDLER_RESULT_HANDLED;
} }
}
if (!dbus_connection_send(bus, reply, NULL)) if (!dbus_connection_send(bus, reply, NULL))
ErrorF("[config] failed to send reply\n"); ErrorF("[config] failed to send reply\n");
dbus_connection_flush(bus);
dbus_message_unref(reply);
} }
dbus_message_unref(reply);
dbus_connection_flush(bus);
} }
dbus_error_free(&error); dbus_error_free(&error);
@ -410,13 +473,13 @@ configReconnect(OsTimerPtr timer, CARD32 time, pointer arg)
} }
void void
configInitialise() configInitialise(void)
{ {
TimerSet(NULL, 0, 1, configReconnect, NULL); TimerSet(NULL, 0, 1, configReconnect, NULL);
} }
void void
configFini() configFini(void)
{ {
DBusError error; DBusError error;

View File

@ -15,21 +15,23 @@ org.x.config.input:
Option names beginning with _ are not allowed; they are reserved Option names beginning with _ are not allowed; they are reserved
for internal use. for internal use.
Returns one int32, which is an X Status, as defined in X.h. If Returns one signed int32, which is the device id of the new device.
everything is successful, Success will be returned. BadMatch will If the return value is a negative number, it represents the X
be returned if the options given do not match any device. BadValue Status, as defined in X.h. BadMatch will be returned if the options
is returned for a malformed message. given do not match any device. BadValue is returned for a malformed
message. (Example: 8 is new device id 8. -8 is BadMatch.)
Notably, BadAlloc is never returned: the server internally signals Notably, BadAlloc is never returned: the server internally signals
to D-BUS that the attempt failed for lack of memory. to D-BUS that the attempt failed for lack of memory.
The return does not notify the client of which devices were created
or modified as a result of this request: clients are encouraged to
listen for the XInput DevicePresenceNotify event to monitor changes
in the device list.
org.x.config.input.remove: org.x.config.input.remove:
Takes one int32 argument, which is the device ID to remove, i.e.: Takes one int32 argument, which is the device ID to remove, i.e.:
i i
is the signature. is the signature.
Same return values as org.x.config.input.add.
Returns one signed int32 which represents an X status as defined in
X.h. See org.x.config.input.add. Error codes are negative numbers.
org.x.config.input.listDevices:
Lists the currently active devices. No argument.
Return value is sequence of <id> <name> <id> <name> ...

View File

@ -123,19 +123,19 @@ b = __swap16(a);
], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) ], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no'])
AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) AC_MSG_RESULT([$SYS_ENDIAN__SWAP])
AC_MSG_CHECKING([for bswap_16 variant of <sys/endian.h> byteswapping macros]) AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
AC_LINK_IFELSE([AC_LANG_PROGRAM([ AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/endian.h> #include <sys/endian.h>
], [ ], [
int a = 1, b; int a = 1, b;
b = bswap_16(a); b = bswap16(a);
]) ])
], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) ], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no'])
AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) AC_MSG_RESULT([$SYS_ENDIAN_BSWAP])
if test "$SYS_ENDIAN_BSWAP" = "yes" ; then if test "$SYS_ENDIAN_BSWAP" = "yes" ; then
USE_SYS_ENDIAN_H=yes USE_SYS_ENDIAN_H=yes
BSWAP=bswap_ BSWAP=bswap
else else
if test "$SYS_ENDIAN__SWAP" = "yes" ; then if test "$SYS_ENDIAN__SWAP" = "yes" ; then
USE_SYS_ENDIAN_H=yes USE_SYS_ENDIAN_H=yes
@ -165,23 +165,24 @@ AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
dnl Old HAS_* names used in os/*.c. dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize], AC_CHECK_FUNC([getdtablesize],
AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the `getdtablesize' function.])) AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
AC_CHECK_FUNC([getifaddrs], AC_CHECK_FUNC([getifaddrs],
AC_DEFINE(HAS_GETIFADDRS, 1, [Have the `getifaddrs' function.])) AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
AC_CHECK_FUNC([getpeereid], AC_CHECK_FUNC([getpeereid],
AC_DEFINE(HAS_GETPEEREID, 1, [Have the `getpeereid' function.])) AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
AC_CHECK_FUNC([getpeerucred], AC_CHECK_FUNC([getpeerucred],
AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the `getpeerucred' function.])) AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no) AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno]) AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])
AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno]) AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])
dnl Check for mmap support for Xvfb dnl Check for mmap support for Xvfb
AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the `mmap' function.])) AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
dnl Find the math libary dnl Find the math libary
AC_CHECK_LIB(m, sqrt) AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h]) AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])
@ -361,30 +362,12 @@ case $host_os in
esac esac
AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes) AM_CONDITIONAL(KDRIVE_HW, test "x$KDRIVE_HW" = xyes)
AC_MSG_CHECKING(for MMX capable platform)
if test "x$use_x86_asm" = xyes && test "x$GCC" = xyes ; then
AC_PREPROC_IFELSE([
#if (!defined (__GNUC__) || __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
#error Not supported
#endif
], mmx_capable=yes, mmx_capable=no)
else
mmx_capable=no
fi
AC_MSG_RESULT([$mmx_capable])
AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes])
OSNAME=`uname -srm`
AC_DEFINE_UNQUOTED(OSNAME, "$OSNAME",
[Define to OS Name string to display for build OS in Xorg log])
DEFAULT_VENDOR_NAME="The X.Org Foundation" DEFAULT_VENDOR_NAME="The X.Org Foundation"
DEFAULT_VENDOR_NAME_SHORT="X.Org" DEFAULT_VENDOR_NAME_SHORT="X.Org"
DEFAULT_VERSION_MAJOR=7 DEFAULT_VERSION_MAJOR=7
DEFAULT_VERSION_MINOR=1 DEFAULT_VERSION_MINOR=2
DEFAULT_VERSION_PATCH=99 DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_SNAP=2 DEFAULT_VERSION_SNAP=0
DEFAULT_RELEASE_DATE="21 December 2005" DEFAULT_RELEASE_DATE="21 December 2005"
DEFAULT_VENDOR_WEB="http://wiki.x.org" DEFAULT_VENDOR_WEB="http://wiki.x.org"
@ -444,18 +427,15 @@ AC_ARG_WITH(builder-addr, AS_HELP_STRING([--with-builder-addr=ADDRESS],
[Builder address (default: xorg@lists.freedesktop.org)]), [Builder address (default: xorg@lists.freedesktop.org)]),
[ BUILDERADDR="$withval" ], [ BUILDERADDR="$withval" ],
[ BUILDERADDR="xorg@lists.freedesktop.org" ]) [ BUILDERADDR="xorg@lists.freedesktop.org" ])
AC_ARG_WITH(os-name, AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: UNKNOWN)]), AC_ARG_WITH(os-name, AS_HELP_STRING([--with-os-name=OSNAME], [Name of OS (default: output of "uname -srm")]),
[ OSNAME="$withval" ], [ OSNAME="$withval" ],
[ OSNAME="UNKNOWN" ]) [ OSNAME=`uname -srm` ])
AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]), AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
[ OSVENDOR="$withval" ], [ OSVENDOR="$withval" ],
[ OSVENDOR="" ]) [ OSVENDOR="" ])
AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]), AC_ARG_WITH(builderstring, AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
[ BUILDERSTRING="$withval" ] [ BUILDERSTRING="$withval" ]
[ ]) [ ])
AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
[ MESA_SOURCE="$withval" ],
[ MESA_SOURCE="" ])
AC_ARG_WITH(fontdir, AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]), AC_ARG_WITH(fontdir, AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
[ FONTDIR="$withval" ], [ FONTDIR="$withval" ],
[ FONTDIR="${libdir}/X11/fonts" ]) [ FONTDIR="${libdir}/X11/fonts" ])
@ -472,9 +452,9 @@ AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to
AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RGB database (default: ${datadir}/X11/rgb)]), AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RGB database (default: ${datadir}/X11/rgb)]),
[ RGBPATH="$withval" ], [ RGBPATH="$withval" ],
[ RGBPATH="${datadir}/X11/rgb" ]) [ RGBPATH="${datadir}/X11/rgb" ])
AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]), AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], [Path to server config (default: ${libdir}/xserver)]),
[ DRI_DRIVER_PATH="$withval" ], [ SERVERCONFIG="$withval" ],
[ DRI_DRIVER_PATH="${libdir}/dri" ]) [ SERVERCONFIG="${libdir}/xserver" ])
APPLE_APPLICATIONS_DIR="${bindir}/Applications" APPLE_APPLICATIONS_DIR="${bindir}/Applications"
AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]), AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
[ APPLE_APPLICATIONS_DIR="${withval}" ]. [ APPLE_APPLICATIONS_DIR="${withval}" ].
@ -494,6 +474,20 @@ AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use
[NULL_ROOT_CURSOR=$enableval], [NULL_ROOT_CURSOR=$enableval],
[NULL_ROOT_CURSOR=no]) [NULL_ROOT_CURSOR=no])
dnl GLX build options
AC_ARG_WITH(mesa-source, AS_HELP_STRING([--with-mesa-source=MESA_SOURCE], [Path to Mesa source tree]),
[ MESA_SOURCE="$withval" ],
[ MESA_SOURCE="" ])
AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
[ DRI_DRIVER_PATH="$withval" ],
[ DRI_DRIVER_PATH="${libdir}/dri" ])
AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]),
[AIGLX=$enableval],
[AIGLX=yes])
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]),
[GLX_USE_TLS=$enableval],
[GLX_USE_TLS=no])
dnl Extensions. dnl Extensions.
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes]) AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes]) AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
@ -508,8 +502,6 @@ AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build Scr
AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto]) AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto]) AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes]) AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes])
AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]), [AIGLX=$enableval], [AIGLX=yes])
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]), [GLX_USE_TLS=$enableval], [GLX_USE_TLS=no])
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval]) AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes]) AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto]) AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
@ -621,9 +613,11 @@ XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la' XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
PIXMAN="[pixman >= 0.9.2]"
dnl Core modules for most extensions, et al. dnl Core modules for most extensions, et al.
REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]" REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto [xproto >= 7.0.9] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc" REQUIRED_LIBS="xfont xau fontenc $PIXMAN"
if test "x$DBUS" = xauto; then if test "x$DBUS" = xauto; then
PKG_CHECK_MODULES(DBUS, dbus-1, [DBUS=yes], [DBUS=no]) PKG_CHECK_MODULES(DBUS, dbus-1, [DBUS=yes], [DBUS=no])
@ -871,7 +865,7 @@ XKB_LIB='$(top_builddir)/xkb/libxkb.la'
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la' XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1, AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have `strcasecmp'.])) [Do not have 'strcasecmp'.]))
if test "x$NULL_ROOT_CURSOR" = xyes; then if test "x$NULL_ROOT_CURSOR" = xyes; then
AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor]) AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
@ -934,6 +928,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VERSION_STRING}"
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path]) AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path]) AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
AC_DEFINE_DIR(SERVERCONFIGdir, SERVERCONFIG, [Server config path])
AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path]) AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path]) AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name]) AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
@ -942,6 +937,11 @@ AC_DEFINE_UNQUOTED(XORG_RELEASE, ["$VENDOR_RELEASE_STRING"], [Vendor release])
AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release]) AC_DEFINE_UNQUOTED(XORG_DATE, ["$RELEASE_DATE"], [Vendor release])
AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version]) AC_DEFINE_UNQUOTED(XORG_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address]) AC_DEFINE_UNQUOTED(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
if test -z "$OSNAME"; then
OSNAME="UNKNOWN"
fi
AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name]) AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor]) AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string]) AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
@ -980,7 +980,6 @@ else
fi fi
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la' CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
MI_LIB='$(top_builddir)/mi/libmi.la' MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
MI_EXT_LIB='$(top_builddir)/mi/libmiext.la' MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
MI_INC='-I$(top_srcdir)/mi' MI_INC='-I$(top_srcdir)/mi'
FB_LIB='$(top_builddir)/fb/libfb.la' FB_LIB='$(top_builddir)/fb/libfb.la'
@ -1097,7 +1096,7 @@ dnl ---------------------------------------------------------------------------
dnl DMX DDX dnl DMX DDX
AC_MSG_CHECKING([whether to build Xdmx 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]) PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES $PIXMAN], [have_dmx=yes], [have_dmx=no])
if test "x$DMX" = xauto; then if test "x$DMX" = xauto; then
DMX="$have_dmx" DMX="$have_dmx"
fi fi
@ -1591,7 +1590,7 @@ AC_MSG_CHECKING([whether to build Xprint DDX])
AC_MSG_RESULT([$XPRINT]) AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau]) PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau $PIXMAN])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS" XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS" XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
AC_SUBST([XPRINT_CFLAGS]) AC_SUBST([XPRINT_CFLAGS])
@ -1939,6 +1938,8 @@ AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD_MODE_TYPE = xsun])
BUILD_DATE="$(date +'%Y%m%d')" BUILD_DATE="$(date +'%Y%m%d')"
AC_SUBST([BUILD_DATE]) AC_SUBST([BUILD_DATE])
BUILD_TIME="$(date +'1%H%M%S')"
AC_SUBST([BUILD_TIME])
DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS" DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"

View File

@ -167,7 +167,7 @@ NameForAtom(Atom atom)
} }
void void
AtomError() AtomError(void)
{ {
FatalError("initializing atoms"); FatalError("initializing atoms");
} }
@ -185,7 +185,7 @@ FreeAtom(NodePtr patom)
} }
void void
FreeAllAtoms() FreeAllAtoms(void)
{ {
if(atomRoot == (NodePtr)NULL) if(atomRoot == (NodePtr)NULL)
return; return;
@ -197,7 +197,7 @@ FreeAllAtoms()
} }
void void
InitAtoms() InitAtoms(void)
{ {
FreeAllAtoms(); FreeAllAtoms();
tableLength = InitialTableSize; tableLength = InitialTableSize;

View File

@ -75,6 +75,7 @@ SOFTWARE.
#include "swaprep.h" #include "swaprep.h"
#include "dixevents.h" #include "dixevents.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "exglobals.h" #include "exglobals.h"
#include "exevents.h" #include "exevents.h"
@ -86,15 +87,27 @@ DeviceIntPtr
AddInputDevice(DeviceProc deviceProc, Bool autoStart) AddInputDevice(DeviceProc deviceProc, Bool autoStart)
{ {
DeviceIntPtr dev, *prev; /* not a typo */ DeviceIntPtr dev, *prev; /* not a typo */
DeviceIntPtr devtmp;
int devid;
char devind[MAX_DEVICES];
if (inputInfo.numDevices >= MAX_DEVICES) /* Find next available id */
memset(devind, 0, sizeof(char)*MAX_DEVICES);
for (devtmp = inputInfo.devices; devtmp; devtmp = devtmp->next)
devind[devtmp->id]++;
for (devtmp = inputInfo.off_devices; devtmp; devtmp = devtmp->next)
devind[devtmp->id]++;
for (devid = 0; devid < MAX_DEVICES && devind[devid]; devid++)
;
if (devid >= MAX_DEVICES)
return (DeviceIntPtr)NULL; return (DeviceIntPtr)NULL;
dev = (DeviceIntPtr) xcalloc(sizeof(DeviceIntRec), 1); dev = (DeviceIntPtr) xcalloc(sizeof(DeviceIntRec), 1);
if (!dev) if (!dev)
return (DeviceIntPtr)NULL; return (DeviceIntPtr)NULL;
dev->name = (char *)NULL; dev->name = (char *)NULL;
dev->type = 0; dev->type = 0;
dev->id = inputInfo.numDevices; dev->id = devid;
inputInfo.numDevices++; inputInfo.numDevices++;
dev->public.on = FALSE; dev->public.on = FALSE;
dev->public.processInputProc = (ProcessInputProc)NoopDDA; dev->public.processInputProc = (ProcessInputProc)NoopDDA;
@ -145,6 +158,8 @@ EnableDevice(DeviceIntPtr dev)
{ {
DeviceIntPtr *prev; DeviceIntPtr *prev;
int ret; int ret;
DeviceIntRec dummyDev;
devicePresenceNotify ev;
for (prev = &inputInfo.off_devices; for (prev = &inputInfo.off_devices;
*prev && (*prev != dev); *prev && (*prev != dev);
@ -163,6 +178,14 @@ EnableDevice(DeviceIntPtr dev)
*prev = dev; *prev = dev;
dev->next = NULL; dev->next = NULL;
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceEnabled;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
return TRUE; return TRUE;
} }
@ -170,6 +193,8 @@ Bool
DisableDevice(DeviceIntPtr dev) DisableDevice(DeviceIntPtr dev)
{ {
DeviceIntPtr *prev; DeviceIntPtr *prev;
DeviceIntRec dummyDev;
devicePresenceNotify ev;
for (prev = &inputInfo.devices; for (prev = &inputInfo.devices;
*prev && (*prev != dev); *prev && (*prev != dev);
@ -182,6 +207,15 @@ DisableDevice(DeviceIntPtr dev)
*prev = dev->next; *prev = dev->next;
dev->next = inputInfo.off_devices; dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev; inputInfo.off_devices = dev;
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceDisabled;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
return TRUE; return TRUE;
} }
@ -200,8 +234,8 @@ ActivateDevice(DeviceIntPtr dev)
ev.type = DevicePresenceNotify; ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.devchange = 0; ev.devchange = DeviceAdded;
ev.deviceid = 0; ev.deviceid = dev->id;
dummyDev.id = 0; dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1); (xEvent *) &ev, 1);
@ -314,7 +348,7 @@ CorePointerProc(DeviceIntPtr pDev, int what)
} }
void void
InitCoreDevices() InitCoreDevices(void)
{ {
DeviceIntPtr dev; DeviceIntPtr dev;
@ -373,7 +407,7 @@ InitCoreDevices()
} }
int int
InitAndStartDevices() InitAndStartDevices(void)
{ {
DeviceIntPtr dev, next; DeviceIntPtr dev, next;
@ -391,6 +425,7 @@ InitAndStartDevices()
for (dev = inputInfo.devices; for (dev = inputInfo.devices;
dev && (dev != inputInfo.keyboard); dev && (dev != inputInfo.keyboard);
dev = dev->next) dev = dev->next)
;
if (!dev || (dev != inputInfo.keyboard)) { if (!dev || (dev != inputInfo.keyboard)) {
ErrorF("No core keyboard\n"); ErrorF("No core keyboard\n");
return BadImplementation; return BadImplementation;
@ -431,8 +466,13 @@ CloseDevice(DeviceIntPtr dev)
xfree(dev->key); xfree(dev->key);
} }
if (dev->valuator) if (dev->valuator) {
/* Counterpart to 'biggest hack ever' in init. */
if (dev->valuator->motion &&
dev->valuator->GetMotionProc == GetMotionHistory)
xfree(dev->valuator->motion);
xfree(dev->valuator); xfree(dev->valuator);
}
if (dev->button) { if (dev->button) {
#ifdef XKB #ifdef XKB
@ -503,7 +543,7 @@ CloseDevice(DeviceIntPtr dev)
} }
void void
CloseDownDevices() CloseDownDevices(void)
{ {
DeviceIntPtr dev, next; DeviceIntPtr dev, next;
@ -530,12 +570,16 @@ RemoveDevice(DeviceIntPtr dev)
int ret = BadMatch; int ret = BadMatch;
devicePresenceNotify ev; devicePresenceNotify ev;
DeviceIntRec dummyDev; DeviceIntRec dummyDev;
int deviceid;
DebugF("(dix) removing device %d\n", dev->id); DebugF("(dix) removing device %d\n", dev->id);
if (!dev || dev == inputInfo.keyboard || dev == inputInfo.pointer) if (!dev || dev == inputInfo.keyboard || dev == inputInfo.pointer)
return BadImplementation; return BadImplementation;
deviceid = dev->id;
DisableDevice(dev);
prev = NULL; prev = NULL;
for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) { for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
next = tmp->next; next = tmp->next;
@ -567,10 +611,11 @@ RemoveDevice(DeviceIntPtr dev)
} }
if (ret == Success) { if (ret == Success) {
inputInfo.numDevices--;
ev.type = DevicePresenceNotify; ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds; ev.time = currentTime.milliseconds;
ev.devchange = 0; ev.devchange = DeviceRemoved;
ev.deviceid = 0; ev.deviceid = deviceid;
dummyDev.id = 0; dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask, SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1); (xEvent *) &ev, 1);
@ -580,7 +625,7 @@ RemoveDevice(DeviceIntPtr dev)
} }
int int
NumMotionEvents() NumMotionEvents(void)
{ {
return inputInfo.pointer->valuator->numMotionEvents; return inputInfo.pointer->valuator->numMotionEvents;
} }
@ -598,13 +643,13 @@ RegisterKeyboardDevice(DeviceIntPtr device)
} }
_X_EXPORT DevicePtr _X_EXPORT DevicePtr
LookupKeyboardDevice() LookupKeyboardDevice(void)
{ {
return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL; return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL;
} }
_X_EXPORT DevicePtr _X_EXPORT DevicePtr
LookupPointerDevice() LookupPointerDevice(void)
{ {
return inputInfo.pointer ? &inputInfo.pointer->public : NULL; return inputInfo.pointer ? &inputInfo.pointer->public : NULL;
} }
@ -856,6 +901,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
abs->width = -1; abs->width = -1;
abs->height = -1; abs->height = -1;
abs->following = 0; abs->following = 0;
abs->screen = 0;
dev->absolute = abs; dev->absolute = abs;
@ -1223,6 +1269,7 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
} }
else { else {
pDev->key->modifierKeyMap = NULL; pDev->key->modifierKeyMap = NULL;
pDev->key->maxKeysPerModifier = 0;
} }
} }
} }

View File

@ -218,7 +218,7 @@ SetInputCheck(HWEventQueuePtr c0, HWEventQueuePtr c1)
} }
_X_EXPORT void _X_EXPORT void
UpdateCurrentTime() UpdateCurrentTime(void)
{ {
TimeStamp systime; TimeStamp systime;
@ -237,7 +237,7 @@ UpdateCurrentTime()
/* Like UpdateCurrentTime, but can't call ProcessInputEvents */ /* Like UpdateCurrentTime, but can't call ProcessInputEvents */
_X_EXPORT void _X_EXPORT void
UpdateCurrentTimeIf() UpdateCurrentTimeIf(void)
{ {
TimeStamp systime; TimeStamp systime;
@ -250,7 +250,7 @@ UpdateCurrentTimeIf()
} }
void void
InitSelections() InitSelections(void)
{ {
if (CurrentSelections) if (CurrentSelections)
xfree(CurrentSelections); xfree(CurrentSelections);
@ -996,10 +996,6 @@ ProcGetAtomName(ClientPtr client)
} }
} }
#ifdef K5AUTH
extern int k5_bad();
#endif
int int
ProcSetSelectionOwner(ClientPtr client) ProcSetSelectionOwner(ClientPtr client)
{ {
@ -3541,12 +3537,6 @@ InitProcVectors(void)
ProcVector[i] = SwappedProcVector[i] = ProcBadRequest; ProcVector[i] = SwappedProcVector[i] = ProcBadRequest;
ReplySwapVector[i] = ReplyNotSwappd; ReplySwapVector[i] = ReplyNotSwappd;
} }
#ifdef K5AUTH
if (!k5_Vector[i])
{
k5_Vector[i] = k5_bad;
}
#endif
} }
for(i = LASTEvent; i < 128; i++) for(i = LASTEvent; i < 128; i++)
{ {
@ -3654,7 +3644,7 @@ CloseDownClient(ClientPtr client)
} }
static void static void
KillAllClients() KillAllClients(void)
{ {
int i; int i;
for (i=1; i<currentMaxClients; i++) for (i=1; i<currentMaxClients; i++)

View File

@ -1878,7 +1878,7 @@ DeleteClientFontStuff(ClientPtr client)
} }
void void
InitFonts () InitFonts (void)
{ {
patternCache = MakeFontPatternCache(); patternCache = MakeFontPatternCache();
@ -1997,7 +1997,7 @@ RegisterFPEFunctions(NameCheckFunc name_func,
} }
void void
FreeFonts() FreeFonts(void)
{ {
if (patternCache) { if (patternCache) {
FreeFontPatternCache(patternCache); FreeFontPatternCache(patternCache);

View File

@ -265,7 +265,7 @@ _X_EXPORT int
dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
{ {
pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY,
DixReadAccess); access);
int clientIndex = CLIENT_ID(rid); int clientIndex = CLIENT_ID(rid);
client->errorValue = rid; client->errorValue = rid;
@ -550,7 +550,7 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
} }
void void
InitBlockAndWakeupHandlers () InitBlockAndWakeupHandlers (void)
{ {
xfree (handlers); xfree (handlers);
handlers = (BlockHandlerPtr) 0; handlers = (BlockHandlerPtr) 0;
@ -950,7 +950,7 @@ DeleteCallbackList(CallbackListPtr *pcbl)
} }
void void
InitCallbackManager() InitCallbackManager(void)
{ {
int i; int i;

View File

@ -107,6 +107,10 @@ of the copyright holder.
******************************************************************/ ******************************************************************/
/** @file
* This file handles event delivery and a big part of the server-side protocol
* handling (the parts for input devices).
*/
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
@ -168,7 +172,9 @@ static xEvent *xeviexE;
#include "dixevents.h" #include "dixevents.h"
#include "dixgrabs.h" #include "dixgrabs.h"
#include "dispatch.h" #include "dispatch.h"
/**
* Extension events type numbering starts at EXTENSION_EVENT_BASE.
*/
#define EXTENSION_EVENT_BASE 64 #define EXTENSION_EVENT_BASE 64
#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */ #define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
@ -214,6 +220,28 @@ _X_EXPORT CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT]; Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT]; static int DontPropagateRefCnts[DNPMCOUNT];
/**
* Main input device struct.
* inputInfo.pointer
* is the core pointer. Referred to as "virtual core pointer", "VCP",
* "core pointer" or inputInfo.pointer. There is exactly one core pointer,
* but multiple devices may send core events. If a device generates core
* events, those events will appear to originate from the core pointer.
*
* inputInfo.keyboard
* is the core keyboard ("virtual core keyboard", "VCK", "core keyboard").
* See inputInfo.pointer.
*
* inputInfo.devices
* linked list containing all devices including VCK and VCP. The VCK will
* always be the first entry, the VCP the second entry in the device list.
*
* inputInfo.off_devices
* Devices that have not been initialized and are thus turned off.
*
* inputInfo.numDevices
* Total number of devices.
*/
_X_EXPORT InputInfo inputInfo; _X_EXPORT InputInfo inputInfo;
static struct { static struct {
@ -228,12 +256,19 @@ static struct {
* The window trace information is used to avoid having to compute all the * The window trace information is used to avoid having to compute all the
* windows between the root and the current pointer window each time a button * windows between the root and the current pointer window each time a button
* or key goes down. The grabs on each of those windows must be checked. * or key goes down. The grabs on each of those windows must be checked.
*
* @see XYToWindow() for a documentation on how the array is set up.
*/ */
static WindowPtr *spriteTrace = (WindowPtr *)NULL; static WindowPtr *spriteTrace = (WindowPtr *)NULL;
#define ROOT spriteTrace[0] #define ROOT spriteTrace[0]
static int spriteTraceSize = 0; static int spriteTraceSize = 0;
static int spriteTraceGood; static int spriteTraceGood;
/**
* DIX sprite information. This is the sprite as seen from the DIX. It does
* not represent the actual sprite rendered to the screen.
*
*/
static struct { static struct {
CursorPtr current; CursorPtr current;
BoxRec hotLimits; /* logical constraints of hot spot */ BoxRec hotLimits; /* logical constraints of hot spot */
@ -270,6 +305,9 @@ static WindowPtr XYToWindow(
int y int y
); );
/**
* Max event opcode.
*/
extern int lastEvent; extern int lastEvent;
static Mask lastEventMask; static Mask lastEventMask;
@ -657,6 +695,13 @@ XineramaChangeToCursor(CursorPtr cursor)
} }
} }
#else
#define SyntheticMotion(x, y) \
PostSyntheticMotion(x, y, \
0, \
syncEvents.playingEvents ? \
syncEvents.time.milliseconds : \
currentTime.milliseconds);
#endif /* PANORAMIX */ #endif /* PANORAMIX */
@ -844,11 +889,18 @@ ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
} }
_X_EXPORT Bool _X_EXPORT Bool
PointerConfinedToScreen() PointerConfinedToScreen(void)
{ {
return sprite.confined; return sprite.confined;
} }
/**
* Update the sprite cursor to the given cursor.
*
* ChangeToCursor() will display the new cursor and free the old cursor (if
* applicable). If the provided cursor is already the updated cursor, nothing
* happens.
*/
static void static void
ChangeToCursor(CursorPtr cursor) ChangeToCursor(CursorPtr cursor)
{ {
@ -873,7 +925,9 @@ ChangeToCursor(CursorPtr cursor)
} }
} }
/* returns true if b is a descendent of a */ /**
* @returns true if b is a descendent of a
*/
Bool Bool
IsParent(WindowPtr a, WindowPtr b) IsParent(WindowPtr a, WindowPtr b)
{ {
@ -882,6 +936,11 @@ IsParent(WindowPtr a, WindowPtr b)
return FALSE; return FALSE;
} }
/**
* Update the cursor displayed on the screen.
*
* Called whenever a cursor may have changed shape or position.
*/
static void static void
PostNewCursor(void) PostNewCursor(void)
{ {
@ -912,24 +971,36 @@ PostNewCursor(void)
} }
} }
/**
* @return root window of current active screen.
*/
_X_EXPORT WindowPtr _X_EXPORT WindowPtr
GetCurrentRootWindow() GetCurrentRootWindow(void)
{ {
return ROOT; return ROOT;
} }
/**
* @return window underneath the cursor sprite.
*/
_X_EXPORT WindowPtr _X_EXPORT WindowPtr
GetSpriteWindow() GetSpriteWindow(void)
{ {
return sprite.win; return sprite.win;
} }
/**
* @return current sprite cursor.
*/
_X_EXPORT CursorPtr _X_EXPORT CursorPtr
GetSpriteCursor() GetSpriteCursor(void)
{ {
return sprite.current; return sprite.current;
} }
/**
* Set x/y current sprite position in screen coordinates.
*/
_X_EXPORT void _X_EXPORT void
GetSpritePosition(int *px, int *py) GetSpritePosition(int *px, int *py)
{ {
@ -939,7 +1010,7 @@ GetSpritePosition(int *px, int *py)
#ifdef PANORAMIX #ifdef PANORAMIX
_X_EXPORT int _X_EXPORT int
XineramaGetCursorScreen() XineramaGetCursorScreen(void)
{ {
if(!noPanoramiXExtension) { if(!noPanoramiXExtension) {
return sprite.screen->myNum; return sprite.screen->myNum;
@ -1114,7 +1185,7 @@ FreezeThaw(DeviceIntPtr dev, Bool frozen)
} }
void void
ComputeFreezes() ComputeFreezes(void)
{ {
DeviceIntPtr replayDev = syncEvents.replayDev; DeviceIntPtr replayDev = syncEvents.replayDev;
int i; int i;
@ -1231,6 +1302,19 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
ComputeFreezes(); ComputeFreezes();
} }
/**
* Activate a pointer grab on the given device. A pointer grab will cause all
* core pointer events to be delivered to the grabbing client only. Can cause
* the cursor to change if a grab cursor is set.
*
* As a pointer grab can only be issued on the core devices, mouse is always
* inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab().
*
* @param mouse The device to grab.
* @param grab The grab structure, needs to be setup.
* @param autoGrab True if the grab was caused by a button down event and not
* explicitely by a client.
*/
void void
ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
TimeStamp time, Bool autoGrab) TimeStamp time, Bool autoGrab)
@ -1259,6 +1343,12 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
} }
/**
* Delete grab on given device, update the sprite.
*
* As a pointer grab can only be issued on the core devices, mouse is always
* inputInfo.pointer. Extension devices are set up for ActivateKeyboardGrab().
*/
void void
DeactivatePointerGrab(DeviceIntPtr mouse) DeactivatePointerGrab(DeviceIntPtr mouse)
{ {
@ -1283,6 +1373,11 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
ComputeFreezes(); ComputeFreezes();
} }
/**
* Activate a keyboard grab on the given device.
*
* Extension devices have ActivateKeyboardGrab() set as their grabbing proc.
*/
void void
ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
{ {
@ -1309,6 +1404,9 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode); CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
} }
/**
* Delete keyboard grab for the given device.
*/
void void
DeactivateKeyboardGrab(DeviceIntPtr keybd) DeactivateKeyboardGrab(DeviceIntPtr keybd)
{ {
@ -1441,6 +1539,11 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
} }
} }
/**
* Server-side protocol handling for AllowEvents request.
*
* Release some events from a frozen device. Only applicable for core devices.
*/
int int
ProcAllowEvents(ClientPtr client) ProcAllowEvents(ClientPtr client)
{ {
@ -1484,6 +1587,9 @@ ProcAllowEvents(ClientPtr client)
return Success; return Success;
} }
/**
* Deactivate grabs from any device that has been grabbed by the client.
*/
void void
ReleaseActiveGrabs(ClientPtr client) ReleaseActiveGrabs(ClientPtr client)
{ {
@ -1510,6 +1616,30 @@ ReleaseActiveGrabs(ClientPtr client)
* The following procedures deal with delivering events * * The following procedures deal with delivering events *
**************************************************************************/ **************************************************************************/
/**
* Deliver the given events to the given client.
*
* More than one event may be delivered at a time. This is the case with
* DeviceMotionNotifies which may be followed by DeviceValuator events.
*
* TryClientEvents() is the last station before actually writing the events to
* the socket. Anything that is not filtered here, will get delivered to the
* client.
* An event is only delivered if
* - mask and filter match up.
* - no other client has a grab on the device that caused the event.
*
*
* @param client The target client to deliver to.
* @param pEvents The events to be delivered.
* @param count Number of elements in pEvents.
* @param mask Event mask as set by the window.
* @param filter Mask based on event type.
* @param grab Possible grab on the device that caused the event.
*
* @return 1 if event was delivered, 0 if not or -1 if grab was not set by the
* client.
*/
_X_EXPORT int _X_EXPORT int
TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask, TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
Mask filter, GrabPtr grab) Mask filter, GrabPtr grab)
@ -1588,6 +1718,23 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
} }
} }
/**
* Deliver events to a window. At this point, we do not yet know if the event
* actually needs to be delivered. May activate a grab if the event is a
* button press.
*
* More than one event may be delivered at a time. This is the case with
* DeviceMotionNotifies which may be followed by DeviceValuator events.
*
* @param pWin The window that would get the event.
* @param pEvents The events to be delivered.
* @param count Number of elements in pEvents.
* @param filter Mask based on event type.
* @param grab Possible grab on the device that caused the event.
* @param mskidx Mask index, depending on device that caused event.
*
* @return Number of events delivered to various clients.
*/
int int
DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count, DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count,
Mask filter, GrabPtr grab, int mskidx) Mask filter, GrabPtr grab, int mskidx)
@ -1707,6 +1854,15 @@ XineramaTryClientEventsResult(
} }
#endif #endif
/**
* Try to deliver events to the interested parties.
*
* @param pWin The window that would get the event.
* @param pEvents The events to be delivered.
* @param count Number of elements in pEvents.
* @param filter Mask based on event type.
* @param dontClient Don't deliver to the dontClient.
*/
int int
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
int count, Mask filter, ClientPtr dontClient) int count, Mask filter, ClientPtr dontClient)
@ -1744,6 +1900,14 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
return 2; return 2;
} }
/**
* Adjust event fields to comply with the window properties.
*
* @param xE Event to be modified in place
* @param pWin The window to get the information from.
* @param child Child window setting for event (if applicable)
* @param calcChild If True, calculate the child window.
*/
static void static void
FixUpEventFromWindow( FixUpEventFromWindow(
xEvent *xE, xEvent *xE,
@ -1798,6 +1962,22 @@ FixUpEventFromWindow(
} }
} }
/**
* Deliver events caused by input devices. Called for all core input events
* and XI events. No filtering of events happens before DeliverDeviceEvents(),
* it will be called for any event that comes out of the event queue.
*
* For all core events, dev is either inputInfo.pointer or inputInfo.keyboard.
* For all extension events, dev is the device that caused the event.
*
* @param pWin Window to deliver event to.
* @param xE Events to deliver.
* @param grab Possible grab on a device.
* @param stopAt Don't recurse up to the root window.
* @param dev The device that is responsible for the event.
* @param count number of events in xE.
*
*/
int int
DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab, DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
WindowPtr stopAt, DeviceIntPtr dev, int count) WindowPtr stopAt, DeviceIntPtr dev, int count)
@ -1861,7 +2041,19 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
return 0; return 0;
} }
/* not useful for events that propagate up the tree or extension events */ /**
* Deliver event to a window and it's immediate parent. Used for most window
* events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
* propagate up the tree or extension events
*
* In case of a ReparentNotify event, the event will be delivered to the
* otherParent as well.
*
* @param pWin Window to deliver events to.
* @param xE Events to deliver.
* @param count number of events in xE.
* @param otherParent Used for ReparentNotify events.
*/
_X_EXPORT int _X_EXPORT int
DeliverEvents(WindowPtr pWin, xEvent *xE, int count, DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
WindowPtr otherParent) WindowPtr otherParent)
@ -1926,6 +2118,17 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
return FALSE; return FALSE;
} }
/**
* Traversed from the root window to the window at the position x/y. While
* traversing, it sets up the traversal history in the spriteTrace array.
* After completing, the spriteTrace history is set in the following way:
* spriteTrace[0] ... root window
* spriteTrace[1] ... top level window that encloses x/y
* ...
* spriteTrace[spriteTraceGood - 1] ... window at x/y
*
* @returns the window at the given coordinates.
*/
static WindowPtr static WindowPtr
XYToWindow(int x, int y) XYToWindow(int x, int y)
{ {
@ -1974,6 +2177,12 @@ XYToWindow(int x, int y)
return spriteTrace[spriteTraceGood-1]; return spriteTrace[spriteTraceGood-1];
} }
/**
* Update the sprite coordinates based on the event. Update the cursor
* position, then update the event with the new coordinates that may have been
* changed. If the window underneath the sprite has changed, change to new
* cursor and send enter/leave events.
*/
static Bool static Bool
CheckMotion(xEvent *xE) CheckMotion(xEvent *xE)
{ {
@ -2046,8 +2255,12 @@ CheckMotion(xEvent *xE)
return TRUE; return TRUE;
} }
/**
* Windows have restructured, we need to update the sprite position and the
* sprite's cursor.
*/
_X_EXPORT void _X_EXPORT void
WindowsRestructured() WindowsRestructured(void)
{ {
(void) CheckMotion((xEvent *)NULL); (void) CheckMotion((xEvent *)NULL);
} }
@ -2091,6 +2304,10 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
} }
#endif #endif
/**
* Set the given window to sane values, display the cursor in the center of
* the screen. Called from main() with the root window on the first screen.
*/
void void
DefineInitialRootWindow(WindowPtr win) DefineInitialRootWindow(WindowPtr win)
{ {
@ -2297,6 +2514,10 @@ XineramaWarpPointer(ClientPtr client)
#endif #endif
/**
* Server-side protocol handling for WarpPointer request.
* Warps the cursor position to the coordinates given in the request.
*/
int int
ProcWarpPointer(ClientPtr client) ProcWarpPointer(ClientPtr client)
{ {
@ -2405,8 +2626,15 @@ BorderSizeNotEmpty(WindowPtr pWin)
return FALSE; return FALSE;
} }
/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a /**
passive grab set on the window to be activated. */ * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
* passive grab set on the window to be activated.
*
* @param pWin The window that may be subject to a passive grab.
* @param device Device that caused the event.
* @param xE List of events (multiple ones for DeviceMotionNotify)
* @count number of elements in xE.
*/
static Bool static Bool
CheckPassiveGrabsOnWindow( CheckPassiveGrabsOnWindow(
@ -2556,6 +2784,16 @@ CheckDeviceGrabs(DeviceIntPtr device, xEvent *xE,
return FALSE; return FALSE;
} }
/**
* Called for keyboard events to deliver event to whatever client owns the
* focus. Event is delivered to the keyboard's focus window, the root window
* or to the window owning the input focus.
*
* @param keybd The keyboard originating the event.
* @param xE The event list.
* @param window Window underneath the sprite.
* @param count number of events in xE.
*/
void void
DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
{ {
@ -2584,6 +2822,13 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
NullGrab, mskidx); NullGrab, mskidx);
} }
/**
* Deliver an event from a device that is currently grabbed. Uses
* DeliverDeviceEvents() for further delivery if a ownerEvents is set on the
* grab. If not, TryClientEvents() is used.
*
* @param deactivateGrab True if the device's grab should be deactivated.
*/
void void
DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev, DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
Bool deactivateGrab, int count) Bool deactivateGrab, int count)
@ -2666,6 +2911,17 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
} }
} }
/**
* Main keyboard event processing function for core keyboard events.
* Updates the events fields from the current pointer state and delivers the
* event.
*
* For key events, xE will always be a single event.
*
* @param xE Event list
* @param keybd The device that caused an event.
* @param count Number of elements in xE.
*/
void void
#ifdef XKB #ifdef XKB
CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count) CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
@ -2861,6 +3117,18 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd)
} }
#endif #endif
/**
* Main pointer event processing function for core pointer events.
* For motion events: update the sprite.
* For all other events: Update the event fields based on the current sprite
* state.
*
* For core pointer events, xE will always be a single event.
*
* @param xE Event list
* @param mouse The device that caused an event.
* @param count Number of elements in xE.
*/
void void
#ifdef XKB #ifdef XKB
CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
@ -2974,6 +3242,18 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
#define AtMostOneClient \ #define AtMostOneClient \
(SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask)
/**
* Recalculate which events may be deliverable for the given window.
* Recalculated mask is used for quicker determination which events may be
* delivered to a window.
*
* The otherEventMasks on a WindowOptional is the combination of all event
* masks set by all clients on the window.
* deliverableEventMask is the combination of the eventMask and the
* otherEventMask.
*
* Traverses to siblings and parents of the window.
*/
void void
RecalculateDeliverableEvents(pWin) RecalculateDeliverableEvents(pWin)
WindowPtr pWin; WindowPtr pWin;
@ -3172,6 +3452,9 @@ EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
return Success; return Success;
} }
/**
* @return The window that is the first ancestor of both a and b.
*/
static WindowPtr static WindowPtr
CommonAncestor( CommonAncestor(
WindowPtr a, WindowPtr a,
@ -3182,6 +3465,10 @@ CommonAncestor(
return NullWindow; return NullWindow;
} }
/**
* Assembles an EnterNotify or LeaveNotify and sends it event to the client.
* The core devices are used to fill in the event fields.
*/
static void static void
EnterLeaveEvent( EnterLeaveEvent(
int type, int type,
@ -3264,6 +3551,10 @@ EnterLeaveEvent(
} }
} }
/**
* Send enter notifies to all parent windows up to ancestor.
* This function recurses.
*/
static void static void
EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail) EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
{ {
@ -3275,6 +3566,11 @@ EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id); EnterLeaveEvent(EnterNotify, mode, detail, parent, child->drawable.id);
} }
/**
* Send leave notifies to all parent windows up to ancestor.
* This function recurses.
*/
static void static void
LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail) LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
{ {
@ -3289,6 +3585,13 @@ LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
} }
} }
/**
* Figure out if enter/leave events are necessary and send them to the
* appropriate windows.
*
* @param fromWin Window the sprite moved out of.
* @param toWin Window the sprite moved into.
*/
static void static void
DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode) DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
{ {
@ -3522,6 +3825,23 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
} }
} }
/**
* Set the input focus to the given window. Subsequent keyboard events will be
* delivered to the given window.
*
* Usually called from ProcSetInputFocus as result of a client request. If so,
* the device is the inputInfo.keyboard.
* If called from ProcXSetInputFocus as result of a client xinput request, the
* device is set to the device specified by the client.
*
* @param client Client that requested input focus change.
* @param dev Focus device.
* @param focusID The window to obtain the focus. Can be PointerRoot or None.
* @param revertTo Specifies where the focus reverts to when window becomes
* unviewable.
* @param ctime Specifies the time.
* @param followOK True if pointer is allowed to follow the keyboard.
*/
int int
SetInputFocus( SetInputFocus(
ClientPtr client, ClientPtr client,
@ -3598,6 +3918,11 @@ SetInputFocus(
return Success; return Success;
} }
/**
* Server-side protocol handling for SetInputFocus request.
*
* Sets the input focus for the virtual core keyboard.
*/
int int
ProcSetInputFocus(client) ProcSetInputFocus(client)
ClientPtr client; ClientPtr client;
@ -3613,6 +3938,12 @@ ProcSetInputFocus(client)
stuff->revertTo, stuff->time, FALSE); stuff->revertTo, stuff->time, FALSE);
} }
/**
* Server-side protocol handling for GetInputFocus request.
*
* Sends the current input focus for the virtual core keyboard back to the
* client.
*/
int int
ProcGetInputFocus(ClientPtr client) ProcGetInputFocus(ClientPtr client)
{ {
@ -3634,6 +3965,12 @@ ProcGetInputFocus(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for Grabpointer request.
*
* Sets an active grab on the inputInfo.pointer and returns success status to
* client.
*/
int int
ProcGrabPointer(ClientPtr client) ProcGrabPointer(ClientPtr client)
{ {
@ -3741,6 +4078,14 @@ ProcGrabPointer(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for ChangeActivePointerGrab request.
*
* Changes properties of the grab hold by the client. If the client does not
* hold an active grab on the device, nothing happens.
*
* Works on the core pointer only.
*/
int int
ProcChangeActivePointerGrab(ClientPtr client) ProcChangeActivePointerGrab(ClientPtr client)
{ {
@ -3787,6 +4132,11 @@ ProcChangeActivePointerGrab(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for UngrabPointer request.
*
* Deletes the pointer grab on the core pointer device.
*/
int int
ProcUngrabPointer(ClientPtr client) ProcUngrabPointer(ClientPtr client)
{ {
@ -3806,6 +4156,24 @@ ProcUngrabPointer(ClientPtr client)
return Success; return Success;
} }
/**
* Sets a grab on the given device.
*
* Called from ProcGrabKeyboard to work on the inputInfo.keyboard.
* Called from ProcXGrabDevice to work on the device specified by the client.
*
* The parameters this_mode and other_mode represent the keyboard_mode and
* pointer_mode parameters of XGrabKeyboard().
* See man page for details on all the parameters
*
* @param client Client that owns the grab.
* @param dev The device to grab.
* @param this_mode GrabModeSync or GrabModeAsync
* @param other_mode GrabModeSync or GrabModeAsync
* @param status Return code to be returned to the caller.
*
* @returns Success or BadValue.
*/
int int
GrabDevice(ClientPtr client, DeviceIntPtr dev, GrabDevice(ClientPtr client, DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned this_mode, unsigned other_mode, Window grabWindow,
@ -3864,6 +4232,11 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
return Success; return Success;
} }
/**
* Server-side protocol handling for GrabKeyboard request.
*
* Grabs the inputInfo.keyboad and returns success status to client.
*/
int int
ProcGrabKeyboard(ClientPtr client) ProcGrabKeyboard(ClientPtr client)
{ {
@ -3892,6 +4265,11 @@ ProcGrabKeyboard(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for UngrabKeyboard request.
*
* Deletes a possible grab on the inputInfo.keyboard.
*/
int int
ProcUngrabKeyboard(ClientPtr client) ProcUngrabKeyboard(ClientPtr client)
{ {
@ -3911,6 +4289,11 @@ ProcUngrabKeyboard(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for QueryPointer request.
*
* Returns the current state and position of the core pointer to the client.
*/
int int
ProcQueryPointer(ClientPtr client) ProcQueryPointer(ClientPtr client)
{ {
@ -3969,8 +4352,12 @@ ProcQueryPointer(ClientPtr client)
return(Success); return(Success);
} }
/**
* Initializes the device list and the DIX sprite to sane values. Allocates
* trace memory used for quick window traversal.
*/
void void
InitEvents() InitEvents(void)
{ {
int i; int i;
@ -4030,6 +4417,11 @@ CloseDownEvents(void)
spriteTraceSize = 0; spriteTraceSize = 0;
} }
/**
* Server-side protocol handling for SendEvent request.
*
* Locates the window to send the event to and forwards the event.
*/
int int
ProcSendEvent(ClientPtr client) ProcSendEvent(ClientPtr client)
{ {
@ -4117,6 +4509,12 @@ ProcSendEvent(ClientPtr client)
return Success; return Success;
} }
/**
* Server-side protocol handling for UngrabKey request.
*
* Deletes a passive grab for the given key. Only works on the
* inputInfo.keyboard.
*/
int int
ProcUngrabKey(ClientPtr client) ProcUngrabKey(ClientPtr client)
{ {
@ -4159,6 +4557,12 @@ ProcUngrabKey(ClientPtr client)
return(Success); return(Success);
} }
/**
* Server-side protocol handling for GrabKey request.
*
* Creates a grab for the inputInfo.keyboard and adds it to the list of
* passive grabs.
*/
int int
ProcGrabKey(ClientPtr client) ProcGrabKey(ClientPtr client)
{ {
@ -4214,6 +4618,12 @@ ProcGrabKey(ClientPtr client)
} }
/**
* Server-side protocol handling for GrabButton request.
*
* Creates a grab for the inputInfo.pointer and adds it as a passive grab to
* the list.
*/
int int
ProcGrabButton(ClientPtr client) ProcGrabButton(ClientPtr client)
{ {
@ -4287,6 +4697,11 @@ ProcGrabButton(ClientPtr client)
return AddPassiveGrabToList(grab); return AddPassiveGrabToList(grab);
} }
/**
* Server-side protocol handling for UngrabButton request.
*
* Deletes a passive grab on the inputInfo.pointer from the list.
*/
int int
ProcUngrabButton(ClientPtr client) ProcUngrabButton(ClientPtr client)
{ {
@ -4320,6 +4735,17 @@ ProcUngrabButton(ClientPtr client)
return(Success); return(Success);
} }
/**
* Deactivate any grab that may be on the window, remove the focus.
* Delete any XInput extension events from the window too. Does not change the
* window mask. Use just before the window is deleted.
*
* If freeResources is set, passive grabs on the window are deleted.
*
* @param pWin The window to delete events from.
* @param freeResources True if resources associated with the window should be
* deleted.
*/
void void
DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources) DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
{ {
@ -4409,7 +4835,9 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
} }
/** /**
* Call this whenever some window at or below pWin has changed geometry * Call this whenever some window at or below pWin has changed geometry. If
* there is a grab on the window, the cursor will be re-confined into the
* window.
*/ */
_X_EXPORT void _X_EXPORT void
CheckCursorConfinement(WindowPtr pWin) CheckCursorConfinement(WindowPtr pWin)
@ -4445,6 +4873,9 @@ EventMaskForClient(WindowPtr pWin, ClientPtr client)
return 0; return 0;
} }
/**
* Server-side protocol handling for RecolorCursor request.
*/
int int
ProcRecolorCursor(ClientPtr client) ProcRecolorCursor(ClientPtr client)
{ {
@ -4486,6 +4917,20 @@ ProcRecolorCursor(ClientPtr client)
return (Success); return (Success);
} }
/**
* Write the given events to a client, swapping the byte order if necessary.
* To swap the byte ordering, a callback is called that has to be set up for
* the given event type.
*
* In the case of DeviceMotionNotify trailed by DeviceValuators, the events
* can be more than one. Usually it's just one event.
*
* Do not modify the event structure passed in. See comment below.
*
* @param pClient Client to send events to.
* @param count Number of events.
* @param events The event list.
*/
_X_EXPORT void _X_EXPORT void
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
{ {

View File

@ -278,7 +278,7 @@ MinorOpcodeOfRequest(ClientPtr client)
} }
void void
CloseDownExtensions() CloseDownExtensions(void)
{ {
int i,j; int i,j;

View File

@ -73,7 +73,7 @@ extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
* Pick some arbitrary size for Xi motion history. * Pick some arbitrary size for Xi motion history.
*/ */
_X_EXPORT int _X_EXPORT int
GetMotionHistorySize() GetMotionHistorySize(void)
{ {
return MOTION_HISTORY_SIZE; return MOTION_HISTORY_SIZE;
} }
@ -183,7 +183,7 @@ updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
* xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum()); * xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
*/ */
_X_EXPORT int _X_EXPORT int
GetMaximumEventsNum() { GetMaximumEventsNum(void) {
/* Two base events -- core and device, plus valuator events. Multiply /* Two base events -- core and device, plus valuator events. Multiply
* by two if we're doing key repeats. */ * by two if we're doing key repeats. */
int ret = 2 + MAX_VALUATOR_EVENTS; int ret = 2 + MAX_VALUATOR_EVENTS;
@ -714,6 +714,7 @@ _X_EXPORT void
SwitchCoreKeyboard(DeviceIntPtr pDev) SwitchCoreKeyboard(DeviceIntPtr pDev)
{ {
KeyClassPtr ckeyc = inputInfo.keyboard->key; KeyClassPtr ckeyc = inputInfo.keyboard->key;
int i = 0;
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) { if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH); memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
@ -728,6 +729,25 @@ SwitchCoreKeyboard(DeviceIntPtr pDev)
ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode; ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms); SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
/*
* Copy state from the extended keyboard to core. If you omit this,
* holding Ctrl on keyboard one, and pressing Q on keyboard two, will
* cause your app to quit. This feels wrong to me, hence the below
* code.
*
* XXX: If you synthesise core modifier events, the state will get
* clobbered here. You'll have to work out something sensible
* to fix that. Good luck.
*/
#define KEYBOARD_MASK (ShiftMask | LockMask | ControlMask | Mod1Mask | \
Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask)
ckeyc->state &= ~(KEYBOARD_MASK);
ckeyc->state |= (pDev->key->state & KEYBOARD_MASK);
#undef KEYBOARD_MASK
for (i = 0; i < 8; i++)
ckeyc->modifierKeyCount[i] = pDev->key->modifierKeyCount[i];
#ifdef XKB #ifdef XKB
if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) { if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc, if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,

View File

@ -11,7 +11,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include "misc.h" #include "misc.h"
#include "dix.h" #include "dix.h"
void MakePredeclaredAtoms() void MakePredeclaredAtoms(void)
{ {
if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError(); if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError(); if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();

View File

@ -253,6 +253,7 @@ main(int argc, char *argv[], char *envp[])
display = "0"; display = "0";
InitGlobals(); InitGlobals();
InitRegions();
#ifdef XPRINT #ifdef XPRINT
PrinterInitGlobals(); PrinterInitGlobals();
#endif #endif
@ -544,7 +545,7 @@ static int padlength[4] = {0, 3, 2, 1};
static static
#endif #endif
Bool Bool
CreateConnectionBlock() CreateConnectionBlock(void)
{ {
xConnSetup setup; xConnSetup setup;
xWindowRoot root; xWindowRoot root;

View File

@ -60,7 +60,7 @@ unsigned *extensionPrivateSizes;
unsigned totalExtensionSize; unsigned totalExtensionSize;
void void
ResetExtensionPrivates() ResetExtensionPrivates(void)
{ {
extensionPrivateCount = 0; extensionPrivateCount = 0;
extensionPrivateLen = 0; extensionPrivateLen = 0;
@ -71,7 +71,7 @@ ResetExtensionPrivates()
} }
_X_EXPORT int _X_EXPORT int
AllocateExtensionPrivateIndex() AllocateExtensionPrivateIndex(void)
{ {
return extensionPrivateCount++; return extensionPrivateCount++;
} }
@ -117,7 +117,7 @@ unsigned *clientPrivateSizes;
unsigned totalClientSize; unsigned totalClientSize;
void void
ResetClientPrivates() ResetClientPrivates(void)
{ {
clientPrivateCount = 0; clientPrivateCount = 0;
clientPrivateLen = 0; clientPrivateLen = 0;
@ -128,7 +128,7 @@ ResetClientPrivates()
} }
_X_EXPORT int _X_EXPORT int
AllocateClientPrivateIndex() AllocateClientPrivateIndex(void)
{ {
return clientPrivateCount++; return clientPrivateCount++;
} }
@ -171,7 +171,7 @@ AllocateClientPrivate(int index2, unsigned amount)
int screenPrivateCount; int screenPrivateCount;
void void
ResetScreenPrivates() ResetScreenPrivates(void)
{ {
screenPrivateCount = 0; screenPrivateCount = 0;
} }
@ -180,7 +180,7 @@ ResetScreenPrivates()
* so we have to worry about resizing existing devPrivates * so we have to worry about resizing existing devPrivates
*/ */
_X_EXPORT int _X_EXPORT int
AllocateScreenPrivateIndex() AllocateScreenPrivateIndex(void)
{ {
int idx; int idx;
int i; int i;
@ -213,13 +213,13 @@ AllocateScreenPrivateIndex()
static int windowPrivateCount; static int windowPrivateCount;
void void
ResetWindowPrivates() ResetWindowPrivates(void)
{ {
windowPrivateCount = 0; windowPrivateCount = 0;
} }
_X_EXPORT int _X_EXPORT int
AllocateWindowPrivateIndex() AllocateWindowPrivateIndex(void)
{ {
return windowPrivateCount++; return windowPrivateCount++;
} }
@ -263,13 +263,13 @@ AllocateWindowPrivate(ScreenPtr pScreen, int index2, unsigned amount)
static int gcPrivateCount; static int gcPrivateCount;
void void
ResetGCPrivates() ResetGCPrivates(void)
{ {
gcPrivateCount = 0; gcPrivateCount = 0;
} }
_X_EXPORT int _X_EXPORT int
AllocateGCPrivateIndex() AllocateGCPrivateIndex(void)
{ {
return gcPrivateCount++; return gcPrivateCount++;
} }
@ -312,13 +312,13 @@ AllocateGCPrivate(ScreenPtr pScreen, int index2, unsigned amount)
static int pixmapPrivateCount; static int pixmapPrivateCount;
void void
ResetPixmapPrivates() ResetPixmapPrivates(void)
{ {
pixmapPrivateCount = 0; pixmapPrivateCount = 0;
} }
_X_EXPORT int _X_EXPORT int
AllocatePixmapPrivateIndex() AllocatePixmapPrivateIndex(void)
{ {
return pixmapPrivateCount++; return pixmapPrivateCount++;
} }
@ -363,7 +363,7 @@ AllocatePixmapPrivate(ScreenPtr pScreen, int index2, unsigned amount)
int colormapPrivateCount; int colormapPrivateCount;
void void
ResetColormapPrivates() ResetColormapPrivates(void)
{ {
colormapPrivateCount = 0; colormapPrivateCount = 0;
} }
@ -424,7 +424,7 @@ AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc)
static int devicePrivateIndex = 0; static int devicePrivateIndex = 0;
_X_EXPORT int _X_EXPORT int
AllocateDevicePrivateIndex() AllocateDevicePrivateIndex(void)
{ {
return devicePrivateIndex++; return devicePrivateIndex++;
} }

View File

@ -235,7 +235,7 @@ CreateNewResourceType(DeleteType deleteFunc)
} }
_X_EXPORT RESTYPE _X_EXPORT RESTYPE
CreateNewResourceClass() CreateNewResourceClass(void)
{ {
RESTYPE next = lastResourceClass >> 1; RESTYPE next = lastResourceClass >> 1;
@ -844,7 +844,7 @@ FreeClientResources(ClientPtr client)
} }
void void
FreeAllResources() FreeAllResources(void)
{ {
int i; int i;

View File

@ -61,11 +61,6 @@ SOFTWARE.
#include "swaprep.h" #include "swaprep.h"
#include "swapreq.h" #include "swapreq.h"
#ifdef K5AUTH
extern int
k5_stage1(), k5_stage2(), k5_stage3(), k5_bad();
#endif
int (* InitialVector[3]) ( int (* InitialVector[3]) (
ClientPtr /* client */ ClientPtr /* client */
) = ) =
@ -515,13 +510,3 @@ _X_EXPORT ReplySwapPtr ReplySwapVector[256] =
ReplyNotSwappd, /* NoOperation */ ReplyNotSwappd, /* NoOperation */
ReplyNotSwappd ReplyNotSwappd
}; };
#ifdef K5AUTH
int (*k5_Vector[256])() =
{
k5_bad,
k5_stage1,
k5_bad,
k5_stage3
};
#endif

View File

@ -126,7 +126,7 @@ exaGetDrawablePixmap(DrawablePtr pDrawable)
* the backing drawable. These coordinates are nonzero only for redirected * the backing drawable. These coordinates are nonzero only for redirected
* windows. * windows.
*/ */
static void void
exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap, exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
int *xp, int *yp) int *xp, int *yp)
{ {
@ -172,29 +172,6 @@ exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
REGION_UNINIT(pScreen, &region); REGION_UNINIT(pScreen, &region);
} }
/**
* exaDrawableDirty() marks a pixmap backing a drawable as dirty, allowing for
* optimizations in pixmap migration when no changes have occurred.
*/
void
exaDrawableDirty (DrawablePtr pDrawable, int x1, int y1, int x2, int y2)
{
PixmapPtr pPix = exaGetDrawablePixmap(pDrawable);
int xoff, yoff;
x1 = max(x1, pDrawable->x);
y1 = max(y1, pDrawable->y);
x2 = min(x2, pDrawable->x + pDrawable->width);
y2 = min(y2, pDrawable->y + pDrawable->height);
if (x1 >= x2 || y1 >= y2)
return;
exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff);
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
}
static Bool static Bool
exaDestroyPixmap (PixmapPtr pPixmap) exaDestroyPixmap (PixmapPtr pPixmap)
{ {
@ -322,6 +299,9 @@ exaPixmapIsOffscreen(PixmapPtr p)
if (p->devPrivate.ptr == NULL) if (p->devPrivate.ptr == NULL)
return TRUE; return TRUE;
if (pExaScr->info->PixmapIsOffscreen)
return pExaScr->info->PixmapIsOffscreen(p);
return ((unsigned long) ((CARD8 *) p->devPrivate.ptr - return ((unsigned long) ((CARD8 *) p->devPrivate.ptr -
(CARD8 *) pExaScr->info->memoryBase) < (CARD8 *) pExaScr->info->memoryBase) <
pExaScr->info->memorySize); pExaScr->info->memorySize);

View File

@ -39,7 +39,7 @@
#include "fb.h" #include "fb.h"
#define EXA_VERSION_MAJOR 2 #define EXA_VERSION_MAJOR 2
#define EXA_VERSION_MINOR 1 #define EXA_VERSION_MINOR 2
#define EXA_VERSION_RELEASE 0 #define EXA_VERSION_RELEASE 0
typedef struct _ExaOffscreenArea ExaOffscreenArea; typedef struct _ExaOffscreenArea ExaOffscreenArea;
@ -229,7 +229,7 @@ typedef struct _ExaDriver {
* @{ * @{
*/ */
/** /**
* PrepareCopy() sets up the driver for doing a copy within offscreen * PrepareCopy() sets up the driver for doing a copy within video
* memory. * memory.
* *
* @param pSrcPixmap source pixmap * @param pSrcPixmap source pixmap
@ -636,6 +636,23 @@ typedef struct _ExaDriver {
*/ */
void (*FinishAccess)(PixmapPtr pPix, int index); void (*FinishAccess)(PixmapPtr pPix, int index);
/**
* PixmapIsOffscreen() is an optional driver replacement to
* exaPixmapIsOffscreen(). Set to NULL if you want the standard behaviour
* of exaPixmapIsOffscreen().
*
* @param pPix the pixmap
* @return TRUE if the given drawable is in framebuffer memory.
*
* exaPixmapIsOffscreen() is used to determine if a pixmap is in offscreen
* memory, meaning that acceleration could probably be done to it, and that it
* will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
* with the CPU.
*
*
*/
Bool (*PixmapIsOffscreen)(PixmapPtr pPix);
/** @name PrepareAccess() and FinishAccess() indices /** @name PrepareAccess() and FinishAccess() indices
* @{ * @{
*/ */
@ -704,6 +721,9 @@ exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
ExaOffscreenArea * ExaOffscreenArea *
exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area); exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
void
ExaOffscreenMarkUsed (PixmapPtr pPixmap);
unsigned long unsigned long
exaGetPixmapOffset(PixmapPtr pPix); exaGetPixmapOffset(PixmapPtr pPix);

View File

@ -74,6 +74,7 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
pGC->planemask, pGC->planemask,
pGC->fgPixel)) pGC->fgPixel))
{ {
exaDoMigration (pixmaps, 1, FALSE);
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted); ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
return; return;
} }
@ -109,8 +110,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
fullX1 + off_x, fullY1 + off_y, fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y); fullX2 + off_x, fullY1 + 1 + off_y);
exaPixmapDirty (pPixmap, fullX1 + off_x, fullY1 + off_y,
fullX2 + off_x, fullY1 + 1 + off_y);
} }
else else
{ {
@ -129,8 +128,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + off_x, fullY1 + off_y, partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y); partX2 + off_x, fullY1 + 1 + off_y);
exaPixmapDirty (pPixmap, partX1 + off_x, fullY1 + off_y,
partX2 + off_x, fullY1 + 1 + off_y);
} }
} }
pbox++; pbox++;
@ -154,8 +151,9 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int xoff, yoff; int xoff, yoff;
int src_stride, bpp = pDrawable->bitsPerPixel; int src_stride, bpp = pDrawable->bitsPerPixel;
if (pExaScr->swappedOut || pExaScr->info->UploadToScreen == NULL) pixmaps[0].as_dst = TRUE;
goto migrate_and_fallback; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
/* Don't bother with under 8bpp, XYPixmaps. */ /* Don't bother with under 8bpp, XYPixmaps. */
if (format != ZPixmap || bpp < 8) if (format != ZPixmap || bpp < 8)
@ -165,10 +163,14 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
if (!EXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy) if (!EXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
goto migrate_and_fallback; goto migrate_and_fallback;
pixmaps[0].as_dst = TRUE; if (pExaScr->swappedOut)
pixmaps[0].as_src = FALSE; goto fallback;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
if (pExaScr->info->UploadToScreen == NULL)
goto fallback;
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
if (pPix == NULL) if (pPix == NULL)
@ -221,25 +223,23 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
fbBltStip((FbStip *)bits + (y1 - y) * (src_stride / sizeof(FbStip)), fbBltStip((FbStip *)bits + (y1 - y) * (src_stride / sizeof(FbStip)),
src_stride / sizeof(FbStip), src_stride / sizeof(FbStip),
(x1 - x) * bpp, (x1 - x) * dstBpp,
dst + (y1 + yoff) * dst_stride, dst + (y1 + dstYoff) * dst_stride,
dst_stride, dst_stride,
(x1 + xoff) * bpp, (x1 + dstXoff) * dstBpp,
(x2 - x1) * bpp, (x2 - x1) * dstBpp,
y2 - y1, y2 - y1,
GXcopy, FB_ALLONES, bpp); GXcopy, FB_ALLONES, dstBpp);
exaFinishAccess(pDrawable, EXA_PREPARE_DEST); exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
} }
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff); exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
} }
return; return;
migrate_and_fallback: migrate_and_fallback:
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
exaDoMigration (pixmaps, 1, FALSE); exaDoMigration (pixmaps, 1, FALSE);
fallback: fallback:
@ -387,6 +387,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
int src_off_x, src_off_y; int src_off_x, src_off_y;
int dst_off_x, dst_off_y; int dst_off_x, dst_off_y;
ExaMigrationRec pixmaps[2]; ExaMigrationRec pixmaps[2];
Bool fallback = FALSE;
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
@ -404,50 +405,37 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
pDstPixmap->drawable.width > pExaScr->info->maxX || pDstPixmap->drawable.width > pExaScr->info->maxX ||
pDstPixmap->drawable.height > pExaScr->info->maxY) pDstPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 2, FALSE); fallback = TRUE;
goto fallback;
} else { } else {
exaDoMigration (pixmaps, 2, TRUE); exaDoMigration (pixmaps, 2, TRUE);
} }
/* Mixed directions must be handled specially if the card is lame */ /* Mixed directions must be handled specially if the card is lame */
if (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS && if (!fallback && (pExaScr->info->flags & EXA_TWO_BITBLT_DIRECTIONS) &&
reverse != upsidedown) { reverse != upsidedown) {
if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox, if (exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
dx, dy)) dx, dy))
goto fallback;
return; return;
fallback = TRUE;
} }
if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) && pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
(pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) && pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap,
reverse ? -1 : 1, upsidedown ? -1 : 1, exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
if (fallback || !exaPixmapIsOffscreen(pSrcPixmap) ||
!exaPixmapIsOffscreen(pDstPixmap) ||
!(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1,
upsidedown ? -1 : 1,
pGC ? pGC->alu : GXcopy, pGC ? pGC->alu : GXcopy,
pGC ? pGC->planemask : FB_ALLONES)) pGC ? pGC->planemask : FB_ALLONES)) {
{ fallback = TRUE;
while (nbox--)
{
(*pExaScr->info->Copy) (pDstPixmap,
pbox->x1 + dx + src_off_x,
pbox->y1 + dy + src_off_y,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
exaPixmapDirty (pDstPixmap,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++;
}
(*pExaScr->info->DoneCopy) (pDstPixmap);
exaMarkSync(pDstDrawable->pScreen);
return;
}
fallback:
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable, EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
exaDrawableLocation(pSrcDrawable), exaDrawableLocation(pSrcDrawable),
exaDrawableLocation(pDstDrawable))); exaDrawableLocation(pDstDrawable)));
exaDoMigration (pixmaps, 2, FALSE);
exaPrepareAccess (pDstDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDstDrawable, EXA_PREPARE_DEST);
exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC); exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC);
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
@ -455,11 +443,26 @@ fallback:
bitplane, closure); bitplane, closure);
exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC); exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC);
exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
}
while (nbox--) while (nbox--)
{ {
exaDrawableDirty (pDstDrawable, pbox->x1, pbox->y1, pbox->x2, pbox->y2); if (!fallback)
(*pExaScr->info->Copy) (pDstPixmap,
pbox->x1 + dx + src_off_x,
pbox->y1 + dy + src_off_y,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
exaPixmapDirty (pDstPixmap, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
if (fallback)
return;
(*pExaScr->info->DoneCopy) (pDstPixmap);
exaMarkSync (pDstDrawable->pScreen);
} }
RegionPtr RegionPtr
@ -618,6 +621,9 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
DEALLOCATE_LOCAL(prect); DEALLOCATE_LOCAL(prect);
} }
static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
Pixel pixel, CARD32 planemask, CARD32 alu);
static void static void
exaPolyFillRect(DrawablePtr pDrawable, exaPolyFillRect(DrawablePtr pDrawable,
GCPtr pGC, GCPtr pGC,
@ -626,7 +632,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
{ {
ExaScreenPriv (pDrawable->pScreen); ExaScreenPriv (pDrawable->pScreen);
RegionPtr pClip = fbGetCompositeClip(pGC); RegionPtr pClip = fbGetCompositeClip(pGC);
PixmapPtr pPixmap; PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
register BoxPtr pbox; register BoxPtr pbox;
BoxPtr pextent; BoxPtr pextent;
int extentX1, extentX2, extentY1, extentY2; int extentX1, extentX2, extentY1, extentY2;
@ -635,39 +641,80 @@ exaPolyFillRect(DrawablePtr pDrawable,
int xoff, yoff; int xoff, yoff;
int xorg, yorg; int xorg, yorg;
int n; int n;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[2];
RegionPtr pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
RegionPtr pDamageReg = DamageRegion(ExaGetPixmapPriv(pPixmap)->pDamage);
/* Compute intersection of rects and clip region */
REGION_TRANSLATE(pScreen, pReg, pDrawable->x, pDrawable->y);
REGION_INTERSECT(pScreen, pReg, pClip, pReg);
if (!REGION_NUM_RECTS(pReg)) {
REGION_DESTROY(pScreen, pReg);
return;
}
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = pPixmap;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
if (pExaScr->swappedOut || if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid ||
pPixmap->drawable.width > pExaScr->info->maxX || pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE); goto fallback;
ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
while (nrect-- >= 0) {
exaDrawableDirty(pDrawable,
pDrawable->x + prect->x,
pDrawable->y + prect->y,
pDrawable->x + prect->x + prect->width,
pDrawable->y + prect->y + prect->height);
prect++;
}
return;
} else {
exaDoMigration (pixmaps, 1, TRUE);
} }
if (!(pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) || /* For ROPs where overlaps don't matter, convert rectangles to region and
* call exaFillRegion{Solid,Tiled}.
*/
if ((pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) &&
(pGC->alu == GXcopy || pGC->alu == GXclear || pGC->alu == GXnoop ||
pGC->alu == GXcopyInverted || pGC->alu == GXset)) {
if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel) &&
exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
pGC->fgPixel : pGC->tile.pixel, pGC->planemask,
pGC->alu)) ||
(pGC->fillStyle == FillTiled && !pGC->tileIsPixel &&
exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap, &pGC->patOrg,
pGC->planemask, pGC->alu))) {
goto damage;
}
}
if (pGC->fillStyle != FillSolid &&
!(pGC->tileIsPixel && pGC->fillStyle == FillTiled))
{
goto fallback;
}
exaDoMigration (pixmaps, 1, TRUE);
if (!exaPixmapIsOffscreen (pPixmap) ||
!(*pExaScr->info->PrepareSolid) (pPixmap, !(*pExaScr->info->PrepareSolid) (pPixmap,
pGC->alu, pGC->alu,
pGC->planemask, pGC->planemask,
pGC->fgPixel)) pGC->fgPixel))
{ {
fallback:
if (pGC->fillStyle == FillTiled && !pGC->tileIsPixel) {
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pGC->tile.pixmap;
exaDoMigration (pixmaps, 2, FALSE);
} else {
exaDoMigration (pixmaps, 1, FALSE);
}
ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect); ExaCheckPolyFillRect (pDrawable, pGC, nrect, prect);
damage:
REGION_TRANSLATE(pScreen, pReg, xoff, yoff);
REGION_UNION(pScreen, pDamageReg, pReg, pDamageReg);
REGION_DESTROY(pScreen, pReg);
return; return;
} }
@ -715,7 +762,8 @@ exaPolyFillRect(DrawablePtr pDrawable,
pbox = REGION_RECTS(pClip); pbox = REGION_RECTS(pClip);
/* /*
* clip the rectangle to each box in the clip region * clip the rectangle to each box in the clip region
* this is logically equivalent to calling Intersect() * this is logically equivalent to calling Intersect(),
* but rectangles may overlap each other here.
*/ */
while(n--) while(n--)
{ {
@ -775,20 +823,19 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
pPixmap->drawable.width > pExaScr->info->maxX || pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE); fallback = TRUE;
goto fallback;
} else { } else {
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
} }
pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); exaGetDrawableDeltas (pDrawable, pPixmap, &xoff, &yoff);
if (!pPixmap || if (fallback || !exaPixmapIsOffscreen(pPixmap) ||
!(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg)) !(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, pm, fg))
{ {
fallback:
EXA_FALLBACK(("to %p (%c)\n", pDrawable, EXA_FALLBACK(("to %p (%c)\n", pDrawable,
exaDrawableLocation(pDrawable))); exaDrawableLocation(pDrawable)));
exaDoMigration (pixmaps, 1, FALSE);
fallback = TRUE; fallback = TRUE;
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel); fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
@ -827,10 +874,10 @@ fallback:
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
partX1 + xoff, partY1 + yoff, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff); partX2 + xoff, partY2 + yoff);
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff, }
partX2 + xoff, partY2 + yoff);
} else exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff, partX2 + xoff,
exaDrawableDirty (pDrawable, partX1, partY1, partX2, partY2); partY2 + yoff);
} }
if (fallback) if (fallback)
@ -870,12 +917,36 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
int dstBpp; int dstBpp;
int dstXoff, dstYoff; int dstXoff, dstYoff;
FbBits depthMask; FbBits depthMask;
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
ExaMigrationRec pixmaps[1];
int xBack, widthBack, yBack, heightBack;
for (ppci = ppciInit, n = nglyph, widthBack = 0; n; n--)
widthBack += (*ppci++)->metrics.characterWidth;
xBack = x;
if (widthBack < 0)
{
xBack += widthBack;
widthBack = -widthBack;
}
yBack = y - FONTASCENT(pGC->font);
heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
if (xBack >= pDrawable->width || yBack >= pDrawable->height ||
(xBack + widthBack) <= 0 || (yBack + heightBack) <= 0)
return;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPixmap;
depthMask = FbFullMask(pDrawable->depth); depthMask = FbFullMask(pDrawable->depth);
if ((pGC->planemask & depthMask) != depthMask) if ((pGC->planemask & depthMask) != depthMask)
{ {
exaDoMigration(pixmaps, 1, FALSE);
ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase); ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
return; goto damage;
} }
glyph = NULL; glyph = NULL;
switch (pDrawable->bitsPerPixel) { switch (pDrawable->bitsPerPixel) {
@ -887,6 +958,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
x += pDrawable->x; x += pDrawable->x;
y += pDrawable->y; y += pDrawable->y;
xBack += pDrawable->x;
yBack += pDrawable->y;
if (TERMINALFONT (pGC->font) && !glyph) if (TERMINALFONT (pGC->font) && !glyph)
{ {
@ -894,23 +967,6 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
} }
else else
{ {
int xBack, widthBack;
int yBack, heightBack;
ppci = ppciInit;
n = nglyph;
widthBack = 0;
while (n--)
widthBack += (*ppci++)->metrics.characterWidth;
xBack = x;
if (widthBack < 0)
{
xBack += widthBack;
widthBack = -widthBack;
}
yBack = y - FONTASCENT(pGC->font);
heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font);
exaSolidBoxClipped (pDrawable, exaSolidBoxClipped (pDrawable,
fbGetCompositeClip(pGC), fbGetCompositeClip(pGC),
pGC->planemask, pGC->planemask,
@ -923,74 +979,50 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
} }
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
exaDoMigration(pixmaps, 1, FALSE);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC); exaPrepareAccessGC (pGC);
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
ppci = ppciInit; for (ppci = ppciInit; nglyph; nglyph--, x += pci->metrics.characterWidth)
while (nglyph--)
{ {
pci = *ppci++; pci = *ppci++;
pglyph = FONTGLYPHBITS(pglyphBase, pci);
gWidth = GLYPHWIDTHPIXELS(pci); gWidth = GLYPHWIDTHPIXELS(pci);
gHeight = GLYPHHEIGHTPIXELS(pci); gHeight = GLYPHHEIGHTPIXELS(pci);
if (gWidth && gHeight)
{
gx = x + pci->metrics.leftSideBearing; gx = x + pci->metrics.leftSideBearing;
gy = y - pci->metrics.ascent; gy = y - pci->metrics.ascent;
if (!gWidth || !gHeight || (gx + gWidth) <= xBack ||
(gy + gHeight) <= yBack || gx >= (xBack + widthBack) ||
gy >= (yBack + heightBack))
continue;
pglyph = FONTGLYPHBITS(pglyphBase, pci);
if (glyph && gWidth <= sizeof (FbStip) * 8 && if (glyph && gWidth <= sizeof (FbStip) * 8 &&
fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
{ {
(*glyph) (dst + (gy + dstYoff) * dstStride, (*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
dstStride, (FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight);
dstBpp,
(FbStip *) pglyph,
pPriv->fg,
gx + dstXoff,
gHeight);
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth, gy + gHeight);
} }
else else
{ {
RegionPtr pClip = fbGetCompositeClip(pGC); RegionPtr pClip = fbGetCompositeClip(pGC);
int nbox;
BoxPtr pbox;
gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
fbPutXYImage (pDrawable, fbPutXYImage (pDrawable, pClip, pPriv->fg, pPriv->bg, pPriv->pm,
pClip, GXcopy, opaque, gx, gy, gWidth, gHeight,
pPriv->fg, (FbStip *) pglyph, gStride, 0);
pPriv->bg,
pPriv->pm,
GXcopy,
opaque,
gx,
gy,
gWidth, gHeight,
(FbStip *) pglyph,
gStride,
0);
for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip);
nbox--; pbox++) {
int x1 = max(gx, pbox->x1), x2 = min(gx + gWidth, pbox->x2);
int y1 = max(gy, pbox->y1), y2 = min(gy + gHeight, pbox->y2);
if (x1 >= x2 || y1 >= y2)
continue;
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth,
gy + gHeight);
} }
} }
}
x += pci->metrics.characterWidth;
}
exaFinishAccessGC (pGC); exaFinishAccessGC (pGC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
damage:
exaGetDrawableDeltas(pDrawable, pPixmap, &dstXoff, &dstYoff);
exaPixmapDirty(pPixmap, xBack + dstXoff, yBack + dstYoff,
xBack + dstXoff + widthBack, yBack + dstYoff + heightBack);
} }
const GCOps exaOps = { const GCOps exaOps = {
@ -1043,10 +1075,12 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
} }
static void static Bool
exaFillRegionSolid (DrawablePtr pDrawable, exaFillRegionSolid (DrawablePtr pDrawable,
RegionPtr pRegion, RegionPtr pRegion,
Pixel pixel) Pixel pixel,
CARD32 planemask,
CARD32 alu)
{ {
ExaScreenPriv(pDrawable->pScreen); ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap; PixmapPtr pPixmap;
@ -1062,22 +1096,19 @@ exaFillRegionSolid (DrawablePtr pDrawable,
if (pPixmap->drawable.width > pExaScr->info->maxX || if (pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY) pPixmap->drawable.height > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 1, FALSE);
goto fallback; goto fallback;
} else { } else {
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, TRUE);
} }
if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) && if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel)) (*pExaScr->info->PrepareSolid) (pPixmap, alu, planemask, pixel))
{ {
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->Solid) (pPixmap, (*pExaScr->info->Solid) (pPixmap,
pBox->x1 + xoff, pBox->y1 + yoff, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff); pBox->x2 + xoff, pBox->y2 + yoff);
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++; pBox++;
} }
(*pExaScr->info->DoneSolid) (pPixmap); (*pExaScr->info->DoneSolid) (pPixmap);
@ -1086,27 +1117,30 @@ exaFillRegionSolid (DrawablePtr pDrawable,
else else
{ {
fallback: fallback:
if (alu != GXcopy || planemask != FB_ALLONES)
return FALSE;
EXA_FALLBACK(("to %p (%c)\n", pDrawable, EXA_FALLBACK(("to %p (%c)\n", pDrawable,
exaDrawableLocation(pDrawable))); exaDrawableLocation(pDrawable)));
exaDoMigration (pixmaps, 1, FALSE);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fbFillRegionSolid (pDrawable, pRegion, 0, fbFillRegionSolid (pDrawable, pRegion, 0,
fbReplicatePixel (pixel, pDrawable->bitsPerPixel)); fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
while (nbox--)
{
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
pBox++;
}
} }
return TRUE;
} }
/* Try to do an accelerated tile of the pTile into pRegion of pDrawable. /* Try to do an accelerated tile of the pTile into pRegion of pDrawable.
* Based on fbFillRegionTiled(), fbTile(). * Based on fbFillRegionTiled(), fbTile().
*/ */
static void Bool
exaFillRegionTiled (DrawablePtr pDrawable, exaFillRegionTiled (DrawablePtr pDrawable,
RegionPtr pRegion, RegionPtr pRegion,
PixmapPtr pTile) PixmapPtr pTile,
DDXPointPtr pPatOrg,
CARD32 planemask,
CARD32 alu)
{ {
ExaScreenPriv(pDrawable->pScreen); ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap; PixmapPtr pPixmap;
@ -1122,10 +1156,10 @@ exaFillRegionTiled (DrawablePtr pDrawable,
/* If we're filling with a solid color, grab it out and go to /* If we're filling with a solid color, grab it out and go to
* FillRegionSolid, saving numerous copies. * FillRegionSolid, saving numerous copies.
*/ */
if (tileWidth == 1 && tileHeight == 1) { if (tileWidth == 1 && tileHeight == 1)
exaFillRegionSolid(pDrawable, pRegion, exaGetPixmapFirstPixel (pTile)); return exaFillRegionSolid(pDrawable, pRegion,
return; exaGetPixmapFirstPixel (pTile), planemask,
} alu);
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE; pixmaps[0].as_src = FALSE;
@ -1139,7 +1173,6 @@ exaFillRegionTiled (DrawablePtr pDrawable,
tileWidth > pExaScr->info->maxX || tileWidth > pExaScr->info->maxX ||
tileHeight > pExaScr->info->maxY) tileHeight > pExaScr->info->maxY)
{ {
exaDoMigration (pixmaps, 2, FALSE);
goto fallback; goto fallback;
} else { } else {
exaDoMigration (pixmaps, 2, TRUE); exaDoMigration (pixmaps, 2, TRUE);
@ -1153,8 +1186,9 @@ exaFillRegionTiled (DrawablePtr pDrawable,
if (!exaPixmapIsOffscreen(pTile)) if (!exaPixmapIsOffscreen(pTile))
goto fallback; goto fallback;
if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile, &tileXoff, &tileYoff), pPixmap, 0, 0, GXcopy, if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile,
FB_ALLONES)) &tileXoff, &tileYoff),
pPixmap, 0, 0, alu, planemask))
{ {
while (nbox--) while (nbox--)
{ {
@ -1162,7 +1196,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
int dstY = pBox->y1; int dstY = pBox->y1;
int tileY; int tileY;
tileY = (dstY - pDrawable->y) % tileHeight; tileY = (dstY - pDrawable->y - pPatOrg->y) % tileHeight;
while (height > 0) { while (height > 0) {
int width = pBox->x2 - pBox->x1; int width = pBox->x2 - pBox->x1;
int dstX = pBox->x1; int dstX = pBox->x1;
@ -1173,7 +1207,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
h = height; h = height;
height -= h; height -= h;
tileX = (dstX - pDrawable->x) % tileWidth; tileX = (dstX - pDrawable->x - pPatOrg->x) % tileWidth;
while (width > 0) { while (width > 0) {
int w = tileWidth - tileX; int w = tileWidth - tileX;
if (w > width) if (w > width)
@ -1190,38 +1224,44 @@ exaFillRegionTiled (DrawablePtr pDrawable,
dstY += h; dstY += h;
tileY = 0; tileY = 0;
} }
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++; pBox++;
} }
(*pExaScr->info->DoneCopy) (pPixmap); (*pExaScr->info->DoneCopy) (pPixmap);
exaMarkSync(pDrawable->pScreen); exaMarkSync(pDrawable->pScreen);
return; return TRUE;
} }
fallback: fallback:
if (alu != GXcopy || planemask != FB_ALLONES)
return FALSE;
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable, EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable,
exaDrawableLocation(&pTile->drawable), exaDrawableLocation(&pTile->drawable),
exaDrawableLocation(pDrawable))); exaDrawableLocation(pDrawable)));
exaDoMigration (pixmaps, 2, FALSE);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC); exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
fbFillRegionTiled (pDrawable, pRegion, pTile); fbFillRegionTiled (pDrawable, pRegion, pTile);
exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC); exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
while (nbox--)
{ return TRUE;
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
pBox++;
}
} }
void void
exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
{ {
ExaScreenPriv (pWin->drawable.pScreen); ExaScreenPriv (pWin->drawable.pScreen);
if (!REGION_NUM_RECTS(pRegion)) PixmapPtr pPixmap = exaGetDrawablePixmap((DrawablePtr)pWin);
int xoff, yoff;
BoxPtr pBox;
int nbox = REGION_NUM_RECTS(pRegion);
if (!nbox)
return; return;
if (!pExaScr->swappedOut) { if (!pExaScr->swappedOut) {
DDXPointRec zeros = { 0, 0 };
switch (what) { switch (what) {
case PW_BACKGROUND: case PW_BACKGROUND:
switch (pWin->backgroundState) { switch (pWin->backgroundState) {
@ -1235,25 +1275,41 @@ exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
what); what);
return; return;
case BackgroundPixel: case BackgroundPixel:
exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel); exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel,
return; FB_ALLONES, GXcopy);
goto damage;
case BackgroundPixmap: case BackgroundPixmap:
exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->background.pixmap); exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->background.pixmap,
return; &zeros, FB_ALLONES, GXcopy);
goto damage;
} }
break; break;
case PW_BORDER: case PW_BORDER:
if (pWin->borderIsPixel) { if (pWin->borderIsPixel) {
exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel); exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel,
return; FB_ALLONES, GXcopy);
goto damage;
} else { } else {
exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->border.pixmap); exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->border.pixmap,
return; &zeros, FB_ALLONES, GXcopy);
goto damage;
} }
break; break;
} }
} }
ExaCheckPaintWindow (pWin, pRegion, what); ExaCheckPaintWindow (pWin, pRegion, what);
damage:
exaGetDrawableDeltas((DrawablePtr)pWin, pPixmap, &xoff, &yoff);
pBox = REGION_RECTS(pRegion);
while (nbox--)
{
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++;
}
} }
/** /**
@ -1273,27 +1329,22 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
int xoff, yoff; int xoff, yoff;
Bool ok; Bool ok;
if (pExaScr->swappedOut || pExaScr->info->DownloadFromScreen == NULL) if (pExaScr->info->DownloadFromScreen == NULL)
goto fallback; goto migrate_and_fallback;
/* Only cover the ZPixmap, solid copy case. */ /* Only cover the ZPixmap, solid copy case. */
if (format != ZPixmap || !EXA_PM_IS_SOLID(pDrawable, planeMask)) if (format != ZPixmap || !EXA_PM_IS_SOLID(pDrawable, planeMask))
goto fallback; goto migrate_and_fallback;
/* Only try to handle the 8bpp and up cases, since we don't want to think /* Only try to handle the 8bpp and up cases, since we don't want to think
* about <8bpp. * about <8bpp.
*/ */
if (pDrawable->bitsPerPixel < 8) if (pDrawable->bitsPerPixel < 8)
goto migrate_and_fallback;
if (pExaScr->swappedOut)
goto fallback; goto fallback;
/* Migrate, but assume that we could accelerate the download. It is up to
* the migration scheme to ensure that this case doesn't result in bad
* moving of pixmaps.
*/
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
exaDoMigration (pixmaps, 1, TRUE);
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff); pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
if (pPix == NULL) if (pPix == NULL)
goto fallback; goto fallback;
@ -1308,12 +1359,12 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
return; return;
} }
fallback: migrate_and_fallback:
pixmaps[0].as_dst = FALSE; pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable); pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
exaDoMigration (pixmaps, 1, FALSE); exaDoMigration (pixmaps, 1, FALSE);
fallback:
ExaCheckGetImage (pDrawable, x, y, w, h, format, planeMask, d); ExaCheckGetImage (pDrawable, x, y, w, h, format, planeMask, d);
} }

View File

@ -464,12 +464,10 @@ exaAssertNotDirty (PixmapPtr pPixmap)
BoxPtr pBox = REGION_RECTS(pValidReg); BoxPtr pBox = REGION_RECTS(pValidReg);
Bool ret = TRUE; Bool ret = TRUE;
if (pExaPixmap == NULL || pExaPixmap->fb_ptr == NULL) if (!nbox || exaPixmapIsPinned(pPixmap) || pExaPixmap->fb_ptr == NULL)
return ret; return ret;
dst = pExaPixmap->sys_ptr;
dst_pitch = pExaPixmap->sys_pitch; dst_pitch = pExaPixmap->sys_pitch;
src = pExaPixmap->fb_ptr;
src_pitch = pExaPixmap->fb_pitch; src_pitch = pExaPixmap->fb_pitch;
cpp = pPixmap->drawable.bitsPerPixel / 8; cpp = pPixmap->drawable.bitsPerPixel / 8;
@ -486,21 +484,18 @@ exaAssertNotDirty (PixmapPtr pPixmap)
continue; continue;
rowbytes = (pBox->x2 - pBox->x1) * cpp; rowbytes = (pBox->x2 - pBox->x1) * cpp;
src += pBox->y1 * src_pitch + pBox->x1 * cpp; src = pExaPixmap->fb_ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
dst += pBox->y1 * dst_pitch + pBox->x1 * cpp; dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp;
for (y = pBox->y2 - pBox->y1; y; y--) { for (y = pBox->y1; y < pBox->y2;
if (memcmp(dst + pBox->y1 * dst_pitch + pBox->x1 * cpp, y++, src += src_pitch, dst += dst_pitch) {
src + pBox->y1 * src_pitch + pBox->x1 * cpp, if (memcmp(dst, src, rowbytes) != 0) {
(pBox->x2 - pBox->x1) * cpp) != 0) {
ret = FALSE; ret = FALSE;
exaPixmapDirty(pPixmap, pBox->x1, pBox->y1, pBox->x2,
pBox->y2);
break; break;
} }
src += src_pitch;
dst += dst_pitch;
} }
src -= pBox->y1 * src_pitch + pBox->x1 * cpp;
dst -= pBox->y1 * dst_pitch + pBox->x1 * cpp;
} }
exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC); exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);

View File

@ -54,7 +54,7 @@ ExaOffscreenValidate (ScreenPtr pScreen)
assert (area->offset >= area->base_offset && assert (area->offset >= area->base_offset &&
area->offset < (area->base_offset + area->size)); area->offset < (area->base_offset + area->size));
if (prev) if (prev)
assert (prev->base_offset + prev->area.size == area->base_offset); assert (prev->base_offset + prev->size == area->base_offset);
prev = area; prev = area;
} }
assert (prev->base_offset + prev->size == pExaScr->info->memorySize); assert (prev->base_offset + prev->size == pExaScr->info->memorySize);
@ -341,13 +341,15 @@ exaEnableDisableFBAccess (int index, Bool enable)
ScreenPtr pScreen = screenInfo.screens[index]; ScreenPtr pScreen = screenInfo.screens[index];
ExaScreenPriv (pScreen); ExaScreenPriv (pScreen);
if (!enable) { if (!enable && pExaScr->disableFbCount++ == 0) {
if (pExaScr->info->exa_minor < 1) if (pExaScr->info->exa_minor < 1)
ExaOffscreenSwapOut (pScreen); ExaOffscreenSwapOut (pScreen);
else else
ExaOffscreenEjectPixmaps (pScreen); ExaOffscreenEjectPixmaps (pScreen);
pExaScr->swappedOut = TRUE; pExaScr->swappedOut = TRUE;
} else { }
if (enable && --pExaScr->disableFbCount == 0) {
if (pExaScr->info->exa_minor < 1) if (pExaScr->info->exa_minor < 1)
ExaOffscreenSwapIn (pScreen); ExaOffscreenSwapIn (pScreen);
pExaScr->swappedOut = FALSE; pExaScr->swappedOut = FALSE;

View File

@ -113,6 +113,7 @@ typedef struct {
enum ExaMigrationHeuristic migration; enum ExaMigrationHeuristic migration;
Bool hideOffscreenPixmapData; Bool hideOffscreenPixmapData;
Bool checkDirtyCorrectness; Bool checkDirtyCorrectness;
unsigned disableFbCount;
} ExaScreenPrivRec, *ExaScreenPrivPtr; } ExaScreenPrivRec, *ExaScreenPrivPtr;
/* /*
@ -287,6 +288,10 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap);
void void
exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
Bool
exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu);
void void
exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
@ -317,9 +322,6 @@ ExaCheckComposite (CARD8 op,
#endif #endif
/* exa_offscreen.c */ /* exa_offscreen.c */
void
ExaOffscreenMarkUsed (PixmapPtr pPixmap);
void void
ExaOffscreenSwapOut (ScreenPtr pScreen); ExaOffscreenSwapOut (ScreenPtr pScreen);
@ -343,7 +345,8 @@ void
exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2); exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
void void
exaDrawableDirty(DrawablePtr pDrawable, int x1, int y1, int x2, int y2); exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
int *xp, int *yp);
Bool Bool
exaDrawableIsOffscreen (DrawablePtr pDrawable); exaDrawableIsOffscreen (DrawablePtr pDrawable);

View File

@ -297,15 +297,15 @@ exaTryDriverSolidFill(PicturePtr pSrc,
nbox = REGION_NUM_RECTS(&region); nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region); pbox = REGION_RECTS(&region);
while (nbox--) while (nbox--)
{ {
(*pExaScr->info->Solid) (pDstPix, (*pExaScr->info->Solid) (pDstPix,
pbox->x1 + dst_off_x, pbox->y1 + dst_off_y, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y); pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
(*pExaScr->info->DoneSolid) (pDstPix); (*pExaScr->info->DoneSolid) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen); exaMarkSync(pDst->pDrawable->pScreen);
@ -446,8 +446,6 @@ exaTryDriverComposite(CARD8 op,
pbox->y1 + dst_off_y, pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1, pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1); pbox->y2 - pbox->y1);
exaPixmapDirty (pDstPix, pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x, pbox->y2 + dst_off_y);
pbox++; pbox++;
} }
(*pExaScr->info->DoneComposite) (pDstPix); (*pExaScr->info->DoneComposite) (pDstPix);
@ -521,6 +519,9 @@ exaTryMagicTwoPassCompositeHelper(CARD8 op,
CARD16 height) CARD16 height)
{ {
ExaScreenPriv (pDst->pDrawable->pScreen); ExaScreenPriv (pDst->pDrawable->pScreen);
DrawablePtr pDstDraw = pDst->pDrawable;
PixmapPtr pDstPixmap = exaGetDrawablePixmap(pDstDraw);
int xoff, yoff;
assert(op == PictOpOver); assert(op == PictOpOver);
@ -539,6 +540,12 @@ exaTryMagicTwoPassCompositeHelper(CARD8 op,
exaComposite(PictOpOutReverse, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, exaComposite(PictOpOutReverse, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
xDst, yDst, width, height); xDst, yDst, width, height);
exaGetDrawableDeltas(pDstDraw, pDstPixmap, &xoff, &yoff);
xoff += pDstDraw->x;
yoff += pDstDraw->y;
exaPixmapDirty(pDstPixmap, xDst + xoff, yDst + yoff, xDst + xoff + width,
yDst + yoff + height);
/* Then, add in the source value times the destination alpha factors (1.0). /* Then, add in the source value times the destination alpha factors (1.0).
*/ */
exaComposite(PictOpAdd, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, exaComposite(PictOpAdd, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
@ -565,6 +572,28 @@ exaComposite(CARD8 op,
int ret = -1; int ret = -1;
Bool saveSrcRepeat = pSrc->repeat; Bool saveSrcRepeat = pSrc->repeat;
Bool saveMaskRepeat = pMask ? pMask->repeat : 0; Bool saveMaskRepeat = pMask ? pMask->repeat : 0;
ExaMigrationRec pixmaps[3];
int npixmaps = 1;
PixmapPtr pSrcPixmap = NULL;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[0].pPix = exaGetDrawablePixmap (pDst->pDrawable);
if (pSrc->pDrawable) {
pSrcPixmap = exaGetDrawablePixmap (pSrc->pDrawable);
pixmaps[npixmaps].as_dst = FALSE;
pixmaps[npixmaps].as_src = TRUE;
pixmaps[npixmaps].pPix = pSrcPixmap;
npixmaps++;
}
if (pMask && pMask->pDrawable) {
pixmaps[npixmaps].as_dst = FALSE;
pixmaps[npixmaps].as_src = TRUE;
pixmaps[npixmaps].pPix = exaGetDrawablePixmap (pMask->pDrawable);
npixmaps++;
}
/* We currently don't support acceleration of gradients, or other pictures /* We currently don't support acceleration of gradients, or other pictures
* with a NULL pDrawable. * with a NULL pDrawable.
@ -583,19 +612,24 @@ exaComposite(CARD8 op,
if (!pMask) if (!pMask)
{ {
if (op == PictOpSrc) if ((op == PictOpSrc &&
((pSrc->format == pDst->format) ||
(pSrc->format==PICT_a8r8g8b8 && pDst->format==PICT_x8r8g8b8) ||
(pSrc->format==PICT_a8b8g8r8 && pDst->format==PICT_x8b8g8r8))) ||
(op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
pSrc->format == pDst->format &&
(pSrc->format==PICT_x8r8g8b8 || pSrc->format==PICT_x8b8g8r8)))
{ {
if (pSrc->pDrawable->width == 1 && if (pSrc->pDrawable->width == 1 &&
pSrc->pDrawable->height == 1 && pSrc->repeat && pSrc->pDrawable->height == 1 &&
pSrc->repeatType == RepeatNormal) pSrc->repeat)
{ {
ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst, ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
width, height); width, height);
if (ret == 1) if (ret == 1)
goto done; goto done;
} }
else if (!pSrc->repeat && !pSrc->transform && else if (pSrcPixmap && !pSrc->repeat && !pSrc->transform)
pSrc->format == pDst->format)
{ {
RegionRec region; RegionRec region;
@ -617,6 +651,45 @@ exaComposite(CARD8 op,
REGION_UNINIT(pDst->pDrawable->pScreen, &region); REGION_UNINIT(pDst->pDrawable->pScreen, &region);
goto done; goto done;
} }
else if (pSrcPixmap && !pSrc->transform &&
pSrc->repeatType == RepeatNormal)
{
RegionRec region;
DDXPointRec srcOrg;
/* Let's see if the driver can do the repeat in one go */
if (pExaScr->info->PrepareComposite && !pSrc->alphaMap &&
!pDst->alphaMap)
{
ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc,
ySrc, xMask, yMask, xDst, yDst,
width, height);
if (ret == 1)
goto done;
}
/* Now see if we can use exaFillRegionTiled() */
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst, xSrc,
ySrc, xMask, yMask, xDst, yDst,
width, height))
goto done;
srcOrg.x = (xSrc - xDst) % pSrcPixmap->drawable.width;
srcOrg.y = (ySrc - yDst) % pSrcPixmap->drawable.height;
ret = exaFillRegionTiled(pDst->pDrawable, &region, pSrcPixmap,
&srcOrg, FB_ALLONES, GXcopy);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
if (ret)
goto done;
}
} }
} }
@ -627,8 +700,8 @@ exaComposite(CARD8 op,
pMask->repeat = 0; pMask->repeat = 0;
if (pExaScr->info->PrepareComposite && if (pExaScr->info->PrepareComposite &&
(!pSrc->repeat || pSrc->repeat == RepeatNormal) && (!pSrc->repeat || pSrc->repeatType == RepeatNormal) &&
(!pMask || !pMask->repeat || pMask->repeat == RepeatNormal) && (!pMask || !pMask->repeat || pMask->repeatType == RepeatNormal) &&
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
{ {
Bool isSrcSolid; Bool isSrcSolid;
@ -660,39 +733,14 @@ exaComposite(CARD8 op,
} }
} }
if (ret != 0) {
ExaMigrationRec pixmaps[3];
/* failure to accelerate was not due to pixmaps being in the wrong
* locations.
*/
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = exaOpReadsDestination(op);
pixmaps[0].pPix = exaGetDrawablePixmap (pDst->pDrawable);
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = exaGetDrawablePixmap (pSrc->pDrawable);
if (pMask) {
pixmaps[2].as_dst = FALSE;
pixmaps[2].as_src = TRUE;
pixmaps[2].pPix = exaGetDrawablePixmap (pMask->pDrawable);
exaDoMigration(pixmaps, 3, FALSE);
} else {
exaDoMigration(pixmaps, 2, FALSE);
}
}
fallback: fallback:
#if DEBUG_TRACE_FALL #if DEBUG_TRACE_FALL
exaPrintCompositeFallback (op, pSrc, pMask, pDst); exaPrintCompositeFallback (op, pSrc, pMask, pDst);
#endif #endif
exaDoMigration(pixmaps, npixmaps, FALSE);
ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height); xMask, yMask, xDst, yDst, width, height);
exaDrawableDirty(pDst->pDrawable,
pDst->pDrawable->x + xDst,
pDst->pDrawable->y + yDst,
pDst->pDrawable->x + xDst + width,
pDst->pDrawable->y + yDst + height);
done: done:
pSrc->repeat = saveSrcRepeat; pSrc->repeat = saveSrcRepeat;
@ -716,6 +764,7 @@ exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
{ {
DrawablePtr pDraw = pPicture->pDrawable; DrawablePtr pDraw = pPicture->pDrawable;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
int xoff, yoff;
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
@ -724,8 +773,10 @@ exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
exaPrepareAccess(pDraw, EXA_PREPARE_DEST); exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
fbRasterizeTrapezoid(pPicture, trap, x_off, y_off); fbRasterizeTrapezoid(pPicture, trap, x_off, y_off);
exaDrawableDirty(pDraw, pDraw->x, pDraw->y, exaGetDrawableDeltas(pDraw, pixmaps[0].pPix, &xoff, &yoff);
pDraw->x + pDraw->width, pDraw->y + pDraw->height); exaPixmapDirty(pixmaps[0].pPix, pDraw->x + xoff, pDraw->y + yoff,
pDraw->x + xoff + pDraw->width,
pDraw->y + yoff + pDraw->height);
exaFinishAccess(pDraw, EXA_PREPARE_DEST); exaFinishAccess(pDraw, EXA_PREPARE_DEST);
} }
@ -739,6 +790,7 @@ exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
{ {
DrawablePtr pDraw = pPicture->pDrawable; DrawablePtr pDraw = pPicture->pDrawable;
ExaMigrationRec pixmaps[1]; ExaMigrationRec pixmaps[1];
int xoff, yoff;
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
@ -747,8 +799,10 @@ exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
exaPrepareAccess(pDraw, EXA_PREPARE_DEST); exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
fbAddTriangles(pPicture, x_off, y_off, ntri, tris); fbAddTriangles(pPicture, x_off, y_off, ntri, tris);
exaDrawableDirty(pDraw, pDraw->x, pDraw->y, exaGetDrawableDeltas(pDraw, pixmaps[0].pPix, &xoff, &yoff);
pDraw->x + pDraw->width, pDraw->y + pDraw->height); exaPixmapDirty(pixmaps[0].pPix, pDraw->x + xoff, pDraw->y + yoff,
pDraw->x + xoff + pDraw->width,
pDraw->y + yoff + pDraw->height);
exaFinishAccess(pDraw, EXA_PREPARE_DEST); exaFinishAccess(pDraw, EXA_PREPARE_DEST);
} }
@ -845,10 +899,11 @@ exaGlyphs (CARD8 op,
PixmapPtr pPixmap = NULL; PixmapPtr pPixmap = NULL;
PicturePtr pPicture; PicturePtr pPicture;
PixmapPtr pMaskPixmap = NULL; PixmapPtr pMaskPixmap = NULL;
PixmapPtr pDstPixmap = exaGetDrawablePixmap(pDst->pDrawable);
PicturePtr pMask; PicturePtr pMask;
ScreenPtr pScreen = pDst->pDrawable->pScreen; ScreenPtr pScreen = pDst->pDrawable->pScreen;
int width = 0, height = 0; int width = 0, height = 0;
int x, y; int x, y, x1, y1, xoff, yoff;
int xDst = list->xOff, yDst = list->yOff; int xDst = list->xOff, yDst = list->yOff;
int n; int n;
int error; int error;
@ -893,6 +948,11 @@ exaGlyphs (CARD8 op,
miGlyphExtents (nlist, list, glyphs, &extents); miGlyphExtents (nlist, list, glyphs, &extents);
extents.x1 = max(extents.x1, 0);
extents.y1 = max(extents.y1, 0);
extents.x2 = min(extents.x2, pDst->pDrawable->width);
extents.y2 = min(extents.y2, pDst->pDrawable->height);
if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1) if (extents.x2 <= extents.x1 || extents.y2 <= extents.y1)
return; return;
width = extents.x2 - extents.x1; width = extents.x2 - extents.x1;
@ -918,6 +978,7 @@ exaGlyphs (CARD8 op,
rect.width = width; rect.width = width;
rect.height = height; rect.height = height;
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect); (*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
exaPixmapDirty(pMaskPixmap, 0, 0, width, height);
FreeScratchGC (pGC); FreeScratchGC (pGC);
x = -extents.x1; x = -extents.x1;
y = -extents.y1; y = -extents.y1;
@ -929,6 +990,8 @@ exaGlyphs (CARD8 op,
y = 0; y = 0;
} }
exaGetDrawableDeltas(pDst->pDrawable, pDstPixmap, &xoff, &yoff);
while (nlist--) while (nlist--)
{ {
GCPtr pGC = NULL; GCPtr pGC = NULL;
@ -983,12 +1046,20 @@ exaGlyphs (CARD8 op,
pixmaps[0].as_dst = TRUE; pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE; pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPixmap; pixmaps[0].pPix = pPixmap;
exaDoMigration (pixmaps, 1, TRUE); exaDoMigration (pixmaps, 1, pExaScr->info->PrepareComposite != NULL);
while (n--) while (n--)
{ {
GlyphPtr glyph = *glyphs++; GlyphPtr glyph = *glyphs++;
pointer glyphdata = (pointer) (glyph + 1); pointer glyphdata = (pointer) (glyph + 1);
DrawablePtr pCmpDrw = (maskFormat ? pMask : pDst)->pDrawable;
x1 = x - glyph->info.x;
y1 = y - glyph->info.y;
if (x1 >= pCmpDrw->width || y1 >= pCmpDrw->height ||
(x1 + glyph->info.width) <= 0 || (y1 + glyph->info.height) <= 0)
goto nextglyph;
(*pScreen->ModifyPixmapHeader) (pScratchPixmap, (*pScreen->ModifyPixmapHeader) (pScratchPixmap,
glyph->info.width, glyph->info.width,
@ -1048,17 +1119,22 @@ exaGlyphs (CARD8 op,
if (maskFormat) if (maskFormat)
{ {
exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0, exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0,
x - glyph->info.x, y - glyph->info.y, x1, y1, glyph->info.width, glyph->info.height);
glyph->info.width, glyph->info.height); exaPixmapDirty(pMaskPixmap, x1, y1, x1 + glyph->info.width,
y1 + glyph->info.height);
} }
else else
{ {
exaComposite (op, pSrc, pPicture, pDst, exaComposite (op, pSrc, pPicture, pDst,
xSrc + (x - glyph->info.x) - xDst, xSrc + x1 - xDst, ySrc + y1 - yDst,
ySrc + (y - glyph->info.y) - yDst, 0, 0, x1, y1, glyph->info.width,
0, 0, x - glyph->info.x, y - glyph->info.y, glyph->info.height);
glyph->info.width, glyph->info.height); x1 += pDst->pDrawable->x + xoff;
y1 += pDst->pDrawable->y + yoff;
exaPixmapDirty(pDstPixmap, x1, y1, x1 + glyph->info.width,
y1 + glyph->info.height);
} }
nextglyph:
x += glyph->info.xOff; x += glyph->info.xOff;
y += glyph->info.yOff; y += glyph->info.yOff;
} }

View File

@ -88,10 +88,15 @@ ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format, int x, int y, int w, int h, int leftPad, int format,
char *bits) char *bits)
{ {
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
int xoff, yoff;
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits); fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
exaPixmapDirty(pPixmap, x + xoff, y + yoff, x + xoff + w, y + yoff + h);
} }
RegionPtr RegionPtr
@ -201,32 +206,11 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
{ {
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable))); EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
if (nrect) {
int x1 = max(prect->x, 0), y1 = max(prect->y, 0);
int x2 = min(prect->x + prect->width, pDrawable->width);
int y2 = min(prect->y + prect->height, pDrawable->height);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST); exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC); exaPrepareAccessGC (pGC);
fbPolyFillRect (pDrawable, pGC, nrect, prect); fbPolyFillRect (pDrawable, pGC, nrect, prect);
exaFinishAccessGC (pGC); exaFinishAccessGC (pGC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST); exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
/* Only track bounding box of damage, as this path can degenerate to
* zillions of damage boxes
*/
while (--nrect)
{
prect++;
x1 = min(x1, prect->x);
x2 = max(x2, prect->x + prect->width);
y1 = min(y1, prect->y);
y2 = max(y2, prect->y + prect->height);
}
exaDrawableDirty (pDrawable, pDrawable->x + x1, pDrawable->y + y1,
pDrawable->x + x2, pDrawable->y + y2);
}
} }
void void

View File

@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libfb.la libwfb.la libfbmmx.la noinst_LTLIBRARIES = libfb.la libwfb.la
INCLUDES = \ INCLUDES = \
-I$(top_srcdir)/hw/xfree86/os-support \ -I$(top_srcdir)/hw/xfree86/os-support \
@ -12,25 +12,8 @@ endif
libfb_la_CFLAGS = $(AM_CFLAGS) libfb_la_CFLAGS = $(AM_CFLAGS)
if MMX_CAPABLE
libfb_la_CFLAGS += -DUSE_MMX
libfbmmx_la_CFLAGS = \
$(DIX_CFLAGS) \
-DUSE_MMX \
-mmmx \
-msse \
-Winline \
--param inline-unit-growth=10000 \
--param large-function-growth=10000
endif
libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
libfbmmx_la_SOURCES = \
fbmmx.c \
fbmmx.h
libfb_la_SOURCES = \ libfb_la_SOURCES = \
fb.h \ fb.h \
fb24_32.c \ fb24_32.c \
@ -42,7 +25,6 @@ libfb_la_SOURCES = \
fbblt.c \ fbblt.c \
fbbltone.c \ fbbltone.c \
fbbstore.c \ fbbstore.c \
fbcompose.c \
fbcopy.c \ fbcopy.c \
fbfill.c \ fbfill.c \
fbfillrect.c \ fbfillrect.c \
@ -70,12 +52,8 @@ libfb_la_SOURCES = \
fbutil.c \ fbutil.c \
fbwindow.c \ fbwindow.c \
fbpseudocolor.c \ fbpseudocolor.c \
fbpseudocolor.h \ fbpseudocolor.h
fbedge.c \
fbedgeimp.h
libwfb_la_SOURCES = $(libfb_la_SOURCES) libwfb_la_SOURCES = $(libfb_la_SOURCES)
libfb_la_LIBADD = libfbmmx.la EXTRA_DIST = fbcmap.c fbcmap_mi.c
EXTRA_DIST = fbcmap.c

View File

@ -26,6 +26,8 @@
#define _FB_H_ #define _FB_H_
#include <X11/X.h> #include <X11/X.h>
#include <pixman/pixman.h>
#include "scrnintstr.h" #include "scrnintstr.h"
#include "pixmap.h" #include "pixmap.h"
#include "pixmapstr.h" #include "pixmapstr.h"
@ -2146,4 +2148,8 @@ void
fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what); fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
pixman_image_t *image_from_pict (PicturePtr pict,
Bool has_clip);
#endif /* _FB_H_ */ #endif /* _FB_H_ */

View File

@ -39,7 +39,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "resource.h" #include "resource.h"
#include "fb.h" #include "fb.h"
#ifndef XFree86Server #ifdef XFree86Server
#error "You should be compiling fbcmap_mi.c instead of fbcmap.c!"
#endif
ColormapPtr FbInstalledMaps[MAXSCREENS]; ColormapPtr FbInstalledMaps[MAXSCREENS];
int int
@ -584,87 +589,3 @@ fbInitVisuals (VisualPtr *visualp,
*defaultVisp = depth[i].vids[j]; *defaultVisp = depth[i].vids[j];
return TRUE; return TRUE;
} }
#else
#include "micmap.h"
int
fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
return miListInstalledColormaps(pScreen, pmaps);
}
void
fbInstallColormap(ColormapPtr pmap)
{
miInstallColormap(pmap);
}
void
fbUninstallColormap(ColormapPtr pmap)
{
miUninstallColormap(pmap);
}
void
fbResolveColor(unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue,
VisualPtr pVisual)
{
miResolveColor(pred, pgreen, pblue, pVisual);
}
Bool
fbInitializeColormap(ColormapPtr pmap)
{
return miInitializeColormap(pmap);
}
int
fbExpandDirectColors (ColormapPtr pmap,
int ndef,
xColorItem *indefs,
xColorItem *outdefs)
{
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
}
Bool
fbCreateDefColormap(ScreenPtr pScreen)
{
return miCreateDefColormap(pScreen);
}
void
fbClearVisualTypes(void)
{
miClearVisualTypes();
}
Bool
fbSetVisualTypes (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 fb.
*/
Bool
fbInitVisuals (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);
}
#endif

123
fb/fbcmap_mi.c Normal file
View File

@ -0,0 +1,123 @@
/************************************************************
Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
All Rights Reserved
Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright no-
tice appear in all copies and that both that copyright no-
tice and this permission notice appear in supporting docu-
mentation, and that the names of Sun or X Consortium
not be used in advertising or publicity pertaining to
distribution of the software without specific prior
written permission. Sun and X Consortium make no
representations about the suitability of this software for
any purpose. It is provided "as is" without any express or
implied warranty.
SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE LI-
ABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
/**
* This version of fbcmap.c is implemented in terms of mi functions.
* These functions used to be in fbcmap.c and depended upon the symbol
* XFree86Server being defined.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include "fb.h"
#include "micmap.h"
int
fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
return miListInstalledColormaps(pScreen, pmaps);
}
void
fbInstallColormap(ColormapPtr pmap)
{
miInstallColormap(pmap);
}
void
fbUninstallColormap(ColormapPtr pmap)
{
miUninstallColormap(pmap);
}
void
fbResolveColor(unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue,
VisualPtr pVisual)
{
miResolveColor(pred, pgreen, pblue, pVisual);
}
Bool
fbInitializeColormap(ColormapPtr pmap)
{
return miInitializeColormap(pmap);
}
int
fbExpandDirectColors (ColormapPtr pmap,
int ndef,
xColorItem *indefs,
xColorItem *outdefs)
{
return miExpandDirectColors(pmap, ndef, indefs, outdefs);
}
Bool
fbCreateDefColormap(ScreenPtr pScreen)
{
return miCreateDefColormap(pScreen);
}
void
fbClearVisualTypes(void)
{
miClearVisualTypes();
}
Bool
fbSetVisualTypes (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 fb.
*/
Bool
fbInitVisuals (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);
}

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "fb.h" #include "fb.h"
#include "fbmmx.h"
void void
fbCopyNtoN (DrawablePtr pSrcDrawable, fbCopyNtoN (DrawablePtr pSrcDrawable,
@ -60,19 +59,15 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
while (nbox--) while (nbox--)
{ {
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
if (pm == FB_ALLONES && alu == GXcopy && !reverse && if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
!upsidedown && fbHaveMMX()) !upsidedown)
{ {
if (!fbCopyAreammx (pSrcDrawable, if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
pDstDrawable, (pbox->x1 + dx + srcXoff),
(pbox->y1 + dy + srcYoff),
(pbox->x1 + dx), (pbox->x1 + srcXoff),
(pbox->y1 + dy), (pbox->y1 + srcYoff),
(pbox->x1),
(pbox->y1),
(pbox->x2 - pbox->x1), (pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1))) (pbox->y2 - pbox->y1)))
goto fallback; goto fallback;
@ -98,7 +93,7 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
reverse, reverse,
upsidedown); upsidedown);
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER
next: next:
#endif #endif
pbox++; pbox++;

View File

@ -1,314 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <string.h>
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "fb.h"
#ifdef RENDER
#include "picturestr.h"
#include "mipict.h"
#include "renderedge.h"
#include "fbpict.h"
/*
* 4 bit alpha
*/
#define N_BITS 4
#define rasterizeEdges fbRasterizeEdges4
#if BITMAP_BIT_ORDER == LSBFirst
#define Shift4(o) ((o) << 2)
#else
#define Shift4(o) ((1-(o)) << 2)
#endif
#define Get4(x,o) (((x) >> Shift4(o)) & 0xf)
#define Put4(x,o,v) (((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o)))
#define DefineAlpha(line,x) \
CARD8 *__ap = (CARD8 *) line + ((x) >> 1); \
int __ao = (x) & 1
#define StepAlpha ((__ap += __ao), (__ao ^= 1))
#define AddAlpha(a) { \
CARD8 __o = READ(__ap); \
CARD8 __a = (a) + Get4(__o, __ao); \
WRITE(__ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \
}
#include "fbedgeimp.h"
#undef AddAlpha
#undef StepAlpha
#undef DefineAlpha
#undef rasterizeEdges
#undef N_BITS
/*
* 1 bit alpha
*/
#define N_BITS 1
#define rasterizeEdges fbRasterizeEdges1
#include "fbedgeimp.h"
#undef rasterizeEdges
#undef N_BITS
/*
* 8 bit alpha
*/
static INLINE CARD8
clip255 (int x)
{
if (x > 255) return 255;
return x;
}
static INLINE void
add_saturate_8 (CARD8 *buf, int value, int length)
{
while (length--)
{
WRITE(buf, clip255 (READ(buf) + value));
buf++;
}
}
/*
* We want to detect the case where we add the same value to a long
* span of pixels. The triangles on the end are filled in while we
* count how many sub-pixel scanlines contribute to the middle section.
*
* +--------------------------+
* fill_height =| \ /
* +------------------+
* |================|
* fill_start fill_end
*/
static void
fbRasterizeEdges8 (FbBits *buf,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b)
{
xFixed y = t;
FbBits *line;
int fill_start = -1, fill_end = -1;
int fill_size = 0;
line = buf + xFixedToInt (y) * stride;
for (;;)
{
CARD8 *ap = (CARD8 *) line;
xFixed lx, rx;
int lxi, rxi;
/* clip X */
lx = l->x;
if (lx < 0)
lx = 0;
rx = r->x;
if (xFixedToInt (rx) >= width)
rx = IntToxFixed (width);
/* Skip empty (or backwards) sections */
if (rx > lx)
{
int lxs, rxs;
/* Find pixel bounds for span. */
lxi = xFixedToInt (lx);
rxi = xFixedToInt (rx);
/* Sample coverage for edge pixels */
lxs = RenderSamplesX (lx, 8);
rxs = RenderSamplesX (rx, 8);
/* Add coverage across row */
if (lxi == rxi)
{
WRITE(ap +lxi, clip255 (READ(ap + lxi) + rxs - lxs));
}
else
{
WRITE(ap + lxi, clip255 (READ(ap + lxi) + N_X_FRAC(8) - lxs));
/* Move forward so that lxi/rxi is the pixel span */
lxi++;
/* Don't bother trying to optimize the fill unless
* the span is longer than 4 pixels. */
if (rxi - lxi > 4)
{
if (fill_start < 0)
{
fill_start = lxi;
fill_end = rxi;
fill_size++;
}
else
{
if (lxi >= fill_end || rxi < fill_start)
{
/* We're beyond what we saved, just fill it */
add_saturate_8 (ap + fill_start,
fill_size * N_X_FRAC(8),
fill_end - fill_start);
fill_start = lxi;
fill_end = rxi;
fill_size = 1;
}
else
{
/* Update fill_start */
if (lxi > fill_start)
{
add_saturate_8 (ap + fill_start,
fill_size * N_X_FRAC(8),
lxi - fill_start);
fill_start = lxi;
}
else if (lxi < fill_start)
{
add_saturate_8 (ap + lxi, N_X_FRAC(8),
fill_start - lxi);
}
/* Update fill_end */
if (rxi < fill_end)
{
add_saturate_8 (ap + rxi,
fill_size * N_X_FRAC(8),
fill_end - rxi);
fill_end = rxi;
}
else if (fill_end < rxi)
{
add_saturate_8 (ap + fill_end,
N_X_FRAC(8),
rxi - fill_end);
}
fill_size++;
}
}
}
else
{
add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi);
}
/* Do not add in a 0 alpha here. This check is
* necessary to avoid a buffer overrun, (when rx
* is exactly on a pixel boundary). */
if (rxs)
WRITE(ap + rxi, clip255 (READ(ap + rxi) + rxs));
}
}
if (y == b) {
/* We're done, make sure we clean up any remaining fill. */
if (fill_start != fill_end) {
if (fill_size == N_Y_FRAC(8))
{
MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
}
else
{
add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
fill_end - fill_start);
}
}
break;
}
if (xFixedFrac (y) != Y_FRAC_LAST(8))
{
RenderEdgeStepSmall (l);
RenderEdgeStepSmall (r);
y += STEP_Y_SMALL(8);
}
else
{
RenderEdgeStepBig (l);
RenderEdgeStepBig (r);
y += STEP_Y_BIG(8);
if (fill_start != fill_end)
{
if (fill_size == N_Y_FRAC(8))
{
MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
}
else
{
add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
fill_end - fill_start);
}
fill_start = fill_end = -1;
fill_size = 0;
}
line += stride;
}
}
}
void
fbRasterizeEdges (FbBits *buf,
int bpp,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b)
{
switch (bpp) {
case 1:
fbRasterizeEdges1 (buf, width, stride, l, r, t, b);
break;
case 4:
fbRasterizeEdges4 (buf, width, stride, l, r, t, b);
break;
case 8:
fbRasterizeEdges8 (buf, width, stride, l, r, t, b);
break;
}
}
#endif /* RENDER */

View File

@ -1,145 +0,0 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef rasterizeSpan
#endif
static void
rasterizeEdges (FbBits *buf,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b)
{
xFixed y = t;
FbBits *line;
line = buf + xFixedToInt (y) * stride;
for (;;)
{
xFixed lx, rx;
int lxi, rxi;
/* clip X */
lx = l->x;
if (lx < 0)
lx = 0;
rx = r->x;
if (xFixedToInt (rx) >= width)
rx = IntToxFixed (width);
/* Skip empty (or backwards) sections */
if (rx > lx)
{
/* Find pixel bounds for span */
lxi = xFixedToInt (lx);
rxi = xFixedToInt (rx);
#if N_BITS == 1
{
FbBits *a = line;
FbBits startmask, endmask;
int nmiddle;
int width = rxi - lxi;
int x = lxi;
a += x >> FB_SHIFT;
x &= FB_MASK;
FbMaskBits (x, width, startmask, nmiddle, endmask);
if (startmask) {
WRITE(a, READ(a) | startmask);
a++;
}
while (nmiddle--)
WRITE(a++, FB_ALLONES);
if (endmask)
WRITE(a, READ(a) | endmask);
}
#else
{
DefineAlpha(line,lxi);
int lxs, rxs;
/* Sample coverage for edge pixels */
lxs = RenderSamplesX (lx, N_BITS);
rxs = RenderSamplesX (rx, N_BITS);
/* Add coverage across row */
if (lxi == rxi)
{
AddAlpha (rxs - lxs);
}
else
{
int xi;
AddAlpha (N_X_FRAC(N_BITS) - lxs);
StepAlpha;
for (xi = lxi + 1; xi < rxi; xi++)
{
AddAlpha (N_X_FRAC(N_BITS));
StepAlpha;
}
/* Do not add in a 0 alpha here. This check is necessary
* to avoid a buffer overrun when rx is exactly on a pixel
* boundary.
*/
if (rxs != 0)
AddAlpha (rxs);
}
}
#endif
}
if (y == b)
break;
#if N_BITS > 1
if (xFixedFrac (y) != Y_FRAC_LAST(N_BITS))
{
RenderEdgeStepSmall (l);
RenderEdgeStepSmall (r);
y += STEP_Y_SMALL(N_BITS);
}
else
#endif
{
RenderEdgeStepBig (l);
RenderEdgeStepBig (r);
y += STEP_Y_BIG(N_BITS);
line += stride;
}
}
}
#undef rasterizeSpan

View File

@ -27,7 +27,6 @@
#endif #endif
#include "fb.h" #include "fb.h"
#include "fbmmx.h"
void void
fbFill (DrawablePtr pDrawable, fbFill (DrawablePtr pDrawable,
@ -47,12 +46,15 @@ fbFill (DrawablePtr pDrawable,
switch (pGC->fillStyle) { switch (pGC->fillStyle) {
case FillSolid: case FillSolid:
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER
if (!pPriv->and && fbHaveMMX()) if (!pPriv->and)
if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor)) { {
if (pixman_fill (dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor))
{
fbFinishAccess (pDrawable); fbFinishAccess (pDrawable);
return; return;
} }
}
#endif #endif
fbSolid (dst + (y + dstYoff) * dstStride, fbSolid (dst + (y + dstYoff) * dstStride,
dstStride, dstStride,
@ -215,13 +217,13 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
if (partY2 <= partY1) if (partY2 <= partY1)
continue; continue;
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER
if (!and && fbHaveMMX()) if (!and)
{
if (pixman_fill (dst, dstStride, dstBpp,
partX1 + dstXoff, partX2 + dstYoff, (partX2 - partX1), (partY2 - partY1),
xor))
{ {
if (fbSolidFillmmx (pDrawable,
partX1, partY1,
(partX2 - partX1), (partY2 - partY1),
xor)) {
fbFinishAccess (pDrawable); fbFinishAccess (pDrawable);
return; return;
} }

2412
fb/fbmmx.c

File diff suppressed because it is too large Load Diff

View File

@ -1,232 +0,0 @@
/*
* Copyright © 2004 Red Hat, Inc.
* Copyright © 2005 Trolltech AS
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Søren Sandmann (sandmann@redhat.com)
* Lars Knoll (lars@trolltech.com)
*
* Based on work by Owen Taylor
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef USE_MMX
#if !defined(__amd64__) && !defined(__x86_64__)
Bool fbHaveMMX(void);
#else
#define fbHaveMMX() TRUE
#endif
#else
#define fbHaveMMX() FALSE
#endif
#ifdef USE_MMX
void fbComposeSetupMMX(void);
void fbCompositeSolidMask_nx8888x0565Cmmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrcAdd_8888x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrcAdd_8000x8000mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888RevNPx8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888x0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888RevNPx0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolid_nx8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolid_nx0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSolidMask_nx8x0565mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeSrc_8888x8x8888mmx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
Bool fbCopyAreammx (DrawablePtr pSrc,
DrawablePtr pDst,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height);
void fbCompositeCopyAreammx (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
Bool fbSolidFillmmx (DrawablePtr pDraw,
int x,
int y,
int width,
int height,
FbBits xor);
#endif /* USE_MMX */

File diff suppressed because it is too large Load Diff

View File

@ -121,7 +121,15 @@ fbCanGetSolid(PicturePtr pict)
break; \ break; \
case 16: \ case 16: \
(bits) = READ((CARD16 *) __bits__); \ (bits) = READ((CARD16 *) __bits__); \
(bits) = cvt0565to8888(bits); \ (bits) = cvt0565to0888(bits); \
break; \
case 8: \
(bits) = READ((CARD8 *) __bits__); \
(bits) = (bits) << 24; \
break; \
case 1: \
(bits) = READ((CARD32 *) __bits__); \
(bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\
break; \ break; \
default: \ default: \
return; \ return; \
@ -153,7 +161,7 @@ fbCanGetSolid(PicturePtr pict)
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 5) & 0x07e0) | \ (((s) >> 5) & 0x07e0) | \
(((s) >> 8) & 0xf800)) (((s) >> 8) & 0xf800))
#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ #define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
@ -375,6 +383,9 @@ typedef struct _FbComposeData {
CARD16 height; CARD16 height;
} FbComposeData; } FbComposeData;
void
fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer);
typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width); typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width);
typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width); typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width);
typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width); typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width);
@ -401,210 +412,7 @@ fbCompositeGeneral (CARD8 op,
CARD16 width, CARD16 width,
CARD16 height); CARD16 height);
/* fbedge.c */
void
fbRasterizeEdges (FbBits *buf,
int bpp,
int width,
int stride,
RenderEdge *l,
RenderEdge *r,
xFixed t,
xFixed b);
/* fbpict.c */ /* fbpict.c */
CARD32
fbOver (CARD32 x, CARD32 y);
CARD32
fbOver24 (CARD32 x, CARD32 y);
CARD32
fbIn (CARD32 x, CARD8 y);
void
fbCompositeSolidMask_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);
void
fbCompositeSolidMask_nx8x0888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8888x8888C (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8x0565 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx8888x0565C (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_8888x8888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_8888x0888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_8888x0565 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrc_0565x0565 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrcAdd_8000x8000 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrcAdd_8888x8888 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSrcAdd_1000x1000 (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMask_nx1xn (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void void
fbComposite (CARD8 op, fbComposite (CARD8 op,
PicturePtr pSrc, PicturePtr pSrc,
@ -619,6 +427,36 @@ fbComposite (CARD8 op,
CARD16 width, CARD16 width,
CARD16 height); CARD16 height);
typedef void (*CompositeFunc) (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbWalkCompositeRegion (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height,
Bool srcRepeat,
Bool maskRepeat,
CompositeFunc compositeRect);
/* fbtrap.c */ /* fbtrap.c */
void void

View File

@ -42,61 +42,16 @@ fbAddTraps (PicturePtr pPicture,
int ntrap, int ntrap,
xTrap *traps) xTrap *traps)
{ {
FbBits *buf; pixman_image_t *image = image_from_pict (pPicture, FALSE);
int bpp;
int width;
int stride;
int height;
int pxoff, pyoff;
xFixed x_off_fixed; if (!image)
xFixed y_off_fixed; return;
RenderEdge l, r;
xFixed t, b;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
x_off += pxoff;
y_off += pyoff;
x_off_fixed = IntToxFixed(y_off);
y_off_fixed = IntToxFixed(y_off);
while (ntrap--)
{
t = traps->top.y + y_off_fixed;
if (t < 0)
t = 0;
t = RenderSampleCeilY (t, bpp);
b = traps->bot.y + y_off_fixed;
if (xFixedToInt (b) >= height)
b = IntToxFixed (height) - 1;
b = RenderSampleFloorY (b, bpp);
if (b >= t)
{
/* initialize edge walkers */
RenderEdgeInit (&l, bpp, t,
traps->top.l + x_off_fixed,
traps->top.y + y_off_fixed,
traps->bot.l + x_off_fixed,
traps->bot.y + y_off_fixed);
RenderEdgeInit (&r, bpp, t,
traps->top.r + x_off_fixed,
traps->top.y + y_off_fixed,
traps->bot.r + x_off_fixed,
traps->bot.y + y_off_fixed);
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
}
traps++;
}
fbFinishAccess (pPicture->pDrawable); fbFinishAccess (pPicture->pDrawable);
pixman_image_unref (image);
} }
void void
@ -105,47 +60,16 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
int x_off, int x_off,
int y_off) int y_off)
{ {
FbBits *buf; pixman_image_t *image = image_from_pict (pPicture, FALSE);
int bpp;
int width;
int stride;
int height;
int pxoff, pyoff;
xFixed x_off_fixed; if (!image)
xFixed y_off_fixed; return;
RenderEdge l, r;
xFixed t, b;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
x_off += pxoff;
y_off += pyoff;
x_off_fixed = IntToxFixed(x_off);
y_off_fixed = IntToxFixed(y_off);
t = trap->top + y_off_fixed;
if (t < 0)
t = 0;
t = RenderSampleCeilY (t, bpp);
b = trap->bottom + y_off_fixed;
if (xFixedToInt (b) >= height)
b = IntToxFixed (height) - 1;
b = RenderSampleFloorY (b, bpp);
if (b >= t)
{
/* initialize edge walkers */
RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
}
fbFinishAccess (pPicture->pDrawable); fbFinishAccess (pPicture->pDrawable);
pixman_image_unref (image);
} }
static int static int

View File

@ -30,10 +30,6 @@
#include "fb.h" #include "fb.h"
#ifdef USE_MMX
#include "fbmmx.h"
#endif
Bool Bool
fbCreateWindow(WindowPtr pWin) fbCreateWindow(WindowPtr pWin)
{ {
@ -222,22 +218,23 @@ fbFillRegionSolid (DrawablePtr pDrawable,
int n = REGION_NUM_RECTS(pRegion); int n = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion); BoxPtr pbox = REGION_RECTS(pRegion);
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER
int has_mmx = 0; int try_mmx = 0;
if (!and && fbHaveMMX()) if (!and)
has_mmx = 1; try_mmx = 1;
#endif #endif
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
while (n--) while (n--)
{ {
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER
if (!has_mmx || !fbSolidFillmmx (pDrawable, if (!try_mmx || !pixman_fill (dst, dstStride, dstBpp,
pbox->x1, pbox->x1 + dstXoff, pbox->y1 + dstYoff,
pbox->y1,
(pbox->x2 - pbox->x1), (pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1), xor)) { (pbox->y2 - pbox->y1),
xor))
{
#endif #endif
fbSolid (dst + (pbox->y1 + dstYoff) * dstStride, fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
dstStride, dstStride,
@ -246,7 +243,7 @@ fbFillRegionSolid (DrawablePtr pDrawable,
(pbox->x2 - pbox->x1) * dstBpp, (pbox->x2 - pbox->x1) * dstBpp,
pbox->y2 - pbox->y1, pbox->y2 - pbox->y1,
and, xor); and, xor);
#ifdef USE_MMX #ifndef FB_ACCESS_WRAPPER
} }
#endif #endif
fbValidateDrawable (pDrawable); fbValidateDrawable (pDrawable);

View File

@ -184,9 +184,11 @@
#define fbUnmapWindow wfbUnmapWindow #define fbUnmapWindow wfbUnmapWindow
#define fbUnrealizeFont wfbUnrealizeFont #define fbUnrealizeFont wfbUnrealizeFont
#define fbValidateGC wfbValidateGC #define fbValidateGC wfbValidateGC
#define fbWalkCompositeRegion wfbWalkCompositeRegion
#define fbWinPrivateIndex wfbWinPrivateIndex #define fbWinPrivateIndex wfbWinPrivateIndex
#define fbZeroLine wfbZeroLine #define fbZeroLine wfbZeroLine
#define fbZeroSegment wfbZeroSegment #define fbZeroSegment wfbZeroSegment
#define image_from_pict wfb_image_from_pict
#define xxScrPrivateIndex wfbxxScrPrivateIndex #define xxScrPrivateIndex wfbxxScrPrivateIndex
#define xxGCPrivateIndex wfbxxGCPrivateIndex #define xxGCPrivateIndex wfbxxGCPrivateIndex
#define xxColormapPrivateIndex wfbxxColormapPrivateIndex #define xxColormapPrivateIndex wfbxxColormapPrivateIndex

View File

@ -26,12 +26,12 @@ libdarwinShared_a_SOURCES = darwin.c \
bin_PROGRAMS = XDarwin Xquartz bin_PROGRAMS = XDarwin Xquartz
XDarwin_SOURCES = \ XDarwin_SOURCES = \
$(top_srcdir)/fb/fbcmap.c \ $(top_srcdir)/fb/fbcmap_mi.c \
$(top_srcdir)/mi/miinitext.c \ $(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xi/stubs.c $(top_srcdir)/Xi/stubs.c
Xquartz_SOURCES = \ Xquartz_SOURCES = \
$(top_srcdir)/fb/fbcmap.c \ $(top_srcdir)/fb/fbcmap_mi.c \
$(top_srcdir)/mi/miinitext.c \ $(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xi/stubs.c \ $(top_srcdir)/Xi/stubs.c \
apple/X11Application.m \ apple/X11Application.m \
@ -115,7 +115,7 @@ x11app:
cd apple && xcodebuild CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)" cd apple && xcodebuild CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)"
XDarwinApp_SOURCES = \ XDarwinApp_SOURCES = \
$(top_srcdir)/fb/fbcmap.c \ $(top_srcdir)/fb/fbcmap_mi.c \
$(top_srcdir)/mi/miinitext.c \ $(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/Xi/stubs.c $(top_srcdir)/Xi/stubs.c

View File

@ -16,9 +16,6 @@ GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod \
GLX_DEFS = @GL_CFLAGS@ GLX_DEFS = @GL_CFLAGS@
endif endif
# It's essential that fbcmap.c be compiled with this flag for DMX to work!!
DMX_CFLAGS = -DXFree86Server=1
if BUILDDOCS if BUILDDOCS
SUBDIRS += doc SUBDIRS += doc
endif endif
@ -76,7 +73,7 @@ Xdmx_SOURCES = dmx.c \
dmxwindow.c \ dmxwindow.c \
dmxwindow.h \ dmxwindow.h \
$(top_srcdir)/mi/miinitext.c \ $(top_srcdir)/mi/miinitext.c \
$(top_srcdir)/fb/fbcmap.c \ $(top_srcdir)/fb/fbcmap_mi.c \
$(GLX_SRCS) $(GLX_SRCS)

View File

@ -66,7 +66,7 @@
((year-2000) * 10000) + \ ((year-2000) * 10000) + \
((month) * 100) + \ ((month) * 100) + \
((day) * 1) ((day) * 1)
#define VENDOR_RELEASE DMX_VENDOR_RELEASE(1,2,2004,6,30) #define VENDOR_RELEASE DMX_VENDOR_RELEASE(1,2,2007,4,24)
#define VENDOR_STRING "DMX Project" #define VENDOR_STRING "DMX Project"
/* Enable the DMX extension */ /* Enable the DMX extension */

View File

@ -889,7 +889,7 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
gx = start->rootXOrigin + x; gx = start->rootXOrigin + x;
gy = start->rootYOrigin + y; gy = start->rootYOrigin + y;
if (x && y && (GX != gx || GY != gy)) if (x && y && (GX != gx || GY != gy))
dmxCoreMotion(gx, gy, 0, DMX_NO_BLOCK); dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
_dmxSetCursor(pScreen, pCursor, x, y); _dmxSetCursor(pScreen, pCursor, x, y);

View File

@ -154,7 +154,7 @@ typedef enum {
extern void dmxGetGlobalPosition(int *x, int *y); extern void dmxGetGlobalPosition(int *x, int *y);
extern DMXScreenInfo *dmxFindFirstScreen(int x, int y); extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
extern void dmxCoreMotion(int x, int y, int delta, extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
DMXBlockType block); DMXBlockType block);
/* Support for dynamic addition of inputs. This functions is defined in /* Support for dynamic addition of inputs. This functions is defined in

View File

@ -67,7 +67,7 @@ extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap );
extern void __glXNoSuchRenderOpcode(GLbyte*); extern void __glXNoSuchRenderOpcode(GLbyte*);
extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*); extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*);
extern void __glXErrorCallBack(__GLinterface *gc, GLenum code); extern void __glXErrorCallBack(GLenum code);
extern void __glXClearErrorOccured(void); extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void); extern GLboolean __glXErrorOccured(void);
extern void __glXResetLargeCommandStatus(__GLXclientState*); extern void __glXResetLargeCommandStatus(__GLXclientState*);

View File

@ -242,11 +242,7 @@ static int dmxBackendOffscreen(int screen, int x, int y)
void dmxBackendUpdatePosition(pointer private, int x, int y) void dmxBackendUpdatePosition(pointer private, int x, int y)
{ {
GETPRIVFROMPRIVATE; GETPRIVFROMPRIVATE;
#if 00 /*BP*/
int screen = miPointerCurrentScreen()->myNum;
#else
int screen = miPointerGetScreen(inputInfo.pointer)->myNum; int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
#endif
DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
int oldRelative = priv->relative; int oldRelative = priv->relative;
int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
@ -358,7 +354,8 @@ void dmxBackendCollectEvents(DevicePtr pDev,
switch (X.type) { switch (X.type) {
case EnterNotify: case EnterNotify:
dmxCommonSaveState(priv); dmxCommonSaveState(priv);
if (entered++) continue; if (entered++)
continue;
priv->entered = 1; priv->entered = 1;
ignoreLeave = 1; ignoreLeave = 1;
DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n", DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
@ -382,7 +379,8 @@ void dmxBackendCollectEvents(DevicePtr pDev,
continue; continue;
} }
dmxCommonRestoreState(priv); dmxCommonRestoreState(priv);
if (left++) continue; if (left++)
continue;
DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n", DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
X.xcrossing.detail, X.xcrossing.focus, X.xcrossing.detail, X.xcrossing.focus,
@ -395,7 +393,6 @@ void dmxBackendCollectEvents(DevicePtr pDev,
} }
break; break;
case MotionNotify: case MotionNotify:
#if 00 /*BP*/
DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
" newscreen=%d: %d %d (e=%d; last=%d,%d)\n", " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
dmxScreen->index, priv->myScreen, dmxScreen->index, priv->myScreen,
@ -403,7 +400,8 @@ void dmxBackendCollectEvents(DevicePtr pDev,
priv->newscreen, priv->newscreen,
X.xmotion.x, X.xmotion.y, X.xmotion.x, X.xmotion.y,
entered, priv->lastX, priv->lastY); entered, priv->lastX, priv->lastY);
if (dmxBackendPendingMotionEvent(priv, TRUE)) continue; if (dmxBackendPendingMotionEvent(priv, TRUE))
continue;
if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window))) if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
dmxLog(dmxFatal, dmxLog(dmxFatal,
" Event on non-existant window %lu\n", " Event on non-existant window %lu\n",
@ -448,26 +446,15 @@ void dmxBackendCollectEvents(DevicePtr pDev,
(dmxScreen->rootYOrigin + X.xmotion.y (dmxScreen->rootYOrigin + X.xmotion.y
- dmxScreen->rootY)); - dmxScreen->rootY));
} }
#else
/*
ErrorF("motion %d, %d, %d\n",
X.xmotion.x, X.xmotion.y, X.xmotion.state);
*/
enqueue(priv->mou, X.type, 0/*X.xbutton.button*/, 0, &X, block);
#endif
break; break;
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
break; break;
#if 11/*BP*/
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
/* /* fall-through */
ErrorF("press/release at %d, %d\n", X.xbutton.x, X.xbutton.y);
*/
#endif
default: default:
/* Pass the whole event here, because /* Pass the whole event here, because
* this may be an extension event. */ * this may be an extension event. */
@ -590,12 +577,16 @@ void dmxBackendInit(DevicePtr pDev)
/** Get information about the backend pointer (for initialization). */ /** Get information about the backend pointer (for initialization). */
void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{ {
const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
info->buttonClass = 1; info->buttonClass = 1;
dmxCommonMouGetMap(pDev, info->map, &info->numButtons); dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
info->valuatorClass = 1; info->valuatorClass = 1;
info->numRelAxes = 2; info->numRelAxes = 2;
info->minval[0] = 0; info->minval[0] = 0;
info->maxval[0] = 0; info->minval[1] = 0;
info->maxval[0] = dmxScreen->beWidth;
info->maxval[1] = dmxScreen->beHeight;
info->res[0] = 1; info->res[0] = 1;
info->minres[0] = 0; info->minres[0] = 0;
info->maxres[0] = 1; info->maxres[0] = 1;

View File

@ -241,13 +241,15 @@ void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
/* Compute pModMap */ /* Compute pModMap */
modifier_mapping = XGetModifierMapping(priv->display); modifier_mapping = XGetModifierMapping(priv->display);
for (i = 0; i < MAP_LENGTH; i++) pModMap[i] = 0; for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = 0;
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
int max_keypermod = modifier_mapping->max_keypermod; int max_keypermod = modifier_mapping->max_keypermod;
for (i = 0; i < max_keypermod; i++) { for (i = 0; i < max_keypermod; i++) {
CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i]; CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i];
if (keycode) pModMap[keycode] |= 1 << j; if (keycode)
pModMap[keycode] |= 1 << j;
} }
} }
XFreeModifiermap(modifier_mapping); XFreeModifiermap(modifier_mapping);
@ -611,6 +613,7 @@ void dmxCommonSaveState(pointer private)
&priv->dmxLocal->kctrl); &priv->dmxLocal->kctrl);
priv->savedModMap = XGetModifierMapping(priv->display); priv->savedModMap = XGetModifierMapping(priv->display);
modmap = XNewModifiermap(0); modmap = XNewModifiermap(0);
XSetModifierMapping(priv->display, modmap); XSetModifierMapping(priv->display, modmap);
if (dmxInput->scrnIdx != -1) if (dmxInput->scrnIdx != -1)
@ -627,8 +630,10 @@ void dmxCommonRestoreState(pointer private)
int retcode = -1; int retcode = -1;
CARD32 start; CARD32 start;
if (dmxInput->console) priv = dmxInput->devs[0]->private; if (dmxInput->console)
if (!priv->stateSaved) return; priv = dmxInput->devs[0]->private;
if (!priv->stateSaved)
return;
priv->stateSaved = 0; priv->stateSaved = 0;
DMXDBG0("dmxCommonRestoreState\n"); DMXDBG0("dmxCommonRestoreState\n");
@ -645,7 +650,8 @@ void dmxCommonRestoreState(pointer private)
CARD32 tmp; CARD32 tmp;
retcode = XSetModifierMapping(priv->display, priv->savedModMap); retcode = XSetModifierMapping(priv->display, priv->savedModMap);
if (retcode == MappingSuccess) break; if (retcode == MappingSuccess)
break;
if (retcode == MappingBusy) if (retcode == MappingBusy)
dmxLogInput(dmxInput, "Keyboard busy, waiting\n"); dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
else else

View File

@ -860,12 +860,17 @@ void dmxConsoleInit(DevicePtr pDev)
* for pointers. */ * for pointers. */
void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{ {
GETPRIVFROMPDEV;
info->buttonClass = 1; info->buttonClass = 1;
dmxCommonMouGetMap(pDev, info->map, &info->numButtons); dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
info->valuatorClass = 1; info->valuatorClass = 1;
info->numRelAxes = 2; info->numRelAxes = 2;
info->minval[0] = 0; info->minval[0] = 0;
info->maxval[0] = 0; info->minval[1] = 0;
/* max possible console window size: */
info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display));
info->res[0] = 1; info->res[0] = 1;
info->minres[0] = 0; info->minres[0] = 0;
info->maxres[0] = 1; info->maxres[0] = 1;

View File

@ -79,7 +79,9 @@ void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
info->valuatorClass = 1; info->valuatorClass = 1;
info->numRelAxes = 2; info->numRelAxes = 2;
info->minval[0] = 0; info->minval[0] = 0;
info->minval[1] = 0;
info->maxval[0] = 0; info->maxval[0] = 0;
info->maxval[1] = 0;
info->res[0] = 1; info->res[0] = 1;
info->minres[0] = 0; info->minres[0] = 0;
info->maxres[0] = 1; info->maxres[0] = 1;

View File

@ -104,6 +104,24 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
unsigned short state = 0; unsigned short state = 0;
#if 1 /* hack to detect ctrl-alt-q, etc */
static int ctrl = 0, alt = 0;
/* keep track of ctrl/alt key status */
if (type == KeyPress && keySym == 0xffe3) {
ctrl = 1;
}
else if (type == KeyRelease && keySym == 0xffe3) {
ctrl = 0;
}
else if (type == KeyPress && keySym == 0xffe9) {
alt = 1;
}
else if (type == KeyRelease && keySym == 0xffe9) {
alt = 0;
}
if (!ctrl || !alt)
return 0;
#else
if (dmxLocal->sendsCore) if (dmxLocal->sendsCore)
state = dmxLocalCoreKeyboard->pDevice->key->state; state = dmxLocalCoreKeyboard->pDevice->key->state;
else if (dmxLocal->pDevice->key) else if (dmxLocal->pDevice->key)
@ -112,7 +130,9 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
keySym, type == KeyPress ? "press" : "release", state); keySym, type == KeyPress ? "press" : "release", state);
if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0; if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
return 0;
#endif
switch (keySym) { switch (keySym) {
case XK_g: case XK_g:
@ -147,16 +167,25 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
int type = e->u.u.type; int type = e->u.u.type;
switch (e->u.u.type) { switch (e->u.u.type) {
case KeyPress: type = DeviceKeyPress; break; case KeyPress:
case KeyRelease: type = DeviceKeyRelease; break; type = DeviceKeyPress;
case ButtonPress: type = DeviceButtonPress; break; break;
case ButtonRelease: type = DeviceButtonRelease; break; case KeyRelease:
type = DeviceKeyRelease;
break;
case ButtonPress:
type = DeviceButtonPress;
break;
case ButtonRelease:
type = DeviceButtonRelease;
break;
case MotionNotify: case MotionNotify:
dmxLog(dmxError, dmxLog(dmxError,
"dmxEnqueueExtEvent: MotionNotify not allowed here\n"); "dmxEnqueueExtEvent: MotionNotify not allowed here\n");
return; return;
default: default:
if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut) break; if (e->u.u.type == ProximityIn || e->u.u.type == ProximityOut)
break;
dmxLogInput(dmxInput, dmxLogInput(dmxInput,
"dmxEnqueueExtEvent: Unhandled %s event (%d)\n", "dmxEnqueueExtEvent: Unhandled %s event (%d)\n",
e->u.u.type >= LASTEvent ? "extension" : "non-extension", e->u.u.type >= LASTEvent ? "extension" : "non-extension",
@ -174,9 +203,11 @@ static void dmxEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, xEvent *e,
xv->num_valuators = 0; xv->num_valuators = 0;
xv->first_valuator = 0; xv->first_valuator = 0;
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxeqEnqueue(xE); dmxeqEnqueue(xE);
if (block) dmxSigioUnblock(); if (block)
dmxSigioUnblock();
} }
#endif #endif
@ -186,12 +217,36 @@ DMXScreenInfo *dmxFindFirstScreen(int x, int y)
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i]; DMXScreenInfo *dmxScreen = &dmxScreens[i];
if (dmxOnScreen(x, y, dmxScreen)) return dmxScreen; if (dmxOnScreen(x, y, dmxScreen))
return dmxScreen;
} }
return NULL; return NULL;
} }
void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
/**
* Enqueue a motion event.
*/
static void enqueueMotion(DevicePtr pDev, int x, int y)
{
GETDMXLOCALFROMPDEV;
DeviceIntPtr p = dmxLocal->pDevice;
int i, nevents, valuators[3];
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
int detail = 0; /* XXX should this be mask of pressed buttons? */
valuators[0] = x;
valuators[1] = y;
nevents = GetPointerEvents(events, p, MotionNotify, detail,
POINTER_ABSOLUTE, 0, 2, valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i);
xfree(events);
return;
}
void
dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
{ {
DMXScreenInfo *dmxScreen; DMXScreenInfo *dmxScreen;
DMXInputInfo *dmxInput; DMXInputInfo *dmxInput;
@ -200,7 +255,8 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
int localY; int localY;
int i; int i;
if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) return; if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
return;
DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
x, y, delta, dmxGlobalX, dmxGlobalY); x, y, delta, dmxGlobalX, dmxGlobalY);
@ -209,71 +265,61 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
dmxGlobalX = x; dmxGlobalX = x;
dmxGlobalY = y; dmxGlobalY = y;
if (dmxGlobalX < 0) dmxGlobalX = 0; if (dmxGlobalX < 0)
if (dmxGlobalY < 0) dmxGlobalY = 0; dmxGlobalX = 0;
if (dmxGlobalX >= dmxGlobalWidth) dmxGlobalX = dmxGlobalWidth + delta -1; if (dmxGlobalY < 0)
if (dmxGlobalY >= dmxGlobalHeight) dmxGlobalY = dmxGlobalHeight + delta -1; dmxGlobalY = 0;
if (dmxGlobalX >= dmxGlobalWidth)
dmxGlobalX = dmxGlobalWidth + delta -1;
if (dmxGlobalY >= dmxGlobalHeight)
dmxGlobalY = dmxGlobalHeight + delta -1;
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
localX = dmxGlobalX - dmxScreen->rootXOrigin; localX = dmxGlobalX - dmxScreen->rootXOrigin;
localY = dmxGlobalY - dmxScreen->rootYOrigin; localY = dmxGlobalY - dmxScreen->rootYOrigin;
#if 00 /*BP*/
if ((pScreen = miPointerCurrentScreen())
#else
if ((pScreen = miPointerGetScreen(inputInfo.pointer)) if ((pScreen = miPointerGetScreen(inputInfo.pointer))
#endif
&& pScreen->myNum == dmxScreen->index) { && pScreen->myNum == dmxScreen->index) {
/* Screen is old screen */ /* Screen is old screen */
if (block) dmxSigioBlock(); if (block)
#if 00 /*BP*/ dmxSigioBlock();
miPointerAbsoluteCursor(localX, localY, GetTimeInMillis()); if (pDev)
#else enqueueMotion(pDev, localX, localY);
miPointerSetPosition(inputInfo.pointer, &localX, &localY, if (block)
GetTimeInMillis()); dmxSigioUnblock();
#endif
if (block) dmxSigioUnblock();
} else { } else {
/* Screen is new */ /* Screen is new */
DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
pScreen->myNum, dmxScreen->index, localX, localY); pScreen->myNum, dmxScreen->index, localX, localY);
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxeqProcessInputEvents(); dmxeqProcessInputEvents();
#if 00 /*BP*/
miPointerSetNewScreen(dmxScreen->index, localX, localY);
miPointerAbsoluteCursor(localX, localY, GetTimeInMillis());
#else
miPointerSetScreen(inputInfo.pointer, dmxScreen->index, miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
localX, localY); localX, localY);
miPointerSetPosition(inputInfo.pointer, &localX, &localY, if (pDev)
GetTimeInMillis()); enqueueMotion(pDev, localX, localY);
#endif if (block)
if (block) dmxSigioUnblock(); dmxSigioUnblock();
} }
#if 00 /*BP*/ #if 00
miPointerPosition(&localX, &localY);
#else
miPointerGetPosition(inputInfo.pointer, &localX, &localY); miPointerGetPosition(inputInfo.pointer, &localX, &localY);
#endif
#if 00 /*BP*/
if ((pScreen = miPointerCurrentScreen())) {
#else
if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { if ((pScreen = miPointerGetScreen(inputInfo.pointer))) {
#endif
dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin;
dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin;
ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY,
localX, localY);
DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d"
" on screen index=%d/%d localX=%d localY=%d\n", " on screen index=%d/%d localX=%d localY=%d\n",
dmxGlobalX, dmxGlobalY, dmxGlobalX, dmxGlobalY,
dmxScreen ? dmxScreen->index : -1, pScreen->myNum, dmxScreen ? dmxScreen->index : -1, pScreen->myNum,
localX, localY); localX, localY);
} }
#endif
} }
/* Send updates down to all core input /* Send updates down to all core input
* drivers */ * drivers */
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
int j; int j;
for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
if (!dmxInput->detached if (!dmxInput->detached
&& dmxInput->devs[j]->sendsCore && dmxInput->devs[j]->sendsCore
@ -284,6 +330,8 @@ void dmxCoreMotion(int x, int y, int delta, DMXBlockType block)
if (!dmxScreen) ProcessInputEvents(); if (!dmxScreen) ProcessInputEvents();
} }
#ifdef XINPUT #ifdef XINPUT
#define DMX_MAX_AXES 32 /* Max axes reported by this routine */ #define DMX_MAX_AXES 32 /* Max axes reported by this routine */
static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
@ -374,10 +422,12 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
} }
} }
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time); dmxPointerPutMotionEvent(pDevice, firstAxis, axesCount, v, xev->time);
dmxeqEnqueue(xE); dmxeqEnqueue(xE);
if (block) dmxSigioUnblock(); if (block)
dmxSigioUnblock();
} }
static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
@ -391,7 +441,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e; XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
XDeviceMotionEvent *me = (XDeviceMotionEvent *)e; XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
if (!e) return -1; /* No extended event passed, cannot handle */ if (!e)
return -1; /* No extended event passed, cannot handle */
if ((XID)dmxLocal->deviceId != ke->deviceid) { if ((XID)dmxLocal->deviceId != ke->deviceid) {
/* Search for the correct dmxLocal, /* Search for the correct dmxLocal,
@ -402,7 +453,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
for (i = 0; i < dmxInput->numDevs; i++) { for (i = 0; i < dmxInput->numDevs; i++) {
dmxLocal = dmxInput->devs[i]; dmxLocal = dmxInput->devs[i];
if ((XID)dmxLocal->deviceId == ke->deviceid) break; if ((XID)dmxLocal->deviceId == ke->deviceid)
break;
} }
} }
@ -451,9 +503,11 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
xv->valuator4 = ke->axis_data[4]; xv->valuator4 = ke->axis_data[4];
xv->valuator5 = ke->axis_data[5]; xv->valuator5 = ke->axis_data[5];
if (block) dmxSigioBlock(); if (block)
dmxSigioBlock();
dmxeqEnqueue(xE); dmxeqEnqueue(xE);
if (block) dmxSigioUnblock(); if (block)
dmxSigioUnblock();
break; break;
case XI_DeviceMotionNotify: case XI_DeviceMotionNotify:
@ -533,12 +587,18 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
return; return;
} }
#endif #endif
if (axesCount == 2) switch (type) { if (axesCount == 2) {
case DMX_RELATIVE: dmxCoreMotion(dmxGlobalX - v[0], switch (type) {
dmxGlobalY - v[1], case DMX_RELATIVE:
0, block); break; dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block);
case DMX_ABSOLUTE: dmxCoreMotion(v[0], v[1], 0, block); break; break;
case DMX_ABSOLUTE_CONFINED: dmxCoreMotion(v[0], v[1], -1, block); break; case DMX_ABSOLUTE:
dmxCoreMotion(pDev, v[0], v[1], 0, block);
break;
case DMX_ABSOLUTE_CONFINED:
dmxCoreMotion(pDev, v[0], v[1], -1, block);
break;
}
} }
} }
@ -550,7 +610,8 @@ static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key)
return NoSymbol; return NoSymbol;
pKeySyms = &dmxLocal->pDevice->key->curKeySyms; pKeySyms = &dmxLocal->pDevice->key->curKeySyms;
if (!pKeySyms) return NoSymbol; if (!pKeySyms)
return NoSymbol;
if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) { if (keyCode > pKeySyms->minKeyCode && keyCode <= pKeySyms->maxKeyCode) {
DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
@ -599,14 +660,16 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
dmxLocal->pDevice->name); dmxLocal->pDevice->name);
return NoSymbol; return NoSymbol;
} }
if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (!keySym)
if (keySym == NoSymbol) return detail; keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
if (keySym == NoSymbol)
return detail;
keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail); keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail);
return keyCode ? keyCode : detail; return keyCode ? keyCode : detail;
} }
/** Enqueue a non-motion event from the \a pDev device with the /** Enqueue an event from the \a pDev device with the
* specified \a type and \a detail. If the event is a KeyPress or * specified \a type and \a detail. If the event is a KeyPress or
* KeyRelease event, then the \a keySym is also specified. * KeyRelease event, then the \a keySym is also specified.
* *
@ -618,100 +681,56 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
{ {
GETDMXINPUTFROMPDEV; GETDMXINPUTFROMPDEV;
xEvent xE; xEvent xE;
DeviceIntPtr p = dmxLocal->pDevice;
int i, nevents, valuators[3];
xEvent *events;
DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail);
switch (type) { switch (type) {
case KeyPress: case KeyPress:
case KeyRelease: case KeyRelease:
if (!keySym) keySym = dmxKeyCodeToKeySym(dmxLocal, detail); if (!keySym)
keySym = dmxKeyCodeToKeySym(dmxLocal, detail);
if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) if (dmxCheckFunctionKeys(dmxLocal, type, keySym))
return; return;
if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
xE.u.u.detail = dmxFixup(pDev, detail, keySym); xE.u.u.detail = dmxFixup(pDev, detail, keySym);
#if 11/*BP*/
{ events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
DeviceIntPtr p = dmxLocal->pDevice; /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
int i, nevents; nevents = GetKeyboardEvents(events, p, type, detail);
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
nevents = GetKeyboardEvents(events,
/*pDev*/p,
/*KeyPress*/type,
/*n*/detail);
/*
ErrorF("NEW KEY EVENT %d n=%d\n", detail, nevents);
*/
for (i = 0; i < nevents; i++) for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i); mieqEnqueue(p, events + i);
xfree(events); xfree(events);
return; return;
}
#endif
break;
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
#if 00 /*BP*/
detail = dmxGetButtonMapping(dmxLocal, detail); detail = dmxGetButtonMapping(dmxLocal, detail);
#else events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
{ nevents = GetPointerEvents(events, p, type, detail,
DeviceIntPtr p = dmxLocal->pDevice;
int i, nevents, valuators[3];
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
valuators[0] = e->xbutton.x;
valuators[1] = e->xbutton.y;
valuators[2] = e->xbutton.button;
nevents = GetPointerEvents(events,
/*pDev*/p,
/*KeyPress*/type,
detail,
POINTER_ABSOLUTE, POINTER_ABSOLUTE,
0, 0, valuators); 0, /* first_valuator = 0 */
/* 0, /* num_valuators = 0 */
ErrorF("NEW PTR EVENT %d (%d,%d,%d) n=%d\n", valuators);
detail, valuators[0], valuators[1], valuators[2],
nevents);
*/
for (i = 0; i < nevents; i++) for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i); mieqEnqueue(p, events + i);
xfree(events); xfree(events);
return; return;
}
#endif
break;
case MotionNotify: case MotionNotify:
/* All MotionNotify events should be sent via dmxCoreMotion and events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
* dmxExtMotion -- no input driver should build motion events by
* hand. */
#if 00 /*BP*/
dmxLog(dmxError, "dmxEnqueueXEvent: MotionNotify not allowed here\n");
#else
{
DeviceIntPtr p = dmxLocal->pDevice;
int i, nevents, valuators[3];
xEvent *events = Xcalloc(sizeof(xEvent), GetMaximumEventsNum());
valuators[0] = e->xmotion.x; valuators[0] = e->xmotion.x;
valuators[1] = e->xmotion.y; valuators[1] = e->xmotion.y;
valuators[2] = e->xmotion.state; valuators[2] = e->xmotion.state;
nevents = GetPointerEvents(events, nevents = GetPointerEvents(events, p, type, detail,
/*pDev*/p, POINTER_ABSOLUTE, 0, 3, valuators);
/*KeyPress*/type,
detail,
POINTER_ABSOLUTE,
0, 0, valuators);
/*
ErrorF("NEW MOTION %d st %d (%d,%d,%d) n=%d\n",
detail, e->xmotion.state,
valuators[0], valuators[1], valuators[2],
nevents);
*/
for (i = 0; i < nevents; i++) for (i = 0; i < nevents; i++)
mieqEnqueue(p, events + i); mieqEnqueue(p, events + i);
xfree(events); xfree(events);
return; return;
}
#endif
break;
/* Always ignore these events */
case EnterNotify: case EnterNotify:
case LeaveNotify: case LeaveNotify:
case KeymapNotify: case KeymapNotify:
@ -719,12 +738,12 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
* modifier map on the backend/console * modifier map on the backend/console
* input device so that we have complete * input device so that we have complete
* control of the input device LEDs. */ * control of the input device LEDs. */
ErrorF("Enter/Leave/Keymap/Mapping\n");
return; return;
default: default:
#ifdef XINPUT #ifdef XINPUT
if (type == ProximityIn || type == ProximityOut) { if (type == ProximityIn || type == ProximityOut) {
if (dmxLocal->sendsCore) return; /* Not a core event */ if (dmxLocal->sendsCore)
return; /* Not a core event */
break; break;
} }
#endif #endif
@ -740,25 +759,19 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
return; return;
} }
#if 00 /* dead code? */
memset(&xE, 0, sizeof(xE)); memset(&xE, 0, sizeof(xE));
xE.u.u.type = type; xE.u.u.type = type;
xE.u.u.detail = detail; xE.u.u.detail = detail;
xE.u.keyButtonPointer.time = GetTimeInMillis(); xE.u.keyButtonPointer.time = GetTimeInMillis();
#ifdef XINPUT #ifdef XINPUT
if (!dmxLocal->sendsCore) dmxEnqueueExtEvent(dmxLocal, &xE, block); if (!dmxLocal->sendsCore)
dmxEnqueueExtEvent(dmxLocal, &xE, block);
else else
#endif #endif
#if 00 /*BP*/
dmxeqEnqueue(&xE); dmxeqEnqueue(&xE);
#else #endif /*00*/
/* never get here! */
if (0) {
DeviceIntPtr p = dmxLocal->pDevice;
ErrorF("enque %d\n", type);
mieqEnqueue(p, &xE);
}
#endif
} }
/** A pointer to this routine is passed to low-level input drivers so /** A pointer to this routine is passed to low-level input drivers so

View File

@ -472,8 +472,10 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
switch (what) { switch (what) {
case DEVICE_INIT: case DEVICE_INIT:
if (dmxLocal->init) dmxLocal->init(pDev); if (dmxLocal->init)
if (dmxLocal->get_info) dmxLocal->get_info(pDev, &info); dmxLocal->init(pDev);
if (dmxLocal->get_info)
dmxLocal->get_info(pDev, &info);
if (info.keyboard) { /* XKEYBOARD makes this a special case */ if (info.keyboard) { /* XKEYBOARD makes this a special case */
dmxKeyboardOn(pDevice, &info); dmxKeyboardOn(pDevice, &info);
break; break;
@ -585,15 +587,12 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
{ {
int i; int i;
/*
ErrorF("%s\n", __FUNCTION__);
*/
dmxeqProcessInputEvents(); dmxeqProcessInputEvents();
#if 00 /*BP*/ #if 00 /*BP*/
miPointerUpdate(); miPointerUpdate();
#endif #endif
if (dmxInput->detached) return; if (dmxInput->detached)
return;
for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->process_input) { if (dmxInput->devs[i]->process_input) {
#if 11 /*BP*/ #if 11 /*BP*/
@ -632,7 +631,8 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
} }
#endif #endif
if (dmxInput->detached) return; if (dmxInput->detached)
return;
for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->update_info) if (dmxInput->devs[i]->update_info)
dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, dmxInput->devs[i]->update_info(dmxInput->devs[i]->private,
@ -643,7 +643,8 @@ static void dmxCollectAll(DMXInputInfo *dmxInput)
{ {
int i; int i;
if (dmxInput->detached) return; if (dmxInput->detached)
return;
for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->collect_events) if (dmxInput->devs[i]->collect_events)
dmxInput->devs[i]->collect_events(&dmxInput->devs[i] dmxInput->devs[i]->collect_events(&dmxInput->devs[i]
@ -740,7 +741,8 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
char *devname; char *devname;
DMXInputInfo *dmxInput; DMXInputInfo *dmxInput;
if (!dmxLocal) return NULL; if (!dmxLocal)
return NULL;
dmxInput = &dmxInputs[dmxLocal->inputIdx]; dmxInput = &dmxInputs[dmxLocal->inputIdx];
if (dmxLocal->sendsCore) { if (dmxLocal->sendsCore) {

View File

@ -23,14 +23,20 @@ if KDRIVELINUX
LINUX_SUBDIRS = linux LINUX_SUBDIRS = linux
endif endif
SUBDIRS = \ SERVER_SUBDIRS = \
src \
$(LINUX_SUBDIRS) \
$(XSDL_SUBDIRS) \ $(XSDL_SUBDIRS) \
$(FBDEV_SUBDIRS) \ $(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \ $(VESA_SUBDIRS) \
$(XEPHYR_SUBDIRS) \ $(XEPHYR_SUBDIRS) \
$(XFAKE_SUBDIRS) $(XFAKE_SUBDIRS)
SUBDIRS = \
src \
$(LINUX_SUBDIRS) \
$(SERVER_SUBDIRS)
DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \ DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via fbdev sdl ephyr src linux fake sis300 smi via fbdev sdl ephyr src linux fake sis300
relink:
@for i in $(SERVER_SUBDIRS) ; do make -C $$i relink ; done

View File

@ -62,3 +62,6 @@ Xati_LDADD = \
$(ATI_LIBS) \ $(ATI_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -788,7 +788,7 @@ ATIPseudoDMAInit(ScreenPtr pScreen)
atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) &
R200_CSQ_CNT_PRIMARY_MASK; R200_CSQ_CNT_PRIMARY_MASK;
MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN); MMIO_OUT32(mmio, RADEON_REG_ME_CNTL, RADEON_ME_MODE_FREE_RUN);
} if (atic->is_radeon) { } else if (atic->is_radeon) {
MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL, MMIO_OUT32(mmio, RADEON_REG_CP_CSQ_CNTL,
RADEON_CSQ_PRIPIO_INDDIS); RADEON_CSQ_PRIPIO_INDDIS);
atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) & atis->cce_pri_size = MMIO_IN32(mmio, RADEON_REG_CP_CSQ_CNTL) &

View File

@ -24,3 +24,6 @@ Xchips_LDADD = \
$(CHIPS_LIBS) \ $(CHIPS_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -29,3 +29,6 @@ Xephyr_LDADD = \
../../../exa/libexa.la \ ../../../exa/libexa.la \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XEPHYR_LIBS@ @XEPHYR_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -24,3 +24,6 @@ Xepson_LDADD = \
$(EPSON_LIBS) \ $(EPSON_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -20,3 +20,6 @@ Xfake_LDADD = \
libfake.a \ libfake.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -18,4 +18,7 @@ Xfbdev_LDADD = \
libfbdev.a \ libfbdev.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
endif endif

View File

@ -27,3 +27,6 @@ Xi810_LDADD = \
$(I810_LIBS) \ $(I810_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -65,7 +65,7 @@ of the copyright holder.
#include <linux/agpgart.h> #include <linux/agpgart.h>
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/agpio.h> #include <sys/agpio.h>
#endif #endif

View File

@ -31,3 +31,6 @@ Xmach64_LDADD = \
$(MACH64_LIBS) \ $(MACH64_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -26,3 +26,6 @@ Xmga_LDADD = \
$(MGA_LIBS) \ $(MGA_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -38,3 +38,6 @@ Xneomagic_LDADD = \
$(NEOMAGIC_LIBS) \ $(NEOMAGIC_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -27,3 +27,6 @@ Xnvidia_LDADD = \
$(NVIDIA_LIBS) \ $(NVIDIA_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -25,3 +25,6 @@ Xpm2_LDADD = \
$(PM2_LIBS) \ $(PM2_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -24,3 +24,6 @@ Xr128_LDADD = \
$(R128_LIBS) \ $(R128_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -11,3 +11,6 @@ Xsdl_LDADD = @KDRIVE_PURE_LIBS@ \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ \ @XSERVER_LIBS@ \
@XSDL_LIBS@ @XSDL_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -38,3 +38,6 @@ Xsis_LDADD = \
$(SIS_LIBS) \ $(SIS_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
$(TSLIB_FLAG) $(TSLIB_FLAG)
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -29,3 +29,6 @@ Xsmi_LDADD = \
$(SMI_LIBS) \ $(SMI_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

@ -2307,7 +2307,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
} }
int int
NewInputDeviceRequest(InputOption *options) NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
{ {
InputOption *option = NULL; InputOption *option = NULL;
KdPointerInfo *pi = NULL; KdPointerInfo *pi = NULL;
@ -2372,5 +2372,16 @@ NewInputDeviceRequest(InputOption *options)
} }
} }
if (pi) {
*pdev = pi->dixdev;
} else if(ki) {
*pdev = ki->dixdev;
}
return Success; return Success;
} }
void
DeleteInputDeviceRequest(DeviceIntPtr pDev)
{
}

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