• Home
  • Raw
  • Download

Lines Matching refs:chain

647    struct x11_swapchain *chain = (struct x11_swapchain *)wsi_chain;  in x11_get_wsi_image()  local
648 return &chain->images[image_index].base; in x11_get_wsi_image()
652 x11_handle_dri3_present_event(struct x11_swapchain *chain, in x11_handle_dri3_present_event() argument
659 if (config->width != chain->extent.width || in x11_handle_dri3_present_event()
660 config->height != chain->extent.height) in x11_handle_dri3_present_event()
669 for (unsigned i = 0; i < chain->base.image_count; i++) { in x11_handle_dri3_present_event()
670 if (chain->images[i].pixmap == idle->pixmap) { in x11_handle_dri3_present_event()
671 chain->images[i].busy = false; in x11_handle_dri3_present_event()
672 if (chain->threaded) in x11_handle_dri3_present_event()
673 wsi_queue_push(&chain->acquire_queue, i); in x11_handle_dri3_present_event()
684 chain->last_present_msc = complete->msc; in x11_handle_dri3_present_event()
716 x11_acquire_next_image_poll_x11(struct x11_swapchain *chain, in x11_acquire_next_image_poll_x11() argument
723 for (uint32_t i = 0; i < chain->base.image_count; i++) { in x11_acquire_next_image_poll_x11()
724 if (!chain->images[i].busy) { in x11_acquire_next_image_poll_x11()
726 xshmfence_await(chain->images[i].shm_fence); in x11_acquire_next_image_poll_x11()
728 chain->images[i].busy = true; in x11_acquire_next_image_poll_x11()
733 xcb_flush(chain->conn); in x11_acquire_next_image_poll_x11()
736 event = xcb_wait_for_special_event(chain->conn, chain->special_event); in x11_acquire_next_image_poll_x11()
740 event = xcb_poll_for_special_event(chain->conn, chain->special_event); in x11_acquire_next_image_poll_x11()
748 pfds.fd = xcb_get_file_descriptor(chain->conn); in x11_acquire_next_image_poll_x11()
768 VkResult result = x11_handle_dri3_present_event(chain, (void *)event); in x11_acquire_next_image_poll_x11()
776 x11_acquire_next_image_from_queue(struct x11_swapchain *chain, in x11_acquire_next_image_from_queue() argument
779 assert(chain->threaded); in x11_acquire_next_image_from_queue()
782 VkResult result = wsi_queue_pull(&chain->acquire_queue, in x11_acquire_next_image_from_queue()
786 } else if (chain->status != VK_SUCCESS) { in x11_acquire_next_image_from_queue()
787 return chain->status; in x11_acquire_next_image_from_queue()
790 assert(image_index < chain->base.image_count); in x11_acquire_next_image_from_queue()
791 xshmfence_await(chain->images[image_index].shm_fence); in x11_acquire_next_image_from_queue()
799 x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index, in x11_present_to_x11() argument
802 struct x11_image *image = &chain->images[image_index]; in x11_present_to_x11()
804 assert(image_index < chain->base.image_count); in x11_present_to_x11()
811 if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR) in x11_present_to_x11()
816 ++chain->send_sbc; in x11_present_to_x11()
818 xcb_present_pixmap(chain->conn, in x11_present_to_x11()
819 chain->window, in x11_present_to_x11()
821 (uint32_t) chain->send_sbc, in x11_present_to_x11()
833 xcb_discard_reply(chain->conn, cookie.sequence); in x11_present_to_x11()
836 xcb_flush(chain->conn); in x11_present_to_x11()
847 struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain; in x11_acquire_next_image() local
849 if (chain->threaded) { in x11_acquire_next_image()
850 return x11_acquire_next_image_from_queue(chain, image_index, timeout); in x11_acquire_next_image()
852 return x11_acquire_next_image_poll_x11(chain, image_index, timeout); in x11_acquire_next_image()
861 struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain; in x11_queue_present() local
863 if (chain->threaded) { in x11_queue_present()
864 wsi_queue_push(&chain->present_queue, image_index); in x11_queue_present()
865 return chain->status; in x11_queue_present()
867 return x11_present_to_x11(chain, image_index, 0); in x11_queue_present()
874 struct x11_swapchain *chain = state; in x11_manage_fifo_queues() local
877 assert(chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR); in x11_manage_fifo_queues()
879 while (chain->status == VK_SUCCESS) { in x11_manage_fifo_queues()
887 result = wsi_queue_pull(&chain->present_queue, &image_index, INT64_MAX); in x11_manage_fifo_queues()
890 } else if (chain->status != VK_SUCCESS) { in x11_manage_fifo_queues()
894 uint64_t target_msc = chain->last_present_msc + 1; in x11_manage_fifo_queues()
895 result = x11_present_to_x11(chain, image_index, target_msc); in x11_manage_fifo_queues()
899 while (chain->last_present_msc < target_msc) { in x11_manage_fifo_queues()
901 xcb_wait_for_special_event(chain->conn, chain->special_event); in x11_manage_fifo_queues()
907 result = x11_handle_dri3_present_event(chain, (void *)event); in x11_manage_fifo_queues()
915 chain->status = result; in x11_manage_fifo_queues()
916 wsi_queue_push(&chain->acquire_queue, UINT32_MAX); in x11_manage_fifo_queues()
922 x11_image_init(VkDevice device_h, struct x11_swapchain *chain, in x11_image_init() argument
931 if (chain->base.use_prime_blit) { in x11_image_init()
932 result = wsi_create_prime_image(&chain->base, pCreateInfo, &image->base); in x11_image_init()
934 result = wsi_create_native_image(&chain->base, pCreateInfo, &image->base); in x11_image_init()
939 image->pixmap = xcb_generate_id(chain->conn); in x11_image_init()
942 xcb_dri3_pixmap_from_buffer_checked(chain->conn, in x11_image_init()
944 chain->window, in x11_image_init()
949 chain->depth, bpp, in x11_image_init()
951 xcb_discard_reply(chain->conn, cookie.sequence); in x11_image_init()
962 image->sync_fence = xcb_generate_id(chain->conn); in x11_image_init()
963 xcb_dri3_fence_from_fd(chain->conn, in x11_image_init()
978 cookie = xcb_free_pixmap(chain->conn, image->pixmap); in x11_image_init()
979 xcb_discard_reply(chain->conn, cookie.sequence); in x11_image_init()
981 wsi_destroy_image(&chain->base, &image->base); in x11_image_init()
987 x11_image_finish(struct x11_swapchain *chain, in x11_image_finish() argument
993 cookie = xcb_sync_destroy_fence(chain->conn, image->sync_fence); in x11_image_finish()
994 xcb_discard_reply(chain->conn, cookie.sequence); in x11_image_finish()
997 cookie = xcb_free_pixmap(chain->conn, image->pixmap); in x11_image_finish()
998 xcb_discard_reply(chain->conn, cookie.sequence); in x11_image_finish()
1000 wsi_destroy_image(&chain->base, &image->base); in x11_image_finish()
1007 struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain; in x11_swapchain_destroy() local
1010 for (uint32_t i = 0; i < chain->base.image_count; i++) in x11_swapchain_destroy()
1011 x11_image_finish(chain, pAllocator, &chain->images[i]); in x11_swapchain_destroy()
1013 if (chain->threaded) { in x11_swapchain_destroy()
1014 chain->status = VK_ERROR_OUT_OF_DATE_KHR; in x11_swapchain_destroy()
1016 wsi_queue_push(&chain->present_queue, UINT32_MAX); in x11_swapchain_destroy()
1017 pthread_join(chain->queue_manager, NULL); in x11_swapchain_destroy()
1018 wsi_queue_destroy(&chain->acquire_queue); in x11_swapchain_destroy()
1019 wsi_queue_destroy(&chain->present_queue); in x11_swapchain_destroy()
1022 xcb_unregister_for_special_event(chain->conn, chain->special_event); in x11_swapchain_destroy()
1023 cookie = xcb_present_select_input_checked(chain->conn, chain->event_id, in x11_swapchain_destroy()
1024 chain->window, in x11_swapchain_destroy()
1026 xcb_discard_reply(chain->conn, cookie.sequence); in x11_swapchain_destroy()
1028 wsi_swapchain_finish(&chain->base); in x11_swapchain_destroy()
1030 vk_free(pAllocator, chain); in x11_swapchain_destroy()
1044 struct x11_swapchain *chain; in x11_surface_create_swapchain() local
1062 size_t size = sizeof(*chain) + num_images * sizeof(chain->images[0]); in x11_surface_create_swapchain()
1063 chain = vk_alloc(pAllocator, size, 8, in x11_surface_create_swapchain()
1065 if (chain == NULL) in x11_surface_create_swapchain()
1068 result = wsi_swapchain_init(wsi_device, &chain->base, device, in x11_surface_create_swapchain()
1073 chain->base.destroy = x11_swapchain_destroy; in x11_surface_create_swapchain()
1074 chain->base.get_wsi_image = x11_get_wsi_image; in x11_surface_create_swapchain()
1075 chain->base.acquire_next_image = x11_acquire_next_image; in x11_surface_create_swapchain()
1076 chain->base.queue_present = x11_queue_present; in x11_surface_create_swapchain()
1077 chain->base.present_mode = pCreateInfo->presentMode; in x11_surface_create_swapchain()
1078 chain->base.image_count = num_images; in x11_surface_create_swapchain()
1079 chain->conn = conn; in x11_surface_create_swapchain()
1080 chain->window = window; in x11_surface_create_swapchain()
1081 chain->depth = bit_depth; in x11_surface_create_swapchain()
1082 chain->extent = pCreateInfo->imageExtent; in x11_surface_create_swapchain()
1083 chain->send_sbc = 0; in x11_surface_create_swapchain()
1084 chain->last_present_msc = 0; in x11_surface_create_swapchain()
1085 chain->threaded = false; in x11_surface_create_swapchain()
1086 chain->status = VK_SUCCESS; in x11_surface_create_swapchain()
1089 chain->base.use_prime_blit = true; in x11_surface_create_swapchain()
1091 chain->event_id = xcb_generate_id(chain->conn); in x11_surface_create_swapchain()
1092 xcb_present_select_input(chain->conn, chain->event_id, chain->window, in x11_surface_create_swapchain()
1100 chain->special_event = in x11_surface_create_swapchain()
1101 xcb_register_for_special_xge(chain->conn, &xcb_present_id, in x11_surface_create_swapchain()
1102 chain->event_id, NULL); in x11_surface_create_swapchain()
1104 chain->gc = xcb_generate_id(chain->conn); in x11_surface_create_swapchain()
1105 if (!chain->gc) { in x11_surface_create_swapchain()
1111 cookie = xcb_create_gc(chain->conn, in x11_surface_create_swapchain()
1112 chain->gc, in x11_surface_create_swapchain()
1113 chain->window, in x11_surface_create_swapchain()
1116 xcb_discard_reply(chain->conn, cookie.sequence); in x11_surface_create_swapchain()
1119 for (; image < chain->base.image_count; image++) { in x11_surface_create_swapchain()
1120 result = x11_image_init(device, chain, pCreateInfo, pAllocator, in x11_surface_create_swapchain()
1121 &chain->images[image]); in x11_surface_create_swapchain()
1126 if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) { in x11_surface_create_swapchain()
1127 chain->threaded = true; in x11_surface_create_swapchain()
1134 ret = wsi_queue_init(&chain->acquire_queue, chain->base.image_count + 1); in x11_surface_create_swapchain()
1139 ret = wsi_queue_init(&chain->present_queue, chain->base.image_count + 1); in x11_surface_create_swapchain()
1141 wsi_queue_destroy(&chain->acquire_queue); in x11_surface_create_swapchain()
1145 for (unsigned i = 0; i < chain->base.image_count; i++) in x11_surface_create_swapchain()
1146 wsi_queue_push(&chain->acquire_queue, i); in x11_surface_create_swapchain()
1148 ret = pthread_create(&chain->queue_manager, NULL, in x11_surface_create_swapchain()
1149 x11_manage_fifo_queues, chain); in x11_surface_create_swapchain()
1151 wsi_queue_destroy(&chain->present_queue); in x11_surface_create_swapchain()
1152 wsi_queue_destroy(&chain->acquire_queue); in x11_surface_create_swapchain()
1157 *swapchain_out = &chain->base; in x11_surface_create_swapchain()
1163 x11_image_finish(chain, pAllocator, &chain->images[j]); in x11_surface_create_swapchain()
1166 xcb_unregister_for_special_event(chain->conn, chain->special_event); in x11_surface_create_swapchain()
1168 wsi_swapchain_finish(&chain->base); in x11_surface_create_swapchain()
1171 vk_free(pAllocator, chain); in x11_surface_create_swapchain()