[Mesa-dev] [PATCH mesa 4/4] vulkan/wsi: fix pointer casting warning on 32bit

Eric Engestrom eric.engestrom at intel.com
Mon Oct 29 10:00:31 UTC 2018


On Sunday, 2018-10-28 17:29:34 -0500, Jason Ekstrand wrote:
> On October 28, 2018 08:45:30 Eric Engestrom <eric.engestrom at intel.com> wrote:
> 
> > Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> > ---
> > src/vulkan/wsi/wsi_common_wayland.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 
> > diff --git a/src/vulkan/wsi/wsi_common_wayland.c
> > b/src/vulkan/wsi/wsi_common_wayland.c
> > index e9cc22ec60372e486e8e..c3cb066bd6dfedb6a363 100644
> > --- a/src/vulkan/wsi/wsi_common_wayland.c
> > +++ b/src/vulkan/wsi/wsi_common_wayland.c
> > @@ -959,7 +959,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase
> > *icd_surface,
> >       /* If we have an oldSwapchain parameter, copy the display struct over
> >        * from the old one so we don't have to fully re-initialize it.
> >        */
> > -      struct wsi_wl_swapchain *old_chain = (void *)pCreateInfo->oldSwapchain;
> > +      struct wsi_wl_swapchain *old_chain = (void
> > *)(uintptr_t)pCreateInfo->oldSwapchain;
> 
> This is exactly what WSI_FROM_HANDLE is for.

Good catch, I wasn't aware of that macro.

I'll send a v2 with the following instead, but I'll wait a bit for other
comments on the series:

----8<----
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index c3cb066bd6dfedb6a363..a7202d61f15eaa2a95ea 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -645,6 +645,7 @@ struct wsi_wl_image {
    bool                                         busy;
 };
 
+WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_wl_swapchain, VkSwapchainKHR)
 struct wsi_wl_swapchain {
    struct wsi_swapchain                        base;
 
@@ -959,7 +960,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
       /* If we have an oldSwapchain parameter, copy the display struct over
        * from the old one so we don't have to fully re-initialize it.
        */
-      struct wsi_wl_swapchain *old_chain = (void *)pCreateInfo->oldSwapchain;
+      WSI_FROM_HANDLE(wsi_wl_swapchain, old_chain, pCreateInfo->oldSwapchain);
       chain->display = wsi_wl_display_ref(old_chain->display);
    } else {
       chain->display = NULL;
---->8----

> 
> --Jason
> 
> >       chain->display = wsi_wl_display_ref(old_chain->display);
> >    } else {
> >       chain->display = NULL;
> > --
> > Cheers,
> >  Eric
> > 
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> 
> 


More information about the mesa-dev mailing list