gallium: fix PIPE_QUERY_TIMESTAMP_DISJOINT

The semantics didn't really make sense, not really matching neither d3d9
(though the docs are all broken there) nor d3d10. So make it match d3d10
semantics, which actually gives meaning to the "disjoint" part.
Drivers are fixed up in a very primitive way, I have no idea what could
actually cause the counter to become unreliable so just always return
FALSE for the disjoint part.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Roland Scheidegger 2013-06-19 23:25:39 +02:00
parent a0a40805dd
commit cdf89d0b5c
3 changed files with 12 additions and 12 deletions

View File

@ -330,11 +330,13 @@ scaled to nanoseconds, recorded after all commands issued prior to
This query does not require a call to ``begin_query``.
The result is an unsigned 64-bit integer.
``PIPE_QUERY_TIMESTAMP_DISJOINT`` can be used to check whether the
internal timer resolution is good enough to distinguish between the
events at ``begin_query`` and ``end_query``.
``PIPE_QUERY_TIMESTAMP_DISJOINT`` can be used to check the
internal timer resolution and whether the timestamp counter has become
unreliable due to things like throttling etc. - only if this is FALSE
a timestamp query (within the timestamp_disjoint query) should be trusted.
The result is a 64-bit integer specifying the timer resolution in Hz,
followed by a boolean value indicating whether the timer has incremented.
followed by a boolean value indicating whether the timestamp counter
is discontinuous or disjoint.
``PIPE_QUERY_PRIMITIVES_GENERATED`` returns a 64-bit integer indicating
the number of primitives processed by the pipeline (regardless of whether

View File

@ -181,7 +181,6 @@ nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
nv50_query_get(push, q, 0x20, 0x05805002);
nv50_query_get(push, q, 0x30, 0x06805002);
break;
case PIPE_QUERY_TIMESTAMP_DISJOINT:
case PIPE_QUERY_TIME_ELAPSED:
nv50_query_get(push, q, 0x10, 0x00005002);
break;
@ -218,7 +217,6 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
case PIPE_QUERY_TIMESTAMP:
q->sequence++;
/* fall through */
case PIPE_QUERY_TIMESTAMP_DISJOINT:
case PIPE_QUERY_TIME_ELAPSED:
nv50_query_get(push, q, 0, 0x00005002);
break;
@ -229,6 +227,8 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
case NVA0_QUERY_STREAM_OUTPUT_BUFFER_OFFSET:
nv50_query_get(push, q, 0, 0x0d005002 | (q->index << 5));
break;
case PIPE_QUERY_TIMESTAMP_DISJOINT:
break;
default:
assert(0);
break;
@ -287,9 +287,9 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq,
case PIPE_QUERY_TIMESTAMP:
res64[0] = data64[1];
break;
case PIPE_QUERY_TIMESTAMP_DISJOINT: /* u32 sequence, u32 0, u64 time */
case PIPE_QUERY_TIMESTAMP_DISJOINT:
res64[0] = 1000000000;
res8[8] = (data64[1] == data64[3]) ? FALSE : TRUE;
res8[8] = FALSE;
break;
case PIPE_QUERY_TIME_ELAPSED:
res64[0] = data64[1] - data64[3];

View File

@ -285,7 +285,6 @@ nvc0_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
nvc0_query_get(push, q, 0x10, 0x03005002 | (q->index << 5));
break;
case PIPE_QUERY_TIMESTAMP_DISJOINT:
case PIPE_QUERY_TIME_ELAPSED:
nvc0_query_get(push, q, 0x10, 0x00005002);
break;
@ -360,7 +359,6 @@ nvc0_query_end(struct pipe_context *pipe, struct pipe_query *pq)
nvc0_query_get(push, q, 0x20, 0x00005002);
break;
case PIPE_QUERY_TIMESTAMP:
case PIPE_QUERY_TIMESTAMP_DISJOINT:
case PIPE_QUERY_TIME_ELAPSED:
nvc0_query_get(push, q, 0, 0x00005002);
break;
@ -476,9 +474,9 @@ nvc0_query_result(struct pipe_context *pipe, struct pipe_query *pq,
case PIPE_QUERY_TIMESTAMP:
res64[0] = data64[1];
break;
case PIPE_QUERY_TIMESTAMP_DISJOINT: /* u32 sequence, u32 0, u64 time */
case PIPE_QUERY_TIMESTAMP_DISJOINT:
res64[0] = 1000000000;
res8[8] = (data64[1] == data64[3]) ? FALSE : TRUE;
res8[8] = FALSE;
break;
case PIPE_QUERY_TIME_ELAPSED:
res64[0] = data64[1] - data64[3];