[Mesa-dev] [PATCH 09/16] vulkan/wsi: Add multiple planes to wsi_image_base
Jason Ekstrand
jason at jlekstrand.net
Fri Feb 9 23:43:25 UTC 2018
From: Daniel Stone <daniels at collabora.com>
Not currently used.
Signed-off-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/vulkan/wsi/wsi_common.c | 18 ++++++++++--------
src/vulkan/wsi/wsi_common_private.h | 9 +++++----
src/vulkan/wsi/wsi_common_wayland.c | 11 +++++++----
src/vulkan/wsi/wsi_common_x11.c | 11 +++++++----
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 90ed07b..268a59a 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -289,10 +289,11 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
goto fail;
- image->size = reqs.size;
- image->row_pitch = image_layout.rowPitch;
- image->offset = 0;
- image->fd = fd;
+ image->num_planes = 1;
+ image->sizes[0] = reqs.size;
+ image->row_pitches[0] = image_layout.rowPitch;
+ image->offsets[0] = 0;
+ image->fds[0] = fd;
return VK_SUCCESS;
@@ -491,10 +492,11 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
goto fail;
- image->size = linear_size;
- image->row_pitch = linear_stride;
- image->offset = 0;
- image->fd = fd;
+ image->num_planes = 1;
+ image->sizes[0] = linear_size;
+ image->row_pitches[0] = linear_stride;
+ image->offsets[0] = 0;
+ image->fds[0] = fd;
return VK_SUCCESS;
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 503b2a0..c5002ec 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -35,10 +35,11 @@ struct wsi_image {
VkCommandBuffer *blit_cmd_buffers;
} prime;
- uint32_t size;
- uint32_t offset;
- uint32_t row_pitch;
- int fd;
+ int num_planes;
+ uint32_t sizes[4];
+ uint32_t offsets[4];
+ uint32_t row_pitches[4];
+ int fds[4];
};
struct wsi_swapchain {
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index be7635b..8290170 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -712,15 +712,18 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
if (result != VK_SUCCESS)
return result;
+ /* Without passing modifiers, we can't have multi-plane RGB images. */
+ assert(image->base.num_planes == 1);
+
image->buffer = wl_drm_create_prime_buffer(chain->drm_wrapper,
- image->base.fd, /* name */
+ image->base.fds[0], /* name */
chain->extent.width,
chain->extent.height,
chain->drm_format,
- image->base.offset,
- image->base.row_pitch,
+ image->base.offsets[0],
+ image->base.row_pitches[0],
0, 0, 0, 0 /* unused */);
- close(image->base.fd);
+ close(image->base.fds[0]);
if (!image->buffer)
goto fail_image;
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index c29e0a2..b42b823 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -936,18 +936,21 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
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)
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list