Commit Graph

877 Commits

Author SHA1 Message Date
Norman Feske
3ab9173b20 gui_session: window-closed state as attribute
With the change of "gui_session: provide mode info as XML", the
client-side window-close handling became dysfunct because the
window-close state got wrongly interpreted as initial window state, to
the effect that a client's initial-window size policy got applied
instead of closing the window.

This patch makes the inital state of running a windowed application
(when no window size is defined yet) clearly distiguishable from the
state after which the user closed the window. Prior this patch, both
conditions were reflected by an empty <capture/> node in the panorama.
Now, the latter condition is reported as <capture closed="yes"/>, which
alleviates the need to track the life cycle of a window at the client
size.

Issue #5353
2024-10-30 08:14:55 +01:00
Norman Feske
d7830a0ce6 Add Input::Session::exclusive() interface
This interface allows a GUI client to express the intent to exclusively
observe relative motion events while locking the absolute pointer
position. This patch merely extends the interface without implementing
it.

As this change touches os/include/input/component.h, it moves the
manage/dissolve operations into the class, ensuring the call of
dissolve at destruction time.

Issue #5355
2024-10-08 09:09:24 +02:00
Norman Feske
318d641266 gui_session: provide mode info as XML
In multi-monitor scenarios, the mode is no longer a single rectangular
area but a panorama with potentially many captured rectangles. This
patch replaces the former 'mode' and 'mode_sigh' RPC by a new 'info'
ROM accessor.

Issue #5353
2024-10-08 09:09:24 +02:00
Norman Feske
d29cb0a15d Gui::Connection::buffer: fix upgrade loop
Once set to true, the 'retry' flag would never be reset to false.

Issue #5242
2024-10-08 09:09:24 +02:00
Norman Feske
e69c01aad3 framebuffer_session: add sync_source selection
The new Framebuffer::Session::sync_source RPC function allows for the
selection of a specific source of sync signals in the presence of
multiple capture clients at the GUI server.

This patch contains only the extension of the interface. The information
is not evaluated by the GUI server yet.

Issue #5347
2024-10-08 09:09:24 +02:00
Norman Feske
5b4e1915d8 framebuffer_session: accessors for buffer surfaces
This patch adds central and safe utilities for accessing the distinct
parts of the virtual framebuffer to relieve clients from pointer
calculations.

Issue #5351
2024-10-08 09:09:24 +02:00
Norman Feske
388218a3f9 os/surface.h: support windowed surface access
This patch eases the vertical organization of multiple surfaces within
one larger surface, which is the case when keeping front/back buffers
within one compounding GUI buffer.

Issue #5351
2024-10-08 09:09:23 +02:00
Norman Feske
e738162bde framebuffer_session: alpha as Mode attribute
Propagate the want of an alpha channel as attribute of Framebuffer::Mode
instead of passing this property as a separate bool argument.

This clears the way for adding useful accessors for pixel/alpha/input
surfaces to the Mode type as a subsequent step.

Issue #5351
2024-10-08 09:09:23 +02:00
Norman Feske
336d481726 os: Pixel_input8 type for input-mask access
Issue #5351
2024-10-08 09:09:23 +02:00
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
Norman Feske
0e33830d1f 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
2024-10-08 09:09:23 +02:00
Norman Feske
09461c51bd capture_session: capture stop/wakeup protocol
With this change, a client (i.e., display driver) can register
a wakeup signal handler to be notified on the arrival of new data to
capture. The signal is delivered only when the client has stopped
capturing. The client propagates this condition to the server using
the new 'capture_stopped' RPC call.

This change in principle enables a display driver to suspend its
periodic mode of operation after a few frames without capturing any
new data. As the first driver, the fb_sdl driver has been adapted to
the new protocol. This change not only eliminates the driver's CPU
load when idle, it also reduces the latency of sporadic output
because the response to such GUI updates is no longer bound by a
fixed periodic interval.

Issue #5344
2024-10-08 09:09:22 +02:00
Norman Feske
c527a4e0e4 util/dirty_rect.h: accessor for empty state
Provide an easy way to check for the absence of any dirty pixels.

