All elements of pre-DRI_NEW_INTERFACE_ONLY are removed. This allows
[mesa.git] / src / mesa / drivers / dri / mga / mgaioctl.h
index b7cf44d6ff949d8ac7fba43b93e79a2380847319..f3ae749ca992b56f6777727a9a6304952e1637d7 100644 (file)
 #include "mgacontext.h"
 #include "mga_xmesa.h"
 
-void mgaSwapBuffers( __DRIdrawablePrivate *dPriv );
-
-GLuint *mgaAllocVertexDwords( mgaContextPtr mmesa, int dwords );
-
-
-void mgaGetILoadBufferLocked( mgaContextPtr mmesa );
-drmBufPtr mgaGetBufferLocked( mgaContextPtr mmesa );
-
+void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv );
 void mgaWaitForVBlank( mgaContextPtr mmesa );
 
+void mgaGetILoadBufferLocked( mgaContextPtr mmesa );
 void mgaFireILoadLocked( mgaContextPtr mmesa,
                         GLuint offset, GLuint length );
 
 void mgaWaitAgeLocked( mgaContextPtr mmesa, int age );
-void mgaWaitAge( mgaContextPtr mmesa, int age );
 
 void mgaFlushVertices( mgaContextPtr mmesa );
 void mgaFlushVerticesLocked( mgaContextPtr mmesa );
-void mgaReleaseBufLocked( mgaContextPtr mmesa, drmBufPtr buffer );
 int mgaFlushDMA( int fd, drmLockFlags flags );
 
-void mgaDDFlush( GLcontext *ctx );
-void mgaDDFinish( GLcontext *ctx );
-
-void mgaDDInitIoctlFuncs( GLcontext *ctx );
+void mgaInitIoctlFuncs( struct dd_function_table *functions );
 
 #define FLUSH_BATCH(mmesa) do {                                                \
         if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL)                             \
@@ -78,14 +67,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 );
    }
@@ -104,8 +101,9 @@ do {                                                                        \
    if ( ret < 0 ) {                                                    \
       drmCommandNone( mmesa->driFd, DRM_MGA_RESET );                   \
       UNLOCK_HARDWARE( mmesa );                                                \
-      fprintf( stderr, "%s: flush ret=%d\n", __FUNCTION__, ret );      \
-      /*fprintf( stderr, "drmMGAFlushDMA: return = %d\n", ret );*/     \
+      fprintf( stderr, "%s: flush return = %s (%d), flags = 0x%08x\n", \
+              __FUNCTION__, strerror( -ret ), -ret,                    \
+              (unsigned)(flags) );                                     \
       exit( 1 );                                                       \
    }                                                                   \
 } while (0)