The batches debug mode tints each batch of a repaint pass in a
different color in order to highlight batches.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Use gcc and clang's 'fallthrough' attribute instead of a comment to
fall through switch statements. This allows to request fall through
inside a block and prevents issues with preprocessed files.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The wireframe debug mode needs to clear the current renderbuffer in
order to clean up old wireframes lying around. This commit makes this
system generic for upcoming debug modes with similar needs.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
In order to avoid the complexity of handling multiple debug modes at
the same time, this commit makes wireframe a proper debug mode. It
also uses the new tinting system to make the white wireframe pop over
a darkened damaged region.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Don't color sub-mesh differently in wireframe mode. There's not much
interest in being able to distinguish the sub-meshes in a paint node
and this allows to simplify the logic by removing the color vertex
stream.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Current green tint support is a hard-coded Porter-Duff premultiplied
blending of a green source (slightly skewed on the green channel) over
the updated damaged destination. This commit makes green tinting
generic by letting the shader user provide a custom tint color.
The goal is to reuse that system for the upcoming debug modes.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Set up debug mode initial infrastructure using a dedicated key binding
and make shaders debug a debug mode.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This prevents a potential abort yelling:
PANIC: ../subprojects/neatvnc/src/server.c: 2245: Multiple displays are not implemented. Aborting!
which happens because we never unregister the output, a mirror function
for nvnc_add_display().
Further more, we migrate nvc_close() to vnc_destroy() and check for
a valid output in vnc_client_cleanup(). Having a single caller in
vnc_shutdown() (which was migrated) we removed that entirely. Necessary
to avoid a use-after-free caused by nvc_close().
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
After c08a6ff8 moved attach to the render loop, we have a bad situation
when clients delete an attached shm buffer. We try to query the stride
at attach time, but the shm_buffer has been destroyed, and we crash.
Instead of carefully fixing that, I've instead stored the stride at
buffer creation time (as we already do with buffer width and height).
This lets attach succeed in the gl-renderer, keeping the old texture data
available for any upcoming rendering.
Fixes: #927
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Tested-by: Connor Abbott <cwabbott0@gmail.com>
is_fully_opaque takes precedence over opaque region, so we shouldn't
replace surface_opaque with the opaque region when is_fully_opaque is
true.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We can skip posting damage beneath planes that are fully translucent,
but that doesn't mean we can skip posting damage beneath planes that
are not fully opaque.
Add a check for content that is entirely blended, and use that instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
image should be initialised to NULL in case image loading fails
between setjmp() and xzalloc().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Fix ‘image’ clobbered by ‘longjmp’ warning using volatile.
jpeg_image_data members are now also declared volatile (like
png_image_data members) to explicitly request compilers to store them
on the stack (not in registers) to avoid warnings and bugs later.
Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Doing this might cause unnecessary DRM importing, which might result in
an error when the DRM's memory address mapping is nearly full.
Return before attempting to create drm_fb to avoid that, since it will
fail in the later check anyway.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Mistakenly used weston_seat as opposed to shell_seat when iterating over
the shell seats. This unfortunately takes down the compositor upon switching
back.
Fixes: 4c100ca1d7 ('desktop-shell: Add session listener')
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This most likely is a driver fail, as we shouldn't be getting a zero
value for max_brightness. Later on, this will be used to compute a
normalized brightness which would trip a with a division by zero.
Rather than fixing that up, just don't enable backlight support and
reportat that to the user that we have an invalid max_brightness value
and not backlight support.
Fixes: #878
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Moving attach to the render loop in c08a6ff8bd
caused this to crash if the shm buffer is destroyed between being committed
to a surface and being rendered.
Since we don't keep a reference to the buffer pool anyway, we might as well
just skip the attachment here.
Fixes: #922
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
weston_output_schedule_repaint() already checks the compositor state but
idle_repaint() is called asynchronously so the state may have changed.
Check the state again and abort if necessary.
Without this the DRM compositor might execute a modeset in
drm_output_start_repaint_loop() which should not happen while sleeping or
offscreen.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
With commit a1f8c49d5b 'compositor: repaint backends separately'
we will be repainting outputs independently so there's no need to keep
this band-aid on. Further more, the comment was most likely wrong.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
With commit a1f8c49d5b 'compositor: repaint backends separately'
we will be repainting outputs independently so there's no need to keep
this band-aid on.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Turns out kiosk_shell_output_set_active_surface_tree() requires having a
valid output which as seen in the wild might not be case. Prevents
an illegal dereference on an invalid shoutput.
Fixes: #920
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Render wireframe within paint nodes instead of drawing lines in a
second pass. The wireframe is blended over the node in a single draw
call. This slightly simplifies the logic by removing the computation
of a second set of indices and enables wireframe anti-aliasing using
Celes and Abraham's "Fast and versatile texture-based wireframe
rendering" paper from 2011.
Celes and Abraham use a one-dimensional set of texture coords for each
triangle edge, 1.0 for the 2 vertices defining the edge and 0.0 for
the other vertex, which basically define barycentric coords. Texture
mapping and the mip chain is then exploited to give a constant-width
edge. The main drawback of the technique is that contour edges of
node's damage mesh are drawn half as thick as interior lines since
each triangle draws half of each line's thickness.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Wrap compiler builtins into shared functions with proper generic
implementations. __builtin_clz() isn't wrapped for now because its use
by screenshooter is pretty specific. It will be properly wrapped in
the next commit which needs a round up to the next power of 2
function.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Only pass -W (warnings are fatal) to Sphinx if we've set Werror in
Meson.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Closes: wayland/weston#917
When a commit fails, then only the outputs that where part of this commit should
be reset or restarted.
Otherwise an unrelated output that has another successful pending commit may be
restarted incorrectly. Then the output is in an inconsistent state and will
trigger an assertion:
weston: ../libweston/backend-drm/state-propose.c:627: drm_output_propose_state: Assertion `!output->state_last' failed.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Currently only the return value of the last backend that implements
repaint_flush() is actually used. That only works because the drm backend is the
only backend that implements repaint_flush().
In the drm backend only the return value of the last device is used. And if a
failure is actually detected, then all repainted outputs of all backends are
reset. This can trigger asserts:
weston_output_schedule_repaint_reset() (or _restart()) will change the state of
the output but the backend that did not cause the failure will still call
weston_output_finish_frame().
The same thing can happen with multiple devices in the drm backend. Or outputs
get stuck if an error is dropped.
Since the drm backend is the only one that implements repaint_flush() anyways,
move the failure handling into the backend and make it device specific.
This way only the outputs that need it are reset.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
With multiple backends or devices repaint_begin/repaint_flush may be called even
if no outout of a device will be repainted. This results in an "empty" drm state
without any output.
The actual commit to the kernel is already skipped but the drm-backend log is
still filled with "Beginning repaint"/"repaint-flush" messages and the scene
graph.
Use the new prepare_repaint() callback to determine if a backend needs to be
repainted and only create the pending_state if necessary.
Exit early in repaint_flush()/repaint_cancel() when no pending_state was created.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
When a repaint is triggered then not all backends may have outputs that need to
be repainted.
Check which outputs will be repainted first and then repaint only the backends
that need it.
This way unnecessary repaint_begin() and repaint_flush()/repaint_cancel() can
be skipped and errors are handled for each backend separately.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
We're now using EGL_EXT_present_opaque and EGL_EXT_surface_compression
in weston-simple-egl, but this breaks the build for people that don't have
them in their system headers.
Pull them in from the khronos headers.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
And use it to perform keyboard activation on the currently focused
window. Similar to what kiosk-shell does, with the note that we go
over all seats in the system rather than picking the first one
available.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Similarly to all the other back-ends do the same for the RDP one.
With this change the remote output will be placed, similar to the
VNC/PipeWire on the right side from the native one, when both backends
are loaded.
But ultimately this patch is about having all backends share the same
code path.
Fixes: #820
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Stop writing weston_buffer::shm_buffer when weston_buffer::type is not
WESTON_BUFFER_SHM. Instead, explicitly write to the union field
that corresponds to the buffer type.
Also add a comment why we clear the shm_buffer/dmabuf/legacy_buffer
pointer here.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Makes things clearer which planes we have been skipped due to fmt/modifier.
All other debug sites print out the plane id, and the assumption might
be that we retried the same plane when it fact is a different one.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
When option "-c <bpc>" is specified, the application uses
EGL_EXT_surface_compression extension to compress the window
surface to the given bitrate (bits per component).
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
If section is NULL, weston_config_section_get_*() will assign the given
default value and return -1 with ENOENT. Hence, checking for NULL
section is unnecessary.
This cleans up only the simple cases.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Clear the selected buffer pointer immediately before the array walk to
pick a new buffer so we don't accidentally re-use the attached buffer
when it's already in use.
Set the buffer used bit only when we attach and commit a buffer - this way
we don't accidentally consume all our buffers with no way to have them
released.
Clean up buffers based on wl_buffer presence instead of used at end of
run.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
With attach only being called at render time, the dmabuf can be deleted
along with its private data before we attach for the first time.
Let's move the first-time logic into its own callback to call at
buffer setup time instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Seems like a typo, found by reading shader debug scope logs and
wondering why "!?!?" is there, e.g.:
Deleting shader program for: !?!? SHADER_VARIANT_XYUV
SHADER_COLOR_CURVE_IDENTITY SHADER_COLOR_MAPPING_IDENTITY
SHADER_COLOR_CURVE_IDENTITY -input_is_premult -green
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Add API to create color profiles from parameters. It is a public API
that should be used by the frontend and also by the color management
protocol implementation.
Currently our protocol implementation does not support clients that want
to create color profiles from parameters, and this is a step towards
supporting that.
As warned in "color: add get_color_profile_from_params() to color
managers", we still do not fully support creating color profiles from
parameters. This just creates a boilerplate color profile that we're
planning to extend later.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>