wsi/wayland: fix pointer casting warning on 32bit
[mesa.git] / src / vulkan / wsi / wsi_common_wayland.c
index 3d3a60167bfa7a6ba699c242a0f69795b51f7438..87fcbae26c405cf1d89d45b038fa722701cbc348 100644 (file)
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <pthread.h>
 
-#include <drm_fourcc.h>
+#include "drm-uapi/drm_fourcc.h"
 
 #include "vk_util.h"
 #include "wsi_common_private.h"
@@ -480,6 +480,7 @@ static const VkPresentModeKHR present_modes[] = {
 
 static VkResult
 wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
+                                struct wsi_device *wsi_device,
                                 VkSurfaceCapabilitiesKHR* caps)
 {
    /* For true mailbox mode, we need at least 4 images:
@@ -494,8 +495,11 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
 
    caps->currentExtent = (VkExtent2D) { -1, -1 };
    caps->minImageExtent = (VkExtent2D) { 1, 1 };
-   /* This is the maximum supported size on Intel */
-   caps->maxImageExtent = (VkExtent2D) { 1 << 14, 1 << 14 };
+   caps->maxImageExtent = (VkExtent2D) {
+      wsi_device->maxImageDimension2D,
+      wsi_device->maxImageDimension2D,
+   };
+
    caps->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
    caps->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
    caps->maxImageArrayLayers = 1;
@@ -508,6 +512,7 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
       VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
       VK_IMAGE_USAGE_SAMPLED_BIT |
       VK_IMAGE_USAGE_TRANSFER_DST_BIT |
+      VK_IMAGE_USAGE_STORAGE_BIT |
       VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
 
    return VK_SUCCESS;
@@ -515,12 +520,14 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
 
 static VkResult
 wsi_wl_surface_get_capabilities2(VkIcdSurfaceBase *surface,
+                                 struct wsi_device *wsi_device,
                                  const void *info_next,
                                  VkSurfaceCapabilities2KHR* caps)
 {
    assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
 
-   return wsi_wl_surface_get_capabilities(surface, &caps->surfaceCapabilities);
+   return wsi_wl_surface_get_capabilities(surface, wsi_device,
+                                          &caps->surfaceCapabilities);
 }
 
 static VkResult
@@ -665,6 +672,7 @@ struct wsi_wl_swapchain {
 
    struct wsi_wl_image                          images[0];
 };
+WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_wl_swapchain, VkSwapchainKHR)
 
 static struct wsi_image *
 wsi_wl_swapchain_get_wsi_image(struct wsi_swapchain *wsi_chain,
@@ -960,7 +968,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;