The modesetting code of both DRM backends is almost the same so share it.
This also works around several race-conditions in some DRM drivers. In
particular, we cannot call drmModeSetCrtc while a drmModePageFlip is still
pending. Therefore, we wait for page-flips to complete before performing
an immediate mode-set.
This requires us to handle page-flip events synchronously so we can wait
for kernel page-flip events but the user-space bottom-half is executed in
an idle-handler.
Note that the chance that we have to wait for a page-flip to complete is
pretty small. In fact, without hacking the code to do fast page-flips, I
couldn't get kmscon to run into this condition.
Last but not least, this patch also makes the dumb-backend support
immediate page-flips like the DRM backend did all the time.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
EV_ONESHOT will remove idle sources once they have been processed and
EV_SINGLE will only register the source if it hasn't been registered, yet.
For source removal EV_ONESHOT has no effect but EV_SINGLE causes all
events with this cb+data combination to be removed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If an entry is marked as 'oneshot' then it will get deleted after it has
been called once. Note that the entry is unlinked _before_ the callback is
called.
If you use 'oneshot'-entries and normal entries with the same cb+data
combination, then you will probably get unexpected behavior. It is not
recommended to do that. In detail, you cannot control which entry is
deleted via a shl_hook_rm() call so you can never be sure whether the
oneshot entry or a normal entry is deleted.
Do not mix oneshot entries with normal entries!
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Very often we want to avoid adding callbacks multiple times. Currently we
have to keep track of this in each module with a boolean value.
To simplify this procedure, we add helpers that guarantee that entries are
only added once and a helper to remove all entries with a given cb+data
combination.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Other DRM users might change the DPMS state of a display while we are
asleep. Therefore, reread the state during wakeup and force DPMS to the
same value it had when we left. But do this only for displays that are
online, other displays are never touched by uterm-video.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
These tests still use uterm.h which builds fine if you have an old uterm
version installed, however, with a new version this will fail horribly.
Hence, fix them to use the new headers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm-video is actually older than shl_dlist and it used its own
single-linked lists until now. This had several drawbacks and produced
ugly code.
This commit converts all uterm-video elements to use shl_dlist and
introduces _bind and _unbind helpers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The set_dpms callback of dumb and drm backends is identical so share it in
drm-shared module.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The dumb and drm backends still use the same code to perform wakeup/sleep
code. Hence, move it into the drm-shared file so we can use the same
helpers for both.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This fixes the last OpenGL user that still uses the wrong y-axis
direction. See the gltex helpers for more information.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This moves the gbm/drm shared properties into the drm-shared helper.
Furthermore, it removes the last static property in uterm_video objects so
everything is correctly accessed via ->data pointers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
OpenGL uses an inverted y-axis by default. However, the old gbm-surface
layer didn't correctly map this. But with the conversion to gbm_surface
objects, we now have the correct OpenGL framebuffers so we have to invert
the y-axis.
This was already fixed for the gltex renderer earlier but we forgot to fix
the uterm-drm blitting backend.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
dumb and drm video backends share quite a lot of logic. Hence, move common
helpers into the drm-shared module and use it in both backends.
This also moves the uterm-display objects of both backends to use the data
member instead of static fields.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The dumb and drm backends use the same mode structure so share the code as
drm_shared module.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We do not set the dimensions correctly but always use 0/0. Fix this by
overwriting the values on mode creation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We never implemented real blending and never hooked it up with the public
API. Hence, we can safely remove this. All functionality that was
available via .blend is now available via .fake_blendv.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is the first step towards a uterm-fbdev module. It splits the huge
video file into a video backend and a render backend. A monitor backend
will follow later when a full uterm module infrastructure is available.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of hardcoding fbdev data in the header, we now store all data in
the "data" pointer so we can be loaded during runtime.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If we want to load backends during runtime, we must allow them to store
their data. Instead of hardcoding it, we now provide a "data" pointer so
they can store arbitrary data.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We want to allow dynamic backend loading during runtime so we need to
avoid static definitions. This converts the backend IDs into module
structures which are then linked into the binary.
To make this fully modular, we need to load the backends dynamicly via
dlsym() and move all the static declarations from uterm_video.h into the
backends. But for now at least the backends can be easily exchanged and
configured during compile-time.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of depending on libdrm, we simply copy the VERSION-IOCTL ABI and
perform the ioctl ourself. This reduces complexity and dependencies.
Why does the DRM layer not provide normal uapi headers via
linux-api-headers? We should fix that.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of using the pciaccess helpers, we now read the boot_vga flag via
uterm. This makes the whole process a lot simpler and removes a lot of
duplicated code that is already provided by the kernel.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We will split the public uterm header soon to avoid big headers. Hence,
rename internal headers to *_internal.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We still have dead dependencies on libfont.la but don't build it anymore.
Remove the dependency as it is directly linked now.
Reported-by: Vladimir Kravets
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We removed this service unit earlier this week but the EXTRA_DIST variable
still mentions it. Remove it so kmscon builds cleanly again.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We no longer need these helpers so remove them. We require each backend to
register itself as part of module-loading so no need to keep these
helpers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Similar to the font backends we now require one backend to be always
available as safe fallback. The bblit backend is the most basic backend so
make it mandatory and link it unconditionally.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When text-ops are registered via modules, we need an owner field so
they're correctly tracked. Hence, add this field to all text-ops and
correctly keep module references.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The freetype2 backend is no longer recommended. You should always prefer
the pango backend. Pango provides a lot more advanced font options and
internationalization.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
All font definitions have been moved to font.h so remove the old
definitions and include font.h instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>