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>
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>
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>
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>
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>
The core Wayland protocol explicitly states that wl_keyboard.modifiers
must be send after wl_keyboard.enter.
This commit also changes the behavior of `seat_get_keyboard` to not
send `wl_keyboard.modifiers` in case where seat had pointer focus,
but not keyboard one.
Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
Launcher-direct does not allow us to run using a different
seat from the default seat0. This happens because VTs are
only exposed to the default seat, and users that are on
non-default seat should not touch VTs.
Add check in launcher-direct to skip VT/tty management if user
is running on a non-default seat.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Surface roles are permanent, so it should not be cleaned up.
Fixes: #409
weston: ../libweston/compositor.c:4094: weston_surface_set_role: Assertion `role_name' failed.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
When there's neither configless nor surfaceless EGL extension
(i.e. not a Mesa driver), Weston falls back to a dummy pbuffer surface.
Weston attempts to find for that surface an EGL config but uses a NULL
array of pixel formats. This fails with the following messages:
EGL_KHR_surfaceless_context unavailable. Trying PbufferSurface
Found an EGLConfig matching { pbf; } but it is not usable because
neither EGL_KHR_no_config_context nor EGL_MESA_configless_context
are supported by EGL.
failed to choose EGL config for PbufferSurface
EGL error state: EGL_SUCCESS (0x3000)
Failed to initialise the GL renderer;
Signed-off-by: Tomek Bury <tomek.bury@broadcom.com>
This moves the creation of the blob to be earlier, to when the damage is
calculated. It replaces the damage tracked inside of the plane state
with the blob id itself.
This should stop creating new blob ids for TEST_ONLY commits, and them
being leaked in general, as the blob ids are now freed with the plane
state.
The FB_DAMAGE_CLIPS property is now always set if it's supported, and
will be 0 in the case that we have no damage information, which
signifies full damage to the kernel.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
In the test suite we may want to run a DRM-backend test on a
non-default seat, which may not have a input device associated.
Weston's default behavior is to not open if input devices are
not found, as it may cause troubles. For instance, Weston can
open but if no input device is set than the user can not
interact or leave it.
Add flag --continue-without-input to DRM-backend so we can run
these types of tests with no input. Notice that this won't force
the compositor to skip opening a input device if it finds it on
the non-default seat.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
All timeline event timestamps are in CLOCK_MONOTONIC already. DRM KMS
timestamps are practically guaranteed to be CLOCK_MONOTONIC too, even though
presentation clock could theoretically be something else. For other backends,
the presentation clock is likely CLOCK_MONOTONIC_RAW due to
weston_compositor_set_presentation_clock_software().
This patch ensures that the recorded vblank timestamp is in CLOCK_MONOTONIC.
Otherwise interpreting the timeline traces might be difficult to do accurately,
since it would be hard to recover the relationship between the presentation
clock and timeline event timestamps.
The time conversion routine is the simplest possible, I don't think we need any
more accurate conversion for timeline purposes. Besides, DRM-backend is the
only backend where the timings actually matter, the other backends are
software-timed anyway.
Since the clock domain of the "vblank" attribute potentially changes, the
attribute is renamed. Wesgr never used this attribute.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using the number of planes to determine if GL_TEXTURE_EXTERNAL_OES should be
used is incorrect with some modifiers: For example RGBA with a
I915_FORMAT_MOD_Y_TILED_CCS modifier has two planes.
Use eglQueryDmaBufModifiersEXT() to query if the current format/modifier only
supports GL_TEXTURE_EXTERNAL_OES.
Use the current code as fallback of modifiers are not supported.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
If a surface has subsurfaces then the surface itself is in the subsurface
list. To avoid printing it again there is a check to skip the child view,
if it is the same as the current view.
However, this fails when a surface with subsurfaces has two (or more) views:
The check to skip the parent fails for the other view and the two views are
printed again and again until a stack overflow occurs.
So instead check if the parent view of the subsurface view is the current
view. This way, any view that does not belong to a real subsurface is
skipped.
As a side effect, this ensures that each view of the subsurfaces is only
printed once at the correct place in the hierarchy.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Without universal plane, the weston crashes with null pointer access in
set_gbm_format function because that function called before output
enable function. By changing timing to set color format for primary
plane in this case, this issue fixes.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
pixman_renderer_output_create currently takes a flags enum bitmask for
its options. Switch this to using a structure, so we can introduce other
non-boolean options.
Signed-off-by: Daniel Stone <daniels@collabora.com>
gl_rendererer's output_pbuffer_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.
Signed-off-by: Daniel Stone <daniels@collabora.com>
gl_rendererer's output_window_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.
Signed-off-by: Daniel Stone <daniels@collabora.com>
gl_rendererer's output_create has a lot of arguments now. Add a
structure for the options to make it more clear what is what.
This is in preparation for adding bare-integer arguments which are ripe
for confusion when passing positional arguments.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The renderer buffer size is usually the same size as the current mode,
so we were taking the dimensions from the currently-set mode. However,
using current_mode is quite confusing in places when it comes to scale,
and it also hampers our ability to do mode switches, as well as to
introduce a future option which will let the renderer use a smaller
buffer than the output and display scaled.
Simply take the dimensions of the renderer's output buffer from the
buffer itself.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This condition inside drm_output_render() checks if we can reuse the
existing renderer buffer for the primary plane; this occurs in
mixed-mode composition where a client buffer promoted to a plane has
changed, but the primary plane is unchanged.
We accomplish this by checking if there is no damage on the
primary/renderer plane, and then if there is already a renderer buffer
active on the primary plane: in that case, we can reuse the buffer we
already have.
There was a further condition checking if the width and height were
identical. This was designed to prevent against issues on mode changes.
However, runtime mode changes are already quite broken, and a mode
change will also cause damage on the full plane. We can simply remove
this condition.
Signed-off-by: Daniel Stone <daniels@collabora.com>
In order to start the repaint loop, the Wayland backend tries to damage
the full SHM buffer, but doesn't actually damage the full area if we
have a frame.
Store the buffer's width and height alongside the buffer itself, so we
can damage the full area when required.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When weston-desktop-shell uses a solid color for the wallpaper, it creates a
1x1 buffer and uses wp_viewport to scale that up to fullscreen. It's a very
nice memory saving optimization.
If you also have output scale != buffer scale, it means pixman-renderer chooses
bilinear filter. Arguably pixman-renderer should choose bilinear filter also
when wp_viewport implies scaling, but it does not. As w-d-s always sets buffer
scale from output scale, triggering the bilinear filter needs some effort.
What happens when you sample with bilinear filter from a 1x1 buffer, stretching
it to cover a big area? Depends on the repeat mode. The default repeat mode is
NONE, which means that samples outside of the buffer come out as (0,0,0,0).
Bilinear filter makes it so that every sampling point on the 1x1 buffer except
the very center is actually a mixture of the pixel value and (0,0,0,0). The
resulting color is no longer opaque, but the renderer and damage tracking
assume it is. This leads to the issue 373.
Fix half of the issue by using repeat mode PAD which corresponds to OpenGL
CLAMP_TO_EDGE. GL-renderer already uses CLAMP_TO_EDGE always.
This is only a half-fix, because composite_clipped() cannot actually be fixed.
It relies on repeat mode NONE to work. It would need a whole different approach
to rendering potentially non-axis-aligned regions exactly like GL-renderer.
Fixes: https://gitlab.freedesktop.org/wayland/weston/issues/373
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The KMS 'panel orientation' property allows the driver to statically
declare a fixed rotation of an output device. Now that weston_head has a
transform member, plumb the KMS property through to weston_head so the
compositor can make a smarter choice out of the box.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches]
Signed-off-by: Daniel Stone <daniels@collabora.com>
Like physical size, subpixel arrangement, etc, transform advises of a
physical transform of a head, if present.
This commit adds the transform member and setter to weston_head, however
it is currently unused.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches.]
Signed-off-by: Daniel Stone <daniels@collabora.com>
b_lundef was overriden for the RDP backend since it triggered linking
errors due to functions that were defined in a missing dependency. This
issue was fixed, so the override is removed. The global project's
linker parameters are now applied to the RDP backend.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
The RDP backend uses functions defined by the Windows Portable Runtime
library (WinPR). The library's code is contained within FreeRDP
repository, but it is packaged as its own library (seperate pkg-config
file).
WinPR is added as a dependency to the RDP backend. The version 2.0 is
choosen as the version to on since the backend depends on FreeRDP 2.0.
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
It was discovered in issue #99 that the implementations of the 90 and 270
degree rotations were actually the inverse of what the Wayland specification
spelled out. This patch fixes the libweston implementation to follow the
specification.
As a result, the behaviour of the the weston.ini transform key also changes. To
force all users to re-think their configuration, the transform key values are
also changed. Since Weston and libweston change their behaviour, the handling
of clients' buffer transform changes too.
All the functions had their 90/270 cases simply swapped, probably due to
confusion of whether WL_OUTPUT_TRANSFORM_* refers to rotating the monitor or
the content.
Hint: a key to understanding weston_matrix_rotate_xy(m, c, s) is that the
rotation matrix is formed as
c -s
s c
that is, it's column-major. This fooled me at first.
Fixing window.c fixes weston-terminal and weston-transformed.
In simple-damage, window_get_transformed_ball() is fixed to follow the proper
transform definitions, but the fix to the viewport path in redraw() is purely
mechanical. The viewport path looks broken to me in the presence of any
transform, but it is not this patch's job to fix it.
Screen-share fix just repeats the general code fix pattern, I did not even try
to understand that bit.
https://gitlab.freedesktop.org/wayland/weston/issues/99
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Clarifies which direction the transformation happens. All exported function
need documentation.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is to put more of the EGL client extension handling in the same
place. This also adds a boolean to check if EGL_EXT_platform_base is
supported, similar to other extensions we check.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
EGL client extensions are not tied to the EGLDisplay we create, and have
an effect on how we create the EGLDisplay. Since we're using this to
look for EGL_EXT_platform_base, it makes more sense for this to be near
the start of the GL renderer initialization.
Signed-off-by: Scott Anderson <scott.anderson@collabora.com>
Make stream_destroy() use weston_log_subscriber_release().
This avoids code duplication and allow us to destroy
weston_log_subscriber_get_only_subscription(), since it's
being used only in this case and it's internal.
Calls for weson_log_subscriber_release() leads to
weston_log_debug_wayland_to_destroy(), which should not
send an error event when the stream has already been closed.
Also, stream_destroy() shouldn't lead to an event error, as
it is a wl_resource destroy handler. So close the stream before
calling weston_log_subscriber_release() in stream_destroy()
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Both weston_log_scope_destroy() and weston_log_subscriber_release()
have calls for destroy_subscription(). We can move this call to
weston_log_subscription_destroy() without losing anything and
avoiding repetition.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
The subscription is directly related to both the log scope and
the subscriber. It makes no sense to destroy one of them and
keep the subscriptions living.
We only had code to destroy subscription with
the destruction of log scopes. Add code to destroy
subscriptions with destruction of subscribers.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>