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

chromium: Add option to enable ozone (for Wayland) #82919

Merged
merged 1 commit into from Mar 28, 2020

Conversation

artemist
Copy link
Member

Motivation for this change

Chromium includes support for Wayland through the Ozone interface, but this is not enabled by default. Using Wayland allows enchanced HiDPI support, especially with monitors of disparate DPIs

Things done

Add a useOzone option to chromium packages. This does not change the derevation of chromium when useOzone is set to false, the default.

  • 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.

Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I cannot believe that this useOzone flag was still missing :o

I found a few minor things that we can probably still improve, but overall it LGTM, thanks :)

@primeos
Copy link
Member

primeos commented Mar 24, 2020

cc @colemickens maybe you could have a look as well so that we don't miss anything (since you already provide Wayland builds https://github.com/colemickens/nixpkgs-chromium)?

@colemickens
Copy link
Member

I had to add libglvnd to the wrapper to get it to start, but that was a long time ago, maybe things around GL init have changed? Otherwise it looks more complete than my attempt (which relies on @volth's chromium-git and even then I haven't properly rebased it since volth pushed their branch most recently). https://github.com/colemickens/nixpkgs-chromium/blob/master/pkgs/chromium-git/default.nix#L216

@artemist
Copy link
Member Author

The build seems to be failing now as it is unable to find several GBM definitions, including GBM_BO_USE_TEXTURING. It looks like mesa includes a very old version of gbm that doesn't have these options. If I don't use the system gbm Chrome will not start as it is unable to find libgbm.so (which should be in mesa)

@primeos
Copy link
Member

primeos commented Mar 25, 2020

@artemist thanks for the update and sorry about the additional circumstances :o

I think the best solution would be to add ozone_platform_gbm = false. I'm not familiar how that platform works but from the documentation it seems mostly relevant for Chom(e|ium) OS and might not even work on other systems.

At least for GBM_BO_USE_TEXTURING there is a merge request but it seems unlikely to be merged anytime soon. If I understand it correctly minigbm is a GBM implementation from Chomium OS and apparently it does diverge from other implementations.

If I don't use the system gbm Chrome will not start as it is unable to find libgbm.so (which should be in mesa)

In that case it should theoretically work if we add libgbm.so to the installPhase (since we copy the files manually) but using ozone_platform_gbm = false is probably still better and easier for now.

Update: I just found this blog post which suggests that the GBM backend works on GNU/Linux but it also seems to confirm that we're probably better of with ozone_platform_gbm = false for now.

Comment on lines 222 to 225
'' + optionalString useOzone ''
#substituteInPlace third_party/wayland/features.gni \
# --replace 'system_wayland_scanner_path = "/usr/bin/wayland-scanner"' \
# 'system_wayland_scanner_path = "${wayland}/bin/wayland-scanner"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please don't forget to remove this, if system_wayland_scanner_path = "${wayland}/bin/wayland-scanner"; works as expected - thanks :)

@artemist artemist force-pushed the chromium-ozone branch 2 times, most recently from 66a27a2 to 3a8e024 Compare March 27, 2020 21:16
@artemist
Copy link
Member Author

oops, I had to do a little rebasing, but everything builds successfully with useOzone = true

Copy link
Member

@primeos primeos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks again :)

@primeos primeos merged commit d83420f into NixOS:master Mar 28, 2020
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.

None yet

3 participants