2 * Copyright 2001 by Alan Hourihane.
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Alan Hourihane not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Alan Hourihane makes no representations
11 * about the suitability of this software for any purpose. It is provided
12 * "as is" without express or implied warranty.
14 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
22 * Authors: Alan Hourihane, <alanh@tungstengraphics.com>
26 #include "gamma_context.h"
28 #include "gamma_lock.h"
29 #if defined(USE_X86_ASM)
30 #include "x86/common_x86_asm.h"
34 #include "swrast/swrast.h"
36 #define GAMMA_DATE "20021125"
39 /* Return the width and height of the current color buffer.
41 static void gammaDDGetBufferSize( GLframebuffer
*buffer
,
42 GLuint
*width
, GLuint
*height
)
44 GET_CURRENT_CONTEXT(ctx
);
45 gammaContextPtr gmesa
= GAMMA_CONTEXT(ctx
);
47 GAMMAHW_LOCK( gmesa
);
48 *width
= gmesa
->driDrawable
->w
;
49 *height
= gmesa
->driDrawable
->h
;
50 GAMMAHW_UNLOCK( gmesa
);
54 /* Return various strings for glGetString().
56 static const GLubyte
*gammaDDGetString( GLcontext
*ctx
, GLenum name
)
58 static char buffer
[128];
62 return (GLubyte
*)"VA Linux Systems, Inc.";
65 sprintf( buffer
, "Mesa DRI Gamma " GAMMA_DATE
);
67 /* Append any CPU-specific information.
70 if ( _mesa_x86_cpu_features
) {
71 strncat( buffer
, " x86", 4 );
75 strncat( buffer
, "/MMX", 4 );
79 if ( cpu_has_3dnow
) {
80 strncat( buffer
, "/3DNow!", 7 );
85 strncat( buffer
, "/SSE", 4 );
89 return (GLubyte
*)buffer
;
96 /* Enable the extensions supported by this driver.
98 void gammaDDInitExtensions( GLcontext
*ctx
)
103 /* Initialize the driver's misc functions.
105 void gammaDDInitDriverFuncs( GLcontext
*ctx
)
107 ctx
->Driver
.GetBufferSize
= gammaDDGetBufferSize
;
108 ctx
->Driver
.ResizeBuffers
= _swrast_alloc_buffers
;
109 ctx
->Driver
.GetString
= gammaDDGetString
;
111 ctx
->Driver
.Error
= NULL
;
113 /* Pixel path fallbacks
115 ctx
->Driver
.Accum
= _swrast_Accum
;
116 ctx
->Driver
.Bitmap
= _swrast_Bitmap
;
117 ctx
->Driver
.CopyPixels
= _swrast_CopyPixels
;
118 ctx
->Driver
.DrawPixels
= _swrast_DrawPixels
;
119 ctx
->Driver
.ReadPixels
= _swrast_ReadPixels
;
120 ctx
->Driver
.ResizeBuffers
= _swrast_alloc_buffers
;
122 /* Swrast hooks for imaging extensions:
124 ctx
->Driver
.CopyColorTable
= _swrast_CopyColorTable
;
125 ctx
->Driver
.CopyColorSubTable
= _swrast_CopyColorSubTable
;
126 ctx
->Driver
.CopyConvolutionFilter1D
= _swrast_CopyConvolutionFilter1D
;
127 ctx
->Driver
.CopyConvolutionFilter2D
= _swrast_CopyConvolutionFilter2D
;