mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-08 16:56:03 +00:00
Allow radeonsi to direct render on XWayland
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
|
||||
VAAPIRenderer::VAAPIRenderer()
|
||||
: m_HwContext(nullptr),
|
||||
m_DrmFd(-1)
|
||||
m_DrmFd(-1),
|
||||
m_BlacklistedForDirectRendering(false)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -285,6 +286,7 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
major, minor);
|
||||
|
||||
const char* vendorString = vaQueryVendorString(vaDeviceContext->display);
|
||||
QString vendorStr(vendorString);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Driver: %s",
|
||||
vendorString ? vendorString : "<unknown>");
|
||||
@@ -294,8 +296,7 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
// driver in place that works well, so use that instead on AMD systems. If
|
||||
// we're using Wayland, we have no choice but to use VAAPI because VDPAU
|
||||
// is only supported under X11 or XWayland.
|
||||
if (vendorString && qgetenv("FORCE_VAAPI") != "1" && !WMUtils::isRunningWayland()) {
|
||||
QString vendorStr(vendorString);
|
||||
if (qgetenv("FORCE_VAAPI") != "1" && !WMUtils::isRunningWayland()) {
|
||||
if (vendorStr.contains("AMD", Qt::CaseInsensitive) ||
|
||||
vendorStr.contains("Radeon", Qt::CaseInsensitive)) {
|
||||
// Fail and let VDPAU pick this up
|
||||
@@ -305,6 +306,12 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
}
|
||||
}
|
||||
|
||||
if (WMUtils::isRunningWayland()) {
|
||||
// The iHD VAAPI driver can initialize on XWayland but it crashes in
|
||||
// vaPutSurface() so we must also not directly render on XWayland.
|
||||
m_BlacklistedForDirectRendering = vendorStr.contains("iHD");
|
||||
}
|
||||
|
||||
// This will populate the driver_quirks
|
||||
err = av_hwdevice_ctx_init(m_HwContext);
|
||||
if (err < 0) {
|
||||
@@ -349,10 +356,8 @@ bool
|
||||
VAAPIRenderer::isDirectRenderingSupported()
|
||||
{
|
||||
// Many Wayland renderers don't support YUV surfaces, so use
|
||||
// another frontend renderer to draw our frames. The iHD VAAPI
|
||||
// driver can initialize on XWayland but it crashes in vaPutSurface()
|
||||
// so we must also not directly render on XWayland either.
|
||||
return m_WindowSystem == SDL_SYSWM_X11 && !WMUtils::isRunningWayland();
|
||||
// another frontend renderer to draw our frames.
|
||||
return m_WindowSystem == SDL_SYSWM_X11 && !m_BlacklistedForDirectRendering;
|
||||
}
|
||||
|
||||
int VAAPIRenderer::getDecoderColorspace()
|
||||
|
||||
@@ -47,6 +47,7 @@ private:
|
||||
int m_WindowSystem;
|
||||
AVBufferRef* m_HwContext;
|
||||
int m_DrmFd;
|
||||
bool m_BlacklistedForDirectRendering;
|
||||
|
||||
#ifdef HAVE_LIBVA_X11
|
||||
Window m_XWindow;
|
||||
|
||||
Reference in New Issue
Block a user