c/main: Print creation info for direct mode objects

This commit is contained in:
Jakob Bornecrantz 2023-08-25 18:19:29 +01:00
parent 67c24ebe92
commit 9bac7ed30e
3 changed files with 21 additions and 14 deletions

View file

@ -679,16 +679,15 @@ comp_target_swapchain_create_images(struct comp_target *ct,
} }
// Always print the first one. // Always print the first one.
{ enum u_logging_level print_log_level = U_LOGGING_DEBUG;
static bool first = true; if (!cts->has_logged_info) {
if (first) { print_log_level = U_LOGGING_INFO;
vk_print_surface_info(vk, &info, U_LOGGING_INFO); cts->has_logged_info = true;
first = false;
} else {
vk_print_surface_info(vk, &info, U_LOGGING_DEBUG);
}
} }
// Print info about the surface.
vk_print_surface_info(vk, &info, print_log_level);
if (!check_surface_present_mode(cts, &info, cts->present_mode)) { if (!check_surface_present_mode(cts, &info, cts->present_mode)) {
// Free old. // Free old.
destroy_old(cts, old_swapchain_handle); destroy_old(cts, old_swapchain_handle);
@ -746,8 +745,6 @@ comp_target_swapchain_create_images(struct comp_target *ct,
* Do the creation. * Do the creation.
*/ */
COMP_DEBUG(ct->c, "Creating compositor swapchain with %d images", image_count);
// Create the swapchain now. // Create the swapchain now.
VkSwapchainCreateInfoKHR swapchain_info = { VkSwapchainCreateInfoKHR swapchain_info = {
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR, .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
@ -771,6 +768,10 @@ comp_target_swapchain_create_images(struct comp_target *ct,
.oldSwapchain = old_swapchain_handle, .oldSwapchain = old_swapchain_handle,
}; };
// Print what we are creating.
vk_print_swapchain_create_info(vk, &swapchain_info, print_log_level);
// Everything decided and logged, do the creation.
ret = vk->vkCreateSwapchainKHR(vk->device, &swapchain_info, NULL, &cts->swapchain.handle); ret = vk->vkCreateSwapchainKHR(vk->device, &swapchain_info, NULL, &cts->swapchain.handle);
// Always destroy the old. // Always destroy the old.

View file

@ -87,6 +87,12 @@ struct comp_target_swapchain
//! Thread waiting on vblank_event_fence (first pixel out). //! Thread waiting on vblank_event_fence (first pixel out).
struct os_thread_helper event_thread; struct os_thread_helper event_thread;
} vblank; } vblank;
/*!
* We print swapchain info as INFO the first time we create a
* VkSWapchain, this keeps track if we have done it.
*/
bool has_logged_info;
}; };

View file

@ -211,11 +211,11 @@ comp_window_direct_create_surface(struct comp_target_swapchain *cts,
}, },
}; };
VkResult result = vk->vkCreateDisplayPlaneSurfaceKHR(vk->instance, &surface_info, NULL, &cts->surface.handle); // This function is called seldom so ok to always print.
vk_print_display_surface_create_info(vk, &surface_info, U_LOGGING_INFO);
free(plane_properties); // Everything decided and logged, do the creation.
return vk->vkCreateDisplayPlaneSurfaceKHR(vk->instance, &surface_info, NULL, &cts->surface.handle);
return result;
} }
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT