From 4c1d373ce17ad0831a986c9e88f65425e5dab4f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Hellstr=C3=B6m?= Date: Thu, 6 Jan 2005 13:51:37 +0000 Subject: [PATCH] Small Unichrome fixes: 1. Unlock hardware before aborting and dumping DMA buffers. Otherwise display system may deadlock. 2. Fix DMA init IOCTL call that got mixed up in one of the previous commits. 3. Fix AGP command alignment --- src/mesa/drivers/dri/unichrome/via_fb.c | 2 +- src/mesa/drivers/dri/unichrome/via_ioctl.c | 3 +++ src/mesa/drivers/dri/unichrome/via_tris.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index 122d3b17cc7..241bf0b9a3b 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -76,7 +76,7 @@ via_alloc_dma_buffer(viaContextPtr vmesa) */ init.func = VIA_DMA_INITIALIZED; vmesa->useAgp = - ( 0 == drmCommandWrite(vmesa->driFd, VIA_INIT_DMA, + ( 0 == drmCommandWrite(vmesa->driFd, DRM_VIA_DMA_INIT, &init, sizeof(init))); if (vmesa->useAgp) printf("unichrome_dri.so: Using AGP.\n"); diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index bbb6651deef..1ea7b2fa806 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -458,6 +458,7 @@ static int fire_buffer(viaContextPtr vmesa) &bSiz, sizeof(bSiz)); } while (ret == -EAGAIN); if (ret) { + UNLOCK_HARDWARE(vmesa); fprintf(stderr, "%s: DRM_VIA_CMDBUF_SIZE returned %d\n", __FUNCTION__, ret); abort(); return ret; @@ -470,6 +471,7 @@ static int fire_buffer(viaContextPtr vmesa) &bufI, sizeof(bufI)); } while (ret == -EAGAIN); if (ret) { + UNLOCK_HARDWARE(vmesa); fprintf(stderr, "%s: DRM_VIA_CMDBUFFER returned %d\n", __FUNCTION__, ret); abort(); /* If this fails, the original code fell back to the PCI path. @@ -485,6 +487,7 @@ static int fire_buffer(viaContextPtr vmesa) ret = drmCommandWrite(vmesa->driFd, DRM_VIA_PCICMD, &bufI, sizeof(bufI)); if (ret) { + UNLOCK_HARDWARE(vmesa); dump_dma(vmesa); fprintf(stderr, "%s: DRM_VIA_PCICMD returned %d\n", __FUNCTION__, ret); abort(); diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index 022399f6981..6fd5a2a64c4 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -987,7 +987,7 @@ void viaFinishPrimitive(viaContextPtr vmesa) /* KW: modified 0x1 to 0x4 below: */ - if ((vmesa->dmaLow & 0x1) || !vmesa->useAgp) { + if ((vmesa->dmaLow & 0x4) || !vmesa->useAgp) { BEGIN_RING_NOCHECK( 1 ); OUT_RING( cmdA ); ADVANCE_RING(); -- 2.30.2