mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
vulkan/wsi/sw: add mit-shm support for pixmap allocation
This allocate the mit-shm pixmap instead of dri3 pixmaps and uses the present paths when mit-shm is enabled Acked-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12482>
This commit is contained in:
parent
1f55f9a97a
commit
a069b4e9b9
1 changed files with 26 additions and 5 deletions
|
|
@ -1214,7 +1214,7 @@ static VkResult
|
||||||
x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index,
|
x11_present_to_x11(struct x11_swapchain *chain, uint32_t image_index,
|
||||||
uint64_t target_msc)
|
uint64_t target_msc)
|
||||||
{
|
{
|
||||||
if (chain->base.wsi->sw)
|
if (chain->base.wsi->sw && !chain->has_mit_shm)
|
||||||
return x11_present_to_x11_sw(chain, image_index, target_msc);
|
return x11_present_to_x11_sw(chain, image_index, target_msc);
|
||||||
return x11_present_to_x11_dri3(chain, image_index, target_msc);
|
return x11_present_to_x11_dri3(chain, image_index, target_msc);
|
||||||
}
|
}
|
||||||
|
|
@ -1231,7 +1231,7 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
|
||||||
if (chain->status < 0)
|
if (chain->status < 0)
|
||||||
return chain->status;
|
return chain->status;
|
||||||
|
|
||||||
if (chain->base.wsi->sw) {
|
if (chain->base.wsi->sw && !chain->has_mit_shm) {
|
||||||
*image_index = 0;
|
*image_index = 0;
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
@ -1375,6 +1375,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
||||||
xcb_void_cookie_t cookie;
|
xcb_void_cookie_t cookie;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
uint32_t bpp = 32;
|
uint32_t bpp = 32;
|
||||||
|
int fence_fd;
|
||||||
|
|
||||||
if (chain->base.use_prime_blit) {
|
if (chain->base.use_prime_blit) {
|
||||||
bool use_modifier = num_tranches > 0;
|
bool use_modifier = num_tranches > 0;
|
||||||
|
|
@ -1389,9 +1390,28 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (chain->base.wsi->sw) {
|
if (chain->base.wsi->sw) {
|
||||||
|
if (!chain->has_mit_shm) {
|
||||||
image->busy = false;
|
image->busy = false;
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image->shmseg = xcb_generate_id(chain->conn);
|
||||||
|
|
||||||
|
xcb_shm_attach(chain->conn,
|
||||||
|
image->shmseg,
|
||||||
|
image->shmid,
|
||||||
|
0);
|
||||||
|
image->pixmap = xcb_generate_id(chain->conn);
|
||||||
|
cookie = xcb_shm_create_pixmap_checked(chain->conn,
|
||||||
|
image->pixmap,
|
||||||
|
chain->window,
|
||||||
|
image->base.row_pitches[0] / 4,
|
||||||
|
pCreateInfo->imageExtent.height,
|
||||||
|
chain->depth,
|
||||||
|
image->shmseg, 0);
|
||||||
|
xcb_discard_reply(chain->conn, cookie.sequence);
|
||||||
|
goto out_fence;
|
||||||
|
}
|
||||||
image->pixmap = xcb_generate_id(chain->conn);
|
image->pixmap = xcb_generate_id(chain->conn);
|
||||||
|
|
||||||
#ifdef HAVE_DRI3_MODIFIERS
|
#ifdef HAVE_DRI3_MODIFIERS
|
||||||
|
|
@ -1441,7 +1461,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
||||||
for (int i = 0; i < image->base.num_planes; i++)
|
for (int i = 0; i < image->base.num_planes; i++)
|
||||||
image->base.fds[i] = -1;
|
image->base.fds[i] = -1;
|
||||||
|
|
||||||
int fence_fd = xshmfence_alloc_shm();
|
out_fence:
|
||||||
|
fence_fd = xshmfence_alloc_shm();
|
||||||
if (fence_fd < 0)
|
if (fence_fd < 0)
|
||||||
goto fail_pixmap;
|
goto fail_pixmap;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue