update to newer Mesa interfaces...
mach64_vb.c \
mach64_dd.c \
mach64_lock.c \
- mach64_native_vb.c \
../../common/driverfuncs.c \
../common/mm.c \
../common/utils.c \
mach64Screen = mmesa->mach64Screen = (mach64ScreenPtr)driScreen->private;
+ /* Parse configuration files */
+ driParseConfigFiles (&mmesa->optionCache, &mach64Screen->optionCache,
+ mach64Screen->driScreen->myNum, "mach64");
+
mmesa->sarea = (ATISAREAPrivPtr)((char *)driScreen->pSAREA +
sizeof(XF86DRISAREARec));
_swrast_allow_vertex_fog( ctx, GL_TRUE );
driInitExtensions( ctx, card_extensions, GL_TRUE );
+
mach64InitVB( ctx );
mach64InitTriFuncs( ctx );
- mach64DDInitDriverFuncs( ctx );
- mach64DDInitIoctlFuncs( ctx );
mach64DDInitStateFuncs( ctx );
mach64DDInitSpanFuncs( ctx );
- mach64DDInitTextureFuncs( ctx );
mach64DDInitState( mmesa );
mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS"));
GLuint vertex_stride_shift;
GLuint vertex_format;
GLuint num_verts;
- char *verts;
+ GLubyte *verts;
CARD32 Color; /* Current draw color */
CARD32 ClearColor; /* Color used to clear color buffer */
static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
- static GLubyte buffer[128];
+ static char buffer[128];
unsigned offset;
const char * card_name = "Mach64 [Rage Pro]";
GLuint agp_mode = mmesa->mach64Screen->IsPCI ? 0 :
/* Initialize the driver's misc functions.
*/
-void mach64DDInitDriverFuncs( GLcontext *ctx )
+void mach64InitDriverFuncs( struct dd_function_table *functions )
{
- ctx->Driver.GetBufferSize = mach64DDGetBufferSize;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetString = mach64DDGetString;
- ctx->Driver.Finish = mach64DDFinish;
- ctx->Driver.Flush = mach64DDFlush;
- ctx->Driver.Error = NULL;
+ functions->GetBufferSize = mach64DDGetBufferSize;
+ functions->ResizeBuffers = _swrast_alloc_buffers;
+ functions->GetString = mach64DDGetString;
+ functions->Finish = mach64DDFinish;
+ functions->Flush = mach64DDFlush;
+
}
#ifdef GLX_DIRECT_RENDERING
-extern void mach64DDInitDriverFuncs( GLcontext *ctx );
+extern void mach64InitDriverFuncs( struct dd_function_table *functions );
#endif
#endif
DMAADVANCE();
}
-void mach64DDInitIoctlFuncs( GLcontext *ctx )
+void mach64InitIoctlFuncs( struct dd_function_table *functions )
{
- ctx->Driver.Clear = mach64DDClear;
+ functions->Clear = mach64DDClear;
}
#endif
extern void mach64WaitForIdleLocked( mach64ContextPtr mmesa );
-
-extern void mach64DDInitIoctlFuncs( GLcontext *ctx );
-
+extern void mach64InitIoctlFuncs( struct dd_function_table *functions );
/* ================================================================
* Helper macros:
count);
}
-#ifndef IMPORT_QUALIFIER
-#define IMPORT_QUALIFIER static
-#endif
-
-IMPORT_QUALIFIER void TAG(import_float_colors)( GLcontext *ctx )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct gl_client_array *to = GET_UBYTE_COLOR_STORE();
- do_import( VB, to, VB->ColorPtr[0] );
- VB->ColorPtr[0] = to;
-}
-
-IMPORT_QUALIFIER void TAG(import_float_spec_colors)( GLcontext *ctx )
-{
- LOCALVARS
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
- struct gl_client_array *to = GET_UBYTE_SPEC_COLOR_STORE();
- do_import( VB, to, VB->SecondaryColorPtr[0] );
- VB->SecondaryColorPtr[0] = to;
-}
-
/* Interpolate the elements of the VB not included in typical hardware
* vertices.
*
#undef INTERP_QUALIFIER
-#undef IMPORT_QUALIFIER
#undef GET_COLOR
#undef IND
#endif
#endif
#if DO_SPEC
- GLubyte (*spec)[4];
+ GLfloat (*spec)[4];
GLuint spec_stride;
#endif
#if DO_FOG
GLuint fog_stride;
#endif
#if DO_RGBA
- GLubyte (*col)[4];
+ GLfloat (*col)[4];
GLuint col_stride;
#endif
GLfloat (*coord)[4];
#endif
#if DO_SPEC
- spec = (GLubyte (*)[4])VB->SecondaryColorPtr[0]->data;
+ spec = VB->SecondaryColorPtr[0]->data;
spec_stride = VB->SecondaryColorPtr[0]->stride;
#endif
tc0 = (GLfloat (*)[4])((GLubyte *)tc0 + start * tc0_stride);
#endif
#if DO_SPEC
- STRIDE_4UB(spec, start * spec_stride);
+ STRIDE_4F(spec, start * spec_stride);
#endif
#if DO_FOG
/* STRIDE_F(fog, start * fog_stride); */
fog = (GLfloat (*)[4])((GLubyte *)fog + start * fog_stride);
#endif
#if DO_RGBA
- STRIDE_4UB(col, start * col_stride);
+ STRIDE_4F(col, start * col_stride);
#endif
coord = (GLfloat (*)[4])((GLubyte *)coord + start * coord_stride);
}
((GLubyte *)p)[0] = spec[0][2]; /* VERTEX_?_SPEC_B */
((GLubyte *)p)[1] = spec[0][1]; /* VERTEX_?_SPEC_G */
((GLubyte *)p)[2] = spec[0][0]; /* VERTEX_?_SPEC_R */
- STRIDE_4UB(spec, spec_stride);
+ STRIDE_4F(spec, spec_stride);
#endif
#if DO_FOG
((GLubyte *)p)[3] = fog[0][0] * 255.0; /* VERTEX_?_SPEC_A */
*((GLubyte *)p)++ = col[0][1]; /* VERTEX_?_G */
*((GLubyte *)p)++ = col[0][0]; /* VERTEX_?_R */
*((GLubyte *)p)++ = col[0][3]; /* VERTEX_?_A */
- STRIDE_4UB(col, col_stride);
+ STRIDE_4F(col, col_stride);
#else
p++;
#endif
#include "utils.h"
#include "vblank.h"
+#ifndef _SOLO
#include "glxextensions.h"
+#endif
+
+/* Mach64 configuration
+ */
+#include "xmlpool.h"
+
+const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+ DRI_CONF_SECTION_PERFORMANCE
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+ DRI_CONF_SECTION_END
+#if ENABLE_PERF_BOXES
+ DRI_CONF_SECTION_DEBUG
+ DRI_CONF_PERFORMANCE_BOXES(false)
+ DRI_CONF_SECTION_END
+#endif
+DRI_CONF_END;
+#if ENABLE_PERF_BOXES
+static const GLuint __driNConfigOptions = 2;
+#else
+static const GLuint __driNConfigOptions = 1;
+#endif
+
/* Create the device specific screen private data struct.
*/
static mach64ScreenRec *
-mach64CreateScreen( __DRIscreenPrivate *driScreen )
+mach64CreateScreen( __DRIscreenPrivate *sPriv )
{
- mach64ScreenRec *mach64Screen;
- ATIDRIPtr serverInfo = (ATIDRIPtr)driScreen->pDevPriv;
+ mach64ScreenPtr mach64Screen;
+ ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
if ( MACH64_DEBUG & DEBUG_VERBOSE_DRI )
fprintf( stderr, "%s\n", __FUNCTION__ );
- if ( ! driCheckDriDdxDrmVersions( driScreen, "Mach64", 4, 0, 6, 4, 1, 0 ) )
+ if ( ! driCheckDriDdxDrmVersions( sPriv, "Mach64", 4, 0, 6, 4, 1, 0 ) )
return NULL;
/* Allocate the private area */
- mach64Screen = (mach64ScreenRec *) CALLOC( sizeof(*mach64Screen) );
+ mach64Screen = (mach64ScreenPtr) CALLOC( sizeof(*mach64Screen) );
if ( !mach64Screen ) return NULL;
-
+
+ /* parse information in __driConfigOptions */
+ driParseOptionInfo (&mach64Screen->optionCache,
+ __driConfigOptions, __driNConfigOptions);
+
mach64Screen->IsPCI = serverInfo->IsPCI;
{
gp.param = MACH64_PARAM_IRQ_NR;
gp.value = &mach64Screen->irq;
- ret = drmCommandWriteRead( driScreen->fd, DRM_MACH64_GETPARAM,
+ ret = drmCommandWriteRead( sPriv->fd, DRM_MACH64_GETPARAM,
&gp, sizeof(gp));
if (ret) {
fprintf(stderr, "DRM_MACH64_GETPARAM (MACH64_PARAM_IRQ_NR): %d\n", ret);
mach64Screen->mmio.handle = serverInfo->regs;
mach64Screen->mmio.size = serverInfo->regsSize;
- if ( drmMap( driScreen->fd,
+ if ( drmMap( sPriv->fd,
mach64Screen->mmio.handle,
mach64Screen->mmio.size,
(drmAddressPtr)&mach64Screen->mmio.map ) != 0 ) {
return NULL;
}
- mach64Screen->buffers = drmMapBufs( driScreen->fd );
+ mach64Screen->buffers = drmMapBufs( sPriv->fd );
if ( !mach64Screen->buffers ) {
drmUnmap( (drmAddress)mach64Screen->mmio.map,
mach64Screen->mmio.size );
if ( !mach64Screen->IsPCI ) {
mach64Screen->agpTextures.handle = serverInfo->agp;
mach64Screen->agpTextures.size = serverInfo->agpSize;
- if ( drmMap( driScreen->fd,
+ if ( drmMap( sPriv->fd,
mach64Screen->agpTextures.handle,
mach64Screen->agpTextures.size,
(drmAddressPtr)&mach64Screen->agpTextures.map ) ) {
mach64Screen->logTexGranularity[MACH64_AGP_HEAP] = serverInfo->logAgpTextureGranularity;
}
- mach64Screen->driScreen = driScreen;
+ mach64Screen->driScreen = sPriv;
+#ifndef _SOLO
+ if ( driCompareGLXAPIVersion( 20030813 ) >= 0 ) {
+ PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
+ (PFNGLXSCRENABLEEXTENSIONPROC) glXGetProcAddress( (const GLubyte *) "__glXScrEnableExtension" );
+ void * const psc = sPriv->psc->screenConfigs;
+
+ if ( glx_enable_extension != NULL ) {
+ if ( mach64Screen->irq != 0 ) {
+ (*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_MESA_swap_frame_usage" );
+ }
+ }
+#endif
return mach64Screen;
}
return GL_TRUE;
}
-
+#ifndef _SOLO
/* This function is called by libGL.so as soon as libGL.so is loaded.
* This is where we register new extension functions with the dispatcher.
*/
if ( driCompareGLXAPIVersion( 20030317 ) >= 0 ) {
glx_enable_extension = (PFNGLXENABLEEXTENSIONPROC)
- glXGetProcAddress( "__glXEnableExtension" );
+ glXGetProcAddress( (const GLubyte *) "__glXEnableExtension" );
if ( glx_enable_extension != NULL ) {
glx_enable_extension( "GLX_SGI_swap_control", GL_FALSE );
}
}
}
-
+#endif
static struct __DriverAPIRec mach64API = {
.InitDriver = mach64InitDriver,
* The __driCreateScreen name is the symbol that libGL.so fetches.
* Return: pointer to a __DRIscreenPrivate.
*/
+#ifndef _SOLO
void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config)
{
psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &mach64API);
return (void *) psp;
}
+#else
+void *__driCreateScreen(struct DRIDriverRec *driver,
+ struct DRIDriverContextRec *driverContext)
+{
+ __DRIscreenPrivate *psp;
+ psp = __driUtilCreateScreen(driver, driverContext, &mach64API);
+ return (void *) psp;
+}
+#endif
}
-void mach64DDInitTextureFuncs( GLcontext *ctx )
+void mach64InitTextureFuncs( struct dd_function_table *functions )
{
- ctx->Driver.TexEnv = mach64DDTexEnv;
- ctx->Driver.ChooseTextureFormat = mach64ChooseTextureFormat;
- ctx->Driver.TexImage1D = mach64TexImage1D;
- ctx->Driver.TexSubImage1D = mach64TexSubImage1D;
- ctx->Driver.TexImage2D = mach64TexImage2D;
- ctx->Driver.TexSubImage2D = mach64TexSubImage2D;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.TexParameter = mach64DDTexParameter;
- ctx->Driver.BindTexture = mach64DDBindTexture;
- ctx->Driver.DeleteTexture = mach64DDDeleteTexture;
- ctx->Driver.UpdateTexturePalette = NULL;
- ctx->Driver.ActiveTexture = NULL;
- ctx->Driver.IsTextureResident = mach64DDIsTextureResident;
- ctx->Driver.PrioritizeTexture = NULL;
+ functions->TexEnv = mach64DDTexEnv;
+ functions->ChooseTextureFormat = mach64ChooseTextureFormat;
+ functions->TexImage1D = mach64TexImage1D;
+ functions->TexSubImage1D = mach64TexSubImage1D;
+ functions->TexImage2D = mach64TexImage2D;
+ functions->TexSubImage2D = mach64TexSubImage2D;
+ functions->TexImage3D = _mesa_store_teximage3d;
+ functions->TexSubImage3D = _mesa_store_texsubimage3d;
+ functions->CopyTexImage1D = _swrast_copy_teximage1d;
+ functions->CopyTexImage2D = _swrast_copy_teximage2d;
+ functions->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
+ functions->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
+ functions->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
+ functions->TexParameter = mach64DDTexParameter;
+ functions->BindTexture = mach64DDBindTexture;
+ functions->DeleteTexture = mach64DDDeleteTexture;
+ functions->UpdateTexturePalette = NULL;
+ functions->ActiveTexture = NULL;
+ functions->IsTextureResident = mach64DDIsTextureResident;
+ functions->PrioritizeTexture = NULL;
}
mach64TexObjPtr t0,
mach64TexObjPtr t1 );
-extern void mach64DDInitTextureFuncs( GLcontext *ctx );
-
+extern void mach64InitTextureFuncs( struct dd_function_table *functions );
/* ================================================================
* Color conversion macros:
if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) )
return;
- image = t->tObj->Image[level];
+ image = t->tObj->Image[0][level];
if ( !image )
return;
if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) )
return;
- image = t->tObj->Image[level];
+ image = t->tObj->Image[0][level];
if ( !image )
return;
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
- mmesa->verts = (char *)ALIGN_MALLOC(size * 4 * 16, 32);
+ mmesa->verts = (GLubyte *)ALIGN_MALLOC(size * 4 * 16, 32);
{
static int firsttime = 1;
} drmMach64Blit;
typedef struct {
- enum {
- MACH64_PARAM_FRAMES_QUEUED = 0x01,
- MACH64_PARAM_IRQ_NR = 0x02
- } param;
+ int param;
int *value;
} drmMach64GetParam;
+#define MACH64_PARAM_FRAMES_QUEUED 1
+#define MACH64_PARAM_IRQ_NR 2
+
#endif /* __MACH64_COMMON_H__ */