Commit Graph

8618 Commits

Author SHA1 Message Date
Michael Olbrich
f7609553a9 ivi-shell: remove some unnecessary checks
Both functions are callbacks that are added when the ivi_shell_surface is
created and removed when it is destroyed, so get_ivi_shell_surface() will never
return NULL here.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Michael Olbrich
2c96bdbdbf ivi-shell: simplify surface creation
The weston_surface passed to surface_create() should never be NULL. And other
code already relies on that anyway, so just remove the check.

Now surface_create() will never fail, so more checks can be removed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Michael Olbrich
c4fab1633b ivi-shell: use x*alloc for small allocations
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-07 15:43:18 +01:00
Derek Foreman
c7b9625775 input: Don't assert when sending touch motion
If a window is clicked with a mouse while it's being interacted with via
touch input, the assert from 2dc8680d will fire.

This is a leftover from d611ab24

Update the transform before converting the coordinate to fix this.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-07 16:28:25 +02:00
Marius Vlad
27ce9dadd8 backend-drm: Do not overwrite plane's index when creating virtual plane
Starting with commit 4cde507be6 "backend-drm: fix plane sorting" the
plane list will have a descending order of the planes rather than ascending.

This reversed order had the side-effect of exposing the fact that we
don't set-up a plane index when creating the drm_plane using the DRM
virtual API. Without settting a plane index for that drm_plane we
effectively overwrite the plane index which has the 0 (zero) entry.

This wasn't an issue before commit 4cde507be6 "backend-drm: fix
plane sorting" as it seems we never picked up that plane index as
being a suitable one due to the fact that those were assigned to primary
planes, but after that commit, the cursor plane will be one getting
the 0 (zero) plane index.

Finally, this would trip over because we attempt to place a (cursor)
view on a primary plane (where it would've normally be a cursor
plane) and we end up with no framebuffer ref.

This is fixed trivially by assigning a plane index, different than the
ones already created by create_spirtes().

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-02-07 16:24:07 +02:00
Leandro Ribeiro
ba82af938a desktop-shell: do not forget to reset pending config size after resizes
During interactive resizes, we progressively change the size of the
client surface and send config events with these sizes to the client.
After that, the toplevel->pending.size keeps the size of the last config
event that we've sent, i.e. the surface size after the resize is over.

Later, if the client spontaneously resize (by attaching a buffer with a
different size or setting the viewport destination, for instance), their
surface size will change, but toplevel->pending.size continues being
that old size from after the resize. If something happens and Weston
decides to send a config event, clients may re-allocate to that old
size, resulting in a sudden resize.

This does not happen when a client goes from fullscreen/maximized to
windowed mode because in such cases we are resetting
toplevel->pending.size to zero. So in the next config event that clients
receive they are allowed to attach buffers with the size that they
prefer.

So do the same after a resize: set the pending config size to zero.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-02-07 09:59:16 +00:00
Philipp Zabel
7c1492216e backend-x11: split x11_output_get_pixel_format out of x11_output_init_shm
Split x11_output_get_pixel_format() out of x11_output_init_shm() so the
pixel format can already be known when calling pixman->output_create().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-07 09:32:31 +00:00
Derek Foreman
8571b844af libweston: Fix broken paint node list walk
Outputs store nodes on the output_link.

Fixes !1118

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-06 08:23:52 -06:00
Derek Foreman
9d24fb96fb xwm: Be careful with window size when minimizing
If we're minimized from maximized or fullscreen state, we want to leave
the saved size alone, so we can restore it if we clear fullscreen or
maximized state later.

Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
2023-02-03 11:02:51 +02:00
Philipp Zabel
3560da1255 frontend: make x11 backend honor the renderer option
If the --renderer option was given, do not let the x11 backend choose
the renderer on its own.

Fixes: 75b3ecfcc3 ("frontend: Add common --renderer=foo argument")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel
a222ce03c7 backend-x11: create renderbuffer when pixman output state already exists
Reorder pixman renderer output state and SHM renderbuffer creation and
removal to make sure the pixman renderbuffer list is empty when the
output state is destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel
918ec64f6a backend-x11: fix pixman output state creation
Pixman output state creation requires a valid pixel format to be set for
weston_output_update_capture_info().

Fixes: c67773bc5c ("pixman-renderer: use pixel_format_info instead of pixman_format_code_t")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel
2914f28fd1 backend-wayland: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and SHM renderbuffer removal to
make sure the pixman renderbuffer list is empty when the output state
is destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Philipp Zabel
2a6c1afced backend-wayland: fix pixman output state creation
Pixman output state creation requires a valid pixel format to be set for
weston_output_update_capture_info().

