const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
int local_fd,
- bool can_handle_different_gpu,
VkBool32* pSupported)
{
xcb_connection_t *conn = x11_surface_get_connection(icd_surface);
return VK_SUCCESS;
}
- if (!can_handle_different_gpu)
- if (!wsi_x11_check_dri3_compatible(conn, local_fd))
- return false;
-
unsigned visual_depth;
if (!get_visualtype_for_window(conn, window, &visual_depth)) {
*pSupported = false;
struct x11_swapchain {
struct wsi_swapchain base;
- bool use_prime_blit;
-
xcb_connection_t * conn;
xcb_window_t window;
xcb_gc_t gc;
struct x11_image images[0];
};
-static VkResult
-x11_get_images(struct wsi_swapchain *anv_chain,
- uint32_t* pCount, VkImage *pSwapchainImages)
+static struct wsi_image *
+x11_get_wsi_image(struct wsi_swapchain *wsi_chain, uint32_t image_index)
{
- struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
- uint32_t ret_count;
- VkResult result;
-
- if (pSwapchainImages == NULL) {
- *pCount = chain->base.image_count;
- return VK_SUCCESS;
- }
-
- result = VK_SUCCESS;
- ret_count = chain->base.image_count;
- if (chain->base.image_count > *pCount) {
- ret_count = *pCount;
- result = VK_INCOMPLETE;
- }
-
- for (uint32_t i = 0; i < ret_count; i++)
- pSwapchainImages[i] = chain->images[i].base.image;
-
- return result;
+ struct x11_swapchain *chain = (struct x11_swapchain *)wsi_chain;
+ return &chain->images[image_index].base;
}
static VkResult
static VkResult
x11_queue_present(struct wsi_swapchain *anv_chain,
- VkQueue queue,
- uint32_t waitSemaphoreCount,
- const VkSemaphore *pWaitSemaphores,
uint32_t image_index,
const VkPresentRegionKHR *damage)
{
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
- VkResult result;
-
- if (chain->use_prime_blit) {
- result = wsi_prime_image_blit_to_linear(&chain->base,
- &chain->images[image_index].base,
- queue,
- waitSemaphoreCount,
- pWaitSemaphores);
- if (result != VK_SUCCESS)
- return result;
- }
if (chain->threaded) {
wsi_queue_push(&chain->present_queue, image_index);
while (chain->last_present_msc < target_msc) {
xcb_generic_event_t *event =
xcb_wait_for_special_event(chain->conn, chain->special_event);
- if (!event)
+ if (!event) {
+ result = VK_ERROR_OUT_OF_DATE_KHR;
goto fail;
+ }
result = x11_handle_dri3_present_event(chain, (void *)event);
free(event);
VkResult result;
uint32_t bpp = 32;
- if (chain->use_prime_blit) {
+ if (chain->base.use_prime_blit) {
result = wsi_create_prime_image(&chain->base, pCreateInfo, &image->base);
} else {
- result = wsi_create_native_image(&chain->base, pCreateInfo, &image->base);
+ result = wsi_create_native_image(&chain->base, pCreateInfo,
+ 0, NULL, NULL, &image->base);
}
if (result != VK_SUCCESS)
return result;
image->pixmap = xcb_generate_id(chain->conn);
+ /* Without passing modifiers, we can't have multi-plane RGB images. */
+ assert(image->base.num_planes == 1);
+
cookie =
xcb_dri3_pixmap_from_buffer_checked(chain->conn,
image->pixmap,
chain->window,
- image->base.size,
+ image->base.sizes[0],
pCreateInfo->imageExtent.width,
pCreateInfo->imageExtent.height,
- image->base.row_pitch,
+ image->base.row_pitches[0],
chain->depth, bpp,
- image->base.fd);
+ image->base.fds[0]);
xcb_discard_reply(chain->conn, cookie.sequence);
- image->base.fd = -1; /* XCB has now taken ownership of the FD */
+ image->base.fds[0] = -1; /* XCB has now taken ownership of the FD */
int fence_fd = xshmfence_alloc_shm();
if (fence_fd < 0)
goto fail_alloc;
chain->base.destroy = x11_swapchain_destroy;
- chain->base.get_images = x11_get_images;
+ chain->base.get_wsi_image = x11_get_wsi_image;
chain->base.acquire_next_image = x11_acquire_next_image;
chain->base.queue_present = x11_queue_present;
chain->base.present_mode = pCreateInfo->presentMode;
chain->threaded = false;
chain->status = VK_SUCCESS;
-
- chain->use_prime_blit = false;
- if (!wsi_x11_check_dri3_compatible(conn, local_fd)) {
- chain->use_prime_blit = true;
- }
+ if (!wsi_x11_check_dri3_compatible(conn, local_fd))
+ chain->base.use_prime_blit = true;
chain->event_id = xcb_generate_id(chain->conn);
xcb_present_select_input(chain->conn, chain->event_id, chain->window,