x11-drivers/nvidia-drivers: workaround kwin null deref issue in 580

Had hoped to not need to do this, but we need a viable stable
candidate by now and it could be a month+ again before another
release.

Leaving old (also affected) 580.142 as-is in case needed for
testing, will be removed later.

Closes: https://bugs.gentoo.org/971109
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2026-04-28 22:38:51 -04:00
parent a13e37deaa
commit 61579e7338
2 changed files with 58 additions and 0 deletions
@@ -0,0 +1,57 @@
This reverts the contents of nvidia-drm-fb.c back to the one used
by nvidia-drivers-580.126.18 as a temporary fix to avoid a NULL
dereference sometimes seen when using kwin.
NVIDIA is aware of the issue but no fix have been deployed as of
the writing of this. Unclear if reverting can cause different
issues but it is believed to be better than doing nothing.
USE=kernel-open is not known to be affected at the moment, so not
changing anything for the open variant.
https://bugs.gentoo.org/971109
https://forums.developer.nvidia.com/t/363409
--- a/kernel/nvidia-drm/nvidia-drm-fb.c
+++ b/kernel/nvidia-drm/nvidia-drm-fb.c
@@ -64,7 +64,5 @@
/* Free NvKmsKapiSurface associated with this framebuffer object */
- if (nv_fb->pSurface != NULL) {
- nvKms->destroySurface(nv_dev->pDevice, nv_fb->pSurface);
- }
+ nvKms->destroySurface(nv_dev->pDevice, nv_fb->pSurface);
__nv_drm_framebuffer_free(nv_fb);
@@ -142,5 +140,4 @@
struct nv_drm_gem_object *nv_gem;
struct drm_framebuffer *fb = &nv_fb->base;
- bool non_scanout_mem_backed = false;
uint32_t i;
int ret;
@@ -164,8 +161,4 @@
params.planes[i].offset = fb->offsets[i];
params.planes[i].pitch = fb->pitches[i];
-
- if (!nvKms->isVidmem(nv_gem->pMemory) && nv_dev->hasVideoMemory) {
- non_scanout_mem_backed = true;
- }
}
}
@@ -234,13 +227,8 @@
/* Create NvKmsKapiSurface */
- if (non_scanout_mem_backed) {
- /* Do not register drm_framebuffer against nvkms */
- nv_fb->pSurface = NULL;
- } else {
- nv_fb->pSurface = nvKms->createSurface(nv_dev->pDevice, &params);
- if (nv_fb->pSurface == NULL) {
- NV_DRM_DEV_DEBUG_DRIVER(nv_dev, "Failed to create NvKmsKapiSurface");
- goto fail;
- }
+ nv_fb->pSurface = nvKms->createSurface(nv_dev->pDevice, &params);
+ if (nv_fb->pSurface == NULL) {
+ NV_DRM_DEV_DEBUG_DRIVER(nv_dev, "Failed to create NvKmsKapiSurface");
+ goto fail;
}
@@ -101,6 +101,7 @@ QA_PREBUILT="lib/firmware/* usr/bin/* usr/lib*"
PATCHES=(
"${FILESDIR}"/nvidia-modprobe-390.141-uvm-perms.patch
"${FILESDIR}"/nvidia-settings-530.30.02-desktop.patch
"${FILESDIR}"/nvidia-drivers-580.159.03-null-deref.patch
)
pkg_setup() {