summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2005-05-12 23:15:38 +0000
committerIan Romanick <[email protected]>2005-05-12 23:15:38 +0000
commitc9a69a69689e0cc26fb4708f7f76ab632af88eca (patch)
treec7a876e4012c813fc6ed82b87815376aa8cabd60 /src
parent269e3895d9837ac7303b91948f003ca5c12c0fe4 (diff)
Remove some unused structure fields, add some comments, and ifdef out some
dead code. This is just some clean-up work which should not have any functional impact.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c3
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.h4
-rw-r--r--src/mesa/drivers/dri/mga/mgaioctl.c40
-rw-r--r--src/mesa/drivers/dri/mga/mgapixel.c20
4 files changed, 49 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 6312997ce64..a4bb95a7916 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -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) {
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.h b/src/mesa/drivers/dri/mga/mga_xmesa.h
index 51cc1295808..2bc0eaa9d57 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.h
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.h
@@ -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 */
diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c
index 29c06dcbbc4..9ebb48f43c3 100644
--- a/src/mesa/drivers/dri/mga/mgaioctl.c
+++ b/src/mesa/drivers/dri/mga/mgaioctl.c
@@ -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 ||
diff --git a/src/mesa/drivers/dri/mga/mgapixel.c b/src/mesa/drivers/dri/mga/mgapixel.c
index 4f733adc4af..952b8d56312 100644
--- a/src/mesa/drivers/dri/mga/mgapixel.c
+++ b/src/mesa/drivers/dri/mga/mgapixel.c
@@ -20,10 +20,19 @@
* 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 <[email protected]>
- * Gareth Hughes <[email protected]>
+ * \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 <[email protected]>
+ * \author Gareth Hughes <[email protected]>
*/
/* $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
}