Issue #5344
2024-10-08 09:09:22 +02:00
Norman Feske
3f1759a4d1 capture_session: detection of idle capture server
This patch enhances the Capture::Connection::Screen such that the
bounding box of the affected pixels can be tracked by the caller,
which can use this information to adjust its behavior to the
activity/inactivity of the capture server.

Issue #5344
2024-10-08 09:09:22 +02:00
Norman Feske
6d68d3297d capture_session: propagate physical size in mm
This patch adds the physical screen size as argument to the
Capture::Session::buffer RPC function, which allows drivers to
propagate DPI information to the GUI server. While changing the
the interface, the patch replaces the former use of C++ exceptions
by a result type. The 'Buffer_result' is handled transparently by the
Capture::Connection. The client.h code is now integrated in
connection.h.

Issue #5344
2024-10-08 09:09:22 +02:00
Norman Feske
e83ace4242 decorator: fix window-stacking glitch
This is a follow-up commit to "gui_session: manage view ID at the client
side", which missed to invalidate the neighbor view of a window but
instead wrongly assigned the (now always valid) view ID 0 as neighbor.
In situations where a window disappears and re-appears (e.g., repeatedly
launching testnit in the wm.run scenario), the new window could not
always be topped.

Issue #5242
2024-10-07 15:54:59 +02:00
Norman Feske
3ba8ddc85c gui_session: mark RPC client methods as nodiscard
Issue #5340
2024-10-07 15:54:59 +02:00
Norman Feske
a9b2d9bdc6 gui_session: adjust session quota for wm scenarios
The current default session RAM quota of 36 KiB reflects the needs of
the nitpicker GUI server. However, in most commonly used scenarios, a
GUI client connects to nitpicker indirectly via the wm. The low value
worked so far because the wm did not account RAM and cap usage per
client so far but paid out of its own pocket and faithfully forwarded
all resource upgrades to nitpicker.

When adding resource accounting to the wm, the old default value has the
effect that a new client has to repeatedly attempt the session creation -
each time offering sligthly more session quota - until both nitpicker and
the wm are satisfied.

By roughly doubling the default to 80 KiB, a wm client immediately
succeeds with opening a GUI session without repeated attempts.
By specifying a custom 'cap_quota' amount to the 'Genode::Connection',
the Gui::Connection now donates enough caps for both the wm and
nitpicker.

Issue #5340
2024-10-07 14:44:31 +02:00
Norman Feske
7e95d5701f os: remove os/handle_registry.h
This utility is superseded by the Id_space.

Issue #5242
Fixes #5317
2024-08-27 15:29:38 +02:00
Norman Feske
d762da8659 gui_session: allow return of View_capbility_error
This interface change gives GUI servers the freedom to allocate view
capabilities at the time of request instead of the creation time of the
view. This is useful because view capabilities are rarely needed.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
faf90f259c gui_session: rename 'view_id' to 'associate'
The view ID is specified as first argument to be consistent with 'view'
and 'child_view'.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
f98c356efd gui_session: manage view ID at the client side
This patch moves the management of view IDs from the server to the
client side. The former 'create_view' and 'create_child_view'
operations do no longer return a view ID but take a view ID as
argument. While changing those operations, this patch takes the
opportunity to allow for initial view attributes. Combined, those
changes simplify the window manager while accommodating typical
client use cases with less code.

To ease the client-side ID management, the Gui::Connection hosts
a 'view_ids' ID space for optional use. E.g., the new 'Top_level_view'
class uses this ID space for ID allocation. This class accommodates the
most typical use case of opening a single window.

The 'alloc_view_id' RPC function is no longer needed.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
805e3552fd gui_session: definition of Gui::Title
This commit allows all GUI clients and servers to talk about the same
type.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
24378ac873 gui_session: rename View_handle to View_id
The former Gui::Session::View_handle is not called Gui::View_id.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
d02a3d25d0 gui_session: replace Handle_registry by Id_space
This patch reworks the view-ID handling within the nitpicker GUI server
and the window manager. The namespace of view handles are now represented
as an Id_space. In constrast to the former "handles", which could be
invalid, IDs cannot be semantically overloaded with anything other than
an actual view reference. There is no notion of an invalid handle.
IDs are like C++ references (which cannot be a nullptr).

