Commit graph

8098 commits

Author SHA1 Message Date
Marius Vlad 49d6532254 shared/xcb-xwayland: Split into common helpers
Avoid duplication of atom retrieval. This is particuarly useful
if one would one to reuse atom retrival in other parts, like tests.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
2022-06-22 08:08:41 +00:00
Derek Foreman 107d69f10c xwayland: Stop drawing shadows on maximized windows
This is especially weird on multi-head setups, but we shouldn't be doing
it in any cases.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +00:00
Derek Foreman 8763f3800e xwayland: Update net_wm state when we change it.
According to the wm-spec we must keep the _NET_WM_STATE property updated
to reflect the current state of the window.

This has been biting me when firefox starts maximized, then I click the
maximize button to toggle to unmaximized state. The next time I mouse over
the maximize button (which causes the frame to be re-rendered with the
maximized button in a highlighted state) we re-read the window state and
weston then believes the window is maximized even though it is being
rendered in a not-maximized state.

Update the state when we change maximized status so this doesn't happen.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +00:00
Derek Foreman 93b58c5648 xwayland: Don't move window in response to geometry change if state changed
When we leave fullscreen or maximized mode we restore a saved window
position. This is expected, but that saved position was saved when window
geometry was set to have shadows rendered.

Since we restore a saved position that had shadow geometry, we don't want
to move the window when we set geometry again, or we'll move away from the
intended saved position.

I guess this is a counter-proposal to !614

Fixes #454

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +00:00
Derek Foreman 40e76fe19d xwayland: Set non zero default saved window size
If a client starts off maximized, clicking the unmaximize button would
result in a 0x0 window - basically a blob of decor with no content.

Instead, use 512x512 as a totally random default value.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-20 16:57:48 +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 f1fe6ec776 xdg-shell: Mark xdg_popup surfaces as mapped
Keep the surface map state in sync with the buffer state: the surface
can be mapped it has a valid buffer, and not if it doesn't.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone c0ff9ed24a test-desktop-shell: Mark weston_curtain views as mapped
Make sure we're there when we need them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone 19744a5207 weston-curtain: Always mark surface as mapped
The surface always has valid content, hence it can always be mapped.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone af7dcdddac desktop-shell: Map surfaces in map()
The only caller of map() then manually sets is_mapped = true. Just do it
in the function which makes you think that's what it would do.

Signed-off-by: Daniel Stone <daniels@collabora.com>
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 888d08d8a5 desktop-shell: Use weston_surface_has_content()
Now we've got a wrapper which can tell us whether or not a surface has
content, use it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-16 12:17:15 +03:00
Daniel Stone d211e3173c xdg-shell: Use weston_surface_has_content()
Now that we've got a wrapper telling us whether or not the surface has
content, just use 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 f212a703cf tests/alpha-blend: use image-iter.h
Simplify the code by using ready-made helpers.

No change in behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 67331be0cd tests/internal-screenshot: use image-iter.h
Simplify the code by using ready-made helpers.

This also change the loop to draw the image row by row rather than
column by column. Row by row is more natural as it is linear with the
memory layout. No other change in behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 884c5f80e8 tests/yuv-buffer: use image-iter.h for rgb_image
Make use of the shared code instead of open-coding everywhere. This
should make the code easier to read, and reduce the chance of typos if
changes are needed in the future.

No change in behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 94589497a1 tests/client-helper: use image_header_from() more
These are the last places in weston-test-client-helper.c where using
image_header_from() will reduce the code line count and simplify the
code a little.

No change in behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 791a6be216 tests: pass image_header to image_check_get_roi()
Make use of the new type to shorten the code.

No change in behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 4eb70a602b tests/client-helper: use image-iter.h
Replace private pixel iterator helpers with the shared ones.

No change in behaviour.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 9b82bfae9e tests/color-icc-output: extract image-iter.h
Move the struct image_header and get_image_prop() into a header where we
can share these useful helpers between more test code. While doing that,
drop the unused field 'depth', rename into image_header_from(), and
introduce a helper to get u32 pointer to the beginning of a row. These
helpers should make pixel iterating code easier to read and safer (less
room for mistakes in address computations, and asserts).

Use the shared 'struct image_header' instead of the local one. The
intention is to make the code easier to read by using the same helpers
everywhere.

Width, height and stride use type 'int' because Pixman API uses that
too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 8de94ec9c9 compositor: add weston.ini option max-bpc
For working around hardware limitations as explained in the man page.
Now added for completeness' sake without knowing if anyone will ever
need this.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-15 12:58:38 +00: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
Pekka Paalanen 4d2ea5dd0b tests: move set_opaque_rect() to client helpers
I will be needing it in a new test, so let's share it.

For convenience, this also adds client back-pointer in struct surface so
that I don't need to pass client explicitly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-15 12:36:05 +03:00
Pekka Paalanen b878357dfd tests: remove skip() as unused
skip() is a left-over from an old test harness design, the comment even
refers to automake. Calling skip() cannot do anything good anymore,
because it wouldn't print the skips in the TAP report, so it would
probably be considered a failure.

Delete this unused and nowadays incorrect function, so it doesn't
confuse people.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-15 12:36:05 +03:00
Robert Mader f7541d9e42 clients/simple-egl: Fix angle reset on benchmark interval
Commit 62ab6891db intended to change the angle calculation
so that the a time delta since the first frame would be used
instead of the absolute time. That was done in order to ensure
the angle would always start with the same value, allowing users
to differentiate left and right, which again is needed when
testing flipped transforms.

However, the `benchmark_time` variable is unsuitable for that
purpose as it gets reset on each benchmark interval, abruptly
changing the angle.

Thus introduce a dedicated variable.

Fixes 62ab6891db

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2022-06-14 13:11:59 +02:00
Hideyuki Nagase ae9643f729 build: enable configuration of RDP backend as a default
Add RDP to the list of backends we can set as default for use
when weston is launched without display/socket environment vars
set.

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-06-10 10:57:22 +00:00
Pekka Paalanen 731a2fd45b tests/color-icc-output: move gen_ramp_rgb() in the file
Move gen_ramp_rgb() down in the file where the TEST() specific code
begins. This way we first have a big block of fixture setup code which
creates an ICC profile, and the next big block is the actual test client
code. gen_ramp_rgb() belongs with the latter.

This makes the file structure slightly more logical.

This is a pure code move, no changes at all.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-10 10:49:47 +00:00
Pekka Paalanen cb38c9c84d tests: rename shaper_matrix_and_cLUT to opaque_pixel_conversion
This name describes better what this test does. In the future another
TEST() for alpha blending will be added. Both of them will be using
matrix-shaper and cLUT output profiles.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-10 10:49:47 +00:00
Pekka Paalanen 6393e43357 tests: rename color-shaper-matrix-test.c to color-icc-output-test.c
The new name better matches the contents of the test.

Currently the test creates output ICC profiles with matrix-shaper and
cLUT forms, and tests that basic color conversion from input to output
color space is correct.

The common theme in this test program is to create ICC profiles to be
used as output profiles. In the future this can include more kinds of
testing, e.g. linear blending. OTOH, this test program will always be
limited to SDR because HDR testing probably will not use ICC files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-10 10:49:47 +00:00
Philipp Zabel 4938f8f6e5 compositor: stop creating outputs without head
To support heterogeneous outputs, the output must be created by the
same backend as the head(s) it is created for. Solve this by always
creating an output with a first head to attach that determines the
backend to use. Skip already attached first heads in drm_try_attach().

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 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
Philipp Zabel 54d7682ee8 libweston: add opaque backend_id pointer to struct weston_head
As a first step towards heterogeneous outputs, add an opaque pointer
weston_head::backend_id that will be used by backends to identify
their own heads.

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
Derek Foreman 2afb812d1e shared/cairo-util: Hold onto our pattern reference until we're done
This doesn't actually fix a bug - cairo refcounts this. But I
really don't like the look of code that drops a reference then
continues to use it.

While we're here, set a different pattern when we're done so the
one we allocated loses its last reference.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-06-09 12:29:46 +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
Luigi Santivetti a62bf5ff48 drm-backend: stop parsing IN_FORMATS blobs, use libdrm instead
Before this change the drm-backend in Weston did the work of parsing DRM
blobs in order to query IN_FORMATS data, if available. This is also the
case for other DRM/KMS clients that use IN_FORMATS (i.e. X).

libdrm 2.4.108 with e641e2a6 ("xf86drm: add iterator API for DRM/KMS
IN_FORMATS blobs") introduced a dedicated API for querying IN_FORMATS data.

Bump the minimum required version to 2.4.108, stop parsing IN_FORMATS in
Weston and start using DRM iterators. In addition, remove fallback code for
libdrm <2.4.107.

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