This is a complete port of the headless backend that
uses the recently added output handling API for output
configuration.
- Output can be configured at runtime by passing the
necessary configuration parameters, which can be
filled in manually, obtained from the configuration
file or obtained from the command line using
previously added functionality. It is required that
the scale and transform values are set using the
previously added functionality.
- Output can be created at runtime using the output
API. The output creation only creates a pending
output, which needs to be configured the same way as
mentioned above.
After everything has been set, output needs to be
enabled manually using weston_output_enable().
Same as before, a single output is created at runtime
using the default configuration or a configuration
parsed from the command line. The no-outputs
functionality is also preserved, which means that no
output will be created initially, but more outputs can
be added at runtime using the output API.
New feature:
This patch also adds, as a bonus of using shared
functionality, support for setting options for outputs
created by this backend in the weston config file in
addition to setting them from the command line.
v2:
- Fix wet_configure_windowed_output_from_config() usage.
- Call headless_output_disable() explicitly from
headless_output_destroy().
v3:
- Add scale support to output width and height.
- Use scaled values in calls to various functions which
require width and height.
- Disallow calling headless_output_configure more than once.
- Remove unneeded checks for output->name == NULL as that
has been disallowed.
- Use weston_compositor_add_pending_output().
- Bump weston_headless_backend_config version to 2.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This is a complete port of the fbdev backend that uses
the recently added output handling API for output
configuration.
It is required that the scale and transform values are
set using the previously added functionality.
After everything has been set, output needs to be
enabled manually using weston_output_enable().
v2:
- Use weston_compositor_add_pending_output().
- Bump weston_fbdev_backend_config version to 2.
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This is a complete port of the DRM backend that uses
the recently added output handling API for output
configuration.
Output can be configured at runtime by passing the
necessary configuration parameters, which can be
filled in manually or obtained from the configuration
file using previously added functionality. It is
required that the scale and transform values are set
using the previously added functionality.
After everything has been set, output needs to be
enabled manually using weston_output_enable().
v2:
- Added missing drmModeFreeCrtc() to drm_output_enable()
cleanup list in case of failure.
- Split drm_backend_disable() into drm_backend_deinit()
to accomodate for changes in the first patch in the
series. Moved restoring original crtc to
drm_output_destroy().
v3:
- Moved origcrtc allocation to drm_output_set_mode().
- Swapped connector_get_current_mode() and
drm_output_add_mode() calls in drm_output_set_mode()
to match current weston.
- Moved crtc_allocator and connector_allocator update
from drm_output_enable() to create_output_for_connector()
to avoid problems when more than one monitor is connected
at startup and crtc allocator wasn't updated before
create_output_for_connector() was called second time,
resulting in one screen being turned off.
- Moved crtc_allocator and connector_allocator update from
drm_output_deinit() to drm_output_destroy(), as it
should not be called on drm_output_disable().
- Use weston_compositor_add_pending_output().
- Bump weston_drm_backend_config version to 2.
v4:
- Reset output->original_crtc to NULL if drm_output_set_mode()
fails.
- Remove unneeded log message when disabling an output when a
pageflip is pending.
- Document that create_output_for_connector() takes ownership
of the connector.
- Free the connector if create output conditionals are not met
in create_outputs() and update_outputs().
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This implements output configuration for outputs which use
previously added weston_windowed_output_api. The function
takes an output that's to be configured, default configuration
that's to be set in case no configuration is specified in
the config file or on command line and optional third argument,
parsed_options, which will override defaults and options for
configuration if they are present.
This also introduces new compositor specific functions for
setting output's scale and transform from either hardcoded
default, config file option or command line option.
Pending output handling helpers have also been introduced.
v2:
- Adapt to changes in previous patch.
- Fix potential double free().
- Remove redundant variables for scale and transform setting.
- Drop parsed_options helper and parameter and use it directly
in wet_configure_windowed_output_from_config().
v3:
- Remove unneeded checks for output->name == NULL as that
has been disallowed.
- Stop printing mode if it's invalid, as it can be NULL.
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
This tightens up the strtol() error checking in several places where it
is used for parsing environment variables, and in the backlight
interface that is reading numbers from files under /sys/class/backlight.
All of these uses are expecting strings containing decimal numbers and
nothing else, so the error checking can all be tightened up and made
consistent with other strtol() calls.
This follows the error checking style used in Wayland
(c.f. wayland-client.c and scanner.c) and c.f. commit cbc05378.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Use the documented libweston-$major.so.0.$minor.$patch scheme.
An (almost) identical one is used by GLIB, GDK{2,3}, QT5, json-glib and
others.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This patch makes the compositor user data a structure
which can be expanded with new fields when necessary.
v2:
Don't export to_wet_compositor
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The third arg to strtol() specifies the base to assume for the number.
When 0 is passed, as is currently done in option-parser.c, hexadecimal
and octal numbers are permitted and automatically detected and
converted.
This change is an expansion of f6051cbab8
to cover the remaining strtol() calls in Weston, where the routine is
being used to read fds and pids - which are always expressed in base-10.
It also changes the calls in config-parser, used by
weston_config_section_get_int(), which in turn is being used to read
scales, sizes, times, rates, and delays; these are all expressed in
base-10 numbers only.
The benefit of limiting this to base-10 is to eliminate surprises when
parsing numbers from the command line. Also, by making the code
consistent with other usages of strtol, it may make it possible to
factor out the common code in the future.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This patch follows a similar approach taken to detach the backends from
weston. But instead of passing a configuration struct when loading the
plugin, we use the plugin API registry to register an API, and to get it
in the compositor side. This API allows to spawn the Xwayland process
in the compositor side, and to deal with signal handling. A new
function is added in compositor.c to load and init the xwayland.so
plugin.
Also make sure to re-arm the SIGUSR1 when the X server quits.
Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
[Pekka: moved xwayland/weston-xwayland.c -> compositor/xwayland.c]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This patch adds a new command line option which can be
used to tell headless backend not to create any
virtual outputs.
This will be used for output hotplug emulation, where
weston will start with no outputs available, and the
virtual output will be created at runtime.
v2:
- Use bool instead of int for the indicator flag
- Move final newspace to a separate line in command
line options
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Write the command line to the log to aid debugging. It needs to be
copied before parsing, because parsing mutates argv.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This is the start of separating weston-the-compositor source files from
libweston source files.
This is moving all the files related to the 'weston' binary. Also the
CMS and systemd plugins are moved.
xwayland plugin is not moved, because it will be turned into a
libweston feature.
To avoid breaking the build, #includes for weston.h are fixed to use
compositor/weston.h. This serves as a reminder that such files may need
further attention: moving to the right directory, or maybe using the
proper -I flags instead.
v2: Move also screen-share.c, and add a note about weston-launch.
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 rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
Free many things we were leaking before:
- input device
- EGL resources
- xcb event source
- X Display
Fixes lots of Valgrind leaks.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Nothing was freeing the allocation from screenshooter_create().
Add enough boilerplate, that we can free it. Fixes a Valgrind leak.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
The two pixman regions of struct wlsc_surface were not being freed
properly.
Fixes some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add a function for destroying all objects allocated in
wlsc_input_device_init().
This patch depends on "server: add wl_input_device_fini()" commit in the
Wayland core.
Compositor backends could now call wlsc_input_device_fini() to fix some
memory leaks.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Free idle_source, shm, and vertices and indices arrays on compositor
shutdown.
Fixes some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
After the compositor exits the main loop in wl_display_run(), set the
compositor state to SLEEPING. This prevents scheduling repaints, that
will never be executed.
A repaint is scheduled by calling wl_event_loop_add_idle(), which
creates an idle event source. Normally the idle event source object is
destroyed after it has been executed. However, in the shutdown case we
never dispatch events again, and the object is leaked.
This leak is triggered by shell.c destructor, which destroys the
desktop-shell client. Destroying a client ends up calling
wlsc_compositor_schedule_repaint() while destroying the client
resources, especially surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
If the compositor is shutting down while the desktop_shell still exists,
we leaked some resources by not destroying the client record.
Call wl_client_destroy() on the desktop_shell client, if it exists
during shutdown. Fixes some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
wlsc_binding_destroy() was not being called at all. Fix the leaks by
introducing a function that destroys a whole list of bindings, instead
of individually saving an extra pointer to the binding object and
calling wlsc_binding_destroy() separately on each.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Some of the local pixman region objects were not being properly
destroyed before returning from the function. Destroy them, fixes
some Valgrind errors.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Add a new wlsc_shell API function for destroying the shell plugin
object. Helps to reduce Valgrind reports.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This is the other direction. The selection bridge will grab the X11
CLIPBOARD selection on behalf of the Wayland client when it sets the
Wayland selection. Right now only UTF-8 text is supported, but the
data types offered will be taken from the Wayland data source.
We need to store all touchpoint positions so that if we just get an
ABS_MT_POSITION_X or Y event, we can pull the other coordinate from the
cache. And we need this across invocations of evdev_input_device_data(),
so the accumulator approach doesn't work.
Instead, we go back to the approach of storing all this state in the
evdev device struct and we might as well just move the rel and abs state
there too.
This adds ABS_MT_* support for direct touch devices and notifies
the compositor. The compositor has a stub for now.
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>