radeon: align FBO pitch
[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 void radeon_get_cliprects(radeonContextPtr radeon,
33 struct drm_clip_rect **cliprects,
34 unsigned int *num_cliprects,
35 int *x_off, int *y_off);
36
37 void radeon_fbo_init(struct radeon_context *radeon);
38 struct gl_renderbuffer *
39 radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv);
40 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
41 {
42 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
43 if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
44 return rrb;
45 else
46 return NULL;
47 }
48
49 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
50 {
51 if (att_index >= 0)
52 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
53 else
54 return NULL;
55 }
56
57 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
58 {
59 struct radeon_renderbuffer *rrb;
60 rrb = rmesa->state.depth.rrb;
61 if (!rrb)
62 return NULL;
63
64 return rrb;
65 }
66
67 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
68 {
69 struct radeon_renderbuffer *rrb;
70 struct radeon_framebuffer *rfb = rmesa->dri.drawable->driverPrivate;
71
72 rrb = rmesa->state.color.rrb;
73 if (rmesa->radeonScreen->driScreen->dri2.enabled) {
74 rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_BACK_LEFT);
75 }
76 if (!rrb)
77 return NULL;
78 return rrb;
79 }
80
81 #include "radeon_cmdbuf.h"
82
83
84 #endif