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

Avoid gpu wakeup in hwdec_cuda by deferring cuInit #14028

Merged
merged 2 commits into from
May 6, 2024

Commits on May 2, 2024

  1. hwdec_cuda: avoid gpu wakeup by deferring cuInit

    `cuInit` wakes up the nvidia dgpu on nvidia laptops. This is bad news because the wake up process
    is blocking and takes a few seconds. It also needlessly increases power consumption.
    
    Sometimes, a VO loads several hwdecs (like `dmabuf_wayland`). When `cuda` is loaded, it calls
    `cuInit` before running all interop inits. However, the first checks in the interops do not
    require cuda initialization, so we only need to call `cuInit` after those checks.
    
    This commit splits the interop `init` function into `check` and `init`. `check` can be called without
    initializing the Cuda backend, so cuInit is only called *after* the first interop check.
    
    With these changes, there's no cuda initialization if no OpenGL/Vulkan backend is available. This prevents
    `dmabuf_wayland` and other VOs which automatically load cuda from waking up the nvidia dgpu unnecessarily,
    making them start faster and decreasing power consumption on laptops.
    
    Fixes: mpv-player#13668
    jrelvas-ipc committed May 2, 2024
    Configuration menu
    Copy the full SHA
    93d7c6c View commit details
    Browse the repository at this point in the history

Commits on May 3, 2024

  1. hwdec_cuda: reduce nesting in check functions

    This simplifies the code and makes it easier to read.
    jrelvas-ipc committed May 3, 2024
    Configuration menu
    Copy the full SHA
    3053b10 View commit details
    Browse the repository at this point in the history