1 /**************************************************************************
3 Copyright 2006 Stephane Marchesin
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 on the rights to use, copy, modify, merge, publish, distribute, sub
10 license, and/or sell copies of the Software, and to permit persons to whom
11 the Software is furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice (including the next
14 paragraph) shall be included in all copies or substantial portions of the
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
21 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 USE OR OTHER DEALINGS IN THE SOFTWARE.
25 **************************************************************************/
27 #include "nouveau_context.h"
28 #include "nouveau_ioctl.h"
29 //#include "nouveau_state.h"
30 #include "nouveau_driver.h"
31 #include "swrast/swrast.h"
34 #include "framebuffer.h"
39 /* Return the width and height of the current color buffer */
40 static void nouveauGetBufferSize( GLframebuffer
*buffer
,
41 GLuint
*width
, GLuint
*height
)
43 GET_CURRENT_CONTEXT(ctx
);
44 nouveauContextPtr nmesa
= NOUVEAU_CONTEXT(ctx
);
46 LOCK_HARDWARE( nmesa
);
47 *width
= nmesa
->driDrawable
->w
;
48 *height
= nmesa
->driDrawable
->h
;
49 UNLOCK_HARDWARE( nmesa
);
53 static const GLubyte
*nouveauGetString( GLcontext
*ctx
, GLenum name
)
55 nouveauContextPtr nmesa
= NOUVEAU_CONTEXT(ctx
);
56 static char buffer
[128];
57 const char * card_name
= "Unknown";
62 return (GLubyte
*)DRIVER_AUTHOR
;
65 switch(nmesa
->screen
->card_type
)
77 card_name
="GeForce 1/2/4Mx";
80 card_name
="GeForce 3/4Ti";
83 card_name
="GeForce FX 5x00";
86 card_name
="GeForce FX 6x00";
89 card_name
="GeForce FX 7x00";
95 switch(nmesa
->screen
->bus_type
)
103 nmesa
->screen
->agp_mode
;
106 driGetRendererString( buffer
, card_name
, DRIVER_DATE
,
108 return (GLubyte
*)buffer
;
115 static void nouveauFlush( GLcontext
*ctx
)
117 nouveauContextPtr nmesa
= NOUVEAU_CONTEXT(ctx
);
122 static void nouveauFinish( GLcontext
*ctx
)
124 nouveauContextPtr nmesa
= NOUVEAU_CONTEXT(ctx
);
126 nouveauWaitForIdle( nmesa
);
130 static void nouveauClear( GLcontext
*ctx
, GLbitfield mask
, GLboolean all
,
131 GLint cx
, GLint cy
, GLint cw
, GLint ch
)
133 // XXX we really should do something here...
136 void nouveauDriverInitFunctions( struct dd_function_table
*functions
)
138 functions
->GetBufferSize
= nouveauGetBufferSize
;
139 functions
->ResizeBuffers
= _mesa_resize_framebuffer
;
140 functions
->GetString
= nouveauGetString
;
141 functions
->Flush
= nouveauFlush
;
142 functions
->Finish
= nouveauFinish
;
143 functions
->Clear
= nouveauClear
;