summaryrefslogtreecommitdiff
path: root/lib/mesa/src/vulkan
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-02-26 12:20:31 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-02-26 12:20:31 +0000
commit9b2e362559110085d2ff9b90fea11fa81e704a78 (patch)
treeb114259e6fecf369e1e7b90f3bb8116fa08b1cf1 /lib/mesa/src/vulkan
parentb5fce4e6eb297a6f7fabd0d6c6b4ffdfefa6ad8b (diff)
Import Mesa 13.0.5
Diffstat (limited to 'lib/mesa/src/vulkan')
-rw-r--r--lib/mesa/src/vulkan/wsi/wsi_common.h20
-rw-r--r--lib/mesa/src/vulkan/wsi/wsi_common_wayland.c29
-rw-r--r--lib/mesa/src/vulkan/wsi/wsi_common_x11.c19
3 files changed, 50 insertions, 18 deletions
diff --git a/lib/mesa/src/vulkan/wsi/wsi_common.h b/lib/mesa/src/vulkan/wsi/wsi_common.h
index a1f5a4018..394b8fa19 100644
--- a/lib/mesa/src/vulkan/wsi/wsi_common.h
+++ b/lib/mesa/src/vulkan/wsi/wsi_common.h
@@ -116,9 +116,27 @@ struct wsi_callbacks {
return (__VkType)(uintptr_t) _obj; \
}
-WSI_DEFINE_NONDISP_HANDLE_CASTS(_VkIcdSurfaceBase, VkSurfaceKHR)
WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, VkSwapchainKHR)
+#define ICD_DEFINE_NONDISP_HANDLE_CASTS(__VkIcdType, __VkType) \
+ \
+ static inline __VkIcdType * \
+ __VkIcdType ## _from_handle(__VkType _handle) \
+ { \
+ return (__VkIcdType *)(uintptr_t) _handle; \
+ } \
+ \
+ static inline __VkType \
+ __VkIcdType ## _to_handle(__VkIcdType *_obj) \
+ { \
+ return (__VkType)(uintptr_t) _obj; \
+ }
+
+#define ICD_FROM_HANDLE(__VkIcdType, __name, __handle) \
+ __VkIcdType *__name = __VkIcdType ## _from_handle(__handle)
+
+ICD_DEFINE_NONDISP_HANDLE_CASTS(VkIcdSurfaceBase, VkSurfaceKHR)
+
VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
diff --git a/lib/mesa/src/vulkan/wsi/wsi_common_wayland.c b/lib/mesa/src/vulkan/wsi/wsi_common_wayland.c
index f6c218bde..d5ba15bfc 100644
--- a/lib/mesa/src/vulkan/wsi/wsi_common_wayland.c
+++ b/lib/mesa/src/vulkan/wsi/wsi_common_wayland.c
@@ -379,7 +379,8 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
caps->currentExtent = (VkExtent2D) { -1, -1 };
caps->minImageExtent = (VkExtent2D) { 1, 1 };
- caps->maxImageExtent = (VkExtent2D) { INT16_MAX, INT16_MAX };
+ /* This is the maximum supported size on Intel */
+ caps->maxImageExtent = (VkExtent2D) { 1 << 14, 1 << 14 };
caps->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
caps->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
caps->maxImageArrayLayers = 1;
@@ -409,25 +410,27 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface,
if (!display)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- uint32_t count = u_vector_length(&display->formats);
-
if (pSurfaceFormats == NULL) {
- *pSurfaceFormatCount = count;
+ *pSurfaceFormatCount = u_vector_length(&display->formats);
return VK_SUCCESS;
}
- assert(*pSurfaceFormatCount >= count);
- *pSurfaceFormatCount = count;
-
+ uint32_t count = 0;
VkFormat *f;
u_vector_foreach(f, &display->formats) {
- *(pSurfaceFormats++) = (VkSurfaceFormatKHR) {
+ if (count == *pSurfaceFormatCount)
+ return VK_INCOMPLETE;
+
+ pSurfaceFormats[count++] = (VkSurfaceFormatKHR) {
.format = *f,
/* TODO: We should get this from the compositor somehow */
.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
};
}
+ assert(*pSurfaceFormatCount <= count);
+ *pSurfaceFormatCount = count;
+
return VK_SUCCESS;
}
@@ -441,11 +444,13 @@ wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *surface,
return VK_SUCCESS;
}
- assert(*pPresentModeCount >= ARRAY_SIZE(present_modes));
+ *pPresentModeCount = MIN2(*pPresentModeCount, ARRAY_SIZE(present_modes));
typed_memcpy(pPresentModes, present_modes, *pPresentModeCount);
- *pPresentModeCount = ARRAY_SIZE(present_modes);
- return VK_SUCCESS;
+ if (*pPresentModeCount < ARRAY_SIZE(present_modes))
+ return VK_INCOMPLETE;
+ else
+ return VK_SUCCESS;
}
VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
@@ -463,7 +468,7 @@ VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
surface->display = pCreateInfo->display;
surface->surface = pCreateInfo->surface;
- *pSurface = _VkIcdSurfaceBase_to_handle(&surface->base);
+ *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
return VK_SUCCESS;
}
diff --git a/lib/mesa/src/vulkan/wsi/wsi_common_x11.c b/lib/mesa/src/vulkan/wsi/wsi_common_x11.c
index 8e0043fdc..ae5ffed2d 100644
--- a/lib/mesa/src/vulkan/wsi/wsi_common_x11.c
+++ b/lib/mesa/src/vulkan/wsi/wsi_common_x11.c
@@ -261,8 +261,12 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
struct wsi_x11_connection *wsi_conn =
wsi_x11_get_connection(wsi_device, alloc, connection);
+ if (!wsi_conn)
+ return false;
+
if (!wsi_conn->has_dri3) {
- fprintf(stderr, "vulkan: No DRI3 support\n");
+ fprintf(stderr, "vulkan: No DRI3 support detected - required for presentation\n");
+ fprintf(stderr, "Note: Buggy applications may crash, if they do please report to vendor\n");
return false;
}
@@ -310,7 +314,8 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
return VK_ERROR_OUT_OF_HOST_MEMORY;
if (!wsi_conn->has_dri3) {
- fprintf(stderr, "vulkan: No DRI3 support\n");
+ fprintf(stderr, "vulkan: No DRI3 support detected - required for presentation\n");
+ fprintf(stderr, "Note: Buggy applications may crash, if they do please report to vendor\n");
*pSupported = false;
return VK_SUCCESS;
}
@@ -349,6 +354,9 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
xcb_visualtype_t *visual =
get_visualtype_for_window(conn, window, &visual_depth);
+ if (!visual)
+ return VK_ERROR_SURFACE_LOST_KHR;
+
geom = xcb_get_geometry_reply(conn, geom_cookie, &err);
if (geom) {
VkExtent2D extent = { geom->width, geom->height };
@@ -362,7 +370,8 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
*/
caps->currentExtent = (VkExtent2D) { -1, -1 };
caps->minImageExtent = (VkExtent2D) { 1, 1 };
- caps->maxImageExtent = (VkExtent2D) { INT16_MAX, INT16_MAX };
+ /* This is the maximum supported size on Intel */
+ caps->maxImageExtent = (VkExtent2D) { 1 << 14, 1 << 14 };
}
free(err);
free(geom);
@@ -447,7 +456,7 @@ VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
surface->connection = pCreateInfo->connection;
surface->window = pCreateInfo->window;
- *pSurface = _VkIcdSurfaceBase_to_handle(&surface->base);
+ *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
return VK_SUCCESS;
}
@@ -466,7 +475,7 @@ VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
surface->dpy = pCreateInfo->dpy;
surface->window = pCreateInfo->window;
- *pSurface = _VkIcdSurfaceBase_to_handle(&surface->base);
+ *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
return VK_SUCCESS;
}