Skip to content
Commits on Source (212)
......@@ -76,6 +76,7 @@ weston-simple-damage
weston-smoke
weston-stacking
weston-subsurfaces
weston-touch-calibrator
weston-transformed
weston-view
......
image: debian:stretch
stages:
- build
before_script:
- echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
- echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
- echo '#!/bin/sh' > /usr/sbin/policy-rc.d
- echo 'exit 101' >> /usr/sbin/policy-rc.d
- chmod +x /usr/sbin/policy-rc.d
- apt-get update
- apt-get -y --no-install-recommends install build-essential automake autoconf libtool pkg-config libexpat1-dev libffi-dev libxml2-dev libpixman-1-dev libpng-dev libjpeg-dev libcolord-dev mesa-common-dev libglu1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libwayland-dev libxcb1-dev libxcb-composite0-dev libxcb-xfixes0-dev libxcb-xkb-dev libx11-xcb-dev libx11-dev libudev-dev libgbm-dev libxkbcommon-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libxcursor-dev libmtdev-dev libpam0g-dev libvpx-dev libsystemd-dev libinput-dev libwebp-dev libjpeg-dev libva-dev liblcms2-dev git
- mkdir -p /tmp/.X11-unix
- chmod 777 /tmp/.X11-unix
build-native:
stage: build
script:
- git clone --depth=1 git://anongit.freedesktop.org/git/wayland/wayland-protocols
- export WAYLAND_PROTOCOLS_DIR="$(pwd)/prefix-wayland-protocols"
- export PKG_CONFIG_PATH="$WAYLAND_PROTOCOLS_DIR/share/pkgconfig:$PKG_CONFIG_PATH"
- export MAKEFLAGS="-j4"
- cd wayland-protocols
- git show -s HEAD
- mkdir build
- cd build
- ../autogen.sh --prefix="$WAYLAND_PROTOCOLS_DIR"
- make install
- cd ../../
- export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
- export BUILD_ID="weston-$CI_JOB_NAME_$CI_COMMIT_SHA-$CI_JOB_ID"
- export PREFIX="$(pwd)/prefix-$BUILD_ID"
- export BUILDDIR="$(pwd)/build-$BUILD_ID"
- mkdir "$BUILDDIR" "$PREFIX"
- cd "$BUILDDIR"
- ../autogen.sh --prefix="$PREFIX" --disable-setuid-install --enable-xwayland --enable-x11-compositor --enable-drm-compositor --enable-wayland-compositor --enable-headless-compositor --enable-fbdev-compositor --disable-rdp-compositor --enable-screen-sharing --enable-vaapi-recorder --enable-simple-clients --enable-simple-egl-clients --enable-simple-dmabuf-drm-client --enable-simple-dmabuf-v4l-client --enable-clients --enable-resize-optimization --enable-weston-launch --enable-fullscreen-shell --enable-colord --enable-dbus --enable-systemd-login --enable-junit-xml --enable-ivi-shell --enable-wcap-tools --disable-libunwind --enable-demo-clients-install --enable-lcms --with-cairo=image
- make all
- make check
- make install
- make distcheck
artifacts:
name: weston-$CI_COMMIT_SHA-$CI_JOB_ID
when: always
paths:
- build-*/weston-*.tar.xz
- build-*/*.log
- build-*/logs
- prefix-*
Contributing to Weston
=======================
Sending patches
---------------
Patches should be sent via
[GitLab merge requests](https://docs.gitlab.com/ce/gitlab-basics/add-merge-request.html).
Weston is
[hosted on freedesktop.org's GitLab](https://gitlab.freedesktop.org/wayland/weston/):
in order to submit code, you should create an account on this GitLab instance,
fork the core Weston repository, push your changes to a branch in your new
repository, and then submit these patches for review through a merge request.
Weston formerly accepted patches via `git-send-email`, sent to
**wayland-devel@lists.freedesktop.org**; these were
[tracked using Patchwork](https://patchwork.freedesktop.org/projects/wayland/).
Some old patches continue to be sent this way, and we may accept small new
patches sent to the list, but please send all new patches through GitLab merge
requests.
Formatting and separating commits
---------------------------------
Unlike many projects using GitHub and GitLab, Weston has a
[linear, 'recipe' style history](http://www.bitsnbites.eu/git-history-work-log-vs-recipe/).
This means that every commit should be small, digestible, stand-alone, and
functional. Rather than a purely chronological commit history like this:
doc: final docs for view transforms
fix tests when disabled, redo broken doc formatting
better transformed-view iteration (thanks Hannah!)
try to catch more cases in tests
tests: add new spline test
fix compilation on splines
doc: notes on reticulating splines
compositor: add spline reticulation for view transforms
we aim to have a clean history which only reflects the final state, broken up
into functional groupings:
compositor: add spline reticulation for view transforms
compositor: new iterator for view transforms
tests: add view-transform correctness tests
doc: fix Doxygen formatting for view transforms
This ensures that the final patch series only contains the final state,
without the changes and missteps taken along the development process.
The first line of a commit message should contain a prefix indicating
what part is affected by the patch followed by one sentence that
describes the change. For examples:
compositor-drm: Support modifiers for drm_fb
and
input: do not forward unmatched touch-ups
If in doubt what prefix to use, look at other commits that change the
same file(s) as the patch being sent.
The body of the commit message should describe what the patch changes
and why, and also note any particular side effects. This shouldn't be
empty on most of the cases. It shouldn't take a lot of effort to write
a commit message for an obvious change, so an empty commit message
body is only acceptable if the questions "What?" and "Why?" are already
answered on the one-line summary.
The lines of the commit message should have at most 76 characters, to
cope with the way git log presents them.
See [notes on commit messages] for a recommended reading on writing commit
messages.
Your patches should also include a Signed-off-by line with your name and
email address. If you're not the patch's original author, you should
also gather S-o-b's by them (and/or whomever gave the patch to you.) The
significance of this is that it certifies that you created the patch,
that it was created under an appropriate open source license, or
provided to you under those terms. This lets us indicate a chain of
responsibility for the copyright status of the code.
We won't reject patches that lack S-o-b, but it is strongly recommended.
When you re-send patches, revised or not, it would be very good to document the
changes compared to the previous revision in the commit message and/or the
merge request. If you have already received Reviewed-by or Acked-by tags, you
should evaluate whether they still apply and include them in the respective
commit messages. Otherwise the tags may be lost, reviewers miss the credit they
deserve, and the patches may cause redundant review effort.
Tracking patches and following up
---------------------------------
Once submitted to GitLab, your patches will be reviewed by the Weston
development team on GitLab. Review may be entirely positive and result in your
code landing instantly, in which case, great! You're done. However, we may ask
you to make some revisions: fixing some bugs we've noticed, working to a
slightly different design, or adding documentation and tests.
If you do get asked to revise the patches, please bear in mind the notes above.
You should use `git rebase -i` to make revisions, so that your patches follow
the clear linear split documented above. Following that split makes it easier
for reviewers to understand your work, and to verify that the code you're
submitting is correct.
A common request is to split single large patch into multiple patches. This can
happen, for example, if when adding a new feature you notice a bug in Weston's
core which you need to fix to progress. Separating these changes into separate
commits will allow us to verify and land the bugfix quickly, pushing part of
your work for the good of everyone, whilst revision and discussion continues on
the larger feature part. It also allows us to direct you towards reviewers who
best understand the different areas you are working on.
When you have made any requested changes, please rebase the commits, verify
that they still individually look good, then force-push your new branch to
GitLab. This will update the merge request and notify everyone subscribed to
your merge request, so they can review it again.
There are also
[many GitLab CLI clients](https://about.gitlab.com/applications/#cli-clients),
if you prefer to avoid the web interface. It may be difficult to follow review
comments without using the web interface though, so we do recommend using this
to go through the review process, even if you use other clients to track the
list of available patches.
Coding style
------------
You should follow the style of the file you're editing. In general, we
try to follow the rules below.
**Note: this file uses spaces due to markdown rendering issues for tabs.
Code must be indented using tabs.**
- indent with tabs, and a tab is always 8 characters wide
- opening braces are on the same line as the if statement;
- no braces in an if-body with just one statement;
- if one of the branches of an if-else condition has braces, then the
other branch should also have braces;
- there is always an empty line between variable declarations and the
code;
```c
static int
my_function(void)
{
int a = 0;
if (a)
b();
else
c();
if (a) {
b();
c();
} else {
d();
}
}
```
- lines should be less than 80 characters wide;
- when breaking lines with functions calls, the parameters are aligned
with the opening parentheses;
- when assigning a variable with the result of a function call, if the
line would be longer we break it around the equal '=' sign if it makes
sense;
```c
long_variable_name =
function_with_a_really_long_name(parameter1, parameter2,
parameter3, parameter4);
x = function_with_a_really_long_name(parameter1, parameter2,
parameter3, parameter4);
```
Conduct
=======
As a freedesktop.org project, Wayland follows the Contributor Covenant,
found at:
https://www.freedesktop.org/wiki/CodeOfConduct
Please conduct yourself in a respectful and civilised manner when
interacting with community members on mailing lists, IRC, or bug
trackers. The community represents the project as a whole, and abusive
or bullying behaviour is not tolerated by the project.
Licensing
=========
Weston is licensed with the intention to be usable anywhere X.org is.
Originally, X.org was covered under the MIT X11 license, but changed to
the MIT Expat license. Similarly, Weston was covered initially as MIT
X11 licensed, but changed to the MIT Expat license, following in X.org's
footsteps. Other than wording, the two licenses are substantially the
same, with the exception of a no-advertising clause in X11 not included
in Expat.
New source code files should specify the MIT Expat license in their
boilerplate, as part of the copyright statement.
Review
======
All patches, even trivial ones, require at least one positive review
(Reviewed-by). Additionally, if no Reviewed-by's have been given by
people with commit access, there needs to be at least one Acked-by from
someone with commit access. A person with commit access is expected to be
able to evaluate the patch with respect to the project scope and architecture.
The below review guidelines are intended to be interpreted in spirit, not by
the letter. There may be circumstances where some guidelines are better
ignored. We rely very much on the judgement of reviewers and commit rights
holders.
During review, the following matters should be checked:
- The commit message explains why the change is being made.
- The code fits the project's scope.
- The code license is the same MIT licence the project generally uses.
- Stable ABI or API is not broken.
- Stable ABI or API additions must be justified by actual use cases, not only
by speculation. They must also be documented, and it is strongly recommended to
include tests excercising the additions in the test suite.
- The code fits the existing software architecture, e.g. no layering
violations.
- The code is correct and does not introduce new failures for existing users,
does not add new corner-case bugs, and does not introduce new compiler
warnings.
- The patch does what it says in the commit message and changes nothing else.
- The patch is a single logical change. If the commit message addresses
multiple points, it is a hint that the commit might need splitting up.
- A bug fix should target the underlying root cause instead of hiding symptoms.
If a complete fix is not practical, partial fixes are acceptable if they come
with code comments and filed Gitlab issues for the remaining bugs.
- The bug root cause rule applies to external software components as well, e.g.
do not work around kernel driver issues in userspace.
- The test suite passes.
- The code does not depend on API or ABI which has no working free open source
implementation.
- The code is not dead or untestable. E.g. if there are no free open source
software users for it then it is effectively dead code.
- The code is written to be easy to understand, or if code cannot be clear
enough on its own there are code comments to explain it.
- The code is minimal, i.e. prefer refactor and re-use when possible unless
clarity suffers.
- The code adheres to the style guidelines.
- In a patch series, every intermediate step adheres to the above guidelines.
Commit rights
=============
Commit rights will be granted to anyone who requests them and fulfills the
below criteria:
- Submitted some (10 as a rule of thumb) non-trivial (not just simple
spelling fixes and whitespace adjustment) patches that have been merged
already.
- Are actively participating in public discussions about their work (on the
mailing list or IRC). This should not be interpreted as a requirement to
review other peoples patches but just make sure that patch submission isn't
one-way communication. Cross-review is still highly encouraged.
- Will be regularly contributing further patches. This includes regular
contributors to other parts of the open source graphics stack who only
do the occasional development in this project.
- Agrees to use their commit rights in accordance with the documented merge
criteria, tools, and processes.
To apply for commit rights, create a new issue in gitlab for the respective
project and give it the "accounts" label.
Committers are encouraged to request their commit rights get removed when they
no longer contribute to the project. Commit rights will be reinstated when they
come back to the project.
Maintainers and committers should encourage contributors to request commit
rights, especially junior contributors tend to underestimate their skills.
Stabilising for releases
========================
A release cycle ends with a stable release which also starts a new cycle and
lifts any code freezes. Gradual code freezing towards a stable release starts
with an alpha release. The release stages of a cycle are:
- **Alpha release**:
Signified by version number #.#.91.
Major features must have landed before this. Major features include
invasive code motion and refactoring, high risk changes, and new stable
library ABI.
- **Beta release**:
Signified by version number #.#.92.
Minor features must have landed before this. Minor features include all
new features that are not major, low risk changes, clean-ups, and
documentation. Stable ABI that was new in the alpha release can be removed
before a beta release if necessary.
- **Release candidates (RC)**:
Signified by version number #.#.93 and up to #.#.99.
Bug fixes that are not release critical must have landed before this.
Release critical bug fixes can still be landed after this, but they may
call for another RC.
- **Stable release**:
Signified by version number #.#.0.
Ideally no changes since the last RC.
Mind that version #.#.90 is never released. It is used during development when
no code freeze is in effect. Stable branches and point releases are not covered
by the above.
[git documentation]: http://git-scm.com/documentation
[notes on commit messages]: http://who-t.blogspot.de/2009/12/on-commit-messages.html
......@@ -24,10 +24,8 @@ weston.ini : $(srcdir)/weston.ini.in
ivi-shell/weston.ini : $(srcdir)/ivi-shell/weston.ini.in
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
-e 's|@bindir[@]|$(bindir)|g' \
-e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
-e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
-e 's|@libexecdir[@]|$(libexecdir)|g' \
-e 's|@plugin_prefix[@]||g' \
-e 's|@westondatadir[@]|$(westondatadir)|g' \
$< > $@
all-local : weston.ini ivi-shell/weston.ini
......@@ -81,6 +79,7 @@ libweston_@LIBWESTON_MAJOR@_la_SOURCES = \
libweston/input.c \
libweston/data-device.c \
libweston/screenshooter.c \
libweston/touch-calibration.c \
libweston/clipboard.c \
libweston/zoom.c \
libweston/bindings.c \
......@@ -168,7 +167,9 @@ nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES = \
protocol/pointer-constraints-unstable-v1-protocol.c \
protocol/pointer-constraints-unstable-v1-server-protocol.h \
protocol/input-timestamps-unstable-v1-protocol.c \
protocol/input-timestamps-unstable-v1-server-protocol.h
protocol/input-timestamps-unstable-v1-server-protocol.h \
protocol/weston-touch-calibration-protocol.c \
protocol/weston-touch-calibration-server-protocol.h
BUILT_SOURCES += $(nodist_libweston_@LIBWESTON_MAJOR@_la_SOURCES)
......@@ -543,6 +544,7 @@ demo_clients = \
weston-fullscreen \
weston-stacking \
weston-calibrator \
weston-touch-calibrator \
weston-scaler
if INSTALL_DEMO_CLIENTS
......@@ -629,6 +631,7 @@ nodist_weston_simple_dmabuf_drm_SOURCES = \
weston_simple_dmabuf_drm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_DMABUF_DRM_CLIENT_CFLAGS)
weston_simple_dmabuf_drm_LDADD = $(SIMPLE_DMABUF_DRM_CLIENT_LIBS) \
$(LIBDRM_PLATFORM_FREEDRENO_LIBS) \
$(LIBDRM_PLATFORM_ETNAVIV_LIBS) \
$(LIBDRM_PLATFORM_INTEL_LIBS) \
libshared.la
endif
......@@ -781,6 +784,17 @@ weston_calibrator_SOURCES = \
weston_calibrator_LDADD = libtoytoolkit.la
weston_calibrator_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
weston_touch_calibrator_SOURCES = \
clients/touch-calibrator.c \
shared/helpers.h \
shared/matrix.c \
shared/matrix.h
nodist_weston_touch_calibrator_SOURCES = \
protocol/weston-touch-calibration-protocol.c \
protocol/weston-touch-calibration-client-protocol.h
weston_touch_calibrator_LDADD = libtoytoolkit.la
weston_touch_calibrator_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
if BUILD_SUBSURFACES_CLIENT
demo_clients += weston-subsurfaces
weston_subsurfaces_SOURCES = \
......@@ -828,7 +842,9 @@ nodist_weston_info_SOURCES = \
protocol/presentation-time-protocol.c \
protocol/presentation-time-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \
protocol/linux-dmabuf-unstable-v1-client-protocol.h
protocol/linux-dmabuf-unstable-v1-client-protocol.h \
protocol/tablet-unstable-v2-protocol.c \
protocol/tablet-unstable-v2-client-protocol.h
weston_info_LDADD = $(WESTON_INFO_LIBS) libshared.la
weston_info_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
......@@ -866,6 +882,8 @@ endif
BUILT_SOURCES += \
protocol/weston-screenshooter-protocol.c \
protocol/weston-screenshooter-client-protocol.h \
protocol/weston-touch-calibration-protocol.c \
protocol/weston-touch-calibration-client-protocol.h \
protocol/text-cursor-position-client-protocol.h \
protocol/text-cursor-position-protocol.c \
protocol/text-input-unstable-v1-protocol.c \
......@@ -888,6 +906,8 @@ BUILT_SOURCES += \
protocol/ivi-application-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \
protocol/linux-dmabuf-unstable-v1-client-protocol.h \
protocol/tablet-unstable-v2-protocol.c \
protocol/tablet-unstable-v2-client-protocol.h \
protocol/input-timestamps-unstable-v1-protocol.c \
protocol/input-timestamps-unstable-v1-client-protocol.h
......@@ -1455,13 +1475,13 @@ ivi_layout_internal_test_la_LIBADD = $(test_module_libadd)
ivi_layout_internal_test_la_LDFLAGS = $(test_module_ldflags)
ivi_layout_internal_test_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
ivi_layout_internal_test_la_SOURCES = \
tests/ivi_layout-internal-test.c
tests/ivi-layout-internal-test.c
ivi_layout_test_la_LIBADD = $(test_module_libadd)
ivi_layout_test_la_LDFLAGS = $(test_module_ldflags)
ivi_layout_test_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
ivi_layout_test_la_SOURCES = \
tests/ivi_layout-test-plugin.c \
tests/ivi-layout-test-plugin.c \
tests/ivi-test.h \
shared/helpers.h
nodist_ivi_layout_test_la_SOURCES = \
......@@ -1478,17 +1498,17 @@ nodist_ivi_shell_app_weston_SOURCES = \
ivi_shell_app_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
ivi_shell_app_weston_LDADD = libtest-client.la
noinst_PROGRAMS += ivi-layout.ivi
noinst_PROGRAMS += ivi-layout-test-client.ivi
ivi_layout_ivi_SOURCES = \
tests/ivi_layout-test.c \
ivi_layout_test_client_ivi_SOURCES = \
tests/ivi-layout-test-client.c \
tests/ivi-test.h \
shared/helpers.h
nodist_ivi_layout_ivi_SOURCES = \
nodist_ivi_layout_test_client_ivi_SOURCES = \
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h
ivi_layout_ivi_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
ivi_layout_ivi_LDADD = libtest-client.la
ivi_layout_test_client_ivi_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
ivi_layout_test_client_ivi_LDADD = libtest-client.la
endif
if BUILD_SETBACKLIGHT
......@@ -1540,6 +1560,7 @@ EXTRA_DIST += \
protocol/weston-screenshooter.xml \
protocol/text-cursor-position.xml \
protocol/weston-test.xml \
protocol/weston-touch-calibration.xml \
protocol/ivi-application.xml \
protocol/ivi-hmi-controller.xml
......@@ -1572,8 +1593,12 @@ endif
MAN_SUBSTS = \
-e 's|__weston_native_backend__|$(WESTON_NATIVE_BACKEND)|g' \
-e 's|__weston_modules_dir__|$(pkglibdir)|g' \
-e 's|__weston_modules_dir__|$(moduledir)|g' \
-e 's|__libweston_modules_dir__|$(libweston_moduledir)|g' \
-e 's|__weston_shell_client__|$(WESTON_SHELL_CLIENT)|g' \
-e 's|__weston_libexecdir__|$(libexecdir)|g' \
-e 's|__weston_bindir__|$(bindir)|g' \
-e 's|__xserver_path__|$(XSERVER_PATH)|g' \
-e 's|__version__|$(PACKAGE_VERSION)|g'
SUFFIXES = .1 .5 .7 .man
......@@ -1582,6 +1607,10 @@ SUFFIXES = .1 .5 .7 .man
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
EXTRA_DIST += \
CONTRIBUTING.md \
README.md \
doc/wayland-screenshot.jpg \
doc/calibration-helper.bash \
man/weston.man \
man/weston-drm.man \
man/weston-rdp.man \
......
Weston
======
Weston is the reference implementation of a Wayland compositor, and a
useful compositor in its own right. Weston has various backends that
lets it run on Linux kernel modesetting and evdev input as well as
under X11. Weston ships with a few example clients, from simple
clients that demonstrate certain aspects of the protocol to more
complete clients and a simplistic toolkit. There is also a quite
capable terminal emulator (weston-terminal) and an toy/example desktop
shell. Finally, weston also provides integration with the Xorg server
and can pull X clients into the Wayland desktop and act as an X window
manager.
Refer to http://wayland.freedesktop.org/building.html for building
weston and its dependencies.
The test suite can be invoked via `make check`; see
http://wayland.freedesktop.org/testing.html for additional details.
Developer documentation can be built via `make doc`. Output will be in
the build root under
docs/developer/html/index.html
docs/tools/html/index.html
![screenshot of skeletal Weston desktop](doc/wayland-screenshot.jpg)
Weston is the reference implementation of a Wayland compositor, as well as a
useful environment in and of itself.
Out of the box, Weston provides a very basic desktop, or a full-featured
environment for non-desktop uses such as automotive, embedded, in-flight,
industrial, kiosks, set-top boxes and TVs. It also provides a library allowing
other projects to build their own full-featured environments on top of Weston's
core.
The core focus of Weston is correctness and reliability. Weston aims to be lean
and fast, but more importantly, to be predictable. Whilst Weston does have known
bugs and shortcomings, we avoid unknown or variable behaviour as much as
possible, including variable performance such as occasional spikes in frame
display time.
A small suite of example or demo clients are also provided: though they can be
useful in themselves, their main purpose is to be an example or test case for
others building compositors or clients.
If you are after a more mainline desktop experience, the
[GNOME](https://www.gnome.org) and [KDE](https://www.kde.org) projects provide
full-featured desktop environments built on the Wayland protocol. Many other
projects also exist providing Wayland clients and desktop environments: you are
not limited to just what you can find in Weston.
Reporting issues and contributing
=================================
Weston's development is
[hosted on freedesktop.org GitLab](https://gitlab.freedesktop.org/wayland/weston/).
Please also see [the contributing document](CONTRIBUTING.md), which details how
to make code or non-technical contributions to Weston.
Building Weston
===============
Weston is built using autotools, with `autogen.sh` and `make`. It often depends
on the current release versions of
[Wayland](https://gitlab.freedesktop.org/wayland/wayland) and
[wayland-protocols](https://cgit.freedesktop.org/wayland/wayland-protocols).
Every push to the Weston master repository and its forks is built using GitLab
CI. [Reading the configuration](.gitlab-ci.yml) may provide a useful example of
how to build and install Weston.
More [detailed documentation on building Weston](https://wayland.freedesktop.org/building.html)
is available on the Wayland site. There are also more details on
[how to run and write tests](https://wayland.freedesktop.org/testing.html).
Running Weston
==============
Once Weston is installed, most users can simply run it by typing `weston`. This
will launch Weston inside whatever environment you launch it from: when launched
from a text console, it will take over that console. When launched from inside
an existing Wayland or X11 session, it will start a 'nested' instance of Weston
inside a window in that session.
Help is available by running `weston --help`, or `man weston`, which will list
the available configuration options and display backends. It can also be
configured through a file on disk; more information on this can be found through
`man weston.ini`.
In some special cases, such as when running remotely or without logind's session
control, Weston may not be able to run directly from a text console. In these
situations, you can instead execute the `weston-launch` helper, which will gain
privileged access to input and output devices by running as root, then granting
access to the main Weston binary running as your user. Running Weston this way
is not recommended unless necessary.
Libweston
......
......@@ -1337,20 +1337,31 @@ output_remove(struct desktop *desktop, struct output *output)
}
if (rep) {
/* If found, hand over the background and panel so they don't
* get destroyed. */
assert(!rep->background);
assert(!rep->panel);
/* If found and it does not already have a background or panel,
* hand over the background and panel so they don't get
* destroyed.
*
* We never create multiple backgrounds or panels for clones,
* but if the compositor moves outputs, a pair of wl_outputs
* might become "clones". This may happen temporarily when
* an output is about to be removed and the rest are reflowed.
* In this case it is correct to let the background/panel be
* destroyed.
*/
if (!rep->background) {
rep->background = output->background;
output->background = NULL;
rep->background->owner = rep;
}
if (!rep->panel) {
rep->panel = output->panel;
output->panel = NULL;
if (rep->panel)
rep->panel->owner = rep;
}
}
output_destroy(output);
}
......
......@@ -343,10 +343,10 @@ nested_client_destroy(struct nested_client *client)
wl_compositor_destroy(client->compositor);
wl_registry_destroy(client->registry);
wl_display_flush(client->display);
wl_display_disconnect(client->display);
eglTerminate(client->egl_display);
eglReleaseThread();
wl_display_flush(client->display);
wl_display_disconnect(client->display);
}
int
......
......@@ -39,6 +39,7 @@
#include <signal.h>
#include <fcntl.h>
#include <getopt.h>
#include <errno.h>
#include <xf86drm.h>
......@@ -49,16 +50,21 @@
#ifdef HAVE_LIBDRM_FREEDRENO
#include <freedreno/freedreno_drmif.h>
#endif
#ifdef HAVE_LIBDRM_ETNAVIV
#include <etnaviv_drmif.h>
#endif
#include <drm_fourcc.h>
#include <wayland-client.h>
#include "shared/zalloc.h"
#include "shared/platform.h"
#include "xdg-shell-unstable-v6-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
extern const unsigned nv12_tiled[];
#ifndef DRM_FORMAT_MOD_LINEAR
#define DRM_FORMAT_MOD_LINEAR 0
#endif
struct buffer;
/* Possible options that affect the displayed image */
......@@ -76,9 +82,8 @@ struct display {
struct zwp_linux_dmabuf_v1 *dmabuf;
int xrgb8888_format_found;
int nv12_format_found;
int nv12_modifier_found;
uint64_t nv12_modifier;
int req_dmabuf_immediate;
int req_dmabuf_modifiers;
};
struct drm_device {
......@@ -108,6 +113,10 @@ struct buffer {
struct fd_device *fd_dev;
struct fd_bo *fd_bo;
#endif /* HAVE_LIBDRM_FREEDRENO */
#if HAVE_LIBDRM_ETNAVIV
struct etna_device *etna_dev;
struct etna_bo *etna_bo;
#endif /* HAVE_LIBDRM_ETNAVIV */
uint32_t gem_handle;
int dmabuf_fd;
......@@ -244,21 +253,14 @@ static int
fd_bo_export_to_prime(struct buffer *buf)
{
buf->dmabuf_fd = fd_bo_dmabuf(buf->fd_bo);
if (buf->dmabuf_fd > 0)
return 0;
return 1;
return buf->dmabuf_fd < 0;
}
static int
fd_map_bo(struct buffer *buf)
{
buf->mmap = fd_bo_map(buf->fd_bo);
if (buf->mmap != NULL)
return 1;
return 0;
return buf->mmap != NULL;
}
static void
......@@ -272,9 +274,59 @@ fd_device_destroy(struct buffer *buf)
fd_device_del(buf->fd_dev);
}
#endif /* HAVE_LIBDRM_FREEDRENO */
#ifdef HAVE_LIBDRM_ETNAVIV
static int
etna_alloc_bo(struct buffer *buf)
{
int flags = DRM_ETNA_GEM_CACHE_WC;
int size;
buf->stride = ALIGN(buf->width, 32) * buf->bpp / 8;
size = buf->stride * buf->height;
buf->etna_dev = etna_device_new(buf->drm_fd);
buf->etna_bo = etna_bo_new(buf->etna_dev, size, flags);
return buf->etna_bo != NULL;
}
static void
fill_content(struct buffer *my_buf)
etna_free_bo(struct buffer *buf)
{
etna_bo_del(buf->etna_bo);
}
static int
etna_bo_export_to_prime(struct buffer *buf)
{
buf->dmabuf_fd = etna_bo_dmabuf(buf->etna_bo);
return buf->dmabuf_fd < 0;
}
static int
etna_map_bo(struct buffer *buf)
{
buf->mmap = etna_bo_map(buf->etna_bo);
return buf->mmap != NULL;
}
static void
etna_unmap_bo(struct buffer *buf)
{
if (munmap(buf->mmap, buf->stride * buf->height) < 0)
fprintf(stderr, "Failed to unmap buffer: %s", strerror(errno));
buf->mmap = NULL;
}
static void
etna_device_destroy(struct buffer *buf)
{
etna_device_del(buf->etna_dev);
}
#endif /* HAVE_LIBDRM_ENTAVIV */
static void
fill_content(struct buffer *my_buf, uint64_t modifier)
{
int x = 0, y = 0;
uint32_t *pix;
......@@ -282,12 +334,32 @@ fill_content(struct buffer *my_buf)
assert(my_buf->mmap);
if (my_buf->format == DRM_FORMAT_NV12) {
if (modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) {
pix = (uint32_t *) my_buf->mmap;
for (y = 0; y < my_buf->height; y++)
memcpy(&pix[y * my_buf->width / 4],
&nv12_tiled[my_buf->width * y / 4],
my_buf->width);
}
else if (modifier == DRM_FORMAT_MOD_LINEAR) {
uint8_t *pix8;
/* first plane: Y (2/3 of the buffer) */
for (y = 0; y < my_buf->height * 2/3; y++) {
pix8 = my_buf->mmap + y * my_buf->stride;
for (x = 0; x < my_buf->width; x++)
*pix8++ = x % 0xff;
}
/* second plane (CbCr) is half the size of Y
plane (last 1/3 of the buffer) */
for (y = my_buf->height * 2/3; y < my_buf->height; y++) {
pix8 = my_buf->mmap + y * my_buf->stride;
for (x = 0; x < my_buf->width; x+=2) {
*pix8++ = x % 256;
*pix8++ = y % 256;
}
}
}
}
else {
for (y = 0; y < my_buf->height; y++) {
pix = (uint32_t *)(my_buf->mmap + y * my_buf->stride);
......@@ -339,6 +411,16 @@ drm_device_init(struct buffer *buf)
dev->unmap_bo = fd_unmap_bo;
dev->device_destroy = fd_device_destroy;
}
#endif
#ifdef HAVE_LIBDRM_ETNAVIV
else if (!strcmp(dev->name, "etnaviv")) {
dev->alloc_bo = etna_alloc_bo;
dev->free_bo = etna_free_bo;
dev->export_bo_to_prime = etna_bo_export_to_prime;
dev->map_bo = etna_map_bo;
dev->unmap_bo = etna_unmap_bo;
dev->device_destroy = etna_device_destroy;
}
#endif
else {
fprintf(stderr, "Error: drm device %s unsupported.\n",
......@@ -421,7 +503,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer,
/* adjust height for allocation of NV12 Y and UV planes */
buffer->height = height * 3 / 2;
buffer->bpp = 8;
modifier = DRM_FORMAT_MOD_SAMSUNG_64_32_TILE;
modifier = display->nv12_modifier;
break;
default:
buffer->height = height;
......@@ -438,7 +520,7 @@ create_dmabuf_buffer(struct display *display, struct buffer *buffer,
fprintf(stderr, "map_bo failed\n");
goto error2;
}
fill_content(buffer);
fill_content(buffer, modifier);
drm_dev->unmap_bo(buffer);
if (drm_dev->export_bo_to_prime(buffer) != 0) {
......@@ -686,10 +768,13 @@ dmabuf_modifiers(void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
d->xrgb8888_format_found = 1;
break;
case DRM_FORMAT_NV12:
switch (modifier) {
case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE:
case DRM_FORMAT_MOD_LINEAR:
d->nv12_format_found = 1;
if (modifier == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE)
d->nv12_modifier_found = 1;
d->nv12_modifier = modifier;
break;
}
default:
break;
}
......@@ -734,16 +819,10 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->fshell = wl_registry_bind(registry,
id, &zwp_fullscreen_shell_v1_interface, 1);
} else if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0) {
int ver;
if (d->req_dmabuf_modifiers)
ver = 3;
else if (d->req_dmabuf_immediate)
ver = 2;
else
ver = 1;
if (version < 3)
return;
d->dmabuf = wl_registry_bind(registry,
id, &zwp_linux_dmabuf_v1_interface,
ver);
id, &zwp_linux_dmabuf_v1_interface, 3);
zwp_linux_dmabuf_v1_add_listener(d->dmabuf, &dmabuf_listener, d);
}
}
......@@ -763,27 +842,16 @@ static struct display *
create_display(int opts, int format)
{
struct display *display;
const char *extensions;
display = malloc(sizeof *display);
if (display == NULL) {
fprintf(stderr, "out of memory\n");
exit(1);
return NULL;
}
display->display = wl_display_connect(NULL);
assert(display->display);
display->req_dmabuf_immediate = opts & OPT_IMMEDIATE;
display->req_dmabuf_modifiers = (format == DRM_FORMAT_NV12);
/*
* hard code format if the platform egl doesn't support format
* querying / advertising.
*/
extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (extensions && !weston_check_egl_extension(extensions,
"EGL_EXT_image_dma_buf_import_modifiers"))
display->xrgb8888_format_found = 1;
display->registry = wl_display_get_registry(display->display);
wl_registry_add_listener(display->registry,
......@@ -791,18 +859,16 @@ create_display(int opts, int format)
wl_display_roundtrip(display->display);
if (display->dmabuf == NULL) {
fprintf(stderr, "No zwp_linux_dmabuf global\n");
exit(1);
return NULL;
}
wl_display_roundtrip(display->display);
if ((format == DRM_FORMAT_XRGB8888 && !display->xrgb8888_format_found) ||
(format == DRM_FORMAT_NV12 && (!display->nv12_format_found ||
!display->nv12_modifier_found))) {
(format == DRM_FORMAT_NV12 && !display->nv12_format_found)) {
fprintf(stderr, "requested format is not available\n");
exit(1);
return NULL;
}
return display;
}
......@@ -842,7 +908,7 @@ print_usage_and_exit(void)
"\t'--y-inverted=<>'\n\t\t0 to not pass Y_INVERTED flag,"
"\n\t\t1 to pass Y_INVERTED flag\n"
"\t'--import-format=<>'\n\t\tXRGB to import dmabuf as XRGB8888,"
"\n\t\tNV12 to import as multi plane NV12 with tiling modifier\n");
"\n\t\tNV12 to import as multi plane NV12\n");
exit(0);
}
......@@ -910,6 +976,8 @@ main(int argc, char **argv)
}
display = create_display(opts, import_format);
if (!display)
return 1;
window = create_window(display, 256, 256, import_format, opts);
if (!window)
return 1;
......
This diff is collapsed.
This diff is collapsed.
......@@ -286,6 +286,7 @@ struct window {
confined_pointer_unconfined_handler_t pointer_unconfined_handler;
struct zwp_confined_pointer_v1 *confined_pointer;
struct input *confined_input;
struct widget *confined_widget;
bool confined;
......@@ -4219,7 +4220,7 @@ window_get_shadow_margin(struct window *window)
return 0;
}
static void
void
window_inhibit_redraw(struct window *window)
{
window->redraw_inhibited = 1;
......@@ -4228,7 +4229,7 @@ window_inhibit_redraw(struct window *window)
window->redraw_task_scheduled = 0;
}
static void
void
window_uninhibit_redraw(struct window *window)
{
window->redraw_inhibited = 0;
......@@ -4788,8 +4789,8 @@ static void
locked_pointer_locked(void *data,
struct zwp_locked_pointer_v1 *locked_pointer)
{
struct input *input = data;
struct window *window = input->pointer_focus;
struct window *window = data;
struct input *input = window->locked_input;
window->pointer_locked = true;
......@@ -4804,8 +4805,8 @@ static void
locked_pointer_unlocked(void *data,
struct zwp_locked_pointer_v1 *locked_pointer)
{
struct input *input = data;
struct window *window = input->pointer_focus;
struct window *window = data;
struct input *input = window->locked_input;
window_unlock_pointer(window);
......@@ -4860,7 +4861,7 @@ window_lock_pointer(struct window *window, struct input *input)
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
zwp_locked_pointer_v1_add_listener(locked_pointer,
&locked_pointer_listener,
input);
window);
window->locked_input = input;
window->locked_pointer = locked_pointer;
......@@ -4902,8 +4903,8 @@ static void
confined_pointer_confined(void *data,
struct zwp_confined_pointer_v1 *confined_pointer)
{
struct input *input = data;
struct window *window = input->pointer_focus;
struct window *window = data;
struct input *input = window->confined_input;
window->confined = true;
......@@ -4918,8 +4919,8 @@ static void
confined_pointer_unconfined(void *data,
struct zwp_confined_pointer_v1 *confined_pointer)
{
struct input *input = data;
struct window *window = input->pointer_focus;
struct window *window = data;
struct input *input = window->confined_input;
window_unconfine_pointer(window);
......@@ -4984,8 +4985,9 @@ window_confine_pointer_to_rectangles(struct window *window,
zwp_confined_pointer_v1_add_listener(confined_pointer,
&confined_pointer_listener,
input);
window);
window->confined_input = input;
window->confined_pointer = confined_pointer;
window->confined_widget = NULL;
......@@ -5046,6 +5048,7 @@ window_unconfine_pointer(struct window *window)
zwp_confined_pointer_v1_destroy(window->confined_pointer);
window->confined_pointer = NULL;
window->confined = false;
window->confined_input = NULL;
}
static void
......
......@@ -604,6 +604,10 @@ widget_set_axis_handlers(struct widget *widget,
widget_axis_stop_handler_t axis_stop_handler,
widget_axis_discrete_handler_t axis_discrete_handler);
void
window_inhibit_redraw(struct window *window);
void
window_uninhibit_redraw(struct window *window);
void
widget_schedule_redraw(struct widget *widget);
void
......
......@@ -102,22 +102,33 @@ edid_value_valid(const char *str)
static gchar *
get_output_id(struct cms_colord *cms, struct weston_output *o)
{
struct weston_head *head;
const gchar *tmp;
GString *device_id;
/* XXX: What to do with multiple heads?
* This is potentially unstable, if head configuration is changed
* while the output is enabled. */
head = weston_output_get_first_head(o);
if (wl_list_length(&o->head_list) > 1) {
weston_log("colord: WARNING: multiple heads are not supported (output %s).\n",
o->name);
}
/* see https://github.com/hughsie/colord/blob/master/doc/device-and-profile-naming-spec.txt
* for format and allowed values */
device_id = g_string_new("xrandr");
if (edid_value_valid(o->make)) {
tmp = g_hash_table_lookup(cms->pnp_ids, o->make);
if (edid_value_valid(head->make)) {
tmp = g_hash_table_lookup(cms->pnp_ids, head->make);
if (tmp == NULL)
tmp = o->make;
tmp = head->make;
g_string_append_printf(device_id, "-%s", tmp);
}
if (edid_value_valid(o->model))
g_string_append_printf(device_id, "-%s", o->model);
if (edid_value_valid(o->serial_number))
g_string_append_printf(device_id, "-%s", o->serial_number);
if (edid_value_valid(head->model))
g_string_append_printf(device_id, "-%s", head->model);
if (edid_value_valid(head->serial_number))
g_string_append_printf(device_id, "-%s", head->serial_number);
/* no EDID data, so use fallback */
if (strcmp(device_id->str, "xrandr") == 0)
......@@ -230,6 +241,7 @@ colord_notifier_output_destroy(struct wl_listener *listener, void *data)
static void
colord_output_created(struct cms_colord *cms, struct weston_output *o)
{
struct weston_head *head;
CdDevice *device;
const gchar *tmp;
gchar *device_id;
......@@ -237,6 +249,9 @@ colord_output_created(struct cms_colord *cms, struct weston_output *o)
GHashTable *device_props;
struct cms_output *ocms;
/* XXX: What to do with multiple heads? */
head = weston_output_get_first_head(o);
/* create device */
device_id = get_output_id(cms, o);
weston_log("colord: output added %s\n", device_id);
......@@ -251,25 +266,25 @@ colord_output_created(struct cms_colord *cms, struct weston_output *o)
g_hash_table_insert (device_props,
g_strdup(CD_DEVICE_PROPERTY_COLORSPACE),
g_strdup(cd_colorspace_to_string(CD_COLORSPACE_RGB)));
if (edid_value_valid(o->make)) {
tmp = g_hash_table_lookup(cms->pnp_ids, o->make);
if (edid_value_valid(head->make)) {
tmp = g_hash_table_lookup(cms->pnp_ids, head->make);
if (tmp == NULL)
tmp = o->make;
tmp = head->make;
g_hash_table_insert (device_props,
g_strdup(CD_DEVICE_PROPERTY_VENDOR),
g_strdup(tmp));
}
if (edid_value_valid(o->model)) {
if (edid_value_valid(head->model)) {
g_hash_table_insert (device_props,
g_strdup(CD_DEVICE_PROPERTY_MODEL),
g_strdup(o->model));
g_strdup(head->model));
}
if (edid_value_valid(o->serial_number)) {
if (edid_value_valid(head->serial_number)) {
g_hash_table_insert (device_props,
g_strdup(CD_DEVICE_PROPERTY_SERIAL),
g_strdup(o->serial_number));
g_strdup(head->serial_number));
}
if (o->connection_internal) {
if (head->connection_internal) {
g_hash_table_insert (device_props,
g_strdup (CD_DEVICE_PROPERTY_EMBEDDED),
NULL);
......
This diff is collapsed.
......@@ -452,6 +452,7 @@ text_input_manager_notifier_destroy(struct wl_listener *listener, void *data)
struct text_input_manager,
destroy_listener);
wl_list_remove(&text_input_manager->destroy_listener.link);
wl_global_destroy(text_input_manager->text_input_manager_global);
free(text_input_manager);
......@@ -679,9 +680,7 @@ input_method_context_grab_keyboard(struct wl_client *client,
context->keyboard = cr;
wl_keyboard_send_keymap(cr, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
keyboard->xkb_info->keymap_fd,
keyboard->xkb_info->keymap_size);
weston_keyboard_send_keymap(keyboard, cr);
if (keyboard->grab != &keyboard->default_grab) {
weston_keyboard_end_grab(keyboard);
......@@ -1047,14 +1046,10 @@ text_backend_configuration(struct text_backend *text_backend)
struct weston_config *config = wet_get_config(text_backend->compositor);
struct weston_config_section *section;
char *client;
int ret;
section = weston_config_get_section(config,
"input-method", NULL, NULL);
ret = asprintf(&client, "%s/weston-keyboard",
weston_config_get_libexec_dir());
if (ret < 0)
client = NULL;
client = wet_get_binary_path("weston-keyboard");
weston_config_section_get_string(section, "path",
&text_backend->input_method.path,
client);
......@@ -1064,6 +1059,8 @@ text_backend_configuration(struct text_backend *text_backend)
WL_EXPORT void
text_backend_destroy(struct text_backend *text_backend)
{
wl_list_remove(&text_backend->seat_created_listener.link);
if (text_backend->input_method.client) {
/* disable respawn */
wl_list_remove(&text_backend->client_listener.link);
......
......@@ -66,7 +66,7 @@ screenshooter_shoot(struct wl_client *client,
struct wl_resource *buffer_resource)
{
struct weston_output *output =
weston_output_from_resource(output_resource);
weston_head_from_resource(output_resource)->output;
struct weston_buffer *buffer =
weston_buffer_from_resource(buffer_resource);
......@@ -117,12 +117,10 @@ screenshooter_binding(struct weston_keyboard *keyboard,
{
struct screenshooter *shooter = data;
char *screenshooter_exe;
int ret;
ret = asprintf(&screenshooter_exe, "%s/%s",
weston_config_get_libexec_dir(),
"/weston-screenshooter");
if (ret < 0) {
screenshooter_exe = wet_get_binary_path("weston-screenshooter");
if (!screenshooter_exe) {
weston_log("Could not construct screenshooter path.\n");
return;
}
......@@ -164,6 +162,8 @@ screenshooter_destroy(struct wl_listener *listener, void *data)
struct screenshooter *shooter =
container_of(listener, struct screenshooter, destroy_listener);
wl_list_remove(&shooter->destroy_listener.link);
wl_global_destroy(shooter->global);
free(shooter);
}
......
......@@ -77,6 +77,9 @@ int
module_init(struct weston_compositor *compositor,
int *argc, char *argv[]);
char *
wet_get_binary_path(const char *name);
int
wet_load_xwayland(struct weston_compositor *comp);
......
m4_define([weston_major_version], [4])
m4_define([weston_major_version], [5])
m4_define([weston_minor_version], [0])
m4_define([weston_micro_version], [0])
m4_define([weston_version],
[weston_major_version.weston_minor_version.weston_micro_version])
m4_define([libweston_major_version], [4])
m4_define([libweston_major_version], [5])
m4_define([libweston_minor_version], [0])
m4_define([libweston_patch_version], [0])
AC_PREREQ([2.64])
AC_INIT([weston],
[weston_version],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=weston_version],
[https://gitlab.freedesktop.org/wayland/weston/issues/],
[weston],
[http://wayland.freedesktop.org])
[https://wayland.freedesktop.org])
WAYLAND_PREREQ_VERSION="1.12.0"
......@@ -113,7 +113,7 @@ AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
# check for libdrm as a build-time dependency only
# libdrm 2.4.30 introduced drm_fourcc.h.
PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.30], [], [AC_MSG_ERROR([
PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.68], [], [AC_MSG_ERROR([
libdrm is a hard build-time dependency for libweston core,
but a sufficient version was not found. However, libdrm
is not a runtime dependency unless you have features
......@@ -206,12 +206,21 @@ AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes)
if test x$enable_drm_compositor = xyes; then
AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
PKG_CHECK_MODULES(DRM_COMPOSITOR_MODIFIERS, [libdrm >= 2.4.71],
[AC_DEFINE([HAVE_DRM_ADDFB2_MODIFIERS], 1, [libdrm supports modifiers])],
[AC_MSG_WARN([libdrm does not support AddFB2 with modifiers])])
PKG_CHECK_MODULES(DRM_COMPOSITOR_ATOMIC, [libdrm >= 2.4.78],
[AC_DEFINE([HAVE_DRM_ATOMIC], 1, [libdrm supports atomic API])],
[AC_MSG_WARN([libdrm does not support atomic modesetting, will omit that capability])])
PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM, [gbm >= 10.2],
[AC_DEFINE([HAVE_GBM_FD_IMPORT], 1, [gbm supports dmabuf import])],
[AC_MSG_WARN([gbm does not support dmabuf import, will omit that capability])])
PKG_CHECK_MODULES(DRM_COMPOSITOR_FORMATS_BLOB, [libdrm >= 2.4.83],
[AC_DEFINE([HAVE_DRM_FORMATS_BLOB], 1, [libdrm supports modifier advertisement])],
[AC_MSG_WARN([libdrm does not support modifier advertisement])])
PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM_MODIFIERS, [gbm >= 17.1],
[AC_DEFINE([HAVE_GBM_MODIFIERS], 1, [GBM supports modifiers])],
[AC_MSG_WARN([GBM does not support modifiers])])
PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM, [gbm >= 17.2],
[AC_DEFINE([HAVE_GBM_FD_IMPORT], 1, [gbm supports import with modifiers])],
[AC_MSG_WARN([GBM does not support dmabuf import, will omit that capability])])
fi
......@@ -264,10 +273,17 @@ if test x$enable_rdp_compositor = xyes; then
[],
[PKG_CHECK_MODULES(RDP_COMPOSITOR, [freerdp >= 1.1.0],[])]
)
SAVED_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $RDP_COMPOSITOR_CFLAGS"
AC_CHECK_HEADERS([freerdp/version.h])
AC_CHECK_MEMBER([SURFACE_BITS_COMMAND.bmp],
[AC_DEFINE([HAVE_SURFACE_BITS_BMP], [1], [SURFACE_BITS_CMD has bmp field])],
[],
[[#include <freerdp/update.h>]]
)
CPPFLAGS="$SAVED_CPPFLAGS"
fi
......@@ -384,7 +400,7 @@ AC_ARG_ENABLE(simple-dmabuf-drm-client,
[do not build the simple dmabuf drm client]),,
enable_simple_dmabuf_drm_client="auto")
if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then
PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm egl], [have_simple_dmabuf_libs=yes],
PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm], [have_simple_dmabuf_libs=yes],
[have_simple_dmabuf_libs=no])
PKG_CHECK_MODULES(LIBDRM_PLATFORM_FREEDRENO, [libdrm_freedreno],
......@@ -393,11 +409,14 @@ if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then
PKG_CHECK_MODULES(LIBDRM_PLATFORM_INTEL, [libdrm_intel],
AC_DEFINE([HAVE_LIBDRM_INTEL], [1], [Build intel dmabuf client]) have_simple_dmabuf_drm_client=yes,
[true])
PKG_CHECK_MODULES(LIBDRM_PLATFORM_ETNAVIV, [libdrm_etnaviv],
AC_DEFINE([HAVE_LIBDRM_ETNAVIV], [1], [Build etnaviv dmabuf client]) have_simple_dmabuf_drm_client=yes,
[true])
if test "x$have_simple_dmabuf_drm_client" != "xyes" -o \
"x$have_simple_dmabuf_libs" = "xno" && \
test "x$enable_simple_dmabuf_drm_client" = "xyes"; then
AC_MSG_ERROR([DRM dmabuf client explicitly enabled, but libdrm_intel or libdrm_freedreno not found])
AC_MSG_ERROR([DRM dmabuf client explicitly enabled, but none of libdrm_{intel,freedreno,etnaviv} found])
fi
if test "x$have_simple_dmabuf_drm_client" = "xyes" -a "x$have_simple_dmabuf_libs" = "xyes"; then
......
......@@ -270,11 +270,13 @@ input_panel_surface_set_toplevel(struct wl_client *client,
struct input_panel_surface *input_panel_surface =
wl_resource_get_user_data(resource);
struct desktop_shell *shell = input_panel_surface->shell;
struct weston_head *head;
wl_list_insert(&shell->input_panel.surfaces,
&input_panel_surface->link);
input_panel_surface->output = weston_output_from_resource(output_resource);
head = weston_head_from_resource(output_resource);
input_panel_surface->output = head->output;
input_panel_surface->panel = 0;
}
......
......@@ -47,10 +47,6 @@
#define DEFAULT_NUM_WORKSPACES 1
#define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200
#ifndef static_assert
#define static_assert(cond, msg)
#endif
struct focus_state {
struct desktop_shell *shell;
struct weston_seat *seat;
......@@ -128,6 +124,7 @@ struct shell_surface {
struct weston_output *fullscreen_output;
struct weston_output *output;
struct wl_listener output_destroy_listener;
struct surface_state {
bool fullscreen;
......@@ -341,6 +338,15 @@ get_output_work_area(struct desktop_shell *shell,
{
int32_t panel_width = 0, panel_height = 0;
if (!output) {
area->x = 0;
area->y = 0;
area->width = 0;
area->height = 0;
return;
}
area->x = output->x;
area->y = output->y;
......@@ -458,17 +464,12 @@ shell_configuration(struct desktop_shell *shell)
{
struct weston_config_section *section;
char *s, *client;
int ret;
int allow_zap;
section = weston_config_get_section(wet_get_config(shell->compositor),
"shell", NULL, NULL);
ret = asprintf(&client, "%s/%s", weston_config_get_libexec_dir(),
WESTON_SHELL_CLIENT);
if (ret < 0)
client = NULL;
weston_config_section_get_string(section,
"client", &s, client);
client = wet_get_binary_path(WESTON_SHELL_CLIENT);
weston_config_section_get_string(section, "client", &s, client);
free(client);
shell->client = s;
......@@ -580,7 +581,7 @@ create_focus_surface(struct weston_compositor *ec,
free(fsurf);
return NULL;
}
fsurf->view->output = output;
weston_view_set_output(fsurf->view, output);
fsurf->view->is_mapped = true;
weston_surface_set_size(surface, output->width, output->height);
......@@ -1933,6 +1934,17 @@ shell_surface_update_layer(struct shell_surface *shsurf)
shell_surface_update_child_surface_layers(shsurf);
}
static void
notify_output_destroy(struct wl_listener *listener, void *data)
{
struct shell_surface *shsurf =
container_of(listener,
struct shell_surface, output_destroy_listener);
shsurf->output = NULL;
shsurf->output_destroy_listener.notify = NULL;
}
static void
shell_surface_set_output(struct shell_surface *shsurf,
struct weston_output *output)
......@@ -1948,6 +1960,18 @@ shell_surface_set_output(struct shell_surface *shsurf,
shsurf->output = es->output;
else
shsurf->output = get_default_output(es->compositor);
if (shsurf->output_destroy_listener.notify) {
wl_list_remove(&shsurf->output_destroy_listener.link);
shsurf->output_destroy_listener.notify = NULL;
}
if (!shsurf->output)
return;
shsurf->output_destroy_listener.notify = notify_output_destroy;
wl_signal_add(&shsurf->output->destroy_signal,
&shsurf->output_destroy_listener);
}
static void
......@@ -1986,7 +2010,7 @@ unset_maximized(struct shell_surface *shsurf)
weston_desktop_surface_get_surface(shsurf->desktop_surface);
/* undo all maximized things here */
shsurf->output = get_default_output(surface->compositor);
shell_surface_set_output(shsurf, get_default_output(surface->compositor));
if (shsurf->saved_position_valid)
weston_view_set_position(shsurf->view,
......@@ -2143,6 +2167,13 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
weston_layer_entry_insert(&shsurf->shell->fullscreen_layer.view_list,
&shsurf->view->layer_link);
if (!shsurf->fullscreen_output) {
/* If there is no output, there's not much we can do.
* Position the window somewhere, whatever. */
weston_view_set_position(shsurf->view, 0, 0);
return;
}
shell_ensure_fullscreen_black_view(shsurf);
surface_subsurfaces_boundingbox(surface, &surf_x, &surf_y,
......@@ -2279,6 +2310,12 @@ fade_out_done_idle_cb(void *data)
struct shell_surface *shsurf = data;
weston_surface_destroy(shsurf->view->surface);
if (shsurf->output_destroy_listener.notify) {
wl_list_remove(&shsurf->output_destroy_listener.link);
shsurf->output_destroy_listener.notify = NULL;
}
free(shsurf);
}
......@@ -2348,7 +2385,8 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface,
shsurf->fullscreen.black_view = NULL;
wl_list_init(&shsurf->fullscreen.transform.link);
shsurf->output = get_default_output(shsurf->shell->compositor);
shell_surface_set_output(
shsurf, get_default_output(shsurf->shell->compositor));
wl_signal_init(&shsurf->destroy_signal);
......@@ -2395,6 +2433,12 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
fade_out_done, shsurf);
} else {
weston_view_destroy(shsurf->view);
if (shsurf->output_destroy_listener.notify) {
wl_list_remove(&shsurf->output_destroy_listener.link);
shsurf->output_destroy_listener.notify = NULL;
}
free(shsurf);
}
}
......@@ -2464,7 +2508,7 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf,
shsurf->view->is_mapped = true;
if (shsurf->state.maximized) {
surface->output = shsurf->output;
shsurf->view->output = shsurf->output;
weston_view_set_output(shsurf->view, shsurf->output);
}
if (!shell->locked) {
......@@ -2881,6 +2925,9 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer, int x,
{
struct weston_view *v, *next;
if (!ev->output)
return;
wl_list_for_each_safe(v, next, &layer->view_list.link, layer_link.link) {
if (v->output == ev->output && v != ev) {
weston_view_unmap(v);
......@@ -2969,8 +3016,8 @@ desktop_shell_set_background(struct wl_client *client,
surface->committed = background_committed;
surface->committed_private = shell;
weston_surface_set_label_func(surface, background_get_label);
surface->output = weston_output_from_resource(output_resource);
view->output = surface->output;
surface->output = weston_head_from_resource(output_resource)->output;
weston_view_set_output(view, surface->output);
sh_output = find_shell_output_from_weston_output(shell, surface->output);
if (sh_output->background_surface) {
......@@ -3066,8 +3113,8 @@ desktop_shell_set_panel(struct wl_client *client,
surface->committed = panel_committed;
surface->committed_private = shell;
weston_surface_set_label_func(surface, panel_get_label);
surface->output = weston_output_from_resource(output_resource);
view->output = surface->output;
surface->output = weston_head_from_resource(output_resource)->output;
weston_view_set_output(view, surface->output);
sh_output = find_shell_output_from_weston_output(shell, surface->output);
if (sh_output->panel_surface) {
......@@ -3726,6 +3773,7 @@ activate(struct desktop_shell *shell, struct weston_view *view,
/* Only demote fullscreen surfaces on the output of activated shsurf.
* Leave fullscreen surfaces on unrelated outputs alone. */
if (shsurf->output)
lower_fullscreen_layer(shell, shsurf->output);
weston_view_activate(view, seat, flags);
......@@ -4141,6 +4189,11 @@ center_on_output(struct weston_view *view, struct weston_output *output)
int32_t surf_x, surf_y, width, height;
float x, y;
if (!output) {
weston_view_set_position(view, 0, 0);
return;
}
surface_subsurfaces_boundingbox(view->surface, &surf_x, &surf_y, &width, &height);
x = output->x + (output->width - width) / 2 - surf_x / 2;
......@@ -4858,6 +4911,7 @@ shell_destroy(struct wl_listener *listener, void *data)
wl_client_destroy(shell->child.client);
}
wl_list_remove(&shell->destroy_listener.link);
wl_list_remove(&shell->idle_listener.link);
wl_list_remove(&shell->wake_listener.link);
wl_list_remove(&shell->transform_listener.link);
......