We reset all modes but forget to set them on the console object, too. The
AUTO_WRAP mode is the only mode that matters here, so we can ignore the
other modes.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We force EGL_DISPLAY to drm now. Otherwise, we might cause segfaults if
the EGL library tries to use the X11 egl-backend.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new --fbdev option allows runtime switching between the two backends.
That is, we only use fbdev devices when --fbdev is given. Otherwise, DRM
is used.
Technically, it would also be possible to use both. However, almost every
DRM device does also register an fbdev device for backwards compatibility.
Therefore, we must avoid using both, the DRM and fbdev device of the same
display at the same time. As this would also mean dealing with failures in
one backend and then switching to the other, we avoid this for complexity
reasons. Who needs fbdev and drm simultaneously, anyway?
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The drm video backend does automatically blit the framebuffer on wake-up,
however, the fbdev backend does not. Hence, we automatically redraw on
wake-up in the terminal backend now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now enumerate displays on wake-up so we might end up adding a display
twice. This causes the display to be redrawn twice which is nasty so we
avoid it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Other registered callbacks might get confused if we change the parameters.
Hence, we use a static copy for further actions.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If OpenGL is not supported, we now allow 2D blitting into the video
framebuffer as alternative to shaders.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If OpenGL is not supported, we should _not_ return 0. Otherwise, there is
not convenient way to detect this scenario.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We might have missed a display when our handler was not registered, yet.
So enumerate these displays on wakeup so we can be sure that we have all
displays registered with the terminal subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently try activating the OpenGL context when adding a video device
to a seat. However, not all video backends provide OpenGL contexts so
remove this restriction. The terminal subsystem does all this by itself
now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If the video backend does not provide an OpenGL context, there is no need
to create the gl shaders. We then use the 2D blitting functions instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This can help a lot when debugging displays that are registered multiple
times with a terminal object.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This makes double-buffering optional as not all drivers provide this. In
fact, only very few drivers implement this. Furthermore, this also adds a
fake display-mode that is used instead of NULL. Otherwise, the screen
object might not work as expected.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
All backends that do not provide OpenGL contexts can not implement buffer
blitting so we can at least draw rectangular areas to the framebuffer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Notify all listeners when going to sleep or waking up. This allows saving
energy in the listeners by not redrawing the screen while being asleep.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We discard all non-xrgb32 devices for simplicity reasons for now. We
definitely need to support other devices in future but that makes the
backend unnecessarily complex at the beginning so avoid it.
This also moves the resolution-change to the beginning and duplicates the
tests so we can be totally sure that everything is right after setting the
correct values.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When the backend does not implement display_use() then we return an error
instead of success to notify the application that it should use blitting
instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
fbdev does not support OpenGL contexts so there is no need to implement
this function. Instead, we will provide blitting support later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds gtk-doc documentation builds to kmscon. All documentation is
build in a central place due to gtk-doc restrictions.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a fully working fbdev backend to the uterm library. This allows
us to create our rendering pipeline on any linux machine.
The fbdev backend is not yet hooked up into kmscon. There are still some
remaining issues as we do not have OpenGL on fbdev if EGL is not compiled
with fbdev backend (which is usually not).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is a rewrite of the whole console layer so we can remove the
kmscon_buffer object to speed up the console.
This removes the split between the scroll region and the two margins so we
can resize margins in O(1). This also correctly merges the remaining
console modes so vte does not have to track them.
Btw. vim runs smoothly on kmscon with this console layer now (finally!).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The fblog drivers provides a replacement for fbcon and prints all kernel
log messages to all available framebuffer devices.
As long as the driver is not upstream, I will keep it here for reference.
See linux-serial@vger.kernel.org for discussion.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We mixed up X/Y coordinates. HUP and HVP send them reversed as often used
in terminals. Anyway, now it works correctly.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When we receive an unknown SM/RM message, be more verbose about what
exactly was received on the log output.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Most of the CSIs for cursor movement are already implemented but HVP and
CUP are missing. This adds both CSI handlers to the VTE layer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
For the same reason as we reset it to white on cell creation we need to
reset it to white on cell reset. Otherwise we have odd artifacts in
reverse video mode.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We didn't reset the console flags on soft reset, however, this is required
to correctly synchronize the flags between vte and console.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Reset font color to white for new cells. This allows us to draw reversed
cells that are not occupied by any value. Otherwise, these cells would be
still black if reversed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The pango backend now correctly draws colored or uncolored backgrounds.
This is needed to support drawing cursors.
We currently do not optimize this for performance. In fact, this reduces
performance a lot and we could avoid drawing backgrounds if we cleared the
background to the same color before. However, this also means we currently
could move drawing the background into the console backend again. The
transparency feature is awful, anyway and I don't see any reason
supporting it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
In inverse screen mode we switch background and foreground colors. As our
console layer supports transparent backgrounds, we have to do this in the
terminal layer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a new function that allows external subsystems to retrieve the
current flags of the console.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of writing a function for each mode we now accept flags for the
console object. For now the flags are unused but other flags will be
added.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If SEND_RECEIVE_MODE is not set, we have to echo all data we send out.
That is, all escape sequences and all characters are directly interpreted
by us. To avoid recursion, we use a simply protection. However, some
escape sequences don't make sense in echo mode but we don't care here, as
this is a problem of the application/client, not us.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When reading Setmode/Resetmode parameters, we should ignore all unset
parameters instead of printing a warning.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
VT510 manual says auto-wrap is disabled by default but most applications
(including bash) expect it to be on, therefore we enable it by default.
The console layer already supported it but the vte layer wasn't hooked up.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>