[PySide] QWebEngineView resize error

Florian Bruhin me at the-compiler.org
Tue Sep 8 22:41:13 CEST 2020

Hey Dennis,

On Tue, Sep 08, 2020 at 03:43:58PM +0200, Dennis Pielken wrote:
> This code generates a full-web-page screenshot for most pages, such as
> slashdort.org. But when visiting https://thetechportal.com/ and scrolling
> down several times, so that additional content is loaded, the code line
>     self.resize(size)
> generates the following errors:
>    [...]
>    [13092:9676:0908/151509.277:ERROR:gles2_cmd_decoder.cc(5678)]
>    GLES2DecoderImpl::ResizeOffscreenFramebuffer failed to allocate
>    storage due to excessive dimensions.
> [...]
> The gles2 errors (the last three lines) are repeated indefinitely. I have
> not found a way to fix this. I have checked that the page is not bigger than
> the maximum size of the widget.

That's the maximum size Qt allows for a widget, which probably is only
part of the equation. From what I can see, QtWebEngine doesn't set the
QWidget::maximumSize() of the QWebEngineView at all, so the height is a
maximum of 16777215 (the default).

I started digging in the code - feel free to skip the details:

-------------------- snip -------------------- 

However, that error is coming from inside the underlying Chromium:

That size is set here:

Namely to either renderbuffer_manager()->max_renderbuffer_size()
or texture_manager()->MaxSizeForTarget(GL_TEXTURE_2D), whichever is

The former is defined here, based on an OpenGL GL_MAX_RENDERBUFFER_SIZE

What that value actually is is dependent on your graphics
driver/hardware. As pointed out in the comment above that line, the GL
standard only requires this to be 1 pixel, while Chromium enforces it to
be at least 512 pixels.

The latter is coming from here, based on an OpenGL GL_MAX_TEXTURE_SIZE

Again, the GL standard only requires 16 pixels, while Chromium enforces
at least 2048 pixels.

-------------------- snip -------------------- 

Long story short: In both Chromium and QtWebEngine, any window dimension
above 512 pixels might or might not work, depending on your graphics

The only thing you could try is to force software rendering.

I'm aware of three different ways to do so, which all do something
slightly different:

- Set "QTWEBENGINE_CHROMIUM_FLAGS=--disable-gpu" in the environment
- Set "QT_QUICK_BACKEND=software" instead

You should be able to confirm that something is different in
chrome://gpu. This usually means worse performance, but I guess this
doesn't matter much here. It might mean that you can now have a bigger
QtWebEngineView, though I didn't actually try because your example isn't
self-contained enough :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20200908/ef96502b/attachment.sig>

More information about the PySide mailing list