anv: disable VK_EXT_calibrated_timestamps when the timestamp register is unreadable

When running in a virtual context, the timestamp register is unreadable
on Gen12+.
While we could work around this, that would result in very inaccurate
results for an extension where the whole point is accuracy, so let's
just disable the extension.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2797>
This commit is contained in:
Eric Engestrom 2019-05-15 11:30:36 +01:00 committed by Marge Bot
parent a62ee262fd
commit f68db81cbb
3 changed files with 16 additions and 3 deletions

View File

@ -66,6 +66,9 @@ DRI_CONF_END;
*/
#define MAX_DEBUG_MESSAGE_LENGTH 4096
/* Render engine timestamp register */
#define TIMESTAMP 0x2358
static void
compiler_debug_log(void *data, const char *fmt, ...)
{
@ -472,6 +475,11 @@ anv_physical_device_try_create(struct anv_instance *instance,
device->has_implicit_ccs = device->info.has_aux_map;
/* Check if we can read the GPU timestamp register from the CPU */
uint64_t u64_ignore;
device->has_reg_timestamp = anv_gem_reg_read(fd, TIMESTAMP | I915_REG_READ_8B_WA,
&u64_ignore) == 0;
device->has_mem_available = get_available_system_memory() != 0;
device->always_flush_cache =
@ -4427,8 +4435,6 @@ anv_clock_gettime(clockid_t clock_id)
return (uint64_t) current.tv_sec * 1000000000ULL + current.tv_nsec;
}
#define TIMESTAMP 0x2358
VkResult anv_GetCalibratedTimestampsEXT(
VkDevice _device,
uint32_t timestampCount,

View File

@ -117,7 +117,7 @@ EXTENSIONS = [
Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'),
Extension('VK_EXT_acquire_xlib_display', 1, 'VK_USE_PLATFORM_XLIB_XRANDR_EXT'),
Extension('VK_EXT_buffer_device_address', 1, 'device->has_a64_buffer_access'),
Extension('VK_EXT_calibrated_timestamps', 1, True),
Extension('VK_EXT_calibrated_timestamps', 1, 'device->has_reg_timestamp'),
Extension('VK_EXT_conditional_rendering', 1, 'device->info.gen >= 8 || device->info.is_haswell'),
Extension('VK_EXT_custom_border_color', 12, 'device->info.gen >= 8'),
Extension('VK_EXT_debug_report', 8, True),

View File

@ -1092,6 +1092,13 @@ struct anv_physical_device {
/** True if we can use bindless access for samplers */
bool has_bindless_samplers;
/** True if we can read the GPU timestamp register
*
* When running in a virtual context, the timestamp register is unreadable
* on Gen12+.
*/
bool has_reg_timestamp;
/** True if this device has implicit AUX
*
* If true, CCS is handled as an implicit attachment to the BO rather than