There are some places where we can make some cosmetic changes
to make code simpler and easier to read. Make these cosmetic
changes. Note that they do not change the code behavior.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The code to init/deinit scanout and cursor planes was in
drm_output_init() and drm_output_deinit(). Move this code
to specific functions drm_output_init_planes() and
drm_output_deinit_planes(), as it makes the code clearer
and easier to maintain.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Now that we have a CRTC list in the DRM-backend, we can
iterate through it and look for the CRTCs that do not have
assigned outputs in order to find unused CRTCS.
So we can drop unused_crtcs from struct drm_backend and also
drop the functions drm_backend_update_unused_outputs() and
wl_array_remove_uint32().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
There are no 'struct drm_output' for CRTCs that are not active.
Also, CRTC data lives in 'struct drm_output'. This is causing
us some trouble, as the DRM-backend needs to program those
unnactive CRTCs to be off.
If the DRM-backend had the reference for every CRTC (being
active or not), it would make certain functions (e.g.
drm_pending_state_apply_atomic()) more simple and efficient.
Move CRTC data from 'struct drm_output' to 'struct drm_crtc',
as this is the first step to allow the DRM-backend to have
references for every CRTC.
Also, add list of CRTCs to DRM-backend object. Now the
DRM-backend is responsible for allocating/deallocating the CRTC
objects. The outputs will only reference, init and fini the CRTCs
in this list.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Currently doesn't exist a standard way to write a weston.ini inside a test.
Here, two new functions `weston_ini_setup` and `cfgln` are introduced to
help the test writer to write a weston.ini file and load it to the test.
And `internal-screenshot-test` is converted to use the new method of write
a weston.ini. This conversion serves as example and initial API test.
The tester needs to call `weston_test_harness_execute_as_client` or
`weston_test_harness_execute_as_plugin` in the same way as before.
The `weston_ini_setup` will fill the setup->config_file with the
correct path to the weston.ini file.
The main design goal is to avoid pre-made or build-made weston.ini(s)
and keep the test as self-contained as possible.
Closes:#410
Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
Try to make drm_output_state_propose a little more clear by reducing
divergence between plane and renderer modes towards the end, removing
a possibly-surprising conditional continue.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reduce the scope of surface_overlap to where it's actually used, which
is only in the per-view loop, where it gets initialised and destroyed
every time.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Previously we assumed that cursor planes occluded nothing and would
always be blended, but overlay and scanout planes would always occlude
what's behind them. This is not actually true, as we can support alpha
blending on any kind of plane type now.
Remove the special case, which might hopefully fix some weird display
issues along the way. (Noticed by inspection.)
Signed-off-by: Daniel Stone <daniels@collabora.com>
We used to use planes_region for the output regions which were being
displayed on hardware planes; before we grew zpos awareness, we couldn't
have any planes overlapping with each other, since the ordering would be
undefined.
Since the zpos awareness though, this region is unused, so we can just
remove it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The opaque region is used to determine where the views underneath the current
view must be drawn. If the opaque is not clipped, then the area that is part of
the opaque region but not part of the scissor area is not drawn at all.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Subsurfaces inherit the scissor region from the parent surface. Currently
the region is updated at the end of weston_view_update_transform(). As a
result, the old region is used to clip the transform.boundingbox of the
subsurface.
Change the order to update the scissor region after the transform.matrix is
updated but before it is used.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
directory
Weston is also a user of the plug-ins, so make use of it. With this
change we unconditionally install the plug-in headers even though
libweston might not be built with support for them.
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Just like pipewire, add DPMS support in remoting plug-in. Mechanical
change mimicking a24a326bb1.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
After some changes in the exposay layout, the outer padding makes
no sense anymore. It was used to avoid the panel to get overlapped
by the exposay surfaces and to keep distance from the borders
of the window.
Currently, the exposay is centralized and the panel cannot get
overlapped. The outer padding just creates unnecessary unused
space, what makes exposay's surfaces smaller.
Delete outer padding from struct exposay_output.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
The exposay grid is square, but we don't always have enough surfaces
to fill all the columns of the last row. The code to centralize
the surfaces of the last row is not working.
Fix the code that centralizes the surfaces in the last row, making
it more visually pleasant.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Commit "exposay: add margins to centralize exposay" has centralized
the whole exposay, but that's not enough. The internal surfaces of
exposay are not centralized.
Each internal surface of exposay is a square, but most of the windows
are rectangular. Add margin to centralize exposay's surfaces in their
own square.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
The exposay is being rendered in the top-left corner of the
screen. Add margins to render it in the center, making it
more visually pleasant.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
We've been using an inner border of fixed size (80px), but this
is dangerous. If you have too many open applications or a small
window, the surface size computed will be negative, crashing
the exposay: "error: weston_view transformation not invertible".
Also, it creates a lot of unnecessary space, making the exposay
unusable when we have a small window or many applications open.
Make inner border to be 10% of surface size and surface size to
be 90% of its original size, avoiding the crashes and making it
more visually pleasant.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Commit "desktop-shell: make get_output_work_area() global" allowed
the usage of get_output_work_area() in exposay. This is necessary to
avoid overlapping the panel when rendering exposay's surfaces.
Use get_output_work_area() to not take into account the panel size,
instead of considering that the whole screen is available to
render exposay's surfaces.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
get_output_work_area() can be used by exposay to know the free space
where it can render its surfaces, what avoids overlapping the panel.
Currently this function is declared as static in
desktop-shell/shell.c, so it cannot be used by exposay.
Remove static from get_output_work_area() and add it to shell.h
so it can be used by exposay as well.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
In exposay_layout(), int pad is being calculated within the
loop. This is unnecessary, as its value is constant. Move it
out of the loop.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
As from commit b7e5f10bf4, weston_view_is_opaque() is called from
debug_scene_graph_cb(), which on its own represents a (different)
scope. By default, we already have a subscriber for the 'log' scope,
which will cause a harmless, yet spurious, message.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Pipewire doesn't need to wait for any hardware. The finish_frame() callback is
just artifically delayed to generate the desired framerate.
So when the DPMS level changes, we can just call finish_frame() immediately if
necessary and cancel the timer.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Initially finish_frame() was never called in drm_output_update_complete() for
'dpms_off_pending = true'. This is wrong for repaint_status ==
REPAINT_AWAITING_COMPLETION and that was fixed in
68d49d772c ("compositor-drm: run finish_frame when
dpms is turned off in update_complete").
However finish_frame() may now be called for repaint_status !=
REPAINT_AWAITING_COMPLETION, which is not allowed and results in a failed
assertion.
Fix this by checking dpms and repaint_status unconditionally.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
It seem that we skipped to put back in TEXT mode the tty, in case a DRM
device node wasn't present at that time, or it isn't present at all. This
orders the destroy part correctly as to handle that case as well.
As a side effect, as the tty will still be set to GRAPHICS mode we will
require a manual change of the tty number, which might be not possible
on all systems. Properly putting back the tty to TEXT mode should avoid
that, and allows to re-use the same tty no in case the DRM device has
been created at a later point in time.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
In case of a crash tty remains in graphic mode. This change allows to restart weston without
taking care of the actual tty mode.
Signed-off-by: ahe <Andreas.Heynig@meetwise.com>
Allow to disable GBM modifiers at runtime using the environment variable
WESTON_DISABLE_GBM_MODIFIERS.
This can be useful for debugging or when modifiers cause issues, e.g. in
case modifiers use higher memory bandwidth and hence impose a lower
resolution limit as it is the case with Intel Kaby Lake graphics.
Related to: https://gitlab.freedesktop.org/wayland/weston/-/issues/404
Signed-off-by: Stefan Agner <stefan@agner.ch>
The pipewire plugin uses this API as well, not just the remoting plugin. So
enable it if either is enabled.
And disable pipewire in the no-gl-renderer CI build. The virtual outputs don't
work without it.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
The opaque region of a weston view is updated only if the alpha value is 1
and the transform matrix is of type WESTON_MATRIX_TRANSFORM_TRANSLATE.
While using ivi-shell, opaque region is never updated, as we are performing
scaling operations to the view transform matrix, even when the scaling
factor is 1 and thereby changing the type to WESTON_MATRIX_TRANSFORM_SCALE.
Perform scaling of the view transformation matrix only when the scaling
factor is non-zero.
Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
If a surface is not visible, then is does not matter if the view is on multiple
outputs. It will be skipped anyways when the output is rendered.
So check first if the surface is acually visible on the output before doing any
checks that might force rendering. This avoids unnecessary rendering.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
When dissociating a universal plane from a crtc, we currently don't
reset the current state of the plane (plane->state_cur). When attempting
to use this plane in the future, we can run into invalid memory accesses
due to left over associations with potentially freed drm backend
objects. This commit resets the state of the scanout and cursor
universal planes associated with a crtc.
The following scenario exhibits the problem:
1. Start a (fullscreen) client that is suitable for and assigned to
the scanout plane. The plane's state_cur->output value is set.
2. Unplug the monitor: the scanout plane is "released" but still
maintains the state_cur->output association.
3. Replug the monitor: the plane is deemed unavailable due to an
existing, albeit invalid, state_cur->output value. Note the memory
errors trying to access the drm_output which was freed at step (2).
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
weston-info is now deprecated in favor of wayland-info which is part of
wayland-utils.
Add a note to weston-info to inform users that weston-info is deprecated
and will be removed soon.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
compositor_accumulate_damage() is called for each output during repaint.
The DRM backend will only set keep_buffer for the surfaces that are visible on
the current output. So a buffer_ref is released that may still be needed. When
the output that shows the surface is repainted, the buffer_ref is gone and the
surface cannot be put on a plane.
Ignore all surfaces that are not visible on the current output to avoid this.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Currently the debug output for 'drm-backend' can be confusing. In the output of
debug_scene_view_print() views may be listed as 'not opaque' but later, during
plane assignment, other views underneath such a view is reported as 'occluded on
our output'.
This happens because weston_view_is_opaque() has some extra checks to determine
if a view is fully opaque, such as 'is_opaque' provided by the renderer for
formats that have no alpha channel.
Use weston_view_is_opaque() in debug_scene_view_print() as well to get more
accurate results.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
kiosk-shell is fullscreen shell for apps that use the xdg-shell
protocol. The goal is to make life easier for people shipping embedded
devices with simple fullscreen shell requirements, and reduce the
proliferation of desktop-shell hacks.
Top level surfaces are made fullscreen, whereas dialogs are placed on
top in the center of the output and retain their natural sizes. Dialogs
can be moved and (un)maximized, but resizing is currently not supported.
An app can be directed to a particular output by populating the
"app-ids" field with the app's XDG app id, in the relevant
"[output]" section in the weston config file.
Fixes: #277
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
There's a log that advertises support for universal planes. That
can make users think there's something wrong with Weston or their
systems when universal planes are not supported, but that's not
the case. Remove this log from the code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>