Bug #7639: Only swap out pixmaps (rather than everything) on VT switch in EXA.
This is a new behavior for version 2.1 of EXA, and only takes effect if the driver has requested that. Otherwise, the previous behavior remains the same.
This commit is contained in:
parent
b6b8559321
commit
7a12952fd4
|
@ -39,7 +39,7 @@
|
||||||
#include "fb.h"
|
#include "fb.h"
|
||||||
|
|
||||||
#define EXA_VERSION_MAJOR 2
|
#define EXA_VERSION_MAJOR 2
|
||||||
#define EXA_VERSION_MINOR 0
|
#define EXA_VERSION_MINOR 1
|
||||||
#define EXA_VERSION_RELEASE 0
|
#define EXA_VERSION_RELEASE 0
|
||||||
|
|
||||||
typedef struct _ExaOffscreenArea ExaOffscreenArea;
|
typedef struct _ExaOffscreenArea ExaOffscreenArea;
|
||||||
|
@ -73,8 +73,8 @@ struct _ExaOffscreenArea {
|
||||||
typedef struct _ExaDriver {
|
typedef struct _ExaDriver {
|
||||||
/**
|
/**
|
||||||
* exa_major and exa_minor should be set by the driver to the version of
|
* exa_major and exa_minor should be set by the driver to the version of
|
||||||
* EXA which the driver was compiled for (or configures itself at runtime to
|
* EXA which the driver was compiled for (or configures itself at runtime
|
||||||
* support). This allows EXA to extend the structure for new features
|
* to support). This allows EXA to extend the structure for new features
|
||||||
* without breaking ABI for drivers compiled against older versions.
|
* without breaking ABI for drivers compiled against older versions.
|
||||||
*/
|
*/
|
||||||
int exa_major, exa_minor;
|
int exa_major, exa_minor;
|
||||||
|
|
|
@ -249,7 +249,7 @@ exaCopyDirtyToFb (PixmapPtr pPixmap)
|
||||||
* Called when the memory manager decides it's time to kick the pixmap out of
|
* Called when the memory manager decides it's time to kick the pixmap out of
|
||||||
* framebuffer entirely.
|
* framebuffer entirely.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
|
exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap = area->privData;
|
PixmapPtr pPixmap = area->privData;
|
||||||
|
|
|
@ -81,15 +81,14 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
|
||||||
* @param save callback for when the area is evicted from memory
|
* @param save callback for when the area is evicted from memory
|
||||||
* @param privdata private data for the save callback.
|
* @param privdata private data for the save callback.
|
||||||
*
|
*
|
||||||
* Allocates offscreen memory from the device associated with pScreen. size and
|
* Allocates offscreen memory from the device associated with pScreen. size
|
||||||
* align deteremine where and how large the allocated area is, and locked will
|
* and align deteremine where and how large the allocated area is, and locked
|
||||||
* mark whether it should be held in card memory. privdata may be any pointer
|
* will mark whether it should be held in card memory. privdata may be any
|
||||||
* for the save callback when the area is removed.
|
* pointer for the save callback when the area is removed.
|
||||||
*
|
*
|
||||||
* Note that locked areas do get evicted on VT switch, because during that time
|
* Note that locked areas do get evicted on VT switch unless the driver
|
||||||
* all offscreen memory becomes inaccessible. This may change in the future,
|
* requested version 2.1 or newer behavior. In that case, the save callback is
|
||||||
* but drivers should be aware of this and provide a callback to mark that their
|
* still called.
|
||||||
* locked allocation was evicted, and then restore it if necessary on EnterVT.
|
|
||||||
*/
|
*/
|
||||||
ExaOffscreenArea *
|
ExaOffscreenArea *
|
||||||
exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
||||||
|
@ -256,6 +255,9 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ejects all offscreen areas, and uninitializes the offscreen memory manager.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
ExaOffscreenSwapOut (ScreenPtr pScreen)
|
ExaOffscreenSwapOut (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
|
@ -283,12 +285,56 @@ ExaOffscreenSwapOut (ScreenPtr pScreen)
|
||||||
ExaOffscreenFini (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
|
void
|
||||||
ExaOffscreenSwapIn (ScreenPtr pScreen)
|
ExaOffscreenSwapIn (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
exaOffscreenInit (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
|
void
|
||||||
exaEnableDisableFBAccess (int index, Bool enable)
|
exaEnableDisableFBAccess (int index, Bool enable)
|
||||||
{
|
{
|
||||||
|
@ -296,10 +342,14 @@ exaEnableDisableFBAccess (int index, Bool enable)
|
||||||
ExaScreenPriv (pScreen);
|
ExaScreenPriv (pScreen);
|
||||||
|
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
ExaOffscreenSwapOut (pScreen);
|
if (pExaScr->info->exa_minor < 1)
|
||||||
|
ExaOffscreenSwapOut (pScreen);
|
||||||
|
else
|
||||||
|
ExaOffscreenEjectPixmaps (pScreen);
|
||||||
pExaScr->swappedOut = TRUE;
|
pExaScr->swappedOut = TRUE;
|
||||||
} else {
|
} else {
|
||||||
ExaOffscreenSwapIn (pScreen);
|
if (pExaScr->info->exa_minor < 1)
|
||||||
|
ExaOffscreenSwapIn (pScreen);
|
||||||
pExaScr->swappedOut = FALSE;
|
pExaScr->swappedOut = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,4 +412,7 @@ exaGlyphs (CARD8 op,
|
||||||
void
|
void
|
||||||
exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
|
exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel);
|
||||||
|
|
||||||
|
void
|
||||||
|
exaPixmapSave (ScreenPtr pScreen, ExaOffscreenArea *area);
|
||||||
|
|
||||||
#endif /* EXAPRIV_H */
|
#endif /* EXAPRIV_H */
|
||||||
|
|
Loading…
Reference in New Issue