Commit Graph

764 Commits

Author SHA1 Message Date
Daniel Stone df2095fa35 gl-renderer: Support EGL_KHR_partial_update
partial_update is an EGL extension which allows us to inform the driver
ahead of time the limits of the areas we'll be writing to. This helps
performance for GPU hardware which renders into a local tile buffer:
informing the driver of the rendering extents means it can avoid
fetching unchanged tiles into the tile buffer and subsequently writing
them out.

The extension complements rather than replaces EGL_EXT_buffer_age (used
before partial_update to know which areas we need to update) and
EGL_KHR_swap_buffers_with_damage (used after partial_update to inform
the winsys of the changed region).

Note however that partial_update deals in buffer-damage regions ('what
has changed since the last time I used _this_ buffer?'), whereas
swap_buffers_with_damage deals in surface-damage regions ('what has
changed since the last time I rendered?'). An explanatory diagram can be
found in the specification:
https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_partial_update.txt

Fixes: #134

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone 0a86a81cc2 gl-renderer: Add EGL_EXT_partial_update query
Query for the extension itself and the core entrypoint.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone f1cecef2f8 gl-renderer: Demystify output repaint slightly
Add some comments in the function to make it clear what's going on,
especially as we twist and turn between a lot of things called 'damage'
meaning different things in different co-ordinate spaces.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone 30f5863756 gl-renderer: Rename buffer_damage variable
The buffer_damage variable stores accumulated damage from previous
frames. This is the area that, before considering our current repaint
request, we need to repaint in order to bring the older buffer up to
date with the last buffer we rendered into.

Rename to previous_damage so it's a bit more clear what this refers to.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone dad2f4046d gl-renderer: Rename border_damage variable
Technically it is storing which areas of the border are damaged.
However, we already have damage-region variables which need to be
translated by the border region. Rename the variable to not contain the
word 'damage' to reduce confusion.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone 55bcb93fef gl-renderer: Use helper for conversion to EGL rects
eglSwapBuffersWithDamage has to convert a damage region from Weston's
global co-ordinate space, into the co-ordinate space for EGL rendering
into a buffer for that output.

The conversion from the global co-ordinate space in logical pixels to
the output space in buffer pixels is slightly long and error-prone,
involving translating by the output's offset within the global
co-ordinate space, multiplying by output scale, and also translating to
allow for any borders we paint around the output.

After this is done, we need to flip the co-ordinates in the Y axis to
account for the lower-left-origin co-ordinate space used by EGL.

Since we want to reuse this for partial_update, but using a different
source region, extract this conversion into a well-commented helper we
can reuse.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone a7722ee92a gl-renderer: Don't use swap_buffers_with_damage with fan debug
Fan debug mode repaints the whole surface in order to clear any 'trails'
left over from previous fan paints. If this happens, fall back to using
regular eglSwapBuffers rather than eglSwapBuffersWithDamageEXT, since
the damage region we would pass will be too small.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone 8e3c8c4b88 gl-renderer: Convert remaining pseudo-bools to real bool
Use the actual boolean type instead of an integer for variables which
only hold true or false.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone d83c1eca92 gl-renderer: Convert extension pseudo-bools to real bool
Use the actual boolean type instead of an integer for variables which
only hold true or false.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:28:03 +01:00
Daniel Stone bc4ccc2085 pixel-formats: Remove duplicate doc string
pixel_format_get_info() is already documented in the headers; no need to
also document it next to the code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-26 12:27:14 +01:00
Marius Vlad 9fdda7f5eb libweston: Add ingroup tag for weston_compositor
This is a continuation of "e2cc7aa40fd: libweston: Define head, output and
compositor group".

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad 55d8736ed1 libweston: Add ingroup tag for weston_output
This is a continuation of "e2cc7aa40fd: libweston: Define head, output and
compositor group".

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad 78984ee971 libweston: Define head, output and compositor group
Also, add tag symbols related to 'weston_head'.

The bridge between sphinx and doxygen (breathe) has a useful directive:
doxygengroup. By using it we can scoop out symbols we'd like to display
documentation from/of.

At the same time some bits of the code has been using '\memberof' (a
doxygen command useful in C code to establish class like
relationship between objects and functions) but this seems not to be
recognized by the sphinx bridge.

Until we find a better solution, we replace '\memberof' command with
'\ingroup' one as to tag the symbols with an "object". This patch does
that for 'weston_head' object.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad eeabe17e7c pixel-formats: Fix doxygen warnings about missing format
We already have documentation in header which conflicts with the one
the source code. Remove it entirely as it confuses user as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Marius Vlad a2dace23ae libweston: Fix/clean-up doxygen warnings
This fixes warnings for weston-debug, input, compositor, log and
linux-explicit-sync. Warnings range from swapping '[in]', '[out]' with
the function arguments to wrong parameter names.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-06-25 14:05:54 +00:00
Daniel Stone 31838bf17e compositor-drm: Remove legacy plane and vblank usage
As of the previous commit, we never create state which uses overlay
planes on non-atomic drivers. We can thus remove the calls to
drmModeSetPlane.

The only time we ever waited for vblank events was when we had called
drmModeSetPlane and needed to make sure we waited until it was active.
We can thus also remove all the vblank event machinery.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-25 14:00:57 +01:00
Daniel Stone 87fab1ca4e compositor-drm: Only assign planes with atomic
Without atomic modesetting, we have no way to know whether or not our
desired configuration is usable. It might fail for a number of reasons:
scaling limits, bandwidth limits, global resource (e.g. decompression)
unit contention, or really just anything.

Not only this, but there is no good way to ensure that our configuration
actually lands together in the same refresh cycle - hence the 'atomic'
in atomic modesetting. Some drivers implement a synchronously blocking
drmModeSetPlane, whereas others return immediately. Using overlay planes
can thus decimate your framerate.

The pre-atomic API is not extensible either, so we need numerous out
clauses: fail if we're cropping or scaling (sometimes), or changing
formats, or fencing, or ...

Now we've had atomic support stable for a couple of releases, just
remove support for doing anything more fancy than displaying our
composited output and a cursor with drivers which don't support atomic
modesetting.

Support for using overlay planes was already disabled by default when
using the legacy API, and required a debug key combination to toggle it
on by flipping the sprites_are_broken variable. We can ensure that we
never try to use it on legacy by simply ignoring the hotkey when in
legacy mode.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-25 14:00:57 +01:00
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
Stefan Agner d93c0f7059 backend-rdp: fix memory leak
Free command data after all rects have been updated. This fixes a
rather huge memory leak when using the RDP backend.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2019-06-20 09:04:12 +02:00
Robert Beckett 8d23ab78bd backend-drm: handle multiple drm nodes with logind
When using logind launcher, we receive a PauseDevice "gone" message
from logind session management for each device we close while looking
for KMS devices.

Make logind notify the backend of the device add/remove so that the
backend can decide what to do, instead of assuming that if it is a
DRM_MAJOR device the session should be (de)activated. The backend can
then react to its specific device.

Fixes #251

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
2019-06-13 18:40:56 +01:00
Tomohito Esaki 68d49d772c compositor-drm: run finish_frame when dpms is turned off in update_complete
A output repaint loop isn't scheduled beacuse the output repaint_status
is AWAITING_COMPLETION when dmps is turned off in update_complete().
Therefore, the display attached to the output is remain inactive even if
weston wakes up. By going through finish_frame, the output
repaint_status is fixed to correct status.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2019-06-13 10:13:59 +00:00
Daniel Stone 82c8ca1628 dbus: Don't return value from void function
Just discard the value, rather than trying to return a value from a void
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-06-11 11:31:04 +01:00
Pekka Paalanen c8acc5f23d backend-fbdev: more into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 526b85401e backend-x11: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 4f1573e48e backend-wayland: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen b70ee941b5 backend-rdp: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 8059d317a5 backend-headless: move into new subdir
For consistency with other backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen f0f37bcaa1 backend-drm: move into new subdir
Move the DRM-backend into a new sub-directory to make it stand out from
libweston core. This facilitates splitting drm.c into more files later.

vaapi-recorder is used only by DRM-backend, move that too.

libbacklight is used only by DRM-backend and a manual test program, and is
moved as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen 6bc50b12f8 build: make backlight a helper lib
Right now only used by the DRM-backend, but there is a test program that should
use this as well.

This helps with building the test program and moving DRM-backend into a
subdirectory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Pekka Paalanen b40e051858 build: make libinput-backend a helper lib
Rather than having fbdev and drm backends include the libinput files ad hoc,
wrap them in a static library. Using the dependency object for that helper
library will then automatically pull in any necerray include dirs for the
users.

This helps with moving the backends into subdirectories.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-16 13:32:34 +01:00
Marius Vlad 4e53814180 build: libweston doesn't need -export-dynamic
According to https://gitlab.freedesktop.org/wayland/weston/merge_requests/159#note_148104
it doesn't make sense to use export-dynamic on libraries.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-05-14 17:29:57 +03: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 6f098663c0 weston-debug: Remove weston_compositor from weston_log_context
This is no longer needed. Also assert if the context passed is NULL and
compositor log context is already set.

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
Marius Vlad 38c66ccb21 weston-launch: Fix warning on error() not being avaiable due to removal of header
Commit a1450a8a7 removed errno header but forgot to remove all error()
calls.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-04-22 17:24:52 +03:00
Randy Li a1450a8a71 make error() portable
error() is not posix but gnu extension so may not be available on all
kind of systemsi e.g. musl.

Signed-off-by: Randy 'ayaka' Li <ayaka@soulik.info>
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2019-04-22 10:46:42 +00:00
Harish Krupo 737ac0d4b3 data-device: send INVALID_FINISH when operation != dnd
The documentation of wl_data_offer::finish states that it should be
used to signify that a drag and drop operation is completed. So send
WL_DATA_OFFER_ERROR_INVALID_FINISH when the client calls the finish
request but the operation isn't dnd.

Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
2019-04-19 22:06:37 +05:30
Pekka Paalanen 81475a5c15 libweston: move gl-renderer into a subdir
GL-renderer is expected to grow more files, both by addition and by splitting.
Moving them into a new subdirectory helps people to understand which files are
relevant.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:52:41 +03:00
Pekka Paalanen 3a2c67aa51 gl-renderer: does not need matrix.c
The symbols of matrix.c are already exported by libweston, no need to build
them again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen 4b5727375c libweston: export weston_linux_sync_file_read_timestamp()
This is an internal export for GL-renderer, so that it does not need to build
linux-sync-file.c a second time. This follows the example of
linux-explicit-synchronization.c which is also used by GL-renderer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03:00
Pekka Paalanen 4e952328ca build: turn vertex-clipping.c into a dependency
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.

This should help with moving GL-renderer into a new subdirectory.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:50:55 +03: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 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 91b1010de9 Rename config-parser.h to libweston/config-parser.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 96dc449259 Rename matrix.h to libweston/matrix.h
matrix.h is a public installed header and even 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
Pekka Paalanen 27b377f51f Rename plugin-registry.h to libweston/plugin-registry.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 7571027f17 Rename public backend headers
The backend headers are renamed from compositor-foo.h to backend-foo.h to
better describe their purpose. These headers are public libweston API for each
specific backend.

The headers will also be used like

 #include <libweston/backend-drm.h>

instead of

 #include <compositor-drm.h>

to give them a more explicit namespace.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen 3d5d9476e3 Rename compositor.h to libweston/libweston.h
The main idea is to make libweston users use the form

 #include <libweston/libweston.h>

instead of the plain

 #include <compositor.h>

which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.

The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:46 +03:00
Pekka Paalanen a78cf77582 Rename timeline-object.h to libweston/timeline-object.h
This patch sets up the stage for similarly renaming compositor.h which will
justify this. That patch will be big, so moving timeline-object.h first makes
it easy to see the changes to the build and install directives.

This and all the following moves essentially break the API, so libweston major
is bumped.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:31:45 +03:00
Pekka Paalanen cb74afd482 build: declare separate dependency for compositor.h
These are not specific to the launchers but to compositor.h, so name them that
way.

Once we can rely on the mentioned Meson PR, we can simplify this further.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-04-18 12:30:03 +03:00
Marius Vlad 3a28bd66ff meson.build/libweston: Fix clang warning for export-dynamic
Identical to 8a8558dd, where we need to pass `-Wl` as linker args.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-04-16 17:38:13 +03:00
Pekka Paalanen 651566af2d build: add missing dep to x11 backend
All other backends already link to libweston, x11 backend should too.

This fixes a build failure:

[1/50] Compiling C object 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o'.
FAILED: libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o
cc -Ilibweston/2b98b6d@@x11-backend@sha -Ilibweston -I../../git/weston/libweston -Ilibweston/.. -I../../git/weston/libweston/.. -Ilibweston/../shared -I../../git/weston/libweston/../shared -Iprotocol -I/home/pq/local/include -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/libdrm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -g -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers -fvisibility=hidden -fPIC  -MD -MQ 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o' -MF 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o.d' -o 'libweston/2b98b6d@@x11-backend@sha/compositor-x11.c.o' -c ../../git/weston/libweston/compositor-x11.c
../../git/weston/libweston/compositor-x11.c:51:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
 #include <xkbcommon/xkbcommon.h>

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-29 13:40:12 +02:00
Marius Vlad 253ba9a6db compositor: Fix missing new line when displaying buffer type for EGL buffer
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-03-28 12:30:25 +00:00
Marius Vlad a6acfa8346 compositor: Fix invalid view numbering in scene-graph
With the addition of patch 433f4e77b7 we display the same view id (0)
for every view as we're modifying the local variable.

Displaying sub-surfaces based views is also problematic. The caller need
to modify the view number as well, so we instead we pass the address as
to allow that to happen. Otherwise we end up repeating the same number
for views without sub-subrfaces once those have been printed.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-03-28 12:30:25 +00:00
Pekka Paalanen fc76388fa1 Remove autotools build
Weston 6.0.0 was released with both autotools and Meson build systems. That
should be enough for downstream to migrate to Meson build on their on pace.

Maintaining two build systems is a hassle, keep the one that is easier to work
with and let the other one go.

doc/dozygen/tool*.doxygen.in are not deleted, because they have not been
integrated with Meson yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 13:56:44 +02:00
Pekka Paalanen 779db046b9 meson: dep fix for compositor.h needing xkbcommon.h
This fixes:

[    5s] cc -Ilibweston/2b98b6d@@session-helper@sta -Ilibweston -I../libweston -Ilibweston/.. -I../libweston/.. -Ilibwes
ton/../shared -I../libweston/../shared -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/dbus-1.0 -I/usr/lib6
4/dbus-1.0/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wno-unused-parameter -Wno-shift-n
egative-value -Wno-missing-field-initializers -fvisibility=hidden -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong
 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fPIC  -MD -MQ 'libweston/2b98b6d@@session-hel
per@sta/launcher-util.c.o' -MF 'libweston/2b98b6d@@session-helper@sta/launcher-util.c.o.d' -o 'libweston/2b98b6d@@sessio
n-helper@sta/launcher-util.c.o' -c ../libweston/launcher-util.c
[    5s] In file included from ../libweston/launcher-util.c:29:
[    5s] ../libweston/compositor.h:39:10: fatal error: xkbcommon/xkbcommon.h: No such file or directory
[    5s]  #include <xkbcommon/xkbcommon.h>

For completeness, also add the same for wayland-server.h.

Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 12:52:00 +02:00
Deepak Rawat 46a1c729b8 compositor-drm: Set damage for scanout plane
Copy the damage region to scanout drm_plane_state which will be sent to
kernel during atomic state update.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
2019-03-28 10:19:13 +00:00
Deepak Rawat 009b3cfa6f compositor-drm: Add support for drm plane FB_DAMAGE_CLIPS property
The plane property FB_DAMAGE_CLIPS provides a way to mark damaged
regions on the plane in framebuffer coordinates of the framebuffer
attached to the plane.

This patch adds a new member "damage" to compositor version of
drm_plane_state and set FB_DAMAGE_CLIPS property whenever damage is
available.

v2: Rebase, check if plane support FB_DAMAGE_CLIPS property before
setting it.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
2019-03-28 10:19:13 +00:00
Pekka Paalanen fe6dd7bcef meson: DRM-backend demands GBM
All the GBM code is unconditional in compositor-drm.c, so while disabling the
GL-renderer would stop GBM from being used, GBM headers would still be needed
for building and GBM library for linking.

Leave a note to fix it properly later. At least we now check for GBM and do not
mislead with the error message.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-03-28 09:47:02 +00:00
Philipp Zabel 5c8eef147c compositor-drm: clear gbm_surface pointer after destroying the GBM surface
Since commit ee1d968e64 ("compositor-drm: Fall back if GBM surface fails with
modifiers"), drm_output_init_egl requires output->gbm_surface to be NULL, or
gbm_surface_create will not be called if HAVE_GBM_MODIFIERS is enabled but no
modifiers are supported by the plane. This could happen if _init_egl is called
after drm_ouptut_fini_egl drom drm_output_switch_mode.

Add an assert to guarantee the requirement and clears the gbm_surface pointer
after the surface is destroyed.

Signed-off-by: Philipp Zabel <p.pzabel@pengutronix.de>
2019-03-06 11:26:42 +01:00
Philipp Zabel 1c49b5445e compositor-drm: fix gbm_bo_get_handle_for_plane error handling
gbm_bo_get_handle_for_plane returns -1 on error, not 0.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-02-25 17:19:54 +01:00
Daniel Stone 2914a6da8b compositor-drm: Add missing newline to debug print
The 'created new mode blob' print was missing a newline, unlike all the
others.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-02-22 13:43:22 +00:00
Emmanuel Gil Peyrot 426c24673f Fix typos all around (thanks codespell!) 2019-02-20 16:47:35 +01:00
Marius Vlad 433f4e77b7 compositor: Fix scene-graph debug scope missing views based on sub-surfaces
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-02-18 16:48:37 +02:00
Marius Vlad d4c7bc58ab compositor-drm: Print pixel format in human-friendly form when failing to assign view to a overlay plane
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-02-18 16:19:58 +02:00
Marius Vlad 0a9c953825 meson: Remove freerdp1 as it no longer builds
../libweston/compositor-rdp.c: In function ‘rdp_peer_refresh_rfx’:
../libweston/compositor-rdp.c:213:25: error: invalid type argument of unary ‘*’ (have ‘SURFACE_BITS_COMMAND’ {aka ‘struct _SURFACE_BITS_COMMAND’})
  memset(&cmd, 0, sizeof(*cmd));

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-02-18 10:46:10 +00:00
Daniel Stone ee1d968e64 compositor-drm: Fall back if GBM surface fails with modifiers
If we cannot create a gbm_surface using a list of modifiers, fall back
to using the old pre-modifier version.

This fixes initialisation on systems where KMS supports modifiers but
the GBM driver does not, such as old i915 systems like Pine View using
the unified KMS driver but the old i915 Mesa driver.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2019-02-16 11:05:40 +00:00
Philipp Zabel cca7346557 meson: add missing libweston EGL dependency if renderer-gl is enabled
If the 'renderer-gl' option is enabled, ENABLE_EGL is defined, and
libweston/pixel-formats.c includes EGL/egl.h. This requires an egl
dependency, as X11-less platforms need the MESA_EGL_NO_X11_HEADERS
define from egl.pc cflags:

  In file included from /usr/include/EGL/egl.h:39:0,
                   from ../libweston/pixel-formats.c:42:
  /usr/include/EGL/eglplatform.h:124:10: fatal error: X11/Xlib.h: No such file or directory
  compilation terminated.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-02-15 23:26:16 +01:00
ant8me 30a285748d compositor-wayland: use xdg_shell stable instead of v6
Better to excercise the current rather than outdated protocol.

Pekka:
- split the patch, rewrote commit message
- rename xdg_shell_ping to xdg_wm_base_ping
- rename xdg_shell_listener to wm_base_listener
- fix continued line alignment

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-15 11:18:38 +00:00
Pekka Paalanen 1ed3506b70 libweston: export weston_config API
Make it official that libweston will export the weston_config API, as requested
in https://gitlab.freedesktop.org/wayland/weston/merge_requests/29 .

There is no other way third party helper clients could access the API.

The autotools build has been accidentally exporting it all the time, but the
Meson build needed fixing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2019-02-06 16:50:21 +02:00
Alexandros Frantzis 676296749a libweston: Support zwp_surface_synchronization_v1.get_release
Implement the get_release request of the zwp_surface_synchronization_v1
interface.

This commit implements the zwp_buffer_release_v1 interface. It supports
the zwp_buffer_release_v1.fenced_release event for surfaces rendered by
the GL renderer, and the zwp_buffer_release_v1.immediate_release event
for other cases.

Note that the immediate_release event is safe to be used for surface
buffers used as planes in the DRM backend, since the backend releases
them only after the next page flip that doesn't use the buffers has
finished.

Changes in v7:
  - Remove "partial" from commit title and description.
  - Fix inverted check when clearing used_in_output_repaint flag.

Changes in v5:
  - Use the new, generic explicit sync server error reporting function.
  - Introduce and use weston_buffer_release_move.
  - Introduce internally and use weston_buffer_release_destroy.

Changes in v4:
  - Support the zwp_buffer_release_v1.fenced_release event.
  - Support release fences in the GL renderer.
  - Assert that pending state buffer_release is always NULL after a
    commit.
  - Simplify weston_buffer_release_reference.
  - Move removal of destroy listener before resource destruction to
    avoid concerns about use-after-free in
    weston_buffer_release_reference
  - Rename weston_buffer_release_reference.busy_count to ref_count.
  - Add documentation for weston_buffer_release and ..._reference.

Changes in v3:
  - Raise NO_BUFFER for get_release if no buffer has been committed,
    don't raise UNSUPPORTED_BUFFER for non-dmabuf buffers,
    so get_release works for all valid buffers.
  - Destroy the buffer_release object after sending an event.
  - Track lifetime of buffer_release objects per commit, independently
    of any buffers.
  - Use updated protocol interface names.
  - Use correct format specifier for resource ids.

Changes in v2:
  - Raise UNSUPPORTED_BUFFER at commit if client has requested a
    buffer_release, but the committed buffer is not a valid linux_dmabuf.
  - Remove tests that are not viable anymore due to our inability to
    create dmabuf buffers and fences in a unit-test environment.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis acff29b3b3 libweston: Support zwp_surface_synchronization_v1.set_acquire_fence
Implement the set_acquire_fence request of the
zwp_surface_synchronization_v1 interface.

The implementation uses the acquire fence in two ways:

1. If the associated buffer is used as GL render source, an
   EGLSyncKHR is created from the fence and used to synchronize
   access.
2. If the associated buffer is used as a plane framebuffer,
   the acquire fence is treated as an in-fence for the atomic
   commit operation. If in-fences are not supported and the buffer
   has an acquire fence, we don't consider it for plane placement.

If the used compositor/renderer doesn't support explicit
synchronization, we don't advertise the protocol at all. Currently only
the DRM and X11 backends when using the GL renderer advertise the
protocol for production use.

Issues for discussion
---------------------

a. Currently, a server-side wait of EGLSyncKHR is performed before
   using the EGLImage/texture during rendering. Unfortunately, it's not clear
   from the specs whether this is generally safe to do, or we need to
   sync before glEGLImageTargetTexture2DOES. The exception is
   TEXTURE_EXTERNAL_OES where the spec mentions it's enough to sync
   and then glBindTexture for any changes to take effect.

Changes in v5:
  - Meson support.
  - Make explicit sync server error reporting more generic, supporting
    all explicit sync related interfaces not just
    wp_linux_surface_synchronization.
  - Fix typo in warning for missing EGL_KHR_wait_sync extension.
  - Support minor version 2 of the explicit sync protocol (i.e., support
    fences for opaque EGL buffers).

Changes in v4:
  - Introduce and use fd_clear and and fd_move helpers.
  - Don't check for a valid buffer when updating surface acquire fence fd
    from state.
  - Assert that pending state acquire fence fd is always clear
    after a commit.
  - Clarify that WESTON_CAP_EXPLICIT_SYNC applies to just the
    renderer.
  - Check for EGL_KHR_wait_sync before using eglWaitSyncKHR.
  - Dup the acquire fence before passing to EGL.

Changes in v3:
  - Keep acquire_fence_fd in surface instead of buffer.
  - Clarify that WESTON_CAP_EXPLICIT_SYNC applies to both backend and
    renderer.
  - Move comment about non-ownership of in_fence_fd to struct
    drm_plane_state definition.
  - Assert that we don't try to use planes with in-fences when using the
    legacy KMS API.
  - Remove unnecessary info from wayland error messages.
  - Handle acquire fence for subsurface commits.
  - Guard against self-update in fd_update.
  - Disconnect the client if acquire fence EGLSyncKHR creation or wait
    fails.
  - Use updated protocol interface names.
  - User correct format specifier for resource ids.
  - Advertise protocol for X11 backend with GL renderer.

Changes in v2:
  - Remove sync file wait fallbacks.
  - Raise UNSUPPORTED_BUFFER error at commit if we have an acquire
    fence, but the committed buffer is not a valid linux_dmabuf.
  - Don't put buffers with in-fences on planes that don't support
    in-fences.
  - Don't advertise explicit sync protocol if backend does not
    support explicit sync.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis c0e2f9261f libweston: Introduce an internal linux sync file API
Introduce an internal API for dealing with linux sync files,
and use it in the codebase to replace ad-hoc sync file management.

The linux_sync_file_is_valid function is not currently used, but will be
utilized in upcoming commits to implement the
zwp_linux_explicit_synchronization_unstable_v1 protocol.

Changes in v5:
  - Meson support.

Changes in v3:
  - Use parameter name in function documentation.
  - Move kernel UAPI to separate header file.

Changes in v2:
  - Add function documentation
  - Remove linux_sync_file_wait()

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Alexandros Frantzis 27d7c395c7 libweston: Introduce zwp_linux_explicit_synchronization_v1
Introduce support for the zwp_linux_explicit_synchronization_unstable_v1
protocol with an implementation of the zwp_linux_explicit_synchronization_v1
interface.

Explicit synchronization provides a more versatile notification
mechanism for buffer readiness and availability, and can be used to
improve efficiency by integrating with related functionality in display
and graphics APIs.

In addition, the per-commit nature of the release events provided by
this protocol potentially offers a solution to a deficiency of the
wl_buffer.release event (see
https://gitlab.freedesktop.org/wayland/wayland/issues/46).

Support for this protocol depends on the capabilities of the backend, so
we don't register it by default but provide a function which each
backend will need to call. In this commit only the headless backend when
using the noop renderer supports this to enable testing.

Note that the zwp_surface_synchronization_v1 interface, which contains
the core functionality of the protocol, is not implemented in this
commit. Support for it will be added in future commits.

Changes in v7:
  - Added some information in the commit message about the benefits of
    the explicit sync protocol.

Changes in v6:
  - Fall back to advertising minor version 1 of the explicit sync protocol,
    although we support minor version 2 features, until the new
    wayland-protocols version is released.

Changes in v5:
  - Meson support.
  - Advertise minor version 2 of the explicit sync protocol.

Changes in v4:
  - Enable explicit sync support in the headless backend for all
    renderers.

Changes in v3:
  - Use wl_resource_get_version() instead of hardcoding version 1.
  - Use updated protocol interface names.
  - Use correct format specifier for resource id.
  - Change test name to 'linux-explicit-synchronization.weston'
    (s/_/-/g).

Changes in v2:
  - Move implementation to separate file so protocol can be registered
    on demand by backends.
  - Register protocol in headless+noop backend for testing purposes.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2019-02-06 12:21:56 +00:00
Pekka Paalanen 91d0f08bce meson: remind about weston-launch suid
Since the Meson install step is not written to try to set the suid bit
automatically, remind the user that weston-launch needs to be
setuid-root to work.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2019-02-01 15:43:36 +00:00
Scott Anderson f0d3197fa5 meson: Fix deprecation warning for pkgconfig
Meson 0.49 now issues a warning for libraries being passed into the
'libraries' keyword argument. Now they should be passed as a positional
argument.

See
https://mesonbuild.com/Release-notes-for-0-49-0.html#deprecation-warning-in-pkgconfig-generator

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2019-02-01 12:17:01 +13:00
n3rdopolis fa2742b380 libweston: fbdev: Force the Framebuffer devices to be activated.
This attempts to wake up secondary framebuffer devices
(/dev/fb1 and up) as usually these devices start powered off, and
the FBIOPUT_VSCREENINFO ioctl turns it on. This was tested on qemu
with two virtual QXL cards. This is a more precise way to activate
framebuffer devices with the ioctl
2019-01-31 09:46:42 +00:00
Thomas Zimmermann ea54c2fda6 weston: Store use_pixman as `bool` type
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2019-01-31 08:57:54 +00:00
Scott Anderson 99553750db compositor-drm: Don't set linear modifier when not supported
This will cause gbm_surface_create_with_modifiers to fail on drivers
where modifiers are not yet supported (e.g. amdgpu). We need to make
sure we only end up using gbm_surface_create in this case.

This fixes the remoting plugin on these drivers.

Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
2019-01-29 16:21:07 +13:00
Marius Vlad be57857af6 compositor-drm: Add an environmental variable to force RENDER-only mode of compositing
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-25 12:56:24 +02:00
Marius Vlad c91cf30154 compositor-drm: Forgot to use mode variable when using render only mode of composition
In patch 5d767416c1 we simplified a bit the way in which the
compositing mode was being printed with the purpose to improve
weston-debug.  It seems we forgot to use the mode when RENDER-only mode
is being used, so this patch fixes that.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2019-01-25 12:47:16 +02:00
Philipp Zabel 619958e382 compositor-drm: fix drm_output_prepare_overlay_view for non-matching format
Add missing drm_plane_state_put_back in case the view's pixel format
does not match any of the tested plane's supported formats.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2019-01-23 15:46:39 +00:00
Marius Vlad 1ca025cc5d compositor-drm: Display the pixel format of the framebuffer used by the plane
With this patch we also display the format in usage by the HW-plane.
This touches both legacy and atomic paths.
2019-01-23 16:28:26 +02:00
Marius Vlad 2ce2339045 pixel-formats: Document pixel format human-friendly conversion methods
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-23 16:28:21 +02:00
Marius Vlad f5ca2f1424 compositor-drm: Print DRM FB pixel format of the view in human-friendly form
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2019-01-23 16:08:43 +02:00
Pekka Paalanen 13dda10f1c meson: better errors for VA-API deps
Helps people avoid libva if they don't want it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 3b6b1e9128 meson: better error for drm+gl deps
Helps people avoid GBM if they don't have it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 83a46ca980 meson: better error for x11+gl deps
Helps people avoid egl in the rare case they don't have it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 43a42920cf meson: better error for wayland-backend wl-egl dep
Helps people avoid wayland-egl if they don't want it.

Makes the check for wayland-egl explicit on the site instead of relying
on gl-renderer checking for it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen a18bd3432d meson: better errors for gl-renderer egl and glesv2
Helps people to avoid EGL and GLESv2 if they do not want them.

Stops using dep_egl and dep_glesv2 so that the human friendly error
message is alongside the dependency() statement, so that the message and
the statement can later be merged together once Meson offers the custom
error messages feature or something even more sophisticated.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 16487ebc06 meson: better errors for x11-backend deps
Helps people avoid X11 related dependencies if they don't want them.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen c529d0b919 meson: better error for freerdp
Helps people to avoid freerdp if they don't want it.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pekka Paalanen 9adcf44077 meson: better error for logind deps
Helps people to disable logind support if they do not want the
dependencies.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-31 15:16:53 +02:00
Pablo Castellano f0ba93c194 compositor-fbdev: add support for ABGR
Make fbdev work with some Android downstream kernels, like the
asus-grouper (Google Nexus 7 2012).

Signed-off-by: Oliver Smith <ollieparanoid@bitmessage.ch>
2018-12-20 07:58:20 +00:00
Marius Vlad a0d9cc64f6 libweston/screnshooter: Fix weston screenshot event done if there's no client running
The 'done' event sent back to client with the weston screenshot interface
is not being sent if there is no damage on the plane. This patch (re-uses just
like recording part) weston_output_damage() to achieve that.

Otherwise the client will have to wait (and be blocked) until some
damage on the plane is being done.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad d9bcc0b171 libweston/weston-debug: Add a easy way to determine if the debug protocol has been enabled
This allows additional debug features to depend on the debug protocol being enabled

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 15:37:34 +02:00
Marius Vlad 748f09efe5 libweston/compositor-drm: Add missing debug message for scanout_view
Print debug message when the fb coudn't be retrieved for the primary
plane.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 11:28:12 +02:00
Marius Vlad 94698d2a83 libweston/compositor-drm: No need to test for invalid alpha for the view
This is redundant and is already being checked drm_fb_get_from_view()

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 11:28:12 +02:00
Marius Vlad 5d767416c1 libweston/compositor-drm: Print composition mode in weston-debug
This fixes the situation when using only plane-state mode for
compositing there's no obvious debug message stating that. This patch
makes it slightly better/easier to dermine what mode the compositor is
using currently.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-18 11:28:07 +02:00
Marius Vlad 7d070ca0ba Fix compiler warnings generated by older toolchains/compiler
This fixes warnings like ``may be used uninitialized''

libweston/compositor-drm.c: In function 'drm_device_is_kms':
libweston/compositor-drm.c:6374:12: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
  b->drm.id = id;

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-15 18:37:53 +02:00
Daniel Stone 8011b0fa03 Add Meson build system
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.

More information at http://mesonbuild.com

Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.

This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.

It is expected that the autotools build system will be removed soon
after the next Weston release.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 14:50:54 +02:00
David Fort 7b7d9d316a rdp-compositor: fix compilation with FreeRDP 2.0-rc4
Some members have been removed from FreeRDP structs, so let's use local
variables.
2018-12-04 23:42:27 +01:00
Marius Vlad 00a6e01d53 compositor: Make pixel format printing in human-friendly form
This would make weston-debug much more readable when looking at
the pixel format of the buffer.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-11-20 18:00:25 +02:00
Marius Vlad a9a630401f pixel-formats: Added pixel_format_get_info_shm() helper for printing SHM buffers
In current form SHM buffers pixel format can only be printed as 0 and 1.
With the help of this helper we align with DRM_FORMAT_ pixel format.

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-11-20 18:00:09 +02:00
Pekka Paalanen 62a9436417 compositor-drm: parse all DRM format names
Use the pixel format table to parse format names. This makes the parser
recognize almost all DRM format names.

Not all formats are usable, but we rely on the use to fail
appropriately. What we can use depends on the drivers anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-20 12:05:11 +02:00
Pekka Paalanen f5ed7431e5 pixel-formats: search by name
Add a function to find a format description by the DRM format name. This
will be useful when parsing configuration strings.

While at it, fix the two function formattings in pixel-formats.h to
match everything else in the file.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-20 12:05:11 +02:00
Pekka Paalanen e7c91b61c7 pixel-formats: add name string
There is often a need to print the name of a pixel format. Printing the
raw numeric value is hard to decipher, printing the four ASCII
characters is slightly more human-friendly but still needs a decoder
table. Add a name that can be printed easily.

The bulk of this patch was done with:
sed -i -e 's/\.format = DRM_FORMAT_\(.\+\),/DRM_FORMAT(\1),/' libweston/pixel-formats.c

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-11-20 12:05:11 +02:00
Arkadiusz Hiler 5a5cbc0245 compositor-drm: Log atomic commits and flips
Add a couple log points for tracking atomic commits and flip processing.

Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-11-03 09:13:09 +00:00
Vasilis Liaskovitis 486b463a18 gl-renderer, pixman: disconnect the client on unhandled buffer type.
Introduce a helper function to disconnect the client on unhandled
buffer types, and use it in the gl and pixman renderers. The function
is modeled after linux_dmabuf_buffer_send_server_error.

Also print the egl error state in the gl renderer, in case the
unrecognized buffer error happens when querying an egl buffer.

https://gitlab.freedesktop.org/wayland/weston/issues/148
2018-11-02 14:28:05 +00:00
Deepak Rawat a864f58f44 compositor-drm: Read FB2_MODIFIERS capability
Not all drivers support fb2 modifiers so read the capability before
using drmModeAddFB2WithModifiers.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
2018-11-02 13:28:34 +00:00
Tomohito Esaki b1fb00dbcd compositor-drm: Add Support virtual output
Add support virtual output for streaming image to remote output by
remoting-plugin which will be added by the patch:
"Add remoting plugin for output streaming."
The gbm bo of virtual output is the linear format.

Virtual output is implemented based on a patch by Grigory Kletsko
<grigory.kletsko@cogentembedded.com>.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Tomohito Esaki 718a40b49c compositor-drm: store gbm bo flags in drm_output
Store usage flags of gbm bo in drm_output in order to specify the bo
format for each output. A following patch will add a new type of
drm_output which requires different gbm_bo_flags.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Tomohito Esaki 1506e99fd3 gl-renderer: provide fence sync fd for synchronizing with GPU rendering
Add new API to gl-renderer interface for providing fence sync fd. the
backend can wait for GPU rendering by this API.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Tomohito Esaki 4976b09a7e compositor-drm: add num_planes to drm_fb structure
Add new member to store number of planes to drm_fb structure.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
2018-10-30 17:09:01 +09:00
Emil Velikov da4f185faa libweston: print EGL information as early as possible
In the case where CreateContext/MakeCurrent fails, we still want to
know what the EGL driver is capable of.

Move the EGL info printing, just after the eglInitialize() call to
ensure that.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-10-18 16:14:05 +01:00
Emil Velikov 3bb047b605 libweston: split EGL and GL info logging
Split the two into separate functions. Former requires an initialized
EGL display, while the latter a current context.

We will use that distinction with the next patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-10-18 16:14:03 +01:00
Daniel Stone bff27cb835 compositor-drm: Don't warn about missing backlight control
Not every output will have a backlight control, and even if it does we
may just not be able to find it. Not having backlight control isn't an
error, so don't spam the log with it, as doing so can confuse users into
thinking this is an actual error which is responsible for their real
problems.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-23 11:21:40 +02:00
Daniel Stone a65d55e133 gl-renderer: Remove warning on missing extensions
Not having swap_buffers_with_damage could cause a performance impact on
some backends, but at least on GBM it causes no issues. It also seems to
confuse users into thinking it's a legitimate error which could explain
session slowness.

Similarly with buffer_age, whilst we do lose a little bit of performance
by not being able to do partial renders, it is not a great deal, and the
user is unlikely to be able to do anything about it in any event.

Remove the warning; we print the full extension list at startup, so we
already have enough information from the logs to easily diagnose any
real errors.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-23 11:21:40 +02:00
Philipp Zabel 61dc4ca92e compositor-drm: check connector non-desktop property and mark head accordingly
Use the DRM connector "non-desktop" property to mark weston_heads that
represent head mounted displays and other non-standard displays that the
desktop should not be extended to.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-23 09:18:00 +00:00
Philipp Zabel c18ffd3939 libweston: add weston_head_{is,set}_non_desktop()
Add non-desktop property for weston_heads representing displays that the
desktop should not be extended to by default, e.g. head mounted displays.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-23 09:18:00 +00:00
Philipp Zabel fff2797c88 compositor-drm: use weston_view_is_opaque()
Implement drm_view_is_opaque() using weston_view_is_opaque(). Also, use
weston_view_is_opaque() directly in drm_output_propose_state(), with the
clipped_view.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-18 19:22:20 +02:00
Philipp Zabel 70decd5b2b libweston: add weston_view_is_opaque()
Use the weston_surface is_opaque property, the opaque region, and the view
alpha value to determine whether the weston_view is opaque in a specific
region.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-18 19:21:46 +02:00
Philipp Zabel 195dadeb2a libweston: add weston_surface is_opaque property
Add an is_opaque property that is set to true if the attached buffer does not
have an alpha component, or if the solid color is non-transparent.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2018-09-18 19:21:46 +02:00
Changwoo Cho f97d250847 libweston: fix typo in comment 2018-09-18 09:58:35 +00:00
Daniel Stone 1cbe1f952d compositor-drm: Add drm-backend log debug scope
Add a 'drm-debug' scope which prints verbose information about the DRM
backend's repaint cycle, including the decision tree on how views are
assigned (or not) to planes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-17 13:29:48 +01:00
Daniel Stone 64dbbee7f6 compositor-drm: Add backend pointer to drm_output
Add this for convenience, so it's easier to access when we add the DRM
backend debug scope.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-17 13:29:48 +01:00
Daniel Stone 3158a2d42e compositor-drm: Calculate atomic-commit flags earlier
Shift up our calculation of the flags we use for atomic commits. We will
later use this to differentiate between test-only and full commits when
printing debug information inside drm_output_state_apply_atomic.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-09-17 13:29:48 +01:00
Daniel Stone ce62cb3d05 compositor: Add scene-graph debug scope
Add a 'scene-graph' debug scope which will dump out the current set of
outputs, layers, and views and as much information as possible about how
they are rendered and composited.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-09-17 13:29:48 +01:00
Daniel Stone 3b7756351d compositor: Add weston_layer_mask_is_infinite
As a counterpart to weston_layer_set_mask_infinite(), returning if the
mask is the same as what is set.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-09-17 13:29:48 +01:00
Pekka Paalanen a5630eafec libweston: add weston_debug API and implementation
weston_debug is both a libweston API for relaying debugging messages,
and the compositor-debug wayland protocol implementation for accessing those
debug messages from a Wayland client.

weston_debug_compositor_{create,destroy}() are private API, hence not
exported.

Signed-off-by: Pekka Paalanen <pq@iki.fi>

append the debug scope name along with the timestamp in
weston_debug_scope_timestamp API

Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Add explicit advertisement of debug scope names.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2018-09-17 13:29:23 +01:00
Pekka Paalanen 4fc1ee8d5b protocol: add weston-debug.xml
This is a new debugging extension for non-production environments. The
aim is to replace all build-time choosable debug prints in the
compositor with runtime subscribable debug streams.

Signed-off-by: Pekka Paalanen <pq@iki.fi>

Added new libweston-$MAJOR-protocols.pc file and install that
for external projects to find the XML files installed by libweston.

Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>

Use noarch_pkgconfig_DATA instead, add ${pc_sysrootdir}, drop
unnecessary EXTRA_DIST of weston-debug.xml.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Add explicit advertisement of available debug interfaces.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2018-09-11 15:24:46 +01:00
Matteo Valdina 3ebbc6b5df gl-renderer: Explicitly zeroing the offset for 2^ plane of SHM_FOMRAT_YUYV
This fix a crash, when gl-renderer uploads the 2^ texture for YUYV.
The pixels buffer was offset of a random value.
2018-08-31 09:47:59 -05:00
Stefan Agner 30e283de70 compositor-drm: add DPI connector type
Linux v4.7 introduced a new connector type for display parallel
interface (DPI). Add DPI to the list of connectors in the DRM
backend of Weston as well. This avoid DPI connectors showing up
as UNNAMED.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2018-08-20 17:11:38 +02:00
Derek Foreman 76829fc4ea input: Send unique keymap file descriptors to clients
Client may map any file descriptor opened for writing with PROT_WRITE
themselves.  On linux, even a read-only file descriptor to an unlinked
file can be re-opened with write permission through /proc/self/fd.

The only way to prevent this is to create a memfd which
is subsequently write-sealed.  Unfortunately this prevents clients
from mapping with MAP_SHARED, which is already in widespread usage.

To isolate and protect the keymap, whilst allowing MAP_SHARED clients
to continue to work, use a unique file descriptor for each
wl_keyboard resource.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-08-17 09:25:24 -05:00
Derek Foreman f8f7fd69df input: add weston_keyboard_send_keymap helper function
We've always had "send_keymap" internally, but some places failed to use
it.  Since we also use this in the text backend, export it.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-08-17 09:25:21 -05:00
Daniel Stone 48687982b5 compositor-drm: Remove addfb warning for user buffers
THe KMS AddFB call can fail for any reason at all: format/modifier not
suitable, stride not aligned, allocation not contiguous, etc. If this
happens with Weston's own buffers, the result is bad - no composition
output.

Failing AddFB from user-supplied buffers though, is not an error. The
user can't necessarily allocate suitable buffers, nor does it have to.
Don't spam the log with warnings when we fail on user buffers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-27 11:21:10 -05:00
Daniel Stone 1178922590 compositor-drm: Don't test render-only atomic configuration
In the RENDERER_ONLY state proposal mode, we don't actually have a
viable configuration to test, because we won't get a renderer buffer
until after assign_planes - where we're called from - has completed.

This can result in us trying to test a configuration with the CRTC and
connectors active, but no planes active, which the kernel can
legitimately fail.

If we're working in renderer-only mode, just return the state we have
without trying to test it first, and let the kernel fill it in later.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-27 11:20:47 -05:00
Daniel Stone 8c9556c57d compositor-drm: Remove unnecessary libdrm defines
The backend begins with a series of #defines of libdrm tokens, in case
the libdrm we build against is too old.

Commit efdebbc4e8 ("configure.ac: bump libdrm requirement to 2.4.68")
did what it said on the box; since we now depend on a relatively modern
libdrm, we can get rid of most of our compatibility defines.

DRM_CAP_TIMESTAMP_MONOTONIC was added in libdrm 2.4.47 (f8f1f6e37ae2).
DRM_CLIENT_CAP_UNIVERSAL_PLANES was added in libdrm 2.4.55
(8fc62ca8ac01).
DRM_CAP_CURSOR_WIDTH and HEIGHT were added in libdrm 2.4.68
(cc9a53f076d4).

Remove these four fallback definitions.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman.samsung@gmail.com>
2018-07-27 11:20:25 -05:00
Daniel Stone 678aabe829 compositor-drm: Enable planes for atomic
Now that we can sensibly test proposed plane configurations with atomic,
sprites are not broken.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-11 14:17:52 +01:00
Daniel Stone 9fe4bf8863 compositor-drm: Relax plane restrictions for atomic
Since we now incrementally test atomic state as we build it, we can
loosen restrictions on what we can do with planes, and let the kernel
tell us whether or not it's OK.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-11 14:17:52 +01:00
Daniel Stone b41abf9c84 compositor-drm: Allow scanout plane to be occluded by overlay
a0f8276fe8 ("compositor-drm: Disallow overlapping overlay planes") was
a little too pessimistic in rejecting occluded views. Whilst it
correctly prevented overlay planes from occluding each other, it also
prevented overlay planes from occluding the scanout plane.

This is undesirable: the primary/scanout plane is specified to stack
strictly below all overlay planes, so there is no need to reject a plane
from consideration for scanout due to being occluded by an overlay
plane.

Shift the check downwards so it only applies to overlay rather than
scanout planes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-11 14:17:52 +01:00
Daniel Stone a284d271f1 compositor-drm: Incrementally test plane states in mixed mode
In the plane-only mode, we try to place every view on a hardware plane,
and fail if we can't do this. This requires a full walk of the scene
graph to come up with a complete configuration in order to be able to
test.

In mixed mode, we know at least some visible views will fail to be
promoted to planes and must be composited via the renderer. In order to
still use some planes where possible, we use atomic modesetting's
test-only mode to incrementally test configurations.

We know that the renderer output will always be visible, and because it
is the renderer, that it will be occupying the scanout plane underneath
everything else. The actual renderer buffer doesn't materialise until
after assign_planes, because it cannot know what to render until then.

However, in order to test whether a configuration is valid, we need the
renderer buffer in the scanout plane. For testing, we fake this by
temporarily stealing the old buffer - if it seems sufficiently
compatible - and placing it in the state we construct. This is used to
test whether or not a renderer buffer will work with the addition of
overlay planes.

Doing this incremental testing will allow us to enable plane usage for
atomic by default, since we know ahead of time that our chosen plane
configuration will work.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-11 14:17:52 +01:00
Daniel Stone d12e51646a compositor-drm: Add planes-only mode to state proposal
Add a new mode, which attempts to construct a scene exclusively using
planes. This is a building block for incrementally testing and
constructing state: in the plane-only mode, we test the state exactly
once, when we have constructed a full set of planes and want to know if
it works or not.

When using the renderer, we need to incrementally test views one by one
to see if they will work on planes, falling back to the renderer if not.
This test is different, since the scanout plane will be occupied by the
renderer's buffer. Testing using the renderer or client buffers may have
completely different characteristics, so we need two passes: first,
constructing a state with only planes and testing if that succeeds,
falling back later to a mixed renderer/plane mode which tests
incrementally.

This implements the first mode, and preferentially attempts to use it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-11 13:08:57 +01:00
Daniel Stone ca6fbe3c93 compositor-drm: Never lift solid surfaces to planes
This will never work, so don't even try to do it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-07-11 12:50:23 +01:00