diff options
author | Ian Romanick <idr@us.ibm.com> | 2005-05-16 23:23:51 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2005-05-16 23:23:51 +0000 |
commit | c1082804a853233eee123c5b2408ba9b3faa7fd9 (patch) | |
tree | 1b83a8d9a70e3d000d2be60a2c12418e9cadfad6 /src | |
parent | ffd97d20aaa1cf7fa683d25deb0391f24ff14589 (diff) |
Rearranged some code and added some comments to mgaAllocDmaLow. The
modified code performs identically, but cuts 16KiB from the resulting
mga_dri.so.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/mga/mgaioctl.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/mga/mgaioctl.h b/src/mesa/drivers/dri/mga/mgaioctl.h index 19785ea593..c83394af59 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.h +++ b/src/mesa/drivers/dri/mga/mgaioctl.h @@ -78,14 +78,22 @@ GLuint *mgaAllocDmaLow( mgaContextPtr mmesa, int bytes ) { GLuint *head; - if (!mmesa->vertex_dma_buffer) { + /* If there is no DMA buffer currently allocated or the currently + * allocated DMA buffer doesn't have enough room left for this request, + * a new buffer will need to be allocated. + */ + if ( (mmesa->vertex_dma_buffer == NULL) + || ((mmesa->vertex_dma_buffer->used + bytes) + > mmesa->vertex_dma_buffer->total) ) { LOCK_HARDWARE( mmesa ); - mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); - UNLOCK_HARDWARE( mmesa ); - } else if (mmesa->vertex_dma_buffer->used + bytes > - mmesa->vertex_dma_buffer->total) { - LOCK_HARDWARE( mmesa ); - mgaFlushVerticesLocked( mmesa ); + + /* In the case where the existing buffer does not have enough room, + * we need to flush it out to the hardware. + */ + if ( mmesa->vertex_dma_buffer != NULL ) { + mgaFlushVerticesLocked( mmesa ); + } + mmesa->vertex_dma_buffer = mga_get_buffer_ioctl( mmesa ); UNLOCK_HARDWARE( mmesa ); } |