vrend: handle queries more defensively

Handle these two command sequences,

  VIRGL_CCMD_BEGIN_QUERY
  VIRGL_CCMD_END_QUERY
  VIRGL_CCMD_GET_QUERY_RESULT
  VIRGL_CCMD_GET_QUERY_RESULT

or

  VIRGL_CCMD_BEGIN_QUERY
  VIRGL_CCMD_END_QUERY
  VIRGL_CCMD_GET_QUERY_RESULT
  (before the query result is available)
  VIRGL_CCMD_BEGIN_QUERY
  VIRGL_CCMD_END_QUERY
  VIRGL_CCMD_GET_QUERY_RESULT

more carefully.

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 85d3f36323
commit 010c974bd4
  1. 7
      src/vrend_renderer.c

@ -8232,6 +8232,8 @@ int vrend_begin_query(struct vrend_context *ctx, uint32_t handle)
if (q->index > 0 && !has_feature(feat_transform_feedback3)) if (q->index > 0 && !has_feature(feat_transform_feedback3))
return EINVAL; return EINVAL;
list_delinit(&q->waiting_queries);
if (q->gltype == GL_TIMESTAMP) if (q->gltype == GL_TIMESTAMP)
return 0; return 0;
@ -8282,8 +8284,11 @@ void vrend_get_query_result(struct vrend_context *ctx, uint32_t handle,
return; return;
ret = vrend_check_query(q); ret = vrend_check_query(q);
if (ret == false) if (ret) {
list_delinit(&q->waiting_queries);
} else if (LIST_IS_EMPTY(&q->waiting_queries)) {
list_addtail(&q->waiting_queries, &vrend_state.waiting_query_list); list_addtail(&q->waiting_queries, &vrend_state.waiting_query_list);
}
} }
#define BUFFER_OFFSET(i) ((void *)((char *)NULL + i)) #define BUFFER_OFFSET(i) ((void *)((char *)NULL + i))

Loading…
Cancel
Save