exa: implement exaMoveInPixmap for "mixed"

- This can be used to force creation of driver pixmap.
- Not for 1 or 4 bpp.
- Driver can still fail (driver) pixmap creation.
This commit is contained in:
Maarten Maathuis 2009-08-05 16:12:16 +02:00
parent 9d2a7128d3
commit e8ac2ed5dc
5 changed files with 59 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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 };

View File

@ -170,3 +170,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);
}

View File

@ -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 */