From 7365aad6161ed2da1f31d6e30603346e8302d381 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 18 Oct 2024 10:28:03 +0100 Subject: x11-drivers/nvidia-drivers: add fbdev_ttm detection for kernel 6.11 (https://gitweb.gentoo.org/repo/gentoo.git/commit/x11-drivers/nvidia-drivers?id=86de42c9fddf3c7a693b77d3662a2677d2b402f3) --- ...idia-drivers-550.107.02-kernel-6.11-fbdev.patch | 186 +++++++++++++++++++++ .../nvidia-drivers-dkms-550.107.02-r1.ebuild | 52 ++++++ .../nvidia-drivers-dkms-550.107.02.ebuild | 51 ------ 3 files changed, 238 insertions(+), 51 deletions(-) create mode 100644 sys-kernel/nvidia-drivers-dkms/files/nvidia-drivers-550.107.02-kernel-6.11-fbdev.patch create mode 100644 sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02-r1.ebuild delete mode 100644 sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02.ebuild (limited to 'sys-kernel') diff --git a/sys-kernel/nvidia-drivers-dkms/files/nvidia-drivers-550.107.02-kernel-6.11-fbdev.patch b/sys-kernel/nvidia-drivers-dkms/files/nvidia-drivers-550.107.02-kernel-6.11-fbdev.patch new file mode 100644 index 00000000..047078dd --- /dev/null +++ b/sys-kernel/nvidia-drivers-dkms/files/nvidia-drivers-550.107.02-kernel-6.11-fbdev.patch @@ -0,0 +1,186 @@ +diff '--color=auto' -Nur a/kernel/conftest.sh b/kernel/conftest.sh +--- a/kernel/conftest.sh 2024-07-24 23:57:19.000000000 +0100 ++++ b/kernel/conftest.sh 2024-10-18 10:22:27.367073132 +0100 +@@ -6593,6 +6593,25 @@ + compile_check_conftest "$CODE" "NV_DRM_FBDEV_GENERIC_SETUP_PRESENT" "" "functions" + ;; + ++ drm_fbdev_ttm_setup) ++ # ++ # Determine whether drm_fbdev_ttm_setup is present. ++ # ++ # Added by commit 9060d7f49376 ("drm/fb-helper: Finish the ++ # generic fbdev emulation") in v4.19. ++ # ++ CODE=" ++ #include ++ #if defined(NV_DRM_DRM_FBDEV_TTM_H_PRESENT) ++ #include ++ #endif ++ void conftest_drm_fbdev_ttm_setup(void) { ++ drm_fbdev_ttm_setup(); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_DRM_FBDEV_TTM_SETUP_PRESENT" "" "functions" ++ ;; ++ + drm_aperture_remove_conflicting_pci_framebuffers) + # + # Determine whether drm_aperture_remove_conflicting_pci_framebuffers is present. +diff '--color=auto' -Nur a/kernel/header-presence-tests.mk b/kernel/header-presence-tests.mk +--- a/kernel/header-presence-tests.mk 2024-07-24 23:57:19.000000000 +0100 ++++ b/kernel/header-presence-tests.mk 2024-10-18 10:22:27.368073132 +0100 +@@ -15,6 +15,7 @@ + drm/drm_atomic_uapi.h \ + drm/drm_drv.h \ + drm/drm_fbdev_generic.h \ ++ drm/drm_fbdev_ttm.h \ + drm/drm_framebuffer.h \ + drm/drm_connector.h \ + drm/drm_probe_helper.h \ +diff '--color=auto' -Nur a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c +--- a/kernel/nvidia-drm/nvidia-drm-drv.c 2024-07-25 00:22:50.000000000 +0100 ++++ b/kernel/nvidia-drm/nvidia-drm-drv.c 2024-10-18 10:22:27.368073132 +0100 +@@ -73,6 +73,10 @@ + #include + #endif + ++#if defined(NV_DRM_DRM_FBDEV_TTM_H_PRESENT) ++#include ++#endif ++ + #include + #include + +@@ -1823,7 +1827,11 @@ + drm_aperture_remove_conflicting_pci_framebuffers(pdev, nv_drm_driver.name); + #endif + } ++#if defined(NV_DRM_FBDEV_TTM_AVAILABLE) ++ drm_fbdev_ttm_setup(dev, 32); ++#else + drm_fbdev_generic_setup(dev, 32); ++#endif + } + #endif /* defined(NV_DRM_FBDEV_GENERIC_AVAILABLE) */ + +diff '--color=auto' -Nur a/kernel/nvidia-drm/nvidia-drm-os-interface.h b/kernel/nvidia-drm/nvidia-drm-os-interface.h +--- a/kernel/nvidia-drm/nvidia-drm-os-interface.h 2024-07-25 00:22:50.000000000 +0100 ++++ b/kernel/nvidia-drm/nvidia-drm-os-interface.h 2024-10-18 10:22:27.368073132 +0100 +@@ -58,8 +58,11 @@ + #error "Need to define kernel timer callback primitives for this OS" + #endif + +-#if defined(NV_DRM_FBDEV_GENERIC_SETUP_PRESENT) && defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_PRESENT) ++#if (defined(NV_DRM_FBDEV_GENERIC_SETUP_PRESENT) || defined(NV_DRM_FBDEV_TTM_SETUP_PRESENT)) && defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_PRESENT) + #define NV_DRM_FBDEV_GENERIC_AVAILABLE ++#if defined(NV_DRM_FBDEV_TTM_SETUP_PRESENT) ++#define NV_DRM_FBDEV_TTM_AVAILABLE ++#endif + #endif + + struct page; +diff '--color=auto' -Nur a/kernel/nvidia-drm/nvidia-drm-sources.mk b/kernel/nvidia-drm/nvidia-drm-sources.mk +--- a/kernel/nvidia-drm/nvidia-drm-sources.mk 2024-07-24 23:59:33.000000000 +0100 ++++ b/kernel/nvidia-drm/nvidia-drm-sources.mk 2024-10-18 10:22:27.368073132 +0100 +@@ -67,6 +67,7 @@ + NV_CONFTEST_FUNCTION_COMPILE_TESTS += sync_file_get_fence + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_conflicting_pci_framebuffers + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fbdev_generic_setup ++NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fbdev_ttm_setup + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_attach_hdr_output_metadata_property + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_helper_crtc_enable_color_mgmt + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_crtc_enable_color_mgmt +diff '--color=auto' -Nur a/kernel-open/conftest.sh b/kernel-open/conftest.sh +--- a/kernel-open/conftest.sh 2024-07-24 23:57:19.000000000 +0100 ++++ b/kernel-open/conftest.sh 2024-10-18 10:22:27.369073132 +0100 +@@ -6593,6 +6593,25 @@ + compile_check_conftest "$CODE" "NV_DRM_FBDEV_GENERIC_SETUP_PRESENT" "" "functions" + ;; + ++ drm_fbdev_ttm_setup) ++ # ++ # Determine whether drm_fbdev_ttm_setup is present. ++ # ++ # Added by commit 9060d7f49376 ("drm/fb-helper: Finish the ++ # generic fbdev emulation") in v4.19. ++ # ++ CODE=" ++ #include ++ #if defined(NV_DRM_DRM_FBDEV_TTM_H_PRESENT) ++ #include ++ #endif ++ void conftest_drm_fbdev_ttm_setup(void) { ++ drm_fbdev_ttm_setup(); ++ }" ++ ++ compile_check_conftest "$CODE" "NV_DRM_FBDEV_TTM_SETUP_PRESENT" "" "functions" ++ ;; ++ + drm_aperture_remove_conflicting_pci_framebuffers) + # + # Determine whether drm_aperture_remove_conflicting_pci_framebuffers is present. +diff '--color=auto' -Nur a/kernel-open/header-presence-tests.mk b/kernel-open/header-presence-tests.mk +--- a/kernel-open/header-presence-tests.mk 2024-07-24 23:57:19.000000000 +0100 ++++ b/kernel-open/header-presence-tests.mk 2024-10-18 10:22:27.369073132 +0100 +@@ -15,6 +15,7 @@ + drm/drm_atomic_uapi.h \ + drm/drm_drv.h \ + drm/drm_fbdev_generic.h \ ++ drm/drm_fbdev_ttm.h \ + drm/drm_framebuffer.h \ + drm/drm_connector.h \ + drm/drm_probe_helper.h \ +diff '--color=auto' -Nur a/kernel-open/nvidia-drm/nvidia-drm-drv.c b/kernel-open/nvidia-drm/nvidia-drm-drv.c +--- a/kernel-open/nvidia-drm/nvidia-drm-drv.c 2024-07-25 00:22:48.000000000 +0100 ++++ b/kernel-open/nvidia-drm/nvidia-drm-drv.c 2024-10-18 10:22:27.370073132 +0100 +@@ -73,6 +73,10 @@ + #include + #endif + ++#if defined(NV_DRM_DRM_FBDEV_TTM_H_PRESENT) ++#include ++#endif ++ + #include + #include + +@@ -1823,7 +1827,11 @@ + drm_aperture_remove_conflicting_pci_framebuffers(pdev, nv_drm_driver.name); + #endif + } ++#if defined(NV_DRM_FBDEV_TTM_AVAILABLE) ++ drm_fbdev_ttm_setup(dev, 32); ++#else + drm_fbdev_generic_setup(dev, 32); ++#endif + } + #endif /* defined(NV_DRM_FBDEV_GENERIC_AVAILABLE) */ + +diff '--color=auto' -Nur a/kernel-open/nvidia-drm/nvidia-drm-os-interface.h b/kernel-open/nvidia-drm/nvidia-drm-os-interface.h +--- a/kernel-open/nvidia-drm/nvidia-drm-os-interface.h 2024-07-25 00:22:48.000000000 +0100 ++++ b/kernel-open/nvidia-drm/nvidia-drm-os-interface.h 2024-10-18 10:22:27.370073132 +0100 +@@ -58,8 +58,11 @@ + #error "Need to define kernel timer callback primitives for this OS" + #endif + +-#if defined(NV_DRM_FBDEV_GENERIC_SETUP_PRESENT) && defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_PRESENT) ++#if (defined(NV_DRM_FBDEV_GENERIC_SETUP_PRESENT) || defined(NV_DRM_FBDEV_TTM_SETUP_PRESENT)) && defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_PRESENT) + #define NV_DRM_FBDEV_GENERIC_AVAILABLE ++#if defined(NV_DRM_FBDEV_TTM_SETUP_PRESENT) ++#define NV_DRM_FBDEV_TTM_AVAILABLE ++#endif + #endif + + struct page; +diff '--color=auto' -Nur a/kernel-open/nvidia-drm/nvidia-drm-sources.mk b/kernel-open/nvidia-drm/nvidia-drm-sources.mk +--- a/kernel-open/nvidia-drm/nvidia-drm-sources.mk 2024-07-24 23:59:33.000000000 +0100 ++++ b/kernel-open/nvidia-drm/nvidia-drm-sources.mk 2024-10-18 10:22:27.370073132 +0100 +@@ -67,6 +67,7 @@ + NV_CONFTEST_FUNCTION_COMPILE_TESTS += sync_file_get_fence + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_conflicting_pci_framebuffers + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fbdev_generic_setup ++NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fbdev_ttm_setup + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_attach_hdr_output_metadata_property + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_helper_crtc_enable_color_mgmt + NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_crtc_enable_color_mgmt diff --git a/sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02-r1.ebuild b/sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02-r1.ebuild new file mode 100644 index 00000000..dca545f1 --- /dev/null +++ b/sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02-r1.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=8 + +NV_URI="http://us.download.nvidia.com/XFree86/" +AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" + +DESCRIPTION="NVIDIA driver sources for linux" +HOMEPAGE="http://www.nvidia.com/" +SRC_URI="amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )" + +LICENSE="GPL-2 NVIDIA-r2" +SLOT="5" +KEYWORDS="amd64" +IUSE="kernel-open" +RESTRICT="strip" + +DEPEND="sys-kernel/dkms" +RDEPEND="${DEPEND} + !!sys-kernel/nvidia-drivers-dkms:3 + !!sys-kernel/nvidia-drivers-dkms:4" + +PATCHES=( + "${FILESDIR}"/dkms550.patch + "${FILESDIR}"/nvidia-drivers-550.107.02-kernel-6.11-fbdev.patch +) + +S="${WORKDIR}/${AMD64_NV_PACKAGE}" + +src_unpack() { + sh ${DISTDIR}/${AMD64_NV_PACKAGE}.run --extract-only +} + +src_install() { + dodir usr/src/${P} + insinto usr/src/${P} + if use kernel-open; then + doins -r "${S}"/kernel-open/* + else + doins -r "${S}"/kernel/* + fi +} + +pkg_postinst() { + dkms add ${PN}/${PV} +} + +pkg_prerm() { + dkms remove ${PN}/${PV} --all +} diff --git a/sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02.ebuild b/sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02.ebuild deleted file mode 100644 index 1bc82c27..00000000 --- a/sys-kernel/nvidia-drivers-dkms/nvidia-drivers-dkms-550.107.02.ebuild +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 1999-2016 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -EAPI=8 - -NV_URI="http://us.download.nvidia.com/XFree86/" -AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}" - -DESCRIPTION="NVIDIA driver sources for linux" -HOMEPAGE="http://www.nvidia.com/" -SRC_URI="amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )" - -LICENSE="GPL-2 NVIDIA-r2" -SLOT="5" -KEYWORDS="amd64" -IUSE="kernel-open" -RESTRICT="strip" - -DEPEND="sys-kernel/dkms" -RDEPEND="${DEPEND} - !!sys-kernel/nvidia-drivers-dkms:3 - !!sys-kernel/nvidia-drivers-dkms:4" - -PATCHES=( - "${FILESDIR}"/dkms550.patch -) - -S="${WORKDIR}/${AMD64_NV_PACKAGE}" - -src_unpack() { - sh ${DISTDIR}/${AMD64_NV_PACKAGE}.run --extract-only -} - -src_install() { - dodir usr/src/${P} - insinto usr/src/${P} - if use kernel-open; then - doins -r "${S}"/kernel-open/* - else - doins -r "${S}"/kernel/* - fi -} - -pkg_postinst() { - dkms add ${PN}/${PV} -} - -pkg_prerm() { - dkms remove ${PN}/${PV} --all -} -- cgit v1.2.3