This API is mostly for use by the DRM-backend. Colorimetry mode is is
the KMS connector property "Colorspace" which defines the video signal
encoding colorimetry. A video sink indicates the supported modes in EDID
or DisplayID.
This patch adds the libweston API that allows backends to indicate the
supported modes for the frontends, and frontends to set the mode to be
used by backends. Colorimetry mode does not directly affect color
management inside Weston, it is only metadata for the video sink. It is
the frontend's responsibility to set up an output color profile that
agrees with the colorimetry mode. (That API has not been implemented
yet.) eotf_mode will be the same.
There is only one reason to make this a libweston core API instead of
a backend-drm API: when wayland-backend gains color-management protocol
support, meaning it can forward WCG and HDR content correctly to a
host compositor, the supported colorimetry modes can be determined from
the host compositor's supported color-management features, allowing the
guest Weston to pick some other output image description than the host
compositor's preferred image description. This likely allows only a few
other choices from standard colorspaces, so it's possible this isn't
sufficient for that use case.
Either way, it is easy to just copy the eotf_mode API design, and since
colorimetry_mode and eotf_mode go together, let both have the same API
design. It is possible to convert this to backend-drm API later.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Turns out these structures do not need to be in the public header, so
move them into a private header.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Just like with color profiles, generate an ID for color transformations
as well. This is not needed by protocol or anything, it is just for
debugging purposes. A small ID is easier for humans than a long pointer
value.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The windowed output API is implemented by the Wayland, the X11 and the
headless backends. It's currently not possible to create a secondary
headless backend when the primary backend is Wayland or X11 because
the windowed output API would be registered twice. This commit
suffixes the windowed output API names with the backend name in order
to avoid clashes: "weston_windowed_output_api_<backend>_v2".
A use case for Wayland or X11 as primary backend and headless as
secondary is for instance to request output captures on the headless
backend to avoid read backs on the primary backend's render buffers.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Damages and captures both trigger repaints of outputs. Some
configurations don't care about damages and use headless only for
captures. This commit adds a new feature to libweston that lets
outputs repaint only on captures, not on damages. The headless backend
enables that new feature when given a special refresh rate of 0 mHz.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Custom headless refresh rates can be useful to instrument clients
matching different screen configurations. This commit adds support for
that to the headless backend and exposes it to the frontend with the
"--refresh-rate" CLI option. The default refresh value is still 60 Hz.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
In this MR we add support to the majority of the interfaces from the
color-management protocol.
That means that we are able to advertise output's images descriptions to
clients, preferred surface images descriptions, and so on. We also
support clients that wants to create ICC-based images descriptions and
set such descriptions for surfaces.
We still don't support the interface to allow clients to create
image descriptions from parameters, but that should be addressed
in the near future.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is preparation for the CM&HDR protocol implementation. It requires
us to give a unique id to each color-profile, so let's do that.
In this commit we introduce a generic id generator to libweston, and
its first user: the color-profile.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Currently we flush damage for the "primary plane" every repaint, but this
is folly.
The drm backend may skip rendering entirely if using an all-planes
composition. This could leave the renderer plane in a messy state if a
surface on an overlay plane disappears.
Instead, let the backends flush the primary plane damage when they know
they need to render.
Fixes#864
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
And with it, bump libweston to next major version, 14. We seems like
we never used that argument so better just removed it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Ignore any client-supplied offset to subsurface commits to keep the same
consistency we find on other compositor.
Fix: #829
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
If coverage and power status are the same, we should prefer a primary
backend over a secondary one.
Fixes#818
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In some use cases the VNC client should not be allowed to resize the VNC
output. Add a boolean option "resizeable" in the VNC [output] section to
control this.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
The counterpart to weston_surface_is_unmapping(). This is valid for the
duration of processing the surface commit.
Signed-off-by: Daniel Stone <daniels@collabora.com>
We already have these for global coordinates, now we have them for
surface coordinates too. In addition to removing some unsightly
unadorned coordinate usage, this also adds appropriate coordinate space
id checks at runtime.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is a tricky bit of code and we use it in two places. Let's make a
single implementation.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This avoids spreading around the knowledge that the primary backend is
the first backend on weston_compositor::backend:list.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Let weston_compositor_load_backend() return a backend pointer and remove
the backend pointer from struct weston_compositor.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Before loading a backend, clear the weston_compositor::backend pointer
to check whether the backend supports multi-backend operation and adds
itself to the weston_compositor::backend_list.
Keep weston_compositor::backend pointing to the last loaded backend
either way, to allow the calling compositor code to store it away for
later, to check whether a head belongs to a given backend in the output
configuration code. This workaround can be removed after all backends
are converted to be multi-backend aware.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
In preparation for multi-backend support, add a list of backends to the
weston_compositor structure. Until backends are converted, this list
just contains the single weston_compositor::backend. Keep that pointer
for now, until the conversion is complete.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Most of these don't use the parameter that changes at all, but some get
a nice simplification.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
There are many times when we want to set a global position with a surface
offset added.
It's a fairly nasty operation, and most places in the code currently do
it naively, ignoring the painful existence of freeform window rotations
and other complex transforms that could be in play (but probably aren't)
Add a helper for this and convert existing usage.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Simple helper to multiply a surface coordinate by -1, -1. There are no
uses yet, but will be in a follow up patch that wants to have cursor
hotspots in their inverted form.
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>
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>
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>
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>
We're going to move primary planes from compositor to output, so we need
struct weston_plane to precede struct weston_output.
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>
Later, we'll want to use the visible region for damage tracking in
paint_nodes. For now, we can use it in the renderers where they've been
calculating it independently to draw paint nodes.
We still can't remove view->clip entirely, because
weston_view_damage_below() may be called before the first render of
a view, when its visible region hasn't been calculated yet. The
clip is empty at that point, which allows weston_view_damage_below()
to "work".
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
In the future we'd like to have multiple overlapping outputs.
weston_output_damage() currently adds damage to the output's coordinates
on the primary plane. This plane is shared between all outputs, so it
would result in damaging more than the intended output.
Eventually, plane damage will go away and be replaced by paint node damage,
and damaging the entire output would involve adding damage to a list of
paint nodes.
Instead, use a flag to indicate the output must be fully redrawn, and add
the damage during the repaint loop.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Most of the time when we're changing things about views, we don't need
to throw away the view list and rebuild it from scratch. The only times
when we need to do this are when views have been added to or removed
from the scene graph, or have been restacked within it.
Signed-off-by: Daniel Stone <daniels@collabora.com>
There's no need to go through and rebuild the subsurface list every
time. In addition to being unnecessary work, it complicates things like
damage tracking.
Track a new surface dirty status indicating that the subsurface tree has
changed in some way, and only rebuild subsurface stacking when this has
occurred.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This indicates that more than just the content changing, the form of the
buffer has changed in a way which may not be like-for-like to the
previous buffer but require significant reinterpretation. Examples
include the format, opacity, colour state, etc.
Signed-off-by: Daniel Stone <daniels@collabora.com>