Norman Feske 8082aa980e 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
2024-10-08 09:09:23 +02:00

64 lines
1.6 KiB
C++

/*
* \brief Client-side framebuffer interface
* \author Norman Feske
* \date 2006-07-10
*/
/*
* Copyright (C) 2006-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_
#define _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_
#include <framebuffer_session/capability.h>
#include <base/rpc_client.h>
namespace Framebuffer { struct Session_client; }
struct Framebuffer::Session_client : Rpc_client<Session>
{
explicit Session_client(Session_capability cap) : Rpc_client<Session>(cap) { }
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 sync_sigh(Signal_context_capability sigh) override { call<Rpc_sync_sigh>(sigh); }
void refresh(Rect rect) override { call<Rpc_refresh>(rect); }
/**
* Flush specified pixel region
*
* \deprecated
* \noapi
*/
void refresh(int x, int y, int w, int h)
{
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_ */