zink: use copy context to eliminate dependency on EXT_calibrated_timestamps
this is unsupported by a surprising number of drivers Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16529>
This commit is contained in:
parent
9d30d82a9a
commit
0befc259a6
|
@ -1298,12 +1298,24 @@ zink_get_timestamp(struct pipe_context *pctx)
|
|||
{
|
||||
struct zink_screen *screen = zink_screen(pctx->screen);
|
||||
uint64_t timestamp, deviation;
|
||||
assert(screen->info.have_EXT_calibrated_timestamps);
|
||||
VkCalibratedTimestampInfoEXT cti = {0};
|
||||
cti.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT;
|
||||
cti.timeDomain = VK_TIME_DOMAIN_DEVICE_EXT;
|
||||
if (VKSCR(GetCalibratedTimestampsEXT)(screen->dev, 1, &cti, ×tamp, &deviation) != VK_SUCCESS) {
|
||||
mesa_loge("ZINK: vkGetCalibratedTimestampsEXT failed");
|
||||
if (screen->info.have_EXT_calibrated_timestamps) {
|
||||
VkCalibratedTimestampInfoEXT cti = {0};
|
||||
cti.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT;
|
||||
cti.timeDomain = VK_TIME_DOMAIN_DEVICE_EXT;
|
||||
if (VKSCR(GetCalibratedTimestampsEXT)(screen->dev, 1, &cti, ×tamp, &deviation) != VK_SUCCESS) {
|
||||
mesa_loge("ZINK: vkGetCalibratedTimestampsEXT failed");
|
||||
}
|
||||
} else {
|
||||
pctx = &screen->copy_context->base;
|
||||
struct pipe_query *pquery = pctx->create_query(pctx, PIPE_QUERY_TIMESTAMP, 0);
|
||||
if (!pquery)
|
||||
return 0;
|
||||
union pipe_query_result result = {0};
|
||||
pctx->begin_query(pctx, pquery);
|
||||
pctx->end_query(pctx, pquery);
|
||||
pctx->get_query_result(pctx, pquery, true, &result);
|
||||
pctx->destroy_query(pctx, pquery);
|
||||
timestamp = result.u64;
|
||||
}
|
||||
timestamp_to_nanoseconds(screen, ×tamp);
|
||||
return timestamp;
|
||||
|
|
|
@ -593,8 +593,7 @@ zink_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||
return screen->info.props.limits.minUniformBufferOffsetAlignment;
|
||||
|
||||
case PIPE_CAP_QUERY_TIMESTAMP:
|
||||
return screen->info.have_EXT_calibrated_timestamps &&
|
||||
screen->timestamp_valid_bits > 0;
|
||||
return screen->timestamp_valid_bits > 0;
|
||||
|
||||
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
|
||||
return 1 << MIN_SLAB_ORDER;
|
||||
|
|
Loading…
Reference in New Issue