Before calling _mesa_create_context(), initialize a dd_function_table struct
[mesa.git] / src / mesa / drivers / dri / i830 / i830_ioctl.h
1
2 /**************************************************************************
3
4 Copyright 2001 VA Linux Systems Inc., Fremont, California.
5
6 All Rights Reserved.
7
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the "Software"),
10 to deal in the Software without restriction, including without limitation
11 on the rights to use, copy, modify, merge, publish, distribute, sub
12 license, and/or sell copies of the Software, and to permit persons to whom
13 the Software is furnished to do so, subject to the following conditions:
14
15 The above copyright notice and this permission notice (including the next
16 paragraph) shall be included in all copies or substantial portions of the
17 Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
22 ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
23 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25 USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27 **************************************************************************/
28
29 /* $XFree86: xc/lib/GL/mesa/src/drv/i830/i830_ioctl.h,v 1.3 2002/10/30 12:51:35 alanh Exp $ */
30
31 /*
32 * Author:
33 * Jeff Hartmann <jhartmann@2d3d.com>
34 * Graeme Fisher <graeme@2d3d.co.za>
35 * Abraham vd Merwe <abraham@2d3d.co.za>
36 *
37 * Heavily based on the I810 driver, which was written by:
38 * Keith Whitwell <keith@tungstengraphics.com>
39 */
40
41 #ifndef I830_IOCTL_H
42 #define I830_IOCTL_H
43
44 #include "i830_context.h"
45
46 GLuint *i830AllocDwords (i830ContextPtr imesa, int dwords);
47 void i830EmitPrim( i830ContextPtr imesa );
48 void i830FlushPrims( i830ContextPtr mmesa );
49 void i830FlushPrimsLocked( i830ContextPtr mmesa );
50 void i830FlushPrimsGetBuffer( i830ContextPtr imesa );
51 void i830FlushPrimsGetBufferLocked( i830ContextPtr imesa );
52 void i830WaitAgeLocked( i830ContextPtr imesa, int age );
53 void i830WaitAge( i830ContextPtr imesa, int age );
54 void i830DmaFinish( i830ContextPtr imesa );
55 void i830RegetLockQuiescent( i830ContextPtr imesa );
56 void i830InitIoctlFuncs( struct dd_function_table *functions );
57 void i830CopyBuffer( const __DRIdrawablePrivate *dpriv );
58 void i830PageFlip( const __DRIdrawablePrivate *dpriv );
59 int i830_check_copy(int fd);
60
61 #define I830_STATECHANGE(imesa, flag) \
62 do { \
63 if (imesa->vertex_low != imesa->vertex_last_prim) \
64 i830FlushPrims(imesa); \
65 imesa->dirty |= flag; \
66 } while (0)
67
68
69 #define I830_FIREVERTICES(imesa) \
70 do { \
71 if (imesa->vertex_buffer) { \
72 i830FlushPrims(imesa); \
73 } \
74 } while (0)
75
76
77 static __inline GLuint *i830AllocDmaLow( i830ContextPtr imesa, int bytes )
78 {
79 if (imesa->vertex_low + bytes > imesa->vertex_high) {
80 i830FlushPrimsGetBuffer( imesa );
81 }
82
83 {
84 GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
85 imesa->vertex_low += bytes;
86 return start;
87 }
88 }
89
90 static __inline GLuint *i830AllocDmaLowLocked( i830ContextPtr imesa,
91 int bytes )
92 {
93 if (imesa->vertex_low + bytes > imesa->vertex_high) {
94 i830FlushPrimsGetBufferLocked( imesa );
95 }
96
97 {
98 GLuint *start = (GLuint *)(imesa->vertex_addr + imesa->vertex_low);
99 imesa->vertex_low += bytes;
100 return start;
101 }
102 }
103
104
105 #endif