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