When a view is destroyed then the views of subsurfaces remain until the view
list is rebuilt for the next repaint.
During that time view->parent_view contains an invalid pointer and weston will
crash when it tries to access the view.
This happens for a surface with subsurfaces with views on two different outputs
with the ivi-shell:
When the surface is destroyed then the destroy handler of the ivi-shell
(shell_handle_surface_destroy()) may be called first. It will (indirectly)
destroy the view of the main surface with weston_view_destroy().
Next the surface destroy handler of the subsurfaces
(subsurface_handle_parent_destroy() is called. It will unmap the first view of
the subsurface. Here weston_surface_assign_output() is called which tries to
find the output of the second view and accesses the now invalid
view->parent_view in the process.
There are probably other ways to trigger similar crashes.
To avoid this, clear view->parent_view when the parent view is destroyed.
Fixes 0669d4de4f ("libweston: Skip views without a layer assignment in
output_mask calculations")
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
The pixel format stored in backends->format[0] is effectively looked up
via pixel_format_get_info(DRM_FORMAT_ARGB8888). Reuse that instead of
looking up the same via pixel_format_get_info_by_pixman(PIXMAN_a8r8g8b8)
in multiple places.
There are still two instances of hard-coded CAIRO_FORMAT_ARGB32 in
wayland_output_get_shm_buffer() that currently can not be obtained from
pixel_format_info.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
When a dependency path is converted to string and dependency is a
subproject, then accessing such file fails in meson with:
ERROR: Sandbox violation: Tried to grab file ... from a nested subproject.
Use '/' operator as documented in
https://mesonbuild.com/Dependencies.html#dependencies-that-provide-resource-filesFixes: #715
Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
This reverts commit 4eea291512.
There were some details and cases that I've missed when writing this
commit, resulting in some weird behaviors. Trying to cover all of them
became a nightmare, and the function got really hard to read.
So it's better to revert this commit and think about other possible
solutions for the issue.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
If the wl_surface resource has version 5 or newer, we should always
ignore the offset parameters in wl_surface.attach.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
ivi-shell has allowed to notify a surface configuring when detecting
an unmapping commit. To avoid the commit_change with source_width
and source_height are zero, we should don't do a configuring when
surface has no content.
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
If a client commits a null buffer, weston will unmap all the views of
the surface and marks it is unmapping. In the case, the client commits
a new valid buffer, then the controller wants to rebuild the views
without applies the pending properties of surfaces and layers.
The ivi_layout_interface should prodive an interface for this.
Suggested-by: Michael Olbrich's avatarMichael Olbrich <m.olbrich@pengutronix.de>
Suggested-by: K J Rajendraprasad's avatarRajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
Push weston_coord into the notification functions instead of passing
two doubles.
The touch handlers are passed a pointer to a weston_coord, which is
unusual. This is done so we can pass a NULL pointer instead of a
fabricated invalid coordinate when the touch type is TOUCH_UP.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Wayland protocol can't do this, but the way our test protocol handles
touch through a single event can - ensure that we don't by accident.
This will matter more shortly when we add assert()s to prevent having
coordinates with WL_TOUCH_UP events internally later.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This creates a global coordinate from a device coordinate.
Replace it with weston_coord_global_from_output_point() which
does the same thing and returns a weston_coord_global.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Remove the independent x, y floats from the clipping code and replace them
with struct weston_cord. This includes the polygon8 structure as well.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>