Commit graph

9560 commits

Author SHA1 Message Date
Derek Foreman 14599d0607 gl-renderer: Rename surface_flush_damage to paint_node_flush_surface_damage
And in doing so, pass the paint node instead of a surface and a buffer.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-11 09:23:27 +00:00
Derek Foreman 101e270f9b gl-renderer: Use pnode->surface directly instead of pnode->view->surface
We don't need the view, so let's skip the extra indirection.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-11 09:23:27 +00:00
Derek Foreman 4a8e8f5e83 gl-renderer: Stop returning bools for things that can't fail
None of these can fail, so let's not return anything from them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-11 09:23:27 +00:00
Derek Foreman 4be5e79f8d gl-renderer: Don't check zalloc return in gl_render_attach_shm
We don't always check allocation failures, so why bother here?

Removing this allows simplifying some code in a further patch.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-11 09:23:27 +00:00
Derek Foreman 41ff97a0d9 gl-renderer: Rename maybe_censor_override
This doesn't just handle censoring protected content anymore, fix the name
and the comments.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-06-11 09:23:27 +00:00
Lukasz Czechowski 05e5405651 vnc: Allow neatvnc in version 0.8.0
Neat VNC 0.8.0 does not introduce any changes that breaks API used
by VNC backend, so it is safe to extend compatibility.

Signed-off-by: Lukasz Czechowski <lukasz.czechowski@thaumatec.com>
2024-06-07 12:57:54 +00:00
Marius Vlad e80ebde028 doc/sphinx/toc/kiosk-shell.rst: Add doc for Xwayland appidis
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 12:40:50 +00:00
Marius Vlad bdcbdb6520 kiosk-shell: Check both WM_NAME and WM_CLASS at the same time
This adds an additonal check for testing both WM_NAME and WM_CLASS being
set-up at the same time.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 12:40:50 +00:00
Marius Vlad 619578f62f kiosk-shell, xwayland: Add a new weston_xwayland_surface_api function
Such that shells can retrieve Xwayland's surface WM_CLASS/WM_NAME and use
it to place the corresponding Xwayland surface on the appropriate
output, similar to what xdg_shell::set_app_id does.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 12:40:50 +00:00
Marius Vlad f2486c8b96 compositor: Remove layer_entry_remove/layer_entry_insert
There are no longer users of these two function. With the
weston_view_move_to_layer() helper being capable of doing this it is time
to retire these entirely to avoid users using them.

Release notes should mention that migrating to the newer helper will be
required when bumping to Weston 14.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 11:59:25 +00:00
Marius Vlad d62e8052f0 weston-test-desktop-shell: Use the weston_view_move_to_layer helper
This looks that probably it was an oversight as
weston_view_move_to_layer() also handles the insertion.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 11:59:25 +00:00
Marius Vlad 904811100e libweston/desktop: Use the weston_view_move_to_layer helper
Rather than using layer_entry_insert, use the
weston_view_move_to_layer().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 11:59:25 +00:00
Ray Smith e79600483f backend-drm: always create gem_handle_refcnt hash table
Devices created via drm_device_create have this hash table, but those
created via drm_backend_create don't.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-06-07 11:27:27 +00:00
Ray Smith 80f096d9d2 backend-drm: don't leak gem_handle_refcnt in drm_destroy
Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-06-07 11:27:27 +00:00
Ray Smith 433f648adb backend-headless: Don't try to finish frame if it was cancelled
When multiple outputs are present, a failure in one's repaint will
cause any repaints of all other outputs to be cancelled. If this
happens during the headless "frame" time, the assertion on
repaint_status in weston_output_finish_frame fails.

Do the same as the DRM backend does in its equivalent callback
drm_output_update_complete and don't finish the frame.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-06-07 11:00:25 +00:00
Marius Vlad dedcfb40dd gitlab-ci.yml: Update CI_BUILD_REF_NAME
With GitLab 16.0 CI_BUILD_REF_NAME was replaced with CI_COMMIT_REF_NAME.
which might explain why we do not seem to install the documentation on
https://wayland.pages.freedesktop.org/weston/

This should makes that docs deplay stage run.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-07 09:49:52 +00:00
Leandro Ribeiro 2ac5777316 clients: make main event loop more robust
This makes the toytoolkit event loop more robust. Now it uses the
canonical wl_display_prepare_read(), read() and cancel().

Also, it allows functions that run before the event loop to create
Wayland queues and dispatch events related to such queue. Before our
changes, this would cause issues, because of how the loop was written
and also because dispatch_queue() reads the display fd and queue them on
the appropriate event queues, it doesn't read only the events related to
the queue we are interested.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-05 10:25:27 +00:00
Leandro Ribeiro bcd76c372b libweston: fix indentation of a few files
Recently I accidentally created a few files using spaces instead of
tabs. This patch fixes that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-04 17:32:39 -03:00
Loïc Molinari 06436d8adc gl-renderer: Define attrib array locations in an enum
This makes the code slightly easier to read and prevents using
incorrect locations now that shader permutations can provide different
vertex streams.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-04 17:24:12 +00:00
Loïc Molinari 26a69cb2f2 gl-renderer: Rename fan debug mode to wireframe debug
There's no fans anymore, so wireframe makes more sense now.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-04 17:24:12 +00:00
Loïc Molinari 23ae2e7f32 gl-renderer: Batch paint node's draw calls in fan debug mode
Index vertices from the damage mesh as lines and emit a single draw
call in fan debug mode. A new shader path and an additional vertex
stream are added in order to filter the color of the solid shader
variant per sub-mesh.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-04 17:24:12 +00:00
Loïc Molinari 22d9b9815f gl-renderer: Use compile-time annotation in vertex shader
Reuse fragment shader's compile-time annotation logic in vertex
shader for consistency.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-04 17:24:12 +00:00
Loïc Molinari f7a14ba0e7 gl-renderer: Batch paint node's draw calls
A paint node with 'n' rects damaged by 'm' quads emits 'n*m' OpenGL
draw calls. This commit batches the 'n*m' clipped polygons into an
indexed triangle strip damage mesh using degenerate triangles. A
single draw call per paint node is emitted to reduce API overhead.

Fan debug mode is disabled for now and will be added back using
batching in the next commits.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-06-04 17:24:12 +00:00
Jeffy Chen 523a2b75f1 clients/desktop-shell: Reset panel clock timer everytime
In case of the system time changed in between.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-05-30 09:22:23 +00:00
Loïc Molinari ce1705435f gl-renderer: Do not expose clipper_clip() in header
There is no need to expose it since it can be accessed by passing
non-axis aligned quads. Move existing tests to the quad clipper.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-05-30 09:09:45 +00:00
Loïc Molinari bef1f5fd7d gl-renderer: Remove support for non-quad polygons from clipper
The added complexity is unnecessary, it is limited to polygons of
length less than or equal to 8, there is currently no use for that
feature nor any plans to use it and tests are non-existent.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-05-30 09:09:45 +00:00
Michael Olbrich 5e43ef81ae backend-wayland: don't wait for one frame when starting the repaint loop
The repaint loop is started when a client provides a new frame while the
compositor is idle. This frame should be shown as soon as possible. So it makes
no sense to commit the previous frame one more time before rendering the next
frame.

Just call weston_output_finish_frame() directly to start repainting immediately.

As a side effect, this fixes an issue when the output is resized when no
fullscreen shell is involved: At that point, parent.draw_initial_frame is
already false, so draw_initial_frame() is not called. But when resizing, the old
buffers are removed so the commit happens without a buffer attached to the
surface. So the surface is invisible for one frame until the next one is
rendered.

draw_initial_frame() is not removed here, because it is still needed for the
synchronous resize that happens with the fullscreen shell.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-05-29 13:20:11 +00:00
Naveen Kumar ad039cdfd2 backend-drm: Enable atomic async flip support
Since DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP capability is available in the
mainline kernel, now we should enable back tearing support.

v2:

 - Bump kernel version to 6.9
 - include the fallback definitions

Reviewed-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Naveen Kumar <naveen1.kumar@intel.com>
2024-05-28 09:33:51 +00:00
Alexandros Frantzis 8988c9436b clients/simple-egl: Allow translucent 16-bit surfaces
This allows users to get r5g5b5a1 configs which currently (in Mesa) interact
badly with EGL_EXT_present_opaque, and act as a good test case for the EGL
implementation.

Users can still get a 16-bit surface without alpha by using the "-o" flag.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2024-05-28 12:22:38 +03:00
Alexandros Frantzis e59eca5187 clients/simple-egl: Add option to use EGL_EXT_present_opaque
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2024-05-28 12:22:38 +03:00
Alexandros Frantzis 479a0247c9 clients/simple-egl: Display RGBA information for selected EGL config
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2024-05-28 12:22:38 +03:00
Marius Vlad f6294962fd clients/simple-damage: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad 5d78f418a1 clients/dmabuf-v4l: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad e2c6568dd6 clients/dmabuf-egl: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad 68214419e9 clients/simple-shm: Remove zwp_fullscreen support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Marius Vlad 50a6411bb6 clients/fullscreen: Remove zwp_fullscreen client support
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 16:49:21 +00:00
Jonas Ådahl 6975cf4265 terminal: Avoid too large character grid when resized
When resizing the terminal, the row/columns would end up potentially too tall
and/or wide, meaning the widget would grow each time the window was configured
with a size.

Fix this by making sure the calculated rows and columns don't loose too much
precision, and if they do, shrink instead of grow, as that is expected by the
xdg_toplevel configure event.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2024-05-27 16:28:48 +00:00
Loïc Molinari d4fe0a42fd gl-renderer: Assume axis alignment using node's valid_transform
Assume axis alignment using node's valid_transform boolean instead of
relying on the transform flags of the weston_view struct. This is more
reliable since matrix flags could erroneously hang around after a
series of transforms. Additionally, nodes with standard output
transforms like translations, flips and rotations by 90° can now take
the fast axis aligned path.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-05-27 16:21:21 +00:00
Chirag Khurana 287b3f1758 clients: simple-im: handle proper destruction of objects
Add signal handler for SIGINT to enable graceful exit and
release allocated memory. This resolves the memory leak
observed with Valgrind:

  LEAK SUMMARY:
    definitely lost: 2,520 bytes in 2 blocks
    indirectly lost: 16,820 bytes in 11 blocks
      possibly lost: 0 bytes in 0 blocks
    still reachable: 0 bytes in 0 blocks
         suppressed: 0 bytes in 0 blocks

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/872

Signed-off-by: Chirag Khurana <quic_ckhurana@quicinc.com>
2024-05-27 13:30:21 +00:00
Marius Vlad b2e6a6438f libweston: Don't add frame callbacks from occluded paint nodes
This changes the callback frame list insertion after paint node late
update takes place in order for to the visibily region to be modified.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-27 10:47:33 +00:00
Derek Foreman e169b77430 compositor: Don't lift planes out of scene graph entirely
When we lift planes entirely out of the scene graph, paint node visibility
calculations become "per plane". This means that when we lift something
onto a paint node, anything beneath it will be redrawn in response to
client side damage even if the lower surfaces are occluded.

Instead, keep the scene graph together and make the paint node visible
regions be their visibility within the global scene graph.

This has the side effect of plane motion causing redraws, to update
regions they've been obscuring. My assumption is that moving planes
is less frequent than damage being posted beneath an overlay, and
that we'll be more efficient for normal use cases this way.

An optimization is in place to prevent redraws when moving transparent
planes, as they haven't been occluding updates.

In addition to theoretically removing some wasteful rendering time, this
also simplifies damage accumulation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-05-24 11:13:34 -05:00
Derek Foreman 36c2c4a254 libweston-desktop: Break grabs when a parent surface is destroyed
When a client is killed we don't get a clean dismissal of pop-ups in
construction order. This can lead to a weston_desktop_surface being
destroyed before its child popup is destroyed.

The weston_surface is still alive, so the surface destroy listener can't
save us.

Track grabbed seats in parent surfaces and explicitly break any grabs
that depend on them when the surfaces are destroyed.

Fixes #870

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-05-21 13:21:35 -05:00
Sami Uddin bedd171d5d shared: memfd_create: try MFD_NOEXEC_SEAL
Effective from Linux 6.3 onward, this creates the memfd without execute
permissions and prevents that setting from ever being changed. A
run-time fallback is made to not using MFD_NOEXEC_SEAL when
weston compiled on Linux >= 6.3 is run on Linux < 6.3.

Signed-off-by: Sami Uddin <sami.uddin@astc-design.com>
2024-05-15 16:27:17 +09:30
Derek Foreman 27bf066c81 renderer: Move dmabuf setup into renderer init
We've forgotten to set this up in some backends, so let's just do it in
weston_compositor_init_renderer().

The headless backend used to fail out if linux_dmabuf_setup() failed, but
had no reason to do so, so just remove that to make the code common.

Suggested by cwabbott on irc.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-05-10 00:09:35 -05:00
Pekka Paalanen b0d5b066c5 tests: add EOTF and colorimetry mode parsing
Essentially ensures that wet_output_set_eotf_mode() and
wet_output_set_colorimetry_mode() work as intended.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 10d99700ca tests: parse colorimetry-mode=bt2020rgb
A trivial test to exercise the parsing code at all.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen ea91d595dc backend-headless: support all colorimetry modes
The headless backend does not display to anything, so it doesn't care
what the colorimetry mode is. To allow testing compositor internal
behavior, claim to support all colorimetry modes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen a7a47503f1 frontend: add colorimetry-mode to weston.ini
This output section key is used to program the KMS connector property
"Colorspace" when used with the DRM-backend.

This is an essential part in defining the color encoding used in the
video signal, and may allow wide color gamut even on SDR.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 627dcde086 frontend: fix leak in wet_output_set_eotf_mode()
Found when developing tests.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen f408a245d0 frontend: drop compositor in wet_output_set_eotf_mode()
It would be painful to mock a struct wet_compositor in the tests, so
pass that one boolean as an explicit argument instead.

This makes it easier to extend the testing of the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00