Merge branch 'master' into XACE-SELINUX

Conflicts:

	include/miscstruct.h
This commit is contained in:
Eamon Walsh 2007-05-22 14:50:26 -04:00 committed by Eamon Walsh
commit 2a4aa63a23
103 changed files with 2815 additions and 7862 deletions

View File

@ -1019,6 +1019,7 @@ __glXCreateARGBConfig(__GLXscreen *screen)
VisualPtr visual;
int i;
/* search for a 32-bit visual */
visual = NULL;
for (i = 0; i < screen->pScreen->numVisuals; i++)
if (screen->pScreen->visuals[i].nplanes == 32) {
@ -1037,8 +1038,22 @@ __glXCreateARGBConfig(__GLXscreen *screen)
if (modes == NULL)
return;
modes->next = screen->modes;
screen->modes = 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->numUsableVisuals++;
screen->numVisuals++;
@ -1104,6 +1119,9 @@ int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap)
}
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);
reply.numFBConfigs = pGlxScreen->numUsableVisuals;
@ -1661,6 +1679,7 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
xGLXGetDrawableAttributesReply reply;
CARD32 attributes[4];
int numAttribs;
PixmapPtr pixmap;
glxPixmap = (__GLXpixmap *)LookupIDByType(drawId, __glXPixmapRes);
if (!glxPixmap) {
@ -1675,10 +1694,19 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
reply.numAttribs = numAttribs;
attributes[0] = GLX_TEXTURE_TARGET_EXT;
attributes[1] = GLX_TEXTURE_RECTANGLE_EXT;
attributes[2] = GLX_Y_INVERTED_EXT;
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) {
__glXSwapGetDrawableAttributesReply(client, &reply, attributes);
} else {

View File

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

View File

@ -76,6 +76,11 @@ struct __GLXDRIscreen {
xf86EnterVTProc *enterVT;
xf86LeaveVTProc *leaveVT;
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
__GLXpixmap* texOffsetOverride[16];
GLuint lastTexOffsetOverride;
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
};
@ -125,30 +130,75 @@ struct __GLXDRIdrawable {
static const char CREATE_NEW_SCREEN_FUNC[] =
"__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
__glXDRIleaveServer(void)
__glXDRIleaveServer(GLboolean rendering)
{
DRIBlockHandler(NULL, NULL, NULL);
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);
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
__glXDRIenterServer(void)
__glXDRIenterServer(GLboolean rendering)
{
DRIWakeupHandler(NULL, 0, NULL);
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);
}
/**
@ -289,19 +339,6 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
&context->driContext);
}
static int
glxCountBits(int word)
{
int ret = 0;
while (word) {
ret += (word & 1);
word >>= 1;
}
return ret;
}
static void
glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height)
{
@ -335,19 +372,75 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
int buffer,
__GLXpixmap *glxPixmap)
{
RegionPtr pRegion;
RegionPtr pRegion = NULL;
PixmapPtr pixmap;
int bpp;
int w, h, bpp, override = 0;
GLenum target, format, type;
ScreenPtr pScreen = glxPixmap->pScreen;
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
pixmap = (PixmapPtr) glxPixmap->pDraw;
if (!glxPixmap->pDamage) {
glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
TRUE, glxPixmap->pScreen, NULL);
if (!glxPixmap->pDamage)
return BadAlloc;
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 (!override) {
glxPixmap->pDamage = DamageCreate(NULL, NULL, DamageReportNone,
TRUE, pScreen, NULL);
if (!glxPixmap->pDamage)
return BadAlloc;
DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
}
DamageRegister ((DrawablePtr) pixmap, glxPixmap->pDamage);
pRegion = NULL;
} else {
pRegion = DamageRegion(glxPixmap->pDamage);
@ -360,30 +453,22 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
bpp = 4;
format = GL_BGRA;
type =
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
GL_UNSIGNED_BYTE;
#else
GL_UNSIGNED_INT_8_8_8_8_REV;
#if X_BYTE_ORDER == X_BIG_ENDIAN
!override ? GL_UNSIGNED_INT_8_8_8_8_REV :
#endif
GL_UNSIGNED_BYTE;
} else {
bpp = 2;
format = GL_RGB;
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,
pixmap->devKind / bpp) );
if (pRegion == NULL)
{
if (pixmap->drawable.depth == 24)
if (!override && pixmap->drawable.depth == 24)
glxFillAlphaChannel(pixmap,
pixmap->drawable.x,
pixmap->drawable.y,
@ -404,8 +489,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
0,
format,
type,
pixmap->devPrivate.ptr) );
} else {
override ? NULL : pixmap->devPrivate.ptr) );
} else if (!override) {
int i, numRects;
BoxPtr p;
@ -436,7 +521,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
}
}
DamageEmpty(glxPixmap->pDamage);
if (!override)
DamageEmpty(glxPixmap->pDamage);
return Success;
}
@ -446,6 +532,40 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
int buffer,
__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;
}
@ -666,9 +786,9 @@ static GLboolean createContext(__DRInativeDisplay *dpy, int screen,
fakeID = FakeClientID(0);
*(XID *) contextID = fakeID;
__glXDRIenterServer();
__glXDRIenterServer(GL_FALSE);
retval = DRICreateContext(pScreen, visual, fakeID, hw_context);
__glXDRIleaveServer();
__glXDRIleaveServer(GL_FALSE);
return retval;
}
@ -677,9 +797,9 @@ static GLboolean destroyContext(__DRInativeDisplay *dpy, int screen,
{
GLboolean retval;
__glXDRIenterServer();
__glXDRIenterServer(GL_FALSE);
retval = DRIDestroyContext(screenInfo.screens[screen], context);
__glXDRIleaveServer();
__glXDRIleaveServer(GL_FALSE);
return retval;
}
@ -694,12 +814,12 @@ createDrawable(__DRInativeDisplay *dpy, int screen,
if (!pDrawable)
return GL_FALSE;
__glXDRIenterServer();
__glXDRIenterServer(GL_FALSE);
retval = DRICreateDrawable(screenInfo.screens[screen],
drawable,
pDrawable,
hHWDrawable);
__glXDRIleaveServer();
__glXDRIleaveServer(GL_FALSE);
return retval;
}
@ -713,11 +833,11 @@ destroyDrawable(__DRInativeDisplay *dpy, int screen, __DRIid drawable)
if (!pDrawable)
return GL_FALSE;
__glXDRIenterServer();
__glXDRIenterServer(GL_FALSE);
retval = DRIDestroyDrawable(screenInfo.screens[screen],
drawable,
pDrawable);
__glXDRIleaveServer();
__glXDRIleaveServer(GL_FALSE);
return retval;
}
@ -754,14 +874,14 @@ getDrawableInfo(__DRInativeDisplay *dpy, int screen,
return GL_FALSE;
}
__glXDRIenterServer();
__glXDRIenterServer(GL_FALSE);
retval = DRIGetDrawableInfo(screenInfo.screens[screen],
pDrawable, index, stamp,
x, y, width, height,
numClipRects, &pClipRects,
backX, backY,
numBackClipRects, &pBackClipRects);
__glXDRIleaveServer();
__glXDRIleaveServer(GL_FALSE);
if (*numClipRects > 0) {
size = sizeof (drm_clip_rect_t) * *numClipRects;
@ -866,7 +986,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
__DRIframebuffer framebuffer;
int fd = -1;
int status;
int api_ver = COPY_SUB_BUFFER_INTERNAL_VERSION;
int api_ver = 20070121;
drm_magic_t magic;
drmVersionPtr version;
int newlyopened;
@ -1048,6 +1168,9 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
&screen->texOffsetFinish);
__glXScreenInit(&screen->base, pScreen);
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. */
if (!glxBlockClients) {
__glXleaveServer();
__glXleaveServer(GL_FALSE);
cx->destroy(cx);
__glXenterServer();
__glXenterServer(GL_FALSE);
} else {
cx->next = glxPendingDestroyContexts;
glxPendingDestroyContexts = cx;
@ -439,49 +439,49 @@ void glxResumeClients(void)
AttendClient(__glXClients[i]->client);
}
__glXleaveServer();
__glXleaveServer(GL_FALSE);
for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
next = cx->next;
cx->destroy(cx);
}
glxPendingDestroyContexts = NULL;
__glXenterServer();
__glXenterServer(GL_FALSE);
}
static void
__glXnopEnterServer(void)
__glXnopEnterServer(GLboolean rendering)
{
}
static void
__glXnopLeaveServer(void)
__glXnopLeaveServer(GLboolean rendering)
{
}
static void (*__glXenterServerFunc)(void) = __glXnopEnterServer;
static void (*__glXleaveServerFunc)(void) = __glXnopLeaveServer;
static void (*__glXenterServerFunc)(GLboolean) = __glXnopEnterServer;
static void (*__glXleaveServerFunc)(GLboolean) = __glXnopLeaveServer;
void __glXsetEnterLeaveServerFuncs(void (*enter)(void),
void (*leave)(void))
void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
void (*leave)(GLboolean))
{
__glXenterServerFunc = enter;
__glXleaveServerFunc = leave;
}
void __glXenterServer(void)
void __glXenterServer(GLboolean rendering)
{
glxServerLeaveCount--;
if (glxServerLeaveCount == 0)
(*__glXenterServerFunc)();
(*__glXenterServerFunc)(rendering);
}
void __glXleaveServer(void)
void __glXleaveServer(GLboolean rendering)
{
if (glxServerLeaveCount == 0)
(*__glXleaveServerFunc)();
(*__glXleaveServerFunc)(rendering);
glxServerLeaveCount++;
}
@ -546,11 +546,12 @@ static int __glXDispatch(ClientPtr client)
opcode,
client->swapped);
if (proc != NULL) {
__glXleaveServer();
GLboolean rendering = opcode <= X_GLXRenderLarge;
__glXleaveServer(rendering);
retval = (*proc)(cl, (GLbyte *) stuff);
__glXenterServer();
__glXenterServer(rendering);
}
else {
retval = BadRequest;

View File

@ -106,11 +106,11 @@ __glXMesaDrawableSwapBuffers(__GLXdrawable *base)
* why we need to re-take the lock and swap in the server context
* before calling XMesaSwapBuffers() here. /me shakes head. */
__glXenterServer();
__glXenterServer(GL_FALSE);
XMesaSwapBuffers(glxPriv->xm_buf);
__glXleaveServer();
__glXleaveServer(GL_FALSE);
return GL_TRUE;
}
@ -258,12 +258,14 @@ __glXMesaScreenDestroy(__GLXscreen *screen)
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
int i;
for (i = 0; i < mesaScreen->num_vis; i++) {
if (mesaScreen->xm_vis[i])
XMesaDestroyVisual(mesaScreen->xm_vis[i]);
}
if (mesaScreen->xm_vis) {
for (i = 0; i < mesaScreen->num_vis; i++) {
if (mesaScreen->xm_vis[i])
XMesaDestroyVisual(mesaScreen->xm_vis[i]);
}
xfree(mesaScreen->xm_vis);
xfree(mesaScreen->xm_vis);
}
__glXScreenDestroy(screen);

View File

