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>
It's not the most code ever, but it does make desktop-shell somewhat
more complicated for questionable (i.e. no) end-user benefit.
When desktop-shell is back in more healthy shape it could potentially be
reintroduced, but for now it's just making it more difficult to reason
about desktop-shell and fix it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
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>
Particularly important was _XWAYLAND_ALLOW_COMMITS atom which caused
some annoying flicker when resizing or hoovering over buttons.
This was introduced with 'shared/xcb-xwayland: Split into common
helpers' and somehow I missed those atoms.
Fixes 49d6532254
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
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>
https://specifications.freedesktop.org/wm-spec/1.4/ar01s05.html says
"The Window Manager MUST set _NET_FRAME_EXTENTS to the extents of the
window's frame", so this is probably something we should be doing.
Some programs (such as some versions of Firefox) expect this to be present,
and will render popups in wrong locations if it's not.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We need these values to calculate frame extents to properly set
_NET_FRAME_EXTENTS, but we don't want to calculate them twice.
Break out these bits from frame_resize_inside, and update it to use
the new function.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Instead of closing the window directly by calling close_handler() use a
deferred task to do that instead.
That way we avoid a potential invalid access on a link which was
previously removed, due to the fact both window_destroy() and
touch_handle_up() traverse the same list.
This is an alternative to 841.
Fixes: #607.
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Reported-by: He Yong <hyyoxhk@163.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
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>
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>
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>
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>
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>
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 !614Fixes#454
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>