Multi-process Lighthouse

Published Friday March 18th, 2011 | by

Lighthouse is the Window System Agnostic port of QtGui. What that means is that QtGui doesn’t know what windowing system it runs on, but pushes that logic into plugins.

A missing feature of Lighthouse up until now was that we didn’t provide a multi-process solutions where you had Qt running on both the server side and the client side (like we had in QWS). You could write such a thing yourself, of course: Marius designed a protocol when he was creating his windowing system for his DevDays presentation. However, Paul and I both agreed on that we didn’t want to create or maintain a protocol. One of the lessons from QWS is that making a multiprocess Window System protocol is difficult. QWS didn’t really have a formal protocol, but rather something that just happened. This also resulted in the QWS server and client being very closely tied.

It would be nice if someone out there was just making a protocol that we could use. It turns out that the Wayland project is just that! Its a specification for a multiprocess windowing system. The Wayland client and server libraries gives means for communicating between server and client, but it does not interfere with what is being drawn, or how it is being composited. The server in Wayland is a compositing window manager, or “compositor” for short. For a deeper insight into Wayland, check out their homepage at: http://wayland.freedesktop.org/

For the last couple of months, Paul, Samuel and I have been getting our hands dirty with Wayland. What became apparent to us quite quickly is that there is not going to be one compositor to rule them all! An embedded device with a small screen has very different requirements from the Linux desktop. However, we would like many of them to be Qt compositors. We have therefore created a new labs project called Qt-Compositor. The goal of the project is to work as a tool box which is being used as a base layer for other people when they are going to write their own custom Wayland compositors.

OverviewHere is a simple diagram that I made which tries to show the intended architecture. The lighthouse plugin which runs on the screen will control mode-setting etc. The display information is available in the Qt-Compositor and Custom Compositor levels through Qt apis and Lighthouse apis.

Qt-Compositor abstracts away all communication needed by a Wayland compositor. Hence the primary task for someone who implements a custom compositor is how the surfaces will be drawn.

On the client side, the display information is sent over the protocol, and is available to all clients through the usual Qt-APIs.

What I think is exciting about this is that this setup is that a compositor can be made with utilizing any painting technology which is in Qt!

  • If you want to compose them using QPainter on a QWidget: “SURE! why not. knock yourself out:)”
  • If you want to compose them using QGraphicsView: “Hey! whats that scrollarea doing there:)
  • If you want to compose surfaces using the up and coming Qt – Quick scene graph project: “oooh, that is interesting!”

A few days ago, Samuel made this super cool example compositor using qml scene graph. Its not a full featured compositor, but it shows some pretty cool features, like how to integrate Qt-Compositor with qml and how to easily write shaders for your surfaces.

The Qml-Compositor example

Did you like this? Share it:

Posted in Lighthouse, MeeGo, Qt

17 comments to Multi-process Lighthouse

TomCooksey says:

Nice. :-) You’re making my 4 year old dream a reality. Excellent work.

Konstantin Tokarev says:

Are you running Wayland on top of X11 on the screenshot?

Konstantin Tokarev says:

BTW, I think XCB backend of Lighthouse is much more important for the near future of Linux desktop.

ezjd says:

I really like the flexibility to use different drawing backend. Thanks!
Wish MeeGo can use this because their mcompositor is bound to opengl es.

I like where this is going :)

Antonio says:

> Lighthouse is the Window System Agnostic port of QtGui.
So Lighthouse thinks that the window system does not exist? :-)

If we use “window system indifferent” we get a more accurate description of what is happening there.

Anyway, those are good news for us! And for mankind, I would say :-), since this technology is free/libre for all.

Uning says:

Is that effective to use lighthouse plugins in different processes? I worried about the performance.

Jørgen Lind says:

@Konstantin Tokarev: Yes, the screenshot shows the qml-compositor running with the xcb backend. The architecture lets you choose what kind of backend you want to run the compositor with. Samuel wrote the xcb backend some weeks ago, and its pretty kick ass :) Its still in its early days, and we are experiencing some weird event handling, but we’r working on it:)
@Antonio: Lighthouse is Window System agnostic. It doesn’t need a window system to run:) This is how its possible to use Lighthouse on the compositor side.
@Uning: There is no cross-process communication between the Lighthouse plugins and QtGui. The cross-process communication is between the client applications and the compositing server.

Antonio says:

In http://labs.qt.nokia.com/2010/02/10/a-lighthouse-with-windows/ we find a definition of what a window system is
“As you probably know, the window system is the process that manages the windows on your screen.”

> It doesn’t need a window system to run:)
That doesn’t mean that Lighthouse thinks that windows systems do not exist. Lighthouse behaves indifferent to an external window system.

Jørgen Lind says:

@Antonio: He he he. Ok:) I remember checking this with Paul, back when we started to use the term, and we came to the conclusion that this was OK. Also, this morning before I replied to your post, I rechecked with Oxford Advanced Learner’s dict. and it had the def. : “person who believes that nothing can be known about the existence of God or of anything except material things.” It comes down to definition I suppose.

M says:

Good news, especially for Android. Google was troubling by Oracle, so they are eagerly seeking for a C++ development framework. And Qt can be one of their best choices.

Konstantin Tokarev says:

@Jørgen: Will XCB backend be included into 4.8 release?

Trevour says:

Antonio, you’re conflating “agnostic” with “atheistic”. And, even if the usage in the blog post is somehow wrong, it’s used often enough that it’s at least reached jargon level.

Ben says:

@Konstantin Tokarev: No, I think that the definition he quoted was sufficiently different.

A quick search of the two terms at wikipedia (I know, we all hate it, but it is a good reference) and here’s what I see:
Atheist – Someone who explicitly does not believe in something (deities or gods, since I haven’t heard it in any other context).
Agnosticist – Someone who believes that you cannot know for sure whether something (in the case of gods, whether they exist or not) is true or not (that doesn’t really tell you about whether they believe in a god or not, though…a definite maybe). However, I usually hear this term used in describing someone who doesn’t follow any religion in particular while not disclaiming any particular religion. In that sense, it sort of fits the use of agnostic in the case of Lighthouse, as it doesn’t use any windowing system in particular, but it doesn’t deny their existence.

Ben says:

Err, @Trevour: That comment was a response to you, not Konstantin Tokarev.

…sorry! ^.^

Markus says:

Hmm – how to overcome the graphics HW integration issues to get the best performance? GPU manufacturers are not exactly the greatest open source supporters as they need to differentiate their features against the competition…

Rune K. Svendsen says:

Jørgen Lind: >> Lighthouse is the Window System Agnostic port of QtGui.
Antonio: >So Lighthouse thinks that the window system does not exist?

“Agnostic” doesn’t mean to hold the belief that something does not exist. It means to hold no belief; Lighthouse has no concept of a windowing system. Agnosticism is defined by a *lack* of belief, rather than a presence of a belief that says something either exists or doesn’t exist.

In my opinion, “window system agnostic” is the perfect description for something that does not concern itself with a windowing system.

Commenting closed.