This change requires the code to be more explicit. E.g., the stacking of
a few at the front-most position can no longer be expressed by passing
an invalid handle as neighbor.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
4e711d4738 gui_session: split alloc_view_handle, view_handle
Express the allocation of a new view handle by a dedicated RPC function
instead of passing an invalid view handle to the existing 'view_handle'
function.

This eliminates the notion of invalid view handles at the GUI session
interface, clearing the way for managing view handles via an Id_space.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
f274ed549e gui_session: distinguish view-stacking operations
This patch eliminates the use of invalid view handles as special
Session::Command arguments. The TO_FRONT and TO_BACK operations
interpreted as invalid neighbor as top-most or back-most position.
Those corner cases are now expressed via dedicated commands. The
new stacking commands are FRONT, BACK, FRONT_OF, and BEHIND_OF.

While changing the command interface, the patch removes the OP_
prefix from the opcode values.

Issue #5242
2024-08-27 15:29:38 +02:00
Norman Feske
b0803eabdb gui_session: simplify input/framebuffer aggregate
- Rename framebuffer_session to framebuffer and
  input_session to input as those RPC interfaces are no longer
  meant to be used as stand-alone sessions.

- Host Connection::input and Connection::framebuffer as public
  members, thereby removing the use of pointers. This simplifies
  the client-sized code. E.g., '_gui.input()->pending()' becomes
  '_gui.input.pending()'.

Issue #5242
2024-08-27 15:29:37 +02:00
Norman Feske
9823b7dbd0 gui_session: remove C++ exceptions
To maintain ease of use at the client side, the OUT_OF_RAM and
OUT_OF_CAPS results are handled at the 'Gui::Connection' now.

Gui::Connection does not inherit the Gui::Session interface any longer,
which allows for the use of different result types.

Issue #5242
Issue #5245
2024-08-27 15:29:37 +02:00
Norman Feske
1c148c7984 gui_session.h: distinguish child-view creation
This patch replaces the optional parent argument of the create_view
RPC function by a dedicated create_child_view RPC function. This
is a preparatory step of removing the notion of an invalid handle
as a special case.

Issue #5242
2024-08-27 15:29:37 +02:00
Stefan Kalkowski
672179c3b8 usb: correct order of index, value in Alt_setting
Fix genodelabs/genode#5315
2024-08-27 15:29:37 +02:00
Pirmin Duss
96ef527436 Gpio::Connection accept a session label
This allows a component to access GPIOs from different banks of
an SOC.

Issue genodelabs#5273
2024-08-27 15:24:20 +02:00
Norman Feske
19c13877ca Replace use of 'typedef' by 'using'
Issue #5227
2024-07-02 12:00:11 +02:00
Stefan Kalkowski
f1f2d759af libusb: re-enable timeout setting for control urbs
Fix genodelabs/genode#5259
2024-07-02 11:59:16 +02:00
Stefan Kalkowski
73b65084e2 pin_session: add missing header
Fix genodelabs/genode#5258
2024-07-02 11:59:16 +02:00
Norman Feske
0105494223 Rework Region_map interface
- Remove exceptions
- Use 'Attr' struct for attach arguments
- Let 'attach' return 'Range' instead of 'Local_addr'
- Renamed 'Region_map::State' to 'Region_map::Fault'

Issue #5245
Fixes #5070
2024-07-02 11:59:16 +02:00
Norman Feske
24342db476 base/signal.h: remove pointers from API
This patch updates the signal API to avoid raw pointers, and
replaces the Context_already_in_use and Context_not_associated
exceptions by diagnostic messages.

Fixes #5247
2024-06-20 12:56:19 +02:00
Norman Feske
7de2f57ef2 Remove Xml_node::attribute accessors
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue #5245
Fixes #5246
2024-06-20 12:56:19 +02:00
Martin Stein
ac42ade48c nic_router: remove use of exception handling
Remove the use of C++ exception as much as possible from the router as C++
exception handling can be resource intensive and can make code hard to
understand.

This also removes the garbage collection that the router used to do when a
session ran out of quota. This is motivated by the fact that the garbage
collection was rather simple and removed connection states regardless of their
current state, thereby causing broken connections. The change is part of this
commit as the approach to integrating garbage collection relied strongly on
exception handling.

