package/nvidia-driver: CUDA support does not require X.org
authorYann E. MORIN <yann.morin.1998@free.fr>
Tue, 31 Mar 2015 17:45:34 +0000 (19:45 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 1 Apr 2015 21:24:44 +0000 (23:24 +0200)
Currently, nvidia-driver always installs the X.org driver, assuming this
is a requirement for all functionalities provided by nvidia-driver, thus
pulling in quite a bunch of X.org packages.

However, it is perfectly legit to be doing CUDA (and OpenCL) work
without the full X.org stack, and indeed the NVidia CUDA and OpenCL
libraries do not require the X.org stack.

Split the configuration so that it is posible to install the different
parts independently from each others, so that CUDA can be installed all
on its own.

Reported-by: Al West <al.west@v-nova.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Al West <al.west@v-nova.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/nvidia-driver/Config.in
package/nvidia-driver/nvidia-driver.mk

index cd7fc958e0efc44a7c67063b4f3d64141699c3fe..a63576cff1552ec0ca270a2e7e6cc445fb5665d6 100644 (file)
@@ -1,12 +1,25 @@
-comment "nvidia-driver needs an (e)glibc toolchain and a modular Xorg server"
+comment "nvidia-driver needs an (e)glibc toolchain"
        depends on BR2_i386 || BR2_x86_64
-       depends on !BR2_TOOLCHAIN_USES_GLIBC \
-               || !BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR
+       depends on !BR2_TOOLCHAIN_USES_GLIBC
 
 config BR2_PACKAGE_NVIDIA_DRIVER
        bool "nvidia-driver"
        depends on BR2_i386 || BR2_x86_64
        depends on BR2_TOOLCHAIN_USES_GLIBC
+       help
+         The binary-only driver blob for NVidia cards.
+         This is the userland part only.
+
+         http://www.nvidia.com/
+
+if BR2_PACKAGE_NVIDIA_DRIVER
+
+comment "nvidia-driver X.org drivers needs a modular Xorg server"
+       depends on !BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR
+
+config BR2_PACKAGE_NVIDIA_DRIVER_XORG
+       bool "X.org drivers"
+       default y
        depends on BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR
        select BR2_PACKAGE_MESA3D_HEADERS
        select BR2_PACKAGE_XLIB_LIBX11
@@ -14,13 +27,8 @@ config BR2_PACKAGE_NVIDIA_DRIVER
        select BR2_PACKAGE_HAS_LIBGL
        select BR2_PACKAGE_HAS_LIBEGL
        select BR2_PACKAGE_HAS_LIBGLES
-       help
-         The binary-only driver blob for NVidia cards.
-         This is the userland part only.
 
-         http://www.nvidia.com/
-
-if BR2_PACKAGE_NVIDIA_DRIVER
+if BR2_PACKAGE_NVIDIA_DRIVER_XORG
 
 config BR2_PACKAGE_PROVIDES_LIBGL
        default "nvidia-driver"
@@ -31,13 +39,6 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
 config BR2_PACKAGE_PROVIDES_LIBGLES
        default "nvidia-driver"
 
-config BR2_PACKAGE_NVIDIA_DRIVER_CUDA
-       bool "CUDA support"
-
-config BR2_PACKAGE_NVIDIA_DRIVER_OPENCL
-       bool "OpenCL support"
-       depends on BR2_PACKAGE_NVIDIA_DRIVER_CUDA
-
 config BR2_PACKAGE_NVIDIA_DRIVER_PRIVATE_LIBS
        bool "Install private libraries"
        help
@@ -49,6 +50,15 @@ config BR2_PACKAGE_NVIDIA_DRIVER_PRIVATE_LIBS
          Say 'y' here if you plan on running a program that uses
          those private libraries.
 
+endif # BR2_PACKAGE_NVIDIA_DRIVER_XORG
+
+config BR2_PACKAGE_NVIDIA_DRIVER_CUDA
+       bool "CUDA support"
+
+config BR2_PACKAGE_NVIDIA_DRIVER_OPENCL
+       bool "OpenCL support"
+       depends on BR2_PACKAGE_NVIDIA_DRIVER_CUDA
+
 comment "nvidia kernel module needs a kernel to be built"
        depends on !BR2_LINUX_KERNEL
 
index 4605d02c9464caf0772d9b1e463093a45b4ea3bb..454209ac13e9eb733f038cd1ae3fe953b562de32 100644 (file)
@@ -13,6 +13,8 @@ NVIDIA_DRIVER_LICENSE_FILES = LICENSE
 NVIDIA_DRIVER_REDISTRIBUTE = NO
 NVIDIA_DRIVER_INSTALL_STAGING = YES
 
+ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_XORG),y)
+
 # Since nvidia-driver are binary blobs, the below dependencies are not
 # strictly speaking build dependencies of nvidia-driver. However, they
 # are build dependencies of packages that depend on nvidia-driver, so
@@ -38,15 +40,6 @@ NVIDIA_DRIVER_LIBS = \
        libvdpau libvdpau_nvidia \
        libnvidia-ml
 
-ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_CUDA),y)
-NVIDIA_DRIVER_LIBS += libcuda libnvidia-compiler libnvcuvid libnvidia-encode
-endif
-
-ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_OPENCL),y)
-NVIDIA_DRIVER_LIBS_NO_VERSION += libOpenCL.so.1.0.0
-NVIDIA_DRIVER_LIBS += libnvidia-opencl
-endif
-
 # Those libraries are 'private' libraries requiring an agreement with
 # NVidia to develop code for those libs. There seems to be no restriction
 # on using those libraries (e.g. if the user has such an agreement, or
@@ -60,6 +53,17 @@ NVIDIA_DRIVER_X_MODS = drivers/nvidia_drv.so \
        extensions/libglx.so.$(NVIDIA_DRIVER_VERSION) \
        libnvidia-wfb.so.$(NVIDIA_DRIVER_VERSION)
 
+endif # X drivers
+
+ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_CUDA),y)
+NVIDIA_DRIVER_LIBS += libcuda libnvidia-compiler libnvcuvid libnvidia-encode
+endif
+
+ifeq ($(BR2_PACKAGE_NVIDIA_DRIVER_OPENCL),y)
+NVIDIA_DRIVER_LIBS_NO_VERSION += libOpenCL.so.1.0.0
+NVIDIA_DRIVER_LIBS += libnvidia-opencl
+endif
+
 # The downloaded archive is in fact an auto-extract script. So, it can run
 # virtually everywhere, and it is fine enough to provide useful options.
 # Except it can't extract into an existing (even empty) directory.