mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
framebuffer_session: use Rect as refresh argument
This patch replaces basic-type arguments x, y, w, h by the 'Rect' type, and imports the Genode namespace into the Framebuffer namespace. Issue #5350
This commit is contained in:
parent
e1b24d1ebd
commit
0e33830d1f
@ -79,8 +79,8 @@ class Scout::Graphics_backend_impl : public Graphics_backend
|
||||
void _refresh_view(Rect rect)
|
||||
{
|
||||
int const y_offset = _flip_state ? _max_size.h : 0;
|
||||
_gui.framebuffer.refresh(rect.x1(), rect.y1() + y_offset,
|
||||
rect.w(), rect.h());
|
||||
_gui.framebuffer.refresh({ { rect.x1(), rect.y1() + y_offset },
|
||||
rect.area });
|
||||
}
|
||||
|
||||
template <typename PT>
|
||||
|
@ -262,9 +262,9 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
_timer.trigger_periodic(10*1000);
|
||||
}
|
||||
|
||||
void refresh(int x, int y, int w, int h) override
|
||||
void refresh(Rect rect) override
|
||||
{
|
||||
_window_content.redraw_area(x, y, w, h);
|
||||
_window_content.redraw_area(rect.x1(), rect.y1(), rect.w(), rect.h());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -444,7 +444,7 @@ struct Nitlog::Main
|
||||
void _handle_timer()
|
||||
{
|
||||
if (_log_window.draw())
|
||||
_gui.framebuffer.refresh(0, 0, _win_w, _win_h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, { _win_w, _win_h } });
|
||||
}
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
|
@ -82,7 +82,7 @@ struct Decorator::Main : Window_factory_base
|
||||
Dirty_rect dirty = _window_stack.draw(_canvas->canvas);
|
||||
|
||||
dirty.flush([&] (Rect const &r) {
|
||||
_gui.framebuffer.refresh(r.x1(), r.y1(), r.w(), r.h()); });
|
||||
_gui.framebuffer.refresh(r); });
|
||||
}
|
||||
|
||||
Window_stack _window_stack = { *this };
|
||||
@ -322,7 +322,7 @@ void Decorator::Main::_handle_gui_sync()
|
||||
_gui.execute();
|
||||
|
||||
dirty.flush([&] (Rect const &r) {
|
||||
_gui.framebuffer.refresh(r.x1(), r.y1(), r.w(), r.h()); });
|
||||
_gui.framebuffer.refresh(r); });
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -191,7 +191,7 @@ struct Menu_view::Dialog : List_model<Dialog>::Element
|
||||
});
|
||||
|
||||
_buffer->flush_surface();
|
||||
_gui.framebuffer.refresh(0, 0, _buffer->size().w, _buffer->size().h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, _buffer->size() });
|
||||
_update_view(Rect(_position, size));
|
||||
|
||||
_redraw_scheduled = false;
|
||||
|
@ -159,7 +159,7 @@ struct Osci::Main
|
||||
|
||||
_gui_buffer->flush_surface();
|
||||
|
||||
_gui.framebuffer.refresh(0, 0, _size.w, _size.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, _size });
|
||||
}
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
|
@ -305,7 +305,7 @@ struct Osci::Main
|
||||
channel.render(pixel, alpha, phase_lock); }); });
|
||||
|
||||
_gui_buffer->flush_surface();
|
||||
_gui.framebuffer.refresh(0, 0, _size.w, _size.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, _size });
|
||||
}
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
|
@ -287,7 +287,7 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
|
||||
buffer.flush_surface();
|
||||
|
||||
buffer.gui.framebuffer.refresh(0, 0, buffer.size().w, buffer.size().h);
|
||||
buffer.gui.framebuffer.refresh({ { 0, 0 }, buffer.size() });
|
||||
}
|
||||
|
||||
void _repaint_decorations()
|
||||
|
@ -207,7 +207,7 @@ class Gui_fader::Framebuffer_session_component
|
||||
|
||||
transfer_src_to_dst_alpha(rect);
|
||||
|
||||
_gui.framebuffer.refresh(rect.x1(), rect.y1(), rect.w(), rect.h());
|
||||
_gui.framebuffer.refresh(rect);
|
||||
|
||||
/* keep animating as long as the destination value is not reached */
|
||||
return _fade != _fade.dst();
|
||||
@ -238,12 +238,12 @@ class Gui_fader::Framebuffer_session_component
|
||||
_gui.framebuffer.mode_sigh(sigh);
|
||||
}
|
||||
|
||||
void refresh(int x, int y, int w, int h) override
|
||||
void refresh(Rect rect) override
|
||||
{
|
||||
transfer_src_to_dst_pixel(Rect(Point(x, y), Area(w, h)));
|
||||
transfer_src_to_dst_alpha(Rect(Point(x, y), Area(w, h)));
|
||||
transfer_src_to_dst_pixel(rect);
|
||||
transfer_src_to_dst_alpha(rect);
|
||||
|
||||
_gui.framebuffer.refresh(x, y, w, h);
|
||||
_gui.framebuffer.refresh(rect);
|
||||
}
|
||||
|
||||
void sync_sigh(Genode::Signal_context_capability sigh) override
|
||||
|
@ -155,7 +155,7 @@ struct Terminal::Main : Character_consumer
|
||||
|
||||
Rect const dirty = _text_screen_surface->redraw(surface);
|
||||
|
||||
_gui.framebuffer.refresh(dirty.x1(), dirty.y1(), dirty.w(), dirty.h());
|
||||
_gui.framebuffer.refresh(dirty);
|
||||
}
|
||||
|
||||
/* update view geometry after mode change */
|
||||
|
@ -80,7 +80,7 @@ struct Test::Main
|
||||
|
||||
Vfs_font _font_4 { _heap, _root, "fonts/regular" };
|
||||
|
||||
void _refresh() { _fb.refresh(0, 0, _size.w, _size.h); }
|
||||
void _refresh() { _fb.refresh({ { 0, 0 }, _size }); }
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ void Pdf_view::show()
|
||||
dst_line += dst_line_width;
|
||||
}
|
||||
|
||||
_gui.framebuffer.refresh(0, 0, _nit_mode.area.w, _nit_mode.area.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, _nit_mode.area });
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,9 +69,7 @@ class Viewer
|
||||
|
||||
uint8_t *framebuffer() { return _framebuffer; }
|
||||
|
||||
void refresh() {
|
||||
_gui.framebuffer.refresh(0, 0, _mode.area.w, _mode.area.h);
|
||||
}
|
||||
void refresh() { _gui.framebuffer.refresh({ { 0, 0 }, _mode.area }); }
|
||||
|
||||
Framebuffer::Mode const &mode() { return _mode; }
|
||||
};
|
||||
|
@ -82,7 +82,7 @@ struct Window : Genode_egl_window
|
||||
|
||||
void refresh()
|
||||
{
|
||||
gui.framebuffer.refresh(0, 0, mode.area.w, mode.area.h);
|
||||
gui.framebuffer.refresh({ { 0, 0 }, mode.area });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -20,24 +20,35 @@
|
||||
namespace Framebuffer { struct Session_client; }
|
||||
|
||||
|
||||
struct Framebuffer::Session_client : Genode::Rpc_client<Session>
|
||||
struct Framebuffer::Session_client : Rpc_client<Session>
|
||||
{
|
||||
explicit Session_client(Session_capability session)
|
||||
: Genode::Rpc_client<Session>(session) { }
|
||||
: Rpc_client<Session>(session) { }
|
||||
|
||||
Genode::Dataspace_capability dataspace() override {
|
||||
Dataspace_capability dataspace() override {
|
||||
return call<Rpc_dataspace>(); }
|
||||
|
||||
Mode mode() const override { return call<Rpc_mode>(); }
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability sigh) override {
|
||||
void mode_sigh(Signal_context_capability sigh) override {
|
||||
call<Rpc_mode_sigh>(sigh); }
|
||||
|
||||
void sync_sigh(Genode::Signal_context_capability sigh) override {
|
||||
void sync_sigh(Signal_context_capability sigh) override {
|
||||
call<Rpc_sync_sigh>(sigh); }
|
||||
|
||||
void refresh(int x, int y, int w, int h) override {
|
||||
call<Rpc_refresh>(x, y, w, h); }
|
||||
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) } });
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__FRAMEBUFFER_SESSION__CLIENT_H_ */
|
||||
|
@ -31,7 +31,7 @@ struct Framebuffer::Connection : Genode::Connection<Session>, Session_client
|
||||
* session, you should validate the actual frame-buffer attributes
|
||||
* by calling the 'info' method of the frame-buffer interface.
|
||||
*/
|
||||
Connection(Genode::Env &env, Framebuffer::Mode mode)
|
||||
Connection(Env &env, Framebuffer::Mode mode)
|
||||
:
|
||||
Genode::Connection<Session>(env, Label(), Ram_quota { 8*1024 },
|
||||
Args("fb_width=", mode.area.w, ", "
|
||||
|
@ -26,7 +26,11 @@ namespace Framebuffer {
|
||||
struct Session;
|
||||
struct Session_client;
|
||||
|
||||
using Area = Genode::Surface_base::Area;
|
||||
using namespace Genode;
|
||||
|
||||
using Area = Surface_base::Area;
|
||||
using Point = Surface_base::Point;
|
||||
using Rect = Surface_base::Rect;
|
||||
}
|
||||
|
||||
|
||||
@ -37,9 +41,9 @@ struct Framebuffer::Mode
|
||||
{
|
||||
Area area;
|
||||
|
||||
Genode::size_t bytes_per_pixel() const { return 4; }
|
||||
size_t bytes_per_pixel() const { return 4; }
|
||||
|
||||
void print(Genode::Output &out) const { Genode::print(out, area); }
|
||||
void print(Output &out) const { Genode::print(out, area); }
|
||||
};
|
||||
|
||||
|
||||
@ -70,7 +74,7 @@ struct Framebuffer::Session : Genode::Session
|
||||
* have detached the previously requested dataspace from its local
|
||||
* address space.
|
||||
*/
|
||||
virtual Genode::Dataspace_capability dataspace() = 0;
|
||||
virtual Dataspace_capability dataspace() = 0;
|
||||
|
||||
/**
|
||||
* Request display-mode properties of the framebuffer ready to be
|
||||
@ -89,30 +93,30 @@ struct Framebuffer::Session : Genode::Session
|
||||
* method. However, from the client's perspective, the original mode
|
||||
* stays in effect until the it calls 'dataspace()' again.
|
||||
*/
|
||||
virtual void mode_sigh(Genode::Signal_context_capability sigh) = 0;
|
||||
virtual void mode_sigh(Signal_context_capability sigh) = 0;
|
||||
|
||||
/**
|
||||
* Flush specified pixel region
|
||||
*
|
||||
* \param x,y,w,h region to be updated on physical frame buffer
|
||||
* \param rect region to be updated on physical frame buffer
|
||||
*/
|
||||
virtual void refresh(int x, int y, int w, int h) = 0;
|
||||
virtual void refresh(Rect rect) = 0;
|
||||
|
||||
/**
|
||||
* Register signal handler for refresh synchronization
|
||||
*/
|
||||
virtual void sync_sigh(Genode::Signal_context_capability) = 0;
|
||||
virtual void sync_sigh(Signal_context_capability) = 0;
|
||||
|
||||
|
||||
/*********************
|
||||
** RPC declaration **
|
||||
*********************/
|
||||
|
||||
GENODE_RPC(Rpc_dataspace, Genode::Dataspace_capability, dataspace);
|
||||
GENODE_RPC(Rpc_dataspace, Dataspace_capability, dataspace);
|
||||
GENODE_RPC(Rpc_mode, Mode, mode);
|
||||
GENODE_RPC(Rpc_refresh, void, refresh, int, int, int, int);
|
||||
GENODE_RPC(Rpc_mode_sigh, void, mode_sigh, Genode::Signal_context_capability);
|
||||
GENODE_RPC(Rpc_sync_sigh, void, sync_sigh, Genode::Signal_context_capability);
|
||||
GENODE_RPC(Rpc_refresh, void, refresh, Rect);
|
||||
GENODE_RPC(Rpc_mode_sigh, void, mode_sigh, Signal_context_capability);
|
||||
GENODE_RPC(Rpc_sync_sigh, void, sync_sigh, Signal_context_capability);
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_dataspace, Rpc_mode, Rpc_mode_sigh, Rpc_refresh,
|
||||
Rpc_sync_sigh);
|
||||
|
@ -163,7 +163,7 @@ void Pointer::Main::_show_default_pointer()
|
||||
|
||||
convert_default_pointer_data_to_pixels(ds.local_addr<Genode::Pixel_rgb888>(),
|
||||
pointer_size);
|
||||
_gui.framebuffer.refresh(0, 0, pointer_size.w, pointer_size.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, pointer_size });
|
||||
|
||||
Gui::Rect geometry(Gui::Point(0, 0), pointer_size);
|
||||
_gui.enqueue<Gui::Session::Command::Geometry>(_view.id(), geometry);
|
||||
@ -224,7 +224,7 @@ void Pointer::Main::_show_shape_pointer(Shape_report &shape_report)
|
||||
Dither_painter::paint(alpha_surface, texture);
|
||||
}
|
||||
|
||||
_gui.framebuffer.refresh(0, 0, shape_size.w, shape_size.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, shape_size });
|
||||
|
||||
Gui::Rect geometry(shape_hot, shape_size);
|
||||
_gui.enqueue<Gui::Session::Command::Geometry>(_view.id(), geometry);
|
||||
|
@ -157,7 +157,7 @@ void Status_bar::Buffer::draw(Domain_name const &domain_name,
|
||||
_draw_label(surface, view_rect.center(_label_size(domain_name, label)),
|
||||
domain_name, label, color);
|
||||
|
||||
_gui.framebuffer.refresh(0, 0, area.w, area.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, area });
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,14 +201,14 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
|
||||
_mode_sigh = sigh;
|
||||
}
|
||||
|
||||
void refresh(int x, int y, int w, int h) override
|
||||
void refresh(Rect rect) override
|
||||
{
|
||||
if (_dataspace_is_new) {
|
||||
_view_updater.update_view();
|
||||
_dataspace_is_new = false;
|
||||
}
|
||||
|
||||
_gui.framebuffer.refresh(x, y, w, h);
|
||||
_gui.framebuffer.refresh(rect);
|
||||
}
|
||||
|
||||
void sync_sigh(Signal_context_capability sigh) override
|
||||
|
@ -115,7 +115,7 @@ class Framebuffer::Session_component : public Rpc_object<Session>
|
||||
_sync_sigh = sigh;
|
||||
}
|
||||
|
||||
void refresh(int x, int y, int w, int h) override;
|
||||
void refresh(Rect) override;
|
||||
};
|
||||
|
||||
#endif /* _FRAMEBUFFER_SESSION_COMPONENT_H_ */
|
||||
|
@ -54,10 +54,8 @@ extern char _binary_default_tff_start[];
|
||||
** Framebuffer::Session_component **
|
||||
************************************/
|
||||
|
||||
void Framebuffer::Session_component::refresh(int x, int y, int w, int h)
|
||||
void Framebuffer::Session_component::refresh(Rect rect)
|
||||
{
|
||||
Rect const rect(Point(x, y), Area(w, h));
|
||||
|
||||
_view_stack.mark_session_views_as_dirty(_session, rect);
|
||||
}
|
||||
|
||||
@ -426,7 +424,7 @@ struct Nitpicker::Main : Focus_updater, Hover_updater,
|
||||
|
||||
/* flush pixels to the framebuffer, reset dirty_rect */
|
||||
_dirty_rect.flush([&] (Rect const &rect) {
|
||||
_fb.refresh(rect.x1(), rect.y1(), rect.w(), rect.h()); });
|
||||
_fb.refresh(rect); });
|
||||
|
||||
/* deliver framebuffer synchronization events */
|
||||
for (Gui_session *s = _main._session_list.first(); s; s = s->next())
|
||||
|
@ -223,7 +223,7 @@ void Vmm::Virtio_gpu_control_request::_resource_flush()
|
||||
uint32_t line_dst = _device._fb_mode.area.w * BYTES_PER_PIXEL;
|
||||
|
||||
blit(src, line_src, dst, line_dst, w*BYTES_PER_PIXEL, h);
|
||||
_device._gui.framebuffer.refresh(x, y, w, h);
|
||||
_device._gui.framebuffer.refresh({ { int(x), int(y) }, { w, h } });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -164,9 +164,7 @@ struct Test::Main
|
||||
});
|
||||
|
||||
affected.for_each_rect([&] (Gui::Rect const rect) {
|
||||
_output->_gui.framebuffer.refresh(rect.x1(), rect.y1(),
|
||||
rect.w(), rect.h());
|
||||
});
|
||||
_output->_gui.framebuffer.refresh(rect); });
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -265,7 +265,7 @@ Test::Main::Main(Genode::Env &env) : _env(env)
|
||||
}
|
||||
}
|
||||
|
||||
_gui.framebuffer.refresh(0, 0, size.w, size.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, size });
|
||||
|
||||
_view_stack.construct(View_stack::Input_mask_ptr { .size = size,
|
||||
.ptr = input_mask });
|
||||
|
@ -179,9 +179,7 @@ struct Test::Main
|
||||
});
|
||||
|
||||
affected.for_each_rect([&] (Gui::Rect const rect) {
|
||||
_output->_gui.framebuffer.refresh(rect.x1(), rect.y1(),
|
||||
rect.w(), rect.h());
|
||||
});
|
||||
_output->_gui.framebuffer.refresh(rect); });
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -67,7 +67,7 @@ class Genodefb :
|
||||
size_t const max_h = Genode::min(_fb_mode.area.h, _virtual_fb_mode.area.h);
|
||||
size_t const num_pixels = _fb_mode.area.w * max_h;
|
||||
memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
|
||||
_gui.framebuffer.refresh(0, 0, _virtual_fb_mode.area.w, _virtual_fb_mode.area.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, _virtual_fb_mode.area });
|
||||
}
|
||||
|
||||
void _adjust_buffer()
|
||||
|
@ -65,7 +65,7 @@ class Genodefb :
|
||||
size_t const max_h = Genode::min(_fb_mode.area.h, _virtual_fb_mode.area.h);
|
||||
size_t const num_pixels = _fb_mode.area.w * max_h;
|
||||
memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
|
||||
_gui.framebuffer.refresh(0, 0, _virtual_fb_mode.area.w, _virtual_fb_mode.area.h);
|
||||
_gui.framebuffer.refresh({ { 0, 0 }, _virtual_fb_mode.area });
|
||||
}
|
||||
|
||||
void _adjust_buffer()
|
||||
|
Loading…
Reference in New Issue
Block a user