<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 20, 2017 at 1:41 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">Hi,<br>
<div><div class="h5"><br>
On Mon, 2017-11-13 at 14:20 -0800, Jason Ekstrand wrote:<br>
> On Mon, Nov 6, 2017 at 2:02 PM, Louis-Francis Ratté-Boulianne <lfrb@c<br>
> <a href="http://ollabora.com" rel="noreferrer" target="_blank">ollabora.com</a>> wrote:<br>
> > 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,<br>
> > 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 *<br>
> > surface->bpe;<br>
> ><br>
> >         return VK_SUCCESS;<br>
> > diff --git a/src/intel/vulkan/anv_wsi.c<br>
> > 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<br>
> > 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>
><br>
> If any of the FDs ever point to different BOs, this will need to be<br>
> per-plane as well.<br>
<br>
</div></div>I've noticed that while rebasing you didn't touch that part. Were you<br>
only pointing out that might be needed at some point? Should we make it<br>
per-plane right away?<span class=""><br></span></blockquote><div><br></div><div>I figured we could make that change when we came to it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> > -   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>
><br>
> Would it be better to have an array of structs rather than SOA?<br>
<br>
</span>While you were rewriting that part, it remained untouched. Any strong<br>
opinion about that one?<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>I looked at the kernel struct in drm_mode.h and saw that it was also done this way.  We might as well keep it consistent.  The above two comments were questions more than suggestions.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
><br>
> >  };<br>
> ><br>
> >  struct wsi_device;<br>
> > diff --git a/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
> > 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<br>
> > *chain,<br>
> >     if (result != VK_SUCCESS)<br>
> >        return result;<br>
> ><br>
> > +   /* Without passing modifiers, we can't have multi-plane RGB<br>
> > 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, /*<br>
> > name */<br>
> > +                                              image->base.fds[0],<br>
> > /* name */<br>
> >                                                chain->extent.width,<br>
> >                                                chain-<br>
> > >extent.height,<br>
> >                                                chain->drm_format,<br>
> > -                                              image->base.offset,<br>
> > -                                              image-<br>
> > >base.row_pitch,<br>
> > +                                              image-<br>
> > >base.offsets[0],<br>
> > +                                              image-<br>
> > >base.row_pitches[0],<br>
> >                                                0, 0, 0, 0 /* unused<br>
> > */);<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<br>
> > 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<br>
> > x11_swapchain *chain,<br>
> ><br>
> >     struct wsi_image_base *image_ws =<br>
> >        chain->base.needs_linear_copy ? &image->linear_base :<br>
> > &image->base;<br>
> > +<br>
> > +   /* Without passing modifiers, we can't have multi-plane RGB<br>
> > 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-<br>
> > >imageExtent.width,<br>
> >                                            pCreateInfo-<br>
> > >imageExtent.height,<br>
> > -                                          image_ws->row_pitch,<br>
> > +                                          image_ws-<br>
> > >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>
> ><br>
> >     int fence_fd = xshmfence_alloc_shm();<br>
> >     if (fence_fd < 0)<br>
> > --<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>
><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>
</div></div></blockquote></div><br></div></div>