1 /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_dd.c,v 1.4 2002/09/11 19:49:07 tsi Exp $
3 * GLX Hardware Device Driver for Sun Creator/Creator3D
4 * Copyright (C) 2000, 2001 David S. Miller
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * DAVID MILLER, OR ANY OTHER CONTRIBUTORS 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
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * David S. Miller <davem@redhat.com>
32 #include "ffb_depth.h"
33 #include "ffb_context.h"
36 #include "ffb_clear.h"
38 #include "extensions.h"
40 #define FFB_DATE "20021125"
42 /* Mesa's Driver Functions */
44 static const GLubyte
*ffbDDGetString(GLcontext
*ctx
, GLenum name
)
46 ffbContextPtr fmesa
= FFB_CONTEXT(ctx
);
47 static char buffer
[128];
51 return (GLubyte
*) "David S. Miller";
54 sprintf(buffer
, "Mesa DRI FFB " FFB_DATE
);
56 if (fmesa
->ffb_sarea
->flags
& FFB_DRI_FFB2
)
57 strncat(buffer
, " FFB2", 5);
58 if (fmesa
->ffb_sarea
->flags
& FFB_DRI_FFB2PLUS
)
59 strncat(buffer
, " FFB2PLUS", 9);
60 if (fmesa
->ffb_sarea
->flags
& FFB_DRI_PAC1
)
61 strncat(buffer
, " PAC1", 5);
62 if (fmesa
->ffb_sarea
->flags
& FFB_DRI_PAC2
)
63 strncat(buffer
, " PAC2", 5);
66 strncat(buffer
, " Sparc", 6);
69 return (GLubyte
*) buffer
;
77 static void ffbBufferSize(GLframebuffer
*buffer
, GLuint
*width
, GLuint
*height
)
79 GET_CURRENT_CONTEXT(ctx
);
80 ffbContextPtr fmesa
= FFB_CONTEXT(ctx
);
83 *width
= fmesa
->driDrawable
->w
;
84 *height
= fmesa
->driDrawable
->h
;
85 UNLOCK_HARDWARE(fmesa
);
88 void ffbDDExtensionsInit(GLcontext
*ctx
)
90 /* Nothing for now until we start to add
91 * real acceleration. -DaveM
94 /* XXX Need to turn off GL_EXT_blend_func_separate for one.
95 * XXX Also BlendEquation should be turned off too, what
96 * XXX EXT is that assosciated with?
100 static void ffbDDFinish(GLcontext
*ctx
)
102 ffbContextPtr fmesa
= FFB_CONTEXT(ctx
);
104 LOCK_HARDWARE(fmesa
);
105 FFBWait(fmesa
, fmesa
->regs
);
106 UNLOCK_HARDWARE(fmesa
);
109 void ffbDDInitDriverFuncs(GLcontext
*ctx
)
111 ctx
->Driver
.GetBufferSize
= ffbBufferSize
;
112 ctx
->Driver
.GetString
= ffbDDGetString
;
113 ctx
->Driver
.Clear
= ffbDDClear
;
115 ctx
->Driver
.Finish
= ffbDDFinish
;