GNU bug report logs - #65155
[PATCH] gnu: mesa: Add native-search-paths.

Previous Next

Package: guix-patches;

Reported by: dan <i <at> dan.games>

Date: Tue, 8 Aug 2023 18:10:02 UTC

Severity: normal

Tags: patch

Done: John Kehayias <john.kehayias <at> protonmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 65155 in the body.
You can then email your comments to 65155 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#65155; Package guix-patches. (Tue, 08 Aug 2023 18:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to dan <i <at> dan.games>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 08 Aug 2023 18:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: dan <i <at> dan.games>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: mesa: Add native-search-paths.
Date: Wed,  9 Aug 2023 02:08:49 +0800
* gnu/packages/gl.scm (mesa) [native-search-paths]: Export XDG_DATA_DIRS.

According to
https://vulkan.lunarg.com/doc/view/1.3.231.1/linux/loader_and_layer_interface.html,
Vulkan loader search for manifest files in several directories.  Some of them
are in the $HOME directory, some of them are set during compile-time.  We
don't raelly want vulkan-loader to depend on mesa during compile-time, since
we couldn't assume that mesa is the only package providing Vulkan drivers.
Thus, it's better for us to export XDG_DATA_DIRS in mesa, so that when both
packages are installed, Vulkan loader could find the corresponding Vulkan
drivers by environment varaible.

---
 gnu/packages/gl.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index b53b42a9ba..583cd5a945 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021, 2022, 2023 John Kehayias <john.kehayias <at> protonmail.com>
 ;;; Copyright © 2022 Petr Hodina <phodina <at> protonmail.com>
 ;;; Copyright © 2023 Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
