Add new void *addr and __DRIdrawablePrivate parameters to
[mesa.git] / src / mesa / drivers / dri / common / drirenderbuffer.h
1
2 /**
3 * A driRenderbuffer is dervied from gl_renderbuffer.
4 * It describes a color buffer (front or back), a depth buffer, or stencil
5 * buffer etc.
6 * Specific to DRI drivers are the offset and pitch fields.
7 */
8
9
10 #ifndef DRIRENDERBUFFER_H
11 #define DRIRENDERBUFFER_H
12
13 #include "mtypes.h"
14 #include "dri_util.h"
15
16
17 typedef struct {
18 struct gl_renderbuffer Base;
19
20 /* Chars or bytes per pixel. If Z and Stencil are stored together this
21 * will typically be 32 whether this a depth or stencil renderbuffer.
22 */
23 GLint cpp;
24
25 /* Buffer position and pitch (row stride). Recall that for today's DRI
26 * drivers, we have statically allocated color/depth/stencil buffers.
27 * So this information describes the whole screen, not just a window.
28 * To address pixels in a window, we need to know the window's position
29 * and size with respect to the screen.
30 */
31 GLint offset; /* in bytes */
32 GLint pitch; /* in pixels */
33
34 /* If the driver can do page flipping (full-screen double buffering)
35 * the current front/back buffers may get swapped.
36 * If page flipping is disabled, these fields will be identical to
37 * the offset/pitch/Data above.
38 * If page flipping is enabled, and this is the front(back) renderbuffer,
39 * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values.
40 */
41 GLint flippedOffset;
42 GLint flippedPitch;
43 GLvoid *flippedData; /* mmap'd address of buffer memory, if used */
44
45 /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute
46 * the window's position within the framebuffer.
47 */
48 __DRIdrawablePrivate *dPriv;
49
50 /* XXX this is for radeon/r200 only. We should really create a new
51 * r200Renderbuffer class, derived from this class... not a huge deal.
52 */
53 GLboolean depthHasSurface;
54
55 /* XXX this is for s3v only. A handy flag to know if this is the back
56 * color buffer.
57 */
58 GLboolean backBuffer;
59 } driRenderbuffer;
60
61
62 extern driRenderbuffer *
63 driNewRenderbuffer(GLenum format, GLvoid *addr,
64 GLint cpp, GLint offset, GLint pitch,
65 __DRIdrawablePrivate *dPriv);
66
67 extern void
68 driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
69
70 #endif /* DRIRENDERBUFFER_H */