From 95e1b466426763d761b171677c86b36f925c9d88 Mon Sep 17 00:00:00 2001 From: Jan-Simon Moeller Date: Thu, 11 May 2023 17:09:44 +0200 Subject: Ensure meta-agl-drm-lease does pass yocto-check-layer and has run-yocto-check-layer.sh scripts Ensure the layers do pass again and that the scripts are up-to-date. Bug-AGL: SPEC-4680 Bug-AGL: SPEC-4686 Change-Id: Id1279d4a43b89d50731dd85e9347d35d524e14b7 Signed-off-by: Jan-Simon Moeller --- meta-agl-drm-lease/README.md | 3 + meta-agl-drm-lease/conf/layer.conf | 2 + .../agl-compositor/agl-compositor-init.bbappend | 3 + .../0001-Add-drm-lease-support.patch | 211 +++++++++++++++++++++ .../agl-compositor/agl-compositor_git.bbappend | 6 + .../recipes-core/psplash/psplash_agl-drm-lease.inc | 43 +++++ .../recipes-core/psplash/psplash_git.bbappend | 44 +---- .../agl-compositor/agl-compositor-init.bbappend | 3 - .../0001-Add-drm-lease-support.patch | 211 --------------------- .../agl-compositor/agl-compositor_git.bbappend | 6 - .../kmscube/kmscube_agl-drm-lease.inc | 8 + .../recipes-graphics/kmscube/kmscube_git.bbappend | 9 +- .../recipes-graphics/weston/weston_10.0.%.bbappend | 11 +- .../weston/weston_agl-drm-lease.inc | 10 + .../scripts/run-yocto-check-layer.sh | 42 ++++ 15 files changed, 331 insertions(+), 281 deletions(-) create mode 100644 meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor-init.bbappend create mode 100644 meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch create mode 100644 meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor_git.bbappend create mode 100644 meta-agl-drm-lease/recipes-core/psplash/psplash_agl-drm-lease.inc delete mode 100644 meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor-init.bbappend delete mode 100644 meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch delete mode 100644 meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor_git.bbappend create mode 100644 meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_agl-drm-lease.inc create mode 100644 meta-agl-drm-lease/recipes-graphics/weston/weston_agl-drm-lease.inc create mode 100755 meta-agl-drm-lease/scripts/run-yocto-check-layer.sh diff --git a/meta-agl-drm-lease/README.md b/meta-agl-drm-lease/README.md index b572fbce..680e72ff 100644 --- a/meta-agl-drm-lease/README.md +++ b/meta-agl-drm-lease/README.md @@ -61,3 +61,6 @@ Multiple kmscube instances (one per DRM lease) can be started at the same time. This layer has been tested on the Renesas R-Car Gen3 platform. Other platforms supporting the Linux DRM API may work as well. + +maintainer: agl-dev-community@lists.automotivelinux.org +patch: agl-dev-community@lists.automotivelinux.org diff --git a/meta-agl-drm-lease/conf/layer.conf b/meta-agl-drm-lease/conf/layer.conf index 2a3279e5..7614ba9f 100644 --- a/meta-agl-drm-lease/conf/layer.conf +++ b/meta-agl-drm-lease/conf/layer.conf @@ -15,6 +15,8 @@ BBFILES_DYNAMIC += " \ qt6-layer:${LAYERDIR}/dynamic-layers/meta-qt6/*/*/*.bbappend \ raspberrypi:${LAYERDIR}/dynamic-layers/meta-raspberrypi/*/*/*.bb \ raspberrypi:${LAYERDIR}/dynamic-layers/meta-raspberrypi/*/*/*.bbappend \ + aglcore:${LAYERDIR}/dynamic-layers/meta-agl-core/*/*/*.bb \ + aglcore:${LAYERDIR}/dynamic-layers/meta-agl-core/*/*/*.bbappend \ " # This should only be incremented on significant changes that will diff --git a/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor-init.bbappend b/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor-init.bbappend new file mode 100644 index 00000000..7b759f69 --- /dev/null +++ b/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor-init.bbappend @@ -0,0 +1,3 @@ +DRM_LEASE_DEVICE ??= "lease0" +AGL_COMPOSITOR_ARGS:append = " --drm-lease=${DRM_LEASE_DEVICE}" + diff --git a/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch b/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch new file mode 100644 index 00000000..868da66d --- /dev/null +++ b/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch @@ -0,0 +1,211 @@ +From d70ec96c2703c421bff55f5d2dce8d8aa5f8819b Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia +Date: Tue, 12 Apr 2022 15:12:27 +0900 +Subject: [PATCH] Add drm-lease support + +Add an option to use a DRM lease instead of a DRM device +as the video output. This will allow agl-compositor to +operate alongside other applications output via a DRM +lease. + +Signed-off-by: Damian Hobson-Garcia +--- + meson.build | 6 +++++ + meson_options.txt | 7 ++++++ + src/compositor.c | 7 ++++++ + src/drm-lease.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ + src/drm-lease.h | 19 ++++++++++++++++ + src/ivi-compositor.h | 2 ++ + 6 files changed, 93 insertions(+) + create mode 100644 src/drm-lease.c + create mode 100644 src/drm-lease.h + +diff --git a/meson.build b/meson.build +index 0958f06..cc5085f 100644 +--- a/meson.build ++++ b/meson.build +@@ -194,6 +194,12 @@ elif policy_to_install == 'rba' + message('Installing rba policy') + endif + ++if get_option('drm-lease') ++ deps_libweston += dependency('libdlmclient') ++ srcs_agl_compositor += 'src/drm-lease.c' ++ config_h.set('HAVE_DRM_LEASE', '1') ++endif ++ + # From meson documentation: + # In order to look for headers in a specific directory you can use args : + # '-I/extra/include/dir, but this should only be used in exceptional cases for +diff --git a/meson_options.txt b/meson_options.txt +index dd1f3c0..89de273 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -5,3 +5,10 @@ option( + value: 'allow-all', + description: 'Default policy when no specific policy was set' + ) ++ ++option( ++ 'drm-lease', ++ type: 'boolean', ++ value: false, ++ description: 'Support for running weston with a leased DRM Master' ++) +diff --git a/src/compositor.c b/src/compositor.c +index 634c468..f328a99 100644 +--- a/src/compositor.c ++++ b/src/compositor.c +@@ -64,6 +64,8 @@ + #include + #endif + ++#include "drm-lease.h" ++ + static int cached_tm_mday = -1; + static struct weston_log_scope *log_scope; + +@@ -904,11 +906,13 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[]) + int use_pixman = 0; + bool use_shadow; + bool without_input = false; ++ char *drm_lease_name = NULL; + int ret; + + const struct weston_option options[] = { + { WESTON_OPTION_STRING, "seat", 0, &config.seat_id }, + { WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device }, ++ { WESTON_OPTION_STRING, "drm-lease", 0, &drm_lease_name }, + { WESTON_OPTION_BOOLEAN, "current-mode", 0, &use_current_mode }, + { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman }, + { WESTON_OPTION_BOOLEAN, "continue-without-input", false, &without_input } +@@ -916,6 +920,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[]) + + parse_options(options, ARRAY_LENGTH(options), argc, argv); + config.use_pixman = use_pixman; ++ config.device_fd = get_drm_lease(&ivi->drm_lease, drm_lease_name); + ivi->cmdline.use_current_mode = use_current_mode; + + section = weston_config_get_section(ivi->config, "core", NULL, NULL); +@@ -947,6 +952,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[]) + error: + free(config.gbm_format); + free(config.seat_id); ++ free(drm_lease_name); + return ret; + } + +@@ -1833,6 +1839,7 @@ error_compositor: + free(modules); + modules = NULL; + ++ release_drm_lease(ivi.drm_lease); + weston_compositor_destroy(ivi.compositor); + + weston_log_scope_destroy(log_scope); +diff --git a/src/drm-lease.c b/src/drm-lease.c +new file mode 100644 +index 0000000..887277d +--- /dev/null ++++ b/src/drm-lease.c +@@ -0,0 +1,52 @@ ++/* ++ * Copyright © 2022 IGEL Co., Ltd. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the ++ * next paragraph) shall be included in all copies or substantial ++ * portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS ++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++ * SOFTWARE. ++ */ ++ ++#include "drm-lease.h" ++ ++#include ++ ++int get_drm_lease(struct dlm_lease **drm_lease, const char *drm_lease_name) { ++ if (!drm_lease_name) ++ return -1; ++ ++ int drm_fd = -1; ++ struct dlm_lease *lease = dlm_get_lease(drm_lease_name); ++ if (lease) { ++ drm_fd = dlm_lease_fd(lease); ++ if (drm_fd < 0) ++ dlm_release_lease(lease); ++ } ++ if (drm_fd < 0) ++ weston_log("Could not get DRM lease %s\n", drm_lease_name); ++ ++ *drm_lease = lease; ++ return drm_fd; ++} ++ ++void release_drm_lease(struct dlm_lease *lease) { ++ if (lease) ++ dlm_release_lease(lease); ++} ++ +diff --git a/src/drm-lease.h b/src/drm-lease.h +new file mode 100644 +index 0000000..9fdc428 +--- /dev/null ++++ b/src/drm-lease.h +@@ -0,0 +1,19 @@ ++#ifndef DRM_LEASE_H ++#define DRM_LEASE_H ++ ++#include "config.h" ++ ++#ifdef HAVE_DRM_LEASE ++#include ++int get_drm_lease(struct dlm_lease **drm_lease, const char *drm_lease_name); ++void release_drm_lease(struct dlm_lease *drm_lease); ++#else ++struct dlm_lease; ++static int get_drm_lease(struct dlm_lease **drm_lease, const char *drm_lease_name) { ++ return -1; ++} ++static void release_drm_lease(struct dlm_lease *drm_lease) { ++} ++ ++#endif ++#endif /* DRM_LEASE_H */ +diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h +index bf96fc7..fcf11bf 100644 +--- a/src/ivi-compositor.h ++++ b/src/ivi-compositor.h +@@ -35,6 +35,7 @@ + #include + + #include "remote.h" ++#include "drm-lease.h" + + #include "agl-shell-server-protocol.h" + +@@ -114,6 +115,7 @@ struct ivi_compositor { + struct weston_layer fullscreen; + + struct wl_list child_process_list; ++ struct dlm_lease *drm_lease; + }; + + struct ivi_surface; +-- +2.35.1 + diff --git a/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor_git.bbappend b/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor_git.bbappend new file mode 100644 index 00000000..3c64ce1f --- /dev/null +++ b/meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor_git.bbappend @@ -0,0 +1,6 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-Add-drm-lease-support.patch" + +PACKAGECONFIG[drm-lease] = "-Ddrm-lease=true,-Ddrm-lease=false,drm-lease-manager" +PACKAGECONFIG:append = " drm-lease" diff --git a/meta-agl-drm-lease/recipes-core/psplash/psplash_agl-drm-lease.inc b/meta-agl-drm-lease/recipes-core/psplash/psplash_agl-drm-lease.inc new file mode 100644 index 00000000..53adec9c --- /dev/null +++ b/meta-agl-drm-lease/recipes-core/psplash/psplash_agl-drm-lease.inc @@ -0,0 +1,43 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/files:" + +# drm-backend backport from: +# https://patchwork.yoctoproject.org/project/yocto/cover/20220425075954.10427-1-vasyl.vavrychuk@opensynergy.com/ +SRC_URI += " \ + file://0001-Fix-duplicated-definition-of-bool.patch \ + file://0002-Trim-trailing-spaces.patch \ + file://0003-Fix-unused-result-warnings.patch \ + file://0004-Remove-unused-save_termios.patch \ + file://0005-Remove-psplash-fb.h-from-psplash.h.patch \ + file://0006-Extract-plot-pixel-from-psplash-fb.patch \ + file://0007-Extract-draw-rect-image-from-psplash-fb.patch \ + file://0008-Extract-draw-font-from-psplash-fb.patch \ + file://0009-psplash.c-Make-psplash_draw_-msg-progress-independen.patch \ + file://0010-Rework-flip-as-function-pointer.patch \ + file://0011-Import-drm-howto-modeset.c-as-psplash-drm.c.patch \ + file://0012-Implement-drm-backend.patch \ + file://0013-Reverse-modeset_list.patch \ + file://0014-psplash-drm.c-Allocate-resources-only-for-the-first-.patch \ + file://0015-psplash-drm.c-Implement-double-buffering.patch \ + " + +# drm-lease support from: +# https://github.com/agl-ic-eg/meta-agl-demo/tree/main/recipes-core/psplash +SRC_URI += " \ + file://0016-Imprement-drm-lease-support.patch \ + file://0017-drm-lease-Fix-incorrect-drawing-with-portrait-orient.patch \ + file://psplash-drmlease.conf \ + " + +# Licesnse checksum was changed by above patches +LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=8;md5=db1ed16abf4be6de3d79201093ac4f07" + +PACKAGECONFIG:append = " drm drm-lease" + +PACKAGECONFIG[drm] = "--enable-drm,,libdrm" +PACKAGECONFIG[drm-lease] = "--enable-drm-lease,,drm-lease-manager" + +do_install:append () { + # Install override + install -d ${D}${systemd_system_unitdir}/psplash-start.service.d + install -m 0644 ${WORKDIR}/psplash-drmlease.conf ${D}${systemd_system_unitdir}/psplash-start.service.d/ +} diff --git a/meta-agl-drm-lease/recipes-core/psplash/psplash_git.bbappend b/meta-agl-drm-lease/recipes-core/psplash/psplash_git.bbappend index 53adec9c..548e209d 100644 --- a/meta-agl-drm-lease/recipes-core/psplash/psplash_git.bbappend +++ b/meta-agl-drm-lease/recipes-core/psplash/psplash_git.bbappend @@ -1,43 +1 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/files:" - -# drm-backend backport from: -# https://patchwork.yoctoproject.org/project/yocto/cover/20220425075954.10427-1-vasyl.vavrychuk@opensynergy.com/ -SRC_URI += " \ - file://0001-Fix-duplicated-definition-of-bool.patch \ - file://0002-Trim-trailing-spaces.patch \ - file://0003-Fix-unused-result-warnings.patch \ - file://0004-Remove-unused-save_termios.patch \ - file://0005-Remove-psplash-fb.h-from-psplash.h.patch \ - file://0006-Extract-plot-pixel-from-psplash-fb.patch \ - file://0007-Extract-draw-rect-image-from-psplash-fb.patch \ - file://0008-Extract-draw-font-from-psplash-fb.patch \ - file://0009-psplash.c-Make-psplash_draw_-msg-progress-independen.patch \ - file://0010-Rework-flip-as-function-pointer.patch \ - file://0011-Import-drm-howto-modeset.c-as-psplash-drm.c.patch \ - file://0012-Implement-drm-backend.patch \ - file://0013-Reverse-modeset_list.patch \ - file://0014-psplash-drm.c-Allocate-resources-only-for-the-first-.patch \ - file://0015-psplash-drm.c-Implement-double-buffering.patch \ - " - -# drm-lease support from: -# https://github.com/agl-ic-eg/meta-agl-demo/tree/main/recipes-core/psplash -SRC_URI += " \ - file://0016-Imprement-drm-lease-support.patch \ - file://0017-drm-lease-Fix-incorrect-drawing-with-portrait-orient.patch \ - file://psplash-drmlease.conf \ - " - -# Licesnse checksum was changed by above patches -LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=8;md5=db1ed16abf4be6de3d79201093ac4f07" - -PACKAGECONFIG:append = " drm drm-lease" - -PACKAGECONFIG[drm] = "--enable-drm,,libdrm" -PACKAGECONFIG[drm-lease] = "--enable-drm-lease,,drm-lease-manager" - -do_install:append () { - # Install override - install -d ${D}${systemd_system_unitdir}/psplash-start.service.d - install -m 0644 ${WORKDIR}/psplash-drmlease.conf ${D}${systemd_system_unitdir}/psplash-start.service.d/ -} +require ${@bb.utils.contains('AGL_FEATURES', 'agl-drm-lease', 'psplash_agl-drm-lease.inc', '', d)} diff --git a/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor-init.bbappend b/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor-init.bbappend deleted file mode 100644 index 7b759f69..00000000 --- a/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor-init.bbappend +++ /dev/null @@ -1,3 +0,0 @@ -DRM_LEASE_DEVICE ??= "lease0" -AGL_COMPOSITOR_ARGS:append = " --drm-lease=${DRM_LEASE_DEVICE}" - diff --git a/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch b/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch deleted file mode 100644 index 868da66d..00000000 --- a/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch +++ /dev/null @@ -1,211 +0,0 @@ -From d70ec96c2703c421bff55f5d2dce8d8aa5f8819b Mon Sep 17 00:00:00 2001 -From: Damian Hobson-Garcia -Date: Tue, 12 Apr 2022 15:12:27 +0900 -Subject: [PATCH] Add drm-lease support - -Add an option to use a DRM lease instead of a DRM device -as the video output. This will allow agl-compositor to -operate alongside other applications output via a DRM -lease. - -Signed-off-by: Damian Hobson-Garcia ---- - meson.build | 6 +++++ - meson_options.txt | 7 ++++++ - src/compositor.c | 7 ++++++ - src/drm-lease.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ - src/drm-lease.h | 19 ++++++++++++++++ - src/ivi-compositor.h | 2 ++ - 6 files changed, 93 insertions(+) - create mode 100644 src/drm-lease.c - create mode 100644 src/drm-lease.h - -diff --git a/meson.build b/meson.build -index 0958f06..cc5085f 100644 ---- a/meson.build -+++ b/meson.build -@@ -194,6 +194,12 @@ elif policy_to_install == 'rba' - message('Installing rba policy') - endif - -+if get_option('drm-lease') -+ deps_libweston += dependency('libdlmclient') -+ srcs_agl_compositor += 'src/drm-lease.c' -+ config_h.set('HAVE_DRM_LEASE', '1') -+endif -+ - # From meson documentation: - # In order to look for headers in a specific directory you can use args : - # '-I/extra/include/dir, but this should only be used in exceptional cases for -diff --git a/meson_options.txt b/meson_options.txt -index dd1f3c0..89de273 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -5,3 +5,10 @@ option( - value: 'allow-all', - description: 'Default policy when no specific policy was set' - ) -+ -+option( -+ 'drm-lease', -+ type: 'boolean', -+ value: false, -+ description: 'Support for running weston with a leased DRM Master' -+) -diff --git a/src/compositor.c b/src/compositor.c -index 634c468..f328a99 100644 ---- a/src/compositor.c -+++ b/src/compositor.c -@@ -64,6 +64,8 @@ - #include - #endif - -+#include "drm-lease.h" -+ - static int cached_tm_mday = -1; - static struct weston_log_scope *log_scope; - -@@ -904,11 +906,13 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[]) - int use_pixman = 0; - bool use_shadow; - bool without_input = false; -+ char *drm_lease_name = NULL; - int ret; - - const struct weston_option options[] = { - { WESTON_OPTION_STRING, "seat", 0, &config.seat_id }, - { WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device }, -+ { WESTON_OPTION_STRING, "drm-lease", 0, &drm_lease_name }, - { WESTON_OPTION_BOOLEAN, "current-mode", 0, &use_current_mode }, - { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman }, - { WESTON_OPTION_BOOLEAN, "continue-without-input", false, &without_input } -@@ -916,6 +920,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[]) - - parse_options(options, ARRAY_LENGTH(options), argc, argv); - config.use_pixman = use_pixman; -+ config.device_fd = get_drm_lease(&ivi->drm_lease, drm_lease_name); - ivi->cmdline.use_current_mode = use_current_mode; - - section = weston_config_get_section(ivi->config, "core", NULL, NULL); -@@ -947,6 +952,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[]) - error: - free(config.gbm_format); - free(config.seat_id); -+ free(drm_lease_name); - return ret; - } - -@@ -1833,6 +1839,7 @@ error_compositor: - free(modules); - modules = NULL; - -+ release_drm_lease(ivi.drm_lease); - weston_compositor_destroy(ivi.compositor); - - weston_log_scope_destroy(log_scope); -diff --git a/src/drm-lease.c b/src/drm-lease.c -new file mode 100644 -index 0000000..887277d ---- /dev/null -+++ b/src/drm-lease.c -@@ -0,0 +1,52 @@ -+/* -+ * Copyright © 2022 IGEL Co., Ltd. -+ * -+ * Permission is hereby granted, free of charge, to any person obtaining -+ * a copy of this software and associated documentation files (the -+ * "Software"), to deal in the Software without restriction, including -+ * without limitation the rights to use, copy, modify, merge, publish, -+ * distribute, sublicense, and/or sell copies of the Software, and to -+ * permit persons to whom the Software is furnished to do so, subject to -+ * the following conditions: -+ * -+ * The above copyright notice and this permission notice (including the -+ * next paragraph) shall be included in all copies or substantial -+ * portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#include "drm-lease.h" -+ -+#include -+ -+int get_drm_lease(struct dlm_lease **drm_lease, const char *drm_lease_name) { -+ if (!drm_lease_name) -+ return -1; -+ -+ int drm_fd = -1; -+ struct dlm_lease *lease = dlm_get_lease(drm_lease_name); -+ if (lease) { -+ drm_fd = dlm_lease_fd(lease); -+ if (drm_fd < 0) -+ dlm_release_lease(lease); -+ } -+ if (drm_fd < 0) -+ weston_log("Could not get DRM lease %s\n", drm_lease_name); -+ -+ *drm_lease = lease; -+ return drm_fd; -+} -+ -+void release_drm_lease(struct dlm_lease *lease) { -+ if (lease) -+ dlm_release_lease(lease); -+} -+ -diff --git a/src/drm-lease.h b/src/drm-lease.h -new file mode 100644 -index 0000000..9fdc428 ---- /dev/null -+++ b/src/drm-lease.h -@@ -0,0 +1,19 @@ -+#ifndef DRM_LEASE_H -+#define DRM_LEASE_H -+ -+#include "config.h" -+ -+#ifdef HAVE_DRM_LEASE -+#include -+int get_drm_lease(struct dlm_lease **drm_lease, const char *drm_lease_name); -+void release_drm_lease(struct dlm_lease *drm_lease); -+#else -+struct dlm_lease; -+static int get_drm_lease(struct dlm_lease **drm_lease, const char *drm_lease_name) { -+ return -1; -+} -+static void release_drm_lease(struct dlm_lease *drm_lease) { -+} -+ -+#endif -+#endif /* DRM_LEASE_H */ -diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h -index bf96fc7..fcf11bf 100644 ---- a/src/ivi-compositor.h -+++ b/src/ivi-compositor.h -@@ -35,6 +35,7 @@ - #include - - #include "remote.h" -+#include "drm-lease.h" - - #include "agl-shell-server-protocol.h" - -@@ -114,6 +115,7 @@ struct ivi_compositor { - struct weston_layer fullscreen; - - struct wl_list child_process_list; -+ struct dlm_lease *drm_lease; - }; - - struct ivi_surface; --- -2.35.1 - diff --git a/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor_git.bbappend b/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor_git.bbappend deleted file mode 100644 index 3c64ce1f..00000000 --- a/meta-agl-drm-lease/recipes-graphics/agl-compositor/agl-compositor_git.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://0001-Add-drm-lease-support.patch" - -PACKAGECONFIG[drm-lease] = "-Ddrm-lease=true,-Ddrm-lease=false,drm-lease-manager" -PACKAGECONFIG:append = " drm-lease" diff --git a/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_agl-drm-lease.inc b/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_agl-drm-lease.inc new file mode 100644 index 00000000..bc9e8b34 --- /dev/null +++ b/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_agl-drm-lease.inc @@ -0,0 +1,8 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + + +SRC_URI += "file://0001-texturator-Use-correct-GL-extension-header.patch \ + file://0002-Add-DRM-lease-support.patch" + +PACKAGECONFIG += "drm-lease" +PACKAGECONFIG[drm-lease] = "-Ddrm_lease=enabled,-Ddrm_lease=disabled,drm-lease-manager" diff --git a/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_git.bbappend b/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_git.bbappend index bc9e8b34..f49e6acb 100644 --- a/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_git.bbappend +++ b/meta-agl-drm-lease/recipes-graphics/kmscube/kmscube_git.bbappend @@ -1,8 +1 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - - -SRC_URI += "file://0001-texturator-Use-correct-GL-extension-header.patch \ - file://0002-Add-DRM-lease-support.patch" - -PACKAGECONFIG += "drm-lease" -PACKAGECONFIG[drm-lease] = "-Ddrm_lease=enabled,-Ddrm_lease=disabled,drm-lease-manager" +require ${@bb.utils.contains('AGL_FEATURES', 'agl-drm-lease', 'kmscube_agl-drm-lease.inc', '', d)} diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend b/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend index 8152a264..0aca4cff 100644 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend +++ b/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend @@ -1,10 +1 @@ -FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" - -SRC_URI:append = " \ - file://0001-backend-drm-Add-method-to-import-DRM-fd.patch \ - file://0002-Add-DRM-lease-support.patch \ - file://0001-compositor-do-not-request-repaint-in-output_enable.patch \ - " - -PACKAGECONFIG[drm-lease] = "-Ddrm-lease=true,-Ddrm-lease=false,drm-lease-manager" -PACKAGECONFIG:append = " drm-lease" +require ${@bb.utils.contains('AGL_FEATURES', 'agl-drm-lease', 'weston_agl-drm-lease.inc', '', d)} diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston_agl-drm-lease.inc b/meta-agl-drm-lease/recipes-graphics/weston/weston_agl-drm-lease.inc new file mode 100644 index 00000000..8152a264 --- /dev/null +++ b/meta-agl-drm-lease/recipes-graphics/weston/weston_agl-drm-lease.inc @@ -0,0 +1,10 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI:append = " \ + file://0001-backend-drm-Add-method-to-import-DRM-fd.patch \ + file://0002-Add-DRM-lease-support.patch \ + file://0001-compositor-do-not-request-repaint-in-output_enable.patch \ + " + +PACKAGECONFIG[drm-lease] = "-Ddrm-lease=true,-Ddrm-lease=false,drm-lease-manager" +PACKAGECONFIG:append = " drm-lease" diff --git a/meta-agl-drm-lease/scripts/run-yocto-check-layer.sh b/meta-agl-drm-lease/scripts/run-yocto-check-layer.sh new file mode 100755 index 00000000..3bcf31ca --- /dev/null +++ b/meta-agl-drm-lease/scripts/run-yocto-check-layer.sh @@ -0,0 +1,42 @@ +#!/bin/bash +#set -x + +SCRIPTPATH="$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )" +echo $SCRIPTPATH +AGLROOT="$SCRIPTPATH/../../.." +POKYDIR="$AGLROOT/external/poky" +TMPROOT=`mktemp -d` + +rm -rf ${TMPROOT}/testbuild-ycl || true +mkdir -p ${TMPROOT}/testbuild-ycl +cd ${TMPROOT}/testbuild-ycl + +source $POKYDIR/oe-init-build-env . + +cat << EOF >> conf/local.conf +# just define defaults +AGL_FEATURES ?= "" +AGL_EXTRA_IMAGE_FSTYPES ?= "" + +# important settings imported from poky-agl.conf +# we cannot import the distro config right away +# as the initial values are poky only till the layer +# is added in + +AGL_DEFAULT_DISTRO_FEATURES = "usrmerge largefile opengl wayland pam bluetooth bluez5 3g" +DISTRO_FEATURES:append = " systemd wayland pam \${AGL_DEFAULT_DISTRO_FEATURES}" +DISTRO_FEATURES_BACKFILL_CONSIDERED:append = " sysvinit" +VIRTUAL-RUNTIME_init_manager = "systemd" + +EOF + +yocto-check-layer --no-auto-dependency \ + -- \ + $AGLROOT/meta-agl-devel/meta-agl-drm-lease +# --dependency \ +# $AGLROOT/meta-agl/meta-agl-core \ +# + +[ $? = 0 ] && rm -rf ${TMPROOT}/testbuild-ycl + +exit 0 -- cgit 1.2.3-korg