svga: fix vgpu10 query fencing

We don't want to flush the command buffer or sync on the fence when ending
a query (that kind of defeats the whole purpose of async queries).  Do that
instead in get_query_result().

Tested with Piglit, arbocclude, Sauerbraten game, Nobel Clinician Viewer,
ETQW.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
This commit is contained in:
Brian Paul 2016-08-18 10:15:46 -06:00
parent 3f51a3f6ac
commit 99d8fe20ab

View file

@ -610,7 +610,6 @@ begin_query_vgpu10(struct svga_context *svga, struct svga_query *sq)
static enum pipe_error
end_query_vgpu10(struct svga_context *svga, struct svga_query *sq)
{
struct svga_winsys_screen *sws = svga_screen(svga->pipe.screen)->sws;
enum pipe_error ret = PIPE_OK;
if (svga->rebind.flags.query) {
@ -623,15 +622,6 @@ end_query_vgpu10(struct svga_context *svga, struct svga_query *sq)
ret = SVGA3D_vgpu10_EndQuery(svga->swc, sq->id);
}
/* Finish fence is copied here from get_query_result_vgpu10. This helps
* with cases where svga_begin_query might be called again before
* svga_get_query_result, such as GL_TIME_ELAPSED.
*/
if (!sq->fence) {
svga_context_flush(svga, &sq->fence);
}
sws->fence_finish(sws, sq->fence, SVGA_FENCE_FLAG_QUERY);
return ret;
}
@ -648,7 +638,17 @@ get_query_result_vgpu10(struct svga_context *svga, struct svga_query *sq,
sws->query_get_result(sws, sq->gb_query, sq->offset, &queryState, result, resultLen);
if (queryState == SVGA3D_QUERYSTATE_PENDING) {
if (queryState == SVGA3D_QUERYSTATE_NEW && !sq->fence) {
/* The query hasn't been submitted yet. We need to submit it now
* since the GL spec says "Querying the state for a given occlusion
* query forces that occlusion query to complete within a finite amount
* of time."
*/
svga_context_flush(svga, &sq->fence);
}
if (queryState == SVGA3D_QUERYSTATE_PENDING ||
queryState == SVGA3D_QUERYSTATE_NEW) {
if (!wait)
return FALSE;
sws->fence_finish(sws, sq->fence, SVGA_FENCE_FLAG_QUERY);