Commit graph

7912 commits

Author SHA1 Message Date
Marius Vlad 509398dc25 desktop-shell: Avoid spurious configure events for xdg-shell activation
This is a minor re-work of how we de-activate and activate the surfaces
in desktop-shell. As activate() is being used for handling keyboard
input events, this basically rectifies that such that  activation
happens only if the passed surface is different from the currently
focused surface.

Fixes: #593

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-26 15:59:29 +00:00
Daniel Stone b5605ccd26 libweston: Remove weston_surface_set_color
Don't do this; instead, create a solid-colour buffer and attach it to
the surface explicitly.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 4d426ab6b1 shell: Explicitly use solid weston_buffers
Rather than punching through to set the surface as a solid colour,
attach an actual weston_buffer to it instead.

This becomes the first user of attaching non-client-generated buffers
to a weston_surface. As a result, it is necessary to introduce a
function which will allow compositors and shells to attach a buffer to a
surface. weston_surface_attach_solid() is therefore introduced as a
special-purpose helper which will attach a solid buffer to a
weston_surface.

It is not intended as a general-purpose mechanism to allow compositors
to attach client-generated buffers to surfaces, as doing so would have
unknown effects on this core part of the compositor itself.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 82b646728c backend-drm: Handle solid-colour buffers in state propose
When we're checking to see if a view is suitable to go on a plane, check
for (and reject) solid-colour buffers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone b38b735e20 backend-drm: Remove Pixman conditional for keep_buffer
The Pixman renderer keeps its own reference to buffers when attached to
surfaces, through its surface state: just use that instead.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 493a4c013e noop-render: Allow solid-color buffers
Refactor the buffer-type check slightly so we can handle solid-color
buffers, which we do exactly nothing with.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone d82d74e713 pixman-renderer: Support solid-colour weston_buffers
Just implemented via the same mechanism as surface_set_color.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 465f4a250c gl-renderer: Support solid-colour weston_buffers
Same as surface_set_color.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 43715ff0c0 weston_buffer: Add solid buffer type
Currently solid-colour displays (e.g. the background for fullscreen
views) is implemented by a special-case weston_surface which has no
buffer attached, with a special punch-through renderer callback to set
the colour.

Replace this with a weston_buffer type explicitly specifying the solid
colour, which helps us eliminate yet more special cases in renderers and
backends.

This is not handled yet in any renderer or backend, however it is also
not used by anything yet. Following commits add support to the renderers
and backends.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 7a27f6cbe4 compositor: Downgrade rather than drop buffer reference when copied
When the renderer/backend indicate that they do not need a surface's
buffer content to be preserved, most often because they have copied it,
simply downgrade the buffer reference to 'will not access', rather than
drop the buffer reference altogether.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone a42908204f weston_buffer: Separate buffer release from lifetime
In the original conception, a weston_buffer_reference indicated that the
underlying contents of the wl_buffer would or could be accessed, so
wl_buffer.release must not be sent until the last reference was
released, as the compositor may still use it.

This meant that renderers or backends which copied the buffer content -
such as the GL renderer with SHM buffers - could only send a buffer
release event to the client by 'losing' the buffer reference altogether.
The main side effect is that `weston-debug scene-graph` could not show
any information at all about SHM buffers when using the GL renderer, but
it also meant that renderers and backends grew increasingly exotic
structures to cache information about the buffer.

Now that we have an additional buffer-reference mode (still referring to
the weston_buffer/wl_buffer, but not going to access its content), we
can allow the weston_buffer_reference and weston_buffer to live as long
as the buffer itself, even if we do send a release event.

This will enable a bunch of backend and renderer deduplication, as well
as finally making scene-graph more useful.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone fdc7b9c352 weston_buffer: Add mode to weston_buffer_reference
Add a mode argument to weston_buffer_reference which indicates whether a
buffer's storage may/will be accessed, or whether the underlying storage
will no longer be accessed, e.g. because it has been copied. This will
be used to retain a pointer to the weston_buffer whilst being able to
send a release event to the client.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 7e90433079 weston_buffer: Hold lifetime for resource/backend usage
Keep the weston_buffer alive for as long as at least one of the
underlying wl_buffer or a backend usage exists.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone d2a858e879 gl-renderer: Prepare for buffer to outlive resource
Make sure we don't die if we're asked to flush the damage on a SHM
buffer which has subsequently been destroyed.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 7b3efabd88 weston_buffer: Prepare for buffer to outlive resource
We currently allow a weston_buffer to outlive the underlying wl_buffer
iff the renderer/backend has cached it. Currently the 'is this buffer
valid?' test relies on looking for the validity of the weston_buffer
itself; shift these tests to looking at the validity of the underlying
resource.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone e9c792ed64 backend-drm: More failure reasons
Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 231a67ff8c drm-backend: Refactor unpleasant keep_buffer if tree
Break a giant if statement out into a more legible grouping.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 2dcfe723be backend-drm: Make use of weston_buffer format and type
Just pull it from the structure rather than pulling it in externally.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 1d9c62b50d weston_buffer: Print more buffer information in scene-graph
Try to print out as much information as we can about the buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 0a8802404c scene-graph: Use weston_buffer's format/modifier info to print
Now that we have this generically available, use it rather than calling
into per-buffer getters.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 7506cf5240 gl-renderer: Simplify surface->is_opaque
We already have the format; no need to go chasing it again.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 4f88b2655e weston_buffer: Change y_inverted to explicit origin enum
y_inverted meant that the buffer's origin was (0,0), and non-inverted
meant that the buffer's origin was (0,height). In practice, every buffer
was 'inverted' into our natural co-ordinate space that we use
everywhere.

Switch to using an explicit origin enum to make this more clear.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 6dcf3eac1f weston_buffer: Add pixel format and modifier info
Promote these to weston_buffer rather than burying them in the renderers
and backends.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone fef8bb275c weston_buffer: Make use of weston_buffer->type
Rather than calling accessors (wl_shm_buffer_get etc) to figure out
which type our buffer is, just look in the structure.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 34cd0d114f weston_buffer: Add type field
Rather than open-coding various resource -> type accessors, just stick a
type enum in the buffer struct.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 1d5f8af82e gl-renderer: Add hook to fill weston_buffer for EGL
Rather than only filling weston_buffer information when we first come to
use it, add an explicit hook so we can fill the dimensions the first
time the buffer's attached.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone f49d6f47f3 gl-renderer: Reject unknown-format dmabufs
Make sure we only import dmabufs where the underlying pixel_format is
known: if we can't reason about the buffer content, we're not entirely
likely to be able to display it well.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone ca9bb01fe6 renderers: Set buffer properties earlier
When we first see a buffer attached, we create a weston_buffer for it.
The weston_buffer doesn't contain any useful information in and of
itself; that's left to renderers to populate later.

Switch this to doing it in the core at the first opportunity, at least
for SHM and dmabuf buffers; EGL buffers will follow in the next commit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone fec0400886 gl-renderer: Drop unnecessary NULL check
All the callers of flush_damage guarantee we'll have a buffer.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone 12675ed19f renderer: Add buffer to flush_damage
We already have the buffer in the caller, and every no-op implementation
will want to access the buffer. So might as well pass it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Daniel Stone f8ac6f940f gl-renderer: Remove outdated comment
The comment about needing to have destroyed images is somewhat less true
now that we actively avoid doing so.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: 0b51b02c5e ("gl-renderer: Don't re-import dmabufs")
2022-04-25 14:27:08 +00:00
Daniel Stone efd6aae915 gl-renderer: Remove unnecessary dmabuf conditional
We can't try to attach a dmabuf that we never imported.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-04-25 14:27:08 +00:00
Hideyuki Nagase 6129cbd880 rdp: Improved rdp logging infrastructure
Add some logging helper functions along with two log scopes for debug
and extremely verbose debugging information.

Also add tangentially related logging for the synchronize event, so
the debug stream isn't empty right now. The vast majority of verbose
usage will come later.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2022-04-21 07:33:27 -05:00
Derek Foreman 04e0558327 rdp: Allow disabling RemoteFX codec
There are currently compatibility issues between FreeRDP's implementation
of the RemoteFX codec and Microsoft's implementation.

Perhaps this will be fixed in the future and this option can go away,
but for now it's necessary to have a way to disable the codec if the
windows client is going to be connecting to a weston server.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-04-21 07:20:59 -05:00
Simon Ser 4887f1a7aa build: add Meson fallback for wayland-protocols
This allows easily co-developing a Wayland protocol and Weston.
Example setup:

    ln -s subprojects/wayland-protocols /path/to/wayland-protocols
    meson configure build/ --force-fallback-for=wayland-protocols

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-04-21 11:29:48 +03:00
Marius Vlad 0a8e3cbc4a screen-share: Document that --no-config option should be passed
With commit 'screen-share: Add option to start screen sharing on weston
star' an section option has been added to start screen-sharing by
default on all outputs. This has the side-effect of attempting to start
screen-share on the same (RDP) output performing the screen-share. That
happens due to re-loading the screen-share module once more.

This patch recommends users to use --no-config option or alternatively,
use a different configuration file to avoid that.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-20 19:45:28 +03:00
Marius Vlad af18a0c4c9 screen-share: Avoid bit-shifting large values
Found while running with b_sanitize=undefined, which yields:

runtime error: shift exponent 909199186 is too large for 32-bit type 'int'

