diff options
author | Ian Romanick <idr@us.ibm.com> | 2005-06-14 22:51:44 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2005-06-14 22:51:44 +0000 |
commit | aa2691547281a09da86f7fcc3f991b92a29fc9c7 (patch) | |
tree | 68f09948c573a39a6c68674450c96dc30e469626 /src/mesa/drivers/dri/mga/mga_xmesa.c | |
parent | fb818a0b115afaf43a5a3a32e649c86165ccc366 (diff) |
Adds support for MGA DRM version 3.2.
This patch makes use of two of the new ioctls added in MGA DRM version
3.2. Specifically, the DRM_MGA_SET_FENCE and DRM_MGA_WAIT_FENCE
ioctls are used in mgaWaitForFrameCompletion. As a result the MMIO
register region and the primary DMA region are *not* mapped (if DRM
3.2 is available).
This patch does *not* make use of the new get_param query was added to
differentiate between G4x0 cards and G550 cards. That is left to a
future update.
Xorg bug: 3259
Reviewed by: Eric Anholt
Diffstat (limited to 'src/mesa/drivers/dri/mga/mga_xmesa.c')
-rw-r--r-- | src/mesa/drivers/dri/mga/mga_xmesa.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index aa4cfe5ccd..44e69dd1de 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -31,6 +31,7 @@ */ #include <stdlib.h> +#include <stdint.h> #include "drm.h" #include "mga_drm.h" #include "mga_xmesa.h" @@ -264,22 +265,30 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) * primary DMA region base address needs to be known is so that the driver * can busy wait for certain DMA operations to complete (see * mgaWaitForFrameCompletion in mgaioctl.c). + * + * Starting with MGA DRM version 3.2, these are completely unneeded as + * there is a new, in-kernel mechanism for handling the wait. */ - mgaScreen->mmio.handle = serverInfo->registers.handle; - mgaScreen->mmio.size = serverInfo->registers.size; - if ( drmMap( sPriv->fd, - mgaScreen->mmio.handle, mgaScreen->mmio.size, - &mgaScreen->mmio.map ) < 0 ) { - FREE( mgaScreen ); - sPriv->private = NULL; - __driUtilMessage( "Couldn't map MMIO registers" ); - return GL_FALSE; - } - - mgaScreen->primary.handle = serverInfo->primary.handle; - mgaScreen->primary.size = serverInfo->primary.size; + if (mgaScreen->sPriv->drmMinor < 2) { + mgaScreen->mmio.handle = serverInfo->registers.handle; + mgaScreen->mmio.size = serverInfo->registers.size; + if ( drmMap( sPriv->fd, + mgaScreen->mmio.handle, mgaScreen->mmio.size, + &mgaScreen->mmio.map ) < 0 ) { + FREE( mgaScreen ); + sPriv->private = NULL; + __driUtilMessage( "Couldn't map MMIO registers" ); + return GL_FALSE; + } + mgaScreen->primary.handle = serverInfo->primary.handle; + mgaScreen->primary.size = serverInfo->primary.size; + } + else { + (void) memset( & mgaScreen->primary, 0, sizeof( mgaScreen->primary ) ); + (void) memset( & mgaScreen->mmio, 0, sizeof( mgaScreen->mmio ) ); + } mgaScreen->textureOffset[MGA_CARD_HEAP] = serverInfo->textureOffset; mgaScreen->textureOffset[MGA_AGP_HEAP] = (serverInfo->agpTextureOffset | |