`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>
We've been clobbering non-solid buffers with solid buffer attachment in
situations where we override the real buffer with a placeholder.
If the reason (punch hole, censor) that led to the placeholder is no
longer in effect, and new buffer is attached, we won't render what we should.
Instead, let's not attach anything for the paint node draw_solid case, and
allow gl_buffer_state be NULL when the real buffer is solid. gl_buffer_state
can then always be the correct state for the real buffer, even if we don't
use it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Currently it uses some values from the existing sconf, instead let's make
it calculate everything on its own
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Refactor textured draw setup into a separate function, preparing for a
future where we set up solid draws from init_for_paint_node as well.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Turns out gl_shader_config_set_input_textures is what adds the filter
parameters to the sconf, so we must set the filters before calling it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In order to be more in line with weston_view_is_opaque() - which we
use in most cases to set the value - and ensure the expectations of
existing places in the code are honored, see usages in both
draw_paint_node() implementations.
An exception here are holes - these always need to get painted as fully
opaque in the renderer path.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
This should be checking for a valid transform so it doesn't use corners
of an axis aligned bounding box for free-form transformed views.
It should still check surf_xform for color management, but it should only
do that when surf_xform_valid is true.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Video underlay "holes" are fully transparent but must be rendered
fully opaque. However, they appear to be fully transparent to
the current gl-renderer test which is missing a need_hole check.
Add a paint node attribute for this so it can be more easily
checked in assign_planes and renderers.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If we have a solid region which is opaque, we don't need to go through
blending: we can simply emit a glClear, which has a pretty big benefit
on tilers in particular.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of predicating the call to ensure_surface_buffer_is_ready() on
various conditions, move those into early exits from there.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Now that paint nodes handle solid buffers properly, we can use the same
codepath through gl-renderer for all solid buffers, regardless of
whether they're a single-pixel buffer from clients, or a weston_curtain,
or a temporary placeholder due to content-protection or direct-display.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we're calling weston_surface_copy_content() from a solid buffer,
use the buffer's solid colour directly instead of our local copy.
Signed-off-by: Daniel Stone <daniels@collabora.com>
The answer is that no, we do not need to be using the view's opaque
region. If the paint node is marked as fully opaque, that's because the
view itself is also opaque, and as we are dealing with surface
co-ordinates we don't need to be handling the transform here.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Writeback connectors often support multiple formats, fully independent
of the input framebuffer. Wire up support for querying formats and send
them to clients.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Output color effects are applied to the whole output scenegraph. It
depends on color-management being disabled, as the color effects are
applied in sRGB content.
For now we added only a few accessibility options: color inversion,
deuteranopia, protanopia and tritanopia CVD correction.
Note that surfaces presented on outputs that contains a color effect
can't be used for direct scanout (i.e. bypass composition and offloading
to KMS overlay planes). The color effect is applied in our GL-renderer.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Listen to the capture destroy signal so we can prevent the async fd
source from causing a UAF.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When gl_renderer_display_create() fails, do not change the compositor
capabilities.
The compositor may not abort when that happens, it may simply decide to
fallback to another renderer. So setting anything on failure is wrong.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This goes through all formats available in the EGLConfig's that we
get from EGLDisplay and expose them in a struct weston_drm_format.
Currently backends choose a format for their outputs and hope that
GL-renderer is able to find a compatible EGLConfig. This should help
backends to avoid guessing.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Let's be more more specific and rename the renderer interface function
that returns the supported dma-buf formats. I.e. if we pass a dma-buf
with one of these formats for the renderer, it should be able to import
it.
Next we'll introduce a function to query the rendering formats from
the renderer, so this distinction is important.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
No behavior change, just to make things easier for next commits. They
will need struct gl_renderer *gr in print_egl_config_info().
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We might not want to enable these scopes always so don't limit
the GL-renderer availability based if these are enabled or not.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This just moves gl-borders up to libweston weston_renderer as-is,
with no change in functionality.
This is a preparation step so that other renderers can use the
same interface.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Forcing the fallback paths for YUV formats. This will allow us
to test these paths on CI now that llvmpipe supports all tested
formats natively.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
So we can test them on CI. For completeness and because they
are commonly used by SW decoders.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
When the 1st frame of the X11 backend is rendered by the GL renderer,
an invalid call to glBindTexture() with a target of 0 is emitted. This
is because the border status of the window renderbuffers are flagged
dirty while the border status of the output state is not. This commit
ensures that the output state and the renderbuffers border status are
dirty by default. It also enforces the creation of output border
textures even though no valid data have (yet) been passed, in which
case the textures are filled with transparent pixels.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This converts weston_matrix and weston_vector to use linalg-types
internally. All direct accesses to members had to be converted
everywhere, mostly in the simplest form possible which leaves some
trivially reducable code around.
The intention is that we can now gradually migrate away from
weston_matrix in the future.
Look like one trailing space got accidentally annihilated in
compositor.c.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
A window freeze can occur in specific use cases like when using a kiosk
shell. It scales surfaces to fit the compositor size and the transformation
to buffer space can, in some cases, round the size one pixel higher than
the texture size, making glTexSubImage2D() refuse the size argument and
generate a GL_INVALID_VALUE without updating the texture.
This commit ensures the GL renderer doesn't exceed the texture size.
Here is how the issue was reproduced:
$ weston --renderer=gl --backend=wayland --width=1920 --height=1080 --shell=kiosk
$ gst-launch-1.0 videotestsrc ! video/x-raw,height=590,width=500 ! waylandsink display=wayland-1
Signed-off-by: Théo Maillart <tmaillart@freebox.fr>
Formats using SHADER_VARIANT_Y_XUXV can now use SHADER_VARIANT_Y_UV
instead with swizzle variations in order to simplify the fragment
shader.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Automatise variant and planes selection for legacy EGL buffers support
by using the global information from the YUV formats table and setup
texture swizzles for legacy EGL buffers and dma-buf.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Support more YUV formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Support more RGB formats using texture swizzles. Automatise wl_shm
format addition based on the format table using the new texture format
utility gl_texture_is_format_supported().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Simplify fragment shader logic by getting rid of the RGBX variant
which can be implemented using texture swizzles instead.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>