[Piglit] [PATCH 2/3] func.sync.semaphore-fd: use queue priorities if supported

Tapani Pälli tapani.palli at intel.com
Wed Feb 28 05:57:46 UTC 2018



On 27.02.2018 23:59, Jason Ekstrand wrote:
> On Tue, Feb 27, 2018 at 12:10 AM, Tapani Pälli <tapani.palli at intel.com 
> <mailto:tapani.palli at intel.com>> wrote:
> 
>     Patch adds VK_EXT_global_priority support. This should not affect
>     test results.
> 
>     Signed-off-by: Tapani Pälli <tapani.palli at intel.com
>     <mailto:tapani.palli at intel.com>>
>     ---
>       src/tests/func/sync/semaphore-fd.c | 23 ++++++++++++++++-------
>       1 file changed, 16 insertions(+), 7 deletions(-)
> 
>     diff --git a/src/tests/func/sync/semaphore-fd.c
>     b/src/tests/func/sync/semaphore-fd.c
>     index 63cb84d..ea54369 100644
>     --- a/src/tests/func/sync/semaphore-fd.c
>     +++ b/src/tests/func/sync/semaphore-fd.c
>     @@ -43,23 +43,32 @@ struct buffer_layout {
>       };
> 
>       static void
>     -init_context(struct test_context *ctx, float priority)
>     +init_context(struct test_context *ctx, float priority,
>     +             VkQueueGlobalPriorityEXT g_priority)
>       {
>          const char *extension_names[] = {
>             "VK_KHR_external_memory",
>             "VK_KHR_external_memory_fd",
>             "VK_KHR_external_semaphore",
>             "VK_KHR_external_semaphore_fd",
>     +      "VK_EXT_global_priority",
>          };
> 
>     +    bool use_global_priority =
>     +        t_has_ext("VK_EXT_global_priority");
>     +
>           VkResult result = vkCreateDevice(t_physical_dev,
>               &(VkDeviceCreateInfo) {
>                   .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
>     -            .enabledExtensionCount = 4,
>     +            .enabledExtensionCount = use_global_priority ? 5 : 4,
>                   .ppEnabledExtensionNames = extension_names,
>                   .queueCreateInfoCount = 1,
>                   .pQueueCreateInfos = &(VkDeviceQueueCreateInfo) {
>                       .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
>     +                .pNext = use_global_priority ?
>     &(VkDeviceQueueGlobalPriorityCreateInfoEXT) {
>     +                    .sType =
>     VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT,
>     +                    .globalPriority = g_priority,
>     +                } : NULL,
> 
> 
> This is a crazy use of ternaries together with compound literals.  I 
> think it might be best to declare the QueueGlobalPriority structure 
> above and make things a little less in-line.

Agreed, will clean it up before pushing! Thanks!


>                       .queueFamilyIndex = 0,
>                       .queueCount = 1,
>                       .pQueuePriorities = (float[]) { priority },
>     @@ -601,7 +610,7 @@ static void
>       test_sanity(void)
>       {
>           struct test_context ctx;
>     -    init_context(&ctx, 1.0);
>     +    init_context(&ctx, 1.0, VK_QUEUE_GLOBAL_PRIORITY_MEDIUM);
> 
>           VkMemoryRequirements buffer_reqs =
>               qoGetBufferMemoryRequirements(ctx.device, ctx.buffer);
>     @@ -674,8 +683,8 @@ test_opaque_fd(void)
>         
>       require_handle_type(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR);
> 
>           struct test_context ctx1, ctx2;
>     -    init_context(&ctx1, 1.0);
>     -    init_context(&ctx2, 0.0);
>     +    init_context(&ctx1, 1.0, VK_QUEUE_GLOBAL_PRIORITY_MEDIUM);
>     +    init_context(&ctx2, 0.0, VK_QUEUE_GLOBAL_PRIORITY_LOW);
> 
>       #define GET_FUNCTION_PTR(name, device) \
>           PFN_vk##name name = (PFN_vk##name)vkGetDeviceProcAddr(device,
>     "vk"#name)
>     @@ -826,8 +835,8 @@ test_sync_fd(void)
>         
>       require_handle_type(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR);
> 
>           struct test_context ctx1, ctx2;
>     -    init_context(&ctx1, 1.0);
>     -    init_context(&ctx2, 0.0);
>     +    init_context(&ctx1, 1.0, VK_QUEUE_GLOBAL_PRIORITY_MEDIUM);
>     +    init_context(&ctx2, 0.0, VK_QUEUE_GLOBAL_PRIORITY_LOW);
> 
>       #define GET_FUNCTION_PTR(name, device) \
>           PFN_vk##name name = (PFN_vk##name)vkGetDeviceProcAddr(device,
>     "vk"#name)
>     --
>     2.14.3
> 
> 


More information about the Piglit mailing list