virgl: Flush context before waiting on fences
The logic behind this change is intuitive: if we are waiting for something, we should probably flush all pending rendering so that it starts executing in the meantime. This prevents the GPU from sitting idle for long periods of time while we are also blocked in the app. With the gun3d trace: Before: 79 fps After: 215 fps Reviewed-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13096>
This commit is contained in:
committed by
Marge Bot
parent
7c22ece8e4
commit
dd5bf189ef
@@ -936,8 +936,8 @@ static void virgl_submit_cmd(struct virgl_winsys *vws,
|
||||
}
|
||||
}
|
||||
|
||||
static void virgl_flush_eq(struct virgl_context *ctx, void *closure,
|
||||
struct pipe_fence_handle **fence)
|
||||
void virgl_flush_eq(struct virgl_context *ctx, void *closure,
|
||||
struct pipe_fence_handle **fence)
|
||||
{
|
||||
struct virgl_screen *rs = virgl_screen(ctx->base.screen);
|
||||
|
||||
|
||||
@@ -138,4 +138,6 @@ void
|
||||
virgl_rebind_resource(struct virgl_context *vctx,
|
||||
struct pipe_resource *res);
|
||||
|
||||
void virgl_flush_eq(struct virgl_context *ctx, void *closure,
|
||||
struct pipe_fence_handle **fence);
|
||||
#endif
|
||||
|
||||
@@ -802,6 +802,10 @@ static bool virgl_fence_finish(struct pipe_screen *screen,
|
||||
{
|
||||
struct virgl_screen *vscreen = virgl_screen(screen);
|
||||
struct virgl_winsys *vws = vscreen->vws;
|
||||
struct virgl_context *vctx = virgl_context(ctx);
|
||||
|
||||
if (vctx && timeout)
|
||||
virgl_flush_eq(vctx, NULL, NULL);
|
||||
|
||||
return vws->fence_wait(vws, fence, timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user