From e5c811e8bbf2ec4b8810cf299862e96f00eb464f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 5 Jan 2026 08:54:45 +0530 Subject: [PATCH] Try disabling webengine GPU acceleration unconditionally It doesnt make any significant performance difference for ebooks and might fix crashes/blackscreen on some older Windows systems. --- manual/faq.rst | 12 ------------ src/calibre/gui2/__init__.py | 10 +++++----- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/manual/faq.rst b/manual/faq.rst index b27ee9f3fd..0987d8089f 100644 --- a/manual/faq.rst +++ b/manual/faq.rst @@ -895,18 +895,6 @@ see which one is causing the issue. Basically, stop a program, run calibre, check for crashes. If they still happen, stop another program and repeat. -The calibre E-book viewer and Edit book tools do not work on Windows? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -These two programs use hardware acceleration as they embed a version of the -Chrome browser to render HTML. If they do not work it will be because of -incompatibility with your system's GPU (graphics) drivers. Try updating these -first, and reboot. If that does not fix it, you can set the -``QTWEBENGINE_CHROMIUM_FLAGS`` environment variable to the value -``--disable-gpu`` to turn off hardware acceleration. See -`this page `_ for details. - - Using the viewer or doing any conversions results in a permission denied error on Windows ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index e02581cb0d..fcb26e9d5a 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1219,6 +1219,9 @@ class Application(QApplication): args.extend(('-platformpluginpath', plugins_loc, '-platform', os.environ.get('CALIBRE_HEADLESS_PLATFORM', 'headless'))) else: args.extend(self.palette_manager.args_to_qt) + # We disable GPU acceleration as it causes crashes/black screen in some Windows systems and + # isnt really needed for performance for our use cases. + args += ['--webEngineArgs', '--disable-gpu'] self.headless = headless from calibre_extensions import progress_indicator self.pi = progress_indicator @@ -1599,11 +1602,8 @@ def ensure_app(headless=True): has_headless = ismacos or islinux or isbsd if headless and has_headless: args += ['-platformpluginpath', plugins_loc, '-platform', os.environ.get('CALIBRE_HEADLESS_PLATFORM', 'headless')] - if isbsd: - val = os.environ.get('QTWEBENGINE_CHROMIUM_FLAGS', '') - if val: - val += ' ' - os.environ['QTWEBENGINE_CHROMIUM_FLAGS'] = f'{val}--disable-gpu' + # WebEngine GPU not needed in headless mode + args += ['--webEngineArgs', '--disable-gpu'] if ismacos: os.environ['QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM'] = '1' if headless and iswindows: