mesa: Factor out the fb initialization details from _mesa_new_framebuffer.
This should make things easier for drivers wanting to work with a "subclass" of gl_framebuffer. The complementary "_mesa_initialize_framebuffer" function is now called "_mesa_initialize_window_framebuffer" for the sake of symmetry. Signed-off-by: Brian Paul <brianp@vmware.com>
This commit is contained in:

committed by
Brian Paul

parent
64da2aeebc
commit
2ec50d256d
@@ -813,7 +813,7 @@ directfbgl_create_context( GLcontext *context,
|
|||||||
{
|
{
|
||||||
struct dd_function_table functions;
|
struct dd_function_table functions;
|
||||||
|
|
||||||
_mesa_initialize_framebuffer( framebuffer, visual );
|
_mesa_initialize_window_framebuffer( framebuffer, visual );
|
||||||
|
|
||||||
_mesa_init_driver_functions( &functions );
|
_mesa_init_driver_functions( &functions );
|
||||||
functions.GetString = dfbGetString;
|
functions.GetString = dfbGetString;
|
||||||
|
@@ -202,7 +202,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
|
|||||||
if (!fb)
|
if (!fb)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
_mesa_initialize_framebuffer(fb, mesaVis);
|
_mesa_initialize_window_framebuffer(fb, mesaVis);
|
||||||
|
|
||||||
if (mesaVis->redBits == 5)
|
if (mesaVis->redBits == 5)
|
||||||
rgbFormat = MESA_FORMAT_RGB565;
|
rgbFormat = MESA_FORMAT_RGB565;
|
||||||
|
@@ -1479,7 +1479,7 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
|
|||||||
if (!rfb)
|
if (!rfb)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
_mesa_initialize_framebuffer(&rfb->base, mesaVis);
|
_mesa_initialize_window_framebuffer(&rfb->base, mesaVis);
|
||||||
|
|
||||||
if (mesaVis->redBits == 5)
|
if (mesaVis->redBits == 5)
|
||||||
rgbFormat = _mesa_little_endian() ? MESA_FORMAT_RGB565 : MESA_FORMAT_RGB565_REV;
|
rgbFormat = _mesa_little_endian() ? MESA_FORMAT_RGB565 : MESA_FORMAT_RGB565_REV;
|
||||||
|
@@ -368,7 +368,7 @@ driCreateNewDrawable(__DRIscreen *screen,
|
|||||||
buf->row = _mesa_malloc(MAX_WIDTH * 4);
|
buf->row = _mesa_malloc(MAX_WIDTH * 4);
|
||||||
|
|
||||||
/* basic framebuffer setup */
|
/* basic framebuffer setup */
|
||||||
_mesa_initialize_framebuffer(&buf->Base, &config->modes);
|
_mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
|
||||||
|
|
||||||
/* add front renderbuffer */
|
/* add front renderbuffer */
|
||||||
frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
|
frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
|
||||||
|
@@ -626,7 +626,7 @@ glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* basic framebuffer setup */
|
/* basic framebuffer setup */
|
||||||
_mesa_initialize_framebuffer(&buf->glframebuffer, &visual->glvisual);
|
_mesa_initialize_window_framebuffer(&buf->glframebuffer, &visual->glvisual);
|
||||||
/* add front renderbuffer */
|
/* add front renderbuffer */
|
||||||
frontrb = new_glfbdev_renderbuffer(frontBuffer, visual);
|
frontrb = new_glfbdev_renderbuffer(frontBuffer, visual);
|
||||||
_mesa_add_renderbuffer(&buf->glframebuffer, BUFFER_FRONT_LEFT,
|
_mesa_add_renderbuffer(&buf->glframebuffer, BUFFER_FRONT_LEFT,
|
||||||
|
@@ -35,7 +35,7 @@ wmesa_new_framebuffer(HDC hdc, GLvisual *visual)
|
|||||||
WMesaFramebuffer pwfb
|
WMesaFramebuffer pwfb
|
||||||
= (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer));
|
= (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer));
|
||||||
if (pwfb) {
|
if (pwfb) {
|
||||||
_mesa_initialize_framebuffer(&pwfb->Base, visual);
|
_mesa_initialize_window_framebuffer(&pwfb->Base, visual);
|
||||||
pwfb->hDC = hdc;
|
pwfb->hDC = hdc;
|
||||||
/* insert at head of list */
|
/* insert at head of list */
|
||||||
pwfb->next = FirstFramebuffer;
|
pwfb->next = FirstFramebuffer;
|
||||||
|
@@ -375,7 +375,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
|
|||||||
b->type = type;
|
b->type = type;
|
||||||
b->cmap = cmap;
|
b->cmap = cmap;
|
||||||
|
|
||||||
_mesa_initialize_framebuffer(&b->mesa_buffer, &vis->mesa_visual);
|
_mesa_initialize_window_framebuffer(&b->mesa_buffer, &vis->mesa_visual);
|
||||||
b->mesa_buffer.Delete = xmesa_delete_framebuffer;
|
b->mesa_buffer.Delete = xmesa_delete_framebuffer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -88,7 +88,7 @@ _mesa_create_framebuffer(const GLvisual *visual)
|
|||||||
struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
|
struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
|
||||||
assert(visual);
|
assert(visual);
|
||||||
if (fb) {
|
if (fb) {
|
||||||
_mesa_initialize_framebuffer(fb, visual);
|
_mesa_initialize_window_framebuffer(fb, visual);
|
||||||
}
|
}
|
||||||
return fb;
|
return fb;
|
||||||
}
|
}
|
||||||
@@ -109,15 +109,7 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
|
|||||||
assert(name != 0);
|
assert(name != 0);
|
||||||
fb = CALLOC_STRUCT(gl_framebuffer);
|
fb = CALLOC_STRUCT(gl_framebuffer);
|
||||||
if (fb) {
|
if (fb) {
|
||||||
fb->Name = name;
|
_mesa_initialize_user_framebuffer(fb, name);
|
||||||
fb->RefCount = 1;
|
|
||||||
fb->_NumColorDrawBuffers = 1;
|
|
||||||
fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT;
|
|
||||||
fb->_ColorDrawBufferIndexes[0] = BUFFER_COLOR0;
|
|
||||||
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
|
|
||||||
fb->_ColorReadBufferIndex = BUFFER_COLOR0;
|
|
||||||
fb->Delete = _mesa_destroy_framebuffer;
|
|
||||||
_glthread_INIT_MUTEX(fb->Mutex);
|
|
||||||
}
|
}
|
||||||
return fb;
|
return fb;
|
||||||
}
|
}
|
||||||
@@ -126,10 +118,11 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
|
|||||||
/**
|
/**
|
||||||
* Initialize a gl_framebuffer object. Typically used to initialize
|
* Initialize a gl_framebuffer object. Typically used to initialize
|
||||||
* window system-created framebuffers, not user-created framebuffers.
|
* window system-created framebuffers, not user-created framebuffers.
|
||||||
* \sa _mesa_create_framebuffer
|
* \sa _mesa_initialize_user_framebuffer
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual)
|
_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
|
||||||
|
const GLvisual *visual)
|
||||||
{
|
{
|
||||||
assert(fb);
|
assert(fb);
|
||||||
assert(visual);
|
assert(visual);
|
||||||
@@ -166,6 +159,30 @@ _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a user-created gl_framebuffer object.
|
||||||
|
* \sa _mesa_initialize_window_framebuffer
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name)
|
||||||
|
{
|
||||||
|
assert(fb);
|
||||||
|
assert(name);
|
||||||
|
|
||||||
|
_mesa_bzero(fb, sizeof(struct gl_framebuffer));
|
||||||
|
|
||||||
|
fb->Name = name;
|
||||||
|
fb->RefCount = 1;
|
||||||
|
fb->_NumColorDrawBuffers = 1;
|
||||||
|
fb->ColorDrawBuffer[0] = GL_COLOR_ATTACHMENT0_EXT;
|
||||||
|
fb->_ColorDrawBufferIndexes[0] = BUFFER_COLOR0;
|
||||||
|
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
|
||||||
|
fb->_ColorReadBufferIndex = BUFFER_COLOR0;
|
||||||
|
fb->Delete = _mesa_destroy_framebuffer;
|
||||||
|
_glthread_INIT_MUTEX(fb->Mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deallocate buffer and everything attached to it.
|
* Deallocate buffer and everything attached to it.
|
||||||
* Typically called via the gl_framebuffer->Delete() method.
|
* Typically called via the gl_framebuffer->Delete() method.
|
||||||
|
@@ -34,7 +34,11 @@ extern struct gl_framebuffer *
|
|||||||
_mesa_new_framebuffer(GLcontext *ctx, GLuint name);
|
_mesa_new_framebuffer(GLcontext *ctx, GLuint name);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual);
|
_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
|
||||||
|
const GLvisual *visual);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_destroy_framebuffer(struct gl_framebuffer *buffer);
|
_mesa_destroy_framebuffer(struct gl_framebuffer *buffer);
|
||||||
|
@@ -53,7 +53,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
|
|||||||
if (visual->sampleBuffers)
|
if (visual->sampleBuffers)
|
||||||
samples = visual->samples;
|
samples = visual->samples;
|
||||||
|
|
||||||
_mesa_initialize_framebuffer(&stfb->Base, visual);
|
_mesa_initialize_window_framebuffer(&stfb->Base, visual);
|
||||||
|
|
||||||
if (visual->doubleBufferMode) {
|
if (visual->doubleBufferMode) {
|
||||||
struct gl_renderbuffer *rb
|
struct gl_renderbuffer *rb
|
||||||
|
Reference in New Issue
Block a user