Lines Matching full:chain
765 struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; in wsi_wl_swapchain_get_wsi_image() local
766 return &chain->images[image_index].base; in wsi_wl_swapchain_get_wsi_image()
774 struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; in wsi_wl_swapchain_acquire_next_image() local
777 int wl_fd = wl_display_get_fd(chain->display->wl_display); in wsi_wl_swapchain_acquire_next_image()
786 int ret = wl_display_dispatch_queue_pending(chain->display->wl_display, in wsi_wl_swapchain_acquire_next_image()
787 chain->display->queue); in wsi_wl_swapchain_acquire_next_image()
792 for (uint32_t i = 0; i < chain->base.image_count; i++) { in wsi_wl_swapchain_acquire_next_image()
793 if (!chain->images[i].busy) { in wsi_wl_swapchain_acquire_next_image()
796 chain->images[i].busy = true; in wsi_wl_swapchain_acquire_next_image()
808 ret = wl_display_prepare_read_queue(chain->display->wl_display, in wsi_wl_swapchain_acquire_next_image()
809 chain->display->queue); in wsi_wl_swapchain_acquire_next_image()
827 wl_display_cancel_read(chain->display->wl_display); in wsi_wl_swapchain_acquire_next_image()
838 ret = wl_display_read_events(chain->display->wl_display); in wsi_wl_swapchain_acquire_next_image()
847 struct wsi_wl_swapchain *chain = data; in frame_handle_done() local
849 chain->frame = NULL; in frame_handle_done()
850 chain->fifo_ready = true; in frame_handle_done()
864 struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; in wsi_wl_swapchain_queue_present() local
866 if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) { in wsi_wl_swapchain_queue_present()
867 while (!chain->fifo_ready) { in wsi_wl_swapchain_queue_present()
868 int ret = wl_display_dispatch_queue(chain->display->wl_display, in wsi_wl_swapchain_queue_present()
869 chain->display->queue); in wsi_wl_swapchain_queue_present()
875 assert(image_index < chain->base.image_count); in wsi_wl_swapchain_queue_present()
876 wl_surface_attach(chain->surface, chain->images[image_index].buffer, 0, 0); in wsi_wl_swapchain_queue_present()
878 if (chain->surface_version >= 4 && damage && in wsi_wl_swapchain_queue_present()
883 wl_surface_damage_buffer(chain->surface, in wsi_wl_swapchain_queue_present()
888 wl_surface_damage(chain->surface, 0, 0, INT32_MAX, INT32_MAX); in wsi_wl_swapchain_queue_present()
891 if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) { in wsi_wl_swapchain_queue_present()
892 chain->frame = wl_surface_frame(chain->surface); in wsi_wl_swapchain_queue_present()
893 wl_callback_add_listener(chain->frame, &frame_listener, chain); in wsi_wl_swapchain_queue_present()
894 chain->fifo_ready = false; in wsi_wl_swapchain_queue_present()
897 chain->images[image_index].busy = true; in wsi_wl_swapchain_queue_present()
898 wl_surface_commit(chain->surface); in wsi_wl_swapchain_queue_present()
899 wl_display_flush(chain->display->wl_display); in wsi_wl_swapchain_queue_present()
919 wsi_wl_image_init(struct wsi_wl_swapchain *chain, in wsi_wl_image_init() argument
924 struct wsi_wl_display *display = chain->display; in wsi_wl_image_init()
927 result = wsi_create_native_image(&chain->base, pCreateInfo, in wsi_wl_image_init()
928 chain->num_drm_modifiers > 0 ? 1 : 0, in wsi_wl_image_init()
929 &chain->num_drm_modifiers, in wsi_wl_image_init()
930 &chain->drm_modifiers, &image->base); in wsi_wl_image_init()
935 if (!chain->drm_wrapper) { in wsi_wl_image_init()
942 wl_proxy_set_queue((struct wl_proxy *) params, chain->display->queue); in wsi_wl_image_init()
957 chain->extent.width, in wsi_wl_image_init()
958 chain->extent.height, in wsi_wl_image_init()
959 chain->drm_format, in wsi_wl_image_init()
968 wl_drm_create_prime_buffer(chain->drm_wrapper, in wsi_wl_image_init()
970 chain->extent.width, in wsi_wl_image_init()
971 chain->extent.height, in wsi_wl_image_init()
972 chain->drm_format, in wsi_wl_image_init()
987 wsi_destroy_image(&chain->base, &image->base); in wsi_wl_image_init()
996 struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; in wsi_wl_swapchain_destroy() local
998 for (uint32_t i = 0; i < chain->base.image_count; i++) { in wsi_wl_swapchain_destroy()
999 if (chain->images[i].buffer) { in wsi_wl_swapchain_destroy()
1000 wl_buffer_destroy(chain->images[i].buffer); in wsi_wl_swapchain_destroy()
1001 wsi_destroy_image(&chain->base, &chain->images[i].base); in wsi_wl_swapchain_destroy()
1005 if (chain->frame) in wsi_wl_swapchain_destroy()
1006 wl_callback_destroy(chain->frame); in wsi_wl_swapchain_destroy()
1007 if (chain->surface) in wsi_wl_swapchain_destroy()
1008 wl_proxy_wrapper_destroy(chain->surface); in wsi_wl_swapchain_destroy()
1009 if (chain->drm_wrapper) in wsi_wl_swapchain_destroy()
1010 wl_proxy_wrapper_destroy(chain->drm_wrapper); in wsi_wl_swapchain_destroy()
1012 if (chain->display) in wsi_wl_swapchain_destroy()
1013 wsi_wl_display_unref(chain->display); in wsi_wl_swapchain_destroy()
1015 wsi_swapchain_finish(&chain->base); in wsi_wl_swapchain_destroy()
1017 vk_free(pAllocator, chain); in wsi_wl_swapchain_destroy()
1033 struct wsi_wl_swapchain *chain; in wsi_wl_surface_create_swapchain() local
1040 size_t size = sizeof(*chain) + num_images * sizeof(chain->images[0]); in wsi_wl_surface_create_swapchain()
1041 chain = vk_alloc(pAllocator, size, 8, in wsi_wl_surface_create_swapchain()
1043 if (chain == NULL) in wsi_wl_surface_create_swapchain()
1046 result = wsi_swapchain_init(wsi_device, &chain->base, device, in wsi_wl_surface_create_swapchain()
1049 vk_free(pAllocator, chain); in wsi_wl_surface_create_swapchain()
1057 chain->images[i].buffer = NULL; in wsi_wl_surface_create_swapchain()
1058 chain->surface = NULL; in wsi_wl_surface_create_swapchain()
1059 chain->drm_wrapper = NULL; in wsi_wl_surface_create_swapchain()
1060 chain->frame = NULL; in wsi_wl_surface_create_swapchain()
1065 chain->base.destroy = wsi_wl_swapchain_destroy; in wsi_wl_surface_create_swapchain()
1066 chain->base.get_wsi_image = wsi_wl_swapchain_get_wsi_image; in wsi_wl_surface_create_swapchain()
1067 chain->base.acquire_next_image = wsi_wl_swapchain_acquire_next_image; in wsi_wl_surface_create_swapchain()
1068 chain->base.queue_present = wsi_wl_swapchain_queue_present; in wsi_wl_surface_create_swapchain()
1069 chain->base.present_mode = wsi_swapchain_get_present_mode(wsi_device, pCreateInfo); in wsi_wl_surface_create_swapchain()
1070 chain->base.image_count = num_images; in wsi_wl_surface_create_swapchain()
1071 chain->extent = pCreateInfo->imageExtent; in wsi_wl_surface_create_swapchain()
1072 chain->vk_format = pCreateInfo->imageFormat; in wsi_wl_surface_create_swapchain()
1073 chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha); in wsi_wl_surface_create_swapchain()
1080 chain->display = wsi_wl_display_ref(old_chain->display); in wsi_wl_surface_create_swapchain()
1082 chain->display = NULL; in wsi_wl_surface_create_swapchain()
1083 result = wsi_wl_display_create(wsi, surface->display, &chain->display); in wsi_wl_surface_create_swapchain()
1088 chain->surface = wl_proxy_create_wrapper(surface->surface); in wsi_wl_surface_create_swapchain()
1089 if (!chain->surface) { in wsi_wl_surface_create_swapchain()
1093 wl_proxy_set_queue((struct wl_proxy *) chain->surface, in wsi_wl_surface_create_swapchain()
1094 chain->display->queue); in wsi_wl_surface_create_swapchain()
1095 chain->surface_version = wl_proxy_get_version((void *)surface->surface); in wsi_wl_surface_create_swapchain()
1097 chain->num_drm_modifiers = 0; in wsi_wl_surface_create_swapchain()
1098 chain->drm_modifiers = 0; in wsi_wl_surface_create_swapchain()
1103 if (chain->display->dmabuf.wl_dmabuf && in wsi_wl_surface_create_swapchain()
1104 chain->base.wsi->supports_modifiers) { in wsi_wl_surface_create_swapchain()
1106 switch (chain->drm_format) { in wsi_wl_surface_create_swapchain()
1108 modifiers = &chain->display->dmabuf.modifiers.argb8888; in wsi_wl_surface_create_swapchain()
1111 modifiers = &chain->display->dmabuf.modifiers.xrgb8888; in wsi_wl_surface_create_swapchain()
1119 chain->drm_modifiers = u_vector_tail(modifiers); in wsi_wl_surface_create_swapchain()
1120 chain->num_drm_modifiers = u_vector_length(modifiers); in wsi_wl_surface_create_swapchain()
1128 if (!chain->num_drm_modifiers) { in wsi_wl_surface_create_swapchain()
1129 assert(chain->display->drm.wl_drm); in wsi_wl_surface_create_swapchain()
1131 chain->drm_wrapper = in wsi_wl_surface_create_swapchain()
1132 wl_proxy_create_wrapper(chain->display->drm.wl_drm); in wsi_wl_surface_create_swapchain()
1133 if (!chain->drm_wrapper) { in wsi_wl_surface_create_swapchain()
1137 wl_proxy_set_queue((struct wl_proxy *) chain->drm_wrapper, in wsi_wl_surface_create_swapchain()
1138 chain->display->queue); in wsi_wl_surface_create_swapchain()
1141 chain->fifo_ready = true; in wsi_wl_surface_create_swapchain()
1143 for (uint32_t i = 0; i < chain->base.image_count; i++) { in wsi_wl_surface_create_swapchain()
1144 result = wsi_wl_image_init(chain, &chain->images[i], in wsi_wl_surface_create_swapchain()
1148 chain->images[i].busy = false; in wsi_wl_surface_create_swapchain()
1151 *swapchain_out = &chain->base; in wsi_wl_surface_create_swapchain()
1156 wsi_wl_swapchain_destroy(&chain->base, pAllocator); in wsi_wl_surface_create_swapchain()