diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2009-02-24 13:44:53 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2009-02-24 13:44:53 -0500 |
commit | 5fdb5ad5234db2ece8b14eadf677e171ba3f1c18 (patch) | |
tree | ce5d19e9effdd7ce9198b486401b529de45ad5da | |
parent | 2be423058eec1bdd32dd55e124d9d7034494aad9 (diff) |
Wait for the command ring to go idle before setting the mode
Set the correct stride in the ModifyPixmapHeader call, and onlhy call
qxl_mem_free_all() if the memory system is initialized.
-rw-r--r-- | src/qxl.h | 1 | ||||
-rw-r--r-- | src/qxl_driver.c | 44 | ||||
-rw-r--r-- | src/qxl_ring.c | 10 |
3 files changed, 43 insertions, 12 deletions
@@ -459,6 +459,7 @@ void qxl_ring_push (struct qxl_ring *ring, const void *element); Bool qxl_ring_pop (struct qxl_ring *ring, void *element); +void qxl_ring_wait_idle (struct qxl_ring *ring); typedef struct _qxlScreen { diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 6740b2e..02723dc 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -280,6 +280,9 @@ qxlSwitchMode(int scrnIndex, DisplayModePtr p, int flags) /* if (debug) */ xf86DrvMsg(scrnIndex, X_INFO, "Setting mode %d (%d x %d) (%d x %d) %p\n", m->id, m->x_res, m->y_res, p->HDisplay, p->VDisplay, p); + + qxl_ring_wait_idle (qxl->command_ring); + outb(qxl->io_base + QXL_IO_SET_MODE, m->id); /* If this happens out of ScreenInit, we won't have a screen yet. In that case @@ -293,13 +296,15 @@ qxlSwitchMode(int scrnIndex, DisplayModePtr p, int flags) { pScreen->ModifyPixmapHeader(pPixmap, m->x_res, m->y_res, - -1, -1, -1, NULL); + -1, -1, + qxl->pScrn->displayWidth * ((qxl->pScrn->bitsPerPixel + 7) / 8), + NULL); } - - ErrorF ("after mode set: ScreenPixmap is %p (%d %d)\n", pPixmap, pPixmap->drawable.width, pPixmap->drawable.height); } - qxl_mem_free_all (qxl->mem); + if (qxl->mem) + qxl_mem_free_all (qxl->mem); + return TRUE; } @@ -489,6 +494,7 @@ submit_copy (qxlScreen *qxl, const struct qxl_rect *rect) #if 0 ErrorF ("stride: %d\n", qxl->modes[qxl->rom->mode].x_res * sizeof (uint32_t)); ErrorF ("new stride: (virtualX: %d) %d\n", pScrn->virtualX, pScrn->virtualX * (pScrn->bitsPerPixel + 7)/8); + ErrorF ("displayWidth: %d\n", pScrn->displayWidth * 4); #endif drawable->u.copy.src_bitmap = physical_address ( @@ -518,10 +524,10 @@ qxlShadowUpdateArea(qxlScreen *qxl, BoxPtr box) qrect.bottom = box->y2; qrect.right = box->x2; +#if 0 ErrorF ("updating %d %d %d %d\n", box->x1, box->y1, box->x2, box->y2); ErrorF ("virtual: %d %d\n", qxl->pScrn->virtualX, qxl->pScrn->virtualY); ErrorF ("active: %d %d\n", qxl->pScrn->currentMode->HDisplay, qxl->pScrn->currentMode->VDisplay); -#if 0 submit_random_fill (qxl, &qrect); #endif submit_copy (qxl, &qrect); @@ -566,7 +572,9 @@ qxlCreateScreenResources(ScreenPtr pScreen) pPixmap = pScreen->GetScreenPixmap(pScreen); +#if 0 ErrorF ("create screen resources: ScreenPixmap is %p (%d %d)\n", pPixmap, pPixmap->drawable.width, pPixmap->drawable.height); +#endif shadowAdd (pScreen, pPixmap, qxlShadowUpdate, NULL, 0, 0); @@ -594,12 +602,6 @@ qxlScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) qxlSaveState(qxl); qxlBlankScreen(pScreen, SCREEN_SAVER_ON); - - CHECK_POINT(); - - qxlSwitchMode(scrnIndex, pScrn->currentMode, 0); - - CHECK_POINT(); miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -608,14 +610,21 @@ qxlScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!miSetPixmapDepths()) goto out; +#if 0 ErrorF ("%d x %d (x, y: %d %d)\n", pScrn->virtualX, pScrn->virtualY, pScrn->frameX0, pScrn->frameY0); ErrorF ("pScrn->displayWidth: %d\n", pScrn->displayWidth); +#endif qxl->fb = xcalloc(pScrn->virtualX * pScrn->displayWidth, (pScrn->bitsPerPixel + 7)/8); if (!qxl->fb) goto out; + pScrn->virtualX = pScrn->currentMode->HDisplay; + pScrn->virtualY = pScrn->currentMode->VDisplay; + + ErrorF ("current: %d %d\n", pScrn->currentMode->HDisplay, pScrn->currentMode->VDisplay); + if (!fbScreenInit(pScreen, qxl->fb, pScrn->currentMode->HDisplay, pScrn->currentMode->VDisplay, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) @@ -684,6 +693,13 @@ qxlScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) qxl->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = qxlCloseScreen; + + CHECK_POINT(); + + qxlSwitchMode(scrnIndex, pScrn->currentMode, 0); + + CHECK_POINT(); + return TRUE; out: @@ -816,7 +832,9 @@ qxlFindNativeMode(ScrnInfoPtr pScrn, DisplayModePtr p) if (m->x_res == p->HDisplay && m->y_res == p->VDisplay && m->bits == pScrn->bitsPerPixel) + { return m; + } } return NULL; @@ -832,7 +850,7 @@ qxlValidMode(int scrn, DisplayModePtr p, Bool flag, int pass) /* FIXME: I don't think this is necessary now that we report the * correct amount of video ram? */ - if (p->HDisplay * p->VDisplay * (bpp/4) > qxl->draw_area_size) + if (p->HDisplay * p->VDisplay * (bpp/8) > qxl->draw_area_size) return MODE_MEM; p->Private = (void *)qxlFindNativeMode(pScrn, p); @@ -842,7 +860,9 @@ qxlValidMode(int scrn, DisplayModePtr p, Bool flag, int pass) assert (((struct qxl_mode *)p->Private)->x_res == p->HDisplay); assert (((struct qxl_mode *)p->Private)->y_res == p->VDisplay); +#if 0 ErrorF ("validated mode %p\n", p); +#endif return MODE_OK; } diff --git a/src/qxl_ring.c b/src/qxl_ring.c index 910b038..d0745a7 100644 --- a/src/qxl_ring.c +++ b/src/qxl_ring.c @@ -1,4 +1,5 @@ #include <string.h> +#include <unistd.h> #include "qxl.h" struct ring @@ -84,3 +85,12 @@ qxl_ring_pop (struct qxl_ring *ring, return TRUE; } +void +qxl_ring_wait_idle (struct qxl_ring *ring) +{ + while (ring->ring->header.cons != ring->ring->header.prod) + { + usleep (1000); + mem_barrier(); + } +} |