Converts the shm_formats to a boolean and checks for the correct pixel
format it directly, instead of trying to gather them all in an array and
then later on to do the check.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-20 19:45:28 +03:00
Marius Vlad 08ee337e4d screen-share: Add a compositor destroy listener
Trivial fix to clean itself on compositor tear-down. While at it
properly free the command string.

Fixes #298

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-20 19:45:28 +03:00
Marius Vlad 9e20730e04 screen-share: Start screen sharing even if no pointer is found
With commit e825fe38, we no longer display the pointer if no movement is
detected, which will cause screen share to fail to start if that is the
case. There could be also legitimate cases where there's no pointer, so
let's allow screen share to function in those cases as well. Makes uses
of previous helper methods to find a proper output to share in case we
don't have an pointer.

Re-uses the shell utils functions.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-20 19:45:25 +03:00
Marius Vlad 3bedb70454 touch-calibration: Clean-up if touch calibrator has been enabled
Seems that we're still missing layer clean-ups, with the touch
calibrator being one of them. Call the appropriate function when
shutting down the compositor instance.

Fixes: #603

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-04-20 08:27:17 +00:00
Hideyuki Nagase 8aa1c30bf1 xwayland: Honour the XCURSOR_THEME environment variable
Toy toolkit apps already do this since commit 807cd2e589

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2022-04-20 08:23:19 +00:00
Weng Xuetian e99ed2ad36
Defer launch input method with wl_event_loop_add_idle.
Input method process may also be a XIM server which requires the correct
DISPLAY to be set after xwayland start up. This helps input method to
work for both wayland and Xwayland.

Signed-off-by: Weng Xuetian <wengxt@gmail.com>
2022-04-19 07:06:30 -07:00
Hideyuki Nagase 8fb529bc31 input: Fix bug in idle inhibition
Server generated key repeats are ignored - and they don't generate
matching release events. We early return to avoid generating events
for them.

We also need to push the idle inhibition counting after that early
return to prevent breaking idle inhibition with unmatched events.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2022-04-18 12:10:20 +00:00
Dominique Martinet c2f4201ed2 xwayland: use -displayfd instead of USR1 to signal readiness
We want to wait for Xwayland to be ready before issuing it blocking
requests, but relying on USR1 is a bit unsafe:
 - we can't ascertain the signal originated from Xwayland
 - if weston is started as PID1 (e.g. in its own container), then
   Xwayland will not send SIGUSR1 and X11 connections will be stuck
   forever: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1312

Creating a pipe and using -displayfd, even if we don't care about the
display value itself, is safe and works for all cases

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
2022-04-18 12:46:04 +03:00
Pekka Paalanen e1a111e1b7 man: add section delimiters in weston.ini
These added lines are comments (do not affect output) that make it
easier to browse this file and find the section headings.

Removal of the preceding empty lines on two of the section headers
remove a blank line from PDF output. The blank line was kind of nice,
but presumably .SH should add any necessary blanks before a new section
heading. Now all the section headings have the same vertical space to
the preceding content in PDF.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-04-18 12:43:00 +03:00
Pekka Paalanen 9203910b9a man: clean up weston.ini mark-up
Try to reduce the cargo-culted directives that do not seem to have any
effect on the output.

I verified that are no changes by doing before this patch

	$ man -Tpdf man/weston.ini.5 > ref.pdf

and then after this patch

	$ ninja && man -Tpdf man/weston.ini.5 > test.pdf

and looking at

	$ diffpdf ref.pdf test.pdf

I used PDF as the format for comparisons, because it can express much
more typesetting features than plain text.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-04-18 12:43:00 +03:00
Michael Olbrich 924e79f4f2 ivi-shell: emit created notification earlier for desktop surfaces
Without this, the earliest signal the ivi controller receives for a new surface
is configure_desktop_changed signal. And this is not emitted until the surface
has the first buffer attached.
By emitting the signal during surface creation, the controller is able to set
the initial width and height for the first configure.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-04-14 13:10:04 +00:00
Maciej Pijanowski cd7801aa95 screen-share: use compositor->read_format with renderer->read_pixels()
The pixel format was hardcoded to PIXMAN_a8r8g8b8. All other
renderer->read_pixels() calls in weston use dynamic format selection via
the compositor->read_format instead.

The problem was spotted on the ARM devices with Mali-400 GPU. The visual
effect of the problem was black screen on the remote display, when using
screen-share with the VNC or RDP backends. Related wayland-devel thread:
https://lists.freedesktop.org/archives/wayland-devel/2020-September/041624.html

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
2022-04-14 12:16:19 +00:00
shierote f2d6d21eec libweston: correct argument name in the handler of wl_data_source.accept
Signed-off-by: Taishi Eguchi <taishi2060@gmail.com>
2022-04-14 12:05:57 +00:00
Hideyuki Nagase 87bded8b54 rdp: split off rdp.h
Refactor some of rdp.c into a header file.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
2022-04-14 12:02:12 +00:00