Fixes: c67773bc5c ("pixman-renderer: use pixel_format_info instead of pixman_format_code_t")
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-02-03 10:41:08 +02:00
Daniel Stone
e07be58dc4 gl-renderer: Use highest precision for vertex shaders
Whilst GLSL requires highp for the vertex shader stage, highp is
optional for the fragment shader.

Make sure that we work in highp by default during the vertex shader
stage, using either highp or mediump for the texcoord varying according
to what the fragment shader supports.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-02-02 21:46:06 +00:00
Derek Foreman
e471edb33d drm-backend: Enable plane rotations
Search for planes that support the rotation required to properly display
a paint node, and properly set coordinates and rotation properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman
b0f23dc09d backend-drm: Set rotation property on planes when possible
For now we just always set the plane up to have a "normal" rotation, so
no new features are added with this commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman
f89f440735 kms: Add plane rotation property
Add plane rotations to our recognized properties.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman
397ed8cec5 kms: Support bitmasks
From our perspective, a bitmask is pretty much the same as an enum, so
allow it to use the same path.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:56 -06:00
Derek Foreman
e3ec879d11 drm-backend: Cache paint node transform
Instead of calculating this multiple times, just store it in the paint
node.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 12:25:54 -06:00
Derek Foreman
da3d3c7e95 compositor: Add dirty bits to paint nodes
We're pushing more and more mutable state into paint nodes, but this state
has a non-zero cost to rebuild every render.

Let's take care to track when we need to rebuild the state.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-02 13:49:39 +00:00
Tran Ba Khang(MS/EMC31-XC)
776fafe13a libweston/desktop: committed when transiting from valid to invalid buffer
Every shells have an implementation of weston_desktop_api structures.
It includes some callbacks to listen to xdg_surface signals. Committed callback
is one of them.

Currently, the xdg_shell don't invoke the weston_desktop_api->committed
callback when the xdg_surface is initial stage or no surface content.

In the case: the client attached a null buffer after the valid buffer,
the shell isn't going to invoke to xdg_surface committed, and don't know
the surface is disappeared. If the surface is fullscreen, we will get
a black background on the screen until a new valid frame come. That
should not happen.

Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:05:19 +02:00
Tran Ba Khang(MS/EMC31-XC)
7ba87d7062 libweston: support API to detect an unmapping commit of surface
Add the weston_surface_is_unmapping() api, this will help the shell
to detect the commit of a surface is unmapping or not.

Suggested-by: Morgane Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
2023-02-02 11:03:10 +02:00
Philipp Zabel
51ef88a7f4 backend-vnc: destroy renderbuffer before renderer output state
Reorder pixman renderer output state and renderbuffer removal to make
sure the pixman renderbuffer list is empty when the output state is
destroyed.

Fixes: 4d96635a3f ("pixman-renderer: track damage in weston_renderbuffer")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-02-02 10:58:14 +02:00
Derek Foreman
8057f28b98 backend-drm: Support tearing
Allow tearing for clients that request it, provided we can put their
content on a plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman
9203d98f8b backend-drm: Check for the atomic tearing capability
Check if our drm device supports atomic async page flips.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman
974a707add libweston: Add support for tearing-control
Add core support for tearing control.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman
030edb5c48 clients/simple-egl: Add a vertical bar mode
Add an animation that moves a vertical bar from left to right. This is
nice for testing the tearing extension.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman
5191113638 clients/simple-egl: Refactor out drawing code
Pull the triangle draw code into its own function so we can more readily
add other animations later.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:55 -06:00
Derek Foreman
ab897491df clients: Add tearing control to simple-egl
Add a new command line option to test the tearing-control protocol.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 10:12:53 -06:00
Derek Foreman
58dde0e0c0 drm-backend: Remember to set the zpos for the scanout plane
We can clear this via drm_plane_state_put_back() at the end of
drm_output_propose_state(). We need to set it back to the minimum zpos
when rendering.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 15:56:24 +00:00
Derek Foreman
ac04199db1 libweston: Remove old coordinate conversion functions
We don't need these anymore, as all users have been moved to the
weston_coord equivalents.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
64d9270804 libweston: Use weston_coord space conversion functions
Update users of the old coordinate space conversion functions that take
x, y pairs to the new weston_coord versions.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
0b78ec96f7 libweston: use weston_coord for weston_matrix_transform_rect
Possibly the least useful place to use this, as the input comes directly
from pixman rects, and the output is more complicated than usual, but
I guess consistency counts for something.

