summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal
Commit message (Collapse)AuthorAge
* terminal/screen: adjust screen age only on updateDavid Herrmann2014-10-03
| | | | | | | Instead of increasing the screen-age on redraw, we now increase it only on real updates. This is effectively the same, but avoids increased age counters on backbuffer rendering. Therefore, we can now check age counters against fronbuffers safely, while rendering frames in background.
* terminal/screen: add color converterDavid Herrmann2014-10-03
| | | | | | | | | | Terminals use pseudo color-codes mixed with 8bit and 24bit colors. Provide a color-converter so external renderers only have to deal with ARGB32 colors. This requires a color-palette as input as there's no fixed mapping. We provide a default, but maybe we wanna support external palettes in the future.
* terminal/screen: add cursor renderingDavid Herrmann2014-10-03
| | | | | | | | | This is the most simple way to render cursors: flip attr->inverse of the cursor cell. This causes the background and foreground colors of the cursor-cell to be inversed. Now that we render cursors ourselves, make subterm not call into the parent terminal to render cursors.
* terminal/screen: mark cursor dirty on enabled/disableDavid Herrmann2014-10-03
| | | | | | If we hide or show the cursor, we change visual attributes and have to mark the underlying cell as dirty. Otherwise, the terminal will not be redrawn.
* terminal/idev: add helper to match keyboard shortcutsDavid Herrmann2014-10-03
| | | | | | | | | | | Matching keyboard shortcuts on internationalized keyboards is actually non-trivial. Matching the actual key is easy, but the modifiers can be used by both, the matching and the translation step. Therefore, XKB exports "consumed-modifiers" that we use to figure out whether a modifier was already used by the translation step. The new IDEV_KBDMATCH() helper can be used to match on any keyboard shortcut and it will do the right thing.
* terminal/screen: add keyboard mappingDavid Herrmann2014-10-03
| | | | | | | | Implement the feed_keyboard() handling by mapping XKB keys according to DEC-VT behavior. Public information on terminal key-mappings is pretty scarce. We only implement the most basic mapping for now. Further improvements welcome!
* terminal/idev: don't map XKB_KEY_NoSymbol as ASCII 0David Herrmann2014-10-03
| | | | | XKB_KEY_NoSymbol is defined as 0 but does not correspond to a VT key with ASCII value 0. No such key exists, so don't try to find such a key.
* terminal/unifont: add built-in fallback glyphDavid Herrmann2014-10-03
| | | | | | | In case we cannot render a glyph, we want a fallback we can display instead. If we rely on the font itself to provide the fallback character, we have nothing to display if that character is not available. Therefore, add a static fallback that we can use at any time.
* terminal/subterm: use screen rendererDavid Herrmann2014-10-03
| | | | | Don't hard-code the screen renderer but use the newly introduced term_screen_draw() helper.
* terminal: add screen rendererDavid Herrmann2014-10-03
| | | | | | We don't want to expose the term_screen internals for rendering. Therefore, provide an iterator that allows external renderers to draw terminals.
* terminal/drm: clear 'applied' flag when changing stateDavid Herrmann2014-10-03
| | | | | | If a pipe is enabled/disabled, we have to clear crtc->applied of the linked CRTC. Otherwise, we will not run a deep modeset, but leave the crtc in the pre-configured state.
* terminal/grdev: allow arbitrary fb-age contextsDavid Herrmann2014-10-03
| | | | | | Instead of limiting fb-aging to 64bit integers, allow any arbitrary context together with a release function to free it once the FB is destroyed.
* terminal/grdev: provide front and back buffer to renderersDavid Herrmann2014-10-03
| | | | | | We really want more sophisticated aging than just 64bit integers. So always provide front *and* back buffers to renderers so they can compare arbitrary aging information and decide whether to re-render.
* terminal/drm: provide pipe->target() callbackDavid Herrmann2014-10-03
| | | | | | | | | | Instead of looking for available back-buffers on each operation, set it to NULL and wait for the next frame request. It will call back into the pipe to request the back-buffer via ->target(), where we can do the same and look for an available backbuffer. This simplifies the code and avoids double lookups if we run short of buffers.
* terminal/grdev: simplify DRM event parsingDavid Herrmann2014-10-03
| | | | | | Coverity complained about this code and is partially right. We are not really protected against integer overflows. Sure, unlikely, but lets just avoid any overflows and properly protect our parser loop.
* terminal: make utf8 decoder return lengthDavid Herrmann2014-10-03
| | | | | | | | | | Lets return the parsed length in term_utf8_decode() instead of a buffer pointer. Store the pointer in the passed argument. This makes it adhere to the systemd coding-style, were we always avoid returning pointers, but store them in output arguments. In this case, the storage is not allocated, so it doesn't fit 100% to this idiom, but still looks much nicer.
* terminal: fix back-buffer selection on DRM page-flipDavid Herrmann2014-10-03
| | | | | | We currently select front-buffers as new back-buffer if they happen to be the last buffer in our framebuffer-array. Fix this by never selecting a new front buffer as back buffer.
* terminal: add helpers to retrieve page dimensionsDavid Herrmann2014-10-02
| | | | | Allow term users to retrieve the page dimensions of a terminal screen. This is needed to properly calculate the grid dimensions when rendering.
* terminal: add term.h header for library usersDavid Herrmann2014-10-02
| | | | | Like all the other parts of libsystemd-terminal, split API of term-internal.h into term.h so we can use it from systemd-consoled.
* terminal: move unifont-map to datadirDavid Herrmann2014-10-02
| | | | | | Lets avoid putting stuff into /usr/shared/unifont/, but keep it in /usr/share/systemd/. Upstream lacks interest in this, so don't bother for now.
* terminal: add unifont_get_width/height()David Herrmann2014-10-02
| | | | | Allow unifont users to retrieve the width and height of unifont glyphs. In version 1 this is hard-coded as 8/16, but may be changed in the future.
* terminal: move unifont-internal.h to unifont.hDavid Herrmann2014-10-02
| | | | | | 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.
* terminal: add helper to retrieve the seat of a sessionDavid Herrmann2014-09-29
| | | | Allow sysview users to retrieve the seat that a session is assigned to.
* terminal: add sysview_seat_switch_to()David Herrmann2014-09-29
| | | | | Add helper to perform session switches on a specific seat whenever we retrieve a VT-switch keyboard event.
* terminal: provide display dimensions to API usersDavid Herrmann2014-09-23
| | | | | Allow users to query the display dimensions of a grdev_display. This is required to properly resize the objects to be rendered.
* terminal: verify kernel-returned DRM events are not truncatedDavid Herrmann2014-09-23
| | | | | | | 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.
* terminal: verify grdev tiles are correctly linkedDavid Herrmann2014-09-23
| | | | | | | | 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.
* terminal: fix tile-offset calculationDavid Herrmann2014-09-23
| | | | | | | | | 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.
* Silence some "unchecked return-value" warningsDavid Herrmann2014-09-23
| | | | | | | | 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.
* terminal: fix spelling mistakeZbigniew Jędrzejewski-Szmek2014-09-23
|
* terminal: signal object removal during sysview_context_stop()David Herrmann2014-09-22
| | | | | | | | 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.
* terminal: handle callback errors in sysview instead of propagating themDavid Herrmann2014-09-22
| | | | | | | | | | 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.
* terminal: allow user-context to be retrieved/storedDavid Herrmann2014-09-22
| | | | | | | | 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.
* terminal: make evdev logind-matches per sessionDavid Herrmann2014-09-22
| | | | | | Instead of adding matches per device, we now add logind matches per session. This reduces the number of matches considerably and saves resources.
* terminal: raise sysview DEVICE_CHANGE events per attachmentDavid Herrmann2014-09-22
| | | | | | | 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.
* terminal: forward evdev RESYNC events to linked devicesDavid Herrmann2014-09-22
| | | | | | 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.
* terminal: always call _enable/_disable on evdev devicesDavid Herrmann2014-09-22
| | | | | | 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.
* terminal: print RESYNC state in evcatDavid Herrmann2014-09-22
| | | | | Whenever a key-event is part of a RESYNC, we should print that verbosely as those events are out-of-order.
* terminal: fix mode sync for connectorsDavid Herrmann2014-09-20
| | | | | | | | | | | | | | | | | | 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.
* terminal: restructure some logging calls in grdrmDavid Herrmann2014-09-20
| | | | | | | | | | | | 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.
* terminal: grdev: schedule virtual frame events if hw doesn't support itDavid Herrmann2014-09-20
| | | | | | | 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.
* terminal: grdev: raise frame event after DISPLAY_ADD/CHANGEDavid Herrmann2014-09-20
| | | | | | 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.
* terminal: split grdrm_crtc_commit() apartDavid Herrmann2014-09-20
| | | | This helper is quite huge, split it apart to make it easier to follow.
* terminal: grdev: refresh device state on hotplug eventsDavid Herrmann2014-09-20
| | | | | Whenever we get udev hotplug events, re-read the device state so we properly detect any changed in the display setups.
* terminal: grdev: treat udev-devices without devnum as hotplugDavid Herrmann2014-09-20
| | | | | | | | | 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.
* terminal: modeset: forward DEVICE_CHANGE events into grdevDavid Herrmann2014-09-20
| | | | | Properly forward DEVICE_CHANGE events into grdev so we can react to changing display setups.
* terminal: reduce speed of morphing colors in modeset testDavid Herrmann2014-09-20
| | | | | | 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.
* terminal: make drm-connectors first-level devicesDavid Herrmann2014-09-20
| | | | | | 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.
* terminal: forward DEVICE_CHANGE events via sysviewDavid Herrmann2014-09-20
| | | | | | | 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.
* terminal: parse ID_SEAT not only for parents but the device itselfDavid Herrmann2014-09-20
| | | | | | | | 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.