Commit graph

645 commits

Author SHA1 Message Date
Marius Vlad 9c4b5c4931 compositor: Fix some warning when passing debugoptimized to meson
Increase the buf size such it can accomodate sufficiently large local
buffers. Spotted whilst looking for something else.

../compositor/main.c:157:22: warning: ‘%s’ directive output may be
truncated writing up to 511 bytes into a region of size 128
[-Wformat-truncation=]
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |                      ^~             ~~~~~~~
../compositor/main.c:157:21: note: directive argument in the range
[-9223372036854775, 9223372036854775]
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |                     ^~~~~~~~~~~~~~
../compositor/main.c:157:2: note: ‘snprintf’ output between 7 and 659
bytes into a destination of size 128
  157 |  snprintf(buf, len, "%s[%s.%03li]", datestr,
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  158 |    timestr, (tv.tv_usec / 1000));
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-11-14 10:54:40 +02:00
Marius Vlad ded0b77316 compositor: Pass the entire string in one-shot when writting logger data
This fixes the situation where the same logger scope is passed multiple
times and the timestamp is being sent before the log mesasge.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-05 13:59:18 +02:00
Marius Vlad 91dffa37a6 compositor: Allow protocol to be displayed when asked for, even if we're not supplying debug argument
This wasn't intentional it just kept the way it was done before.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-11-04 17:04:08 +02:00
Pekka Paalanen 8e7f9501e4 Link Weston plugins to libexec-weston.so
All these plugins use symbols that were exported by the weston executable and
are now exported by libexec-weston.so. Linking these to libexec-weston.so fixes
unresolved symbols.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:40:51 +03:00
Pekka Paalanen 699d89c92f cms-colord: work around unresolved symbols
This is preparation for disallowing unresolved symbols project-wide.

This is a temporary fix that should be reverted and fixed properly later.

/usr/bin/ld: compositor/fb12c4d@@cms-colord@sha/cms-helper.c.o: in function `weston_cms_set_color_profile':
/home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:79: undefined reference to `cmsReadTag'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:91: undefined reference to `cmsEvalToneCurveFloat'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:92: undefined reference to `cmsEvalToneCurveFloat'
/usr/bin/ld: /home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:93: undefined reference to `cmsEvalToneCurveFloat'
/usr/bin/ld: compositor/fb12c4d@@cms-colord@sha/cms-helper.c.o: in function `weston_cms_destroy_profile':
/home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:108: undefined reference to `cmsCloseProfile'
/usr/bin/ld: compositor/fb12c4d@@cms-colord@sha/cms-helper.c.o: in function `weston_cms_load_profile':
/home/pq/build/weston-meson/../../git/weston/compositor/cms-helper.c:131: undefined reference to `cmsOpenProfileFromFile'

See also #263

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:40:51 +03:00
Pekka Paalanen b35c21f70c compositor: turn weston main() into a lib
This takes everything that was in 'weston' the executable a turns it into
library. A new trivial 'weston' executable is written.

Creating the library will allow future improvements:

- we can link weston plugins against the library, meaning that they no longer
  need unresolved symbols to be allowed during linking

- tests do not have to fork() and exec() 'weston', they can just link to the
  library and call wet_main() after setting things up; this will help with
  using a debugger

install_rpath is set so that we can install the library into weston's module
directory, away from the normal libraries in a system. This is one library we
do not intend for others to use.

The library has no stable ABI and is not versioned.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:40:51 +03:00
Pekka Paalanen 71ff95a544 build: separate deps for int and ext libweston users
We have two kinds of libweston users: internal and external. Weston, the
frontend, counts as an external user, and should not have access to libweston
private headers. The shell plugins are external users as well, because we
intend people to be able to write them. Renderers, backends, and some plugins
are internal users who will need access to private headers.

Create two different Meson dependency objects, one for each kind.

This makes it less likely to accidentally use a private header.

Screen-share is a Weston plugin and therefore counts as an external user, but
it needs the backend API to deliver input. Until we are comfortable exposing
public API for that purpose, let it use internal headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-24 13:29:33 +03:00
Marius Vlad 9bb1c3a3c2 weston-log: Add 'destroy_subscription' callback for the subscription
As 'new_subscription' can create additional objects, 'destroy_subscription'
will be needed when cleaning up.

As this requires a libweston_major bump (noticed by @pq), bump it up to
8.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2019-10-17 19:42:55 +03:00
Pekka Paalanen c57a8cccd3 compositor: add use-gl option to headless
This will allow one to run the headless backend with GL-renderer.

Implements: https://gitlab.freedesktop.org/wayland/weston/issues/278

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-11 12:16:35 +00:00
Pekka Paalanen 4f5e360180 build: simplify include_directories
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.

Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
 #include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.

Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 17:14:22 +03:00
Pekka Paalanen c232f8d934 Unify the include style of shared/ headers
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.

This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.

