virgl: Add support for querying detailed memory info

This allows for virgl guests to expose GL_NVX_gpu_memory_info and
GL_ATI_meminfo when the extensions are supported on the host.

Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9337>
This commit is contained in:
Rohan Garg
2021-02-25 18:13:22 +01:00
parent 1e53e0d2c7
commit c6eb84ff30
5 changed files with 63 additions and 0 deletions
+1
View File
@@ -440,6 +440,7 @@ enum virgl_formats {
#define VIRGL_CAP_V2_BLEND_EQUATION (1 << 0)
#define VIRGL_CAP_V2_UNTYPED_RESOURCE (1 << 1)
#define VIRGL_CAP_V2_VIDEO_MEMORY (1 << 2)
#define VIRGL_CAP_V2_MEMINFO (1 << 3)
/* virgl bind flags - these are compatible with mesa 10.5 gallium.
* but are fixed, no other should be passed to virgl either.
+11
View File
@@ -35,6 +35,16 @@ struct virgl_host_query_state {
uint64_t result;
};
struct virgl_memory_info
{
uint32_t total_device_memory; /**< size of device memory, e.g. VRAM */
uint32_t avail_device_memory; /**< free device memory at the moment */
uint32_t total_staging_memory; /**< size of staging memory, e.g. GART */
uint32_t avail_staging_memory; /**< free staging memory at the moment */
uint32_t device_memory_evicted; /**< size of memory evicted (monotonic counter) */
uint32_t nr_device_memory_evictions; /**< # of evictions (monotonic counter) */
};
enum virgl_object_type {
VIRGL_OBJECT_NULL,
VIRGL_OBJECT_BLEND,
@@ -103,6 +113,7 @@ enum virgl_context_cmd {
VIRGL_CCMD_CLEAR_TEXTURE,
VIRGL_CCMD_PIPE_RESOURCE_CREATE,
VIRGL_CCMD_PIPE_RESOURCE_SET_TYPE,
VIRGL_CCMD_GET_MEMORY_INFO,
VIRGL_MAX_COMMANDS
};