gallium: Add PIPE_CAP_QUERY_TIMESTAMP_BITS

For those drivers that don't make full use of the 64 bits in
pipe_query_result.u64.

Applications will make use of it via GL_QUERY_COUNTER_BITS to handle
when the value rolls over.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10770>
This commit is contained in:
Tomeu Vizoso
2021-05-12 16:07:37 +02:00
parent ca330f7f04
commit 79b92af9da
6 changed files with 15 additions and 0 deletions
+2
View File
@@ -153,6 +153,8 @@ The integer capabilities:
pipe_draw_info::start_instance.
* ``PIPE_CAP_QUERY_TIMESTAMP``: Whether PIPE_QUERY_TIMESTAMP and
the pipe_screen::get_timestamp hook are implemented.
* ``PIPE_CAP_QUERY_TIMESTAMP_BITS``: How many bits the driver uses for the
results of GL_TIMESTAMP queries.
* ``PIPE_CAP_TEXTURE_MULTISAMPLE``: Whether all MSAA resources supported
for rendering are also supported for texturing.
* ``PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT``: The minimum alignment that should be
+3
View File
@@ -515,6 +515,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
}
case PIPE_CAP_QUERY_TIMESTAMP_BITS:
return 64;
default:
unreachable("bad PIPE_CAP_*");
}
+3
View File
@@ -407,6 +407,9 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
*/
return devinfo->ver >= 11;
case PIPE_CAP_QUERY_TIMESTAMP_BITS:
return TIMESTAMP_BITS;
default:
return u_pipe_screen_get_param_defaults(pscreen, param);
}
+3
View File
@@ -676,6 +676,9 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_QUERY_TIMESTAMP:
return screen->timestamp_valid_bits > 0;
case PIPE_CAP_QUERY_TIMESTAMP_BITS:
return screen->timestamp_valid_bits;
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
return 1 << MIN_SLAB_ORDER;
+1
View File
@@ -1001,6 +1001,7 @@ enum pipe_cap
PIPE_CAP_DITHERING,
PIPE_CAP_FBFETCH_ZS,
PIPE_CAP_TIMELINE_SEMAPHORE_IMPORT,
PIPE_CAP_QUERY_TIMESTAMP_BITS,
PIPE_CAP_LAST,
/* XXX do not add caps after PIPE_CAP_LAST! */
+3
View File
@@ -559,6 +559,9 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
PIPE_TEXTURE_2D, 0, 0,
PIPE_BIND_SAMPLER_VIEW);
ctx->Const.QueryCounterBits.Timestamp =
screen->get_param(screen, PIPE_CAP_QUERY_TIMESTAMP_BITS);
st->has_stencil_export =
screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
st->has_etc1 = screen->is_format_supported(screen, PIPE_FORMAT_ETC1_RGB8,