Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IN DISCUSSION] Provide packages for different NVidia driver types - mediated #3673

Closed

Conversation

jimklimov
Copy link
Contributor

@jimklimov jimklimov commented Nov 5, 2017

Alternative/follow-up to #3458 with proposed mediation of FS objects delivered by each driver in such a way that they can be installed all at once (or in any combination), and then the user can pick one to be enabled via IPS mediation.

NOTE: Still not quite sure how to properly address the driver_aliases in a way that drivers won't conflict over common cards, and won't claim ones they do not know either. And also having the active driver named nvidia is probably still a goal.

Hopefully would supersede the PR #5337 as well ;)

To build this in a local testing environment, you'd probably need to set up a local publisher, make publish the nvidia-select into it, and then piggy-back on encumbered builds support to keep the pkglint satisfied while publishing the actual driver packages and the nvidia metapackage (new package, old name). So something like:

:; ( cd components/openindiana/nvidia-select && make publish )
:; for N in 304 340 084 387 390 396 ; do ( \
    cd components/openindiana/nvidia-$N && make ENCUMBERED=yes publish ; \
   ) ; done
:; ( cd components/meta-packages/nvidia && make ENCUMBERED=yes publish )

and then you should be able to install them into a local test BE which would use this publisher (possibly using the full FMRIs to publisher+package names).

…d files and dirs into Makefile, break up the big install ruleset into better visible steps, and symlink back to original names to facilitate manifest generation
…ple-manifest.p5m.nvidia generated with the new recipe
…d files and dirs into Makefile, break up the big install ruleset into better visible steps, and symlink back to original names to facilitate manifest generation
…ple-manifest.p5m.nvidia generated with the new recipe
@kenmays
Copy link
Contributor

kenmays commented Nov 5, 2019

Main driver versions to use as of today:

nvidia-304 - 304.137
nvidia-340 - 340.107
nvidia-440 - 440.31

This covers the main Nvidia graphics product releases from Y2004->Y2019. The Nvidia PCI ID scanning starts from the most current video driver and fallbacks to the older driver until found or will fallback to the VESA driver if not found at all within the provided drivers.

# http://www.illumos.org/license/CDDL.
#
# Copyright 2017, Jim Klimov
# Portions Copyright 2003-2005 Sun Microsystems, Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about 'Portions Copyright' string. Do we have precedents?
I'd just put Sun copyright on top, if this file has Sun heritage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta remember now, not sure I can after so long :)

I'd guess this started by looking at ogl-select and at least modelling after the idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at current ogl-select, they are very dissimilar. So I must have started from something else back then :)

As for precedents, we have a few:

jim@jimoi:~/shared/oi-userland-tmp/components$ git grep -i 'portions copyright' | grep -v yyyy | wc -l
32
jim@jimoi:~/shared/oi-userland-tmp/components$ git grep -i 'portions copyright' | wc -l
1132

@jimklimov
Copy link
Contributor Author

@kenmays : addition of nvidia-440 in progress locally, lots of different file lists to adapt the recipes iteratively :)

@jimklimov
Copy link
Contributor Author

@kenmays : added nvidia-440 to the wad. Not sure if I have anything to do in practice about your comment on PCI IDs : as far as I can see, the original driver packages assume only one copy/version present and active in the system, so either there are PCI IDs listed that this one supports, or not.

This PR (and nvidia-select in particular) should allow switching the symlinked names, and ID-DRV mappings, to the currently chosen active driver version -- if someone has several nvidia-NNN packages installed for experiments, upgrades... eventually as a default preinstalled footprint or Live env maybe?

@kenmays
Copy link
Contributor

kenmays commented Nov 6, 2019

@jimklimov - I concur with the default footprint for Live DVD Env as a test method as I still have GeForce Go 7600/Quadro FX 5500 for legacy driver testing. If things go right, I can install a Live DVD and it'll pick the right driver for these old graphics cards without any user/human interaction (but we can bulletproof this through a future startup screen selection/installation script - if needed). If everything goes right, anything from Quadro RTX 8000 -> GeForce 6000-series is properly detected and driver selected.

Nvidia driver coverage:
Nvidia 440.x - covers GeForce RTX 20 series -> GeForce 400 series (primary)
Nvidia 340.x - covers GeForce 300 series-> GeForce 8000 series (secondary)
Nvidia 304.x - covers GeForce 7000 series -> GeForce 6000 series (tertiary)

I think the FreeBSD people are listening as they just updated their Nvidia driver revisions as well today:
See: https://www.freebsd.org/cgi/ports.cgi?query=nvidia&stype=name

The more, the merrier! ;>

@jimklimov
Copy link
Contributor Author

@kenmays : Any chance you could test this PR on hardware and/or propose the improvement implementations? :)

I might lack time (f)or imagination at the moment, but do not very well see how this current solution can help auto-detect the actual driver version to use... unless I made it two years ago already and forgot, Gallagher-style? :-)

I mean, what (IIRC) the nvidia-select script and service do is, essentially, ensure that the verbatim nvidia component of filenames (X11 and kernel driver) and directory names (a lot of these) points to one particular nvidia-NNN, and that this version's PCI IDs are recorded into system setup.

Thinking about it, if I get correctly what you could mean above, the script could probably look into the PCI ID mappings available in each installed nvidia-NNN package and into PCI IDs of the current hardware, (and track that it is in some auto mode vs. version preference set by user explicitly), and based on this pick a best-match video driver version. At least, this automagic makes sense and sounds neat, but I am not sure if it is in the code yet (and won't have time this week to look into it).

@despair86
Copy link
Contributor

I've got a GTX 1650, so i practically live on bleeding-edge (and suffer bugs)

@jimklimov
Copy link
Contributor Author

Did anyone have a chance to test this on real HW that is supported by the drivers, so merging the PR can proceed?

I see that a new PR to piecemeal bump the one driver provided by the distro was posted recently by @mnowak , and fear that in a few days i'd have to solve new merge conflicts in this PR... and later again, and again, seems in vain ;)

@kenmays
Copy link
Contributor

kenmays commented Jan 9, 2020

@jimklimov - Yes, tested the Nvidia 440.44 driver w/RTX 2080 & GT 630 cards. Hope we can move forward.

@mnowak
Copy link

mnowak commented Jan 9, 2020

I see that a new PR to piecemeal bump the one driver provided by the distro was posted recently by @mnowak , and fear that in a few days i'd have to solve new merge conflicts in this PR... and later again, and again, seems in vain ;)

You mentioned the wrong guy pal :)

install_mv_desktop_32: install_reloc_32
mv -f "$(PROTO_DIR)/usr/share/applications/nvidia-settings.desktop" \
"$(PROTO_DIR)/usr/share/applications/nvidia-settings-$(NVIDIA_DRIVER_MAJOR_VERSION).desktop" \
&& ln -s "nvidia-settings-$(NVIDIA_DRIVER_MAJOR_VERSION).desktop" \
Copy link
Contributor

@pyhalov pyhalov Jan 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this will not work as expected, we'll have several desktop files instead of one. Perhaps, simplify this by moving them and share/doc, share/icons to usr/share/NVIDIA-$(NVIDIA_DRIVER_MAJOR_VERSION)/some-subdirectory ?

;;
esac
done
shift "`/usr/bin/expr $OPTIND - 1`"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/bin/sh can handle `$(($OPTIND - 1))

cmd="$cmd $drvname"
drvname="`echo $drvname | /usr/bin/sed 's;.*/;;g'`"

/usr/bin/grep "^$drvname[ ]" $BASEDIR/etc/name_to_major > /dev/null 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need in full path, as we set PATH in the begining

then
for i in $alias
do
/usr/bin/egrep "^$drvname[ ]+$i" $BASEDIR/etc/driver_aliases>/dev/null 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

egrep -q ... 2>&1?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or perhaps even avoid masking egrep errors

}

reload_drv() {
unload_drv "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we really unload nvidia driver?

NVIDIA_VERSION_SMF="`svcprop -p options/NVIDIA_VERSION $SMF_FMRI`" \
&& [ -n "$NVIDIA_VERSION_SMF" ] && NVIDIA_VERSION="$NVIDIA_VERSION_SMF"

if [ "$SMF_ACTION" = start ] \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we set options/NVIDIA_VERSION and reboot?
Will we skip driver update?


if [ -z "${EXISTING_MEDIATOR_DATA-}" ] ; then
echo "INFO: setting mediator $MEDIATOR_NAME to $MEDIATOR_IMPL / $NVIDIA_VERSION under $BASEDIR ..." >&2
$ALTROOT_FLAG /usr/bin/pkg set-mediator \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use -R option instead of chroot for pkg?

@pyhalov
Copy link
Contributor

pyhalov commented Jan 10, 2020

Generally, this PR has one issue - overcomplicated installation logic for nvidia.
Earlier we did just

$(INSTALL_32):  $(BUILD_32)
        [ -d $(PROTO_DIR)/kernel/drv/amd64 ] || mkdir -p $(PROTO_DIR)/kernel/drv/amd64
        for i in kernel/drv/amd64/nvidia kernel/drv/nvidia.conf; do \
            cp $(SOURCE_DIR)/NVDAgraphicsr/reloc/$$i $(PROTO_DIR)/$$i; done
        rm -fr $(PROTO_DIR)/usr
        cp -a $(SOURCE_DIR)/NVDAgraphics/reloc $(PROTO_DIR)/usr
        $(COMPONENT_POST_INSTALL_ACTION)
        $(TOUCH) $@

Now we have several steps, including moving files to separate dirs, moving individual files and so on. This makes updates to new major version not so straightforward. Can we somehow simplify these steps? Like move everything to /usr/share/nvidia-XXX and create necessary symlinks in several loops?

@3eka
Copy link
Contributor

3eka commented Jan 10, 2020

I am running NVIDIA driver 440.31,REV=2019.10.27.02.19 (from nvidia site) on GK208B [GeForce GT 730] card, with no problem

@kenmays
Copy link
Contributor

kenmays commented Jan 10, 2020

Bump driver/graphics/nvidia to 440.44 in OI-IPS. Make it the new default.
Repackaged the legacy drivers in OI-IPS as: driver/graphics/nvidiaR304, driver/graphics/nvidiaR340
Closes #5337.
The Nvidia 440.40 driver provides 10 years of legacy support back to GeForce 400-series. We can then simplify this process much easier by just focusing on the one driver update - instead of three!

@Mno-hime
Copy link
Contributor

I really don't have the skills to review nor understand, the less to maintain this change.

I think we should bite the bullet and plainly and transparently update to a sensible new default, be it version 390 (#5337), which I researched to be OK for almost everyone, or 440, the default in recent Linux distros.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants