Commit Graph

8302 Commits

Author SHA1 Message Date
Pekka Paalanen
02879a93d7 gl-renderer: use fb_size/area in egl_y_invert
Do not use border texture size when we have the area stored. This
decouples border texture size further.

We also have buffer_height available directly from fb_size, so do not
reverse-engineer it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 15:48:51 +03:00
Pekka Paalanen
39a9b654b9 gl-renderer: use a loop in output_get_border_damage()
Pure refactoring to make the code easier to read.

Also drop the redundant all-clean check.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 15:48:51 +03:00
Pekka Paalanen
326a762e25 gl-renderer: use a loop in draw_output_borders()
Pure refactoring to make the code easier to read.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 15:48:51 +03:00
Pekka Paalanen
5b82324b79 gl-renderer: stop using texture sizes for border area
Compute the border area from the framebuffer size and composited area
only.

Now the border textures can be freely sized while they will be stretched
to fill the respective border areas. In fact, this was already made use
of by having left/right image height=1 as special cases. Now all the
texture dimensions behave the same.

No change in behavior, the values are the same, just computed
differently.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 15:48:51 +03:00
Pekka Paalanen
fccb21f17e gl-renderer: refactor into output_get_border_area()
This moves the identical code from draw_output_borders() and
output_get_border_damage() into a new shared function. Reduces code
duplication.

This is a pure refactoring, all the computations stay the same.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 15:48:39 +03:00
Pekka Paalanen
7e49d1ada1 gl-renderer: use fb_size and area for border
This step prepares to share the coordinate computations between
draw_output_borders() and output_get_border_damage(). The use of
weston_output is replaced with gl_output_state, so that when sharing the
code in a new function, it does not need a weston_output.

This stops the function from accessing output->current_mode and use the
gl-renderer tracked frambuffer size and compositing area instead. Not
using current_mode is a small step towards allowing gl-renderer to
render for other targets than an output.

No behavioral changes, all the values are still the same.

See the diagram in gl-renderer.h for the border areas.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 15:47:00 +03:00
Pekka Paalanen
8c4f75f0ea backend-x11: use resize_output with GL-renderer
We get rid of unnecessary GL-renderer output state destroy and create,
meaning we don't destroy and create an EGLSurface either.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
a989d12c04 gl-renderer: implement shadow resizing
This is necessary if you want to resize an output that uses a shadow
framebuffer, instead of destroying and re-creating the renderer state.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
7886cbe4b9 gl-renderer: pass initial output area explicitly
This changes the GL-renderer interface to pass the initial framebuffer
size and compositing area explicitly. All backends are changed to
provide the correct parameters.

GL-renderer mostly does not yet use these values, but later patches
will. The pbuffer path uses it already, because they replaced the
existing fields.

All this is to make GL-renderer aware of the different sizes, so it can
implement the future revision of the screenshooting API.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
84b5d0eb4b backend-x11: use resize_output with pixman-renderer
Now that resize_output() exists and is implemented for Pixman-renderer,
use it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
e78e0cf53d backend-rdp: use resize_output with pixman-renderer
This is a slightly better way of keeping pixman-renderer aware of the
target size.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
55d08f9634 pixman-renderer: track framebuffer size explicitly
This will make sure that backends do not forget to tell us about
resizes.

composite_*() functions still read the size from the destination buffer,
because pixman_output_state is not available there.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
f4559b0760 pixman-renderer: pass initial size explicitly
In a journey to decouple renderer from weston_output, pass the initial
framebuffer size to Pixman-renderer explicitly.

Now Pixman-renderer will never look into weston_output::current_mode.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
deff50963e pixman-renderer: implement shadow resize
This is necessary if you want to resize a Pixman rendered output that
uses the shadow.

Also reset the current hw_buffer to NULL, because surely it needs to
change and we don't want to keep an old buffer live for no reason if
there happens to be one.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Pekka Paalanen
8636422309 libweston: add weston_renderer::resize_output()
Previously renderers were not told when the output (framebuffer they
need to draw) size changed. Renderers just pulled that information out
from weston_output::current_mode when they happened to need it. This
makes some things awkward, like resizing the shadow or intermediate
buffers. In fact, Pixman-renderer does not even support resizing its
shadow buffer, nor does GL-renderer. DRM-backend has to destroy and
re-create the renderer output state anyway, but rdp, x11 and wayland
backends would be natural users of resizing API.

This commit adds an API for resizing with empty implementations. Actual
implementations will be added in following patches for each renderer
while moving parts of resizing code from backends into the renderers.
No-op renderer needs no implementation.

Only wayland-backend has actual resizing code already, and that is made
to call the new API. Unfortunately, Pixman and GL renderers differ: one
does not blit them while the other does. In order to assert the
functionality of each renderer to keep the API consistent,
wayland-backend needs to lie to pixman-renderer. That's not new, it
already does so in wayland_output_get_shm_buffer() where the 'pm_image'
addresses only the interior area instead of the whole buffer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-23 12:42:05 +00:00
Colin Kinloch
c67b064e62 meson.build: Add devenv for running from the build directory
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2022-09-23 12:28:13 +00:00
Derek Foreman
cb5872f0a6 screen-share: Use weston_output_contains_point
Let's not open code this here anymore.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 12:08:34 +00:00
Derek Foreman
bb8ef7d271 libweston: Refactor point in output test
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>
2022-09-23 12:08:34 +00:00
Derek Foreman
5c352b8f4f compositor: Remove output dirty bit
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>
2022-09-23 12:04:00 +00:00
Derek Foreman
3a61976af7 matrix: Make matrix const in weston_matrix_transform
This function doesn't need to change the matrix, so we might as well
enforce that.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 12:00:59 +00:00
Derek Foreman
e5e9980391 desktop-shell: Remove unused params from internal map() function
We don't use these.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:57:57 +00:00
Derek Foreman
64c618e47e libweston: Remove x,y from weston_plane_init
This is always passed as 0 right now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:53:16 +00:00
Marius Vlad
eaf2de3441 compositor: Use weston_load_module
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>
2022-09-23 11:47:40 +00:00
Derek Foreman
21deaee6a9 libweston: use weston_region_global_to_output more often
Use this anywhere we used weston_matrix_transform_region with an output
matrix.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman
342afb390b libweston: rename weston_output_region_from_global
Rename weston_output_region_from_global to weston_region_global_to_output,
and also no longer modify in place.

Trying to make it look a little nicer, as well as making it easier to use
from other places that don't want modify in place semantics.

This becomes a very thin wrapper around weston_matrix_transform_region.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman
2e5b62079b compositor: Remove weston_transformed_ functions
These no longer have any callers, so they can go.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman
c12ec7a2e5 compositor: Remove weston_transformed_region
Replace all uses of weston_transform_region with
weston_matrix_transform_region, then remove the function completely.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman
df96fd435c backend-drm: Use weston_matrix_transform_region for plane setup
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman
8191aa2188 compositor: use matrix transforms for surface_to_buffer functions
Now that we have weston_matrix_transform_rect we can use that
instead of weston_transformed_coord + viewport_surface_to_buffer.

viewport_surface_to_buffer no longer has users, so remove it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Derek Foreman
77f094ed7e compositor: add weston_matrix_transform_rect() and use it
New function that transforms a pixman_box32_t rectangle by a matrix.

Since pixman rectangles are represented by 2 corners, non-90 degree
rotations can't be properly represented.  This function gives the
axis aligned rectangle that encloses the rotated rectangle.

We use this for weston_matrix_transform_region(), simplifying it and
allowing it to work for non 90 degree rotations.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:41:59 +00:00
Marius Vlad
402d9a81c9 doc/sphinx: Make doxygen warn as error depend on meson werror flag
As seen previous times, with newer doxygen version we seem to be
generating warnings and with it to stop generating documentation
entirely as we have enabled warning as error in the doxygen
configuration file.

By default meson werror build option is not enabled, so users can still
generate documentation when building regularly, and when we'll update to
the same doxygen version we should be able to catch those errors up if
any of them will pile up in between.

Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:37:06 +00:00
Marius Vlad
8c4cdd782e compositor/shared: Suppress write(2) warnings
Fixes the following warnings when building with _FORTIFY_SOURCE
and optimizations enabled:

../shared/xalloc.h:49:9: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
   49 |         write(STDERR_FILENO, oommsg, strlen(oommsg));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

or
../compositor/main.c:427:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  427 |                         write(STDERR_FILENO, fail_seteuid,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  428 |                               strlen(fail_seteuid));
      |                               ~~~~~~~~~~~~~~~~~~~~~
../compositor/main.c:434:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  434 |                         write(STDERR_FILENO, fail_cloexec,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  435 |                               strlen(fail_cloexec));
      |                               ~~~~~~~~~~~~~~~~~~~~~
../compositor/main.c:442:25: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
  442 |                         write(STDERR_FILENO, fail_exec, strlen(fail_exec));
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:32:19 +00:00
Marius Vlad
9455ad7c7c backend-rdp/rdpclip: Avoid printing negative index
As clipboard_find_supported_format_by_mime_type() can return -1 if it
can't find out an index avoid trying to print outside of the array.

Fixes the following warnings triggered when enabling FORTIFY_SOURCE
combined with optimizations (-O)

../libweston/backend-rdp/rdpclip.c:1114:17: error: array subscript -1 is below array bounds of ‘uint32_t[5]’ {aka ‘unsigned int[5]’} [-Werror=array-bounds]
 1114 |                 weston_log("RDP %s (%p:%s) specified format \"%s\" index:%d formatId:%d is not supported by client\n",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1115 |                            __func__, source, clipboard_data_source_state_to_string(source),
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1116 |                            mime_type, index, source->client_format_id_table[index]);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../libweston/backend-rdp/rdpclip.c:131:18: note: while referencing ‘client_format_id_table’
  131 |         uint32_t client_format_id_table[RDP_NUM_CLIPBOARD_FORMATS];

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:32:19 +00:00
Derek Foreman
1cb46994e3 xwm: Check size hints in weston_wm_window_is_positioned()
Currently we can't tell the difference between a window intentionally
created at 0,0 and a window that we can place anywhere.

