Lines Matching refs:swapchain

344 VkSwapchainKHR HandleFromSwapchain(Swapchain* swapchain) {  in HandleFromSwapchain()  argument
345 return VkSwapchainKHR(reinterpret_cast<uint64_t>(swapchain)); in HandleFromSwapchain()
424 void OrphanSwapchain(VkDevice device, Swapchain* swapchain) { in OrphanSwapchain() argument
425 if (swapchain->surface.swapchain_handle != HandleFromSwapchain(swapchain)) in OrphanSwapchain()
427 for (uint32_t i = 0; i < swapchain->num_images; i++) { in OrphanSwapchain()
428 if (!swapchain->images[i].dequeued) { in OrphanSwapchain()
429 ReleaseSwapchainImage(device, swapchain->shared, nullptr, -1, in OrphanSwapchain()
430 swapchain->images[i], true); in OrphanSwapchain()
433 swapchain->surface.swapchain_handle = VK_NULL_HANDLE; in OrphanSwapchain()
434 swapchain->timing.clear(); in OrphanSwapchain()
437 uint32_t get_num_ready_timings(Swapchain& swapchain) { in get_num_ready_timings() argument
438 if (swapchain.timing.size() < MIN_NUM_FRAMES_AGO) { in get_num_ready_timings()
443 const size_t num_timings = swapchain.timing.size() - MIN_NUM_FRAMES_AGO + 1; in get_num_ready_timings()
445 TimingInfo& ti = swapchain.timing[i]; in get_num_ready_timings()
461 swapchain.surface.window.get(), ti.native_frame_id_, in get_num_ready_timings()
486 ti.calculate(swapchain.refresh_duration); in get_num_ready_timings()
493 void copy_ready_timings(Swapchain& swapchain, in copy_ready_timings() argument
496 if (swapchain.timing.empty()) { in copy_ready_timings()
501 size_t last_ready = swapchain.timing.size() - 1; in copy_ready_timings()
502 while (!swapchain.timing[last_ready].ready()) { in copy_ready_timings()
513 const TimingInfo& ti = swapchain.timing[i]; in copy_ready_timings()
523 swapchain.timing.erase(swapchain.timing.begin(), in copy_ready_timings()
524 swapchain.timing.begin() + num_to_remove); in copy_ready_timings()
1380 Swapchain* swapchain = SwapchainFromHandle(swapchain_handle); in DestroySwapchainInternal() local
1381 if (!swapchain) { in DestroySwapchainInternal()
1385 bool active = swapchain->surface.swapchain_handle == swapchain_handle; in DestroySwapchainInternal()
1386 ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr; in DestroySwapchainInternal()
1388 if (window && swapchain->frame_timestamps_enabled) { in DestroySwapchainInternal()
1392 for (uint32_t i = 0; i < swapchain->num_images; i++) { in DestroySwapchainInternal()
1393 ReleaseSwapchainImage(device, swapchain->shared, window, -1, in DestroySwapchainInternal()
1394 swapchain->images[i], false); in DestroySwapchainInternal()
1398 swapchain->surface.swapchain_handle = VK_NULL_HANDLE; in DestroySwapchainInternal()
1405 swapchain->~Swapchain(); in DestroySwapchainInternal()
1406 allocator->pfnFree(allocator->pUserData, swapchain); in DestroySwapchainInternal()
1968 Swapchain* swapchain = new (mem) in CreateSwapchainKHR() local
2019 .swapchain = HandleFromSwapchain(swapchain), in CreateSwapchainKHR()
2024 Swapchain::Image& img = swapchain->images[i]; in CreateSwapchainKHR()
2039 Swapchain::Image& img = swapchain->images[i]; in CreateSwapchainKHR()
2084 Swapchain::Image& img = swapchain->images[i]; in CreateSwapchainKHR()
2086 if (!swapchain->shared) { in CreateSwapchainKHR()
2097 DestroySwapchainInternal(device, HandleFromSwapchain(swapchain), in CreateSwapchainKHR()
2102 if (transform_hint != swapchain->pre_transform) { in CreateSwapchainKHR()
2113 surface.swapchain_handle = HandleFromSwapchain(swapchain); in CreateSwapchainKHR()
2134 Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle); in GetSwapchainImagesKHR() local
2135 ALOGW_IF(swapchain.surface.swapchain_handle != swapchain_handle, in GetSwapchainImagesKHR()
2141 uint32_t n = swapchain.num_images; in GetSwapchainImagesKHR()
2142 if (*count < swapchain.num_images) { in GetSwapchainImagesKHR()
2147 images[i] = swapchain.images[i].image; in GetSwapchainImagesKHR()
2150 *count = swapchain.num_images; in GetSwapchainImagesKHR()
2164 Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle); in AcquireNextImageKHR() local
2165 ANativeWindow* window = swapchain.surface.window.get(); in AcquireNextImageKHR()
2169 if (swapchain.surface.swapchain_handle != swapchain_handle) in AcquireNextImageKHR()
2172 if (swapchain.shared) { in AcquireNextImageKHR()
2178 device, swapchain.images[*image_index].image, -1, semaphore, vk_fence); in AcquireNextImageKHR()
2184 if (acquire_next_image_timeout != swapchain.acquire_next_image_timeout) { in AcquireNextImageKHR()
2193 swapchain.acquire_next_image_timeout = acquire_next_image_timeout; in AcquireNextImageKHR()
2208 for (idx = 0; idx < swapchain.num_images; idx++) { in AcquireNextImageKHR()
2209 if (swapchain.images[idx].buffer.get() == buffer) { in AcquireNextImageKHR()
2210 swapchain.images[idx].dequeued = true; in AcquireNextImageKHR()
2211 swapchain.images[idx].dequeue_fence = fence_fd; in AcquireNextImageKHR()
2222 if (idx == swapchain.num_images) { in AcquireNextImageKHR()
2223 for (idx = 0; idx < swapchain.num_images; idx++) { in AcquireNextImageKHR()
2224 if (!swapchain.images[idx].buffer) { in AcquireNextImageKHR()
2234 .swapchain = swapchain_handle, in AcquireNextImageKHR()
2253 .image = swapchain.images[idx].image, in AcquireNextImageKHR()
2267 swapchain.images[idx].dequeued = true; in AcquireNextImageKHR()
2268 swapchain.images[idx].dequeue_fence = fence_fd; in AcquireNextImageKHR()
2269 swapchain.images[idx].buffer = buffer; in AcquireNextImageKHR()
2278 if (idx == swapchain.num_images) { in AcquireNextImageKHR()
2295 device, swapchain.images[idx].image, fence_clone, semaphore, vk_fence); in AcquireNextImageKHR()
2305 swapchain.images[idx].dequeued = false; in AcquireNextImageKHR()
2306 swapchain.images[idx].dequeue_fence = -1; in AcquireNextImageKHR()
2320 return AcquireNextImageKHR(device, pAcquireInfo->swapchain, in AcquireNextImage2KHR()
2364 static void SetSwapchainFrameTimestamp(Swapchain &swapchain, const VkPresentTimeGOOGLE *pTime) { in SetSwapchainFrameTimestamp() argument
2365 ANativeWindow *window = swapchain.surface.window.get(); in SetSwapchainFrameTimestamp()
2370 if (!swapchain.frame_timestamps_enabled) { in SetSwapchainFrameTimestamp()
2373 swapchain.frame_timestamps_enabled = true; in SetSwapchainFrameTimestamp()
2387 swapchain.timing.emplace_back(pTime, nativeFrameId); in SetSwapchainFrameTimestamp()
2388 if (swapchain.timing.size() > MAX_TIMING_INFOS) { in SetSwapchainFrameTimestamp()
2389 swapchain.timing.erase( in SetSwapchainFrameTimestamp()
2390 swapchain.timing.begin(), in SetSwapchainFrameTimestamp()
2391 swapchain.timing.begin() + swapchain.timing.size() - MAX_TIMING_INFOS); in SetSwapchainFrameTimestamp()
2423 Swapchain& swapchain, in PresentOneSwapchain() argument
2435 Swapchain::Image& img = swapchain.images[imageIndex]; in PresentOneSwapchain()
2455 if (swapchain.surface.swapchain_handle == HandleFromSwapchain(&swapchain)) { in PresentOneSwapchain()
2456 ANativeWindow* window = swapchain.surface.window.get(); in PresentOneSwapchain()
2479 SetSwapchainFrameTimestamp(swapchain, pTime); in PresentOneSwapchain()
2505 if (swapchain.shared && swapchain_result == VK_SUCCESS) { in PresentOneSwapchain()
2524 OrphanSwapchain(device, &swapchain); in PresentOneSwapchain()
2540 if (swapchain.pre_transform != window_transform_hint) { in PresentOneSwapchain()
2545 ReleaseSwapchainImage(device, swapchain.shared, nullptr, fence, in PresentOneSwapchain()
2618 Swapchain& swapchain = in QueuePresentKHR() local
2623 swapchain, in QueuePresentKHR()
2625 (regions && !swapchain.mailbox_mode) ? &regions[sc] : nullptr, in QueuePresentKHR()
2649 Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle); in GetRefreshCycleDurationGOOGLE() local
2650 VkResult result = swapchain.get_refresh_duration(pDisplayTimingProperties->refreshDuration); in GetRefreshCycleDurationGOOGLE()
2663 Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle); in GetPastPresentationTimingGOOGLE() local
2664 if (swapchain.surface.swapchain_handle != swapchain_handle) { in GetPastPresentationTimingGOOGLE()
2668 ANativeWindow* window = swapchain.surface.window.get(); in GetPastPresentationTimingGOOGLE()
2671 if (!swapchain.frame_timestamps_enabled) { in GetPastPresentationTimingGOOGLE()
2674 swapchain.frame_timestamps_enabled = true; in GetPastPresentationTimingGOOGLE()
2680 uint32_t n = get_num_ready_timings(swapchain); in GetPastPresentationTimingGOOGLE()
2681 copy_ready_timings(swapchain, count, timings); in GetPastPresentationTimingGOOGLE()
2688 *count = get_num_ready_timings(swapchain); in GetPastPresentationTimingGOOGLE()
2700 Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle); in GetSwapchainStatusKHR() local
2703 if (swapchain.surface.swapchain_handle != swapchain_handle) { in GetSwapchainStatusKHR()
2720 Swapchain* swapchain = SwapchainFromHandle(pSwapchains[idx]); in SetHdrMetadataEXT() local
2721 if (!swapchain) in SetHdrMetadataEXT()
2724 if (swapchain->surface.swapchain_handle != pSwapchains[idx]) continue; in SetHdrMetadataEXT()
2726 ANativeWindow* window = swapchain->surface.window.get(); in SetHdrMetadataEXT()
2776 ALOG_ASSERT(info->swapchain != VK_NULL_HANDLE, in InterceptBindImageMemory2()
2778 const Swapchain* swapchain = SwapchainFromHandle(info->swapchain); in InterceptBindImageMemory2() local
2780 info->imageIndex < swapchain->num_images, in InterceptBindImageMemory2()
2784 swapchain->images[info->imageIndex].buffer.get(); in InterceptBindImageMemory2()
2861 Swapchain& swapchain = *SwapchainFromHandle(pReleaseInfo->swapchain); in ReleaseSwapchainImagesEXT() local
2862 ANativeWindow* window = swapchain.surface.window.get(); in ReleaseSwapchainImagesEXT()
2866 if (swapchain.shared) in ReleaseSwapchainImagesEXT()
2870 Swapchain::Image& img = swapchain.images[pReleaseInfo->pImageIndices[i]]; in ReleaseSwapchainImagesEXT()