2 * Copyright © 2020 Collabora, Ltd.
3 * Copyright (c) 2020 DENSO CORPORATION.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #include "ivi-compositor.h"
29 #include "rba_adapter.h"
34 ivi_policy_rba_surface_create(struct ivi_surface *surf, void *user_data)
40 ivi_policy_rba_surface_commmited(struct ivi_surface *surf, void *user_data)
46 ivi_policy_rba_surface_activate(struct ivi_surface *surf, void *user_data)
48 const char *app_id = NULL;
49 app_id = weston_desktop_surface_get_app_id(surf->dsurface);
51 weston_log("app_id is NULL, surface activation failed.\n");
54 return rba_adapter_arbitrate(app_id,surf->ivi);
58 ivi_policy_rba_surface_deactivate(struct ivi_surface *surf, void *user_data)
64 ivi_policy_rba_surface_activate_default(struct ivi_surface *surf, void *user_data)
70 ivi_policy_rba_surface_advertise_state_change(struct ivi_surface *surf, void *user_data)
76 ivi_policy_rba_shell_bind_interface(void *client, void *interface)
78 return rba_adapter_initialize();
81 static const struct ivi_policy_api policy_api = {
82 .struct_size = sizeof(policy_api),
83 .surface_create = ivi_policy_rba_surface_create,
84 .surface_commited = ivi_policy_rba_surface_commmited,
85 .surface_activate = ivi_policy_rba_surface_activate,
86 .surface_deactivate = ivi_policy_rba_surface_deactivate,
87 .surface_activate_by_default = ivi_policy_rba_surface_activate_default,
88 .surface_advertise_state_change = ivi_policy_rba_surface_advertise_state_change,
89 .shell_bind_interface = ivi_policy_rba_shell_bind_interface,
90 .policy_rule_allow_to_add = NULL,
91 .policy_rule_try_event = NULL,
95 ivi_policy_init(struct ivi_compositor *ivi)
97 ivi->policy = ivi_policy_create(ivi, &policy_api, ivi);
101 weston_log("Installing 'rba(Rule Base Arbitration)' policy engine\n");