@ -131,10 +131,10 @@ struct __GLXprovider {
void GlxPushProvider(__GLXprovider *provider);
void __glXsetEnterLeaveServerFuncs(void (*enter)(void),
void (*leave)(void));
void __glXenterServer(void);
void __glXleaveServer(void);
void __glXsetEnterLeaveServerFuncs(void (*enter)(GLboolean),
void (*leave)(GLboolean));
void __glXenterServer(GLboolean rendering);
void __glXleaveServer(GLboolean rendering);
void glxSuspendClients(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 void __glXDisp_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 __glXDispSwap_TexParameterf(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 __glXDisp_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 __glXDispSwap_SampleMaskSGIS(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 __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
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 void __glXDisp_Rotatef(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc);
extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
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 __glXDisp_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 __glXDispSwap_GetCompressedTexImageARB(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_TEXTURE_STACK_DEPTH:
case GL_ATTRIB_STACK_DEPTH:
case GL_CLIENT_ATTRIB_STACK_DEPTH:
case GL_ALPHA_TEST:
case GL_ALPHA_TEST_FUNC:
case GL_ALPHA_TEST_REF:
@ -448,6 +449,7 @@ __glGetBooleanv_size(GLenum e)
case GL_MAX_NAME_STACK_DEPTH:
case GL_MAX_PROJECTION_STACK_DEPTH:
case GL_MAX_TEXTURE_STACK_DEPTH:
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
case GL_SUBPIXEL_BITS:
case GL_INDEX_BITS:
case GL_RED_BITS:

View File

@ -1231,8 +1231,8 @@ const struct __glXDispatchInfo Render_dispatch_info = {
};
/*****************************************************************/
/* tree depth = 13 */
static const int_fast16_t VendorPriv_dispatch_tree[155] = {
/* tree depth = 12 */
static const int_fast16_t VendorPriv_dispatch_tree[152] = {
/* [0] -> opcode range [0, 131072], node depth 1 */
2,
5,
@ -1474,17 +1474,12 @@ static const int_fast16_t VendorPriv_dispatch_tree[155] = {
/* [149] -> opcode range [65536, 65568], node depth 12 */
1,
152,
EMPTY_LEAF,
/* [152] -> opcode range [65536, 65552], node depth 13 */
1,
LEAF(88),
EMPTY_LEAF,
};
static const void *VendorPriv_function_table[96][2] = {
static const void *VendorPriv_function_table[104][2] = {
/* [ 0] = 0 */ {NULL, NULL},
/* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT},
/* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT},
@ -1581,6 +1576,14 @@ static const void *VendorPriv_function_table[96][2] = {
/* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
/* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
/* [ 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 = {

View File

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

View File

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

View File

@ -243,6 +243,11 @@ SyncInitServerTime(
void
);
static void
SyncInitIdleTime(
void
);
static void
SyncResetProc(
ExtensionEntry * /* extEntry */
@ -2400,6 +2405,7 @@ SyncExtensionInit(INITARGS)
* because there is always a servertime counter.
*/
SyncInitServerTime();
SyncInitIdleTime();
#ifdef DEBUG
fprintf(stderr, "Sync Extension %d.%d\n",
@ -2520,3 +2526,116 @@ SyncInitServerTime(void)
ServertimeQueryValue, ServertimeBracketValues);
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

@ -280,11 +280,6 @@ configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
if (strcmp(dbus_message_get_interface(message),
"org.x.config.input") == 0) {
if (!dbus_message_iter_init(message, &iter)) {
ErrorF("[config] failed to init iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
}
if (!(reply = dbus_message_new_method_return(message))) {
ErrorF("[config] failed to create the reply message\n");
@ -292,21 +287,36 @@ configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
dbus_message_iter_init_append(reply, &r_iter);
if (strcmp(dbus_message_get_member(message), "add") == 0)
ret = configAddDevice(message, &iter, reply, &r_iter, &error);
else if (strcmp(dbus_message_get_member(message), "remove") == 0)
ret = configRemoveDevice(message, &iter, &error);
else if (strcmp(dbus_message_get_member(message), "listDevices") == 0)
ret = configListDevices(message, &iter, reply, &r_iter, &error);
if (ret != BadDrawable && ret != BadAlloc) {
/* 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)) {
ErrorF("[config] failed to init iterator\n");
dbus_message_unref(reply);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
}
if (strcmp(dbus_message_get_member(message), "add") == 0)
ret = configAddDevice(message, &iter, reply, &r_iter, &error);
else if (strcmp(dbus_message_get_member(message), "remove") == 0)
ret = configRemoveDevice(message, &iter, &error);
}
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");
dbus_message_unref(reply);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
}
if (!dbus_connection_send(bus, reply, NULL))
ErrorF("[config] failed to send reply\n");

View File

@ -15,21 +15,23 @@ org.x.config.input:
Option names beginning with _ are not allowed; they are reserved
for internal use.
Returns one int32, which is an X Status, as defined in X.h. If
everything is successful, Success will be returned. BadMatch will
be returned if the options given do not match any device. BadValue
is returned for a malformed message.
Returns one signed int32, which is the device id of the new device.
If the return value is a negative number, it represents the X
Status, as defined in X.h. BadMatch will be returned if the options
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
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:
Takes one int32 argument, which is the device ID to remove, i.e.:
i
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

@ -182,6 +182,7 @@ AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the `mmap' function.]))
dnl Find the math libary
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])
@ -374,17 +375,12 @@ 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_SHORT="X.Org"
DEFAULT_VERSION_MAJOR=7
DEFAULT_VERSION_MINOR=1
DEFAULT_VERSION_PATCH=99
DEFAULT_VERSION_SNAP=2
DEFAULT_VERSION_MINOR=2
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_SNAP=0
DEFAULT_RELEASE_DATE="21 December 2005"
DEFAULT_VENDOR_WEB="http://wiki.x.org"
@ -444,9 +440,9 @@ AC_ARG_WITH(builder-addr, AS_HELP_STRING([--with-builder-addr=ADDRESS],
[Builder address (default: xorg@lists.freedesktop.org)]),
[ BUILDERADDR="$withval" ],
[ 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="UNKNOWN" ])
[ OSNAME=`uname -srm` ])
AC_ARG_WITH(os-vendor, AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name of OS vendor]),
[ OSVENDOR="$withval" ],
[ OSVENDOR="" ])
@ -628,9 +624,11 @@ XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
PIXMAN="[pixman >= 0.9.0]"
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_LIBS="xfont xau fontenc"
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.2] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc $PIXMAN"
if test "x$DBUS" = xauto; then
PKG_CHECK_MODULES(DBUS, dbus-1, [DBUS=yes], [DBUS=no])
@ -962,6 +960,11 @@ AC_DEFINE_UNQUOTED(XORG_RELEASE, ["$VENDOR_RELEASE_STRING"], [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(BUILDERADDR, ["$BUILDERADDR"], [Builder address])
if test -z "$OSNAME"; then
OSNAME="UNKNOWN"
fi
AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
@ -1000,7 +1003,6 @@ else
fi
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
MI_EXT_LIB='$(top_builddir)/mi/libmiext.la'
MI_INC='-I$(top_srcdir)/mi'
FB_LIB='$(top_builddir)/fb/libfb.la'
@ -1117,7 +1119,7 @@ dnl ---------------------------------------------------------------------------
dnl DMX DDX
AC_MSG_CHECKING([whether to build Xdmx DDX])
PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no])
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
DMX="$have_dmx"
fi

View File

@ -76,6 +76,7 @@ SOFTWARE.
#include "swaprep.h"
#include "dixevents.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
@ -164,6 +165,8 @@ EnableDevice(DeviceIntPtr dev)
{
DeviceIntPtr *prev;
int ret;
DeviceIntRec dummyDev;
devicePresenceNotify ev;
for (prev = &inputInfo.off_devices;
*prev && (*prev != dev);
@ -182,6 +185,14 @@ EnableDevice(DeviceIntPtr dev)
*prev = dev;
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;
}
@ -189,6 +200,8 @@ Bool
DisableDevice(DeviceIntPtr dev)
{
DeviceIntPtr *prev;
DeviceIntRec dummyDev;
devicePresenceNotify ev;
for (prev = &inputInfo.devices;
*prev && (*prev != dev);
@ -201,6 +214,15 @@ DisableDevice(DeviceIntPtr dev)
*prev = dev->next;
dev->next = inputInfo.off_devices;
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;
}
@ -219,8 +241,8 @@ ActivateDevice(DeviceIntPtr dev)
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = 0;
ev.deviceid = 0;
ev.devchange = DeviceAdded;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@ -555,12 +577,16 @@ RemoveDevice(DeviceIntPtr dev)
int ret = BadMatch;
devicePresenceNotify ev;
DeviceIntRec dummyDev;
int deviceid;
DebugF("(dix) removing device %d\n", dev->id);
if (!dev || dev == inputInfo.keyboard || dev == inputInfo.pointer)
return BadImplementation;
deviceid = dev->id;
DisableDevice(dev);
prev = NULL;
for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
next = tmp->next;
@ -595,8 +621,8 @@ RemoveDevice(DeviceIntPtr dev)
inputInfo.numDevices--;
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = 0;
ev.deviceid = 0;
ev.devchange = DeviceRemoved;
ev.deviceid = deviceid;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@ -1249,6 +1275,7 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap,
}
else {
pDev->key->modifierKeyMap = NULL;
pDev->key->maxKeysPerModifier = 0;
}
}
}

View File

@ -255,6 +255,7 @@ main(int argc, char *argv[], char *envp[])
display = "0";
InitGlobals();
InitRegions();
#ifdef XPRINT
PrinterInitGlobals();
#endif

View File

@ -126,7 +126,7 @@ exaGetDrawablePixmap(DrawablePtr pDrawable)
* the backing drawable. These coordinates are nonzero only for redirected
* windows.
*/
static void
void
exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
int *xp, int *yp)
{
@ -172,29 +172,6 @@ exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
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
exaDestroyPixmap (PixmapPtr pPixmap)
{

View File

@ -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.
*
* @param pSrcPixmap source pixmap
@ -721,6 +721,9 @@ exaOffscreenAlloc(ScreenPtr pScreen, int size, int align,
ExaOffscreenArea *
exaOffscreenFree(ScreenPtr pScreen, ExaOffscreenArea *area);
void
ExaOffscreenMarkUsed (PixmapPtr pPixmap);
unsigned long
exaGetPixmapOffset(PixmapPtr pPix);

View File

@ -74,6 +74,7 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
pGC->planemask,
pGC->fgPixel))
{
exaDoMigration (pixmaps, 1, FALSE);
ExaCheckFillSpans (pDrawable, pGC, n, ppt, pwidth, fSorted);
return;
}
@ -109,8 +110,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
(*pExaScr->info->Solid) (pPixmap,
fullX1 + off_x, fullY1 + 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
{
@ -129,8 +128,6 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
(*pExaScr->info->Solid) (pPixmap,
partX1 + off_x, fullY1 + 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++;
@ -154,8 +151,9 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int xoff, yoff;
int src_stride, bpp = pDrawable->bitsPerPixel;
if (pExaScr->swappedOut || pExaScr->info->UploadToScreen == NULL)
goto migrate_and_fallback;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
/* Don't bother with under 8bpp, XYPixmaps. */
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)
goto migrate_and_fallback;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
if (pExaScr->swappedOut)
goto fallback;
exaDoMigration (pixmaps, 1, TRUE);
if (pExaScr->info->UploadToScreen == NULL)
goto fallback;
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
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)),
src_stride / sizeof(FbStip),
(x1 - x) * bpp,
dst + (y1 + yoff) * dst_stride,
(x1 - x) * dstBpp,
dst + (y1 + dstYoff) * dst_stride,
dst_stride,
(x1 + xoff) * bpp,
(x2 - x1) * bpp,
(x1 + dstXoff) * dstBpp,
(x2 - x1) * dstBpp,
y2 - y1,
GXcopy, FB_ALLONES, bpp);
GXcopy, FB_ALLONES, dstBpp);
exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
}
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
}
return;
migrate_and_fallback:
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
exaDoMigration (pixmaps, 1, FALSE);
fallback:
@ -387,6 +387,7 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
int src_off_x, src_off_y;
int dst_off_x, dst_off_y;
ExaMigrationRec pixmaps[2];
Bool fallback = FALSE;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
@ -404,62 +405,64 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
pDstPixmap->drawable.width > pExaScr->info->maxX ||
pDstPixmap->drawable.height > pExaScr->info->maxY)
{
exaDoMigration (pixmaps, 2, FALSE);
goto fallback;
fallback = TRUE;
} else {
exaDoMigration (pixmaps, 2, TRUE);
}
/* 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) {
if (!exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
if (exaCopyNtoNTwoDir(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
dx, dy))
goto fallback;
return;
return;
fallback = TRUE;
}
if ((pSrcPixmap = exaGetOffscreenPixmap (pSrcDrawable, &src_off_x, &src_off_y)) &&
(pDstPixmap = exaGetOffscreenPixmap (pDstDrawable, &dst_off_x, &dst_off_y)) &&
(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap,
reverse ? -1 : 1, upsidedown ? -1 : 1,
pGC ? pGC->alu : GXcopy,
pGC ? pGC->planemask : FB_ALLONES))
pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
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->planemask : FB_ALLONES)) {
fallback = TRUE;
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
exaDrawableLocation(pSrcDrawable),
exaDrawableLocation(pDstDrawable)));
exaDoMigration (pixmaps, 2, FALSE);
exaPrepareAccess (pDstDrawable, EXA_PREPARE_DEST);
exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC);
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
pbox, nbox, dx, dy, reverse, upsidedown,
bitplane, closure);
exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC);
exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
}
while (nbox--)
{
while (nbox--)
{
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++;
}
(*pExaScr->info->DoneCopy) (pDstPixmap);
exaMarkSync(pDstDrawable->pScreen);
return;
}
fallback:
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
exaDrawableLocation(pSrcDrawable),
exaDrawableLocation(pDstDrawable)));
exaPrepareAccess (pDstDrawable, EXA_PREPARE_DEST);
exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC);
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC,
pbox, nbox, dx, dy, reverse, upsidedown,
bitplane, closure);
exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC);
exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
while (nbox--)
{
exaDrawableDirty (pDstDrawable, pbox->x1, pbox->y1, pbox->x2, pbox->y2);
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++;
}
if (fallback)
return;
(*pExaScr->info->DoneCopy) (pDstPixmap);
exaMarkSync (pDstDrawable->pScreen);
}
RegionPtr
@ -618,6 +621,9 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
DEALLOCATE_LOCAL(prect);
}
static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
Pixel pixel, CARD32 planemask, CARD32 alu);
static void
exaPolyFillRect(DrawablePtr pDrawable,
GCPtr pGC,
@ -626,7 +632,7 @@ exaPolyFillRect(DrawablePtr pDrawable,
{
ExaScreenPriv (pDrawable->pScreen);
RegionPtr pClip = fbGetCompositeClip(pGC);
PixmapPtr pPixmap;
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
register BoxPtr pbox;
BoxPtr pextent;
int extentX1, extentX2, extentY1, extentY2;
@ -635,39 +641,80 @@ exaPolyFillRect(DrawablePtr pDrawable,
int xoff, yoff;
int xorg, yorg;
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_src = FALSE;
pixmaps[0].pPix = pPixmap = exaGetDrawablePixmap (pDrawable);
pixmaps[0].pPix = pPixmap;
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
if (pExaScr->swappedOut ||
pGC->fillStyle != FillSolid ||
pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY)
{
exaDoMigration (pixmaps, 1, FALSE);
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);
goto fallback;
}
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,
pGC->alu,
pGC->planemask,
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);
damage:
REGION_TRANSLATE(pScreen, pReg, xoff, yoff);
REGION_UNION(pScreen, pDamageReg, pReg, pDamageReg);
REGION_DESTROY(pScreen, pReg);
return;
}
@ -715,7 +762,8 @@ exaPolyFillRect(DrawablePtr pDrawable,
pbox = REGION_RECTS(pClip);
/*
* 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--)
{
@ -775,20 +823,19 @@ exaSolidBoxClipped (DrawablePtr pDrawable,
pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY)
{
exaDoMigration (pixmaps, 1, FALSE);
goto fallback;
fallback = TRUE;
} else {
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))
{
fallback:
EXA_FALLBACK(("to %p (%c)\n", pDrawable,
exaDrawableLocation(pDrawable)));
exaDoMigration (pixmaps, 1, FALSE);
fallback = TRUE;
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fg = fbReplicatePixel (fg, pDrawable->bitsPerPixel);
@ -827,10 +874,10 @@ fallback:
(*pExaScr->info->Solid) (pPixmap,
partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff);
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff,
partX2 + xoff, partY2 + yoff);
} else
exaDrawableDirty (pDrawable, partX1, partY1, partX2, partY2);
}
exaPixmapDirty (pPixmap, partX1 + xoff, partY1 + yoff, partX2 + xoff,
partY2 + yoff);
}
if (fallback)
@ -870,12 +917,36 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
int dstBpp;
int dstXoff, dstYoff;
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);
if ((pGC->planemask & depthMask) != depthMask)
{
exaDoMigration(pixmaps, 1, FALSE);
ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
return;
goto damage;
}
glyph = NULL;
switch (pDrawable->bitsPerPixel) {
@ -887,6 +958,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
x += pDrawable->x;
y += pDrawable->y;
xBack += pDrawable->x;
yBack += pDrawable->y;
if (TERMINALFONT (pGC->font) && !glyph)
{
@ -894,23 +967,6 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
}
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,
fbGetCompositeClip(pGC),
pGC->planemask,
@ -923,74 +979,50 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
}
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
exaDoMigration(pixmaps, 1, FALSE);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC);
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
ppci = ppciInit;
while (nglyph--)
for (ppci = ppciInit; nglyph; nglyph--, x += pci->metrics.characterWidth)
{
pci = *ppci++;
pglyph = FONTGLYPHBITS(pglyphBase, pci);
gWidth = GLYPHWIDTHPIXELS(pci);
gHeight = GLYPHHEIGHTPIXELS(pci);
if (gWidth && gHeight)
gx = x + pci->metrics.leftSideBearing;
gy = y - pci->metrics.ascent;
if (!gWidth || !gHeight || (gx + gWidth) <= xBack ||
(gy + gHeight) <= yBack || gx >= (xBack + widthBack) ||
gy >= (yBack + heightBack))
continue;
pglyph = FONTGLYPHBITS(pglyphBase, pci);
if (glyph && gWidth <= sizeof (FbStip) * 8 &&
fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
{
gx = x + pci->metrics.leftSideBearing;
gy = y - pci->metrics.ascent;
if (glyph && gWidth <= sizeof (FbStip) * 8 &&
fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
{
(*glyph) (dst + (gy + dstYoff) * dstStride,
dstStride,
dstBpp,
(FbStip *) pglyph,
pPriv->fg,
gx + dstXoff,
gHeight);
exaDrawableDirty (pDrawable, gx, gy, gx + gWidth, gy + gHeight);
}
else
{
RegionPtr pClip = fbGetCompositeClip(pGC);
int nbox;
BoxPtr pbox;
gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
fbPutXYImage (pDrawable,
pClip,
pPriv->fg,
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);
}
}
(*glyph) (dst + (gy + dstYoff) * dstStride, dstStride, dstBpp,
(FbStip *) pglyph, pPriv->fg, gx + dstXoff, gHeight);
}
else
{
RegionPtr pClip = fbGetCompositeClip(pGC);
gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip);
fbPutXYImage (pDrawable, pClip, pPriv->fg, pPriv->bg, pPriv->pm,
GXcopy, opaque, gx, gy, gWidth, gHeight,
(FbStip *) pglyph, gStride, 0);
}
x += pci->metrics.characterWidth;
}
exaFinishAccessGC (pGC);
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 = {
@ -1043,10 +1075,12 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
REGION_UNINIT(pWin->drawable.pScreen, &rgnDst);
}
static void
static Bool
exaFillRegionSolid (DrawablePtr pDrawable,
RegionPtr pRegion,
Pixel pixel)
Pixel pixel,
CARD32 planemask,
CARD32 alu)
{
ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap;
@ -1062,22 +1096,19 @@ exaFillRegionSolid (DrawablePtr pDrawable,
if (pPixmap->drawable.width > pExaScr->info->maxX ||
pPixmap->drawable.height > pExaScr->info->maxY)
{
exaDoMigration (pixmaps, 1, FALSE);
goto fallback;
} else {
exaDoMigration (pixmaps, 1, TRUE);
}
if ((pPixmap = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff)) &&
(*pExaScr->info->PrepareSolid) (pPixmap, GXcopy, FB_ALLONES, pixel))
(*pExaScr->info->PrepareSolid) (pPixmap, alu, planemask, pixel))
{
while (nbox--)
{
(*pExaScr->info->Solid) (pPixmap,
pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++;
}
(*pExaScr->info->DoneSolid) (pPixmap);
@ -1086,27 +1117,30 @@ exaFillRegionSolid (DrawablePtr pDrawable,
else
{
fallback:
if (alu != GXcopy || planemask != FB_ALLONES)
return FALSE;
EXA_FALLBACK(("to %p (%c)\n", pDrawable,
exaDrawableLocation(pDrawable)));
exaDoMigration (pixmaps, 1, FALSE);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fbFillRegionSolid (pDrawable, pRegion, 0,
fbReplicatePixel (pixel, pDrawable->bitsPerPixel));
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.
* Based on fbFillRegionTiled(), fbTile().
*/
static void
Bool
exaFillRegionTiled (DrawablePtr pDrawable,
RegionPtr pRegion,
PixmapPtr pTile)
PixmapPtr pTile,
DDXPointPtr pPatOrg,
CARD32 planemask,
CARD32 alu)
{
ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap;
@ -1122,10 +1156,10 @@ exaFillRegionTiled (DrawablePtr pDrawable,
/* If we're filling with a solid color, grab it out and go to
* FillRegionSolid, saving numerous copies.
*/
if (tileWidth == 1 && tileHeight == 1) {
exaFillRegionSolid(pDrawable, pRegion, exaGetPixmapFirstPixel (pTile));
return;
}
if (tileWidth == 1 && tileHeight == 1)
return exaFillRegionSolid(pDrawable, pRegion,
exaGetPixmapFirstPixel (pTile), planemask,
alu);
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
@ -1139,7 +1173,6 @@ exaFillRegionTiled (DrawablePtr pDrawable,
tileWidth > pExaScr->info->maxX ||
tileHeight > pExaScr->info->maxY)
{
exaDoMigration (pixmaps, 2, FALSE);
goto fallback;
} else {
exaDoMigration (pixmaps, 2, TRUE);
@ -1153,8 +1186,9 @@ exaFillRegionTiled (DrawablePtr pDrawable,
if (!exaPixmapIsOffscreen(pTile))
goto fallback;
if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile, &tileXoff, &tileYoff), pPixmap, 0, 0, GXcopy,
FB_ALLONES))
if ((*pExaScr->info->PrepareCopy) (exaGetOffscreenPixmap((DrawablePtr)pTile,
&tileXoff, &tileYoff),
pPixmap, 0, 0, alu, planemask))
{
while (nbox--)
{
@ -1162,7 +1196,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
int dstY = pBox->y1;
int tileY;
tileY = (dstY - pDrawable->y) % tileHeight;
tileY = (dstY - pDrawable->y - pPatOrg->y) % tileHeight;
while (height > 0) {
int width = pBox->x2 - pBox->x1;
int dstX = pBox->x1;
@ -1173,7 +1207,7 @@ exaFillRegionTiled (DrawablePtr pDrawable,
h = height;
height -= h;
tileX = (dstX - pDrawable->x) % tileWidth;
tileX = (dstX - pDrawable->x - pPatOrg->x) % tileWidth;
while (width > 0) {
int w = tileWidth - tileX;
if (w > width)
@ -1190,38 +1224,44 @@ exaFillRegionTiled (DrawablePtr pDrawable,
dstY += h;
tileY = 0;
}
exaPixmapDirty (pPixmap, pBox->x1 + xoff, pBox->y1 + yoff,
pBox->x2 + xoff, pBox->y2 + yoff);
pBox++;
}
(*pExaScr->info->DoneCopy) (pPixmap);
exaMarkSync(pDrawable->pScreen);
return;
return TRUE;
}
fallback:
if (alu != GXcopy || planemask != FB_ALLONES)
return FALSE;
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pTile, pDrawable,
exaDrawableLocation(&pTile->drawable),
exaDrawableLocation(pDrawable)));
exaDoMigration (pixmaps, 2, FALSE);
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
fbFillRegionTiled (pDrawable, pRegion, pTile);
exaFinishAccess ((DrawablePtr)pTile, EXA_PREPARE_SRC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
while (nbox--)
{
exaDrawableDirty (pDrawable, pBox->x1, pBox->y1, pBox->x2, pBox->y2);
pBox++;
}
return TRUE;
}
void
exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
{
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;
if (!pExaScr->swappedOut) {
DDXPointRec zeros = { 0, 0 };
switch (what) {
case PW_BACKGROUND:
switch (pWin->backgroundState) {
@ -1235,25 +1275,41 @@ exaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what)
what);
return;
case BackgroundPixel:
exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel);
return;
exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel,
FB_ALLONES, GXcopy);
goto damage;
case BackgroundPixmap:
exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->background.pixmap);
return;
exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->background.pixmap,
&zeros, FB_ALLONES, GXcopy);
goto damage;
}
break;
case PW_BORDER:
if (pWin->borderIsPixel) {
exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel);
return;
exaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel,
FB_ALLONES, GXcopy);
goto damage;
} else {
exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->border.pixmap);
return;
exaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->border.pixmap,
&zeros, FB_ALLONES, GXcopy);
goto damage;
}
break;
}
}
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;
Bool ok;
if (pExaScr->swappedOut || pExaScr->info->DownloadFromScreen == NULL)
goto fallback;
if (pExaScr->info->DownloadFromScreen == NULL)
goto migrate_and_fallback;
/* Only cover the ZPixmap, solid copy case. */
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
* about <8bpp.
*/
if (pDrawable->bitsPerPixel < 8)
goto migrate_and_fallback;
if (pExaScr->swappedOut)
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);
if (pPix == NULL)
goto fallback;
@ -1308,12 +1359,12 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
return;
}
fallback:
migrate_and_fallback:
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
exaDoMigration (pixmaps, 1, FALSE);
fallback:
ExaCheckGetImage (pDrawable, x, y, w, h, format, planeMask, d);
}

