81429c167e36b9f167edd151bae88e6f349e69aa
2 * (c) Copyright IBM Corporation 2002
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 SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Ian Romanick <idr@us.ibm.com>
32 #include "extensions.h"
35 #if defined(USE_X86_ASM)
36 #include "x86/common_x86_asm.h"
40 driParseDebugString( const char * debug
,
41 const struct dri_debug_control
* control
)
47 if ( debug
!= NULL
) {
48 while( control
->string
!= NULL
) {
49 if ( strstr( debug
, control
->string
) != NULL
) {
50 flag
|= control
->flag
;
64 driGetRendererString( char * buffer
, const char * hardware_name
,
65 const char * driver_date
, GLuint agp_mode
)
70 char * tdnow_str
= "";
76 offset
= sprintf( buffer
, "Mesa DRI %s %s", hardware_name
, driver_date
);
78 /* Append any AGP-specific information.
85 offset
+= sprintf( & buffer
[ offset
], " AGP %ux", agp_mode
);
92 /* Append any CPU-specific information.
95 if ( _mesa_x86_cpu_features
) {
100 mmx_str
= (cpu_has_mmxext
) ? "/MMX+" : "/MMX";
103 # ifdef USE_3DNOW_ASM
104 if ( cpu_has_3dnow
) {
105 tdnow_str
= (cpu_has_3dnowext
) ? "/3DNow!+" : "/3DNow!";
110 sse_str
= (cpu_has_xmm2
) ? "/SSE2" : "/SSE";
114 offset
+= sprintf( & buffer
[ offset
], "%s%s%s%s",
115 x86_str
, mmx_str
, tdnow_str
, sse_str
);
117 #elif defined(USE_SPARC_ASM)
119 offset
+= sprintf( & buffer
[ offset
], " Sparc" );
129 void driInitExtensions( GLcontext
* ctx
,
130 const char * const extensions_to_enable
[],
131 GLboolean enable_imaging
)
135 if ( enable_imaging
) {
136 _mesa_enable_imaging_extensions( ctx
);
139 for ( i
= 0 ; extensions_to_enable
[i
] != NULL
; i
++ ) {
140 _mesa_enable_extension( ctx
, extensions_to_enable
[i
] );
148 driCheckDriDdxDrmVersions(__DRIscreenPrivate
*sPriv
,
149 const char * driver_name
,
150 int dri_major
, int dri_minor
,
151 int ddx_major
, int ddx_minor
,
152 int drm_major
, int drm_minor
)
154 static const char format
[] = "%s DRI driver expected %s version %d.%d.x "
155 "but got version %d.%d.%d";
156 int major
, minor
, patch
;
159 /* Check the DRI version */
160 if (XF86DRIQueryVersion(sPriv
->display
, &major
, &minor
, &patch
)) {
161 if (major
!= dri_major
|| minor
< dri_minor
) {
162 __driUtilMessage(format
, "DRI", driver_name
, dri_major
, dri_minor
,
163 major
, minor
, patch
);
168 /* Check that the DDX driver version is compatible */
169 if (sPriv
->ddxMajor
!= ddx_major
|| sPriv
->ddxMinor
< ddx_minor
) {
170 __driUtilMessage(format
, "DDX", driver_name
, ddx_major
, ddx_minor
,
171 sPriv
->ddxMajor
, sPriv
->ddxMinor
, sPriv
->ddxPatch
);
175 (void)major
;(void)minor
;(void)patch
;
178 /* Check that the DRM driver version is compatible */
179 if (sPriv
->drmMajor
!= drm_major
|| sPriv
->drmMinor
< drm_minor
) {
180 __driUtilMessage(format
, "DRM", driver_name
, drm_major
, drm_minor
,
181 sPriv
->drmMajor
, sPriv
->drmMinor
, sPriv
->drmPatch
);
188 GLboolean
driClipRectToFramebuffer( const GLframebuffer
*buffer
,
190 GLsizei
*width
, GLsizei
*height
)
193 if (*x
< buffer
->_Xmin
) {
194 *width
-= (buffer
->_Xmin
- *x
);
199 if (*x
+ *width
> buffer
->_Xmax
)
200 *width
-= (*x
+ *width
- buffer
->_Xmax
- 1);
205 /* bottom clipping */
206 if (*y
< buffer
->_Ymin
) {
207 *height
-= (buffer
->_Ymin
- *y
);
212 if (*y
+ *height
> buffer
->_Ymax
)
213 *height
-= (*y
+ *height
- buffer
->_Ymax
- 1);