[Mesa-dev] [PATCH 01/11] mesa: Remove Driver.GetBufferSize and its callers.

Eric Anholt eric at anholt.net
Thu Jun 20 23:07:54 PDT 2013


Only the GDI driver set it to non-NULL any more, and that driver has a
Viewport hook that should keep it limping along as well as it ever has.
---
 src/mesa/drivers/common/driverfuncs.c    |  1 -
 src/mesa/drivers/dri/r200/r200_context.c |  1 -
 src/mesa/drivers/dri/swrast/swrast.c     |  1 -
 src/mesa/drivers/osmesa/osmesa.c         |  1 -
 src/mesa/drivers/windows/gdi/wmesa.c     |  1 -
 src/mesa/drivers/x11/xm_dd.c             |  1 -
 src/mesa/main/context.c                  | 45 ---------------------
 src/mesa/main/dd.h                       |  9 -----
 src/mesa/main/framebuffer.c              | 69 --------------------------------
 9 files changed, 129 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 016c0e8..5faa98a 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -75,7 +75,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
 
    driver->GetString = NULL;  /* REQUIRED! */
    driver->UpdateState = NULL;  /* REQUIRED! */
-   driver->GetBufferSize = NULL;  /* REQUIRED! */
    driver->ResizeBuffers = _mesa_resize_framebuffer;
 
    driver->Finish = NULL;
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 391fa90..3484478 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -139,7 +139,6 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = {
  */
 static void r200InitDriverFuncs( struct dd_function_table *functions )
 {
-    functions->GetBufferSize		= NULL; /* OBSOLETE */
     functions->GetString		= r200GetString;
 }
 
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 91bcc59..ee80c1f 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -642,7 +642,6 @@ swrast_init_driver_functions(struct dd_function_table *driver)
 {
     driver->GetString = get_string;
     driver->UpdateState = update_state;
-    driver->GetBufferSize = NULL;
     driver->Viewport = viewport;
     driver->ChooseTextureFormat = swrastChooseTextureFormat;
     driver->MapRenderbuffer = swrast_map_renderbuffer;
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 0d62712..241e74f 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -710,7 +710,6 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
       /* override with our functions */
       functions.GetString = get_string;
       functions.UpdateState = osmesa_update_state;
-      functions.GetBufferSize = NULL;
 
       if (!_mesa_initialize_context(&osmesa->mesa,
                                     API_OPENGL_COMPAT,
diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c
index 35ec65a..ef791ab 100644
--- a/src/mesa/drivers/windows/gdi/wmesa.c
+++ b/src/mesa/drivers/windows/gdi/wmesa.c
@@ -605,7 +605,6 @@ WMesaContext WMesaCreateContext(HDC hDC,
     _mesa_init_driver_functions(&functions);
     functions.GetString = wmesa_get_string;
     functions.UpdateState = wmesa_update_state;
-    functions.GetBufferSize = wmesa_get_buffer_size;
     functions.Flush = wmesa_flush;
     functions.Clear = clear;
     functions.ResizeBuffers = wmesa_resize_buffers;
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c
index d0adea5..676411a 100644
--- a/src/mesa/drivers/x11/xm_dd.c
+++ b/src/mesa/drivers/x11/xm_dd.c
@@ -841,7 +841,6 @@ xmesa_init_driver_functions( XMesaVisual xmvisual,
 {
    driver->GetString = get_string;
    driver->UpdateState = xmesa_update_state;
-   driver->GetBufferSize = NULL; /* OBSOLETE */
    driver->Flush = finish_or_flush;
    driver->Finish = finish_or_flush;
    driver->ColorMask = color_mask;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c59f755..5ad04cc 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1388,25 +1388,6 @@ check_compatible(const struct gl_context *ctx,
 
 
 /**
- * Do one-time initialization for the given framebuffer.  Specifically,
- * ask the driver for the window's current size and update the framebuffer
- * object to match.
- * Really, the device driver should totally take care of this.
- */
-static void
-initialize_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb)
-{
-   GLuint width, height;
-   if (ctx->Driver.GetBufferSize) {
-      ctx->Driver.GetBufferSize(fb, &width, &height);
-      if (ctx->Driver.ResizeBuffers)
-         ctx->Driver.ResizeBuffers(ctx, fb, width, height);
-      fb->Initialized = GL_TRUE;
-   }
-}
-
-
-/**
  * Check if the viewport/scissor size has not yet been initialized.
  * Initialize the size if the given width and height are non-zero.
  */
@@ -1508,32 +1489,6 @@ _mesa_make_current( struct gl_context *newCtx,
           */
 	 newCtx->NewState |= _NEW_BUFFERS;
 
-#if 1
-         /* We want to get rid of these lines: */
-         if (!drawBuffer->Initialized) {
-            initialize_framebuffer_size(newCtx, drawBuffer);
-         }
-         if (readBuffer != drawBuffer && !readBuffer->Initialized) {
-            initialize_framebuffer_size(newCtx, readBuffer);
-         }
-
-	 _mesa_resizebuffers(newCtx);
-#else
-         /* We want the drawBuffer and readBuffer to be initialized by
-          * the driver.
-          * This generally means the Width and Height match the actual
-          * window size and the renderbuffers (both hardware and software
-          * based) are allocated to match.  The later can generally be
-          * done with a call to _mesa_resize_framebuffer().
-          *
-          * It's theoretically possible for a buffer to have zero width
-          * or height, but for now, assert check that the driver did what's
-          * expected of it.
-          */
-         ASSERT(drawBuffer->Width > 0);
-         ASSERT(drawBuffer->Height > 0);
-#endif
-
          if (drawBuffer) {
             _mesa_check_init_viewport(newCtx,
                                       drawBuffer->Width, drawBuffer->Height);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index e251978..c1d9b2c 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -93,15 +93,6 @@ struct dd_function_table {
    void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
 
    /**
-    * Get the width and height of the named buffer/window.
-    *
-    * Mesa uses this to determine when the driver's window size has changed.
-    * XXX OBSOLETE: this function will be removed in the future.
-    */
-   void (*GetBufferSize)( struct gl_framebuffer *buffer,
-                          GLuint *width, GLuint *height );
-
-   /**
     * Resize the given framebuffer to the given size.
     * XXX OBSOLETE: this function will be removed in the future.
     */
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 1906a8a..d28882a 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -319,81 +319,12 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
    }
 }
 
-
-
-/**
- * XXX THIS IS OBSOLETE - drivers should take care of detecting window
- * size changes and act accordingly, likely calling _mesa_resize_framebuffer().
- *
- * GL_MESA_resize_buffers extension.
- *
- * When this function is called, we'll ask the window system how large
- * the current window is.  If it's a new size, we'll call the driver's
- * ResizeBuffers function.  The driver will then resize its color buffers
- * as needed, and maybe call the swrast's routine for reallocating
- * swrast-managed depth/stencil/accum/etc buffers.
- * \note This function should only be called through the GL API, not
- * from device drivers (as was done in the past).
- */
-void
-_mesa_resizebuffers( struct gl_context *ctx )
-{
-   FLUSH_VERTICES(ctx, 0);
-
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glResizeBuffersMESA\n");
-
-   if (!ctx->Driver.GetBufferSize) {
-      return;
-   }
-
-   if (ctx->WinSysDrawBuffer) {
-      GLuint newWidth, newHeight;
-      struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer;
-
-      assert(_mesa_is_winsys_fbo(buffer));
-
-      /* ask device driver for size of output buffer */
-      ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
-
-      /* see if size of device driver's color buffer (window) has changed */
-      if (buffer->Width != newWidth || buffer->Height != newHeight) {
-         if (ctx->Driver.ResizeBuffers)
-            ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
-      }
-   }
-
-   if (ctx->WinSysReadBuffer
-       && ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
-      GLuint newWidth, newHeight;
-      struct gl_framebuffer *buffer = ctx->WinSysReadBuffer;
-
-      assert(_mesa_is_winsys_fbo(buffer));
-
-      /* ask device driver for size of read buffer */
-      ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
-
-      /* see if size of device driver's color buffer (window) has changed */
-      if (buffer->Width != newWidth || buffer->Height != newHeight) {
-         if (ctx->Driver.ResizeBuffers)
-            ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
-      }
-   }
-
-   ctx->NewState |= _NEW_BUFFERS;  /* to update scissor / window bounds */
-}
-
-
 /*
  * XXX THIS IS OBSOLETE
  */
 void GLAPIENTRY
 _mesa_ResizeBuffersMESA( void )
 {
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (ctx->Extensions.MESA_resize_buffers)
-      _mesa_resizebuffers( ctx );
 }
 
 
-- 
1.8.3.rc0



More information about the mesa-dev mailing list