The surface buffer must be committed before a ivi-controller adds ivi
surface to a ivi layer. This constraint is necessary information for the
ivi-controller.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Use assert() to check for invalid NULL arguments. Something like that happens
during development and assert() makes it easier to find the error. And it avoids
unnecessary additional error handling.
The hmi-controller asserted anyways so this just moves the assert on level
deeper. Other controller probably do the same thing, or don't check the return
values at all.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
The return values for most of the API functions will be removed and replaced by
asserts. So remove the return value checks. The end result will be the same:
These functions only fail for incorrect API usage, so basically the asserts are
moved from the hmi-controller into the shell.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
The surface of the focus_view may be a subsurface. So get the corresponding main
surface first.
Without this get_ivi_shell_surface(), will cast committed_private (which is a
weston_subsurface object) to ivi_shell_surface. Weston crashes shortly
afterwards.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Input panels are used for complex text composition for CJK alphabets and for
onscreen keyboards. Support for this is already implemented in libweston and
the desktop shell.
This adds extends the IVI shell to add support for input panels as well. The
low-level parts are implemented in the IVI shell. The positioning of the input
panels is delegated to the controller.
Support for input panels and the relevant protocols is only enabled if the
controller attaches a listener to the new signals.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This makes it possible for the controller to distinguish different surface
types. For IVI and desktop surfaces, this is not all that useful, but it will be
needed for a new surface type: input panels.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
shell_surface_send_configure() should only be called for ivi surfaces. Other (or
no) *configure() calls are needed for other types of surfaces.
Make sure that get_ivi_shell_surface() returns NULL if the surface is not an ivi
surface. And don't ignore wrong surfaces but assert instead to make it obvious
that new surface types need special handling in ivi_layout_surface_set_size().
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
I also snuck in a trivial change to drag_surface_configure at the same
time to avoid yet another micro patch.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Convert the bare x,y coordinates into struct weston_coord and update all
users.
We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.
Signed-off-by: Derek Foreman <derek.foreman@collabora.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>
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>
Various shells provide the functionality to take screenshots using the
weston-screenshooter or a key combination. This is useful on the ivi-shell, too.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Listening the shell destroy instead of compositor destroy signal.
This show how to in case the controller depends on shell resource.
The order destroying had changed in this commit, the controller
is destroyed first now
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
The surface listeners must remove when hmi-controller destroying.
To avoid to use after free.
Suggested-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
In the case the controlelrs are depended on ivi-shell resource,
it must be destroy before the ivi shell destroy. To do this,
add new ivi shell destroy signal on ivi shell, emit it on
the begining of the shell destroying
Suggested-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
Suggested-by: Michael Olbrich <m.olbrich@pengutronix.de>
Suggested-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
To avoid the following UAF:
Invalid read of size 8
at 0x4AE5EFF: weston_desktop_get_display (libweston-desktop.c:110)
by 0x4AEB2C9: weston_desktop_xdg_surface_schedule_configure (xdg-shell.c:1160)
by 0x4AEA77A: weston_desktop_xdg_toplevel_set_size (xdg-shell.c:711)
by 0x4AE839D: weston_desktop_surface_set_size (surface.c:504)
by 0x63F7D43: ivi_layout_surface_set_size (ivi-layout.c:1599)
by 0x63F949F: transition_move_resize_view_destroy (ivi-layout-transition.c:311)
by 0x63F9397: layout_transition_destroy (ivi-layout-transition.c:259)
by 0x63F8E0B: ivi_layout_remove_all_surface_transitions (ivi-layout-transition.c:121)
by 0x63F4BC1: ivi_layout_surface_destroy (ivi-layout.c:258)
by 0x63F38AF: layout_surface_cleanup (ivi-shell.c:162)
by 0x63F3D2D: shell_destroy (ivi-shell.c:359)
by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
Address 0x174202d0 is 0 bytes inside a block of size 152 free'd
at 0x484617B: free (vg_replace_malloc.c:872)
by 0x4AE5EDC: weston_desktop_destroy (libweston-desktop.c:97)
by 0x63F3CF2: shell_destroy (ivi-shell.c:355)
by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
by 0x4864A4B: wet_main (main.c:3908)
by 0x10915D: main (executable.c:33)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Shutting down the compositor gives us:
Invalid write of size 8
at 0x4B1AEDB: wl_list_remove (wayland-util.c:56)
by 0x4AF05BF: weston_signal_emit_mutable (signal.c:66)
by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
by 0x4864A4B: wet_main (main.c:3908)
by 0x10915D: main (executable.c:33)
Address 0x17435f20 is 224 bytes inside a block of size 384 free'd
at 0x484617B: free (vg_replace_malloc.c:872)
by 0x17718C7E: hmi_controller_destroy (hmi-controller.c:761)
by 0x4AF059A: weston_signal_emit_mutable (signal.c:62)
by 0x4ACBC2C: weston_compositor_destroy (compositor.c:8629)
by 0x4864A4B: wet_main (main.c:3908)
by 0x10915D: main (executable.c:33)
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
listen the signal and destroy the screen
corresponding to the destroyed weston_output.
clear also pending and order layer lists and
unmap all active views on the screen.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
The controller should decide what to do with the views. It can
destroy the views or move the view to other screen. So, don't unmap
the views on the destroy screen event in ivi-layout. Removing typecast
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
listen the signal and create new ivi screens.
this is required to handle hotplug events.
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
don't need to check the output in event, remove the typecast
Signed-off-by: Tran Ba Khang(MS/EMC31-XC) <Khang.TranBa@vn.bosch.com>
The controller sets the source and destination rectangles for any surface,
based on these parameters configure event is sent from the client application.
The controller commit the properties in the initial time, so
the view mask is capped to the current buffer dimensions of the
client. In runtime the client maybe sends some the bigger
configures of buffers. In this case view mask will be of smaller
dimension compared to the client buffer and it results in un-desired
clipping of client buffer.
To resolve this, use source rectangle as view mask. weston will take
care to clip the boundingbox of view to client buffer dimension if the
view mask is smaller.
Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
The ivi-shell keeps track of its surfaces by adding them to the ivi_surface_list
to be able to remove them on shutdown. It also creates an ivi_layout_surface for
a desktop surface, but does not keep track of these surfaces.
During compositor shutdown, libweston prints the following message:
BUG: finalizing a layer with views still on it.
Fix it by adding the created ivi_layout_surface to the ivi_surface_list to
remove the surfaces from the layer during shutdown.
Furthermore, remove the ivi_layout_surface from the desktop surface and free it
when the desktop surface is destroyed.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
It's ok if the rectangle is too large: If the calculation fails, the
bounding rectangle is used anyways. However, a rectangle that is too small
will create incorrect results. So make sure to round all edges outwards.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
If a controller requests the layers under a surface that has no views attached,
Weston crashes since it tries to free the array that would be used to return the
found layers, but has not been allocated before.
Free the ppArray only if it was allocated in ivi_layout_get_layers_under_surface
before and no layers were found.
While at it, make it obvious that checking the length is an integer comparison
by comparing it to 0.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
There is no need to call layer_add_surface() in mode_random_replace()
because the surface has already been added to the layer. Rather, calling
layer_add_surface() has the issue that the child surface is displayed
below the parent surface.
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Activate keyboard focus for surfaces created with xdg-shell protocol. If
the surface has child surface, the child surface is activated instead of
the parent surface.
Fixes: #630
Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
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>
The README for the IVI-shell is completely outdated.
Update the documentation, add some more information on the IVI-shell use cases
and explain how to use and customize the IVI-shell. Also convert the file to rst
and move it to doc directory next to the kiosk-shell documentation.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The at.projects.genivi.org domain redirects to wiki.covesa.global and the
referenced wiki entry does not exist anymore. Remove it from the comment.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
The ivi_layout_screen is internal to the IVI shell and not used by any
controllers. Controllers use weston_output directly.
Remove it from the exported header to avoid confusion.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Drop the even more home-grown alloc wrapper and use the xalloc.h
wrappers directly.
xcalloc() is added and used, because calloc() will detect integer
overflows in the size multiplication, while doing a simple
multiplication in the caller is subject to overflows which may result in
allocating not what was expected, subjecting to out-of-bounds access.
All MEM_ALLOC() calls that had a meaningful multiplication in them were
converted to xcalloc(), the rest to xzalloc().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It's not really useful to have libweston without libweston-desktop. It's
also very little code.
Merging both into the same DSO will allow us to cut out a bunch of
indirection and pain.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Without this, the earliest signal the ivi controller receives for a new surface
is configure_desktop_changed signal. And this is not emitted until the surface
has the first buffer attached.
By emitting the signal during surface creation, the controller is able to set
the initial width and height for the first configure.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Fixes ASan reported leaks:
Direct leak of 88 byte(s) in 1 object(s) allocated from:
#0 0x7fcdc7382518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
#1 0x7fcdc2d902f3 in zalloc ../../git/weston/include/libweston/zalloc.h:38
#2 0x7fcdc2d91cc2 in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:410
#3 0x7fcdc2d89aef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
#4 0x7fcdc2db7300 in wet_shell_init ../../git/weston/ivi-shell/ivi-shell.c:642
#5 0x7fcdc7261de5 in wet_load_shell ../../git/weston/compositor/main.c:956
#6 0x7fcdc7272baa in wet_main ../../git/weston/compositor/main.c:3410
#7 0x55e12a669e29 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
#8 0x55e12a66d85d in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
#9 0x55e12a65dc48 in fixture_setup ../../git/weston/tests/ivi-layout-test-client.c:48
#10 0x55e12a65dcca in fixture_setup_run_ ../../git/weston/tests/ivi-layout-test-client.c:50
#11 0x55e12a66de12 in main ../../git/weston/tests/weston-test-runner.c:661
#12 0x7fcdc6ed709a in __libc_start_main ../csu/libc-start.c:308
#13 0x55e12a65d769 in _start (/home/pq/build/weston-meson/tests/test-ivi-layout-client+0xd769)
Indirect leak of 152 byte(s) in 1 object(s) allocated from:
#0 0x7fcdc7382518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
#1 0x7fcdc2d89811 in zalloc ../../git/weston/include/libweston/zalloc.h:38
#2 0x7fcdc2d8992d in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:65
#3 0x7fcdc2db7300 in wet_shell_init ../../git/weston/ivi-shell/ivi-shell.c:642
#4 0x7fcdc7261de5 in wet_load_shell ../../git/weston/compositor/main.c:956
#5 0x7fcdc7272baa in wet_main ../../git/weston/compositor/main.c:3410
#6 0x55e12a669e29 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
#7 0x55e12a66d85d in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
#8 0x55e12a65dc48 in fixture_setup ../../git/weston/tests/ivi-layout-test-client.c:48
#9 0x55e12a65dcca in fixture_setup_run_ ../../git/weston/tests/ivi-layout-test-client.c:50
#10 0x55e12a66de12 in main ../../git/weston/tests/weston-test-runner.c:661
#11 0x7fcdc6ed709a in __libc_start_main ../csu/libc-start.c:308
#12 0x55e12a65d769 in _start (/home/pq/build/weston-meson/tests/test-ivi-layout-client+0xd769)
Indirect leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7fcdc7382518 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9518)
#1 0x7fcdc2d8a5ae in zalloc ../../git/weston/include/libweston/zalloc.h:38
#2 0x7fcdc2d8a89e in weston_desktop_client_create ../../git/weston/libweston-desktop/client.c:108
#3 0x7fcdc2d91d2a in weston_desktop_xwayland_init ../../git/weston/libweston-desktop/xwayland.c:415
#4 0x7fcdc2d89aef in weston_desktop_create ../../git/weston/libweston-desktop/libweston-desktop.c:87
#5 0x7fcdc2db7300 in wet_shell_init ../../git/weston/ivi-shell/ivi-shell.c:642
#6 0x7fcdc7261de5 in wet_load_shell ../../git/weston/compositor/main.c:956
#7 0x7fcdc7272baa in wet_main ../../git/weston/compositor/main.c:3410
#8 0x55e12a669e29 in execute_compositor ../../git/weston/tests/weston-test-fixture-compositor.c:432
#9 0x55e12a66d85d in weston_test_harness_execute_as_client ../../git/weston/tests/weston-test-runner.c:528
#10 0x55e12a65dc48 in fixture_setup ../../git/weston/tests/ivi-layout-test-client.c:48
#11 0x55e12a65dcca in fixture_setup_run_ ../../git/weston/tests/ivi-layout-test-client.c:50
#12 0x55e12a66de12 in main ../../git/weston/tests/weston-test-runner.c:661
#13 0x7fcdc6ed709a in __libc_start_main ../csu/libc-start.c:308
#14 0x55e12a65d769 in _start (/home/pq/build/weston-meson/tests/test-ivi-layout-client+0xd769)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
In commit d8e09afc9f ("tests: Convert ivi-shell-app-test.c to use
`weston_ini_setup`") the reference weston.ini for the ivi-shell was
removed, because it is not required by the test anymore.
The reference weston.ini still has value as an example for the ivi-shell
and how the ivi-shell-user-interface has to be configured. Retrieving
this information from the test case is not intuitive. Furthermore, the
file is still referenced by the ivi-shell/README, and the
configuration_data for generating the file was not fully removed.
Bring back the reference weston.ini for the ivi-shell and, while at it, cleanup
the configuration_data() to define only keys that are actually used in
weston.ivi.in.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
This ensures the layers are torn down properly.
See commit: libweston: add weston_layer_fini()
There would be a lot more to tear down here, but that is for another
time.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Convert ivi-shell-app-test.c to use `weston_ini_setup`. It also removes
the pre-made weston.ini and all the related code in the meson files.
Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
The opaque region of a weston view is updated only if the alpha value is 1
and the transform matrix is of type WESTON_MATRIX_TRANSFORM_TRANSLATE.
While using ivi-shell, opaque region is never updated, as we are performing
scaling operations to the view transform matrix, even when the scaling
factor is 1 and thereby changing the type to WESTON_MATRIX_TRANSFORM_SCALE.
Perform scaling of the view transformation matrix only when the scaling
factor is non-zero.
Signed-off-by: Rajendraprasad K J <KarammelJayakumar.Rajendraprasad@in.bosch.com>
The cms-static, desktop-shell, hmi-controller, ivi-shell, and screen-share
modules use symbols from libexec_weston, e.g.:
$ ldd /usr/lib/x86_64-linux-gnu/weston/desktop-shell.so | grep "not found"
libexec_weston.so.0 => not found
Loading these modules from weston happens to work because the weston executable
itself links against libexec_weston, and has an rpath set. Still, these modules
depend on a library in a non-standard location. Adding an rpath could help
static checkers to make sure all shared objects' dependencies are present.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Wayland innovated a lot of cool things, but non-binary boolean values is
the great advances of our time.
Make config_parser_get_bool() work on boolean values, and switch all its
users.
Signed-off-by: Daniel Stone <daniels@collabora.com>
This introduces a new convention of checking through the compositor destroy
listener if the plugin is already initialized. If the plugin is already
initialized, then the plugin entry function succeeds as a no-op. This makes it
safe to load the same plugin multiple times in a running compositor.
Currently module loading functions return failure if a plugin is already
loaded, but that will change in the future. Therefore we need this other method
of ensuring we do not double-initialize a plugin which would lead to list
corruptions the very least.
All plugins are converted to use the new helper, except:
- those that do not have a destroy listener already, and
- hmi-controller which does the same open-coded as the common code pattern
did not fit there.
Plugins should always have a compositor destroy listener registered since they
very least allocate a struct to hold their data. Hence omissions are
highlighted in code.
Backends do not need this because weston_compositor_load_backend() already
protects against double-init. GL-renderer does not export a standard module
init function so cannot be initialized the usual way and therefore is not
vulnerable to double-init.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>