[PATCH] exa: add low VRAM option.
Dave Airlie
airlied at redhat.com
Sun Sep 27 21:57:50 PDT 2009
From: Dave Airlie <airlied at linux.ie>
This basically stops any accel to non screen pixmap and non
window pixmaps when this option is enabled. It makes my
RN50 at least useable again under KMS.
I'm mainly producing this to open discussions on whether
there is a better way. I'm defining low VRAM as < 32MB.
---
exa/exa.c | 22 ++++++++++++++++++++++
exa/exa.h | 3 +++
exa/exa_migration_mixed.c | 2 +-
exa/exa_priv.h | 2 ++
4 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/exa/exa.c b/exa/exa.c
index 46e9182..76663b4 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -232,6 +232,28 @@ exaPixmapIsPinned (PixmapPtr pPix)
return pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED;
}
+Bool
+exaPixmapLowMemory(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ ExaScreenPriv(pScreen);
+ ExaPixmapPriv (pPix);
+
+ if (pExaPixmap == NULL)
+ EXA_FatalErrorDebugWithRet(("EXA bug: exaPixmapIsPinned was called on a non-exa pixmap.\n"), TRUE);
+
+ if (!(pExaScr->info->flags & EXA_LOW_MEMORY_CARD))
+ return FALSE;
+
+ if (pPix == pScreen->GetScreenPixmap(pScreen))
+ return FALSE;
+
+ if (pPix->drawable.type == DRAWABLE_WINDOW)
+ return FALSE;
+ return TRUE;
+}
+
+
/**
* exaPixmapIsOffscreen() is used to determine if a pixmap is in offscreen
* memory, meaning that acceleration could probably be done to it, and that it
diff --git a/exa/exa.h b/exa/exa.h
index 4b39473..c01455c 100644
--- a/exa/exa.h
+++ b/exa/exa.h
@@ -769,6 +769,9 @@ typedef struct _ExaDriver {
*/
#define EXA_MIXED_PIXMAPS (1 << 6)
+/* enable low memory optimisations */
+#define EXA_LOW_MEMORY_CARD (1 << 7)
+
/** @} */
/* in exa.c */
diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 6065d75..2f60e7b 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -79,7 +79,7 @@ exaDoMigration_mixed(ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
* accelerate.
*/
for (i = 0; i < npixmaps; i++) {
- if (exaPixmapIsPinned (pixmaps[i].pPix) &&
+ if ((exaPixmapIsPinned (pixmaps[i].pPix) || exaPixmapLowMemory(pixmaps[i].pPix)) &&
!exaPixmapIsOffscreen (pixmaps[i].pPix))
{
can_accel = FALSE;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 5b056da..414ad7c 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -691,4 +691,6 @@ exaMoveInPixmap_classic (PixmapPtr pPixmap);
void
exaPrepareAccessReg_classic(PixmapPtr pPixmap, int index, RegionPtr pReg);
+Bool
+exaPixmapLowMemory(PixmapPtr pPix);
#endif /* EXAPRIV_H */
--
1.6.4.2
More information about the xorg-devel
mailing list