Commit Graph

1437 Commits

Author SHA1 Message Date
Pekka Paalanen
dd706d5953 backend-headless: let pixman allocate the image
No need to manually allocate the storage, Pixman can do that.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-29 08:54:21 +00:00
Pekka Paalanen
7323ddec62 pixman-renderer: let pixman allocate shadow
There is no need for us to allocate the storage manually, Pixman can do
that for us.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-29 08:54:21 +00:00
Jonas Ådahl
5ffa1962a5 compositor: Add support for wl_surface.offset()
This allows for setting a buffer offset without having to make it part
of the wl_surface.attach request. This is useful for e.g. setting a DND
surface icon hotspot offset when using Vulkan; or doing the same with
EGL without having to use wl_egl_window_resize().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2022-07-26 17:43:01 +00:00
Derek Foreman
4564a40cb0 rdp: Move peer list from output to backend
In the future we'll have multiple output support, which makes storing
the peer list on an output rather tricky.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-07-26 17:34:20 +00:00
Michael Olbrich
27d2a4cfab libweston: don't reset the plane for views from other outputs
The paint_node_z_order_list contains all views, not just the ones visible on the
current output. So all views are moved to the primary plane when one output
does not support planes.

This will be relevant with multiple backends: When an output without plane
support is rendered then the views of all other outputs are removed from
the current planes and the corresponding outputs will be repainted
unnecessarily.

So only reset the plane if the view is actually on the current output.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-07-26 17:28:15 +00:00
Marius Vlad
78ccc99d0a libweston: Remove runtime render switching
It is only enabled by a debug key binding, currently not tested at all,
and is seems it doesn't really work, so let's remove it. This also
removes it from the man page.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-07-26 13:40:43 +00:00
Daniel Stone
a8048c5c1c libweston: Properly namespace solid_buffer_values
It's exported by libweston, so shouldn't leak unprefixed types.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 11:52:24 +01:00
Joshua Watt
a09f02d43a libweston: Compute output protection when head is attached
A head may have its output protection set before it is attached to an
output. Recompute the output protection whenever a head is attached to
make sure it correctly set in output.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
2022-07-26 13:03:23 +03:00
Daniel Stone
b047f989a5 xdg-shell: Implement xdg-shell v5 capabilities event
This skips over xdg-shell v4, which can be implemented with no changes
as it's just another optional event.

v5 adds a capabilities event, which we send to inform clients of the
window manager's capabilities.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 12:09:04 +03:00
Daniel Stone
1541c44777 libweston-desktop: Add shell capability queries
Allow other components to query which window-management operations are
supported by the shell.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 12:09:04 +03:00
Daniel Stone
28caa08be6 Implement wp_single_pixel_buffer_v1 protocol
This protocol allows clients to create single-pixel RGBA buffers. Now
that we have proper support for these buffers internally within Weston,
we can expose them to clients.

This bumps the build container version, as we now depend on
wayland-protocols v1.26.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 10:26:55 +03:00
Marius Vlad
7fd22ae44d libweston/compositor: Check whether flushing is allowed
This patch acts as bandaid in the core compositor to avoid the renderer
doing a flush after the buffer has been released. Flushing after release
can happen due to problems in the internal damage tracking, is violating
the protocol, and causes visible glitches.

A more proper fix would be to handle compositor side damage correctly.

Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Daniel Stone <daniel.stone@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-07-15 12:55:30 +03:00
Marius Vlad
50f98b1006 backend-drm/state-propose: Amend an older comment
Since b38b735e20, 'backend-drm: Remove Pixman conditional
for keep_buffer' the Pixman renderer keeps its own reference to buffers
when attached to surfaces, rather than flipping keep_buffer variable for
the surface. Problem is that when switching from the Pixman render to
the GL would not work and could result in a crash upon first repaint.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-07-15 12:54:05 +03:00
Michael Olbrich
f5a4fb5abc backend-drm: make sure all buffers are released when an output is removed
When an output is destroyed then the output state is freed immediately. In this
case, the plane state is only partially destroyed because it is the currently
active state. This includes the buffer reference.

