if (driContextPriv) {
struct intel_context *intel
= (struct intel_context *) driContextPriv->driverPrivate;
- struct st_framebuffer *draw_fb
- = (struct st_framebuffer *) driDrawPriv->driverPrivate;
- struct st_framebuffer *read_fb
- = (struct st_framebuffer *) driReadPriv->driverPrivate;
+ struct intel_framebuffer *draw_fb = intel_framebuffer(driDrawPriv);
+ struct intel_framebuffer *read_fb = intel_framebuffer(driReadPriv);
+
+ assert(draw_fb->stfb);
+ assert(read_fb->stfb);
/* this is a hack so we have a valid context when the region allocation
is done. Need a per-screen context? */
intel->intelScreen->dummyctxptr = intel;
- st_make_current(intel->st, draw_fb, read_fb);
+ st_make_current(intel->st, draw_fb->stfb, read_fb->stfb);
if ((intel->driDrawable != driDrawPriv) ||
(intel->lastStamp != driDrawPriv->lastStamp)) {
#define INTEL_MAX_FIXUP 64
+/**
+ * Intel rendering context, contains a state tracker and intel-specific info.
+ */
struct intel_context
{
struct st_context *st;
driOptionCache optionCache;
};
+
+
+/**
+ * Intel framebuffer.
+ */
+struct intel_framebuffer
+{
+ struct st_framebuffer *stfb;
+
+ /* other fields TBD */
+ int other;
+};
+
+
+
+
/* These are functions now:
*/
void LOCK_HARDWARE( struct intel_context *intel );
#define PCI_CHIP_Q33_G 0x29D2
-/*======================================================================
- * Inline conversion functions.
- * These are better-typed than the macros used previously:
- */
+/** Cast wrapper */
static INLINE struct intel_context *
intel_context(GLcontext * ctx)
{
}
+/** Cast wrapper */
+static INLINE struct intel_framebuffer *
+intel_framebuffer(__DRIdrawablePrivate * driDrawPriv)
+{
+ return (struct intel_framebuffer *) driDrawPriv->driverPrivate;
+}
+
+
#endif
#include "vblank.h"
#include "xmlpool.h"
+#include "intel_context.h"
#include "intel_screen.h"
#include "intel_batchbuffer.h"
#include "intel_swapbuffers.h"
return GL_FALSE; /* not implemented */
}
else {
- struct st_framebuffer *stfb = st_create_framebuffer(mesaVis);
- driDrawPriv->driverPrivate = (void *) stfb;
+ struct intel_framebuffer *intelfb = CALLOC_STRUCT(intel_framebuffer);
+ if (!intelfb)
+ return GL_FALSE;
+
+ intelfb->stfb = st_create_framebuffer(mesaVis);
+ if (!intelfb->stfb) {
+ free(intelfb);
+ return GL_FALSE;
+ }
+
+ driDrawPriv->driverPrivate = (void *) intelfb;
return GL_TRUE;
}
}
static void
intelDestroyBuffer(__DRIdrawablePrivate * driDrawPriv)
{
- st_unreference_framebuffer((struct st_framebuffer **)
- (&(driDrawPriv->driverPrivate)));
+ struct intel_framebuffer *intelfb = intel_framebuffer(driDrawPriv);
+ assert(intelfb->stfb);
+ st_unreference_framebuffer(&intelfb->stfb);
+ free(intelfb);
}
GLuint bufferIndex)
{
struct st_renderbuffer *strb
- = st_renderbuffer(intel_fb->Base.Attachment[bufferIndex].Renderbuffer);
+ = st_renderbuffer(intel_fb->stfb->Base.Attachment[bufferIndex].Renderbuffer);
if (strb)
return strb->surface;
return NULL;
void
intelUpdateWindowSize(__DRIdrawablePrivate *dPriv)
{
- struct st_framebuffer *stfb
- = (struct st_framebuffer *) dPriv->driverPrivate;
- st_resize_framebuffer(stfb, dPriv->w, dPriv->h);
+ struct intel_framebuffer *intelfb = intel_framebuffer(dPriv);
+ assert(intelfb->stfb);
+ st_resize_framebuffer(intelfb->stfb, dPriv->w, dPriv->h);
}
*
**************************************************************************/
-#ifndef INTEL_BUFFERS_H
-#define INTEL_BUFFERS_H
-
-
-
-/**
- * Intel framebuffer, derived from gl_framebuffer.
- */
-struct intel_framebuffer
-{
- struct gl_framebuffer Base;
-
-};
+#ifndef INTEL_SWAPBUFFERS_H
+#define INTEL_SWAPBUFFERS_H
extern void intelDisplaySurface(__DRIdrawablePrivate * dPriv,
extern void intelUpdateWindowSize(__DRIdrawablePrivate *dPriv);
-#endif /* INTEL_BUFFERS_H */
+#endif /* INTEL_SWAPBUFFERS_H */