Skip to content

Commit

Permalink
Merge branch 'master' into freebsd
Browse files Browse the repository at this point in the history
  • Loading branch information
elFarto authored Feb 11, 2024
2 parents 9743084 + 3eb412e commit f0025c4
Show file tree
Hide file tree
Showing 11 changed files with 339 additions and 290 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
DISTRO: ${{ matrix.os }}
steps:
- name: 'Checkout'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Install toolchain'
if: ${{ (matrix.compiler == 'clang-15') }}
run: .github/workflows/install-clang.sh 15
Expand Down
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ This is an VA-API implementation that uses NVDEC as a backend. This implementati
- [Table of contents](#table-of-contents)
- [Codec Support](#codec-support)
- [Installation](#installation)
- [Package manager](#package-manager)
- [Packaging status](#packaging-status)
- [Building](#building)
- [Removal](#removal)
- [Configuration](#configuration)
- [Upstream regressions](#upstream-regressions)
- [Kernel parameters](#kernel-parameters)
- [Environment Variables](#environment-variables)
- [Firefox](#firefox)
- [Chrome](#chrome)
- [MPV](#mpv)
- [Direct Backend](#direct-backend)
- [Testing](#testing)
Expand Down Expand Up @@ -51,16 +53,15 @@ To install and use `nvidia-vaapi-driver`, follow the steps in installation and c

* NVIDIA driver series 470 or 500+

## Package manager
## Packaging status

| Distribution | Package name |
|---|---|
| Arch<sup>AUR</sup> | [libva-nvidia-driver](https://aur.archlinux.org/packages/libva-nvidia-driver) |
| Arch<sup>AUR</sup> | [libva-nvidia-driver-git](https://aur.archlinux.org/packages/libva-nvidia-driver-git) |
| Debian,Ubuntu | nvidia-vaapi-driver<sup>[debian](https://tracker.debian.org/pkg/nvidia-vaapi-driver) [ubuntu](https://packages.ubuntu.com/kinetic/nvidia-vaapi-driver)</sup> |
| Fedora, RHEL and derivates (Rocky, Alma, etc).| [nvidia-vaapi-driver](https://github.com/rpmfusion/nvidia-vaapi-driver) |
<p align="top"><a href="https://repology.org/project/nvidia-vaapi-driver/versions"><img src="https://repology.org/badge/vertical-allrepos/nvidia-vaapi-driver.svg" alt="repology"><a href="https://repology.org/project/libva-nvidia-driver/versions"><img src="https://repology.org/badge/vertical-allrepos/libva-nvidia-driver.svg" alt="repology" align="top" width="%"></p>

[pkgs.org/nvidia-vaapi-driver](https://pkgs.org/search/?q=nvidia-vaapi-driver) [pkgs.org/libva-nvidia-driver](https://pkgs.org/search/?q=libva-nvidia-driver)

openSUSE: [1](https://software.opensuse.org/package/nvidia-vaapi-driver), [2](https://software.opensuse.org/package/libva-nvidia-driver).

Feel free to add your distributions package in an issue/PR.
Feel free to add your distributions package in an issue/PR, if it isn't on these websites.

## Building

Expand All @@ -85,7 +86,11 @@ By default the driver installs itself as `/usr/lib64/dri/nvidia_drv_video.so` (t

# Configuration

**IMPORTANT**: The [direct backend](#direct-backend) is currently required on NVIDIA driver series 525 due to a regression (see [issue #126](/../../issues/126)).
## Upstream regressions

The EGL backend is broken on driver versions 525 or later due to a regression. Users running these drivers should use the [direct backend](#direct-backend) instead.

For more information read the [upstream bug report](https://forums.developer.nvidia.com/t/cueglstreamproducerconnect-returns-error-801-on-525-53-driver/233610) or [issue #126](/../../issues/126).

## Kernel parameters

Expand All @@ -103,7 +108,7 @@ Environment variables used to control the behavior of this library.

## Firefox

To use the driver with firefox you will need at least Firefox 96, `ffmpeg` compiled with vaapi support (search ffmpeg output for --enable-vaapi), and the following config options need to be set in the `about:config` page:
To use the driver with firefox you will need at least Firefox 96, `ffmpeg` compiled with vaapi support (`ffmpeg -hwaccels` output should include vaapi), and the following config options need to be set in the `about:config` page:

| Option | Value | Reason |
|---|---|---|
Expand All @@ -118,15 +123,16 @@ In addition the following environment variables need to be set. For permanent co
| Variable | Value | Reason |
|---|---|---|
| MOZ_DISABLE_RDD_SANDBOX | 1 | Disables the sandbox for the RDD process that the decoder runs in. |
| EGL_PLATFORM | wayland | Required on FF98+ when running on Wayland, due to a regression that has been introduced. |
| LIBVA_DRIVER_NAME | nvidia | For libva versions prior to 2.15, this forces libva to load the `nvidia` backend. |
| LIBVA_DRIVER_NAME | nvidia | Required for libva 2.20+, forces libva to load this driver. |
| __EGL_VENDOR_LIBRARY_FILENAMES | /usr/share/glvnd/egl_vendor.d/10_nvidia.json | Required for the 470 driver series only. It overrides the list of drivers the glvnd library can use to prevent Firefox from using the MESA driver by mistake. |

When libva is used it will log out some information, which can be excessive when Firefox initalises it multiple times per page. This logging can be suppressed by adding the following line to the `/etc/libva.conf` file:
```
LIBVA_MESSAGING_LEVEL=1
```

If you're using the Snap version of Firefox, it will be unable to access the host version of the driver that is installed.

## Chrome

Chrome is currently unsupported, and will not function.
Expand Down
7 changes: 5 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ deps = [
cc.find_library('dl', required : false),
dependency('egl'),
dependency('ffnvcodec', version: '>= 11.1.5.1'),
dependency('libva', version: '>= 1.8.0').partial_dependency(compile_args: true),
dependency('libdrm', version: '>=2.4.60').partial_dependency(compile_args: true),
dependency('threads'),
]
libva_deps = dependency('libva', version: '>= 1.8.0').partial_dependency(compile_args: true)
deps += [libva_deps]

gst_codecs_deps = dependency('gstreamer-codecparsers-1.0', required: false)

if cc.get_argument_syntax() == 'gcc'
Expand Down Expand Up @@ -69,6 +71,7 @@ if gst_codecs_deps.found()
endif

nvidia_incdir = include_directories('nvidia-include')
nvidia_install_dir = libva_deps.get_variable(pkgconfig: 'driverdir')

shared_library(
'nvidia_drv_video',
Expand All @@ -77,7 +80,7 @@ shared_library(
dependencies: deps,
include_directories: nvidia_incdir,
install: true,
install_dir: get_option('libdir') / 'dri',
install_dir: nvidia_install_dir,
gnu_symbol_visibility: 'hidden',
)

Expand Down
20 changes: 20 additions & 0 deletions nvidia-include/nvidia-drm-ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
DRM_IOWR((DRM_COMMAND_BASE + DRM_NVIDIA_GET_DEV_INFO), \
struct drm_nvidia_get_dev_info_params)

#define DRM_IOCTL_NVIDIA_GET_DEV_INFO_545 \
DRM_IOWR((DRM_COMMAND_BASE + DRM_NVIDIA_GET_DEV_INFO), \
struct drm_nvidia_get_dev_info_params_545)

/*
* XXX Solaris compiler has issues with DRM_IO. None of this is supported on
* Solaris anyway, so just skip it.
Expand Down Expand Up @@ -136,6 +140,22 @@ struct drm_nvidia_get_dev_info_params {
uint32_t sector_layout; /* OUT */
};

struct drm_nvidia_get_dev_info_params_545 {
uint32_t gpu_id; /* OUT */
uint32_t primary_index; /* OUT; the "card%d" value */

uint32_t supports_alloc; /* OUT */
/* The generic_page_kind, page_kind_generation, and sector_layout
* fields are only valid if supports_alloc is true.
* See DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D definitions of these. */
uint32_t generic_page_kind; /* OUT */
uint32_t page_kind_generation; /* OUT */
uint32_t sector_layout; /* OUT */
uint32_t supports_sync_fd; /* OUT */
uint32_t supports_semsurf; /* OUT */
};


struct drm_nvidia_fence_context_create_params {
uint32_t handle; /* OUT GEM handle to fence context */

Expand Down
21 changes: 21 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Created by stephen on 12/11/23.
//

#ifndef COMMON_H
#define COMMON_H

typedef struct
{
uint32_t x;
uint32_t y;
} NVSubSampling;

typedef struct
{
uint32_t channelCount;
uint32_t fourcc;
NVSubSampling ss; // subsampling
} NVFormatPlane;

#endif //COMMON_H
Loading

0 comments on commit f0025c4

Please sign in to comment.