summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2018-02-09 15:43:25 -0800
committerDaniel Stone <[email protected]>2018-02-21 22:37:10 +0000
commit61c3feb38dcae3feb1176426903ca8e0046edd12 (patch)
treedacc4ffb991846552e5f25e97363c640a3546bd9
parentcdeac002677774b14b78bb234aa082bbc499f933 (diff)
vulkan/wsi: Add multiple planes to wsi_image
Not currently used. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/vulkan/wsi/wsi_common.c20
-rw-r--r--src/vulkan/wsi/wsi_common_private.h9
-rw-r--r--src/vulkan/wsi/wsi_common_wayland.c11
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c11
4 files changed, 31 insertions, 20 deletions
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 90ed07b7857..f257eb08755 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -201,6 +201,8 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
VkResult result;
memset(image, 0, sizeof(*image));
+ for (int i = 0; i < ARRAY_SIZE(image->fds); i++)
+ image->fds[i] = -1;
const struct wsi_image_create_info image_wsi_info = {
.sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
@@ -289,10 +291,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 +494,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 503b2a015dc..c5002ec8eca 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 be7635bbf84..8290170c9ec 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 c29e0a2d30d..b42b8234064 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)