Merge pull request #547 from NVIDIA/revert-490-main

Revert "Inject additional libraries required for full display functionality"
This commit is contained in:
Evan Lezar 2024-06-17 11:47:36 +02:00 committed by GitHub
commit 33369861fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,9 +56,6 @@ func NewGraphicsMountsDiscoverer(logger logger.Interface, driver *root.Driver, n
driver.Root, driver.Root,
[]string{ []string{
"libnvidia-egl-gbm.so.*", "libnvidia-egl-gbm.so.*",
"libnvidia-egl-wayland.so.*",
"libnvidia-allocator.so.*",
"libnvidia-vulkan-producer.so.*",
}, },
) )
@ -77,75 +74,17 @@ func NewGraphicsMountsDiscoverer(logger logger.Interface, driver *root.Driver, n
}, },
) )
symlinks := newGraphicsDriverSymlinks(logger, libraries, nvidiaCDIHookPath)
xorg := optionalXorgDiscoverer(logger, driver, nvidiaCDIHookPath) xorg := optionalXorgDiscoverer(logger, driver, nvidiaCDIHookPath)
discover := Merge( discover := Merge(
libraries, libraries,
jsonMounts, jsonMounts,
symlinks,
xorg, xorg,
) )
return discover, nil return discover, nil
} }
type graphicsDriverSymlinks struct {
None
logger logger.Interface
libraries Discover
nvidiaCDIHookPath string
}
var _ Discover = (*graphicsDriverSymlinks)(nil)
func newGraphicsDriverSymlinks(logger logger.Interface, libraries Discover, nvidiaCDIHookPath string) Discover {
return &graphicsDriverSymlinks{
logger: logger,
libraries: libraries,
nvidiaCDIHookPath: nvidiaCDIHookPath,
}
}
// Create necessary library symlinks for graphics drivers
func (d graphicsDriverSymlinks) Hooks() ([]Hook, error) {
mounts, err := d.libraries.Mounts()
if err != nil {
return nil, fmt.Errorf("failed to get library mounts: %v", err)
}
links := []string{}
for _, mount := range mounts {
filename := filepath.Base(mount.HostPath)
// nvidia-drm_gbm.so is a symlink to libnvidia-allocator.so
// Make sure this is actually available
if strings.HasPrefix(filename, "libnvidia-allocator.so.") {
linkDir := filepath.Dir(mount.Path)
linkPath := filepath.Join(linkDir, "gbm", "nvidia-drm_gbm.so")
target := filepath.Join("..", filename)
links = append(links, fmt.Sprintf("%s::%s", target, linkPath))
}
// Address the vulkan-producer lib for nvidia drivers prior driver version 545
if strings.HasPrefix(filename, "libnvidia-vulkan-producer.so.") {
linkDir := filepath.Dir(mount.Path)
linkPath := filepath.Join(linkDir, "libnvidia-vulkan-producer.so")
links = append(links, fmt.Sprintf("%s::%s", filename, linkPath))
}
}
if len(links) == 0 {
return nil, nil
}
hooks := CreateCreateSymlinkHook(d.nvidiaCDIHookPath, links)
return hooks.Hooks()
}
type drmDevicesByPath struct { type drmDevicesByPath struct {
None None
logger logger.Interface logger logger.Interface
@ -312,26 +251,6 @@ func optionalXorgDiscoverer(logger logger.Interface, driver *root.Driver, nvidia
return xorg return xorg
} }
func buildXOrgSearchPaths(libRoot string) []string {
paths := []string{
libRoot + "/nvidia/xorg",
}
directories := []string{"drivers", "extensions"}
pathOptions := []string{"modules", "modules/updates"}
prefixes := []string{libRoot + "/xorg", "/usr/lib/xorg", "/usr/lib64/xorg", "/usr/X11R6/lib", "/usr/X11R6/lib64"}
for _, prefix := range prefixes {
for _, pathOption := range pathOptions {
for _, directory := range directories {
paths = append(paths, prefix+"/"+pathOption+"/"+directory)
}
}
}
return paths
}
func newXorgDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCDIHookPath string) (Discover, error) { func newXorgDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCDIHookPath string) (Discover, error) {
libCudaPaths, err := cuda.New( libCudaPaths, err := cuda.New(
driver.Libraries(), driver.Libraries(),
@ -352,13 +271,13 @@ func newXorgDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCDIHo
lookup.NewFileLocator( lookup.NewFileLocator(
lookup.WithLogger(logger), lookup.WithLogger(logger),
lookup.WithRoot(driver.Root), lookup.WithRoot(driver.Root),
lookup.WithSearchPaths(buildXOrgSearchPaths(libRoot)...), lookup.WithSearchPaths(libRoot, "/usr/lib/x86_64-linux-gnu"),
lookup.WithCount(1), lookup.WithCount(1),
), ),
driver.Root, driver.Root,
[]string{ []string{
"nvidia_drv.so", "nvidia/xorg/nvidia_drv.so",
fmt.Sprintf("libglxserver_nvidia.so.%s", version), fmt.Sprintf("nvidia/xorg/libglxserver_nvidia.so.%s", version),
}, },
) )
xorgHooks := xorgHooks{ xorgHooks := xorgHooks{
@ -371,10 +290,7 @@ func newXorgDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCDIHo
logger, logger,
driver.Configs(), driver.Configs(),
driver.Root, driver.Root,
[]string{ []string{"X11/xorg.conf.d/10-nvidia.conf"},
"X11/xorg.conf.d/10-nvidia.conf",
"X11/xorg.conf.d/nvidia-drm-outputclass.conf",
},
) )
d := Merge( d := Merge(