summaryrefslogtreecommitdiff
path: root/exa/exa_offscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'exa/exa_offscreen.c')
-rw-r--r--exa/exa_offscreen.c70
1 files changed, 60 insertions, 10 deletions
diff --git a/exa/exa_offscreen.c b/exa/exa_offscreen.c
index fd3599e8c..7708dd739 100644
--- a/exa/exa_offscreen.c
+++ b/exa/exa_offscreen.c
@@ -81,15 +81,14 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
* @param save callback for when the area is evicted from memory
* @param privdata private data for the save callback.
*
- * Allocates offscreen memory from the device associated with pScreen. size and
- * align deteremine where and how large the allocated area is, and locked will
- * mark whether it should be held in card memory. privdata may be any pointer
- * for the save callback when the area is removed.
+ * Allocates offscreen memory from the device associated with pScreen. size
+ * and align deteremine where and how large the allocated area is, and locked
+ * will mark whether it should be held in card memory. privdata may be any
+ * pointer for the save callback when the area is removed.
*
- * Note that locked areas do get evicted on VT switch, because during that time
- * all offscreen memory becomes inaccessible. This may change in the future,
- * but drivers should be aware of this and provide a callback to mark that their
- * locked allocation was evicted, and then restore it if necessary on EnterVT.
+ * Note that locked areas do get evicted on VT switch unless the driver
+ * requested version 2.1 or newer behavior. In that case, the save callback is
+ * still called.
*/
ExaOffscreenArea *
exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
@@ -256,6 +255,9 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
return area;
}
+/**
+ * Ejects all offscreen areas, and uninitializes the offscreen memory manager.
+ */
void
ExaOffscreenSwapOut (ScreenPtr pScreen)
{
@@ -283,12 +285,56 @@ ExaOffscreenSwapOut (ScreenPtr pScreen)
ExaOffscreenFini (pScreen);
}
+/** Ejects all pixmaps managed by EXA. */
+static void
+ExaOffscreenEjectPixmaps (ScreenPtr pScreen)
+{
+ ExaScreenPriv (pScreen);
+
+ ExaOffscreenValidate (pScreen);
+ /* loop until a single free area spans the space */
+ for (;;)
+ {
+ ExaOffscreenArea *area;
+
+ for (area = pExaScr->info->offScreenAreas; area != NULL;
+ area = area->next)
+ {
+ if (area->state == ExaOffscreenRemovable &&
+ area->save == exaPixmapSave)
+ {
+ (void) ExaOffscreenKickOut (pScreen, area);
+ ExaOffscreenValidate (pScreen);
+ break;
+ }
+ }
+ if (area == NULL)
+ break;
+ }
+ ExaOffscreenValidate (pScreen);
+}
+
void
ExaOffscreenSwapIn (ScreenPtr pScreen)
{
exaOffscreenInit (pScreen);
}
+/**
+ * Prepares EXA for disabling of FB access, or restoring it.
+ *
+ * In version 2.1, the disabling results in pixmaps being ejected, while other
+ * allocations remain. With this plus the prevention of migration while
+ * swappedOut is set, EXA by itself should not cause any access of the
+ * framebuffer to occur while swapped out. Any remaining issues are the
+ * responsibility of the driver.
+ *
+ * Prior to version 2.1, all allocations, including locked ones, are ejected
+ * when access is disabled, and the allocator is torn down while swappedOut
+ * is set. This is more drastic, and caused implementation difficulties for
+ * many drivers that could otherwise handle the lack of FB access while
+ * swapped out.
+ */
void
exaEnableDisableFBAccess (int index, Bool enable)
{
@@ -296,10 +342,14 @@ exaEnableDisableFBAccess (int index, Bool enable)
ExaScreenPriv (pScreen);
if (!enable) {
- ExaOffscreenSwapOut (pScreen);
+ if (pExaScr->info->exa_minor < 1)
+ ExaOffscreenSwapOut (pScreen);
+ else
+ ExaOffscreenEjectPixmaps (pScreen);
pExaScr->swappedOut = TRUE;
} else {
- ExaOffscreenSwapIn (pScreen);
+ if (pExaScr->info->exa_minor < 1)
+ ExaOffscreenSwapIn (pScreen);
pExaScr->swappedOut = FALSE;
}
}