summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-09-01 18:59:06 -0700
committerJason Ekstrand <[email protected]>2015-09-04 17:55:42 -0700
commitca3cfbf6f1e009c0208ffaa483c8a7e80394639d (patch)
tree16e4f40d8e2a879eaff8e3a23aa54626de1c716b /src/vulkan
parent3d9fbb6575697744642c28464fb098552576ac97 (diff)
vk: Add an initial implementation of the actual Khronos WSI extension
Unfortunately, this is a very large commit and removes the old LunarG WSI extension. This is because there are a couple of entrypoints that have the same name between the two extensions so implementing them both is impractiacl. Support is still incomplete, but this is enough to get vkcube up and going again.
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/Makefile.am2
-rw-r--r--src/vulkan/anv_device.c8
-rw-r--r--src/vulkan/anv_private.h5
-rw-r--r--src/vulkan/anv_wsi.c146
-rw-r--r--src/vulkan/anv_wsi.h59
-rw-r--r--src/vulkan/anv_wsi_x11.c201
6 files changed, 324 insertions, 97 deletions
diff --git a/src/vulkan/Makefile.am b/src/vulkan/Makefile.am
index 9d52dad7bb1..24e45cf873b 100644
--- a/src/vulkan/Makefile.am
+++ b/src/vulkan/Makefile.am
@@ -28,7 +28,7 @@ vulkan_include_HEADERS = \
$(top_srcdir)/include/vulkan/vulkan.h \
$(top_srcdir)/include/vulkan/vulkan_intel.h \
$(top_srcdir)/include/vulkan/vk_wsi_swapchain.h \
- $(top_srcdir)/include/vulkan/vk_wsi_lunarg.h
+ $(top_srcdir)/include/vulkan/vk_wsi_device_swapchain.h
lib_LTLIBRARIES = libvulkan.la
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index e83bd4bf272..7ae11d6560b 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -637,10 +637,6 @@ static const VkExtensionProperties global_extensions[] = {
.extName = "VK_WSI_swapchain",
.specVersion = 12
},
- {
- .extName = "VK_WSI_LunarG",
- .specVersion = 3
- }
};
VkResult anv_GetGlobalExtensionProperties(
@@ -662,6 +658,10 @@ VkResult anv_GetGlobalExtensionProperties(
}
static const VkExtensionProperties device_extensions[] = {
+ {
+ .extName = "VK_WSI_device_swapchain",
+ .specVersion = 12
+ },
};
VkResult anv_GetPhysicalDeviceExtensionProperties(
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h
index c09d4ad2f0d..06ef4e123f3 100644
--- a/src/vulkan/anv_private.h
+++ b/src/vulkan/anv_private.h
@@ -46,8 +46,8 @@
#define VK_PROTOTYPES
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_intel.h>
-#include <vulkan/vk_wsi_lunarg.h>
#include <vulkan/vk_wsi_swapchain.h>
+#include <vulkan/vk_wsi_device_swapchain.h>
#include "anv_entrypoints.h"
@@ -1060,8 +1060,6 @@ struct anv_image {
struct anv_bo *bo;
VkDeviceSize offset;
- struct anv_swap_chain *swap_chain;
-
/** RENDER_SURFACE_STATE.SurfaceType */
uint8_t surf_type;
@@ -1287,7 +1285,6 @@ ANV_DEFINE_HANDLE_CASTS(anv_device, VkDevice)
ANV_DEFINE_HANDLE_CASTS(anv_instance, VkInstance)
ANV_DEFINE_HANDLE_CASTS(anv_physical_device, VkPhysicalDevice)
ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue)
-ANV_DEFINE_HANDLE_CASTS(anv_swap_chain, VkSwapChainWSI);
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_cmd_pool, VkCmdPool)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_attachment_view, VkAttachmentView)
diff --git a/src/vulkan/anv_wsi.c b/src/vulkan/anv_wsi.c
index 5ae9b85e540..5c2dbb5fbca 100644
--- a/src/vulkan/anv_wsi.c
+++ b/src/vulkan/anv_wsi.c
@@ -21,7 +21,7 @@
* IN THE SOFTWARE.
*/
-#include "anv_private.h"
+#include "anv_wsi.h"
VkResult
anv_GetPhysicalDeviceSurfaceSupportWSI(
@@ -39,3 +39,147 @@ anv_GetPhysicalDeviceSurfaceSupportWSI(
return VK_SUCCESS;
}
+
+VkResult
+anv_GetSurfaceInfoWSI(
+ VkDevice _device,
+ const VkSurfaceDescriptionWSI* pSurfaceDescription,
+ VkSurfaceInfoTypeWSI infoType,
+ size_t* pDataSize,
+ void* pData)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+
+ assert(pSurfaceDescription->sType ==
+ VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI);
+ VkSurfaceDescriptionWindowWSI *window =
+ (VkSurfaceDescriptionWindowWSI *)pSurfaceDescription;
+
+ switch (window->platform) {
+ case VK_PLATFORM_XCB_WSI:
+ return anv_x11_get_surface_info(device, window, infoType,
+ pDataSize, pData);
+ default:
+ return vk_error(VK_ERROR_INVALID_VALUE);
+ }
+}
+
+VkResult
+anv_CreateSwapChainWSI(
+ VkDevice _device,
+ const VkSwapChainCreateInfoWSI* pCreateInfo,
+ VkSwapChainWSI* pSwapChain)
+{
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ struct anv_swap_chain *swap_chain;
+ VkResult result;
+
+ assert(pCreateInfo->pSurfaceDescription->sType ==
+ VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI);
+ VkSurfaceDescriptionWindowWSI *window =
+ (VkSurfaceDescriptionWindowWSI *)pCreateInfo->pSurfaceDescription;
+
+ switch (window->platform) {
+ case VK_PLATFORM_XCB_WSI:
+ result = anv_x11_create_swap_chain(device, pCreateInfo,
+ (void *)&swap_chain);
+ break;
+ default:
+ return vk_error(VK_ERROR_INVALID_VALUE);
+ }
+
+ if (result == VK_SUCCESS)
+ *pSwapChain = anv_swap_chain_to_handle(swap_chain);
+
+ return result;
+}
+
+VkResult
+anv_DestroySwapChainWSI(
+ VkDevice device,
+ VkSwapChainWSI swapChain)
+{
+ ANV_FROM_HANDLE(anv_swap_chain, swap_chain, swapChain);
+
+ assert(swap_chain->device == anv_device_from_handle(device));
+
+ switch (swap_chain->type) {
+ case ANV_SWAP_CHAIN_TYPE_X11:
+ return anv_x11_destroy_swap_chain((void *)swap_chain);
+ default:
+ return vk_error(VK_ERROR_INVALID_VALUE);
+ }
+}
+
+VkResult
+anv_GetSwapChainInfoWSI(
+ VkDevice device,
+ VkSwapChainWSI swapChain,
+ VkSwapChainInfoTypeWSI infoType,
+ size_t* pDataSize,
+ void* pData)
+{
+ ANV_FROM_HANDLE(anv_swap_chain, swap_chain, swapChain);
+
+ assert(swap_chain->device == anv_device_from_handle(device));
+
+ switch (swap_chain->type) {
+ case ANV_SWAP_CHAIN_TYPE_X11:
+ return anv_x11_get_swap_chain_info((void *)swap_chain,
+ infoType, pDataSize, pData);
+ default:
+ return vk_error(VK_ERROR_INVALID_VALUE);
+ }
+}
+
+VkResult
+anv_AcquireNextImageWSI(
+ VkDevice device,
+ VkSwapChainWSI swapChain,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ uint32_t* pImageIndex)
+{
+ ANV_FROM_HANDLE(anv_swap_chain, swap_chain, swapChain);
+
+ assert(swap_chain->device == anv_device_from_handle(device));
+
+ switch (swap_chain->type) {
+ case ANV_SWAP_CHAIN_TYPE_X11:
+ return anv_x11_acquire_next_image((void *)swap_chain,
+ timeout, semaphore, pImageIndex);
+ default:
+ return vk_error(VK_ERROR_INVALID_VALUE);
+ }
+}
+
+VkResult
+anv_QueuePresentWSI(
+ VkQueue _queue,
+ VkPresentInfoWSI* pPresentInfo)
+{
+ ANV_FROM_HANDLE(anv_queue, queue, _queue);
+ VkResult result;
+
+ for (uint32_t i = 0; i < pPresentInfo->swapChainCount; i++) {
+ ANV_FROM_HANDLE(anv_swap_chain, swap_chain, pPresentInfo->swapChains[i]);
+
+ assert(swap_chain->device == queue->device);
+
+ switch (swap_chain->type) {
+ case ANV_SWAP_CHAIN_TYPE_X11:
+ result = anv_x11_queue_present(queue, (void *)swap_chain,
+ pPresentInfo->imageIndices[i]);
+ /* TODO: What if one of them returns OUT_OF_DATE? */
+ if (result != VK_SUCCESS)
+ return result;
+ else
+ continue;
+
+ default:
+ return vk_error(VK_ERROR_INVALID_VALUE);
+ }
+ }
+
+ return VK_SUCCESS;
+}
diff --git a/src/vulkan/anv_wsi.h b/src/vulkan/anv_wsi.h
new file mode 100644
index 00000000000..1c1870f5453
--- /dev/null
+++ b/src/vulkan/anv_wsi.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "anv_private.h"
+
+enum anv_swap_chain_type {
+ ANV_SWAP_CHAIN_TYPE_X11 = 11,
+};
+
+struct anv_swap_chain {
+ enum anv_swap_chain_type type;
+
+ struct anv_device * device;
+};
+
+struct anv_x11_swap_chain;
+
+ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_swap_chain, VkSwapChainWSI)
+
+VkResult anv_x11_get_surface_info(struct anv_device *device,
+ VkSurfaceDescriptionWindowWSI *window,
+ VkSurfaceInfoTypeWSI infoType,
+ size_t* pDataSize, void* pData);
+VkResult anv_x11_create_swap_chain(struct anv_device *device,
+ const VkSwapChainCreateInfoWSI *pCreateInfo,
+ struct anv_x11_swap_chain **swap_chain);
+VkResult anv_x11_destroy_swap_chain(struct anv_x11_swap_chain *swap_chain);
+VkResult anv_x11_get_swap_chain_info(struct anv_x11_swap_chain *swap_chain,
+ VkSwapChainInfoTypeWSI infoType,
+ size_t* pDataSize, void* pData);
+VkResult anv_x11_acquire_next_image(struct anv_x11_swap_chain *swap_chain,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ uint32_t *image_index);
+VkResult anv_x11_queue_present(struct anv_queue *queue,
+ struct anv_x11_swap_chain *swap_chain,
+ uint32_t image_index);
diff --git a/src/vulkan/anv_wsi_x11.c b/src/vulkan/anv_wsi_x11.c
index 3c6d41aa79e..403949b3410 100644
--- a/src/vulkan/anv_wsi_x11.c
+++ b/src/vulkan/anv_wsi_x11.c
@@ -21,61 +21,86 @@
* IN THE SOFTWARE.
*/
-#include "anv_private.h"
-
#include <xcb/xcb.h>
#include <xcb/dri3.h>
#include <xcb/present.h>
+#include "anv_wsi.h"
+
static const VkFormat formats[] = {
VK_FORMAT_B5G6R5_UNORM,
VK_FORMAT_B8G8R8A8_UNORM,
VK_FORMAT_B8G8R8A8_SRGB,
};
-VkResult anv_GetDisplayInfoWSI(
- VkDisplayWSI display,
- VkDisplayInfoTypeWSI infoType,
- size_t* pDataSize,
- void* pData)
-{
- VkDisplayFormatPropertiesWSI *properties = pData;
- size_t size;
+static const VkSurfacePresentModePropertiesWSI present_modes[] = {
+ { VK_PRESENT_MODE_MAILBOX_WSI },
+};
+VkResult
+anv_x11_get_surface_info(struct anv_device *device,
+ VkSurfaceDescriptionWindowWSI *window,
+ VkSurfaceInfoTypeWSI infoType,
+ size_t* pDataSize, void* pData)
+{
if (pDataSize == NULL)
- return VK_ERROR_INVALID_POINTER;
+ return vk_error(VK_ERROR_INVALID_POINTER);
switch (infoType) {
- case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI:
- size = sizeof(properties[0]) * ARRAY_SIZE(formats);
+ case VK_SURFACE_INFO_TYPE_PROPERTIES_WSI: {
+ assert(*pDataSize >= sizeof(VkSurfacePropertiesWSI));
+ VkSurfacePropertiesWSI *props = pData;
+
+ props->minImageCount = 2;
+ props->maxImageCount = 4;
+ props->currentExtent = (VkExtent2D) { -1, -1 };
+ props->minImageExtent = (VkExtent2D) { 1, 1 };
+ props->maxImageExtent = (VkExtent2D) { INT16_MAX, INT16_MAX };
+ props->supportedTransforms = VK_SURFACE_TRANSFORM_NONE_BIT_WSI;
+ props->currentTransform = VK_SURFACE_TRANSFORM_NONE_WSI;
+ props->maxImageArraySize = 1;
+ props->supportedUsageFlags =
+ VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT |
+ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+ return VK_SUCCESS;
+ }
+
+ case VK_SURFACE_INFO_TYPE_FORMATS_WSI:
if (pData == NULL) {
- *pDataSize = size;
+ *pDataSize = sizeof(formats);
return VK_SUCCESS;
}
- if (*pDataSize < size)
- return vk_error(VK_ERROR_INVALID_VALUE);
+ assert(*pDataSize >= sizeof(formats));
+ memcpy(pData, formats, *pDataSize);
- *pDataSize = size;
+ return VK_SUCCESS;
- for (uint32_t i = 0; i < ARRAY_SIZE(formats); i++)
- properties[i].swapChainFormat = formats[i];
+ case VK_SURFACE_INFO_TYPE_PRESENT_MODES_WSI:
+ if (pData == NULL) {
+ *pDataSize = sizeof(present_modes);
+ return VK_SUCCESS;
+ }
- return VK_SUCCESS;
+ assert(*pDataSize >= sizeof(present_modes));
+ memcpy(pData, present_modes, *pDataSize);
+ return VK_SUCCESS;
default:
- return VK_UNSUPPORTED;
+ return vk_error(VK_ERROR_INVALID_VALUE);
}
}
-struct anv_swap_chain {
- struct anv_device * device;
+struct anv_x11_swap_chain {
+ struct anv_swap_chain base;
+
xcb_connection_t * conn;
xcb_window_t window;
xcb_gc_t gc;
VkExtent2D extent;
- uint32_t count;
+ uint32_t image_count;
+ uint32_t next_image;
struct {
struct anv_image * image;
struct anv_device_memory * memory;
@@ -83,41 +108,50 @@ struct anv_swap_chain {
} images[0];
};
-VkResult anv_CreateSwapChainWSI(
- VkDevice _device,
- const VkSwapChainCreateInfoWSI* pCreateInfo,
- VkSwapChainWSI* pSwapChain)
+VkResult
+anv_x11_create_swap_chain(struct anv_device *device,
+ const VkSwapChainCreateInfoWSI *pCreateInfo,
+ struct anv_x11_swap_chain **swap_chain_out)
{
- ANV_FROM_HANDLE(anv_device, device, _device);
-
- struct anv_swap_chain *chain;
+ struct anv_x11_swap_chain *chain;
xcb_void_cookie_t cookie;
VkResult result;
- size_t size;
- int ret;
+
+ assert(pCreateInfo->pSurfaceDescription->sType ==
+ VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI);
+ VkSurfaceDescriptionWindowWSI *vk_window =
+ (VkSurfaceDescriptionWindowWSI *)pCreateInfo->pSurfaceDescription;
+ assert(vk_window->platform == VK_PLATFORM_XCB_WSI);
+
+ int num_images = pCreateInfo->minImageCount;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI);
- size = sizeof(*chain) + pCreateInfo->imageCount * sizeof(chain->images[0]);
+ size_t size = sizeof(*chain) + num_images * sizeof(chain->images[0]);
chain = anv_device_alloc(device, size, 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (chain == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
- chain->device = device;
- chain->conn = (xcb_connection_t *) pCreateInfo->pNativeWindowSystemHandle;
- chain->window = (xcb_window_t) (uintptr_t) pCreateInfo->pNativeWindowHandle;
- chain->count = pCreateInfo->imageCount;
+ chain->base.type = ANV_SWAP_CHAIN_TYPE_X11;
+ chain->base.device = device;
+
+ VkPlatformHandleXcbWSI *vk_xcb_handle = vk_window->pPlatformHandle;
+
+ chain->conn = (xcb_connection_t *) vk_xcb_handle->connection;
+ chain->window = (xcb_window_t) (uintptr_t)vk_window->pPlatformWindow;
chain->extent = pCreateInfo->imageExtent;
+ chain->image_count = num_images;
+ chain->next_image = 0;
- for (uint32_t i = 0; i < chain->count; i++) {
+ for (uint32_t i = 0; i < chain->image_count; i++) {
VkDeviceMemory memory_h;
VkImage image_h;
struct anv_image *image;
struct anv_surface *surface;
struct anv_device_memory *memory;
- anv_image_create(_device,
+ anv_image_create(anv_device_to_handle(device),
&(struct anv_image_create_info) {
.force_tile_mode = true,
.tile_mode = XMAJOR,
@@ -147,7 +181,7 @@ VkResult anv_CreateSwapChainWSI(
surface = &image->color_surface;
- anv_AllocMemory(_device,
+ anv_AllocMemory(anv_device_to_handle(device),
&(VkMemoryAllocInfo) {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO,
.allocationSize = image->size,
@@ -160,8 +194,8 @@ VkResult anv_CreateSwapChainWSI(
anv_BindImageMemory(VK_NULL_HANDLE, anv_image_to_handle(image),
memory_h, 0);
- ret = anv_gem_set_tiling(device, memory->bo.gem_handle,
- surface->stride, I915_TILING_X);
+ int ret = anv_gem_set_tiling(device, memory->bo.gem_handle,
+ surface->stride, I915_TILING_X);
if (ret) {
result = vk_errorf(VK_ERROR_UNKNOWN, "set_tiling failed: %m");
goto fail;
@@ -190,7 +224,6 @@ VkResult anv_CreateSwapChainWSI(
chain->images[i].image = image;
chain->images[i].memory = memory;
chain->images[i].pixmap = pixmap;
- image->swap_chain = chain;
xcb_discard_reply(chain->conn, cookie.sequence);
}
@@ -208,7 +241,7 @@ VkResult anv_CreateSwapChainWSI(
(uint32_t []) { 0 });
xcb_discard_reply(chain->conn, cookie.sequence);
- *pSwapChain = anv_swap_chain_to_handle(chain);
+ *swap_chain_out = chain;
return VK_SUCCESS;
@@ -216,72 +249,66 @@ VkResult anv_CreateSwapChainWSI(
return result;
}
-VkResult anv_DestroySwapChainWSI(
- VkSwapChainWSI _chain)
+VkResult
+anv_x11_destroy_swap_chain(struct anv_x11_swap_chain *chain)
{
- ANV_FROM_HANDLE(anv_swap_chain, chain, _chain);
-
- anv_device_free(chain->device, chain);
+ anv_device_free(chain->base.device, chain);
return VK_SUCCESS;
}
-VkResult anv_GetSwapChainInfoWSI(
- VkSwapChainWSI _chain,
- VkSwapChainInfoTypeWSI infoType,
- size_t* pDataSize,
- void* pData)
+VkResult
+anv_x11_get_swap_chain_info(struct anv_x11_swap_chain *chain,
+ VkSwapChainInfoTypeWSI infoType,
+ size_t* pDataSize, void* pData)
{
- ANV_FROM_HANDLE(anv_swap_chain, chain, _chain);
-
- VkSwapChainImageInfoWSI *images;
size_t size;
switch (infoType) {
- case VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI:
- size = sizeof(*images) * chain->count;
- if (pData && *pDataSize < size)
- return VK_ERROR_INVALID_VALUE;
+ case VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI: {
+ VkSwapChainImagePropertiesWSI *images = pData;
- *pDataSize = size;
- if (!pData)
+ size = chain->image_count * sizeof(*images);
+
+ if (pData == NULL) {
+ *pDataSize = size;
return VK_SUCCESS;
+ }
- images = pData;
- for (uint32_t i = 0; i < chain->count; i++) {
+ assert(size <= *pDataSize);
+ for (uint32_t i = 0; i < chain->image_count; i++)
images[i].image = anv_image_to_handle(chain->images[i].image);
- images[i].memory = anv_device_memory_to_handle(chain->images[i].memory);
- }
+
+ *pDataSize = size;
return VK_SUCCESS;
+ }
default:
- return VK_UNSUPPORTED;
+ return vk_error(VK_ERROR_INVALID_VALUE);
}
}
-VkResult anv_QueuePresentWSI(
- VkQueue queue_,
- const VkPresentInfoWSI* pPresentInfo)
+VkResult
+anv_x11_acquire_next_image(struct anv_x11_swap_chain *chain,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ uint32_t *image_index)
{
- ANV_FROM_HANDLE(anv_image, image, pPresentInfo->image);
+ anv_finishme("Implement real blocking AcquireNextImage");
+ *image_index = chain->next_image;
+ chain->next_image = (chain->next_image + 1) % chain->image_count;
+ return VK_SUCCESS;
+}
- struct anv_swap_chain *chain = image->swap_chain;
+VkResult
+anv_x11_queue_present(struct anv_queue *queue,
+ struct anv_x11_swap_chain *chain,
+ uint32_t image_index)
+{
xcb_void_cookie_t cookie;
- xcb_pixmap_t pixmap;
-
- assert(pPresentInfo->sType == VK_STRUCTURE_TYPE_PRESENT_INFO_WSI);
- if (chain == NULL)
- return vk_error(VK_ERROR_INVALID_VALUE);
-
- pixmap = XCB_NONE;
- for (uint32_t i = 0; i < chain->count; i++) {
- if (image == chain->images[i].image) {
- pixmap = chain->images[i].pixmap;
- break;
- }
- }
+ xcb_pixmap_t pixmap = chain->images[image_index].pixmap;
if (pixmap == XCB_NONE)
return vk_error(VK_ERROR_INVALID_VALUE);