summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_context.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-02-02 01:27:55 +0100
committerMarek Olšák <[email protected]>2016-02-05 17:31:53 +0100
commit5f51a24a77515ff10326c46c8e698ace44344c18 (patch)
tree65946604c971a407741c64b38812384105683960 /src/mesa/state_tracker/st_context.c
parent837f74aa511321c87bee768e463a0248d689c55d (diff)
st/mesa: implement and enable memory info extensions (v2)
v2: assert and return if query_memory_info is not set rebase Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r--src/mesa/state_tracker/st_context.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 6c50a31dbd2..446ebfb563f 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -97,6 +97,30 @@ static void st_Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
/**
+ * Called via ctx->Driver.QueryMemoryInfo()
+ */
+static void
+st_query_memory_info(struct gl_context *ctx, struct gl_memory_info *out)
+{
+ struct pipe_screen *screen = st_context(ctx)->pipe->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;
+}
+
+
+/**
* Called via ctx->Driver.UpdateState()
*/
void st_invalidate_state(struct gl_context * ctx, GLbitfield new_state)
@@ -491,4 +515,5 @@ void st_init_driver_functions(struct pipe_screen *screen,
functions->Enable = st_Enable;
functions->UpdateState = st_invalidate_state;
+ functions->QueryMemoryInfo = st_query_memory_info;
}