remove gpuworkaround as it's not needed anymore

This commit is contained in:
2026-10-16 01:12:21 +02:00
parent 7bc669225a
commit ead23646b2
5 changed files with 0 additions and 98 deletions
-1
View File
@@ -42,7 +42,6 @@ The only tests are the Rust crate's (`nix develop -c sh -c 'cd adblock && cargo
- Following a hint sends a real `QMouseEvent` press/release to `m_view->focusProxy()` (the render widget). The position is in CSS px multiplied by the zoom factor.
- **`CommandLine`** keeps the leading `:` in its text; deleting it cancels. It emits `commandEntered(cmd)` without the `:`, and `BrowserWindow::runCommand` parses it as name plus the rest of the line.
- **`urlutil::fromUserInput`** turns what the user typed into a URL. In order, it tries an existing local path, a full URL, then something that looks like a host (gets `https://`). Anything else becomes a DuckDuckGo search.
- **`gpuworkaround::apply()`** must run before `QApplication` is constructed, because Chromium reads `QTWEBENGINE_CHROMIUM_FLAGS` from the environment. It adds `--disable-accelerated-video-decode` only on Wayland with QtWebEngine < 6.11.2 (QTBUG-145344). Set `ATT_NO_GPU_WORKAROUND=1` to skip it.
- **The `QWebEngineProfile` is created in `main.cpp`** and passed into `BrowserWindow`. It is a named, on-disk profile with `ForcePersistentCookies`, because Qt 6's default profile is off-the-record. It is parented to the `QApplication` so it outlives the view's page. Qt warns if a profile is destroyed while a page still uses it.
- **Adblocking** is split across two parts:
- `adblock/` is a Rust staticlib exposing a hand-written C API (`att_adblock.h`, kept in sync with `src/lib.rs` by hand) over Brave's `adblock` crate. Corrosion builds it as part of `cmake --build`, always in release. Its `single-thread` default feature is off, which makes `Engine` `Send + Sync`.
-2
View File
@@ -36,8 +36,6 @@ qt_add_executable(att
src/commandline.h
src/completionview.cpp
src/completionview.h
src/gpuworkaround.cpp
src/gpuworkaround.h
src/greasemonkey.cpp
src/greasemonkey.h
src/hints.cpp
-75
View File
@@ -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
-15
View File
@@ -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
-5
View File
@@ -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"));