vrend: make sure queries are fenced

Check queries from within vrend_renderer_check_fences, after
glClientWaitSync but before write_fence.  This makes sure query
results are available after the fence is waited for.

In other words, given this sequence of commands

  BEGIN_QUERY > DRAW_VBO > END_QUERY > GET_QUERY_RESULT > FENCE

Waiting on the fence makes sure the query result becomes available
to the guest.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 6 years ago committed by Gurchetan Singh
parent 010c974bd4
commit 6628658027
  1. 1
      src/virglrenderer.c
  2. 10
      src/vrend_renderer.c
  3. 1
      src/vrend_renderer.h

@ -299,7 +299,6 @@ void *virgl_renderer_get_cursor_data(uint32_t resource_id, uint32_t *width, uint
void virgl_renderer_poll(void) void virgl_renderer_poll(void)
{ {
vrend_renderer_check_queries();
vrend_renderer_check_fences(); vrend_renderer_check_fences();
} }

@ -7995,6 +7995,8 @@ static void flush_eventfd(int fd)
} while ((len == -1 && errno == EINTR) || len == sizeof(value)); } while ((len == -1 && errno == EINTR) || len == sizeof(value));
} }
static void vrend_renderer_check_queries(void);
void vrend_renderer_check_fences(void) void vrend_renderer_check_fences(void)
{ {
struct vrend_fence *fence, *stor; struct vrend_fence *fence, *stor;
@ -8031,6 +8033,9 @@ void vrend_renderer_check_fences(void)
if (latest_id == 0) if (latest_id == 0)
return; return;
vrend_renderer_check_queries();
vrend_clicbs->write_fence(latest_id); vrend_clicbs->write_fence(latest_id);
} }
@ -8071,13 +8076,10 @@ static bool vrend_check_query(struct vrend_query *query)
return true; return true;
} }
void vrend_renderer_check_queries(void) static void vrend_renderer_check_queries(void)
{ {
struct vrend_query *query, *stor; struct vrend_query *query, *stor;
if (!vrend_state.inited)
return;
LIST_FOR_EACH_ENTRY_SAFE(query, stor, &vrend_state.waiting_query_list, waiting_queries) { LIST_FOR_EACH_ENTRY_SAFE(query, stor, &vrend_state.waiting_query_list, waiting_queries) {
vrend_hw_switch_context(vrend_lookup_renderer_ctx(query->ctx_id), true); vrend_hw_switch_context(vrend_lookup_renderer_ctx(query->ctx_id), true);
if (vrend_check_query(query)) if (vrend_check_query(query))

@ -316,7 +316,6 @@ struct vrend_context *vrend_lookup_renderer_ctx(uint32_t ctx_id);
int vrend_renderer_create_fence(int client_fence_id, uint32_t ctx_id); int vrend_renderer_create_fence(int client_fence_id, uint32_t ctx_id);
void vrend_renderer_check_fences(void); void vrend_renderer_check_fences(void);
void vrend_renderer_check_queries(void);
bool vrend_hw_switch_context(struct vrend_context *ctx, bool now); bool vrend_hw_switch_context(struct vrend_context *ctx, bool now);
uint32_t vrend_renderer_object_insert(struct vrend_context *ctx, void *data, uint32_t vrend_renderer_object_insert(struct vrend_context *ctx, void *data,

Loading…
Cancel
Save