Merge remote branch 'main/master' into radeon-rewrite
[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 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
34 {
35 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
36 if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
37 return rrb;
38 else
39 return NULL;
40 }
41
42 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
43 {
44 if (att_index >= 0)
45 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
46 else
47 return NULL;
48 }
49
50 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
51 {
52 struct radeon_renderbuffer *rrb;
53 rrb = rmesa->state.depth.rrb;
54 if (!rrb)
55 return NULL;
56
57 return rrb;
58 }
59
60 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
61 {
62 struct radeon_renderbuffer *rrb;
63 struct radeon_framebuffer *rfb = rmesa->dri.drawable->driverPrivate;
64
65 rrb = rmesa->state.color.rrb;
66 if (rmesa->radeonScreen->driScreen->dri2.enabled) {
67 rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_BACK_LEFT);
68 }
69 if (!rrb)
70 return NULL;
71 return rrb;
72 }
73
74 #include "radeon_cmdbuf.h"
75
76
77 #endif