summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2010-03-11 13:49:25 +0100
committerLuc Verhaegen <libv@skynet.be>2010-03-11 13:49:25 +0100
commitab9f392e9bc2dcdcd09cc216c0cb4cb5aa855633 (patch)
tree85a5a5750627e31c77d1e36801f7132ef358d9e4
parent2a95e686b3082970d42b04568d3b3af7f27f9465 (diff)
Import tdfx dri driver from mesa 7.2.0.7.2.07.1.0
-rw-r--r--configure.ac6
-rw-r--r--src/tdfx_context.h6
-rw-r--r--src/tdfx_render.c4
-rw-r--r--src/tdfx_screen.c218
-rw-r--r--src/tdfx_state.c16
-rw-r--r--src/tdfx_tex.c2
-rw-r--r--src/tdfx_tris.c18
7 files changed, 113 insertions, 157 deletions
diff --git a/configure.ac b/configure.ac
index 592cad3..18eb702 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-tdfx], 7.0.3, [], mesa-dri-tdfx)
+AC_INIT([mesa-dri-tdfx], 7.2.0, [], mesa-dri-tdfx)
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/tdfx_context.h b/src/tdfx_context.h
index 89a7a9d..dc8ece5 100644
--- a/src/tdfx_context.h
+++ b/src/tdfx_context.h
@@ -984,9 +984,9 @@ FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]);
#define TDFXPACKCOLOR4444( r, g, b, a ) \
((((a) & 0xf0) << 8) | (((b) & 0xf0) << 4) | ((g) & 0xf0) | ((r) >> 4))
-static __inline__ GrColor_t tdfxPackColor( GLuint cpp,
- GLubyte r, GLubyte g,
- GLubyte b, GLubyte a )
+static INLINE GrColor_t tdfxPackColor( GLuint cpp,
+ GLubyte r, GLubyte g,
+ GLubyte b, GLubyte a )
{
switch ( cpp ) {
case 2:
diff --git a/src/tdfx_render.c b/src/tdfx_render.c
index f36c97b..7b3ce36 100644
--- a/src/tdfx_render.c
+++ b/src/tdfx_render.c
@@ -275,7 +275,7 @@ static void tdfxClear( GLcontext *ctx, GLbitfield mask )
fxMesa->Color.ClearAlpha,
fxMesa->Depth.Clear);
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT)
+ if (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
if (!ctx->Depth.Test || !ctx->Depth.Mask)
fxMesa->Glide.grDepthMask(FXFALSE);
@@ -295,7 +295,7 @@ static void tdfxClear( GLcontext *ctx, GLbitfield mask )
fxMesa->Glide.grDepthMask(FXTRUE);
}
FX_grColorMaskv_NoLock(ctx, true4);
- if (ctx->DrawBuffer->_ColorDrawBufferMask[0] & BUFFER_BIT_FRONT_LEFT)
+ if (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT)
fxMesa->Glide.grRenderBuffer(GR_BUFFER_FRONTBUFFER);
}
}
diff --git a/src/tdfx_screen.c b/src/tdfx_screen.c
index 1f9ff4e..bb1f362 100644
--- a/src/tdfx_screen.c
+++ b/src/tdfx_screen.c
@@ -63,6 +63,11 @@ DRI_CONF_BEGIN
DRI_CONF_SECTION_END
DRI_CONF_END;
+static const __DRIextension *tdfxExtensions[] = {
+ &driReadDrawableExtension,
+ NULL
+};
+
static const GLuint __driNConfigOptions = 1;
extern const struct dri_extension card_extensions[];
@@ -73,9 +78,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
{
tdfxScreenPrivate *fxScreen;
TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void *const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n");
@@ -116,9 +118,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
return GL_FALSE;
}
- if (glx_enable_extension != NULL) {
- (*glx_enable_extension)(psc, "GLX_SGI_make_current_read");
- }
+ sPriv->extensions = tdfxExtensions;
return GL_TRUE;
}
@@ -344,36 +344,14 @@ tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv )
}
}
-
-static const struct __DriverAPIRec tdfxAPI = {
- .InitDriver = tdfxInitDriver,
- .DestroyScreen = tdfxDestroyScreen,
- .CreateContext = tdfxCreateContext,
- .DestroyContext = tdfxDestroyContext,
- .CreateBuffer = tdfxCreateBuffer,
- .DestroyBuffer = tdfxDestroyBuffer,
- .SwapBuffers = tdfxSwapBuffers,
- .MakeCurrent = tdfxMakeCurrent,
- .UnbindContext = tdfxUnbindContext,
- .GetSwapInfo = NULL,
- .GetMSC = NULL,
- .WaitForMSC = NULL,
- .WaitForSBC = NULL,
- .SwapBuffersMSC = NULL
-};
-
-
-static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits,
- GLboolean have_back_buffer)
+static const __DRIconfig **
+tdfxFillInModes(__DRIscreenPrivate *psp,
+ unsigned pixel_bits,
+ unsigned depth_bits,
+ unsigned stencil_bits,
+ GLboolean have_back_buffer)
{
- __GLcontextModes *modes;
- __GLcontextModes *m;
- unsigned num_modes;
- unsigned vis[2] = { GLX_TRUE_COLOR, GLX_DIRECT_COLOR };
unsigned deep = (depth_bits > 17);
- unsigned i, db, depth, accum, stencil;
/* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
* enough to add support. Basically, if a context is created with an
@@ -381,120 +359,96 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits,
* will never be used.
*/
- num_modes = (depth_bits == 16) ? 32 : 16;
-
- modes = (*dri_interface->createContextModes)(num_modes, sizeof(__GLcontextModes));
- m = modes;
-
- for (i = 0; i <= 1; i++) {
- for (db = 0; db <= 1; db++) {
- for (depth = 0; depth <= 1; depth++) {
- for (accum = 0; accum <= 1; accum++) {
- for (stencil = 0; stencil <= !deep; stencil++) {
- if (deep) stencil = depth;
- m->redBits = deep ? 8 : 5;
- m->greenBits = deep ? 8 : 6;
- m->blueBits = deep ? 8 : 5;
- m->alphaBits = deep ? 8 : 0;
- m->redMask = deep ?0xFF000000 :0x0000F800;
- m->greenMask = deep ?0x00FF0000 :0x000007E0;
- m->blueMask = deep ?0x0000FF00 :0x0000001F;
- m->alphaMask = deep ? 0x000000FF : 0;
- m->rgbBits = m->redBits + m->greenBits +
- m->blueBits + m->alphaBits;
- m->accumRedBits = accum ? 16 : 0;
- m->accumGreenBits = accum ? 16 : 0;
- m->accumBlueBits = accum ? 16 : 0;
- m->accumAlphaBits = (accum && deep) ? 16 : 0;
- m->stencilBits = stencil ? 8 : 0;
- m->depthBits = deep
- ? (depth ? 24 : 0)
- : (depth ? 0 : depth_bits);
- m->visualType = vis[i];
- m->renderType = GLX_RGBA_BIT;
- m->drawableType = GLX_WINDOW_BIT;
- m->rgbMode = GL_TRUE;
- m->doubleBufferMode = db ? GL_TRUE : GL_FALSE;
- if (db)
- m->swapMethod = GLX_SWAP_UNDEFINED_OML;
- m->visualRating = ((stencil && !deep) || accum)
- ? GLX_SLOW_CONFIG
- : GLX_NONE;
- m = m->next;
- if (deep) stencil = 0;
- }
- }
- }
- }
+ static const GLenum db_modes[2] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML };
+ uint8_t depth_bits_array[4];
+ uint8_t stencil_bits_array[4];
+ if(deep) {
+ depth_bits_array[0] = 0;
+ depth_bits_array[1] = 24;
+ stencil_bits_array[0] = 0;
+ stencil_bits_array[1] = 8;
+ } else {
+ depth_bits_array[0] = depth_bits;
+ depth_bits_array[1] = 0;
+ depth_bits_array[2] = depth_bits;
+ depth_bits_array[3] = 0;
+ stencil_bits_array[0] = 0;
+ stencil_bits_array[1] = 0;
+ stencil_bits_array[2] = 8;
+ stencil_bits_array[3] = 8;
}
- return modes;
+ return driCreateConfigs(
+ deep ? GL_RGBA : GL_RGB,
+ deep ? GL_UNSIGNED_INT_8_8_8_8 : GL_UNSIGNED_SHORT_5_6_5,
+ depth_bits_array,
+ stencil_bits_array,
+ deep ? 2 : 4,
+ db_modes, 2);
}
/**
- * 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.
+ *
+ * \todo maybe fold this into intelInitDriver
*
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
+ * \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 **
+tdfxInitScreen(__DRIscreen *psp)
{
- __DRIscreenPrivate *psp;
static const __DRIversion ddx_expected = { 1, 1, 0 };
static const __DRIversion dri_expected = { 4, 0, 0 };
static const __DRIversion drm_expected = { 1, 0, 0 };
- dri_interface = interface;
+ /* divined from tdfx_dri.c, sketchy */
+ TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv;
+
+ /* XXX i wish it was like this */
+ /* bpp = dri_priv->bpp */
+ int bpp = (dri_priv->cpp > 2) ? 24 : 16;
if ( ! driCheckDriDdxDrmVersions2( "tdfx",
- 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, &tdfxAPI);
- if (psp != NULL) {
- /* divined from tdfx_dri.c, sketchy */
- TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv;
- int bpp = (dri_priv->cpp > 2) ? 24 : 16;
+ /* 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, napalm_extensions, GL_FALSE );
- /* XXX i wish it was like this */
- /* bpp = dri_priv->bpp */
+ if (!tdfxInitDriver(psp))
+ return NULL;
- *driver_modes = tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24,
- (bpp == 16) ? 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, napalm_extensions, GL_FALSE );
- }
-
- return (void *)psp;
+ return tdfxFillInModes(psp,
+ bpp, (bpp == 16) ? 16 : 24,
+ (bpp == 16) ? 0 : 8,
+ (dri_priv->backOffset!=dri_priv->depthOffset));
}
+
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = tdfxInitScreen,
+ .DestroyScreen = tdfxDestroyScreen,
+ .CreateContext = tdfxCreateContext,
+ .DestroyContext = tdfxDestroyContext,
+ .CreateBuffer = tdfxCreateBuffer,
+ .DestroyBuffer = tdfxDestroyBuffer,
+ .SwapBuffers = tdfxSwapBuffers,
+ .MakeCurrent = tdfxMakeCurrent,
+ .UnbindContext = tdfxUnbindContext,
+ .GetSwapInfo = NULL,
+ .GetDrawableMSC = NULL,
+ .WaitForMSC = NULL,
+ .WaitForSBC = NULL,
+ .SwapBuffersMSC = NULL
+};
diff --git a/src/tdfx_state.c b/src/tdfx_state.c
index 42cb5df..e4d77e6 100644
--- a/src/tdfx_state.c
+++ b/src/tdfx_state.c
@@ -1033,21 +1033,23 @@ static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
FLUSH_BATCH( fxMesa );
- /*
- * _ColorDrawBufferMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
- case BUFFER_BIT_FRONT_LEFT:
+ if (ctx->DrawBuffer->_NumColorDrawBuffers > 1) {
+ FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
+ }
+
+ switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
+ case BUFFER_FRONT_LEFT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_FRONTBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
fxMesa->DrawBuffer = fxMesa->ReadBuffer = GR_BUFFER_BACKBUFFER;
fxMesa->new_state |= TDFX_NEW_RENDER;
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
- case 0:
+ case -1:
FX_grColorMaskv( ctx, false4 );
FALLBACK( fxMesa, TDFX_FALLBACK_DRAW_BUFFER, GL_FALSE );
break;
diff --git a/src/tdfx_tex.c b/src/tdfx_tex.c
index 89865d9..6494638 100644
--- a/src/tdfx_tex.c
+++ b/src/tdfx_tex.c
@@ -1822,7 +1822,7 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target,
tdfxTexInfo *ti;
int memNeeded;
- tObj = ctx->Texture.Proxy2D;
+ tObj = ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
if (!tObj->DriverData)
tObj->DriverData = fxAllocTexObjData(fxMesa);
ti = TDFX_TEXTURE_DATA(tObj);
diff --git a/src/tdfx_tris.c b/src/tdfx_tris.c
index 4ba2f40..7252a7e 100644
--- a/src/tdfx_tris.c
+++ b/src/tdfx_tris.c
@@ -142,10 +142,10 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (fxMesa->vertexFormat == TDFX_LAYOUT_TINY) {
- dst->win[0] = src->x - fxMesa->x_offset;
- dst->win[1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->z;
- dst->win[3] = 1.0;
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = src->x - fxMesa->x_offset;
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = src->z;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0;
dst->color[0] = src->color[2];
dst->color[1] = src->color[1];
@@ -155,10 +155,10 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
else {
GLfloat w = 1.0 / src->rhw;
- dst->win[0] = src->x - fxMesa->x_offset;
- dst->win[1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
- dst->win[2] = src->z;
- dst->win[3] = src->rhw;
+ dst->attrib[FRAG_ATTRIB_WPOS][0] = src->x - fxMesa->x_offset;
+ dst->attrib[FRAG_ATTRIB_WPOS][1] = src->y - (fxMesa->screen_height - fxMesa->height - fxMesa->y_offset);
+ dst->attrib[FRAG_ATTRIB_WPOS][2] = src->z;
+ dst->attrib[FRAG_ATTRIB_WPOS][3] = src->rhw;
dst->color[0] = src->color[2];
dst->color[1] = src->color[1];
@@ -184,7 +184,7 @@ tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
}
}
- dst->pointSize = ctx->Point._Size;
+ dst->pointSize = ctx->Point.Size;
}