diff options
Diffstat (limited to 'meta-agl-drm-lease/recipes-graphics')
6 files changed, 72 insertions, 181 deletions
diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-backend-drm-Add-method-to-import-DRM-fd.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-backend-drm-Add-method-to-import-DRM-fd.patch index da3a0c6f..7387be9c 100644 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-backend-drm-Add-method-to-import-DRM-fd.patch +++ b/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-backend-drm-Add-method-to-import-DRM-fd.patch @@ -1,7 +1,7 @@ -From e7d843e3a2af9ed04569f4ec94d3f558ab2aeede Mon Sep 17 00:00:00 2001 +From 9ce172053169bbfd27ef8c18eb50ebac348f5bc2 Mon Sep 17 00:00:00 2001 From: Damian Hobson-Garcia <dhobsong@igel.co.jp> -Date: Wed, 20 Jan 2021 16:25:39 +0900 -Subject: [PATCH 1/2] backend-drm: Add method to import DRM fd +Date: Mon, 11 Apr 2022 18:50:45 +0900 +Subject: [PATCH 1/3] backend-drm: Add method to import DRM fd Allow the compositor to provide a file descriptor for a DRM device. @@ -14,26 +14,15 @@ and pass it to the DRM backend for use. Having the DRM device management in the compositor allows for integrating a platform specific resource manager without having to add extra dependencies to the generic libweston code. + +%% original patch: 0001-backend-drm-Add-method-to-import-DRM-fd.patch --- - compositor/main.c | 1 + include/libweston/backend-drm.h | 7 +++ - libweston/backend-drm/drm.c | 76 ++++++++++++++++++++++++--------- - 3 files changed, 65 insertions(+), 19 deletions(-) + libweston/backend-drm/drm.c | 75 ++++++++++++++++++++++++--------- + 2 files changed, 63 insertions(+), 19 deletions(-) -diff --git a/compositor/main.c b/compositor/main.c -index 8eb8a470..7d5373f7 100644 ---- a/compositor/main.c -+++ b/compositor/main.c -@@ -2510,6 +2510,7 @@ load_drm_backend(struct weston_compositor *c, - config.base.struct_version = WESTON_DRM_BACKEND_CONFIG_VERSION; - config.base.struct_size = sizeof(struct weston_drm_backend_config); - config.configure_device = configure_input_device; -+ config.device_fd = -1; - - wet->heads_changed_listener.notify = drm_heads_changed; - weston_compositor_add_heads_changed_listener(c, diff --git a/include/libweston/backend-drm.h b/include/libweston/backend-drm.h -index f6647e28..a62c8996 100644 +index af2da4a..2c12b17 100644 --- a/include/libweston/backend-drm.h +++ b/include/libweston/backend-drm.h @@ -223,6 +223,13 @@ struct weston_drm_backend_config { @@ -51,7 +40,7 @@ index f6647e28..a62c8996 100644 #ifdef __cplusplus diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c -index e3169b6e..300c9ff6 100644 +index 4278770..0707db7 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -40,6 +40,7 @@ @@ -62,7 +51,7 @@ index e3169b6e..300c9ff6 100644 #include <time.h> #include <xf86drm.h> -@@ -2486,29 +2487,22 @@ drm_device_changed(struct weston_compositor *compositor, +@@ -2670,29 +2671,22 @@ drm_device_changed(struct weston_compositor *compositor, wl_signal_emit(&compositor->session_signal, compositor); } @@ -98,7 +87,7 @@ index e3169b6e..300c9ff6 100644 if (res->count_crtcs <= 0 || res->count_connectors <= 0 || res->count_encoders <= 0) -@@ -2517,7 +2511,7 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device) +@@ -2701,7 +2695,7 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device) if (sysnum) id = atoi(sysnum); if (!sysnum || id < 0) { @@ -107,7 +96,7 @@ index e3169b6e..300c9ff6 100644 goto out_res; } -@@ -2527,9 +2521,9 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device) +@@ -2711,9 +2705,9 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device) weston_launcher_close(b->compositor->launcher, b->drm.fd); free(b->drm.filename); @@ -119,7 +108,7 @@ index e3169b6e..300c9ff6 100644 b->drm.devnum = devnum; drmModeFreeResources(res); -@@ -2538,11 +2532,33 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device) +@@ -2722,11 +2716,33 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device) out_res: drmModeFreeResources(res); @@ -155,7 +144,7 @@ index e3169b6e..300c9ff6 100644 /* * Find primary GPU * Some systems may have multiple DRM devices attached to a single seat. This -@@ -2630,6 +2646,25 @@ find_primary_gpu(struct drm_backend *b, const char *seat) +@@ -2814,6 +2830,25 @@ find_primary_gpu(struct drm_backend *b, const char *seat) return drm_device; } @@ -181,25 +170,17 @@ index e3169b6e..300c9ff6 100644 static struct udev_device * open_specific_drm_device(struct drm_backend *b, const char *name) { -@@ -2854,7 +2889,9 @@ drm_backend_create(struct weston_compositor *compositor, +@@ -3038,7 +3073,9 @@ drm_backend_create(struct weston_compositor *compositor, b->session_listener.notify = session_notify; wl_signal_add(&compositor->session_signal, &b->session_listener); - if (config->specific_device) -+ if (config->device_fd >= 0) ++ if (config->device_fd > 0) + drm_device = import_drm_device_fd(b, config->device_fd); + else if (config->specific_device) drm_device = open_specific_drm_device(b, config->specific_device); else drm_device = find_primary_gpu(b, seat_id); -@@ -3013,6 +3050,7 @@ static void - config_init_to_defaults(struct weston_drm_backend_config *config) - { - config->use_pixman_shadow = true; -+ config->device_fd = -1; - } - - WL_EXPORT int -- -2.25.1 +2.17.1 diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-compositor-do-not-request-repaint-in-output_enable.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-compositor-do-not-request-repaint-in-output_enable.patch index f2f99036..8301b051 100644 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-compositor-do-not-request-repaint-in-output_enable.patch +++ b/meta-agl-drm-lease/recipes-graphics/weston/weston/0001-compositor-do-not-request-repaint-in-output_enable.patch @@ -1,7 +1,7 @@ -From 3b7c9b7458976ea7f1e57796149d4ed4c56d9225 Mon Sep 17 00:00:00 2001 +From 434e7f0e87c7728ad2c9056ee4cf42686db2d5f2 Mon Sep 17 00:00:00 2001 From: Michael Tretter <m.tretter@pengutronix.de> Date: Thu, 23 Aug 2018 16:58:47 +0200 -Subject: [PATCH] compositor: do not request repaint in output_enable +Subject: [PATCH 3/3] compositor: do not request repaint in output_enable When enabling a weston_output, the compositor damages the entire output, to ensure that the entire output is redrawn. However, this triggers a @@ -12,15 +12,17 @@ Damage the entire output region, but do not trigger the repaint when enabling a weston_output. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> + +%% original patch: 0001-compositor-do-not-request-repaint-in-output_enable.patch --- libweston/compositor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libweston/compositor.c b/libweston/compositor.c -index 6e965372..34d8483c 100644 +index 1670c50..a983e60 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c -@@ -6471,7 +6471,9 @@ weston_output_enable(struct weston_output *output) +@@ -6762,7 +6762,9 @@ weston_output_enable(struct weston_output *output) weston_output_init_zoom(output); weston_output_init_geometry(output, x, y); @@ -32,5 +34,5 @@ index 6e965372..34d8483c 100644 wl_list_init(&output->animation_list); wl_list_init(&output->feedback_list); -- -2.25.1 +2.17.1 diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0002-Add-DRM-lease-support.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0002-Add-DRM-lease-support.patch index 5b2d69ae..a2249460 100644 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston/0002-Add-DRM-lease-support.patch +++ b/meta-agl-drm-lease/recipes-graphics/weston/weston/0002-Add-DRM-lease-support.patch @@ -1,23 +1,26 @@ -From 24ece5f73b7c9377e14d74c2b14c9ae3504edcc3 Mon Sep 17 00:00:00 2001 +From 5c315a4e4ab5e0d0376508f72c6f8a8070251c3f Mon Sep 17 00:00:00 2001 From: Damian Hobson-Garcia <dhobsong@igel.co.jp> -Date: Fri, 5 Mar 2021 19:24:35 +0900 -Subject: [PATCH 2/2] Add DRM lease support +Date: Mon, 11 Apr 2022 18:43:06 +0900 +Subject: [PATCH 2/3] Add DRM lease support Add a command line option to use a DRM lease instead of a primary node for output when using the DRM backend. + +%% original patch: 0002-Add-DRM-lease-support.patch --- - compositor/drm-lease.c | 53 ++++++++++++++++++++++++++++++++++++++++++ - compositor/drm-lease.h | 40 +++++++++++++++++++++++++++++++ - compositor/main.c | 11 ++++++++- - compositor/meson.build | 5 ++++ - meson_options.txt | 7 ++++++ - 5 files changed, 115 insertions(+), 1 deletion(-) + compositor/drm-lease.c | 53 +++++++++++++++++++++++++++++++++++++ + compositor/drm-lease.h | 40 ++++++++++++++++++++++++++++ + compositor/main.c | 10 +++++++ + compositor/meson.build | 5 ++++ + libweston/backend-drm/drm.c | 1 + + meson_options.txt | 7 +++++ + 6 files changed, 116 insertions(+) create mode 100644 compositor/drm-lease.c create mode 100644 compositor/drm-lease.h diff --git a/compositor/drm-lease.c b/compositor/drm-lease.c new file mode 100644 -index 00000000..fdb1f5e2 +index 0000000..fdb1f5e --- /dev/null +++ b/compositor/drm-lease.c @@ -0,0 +1,53 @@ @@ -76,7 +79,7 @@ index 00000000..fdb1f5e2 + diff --git a/compositor/drm-lease.h b/compositor/drm-lease.h new file mode 100644 -index 00000000..a102e4cb +index 0000000..a102e4c --- /dev/null +++ b/compositor/drm-lease.h @@ -0,0 +1,40 @@ @@ -121,26 +124,26 @@ index 00000000..a102e4cb + +#endif diff --git a/compositor/main.c b/compositor/main.c -index 7d5373f7..dae754aa 100644 +index 322f2ff..419ad06 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -65,6 +65,7 @@ #include <libweston/weston-log.h> - #include "../remoting/remoting-plugin.h" - #include "../pipewire/pipewire-plugin.h" + #include <libweston/remoting-plugin.h> + #include <libweston/pipewire-plugin.h> +#include "drm-lease.h" #define WINDOW_TITLE "Weston Compositor" /* flight recorder size (in bytes) */ -@@ -122,6 +123,7 @@ struct wet_compositor { - int (*simple_output_configure)(struct weston_output *output); - bool init_failed; - struct wl_list layoutput_list; /**< wet_layoutput::compositor_link */ +@@ -127,6 +128,7 @@ struct wet_compositor { + pid_t autolaunch_pid; + bool autolaunch_watch; + bool use_color_manager; + struct dlm_lease *drm_lease; }; static FILE *weston_logfile = NULL; -@@ -669,6 +671,9 @@ usage(int error_code) +@@ -687,6 +689,9 @@ usage(int error_code) " --seat=SEAT\t\tThe seat that weston should run on, instead of the seat defined in XDG_SEAT\n" " --tty=TTY\t\tThe tty to use\n" " --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n" @@ -148,42 +151,41 @@ index 7d5373f7..dae754aa 100644 + " --drm-lease=lease\tUse the specified DRM lease. e.g \"card0-HDMI-A-1\"\n" +#endif " --use-pixman\t\tUse the pixman (CPU) renderer\n" - " --current-mode\tPrefer current KMS mode over EDID preferred mode\n\n"); - #endif -@@ -2481,6 +2486,7 @@ load_drm_backend(struct weston_compositor *c, - struct weston_config_section *section; + " --current-mode\tPrefer current KMS mode over EDID preferred mode\n" + " --continue-without-input\tAllow the compositor to start without input devices\n\n"); +@@ -2626,6 +2631,7 @@ load_drm_backend(struct weston_compositor *c, struct wet_compositor *wet = to_wet_compositor(c); + bool without_input = false; int ret = 0; + char *drm_lease_name = NULL; wet->drm_use_current_mode = false; -@@ -2492,6 +2498,7 @@ load_drm_backend(struct weston_compositor *c, +@@ -2637,6 +2643,7 @@ load_drm_backend(struct weston_compositor *c, { WESTON_OPTION_STRING, "seat", 0, &config.seat_id }, { WESTON_OPTION_INTEGER, "tty", 0, &config.tty }, { WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device }, + { WESTON_OPTION_STRING, "drm-lease", 0, &drm_lease_name }, { WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode }, { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman }, - }; -@@ -2510,7 +2517,7 @@ load_drm_backend(struct weston_compositor *c, + { WESTON_OPTION_BOOLEAN, "continue-without-input", false, &without_input } +@@ -2658,6 +2665,7 @@ load_drm_backend(struct weston_compositor *c, config.base.struct_version = WESTON_DRM_BACKEND_CONFIG_VERSION; config.base.struct_size = sizeof(struct weston_drm_backend_config); config.configure_device = configure_input_device; -- config.device_fd = -1; + config.device_fd = get_drm_lease(&wet->drm_lease, drm_lease_name); wet->heads_changed_listener.notify = drm_heads_changed; weston_compositor_add_heads_changed_listener(c, -@@ -2527,6 +2534,7 @@ load_drm_backend(struct weston_compositor *c, - +@@ -2675,6 +2683,7 @@ load_drm_backend(struct weston_compositor *c, free(config.gbm_format); free(config.seat_id); + free(config.specific_device); + free(drm_lease_name); return ret; } -@@ -3373,6 +3381,7 @@ out: +@@ -3577,6 +3586,7 @@ out: /* free(NULL) is valid, and it won't be NULL if it's used */ free(wet.parsed_options); @@ -192,7 +194,7 @@ index 7d5373f7..dae754aa 100644 if (protologger) wl_protocol_logger_destroy(protologger); diff --git a/compositor/meson.build b/compositor/meson.build -index e1334d6a..e5b82a88 100644 +index 8a54ea9..5700d25 100644 --- a/compositor/meson.build +++ b/compositor/meson.build @@ -25,6 +25,11 @@ if get_option('xwayland') @@ -207,11 +209,23 @@ index e1334d6a..e5b82a88 100644 libexec_weston = shared_library( 'exec_weston', +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 0707db7..03e80ce 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -3267,6 +3267,7 @@ static void + config_init_to_defaults(struct weston_drm_backend_config *config) + { + config->use_pixman_shadow = true; ++ config->device_fd = -1; + } + + WL_EXPORT int diff --git a/meson_options.txt b/meson_options.txt -index 73ef2c34..9cb27536 100644 +index 8a527d7..db9f19b 100644 --- a/meson_options.txt +++ b/meson_options.txt -@@ -113,6 +113,13 @@ option( +@@ -106,6 +106,13 @@ option( description: 'Virtual remote output with Pipewire on DRM backend' ) @@ -226,5 +240,5 @@ index 73ef2c34..9cb27536 100644 'shell-desktop', type: 'boolean', -- -2.25.1 +2.17.1 diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch deleted file mode 100644 index ef60bdd5..00000000 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch +++ /dev/null @@ -1,61 +0,0 @@ -From d086d6e3bc75331048f9f235c03408c68df40457 Mon Sep 17 00:00:00 2001 -From: Leandro Ribeiro <leandro.ribeiro@collabora.com> -Date: Wed, 3 Jun 2020 10:01:06 -0300 -Subject: [PATCH 3/4] launcher: do not touch VT/tty while using non-default - seat - -Launcher-direct does not allow us to run using a different -seat from the default seat0. This happens because VTs are -only exposed to the default seat, and users that are on -non-default seat should not touch VTs. - -Add check in launcher-direct to skip VT/tty management if user -is running on a non-default seat. - -Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com> -(cherry picked from commit 887a7e5717275c0dec007e6128298d5956c70891) -Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> ---- - libweston/launcher-direct.c | 18 +++++++++++------- - 1 file changed, 11 insertions(+), 7 deletions(-) - -diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c -index 8e21880..71c332a 100644 ---- a/libweston/launcher-direct.c -+++ b/libweston/launcher-direct.c -@@ -303,9 +303,13 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * - launcher->base.iface = &launcher_direct_iface; - launcher->compositor = compositor; - -- if (setup_tty(launcher, tty) == -1) { -- free(launcher); -- return -1; -+ if (strcmp("seat0", seat_id) == 0) { -+ if (setup_tty(launcher, tty) == -1) { -+ free(launcher); -+ return -1; -+ } -+ } else { -+ launcher->tty = -1; - } - - * (struct launcher_direct **) out = launcher; -@@ -317,11 +321,11 @@ launcher_direct_destroy(struct weston_launcher *launcher_base) - { - struct launcher_direct *launcher = wl_container_of(launcher_base, launcher, base); - -- launcher_direct_restore(&launcher->base); -- wl_event_source_remove(launcher->vt_source); -- -- if (launcher->tty >= 0) -+ if (launcher->tty >= 0) { -+ launcher_direct_restore(&launcher->base); -+ wl_event_source_remove(launcher->vt_source); - close(launcher->tty); -+ } - - free(launcher); - } --- -2.17.1 - diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch deleted file mode 100644 index 6d49112c..00000000 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch +++ /dev/null @@ -1,43 +0,0 @@ -From a3c1df8dd097b72de09a6cb851ae797c0cb055b6 Mon Sep 17 00:00:00 2001 -From: nerdopolis <bluescreen_avenger@verizon.net> -Date: Wed, 20 Jan 2021 22:00:18 -0500 -Subject: [PATCH] launcher-direct: handle seat0 without VTs - -This allows launcher-direct to run when seat0 has no TTYs -This checks for a proper /dev/tty0 device as /dev/tty0 -does not get created by kernels compiled with CONFIG_VT=n - -(cherry picked from commit 72db3ac694c0f84f3c193df42e81be8329e52b61) -Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp> ---- - libweston/launcher-direct.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c -index 382ca49..646a91d 100644 ---- a/libweston/launcher-direct.c -+++ b/libweston/launcher-direct.c -@@ -290,6 +290,7 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * - int tty, const char *seat_id, bool sync_drm) - { - struct launcher_direct *launcher; -+ struct stat buf; - - if (geteuid() != 0) - return -EINVAL; -@@ -301,7 +302,11 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * - launcher->base.iface = &launcher_direct_iface; - launcher->compositor = compositor; - -- if (strcmp("seat0", seat_id) == 0) { -+ /* Checking the existance of /dev/tty0 and verifying it's a TTY -+ * device, as kernels compiled with CONFIG_VT=0 do not create these -+ * devices. */ -+ if (stat("/dev/tty0", &buf) == 0 && -+ strcmp("seat0", seat_id) == 0 && major(buf.st_rdev) == TTY_MAJOR) { - if (setup_tty(launcher, tty) == -1) { - free(launcher); - return -1; --- -2.25.1 - diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.0.bbappend b/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.0.bbappend index 9b8298d8..6444d341 100644 --- a/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.0.bbappend +++ b/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.0.bbappend @@ -3,8 +3,6 @@ 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://0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch \ - file://0004-launcher-direct-handle-seat0-without-VTs.patch \ file://0001-compositor-do-not-request-repaint-in-output_enable.patch \ " |