diff --git a/drivers/gpu/drm/tegra/include/uapi/drm/tegra_drm_next.h b/drivers/gpu/drm/tegra/include/uapi/drm/tegra_drm_next.h index e2637765..3ef63a59 100644 --- a/drivers/gpu/drm/tegra/include/uapi/drm/tegra_drm_next.h +++ b/drivers/gpu/drm/tegra/include/uapi/drm/tegra_drm_next.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: MIT */ -/* Copyright (c) 2012-2020 NVIDIA Corporation */ +/* Copyright (c) 2012-2025 NVIDIA Corporation */ #ifndef _UAPI_TEGRA_DRM_H_ #define _UAPI_TEGRA_DRM_H_ diff --git a/drivers/gpu/drm/tegra/uapi.c b/drivers/gpu/drm/tegra/uapi.c index 70de9bd3..b7cdbde0 100644 --- a/drivers/gpu/drm/tegra/uapi.c +++ b/drivers/gpu/drm/tegra/uapi.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2020 NVIDIA Corporation */ +/* Copyright (c) 2020-2025 NVIDIA Corporation */ #include #include @@ -13,6 +13,10 @@ #include "drm.h" #include "uapi.h" +static bool explicit_syncpt_free; +module_param(explicit_syncpt_free, bool, 0644); +MODULE_PARM_DESC(explicit_syncpt_free, "If enabled, syncpoints need to be explicitly freed via IOCTL or they will be left dangling when the fd is closed"); + static void tegra_drm_mapping_release(struct kref *ref) { struct tegra_drm_mapping *mapping = @@ -60,8 +64,16 @@ void tegra_drm_uapi_close_file(struct tegra_drm_file *file) xa_for_each(&file->contexts, id, context) tegra_drm_channel_context_close(context); - xa_for_each(&file->syncpoints, id, sp) - host1x_syncpt_put(sp); + /* + * If explicit_syncpt_free is enabled, users must free syncpoints + * explicitly or they will be left dangling. This prevents syncpoints + * from getting in an unexpected state if e.g. the application crashes. + * Obviously only usable on particularly locked down configurations. + */ + if (!explicit_syncpt_free) { + xa_for_each(&file->syncpoints, id, sp) + host1x_syncpt_put(sp); + } xa_destroy(&file->contexts); xa_destroy(&file->syncpoints); diff --git a/drivers/gpu/drm/tegra/uapi.h b/drivers/gpu/drm/tegra/uapi.h index 3c8b24ae..5f9c82c7 100644 --- a/drivers/gpu/drm/tegra/uapi.h +++ b/drivers/gpu/drm/tegra/uapi.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* Copyright (c) 2020 NVIDIA Corporation */ +/* Copyright (c) 2020-2025 NVIDIA Corporation */ #ifndef _TEGRA_DRM_UAPI_H #define _TEGRA_DRM_UAPI_H