This is useful for cases where we already have an open stream which we
can pass straight in and use it when printing node information.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Cache string invalidations happens in view update transform (which
handles most of the view updates, including layer movement and alpha
changes), and view unammping.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
We used to state that backgrounds are 0xAARRGGBB format, then we stopped
because alpha on a background is bad.
However, to get a black background we need a value other than 0, or the
shell just treats it as "no background color" and can use a default image
instead.
Explain how to describe a black background.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We'll be rebuilding state assuming it's all broken, so we should probably
avoid the reuse path as a precaution.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This fixes a huge bug: we were ignoring the return value from
verify_screen_content(), which meant that tests were always passing.
Also, this adds tests for single-pixel solid color buffers, which are
useful to verify that color effects are actually applied in such cases.
Renderers (as the GL-renderer) may simply use glClear() instead of going
through the full rendering pipeline when drawing solid colors, and we
need to ensure that color effects are applied in those cases as well.
Besides that, some refactoring was done to improve the code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
When repainting a paint node, if the buffer is a solid color buffer we
may skip the rendering pipeline and directly call glClear() with the
solid color, for optimization purposes.
Currently there's a bug where if the output has an output color effect
set, it is skipped when we have a solid color buffer (as we don't go
through the rendering pipeline, where the effects are implemented).
When we have color-management and the paint node contains a color xform,
we've opted for skipping this optimization and going through the
rendering pipeline for now. However, output color effects are simple,
so let's add the logic to apply them on CPU when we have a solid color
buffer.
Reported-by: Christopher Healy <healych@amazon.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This avoids hitting the assert that we don't have any paint nodes in
available when the repaint loop starts.
As we only have just a single curtain, in multi-head/outputs case a new
output creation will destroy the previous curtain and we'll end up
hitting the empty paint nodes assert.
Note that this doesn't add any functionality it just makes sure we're actually
capable of running the lua-shell rather than dying.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When moving the views between two outputs, the view's paint node is
removed from an output's z order list, but no paint_node_changes are set.
The drm-backend uses paint_node_changes to determine if it can reuse state,
so could leave a stale image behind on a plane until something else
triggered new state generation.
Make z_order_link removal dirty the paint node changes to prevent stale
state reuse.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
commit-timing uses presentation feedback to drive its repaint loop, no
need to keep the frame callback.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Users might start the compositor with the scene-graph debug scope which
requires having the clock set-up as implicitly one of the backends needs to be
loaded.
Just avoid doing that until we have one the backends loaded to prevent
a start-up crash.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This seems to cause a lot of stir in CI as it was failing for half of the
time.
Mark the test as succeeding for now and include the Mesa assert crash to
follow-up. We use that instead of SKIP to we have
WESTON_TEST_SKIP_IS_FAILURE.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
The protocol requires clients to perform an initial commit before they
receive configure events:
> After creating a role-specific object and setting it up (e.g. by sending
> the title, app ID, size constraints, parent, etc), the client must
> perform an initial commit without any buffer attached. The compositor
> will reply with initial wl_surface state such as
> wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
> event. The client must acknowledge it and is then allowed to attach a
> buffer to map the surface.
Previous to this patch various calls such as set_fullscreen() or
set_maximized() would schedule configure events, resulting in clients
being able skip the initial commit. This again made it possible to write
clients that only work on Weston, in violation of the protocol.
For xdg-popups we already tracked the initial commit status. Move it
to xdg-surface, guard schedule_configure() on it and ensure to run the
later on the initial commit.
Incorporate tests that checks if we get configure events when calling
set_fullscreen/set_maximized and tests that uses the main xdg_surface as
a parent to a sub-surface (which initially triggered this issue).
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The change in 65227cb7d4 is actually destructive, as it causes multiple
drm-backend heads to no longer be repainted at the exact same time at
startup.
This frequently leads to a failure to flip when only one head is properly
set up and others have stale state.
Force stampless finish_frame to skip any time adjustments to restore proper
behaviour.
Fixes: 65227cb7 (compositor: Round repaint times down to possible presentation times)
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Make sure we check if a paint node has been assigned to a view before
trying to dump its contents.
The scene graph dump from the repaint loop should always be ok, but if
we're using weston-debug we could race with the repaint for a new view
and try to print the scene graph before the node is created.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
For systems where udmabuf is not available.
Fixes: 75d75ac6c (tests: Add color-representation tests for DRM and GL)
Signed-off-by: Robert Mader <robert.mader@collabora.com>
The new color-representation-drm test occasionally crashes Mesa. Update
to the latest point release in case it helps.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Test the various combinations of:
1. Renderer backends - currently GL only.
2. Renderer modes - plane-offloading/vkms, shaders in Mesa, internal
shaders.
3. Buffer-types - SHM and DMABuf.
4. Coefficient/range combinations.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Using values from the color representation protocol. Only supported for
YCbCr formats in KMS drivers for now.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
`EGL_YUV_COLOR_SPACE_HINT_EXT` and `EGL_SAMPLE_RANGE_HINT_EXT` have
to be set at image import, which again happens on wl_buffer creation.
This is problematic because in Wayland (and Vulkan) those values are
surface attributes and thus only known once the buffer gets attached
to a particular surface.
We solve that by first importing the dmabuf with default values and,
when attaching a buffer to a surface, creating additional EGLImages
as needed.
Note that we ignore `EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT` and
`EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT` for now, which are neither
required by the Wayland color-representation protocol nor supported by
Mesa shaders (as of 25.3).
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Unlike EGL image import, texture creation and binding is quite fast and
cheap. Thus, instead of doing it as early as possible in various places,
do it right before we actually need it in prepare_textured_draw().
This will follow-up changes easier and includes some preparations for
them.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Add matrix-coefficients and range tracking to more gl-renderer structures
and get the relevant values from the color-representation implementation
instead of hard-coding them in the shader.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
For now limited to coefficients and ranges that are typically
supported by KMS drivers. We notably leave out alpha modes and
chroma locations for now.
The protocol initialization is guarded by the WESTON_CAP_COLOR_REP
backend capability and thus not enabled anywhere yet.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Doesn't yet deal with work area (monitor area excluding panels etc), or
reconstraining while moving, but it's a start.
It's more or less based on the mutter implementation. While the mutter
implementation is GPL, it was authored by me, thus grant permission to
relicense to MIT.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Add a simple client that queues up a few future frames and logs how
accurately the requested presentation times were hit.
This used simple-shm as a skeleton, and those copyrights have been retained.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.
We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Currently this shouldn't result in any change, since the times we pass in
are real presentation times.
Later when commit-timing lets applications pass in arbitrary times, it
will be more interesting.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Validate repaint_msec so it's not longer than a refresh interval.
Negative repaint windows will cause problems for frame scheduling in the
future, so remove them.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we add timed transactions, we'll want to feed them through the repaint
timer, so share it to allow this in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Add a listener and a roundtrip so test clients using presentation have
access to the presentation clock id.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the near future commit-timing + VRR combined will want to have better
than the 1ms precision we're allowed now.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
After moving the drm-backend's scene graph dump, it now always occurs when
repaint_status is REPAINT_AWAITING_COMPLETION, which loses useful timing
information we used to have.
Add timing information for the REPAINT_AWAITING_COMPLETION state, and also
add the expected presentation time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we need to use VRR, we'll miss a potential frame deadline, fail to
deliver a frame, then stop the repaint loop. When a late frame comes
in, we deliver it immediately at the start of a new repaint loop.
The only time we really need to deliver a frame immediately is at
the start of the loop, otherwise we can use the same repaint window
behaviour as any other time.
This still leaves some room for improvement, as we still don't try
to avoid Vactive.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>