summaryrefslogtreecommitdiffstats
path: root/recipes-graphics/wayland
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-06-15 09:35:10 +0900
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-06-26 20:19:08 +0000
commitbd1d83c7a2787a09a27b6a94dbf83381338981e6 (patch)
tree48ce84def5a113fcddadac2db7139334b70c241f /recipes-graphics/wayland
parent907a28b06a0cf3dcbacaa2e9c0f3b5b0e2729ae4 (diff)
Add simple-id-agent for wayland-ivi-extension 2.0.2
Add a subdirectory id-agent-modules for simple-id-agent. And load this library in ivi-controller. These codes are copy from this commit create by Emre Ucan. This commit is from meta-agl and can not cherrypick to meta-agl-demo. So copy it and create a new patch, change a litte line number to 0002. https://gerrit.automotivelinux.org/gerrit/#/c/11991/ 0001-simple-id-agent-initial-commit.patch 0002-ivi-controller-load-id-agent-module.patch Change-Id: I5e5278c9b6b536681ba0665e8549f98d75d69245 Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com> Signed-off-by: Emre Ucan <eucan at de.adit-jv.com> Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> Signed-off-by: Tadao Tanikawa <taniakwa.tadao@jp.panasonic.com>
Diffstat (limited to 'recipes-graphics/wayland')
-rw-r--r--recipes-graphics/wayland/wayland-ivi-extension/0001-simple-id-agent-for-2.0.2.patch294
-rw-r--r--recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb1
2 files changed, 295 insertions, 0 deletions
diff --git a/recipes-graphics/wayland/wayland-ivi-extension/0001-simple-id-agent-for-2.0.2.patch b/recipes-graphics/wayland/wayland-ivi-extension/0001-simple-id-agent-for-2.0.2.patch
new file mode 100644
index 000000000..24bf8394f
--- /dev/null
+++ b/recipes-graphics/wayland/wayland-ivi-extension/0001-simple-id-agent-for-2.0.2.patch
@@ -0,0 +1,294 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c82136e..eeed7a6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,6 +35,7 @@ add_subdirectory(ivi-layermanagement-api/ilmClient)
+ add_subdirectory(ivi-layermanagement-api/ilmControl)
+ add_subdirectory(ivi-layermanagement-api/test)
+ add_subdirectory(ivi-layermanagement-examples)
++add_subdirectory(id-agent-modules/simple-id-agent)
+
+ if(WITH_ILM_INPUT)
+ add_subdirectory(ivi-input-api/ilmInput)
+diff --git a/id-agent-modules/simple-id-agent/CMakeLists.txt b/id-agent-modules/simple-id-agent/CMakeLists.txt
+new file mode 100644
+index 0000000..8290722
+--- /dev/null
++++ b/id-agent-modules/simple-id-agent/CMakeLists.txt
+@@ -0,0 +1,72 @@
++############################################################################
++#
++# Copyright (C) 2013 DENSO CORPORATION
++# Copyright 2014 BMW Car IT GmbH
++#
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++#
++############################################################################
++
++cmake_minimum_required (VERSION 2.6)
++
++project(simple-id-agent)
++
++find_package(PkgConfig REQUIRED)
++pkg_check_modules(WAYLAND_SERVER wayland-server>=1.13.0 REQUIRED)
++pkg_check_modules(WESTON weston>=2.0.0 REQUIRED)
++pkg_check_modules(PIXMAN pixman-1 REQUIRED)
++
++find_package(Threads REQUIRED)
++
++GET_TARGET_PROPERTY(IVI_EXTENSION_INCLUDE_DIRS ivi-extension-protocol INCLUDE_DIRECTORIES)
++
++include_directories(
++ src
++ ${IVI_EXTENSION_INCLUDE_DIRS}
++ ${WAYLAND_SERVER_INCLUDE_DIRS}
++ ${WESTON_INCLUDE_DIRS}
++ ${PIXMAN_INCLUDE_DIRS}
++)
++
++link_directories(
++ ${WAYLAND_SERVER_LIBRARY_DIRS}
++ ${PIXMAN_LIBRARY_DIRS}
++)
++
++add_library(${PROJECT_NAME} MODULE
++ src/simple-id-agent.c
++)
++
++set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
++
++add_dependencies(${PROJECT_NAME}
++ ivi-extension-protocol
++ ${WAYLAND_SERVER_LIBRARIES}
++ ${PIXMAN_LIBRARIES}
++)
++
++set(LIBS
++ ${LIBS}
++ ivi-extension-protocol
++ ${WAYLAND_SERVER_LIBRARIES}
++)
++
++set(CMAKE_C_LDFLAGS "-module -avoid-version")
++
++target_link_libraries(${PROJECT_NAME} ${LIBS})
++
++install (
++ TARGETS ${PROJECT_NAME}
++ LIBRARY DESTINATION lib${LIB_SUFFIX}/weston
++)
+diff --git a/id-agent-modules/simple-id-agent/src/simple-id-agent.c b/id-agent-modules/simple-id-agent/src/simple-id-agent.c
+new file mode 100644
+index 0000000..3c9e989
+--- /dev/null
++++ b/id-agent-modules/simple-id-agent/src/simple-id-agent.c
+@@ -0,0 +1,124 @@
++/*
++ * Copyright (C) 2017 Advanced Driver Information Technology Joint Venture GmbH
++ *
++ * Permission to use, copy, modify, distribute, and sell this software and
++ * its documentation for any purpose is hereby granted without fee, provided
++ * that the above copyright notice appear in all copies and that both that
++ * copyright notice and this permission notice appear in supporting
++ * documentation, and that the name of the copyright holders not be used in
++ * advertising or publicity pertaining to distribution of the software
++ * without specific, written prior permission. The copyright holders make
++ * no representations about the suitability of this software for any
++ * purpose. It is provided "as is" without express or implied warranty.
++ *
++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
++ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
++ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <stdlib.h>
++#include <stdio.h>
++#include <string.h>
++#include <limits.h>
++
++#include <weston.h>
++#include <weston/ivi-layout-export.h>
++
++struct ivi_id_agent
++{
++ uint32_t default_id_offset;
++ uint32_t last_assigned_id;
++ struct weston_compositor *compositor;
++ const struct ivi_layout_interface *interface;
++ struct wl_listener desktop_surface_configured;
++};
++
++static void
++desktop_surface_event_configure(struct wl_listener *listener,
++ void *data)
++{
++ struct ivi_id_agent *ida = wl_container_of(listener, ida,
++ desktop_surface_configured);
++ struct ivi_layout_surface *layout_surface =
++ (struct ivi_layout_surface *) data;
++ uint32_t tmp_id;
++
++ tmp_id = ++ida->last_assigned_id;
++
++ /* Find an unused id */
++ while(ida->interface->get_surface_from_id(tmp_id)) {
++ weston_log("simple-id-agent: surface id: %d is already used\n", tmp_id);
++ tmp_id++;
++ }
++
++ ida->last_assigned_id = tmp_id;
++
++ if (ida->interface->surface_set_id(layout_surface, ida->last_assigned_id) != 0)
++ weston_log("simple-id-agent: failed to set surface id :%d\n", ida->last_assigned_id);
++}
++
++static void
++deinit(struct ivi_id_agent *ida)
++{
++ wl_list_remove(&ida->desktop_surface_configured.link);
++ free(ida);
++}
++
++static int32_t
++read_config(struct ivi_id_agent *ida)
++{
++ struct weston_config *config = NULL;
++ struct weston_config_section *section = NULL;
++ const char *name = NULL;
++
++ config = wet_get_config(ida->compositor);
++ if (!config)
++ return -1;
++
++ section = weston_config_get_section(config, "id-agent", NULL, NULL);
++
++ if (section) {
++
++ weston_config_section_get_uint(section, "default-id-offset",
++ &ida->default_id_offset, 0);
++
++ } else {
++ ida->default_id_offset = 0;
++ }
++
++ return 0;
++}
++
++WL_EXPORT int32_t
++id_agent_module_init(struct weston_compositor *ec,
++ const struct ivi_layout_interface *interface,
++ size_t interface_version)
++{
++ struct ivi_id_agent *ida;
++
++ ida = calloc(1, sizeof *ida);
++ if (ida == NULL) {
++ weston_log("failed to allocate ivi_id_agent\n");
++ return -1;
++ }
++
++ ida->compositor = ec;
++ ida->interface = interface;
++ ida->desktop_surface_configured.notify = desktop_surface_event_configure;
++ ida->interface->add_listener_configure_desktop_surface(&ida->desktop_surface_configured);
++
++ if(read_config(ida) != 0) {
++ deinit(ida);
++ return -1;
++ }
++
++ ida->last_assigned_id = ida->default_id_offset;
++
++ weston_log("id_agent_module_init: success\n");
++
++ return 0;
++}
+diff --git a/id-agent-modules/simple-id-agent/weston.ini.in b/id-agent-modules/simple-id-agent/weston.ini.in
+new file mode 100644
+index 0000000..b5e5fa1
+--- /dev/null
++++ b/id-agent-modules/simple-id-agent/weston.ini.in
+@@ -0,0 +1,11 @@
++[core]
++shell=ivi-shell.so
++require-input=false
++
++[ivi-shell]
++ivi-module=ivi-controller.so
++ivi-input-module=ivi-input-controller.so
++id-agent-module=simple-id-agent.so
++
++[id-agent]
++default-id-offset=10
+diff --git a/weston-ivi-shell/src/ivi-controller.c b/weston-ivi-shell/src/ivi-controller.c
+index 6d95c88..5e61e76 100644
+--- a/weston-ivi-shell/src/ivi-controller.c
++++ b/weston-ivi-shell/src/ivi-controller.c
+@@ -2164,6 +2164,40 @@ load_input_module(struct ivishell *shell)
+ return 0;
+ }
+
++static int load_id_agent_module(struct weston_compositor *ec,
++ const struct ivi_layout_interface *interface,
++ size_t interface_version)
++{
++ struct weston_config *config = wet_get_config(ec);
++ struct weston_config_section *section;
++ char *id_agent_module = NULL;
++
++ int (*id_agent_module_init)(struct weston_compositor *ec,
++ const struct ivi_layout_interface *interface,
++ size_t interface_version);
++
++ section = weston_config_get_section(config, "ivi-shell", NULL, NULL);
++
++ if (weston_config_section_get_string(section, "id-agent-module",
++ &id_agent_module, NULL) < 0) {
++ weston_log("ivi-controller: No id-agent-module set\n");
++ return 0;
++ }
++
++ id_agent_module_init = wet_load_module_entrypoint(id_agent_module, "id_agent_module_init");
++ if (!id_agent_module_init)
++ return -1;
++
++ if (id_agent_module_init(ec, interface,
++ sizeof(struct ivi_layout_interface)) != 0) {
++ weston_log("ivi-controller: Initialization of id agent module fails\n");
++ return -1;
++ }
++
++ free(id_agent_module);
++ return 0;
++}
++
+ static void
+ launch_client_process(void *data)
+ {
+@@ -2229,6 +2263,11 @@ controller_module_init(struct weston_compositor *compositor,
+ return -1;
+ }
+
++ if (load_id_agent_module(compositor, interface, interface_version) < 0) {
++ free(shell);
++ return -1;
++ }
++
+ if (shell->bkgnd_surface_id && shell->ivi_client_name) {
+ loop = wl_display_get_event_loop(compositor->wl_display);
+ wl_event_loop_add_idle(loop, launch_client_process, shell);
diff --git a/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb b/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb
index ea74e384c..1a09c7c32 100644
--- a/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb
+++ b/recipes-graphics/wayland/wayland-ivi-extension_2.0.2.bb
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=1f1a56bb2dadf5f2be8eb342acf4ed79"
SRCREV = "ff067a640451de46836200624ece7ac777977c30"
SRC_URI = "git://github.com/GENIVI/${BPN}.git;branch=2.0;protocol=http \
+ file://0001-simple-id-agent-for-2.0.2.patch \
"
SRC_URI_append_wandboard = " file://wandboard_fix_build.patch"