+;;; Copyright © 2023 dan <i <at> dan.games>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -518,7 +519,11 @@ (define-public mesa
             ;; Ensure the Mesa VDPAU drivers can be found.
             (variable "VDPAU_DRIVER_PATH")
             (separator #f)
-            (files '("lib/vdpau")))))
+            (files '("lib/vdpau")))
+           (search-path-specification
+            ;; Ensure the Vulkan drivers can be found by Vulkan loader.
+            (variable "XDG_DATA_DIRS")
+            (files '("share")))))
     (home-page "https://mesa3d.org/")
     (synopsis "OpenGL and Vulkan implementations")
     (description "Mesa is a free implementation of the OpenGL and Vulkan

base-commit: 4547bc6fa3142dca77f7fc912368aeff31bd6e53
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#65155; Package guix-patches. (Tue, 28 Nov 2023 05:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 65155 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: dan <i <at> dan.games>
Cc: 65155 <at> debbugs.gnu.org
Subject: Re: [bug#65155] [PATCH] gnu: mesa: Add native-search-paths.
Date: Tue, 28 Nov 2023 05:54:25 +0000
Hi,

Sorry for the long overdue reply here.

On Wed, Aug 09, 2023 at 02:08 AM, dan wrote:

> * gnu/packages/gl.scm (mesa) [native-search-paths]: Export XDG_DATA_DIRS.
>
> According to
> https://vulkan.lunarg.com/doc/view/1.3.231.1/linux/loader_and_layer_interface.html,
> Vulkan loader search for manifest files in several directories.  Some of them
> are in the $HOME directory, some of them are set during compile-time.  We
> don't raelly want vulkan-loader to depend on mesa during compile-time, since
> we couldn't assume that mesa is the only package providing Vulkan drivers.
> Thus, it's better for us to export XDG_DATA_DIRS in mesa, so that when both
> packages are installed, Vulkan loader could find the corresponding Vulkan
> drivers by environment varaible.
>

I'm not sure if this patch does what you intend. A search-path is
defined in the package that consumes the path, meaning the package that
looks there for something. The environment variable is then set whenever
there is package also in the profile that populates the specified
directory.

So perhaps this belongs in vulkan-loader? Although I admit I'm less sure
for XDG_* related paths. Is there a test case or something we can see if
this does what is intended for vulkan?

(This did not make it into the just merged mesa-updates but happy to do
it on the next round, which could also include changes to vulkan
packages if they need a branch.)

Apologies for the wait on this one, since I had looked at it a while
ago!

John

> ---
>  gnu/packages/gl.scm | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
> index b53b42a9ba..583cd5a945 100644
> --- a/gnu/packages/gl.scm
> +++ b/gnu/packages/gl.scm
> @@ -18,6 +18,7 @@
>  ;;; Copyright © 2021, 2022, 2023 John Kehayias <john.kehayias <at> protonmail.com>
>  ;;; Copyright © 2022 Petr Hodina <phodina <at> protonmail.com>
>  ;;; Copyright © 2023 Kaelyn Takata <kaelyn.alexi <at> protonmail.com>
> +;;; Copyright © 2023 dan <i <at> dan.games>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -518,7 +519,11 @@ (define-public mesa
>              ;; Ensure the Mesa VDPAU drivers can be found.
>              (variable "VDPAU_DRIVER_PATH")
>              (separator #f)
> -            (files '("lib/vdpau")))))
> +            (files '("lib/vdpau")))
> +           (search-path-specification
> +            ;; Ensure the Vulkan drivers can be found by Vulkan loader.
> +            (variable "XDG_DATA_DIRS")
> +            (files '("share")))))
>      (home-page "https://mesa3d.org/")
>      (synopsis "OpenGL and Vulkan implementations")
>      (description "Mesa is a free implementation of the OpenGL and Vulkan
>
> base-commit: 4547bc6fa3142dca77f7fc912368aeff31bd6e53





Information forwarded to guix-patches <at> gnu.org:
bug#65155; Package guix-patches. (Sun, 11 Feb 2024 17:38:01 GMT) Full text and rfc822 format available.

Message #11 received at 65155 <at> debbugs.gnu.org (full text, mbox):

From: David Elsing <david.elsing <at> posteo.net>
To: John Kehayias <john.kehayias <at> protonmail.com>
Cc: 65155 <at> debbugs.gnu.org, i <at> dan.games
Subject: Re: [bug#65155] [PATCH] gnu: mesa: Add native-search-paths.
Date: Sun, 11 Feb 2024 17:36:52 +0000
Hello,

John Kehayias <john.kehayias <at> protonmail.com> writes:

> So perhaps this belongs in vulkan-loader? Although I admit I'm less sure
> for XDG_* related paths. Is there a test case or something we can see if
> this does what is intended for vulkan?

I also noticed the same problem and agree that the search path belongs
in the vulkan-loader package:

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
index 285d6be7f5..98ce979652 100644
--- a/gnu/packages/vulkan.scm
+++ b/gnu/packages/vulkan.scm
@@ -303,6 +303,11 @@ (define-public vulkan-loader
            wayland))
     (inputs
      (list vulkan-headers libxrandr))
+    (native-search-paths
+     (list
+      (search-path-specification
+       (variable "XDG_DATA_DIRS")
+       (files '("share")))))
     (home-page
      "https://github.com/KhronosGroup/Vulkan-Loader")
     (synopsis "Khronos official ICD loader and validation layers for Vulkan")
--8<---------------cut here---------------end--------------->8---

I tested it with
--8<---------------cut here---------------start------------->8---
guix shell -C vulkan-tools vulkan-loader mesa --no-grafts -- vulkaninfo
--8<---------------cut here---------------end--------------->8---
which works with the patch applied. As documented in [1], vulkan-loader
still needs to be part of the profile for the search path to take effect.

Cheers,
David

[1] https://guix.gnu.org/manual/en/html_node/Search-Paths.html




Information forwarded to guix-patches <at> gnu.org:
bug#65155; Package guix-patches. (Wed, 06 Mar 2024 05:57:02 GMT) Full text and rfc822 format available.

Message #14 received at 65155 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: David Elsing <david.elsing <at> posteo.net>
Cc: 65155 <at> debbugs.gnu.org, i <at> dan.games
Subject: Re: [bug#65155] [PATCH] gnu: mesa: Add native-search-paths.
Date: Wed, 06 Mar 2024 05:55:35 +0000
Hi David and dan,

On Sun, Feb 11, 2024 at 05:36 PM, David Elsing wrote:

> Hello,
>
> John Kehayias <john.kehayias <at> protonmail.com> writes:
>
>> So perhaps this belongs in vulkan-loader? Although I admit I'm less sure
>> for XDG_* related paths. Is there a test case or something we can see if
>> this does what is intended for vulkan?
>
> I also noticed the same problem and agree that the search path belongs
> in the vulkan-loader package:
>
> diff --git a/gnu/packages/vulkan.scm b/gnu/packages/vulkan.scm
> index 285d6be7f5..98ce979652 100644
> --- a/gnu/packages/vulkan.scm
> +++ b/gnu/packages/vulkan.scm
> @@ -303,6 +303,11 @@ (define-public vulkan-loader
>             wayland))
>      (inputs
>       (list vulkan-headers libxrandr))
> +    (native-search-paths
> +     (list
> +      (search-path-specification
> +       (variable "XDG_DATA_DIRS")
> +       (files '("share")))))
>      (home-page
>       "https://github.com/KhronosGroup/Vulkan-Loader")
>      (synopsis "Khronos official ICD loader and validation layers for Vulkan")
>

Thanks for the diff, which I also tried.

>
> I tested it with
>
> guix shell -C vulkan-tools vulkan-loader mesa --no-grafts -- vulkaninfo
>
> which works with the patch applied. As documented in [1], vulkan-loader
> still needs to be part of the profile for the search path to take effect.
>
> Cheers,
> David
>
> [1] https://guix.gnu.org/manual/en/html_node/Search-Paths.html

Yes, this also works for me. It is also works on my machine when
dropping "mesa" and the "-C" without this diff; presumably because of
how my environment exists and XDG_DATA_DIRS. Probably in most desktop
setups things already work for Vulkan (or we'd have more bug reports?)
with any typical desktop/graphical packages. Still, this seems like this
should be more explicit like in the above diff for exactly the case of
things like containers or minimal testing environments.

I can apply such a change on mesa-updates soon when I make the other
mesa/vulkan/etc. updates we have pending. Feel free to submit a more
formal patch here so I can credit you as the author, though I should be
able to do the same on my own anyway.

Thanks for the diff and testing!

John





Information forwarded to guix-patches <at> gnu.org:
bug#65155; Package guix-patches. (Wed, 06 Mar 2024 07:01:02 GMT) Full text and rfc822 format available.

Message #17 received at 65155 <at> debbugs.gnu.org (full text, mbox):

From: dan <i <at> dan.games>
To: John Kehayias <john.kehayias <at> protonmail.com>,
 David Elsing <david.elsing <at> posteo.net>
Cc: 65155 <at> debbugs.gnu.org
Subject: Re: [bug#65155] [PATCH] gnu: mesa: Add native-search-paths.
Date: Wed, 6 Mar 2024 14:59:42 +0800
Hi John and David,

On 3/6/2024 1:55 PM, John Kehayias wrote:
> I can apply such a change on mesa-updates soon when I make the other
> mesa/vulkan/etc. updates we have pending. Feel free to submit a more
> formal patch here so I can credit you as the author, though I should be
> able to do the same on my own anyway.

This is actually included in my patch when trying to update vulkan-sdk 
packages: <https://issues.guix.gnu.org/69461#5>

-- 
dan





Information forwarded to guix-patches <at> gnu.org:
bug#65155; Package guix-patches. (Mon, 25 Mar 2024 01:07:02 GMT) Full text and rfc822 format available.

Message #20 received at 65155 <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: dan <i <at> dan.games>
Cc: David Elsing <david.elsing <at> posteo.net>, 65155 <at> debbugs.gnu.org
Subject: Re: [bug#65155] [PATCH] gnu: mesa: Add native-search-paths.
Date: Mon, 25 Mar 2024 01:05:40 +0000
Hi David and Dan,

On Wed, Mar 06, 2024 at 02:59 PM, dan wrote:

> Hi John and David,
>
> On 3/6/2024 1:55 PM, John Kehayias wrote:
>> I can apply such a change on mesa-updates soon when I make the other
>> mesa/vulkan/etc. updates we have pending. Feel free to submit a more
>> formal patch here so I can credit you as the author, though I should be
>> able to do the same on my own anyway.
>
> This is actually included in my patch when trying to update vulkan-sdk
> packages: <https://issues.guix.gnu.org/69461#5>

Thanks both! Will look to have that series on mesa-updates soon.

John





Reply sent to John Kehayias <john.kehayias <at> protonmail.com>:
You have taken responsibility. (Thu, 18 Apr 2024 04:47:03 GMT) Full text and rfc822 format available.

Notification sent to dan <i <at> dan.games>:
bug acknowledged by developer. (Thu, 18 Apr 2024 04:47:03 GMT) Full text and rfc822 format available.

Message #25 received at 65155-done <at> debbugs.gnu.org (full text, mbox):

From: John Kehayias <john.kehayias <at> protonmail.com>
To: dan <i <at> dan.games>
Cc: David Elsing <david.elsing <at> posteo.net>, 65155-done <at> debbugs.gnu.org
Subject: Re: [bug#65155] [PATCH] gnu: mesa: Add native-search-paths.
Date: Thu, 18 Apr 2024 04:46:30 +0000
On Sun, Mar 24, 2024 at 09:05 PM, John Kehayias wrote:

> Hi David and Dan,
>
> On Wed, Mar 06, 2024 at 02:59 PM, dan wrote:
>
>> Hi John and David,
>>
>> On 3/6/2024 1:55 PM, John Kehayias wrote:
>>> I can apply such a change on mesa-updates soon when I make the other
>>> mesa/vulkan/etc. updates we have pending. Feel free to submit a more
>>> formal patch here so I can credit you as the author, though I should be
>>> able to do the same on my own anyway.
>>
>> This is actually included in my patch when trying to update vulkan-sdk
>> packages: <https://issues.guix.gnu.org/69461#5>
>
> Thanks both! Will look to have that series on mesa-updates soon.
>
> John

This was fixed on mesa-updates and then merged to master in
2d5736cc3e869fadd2592cc13a8d332fac63b144





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 May 2024 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.