View File

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

View File

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

View File

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

View File

@ -297,15 +297,15 @@ exaTryDriverSolidFill(PicturePtr pSrc,
nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region);
while (nbox--)
{
(*pExaScr->info->Solid) (pDstPix,
pbox->x1 + dst_off_x, pbox->y1 + 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++;
}
(*pExaScr->info->DoneSolid) (pDstPix);
exaMarkSync(pDst->pDrawable->pScreen);
@ -446,8 +446,6 @@ exaTryDriverComposite(CARD8 op,
pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1,
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++;
}
(*pExaScr->info->DoneComposite) (pDstPix);
@ -521,6 +519,9 @@ exaTryMagicTwoPassCompositeHelper(CARD8 op,
CARD16 height)
{
ExaScreenPriv (pDst->pDrawable->pScreen);
DrawablePtr pDstDraw = pDst->pDrawable;
PixmapPtr pDstPixmap = exaGetDrawablePixmap(pDstDraw);
int xoff, yoff;
assert(op == PictOpOver);
@ -539,6 +540,12 @@ exaTryMagicTwoPassCompositeHelper(CARD8 op,
exaComposite(PictOpOutReverse, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
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).
*/
exaComposite(PictOpAdd, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
@ -565,6 +572,28 @@ exaComposite(CARD8 op,
int ret = -1;
Bool saveSrcRepeat = pSrc->repeat;
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
* with a NULL pDrawable.
@ -583,19 +612,24 @@ exaComposite(CARD8 op,
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 &&
pSrc->pDrawable->height == 1 && pSrc->repeat &&
pSrc->repeatType == RepeatNormal)
pSrc->pDrawable->height == 1 &&
pSrc->repeat)
{
ret = exaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
width, height);
if (ret == 1)
goto done;
}
else if (!pSrc->repeat && !pSrc->transform &&
pSrc->format == pDst->format)
else if (pSrcPixmap && !pSrc->repeat && !pSrc->transform)
{
RegionRec region;
@ -617,6 +651,45 @@ exaComposite(CARD8 op,
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
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;
if (pExaScr->info->PrepareComposite &&
(!pSrc->repeat || pSrc->repeat == RepeatNormal) &&
(!pMask || !pMask->repeat || pMask->repeat == RepeatNormal) &&
(!pSrc->repeat || pSrc->repeatType == RepeatNormal) &&
(!pMask || !pMask->repeat || pMask->repeatType == RepeatNormal) &&
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
{
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:
#if DEBUG_TRACE_FALL
exaPrintCompositeFallback (op, pSrc, pMask, pDst);
#endif
exaDoMigration(pixmaps, npixmaps, FALSE);
ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
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:
pSrc->repeat = saveSrcRepeat;
@ -716,6 +764,7 @@ exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
{
DrawablePtr pDraw = pPicture->pDrawable;
ExaMigrationRec pixmaps[1];
int xoff, yoff;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE;
@ -724,8 +773,10 @@ exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
exaPrepareAccess(pDraw, EXA_PREPARE_DEST);
fbRasterizeTrapezoid(pPicture, trap, x_off, y_off);
exaDrawableDirty(pDraw, pDraw->x, pDraw->y,
pDraw->x + pDraw->width, pDraw->y + pDraw->height);
exaGetDrawableDeltas(pDraw, pixmaps[0].pPix, &xoff, &yoff);
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);
}
@ -739,6 +790,7 @@ exaAddTriangles (PicturePtr pPicture, INT16 x_off, INT16 y_off, int ntri,
{
DrawablePtr pDraw = pPicture->pDrawable;
ExaMigrationRec pixmaps[1];
int xoff, yoff;
pixmaps[0].as_dst = 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);
fbAddTriangles(pPicture, x_off, y_off, ntri, tris);
exaDrawableDirty(pDraw, pDraw->x, pDraw->y,
pDraw->x + pDraw->width, pDraw->y + pDraw->height);
exaGetDrawableDeltas(pDraw, pixmaps[0].pPix, &xoff, &yoff);
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);
}
@ -845,10 +899,11 @@ exaGlyphs (CARD8 op,
PixmapPtr pPixmap = NULL;
PicturePtr pPicture;
PixmapPtr pMaskPixmap = NULL;
PixmapPtr pDstPixmap = exaGetDrawablePixmap(pDst->pDrawable);
PicturePtr pMask;
ScreenPtr pScreen = pDst->pDrawable->pScreen;
int width = 0, height = 0;
int x, y;
int x, y, x1, y1, xoff, yoff;
int xDst = list->xOff, yDst = list->yOff;
int n;
int error;
@ -892,7 +947,12 @@ exaGlyphs (CARD8 op,
xRectangle rect;
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)
return;
width = extents.x2 - extents.x1;
@ -918,6 +978,7 @@ exaGlyphs (CARD8 op,
rect.width = width;
rect.height = height;
(*pGC->ops->PolyFillRect) (&pMaskPixmap->drawable, pGC, 1, &rect);
exaPixmapDirty(pMaskPixmap, 0, 0, width, height);
FreeScratchGC (pGC);
x = -extents.x1;
y = -extents.y1;
@ -929,6 +990,8 @@ exaGlyphs (CARD8 op,
y = 0;
}
exaGetDrawableDeltas(pDst->pDrawable, pDstPixmap, &xoff, &yoff);
while (nlist--)
{
GCPtr pGC = NULL;
@ -983,13 +1046,21 @@ exaGlyphs (CARD8 op,
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPixmap;
exaDoMigration (pixmaps, 1, TRUE);
exaDoMigration (pixmaps, 1, pExaScr->info->PrepareComposite != NULL);
while (n--)
{
GlyphPtr glyph = *glyphs++;
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,
glyph->info.width,
glyph->info.height,
@ -1048,17 +1119,22 @@ exaGlyphs (CARD8 op,
if (maskFormat)
{
exaComposite (PictOpAdd, pPicture, NULL, pMask, 0, 0, 0, 0,
x - glyph->info.x, y - glyph->info.y,
glyph->info.width, glyph->info.height);
x1, y1, glyph->info.width, glyph->info.height);
exaPixmapDirty(pMaskPixmap, x1, y1, x1 + glyph->info.width,
y1 + glyph->info.height);
}
else
{
exaComposite (op, pSrc, pPicture, pDst,
xSrc + (x - glyph->info.x) - xDst,
ySrc + (y - glyph->info.y) - yDst,
0, 0, x - glyph->info.x, y - glyph->info.y,
glyph->info.width, glyph->info.height);
xSrc + x1 - xDst, ySrc + y1 - yDst,
0, 0, x1, y1, 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;
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,
char *bits)
{
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
int xoff, yoff;
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
exaGetDrawableDeltas(pDrawable, pPixmap, &xoff, &yoff);
exaPixmapDirty(pPixmap, x + xoff, y + yoff, x + xoff + w, y + yoff + h);
}
RegionPtr
@ -201,32 +206,11 @@ ExaCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
{
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);
exaPrepareAccessGC (pGC);
fbPolyFillRect (pDrawable, pGC, nrect, prect);
exaFinishAccessGC (pGC);
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);
}
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
exaPrepareAccessGC (pGC);
fbPolyFillRect (pDrawable, pGC, nrect, prect);
exaFinishAccessGC (pGC);
exaFinishAccess (pDrawable, EXA_PREPARE_DEST);
}
void

View File

@ -42,7 +42,6 @@ libfb_la_SOURCES = \
fbblt.c \
fbbltone.c \
fbbstore.c \
fbcompose.c \
fbcopy.c \
fbfill.c \
fbfillrect.c \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,32 @@ void fbCompositeSrc_8888x8888mmx (CARD8 op,
INT16 yDst,
CARD16 width,
CARD16 height);
void
fbCompositeSolidMaskSrc_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
fbCompositeSrc_x888x8x8888mmx (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,
@ -106,6 +132,42 @@ void fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
INT16 yDst,
CARD16 width,
CARD16 height);
void fbCompositeIn_nx8x8mmx (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 fbCompositeIn_8x8mmx (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_8888x8x8mmx (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,

File diff suppressed because it is too large Load Diff

View File

@ -121,7 +121,15 @@ fbCanGetSolid(PicturePtr pict)
break; \
case 16: \
(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; \
default: \
return; \
@ -153,7 +161,7 @@ fbCanGetSolid(PicturePtr pict)
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
(((s) >> 5) & 0x07e0) | \
(((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) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
@ -375,6 +383,9 @@ typedef struct _FbComposeData {
CARD16 height;
} FbComposeData;
void
fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer);
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 (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width);
@ -414,197 +425,6 @@ fbRasterizeEdges (FbBits *buf,
xFixed b);
/* 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
fbComposite (CARD8 op,
PicturePtr pSrc,
@ -619,6 +439,36 @@ fbComposite (CARD8 op,
CARD16 width,
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 */
void

View File

@ -117,6 +117,9 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
RenderEdge l, r;
xFixed t, b;
if (!xTrapezoidValid (trap))
return;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
width = pPicture->pDrawable->width;

View File

@ -66,7 +66,7 @@
((year-2000) * 10000) + \
((month) * 100) + \
((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"
/* Enable the DMX extension */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,3 +23,6 @@ Xvesa_LDADD = \
libvesa.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View File

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

View File

@ -254,6 +254,7 @@ xf86ModulelistFromConfig(pointer **optlist)
char *ignore[] = { "GLcore", "speedo", "bitmap", "drm", NULL };
pointer *optarray;
XF86LoadPtr modp;
Bool found;
/*
* make sure the config file has been parsed and that we have a
@ -266,35 +267,76 @@ xf86ModulelistFromConfig(pointer **optlist)
}
if (xf86configptr->conf_modules) {
/*
* Walk the list of modules in the "Module" section to determine how
* many we have.
*/
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
for (i = 0; ignore[i]; i++) {
if (strcmp(modp->load_name, ignore[i]) == 0)
modp->ignore = 1;
/* Walk the disable list and let people know what we've parsed to
* not be loaded
*/
modp = xf86configptr->conf_modules->mod_disable_lst;
while (modp) {
xf86Msg(X_WARNING, "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n", modp->load_name);
modp = (XF86LoadPtr) modp->list.next;
}
/*
* Walk the default settings table. For each module listed to be
* loaded, make sure it's in the mod_load_lst. If it's not, make
* sure it's not in the mod_no_load_lst. If it's not disabled,
* append it to mod_load_lst
*/
for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
if (ModuleDefaults[i].toLoad == FALSE) {
xf86Msg(X_WARNING, "\"%s\" is not to be loaded by default. Skipping.\n", ModuleDefaults[i].name);
continue;
}
if (!modp->ignore)
count++;
modp = (XF86LoadPtr) modp->list.next;
}
found = FALSE;
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
xf86Msg(X_INFO, "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n", ModuleDefaults[i].name);
found = TRUE;
break;
}
modp = (XF86LoadPtr) modp->list.next;
}
if (found == FALSE) {
modp = xf86configptr->conf_modules->mod_disable_lst;
while (modp) {
if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
xf86Msg(X_INFO, "\"%s\" will be loaded even though the default is to disable it.\n", ModuleDefaults[i].name);
found = TRUE;
break;
}
modp = (XF86LoadPtr) modp->list.next;
}
}
if (found == FALSE) {
XF86ConfModulePtr ptr = xf86configptr->conf_modules;
ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
}
}
} else {
xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
if (ModuleDefaults[i].toLoad == TRUE) {
XF86ConfModulePtr ptr = xf86configptr->conf_modules;
ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
}
}
}
if (count == 0) {
XF86ConfModulePtr ptr = xf86configptr->conf_modules;
ptr = xf86addNewLoadDirective(ptr, "extmod", XF86_LOAD_MODULE, NULL);
ptr = xf86addNewLoadDirective(ptr, "dbe", XF86_LOAD_MODULE, NULL);
ptr = xf86addNewLoadDirective(ptr, "glx", XF86_LOAD_MODULE, NULL);
ptr = xf86addNewLoadDirective(ptr, "freetype", XF86_LOAD_MODULE, NULL);
ptr = xf86addNewLoadDirective(ptr, "type1", XF86_LOAD_MODULE, NULL);
ptr = xf86addNewLoadDirective(ptr, "record", XF86_LOAD_MODULE, NULL);
ptr = xf86addNewLoadDirective(ptr, "dri", XF86_LOAD_MODULE, NULL);
count = 7;
}
/*
* Walk the list of modules in the "Module" section to determine how
* many we have.
*/
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
for (i = 0; ignore[i]; i++) {
if (strcmp(modp->load_name, ignore[i]) == 0)
modp->ignore = 1;
}
if (!modp->ignore)
count++;
modp = (XF86LoadPtr) modp->list.next;
}
/*
* allocate the memory and walk the list again to fill in the pointers
@ -303,22 +345,22 @@ xf86ModulelistFromConfig(pointer **optlist)
optarray = xnfalloc((count + 1) * sizeof(pointer));
count = 0;
if (xf86configptr->conf_modules) {
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
modp = xf86configptr->conf_modules->mod_load_lst;
while (modp) {
if (!modp->ignore) {
modulearray[count] = modp->load_name;
optarray[count] = modp->load_opt;
count++;
modulearray[count] = modp->load_name;
optarray[count] = modp->load_opt;
count++;
}
modp = (XF86LoadPtr) modp->list.next;
}
modp = (XF86LoadPtr) modp->list.next;
}
}
modulearray[count] = NULL;
optarray[count] = NULL;
if (optlist)
*optlist = optarray;
*optlist = optarray;
else
xfree(optarray);
xfree(optarray);
return modulearray;
}
@ -565,16 +607,24 @@ configFiles(XF86ConfFilesPtr fileconf)
char *log_buf;
/* FontPath */
/* Try XF86Config FontPath first */
if (!xf86fpFlag) {
if (fileconf) {
if (fileconf->file_fontpath) {
char *f = xf86ValidateFontPath(fileconf->file_fontpath);
pathFrom = X_CONFIG;
if (*f)
defaultFontPath = f;
else {
if (*f) {
if (xf86Info.useDefaultFontPath) {
xf86Msg(X_WARNING, "Including the default font path %s.\n", defaultFontPath);
char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
strcpy(g, f);
strcat(g, ",");
defaultFontPath = strcat(g, defaultFontPath);
xfree(f);
} else {
defaultFontPath = f;
}
} else {
xf86Msg(X_WARNING,
"FontPath is completely invalid. Using compiled-in default.\n");
fontPath = NULL;
@ -742,6 +792,7 @@ typedef enum {
FLAG_AIGLX,
FLAG_IGNORE_ABI,
FLAG_ALLOW_EMPTY_INPUT,
FLAG_USE_DEFAULT_FONT_PATH
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@ -817,6 +868,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
{0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@ -1016,6 +1069,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
xf86Info.allowEmptyInput = TRUE;
xf86Info.useDefaultFontPath = TRUE;
xf86Info.useDefaultFontPathFrom = X_DEFAULT;
if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) {
xf86Info.useDefaultFontPath = value;
xf86Info.useDefaultFontPathFrom = X_CONFIG;
}
/* Make sure that timers don't overflow CARD32's after multiplying */
#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
@ -1749,7 +1809,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
indp = xnfalloc(sizeof(IDevRec));
indp->identifier = NULL;
servlayoutp->inputs = indp;
if (!xf86Info.allowEmptyInput && checkCoreInputDevices(servlayoutp, TRUE))
if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
return TRUE;
@ -2451,9 +2511,9 @@ xf86HandleConfigFile(Bool autoconfig)
/* Now process everything else */
if (!configFiles(xf86configptr->conf_files) ||
!configServerFlags(xf86configptr->conf_flags,
if (!configServerFlags(xf86configptr->conf_flags,
xf86ConfigLayout.options) ||
!configFiles(xf86configptr->conf_files) ||
!configExtensions(xf86configptr->conf_extensions)
#ifdef XF86DRI
|| !configDRI(xf86configptr->conf_dri)

View File

@ -33,6 +33,8 @@
#ifndef _xf86_config_h
#define _xf86_config_h
#include "xf86Optrec.h"
#ifdef HAVE_PARSER_DECLS
/*
* global structure that holds the result of parsing the config file
@ -46,6 +48,23 @@ typedef enum _ConfigStatus {
CONFIG_NOFILE
} ConfigStatus;
typedef struct _ModuleDefault {
char *name;
Bool toLoad;
XF86OptionPtr load_opt;
} ModuleDefault;
static ModuleDefault ModuleDefaults[] = {
{.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
{.name = "type1", .toLoad = TRUE, .load_opt=NULL},
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
/*
* prototypes
*/

View File

@ -120,6 +120,8 @@ typedef struct {
MessageType randRFrom;
Bool aiglx;
MessageType aiglxFrom;
Bool useDefaultFontPath;
MessageType useDefaultFontPathFrom;
Bool ignoreABI;
struct {
Bool disabled; /* enable/disable deactivating

View File

@ -764,4 +764,48 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
}
}
/**
* Deactivate a device. Call this function from the driver if you receive a
* read error or something else that spoils your day.
* Device will be moved to the off_devices list, but it will still be there
* until you really clean up after it.
* Notifies the client about an inactive device.
*
* @param panic True if device is unrecoverable and needs to be removed.
*/
_X_EXPORT void
xf86DisableDevice(DeviceIntPtr dev, Bool panic)
{
devicePresenceNotify ev;
DeviceIntRec dummyDev;
if(!panic)
{
DisableDevice(dev);
} else
{
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceUnrecoverable;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
DeleteInputDeviceRequest(dev);
}
}
/**
* Reactivate a device. Call this function from the driver if you just found
* out that the read error wasn't quite that bad after all.
* Device will be re-activated, and an event sent to the client.
*/
_X_EXPORT void
xf86EnableDevice(DeviceIntPtr dev)
{
EnableDevice(dev);
}
/* end of xf86Xinput.c */

View File

@ -187,6 +187,8 @@ void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
void xf86AddEnabledDevice(InputInfoPtr pInfo);
void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
void xf86EnableDevice(DeviceIntPtr dev);
/* xf86Helper.c */
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
@ -204,6 +206,7 @@ int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts);
/* Legacy hatred */
#define SendCoreEvents 59
#define DontSendCoreEvents 60

View File

@ -1,361 +0,0 @@
/*
* Copyright 2006 Luc Verhaegen.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, 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
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86.h"
#include "xf86DDC.h"
#include <X11/Xatom.h>
#include "property.h"
#include "propertyst.h"
#include "xf86DDC.h"
/*
* TODO:
* - for those with access to the VESA DMT standard; review please.
*/
#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
DisplayModeRec DDCEstablishedModes[17] = {
{ MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
{ MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
{ MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
{ MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
{ MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
{ MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
{ MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
{ MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
{ MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
{ MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
{ MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
{ MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
{ MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
{ MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
{ MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
{ MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
{ MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
};
static DisplayModePtr
DDCModesFromEstablished(int scrnIndex, struct established_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
CARD32 bits = (timing->t1) | (timing->t2 << 8) |
((timing->t_manu & 0x80) << 9);
int i;
for (i = 0; i < 17; i++) {
if (bits & (0x01 << i)) {
Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
Modes = xf86ModesAdd(Modes, Mode);
}
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
{
DisplayModePtr Modes = NULL, Mode = NULL;
int i;
for (i = 0; i < STD_TIMINGS; i++) {
if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
timing[i].refresh, FALSE, FALSE);
Mode->type = M_T_DRIVER;
Modes = xf86ModesAdd(Modes, Mode);
}
}
return Modes;
}
/*
*
*/
static DisplayModePtr
DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
int preferred)
{
DisplayModePtr Mode;
/*
* Refuse to create modes that are insufficiently large. 64 is a random
* number, maybe the spec says something about what the minimum is. In
* particular I see this frequently with _old_ EDID, 1.0 or so, so maybe
* our parser is just being too aggresive there.
*/
if (timing->h_active < 64 || timing->v_active < 64) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: Ignoring tiny %dx%d mode\n", __func__,
timing->h_active, timing->v_active);
return NULL;
}
/* We don't do stereo */
if (timing->stereo) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: Ignoring: We don't handle stereo.\n", __func__);
return NULL;
}
/* We only do seperate sync currently */
if (timing->sync != 0x03) {
xf86DrvMsg(scrnIndex, X_INFO,
"%s: %dx%d Warning: We only handle seperate"
" sync.\n", __func__, timing->h_active, timing->v_active);
}
Mode = xnfalloc(sizeof(DisplayModeRec));
memset(Mode, 0, sizeof(DisplayModeRec));
Mode->type = M_T_DRIVER;
if (preferred)
Mode->type |= M_T_PREFERRED;
Mode->Clock = timing->clock / 1000.0;
Mode->HDisplay = timing->h_active;
Mode->HSyncStart = timing->h_active + timing->h_sync_off;
Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
Mode->HTotal = timing->h_active + timing->h_blanking;
Mode->VDisplay = timing->v_active;
Mode->VSyncStart = timing->v_active + timing->v_sync_off;
Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
Mode->VTotal = timing->v_active + timing->v_blanking;
xf86SetModeDefaultName(Mode);
/* We ignore h/v_size and h/v_border for now. */
if (timing->interlaced)
Mode->Flags |= V_INTERLACE;
if (timing->misc & 0x02)
Mode->Flags |= V_PHSYNC;
else
Mode->Flags |= V_NHSYNC;
if (timing->misc & 0x01)
Mode->Flags |= V_PVSYNC;
else
Mode->Flags |= V_NVSYNC;
return Mode;
}
/*
*
*/
static void
DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
{
DisplayModePtr Mode = Modes;
if (!Monitor || !Modes)
return;
/* set up the ranges for scanning through the modes */
Monitor->nHsync = 1;
Monitor->hsync[0].lo = 1024.0;
Monitor->hsync[0].hi = 0.0;
Monitor->nVrefresh = 1;
Monitor->vrefresh[0].lo = 1024.0;
Monitor->vrefresh[0].hi = 0.0;
while (Mode) {
if (!Mode->HSync)
Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
if (!Mode->VRefresh)
Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
((float) (Mode->HTotal * Mode->VTotal));
if (Mode->HSync < Monitor->hsync[0].lo)
Monitor->hsync[0].lo = Mode->HSync;
if (Mode->HSync > Monitor->hsync[0].hi)
Monitor->hsync[0].hi = Mode->HSync;
if (Mode->VRefresh < Monitor->vrefresh[0].lo)
Monitor->vrefresh[0].lo = Mode->VRefresh;
if (Mode->VRefresh > Monitor->vrefresh[0].hi)
Monitor->vrefresh[0].hi = Mode->VRefresh;
Mode = Mode->next;
}
}
DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
int preferred, i;
DisplayModePtr Modes = NULL, Mode;
preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
/* Add established timings */
Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1);
Modes = xf86ModesAdd(Modes, Mode);
/* Add standard timings */
Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
Modes = xf86ModesAdd(Modes, Mode);
for (i = 0; i < DET_TIMINGS; i++) {
struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
switch (det_mon->type) {
case DT:
Mode = DDCModeFromDetailedTiming(scrnIndex,
&det_mon->section.d_timings,
preferred);
preferred = 0;
Modes = xf86ModesAdd(Modes, Mode);
break;
case DS_STD_TIMINGS:
Mode = DDCModesFromStandardTiming(scrnIndex,
det_mon->section.std_t);
Modes = xf86ModesAdd(Modes, Mode);
break;
default:
break;
}
}
return Modes;
}
/*
* Fill out MonPtr with xf86MonPtr information.
*/
void
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
{
DisplayModePtr Modes = NULL, Mode;
int i, clock;
Bool have_hsync = FALSE, have_vrefresh = FALSE;
if (!Monitor || !DDC)
return;
Monitor->DDC = DDC;
Monitor->widthmm = 10 * DDC->features.hsize;
Monitor->heightmm = 10 * DDC->features.vsize;
/* If this is a digital display, then we can use reduced blanking */
if (DDC->features.input_type)
Monitor->reducedblanking = TRUE;
/* Allow the user to also enable this through config */
Modes = xf86DDCGetModes(scrnIndex, DDC);
/* Skip EDID ranges if they were specified in the config file */
have_hsync = (Monitor->nHsync != 0);
have_vrefresh = (Monitor->nVrefresh != 0);
/* Go through the detailed monitor sections */
for (i = 0; i < DET_TIMINGS; i++) {
switch (DDC->det_mon[i].type) {
case DS_RANGES:
if (!have_hsync) {
if (!Monitor->nHsync)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for horizontal sync\n");
Monitor->hsync[Monitor->nHsync].lo =
DDC->det_mon[i].section.ranges.min_h;
Monitor->hsync[Monitor->nHsync].hi =
DDC->det_mon[i].section.ranges.max_h;
Monitor->nHsync++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using hsync ranges from config file\n");
}
if (!have_vrefresh) {
if (!Monitor->nVrefresh)
xf86DrvMsg(scrnIndex, X_INFO,
"Using EDID range info for vertical refresh\n");
Monitor->vrefresh[Monitor->nVrefresh].lo =
DDC->det_mon[i].section.ranges.min_v;
Monitor->vrefresh[Monitor->nVrefresh].hi =
DDC->det_mon[i].section.ranges.max_v;
Monitor->nVrefresh++;
} else {
xf86DrvMsg(scrnIndex, X_INFO,
"Using vrefresh ranges from config file\n");
}
clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
if (clock > Monitor->maxPixClock)
Monitor->maxPixClock = clock;
break;
default:
break;
}
}
if (Modes) {
/* Print Modes */
xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
Mode = Modes;
while (Mode) {
xf86PrintModeline(scrnIndex, Mode);
Mode = Mode->next;
}
/* Do we still need ranges to be filled in? */
if (!Monitor->nHsync || !Monitor->nVrefresh)
DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
/* look for last Mode */
Mode = Modes;
while (Mode->next)
Mode = Mode->next;
/* add to MonPtr */
if (Monitor->Modes) {
Monitor->Last->next = Modes;
Modes->prev = Monitor->Last;
Monitor->Last = Mode;
} else {
Monitor->Modes = Modes;
Monitor->Last = Mode;
}
}
}

View File

@ -45,9 +45,6 @@ fontsmodule_LTLIBRARIES = libfreetype.la \
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
INCLUDES = @XORG_INCS@ \
-I$(top_srcdir)/afb \
-I$(top_srcdir)/cfb \
-I$(top_srcdir)/mfb \
-I$(top_srcdir)/dbe \
-I$(top_srcdir)/hw/xfree86/loader \
-I$(top_srcdir)/miext/shadow \

View File

@ -29,7 +29,6 @@
#endif
#include "xf86Module.h"
#include "afb.h"
static MODULESETUPPROTO(afbSetup);

View File

@ -28,10 +28,7 @@
#include <xorg-config.h>
#endif
#define PSZ 32
#include "xf86Module.h"
#include "cfb.h"
static MODULESETUPPROTO(cfb32Setup);

View File

@ -28,10 +28,7 @@
#include <xorg-config.h>
#endif
#define PSZ 8
#include "xf86Module.h"
#include "cfb.h"
static MODULESETUPPROTO(cfbSetup);

View File

@ -604,6 +604,11 @@ the builtin handler will be used.
.BI "Option \*qAIGLX\*q \*q" boolean \*q
enable or disable AIGLX. AIGLX is enabled by default.
.TP 7
.BI "Option \*qUseDefaultFontPath\*q \*q" boolean \*q
Include the default font path even if other paths are specified in
xorg.conf. If enabled, other font paths are included as well. Enabled by
default.
.TP 7
.BI "Option \*qIgnoreABI\*q \*q" boolean \*q
Allow modules built for a different, potentially incompatible version of
the X server to load. Disabled by default.
@ -639,6 +644,20 @@ Example: the Type 1 font rasteriser can be loaded with the following entry:
.B "Load \*qtype1\*q"
.RE
.RE
.TP 7
.BI "Disable \*q" modulename \*q
This instructs the server to not load the module called
.IR modulename .
Some modules are loaded by default in the server, and this overrides that
default. If a
.B Load
instruction is given for the same module, it overrides the
.B Disable
instruction and the module is loaded. The module name given should be the
module's standard name, not the module file name. As with the
.B Load
instruction, the standard name is case-sensitive, and does not include the
"lib" prefix, or the ".a", ".o", or ".so" suffixes.
.PP
The second form of entry is a
.BR SubSection,

View File

@ -473,6 +473,9 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->pLockRefCount = &pDRIEntPriv->lockRefCount;
pDRIPriv->pLockingContext = &pDRIEntPriv->lockingContext;
if (!pDRIEntPriv->keepFDOpen)
pDRIEntPriv->keepFDOpen = pDRIInfo->keepFDOpen;
pDRIEntPriv->refCount++;
return TRUE;
@ -2207,6 +2210,19 @@ DRIGetContext(ScreenPtr pScreen)
return pDRIPriv->myContext;
}
void
DRIGetTexOffsetFuncs(ScreenPtr pScreen,
DRITexOffsetStartProcPtr *texOffsetStartFunc,
DRITexOffsetFinishProcPtr *texOffsetFinishFunc)
{
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if (!pDRIPriv) return;
*texOffsetStartFunc = pDRIPriv->pDriverInfo->texOffsetStart;
*texOffsetFinishFunc = pDRIPriv->pDriverInfo->texOffsetFinish;
}
/* This lets get at the unwrapped functions so that they can correctly
* call the lowerlevel functions, and choose whether they will be
* called at every level of recursion (eg in validatetree).

View File

@ -107,9 +107,12 @@ typedef struct {
*/
#define DRIINFO_MAJOR_VERSION 5
#define DRIINFO_MINOR_VERSION 2
#define DRIINFO_MINOR_VERSION 3
#define DRIINFO_PATCH_VERSION 0
typedef unsigned long long (*DRITexOffsetStartProcPtr)(PixmapPtr pPix);
typedef void (*DRITexOffsetFinishProcPtr)(PixmapPtr pPix);
typedef struct {
/* driver call back functions
*
@ -180,6 +183,10 @@ typedef struct {
/* New with DRI version 5.2.0 */
Bool allocSarea;
Bool keepFDOpen;
/* New with DRI version 5.3.0 */
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
} DRIInfoRec, *DRIInfoPtr;
@ -358,7 +365,9 @@ extern void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
extern drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
extern void DRIGetTexOffsetFuncs(ScreenPtr pScreen,
DRITexOffsetStartProcPtr *texOffsetStartFunc,
DRITexOffsetFinishProcPtr *texOffsetFinishFunc);
#define _DRI_H_

View File

@ -1723,8 +1723,26 @@ Bool
xf86SetDesiredModes (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int c;
int c, o;
/*
* Turn off everything so mode setting is done
* with hardware in a consistent state
*/
for (o = 0; o < config->num_output; o++)
{
xf86OutputPtr output = config->output[o];
(*output->funcs->dpms)(output, DPMSModeOff);
}
for (c = 0; c < config->num_crtc; c++)
{
xf86CrtcPtr crtc = config->crtc[c];
crtc->funcs->dpms(crtc, DPMSModeOff);
memset(&crtc->mode, 0, sizeof(crtc->mode));
}
for (c = 0; c < config->num_crtc; c++)
{
xf86CrtcPtr crtc = config->crtc[c];
@ -1903,7 +1921,9 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
}
}
xf86DisableUnusedFunctions(pScrn);
#if RANDR_12_INTERFACE
xf86RandR12TellChanged (pScrn->pScreen);
#endif
return ok;
}

View File

@ -562,6 +562,10 @@ typedef struct _xf86CrtcConfig {
OptionInfoPtr options;
Bool debug_modes;
/* wrap screen BlockHandler for rotation */
ScreenBlockHandlerProcPtr BlockHandler;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex;

View File

@ -86,6 +86,11 @@ static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
DDC->vendor.prod_id == 44358)
return TRUE;
/* Samsung SyncMaster 226BW */
if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
DDC->vendor.prod_id == 638)
return TRUE;
return FALSE;
}

View File

@ -337,6 +337,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
WindowPtr pRoot = WindowTable[pScreen->myNum];
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE;
if (randrp->virtualX == -1 || randrp->virtualY == -1)
@ -353,8 +354,8 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
ret = TRUE;
pScreen->width = width;
pScreen->height = height;
pScreen->width = pScrnPix->drawable.width = width;
pScreen->height = pScrnPix->drawable.height = height;
pScreen->mmWidth = mmWidth;
pScreen->mmHeight = mmHeight;

View File

@ -24,6 +24,9 @@
#define _XF86_RANDR_H_
#include <randrstr.h>
#include <X11/extensions/render.h>
#if XF86_MODES_RENAME
#include "xf86Rename.h"
#endif
Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
Bool xf86RandR12Init(ScreenPtr pScreen);

View File

@ -25,6 +25,12 @@
#include "local_xf86Rename.h"
#define xf86_cursors_fini XF86NAME(xf86_cursors_fini)
#define xf86_cursors_init XF86NAME(xf86_cursors_init)
#define xf86_hide_cursors XF86NAME(xf86_hide_cursors)
#define xf86_reload_cursors XF86NAME(xf86_reload_cursors)
#define xf86_show_cursors XF86NAME(xf86_show_cursors)
#define xf86ConnectorGetName XF86NAME(xf86ConnectorGetName)
#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
@ -35,6 +41,7 @@
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
#define xf86CVTMode XF86NAME(xf86CVTMode)
#define xf86DDCMonitorSet XF86NAME(xf86DDCMonitorSet)
#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
#define xf86DPMSSet XF86NAME(xf86DPMSSet)
#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
@ -52,9 +59,11 @@
#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
#define xf86OutputRename XF86NAME(xf86OutputRename)
#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
#define xf86OutputUseScreenMonitor XF86NAME(xf86OutputUseScreenMonitor)
#define xf86PrintModeline XF86NAME(xf86PrintModeline)
#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
#define xf86RotateCloseScreen XF86NAME(xf86RotateCloseScreen)
#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)

View File

@ -264,7 +264,7 @@ xf86RotatePrepare (ScreenPtr pScreen)
}
}
static void
static Bool
xf86RotateRedisplay(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@ -273,18 +273,28 @@ xf86RotateRedisplay(ScreenPtr pScreen)
RegionPtr region;
if (!damage)
return;
return FALSE;
xf86RotatePrepare (pScreen);
region = DamageRegion(damage);
if (REGION_NOTEMPTY(pScreen, region))
{
int c;
int c;
SourceValidateProcPtr SourceValidate;
/*
* SourceValidate is used by the software cursor code
* to pull the cursor off of the screen when reading
* bits from the frame buffer. Bypassing this function
* leaves the software cursor in place
*/
SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = NULL;
for (c = 0; c < xf86_config->num_crtc; c++)
{
xf86CrtcPtr crtc = xf86_config->crtc[c];
if (crtc->rotation != RR_Rotate_0)
if (crtc->rotation != RR_Rotate_0 && crtc->enabled)
{
BoxRec box;
RegionRec crtc_damage;
@ -304,21 +314,28 @@ xf86RotateRedisplay(ScreenPtr pScreen)
REGION_UNINIT (pScreen, &crtc_damage);
}
}
pScreen->SourceValidate = SourceValidate;
DamageEmpty(damage);
}
return TRUE;
}
static void
xf86RotateBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
xf86RotateBlockHandler(int screenNum, pointer blockData,
pointer pTimeout, pointer pReadmask)
{
ScreenPtr pScreen = (ScreenPtr) data;
ScreenPtr pScreen = screenInfo.screens[screenNum];
ScrnInfoPtr pScrn = xf86Screens[screenNum];
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86RotateRedisplay(pScreen);
}
static void
xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask)
{
pScreen->BlockHandler = xf86_config->BlockHandler;
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
if (xf86RotateRedisplay(pScreen))
{
/* Re-wrap if rotation is still happening */
xf86_config->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = xf86RotateBlockHandler;
}
}
static void
@ -338,7 +355,8 @@ xf86RotateDestroy (xf86CrtcPtr crtc)
}
for (c = 0; c < xf86_config->num_crtc; c++)
if (crtc->rotatedPixmap || crtc->rotatedData)
if (xf86_config->crtc[c]->rotatedPixmap ||
xf86_config->crtc[c]->rotatedData)
return;
/*
@ -355,10 +373,6 @@ xf86RotateDestroy (xf86CrtcPtr crtc)
}
DamageDestroy (xf86_config->rotation_damage);
xf86_config->rotation_damage = NULL;
/* Free block/wakeup handler */
RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler,
xf86RotateWakeupHandler,
(pointer) pScreen);
}
}
@ -428,20 +442,12 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
if (!xf86_config->rotation_damage)
goto bail2;
/* Assign block/wakeup handler */
if (!RegisterBlockAndWakeupHandlers (xf86RotateBlockHandler,
xf86RotateWakeupHandler,
(pointer) pScreen))
{
goto bail3;
}
/* Wrap block handler */
xf86_config->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = xf86RotateBlockHandler;
}
if (0)
{
bail3:
DamageDestroy (xf86_config->rotation_damage);
xf86_config->rotation_damage = NULL;
bail2:
if (shadow || shadowData)
{

View File

@ -232,14 +232,14 @@ _X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */
int pciMaxBusNum = MAX_PCI_BUSES;
static Bool inProbe = FALSE;
static pciConfigPtr pci_devp[MAX_PCI_DEVICES + 1] = {NULL, };
static pciConfigPtr *pci_devp = NULL;
static int readPciBios( PCITAG Tag, CARD8* tmp, ADDRESS hostbase,
unsigned char * buf, int len, PciBiosType BiosType );
static int (*pciOSHandleBIOS)(PCITAG Tag, int basereg, unsigned char *buf, int len);
int xf86MaxPciDevs = MAX_PCI_DEVICES;
int xf86MaxPciDevs = 0;
/*
* Platform specific PCI function pointers.
@ -272,6 +272,14 @@ pciInit()
if (pciNumBuses <= 0)
ARCH_PCI_OS_INIT();
#endif
if (xf86MaxPciDevs == 0) {
xf86Msg(X_WARNING,
"OS did not count PCI devices, guessing wildly\n");
xf86MaxPciDevs = MAX_PCI_DEVICES;
}
if (pci_devp)
xfree(pci_devp);
pci_devp = xnfcalloc(xf86MaxPciDevs + 1, sizeof(pciConfigPtr));
}
void pciSetOSBIOSPtr(int (*bios_fn)(PCITAG Tag, int basereg, unsigned char * buf, int len))
@ -920,7 +928,7 @@ xf86scanpci(int flags)
* result in an endless recursion if platform/OS specific PCI
* bus probing code calls this function from with in it.
*/
if (done || pci_devp[0])
if (done || pci_devp)
return pci_devp;
done = TRUE;

View File

@ -327,7 +327,7 @@
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
# if !defined(__FreeBSD__)
# if !defined(__FreeBSD__) && !defined(linux)
# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
# endif
#elif defined(__amd64__) || defined(__amd64)

View File

@ -76,6 +76,7 @@ static xf86ConfigSymTabRec ModuleTab[] =
{
{ENDSECTION, "endsection"},
{LOAD, "load"},
{DISABLE, "disable"},
{LOAD_DRIVER, "loaddriver"},
{SUBSECTION, "subsection"},
{-1, ""},
@ -141,6 +142,13 @@ xf86parseModuleSection (void)
xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
XF86_LOAD_MODULE, NULL);
break;
case DISABLE:
if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
Error (QUOTE_MSG, "Disable");
ptr->mod_disable_lst =
xf86addNewLoadDirective (ptr->mod_disable_lst, val.str,
XF86_DISABLE_MODULE, NULL);
break;
case LOAD_DRIVER:
if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
Error (QUOTE_MSG, "LoadDriver");
@ -257,6 +265,15 @@ xf86freeModules (XF86ConfModulePtr ptr)
lptr = lptr->list.next;
xf86conffree (prev);
}
lptr = ptr->mod_disable_lst;
while (lptr)
{
TestFree (lptr->load_name);
TestFree (lptr->load_comment);
prev = lptr;
lptr = lptr->list.next;
xf86conffree (prev);
}
TestFree (ptr->mod_comment);
xf86conffree (ptr);
}

View File

@ -82,6 +82,7 @@ XF86ConfFilesRec, *XF86ConfFilesPtr;
/* Values for load_type */
#define XF86_LOAD_MODULE 0
#define XF86_LOAD_DRIVER 1
#define XF86_DISABLE_MODULE 2
typedef struct
{
@ -97,6 +98,7 @@ XF86LoadRec, *XF86LoadPtr;
typedef struct
{
XF86LoadPtr mod_load_lst;
XF86LoadPtr mod_disable_lst;
char *mod_comment;
}
XF86ConfModuleRec, *XF86ConfModulePtr;

View File

@ -170,6 +170,7 @@ typedef enum {
/* Module tokens */
LOAD,
LOAD_DRIVER,
DISABLE,
/* Device tokens */
DRIVER,

View File

@ -32,10 +32,6 @@ Original mi code written by Keith Packard.
#include "xaa.h"
#include "xaalocal.h"
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
#endif
#define DRAW_POINT(pScrn, x, y) \
if(hardClip) (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, 1); \
else XAAPointHelper(pScrn, x, y)

View File

@ -177,7 +177,7 @@ xglCompositeGeneral (CARD8 op,
{
if (!pSrc->transform && pSrc->filter != PictFilterConvolution)
{
if (pSrc->pDrawable && pSrc->repeat == RepeatNormal)
if (pSrc->pDrawable && pSrc->repeatType == RepeatNormal)
{
XGL_PIXMAP_PRIV ((PixmapPtr) pSrc->pDrawable);

View File

@ -100,9 +100,10 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
InitPointerDeviceStruct (pDevice,
map,
lngMouseButtons + lngWheelEvents,
miPointerGetMotionEvents,
GetMotionHistory,
winMouseCtrl,
miPointerGetMotionBufferSize ());
GetMotionHistorySize(),
2);
free(map);
#if defined(XFree86Server) && defined(XINPUT)

View File

@ -445,10 +445,7 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
}
else
{
XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum);
/* */
if (nNum && ppList && *ppList)
if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
{
*ppName = strdup (*ppList);
XFreeStringList (ppList);

View File

@ -38,6 +38,7 @@
#include "winmultiwindowclass.h"
#include "winprefs.h"
#include "winmsg.h"
#include "inputstr.h"
/*
* External global variables
@ -444,7 +445,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
/* Avoid the BitBlt's if the PAINTSTRUCT is bogus */
if (ps.rcPaint.right==0 && ps.rcPaint.bottom==0 && ps.rcPaint.left==0 && ps.rcPaint.top==0)
{
EndPaint (hwndScreen, &ps);
EndPaint (hwnd, &ps);
return 0;
}
@ -474,7 +475,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
}
/* EndPaint frees the DC */
EndPaint (hwndScreen, &ps);
EndPaint (hwnd, &ps);
return 0;
case WM_MOUSEMOVE:
@ -494,8 +495,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
break;
/* Has the mouse pointer crossed screens? */
if (s_pScreen != miPointerCurrentScreen ())
miPointerSetNewScreen (s_pScreenInfo->dwScreen,
if (s_pScreen != miPointerGetScreen(inputInfo.pointer))
miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen,
ptMouse.x - s_pScreenInfo->dwXOffset,
ptMouse.y - s_pScreenInfo->dwYOffset);

View File

@ -41,6 +41,7 @@
#include <X11/Xatom.h>
#include "winmultiwindowclass.h"
#include "winmsg.h"
#include "inputstr.h"
/*
@ -534,8 +535,8 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
break;
/* Has the mouse pointer crossed screens? */
if (pScreen != miPointerCurrentScreen ())
miPointerSetNewScreen (pScreenInfo->dwScreen,
if (pScreen != miPointerGetScreen(inputInfo.pointer))
miPointerSetScreen (inputInfo.pointer, pScreenInfo->dwScreen,
ptMouse.x - pScreenInfo->dwXOffset,
ptMouse.y - pScreenInfo->dwYOffset);

View File

@ -40,6 +40,7 @@
#include "winprefs.h"
#include "winconfig.h"
#include "winmsg.h"
#include "inputstr.h"
#ifdef XKB
extern BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
@ -723,8 +724,8 @@ winWindowProc (HWND hwnd, UINT message,
break;
/* Has the mouse pointer crossed screens? */
if (s_pScreen != miPointerCurrentScreen ())
miPointerSetNewScreen (s_pScreenInfo->dwScreen,
if (s_pScreen != miPointerGetScreen(inputInfo.pointer))
miPointerSetScreen (inputInfo.pointer, s_pScreenInfo->dwScreen,
GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);

View File

@ -102,6 +102,9 @@
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
/* Define to 1 if you have cbrt */
#undef HAVE_CBRT
/* Define to 1 if you have the <dbm.h> header file. */
#undef HAVE_DBM_H

View File

@ -239,7 +239,7 @@ extern int Ones(
unsigned long /*mask*/);
typedef struct _xPoint *DDXPointPtr;
typedef struct _Box *BoxPtr;
typedef struct pixman_box16 *BoxPtr;
typedef struct _xEvent *xEventPtr;
typedef struct _xRectangle *xRectanglePtr;
typedef struct _GrabRec *GrabPtr;

View File

@ -50,12 +50,11 @@ SOFTWARE.
#include "misc.h"
#include <X11/Xprotostr.h>
#include <pixman/pixman.h>
typedef xPoint DDXPointRec;
typedef struct _Box {
short x1, y1, x2, y2;
} BoxRec;
typedef struct pixman_box16 BoxRec;
typedef union _DevUnion {
pointer ptr;

View File

@ -48,7 +48,7 @@ SOFTWARE.
#ifndef REGIONSTRUCT_H
#define REGIONSTRUCT_H
typedef struct _Region RegionRec, *RegionPtr;
typedef struct pixman_region16 RegionRec, *RegionPtr;
#include "miscstruct.h"
@ -64,16 +64,7 @@ typedef struct _Region RegionRec, *RegionPtr;
* clip region
*/
typedef struct _RegData {
long size;
long numRects;
/* BoxRec rects[size]; in memory but not explicitly declared */
} RegDataRec, *RegDataPtr;
struct _Region {
BoxRec extents;
RegDataPtr data;
};
typedef struct pixman_region16_data RegDataRec, *RegDataPtr;
extern BoxRec miEmptyBox;
extern RegDataRec miEmptyData;
@ -234,6 +225,8 @@ extern RegDataRec miBrokenData;
/* moved from mi.h */
extern void InitRegions (void);
extern RegionPtr miRegionCreate(
BoxPtr /*rect*/,
int /*size*/);

View File

@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libminimi.la libmi.la
noinst_LTLIBRARIES = libmi.la
if XORG
sdk_HEADERS = mibank.h micmap.h miline.h mipointer.h mi.h mibstore.h \
@ -8,9 +8,7 @@ endif
AM_CFLAGS = $(DIX_CFLAGS)
# libminimi is for dmx - it has different defines for miinitext.c
libminimi_la_SOURCES = \
cbrt.c \
libmi_la_SOURCES = \
mi.h \
miarc.c \
mibank.c \
@ -69,7 +67,3 @@ libminimi_la_SOURCES = \
mizerarc.h \
mizerclip.c \
mizerline.c
libmi_la_SOURCES = $(libminimi_la_SOURCES)
INCLUDES = -I$(top_srcdir)/mfb

View File

@ -1,46 +0,0 @@
/*
Copyright 1990, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/* simple cbrt, in case your math library doesn't have a good one */
/*
* Would normally include <math.h> for this, but for the sake of compiler
* warnings, we don't want to get duplicate declarations for cbrt().
*/
double pow(double, double);
double cbrt(double);
double
cbrt(double x)
{
if (x > 0.0)
return pow(x, 1.0/3.0);
else
return -pow(-x, 1.0/3.0);
}

View File

@ -51,14 +51,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) \
|| (defined(sun) && defined(__SVR4))
#include <math.h>
#else
#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
#include <math.h>
#undef _XOPEN_SOURCE
#endif
#include <X11/X.h>
#include <X11/Xprotostr.h>
#include "misc.h"
@ -75,10 +68,16 @@ static double miDsin(double a);
static double miDcos(double a);
static double miDasin(double v);
static double miDatan2(double dy, double dx);
double cbrt(double);
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
#ifndef HAVE_CBRT
static double
cbrt(double x)
{
if (x > 0.0)
return pow(x, 1.0/3.0);
else
return -pow(-x, 1.0/3.0);
}
#endif
/*
@ -104,37 +103,16 @@ ICEILTEMPDECL
#undef max
#undef min
#if defined (__GNUC__) && !defined (__STRICT_ANSI__)
#define USE_INLINE
#endif
#ifdef USE_INLINE
inline static int max (const int x, const int y)
_X_INLINE static int max (const int x, const int y)
{
return x>y? x:y;
}
inline static int min (const int x, const int y)
_X_INLINE static int min (const int x, const int y)
{
return x<y? x:y;
}
#else
static int
max (int x, int y)
{
return x>y? x:y;
}
static int
min (int x, int y)
{
return x<y? x:y;
}
#endif
struct bound {
double min, max;
};

View File

@ -48,6 +48,8 @@ SOFTWARE.
#ifndef __MIFPOLY_H__
#define __MIFPOLY_H__
#include <X11/Xfuncproto.h>
#define EPSILON 0.000001
#define ISEQUAL(a,b) (Fabs((a) - (b)) <= EPSILON)
#define UNEQUAL(a,b) (Fabs((a) - (b)) > EPSILON)
@ -66,20 +68,11 @@ SOFTWARE.
#define SQSECANT 108.856472512142 /* 1/sin^2(11/2) - for 11o miter cutoff */
#define D2SECANT 5.21671526231167 /* 1/2*sin(11/2) - max extension per width */
#ifdef NOINLINEICEIL
#define ICEIL(x) ((int)ceil(x))
#else
#ifdef __GNUC__
static __inline int ICEIL(double x)
static _X_INLINE int ICEIL(double x)
{
int _cTmp = x;
return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1;
}
#else
#define ICEIL(x) ((((x) == (_cTmp = (x))) || ((x) < 0.0)) ? _cTmp : _cTmp+1)
#define ICEILTEMPDECL static int _cTmp;
#endif
#endif
/* Point with sub-pixel positioning. In this case we use doubles, but
* see mifpolycon.c for other suggestions

View File

@ -58,10 +58,6 @@ SOFTWARE.
static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
int *by, int *ty);
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
#endif
/*
* Written by Todd Newman; April. 1987.
*

View File

@ -81,15 +81,11 @@ Equipment Corporation.
#include "regionstr.h"
#include <X11/Xprotostr.h>
#include <X11/Xfuncproto.h>
#include "gc.h"
#include "mi.h"
#include "mispans.h"
#if defined (__GNUC__) && !defined (NO_INLINES)
#define INLINE __inline
#else
#define INLINE
#endif
#include <pixman/pixman.h>
#undef assert
#ifdef DEBUG
@ -223,6 +219,43 @@ _X_EXPORT RegDataRec miEmptyData = {0, 0};
RegDataRec miBrokenData = {0, 0};
static RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
extern void
InitRegions (void)
{
pixman_region_set_static_pointers (&miEmptyBox, &miEmptyData, &miBrokenData);
}
/*****************************************************************
* RegionCreate(rect, size)
* This routine does a simple malloc to make a structure of
* REGION of "size" number of rectangles.
*****************************************************************/
_X_EXPORT RegionPtr
miRegionCreate(rect, size)
BoxPtr rect;
int size;
{
RegionPtr pReg;
pReg = (RegionPtr)xalloc(sizeof(RegionRec));
if (!pReg)
return &miBrokenRegion;
miRegionInit (pReg, rect, size);
return(pReg);
}
_X_EXPORT void
miRegionDestroy(pReg)
RegionPtr pReg;
{
pixman_region_fini (pReg);
if (pReg != &miBrokenRegion)
xfree(pReg);
}
_X_EXPORT void
miPrintRegion(rgn)
RegionPtr rgn;
@ -248,26 +281,7 @@ miRegionEqual(reg1, reg2)
RegionPtr reg1;
RegionPtr reg2;
{
int i, num;
BoxPtr rects1, rects2;
if (reg1->extents.x1 != reg2->extents.x1) return FALSE;
if (reg1->extents.x2 != reg2->extents.x2) return FALSE;
if (reg1->extents.y1 != reg2->extents.y1) return FALSE;
if (reg1->extents.y2 != reg2->extents.y2) return FALSE;
num = REGION_NUM_RECTS(reg1);
if (num != REGION_NUM_RECTS(reg2)) return FALSE;
rects1 = REGION_RECTS(reg1);
rects2 = REGION_RECTS(reg2);
for (i = 0; i != num; i++) {
if (rects1[i].x1 != rects2[i].x1) return FALSE;
if (rects1[i].x2 != rects2[i].x2) return FALSE;
if (rects1[i].y1 != rects2[i].y1) return FALSE;
if (rects1[i].y2 != rects2[i].y2) return FALSE;
}
return TRUE;
return pixman_region_equal (reg1, reg2);
}
#ifdef DEBUG
@ -276,7 +290,7 @@ miValidRegion(reg)
RegionPtr reg;
{
int i, numRects;
if ((reg->extents.x1 > reg->extents.x2) ||
(reg->extents.y1 > reg->extents.y2))
return FALSE;
@ -291,7 +305,7 @@ miValidRegion(reg)
{
BoxPtr pboxP, pboxN;
BoxRec box;
pboxP = REGION_RECTS(reg);
box = *pboxP;
box.y2 = pboxP[numRects-1].y2;
@ -302,7 +316,7 @@ miValidRegion(reg)
(pboxN->y1 >= pboxN->y2))
return FALSE;
if (pboxN->x1 < box.x1)
box.x1 = pboxN->x1;
box.x1 = pboxN->x1;
if (pboxN->x2 > box.x2)
box.x2 = pboxN->x2;
if ((pboxN->y1 < pboxP->y1) ||
@ -316,45 +330,8 @@ miValidRegion(reg)
(box.y2 == reg->extents.y2));
}
}
#endif /* DEBUG */
/*****************************************************************
* RegionCreate(rect, size)
* This routine does a simple malloc to make a structure of
* REGION of "size" number of rectangles.
*****************************************************************/
_X_EXPORT RegionPtr
miRegionCreate(rect, size)
BoxPtr rect;
int size;
{
RegionPtr pReg;
pReg = (RegionPtr)xalloc(sizeof(RegionRec));
if (!pReg)
return &miBrokenRegion;
if (rect)
{
pReg->extents = *rect;
pReg->data = (RegDataPtr)NULL;
}
else
{
pReg->extents = miEmptyBox;
if ((size > 1) && (pReg->data = xallocData(size)))
{
pReg->data->size = size;
pReg->data->numRects = 0;
}
else
pReg->data = &miEmptyData;
}
return(pReg);
}
/*****************************************************************
* RegionInit(pReg, rect, size)
* Outer region rect is statically allocated.
@ -367,39 +344,16 @@ miRegionInit(pReg, rect, size)
int size;
{
if (rect)
{
pReg->extents = *rect;
pReg->data = (RegDataPtr)NULL;
}
pixman_region_init_with_extents (pReg, rect);
else
{
pReg->extents = miEmptyBox;
if ((size > 1) && (pReg->data = xallocData(size)))
{
pReg->data->size = size;
pReg->data->numRects = 0;
}
else
pReg->data = &miEmptyData;
}
}
_X_EXPORT void
miRegionDestroy(pReg)
RegionPtr pReg;
{
good(pReg);
xfreeData(pReg);
if (pReg != &miBrokenRegion)
xfree(pReg);
pixman_region_init (pReg);
}
_X_EXPORT void
miRegionUninit(pReg)
RegionPtr pReg;
{
good(pReg);
xfreeData(pReg);
pixman_region_fini (pReg);
}
Bool
@ -458,32 +412,9 @@ miRegionCopy(dst, src)
RegionPtr dst;
RegionPtr src;
{
good(dst);
good(src);
if (dst == src)
return TRUE;
dst->extents = src->extents;
if (!src->data || !src->data->size)
{
xfreeData(dst);
dst->data = src->data;
return TRUE;
}
if (!dst->data || (dst->data->size < src->data->numRects))
{
xfreeData(dst);
dst->data = xallocData(src->data->numRects);
if (!dst->data)
return miRegionBreak (dst);
dst->data->size = src->data->numRects;
}
dst->data->numRects = src->data->numRects;
memmove((char *)REGION_BOXPTR(dst),(char *)REGION_BOXPTR(src),
dst->data->numRects * sizeof(BoxRec));
return TRUE;
return pixman_region_copy (dst, src);
}
/*======================================================================
* Generic Region Operator
*====================================================================*/
@ -506,7 +437,7 @@ miRegionCopy(dst, src)
*
*-----------------------------------------------------------------------
*/
INLINE static int
_X_INLINE static int
miCoalesce (
RegionPtr pReg, /* Region to coalesce */
int prevStart, /* Index of start of previous band */
@ -590,7 +521,7 @@ miCoalesce (
*-----------------------------------------------------------------------
*/
INLINE static Bool
_X_INLINE static Bool
miAppendNonO (
RegionPtr pReg,
BoxPtr r,
@ -914,8 +845,7 @@ miRegionOp(
*-----------------------------------------------------------------------
*/
static void
miSetExtents (pReg)
RegionPtr pReg;
miSetExtents (RegionPtr pReg)
{
BoxPtr pBox, pBoxEnd;
@ -972,113 +902,13 @@ miSetExtents (pReg)
*-----------------------------------------------------------------------
*/
/*ARGSUSED*/
static Bool
miIntersectO (
RegionPtr pReg,
BoxPtr r1,
BoxPtr r1End,
BoxPtr r2,
BoxPtr r2End,
short y1,
short y2,
Bool *pOverlap)
{
int x1;
int x2;
BoxPtr pNextRect;
pNextRect = REGION_TOP(pReg);
assert(y1 < y2);
assert(r1 != r1End && r2 != r2End);
do {
x1 = max(r1->x1, r2->x1);
x2 = min(r1->x2, r2->x2);
/*
* If there's any overlap between the two rectangles, add that
* overlap to the new region.
*/
if (x1 < x2)
NEWRECT(pReg, pNextRect, x1, y1, x2, y2);
/*
* Advance the pointer(s) with the leftmost right side, since the next
* rectangle on that list may still overlap the other region's
* current rectangle.
*/
if (r1->x2 == x2) {
r1++;
}
if (r2->x2 == x2) {
r2++;
}
} while ((r1 != r1End) && (r2 != r2End));
return TRUE;
}
_X_EXPORT Bool
miIntersect(newReg, reg1, reg2)
RegionPtr newReg; /* destination Region */
RegionPtr reg1;
RegionPtr reg2; /* source regions */
{
good(reg1);
good(reg2);
good(newReg);
/* check for trivial reject */
if (REGION_NIL(reg1) || REGION_NIL(reg2) ||
!EXTENTCHECK(&reg1->extents, &reg2->extents))
{
/* Covers about 20% of all cases */
xfreeData(newReg);
newReg->extents.x2 = newReg->extents.x1;
newReg->extents.y2 = newReg->extents.y1;
if (REGION_NAR(reg1) || REGION_NAR(reg2))
{
newReg->data = &miBrokenData;
return FALSE;
}
else
newReg->data = &miEmptyData;
}
else if (!reg1->data && !reg2->data)
{
/* Covers about 80% of cases that aren't trivially rejected */
newReg->extents.x1 = max(reg1->extents.x1, reg2->extents.x1);
newReg->extents.y1 = max(reg1->extents.y1, reg2->extents.y1);
newReg->extents.x2 = min(reg1->extents.x2, reg2->extents.x2);
newReg->extents.y2 = min(reg1->extents.y2, reg2->extents.y2);
xfreeData(newReg);
newReg->data = (RegDataPtr)NULL;
}
else if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
{
return miRegionCopy(newReg, reg1);
}
else if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
{
return miRegionCopy(newReg, reg2);
}
else if (reg1 == reg2)
{
return miRegionCopy(newReg, reg1);
}
else
{
/* General purpose intersection */
Bool overlap; /* result ignored */
if (!miRegionOp(newReg, reg1, reg2, miIntersectO, FALSE, FALSE,
&overlap))
return FALSE;
miSetExtents(newReg);
}
good(newReg);
return(TRUE);
return pixman_region_intersect (newReg, reg1, reg2);
}
#define MERGERECT(r) \
@ -1181,78 +1011,9 @@ miUnion(newReg, reg1, reg2)
RegionPtr reg1;
RegionPtr reg2; /* source regions */
{
Bool overlap; /* result ignored */
/* Return TRUE if some overlap between reg1, reg2 */
good(reg1);
good(reg2);
good(newReg);
/* checks all the simple cases */
/*
* Region 1 and 2 are the same
*/
if (reg1 == reg2)
{
return miRegionCopy(newReg, reg1);
}
/*
* Region 1 is empty
*/
if (REGION_NIL(reg1))
{
if (REGION_NAR(reg1))
return miRegionBreak (newReg);
if (newReg != reg2)
return miRegionCopy(newReg, reg2);
return TRUE;
}
/*
* Region 2 is empty
*/
if (REGION_NIL(reg2))
{
if (REGION_NAR(reg2))
return miRegionBreak (newReg);
if (newReg != reg1)
return miRegionCopy(newReg, reg1);
return TRUE;
}
/*
* Region 1 completely subsumes region 2
*/
if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
{
if (newReg != reg1)
return miRegionCopy(newReg, reg1);
return TRUE;
}
/*
* Region 2 completely subsumes region 1
*/
if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
{
if (newReg != reg2)
return miRegionCopy(newReg, reg2);
return TRUE;
}
if (!miRegionOp(newReg, reg1, reg2, miUnionO, TRUE, TRUE, &overlap))
return FALSE;
newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1);
newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1);
newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2);
newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2);
good(newReg);
return TRUE;
return pixman_region_union (newReg, reg1, reg2);
}
/*======================================================================
* Batch Rectangle Union
*====================================================================*/
@ -1657,6 +1418,7 @@ miRectsToRegion(nrects, prect, ctype)
xRectangle *prect;
int ctype;
{
RegionPtr pRgn;
RegDataPtr pData;
BoxPtr pBox;
@ -1752,116 +1514,7 @@ miRectsToRegion(nrects, prect, ctype)
*-----------------------------------------------------------------------
*/
/*ARGSUSED*/
static Bool
miSubtractO (
RegionPtr pReg,
BoxPtr r1,
BoxPtr r1End,
BoxPtr r2,
BoxPtr r2End,
short y1,
short y2,
Bool *pOverlap)
{
BoxPtr pNextRect;
int x1;
x1 = r1->x1;
assert(y1<y2);
assert(r1 != r1End && r2 != r2End);
pNextRect = REGION_TOP(pReg);
do
{
if (r2->x2 <= x1)
{
/*
* Subtrahend entirely to left of minuend: go to next subtrahend.
*/
r2++;
}
else if (r2->x1 <= x1)
{
/*
* Subtrahend preceeds minuend: nuke left edge of minuend.
*/
x1 = r2->x2;
if (x1 >= r1->x2)
{
/*
* Minuend completely covered: advance to next minuend and
* reset left fence to edge of new minuend.
*/
r1++;
if (r1 != r1End)
x1 = r1->x1;
}
else
{
/*
* Subtrahend now used up since it doesn't extend beyond
* minuend
*/
r2++;
}
}
else if (r2->x1 < r1->x2)
{
/*
* Left part of subtrahend covers part of minuend: add uncovered
* part of minuend to region and skip to next subtrahend.
*/
assert(x1<r2->x1);
NEWRECT(pReg, pNextRect, x1, y1, r2->x1, y2);
x1 = r2->x2;
if (x1 >= r1->x2)
{
/*
* Minuend used up: advance to new...
*/
r1++;
if (r1 != r1End)
x1 = r1->x1;
}
else
{
/*
* Subtrahend used up
*/
r2++;
}
}
else
{
/*
* Minuend used up: add any remaining piece before advancing.
*/
if (r1->x2 > x1)
NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2);
r1++;
if (r1 != r1End)
x1 = r1->x1;
}
} while ((r1 != r1End) && (r2 != r2End));
/*
* Add remaining minuend rectangles to region.
*/
while (r1 != r1End)
{
assert(x1<r1->x2);
NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2);
r1++;
if (r1 != r1End)
x1 = r1->x1;
}
return TRUE;
}
/*-
*-----------------------------------------------------------------------
* miSubtract --
@ -1882,44 +1535,7 @@ miSubtract(regD, regM, regS)
RegionPtr regM;
RegionPtr regS;
{
Bool overlap; /* result ignored */
good(regM);
good(regS);
good(regD);
/* check for trivial rejects */
if (REGION_NIL(regM) || REGION_NIL(regS) ||
!EXTENTCHECK(&regM->extents, &regS->extents))
{
if (REGION_NAR (regS))
return miRegionBreak (regD);
return miRegionCopy(regD, regM);
}
else if (regM == regS)
{
xfreeData(regD);
regD->extents.x2 = regD->extents.x1;
regD->extents.y2 = regD->extents.y1;
regD->data = &miEmptyData;
return TRUE;
}
/* Add those rectangles in region 1 that aren't in region 2,
do yucky substraction for overlaps, and
just throw away rectangles in region 2 that aren't in region 1 */
if (!miRegionOp(regD, regM, regS, miSubtractO, TRUE, FALSE, &overlap))
return FALSE;
/*
* Can't alter RegD's extents before we call miRegionOp because
* it might be one of the source regions and miRegionOp depends
* on the extents of those regions being unaltered. Besides, this
* way there's no checking against rectangles that will be nuked
* due to coalescing, so we have to examine fewer rectangles.
*/
miSetExtents(regD);
good(regD);
return TRUE;
return pixman_region_subtract (regD, regM, regS);
}
/*======================================================================
@ -1947,150 +1563,14 @@ miInverse(newReg, reg1, invRect)
RegionPtr reg1; /* Region to invert */
BoxPtr invRect; /* Bounding box for inversion */
{
RegionRec invReg; /* Quick and dirty region made from the
* bounding box */
Bool overlap; /* result ignored */
good(reg1);
good(newReg);
/* check for trivial rejects */
if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, &reg1->extents))
{
if (REGION_NAR(reg1))
return miRegionBreak (newReg);
newReg->extents = *invRect;
xfreeData(newReg);
newReg->data = (RegDataPtr)NULL;
return TRUE;
}
/* Add those rectangles in region 1 that aren't in region 2,
do yucky substraction for overlaps, and
just throw away rectangles in region 2 that aren't in region 1 */
invReg.extents = *invRect;
invReg.data = (RegDataPtr)NULL;
if (!miRegionOp(newReg, &invReg, reg1, miSubtractO, TRUE, FALSE, &overlap))
return FALSE;
/*
* Can't alter newReg's extents before we call miRegionOp because
* it might be one of the source regions and miRegionOp depends
* on the extents of those regions being unaltered. Besides, this
* way there's no checking against rectangles that will be nuked
* due to coalescing, so we have to examine fewer rectangles.
*/
miSetExtents(newReg);
good(newReg);
return TRUE;
return pixman_region_inverse (newReg, reg1, invRect);
}
/*
* RectIn(region, rect)
* This routine takes a pointer to a region and a pointer to a box
* and determines if the box is outside/inside/partly inside the region.
*
* The idea is to travel through the list of rectangles trying to cover the
* passed box with them. Anytime a piece of the rectangle isn't covered
* by a band of rectangles, partOut is set TRUE. Any time a rectangle in
* the region covers part of the box, partIn is set TRUE. The process ends
* when either the box has been completely covered (we reached a band that
* doesn't overlap the box, partIn is TRUE and partOut is false), the
* box has been partially covered (partIn == partOut == TRUE -- because of
* the banding, the first time this is true we know the box is only
* partially in the region) or is outside the region (we reached a band
* that doesn't overlap the box at all and partIn is false)
*/
_X_EXPORT int
miRectIn(region, prect)
RegionPtr region;
BoxPtr prect;
{
int x;
int y;
BoxPtr pbox;
BoxPtr pboxEnd;
int partIn, partOut;
int numRects;
good(region);
numRects = REGION_NUM_RECTS(region);
/* useful optimization */
if (!numRects || !EXTENTCHECK(&region->extents, prect))
return(rgnOUT);
if (numRects == 1)
{
/* We know that it must be rgnIN or rgnPART */
if (SUBSUMES(&region->extents, prect))
return(rgnIN);
else
return(rgnPART);
}
partOut = FALSE;
partIn = FALSE;
/* (x,y) starts at upper left of rect, moving to the right and down */
x = prect->x1;
y = prect->y1;
/* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */
for (pbox = REGION_BOXPTR(region), pboxEnd = pbox + numRects;
pbox != pboxEnd;
pbox++)
{
if (pbox->y2 <= y)
continue; /* getting up to speed or skipping remainder of band */
if (pbox->y1 > y)
{
partOut = TRUE; /* missed part of rectangle above */
if (partIn || (pbox->y1 >= prect->y2))
break;
y = pbox->y1; /* x guaranteed to be == prect->x1 */
}
if (pbox->x2 <= x)
continue; /* not far enough over yet */
if (pbox->x1 > x)
{
partOut = TRUE; /* missed part of rectangle to left */
if (partIn)
break;
}
if (pbox->x1 < prect->x2)
{
partIn = TRUE; /* definitely overlap */
if (partOut)
break;
}
if (pbox->x2 >= prect->x2)
{
y = pbox->y2; /* finished with this band */
if (y >= prect->y2)
break;
x = prect->x1; /* reset x out to left again */
}
else
{
/*
* Because boxes in a band are maximal width, if the first box
* to overlap the rectangle doesn't completely cover it in that
* band, the rectangle must be partially out, since some of it
* will be uncovered in that band. partIn will have been set true
* by now...
*/
partOut = TRUE;
break;
}
}
return(partIn ? ((y < prect->y2) ? rgnPART : rgnIN) : rgnOUT);
return pixman_region_contains_rectangle (region, prect);
}
/* TranslateRegion(pReg, x, y)
@ -2103,83 +1583,7 @@ miTranslateRegion(pReg, x, y)
int x;
int y;
{
int x1, x2, y1, y2;
int nbox;
BoxPtr pbox;
good(pReg);
pReg->extents.x1 = x1 = pReg->extents.x1 + x;
pReg->extents.y1 = y1 = pReg->extents.y1 + y;
pReg->extents.x2 = x2 = pReg->extents.x2 + x;
pReg->extents.y2 = y2 = pReg->extents.y2 + y;
if (((x1 - MINSHORT)|(y1 - MINSHORT)|(MAXSHORT - x2)|(MAXSHORT - y2)) >= 0)
{
if (pReg->data && (nbox = pReg->data->numRects))
{
for (pbox = REGION_BOXPTR(pReg); nbox--; pbox++)
{
pbox->x1 += x;
pbox->y1 += y;
pbox->x2 += x;
pbox->y2 += y;
}
}
return;
}
if (((x2 - MINSHORT)|(y2 - MINSHORT)|(MAXSHORT - x1)|(MAXSHORT - y1)) <= 0)
{
pReg->extents.x2 = pReg->extents.x1;
pReg->extents.y2 = pReg->extents.y1;
xfreeData(pReg);
pReg->data = &miEmptyData;
return;
}
if (x1 < MINSHORT)
pReg->extents.x1 = MINSHORT;
else if (x2 > MAXSHORT)
pReg->extents.x2 = MAXSHORT;
if (y1 < MINSHORT)
pReg->extents.y1 = MINSHORT;
else if (y2 > MAXSHORT)
pReg->extents.y2 = MAXSHORT;
if (pReg->data && (nbox = pReg->data->numRects))
{
BoxPtr pboxout;
for (pboxout = pbox = REGION_BOXPTR(pReg); nbox--; pbox++)
{
pboxout->x1 = x1 = pbox->x1 + x;
pboxout->y1 = y1 = pbox->y1 + y;
pboxout->x2 = x2 = pbox->x2 + x;
pboxout->y2 = y2 = pbox->y2 + y;
if (((x2 - MINSHORT)|(y2 - MINSHORT)|
(MAXSHORT - x1)|(MAXSHORT - y1)) <= 0)
{
pReg->data->numRects--;
continue;
}
if (x1 < MINSHORT)
pboxout->x1 = MINSHORT;
else if (x2 > MAXSHORT)
pboxout->x2 = MAXSHORT;
if (y1 < MINSHORT)
pboxout->y1 = MINSHORT;
else if (y2 > MAXSHORT)
pboxout->y2 = MAXSHORT;
pboxout++;
}
if (pboxout != pbox)
{
if (pReg->data->numRects == 1)
{
pReg->extents = *REGION_BOXPTR(pReg);
xfreeData(pReg);
pReg->data = (RegDataPtr)NULL;
}
else
miSetExtents(pReg);
}
}
pixman_region_translate (pReg, x, y);
}
_X_EXPORT void
@ -2187,12 +1591,7 @@ miRegionReset(pReg, pBox)
RegionPtr pReg;
BoxPtr pBox;
{
good(pReg);
assert(pBox->x1<=pBox->x2);
assert(pBox->y1<=pBox->y2);
pReg->extents = *pBox;
xfreeData(pReg);
pReg->data = (RegDataPtr)NULL;
pixman_region_reset (pReg, pBox);
}
_X_EXPORT Bool
@ -2201,40 +1600,14 @@ miPointInRegion(pReg, x, y, box)
int x, y;
BoxPtr box; /* "return" value */
{
BoxPtr pbox, pboxEnd;
int numRects;
good(pReg);
numRects = REGION_NUM_RECTS(pReg);
if (!numRects || !INBOX(&pReg->extents, x, y))
return(FALSE);
if (numRects == 1)
{
*box = pReg->extents;
return(TRUE);
}
for (pbox = REGION_BOXPTR(pReg), pboxEnd = pbox + numRects;
pbox != pboxEnd;
pbox++)
{
if (y >= pbox->y2)
continue; /* not there yet */
if ((y < pbox->y1) || (x < pbox->x1))
break; /* missed it */
if (x >= pbox->x2)
continue; /* not there yet */
*box = *pbox;
return(TRUE);
}
return(FALSE);
return pixman_region_contains_point (pReg, x, y, box);
}
_X_EXPORT Bool
miRegionNotEmpty(pReg)
RegionPtr pReg;
{
good(pReg);
return(!REGION_NIL(pReg));
return pixman_region_not_empty (pReg);
}
Bool

View File

@ -52,10 +52,6 @@ from The Open Group.
#include "miwideline.h"
#include "mi.h"
#ifdef ICEILTEMPDECL
ICEILTEMPDECL
#endif
static void miLineArc(DrawablePtr pDraw, GCPtr pGC,
unsigned long pixel, SpanDataPtr spanData,
LineFacePtr leftFace,

View File

@ -30,6 +30,7 @@
#include "gcstruct.h"
#include "pixmapstr.h"
#include "cw.h"
#include "mi.h"
#define SETUP_BACKING_DST(_pDst, _pGC) \
cwGCPtr pGCPrivate = getCwGC (_pGC); \
@ -185,7 +186,7 @@ cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
int w, int h, int dstx, int dsty)
{
int odstx, odsty;
RegionPtr exposed = NULL;
int osrcx, osrcy;
SETUP_BACKING_DST(pDst, pGC);
SETUP_BACKING_SRC(pSrc, pGC);
@ -193,19 +194,20 @@ cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
odstx = dstx;
odsty = dsty;
osrcx = srcx;
osrcy = srcy;
CW_OFFSET_XY_DST(dstx, dsty);
CW_OFFSET_XY_SRC(srcx, srcy);
exposed = (*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst,
pBackingGC, srcx, srcy, w, h,
dstx, dsty);
if (exposed != NULL)
REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty);
(*pBackingGC->ops->CopyArea)(pBackingSrc, pBackingDst,
pBackingGC, srcx, srcy, w, h,
dstx, dsty);
EPILOGUE(pGC);
return exposed;
return miHandleExposures(pSrc, pDst, pGC,
osrcx, osrcy, w, h,
odstx, odsty, 0);
}
static RegionPtr
@ -213,7 +215,7 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
int w, int h, int dstx, int dsty, unsigned long plane)
{
int odstx, odsty;
RegionPtr exposed = NULL;
int osrcx, osrcy;
SETUP_BACKING_DST(pDst, pGC);
SETUP_BACKING_SRC(pSrc, pGC);
@ -221,19 +223,20 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy,
odstx = dstx;
odsty = dsty;
osrcx = srcx;
osrcy = srcy;
CW_OFFSET_XY_DST(dstx, dsty);
CW_OFFSET_XY_SRC(srcx, srcy);
exposed = (*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst,
pBackingGC, srcx, srcy, w, h,
dstx, dsty, plane);
if (exposed != NULL)
REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty);
(*pBackingGC->ops->CopyPlane)(pBackingSrc, pBackingDst,
pBackingGC, srcx, srcy, w, h,
dstx, dsty, plane);
EPILOGUE(pGC);
return exposed;
return miHandleExposures(pSrc, pDst, pGC,
osrcx, osrcy, w, h,
odstx, odsty, plane);
}
static void

View File

@ -46,22 +46,6 @@
#include "fbpict.h"
#include "safeAlpha.h"
#include "rootlessCommon.h"
# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
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);
/* Optimized version of fbCompositeSolidMask_nx8x8888 */
void
@ -148,46 +132,22 @@ SafeAlphaCompositeSolidMask_nx8x8888(
}
void
SafeAlphaComposite (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
SafeAlphaComposite (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
RegionRec region;
int n;
BoxPtr pbox;
CompositeFunc func = 0;
Bool srcRepeat = pSrc->repeat;
Bool maskRepeat = FALSE;
Bool srcAlphaMap = pSrc->alphaMap != 0;
Bool maskAlphaMap = FALSE;
Bool dstAlphaMap = pDst->alphaMap != 0;
int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
int w, h, w_this, h_this;
int dstDepth = pDst->pDrawable->depth;
int oldFormat = pDst->format;
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (pMask)
{
xMask += pMask->pDrawable->x;
yMask += pMask->pDrawable->y;
maskRepeat = pMask->repeat;
maskAlphaMap = pMask->alphaMap != 0;
}
int oldDepth = pDst->pDrawable->depth;
int oldFormat = pDst->format;
/*
* We can use the more optimized fbpict code, but it sets bits above
* the depth to zero. Temporarily adjust destination depth if needed.
@ -198,6 +158,7 @@ SafeAlphaComposite (CARD8 op,
{
pDst->pDrawable->depth = 32;
}
/* For rootless preserve the alpha in x8r8g8b8 which really is
* a8r8g8b8
*/
@ -205,441 +166,34 @@ SafeAlphaComposite (CARD8 op,
{
pDst->format = PICT_a8r8g8b8;
}
if (!pSrc->transform && !(pMask && pMask->transform))
if (!maskAlphaMap && !srcAlphaMap && !dstAlphaMap)
switch (op) {
case PictOpSrc:
#ifdef USE_MMX
if (!pMask && pSrc->format == pDst->format &&
pSrc->pDrawable != pDst->pDrawable)
{
func = fbCompositeCopyAreammx;
}
#endif
break;
case PictOpOver:
if (pMask)
{
if (srcRepeat &&
pSrc->pDrawable->width == 1 &&
pSrc->pDrawable->height == 1)
{
srcRepeat = FALSE;
if (PICT_FORMAT_COLOR(pSrc->format)) {
switch (pMask->format) {
case PICT_a8:
switch (pDst->format) {
case PICT_r5g6b5:
case PICT_b5g6r5:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSolidMask_nx8x0565mmx;
else
#endif
func = fbCompositeSolidMask_nx8x0565;
break;
case PICT_r8g8b8:
case PICT_b8g8r8:
func = fbCompositeSolidMask_nx8x0888;
break;
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
func = SafeAlphaCompositeSolidMask_nx8x8888;
break;
}
break;
case PICT_a8r8g8b8:
if (pMask->componentAlpha) {
switch (pDst->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSolidMask_nx8888x8888Cmmx;
else
#endif
func = fbCompositeSolidMask_nx8888x8888C;
break;
case PICT_r5g6b5:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSolidMask_nx8888x0565Cmmx;
else
#endif
func = fbCompositeSolidMask_nx8888x0565C;
break;
}
}
break;
case PICT_a8b8g8r8:
if (pMask->componentAlpha) {
switch (pDst->format) {
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSolidMask_nx8888x8888Cmmx;
else
#endif
func = fbCompositeSolidMask_nx8888x8888C;
break;
case PICT_b5g6r5:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSolidMask_nx8888x0565Cmmx;
else
#endif
func = fbCompositeSolidMask_nx8888x0565C;
break;
}
}
break;
case PICT_a1:
switch (pDst->format) {
case PICT_r5g6b5:
case PICT_b5g6r5:
case PICT_r8g8b8:
case PICT_b8g8r8:
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
func = fbCompositeSolidMask_nx1xn;
break;
}
break;
}
}
}
else /* has mask and non-repeating source */
{
if (pSrc->pDrawable == pMask->pDrawable &&
xSrc == xMask && ySrc == yMask &&
!pMask->componentAlpha)
{
/* source == mask: non-premultiplied data */
switch (pSrc->format) {
case PICT_x8b8g8r8:
switch (pMask->format) {
case PICT_a8r8g8b8:
case PICT_a8b8g8r8:
switch (pDst->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888RevNPx8888mmx;
#endif
break;
case PICT_r5g6b5:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888RevNPx0565mmx;
#endif
break;
}
break;
}
break;
case PICT_x8r8g8b8:
switch (pMask->format) {
case PICT_a8r8g8b8:
case PICT_a8b8g8r8:
switch (pDst->format) {
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888RevNPx8888mmx;
#endif
break;
case PICT_r5g6b5:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888RevNPx0565mmx;
#endif
break;
}
break;
}
break;
}
break;
}
else
{
/* non-repeating source, repeating mask => translucent window */
if (maskRepeat &&
pMask->pDrawable->width == 1 &&
pMask->pDrawable->height == 1)
{
if (pSrc->format == PICT_x8r8g8b8 &&
pDst->format == PICT_x8r8g8b8 &&
pMask->format == PICT_a8)
{
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888x8x8888mmx;
#endif
}
}
}
}
}
else /* no mask */
{
if (srcRepeat &&
pSrc->pDrawable->width == 1 &&
pSrc->pDrawable->height == 1)
{
/* no mask and repeating source */
switch (pSrc->format) {
case PICT_a8r8g8b8:
switch (pDst->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
#ifdef USE_MMX
if (fbHaveMMX())
{
srcRepeat = FALSE;
func = fbCompositeSolid_nx8888mmx;
}
#endif
break;
case PICT_r5g6b5:
#ifdef USE_MMX
if (fbHaveMMX())
{
srcRepeat = FALSE;
func = fbCompositeSolid_nx0565mmx;
}
#endif
break;
}
break;
}
}
else
{
switch (pSrc->format) {
case PICT_a8r8g8b8:
switch (pDst->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888x8888mmx;
else
#endif
func = fbCompositeSrc_8888x8888;
break;
case PICT_r8g8b8:
func = fbCompositeSrc_8888x0888;
break;
case PICT_r5g6b5:
func = fbCompositeSrc_8888x0565;
break;
}
break;
case PICT_x8r8g8b8:
switch (pDst->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeCopyAreammx;
#endif
break;
}
case PICT_x8b8g8r8:
switch (pDst->format) {
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeCopyAreammx;
#endif
break;
}
break;
case PICT_a8b8g8r8:
switch (pDst->format) {
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrc_8888x8888mmx;
else
#endif
func = fbCompositeSrc_8888x8888;
break;
case PICT_b8g8r8:
func = fbCompositeSrc_8888x0888;
break;
case PICT_b5g6r5:
func = fbCompositeSrc_8888x0565;
break;
}
break;
case PICT_r5g6b5:
switch (pDst->format) {
case PICT_r5g6b5:
func = fbCompositeSrc_0565x0565;
break;
}
break;
case PICT_b5g6r5:
switch (pDst->format) {
case PICT_b5g6r5:
func = fbCompositeSrc_0565x0565;
break;
}
break;
}
}
}
break;
case PictOpAdd:
if (pMask == 0)
{
switch (pSrc->format) {
case PICT_a8r8g8b8:
switch (pDst->format) {
case PICT_a8r8g8b8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrcAdd_8888x8888mmx;
else
#endif
func = fbCompositeSrcAdd_8888x8888;
break;
}
break;
case PICT_a8b8g8r8:
switch (pDst->format) {
case PICT_a8b8g8r8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrcAdd_8888x8888mmx;
else
#endif
func = fbCompositeSrcAdd_8888x8888;
break;
}
break;
case PICT_a8:
switch (pDst->format) {
case PICT_a8:
#ifdef USE_MMX
if (fbHaveMMX())
func = fbCompositeSrcAdd_8000x8000mmx;
else
#endif
func = fbCompositeSrcAdd_8000x8000;
break;
}
break;
case PICT_a1:
switch (pDst->format) {
case PICT_a1:
func = fbCompositeSrcAdd_1000x1000;
break;
}
break;
}
}
break;
}
if (!func) {
/* no fast path, use the general code */
fbCompositeGeneral(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
// Reset destination depth and format to their true value
pDst->pDrawable->depth = dstDepth;
pDst->format = oldFormat;
return;
}
if (!miComputeCompositeRegion (&region,
pSrc,
pMask,
pDst,
xSrc,
ySrc,
xMask,
yMask,
xDst,
yDst,
width,
height))
return;
n = REGION_NUM_RECTS (&region);
pbox = REGION_RECTS (&region);
while (n--)
if (pSrc->pDrawable && pMask->pDrawable &&
!pSrc->transform && !pMask->transform &&
!pSrc->alphaMap && !pMask->alphaMap &&
!pMask->repeat && !pMask->componentAlpha && !pDst->alphaMap &&
pMask->format == PICT_a8 &&
pSrc->repeatType == RepeatNormal &&
pSrc->pDrawable->width == 1 &&
pSrc->pDrawable->height == 1 &&
(pDst->format == PICT_a8r8g8b8 ||
pDst->format == PICT_x8r8g8b8 ||
pDst->format == PICT_a8b8g8r8 ||
pDst->format == PICT_x8b8g8r8))
{
h = pbox->y2 - pbox->y1;
y_src = pbox->y1 - yDst + ySrc;
y_msk = pbox->y1 - yDst + yMask;
y_dst = pbox->y1;
while (h)
{
h_this = h;
w = pbox->x2 - pbox->x1;
x_src = pbox->x1 - xDst + xSrc;
x_msk = pbox->x1 - xDst + xMask;
x_dst = pbox->x1;
if (maskRepeat)
{
y_msk = mod (y_msk, pMask->pDrawable->height);
if (h_this > pMask->pDrawable->height - y_msk)
h_this = pMask->pDrawable->height - y_msk;
}
if (srcRepeat)
{
y_src = mod (y_src, pSrc->pDrawable->height);
if (h_this > pSrc->pDrawable->height - y_src)
h_this = pSrc->pDrawable->height - y_src;
}
while (w)
{
w_this = w;
if (maskRepeat)
{
x_msk = mod (x_msk, pMask->pDrawable->width);
if (w_this > pMask->pDrawable->width - x_msk)
w_this = pMask->pDrawable->width - x_msk;
}
if (srcRepeat)
{
x_src = mod (x_src, pSrc->pDrawable->width);
if (w_this > pSrc->pDrawable->width - x_src)
w_this = pSrc->pDrawable->width - x_src;
}
(*func) (op, pSrc, pMask, pDst,
x_src, y_src, x_msk, y_msk, x_dst, y_dst,
w_this, h_this);
w -= w_this;
x_src += w_this;
x_msk += w_this;
x_dst += w_this;
}
h -= h_this;
y_src += h_this;
y_msk += h_this;
y_dst += h_this;
}
pbox++;
fbWalkCompositeRegion (op, pSrc, pMask, pDst,
xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height,
TRUE /* srcRepeat */,
FALSE /* maskRepeat */,
SafeAlphaCompositeSolidMask_nx8x8888);
}
else
{
fbComposite (op, pSrc, pMask, pDst,
xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
}
REGION_UNINIT (pDst->pDrawable->pScreen, &region);
// Reset destination depth/format to its true value
pDst->pDrawable->depth = dstDepth;
pDst->pDrawable->depth = oldDepth;
pDst->format = oldFormat;
}

View File

@ -428,6 +428,14 @@ RRXineramaExtensionInit(void)
return;
#endif
/*
* Xinerama isn't capable enough to have multiple protocol screens each
* with their own output geometry. So if there's more than one protocol
* screen, just don't even try.
*/
if (screenInfo.numScreens > 1)
return;
(void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
ProcRRXineramaDispatch,
SProcRRXineramaDispatch,

View File

@ -890,54 +890,22 @@ static unsigned int INTERPOLATE_PIXEL_256(unsigned int x, unsigned int a,
return x;
}
static void initGradientColorTable(SourcePictPtr pGradient, int *error)
CARD32
PictureGradientColor (PictGradientStopPtr stop1,
PictGradientStopPtr stop2,
CARD32 x)
{
int begin_pos, end_pos;
xFixed incr, dpos;
int pos, current_stop;
PictGradientStopPtr stops = pGradient->linear.stops;
int nstops = pGradient->linear.nstops;
CARD32 current_color, next_color;
int dist, idist;
/* The position where the gradient begins and ends */
begin_pos = (stops[0].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16;
end_pos = (stops[nstops - 1].x * PICT_GRADIENT_STOPTABLE_SIZE) >> 16;
current_color = xRenderColorToCard32 (stop1->color);
next_color = xRenderColorToCard32 (stop2->color);
pos = 0; /* The position in the color table. */
dist = (int) (256 * (x - stop1->x) / (stop2->x - stop1->x));
idist = 256 - dist;
/* Up to first point */
while (pos <= begin_pos) {
pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[0].color);
++pos;
}
incr = (1<<16)/ PICT_GRADIENT_STOPTABLE_SIZE; /* the double increment. */
dpos = incr * pos; /* The position in terms of 0-1. */
current_stop = 0; /* We always interpolate between current and current + 1. */
/* Gradient area */
while (pos < end_pos) {
unsigned int current_color = xRenderColorToCard32(stops[current_stop].color);
unsigned int next_color = xRenderColorToCard32(stops[current_stop + 1].color);
int dist = (int)(256*(dpos - stops[current_stop].x)
/ (stops[current_stop+1].x - stops[current_stop].x));
int idist = 256 - dist;
pGradient->linear.colorTable[pos] = premultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
++pos;
dpos += incr;
if (dpos > stops[current_stop + 1].x)
++current_stop;
}
/* After last point */
while (pos < PICT_GRADIENT_STOPTABLE_SIZE) {
pGradient->linear.colorTable[pos] = xRenderColorToCard32(stops[nstops - 1].color);
++pos;
}
return premultiply (INTERPOLATE_PIXEL_256 (current_color, idist,
next_color, dist));
}
static void initGradient(SourcePictPtr pGradient, int stopCount,
@ -953,26 +921,30 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
dpos = -1;
for (i = 0; i < stopCount; ++i) {
if (stopPoints[i] <= dpos || stopPoints[i] > (1<<16)) {
if (stopPoints[i] < dpos || stopPoints[i] > (1<<16)) {
*error = BadValue;
return;
}
dpos = stopPoints[i];
}
pGradient->linear.stops = xalloc(stopCount*sizeof(PictGradientStop));
if (!pGradient->linear.stops) {
pGradient->gradient.stops = xalloc(stopCount*sizeof(PictGradientStop));
if (!pGradient->gradient.stops) {
*error = BadAlloc;
return;
}
pGradient->linear.nstops = stopCount;
pGradient->gradient.nstops = stopCount;
for (i = 0; i < stopCount; ++i) {
pGradient->linear.stops[i].x = stopPoints[i];
pGradient->linear.stops[i].color = stopColors[i];
pGradient->gradient.stops[i].x = stopPoints[i];
pGradient->gradient.stops[i].color = stopColors[i];
}
initGradientColorTable(pGradient, error);
pGradient->gradient.class = SourcePictClassUnknown;
pGradient->gradient.stopRange = 0xffff;
pGradient->gradient.colorTable = NULL;
pGradient->gradient.colorTableSize = 0;
}
static PicturePtr createSourcePicture(void)
@ -980,9 +952,9 @@ static PicturePtr createSourcePicture(void)
PicturePtr pPicture;
pPicture = (PicturePtr) xalloc(sizeof(PictureRec));
pPicture->pDrawable = 0;
pPicture->format = PICT_a8r8g8b8;
pPicture->pFormat = 0;
pPicture->pNext = 0;
pPicture->format = PICT_a8r8g8b8;
pPicture->devPrivates = 0;
SetPictureToDefaults(pPicture);
@ -1027,10 +999,6 @@ CreateLinearGradientPicture (Picture pid, xPointFixed *p1, xPointFixed *p2,
*error = BadAlloc;
return 0;
}
if (p1->x == p2->x && p1->y == p2->y) {
*error = BadValue;
return 0;
}
pPicture->id = pid;
pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictLinearGradient));
@ -1072,14 +1040,6 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
*error = BadAlloc;
return 0;
}
{
double dx = (double)(inner->x - outer->x);
double dy = (double)(inner->y - outer->y);
if (sqrt(dx*dx + dy*dy) + (double)(innerRadius) > (double)(outerRadius)) {
*error = BadValue;
return 0;
}
}
pPicture->id = pid;
pPicture->pSourcePict = (SourcePictPtr) xalloc(sizeof(PictRadialGradient));
@ -1091,22 +1051,19 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
radial = &pPicture->pSourcePict->radial;
radial->type = SourcePictTypeRadial;
{
double x = (double)innerRadius / (double)outerRadius;
radial->dx = (outer->x - inner->x);
radial->dy = (outer->y - inner->y);
radial->fx = (inner->x) - x*radial->dx;
radial->fy = (inner->y) - x*radial->dy;
radial->m = 1./(1+x);
radial->b = -x*radial->m;
radial->dx /= 65536.;
radial->dy /= 65536.;
radial->fx /= 65536.;
radial->fy /= 65536.;
x = outerRadius/65536.;
radial->a = x*x - radial->dx*radial->dx - radial->dy*radial->dy;
}
radial->c1.x = inner->x;
radial->c1.y = inner->y;
radial->c1.radius = innerRadius;
radial->c2.x = outer->x;
radial->c2.y = outer->y;
radial->c2.radius = outerRadius;
radial->cdx = (radial->c2.x - radial->c1.x) / 65536.;
radial->cdy = (radial->c2.y - radial->c1.y) / 65536.;
radial->dr = (radial->c2.radius - radial->c1.radius) / 65536.;
radial->A = ( radial->cdx * radial->cdx
+ radial->cdy * radial->cdy
- radial->dr * radial->dr);
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
xfree(pPicture);
@ -1627,13 +1584,17 @@ FreePicture (pointer value,
{
if (pPicture->transform)
xfree (pPicture->transform);
if (!pPicture->pDrawable) {
if (pPicture->pSourcePict) {
if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
xfree(pPicture->pSourcePict->linear.stops);
xfree(pPicture->pSourcePict);
}
} else {
if (pPicture->pSourcePict)
{
if (pPicture->pSourcePict->type != SourcePictTypeSolidFill)
xfree(pPicture->pSourcePict->linear.stops);
xfree(pPicture->pSourcePict);
}
if (pPicture->pDrawable)
{
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen);
@ -1918,9 +1879,6 @@ AddTraps (PicturePtr pPicture,
(*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps);
}
#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff)
#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31))
_X_EXPORT Bool
PictureTransformPoint3d (PictTransformPtr transform,
PictVectorPtr vector)

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