[PATCH 4/5] exa: implement exaMoveInPixmap for "mixed"

Maarten Maathuis madman2003 at gmail.com
Wed Aug 5 11:12:03 PDT 2009


- This can be used to force creation of driver pixmap.
- Not for 1 or 4 bpp.
- Driver can still fail (driver) pixmap creation.
---
 exa/exa.c                   |   32 ++++++++++++++++++++++++++++++++
 exa/exa.h                   |    2 +-
 exa/exa_migration_classic.c |    4 ++--
 exa/exa_migration_mixed.c   |   13 +++++++++++++
 exa/exa_priv.h              |   11 +++++++++++
 5 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/exa/exa.c b/exa/exa.c
index fd9ba90..32a1c3e 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -1059,12 +1059,16 @@ exaDriverInit (ScreenPtr		pScreen,
 		wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_mixed);
 		pExaScr->do_migration = exaDoMigration_mixed;
 		pExaScr->pixmap_is_offscreen = exaPixmapIsOffscreen_mixed;
+		pExaScr->do_move_in_pixmap = exaMoveInPixmap_mixed;
+		pExaScr->do_move_out_pixmap = NULL;
 	    } else {
 		wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
 		wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
 		wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_driver);
 		pExaScr->do_migration = NULL;
 		pExaScr->pixmap_is_offscreen = exaPixmapIsOffscreen_driver;
+		pExaScr->do_move_in_pixmap = NULL;
+		pExaScr->do_move_out_pixmap = NULL;
 	    }
 	} else {
 	    wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
@@ -1072,6 +1076,8 @@ exaDriverInit (ScreenPtr		pScreen,
 	    wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader_classic);
 	    pExaScr->do_migration = exaDoMigration_classic;
 	    pExaScr->pixmap_is_offscreen = exaPixmapIsOffscreen_classic;
+	    pExaScr->do_move_in_pixmap = exaMoveInPixmap_classic;
+	    pExaScr->do_move_out_pixmap = exaMoveOutPixmap_classic;
 	}
 	if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
 	    LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n",
@@ -1188,3 +1194,29 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
     if (pExaScr->do_migration)
 	(*pExaScr->do_migration)(pixmaps, npixmaps, can_accel);
 }
+
+void
+exaMoveInPixmap (PixmapPtr pPixmap)
+{
+    ScreenPtr pScreen = pPixmap->drawable.pScreen;
+    ExaScreenPriv(pScreen);
+
+    if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
+	return;
+
+    if (pExaScr->do_move_in_pixmap)
+	(*pExaScr->do_move_in_pixmap)(pPixmap);
+}
+
+void
+exaMoveOutPixmap (PixmapPtr pPixmap)
+{
+    ScreenPtr pScreen = pPixmap->drawable.pScreen;
+    ExaScreenPriv(pScreen);
+
+    if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
+	return;
+
+    if (pExaScr->do_move_out_pixmap)
+	(*pExaScr->do_move_out_pixmap)(pPixmap);
+}
diff --git a/exa/exa.h b/exa/exa.h
index 40ac1dd..46d12b7 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -815,7 +815,7 @@ exaEnableDisableFBAccess (int index, Bool enable);
 extern _X_EXPORT Bool
 exaDrawableIsOffscreen (DrawablePtr pDrawable);
 
-/* in exa_migration.c */
+/* in exa.c */
 extern _X_EXPORT void
 exaMoveInPixmap (PixmapPtr pPixmap);
 
diff --git a/exa/exa_migration_classic.c b/exa/exa_migration_classic.c
index 8355959..d8e1e86 100644
--- a/exa/exa_migration_classic.c
+++ b/exa/exa_migration_classic.c
@@ -366,7 +366,7 @@ exaDoMoveInPixmap (ExaMigrationPtr migrate)
 }
 
 void
-exaMoveInPixmap (PixmapPtr pPixmap)
+exaMoveInPixmap_classic (PixmapPtr pPixmap)
 {
     static ExaMigrationRec migrate = { .as_dst = FALSE, .as_src = TRUE,
 				       .pReg = NULL };
@@ -407,7 +407,7 @@ exaDoMoveOutPixmap (ExaMigrationPtr migrate)
 }
 
 void
-exaMoveOutPixmap (PixmapPtr pPixmap)
+exaMoveOutPixmap_classic (PixmapPtr pPixmap)
 {
     static ExaMigrationRec migrate = { .as_dst = FALSE, .as_src = TRUE,
 				       .pReg = NULL };
diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 88077a3..49b1934 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -171,3 +171,16 @@ exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
 	    exaCreateDriverPixmap_mixed(pPixmap);
     }
 }
+
+void
+exaMoveInPixmap_mixed(PixmapPtr pPixmap)
+{
+    ExaMigrationRec pixmaps[1];
+
+    pixmaps[0].as_dst = FALSE;
+    pixmaps[0].as_src = TRUE;
+    pixmaps[0].pPix = pPixmap;
+    pixmaps[0].pReg = NULL;
+
+    exaDoMigration(pixmaps, 1, TRUE);
+}
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 620bc67..869cf17 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -174,6 +174,8 @@ typedef struct {
 #endif
     void (*do_migration) (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
     Bool (*pixmap_is_offscreen) (PixmapPtr pPixmap);
+    void (*do_move_in_pixmap) (PixmapPtr pPixmap);
+    void (*do_move_out_pixmap) (PixmapPtr pPixmap);
 
     Bool			 swappedOut;
     enum ExaMigrationHeuristic	 migration;
@@ -604,6 +606,9 @@ exaCreateDriverPixmap_mixed(PixmapPtr pPixmap);
 void
 exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
 
+void
+exaMoveInPixmap_mixed(PixmapPtr pPixmap);
+
 /* exa_render.c */
 Bool
 exaOpReadsDestination (CARD8 op);
@@ -665,4 +670,10 @@ exaDoMigration_classic (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
 void
 exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
 
+void
+exaMoveOutPixmap_classic (PixmapPtr pPixmap);
+
+void
+exaMoveInPixmap_classic (PixmapPtr pPixmap);
+
 #endif /* EXAPRIV_H */
-- 
1.6.4



More information about the xorg-devel mailing list