2 * Copyright 2000-2001 VA Linux Systems, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
25 * Keith Whitwell <keith@tungstengraphics.com>
27 /* $XFree86: xc/lib/GL/mesa/src/drv/mga/mgadd.c,v 1.14 2002/10/30 12:51:35 alanh Exp $ */
37 #include "mgacontext.h"
44 #include "mga_xmesa.h"
45 #include "extensions.h"
46 #if defined(USE_X86_ASM)
47 #include "X86/common_x86_asm.h"
50 #define MGA_DATE "20020221"
53 /***************************************
54 * Mesa's Driver Functions
55 ***************************************/
58 static const GLubyte
*mgaDDGetString( GLcontext
*ctx
, GLenum name
)
60 mgaContextPtr mmesa
= MGA_CONTEXT( ctx
);
61 static char buffer
[128];
65 return (GLubyte
*) "VA Linux Systems Inc.";
68 sprintf( buffer
, "Mesa DRI %s " MGA_DATE
,
69 MGA_IS_G400(mmesa
) ? "G400" :
70 MGA_IS_G200(mmesa
) ? "G200" : "MGA" );
72 /* Append any AGP-specific information.
74 switch ( mmesa
->mgaScreen
->agpMode
) {
76 strncat( buffer
, " AGP 1x", 7 );
79 strncat( buffer
, " AGP 2x", 7 );
82 strncat( buffer
, " AGP 4x", 7 );
86 /* Append any CPU-specific information.
89 if ( _mesa_x86_cpu_features
) {
90 strncat( buffer
, " x86", 4 );
95 strncat( buffer
, "/MMX", 4 );
99 if ( cpu_has_3dnow
) {
100 strncat( buffer
, "/3DNow!", 7 );
105 strncat( buffer
, "/SSE", 4 );
108 return (GLubyte
*)buffer
;
117 static void mgaBufferSize(GLframebuffer
*buffer
, GLuint
*width
, GLuint
*height
)
119 GET_CURRENT_CONTEXT(ctx
);
120 mgaContextPtr mmesa
= MGA_CONTEXT(ctx
);
122 /* Need to lock to make sure the driDrawable is uptodate. This
123 * information is used to resize Mesa's software buffers, so it has
126 LOCK_HARDWARE( mmesa
);
127 *width
= mmesa
->driDrawable
->w
;
128 *height
= mmesa
->driDrawable
->h
;
129 UNLOCK_HARDWARE( mmesa
);
132 void mgaDDExtensionsInit( GLcontext
*ctx
)
134 /* paletted_textures currently doesn't work, but we could fix them later */
136 _mesa_enable_extension( ctx, "GL_EXT_shared_texture_palette" );
137 _mesa_enable_extension( ctx, "GL_EXT_paletted_texture" );
140 _mesa_enable_extension( ctx
, "GL_ARB_texture_compression" );
141 _mesa_enable_extension( ctx
, "GL_ARB_multisample" );
143 _mesa_enable_extension( ctx
, "GL_SGIS_generate_mipmap" );
145 /* Turn on multitexture and texenv_add for the G400.
147 if (MGA_IS_G400(MGA_CONTEXT(ctx
))) {
148 _mesa_enable_extension( ctx
, "GL_ARB_multitexture" );
149 _mesa_enable_extension( ctx
, "GL_ARB_texture_env_add" );
151 _mesa_enable_extension( ctx
, "GL_EXT_texture_env_add" );
153 #if defined (MESA_packed_depth_stencil)
154 _mesa_enable_extension( ctx
, "GL_MESA_packed_depth_stencil" );
157 #if defined (MESA_experimetal_agp_allocator)
158 if (!getenv("MGA_DISABLE_AGP_ALLOCATOR"))
159 _mesa_enable_extension( ctx
, "GL_MESA_experimental_agp_allocator" );
166 void mgaDDInitDriverFuncs( GLcontext
*ctx
)
168 ctx
->Driver
.GetBufferSize
= mgaBufferSize
;
169 ctx
->Driver
.ResizeBuffers
= _swrast_alloc_buffers
;
170 ctx
->Driver
.GetString
= mgaDDGetString
;