summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal
AgeCommit message (Collapse)Author
2014-10-02terminal: move unifont-internal.h to unifont.hDavid Herrmann
All the definitions are for outside users, so drop the -internal suffix. Internal definitions are in unifont-def.h and unifont.c, no need to share those.
2014-09-29terminal: add helper to retrieve the seat of a sessionDavid Herrmann
Allow sysview users to retrieve the seat that a session is assigned to.
2014-09-29terminal: add sysview_seat_switch_to()David Herrmann
Add helper to perform session switches on a specific seat whenever we retrieve a VT-switch keyboard event.
2014-09-23terminal: provide display dimensions to API usersDavid Herrmann
Allow users to query the display dimensions of a grdev_display. This is required to properly resize the objects to be rendered.
2014-09-23terminal: verify kernel-returned DRM events are not truncatedDavid Herrmann
Make sure the kernel always returns events properly. This is guaranteed right now, otherwise, we do something really wrong. But lets be sure and verify the received values properly. This also silences some coverity warnings.
2014-09-23terminal: verify grdev tiles are correctly linkedDavid Herrmann
We used to set "pipe->tile = tile" inside of the leaf allocation. We no longer do that. Verify that "out" is non-NULL, otherwise we'd leak memory. This is currently always given, but make sure to add an assert(), so coverity does not complain.
2014-09-23terminal: fix tile-offset calculationDavid Herrmann
Binary operators with two pointers as arguments always operate on object-size, not bytes. That is, "int *a, *b", (a - b) calculates the number of integers between b and a, not the number of bytes. Fix our cache-offset calculation to not use sizeof() with full-ptr arithmetic.
2014-09-23Silence some "unchecked return-value" warningsDavid Herrmann
This adds some log-messages to ioctl() calls where we don't really care for the return value. It isn't strictly necessary to look for those, but lets be sure and print warnings. This silences gcc and coverity, and also makes sure we get reports in case something goes wrong and we didn't expect it to fail that way.
2014-09-23terminal: fix spelling mistakeZbigniew Jędrzejewski-Szmek
2014-09-22terminal: signal object removal during sysview_context_stop()David Herrmann
Now that we no longer propagate callback return values, we can safely call into user-callbacks during sysview_context_stop(). This way, users can rely on all objects to be removed via callbacks (except if they failed during object creation). This avoids duplicating any object hashtables on the users' side and reduces memory consumption.
2014-09-22terminal: handle callback errors in sysview instead of propagating themDavid Herrmann
We cannot sanely propagate error codes if we call into user-callbacks multiple times for multiple objects. There is no way to merge those errors or somehow propagate them. However, we can just act similar to sd-event and print a log-message while discarding the values. This way, we allow error-returns, but can properly continue working on our objects.
2014-09-22terminal: allow user-context to be retrieved/storedDavid Herrmann
Add "userdata" storage to a bunch of external objects, namely displays and sessions. Furthermore, add some property retrieval helpers. This is required if we want external API users to not duplicate our own object hashtables, but retrieve context from the objects themselves.
2014-09-22terminal: make evdev logind-matches per sessionDavid Herrmann
Instead of adding matches per device, we now add logind matches per session. This reduces the number of matches considerably and saves resources.
2014-09-22terminal: raise sysview DEVICE_CHANGE events per attachmentDavid Herrmann
Instead of raising DEVICE_CHANGE only per device, we now raise it per device-session attachment. This is what we want for all sysview users, anyway, as sessions are meant to be independent of each other. Lets avoid any external session iterators and just do that in sysview itself.
2014-09-22terminal: forward evdev RESYNC events to linked devicesDavid Herrmann
Whenever we resync an evdev device (or disable it), we should send RESYNC events to the linked upper layers. This allows to disable key-repeat and assume some events got dropped.
2014-09-22terminal: always call _enable/_disable on evdev devicesDavid Herrmann
The current pause/resume logic kinda intertwines the resume/pause and enable/disable functions. Lets avoid that non-obvious behavior and always make resume call into enable, and pause call into disable, if appropriate.
2014-09-22terminal: print RESYNC state in evcatDavid Herrmann
Whenever a key-event is part of a RESYNC, we should print that verbosely as those events are out-of-order.
2014-09-20terminal: fix mode sync for connectorsDavid Herrmann
The GETXY ioctls of DRM are usually called twice by libdrm: Once to retrieve the number of objects, a second time with suitably sized buffers to actually retrieve all objects. In grdrm, we avoid these excessive calls and instead just call ioctls with cached buffers and resize them if they were too small. However, connectors need to read the mode list via EDID, which is horribly slow. As the kernel still cannot do that asynchronously (seriously, we need to fix this!), it has a hack to only do it if count_modes==0. This is fine with libdrm, as it calls every ioctl twice, anyway. However, we fail horribly with this as we usually never pass 0. Fix this by calling into GETCONNECTOR ioctls twice in case we received an hotplug event. Only in those cases, we need to re-read modes, so this should be totally fine.
2014-09-20terminal: restructure some logging calls in grdrmDavid Herrmann
Multiple issues here: 1) Don't print excessive card dumps on each resync. Disable it and make developers add it themselves. 2) Ignore EINVAL on page-flips. Some cards don't support page-flips, so we'd print it on each frame. Maybe, at some point, the kernel will add support to retrieve capabilities for that. Until then, simply ignore it. 3) Replace the now dropped card-dump with a short message about resyncing the card.
2014-09-20terminal: grdev: schedule virtual frame events if hw doesn't support itDavid Herrmann
Whenever we cannot use hardware frame events, we now schedule a virtual frame event to make sure applications don't have to do this. Usually, applications render only on data changes, but we can further reduce render-time by also limiting rendering to vsyncs.
2014-09-20terminal: grdev: raise frame event after DISPLAY_ADD/CHANGEDavid Herrmann
Whenever a display is added or changed, we suppressed any frame events. Make sure to raise them manually so we can avoid rendering when handling anything but FRAME events.
2014-09-20terminal: split grdrm_crtc_commit() apartDavid Herrmann
This helper is quite huge, split it apart to make it easier to follow.
2014-09-20terminal: grdev: refresh device state on hotplug eventsDavid Herrmann
Whenever we get udev hotplug events, re-read the device state so we properly detect any changed in the display setups.
2014-09-20terminal: grdev: treat udev-devices without devnum as hotplugDavid Herrmann
If we get udev-device events via sysview, but they lack devnum annotations, we know it cannot be a DRM card. Look through it's parents and treat it as hotplug event in case we find such a card. This will treat any new/removed connectors as sub-devices of the real card, instead of as devices on its own.
2014-09-20terminal: modeset: forward DEVICE_CHANGE events into grdevDavid Herrmann
Properly forward DEVICE_CHANGE events into grdev so we can react to changing display setups.
2014-09-20terminal: reduce speed of morphing colors in modeset testDavid Herrmann
The high frequency of the color-morphing is kinda irritating. Reduce it to a much lower frequency so you can actually look at it longer than few seconds.
2014-09-20terminal: make drm-connectors first-level devicesDavid Herrmann
So far, we only forward DRM cards via sysview APIs. However, with MST, connectors can be hotplugged, too. Forward the connectors as first-level devices via sysview so API users can react to changing DRM connectors.
2014-09-20terminal: forward DEVICE_CHANGE events via sysviewDavid Herrmann
Whe need to react to "change" events on devices, but we want to avoid duplicating udev-monitors everywhere. Therefore, make sysview forward change events to the sysview controllers, which can then properly react to it.
2014-09-20terminal: parse ID_SEAT not only for parents but the device itselfDavid Herrmann
When deciding what seat a device is on, we have to traverse all parents to find one with an ID_SEAT tag, otherwise, input devices plugged on a seated USB-hub are not automatically attached to the right seat. But any tags on the main device still overwrite the tags of the childs, so fix our logic to check the device itself first, before traversing the parents.
2014-09-19terminal: add systemd-modeset debugging toolDavid Herrmann
The systemd-modeset tool is meant to debug grdev issues. It simply displays morphing colors on any found display. This is pretty handy to look for tearing in the backends and debug hotplug issues. Note that this tool requires systemd-logind to be compiled from git (there're important fixes that haven't been released, yet).
2014-09-19terminal: add grdev DRM backendDavid Herrmann
The grdev-drm backend manages DRM cards for grdev. Any DRM card with DUMB_BUFFER support can be used. So far, our policy is to configure all available connectors, but keep pipes inactive as long as users don't enable the displays on top. We hard-code double-buffering so far, but can easily support single-buffering or n-buffering. We also require XRGB8888 as format as this is required to be supported by all DRM drivers and it is what VTs use. This allows us to switch from VTs to grdev via page-flips instead of deep modesets. There is still a lot room for improvements in this backend, but it works smoothly so far so more enhanced features can be added later.
2014-09-19terminal: add graphics interfaceDavid Herrmann
The grdev layer provides graphics-device access via the libsystemd-terminal library. It will be used by all terminal helpers to actually access display hardware. Like idev, the grdev layer is built around session objects. On each session object you add/remove graphics devices as they appear and vanish. Any device type can be supported via specific card-backends. The exported grdev API hides any device details. Graphics devices are represented by "cards". Those are hidden in the session and any pipe-configuration is automatically applied. Out of those, we configure displays which are then exported to the API user. Displays are meant as lowest hardware entity available outside of grdev. The underlying pipe configuration is fully hidden and not accessible from the outside. The grdev tiling layer allows almost arbitrary setups out of multiple pipes, but so far we only use a small subset of this. More will follow. A grdev-display is meant to represent real connected displays/monitors. The upper level screen arrangements are user policy and not controlled by grdev. Applications are free to apply any policy they want. Real card-backends will follow in later patches.
2014-09-16terminal: remove dead code checking O_WRONLYDavid Herrmann
We only reject evdev FDs that are O_WRONLY as they're currently pretty useless. The following check for O_WRONLY is thus never excercised so drop it. Thanks to Thomas Andersen (via coverity)!
2014-09-16terminal: sd_bus_error_get_errno returns positive errnoThomas Hindoe Paaboel Andersen
The 3 calls to sd_bus_error_get_errno appear to expect a negative return value. This patch negates the returned value so it matches the other error cases in the 3 functions where sd_bus_error_get_errno is used.
2014-09-15terminal: fix missing hashmap_new() conversionsDavid Herrmann
hashmap_new() now takes *_ops instead of individual functions. Fix up any missing invokations of it that haven't been converted already.
2014-09-11terminal: fix uninitialized variable in strerror() log messageDavid Herrmann
We currently print weird error-messages if xkbcommon fails (which cannot fail so far, but might in the future). Fix the uninitialized variable warnings by setting 'r' correctly. Thanks to Philippe De Swert for catching this (via coverity).
2014-09-11terminal: drop redundant assertionDavid Herrmann
This assertion is already there two lines down. Drop the redundant assertion.
2014-09-11terminal: fix wrong return value in idev if fcntl() failsDavid Herrmann
This might cause >=0 to be returned, even though the method failed. Fix this and return -errno.
2014-09-11terminal: enable sessions in evcat after taking controlDavid Herrmann
If we enable a session, any probed device might get immediately enabled. This might cause TakeDevice() messages to be sent before we call TakeControl(). Therefore, enable sessions *after* sending TakeControl() so we always succeed if TakeControl() succeeds.
2014-09-11terminal: remove unused set.h inclusion in idevDavid Herrmann
We don't use set.h so no need to include it. We used to include it for temporary refs on all idev devices of a session, but that never was pushed upstream.
2014-09-11terminal: remove redundant "struct" prefixesDavid Herrmann
We define typedefs for all internal types so drop the redundant "struct" prefix.
2014-09-11terminal: discard async read() errors for evdevDavid Herrmann
If read() fails on evdev devices, we deal with this in idev_evdev_hup(). It is very likely this is an async revoke, therefore, we must not abort. Fix our io helper to discard such errors after passing them to idev_evdev_hup(), so we don't bail out of the event loop.
2014-08-30Fix a few more typosRuben Kerkhof
2014-08-28bus: don't skip interfaces in bus_message_map_properties_changed()David Herrmann
Skipping interfaces randomly without the caller specifying it is nasty. Avoid this and let the caller do that themselves.
2014-08-28terminal: free sysview-device names on destructionDavid Herrmann
Don't leak the device-names during device destruction in sysview. Somehow, the device-name is "const char*", so make it "char*" first to avoid warnings when calling free() on it.
2014-08-28terminal: free xkb state on keyboard destructionDavid Herrmann
Fix leaking the xkb-state during keyboard destruction, leaking lots of xkb references into the wild.
2014-08-28terminal: sysview: don't return uninitialized error codesDavid Herrmann
In case 'scan_evdev' and 'scan_drm' are both false, we never set 'r' to anyhting, thus return an uninitialized error code. Fix this by always returning 0 as we catch negative codes earlier, anyway. Thanks to Thomas H.P. Anderson for the report.
2014-08-27terminal: remove unused variableThomas Hindoe Paaboel Andersen
2014-08-27terminal: add systemd-evcat input debugging toolDavid Herrmann
Like systemd-subterm, this new systemd-evcat tool should only be used to debug libsystemd-terminal. systemd-evcat attaches to the running session and pushes all evdev devices attached to the current session into an idev-session. All events of the created idev-devices are then printed to stdout for input-event debugging.
2014-08-27terminal: add xkb-based keyboard devices to idevDavid Herrmann
The idev-keyboard object provides keyboard devices to the idev interface. It uses libxkbcommon to provide proper keymap support. So far, the keyboard implementation is pretty straightforward with one keyboard device per matching evdev element. We feed everything into the system keymap and provide proper high-level keyboard events to the application. Compose-features and IM need to be added later.