Skip to content
Snippets Groups Projects
Commit bbb4a1a0 authored by Philippe Gorley's avatar Philippe Gorley Committed by Guillaume Roguez
Browse files

vaapi: prefer render nodes over card devices


Prefer renderD* nodes over card* devices, as they provide several
advantages:
- No kernel mode-setting (ie display resolution and depth)
- No insecure gem-flink (the names are global)
- No DRM-auth
- No legacy pre-KMS DRM-API

In other words, userspace can use GPUs without a privileged
graphics-server.

Change-Id: I2e6207ba2fc6e0b17f6cf0cb294c0a5188bc022e
Reviewed-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 3069cb27
Branches
Tags
No related merge requests found
......@@ -79,9 +79,11 @@ VaapiAccel::checkAvailability()
{
AVBufferRef* hardwareDeviceCtx = nullptr;
#ifdef HAVE_VAAPI_ACCEL_DRM
// try all possible devices, use first one that works
const std::string path = "/dev/dri/";
for (auto& entry : ring::fileutils::readDirectory(path)) {
auto files = ring::fileutils::readDirectory(path);
// renderD* is preferred over card*
std::sort(files.rbegin(), files.rend());
for (auto& entry : files) {
std::string deviceName = path + entry;
if (av_hwdevice_ctx_create(&hardwareDeviceCtx, AV_HWDEVICE_TYPE_VAAPI, deviceName.c_str(), nullptr, 0) >= 0) {
deviceName_ = deviceName;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment