Commit Graph

9691 Commits

Author SHA1 Message Date
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
Pekka Paalanen a16598b038 backend-drm: make libdisplay-info mandatory
Making libdisplay-info a mandatory dependency allows us to drop this old
code.

Future new features will require libdisplay-info to work, and would not
get fallback code anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-15 14:29:02 +00:00
Derek Foreman 0a4f50a072 libweston: Remove output->scale
We've got output->scale, output->current_scale, output->original_scale and
output->native_scale.

output->scale is apparently just a weird temporary variable, and has led
to some confusing bugs.

Remove it entirely.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-15 11:50:49 +00:00
Derek Foreman d500dbd4e2 xwm: Fix input regions
commit 0f99e081c4 broke xwayland client
input regions. The xwayland window manager sets input regions in the
pending state without going through the function that sets the
WESTON_SURFACE_DIRTY_INPUT bit.

Just add the dirty bit to the xwm code.

Also, fix the whitespace error the same patch introduced.

fixes 0f99e081c4

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-12 12:16:20 -05:00
Daniel Stone 3b7ef70d3a repaint: Requeue presentation feedback on failed repaint
Whenever an output repaint fails, we leave the presentation-feedback
requests hanging. Requeue them back to the surface so the next repaint
attempt can collect them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2024-07-12 17:50:22 +03:00
Daniel Stone f5074f261a view: Move psf_flags from weston_view to weston_paint_node
Fundamentally, the flags are a property of each paint node, rather than
each view as such. Move them over there so it gets a little less painful
to work with.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2024-07-12 17:50:21 +03:00
Derek Foreman b56d887e34 rdp-backend: Fix more scale that should be current_scale
Commit c3321d5819 tried to fix this, but
I didn't thoroughly look for other uses of the wrong scale variable.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-11 12:37:25 -05:00
Marius Vlad 3bb9b664ad weston-drm: Add a note into man page about gbm-format
We do inform users when this is not happening, add also a note about that
in the man page.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-07-11 10:53:46 +00:00
Chao Guo 5ce486037e backend-drm: Improve the way to find plane for view
1. remove the restriction on underlay planes when finding plane.
Because the view on the underlay plane can be displayed by drawing
a through hole on primary plane, so we can try underlay planes.

2. Add step to check if the view is assigned on underlay plane, When
it is successfully placed on a HW plane. Because we need to set the
underlay view pnode->need_hole to true so that gl-renderer
will draw a hole for it  when repainting.

3. Avoid assigning views to underlay HW planes when the backend format
is opaque and avoid assigning views with alpha to underlay HW planes.

4. when overlay plane is not enough, try to find underlay plane on
platform with both overlay and underlay plane.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-07-11 10:53:30 +00:00
Chao Guo 1065d23406 backend-drm: Improve plane assignment for underlay platform
On underlay platforms, the HW planes can be placed below the primary
plane, so some views that intersect with the renderer region can try
to be placed on the underlay planes. In order to assign these views
to underlay planes, the improvement is as follows:

1. Add current_lowest_zpos_overlay. Record the current lowest zpos
   of the overlay planes.

2. Add current_lowest_zpos_underlay. Record the current lowest zpos
   of the underlay plane. It is initialized to scanout_plane::zpos.

3. Add need_underlay to indicate whether to find underlay plane for
   view.

4. The views that intersect with the renderer region and underlay
   views should be assigned to underlay planes.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-07-11 10:38:43 +00:00
Chao Guo a7bfecd541 backend-drm: Add some underlay plane helper elements
Add 'is_underlay' in drm_plane, which is used to indicate whether the
HW plane is below the primary plane at the Z position.

Add 'has_underlay' in drm_backend, which is used indicate that there
are underlay planes in drm backend.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-07-11 10:38:37 +00:00
Chao Guo 827e22761b gl-renderer: Draw holes on primary plane for the view on underlay
Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-07-11 09:47:32 +00:00
Chao Guo 99eff1276a compositor: Consider punch holes when flushing damage
Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-07-11 08:59:03 +00:00
Chao Guo 0000c491f4 backend-drm: make the renderer produce client format matched image
When users need to place view on underlay HW plane, they need to set
the output format to alpha format.

This will cause gl-renderer to output a transparent image, allowing
through holes to work.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-07-11 08:59:03 +00:00
Chao Guo e1594110f0 compositor: Add a new member to the weston_paint_node
Add a boolean member named need_hole in weston_paint_node, which is used
to indicate whether the renderer should draw through hole on primary
plane when rendering.

For paint node whose view are placed on the underlay plane, this
member should be set to true, otherwise it is false.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-07-10 13:17:21 +00:00
Michael Olbrich 1c7cf4796a drm-backend: really reset/restart outputs of a failed commit
This reverts f843ba34d1 ("drm-backend: limit
reset/restart to output of a failed commit") and actually solves the problem
correctly.

The pending_state is no longer valid at this point, so it cannot be used to
determine the outputs of the current commit. So only clear will_repaint when
starting to repaint, so it can be used to determine which outputs of a device
were actually repainted and use it to reset/restart those outputs.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-07-10 00:47:04 +02:00
Derek Foreman 661a7142ca libweston: Defer animation destruction to idle loop
If the first tick of an animation finishes the animation, then the
animation is destroyed before its creation function even returns.

Let's just defer that destruction to the idle loop so that can't happen.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-08 11:17:10 +00:00
Derek Foreman b3df77a627 libweston: Refactor deferred animation destruction
refactor the deferred animation destruction code into
defer_animation_destroy() so we can use it elsewhere later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-08 11:17:10 +00:00
Derek Foreman 05f199feea libweston: Move idle_animation_destroy to before frame handler
No functional change, we'll just need this function earlier in a
later commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-07-08 11:17:10 +00:00
Loïc Molinari dbf408791c gl-renderer: Move debug mode setup to dedicated func
This moves debug mode setup to a dedicated function because the
addition of new modes made it bigger.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-04 14:15:04 +00:00
Loïc Molinari e512f5482d gl-renderer: Remove shaders debug mode
The shaders debug mode doesn't have much interest now that other more
specific debug modes show shaders too.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-07-04 14:15:04 +00:00