-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Draft: oneVPL for intel gpu #242359
Draft: oneVPL for intel gpu #242359
Conversation
I haven't checked the changes here against my own derivations, but I can already leave some notes:
If you want to try whether environment.variables.ONEVPL_SEARCH_PATH = lib.strings.makeLibraryPath (with pkgs; [intel-media-sdk oneVPL-intel-gpu]); |
amazing work, thanks for taking a look! I'll be back home next week but until then I don't have time to test. |
changed the PR title to oneVPL from libvpl, and I intend on changing the package name as well |
FYI. Here's the relevant code in |
These are the derivations and overlays I currently use as part of my NixOS configuration. The oneVPL repos are non-flake inputs to my configuration flake.
The My oneVPL-intel-gpu derivation:{
lib,
stdenv,
cmake,
pkg-config,
gtest,
libdrm,
libva,
self,
}:
stdenv.mkDerivation rec {
pname = "onevpl-intel-gpu";
version = "custom";
src = self.inputs.onevpl-intel-gpu;
nativeBuildInputs = [cmake pkg-config];
buildInputs = [
libdrm
libva
];
nativeCheckInputs = [gtest];
cmakeFlags = [
"-DBUILD_TESTS=${
if doCheck
then "ON"
else "OFF"
}"
"-DUSE_SYSTEM_GTEST=ON"
];
doCheck = true;
meta = with lib; {
description = "Intel oneVPL GPU Runtime";
license = licenses.mit;
platforms = ["x86_64-linux"];
};
} My oneVPL derivation:{
self,
lib,
stdenv,
cmake,
pkg-config,
gtest,
libdrm,
libffi,
libpciaccess,
libva,
libX11,
libXau,
libXdmcp,
wayland,
wayland-protocols,
...
}:
stdenv.mkDerivation rec {
pname = "onevpl";
version = "custom";
src = self.inputs.onevpl;
nativeBuildInputs = [cmake pkg-config];
buildInputs = [
libdrm
libffi
libpciaccess
libva
libX11
libXau
libXdmcp
wayland
wayland-protocols
];
nativeCheckInputs = [gtest];
cmakeFlags = [
"-DBUILD_TESTS=${
if doCheck
then "ON"
else "OFF"
}"
"-DUSE_SYSTEM_GTEST=ON"
"-DINSTALL_EXAMPLE_CODE=OFF"
];
doCheck = false;
meta = with lib; {
description = "Intel oneVPL GPU Runtime";
license = licenses.mit;
platforms = ["x86_64-linux"];
};
} My jellyfin-ffmpeg overlay:final: prev: {
jellyfin-ffmpeg = final.ffmpeg_6-full.overrideAttrs (finalAttrs: prevAttrs: {
src = final.fetchFromGitHub {
owner = "jellyfin";
repo = "jellyfin-ffmpeg";
rev = "v6.0-4";
sha256 = "sha256-o0D/GWbSoy5onbYG29wTbpZ8z4sZ2s1WclGCXRMSekA=";
};
version = "custom";
buildInputs = prevAttrs.buildInputs ++ [final.onevpl];
configureFlags = (final.lib.lists.remove "--enable-libmfx" prevAttrs.configureFlags) ++ ["--enable-libvpl"];
});
jellyfin = prev.jellyfin.override {
ffmpeg = final.jellyfin-ffmpeg;
};
} |
@evanrichter I think I've got it working in Nixpkgs. Could you check the changes in my fork? I based those on this PR. See https://github.com/PJungkamp/nixpkgs/tree/onevpl Feel free to pull those into your branch. I'm not quite settled on NixOS yet, so I won't fill myself in as a maintainer and thus won't create a PR myself. Using
But using Remember that
Building |
@PJungkamp hey, thanks for documenting everything here and in that linked issue. EDIT2: it looks likes its because I was setting the various envvars using EDIT3: last edit, I promise... you need to also be sure to add these variables to |
@J-Swift thanks for sharing your findings! Because of the nuance with environment variables to actually get these libraries to work at runtime, I think I should also define a nixos module like I'm hoping to test myself this week, and finally mark this PR ready. I'm not sure if the ffmpeg maintainers will like having a change like this so close to 23.11 feature freeze, so I'll probably leave the |
The ffmpeg part of this is probably rather trivial. As long as it builds and still works for everything else, I don't see why we shouldn't add this to at least ffmpeg-full. Once it's been enabled there for a release, we can move it to regular ffmpeg should some other package (jellyfin?) require it. Closure size might be a concern at that point, have you tested that? |
@evanrichter yeah there is some stuff in the nixos-hardware configs (https://github.com/NixOS/nixos-hardware/blob/master/common/cpu/intel/default.nix and https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/intel/default.nix), I added my own jellyfin service wrapper to do as you describe. Here is what I've got for reference (
|
558cfd2
to
445dde9
Compare
@Atemu closure size goes down by a few MB, seemingly because intel-media-sdk is not a direct dependency, but it would be found at runtime by the new onevpl dependency. Which now that I think about it, that will probably cause problems for uses depending on intel-media-sdk playback or rendering due to library search paths? see @J-Swift's work adding the necessary environment variable: ONEVPL_SEARCH_PATH = lib.strings.makeLibraryPath (with pkgs; [oneVPL-intel-gpu intel-media-sdk]); here's the output of @PJungkamp I pulled in your commit for ffmpeg, hope that's ok!
|
445dde9
to
5c94b8d
Compare
Awesome! My Nix Build Machine that was supposed to run jellyfin is currently down, so I lost sight of this issue... I also took a look into intel-media-sdk, which can also discover the onevpl backend at runtime. This seems to be done by searching a path specified at build time (MODULES_PATH I think), where the media-sdk .so is installed into and the onevpl .so is searched for. Maybe we should also pull onevpl as an optional, default enabled dependency into the media sdk derivation. That would make all media sdk remaining consumers get the proper GPU acceleration on Alder Lake and newer. |
Maybe putting it into the buildInputs is enough, it seems to search for onevpl in the normal library path. |
Please follow the contributing guide on how to change the merge base. |
Description of changes
I got an Intel Arc dedicated gpu and want to test hardware decoding with ffmpeg. This requires using
libvpl
instead oflibmfx
to interface with hardware, and is a configure flag in ffmpeg (newer sources than currently in nixpkgs).This PR:
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)