Commit Graph

8888 Commits

Author SHA1 Message Date
Derek Foreman db51409b9a desktop-shell: Pass a weston_coord to calc_input_panel_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman aea5ca97ae kiosk-shell: Use weston_coord for grabs
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman 643c9b929f desktop-shell: use weston_coord in weston_move_*_grab
Replace some wl_fixed_t pairs with weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman 2ac566d281 libweston: Add more weston_coord arithmetic helpers
Until now we've only had the unadorned arithmetic functions, but they're
easy to abuse and tedious to use.

For now, we just add weston_coord_global_add/sub functions and use them
where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman d961e59d4a libweston: Add getters for view position/offset
This is stored as an unadorned weston_coord internally, but with getter
functions we can put together the appropriate global or surface
coordinate.

Use them where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Derek Foreman 1f81c082b5 libweston: Add weston_coord_truncate()
Truncating a weston coord to integer values is something we do
frequently enough to warrant a helper function.

Use this in the kiosk and desktop shells where appropriate.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-19 13:09:03 +00:00
Philipp Zabel ca1f6936c4 backend-rdp: GL renderer support
Let the GL renderer render to FBOs for RDP outputs and read the pixels
into the RDP frame buffer. This allows to run the RDP backend with the
GL renderer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-15 15:48:26 +00:00
Philipp Zabel dbe5b53766 backend-rdp: add pixel format info array
Store pixel formats on the backend and stop open coding Pixman format
codes.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-15 15:48:26 +00:00
Philipp Zabel 17d7353b36 backend-rdp: move code to prepare for GL renderer support
Add switch statements where renderer specific API is called to prepare
for adding GL renderer support. No functional change.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-15 15:48:26 +00:00
Philipp Zabel e0c7fd1586 backend-rdp: bring back shadow_surface image
Partially revert commit 89e1831cd7 ("pixman-renderer: add
weston_renderbuffer and create/destroy interface") to bring back the
shadow_surface pixman image. The renderbuffer is only wrapped around it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-15 15:48:26 +00:00
Sergio Gómez 03aeb4bd83 clients: Replace 'confine' client to showcase pointer constraints in general
The 'confine' client is used to showcase the behavior of pointer confinement
through the interface zwp_confined_pointer_v1.

Since zwp_confined_pointer_v1 is part of pointer constraints in general, which
includes pointer locking, it makes sense to augment the scope of the client so
it can serve as a showcase for this category of interfaces through
zwp_pointer_constraints_v1.

Currently 'confine' relies on, and is designed around the limitations of, the
toytoolkit. Adapting the toytoolkit for the new requirements proved
unproductive, especially since we wish to add support for pointer constraints in
sub-surfaces. Hence the solution adopted was to write a new client that would
replace the previous one.

This patch introduces the new client, 'constraints.c', replacing 'confine.c'.

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 16:26:34 -05:00
Sergio Gómez 65740ca9a7 tests: Add basic testing for pointer constraints protocol
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 10:27:14 +03:00
Sergio Gómez 34269c4708 tests: Add a button binding to weston-test-desktop-shell
We need this so that Weston can update the "click to activate" serial, so
that we can then use the constraints protocol (see
maybe_enable_pointer_constraint() in libweston/input.c).

Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 10:27:14 +03:00
Philipp Zabel efc846b659 gl-renderer: fix FBO renderbuffer download extents
Translate damage extents used to calculate glReadPixels rectangle from
global to local coordinates.

Fixes: b1606a9f2c ("gl-renderer: support automatically downloading FBO renderbuffers")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-06-13 22:48:22 +00:00
Philipp Zabel 6083a613e6 libweston: damage moved outputs
When an output is moved, all views that are not moving with it should
cause damage where they appear in it before and after the move, and all
prior damage should move with the output.
To avoid this complexity, just damage the full output after the move.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-13 22:38:30 +00:00
Marius Vlad 51f377b813 desktop-shell: Do another update transform
This is similar to commit 'libweston: Update view transforms more often', where
we update the view's transform when getting the panel dimensions.

Fixes #740

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-06-13 16:32:39 +00:00
Philipp Zabel 291958682f backend-wayland: track damage on renderbuffers
Track damage on struct weston_renderbuffer and drop the custom damage
region from struct wayland_shm_buffer.

Pass repaint damage to wl_surface_damage() instead of accumulated
renderbuffer damage.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-06-13 15:43:56 +00:00
Philipp Zabel 5b1974fa4f backend-pipewire: add GL renderer support
While the GL renderer is not able to directly render into the PipeWire buffers,
it is possible to read the rendered frame from the fbo into the PipeWire buffer.

Use the automatic download to add support for the GL renderer to the PipeWire
backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter a9d1b5dc50 backend-pipewire: make renderer initialization depend on renderer
Instead of always initializing the Pixman renderer, make the initialization
dependent on the selected renderer. This makes it easier to add other renderers.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter 1effba000e backend-pipewire: add local variables for spa_buffer and data
Make it easier to understand where ptr points to by using local variables for
the spa_buffer and spa_data.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter b5854ff95d backend-pipewire: move pixman renderbuffer creation to helper
Extract the pixman renderbuffer configuration from the add_buffer function into
a helper function to simplify the addition of the GL renderer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter 7155d00929 backend-pipewire: move pixman setup into helper functions
Use helper function for setting up the pixman renderer to simplify the addition
of the GL renderer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Derek Foreman 0bf2d82e0c libweston: Use weston_coord in struct weston_touch
Convert the grab coordinate to a weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:58:17 -05:00
Derek Foreman e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Derek Foreman 244dc963b9 libweston: use weston_coord for weston_view_set_position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:19 -05:00
Loïc Molinari fff8dbd9b8 gl-renderer: Move clip_quad() to clipper
clip_quad() is a dedicated clipping function for quads that doesn't
depend on any GL renderer internal structures. It can be moved out to
the clipper to be called by both the renderer and the clipping test
client without having to duplicate code.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 3d94f943a6 gl-renderer: Update HTTP links to vertex clipping resources
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 39fee794b5 gl-renderer: Get rid of axis-aligned bbox check in simple clipper
Since both the surface rect and the transformed quad are axis-aligned
in the simple clipping path, non-zero area detection can more
efficiently be checked post-clipping by comparing opposite edges.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari d34f35c904 gl-renderer: Use simple clipper on translated and/or scaled nodes
Add a basic check to let the clipper take the simple axis-aligned path
when nodes are solely transformed with a translation and/or a scaling.
That makes some nodes like sub-surfaces (which always have their
transform enabled) take the fast path in the common case.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 49053a2aa2 gl-renderer: Store clipped vertices directly into the vertex buffer
Move vertex clipper back to single-precision floating point
intermediates. Since positions are sent down the graphics hardware as
single-precision values, this prevents useless conversions between
single and double precision values and lets compilers fit twice as
much data into vector registers. It also removes a copy by letting the
clipper store vertices directly into the vertex buffer.

This is mostly reverting the conversion to double-precision that
happened along with the switch to the weston_coord struct for vertex
coordinates (commit 10e70bf23c).

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari bcd04e0fad gl-renderer: Derive texcoords from position in the vertex shader
Let the graphics hardware handle the transformation from surface
position to texture coordinates. Paint nodes now have a single vertex
position attribute from which texture coordinates are derived. A new
vertex shader variant handles the transformation.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari a4d31fa8bd gl-renderer: Decouple coord space transformation from clipper
The clipper transforms dirty rects to surface space before clipping.
Each dirty rect is transformed by the same matrix for each surface
rect. This change decouples the transformation and the clipping code
to transform and compute the bounding box of dirty rects just once.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Loïc Molinari 54bce80c73 gl-renderer: Clip and dispatch vertices in surface coord space
Clip dirty rects to surface rects in surface coordinate space.
Dispatch vertices in surface coordinates and let the graphics hardware
handle the transformations. Clipping in global coordinate space
implies a useless roundtrip on the CPU to get the clipped polygons
back in surface coordinates for the buffer transformation. Clipping in
surface coordinate space prevents that.

This might seem counter-intuitive at first because in surface space
it's the dirty rects that are clipped to axis-aligned surface rects,
while it's the opposite in global space.

The projection matrix now combines the view and the output transforms.

Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
2023-06-12 11:15:51 +00:00
Philipp Zabel 0d64d0ac5c backend-vnc: GL renderer support
Let the GL renderer render to FBOs and read the pixels into the Neat VNC
frame buffers. This allows to run the VNC backend with the GL renderer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 15:40:05 +00:00
Philipp Zabel b1606a9f2c gl-renderer: support automatically downloading FBO renderbuffers
For software backends like VNC, support downloading the FBO renderbuffer
contents via glReadPixels automatically at the end of repaint_output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 15:37:09 +00:00
Philipp Zabel 4a271bdaae gl-renderer: split gl_renderer_do_read_pixels out of gl_renderer_do_capture
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 15:37:09 +00:00
Philipp Zabel 7bc5cf9ca6 renderer-gl: drop unused fields from struct gl_fbo_texture
Drop unused width and height fields from the gl_fbo_texture structure.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:48:10 +00:00
Philipp Zabel 2122be5a13 gl-renderer: remove pbuffer dummy surface
Drop the dummy PBuffer surface.
This makes EGL_KHR_surfaceless_context mandatory.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-06-09 10:26:58 +01:00
Philipp Zabel 499e617a62 gl-renderer: remove backend pbuffer support
Drop the now unused output_pbuffer_create from gl_renderer_interface.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:21:31 +00:00
Philipp Zabel c3d49732de backend-headless: render to FBO instead of pbuffer
Render into an FBO instead of a PBuffer EGL surface.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:21:31 +00:00
Philipp Zabel 5a40ebbbf1 gl-renderer: add FBO output support
Add support for creating surfaceless outputs and rendering to FBOs.

The backend has to create FBOs with the create_fbo API and pass the
resulting weston_renderbuffer handles to repaint_output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:21:31 +00:00
Philipp Zabel 68778dd6f4 pixel-formats: Add gl_internalformat
Add GL internal format value to be passed to glRenderbufferStorage.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:21:31 +00:00
Philipp Zabel fd3732e834 gl-renderer: add framebuffer object name to gl_renderbuffer
For dummy renderbuffers this is always 0, meaning the surface
framebuffer. No functional change.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:21:31 +00:00
Philipp Zabel 2c7dceced7 backend-wayland: fix memory leak in wayland_shm_buffer_attach
Since the pixman_region32_t damage is initialized unconditionally, also
finalize it unconditionally. Otherwise we leak rectangle memory when
sb->output->frame is NULL.

Reported-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:17:55 +00:00
Philipp Zabel 0d4c523c4c pixman-renderer: Add to_pixman_renderbuffer helper
Add a to_pixman_renderbuffer() helper to consolidate the
container_of(renderbuffer, ...) macro calls.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-09 09:14:47 +00:00
Liu, Kai1 b468687dd2 xwm: WM_TRANSIENT_FOR should not point to override-redirect window
The override-redirect window will not be assigned a shell_surface
object. If it is used as a parent window, it will cause a crash
when calling the set_parent function.

The EWMH specification does not describe the behavior of an
override-redirect window as a parent window, so we should ignore
this case.

Signed-off-by: Liu, Kai1 <kai1.liu@intel.com>
2023-06-09 09:10:28 +00:00
Philipp Zabel 3010d1f070 gl-renderer: remove old damage tracking
Remove the now unused previous/total_damage regions and the
buffer/border_damage arrays, as well as the output_get_damage and
output_rotate_damage functions.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-08 11:02:24 +00:00
Philipp Zabel fb91919fa2 gl-renderer: track damage on dummy renderbuffers
Create dummy renderbuffers to track surface buffer damage on
demand. The renderbuffer representing the surface buffer that
is currently rendered to is inferred using buffer age.
This aligns damage tracking with the Pixman renderer and will
simplify adding FBO rendering support.

The previous/total_damage regions and the buffer/border_damage
arrays are now unused except for validation.
They can be removed next.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-08 11:02:24 +00:00
Philipp Zabel 38181e1748 gl-renderer: split buffer age query out of output_get_damage
Split the buffer age query out into a separate function.
The following patches will replace the remainder of the
output_get_damage function.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-08 11:02:24 +00:00
Marius Vlad f043ad3647 virtme-scripts: Add LSAN_OPTION
In preparation of turning mem leak detection on in CI, this patch adds
LSAN_OPTIONS to be able to pass the suppression file.

This *does not* turn the mem leak detection on yet, as we still
need some additional mem leak fixes.

This removes fast unwind set to zero as well, as that will add a massive
runtime penalty to some of our tests, and we'll no longer need it as
we've included the entire libfontconfig as a mem leak source in the
suppression file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-06-07 13:44:15 +03:00