1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
/*
* (c) Copyright IBM Corporation 2002
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Ian Romanick <idr@us.ibm.com>
*/
/* $XFree86:$ */
#include <string.h>
#include <stdlib.h>
#include "mtypes.h"
#include "extensions.h"
#include "utils.h"
#if defined(USE_X86_ASM)
#include "X86/common_x86_asm.h"
#endif
unsigned
driParseDebugString( const char * debug,
const struct dri_debug_control * control )
{
unsigned flag;
flag = 0;
if ( debug != NULL ) {
while( control->string != NULL ) {
if ( strstr( debug, control->string ) != NULL ) {
flag |= control->flag;
}
control++;
}
}
return flag;
}
unsigned
driGetRendererString( char * buffer, const char * hardware_name,
const char * driver_date, GLuint agp_mode )
{
#ifdef USE_X86_ASM
char * x86_str = "";
char * mmx_str = "";
char * tdnow_str = "";
char * sse_str = "";
#endif
unsigned offset;
offset = sprintf( buffer, "Mesa DRI %s %s", hardware_name, driver_date );
/* Append any AGP-specific information.
*/
switch ( agp_mode ) {
case 1:
case 2:
case 4:
case 8:
offset += sprintf( & buffer[ offset ], " AGP %ux", agp_mode );
break;
default:
break;
}
/* Append any CPU-specific information.
*/
#ifdef USE_X86_ASM
if ( _mesa_x86_cpu_features ) {
x86_str = " x86";
}
# ifdef USE_MMX_ASM
if ( cpu_has_mmx ) {
mmx_str = (cpu_has_mmxext) ? "/MMX+" : "/MMX";
}
# endif
# ifdef USE_3DNOW_ASM
if ( cpu_has_3dnow ) {
tdnow_str = (cpu_has_3dnowext) ? "/3DNow!+" : "/3DNow!";
}
# endif
# ifdef USE_SSE_ASM
if ( cpu_has_xmm ) {
sse_str = (cpu_has_xmm2) ? "/SSE2" : "/SSE";
}
# endif
offset += sprintf( & buffer[ offset ], "%s%s%s%s",
x86_str, mmx_str, tdnow_str, sse_str );
#elif defined(USE_SPARC_ASM)
offset += sprintf( & buffer[ offset ], " Sparc" );
#endif
return offset;
}
void driInitExtensions( GLcontext * ctx,
const char * const extensions_to_enable[],
GLboolean enable_imaging )
{
unsigned i;
if ( enable_imaging ) {
_mesa_enable_imaging_extensions( ctx );
}
for ( i = 0 ; extensions_to_enable[i] != NULL ; i++ ) {
_mesa_enable_extension( ctx, extensions_to_enable[i] );
}
}
GLboolean
driCheckDriDdxDrmVersions(__DRIscreenPrivate *sPriv,
const char * driver_name,
int dri_major, int dri_minor,
int ddx_major, int ddx_minor,
int drm_major, int drm_minor)
{
static const char format[] = "%s DRI driver expected %s version %d.%d.x "
"but got version %d.%d.%d";
int major, minor, patch;
#ifndef _SOLO
/* Check the DRI version */
if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) {
if (major != dri_major || minor < dri_minor) {
__driUtilMessage(format, "DRI", driver_name, dri_major, dri_minor,
major, minor, patch);
return GL_FALSE;
}
}
#else
(void)major;(void)minor;(void)patch;
#endif
/* Check that the DDX driver version is compatible */
if (sPriv->ddxMajor != ddx_major || sPriv->ddxMinor < ddx_minor) {
__driUtilMessage(format, "DDX", driver_name, ddx_major, ddx_minor,
sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch);
return GL_FALSE;
}
/* Check that the DRM driver version is compatible */
if (sPriv->drmMajor != drm_major || sPriv->drmMinor < drm_minor) {
__driUtilMessage(format, "DRM", driver_name, drm_major, drm_minor,
sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch);
return GL_FALSE;
}
return GL_TRUE;
}
|