remove gpuworkaround as it's not needed anymore
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
#include "gpuworkaround.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QLatin1String>
|
||||
#include <QString>
|
||||
#include <QVersionNumber>
|
||||
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr auto kChromiumFlagsVar = "QTWEBENGINE_CHROMIUM_FLAGS";
|
||||
constexpr auto kDisableVideoDecode = "--disable-accelerated-video-decode";
|
||||
|
||||
// First release carrying the multi-planar NativePixmap import fix.
|
||||
const QVersionNumber kFixedIn(6, 11, 2);
|
||||
|
||||
bool envIsSet(const char *name)
|
||||
{
|
||||
const char *value = std::getenv(name);
|
||||
return value != nullptr && *value != '\0';
|
||||
}
|
||||
|
||||
bool envIsTruthy(const char *name)
|
||||
{
|
||||
const char *value = std::getenv(name);
|
||||
if (value == nullptr || *value == '\0')
|
||||
return false;
|
||||
const QLatin1String s(value);
|
||||
return s != QLatin1String("0") && s != QLatin1String("false");
|
||||
}
|
||||
|
||||
// The runtime version, not QTWEBENGINECORE_VERSION: linking against a fixed
|
||||
// QtWebEngine should drop the workaround without rebuilding att.
|
||||
bool webEngineHasFix()
|
||||
{
|
||||
QString version = QString::fromLatin1(qWebEngineVersion());
|
||||
const QVersionNumber parsed = QVersionNumber::fromString(version);
|
||||
return !parsed.isNull() && parsed >= kFixedIn;
|
||||
}
|
||||
|
||||
// X11/GLX only ever imports BGRA8888 buffers, so it never hits the bug.
|
||||
bool onWayland()
|
||||
{
|
||||
const char *forced = std::getenv("QT_QPA_PLATFORM");
|
||||
if (forced != nullptr && *forced != '\0')
|
||||
return QLatin1String(forced).startsWith(QLatin1String("wayland"));
|
||||
return envIsSet("WAYLAND_DISPLAY");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace gpuworkaround {
|
||||
|
||||
void apply()
|
||||
{
|
||||
if (envIsTruthy("ATT_NO_GPU_WORKAROUND"))
|
||||
return;
|
||||
if (!onWayland() || webEngineHasFix())
|
||||
return;
|
||||
|
||||
QByteArray flags(qgetenv(kChromiumFlagsVar));
|
||||
|
||||
// Leave an explicit opinion about video decoding alone, whichever way it goes.
|
||||
if (flags.contains("accelerated-video-decode"))
|
||||
return;
|
||||
|
||||
if (!flags.isEmpty())
|
||||
flags.append(' ');
|
||||
flags.append(kDisableVideoDecode);
|
||||
qputenv(kChromiumFlagsVar, flags);
|
||||
}
|
||||
|
||||
} // namespace gpuworkaround
|
||||
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace gpuworkaround {
|
||||
|
||||
// Works around QTBUG-145344: on Wayland, QtWebEngine before 6.11.2 cannot import
|
||||
// the multi-planar (YUV420) buffers that VA-API hardware decoding hands it, so
|
||||
// video renders as black/flickering while the log fills with
|
||||
// "SharedImageManager::ProduceSkia: ... non-existent mailbox". Disables
|
||||
// accelerated video decoding only where the bug applies.
|
||||
//
|
||||
// Must be called before QApplication is constructed. Set ATT_NO_GPU_WORKAROUND=1
|
||||
// to skip it.
|
||||
void apply();
|
||||
|
||||
} // namespace gpuworkaround
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "adblock.h"
|
||||
#include "browserwindow.h"
|
||||
#include "gpuworkaround.h"
|
||||
#include "greasemonkey.h"
|
||||
#include "history.h"
|
||||
#include "urlutil.h"
|
||||
@@ -47,10 +46,6 @@ constexpr auto kStyleSheet = R"(
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Chromium reads its flags out of the environment, so this has to happen
|
||||
// before QtWebEngine gets a chance to initialize.
|
||||
gpuworkaround::apply();
|
||||
|
||||
QApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationName(QStringLiteral("att"));
|
||||
QCoreApplication::setApplicationVersion(QStringLiteral("0.1.0"));
|
||||
|
||||
Reference in New Issue
Block a user