mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
vulkan/wsi: add use_prime_blit param to wsi_swapchain_init
Instead of initializing it to false and overriding it later if needed. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13959>
This commit is contained in:
parent
d6ea60d5a2
commit
0ad7ec56c9
6 changed files with 14 additions and 11 deletions
|
|
@ -220,7 +220,8 @@ wsi_swapchain_init(const struct wsi_device *wsi,
|
|||
struct wsi_swapchain *chain,
|
||||
VkDevice device,
|
||||
const VkSwapchainCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
bool use_prime_blit)
|
||||
{
|
||||
VkResult result;
|
||||
|
||||
|
|
@ -231,7 +232,7 @@ wsi_swapchain_init(const struct wsi_device *wsi,
|
|||
chain->wsi = wsi;
|
||||
chain->device = device;
|
||||
chain->alloc = *pAllocator;
|
||||
chain->use_prime_blit = false;
|
||||
chain->use_prime_blit = use_prime_blit;
|
||||
|
||||
chain->cmd_pools =
|
||||
vk_zalloc(pAllocator, sizeof(VkCommandPool) * wsi->queue_family_count, 8,
|
||||
|
|
|
|||
|
|
@ -1906,7 +1906,7 @@ wsi_display_surface_create_swapchain(
|
|||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
VkResult result = wsi_swapchain_init(wsi_device, &chain->base, device,
|
||||
create_info, allocator);
|
||||
create_info, allocator, false);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_free(allocator, chain);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ wsi_swapchain_init(const struct wsi_device *wsi,
|
|||
struct wsi_swapchain *chain,
|
||||
VkDevice device,
|
||||
const VkSwapchainCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
bool use_prime_blit);
|
||||
|
||||
enum VkPresentModeKHR
|
||||
wsi_swapchain_get_present_mode(struct wsi_device *wsi,
|
||||
|
|
|
|||
|
|
@ -1237,7 +1237,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
result = wsi_swapchain_init(wsi_device, &chain->base, device,
|
||||
pCreateInfo, pAllocator);
|
||||
pCreateInfo, pAllocator, false);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_free(pAllocator, chain);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -596,7 +596,7 @@ wsi_win32_surface_create_swapchain(
|
|||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
VkResult result = wsi_swapchain_init(wsi_device, &chain->base, device,
|
||||
create_info, allocator);
|
||||
create_info, allocator, false);
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_free(allocator, chain);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1762,8 +1762,13 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
if (chain == NULL)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
bool use_prime_blit = false;
|
||||
if (!wsi_device->sw)
|
||||
if (!wsi_x11_check_dri3_compatible(wsi_device, conn))
|
||||
use_prime_blit = true;
|
||||
|
||||
result = wsi_swapchain_init(wsi_device, &chain->base, device,
|
||||
pCreateInfo, pAllocator);
|
||||
pCreateInfo, pAllocator, use_prime_blit);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_alloc;
|
||||
|
||||
|
|
@ -1799,10 +1804,6 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
*/
|
||||
chain->copy_is_suboptimal = false;
|
||||
|
||||
if (!wsi_device->sw)
|
||||
if (!wsi_x11_check_dri3_compatible(wsi_device, conn))
|
||||
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,
|
||||
XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY |
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue