summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2010-07-13 14:56:53 +0200
committerKeith Packard <keithp@keithp.com>2010-07-13 10:07:04 -0700
commit0540c46066f938ad5611c56081cfcd8457a9b718 (patch)
tree24f3b8c593ca490657e3a36792954d781eabe36c
parentd75e8146c414bfd512ba5dbd4a83acb334bbe19b (diff)
EXA: Finish access to pixmap if it's prepared at destruction time.
Previously we assumed every pixmap destroyed during a software fallback was also created during a software fallback and had access prepared, but that's not always true. Fixes a server abort Reported-by: 邓逸昕 <bupt.dengyixin@gmail.com> Signed-off-by: Michel Dänzer <daenzer@vmware.com> Acked-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--exa/exa.c23
-rw-r--r--exa/exa_classic.c4
-rw-r--r--exa/exa_driver.c4
-rw-r--r--exa/exa_mixed.c4
-rw-r--r--exa/exa_priv.h3
5 files changed, 29 insertions, 9 deletions
diff --git a/exa/exa.c b/exa/exa.c
index 118a11098..fc15c2471 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -435,6 +435,29 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
(*pExaScr->info->FinishAccess) (pPixmap, i);
}
+
+/**
+ * Helper for things common to all schemes when a pixmap is destroyed
+ */
+void
+exaDestroyPixmap(PixmapPtr pPixmap)
+{
+ ExaScreenPriv(pPixmap->drawable.pScreen);
+ int i;
+
+ /* Finish access if it was prepared (e.g. pixmap created during
+ * software fallback)
+ */
+ for (i = 0; i < EXA_NUM_PREPARE_INDICES; i++) {
+ if (pExaScr->access[i].pixmap == pPixmap) {
+ exaFinishAccess(&pPixmap->drawable, i);
+ pExaScr->access[i].pixmap = NULL;
+ break;
+ }
+ }
+}
+
+
/**
* Here begins EXA's GC code.
* Do not ever access the fb/mi layer directly.
diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index 2cfeda5fa..169ce3aac 100644
--- a/exa/exa_classic.c
+++ b/exa/exa_classic.c
@@ -221,9 +221,7 @@ exaDestroyPixmap_classic (PixmapPtr pPixmap)
{
ExaPixmapPriv (pPixmap);
- /* During a fallback we must finish access, but we don't know the index. */
- if (pExaScr->fallback_counter)
- exaFinishAccess(&pPixmap->drawable, -1);
+ exaDestroyPixmap(pPixmap);
if (pExaPixmap->area)
{
diff --git a/exa/exa_driver.c b/exa/exa_driver.c
index abe79baad..a913cfb02 100644
--- a/exa/exa_driver.c
+++ b/exa/exa_driver.c
@@ -193,9 +193,7 @@ exaDestroyPixmap_driver (PixmapPtr pPixmap)
{
ExaPixmapPriv (pPixmap);
- /* During a fallback we must finish access, but we don't know the index. */
- if (pExaScr->fallback_counter)
- exaFinishAccess(&pPixmap->drawable, -1);
+ exaDestroyPixmap(pPixmap);
if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 7fa771d49..ef20eb502 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -245,9 +245,7 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
{
ExaPixmapPriv (pPixmap);
- /* During a fallback we must finish access, but we don't know the index. */
- if (pExaScr->fallback_counter)
- exaFinishAccess(&pPixmap->drawable, -1);
+ exaDestroyPixmap(pPixmap);
if (pExaScr->deferred_mixed_pixmap == pPixmap)
pExaScr->deferred_mixed_pixmap = NULL;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 58d04b0de..e5d90d468 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -551,6 +551,9 @@ void
exaFinishAccess(DrawablePtr pDrawable, int index);
void
+exaDestroyPixmap(PixmapPtr pPixmap);
+
+void
exaPixmapDirty(PixmapPtr pPix, int x1, int y1, int x2, int y2);
void