From bab755ad1b8cc5560c7d92e21b1fb1c3bebd43ae Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 20 Jun 2013 09:39:11 -0700 Subject: [PATCH] mesa: Remove Driver.GetBufferSize and its callers. 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. Reviewed-by: Brian Paul Reviewed-by: Kenneth Graunke --- 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 016c0e80fd3..5faa98af1ec 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 391fa90553c..3484478691c 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 91bcc59440a..ee80c1f4ad6 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 0d62712311e..241e74f778c 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 35ec65ac311..ef791ab2f82 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 d0adea50a5d..676411a4a87 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 c59f755c687..5ad04cc9988 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1387,25 +1387,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 e2519780ab2..c1d9b2c9585 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -92,15 +92,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 1906a8a55ad..d28882ac448 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 ); } -- 2.30.2