summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index c7eb3f63e58..c1bd8ec3a0d 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -705,9 +705,13 @@ svga_create_query(struct pipe_context *pipe,
}
break;
case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
- define_query_vgpu10(svga, sq, sizeof(SVGADXOcclusionPredicateQueryResult));
+ if (svga_have_vgpu10(svga)) {
+ sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
+ define_query_vgpu10(svga, sq, sizeof(SVGADXOcclusionPredicateQueryResult));
+ } else {
+ sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSION;
+ define_query_vgpu9(svga, sq);
+ }
break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
@@ -777,6 +781,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
if (svga_have_vgpu10(svga)) {
/* make sure to also destroy any associated predicate query */
if (sq->predicate)
@@ -787,11 +792,6 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
}
sws->fence_reference(sws, &sq->fence, NULL);
break;
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- destroy_query_vgpu10(svga, sq);
- sws->fence_reference(sws, &sq->fence, NULL);
- break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -854,6 +854,7 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
if (svga_have_vgpu10(svga)) {
ret = begin_query_vgpu10(svga, sq);
/* also need to start the associated occlusion predicate query */
@@ -869,11 +870,6 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)
assert(ret == PIPE_OK);
(void) ret;
break;
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- ret = begin_query_vgpu10(svga, sq);
- assert(ret == PIPE_OK);
- break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -967,6 +963,7 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
if (svga_have_vgpu10(svga)) {
ret = end_query_vgpu10(svga, sq);
/* also need to end the associated occlusion predicate query */
@@ -987,11 +984,6 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
*/
svga_context_flush(svga, NULL);
break;
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- ret = end_query_vgpu10(svga, sq);
- assert(ret == PIPE_OK);
- break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -1090,11 +1082,16 @@ svga_get_query_result(struct pipe_context *pipe,
}
break;
case PIPE_QUERY_OCCLUSION_PREDICATE: {
- SVGADXOcclusionPredicateQueryResult occResult;
- assert(svga_have_vgpu10(svga));
- ret = get_query_result_vgpu10(svga, sq, wait,
- (void *)&occResult, sizeof(occResult));
- vresult->b = occResult.anySamplesRendered != 0;
+ if (svga_have_vgpu10(svga)) {
+ SVGADXOcclusionPredicateQueryResult occResult;
+ ret = get_query_result_vgpu10(svga, sq, wait,
+ (void *)&occResult, sizeof(occResult));
+ vresult->b = occResult.anySamplesRendered != 0;
+ } else {
+ uint64_t count;
+ ret = get_query_result_vgpu9(svga, sq, wait, (uint64_t *)&count);
+ vresult->b = count != 0;
+ }
break;
}
case PIPE_QUERY_SO_STATISTICS: {