blob: f31f08edf368f89aab156399b84256c96b327762 [file] [log] [blame]
Dave Airlie23d35592009-02-12 22:38:10 +10001#ifndef COMMON_MISC_H
2#define COMMON_MISC_H
3
4#include "radeon_common_context.h"
Dave Airlie23d35592009-02-12 22:38:10 +10005#include "radeon_dma.h"
6#include "radeon_texture.h"
7
Dave Airlief6f0e112009-07-15 09:35:09 +10008void radeonUserClear(GLcontext *ctx, GLuint mask);
Dave Airlie23d35592009-02-12 22:38:10 +10009void radeonRecalcScissorRects(radeonContextPtr radeon);
10void radeonSetCliprects(radeonContextPtr radeon);
11void radeonUpdateScissor( GLcontext *ctx );
12void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
13
14void radeonWaitForIdleLocked(radeonContextPtr radeon);
15extern uint32_t radeonGetAge(radeonContextPtr radeon);
Kristian Høgsbergd61f0732010-01-01 17:09:12 -050016void radeonCopyBuffer( __DRIdrawable *dPriv,
Dave Airlie23d35592009-02-12 22:38:10 +100017 const drm_clip_rect_t *rect);
Kristian Høgsbergd61f0732010-01-01 17:09:12 -050018void radeonSwapBuffers(__DRIdrawable * dPriv);
19void radeonCopySubBuffer(__DRIdrawable * dPriv,
Dave Airlie23d35592009-02-12 22:38:10 +100020 int x, int y, int w, int h );
21
22void radeonUpdatePageFlipping(radeonContextPtr rmesa);
23
24void radeonFlush(GLcontext *ctx);
25void radeonFinish(GLcontext * ctx);
26void radeonEmitState(radeonContextPtr radeon);
Pauli Nieminenb7ec2eb2009-08-21 20:44:54 +030027GLuint radeonCountStateEmitSize(radeonContextPtr radeon);
Dave Airlie23d35592009-02-12 22:38:10 +100028
Dave Airlie8c7e30f2009-03-23 18:27:49 +100029void radeon_clear_tris(GLcontext *ctx, GLbitfield mask);
30
Dave Airlie2b85fcc2009-03-03 03:27:59 +100031void radeon_window_moved(radeonContextPtr radeon);
32void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
33void radeonDrawBuffer( GLcontext *ctx, GLenum mode );
34void radeonReadBuffer( GLcontext *ctx, GLenum mode );
35void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
Dave Airlie9368dcb2009-03-21 16:08:20 +100036void radeon_get_cliprects(radeonContextPtr radeon,
37 struct drm_clip_rect **cliprects,
38 unsigned int *num_cliprects,
39 int *x_off, int *y_off);
Dave Airliefabce832009-03-20 18:23:38 +100040void radeon_fbo_init(struct radeon_context *radeon);
Dave Airlie8c7e30f2009-03-23 18:27:49 +100041void
42radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
43 struct radeon_bo *bo);
44struct radeon_renderbuffer *
Kristian Høgsbergd61f0732010-01-01 17:09:12 -050045radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
Dave Airlie112908c2009-12-18 14:35:03 +100046
47void radeon_check_front_buffer_rendering(GLcontext *ctx);
Dave Airliebdaa0342009-03-19 15:31:03 +100048static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
49{
50 struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
51 if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
52 return rrb;
53 else
54 return NULL;
55}
56
57static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
58{
59 if (att_index >= 0)
60 return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
61 else
62 return NULL;
63}
64
Dave Airlie23d35592009-02-12 22:38:10 +100065static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
66{
67 struct radeon_renderbuffer *rrb;
Michel Dänzer01daead2009-05-20 16:39:33 +020068 rrb = radeon_renderbuffer(rmesa->state.depth.rb);
Dave Airlie23d35592009-02-12 22:38:10 +100069 if (!rrb)
70 return NULL;
71
72 return rrb;
73}
74
75static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
76{
77 struct radeon_renderbuffer *rrb;
Dave Airlie23d35592009-02-12 22:38:10 +100078
Michel Dänzer01daead2009-05-20 16:39:33 +020079 rrb = radeon_renderbuffer(rmesa->state.color.rb);
Dave Airlie23d35592009-02-12 22:38:10 +100080 if (!rrb)
81 return NULL;
82 return rrb;
83}
84
85#include "radeon_cmdbuf.h"
86
87
88#endif