There is some small benefit in switching to weston_matrix_transform_coord
to hide the perspective normalization step and the homogenous coords.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
e1b4ad7d0b matrix: Introduce weston_coord
All through weston we have code that passes int x, y or
float x, y or wl_fixed_t x, y pairs. These pairs are frequently
converted to/from wl_fixed_t and other types.

We also have struct vec2d and struct weston_geometry which also
contain coordinate pairs.

Let's create a family of coordinate vector structures for coordinate
pairs and use it anywhere we sensibly can.

This has a few benefits - it helps remove intermediate conversion
between fixed/float/int types. It lets us roll the homogenous
coordinate normalization bits into helper functions instead of
needing them open coded throughout the source.

Possibly most importantly, it also allows us to do some compile time
validation of what coordinate space we're working in.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Derek Foreman
fe4d5711bf libweston: Split weston_view_set_position() into rel and abs variants
One variant is used when a view is being positioned relative to a parent,
the other is when the view is being given an absolute position in the
global space.

This will help later when surface and global coordinates are different
data types, but for now the two functions do essentially the same thing.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-01 07:27:05 -06:00
Leandro Ribeiro
4eea291512 desktop-shell: avoid alternating surface between outputs
In commit d611ab24fd "libweston: Update
view transforms more often", a call to weston_view_update_transform()
was introduced to desktop_surface_committed(). It was added between the
point in which we call unset_fullscreen() and
shell_configure_fullscreen(), right after the view geometry dirty bit is
set.

There's a scenario with dual displays in which this change resulted in
the surface being alternated between two outputs:

---

Dual display configuration:

    1st display: DP1, with scale 1 - origin 0, 0
    2nd display: DP2, with scale 2 - origin 1920, 0

We start the app with the cursor on DP2. Function
desktop_surface_committed() gets called a few times, and it ends up
setting shsurf->saved_x and shsurf->saved_y to the origin of DP2.

Application wants to become fullscreen on DP1, so when the surface gets
committed again and desktop_surface_committed() gets called, we have the
following sequence:

