diff --git a/repos/demo/include/scout/graphics_backend_impl.h b/repos/demo/include/scout/graphics_backend_impl.h index 9f02aacb7b..02ca1e6b93 100644 --- a/repos/demo/include/scout/graphics_backend_impl.h +++ b/repos/demo/include/scout/graphics_backend_impl.h @@ -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 diff --git a/repos/demo/src/server/liquid_framebuffer/services.cc b/repos/demo/src/server/liquid_framebuffer/services.cc index f1daa3121f..0df745cb7d 100644 --- a/repos/demo/src/server/liquid_framebuffer/services.cc +++ b/repos/demo/src/server/liquid_framebuffer/services.cc @@ -262,9 +262,9 @@ class Framebuffer::Session_component : public Genode::Rpc_object _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()); } }; diff --git a/repos/demo/src/server/nitlog/main.cc b/repos/demo/src/server/nitlog/main.cc index 8b4ef8d1ff..d376d5dcbc 100644 --- a/repos/demo/src/server/nitlog/main.cc +++ b/repos/demo/src/server/nitlog/main.cc @@ -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) diff --git a/repos/gems/src/app/decorator/main.cc b/repos/gems/src/app/decorator/main.cc index a696b4cc38..a590283eab 100644 --- a/repos/gems/src/app/decorator/main.cc +++ b/repos/gems/src/app/decorator/main.cc @@ -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); }); } /* diff --git a/repos/gems/src/app/menu_view/dialog.h b/repos/gems/src/app/menu_view/dialog.h index b4b16b8226..3ac6fa9b8b 100644 --- a/repos/gems/src/app/menu_view/dialog.h +++ b/repos/gems/src/app/menu_view/dialog.h @@ -191,7 +191,7 @@ struct Menu_view::Dialog : List_model::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; diff --git a/repos/gems/src/app/osci/main.cc b/repos/gems/src/app/osci/main.cc index 2a70ec9e9f..ccdd089209 100644 --- a/repos/gems/src/app/osci/main.cc +++ b/repos/gems/src/app/osci/main.cc @@ -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) diff --git a/repos/gems/src/app/rom_osci/main.cc b/repos/gems/src/app/rom_osci/main.cc index 16c4d492e6..9d5ee4aeb4 100644 --- a/repos/gems/src/app/rom_osci/main.cc +++ b/repos/gems/src/app/rom_osci/main.cc @@ -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) diff --git a/repos/gems/src/app/themed_decorator/window.h b/repos/gems/src/app/themed_decorator/window.h index 3c35413546..9a228103a4 100644 --- a/repos/gems/src/app/themed_decorator/window.h +++ b/repos/gems/src/app/themed_decorator/window.h @@ -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() diff --git a/repos/gems/src/server/gui_fader/main.cc b/repos/gems/src/server/gui_fader/main.cc index e6225e2df7..f19112bf5a 100644 --- a/repos/gems/src/server/gui_fader/main.cc +++ b/repos/gems/src/server/gui_fader/main.cc @@ -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 diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc index f81db3a24b..2ed39bd81b 100644 --- a/repos/gems/src/server/terminal/main.cc +++ b/repos/gems/src/server/terminal/main.cc @@ -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 */ diff --git a/repos/gems/src/test/text_painter/main.cc b/repos/gems/src/test/text_painter/main.cc index 6ad5a28685..fd0455ef5c 100644 --- a/repos/gems/src/test/text_painter/main.cc +++ b/repos/gems/src/test/text_painter/main.cc @@ -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) { diff --git a/repos/libports/src/app/pdf_view/main.cc b/repos/libports/src/app/pdf_view/main.cc index 7931ee9b42..0d775c12a5 100644 --- a/repos/libports/src/app/pdf_view/main.cc +++ b/repos/libports/src/app/pdf_view/main.cc @@ -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 }); } diff --git a/repos/libports/src/app/usb_webcam/main.cc b/repos/libports/src/app/usb_webcam/main.cc index 97ea891001..29ff6b51a0 100644 --- a/repos/libports/src/app/usb_webcam/main.cc +++ b/repos/libports/src/app/usb_webcam/main.cc @@ -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; } }; diff --git a/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc b/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc index d432ba8bf5..38ffed7fb9 100644 --- a/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc +++ b/repos/libports/src/test/mesa_demo/eglut/eglut_genode.cc @@ -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 }); } }; diff --git a/repos/os/include/framebuffer_session/client.h b/repos/os/include/framebuffer_session/client.h index 57bc389e19..7c38ada337 100644 --- a/repos/os/include/framebuffer_session/client.h +++ b/repos/os/include/framebuffer_session/client.h @@ -20,24 +20,35 @@ namespace Framebuffer { struct Session_client; } -struct Framebuffer::Session_client : Genode::Rpc_client +struct Framebuffer::Session_client : Rpc_client { explicit Session_client(Session_capability session) - : Genode::Rpc_client(session) { } + : Rpc_client(session) { } - Genode::Dataspace_capability dataspace() override { + Dataspace_capability dataspace() override { return call(); } Mode mode() const override { return call(); } - void mode_sigh(Genode::Signal_context_capability sigh) override { + void mode_sigh(Signal_context_capability sigh) override { call(sigh); } - void sync_sigh(Genode::Signal_context_capability sigh) override { + void sync_sigh(Signal_context_capability sigh) override { call(sigh); } - void refresh(int x, int y, int w, int h) override { - call(x, y, w, h); } + void refresh(Rect rect) override { call(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_ */ diff --git a/repos/os/include/framebuffer_session/connection.h b/repos/os/include/framebuffer_session/connection.h index 7d6ac22fb2..ab3ce94c6e 100644 --- a/repos/os/include/framebuffer_session/connection.h +++ b/repos/os/include/framebuffer_session/connection.h @@ -31,7 +31,7 @@ struct Framebuffer::Connection : Genode::Connection, 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(env, Label(), Ram_quota { 8*1024 }, Args("fb_width=", mode.area.w, ", " diff --git a/repos/os/include/framebuffer_session/framebuffer_session.h b/repos/os/include/framebuffer_session/framebuffer_session.h index 3f45ab9410..6b12d5a572 100644 --- a/repos/os/include/framebuffer_session/framebuffer_session.h +++ b/repos/os/include/framebuffer_session/framebuffer_session.h @@ -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); diff --git a/repos/os/src/app/pointer/main.cc b/repos/os/src/app/pointer/main.cc index ec98137354..1ee8bbcd78 100644 --- a/repos/os/src/app/pointer/main.cc +++ b/repos/os/src/app/pointer/main.cc @@ -163,7 +163,7 @@ void Pointer::Main::_show_default_pointer() convert_default_pointer_data_to_pixels(ds.local_addr(), 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(_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(_view.id(), geometry); diff --git a/repos/os/src/app/status_bar/main.cc b/repos/os/src/app/status_bar/main.cc index ceefc3426d..5ff1c9be91 100644 --- a/repos/os/src/app/status_bar/main.cc +++ b/repos/os/src/app/status_bar/main.cc @@ -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 }); } diff --git a/repos/os/src/server/gui_fb/main.cc b/repos/os/src/server/gui_fb/main.cc index c8e761a69f..cd21856247 100644 --- a/repos/os/src/server/gui_fb/main.cc +++ b/repos/os/src/server/gui_fb/main.cc @@ -201,14 +201,14 @@ struct Framebuffer::Session_component : Genode::Rpc_object _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 diff --git a/repos/os/src/server/nitpicker/framebuffer_session.h b/repos/os/src/server/nitpicker/framebuffer_session.h index 12cb71bd9a..b1eb7dd409 100644 --- a/repos/os/src/server/nitpicker/framebuffer_session.h +++ b/repos/os/src/server/nitpicker/framebuffer_session.h @@ -115,7 +115,7 @@ class Framebuffer::Session_component : public Rpc_object _sync_sigh = sigh; } - void refresh(int x, int y, int w, int h) override; + void refresh(Rect) override; }; #endif /* _FRAMEBUFFER_SESSION_COMPONENT_H_ */ diff --git a/repos/os/src/server/nitpicker/main.cc b/repos/os/src/server/nitpicker/main.cc index c4eb01ee80..f3ee93956e 100644 --- a/repos/os/src/server/nitpicker/main.cc +++ b/repos/os/src/server/nitpicker/main.cc @@ -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()) diff --git a/repos/os/src/server/vmm/virtio_gpu.cc b/repos/os/src/server/vmm/virtio_gpu.cc index 9214e119ca..7b26d892dc 100644 --- a/repos/os/src/server/vmm/virtio_gpu.cc +++ b/repos/os/src/server/vmm/virtio_gpu.cc @@ -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 } }); }); } diff --git a/repos/os/src/test/capture/main.cc b/repos/os/src/test/capture/main.cc index 347b13a6b2..8724e42083 100644 --- a/repos/os/src/test/capture/main.cc +++ b/repos/os/src/test/capture/main.cc @@ -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); }); }); }); diff --git a/repos/os/src/test/nitpicker/main.cc b/repos/os/src/test/nitpicker/main.cc index c6643dc4c5..ac7bece9ee 100644 --- a/repos/os/src/test/nitpicker/main.cc +++ b/repos/os/src/test/nitpicker/main.cc @@ -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 }); diff --git a/repos/os/src/test/vfs_capture/main.cc b/repos/os/src/test/vfs_capture/main.cc index 43b15f7b01..2781ea444b 100644 --- a/repos/os/src/test/vfs_capture/main.cc +++ b/repos/os/src/test/vfs_capture/main.cc @@ -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); }); }); }); diff --git a/repos/ports/src/virtualbox5/frontend/fb.h b/repos/ports/src/virtualbox5/frontend/fb.h index 89e332779d..78505b1a3d 100644 --- a/repos/ports/src/virtualbox5/frontend/fb.h +++ b/repos/ports/src/virtualbox5/frontend/fb.h @@ -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() diff --git a/repos/ports/src/virtualbox6/include/fb.h b/repos/ports/src/virtualbox6/include/fb.h index f1db4d66a0..3e43eafa19 100644 --- a/repos/ports/src/virtualbox6/include/fb.h +++ b/repos/ports/src/virtualbox6/include/fb.h @@ -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()