Skip to content

Conversation

sparky3387
Copy link

@sparky3387 sparky3387 commented Sep 20, 2025

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:
#15107
#10810

@sparky3387
Copy link
Author

For testing purposes, I have also got a fork with the changes needed for Haruna/mpvQt here:
https://github.com/sparky3387/mpvqt

@kasper93
Copy link
Member

Thanks, I will take a look when I get a longer second.

/cc @haasn if you are interested.

Copy link

github-actions bot commented Sep 21, 2025

@sparky3387 sparky3387 force-pushed the master branch 4 times, most recently from d683bda to 3ebc201 Compare September 22, 2025 10:17
@sparky3387
Copy link
Author

sparky3387 commented Oct 12, 2025

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-O7j+kLo0Ybvf2T0U50vBawmAwopMt0CfFHVmoIoTHBU=";
    };
  });

  # 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-u7xYhmEGHLinm3TSvJw5wbXr8Y3FgJ5QQHzpFRIahWw=";
    };

    # 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
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants