We have an optimization to skip composition if there's no damage on the
primary plane and we already have a renderer buffer active. But we don't
allow this optimization if there's a pending capture task for the
output. For the renderer-based sources, that is really necessary, but
for the writeback source we should allow this optimization.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
A popup grab is specified to have the top most popup surface gain
keyboard focus. This means the keyboard focus should always follow the
most recent xdg_popup.grab() surface. Make sure this happens by keeping
track of the parent surface in the libweston-desktop popup grab,
updating the keyboard focus when surfaces are added and removed from the
popup chain, and restoring the keyboard focus to the toplevel when there
are no popups anymore.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Popups should have keyboard focus when active, but the toplevel window
should still appear "active". Make sure this is the case by changing the
"active" tracking to see whether any child surface has keyboard focus.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
When doing plane selection for an output CRTC check if the plane
already has a CRTC attached and if so prefer that plane only for
the corresponding CRTC.
This prevents changing a CRTC's primary plane when it is active
which is not allowed by the DRM framework.
Based-on-patch-by: Eric Ruei <e-ruei1@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
For some reason we'd managed to have a mismatching header prototype and
implementation. Fix this up to consistently use enums everywhere.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We map view alpha(0.0-1.0) to plane state's alpha
by using the max plane alpha value got from drm.
Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
This checks whether plane alpha is supported.
We get range of alpha value supported for plane
which is required for mapping view's alpha(0.0-1.0)
with drm plane alpha. No functional change.
Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
This prevents to trigger an assert within
weston_view_set_rel_position(), introduced with commit 'libweston: Split
weston_view_set_position() into rel and abs variants', which is hit when
a subsurface attempts to commit without having a parent surface set.
Fixes: #730
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Colin Kinloch <collin.kinloch@collabora.com>
We need only check that the region is not empty. If either the input region or
the constraint region have degenerate extents, the intersection from the
previous instruction will set confine_region->data to pixman_region_empty_data.
Fixes: b6423e59
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
We log the reasons why the fb of a certain view was not placed in an
overlay plane and use that for debug purposes. With these reasons we
also decide if the scanout tranche should be included on the dma-buf
feedback or not. For instance:
1. If the reason is the incompatibility between the format/modifier
pair of the fb and those supported by the KMS device, the scanout
tranche is added and feedback is re-sent (so that the client can
re-allocate with parameters that makes it eligible for direct
scanout).
2. If the reason is because we have no overlay planes available, the
scanout tranche is useless. So the scanout tranche is removed and
the feedback re-sent (so that clients can re-allocate with
parameters optimal for the render device).
Also, when we detect that a view is eligible for direct scanout, we
don't even consider sending new feedback, as our interpretation of the
dma-buf feedback spec was that we should avoid bothering clients with
new feedback when they are already hitting direct scanout.
After some discussions and clarifications regarding the spec, we've
realized that Weston should start to also include the scanout tranche
even when the compositor is able to place client's content on overlay
planes. Basically, because this gives a chance for clients to
re-allocate with the proper parameters (not only format/modifier pair,
but also the target_device and the flags) from the scanout tranche. In
this patch we start doing this.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
It makes no sense to keep the scanout tranche on the dma-buf feedback if
there are no overlay planes available. So start to remove it.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
wayland_output_destroy_shm_buffers() is called immediately before
output_destroy() of the renderer is called. And for the pixman renderer all
renderbuffers must be destroyed before the output can be destroyed.
Also, weston_renderbuffer_unref() is not called when the buffer is released
because buffer->output is now NULL, so the renderbuffer would be leaked.
So just unref the renderbuffer immediately. Set it to NULL to avoid unreffing it
again should wayland_output_destroy_shm_buffers() be called again before the
buffer is released. This can happen during an xdg-shell resize.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
In commit "drm-backend: add writeback connector screenshooter to
DRM-backend" we were failing the writeback screenshot when the DRM/KMS
driver would take longer than the atomic commit to finish. In this patch
we address such case.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In this patch, we add the writeback connector screenshooter to the
DRM-backend.
This will be useful to create plane composition tests that will run in
our CI, as VKMS already supports writeback connectors.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
With this change, we expose the DRM-backend writeback source through the
output capture interface, making it available to clients.
For now we'll always fail writeback screenshots requests, because we
still don't have the writeback screenshooter implementation on the
DRM-backend. We add that in the following commits.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In the following commits we add a writeback screenshooter. For that,
we'll need the formats supported by the writeback connectors. So include
the supported formats in struct drm_writeback.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Allow VNC clients that support the cursor pseudo encoding to render
the cursor themselves. This reduces observable latency of cursor
movement.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
The state does not own the fd. This is usually not a problem, because the
in_fence_fd of the state is assigned during drm_assign_planes() and then
immediately used in drm_repaint_flush(). It cannot be closed in-between.
However, in the fallback path in drm_output_start_repaint_loop(), the state is
duplicated. At this point in time, the in_fence_fd may be invalid because it was
replaced in a new commit of the corresponding surface.
The plane state was already committed to the kernel when it is copied, so the
fence is no longer needed. So just clear it.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
With multiple DRM devices, the state for one device may be empty during
repaint_flush(). This can happen for example if an output of one device triggers
the repaint and there are no screens attached to the other device and therefore
no active outputs.
The atomic commit will actually fail because the commit contains the
DRM_MODE_PAGE_FLIP_EVENT flag but no CRTCs.
Avoid this by skipping the commit entirly. There is nothing to to anyways.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
With some displays connect, disconnect, connect events can happen is a very
short amount of time. When this happens, the output global may already be
destroyed when a client tries to bind it. As a result, the client is
disconnected with a protocol error. See [1] for more details on the general
problem.
To mitigate this problem call wl_global_remove() first and call
wl_global_destroy() several seconds later. This is inspired by the
implementation for the same problem in wlroots.
[1] https://gitlab.freedesktop.org/wayland/wayland/-/issues/10
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Since the logic of pointer constraints assumes a valid view throughout, add a
signal to disable constraints when its current view is unmapped by Weston.
The assumption that a previously unmapped view is valid already leads to the
constraints code crashing. This can happen when attaching a NULL buffer to the
surface and commiting, which effectively unmaps the view with the side effect of
clearing the surface's input region, which is then assumed valid inside
maybe_warp_confined_pointer().
Fixes: #721
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
Currently, the surface destroy listener in pointer constraints is redundant,
since surface destruction already handles pointer constraints destruction (see
libweston/compositor.c:weston_surface_unref()).
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
This makes flight recorder creation faster by using wider store
instructions (depending on the memset() implementation).
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
This is a flag used to track whether the position has changed, not
whether the position is set.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add the --additional-devices parameter to Weston to add secondary drm devices
that will only be used as outputs, but not for rendering.
We can only fail the repaint for the entire backend, but not for single
devices. Thus, if one of the devices fail, we have to fail the repaint for the
entire backend.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Additional devices don't have a gbm device. Therefore, we cannot create gbm bos
for the cursor.
If the output device differs from the gbm device, fall back to the allocation of
a dumb buffer for the cursor on the output device. Update the cursor sprite with
a memcpy to the already mapped dumb buffer that belongs to the current cursor.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
If the GBM bo was allocated on a different device than the device that is used
for the fb, we have to import the fd first and update the handle.
Use drmPrimeFDToHandle directly instead of using a gbm device for the scanout
device, since a gbm device would require a gbm implementation, which is often
not available for devices that only support scanout.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
If we are using multiple GPUs and are not able to use modifiers to ensure that
the formats are compatible, we have to use linear buffers for the transfer.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Weston uses a cached drm_fb when a view is shown multiple times. If the view is
shown on multiple outputs backed by different DRM devices, Weston returns the
cached drm_fb for the first device that was used for the import. This causes a
failure when adding the fb to the other device.
Use a list of all drm_fbs to cache the buf_fb per device, and check for the
device before reusing a drm_fb.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The faked z position must be created for each device. Therefore, the device
itself must be passed to the function. If only the backend is passed, the faked
z position would be only created for the primary device.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Now that struct weston_renderbuffer is refcounted, hold a reference for
renderbuffers on the pixman_output_state::renderbuffer_list. This allows
backends to destroy the renderer output state and release renderbuffer
references in any order without running into an assert().
To avoid breaking resizing, We also have to drop the renderbuffer list
during pixman_renderer_resize_output(). The backends have to create new
renderbuffers afterwards.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Align the function name and arguments of vnc_convert_damage() with
weston_region_global_to_output(). It does not support rotation and
stores the result in a pixman_region16_t, but otherwise it serves the
same purpose.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_renderer::repaint_output must be called from the weston_output::repaint
callback. When called from the weston_output::enable callback, a black frame
is produced. Instead of painting an invalid buffer and then working around it
by setting output damage, just don't skip the first real repaint even though
no VNC client is connected yet.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Add a debug scope "vnc-backend" and use it to log per-renderbuffer
accumulated damage and new repaint damage before repainting.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Since neatvnc frame buffers are in system memory, using a shadow
buffer just causes an unnecessary copy in the pixman renderer.
Stop using the shadow buffer.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
It is enough to report new repaint damage instead of accumulated
per-renderbuffer damage to nvnc_display_feed_buffer().
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>