mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
clean-up/re-org of intel_framebuffer code
This commit is contained in:
parent
1f17d845ff
commit
2edc87eb3d
5 changed files with 57 additions and 31 deletions
|
|
@ -206,16 +206,17 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
|
|||
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)) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ struct st_context;
|
|||
|
||||
#define INTEL_MAX_FIXUP 64
|
||||
|
||||
/**
|
||||
* Intel rendering context, contains a state tracker and intel-specific info.
|
||||
*/
|
||||
struct intel_context
|
||||
{
|
||||
struct st_context *st;
|
||||
|
|
@ -79,6 +82,22 @@ struct intel_context
|
|||
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 );
|
||||
|
|
@ -124,10 +143,7 @@ extern int __intel_debug;
|
|||
#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)
|
||||
{
|
||||
|
|
@ -135,4 +151,12 @@ intel_context(GLcontext * ctx)
|
|||
}
|
||||
|
||||
|
||||
/** Cast wrapper */
|
||||
static INLINE struct intel_framebuffer *
|
||||
intel_framebuffer(__DRIdrawablePrivate * driDrawPriv)
|
||||
{
|
||||
return (struct intel_framebuffer *) driDrawPriv->driverPrivate;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "vblank.h"
|
||||
#include "xmlpool.h"
|
||||
|
||||
#include "intel_context.h"
|
||||
#include "intel_screen.h"
|
||||
#include "intel_batchbuffer.h"
|
||||
#include "intel_swapbuffers.h"
|
||||
|
|
@ -280,8 +281,17 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -289,8 +299,10 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ get_color_surface(struct intel_framebuffer *intel_fb,
|
|||
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;
|
||||
|
|
@ -236,9 +236,9 @@ intelDisplaySurface(__DRIdrawablePrivate * dPriv,
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,19 +25,8 @@
|
|||
*
|
||||
**************************************************************************/
|
||||
|
||||
#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,
|
||||
|
|
@ -52,4 +41,4 @@ extern void intelCopySubBuffer(__DRIdrawablePrivate * dPriv,
|
|||
extern void intelUpdateWindowSize(__DRIdrawablePrivate *dPriv);
|
||||
|
||||
|
||||
#endif /* INTEL_BUFFERS_H */
|
||||
#endif /* INTEL_SWAPBUFFERS_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue