Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
On 5 May 2018 at 14:34, Bas Nieuwenhuizenwrote: > This was setting the LINEAR modifier if neither the > X server nor the driver supported modifiers. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180 > Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2" > CC: 18.1 > CC: Abel Garcia Dorta > CC: Daniel Stone Acked-by: Daniel Stone Reviewed-by: Jason Ekstrand Cheers, Daniel ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
This patch has been Tested-by: Abel Garcia Dortaon top of master and on top of mesa-18.1.0_rc2 provided by gentoo. Thank you for fixing it! 2018-05-05 15:34 GMT+02:00 Bas Nieuwenhuizen : > This was setting the LINEAR modifier if neither the > X server nor the driver supported modifiers. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180 > Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2" > CC: 18.1 > CC: Abel Garcia Dorta > CC: Daniel Stone > --- > src/vulkan/wsi/wsi_common.c | 3 ++- > src/vulkan/wsi/wsi_common_private.h | 1 + > src/vulkan/wsi/wsi_common_x11.c | 3 ++- > 3 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c > index fe262b4968d..87e508ddf85 100644 > --- a/src/vulkan/wsi/wsi_common.c > +++ b/src/vulkan/wsi/wsi_common.c > @@ -442,6 +442,7 @@ fail: > VkResult > wsi_create_prime_image(const struct wsi_swapchain *chain, > const VkSwapchainCreateInfoKHR *pCreateInfo, > + bool use_modifier, > struct wsi_image *image) > { > const struct wsi_device *wsi = chain->wsi; > @@ -626,7 +627,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain, > if (result != VK_SUCCESS) >goto fail; > > - image->drm_modifier = DRM_FORMAT_MOD_LINEAR; > + image->drm_modifier = use_modifier ? DRM_FORMAT_MOD_LINEAR : > DRM_FORMAT_MOD_INVALID; > image->num_planes = 1; > image->sizes[0] = linear_size; > image->row_pitches[0] = linear_stride; > diff --git a/src/vulkan/wsi/wsi_common_private.h > b/src/vulkan/wsi/wsi_common_private.h > index b608119b969..90941c8201b 100644 > --- a/src/vulkan/wsi/wsi_common_private.h > +++ b/src/vulkan/wsi/wsi_common_private.h > @@ -89,6 +89,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain, > VkResult > wsi_create_prime_image(const struct wsi_swapchain *chain, > const VkSwapchainCreateInfoKHR *pCreateInfo, > + bool use_modifier, > struct wsi_image *image); > > void > diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c > index 3a00caddfb9..62739b99125 100644 > --- a/src/vulkan/wsi/wsi_common_x11.c > +++ b/src/vulkan/wsi/wsi_common_x11.c > @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain > *chain, > uint32_t bpp = 32; > > if (chain->base.use_prime_blit) { > - result = wsi_create_prime_image(>base, pCreateInfo, > >base); > + bool use_modifier = num_tranches > 0; > + result = wsi_create_prime_image(>base, pCreateInfo, > use_modifier, >base); > } else { >result = wsi_create_native_image(>base, pCreateInfo, > num_tranches, num_modifiers, > modifiers, > -- > 2.17.0 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
Hi, I sent a similar patch yesterday with: + if (chain->has_dri3_modifiers && + image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) { but was rejected by bas and never got into the mail list... If the jason's patch is going to be the good patch I would like to have some aknowlegment in the commit message because I found the bug and I sent a similar patch. I will test tomorrow both patches in my computer. Thank you for fixing it. 2018-05-05 20:07 GMT+02:00 Jason Ekstrand: > On Sat, May 5, 2018 at 6:34 AM, Bas Nieuwenhuizen > wrote: >> >> This was setting the LINEAR modifier if neither the >> X server nor the driver supported modifiers. >> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180 >> Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2" >> CC: 18.1 >> CC: Abel Garcia Dorta >> CC: Daniel Stone >> --- >> src/vulkan/wsi/wsi_common.c | 3 ++- >> src/vulkan/wsi/wsi_common_private.h | 1 + >> src/vulkan/wsi/wsi_common_x11.c | 3 ++- >> 3 files changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c >> index fe262b4968d..87e508ddf85 100644 >> --- a/src/vulkan/wsi/wsi_common.c >> +++ b/src/vulkan/wsi/wsi_common.c >> @@ -442,6 +442,7 @@ fail: >> VkResult >> wsi_create_prime_image(const struct wsi_swapchain *chain, >> const VkSwapchainCreateInfoKHR *pCreateInfo, >> + bool use_modifier, >> struct wsi_image *image) >> { >> const struct wsi_device *wsi = chain->wsi; >> @@ -626,7 +627,7 @@ wsi_create_prime_image(const struct wsi_swapchain >> *chain, >> if (result != VK_SUCCESS) >>goto fail; >> >> - image->drm_modifier = DRM_FORMAT_MOD_LINEAR; >> + image->drm_modifier = use_modifier ? DRM_FORMAT_MOD_LINEAR : >> DRM_FORMAT_MOD_INVALID; >> image->num_planes = 1; >> image->sizes[0] = linear_size; >> image->row_pitches[0] = linear_stride; >> diff --git a/src/vulkan/wsi/wsi_common_private.h >> b/src/vulkan/wsi/wsi_common_private.h >> index b608119b969..90941c8201b 100644 >> --- a/src/vulkan/wsi/wsi_common_private.h >> +++ b/src/vulkan/wsi/wsi_common_private.h >> @@ -89,6 +89,7 @@ wsi_create_native_image(const struct wsi_swapchain >> *chain, >> VkResult >> wsi_create_prime_image(const struct wsi_swapchain *chain, >> const VkSwapchainCreateInfoKHR *pCreateInfo, >> + bool use_modifier, >> struct wsi_image *image); >> >> void >> diff --git a/src/vulkan/wsi/wsi_common_x11.c >> b/src/vulkan/wsi/wsi_common_x11.c >> index 3a00caddfb9..62739b99125 100644 >> --- a/src/vulkan/wsi/wsi_common_x11.c >> +++ b/src/vulkan/wsi/wsi_common_x11.c >> @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct >> x11_swapchain *chain, >> uint32_t bpp = 32; >> >> if (chain->base.use_prime_blit) { >> - result = wsi_create_prime_image(>base, pCreateInfo, >> >base); >> + bool use_modifier = num_tranches > 0; >> + result = wsi_create_prime_image(>base, pCreateInfo, >> use_modifier, >base); > > > This confused me for a bit but I think I see what's going on. You have an X > server which doesn't know about modifiers but mesa is built with modifier > support and prime is in use. This results in the WSI code calling > dri3_pixmap_from_buffers (plural) on an X server which doesn't support it. > > I'm not sure what I think about this way of solving the problem. In my > twisted mind, DRM_FORMAT_MOD_LINEAR should always be valid even if the > modifier is ultimately ignored. I'm going to send a counter-patch which > solves it another way but I'm not sure if my solution is better. Daniel, do > you have any thoughts? > >> >> } else { >>result = wsi_create_native_image(>base, pCreateInfo, >> num_tranches, num_modifiers, >> modifiers, >> -- >> 2.17.0 >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
Rb On May 5, 2018 06:35:46 Bas Nieuwenhuizenwrote: This was setting the LINEAR modifier if neither the X server nor the driver supported modifiers. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180 Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2" CC: 18.1 CC: Abel Garcia Dorta CC: Daniel Stone --- src/vulkan/wsi/wsi_common.c | 3 ++- src/vulkan/wsi/wsi_common_private.h | 1 + src/vulkan/wsi/wsi_common_x11.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index fe262b4968d..87e508ddf85 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -442,6 +442,7 @@ fail: VkResult wsi_create_prime_image(const struct wsi_swapchain *chain, const VkSwapchainCreateInfoKHR *pCreateInfo, + bool use_modifier, struct wsi_image *image) { const struct wsi_device *wsi = chain->wsi; @@ -626,7 +627,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain, if (result != VK_SUCCESS) goto fail; - image->drm_modifier = DRM_FORMAT_MOD_LINEAR; + image->drm_modifier = use_modifier ? DRM_FORMAT_MOD_LINEAR : DRM_FORMAT_MOD_INVALID; image->num_planes = 1; image->sizes[0] = linear_size; image->row_pitches[0] = linear_stride; diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index b608119b969..90941c8201b 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -89,6 +89,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain, VkResult wsi_create_prime_image(const struct wsi_swapchain *chain, const VkSwapchainCreateInfoKHR *pCreateInfo, + bool use_modifier, struct wsi_image *image); void diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 3a00caddfb9..62739b99125 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain, uint32_t bpp = 32; if (chain->base.use_prime_blit) { - result = wsi_create_prime_image(>base, pCreateInfo, >base); + bool use_modifier = num_tranches > 0; + result = wsi_create_prime_image(>base, pCreateInfo, use_modifier, >base); } else { result = wsi_create_native_image(>base, pCreateInfo, num_tranches, num_modifiers, modifiers, -- 2.17.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
On May 6, 2018 05:58:52 Daniel Stonewrote: Hi, On 5 May 2018 at 19:07, Jason Ekstrand wrote: On Sat, May 5, 2018 at 6:34 AM, Bas Nieuwenhuizen wrote: @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain, uint32_t bpp = 32; if (chain->base.use_prime_blit) { - result = wsi_create_prime_image(>base, pCreateInfo, >base); + bool use_modifier = num_tranches > 0; + result = wsi_create_prime_image(>base, pCreateInfo, use_modifier, >base); This confused me for a bit but I think I see what's going on. You have an X server which doesn't know about modifiers but mesa is built with modifier support and prime is in use. This results in the WSI code calling dri3_pixmap_from_buffers (plural) on an X server which doesn't support it. I'm not sure what I think about this way of solving the problem. In my twisted mind, DRM_FORMAT_MOD_LINEAR should always be valid even if the modifier is ultimately ignored. I'm going to send a counter-patch which solves it another way but I'm not sure if my solution is better. Daniel, do you have any thoughts? Linear is fairly unique in aliasing a pre-modifier GBM use flag, as well as something that translates well across all our drivers. That being said, I prefer Bas's patch for consistency: currently, we _always_ set INVALID _everywhere_ if one or more components in the chain are not modifier-aware. I don't really see a reason to diverge here, especially when we could end up deciding on LINEAR inside the driver but still setting INVALID for other reasons, e.g. if the user requests a linear VkTilingMode. Fair enough. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
Hi, On 5 May 2018 at 19:07, Jason Ekstrandwrote: > On Sat, May 5, 2018 at 6:34 AM, Bas Nieuwenhuizen > wrote: >> @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct >> x11_swapchain *chain, >> uint32_t bpp = 32; >> >> if (chain->base.use_prime_blit) { >> - result = wsi_create_prime_image(>base, pCreateInfo, >> >base); >> + bool use_modifier = num_tranches > 0; >> + result = wsi_create_prime_image(>base, pCreateInfo, >> use_modifier, >base); > > This confused me for a bit but I think I see what's going on. You have an X > server which doesn't know about modifiers but mesa is built with modifier > support and prime is in use. This results in the WSI code calling > dri3_pixmap_from_buffers (plural) on an X server which doesn't support it. > > I'm not sure what I think about this way of solving the problem. In my > twisted mind, DRM_FORMAT_MOD_LINEAR should always be valid even if the > modifier is ultimately ignored. I'm going to send a counter-patch which > solves it another way but I'm not sure if my solution is better. Daniel, do > you have any thoughts? Linear is fairly unique in aliasing a pre-modifier GBM use flag, as well as something that translates well across all our drivers. That being said, I prefer Bas's patch for consistency: currently, we _always_ set INVALID _everywhere_ if one or more components in the chain are not modifier-aware. I don't really see a reason to diverge here, especially when we could end up deciding on LINEAR inside the driver but still setting INVALID for other reasons, e.g. if the user requests a linear VkTilingMode. Cheers, Daniel ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
On Sat, May 5, 2018 at 6:34 AM, Bas Nieuwenhuizenwrote: > This was setting the LINEAR modifier if neither the > X server nor the driver supported modifiers. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180 > Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2" > CC: 18.1 > CC: Abel Garcia Dorta > CC: Daniel Stone > --- > src/vulkan/wsi/wsi_common.c | 3 ++- > src/vulkan/wsi/wsi_common_private.h | 1 + > src/vulkan/wsi/wsi_common_x11.c | 3 ++- > 3 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c > index fe262b4968d..87e508ddf85 100644 > --- a/src/vulkan/wsi/wsi_common.c > +++ b/src/vulkan/wsi/wsi_common.c > @@ -442,6 +442,7 @@ fail: > VkResult > wsi_create_prime_image(const struct wsi_swapchain *chain, > const VkSwapchainCreateInfoKHR *pCreateInfo, > + bool use_modifier, > struct wsi_image *image) > { > const struct wsi_device *wsi = chain->wsi; > @@ -626,7 +627,7 @@ wsi_create_prime_image(const struct wsi_swapchain > *chain, > if (result != VK_SUCCESS) >goto fail; > > - image->drm_modifier = DRM_FORMAT_MOD_LINEAR; > + image->drm_modifier = use_modifier ? DRM_FORMAT_MOD_LINEAR : > DRM_FORMAT_MOD_INVALID; > image->num_planes = 1; > image->sizes[0] = linear_size; > image->row_pitches[0] = linear_stride; > diff --git a/src/vulkan/wsi/wsi_common_private.h > b/src/vulkan/wsi/wsi_common_private.h > index b608119b969..90941c8201b 100644 > --- a/src/vulkan/wsi/wsi_common_private.h > +++ b/src/vulkan/wsi/wsi_common_private.h > @@ -89,6 +89,7 @@ wsi_create_native_image(const struct wsi_swapchain > *chain, > VkResult > wsi_create_prime_image(const struct wsi_swapchain *chain, > const VkSwapchainCreateInfoKHR *pCreateInfo, > + bool use_modifier, > struct wsi_image *image); > > void > diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_ > x11.c > index 3a00caddfb9..62739b99125 100644 > --- a/src/vulkan/wsi/wsi_common_x11.c > +++ b/src/vulkan/wsi/wsi_common_x11.c > @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct > x11_swapchain *chain, > uint32_t bpp = 32; > > if (chain->base.use_prime_blit) { > - result = wsi_create_prime_image(>base, pCreateInfo, > >base); > + bool use_modifier = num_tranches > 0; > + result = wsi_create_prime_image(>base, pCreateInfo, > use_modifier, >base); > This confused me for a bit but I think I see what's going on. You have an X server which doesn't know about modifiers but mesa is built with modifier support and prime is in use. This results in the WSI code calling dri3_pixmap_from_buffers (plural) on an X server which doesn't support it. I'm not sure what I think about this way of solving the problem. In my twisted mind, DRM_FORMAT_MOD_LINEAR should always be valid even if the modifier is ultimately ignored. I'm going to send a counter-patch which solves it another way but I'm not sure if my solution is better. Daniel, do you have any thoughts? > } else { >result = wsi_create_native_image(>base, pCreateInfo, > num_tranches, num_modifiers, > modifiers, > -- > 2.17.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] vulkan/wsi: Only use LINEAR modifier for prime if supported.
This was setting the LINEAR modifier if neither the X server nor the driver supported modifiers. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180 Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2" CC: 18.1CC: Abel Garcia Dorta CC: Daniel Stone --- src/vulkan/wsi/wsi_common.c | 3 ++- src/vulkan/wsi/wsi_common_private.h | 1 + src/vulkan/wsi/wsi_common_x11.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index fe262b4968d..87e508ddf85 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -442,6 +442,7 @@ fail: VkResult wsi_create_prime_image(const struct wsi_swapchain *chain, const VkSwapchainCreateInfoKHR *pCreateInfo, + bool use_modifier, struct wsi_image *image) { const struct wsi_device *wsi = chain->wsi; @@ -626,7 +627,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain, if (result != VK_SUCCESS) goto fail; - image->drm_modifier = DRM_FORMAT_MOD_LINEAR; + image->drm_modifier = use_modifier ? DRM_FORMAT_MOD_LINEAR : DRM_FORMAT_MOD_INVALID; image->num_planes = 1; image->sizes[0] = linear_size; image->row_pitches[0] = linear_stride; diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index b608119b969..90941c8201b 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -89,6 +89,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain, VkResult wsi_create_prime_image(const struct wsi_swapchain *chain, const VkSwapchainCreateInfoKHR *pCreateInfo, + bool use_modifier, struct wsi_image *image); void diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 3a00caddfb9..62739b99125 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain, uint32_t bpp = 32; if (chain->base.use_prime_blit) { - result = wsi_create_prime_image(>base, pCreateInfo, >base); + bool use_modifier = num_tranches > 0; + result = wsi_create_prime_image(>base, pCreateInfo, use_modifier, >base); } else { result = wsi_create_native_image(>base, pCreateInfo, num_tranches, num_modifiers, modifiers, -- 2.17.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev