radeon: fix up span function setting
[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 radeonRecalcScissorRects(radeonContextPtr radeon);
9 void radeonSetCliprects(radeonContextPtr radeon);
10 void radeonUpdateScissor( GLcontext *ctx );
11 void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
12
13 void radeonWaitForIdleLocked(radeonContextPtr radeon);
14 extern uint32_t radeonGetAge(radeonContextPtr radeon);
15 void radeonCopyBuffer( __DRIdrawablePrivate *dPriv,
16 const drm_clip_rect_t *rect);
17 void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
18 void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
19 int x, int y, int w, int h );
20
21 void radeonUpdatePageFlipping(radeonContextPtr rmesa);
22
23 void radeonFlush(GLcontext *ctx);
24 void radeonFinish(GLcontext * ctx);
25 void radeonEmitState(radeonContextPtr radeon);
26
27 void radeon_window_moved(radeonContextPtr radeon);
28 void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
29 void radeonDrawBuffer( GLcontext *ctx, GLenum mode );
30 void radeonReadBuffer( GLcontext *ctx, GLenum mode );
31 void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
32
33 void radeon_fbo_init(struct radeon_context *radeon);
34 struct gl_renderbuffer *
35 radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv);
36 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
37 {
38 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
39 if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
40 return rrb;
41 else
42 return NULL;
43 }
44
45 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
46 {
47 if (att_index >= 0)
48 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
49 else
50 return NULL;
51 }
52
53 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
54 {
55 struct radeon_renderbuffer *rrb;
56 rrb = rmesa->state.depth.rrb;
57 if (!rrb)
58 return NULL;
59
60 return rrb;
61 }
62
63 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
64 {
65 struct radeon_renderbuffer *rrb;
66 struct radeon_framebuffer *rfb = rmesa->dri.drawable->driverPrivate;
67
68 rrb = rmesa->state.color.rrb;
69 if (rmesa->radeonScreen->driScreen->dri2.enabled) {
70 rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_BACK_LEFT);
71 }
72 if (!rrb)
73 return NULL;
74 return rrb;
75 }
76
77 #include "radeon_cmdbuf.h"
78
79
80 #endif