b60792df0be0d1b98a1092a0330ccf29a7ea1de1
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_common.h
1 #ifndef COMMON_MISC_H
2 #define COMMON_MISC_H
3
4 #include "radeon_common_context.h"
5 #include "radeon_dma.h"
6 #include "radeon_texture.h"
7
8
9 #define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT | \
10 BUFFER_BIT_FRONT_LEFT | \
11 BUFFER_BIT_COLOR0 | \
12 BUFFER_BIT_COLOR1 | \
13 BUFFER_BIT_COLOR2 | \
14 BUFFER_BIT_COLOR3 | \
15 BUFFER_BIT_COLOR4 | \
16 BUFFER_BIT_COLOR5 | \
17 BUFFER_BIT_COLOR6 | \
18 BUFFER_BIT_COLOR7)
19
20 void radeonRecalcScissorRects(radeonContextPtr radeon);
21 void radeonSetCliprects(radeonContextPtr radeon);
22 void radeonUpdateScissor( GLcontext *ctx );
23 void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
24
25 void radeonWaitForIdleLocked(radeonContextPtr radeon);
26 extern uint32_t radeonGetAge(radeonContextPtr radeon);
27 void radeonCopyBuffer( __DRIdrawablePrivate *dPriv,
28 const drm_clip_rect_t *rect);
29 void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
30 void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
31 int x, int y, int w, int h );
32
33 void radeonUpdatePageFlipping(radeonContextPtr rmesa);
34
35 void radeonFlush(GLcontext *ctx);
36 void radeonFinish(GLcontext * ctx);
37 void radeonEmitState(radeonContextPtr radeon);
38
39 void radeon_clear_tris(GLcontext *ctx, GLbitfield mask);
40
41 void radeon_window_moved(radeonContextPtr radeon);
42 void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
43 void radeonDrawBuffer( GLcontext *ctx, GLenum mode );
44 void radeonReadBuffer( GLcontext *ctx, GLenum mode );
45 void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
46 void radeon_get_cliprects(radeonContextPtr radeon,
47 struct drm_clip_rect **cliprects,
48 unsigned int *num_cliprects,
49 int *x_off, int *y_off);
50 GLboolean radeon_revalidate_bos(GLcontext *ctx);
51 void radeon_validate_bo(radeonContextPtr radeon, struct radeon_bo *bo, uint32_t read_domains, uint32_t write_domain);
52 void radeon_validate_reset_bos(radeonContextPtr radeon);
53
54 void radeon_fbo_init(struct radeon_context *radeon);
55 void
56 radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
57 struct radeon_bo *bo);
58 struct radeon_renderbuffer *
59 radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv);
60 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
61 {
62 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
63 if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
64 return rrb;
65 else
66 return NULL;
67 }
68
69 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
70 {
71 if (att_index >= 0)
72 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
73 else
74 return NULL;
75 }
76
77 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
78 {
79 struct radeon_renderbuffer *rrb;
80 rrb = radeon_renderbuffer(rmesa->state.depth.rb);
81 if (!rrb)
82 return NULL;
83
84 return rrb;
85 }
86
87 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
88 {
89 struct radeon_renderbuffer *rrb;
90
91 rrb = radeon_renderbuffer(rmesa->state.color.rb);
92 if (!rrb)
93 return NULL;
94 return rrb;
95 }
96
97 #include "radeon_cmdbuf.h"
98
99
100 #endif