diff options
Diffstat (limited to 'src/mesa/drivers/dri/unichrome')
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_context.c | 107 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_context.h | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_fb.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_fb.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_ioctl.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_screen.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_span.c | 152 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_span.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_state.c | 9 |
9 files changed, 171 insertions, 177 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index abcdcd70a5e..0dd787e9897 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -37,6 +37,7 @@ #include "simple_list.h" #include "extensions.h" #include "framebuffer.h" +#include "renderbuffer.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -127,6 +128,53 @@ buffer_align( unsigned width ) } +static void +nop_delete_renderbuffer(struct gl_renderbuffer *rb) +{ + /* Don't free() since we're contained in via_context struct. */ +} + + +static void +viaInitRenderbuffer(struct gl_renderbuffer *rb, GLenum format) +{ + const GLuint name = 0; + + _mesa_init_renderbuffer(rb, name); + + /* Make sure we're using a null-valued GetPointer routine */ + assert(rb->GetPointer(NULL, rb, 0, 0) == NULL); + + rb->InternalFormat = format; + + if (format == GL_RGBA) { + /* Color */ + rb->_BaseFormat = GL_RGBA; + rb->DataType = GL_UNSIGNED_BYTE; + } + else if (format == GL_DEPTH_COMPONENT16) { + /* Depth */ + rb->_BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + rb->DataType = GL_UNSIGNED_INT; + } + else if (format == GL_DEPTH_COMPONENT24) { + /* Depth */ + rb->_BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + rb->DataType = GL_UNSIGNED_INT; + } + else { + /* Stencil */ + ASSERT(format == GL_STENCIL_INDEX8); + rb->_BaseFormat = GL_STENCIL_INDEX; + rb->DataType = GL_UNSIGNED_BYTE; + } + + rb->Delete = nop_delete_renderbuffer; +} + + /** * Calculate the framebuffer parameters for all buffers (front, back, depth, * and stencil) associated with the specified context. @@ -138,20 +186,47 @@ buffer_align( unsigned width ) * \sa AllocateBuffer */ static GLboolean -calculate_buffer_parameters( struct via_context *vmesa ) +calculate_buffer_parameters( struct via_context *vmesa, + struct gl_framebuffer *fb ) { const unsigned shift = vmesa->viaScreen->bitsPerPixel / 16; const unsigned extra = 32; unsigned w; unsigned h; + /* Normally, the renderbuffer would be added to the framebuffer just once + * when the framebuffer was created. The VIA driver is a bit funny + * though in that the front/back/depth renderbuffers are in the per-context + * state! + * That should be fixed someday. + */ + _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &vmesa->front.Base); + _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &vmesa->back.Base); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &vmesa->depth.Base); + _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &vmesa->stencil.Base); + + if (!vmesa->front.Base.InternalFormat) { + /* do one-time init for the renderbuffers */ + viaInitRenderbuffer(&vmesa->front.Base, GL_RGBA); + viaInitRenderbuffer(&vmesa->back.Base, GL_RGBA); + if (vmesa->glCtx->Visual.depthBits > 0) { + viaInitRenderbuffer(&vmesa->depth.Base, + (vmesa->glCtx->Visual.depthBits == 16 + ? GL_DEPTH_COMPONENT16 : GL_DEPTH_COMPONENT24)); + } + if (vmesa->glCtx->Visual.stencilBits > 0) { + viaInitRenderbuffer(&vmesa->stencil.Base, GL_STENCIL_INDEX8_EXT); + } + } + + /* Allocate front-buffer */ if (vmesa->drawType == GLX_PBUFFER_BIT) { w = vmesa->driDrawable->w; h = vmesa->driDrawable->h; vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel; - vmesa->front.pitch = buffer_align( w ) << shift; + vmesa->front.pitch = buffer_align( w ) << shift; /* bytes, not pixels */ vmesa->front.size = vmesa->front.pitch * h; if (vmesa->front.map) @@ -164,7 +239,7 @@ calculate_buffer_parameters( struct via_context *vmesa ) h = vmesa->viaScreen->height; vmesa->front.bpp = vmesa->viaScreen->bitsPerPixel; - vmesa->front.pitch = buffer_align( w ) << shift; + vmesa->front.pitch = buffer_align( w ) << shift; /* bytes, not pixels */ vmesa->front.size = vmesa->front.pitch * h; if (getenv("ALTERNATE_SCREEN")) vmesa->front.offset = vmesa->front.size; @@ -215,6 +290,17 @@ calculate_buffer_parameters( struct via_context *vmesa ) (void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) ); } + /* stencil buffer is same as depth buffer */ + vmesa->stencil.handle = vmesa->depth.handle; + vmesa->stencil.size = vmesa->depth.size; + vmesa->stencil.offset = vmesa->depth.offset; + vmesa->stencil.index = vmesa->depth.index; + vmesa->stencil.pitch = vmesa->depth.pitch; + vmesa->stencil.bpp = vmesa->depth.bpp; + vmesa->stencil.map = vmesa->depth.map; + vmesa->stencil.orig = vmesa->depth.orig; + vmesa->stencil.origMap = vmesa->depth.origMap; + if( vmesa->viaScreen->width == vmesa->driDrawable->w && vmesa->viaScreen->height == vmesa->driDrawable->h ) { vmesa->doPageFlip = vmesa->allowPageFlip; @@ -238,7 +324,7 @@ void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, _mesa_resize_framebuffer(ctx, drawbuffer, width, height); #endif - calculate_buffer_parameters( vmesa ); + calculate_buffer_parameters( vmesa, drawbuffer ); } static void viaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) @@ -646,7 +732,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa) if (vmesa->drawW != dPriv->w || vmesa->drawH != dPriv->h) - calculate_buffer_parameters( vmesa ); + calculate_buffer_parameters( vmesa, vmesa->glCtx->DrawBuffer ); vmesa->drawXoff = (GLuint)(((dPriv->x * bytePerPixel) & 0x1f) / bytePerPixel); @@ -692,19 +778,20 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, struct via_context *vmesa = (struct via_context *)driContextPriv->driverPrivate; GLcontext *ctx = vmesa->glCtx; + struct gl_framebuffer *drawBuffer, *readBuffer; + + drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; + readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; if ( vmesa->driDrawable != driDrawPriv ) { driDrawableInitVBlank( driDrawPriv, vmesa->vblank_flags ); vmesa->driDrawable = driDrawPriv; - if ( ! calculate_buffer_parameters( vmesa ) ) { + if ( ! calculate_buffer_parameters( vmesa, drawBuffer ) ) { return GL_FALSE; } } - _mesa_make_current(vmesa->glCtx, - (GLframebuffer *)driDrawPriv->driverPrivate, - (GLframebuffer *)driReadPriv->driverPrivate); - + _mesa_make_current(vmesa->glCtx, drawBuffer, readBuffer); ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] ); diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index a4b1afc02bb..4ee56515b9c 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -82,7 +82,11 @@ typedef void (*via_tri_func)(struct via_context *, viaVertex *, viaVertex *, typedef void (*via_line_func)(struct via_context *, viaVertex *, viaVertex *); typedef void (*via_point_func)(struct via_context *, viaVertex *); -struct via_buffer { +/** + * Derived from gl_renderbuffer. + */ +struct via_renderbuffer { + struct gl_renderbuffer Base; /* must be first! */ drm_handle_t handle; drmSize size; GLuint offset; @@ -144,10 +148,12 @@ struct via_context { GLcontext *glCtx; GLcontext *shareCtx; - struct via_buffer front; - struct via_buffer back; - struct via_buffer depth; - struct via_buffer breadcrumb; + /* XXX These don't belong here. They should be per-drawable state. */ + struct via_renderbuffer front; + struct via_renderbuffer back; + struct via_renderbuffer depth; + struct via_renderbuffer stencil; /* mirrors depth */ + struct via_renderbuffer breadcrumb; GLboolean hasBack; GLboolean hasDepth; @@ -264,8 +270,7 @@ struct via_context { */ GLboolean doPageFlip; - struct via_buffer *drawBuffer; - struct via_buffer *readBuffer; + struct via_renderbuffer *drawBuffer; int drawX; /* origin of drawable in draw buffer */ int drawY; diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index e07c200b321..9ac98d1445c 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -33,7 +33,7 @@ #include <sys/ioctl.h> GLboolean -via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf) +via_alloc_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf) { drm_via_mem_t mem; mem.context = vmesa->hHWContext; @@ -53,7 +53,7 @@ via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf) } void -via_free_draw_buffer(struct via_context *vmesa, struct via_buffer *buf) +via_free_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf) { drm_via_mem_t mem; diff --git a/src/mesa/drivers/dri/unichrome/via_fb.h b/src/mesa/drivers/dri/unichrome/via_fb.h index 7ee153f474f..2d329ac2a7d 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.h +++ b/src/mesa/drivers/dri/unichrome/via_fb.h @@ -27,7 +27,7 @@ #include "via_context.h" -extern GLboolean via_alloc_draw_buffer(struct via_context *vmesa, struct via_buffer *buf); +extern GLboolean via_alloc_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf); extern GLboolean via_alloc_dma_buffer(struct via_context *vmesa); struct via_tex_buffer * @@ -35,7 +35,7 @@ via_alloc_texture(struct via_context *vmesa, GLuint size, GLuint memType); -extern void via_free_draw_buffer(struct via_context *vmesa, struct via_buffer *buf); +extern void via_free_draw_buffer(struct via_context *vmesa, struct via_renderbuffer *buf); extern void via_free_dma_buffer(struct via_context *vmesa); extern void via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t); void via_release_pending_textures( struct via_context *vmesa ); diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 435fd20f778..db178c134d0 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -172,7 +172,7 @@ static void viaBlit(struct via_context *vmesa, GLuint bpp, } static void viaFillBuffer(struct via_context *vmesa, - struct via_buffer *buffer, + struct via_renderbuffer *buffer, drm_clip_rect_t *pbox, int nboxes, GLuint pixel, @@ -339,8 +339,8 @@ static void viaDoSwapBuffers(struct via_context *vmesa, GLuint nbox) { GLuint bytePerPixel = vmesa->viaScreen->bitsPerPixel >> 3; - struct via_buffer *front = &vmesa->front; - struct via_buffer *back = &vmesa->back; + struct via_renderbuffer *front = &vmesa->front; + struct via_renderbuffer *back = &vmesa->back; GLuint i; for (i = 0; i < nbox; i++, b++) { @@ -366,7 +366,7 @@ static void viaDoSwapBuffers(struct via_context *vmesa, static void viaEmitBreadcrumbLocked( struct via_context *vmesa ) { - struct via_buffer *buffer = &vmesa->breadcrumb; + struct via_renderbuffer *buffer = &vmesa->breadcrumb; GLuint value = vmesa->lastBreadcrumbWrite + 1; if (VIA_DEBUG & DEBUG_IOCTL) @@ -562,10 +562,10 @@ void viaResetPageFlippingLocked(struct via_context *vmesa) viaDoPageFlipLocked( vmesa, 0 ); if (vmesa->front.offset != 0) { - struct via_buffer buffer_tmp; - memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_buffer)); - memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_buffer)); - memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_buffer)); + struct via_renderbuffer buffer_tmp; + memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_renderbuffer)); + memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_renderbuffer)); + memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_renderbuffer)); } assert(vmesa->front.offset == 0); @@ -623,7 +623,7 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; - struct via_buffer buffer_tmp; + struct via_renderbuffer buffer_tmp; VIA_FLUSH_DMA(vmesa); if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && @@ -645,9 +645,9 @@ void viaPageFlip(const __DRIdrawablePrivate *dPriv) /* KW: FIXME: When buffers are freed, could free frontbuffer by * accident: */ - memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_buffer)); - memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_buffer)); - memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_buffer)); + memcpy(&buffer_tmp, &vmesa->back, sizeof(struct via_renderbuffer)); + memcpy(&vmesa->back, &vmesa->front, sizeof(struct via_renderbuffer)); + memcpy(&vmesa->front, &buffer_tmp, sizeof(struct via_renderbuffer)); } @@ -724,7 +724,7 @@ static int fire_buffer(struct via_context *vmesa) static void via_emit_cliprect(struct via_context *vmesa, drm_clip_rect_t *b) { - struct via_buffer *buffer = vmesa->drawBuffer; + struct via_renderbuffer *buffer = vmesa->drawBuffer; GLuint *vb = (GLuint *)(vmesa->dma + vmesa->dmaCliprectAddr); GLuint format = (vmesa->viaScreen->bitsPerPixel == 0x20 diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 1b2e22ef299..ddd360cc240 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -214,7 +214,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, GLboolean swStencil = (mesaVis->stencilBits > 0 && mesaVis->depthBits != 24); - + GLboolean swAccum = mesaVis->accumRedBits > 0; if (isPixmap) { /* KW: This needs work, disabled for now: @@ -232,16 +232,14 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, return GL_FALSE; } else { -#if 0 - driDrawPriv->driverPrivate = (void *) - _mesa_create_framebuffer(mesaVis, - GL_FALSE, /* software depth buffer? */ - swStencil, - mesaVis->accumRedBits > 0, - GL_FALSE /* s/w alpha planes */); -#else struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); + /* The front color, back color and depth renderbuffers are + * set up later in calculate_buffer_parameters(). + * Only create/connect software-based buffers here. + */ + +#if 000 /* XXX check/fix the offset/pitch parameters! */ { driRenderbuffer *frontRb @@ -288,17 +286,18 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, viaSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } +#endif _mesa_add_soft_renderbuffers(fb, GL_FALSE, /* color */ GL_FALSE, /* depth */ swStencil, - mesaVis->accumRedBits > 0, + swAccum, GL_FALSE, /* alpha */ GL_FALSE /* aux */); driDrawPriv->driverPrivate = (void *) fb; -#endif - return (driDrawPriv->driverPrivate != NULL); + + return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index 16a1aa8b367..5bffade9408 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -43,13 +43,12 @@ #define LOCAL_VARS \ struct via_context *vmesa = VIA_CONTEXT(ctx); \ __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ - GLuint draw_pitch = vmesa->drawBuffer->pitch; \ - GLuint read_pitch = vmesa->readBuffer->pitch; \ + struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb; \ + GLuint pitch = vrb->pitch; \ GLuint height = dPriv->h; \ GLint p = 0; \ - char *buf = (char *)(vmesa->drawBuffer->origMap + vmesa->drawXoff * vmesa->viaScreen->bytesPerPixel); \ - char *read_buf = (char *)(vmesa->readBuffer->origMap + vmesa->drawXoff * vmesa->viaScreen->bytesPerPixel); \ - (void) (read_pitch && draw_pitch && buf && read_buf && p); + char *buf = (char *)(vrb->origMap + vmesa->drawXoff * vrb->bpp); \ + (void) p; /* ================================================================ * Color buffer @@ -57,8 +56,8 @@ /* 16 bit, RGB565 color spanline and pixel functions */ -#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 2 + (_y) * read_pitch) -#define GET_DST_PTR(_x, _y) ( buf + (_x) * 2 + (_y) * draw_pitch) +#define GET_SRC_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#define GET_DST_PTR(_x, _y) GET_SRC_PTR(_x, _y); #define SPANTMP_PIXEL_FMT GL_RGB #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5 @@ -69,8 +68,8 @@ /* 32 bit, ARGB8888 color spanline and pixel functions */ -#define GET_SRC_PTR(_x, _y) (read_buf + (_x) * 4 + (_y) * read_pitch) -#define GET_DST_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * draw_pitch) +#define GET_SRC_PTR(_x, _y) (buf + (_x) * 4 + (_y) * pitch) +#define GET_DST_PTR(_x, _y) GET_SRC_PTR(_x, _y); #define SPANTMP_PIXEL_FMT GL_BGRA #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV @@ -81,12 +80,13 @@ /* 16 bit depthbuffer functions. */ -#define LOCAL_DEPTH_VARS \ - struct via_context *vmesa = VIA_CONTEXT(ctx); \ - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ - GLuint depth_pitch = vmesa->depth.pitch; \ - GLuint height = dPriv->h; \ - char *buf = (char *)(vmesa->depth.map + (vmesa->drawXoff * vmesa->depth.bpp/8)) +#define LOCAL_DEPTH_VARS \ + struct via_context *vmesa = VIA_CONTEXT(ctx); \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb; \ + GLuint depth_pitch = vrb->pitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(vrb->map + (vmesa->drawXoff * vrb->bpp/8)) #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS @@ -97,7 +97,7 @@ #define READ_DEPTH(d, _x, _y) \ d = *(volatile GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch); -#define TAG(x) via##x##_16 +#define TAG(x) via##x##_z16 #include "depthtmp.h" /* 32 bit depthbuffer functions. @@ -108,7 +108,7 @@ #define READ_DEPTH(d, _x, _y) \ d = *(volatile GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch); -#define TAG(x) via##x##_32 +#define TAG(x) via##x##_z32 #include "depthtmp.h" @@ -126,7 +126,7 @@ d = (*(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch)) >> 8; -#define TAG(x) via##x##_24_8 +#define TAG(x) via##x##_z24_s8 #include "depthtmp.h" #define WRITE_STENCIL( _x, _y, d ) { \ @@ -139,26 +139,11 @@ #define READ_STENCIL( d, _x, _y ) \ d = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch) & 0xff; -#define TAG(x) via##x##_24_8 +#define TAG(x) via##x##_z24_s8 #include "stenciltmp.h" -static void viaSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer, - GLuint bufferBit) -{ - struct via_context *vmesa = VIA_CONTEXT(ctx); - - if (bufferBit == BUFFER_BIT_FRONT_LEFT) { - vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front; - } - else if (bufferBit == BUFFER_BIT_BACK_LEFT) { - vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back; - } - else { - ASSERT(0); - } -} /* Move locking out to get reasonable span performance. */ @@ -178,64 +163,9 @@ void viaSpanRenderFinish( GLcontext *ctx ) void viaInitSpanFuncs(GLcontext *ctx) { -#if 0 - struct via_context *vmesa = VIA_CONTEXT(ctx); -#endif struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx); - - swdd->SetBuffer = viaSetBuffer; -#if 0 - if (vmesa->viaScreen->bitsPerPixel == 16) { - viaInitPointers_565( swdd ); - } - else if (vmesa->viaScreen->bitsPerPixel == 32) { - viaInitPointers_8888( swdd ); - } - else { - assert(0); - } -#endif -#if 0 - if (vmesa->glCtx->Visual.depthBits == 16) { - swdd->ReadDepthSpan = viaReadDepthSpan_16; - swdd->WriteDepthSpan = viaWriteDepthSpan_16; - swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_16; - swdd->ReadDepthPixels = viaReadDepthPixels_16; - swdd->WriteDepthPixels = viaWriteDepthPixels_16; - } - else if (vmesa->glCtx->Visual.depthBits == 24) { - swdd->ReadDepthSpan = viaReadDepthSpan_24_8; - swdd->WriteDepthSpan = viaWriteDepthSpan_24_8; - swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_24_8; - swdd->ReadDepthPixels = viaReadDepthPixels_24_8; - swdd->WriteDepthPixels = viaWriteDepthPixels_24_8; - - swdd->WriteStencilSpan = viaWriteStencilSpan_24_8; - swdd->ReadStencilSpan = viaReadStencilSpan_24_8; - swdd->WriteStencilPixels = viaWriteStencilPixels_24_8; - swdd->ReadStencilPixels = viaReadStencilPixels_24_8; - } - else if (vmesa->glCtx->Visual.depthBits == 32) { - swdd->ReadDepthSpan = viaReadDepthSpan_32; - swdd->WriteDepthSpan = viaWriteDepthSpan_32; - swdd->WriteMonoDepthSpan = viaWriteMonoDepthSpan_32; - swdd->ReadDepthPixels = viaReadDepthPixels_32; - swdd->WriteDepthPixels = viaWriteDepthPixels_32; - } -#endif - swdd->SpanRenderStart = viaSpanRenderStart; swdd->SpanRenderFinish = viaSpanRenderFinish; - -#if 0 - swdd->WriteCI8Span = NULL; - swdd->WriteCI32Span = NULL; - swdd->WriteMonoCISpan = NULL; - swdd->WriteCI32Pixels = NULL; - swdd->WriteMonoCIPixels = NULL; - swdd->ReadCI32Span = NULL; - swdd->ReadCI32Pixels = NULL; -#endif } @@ -244,46 +174,26 @@ void viaInitSpanFuncs(GLcontext *ctx) * Plug in the Get/Put routines for the given driRenderbuffer. */ void -viaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis) { - if (drb->Base.InternalFormat == GL_RGBA) { + if (vrb->Base.InternalFormat == GL_RGBA) { if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - viaInitPointers_565(&drb->Base); + viaInitPointers_565(&vrb->Base); } else { - viaInitPointers_8888(&drb->Base); + viaInitPointers_8888(&vrb->Base); } } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { - drb->Base.GetRow = viaReadDepthSpan_16; - drb->Base.GetValues = viaReadDepthPixels_16; - drb->Base.PutRow = viaWriteDepthSpan_16; - drb->Base.PutMonoRow = viaWriteMonoDepthSpan_16; - drb->Base.PutValues = viaWriteDepthPixels_16; - drb->Base.PutMonoValues = NULL; + else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + viaInitDepthPointers_z16(&vrb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { - drb->Base.GetRow = viaReadDepthSpan_24_8; - drb->Base.GetValues = viaReadDepthPixels_24_8; - drb->Base.PutRow = viaWriteDepthSpan_24_8; - drb->Base.PutMonoRow = viaWriteMonoDepthSpan_24_8; - drb->Base.PutValues = viaWriteDepthPixels_24_8; - drb->Base.PutMonoValues = NULL; + else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + viaInitDepthPointers_z24_s8(&vrb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { - drb->Base.GetRow = viaReadDepthSpan_32; - drb->Base.GetValues = viaReadDepthPixels_32; - drb->Base.PutRow = viaWriteDepthSpan_32; - drb->Base.PutMonoRow = viaWriteMonoDepthSpan_32; - drb->Base.PutValues = viaWriteDepthPixels_32; - drb->Base.PutMonoValues = NULL; + else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + viaInitDepthPointers_z32(&vrb->Base); } - else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { - drb->Base.GetRow = viaReadStencilSpan_24_8; - drb->Base.GetValues = viaReadStencilPixels_24_8; - drb->Base.PutRow = viaWriteStencilSpan_24_8; - drb->Base.PutMonoRow = viaWriteMonoStencilSpan_24_8; - drb->Base.PutValues = viaWriteStencilPixels_24_8; - drb->Base.PutMonoValues = NULL; + else if (vrb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + viaInitStencilPointers_z24_s8(&vrb->Base); } } diff --git a/src/mesa/drivers/dri/unichrome/via_span.h b/src/mesa/drivers/dri/unichrome/via_span.h index c3bd24b0e78..3dca0d56619 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.h +++ b/src/mesa/drivers/dri/unichrome/via_span.h @@ -25,13 +25,11 @@ #ifndef _VIA_SPAN_H #define _VIA_SPAN_H -#include "drirenderbuffer.h" - extern void viaInitSpanFuncs(GLcontext *ctx); extern void viaSpanRenderStart( GLcontext *ctx ); extern void viaSpanRenderFinish( GLcontext *ctx ); extern void -viaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); +viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis); #endif diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 4037d14fff9..324c72b46ab 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -659,12 +659,12 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode) switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { case BUFFER_BIT_FRONT_LEFT: VIA_FLUSH_DMA(vmesa); - vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front; + vmesa->drawBuffer = &vmesa->front; FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE); break; case BUFFER_BIT_BACK_LEFT: VIA_FLUSH_DMA(vmesa); - vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back; + vmesa->drawBuffer = &vmesa->back; FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE); break; default: @@ -674,11 +674,6 @@ static void viaDrawBuffer(GLcontext *ctx, GLenum mode) viaXMesaWindowMoved(vmesa); - - /* We want to update the s/w rast state too so that viaSetBuffer() - * gets called. - */ - _swrast_DrawBuffer(ctx, mode); } static void viaClearColor(GLcontext *ctx, const GLfloat color[4]) |