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