<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 6, 2017 at 2:02 PM, Louis-Francis Ratté-Boulianne <span dir="ltr"><<a href="mailto:lfrb@collabora.com" target="_blank">lfrb@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
<br>
Not currently used.<br>
<br>
Signed-off-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
---<br>
 src/amd/vulkan/radv_wsi.c           | 13 +++++++------<br>
 src/intel/vulkan/anv_wsi.c          |  9 +++++----<br>
 src/vulkan/wsi/wsi_common.h         |  9 +++++----<br>
 src/vulkan/wsi/wsi_common_<wbr>wayland.c | 11 +++++++----<br>
 src/vulkan/wsi/wsi_common_x11.<wbr>c     | 12 ++++++++----<br>
 5 files changed, 32 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c<br>
index b24cf28d42..b535dc22f4 100644<br>
--- a/src/amd/vulkan/radv_wsi.c<br>
+++ b/src/amd/vulkan/radv_wsi.c<br>
@@ -213,22 +213,23 @@ radv_wsi_image_create(VkDevice device_h,<br>
                RADV_FROM_HANDLE(radv_device_<wbr>memory, memory, memory_h);<br>
                if (!radv_get_memory_fd(device, memory, &fd))<br>
                        goto fail_alloc_memory;<br>
-               wsi_image->fd = fd;<br>
+               wsi_image->fds[0] = fd;<br>
        } else {<br>
-               wsi_image->fd = -1;<br>
+               wsi_image->fds[0] = -1;<br>
        }<br>
<br>
        surface = &image->surface;<br>
<br>
        wsi_image->image = image_h;<br>
        wsi_image->memory = memory_h;<br>
-       wsi_image->size = image->size;<br>
-       wsi_image->offset = image->offset;<br>
+       wsi_image->num_planes = 1;<br>
+       wsi_image->sizes[0] = image->size;<br>
+       wsi_image->offsets[0] = image->offset;<br>
        if (device->physical_device->rad_<wbr>info.chip_class >= GFX9)<br>
-               wsi_image->row_pitch =<br>
+               wsi_image->row_pitches[0] =<br>
                        surface->u.gfx9.surf_pitch * surface->bpe;<br>
        else<br>
-               wsi_image->row_pitch =<br>
+               wsi_image->row_pitches[0] =<br>
                        surface->u.legacy.level[0].<wbr>nblk_x * surface->bpe;<br>
<br>
        return VK_SUCCESS;<br>
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c<br>
index 916c62cad9..ae40f1f2f4 100644<br>
--- a/src/intel/vulkan/anv_wsi.c<br>
+++ b/src/intel/vulkan/anv_wsi.c<br>
@@ -266,10 +266,11 @@ anv_wsi_image_create(VkDevice device_h,<br>
<br>
    wsi_image->image = image_h;<br>
    wsi_image->memory = memory_h;<br>
-   wsi_image->fd = fd;<br>
-   wsi_image->size = image->size;<br>
-   wsi_image->offset = 0;<br>
-   wsi_image->row_pitch = surface->isl.row_pitch;<br>
+   wsi_image->num_planes = 1;<br>
+   wsi_image->fds[0] = fd;<br>
+   wsi_image->sizes[0] = image->size;<br>
+   wsi_image->offsets[0] = 0;<br>
+   wsi_image->row_pitches[0] = surface->isl.row_pitch;<br>
    return VK_SUCCESS;<br>
 fail_alloc_memory:<br>
    anv_FreeMemory(device_h, memory_h, pAllocator);<br>
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h<br>
index 1103703b0e..b6c5a438b1 100644<br>
--- a/src/vulkan/wsi/wsi_common.h<br>
+++ b/src/vulkan/wsi/wsi_common.h<br>
@@ -33,10 +33,11 @@<br>
 struct wsi_image_base {<br>
    VkImage image;<br>
    VkDeviceMemory memory;<br></blockquote><div><br></div><div>If any of the FDs ever point to different BOs, this will need to be per-plane as well.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-   uint32_t size;<br>
-   uint32_t offset;<br>
-   uint32_t row_pitch;<br>
-   int fd;<br>
+   int num_planes;<br>
+   uint32_t sizes[4];<br>
+   uint32_t offsets[4];<br>
+   uint32_t row_pitches[4];<br>
+   int fds[4];<br></blockquote><div><br></div><div>Would it be better to have an array of structs rather than SOA?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 };<br>
<br>
 struct wsi_device;<br>
diff --git a/src/vulkan/wsi/wsi_common_<wbr>wayland.c b/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
index 36cc4d0821..a76e29d26e 100644<br>
--- a/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
+++ b/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
@@ -736,15 +736,18 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,<br>
    if (result != VK_SUCCESS)<br>
       return result;<br>
<br>
+   /* Without passing modifiers, we can't have multi-plane RGB images. */<br>
+   assert(image->base.num_planes == 1);<br>
+<br>
    image->buffer = wl_drm_create_prime_buffer(<wbr>chain->drm_wrapper,<br>
-                                              image->base.fd, /* name */<br>
+                                              image->base.fds[0], /* name */<br>
                                               chain->extent.width,<br>
                                               chain->extent.height,<br>
                                               chain->drm_format,<br>
-                                              image->base.offset,<br>
-                                              image->base.row_pitch,<br>
+                                              image->base.offsets[0],<br>
+                                              image->base.row_pitches[0],<br>
                                               0, 0, 0, 0 /* unused */);<br>
-   close(image->base.fd);<br>
+   close(image->base.fds[0]);<br>
<br>
    if (!image->buffer)<br>
       goto fail_image;<br>
diff --git a/src/vulkan/wsi/wsi_common_<wbr>x11.c b/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
index 78fd406aa1..e48d746305 100644<br>
--- a/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
+++ b/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
@@ -988,18 +988,22 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,<br>
<br>
    struct wsi_image_base *image_ws =<br>
       chain->base.needs_linear_copy ? &image->linear_base : &image->base;<br>
+<br>
+   /* Without passing modifiers, we can't have multi-plane RGB images. */<br>
+   assert(image_ws->num_planes == 1);<br>
+<br>
    cookie =<br>
       xcb_dri3_pixmap_from_buffer_<wbr>checked(chain->conn,<br>
                                           image->pixmap,<br>
                                           chain->window,<br>
-                                          image_ws->size,<br>
+                                          image_ws->sizes[0],<br>
                                           pCreateInfo->imageExtent.<wbr>width,<br>
                                           pCreateInfo->imageExtent.<wbr>height,<br>
-                                          image_ws->row_pitch,<br>
+                                          image_ws->row_pitches[0],<br>
                                           chain->depth, bpp,<br>
-                                          image_ws->fd);<br>
+                                          image_ws->fds[0]);<br>
    xcb_discard_reply(chain->conn, cookie.sequence);<br>
-   image_ws->fd = -1; /* XCB has now taken ownership of the FD */<br>
+   image_ws->fds[0] = -1; /* XCB has now taken ownership of the FD */<br>
<br>
    int fence_fd = xshmfence_alloc_shm();<br>
    if (fence_fd < 0)<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>