vulkan: Add VK_GOOGLE_display_timing extension (x11+display, anv+radv) [v8]
PATCH 1/1 vulkan: Add VK_GOOGLE_display_timing extension (x11+display, anv+radv) [v8]
This adds support for the VK_GOOGLE_display timing extension, which provides two things:
1) Detailed information about when frames are displayed, including slack time between GPU execution and display frame.
2) Absolute time control over swapchain queue processing. This allows the application to request frames be displayed at specific absolute times, using the same timebase as that provided in vblank events.
Support for this extension has been implemented for the x11 and display backends; adding support to other backends should be reasonable straightforward for one familiar with those systems and should not require any additional device-specific code.
v2:
Adjust GOOGLE_display_timing earliest value. The earliestPresentTime for an image cannot be before the previous image was displayed, or even a frame later (in FIFO mode).
Make GOOGLE_display_timing use render completed time. Switch from VK_PIPELINE_TOP_OF_PIPE_BIT to VK_PIPELINE_STAGE_ALL_COMMANDS_BIT so that the time reported to applications as the end of rendering reflects the latest possible value to ensure that applications don't underestimate the amount of work done in the frame.
v3:
Adopt Jason Ekstrand's coding conventions. Declare variables at first use, eliminate extra whitespace between types and names. Wrap lines to 80 columns.
v4:
Adapt to changes in MESA_query_timestamp extension
v5:
Squash core bits and anv/radv wrappers into a single patch
v6:
Switch from MESA_query_timestamp to EXT_calibrated_timestamps
v7:
Ensure we target frame no earlier than desired. This means rounding the target frame up, rather than selecting the nearest one.
v8:
Re-order display_timing in anv_extensions.py. That code now requires extensions in alphabetical order.
Rename wsi_mark_time to wsi_present_complete to make the functionality clearer.
--- src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_wsi.c | 33 +++ src/intel/vulkan/anv_extensions.py | 1 + src/intel/vulkan/anv_wsi.c | 31 +++ src/vulkan/wsi/wsi_common.c | 301 +++++++++++++++++++++++++++- src/vulkan/wsi/wsi_common.h | 32 +++ src/vulkan/wsi/wsi_common_display.c | 163 ++++++++++++++- src/vulkan/wsi/wsi_common_private.h | 35 ++++ src/vulkan/wsi/wsi_common_x11.c | 71 ++++++- 9 files changed, 656 insertions(+), 12 deletions(-)
src/amd/vulkan/radv_extensions.py +1 -0
@@ -166,6 +166,7 @@ EXTENSIONS = [ Extension('VK_AMD_shader_trinary_minmax', 1, True), Extension('VK_GOOGLE_decorate_string', 1, True), Extension('VK_GOOGLE_hlsl_functionality1', 1, True), + Extension('VK_GOOGLE_display_timing', 1, True), Extension('VK_NV_compute_shader_derivatives', 1, 'device->rad_info.chip_class >= GFX8'), ]
src/amd/vulkan/radv_wsi.c +33 -0
@@ -316,3 +316,36 @@ VkResult radv_GetPhysicalDevicePresentRectanglesKHR( surface, pRectCount, pRects); } + +/* VK_GOOGLE_display_timing */ +VkResult +radv_GetRefreshCycleDurationGOOGLE ( +VkDevice _device, +VkSwapchainKHR swapchain, +VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) +{ +RADV_FROM_HANDLE (radv_device, device, _device); +struct radv_physical_device *pdevice = device->physical_device; + +return wsi_common_get_refresh_cycle_duration (&pdevice->wsi_device, + _device, + swapchain, + pDisplayTimingProperties); +} + +VkResult +radv_GetPastPresentationTimingGOOGLE (VkDevice _device, +VkSwapchainKHR swapchain, +uint32_t *pPresentationTimingCount, +VkPastPresentationTimingGOOGLE + *pPresentationTimings) +{ +RADV_FROM_HANDLE (radv_device, device, _device); +struct radv_physical_device *pdevice = device->physical_device; + +return wsi_common_get_past_presentation_timing (&pdevice->wsi_device, + _device, + swapchain, + pPresentationTimingCount, + pPresentationTimings); +}
src/intel/vulkan/anv_extensions.py +1 -0
@@ -170,6 +170,7 @@ EXTENSIONS = [ Extension('VK_ANDROID_external_memory_android_hardware_buffer', 3, 'ANDROID'), Extension('VK_ANDROID_native_buffer', 7, 'ANDROID'), Extension('VK_GOOGLE_decorate_string', 1, True), + Extension('VK_GOOGLE_display_timing', 1, True), Extension('VK_GOOGLE_hlsl_functionality1', 1, True), Extension('VK_INTEL_performance_query', 1, 'device->perf'), Extension('VK_INTEL_shader_integer_functions2', 1, 'device->info.gen >= 8'),
src/intel/vulkan/anv_wsi.c +31 -0
@@ -329,3 +329,34 @@ VkResult anv_GetPhysicalDevicePresentRectanglesKHR( surface, pRectCount, pRects); } + +/* VK_GOOGLE_display_timing */ +VkResult +anv_GetRefreshCycleDurationGOOGLE (VkDevice _device, +VkSwapchainKHR swapchain, +VkRefreshCycleDurationGOOGLE + *pDisplayTimingProperties) +{ +ANV_FROM_HANDLE (anv_device, device, _device); + +return wsi_common_get_refresh_cycle_duration (&device->physical->wsi_device, + _device, + swapchain, + pDisplayTimingProperties); +} + +VkResult +anv_GetPastPresentationTimingGOOGLE (VkDevice _device, +VkSwapchainKHR swapchain, +uint32_t *pPresentationTimingCount, +VkPastPresentationTimingGOOGLE + *pPresentationTimings) +{ +ANV_FROM_HANDLE (anv_device, device, _device); + +return wsi_common_get_past_presentation_timing (&device->physical->wsi_device, + _device, + swapchain, + pPresentationTimingCount, + pPresentationTimings); +}
src/vulkan/wsi/wsi_common.c +298 -3
404 lines not on this page · raw message
src/vulkan/wsi/wsi_common.h +32 -0
@@ -88,6 +88,7 @@ struct wsi_device {VkPhysicalDevice pdevice;VkPhysicalDeviceMemoryProperties memory_props;uint32_t queue_family_count; +float timestamp_period;VkPhysicalDevicePCIBusInfoPropertiesEXT pci_bus_info;
@@ -134,14 +135,18 @@ struct wsi_device {WSI_CB (BindImageMemory);WSI_CB (BeginCommandBuffer);WSI_CB (CmdCopyImageToBuffer); +WSI_CB (CmdResetQueryPool); +WSI_CB (CmdWriteTimestamp);WSI_CB (CreateBuffer);WSI_CB (CreateCommandPool);WSI_CB (CreateFence);WSI_CB (CreateImage); +WSI_CB (CreateQueryPool);WSI_CB (DestroyBuffer);WSI_CB (DestroyCommandPool);WSI_CB (DestroyFence);WSI_CB (DestroyImage); +WSI_CB (DestroyQueryPool);WSI_CB (EndCommandBuffer);WSI_CB (FreeMemory);WSI_CB (FreeCommandBuffers);
@@ -150,11 +155,15 @@ struct wsi_device {WSI_CB (GetImageMemoryRequirements);WSI_CB (GetImageSubresourceLayout);WSI_CB (GetMemoryFdKHR); +WSI_CB (GetPhysicalDeviceProperties);WSI_CB (GetPhysicalDeviceFormatProperties);WSI_CB (GetPhysicalDeviceFormatProperties2KHR);WSI_CB (GetPhysicalDeviceImageFormatProperties2); +WSI_CB (GetPhysicalDeviceQueueFamilyProperties); +WSI_CB (GetQueryPoolResults);WSI_CB (ResetFences);WSI_CB (QueueSubmit); +WSI_CB (GetCalibratedTimestampsEXT);WSI_CB (WaitForFences);#undef WSI_CB
@@ -272,4 +281,27 @@ wsi_common_queue_present(const struct wsi_device *wsi,uint64_t wsi_common_get_current_time (void ); +VkResult +wsi_common_convert_timestamp (const struct wsi_device *wsi, +VkDevice device_h, +VkSurfaceKHR surface_h, +uint64_t monotonic_timestamp, +uint64_t *surface_timestamp); + +/* VK_GOOGLE_display_timing */ +VkResult +wsi_common_get_refresh_cycle_duration (const struct wsi_device *wsi, +VkDevice device_h, +VkSwapchainKHR swapchain, +VkRefreshCycleDurationGOOGLE + *pDisplayTimingProperties); + +VkResult +wsi_common_get_past_presentation_timing (const struct wsi_device *wsi, +VkDevice device_h, +VkSwapchainKHR swapchain, +uint32_t *pPresentationTimingCount, +VkPastPresentationTimingGOOGLE + *pPresentationTimings); +#endif
src/vulkan/wsi/wsi_common_display.c +157 -6
283 lines not on this page · raw message
src/vulkan/wsi/wsi_common_private.h +35 -0
@@ -25,6 +25,13 @@#include "wsi_common.h" +struct wsi_timing { +bool complete; +bool consumed; +uint64_t target_msc; +VkPastPresentationTimingGOOGLE timing; +}; +struct wsi_image {VkImage image;VkDeviceMemory memory;
@@ -41,8 +48,16 @@ struct wsi_image {uint32_t offsets[4 ];uint32_t row_pitches[4 ];int fds[4 ]; + +VkQueryPool query_pool; + +VkCommandBuffer timestamp_buffer; + +struct wsi_timing *timing; }; +#define WSI_TIMING_HISTORY 16 +struct wsi_swapchain {const struct wsi_device *wsi;
@@ -54,6 +69,16 @@ struct wsi_swapchain {bool use_prime_blit; +uint32_t timing_insert; +uint32_t timing_count; + +struct wsi_timing timing[WSI_TIMING_HISTORY ]; + +uint64_t frame_msc; +uint64_t frame_ust; + +float timestamp_period; +/* Command pools, one per queue family */ VkCommandPool *cmd_pools;
@@ -67,6 +92,10 @@ struct wsi_swapchain {VkResult (*queue_present)(struct wsi_swapchain *swap_chain,uint32_t image_index,const VkPresentRegionKHR *damage); +VkResult (*get_refresh_cycle_duration)(struct wsi_swapchain *swap_chain, +VkRefreshCycleDurationGOOGLE + *pDisplayTimingProperties); + };bool
@@ -104,6 +133,12 @@ wsi_destroy_image(const struct wsi_swapchain *chain, struct wsi_image *image); +void +wsi_present_complete (struct wsi_swapchain *swapchain, +struct wsi_image *image, +uint64_t ust, +uint64_t msc); +struct wsi_interface { VkResult (*get_support)(VkIcdSurfaceBase *surface, struct wsi_device *wsi_device,
src/vulkan/wsi/wsi_common_x11.c +68 -3
136 lines not on this page · raw message
Signature · 7 lines
2.25.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hey Keith,
Most of the cool kids prefer gitlab MR, can you open one going forward? That aside, here is some long overdue input on the patch itself.
My biggest concern that we expose the extension, even when it's not implemented. The rest are rather minor - more documentation/comments, style fixes and nitpicks.
Quoted 3 lines · Keith Packard
v5:
Squash core bits and anv/radv wrappers into a single patch
We have more Vulkan drivers than anv/radv these days, with a few others in the works.
For posterity sake, it might be worth keeping core + driver enablement separate patches.
As an added bonus, this way the respective teams can test, review, merge or even revert (please no) completely independently from each other.
src/amd/vulkan/radv_extensions.py EXTENSIONS = [ · line 169
Quoted 7 lines
src/amd/vulkan/radv_extensions.py +1
-0@@ -166,6 +166,7 @@ EXTENSIONS = [ Extension('VK_AMD_shader_trinary_minmax', 1, True), Extension('VK_GOOGLE_decorate_string', 1, True), Extension('VK_GOOGLE_hlsl_functionality1', 1, True), + Extension('VK_GOOGLE_display_timing', 1, True),
Nit: sort?
src/amd/vulkan/radv_wsi.c VkResult radv_GetPhysicalDevicePresentRectanglesKHR( · line 325
Quoted 13 lines
src/amd/vulkan/radv_wsi.c +7
-0@@ -316,3 +316,36 @@ VkResult radv_GetPhysicalDevicePresentRectanglesKHR( surface, pRectCount, pRects); } + +/* VK_GOOGLE_display_timing */ +VkResult +radv_GetRefreshCycleDurationGOOGLE ( +VkDevice _device, +VkSwapchainKHR swapchain, +VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties)
Nit: inconsistent indentation (follow GetPastPresentationTiming example below).
src/intel/vulkan/anv_extensions.py EXTENSIONS = [ · line 173
Quoted 7 lines
src/intel/vulkan/anv_extensions.py +1
-0@@ -170,6 +170,7 @@ EXTENSIONS = [ Extension('VK_ANDROID_external_memory_android_hardware_buffer', 3, 'ANDROID'), Extension('VK_ANDROID_native_buffer', 7, 'ANDROID'), Extension('VK_GOOGLE_decorate_string', 1, True), + Extension('VK_GOOGLE_display_timing', 1, True),
The dummy true will always advertise the extension. The extension depends on VK_KHR_swapchain which uses DRV_HAS_SURFACE guard, which is a good start.
Although there is no Wayland implementation, so how does the extension work there? We really should not advertise it in said case.
Same applies for radv as well, obviously.
src/vulkan/wsi/wsi_common.c wsi_device_init(struct wsi_device *wsi, · line 58
Quoted 8 lines
src/vulkan/wsi/wsi_common.c +1
-0@@ -54,6 +55,7 @@ wsi_device_init(struct wsi_device *wsi,WSI_GET_CB (GetPhysicalDeviceProperties2);WSI_GET_CB (GetPhysicalDeviceMemoryProperties);WSI_GET_CB (GetPhysicalDeviceQueueFamilyProperties); +WSI_GET_CB (GetPhysicalDeviceProperties);
Nit: sort
src/vulkan/wsi/wsi_common.c wsi_device_init(struct wsi_device *wsi, · line 109
Quoted 7 lines
src/vulkan/wsi/wsi_common.c +1
-0@@ -94,11 +104,15 @@ wsi_device_init(struct wsi_device *wsi,WSI_GET_CB (GetImageMemoryRequirements);WSI_GET_CB (GetImageSubresourceLayout);WSI_GET_CB (GetMemoryFdKHR); +WSI_GET_CB (GetPhysicalDeviceProperties);WSI_GET_CB (GetPhysicalDeviceFormatProperties);WSI_GET_CB (GetPhysicalDeviceFormatProperties2KHR);
Nit: sort - DeviceProperties should be here.
src/vulkan/wsi/wsi_common.c wsi_swapchain_init(const struct wsi_device *wsi, · line 229
Quoted 7 lines
src/vulkan/wsi/wsi_common.c +2
-0@@ -210,6 +224,8 @@ wsi_swapchain_init(const struct wsi_device *wsi, chain->device = device; chain->alloc = *pAllocator; chain->use_prime_blit = false; + chain->timing_insert =0 ; + chain->timing_count =0 ;
Not needed we memset(0) at the top of the function.
Quoted 8 lines
src/vulkan/wsi/wsi_common.c +8
-0+static VkResult +wsi_image_init_timestamp (const struct wsi_swapchain *chain, +struct wsi_image *image) +{ +const struct wsi_device *wsi = chain->wsi; +VkResult result; +/* Set up command buffer to get timestamp info */ +
src/vulkan/wsi/wsi_common.c align_u32(uint32_t v, uint32_t a) · line 376
Quoted 10 lines
src/vulkan/wsi/wsi_common.c +10
-0+ result = wsi->CreateQueryPool ( + chain->device, + &(const VkQueryPoolCreateInfo ) { + .sType =VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO , + .queryType =VK_QUERY_TYPE_TIMESTAMP , + .queryCount =1 , + }, +NULL , + &image->query_pool); +
Current code prefers using local variables. Bonus - it will ease fixing the indentation. Comments apply for the whole patch.
src/vulkan/wsi/wsi_common.c
Quoted 2 lines
src/vulkan/wsi/wsi_common.c +2
-0+static struct wsi_timing * +wsi_next_timing (struct wsi_swapchain *chain,int image_index)
Unused image_index. Left over from earlier revision, or incomplete code?
src/vulkan/wsi/wsi_common.c wsi_common_acquire_next_image2(const struct wsi_device *wsi, · line 1213
Quoted 3 lines
src/vulkan/wsi/wsi_common.c +3
-0+{ +uint32_t j = chain->timing_insert; + ++chain->timing_insert;
Please use post increments through the patch.
src/vulkan/wsi/wsi_common.c wsi_common_acquire_next_image2(const struct wsi_device *wsi, · line 1219
Quoted 6 lines
src/vulkan/wsi/wsi_common.c +6
-0+if (chain->timing_insert >=WSI_TIMING_HISTORY ) + chain->timing_insert =0 ; +if (chain->timing_count <WSI_TIMING_HISTORY ) + ++chain->timing_count; +struct wsi_timing *timing = &chain->timing[j]; +memset (timing,'\0' ,sizeof (*timing));
The memset here is rather misleading. Since the caller already (re)sets some of the fields one might as well just expand that.
Quoted 9 lines
src/vulkan/wsi/wsi_common.c +9
-0+void +wsi_present_complete (struct wsi_swapchain *swapchain, +struct wsi_image *image, +uint64_t ust, +uint64_t msc) +{ +const struct wsi_device *wsi = swapchain->wsi; +struct wsi_timing *timing = image->timing; +
src/vulkan/wsi/wsi_common.c wsi_common_acquire_next_image2(const struct wsi_device *wsi, · line 1241
Quoted 10 lines
src/vulkan/wsi/wsi_common.c +10
-0+if (!timing) +return ; + +uint64_t render_timestamp; + +VkResult result = wsi->GetQueryPoolResults ( + swapchain->device, image->query_pool, +0 ,1 ,sizeof (render_timestamp), &render_timestamp, +sizeof (uint64_t ), +VK_QUERY_RESULT_64_BIT |VK_QUERY_RESULT_WAIT_BIT );
Rewrap this and any other parts to use 80 columns as suggested earlier.
src/vulkan/wsi/wsi_common.c wsi_common_acquire_next_image2(const struct wsi_device *wsi, · line 1259
Quoted 4 lines
src/vulkan/wsi/wsi_common.c +3
-0+static const VkCalibratedTimestampInfoEXT timestampInfo[2 ] = { + uint64_t timestamps[2]; +uint64_t maxDeviation;
Drop the space alignment when declaring variables.
src/vulkan/wsi/wsi_common.c wsi_common_acquire_next_image2(const struct wsi_device *wsi, · line 1262
Quoted 3 lines
src/vulkan/wsi/wsi_common.c +3
-0+ + result = wsi->GetCalibratedTimestampsEXT(swapchain->device, + 2,
ARRAY_SIZE(), rewrap.
Quoted 7 lines
src/vulkan/wsi/wsi_common.c +3
-0+ timestampInfo, + timestamps, + &maxDeviation);@@ -1125,11 +1328,14 @@ wsi_common_queue_present(const struct wsi_device *wsi,
src/vulkan/wsi/wsi_common.c wsi_common_queue_present(const struct wsi_device *wsi, · line 1338
Quoted 10 lines
src/vulkan/wsi/wsi_common.c +3
-0const VkPresentRegionsKHR *regions =vk_find_struct_const (pPresentInfo->pNext,PRESENT_REGIONS_KHR ); +const VkPresentTimesInfoGOOGLE *present_times_info = +vk_find_struct_const (pPresentInfo->pNext,PRESENT_TIMES_INFO_GOOGLE );for (uint32_t i =0 ; i < pPresentInfo->swapchainCount; i++) {WSI_FROM_HANDLE (wsi_swapchain, swapchain, pPresentInfo->pSwapchains[i]);uint32_t image_index = pPresentInfo->pImageIndices[i];VkResult result; +struct wsi_timing *timing =NULL ;
Move the declaration where it is used.
Quoted 22 lines
src/vulkan/wsi/wsi_common.c +3
-2if (swapchain->fences[image_index] ==VK_NULL_HANDLE ) {const VkFenceCreateInfo fence_info = {@@ -1164,9 +1370,12 @@ wsi_common_queue_present(const struct wsi_device *wsi, .memory = image->memory, }; +VkCommandBuffer submit_buffers[2 ];VkSubmitInfo submit_info = { .sType =VK_STRUCTURE_TYPE_SUBMIT_INFO , .pNext = &mem_signal, + .pCommandBuffers = submit_buffers, + .commandBufferCount =0 };VkPipelineStageFlags *stage_flags =NULL ;@@ -1197,10 +1406,47 @@ wsi_common_queue_present(const struct wsi_device *wsi,/* If we are using prime blits, we need to perform the blit now. The * command buffer is attached to the image. */ - submit_info.commandBufferCount =1 ; - submit_info.pCommandBuffers =
src/vulkan/wsi/wsi_common.c wsi_common_queue_present(const struct wsi_device *wsi, · line 1417
Quoted 10 lines
src/vulkan/wsi/wsi_common.c +8
-1- &image->prime.blit_cmd_buffers[queue_family_index]; mem_signal.memory = image->prime.memory; + submit_buffers[submit_info.commandBufferCount++] = + image->prime.blit_cmd_buffers[queue_family_index]; + } + +/* Set up GOOGLE_display_timing bits */ +if (present_times_info && + present_times_info->pTimes !=NULL && + i < present_times_info->swapchainCount)
The spec says "swapchainCount must be the same value as VkPresentInfoKHR::swapchainCount".
Thus we should be safe to drop this - we already check the VkPresentInfoKHR one (pPresentInfo->swapchainCount) at the top of the loop.
src/vulkan/wsi/wsi_common.c wsi_common_queue_present(const struct wsi_device *wsi, · line 1418
Quoted 1 line
src/vulkan/wsi/wsi_common.c +1
-0+ {
The if opening brace should be trailing on the previous line.
src/vulkan/wsi/wsi_common.c wsi_common_queue_present(const struct wsi_device *wsi, · line 1429
Quoted 11 lines
src/vulkan/wsi/wsi_common.c +11
-0+const VkPresentTimeGOOGLE *present_time = + &present_times_info->pTimes[i]; + + timing =wsi_next_timing (swapchain, pPresentInfo->pImageIndices[i]); + timing->timing.presentID = present_time->presentID; + timing->timing.desiredPresentTime = present_time->desiredPresentTime; + timing->target_msc =0 ; + image->timing = timing; + +if (present_time->desiredPresentTime !=0 ) + {
Ditto
src/vulkan/wsi/wsi_common.c wsi_common_queue_present(const struct wsi_device *wsi, · line 1434
Quoted 5 lines
src/vulkan/wsi/wsi_common.c +5
-0+int64_t delta_nsec = (int64_t ) (present_time->desiredPresentTime - + swapchain->frame_ust); + +/* Set the target msc only if it's no more than two seconds from +* now, and not stale
The specification does not say anything about the above two seconds. Please document how and why it was chosen.
src/vulkan/wsi/wsi_common.c wsi_common_get_current_time(void) · line 1490
Quoted 11 lines
src/vulkan/wsi/wsi_common.c +7
-0@@ -1235,3 +1481,52 @@ wsi_common_get_current_time(void)clock_gettime (CLOCK_MONOTONIC , ¤t);return current.tv_nsec + current.tv_sec *1000000000ull ; } + +VkResult +wsi_common_get_refresh_cycle_duration ( +const struct wsi_device *wsi, +VkDevice device_h, +VkSwapchainKHR _swapchain, +VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties)
Nit: unusual indent
src/vulkan/wsi/wsi_common.c wsi_common_get_current_time(void) · line 1507
Quoted 7 lines
src/vulkan/wsi/wsi_common.c +7
-0+VkResult +wsi_common_get_past_presentation_timing ( +const struct wsi_device *wsi, +VkDevice device_h, +VkSwapchainKHR _swapchain, +uint32_t *count, +VkPastPresentationTimingGOOGLE *timings)
Ditto
src/vulkan/wsi/wsi_common.c struct wsi_device { · line 161
Quoted 8 lines
src/vulkan/wsi/wsi_common.c +1
-0@@ -150,11 +155,15 @@ struct wsi_device {WSI_CB (GetImageMemoryRequirements);WSI_CB (GetImageSubresourceLayout);WSI_CB (GetMemoryFdKHR); +WSI_CB (GetPhysicalDeviceProperties);WSI_CB (GetPhysicalDeviceFormatProperties);WSI_CB (GetPhysicalDeviceFormatProperties2KHR);WSI_CB (GetPhysicalDeviceImageFormatProperties2);
Nit: DeviceProperties should be here.
Quoted 11 lines
src/vulkan/wsi/wsi_common.c +3
-0+WSI_CB (GetPhysicalDeviceQueueFamilyProperties); +WSI_CB (GetQueryPoolResults);WSI_CB (ResetFences);WSI_CB (QueueSubmit); +WSI_CB (GetCalibratedTimestampsEXT);WSI_CB (WaitForFences);#undef WSI_CB
src/vulkan/wsi/wsi_common.c wsi_display_page_flip_handler2(int fd, · line 1163
Quoted 8 lines
src/vulkan/wsi/wsi_common.c +5
-0@@ -1145,17 +1156,38 @@ wsi_display_page_flip_handler2(int fd, {struct wsi_display_image *image = data;struct wsi_display_swapchain *chain = image->chain; +VkIcdSurfaceDisplay *surface = chain->surface; +wsi_display_mode *display_mode = +wsi_display_mode_from_handle (surface->displayMode); +wsi_display_connector *connector = display_mode->connector; +uint64_t nsec = (uint64_t ) sec *1000000000ull + (uint64_t ) usec *1000 ;
Let's add an inline helper (like the widen) and use in both handlers.
src/vulkan/wsi/wsi_common.c wsi_get_swapchain_counter(VkDevice device, · line 2707
Quoted 10 lines
src/vulkan/wsi/wsi_common.c +3
-2@@ -2555,9 +2701,14 @@ wsi_get_swapchain_counter(VkDevice device,return VK_SUCCESS ; } -int ret =drmCrtcGetSequence (wsi->fd, connector->crtc_id, value,NULL ); -if (ret) +uint64_t nsec; +int ret =drmCrtcGetSequence (wsi->fd, connector->crtc_id, value, &nsec); +if (ret) { *value =0 ;
Using "return VK_ERROR_DEVICE_LOST;" seems perfectly reasonable here. Although that should really be a separate patch.
src/vulkan/wsi/wsi_common.c wsi_get_swapchain_counter(VkDevice device, · line 2709
Quoted 2 lines
src/vulkan/wsi/wsi_common.c +2
-0+#define WSI_TIMING_HISTORY 16 +
Please add some comments why we have a fixed timing set in the swapchain and how 16 was chosen.
Quoted 5 lines
src/vulkan/wsi/wsi_common.c +0
-1@@ -859,8 +862,39 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,case XCB_PRESENT_EVENT_COMPLETE_NOTIFY : {xcb_present_complete_notify_event_t *complete = (void *) event; -if (complete->kind ==XCB_PRESENT_COMPLETE_KIND_PIXMAP )
src/vulkan/wsi/wsi_common.c x11_handle_dri3_present_event(struct x11_swapchain *chain, · line 874
Quoted 10 lines
src/vulkan/wsi/wsi_common.c +10
-0+if (complete->kind ==XCB_PRESENT_COMPLETE_KIND_PIXMAP ) { +uint64_t frames = complete->msc - chain->last_present_msc; +uint64_t present_nsec = complete->ust *1000 ; + +/* +* Well, this is about as good as we can do -- measure the refresh +* instead of asking for the current mode and using that. Turns out, +* for eDP panels, this works better anyways as they use the builtin +* fixed mode for everything +*/
What is wrong with checking the current mode and using the data? Let's document that reasoning.
Apart from the initial 60Hz, the refresh period returned will vary during the initial 10 frames. Are we confident that either of those assumptions won't back-fire with applications?
src/vulkan/wsi/wsi_common.c x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, · line 1544
Quoted 3 lines
src/vulkan/wsi/wsi_common.c +1
-0@@ -1480,6 +1543,8 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, + chain->threaded = false;
Unrelated, yet again it's missing all together in master.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel