static void mgaRunPipeline( GLcontext *ctx ) { mgaContextPtr mmesa = MGA_CONTEXT(ctx); if (mmesa->NewGLState) { mgaDDValidateState( ctx ); } if (mmesa->dirty) { mgaEmitHwStateLocked( mmesa ); } _tnl_run_pipeline( ctx ); }
void mgaFlushVerticesLocked( mgaContextPtr mmesa ) { XF86DRIClipRectPtr pbox = mmesa->pClipRects; int nbox = mmesa->numClipRects; drmBufPtr buffer = mmesa->vertex_dma_buffer; drmMGAVertex vertex; int i; mmesa->vertex_dma_buffer = 0; if (!buffer) return; if (mmesa->dirty_cliprects & mmesa->draw_buffer) mgaUpdateRects( mmesa, mmesa->draw_buffer ); if (mmesa->dirty & ~MGA_UPLOAD_CLIPRECTS) mgaEmitHwStateLocked( mmesa ); /* FIXME: Workaround bug in kernel module. */ mmesa->sarea->dirty |= MGA_UPLOAD_CONTEXT; if (!nbox) buffer->used = 0; if (nbox >= MGA_NR_SAREA_CLIPRECTS) mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; #if 0 if (!buffer->used || !(mmesa->dirty & MGA_UPLOAD_CLIPRECTS)) { if (nbox == 1) mmesa->sarea->nbox = 0; else mmesa->sarea->nbox = nbox; if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) fprintf(stderr, "Firing vertex -- case a nbox %d\n", nbox); vertex.idx = buffer->idx; vertex.used = buffer->used; vertex.discard = 1; drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX, &vertex, sizeof(drmMGAVertex) ); age_mmesa(mmesa, mmesa->sarea->last_enqueue); } else #endif { for (i = 0 ; i < nbox ; ) { int nr = MIN2(i + MGA_NR_SAREA_CLIPRECTS, nbox); XF86DRIClipRectPtr b = mmesa->sarea->boxes; int discard = 0; if (mmesa->scissor) { mmesa->sarea->nbox = 0; for ( ; i < nr ; i++) { *b = pbox[i]; if (intersect_rect(b, b, &mmesa->scissor_rect)) { mmesa->sarea->nbox++; b++; } } /* Culled? */ if (!mmesa->sarea->nbox) { if (nr < nbox) continue; buffer->used = 0; } } else { mmesa->sarea->nbox = nr - i; for ( ; i < nr ; i++) *b++ = pbox[i]; } /* Finished with the buffer? */ if (nr == nbox) discard = 1; mmesa->sarea->dirty |= MGA_UPLOAD_CLIPRECTS; vertex.idx = buffer->idx; vertex.used = buffer->used; vertex.discard = discard; drmCommandWrite( mmesa->driFd, DRM_MGA_VERTEX, &vertex, sizeof(drmMGAVertex) ); age_mmesa(mmesa, mmesa->sarea->last_enqueue); } } /* Do we really need to do this ? */ #ifdef __i386__ if ( __break_vertex ) { __asm__ __volatile__ ( "int $3" ); } #endif mmesa->dirty &= ~MGA_UPLOAD_CLIPRECTS; }