xserver: Branch 'master' - 3 commits
Maarten Maathuis
madman2003 at kemper.freedesktop.org
Sat Aug 8 02:39:52 PDT 2009
exa/exa.c | 2 +-
exa/exa_migration_mixed.c | 38 ++++++++++++++++++++------------------
exa/exa_mixed.c | 20 ++++++++++----------
3 files changed, 31 insertions(+), 29 deletions(-)
New commits:
commit d573cc46d3106824902ab4f926617bd9959af57c
Author: Maarten Maathuis <madman2003 at gmail.com>
Date: Sat Aug 8 11:32:05 2009 +0200
exa: more safety
diff --git a/exa/exa.c b/exa/exa.c
index c8fe12e..483e3b4 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -336,7 +336,7 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
if (!offscreen) {
/* Do we need to allocate our system buffer? */
if ((pExaScr->info->flags & EXA_HANDLES_PIXMAPS) && (pExaScr->info->flags & EXA_MIXED_PIXMAPS)) {
- if (!pExaPixmap->sys_ptr) {
+ if (!pExaPixmap->sys_ptr && !exaPixmapIsPinned(pPixmap)) {
pExaPixmap->sys_ptr = malloc(pExaPixmap->sys_pitch * pDrawable->height);
if (!pExaPixmap->sys_ptr)
FatalError("EXA: malloc failed for size %d bytes\n", pExaPixmap->sys_pitch * pDrawable->height);
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index abfa957..7ba62ea 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -82,6 +82,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
datasize = h * paddedWidth;
/* We will allocate the system pixmap later if needed. */
+ pPixmap->devPrivate.ptr = NULL;
pExaPixmap->sys_ptr = NULL;
pExaPixmap->sys_pitch = paddedWidth;
commit 8b652435cd42929e2d187b353b3b20e798569356
Author: Maarten Maathuis <madman2003 at gmail.com>
Date: Sat Aug 8 10:35:01 2009 +0200
exa: minor cleanup
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 0d2552d..abfa957 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -87,7 +87,6 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->area = NULL;
pExaPixmap->offscreen = FALSE;
- pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
pExaPixmap->fb_ptr = NULL;
pExaPixmap->pDamage = NULL;
@@ -95,19 +94,19 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
exaSetAccelBlock(pExaScr, pExaPixmap,
w, h, bpp);
+ /* Avoid freeing sys_ptr. */
+ pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
+
+ (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
+ paddedWidth, NULL);
+
+ /* We want to be able to transfer the pixmap to driver memory later on. */
+ pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
+
/* A scratch pixmap will become a driver pixmap right away. */
if (!w || !h) {
exaCreateDriverPixmap_mixed(pPixmap);
} else {
- /* Avoid freeing sys_ptr. */
- pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
-
- (*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
- paddedWidth, NULL);
-
- /* We want to be able to copy the pixmap to driver memory later on. */
- pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
-
/* Set up damage tracking */
pExaPixmap->pDamage = DamageCreate (NULL, NULL,
DamageReportNone, TRUE,
commit a73f95aa93634cf7ba2c7c9274a046b2df2adca7
Author: Maarten Maathuis <madman2003 at gmail.com>
Date: Sat Aug 8 02:31:23 2009 +0200
exa: Fix the broken upload fallback for "mixed"
- Replace it with something wfb friendly while i'm at it.
diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 91fadc2..ed0cc14 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -32,32 +32,37 @@
#include "exa.h"
static void
-exaUploadFallback(PixmapPtr pPixmap, CARD8 *src, int src_pitch,
- CARD8 *dst, int dst_pitch)
- {
+exaUploadFallback(PixmapPtr pPixmap, CARD8 *src, int src_pitch)
+{
ExaPixmapPriv(pPixmap);
RegionPtr damage = DamageRegion (pExaPixmap->pDamage);
- int i, cpp = pPixmap->drawable.bitsPerPixel / 8;
- int bytes, nbox;
+ GCPtr pGC = GetScratchGC (pPixmap->drawable.depth,
+ pPixmap->drawable.pScreen);
+ int nbox, cpp = pPixmap->drawable.bitsPerPixel / 8;
+ DamagePtr backup = pExaPixmap->pDamage;
BoxPtr pbox;
+ CARD8 *src2;
+
+ /* We don't want damage optimisations. */
+ pExaPixmap->pDamage = NULL;
+ ValidateGC (&pPixmap->drawable, pGC);
pbox = REGION_RECTS(damage);
nbox = REGION_NUM_RECTS(damage);
while (nbox--) {
- bytes = (pbox->x2 - pbox->x1) * cpp;
+ src2 = src + pbox->y1 * src_pitch + pbox->x1 * cpp;
- src += pbox->y1 * src_pitch + pbox->x1 * cpp;
- dst += pbox->y1 * dst_pitch + pbox->x1 * cpp;
-
- for (i = pbox->y2 - pbox->y1; i; i--) {
- memcpy (dst, src, bytes);
- src += src_pitch;
- dst += dst_pitch;
- }
+ ExaCheckPutImage(&pPixmap->drawable, pGC,
+ pPixmap->drawable.depth, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, 0,
+ ZPixmap, (char*) src2);
pbox++;
}
+
+ FreeScratchGC (pGC);
+ pExaPixmap->pDamage = backup;
}
void
@@ -131,10 +136,7 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap)
goto finish;
fallback:
- ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
- exaUploadFallback(pPixmap, sys_buffer, sys_pitch, pPixmap->devPrivate.ptr,
- exaGetPixmapPitch(pPixmap));
- exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
+ exaUploadFallback(pPixmap, sys_buffer, sys_pitch);
finish:
free(sys_buffer);
More information about the xorg-commit
mailing list