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