Rather than calling accessors (wl_shm_buffer_get etc) to figure out
which type our buffer is, just look in the structure.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we first see a buffer attached, we create a weston_buffer for it.
The weston_buffer doesn't contain any useful information in and of
itself; that's left to renderers to populate later.
Switch this to doing it in the core at the first opportunity, at least
for SHM and dmabuf buffers; EGL buffers will follow in the next commit.
Signed-off-by: Daniel Stone <daniels@collabora.com>
If full output damage is forced every time a screenshot is taken, the
test suite cannot take screenshots of damage as that would depend on
repainting only the damaged area.
Stop damaging the output and instead just schedule a repaint so the
screenshot can be taken. This is safe because:
- if any views were promoted to hw planes previously,
weston_output_disable_planes_incr() would force them to be demoted at
assing_planes() time causing damage via weston_view_move_to_plane()
- even when hardware primary plane has no damage, DRM-backend will not
skip calling to the renderer after commit
"drm-backend: do not skip renderer if capturing screen".
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Instead of getting previous_damage from the weston_output struct, get it from
the frame_signal data argument. This will make possible to remove
previous_damage from weston_output after we decide what to do with
output->previous_damage usage in DRM backend.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Instead of getting weston_output from the frame_signal argument 'void *data',
add weston_output in the private data struct of the users that are listening
to frame_signal. With this change we are able to pass previous_damage as the
data argument.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
The member disable_planes of weston_output signifies the recording
status of the output, and is incremented and decremented from various
places. This patch provides helper functions to increment and decrement
the counter. These functions can then be used to do processing, before
and after the recording has started or stopped.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.
In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.
Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
The main idea is to make libweston users use the form
#include <libweston/libweston.h>
instead of the plain
#include <compositor.h>
which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.
The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The 'done' event sent back to client with the weston screenshot interface
is not being sent if there is no damage on the plane. This patch (re-uses just
like recording part) weston_output_damage() to achieve that.
Otherwise the client will have to wait (and be blocked) until some
damage on the plane is being done.
Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
Store the output presentation timestamp as struct timespec.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This clarifies what is supposed to be the libweston code.
v2: screen-share.c is already in compositor/ instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
This patch splits screensooter.c so that the code implementing
the private screenshooter protocol and launching the client is
moved to a weston specific file, leaving only the code that can
be shared between compositors in screenshooter.c.
Two exported functions are added in screenshooter.c to start and
stop the recorder.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Due to the effort of moving a way from non-prefixed protocols, rename
the weston specific screenshooter protocol to weston_screenshooter.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The screenshooter encoder wrote the output from either top-to-bottom or
bottom-to-top, depending on the Y-flip setting, but wcap-decode only
decodes from bottom-to-top. Make the encoder always output from
bottom-to-top, to match the decoder, and flip the input (source)
according to the Y-flip setting.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer. However, in a binding you're
guaranteed that the seat has a device of that type. If we pass in
that type instead of the seat, it's obvious we don't have to test it.
The bindings can still get the seat pointer via whatever->seat if they
need it.
This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
We already have a pointer to the compositor so change seat->compositor to ec
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
There were unchecked malloc and no free for this memory.
Also simplify error handling in one function.
v2. remove check if memory is NULL, according to man pages,
free(NULL) is a no-op
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fix recently introduced compiler warnings:
desktop-shell/shell.c: In function 'shell_configuration':
desktop-shell/shell.c:588:10: warning: ignoring return value of
'asprintf', declared with attribute warn_unused_result [-Wunused-result]
src/screenshooter.c: In function ‘screenshooter_binding’:
src/screenshooter.c:291:10: warning: ignoring return value of
‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
src/text-backend.c: In function ‘text_backend_configuration’:
src/text-backend.c:944:10: warning: ignoring return value of ‘asprintf’,
declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
desktop shell and weston keyboard both refer to themselves prefixed by
LIBEXECDIR, however this is only valid once installed. make check will
currently either fail or run pre-existing versions.
This patch adds a way to override that location by setting the env var
WESTON_BUILD_DIR - which is then set by the test env script so make check
will test the versions in the build directory regardless of whether they're
installed or not.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
An error makes the client exit, which cleans up the resources anyway.
Note (Jason Ekstrand):
This is safe for two reasons. First, we should be handling object
destruction nicely anyway. Second, in each of these cases, the resources
don't have any implementation or destruction set so it has absolutely no
effect on the rest of weston whether we destroy it now or later.
Most zalloc calls in weston are checked, this fixes a handful that were
being ignored. As found by `grep -EIsr "[^x]zalloc\(" . -A1`
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
screenshooter.c: In function ‘recorder_binding’:
screenshooter.c:509:5: warning: ‘listener’ may be used uninitialized in
this function [-Wuninitialized]
This was not really a problem so far, because the variable was
uninitialized only in the case where Weston had no outputs.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Record from the output of the surface that has keyboard focus for the
seat used to activate the recorder key binding. If there is no focused
surface, record from the first one.
Also, use the weston_transformed_region() to transform the damage
region of the output into the coordinates expected by read_pixels().
https://bugs.freedesktop.org/show_bug.cgi?id=71401
If the compositor hasn't been rendering for a while when the recording
stops, the time difference between the last rendered frame and that
moment won't be in the encoded video. Fix that by forcing one extra
frame to be recorded when the user presses the recorder key binding.
https://bugs.freedesktop.org/show_bug.cgi?id=71142
This wraps all accesses to an SHM buffer between wl_shm_buffer_begin
and end so that wayland-shm can install a handler for SIGBUS and catch
attempts to pass the compositor a buffer that is too small.
This commit sets the version numbers for all added/created objects. The
wl_compositor.create_surface implementation was altered to create a surface
with the same version as the underlying wl_compositor. Since no other
"child interfaces" have version greater than 1, they were all hard-coded to
version 1.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
This commit adds a weston_buffer structure to replace wl_buffer. This way
we can hold onto buffers by just their resource. In order to do this, the
every renderer.attach function has to fill in the weston_buffer.width and
weston_buffer.height fields.
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system. This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.
Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries. This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
[pq: rebased and converted more files]
Both GL and pixman renderer (pixman probably only because GL did?)
return the screen capture image as y-flipped, therefore Weston y-flips
it again. However, the future rpi-renderer can produce only right-way-up
(non-flipped) screen captures, and does not need an y-flip.
Add a capability flag for y-flip, which the rpi-renderer will not set,
to get screen captures the right way up.
The wcap recording code needs yet another temporary buffer for the
non-flipped case, since the WCAP format is flipped, and the code
normally overwrites the input image as it compresses it. This becomes
difficult, if the compressor is supposed to flip while processing.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>