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, ¶ms); - 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, ¶ms); + if (nv_fb->pSurface == NULL) { + NV_DRM_DEV_DEBUG_DRIVER(nv_dev, "Failed to create NvKmsKapiSurface"); + goto fail; }