sync with tizen_2.2
[sdk/emulator/qemu.git] / gl / mesa / 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_fbo_init(struct radeon_context *radeon);
29 void
30 radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
31                            struct radeon_bo *bo);
32 struct radeon_renderbuffer *
33 radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
34
35 void
36 radeonReadPixels(struct gl_context * ctx,
37                                 GLint x, GLint y, GLsizei width, GLsizei height,
38                                 GLenum format, GLenum type,
39                                 const struct gl_pixelstore_attrib *pack, GLvoid * pixels);
40
41 void radeon_check_front_buffer_rendering(struct gl_context *ctx);
42 static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
43 {
44         struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
45         radeon_print(RADEON_MEMORY, RADEON_TRACE,
46                 "%s(rb %p)\n",
47                 __func__, (void *) rb);
48         if (rrb && rrb->base.Base.ClassID == RADEON_RB_CLASS)
49                 return rrb;
50         else
51                 return NULL;
52 }
53
54 static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
55 {
56         radeon_print(RADEON_MEMORY, RADEON_TRACE,
57                 "%s(fb %p, index %d)\n",
58                 __func__, (void *) fb, att_index);
59
60         if (att_index >= 0)
61                 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
62         else
63                 return NULL;
64 }
65
66 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
67 {
68         struct radeon_renderbuffer *rrb;
69         rrb = radeon_renderbuffer(rmesa->state.depth.rb);
70         if (!rrb)
71                 return NULL;
72
73         return rrb;
74 }
75
76 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
77 {
78         struct radeon_renderbuffer *rrb;
79
80         rrb = radeon_renderbuffer(rmesa->state.color.rb);
81         if (!rrb)
82                 return NULL;
83         return rrb;
84 }
85
86 #include "radeon_cmdbuf.h"
87
88
89 #endif