2 * Copyright (C) 2009 Francisco Jerez.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef __NOUVEAU_BO_STATE_H__
28 #define __NOUVEAU_BO_STATE_H__
31 NOUVEAU_BO_CONTEXT_FRAMEBUFFER
= 0,
32 NOUVEAU_BO_CONTEXT_HIERZ
,
33 NOUVEAU_BO_CONTEXT_SURFACE
,
34 NOUVEAU_BO_CONTEXT_TEXTURE0
,
35 NOUVEAU_BO_CONTEXT_TEXTURE1
,
36 NOUVEAU_BO_CONTEXT_TEXTURE2
,
37 NOUVEAU_BO_CONTEXT_TEXTURE3
,
38 NOUVEAU_BO_CONTEXT_VERTEX
,
39 NUM_NOUVEAU_BO_CONTEXT
42 struct nouveau_bo_marker
{
43 struct nouveau_grobj
*gr
;
46 struct nouveau_bo
*bo
;
54 struct nouveau_bo_context
{
55 struct gl_context
*ctx
;
57 struct nouveau_bo_marker
*marker
;
62 struct nouveau_bo_state
{
63 struct nouveau_bo_context context
[NUM_NOUVEAU_BO_CONTEXT
];
68 nouveau_bo_mark(struct nouveau_bo_context
*bctx
, struct nouveau_grobj
*gr
,
69 uint32_t mthd
, struct nouveau_bo
*bo
,
70 uint32_t data
, uint32_t data2
, uint32_t vor
, uint32_t tor
,
73 #define nouveau_bo_markl(bctx, gr, mthd, bo, data, flags) \
74 nouveau_bo_mark(bctx, gr, mthd, bo, data, 0, 0, 0, \
75 flags | NOUVEAU_BO_LOW);
77 #define nouveau_bo_marko(bctx, gr, mthd, bo, flags) \
78 nouveau_bo_mark(bctx, gr, mthd, bo, 0, 0, \
79 context_chan(ctx)->vram->handle, \
80 context_chan(ctx)->gart->handle, \
81 flags | NOUVEAU_BO_OR);
84 nouveau_bo_context_reset(struct nouveau_bo_context
*bctx
);
87 nouveau_bo_state_emit(struct gl_context
*ctx
);
90 nouveau_bo_state_init(struct gl_context
*ctx
);
93 nouveau_bo_state_destroy(struct gl_context
*ctx
);
95 #define __context_bctx(ctx, i) \
97 struct nouveau_context *nctx = to_nouveau_context(ctx); \
98 struct nouveau_bo_context *bctx = &nctx->bo.context[i]; \
99 nouveau_bo_context_reset(bctx); \
102 #define context_bctx(ctx, s) \
103 __context_bctx(ctx, NOUVEAU_BO_CONTEXT_##s)
104 #define context_bctx_i(ctx, s, i) \
105 __context_bctx(ctx, NOUVEAU_BO_CONTEXT_##s##0 + (i))