Add an explicit request to the backend config to choose the renderer.
Currently, only Pixman remains supported, with auto defaulting to that.
Signed-off-by: Daniel Stone <daniels@collabora.com>
When we're selecting our renderer, use the enum rather than two
mutually-exclusive booleans to not use the no-op renderer.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Add an 'auto' or unspecified renderer type, so we can use enum
weston_renderer_type during the configuration stage, where the target
renderer may be unspecified or unknown.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Similar to the backend type, also expose the renderer type enum as ABI.
This makes it possible to implement a more consistent config API, as
opposed to every backend hand-rolling its own use-the-other-one bool.
The enums are explicitly numbered to avoid 0, so 0 can be used as a
'not-specified' sentinel value to allow backwards compatibility with the
old config interfaces.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This doesn't really belong into shell-utils, so better move it out to
shared/config-parser. Renamed to weston_config_get_binding_modifier
to maintain the same namespace.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Allow C++ access from within C code and add macros to avoid
multiple inclusion of the header. Also, install the header for other
users of libweston to actually make use of it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
These shell utils functions are potentially useful to other shells as
well, so make them widely available.
Renamed all functions to weston_shell_utils namespace.
No functional change, copied ad litteram.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Compositor code can use opaque pointer comparison to determine whether
a head belongs to a given backend. Store a backend pointer in struct
weston_head to enable the compositor to select the correct backend
specific output configuration code.
This also allows to use the backend pointer instead of the opaque
backend_id pointer to check whether a head belongs to a backend, so
replace the checks in all to_xyz_head() functions and drop backend_id.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
struct weston_renderer is defined in libweston-internal.h, which is not
included from libweston.h. Add the missing forward declaration for the
renderer pointer stored in struct weston_compositor.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
When the new option is enabled, headless backend will draw decorations
around its outputs. This makes the actual "framebuffer" larger by the
thickness of the decorations to keep the video mode area free for
clients.
This will be needed for a future test, that will ensure that GL-renderer
will paint the output decorations correctly.
The output title is deliberately NULL, because text rendering is
unpredictable and depends on e.g. what fonts are installed in the
system. Therefore screenshot testing of any text would be really
painful, so let's avoid that.
The decorations setup code is mostly copied from wayland-backend.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Nothing in-tree uses this function, and its functionality has been
replaced with the weston-output-capture protocol extension which is
implemented in libweston core.
Users of this function should migrate to
weston_compositor_add_screenshot_authority() and replace custom
screenshooting protocols with weston-output-capture.xml installed by
libweston.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This implements the basics of the new screenshooting protocol. The
actual pixel operations will be implemented separately in the renderers
and DRM-backend.
See the previous commit "protocol: new screenshooter protocol" for why.
If DRM-backend needs more from weston_capture_task when it implements
writeback screenshooting, it will be easy to add user_data or expose
weston_capture_task::link for the backend to use. Those were not added
yet because it is uncertain what is actually needed.
The DRM-backend no-damage optimization requires special handling here as
well. See also 7f1a113c89 .
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We now depend on the matrices in weston_view being correct even when the
transform isn't enabled.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
When we build up a matrix from a series of operations, it's very useful
to know if the combined operations still result in something that matches
a wl_output_transform.
This adds a function to test if a matrix leads to a standard output
transform, and returns the transform if it does.
Tests are provided that check if complex series of operations return
expected results - the weston_matrix_needs_filtering function is tested
at the same time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
If a transformation matrix causes a scale, a rotation not a multiple of 90
degrees or a non-integral translation then textures rendered with
it would benefit from bilinear filtering.
This test is done in a lazy fashion by examining elements of the matrix
to check for a simple pattern that indicates these conditions are met.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This introduces a few getters to retrieve the pending state from
libweston-desktop, now just libweston, and makes use of it,
specifically get_pending_maximized to avoid sending invalid
dimensions to the client in the particular use case
set_maximized/unset_fullscreen.
These pending state getters are useful to query/poke a not-applied
yet state, and could be useful where we don't have a buffer attached
where the client might be set-up as maximized, but internally libweston
hasn't yet applied that pending state.
Fixes#645
Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Mimic the existing behaviour of logging once, but make it once
per output instead of per run.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
The current code only prints this once, and this is a probably a sensible
thing to do, as a clock read failure is probably not a condition that will
correct itself.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Ideally we'd like to see this more than just a single time, but we'd also
like to prevent it from triggering endlessly. Let's also make this happen
per output.
While we're here, use the word "abnormal" instead of "insane"
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We have a few places where we log messages only the first time they occur.
Provide a log throttling implementation so we don't have to open code this
in all the places that need it.
Instead of just logging a single time, allow some finer control. We allow
logging of a specified number of events. Additionally, we have an optional
timeout after which the event count is reset so we can log at most N
events in M ms.
The first new event printed after the timeout expires will also include a
count of suppressed events.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Some monitors expose a selector for the kind of content that will get
displayed, allowing them to optimise their settings for this particular
content type.
I got access to such a monitor, sadly even setting it to game mode
didn’t lower its atrocious latency, but drm_info[1] reports it to be set
correctly so hopefully it’ll work better with other monitors.
[1] https://github.com/ascent12/drm_info
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Sometimes callers don't want them, and sometimes (when view is NULL) the
coordinate is invalid.
Waste a tiny bit of time calculating them as needed in the callers
instead.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
We're always passing pointer->x, y converted to surface coordinates, or
garbage if view is NULL. Let's just stop passing those coordinates
entirely and calculate them in the function.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This adds basic VNC protocol support using the Neat VNC library
(https://github.com/any1/neatvnc). Neat VNC depends on the AML main
loop library. The backend makes use of AML's integrated epoll backend
and connects AML via file descriptor with the Wayland event loop.
This implementation does not support authentication and hardcodes the
pixel format currently.
Co-authored-by: Philipp Zabel <p.zabel@pengutronix.de>
Co-authored-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Stefan Agner <stefan@agner.ch>
[r.czerwinski@pengutronix.de:
- use new (as of 0.5.0) Neat VNC buffer API, with a buffer pool]
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
[p.zabel@pengutronix.de:
- transform repaint damage to output coordinates
- transform pointer coordinates into global space
- check that outputs and heads are in fact ours, see aab722bb1785..060ef82d9360
- track damage across multiple frame buffers
- choose pixel format by drm_fourcc, see 8b6c3fe0ad
- enable ctrl and alt modifiers
- fix frame timing to achieve a constant repaint rate
- pass initial size explicitly, see f4559b0760
- use resize_output with pixman-renderer, see 55d08f9634e8..84b5d0eb4bee
- allow configuring the refresh rate]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Currently the frame event gets lost: The touch focus is removed in the 'up'
event. So the focus is gone when the frame event arrives so it is never sent to
the clients.
To avoid this, keep the touch focus until the frame is handled.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This is arguably a little nicer without calling the pixman functions
directly.
In the future when we have different datatypes for coordinates in different
spaces, this test will only be valid on global coordinates, so this change
is also a precursor to stronger type validation.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This was actually introduced as part of desktop zoom. We no longer have
use of it.
This makes a subtle functional change - the output's matrices will now be
up to date immediately in cases where previously that update could have
been deferred.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Except the module dir path, they're one and the same. This change
warrants a libweston version bump, if it hasn't been done already.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
As things are, even when mode=current is specified on the .ini file,
a full modeset is needed (and done), which causes a very noticeable
screen blinking. That is because setting the max_bpc on a connector
needs full modesetting.
The idea here is that if mode=current on the .ini, no modesetting
should be done, so the current max_bpc is programmed into the
connector.
But if a custom max-bpc=... is specified, that will be used instead,
even if mode=current on the .ini
Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/660
Signed-off-by: vanfanel <redwindwanderer@gmail.com>
With commit 'Move libweston-desktop into libweston' we've moved out
libweston-desktop DSO into libweston. Move also the header to
libweston/desktop.
This removes removes the libweston-desktop pc file and bumps libweston
major version to 12.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Everywhere we are standardising to drm_fourcc.h pixel format codes, and
using struct pixel_format_info as a general handle that allows us to
access the equivalent format in various APIs. In the name of
standardisation, convert weston_compositor::read_format to
pixel_format_info.
Pixman formats are defined CPU-endian, while DRM formats are defined
always little-endian. OpenGL has various definitions. Correctly mapping
between these when the CPU is big-endian is an extra chore we can
hopefully offload to pixel-formats.c.
GL-renderer read_format is still defined based on Pixman format, because
of the pecualiar way OpenGL defines a pixel format with
GL_UNSIGNED_BYTE. That matches the same Pixman format on big-endian but
not the same drm_fourcc.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This allows for setting a buffer offset without having to make it part
of the wl_surface.attach request. This is useful for e.g. setting a DND
surface icon hotspot offset when using Vulkan; or doing the same with
EGL without having to use wl_egl_window_resize().
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This protocol allows clients to create single-pixel RGBA buffers. Now
that we have proper support for these buffers internally within Weston,
we can expose them to clients.
This bumps the build container version, as we now depend on
wayland-protocols v1.26.
Signed-off-by: Daniel Stone <daniels@collabora.com>
weston_compositor_reflow_outputs() assumes that all output are positioned from
left to right with no gaps in the same order in which they where created.
If the shell moves an output with weston_output_move() then this assumption is
no longer true. So stop reflowing the outputs in the case. The shell is now
responsible for positioning all outputs as needed.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
If a surface or a view is not mapped, then we should not be trying to
paint it. Check if this is the case and ensure that we only insert
paint nodes for mapped surfaces & views.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: #621
"max bpc" property is meant for working around faulty sink hardware.
Normally it should be set to the maximum possible value so that the
kernel driver has full freedom to choose the link bpc without being
artificially forced to lower color precision.
The default value is 16 because that is a nice round number and more
than any link technology I've heard is using today which would be 12.
Also offer an API set the value, so that weston.ini could be used in the
next patch for sink workaround purposes.
Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/612
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Add a struct weston_head parameter to weston_compositor_create_output()
and fold weston_compositor_create_output_with_head() into it.
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Stop plugins from overwriting the struct weston_output::destroy vfunc,
as that will be used by backends to recognize their outputs.
Instead, pass a plugin-specific destroy callback when creating the
virtual output.
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
As a first step towards heterogeneous outputs, add an opaque pointer
weston_head::backend_id that will be used by backends to identify
their own heads.
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/268
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This #define was used only by the matrix-test program, which was removed
in the previous commit.
Remove it as unused and fold away MATRIX_TEST_EXPORT.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>