Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mesa: Set datadir so that the path to the DriConf defaults is correct #89657

Merged
merged 1 commit into from Aug 15, 2020

Conversation

primeos
Copy link
Member

@primeos primeos commented Jun 6, 2020

Motivation for this change

This should fix #89421. Unfortunately it results in a cyclic dependency:
cycle detected in the references of '/nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2' from '/nix/store/br6c6zm6n8h48qyrb9a4qvf3nyqkcvr6-mesa-20.0.2-drivers'

The cycle probably comes from src/util/xmlconfig.c in which case we cannot just drop the dependency. The problem is:

$ grep -R /nix/store/br6c6zm6n8h48qyrb9a4qvf3nyqkcvr6-mesa-20.0.2-drivers /nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2
Binary file /nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2/lib/libgbm.so.1 matches
Binary file /nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2/lib/libgbm.so.1.0.0 matches
Binary file /nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2/lib/libgbm.so matches
$ tree -a /nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2
/nix/store/4mnbqgm2a4b055mpmdak2b17ccp1ah82-mesa-20.0.2
└── lib
    ├── libgbm.so -> libgbm.so.1
    ├── libgbm.so.1 -> libgbm.so.1.0.0
    ├── libgbm.so.1.0.0
    ├── libglapi.so -> libglapi.so.0
    ├── libglapi.so.0 -> libglapi.so.0.0.0
    └── libglapi.so.0.0.0

On NixOS we could use /run/opengl-driver/share/ but then this wouldn't work on non-NixOS systems.

@vcunat any ideas what to do here?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/issues-preventing-proper-freesync-support/7450/4

@vcunat
Copy link
Member

vcunat commented Jun 7, 2020

Why not the other way around? drirc.d seems tiny, so change nothing except for moving it into the directory where it's searched? (within $out)

@primeos
Copy link
Member Author

primeos commented Jun 7, 2020

@vcunat so should I move the whole share/ directory (still tiny) from $drivers to $out?:

$ du -sh /nix/store/br6c6zm6n8h48qyrb9a4qvf3nyqkcvr6-mesa-20.0.2-drivers/share/
64K     /nix/store/br6c6zm6n8h48qyrb9a4qvf3nyqkcvr6-mesa-20.0.2-drivers/share/
$ tree /nix/store/br6c6zm6n8h48qyrb9a4qvf3nyqkcvr6-mesa-20.0.2-drivers/share/
/nix/store/br6c6zm6n8h48qyrb9a4qvf3nyqkcvr6-mesa-20.0.2-drivers/share/
├── drirc.d
│   └── 00-mesa-defaults.conf
├── glvnd
│   └── egl_vendor.d
│       └── 50_mesa.json
└── vulkan
    └── icd.d
        ├── intel_icd.x86_64.json
        └── radeon_icd.x86_64.json

5 directories, 4 files

In that case I think it would not end up in /run/opengl-driver/ anymore. But we could obviously change this by modifying nixos/modules/hardware/opengl.nix.

If we only load drirc.d/00-mesa-defaults.conf from the Nix store we don't need it in /run/opengl-driver/ anyway, but I don't know if we have other mechanisms that depend on /run/opengl-driver/share/ and I'm not familiar with the other files.

@vcunat
Copy link
Member

vcunat commented Jun 7, 2020

Other than making sure stuff gets found, I don't immediately know if it makes sense to configure any of these impurely (without rebuild). Theoretically it's a difference whether you use your OS settings (/run/opengl-driver) or the settings that the particular closure built with.

The effective change is that "drirc.d/00-mesa-defaults.conf" will now be
installed to $out instead of $drivers and not appear under
"/run/opengl-driver/share/" anymore.

This is done to fix NixOS#89421, i.e. so that Mesa will find and load the
included DriConf defaults. The other files in "$drivers/share" will not
be moved to $out as some Nixpkgs logic might depend on them being
available under "/run/opengl-driver/share/" (e.g. addOpenGLRunpath).
@primeos primeos marked this pull request as ready for review August 13, 2020 19:37
@primeos
Copy link
Member Author

primeos commented Aug 13, 2020

Ok, so I finally had time for another look and decided to go with a more conservative approach. The most conservative approach I could think is installing the files in shared/ to both $out and $drivers but that wouldn't be very nice (duplication) and confusing (if one tries to override files in /run/opengl-driver/share/drirc.d/). So I went with the 2nd most conservative approach I could think of and I guess this should be fine (fingers crossed). I tested this with Mesa 2.1.5 and used strace and glxinfo to confirm that drirc.d/00-mesa-defaults.conf is now found so this should be good to go if there are no objections. I also verified that at least sway, XWayland, and glxgears are still working.

@primeos primeos linked an issue Aug 13, 2020 that may be closed by this pull request
@primeos primeos merged commit dfbda21 into NixOS:staging Aug 15, 2020
@Artturin Artturin mentioned this pull request Jul 24, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mesa DriConf defaults are being ignored
3 participants