[Qtwebengine] Revisiting texture streaming

Mansoor C mchishtie at gmail.com
Tue Mar 11 22:09:32 CET 2014


Hi,

Taking a second look at how delegated rendering works on qtwebengine,
I wonder if there could be some shared-context related issues when
rendering video ...

It is my understanding that when two GL contexts (threads) share
resources, it is up to the application to ensure that whenever a
resource (texture in this case) is being modified, it is not accessed
by other threads. For non-stream textures, I see this constraint is
met in the way qt-renderer thread interacts with chromium-gpu thread.
I see that DFN::preprocess blocks qt-renderer thread whenever a new
MailboxTexture is received from chromium whose textureId is  not set
yet. Then chromium gpu thread unblocks qt-renderer after all
MailboxTextures are ready. My understanding is that this happens once
for each new texture. This is fine for regular textures because once
an image is loaded on a texture by gpu thread, it does not ever has to
change again. If content changes later, a different texture will be
sent by chromium and previous texture will be removed.

But what about video textures? I think that a MailboxTexture
containing video stays unchanged in the RenderPass (its textureId
stays the same) - only a new video frame will be periodically uploaded
to that texture by the gpu thread. This implies that the qt-renderer
thread would never wait on this texture to be updated - except for the
very first time when this texture appeared new in a RenderPass. Could
that be a problem given that the gpu thread would be updating this
texture while at the same time qt-renderer thread might be drawing
with the same texture?

I don't know enough about GPU shared contexts but from what I
understood this could be a potential problem. Could it cause any
rendering artifacts? This is not just about the recent StreamVideo
material that my patch introduced in qtwebengine - but I think same
thing would happen in case of YUVVideo material as well. I haven't
studied YUVVideo code but I assume that the same three MailboxTextures
would be reused over and over again while video is playing.

Is there something I am missing?

Thanks,
Mansoor Chishtie
BlackBerry



More information about the QtWebEngine mailing list