radeon: make compile again.
[mesa.git] / src / mesa / drivers / dri / radeon / common_misc.h
1 #ifndef COMMON_MISC_H
2 #define COMMON_MISC_H
3
4 #include "common_context.h"
5 #include "radeon_buffer.h"
6 void radeonRecalcScissorRects(radeonContextPtr radeon);
7 void radeonSetCliprects(radeonContextPtr radeon);
8 void radeonUpdateScissor( GLcontext *ctx );
9
10 void radeonWaitForIdleLocked(radeonContextPtr radeon);
11 extern uint32_t radeonGetAge(radeonContextPtr radeon);
12 void radeonCopyBuffer( __DRIdrawablePrivate *dPriv,
13 const drm_clip_rect_t *rect);
14 void radeonPageFlip( __DRIdrawablePrivate *dPriv );
15 void radeon_common_finish(GLcontext * ctx);
16 void radeonSwapBuffers(__DRIdrawablePrivate * dPriv);
17 void radeonCopySubBuffer(__DRIdrawablePrivate * dPriv,
18 int x, int y, int w, int h );
19
20 void radeonUpdatePageFlipping(radeonContextPtr rmesa);
21
22 GLboolean radeonInitContext(radeonContextPtr radeon,
23 struct dd_function_table* functions,
24 const __GLcontextModes * glVisual,
25 __DRIcontextPrivate * driContextPriv,
26 void *sharedContextPrivate);
27
28 void radeonCleanupContext(radeonContextPtr radeon);
29 void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable);
30 GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv,
31 __DRIdrawablePrivate * driDrawPriv,
32 __DRIdrawablePrivate * driReadPriv);
33
34 void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos,
35 GLvoid * data, int size, int stride, int count);
36 void radeon_print_state_atom( struct radeon_state_atom *state );
37
38 struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx);
39 void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage);
40
41 void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable);
42 void radeon_teximage_unmap(radeon_texture_image *image);
43 void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj);
44 void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj);
45 void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj);
46 int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj);
47 GLuint radeon_face_for_target(GLenum target);
48 const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx,
49 GLint internalFormat,
50 GLenum format,
51 GLenum type);
52
53 void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level,
54 GLint internalFormat,
55 GLint width, GLint border,
56 GLenum format, GLenum type, const GLvoid * pixels,
57 const struct gl_pixelstore_attrib *packing,
58 struct gl_texture_object *texObj,
59 struct gl_texture_image *texImage);
60 void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level,
61 GLint internalFormat,
62 GLint width, GLint height, GLint border,
63 GLenum format, GLenum type, const GLvoid * pixels,
64 const struct gl_pixelstore_attrib *packing,
65 struct gl_texture_object *texObj,
66 struct gl_texture_image *texImage);
67 void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target,
68 GLint level, GLint internalFormat,
69 GLint width, GLint height, GLint border,
70 GLsizei imageSize, const GLvoid * data,
71 struct gl_texture_object *texObj,
72 struct gl_texture_image *texImage);
73 void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level,
74 GLint internalFormat,
75 GLint width, GLint height, GLint depth,
76 GLint border,
77 GLenum format, GLenum type, const GLvoid * pixels,
78 const struct gl_pixelstore_attrib *packing,
79 struct gl_texture_object *texObj,
80 struct gl_texture_image *texImage);
81 void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
82 GLint xoffset,
83 GLsizei width,
84 GLenum format, GLenum type,
85 const GLvoid * pixels,
86 const struct gl_pixelstore_attrib *packing,
87 struct gl_texture_object *texObj,
88 struct gl_texture_image *texImage);
89 void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
90 GLint xoffset, GLint yoffset,
91 GLsizei width, GLsizei height,
92 GLenum format, GLenum type,
93 const GLvoid * pixels,
94 const struct gl_pixelstore_attrib *packing,
95 struct gl_texture_object *texObj,
96 struct gl_texture_image *texImage);
97 void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target,
98 GLint level, GLint xoffset,
99 GLint yoffset, GLsizei width,
100 GLsizei height, GLenum format,
101 GLsizei imageSize, const GLvoid * data,
102 struct gl_texture_object *texObj,
103 struct gl_texture_image *texImage);
104
105 void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
106 GLint xoffset, GLint yoffset, GLint zoffset,
107 GLsizei width, GLsizei height, GLsizei depth,
108 GLenum format, GLenum type,
109 const GLvoid * pixels,
110 const struct gl_pixelstore_attrib *packing,
111 struct gl_texture_object *texObj,
112 struct gl_texture_image *texImage);
113
114 void radeonSpanRenderStart(GLcontext * ctx);
115 void radeonSpanRenderFinish(GLcontext * ctx);
116 GLubyte *radeon_ptr(const struct radeon_renderbuffer * rrb,
117 GLint x, GLint y);
118 GLubyte *radeon_ptr16(const struct radeon_renderbuffer * rrb,
119 GLint x, GLint y);
120 GLubyte *radeon_ptr32(const struct radeon_renderbuffer * rrb,
121 GLint x, GLint y);
122 void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size);
123 void radeonAllocDmaRegion(radeonContextPtr rmesa,
124 struct radeon_bo **pbo, int *poffset,
125 int bytes, int alignment);
126 void radeonReleaseDmaRegion(radeonContextPtr rmesa);
127
128 void rcommon_flush_last_swtcl_prim(GLcontext *ctx);
129
130 void *rcommonAllocDmaLowVerts(radeonContextPtr rmesa, int nverts, int vsize);
131
132
133 static inline struct radeon_renderbuffer *radeon_get_depthbuffer(radeonContextPtr rmesa)
134 {
135 struct radeon_renderbuffer *rrb;
136 rrb = rmesa->state.depth.rrb;
137 if (!rrb)
138 return NULL;
139
140 return rrb;
141 }
142
143 static inline struct radeon_renderbuffer *radeon_get_colorbuffer(radeonContextPtr rmesa)
144 {
145 struct radeon_renderbuffer *rrb;
146 GLframebuffer *fb = rmesa->dri.drawable->driverPrivate;
147
148 rrb = rmesa->state.color.rrb;
149 if (rmesa->radeonScreen->driScreen->dri2.enabled) {
150 rrb = (struct radeon_renderbuffer *)fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
151 }
152 if (!rrb)
153 return NULL;
154 return rrb;
155 }
156
157
158 #endif