mirror of
				https://github.com/vdsm/virtual-dsm.git
				synced 2025-11-04 17:04:52 +08:00 
			
		
		
		
	feat: GPU passthrough support
feat: GPU passthrough support
This commit is contained in:
		
						commit
						c2cd9f52f4
					
				@ -29,6 +29,7 @@ RUN apt-get update && apt-get -y upgrade && \
 | 
			
		||||
	ca-certificates \
 | 
			
		||||
	netcat-openbsd \
 | 
			
		||||
	qemu-system-x86 \
 | 
			
		||||
	xserver-xorg-video-intel \
 | 
			
		||||
    && apt-get clean \
 | 
			
		||||
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								readme.md
									
									
									
									
									
								
							@ -170,6 +170,17 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti
 | 
			
		||||
 | 
			
		||||
    With this method, you are able to switch between different versions while keeping your file data.
 | 
			
		||||
 | 
			
		||||
  * ### How do I passthrough my GPU?
 | 
			
		||||
 | 
			
		||||
    To enable this feature, add the following lines to your compose file:
 | 
			
		||||
 | 
			
		||||
    ```yaml
 | 
			
		||||
    environment:
 | 
			
		||||
        GPU: "Y"
 | 
			
		||||
    devices:
 | 
			
		||||
        - /dev/dri
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
  * ### What are the differences compared to the standard DSM?
 | 
			
		||||
 | 
			
		||||
    There are only two minor differences: the Virtual Machine Manager package is not provided, and Surveillance Station doesn't include any free licenses.
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ set -Eeuo pipefail
 | 
			
		||||
# Docker environment variables
 | 
			
		||||
 | 
			
		||||
: ${URL:=''}            # URL of the PAT file
 | 
			
		||||
: ${GPU:='N'}         # Enable GPU passthrough
 | 
			
		||||
: ${DEBUG:='N'}         # Enable debug mode
 | 
			
		||||
: ${ALLOCATE:='Y'}      # Preallocate diskspace
 | 
			
		||||
: ${ARGUMENTS:=''}      # Extra QEMU parameters
 | 
			
		||||
@ -81,6 +82,11 @@ EXTRA_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
 | 
			
		||||
EXTRA_OPTS="$EXTRA_OPTS -object rng-random,id=objrng0,filename=/dev/urandom"
 | 
			
		||||
EXTRA_OPTS="$EXTRA_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
 | 
			
		||||
 | 
			
		||||
if [[ "${GPU}" == [Yy1]* ]]; then
 | 
			
		||||
  DEF_OPTS="-nodefaults -boot strict=on -display egl-headless,rendernode=/dev/dri/renderD128"
 | 
			
		||||
  DEF_OPTS="${DEF_OPTS} -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
ARGS="${DEF_OPTS} ${CPU_OPTS} ${RAM_OPTS} ${MAC_OPTS} ${MON_OPTS} ${SERIAL_OPTS} ${NET_OPTS} ${DISK_OPTS} ${EXTRA_OPTS} ${ARGUMENTS}"
 | 
			
		||||
ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user