virgl: resources without any binding can be cached

Certain games create and destroy lots of resources without binding them.
This can take quite a bit of time and even create unneeded
synchronization. However, we know that if a resource was never bound to
anything, it can be cached. This change does that.

Counting the number of uncached allocation with a tabletop simulator trace:
Before: 2967 uncached allocations over the replay
After: 24 uncached allocations over the replay

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10225>
This commit is contained in:
Stéphane Marchesin
2021-04-14 08:05:24 +02:00
committed by Marge Bot
parent 7886983835
commit b460d4da60

View File

@@ -63,7 +63,8 @@ static inline boolean can_cache_resource(uint32_t bind)
bind == VIRGL_BIND_VERTEX_BUFFER ||
bind == VIRGL_BIND_CUSTOM ||
bind == VIRGL_BIND_STAGING ||
bind == VIRGL_BIND_DEPTH_STENCIL;
bind == VIRGL_BIND_DEPTH_STENCIL ||
bind == 0;
}
static void virgl_hw_res_destroy(struct virgl_drm_winsys *qdws,