summaryrefslogtreecommitdiffstats
path: root/meta-agl-drm-lease
diff options
context:
space:
mode:
Diffstat (limited to 'meta-agl-drm-lease')
-rw-r--r--meta-agl-drm-lease/conf/layer.conf2
-rw-r--r--meta-agl-drm-lease/dynamic-layers/meta-agl-core/recipes-graphics/agl-compositor/agl-compositor/0001-Add-drm-lease-support.patch93
-rw-r--r--meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch17
-rw-r--r--meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_24.%.bbappend (renamed from meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend)0
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston/0001-backend-drm-Add-method-to-import-DRM-fd.patch106
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston/0001-compositor-do-not-request-repaint-in-output_enable.patch34
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston/0002-Add-DRM-lease-support.patch106
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston_13.0.%.bbappend (renamed from meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend)0
8 files changed, 182 insertions, 176 deletions
diff --git a/meta-agl-drm-lease/conf/layer.conf b/meta-agl-drm-lease/conf/layer.conf
index 7614ba9f..7cb075ab 100644
--- a/meta-agl-drm-lease/conf/layer.conf
+++ b/meta-agl-drm-lease/conf/layer.conf
@@ -24,4 +24,4 @@ BBFILES_DYNAMIC += " \
LAYERVERSION_agl-drm-lease = "1"
LAYERDEPENDS_agl-drm-lease = "core"
-LAYERSERIES_COMPAT_agl-drm-lease = "kirkstone"
+LAYERSERIES_COMPAT_agl-drm-lease = "scarthgap"
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
index 868da66d..a5853d36 100644
--- 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
@@ -1,6 +1,6 @@
-From d70ec96c2703c421bff55f5d2dce8d8aa5f8819b Mon Sep 17 00:00:00 2001
-From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-Date: Tue, 12 Apr 2022 15:12:27 +0900
+From 7963529fc8e3e17a9596ef27cccc5c1b9e065e30 Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Date: Fri, 3 May 2024 14:29:13 +0300
Subject: [PATCH] Add drm-lease support
Add an option to use a DRM lease instead of a DRM device
@@ -8,23 +8,25 @@ as the video output. This will allow agl-compositor to
operate alongside other applications output via a DRM
lease.
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+Change-Id: I78f8b9425280d4c0606003cd86f4cf30c065b888
---
meson.build | 6 +++++
- meson_options.txt | 7 ++++++
+ meson_options.txt | 8 +++++++
src/compositor.c | 7 ++++++
src/drm-lease.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
src/drm-lease.h | 19 ++++++++++++++++
src/ivi-compositor.h | 2 ++
- 6 files changed, 93 insertions(+)
+ 6 files changed, 94 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
+index aa811ad..f5a98e8 100644
--- a/meson.build
+++ b/meson.build
-@@ -194,6 +194,12 @@ elif policy_to_install == 'rba'
+@@ -163,6 +163,12 @@ elif policy_to_install == 'rba'
message('Installing rba policy')
endif
@@ -38,14 +40,22 @@ index 0958f06..cc5085f 100644
# 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
+index 7c0e103..e0463f4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
-@@ -5,3 +5,10 @@ option(
+@@ -5,6 +5,7 @@ option(
value: 'allow-all',
description: 'Default policy when no specific policy was set'
)
+
+ option(
+ 'grpc-proxy',
+ type: 'boolean',
+@@ -24,3 +25,10 @@ option(
+ value: '/usr/bin/Xwayland',
+ description: 'Xwayland: path to installed Xwayland binary'
+ )
++
+option(
+ 'drm-lease',
+ type: 'boolean',
@@ -53,49 +63,50 @@ index dd1f3c0..89de273 100644
+ description: 'Support for running weston with a leased DRM Master'
+)
diff --git a/src/compositor.c b/src/compositor.c
-index 634c468..f328a99 100644
+index 078157a..156a0ae 100644
--- a/src/compositor.c
+++ b/src/compositor.c
-@@ -64,6 +64,8 @@
- #include <waltham-transmitter/transmitter_api.h>
- #endif
+@@ -57,6 +57,8 @@
+ #include "config.h"
+ #include "agl-shell-server-protocol.h"
+#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;
+ #ifdef HAVE_REMOTING
+ #include "remote.h"
+ #endif
+@@ -1069,6 +1071,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
+ bool force_pixman = false;
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;
+@@ -1094,6 +1097,7 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
+ &config.pageflip_timeout, 0);
+ weston_config_section_get_bool(section, "pixman-shadow", &use_shadow, 1);
+ config.use_pixman_shadow = use_shadow;
+ 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[])
+ if (without_input)
+ ivi->compositor->require_input = !without_input;
+@@ -1114,12 +1118,14 @@ load_drm_backend(struct ivi_compositor *ivi, int *argc, char *argv[],
+ goto error;
+ }
+
++ free(drm_lease_name);
+ load_remoting_plugin(ivi, ivi->config);
+
+ return 0;
+
error:
free(config.gbm_format);
- free(config.seat_id);
+ free(drm_lease_name);
- return ret;
+ free(config.seat_id);
+ return -1;
}
-
-@@ -1833,6 +1839,7 @@ error_compositor:
+@@ -2263,6 +2269,7 @@ error_compositor:
free(modules);
modules = NULL;
@@ -187,25 +198,25 @@ index 0000000..9fdc428
+#endif
+#endif /* DRM_LEASE_H */
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h
-index bf96fc7..fcf11bf 100644
+index 695cf95..e3df79a 100644
--- a/src/ivi-compositor.h
+++ b/src/ivi-compositor.h
-@@ -35,6 +35,7 @@
- #include <libweston-desktop/libweston-desktop.h>
+@@ -36,6 +36,7 @@
+ #include <libweston/desktop.h>
#include "remote.h"
+#include "drm-lease.h"
#include "agl-shell-server-protocol.h"
-@@ -114,6 +115,7 @@ struct ivi_compositor {
- struct weston_layer fullscreen;
+@@ -145,6 +146,7 @@ struct ivi_compositor {
+ bool need_ivi_output_relayout;
struct wl_list child_process_list;
+ struct dlm_lease *drm_lease;
};
struct ivi_surface;
--
-2.35.1
+2.43.0
diff --git a/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch
index f6be51e0..a83ca0ee 100644
--- a/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch
+++ b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa/0001-Workaround-Disable-DRM_AUTH-checks-on-wayland-protocols.patch
@@ -1,4 +1,4 @@
-From f583672221b8451d03f739bc96428e97809d021a Mon Sep 17 00:00:00 2001
+From 991eb404c23c328b10894303be00c1036e6d3d3d Mon Sep 17 00:00:00 2001
From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
Date: Tue, 5 Apr 2022 18:09:02 +0900
Subject: [PATCH] Workaround: Disable DRM_AUTH check on wayland protocols
@@ -18,25 +18,26 @@ DRM lease and/or whether the import/export can succeed without
authentication. For now, just try to authenticate and ignore
any failures.
---
- src/egl/drivers/dri2/platform_drm.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
+ src/egl/drivers/dri2/platform_drm.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
-index d0ab172..260a2c6 100644
+index 1a35ae3..0436f16 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
-@@ -508,7 +508,10 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
+@@ -405,7 +405,11 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-- return drmAuthMagic(dri2_dpy->fd, id);
+- return drmAuthMagic(dri2_dpy->fd_render_gpu, id);
++ //return drmAuthMagic(dri2_dpy->fd_render_gpu, id);
+ /* WORKAROUND: Ignore DRM_AUTH failures. Ideally should only be done for
+ clienits coming through a DRM lease, but just make it global for now */
-+ drmAuthMagic(dri2_dpy->fd, id);
++ drmAuthMagic(dri2_dpy->fd_render_gpu, id);
+ return 0;
}
static void
--
-2.17.1
+2.37.3
diff --git a/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_24.%.bbappend
index 15e3aeba..15e3aeba 100644
--- a/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_22.%.bbappend
+++ b/meta-agl-drm-lease/dynamic-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_24.%.bbappend
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 7387be9c..a87e8bac 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 9ce172053169bbfd27ef8c18eb50ebac348f5bc2 Mon Sep 17 00:00:00 2001
-From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-Date: Mon, 11 Apr 2022 18:50:45 +0900
-Subject: [PATCH 1/3] backend-drm: Add method to import DRM fd
+From 46e5ec89cad434b1a1dd9ca49a35e1c6992c54c1 Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Date: Thu, 2 May 2024 19:11:06 +0300
+Subject: [PATCH 1/2] backend-drm: Add method to import DRM fd
Allow the compositor to provide a file descriptor for a
DRM device.
@@ -15,20 +15,21 @@ 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
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
---
include/libweston/backend-drm.h | 7 +++
- libweston/backend-drm/drm.c | 75 ++++++++++++++++++++++++---------
- 2 files changed, 63 insertions(+), 19 deletions(-)
+ libweston/backend-drm/drm.c | 78 ++++++++++++++++++++++++---------
+ 2 files changed, 64 insertions(+), 21 deletions(-)
diff --git a/include/libweston/backend-drm.h b/include/libweston/backend-drm.h
-index af2da4a..2c12b17 100644
+index d47955c..889848a 100644
--- a/include/libweston/backend-drm.h
+++ b/include/libweston/backend-drm.h
-@@ -223,6 +223,13 @@ struct weston_drm_backend_config {
-
- /** Use shadow buffer if using Pixman-renderer. */
- bool use_pixman_shadow;
+@@ -258,6 +258,13 @@ struct weston_drm_backend_config {
+ * rendering device.
+ */
+ char *additional_devices;
+
+ /** DRM device file descriptor to use
+ *
@@ -40,7 +41,7 @@ index af2da4a..2c12b17 100644
#ifdef __cplusplus
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
-index 4278770..0707db7 100644
+index 8092789..4e78ad0 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -40,6 +40,7 @@
@@ -49,9 +50,9 @@ index 4278770..0707db7 100644
#include <sys/mman.h>
+#include <sys/stat.h>
#include <time.h>
+ #include <poll.h>
- #include <xf86drm.h>
-@@ -2670,29 +2671,22 @@ drm_device_changed(struct weston_compositor *compositor,
+@@ -3431,31 +3432,22 @@ drm_device_changed(struct weston_backend *backend,
wl_signal_emit(&compositor->session_signal, compositor);
}
@@ -60,25 +61,27 @@ index 4278770..0707db7 100644
- * sets b->drm.fd and b->drm.filename to the opened device.
- */
static bool
--drm_device_is_kms(struct drm_backend *b, struct udev_device *device)
-+drm_backend_update_kms_device(struct drm_backend *b, struct udev_device *device,
-+ const char *name, int drm_fd)
+-drm_device_is_kms(struct drm_backend *b, struct drm_device *device,
+- struct udev_device *udev_device)
++drm_backend_update_kms_device(struct drm_backend *b, struct drm_device *device,
++ struct udev_device *udev_device, const char *name, int drm_fd)
{
-- const char *filename = udev_device_get_devnode(device);
- const char *sysnum = udev_device_get_sysnum(device);
- dev_t devnum = udev_device_get_devnum(device);
+ struct weston_compositor *compositor = b->compositor;
+- const char *filename = udev_device_get_devnode(udev_device);
+ const char *sysnum = udev_device_get_sysnum(udev_device);
+ dev_t devnum = udev_device_get_devnum(udev_device);
drmModeRes *res;
- int id = -1, fd;
+ int id = -1;
- if (!filename)
+- return false;
+-
+- fd = weston_launcher_open(compositor->launcher, filename, O_RDWR);
+- if (fd < 0)
+ if (!name)
return false;
-- fd = weston_launcher_open(b->compositor->launcher, filename, O_RDWR);
-- if (fd < 0)
-- return false;
-
- res = drmModeGetResources(fd);
+ res = drmModeGetResources(drm_fd);
if (!res)
@@ -87,7 +90,7 @@ index 4278770..0707db7 100644
if (res->count_crtcs <= 0 || res->count_connectors <= 0 ||
res->count_encoders <= 0)
-@@ -2701,7 +2695,7 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device)
+@@ -3464,7 +3456,7 @@ drm_device_is_kms(struct drm_backend *b, struct drm_device *device,
if (sysnum)
id = atoi(sysnum);
if (!sysnum || id < 0) {
@@ -96,19 +99,19 @@ index 4278770..0707db7 100644
goto out_res;
}
-@@ -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);
+@@ -3474,9 +3466,9 @@ drm_device_is_kms(struct drm_backend *b, struct drm_device *device,
+ weston_launcher_close(compositor->launcher, device->drm.fd);
+ free(device->drm.filename);
-- b->drm.fd = fd;
-+ b->drm.fd = drm_fd;
- b->drm.id = id;
-- b->drm.filename = strdup(filename);
-+ b->drm.filename = strdup(name);
- b->drm.devnum = devnum;
+- device->drm.fd = fd;
++ device->drm.fd = drm_fd;
+ device->drm.id = id;
+- device->drm.filename = strdup(filename);
++ device->drm.filename = strdup(name);
+ device->drm.devnum = devnum;
drmModeFreeResources(res);
-@@ -2722,11 +2716,33 @@ drm_device_is_kms(struct drm_backend *b, struct udev_device *device)
+@@ -3485,11 +3477,34 @@ drm_device_is_kms(struct drm_backend *b, struct drm_device *device,
out_res:
drmModeFreeResources(res);
@@ -122,10 +125,11 @@ index 4278770..0707db7 100644
+ * sets b->drm.fd and b->drm.filename to the opened device.
+ */
+static bool
-+drm_device_is_kms(struct drm_backend *b, struct udev_device *device)
++drm_device_is_kms(struct drm_backend *b, struct drm_device *device,
++ struct udev_device *udev_device)
+{
+ int fd;
-+ const char *filename = udev_device_get_devnode(device);
++ const char *filename = udev_device_get_devnode(udev_device);
+ if (!filename)
+ return false;
+
@@ -133,7 +137,7 @@ index 4278770..0707db7 100644
+ if (fd < 0)
+ return false;
+
-+ if (!drm_backend_update_kms_device(b, device, filename, fd)) {
++ if (!drm_backend_update_kms_device(b, b->drm, udev_device, filename, fd)) {
+ weston_launcher_close(b->compositor->launcher, fd);
+ return false;
+ }
@@ -144,33 +148,33 @@ index 4278770..0707db7 100644
/*
* Find primary GPU
* Some systems may have multiple DRM devices attached to a single seat. This
-@@ -2814,6 +2830,25 @@ find_primary_gpu(struct drm_backend *b, const char *seat)
+@@ -3578,6 +3593,25 @@ find_primary_gpu(struct drm_backend *b, const char *seat)
return drm_device;
}
+static struct udev_device *
+import_drm_device_fd(struct drm_backend *b, int fd)
+{
-+ struct udev_device *device;
++ struct udev_device *udev_device;
+ struct stat s;
+
+ if (fstat(fd, &s) < 0 || !S_ISCHR(s.st_mode))
+ return NULL;
+
-+ device = udev_device_new_from_devnum(b->udev, 'c', s.st_rdev);
-+ if (!device)
++ udev_device = udev_device_new_from_devnum(b->udev, 'c', s.st_rdev);
++ if (!udev_device)
+ return NULL;
+
-+ if (!drm_backend_update_kms_device(b, device, "imported DRM device fd", fd))
++ if (!drm_backend_update_kms_device(b, b->drm, udev_device, "imported DRM device fd", fd))
+ return NULL;
+
-+ return device;
++ return udev_device;
+}
+
static struct udev_device *
- open_specific_drm_device(struct drm_backend *b, const char *name)
- {
-@@ -3038,7 +3073,9 @@ drm_backend_create(struct weston_compositor *compositor,
+ open_specific_drm_device(struct drm_backend *b, struct drm_device *device,
+ const char *name)
+@@ -3904,7 +3938,9 @@ drm_backend_create(struct weston_compositor *compositor,
b->session_listener.notify = session_notify;
wl_signal_add(&compositor->session_signal, &b->session_listener);
@@ -178,9 +182,9 @@ index 4278770..0707db7 100644
+ 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);
+ drm_device = open_specific_drm_device(b, device,
+ config->specific_device);
else
- drm_device = find_primary_gpu(b, seat_id);
--
-2.17.1
+2.43.0
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 8301b051..f982f0b6 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 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 3/3] compositor: do not request repaint in output_enable
+From c030a31ee81e5d17002b4b6ee672ae3d532e4e28 Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Date: Sat, 4 May 2024 23:27:57 +0300
+Subject: [PATCH] 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,27 +12,25 @@ 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
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
- libweston/compositor.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
+ libweston/compositor.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libweston/compositor.c b/libweston/compositor.c
-index 1670c50..a983e60 100644
+index 34cde8c..3eba50d 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
-@@ -6762,7 +6762,9 @@ weston_output_enable(struct weston_output *output)
- weston_output_init_zoom(output);
+@@ -7823,7 +7823,8 @@ weston_output_enable(struct weston_output *output)
+ }
- weston_output_init_geometry(output, x, y);
+ weston_compositor_add_output(output->compositor, output);
- weston_output_damage(output);
-+ pixman_region32_union(&c->primary_plane.damage,
-+ &c->primary_plane.damage,
-+ &output->region);
++ weston_output_flush_damage_for_plane(output, &output->primary_plane,
++ &output->region);
- wl_list_init(&output->animation_list);
- wl_list_init(&output->feedback_list);
+ head_names = weston_output_create_heads_string(output);
+ weston_log("Output '%s' enabled with head(s) %s\n",
--
-2.17.1
+2.43.0
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 a2249460..48314680 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,29 +1,30 @@
-From 5c315a4e4ab5e0d0376508f72c6f8a8070251c3f Mon Sep 17 00:00:00 2001
-From: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-Date: Mon, 11 Apr 2022 18:43:06 +0900
-Subject: [PATCH 2/3] Add DRM lease support
+From 180b3f71ef411c88d4fd40a90ef75ef1a694805e Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Date: Thu, 2 May 2024 19:45:41 +0300
+Subject: [PATCH 2/2] 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
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
---
- compositor/drm-lease.c | 53 +++++++++++++++++++++++++++++++++++++
- compositor/drm-lease.h | 40 ++++++++++++++++++++++++++++
- compositor/main.c | 10 +++++++
- compositor/meson.build | 5 ++++
+ compositor/drm-lease.c | 51 +++++++++++++++++++++++++++++++++++++
+ compositor/drm-lease.h | 40 +++++++++++++++++++++++++++++
+ compositor/main.c | 9 +++++++
+ compositor/meson.build | 6 +++++
libweston/backend-drm/drm.c | 1 +
meson_options.txt | 7 +++++
- 6 files changed, 116 insertions(+)
+ 6 files changed, 114 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 0000000..fdb1f5e
+index 0000000..11ee2e4
--- /dev/null
+++ b/compositor/drm-lease.c
-@@ -0,0 +1,53 @@
+@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2021 IGEL Co., Ltd.
+ *
@@ -65,9 +66,9 @@ index 0000000..fdb1f5e
+ dlm_release_lease(lease);
+ }
+ if (drm_fd < 0)
-+ weston_log("Could not get DRM lease %s\n", drm_lease_name);
++ weston_log("Could not get DRM lease %s\n", drm_lease_name);
+
-+ *drm_lease = lease;
++ *drm_lease = lease;
+ return drm_fd;
+}
+
@@ -75,8 +76,6 @@ index 0000000..fdb1f5e
+ if (lease)
+ dlm_release_lease(lease);
+}
-+
-+
diff --git a/compositor/drm-lease.h b/compositor/drm-lease.h
new file mode 100644
index 0000000..a102e4c
@@ -124,10 +123,10 @@ index 0000000..a102e4c
+
+#endif
diff --git a/compositor/main.c b/compositor/main.c
-index 322f2ff..419ad06 100644
+index 0e3d375..bb8e27e 100644
--- a/compositor/main.c
+++ b/compositor/main.c
-@@ -65,6 +65,7 @@
+@@ -70,6 +70,7 @@
#include <libweston/weston-log.h>
#include <libweston/remoting-plugin.h>
#include <libweston/pipewire-plugin.h>
@@ -135,97 +134,90 @@ index 322f2ff..419ad06 100644
#define WINDOW_TITLE "Weston Compositor"
/* flight recorder size (in bytes) */
-@@ -127,6 +128,7 @@ struct wet_compositor {
- pid_t autolaunch_pid;
- bool autolaunch_watch;
- bool use_color_manager;
+@@ -152,6 +153,7 @@ struct wet_compositor {
+ bool drm_backend_loaded;
+ struct wl_listener screenshot_auth;
+ enum require_outputs require_outputs;
+ struct dlm_lease *drm_lease;
};
static FILE *weston_logfile = NULL;
-@@ -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"
+@@ -718,6 +720,9 @@ usage(int error_code)
+ " --drm-device=CARD\tThe DRM device to use for rendering and output, e.g. \"card0\".\n"
+ " --additional-devices=CARD\tSecondary DRM devices to use for output only, e.g. \"card1,card2\".\n"
+ " --use-pixman\t\tUse the pixman (CPU) renderer (deprecated alias for --renderer=pixman)\n"
+#ifdef BUILD_DRM_LEASE_CLIENT
+ " --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"
" --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);
+ #endif
+@@ -3025,6 +3030,7 @@ load_drm_backend(struct weston_compositor *c, int *argc, char **argv,
+ struct wet_backend *wb;
bool without_input = false;
- int ret = 0;
+ bool force_pixman = false;
+ char *drm_lease_name = NULL;
wet->drm_use_current_mode = false;
-@@ -2637,6 +2643,7 @@ load_drm_backend(struct weston_compositor *c,
+@@ -3036,6 +3042,7 @@ load_drm_backend(struct weston_compositor *c, int *argc, char **argv,
+ const struct weston_option options[] = {
{ 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_STRING, "additional-devices", 0, &config.additional_devices},
{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode },
- { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
- { WESTON_OPTION_BOOLEAN, "continue-without-input", false, &without_input }
-@@ -2658,6 +2665,7 @@ load_drm_backend(struct weston_compositor *c,
+ { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &force_pixman },
+@@ -3067,6 +3074,7 @@ load_drm_backend(struct weston_compositor *c, int *argc, char **argv,
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 = get_drm_lease(&wet->drm_lease, drm_lease_name);
- wet->heads_changed_listener.notify = drm_heads_changed;
- weston_compositor_add_heads_changed_listener(c,
-@@ -2675,6 +2683,7 @@ load_drm_backend(struct weston_compositor *c,
+ wb = wet_compositor_load_backend(c, WESTON_BACKEND_DRM, &config.base,
+ drm_heads_changed, NULL);
+@@ -3080,6 +3088,7 @@ load_drm_backend(struct weston_compositor *c, int *argc, char **argv,
free(config.gbm_format);
free(config.seat_id);
free(config.specific_device);
+ free(drm_lease_name);
- return ret;
+ return 0;
}
-@@ -3577,6 +3586,7 @@ out:
-
- /* free(NULL) is valid, and it won't be NULL if it's used */
- free(wet.parsed_options);
-+ release_drm_lease(wet.drm_lease);
-
- if (protologger)
- wl_protocol_logger_destroy(protologger);
diff --git a/compositor/meson.build b/compositor/meson.build
-index 8a54ea9..5700d25 100644
+index 7b49c48..d0f7c6a 100644
--- a/compositor/meson.build
+++ b/compositor/meson.build
-@@ -25,6 +25,11 @@ if get_option('xwayland')
- srcs_weston += 'xwayland.c'
+@@ -25,6 +25,12 @@ if get_option('xwayland')
config_h.set_quoted('XSERVER_PATH', get_option('xwayland-path'))
endif
+
+if get_option('drm-lease')
+ deps_weston += dependency('libdlmclient')
+ srcs_weston += 'drm-lease.c'
+ config_h.set('BUILD_DRM_LEASE_CLIENT', '1')
+endif
-
++
libexec_weston = shared_library(
'exec_weston',
+ sources: srcs_weston,
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
-index 0707db7..03e80ce 100644
+index 4e78ad0..3b747ed 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)
+@@ -4150,6 +4150,7 @@ config_init_to_defaults(struct weston_drm_backend_config *config)
{
+ config->renderer = WESTON_RENDERER_AUTO;
config->use_pixman_shadow = true;
+ config->device_fd = -1;
}
WL_EXPORT int
diff --git a/meson_options.txt b/meson_options.txt
-index 8a527d7..db9f19b 100644
+index ac355f1..b0d32a0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
-@@ -106,6 +106,13 @@ option(
+@@ -105,6 +105,13 @@ option(
description: 'Virtual remote output with Pipewire on DRM backend'
)
@@ -240,5 +232,5 @@ index 8a527d7..db9f19b 100644
'shell-desktop',
type: 'boolean',
--
-2.17.1
+2.43.0
diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend b/meta-agl-drm-lease/recipes-graphics/weston/weston_13.0.%.bbappend
index 0aca4cff..0aca4cff 100644
--- a/meta-agl-drm-lease/recipes-graphics/weston/weston_10.0.%.bbappend
+++ b/meta-agl-drm-lease/recipes-graphics/weston/weston_13.0.%.bbappend