[Mesa-dev] [PATCH 12/18] mesa: remove unused _mesa_total_buffer_object_memory()

Brian Paul brianp at vmware.com
Thu May 4 16:00:28 UTC 2017


On 05/04/2017 01:41 AM, Timothy Arceri wrote:
> ---
>   src/mesa/main/bufferobj.c | 31 -------------------------------
>   src/mesa/main/bufferobj.h |  3 ---
>   2 files changed, 34 deletions(-)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 6161271..2944dce 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -550,51 +550,20 @@ _mesa_initialize_buffer_object(struct gl_context *ctx,
>      mtx_init(&obj->Mutex, mtx_plain);
>      obj->RefCount = 1;
>      obj->Name = name;
>      obj->Usage = GL_STATIC_DRAW_ARB;
>
>      if (get_no_minmax_cache())
>         obj->UsageHistory |= USAGE_DISABLE_MINMAX_CACHE;
>   }
>
>
> -
> -/**
> - * Callback called from _mesa_HashWalk()
> - */
> -static void
> -count_buffer_size(GLuint key, void *data, void *userData)
> -{
> -   const struct gl_buffer_object *bufObj =
> -      (const struct gl_buffer_object *) data;
> -   GLuint *total = (GLuint *) userData;
> -
> -   (void) key;
> -   *total = *total + bufObj->Size;
> -}
> -
> -
> -/**
> - * Compute total size (in bytes) of all buffer objects for the given context.
> - * For debugging purposes.
> - */
> -GLuint
> -_mesa_total_buffer_object_memory(struct gl_context *ctx)
> -{
> -   GLuint total = 0;
> -
> -   _mesa_HashWalk(ctx->Shared->BufferObjects, count_buffer_size, &total);
> -
> -   return total;
> -}
> -
> -
>   /**
>    * Allocate space for and store data in a buffer object.  Any data that was
>    * previously stored in the buffer object is lost.  If \c data is \c NULL,
>    * memory will be allocated, but no copy will occur.
>    *
>    * This is the default callback for \c dd_function_table::BufferData()
>    * Note that all GL error checking will have been done already.
>    *
>    * \param ctx     GL context.
>    * \param target  Buffer object target on which to operate.
> diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
> index 93a360d..606582e 100644
> --- a/src/mesa/main/bufferobj.h
> +++ b/src/mesa/main/bufferobj.h
> @@ -119,23 +119,20 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
>
>   static inline void
>   _mesa_reference_buffer_object(struct gl_context *ctx,
>                                 struct gl_buffer_object **ptr,
>                                 struct gl_buffer_object *bufObj)
>   {
>      if (*ptr != bufObj)
>         _mesa_reference_buffer_object_(ctx, ptr, bufObj);
>   }
>
> -extern GLuint
> -_mesa_total_buffer_object_memory(struct gl_context *ctx);
> -
>   extern void
>   _mesa_init_buffer_object_functions(struct dd_function_table *driver);
>
>   extern void
>   _mesa_buffer_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
>                     GLenum target, GLsizeiptr size, const GLvoid *data,
>                     GLenum usage, const char *func);
>
>   extern void
>   _mesa_buffer_sub_data(struct gl_context *ctx, struct gl_buffer_object *bufObj,
>

I've used this a few times in the past to help debug apps using lots of 
memory.  If it's all the same to you, I'd like to keep it.

-Brian



More information about the mesa-dev mailing list