Instead if implementing complex idle sources we now provide a hook so
other subsystems can register callbacks.
This simplifies the code a lot and doesn't drop any major functionality.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Similar to other event sources we now initialize internal data on timer
creation instead of when the source is added to the loop.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When creating a new fd-source you must supply the file descriptor
directly. You cannot delay this to the time when you add the fd to the
event loop.
This simplifies the logic and allows much smoother handling in the event
loop core.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Counter sources are based on the eventfd syscall of linux. Internally, is
uses a 64bit counter which is initialized to 0 and can be increased by the
caller. Whenever the value is non-zero, the fd is marked readable and we
call our callback. We read the 64bit integer (which resets it to 0) and
pass the current value to the callback.
This can be used to implement cross-process notification methods or to
have idle-sources as valid file-descriptors in an epoll set which could be
exported to other applications that are not compliant to our event loop.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This helper returns true if the fd is bound to an eloop object, otherwise
false is returned.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now support multiple GL contexts in uterm so we need to explicitely
enable them before using them.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Use new uterm_video constructor. This requires hard-coding the DRM card
but this is needed until we use the uterm_monitor interface.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We are actually not interested in the main input device but rather in the
evdev interface. However, the evdev interface is a child of the input
device and therefore has no seat values specifies. This patch removes the
scan-filter for seat tags and performs seat matching in user-space by
first finding the parent of the input device.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently only scan devices in uterm_monitor_scan() but we should read
the initial seat values before even searching for devices.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Be more verbose about added and removed devices. Otherwise, debugging is
not as easy as it could be.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Internally, we use a new kbd API to handle keyboard related stuff in
uterm. It is a reimplementation of the old kbd_dumb.c backend.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is a rewrite of the input layer but integrated into uterm. It has the
same functionality but is tightly bound to the concepts behind uterm and
will soon supercede the old implementation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
To allow moving all input handling to uterm, too, we need to detect input
devices in the uterm-monitor like all other devices, too.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
To introduce the new uterm-monitor object we need to remove all the udev
handling from uterm_video. To not break "git bisect" we now remove all the
udev code from uterm_video and uterm_video_drm and make kmscon use the
static /dev/dri/card0 interface for now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Upstream mesa fixed the missing header protection of xf86drmMode.h so we
can include it again.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new uterm_monitor watches the system for seat-changes and puts all
devices under the correct seat. This allows to run kmscon on multiple
seats in a single process. It now also correctly handles seat-changes,
that is, devices that are reattached to a different seat on runtime.
It is not integrated into the kmscon source, yet, but will soon be.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
New for-each implementation that keeps a safe pointer to the next element
so you can remove the current element from the list.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Sometimes one wants to remove all pending events for an fd. The new
ev_eloop_flush_fd() call allows this in a safe way.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When triggered by seat monitor we need to be able to create uterm_video
objects on a concrete device so enable passing it in.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If a display is already activated we return EINVAL. Otherwise, the user
might think that the requested mode was activated even though a totally
different mode may be still active.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We may have to use multiple GL contexts if we mix DRM and fbdev devices.
Therefore, we need explicit GL-ctx management.
We now allow to explicitely activate a specific GL context. This means,
the user needs to use the right GL context before he creates textures or
similar.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This test doesn't compile and is no longer needed. We can now use the
kmscon program or test_terminal for the same functionality.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now assume a screen of -1,-1 to 1,1 instead of 0,0 to 1,1 to avoid
matrix transformations.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This currently does not work properly so disable it. However, we
definitely need to fix this later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
A shared signal owns an eloop_fd object. This has a reference of its
connected eloop. Therefore, we must free a shared signal to drop a
reference to the connected eloop and cannot postpone this to
eloop-destruction. Otherwise, the eloop will never get destroyed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Move to new list-implementation instead of the single-linked list. This
allows removal of elements in O(1).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a generic double-linked list implementation so we don't have to
write all list-handling over and over again.
The list-type is similar to the kernel list where we use the same type for
heads and entries. This is a _very_ convenient list-type so we copy it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This uses the GCC extension "typeof" to implement a type-safe "offsetof"
similar to the implementation in the linux kernel.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of accepting a list of outputs we now enable all outputs when
testing the video subsystem.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The new eloop implementation allows to run the eloop for a fixed amount of
time. Use this instead of sleeping for 5s which would prevent us from
catching signals as the eloop blocks them in favor of signalfd.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The test_include.h header now provides the basic initialization that will
later be used in all other tests. This allows us to use the same
program-parameters that kmscon uses and makes sure everything is
initialized properly before we run the tests.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>