[haiku-development] Re: Help needed for WebKit2 port about app_server and bitmaps

  • From: Dario Casalinuovo <b.vitruvio@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 27 Jul 2019 12:08:33 +0200

Moreover, we would like to leverage the fact that on Haiku, drawing
happens on the server side. This means, ideally, the UI process does not
really need to access the bitmap data, it can just ask app_server to
draw it.

The drawing occurs in an app_server Window thread which is directed by a
client BWindow and its attached BViews.  The client doesn't really need
to access the BBitmap data directly unless it's doing direct
manipulation.... So it would seem what you really need is a simple means
of sharing BBitmaps between owners within the app_server - a global
BBitmap.

This doesn't seem like something that would be particularly complicated
to implement - a reference counted SharedServerBitmap on the app_server
side which can be shared between ServerApps and Window threads without
any data copying, just a MultiLocker for synchronization and a means to
find shared bitmaps.


While it should be possible to do something like that, using a shared
semaphore for synchronization, I don't think that would be a good idea.
Allowing apps to edit directly the server bitmap is going to cause lot of
troubles. What I'd do, considering the chromium multiprocess design (e.g.
the tab bar is rendered by the main process, the tabs are rendered by
rendering processes. This means that basically you are not going to draw
all the tabs at the same time, and if that happened there would be another
BWindow in the middle.

Chrome instantiates a new process per window and tab, so makes sense to me
to just have an area/bitmap shared between rendering processes and having
the processes holding the BWindow handle drawing it. That looks something
very similar to a shared framebuffer, where the buffer is the area down the
navigation bar of the browser.

Other related posts: