framebuffer_session: atomic blitting and panning

By enhancing the Framebuffer::Session interface by the new RPC functions
'blit' and 'panning', GUI clients become able to attain tearing-free
output. Two modes of operations are supported.

1. Atomic back-to-front blitting

   GUI clients that partially update their user interface like regular
   application dialogs, can now implement double buffering by placing
   both the back buffer and front buffer within the GUI session's
   framebuffer and configuring a view that shows only the front buffer.
   The 'blit' operation allows the client to atomically flush pixels
   from the back buffer to the front buffer.

2. Atomic buffer flipping

   GUI clients that always update all pixels like a media player or
   a game can now use the 'panning' feature to atomically redirect the
   displayed pixels to a different portion of the GUI session's virtual
   frame buffer. The virtual framebuffer always contains two frames,
   the displayed one and the next one. Once the next frame is complete,
   the client changes the panning position to the portion containing
   the next frame.

Issue #5350
This commit is contained in:
Norman Feske
2024-09-23 16:54:05 +02:00
committed by Christian Helmuth
parent 0e33830d1f
commit 8082aa980e
13 changed files with 308 additions and 52 deletions

View File

@ -22,19 +22,15 @@ namespace Framebuffer { struct Session_client; }
struct Framebuffer::Session_client : Rpc_client<Session>
{
explicit Session_client(Session_capability session)
: Rpc_client<Session>(session) { }
explicit Session_client(Session_capability cap) : Rpc_client<Session>(cap) { }
Dataspace_capability dataspace() override {
return call<Rpc_dataspace>(); }
Dataspace_capability dataspace() override { return call<Rpc_dataspace>(); }
Mode mode() const override { return call<Rpc_mode>(); }
void mode_sigh(Signal_context_capability sigh) override {
call<Rpc_mode_sigh>(sigh); }
void mode_sigh(Signal_context_capability sigh) override { call<Rpc_mode_sigh>(sigh); }
void sync_sigh(Signal_context_capability sigh) override {
call<Rpc_sync_sigh>(sigh); }
void sync_sigh(Signal_context_capability sigh) override { call<Rpc_sync_sigh>(sigh); }
void refresh(Rect rect) override { call<Rpc_refresh>(rect); }
@ -49,6 +45,19 @@ struct Framebuffer::Session_client : Rpc_client<Session>
refresh(Rect { { x, y }, { unsigned(w), unsigned(h) } });
}
Blit_result blit(Blit_batch const &batch) override { return call<Rpc_blit>(batch); }
/**
* Transfer a single pixel region within the framebuffer
*/
Blit_result blit(Rect from, Point to)
{
Blit_batch batch { };
batch.transfer[0] = { from, to };
return blit(batch);
}
void panning(Point pos) override { call<Rpc_panning>(pos); }
};
#endif /* _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_ */