Commit Graph

9661 Commits

Author SHA1 Message Date
Loïc Molinari bb6abf3c33 gl-renderer: Clean up comments
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Loïc Molinari 0078a20f17 gl-renderer: Fix debug clear on shadow buffers
The shadow buffer must be blitted entirely when debug clear is on.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Loïc Molinari c65284bf9d gl-renderer: Fix debug clear region
The debug clear region must be generated out of the current render
buffer's damage region, not out of the current damage region, unless
shadow 16F is enabled.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Loïc Molinari 215d552ce1 gl-renderer: Don't use eglSetDamageRegion() on surfaceless outputs
eglSetDamageRegion() requires a postable surface and shouldn't be
called with EGL_NO_SURFACE.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-08-12 10:44:55 +00:00
Derek Foreman 003e529d46 compositor: Unmap views moved to layers outside of the scene graph
commit 5fe02dc68e partially resolved the issue in #937 by bringing back
the old band-aid solution for layer moves. However, since the events of
commit bf228370ff and following commits we have a problem with
subsurfaces leaving garbage behind when minimized - see #366 which was
probably fixed for a while then became broken again.

When we minimize a view that has subsurfaces, by moving it to a layer
outside of the scene graph, we need to be sure to handle the subsurface
views - which follow their parent's layer instead of having
weston_view_move_to_layer() explicitly called.

Do this by assuming layers with an empty link are not part of the scene
graph and unmapping views when they're moved to these layers. This will
recursively unmap the subsurface views.

We can now remove the band-aid paint node destroy, as the unmap process
will destroy paint nodes as appropriate.

Fixes 5fe02dc68e

Fixes #937

Fixes #366

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-08 08:08:10 -05:00
Derek Foreman 30fd16dae7 desktop-shell: check view mappedness in desktop_surface_removed
A "mapped" surface need not have a primary output assigned, or
be in a state such that it needs a fade out animation. The view
being mapped is what we should be testing here.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-08 08:02:09 -05:00
Michael Olbrich a7e8bd4bea subsurface: don't forget to repaint after the first sub-surface commit
For the following sequence, weston will not trigger a repaint:

1. create the main surface
2. create another surface and attach it as a sub-surface to the main surface
3. set the sub-surface to desync
4. attach a buffer to the main surface and commit it
5. attach a buffer to the sub-surface and commit it

Step 5 should cause the sub-surface to become mapped. However, Weston fails to
schedule a repaint in that case, so the sub-surface will not appear until
something else causes a repaint on that output, e.g. the main window.

And sub-surfaces are special when it comes to mapping because
weston_surface_is_mapped() will not return true until the parent surface is
mapped as well. So right now, weston_surface_map() may be called multiple times
and it will send the map_signal each time.

So to fix all this and make it clearer:

1. define a separate weston_surface_start_mapping() function to make it clearer
   that the (sub-)surface may not be fully mapped at the end
2. check surface->is_mapped explicitly to ensure that the sub-surface is only
   mapped once.
3. call weston_view_update_transform() for all views of the sub-surface when the
   parent surface is already mapped to ensure that a repaint for all relevant
   outputs is triggered.

The new test checks this by waiting for a frame event for the first subsurface
commit. Without these changes, the test will block until it is killed by the
timeout.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-08-07 15:10:49 +00:00
Joan Torres 1b793b7acd color: update color-management protocol to xx-v4
The main differences is the split of cm_surface functionality with
cm_surface and cm_feedback_surface.

There can only be one cm_surface to set, unset image descriptions. When
cm_surface is destroyed, the image description is automatically unset.

There can be multiple feedback_surfaces for one surface though.
Now the "preferred_changed" signal can be an initial event.

Creator params now have a new request: set_luminances.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-08-07 13:36:49 +00:00
Derek Foreman 5fe02dc68e compositor: Destroy paint nodes in weston_view_move_to_layer()
Commit f2486c8b96 removed some helper functions for layer changes, but
the loop to delete stale paint nodes was elided.

We need to delete paint nodes on a layer change to ensure damage is tracked
properly.

Fixes f2486c8b96

Fixes #937

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-06 07:41:26 -05:00
Philipp Zabel 4b4cedfc66 backend-pipewire: add fence to synchronize on finish of render
If the PipeWire-backend renders to a DmaBuf, try to use a fence to synchronize
the submit of the next PipeWire buffer to the completion of the current render
process.

This ensures that the GPU rendering is finished before the buffer is passed to
PipeWire.

If fences are not available, the buffer is submitted without explicit
synchronization as before.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-08-05 09:09:51 +00:00
Leandro Ribeiro f271dd34b6 compositor: delete cms-static and cms-colord plugins
Plugins cms-static and cms-colord were deprecated with "compositor:
deprecate cms-static and cms-colord plugins", and the promise was that
we'd delete them if no one complained.

They were deprecated 2 years ago, and no one bothered. So it's about
time to delete them.

See https://gitlab.freedesktop.org/wayland/weston/-/issues/634.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-08-05 11:47:30 +03:00
Marius Vlad 6449ee9dae gitlab-ci: Use virtme-ng for running our tests
virtme-ng is the an update version of virtme, and this patch uses
that instead of the one we had partially modified.

Besides that this partially reverts ad039cdfd2, 'backend-drm: Enable
atomic async flip support' and makes our CI happier. Specifically
ad039cdfd2 updated our kernel version from 6.3 to 6.9 but did not do
a FDO bum,p and with that, no container images were rebuilt. Effectively
we were still using 6.3.

Now, with the FDO bump, in this patch, we noticed that the drm-writeback
test is failing with linux kernel version 6.9.

So far, only 6.3 and 6.4 kernel versions seems to be working, that is,
without that drm writeback test timing out. The safest bet for the
time being, would be to keep our CI just use 6.3 kernel, until we
have proper version to update to.

Signed-off-by: Daniel Stone <daniel.stone@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-02 20:06:25 +03:00
Marius Vlad e667a16752 tests/drm-*: Log drm-backend by default
This could be useful in investigating drm-* test hang-ups.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-02 20:03:41 +03:00
Loïc Molinari 2d8c1af8b7 gl-renderer: Add pixel storage modes section to best practices
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari fb4cccc290 gl-renderer: Assume default GL texture unit
Revert active unit to default value right after use so that other
functions can assume the default state. A best practices section is
added to the internal header for reference.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari b755345a46 gl-renderer: Assume fixed wireframe tex unit
The wireframe unit can only be used by the wireframe texture so
there's no need to bind it anymore before use.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari 69d4f66fab gl-renderer: Use fixed tex units
Provide a fixed allocation to each texture unit in order to prevent
conflicts. This fixes a conflict between colour transforms and the
wireframe debug mode.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari 16390dbae1 gl-renderer: Avoid GL_ as a prefix for constants
Avoid prefixing constants with GL_ as it could be confused with OpenGL
constants.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Loïc Molinari 8a9fba9827 gl-renderer: Merge duplicated functions
Merge duplicated gl_renderer_attach_dmabuf() and
gl_renderer_attach_egl() functions into a single
gl_renderer_attach_buffer() one.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-29 14:20:43 +00:00
Robert Mader 9a754434f1 gl-renderer: Fix limited range quantization
The highest possible value is 255, not 256, like in previous part of the
calculation. While on it, use the values directly, making the code more
readable.

Fix suggested by Pekka Paalanen and Loïc Molinari.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-07-25 19:03:01 +02:00
Pekka Paalanen fa587e3fc0 backend-drm: get colorimetry mask from EDID
This is the mask that the sink claims to support. Default is always
supported.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Pekka Paalanen 77f72ce8f1 backend-drm: expose display_info
Update the field returned by weston_head_get_display_info(). This makes
EDID di_info available to frontends.

Since EDID data has changed, then head device_changed must be true as
well, because di_info may expose all EDID information and not just what
we track in the backend.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Pekka Paalanen 39b577e3a6 libweston: add weston_head_get_display_info()
This new public API is intended to deliver EDID etc. information to the
frontend. The use case here is display colorimetry, to help the frontend
craft output image descriptions (color profiles).

The frontend will need to link to and use libdisplay-info to make use of
this. This avoids having to replicate in libweston the high-level API
that libdisplay-info already has. The libdisplay-info API is also likely
to be extended, and it is not nice to play catch-up with it.

As a di_info can only be destroyed by calling into libdisplay-info,
libweston core can only ensure it has already been freed. There is not
enough reason to make libweston core depend on libdisplay-info, only the
DRM-backend is.

It will be up to DRM-backend to ensure display_info is updated and
device_changed is set only when necessary.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Pekka Paalanen 85593d2e4a backend-drm: get_eotf_mask() from di_info
Use libdisplay-info to parse the supported EOTF modes for the
sink/monitor. No more guessing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-25 13:20:52 +00:00
Leandro Ribeiro f23e511ec7 backend-drm: init dhi in drm_head_info_from_edid()
Instead of initializing dhi in update_head_from_connector(), let
drm_head_info_from_edid() always init that, even when it fails to parse
EDID data.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-07-25 13:20:52 +00:00
Loïc Molinari 95c3f96870 gl-renderer: Assume default GL_UNPACK_* states
Revert pixel store's GL_UNPACK_* changes to default values right after
use so that other part of the code can assume the default state.

Fixes: #928

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari 84d83f5bf8 gl-renderer: Assume default GL_PACK_ALIGNMENT state
Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to default
value right after use so that other part of the code can assume the
default state.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari 1a0e450da5 gl-renderer: Assume default GL_PACK_REVERSE_ROW_ORDER_ANGLE state
Revert pixel store's GL_PACK_REVERSE_ROW_ORDER_ANGLE changes to
default value right after use so that other part of the code can
assume the default state.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari 4fab505b96 gl-renderer: Prepare for reset to default pixel storage states
Prepare gl_renderer_do_read_pixels() so that the default pixel storage
states can be more easily reverted to default before return.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 09:00:38 +00:00
Loïc Molinari db66a64aab rdp: Fix invalid free and memory leak on error
Peer context creation's error handling labels must be swapped to avoid
an invalid free when nsc context creation fails and a leak of the rfx
context when encode stream creation fails.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-24 08:54:45 +00:00
Ray Smith ee5b6bcc30 backend-drm: rename "virtual" to work with C++ compilers
"virtual" is a keyword in C++ so any C++ code including drm-internal.h
fails to compile.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-07-24 08:48:25 +00:00
Ray Smith 7b1520c4d9 helpers: don't override C++11's built-in static_assert
The #ifndef doesn't work with the built-in static_assert from C++11, so
it ends up getting redefined. It seems that there are other versions of
static_assert internally in some C++ standard library implementations
that have additional arguments, and these also get overwritten by the
two-argument version here.

Detect if we're using a suitably-recent version of C++ and avoid the
redefintion in that case.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-07-24 08:48:25 +00:00
Derek Foreman 302a1b143f rdp: Align nsc_compose_message content
This function in FreeRDP expects to be able to read groups of bytes, so
move the left edge of our damage region so the wide reads never read
outside of our framebuffer.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-24 08:41:36 +00:00
Derek Foreman 1fd99807ec renderers: Remove internal flush and attach
These were only necessary to allow surface_copy_content to return contents
that included recently attached (but not yet rendered) buffers.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-19 16:41:05 +00:00
Derek Foreman 0f8bd8dbc5 libweston: Don't change surface state in weston_surface_copy_content
Instead of attaching and flushing damage when performing
weston_surface_copy_content, just return the contents as the renderer
currently knows them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-19 16:41:05 +00:00
Michael Tretter ae53d196db backend-pipewire: add DmaBuf allocation and import
The GL renderer allows the PipeWire backend to allocate DMABUFs that can be used
as renderbuffers and passed to PipeWire. This allows to avoid a copy of the
rendered output when using PipeWire.

PipeWire negotiates DmaBuf buffers using the SPA_FORMAT_VIDEO_modifier property.
Currently, the PipeWire-backend only announces and handles
DRM_FORMAT_MOD_LINEAR, which allows to share DmaBufs with consumers that have
modifier support for linear buffers. Consumers which could consume DmaBufs but
don't support modifiers (DRM_FORMAT_MOD_INVALID) are not supported. Moreover,
consumers that would benefit from other formats with modifiers, for example
tiled or compressed, aren't not supported, too.

Modifier negotiation can be added by extending the list of announced modifiers
and selecting and checking the proposed modifiers in param_changed.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter fa2f05219e backend-pipewire: add MemFd allocator
Instead of letting PipeWire allocate the buffers, allocate them in the PipeWire
backend. This allows the PipeWire backend to define the type of the allocated
buffers, which will ultimately allow to allocate buffers that can be rendered
to.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 4304468a7e backend-pipewire: add helper function for building format params
Add a helper function for building the pod for the format.

This simplifies the creation of the EnumFormat params and to provide multiple
EnumFormats. Furthermore, it allows to optionally set add a Modifier to enable
DmaBuf negotiation.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 073a97a9f5 backend-pipewire: skip rendering and free if there is no renderbuffer
The PipeWire backend is only able to render into renderbuffers and passing NULL
to the renderer is not valid. Don't try to use the renderbuffer if a buffer
without renderbuffer is dequeued from PipeWire.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 4815259164 gl-renderer: use existing gbm_device if possible
If the renderer uses the EGL_PLATFORM_GBM_KHR, the egl_native_display is already
a gbm_device and the renderer doesn't have to create another device.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 14e133e48e gl-renderer: add DMABUF allocator
The GL renderer is able to use a gbm_device to allocate gbm_bos, which can be
used as DMABUFs.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 5a779b7804 gl-renderer: add dmabuf renderbuffer support
Support importing dmabuf buffers as renderbuffers and binding them to
FBOs. These can then be rendered to directly, or they can be blitted
into from the shadow render buffer.

How to best create those dmabuf buffers in the backend is an open
question and may vary depending on what external API the backend is
interfacing with.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter c9c4549064 gl-renderer: add helper function for adding renderbuffers
The renderbuffer list is the reason for keeping a reference for the
renderbuffers in the gl-renderer. Add helper functions to make this explicit.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter cc926a4567 gl-renderer: don't flip outputs for FBO rendering
The GL renderer uses the bottom left corner as origin. Therefore, the buffers
must be flipped when using ReadPixels to have a image in the correct orientation
for screenshots. If the rendered buffers are directly passed to a different
application without going through ReadPixels, the rendered buffer appears upside
down.

Flip the rendered image in the FBO to fix the orientation when directly using
the rendered buffer. Update read_pixels to not flip the image in these cases.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter c2dbe17150 gl_renderer: respect y_flip in read_pixels
read_pixels may use the top left or bottom left corner as origin.

As the renderer may render the image upside down based on the y_flip variable.
read_pixels must read the image with the same origin as used by the renderer to
produce a correct image.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter b57129f451 gl-renderer: allow to render y-flipped outputs
The GL renderer uses the bottom left corner as origin and several
transformations in the renderer assume this corner as origin.

Make this assumption explicit by introducing a y_flip variable that is used to
calculate transformation that are caused by this origin.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter b6075fd075 gl-renderer: use transformation matrix to flip damage
Avoid the calculation of the y-flipped coordinates when transforming the pixman
region to the vertex coordinates by initializing the projection matrix to
already include the y-flip.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Michael Tretter 9b65a706f0 libweston: extract dep_gbm from backend-drm
Move the dep_gbm from the backend-drm specific meson.build to the common
libweston meson.build to be able to use it in other modules, too.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2024-07-19 11:43:42 +02:00
Biswapriyo Nath 51eea1f265 build: add option to disable tests
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
2024-07-16 10:15:17 +00:00
Derek Foreman 629abeaf36 man: Remove binding documentation for desktop zoom
This feature has been removed, so the documentation for it should be
removed as well.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-15 14:45:10 +00:00