2 Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
4 The Weather Channel (TM) funded Tungsten Graphics to develop the
5 initial release of the Radeon 8500 driver under the XFree86 license.
6 This notice must be preserved.
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice (including the
17 next paragraph) shall be included in all copies or substantial
18 portions of the Software.
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
33 * \author Nicolai Haehnle <prefect_@gmx.net>
36 #ifndef __R300_CMDBUF_H__
37 #define __R300_CMDBUF_H__
39 #include "r300_context.h"
41 extern int r300FlushCmdBufLocked(r300ContextPtr r300
, const char *caller
);
42 extern int r300FlushCmdBuf(r300ContextPtr r300
, const char *caller
);
44 extern void r300EmitState(r300ContextPtr r300
);
46 extern void r300InitCmdBuf(r300ContextPtr r300
);
47 extern void r300DestroyCmdBuf(r300ContextPtr r300
);
50 * Make sure that enough space is available in the command buffer
51 * by flushing if necessary.
53 * \param dwords The number of dwords we need to be free on the command buffer
55 static INLINE
void r300EnsureCmdBufSpace(r300ContextPtr r300
,
56 int dwords
, const char *caller
)
58 assert(dwords
< r300
->cmdbuf
.size
);
60 if (r300
->cmdbuf
.count_used
+ dwords
> r300
->cmdbuf
.size
)
61 r300FlushCmdBuf(r300
, caller
);
65 * Allocate the given number of dwords in the command buffer and return
66 * a pointer to the allocated area.
67 * When necessary, these functions cause a flush. r300AllocCmdBuf() also
68 * causes state reemission after a flush. This is necessary to ensure
69 * correct hardware state after an unlock.
71 static INLINE
uint32_t *r300RawAllocCmdBuf(r300ContextPtr r300
,
72 int dwords
, const char *caller
)
76 r300EnsureCmdBufSpace(r300
, dwords
, caller
);
78 ptr
= &r300
->cmdbuf
.cmd_buf
[r300
->cmdbuf
.count_used
];
79 r300
->cmdbuf
.count_used
+= dwords
;
83 static INLINE
uint32_t *r300AllocCmdBuf(r300ContextPtr r300
,
84 int dwords
, const char *caller
)
88 r300EnsureCmdBufSpace(r300
, dwords
, caller
);
90 if (!r300
->cmdbuf
.count_used
) {
91 if (RADEON_DEBUG
& DEBUG_IOCTL
)
93 "Reemit state after flush (from %s)\n", caller
);
97 ptr
= &r300
->cmdbuf
.cmd_buf
[r300
->cmdbuf
.count_used
];
98 r300
->cmdbuf
.count_used
+= dwords
;
102 extern void r300EmitBlit(r300ContextPtr rmesa
,
108 GLint srcx
, GLint srcy
,
109 GLint dstx
, GLint dsty
, GLuint w
, GLuint h
);
111 extern void r300EmitWait(r300ContextPtr rmesa
, GLuint flags
);
112 extern void r300EmitLOAD_VBPNTR(r300ContextPtr rmesa
, int start
);
113 extern void r300EmitVertexShader(r300ContextPtr rmesa
);
114 extern void r300EmitPixelShader(r300ContextPtr rmesa
);
116 #endif /* __R300_CMDBUF_H__ */