50a8a959858fc71baad70496e88a7364f6196083
1 /**************************************************************************
3 * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
31 #include "main/formats.h"
32 #include "intel_screen.h"
37 * Intel framebuffer, derived from gl_framebuffer.
39 struct intel_framebuffer
41 struct gl_framebuffer Base
;
43 struct intel_renderbuffer
*color_rb
[2];
50 int64_t swap_missed_ust
;
53 GLuint swap_missed_count
;
58 * Intel renderbuffer, derived from gl_renderbuffer.
60 struct intel_renderbuffer
62 struct gl_renderbuffer Base
;
63 struct intel_region
*region
;
67 GLuint vbl_pending
; /**< vblank sequence number of pending flip */
70 unsigned long span_cache_offset
;
75 * gl_renderbuffer is a base class which we subclass. The Class field
76 * is used for simple run-time type checking.
78 #define INTEL_RB_CLASS 0x12345678
82 * Return a gl_renderbuffer ptr casted to intel_renderbuffer.
83 * NULL will be returned if the rb isn't really an intel_renderbuffer.
84 * This is determined by checking the ClassID.
86 static INLINE
struct intel_renderbuffer
*
87 intel_renderbuffer(struct gl_renderbuffer
*rb
)
89 struct intel_renderbuffer
*irb
= (struct intel_renderbuffer
*) rb
;
90 if (irb
&& irb
->Base
.ClassID
== INTEL_RB_CLASS
) {
91 /*_mesa_warning(NULL, "Returning non-intel Rb\n");*/
100 * Return a framebuffer's renderbuffer, named by a BUFFER_x index.
102 static INLINE
struct intel_renderbuffer
*
103 intel_get_renderbuffer(struct gl_framebuffer
*fb
, int attIndex
)
106 return intel_renderbuffer(fb
->Attachment
[attIndex
].Renderbuffer
);
113 intel_renderbuffer_set_region(struct intel_renderbuffer
*irb
,
114 struct intel_region
*region
);
117 extern struct intel_renderbuffer
*
118 intel_create_renderbuffer(gl_format format
);
122 intel_fbo_init(struct intel_context
*intel
);
126 intel_flip_renderbuffers(struct intel_framebuffer
*intel_fb
);
129 static INLINE
struct intel_region
*
130 intel_get_rb_region(struct gl_framebuffer
*fb
, GLuint attIndex
)
132 struct intel_renderbuffer
*irb
= intel_get_renderbuffer(fb
, attIndex
);
140 #endif /* INTEL_FBO_H */