radeon_common.h revision 8fc433fa0f8c5364454858f9be919387feda440c
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
8void radeonUserClear(GLcontext *ctx, GLuint mask);
9void 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);
16void radeonCopyBuffer( __DRIdrawablePrivate *dPriv,
17		       const drm_clip_rect_t	  *rect);
18void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
19void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
20			 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);
27GLuint radeonCountStateEmitSize(radeonContextPtr radeon);
28
29void radeon_clear_tris(GLcontext *ctx, GLbitfield mask);
30
31void 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);
36void radeon_get_cliprects(radeonContextPtr radeon,
37			  struct drm_clip_rect **cliprects,
38			  unsigned int *num_cliprects,
39			  int *x_off, int *y_off);
40void radeon_fbo_init(struct radeon_context *radeon);
41void
42radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
43			   struct radeon_bo *bo);
44struct radeon_renderbuffer *
45radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv);
46static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
47{
48	struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
49	if (rrb && rrb->base.ClassID == RADEON_RB_CLASS)
50		return rrb;
51	else
52		return NULL;
53}
54
55static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index)
56{
57	if (att_index >= 0)
58		return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer);
59	else
60		return NULL;
61}
62
63static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
64{
65	struct radeon_renderbuffer *rrb;
66	rrb = radeon_renderbuffer(rmesa->state.depth.rb);
67	if (!rrb)
68		return NULL;
69
70	return rrb;
71}
72
73static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
74{
75	struct radeon_renderbuffer *rrb;
76
77	rrb = radeon_renderbuffer(rmesa->state.color.rb);
78	if (!rrb)
79		return NULL;
80	return rrb;
81}
82
83#include "radeon_cmdbuf.h"
84
85
86#endif
87