summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2010-03-11 02:02:32 +0100
committerLuc Verhaegen <libv@skynet.be>2010-03-11 02:02:32 +0100
commit55e1d835c97b4078766fe8f29e1b1d66ce5ec5c7 (patch)
tree597661d4db565fbca9a32071fb5ba161c265db80
parent5347249ae0486e833f851e841c007bc4137395c2 (diff)
Import mga dri driver from mesa 7.1.0.7.2.07.1.0
-rw-r--r--configure.ac6
-rw-r--r--src/mga_xmesa.c213
-rw-r--r--src/mgacontext.h11
-rw-r--r--src/mgadd.c2
-rw-r--r--src/mgaioctl.c15
-rw-r--r--src/mgaioctl.h4
-rw-r--r--src/mgaspan.c6
-rw-r--r--src/mgastate.c21
-rw-r--r--src/mgatris.c18
9 files changed, 135 insertions, 161 deletions
diff --git a/configure.ac b/configure.ac
index a4bb79b..d8937c8 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-mga], 7.0.3, [], mesa-dri-mga)
+AC_INIT([mesa-dri-mga], 7.1.0, [], mesa-dri-mga)
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/mga_xmesa.c b/src/mga_xmesa.c
index f4e651a..c271c8e 100644
--- a/src/mga_xmesa.c
+++ b/src/mga_xmesa.c
@@ -75,11 +75,13 @@
#define need_GL_ARB_vertex_buffer_object
#define need_GL_ARB_vertex_program
#define need_GL_EXT_fog_coord
+#define need_GL_EXT_gpu_program_parameters
#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
#if 0
#define need_GL_EXT_paletted_texture
#endif
+#define need_GL_APPLE_vertex_array_object
#define need_GL_NV_vertex_program
#include "extension_helper.h"
@@ -110,19 +112,18 @@ static const GLuint __driNConfigOptions = 6;
int MGA_DEBUG = 0;
#endif
-static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo );
-
-static __GLcontextModes *
-mgaFillInModes( unsigned pixel_bits, unsigned depth_bits,
+static const __DRIconfig **
+mgaFillInModes( __DRIscreenPrivate *psp,
+ unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
{
- __GLcontextModes * modes;
+ __DRIconfig **configs;
__GLcontextModes * m;
- unsigned num_modes;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
GLenum fb_type;
+ int i;
/* GLX_SWAP_COPY_OML is only supported because the MGA driver doesn't
* support pageflipping at all.
@@ -150,8 +151,6 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits,
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
if ( pixel_bits == 16 ) {
fb_format = GL_RGB;
fb_type = GL_UNSIGNED_SHORT_5_6_5;
@@ -161,46 +160,41 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits,
fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR ) ) {
- fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__ );
- return NULL;
- }
-
- if ( ! driFillInModes( & m, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- 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;
- }
- }
+ /* Mark the visual as slow if there are "fake" stencil bits.
+ */
+ 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;
}
+const __DRIextension *mgaScreenExtensions[] = {
+ &driReadDrawableExtension,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ NULL
+};
static GLboolean
mgaInitDriver(__DRIscreenPrivate *sPriv)
{
mgaScreenPrivate *mgaScreen;
MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(MGADRIRec)) {
fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n");
@@ -217,7 +211,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
mgaScreen->sPriv = sPriv;
sPriv->private = (void *)mgaScreen;
- if (sPriv->drmMinor >= 1) {
+ if (sPriv->drm_version.minor >= 1) {
int ret;
drm_mga_getparam_t gp;
@@ -235,13 +229,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
}
}
- if ( glx_enable_extension != NULL ) {
- (*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" );
- }
+ sPriv->extensions = mgaScreenExtensions;
if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
serverInfo->chipset != MGA_CARD_TYPE_G400) {
@@ -274,7 +262,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
* there is a new, in-kernel mechanism for handling the wait.
*/
- if (mgaScreen->sPriv->drmMinor < 2) {
+ if (mgaScreen->sPriv->drm_version.minor < 2) {
mgaScreen->mmio.handle = serverInfo->registers.handle;
mgaScreen->mmio.size = serverInfo->registers.size;
if ( drmMap( sPriv->fd,
@@ -412,13 +400,15 @@ static const struct dri_extension card_extensions[] =
#endif
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
{ "GL_EXT_stencil_wrap", NULL },
+ { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions },
{ "GL_MESA_ycbcr_texture", NULL },
{ "GL_SGIS_generate_mipmap", NULL },
{ NULL, NULL }
};
-static const struct dri_extension ARB_vp_extension[] = {
+static const struct dri_extension ARB_vp_extensions[] = {
{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
+ { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions },
{ NULL, NULL }
};
@@ -623,7 +613,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
}
if ( driQueryOptionb( &mmesa->optionCache, "arb_vertex_program" ) ) {
- driInitSingleExtension( ctx, ARB_vp_extension );
+ driInitExtensions(ctx, ARB_vp_extensions, GL_FALSE);
}
if ( driQueryOptionb( &mmesa->optionCache, "nv_vertex_program" ) ) {
@@ -647,10 +637,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
debug_control );
#endif
- mmesa->vblank_flags = (mmesa->mgaScreen->irq == 0)
- ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache);
-
- (*dri_interface->getUST)( & mmesa->swap_ust );
+ (*sPriv->systemTime->getUST)( & mmesa->swap_ust );
if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
fprintf(stderr, "disabling 3D acceleration\n");
@@ -879,8 +866,14 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate;
if (mmesa->driDrawable != driDrawPriv) {
- driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags,
- &mmesa->vbl_seq );
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
+ driDrawPriv->vblFlags = (mmesa->mgaScreen->irq == 0)
+ ? VBLANK_FLAG_NO_IRQ
+ : driGetDefaultVBlankFlags(&mmesa->optionCache);
+
+ driDrawableInitVBlank( driDrawPriv );
+ }
+
mmesa->driDrawable = driDrawPriv;
mmesa->dirty = ~0;
mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK);
@@ -934,88 +927,51 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
}
-static const struct __DriverAPIRec mgaAPI = {
- .InitDriver = mgaInitDriver,
- .DestroyScreen = mgaDestroyScreen,
- .CreateContext = mgaCreateContext,
- .DestroyContext = mgaDestroyContext,
- .CreateBuffer = mgaCreateBuffer,
- .DestroyBuffer = mgaDestroyBuffer,
- .SwapBuffers = mgaSwapBuffers,
- .MakeCurrent = mgaMakeCurrent,
- .UnbindContext = mgaUnbindContext,
- .GetSwapInfo = getSwapInfo,
- .GetMSC = driGetMSC32,
- .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.
+ * This is the driver specific part of the createNewScreen entry point.
*
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
+ * \todo maybe fold this into intelInitDriver
+ *
+ * \return the __GLcontextModes supported by this driver
*/
-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 )
-
+static const __DRIconfig **mgaInitScreen(__DRIscreen *psp)
{
- __DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 2, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 3, 0, 0 };
-
- dri_interface = interface;
+ MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
if ( ! driCheckDriDdxDrmVersions2( "MGA",
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
+ &psp->dri_version, & dri_expected,
+ &psp->ddx_version, & ddx_expected,
+ &psp->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, &mgaAPI);
- if ( psp != NULL ) {
- MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv;
- *driver_modes = mgaFillInModes( dri_priv->cpp * 8,
- (dri_priv->cpp == 2) ? 16 : 24,
- (dri_priv->cpp == 2) ? 0 : 8,
- (dri_priv->backOffset != dri_priv->depthOffset) );
-
- /* 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 );
- driInitExtensions( NULL, g400_extensions, GL_FALSE );
- driInitSingleExtension( NULL, ARB_vp_extension );
- driInitExtensions( NULL, NV_vp_extensions, GL_FALSE );
- }
+ /* 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?
+ */
- return (void *) psp;
+ driInitExtensions( NULL, card_extensions, GL_FALSE );
+ driInitExtensions( NULL, g400_extensions, GL_FALSE );
+ driInitExtensions(NULL, ARB_vp_extensions, GL_FALSE);
+ driInitExtensions( NULL, NV_vp_extensions, GL_FALSE );
+
+ if (!mgaInitDriver(psp))
+ return NULL;
+
+ return mgaFillInModes( psp,
+ dri_priv->cpp * 8,
+ (dri_priv->cpp == 2) ? 16 : 24,
+ (dri_priv->cpp == 2) ? 0 : 8,
+ (dri_priv->backOffset != dri_priv->depthOffset) );
}
@@ -1044,3 +1000,20 @@ getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo )
return 0;
}
+
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = mgaInitScreen,
+ .DestroyScreen = mgaDestroyScreen,
+ .CreateContext = mgaCreateContext,
+ .DestroyContext = mgaDestroyContext,
+ .CreateBuffer = mgaCreateBuffer,
+ .DestroyBuffer = mgaDestroyBuffer,
+ .SwapBuffers = mgaSwapBuffers,
+ .MakeCurrent = mgaMakeCurrent,
+ .UnbindContext = mgaUnbindContext,
+ .GetSwapInfo = getSwapInfo,
+ .GetDrawableMSC = driDrawableGetMSC32,
+ .WaitForMSC = driWaitForMSC32,
+ .WaitForSBC = NULL,
+ .SwapBuffersMSC = NULL
+};
diff --git a/src/mgacontext.h b/src/mgacontext.h
index 2124006..55d8238 100644
--- a/src/mgacontext.h
+++ b/src/mgacontext.h
@@ -258,11 +258,6 @@ struct mga_context_t {
drmBufPtr vertex_dma_buffer;
drmBufPtr iload_buffer;
- /* VBI
- */
- GLuint vbl_seq;
- GLuint vblank_flags;
-
int64_t swap_ust;
int64_t swap_missed_ust;
@@ -334,9 +329,9 @@ extern int MGA_DEBUG;
#define DEBUG_VERBOSE_TEXTURE 0x08
#define DEBUG_VERBOSE_FALLBACK 0x10
-static __inline__ GLuint mgaPackColor(GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a)
+static INLINE GLuint mgaPackColor(GLuint cpp,
+ GLubyte r, GLubyte g,
+ GLubyte b, GLubyte a)
{
switch (cpp) {
case 2:
diff --git a/src/mgadd.c b/src/mgadd.c
index b1d5e0c..6d18bd8 100644
--- a/src/mgadd.c
+++ b/src/mgadd.c
@@ -41,7 +41,7 @@
#include "mga_xmesa.h"
#include "utils.h"
-#define DRIVER_DATE "20061030"
+#define DRIVER_DATE "20071017"
/***************************************
diff --git a/src/mgaioctl.c b/src/mgaioctl.c
index f8587fc..dee9399 100644
--- a/src/mgaioctl.c
+++ b/src/mgaioctl.c
@@ -55,7 +55,7 @@ mgaSetFence( mgaContextPtr mmesa, uint32_t * fence )
{
int ret = ENOSYS;
- if ( mmesa->driScreen->drmMinor >= 2 ) {
+ if ( mmesa->driScreen->drm_version.minor >= 2 ) {
ret = drmCommandWriteRead( mmesa->driScreen->fd, DRM_MGA_SET_FENCE,
fence, sizeof( uint32_t ));
if (ret) {
@@ -73,7 +73,7 @@ mgaWaitFence( mgaContextPtr mmesa, uint32_t fence, uint32_t * curr_fence )
{
int ret = ENOSYS;
- if ( mmesa->driScreen->drmMinor >= 2 ) {
+ if ( mmesa->driScreen->drm_version.minor >= 2 ) {
uint32_t temp = fence;
ret = drmCommandWriteRead( mmesa->driScreen->fd,
@@ -409,7 +409,7 @@ static void mgaWaitForFrameCompletion( mgaContextPtr mmesa )
/*
* Copy the back buffer to the front buffer.
*/
-void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
+void mgaCopyBuffer( __DRIdrawablePrivate *dPriv )
{
mgaContextPtr mmesa;
drm_clip_rect_t *pbox;
@@ -417,7 +417,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
GLint ret;
GLint i;
GLboolean missed_target;
-
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
@@ -428,11 +428,10 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
FLUSH_BATCH( mmesa );
mgaWaitForFrameCompletion( mmesa );
- driWaitForVBlank( dPriv, & mmesa->vbl_seq, mmesa->vblank_flags,
- & missed_target );
+ driWaitForVBlank( dPriv, & missed_target );
if ( missed_target ) {
mmesa->swap_missed_count++;
- (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust );
+ (void) (*psp->systemTime->getUST)( & mmesa->swap_missed_ust );
}
LOCK_HARDWARE( mmesa );
@@ -470,7 +469,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv )
mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
mmesa->swap_count++;
- (void) (*dri_interface->getUST)( & mmesa->swap_ust );
+ (void) (*psp->systemTime->getUST)( & mmesa->swap_ust );
}
diff --git a/src/mgaioctl.h b/src/mgaioctl.h
index f3ae749..3a37723 100644
--- a/src/mgaioctl.h
+++ b/src/mgaioctl.h
@@ -33,7 +33,7 @@
#include "mgacontext.h"
#include "mga_xmesa.h"
-void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv );
+void mgaCopyBuffer( __DRIdrawablePrivate *dPriv );
void mgaWaitForVBlank( mgaContextPtr mmesa );
void mgaGetILoadBufferLocked( mgaContextPtr mmesa );
@@ -62,7 +62,7 @@ void mgaInitIoctlFuncs( struct dd_function_table *functions );
extern drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa );
-static __inline
+static INLINE
GLuint *mgaAllocDmaLow( mgaContextPtr mmesa, int bytes )
{
GLuint *head;
diff --git a/src/mgaspan.c b/src/mgaspan.c
index 05dcbb8..7ac5966 100644
--- a/src/mgaspan.c
+++ b/src/mgaspan.c
@@ -107,6 +107,8 @@
/* 16 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLushort
+
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
@@ -121,6 +123,8 @@
/* 32 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH( _x, _y, d ) \
*(GLuint *)(buf + (_x)*4 + (_y)*pitch) = d;
@@ -134,6 +138,8 @@
/* 24/8 bit interleaved depth/stencil functions
*/
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH( _x, _y, d ) { \
GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*pitch); \
tmp &= 0xff; \
diff --git a/src/mgastate.c b/src/mgastate.c
index c20a76f..1d413d3 100644
--- a/src/mgastate.c
+++ b/src/mgastate.c
@@ -778,8 +778,6 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
{
__DRIdrawablePrivate *const driDrawable = mmesa->driDrawable;
__DRIdrawablePrivate *const driReadable = mmesa->driReadable;
- drm_mga_sarea_t *sarea = mmesa->sarea;
-
mmesa->dirty_cliprects = 0;
@@ -790,9 +788,6 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers )
mga_set_cliprects(mmesa);
- sarea->req_drawable = driDrawable->draw;
- sarea->req_draw_buffer = mmesa->draw_buffer;
-
mgaUpdateClipping( mmesa->glCtx );
mgaCalcViewport( mmesa->glCtx );
}
@@ -804,20 +799,22 @@ static void mgaDDDrawBuffer(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( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
+ }
+
+ switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
+ case BUFFER_FRONT_LEFT:
mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
mmesa->draw_buffer = MGA_FRONT;
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
mmesa->draw_buffer = MGA_BACK;
break;
default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
diff --git a/src/mgatris.c b/src/mgatris.c
index 2b7ea05..9f270d7 100644
--- a/src/mgatris.c
+++ b/src/mgatris.c
@@ -67,7 +67,7 @@ do { \
} while (0)
#endif
-static void __inline__ mga_draw_triangle( mgaContextPtr mmesa,
+static void INLINE mga_draw_triangle( mgaContextPtr mmesa,
mgaVertexPtr v0,
mgaVertexPtr v1,
mgaVertexPtr v2 )
@@ -82,7 +82,7 @@ static void __inline__ mga_draw_triangle( mgaContextPtr mmesa,
}
-static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
+static void INLINE mga_draw_quad( mgaContextPtr mmesa,
mgaVertexPtr v0,
mgaVertexPtr v1,
mgaVertexPtr v2,
@@ -101,11 +101,13 @@ static void __inline__ mga_draw_quad( mgaContextPtr mmesa,
}
-static __inline__ void mga_draw_point( mgaContextPtr mmesa,
+static INLINE void mga_draw_point( mgaContextPtr mmesa,
mgaVertexPtr tmp )
{
- GLfloat sz = mmesa->glCtx->Point._Size * .5;
- int vertex_size = mmesa->vertex_size;
+ const GLfloat sz = 0.5 * CLAMP(mmesa->glCtx->Point.Size,
+ mmesa->glCtx->Const.MinPointSize,
+ mmesa->glCtx->Const.MaxPointSize);
+ const int vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
int j;
@@ -158,14 +160,16 @@ static __inline__ void mga_draw_point( mgaContextPtr mmesa,
}
-static __inline__ void mga_draw_line( mgaContextPtr mmesa,
+static INLINE void mga_draw_line( mgaContextPtr mmesa,
mgaVertexPtr v0,
mgaVertexPtr v1 )
{
GLuint vertex_size = mmesa->vertex_size;
GLuint *vb = mgaAllocDmaLow( mmesa, 6 * 4 * vertex_size );
GLfloat dx, dy, ix, iy;
- GLfloat width = mmesa->glCtx->Line._Width;
+ const GLfloat width = CLAMP(mmesa->glCtx->Line.Width,
+ mmesa->glCtx->Const.MinLineWidth,
+ mmesa->glCtx->Const.MaxLineWidth);
GLint j;
#if 0