radeon: Drop dri2 checks now that it's always true.
[profile/ivi/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(struct gl_context *ctx, GLuint mask);
9 void radeonRecalcScissorRects(radeonContextPtr radeon);
10 void radeonSetCliprects(radeonContextPtr radeon);
11 void radeonUpdateScissor( struct gl_context *ctx );
12 void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
13
14 extern uint32_t radeonGetAge(radeonContextPtr radeon);
15
16 void radeonFlush(struct gl_context *ctx);
17 void radeonFinish(struct gl_context * ctx);
18 void radeonEmitState(radeonContextPtr radeon);
19 GLuint radeonCountStateEmitSize(radeonContextPtr radeon);
20
21 void radeon_clear_tris(struct gl_context *ctx, GLbitfield mask);
22
23 void radeon_window_moved(radeonContextPtr radeon);
24 void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb);
25 void radeonDrawBuffer( struct gl_context *ctx, GLenum mode );
26 void radeonReadBuffer( struct gl_context *ctx, GLenum mode );
27 void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
28 void radeon_get_cliprects(radeonContextPtr radeon,
29                           struct drm_clip_rect **cliprects,
30                           unsigned int *num_cliprects,
31                           int *x_off, int *y_off);
32 void radeon_fbo_init(struct radeon_context *radeon);
33 void
34 radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
35                            struct radeon_bo *bo);
36 struct radeon_renderbuffer *
37 radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
38
39 void
40 radeonReadPixels(struct gl_context * ctx,
41                                 GLint x, GLint y, GLsizei width, GLsizei height,
42                                 GLenum format, GLenum type,
43                                 const struct gl_pixelstore_attrib *pack, GLvoid * pixels);
44
45 void radeon_check_front_buffer_rendering(struct gl_context *ctx);
46 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
47 {
48         struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
49         radeon_print(RADEON_MEMORY, RADEON_TRACE,
50                 "%s(rb %p)\n",
51                 __func__, rb);
52         if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
53                 return rrb;
54         else
55                 return NULL;
56 }
57
58 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
59 {
60         radeon_print(RADEON_MEMORY, RADEON_TRACE,
61                 "%s(fb %p, index %d)\n",
62                 __func__, fb, att_index);
63
64         if (att_index >= 0)
65                 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
66         else
67                 return NULL;
68 }
69
70 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
71 {
72         struct radeon_renderbuffer *rrb;
73         rrb = radeon_renderbuffer(rmesa->state.depth.rb);
74         if (!rrb)
75                 return NULL;
76
77         return rrb;
78 }
79
80 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
81 {
82         struct radeon_renderbuffer *rrb;
83
84         rrb = radeon_renderbuffer(rmesa->state.color.rb);
85         if (!rrb)
86                 return NULL;
87         return rrb;
88 }
89
90 #include "radeon_cmdbuf.h"
91
92
93 #endif