aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/exa/exa.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
commit4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch)
treec1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/exa/exa.c
parentdc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff)
downloadvcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/exa/exa.c')
-rw-r--r--xorg-server/exa/exa.c105
1 files changed, 66 insertions, 39 deletions
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c
index 72539c0f3..270810766 100644
--- a/xorg-server/exa/exa.c
+++ b/xorg-server/exa/exa.c
@@ -35,13 +35,12 @@
#include <stdlib.h>
#include "exa_priv.h"
-#include <X11/fonts/fontstruct.h>
-#include "dixfontstr.h"
#include "exa.h"
-#include "cw.h"
-DevPrivateKey exaScreenPrivateKey = &exaScreenPrivateKey;
-DevPrivateKey exaPixmapPrivateKey = &exaPixmapPrivateKey;
+static int exaScreenPrivateKeyIndex;
+DevPrivateKey exaScreenPrivateKey = &exaScreenPrivateKeyIndex;
+static int exaPixmapPrivateKeyIndex;
+DevPrivateKey exaPixmapPrivateKey = &exaPixmapPrivateKeyIndex;
#ifdef MITSHM
static ShmFuncs exaShmFuncs = { NULL, NULL };
@@ -165,7 +164,7 @@ exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
RegionPtr pDamageReg;
RegionRec region;
- if (!pExaPixmap)
+ if (!pExaPixmap || !pExaPixmap->pDamage)
return;
box.x1 = max(x1, 0);
@@ -315,6 +314,11 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
datasize = h * paddedWidth;
+ /* Set this before driver hooks, to allow for !offscreen pixmaps.
+ * !offscreen pixmaps have a valid pointer at all times.
+ */
+ pPixmap->devPrivate.ptr = NULL;
+
pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
if (!pExaPixmap->driverPriv) {
fbDestroyPixmap(pPixmap);
@@ -325,6 +329,9 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
paddedWidth, NULL);
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
pExaPixmap->fb_ptr = NULL;
+ pExaPixmap->pDamage = NULL;
+ pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
+
} else {
pExaPixmap->driverPriv = NULL;
/* Scratch pixmaps may have w/h equal to zero, and may not be
@@ -349,21 +356,24 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
fbDestroyPixmap(pPixmap);
return NULL;
}
- }
-
- pExaPixmap->area = NULL;
- /* Set up damage tracking */
- pExaPixmap->pDamage = DamageCreate (NULL, NULL, DamageReportNone, TRUE,
- pScreen, pPixmap);
+ /* Set up damage tracking */
+ pExaPixmap->pDamage = DamageCreate (NULL, NULL,
+ DamageReportNone, TRUE,
+ pScreen, pPixmap);
- if (pExaPixmap->pDamage == NULL) {
- fbDestroyPixmap (pPixmap);
- return NULL;
- }
+ if (pExaPixmap->pDamage == NULL) {
+ fbDestroyPixmap (pPixmap);
+ return NULL;
+ }
- DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage);
- DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE);
+ DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage);
+ /* This ensures that pending damage reflects the current operation. */
+ /* This is used by exa to optimize migration. */
+ DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE);
+ }
+
+ pExaPixmap->area = NULL;
/* None of the pixmap bits are valid initially */
REGION_NULL(pScreen, &pExaPixmap->validSys);
@@ -501,6 +511,12 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
if (pExaScr->info->PrepareAccess == NULL)
return;
+ if (index >= EXA_PREPARE_AUX0 &&
+ !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
+ exaMoveOutPixmap (pPixmap);
+ return;
+ }
+
if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
ExaPixmapPriv (pPixmap);
if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
@@ -560,6 +576,13 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
if (!exaPixmapIsOffscreen (pPixmap))
return;
+ if (index >= EXA_PREPARE_AUX0 &&
+ !(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
+ ErrorF("EXA bug: Trying to call driver FinishAccess hook with "
+ "unsupported index EXA_PREPARE_AUX*\n");
+ return;
+ }
+
(*pExaScr->info->FinishAccess) (pPixmap, index);
}
@@ -660,34 +683,25 @@ exaCreateGC (GCPtr pGC)
return TRUE;
}
-void
-exaPrepareAccessWindow(WindowPtr pWin)
+static Bool
+exaChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
- if (pWin->backgroundState == BackgroundPixmap)
+ Bool ret;
+
+ if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
exaPrepareAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
- if (pWin->borderIsPixel == FALSE)
- exaPrepareAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_SRC);
-}
+ if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
+ exaPrepareAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
-void
-exaFinishAccessWindow(WindowPtr pWin)
-{
- if (pWin->backgroundState == BackgroundPixmap)
- exaFinishAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
+ ret = fbChangeWindowAttributes(pWin, mask);
- if (pWin->borderIsPixel == FALSE)
- exaFinishAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_SRC);
-}
+ if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
+ exaFinishAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
-static Bool
-exaChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
-{
- Bool ret;
+ if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
+ exaFinishAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
- exaPrepareAccessWindow(pWin);
- ret = fbChangeWindowAttributes(pWin, mask);
- exaFinishAccessWindow(pWin);
return ret;
}
@@ -741,6 +755,9 @@ exaCloseScreen(int i, ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
+ if (ps->Glyphs == exaGlyphs)
+ exaGlyphsFini(pScreen);
+
pScreen->CreateGC = pExaScr->SavedCreateGC;
pScreen->CloseScreen = pExaScr->SavedCloseScreen;
pScreen->GetImage = pExaScr->SavedGetImage;
@@ -754,7 +771,9 @@ exaCloseScreen(int i, ScreenPtr pScreen)
#ifdef RENDER
if (ps) {
ps->Composite = pExaScr->SavedComposite;
+ ps->Glyphs = pExaScr->SavedGlyphs;
ps->Trapezoids = pExaScr->SavedTrapezoids;
+ ps->Triangles = pExaScr->SavedTriangles;
ps->AddTraps = pExaScr->SavedAddTraps;
}
#endif
@@ -917,6 +936,11 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->SavedComposite = ps->Composite;
ps->Composite = exaComposite;
+ if (pScreenInfo->PrepareComposite) {
+ pExaScr->SavedGlyphs = ps->Glyphs;
+ ps->Glyphs = exaGlyphs;
+ }
+
pExaScr->SavedTriangles = ps->Triangles;
ps->Triangles = exaTriangles;
@@ -978,6 +1002,9 @@ exaDriverInit (ScreenPtr pScreen,
}
}
+ if (ps->Glyphs == exaGlyphs)
+ exaGlyphsInit(pScreen);
+
LogMessage(X_INFO, "EXA(%d): Driver registered support for the following"
" operations:\n", pScreen->myNum);
assert(pScreenInfo->PrepareSolid != NULL);