If we allow users to specify log functions, we should also allow them to
pass a context. This isn't used internally, but may be needed by external
users so provide it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of using the blown up UTERM_FORMAT_GREY binary data, we now use an
A1 1bit alpha channel and extract the data during runtime. This guarantees
that only used characters will be extracted into the full alpha channel.
We should add support for A1 formats in uterm to avoid this problem
entirely.
We also now link the binary file directly into the module via ld. This
avoids the long compile times for the huge C-array that we previously
generated. As a side effect, you no longer run out of memory linking this
file on small machines.
With this change we could even start making unifont a default font-backend
as it now works pretty well.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Major overhaul of the build system. This introduces symbol-versioning for
all exported libraries. Please note that none of these libraries is
stable, yet!
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Afterchecks should be always performed when reading data into a config
context. So perform them after copy operations, too.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We need the font layer to build wlterm. However, the font layer depends on
kmscon internal module handling so we cannot do this. To avoid this, we
simply provide dummy handlers for the kmscon_module_* layer and link it
anyway. This is kind of ugly but works, yey!
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This renames the video-drm backend to drm3d (which was already used
internally). This is a pure rename, the code-logic stays the same.
This also puts the drm3d backend into a module so we can more easily
load it during runtime.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This moves all the drm-dumb code into a new module that is now called
drm2d (which was already used internally before).
No conceptual changes, just renames and moves.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
pixman expects stride values to be a multiple of 4. However, the glyphs we
get may be of a different stride so copy it if it is.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The "true ||" case made pixman always use shadow buffers. Remove this
debug statement so it works as expected.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We can preallocate a white solid-fill image so we don't have to do that
for each round where we blend white glyphs.
Also, if the background is black, we can omit the pixman_fill() operation
and use the direct composite with SRC operations.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This was recommended by Soren Sandmann on the pixman ML. We can optimize a
real t /= 255 with:
t += 0x80
t = (t + (t >> 8)) >> 8;
Instead of using a single fake (t >> 8) shift as we used to.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This is an experimental renderer based on pixman. It is only available for
testing-purposes and should not be used in production, yet. The bbulk
renderer is still the faster alternative and should be used instead.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The dfb->disp pointer is not used so the current fbdev backend doesn't
wake up displays on video-wakeup. Fix this by traversing the new display
list (even though we currently have only one display at most).
Also remove th dfb->disp pointer as it is unused now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The cairo text renderer uses the cairo blitting functions to blit all
glyphs into the cairo-surface. This is only for testing-purposes. Cairo is
not really suited for blending/blitting of large surfaces. Hence, this
backend is horribly slow compared to bblit/bbulk.
This backend is disabled by default.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We want to provide read-access to users of get_buffers() so map memory
with PROT_READ. However, read is almost always horribly slow so this
should only be used as fallback.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm_display_use() now returns the current back-buffer index when called.
It returns <0 on error. Whether OpenGL is supported is returned via a new
parameter "opengl". Set it to NULL if you're not interested.
Note that a backend might support OpenGL _and_ memory-mapped buffer
access. But you shouldn't rely on uterm_display_use() to return the
correct buffer-index if uterm_display_get_buffers() is not supported. For
instance the DRM-3D backend always returns 0 as buffer index as it has no
way of detecting it, yet.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This renames get_buffer() to get_buffers() and returns back _and_ front
buffer to the application. This allows the application to create
supplemantal data for the buffers and manage it themself.
This data _must_ stay the same as long an activation-period of a display
so users can rely on the buffer information.
Also all information for back and front buffer is the same except for the
data pointer (which is only the same for single-buffered FBs).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If an entry is not a oneshot entry, then it might get deleted during the
callback procedure and hence, we _must_ not access it afterwards.
Therefore, remember the oneshot setting so we access it only if it really
is a oneshot entry.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Until now we required external renderers to use the blit/blend helpers.
However, this seems hardly reasonable now so we provide a way to retrieve
the 2D buffer via the public API.
This is limited to xrgb32 and rgb16, other formats are not exported for
now (and probably not used, yet?). The 3D backends do not support that so
use the blit/blend helpers or OpenGL.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Without his many bug-reports kmscon wouldn't be what it is now. So add him
to the author-list.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Internally, we already support immediate buffer-swaps but this hasn't been
exported in the API. This patch adds an "immediate" argument that causes
the flip to be immediate and not synchronized with vertical-blanks.
Please note that this might block if there is a pending page-flip.
However, this is mostly a delay of 16ms so we can ignore it as this is
acceptable if you want immediate swaps while there is still a
pending-buffer.
You can listen for the UTERM_PAGE_FLIP event if you don't want this
behavior.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If signal-handlers are set to SIG_IGN, then this behavior is preserved
across an execve(). We don't want that so reset the handlers for all
childs before executing them.
kmscon may be executed with pre-set signal handlers for good reasons. So
reset the handlers in setup_child() so we have a clean environment.
This fixes a bug where child-programs assume SIGPIPE is not ignored but do
not explicitly set it to SIG_DFL.
Reported-by: Swift Geek [github issue #62]
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
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>