summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/mga
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2005-05-18 22:49:59 +0000
committerIan Romanick <[email protected]>2005-05-18 22:49:59 +0000
commit6bc9ea1df92a102c60c409c2f2261151503890b4 (patch)
treef5a2a3db11ff7b69f468ec5aef2cecc5fae7aee3 /src/mesa/drivers/dri/mga
parent9a1b5af3331361177cf73c1d0b18cea4e260688b (diff)
In addition to dead-code removal and other clean-up, bump the required DDX
version from 1.0.0 to 1.1.1. 1.1.1 is over a year and a half old at this point, so it should be pretty widespread. This allows the linecomp_sane field to be eliminated from mga_screen_private_s.
Diffstat (limited to 'src/mesa/drivers/dri/mga')
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c82
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.h30
-rw-r--r--src/mesa/drivers/dri/mga/server/mga_dri.h58
3 files changed, 83 insertions, 87 deletions
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 6c77db5a329..d32934b06bd 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -215,9 +215,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
return GL_FALSE;
}
}
-
- mgaScreen->linecomp_sane = (sPriv->ddxMajor > 1) || (sPriv->ddxMinor > 1)
- || ((sPriv->ddxMinor == 1) && (sPriv->ddxPatch > 0));
if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
@@ -225,14 +222,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
void * const psc = sPriv->psc->screenConfigs;
if ( glx_enable_extension != NULL ) {
- if ( mgaScreen->linecomp_sane ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- }
-
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
+ (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
(*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
+ (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
+ (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
+ (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
if ( driCompareGLXAPIVersion( 20030915 ) >= 0 ) {
(*glx_enable_extension)( psc, "GLX_SGIX_fbconfig" );
@@ -251,9 +245,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->chipset = serverInfo->chipset;
- mgaScreen->width = serverInfo->width;
- mgaScreen->height = serverInfo->height;
- mgaScreen->mem = serverInfo->mem;
mgaScreen->cpp = serverInfo->cpp;
mgaScreen->agpMode = serverInfo->agpMode;
@@ -265,6 +256,13 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->depthOffset = serverInfo->depthOffset;
mgaScreen->depthPitch = serverInfo->depthPitch;
+
+ /* The only reason that the MMIO region needs to be accessable and the
+ * 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).
+ */
+
mgaScreen->mmio.handle = serverInfo->registers.handle;
mgaScreen->mmio.size = serverInfo->registers.size;
if ( drmMap( sPriv->fd,
@@ -279,21 +277,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->primary.handle = serverInfo->primary.handle;
mgaScreen->primary.size = serverInfo->primary.size;
-#if 0
- mgaScreen->agp.handle = serverInfo->agp;
- mgaScreen->agp.size = serverInfo->agpSize;
-
- if (drmMap(sPriv->fd,
- mgaScreen->agp.handle,
- mgaScreen->agp.size,
- (drmAddress *)&mgaScreen->agp.map) != 0)
- {
- Xfree(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map agp region");
- return GL_FALSE;
- }
-#endif
mgaScreen->textureOffset[MGA_CARD_HEAP] = serverInfo->textureOffset;
mgaScreen->textureOffset[MGA_AGP_HEAP] = (serverInfo->agpTextureOffset |
@@ -302,37 +285,34 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->textureSize[MGA_CARD_HEAP] = serverInfo->textureSize;
mgaScreen->textureSize[MGA_AGP_HEAP] = serverInfo->agpTextureSize;
- mgaScreen->logTextureGranularity[MGA_CARD_HEAP] =
- serverInfo->logTextureGranularity;
- mgaScreen->logTextureGranularity[MGA_AGP_HEAP] =
- serverInfo->logAgpTextureGranularity;
+
+ /* The texVirtual array stores the base addresses in the CPU's address
+ * space of the texture memory pools. The base address of the on-card
+ * memory pool is calculated as an offset of the base of video memory. The
+ * AGP texture pool has to be mapped into the processes address space by
+ * the DRM.
+ */
mgaScreen->texVirtual[MGA_CARD_HEAP] = (char *)(mgaScreen->sPriv->pFB +
serverInfo->textureOffset);
- if (drmMap(sPriv->fd,
- serverInfo->agpTextureOffset,
- serverInfo->agpTextureSize,
- (drmAddress *)&mgaScreen->texVirtual[MGA_AGP_HEAP]) != 0)
- {
- FREE(mgaScreen);
- sPriv->private = NULL;
- __driUtilMessage("Couldn't map agptexture region");
- return GL_FALSE;
- }
-#if 0
- mgaScreen->texVirtual[MGA_AGP_HEAP] = (mgaScreen->agp.map +
- serverInfo->agpTextureOffset);
-#endif
+ if ( serverInfo->agpTextureSize > 0 ) {
+ if (drmMap(sPriv->fd, serverInfo->agpTextureOffset,
+ serverInfo->agpTextureSize,
+ (drmAddress *)&mgaScreen->texVirtual[MGA_AGP_HEAP]) != 0) {
+ FREE(mgaScreen);
+ sPriv->private = NULL;
+ __driUtilMessage("Couldn't map agptexture region");
+ return GL_FALSE;
+ }
+ }
- mgaScreen->mAccess = serverInfo->mAccess;
/* For calculating setupdma addresses.
*/
mgaScreen->bufs = drmMapBufs(sPriv->fd);
if (!mgaScreen->bufs) {
- /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
FREE(mgaScreen);
sPriv->private = NULL;
__driUtilMessage("Couldn't map dma buffers");
@@ -358,7 +338,6 @@ mgaDestroyScreen(__DRIscreenPrivate *sPriv)
drmUnmapBufs(mgaScreen->bufs);
- /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
/* free all option information */
driDestroyOptionInfo (&mgaScreen->optionCache);
@@ -651,8 +630,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
debug_control );
#endif
- mmesa->vblank_flags = ((mmesa->mgaScreen->irq == 0)
- || !mmesa->mgaScreen->linecomp_sane)
+ mmesa->vblank_flags = (mmesa->mgaScreen->irq == 0)
? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
mmesa->get_ust = (PFNGLXGETUSTPROC) glXGetProcAddress( (const GLubyte *) "__glXGetUST" );
@@ -974,7 +952,7 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc
{
__DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 0, 0 };
+ static const __DRIversion ddx_expected = { 1, 1, 1 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 3, 0, 0 };
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.h b/src/mesa/drivers/dri/mga/mga_xmesa.h
index 14110b8f1e7..0ab0c63f781 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.h
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.h
@@ -37,20 +37,23 @@
#include "xmlconfig.h"
typedef struct mga_screen_private_s {
-
+ /**
+ * Chipset "family" of this card. Currently only \c MGA_CARD_TYPE_G200 and
+ * \c MGA_CARD_TYPE_G400 are possible.
+ */
int chipset;
- int width;
- int height;
- int mem;
- int cpp; /* for front and back buffers */
- GLint agpMode;
- unsigned int irq; /* IRQ number (0 means none) */
- GLboolean linecomp_sane; /* GL_TRUE if line comp. programmed correctly
- * by the DDX driver.
- */
- unsigned int mAccess;
+ /**
+ * Characters (bytes) per-pixel for both the front and back buffers.
+ *
+ * \note
+ * This is also implicitly the bytes per-pixel for the depth-buffer.
+ */
+ int cpp;
+
+ GLint agpMode;
+ unsigned int irq; /**< IRQ number (0 means none) */
unsigned int frontOffset;
unsigned int frontPitch;
@@ -59,11 +62,9 @@ typedef struct mga_screen_private_s {
unsigned int depthOffset;
unsigned int depthPitch;
- int depthCpp;
unsigned int textureOffset[MGA_NR_TEX_HEAPS];
unsigned int textureSize[MGA_NR_TEX_HEAPS];
- int logTextureGranularity[MGA_NR_TEX_HEAPS];
char *texVirtual[MGA_NR_TEX_HEAPS];
@@ -74,7 +75,7 @@ typedef struct mga_screen_private_s {
drmRegion primary;
unsigned int sarea_priv_offset;
- /* Configuration cache with default values for all contexts */
+ /** Configuration cache with default values for all contexts */
driOptionCache optionCache;
} mgaScreenPrivate;
@@ -150,6 +151,5 @@ do { \
#define MGA_DEREF( reg ) *(volatile u_int32_t *)MGA_ADDR( reg )
#define MGA_READ( reg ) MGA_DEREF( reg )
-#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0)
#endif
diff --git a/src/mesa/drivers/dri/mga/server/mga_dri.h b/src/mesa/drivers/dri/mga/server/mga_dri.h
index 8a75d2eda72..1ef6592196c 100644
--- a/src/mesa/drivers/dri/mga/server/mga_dri.h
+++ b/src/mesa/drivers/dri/mga/server/mga_dri.h
@@ -43,42 +43,60 @@
*/
#define MGA_BUFFER_ALIGN 0x00000fff
+#ifdef __GNUC__
+# define DEPRECATED __attribute__ ((deprecated))
+#else
+# define DEPRECATED
+#endif
+
typedef struct {
int chipset;
- int width;
- int height;
- int mem;
+ int width DEPRECATED;
+ int height DEPRECATED;
+ int mem DEPRECATED;
int cpp;
int agpMode;
- int frontOffset;
- int frontPitch;
+ unsigned int frontOffset;
+ unsigned int frontPitch;
- int backOffset;
- int backPitch;
+ unsigned int backOffset;
+ unsigned int backPitch;
- int depthOffset;
- int depthPitch;
+ unsigned int depthOffset;
+ unsigned int depthPitch;
- int textureOffset;
- int textureSize;
- int logTextureGranularity;
+ unsigned int textureOffset;
+ unsigned int textureSize;
+ int logTextureGranularity DEPRECATED;
/* Allow calculation of setup dma addresses.
*/
- unsigned int agpBufferOffset;
+ unsigned int agpBufferOffset DEPRECATED;
unsigned int agpTextureOffset;
unsigned int agpTextureSize;
- int logAgpTextureGranularity;
-
- unsigned int mAccess;
+ int logAgpTextureGranularity DEPRECATED;
+
+ unsigned int mAccess DEPRECATED;
+
+ /**
+ * \name DRM memory regions.
+ *
+ * \todo
+ * Several of these fields are no longer used (and will never be used
+ * again) on the client-side. None of them, except \c registers, are used
+ * on the server-side. At some point when it is safe to do so (probably
+ * for the X.org 6.9 / 7.0 release), these fields should be removed.
+ */
+ /*@{*/
+ drmRegion registers; /**< MMIO registers. */
+ drmRegion status DEPRECATED; /**< No longer used on the client-side. */
+ drmRegion primary; /**< Primary DMA region. */
+ drmRegion buffers DEPRECATED; /**< No longer used on the client-side. */
+ /*@}*/
- drmRegion registers;
- drmRegion status;
- drmRegion primary;
- drmRegion buffers;
unsigned int sarea_priv_offset;
} MGADRIRec, *MGADRIPtr;