Without the output, the plane will not be updated any more until it is used by a
different output (if possible) or the output returns and the plane is used
again.
As a result, the buffer reference is kept for a long time. This will cause some
applications to stall because weston now keeps two buffers (the one here and
another one for a different output where the application is now displayed).

To avoid this, do a synchronous commit that disables the output. The output
needs to be disabled anyways and this way the current state contains no
buffers that would remain.

`device->state_invalid = true` in drm_output_detach_crtc() is no longer
needed, because drm_output_detach_crtc() is called only when initialization
failed and the crtc was not yet used or in drm_output_deinit() when the
crtc was already disabled with the new synchronous commit.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-07-04 18:42:48 +00:00
Marius Vlad
7932664b3b weston-log: Fix documentation for weston_log_subscription_create
Introduced with e0a858a5f2, commit 'weston-debug: Introduce
weston_log_subscription and weston_log_subscriber objects'. We don't
really return a weston_log_subscription so let's remove it.

Some newer doxygen detects this and we are treating warning as errors.

Fixes #594

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-07-01 17:20:18 +03:00
Daniel Stone
01c57eca43 backend-drm: Don't leak drm_device on shutdown
This was introduced in a partial MR, where the later commits in the new
multi-GPU MR fully fix it, but the initially cherry-picked ones don't.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Daniel Stone
97f664815d backend-wayland: Don't leak parent output trackers
We were only destroying these when the parent display removed the output
global. Do it on shutdown too, so we can avoid leaking it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 14:33:21 +01:00
Derek Foreman
23e3a3285a libweston-desktop: Add get_position
Plumb the new weston_desktop_api_get_position() through to xwayland.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Derek Foreman
d615abdffd shells: Add libweston-desktop API to query position and add to shells
We're going to need this to properly send xwayland events later, so add
API to get the current x,y co-ordinates of a shell surface and add it to
the kiosk and desktop shells.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-29 11:44:48 +00:00
Daniel Stone
450ec38d79 noop-renderer: Make sure buffer access doesn't get optimised out
noop-renderer needs to actually access the buffer content, to ensure
that the bad-buffer test works. This was previously done using a
volatile variable, but clang rightly pointed out that the variable
access had no effect (since the volatile stack variable was never read
from, and the source is not volatile), so 9b0b5b57dd changed it to be
explicitly marked it as unused to suppress the compiler warning.

Unfortunately suppressing the warning still leaves the compiler free to
optimise out the access.

Replace the variable decorations with actually using the result of the
read, so we can be really sure that it's never going to be optimised
away.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 11:38:36 +00:00
Daniel Stone
19278569a3 noop-renderer: weston_buffer properties are set by the core
ca9bb01fe6 made it so that we already set shm_buffer, width, height,
etc, in the core. There's no need for the renderer to do this.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-29 11:38:36 +00:00
Hideyuki Nagase
e4100f856d xwayland: Change layer for xwayland override redirect windows
Our positioning of override redirect windows falls apart when an
app is on the fullscreen layer, because we end up putting its
menus and tooltips beneath it. This patch raises the special
override redirect layer to be just below things like on-screen
keyboards (and, unfortunately, above things like panels).

There is no perfect way to deal with this problem, especially
for content like tooltips that don't come with transience hints.

In some cases override redirect menus could be better placed by
using the parenting/transience information provided with them
at map time, and we should probably do that at some point, but
that would still leave us with tooltips below full screen
applications, and the need for this layer change.

based on a patch
Co-authored-by: Hideyuki Nagase <hideyukn@microsoft.com>
Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>

I changed the layer position and the comments, so:
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-28 11:37:54 +00:00
Daniel Stone
9336263d9b Move libweston-desktop into libweston
It's not really useful to have libweston without libweston-desktop. It's
also very little code.

Merging both into the same DSO will allow us to cut out a bunch of
indirection and pain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-28 10:35:52 +00:00
Daniel Stone
0774a321c5 scene-graph: Print when surface/view is not mapped
A view shouldn't be mapped if a surface isn't mapped, and it shouldn't
be in the scene graph if it isn't mapped either. Print when this happens
so you can see more from the debug.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-28 10:35:52 +00:00
Michael Olbrich
10403a85ec libweston: disable a pending idle_repaint_source when the output is removed
Currently the idle_repaint_source is removed when the output is destroyed.
This covers the most common case: When a monitor is unplugged then the
corresponding DRM output is destroyed and not just disabled.

