Oops, this was always wrong but nothing actually checked it. Checks are
coming, so it needs to be fixed.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
PIXMAN_a8r8g8b8 / PIXMAN_a8b8g8r8 only matches GL_BGRA_EXT / GL_BGRA on little-endian.
So to have a GL format, we should use DRM_FORMAT_ARGB8888 / DRM_FORMAT_ABGR8888.
Without GL_EXT_read_format_bgra, the read-back format is DRM_FORMAT_ABGR8888.
Then weston-screenshooter fails to create a wl_shm buffer with WL_SHM_FORMAT_ABGR8888,
unless it has been added with wl_display_add_shm_format.
Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
Allow passing NULL to monitor string in order to set the default
"unknown" strings. This allows a head to be initialized with the default
strings, meaning that it will no longer be mandatory for a backend to
call weston_head_set_monitor_strings(). In DRM-backend case this makes
future changes more convenient.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We never expected these strdups to fail, and things tend to assume these
fields are not NULL (except serial_number).
Use xstrdup to ensure that a catastrophic OOM is immediately obvious.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If serial is unknown, it's best to leave it as NULL. All usage sites
already deal with it possibly being NULL.
This makes DRM-backend consistent with all other backend that leave
serial as NULL, allowing to move the initialization of these fields into
core.
Pipewire and remoting plugins are modified just for consistency.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.
Use CLIP() to simplify limiting the ms delay to a reasonable range.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Round up the ms delay to make sure that the finish_frame_timer always
expires after the next frame_time. That way, finish_frame_handler()
never passes a timestamp in the future to weston_output_finish_frame().
Setting frame_time into the future risks hitting an assert in
weston_output_finish_frame(), when it is called from start_repaint_loop
within the frame interval.
Use CLIP() to simplify limiting the ms delay to a reasonable range.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
If the compositor is disabling a weston_output,
weston_head_from_resource can return NULL, so the return code must be
checked where used.
Fixes#638
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
When gl_renderer_attach is called, surface->buffer_ref.buffer points to the buffer.
So if the surface state needs to be created, we have :
gl_renderer_attach -> get_surface_state -> gl_renderer_create_surface -> gl_renderer_attach
Fixes: 895b1fdcb2 ("gl-renderer: Attach buffer during surface state creation if possible")
Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
For drivers not supporting importing them directly. We use the equivalent
values to NV12 but with 16bit. The lowest 6 or 4 bits for P010/P012 are
padding and set to zero, so we can use the same subformats like for P016
and share the shader with NV12.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
They are the 10/12/16bit equivalents of NV12 and at least P010 is widely
supported for a while now, so let's support them.
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Since drm-backend requires libgbm 21.1.1 or later, there is no need to
support the old libgbm which does not support modifiers or fd import.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Initialize no-op color manager in weston_compositor_backends_loaded()
if weston_compositor_load_color_manager() was never called.
This makes weston_compositor_load_backend() live up to its name and
prepares it to be called multiple times.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Move the presentation clock selection loop into
weston_compositor_set_presentation_clock() and refactor
weston_compositor_backends_loaded() to make it possible
to add more functionality.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
We seem to be using at least mesa 21.1.1 since Weston 10, but we never
explicitly asked for it.
Fixes: #790
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Since we use paint nodes to track damage, we have to be very careful to
make sure that we never have paint nodes that aren't actually being
displayed on their outputs.
Shells may move views to invisible layers (minimized_layer, inactive_layer)
and this currently leaves the paint node alive but not visible on its
output.
When this happens, the paint node's previous visible region is left
undamaged, and the paint node is removed from processing.
Let's delete paint nodes when their views change layers, thus creating
damage for their full visible region.
This may create excess damage if the paint node moves between two visible
layers, but this is probably far less harmful than leaving pieces of
invisible views on screen.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Commit 43b59786 errantly claimed that paint_node_damage_below() needed to
damage all planes because it's used when moving paint nodes between
planes.
This is wrong because the destination plane will receive damage correctly
from paint_node_update_late() when the node's visible region is added to
its damage.
Leave the rest of that commit's changes, but make it once again only
damage the plane the node is currently on.
The problem this caused is easily seen by turning on triangle fan debug
and moving the mouse. Extra damage is generated beneath the cursor plane.
Fixes 43b59786
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Let backends declare the presentation clocks they can use with a
new bitfield weston_backend::supported_presentation_clocks and set
presentation clock after loading the backend in the compositor.
Make weston_compositor_set_presentation_clock() internal and replace
weston_compositor_set_presentation_clock_software() with an exported
weston_compositor_backends_loaded(), which is called by the compositor
after the backend is loaded.
In the future, this can be extended to determine the subset of clocks
supported by all backends.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
The function find_focus_successor() is called when destroying a surface to find
a successor to the current focus. It, however, has the following issues:
- Its first parameter is the weston layer from which to search for a successor.
This is an unnecessary flexibility for our use, which only adds complexity to
the user of the function by having to make a call for each layer. We know
that we want to search for a successor first in the normal layer, and if that
fails, then in the inactive layer. So we change the signature of
find_focus_successor(), removing this first parameter.
- It includes logic to decide whether to do the search or not: if the destroyed
surface is different from the surface that currently has focus, and if their
outputs are the same, then abort and don't do the search. This returns NULL to
the calling function. The problem is that the function also returns NULL if
it does the search and finds no successor. The distinction for the failing
reason is lost, and the user of the function needs to add more logic to know
the reason for failure. To simplify, we take the logic out of
find_focus_successor() and inside the caller.
- It returns the successor view, although it receives surfaces and the client
has logic to retrieve the surface corresponding to the returned view. To
simplify and maintain symmetry, we change the signature so that the function
returns the surface corresponding to the successor view.
Fixes: #738
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
We don't need to manually schedule a repaint after we've updated our
views - which happens as a side effect of destroying the transform/etc
within the animation.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Whenever a view is moved, we should schedule a repaint for the outputs
the view is on. This avoids users having to do it by hand every time
they change something. There is no change in determinism of behaviour
(e.g. 'I can reconfigure views as often as I like and it won't take
effect until I schedule a repaint' isn't true, because output repaints
might happen for reasons outside your control).
Signed-off-by: Daniel Stone <daniels@collabora.com>
This list walk is broken, the intent was to walk the tail of the list
starting from the currently held node - but that is not what happens.
Instead, walk the list backwards and stop a the held node.
Also, paint_node_damage_below() is used when moving paint nodes between
planes, and in these cases we definitely don't want to limit damage to
the current plane.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Currently this isn't calculated properly, and results in clipping away
important damage when a client moves from a non-primary plane to the
primary plane.
Instead of trying to fix it, let's just throw it away.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In other parts of the code, use_geometry implies a parent is present. So
let's clear it when we clear relative placement.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Having use_geometry set is not the only time we have a parent window,
apparently.
Clicking on the 'Line diff' drop down in gitk would cause an assert()
because of this.
Fixes#769
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Until kernel mainline does merge the aysnc page flip ioctl, make the
whole bit look like it's unsupported. We can further switch it back when
it lands into the kernel.
Fixes: 9203d98f
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reported-by: Simon Ser <contact@emersion.fr>
Stop flushing surfaces that are put on an overlay plane on the output to
be repainted next, but that have to be painted into another output's
primary_plane.
Now that each output has its own primary_plane, and flush_damage() knows
the output that is going to be repainted, texture_used can be limited to
surfaces that will actually be used by the renderer during the following
repaint_output().
Always upload when called from gl_renderer_surface_copy_content() or
gl_renderer_create_surface() with the output parameter set to NULL.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
When flush_damage() is called, the output to be repainted next is
already known. Pass it along into the renderer, which can make use
of this information:
The GL renderer can get a better idea which SHM surface textures
actually have to be updated, in case a surface can be put on a plane
on one output, but not another.
A future Vulkan renderer could record texture uploads into an output
specific command buffer.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Currently dbus support is built when launcher-logind option
is set; let's split that such that dbus is its own option
and launcher-logind depends on dbus.
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
Currently the dbus helper stuff is internal only in libweston,
let's move it to being public so that custom shells may use
the helper code.
Signed-off-by: Christopher Obbard <chris.obbard@collabora.com>
Use the shared helper extracted from the RDP backend to avoid leaking
modes into the output mode list on every resize.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
The ensure_single_mode() helper replaces an output's single mode.
Extract it into libweston so it can be reused by the VNC backend,
and rename it to weston_output_set_single_mode().
At the same time, set the the previously missing
WL_OUTPUT_MODE_CURRENT flag on the new mode.
Fixes#758
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
We can now have overlapping outputs, so we can remove the checks that
protected us against this previously.
We may want to consider adding checks for discontinuities in the future
though, so leave a brief comment where the checks used to be.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Now that planes are attached to paint nodes, we no have no reason to
prevent placing a view on a plane when it's on multiple monitors.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The primary_plane is currently shared amongst all outputs, and is the last
barrier to having overlapping outputs.
Split it up and make it per output instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The color-metadata-errors test inits outputs with a NULL compositor, and
makes a compositor that's entirely 0s except for the bits it's interested
in.
This makes a mess in a future where the primary_plane is split up per
output, as initializing the primary plane tries to add it to the
compositor's plane_list.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We don't need to do this, we can just leave them in the plane list until
they're used.
Also, doing so helps for when we want to move the primary_plane from
the compositor to the outputs in the future.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Remove plane->damage and instead accumulate damage on paint
nodes.
This is a step towards allowing multiple overlapping outputs.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Tracking the view's plane in the paint node in this way is a step towards
inflicting plane damage from paint node update during the output repaint,
instead of manually doing weston_view_damage_below().
We remove view->plane entirely and do all access through pnodes.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>