Remove some unused structure fields, add some comments, and ifdef out some
authorIan Romanick <idr@us.ibm.com>
Thu, 12 May 2005 23:15:38 +0000 (23:15 +0000)
committerIan Romanick <idr@us.ibm.com>
Thu, 12 May 2005 23:15:38 +0000 (23:15 +0000)
dead code.  This is just some clean-up work which should not have any
functional impact.

src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/mga/mga_xmesa.h
src/mesa/drivers/dri/mga/mgaioctl.c
src/mesa/drivers/dri/mga/mgapixel.c

index 6312997..a4bb95a 100644 (file)
@@ -274,8 +274,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 
    mgaScreen->primary.handle = serverInfo->primary.handle;
    mgaScreen->primary.size = serverInfo->primary.size;
-   mgaScreen->buffers.handle = serverInfo->buffers.handle;
-   mgaScreen->buffers.size = serverInfo->buffers.size;
 
 #if 0
    mgaScreen->agp.handle = serverInfo->agp;
@@ -327,7 +325,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
 
    /* For calculating setupdma addresses.
     */
-   mgaScreen->dmaOffset = serverInfo->buffers.handle;
 
    mgaScreen->bufs = drmMapBufs(sPriv->fd);
    if (!mgaScreen->bufs) {
index 51cc129..2bc0eaa 100644 (file)
@@ -61,8 +61,6 @@ typedef struct mga_screen_private_s {
    unsigned int depthPitch;
    int depthCpp;
 
-   unsigned int dmaOffset;
-
    unsigned int textureOffset[MGA_NR_TEX_HEAPS];
    unsigned int textureSize[MGA_NR_TEX_HEAPS];
    int logTextureGranularity[MGA_NR_TEX_HEAPS];
@@ -73,9 +71,7 @@ typedef struct mga_screen_private_s {
    drmBufMapPtr  bufs;
 
    drmRegion mmio;
-   drmRegion status;
    drmRegion primary;
-   drmRegion buffers;
    unsigned int sarea_priv_offset;
 
    /* Configuration cache with default values for all contexts */
index 29c06dc..9ebb48f 100644 (file)
@@ -283,16 +283,42 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
 }
 
 
+/**
+ * Wait for the previous frame of rendering has completed.
+ * 
+ * \param mmesa  Hardware context pointer.
+ *
+ * \bug
+ * The loop in this function should have some sort of a timeout mechanism.
+ *
+ * \todo
+ * This routine should be modified to wait on a semaphore.  To do this,
+ * the DRM would have to queue an interrupt when the swap command was
+ * put in the DMA buffer.  When the interrupt occured, the DRM would UP
+ * the semaphore.  This function would then just DOWN the semaphore.
+ */
+
 static void mgaWaitForFrameCompletion( mgaContextPtr mmesa )
 {
    unsigned wait = 0;
-   GLuint last_frame, last_wrap;
-
-
-   last_frame = mmesa->sarea->last_frame.head;
-   last_wrap = mmesa->sarea->last_frame.wrap;
-
-   /* FIXME: Add a timeout to this loop...
+   const GLuint last_frame = mmesa->sarea->last_frame.head;
+   const GLuint last_wrap = mmesa->sarea->last_frame.wrap;
+
+
+   /* The DMA routines in the kernel track a couple values in the SAREA that
+    * we use here.  The number of times that the primary DMA buffer has
+    * "wrapped" around is tracked in last_wrap.  In addition, the wrap count
+    * and the buffer position at the end of the last frame are stored in
+    * last_frame.wrap and last_frame.head.
+    * 
+    * By comparing the wrap counts and the current DMA pointer value (read
+    * directly from the hardware) to last_frame.head, we can determine when
+    * the graphics processor has processed all of the commands for the last
+    * frame.
+    * 
+    * In this case "last frame" means the frame of the *previous* swap-
+    * buffers call.  This is done to prevent queuing a second buffer swap
+    * before the previous swap is executed.
     */
    while ( 1 ) {
       if ( last_wrap < mmesa->sarea->last_wrap ||
index 4f733ad..952b8d5 100644 (file)
  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file mgapixel.c
+ * Implement framebuffer pixel operations for MGA.
  *
- * Authors:
- *    Keith Whitwell <keith@tungstengraphics.com>
- *    Gareth Hughes <gareth@valinux.com>
+ * \todo
+ * Someday the accelerated \c glReadPixels and \c glDrawPixels paths need to
+ * be resurrected.  They are currently ifdef'ed out because they don't seem
+ * to work and they only get activated some very rare circumstances.
+ *
+ * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Gareth Hughes <gareth@valinux.com>
  */
 /* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgapixel.c,v 1.9 2002/11/05 17:46:08 tsi Exp $ */
 
@@ -38,6 +47,7 @@
 #include "swrast/swrast.h"
 #include "imports.h"
 
+#if 0
 #define IS_AGP_MEM( mmesa, p )                                           \
    ((unsigned long)mmesa->mgaScreen->buffers.map <= ((unsigned long)p) && \
     (unsigned long)mmesa->mgaScreen->buffers.map +                       \
@@ -628,7 +638,7 @@ mgaDDDrawPixels( GLcontext *ctx,
       _swrast_DrawPixels( ctx, x, y, width, height, format, type,
                          unpack, pixels );
 }
-
+#endif
 
 
 /* Stub functions - not a real allocator, always returns pointer to
@@ -645,8 +655,10 @@ void mgaDDInitPixelFuncs( GLcontext *ctx )
    ctx->Driver.DrawPixels = _swrast_DrawPixels;
    ctx->Driver.ReadPixels = _swrast_ReadPixels;
 
+#if 0
    if (getenv("MGA_BLIT_PIXELS")) {
       ctx->Driver.ReadPixels = mgaDDReadPixels; /* requires agp dest */
       ctx->Driver.DrawPixels = mgaDDDrawPixels; /* works with agp/normal mem */
    }
+#endif
 }