From 154cc16d08c5de175f8bdf83c685991a8b2cd71b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Hellstr=C3=B6m?= Date: Wed, 16 Nov 2005 19:24:00 +0000 Subject: [PATCH] Fixes for x86_64 Unichrome. --- src/mesa/drivers/dri/unichrome/via_context.c | 17 +++++++++-------- src/mesa/drivers/dri/unichrome/via_context.h | 10 +++++----- src/mesa/drivers/dri/unichrome/via_fb.c | 6 +++--- src/mesa/drivers/dri/unichrome/via_screen.c | 10 ++++++++-- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 3ff79c06cd6..62498fb8745 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -675,13 +675,14 @@ viaCreateContext(const __GLcontextModes *visual, (*dri_interface->getUST)( &vmesa->swap_ust ); - vmesa->regMMIOBase = (GLuint *)((GLuint)viaScreen->reg); - vmesa->pnGEMode = (GLuint *)((GLuint)viaScreen->reg + 0x4); - vmesa->regEngineStatus = (GLuint *)((GLuint)viaScreen->reg + 0x400); - vmesa->regTranSet = (GLuint *)((GLuint)viaScreen->reg + 0x43C); - vmesa->regTranSpace = (GLuint *)((GLuint)viaScreen->reg + 0x440); + vmesa->regMMIOBase = (GLuint *)((unsigned long)viaScreen->reg); + vmesa->pnGEMode = (GLuint *)((unsigned long)viaScreen->reg + 0x4); + vmesa->regEngineStatus = (GLuint *)((unsigned long)viaScreen->reg + 0x400); + vmesa->regTranSet = (GLuint *)((unsigned long)viaScreen->reg + 0x43C); + vmesa->regTranSpace = (GLuint *)((unsigned long)viaScreen->reg + 0x440); vmesa->agpBase = viaScreen->agpBase; + return GL_TRUE; } @@ -797,9 +798,9 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driReadPriv) { if (VIA_DEBUG & DEBUG_DRI) { - fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driContextPriv); - fprintf(stderr, "driDrawPriv = %08x\n", (GLuint)driDrawPriv); - fprintf(stderr, "driReadPriv = %08x\n", (GLuint)driReadPriv); + fprintf(stderr, "driContextPriv = %016lx\n", (unsigned long)driContextPriv); + fprintf(stderr, "driDrawPriv = %016lx\n", (unsigned long)driDrawPriv); + fprintf(stderr, "driReadPriv = %016lx\n", (unsigned long)driReadPriv); } if (driContextPriv) { diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 59311eab362..9d7a0e6cb64 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -89,8 +89,8 @@ struct via_renderbuffer { struct gl_renderbuffer Base; /* must be first! */ drm_handle_t handle; drmSize size; - GLuint offset; - GLuint index; + unsigned long offset; + unsigned long index; GLuint pitch; GLuint bpp; char *map; @@ -106,8 +106,8 @@ struct via_renderbuffer { struct via_tex_buffer { struct via_tex_buffer *next, *prev; struct via_texture_image *image; - GLuint index; - GLuint offset; + unsigned long index; + unsigned long offset; GLuint size; GLuint memType; unsigned char *bufAddr; @@ -303,7 +303,7 @@ struct via_context { volatile GLuint* regEngineStatus; volatile GLuint* regTranSet; volatile GLuint* regTranSpace; - GLuint* agpBase; + GLuint agpBase; GLuint drawType; GLuint nDoneFirstFlip; diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index 5b6ed9bb302..48c7ed4caa5 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -142,12 +142,12 @@ via_alloc_texture(struct via_context *vmesa, t->index = fb.index; if (t->memType == VIA_MEM_AGP) { - t->bufAddr = (GLubyte *)((GLuint)vmesa->viaScreen->agpLinearStart + + t->bufAddr = (GLubyte *)((unsigned long)vmesa->viaScreen->agpLinearStart + fb.offset); - t->texBase = (GLuint)vmesa->agpBase + fb.offset; + t->texBase = vmesa->agpBase + fb.offset; } else { - t->bufAddr = (GLubyte *)(fb.offset + (GLuint)vmesa->driScreen->pFB); + t->bufAddr = (GLubyte *)((unsigned long)vmesa->driScreen->pFB + fb.offset); t->texBase = fb.offset; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 424a037a0ab..24c62198ac6 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -168,8 +168,14 @@ viaInitDriver(__DRIscreenPrivate *sPriv) sPriv->private = NULL; __driUtilMessage("viaInitDriver: drmMap agp failed"); return GL_FALSE; - } - viaScreen->agpBase = (GLuint *)gDRIPriv->agp.handle; + } + + /* + * FIXME: This is an invalid assumption that works until handle is + * changed to mean something else than the 32-bit physical AGP address. + */ + + viaScreen->agpBase = gDRIPriv->agp.handle; } else viaScreen->agpLinearStart = 0; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 8239960a632..84aa5aef88e 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -59,7 +59,7 @@ typedef struct { drmAddress reg; drmAddress agpLinearStart; - GLuint* agpBase; + GLuint agpBase; __DRIscreenPrivate *driScrnPriv; drmBufMapPtr bufs; -- 2.30.2