summaryrefslogtreecommitdiff
path: root/src/glamo-draw.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2009-02-22 02:51:52 +0100
committerLars-Peter Clausen <lars@metafoo.de>2009-02-22 02:51:52 +0100
commit0e9a7ed0cc0b7fd8fe546d751ec553cba1683077 (patch)
treeb0d76ba7b50df5e7aeb4c3b1681dec7da97fcf63 /src/glamo-draw.c
parent6aa6e5442c6f5b0b08080e4e3a46e923fd7921d9 (diff)
Add proper VT switching. Save and restore hardware registers. This should fix
suspend/resume.
Diffstat (limited to 'src/glamo-draw.c')
-rw-r--r--src/glamo-draw.c70
1 files changed, 54 insertions, 16 deletions
diff --git a/src/glamo-draw.c b/src/glamo-draw.c
index b8613f8..2a951b1 100644
--- a/src/glamo-draw.c
+++ b/src/glamo-draw.c
@@ -74,6 +74,9 @@ static const CARD8 GLAMOBltRop[16] = {
* exa entry points declarations
********************************/
+static Bool
+GLAMODrawExaInit(ScrnInfoPtr pScrn);
+
Bool
GLAMOExaPrepareSolid(PixmapPtr pPixmap,
int alu,
@@ -168,25 +171,57 @@ GLAMOWakeupHandler(pointer blockData, int result, pointer readmask)
{
}
+Bool
+GLAMODrawInit(ScrnInfoPtr pScrn)
+{
+ if (!GLAMODrawExaInit(pScrn))
+ return FALSE;
+
+ if (!GLAMOCMDQInit(pScrn)) {
+ GLAMODrawFini(pScrn);
+ return FALSE;
+ }
+ return TRUE;
+}
+
void
-GLAMODrawSetup(GlamoPtr pGlamo)
+GLAMODrawFini(ScrnInfoPtr pScrn) {
+ GlamoPtr pGlamo = GlamoPTR(pScrn);
+
+ GLAMOCMDQFini(pScrn);
+ if (pGlamo->exa) {
+ exaDriverFini(pGlamo->pScreen);
+ xfree(pGlamo->exa);
+ pGlamo->exa = NULL;
+ }
+}
+
+Bool
+GLAMODrawEnable(ScrnInfoPtr pScrn)
{
+ GlamoPtr pGlamo = GlamoPTR(pScrn);
+
GLAMOEngineEnable(pGlamo, GLAMO_ENGINE_2D);
GLAMOEngineReset(pGlamo, GLAMO_ENGINE_2D);
+ GLAMOCMDQEnable(pScrn);
+
+ GLAMOEngineWait(pGlamo, GLAMO_ENGINE_ALL);
+
+ return TRUE;
}
void
-GLAMODrawEnable(GlamoPtr pGlamo)
-{
- GLAMOCMDQCacheSetup(pGlamo);
- GLAMODrawSetup(pGlamo);
- GLAMOEngineWait(pGlamo, GLAMO_ENGINE_ALL);
+GLAMODrawDisable(ScrnInfoPtr pScrn) {
+ GlamoPtr pGlamo = GlamoPTR(pScrn);
+
+ GLAMOCMDQDisable(pScrn);
+ GLAMOEngineDisable(pGlamo, GLAMO_ENGINE_2D);
}
-Bool
-GLAMODrawExaInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
+static Bool
+GLAMODrawExaInit(ScrnInfoPtr pScrn)
{
- GlamoPtr pGlamo = GlamoPTR(pScrn);
+ GlamoPtr pGlamo = GlamoPTR(pScrn);
Bool success = FALSE;
ExaDriverPtr exa;
@@ -195,15 +230,16 @@ GLAMODrawExaInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
"EXA hardware acceleration initialising\n");
exa = pGlamo->exa = exaDriverAlloc();
- if(!exa) return FALSE;
+ if(!exa)
+ return FALSE;
exa->memoryBase = pGlamo->fbstart;
exa->memorySize = 1024 * 1024 * 4;
/*exa->offScreenBase = pGlamo->fboff;*/
- exa->offScreenBase = pScrn->virtualX * pScrn->virtualY * 2;
+ exa->offScreenBase = 480 * 640 * 2;
- exa->exa_major = 2;
- exa->exa_minor = 0;
+ exa->exa_major = EXA_VERSION_MAJOR;
+ exa->exa_minor = EXA_VERSION_MINOR;
exa->PrepareSolid = GLAMOExaPrepareSolid;
exa->Solid = GLAMOExaSolid;
@@ -218,7 +254,6 @@ GLAMODrawExaInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
exa->Composite = GLAMOExaComposite;
exa->DoneComposite = GLAMOExaDoneComposite;
-
exa->DownloadFromScreen = GLAMOExaDownloadFromScreen;
exa->UploadToScreen = GLAMOExaUploadToScreen;
@@ -235,13 +270,15 @@ GLAMODrawExaInit(ScreenPtr pScreen, ScrnInfoPtr pScrn)
RegisterBlockAndWakeupHandlers(GLAMOBlockHandler,
GLAMOWakeupHandler,
- pScreen);
+ pGlamo->pScreen);
- success = exaDriverInit(pScreen, exa);
+ success = exaDriverInit(pGlamo->pScreen, exa);
if (success) {
ErrorF("Initialized EXA acceleration\n");
} else {
ErrorF("Failed to initialize EXA acceleration\n");
+ xfree(pGlamo->exa);
+ pGlamo->exa = NULL;
}
return success;
@@ -513,3 +550,4 @@ GLAMOExaWaitMarker (ScreenPtr pScreen, int marker)
GLAMOEngineWait(pGlamo, GLAMO_ENGINE_ALL);
}
+