Support software QtQuickRendering in Aurorae
ClosedPublic

Authored by davidedmundson on Sep 28 2017, 6:32 PM.

Details

Summary

For software QtQuick rendering we want to create a pixmap buffer and
render our contents in there.

m_rendercontrol->grab does this, but also covers the GL side in pretty
much the same way that we were currently doing.

Some calls are redundant in software mode, but they don't do any harm,
and I didn't want to pollute the code.

In doing so I found a bug in Qt, that's submitted upstream, and also worked round.

Test Plan

Tested with forced software mode, could see an Aurorae decorations
Tested without (so normal code), could see an Aurorae

Whether we then end up using GL, painter or xrender rendering is irrelevant
(but I tested two of them anyway)

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Sep 28 2017, 6:32 PM
Restricted Application added a project: KWin. · View Herald TranscriptSep 28 2017, 6:32 PM
Restricted Application added subscribers: KWin, kwin, plasma-devel. · View Herald Transcript
apol added a subscriber: apol.Sep 28 2017, 7:20 PM
apol added inline comments.
plugins/kdecorations/aurorae/src/aurorae.cpp
347

#if QT_VERSION < QT_VERSION_CHECK(5,10,0)?

graesslin added inline comments.
plugins/kdecorations/aurorae/src/aurorae.cpp
357–358

stupid question: but why is this code working? I would assume that making the context current will fail here and then we return? And even if the creation of the FBO should fail and then also return?

davidedmundson added inline comments.Sep 29 2017, 4:01 PM
plugins/kdecorations/aurorae/src/aurorae.cpp
347

Yeah, makes sense, it got +2'd quicker than I expected.

357–358

Changing the rendering doesn't block making calls to any of the openGL calls in QtBase.
The only changes are purely inside QtQuick

So:
creating a context still works fine
creating an FBO still works fine

why m_view->setRenderTarget and m_view->resetOpenGLState still work are the more interesting questions
but that's because they're virtual methods that no-op.

With this code:
we create an OpenGL context
set it to be active
then ignore it and do something completely different with QPainter instead

Check Qt version

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptOct 10 2017, 1:26 PM
graesslin added inline comments.Oct 10 2017, 4:22 PM
plugins/kdecorations/aurorae/src/aurorae.cpp
357–358

then I would suggest to guard it to only do it in the OpenGL case. Especially on Wayland without OpenGL support this could be very nasty.

Ah sorry, I had my comment here for weeks, just unsubmitted :-(

Avoid all GL in software mode.

Had a bit of a reshuffle to create the view first, so we can use the graphicsAPI from that
rather than the static methods.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptNov 1 2017, 2:21 PM
graesslin accepted this revision.Nov 1 2017, 3:04 PM
This revision is now accepted and ready to land.Nov 1 2017, 3:04 PM
This revision was automatically updated to reflect the committed changes.