From 077958364fc2ed1fbe36c1c32524e52b6150272e Mon Sep 17 00:00:00 2001 From: Yusuf Khan Date: Wed, 24 Aug 2022 12:07:52 -0500 Subject: [PATCH] drm: remove drivers trying to take the framebuffer Signed-off-by: Yusuf Khan --- kernel-open/conftest.sh | 2 ++ kernel-open/nvidia-drm/nvidia-drm-drv.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/kernel-open/conftest.sh b/kernel-open/conftest.sh index ee19e0374..1ab80a189 100755 --- a/kernel-open/conftest.sh +++ b/kernel-open/conftest.sh @@ -122,6 +122,7 @@ test_headers() { FILES="$FILES drm/drm_ioctl.h" FILES="$FILES drm/drm_device.h" FILES="$FILES drm/drm_mode_config.h" + FILES="$FILES drm/drm_aperture.h" FILES="$FILES dt-bindings/interconnect/tegra_icc_id.h" FILES="$FILES generated/autoconf.h" FILES="$FILES generated/compile.h" @@ -139,6 +140,7 @@ test_headers() { FILES="$FILES linux/sched/signal.h" FILES="$FILES linux/sched/task.h" FILES="$FILES linux/sched/task_stack.h" + FILES="$FILES linux/aperture.h" FILES="$FILES xen/ioemu.h" FILES="$FILES linux/fence.h" FILES="$FILES linux/dma-resv.h" diff --git a/kernel-open/nvidia-drm/nvidia-drm-drv.c b/kernel-open/nvidia-drm/nvidia-drm-drv.c index cf2080db3..b86ad2aff 100644 --- a/kernel-open/nvidia-drm/nvidia-drm-drv.c +++ b/kernel-open/nvidia-drm/nvidia-drm-drv.c @@ -84,6 +84,14 @@ #include #endif +#if defined(NV_DRM_DRM_APERTURE_H_PRESENT) +#include +#endif + +#if defined(NV_LINUX_APERTURE_H_PRESENT) +#include +#endif + static struct nv_drm_device *dev_list = NULL; #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE) @@ -941,6 +949,17 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info) NV_DRM_DEV_LOG_ERR(nv_dev, "Failed to register device"); goto failed_drm_register; } +/* + * Remove conflicting framebuffers, some framebuffers might interfere + * with the operation of nvidia-drm(eg. nouveau) so remove all that + * might. + */ +#if defined(NV_LINUX_APERTURE_H_PRESENT) + /* Linux 6.0-rc1 has this, the drm apreture func wraps this */ + aperture_remove_conflicting_pci_devices(to_pci_dev(device), "nvidia-drm"); +#elif defined(NV_DRM_DRM_APERTURE_H_PRESENT) + drm_aperture_remove_conflicting_pci_framebuffers(to_pci_dev(device), dev); +#endif /* Add NVIDIA-DRM device into list */