/** Non-GPU queries for gallium HUD */
#define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0)
#define SVGA_QUERY_FALLBACKS (PIPE_QUERY_DRIVER_SPECIFIC + 1)
+#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 2)
struct draw_vertex_shader;
break;
case SVGA_QUERY_DRAW_CALLS:
case SVGA_QUERY_FALLBACKS:
+ case SVGA_QUERY_MEMORY_USED:
break;
default:
assert(!"unexpected query type in svga_create_query()");
break;
case SVGA_QUERY_DRAW_CALLS:
case SVGA_QUERY_FALLBACKS:
+ case SVGA_QUERY_MEMORY_USED:
/* nothing */
break;
default:
case SVGA_QUERY_FALLBACKS:
sq->begin_count = svga->num_fallbacks;
break;
+ case SVGA_QUERY_MEMORY_USED:
+ /* nothing */
+ break;
default:
assert(!"unexpected query type in svga_begin_query()");
}
case SVGA_QUERY_FALLBACKS:
sq->end_count = svga->num_fallbacks;
break;
+ case SVGA_QUERY_MEMORY_USED:
+ /* nothing */
+ break;
default:
assert(!"unexpected query type in svga_end_query()");
}
case SVGA_QUERY_FALLBACKS:
vresult->u64 = sq->end_count - sq->begin_count;
break;
+ case SVGA_QUERY_MEMORY_USED:
+ vresult->u64 = svgascreen->total_resource_bytes;
+ break;
default:
assert(!"unexpected query type in svga_get_query_result");
}
#include "os/os_thread.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_resource.h"
#include "svga_context.h"
#include "svga_screen.h"
if(sbuf->swbuf && !sbuf->user)
align_free(sbuf->swbuf);
+ ss->total_resource_bytes -= sbuf->size;
+
FREE(sbuf);
}
debug_reference(&sbuf->b.b.reference,
(debug_reference_descriptor)debug_describe_resource, 0);
+ sbuf->size = util_resource_size(template);
+ ss->total_resource_bytes += sbuf->size;
+
return &sbuf->b.b;
error2:
* a context. It is only valid if the dma.pending is set above.
*/
struct list_head head;
+
+ unsigned size; /**< Approximate size in bytes */
};
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_resource.h"
#include "svga_format.h"
#include "svga_screen.h"
SVGA_DBG(DEBUG_DMA, "unref sid %p (texture)\n", tex->handle);
svga_screen_surface_destroy(ss, &tex->key, &tex->handle);
+ ss->total_resource_bytes -= tex->size;
+
FREE(tex);
}
debug_reference(&tex->b.b.reference,
(debug_reference_descriptor)debug_describe_resource, 0);
+ tex->size = util_resource_size(template);
+ svgascreen->total_resource_bytes += tex->size;
+
return &tex->b.b;
error2:
* to this texture and never destroy this handle directly.
*/
struct svga_winsys_surface *handle;
+
+ unsigned size; /**< Approximate size in bytes */
};
{
static const struct pipe_driver_query_info queries[] = {
{"draw-calls", SVGA_QUERY_DRAW_CALLS, 0, FALSE},
- {"fallbacks", SVGA_QUERY_FALLBACKS, 0, FALSE}
+ {"fallbacks", SVGA_QUERY_FALLBACKS, 0, FALSE},
+ {"memory-used", SVGA_QUERY_MEMORY_USED, 0, TRUE}
};
if (!info)
} depth;
struct svga_host_surface_cache cache;
+
+ /** Memory used by all resources (buffers and surfaces) */
+ uint64_t total_resource_bytes;
};
#ifndef DEBUG