Commit Graph

1733 Commits

Author SHA1 Message Date
Loïc Molinari ad141defcd weston-log-flight-rec: Map ring buffer using memset()
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>
2023-03-10 11:35:04 +01:00
Derek Foreman ff00ae4218 compositor: Rename position.set to position.changed
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>
2023-03-07 14:45:48 -06:00
Michael Tretter 3c6cfe6bf4 backend-drm: add additional-devices to support multi GPU
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>
2023-03-03 08:08:46 +00:00
Michael Tretter 3f9f4277c3 backend-drm: import cursors on non gbm outputs
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>
2023-03-03 08:08:46 +00:00
Michael Tretter 7887d3fb48 backend-drm: import GBM bo to scanout device if necessary
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>
2023-03-03 08:08:46 +00:00
Michael Tretter 575804c7e1 backend-drm: use linear buffers if gbm and kms device differ
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>
2023-03-03 08:08:46 +00:00
Michael Tretter f05029127c backend-drm: allow to create multiple drm_fb for a weston_view
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>
2023-03-03 08:08:46 +00:00
Michael Tretter a8fb329335 backend-drm: create faked zpos for device instead of backend
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>
2023-03-03 08:08:46 +00:00
Philipp Zabel 07734a2564 pixman-renderer: hold a reference for renderbuffers on the output state list
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>
2023-03-03 07:36:32 +00:00
Philipp Zabel 12a7e4e163 backend-vnc: rename vnc_convert_damage to vnc_region_global_to_output
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>
2023-02-28 08:45:48 +02:00
Derek Foreman aef2da675b libweston: Convert weston_output_move to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 59a0bd99bd libweston: Use weston_coord in surface committed handler
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>
2023-02-24 18:44:19 +00:00
Derek Foreman 5e353d523f libweston: Use weston_coord in struct weston_view
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 989cdcb86e libweston: Convert struct weston_subsurface to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 4a2e7c9f1f backend-x11: use weston_coord to store previous pointer position
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 716a1714f3 data-device: Make struct weston_drag use weston_coord
Somewhat lazy approach, as this will all collapse shortly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Philipp Zabel d245bbdd13 backend-vnc: fix initial repaint
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>
2023-02-24 13:52:40 +00:00
Philipp Zabel b399d48dd4 backend-vnc: add debug scope to log damage regions
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>
2023-02-24 13:52:40 +00:00
Philipp Zabel d18954ba10 backend-vnc: stop using pixman shadow buffer
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>
2023-02-24 13:52:40 +00:00
Philipp Zabel e5445d836b backend-vnc: track damage on renderbuffers
Replace the custom damage tracking with tracking damage on the
renderbuffers.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Philipp Zabel ca8e0c9d16 backend-vnc: stop over-damaging nvnc_display
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>
2023-02-24 13:52:40 +00:00
Philipp Zabel fc8ce13747 backend-vnc: track damage on output while not repainting
While not repainting, all buffers are damaged exactly the same.
Avoid unnecessary work by tracking this damage separately on struct
vnc_output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-24 13:52:40 +00:00
Rajendraprasad K J 342243e8b9 libweston: Add support to force an output power state to off
In IVI, there are several displays connected to a SoC. These displays
are just driven by differential pairs (LVDS, FPD-Link, GMSL) and powered
centrally. To reduce power comsumption when user inactivity timeout
happended on the display, there is a need to cut down pixel clock from
SoC. Then, if any input events happend on the display, it should become
active again.

Currently, controlling the compositor outputs doesn't happen independently
but rather globally, and outputs repaints are based on the compositor state

This is necessary to have an API that can force the power state of an
output to off via DPMS mode while all other compositor outputs remain
unaffected.

Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
2023-02-23 11:44:30 +00:00
Marius Vlad d90533b8ad backend-drm/drm-virtual: Hang off the drm_backend
This is needed by drm_output_fini_egl() to be able to retrieve the
backend out of the drm_output on the shutdown path of the compositor.

Both the remoting plug-in and the pipewire plug-in are users of the
drm-virtual API and as such they would trigger a crash when shutting
down the compositor, as we're not setting up any backend whatsoever.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-20 12:41:03 +02:00
Derek Foreman 583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 8f33e86cda data-device: convert weston_drag focus functions to weston_coord
More under the hood conversion to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 3bb09ea3cb input: Use weston_coord for weston_touch functions
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman d07705c7d3 input: use weston_coord for weston_pointer_move_to
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman 84a2a84045 input: Use weston_coord for pointer clamping
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman f7e936ae2a input: Convert weston_pointer_motion_to_abs() to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman b6ec770595 input: Convert weston_view_takes_input_at_point to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Derek Foreman c3cd8306c9 libweston: Pass weston_coords to weston_compositor_pick_view
Continuing to convert things to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00
Michael Olbrich 39796f88e6 libweston: clear parent_view when the parent view is destroyed
When a view is destroyed then the views of subsurfaces remain until the view
list is rebuilt for the next repaint.
During that time view->parent_view contains an invalid pointer and weston will
crash when it tries to access the view.

This happens for a surface with subsurfaces with views on two different outputs
with the ivi-shell:

When the surface is destroyed then the destroy handler of the ivi-shell
(shell_handle_surface_destroy()) may be called first. It will (indirectly)
destroy the view of the main surface with weston_view_destroy().
Next the surface destroy handler of the subsurfaces
(subsurface_handle_parent_destroy() is called. It will unmap the first view of
the subsurface. Here weston_surface_assign_output() is called which tries to
find the output of the second view and accesses the now invalid
view->parent_view in the process.

There are probably other ways to trigger similar crashes.

To avoid this, clear view->parent_view when the parent view is destroyed.

Fixes 0669d4de4f ("libweston: Skip views without a layer assignment in
      output_mask calculations")

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-16 14:56:10 +01:00
Philipp Zabel 7222171d81 backend-wayland: reuse backend->formats[0] as pixman/cairo/shm pixel format
The pixel format stored in backends->format[0] is effectively looked up
via pixel_format_get_info(DRM_FORMAT_ARGB8888). Reuse that instead of
looking up the same via pixel_format_get_info_by_pixman(PIXMAN_a8r8g8b8)
in multiple places.

There are still two instances of hard-coded CAIRO_FORMAT_ARGB32 in
wayland_output_get_shm_buffer() that currently can not be obtained from
pixel_format_info.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-16 09:48:55 +00:00
Jonas Ådahl 9c511fedba compositor: Don't overwrite offset on attach
If the wl_surface resource has version 5 or newer, we should always
ignore the offset parameters in wl_surface.attach.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2023-02-14 11:34:50 +02:00
Derek Foreman 5e7b4d0c00 input: Use weston_coord in add_border
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 905d16d23b input: Use weston_coord for weston_pointer_motion_to_rel
Use weston_coord for some internal stuff.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman d5132c6516 input: Convert vec2d to weston_coord
No need for two vector structs.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 69908000e3 input: Convert weston_pointer_motion_event to weston_coord
This struct has a lot of members that can be converted to weston_coord.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 8031b9d57f backend: Make input notification functions use weston_coord
Push weston_coord into the notification functions instead of passing
two doubles.

The touch handlers are passed a pointer to a weston_coord, which is
unusual. This is done so we can pass a NULL pointer instead of a
fabricated invalid coordinate when the touch type is TOUCH_UP.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 4d0ce16669 libweston: replace weston_output_transform_coordinate
This creates a global coordinate from a device coordinate.

Replace it with weston_coord_global_from_output_point() which
does the same thing and returns a weston_coord_global.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman 10e70bf23c clipping: Use struct weston_coord in vertex clipping code
Remove the independent x, y floats from the clipping code and replace them
with struct weston_cord. This includes the polygon8 structure as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-09 12:12:40 +00:00
Derek Foreman c7b9625775 input: Don't assert when sending touch motion
If a window is clicked with a mouse while it's being interacted with via
touch input, the assert from 2dc8680d will fire.

This is a leftover from d611ab24

Update the transform before converting the coordinate to fix this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-07 16:28:25 +02:00
Marius Vlad 27ce9dadd8 backend-drm: Do not overwrite plane's index when creating virtual plane
Starting with commit 4cde507be6 "backend-drm: fix plane sorting" the
plane list will have a descending order of the planes rather than ascending.

This reversed order had the side-effect of exposing the fact that we
don't set-up a plane index when creating the drm_plane using the DRM
virtual API. Without settting a plane index for that drm_plane we
effectively overwrite the plane index which has the 0 (zero) entry.

This wasn't an issue before commit 4cde507be6 "backend-drm: fix
plane sorting" as it seems we never picked up that plane index as
being a suitable one due to the fact that those were assigned to primary
planes, but after that commit, the cursor plane will be one getting
the 0 (zero) plane index.

Finally, this would trip over because we attempt to place a (cursor)
view on a primary plane (where it would've normally be a cursor
plane) and we end up with no framebuffer ref.

This is fixed trivially by assigning a plane index, different than the
ones already created by create_spirtes().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-07 16:24:07 +02:00
Philipp Zabel 7c1492216e backend-x11: split x11_output_get_pixel_format out of x11_output_init_shm
Split x11_output_get_pixel_format() out of x11_output_init_shm() so the
pixel format can already be known when calling pixman->output_create().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-07 09:32:31 +00:00
Derek Foreman 8571b844af libweston: Fix broken paint node list walk
Outputs store nodes on the output_link.

Fixes !1118

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-06 08:23:52 -06:00
Philipp Zabel a222ce03c7 backend-x11: create renderbuffer when pixman output state already exists
Reorder pixman renderer output state and SHM renderbuffer creation and
removal to make sure the pixman renderbuffer list is empty when the
output state is destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel 918ec64f6a backend-x11: fix pixman output state creation
Pixman output state creation requires a valid pixel format to be set for
weston_output_update_capture_info().

Fixes: c67773bc5c ("pixman-renderer: use pixel_format_info instead of pixman_format_code_t")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel 2914f28fd1 backend-wayland: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and SHM renderbuffer removal to
make sure the pixman renderbuffer list is empty when the output state
is destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel 2a6c1afced backend-wayland: fix pixman output state creation
Pixman output state creation requires a valid pixel format to be set for
weston_output_update_capture_info().

Fixes: c67773bc5c ("pixman-renderer: use pixel_format_info instead of pixman_format_code_t")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00