Tizen 2.0 Release
[profile/ivi/osmesa.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 "main/mtypes.h"
14 #include "main/formats.h"
15 #include "dri_util.h"
16
17
18 typedef struct {
19    struct gl_renderbuffer Base;
20
21    /* Chars or bytes per pixel.  If Z and Stencil are stored together this
22     * will typically be 32 whether this a depth or stencil renderbuffer.
23     */
24    GLint cpp;
25
26    /* Buffer position and pitch (row stride).  Recall that for today's DRI
27     * drivers, we have statically allocated color/depth/stencil buffers.
28     * So this information describes the whole screen, not just a window.
29     * To address pixels in a window, we need to know the window's position
30     * and size with respect to the screen.
31     */
32    GLint offset;  /* in bytes */
33    GLint pitch;   /* in pixels */
34
35    /* If the driver can do page flipping (full-screen double buffering)
36     * the current front/back buffers may get swapped.
37     * If page flipping is disabled, these  fields will be identical to
38     * the offset/pitch/Data above.
39     * If page flipping is enabled, and this is the front(back) renderbuffer,
40     * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values.
41     */
42    GLint flippedOffset;
43    GLint flippedPitch;
44    GLvoid *flippedData;  /* mmap'd address of buffer memory, if used */
45
46    /* Pointer to corresponding __DRIdrawable.  This is used to compute
47     * the window's position within the framebuffer.
48     */
49    __DRIdrawable *dPriv;
50
51    /* XXX this is for radeon/r200 only.  We should really create a new
52     * r200Renderbuffer class, derived from this class...  not a huge deal.
53     */
54    GLboolean depthHasSurface;
55
56    /**
57     * A handy flag to know if this is the back color buffer.
58     * 
59     * \note
60     * This is currently only used by tdfx.
61     */
62    GLboolean backBuffer;
63 } driRenderbuffer;
64
65
66 extern driRenderbuffer *
67 driNewRenderbuffer(gl_format format, GLvoid *addr,
68                    GLint cpp, GLint offset, GLint pitch,
69                    __DRIdrawable *dPriv);
70
71 extern void
72 driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
73
74
75 extern void
76 driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv);
77
78
79 #endif /* DRIRENDERBUFFER_H */