radeon: fixup some issue with fbos and sw fallbacks
[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
51 void radeon_fbo_init(struct radeon_context *radeon);
52 void
53 radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
54 struct radeon_bo *bo);
55 struct radeon_renderbuffer *
56 radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv);
57 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
58 {
59 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
60 if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
61 return rrb;
62 else
63 return NULL;
64 }
65
66 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
67 {
68 if (att_index >= 0)
69 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
70 else
71 return NULL;
72 }
73
74 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
75 {
76 struct radeon_renderbuffer *rrb;
77 rrb = rmesa->state.depth.rrb;
78 if (!rrb)
79 return NULL;
80
81 return rrb;
82 }
83
84 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
85 {
86 struct radeon_renderbuffer *rrb;
87
88 rrb = rmesa->state.color.rrb;
89 if (!rrb)
90 return NULL;
91 return rrb;
92 }
93
94 #include "radeon_cmdbuf.h"
95
96
97 #endif