vo_libmpv: introduce 'gpu-next' render backend
This commit adds a new rendering backend for the libmpv render API, named 'gpu-next'. It is designed as a successor to the legacy 'gpu' backend for API users.
The new backend is built entirely on top of libplacebo, offloading all complex rendering tasks like scaling, colorspace conversion, OSD, and tone-mapping to it. This aligns the render API with the core mpv rendering architecture with the eventual aim of reducing code duplication.
A key design goal is the decoupling of graphics API specifics from the core rendering logic. It introduces an API context interface (libmpv_gpu_next.h) that separates the API-specific host duties (like wrapping a user-provided framebuffer) from the shared, API-agnostic video engine (video.c).
This initial implementation provides an OpenGL backend, which is selected when the client specifies MPV_RENDER_API_TYPE_OPENGL. The architecture is designed to easily accommodate other backends like Vulkan or D3D11 in the future.
To use it, libmpv clients can pass the MPV_RENDER_PARAM_BACKEND parameter with the value "gpu-next" during the call to mpv_render_context_create.
Resolves: https://github.com/mpv-player/mpv/issues/15107 https://github.com/mpv-player/mpv/issues/10810
For testing purposes, I have also got a fork with the changes needed for Haruna/mpvQt here: https://github.com/sparky3387/mpvqt
Thanks, I will take a look when I get a longer second.
/cc @haasn if you are interested.
Download the artifacts for this pull request:
Windows
For anyone out there on nix os patch can be used with:
let
# 1. Define your custom mpv-unwrapped from your fork.
# We override pkgs.mpv-unwrapped, as that is the actual dependency.
mpv-unwrapped-from-fork = pkgs.mpv-unwrapped.overrideAttrs (oldAttrs: rec {
pname = "mpv-unwrapped-from-fork";
version = "git-unstable";
src = pkgs.fetchFromGitHub {
owner = "sparky3387";
repo = "mpv";
rev = "master";
hash = "sha256-LAicqT7R832vIFULi+cyDi+XHKNK+03p8ncf5GHVEh4=";
};
});
# 2. Define your custom mpvqt using overrideAttrs.
# This correctly modifies the `extraPropagatedBuildInputs` list.
mpvqt-from-fork = pkgs.kdePackages.mpvqt.overrideAttrs (oldAttrs: {
pname = "mpvqt-from-fork";
version = "git-unstable";
# Change the source to our fork
src = pkgs.fetchFromGitHub {
owner = "sparky3387";
repo = "mpvqt";
rev = "master";
hash = "sha256-nrKN+grQZou2KNqi2SnjkGsudq5CHyioGixHHGIySNc=";
};
# We remove the original `mpv-unwrapped` from the correct list
# and add our new version from your fork.
propagatedBuildInputs = lib.lists.remove pkgs.mpv-unwrapped oldAttrs.propagatedBuildInputs ++ [ mpv-unwrapped-from-fork ];
});
# 3. Override haruna to use your custom mpvqt.
# This part has been correct.
haruna-custom = pkgs.haruna.override {
kdePackages = pkgs.kdePackages // { mpvqt = mpvqt-from-fork; };
};
in
{
home.packages = with pkgs; [
haruna-custom
};