This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with

	#include "libweston/dbus.h"

or even

	#include <libweston/dbus.h>

IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.

The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-10-04 16:04:48 +03:00
Miguel A. Vico 5c5f0272d9 compositor: Do not trigger invalid destructors when hotunplugging
When hotunplugging a display, the compositor will tear the top-level
wet_output object down, freeing its memory.

However, destruction of the backend output might be delayed in certain
situations (e.g. destroying DRM output while in the middle of a page
flip).

When the backend output is finally destroyed, it will trigger a
destruction callback previously added by the compositor, which point to
data belonging to the top-level wet_output object.

In order to avoid access to invalid data when the backend output is
destroyed after the top-level wet_output object, remove the destruction
callback from the corresponding list before freeing the object.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
2019-09-25 13:25:39 -07:00
Ankit Nautiyal 93dde245ee libweston: Add functions to modify disable_planes counter for an output
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>
2019-08-26 16:18:22 +05:30
Marius Vlad e568488548 compositor: Return the number of bytes written as to format properly
Otherwise 'log_extensions()' will not know how to properly format the
data.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-08-19 12:52:29 +03:00
Stefan Agner bf5b6219ae screen-share: use pixman_image_composite32 instead of pixman_blt
The function pixman_blt may return false in case there is no
accelerated blit function available. In this case the remote shared
screen stays black.

This has been observed on Weston compiled for aarch64. In currrent
pixman 0.38.4 there is no accelerated pixman_blt function for
aarch64 available.

Use pixman_image_composite32 instead which is guaranteed to have a
working fallback implementation.

Fixes: #253

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Stefan Agner ab840fc855 screen-share: move damage calculation after screen resize
Calculate damage region after resizing the cache image. This
avoids unnecessary calculation of damaged regions on resize,
makes sure that the whole screen is considered damaged on
resize and simplifies error handling.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Stefan Agner 64e2964159 screen-share: fix error handling
Make sure damage region gets properly unreferenced in error cases.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Stefan Agner 2b2c9a6f7f screen-share: align read_pixels call with screenshooter
Calculate y_orig separately first makes it easer to understand the
code and aligns with how pixels are read in screenshooter.c.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-08-16 07:51:20 +00:00
Marius Vlad 7216d4c44b compositor: Bring back the old timestamp format for the log scope
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-08-12 18:31:46 +00:00
Marius Vlad bed9b81a39 compositor: Use only 'log' scope to print libwayland messages
No need to duplicate messages.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-08-06 14:34:17 +03:00
Stefan Agner f6e7d2ce67 screen-share: destroy seat on remove
Destroy seats when they get removed. This makes sure that seats
properly disappear when screen-share RDP clients disconnect.
There will be no excessive amount of mouse pointer anymore after
several client connection/disconnections.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-07-23 16:08:04 +00:00
Michael Olbrich d5d5aa91a2 Add pipewire plugin
It is quite similar to the remoting plugin. It just exports the frames via
pipewire instead of the builtin GStreamer pipeline.
It implements the same virtual output API. Virtual outputs can be created
by adding 'pipewire-output' sections to weston.ini.

The generated frames can be accessed with any pipewire client. e.g. with
GStreamer:

gst-launch-1.0 pipewiresrc ! video/x-raw,format=BGRx ! ...

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2019-07-19 08:01:55 +02:00
Marius Vlad e2d2ab7ed5 compositor: Remove from main displaying available log scopes
Place the subscribe parts and displaying of available scopes out of
main as it makes no sense to keep them there.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad 592555831a compositor: Add debug key-binding to display/dump flight recorder contents
Uses (debug key-binding mod+shift+space) KEY_D to display/dump
the contents of the flight recorder.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad b5ac5a9aa1 compositor: Plug-in the flight recorder
Create a flight recorder subscriber and allow subscribring to scopes
over the command line.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad b599ad7701 compositor: Create the 'log' scope much earlier
Logging should start as early as possible so create the log scope as
early as possible, before subscribing to it.

Open the logfile before creating the 'logger' subscriber, making sure
we're logging to the file properly.

Also migrate `weston_log_set_handler()` to avoid potential calls to
`weston_log` before installing the log handler.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad 284d5345ad compositor: Destroy the compositor before the log scope
Destroying the compositor after destroying the log scope will not print
out the messages in the tear down/clean-up phase of the compositor, so
add a new tear_down function which allows keeping a valid reference to
the compositor. This way we can destroy the compositor before destroying
the scope and keep the debug messages.

