summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2010-03-04 14:42:14 +0100
committerLuc Verhaegen <libv@skynet.be>2010-03-09 07:36:41 +0100
commit27550c48a797068c8285e8aa25646f4568b953f0 (patch)
treedf5b063b89e0ca0038f6fac385d6c760b14c7978
parent6f692a811778c3481b404e9c9a2d68504c39af08 (diff)
Import mach64 dri driver from mesa 7.1.0-7.2.0.7.2.07.1.0
-rw-r--r--configure.ac6
-rw-r--r--src/mach64_context.c14
-rw-r--r--src/mach64_context.h2
-rw-r--r--src/mach64_ioctl.c4
-rw-r--r--src/mach64_ioctl.h6
-rw-r--r--src/mach64_lock.c2
-rw-r--r--src/mach64_native_vb.c20
-rw-r--r--src/mach64_screen.c256
-rw-r--r--src/mach64_screen.h2
-rw-r--r--src/mach64_span.c2
-rw-r--r--src/mach64_state.c16
-rw-r--r--src/mach64_tex.h6
-rw-r--r--src/mach64_tris.c21
13 files changed, 139 insertions, 218 deletions
diff --git a/configure.ac b/configure.ac
index 825b9d5..8c4ea92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script
AC_PREREQ(2.57)
-AC_INIT([mesa-dri-mach64], 7.0.3, [], mesa-dri-mach64)
+AC_INIT([mesa-dri-mach64], 7.1.0, [], mesa-dri-mach64)
AM_INIT_AUTOMAKE([dist-bzip2])
@@ -16,8 +16,8 @@ AC_PROG_CC
AC_HEADER_STDC
PKG_CHECK_MODULES([DRM], [libdrm >= 2.3.0])
-PKG_CHECK_MODULES([DRI], [libmesadri >= 7.0.3 libmesadri < 7.1.0
- libmesadricommon >= 7.0.3 libmesadricommon < 7.1.0])
+PKG_CHECK_MODULES([DRI], [libmesadri >= 7.1.0 libmesadri < 7.3.0
+ libmesadricommon >= 7.1.0 libmesadricommon < 7.3.0])
AC_OUTPUT([
Makefile
diff --git a/src/mach64_context.c b/src/mach64_context.c
index ad661e1..f730c83 100644
--- a/src/mach64_context.c
+++ b/src/mach64_context.c
@@ -253,9 +253,6 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS"));
- mmesa->vblank_flags = (mmesa->do_irqs)
- ? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ;
-
driContextPriv->driverPrivate = (void *)mmesa;
if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
@@ -330,10 +327,15 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
}
- driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags,
- &newMach64Ctx->vbl_seq );
-
if ( newMach64Ctx->driDrawable != driDrawPriv ) {
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
+ driDrawPriv->vblFlags = (newMach64Ctx->do_irqs)
+ ? driGetDefaultVBlankFlags(&newMach64Ctx->optionCache)
+ : VBLANK_FLAG_NO_IRQ;
+
+ driDrawableInitVBlank( driDrawPriv );
+ }
+
newMach64Ctx->driDrawable = driDrawPriv;
mach64CalcViewport( newMach64Ctx->glCtx );
}
diff --git a/src/mach64_context.h b/src/mach64_context.h
index 8d89452..c602333 100644
--- a/src/mach64_context.h
+++ b/src/mach64_context.h
@@ -263,8 +263,6 @@ struct mach64_context {
/* VBI
*/
- GLuint vbl_seq;
- GLuint vblank_flags;
GLuint do_irqs;
/* Configuration cache
diff --git a/src/mach64_ioctl.c b/src/mach64_ioctl.c
index 36e7d3c..3bcec50 100644
--- a/src/mach64_ioctl.c
+++ b/src/mach64_ioctl.c
@@ -279,7 +279,7 @@ static int mach64WaitForFrameCompletion( mach64ContextPtr mmesa )
/* Copy the back color buffer to the front color buffer.
*/
-void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv )
+void mach64CopyBuffer( __DRIdrawablePrivate *dPriv )
{
mach64ContextPtr mmesa;
GLint nbox, i, ret;
@@ -320,7 +320,7 @@ void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv )
#endif
UNLOCK_HARDWARE( mmesa );
- driWaitForVBlank( dPriv, &mmesa->vbl_seq, mmesa->vblank_flags, &missed_target );
+ driWaitForVBlank( dPriv, &missed_target );
LOCK_HARDWARE( mmesa );
/* use front buffer cliprects */
diff --git a/src/mach64_ioctl.h b/src/mach64_ioctl.h
index 52fe863..3e5faff 100644
--- a/src/mach64_ioctl.h
+++ b/src/mach64_ioctl.h
@@ -44,7 +44,7 @@ extern void mach64FlushVerticesLocked( mach64ContextPtr mmesa );
extern void mach64FlushDMALocked( mach64ContextPtr mmesa );
extern void mach64UploadHwStateLocked( mach64ContextPtr mmesa );
-static __inline void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes )
+static INLINE void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes )
{
CARD32 *head;
@@ -60,7 +60,7 @@ static __inline void *mach64AllocDmaLow( mach64ContextPtr mmesa, int bytes )
return head;
}
-static __inline void *mach64AllocDmaLocked( mach64ContextPtr mmesa, int bytes )
+static INLINE void *mach64AllocDmaLocked( mach64ContextPtr mmesa, int bytes )
{
CARD32 *head;
@@ -78,7 +78,7 @@ extern void mach64FireBlitLocked( mach64ContextPtr mmesa, void *buffer,
GLint offset, GLint pitch, GLint format,
GLint x, GLint y, GLint width, GLint height );
-extern void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv );
+extern void mach64CopyBuffer( __DRIdrawablePrivate *dPriv );
#if ENABLE_PERF_BOXES
extern void mach64PerformanceCounters( mach64ContextPtr mmesa );
extern void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa );
diff --git a/src/mach64_lock.c b/src/mach64_lock.c
index b73e350..13e212b 100644
--- a/src/mach64_lock.c
+++ b/src/mach64_lock.c
@@ -70,7 +70,7 @@ void mach64GetLock( mach64ContextPtr mmesa, GLuint flags )
if ( mmesa->lastStamp != dPriv->lastStamp ) {
mmesa->lastStamp = dPriv->lastStamp;
- if (mmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
+ if (mmesa->glCtx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_BACK_LEFT)
mach64SetCliprects( mmesa->glCtx, GL_BACK_LEFT );
else
mach64SetCliprects( mmesa->glCtx, GL_FRONT_LEFT );
diff --git a/src/mach64_native_vb.c b/src/mach64_native_vb.c
index 81bcf80..248fa2a 100644
--- a/src/mach64_native_vb.c
+++ b/src/mach64_native_vb.c
@@ -44,7 +44,7 @@ void TAG(translate_vertex)(GLcontext *ctx,
UNVIEWPORT_VARS;
CARD32 *p = (CARD32 *)src + 10 - mmesa->vertex_size;
- dst->win[3] = 1.0;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
switch ( format ) {
case TEX1_VERTEX_FORMAT:
@@ -75,17 +75,17 @@ void TAG(translate_vertex)(GLcontext *ctx,
dst->attrib[FRAG_ATTRIB_TEX0][1] = LE32_IN_FLOAT( p++ );
#endif
dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0;
- dst->win[3] = LE32_IN_FLOAT( p++ );
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = LE32_IN_FLOAT( p++ );
case NOTEX_VERTEX_FORMAT:
- dst->specular[2] = ((GLubyte *)p)[0];
- dst->specular[1] = ((GLubyte *)p)[1];
- dst->specular[0] = ((GLubyte *)p)[2];
- dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3];
+ dst->attrib[FRAG_ATTRIB_COL1][2] = UBYTE_TO_FLOAT(((GLubyte *)p)[0]);
+ dst->attrib[FRAG_ATTRIB_COL1][1] = UBYTE_TO_FLOAT(((GLubyte *)p)[1]);
+ dst->attrib[FRAG_ATTRIB_COL1][0] = UBYTE_TO_FLOAT(((GLubyte *)p)[2]);
+ dst->attrib[FRAG_ATTRIB_FOGC][0] = ((GLubyte *)p)[3]; /*XXX int->float?*/
p++;
case TINY_VERTEX_FORMAT:
- dst->win[2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( LE32_IN( p++ ) );
dst->color[2] = ((GLubyte *)p)[0];
dst->color[1] = ((GLubyte *)p)[1];
@@ -96,14 +96,14 @@ void TAG(translate_vertex)(GLcontext *ctx,
{
GLuint xy = LE32_IN( p );
- dst->win[0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
- dst->win[1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( (GLfloat)(GLshort)( xy >> 16 ) );
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( (GLfloat)(GLshort)( xy & 0xffff ) );
}
}
assert( p + 1 - (CARD32 *)src == 10 );
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = ctx->Point.Size;
}
diff --git a/src/mach64_screen.c b/src/mach64_screen.c
index 4e9e216..2dba50f 100644
--- a/src/mach64_screen.c
+++ b/src/mach64_screen.c
@@ -69,79 +69,15 @@ static const GLuint __driNConfigOptions = 2;
extern const struct dri_extension card_extensions[];
-static __GLcontextModes * fill_in_modes( __GLcontextModes * modes,
- unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits,
- const GLenum * db_modes,
- unsigned num_db_modes,
- int visType )
+static const __DRIconfig **
+mach64FillInModes( __DRIscreenPrivate *psp,
+ unsigned pixel_bits, unsigned depth_bits,
+ unsigned stencil_bits, GLboolean have_back_buffer )
{
- static const u_int8_t bits[2][4] = {
- { 5, 6, 5, 0 },
- { 8, 8, 8, 0 }
- };
-
- static const u_int32_t masks[2][4] = {
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 },
- { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }
- };
-
- unsigned i;
- unsigned j;
- const unsigned index = ((pixel_bits + 15) / 16) - 1;
-
- for ( i = 0 ; i < num_db_modes ; i++ ) {
- for ( j = 0 ; j < 2 ; j++ ) {
-
- modes->redBits = bits[index][0];
- modes->greenBits = bits[index][1];
- modes->blueBits = bits[index][2];
- modes->alphaBits = bits[index][3];
- modes->redMask = masks[index][0];
- modes->greenMask = masks[index][1];
- modes->blueMask = masks[index][2];
- modes->alphaMask = masks[index][3];
- modes->rgbBits = modes->redBits + modes->greenBits
- + modes->blueBits + modes->alphaBits;
-
- modes->accumRedBits = 16 * j;
- modes->accumGreenBits = 16 * j;
- modes->accumBlueBits = 16 * j;
- modes->accumAlphaBits = 0;
- modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG;
- modes->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
- modes->stencilBits = stencil_bits;
- modes->depthBits = depth_bits;
-
- modes->visualType = visType;
- modes->renderType = GLX_RGBA_BIT;
- modes->rgbMode = GL_TRUE;
-
- if ( db_modes[i] == GLX_NONE ) {
-
- modes->doubleBufferMode = GL_FALSE;
- }
- else {
- modes->doubleBufferMode = GL_TRUE;
- modes->swapMethod = db_modes[i];
- }
-
- modes = modes->next;
- }
- }
-
- return modes;
-}
-
-
-static __GLcontextModes *
-mach64FillInModes( unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer )
-{
- __GLcontextModes * modes;
+ __DRIconfig **configs;
__GLcontextModes * m;
- unsigned num_modes;
+ GLenum fb_format;
+ GLenum fb_type;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
unsigned i;
@@ -155,49 +91,51 @@ mach64FillInModes( unsigned pixel_bits, unsigned depth_bits,
GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
};
- int depth_buffer_modes[2][2];
-
+ u_int8_t depth_bits_array[2];
+ u_int8_t stencil_bits_array[2];
- depth_buffer_modes[0][0] = depth_bits;
- depth_buffer_modes[1][0] = depth_bits;
+ depth_bits_array[0] = depth_bits;
+ depth_bits_array[1] = depth_bits;
/* Just like with the accumulation buffer, always provide some modes
* with a stencil buffer. It will be a sw fallback, but some apps won't
* care about that.
*/
- depth_buffer_modes[0][1] = 0;
- depth_buffer_modes[1][1] = (stencil_bits == 0) ? 8 : stencil_bits;
+ stencil_bits_array[0] = 0;
+ stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR );
+ if (pixel_bits == 16) {
+ fb_format = GL_RGB;
+ fb_type = GL_UNSIGNED_SHORT_5_6_5;
+ }
+ else {
+ fb_format = GL_BGRA;
+ fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR );
+ configs = driCreateConfigs(fb_format, fb_type,
+ depth_bits_array, stencil_bits_array,
+ depth_buffer_factor, back_buffer_modes,
+ back_buffer_factor);
+ if (configs == NULL) {
+ fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
+ __func__, __LINE__);
+ return NULL;
}
/* Mark the visual as slow if there are "fake" stencil bits.
*/
- for ( m = modes ; m != NULL ; m = m->next ) {
- if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ){
- m->visualRating = GLX_SLOW_CONFIG;
- }
+ for (i = 0; configs[i]; i++) {
+ m = &configs[i]->modes;
+ if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
+ m->visualRating = GLX_SLOW_CONFIG;
+ }
}
- return modes;
+ return (const __DRIconfig **) configs;
}
@@ -208,9 +146,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
{
mach64ScreenPtr mach64Screen;
ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
+ int i;
if (sPriv->devPrivSize != sizeof(ATIDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n");
@@ -319,15 +255,14 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
mach64Screen->driScreen = sPriv;
- 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" );
+ i = 0;
+ mach64Screen->extensions[i++] = &driFrameTrackingExtension.base;
+ if ( mach64Screen->irq != 0 ) {
+ mach64Screen->extensions[i++] = &driSwapControlExtension.base;
+ mach64Screen->extensions[i++] = &driMediaStreamCounterExtension.base;
}
+ mach64Screen->extensions[i++] = NULL;
+ sPriv->extensions = mach64Screen->extensions;
return mach64Screen;
}
@@ -475,9 +410,48 @@ mach64InitDriver( __DRIscreenPrivate *driScreen )
return GL_TRUE;
}
+/**
+ * This is the driver specific part of the createNewScreen entry point.
+ *
+ * \todo maybe fold this into intelInitDriver
+ *
+ * \return the __GLcontextModes supported by this driver
+ */
+static const __DRIconfig **
+mach64InitScreen(__DRIscreenPrivate *psp)
+{
+ static const __DRIversion ddx_expected = { 6, 4, 0 };
+ static const __DRIversion dri_expected = { 4, 0, 0 };
+ static const __DRIversion drm_expected = { 2, 0, 0 };
+ ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
-static struct __DriverAPIRec mach64API = {
- .InitDriver = mach64InitDriver,
+ if ( ! driCheckDriDdxDrmVersions2( "Mach64",
+ &psp->dri_version, & dri_expected,
+ &psp->ddx_version, & ddx_expected,
+ &psp->drm_version, & drm_expected ) ) {
+ return NULL;
+ }
+
+ /* Calling driInitExtensions here, with a NULL context pointer,
+ * does not actually enable the extensions. It just makes sure
+ * that all the dispatch offsets for all the extensions that
+ * *might* be enables are known. This is needed because the
+ * dispatch offsets need to be known when _mesa_context_create is
+ * called, but we can't enable the extensions until we have a
+ * context pointer.
+ *
+ * Hello chicken. Hello egg. How are you two today?
+ */
+ driInitExtensions( NULL, card_extensions, GL_FALSE );
+
+ if (!mach64InitDriver(psp))
+ return NULL;
+
+ return mach64FillInModes( psp, dri_priv->cpp * 8, 16, 0, 1);
+}
+
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = mach64InitScreen,
.DestroyScreen = mach64DestroyScreen,
.CreateContext = mach64CreateContext,
.DestroyContext = mach64DestroyContext,
@@ -487,71 +461,9 @@ static struct __DriverAPIRec mach64API = {
.MakeCurrent = mach64MakeCurrent,
.UnbindContext = mach64UnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = driGetMSC32,
+ .GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};
-
-/**
- * This is the bootstrap function for the driver. libGL supplies all of the
- * requisite information about the system, and the driver initializes itself.
- * This routine also fills in the linked list pointed to by \c driver_modes
- * with the \c __GLcontextModes that the driver can support for windows or
- * pbuffers.
- *
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 6, 4, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 2, 0, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "Mach64",
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
- return NULL;
- }
-
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- ddx_version, dri_version, drm_version,
- frame_buffer, pSAREA, fd,
- internal_api_version, &mach64API);
- if ( psp != NULL ) {
- ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv;
- *driver_modes = mach64FillInModes( dri_priv->cpp * 8,
- 16,
- 0,
- 1);
-
- /* Calling driInitExtensions here, with a NULL context pointer, does not actually
- * enable the extensions. It just makes sure that all the dispatch offsets for all
- * the extensions that *might* be enables are known. This is needed because the
- * dispatch offsets need to be known when _mesa_context_create is called, but we can't
- * enable the extensions until we have a context pointer.
- *
- * Hello chicken. Hello egg. How are you two today?
- */
- driInitExtensions( NULL, card_extensions, GL_FALSE );
- }
-
- return (void *) psp;
-}
diff --git a/src/mach64_screen.h b/src/mach64_screen.h
index 5305058..766554d 100644
--- a/src/mach64_screen.h
+++ b/src/mach64_screen.h
@@ -73,6 +73,8 @@ typedef struct {
__DRIscreenPrivate *driScreen;
driOptionCache optionCache;
+
+ const __DRIextension *extensions[4];
} mach64ScreenRec, *mach64ScreenPtr;
#endif /* __MACH64_SCREEN_H__ */
diff --git a/src/mach64_span.c b/src/mach64_span.c
index 3830a28..aa8c725 100644
--- a/src/mach64_span.c
+++ b/src/mach64_span.c
@@ -117,6 +117,8 @@
/* 16 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLushort
+
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)(buf + ((_x) + (_y) * drb->pitch) * 2) = d;
diff --git a/src/mach64_state.c b/src/mach64_state.c
index 667a394..10a5b40 100644
--- a/src/mach64_state.c
+++ b/src/mach64_state.c
@@ -726,24 +726,26 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
FLUSH_BATCH( mmesa );
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
+ if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
+ FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
+ }
+
+ switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
+ case BUFFER_FRONT_LEFT:
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
mach64SetCliprects( ctx, GL_FRONT_LEFT );
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
mach64SetCliprects( ctx, GL_BACK_LEFT );
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
break;
default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_TRUE );
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
fprintf(stderr,"%s: fallback (mode=%d)\n", __FUNCTION__, mode);
diff --git a/src/mach64_tex.h b/src/mach64_tex.h
index f6cf1cf..933cfbb 100644
--- a/src/mach64_tex.h
+++ b/src/mach64_tex.h
@@ -72,9 +72,9 @@ extern void mach64InitTextureFuncs( struct dd_function_table *functions );
#define MACH64PACKCOLOR4444(r, g, b, a) \
((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
-static __inline__ GLuint mach64PackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
+static INLINE GLuint mach64PackColor( GLuint cpp,
+ GLubyte r, GLubyte g,
+ GLubyte b, GLubyte a )
{
switch ( cpp ) {
case 2:
diff --git a/src/mach64_tris.c b/src/mach64_tris.c
index 08cc184..5ce348f 100644
--- a/src/mach64_tris.c
+++ b/src/mach64_tris.c
@@ -113,7 +113,7 @@ do { \
#define COPY_VERTEX_OOA( vb, vertsize, v, n ) DO_COPY_VERTEX( vb, vertsize, v, n, 1 )
-static __inline void mach64_draw_quad( mach64ContextPtr mmesa,
+static INLINE void mach64_draw_quad( mach64ContextPtr mmesa,
mach64VertexPtr v0,
mach64VertexPtr v1,
mach64VertexPtr v2,
@@ -419,7 +419,7 @@ static __inline void mach64_draw_quad( mach64ContextPtr mmesa,
#endif
}
-static __inline void mach64_draw_triangle( mach64ContextPtr mmesa,
+static INLINE void mach64_draw_triangle( mach64ContextPtr mmesa,
mach64VertexPtr v0,
mach64VertexPtr v1,
mach64VertexPtr v2 )
@@ -666,14 +666,17 @@ static __inline void mach64_draw_triangle( mach64ContextPtr mmesa,
#endif
}
-static __inline void mach64_draw_line( mach64ContextPtr mmesa,
+static INLINE void mach64_draw_line( mach64ContextPtr mmesa,
mach64VertexPtr v0,
mach64VertexPtr v1 )
{
#if MACH64_NATIVE_VTXFMT
GLcontext *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
- GLint width = (GLint)(mmesa->glCtx->Line._Width * 2.0); /* 2 fractional bits for hardware */
+ /* 2 fractional bits for hardware: */
+ const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width,
+ mmesa->glCtx->Const.MinLineWidth,
+ mmesa->glCtx->Const.MaxLineWidth));
GLfloat ooa;
GLuint *pxy0, *pxy1;
GLuint xy0old, xy0, xy1old, xy1;
@@ -691,9 +694,6 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
mach64_print_vertex( ctx, v1 );
}
- if( !width )
- width = 1; /* round to the nearest supported width */
-
pxy0 = &v0->ui[xyoffset];
xy0old = *pxy0;
xy0 = LE32_IN( &xy0old );
@@ -955,13 +955,16 @@ static __inline void mach64_draw_line( mach64ContextPtr mmesa,
#endif
}
-static __inline void mach64_draw_point( mach64ContextPtr mmesa,
+static INLINE void mach64_draw_point( mach64ContextPtr mmesa,
mach64VertexPtr v0 )
{
#if MACH64_NATIVE_VTXFMT
GLcontext *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
- GLint sz = (GLint)(mmesa->glCtx->Point._Size * 2.0); /* 2 fractional bits for hardware */
+ /* 2 fractional bits for hardware: */
+ GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size,
+ ctx->Const.MinPointSize,
+ ctx->Const.MaxPointSize));
GLfloat ooa;
GLuint *pxy;
GLuint xyold, xy;