From 8467047f6dab7427fa9bb8ce6a3e2ad130915e45 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Dec 2021 14:14:45 +1000 Subject: [PATCH] mesa/st: move memory query into mesa. Drop the gl_memory_info type as it's equiv to the pipe one, and internal Reviewed-by: Kristian H. Kristensen Part-of: --- src/mesa/main/get.c | 6 ++++-- src/mesa/main/mtypes.h | 13 ------------- src/mesa/state_tracker/st_context.c | 21 --------------------- src/mesa/state_tracker/st_context.h | 2 -- 4 files changed, 4 insertions(+), 38 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 97b12291031..20258101e74 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1247,9 +1247,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX: case GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX: { - struct gl_memory_info info; + struct pipe_memory_info info; + struct pipe_screen *screen = ctx->pipe->screen; - st_query_memory_info(ctx, &info); + assert(screen->query_memory_info); + screen->query_memory_info(screen, &info); if (d->pname == GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX) v->value_int = info.total_device_memory; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2b27a56863e..17914a5ade8 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3586,19 +3586,6 @@ struct gl_context bool shader_builtin_ref; }; -/** - * Information about memory usage. All sizes are in kilobytes. - */ -struct gl_memory_info -{ - unsigned total_device_memory; /**< size of device memory, e.g. VRAM */ - unsigned avail_device_memory; /**< free device memory at the moment */ - unsigned total_staging_memory; /**< size of staging memory, e.g. GART */ - unsigned avail_staging_memory; /**< free staging memory at the moment */ - unsigned device_memory_evicted; /**< size of memory evicted (monotonic counter) */ - unsigned nr_device_memory_evictions; /**< # of evictions (monotonic counter) */ -}; - #ifndef NDEBUG extern int MESA_VERBOSE; extern int MESA_DEBUG_FLAGS; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 426667133ac..877852d2f87 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -71,27 +71,6 @@ DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE) -void -st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out) -{ - struct pipe_screen *screen = st_context(ctx)->screen; - struct pipe_memory_info info; - - assert(screen->query_memory_info); - if (!screen->query_memory_info) - return; - - screen->query_memory_info(screen, &info); - - out->total_device_memory = info.total_device_memory; - out->avail_device_memory = info.avail_device_memory; - out->total_staging_memory = info.total_staging_memory; - out->avail_staging_memory = info.avail_staging_memory; - out->device_memory_evicted = info.device_memory_evicted; - out->nr_device_memory_evictions = info.nr_device_memory_evictions; -} - - static uint64_t st_get_active_states(struct gl_context *ctx) { diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index fbbd1bc54ae..91bdc49f4f2 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -450,8 +450,6 @@ struct st_framebuffer struct list_head head; }; -void st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out); - void st_invalidate_state(struct gl_context *ctx); void st_set_background_context(struct gl_context *ctx, struct util_queue_monitoring *queue_info);