Add PCI IDs for the G33, Q33, and Q35 chipsets.
[mesa.git] / src / mesa / drivers / dri / i915 / intel_batchbuffer.h
1 /**************************************************************************
2 *
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28 #ifndef INTEL_BATCHBUFFER_H
29 #define INTEL_BATCHBUFFER_H
30
31 #include "intel_context.h"
32 #include "intel_ioctl.h"
33
34
35 #define BATCH_LOCALS GLubyte *batch_ptr;
36
37 /* #define VERBOSE 0 */
38 #ifndef VERBOSE
39 extern int VERBOSE;
40 #endif
41
42
43 #define BEGIN_BATCH(n) \
44 do { \
45 if (VERBOSE) fprintf(stderr, \
46 "BEGIN_BATCH(%ld) in %s, %d dwords free\n", \
47 ((unsigned long)n), __FUNCTION__, \
48 intel->batch.space/4); \
49 if (intel->batch.space < (n)*4) \
50 intelFlushBatch(intel, GL_TRUE); \
51 if (intel->batch.space == intel->batch.size) intel->batch.func = __FUNCTION__; \
52 batch_ptr = intel->batch.ptr; \
53 } while (0)
54
55 #define OUT_BATCH(n) \
56 do { \
57 *(GLuint *)batch_ptr = (n); \
58 if (VERBOSE) fprintf(stderr, " -- %08x at %s/%d\n", (n), __FILE__, __LINE__); \
59 batch_ptr += 4; \
60 } while (0)
61
62 #define ADVANCE_BATCH() \
63 do { \
64 if (VERBOSE) fprintf(stderr, "ADVANCE_BATCH()\n"); \
65 intel->batch.space -= (batch_ptr - intel->batch.ptr); \
66 intel->batch.ptr = batch_ptr; \
67 assert(intel->batch.space >= 0); \
68 } while(0)
69
70 extern void intelInitBatchBuffer( GLcontext *ctx );
71 extern void intelDestroyBatchBuffer( GLcontext *ctx );
72
73 extern void intelStartInlinePrimitive( intelContextPtr intel, GLuint prim );
74 extern void intelWrapInlinePrimitive( intelContextPtr intel );
75 extern void intelRestartInlinePrimitive( intelContextPtr intel );
76 extern GLuint *intelEmitInlinePrimitiveLocked(intelContextPtr intel,
77 int primitive, int dwords,
78 int vertex_size);
79 extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv,
80 const drm_clip_rect_t *rect);
81 extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask, GLboolean all,
82 GLint cx1, GLint cy1, GLint cw, GLint ch);
83
84 extern void intelEmitCopyBlitLocked( intelContextPtr intel,
85 GLuint cpp,
86 GLshort src_pitch,
87 GLuint src_offset,
88 GLshort dst_pitch,
89 GLuint dst_offset,
90 GLshort srcx, GLshort srcy,
91 GLshort dstx, GLshort dsty,
92 GLshort w, GLshort h );
93
94 extern void intelEmitFillBlitLocked( intelContextPtr intel,
95 GLuint cpp,
96 GLshort dst_pitch,
97 GLuint dst_offset,
98 GLshort x, GLshort y,
99 GLshort w, GLshort h,
100 GLuint color );
101
102
103
104
105 static __inline GLuint *intelExtendInlinePrimitive( intelContextPtr intel,
106 GLuint dwords )
107 {
108 GLuint sz = dwords * sizeof(GLuint);
109 GLuint *ptr;
110
111 if (intel->batch.space < sz) {
112 intelWrapInlinePrimitive( intel );
113 /* assert(intel->batch.space >= sz); */
114 }
115
116 /* assert(intel->prim.primitive != ~0); */
117 ptr = (GLuint *)intel->batch.ptr;
118 intel->batch.ptr += sz;
119 intel->batch.space -= sz;
120
121 return ptr;
122 }
123
124
125
126 #endif