While at it remove the log context destroy part from the clean-up
of the compositor and make it stand on its own.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad f387f8409a compositor: Plug-in the file stream
Pass log scopes from the command line to subscribe log scopes
dynamically to the 'logger' subscriber.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 13:34:04 +03:00
Marius Vlad c901e8913e weston-debug: Rename weston-debug to weston-log to better reflect its purpose
No changes in functionality have been made.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 10:49:39 +03:00
Marius Vlad 63ef078ada libweston: Migrate functions that operate on 'weston_output' into backend header
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Marius Vlad 9eb2064b85 libweston: Migrate functions that operate on input objects
This include 'weston_keyboard', 'weston_touch', 'weston_pointer' and
other released classes.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-07-18 06:43:38 +00:00
Pekka Paalanen 1c0d04bff7 libweston: do not include config-parser.h
config-parser.h is a helper API that libweston core must never depend on. Using
it is a compositor frontend decision.

Including it in libweston.h would give the wrong message.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-07-18 06:43:38 +00:00
Tomohito Esaki 3ea03bb85e remoting: make a gstreamer pipeline configurable
Allow a gstreamer pipeline to be configurable via an weston.ini. It is
necessary that source is appsrc, its name is "src", and sink name is
"sink" in pipeline. Also, remoting plugin ignore port and host
configuration if the gst-pipeline is specified.
2019-07-09 14:22:25 +00:00
Ankit Nautiyal 2844f8eaaf compositor: Enable HDCP for an output using weston.ini
This patch enables a user to opt for HDCP per output, by writing into
the output section of weston.ini configuration file. HDCP is always
enabled by default for the outputs.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2019-07-05 14:13:30 +05:30
Stefan Agner b0e16d4c53 backend-rdp: allow to force compression off
By default the client communicates its preference with regards to
compression to the server. However, some clients always use
compression, which is not ideal for certain environments (e.g.
low performance embedded devices in a local network with plenty
of bandwidth). Allow to disable compression server-side which will
override the clients request for compression.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-06-20 16:39:13 +02:00
Daniel Stone 814335821e weston: Properly test for output-creation failure
We were testing the wrong variable to see if output creation had failed:
instead of testing the return of the function we'd just called, we were
testing something we'd already checked earlier.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-11 10:36:55 +00:00
Fabrice Fontaine 137b811ecd Fix build with kernel < 4.4
weston includes input-event-codes.h since version 5.0.91 and
6e229ca263

input-event-codes.h is available only since kernel 4.4 and
f902dd8934

To fix this build failure, replace include on linux/input-event-codes.h
by linux/input.h

Fixes:
 - http://autobuild.buildroot.org/results/210c2759900f15ea0030d088f6f45cd8bb199b29

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-06-10 14:02:29 +02:00
Silva Alejandro Ismael 21a1f40760 compositor: fix segfaults if wl_display_create fails
Added check to log the error if wl_display_create return NULL.

Fixes: #101

Signed-off-by: Silva Alejandro Ismael <silva.alejandro.ismael@gmail.com>
2019-05-31 16:39:43 -03:00
Scott Anderson 2edbcbd9cd compositor: Fix incorrect use of bool options
WESTON_OPTION_BOOLEAN takes a pointer to an int as an argument, but
there were several cases of being passed a pointer to a bool instead.
This changes it to use a local int instead, and then write that value to
the bool.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2019-05-29 18:30:06 +12:00
Marius Vlad f4f4c2bcf1 libweston: Add weston-debug header to libweston
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 7e4db95373 libweston: Rename weston_debug_scope_ to weston_log_scope_
Rename also the functions which work on weston_log_scope.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 5d5e335845 libweston: Rename weston_debug_scope to weston_log_scope
This is a continuation of the previous patch to align more closely to
the weston log framework.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 3d7d978c21 libweston: Rename weston_debug_compositor to weston_log_context
As we transition towards a more generic API for weston loggging
framework rename weston_debug_compositor to weston_log_context to show
the fact that this is not really debug but a logging context.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:02:00 +00:00
Marius Vlad 1e2fda2ea1 compositor: Convert weston-debug framework to use weston_debug_compositor
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:01:59 +00:00
Marius Vlad 880b485d76 libweston: Decouple weston_debug_compositor from weston_compositor
This patch allows initialization of weston-debug/log framework much earlier
than weston_compositor, which in turn will provide the option start
logging before weston_compositor has been created.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-05-10 12:01:59 +00:00
Antonio Borneo 3957863667 log: remove "%m" from format strings by using strerror(errno)
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>
2019-05-02 22:10:30 +02:00
Pekka Paalanen cda1488ce0 Rename version.h to libweston/version.h
This is an installed public header, and without the subdir would surely
conflict with something else.

include/libweston/meson.build is necessary for putting the generated header in
the right subdirectory so that '#include <libweston/version.h>' can work.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen eebb7dc9ce Rename xwayland-api.h to libweston/xwayland-api.h
See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen ecbdcfd373 Rename zalloc.h to libweston/zalloc.h
It is a public installed header used by libweston.h.

See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 9eda0ea825 Rename windowed-output-api.h to libweston/windowed-output-api.h
See "Rename compositor.h to libweston/libweston.h" for rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00