Avoid VAAPI on AMD drivers due to a bad memory leak

This commit is contained in:
Cameron Gutman
2018-10-14 20:37:13 -07:00
parent cb52a53922
commit d5a1189053

View File

@@ -1,3 +1,5 @@
#include <QString>
#include "vaapi.h"
#include <streaming/streamutils.h>
@@ -114,6 +116,21 @@ VAAPIRenderer::initialize(SDL_Window* window, int, int width, int height, int, b
"Driver: %s",
vendorString ? vendorString : "<unknown>");
// AMD's Gallium VAAPI driver has a nasty memory leak
// that causes memory to be leaked for each submitted frame.
// The Flatpak runtime has a VDPAU driver in place that works
// well, so use that instead on AMD systems.
if (vendorString && qgetenv("FORCE_VAAPI") != "1") {
QString vendorStr(vendorString);
if (vendorStr.contains("AMD", Qt::CaseInsensitive) ||
vendorStr.contains("Radeon", Qt::CaseInsensitive)) {
// Fail and let VDPAU pick this up
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Avoiding VAAPI on AMD driver");
return false;
}
}
// This will populate the driver_quirks
err = av_hwdevice_ctx_init(m_HwContext);
if (err < 0) {