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