desktop_surface_committed():

        was_fullscreen = shsurf->state.fullscreen
        is_fullscreen = weston_desktop_surface_get_fullscreen()

        if (!weston_surface_is_mapped(desktop_surf))
                map(shell, desktop_surf)
                return;

        /* POINT A, this is important for understanding the issue. */
        if (shsurf size didn't change and
            fullscreen state didn't change)
                return;

        if (was_fullscreen)
                /* This function calls weston_view_set_pos(saved_x,
                 * saved_y), and the saved position is the origin of
                 * DP2. Then it invalidates the saved position */
                unset_fullscreen(shsurf)

        if (is_fullscreen && !shsurf->saved_position_valid)
                /* Saves the position (as it just have been
                 * invalidated), which will be the origin of DP2
                 * again. */
                shsurf->saved_x = shsurf->view->geometry.x
                shsurf->saved_y = shsurf->view->geometry.y
                shsurf->saved_position_valid = true

        /* This function calls weston_view_assign_output(), which then
         * calls weston_surface_assign_output(). The effect of these two
         * functions is that the view gets assigned to an output, and to
         * choose the output it takes into consideration the position in
         * which it is and the area that it occupies on the output. As
         * the view has been moved to the origin of DP2, it gets
         * assigned to this output. Then Weston sends the enter/leave
         * surface events. */
        weston_view_update_transform()

        if (is_fullscreen)
                /* This function positions the view on DP1, because
                 * that's the output in which the wine app wants to
                 * become fullscreen. */
                shell_configure_fullscreen(shsurf)

        /* Now we call weston_view_update_transform() again to each view
         * of the surface, and so we end up sending enter/leave surface
         * events. But notice that now we are positioned on DP1. */
        wl_list_for_each(view, &surface->views, surface_link)
                weston_view_update_transform(view);

The next time the surface gets committed and desktop_surface_committed()
gets called, the same sequence will happen. So we'll continue in this
weird loop.

The reason why the surface size changes and we don't return in POINT A
in this scenario is because the application uses a viewport, and then
when its surface moves to the output with scale 2 it sets the surface
size to half its size. That happens for apps that want to keep a
reasonable DPI on scaled displays.

This only happens after the change that introduced the call to
weston_view_update_transform() in this function. Without this call we'd
not reposition the view on DP2 and send enter/leave events at that
point.

---

So in order to avoid that, be more careful before calling
unset_fullscreen() and then shell_configure_fullscreen(). Only do that
when:

  - the surface was not fullscreen, and now it becomes.
  - the surface was fullscreen, but now it becomes fullscreen on a
    different output.

In order to be consistent, do something similar to the maximized state.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-01-31 19:22:45 +00:00
Philipp Zabel
397e66a4dd backend-drm: allow more formats with pixman-renderer
Clean up the code a little by dropping the now unnecessary switch case
in drm_output_init_pixman(). As a side effect, this enables all formats
that have a pixman_format entry in the pixel format table:

  - rgb565
  - xrgb8888
  - argb8888
  - xbgr8888
  - abgr8888
  - rgbx8888
  - rgba8888
  - bgrx8888
  - bgra8888
  - xrgb2101010
  - argb2101010
  - xbgr2101010
  - abgr2101010

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 15:32:24 +00:00
Philipp Zabel
4c3febfb52 backend-drm: use pixel_format_info instead of gbm_format
Use const struct pixel_format_info *format instead of uint32_t
gbm_format for backend and output pixel format.

Since create_gbm_surface() is never called without output->format being
set, drop the unnecessary error message.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 15:32:24 +00:00
Philipp Zabel
f639c9cac4 build: fix meson deprecation warnings
Stop using features that Meson 0.63.0 throws deprecation warnings about:

  WARNING: Deprecated features used:
   * 0.56.0: {'dependency.get_pkgconfig_variable'}
   * 0.62.0: {'pkgconfig.generate variable for builtin directories'}

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 09:43:41 +02:00
Philipp Zabel
eb3ad4ec64 backend-vnc: add meson wrap files for aml and neatvnc
Use aml v0.3.0 and neatvnc v0.6.0 fallback subprojects.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 09:43:41 +02:00
Stefan Agner
64dea007c6 backend-vnc: add meson subprojects support
Make use of meson subprojects support. Allow to optionally build the
libraries required for the VNC backend as subproject of Weston.

Signed-off-by: Stefan Agner <stefan@agner.ch>
[philipp.zabel@gmail.com: update neatvnc and aml versions]
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-31 09:43:41 +02:00
Philipp Zabel
df6ffb8cbc build: bump Meson requirement to 0.63.0
Meson 0.63 supports per-subproject compiler options:

  https://mesonbuild.com/Release-notes-for-0-63-0.html#compiler-options-can-be-set-per-subproject

This is required for building aml and neatvnc as subprojects due to the
different c_std.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 09:43:41 +02:00
Philipp Zabel
4cad7146a4 ci: bump Meson version to 0.63.0
Prepare for bumping the Meson requirement in meson.build to 0.63.0,
adding support for per-subproject compiler options to allow building
aml and neatvnc as subprojects.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-31 09:43:41 +02:00
Philipp Zabel
ad38c41a50 gl-renderer: use pixel_format_info instead of drm fourccs
Use struct pixel_format_info pointers instead of uint32_t drm fourcc
values at the API surface for output and image creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-29 14:47:03 +01:00
Philipp Zabel
782fd7f370 pixel-formats: add pixel_format_get_array()
Add a helper function to turn an array of DRM fourccs into an array of
corresponding struct pixel_format_info pointers.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-29 14:47:03 +01:00
Philipp Zabel
efffd0d8a4 Revert "libweston: let weston_output_update_capture_info() take drm_format"
This reverts commit af5acbc9cb.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-28 12:59:16 +00:00
Philipp Zabel
c67773bc5c pixman-renderer: use pixel_format_info instead of pixman_format_code_t
Use struct pixel_format_info pointers instead of pixman_format_code_t
values at the API surface for output and image creation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-01-28 12:59:16 +00:00
Derek Foreman
889c2e3f0d xwayland: Fix delay in displaying pop-up menu
Xwayland pop-up menus aren't displayed until the mouse moves, or some other
action causes the compositor to repaint.

This is because the shell knows nothing about xwayland override redirect
windows, so it won't assign them an output. Without an output, the
surface commit won't cause a repaint.

Fix this with brute force by updating their geometry on commit. If the
geometry is dirty (and it will be for new surfaces), this will cause an
output to be assigned before the upcoming weston_surface_schedule_repaint()

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Found-by: Hideyuki Nagase <hideyukn@microsoft.com>
2023-01-28 12:56:23 +00:00
Philipp Zabel
14533cdd25 libweston: make weston_renderbuffer refcounted
Add weston_renderbuffer_ref/unref() functions and use them to
eventually destroy the weston_renderbuffer. Drop the explicit
renderbuffer_destroy vfunc from the pixman renderer interface.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-27 16:52:14 +01:00