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;
/* For calculating setupdma addresses.
*/
- mgaScreen->dmaOffset = serverInfo->buffers.handle;
mgaScreen->bufs = drmMapBufs(sPriv->fd);
if (!mgaScreen->bufs) {
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];
drmBufMapPtr bufs;
drmRegion mmio;
- drmRegion status;
drmRegion primary;
- drmRegion buffers;
unsigned int sarea_priv_offset;
/* Configuration cache with default values for all contexts */
}
+/**
+ * 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 ||
* 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 $ */
#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 + \
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
unpack, pixels );
}
-
+#endif
/* Stub functions - not a real allocator, always returns pointer to
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
}