VkPresentModeKHR present_mode;
bool fifo_ready;
- uint32_t image_count;
struct wsi_wl_image images[0];
};
VkResult result;
if (pSwapchainImages == NULL) {
- *pCount = chain->image_count;
+ *pCount = chain->base.image_count;
return VK_SUCCESS;
}
result = VK_SUCCESS;
- ret_count = chain->image_count;
- if (chain->image_count > *pCount) {
+ ret_count = chain->base.image_count;
+ if (chain->base.image_count > *pCount) {
ret_count = *pCount;
result = VK_INCOMPLETE;
}
return VK_ERROR_OUT_OF_DATE_KHR;
while (1) {
- for (uint32_t i = 0; i < chain->image_count; i++) {
+ for (uint32_t i = 0; i < chain->base.image_count; i++) {
if (!chain->images[i].busy) {
/* We found a non-busy image */
*image_index = i;
}
}
- assert(image_index < chain->image_count);
+ assert(image_index < chain->base.image_count);
wl_surface_attach(chain->surface, chain->images[image_index].buffer, 0, 0);
wl_surface_damage(chain->surface, 0, 0, INT32_MAX, INT32_MAX);
{
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
- for (uint32_t i = 0; i < chain->image_count; i++) {
+ for (uint32_t i = 0; i < chain->base.image_count; i++) {
if (chain->images[i].buffer)
chain->base.image_fns->free_wsi_image(chain->base.device, pAllocator,
chain->images[i].image,
chain->base.queue_present = wsi_wl_swapchain_queue_present;
chain->base.image_fns = image_fns;
chain->base.present_mode = pCreateInfo->presentMode;
+ chain->base.image_count = num_images;
chain->surface = surface->surface;
chain->extent = pCreateInfo->imageExtent;
chain->vk_format = pCreateInfo->imageFormat;
chain->fifo_ready = true;
- chain->image_count = num_images;
-
/* Mark a bunch of stuff as NULL. This way we can just call
* destroy_swapchain for cleanup.
*/
- for (uint32_t i = 0; i < chain->image_count; i++)
+ for (uint32_t i = 0; i < chain->base.image_count; i++)
chain->images[i].buffer = NULL;
chain->queue = NULL;
goto fail;
}
- for (uint32_t i = 0; i < chain->image_count; i++) {
+ for (uint32_t i = 0; i < chain->base.image_count; i++) {
result = wsi_wl_image_init(chain, &chain->images[i],
pCreateInfo, pAllocator);
if (result != VK_SUCCESS)
xcb_gc_t gc;
uint32_t depth;
VkExtent2D extent;
- uint32_t image_count;
xcb_present_event_t event_id;
xcb_special_event_t * special_event;
VkResult result;
if (pSwapchainImages == NULL) {
- *pCount = chain->image_count;
+ *pCount = chain->base.image_count;
return VK_SUCCESS;
}
result = VK_SUCCESS;
- ret_count = chain->image_count;
- if (chain->image_count > *pCount) {
+ ret_count = chain->base.image_count;
+ if (chain->base.image_count > *pCount) {
ret_count = *pCount;
result = VK_INCOMPLETE;
}
case XCB_PRESENT_EVENT_IDLE_NOTIFY: {
xcb_present_idle_notify_event_t *idle = (void *) event;
- for (unsigned i = 0; i < chain->image_count; i++) {
+ for (unsigned i = 0; i < chain->base.image_count; i++) {
if (chain->images[i].pixmap == idle->pixmap) {
chain->images[i].busy = false;
if (chain->threaded)
struct pollfd pfds;
uint64_t atimeout;
while (1) {
- for (uint32_t i = 0; i < chain->image_count; i++) {
+ for (uint32_t i = 0; i < chain->base.image_count; i++) {
if (!chain->images[i].busy) {
/* We found a non-busy image */
xshmfence_await(chain->images[i].shm_fence);
return chain->status;
}
- assert(image_index < chain->image_count);
+ assert(image_index < chain->base.image_count);
xshmfence_await(chain->images[image_index].shm_fence);
*image_index_out = image_index;
{
struct x11_image *image = &chain->images[image_index];
- assert(image_index < chain->image_count);
+ assert(image_index < chain->base.image_count);
uint32_t options = XCB_PRESENT_OPTION_NONE;
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
xcb_void_cookie_t cookie;
- for (uint32_t i = 0; i < chain->image_count; i++)
+ for (uint32_t i = 0; i < chain->base.image_count; i++)
x11_image_finish(chain, pAllocator, &chain->images[i]);
if (chain->threaded) {
chain->base.queue_present = x11_queue_present;
chain->base.image_fns = image_fns;
chain->base.present_mode = pCreateInfo->presentMode;
+ chain->base.image_count = num_images;
chain->conn = conn;
chain->window = window;
chain->depth = geometry->depth;
chain->extent = pCreateInfo->imageExtent;
- chain->image_count = num_images;
chain->send_sbc = 0;
chain->last_present_msc = 0;
chain->threaded = false;
xcb_discard_reply(chain->conn, cookie.sequence);
uint32_t image = 0;
- for (; image < chain->image_count; image++) {
+ for (; image < chain->base.image_count; image++) {
result = x11_image_init(device, chain, pCreateInfo, pAllocator,
&chain->images[image]);
if (result != VK_SUCCESS)
if (chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR) {
chain->threaded = true;
- /* Initialize our queues. We make them image_count + 1 because we will
+ /* Initialize our queues. We make them base.image_count + 1 because we will
* occasionally use UINT32_MAX to signal the other thread that an error
* has occurred and we don't want an overflow.
*/
int ret;
- ret = wsi_queue_init(&chain->acquire_queue, chain->image_count + 1);
+ ret = wsi_queue_init(&chain->acquire_queue, chain->base.image_count + 1);
if (ret) {
goto fail_init_images;
}
- ret = wsi_queue_init(&chain->present_queue, chain->image_count + 1);
+ ret = wsi_queue_init(&chain->present_queue, chain->base.image_count + 1);
if (ret) {
wsi_queue_destroy(&chain->acquire_queue);
goto fail_init_images;
}
- for (unsigned i = 0; i < chain->image_count; i++)
+ for (unsigned i = 0; i < chain->base.image_count; i++)
wsi_queue_push(&chain->acquire_queue, i);
ret = pthread_create(&chain->queue_manager, NULL,