However, outputs can be explicitly disabled by the shell. In this case the
output is not removed and idle_repaint() may be called for a removed
output.

Remove the idle_repaint_source in weston_compositor_remove_output() to fix
this. And reset the variable to ensure that the source can be created
again.

Removing the source in weston_output_release() is now no longer necessary
since it calls weston_compositor_remove_output().

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-06-27 09:03:09 +00:00
Michael Olbrich
48e8c158ea compositor: only reflow the outputs if the shell did not move them
weston_compositor_reflow_outputs() assumes that all output are positioned from
left to right with no gaps in the same order in which they where created.

If the shell moves an output with weston_output_move() then this assumption is
no longer true. So stop reflowing the outputs in the case. The shell is now
responsible for positioning all outputs as needed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-06-23 18:02:00 +00:00
Michael Olbrich
2929b6c483 backend-drm: check that outputs are in fact ours
This is another followup to ffc011d6a3
("backend-drm: check that outputs and heads are in fact ours") which missed
some places.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-06-23 14:00:04 +00:00
Pekka Paalanen
57d32722a2 gl-renderer: simplify main() in frag
By moving the application of view_alpha after pre-multiplication we can
simplify main() considerably.

The cost is that for straight-alpha input or color_pipeline() we might
be doing three multiplications more than before. However,

 a) the cost of running color_pipeline() probably dominates anyway, and
 b) to get straight-alpha input you have to use a future Wayland
   extension that probably won't be advertised without color management.

So we keep the optimization for the simple case (no color management)
while potentially incurring a small cost on the heavy case (with color
management).

Thanks to Pierre-Yves Mordred for the inspiration in
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/889#note_1411774

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-22 12:15:58 +00:00
Pekka Paalanen
932c374779 gl-renderer: move undo-premult to color_pipeline()
Now that we have the if-else ladder to call color_pipeline() only when
necessary, and since only color_pipeline() needs undo-premult, move
undo-premult into color_pipeline().

This is a small step towards improving code readability.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-22 12:15:58 +00:00
Pekka Paalanen
924b94bc94 gl-renderer: call it view_alpha in frag
We always talk about "view alpha", so the name variable in the fragment
shader the same. Now it's clear without the comments, making the code
easier to read overall.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-22 12:15:58 +00:00
Ivan Nikolaenko
0d3e438d08 build: fix possible race/error for some backends
There is missing dependency on linux-dmabuf-unstable-v1-server-protocol.h
header file in backend-headless, backend-drm and backend-x11. That files
do not depend on that header, in fact. But by this moment they've had
that implicit dependency due to linux-dmabuf.h header.

With specific set of meson configure options the protocol header is not
generated at the right time, what causes build error in 100% cases using
small amount of building threads (from -j1 to -j8).

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
2022-06-20 16:14:01 +03:00
Michael Olbrich
78933093a1 backend-drm: check that outputs are in fact ours
This is a followup to ffc011d6a3
("backend-drm: check that outputs and heads are in fact ours") which missed
some places.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-06-16 09:53:01 +00:00
Michael Olbrich
3e44a6eb3d backend-drm: don't try to disable planes on session deactivation
This uses the legacy DRM API it incomplete and no longer works anyways.
At this point, weston is no longer DRM master, so these calls fail with
"Permission denied".

So just remove the corresponding code.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-06-16 09:53:01 +00:00
Daniel Stone
f962b48958 compositor: Only create paint nodes for mapped surfaces/views
If a surface or a view is not mapped, then we should not be trying to
paint it. Check if this is the case and ensure that we only insert
paint nodes for mapped surfaces & views.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: #621
2022-06-16 12:17:15 +03:00
Daniel Stone
0c69688aa2 libweston: Add weston_surface_map() wrapper
Change all instances of surface->is_mapped = true, to a specialised
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone
51fe874ad4 libweston: Use weston_surface_has_content() in core compositor
Used when taking the size from a buffer, as well as in subsurface
handling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone
dd6b5a190e data-device: Use weston_surface_has_content()
Now we've got a wrapper which tells us whether or not the surface has
valid content, use it.

