[Mesa-dev] [PATCH 1/2] vulkan/wsi: move image count to shared structure.

Jason Ekstrand jason at jlekstrand.net
Tue Feb 21 16:21:21 UTC 2017


On Tue, Feb 21, 2017 at 1:01 AM, Gustaw Smolarczyk <wielkiegie at gmail.com>
wrote:

> 21 lut 2017 03:47 "Jason Ekstrand" <jason at jlekstrand.net> napisaƂ(a):
>
> Fine by me
>
> Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
>
> On Mon, Feb 20, 2017 at 6:26 PM, Dave Airlie <airlied at gmail.com> wrote:
>
>> From: Dave Airlie <airlied at redhat.com>
>>
>> For prime support I need to access this, so move it in advance.
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  src/vulkan/wsi/wsi_common.h         |  1 +
>>  src/vulkan/wsi/wsi_common_wayland.c | 20 +++++++++-----------
>>  src/vulkan/wsi/wsi_common_x11.c     | 29 ++++++++++++++---------------
>>  3 files changed, 24 insertions(+), 26 deletions(-)
>>
>> diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
>> index ae9e587..1a22935 100644
>> --- a/src/vulkan/wsi/wsi_common.h
>> +++ b/src/vulkan/wsi/wsi_common.h
>> @@ -54,6 +54,7 @@ struct wsi_swapchain {
>>     const struct wsi_image_fns *image_fns;
>>     VkFence fences[3];
>>     VkPresentModeKHR present_mode;
>> +   int image_count;
>>
>>     VkResult (*destroy)(struct wsi_swapchain *swapchain,
>>                         const VkAllocationCallbacks *pAllocator);
>> diff --git a/src/vulkan/wsi/wsi_common_wayland.c
>> b/src/vulkan/wsi/wsi_common_wayland.c
>> index 4489736..e6490ee 100644
>> --- a/src/vulkan/wsi/wsi_common_wayland.c
>> +++ b/src/vulkan/wsi/wsi_common_wayland.c
>> @@ -495,7 +495,6 @@ struct wsi_wl_swapchain {
>>     VkPresentModeKHR                             present_mode;
>>     bool                                         fifo_ready;
>>
>> -   uint32_t                                     image_count;
>>     struct wsi_wl_image                          images[0];
>>  };
>>
>> @@ -508,13 +507,13 @@ wsi_wl_swapchain_get_images(struct wsi_swapchain
>> *wsi_chain,
>>     VkResult result;
>>
>>     if (pSwapchainImages == NULL) {
>> -      *pCount = chain->image_count;
>> +      *pCount = chain->base.image_count;
>>        return VK_SUCCESS;
>>     }
>>
>>     result = VK_SUCCESS;
>> -   ret_count = chain->image_count;
>> -   if (chain->image_count > *pCount) {
>> +   ret_count = chain->base.image_count;
>> +   if (chain->base.image_count > *pCount) {
>>       ret_count = *pCount;
>>       result = VK_INCOMPLETE;
>>     }
>> @@ -543,7 +542,7 @@ wsi_wl_swapchain_acquire_next_image(struct
>> wsi_swapchain *wsi_chain,
>>        return VK_ERROR_OUT_OF_DATE_KHR;
>>
>>     while (1) {
>> -      for (uint32_t i = 0; i < chain->image_count; i++) {
>> +      for (uint32_t i = 0; i < chain->base.image_count; i++) {
>>
>
> Looks like a comparison between signed and unsigned. Not sure if you care
> about this (it produces a warning at -Wall or -Wextra IIRC).
>

Good point.  All we need to do is tweak it to store a uint32_t instead of
an int.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170221/5fe94046/attachment-0001.html>


More information about the mesa-dev mailing list