diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2005-02-08 16:19:42 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2005-02-08 16:19:42 +0000 |
commit | baffc16226aa92792430bb2abb4bed1ed3761491 (patch) | |
tree | 12872085ed05104d0c29292882b5e0360908c1c3 | |
parent | 07337ef63ab9471676de413ea53bbabff8abc74d (diff) |
reformat (largely) for 80 chars
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_context.c | 37 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_fb.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_ioctl.c | 64 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_render.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_screen.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_span.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_state.c | 114 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_tex.c | 30 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_texcombine.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_tris.c | 29 |
10 files changed, 194 insertions, 128 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 6b0f73e753..2c5dc7457e 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -170,7 +170,8 @@ calculate_buffer_parameters( struct via_context *vmesa ) /* Allocate back-buffer */ if (vmesa->hasBack) { vmesa->back.bpp = vmesa->viaScreen->bitsPerPixel; - vmesa->back.pitch = (buffer_align( vmesa->driDrawable->w ) << shift) + extra; + vmesa->back.pitch = (buffer_align( vmesa->driDrawable->w ) << shift); + vmesa->back.pitch += extra; vmesa->back.pitch = MIN2(vmesa->back.pitch, vmesa->front.pitch); vmesa->back.size = vmesa->back.pitch * vmesa->driDrawable->h; if (vmesa->back.map) @@ -191,7 +192,8 @@ calculate_buffer_parameters( struct via_context *vmesa ) if (vmesa->depth.bpp == 24) vmesa->depth.bpp = 32; - vmesa->depth.pitch = (buffer_align( vmesa->driDrawable->w ) * (vmesa->depth.bpp/8)) + extra; + vmesa->depth.pitch = (buffer_align( vmesa->driDrawable->w ) * + (vmesa->depth.bpp/8)) + extra; vmesa->depth.size = vmesa->depth.pitch * vmesa->driDrawable->h; if (vmesa->depth.map) @@ -420,7 +422,8 @@ viaCreateContext(const __GLcontextModes *mesaVis, else shareCtx = NULL; - vmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, &functions, (void*) vmesa); + vmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, &functions, + (void*) vmesa); vmesa->shareCtx = shareCtx; @@ -542,12 +545,14 @@ viaCreateContext(const __GLcontextModes *mesaVis, /* Hack this up in its place: */ - vmesa->vblank_flags = getenv("VIA_VSYNC") ? VBLANK_FLAG_SYNC : VBLANK_FLAG_NO_IRQ; + vmesa->vblank_flags = (getenv("VIA_VSYNC") ? + VBLANK_FLAG_SYNC : VBLANK_FLAG_NO_IRQ); if (getenv("VIA_PAGEFLIP")) vmesa->allowPageFlip = 1; - vmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); + vmesa->get_ust = + (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" ); if ( vmesa->get_ust == NULL ) { vmesa->get_ust = get_ust_nop; } @@ -568,7 +573,8 @@ void viaDestroyContext(__DRIcontextPrivate *driContextPriv) { GET_CURRENT_CONTEXT(ctx); - struct via_context *vmesa = (struct via_context *)driContextPriv->driverPrivate; + struct via_context *vmesa = + (struct via_context *)driContextPriv->driverPrivate; struct via_context *current = ctx ? VIA_CONTEXT(ctx) : NULL; assert(vmesa); /* should never be null */ @@ -633,7 +639,8 @@ void viaXMesaWindowMoved(struct via_context *vmesa) vmesa->drawH != dPriv->h) calculate_buffer_parameters( vmesa ); - vmesa->drawXoff = (GLuint)(((dPriv->x * bytePerPixel) & 0x1f) / bytePerPixel); + vmesa->drawXoff = (GLuint)(((dPriv->x * bytePerPixel) & 0x1f) / + bytePerPixel); vmesa->drawX = dPriv->x - vmesa->drawXoff; vmesa->drawY = dPriv->y; vmesa->drawW = dPriv->w; @@ -673,7 +680,8 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, } if (driContextPriv) { - struct via_context *vmesa = (struct via_context *)driContextPriv->driverPrivate; + struct via_context *vmesa = + (struct via_context *)driContextPriv->driverPrivate; GLcontext *ctx = vmesa->glCtx; if ( vmesa->driDrawable != driDrawPriv ) { @@ -735,12 +743,13 @@ viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate; - if (dPriv && dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { - struct via_context *vmesa; - GLcontext *ctx; - - vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; - ctx = vmesa->glCtx; + if (dPriv && + dPriv->driContextPriv && + dPriv->driContextPriv->driverPrivate) { + struct via_context *vmesa = + (struct via_context *)dPriv->driContextPriv->driverPrivate; + GLcontext *ctx = vmesa->glCtx; + if (ctx->Visual.doubleBufferMode) { _mesa_notifySwapBuffers(ctx); if (vmesa->doPageFlip) { diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index 4fcc2bfd0b..5b5f3c7f48 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -133,11 +133,12 @@ via_alloc_texture(struct via_context *vmesa, t->index = fb.index; if (t->memType == VIA_MEM_AGP) { - t->bufAddr = (unsigned char *)((GLuint)vmesa->viaScreen->agpLinearStart + fb.offset); + t->bufAddr = (GLubyte *)((GLuint)vmesa->viaScreen->agpLinearStart + + fb.offset); t->texBase = (GLuint)vmesa->agpBase + fb.offset; } else { - t->bufAddr = (unsigned char *)(fb.offset + (GLuint)vmesa->driScreen->pFB); + t->bufAddr = (GLubyte *)(fb.offset + (GLuint)vmesa->driScreen->pFB); t->texBase = fb.offset; } @@ -192,7 +193,8 @@ via_release_pending_textures( struct via_context *vmesa ) foreach_s( s, tmp, &vmesa->freed_tex_buffers ) { if (s->lastUsed < vmesa->lastBreadcrumbRead) { if (VIA_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, "%s: release tex sz %d lastUsed %x\n",__FUNCTION__, s->size, s->lastUsed); + fprintf(stderr, "%s: release tex sz %d lastUsed %x\n", + __FUNCTION__, s->size, s->lastUsed); remove_from_list(s); via_do_free_texture(vmesa, s); } diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 5643c5fca7..6acf4252d8 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -119,8 +119,11 @@ static void viaBlit(struct via_context *vmesa, GLuint bpp, RING_VARS; if (VIA_DEBUG & DEBUG_2D) - fprintf(stderr, "%s bpp %d src %x/%x dst %x/%x w %d h %d mode: %x color: 0x%08x mask 0x%08x\n", - __FUNCTION__, bpp, srcBase, srcPitch, dstBase, dstPitch, w,h, blitMode, color, nMask); + fprintf(stderr, + "%s bpp %d src %x/%x dst %x/%x w %d h %d " + " mode: %x color: 0x%08x mask 0x%08x\n", + __FUNCTION__, bpp, srcBase, srcPitch, dstBase, + dstPitch, w,h, blitMode, color, nMask); if (!w || !h) @@ -239,7 +242,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, } else { if (VIA_DEBUG & DEBUG_2D) - fprintf(stderr, "XXX: Clear stencil writemask %x -- need triangles (or a ROP?)\n", + fprintf(stderr, "Clear stencil writemask %x\n", ctx->Stencil.WriteMask[0]); } } @@ -269,8 +272,9 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, if (!all) { drm_clip_rect_t *b = vmesa->pClipRects; - boxes = tmp_boxes = (drm_clip_rect_t *)malloc(vmesa->numClipRects * - sizeof(drm_clip_rect_t)); + boxes = tmp_boxes = + (drm_clip_rect_t *)malloc(vmesa->numClipRects * + sizeof(drm_clip_rect_t)); if (!boxes) { UNLOCK_HARDWARE(vmesa); return; @@ -302,15 +306,18 @@ static void viaClear(GLcontext *ctx, GLbitfield mask, GLboolean all, } if (flag & VIA_FRONT) { - viaFillBuffer(vmesa, &vmesa->front, boxes, nr, vmesa->ClearColor, vmesa->ClearMask); + viaFillBuffer(vmesa, &vmesa->front, boxes, nr, vmesa->ClearColor, + vmesa->ClearMask); } if (flag & VIA_BACK) { - viaFillBuffer(vmesa, &vmesa->back, boxes, nr, vmesa->ClearColor, vmesa->ClearMask); + viaFillBuffer(vmesa, &vmesa->back, boxes, nr, vmesa->ClearColor, + vmesa->ClearMask); } if (flag & VIA_DEPTH) { - viaFillBuffer(vmesa, &vmesa->depth, boxes, nr, clear_depth, clear_depth_mask); + viaFillBuffer(vmesa, &vmesa->depth, boxes, nr, clear_depth, + clear_depth_mask); } viaFlushDmaLocked(vmesa, VIA_NO_CLIPRECTS); @@ -403,7 +410,8 @@ GLboolean viaCheckBreadcrumb( struct via_context *vmesa, GLuint value ) vmesa->lastBreadcrumbRead = *buf; if (VIA_DEBUG & DEBUG_IOCTL) - fprintf(stderr, "%s %d < %d: %d\n", __FUNCTION__, value, vmesa->lastBreadcrumbRead, + fprintf(stderr, "%s %d < %d: %d\n", __FUNCTION__, value, + vmesa->lastBreadcrumbRead, value < vmesa->lastBreadcrumbRead); return value < vmesa->lastBreadcrumbRead; @@ -548,7 +556,17 @@ void viaResetPageFlippingLocked(struct via_context *vmesa) */ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) { - struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; + struct via_context *vmesa = + (struct via_context *)dPriv->driContextPriv->driverPrivate; + + if (VIA_DEBUG & DEBUG_IOCTL) + fprintf(stderr, + "%s: lastSwap[1] %d lastSwap[0] %d lastWrite %d lastRead %d\n", + __FUNCTION__, + vmesa->lastSwap[1], + vmesa->lastSwap[0], + vmesa->lastBreadcrumbWrite, + vmesa->lastBreadcrumbRead); VIA_FLUSH_DMA(vmesa); viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastSwap[1]); @@ -575,7 +593,8 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) void viaPageFlip(const __DRIdrawablePrivate *dPriv) { - struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; + struct via_context *vmesa = + (struct via_context *)dPriv->driContextPriv->driverPrivate; struct via_buffer buffer_tmp; VIA_FLUSH_DMA(vmesa); @@ -626,7 +645,8 @@ static int fire_buffer(struct via_context *vmesa) } while (ret == -EAGAIN); if (ret) { UNLOCK_HARDWARE(vmesa); - fprintf(stderr, "%s: DRM_VIA_CMDBUF_SIZE returned %d\n", __FUNCTION__, ret); + fprintf(stderr, "%s: DRM_VIA_CMDBUF_SIZE returned %d\n", + __FUNCTION__, ret); abort(); return ret; } @@ -639,7 +659,8 @@ static int fire_buffer(struct via_context *vmesa) } while (ret == -EAGAIN); if (ret) { UNLOCK_HARDWARE(vmesa); - fprintf(stderr, "%s: DRM_VIA_CMDBUFFER returned %d\n", __FUNCTION__, ret); + fprintf(stderr, "%s: DRM_VIA_CMDBUFFER returned %d\n", + __FUNCTION__, ret); abort(); /* If this fails, the original code fell back to the PCI path. */ @@ -656,7 +677,7 @@ static int fire_buffer(struct via_context *vmesa) if (ret) { UNLOCK_HARDWARE(vmesa); dump_dma(vmesa); - fprintf(stderr, "%s: DRM_VIA_PCICMD returned %d\n", __FUNCTION__, ret); + fprintf(stderr, "%s: DRM_VIA_PCICMD returned %d\n", __FUNCTION__, ret); abort(); } @@ -682,7 +703,8 @@ static void via_emit_cliprect(struct via_context *vmesa, GLuint offset = buffer->orig; if (0) - fprintf(stderr, "emit cliprect for box %d,%d %d,%d\n", b->x1, b->y1, b->x2, b->y2); + fprintf(stderr, "emit cliprect for box %d,%d %d,%d\n", + b->x1, b->y1, b->x2, b->y2); vb[0] = HC_HEADER2; vb[1] = (HC_ParaType_NotTex << 16); @@ -696,11 +718,11 @@ static void via_emit_cliprect(struct via_context *vmesa, vb[3] = (HC_SubA_HClipLR << 24) | (b->x1 << 12) | b->x2; } - vb[4] = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); - vb[5] = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); + vb[4] = (HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF); + vb[5] = (HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000) >> 24); - vb[6] = ((HC_SubA_HSPXYOS << 24) | ((31 - vmesa->drawXoff) << HC_HSPXOS_SHIFT)); - vb[7] = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + vb[6] = (HC_SubA_HSPXYOS << 24) | ((31-vmesa->drawXoff) << HC_HSPXOS_SHIFT); + vb[7] = (HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch; } @@ -736,7 +758,8 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags) fprintf(stderr, "%s\n", __FUNCTION__); if (*(GLuint *)vmesa->driHwLock != (DRM_LOCK_HELD|vmesa->hHWContext) && - *(GLuint *)vmesa->driHwLock != (DRM_LOCK_HELD|DRM_LOCK_CONT|vmesa->hHWContext)) { + *(GLuint *)vmesa->driHwLock != + (DRM_LOCK_HELD|DRM_LOCK_CONT|vmesa->hHWContext)) { fprintf(stderr, "%s called without lock held\n", __FUNCTION__); abort(); } @@ -813,7 +836,6 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags) } else if (vmesa->numClipRects) { drm_clip_rect_t *pbox = vmesa->pClipRects; - if (0) fprintf(stderr, "%s: %d cliprects\n", __FUNCTION__, vmesa->numClipRects); for (i = 0; i < vmesa->numClipRects; i++) { drm_clip_rect_t b; diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c index 755f3b22c8..201235410d 100644 --- a/src/mesa/drivers/dri/unichrome/via_render.c +++ b/src/mesa/drivers/dri/unichrome/via_render.c @@ -119,7 +119,8 @@ static GLboolean via_run_fastrender(GLcontext *ctx, } -static void via_check_fastrender(GLcontext *ctx, struct tnl_pipeline_stage *stage) +static void via_check_fastrender(GLcontext *ctx, + struct tnl_pipeline_stage *stage) { stage->inputs = TNL_CONTEXT(ctx)->render_inputs; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 5951ada0ab..b160521a8a 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -162,7 +162,8 @@ viaInitDriver(__DRIscreenPrivate *sPriv) if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) { PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" ); + (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( + (const GLubyte *) "__glXScrEnableExtension" ); void * const psc = sPriv->psc->screenConfigs; if ( glx_enable_extension != NULL ) { @@ -321,7 +322,8 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) modes = (*create_context_modes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, back_buffer_factor, GLX_TRUE_COLOR ) ) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", @@ -330,7 +332,8 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) } if ( ! driFillInModes( & m, fb_format, fb_type, - depth_bits_array, stencil_bits_array, depth_buffer_factor, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, back_buffer_factor, GLX_DIRECT_COLOR ) ) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", @@ -355,7 +358,8 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) */ #ifdef USE_NEW_INTERFACE PUBLIC -void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, + __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index ba73cccb67..e5e25f08c1 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -51,15 +51,15 @@ #define Y_FLIP(_y) (height - _y - 1) #define HW_LOCK() -#define HW_CLIPLOOP() \ - do { \ - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ - int _nc = dPriv->numClipRects; \ - while (_nc--) { \ - int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ - int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ - int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ - int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; +#define HW_CLIPLOOP() \ + do { \ + __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ + int _nc = dPriv->numClipRects; \ + while (_nc--) { \ + int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; #define HW_ENDCLIPLOOP() \ diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 12583c1a3e..4ab8770aa6 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -105,13 +105,13 @@ void viaEmitState(struct via_context *vmesa) pitch = vmesa->depth.pitch; BEGIN_RING(6); - OUT_RING( ((HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF)) ); - OUT_RING( ((HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24)) ); - OUT_RING( ((HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | - format | pitch) ); - OUT_RING( ((HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD) ); - OUT_RING( ((HC_SubA_HSTREF << 24) | vmesa->regHSTREF) ); - OUT_RING( ((HC_SubA_HSTMD << 24) | vmesa->regHSTMD) ); + OUT_RING( (HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF) ); + OUT_RING( (HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24) ); + OUT_RING( (HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | + format | pitch ); + OUT_RING( (HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD ); + OUT_RING( (HC_SubA_HSTREF << 24) | vmesa->regHSTREF ); + OUT_RING( (HC_SubA_HSTMD << 24) | vmesa->regHSTMD ); ADVANCE_RING(); } else if (vmesa->hasDepth) { @@ -129,54 +129,54 @@ void viaEmitState(struct via_context *vmesa) pitch = vmesa->depth.pitch; BEGIN_RING(4); - OUT_RING( ((HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF)) ); - OUT_RING( ((HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24)) ); - OUT_RING( ((HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | - format | pitch) ); - OUT_RING( ((HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD) ); + OUT_RING( (HC_SubA_HZWBBasL << 24) | (offset & 0xFFFFFF) ); + OUT_RING( (HC_SubA_HZWBBasH << 24) | ((offset & 0xFF000000) >> 24) ); + OUT_RING( (HC_SubA_HZWBType << 24) | HC_HDBLoc_Local | HC_HZONEasFF_MASK | + format | pitch ); + OUT_RING( (HC_SubA_HZWTMD << 24) | vmesa->regHZWTMD ); ADVANCE_RING(); } if (ctx->Color.AlphaEnabled) { BEGIN_RING(1); - OUT_RING( ((HC_SubA_HATMD << 24) | vmesa->regHATMD) ); + OUT_RING( (HC_SubA_HATMD << 24) | vmesa->regHATMD ); ADVANCE_RING(); i++; } if (ctx->Color.BlendEnabled) { BEGIN_RING(11); - OUT_RING( ((HC_SubA_HABLCsat << 24) | vmesa->regHABLCsat) ); - OUT_RING( ((HC_SubA_HABLCop << 24) | vmesa->regHABLCop) ); - OUT_RING( ((HC_SubA_HABLAsat << 24) | vmesa->regHABLAsat) ); - OUT_RING( ((HC_SubA_HABLAop << 24) | vmesa->regHABLAop) ); - OUT_RING( ((HC_SubA_HABLRCa << 24) | vmesa->regHABLRCa) ); - OUT_RING( ((HC_SubA_HABLRFCa << 24) | vmesa->regHABLRFCa) ); - OUT_RING( ((HC_SubA_HABLRCbias << 24) | vmesa->regHABLRCbias) ); - OUT_RING( ((HC_SubA_HABLRCb << 24) | vmesa->regHABLRCb) ); - OUT_RING( ((HC_SubA_HABLRFCb << 24) | vmesa->regHABLRFCb) ); - OUT_RING( ((HC_SubA_HABLRAa << 24) | vmesa->regHABLRAa) ); - OUT_RING( ((HC_SubA_HABLRAb << 24) | vmesa->regHABLRAb) ); + OUT_RING( (HC_SubA_HABLCsat << 24) | vmesa->regHABLCsat ); + OUT_RING( (HC_SubA_HABLCop << 24) | vmesa->regHABLCop ); + OUT_RING( (HC_SubA_HABLAsat << 24) | vmesa->regHABLAsat ); + OUT_RING( (HC_SubA_HABLAop << 24) | vmesa->regHABLAop ); + OUT_RING( (HC_SubA_HABLRCa << 24) | vmesa->regHABLRCa ); + OUT_RING( (HC_SubA_HABLRFCa << 24) | vmesa->regHABLRFCa ); + OUT_RING( (HC_SubA_HABLRCbias << 24) | vmesa->regHABLRCbias ); + OUT_RING( (HC_SubA_HABLRCb << 24) | vmesa->regHABLRCb ); + OUT_RING( (HC_SubA_HABLRFCb << 24) | vmesa->regHABLRFCb ); + OUT_RING( (HC_SubA_HABLRAa << 24) | vmesa->regHABLRAa ); + OUT_RING( (HC_SubA_HABLRAb << 24) | vmesa->regHABLRAb ); ADVANCE_RING(); } if (ctx->Fog.Enabled) { BEGIN_RING(3); - OUT_RING( ((HC_SubA_HFogLF << 24) | vmesa->regHFogLF) ); - OUT_RING( ((HC_SubA_HFogCL << 24) | vmesa->regHFogCL) ); - OUT_RING( ((HC_SubA_HFogCH << 24) | vmesa->regHFogCH) ); + OUT_RING( (HC_SubA_HFogLF << 24) | vmesa->regHFogLF ); + OUT_RING( (HC_SubA_HFogCL << 24) | vmesa->regHFogCL ); + OUT_RING( (HC_SubA_HFogCH << 24) | vmesa->regHFogCH ); ADVANCE_RING(); } if (ctx->Line.StippleFlag) { BEGIN_RING(2); - OUT_RING( ((HC_SubA_HLP << 24) | ctx->Line.StipplePattern) ); - OUT_RING( ((HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor) ); + OUT_RING( (HC_SubA_HLP << 24) | ctx->Line.StipplePattern ); + OUT_RING( (HC_SubA_HLPRF << 24) | ctx->Line.StippleFactor ); ADVANCE_RING(); } BEGIN_RING(1); - OUT_RING( ((HC_SubA_HPixGC << 24) | 0x0) ); + OUT_RING( (HC_SubA_HPixGC << 24) | 0x0 ); ADVANCE_RING(); QWORD_PAD_RING(); @@ -515,8 +515,10 @@ void viaEmitState(struct via_context *vmesa) OUT_RING( stipple[0] ); OUT_RING( HC_HEADER2 ); OUT_RING( (HC_ParaType_NotTex << 16) ); - OUT_RING( ((HC_SubA_HSPXYOS << 24) | (((31 - vmesa->drawX) & 0x1f) << HC_HSPXOS_SHIFT))); - OUT_RING( ((HC_SubA_HSPXYOS << 24) | (((31 - vmesa->drawX) & 0x1f) << HC_HSPXOS_SHIFT))); + OUT_RING( (HC_SubA_HSPXYOS << 24) | + (((31 - vmesa->drawX) & 0x1f) << HC_HSPXOS_SHIFT)); + OUT_RING( (HC_SubA_HSPXYOS << 24) | + (((31 - vmesa->drawX) & 0x1f) << HC_HSPXOS_SHIFT)); ADVANCE_RING(); } @@ -539,7 +541,9 @@ static __inline__ GLuint viaPackColor(GLuint bpp, } } -static void viaBlendEquationSeparate(GLcontext *ctx, GLenum rgbMode, GLenum aMode) +static void viaBlendEquationSeparate(GLcontext *ctx, + GLenum rgbMode, + GLenum aMode) { if (VIA_DEBUG & DEBUG_STATE) fprintf(stderr, "%s in\n", __FUNCTION__); @@ -548,7 +552,8 @@ static void viaBlendEquationSeparate(GLcontext *ctx, GLenum rgbMode, GLenum aMod ASSERT(rgbMode == aMode); /* Can only do GL_ADD equation in hardware */ - FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_BLEND_EQ, rgbMode != GL_FUNC_ADD_EXT); + FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_BLEND_EQ, + rgbMode != GL_FUNC_ADD_EXT); /* BlendEquation sets ColorLogicOpEnabled in an unexpected * manner. @@ -619,7 +624,8 @@ static void viaScissor(GLcontext *ctx, GLint x, GLint y, return; if (VIA_DEBUG & DEBUG_STATE) - fprintf(stderr, "%s %d,%d %dx%d, drawH %d\n", __FUNCTION__, x,y,w,h, vmesa->driDrawable->h); + fprintf(stderr, "%s %d,%d %dx%d, drawH %d\n", __FUNCTION__, + x,y,w,h, vmesa->driDrawable->h); if (vmesa->scissor) { VIA_FLUSH_DMA(vmesa); /* don't pipeline cliprect changes */ @@ -901,9 +907,10 @@ static GLboolean viaChooseTextureState(GLcontext *ctx) vmesa->regHTXnTB[0] &= ~(HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); if (texObj->Image[0][texObj->BaseLevel]->Border > 0) { vmesa->regHTXnTB[0] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); - vmesa->regHTXnTBC[0] = PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]), - FLOAT_TO_UBYTE(texObj->BorderColor[1]), - FLOAT_TO_UBYTE(texObj->BorderColor[2])); + vmesa->regHTXnTBC[0] = + PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]), + FLOAT_TO_UBYTE(texObj->BorderColor[1]), + FLOAT_TO_UBYTE(texObj->BorderColor[2])); vmesa->regHTXnTRAH[0] = FLOAT_TO_UBYTE(texObj->BorderColor[3]); } @@ -933,9 +940,10 @@ static GLboolean viaChooseTextureState(GLcontext *ctx) vmesa->regHTXnTB[1] &= ~(HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); if (texObj->Image[0][texObj->BaseLevel]->Border > 0) { vmesa->regHTXnTB[1] |= (HC_HTXnTB_TBC_S | HC_HTXnTB_TBC_T); - vmesa->regHTXnTBC[1] = PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]), - FLOAT_TO_UBYTE(texObj->BorderColor[1]), - FLOAT_TO_UBYTE(texObj->BorderColor[2])); + vmesa->regHTXnTBC[1] = + PACK_COLOR_888(FLOAT_TO_UBYTE(texObj->BorderColor[0]), + FLOAT_TO_UBYTE(texObj->BorderColor[1]), + FLOAT_TO_UBYTE(texObj->BorderColor[2])); vmesa->regHTXnTRAH[1] = FLOAT_TO_UBYTE(texObj->BorderColor[3]); } @@ -955,7 +963,8 @@ static GLboolean viaChooseTextureState(GLcontext *ctx) } } else { - vmesa->regEnable &= (~(HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK)); + vmesa->regEnable &= ~(HC_HenTXMP_MASK | HC_HenTXCH_MASK | + HC_HenTXPP_MASK); } return GL_TRUE; @@ -975,12 +984,10 @@ static void viaChooseColorState(GLcontext *ctx) vmesa->regEnable |= HC_HenABL_MASK; /* Ca -- always from source color. */ - vmesa->regHABLCsat = HC_HABLCsat_MASK | HC_HABLCa_OPC | - HC_HABLCa_Csrc; + vmesa->regHABLCsat = HC_HABLCsat_MASK | HC_HABLCa_OPC | HC_HABLCa_Csrc; /* Aa -- always from source alpha. */ - vmesa->regHABLAsat = HC_HABLAsat_MASK | HC_HABLAa_OPA | - HC_HABLAa_Asrc; + vmesa->regHABLAsat = HC_HABLAsat_MASK | HC_HABLAa_OPA | HC_HABLAa_Asrc; /* FCa -- depend on following condition. * FAa -- depend on following condition. */ @@ -1042,8 +1049,10 @@ static void viaChooseColorState(GLcontext *ctx) if (vmesa->viaScreen->bitsPerPixel == 16) { /* (1, 1, 1, 1) */ - vmesa->regHABLCsat |= HC_HABLFCa_InvOPC | HC_HABLFCa_HABLRCa; - vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLCsat |= (HC_HABLFCa_InvOPC | + HC_HABLFCa_HABLRCa); + vmesa->regHABLAsat |= (HC_HABLFAa_InvOPA | + HC_HABLFAa_HABLFRA); vmesa->regHABLRFCa = 0x0; vmesa->regHABLRAa = 0x0; } @@ -1080,15 +1089,18 @@ static void viaChooseColorState(GLcontext *ctx) * So (f, f, f, 1) = (0, 0, 0, 1) */ vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_HABLRCa; - vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLAsat |= (HC_HABLFAa_InvOPA | + HC_HABLFAa_HABLFRA); vmesa->regHABLRFCa = 0x0; vmesa->regHABLRAa = 0x0; } else { /* (f, f, f, 1), f = min(As, 1 - Ad) */ - vmesa->regHABLCsat |= HC_HABLFCa_OPC | HC_HABLFCa_mimAsrcInvAdst; - vmesa->regHABLAsat |= HC_HABLFAa_InvOPA | HC_HABLFAa_HABLFRA; + vmesa->regHABLCsat |= (HC_HABLFCa_OPC | + HC_HABLFCa_mimAsrcInvAdst); + vmesa->regHABLAsat |= (HC_HABLFAa_InvOPA | + HC_HABLFAa_HABLFRA); vmesa->regHABLRFCa = 0x0; vmesa->regHABLRAa = 0x0; } diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 770ad281e7..4bb4635990 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -323,7 +323,7 @@ static GLboolean viaSwapInTexObject( struct via_context *vmesa, struct via_texture_object *viaObj ) { const struct via_texture_image *baseImage = - (struct via_texture_image *)viaObj->obj.Image[0][viaObj->obj.BaseLevel]; + (struct via_texture_image *)viaObj->obj.Image[0][viaObj->obj.BaseLevel]; if (VIA_DEBUG & DEBUG_TEXTURE) fprintf(stderr, "%s\n", __FUNCTION__); @@ -463,7 +463,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx, lastLevel = MAX2(lastLevel, texObj->BaseLevel); lastLevel = MIN2(lastLevel, texObj->BaseLevel + baseImage->image.MaxLog2); lastLevel = MIN2(lastLevel, texObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ } numLevels = lastLevel - firstLevel + 1; @@ -489,7 +489,8 @@ static GLboolean viaSetTexImages(GLcontext *ctx, if (!viaSwapInTexObject(vmesa, viaObj)) { if (VIA_DEBUG & DEBUG_TEXTURE) if (!vmesa->thrashing) - fprintf(stderr, "Thrashing flag set for frame %d\n", vmesa->swap_count); + fprintf(stderr, "Thrashing flag set for frame %d\n", + vmesa->swap_count); vmesa->thrashing = GL_TRUE; return GL_FALSE; } @@ -525,18 +526,18 @@ static GLboolean viaSetTexImages(GLcontext *ctx, viaImage->texMem->lastUsed = vmesa->lastBreadcrumbWrite; - viaObj->regTexBaseAndPitch[i].baseL = (((HC_SubA_HTXnL0BasL + i) << 24) | - (texBase & 0xFFFFFF)); + viaObj->regTexBaseAndPitch[i].baseL = + ((HC_SubA_HTXnL0BasL + i) << 24) | (texBase & 0xFFFFFF); - viaObj->regTexBaseAndPitch[i].pitchLog2 = (((HC_SubA_HTXnL0Pit + i) << 24) | - (p << 20)); + viaObj->regTexBaseAndPitch[i].pitchLog2 = + ((HC_SubA_HTXnL0Pit + i) << 24) | (p << 20); /* The base high bytes for each 3 levels are packed * together into one register: */ j = i / 3; - k = 3 - (i % 3); + k = 3 - (i % 3); basH |= ((texBase & 0xFF000000) >> (k << 3)); if (k == 1) { viaObj->regTexBaseH[j] = ((j + HC_SubA_HTXnL012BasH) << 24) | basH; @@ -551,8 +552,10 @@ static GLboolean viaSetTexImages(GLcontext *ctx, widthExp |= (((GLuint)w & 0xF) << (m << 2)); heightExp |= (((GLuint)h & 0xF) << (m << 2)); if (m == 5) { - viaObj->regTexWidthLog2[l] = ((l + HC_SubA_HTXnL0_5WE) << 24 | widthExp); - viaObj->regTexHeightLog2[l] = ((l + HC_SubA_HTXnL0_5HE) << 24 | heightExp); + viaObj->regTexWidthLog2[l] = + (l + HC_SubA_HTXnL0_5WE) << 24 | widthExp; + viaObj->regTexHeightLog2[l] = + (l + HC_SubA_HTXnL0_5HE) << 24 | heightExp; widthExp = 0; heightExp = 0; } @@ -565,8 +568,8 @@ static GLboolean viaSetTexImages(GLcontext *ctx, viaObj->regTexBaseH[j] = ((j + HC_SubA_HTXnL012BasH) << 24) | basH; } if (m != 5) { - viaObj->regTexWidthLog2[l] = ((l + HC_SubA_HTXnL0_5WE) << 24 | widthExp); - viaObj->regTexHeightLog2[l] = ((l + HC_SubA_HTXnL0_5HE) << 24 | heightExp); + viaObj->regTexWidthLog2[l] = (l + HC_SubA_HTXnL0_5WE) << 24 | widthExp; + viaObj->regTexHeightLog2[l] = (l + HC_SubA_HTXnL0_5HE) << 24 | heightExp; } return GL_TRUE; @@ -721,7 +724,8 @@ static void viaTexImage(GLcontext *ctx, vmesa->clearTexCache = 1; - pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, 1, format, type, + pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, 1, + format, type, pixels, packing, "glTexImage"); if (!pixels) { /* Note: we check for a NULL image pointer here, _after_ we allocated diff --git a/src/mesa/drivers/dri/unichrome/via_texcombine.c b/src/mesa/drivers/dri/unichrome/via_texcombine.c index 915a6f939a..e691c553f9 100644 --- a/src/mesa/drivers/dri/unichrome/via_texcombine.c +++ b/src/mesa/drivers/dri/unichrome/via_texcombine.c @@ -111,7 +111,8 @@ viaTexCombineState( struct via_context *vmesa, unsigned constant_alpha[3]; unsigned bias_alpha = 0; unsigned abc_alpha = 0; - const struct gl_texture_unit const * texUnit = & vmesa->glCtx->Texture.Unit[unit]; + const struct gl_texture_unit const * texUnit = + &vmesa->glCtx->Texture.Unit[unit]; unsigned env_color[4]; /* It seems that the color clamping can be overwhelmed at the 4x @@ -314,7 +315,9 @@ viaTexCombineState( struct via_context *vmesa, case GL_PREVIOUS: alpha_arg[i] = (unit == 0) ? HC_XTA_Adif : HC_XTA_Acur; alpha_arg[i] += alpha_operand_modifier[op]; - bias_alpha_arg[i] = (unit == 0) ? HC_HTXnTBLAbias_Adif : HC_HTXnTBLAbias_Acur; + bias_alpha_arg[i] = (unit == 0 ? + HC_HTXnTBLAbias_Adif : + HC_HTXnTBLAbias_Acur); bias_alpha_arg[i] += bias_alpha_operand_modifier[op]; break; } diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index e96f6a82fd..5e697e32f7 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -724,13 +724,15 @@ static void viaChooseVertexState( GLcontext *ctx ) } /* t_context.c always includes a diffuse color */ - EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VIA_EMIT_RGBA, HC_HVPMSK_Cd ); + EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, VIA_EMIT_RGBA, + HC_HVPMSK_Cd ); vmesa->specoffset = 0; if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) { if ((index & _TNL_BIT_COLOR1)) { vmesa->specoffset = vmesa->coloroffset + 1; - EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VIA_EMIT_SPEC, HC_HVPMSK_Cs ); + EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR, VIA_EMIT_SPEC, + HC_HVPMSK_Cs ); } else EMIT_PAD( 3 ); @@ -743,13 +745,16 @@ static void viaChooseVertexState( GLcontext *ctx ) if (index & _TNL_BIT_TEX(0)) { if (vmesa->ptexHack) - EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, VIA_EMIT_PTEX0, (HC_HVPMSK_S | HC_HVPMSK_T) ); + EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, VIA_EMIT_PTEX0, + (HC_HVPMSK_S | HC_HVPMSK_T) ); else - EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, VIA_EMIT_TEX0, (HC_HVPMSK_S | HC_HVPMSK_T) ); + EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, VIA_EMIT_TEX0, + (HC_HVPMSK_S | HC_HVPMSK_T) ); } if (index & _TNL_BIT_TEX(1)) { - EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, VIA_EMIT_TEX1, (HC_HVPMSK_S | HC_HVPMSK_T) ); + EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, VIA_EMIT_TEX1, + (HC_HVPMSK_S | HC_HVPMSK_T) ); } if (setupIndex != vmesa->setupIndex) { @@ -858,15 +863,17 @@ void viaRasterPrimitive(GLcontext *ctx, RING_VARS; if (VIA_DEBUG & DEBUG_PRIMS) - fprintf(stderr, "%s: %s/%s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(glprim), + fprintf(stderr, "%s: %s/%s\n", + __FUNCTION__, _mesa_lookup_enum_by_nr(glprim), _mesa_lookup_enum_by_nr(hwprim)); vmesa->renderPrimitive = glprim; if (hwprim != vmesa->hwPrimitive) { VIA_FINISH_PRIM(vmesa); - - viaCheckDma( vmesa, 1024 ); /* Ensure no wrapping inside this function */ + + /* Ensure no wrapping inside this function */ + viaCheckDma( vmesa, 1024 ); if (vmesa->newEmitState) { viaEmitState(vmesa); @@ -883,7 +890,8 @@ void viaRasterPrimitive(GLcontext *ctx, switch (hwprim) { case GL_POINTS: vmesa->regCmdA_End |= HC_HPMType_Point | HC_HVCycle_Full; - vmesa->regCmdA_End |= HC_HShading_Gouraud; /* always Gouraud shade points?!? */ + vmesa->regCmdA_End |= HC_HShading_Gouraud; /* always Gouraud + shade points?!? */ break; case GL_LINES: vmesa->regCmdA_End |= HC_HPMType_Line | HC_HVCycle_Full; @@ -993,7 +1001,8 @@ void viaFinishPrimitive(struct via_context *vmesa) assert(0); } else if (vmesa->dmaLow != vmesa->dmaLastPrim) { - GLuint cmdA = vmesa->regCmdA_End | HC_HPLEND_MASK | HC_HPMValidN_MASK | HC_HE3Fire_MASK; + GLuint cmdA = (vmesa->regCmdA_End | HC_HPLEND_MASK | + HC_HPMValidN_MASK | HC_HE3Fire_MASK); RING_VARS; vmesa->dmaLastPrim = 0; |