diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2024-07-26 13:54:47 +0300 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2024-08-29 02:40:33 +0000 |
commit | a85d71c2072c59f90a4fe0214cc6696364a82c34 (patch) | |
tree | 0e5b50c0caa5729784a00dc3b4907b05cec26cd5 | |
parent | 336373fb924c2a79f77fcf19eea923246c5df2cc (diff) |
weston: Port small fix for always creating a hash table
This is a attempting for SPEC-5208 which brings in two changes from
Weston main, which could potentially fix the issue.
Bug-AGL: SPEC-5208
Change-Id: I7d350797bddae9e3aef1ab7c8816f8269f2a14e7
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/30138
ci-image-build: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tested-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
(cherry picked from commit 64bb35267deb05e730232230f2e5bf19ad7bcdac)
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/30207
Reviewed-by: Scott Murray <scott.murray@konsulko.com>
ci-image-boot-test: Jenkins Job builder account
Tested-by: Jenkins Job builder account
3 files changed, 85 insertions, 0 deletions
diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-don-t-leak-gem_handle_refcnt-in-drm_dest.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-don-t-leak-gem_handle_refcnt-in-drm_dest.patch new file mode 100644 index 000000000..0e3ab7613 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-drm-don-t-leak-gem_handle_refcnt-in-drm_dest.patch @@ -0,0 +1,27 @@ +From fb60f9c16ce8865fbdcd181419f44b72af1aa3c2 Mon Sep 17 00:00:00 2001 +From: Ray Smith <rsmith@brightsign.biz> +Date: Tue, 19 Dec 2023 11:43:55 +0000 +Subject: [PATCH 1/2] backend-drm: don't leak gem_handle_refcnt in drm_destroy + +Signed-off-by: Ray Smith <rsmith@brightsign.biz> +--- + libweston/backend-drm/drm.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 8092789..fcececb 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -3364,6 +3364,9 @@ drm_destroy(struct weston_backend *backend) + weston_launcher_close(ec->launcher, device->drm.fd); + weston_launcher_destroy(ec->launcher); + ++ if (device->gem_handle_refcnt) ++ hash_table_destroy(device->gem_handle_refcnt); ++ + free(device->drm.filename); + free(device); + free(b); +-- +2.43.0 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0002-backend-drm-always-create-gem_handle_refcnt-hash-tab.patch b/meta-agl-core/recipes-graphics/wayland/weston/0002-backend-drm-always-create-gem_handle_refcnt-hash-tab.patch new file mode 100644 index 000000000..0ae82088a --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0002-backend-drm-always-create-gem_handle_refcnt-hash-tab.patch @@ -0,0 +1,56 @@ +From 10fcfd66069c774e28f67b18afd329e4bcf9f5b3 Mon Sep 17 00:00:00 2001 +From: Ray Smith <rsmith@brightsign.biz> +Date: Tue, 19 Dec 2023 11:45:45 +0000 +Subject: [PATCH 2/2] backend-drm: always create gem_handle_refcnt hash table + +Devices created via drm_device_create have this hash table, but those +created via drm_backend_create don't. + +Signed-off-by: Ray Smith <rsmith@brightsign.biz> +--- + libweston/backend-drm/drm.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index fcececb..9d6a9cf 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -3364,8 +3364,7 @@ drm_destroy(struct weston_backend *backend) + weston_launcher_close(ec->launcher, device->drm.fd); + weston_launcher_destroy(ec->launcher); + +- if (device->gem_handle_refcnt) +- hash_table_destroy(device->gem_handle_refcnt); ++ hash_table_destroy(device->gem_handle_refcnt); + + free(device->drm.filename); + free(device); +@@ -3867,10 +3866,13 @@ drm_backend_create(struct weston_compositor *compositor, + + device = zalloc(sizeof *device); + if (device == NULL) +- return NULL; ++ goto err_backend; + device->state_invalid = true; + device->drm.fd = -1; + device->backend = b; ++ device->gem_handle_refcnt = hash_table_create(); ++ if (!device->gem_handle_refcnt) ++ goto err_device; + + b->drm = device; + wl_list_init(&b->kms_list); +@@ -4108,6 +4110,10 @@ err_compositor: + if (b->gbm) + gbm_device_destroy(b->gbm); + #endif ++ hash_table_destroy(device->gem_handle_refcnt); ++err_device: ++ free(device); ++err_backend: + free(b); + return NULL; + } +-- +2.43.0 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston_13.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_13.0_aglcore.inc index 843a068b4..a377bbe4e 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston_13.0_aglcore.inc +++ b/meta-agl-core/recipes-graphics/wayland/weston_13.0_aglcore.inc @@ -5,6 +5,8 @@ PACKAGECONFIG:append = "${@bb.utils.contains('DISTRO_FEATURES', 'weston-remoting SRC_URI:append = " \ file://0001-clients-Handle-missing-pointer_surface-is-there-s-no.patch \ file://0001-libweston-Add-paint-node-destruction-into-weston_lay.patch \ + file://0001-backend-drm-don-t-leak-gem_handle_refcnt-in-drm_dest.patch \ + file://0002-backend-drm-always-create-gem_handle_refcnt-hash-tab.patch \ " |