The 'XXX' comment was removed because it's the same pattern as every
other surface-role implementor: if the surface is not mapped but does
have valid content, then map it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone
13ead893e2 Add weston_surface_has_content()
Just a trivial wrapper to tell you whether or not the surface has valid
content.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Pekka Paalanen
d24adbbe25 backend-drm: set connector max bpc
"max bpc" property is meant for working around faulty sink hardware.
Normally it should be set to the maximum possible value so that the
kernel driver has full freedom to choose the link bpc without being
artificially forced to lower color precision.

The default value is 16 because that is a nice round number and more
than any link technology I've heard is using today which would be 12.

Also offer an API set the value, so that weston.ini could be used in the
next patch for sink workaround purposes.

Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/612

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-15 12:58:38 +00:00
Philipp Zabel
c6e47d177a libweston: consolidate weston_compositor_create_output(_with_head)
Add a struct weston_head parameter to weston_compositor_create_output()
and fold weston_compositor_create_output_with_head() into it.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Philipp Zabel
060ef82d93 backend-x11: check that outputs and heads are in fact ours
As a first step towards heterogeneous outputs, ignore other backends'
heads and outputs. This is done by checking the destroy callbacks for
heads and outputs.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Philipp Zabel
69c4cec4f1 backend-wayland: check that outputs and heads are in fact ours
As a first step towards heterogeneous outputs, ignore other backends'
heads and outputs. This is done by checking the destroy callbacks for
heads and outputs.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Philipp Zabel
5b41ffa9da backend-rdp: check that outputs and heads are in fact ours
As a first step towards heterogeneous outputs, ignore other backends'
heads and outputs. This is done by checking the destroy callbacks for
heads and outputs.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Philipp Zabel
5159af0607 backend-headless: check that outputs and heads are in fact ours
As a first step towards heterogeneous outputs, ignore other backends'
heads and outputs. This is done by checking the destroy callbacks for
heads and outputs.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Philipp Zabel
ffc011d6a3 backend-drm: check that outputs and heads are in fact ours
As a first step towards heterogeneous outputs, ignore other backends'
heads and outputs. This is done by checking the destroy callbacks for
heads and outputs.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Philipp Zabel
aab722bb17 backend-drm: prepare virtual output API for heterogeneous outputs
Stop plugins from overwriting the struct weston_output::destroy vfunc,
as that will be used by backends to recognize their outputs.
Instead, pass a plugin-specific destroy callback when creating the
virtual output.

See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2022-06-10 09:27:43 +00:00
Derek Foreman
982e59a942 rdp: Stop using deprecated functions
The get file descriptor functions are being deprecated and a two step
process of getting handles and then getting the descriptors for the
handles is being used instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-09 13:17:03 +00:00
Derek Foreman
5014eb03a3 rdp: Update to new FreeRDP structure layout
In an upcoming release the old style will be deprecated, so let's update
now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-09 13:17:03 +00:00
Derek Foreman
da386c827e rdp: Update to newer FreeRDP release
Update to a newer FreeRDP release so we can start cleaning up
some of our usage of things that will be deprecated in the next
major release.

For this, I've simply picked the newest version currently in
our CI images.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-09 13:17:03 +00:00
Luigi Santivetti
8b654c47eb Revert "backend-drm: add HDR_OUTPUT_METADATA definitions"
This reverts commit 6914064066.

This is a follow-up change of b623fd2a ("drm-backend: stop parsing IN_FORMATS
blobs, use libdrm instead"). Weston now has a hard-requirement on libdrm
2.4.108, clean up remaining and unnecessary conditional code. Change 69140640
("backend-drm: add HDR_OUTPUT_METADATA definitions") is no longer needed
and stop including libdrm-updates.h from kms-color.c.

Signed-off-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
2022-06-07 09:35:14 +01:00