Import s3virge and trident drivers. Not functional yet; no Makefile, no DRI-aware...
[mesa.git] / src / mesa / drivers / dri / s3v / s3v_dd.c
1 /*
2 * Author: Max Lingua <sunmax@libero.it>
3 */
4
5 #include "s3v_context.h"
6 #include "s3v_vb.h"
7 #include "s3v_lock.h"
8 #if defined(USE_X86_ASM)
9 #include "X86/common_x86_asm.h"
10 #endif
11
12 #include "context.h"
13 #include "swrast/swrast.h"
14
15 #define S3V_DATE "20020207"
16
17
18 /* Return the width and height of the current color buffer.
19 */
20 static void s3vDDGetBufferSize( GLframebuffer *buffer,
21 GLuint *width, GLuint *height )
22 {
23 GET_CURRENT_CONTEXT(ctx);
24 s3vContextPtr vmesa = S3V_CONTEXT(ctx);
25
26 /* S3VHW_LOCK( vmesa ); */
27 *width = vmesa->driDrawable->w;
28 *height = vmesa->driDrawable->h;
29 /* S3VHW_UNLOCK( vmesa ); */
30 }
31
32
33 /* Return various strings for glGetString().
34 */
35 static const GLubyte *s3vDDGetString( GLcontext *ctx, GLenum name )
36 {
37 static char buffer[128];
38
39 switch ( name ) {
40 case GL_VENDOR:
41 return (GLubyte *)"Max Lingua (ladybug)";
42
43 case GL_RENDERER:
44 sprintf( buffer, "Mesa DRI S3 Virge " S3V_DATE );
45
46 /* Append any CPU-specific information.
47 */
48 #ifdef USE_X86_ASM
49 if ( _mesa_x86_cpu_features ) {
50 strncat( buffer, " x86", 4 );
51
52 }
53 #ifdef USE_MMX_ASM
54 if ( cpu_has_mmx ) {
55 strncat( buffer, "/MMX", 4 );
56 }
57 #endif
58 #ifdef USE_3DNOW_ASM
59 if ( cpu_has_3dnow ) {
60 strncat( buffer, "/3DNow!", 7 );
61 }
62 #endif
63 #ifdef USE_SSE_ASM
64 if ( cpu_has_xmm ) {
65 strncat( buffer, "/SSE", 4 );
66 }
67 #endif
68 #endif
69 return (GLubyte *)buffer;
70
71 default:
72 return NULL;
73 }
74 }
75
76 /* Enable the extensions supported by this driver.
77 */
78 void s3vInitExtensions( GLcontext *ctx )
79 {
80 /* None... */
81 }
82
83 /* Initialize the driver's misc functions.
84 */
85 void s3vInitDriverFuncs( GLcontext *ctx )
86 {
87 ctx->Driver.GetBufferSize = s3vDDGetBufferSize;
88 ctx->Driver.GetString = s3vDDGetString;
89
90 ctx->Driver.Error = NULL;
91
92 /* Pixel path fallbacks
93 */
94 ctx->Driver.Accum = _swrast_Accum;
95 ctx->Driver.Bitmap = _swrast_Bitmap;
96 ctx->Driver.CopyPixels = _swrast_CopyPixels;
97 ctx->Driver.DrawPixels = _swrast_DrawPixels;
98 ctx->Driver.ReadPixels = _swrast_ReadPixels;
99 ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
100
101 /* Swrast hooks for imaging extensions:
102 */
103 ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
104 ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
105 ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
106 ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
107 }