summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2010-03-09 08:43:44 +0100
committerLuc Verhaegen <libv@skynet.be>2010-03-09 08:43:44 +0100
commit6f1429a191947cebd9bb6266fd377f0fbc36f0a1 (patch)
treeac86e71c1119009871e18b18ab86a4f6c9320596 /src
parentf065640e154291ce735262245bfdc7a66f57f7fa (diff)
Import mach64 dri driver from mesa 7.7.1.7.7.17.7.0
Diffstat (limited to 'src')
-rw-r--r--src/mach64_context.c4
-rw-r--r--src/mach64_dd.c3
-rw-r--r--src/mach64_lock.c1
-rw-r--r--src/mach64_screen.c24
-rw-r--r--src/mach64_span.c15
-rw-r--r--src/mach64_state.c3
-rw-r--r--src/mach64_tex.c41
-rw-r--r--src/mach64_texmem.c28
-rw-r--r--src/mach64_texstate.c7
-rw-r--r--src/mach64_vb.c1
10 files changed, 45 insertions, 82 deletions
diff --git a/src/mach64_context.c b/src/mach64_context.c
index 9c7f513..37cea9d 100644
--- a/src/mach64_context.c
+++ b/src/mach64_context.c
@@ -33,8 +33,6 @@
#include "main/context.h"
#include "main/simple_list.h"
#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/extensions.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -76,7 +74,7 @@ static const struct dri_debug_control debug_control[] =
{ NULL, 0 }
};
-const struct dri_extension card_extensions[] =
+static const struct dri_extension card_extensions[] =
{
{ "GL_ARB_multitexture", NULL },
{ "GL_EXT_texture_edge_clamp", NULL },
diff --git a/src/mach64_dd.c b/src/mach64_dd.c
index e400e9a..ca713e2 100644
--- a/src/mach64_dd.c
+++ b/src/mach64_dd.c
@@ -31,12 +31,9 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
#include "mach64_dd.h"
#include "main/context.h"
-#include "main/framebuffer.h"
#include "utils.h"
diff --git a/src/mach64_lock.c b/src/mach64_lock.c
index d018ba4..f7ef4da 100644
--- a/src/mach64_lock.c
+++ b/src/mach64_lock.c
@@ -32,7 +32,6 @@
#include "mach64_context.h"
#include "mach64_state.h"
#include "mach64_lock.h"
-#include "mach64_tex.h"
#include "drirenderbuffer.h"
#if DEBUG_LOCKING
diff --git a/src/mach64_screen.c b/src/mach64_screen.c
index 6440027..61e1745 100644
--- a/src/mach64_screen.c
+++ b/src/mach64_screen.c
@@ -31,8 +31,6 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_tris.h"
-#include "mach64_vb.h"
#include "mach64_span.h"
#include "main/context.h"
@@ -67,8 +65,6 @@ static const GLuint __driNConfigOptions = 3;
static const GLuint __driNConfigOptions = 2;
#endif
-extern const struct dri_extension card_extensions[];
-
static const __DRIconfig **
mach64FillInModes( __DRIscreenPrivate *psp,
unsigned pixel_bits, unsigned depth_bits,
@@ -316,7 +312,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->frontOffset, screen->frontPitch,
@@ -327,7 +323,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->backOffset, screen->backPitch,
@@ -338,7 +334,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16,
+ = driNewRenderbuffer(MESA_FORMAT_Z16,
NULL, screen->cpp,
screen->depthOffset, screen->depthPitch,
driDrawPriv);
@@ -348,7 +344,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
else if (mesaVis->depthBits == 24) {
/* XXX I don't think 24-bit Z is supported - so this isn't used */
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -436,18 +432,6 @@ mach64InitScreen(__DRIscreenPrivate *psp)
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;
diff --git a/src/mach64_span.c b/src/mach64_span.c
index 91d46ce..d9d1244 100644
--- a/src/mach64_span.c
+++ b/src/mach64_span.c
@@ -31,7 +31,6 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
#include "mach64_span.h"
#include "swrast/swrast.h"
@@ -157,15 +156,13 @@ void mach64DDInitSpanFuncs( GLcontext *ctx )
void
mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- mach64InitPointers_RGB565(&drb->Base);
- }
- else {
- mach64InitPointers_ARGB8888(&drb->Base);
- }
+ if (drb->Base.Format == MESA_FORMAT_RGB565) {
+ mach64InitPointers_RGB565(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (drb->Base.Format == MESA_FORMAT_ARGB8888) {
+ mach64InitPointers_ARGB8888(&drb->Base);
+ }
+ else if (drb->Base.Format == MESA_FORMAT_Z16) {
mach64InitDepthPointers_z16(&drb->Base);
}
}
diff --git a/src/mach64_state.c b/src/mach64_state.c
index 3a02318..754ed86 100644
--- a/src/mach64_state.c
+++ b/src/mach64_state.c
@@ -36,7 +36,6 @@
#include "mach64_vb.h"
#include "mach64_tex.h"
-#include "main/context.h"
#include "main/enums.h"
#include "main/colormac.h"
#include "swrast/swrast.h"
@@ -44,8 +43,6 @@
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_pipeline.h"
-
/* =============================================================
* Alpha blending
diff --git a/src/mach64_tex.c b/src/mach64_tex.c
index 225d231..2e85336 100644
--- a/src/mach64_tex.c
+++ b/src/mach64_tex.c
@@ -31,17 +31,11 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
#include "mach64_tex.h"
-#include "main/context.h"
-#include "main/macros.h"
#include "main/simple_list.h"
#include "main/enums.h"
#include "main/texstore.h"
-#include "main/texformat.h"
#include "main/teximage.h"
#include "main/texobj.h"
#include "main/imports.h"
@@ -138,7 +132,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj )
/* Called by the _mesa_store_teximage[123]d() functions. */
-static const struct gl_texture_format *
+static gl_format
mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
@@ -167,15 +161,15 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGBA2:
case GL_COMPRESSED_RGBA:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGBA8:
case GL_RGB10_A2:
@@ -183,9 +177,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGBA16:
case GL_RGBA4:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case 3:
case GL_RGB:
@@ -198,9 +192,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGB16:
case GL_COMPRESSED_RGB:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888;
+ return MESA_FORMAT_ARGB8888;
else
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case 1:
case GL_LUMINANCE:
@@ -210,9 +204,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888; /* inefficient but accurate */
+ return MESA_FORMAT_ARGB8888; /* inefficient but accurate */
else
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_INTENSITY4:
case GL_INTENSITY:
@@ -221,9 +215,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
if (mmesa->mach64Screen->cpp == 4)
- return &_mesa_texformat_argb8888; /* inefficient but accurate */
+ return MESA_FORMAT_ARGB8888; /* inefficient but accurate */
else
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
@@ -232,18 +226,18 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
case GL_YCBCR_MESA:
if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE)
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
default:
_mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ );
- return NULL;
+ return MESA_FORMAT_NONE;
}
}
@@ -567,7 +561,6 @@ void mach64InitTextureFuncs( struct dd_function_table *functions )
functions->UpdateTexturePalette = NULL;
functions->ActiveTexture = NULL;
- functions->PrioritizeTexture = NULL;
driInitTextureFormats();
}
diff --git a/src/mach64_texmem.c b/src/mach64_texmem.c
index 734e547..46cee43 100644
--- a/src/mach64_texmem.c
+++ b/src/mach64_texmem.c
@@ -31,19 +31,15 @@
* Jose Fonseca <j_r_fonseca@yahoo.co.uk>
*/
-#include "mach64_context.h"
-#include "mach64_state.h"
-#include "mach64_ioctl.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
-#include "mach64_tex.h"
-
#include "main/context.h"
#include "main/macros.h"
#include "main/simple_list.h"
-#include "main/texformat.h"
#include "main/imports.h"
+#include "mach64_context.h"
+#include "mach64_ioctl.h"
+#include "mach64_tex.h"
+
/* Destroy hardware state associated with texture `t'.
*/
@@ -76,6 +72,7 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa,
struct gl_texture_image *image;
int texelsPerDword = 0;
int dwords;
+ GLuint texelBytes;
/* Ensure we have a valid texture to upload */
if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) )
@@ -85,7 +82,9 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa,
if ( !image )
return;
- switch ( image->TexFormat->TexelBytes ) {
+ texelBytes = _mesa_get_format_bytes(image->TexFormat);
+
+ switch ( texelBytes ) {
case 1: texelsPerDword = 4; break;
case 2: texelsPerDword = 2; break;
case 4: texelsPerDword = 1; break;
@@ -118,8 +117,8 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa,
{
CARD32 *dst = (CARD32 *)((char *)mach64Screen->agpTextures.map + t->base.memBlock->ofs);
const GLubyte *src = (const GLubyte *) image->Data +
- (y * image->Width + x) * image->TexFormat->TexelBytes;
- const GLuint bytes = width * height * image->TexFormat->TexelBytes;
+ (y * image->Width + x) * texelBytes;
+ const GLuint bytes = width * height * texelBytes;
memcpy(dst, src, bytes);
}
@@ -140,6 +139,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa,
const int maxdwords = (MACH64_BUFFER_MAX_DWORDS - (MACH64_HOSTDATA_BLIT_OFFSET / 4));
CARD32 pitch, offset;
int i;
+ GLuint texelBytes;
/* Ensure we have a valid texture to upload */
if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) )
@@ -149,7 +149,9 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa,
if ( !image )
return;
- switch ( image->TexFormat->TexelBytes ) {
+ texelBytes = _mesa_get_format_bytes(image->TexFormat);
+
+ switch ( texelBytes ) {
case 1: texelsPerDword = 4; break;
case 2: texelsPerDword = 2; break;
case 4: texelsPerDword = 1; break;
@@ -259,7 +261,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa,
{
const GLubyte *src = (const GLubyte *) image->Data +
- (y * image->Width + x) * image->TexFormat->TexelBytes;
+ (y * image->Width + x) * texelBytes;
mach64FireBlitLocked( mmesa, (void *)src, offset, pitch, format,
x, y, width, height );
diff --git a/src/mach64_texstate.c b/src/mach64_texstate.c
index fd2369d..adf774e 100644
--- a/src/mach64_texstate.c
+++ b/src/mach64_texstate.c
@@ -33,12 +33,9 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/texformat.h"
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
#include "mach64_tris.h"
#include "mach64_tex.h"
@@ -55,7 +52,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa,
if ( MACH64_DEBUG & DEBUG_VERBOSE_API )
fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj );
- switch (baseImage->TexFormat->MesaFormat) {
+ switch (baseImage->TexFormat) {
case MESA_FORMAT_ARGB8888:
t->textureFormat = MACH64_DATATYPE_ARGB8888;
break;
@@ -89,7 +86,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa,
totalSize = ( baseImage->Height *
baseImage->Width *
- baseImage->TexFormat->TexelBytes );
+ _mesa_get_format_bytes(baseImage->TexFormat) );
totalSize = (totalSize + 31) & ~31;
diff --git a/src/mach64_vb.c b/src/mach64_vb.c
index e58812e..00da835 100644
--- a/src/mach64_vb.c
+++ b/src/mach64_vb.c
@@ -42,7 +42,6 @@
#include "mach64_vb.h"
#include "mach64_ioctl.h"
#include "mach64_tris.h"
-#include "mach64_state.h"
#define MACH64_TEX1_BIT 0x1