Lines Matching defs:chain
271 struct wsi_swapchain *chain,
280 memset(chain, 0, sizeof(*chain));
282 vk_object_base_init(device, &chain->base, VK_OBJECT_TYPE_SWAPCHAIN_KHR);
284 chain->wsi = wsi;
285 chain->device = _device;
286 chain->alloc = *pAllocator;
288 chain->use_buffer_blit = use_buffer_blit || (WSI_DEBUG & WSI_DEBUG_BUFFER);
290 chain->use_buffer_blit = true;
292 chain->buffer_blit_queue = VK_NULL_HANDLE;
294 chain->buffer_blit_queue = wsi->get_buffer_blit_queue(_device);
296 int cmd_pools_count = chain->buffer_blit_queue != VK_NULL_HANDLE ? 1 : wsi->queue_family_count;
298 chain->cmd_pools =
301 if (!chain->cmd_pools)
307 if (chain->buffer_blit_queue != VK_NULL_HANDLE) {
308 VK_FROM_HANDLE(vk_queue, queue, chain->buffer_blit_queue);
317 result = wsi->CreateCommandPool(_device, &cmd_pool_info, &chain->alloc,
318 &chain->cmd_pools[i]);
326 wsi_swapchain_finish(chain);
384 wsi_swapchain_finish(struct wsi_swapchain *chain)
386 if (chain->fences) {
387 for (unsigned i = 0; i < chain->image_count; i++)
388 chain->wsi->DestroyFence(chain->device, chain->fences[i], &chain->alloc);
390 vk_free(&chain->alloc, chain->fences);
392 if (chain->buffer_blit_semaphores) {
393 for (unsigned i = 0; i < chain->image_count; i++)
394 chain->wsi->DestroySemaphore(chain->device, chain->buffer_blit_semaphores[i], &chain->alloc);
396 vk_free(&chain->alloc, chain->buffer_blit_semaphores);
398 chain->wsi->DestroySemaphore(chain->device, chain->dma_buf_semaphore,
399 &chain->alloc);
401 int cmd_pools_count = chain->buffer_blit_queue != VK_NULL_HANDLE ?
402 1 : chain->wsi->queue_family_count;
404 chain->wsi->DestroyCommandPool(chain->device, chain->cmd_pools[i],
405 &chain->alloc);
407 vk_free(&chain->alloc, chain->cmd_pools);
409 vk_object_base_finish(&chain->base);
413 wsi_configure_image(const struct wsi_swapchain *chain,
429 vk_alloc(&chain->alloc,
486 vk_alloc(&chain->alloc, sizeof(VkFormat) * view_format_count,
510 wsi_destroy_image_info(chain, info);
515 wsi_destroy_image_info(const struct wsi_swapchain *chain,
518 vk_free(&chain->alloc, (void *)info->create.pQueueFamilyIndices);
519 vk_free(&chain->alloc, (void *)info->format_list.pViewFormats);
520 vk_free(&chain->alloc, (void *)info->drm_mod_list.pDrmFormatModifiers);
521 vk_free(&chain->alloc, info->modifier_props);
525 wsi_create_image(const struct wsi_swapchain *chain,
529 const struct wsi_device *wsi = chain->wsi;
538 result = wsi->CreateImage(chain->device, &info->create,
539 &chain->alloc, &image->image);
543 result = info->create_mem(chain, info, image);
547 result = wsi->BindImageMemory(chain->device, image->image,
553 result = info->finish_create(chain, info, image);
561 wsi_destroy_image(chain, image);
566 wsi_destroy_image(const struct wsi_swapchain *chain,
569 const struct wsi_device *wsi = chain->wsi;
577 wsi->UnmapMemory(chain->device, image->buffer.buffer != VK_NULL_HANDLE ?
583 chain->buffer_blit_queue != VK_NULL_HANDLE ? 1 : wsi->queue_family_count;
586 wsi->FreeCommandBuffers(chain->device, chain->cmd_pools[i],
589 vk_free(&chain->alloc, image->buffer.blit_cmd_buffers);
592 wsi->FreeMemory(chain->device, image->memory, &chain->alloc);
593 wsi->DestroyImage(chain->device, image->image, &chain->alloc);
594 wsi->FreeMemory(chain->device, image->buffer.memory, &chain->alloc);
595 wsi->DestroyBuffer(chain->device, image->buffer.buffer, &chain->alloc);
888 const struct wsi_swapchain *chain,
900 VkResult result = wsi_create_sync_for_dma_buf_wait(chain, image,
907 if (chain->wsi->signal_semaphore_with_memory) {
920 const struct wsi_swapchain *chain,
932 VkResult result = wsi_create_sync_for_dma_buf_wait(chain, image,
939 if (chain->wsi->signal_fence_with_memory) {
1224 VK_FROM_HANDLE(wsi_swapchain, chain, _swapchain);
1227 const VkImageCreateInfo *swcInfo = &chain->image_info.create;
1246 &chain->image_info.format_list;
1270 return wsi->CreateImage(chain->device, &chain->image_info.create,
1271 &chain->alloc, pImage);
1280 VK_FROM_HANDLE(wsi_swapchain, chain, _swapchain);
1281 struct wsi_image *image = chain->get_wsi_image(chain, image_idx);
1283 return wsi->BindImageMemory(chain->device, vk_image, image->memory, 0);
1337 wsi_create_buffer_image_mem(const struct wsi_swapchain *chain,
1343 const struct wsi_device *wsi = chain->wsi;
1358 result = wsi->CreateBuffer(chain->device, &buffer_info,
1359 &chain->alloc, &image->buffer.buffer);
1364 wsi->GetBufferMemoryRequirements(chain->device, image->buffer.buffer, &reqs);
1407 result = wsi->AllocateMemory(chain->device, &buf_mem_info,
1408 &chain->alloc, &image->buffer.memory);
1412 result = wsi->BindBufferMemory(chain->device, image->buffer.buffer,
1417 wsi->GetImageMemoryRequirements(chain->device, image->image, &reqs);
1433 result = wsi->AllocateMemory(chain->device, &memory_info,
1434 &chain->alloc, &image->memory);
1447 wsi_finish_create_buffer_image(const struct wsi_swapchain *chain,
1451 const struct wsi_device *wsi = chain->wsi;
1455 chain->buffer_blit_queue != VK_NULL_HANDLE ? 1 : wsi->queue_family_count;
1457 vk_zalloc(&chain->alloc,
1467 .commandPool = chain->cmd_pools[i],
1471 result = wsi->AllocateCommandBuffers(chain->device, &cmd_buffer_info,
1548 wsi_configure_buffer_image(UNUSED const struct wsi_swapchain *chain,
1553 const struct wsi_device *wsi = chain->wsi;
1558 VkResult result = wsi_configure_image(chain, pCreateInfo,
1586 wsi_create_cpu_linear_image_mem(const struct wsi_swapchain *chain,
1590 const struct wsi_device *wsi = chain->wsi;
1594 wsi->GetImageMemoryRequirements(chain->device, image->image, &reqs);
1597 wsi->GetImageSubresourceLayout(chain->device, image->image,
1632 result = wsi->AllocateMemory(chain->device, &memory_info,
1633 &chain->alloc, &image->memory);
1637 result = wsi->MapMemory(chain->device, image->memory,
1651 wsi_create_cpu_buffer_image_mem(const struct wsi_swapchain *chain,
1657 result = wsi_create_buffer_image_mem(chain, info, image, 0,
1662 result = chain->wsi->MapMemory(chain->device, image->buffer.memory,
1671 wsi_configure_cpu_image(const struct wsi_swapchain *chain,
1680 if (chain->use_buffer_blit) {
1681 VkResult result = wsi_configure_buffer_image(chain, pCreateInfo,
1692 VkResult result = wsi_configure_image(chain, pCreateInfo,