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 =
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" );
mgaScreen->chipset = serverInfo->chipset;
- mgaScreen->width = serverInfo->width;
- mgaScreen->height = serverInfo->height;
- mgaScreen->mem = serverInfo->mem;
mgaScreen->cpp = serverInfo->cpp;
mgaScreen->agpMode = serverInfo->agpMode;
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,
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 |
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");
drmUnmapBufs(mgaScreen->bufs);
- /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/
/* free all option information */
driDestroyOptionInfo (&mgaScreen->optionCache);
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" );
{
__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 };
#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;
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];
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;
#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
*/
#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;