diff options
Diffstat (limited to 'src/mesa/drivers')
| -rw-r--r-- | src/mesa/drivers/dri/mga/mga_xmesa.c | 3 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/mga/mga_xmesa.h | 4 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/mga/mgaioctl.c | 36 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/mga/mgapixel.c | 20 | 
4 files changed, 47 insertions, 16 deletions
| diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 6312997ce6..a4bb95a791 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 51cc129580..2bc0eaa9d5 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 29c06dcbbc..9ebb48f43c 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; - +   const GLuint last_frame = mmesa->sarea->last_frame.head; +   const GLuint last_wrap = mmesa->sarea->last_frame.wrap; -   last_frame = mmesa->sarea->last_frame.head; -   last_wrap = mmesa->sarea->last_frame.wrap; -   /* FIXME: Add a timeout to this loop... +   /* 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 4f733adc4a..952b8d5631 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 <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  } | 
