Brian Paul <bri...@vmware.com> writes:

> Francisco Jerez wrote:
>> 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_unnamed_framebuffer" for the sake of
>> symmetry.
>
> I think I'd prefer _mesa_initialize_window_framebuffer() or
> _mesa_initialize_winsys_framebuffer() to "unnamed".  I think either of
> those would be a better name for the framebuffer that's associated
> with an actual window.  OK?
>
Sounds good to me.

> Also, the comments and the actual function name don't agree in your
> comments below...
>
Sorry for that, I'll fix both soon.

> -Brian
>
>
>
>
>> ---
>>  src/mesa/drivers/directfb/idirectfbgl_mesa.c |    2 +-
>>  src/mesa/drivers/dri/intel/intel_screen.c    |    2 +-
>>  src/mesa/drivers/dri/radeon/radeon_screen.c  |    2 +-
>>  src/mesa/drivers/dri/swrast/swrast.c         |    2 +-
>>  src/mesa/drivers/fbdev/glfbdev.c             |    2 +-
>>  src/mesa/drivers/windows/gdi/wmesa.c         |    2 +-
>>  src/mesa/drivers/x11/xm_api.c                |    2 +-
>>  src/mesa/main/framebuffer.c                  |   41 
>> ++++++++++++++++++-------
>>  src/mesa/main/framebuffer.h                  |    6 +++-
>>  src/mesa/state_tracker/st_framebuffer.c      |    2 +-
>>  10 files changed, 42 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c 
>> b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
>> index 62a3269..83971de 100644
>> --- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c
>> +++ b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
>> @@ -813,7 +813,7 @@ directfbgl_create_context( GLcontext        *context,
>>  {
>>       struct dd_function_table functions;
>>
>> -     _mesa_initialize_framebuffer( framebuffer, visual );
>> +     _mesa_initialize_unnamed_framebuffer( framebuffer, visual );
>>
>>       _mesa_init_driver_functions( &functions );
>>       functions.GetString     = dfbGetString;
>> diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
>> b/src/mesa/drivers/dri/intel/intel_screen.c
>> index e8cc202..c0710b2 100644
>> --- a/src/mesa/drivers/dri/intel/intel_screen.c
>> +++ b/src/mesa/drivers/dri/intel/intel_screen.c
>> @@ -202,7 +202,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
>>        if (!fb)
>>          return GL_FALSE;
>>
>> -      _mesa_initialize_framebuffer(fb, mesaVis);
>> +      _mesa_initialize_unnamed_framebuffer(fb, mesaVis);
>>
>>        if (mesaVis->redBits == 5)
>>          rgbFormat = MESA_FORMAT_RGB565;
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
>> b/src/mesa/drivers/dri/radeon/radeon_screen.c
>> index 6fa1a06..031a301 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_screen.c
>> +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
>> @@ -1479,7 +1479,7 @@ radeonCreateBuffer( __DRIscreen *driScrnPriv,
>>      if (!rfb)
>>        return GL_FALSE;
>>
>> -    _mesa_initialize_framebuffer(&rfb->base, mesaVis);
>> +    _mesa_initialize_unnamed_framebuffer(&rfb->base, mesaVis);
>>
>>      if (mesaVis->redBits == 5)
>>          rgbFormat = _mesa_little_endian() ? MESA_FORMAT_RGB565 : 
>> MESA_FORMAT_RGB565_REV;
>> diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
>> b/src/mesa/drivers/dri/swrast/swrast.c
>> index 8340861..e0c8624 100644
>> --- a/src/mesa/drivers/dri/swrast/swrast.c
>> +++ b/src/mesa/drivers/dri/swrast/swrast.c
>> @@ -368,7 +368,7 @@ driCreateNewDrawable(__DRIscreen *screen,
>>      buf->row = _mesa_malloc(MAX_WIDTH * 4);
>>
>>      /* basic framebuffer setup */
>> -    _mesa_initialize_framebuffer(&buf->Base, &config->modes);
>> +    _mesa_initialize_unnamed_framebuffer(&buf->Base, &config->modes);
>>
>>      /* add front renderbuffer */
>>      frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
>> diff --git a/src/mesa/drivers/fbdev/glfbdev.c 
>> b/src/mesa/drivers/fbdev/glfbdev.c
>> index 531558d..d809c28 100644
>> --- a/src/mesa/drivers/fbdev/glfbdev.c
>> +++ b/src/mesa/drivers/fbdev/glfbdev.c
>> @@ -626,7 +626,7 @@ glFBDevCreateBuffer( const struct fb_fix_screeninfo 
>> *fixInfo,
>>        return NULL;
>>
>>     /* basic framebuffer setup */
>> -   _mesa_initialize_framebuffer(&buf->glframebuffer, &visual->glvisual);
>> +   _mesa_initialize_unnamed_framebuffer(&buf->glframebuffer, 
>> &visual->glvisual);
>>     /* add front renderbuffer */
>>     frontrb = new_glfbdev_renderbuffer(frontBuffer, visual);
>>     _mesa_add_renderbuffer(&buf->glframebuffer, BUFFER_FRONT_LEFT,
>> diff --git a/src/mesa/drivers/windows/gdi/wmesa.c 
>> b/src/mesa/drivers/windows/gdi/wmesa.c
>> index ceeafd5..c398e36 100644
>> --- a/src/mesa/drivers/windows/gdi/wmesa.c
>> +++ b/src/mesa/drivers/windows/gdi/wmesa.c
>> @@ -35,7 +35,7 @@ wmesa_new_framebuffer(HDC hdc, GLvisual *visual)
>>      WMesaFramebuffer pwfb
>>          = (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer));
>>      if (pwfb) {
>> -        _mesa_initialize_framebuffer(&pwfb->Base, visual);
>> +        _mesa_initialize_unnamed_framebuffer(&pwfb->Base, visual);
>>          pwfb->hDC = hdc;
>>          /* insert at head of list */
>>          pwfb->next = FirstFramebuffer;
>> diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
>> index bf767bc..f9b6ebc 100644
>> --- a/src/mesa/drivers/x11/xm_api.c
>> +++ b/src/mesa/drivers/x11/xm_api.c
>> @@ -375,7 +375,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
>>     b->type = type;
>>     b->cmap = cmap;
>>
>> -   _mesa_initialize_framebuffer(&b->mesa_buffer, &vis->mesa_visual);
>> +   _mesa_initialize_unnamed_framebuffer(&b->mesa_buffer, &vis->mesa_visual);
>>     b->mesa_buffer.Delete = xmesa_delete_framebuffer;
>>
>>     /*
>> diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
>> index d958dbf..0a9ecb9 100644
>> --- a/src/mesa/main/framebuffer.c
>> +++ b/src/mesa/main/framebuffer.c
>> @@ -88,7 +88,7 @@ _mesa_create_framebuffer(const GLvisual *visual)
>>     struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
>>     assert(visual);
>>     if (fb) {
>> -      _mesa_initialize_framebuffer(fb, visual);
>> +      _mesa_initialize_unnamed_framebuffer(fb, visual);
>>     }
>>     return fb;
>>  }
>> @@ -109,15 +109,7 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
>>     assert(name != 0);
>>     fb = CALLOC_STRUCT(gl_framebuffer);
>>     if (fb) {
>> -      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);
>> +      _mesa_initialize_user_framebuffer(fb, name);
>>     }
>>     return fb;
>>  }
>> @@ -126,10 +118,11 @@ _mesa_new_framebuffer(GLcontext *ctx, GLuint name)
>>  /**
>>   * Initialize a gl_framebuffer object.  Typically used to initialize
>>   * window system-created framebuffers, not user-created framebuffers.
>> - * \sa _mesa_create_framebuffer
>> + * \sa _mesa_initialize_framebuffer_user
>
> Wrong function name in comment.
>
>
>>   */
>>  void
>> -_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual 
>> *visual)
>> +_mesa_initialize_unnamed_framebuffer(struct gl_framebuffer *fb,
>> +                                    const GLvisual *visual)
>>  {
>>     assert(fb);
>>     assert(visual);
>> @@ -167,6 +160,30 @@ _mesa_initialize_framebuffer(struct gl_framebuffer *fb, 
>> const GLvisual *visual)
>>
>>
>>  /**
>> + * Initialize an user-created gl_framebuffer object.
>> + * \sa _mesa_initialize_framebuffer_unnamed
>
> Wrong function name in comment.
>
>
>> + */
>> +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.
>>   * Typically called via the gl_framebuffer->Delete() method.
>>   */
>> diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
>> index ef21dd9..425e2a0 100644
>> --- a/src/mesa/main/framebuffer.h
>> +++ b/src/mesa/main/framebuffer.h
>> @@ -34,7 +34,11 @@ extern struct gl_framebuffer *
>>  _mesa_new_framebuffer(GLcontext *ctx, GLuint name);
>>
>>  extern void
>> -_mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual 
>> *visual);
>> +_mesa_initialize_unnamed_framebuffer(struct gl_framebuffer *fb,
>> +                                    const GLvisual *visual);
>> +
>> +extern void
>> +_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name);
>>
>>  extern void
>>  _mesa_destroy_framebuffer(struct gl_framebuffer *buffer);
>> diff --git a/src/mesa/state_tracker/st_framebuffer.c 
>> b/src/mesa/state_tracker/st_framebuffer.c
>> index 835142e..91ecd3f 100644
>> --- a/src/mesa/state_tracker/st_framebuffer.c
>> +++ b/src/mesa/state_tracker/st_framebuffer.c
>> @@ -53,7 +53,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
>>        if (visual->sampleBuffers)
>>           samples = visual->samples;
>>
>> -      _mesa_initialize_framebuffer(&stfb->Base, visual);
>> +      _mesa_initialize_unnamed_framebuffer(&stfb->Base, visual);
>>
>>        if (visual->doubleBufferMode) {
>>           struct gl_renderbuffer *rb
>> --
>> 1.6.4.4
>>
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>> _______________________________________________
>> Mesa3d-dev mailing list
>> Mesa3d-dev@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
>> .
>>

Attachment: pgpSK32131pV1.pgp
Description: PGP signature

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to