xserver: Branch 'master' - 5 commits
Michel Daenzer
daenzer at kemper.freedesktop.org
Fri Aug 24 05:12:07 PDT 2007
GL/glx/glxdri.c | 17 +++++++-----
Xext/shm.c | 4 +-
Xext/shmint.h | 3 ++
exa/exa.c | 6 ----
exa/exa_accel.c | 71 ++++++++++++++++++++++++++++++++++++++--------------
exa/exa_migration.c | 8 ++++-
exa/exa_priv.h | 7 +++++
7 files changed, 81 insertions(+), 35 deletions(-)
New commits:
diff-tree d0f0d1092c7587a02404e1db07740e6334462ba6 (from 5d9e2c282145897008d7d941e2a0a3fdc71f2373)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Fri Aug 24 14:10:13 2007 +0200
exaGetImage: Don't migrate pixmap out of FB with no DownloadFromScreen hook.
Based on the assumption that GetImage is relatively rare, so the overhead of
the migration is probably bigger than any potential savings.
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 3af5c6e..692f2b8 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -1357,7 +1357,7 @@ exaGetImage (DrawablePtr pDrawable, int
goto fallback;
if (pExaScr->info->DownloadFromScreen == NULL)
- goto migrate_and_fallback;
+ goto fallback;
/* Only cover the ZPixmap, solid copy case. */
if (format != ZPixmap || !EXA_PM_IS_SOLID(pDrawable, planeMask))
diff-tree 5d9e2c282145897008d7d941e2a0a3fdc71f2373 (from 6085522d91e875c0e1ab8d4300e7378701c19b7c)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Fri Aug 24 14:03:14 2007 +0200
EXA: Improve ShmPutImage.
Share as much code with exaPutImage as possible, and fall back to fbShmPutImage
when that fails.
diff --git a/exa/exa.c b/exa/exa.c
index b2faf2f..d827fc6 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -32,10 +32,6 @@
#include <dix-config.h>
#endif
-#ifdef MITSHM
-#include "shmint.h"
-#endif
-
#include <stdlib.h>
#include "exa_priv.h"
@@ -696,7 +692,7 @@ exaDriverInit (ScreenPtr pScreen,
* Shared pixmaps are almost always a performance loss for us, but this
* still allows for SHM PutImage.
*/
- ShmRegisterFuncs(pScreen, NULL);
+ ShmRegisterFuncs(pScreen, &exaShmFuncs);
#endif
/*
* Hookup offscreen pixmaps
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index cc383cc..3af5c6e 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -138,9 +138,9 @@ exaFillSpans(DrawablePtr pDrawable, GCPt
exaMarkSync(pScreen);
}
-static void
-exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *bits)
+static Bool
+exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits, int src_stride)
{
ExaScreenPriv (pDrawable->pScreen);
PixmapPtr pPix;
@@ -149,7 +149,8 @@ exaPutImage (DrawablePtr pDrawable, GCPt
BoxPtr pbox;
int nbox;
int xoff, yoff;
- int src_stride, bpp = pDrawable->bitsPerPixel;
+ int bpp = pDrawable->bitsPerPixel;
+ Bool access_prepared = FALSE;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
@@ -168,19 +169,12 @@ exaPutImage (DrawablePtr pDrawable, GCPt
exaDoMigration (pixmaps, 1, TRUE);
- if (pExaScr->info->UploadToScreen == NULL)
- goto fallback;
-
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
- if (pPix == NULL)
- goto fallback;
-
x += pDrawable->x;
y += pDrawable->y;
pClip = fbGetCompositeClip(pGC);
- src_stride = PixmapBytePad(w, pDrawable->depth);
for (nbox = REGION_NUM_RECTS(pClip),
pbox = REGION_RECTS(pClip);
nbox--;
@@ -205,8 +199,10 @@ exaPutImage (DrawablePtr pDrawable, GCPt
continue;
src = bits + (y1 - y) * src_stride + (x1 - x) * (bpp / 8);
- ok = pExaScr->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
- x2 - x1, y2 - y1, src, src_stride);
+ ok = (pPix && pExaScr->info->UploadToScreen) ?
+ pExaScr->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
+ x2 - x1, y2 - y1, src, src_stride) :
+ FALSE;
/* If we fail to accelerate the upload, fall back to using unaccelerated
* fb calls.
*/
@@ -216,7 +212,11 @@ exaPutImage (DrawablePtr pDrawable, GCPt
int dstBpp;
int dstXoff, dstYoff;
- exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+ if (!access_prepared) {
+ exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
+
+ access_prepared = TRUE;
+ }
fbGetStipDrawable(pDrawable, dst, dst_stride, dstBpp,
dstXoff, dstYoff);
@@ -230,22 +230,55 @@ exaPutImage (DrawablePtr pDrawable, GCPt
(x2 - x1) * dstBpp,
y2 - y1,
GXcopy, FB_ALLONES, dstBpp);
+ }
+ if (access_prepared)
exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
- }
- exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
+ exaPixmapDirty(pixmaps[0].pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
}
- return;
+ return TRUE;
migrate_and_fallback:
exaDoMigration (pixmaps, 1, FALSE);
fallback:
- ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
+ return FALSE;
}
+static void
+exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *bits)
+{
+ if (!exaDoPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits,
+ PixmapBytePad(w, pDrawable->depth)))
+ ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
+ bits);
+}
+
+#ifdef MITSHM
+
+static void
+exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
+ int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
+ char *data)
+{
+ int src_stride = PixmapBytePad(w, depth);
+
+ if (exaDoPutImage(pDrawable, pGC, depth, dx, dy, sw, sh, 0, format, data +
+ sy * src_stride + sx * BitsPerPixel(depth) / 8,
+ src_stride))
+ return;
+
+ fbShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
+ data);
+}
+
+ShmFuncs exaShmFuncs = { NULL, exaShmPutImage };
+
+#endif
+
static Bool inline
exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy)
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index bab8aa2..9bed5c8 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -35,6 +35,9 @@
#include <X11/X.h>
#define NEED_EVENTS
#include <X11/Xproto.h>
+#ifdef MITSHM
+#include "shmint.h"
+#endif
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
@@ -306,6 +309,10 @@ exaGetSpans (DrawablePtr pDrawable, int
extern const GCOps exaOps;
+#ifdef MITSHM
+extern ShmFuncs exaShmFuncs;
+#endif
+
#ifdef RENDER
void
ExaCheckComposite (CARD8 op,
diff-tree 6085522d91e875c0e1ab8d4300e7378701c19b7c (from c19f227b468d039c5ea136cc8a53c420da30263b)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Fri Aug 24 14:02:35 2007 +0200
Export fbShmPutImage to modules.
To be used by EXA.
diff --git a/Xext/shm.c b/Xext/shm.c
index 9d82a21..7fa8349 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -57,6 +57,7 @@ in this Software without prior written a
#include "gcstruct.h"
#include "extnsionst.h"
#include "servermd.h"
+#include "shmint.h"
#define _XSHM_SERVER_
#include <X11/extensions/shmstr.h>
#include <X11/Xfuncproto.h>
@@ -78,7 +79,6 @@ typedef struct _ShmDesc {
} ShmDescRec, *ShmDescPtr;
static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
-static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(
pointer /* value */,
@@ -510,7 +510,7 @@ miShmPutImage(dst, pGC, depth, format, w
(*pmap->drawable.pScreen->DestroyPixmap)(pmap);
}
-static void
+_X_EXPORT void
fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
GCPtr pGC;
diff --git a/Xext/shmint.h b/Xext/shmint.h
index fc056bc..33ab6a4 100644
--- a/Xext/shmint.h
+++ b/Xext/shmint.h
@@ -37,6 +37,9 @@ void
ShmSetPixmapFormat(ScreenPtr pScreen, int format);
void
+fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
+
+void
ShmRegisterFbFuncs(ScreenPtr pScreen);
#endif /* _SHMINT_H_ */
diff-tree c19f227b468d039c5ea136cc8a53c420da30263b (from 095850596114178119a8cc854716ce0cc6e05121)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Fri Aug 24 13:05:52 2007 +0200
EXA: Only mark offscreen memory as used when it really is.
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 70d8e12..5f07a8d 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -620,7 +620,6 @@ exaDoMigration (ExaMigrationPtr pixmaps,
/* Now, try to move them all into FB */
for (i = 0; i < npixmaps; i++) {
exaMoveInPixmap(pixmaps[i].pPix);
- ExaOffscreenMarkUsed (pixmaps[i].pPix);
}
/* If we couldn't fit everything in, then kick back out */
@@ -631,8 +630,13 @@ exaDoMigration (ExaMigrationPtr pixmaps,
pixmaps[i].pPix->drawable.height));
for (j = 0; j < npixmaps; j++)
exaMoveOutPixmap(pixmaps[j].pPix);
- break;
+ return;
}
}
+
+ /* Yay, everything's offscreen, mark memory as used */
+ for (i = 0; i < npixmaps; i++) {
+ ExaOffscreenMarkUsed (pixmaps[i].pPix);
+ }
}
}
diff-tree 095850596114178119a8cc854716ce0cc6e05121 (from 3305d17195e3a0a5555300555bd7703312fa489f)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Fri Aug 24 13:04:48 2007 +0200
__glXDRIbindTexImage: Fail if no texture bound to pixmap's texture target.
We would most likely crash somewhere in Mesa if we tried to continue in this
case.
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index 685683d..c1f3eb7 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -374,17 +374,25 @@ __glXDRIbindTexImage(__GLXcontext *baseC
{
RegionPtr pRegion = NULL;
PixmapPtr pixmap;
- int bpp, override = 0;
+ int bpp, override = 0, texname;
GLenum format, type;
ScreenPtr pScreen = glxPixmap->pScreen;
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
+ CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
+ GL_TEXTURE_BINDING_2D :
+ GL_TEXTURE_BINDING_RECTANGLE_NV,
+ &texname));
+
+ if (!texname)
+ return __glXError(GLXBadContextState);
+
pixmap = (PixmapPtr) glxPixmap->pDraw;
if (screen->texOffsetStart && screen->driScreen.setTexOffset) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
- int i, firstEmpty = 16, texname;
+ int i, firstEmpty = 16;
for (i = 0; i < 16; i++) {
if (texOffsetOverride[i] == glxPixmap)
@@ -409,11 +417,6 @@ alreadyin:
glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext;
- CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
- GL_TEXTURE_BINDING_2D :
- GL_TEXTURE_BINDING_RECTANGLE_NV,
- &texname));
-
if (texname == glxPixmap->texname)
return Success;
More information about the xorg-commit
mailing list