Merge commit 'origin/master' into gallium-sw-api-2
[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 void radeonUserClear(GLcontext *ctx, GLuint mask);
9 void radeonRecalcScissorRects(radeonContextPtr radeon);
10 void radeonSetCliprects(radeonContextPtr radeon);
11 void radeonUpdateScissor( GLcontext *ctx );
12 void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
13
14 void radeonWaitForIdleLocked(radeonContextPtr radeon);
15 extern uint32_t radeonGetAge(radeonContextPtr radeon);
16 void radeonCopyBuffer( __DRIdrawable *dPriv,
17 const drm_clip_rect_t *rect);
18 void radeonSwapBuffers(__DRIdrawable * dPriv);
19 void radeonCopySubBuffer(__DRIdrawable * dPriv,
20 int x, int y, int w, int h );
21
22 void radeonUpdatePageFlipping(radeonContextPtr rmesa);
23
24 void radeonFlush(GLcontext *ctx);
25 void radeonFinish(GLcontext * ctx);
26 void radeonEmitState(radeonContextPtr radeon);
27 GLuint radeonCountStateEmitSize(radeonContextPtr radeon);
28
29 void radeon_clear_tris(GLcontext *ctx, GLbitfield mask);
30
31 void radeon_window_moved(radeonContextPtr radeon);
32 void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
33 void radeonDrawBuffer( GLcontext *ctx, GLenum mode );
34 void radeonReadBuffer( GLcontext *ctx, GLenum mode );
35 void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
36 void radeon_get_cliprects(radeonContextPtr radeon,
37 struct drm_clip_rect **cliprects,
38 unsigned int *num_cliprects,
39 int *x_off, int *y_off);
40 void radeon_fbo_init(struct radeon_context *radeon);
41 void
42 radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
43 struct radeon_bo *bo);
44 struct radeon_renderbuffer *
45 radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
46
47 void
48 radeonReadPixels(GLcontext * ctx,
49 GLint x, GLint y, GLsizei width, GLsizei height,
50 GLenum format, GLenum type,
51 const struct gl_pixelstore_attrib *pack, GLvoid * pixels);
52
53 void radeon_check_front_buffer_rendering(GLcontext *ctx);
54 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
55 {
56 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
57 radeon_print(RADEON_MEMORY, RADEON_TRACE,
58 "%s(rb %p)\n",
59 __func__, 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 radeon_print(RADEON_MEMORY, RADEON_TRACE,
69 "%s(fb %p, index %d)\n",
70 __func__, fb, att_index);
71
72 if (att_index >= 0)
73 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
74 else
75 return NULL;
76 }
77
78 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
79 {
80 struct radeon_renderbuffer *rrb;
81 rrb = radeon_renderbuffer(rmesa->state.depth.rb);
82 if (!rrb)
83 return NULL;
84
85 return rrb;
86 }
87
88 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
89 {
90 struct radeon_renderbuffer *rrb;
91
92 rrb = radeon_renderbuffer(rmesa->state.color.rb);
93 if (!rrb)
94 return NULL;
95 return rrb;
96 }
97
98 #include "radeon_cmdbuf.h"
99
100
101 #endif