Check the size hints to see if the flags indicating the placement
is intentional are present.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-23 11:25:10 +00:00
Daniel Stone
022e79bf3e build: Use cc.get_supported_arguments() instead of open-coding
I added support to Meson for cc.get_supported_arguments() when I was
typing out the initial build because I didn't like the open-coding, then
completely forgot to update Weston when it got merged.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-09-23 11:19:06 +00:00
vanfanel
3240ccc69d Don't change the max_bpc connector prop if mode=current.
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>
2022-09-23 11:05:34 +00:00
Marius Vlad
995d080cb9 compositor/main: Extract split/retrieve args passed shell client
The supplied path for executing the shell client could contain potential
arguments and not only the binary itself. Specifying the platform either
by using an argument (-platform wayland) or using an environmental
variable (QT_QPA_PLATFORM) with clients written in Qt is for instance
an example on why this might be useful to have in.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-23 11:01:57 +00:00
Marius Vlad
1b4def3c48 libweston/desktop: Migrate libweston-desktop/libweston-desktop.h
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>
2022-09-23 13:57:26 +03:00
Simon Ser
7d6dd013fb build: re-open main for regular development 2022-09-22 18:25:20 +02:00
Simon Ser
d23a69272f build: bump to version 11.0.0 for the official release 2022-09-22 18:16:14 +02:00
Simon Ser
3dc6a682e4 build: bump to version 10.0.94 for the RC2 release
Signed-off-by: Simon Ser <contact@emersion.fr>
2022-09-15 19:09:49 +02:00
Alexandros Frantzis
0669d4de4f libweston: Skip views without a layer assignment in output_mask calculations
Surface views that are not assigned to a layer are not going to be
rendered, and thus should not participate in determining the outputs the
surface is on.

There are other view properties that may determine if the view should be
considered in output_mask calculations, e.g., is_mapped, but checking
for this currently breaks tests. Such additional checks are left for
future fixes or reworkings of the view infrastructure.

Fixes #646

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2022-09-14 17:08:09 +03:00
Marius Vlad
b87418e4c4 clients/eventdemo: Remove duplicated param entries
Removes doxygen warning.

Fixes #664

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-14 16:46:24 +03:00
Pekka Paalanen
259bd17822 doc: remove directives deprecated in Doxygen 1.9.5
All these Doxygen configuration directives raise a deprecation warning
with Doxygen 1.9.5.

Since we have WARN_AS_ERROR = YES, this causes the build to fail.

Remove these deprecated directives.

I have checked the differences by first building from scratch without
this patch, and then building from scratch with this patch, and
in the latter builddir checking

$ diff -ru -x '*.md5' -x '*.pdf' ~/tmp/weston-doc-before doc

The only differences are the Doxygen config file and one .pickle file.
So it seems the generated docs are identical with Doxygen 1.9.1.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/661

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-09-13 18:38:27 +03:00
Derek Foreman
11ba13d717 clients: Fix cursors when compositor gives wl_seat before wl_compositor
We have no guarantee that we can create a surface for the pointer at the
instant we receive a seat that will (probably eventually) need one.

Hold off until we receive an enter event before creating this - at that
point we know with certainty that wl_compositor is available, since we've
used it to create the surface that was entered.

Fixes #659

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-09-12 11:53:41 -05:00
Simon Ser
a6b8f0f89c build: bump to version 10.0.93 for the RC1 release 2022-09-06 19:29:17 +02:00
Marius Vlad
1aa935e6d8 libweston/input: Assert if we're still having a notify listener installed
Tracking correctly previous events shouldn't corrupt the surface destroy
signal list. This enforces that by ensuring that we wouldn't have
a .notify wl_listener still being set (which shouldn't happen if we do
eventually get a focus_in event that clears it out).

Suggested-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-02 15:45:13 +03:00
Marius Vlad
d6ab6da988 libweston/backend-x11: Tracking previous events over multiple calls
Rather than doing it with a local variable, track any previous events by
hanging it out of the x11 backend and use it to handle keymap notify
events.

In this way we avoid corrupting the surface destroy signal list, in
notify_keyboard_focus_out(), ultimately leading to a crash.

Fixes #649, #650

Suggested-by: Daniel Stone <daniel.stone@collabora.com>
Reported-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2022-09-02 15:45:11 +03:00
Michael Olbrich
4cde507be6 backend-drm: fix plane sorting
The planes in the plane_list must be sorted from largest zpos_max to smallest.

Currently the plane order is only correct when the planes are already ordered
and added starting with the smallest zpos_max. This works accidentally in most
cases because the primary plane is usually first and there is often only one
overlay plane or the zpos is sufficiantly configurable.

To fix this, insert a new plane before the first plane with a smaller zpos_max.
And if none is found, insert it at the end of the list.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2022-08-31 08:28:55 +02:00
Simon Ser
4990e28ff2 build: bump to version 10.0.92 for the beta release 2022-08-23 19:16:02 +02:00