The user story behind removing garbage collection: The router emergency-dropped
an established TCP connection (with NAPT) and on the next matching packet
re-created it with a different NAPT port, thereby breaking the connection. With
this commit, existing connections are prioritized over new ones during resource
exhaustion and the packets that attempt to create a new connection in such a
state are dropped with a warning in the log (verbose_packet_drop="yes").

Note that the state resolves itself with time as existing connections time out
or are closed by peers.

Ref #4729
2024-06-20 12:54:31 +02:00
Martin Stein
0faec6afaa net/port.h: default constructor
Adds default constructor to Net::Port that initializes the value to 0. This
allows for using Net::Port with the Genode::Attempt utility.

Ref #4729
2024-06-20 12:54:30 +02:00
Norman Feske
b9594c2ae8 gui_session,nitpicker,testnit: update coding style
- Replace 'typedef' by 'using'
- Avoid plain pointers
- Import Genode namespace into Gui::
- Use enum class
- Use Attr struct for passing multiple attributes
- Turn testnit into proper Genode::Component
  - Use distinct types for top-level and child views
  - Remove dependency from timer
  - Use util/geometry.h
2024-06-20 12:54:30 +02:00
Norman Feske
c629c54153 Make util/geometry.h C++20 friendly
- Move header to base/include to make it applicable for base types
  like 'Affinity' down the road.
- Represent 'Rect' as typle of point and area, which is the most
  common form of initialization, creates in valid 'Rect' by default.
- Turn Point, Area, and Rect into compound types, making x, y, w, h, at,
  area accessible without a method call
- 'Rect::Compound' function for constructing a 'Rect' from two points,
  replacing a former constructor
- Use result type 'Rect::Cut_remainder' instead of out parameters.

Fixes #5239
2024-06-20 12:54:30 +02:00
Norman Feske
bb06d879aa os: make 'Genode::Color' C++20 friendly
This patch turns 'Color' from a class to a POD type by replacing
the constructors by the named create functions 'rgb', 'clamped_rgb',
and 'clamped_rgba'. It thereby enables the initialization of Color
values using { .r = ... } syntax and makes the type usable in const
expressions.

It also narrows the type for color components and alpha values to
uint8_t. So possible integer overflows of computed values are detected
by -Wconversion.

As 'Color::rgb(0, 0, 0)' is repeatedly used as a default value, the
patch adds the 'Color::black()' function.

Fixes #5238
2024-06-20 12:54:30 +02:00
Norman Feske
eca864175c Remove Gui::Session::session_control
This functionality has long been superseded by the window
manager/layouter.

Fixes #5160
2024-06-20 12:54:29 +02:00
Johannes Schlatow
78a6d2bd0c os: fix multiplication wrap-around in Area::count
When having a maximized terminal window, a suspend was causing an
invalid mode change at nitpicker. This triggered a huge resource request
in nitpicker because the RAM-quota check was rendered ineffective by a
wrap-around during unsigned multiplication.

Issue genodelabs/genode#5180
Fixes genodelabs/genode#5201
2024-06-20 12:54:29 +02:00
Norman Feske
f171bc5050 Remove loader and qpluginwidget
The original use cases of the loader have long been covered by the
dynamic init. The only substantial client of the loader remained to be
the qpluginwidget. However, the qpluginwidget was supported only by the
Arora web browser. But the blending of plugins with websites ultimately
remained a tech demo, and Arora has been replaced by Falkon.

Fixes #5229
2024-05-29 09:18:12 +02:00
Norman Feske
cfd013a01a os/include: use C++20 function template syntax
Issue #5227
2024-05-29 09:18:12 +02:00
Stefan Kalkowski
2f0fe562ec os: packet_allocator needs size for free
Unlike the previous return value of
`Genode::Packet_allocator::need_size_for_free()` indicated, it does need
the size of the object it has to free to work properly.
2024-04-12 15:05:14 +02:00
Christian Prochaska
2eae70d3cd os/vfs.h: add support for symlink creation
Fixes #5162
2024-04-12 15:00:44 +02:00
Christian Helmuth
960670b16c decorator: fix handling of back-most window
Before, the current back-most window was not restacked if it was part of
the already, which lead to partially inconsistent view of the window
stack between decorator and nitpicker.
2024-04-12 15:00:44 +02:00