Commit Graph

9691 Commits

Author SHA1 Message Date
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
Pekka Paalanen 8556059785 backend-drm: set connector property "Colorspace"
Based on what is configured in weston_output, check and set the
colorimetry mode into KMS connector property "Colorspace".

This changes how video sinks interpret the pixels, and should allow
driving e.g. WCG monitors in BT.2020 mode.

This does not alter the pixel values themselves. That is the color
manager responsibility, and ultimately the responsibility of the
frontend and the end user to match the monitor driving mode with the
output color profile they chose.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 45ae99aff7 backend-drm: get KMS colorimetry modes
Based on KMS "Colorspace" connector property, populate the mask of
supported colorimetry modes on a head.

EDID should be checked too, but it is currently ignored.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 53493aaddc libweston: add colorimetry_mode API
This API is mostly for use by the DRM-backend. Colorimetry mode is is
the KMS connector property "Colorspace" which defines the video signal
encoding colorimetry. A video sink indicates the supported modes in EDID
or DisplayID.

This patch adds the libweston API that allows backends to indicate the
supported modes for the frontends, and frontends to set the mode to be
used by backends. Colorimetry mode does not directly affect color
management inside Weston, it is only metadata for the video sink. It is
the frontend's responsibility to set up an output color profile that
agrees with the colorimetry mode. (That API has not been implemented
yet.) eotf_mode will be the same.

There is only one reason to make this a libweston core API instead of
a backend-drm API: when wayland-backend gains color-management protocol
support, meaning it can forward WCG and HDR content correctly to a
host compositor, the supported colorimetry modes can be determined from
the host compositor's supported color-management features, allowing the
guest Weston to pick some other output image description than the host
compositor's preferred image description. This likely allows only a few
other choices from standard colorspaces, so it's possible this isn't
sufficient for that use case.

Either way, it is easy to just copy the eotf_mode API design, and since
colorimetry_mode and eotf_mode go together, let both have the same API
design. It is possible to convert this to backend-drm API later.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen cd622900ee shared: add weston_assert_false()
Complement to weston_assert_true(), to avoid having to use !.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen c310516d1d shared: add weston_assert_legal_bits()
Helper to assert that a value does not have any bit set outside of the
mask. To be used with "all bits mask" of enum types that enumerate bits.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 74d1700f0b libweston: add TODO to validate EOTF mode
Currently EOTF mode is not validated against the supported mask, to
allow easier experimenting without supplying a modified EDID through the
kernel.

The validation should be added before color management becomes
non-experimental.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 8f31f172f8 backend-drm: add connector property "Colorspace"
Just the definitions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen cfd6f3ea83 backend-drm: move wdrm enums to separate file
This will allow me to use this header in libweston core to build a
single translation table between core enums, string names, and wdrm
enums.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen fd8acf2148 libweston: bits_to_str() helper
Refactor existing code into a helper, so when I introduce more bit mask
enums, I don't need to copy the whole function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Pekka Paalanen 161cc8643c libweston: move weston_output_color_outcome to private
Turns out these structures do not need to be in the public header, so
move them into a private header.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00
Marius Vlad 4193bd660f tests: Just keep PIXMAN as renderer
No need to use both renderer for the tests, PIXMAN one is enough.

For the kiosk-shell test which was recently added, but also for the
older paint-node test.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-05-02 16:05:18 +03:00
Daniel Stone 329f5f49e1 tests: Add kiosk-shell testing
Test xdg-shell apps with kiosk-shell, including transition and focus
handling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2024-05-01 14:18:43 +03:00
Leandro Ribeiro 27a8cbeed9 shared: do not call png_destroy_read_struct() with uninitialized object
If png_create_info_struct() fails, we should pass NULL to
png_destroy_read_struct(), and not the address of the info we just
failed to create.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro 13f09a549d clients/image: do not leak filename
Do not forget to destroy the filename.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro 8af763fb7d clients/image: do not leak cairo surface
Do not forget to destroy the cairo surface.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro ca01b1ff8d clients/image: move a few functions on the file
Cosmetic changes. Move the image_widget handlers closer to each other.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro cfc886fcb3 clients/image: display image in a subsurface
In the next commits we'll add support to extract the ICC information
from the images and use the CM&HDR protocol extension to present them
with the ICC data.

Currently the decorations, background and the image content are
presented on the same surface. As we want to apply the ICC only on the
image content, move it to a subsurface.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro c427ae5a49 clients/image: use widget variable directly
Cosmetic change. Instead of accessing image->frame_widget on the widget
handlers, use the parameter widget.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00
Leandro Ribeiro c9e76869c4 clients/image: rename widget to frame_widget
In the next commits we'll add another widget to the code, so rename this
one to frame_widget.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-04-26 14:15:28 +00:00