From b460d4da60718a937796a0ad96bd539b8ba77e84 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Marchesin?= Date: Wed, 14 Apr 2021 08:05:24 +0200 Subject: [PATCH] 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 Part-of: --- src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 76e1225..6ff94ce 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -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, -- 2.7.4