[Mesa-dev] [PATCH 4/5] st/mesa: implement and enable memory info extensions (v2)
Ilia Mirkin
imirkin at alum.mit.edu
Thu Feb 4 20:47:48 UTC 2016
Patches 1-4 are
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
On Thu, Feb 4, 2016 at 3:42 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> v2: assert and return if query_memory_info is not set
> rebase
> ---
> src/mesa/state_tracker/st_context.c | 25 +++++++++++++++++++++++++
> src/mesa/state_tracker/st_extensions.c | 2 ++
> 2 files changed, 27 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
> index 6c50a31..446ebfb 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;
> }
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index d066784..f4b2e77 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -526,12 +526,14 @@ void st_init_extensions(struct pipe_screen *screen,
> { o(EXT_transform_feedback), PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS },
>
> { o(AMD_pinned_memory), PIPE_CAP_RESOURCE_FROM_USER_MEMORY },
> + { o(ATI_meminfo), PIPE_CAP_QUERY_MEMORY_INFO },
> { o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE },
> { o(ATI_separate_stencil), PIPE_CAP_TWO_SIDED_STENCIL },
> { o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP },
> { o(NV_conditional_render), PIPE_CAP_CONDITIONAL_RENDER },
> { o(NV_primitive_restart), PIPE_CAP_PRIMITIVE_RESTART },
> { o(NV_texture_barrier), PIPE_CAP_TEXTURE_BARRIER },
> + { o(NVX_gpu_memory_info), PIPE_CAP_QUERY_MEMORY_INFO },
> /* GL_NV_point_sprite is not supported by gallium because we don't
> * support the GL_POINT_SPRITE_R_MODE_NV option. */
>
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list